if (function(global, factory) {
    "object" == typeof exports && "undefined" != typeof module ? module.exports = factory() : "function" == typeof define && define.amd ? define(factory) : global.ES6Promise = factory();
}(this, function() {
    "use strict";
    function isFunction(x) {
        return "function" == typeof x;
    }
    var isArray = Array.isArray ? Array.isArray : function(x) {
        return "[object Array]" === Object.prototype.toString.call(x);
    }, len = 0, vertxNext = void 0, customSchedulerFn = void 0, asap = function(callback, arg) {
        queue[len] = callback, queue[len + 1] = arg, 2 === (len += 2) && (customSchedulerFn ? customSchedulerFn(flush) : scheduleFlush());
    };
    var browserWindow = "undefined" != typeof window ? window : void 0, browserGlobal = browserWindow || {}, BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver, isNode = "undefined" == typeof self && "undefined" != typeof process && "[object process]" === {}.toString.call(process), isWorker = "undefined" != typeof Uint8ClampedArray && "undefined" != typeof importScripts && "undefined" != typeof MessageChannel;
    function useSetTimeout() {
        var globalSetTimeout = setTimeout;
        return function() {
            return globalSetTimeout(flush, 1);
        };
    }
    var queue = new Array(1e3);
    function flush() {
        for (var i = 0; i < len; i += 2) {
            (0, queue[i])(queue[i + 1]), queue[i] = void 0, queue[i + 1] = void 0;
        }
        len = 0;
    }
    var channel, iterations, observer, node, scheduleFlush = void 0;
    function then(onFulfillment, onRejection) {
        var parent = this, child = new this.constructor(noop);
        void 0 === child[PROMISE_ID] && makePromise(child);
        var _state = parent._state;
        if (_state) {
            var callback = arguments[_state - 1];
            asap(function() {
                return invokeCallback(_state, child, callback, parent._result);
            });
        } else subscribe(parent, child, onFulfillment, onRejection);
        return child;
    }
    function resolve$1(object) {
        if (object && "object" == typeof object && object.constructor === this) return object;
        var promise = new this(noop);
        return resolve(promise, object), promise;
    }
    isNode ? scheduleFlush = function() {
        return process.nextTick(flush);
    } : BrowserMutationObserver ? (iterations = 0, observer = new BrowserMutationObserver(flush), 
    node = document.createTextNode(""), observer.observe(node, {
        characterData: !0
    }), scheduleFlush = function() {
        node.data = iterations = ++iterations % 2;
    }) : isWorker ? ((channel = new MessageChannel()).port1.onmessage = flush, scheduleFlush = function() {
        return channel.port2.postMessage(0);
    }) : scheduleFlush = void 0 === browserWindow && "function" == typeof require ? function() {
        try {
            var vertx = Function("return this")().require("vertx");
            return void 0 !== (vertxNext = vertx.runOnLoop || vertx.runOnContext) ? function() {
                vertxNext(flush);
            } : useSetTimeout();
        } catch (e) {
            return useSetTimeout();
        }
    }() : useSetTimeout();
    var PROMISE_ID = Math.random().toString(36).substring(2);
    function noop() {}
    var PENDING = void 0, FULFILLED = 1, REJECTED = 2, TRY_CATCH_ERROR = {
        error: null
    };
    function getThen(promise) {
        try {
            return promise.then;
        } catch (error) {
            return TRY_CATCH_ERROR.error = error, TRY_CATCH_ERROR;
        }
    }
    function handleMaybeThenable(promise, maybeThenable, then$$1) {
        maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1 ? function(promise, thenable) {
            thenable._state === FULFILLED ? fulfill(promise, thenable._result) : thenable._state === REJECTED ? reject(promise, thenable._result) : subscribe(thenable, void 0, function(value) {
                return resolve(promise, value);
            }, function(reason) {
                return reject(promise, reason);
            });
        }(promise, maybeThenable) : then$$1 === TRY_CATCH_ERROR ? (reject(promise, TRY_CATCH_ERROR.error), 
        TRY_CATCH_ERROR.error = null) : void 0 === then$$1 ? fulfill(promise, maybeThenable) : isFunction(then$$1) ? function(promise, thenable, then$$1) {
            asap(function(promise) {
                var sealed = !1, error = function(then$$1, value, fulfillmentHandler, rejectionHandler) {
                    try {
                        then$$1.call(value, fulfillmentHandler, rejectionHandler);
                    } catch (e) {
                        return e;
                    }
                }(then$$1, thenable, function(value) {
                    sealed || (sealed = !0, thenable !== value ? resolve(promise, value) : fulfill(promise, value));
                }, function(reason) {
                    sealed || (sealed = !0, reject(promise, reason));
                }, promise._label);
                !sealed && error && (sealed = !0, reject(promise, error));
            }, promise);
        }(promise, maybeThenable, then$$1) : fulfill(promise, maybeThenable);
    }
    function resolve(promise, value) {
        var x, type;
        promise === value ? reject(promise, new TypeError("You cannot resolve a promise with itself")) : (type = typeof (x = value), 
        null === x || "object" !== type && "function" !== type ? fulfill(promise, value) : handleMaybeThenable(promise, value, getThen(value)));
    }
    function publishRejection(promise) {
        promise._onerror && promise._onerror(promise._result), publish(promise);
    }
    function fulfill(promise, value) {
        promise._state === PENDING && (promise._result = value, promise._state = FULFILLED, 
        0 !== promise._subscribers.length && asap(publish, promise));
    }
    function reject(promise, reason) {
        promise._state === PENDING && (promise._state = REJECTED, promise._result = reason, 
        asap(publishRejection, promise));
    }
    function subscribe(parent, child, onFulfillment, onRejection) {
        var _subscribers = parent._subscribers, length = _subscribers.length;
        parent._onerror = null, _subscribers[length] = child, _subscribers[length + FULFILLED] = onFulfillment, 
        _subscribers[length + REJECTED] = onRejection, 0 === length && parent._state && asap(publish, parent);
    }
    function publish(promise) {
        var subscribers = promise._subscribers, settled = promise._state;
        if (0 !== subscribers.length) {
            for (var child = void 0, callback = void 0, detail = promise._result, i = 0; i < subscribers.length; i += 3) child = subscribers[i], 
            callback = subscribers[i + settled], child ? invokeCallback(settled, child, callback, detail) : callback(detail);
            promise._subscribers.length = 0;
        }
    }
    function invokeCallback(settled, promise, callback, detail) {
        var hasCallback = isFunction(callback), value = void 0, error = void 0, succeeded = void 0, failed = void 0;
        if (hasCallback) {
            if ((value = function(callback, detail) {
                try {
                    return callback(detail);
                } catch (e) {
                    return TRY_CATCH_ERROR.error = e, TRY_CATCH_ERROR;
                }
            }(callback, detail)) === TRY_CATCH_ERROR ? (failed = !0, error = value.error, value.error = null) : succeeded = !0, 
            promise === value) return void reject(promise, new TypeError("A promises callback cannot return that same promise."));
        } else value = detail, succeeded = !0;
        promise._state !== PENDING || (hasCallback && succeeded ? resolve(promise, value) : failed ? reject(promise, error) : settled === FULFILLED ? fulfill(promise, value) : settled === REJECTED && reject(promise, value));
    }
    var id = 0;
    function makePromise(promise) {
        promise[PROMISE_ID] = id++, promise._state = void 0, promise._result = void 0, promise._subscribers = [];
    }
    var Enumerator = function() {
        function Enumerator(Constructor, input) {
            this._instanceConstructor = Constructor, this.promise = new Constructor(noop), this.promise[PROMISE_ID] || makePromise(this.promise), 
            isArray(input) ? (this.length = input.length, this._remaining = input.length, this._result = new Array(this.length), 
            0 === this.length ? fulfill(this.promise, this._result) : (this.length = this.length || 0, 
            this._enumerate(input), 0 === this._remaining && fulfill(this.promise, this._result))) : reject(this.promise, new Error("Array Methods must be provided an Array"));
        }
        return Enumerator.prototype._enumerate = function(input) {
            for (var i = 0; this._state === PENDING && i < input.length; i++) this._eachEntry(input[i], i);
        }, Enumerator.prototype._eachEntry = function(entry, i) {
            var c = this._instanceConstructor, resolve$$1 = c.resolve;
            if (resolve$$1 === resolve$1) {
                var _then = getThen(entry);
                if (_then === then && entry._state !== PENDING) this._settledAt(entry._state, i, entry._result); else if ("function" != typeof _then) this._remaining--, 
                this._result[i] = entry; else if (c === Promise$2) {
                    var promise = new c(noop);
                    handleMaybeThenable(promise, entry, _then), this._willSettleAt(promise, i);
                } else this._willSettleAt(new c(function(resolve$$1) {
                    return resolve$$1(entry);
                }), i);
            } else this._willSettleAt(resolve$$1(entry), i);
        }, Enumerator.prototype._settledAt = function(state, i, value) {
            var promise = this.promise;
            promise._state === PENDING && (this._remaining--, state === REJECTED ? reject(promise, value) : this._result[i] = value), 
            0 === this._remaining && fulfill(promise, this._result);
        }, Enumerator.prototype._willSettleAt = function(promise, i) {
            var enumerator = this;
            subscribe(promise, void 0, function(value) {
                return enumerator._settledAt(FULFILLED, i, value);
            }, function(reason) {
                return enumerator._settledAt(REJECTED, i, reason);
            });
        }, Enumerator;
    }();
    var Promise$2 = function() {
        function Promise(resolver) {
            this[PROMISE_ID] = id++, this._result = this._state = void 0, this._subscribers = [], 
            noop !== resolver && ("function" != typeof resolver && function() {
                throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");
            }(), this instanceof Promise ? function(promise, resolver) {
                try {
                    resolver(function(value) {
                        resolve(promise, value);
                    }, function(reason) {
                        reject(promise, reason);
                    });
                } catch (e) {
                    reject(promise, e);
                }
            }(this, resolver) : function() {
                throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
            }());
        }
        return Promise.prototype.catch = function(onRejection) {
            return this.then(null, onRejection);
        }, Promise.prototype.finally = function(callback) {
            var constructor = this.constructor;
            return this.then(function(value) {
                return constructor.resolve(callback()).then(function() {
                    return value;
                });
            }, function(reason) {
                return constructor.resolve(callback()).then(function() {
                    throw reason;
                });
            });
        }, Promise;
    }();
    return Promise$2.prototype.then = then, Promise$2.all = function(entries) {
        return new Enumerator(this, entries).promise;
    }, Promise$2.race = function(entries) {
        var Constructor = this;
        return isArray(entries) ? new Constructor(function(resolve, reject) {
            for (var length = entries.length, i = 0; i < length; i++) Constructor.resolve(entries[i]).then(resolve, reject);
        }) : new Constructor(function(_, reject) {
            return reject(new TypeError("You must pass an array to race."));
        });
    }, Promise$2.resolve = resolve$1, Promise$2.reject = function(reason) {
        var promise = new this(noop);
        return reject(promise, reason), promise;
    }, Promise$2._setScheduler = function(scheduleFn) {
        customSchedulerFn = scheduleFn;
    }, Promise$2._setAsap = function(asapFn) {
        asap = asapFn;
    }, Promise$2._asap = asap, Promise$2.polyfill = function() {
        var local = void 0;
        if ("undefined" != typeof global) local = global; else if ("undefined" != typeof self) local = self; else try {
            local = Function("return this")();
        } catch (e) {
            throw new Error("polyfill failed because global object is unavailable in this environment");
        }
        var P = local.Promise;
        if (P) {
            var promiseToString = null;
            try {
                promiseToString = Object.prototype.toString.call(P.resolve());
            } catch (e) {}
            if ("[object Promise]" === promiseToString && !P.cast) return;
        }
        local.Promise = Promise$2;
    }, (Promise$2.Promise = Promise$2).polyfill(), Promise$2;
}), Array.prototype.find || Object.defineProperty(Array.prototype, "find", {
    value: function(predicate) {
        if (null == this) throw new TypeError('"this" is null or not defined');
        var o = Object(this), len = o.length >>> 0;
        if ("function" != typeof predicate) throw new TypeError("predicate must be a function");
        for (var thisArg = arguments[1], k = 0; k < len; ) {
            var kValue = o[k];
            if (predicate.call(thisArg, kValue, k, o)) return kValue;
            k++;
        }
    }
}), Array.prototype.findIndex || Object.defineProperty(Array.prototype, "findIndex", {
    value: function(predicate) {
        if (null == this) throw new TypeError('"this" is null or not defined');
        var o = Object(this), len = o.length >>> 0;
        if ("function" != typeof predicate) throw new TypeError("predicate must be a function");
        for (var thisArg = arguments[1], k = 0; k < len; ) {
            var kValue = o[k];
            if (predicate.call(thisArg, kValue, k, o)) return k;
            k++;
        }
        return -1;
    }
}), "function" != typeof Object.assign && Object.defineProperty(Object, "assign", {
    value: function(target, varArgs) {
        "use strict";
        if (null == target) throw new TypeError("Cannot convert undefined or null to object");
        for (var to = Object(target), index = 1; index < arguments.length; index++) {
            var nextSource = arguments[index];
            if (null != nextSource) for (var nextKey in nextSource) Object.prototype.hasOwnProperty.call(nextSource, nextKey) && (to[nextKey] = nextSource[nextKey]);
        }
        return to;
    },
    writable: !0,
    configurable: !0
}), function(global, factory) {
    "use strict";
    "object" == typeof module && "object" == typeof module.exports ? module.exports = global.document ? factory(global, !0) : function(w) {
        if (!w.document) throw new Error("jQuery requires a window with a document");
        return factory(w);
    } : factory(global);
}("undefined" != typeof window ? window : this, function(window, noGlobal) {
    "use strict";
    var arr = [], document = window.document, getProto = Object.getPrototypeOf, slice = arr.slice, concat = arr.concat, push = arr.push, indexOf = arr.indexOf, class2type = {}, toString = class2type.toString, hasOwn = class2type.hasOwnProperty, fnToString = hasOwn.toString, ObjectFunctionString = fnToString.call(Object), support = {}, isFunction = function(obj) {
        return "function" == typeof obj && "number" != typeof obj.nodeType;
    }, isWindow = function(obj) {
        return null != obj && obj === obj.window;
    }, preservedScriptAttributes = {
        type: !0,
        src: !0,
        noModule: !0
    };
    function DOMEval(code, doc, node) {
        var i, script = (doc = doc || document).createElement("script");
        if (script.text = code, node) for (i in preservedScriptAttributes) node[i] && (script[i] = node[i]);
        doc.head.appendChild(script).parentNode.removeChild(script);
    }
    function toType(obj) {
        return null == obj ? obj + "" : "object" == typeof obj || "function" == typeof obj ? class2type[toString.call(obj)] || "object" : typeof obj;
    }
    var version = "3.3.1 -ajax,-ajax/jsonp,-ajax/load,-ajax/parseXML,-ajax/script,-ajax/var/location,-ajax/var/nonce,-ajax/var/rquery,-ajax/xhr,-manipulation/_evalUrl,-event/ajax,-effects,-effects/Tween,-effects/animatedSelector", jQuery = function(selector, context) {
        return new jQuery.fn.init(selector, context);
    }, rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
    function isArrayLike(obj) {
        var length = !!obj && "length" in obj && obj.length, type = toType(obj);
        return !isFunction(obj) && !isWindow(obj) && ("array" === type || 0 === length || "number" == typeof length && 0 < length && length - 1 in obj);
    }
    jQuery.fn = jQuery.prototype = {
        jquery: version,
        constructor: jQuery,
        length: 0,
        toArray: function() {
            return slice.call(this);
        },
        get: function(num) {
            return null == num ? slice.call(this) : num < 0 ? this[num + this.length] : this[num];
        },
        pushStack: function(elems) {
            var ret = jQuery.merge(this.constructor(), elems);
            return ret.prevObject = this, ret;
        },
        each: function(callback) {
            return jQuery.each(this, callback);
        },
        map: function(callback) {
            return this.pushStack(jQuery.map(this, function(elem, i) {
                return callback.call(elem, i, elem);
            }));
        },
        slice: function() {
            return this.pushStack(slice.apply(this, arguments));
        },
        first: function() {
            return this.eq(0);
        },
        last: function() {
            return this.eq(-1);
        },
        eq: function(i) {
            var len = this.length, j = +i + (i < 0 ? len : 0);
            return this.pushStack(0 <= j && j < len ? [ this[j] ] : []);
        },
        end: function() {
            return this.prevObject || this.constructor();
        },
        push: push,
        sort: arr.sort,
        splice: arr.splice
    }, jQuery.extend = jQuery.fn.extend = function() {
        var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = !1;
        for ("boolean" == typeof target && (deep = target, target = arguments[i] || {}, 
        i++), "object" == typeof target || isFunction(target) || (target = {}), i === length && (target = this, 
        i--); i < length; i++) if (null != (options = arguments[i])) for (name in options) src = target[name], 
        target !== (copy = options[name]) && (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy))) ? (copyIsArray ? (copyIsArray = !1, 
        clone = src && Array.isArray(src) ? src : []) : clone = src && jQuery.isPlainObject(src) ? src : {}, 
        target[name] = jQuery.extend(deep, clone, copy)) : void 0 !== copy && (target[name] = copy));
        return target;
    }, jQuery.extend({
        expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
        isReady: !0,
        error: function(msg) {
            throw new Error(msg);
        },
        noop: function() {},
        isPlainObject: function(obj) {
            var proto, Ctor;
            return !(!obj || "[object Object]" !== toString.call(obj)) && (!(proto = getProto(obj)) || "function" == typeof (Ctor = hasOwn.call(proto, "constructor") && proto.constructor) && fnToString.call(Ctor) === ObjectFunctionString);
        },
        isEmptyObject: function(obj) {
            var name;
            for (name in obj) return !1;
            return !0;
        },
        globalEval: function(code) {
            DOMEval(code);
        },
        each: function(obj, callback) {
            var length, i = 0;
            if (isArrayLike(obj)) for (length = obj.length; i < length && !1 !== callback.call(obj[i], i, obj[i]); i++) ; else for (i in obj) if (!1 === callback.call(obj[i], i, obj[i])) break;
            return obj;
        },
        trim: function(text) {
            return null == text ? "" : (text + "").replace(rtrim, "");
        },
        makeArray: function(arr, results) {
            var ret = results || [];
            return null != arr && (isArrayLike(Object(arr)) ? jQuery.merge(ret, "string" == typeof arr ? [ arr ] : arr) : push.call(ret, arr)), 
            ret;
        },
        inArray: function(elem, arr, i) {
            return null == arr ? -1 : indexOf.call(arr, elem, i);
        },
        merge: function(first, second) {
            for (var len = +second.length, j = 0, i = first.length; j < len; j++) first[i++] = second[j];
            return first.length = i, first;
        },
        grep: function(elems, callback, invert) {
            for (var matches = [], i = 0, length = elems.length, callbackExpect = !invert; i < length; i++) !callback(elems[i], i) !== callbackExpect && matches.push(elems[i]);
            return matches;
        },
        map: function(elems, callback, arg) {
            var length, value, i = 0, ret = [];
            if (isArrayLike(elems)) for (length = elems.length; i < length; i++) null != (value = callback(elems[i], i, arg)) && ret.push(value); else for (i in elems) null != (value = callback(elems[i], i, arg)) && ret.push(value);
            return concat.apply([], ret);
        },
        guid: 1,
        support: support
    }), "function" == typeof Symbol && (jQuery.fn[Symbol.iterator] = arr[Symbol.iterator]), 
    jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function(i, name) {
        class2type["[object " + name + "]"] = name.toLowerCase();
    });
    var Sizzle = function(window) {
        var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, expando = "sizzle" + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function(a, b) {
            return a === b && (hasDuplicate = !0), 0;
        }, hasOwn = {}.hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, indexOf = function(list, elem) {
            for (var i = 0, len = list.length; i < len; i++) if (list[i] === elem) return i;
            return -1;
        }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", whitespace = "[\\x20\\t\\r\\n\\f]", identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + ")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|.*)\\)|)", rwhitespace = new RegExp(whitespace + "+", "g"), rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = {
            ID: new RegExp("^#(" + identifier + ")"),
            CLASS: new RegExp("^\\.(" + identifier + ")"),
            TAG: new RegExp("^(" + identifier + "|[*])"),
            ATTR: new RegExp("^" + attributes),
            PSEUDO: new RegExp("^" + pseudos),
            CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
            bool: new RegExp("^(?:" + booleans + ")$", "i"),
            needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
        }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"), funescape = function(_, escaped, escapedWhitespace) {
            var high = "0x" + escaped - 65536;
            return high != high || escapedWhitespace ? escaped : high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, 1023 & high | 56320);
        }, rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, fcssescape = function(ch, asCodePoint) {
            return asCodePoint ? "\0" === ch ? "�" : ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " " : "\\" + ch;
        }, unloadHandler = function() {
            setDocument();
        }, disabledAncestor = addCombinator(function(elem) {
            return !0 === elem.disabled && ("form" in elem || "label" in elem);
        }, {
            dir: "parentNode",
            next: "legend"
        });
        try {
            push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes), 
            arr[preferredDoc.childNodes.length].nodeType;
        } catch (e) {
            push = {
                apply: arr.length ? function(target, els) {
                    push_native.apply(target, slice.call(els));
                } : function(target, els) {
                    for (var j = target.length, i = 0; target[j++] = els[i++]; ) ;
                    target.length = j - 1;
                }
            };
        }
        function Sizzle(selector, context, results, seed) {
            var m, i, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, nodeType = context ? context.nodeType : 9;
            if (results = results || [], "string" != typeof selector || !selector || 1 !== nodeType && 9 !== nodeType && 11 !== nodeType) return results;
            if (!seed && ((context ? context.ownerDocument || context : preferredDoc) !== document && setDocument(context), 
            context = context || document, documentIsHTML)) {
                if (11 !== nodeType && (match = rquickExpr.exec(selector))) if (m = match[1]) {
                    if (9 === nodeType) {
                        if (!(elem = context.getElementById(m))) return results;
                        if (elem.id === m) return results.push(elem), results;
                    } else if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) return results.push(elem), 
                    results;
                } else {
                    if (match[2]) return push.apply(results, context.getElementsByTagName(selector)), 
                    results;
                    if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) return push.apply(results, context.getElementsByClassName(m)), 
                    results;
                }
                if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
                    if (1 !== nodeType) newContext = context, newSelector = selector; else if ("object" !== context.nodeName.toLowerCase()) {
                        for ((nid = context.getAttribute("id")) ? nid = nid.replace(rcssescape, fcssescape) : context.setAttribute("id", nid = expando), 
                        i = (groups = tokenize(selector)).length; i--; ) groups[i] = "#" + nid + " " + toSelector(groups[i]);
                        newSelector = groups.join(","), newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
                    }
                    if (newSelector) try {
                        return push.apply(results, newContext.querySelectorAll(newSelector)), results;
                    } catch (qsaError) {} finally {
                        nid === expando && context.removeAttribute("id");
                    }
                }
            }
            return select(selector.replace(rtrim, "$1"), context, results, seed);
        }
        function createCache() {
            var keys = [];
            return function cache(key, value) {
                return keys.push(key + " ") > Expr.cacheLength && delete cache[keys.shift()], cache[key + " "] = value;
            };
        }
        function markFunction(fn) {
            return fn[expando] = !0, fn;
        }
        function assert(fn) {
            var el = document.createElement("fieldset");
            try {
                return !!fn(el);
            } catch (e) {
                return !1;
            } finally {
                el.parentNode && el.parentNode.removeChild(el), el = null;
            }
        }
        function addHandle(attrs, handler) {
            for (var arr = attrs.split("|"), i = arr.length; i--; ) Expr.attrHandle[arr[i]] = handler;
        }
        function siblingCheck(a, b) {
            var cur = b && a, diff = cur && 1 === a.nodeType && 1 === b.nodeType && a.sourceIndex - b.sourceIndex;
            if (diff) return diff;
            if (cur) for (;cur = cur.nextSibling; ) if (cur === b) return -1;
            return a ? 1 : -1;
        }
        function createInputPseudo(type) {
            return function(elem) {
                return "input" === elem.nodeName.toLowerCase() && elem.type === type;
            };
        }
        function createButtonPseudo(type) {
            return function(elem) {
                var name = elem.nodeName.toLowerCase();
                return ("input" === name || "button" === name) && elem.type === type;
            };
        }
        function createDisabledPseudo(disabled) {
            return function(elem) {
                return "form" in elem ? elem.parentNode && !1 === elem.disabled ? "label" in elem ? "label" in elem.parentNode ? elem.parentNode.disabled === disabled : elem.disabled === disabled : elem.isDisabled === disabled || elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled : elem.disabled === disabled : "label" in elem && elem.disabled === disabled;
            };
        }
        function createPositionalPseudo(fn) {
            return markFunction(function(argument) {
                return argument = +argument, markFunction(function(seed, matches) {
                    for (var j, matchIndexes = fn([], seed.length, argument), i = matchIndexes.length; i--; ) seed[j = matchIndexes[i]] && (seed[j] = !(matches[j] = seed[j]));
                });
            });
        }
        function testContext(context) {
            return context && void 0 !== context.getElementsByTagName && context;
        }
        for (i in support = Sizzle.support = {}, isXML = Sizzle.isXML = function(elem) {
            var documentElement = elem && (elem.ownerDocument || elem).documentElement;
            return !!documentElement && "HTML" !== documentElement.nodeName;
        }, setDocument = Sizzle.setDocument = function(node) {
            var hasCompare, subWindow, doc = node ? node.ownerDocument || node : preferredDoc;
            return doc !== document && 9 === doc.nodeType && doc.documentElement && (docElem = (document = doc).documentElement, 
            documentIsHTML = !isXML(document), preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow && (subWindow.addEventListener ? subWindow.addEventListener("unload", unloadHandler, !1) : subWindow.attachEvent && subWindow.attachEvent("onunload", unloadHandler)), 
            support.attributes = assert(function(el) {
                return el.className = "i", !el.getAttribute("className");
            }), support.getElementsByTagName = assert(function(el) {
                return el.appendChild(document.createComment("")), !el.getElementsByTagName("*").length;
            }), support.getElementsByClassName = rnative.test(document.getElementsByClassName), 
            support.getById = assert(function(el) {
                return docElem.appendChild(el).id = expando, !document.getElementsByName || !document.getElementsByName(expando).length;
            }), support.getById ? (Expr.filter.ID = function(id) {
                var attrId = id.replace(runescape, funescape);
                return function(elem) {
                    return elem.getAttribute("id") === attrId;
                };
            }, Expr.find.ID = function(id, context) {
                if (void 0 !== context.getElementById && documentIsHTML) {
                    var elem = context.getElementById(id);
                    return elem ? [ elem ] : [];
                }
            }) : (Expr.filter.ID = function(id) {
                var attrId = id.replace(runescape, funescape);
                return function(elem) {
                    var node = void 0 !== elem.getAttributeNode && elem.getAttributeNode("id");
                    return node && node.value === attrId;
                };
            }, Expr.find.ID = function(id, context) {
                if (void 0 !== context.getElementById && documentIsHTML) {
                    var node, i, elems, elem = context.getElementById(id);
                    if (elem) {
                        if ((node = elem.getAttributeNode("id")) && node.value === id) return [ elem ];
                        for (elems = context.getElementsByName(id), i = 0; elem = elems[i++]; ) if ((node = elem.getAttributeNode("id")) && node.value === id) return [ elem ];
                    }
                    return [];
                }
            }), Expr.find.TAG = support.getElementsByTagName ? function(tag, context) {
                return void 0 !== context.getElementsByTagName ? context.getElementsByTagName(tag) : support.qsa ? context.querySelectorAll(tag) : void 0;
            } : function(tag, context) {
                var elem, tmp = [], i = 0, results = context.getElementsByTagName(tag);
                if ("*" === tag) {
                    for (;elem = results[i++]; ) 1 === elem.nodeType && tmp.push(elem);
                    return tmp;
                }
                return results;
            }, Expr.find.CLASS = support.getElementsByClassName && function(className, context) {
                if (void 0 !== context.getElementsByClassName && documentIsHTML) return context.getElementsByClassName(className);
            }, rbuggyMatches = [], rbuggyQSA = [], (support.qsa = rnative.test(document.querySelectorAll)) && (assert(function(el) {
                docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a><select id='" + expando + "-\r\\' msallowcapture=''><option selected=''></option></select>", 
                el.querySelectorAll("[msallowcapture^='']").length && rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")"), 
                el.querySelectorAll("[selected]").length || rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")"), 
                el.querySelectorAll("[id~=" + expando + "-]").length || rbuggyQSA.push("~="), el.querySelectorAll(":checked").length || rbuggyQSA.push(":checked"), 
                el.querySelectorAll("a#" + expando + "+*").length || rbuggyQSA.push(".#.+[+~]");
            }), assert(function(el) {
                el.innerHTML = "<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";
                var input = document.createElement("input");
                input.setAttribute("type", "hidden"), el.appendChild(input).setAttribute("name", "D"), 
                el.querySelectorAll("[name=d]").length && rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?="), 
                2 !== el.querySelectorAll(":enabled").length && rbuggyQSA.push(":enabled", ":disabled"), 
                docElem.appendChild(el).disabled = !0, 2 !== el.querySelectorAll(":disabled").length && rbuggyQSA.push(":enabled", ":disabled"), 
                el.querySelectorAll("*,:x"), rbuggyQSA.push(",.*:");
            })), (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) && assert(function(el) {
                support.disconnectedMatch = matches.call(el, "*"), matches.call(el, "[s!='']:x"), 
                rbuggyMatches.push("!=", pseudos);
            }), rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|")), rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|")), 
            hasCompare = rnative.test(docElem.compareDocumentPosition), contains = hasCompare || rnative.test(docElem.contains) ? function(a, b) {
                var adown = 9 === a.nodeType ? a.documentElement : a, bup = b && b.parentNode;
                return a === bup || !(!bup || 1 !== bup.nodeType || !(adown.contains ? adown.contains(bup) : a.compareDocumentPosition && 16 & a.compareDocumentPosition(bup)));
            } : function(a, b) {
                if (b) for (;b = b.parentNode; ) if (b === a) return !0;
                return !1;
            }, sortOrder = hasCompare ? function(a, b) {
                if (a === b) return hasDuplicate = !0, 0;
                var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
                return compare || (1 & (compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1) || !support.sortDetached && b.compareDocumentPosition(a) === compare ? a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ? -1 : b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0 : 4 & compare ? -1 : 1);
            } : function(a, b) {
                if (a === b) return hasDuplicate = !0, 0;
                var cur, i = 0, aup = a.parentNode, bup = b.parentNode, ap = [ a ], bp = [ b ];
                if (!aup || !bup) return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
                if (aup === bup) return siblingCheck(a, b);
                for (cur = a; cur = cur.parentNode; ) ap.unshift(cur);
                for (cur = b; cur = cur.parentNode; ) bp.unshift(cur);
                for (;ap[i] === bp[i]; ) i++;
                return i ? siblingCheck(ap[i], bp[i]) : ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
            }), document;
        }, Sizzle.matches = function(expr, elements) {
            return Sizzle(expr, null, null, elements);
        }, Sizzle.matchesSelector = function(elem, expr) {
            if ((elem.ownerDocument || elem) !== document && setDocument(elem), expr = expr.replace(rattributeQuotes, "='$1']"), 
            support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) try {
                var ret = matches.call(elem, expr);
                if (ret || support.disconnectedMatch || elem.document && 11 !== elem.document.nodeType) return ret;
            } catch (e) {}
            return 0 < Sizzle(expr, document, null, [ elem ]).length;
        }, Sizzle.contains = function(context, elem) {
            return (context.ownerDocument || context) !== document && setDocument(context), 
            contains(context, elem);
        }, Sizzle.attr = function(elem, name) {
            (elem.ownerDocument || elem) !== document && setDocument(elem);
            var fn = Expr.attrHandle[name.toLowerCase()], val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : void 0;
            return void 0 !== val ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
        }, Sizzle.escape = function(sel) {
            return (sel + "").replace(rcssescape, fcssescape);
        }, Sizzle.error = function(msg) {
            throw new Error("Syntax error, unrecognized expression: " + msg);
        }, Sizzle.uniqueSort = function(results) {
            var elem, duplicates = [], j = 0, i = 0;
            if (hasDuplicate = !support.detectDuplicates, sortInput = !support.sortStable && results.slice(0), 
            results.sort(sortOrder), hasDuplicate) {
                for (;elem = results[i++]; ) elem === results[i] && (j = duplicates.push(i));
                for (;j--; ) results.splice(duplicates[j], 1);
            }
            return sortInput = null, results;
        }, getText = Sizzle.getText = function(elem) {
            var node, ret = "", i = 0, nodeType = elem.nodeType;
            if (nodeType) {
                if (1 === nodeType || 9 === nodeType || 11 === nodeType) {
                    if ("string" == typeof elem.textContent) return elem.textContent;
                    for (elem = elem.firstChild; elem; elem = elem.nextSibling) ret += getText(elem);
                } else if (3 === nodeType || 4 === nodeType) return elem.nodeValue;
            } else for (;node = elem[i++]; ) ret += getText(node);
            return ret;
        }, (Expr = Sizzle.selectors = {
            cacheLength: 50,
            createPseudo: markFunction,
            match: matchExpr,
            attrHandle: {},
            find: {},
            relative: {
                ">": {
                    dir: "parentNode",
                    first: !0
                },
                " ": {
                    dir: "parentNode"
                },
                "+": {
                    dir: "previousSibling",
                    first: !0
                },
                "~": {
                    dir: "previousSibling"
                }
            },
            preFilter: {
                ATTR: function(match) {
                    return match[1] = match[1].replace(runescape, funescape), match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape), 
                    "~=" === match[2] && (match[3] = " " + match[3] + " "), match.slice(0, 4);
                },
                CHILD: function(match) {
                    return match[1] = match[1].toLowerCase(), "nth" === match[1].slice(0, 3) ? (match[3] || Sizzle.error(match[0]), 
                    match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * ("even" === match[3] || "odd" === match[3])), 
                    match[5] = +(match[7] + match[8] || "odd" === match[3])) : match[3] && Sizzle.error(match[0]), 
                    match;
                },
                PSEUDO: function(match) {
                    var excess, unquoted = !match[6] && match[2];
                    return matchExpr.CHILD.test(match[0]) ? null : (match[3] ? match[2] = match[4] || match[5] || "" : unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, !0)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length) && (match[0] = match[0].slice(0, excess), 
                    match[2] = unquoted.slice(0, excess)), match.slice(0, 3));
                }
            },
            filter: {
                TAG: function(nodeNameSelector) {
                    var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
                    return "*" === nodeNameSelector ? function() {
                        return !0;
                    } : function(elem) {
                        return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
                    };
                },
                CLASS: function(className) {
                    var pattern = classCache[className + " "];
                    return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
                        return pattern.test("string" == typeof elem.className && elem.className || void 0 !== elem.getAttribute && elem.getAttribute("class") || "");
                    });
                },
                ATTR: function(name, operator, check) {
                    return function(elem) {
                        var result = Sizzle.attr(elem, name);
                        return null == result ? "!=" === operator : !operator || (result += "", "=" === operator ? result === check : "!=" === operator ? result !== check : "^=" === operator ? check && 0 === result.indexOf(check) : "*=" === operator ? check && -1 < result.indexOf(check) : "$=" === operator ? check && result.slice(-check.length) === check : "~=" === operator ? -1 < (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) : "|=" === operator && (result === check || result.slice(0, check.length + 1) === check + "-"));
                    };
                },
                CHILD: function(type, what, argument, first, last) {
                    var simple = "nth" !== type.slice(0, 3), forward = "last" !== type.slice(-4), ofType = "of-type" === what;
                    return 1 === first && 0 === last ? function(elem) {
                        return !!elem.parentNode;
                    } : function(elem, context, xml) {
                        var cache, uniqueCache, outerCache, node, nodeIndex, start, dir = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = !1;
                        if (parent) {
                            if (simple) {
                                for (;dir; ) {
                                    for (node = elem; node = node[dir]; ) if (ofType ? node.nodeName.toLowerCase() === name : 1 === node.nodeType) return !1;
                                    start = dir = "only" === type && !start && "nextSibling";
                                }
                                return !0;
                            }
                            if (start = [ forward ? parent.firstChild : parent.lastChild ], forward && useCache) {
                                for (diff = (nodeIndex = (cache = (uniqueCache = (outerCache = (node = parent)[expando] || (node[expando] = {}))[node.uniqueID] || (outerCache[node.uniqueID] = {}))[type] || [])[0] === dirruns && cache[1]) && cache[2], 
                                node = nodeIndex && parent.childNodes[nodeIndex]; node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop(); ) if (1 === node.nodeType && ++diff && node === elem) {
                                    uniqueCache[type] = [ dirruns, nodeIndex, diff ];
                                    break;
                                }
                            } else if (useCache && (diff = nodeIndex = (cache = (uniqueCache = (outerCache = (node = elem)[expando] || (node[expando] = {}))[node.uniqueID] || (outerCache[node.uniqueID] = {}))[type] || [])[0] === dirruns && cache[1]), 
                            !1 === diff) for (;(node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) && ((ofType ? node.nodeName.toLowerCase() !== name : 1 !== node.nodeType) || !++diff || (useCache && ((uniqueCache = (outerCache = node[expando] || (node[expando] = {}))[node.uniqueID] || (outerCache[node.uniqueID] = {}))[type] = [ dirruns, diff ]), 
                            node !== elem)); ) ;
                            return (diff -= last) === first || diff % first == 0 && 0 <= diff / first;
                        }
                    };
                },
                PSEUDO: function(pseudo, argument) {
                    var args, fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
                    return fn[expando] ? fn(argument) : 1 < fn.length ? (args = [ pseudo, pseudo, "", argument ], 
                    Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches) {
                        for (var idx, matched = fn(seed, argument), i = matched.length; i--; ) seed[idx = indexOf(seed, matched[i])] = !(matches[idx] = matched[i]);
                    }) : function(elem) {
                        return fn(elem, 0, args);
                    }) : fn;
                }
            },
            pseudos: {
                not: markFunction(function(selector) {
                    var input = [], results = [], matcher = compile(selector.replace(rtrim, "$1"));
                    return matcher[expando] ? markFunction(function(seed, matches, context, xml) {
                        for (var elem, unmatched = matcher(seed, null, xml, []), i = seed.length; i--; ) (elem = unmatched[i]) && (seed[i] = !(matches[i] = elem));
                    }) : function(elem, context, xml) {
                        return input[0] = elem, matcher(input, null, xml, results), input[0] = null, !results.pop();
                    };
                }),
                has: markFunction(function(selector) {
                    return function(elem) {
                        return 0 < Sizzle(selector, elem).length;
                    };
                }),
                contains: markFunction(function(text) {
                    return text = text.replace(runescape, funescape), function(elem) {
                        return -1 < (elem.textContent || elem.innerText || getText(elem)).indexOf(text);
                    };
                }),
                lang: markFunction(function(lang) {
                    return ridentifier.test(lang || "") || Sizzle.error("unsupported lang: " + lang), 
                    lang = lang.replace(runescape, funescape).toLowerCase(), function(elem) {
                        var elemLang;
                        do {
                            if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) return (elemLang = elemLang.toLowerCase()) === lang || 0 === elemLang.indexOf(lang + "-");
                        } while ((elem = elem.parentNode) && 1 === elem.nodeType);
                        return !1;
                    };
                }),
                target: function(elem) {
                    var hash = window.location && window.location.hash;
                    return hash && hash.slice(1) === elem.id;
                },
                root: function(elem) {
                    return elem === docElem;
                },
                focus: function(elem) {
                    return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
                },
                enabled: createDisabledPseudo(!1),
                disabled: createDisabledPseudo(!0),
                checked: function(elem) {
                    var nodeName = elem.nodeName.toLowerCase();
                    return "input" === nodeName && !!elem.checked || "option" === nodeName && !!elem.selected;
                },
                selected: function(elem) {
                    return elem.parentNode && elem.parentNode.selectedIndex, !0 === elem.selected;
                },
                empty: function(elem) {
                    for (elem = elem.firstChild; elem; elem = elem.nextSibling) if (elem.nodeType < 6) return !1;
                    return !0;
                },
                parent: function(elem) {
                    return !Expr.pseudos.empty(elem);
                },
                header: function(elem) {
                    return rheader.test(elem.nodeName);
                },
                input: function(elem) {
                    return rinputs.test(elem.nodeName);
                },
                button: function(elem) {
                    var name = elem.nodeName.toLowerCase();
                    return "input" === name && "button" === elem.type || "button" === name;
                },
                text: function(elem) {
                    var attr;
                    return "input" === elem.nodeName.toLowerCase() && "text" === elem.type && (null == (attr = elem.getAttribute("type")) || "text" === attr.toLowerCase());
                },
                first: createPositionalPseudo(function() {
                    return [ 0 ];
                }),
                last: createPositionalPseudo(function(matchIndexes, length) {
                    return [ length - 1 ];
                }),
                eq: createPositionalPseudo(function(matchIndexes, length, argument) {
                    return [ argument < 0 ? argument + length : argument ];
                }),
                even: createPositionalPseudo(function(matchIndexes, length) {
                    for (var i = 0; i < length; i += 2) matchIndexes.push(i);
                    return matchIndexes;
                }),
                odd: createPositionalPseudo(function(matchIndexes, length) {
                    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; 0 <= --i; ) 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;
                })
            }
        }).pseudos.nth = Expr.pseudos.eq, {
            radio: !0,
            checkbox: !0,
            file: !0,
            password: !0,
            image: !0
        }) Expr.pseudos[i] = createInputPseudo(i);
        for (i in {
            submit: !0,
            reset: !0
        }) Expr.pseudos[i] = createButtonPseudo(i);
        function setFilters() {}
        function toSelector(tokens) {
            for (var i = 0, len = tokens.length, selector = ""; i < len; i++) selector += tokens[i].value;
            return selector;
        }
        function addCombinator(matcher, combinator, base) {
            var dir = combinator.dir, skip = combinator.next, key = skip || dir, checkNonElements = base && "parentNode" === key, doneName = done++;
            return combinator.first ? function(elem, context, xml) {
                for (;elem = elem[dir]; ) if (1 === elem.nodeType || checkNonElements) return matcher(elem, context, xml);
                return !1;
            } : function(elem, context, xml) {
                var oldCache, uniqueCache, outerCache, newCache = [ dirruns, doneName ];
                if (xml) {
                    for (;elem = elem[dir]; ) if ((1 === elem.nodeType || checkNonElements) && matcher(elem, context, xml)) return !0;
                } else for (;elem = elem[dir]; ) if (1 === elem.nodeType || checkNonElements) if (uniqueCache = (outerCache = elem[expando] || (elem[expando] = {}))[elem.uniqueID] || (outerCache[elem.uniqueID] = {}), 
                skip && skip === elem.nodeName.toLowerCase()) elem = elem[dir] || elem; else {
                    if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) return newCache[2] = oldCache[2];
                    if ((uniqueCache[key] = newCache)[2] = matcher(elem, context, xml)) return !0;
                }
                return !1;
            };
        }
        function elementMatcher(matchers) {
            return 1 < matchers.length ? function(elem, context, xml) {
                for (var i = matchers.length; i--; ) if (!matchers[i](elem, context, xml)) return !1;
                return !0;
            } : matchers[0];
        }
        function condense(unmatched, map, filter, context, xml) {
            for (var elem, newUnmatched = [], i = 0, len = unmatched.length, mapped = null != map; i < len; i++) (elem = unmatched[i]) && (filter && !filter(elem, context, xml) || (newUnmatched.push(elem), 
            mapped && map.push(i)));
            return newUnmatched;
        }
        function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
            return postFilter && !postFilter[expando] && (postFilter = setMatcher(postFilter)), 
            postFinder && !postFinder[expando] && (postFinder = setMatcher(postFinder, postSelector)), 
            markFunction(function(seed, results, context, xml) {
                var temp, i, elem, preMap = [], postMap = [], preexisting = results.length, elems = seed || function(selector, contexts, results) {
                    for (var i = 0, len = contexts.length; i < len; i++) Sizzle(selector, contexts[i], results);
                    return results;
                }(selector || "*", context.nodeType ? [ context ] : context, []), matcherIn = !preFilter || !seed && selector ? elems : condense(elems, preMap, preFilter, context, xml), matcherOut = matcher ? postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results : matcherIn;
                if (matcher && matcher(matcherIn, matcherOut, context, xml), postFilter) for (temp = condense(matcherOut, postMap), 
                postFilter(temp, [], context, xml), i = temp.length; i--; ) (elem = temp[i]) && (matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem));
                if (seed) {
                    if (postFinder || preFilter) {
                        if (postFinder) {
                            for (temp = [], i = matcherOut.length; i--; ) (elem = matcherOut[i]) && temp.push(matcherIn[i] = elem);
                            postFinder(null, matcherOut = [], temp, xml);
                        }
                        for (i = matcherOut.length; i--; ) (elem = matcherOut[i]) && -1 < (temp = postFinder ? indexOf(seed, elem) : preMap[i]) && (seed[temp] = !(results[temp] = elem));
                    }
                } else matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut), 
                postFinder ? postFinder(null, results, matcherOut, xml) : push.apply(results, matcherOut);
            });
        }
        function matcherFromTokens(tokens) {
            for (var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[" "], i = leadingRelative ? 1 : 0, matchContext = addCombinator(function(elem) {
                return elem === checkContext;
            }, implicitRelative, !0), matchAnyContext = addCombinator(function(elem) {
                return -1 < indexOf(checkContext, elem);
            }, implicitRelative, !0), matchers = [ function(elem, context, xml) {
                var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
                return checkContext = null, ret;
            } ]; i < len; i++) if (matcher = Expr.relative[tokens[i].type]) matchers = [ addCombinator(elementMatcher(matchers), matcher) ]; else {
                if ((matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches))[expando]) {
                    for (j = ++i; j < len && !Expr.relative[tokens[j].type]; j++) ;
                    return setMatcher(1 < i && elementMatcher(matchers), 1 < i && toSelector(tokens.slice(0, i - 1).concat({
                        value: " " === tokens[i - 2].type ? "*" : ""
                    })).replace(rtrim, "$1"), matcher, i < j && matcherFromTokens(tokens.slice(i, j)), j < len && matcherFromTokens(tokens = tokens.slice(j)), j < len && toSelector(tokens));
                }
                matchers.push(matcher);
            }
            return elementMatcher(matchers);
        }
        return setFilters.prototype = Expr.filters = Expr.pseudos, Expr.setFilters = new setFilters(), 
        tokenize = Sizzle.tokenize = function(selector, parseOnly) {
            var matched, match, tokens, type, soFar, groups, preFilters, cached = tokenCache[selector + " "];
            if (cached) return parseOnly ? 0 : cached.slice(0);
            for (soFar = selector, groups = [], preFilters = Expr.preFilter; soFar; ) {
                for (type in matched && !(match = rcomma.exec(soFar)) || (match && (soFar = soFar.slice(match[0].length) || soFar), 
                groups.push(tokens = [])), matched = !1, (match = rcombinators.exec(soFar)) && (matched = match.shift(), 
                tokens.push({
                    value: matched,
                    type: match[0].replace(rtrim, " ")
                }), soFar = soFar.slice(matched.length)), Expr.filter) !(match = matchExpr[type].exec(soFar)) || preFilters[type] && !(match = preFilters[type](match)) || (matched = match.shift(), 
                tokens.push({
                    value: matched,
                    type: type,
                    matches: match
                }), soFar = soFar.slice(matched.length));
                if (!matched) break;
            }
            return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) : tokenCache(selector, groups).slice(0);
        }, compile = Sizzle.compile = function(selector, match) {
            var i, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + " "];
            if (!cached) {
                for (match || (match = tokenize(selector)), i = match.length; i--; ) (cached = matcherFromTokens(match[i]))[expando] ? setMatchers.push(cached) : elementMatchers.push(cached);
                (cached = compilerCache(selector, function(elementMatchers, setMatchers) {
                    var bySet = 0 < setMatchers.length, byElement = 0 < elementMatchers.length, superMatcher = function(seed, context, xml, results, outermost) {
                        var elem, j, matcher, matchedCount = 0, i = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG("*", outermost), dirrunsUnique = dirruns += null == contextBackup ? 1 : Math.random() || .1, len = elems.length;
                        for (outermost && (outermostContext = context === document || context || outermost); i !== len && null != (elem = elems[i]); i++) {
                            if (byElement && elem) {
                                for (j = 0, context || elem.ownerDocument === document || (setDocument(elem), xml = !documentIsHTML); matcher = elementMatchers[j++]; ) if (matcher(elem, context || document, xml)) {
                                    results.push(elem);
                                    break;
                                }
                                outermost && (dirruns = dirrunsUnique);
                            }
                            bySet && ((elem = !matcher && elem) && matchedCount--, seed && unmatched.push(elem));
                        }
                        if (matchedCount += i, bySet && i !== matchedCount) {
                            for (j = 0; matcher = setMatchers[j++]; ) matcher(unmatched, setMatched, context, xml);
                            if (seed) {
                                if (0 < matchedCount) for (;i--; ) unmatched[i] || setMatched[i] || (setMatched[i] = pop.call(results));
                                setMatched = condense(setMatched);
                            }
                            push.apply(results, setMatched), outermost && !seed && 0 < setMatched.length && 1 < matchedCount + setMatchers.length && Sizzle.uniqueSort(results);
                        }
                        return outermost && (dirruns = dirrunsUnique, outermostContext = contextBackup), 
                        unmatched;
                    };
                    return bySet ? markFunction(superMatcher) : superMatcher;
                }(elementMatchers, setMatchers))).selector = selector;
            }
            return cached;
        }, select = Sizzle.select = function(selector, context, results, seed) {
            var i, tokens, token, type, find, compiled = "function" == typeof selector && selector, match = !seed && tokenize(selector = compiled.selector || selector);
            if (results = results || [], 1 === match.length) {
                if (2 < (tokens = match[0] = match[0].slice(0)).length && "ID" === (token = tokens[0]).type && 9 === context.nodeType && documentIsHTML && Expr.relative[tokens[1].type]) {
                    if (!(context = (Expr.find.ID(token.matches[0].replace(runescape, funescape), context) || [])[0])) return results;
                    compiled && (context = context.parentNode), selector = selector.slice(tokens.shift().value.length);
                }
                for (i = matchExpr.needsContext.test(selector) ? 0 : tokens.length; i-- && (token = tokens[i], 
                !Expr.relative[type = token.type]); ) if ((find = Expr.find[type]) && (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context))) {
                    if (tokens.splice(i, 1), !(selector = seed.length && toSelector(tokens))) return push.apply(results, seed), 
                    results;
                    break;
                }
            }
            return (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context), 
            results;
        }, support.sortStable = expando.split("").sort(sortOrder).join("") === expando, 
        support.detectDuplicates = !!hasDuplicate, setDocument(), support.sortDetached = assert(function(el) {
            return 1 & el.compareDocumentPosition(document.createElement("fieldset"));
        }), assert(function(el) {
            return el.innerHTML = "<a href='#'></a>", "#" === el.firstChild.getAttribute("href");
        }) || addHandle("type|href|height|width", function(elem, name, isXML) {
            if (!isXML) return elem.getAttribute(name, "type" === name.toLowerCase() ? 1 : 2);
        }), support.attributes && assert(function(el) {
            return el.innerHTML = "<input/>", el.firstChild.setAttribute("value", ""), "" === el.firstChild.getAttribute("value");
        }) || addHandle("value", function(elem, name, isXML) {
            if (!isXML && "input" === elem.nodeName.toLowerCase()) return elem.defaultValue;
        }), assert(function(el) {
            return null == el.getAttribute("disabled");
        }) || addHandle(booleans, function(elem, name, isXML) {
            var val;
            if (!isXML) return !0 === elem[name] ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
        }), Sizzle;
    }(window);
    jQuery.find = Sizzle, jQuery.expr = Sizzle.selectors, jQuery.expr[":"] = jQuery.expr.pseudos, 
    jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort, jQuery.text = Sizzle.getText, 
    jQuery.isXMLDoc = Sizzle.isXML, jQuery.contains = Sizzle.contains, jQuery.escapeSelector = Sizzle.escape;
    var dir = function(elem, dir, until) {
        for (var matched = [], truncate = void 0 !== until; (elem = elem[dir]) && 9 !== elem.nodeType; ) if (1 === elem.nodeType) {
            if (truncate && jQuery(elem).is(until)) break;
            matched.push(elem);
        }
        return matched;
    }, siblings = function(n, elem) {
        for (var matched = []; n; n = n.nextSibling) 1 === n.nodeType && n !== elem && matched.push(n);
        return matched;
    }, rneedsContext = jQuery.expr.match.needsContext;
    function nodeName(elem, name) {
        return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
    }
    var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
    function winnow(elements, qualifier, not) {
        return isFunction(qualifier) ? jQuery.grep(elements, function(elem, i) {
            return !!qualifier.call(elem, i, elem) !== not;
        }) : qualifier.nodeType ? jQuery.grep(elements, function(elem) {
            return elem === qualifier !== not;
        }) : "string" != typeof qualifier ? jQuery.grep(elements, function(elem) {
            return -1 < indexOf.call(qualifier, elem) !== not;
        }) : jQuery.filter(qualifier, elements, not);
    }
    jQuery.filter = function(expr, elems, not) {
        var elem = elems[0];
        return not && (expr = ":not(" + expr + ")"), 1 === elems.length && 1 === elem.nodeType ? jQuery.find.matchesSelector(elem, expr) ? [ elem ] : [] : jQuery.find.matches(expr, jQuery.grep(elems, function(elem) {
            return 1 === elem.nodeType;
        }));
    }, jQuery.fn.extend({
        find: function(selector) {
            var i, ret, len = this.length, self = this;
            if ("string" != typeof selector) return this.pushStack(jQuery(selector).filter(function() {
                for (i = 0; i < len; i++) if (jQuery.contains(self[i], this)) return !0;
            }));
            for (ret = this.pushStack([]), i = 0; i < len; i++) jQuery.find(selector, self[i], ret);
            return 1 < len ? jQuery.uniqueSort(ret) : ret;
        },
        filter: function(selector) {
            return this.pushStack(winnow(this, selector || [], !1));
        },
        not: function(selector) {
            return this.pushStack(winnow(this, selector || [], !0));
        },
        is: function(selector) {
            return !!winnow(this, "string" == typeof selector && rneedsContext.test(selector) ? jQuery(selector) : selector || [], !1).length;
        }
    });
    var rootjQuery, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;
    (jQuery.fn.init = function(selector, context, root) {
        var match, elem;
        if (!selector) return this;
        if (root = root || rootjQuery, "string" == typeof selector) {
            if (!(match = "<" === selector[0] && ">" === selector[selector.length - 1] && 3 <= selector.length ? [ null, selector, null ] : rquickExpr.exec(selector)) || !match[1] && context) return !context || context.jquery ? (context || root).find(selector) : this.constructor(context).find(selector);
            if (match[1]) {
                if (context = context instanceof jQuery ? context[0] : context, jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, !0)), 
                rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) for (match in context) isFunction(this[match]) ? this[match](context[match]) : this.attr(match, context[match]);
                return this;
            }
            return (elem = document.getElementById(match[2])) && (this[0] = elem, this.length = 1), 
            this;
        }
        return selector.nodeType ? (this[0] = selector, this.length = 1, this) : isFunction(selector) ? void 0 !== root.ready ? root.ready(selector) : selector(jQuery) : jQuery.makeArray(selector, this);
    }).prototype = jQuery.fn, rootjQuery = jQuery(document);
    var rparentsprev = /^(?:parents|prev(?:Until|All))/, guaranteedUnique = {
        children: !0,
        contents: !0,
        next: !0,
        prev: !0
    };
    function sibling(cur, dir) {
        for (;(cur = cur[dir]) && 1 !== cur.nodeType; ) ;
        return cur;
    }
    jQuery.fn.extend({
        has: function(target) {
            var targets = jQuery(target, this), l = targets.length;
            return this.filter(function() {
                for (var i = 0; i < l; i++) if (jQuery.contains(this, targets[i])) return !0;
            });
        },
        closest: function(selectors, context) {
            var cur, i = 0, l = this.length, matched = [], targets = "string" != typeof selectors && jQuery(selectors);
            if (!rneedsContext.test(selectors)) for (;i < l; i++) for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) if (cur.nodeType < 11 && (targets ? -1 < targets.index(cur) : 1 === cur.nodeType && jQuery.find.matchesSelector(cur, selectors))) {
                matched.push(cur);
                break;
            }
            return this.pushStack(1 < matched.length ? jQuery.uniqueSort(matched) : matched);
        },
        index: function(elem) {
            return elem ? "string" == typeof elem ? indexOf.call(jQuery(elem), this[0]) : indexOf.call(this, elem.jquery ? elem[0] : elem) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
        },
        add: function(selector, context) {
            return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
        },
        addBack: function(selector) {
            return this.add(null == selector ? this.prevObject : this.prevObject.filter(selector));
        }
    }), jQuery.each({
        parent: function(elem) {
            var parent = elem.parentNode;
            return parent && 11 !== parent.nodeType ? parent : null;
        },
        parents: function(elem) {
            return dir(elem, "parentNode");
        },
        parentsUntil: function(elem, i, until) {
            return dir(elem, "parentNode", until);
        },
        next: function(elem) {
            return sibling(elem, "nextSibling");
        },
        prev: function(elem) {
            return sibling(elem, "previousSibling");
        },
        nextAll: function(elem) {
            return dir(elem, "nextSibling");
        },
        prevAll: function(elem) {
            return dir(elem, "previousSibling");
        },
        nextUntil: function(elem, i, until) {
            return dir(elem, "nextSibling", until);
        },
        prevUntil: function(elem, i, until) {
            return dir(elem, "previousSibling", until);
        },
        siblings: function(elem) {
            return siblings((elem.parentNode || {}).firstChild, elem);
        },
        children: function(elem) {
            return siblings(elem.firstChild);
        },
        contents: function(elem) {
            return nodeName(elem, "iframe") ? elem.contentDocument : (nodeName(elem, "template") && (elem = elem.content || elem), 
            jQuery.merge([], elem.childNodes));
        }
    }, function(name, fn) {
        jQuery.fn[name] = function(until, selector) {
            var matched = jQuery.map(this, fn, until);
            return "Until" !== name.slice(-5) && (selector = until), selector && "string" == typeof selector && (matched = jQuery.filter(selector, matched)), 
            1 < this.length && (guaranteedUnique[name] || jQuery.uniqueSort(matched), rparentsprev.test(name) && matched.reverse()), 
            this.pushStack(matched);
        };
    });
    var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
    function Identity(v) {
        return v;
    }
    function Thrower(ex) {
        throw ex;
    }
    function adoptValue(value, resolve, reject, noValue) {
        var method;
        try {
            value && isFunction(method = value.promise) ? method.call(value).done(resolve).fail(reject) : value && isFunction(method = value.then) ? method.call(value, resolve, reject) : resolve.apply(void 0, [ value ].slice(noValue));
        } catch (value) {
            reject.apply(void 0, [ value ]);
        }
    }
    jQuery.Callbacks = function(options) {
        options = "string" == typeof options ? function(options) {
            var object = {};
            return jQuery.each(options.match(rnothtmlwhite) || [], function(_, flag) {
                object[flag] = !0;
            }), object;
        }(options) : jQuery.extend({}, options);
        var firing, memory, fired, locked, list = [], queue = [], firingIndex = -1, fire = function() {
            for (locked = locked || options.once, fired = firing = !0; queue.length; firingIndex = -1) for (memory = queue.shift(); ++firingIndex < list.length; ) !1 === list[firingIndex].apply(memory[0], memory[1]) && options.stopOnFalse && (firingIndex = list.length, 
            memory = !1);
            options.memory || (memory = !1), firing = !1, locked && (list = memory ? [] : "");
        }, self = {
            add: function() {
                return list && (memory && !firing && (firingIndex = list.length - 1, queue.push(memory)), 
                function add(args) {
                    jQuery.each(args, function(_, arg) {
                        isFunction(arg) ? options.unique && self.has(arg) || list.push(arg) : arg && arg.length && "string" !== toType(arg) && add(arg);
                    });
                }(arguments), memory && !firing && fire()), this;
            },
            remove: function() {
                return jQuery.each(arguments, function(_, arg) {
                    for (var index; -1 < (index = jQuery.inArray(arg, list, index)); ) list.splice(index, 1), 
                    index <= firingIndex && firingIndex--;
                }), this;
            },
            has: function(fn) {
                return fn ? -1 < jQuery.inArray(fn, list) : 0 < list.length;
            },
            empty: function() {
                return list && (list = []), this;
            },
            disable: function() {
                return locked = queue = [], list = memory = "", this;
            },
            disabled: function() {
                return !list;
            },
            lock: function() {
                return locked = queue = [], memory || firing || (list = memory = ""), this;
            },
            locked: function() {
                return !!locked;
            },
            fireWith: function(context, args) {
                return locked || (args = [ context, (args = args || []).slice ? args.slice() : args ], 
                queue.push(args), firing || fire()), this;
            },
            fire: function() {
                return self.fireWith(this, arguments), this;
            },
            fired: function() {
                return !!fired;
            }
        };
        return self;
    }, jQuery.extend({
        Deferred: function(func) {
            var tuples = [ [ "notify", "progress", jQuery.Callbacks("memory"), jQuery.Callbacks("memory"), 2 ], [ "resolve", "done", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 0, "resolved" ], [ "reject", "fail", jQuery.Callbacks("once memory"), jQuery.Callbacks("once memory"), 1, "rejected" ] ], state = "pending", promise = {
                state: function() {
                    return state;
                },
                always: function() {
                    return deferred.done(arguments).fail(arguments), this;
                },
                catch: function(fn) {
                    return promise.then(null, fn);
                },
                pipe: function() {
                    var fns = arguments;
                    return jQuery.Deferred(function(newDefer) {
                        jQuery.each(tuples, function(i, tuple) {
                            var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
                            deferred[tuple[1]](function() {
                                var returned = fn && fn.apply(this, arguments);
                                returned && isFunction(returned.promise) ? returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject) : newDefer[tuple[0] + "With"](this, fn ? [ returned ] : arguments);
                            });
                        }), fns = null;
                    }).promise();
                },
                then: function(onFulfilled, onRejected, onProgress) {
                    var maxDepth = 0;
                    function resolve(depth, deferred, handler, special) {
                        return function() {
                            var that = this, args = arguments, mightThrow = function() {
                                var returned, then;
                                if (!(depth < maxDepth)) {
                                    if ((returned = handler.apply(that, args)) === deferred.promise()) throw new TypeError("Thenable self-resolution");
                                    then = returned && ("object" == typeof returned || "function" == typeof returned) && returned.then, 
                                    isFunction(then) ? special ? then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special)) : (maxDepth++, 
                                    then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith))) : (handler !== Identity && (that = void 0, 
                                    args = [ returned ]), (special || deferred.resolveWith)(that, args));
                                }
                            }, process = special ? mightThrow : function() {
                                try {
                                    mightThrow();
                                } catch (e) {
                                    jQuery.Deferred.exceptionHook && jQuery.Deferred.exceptionHook(e, process.stackTrace), 
                                    maxDepth <= depth + 1 && (handler !== Thrower && (that = void 0, args = [ e ]), 
                                    deferred.rejectWith(that, args));
                                }
                            };
                            depth ? process() : (jQuery.Deferred.getStackHook && (process.stackTrace = jQuery.Deferred.getStackHook()), 
                            window.setTimeout(process));
                        };
                    }
                    return jQuery.Deferred(function(newDefer) {
                        tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith)), 
                        tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity)), 
                        tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
                    }).promise();
                },
                promise: function(obj) {
                    return null != obj ? jQuery.extend(obj, promise) : promise;
                }
            }, deferred = {};
            return jQuery.each(tuples, function(i, tuple) {
                var list = tuple[2], stateString = tuple[5];
                promise[tuple[1]] = list.add, stateString && list.add(function() {
                    state = stateString;
                }, tuples[3 - i][2].disable, tuples[3 - i][3].disable, tuples[0][2].lock, tuples[0][3].lock), 
                list.add(tuple[3].fire), deferred[tuple[0]] = function() {
                    return deferred[tuple[0] + "With"](this === deferred ? void 0 : this, arguments), 
                    this;
                }, deferred[tuple[0] + "With"] = list.fireWith;
            }), promise.promise(deferred), func && func.call(deferred, deferred), deferred;
        },
        when: function(singleValue) {
            var remaining = arguments.length, i = remaining, resolveContexts = Array(i), resolveValues = slice.call(arguments), master = jQuery.Deferred(), updateFunc = function(i) {
                return function(value) {
                    resolveContexts[i] = this, resolveValues[i] = 1 < arguments.length ? slice.call(arguments) : value, 
                    --remaining || master.resolveWith(resolveContexts, resolveValues);
                };
            };
            if (remaining <= 1 && (adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining), 
            "pending" === master.state() || isFunction(resolveValues[i] && resolveValues[i].then))) return master.then();
            for (;i--; ) adoptValue(resolveValues[i], updateFunc(i), master.reject);
            return master.promise();
        }
    });
    var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
    jQuery.Deferred.exceptionHook = function(error, stack) {
        window.console && window.console.warn && error && rerrorNames.test(error.name) && window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
    }, jQuery.readyException = function(error) {
        window.setTimeout(function() {
            throw error;
        });
    };
    var readyList = jQuery.Deferred();
    function completed() {
        document.removeEventListener("DOMContentLoaded", completed), window.removeEventListener("load", completed), 
        jQuery.ready();
    }
    jQuery.fn.ready = function(fn) {
        return readyList.then(fn).catch(function(error) {
            jQuery.readyException(error);
        }), this;
    }, jQuery.extend({
        isReady: !1,
        readyWait: 1,
        ready: function(wait) {
            (!0 === wait ? --jQuery.readyWait : jQuery.isReady) || (jQuery.isReady = !0) !== wait && 0 < --jQuery.readyWait || readyList.resolveWith(document, [ jQuery ]);
        }
    }), jQuery.ready.then = readyList.then, "complete" === document.readyState || "loading" !== document.readyState && !document.documentElement.doScroll ? window.setTimeout(jQuery.ready) : (document.addEventListener("DOMContentLoaded", completed), 
    window.addEventListener("load", completed));
    var access = function(elems, fn, key, value, chainable, emptyGet, raw) {
        var i = 0, len = elems.length, bulk = null == key;
        if ("object" === toType(key)) for (i in chainable = !0, key) access(elems, fn, i, key[i], !0, emptyGet, raw); else if (void 0 !== value && (chainable = !0, 
        isFunction(value) || (raw = !0), bulk && (raw ? (fn.call(elems, value), fn = null) : (bulk = fn, 
        fn = function(elem, key, value) {
            return bulk.call(jQuery(elem), value);
        })), fn)) for (;i < len; i++) fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
        return chainable ? elems : bulk ? fn.call(elems) : len ? fn(elems[0], key) : emptyGet;
    }, rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g;
    function fcamelCase(all, letter) {
        return letter.toUpperCase();
    }
    function camelCase(string) {
        return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
    }
    var acceptData = function(owner) {
        return 1 === owner.nodeType || 9 === owner.nodeType || !+owner.nodeType;
    };
    function Data() {
        this.expando = jQuery.expando + Data.uid++;
    }
    Data.uid = 1, Data.prototype = {
        cache: function(owner) {
            var value = owner[this.expando];
            return value || (value = {}, acceptData(owner) && (owner.nodeType ? owner[this.expando] = value : Object.defineProperty(owner, this.expando, {
                value: value,
                configurable: !0
            }))), value;
        },
        set: function(owner, data, value) {
            var prop, cache = this.cache(owner);
            if ("string" == typeof data) cache[camelCase(data)] = value; else for (prop in data) cache[camelCase(prop)] = data[prop];
            return cache;
        },
        get: function(owner, key) {
            return void 0 === key ? this.cache(owner) : owner[this.expando] && owner[this.expando][camelCase(key)];
        },
        access: function(owner, key, value) {
            return void 0 === key || key && "string" == typeof key && void 0 === value ? this.get(owner, key) : (this.set(owner, key, value), 
            void 0 !== value ? value : key);
        },
        remove: function(owner, key) {
            var i, cache = owner[this.expando];
            if (void 0 !== cache) {
                if (void 0 !== key) {
                    i = (key = Array.isArray(key) ? key.map(camelCase) : (key = camelCase(key)) in cache ? [ key ] : key.match(rnothtmlwhite) || []).length;
                    for (;i--; ) delete cache[key[i]];
                }
                (void 0 === key || jQuery.isEmptyObject(cache)) && (owner.nodeType ? owner[this.expando] = void 0 : delete owner[this.expando]);
            }
        },
        hasData: function(owner) {
            var cache = owner[this.expando];
            return void 0 !== cache && !jQuery.isEmptyObject(cache);
        }
    };
    var dataPriv = new Data(), dataUser = new Data(), rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g;
    function dataAttr(elem, key, data) {
        var name;
        if (void 0 === data && 1 === elem.nodeType) if (name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase(), 
        "string" == typeof (data = elem.getAttribute(name))) {
            try {
                data = function(data) {
                    return "true" === data || "false" !== data && ("null" === data ? null : data === +data + "" ? +data : rbrace.test(data) ? JSON.parse(data) : data);
                }(data);
            } catch (e) {}
            dataUser.set(elem, key, data);
        } else data = void 0;
        return data;
    }
    jQuery.extend({
        hasData: function(elem) {
            return dataUser.hasData(elem) || dataPriv.hasData(elem);
        },
        data: function(elem, name, data) {
            return dataUser.access(elem, name, data);
        },
        removeData: function(elem, name) {
            dataUser.remove(elem, name);
        },
        _data: function(elem, name, data) {
            return dataPriv.access(elem, name, data);
        },
        _removeData: function(elem, name) {
            dataPriv.remove(elem, name);
        }
    }), jQuery.fn.extend({
        data: function(key, value) {
            var i, name, data, elem = this[0], attrs = elem && elem.attributes;
            if (void 0 === key) {
                if (this.length && (data = dataUser.get(elem), 1 === elem.nodeType && !dataPriv.get(elem, "hasDataAttrs"))) {
                    for (i = attrs.length; i--; ) attrs[i] && 0 === (name = attrs[i].name).indexOf("data-") && (name = camelCase(name.slice(5)), 
                    dataAttr(elem, name, data[name]));
                    dataPriv.set(elem, "hasDataAttrs", !0);
                }
                return data;
            }
            return "object" == typeof key ? this.each(function() {
                dataUser.set(this, key);
            }) : access(this, function(value) {
                var data;
                if (elem && void 0 === value) return void 0 !== (data = dataUser.get(elem, key)) ? data : void 0 !== (data = dataAttr(elem, key)) ? data : void 0;
                this.each(function() {
                    dataUser.set(this, key, value);
                });
            }, null, value, 1 < arguments.length, null, !0);
        },
        removeData: function(key) {
            return this.each(function() {
                dataUser.remove(this, key);
            });
        }
    }), jQuery.extend({
        queue: function(elem, type, data) {
            var queue;
            if (elem) return type = (type || "fx") + "queue", queue = dataPriv.get(elem, type), 
            data && (!queue || Array.isArray(data) ? queue = dataPriv.access(elem, type, jQuery.makeArray(data)) : queue.push(data)), 
            queue || [];
        },
        dequeue: function(elem, type) {
            type = type || "fx";
            var queue = jQuery.queue(elem, type), startLength = queue.length, fn = queue.shift(), hooks = jQuery._queueHooks(elem, type);
            "inprogress" === fn && (fn = queue.shift(), startLength--), fn && ("fx" === type && queue.unshift("inprogress"), 
            delete hooks.stop, fn.call(elem, function() {
                jQuery.dequeue(elem, type);
            }, hooks)), !startLength && hooks && hooks.empty.fire();
        },
        _queueHooks: function(elem, type) {
            var key = type + "queueHooks";
            return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
                empty: jQuery.Callbacks("once memory").add(function() {
                    dataPriv.remove(elem, [ type + "queue", key ]);
                })
            });
        }
    }), jQuery.fn.extend({
        queue: function(type, data) {
            var setter = 2;
            return "string" != typeof type && (data = type, type = "fx", setter--), arguments.length < setter ? jQuery.queue(this[0], type) : void 0 === data ? this : this.each(function() {
                var queue = jQuery.queue(this, type, data);
                jQuery._queueHooks(this, type), "fx" === type && "inprogress" !== queue[0] && jQuery.dequeue(this, type);
            });
        },
        dequeue: function(type) {
            return this.each(function() {
                jQuery.dequeue(this, type);
            });
        },
        clearQueue: function(type) {
            return this.queue(type || "fx", []);
        },
        promise: function(type, obj) {
            var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i = this.length, resolve = function() {
                --count || defer.resolveWith(elements, [ elements ]);
            };
            for ("string" != typeof type && (obj = type, type = void 0), type = type || "fx"; i--; ) (tmp = dataPriv.get(elements[i], type + "queueHooks")) && tmp.empty && (count++, 
            tmp.empty.add(resolve));
            return resolve(), defer.promise(obj);
        }
    });
    var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"), cssExpand = [ "Top", "Right", "Bottom", "Left" ], isHiddenWithinTree = function(elem, el) {
        return "none" === (elem = el || elem).style.display || "" === elem.style.display && jQuery.contains(elem.ownerDocument, elem) && "none" === jQuery.css(elem, "display");
    }, swap = function(elem, options, callback, args) {
        var ret, name, old = {};
        for (name in options) old[name] = elem.style[name], elem.style[name] = options[name];
        for (name in ret = callback.apply(elem, args || []), options) elem.style[name] = old[name];
        return ret;
    };
    var defaultDisplayMap = {};
    function getDefaultDisplay(elem) {
        var temp, doc = elem.ownerDocument, nodeName = elem.nodeName, display = defaultDisplayMap[nodeName];
        return display || (temp = doc.body.appendChild(doc.createElement(nodeName)), display = jQuery.css(temp, "display"), 
        temp.parentNode.removeChild(temp), "none" === display && (display = "block"), defaultDisplayMap[nodeName] = display);
    }
    function showHide(elements, show) {
        for (var display, elem, values = [], index = 0, length = elements.length; index < length; index++) (elem = elements[index]).style && (display = elem.style.display, 
        show ? ("none" === display && (values[index] = dataPriv.get(elem, "display") || null, 
        values[index] || (elem.style.display = "")), "" === elem.style.display && isHiddenWithinTree(elem) && (values[index] = getDefaultDisplay(elem))) : "none" !== display && (values[index] = "none", 
        dataPriv.set(elem, "display", display)));
        for (index = 0; index < length; index++) null != values[index] && (elements[index].style.display = values[index]);
        return elements;
    }
    jQuery.fn.extend({
        show: function() {
            return showHide(this, !0);
        },
        hide: function() {
            return showHide(this);
        },
        toggle: function(state) {
            return "boolean" == typeof state ? state ? this.show() : this.hide() : this.each(function() {
                isHiddenWithinTree(this) ? jQuery(this).show() : jQuery(this).hide();
            });
        }
    });
    var rcheckableType = /^(?:checkbox|radio)$/i, rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i, rscriptType = /^$|^module$|\/(?:java|ecma)script/i, wrapMap = {
        option: [ 1, "<select multiple='multiple'>", "</select>" ],
        thead: [ 1, "<table>", "</table>" ],
        col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
        tr: [ 2, "<table><tbody>", "</tbody></table>" ],
        td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
        _default: [ 0, "", "" ]
    };
    function getAll(context, tag) {
        var ret;
        return ret = void 0 !== context.getElementsByTagName ? context.getElementsByTagName(tag || "*") : void 0 !== context.querySelectorAll ? context.querySelectorAll(tag || "*") : [], 
        void 0 === tag || tag && nodeName(context, tag) ? jQuery.merge([ context ], ret) : ret;
    }
    function setGlobalEval(elems, refElements) {
        for (var i = 0, l = elems.length; i < l; i++) dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
    }
    wrapMap.optgroup = wrapMap.option, wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead, 
    wrapMap.th = wrapMap.td;
    var div, input, rhtml = /<|&#?\w+;/;
    function buildFragment(elems, context, scripts, selection, ignored) {
        for (var elem, tmp, tag, wrap, contains, j, fragment = context.createDocumentFragment(), nodes = [], i = 0, l = elems.length; i < l; i++) if ((elem = elems[i]) || 0 === elem) if ("object" === toType(elem)) jQuery.merge(nodes, elem.nodeType ? [ elem ] : elem); else if (rhtml.test(elem)) {
            for (tmp = tmp || fragment.appendChild(context.createElement("div")), tag = (rtagName.exec(elem) || [ "", "" ])[1].toLowerCase(), 
            wrap = wrapMap[tag] || wrapMap._default, tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2], 
            j = wrap[0]; j--; ) tmp = tmp.lastChild;
            jQuery.merge(nodes, tmp.childNodes), (tmp = fragment.firstChild).textContent = "";
        } else nodes.push(context.createTextNode(elem));
        for (fragment.textContent = "", i = 0; elem = nodes[i++]; ) if (selection && -1 < jQuery.inArray(elem, selection)) ignored && ignored.push(elem); else if (contains = jQuery.contains(elem.ownerDocument, elem), 
        tmp = getAll(fragment.appendChild(elem), "script"), contains && setGlobalEval(tmp), 
        scripts) for (j = 0; elem = tmp[j++]; ) rscriptType.test(elem.type || "") && scripts.push(elem);
        return fragment;
    }
    div = document.createDocumentFragment().appendChild(document.createElement("div")), 
    (input = document.createElement("input")).setAttribute("type", "radio"), input.setAttribute("checked", "checked"), 
    input.setAttribute("name", "t"), div.appendChild(input), support.checkClone = div.cloneNode(!0).cloneNode(!0).lastChild.checked, 
    div.innerHTML = "<textarea>x</textarea>", support.noCloneChecked = !!div.cloneNode(!0).lastChild.defaultValue;
    var documentElement = document.documentElement, rkeyEvent = /^key/, rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
    function returnTrue() {
        return !0;
    }
    function returnFalse() {
        return !1;
    }
    function safeActiveElement() {
        try {
            return document.activeElement;
        } catch (err) {}
    }
    function on(elem, types, selector, data, fn, one) {
        var origFn, type;
        if ("object" == typeof types) {
            for (type in "string" != typeof selector && (data = data || selector, selector = void 0), 
            types) on(elem, type, selector, data, types[type], one);
            return elem;
        }
        if (null == data && null == fn ? (fn = selector, data = selector = void 0) : null == fn && ("string" == typeof selector ? (fn = data, 
        data = void 0) : (fn = data, data = selector, selector = void 0)), !1 === fn) fn = returnFalse; else if (!fn) return elem;
        return 1 === one && (origFn = fn, (fn = function(event) {
            return jQuery().off(event), origFn.apply(this, arguments);
        }).guid = origFn.guid || (origFn.guid = jQuery.guid++)), elem.each(function() {
            jQuery.event.add(this, types, fn, data, selector);
        });
    }
    jQuery.event = {
        global: {},
        add: function(elem, types, handler, data, selector) {
            var handleObjIn, eventHandle, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.get(elem);
            if (elemData) for (handler.handler && (handler = (handleObjIn = handler).handler, 
            selector = handleObjIn.selector), selector && jQuery.find.matchesSelector(documentElement, selector), 
            handler.guid || (handler.guid = jQuery.guid++), (events = elemData.events) || (events = elemData.events = {}), 
            (eventHandle = elemData.handle) || (eventHandle = elemData.handle = function(e) {
                return void 0 !== jQuery && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : void 0;
            }), t = (types = (types || "").match(rnothtmlwhite) || [ "" ]).length; t--; ) type = origType = (tmp = rtypenamespace.exec(types[t]) || [])[1], 
            namespaces = (tmp[2] || "").split(".").sort(), type && (special = jQuery.event.special[type] || {}, 
            type = (selector ? special.delegateType : special.bindType) || type, special = jQuery.event.special[type] || {}, 
            handleObj = jQuery.extend({
                type: type,
                origType: origType,
                data: data,
                handler: handler,
                guid: handler.guid,
                selector: selector,
                needsContext: selector && jQuery.expr.match.needsContext.test(selector),
                namespace: namespaces.join(".")
            }, handleObjIn), (handlers = events[type]) || ((handlers = events[type] = []).delegateCount = 0, 
            special.setup && !1 !== special.setup.call(elem, data, namespaces, eventHandle) || elem.addEventListener && elem.addEventListener(type, eventHandle)), 
            special.add && (special.add.call(elem, handleObj), handleObj.handler.guid || (handleObj.handler.guid = handler.guid)), 
            selector ? handlers.splice(handlers.delegateCount++, 0, handleObj) : handlers.push(handleObj), 
            jQuery.event.global[type] = !0);
        },
        remove: function(elem, types, handler, selector, mappedTypes) {
            var j, origCount, tmp, events, t, handleObj, special, handlers, type, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
            if (elemData && (events = elemData.events)) {
                for (t = (types = (types || "").match(rnothtmlwhite) || [ "" ]).length; t--; ) if (type = origType = (tmp = rtypenamespace.exec(types[t]) || [])[1], 
                namespaces = (tmp[2] || "").split(".").sort(), type) {
                    for (special = jQuery.event.special[type] || {}, handlers = events[type = (selector ? special.delegateType : special.bindType) || type] || [], 
                    tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"), 
                    origCount = j = handlers.length; j--; ) handleObj = handlers[j], !mappedTypes && origType !== handleObj.origType || handler && handler.guid !== handleObj.guid || tmp && !tmp.test(handleObj.namespace) || selector && selector !== handleObj.selector && ("**" !== selector || !handleObj.selector) || (handlers.splice(j, 1), 
                    handleObj.selector && handlers.delegateCount--, special.remove && special.remove.call(elem, handleObj));
                    origCount && !handlers.length && (special.teardown && !1 !== special.teardown.call(elem, namespaces, elemData.handle) || jQuery.removeEvent(elem, type, elemData.handle), 
                    delete events[type]);
                } else for (type in events) jQuery.event.remove(elem, type + types[t], handler, selector, !0);
                jQuery.isEmptyObject(events) && dataPriv.remove(elem, "handle events");
            }
        },
        dispatch: function(nativeEvent) {
            var i, j, ret, matched, handleObj, handlerQueue, event = jQuery.event.fix(nativeEvent), args = new Array(arguments.length), handlers = (dataPriv.get(this, "events") || {})[event.type] || [], special = jQuery.event.special[event.type] || {};
            for (args[0] = event, i = 1; i < arguments.length; i++) args[i] = arguments[i];
            if (event.delegateTarget = this, !special.preDispatch || !1 !== special.preDispatch.call(this, event)) {
                for (handlerQueue = jQuery.event.handlers.call(this, event, handlers), i = 0; (matched = handlerQueue[i++]) && !event.isPropagationStopped(); ) for (event.currentTarget = matched.elem, 
                j = 0; (handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped(); ) event.rnamespace && !event.rnamespace.test(handleObj.namespace) || (event.handleObj = handleObj, 
                event.data = handleObj.data, void 0 !== (ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args)) && !1 === (event.result = ret) && (event.preventDefault(), 
                event.stopPropagation()));
                return special.postDispatch && special.postDispatch.call(this, event), event.result;
            }
        },
        handlers: function(event, handlers) {
            var i, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event.target;
            if (delegateCount && cur.nodeType && !("click" === event.type && 1 <= event.button)) for (;cur !== this; cur = cur.parentNode || this) if (1 === cur.nodeType && ("click" !== event.type || !0 !== cur.disabled)) {
                for (matchedHandlers = [], matchedSelectors = {}, i = 0; i < delegateCount; i++) void 0 === matchedSelectors[sel = (handleObj = handlers[i]).selector + " "] && (matchedSelectors[sel] = handleObj.needsContext ? -1 < jQuery(sel, this).index(cur) : jQuery.find(sel, this, null, [ cur ]).length), 
                matchedSelectors[sel] && matchedHandlers.push(handleObj);
                matchedHandlers.length && handlerQueue.push({
                    elem: cur,
                    handlers: matchedHandlers
                });
            }
            return cur = this, delegateCount < handlers.length && handlerQueue.push({
                elem: cur,
                handlers: handlers.slice(delegateCount)
            }), handlerQueue;
        },
        addProp: function(name, hook) {
            Object.defineProperty(jQuery.Event.prototype, name, {
                enumerable: !0,
                configurable: !0,
                get: isFunction(hook) ? function() {
                    if (this.originalEvent) return hook(this.originalEvent);
                } : function() {
                    if (this.originalEvent) return this.originalEvent[name];
                },
                set: function(value) {
                    Object.defineProperty(this, name, {
                        enumerable: !0,
                        configurable: !0,
                        writable: !0,
                        value: value
                    });
                }
            });
        },
        fix: function(originalEvent) {
            return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
        },
        special: {
            load: {
                noBubble: !0
            },
            focus: {
                trigger: function() {
                    if (this !== safeActiveElement() && this.focus) return this.focus(), !1;
                },
                delegateType: "focusin"
            },
            blur: {
                trigger: function() {
                    if (this === safeActiveElement() && this.blur) return this.blur(), !1;
                },
                delegateType: "focusout"
            },
            click: {
                trigger: function() {
                    if ("checkbox" === this.type && this.click && nodeName(this, "input")) return this.click(), 
                    !1;
                },
                _default: function(event) {
                    return nodeName(event.target, "a");
                }
            },
            beforeunload: {
                postDispatch: function(event) {
                    void 0 !== event.result && event.originalEvent && (event.originalEvent.returnValue = event.result);
                }
            }
        }
    }, jQuery.removeEvent = function(elem, type, handle) {
        elem.removeEventListener && elem.removeEventListener(type, handle);
    }, jQuery.Event = function(src, props) {
        if (!(this instanceof jQuery.Event)) return new jQuery.Event(src, props);
        src && src.type ? (this.originalEvent = src, this.type = src.type, this.isDefaultPrevented = src.defaultPrevented || void 0 === src.defaultPrevented && !1 === src.returnValue ? returnTrue : returnFalse, 
        this.target = src.target && 3 === src.target.nodeType ? src.target.parentNode : src.target, 
        this.currentTarget = src.currentTarget, this.relatedTarget = src.relatedTarget) : this.type = src, 
        props && jQuery.extend(this, props), this.timeStamp = src && src.timeStamp || Date.now(), 
        this[jQuery.expando] = !0;
    }, jQuery.Event.prototype = {
        constructor: jQuery.Event,
        isDefaultPrevented: returnFalse,
        isPropagationStopped: returnFalse,
        isImmediatePropagationStopped: returnFalse,
        isSimulated: !1,
        preventDefault: function() {
            var e = this.originalEvent;
            this.isDefaultPrevented = returnTrue, e && !this.isSimulated && e.preventDefault();
        },
        stopPropagation: function() {
            var e = this.originalEvent;
            this.isPropagationStopped = returnTrue, e && !this.isSimulated && e.stopPropagation();
        },
        stopImmediatePropagation: function() {
            var e = this.originalEvent;
            this.isImmediatePropagationStopped = returnTrue, e && !this.isSimulated && e.stopImmediatePropagation(), 
            this.stopPropagation();
        }
    }, jQuery.each({
        altKey: !0,
        bubbles: !0,
        cancelable: !0,
        changedTouches: !0,
        ctrlKey: !0,
        detail: !0,
        eventPhase: !0,
        metaKey: !0,
        pageX: !0,
        pageY: !0,
        shiftKey: !0,
        view: !0,
        char: !0,
        charCode: !0,
        key: !0,
        keyCode: !0,
        button: !0,
        buttons: !0,
        clientX: !0,
        clientY: !0,
        offsetX: !0,
        offsetY: !0,
        pointerId: !0,
        pointerType: !0,
        screenX: !0,
        screenY: !0,
        targetTouches: !0,
        toElement: !0,
        touches: !0,
        which: function(event) {
            var button = event.button;
            return null == event.which && rkeyEvent.test(event.type) ? null != event.charCode ? event.charCode : event.keyCode : !event.which && void 0 !== button && rmouseEvent.test(event.type) ? 1 & button ? 1 : 2 & button ? 3 : 4 & button ? 2 : 0 : event.which;
        }
    }, jQuery.event.addProp), jQuery.each({
        mouseenter: "mouseover",
        mouseleave: "mouseout",
        pointerenter: "pointerover",
        pointerleave: "pointerout"
    }, function(orig, fix) {
        jQuery.event.special[orig] = {
            delegateType: fix,
            bindType: fix,
            handle: function(event) {
                var ret, related = event.relatedTarget, handleObj = event.handleObj;
                return related && (related === this || jQuery.contains(this, related)) || (event.type = handleObj.origType, 
                ret = handleObj.handler.apply(this, arguments), event.type = fix), ret;
            }
        };
    }), jQuery.fn.extend({
        on: function(types, selector, data, fn) {
            return on(this, types, selector, data, fn);
        },
        one: function(types, selector, data, fn) {
            return on(this, types, selector, data, fn, 1);
        },
        off: function(types, selector, fn) {
            var handleObj, type;
            if (types && types.preventDefault && types.handleObj) return handleObj = types.handleObj, 
            jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler), 
            this;
            if ("object" == typeof types) {
                for (type in types) this.off(type, selector, types[type]);
                return this;
            }
            return !1 !== selector && "function" != typeof selector || (fn = selector, selector = void 0), 
            !1 === fn && (fn = returnFalse), this.each(function() {
                jQuery.event.remove(this, types, fn, selector);
            });
        }
    });
    var rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, rnoInnerhtml = /<script|<style|<link/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
    function manipulationTarget(elem, content) {
        return nodeName(elem, "table") && nodeName(11 !== content.nodeType ? content : content.firstChild, "tr") && jQuery(elem).children("tbody")[0] || elem;
    }
    function disableScript(elem) {
        return elem.type = (null !== elem.getAttribute("type")) + "/" + elem.type, elem;
    }
    function restoreScript(elem) {
        return "true/" === (elem.type || "").slice(0, 5) ? elem.type = elem.type.slice(5) : elem.removeAttribute("type"), 
        elem;
    }
    function cloneCopyEvent(src, dest) {
        var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
        if (1 === dest.nodeType) {
            if (dataPriv.hasData(src) && (pdataOld = dataPriv.access(src), pdataCur = dataPriv.set(dest, pdataOld), 
            events = pdataOld.events)) for (type in delete pdataCur.handle, pdataCur.events = {}, 
            events) for (i = 0, l = events[type].length; i < l; i++) jQuery.event.add(dest, type, events[type][i]);
            dataUser.hasData(src) && (udataOld = dataUser.access(src), udataCur = jQuery.extend({}, udataOld), 
            dataUser.set(dest, udataCur));
        }
    }
    function domManip(collection, args, callback, ignored) {
        args = concat.apply([], args);
        var fragment, first, scripts, hasScripts, node, doc, i = 0, l = collection.length, iNoClone = l - 1, value = args[0], valueIsFunction = isFunction(value);
        if (valueIsFunction || 1 < l && "string" == typeof value && !support.checkClone && rchecked.test(value)) return collection.each(function(index) {
            var self = collection.eq(index);
            valueIsFunction && (args[0] = value.call(this, index, self.html())), domManip(self, args, callback, ignored);
        });
        if (l && (first = (fragment = buildFragment(args, collection[0].ownerDocument, !1, collection, ignored)).firstChild, 
        1 === fragment.childNodes.length && (fragment = first), first || ignored)) {
            for (hasScripts = (scripts = jQuery.map(getAll(fragment, "script"), disableScript)).length; i < l; i++) node = fragment, 
            i !== iNoClone && (node = jQuery.clone(node, !0, !0), hasScripts && jQuery.merge(scripts, getAll(node, "script"))), 
            callback.call(collection[i], node, i);
            if (hasScripts) for (doc = scripts[scripts.length - 1].ownerDocument, jQuery.map(scripts, restoreScript), 
            i = 0; i < hasScripts; i++) node = scripts[i], rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node) && (node.src && "module" !== (node.type || "").toLowerCase() ? jQuery._evalUrl && jQuery._evalUrl(node.src) : DOMEval(node.textContent.replace(rcleanScript, ""), doc, node));
        }
        return collection;
    }
    function remove(elem, selector, keepData) {
        for (var node, nodes = selector ? jQuery.filter(selector, elem) : elem, i = 0; null != (node = nodes[i]); i++) keepData || 1 !== node.nodeType || jQuery.cleanData(getAll(node)), 
        node.parentNode && (keepData && jQuery.contains(node.ownerDocument, node) && setGlobalEval(getAll(node, "script")), 
        node.parentNode.removeChild(node));
        return elem;
    }
    jQuery.extend({
        htmlPrefilter: function(html) {
            return html.replace(rxhtmlTag, "<$1></$2>");
        },
        clone: function(elem, dataAndEvents, deepDataAndEvents) {
            var i, l, srcElements, destElements, src, dest, nodeName, clone = elem.cloneNode(!0), inPage = jQuery.contains(elem.ownerDocument, elem);
            if (!(support.noCloneChecked || 1 !== elem.nodeType && 11 !== elem.nodeType || jQuery.isXMLDoc(elem))) for (destElements = getAll(clone), 
            i = 0, l = (srcElements = getAll(elem)).length; i < l; i++) src = srcElements[i], 
            dest = destElements[i], void 0, "input" === (nodeName = dest.nodeName.toLowerCase()) && rcheckableType.test(src.type) ? dest.checked = src.checked : "input" !== nodeName && "textarea" !== nodeName || (dest.defaultValue = src.defaultValue);
            if (dataAndEvents) if (deepDataAndEvents) for (srcElements = srcElements || getAll(elem), 
            destElements = destElements || getAll(clone), i = 0, l = srcElements.length; i < l; i++) cloneCopyEvent(srcElements[i], destElements[i]); else cloneCopyEvent(elem, clone);
            return 0 < (destElements = getAll(clone, "script")).length && setGlobalEval(destElements, !inPage && getAll(elem, "script")), 
            clone;
        },
        cleanData: function(elems) {
            for (var data, elem, type, special = jQuery.event.special, i = 0; void 0 !== (elem = elems[i]); i++) if (acceptData(elem)) {
                if (data = elem[dataPriv.expando]) {
                    if (data.events) for (type in data.events) special[type] ? jQuery.event.remove(elem, type) : jQuery.removeEvent(elem, type, data.handle);
                    elem[dataPriv.expando] = void 0;
                }
                elem[dataUser.expando] && (elem[dataUser.expando] = void 0);
            }
        }
    }), jQuery.fn.extend({
        detach: function(selector) {
            return remove(this, selector, !0);
        },
        remove: function(selector) {
            return remove(this, selector);
        },
        text: function(value) {
            return access(this, function(value) {
                return void 0 === value ? jQuery.text(this) : this.empty().each(function() {
                    1 !== this.nodeType && 11 !== this.nodeType && 9 !== this.nodeType || (this.textContent = value);
                });
            }, null, value, arguments.length);
        },
        append: function() {
            return domManip(this, arguments, function(elem) {
                1 !== this.nodeType && 11 !== this.nodeType && 9 !== this.nodeType || manipulationTarget(this, elem).appendChild(elem);
            });
        },
        prepend: function() {
            return domManip(this, arguments, function(elem) {
                if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) {
                    var target = manipulationTarget(this, elem);
                    target.insertBefore(elem, target.firstChild);
                }
            });
        },
        before: function() {
            return domManip(this, arguments, function(elem) {
                this.parentNode && this.parentNode.insertBefore(elem, this);
            });
        },
        after: function() {
            return domManip(this, arguments, function(elem) {
                this.parentNode && this.parentNode.insertBefore(elem, this.nextSibling);
            });
        },
        empty: function() {
            for (var elem, i = 0; null != (elem = this[i]); i++) 1 === elem.nodeType && (jQuery.cleanData(getAll(elem, !1)), 
            elem.textContent = "");
            return this;
        },
        clone: function(dataAndEvents, deepDataAndEvents) {
            return dataAndEvents = null != dataAndEvents && dataAndEvents, deepDataAndEvents = null == deepDataAndEvents ? dataAndEvents : deepDataAndEvents, 
            this.map(function() {
                return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
            });
        },
        html: function(value) {
            return access(this, function(value) {
                var elem = this[0] || {}, i = 0, l = this.length;
                if (void 0 === value && 1 === elem.nodeType) return elem.innerHTML;
                if ("string" == typeof value && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || [ "", "" ])[1].toLowerCase()]) {
                    value = jQuery.htmlPrefilter(value);
                    try {
                        for (;i < l; i++) 1 === (elem = this[i] || {}).nodeType && (jQuery.cleanData(getAll(elem, !1)), 
                        elem.innerHTML = value);
                        elem = 0;
                    } catch (e) {}
                }
                elem && this.empty().append(value);
            }, null, value, arguments.length);
        },
        replaceWith: function() {
            var ignored = [];
            return domManip(this, arguments, function(elem) {
                var parent = this.parentNode;
                jQuery.inArray(this, ignored) < 0 && (jQuery.cleanData(getAll(this)), parent && parent.replaceChild(elem, this));
            }, ignored);
        }
    }), jQuery.each({
        appendTo: "append",
        prependTo: "prepend",
        insertBefore: "before",
        insertAfter: "after",
        replaceAll: "replaceWith"
    }, function(name, original) {
        jQuery.fn[name] = function(selector) {
            for (var elems, ret = [], insert = jQuery(selector), last = insert.length - 1, i = 0; i <= last; i++) elems = i === last ? this : this.clone(!0), 
            jQuery(insert[i])[original](elems), push.apply(ret, elems.get());
            return this.pushStack(ret);
        };
    });
    var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i"), getStyles = function(elem) {
        var view = elem.ownerDocument.defaultView;
        return view && view.opener || (view = window), view.getComputedStyle(elem);
    }, rboxStyle = new RegExp(cssExpand.join("|"), "i");
    function curCSS(elem, name, computed) {
        var width, minWidth, maxWidth, ret, style = elem.style;
        return (computed = computed || getStyles(elem)) && ("" !== (ret = computed.getPropertyValue(name) || computed[name]) || jQuery.contains(elem.ownerDocument, elem) || (ret = jQuery.style(elem, name)), 
        !support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name) && (width = style.width, 
        minWidth = style.minWidth, maxWidth = style.maxWidth, style.minWidth = style.maxWidth = style.width = ret, 
        ret = computed.width, style.width = width, style.minWidth = minWidth, style.maxWidth = maxWidth)), 
        void 0 !== ret ? ret + "" : ret;
    }
    function addGetHookIf(conditionFn, hookFn) {
        return {
            get: function() {
                if (!conditionFn()) return (this.get = hookFn).apply(this, arguments);
                delete this.get;
            }
        };
    }
    !function() {
        function computeStyleTests() {
            if (div) {
                container.style.cssText = "position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0", 
                div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%", 
                documentElement.appendChild(container).appendChild(div);
                var divStyle = window.getComputedStyle(div);
                pixelPositionVal = "1%" !== divStyle.top, reliableMarginLeftVal = 12 === roundPixelMeasures(divStyle.marginLeft), 
                div.style.right = "60%", pixelBoxStylesVal = 36 === roundPixelMeasures(divStyle.right), 
                boxSizingReliableVal = 36 === roundPixelMeasures(divStyle.width), div.style.position = "absolute", 
                scrollboxSizeVal = 36 === div.offsetWidth || "absolute", documentElement.removeChild(container), 
                div = null;
            }
        }
        function roundPixelMeasures(measure) {
            return Math.round(parseFloat(measure));
        }
        var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, reliableMarginLeftVal, container = document.createElement("div"), div = document.createElement("div");
        div.style && (div.style.backgroundClip = "content-box", div.cloneNode(!0).style.backgroundClip = "", 
        support.clearCloneStyle = "content-box" === div.style.backgroundClip, jQuery.extend(support, {
            boxSizingReliable: function() {
                return computeStyleTests(), boxSizingReliableVal;
            },
            pixelBoxStyles: function() {
                return computeStyleTests(), pixelBoxStylesVal;
            },
            pixelPosition: function() {
                return computeStyleTests(), pixelPositionVal;
            },
            reliableMarginLeft: function() {
                return computeStyleTests(), reliableMarginLeftVal;
            },
            scrollboxSize: function() {
                return computeStyleTests(), scrollboxSizeVal;
            }
        }));
    }();
    var rdisplayswap = /^(none|table(?!-c[ea]).+)/, rcustomProp = /^--/, cssShow = {
        position: "absolute",
        visibility: "hidden",
        display: "block"
    }, cssNormalTransform = {
        letterSpacing: "0",
        fontWeight: "400"
    }, cssPrefixes = [ "Webkit", "Moz", "ms" ], emptyStyle = document.createElement("div").style;
    function finalPropName(name) {
        var ret = jQuery.cssProps[name];
        return ret || (ret = jQuery.cssProps[name] = function(name) {
            if (name in emptyStyle) return name;
            for (var capName = name[0].toUpperCase() + name.slice(1), i = cssPrefixes.length; i--; ) if ((name = cssPrefixes[i] + capName) in emptyStyle) return name;
        }(name) || name), ret;
    }
    function setPositiveNumber(elem, value, subtract) {
        var matches = rcssNum.exec(value);
        return matches ? Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
    }
    function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
        var i = "width" === dimension ? 1 : 0, extra = 0, delta = 0;
        if (box === (isBorderBox ? "border" : "content")) return 0;
        for (;i < 4; i += 2) "margin" === box && (delta += jQuery.css(elem, box + cssExpand[i], !0, styles)), 
        isBorderBox ? ("content" === box && (delta -= jQuery.css(elem, "padding" + cssExpand[i], !0, styles)), 
        "margin" !== box && (delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", !0, styles))) : (delta += jQuery.css(elem, "padding" + cssExpand[i], !0, styles), 
        "padding" !== box ? delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", !0, styles) : extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", !0, styles));
        return !isBorderBox && 0 <= computedVal && (delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - .5))), 
        delta;
    }
    function getWidthOrHeight(elem, dimension, extra) {
        var styles = getStyles(elem), val = curCSS(elem, dimension, styles), isBorderBox = "border-box" === jQuery.css(elem, "boxSizing", !1, styles), valueIsBorderBox = isBorderBox;
        if (rnumnonpx.test(val)) {
            if (!extra) return val;
            val = "auto";
        }
        return valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]), 
        ("auto" === val || !parseFloat(val) && "inline" === jQuery.css(elem, "display", !1, styles)) && (val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)], 
        valueIsBorderBox = !0), (val = parseFloat(val) || 0) + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles, val) + "px";
    }
    jQuery.extend({
        cssHooks: {
            opacity: {
                get: function(elem, computed) {
                    if (computed) {
                        var ret = curCSS(elem, "opacity");
                        return "" === ret ? "1" : ret;
                    }
                }
            }
        },
        cssNumber: {
            animationIterationCount: !0,
            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: {},
        style: function(elem, name, value, extra) {
            if (elem && 3 !== elem.nodeType && 8 !== elem.nodeType && elem.style) {
                var ret, type, hooks, origName = camelCase(name), isCustomProp = rcustomProp.test(name), style = elem.style;
                if (isCustomProp || (name = finalPropName(origName)), hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName], 
                void 0 === value) return hooks && "get" in hooks && void 0 !== (ret = hooks.get(elem, !1, extra)) ? ret : style[name];
                "string" === (type = typeof value) && (ret = rcssNum.exec(value)) && ret[1] && (value = function(elem, prop, valueParts, tween) {
                    var adjusted, scale, maxIterations = 20, currentValue = tween ? function() {
                        return tween.cur();
                    } : function() {
                        return jQuery.css(elem, prop, "");
                    }, initial = currentValue(), unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"), initialInUnit = (jQuery.cssNumber[prop] || "px" !== unit && +initial) && rcssNum.exec(jQuery.css(elem, prop));
                    if (initialInUnit && initialInUnit[3] !== unit) {
                        for (initial /= 2, unit = unit || initialInUnit[3], initialInUnit = +initial || 1; maxIterations--; ) jQuery.style(elem, prop, initialInUnit + unit), 
                        (1 - scale) * (1 - (scale = currentValue() / initial || .5)) <= 0 && (maxIterations = 0), 
                        initialInUnit /= scale;
                        initialInUnit *= 2, jQuery.style(elem, prop, initialInUnit + unit), valueParts = valueParts || [];
                    }
                    return valueParts && (initialInUnit = +initialInUnit || +initial || 0, adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2], 
                    tween && (tween.unit = unit, tween.start = initialInUnit, tween.end = adjusted)), 
                    adjusted;
                }(elem, name, ret), type = "number"), null != value && value == value && ("number" === type && (value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px")), 
                support.clearCloneStyle || "" !== value || 0 !== name.indexOf("background") || (style[name] = "inherit"), 
                hooks && "set" in hooks && void 0 === (value = hooks.set(elem, value, extra)) || (isCustomProp ? style.setProperty(name, value) : style[name] = value));
            }
        },
        css: function(elem, name, extra, styles) {
            var val, num, hooks, origName = camelCase(name);
            return rcustomProp.test(name) || (name = finalPropName(origName)), (hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]) && "get" in hooks && (val = hooks.get(elem, !0, extra)), 
            void 0 === val && (val = curCSS(elem, name, styles)), "normal" === val && name in cssNormalTransform && (val = cssNormalTransform[name]), 
            "" === extra || extra ? (num = parseFloat(val), !0 === extra || isFinite(num) ? num || 0 : val) : val;
        }
    }), jQuery.each([ "height", "width" ], function(i, dimension) {
        jQuery.cssHooks[dimension] = {
            get: function(elem, computed, extra) {
                if (computed) return !rdisplayswap.test(jQuery.css(elem, "display")) || elem.getClientRects().length && elem.getBoundingClientRect().width ? getWidthOrHeight(elem, dimension, extra) : swap(elem, cssShow, function() {
                    return getWidthOrHeight(elem, dimension, extra);
                });
            },
            set: function(elem, value, extra) {
                var matches, styles = getStyles(elem), isBorderBox = "border-box" === jQuery.css(elem, "boxSizing", !1, styles), subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
                return isBorderBox && support.scrollboxSize() === styles.position && (subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", !1, styles) - .5)), 
                subtract && (matches = rcssNum.exec(value)) && "px" !== (matches[3] || "px") && (elem.style[dimension] = value, 
                value = jQuery.css(elem, dimension)), setPositiveNumber(0, value, subtract);
            }
        };
    }), jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function(elem, computed) {
        if (computed) return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, {
            marginLeft: 0
        }, function() {
            return elem.getBoundingClientRect().left;
        })) + "px";
    }), jQuery.each({
        margin: "",
        padding: "",
        border: "Width"
    }, function(prefix, suffix) {
        jQuery.cssHooks[prefix + suffix] = {
            expand: function(value) {
                for (var i = 0, expanded = {}, parts = "string" == typeof value ? value.split(" ") : [ value ]; i < 4; i++) expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
                return expanded;
            }
        }, "margin" !== prefix && (jQuery.cssHooks[prefix + suffix].set = setPositiveNumber);
    }), jQuery.fn.extend({
        css: function(name, value) {
            return access(this, function(elem, name, value) {
                var styles, len, map = {}, i = 0;
                if (Array.isArray(name)) {
                    for (styles = getStyles(elem), len = name.length; i < len; i++) map[name[i]] = jQuery.css(elem, name[i], !1, styles);
                    return map;
                }
                return void 0 !== value ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
            }, name, value, 1 < arguments.length);
        }
    }), jQuery.fn.delay = function(time, type) {
        return time = jQuery.fx && jQuery.fx.speeds[time] || time, type = type || "fx", 
        this.queue(type, function(next, hooks) {
            var timeout = window.setTimeout(next, time);
            hooks.stop = function() {
                window.clearTimeout(timeout);
            };
        });
    }, function() {
        var input = document.createElement("input"), opt = document.createElement("select").appendChild(document.createElement("option"));
        input.type = "checkbox", support.checkOn = "" !== input.value, support.optSelected = opt.selected, 
        (input = document.createElement("input")).value = "t", input.type = "radio", support.radioValue = "t" === input.value;
    }();
    var boolHook, attrHandle = jQuery.expr.attrHandle;
    jQuery.fn.extend({
        attr: function(name, value) {
            return access(this, jQuery.attr, name, value, 1 < arguments.length);
        },
        removeAttr: function(name) {
            return this.each(function() {
                jQuery.removeAttr(this, name);
            });
        }
    }), jQuery.extend({
        attr: function(elem, name, value) {
            var ret, hooks, nType = elem.nodeType;
            if (3 !== nType && 8 !== nType && 2 !== nType) return void 0 === elem.getAttribute ? jQuery.prop(elem, name, value) : (1 === nType && jQuery.isXMLDoc(elem) || (hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : void 0)), 
            void 0 !== value ? null === value ? void jQuery.removeAttr(elem, name) : hooks && "set" in hooks && void 0 !== (ret = hooks.set(elem, value, name)) ? ret : (elem.setAttribute(name, value + ""), 
            value) : hooks && "get" in hooks && null !== (ret = hooks.get(elem, name)) ? ret : null == (ret = jQuery.find.attr(elem, name)) ? void 0 : ret);
        },
        attrHooks: {
            type: {
                set: function(elem, value) {
                    if (!support.radioValue && "radio" === value && nodeName(elem, "input")) {
                        var val = elem.value;
                        return elem.setAttribute("type", value), val && (elem.value = val), value;
                    }
                }
            }
        },
        removeAttr: function(elem, value) {
            var name, i = 0, attrNames = value && value.match(rnothtmlwhite);
            if (attrNames && 1 === elem.nodeType) for (;name = attrNames[i++]; ) elem.removeAttribute(name);
        }
    }), boolHook = {
        set: function(elem, value, name) {
            return !1 === value ? jQuery.removeAttr(elem, name) : elem.setAttribute(name, name), 
            name;
        }
    }, jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(i, name) {
        var getter = attrHandle[name] || jQuery.find.attr;
        attrHandle[name] = function(elem, name, isXML) {
            var ret, handle, lowercaseName = name.toLowerCase();
            return isXML || (handle = attrHandle[lowercaseName], attrHandle[lowercaseName] = ret, 
            ret = null != getter(elem, name, isXML) ? lowercaseName : null, attrHandle[lowercaseName] = handle), 
            ret;
        };
    });
    var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i;
    function stripAndCollapse(value) {
        return (value.match(rnothtmlwhite) || []).join(" ");
    }
    function getClass(elem) {
        return elem.getAttribute && elem.getAttribute("class") || "";
    }
    function classesToArray(value) {
        return Array.isArray(value) ? value : "string" == typeof value && value.match(rnothtmlwhite) || [];
    }
    jQuery.fn.extend({
        prop: function(name, value) {
            return access(this, jQuery.prop, name, value, 1 < arguments.length);
        },
        removeProp: function(name) {
            return this.each(function() {
                delete this[jQuery.propFix[name] || name];
            });
        }
    }), jQuery.extend({
        prop: function(elem, name, value) {
            var ret, hooks, nType = elem.nodeType;
            if (3 !== nType && 8 !== nType && 2 !== nType) return 1 === nType && jQuery.isXMLDoc(elem) || (name = jQuery.propFix[name] || name, 
            hooks = jQuery.propHooks[name]), void 0 !== value ? hooks && "set" in hooks && void 0 !== (ret = hooks.set(elem, value, name)) ? ret : elem[name] = value : hooks && "get" in hooks && null !== (ret = hooks.get(elem, name)) ? ret : elem[name];
        },
        propHooks: {
            tabIndex: {
                get: function(elem) {
                    var tabindex = jQuery.find.attr(elem, "tabindex");
                    return tabindex ? parseInt(tabindex, 10) : rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href ? 0 : -1;
                }
            }
        },
        propFix: {
            for: "htmlFor",
            class: "className"
        }
    }), support.optSelected || (jQuery.propHooks.selected = {
        get: function(elem) {
            var parent = elem.parentNode;
            return parent && parent.parentNode && parent.parentNode.selectedIndex, null;
        },
        set: function(elem) {
            var parent = elem.parentNode;
            parent && (parent.selectedIndex, parent.parentNode && parent.parentNode.selectedIndex);
        }
    }), jQuery.each([ "tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable" ], function() {
        jQuery.propFix[this.toLowerCase()] = this;
    }), jQuery.fn.extend({
        addClass: function(value) {
            var classes, elem, cur, curValue, clazz, j, finalValue, i = 0;
            if (isFunction(value)) return this.each(function(j) {
                jQuery(this).addClass(value.call(this, j, getClass(this)));
            });
            if ((classes = classesToArray(value)).length) for (;elem = this[i++]; ) if (curValue = getClass(elem), 
            cur = 1 === elem.nodeType && " " + stripAndCollapse(curValue) + " ") {
                for (j = 0; clazz = classes[j++]; ) cur.indexOf(" " + clazz + " ") < 0 && (cur += clazz + " ");
                curValue !== (finalValue = stripAndCollapse(cur)) && elem.setAttribute("class", finalValue);
            }
            return this;
        },
        removeClass: function(value) {
            var classes, elem, cur, curValue, clazz, j, finalValue, i = 0;
            if (isFunction(value)) return this.each(function(j) {
                jQuery(this).removeClass(value.call(this, j, getClass(this)));
            });
            if (!arguments.length) return this.attr("class", "");
            if ((classes = classesToArray(value)).length) for (;elem = this[i++]; ) if (curValue = getClass(elem), 
            cur = 1 === elem.nodeType && " " + stripAndCollapse(curValue) + " ") {
                for (j = 0; clazz = classes[j++]; ) for (;-1 < cur.indexOf(" " + clazz + " "); ) cur = cur.replace(" " + clazz + " ", " ");
                curValue !== (finalValue = stripAndCollapse(cur)) && elem.setAttribute("class", finalValue);
            }
            return this;
        },
        toggleClass: function(value, stateVal) {
            var type = typeof value, isValidValue = "string" === type || Array.isArray(value);
            return "boolean" == typeof stateVal && isValidValue ? stateVal ? this.addClass(value) : this.removeClass(value) : isFunction(value) ? this.each(function(i) {
                jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
            }) : this.each(function() {
                var className, i, self, classNames;
                if (isValidValue) for (i = 0, self = jQuery(this), classNames = classesToArray(value); className = classNames[i++]; ) self.hasClass(className) ? self.removeClass(className) : self.addClass(className); else void 0 !== value && "boolean" !== type || ((className = getClass(this)) && dataPriv.set(this, "__className__", className), 
                this.setAttribute && this.setAttribute("class", className || !1 === value ? "" : dataPriv.get(this, "__className__") || ""));
            });
        },
        hasClass: function(selector) {
            var className, elem, i = 0;
            for (className = " " + selector + " "; elem = this[i++]; ) if (1 === elem.nodeType && -1 < (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className)) return !0;
            return !1;
        }
    });
    var rreturn = /\r/g;
    jQuery.fn.extend({
        val: function(value) {
            var hooks, ret, valueIsFunction, elem = this[0];
            return arguments.length ? (valueIsFunction = isFunction(value), this.each(function(i) {
                var val;
                1 === this.nodeType && (null == (val = valueIsFunction ? value.call(this, i, jQuery(this).val()) : value) ? val = "" : "number" == typeof val ? val += "" : Array.isArray(val) && (val = jQuery.map(val, function(value) {
                    return null == value ? "" : value + "";
                })), (hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()]) && "set" in hooks && void 0 !== hooks.set(this, val, "value") || (this.value = val));
            })) : elem ? (hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()]) && "get" in hooks && void 0 !== (ret = hooks.get(elem, "value")) ? ret : "string" == typeof (ret = elem.value) ? ret.replace(rreturn, "") : null == ret ? "" : ret : void 0;
        }
    }), jQuery.extend({
        valHooks: {
            option: {
                get: function(elem) {
                    var val = jQuery.find.attr(elem, "value");
                    return null != val ? val : stripAndCollapse(jQuery.text(elem));
                }
            },
            select: {
                get: function(elem) {
                    var value, option, i, options = elem.options, index = elem.selectedIndex, one = "select-one" === elem.type, values = one ? null : [], max = one ? index + 1 : options.length;
                    for (i = index < 0 ? max : one ? index : 0; i < max; i++) if (((option = options[i]).selected || i === index) && !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
                        if (value = jQuery(option).val(), one) return value;
                        values.push(value);
                    }
                    return values;
                },
                set: function(elem, value) {
                    for (var optionSet, option, options = elem.options, values = jQuery.makeArray(value), i = options.length; i--; ) ((option = options[i]).selected = -1 < jQuery.inArray(jQuery.valHooks.option.get(option), values)) && (optionSet = !0);
                    return optionSet || (elem.selectedIndex = -1), values;
                }
            }
        }
    }), jQuery.each([ "radio", "checkbox" ], function() {
        jQuery.valHooks[this] = {
            set: function(elem, value) {
                if (Array.isArray(value)) return elem.checked = -1 < jQuery.inArray(jQuery(elem).val(), value);
            }
        }, support.checkOn || (jQuery.valHooks[this].get = function(elem) {
            return null === elem.getAttribute("value") ? "on" : elem.value;
        });
    }), support.focusin = "onfocusin" in window;
    var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, stopPropagationCallback = function(e) {
        e.stopPropagation();
    };
    jQuery.extend(jQuery.event, {
        trigger: function(event, data, elem, onlyHandlers) {
            var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, eventPath = [ elem || document ], type = hasOwn.call(event, "type") ? event.type : event, namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
            if (cur = lastElement = tmp = elem = elem || document, 3 !== elem.nodeType && 8 !== elem.nodeType && !rfocusMorph.test(type + jQuery.event.triggered) && (-1 < type.indexOf(".") && (type = (namespaces = type.split(".")).shift(), 
            namespaces.sort()), ontype = type.indexOf(":") < 0 && "on" + type, (event = event[jQuery.expando] ? event : new jQuery.Event(type, "object" == typeof event && event)).isTrigger = onlyHandlers ? 2 : 3, 
            event.namespace = namespaces.join("."), event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, 
            event.result = void 0, event.target || (event.target = elem), data = null == data ? [ event ] : jQuery.makeArray(data, [ event ]), 
            special = jQuery.event.special[type] || {}, onlyHandlers || !special.trigger || !1 !== special.trigger.apply(elem, data))) {
                if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
                    for (bubbleType = special.delegateType || type, rfocusMorph.test(bubbleType + type) || (cur = cur.parentNode); cur; cur = cur.parentNode) eventPath.push(cur), 
                    tmp = cur;
                    tmp === (elem.ownerDocument || document) && eventPath.push(tmp.defaultView || tmp.parentWindow || window);
                }
                for (i = 0; (cur = eventPath[i++]) && !event.isPropagationStopped(); ) lastElement = cur, 
                event.type = 1 < i ? bubbleType : special.bindType || type, (handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle")) && handle.apply(cur, data), 
                (handle = ontype && cur[ontype]) && handle.apply && acceptData(cur) && (event.result = handle.apply(cur, data), 
                !1 === event.result && event.preventDefault());
                return event.type = type, onlyHandlers || event.isDefaultPrevented() || special._default && !1 !== special._default.apply(eventPath.pop(), data) || !acceptData(elem) || ontype && isFunction(elem[type]) && !isWindow(elem) && ((tmp = elem[ontype]) && (elem[ontype] = null), 
                jQuery.event.triggered = type, event.isPropagationStopped() && lastElement.addEventListener(type, stopPropagationCallback), 
                elem[type](), event.isPropagationStopped() && lastElement.removeEventListener(type, stopPropagationCallback), 
                jQuery.event.triggered = void 0, tmp && (elem[ontype] = tmp)), event.result;
            }
        },
        simulate: function(type, elem, event) {
            var e = jQuery.extend(new jQuery.Event(), event, {
                type: type,
                isSimulated: !0
            });
            jQuery.event.trigger(e, null, elem);
        }
    }), jQuery.fn.extend({
        trigger: function(type, data) {
            return this.each(function() {
                jQuery.event.trigger(type, data, this);
            });
        },
        triggerHandler: function(type, data) {
            var elem = this[0];
            if (elem) return jQuery.event.trigger(type, data, elem, !0);
        }
    }), support.focusin || jQuery.each({
        focus: "focusin",
        blur: "focusout"
    }, function(orig, fix) {
        var handler = function(event) {
            jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
        };
        jQuery.event.special[fix] = {
            setup: function() {
                var doc = this.ownerDocument || this, attaches = dataPriv.access(doc, fix);
                attaches || doc.addEventListener(orig, handler, !0), dataPriv.access(doc, fix, (attaches || 0) + 1);
            },
            teardown: function() {
                var doc = this.ownerDocument || this, attaches = dataPriv.access(doc, fix) - 1;
                attaches ? dataPriv.access(doc, fix, attaches) : (doc.removeEventListener(orig, handler, !0), 
                dataPriv.remove(doc, fix));
            }
        };
    });
    var body, rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i;
    function buildParams(prefix, obj, traditional, add) {
        var name;
        if (Array.isArray(obj)) jQuery.each(obj, function(i, v) {
            traditional || rbracket.test(prefix) ? add(prefix, v) : buildParams(prefix + "[" + ("object" == typeof v && null != v ? i : "") + "]", v, traditional, add);
        }); else if (traditional || "object" !== toType(obj)) add(prefix, obj); else for (name in obj) buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
    }
    jQuery.param = function(a, traditional) {
        var prefix, s = [], add = function(key, valueOrFunction) {
            var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
            s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(null == value ? "" : value);
        };
        if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) jQuery.each(a, function() {
            add(this.name, this.value);
        }); else for (prefix in a) buildParams(prefix, a[prefix], traditional, add);
        return s.join("&");
    }, jQuery.fn.extend({
        serialize: function() {
            return jQuery.param(this.serializeArray());
        },
        serializeArray: function() {
            return this.map(function() {
                var elements = jQuery.prop(this, "elements");
                return elements ? jQuery.makeArray(elements) : this;
            }).filter(function() {
                var type = this.type;
                return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
            }).map(function(i, elem) {
                var val = jQuery(this).val();
                return null == val ? null : Array.isArray(val) ? jQuery.map(val, function(val) {
                    return {
                        name: elem.name,
                        value: val.replace(rCRLF, "\r\n")
                    };
                }) : {
                    name: elem.name,
                    value: val.replace(rCRLF, "\r\n")
                };
            }).get();
        }
    }), jQuery.fn.extend({
        wrapAll: function(html) {
            var wrap;
            return this[0] && (isFunction(html) && (html = html.call(this[0])), wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(!0), 
            this[0].parentNode && wrap.insertBefore(this[0]), wrap.map(function() {
                for (var elem = this; elem.firstElementChild; ) elem = elem.firstElementChild;
                return elem;
            }).append(this)), this;
        },
        wrapInner: function(html) {
            return isFunction(html) ? this.each(function(i) {
                jQuery(this).wrapInner(html.call(this, i));
            }) : this.each(function() {
                var self = jQuery(this), contents = self.contents();
                contents.length ? contents.wrapAll(html) : self.append(html);
            });
        },
        wrap: function(html) {
            var htmlIsFunction = isFunction(html);
            return this.each(function(i) {
                jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
            });
        },
        unwrap: function(selector) {
            return this.parent(selector).not("body").each(function() {
                jQuery(this).replaceWith(this.childNodes);
            }), this;
        }
    }), jQuery.expr.pseudos.hidden = function(elem) {
        return !jQuery.expr.pseudos.visible(elem);
    }, jQuery.expr.pseudos.visible = function(elem) {
        return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
    }, support.createHTMLDocument = ((body = document.implementation.createHTMLDocument("").body).innerHTML = "<form></form><form></form>", 
    2 === body.childNodes.length), jQuery.parseHTML = function(data, context, keepScripts) {
        return "string" != typeof data ? [] : ("boolean" == typeof context && (keepScripts = context, 
        context = !1), context || (support.createHTMLDocument ? ((base = (context = document.implementation.createHTMLDocument("")).createElement("base")).href = document.location.href, 
        context.head.appendChild(base)) : context = document), scripts = !keepScripts && [], 
        (parsed = rsingleTag.exec(data)) ? [ context.createElement(parsed[1]) ] : (parsed = buildFragment([ data ], context, scripts), 
        scripts && scripts.length && jQuery(scripts).remove(), jQuery.merge([], parsed.childNodes)));
        var base, parsed, scripts;
    }, jQuery.offset = {
        setOffset: function(elem, options, i) {
            var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, position = jQuery.css(elem, "position"), curElem = jQuery(elem), props = {};
            "static" === position && (elem.style.position = "relative"), curOffset = curElem.offset(), 
            curCSSTop = jQuery.css(elem, "top"), curCSSLeft = jQuery.css(elem, "left"), ("absolute" === position || "fixed" === position) && -1 < (curCSSTop + curCSSLeft).indexOf("auto") ? (curTop = (curPosition = curElem.position()).top, 
            curLeft = curPosition.left) : (curTop = parseFloat(curCSSTop) || 0, curLeft = parseFloat(curCSSLeft) || 0), 
            isFunction(options) && (options = options.call(elem, i, jQuery.extend({}, curOffset))), 
            null != options.top && (props.top = options.top - curOffset.top + curTop), null != options.left && (props.left = options.left - curOffset.left + curLeft), 
            "using" in options ? options.using.call(elem, props) : curElem.css(props);
        }
    }, jQuery.fn.extend({
        offset: function(options) {
            if (arguments.length) return void 0 === options ? this : this.each(function(i) {
                jQuery.offset.setOffset(this, options, i);
            });
            var rect, win, elem = this[0];
            return elem ? elem.getClientRects().length ? (rect = elem.getBoundingClientRect(), 
            win = elem.ownerDocument.defaultView, {
                top: rect.top + win.pageYOffset,
                left: rect.left + win.pageXOffset
            }) : {
                top: 0,
                left: 0
            } : void 0;
        },
        position: function() {
            if (this[0]) {
                var offsetParent, offset, doc, elem = this[0], parentOffset = {
                    top: 0,
                    left: 0
                };
                if ("fixed" === jQuery.css(elem, "position")) offset = elem.getBoundingClientRect(); else {
                    for (offset = this.offset(), doc = elem.ownerDocument, offsetParent = elem.offsetParent || doc.documentElement; offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && "static" === jQuery.css(offsetParent, "position"); ) offsetParent = offsetParent.parentNode;
                    offsetParent && offsetParent !== elem && 1 === offsetParent.nodeType && ((parentOffset = jQuery(offsetParent).offset()).top += jQuery.css(offsetParent, "borderTopWidth", !0), 
                    parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", !0));
                }
                return {
                    top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", !0),
                    left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", !0)
                };
            }
        },
        offsetParent: function() {
            return this.map(function() {
                for (var offsetParent = this.offsetParent; offsetParent && "static" === jQuery.css(offsetParent, "position"); ) offsetParent = offsetParent.offsetParent;
                return offsetParent || documentElement;
            });
        }
    }), jQuery.each({
        scrollLeft: "pageXOffset",
        scrollTop: "pageYOffset"
    }, function(method, prop) {
        var top = "pageYOffset" === prop;
        jQuery.fn[method] = function(val) {
            return access(this, function(elem, method, val) {
                var win;
                if (isWindow(elem) ? win = elem : 9 === elem.nodeType && (win = elem.defaultView), 
                void 0 === val) return win ? win[prop] : elem[method];
                win ? win.scrollTo(top ? win.pageXOffset : val, top ? val : win.pageYOffset) : elem[method] = val;
            }, method, val, arguments.length);
        };
    }), jQuery.each([ "top", "left" ], function(i, prop) {
        jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function(elem, computed) {
            if (computed) return computed = curCSS(elem, prop), rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
        });
    }), jQuery.each({
        Height: "height",
        Width: "width"
    }, function(name, type) {
        jQuery.each({
            padding: "inner" + name,
            content: type,
            "": "outer" + name
        }, function(defaultExtra, funcName) {
            jQuery.fn[funcName] = function(margin, value) {
                var chainable = arguments.length && (defaultExtra || "boolean" != typeof margin), extra = defaultExtra || (!0 === margin || !0 === value ? "margin" : "border");
                return access(this, function(elem, type, value) {
                    var doc;
                    return isWindow(elem) ? 0 === funcName.indexOf("outer") ? elem["inner" + name] : elem.document.documentElement["client" + name] : 9 === elem.nodeType ? (doc = elem.documentElement, 
                    Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name])) : void 0 === value ? jQuery.css(elem, type, extra) : jQuery.style(elem, type, value, extra);
                }, type, chainable ? margin : void 0, chainable);
            };
        });
    }), jQuery.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "), function(i, name) {
        jQuery.fn[name] = function(data, fn) {
            return 0 < arguments.length ? this.on(name, null, data, fn) : this.trigger(name);
        };
    }), jQuery.fn.extend({
        hover: function(fnOver, fnOut) {
            return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
        }
    }), jQuery.fn.extend({
        bind: function(types, data, fn) {
            return this.on(types, null, data, fn);
        },
        unbind: function(types, fn) {
            return this.off(types, null, fn);
        },
        delegate: function(selector, types, data, fn) {
            return this.on(types, selector, data, fn);
        },
        undelegate: function(selector, types, fn) {
            return 1 === arguments.length ? this.off(selector, "**") : this.off(types, selector || "**", fn);
        }
    }), jQuery.proxy = function(fn, context) {
        var tmp, args, proxy;
        if ("string" == typeof context && (tmp = fn[context], context = fn, fn = tmp), isFunction(fn)) return args = slice.call(arguments, 2), 
        (proxy = function() {
            return fn.apply(context || this, args.concat(slice.call(arguments)));
        }).guid = fn.guid = fn.guid || jQuery.guid++, proxy;
    }, jQuery.holdReady = function(hold) {
        hold ? jQuery.readyWait++ : jQuery.ready(!0);
    }, jQuery.isArray = Array.isArray, jQuery.parseJSON = JSON.parse, jQuery.nodeName = nodeName, 
    jQuery.isFunction = isFunction, jQuery.isWindow = isWindow, jQuery.camelCase = camelCase, 
    jQuery.type = toType, jQuery.now = Date.now, jQuery.isNumeric = function(obj) {
        var type = jQuery.type(obj);
        return ("number" === type || "string" === type) && !isNaN(obj - parseFloat(obj));
    }, "function" == typeof define && define.amd && define("jquery", [], function() {
        return jQuery;
    });
    var _jQuery = window.jQuery, _$ = window.$;
    return jQuery.noConflict = function(deep) {
        return window.$ === jQuery && (window.$ = _$), deep && window.jQuery === jQuery && (window.jQuery = _jQuery), 
        jQuery;
    }, noGlobal || (window.jQuery = window.$ = jQuery), jQuery;
}), "undefined" == typeof jQuery) throw new Error("Bootstrap's JavaScript requires jQuery");

!function($) {
    "use strict";
    var version = jQuery.fn.jquery.split(" ")[0].split(".");
    if (version[0] < 2 && version[1] < 9 || 1 == version[0] && 9 == version[1] && version[2] < 1 || 3 < version[0]) throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4");
}(), function($) {
    "use strict";
    $.fn.emulateTransitionEnd = function(duration) {
        var called = !1, $el = this;
        $(this).one("bsTransitionEnd", function() {
            called = !0;
        });
        return setTimeout(function() {
            called || $($el).trigger($.support.transition.end);
        }, duration), this;
    }, $(function() {
        $.support.transition = function() {
            var el = document.createElement("bootstrap"), transEndEventNames = {
                WebkitTransition: "webkitTransitionEnd",
                MozTransition: "transitionend",
                OTransition: "oTransitionEnd otransitionend",
                transition: "transitionend"
            };
            for (var name in transEndEventNames) if (void 0 !== el.style[name]) return {
                end: transEndEventNames[name]
            };
            return !1;
        }(), $.support.transition && ($.event.special.bsTransitionEnd = {
            bindType: $.support.transition.end,
            delegateType: $.support.transition.end,
            handle: function(e) {
                if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments);
            }
        });
    });
}(jQuery), function($) {
    "use strict";
    var dismiss = '[data-dismiss="alert"]', Alert = function(el) {
        $(el).on("click", dismiss, this.close);
    };
    Alert.VERSION = "3.3.7", Alert.TRANSITION_DURATION = 150, Alert.prototype.close = function(e) {
        var $this = $(this), selector = $this.attr("data-target");
        selector || (selector = (selector = $this.attr("href")) && selector.replace(/.*(?=#[^\s]*$)/, ""));
        var $parent = $("#" === selector ? [] : selector);
        function removeElement() {
            $parent.detach().trigger("closed.bs.alert").remove();
        }
        e && e.preventDefault(), $parent.length || ($parent = $this.closest(".alert")), 
        $parent.trigger(e = $.Event("close.bs.alert")), e.isDefaultPrevented() || ($parent.removeClass("in"), 
        $.support.transition && $parent.hasClass("fade") ? $parent.one("bsTransitionEnd", removeElement).emulateTransitionEnd(Alert.TRANSITION_DURATION) : removeElement());
    };
    var old = $.fn.alert;
    $.fn.alert = function(option) {
        return this.each(function() {
            var $this = $(this), data = $this.data("bs.alert");
            data || $this.data("bs.alert", data = new Alert(this)), "string" == typeof option && data[option].call($this);
        });
    }, $.fn.alert.Constructor = Alert, $.fn.alert.noConflict = function() {
        return $.fn.alert = old, this;
    }, $(document).on("click.bs.alert.data-api", dismiss, Alert.prototype.close);
}(jQuery), function($) {
    "use strict";
    var Button = function(element, options) {
        this.$element = $(element), this.options = $.extend({}, Button.DEFAULTS, options), 
        this.isLoading = !1;
    };
    function Plugin(option) {
        return this.each(function() {
            var $this = $(this), data = $this.data("bs.button"), options = "object" == typeof option && option;
            data || $this.data("bs.button", data = new Button(this, options)), "toggle" == option ? data.toggle() : option && data.setState(option);
        });
    }
    Button.VERSION = "3.3.7", Button.DEFAULTS = {
        loadingText: "loading..."
    }, Button.prototype.setState = function(state) {
        var d = "disabled", $el = this.$element, val = $el.is("input") ? "val" : "html", data = $el.data();
        state += "Text", null == data.resetText && $el.data("resetText", $el[val]()), setTimeout($.proxy(function() {
            $el[val](null == data[state] ? this.options[state] : data[state]), "loadingText" == state ? (this.isLoading = !0, 
            $el.addClass(d).attr(d, d).prop(d, !0)) : this.isLoading && (this.isLoading = !1, 
            $el.removeClass(d).removeAttr(d).prop(d, !1));
        }, this), 0);
    }, Button.prototype.toggle = function() {
        var changed = !0, $parent = this.$element.closest('[data-toggle="buttons"]');
        if ($parent.length) {
            var $input = this.$element.find("input");
            "radio" == $input.prop("type") ? ($input.prop("checked") && (changed = !1), $parent.find(".active").removeClass("active"), 
            this.$element.addClass("active")) : "checkbox" == $input.prop("type") && ($input.prop("checked") !== this.$element.hasClass("active") && (changed = !1), 
            this.$element.toggleClass("active")), $input.prop("checked", this.$element.hasClass("active")), 
            changed && $input.trigger("change");
        } else this.$element.attr("aria-pressed", !this.$element.hasClass("active")), this.$element.toggleClass("active");
    };
    var old = $.fn.button;
    $.fn.button = Plugin, $.fn.button.Constructor = Button, $.fn.button.noConflict = function() {
        return $.fn.button = old, this;
    }, $(document).on("click.bs.button.data-api", '[data-toggle^="button"]', function(e) {
        var $btn = $(e.target).closest(".btn");
        Plugin.call($btn, "toggle"), $(e.target).is('input[type="radio"], input[type="checkbox"]') || (e.preventDefault(), 
        $btn.is("input,button") ? $btn.trigger("focus") : $btn.find("input:visible,button:visible").first().trigger("focus"));
    }).on("focus.bs.button.data-api blur.bs.button.data-api", '[data-toggle^="button"]', function(e) {
        $(e.target).closest(".btn").toggleClass("focus", /^focus(in)?$/.test(e.type));
    });
}(jQuery), function($) {
    "use strict";
    var Carousel = function(element, options) {
        this.$element = $(element), this.$indicators = this.$element.find(".carousel-indicators"), 
        this.options = options, this.paused = null, this.sliding = null, this.interval = null, 
        this.$active = null, this.$items = null, this.options.keyboard && this.$element.on("keydown.bs.carousel", $.proxy(this.keydown, this)), 
        "hover" == this.options.pause && !("ontouchstart" in document.documentElement) && this.$element.on("mouseenter.bs.carousel", $.proxy(this.pause, this)).on("mouseleave.bs.carousel", $.proxy(this.cycle, this));
    };
    function Plugin(option) {
        return this.each(function() {
            var $this = $(this), data = $this.data("bs.carousel"), options = $.extend({}, Carousel.DEFAULTS, $this.data(), "object" == typeof option && option), action = "string" == typeof option ? option : options.slide;
            data || $this.data("bs.carousel", data = new Carousel(this, options)), "number" == typeof option ? data.to(option) : action ? data[action]() : options.interval && data.pause().cycle();
        });
    }
    Carousel.VERSION = "3.3.7", Carousel.TRANSITION_DURATION = 600, Carousel.DEFAULTS = {
        interval: 5e3,
        pause: "hover",
        wrap: !0,
        keyboard: !0
    }, Carousel.prototype.keydown = function(e) {
        if (!/input|textarea/i.test(e.target.tagName)) {
            switch (e.which) {
              case 37:
                this.prev();
                break;

              case 39:
                this.next();
                break;

              default:
                return;
            }
            e.preventDefault();
        }
    }, Carousel.prototype.cycle = function(e) {
        return e || (this.paused = !1), this.interval && clearInterval(this.interval), this.options.interval && !this.paused && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)), 
        this;
    }, Carousel.prototype.getItemIndex = function(item) {
        return this.$items = item.parent().children(".item"), this.$items.index(item || this.$active);
    }, Carousel.prototype.getItemForDirection = function(direction, active) {
        var activeIndex = this.getItemIndex(active);
        if (("prev" == direction && 0 === activeIndex || "next" == direction && activeIndex == this.$items.length - 1) && !this.options.wrap) return active;
        var itemIndex = (activeIndex + ("prev" == direction ? -1 : 1)) % this.$items.length;
        return this.$items.eq(itemIndex);
    }, Carousel.prototype.to = function(pos) {
        var that = this, activeIndex = this.getItemIndex(this.$active = this.$element.find(".item.active"));
        if (!(pos > this.$items.length - 1 || pos < 0)) return this.sliding ? this.$element.one("slid.bs.carousel", function() {
            that.to(pos);
        }) : activeIndex == pos ? this.pause().cycle() : this.slide(activeIndex < pos ? "next" : "prev", this.$items.eq(pos));
    }, Carousel.prototype.pause = function(e) {
        return e || (this.paused = !0), this.$element.find(".next, .prev").length && $.support.transition && (this.$element.trigger($.support.transition.end), 
        this.cycle(!0)), this.interval = clearInterval(this.interval), this;
    }, Carousel.prototype.next = function() {
        if (!this.sliding) return this.slide("next");
    }, Carousel.prototype.prev = function() {
        if (!this.sliding) return this.slide("prev");
    }, Carousel.prototype.slide = function(type, next) {
        var $active = this.$element.find(".item.active"), $next = next || this.getItemForDirection(type, $active), isCycling = this.interval, direction = "next" == type ? "left" : "right", that = this;
        if ($next.hasClass("active")) return this.sliding = !1;
        var relatedTarget = $next[0], slideEvent = $.Event("slide.bs.carousel", {
            relatedTarget: relatedTarget,
            direction: direction
        });
        if (this.$element.trigger(slideEvent), !slideEvent.isDefaultPrevented()) {
            if (this.sliding = !0, isCycling && this.pause(), this.$indicators.length) {
                this.$indicators.find(".active").removeClass("active");
                var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]);
                $nextIndicator && $nextIndicator.addClass("active");
            }
            var slidEvent = $.Event("slid.bs.carousel", {
                relatedTarget: relatedTarget,
                direction: direction
            });
            return $.support.transition && this.$element.hasClass("slide") ? ($next.addClass(type), 
            $next[0].offsetWidth, $active.addClass(direction), $next.addClass(direction), $active.one("bsTransitionEnd", function() {
                $next.removeClass([ type, direction ].join(" ")).addClass("active"), $active.removeClass([ "active", direction ].join(" ")), 
                that.sliding = !1, setTimeout(function() {
                    that.$element.trigger(slidEvent);
                }, 0);
            }).emulateTransitionEnd(Carousel.TRANSITION_DURATION)) : ($active.removeClass("active"), 
            $next.addClass("active"), this.sliding = !1, this.$element.trigger(slidEvent)), 
            isCycling && this.cycle(), this;
        }
    };
    var old = $.fn.carousel;
    $.fn.carousel = Plugin, $.fn.carousel.Constructor = Carousel, $.fn.carousel.noConflict = function() {
        return $.fn.carousel = old, this;
    };
    var clickHandler = function(e) {
        var href, $this = $(this), $target = $($this.attr("data-target") || (href = $this.attr("href")) && href.replace(/.*(?=#[^\s]+$)/, ""));
        if ($target.hasClass("carousel")) {
            var options = $.extend({}, $target.data(), $this.data()), slideIndex = $this.attr("data-slide-to");
            slideIndex && (options.interval = !1), Plugin.call($target, options), slideIndex && $target.data("bs.carousel").to(slideIndex), 
            e.preventDefault();
        }
    };
    $(document).on("click.bs.carousel.data-api", "[data-slide]", clickHandler).on("click.bs.carousel.data-api", "[data-slide-to]", clickHandler), 
    $(window).on("load", function() {
        $('[data-ride="carousel"]').each(function() {
            var $carousel = $(this);
            Plugin.call($carousel, $carousel.data());
        });
    });
}(jQuery), function($) {
    "use strict";
    var Collapse = function(element, options) {
        this.$element = $(element), this.options = $.extend({}, Collapse.DEFAULTS, options), 
        this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],[data-toggle="collapse"][data-target="#' + element.id + '"]'), 
        this.transitioning = null, this.options.parent ? this.$parent = this.getParent() : this.addAriaAndCollapsedClass(this.$element, this.$trigger), 
        this.options.toggle && this.toggle();
    };
    function getTargetFromTrigger($trigger) {
        var href, target = $trigger.attr("data-target") || (href = $trigger.attr("href")) && href.replace(/.*(?=#[^\s]+$)/, "");
        return $(target);
    }
    function Plugin(option) {
        return this.each(function() {
            var $this = $(this), data = $this.data("bs.collapse"), options = $.extend({}, Collapse.DEFAULTS, $this.data(), "object" == typeof option && option);
            !data && options.toggle && /show|hide/.test(option) && (options.toggle = !1), data || $this.data("bs.collapse", data = new Collapse(this, options)), 
            "string" == typeof option && data[option]();
        });
    }
    Collapse.VERSION = "3.3.7", Collapse.TRANSITION_DURATION = 350, Collapse.DEFAULTS = {
        toggle: !0
    }, Collapse.prototype.dimension = function() {
        return this.$element.hasClass("width") ? "width" : "height";
    }, Collapse.prototype.show = function() {
        if (!this.transitioning && !this.$element.hasClass("in")) {
            var activesData, actives = this.$parent && this.$parent.children(".panel").children(".in, .collapsing");
            if (!(actives && actives.length && (activesData = actives.data("bs.collapse")) && activesData.transitioning)) {
                var startEvent = $.Event("show.bs.collapse");
                if (this.$element.trigger(startEvent), !startEvent.isDefaultPrevented()) {
                    actives && actives.length && (Plugin.call(actives, "hide"), activesData || actives.data("bs.collapse", null));
                    var dimension = this.dimension();
                    this.$element.removeClass("collapse").addClass("collapsing")[dimension](0).attr("aria-expanded", !0), 
                    this.$trigger.removeClass("collapsed").attr("aria-expanded", !0), this.transitioning = 1;
                    var complete = function() {
                        this.$element.removeClass("collapsing").addClass("collapse in")[dimension](""), 
                        this.transitioning = 0, this.$element.trigger("shown.bs.collapse");
                    };
                    if (!$.support.transition) return complete.call(this);
                    var scrollSize = $.camelCase([ "scroll", dimension ].join("-"));
                    this.$element.one("bsTransitionEnd", $.proxy(complete, this)).emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]);
                }
            }
        }
    }, Collapse.prototype.hide = function() {
        if (!this.transitioning && this.$element.hasClass("in")) {
            var startEvent = $.Event("hide.bs.collapse");
            if (this.$element.trigger(startEvent), !startEvent.isDefaultPrevented()) {
                var dimension = this.dimension();
                this.$element[dimension](this.$element[dimension]())[0].offsetHeight, this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded", !1), 
                this.$trigger.addClass("collapsed").attr("aria-expanded", !1), this.transitioning = 1;
                var complete = function() {
                    this.transitioning = 0, this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse");
                };
                if (!$.support.transition) return complete.call(this);
                this.$element[dimension](0).one("bsTransitionEnd", $.proxy(complete, this)).emulateTransitionEnd(Collapse.TRANSITION_DURATION);
            }
        }
    }, Collapse.prototype.toggle = function() {
        this[this.$element.hasClass("in") ? "hide" : "show"]();
    }, Collapse.prototype.getParent = function() {
        return $(this.options.parent).find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]').each($.proxy(function(i, element) {
            var $element = $(element);
            this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element);
        }, this)).end();
    }, Collapse.prototype.addAriaAndCollapsedClass = function($element, $trigger) {
        var isOpen = $element.hasClass("in");
        $element.attr("aria-expanded", isOpen), $trigger.toggleClass("collapsed", !isOpen).attr("aria-expanded", isOpen);
    };
    var old = $.fn.collapse;
    $.fn.collapse = Plugin, $.fn.collapse.Constructor = Collapse, $.fn.collapse.noConflict = function() {
        return $.fn.collapse = old, this;
    }, $(document).on("click.bs.collapse.data-api", '[data-toggle="collapse"]', function(e) {
        var $this = $(this);
        $this.attr("data-target") || e.preventDefault();
        var $target = getTargetFromTrigger($this), option = $target.data("bs.collapse") ? "toggle" : $this.data();
        Plugin.call($target, option);
    });
}(jQuery), function($) {
    "use strict";
    var backdrop = ".dropdown-backdrop", toggle = '[data-toggle="dropdown"]', Dropdown = function(element) {
        $(element).on("click.bs.dropdown", this.toggle);
    };
    function getParent($this) {
        var selector = $this.attr("data-target");
        selector || (selector = (selector = $this.attr("href")) && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, ""));
        var $parent = selector && $(selector);
        return $parent && $parent.length ? $parent : $this.parent();
    }
    function clearMenus(e) {
        e && 3 === e.which || ($(backdrop).remove(), $(toggle).each(function() {
            var $this = $(this), $parent = getParent($this), relatedTarget = {
                relatedTarget: this
            };
            $parent.hasClass("open") && (e && "click" == e.type && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target) || ($parent.trigger(e = $.Event("hide.bs.dropdown", relatedTarget)), 
            e.isDefaultPrevented() || ($this.attr("aria-expanded", "false"), $parent.removeClass("open").trigger($.Event("hidden.bs.dropdown", relatedTarget)))));
        }));
    }
    Dropdown.VERSION = "3.3.7", Dropdown.prototype.toggle = function(e) {
        var $this = $(this);
        if (!$this.is(".disabled, :disabled")) {
            var $parent = getParent($this), isActive = $parent.hasClass("open");
            if (clearMenus(), !isActive) {
                "ontouchstart" in document.documentElement && !$parent.closest(".navbar-nav").length && $(document.createElement("div")).addClass("dropdown-backdrop").insertAfter($(this)).on("click", clearMenus);
                var relatedTarget = {
                    relatedTarget: this
                };
                if ($parent.trigger(e = $.Event("show.bs.dropdown", relatedTarget)), e.isDefaultPrevented()) return;
                $this.trigger("focus").attr("aria-expanded", "true"), $parent.toggleClass("open").trigger($.Event("shown.bs.dropdown", relatedTarget));
            }
            return !1;
        }
    }, Dropdown.prototype.keydown = function(e) {
        if (/(38|40|27|32)/.test(e.which) && !/input|textarea/i.test(e.target.tagName)) {
            var $this = $(this);
            if (e.preventDefault(), e.stopPropagation(), !$this.is(".disabled, :disabled")) {
                var $parent = getParent($this), isActive = $parent.hasClass("open");
                if (!isActive && 27 != e.which || isActive && 27 == e.which) return 27 == e.which && $parent.find(toggle).trigger("focus"), 
                $this.trigger("click");
                var $items = $parent.find(".dropdown-menu li:not(.disabled):visible a");
                if ($items.length) {
                    var index = $items.index(e.target);
                    38 == e.which && 0 < index && index--, 40 == e.which && index < $items.length - 1 && index++, 
                    ~index || (index = 0), $items.eq(index).trigger("focus");
                }
            }
        }
    };
    var old = $.fn.dropdown;
    $.fn.dropdown = function(option) {
        return this.each(function() {
            var $this = $(this), data = $this.data("bs.dropdown");
            data || $this.data("bs.dropdown", data = new Dropdown(this)), "string" == typeof option && data[option].call($this);
        });
    }, $.fn.dropdown.Constructor = Dropdown, $.fn.dropdown.noConflict = function() {
        return $.fn.dropdown = old, this;
    }, $(document).on("click.bs.dropdown.data-api", clearMenus).on("click.bs.dropdown.data-api", ".dropdown form", function(e) {
        e.stopPropagation();
    }).on("click.bs.dropdown.data-api", toggle, Dropdown.prototype.toggle).on("keydown.bs.dropdown.data-api", toggle, Dropdown.prototype.keydown).on("keydown.bs.dropdown.data-api", ".dropdown-menu", Dropdown.prototype.keydown);
}(jQuery), function($) {
    "use strict";
    var Modal = function(element, options) {
        this.options = options, this.$body = $(document.body), this.$element = $(element), 
        this.$dialog = this.$element.find(".modal-dialog"), this.$backdrop = null, this.isShown = null, 
        this.originalBodyPad = null, this.scrollbarWidth = 0, this.ignoreBackdropClick = !1, 
        this.options.remote && this.$element.find(".modal-content").load(this.options.remote, $.proxy(function() {
            this.$element.trigger("loaded.bs.modal");
        }, this));
    };
    function Plugin(option, _relatedTarget) {
        return this.each(function() {
            var $this = $(this), data = $this.data("bs.modal"), options = $.extend({}, Modal.DEFAULTS, $this.data(), "object" == typeof option && option);
            data || $this.data("bs.modal", data = new Modal(this, options)), "string" == typeof option ? data[option](_relatedTarget) : options.show && data.show(_relatedTarget);
        });
    }
    Modal.VERSION = "3.3.7", Modal.TRANSITION_DURATION = 300, Modal.BACKDROP_TRANSITION_DURATION = 150, 
    Modal.DEFAULTS = {
        backdrop: !0,
        keyboard: !0,
        show: !0
    }, Modal.prototype.toggle = function(_relatedTarget) {
        return this.isShown ? this.hide() : this.show(_relatedTarget);
    }, Modal.prototype.show = function(_relatedTarget) {
        var that = this, e = $.Event("show.bs.modal", {
            relatedTarget: _relatedTarget
        });
        this.$element.trigger(e), this.isShown || e.isDefaultPrevented() || (this.isShown = !0, 
        this.checkScrollbar(), this.setScrollbar(), this.$body.addClass("modal-open"), this.escape(), 
        this.resize(), this.$element.on("click.dismiss.bs.modal", '[data-dismiss="modal"]', $.proxy(this.hide, this)), 
        this.$dialog.on("mousedown.dismiss.bs.modal", function() {
            that.$element.one("mouseup.dismiss.bs.modal", function(e) {
                $(e.target).is(that.$element) && (that.ignoreBackdropClick = !0);
            });
        }), this.backdrop(function() {
            var transition = $.support.transition && that.$element.hasClass("fade");
            that.$element.parent().length || that.$element.appendTo(that.$body), that.$element.show().scrollTop(0), 
            that.adjustDialog(), transition && that.$element[0].offsetWidth, that.$element.addClass("in"), 
            that.enforceFocus();
            var e = $.Event("shown.bs.modal", {
                relatedTarget: _relatedTarget
            });
            transition ? that.$dialog.one("bsTransitionEnd", function() {
                that.$element.trigger("focus").trigger(e);
            }).emulateTransitionEnd(Modal.TRANSITION_DURATION) : that.$element.trigger("focus").trigger(e);
        }));
    }, Modal.prototype.hide = function(e) {
        e && e.preventDefault(), e = $.Event("hide.bs.modal"), this.$element.trigger(e), 
        this.isShown && !e.isDefaultPrevented() && (this.isShown = !1, this.escape(), this.resize(), 
        $(document).off("focusin.bs.modal"), this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"), 
        this.$dialog.off("mousedown.dismiss.bs.modal"), $.support.transition && this.$element.hasClass("fade") ? this.$element.one("bsTransitionEnd", $.proxy(this.hideModal, this)).emulateTransitionEnd(Modal.TRANSITION_DURATION) : this.hideModal());
    }, Modal.prototype.enforceFocus = function() {
        $(document).off("focusin.bs.modal").on("focusin.bs.modal", $.proxy(function(e) {
            document === e.target || this.$element[0] === e.target || this.$element.has(e.target).length || this.$element.trigger("focus");
        }, this));
    }, Modal.prototype.escape = function() {
        this.isShown && this.options.keyboard ? this.$element.on("keydown.dismiss.bs.modal", $.proxy(function(e) {
            27 == e.which && this.hide();
        }, this)) : this.isShown || this.$element.off("keydown.dismiss.bs.modal");
    }, Modal.prototype.resize = function() {
        this.isShown ? $(window).on("resize.bs.modal", $.proxy(this.handleUpdate, this)) : $(window).off("resize.bs.modal");
    }, Modal.prototype.hideModal = function() {
        var that = this;
        this.$element.hide(), this.backdrop(function() {
            that.$body.removeClass("modal-open"), that.resetAdjustments(), that.resetScrollbar(), 
            that.$element.trigger("hidden.bs.modal");
        });
    }, Modal.prototype.removeBackdrop = function() {
        this.$backdrop && this.$backdrop.remove(), this.$backdrop = null;
    }, Modal.prototype.backdrop = function(callback) {
        var that = this, animate = this.$element.hasClass("fade") ? "fade" : "";
        if (this.isShown && this.options.backdrop) {
            var doAnimate = $.support.transition && animate;
            if (this.$backdrop = $(document.createElement("div")).addClass("modal-backdrop " + animate).appendTo(this.$body), 
            this.$element.on("click.dismiss.bs.modal", $.proxy(function(e) {
                this.ignoreBackdropClick ? this.ignoreBackdropClick = !1 : e.target === e.currentTarget && ("static" == this.options.backdrop ? this.$element[0].focus() : this.hide());
            }, this)), doAnimate && this.$backdrop[0].offsetWidth, this.$backdrop.addClass("in"), 
            !callback) return;
            doAnimate ? this.$backdrop.one("bsTransitionEnd", callback).emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callback();
        } else if (!this.isShown && this.$backdrop) {
            this.$backdrop.removeClass("in");
            var callbackRemove = function() {
                that.removeBackdrop(), callback && callback();
            };
            $.support.transition && this.$element.hasClass("fade") ? this.$backdrop.one("bsTransitionEnd", callbackRemove).emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : callbackRemove();
        } else callback && callback();
    }, Modal.prototype.handleUpdate = function() {
        this.adjustDialog();
    }, Modal.prototype.adjustDialog = function() {
        var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight;
        this.$element.css({
            paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : "",
            paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ""
        });
    }, Modal.prototype.resetAdjustments = function() {
        this.$element.css({
            paddingLeft: "",
            paddingRight: ""
        });
    }, Modal.prototype.checkScrollbar = function() {
        var fullWindowWidth = window.innerWidth;
        if (!fullWindowWidth) {
            var documentElementRect = document.documentElement.getBoundingClientRect();
            fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left);
        }
        this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth, this.scrollbarWidth = this.measureScrollbar();
    }, Modal.prototype.setScrollbar = function() {
        var bodyPad = parseInt(this.$body.css("padding-right") || 0, 10);
        this.originalBodyPad = document.body.style.paddingRight || "", this.bodyIsOverflowing && this.$body.css("padding-right", bodyPad + this.scrollbarWidth);
    }, Modal.prototype.resetScrollbar = function() {
        this.$body.css("padding-right", this.originalBodyPad);
    }, Modal.prototype.measureScrollbar = function() {
        var scrollDiv = document.createElement("div");
        scrollDiv.className = "modal-scrollbar-measure", this.$body.append(scrollDiv);
        var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
        return this.$body[0].removeChild(scrollDiv), scrollbarWidth;
    };
    var old = $.fn.modal;
    $.fn.modal = Plugin, $.fn.modal.Constructor = Modal, $.fn.modal.noConflict = function() {
        return $.fn.modal = old, this;
    }, $(document).on("click.bs.modal.data-api", '[data-toggle="modal"]', function(e) {
        var $this = $(this), href = $this.attr("href"), $target = $($this.attr("data-target") || href && href.replace(/.*(?=#[^\s]+$)/, "")), option = $target.data("bs.modal") ? "toggle" : $.extend({
            remote: !/#/.test(href) && href
        }, $target.data(), $this.data());
        $this.is("a") && e.preventDefault(), $target.one("show.bs.modal", function(showEvent) {
            showEvent.isDefaultPrevented() || $target.one("hidden.bs.modal", function() {
                $this.is(":visible") && $this.trigger("focus");
            });
        }), Plugin.call($target, option, this);
    });
}(jQuery), function($) {
    "use strict";
    var Tooltip = function(element, options) {
        this.type = null, this.options = null, this.enabled = null, this.timeout = null, 
        this.hoverState = null, this.$element = null, this.inState = null, this.init("tooltip", element, options);
    };
    Tooltip.VERSION = "3.3.7", Tooltip.TRANSITION_DURATION = 150, Tooltip.DEFAULTS = {
        animation: !0,
        placement: "top",
        selector: !1,
        template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
        trigger: "hover focus",
        title: "",
        delay: 0,
        html: !1,
        container: !1,
        viewport: {
            selector: "body",
            padding: 0
        }
    }, Tooltip.prototype.init = function(type, element, options) {
        if (this.enabled = !0, this.type = type, this.$element = $(element), this.options = this.getOptions(options), 
        this.$viewport = this.options.viewport && $($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : this.options.viewport.selector || this.options.viewport), 
        this.inState = {
            click: !1,
            hover: !1,
            focus: !1
        }, this.$element[0] instanceof document.constructor && !this.options.selector) throw new Error("`selector` option must be specified when initializing " + this.type + " on the window.document object!");
        for (var triggers = this.options.trigger.split(" "), i = triggers.length; i--; ) {
            var trigger = triggers[i];
            if ("click" == trigger) this.$element.on("click." + this.type, this.options.selector, $.proxy(this.toggle, this)); else if ("manual" != trigger) {
                var eventIn = "hover" == trigger ? "mouseenter" : "focusin", eventOut = "hover" == trigger ? "mouseleave" : "focusout";
                this.$element.on(eventIn + "." + this.type, this.options.selector, $.proxy(this.enter, this)), 
                this.$element.on(eventOut + "." + this.type, this.options.selector, $.proxy(this.leave, this));
            }
        }
        this.options.selector ? this._options = $.extend({}, this.options, {
            trigger: "manual",
            selector: ""
        }) : this.fixTitle();
    }, Tooltip.prototype.getDefaults = function() {
        return Tooltip.DEFAULTS;
    }, Tooltip.prototype.getOptions = function(options) {
        return (options = $.extend({}, this.getDefaults(), this.$element.data(), options)).delay && "number" == typeof options.delay && (options.delay = {
            show: options.delay,
            hide: options.delay
        }), options;
    }, Tooltip.prototype.getDelegateOptions = function() {
        var options = {}, defaults = this.getDefaults();
        return this._options && $.each(this._options, function(key, value) {
            defaults[key] != value && (options[key] = value);
        }), options;
    }, Tooltip.prototype.enter = function(obj) {
        var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data("bs." + this.type);
        if (self || (self = new this.constructor(obj.currentTarget, this.getDelegateOptions()), 
        $(obj.currentTarget).data("bs." + this.type, self)), obj instanceof $.Event && (self.inState["focusin" == obj.type ? "focus" : "hover"] = !0), 
        self.tip().hasClass("in") || "in" == self.hoverState) self.hoverState = "in"; else {
            if (clearTimeout(self.timeout), self.hoverState = "in", !self.options.delay || !self.options.delay.show) return self.show();
            self.timeout = setTimeout(function() {
                "in" == self.hoverState && self.show();
            }, self.options.delay.show);
        }
    }, Tooltip.prototype.isInStateTrue = function() {
        for (var key in this.inState) if (this.inState[key]) return !0;
        return !1;
    }, Tooltip.prototype.leave = function(obj) {
        var self = obj instanceof this.constructor ? obj : $(obj.currentTarget).data("bs." + this.type);
        if (self || (self = new this.constructor(obj.currentTarget, this.getDelegateOptions()), 
        $(obj.currentTarget).data("bs." + this.type, self)), obj instanceof $.Event && (self.inState["focusout" == obj.type ? "focus" : "hover"] = !1), 
        !self.isInStateTrue()) {
            if (clearTimeout(self.timeout), self.hoverState = "out", !self.options.delay || !self.options.delay.hide) return self.hide();
            self.timeout = setTimeout(function() {
                "out" == self.hoverState && self.hide();
            }, self.options.delay.hide);
        }
    }, Tooltip.prototype.show = function() {
        var e = $.Event("show.bs." + this.type);
        if (this.hasContent() && this.enabled) {
            this.$element.trigger(e);
            var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]);
            if (e.isDefaultPrevented() || !inDom) return;
            var that = this, $tip = this.tip(), tipId = this.getUID(this.type);
            this.setContent(), $tip.attr("id", tipId), this.$element.attr("aria-describedby", tipId), 
            this.options.animation && $tip.addClass("fade");
            var placement = "function" == typeof this.options.placement ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement, autoToken = /\s?auto?\s?/i, autoPlace = autoToken.test(placement);
            autoPlace && (placement = placement.replace(autoToken, "") || "top"), $tip.detach().css({
                top: 0,
                left: 0,
                display: "block"
            }).addClass(placement).data("bs." + this.type, this), this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element), 
            this.$element.trigger("inserted.bs." + this.type);
            var pos = this.getPosition(), actualWidth = $tip[0].offsetWidth, actualHeight = $tip[0].offsetHeight;
            if (autoPlace) {
                var orgPlacement = placement, viewportDim = this.getPosition(this.$viewport);
                placement = "bottom" == placement && pos.bottom + actualHeight > viewportDim.bottom ? "top" : "top" == placement && pos.top - actualHeight < viewportDim.top ? "bottom" : "right" == placement && pos.right + actualWidth > viewportDim.width ? "left" : "left" == placement && pos.left - actualWidth < viewportDim.left ? "right" : placement, 
                $tip.removeClass(orgPlacement).addClass(placement);
            }
            var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight);
            this.applyPlacement(calculatedOffset, placement);
            var complete = function() {
                var prevHoverState = that.hoverState;
                that.$element.trigger("shown.bs." + that.type), that.hoverState = null, "out" == prevHoverState && that.leave(that);
            };
            $.support.transition && this.$tip.hasClass("fade") ? $tip.one("bsTransitionEnd", complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete();
        }
    }, Tooltip.prototype.applyPlacement = function(offset, placement) {
        var $tip = this.tip(), width = $tip[0].offsetWidth, height = $tip[0].offsetHeight, marginTop = parseInt($tip.css("margin-top"), 10), marginLeft = parseInt($tip.css("margin-left"), 10);
        isNaN(marginTop) && (marginTop = 0), isNaN(marginLeft) && (marginLeft = 0), offset.top += marginTop, 
        offset.left += marginLeft, $.offset.setOffset($tip[0], $.extend({
            using: function(props) {
                $tip.css({
                    top: Math.round(props.top),
                    left: Math.round(props.left)
                });
            }
        }, offset), 0), $tip.addClass("in");
        var actualWidth = $tip[0].offsetWidth, actualHeight = $tip[0].offsetHeight;
        "top" == placement && actualHeight != height && (offset.top = offset.top + height - actualHeight);
        var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight);
        delta.left ? offset.left += delta.left : offset.top += delta.top;
        var isVertical = /top|bottom/.test(placement), arrowDelta = isVertical ? 2 * delta.left - width + actualWidth : 2 * delta.top - height + actualHeight, arrowOffsetPosition = isVertical ? "offsetWidth" : "offsetHeight";
        $tip.offset(offset), this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical);
    }, Tooltip.prototype.replaceArrow = function(delta, dimension, isVertical) {
        this.arrow().css(isVertical ? "left" : "top", 50 * (1 - delta / dimension) + "%").css(isVertical ? "top" : "left", "");
    }, Tooltip.prototype.setContent = function() {
        var $tip = this.tip(), title = this.getTitle();
        $tip.find(".tooltip-inner")[this.options.html ? "html" : "text"](title), $tip.removeClass("fade in top bottom left right");
    }, Tooltip.prototype.hide = function(callback) {
        var that = this, $tip = $(this.$tip), e = $.Event("hide.bs." + this.type);
        function complete() {
            "in" != that.hoverState && $tip.detach(), that.$element && that.$element.removeAttr("aria-describedby").trigger("hidden.bs." + that.type), 
            callback && callback();
        }
        if (this.$element.trigger(e), !e.isDefaultPrevented()) return $tip.removeClass("in"), 
        $.support.transition && $tip.hasClass("fade") ? $tip.one("bsTransitionEnd", complete).emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : complete(), 
        this.hoverState = null, this;
    }, Tooltip.prototype.fixTitle = function() {
        var $e = this.$element;
        ($e.attr("title") || "string" != typeof $e.attr("data-original-title")) && $e.attr("data-original-title", $e.attr("title") || "").attr("title", "");
    }, Tooltip.prototype.hasContent = function() {
        return this.getTitle();
    }, Tooltip.prototype.getPosition = function($element) {
        var el = ($element = $element || this.$element)[0], isBody = "BODY" == el.tagName, elRect = el.getBoundingClientRect();
        null == elRect.width && (elRect = $.extend({}, elRect, {
            width: elRect.right - elRect.left,
            height: elRect.bottom - elRect.top
        }));
        var isSvg = window.SVGElement && el instanceof window.SVGElement, elOffset = isBody ? {
            top: 0,
            left: 0
        } : isSvg ? null : $element.offset(), scroll = {
            scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop()
        }, outerDims = isBody ? {
            width: $(window).width(),
            height: $(window).height()
        } : null;
        return $.extend({}, elRect, scroll, outerDims, elOffset);
    }, Tooltip.prototype.getCalculatedOffset = function(placement, pos, actualWidth, actualHeight) {
        return "bottom" == placement ? {
            top: pos.top + pos.height,
            left: pos.left + pos.width / 2 - actualWidth / 2
        } : "top" == placement ? {
            top: pos.top - actualHeight,
            left: pos.left + pos.width / 2 - actualWidth / 2
        } : "left" == placement ? {
            top: pos.top + pos.height / 2 - actualHeight / 2,
            left: pos.left - actualWidth
        } : {
            top: pos.top + pos.height / 2 - actualHeight / 2,
            left: pos.left + pos.width
        };
    }, Tooltip.prototype.getViewportAdjustedDelta = function(placement, pos, actualWidth, actualHeight) {
        var delta = {
            top: 0,
            left: 0
        };
        if (!this.$viewport) return delta;
        var viewportPadding = this.options.viewport && this.options.viewport.padding || 0, viewportDimensions = this.getPosition(this.$viewport);
        if (/right|left/.test(placement)) {
            var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll, bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight;
            topEdgeOffset < viewportDimensions.top ? delta.top = viewportDimensions.top - topEdgeOffset : bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height && (delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset);
        } else {
            var leftEdgeOffset = pos.left - viewportPadding, rightEdgeOffset = pos.left + viewportPadding + actualWidth;
            leftEdgeOffset < viewportDimensions.left ? delta.left = viewportDimensions.left - leftEdgeOffset : rightEdgeOffset > viewportDimensions.right && (delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset);
        }
        return delta;
    }, Tooltip.prototype.getTitle = function() {
        var $e = this.$element, o = this.options;
        return $e.attr("data-original-title") || ("function" == typeof o.title ? o.title.call($e[0]) : o.title);
    }, Tooltip.prototype.getUID = function(prefix) {
        for (;prefix += ~~(1e6 * Math.random()), document.getElementById(prefix); ) ;
        return prefix;
    }, Tooltip.prototype.tip = function() {
        if (!this.$tip && (this.$tip = $(this.options.template), 1 != this.$tip.length)) throw new Error(this.type + " `template` option must consist of exactly 1 top-level element!");
        return this.$tip;
    }, Tooltip.prototype.arrow = function() {
        return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow");
    }, Tooltip.prototype.enable = function() {
        this.enabled = !0;
    }, Tooltip.prototype.disable = function() {
        this.enabled = !1;
    }, Tooltip.prototype.toggleEnabled = function() {
        this.enabled = !this.enabled;
    }, Tooltip.prototype.toggle = function(e) {
        var self = this;
        e && ((self = $(e.currentTarget).data("bs." + this.type)) || (self = new this.constructor(e.currentTarget, this.getDelegateOptions()), 
        $(e.currentTarget).data("bs." + this.type, self))), e ? (self.inState.click = !self.inState.click, 
        self.isInStateTrue() ? self.enter(self) : self.leave(self)) : self.tip().hasClass("in") ? self.leave(self) : self.enter(self);
    }, Tooltip.prototype.destroy = function() {
        var that = this;
        clearTimeout(this.timeout), this.hide(function() {
            that.$element.off("." + that.type).removeData("bs." + that.type), that.$tip && that.$tip.detach(), 
            that.$tip = null, that.$arrow = null, that.$viewport = null, that.$element = null;
        });
    };
    var old = $.fn.tooltip;
    $.fn.tooltip = function(option) {
        return this.each(function() {
            var $this = $(this), data = $this.data("bs.tooltip"), options = "object" == typeof option && option;
            !data && /destroy|hide/.test(option) || (data || $this.data("bs.tooltip", data = new Tooltip(this, options)), 
            "string" == typeof option && data[option]());
        });
    }, $.fn.tooltip.Constructor = Tooltip, $.fn.tooltip.noConflict = function() {
        return $.fn.tooltip = old, this;
    };
}(jQuery), function($) {
    "use strict";
    var Popover = function(element, options) {
        this.init("popover", element, options);
    };
    if (!$.fn.tooltip) throw new Error("Popover requires tooltip.js");
    Popover.VERSION = "3.3.7", Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {
        placement: "right",
        trigger: "click",
        content: "",
        template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
    }), Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype), (Popover.prototype.constructor = Popover).prototype.getDefaults = function() {
        return Popover.DEFAULTS;
    }, Popover.prototype.setContent = function() {
        var $tip = this.tip(), title = this.getTitle(), content = this.getContent();
        $tip.find(".popover-title")[this.options.html ? "html" : "text"](title), $tip.find(".popover-content").children().detach().end()[this.options.html ? "string" == typeof content ? "html" : "append" : "text"](content), 
        $tip.removeClass("fade top bottom left right in"), $tip.find(".popover-title").html() || $tip.find(".popover-title").hide();
    }, Popover.prototype.hasContent = function() {
        return this.getTitle() || this.getContent();
    }, Popover.prototype.getContent = function() {
        var $e = this.$element, o = this.options;
        return $e.attr("data-content") || ("function" == typeof o.content ? o.content.call($e[0]) : o.content);
    }, Popover.prototype.arrow = function() {
        return this.$arrow = this.$arrow || this.tip().find(".arrow");
    };
    var old = $.fn.popover;
    $.fn.popover = function(option) {
        return this.each(function() {
            var $this = $(this), data = $this.data("bs.popover"), options = "object" == typeof option && option;
            !data && /destroy|hide/.test(option) || (data || $this.data("bs.popover", data = new Popover(this, options)), 
            "string" == typeof option && data[option]());
        });
    }, $.fn.popover.Constructor = Popover, $.fn.popover.noConflict = function() {
        return $.fn.popover = old, this;
    };
}(jQuery), function($) {
    "use strict";
    function ScrollSpy(element, options) {
        this.$body = $(document.body), this.$scrollElement = $(element).is(document.body) ? $(window) : $(element), 
        this.options = $.extend({}, ScrollSpy.DEFAULTS, options), this.selector = (this.options.target || "") + " .nav li > a", 
        this.offsets = [], this.targets = [], this.activeTarget = null, this.scrollHeight = 0, 
        this.$scrollElement.on("scroll.bs.scrollspy", $.proxy(this.process, this)), this.refresh(), 
        this.process();
    }
    function Plugin(option) {
        return this.each(function() {
            var $this = $(this), data = $this.data("bs.scrollspy"), options = "object" == typeof option && option;
            data || $this.data("bs.scrollspy", data = new ScrollSpy(this, options)), "string" == typeof option && data[option]();
        });
    }
    ScrollSpy.VERSION = "3.3.7", ScrollSpy.DEFAULTS = {
        offset: 10
    }, ScrollSpy.prototype.getScrollHeight = function() {
        return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight);
    }, ScrollSpy.prototype.refresh = function() {
        var that = this, offsetMethod = "offset", offsetBase = 0;
        this.offsets = [], this.targets = [], this.scrollHeight = this.getScrollHeight(), 
        $.isWindow(this.$scrollElement[0]) || (offsetMethod = "position", offsetBase = this.$scrollElement.scrollTop()), 
        this.$body.find(this.selector).map(function() {
            var $el = $(this), href = $el.data("target") || $el.attr("href"), $href = /^#./.test(href) && $(href);
            return $href && $href.length && $href.is(":visible") && [ [ $href[offsetMethod]().top + offsetBase, href ] ] || null;
        }).sort(function(a, b) {
            return a[0] - b[0];
        }).each(function() {
            that.offsets.push(this[0]), that.targets.push(this[1]);
        });
    }, ScrollSpy.prototype.process = function() {
        var i, scrollTop = this.$scrollElement.scrollTop() + this.options.offset, scrollHeight = this.getScrollHeight(), maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height(), offsets = this.offsets, targets = this.targets, activeTarget = this.activeTarget;
        if (this.scrollHeight != scrollHeight && this.refresh(), maxScroll <= scrollTop) return activeTarget != (i = targets[targets.length - 1]) && this.activate(i);
        if (activeTarget && scrollTop < offsets[0]) return this.activeTarget = null, this.clear();
        for (i = offsets.length; i--; ) activeTarget != targets[i] && scrollTop >= offsets[i] && (void 0 === offsets[i + 1] || scrollTop < offsets[i + 1]) && this.activate(targets[i]);
    }, ScrollSpy.prototype.activate = function(target) {
        this.activeTarget = target, this.clear();
        var selector = this.selector + '[data-target="' + target + '"],' + this.selector + '[href="' + target + '"]', active = $(selector).parents("li").addClass("active");
        active.parent(".dropdown-menu").length && (active = active.closest("li.dropdown").addClass("active")), 
        active.trigger("activate.bs.scrollspy");
    }, ScrollSpy.prototype.clear = function() {
        $(this.selector).parentsUntil(this.options.target, ".active").removeClass("active");
    };
    var old = $.fn.scrollspy;
    $.fn.scrollspy = Plugin, $.fn.scrollspy.Constructor = ScrollSpy, $.fn.scrollspy.noConflict = function() {
        return $.fn.scrollspy = old, this;
    }, $(window).on("load.bs.scrollspy.data-api", function() {
        $('[data-spy="scroll"]').each(function() {
            var $spy = $(this);
            Plugin.call($spy, $spy.data());
        });
    });
}(jQuery), function($) {
    "use strict";
    var Tab = function(element) {
        this.element = $(element);
    };
    function Plugin(option) {
        return this.each(function() {
            var $this = $(this), data = $this.data("bs.tab");
            data || $this.data("bs.tab", data = new Tab(this)), "string" == typeof option && data[option]();
        });
    }
    Tab.VERSION = "3.3.7", Tab.TRANSITION_DURATION = 150, Tab.prototype.show = function() {
        var $this = this.element, $ul = $this.closest("ul:not(.dropdown-menu)"), selector = $this.data("target");
        if (selector || (selector = (selector = $this.attr("href")) && selector.replace(/.*(?=#[^\s]*$)/, "")), 
        !$this.parent("li").hasClass("active")) {
            var $previous = $ul.find(".active:last a"), hideEvent = $.Event("hide.bs.tab", {
                relatedTarget: $this[0]
            }), showEvent = $.Event("show.bs.tab", {
                relatedTarget: $previous[0]
            });
            if ($previous.trigger(hideEvent), $this.trigger(showEvent), !showEvent.isDefaultPrevented() && !hideEvent.isDefaultPrevented()) {
                var $target = $(selector);
                this.activate($this.closest("li"), $ul), this.activate($target, $target.parent(), function() {
                    $previous.trigger({
                        type: "hidden.bs.tab",
                        relatedTarget: $this[0]
                    }), $this.trigger({
                        type: "shown.bs.tab",
                        relatedTarget: $previous[0]
                    });
                });
            }
        }
    }, Tab.prototype.activate = function(element, container, callback) {
        var $active = container.find("> .active"), transition = callback && $.support.transition && ($active.length && $active.hasClass("fade") || !!container.find("> .fade").length);
        function next() {
            $active.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded", !1), 
            element.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded", !0), 
            transition ? (element[0].offsetWidth, element.addClass("in")) : element.removeClass("fade"), 
            element.parent(".dropdown-menu").length && element.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded", !0), 
            callback && callback();
        }
        $active.length && transition ? $active.one("bsTransitionEnd", next).emulateTransitionEnd(Tab.TRANSITION_DURATION) : next(), 
        $active.removeClass("in");
    };
    var old = $.fn.tab;
    $.fn.tab = Plugin, $.fn.tab.Constructor = Tab, $.fn.tab.noConflict = function() {
        return $.fn.tab = old, this;
    };
    var clickHandler = function(e) {
        e.preventDefault(), Plugin.call($(this), "show");
    };
    $(document).on("click.bs.tab.data-api", '[data-toggle="tab"]', clickHandler).on("click.bs.tab.data-api", '[data-toggle="pill"]', clickHandler);
}(jQuery), function($) {
    "use strict";
    var Affix = function(element, options) {
        this.options = $.extend({}, Affix.DEFAULTS, options), this.$target = $(this.options.target).on("scroll.bs.affix.data-api", $.proxy(this.checkPosition, this)).on("click.bs.affix.data-api", $.proxy(this.checkPositionWithEventLoop, this)), 
        this.$element = $(element), this.affixed = null, this.unpin = null, this.pinnedOffset = null, 
        this.checkPosition();
    };
    function Plugin(option) {
        return this.each(function() {
            var $this = $(this), data = $this.data("bs.affix"), options = "object" == typeof option && option;
            data || $this.data("bs.affix", data = new Affix(this, options)), "string" == typeof option && data[option]();
        });
    }
    Affix.VERSION = "3.3.7", Affix.RESET = "affix affix-top affix-bottom", Affix.DEFAULTS = {
        offset: 0,
        target: window
    }, Affix.prototype.getState = function(scrollHeight, height, offsetTop, offsetBottom) {
        var scrollTop = this.$target.scrollTop(), position = this.$element.offset(), targetHeight = this.$target.height();
        if (null != offsetTop && "top" == this.affixed) return scrollTop < offsetTop && "top";
        if ("bottom" == this.affixed) return null != offsetTop ? !(scrollTop + this.unpin <= position.top) && "bottom" : !(scrollTop + targetHeight <= scrollHeight - offsetBottom) && "bottom";
        var initializing = null == this.affixed, colliderTop = initializing ? scrollTop : position.top;
        return null != offsetTop && scrollTop <= offsetTop ? "top" : null != offsetBottom && scrollHeight - offsetBottom <= colliderTop + (initializing ? targetHeight : height) && "bottom";
    }, Affix.prototype.getPinnedOffset = function() {
        if (this.pinnedOffset) return this.pinnedOffset;
        this.$element.removeClass(Affix.RESET).addClass("affix");
        var scrollTop = this.$target.scrollTop(), position = this.$element.offset();
        return this.pinnedOffset = position.top - scrollTop;
    }, Affix.prototype.checkPositionWithEventLoop = function() {
        setTimeout($.proxy(this.checkPosition, this), 1);
    }, Affix.prototype.checkPosition = function() {
        if (this.$element.is(":visible")) {
            var height = this.$element.height(), offset = this.options.offset, offsetTop = offset.top, offsetBottom = offset.bottom, scrollHeight = Math.max($(document).height(), $(document.body).height());
            "object" != typeof offset && (offsetBottom = offsetTop = offset), "function" == typeof offsetTop && (offsetTop = offset.top(this.$element)), 
            "function" == typeof offsetBottom && (offsetBottom = offset.bottom(this.$element));
            var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom);
            if (this.affixed != affix) {
                null != this.unpin && this.$element.css("top", "");
                var affixType = "affix" + (affix ? "-" + affix : ""), e = $.Event(affixType + ".bs.affix");
                if (this.$element.trigger(e), e.isDefaultPrevented()) return;
                this.affixed = affix, this.unpin = "bottom" == affix ? this.getPinnedOffset() : null, 
                this.$element.removeClass(Affix.RESET).addClass(affixType).trigger(affixType.replace("affix", "affixed") + ".bs.affix");
            }
            "bottom" == affix && this.$element.offset({
                top: scrollHeight - height - offsetBottom
            });
        }
    };
    var old = $.fn.affix;
    $.fn.affix = Plugin, $.fn.affix.Constructor = Affix, $.fn.affix.noConflict = function() {
        return $.fn.affix = old, this;
    }, $(window).on("load", function() {
        $('[data-spy="affix"]').each(function() {
            var $spy = $(this), data = $spy.data();
            data.offset = data.offset || {}, null != data.offsetBottom && (data.offset.bottom = data.offsetBottom), 
            null != data.offsetTop && (data.offset.top = data.offsetTop), Plugin.call($spy, data);
        });
    });
}(jQuery), function(global, factory) {
    "object" == typeof exports && "undefined" != typeof module ? factory(exports) : "function" == typeof define && define.amd ? define([ "exports" ], factory) : factory(global.d3 = global.d3 || {});
}(this, function(exports) {
    "use strict";
    function ascending(a, b) {
        return a < b ? -1 : b < a ? 1 : b <= a ? 0 : NaN;
    }
    function bisector(compare) {
        var f;
        return 1 === compare.length && (f = compare, compare = function(d, x) {
            return ascending(f(d), x);
        }), {
            left: function(a, x, lo, hi) {
                for (null == lo && (lo = 0), null == hi && (hi = a.length); lo < hi; ) {
                    var mid = lo + hi >>> 1;
                    compare(a[mid], x) < 0 ? lo = mid + 1 : hi = mid;
                }
                return lo;
            },
            right: function(a, x, lo, hi) {
                for (null == lo && (lo = 0), null == hi && (hi = a.length); lo < hi; ) {
                    var mid = lo + hi >>> 1;
                    0 < compare(a[mid], x) ? hi = mid : lo = mid + 1;
                }
                return lo;
            }
        };
    }
    var ascendingBisect = bisector(ascending), bisectRight = ascendingBisect.right, bisectLeft = ascendingBisect.left;
    function pair(a, b) {
        return [ a, b ];
    }
    function number(x) {
        return null === x ? NaN : +x;
    }
    function variance(values, valueof) {
        var value, delta, n = values.length, m = 0, i = -1, mean = 0, sum = 0;
        if (null == valueof) for (;++i < n; ) isNaN(value = number(values[i])) || (sum += (delta = value - mean) * (value - (mean += delta / ++m))); else for (;++i < n; ) isNaN(value = number(valueof(values[i], i, values))) || (sum += (delta = value - mean) * (value - (mean += delta / ++m)));
        if (1 < m) return sum / (m - 1);
    }
    function deviation(array, f) {
        var v = variance(array, f);
        return v ? Math.sqrt(v) : v;
    }
    function extent(values, valueof) {
        var value, min, max, n = values.length, i = -1;
        if (null == valueof) {
            for (;++i < n; ) if (null != (value = values[i]) && value <= value) for (min = max = value; ++i < n; ) null != (value = values[i]) && (value < min && (min = value), 
            max < value && (max = value));
        } else for (;++i < n; ) if (null != (value = valueof(values[i], i, values)) && value <= value) for (min = max = value; ++i < n; ) null != (value = valueof(values[i], i, values)) && (value < min && (min = value), 
        max < value && (max = value));
        return [ min, max ];
    }
    var array = Array.prototype, slice = array.slice, map = array.map;
    function constant(x) {
        return function() {
            return x;
        };
    }
    function identity(x) {
        return x;
    }
    function sequence(start, stop, step) {
        start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, 
        start = 0, 1) : n < 3 ? 1 : +step;
        for (var i = -1, n = 0 | Math.max(0, Math.ceil((stop - start) / step)), range = new Array(n); ++i < n; ) range[i] = start + i * step;
        return range;
    }
    var e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2);
    function ticks(start, stop, count) {
        var reverse, n, ticks, step, i = -1;
        if (count = +count, (start = +start) === (stop = +stop) && 0 < count) return [ start ];
        if ((reverse = stop < start) && (n = start, start = stop, stop = n), 0 === (step = tickIncrement(start, stop, count)) || !isFinite(step)) return [];
        if (0 < step) for (start = Math.ceil(start / step), stop = Math.floor(stop / step), 
        ticks = new Array(n = Math.ceil(stop - start + 1)); ++i < n; ) ticks[i] = (start + i) * step; else for (start = Math.floor(start * step), 
        stop = Math.ceil(stop * step), ticks = new Array(n = Math.ceil(start - stop + 1)); ++i < n; ) ticks[i] = (start - i) / step;
        return reverse && ticks.reverse(), ticks;
    }
    function tickIncrement(start, stop, count) {
        var step = (stop - start) / Math.max(0, count), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power);
        return 0 <= power ? (e10 <= error ? 10 : e5 <= error ? 5 : e2 <= error ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (e10 <= error ? 10 : e5 <= error ? 5 : e2 <= error ? 2 : 1);
    }
    function tickStep(start, stop, count) {
        var step0 = Math.abs(stop - start) / Math.max(0, count), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1;
        return e10 <= error ? step1 *= 10 : e5 <= error ? step1 *= 5 : e2 <= error && (step1 *= 2), 
        stop < start ? -step1 : step1;
    }
    function sturges(values) {
        return Math.ceil(Math.log(values.length) / Math.LN2) + 1;
    }
    function threshold(values, p, valueof) {
        if (null == valueof && (valueof = number), n = values.length) {
            if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values);
            if (1 <= p) return +valueof(values[n - 1], n - 1, values);
            var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values);
            return value0 + (+valueof(values[i0 + 1], i0 + 1, values) - value0) * (i - i0);
        }
    }
    function merge(arrays) {
        for (var m, merged, array, n = arrays.length, i = -1, j = 0; ++i < n; ) j += arrays[i].length;
        for (merged = new Array(j); 0 <= --n; ) for (m = (array = arrays[n]).length; 0 <= --m; ) merged[--j] = array[m];
        return merged;
    }
    function min(values, valueof) {
        var value, min, n = values.length, i = -1;
        if (null == valueof) {
            for (;++i < n; ) if (null != (value = values[i]) && value <= value) for (min = value; ++i < n; ) null != (value = values[i]) && value < min && (min = value);
        } else for (;++i < n; ) if (null != (value = valueof(values[i], i, values)) && value <= value) for (min = value; ++i < n; ) null != (value = valueof(values[i], i, values)) && value < min && (min = value);
        return min;
    }
    function transpose(matrix) {
        if (!(n = matrix.length)) return [];
        for (var i = -1, m = min(matrix, length), transpose = new Array(m); ++i < m; ) for (var n, j = -1, row = transpose[i] = new Array(n); ++j < n; ) row[j] = matrix[j][i];
        return transpose;
    }
    function length(d) {
        return d.length;
    }
    var slice$1 = Array.prototype.slice;
    function identity$1(x) {
        return x;
    }
    var top = 1, right = 2, bottom = 3, left = 4, epsilon = 1e-6;
    function translateX(x) {
        return "translate(" + (x + .5) + ",0)";
    }
    function translateY(y) {
        return "translate(0," + (y + .5) + ")";
    }
    function entering() {
        return !this.__axis;
    }
    function axis(orient, scale) {
        var tickArguments = [], tickValues = null, tickFormat = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, k = orient === top || orient === left ? -1 : 1, x = orient === left || orient === right ? "x" : "y", transform = orient === top || orient === bottom ? translateX : translateY;
        function axis(context) {
            var values = null == tickValues ? scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain() : tickValues, format = null == tickFormat ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity$1 : tickFormat, spacing = Math.max(tickSizeInner, 0) + tickPadding, range = scale.range(), range0 = +range[0] + .5, range1 = +range[range.length - 1] + .5, position = (scale.bandwidth ? function(scale) {
                var offset = Math.max(0, scale.bandwidth() - 1) / 2;
                return scale.round() && (offset = Math.round(offset)), function(d) {
                    return +scale(d) + offset;
                };
            } : function(scale) {
                return function(d) {
                    return +scale(d);
                };
            })(scale.copy()), selection = context.selection ? context.selection() : context, path = selection.selectAll(".domain").data([ null ]), tick = selection.selectAll(".tick").data(values, scale).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line = tick.select("line"), text = tick.select("text");
            path = path.merge(path.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "#000")), 
            tick = tick.merge(tickEnter), line = line.merge(tickEnter.append("line").attr("stroke", "#000").attr(x + "2", k * tickSizeInner)), 
            text = text.merge(tickEnter.append("text").attr("fill", "#000").attr(x, k * spacing).attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em")), 
            context !== selection && (path = path.transition(context), tick = tick.transition(context), 
            line = line.transition(context), text = text.transition(context), tickExit = tickExit.transition(context).attr("opacity", epsilon).attr("transform", function(d) {
                return isFinite(d = position(d)) ? transform(d) : this.getAttribute("transform");
            }), tickEnter.attr("opacity", epsilon).attr("transform", function(d) {
                var p = this.parentNode.__axis;
                return transform(p && isFinite(p = p(d)) ? p : position(d));
            })), tickExit.remove(), path.attr("d", orient === left || orient == right ? "M" + k * tickSizeOuter + "," + range0 + "H0.5V" + range1 + "H" + k * tickSizeOuter : "M" + range0 + "," + k * tickSizeOuter + "V0.5H" + range1 + "V" + k * tickSizeOuter), 
            tick.attr("opacity", 1).attr("transform", function(d) {
                return transform(position(d));
            }), line.attr(x + "2", k * tickSizeInner), text.attr(x, k * spacing).text(format), 
            selection.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle"), 
            selection.each(function() {
                this.__axis = position;
            });
        }
        return axis.scale = function(_) {
            return arguments.length ? (scale = _, axis) : scale;
        }, axis.ticks = function() {
            return tickArguments = slice$1.call(arguments), axis;
        }, axis.tickArguments = function(_) {
            return arguments.length ? (tickArguments = null == _ ? [] : slice$1.call(_), axis) : tickArguments.slice();
        }, axis.tickValues = function(_) {
            return arguments.length ? (tickValues = null == _ ? null : slice$1.call(_), axis) : tickValues && tickValues.slice();
        }, axis.tickFormat = function(_) {
            return arguments.length ? (tickFormat = _, axis) : tickFormat;
        }, axis.tickSize = function(_) {
            return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis) : tickSizeInner;
        }, axis.tickSizeInner = function(_) {
            return arguments.length ? (tickSizeInner = +_, axis) : tickSizeInner;
        }, axis.tickSizeOuter = function(_) {
            return arguments.length ? (tickSizeOuter = +_, axis) : tickSizeOuter;
        }, axis.tickPadding = function(_) {
            return arguments.length ? (tickPadding = +_, axis) : tickPadding;
        }, axis;
    }
    var noop = {
        value: function() {}
    };
    function dispatch() {
        for (var t, i = 0, n = arguments.length, _ = {}; i < n; ++i) {
            if (!(t = arguments[i] + "") || t in _) throw new Error("illegal type: " + t);
            _[t] = [];
        }
        return new Dispatch(_);
    }
    function Dispatch(_) {
        this._ = _;
    }
    function get(type, name) {
        for (var c, i = 0, n = type.length; i < n; ++i) if ((c = type[i]).name === name) return c.value;
    }
    function set(type, name, callback) {
        for (var i = 0, n = type.length; i < n; ++i) if (type[i].name === name) {
            type[i] = noop, type = type.slice(0, i).concat(type.slice(i + 1));
            break;
        }
        return null != callback && type.push({
            name: name,
            value: callback
        }), type;
    }
    Dispatch.prototype = dispatch.prototype = {
        constructor: Dispatch,
        on: function(typename, callback) {
            var t, types, _ = this._, T = (types = _, (typename + "").trim().split(/^|\s+/).map(function(t) {
                var name = "", i = t.indexOf(".");
                if (0 <= i && (name = t.slice(i + 1), t = t.slice(0, i)), t && !types.hasOwnProperty(t)) throw new Error("unknown type: " + t);
                return {
                    type: t,
                    name: name
                };
            })), i = -1, n = T.length;
            if (!(arguments.length < 2)) {
                if (null != callback && "function" != typeof callback) throw new Error("invalid callback: " + callback);
                for (;++i < n; ) if (t = (typename = T[i]).type) _[t] = set(_[t], typename.name, callback); else if (null == callback) for (t in _) _[t] = set(_[t], typename.name, null);
                return this;
            }
            for (;++i < n; ) if ((t = (typename = T[i]).type) && (t = get(_[t], typename.name))) return t;
        },
        copy: function() {
            var copy = {}, _ = this._;
            for (var t in _) copy[t] = _[t].slice();
            return new Dispatch(copy);
        },
        call: function(type, that) {
            if (0 < (n = arguments.length - 2)) for (var n, t, args = new Array(n), i = 0; i < n; ++i) args[i] = arguments[i + 2];
            if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
            for (i = 0, n = (t = this._[type]).length; i < n; ++i) t[i].value.apply(that, args);
        },
        apply: function(type, that, args) {
            if (!this._.hasOwnProperty(type)) throw new Error("unknown type: " + type);
            for (var t = this._[type], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args);
        }
    };
    var xhtml = "http://www.w3.org/1999/xhtml", namespaces = {
        svg: "http://www.w3.org/2000/svg",
        xhtml: xhtml,
        xlink: "http://www.w3.org/1999/xlink",
        xml: "http://www.w3.org/XML/1998/namespace",
        xmlns: "http://www.w3.org/2000/xmlns/"
    };
    function namespace(name) {
        var prefix = name += "", i = prefix.indexOf(":");
        return 0 <= i && "xmlns" !== (prefix = name.slice(0, i)) && (name = name.slice(i + 1)), 
        namespaces.hasOwnProperty(prefix) ? {
            space: namespaces[prefix],
            local: name
        } : name;
    }
    function creator(name) {
        var fullname = namespace(name);
        return (fullname.local ? function(fullname) {
            return function() {
                return this.ownerDocument.createElementNS(fullname.space, fullname.local);
            };
        } : function(name) {
            return function() {
                var document = this.ownerDocument, uri = this.namespaceURI;
                return uri === xhtml && document.documentElement.namespaceURI === xhtml ? document.createElement(name) : document.createElementNS(uri, name);
            };
        })(fullname);
    }
    function none() {}
    function selector(selector) {
        return null == selector ? none : function() {
            return this.querySelector(selector);
        };
    }
    function empty$1() {
        return [];
    }
    function selectorAll(selector) {
        return null == selector ? empty$1 : function() {
            return this.querySelectorAll(selector);
        };
    }
    var matcher = function(selector) {
        return function() {
            return this.matches(selector);
        };
    };
    if ("undefined" != typeof document) {
        var element = document.documentElement;
        if (!element.matches) {
            var vendorMatches = element.webkitMatchesSelector || element.msMatchesSelector || element.mozMatchesSelector || element.oMatchesSelector;
            matcher = function(selector) {
                return function() {
                    return vendorMatches.call(this, selector);
                };
            };
        }
    }
    var matcher$1 = matcher;
    function sparse(update) {
        return new Array(update.length);
    }
    function EnterNode(parent, datum) {
        this.ownerDocument = parent.ownerDocument, this.namespaceURI = parent.namespaceURI, 
        this._next = null, this._parent = parent, this.__data__ = datum;
    }
    EnterNode.prototype = {
        constructor: EnterNode,
        appendChild: function(child) {
            return this._parent.insertBefore(child, this._next);
        },
        insertBefore: function(child, next) {
            return this._parent.insertBefore(child, next);
        },
        querySelector: function(selector) {
            return this._parent.querySelector(selector);
        },
        querySelectorAll: function(selector) {
            return this._parent.querySelectorAll(selector);
        }
    };
    var keyPrefix = "$";
    function bindIndex(parent, group, enter, update, exit, data) {
        for (var node, i = 0, groupLength = group.length, dataLength = data.length; i < dataLength; ++i) (node = group[i]) ? (node.__data__ = data[i], 
        update[i] = node) : enter[i] = new EnterNode(parent, data[i]);
        for (;i < groupLength; ++i) (node = group[i]) && (exit[i] = node);
    }
    function bindKey(parent, group, enter, update, exit, data, key) {
        var i, node, keyValue, nodeByKeyValue = {}, groupLength = group.length, dataLength = data.length, keyValues = new Array(groupLength);
        for (i = 0; i < groupLength; ++i) (node = group[i]) && (keyValues[i] = keyValue = keyPrefix + key.call(node, node.__data__, i, group), 
        keyValue in nodeByKeyValue ? exit[i] = node : nodeByKeyValue[keyValue] = node);
        for (i = 0; i < dataLength; ++i) (node = nodeByKeyValue[keyValue = keyPrefix + key.call(parent, data[i], i, data)]) ? ((update[i] = node).__data__ = data[i], 
        nodeByKeyValue[keyValue] = null) : enter[i] = new EnterNode(parent, data[i]);
        for (i = 0; i < groupLength; ++i) (node = group[i]) && nodeByKeyValue[keyValues[i]] === node && (exit[i] = node);
    }
    function ascending$1(a, b) {
        return a < b ? -1 : b < a ? 1 : b <= a ? 0 : NaN;
    }
    function defaultView(node) {
        return node.ownerDocument && node.ownerDocument.defaultView || node.document && node || node.defaultView;
    }
    function styleValue(node, name) {
        return node.style.getPropertyValue(name) || defaultView(node).getComputedStyle(node, null).getPropertyValue(name);
    }
    function classArray(string) {
        return string.trim().split(/^|\s+/);
    }
    function classList(node) {
        return node.classList || new ClassList(node);
    }
    function ClassList(node) {
        this._node = node, this._names = classArray(node.getAttribute("class") || "");
    }
    function classedAdd(node, names) {
        for (var list = classList(node), i = -1, n = names.length; ++i < n; ) list.add(names[i]);
    }
    function classedRemove(node, names) {
        for (var list = classList(node), i = -1, n = names.length; ++i < n; ) list.remove(names[i]);
    }
    function textRemove() {
        this.textContent = "";
    }
    function htmlRemove() {
        this.innerHTML = "";
    }
    function raise() {
        this.nextSibling && this.parentNode.appendChild(this);
    }
    function lower() {
        this.previousSibling && this.parentNode.insertBefore(this, this.parentNode.firstChild);
    }
    function constantNull() {
        return null;
    }
    function remove() {
        var parent = this.parentNode;
        parent && parent.removeChild(this);
    }
    function selection_cloneShallow() {
        return this.parentNode.insertBefore(this.cloneNode(!1), this.nextSibling);
    }
    function selection_cloneDeep() {
        return this.parentNode.insertBefore(this.cloneNode(!0), this.nextSibling);
    }
    ClassList.prototype = {
        add: function(name) {
            this._names.indexOf(name) < 0 && (this._names.push(name), this._node.setAttribute("class", this._names.join(" ")));
        },
        remove: function(name) {
            var i = this._names.indexOf(name);
            0 <= i && (this._names.splice(i, 1), this._node.setAttribute("class", this._names.join(" ")));
        },
        contains: function(name) {
            return 0 <= this._names.indexOf(name);
        }
    };
    var filterEvents = {};
    (exports.event = null, "undefined" != typeof document) && ("onmouseenter" in document.documentElement || (filterEvents = {
        mouseenter: "mouseover",
        mouseleave: "mouseout"
    }));
    function filterContextListener(listener, index, group) {
        return listener = contextListener(listener, index, group), function(event) {
            var related = event.relatedTarget;
            related && (related === this || 8 & related.compareDocumentPosition(this)) || listener.call(this, event);
        };
    }
    function contextListener(listener, index, group) {
        return function(event1) {
            var event0 = exports.event;
            exports.event = event1;
            try {
                listener.call(this, this.__data__, index, group);
            } finally {
                exports.event = event0;
            }
        };
    }
    function onRemove(typename) {
        return function() {
            var on = this.__on;
            if (on) {
                for (var o, j = 0, i = -1, m = on.length; j < m; ++j) o = on[j], typename.type && o.type !== typename.type || o.name !== typename.name ? on[++i] = o : this.removeEventListener(o.type, o.listener, o.capture);
                ++i ? on.length = i : delete this.__on;
            }
        };
    }
    function onAdd(typename, value, capture) {
        var wrap = filterEvents.hasOwnProperty(typename.type) ? filterContextListener : contextListener;
        return function(d, i, group) {
            var o, on = this.__on, listener = wrap(value, i, group);
            if (on) for (var j = 0, m = on.length; j < m; ++j) if ((o = on[j]).type === typename.type && o.name === typename.name) return this.removeEventListener(o.type, o.listener, o.capture), 
            this.addEventListener(o.type, o.listener = listener, o.capture = capture), void (o.value = value);
            this.addEventListener(typename.type, listener, capture), o = {
                type: typename.type,
                name: typename.name,
                value: value,
                listener: listener,
                capture: capture
            }, on ? on.push(o) : this.__on = [ o ];
        };
    }
    function customEvent(event1, listener, that, args) {
        var event0 = exports.event;
        event1.sourceEvent = exports.event, exports.event = event1;
        try {
            return listener.apply(that, args);
        } finally {
            exports.event = event0;
        }
    }
    function dispatchEvent(node, type, params) {
        var window = defaultView(node), event = window.CustomEvent;
        "function" == typeof event ? event = new event(type, params) : (event = window.document.createEvent("Event"), 
        params ? (event.initEvent(type, params.bubbles, params.cancelable), event.detail = params.detail) : event.initEvent(type, !1, !1)), 
        node.dispatchEvent(event);
    }
    var root = [ null ];
    function Selection(groups, parents) {
        this._groups = groups, this._parents = parents;
    }
    function selection() {
        return new Selection([ [ document.documentElement ] ], root);
    }
    function select(selector) {
        return "string" == typeof selector ? new Selection([ [ document.querySelector(selector) ] ], [ document.documentElement ]) : new Selection([ [ selector ] ], root);
    }
    Selection.prototype = selection.prototype = {
        constructor: Selection,
        select: function(select) {
            "function" != typeof select && (select = selector(select));
            for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) for (var node, subnode, group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), i = 0; i < n; ++i) (node = group[i]) && (subnode = select.call(node, node.__data__, i, group)) && ("__data__" in node && (subnode.__data__ = node.__data__), 
            subgroup[i] = subnode);
            return new Selection(subgroups, this._parents);
        },
        selectAll: function(select) {
            "function" != typeof select && (select = selectorAll(select));
            for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) for (var node, group = groups[j], n = group.length, i = 0; i < n; ++i) (node = group[i]) && (subgroups.push(select.call(node, node.__data__, i, group)), 
            parents.push(node));
            return new Selection(subgroups, parents);
        },
        filter: function(match) {
            "function" != typeof match && (match = matcher$1(match));
            for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) for (var node, group = groups[j], n = group.length, subgroup = subgroups[j] = [], i = 0; i < n; ++i) (node = group[i]) && match.call(node, node.__data__, i, group) && subgroup.push(node);
            return new Selection(subgroups, this._parents);
        },
        data: function(value, key) {
            if (!value) return data = new Array(this.size()), j = -1, this.each(function(d) {
                data[++j] = d;
            }), data;
            var x, bind = key ? bindKey : bindIndex, parents = this._parents, groups = this._groups;
            "function" != typeof value && (x = value, value = function() {
                return x;
            });
            for (var m = groups.length, update = new Array(m), enter = new Array(m), exit = new Array(m), j = 0; j < m; ++j) {
                var parent = parents[j], group = groups[j], groupLength = group.length, data = value.call(parent, parent && parent.__data__, j, parents), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update[j] = new Array(dataLength);
                bind(parent, group, enterGroup, updateGroup, exit[j] = new Array(groupLength), data, key);
                for (var previous, next, i0 = 0, i1 = 0; i0 < dataLength; ++i0) if (previous = enterGroup[i0]) {
                    for (i1 <= i0 && (i1 = i0 + 1); !(next = updateGroup[i1]) && ++i1 < dataLength; ) ;
                    previous._next = next || null;
                }
            }
            return (update = new Selection(update, parents))._enter = enter, update._exit = exit, 
            update;
        },
        enter: function() {
            return new Selection(this._enter || this._groups.map(sparse), this._parents);
        },
        exit: function() {
            return new Selection(this._exit || this._groups.map(sparse), this._parents);
        },
        merge: function(selection$$1) {
            for (var groups0 = this._groups, groups1 = selection$$1._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) for (var node, group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), i = 0; i < n; ++i) (node = group0[i] || group1[i]) && (merge[i] = node);
            for (;j < m0; ++j) merges[j] = groups0[j];
            return new Selection(merges, this._parents);
        },
        order: function() {
            for (var groups = this._groups, j = -1, m = groups.length; ++j < m; ) for (var node, group = groups[j], i = group.length - 1, next = group[i]; 0 <= --i; ) (node = group[i]) && (next && next !== node.nextSibling && next.parentNode.insertBefore(node, next), 
            next = node);
            return this;
        },
        sort: function(compare) {
            function compareNode(a, b) {
                return a && b ? compare(a.__data__, b.__data__) : !a - !b;
            }
            compare || (compare = ascending$1);
            for (var groups = this._groups, m = groups.length, sortgroups = new Array(m), j = 0; j < m; ++j) {
                for (var node, group = groups[j], n = group.length, sortgroup = sortgroups[j] = new Array(n), i = 0; i < n; ++i) (node = group[i]) && (sortgroup[i] = node);
                sortgroup.sort(compareNode);
            }
            return new Selection(sortgroups, this._parents).order();
        },
        call: function() {
            var callback = arguments[0];
            return arguments[0] = this, callback.apply(null, arguments), this;
        },
        nodes: function() {
            var nodes = new Array(this.size()), i = -1;
            return this.each(function() {
                nodes[++i] = this;
            }), nodes;
        },
        node: function() {
            for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) for (var group = groups[j], i = 0, n = group.length; i < n; ++i) {
                var node = group[i];
                if (node) return node;
            }
            return null;
        },
        size: function() {
            var size = 0;
            return this.each(function() {
                ++size;
            }), size;
        },
        empty: function() {
            return !this.node();
        },
        each: function(callback) {
            for (var groups = this._groups, j = 0, m = groups.length; j < m; ++j) for (var node, group = groups[j], i = 0, n = group.length; i < n; ++i) (node = group[i]) && callback.call(node, node.__data__, i, group);
            return this;
        },
        attr: function(name, value) {
            var fullname = namespace(name);
            if (arguments.length < 2) {
                var node = this.node();
                return fullname.local ? node.getAttributeNS(fullname.space, fullname.local) : node.getAttribute(fullname);
            }
            return this.each((null == value ? fullname.local ? function(fullname) {
                return function() {
                    this.removeAttributeNS(fullname.space, fullname.local);
                };
            } : function(name) {
                return function() {
                    this.removeAttribute(name);
                };
            } : "function" == typeof value ? fullname.local ? function(fullname, value) {
                return function() {
                    var v = value.apply(this, arguments);
                    null == v ? this.removeAttributeNS(fullname.space, fullname.local) : this.setAttributeNS(fullname.space, fullname.local, v);
                };
            } : function(name, value) {
                return function() {
                    var v = value.apply(this, arguments);
                    null == v ? this.removeAttribute(name) : this.setAttribute(name, v);
                };
            } : fullname.local ? function(fullname, value) {
                return function() {
                    this.setAttributeNS(fullname.space, fullname.local, value);
                };
            } : function(name, value) {
                return function() {
                    this.setAttribute(name, value);
                };
            })(fullname, value));
        },
        style: function(name, value, priority) {
            return 1 < arguments.length ? this.each((null == value ? function(name) {
                return function() {
                    this.style.removeProperty(name);
                };
            } : "function" == typeof value ? function(name, value, priority) {
                return function() {
                    var v = value.apply(this, arguments);
                    null == v ? this.style.removeProperty(name) : this.style.setProperty(name, v, priority);
                };
            } : function(name, value, priority) {
                return function() {
                    this.style.setProperty(name, value, priority);
                };
            })(name, value, null == priority ? "" : priority)) : styleValue(this.node(), name);
        },
        property: function(name, value) {
            return 1 < arguments.length ? this.each((null == value ? function(name) {
                return function() {
                    delete this[name];
                };
            } : "function" == typeof value ? function(name, value) {
                return function() {
                    var v = value.apply(this, arguments);
                    null == v ? delete this[name] : this[name] = v;
                };
            } : function(name, value) {
                return function() {
                    this[name] = value;
                };
            })(name, value)) : this.node()[name];
        },
        classed: function(name, value) {
            var names = classArray(name + "");
            if (arguments.length < 2) {
                for (var list = classList(this.node()), i = -1, n = names.length; ++i < n; ) if (!list.contains(names[i])) return !1;
                return !0;
            }
            return this.each(("function" == typeof value ? function(names, value) {
                return function() {
                    (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names);
                };
            } : value ? function(names) {
                return function() {
                    classedAdd(this, names);
                };
            } : function(names) {
                return function() {
                    classedRemove(this, names);
                };
            })(names, value));
        },
        text: function(value) {
            return arguments.length ? this.each(null == value ? textRemove : ("function" == typeof value ? function(value) {
                return function() {
                    var v = value.apply(this, arguments);
                    this.textContent = null == v ? "" : v;
                };
            } : function(value) {
                return function() {
                    this.textContent = value;
                };
            })(value)) : this.node().textContent;
        },
        html: function(value) {
            return arguments.length ? this.each(null == value ? htmlRemove : ("function" == typeof value ? function(value) {
                return function() {
                    var v = value.apply(this, arguments);
                    this.innerHTML = null == v ? "" : v;
                };
            } : function(value) {
                return function() {
                    this.innerHTML = value;
                };
            })(value)) : this.node().innerHTML;
        },
        raise: function() {
            return this.each(raise);
        },
        lower: function() {
            return this.each(lower);
        },
        append: function(name) {
            var create = "function" == typeof name ? name : creator(name);
            return this.select(function() {
                return this.appendChild(create.apply(this, arguments));
            });
        },
        insert: function(name, before) {
            var create = "function" == typeof name ? name : creator(name), select = null == before ? constantNull : "function" == typeof before ? before : selector(before);
            return this.select(function() {
                return this.insertBefore(create.apply(this, arguments), select.apply(this, arguments) || null);
            });
        },
        remove: function() {
            return this.each(remove);
        },
        clone: function(deep) {
            return this.select(deep ? selection_cloneDeep : selection_cloneShallow);
        },
        datum: function(value) {
            return arguments.length ? this.property("__data__", value) : this.node().__data__;
        },
        on: function(typename, value, capture) {
            var i, t, typenames = function(typenames) {
                return typenames.trim().split(/^|\s+/).map(function(t) {
                    var name = "", i = t.indexOf(".");
                    return 0 <= i && (name = t.slice(i + 1), t = t.slice(0, i)), {
                        type: t,
                        name: name
                    };
                });
            }(typename + ""), n = typenames.length;
            if (!(arguments.length < 2)) {
                for (on = value ? onAdd : onRemove, null == capture && (capture = !1), i = 0; i < n; ++i) this.each(on(typenames[i], value, capture));
                return this;
            }
            var on = this.node().__on;
            if (on) for (var o, j = 0, m = on.length; j < m; ++j) for (i = 0, o = on[j]; i < n; ++i) if ((t = typenames[i]).type === o.type && t.name === o.name) return o.value;
        },
        dispatch: function(type, params) {
            return this.each(("function" == typeof params ? function(type, params) {
                return function() {
                    return dispatchEvent(this, type, params.apply(this, arguments));
                };
            } : function(type, params) {
                return function() {
                    return dispatchEvent(this, type, params);
                };
            })(type, params));
        }
    };
    var nextId = 0;
    function local$1() {
        return new Local();
    }
    function Local() {
        this._ = "@" + (++nextId).toString(36);
    }
    function sourceEvent() {
        for (var source, current = exports.event; source = current.sourceEvent; ) current = source;
        return current;
    }
    function point(node, event) {
        var svg = node.ownerSVGElement || node;
        if (svg.createSVGPoint) {
            var point = svg.createSVGPoint();
            return point.x = event.clientX, point.y = event.clientY, [ (point = point.matrixTransform(node.getScreenCTM().inverse())).x, point.y ];
        }
        var rect = node.getBoundingClientRect();
        return [ event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop ];
    }
    function mouse(node) {
        var event = sourceEvent();
        return event.changedTouches && (event = event.changedTouches[0]), point(node, event);
    }
    function touch(node, touches, identifier) {
        arguments.length < 3 && (identifier = touches, touches = sourceEvent().changedTouches);
        for (var touch, i = 0, n = touches ? touches.length : 0; i < n; ++i) if ((touch = touches[i]).identifier === identifier) return point(node, touch);
        return null;
    }
    function nopropagation() {
        exports.event.stopImmediatePropagation();
    }
    function noevent() {
        exports.event.preventDefault(), exports.event.stopImmediatePropagation();
    }
    function dragDisable(view) {
        var root = view.document.documentElement, selection = select(view).on("dragstart.drag", noevent, !0);
        "onselectstart" in root ? selection.on("selectstart.drag", noevent, !0) : (root.__noselect = root.style.MozUserSelect, 
        root.style.MozUserSelect = "none");
    }
    function yesdrag(view, noclick) {
        var root = view.document.documentElement, selection = select(view).on("dragstart.drag", null);
        noclick && (selection.on("click.drag", noevent, !0), setTimeout(function() {
            selection.on("click.drag", null);
        }, 0)), "onselectstart" in root ? selection.on("selectstart.drag", null) : (root.style.MozUserSelect = root.__noselect, 
        delete root.__noselect);
    }
    function constant$2(x) {
        return function() {
            return x;
        };
    }
    function DragEvent(target, type, subject, id, active, x, y, dx, dy, dispatch) {
        this.target = target, this.type = type, this.subject = subject, this.identifier = id, 
        this.active = active, this.x = x, this.y = y, this.dx = dx, this.dy = dy, this._ = dispatch;
    }
    function defaultFilter$1() {
        return !exports.event.button;
    }
    function defaultContainer() {
        return this.parentNode;
    }
    function defaultSubject(d) {
        return null == d ? {
            x: exports.event.x,
            y: exports.event.y
        } : d;
    }
    function defaultTouchable() {
        return "ontouchstart" in this;
    }
    function define(constructor, factory, prototype) {
        constructor.prototype = factory.prototype = prototype, prototype.constructor = constructor;
    }
    function extend(parent, definition) {
        var prototype = Object.create(parent.prototype);
        for (var key in definition) prototype[key] = definition[key];
        return prototype;
    }
    function Color() {}
    Local.prototype = local$1.prototype = {
        constructor: Local,
        get: function(node) {
            for (var id = this._; !(id in node); ) if (!(node = node.parentNode)) return;
            return node[id];
        },
        set: function(node, value) {
            return node[this._] = value;
        },
        remove: function(node) {
            return this._ in node && delete node[this._];
        },
        toString: function() {
            return this._;
        }
    }, DragEvent.prototype.on = function() {
        var value = this._.on.apply(this._, arguments);
        return value === this._ ? this : value;
    };
    var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex3 = /^#([0-9a-f]{3})$/, reHex6 = /^#([0-9a-f]{6})$/, reRgbInteger = new RegExp("^rgb\\(" + [ reI, reI, reI ] + "\\)$"), reRgbPercent = new RegExp("^rgb\\(" + [ reP, reP, reP ] + "\\)$"), reRgbaInteger = new RegExp("^rgba\\(" + [ reI, reI, reI, reN ] + "\\)$"), reRgbaPercent = new RegExp("^rgba\\(" + [ reP, reP, reP, reN ] + "\\)$"), reHslPercent = new RegExp("^hsl\\(" + [ reN, reP, reP ] + "\\)$"), reHslaPercent = new RegExp("^hsla\\(" + [ reN, reP, reP, reN ] + "\\)$"), named = {
        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,
        rebeccapurple: 6697881,
        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
    };
    function color(format) {
        var m;
        return format = (format + "").trim().toLowerCase(), (m = reHex3.exec(format)) ? new Rgb((m = parseInt(m[1], 16)) >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | 240 & m, (15 & m) << 4 | 15 & m, 1) : (m = reHex6.exec(format)) ? rgbn(parseInt(m[1], 16)) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(255 * m[1] / 100, 255 * m[2] / 100, 255 * m[3] / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(255 * m[1] / 100, 255 * m[2] / 100, 255 * m[3] / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : "transparent" === format ? new Rgb(NaN, NaN, NaN, 0) : null;
    }
    function rgbn(n) {
        return new Rgb(n >> 16 & 255, n >> 8 & 255, 255 & n, 1);
    }
    function rgba(r, g, b, a) {
        return a <= 0 && (r = g = b = NaN), new Rgb(r, g, b, a);
    }
    function rgbConvert(o) {
        return o instanceof Color || (o = color(o)), o ? new Rgb((o = o.rgb()).r, o.g, o.b, o.opacity) : new Rgb();
    }
    function rgb(r, g, b, opacity) {
        return 1 === arguments.length ? rgbConvert(r) : new Rgb(r, g, b, null == opacity ? 1 : opacity);
    }
    function Rgb(r, g, b, opacity) {
        this.r = +r, this.g = +g, this.b = +b, this.opacity = +opacity;
    }
    function hsla(h, s, l, a) {
        return a <= 0 ? h = s = l = NaN : l <= 0 || 1 <= l ? h = s = NaN : s <= 0 && (h = NaN), 
        new Hsl(h, s, l, a);
    }
    function hsl(h, s, l, opacity) {
        return 1 === arguments.length ? function(o) {
            if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
            if (o instanceof Color || (o = color(o)), !o) return new Hsl();
            if (o instanceof Hsl) return o;
            var r = (o = o.rgb()).r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2;
            return s ? (h = r === max ? (g - b) / s + 6 * (g < b) : g === max ? (b - r) / s + 2 : (r - g) / s + 4, 
            s /= l < .5 ? max + min : 2 - max - min, h *= 60) : s = 0 < l && l < 1 ? 0 : h, 
            new Hsl(h, s, l, o.opacity);
        }(h) : new Hsl(h, s, l, null == opacity ? 1 : opacity);
    }
    function Hsl(h, s, l, opacity) {
        this.h = +h, this.s = +s, this.l = +l, this.opacity = +opacity;
    }
    function hsl2rgb(h, m1, m2) {
        return 255 * (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1);
    }
    define(Color, color, {
        displayable: function() {
            return this.rgb().displayable();
        },
        toString: function() {
            return this.rgb() + "";
        }
    }), define(Rgb, rgb, extend(Color, {
        brighter: function(k) {
            return k = null == k ? 1 / .7 : Math.pow(1 / .7, k), new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
        },
        darker: function(k) {
            return k = null == k ? .7 : Math.pow(.7, k), new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
        },
        rgb: function() {
            return this;
        },
        displayable: function() {
            return 0 <= this.r && this.r <= 255 && 0 <= this.g && this.g <= 255 && 0 <= this.b && this.b <= 255 && 0 <= this.opacity && this.opacity <= 1;
        },
        toString: function() {
            var a = this.opacity;
            return (1 === (a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a))) ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (1 === a ? ")" : ", " + a + ")");
        }
    })), define(Hsl, hsl, extend(Color, {
        brighter: function(k) {
            return k = null == k ? 1 / .7 : Math.pow(1 / .7, k), new Hsl(this.h, this.s, this.l * k, this.opacity);
        },
        darker: function(k) {
            return k = null == k ? .7 : Math.pow(.7, k), new Hsl(this.h, this.s, this.l * k, this.opacity);
        },
        rgb: function() {
            var h = this.h % 360 + 360 * (this.h < 0), s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < .5 ? l : 1 - l) * s, m1 = 2 * l - m2;
            return new Rgb(hsl2rgb(240 <= h ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity);
        },
        displayable: function() {
            return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
        }
    }));
    var deg2rad = Math.PI / 180, rad2deg = 180 / Math.PI, Xn = .95047, Yn = 1, Zn = 1.08883, t0 = 4 / 29, t1 = 6 / 29, t2 = 3 * t1 * t1, t3 = t1 * t1 * t1;
    function labConvert(o) {
        if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
        if (o instanceof Hcl) {
            var h = o.h * deg2rad;
            return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
        }
        o instanceof Rgb || (o = rgbConvert(o));
        var b = rgb2xyz(o.r), a = rgb2xyz(o.g), l = rgb2xyz(o.b), x = xyz2lab((.4124564 * b + .3575761 * a + .1804375 * l) / Xn), y = xyz2lab((.2126729 * b + .7151522 * a + .072175 * l) / Yn);
        return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - xyz2lab((.0193339 * b + .119192 * a + .9503041 * l) / Zn)), o.opacity);
    }
    function lab(l, a, b, opacity) {
        return 1 === arguments.length ? labConvert(l) : new Lab(l, a, b, null == opacity ? 1 : opacity);
    }
    function Lab(l, a, b, opacity) {
        this.l = +l, this.a = +a, this.b = +b, this.opacity = +opacity;
    }
    function xyz2lab(t) {
        return t3 < t ? Math.pow(t, 1 / 3) : t / t2 + t0;
    }
    function lab2xyz(t) {
        return t1 < t ? t * t * t : t2 * (t - t0);
    }
    function xyz2rgb(x) {
        return 255 * (x <= .0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - .055);
    }
    function rgb2xyz(x) {
        return (x /= 255) <= .04045 ? x / 12.92 : Math.pow((x + .055) / 1.055, 2.4);
    }
    function hcl(h, c, l, opacity) {
        return 1 === arguments.length ? function(o) {
            if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
            o instanceof Lab || (o = labConvert(o));
            var h = Math.atan2(o.b, o.a) * rad2deg;
            return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
        }(h) : new Hcl(h, c, l, null == opacity ? 1 : opacity);
    }
    function Hcl(h, c, l, opacity) {
        this.h = +h, this.c = +c, this.l = +l, this.opacity = +opacity;
    }
    define(Lab, lab, extend(Color, {
        brighter: function(k) {
            return new Lab(this.l + 18 * (null == k ? 1 : k), this.a, this.b, this.opacity);
        },
        darker: function(k) {
            return new Lab(this.l - 18 * (null == k ? 1 : k), this.a, this.b, this.opacity);
        },
        rgb: function() {
            var y = (this.l + 16) / 116, x = isNaN(this.a) ? y : y + this.a / 500, z = isNaN(this.b) ? y : y - this.b / 200;
            return y = Yn * lab2xyz(y), new Rgb(xyz2rgb(3.2404542 * (x = Xn * lab2xyz(x)) - 1.5371385 * y - .4985314 * (z = Zn * lab2xyz(z))), xyz2rgb(-.969266 * x + 1.8760108 * y + .041556 * z), xyz2rgb(.0556434 * x - .2040259 * y + 1.0572252 * z), this.opacity);
        }
    })), define(Hcl, hcl, extend(Color, {
        brighter: function(k) {
            return new Hcl(this.h, this.c, this.l + 18 * (null == k ? 1 : k), this.opacity);
        },
        darker: function(k) {
            return new Hcl(this.h, this.c, this.l - 18 * (null == k ? 1 : k), this.opacity);
        },
        rgb: function() {
            return labConvert(this).rgb();
        }
    }));
    var A = -.14861, B = 1.78277, C = -.29227, D = -.90649, E = 1.97294, ED = E * D, EB = E * B, BC_DA = B * C - D * A;
    function cubehelix(h, s, l, opacity) {
        return 1 === arguments.length ? function(o) {
            if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity);
            o instanceof Rgb || (o = rgbConvert(o));
            var r = o.r / 255, g = o.g / 255, b = o.b / 255, l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), bl = b - l, k = (E * (g - l) - C * bl) / D, s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN;
            return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
        }(h) : new Cubehelix(h, s, l, null == opacity ? 1 : opacity);
    }
    function Cubehelix(h, s, l, opacity) {
        this.h = +h, this.s = +s, this.l = +l, this.opacity = +opacity;
    }
    function basis(t1, v0, v1, v2, v3) {
        var t2 = t1 * t1, t3 = t2 * t1;
        return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6;
    }
    function basis$1(values) {
        var n = values.length - 1;
        return function(t) {
            var i = t <= 0 ? t = 0 : 1 <= t ? n - (t = 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = 0 < i ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1;
            return basis((t - i / n) * n, v0, v1, v2, v3);
        };
    }
    function basisClosed(values) {
        var n = values.length;
        return function(t) {
            var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n];
            return basis((t - i / n) * n, v0, v1, v2, v3);
        };
    }
    function constant$3(x) {
        return function() {
            return x;
        };
    }
    function linear(a, d) {
        return function(t) {
            return a + t * d;
        };
    }
    function hue(a, b) {
        var d = b - a;
        return d ? linear(a, 180 < d || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$3(isNaN(a) ? b : a);
    }
    function gamma(y) {
        return 1 == (y = +y) ? nogamma : function(a, b) {
            return b - a ? function(a, b, y) {
                return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
                    return Math.pow(a + t * b, y);
                };
            }(a, b, y) : constant$3(isNaN(a) ? b : a);
        };
    }
    function nogamma(a, b) {
        var d = b - a;
        return d ? linear(a, d) : constant$3(isNaN(a) ? b : a);
    }
    define(Cubehelix, cubehelix, extend(Color, {
        brighter: function(k) {
            return k = null == k ? 1 / .7 : Math.pow(1 / .7, k), new Cubehelix(this.h, this.s, this.l * k, this.opacity);
        },
        darker: function(k) {
            return k = null == k ? .7 : Math.pow(.7, k), new Cubehelix(this.h, this.s, this.l * k, this.opacity);
        },
        rgb: function() {
            var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, l = +this.l, a = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh = Math.cos(h), sinh = Math.sin(h);
            return new Rgb(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity);
        }
    }));
    var interpolateRgb = function rgbGamma(y) {
        var color$$1 = gamma(y);
        function rgb$$1(start, end) {
            var r = color$$1((start = rgb(start)).r, (end = rgb(end)).r), g = color$$1(start.g, end.g), b = color$$1(start.b, end.b), opacity = nogamma(start.opacity, end.opacity);
            return function(t) {
                return start.r = r(t), start.g = g(t), start.b = b(t), start.opacity = opacity(t), 
                start + "";
            };
        }
        return rgb$$1.gamma = rgbGamma, rgb$$1;
    }(1);
    function rgbSpline(spline) {
        return function(colors) {
            var i, color$$1, n = colors.length, r = new Array(n), g = new Array(n), b = new Array(n);
            for (i = 0; i < n; ++i) color$$1 = rgb(colors[i]), r[i] = color$$1.r || 0, g[i] = color$$1.g || 0, 
            b[i] = color$$1.b || 0;
            return r = spline(r), g = spline(g), b = spline(b), color$$1.opacity = 1, function(t) {
                return color$$1.r = r(t), color$$1.g = g(t), color$$1.b = b(t), color$$1 + "";
            };
        };
    }
    var rgbBasis = rgbSpline(basis$1), rgbBasisClosed = rgbSpline(basisClosed);
    function array$1(a, b) {
        var i, nb = b ? b.length : 0, na = a ? Math.min(nb, a.length) : 0, x = new Array(na), c = new Array(nb);
        for (i = 0; i < na; ++i) x[i] = interpolateValue(a[i], b[i]);
        for (;i < nb; ++i) c[i] = b[i];
        return function(t) {
            for (i = 0; i < na; ++i) c[i] = x[i](t);
            return c;
        };
    }
    function date(a, b) {
        var d = new Date();
        return b -= a = +a, function(t) {
            return d.setTime(a + b * t), d;
        };
    }
    function reinterpolate(a, b) {
        return b -= a = +a, function(t) {
            return a + b * t;
        };
    }
    function object(a, b) {
        var k, i = {}, c = {};
        for (k in null !== a && "object" == typeof a || (a = {}), null !== b && "object" == typeof b || (b = {}), 
        b) k in a ? i[k] = interpolateValue(a[k], b[k]) : c[k] = b[k];
        return function(t) {
            for (k in i) c[k] = i[k](t);
            return c;
        };
    }
    var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g");
    function interpolateString(a, b) {
        var am, bm, bs, bi = reA.lastIndex = reB.lastIndex = 0, i = -1, s = [], q = [];
        for (a += "", b += ""; (am = reA.exec(a)) && (bm = reB.exec(b)); ) (bs = bm.index) > bi && (bs = b.slice(bi, bs), 
        s[i] ? s[i] += bs : s[++i] = bs), (am = am[0]) === (bm = bm[0]) ? s[i] ? s[i] += bm : s[++i] = bm : (s[++i] = null, 
        q.push({
            i: i,
            x: reinterpolate(am, bm)
        })), bi = reB.lastIndex;
        return bi < b.length && (bs = b.slice(bi), s[i] ? s[i] += bs : s[++i] = bs), s.length < 2 ? q[0] ? function(b) {
            return function(t) {
                return b(t) + "";
            };
        }(q[0].x) : function(b) {
            return function() {
                return b;
            };
        }(b) : (b = q.length, function(t) {
            for (var o, i = 0; i < b; ++i) s[(o = q[i]).i] = o.x(t);
            return s.join("");
        });
    }
    function interpolateValue(a, b) {
        var c, t = typeof b;
        return null == b || "boolean" === t ? constant$3(b) : ("number" === t ? reinterpolate : "string" === t ? (c = color(b)) ? (b = c, 
        interpolateRgb) : interpolateString : b instanceof color ? interpolateRgb : b instanceof Date ? date : Array.isArray(b) ? array$1 : "function" != typeof b.valueOf && "function" != typeof b.toString || isNaN(b) ? object : reinterpolate)(a, b);
    }
    function interpolateRound(a, b) {
        return b -= a = +a, function(t) {
            return Math.round(a + b * t);
        };
    }
    var cssNode, cssRoot, cssView, svgNode, degrees = 180 / Math.PI, identity$2 = {
        translateX: 0,
        translateY: 0,
        rotate: 0,
        skewX: 0,
        scaleX: 1,
        scaleY: 1
    };
    function decompose(a, b, c, d, e, f) {
        var scaleX, scaleY, skewX;
        return (scaleX = Math.sqrt(a * a + b * b)) && (a /= scaleX, b /= scaleX), (skewX = a * c + b * d) && (c -= a * skewX, 
        d -= b * skewX), (scaleY = Math.sqrt(c * c + d * d)) && (c /= scaleY, d /= scaleY, 
        skewX /= scaleY), a * d < b * c && (a = -a, b = -b, skewX = -skewX, scaleX = -scaleX), 
        {
            translateX: e,
            translateY: f,
            rotate: Math.atan2(b, a) * degrees,
            skewX: Math.atan(skewX) * degrees,
            scaleX: scaleX,
            scaleY: scaleY
        };
    }
    function interpolateTransform(parse, pxComma, pxParen, degParen) {
        function pop(s) {
            return s.length ? s.pop() + " " : "";
        }
        return function(a, b) {
            var s = [], q = [];
            return a = parse(a), b = parse(b), function(xa, ya, xb, yb, s, q) {
                if (xa !== xb || ya !== yb) {
                    var i = s.push("translate(", null, pxComma, null, pxParen);
                    q.push({
                        i: i - 4,
                        x: reinterpolate(xa, xb)
                    }, {
                        i: i - 2,
                        x: reinterpolate(ya, yb)
                    });
                } else (xb || yb) && s.push("translate(" + xb + pxComma + yb + pxParen);
            }(a.translateX, a.translateY, b.translateX, b.translateY, s, q), function(a, b, s, q) {
                a !== b ? (180 < a - b ? b += 360 : 180 < b - a && (a += 360), q.push({
                    i: s.push(pop(s) + "rotate(", null, degParen) - 2,
                    x: reinterpolate(a, b)
                })) : b && s.push(pop(s) + "rotate(" + b + degParen);
            }(a.rotate, b.rotate, s, q), function(a, b, s, q) {
                a !== b ? q.push({
                    i: s.push(pop(s) + "skewX(", null, degParen) - 2,
                    x: reinterpolate(a, b)
                }) : b && s.push(pop(s) + "skewX(" + b + degParen);
            }(a.skewX, b.skewX, s, q), function(xa, ya, xb, yb, s, q) {
                if (xa !== xb || ya !== yb) {
                    var i = s.push(pop(s) + "scale(", null, ",", null, ")");
                    q.push({
                        i: i - 4,
                        x: reinterpolate(xa, xb)
                    }, {
                        i: i - 2,
                        x: reinterpolate(ya, yb)
                    });
                } else 1 === xb && 1 === yb || s.push(pop(s) + "scale(" + xb + "," + yb + ")");
            }(a.scaleX, a.scaleY, b.scaleX, b.scaleY, s, q), a = b = null, function(t) {
                for (var o, i = -1, n = q.length; ++i < n; ) s[(o = q[i]).i] = o.x(t);
                return s.join("");
            };
        };
    }
    var interpolateTransformCss = interpolateTransform(function(value) {
        return "none" === value ? identity$2 : (cssNode || (cssNode = document.createElement("DIV"), 
        cssRoot = document.documentElement, cssView = document.defaultView), cssNode.style.transform = value, 
        value = cssView.getComputedStyle(cssRoot.appendChild(cssNode), null).getPropertyValue("transform"), 
        cssRoot.removeChild(cssNode), decompose(+(value = value.slice(7, -1).split(","))[0], +value[1], +value[2], +value[3], +value[4], +value[5]));
    }, "px, ", "px)", "deg)"), interpolateTransformSvg = interpolateTransform(function(value) {
        return null == value ? identity$2 : (svgNode || (svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g")), 
        svgNode.setAttribute("transform", value), (value = svgNode.transform.baseVal.consolidate()) ? decompose((value = value.matrix).a, value.b, value.c, value.d, value.e, value.f) : identity$2);
    }, ", ", ")", ")"), rho = Math.SQRT2, rho2 = 2, rho4 = 4, epsilon2 = 1e-12;
    function cosh(x) {
        return ((x = Math.exp(x)) + 1 / x) / 2;
    }
    function interpolateZoom(p0, p1) {
        var i, S, ux0 = p0[0], uy0 = p0[1], w0 = p0[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy;
        if (d2 < epsilon2) S = Math.log(w1 / w0) / rho, i = function(t) {
            return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S) ];
        }; else {
            var d1 = Math.sqrt(d2), b0 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b1 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0), r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1);
            S = (r1 - r0) / rho, i = function(t) {
                var x, s = t * S, coshr0 = cosh(r0), u = w0 / (rho2 * d1) * (coshr0 * (x = rho * s + r0, 
                ((x = Math.exp(2 * x)) - 1) / (x + 1)) - function(x) {
                    return ((x = Math.exp(x)) - 1 / x) / 2;
                }(r0));
                return [ ux0 + u * dx, uy0 + u * dy, w0 * coshr0 / cosh(rho * s + r0) ];
            };
        }
        return i.duration = 1e3 * S, i;
    }
    function hsl$1(hue$$1) {
        return function(start, end) {
            var h = hue$$1((start = hsl(start)).h, (end = hsl(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity);
            return function(t) {
                return start.h = h(t), start.s = s(t), start.l = l(t), start.opacity = opacity(t), 
                start + "";
            };
        };
    }
    var hsl$2 = hsl$1(hue), hslLong = hsl$1(nogamma);
    function hcl$1(hue$$1) {
        return function(start, end) {
            var h = hue$$1((start = hcl(start)).h, (end = hcl(end)).h), c = nogamma(start.c, end.c), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity);
            return function(t) {
                return start.h = h(t), start.c = c(t), start.l = l(t), start.opacity = opacity(t), 
                start + "";
            };
        };
    }
    var hcl$2 = hcl$1(hue), hclLong = hcl$1(nogamma);
    function cubehelix$1(hue$$1) {
        return function cubehelixGamma(y) {
            function cubehelix$$1(start, end) {
                var h = hue$$1((start = cubehelix(start)).h, (end = cubehelix(end)).h), s = nogamma(start.s, end.s), l = nogamma(start.l, end.l), opacity = nogamma(start.opacity, end.opacity);
                return function(t) {
                    return start.h = h(t), start.s = s(t), start.l = l(Math.pow(t, y)), start.opacity = opacity(t), 
                    start + "";
                };
            }
            return y = +y, cubehelix$$1.gamma = cubehelixGamma, cubehelix$$1;
        }(1);
    }
    var cubehelix$2 = cubehelix$1(hue), cubehelixLong = cubehelix$1(nogamma);
    var taskHead, taskTail, frame = 0, timeout = 0, interval = 0, pokeDelay = 1e3, clockLast = 0, clockNow = 0, clockSkew = 0, clock = "object" == typeof performance && performance.now ? performance : Date, setFrame = "object" == typeof window && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) {
        setTimeout(f, 17);
    };
    function now() {
        return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew);
    }
    function clearNow() {
        clockNow = 0;
    }
    function Timer() {
        this._call = this._time = this._next = null;
    }
    function timer(callback, delay, time) {
        var t = new Timer();
        return t.restart(callback, delay, time), t;
    }
    function timerFlush() {
        now(), ++frame;
        for (var e, t = taskHead; t; ) 0 <= (e = clockNow - t._time) && t._call.call(null, e), 
        t = t._next;
        --frame;
    }
    function wake() {
        clockNow = (clockLast = clock.now()) + clockSkew, frame = timeout = 0;
        try {
            timerFlush();
        } finally {
            frame = 0, function() {
                var t0, t2, t1 = taskHead, time = 1 / 0;
                for (;t1; ) t1._call ? (time > t1._time && (time = t1._time), t1 = (t0 = t1)._next) : (t2 = t1._next, 
                t1._next = null, t1 = t0 ? t0._next = t2 : taskHead = t2);
                taskTail = t0, sleep(time);
            }(), clockNow = 0;
        }
    }
    function poke() {
        var now = clock.now(), delay = now - clockLast;
        pokeDelay < delay && (clockSkew -= delay, clockLast = now);
    }
    function sleep(time) {
        frame || (timeout && (timeout = clearTimeout(timeout)), 24 < time - clockNow ? (time < 1 / 0 && (timeout = setTimeout(wake, time - clock.now() - clockSkew)), 
        interval && (interval = clearInterval(interval))) : (interval || (clockLast = clock.now(), 
        interval = setInterval(poke, pokeDelay)), frame = 1, setFrame(wake)));
    }
    function timeout$1(callback, delay, time) {
        var t = new Timer();
        return delay = null == delay ? 0 : +delay, t.restart(function(elapsed) {
            t.stop(), callback(elapsed + delay);
        }, delay, time), t;
    }
    Timer.prototype = timer.prototype = {
        constructor: Timer,
        restart: function(callback, delay, time) {
            if ("function" != typeof callback) throw new TypeError("callback is not a function");
            time = (null == time ? now() : +time) + (null == delay ? 0 : +delay), this._next || taskTail === this || (taskTail ? taskTail._next = this : taskHead = this, 
            taskTail = this), this._call = callback, this._time = time, sleep();
        },
        stop: function() {
            this._call && (this._call = null, this._time = 1 / 0, sleep());
        }
    };
    var emptyOn = dispatch("start", "end", "interrupt"), emptyTween = [], CREATED = 0, SCHEDULED = 1, STARTING = 2, STARTED = 3, RUNNING = 4, ENDING = 5, ENDED = 6;
    function schedule(node, name, id, index, group, timing) {
        var schedules = node.__transition;
        if (schedules) {
            if (id in schedules) return;
        } else node.__transition = {};
        !function(node, id, self) {
            var tween, schedules = node.__transition;
            function start(elapsed) {
                var i, j, n, o;
                if (self.state !== SCHEDULED) return stop();
                for (i in schedules) if ((o = schedules[i]).name === self.name) {
                    if (o.state === STARTED) return timeout$1(start);
                    o.state === RUNNING ? (o.state = ENDED, o.timer.stop(), o.on.call("interrupt", node, node.__data__, o.index, o.group), 
                    delete schedules[i]) : +i < id && (o.state = ENDED, o.timer.stop(), delete schedules[i]);
                }
                if (timeout$1(function() {
                    self.state === STARTED && (self.state = RUNNING, self.timer.restart(tick, self.delay, self.time), 
                    tick(elapsed));
                }), self.state = STARTING, self.on.call("start", node, node.__data__, self.index, self.group), 
                self.state === STARTING) {
                    for (self.state = STARTED, tween = new Array(n = self.tween.length), i = 0, j = -1; i < n; ++i) (o = self.tween[i].value.call(node, node.__data__, self.index, self.group)) && (tween[++j] = o);
                    tween.length = j + 1;
                }
            }
            function tick(elapsed) {
                for (var t = elapsed < self.duration ? self.ease.call(null, elapsed / self.duration) : (self.timer.restart(stop), 
                self.state = ENDING, 1), i = -1, n = tween.length; ++i < n; ) tween[i].call(null, t);
                self.state === ENDING && (self.on.call("end", node, node.__data__, self.index, self.group), 
                stop());
            }
            function stop() {
                for (var i in self.state = ENDED, self.timer.stop(), delete schedules[id], schedules) return;
                delete node.__transition;
            }
            (schedules[id] = self).timer = timer(function(elapsed) {
                self.state = SCHEDULED, self.timer.restart(start, self.delay, self.time), self.delay <= elapsed && start(elapsed - self.delay);
            }, 0, self.time);
        }(node, id, {
            name: name,
            index: index,
            group: group,
            on: emptyOn,
            tween: emptyTween,
            time: timing.time,
            delay: timing.delay,
            duration: timing.duration,
            ease: timing.ease,
            timer: null,
            state: CREATED
        });
    }
    function init(node, id) {
        var schedule = get$1(node, id);
        if (schedule.state > CREATED) throw new Error("too late; already scheduled");
        return schedule;
    }
    function set$1(node, id) {
        var schedule = get$1(node, id);
        if (schedule.state > STARTING) throw new Error("too late; already started");
        return schedule;
    }
    function get$1(node, id) {
        var schedule = node.__transition;
        if (!schedule || !(schedule = schedule[id])) throw new Error("transition not found");
        return schedule;
    }
    function interrupt(node, name) {
        var schedule$$1, active, i, schedules = node.__transition, empty = !0;
        if (schedules) {
            for (i in name = null == name ? null : name + "", schedules) (schedule$$1 = schedules[i]).name === name ? (active = schedule$$1.state > STARTING && schedule$$1.state < ENDING, 
            schedule$$1.state = ENDED, schedule$$1.timer.stop(), active && schedule$$1.on.call("interrupt", node, node.__data__, schedule$$1.index, schedule$$1.group), 
            delete schedules[i]) : empty = !1;
            empty && delete node.__transition;
        }
    }
    function tweenValue(transition, name, value) {
        var id = transition._id;
        return transition.each(function() {
            var schedule$$1 = set$1(this, id);
            (schedule$$1.value || (schedule$$1.value = {}))[name] = value.apply(this, arguments);
        }), function(node) {
            return get$1(node, id).value[name];
        };
    }
    function interpolate(a, b) {
        var c;
        return ("number" == typeof b ? reinterpolate : b instanceof color ? interpolateRgb : (c = color(b)) ? (b = c, 
        interpolateRgb) : interpolateString)(a, b);
    }
    var Selection$1 = selection.prototype.constructor;
    var id = 0;
    function Transition(groups, parents, name, id) {
        this._groups = groups, this._parents = parents, this._name = name, this._id = id;
    }
    function transition(name) {
        return selection().transition(name);
    }
    function newId() {
        return ++id;
    }
    var selection_prototype = selection.prototype;
    function quadInOut(t) {
        return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2;
    }
    function cubicInOut(t) {
        return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2;
    }
    Transition.prototype = transition.prototype = {
        constructor: Transition,
        select: function(select) {
            var name = this._name, id = this._id;
            "function" != typeof select && (select = selector(select));
            for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) for (var node, subnode, group = groups[j], n = group.length, subgroup = subgroups[j] = new Array(n), i = 0; i < n; ++i) (node = group[i]) && (subnode = select.call(node, node.__data__, i, group)) && ("__data__" in node && (subnode.__data__ = node.__data__), 
            subgroup[i] = subnode, schedule(subgroup[i], name, id, i, subgroup, get$1(node, id)));
            return new Transition(subgroups, this._parents, name, id);
        },
        selectAll: function(select) {
            var name = this._name, id = this._id;
            "function" != typeof select && (select = selectorAll(select));
            for (var groups = this._groups, m = groups.length, subgroups = [], parents = [], j = 0; j < m; ++j) for (var node, group = groups[j], n = group.length, i = 0; i < n; ++i) if (node = group[i]) {
                for (var child, children = select.call(node, node.__data__, i, group), inherit = get$1(node, id), k = 0, l = children.length; k < l; ++k) (child = children[k]) && schedule(child, name, id, k, children, inherit);
                subgroups.push(children), parents.push(node);
            }
            return new Transition(subgroups, parents, name, id);
        },
        filter: function(match) {
            "function" != typeof match && (match = matcher$1(match));
            for (var groups = this._groups, m = groups.length, subgroups = new Array(m), j = 0; j < m; ++j) for (var node, group = groups[j], n = group.length, subgroup = subgroups[j] = [], i = 0; i < n; ++i) (node = group[i]) && match.call(node, node.__data__, i, group) && subgroup.push(node);
            return new Transition(subgroups, this._parents, this._name, this._id);
        },
        merge: function(transition$$1) {
            if (transition$$1._id !== this._id) throw new Error();
            for (var groups0 = this._groups, groups1 = transition$$1._groups, m0 = groups0.length, m1 = groups1.length, m = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m; ++j) for (var node, group0 = groups0[j], group1 = groups1[j], n = group0.length, merge = merges[j] = new Array(n), i = 0; i < n; ++i) (node = group0[i] || group1[i]) && (merge[i] = node);
            for (;j < m0; ++j) merges[j] = groups0[j];
            return new Transition(merges, this._parents, this._name, this._id);
        },
        selection: function() {
            return new Selection$1(this._groups, this._parents);
        },
        transition: function() {
            for (var name = this._name, id0 = this._id, id1 = newId(), groups = this._groups, m = groups.length, j = 0; j < m; ++j) for (var node, group = groups[j], n = group.length, i = 0; i < n; ++i) if (node = group[i]) {
                var inherit = get$1(node, id0);
                schedule(node, name, id1, i, group, {
                    time: inherit.time + inherit.delay + inherit.duration,
                    delay: 0,
                    duration: inherit.duration,
                    ease: inherit.ease
                });
            }
            return new Transition(groups, this._parents, name, id1);
        },
        call: selection_prototype.call,
        nodes: selection_prototype.nodes,
        node: selection_prototype.node,
        size: selection_prototype.size,
        empty: selection_prototype.empty,
        each: selection_prototype.each,
        on: function(name, listener) {
            var id = this._id;
            return arguments.length < 2 ? get$1(this.node(), id).on.on(name) : this.each(function(id, name, listener) {
                var on0, on1, sit = function(name) {
                    return (name + "").trim().split(/^|\s+/).every(function(t) {
                        var i = t.indexOf(".");
                        return 0 <= i && (t = t.slice(0, i)), !t || "start" === t;
                    });
                }(name) ? init : set$1;
                return function() {
                    var schedule$$1 = sit(this, id), on = schedule$$1.on;
                    on !== on0 && (on1 = (on0 = on).copy()).on(name, listener), schedule$$1.on = on1;
                };
            }(id, name, listener));
        },
        attr: function(name, value) {
            var fullname = namespace(name), i = "transform" === fullname ? interpolateTransformSvg : interpolate;
            return this.attrTween(name, "function" == typeof value ? (fullname.local ? function(fullname, interpolate$$1, value) {
                var value00, value10, interpolate0;
                return function() {
                    var value0, value1 = value(this);
                    if (null != value1) return (value0 = this.getAttributeNS(fullname.space, fullname.local)) === value1 ? null : value0 === value00 && value1 === value10 ? interpolate0 : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
                    this.removeAttributeNS(fullname.space, fullname.local);
                };
            } : function(name, interpolate$$1, value) {
                var value00, value10, interpolate0;
                return function() {
                    var value0, value1 = value(this);
                    if (null != value1) return (value0 = this.getAttribute(name)) === value1 ? null : value0 === value00 && value1 === value10 ? interpolate0 : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
                    this.removeAttribute(name);
                };
            })(fullname, i, tweenValue(this, "attr." + name, value)) : null == value ? (fullname.local ? function(fullname) {
                return function() {
                    this.removeAttributeNS(fullname.space, fullname.local);
                };
            } : function(name) {
                return function() {
                    this.removeAttribute(name);
                };
            })(fullname) : (fullname.local ? function(fullname, interpolate$$1, value1) {
                var value00, interpolate0;
                return function() {
                    var value0 = this.getAttributeNS(fullname.space, fullname.local);
                    return value0 === value1 ? null : value0 === value00 ? interpolate0 : interpolate0 = interpolate$$1(value00 = value0, value1);
                };
            } : function(name, interpolate$$1, value1) {
                var value00, interpolate0;
                return function() {
                    var value0 = this.getAttribute(name);
                    return value0 === value1 ? null : value0 === value00 ? interpolate0 : interpolate0 = interpolate$$1(value00 = value0, value1);
                };
            })(fullname, i, value + ""));
        },
        attrTween: function(name, value) {
            var key = "attr." + name;
            if (arguments.length < 2) return (key = this.tween(key)) && key._value;
            if (null == value) return this.tween(key, null);
            if ("function" != typeof value) throw new Error();
            var fullname = namespace(name);
            return this.tween(key, (fullname.local ? function(fullname, value) {
                function tween() {
                    var node = this, i = value.apply(node, arguments);
                    return i && function(t) {
                        node.setAttributeNS(fullname.space, fullname.local, i(t));
                    };
                }
                return tween._value = value, tween;
            } : function(name, value) {
                function tween() {
                    var node = this, i = value.apply(node, arguments);
                    return i && function(t) {
                        node.setAttribute(name, i(t));
                    };
                }
                return tween._value = value, tween;
            })(fullname, value));
        },
        style: function(name, value, priority) {
            var i = "transform" == (name += "") ? interpolateTransformCss : interpolate;
            return null == value ? this.styleTween(name, function(name, interpolate$$1) {
                var value00, value10, interpolate0;
                return function() {
                    var value0 = styleValue(this, name), value1 = (this.style.removeProperty(name), 
                    styleValue(this, name));
                    return value0 === value1 ? null : value0 === value00 && value1 === value10 ? interpolate0 : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
                };
            }(name, i)).on("end.style." + name, function(name) {
                return function() {
                    this.style.removeProperty(name);
                };
            }(name)) : this.styleTween(name, "function" == typeof value ? function(name, interpolate$$1, value) {
                var value00, value10, interpolate0;
                return function() {
                    var value0 = styleValue(this, name), value1 = value(this);
                    return null == value1 && (this.style.removeProperty(name), value1 = styleValue(this, name)), 
                    value0 === value1 ? null : value0 === value00 && value1 === value10 ? interpolate0 : interpolate0 = interpolate$$1(value00 = value0, value10 = value1);
                };
            }(name, i, tweenValue(this, "style." + name, value)) : function(name, interpolate$$1, value1) {
                var value00, interpolate0;
                return function() {
                    var value0 = styleValue(this, name);
                    return value0 === value1 ? null : value0 === value00 ? interpolate0 : interpolate0 = interpolate$$1(value00 = value0, value1);
                };
            }(name, i, value + ""), priority);
        },
        styleTween: function(name, value, priority) {
            var key = "style." + (name += "");
            if (arguments.length < 2) return (key = this.tween(key)) && key._value;
            if (null == value) return this.tween(key, null);
            if ("function" != typeof value) throw new Error();
            return this.tween(key, function(name, value, priority) {
                function tween() {
                    var node = this, i = value.apply(node, arguments);
                    return i && function(t) {
                        node.style.setProperty(name, i(t), priority);
                    };
                }
                return tween._value = value, tween;
            }(name, value, null == priority ? "" : priority));
        },
        text: function(value) {
            return this.tween("text", "function" == typeof value ? function(value) {
                return function() {
                    var value1 = value(this);
                    this.textContent = null == value1 ? "" : value1;
                };
            }(tweenValue(this, "text", value)) : function(value) {
                return function() {
                    this.textContent = value;
                };
            }(null == value ? "" : value + ""));
        },
        remove: function() {
            return this.on("end.remove", (id = this._id, function() {
                var parent = this.parentNode;
                for (var i in this.__transition) if (+i !== id) return;
                parent && parent.removeChild(this);
            }));
            var id;
        },
        tween: function(name, value) {
            var id = this._id;
            if (name += "", arguments.length < 2) {
                for (var t, tween = get$1(this.node(), id).tween, i = 0, n = tween.length; i < n; ++i) if ((t = tween[i]).name === name) return t.value;
                return null;
            }
            return this.each((null == value ? function(id, name) {
                var tween0, tween1;
                return function() {
                    var schedule$$1 = set$1(this, id), tween = schedule$$1.tween;
                    if (tween !== tween0) for (var i = 0, n = (tween1 = tween0 = tween).length; i < n; ++i) if (tween1[i].name === name) {
                        (tween1 = tween1.slice()).splice(i, 1);
                        break;
                    }
                    schedule$$1.tween = tween1;
                };
            } : function(id, name, value) {
                var tween0, tween1;
                if ("function" != typeof value) throw new Error();
                return function() {
                    var schedule$$1 = set$1(this, id), tween = schedule$$1.tween;
                    if (tween !== tween0) {
                        tween1 = (tween0 = tween).slice();
                        for (var t = {
                            name: name,
                            value: value
                        }, i = 0, n = tween1.length; i < n; ++i) if (tween1[i].name === name) {
                            tween1[i] = t;
                            break;
                        }
                        i === n && tween1.push(t);
                    }
                    schedule$$1.tween = tween1;
                };
            })(id, name, value));
        },
        delay: function(value) {
            var id = this._id;
            return arguments.length ? this.each(("function" == typeof value ? function(id, value) {
                return function() {
                    init(this, id).delay = +value.apply(this, arguments);
                };
            } : function(id, value) {
                return value = +value, function() {
                    init(this, id).delay = value;
                };
            })(id, value)) : get$1(this.node(), id).delay;
        },
        duration: function(value) {
            var id = this._id;
            return arguments.length ? this.each(("function" == typeof value ? function(id, value) {
                return function() {
                    set$1(this, id).duration = +value.apply(this, arguments);
                };
            } : function(id, value) {
                return value = +value, function() {
                    set$1(this, id).duration = value;
                };
            })(id, value)) : get$1(this.node(), id).duration;
        },
        ease: function(value) {
            var id = this._id;
            return arguments.length ? this.each(function(id, value) {
                if ("function" != typeof value) throw new Error();
                return function() {
                    set$1(this, id).ease = value;
                };
            }(id, value)) : get$1(this.node(), id).ease;
        }
    };
    var polyIn = function custom(e) {
        function polyIn(t) {
            return Math.pow(t, e);
        }
        return e = +e, polyIn.exponent = custom, polyIn;
    }(3), polyOut = function custom(e) {
        function polyOut(t) {
            return 1 - Math.pow(1 - t, e);
        }
        return e = +e, polyOut.exponent = custom, polyOut;
    }(3), polyInOut = function custom(e) {
        function polyInOut(t) {
            return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2;
        }
        return e = +e, polyInOut.exponent = custom, polyInOut;
    }(3), pi = Math.PI, halfPi = pi / 2;
    function sinInOut(t) {
        return (1 - Math.cos(pi * t)) / 2;
    }
    function expInOut(t) {
        return ((t *= 2) <= 1 ? Math.pow(2, 10 * t - 10) : 2 - Math.pow(2, 10 - 10 * t)) / 2;
    }
    function circleInOut(t) {
        return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2;
    }
    var b1 = 4 / 11, b2 = 6 / 11, b3 = 8 / 11, b4 = .75, b5 = 9 / 11, b6 = 10 / 11, b7 = .9375, b8 = 21 / 22, b9 = 63 / 64, b0 = 1 / b1 / b1;
    function bounceOut(t) {
        return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9;
    }
    var backIn = function custom(s) {
        function backIn(t) {
            return t * t * ((s + 1) * t - s);
        }
        return s = +s, backIn.overshoot = custom, backIn;
    }(1.70158), backOut = function custom(s) {
        function backOut(t) {
            return --t * t * ((s + 1) * t + s) + 1;
        }
        return s = +s, backOut.overshoot = custom, backOut;
    }(1.70158), backInOut = function custom(s) {
        function backInOut(t) {
            return ((t *= 2) < 1 ? t * t * ((s + 1) * t - s) : (t -= 2) * t * ((s + 1) * t + s) + 2) / 2;
        }
        return s = +s, backInOut.overshoot = custom, backInOut;
    }(1.70158), tau = 2 * Math.PI, elasticIn = function custom(a, p) {
        var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
        function elasticIn(t) {
            return a * Math.pow(2, 10 * --t) * Math.sin((s - t) / p);
        }
        return elasticIn.amplitude = function(a) {
            return custom(a, p * tau);
        }, elasticIn.period = function(p) {
            return custom(a, p);
        }, elasticIn;
    }(1, .3), elasticOut = function custom(a, p) {
        var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
        function elasticOut(t) {
            return 1 - a * Math.pow(2, -10 * (t = +t)) * Math.sin((t + s) / p);
        }
        return elasticOut.amplitude = function(a) {
            return custom(a, p * tau);
        }, elasticOut.period = function(p) {
            return custom(a, p);
        }, elasticOut;
    }(1, .3), elasticInOut = function custom(a, p) {
        var s = Math.asin(1 / (a = Math.max(1, a))) * (p /= tau);
        function elasticInOut(t) {
            return ((t = 2 * t - 1) < 0 ? a * Math.pow(2, 10 * t) * Math.sin((s - t) / p) : 2 - a * Math.pow(2, -10 * t) * Math.sin((s + t) / p)) / 2;
        }
        return elasticInOut.amplitude = function(a) {
            return custom(a, p * tau);
        }, elasticInOut.period = function(p) {
            return custom(a, p);
        }, elasticInOut;
    }(1, .3), defaultTiming = {
        time: null,
        delay: 0,
        duration: 250,
        ease: cubicInOut
    };
    function inherit(node, id) {
        for (var timing; !(timing = node.__transition) || !(timing = timing[id]); ) if (!(node = node.parentNode)) return defaultTiming.time = now(), 
        defaultTiming;
        return timing;
    }
    selection.prototype.interrupt = function(name) {
        return this.each(function() {
            interrupt(this, name);
        });
    }, selection.prototype.transition = function(name) {
        var id, timing;
        name instanceof Transition ? (id = name._id, name = name._name) : (id = newId(), 
        (timing = defaultTiming).time = now(), name = null == name ? null : name + "");
        for (var groups = this._groups, m = groups.length, j = 0; j < m; ++j) for (var node, group = groups[j], n = group.length, i = 0; i < n; ++i) (node = group[i]) && schedule(node, name, id, i, group, timing || inherit(node, id));
        return new Transition(groups, this._parents, name, id);
    };
    var root$1 = [ null ];
    function constant$4(x) {
        return function() {
            return x;
        };
    }
    function BrushEvent(target, type, selection) {
        this.target = target, this.type = type, this.selection = selection;
    }
    function nopropagation$1() {
        exports.event.stopImmediatePropagation();
    }
    function noevent$1() {
        exports.event.preventDefault(), exports.event.stopImmediatePropagation();
    }
    var MODE_DRAG = {
        name: "drag"
    }, MODE_SPACE = {
        name: "space"
    }, MODE_HANDLE = {
        name: "handle"
    }, MODE_CENTER = {
        name: "center"
    }, X = {
        name: "x",
        handles: [ "e", "w" ].map(type),
        input: function(x, e) {
            return x && [ [ x[0], e[0][1] ], [ x[1], e[1][1] ] ];
        },
        output: function(xy) {
            return xy && [ xy[0][0], xy[1][0] ];
        }
    }, Y = {
        name: "y",
        handles: [ "n", "s" ].map(type),
        input: function(y, e) {
            return y && [ [ e[0][0], y[0] ], [ e[1][0], y[1] ] ];
        },
        output: function(xy) {
            return xy && [ xy[0][1], xy[1][1] ];
        }
    }, XY = {
        name: "xy",
        handles: [ "n", "e", "s", "w", "nw", "ne", "se", "sw" ].map(type),
        input: function(xy) {
            return xy;
        },
        output: function(xy) {
            return xy;
        }
    }, cursors = {
        overlay: "crosshair",
        selection: "move",
        n: "ns-resize",
        e: "ew-resize",
        s: "ns-resize",
        w: "ew-resize",
        nw: "nwse-resize",
        ne: "nesw-resize",
        se: "nwse-resize",
        sw: "nesw-resize"
    }, flipX = {
        e: "w",
        w: "e",
        nw: "ne",
        ne: "nw",
        se: "sw",
        sw: "se"
    }, flipY = {
        n: "s",
        s: "n",
        nw: "sw",
        ne: "se",
        se: "ne",
        sw: "nw"
    }, signsX = {
        overlay: 1,
        selection: 1,
        n: null,
        e: 1,
        s: null,
        w: -1,
        nw: -1,
        ne: 1,
        se: 1,
        sw: -1
    }, signsY = {
        overlay: 1,
        selection: 1,
        n: -1,
        e: null,
        s: 1,
        w: null,
        nw: -1,
        ne: -1,
        se: 1,
        sw: 1
    };
    function type(t) {
        return {
            type: t
        };
    }
    function defaultFilter() {
        return !exports.event.button;
    }
    function defaultExtent() {
        var svg = this.ownerSVGElement || this;
        return [ [ 0, 0 ], [ svg.width.baseVal.value, svg.height.baseVal.value ] ];
    }
    function local(node) {
        for (;!node.__brush; ) if (!(node = node.parentNode)) return;
        return node.__brush;
    }
    function empty(extent) {
        return extent[0][0] === extent[1][0] || extent[0][1] === extent[1][1];
    }
    function brush$1(dim) {
        var touchending, extent = defaultExtent, filter = defaultFilter, listeners = dispatch(brush, "start", "brush", "end"), handleSize = 6;
        function brush(group) {
            var overlay = group.property("__brush", initialize).selectAll(".overlay").data([ type("overlay") ]);
            overlay.enter().append("rect").attr("class", "overlay").attr("pointer-events", "all").attr("cursor", cursors.overlay).merge(overlay).each(function() {
                var extent = local(this).extent;
                select(this).attr("x", extent[0][0]).attr("y", extent[0][1]).attr("width", extent[1][0] - extent[0][0]).attr("height", extent[1][1] - extent[0][1]);
            }), group.selectAll(".selection").data([ type("selection") ]).enter().append("rect").attr("class", "selection").attr("cursor", cursors.selection).attr("fill", "#777").attr("fill-opacity", .3).attr("stroke", "#fff").attr("shape-rendering", "crispEdges");
            var handle = group.selectAll(".handle").data(dim.handles, function(d) {
                return d.type;
            });
            handle.exit().remove(), handle.enter().append("rect").attr("class", function(d) {
                return "handle handle--" + d.type;
            }).attr("cursor", function(d) {
                return cursors[d.type];
            }), group.each(redraw).attr("fill", "none").attr("pointer-events", "all").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)").on("mousedown.brush touchstart.brush", started);
        }
        function redraw() {
            var group = select(this), selection = local(this).selection;
            selection ? (group.selectAll(".selection").style("display", null).attr("x", selection[0][0]).attr("y", selection[0][1]).attr("width", selection[1][0] - selection[0][0]).attr("height", selection[1][1] - selection[0][1]), 
            group.selectAll(".handle").style("display", null).attr("x", function(d) {
                return "e" === d.type[d.type.length - 1] ? selection[1][0] - handleSize / 2 : selection[0][0] - handleSize / 2;
            }).attr("y", function(d) {
                return "s" === d.type[0] ? selection[1][1] - handleSize / 2 : selection[0][1] - handleSize / 2;
            }).attr("width", function(d) {
                return "n" === d.type || "s" === d.type ? selection[1][0] - selection[0][0] + handleSize : handleSize;
            }).attr("height", function(d) {
                return "e" === d.type || "w" === d.type ? selection[1][1] - selection[0][1] + handleSize : handleSize;
            })) : group.selectAll(".selection,.handle").style("display", "none").attr("x", null).attr("y", null).attr("width", null).attr("height", null);
        }
        function emitter(that, args) {
            return that.__brush.emitter || new Emitter(that, args);
        }
        function Emitter(that, args) {
            this.that = that, this.args = args, this.state = that.__brush, this.active = 0;
        }
        function started() {
            if (exports.event.touches) {
                if (exports.event.changedTouches.length < exports.event.touches.length) return noevent$1();
            } else if (touchending) return;
            if (filter.apply(this, arguments)) {
                var w0, w1, n0, n1, e0, e1, s0, s1, dx, dy, moving, lockX, lockY, that = this, type = exports.event.target.__data__.type, mode = "selection" === (exports.event.metaKey ? type = "overlay" : type) ? MODE_DRAG : exports.event.altKey ? MODE_CENTER : MODE_HANDLE, signX = dim === Y ? null : signsX[type], signY = dim === X ? null : signsY[type], state = local(that), extent = state.extent, selection = state.selection, W = extent[0][0], N = extent[0][1], E = extent[1][0], S = extent[1][1], shifting = signX && signY && exports.event.shiftKey, point0 = mouse(that), point = point0, emit = emitter(that, arguments).beforestart();
                "overlay" === type ? state.selection = selection = [ [ w0 = dim === Y ? W : point0[0], n0 = dim === X ? N : point0[1] ], [ e0 = dim === Y ? E : w0, s0 = dim === X ? S : n0 ] ] : (w0 = selection[0][0], 
                n0 = selection[0][1], e0 = selection[1][0], s0 = selection[1][1]), w1 = w0, n1 = n0, 
                e1 = e0, s1 = s0;
                var group = select(that).attr("pointer-events", "none"), overlay = group.selectAll(".overlay").attr("cursor", cursors[type]);
                if (exports.event.touches) group.on("touchmove.brush", moved, !0).on("touchend.brush touchcancel.brush", ended, !0); else {
                    var view = select(exports.event.view).on("keydown.brush", function() {
                        switch (exports.event.keyCode) {
                          case 16:
                            shifting = signX && signY;
                            break;

                          case 18:
                            mode === MODE_HANDLE && (signX && (e0 = e1 - dx * signX, w0 = w1 + dx * signX), 
                            signY && (s0 = s1 - dy * signY, n0 = n1 + dy * signY), mode = MODE_CENTER, move());
                            break;

                          case 32:
                            mode !== MODE_HANDLE && mode !== MODE_CENTER || (signX < 0 ? e0 = e1 - dx : 0 < signX && (w0 = w1 - dx), 
                            signY < 0 ? s0 = s1 - dy : 0 < signY && (n0 = n1 - dy), mode = MODE_SPACE, overlay.attr("cursor", cursors.selection), 
                            move());
                            break;

                          default:
                            return;
                        }
                        noevent$1();
                    }, !0).on("keyup.brush", function() {
                        switch (exports.event.keyCode) {
                          case 16:
                            shifting && (lockX = lockY = shifting = !1, move());
                            break;

                          case 18:
                            mode === MODE_CENTER && (signX < 0 ? e0 = e1 : 0 < signX && (w0 = w1), signY < 0 ? s0 = s1 : 0 < signY && (n0 = n1), 
                            mode = MODE_HANDLE, move());
                            break;

                          case 32:
                            mode === MODE_SPACE && (exports.event.altKey ? (signX && (e0 = e1 - dx * signX, 
                            w0 = w1 + dx * signX), signY && (s0 = s1 - dy * signY, n0 = n1 + dy * signY), mode = MODE_CENTER) : (signX < 0 ? e0 = e1 : 0 < signX && (w0 = w1), 
                            signY < 0 ? s0 = s1 : 0 < signY && (n0 = n1), mode = MODE_HANDLE), overlay.attr("cursor", cursors[type]), 
                            move());
                            break;

                          default:
                            return;
                        }
                        noevent$1();
                    }, !0).on("mousemove.brush", moved, !0).on("mouseup.brush", ended, !0);
                    dragDisable(exports.event.view);
                }
                nopropagation$1(), interrupt(that), redraw.call(that), emit.start();
            }
            function moved() {
                var point1 = mouse(that);
                !shifting || lockX || lockY || (Math.abs(point1[0] - point[0]) > Math.abs(point1[1] - point[1]) ? lockY = !0 : lockX = !0), 
                point = point1, moving = !0, noevent$1(), move();
            }
            function move() {
                var t;
                switch (dx = point[0] - point0[0], dy = point[1] - point0[1], mode) {
                  case MODE_SPACE:
                  case MODE_DRAG:
                    signX && (dx = Math.max(W - w0, Math.min(E - e0, dx)), w1 = w0 + dx, e1 = e0 + dx), 
                    signY && (dy = Math.max(N - n0, Math.min(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy);
                    break;

                  case MODE_HANDLE:
                    signX < 0 ? (dx = Math.max(W - w0, Math.min(E - w0, dx)), w1 = w0 + dx, e1 = e0) : 0 < signX && (dx = Math.max(W - e0, Math.min(E - e0, dx)), 
                    w1 = w0, e1 = e0 + dx), signY < 0 ? (dy = Math.max(N - n0, Math.min(S - n0, dy)), 
                    n1 = n0 + dy, s1 = s0) : 0 < signY && (dy = Math.max(N - s0, Math.min(S - s0, dy)), 
                    n1 = n0, s1 = s0 + dy);
                    break;

                  case MODE_CENTER:
                    signX && (w1 = Math.max(W, Math.min(E, w0 - dx * signX)), e1 = Math.max(W, Math.min(E, e0 + dx * signX))), 
                    signY && (n1 = Math.max(N, Math.min(S, n0 - dy * signY)), s1 = Math.max(N, Math.min(S, s0 + dy * signY)));
                }
                e1 < w1 && (signX *= -1, t = w0, w0 = e0, e0 = t, t = w1, w1 = e1, e1 = t, type in flipX && overlay.attr("cursor", cursors[type = flipX[type]])), 
                s1 < n1 && (signY *= -1, t = n0, n0 = s0, s0 = t, t = n1, n1 = s1, s1 = t, type in flipY && overlay.attr("cursor", cursors[type = flipY[type]])), 
                state.selection && (selection = state.selection), lockX && (w1 = selection[0][0], 
                e1 = selection[1][0]), lockY && (n1 = selection[0][1], s1 = selection[1][1]), selection[0][0] === w1 && selection[0][1] === n1 && selection[1][0] === e1 && selection[1][1] === s1 || (state.selection = [ [ w1, n1 ], [ e1, s1 ] ], 
                redraw.call(that), emit.brush());
            }
            function ended() {
                if (nopropagation$1(), exports.event.touches) {
                    if (exports.event.touches.length) return;
                    touchending && clearTimeout(touchending), touchending = setTimeout(function() {
                        touchending = null;
                    }, 500), group.on("touchmove.brush touchend.brush touchcancel.brush", null);
                } else yesdrag(exports.event.view, moving), view.on("keydown.brush keyup.brush mousemove.brush mouseup.brush", null);
                group.attr("pointer-events", "all"), overlay.attr("cursor", cursors.overlay), state.selection && (selection = state.selection), 
                empty(selection) && (state.selection = null, redraw.call(that)), emit.end();
            }
        }
        function initialize() {
            var state = this.__brush || {
                selection: null
            };
            return state.extent = extent.apply(this, arguments), state.dim = dim, state;
        }
        return brush.move = function(group, selection) {
            group.selection ? group.on("start.brush", function() {
                emitter(this, arguments).beforestart().start();
            }).on("interrupt.brush end.brush", function() {
                emitter(this, arguments).end();
            }).tween("brush", function() {
                var that = this, state = that.__brush, emit = emitter(that, arguments), selection0 = state.selection, selection1 = dim.input("function" == typeof selection ? selection.apply(this, arguments) : selection, state.extent), i = interpolateValue(selection0, selection1);
                function tween(t) {
                    state.selection = 1 === t && empty(selection1) ? null : i(t), redraw.call(that), 
                    emit.brush();
                }
                return selection0 && selection1 ? tween : tween(1);
            }) : group.each(function() {
                var args = arguments, state = this.__brush, selection1 = dim.input("function" == typeof selection ? selection.apply(this, args) : selection, state.extent), emit = emitter(this, args).beforestart();
                interrupt(this), state.selection = null == selection1 || empty(selection1) ? null : selection1, 
                redraw.call(this), emit.start().brush().end();
            });
        }, Emitter.prototype = {
            beforestart: function() {
                return 1 == ++this.active && ((this.state.emitter = this).starting = !0), this;
            },
            start: function() {
                return this.starting && (this.starting = !1, this.emit("start")), this;
            },
            brush: function() {
                return this.emit("brush"), this;
            },
            end: function() {
                return 0 == --this.active && (delete this.state.emitter, this.emit("end")), this;
            },
            emit: function(type) {
                customEvent(new BrushEvent(brush, type, dim.output(this.state.selection)), listeners.apply, listeners, [ type, this.that, this.args ]);
            }
        }, brush.extent = function(_) {
            return arguments.length ? (extent = "function" == typeof _ ? _ : constant$4([ [ +_[0][0], +_[0][1] ], [ +_[1][0], +_[1][1] ] ]), 
            brush) : extent;
        }, brush.filter = function(_) {
            return arguments.length ? (filter = "function" == typeof _ ? _ : constant$4(!!_), 
            brush) : filter;
        }, brush.handleSize = function(_) {
            return arguments.length ? (handleSize = +_, brush) : handleSize;
        }, brush.on = function() {
            var value = listeners.on.apply(listeners, arguments);
            return value === listeners ? brush : value;
        }, brush;
    }
    var cos = Math.cos, sin = Math.sin, pi$1 = Math.PI, halfPi$1 = pi$1 / 2, tau$1 = 2 * pi$1, max$1 = Math.max;
    var slice$2 = Array.prototype.slice;
    function constant$5(x) {
        return function() {
            return x;
        };
    }
    var pi$2 = Math.PI, tau$2 = 2 * pi$2, tauEpsilon = tau$2 - 1e-6;
    function Path() {
        this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "";
    }
    function path() {
        return new Path();
    }
    function defaultSource(d) {
        return d.source;
    }
    function defaultTarget(d) {
        return d.target;
    }
    function defaultRadius(d) {
        return d.radius;
    }
    function defaultStartAngle(d) {
        return d.startAngle;
    }
    function defaultEndAngle(d) {
        return d.endAngle;
    }
    Path.prototype = path.prototype = {
        constructor: Path,
        moveTo: function(x, y) {
            this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y);
        },
        closePath: function() {
            null !== this._x1 && (this._x1 = this._x0, this._y1 = this._y0, this._ += "Z");
        },
        lineTo: function(x, y) {
            this._ += "L" + (this._x1 = +x) + "," + (this._y1 = +y);
        },
        quadraticCurveTo: function(x1, y1, x, y) {
            this._ += "Q" + +x1 + "," + +y1 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
        },
        bezierCurveTo: function(x1, y1, x2, y2, x, y) {
            this._ += "C" + +x1 + "," + +y1 + "," + +x2 + "," + +y2 + "," + (this._x1 = +x) + "," + (this._y1 = +y);
        },
        arcTo: function(x1, y1, x2, y2, r) {
            x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
            var x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
            if (r < 0) throw new Error("negative radius: " + r);
            if (null === this._x1) this._ += "M" + (this._x1 = x1) + "," + (this._y1 = y1); else if (1e-6 < l01_2) if (1e-6 < Math.abs(y01 * x21 - y21 * x01) && r) {
                var x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi$2 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;
                1e-6 < Math.abs(t01 - 1) && (this._ += "L" + (x1 + t01 * x01) + "," + (y1 + t01 * y01)), 
                this._ += "A" + r + "," + r + ",0,0," + +(x01 * y20 < y01 * x20) + "," + (this._x1 = x1 + t21 * x21) + "," + (this._y1 = y1 + t21 * y21);
            } else this._ += "L" + (this._x1 = x1) + "," + (this._y1 = y1); else ;
        },
        arc: function(x, y, r, a0, a1, ccw) {
            x = +x, y = +y;
            var dx = (r = +r) * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
            if (r < 0) throw new Error("negative radius: " + r);
            null === this._x1 ? this._ += "M" + x0 + "," + y0 : (1e-6 < Math.abs(this._x1 - x0) || 1e-6 < Math.abs(this._y1 - y0)) && (this._ += "L" + x0 + "," + y0), 
            r && (da < 0 && (da = da % tau$2 + tau$2), tauEpsilon < da ? this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x - dx) + "," + (y - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x0) + "," + (this._y1 = y0) : 1e-6 < da && (this._ += "A" + r + "," + r + ",0," + +(pi$2 <= da) + "," + cw + "," + (this._x1 = x + r * Math.cos(a1)) + "," + (this._y1 = y + r * Math.sin(a1))));
        },
        rect: function(x, y, w, h) {
            this._ += "M" + (this._x0 = this._x1 = +x) + "," + (this._y0 = this._y1 = +y) + "h" + +w + "v" + +h + "h" + -w + "Z";
        },
        toString: function() {
            return this._;
        }
    };
    function Map() {}
    function map$1(object, f) {
        var map = new Map();
        if (object instanceof Map) object.each(function(value, key) {
            map.set(key, value);
        }); else if (Array.isArray(object)) {
            var o, i = -1, n = object.length;
            if (null == f) for (;++i < n; ) map.set(i, object[i]); else for (;++i < n; ) map.set(f(o = object[i], i, object), o);
        } else if (object) for (var key in object) map.set(key, object[key]);
        return map;
    }
    function createObject() {
        return {};
    }
    function setObject(object, key, value) {
        object[key] = value;
    }
    function createMap() {
        return map$1();
    }
    function setMap(map, key, value) {
        map.set(key, value);
    }
    function Set() {}
    Map.prototype = map$1.prototype = {
        constructor: Map,
        has: function(key) {
            return "$" + key in this;
        },
        get: function(key) {
            return this["$" + key];
        },
        set: function(key, value) {
            return this["$" + key] = value, this;
        },
        remove: function(key) {
            var property = "$" + key;
            return property in this && delete this[property];
        },
        clear: function() {
            for (var property in this) "$" === property[0] && delete this[property];
        },
        keys: function() {
            var keys = [];
            for (var property in this) "$" === property[0] && keys.push(property.slice(1));
            return keys;
        },
        values: function() {
            var values = [];
            for (var property in this) "$" === property[0] && values.push(this[property]);
            return values;
        },
        entries: function() {
            var entries = [];
            for (var property in this) "$" === property[0] && entries.push({
                key: property.slice(1),
                value: this[property]
            });
            return entries;
        },
        size: function() {
            var size = 0;
            for (var property in this) "$" === property[0] && ++size;
            return size;
        },
        empty: function() {
            for (var property in this) if ("$" === property[0]) return !1;
            return !0;
        },
        each: function(f) {
            for (var property in this) "$" === property[0] && f(this[property], property.slice(1), this);
        }
    };
    var proto = map$1.prototype;
    function set$2(object, f) {
        var set = new Set();
        if (object instanceof Set) object.each(function(value) {
            set.add(value);
        }); else if (object) {
            var i = -1, n = object.length;
            if (null == f) for (;++i < n; ) set.add(object[i]); else for (;++i < n; ) set.add(f(object[i], i, object));
        }
        return set;
    }
    Set.prototype = set$2.prototype = {
        constructor: Set,
        has: proto.has,
        add: function(value) {
            return this["$" + (value += "")] = value, this;
        },
        remove: proto.remove,
        clear: proto.clear,
        values: proto.keys,
        size: proto.size,
        empty: proto.empty,
        each: proto.each
    };
    var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13;
    function objectConverter(columns) {
        return new Function("d", "return {" + columns.map(function(name, i) {
            return JSON.stringify(name) + ": d[" + i + "]";
        }).join(",") + "}");
    }
    function dsv(delimiter) {
        var reFormat = new RegExp('["' + delimiter + "\n\r]"), DELIMITER = delimiter.charCodeAt(0);
        function parseRows(text, f) {
            var t, rows = [], N = text.length, I = 0, n = 0, eof = N <= 0, eol = !1;
            function token() {
                if (eof) return EOF;
                if (eol) return eol = !1, EOL;
                var i, c, j = I;
                if (text.charCodeAt(j) === QUOTE) {
                    for (;I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE; ) ;
                    return (i = I) >= N ? eof = !0 : (c = text.charCodeAt(I++)) === NEWLINE ? eol = !0 : c === RETURN && (eol = !0, 
                    text.charCodeAt(I) === NEWLINE && ++I), text.slice(j + 1, i - 1).replace(/""/g, '"');
                }
                for (;I < N; ) {
                    if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = !0; else if (c === RETURN) eol = !0, 
                    text.charCodeAt(I) === NEWLINE && ++I; else if (c !== DELIMITER) continue;
                    return text.slice(j, i);
                }
                return eof = !0, text.slice(j, N);
            }
            for (text.charCodeAt(N - 1) === NEWLINE && --N, text.charCodeAt(N - 1) === RETURN && --N; (t = token()) !== EOF; ) {
                for (var row = []; t !== EOL && t !== EOF; ) row.push(t), t = token();
                f && null == (row = f(row, n++)) || rows.push(row);
            }
            return rows;
        }
        function formatRow(row) {
            return row.map(formatValue).join(delimiter);
        }
        function formatValue(text) {
            return null == text ? "" : reFormat.test(text += "") ? '"' + text.replace(/"/g, '""') + '"' : text;
        }
        return {
            parse: function(text, f) {
                var convert, columns, rows = parseRows(text, function(row, i) {
                    if (convert) return convert(row, i - 1);
                    columns = row, convert = f ? function(columns, f) {
                        var object = objectConverter(columns);
                        return function(row, i) {
                            return f(object(row), i, columns);
                        };
                    }(row, f) : objectConverter(row);
                });
                return rows.columns = columns || [], rows;
            },
            parseRows: parseRows,
            format: function(rows, columns) {
                return null == columns && (columns = function(rows) {
                    var columnSet = Object.create(null), columns = [];
                    return rows.forEach(function(row) {
                        for (var column in row) column in columnSet || columns.push(columnSet[column] = column);
                    }), columns;
                }(rows)), [ columns.map(formatValue).join(delimiter) ].concat(rows.map(function(row) {
                    return columns.map(function(column) {
                        return formatValue(row[column]);
                    }).join(delimiter);
                })).join("\n");
            },
            formatRows: function(rows) {
                return rows.map(formatRow).join("\n");
            }
        };
    }
    var csv = dsv(","), csvParse = csv.parse, csvParseRows = csv.parseRows, csvFormat = csv.format, csvFormatRows = csv.formatRows, tsv = dsv("\t"), tsvParse = tsv.parse, tsvParseRows = tsv.parseRows, tsvFormat = tsv.format, tsvFormatRows = tsv.formatRows;
    function constant$6(x) {
        return function() {
            return x;
        };
    }
    function jiggle() {
        return 1e-6 * (Math.random() - .5);
    }
    function add(tree, x, y, d) {
        if (isNaN(x) || isNaN(y)) return tree;
        var parent, xm, ym, xp, yp, right, bottom, i, j, node = tree._root, leaf = {
            data: d
        }, x0 = tree._x0, y0 = tree._y0, x1 = tree._x1, y1 = tree._y1;
        if (!node) return tree._root = leaf, tree;
        for (;node.length; ) if ((right = x >= (xm = (x0 + x1) / 2)) ? x0 = xm : x1 = xm, 
        (bottom = y >= (ym = (y0 + y1) / 2)) ? y0 = ym : y1 = ym, !(node = (parent = node)[i = bottom << 1 | right])) return parent[i] = leaf, 
        tree;
        if (xp = +tree._x.call(null, node.data), yp = +tree._y.call(null, node.data), x === xp && y === yp) return leaf.next = node, 
        parent ? parent[i] = leaf : tree._root = leaf, tree;
        for (;parent = parent ? parent[i] = new Array(4) : tree._root = new Array(4), (right = x >= (xm = (x0 + x1) / 2)) ? x0 = xm : x1 = xm, 
        (bottom = y >= (ym = (y0 + y1) / 2)) ? y0 = ym : y1 = ym, (i = bottom << 1 | right) == (j = (ym <= yp) << 1 | xm <= xp); ) ;
        return parent[j] = node, parent[i] = leaf, tree;
    }
    function Quad(node, x0, y0, x1, y1) {
        this.node = node, this.x0 = x0, this.y0 = y0, this.x1 = x1, this.y1 = y1;
    }
    function defaultX(d) {
        return d[0];
    }
    function defaultY(d) {
        return d[1];
    }
    function quadtree(nodes, x, y) {
        var tree = new Quadtree(null == x ? defaultX : x, null == y ? defaultY : y, NaN, NaN, NaN, NaN);
        return null == nodes ? tree : tree.addAll(nodes);
    }
    function Quadtree(x, y, x0, y0, x1, y1) {
        this._x = x, this._y = y, this._x0 = x0, this._y0 = y0, this._x1 = x1, this._y1 = y1, 
        this._root = void 0;
    }
    function leaf_copy(leaf) {
        for (var copy = {
            data: leaf.data
        }, next = copy; leaf = leaf.next; ) next = next.next = {
            data: leaf.data
        };
        return copy;
    }
    var treeProto = quadtree.prototype = Quadtree.prototype;
    function x(d) {
        return d.x + d.vx;
    }
    function y(d) {
        return d.y + d.vy;
    }
    function index(d) {
        return d.index;
    }
    function find(nodeById, nodeId) {
        var node = nodeById.get(nodeId);
        if (!node) throw new Error("missing: " + nodeId);
        return node;
    }
    function x$1(d) {
        return d.x;
    }
    function y$1(d) {
        return d.y;
    }
    treeProto.copy = function() {
        var nodes, child, copy = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node = this._root;
        if (!node) return copy;
        if (!node.length) return copy._root = leaf_copy(node), copy;
        for (nodes = [ {
            source: node,
            target: copy._root = new Array(4)
        } ]; node = nodes.pop(); ) for (var i = 0; i < 4; ++i) (child = node.source[i]) && (child.length ? nodes.push({
            source: child,
            target: node.target[i] = new Array(4)
        }) : node.target[i] = leaf_copy(child));
        return copy;
    }, treeProto.add = function(d) {
        var x = +this._x.call(null, d), y = +this._y.call(null, d);
        return add(this.cover(x, y), x, y, d);
    }, treeProto.addAll = function(data) {
        var d, i, x, y, n = data.length, xz = new Array(n), yz = new Array(n), x0 = 1 / 0, y0 = 1 / 0, x1 = -1 / 0, y1 = -1 / 0;
        for (i = 0; i < n; ++i) isNaN(x = +this._x.call(null, d = data[i])) || isNaN(y = +this._y.call(null, d)) || ((xz[i] = x) < x0 && (x0 = x), 
        x1 < x && (x1 = x), (yz[i] = y) < y0 && (y0 = y), y1 < y && (y1 = y));
        for (x1 < x0 && (x0 = this._x0, x1 = this._x1), y1 < y0 && (y0 = this._y0, y1 = this._y1), 
        this.cover(x0, y0).cover(x1, y1), i = 0; i < n; ++i) add(this, xz[i], yz[i], data[i]);
        return this;
    }, treeProto.cover = function(x, y) {
        if (isNaN(x = +x) || isNaN(y = +y)) return this;
        var x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1;
        if (isNaN(x0)) x1 = (x0 = Math.floor(x)) + 1, y1 = (y0 = Math.floor(y)) + 1; else {
            if (!(x < x0 || x1 < x || y < y0 || y1 < y)) return this;
            var parent, i, z = x1 - x0, node = this._root;
            switch (i = (y < (y0 + y1) / 2) << 1 | x < (x0 + x1) / 2) {
              case 0:
                for (;(parent = new Array(4))[i] = node, node = parent, y1 = y0 + (z *= 2), (x1 = x0 + z) < x || y1 < y; ) ;
                break;

              case 1:
                for (;(parent = new Array(4))[i] = node, node = parent, y1 = y0 + (z *= 2), x < (x0 = x1 - z) || y1 < y; ) ;
                break;

              case 2:
                for (;(parent = new Array(4))[i] = node, node = parent, y0 = y1 - (z *= 2), (x1 = x0 + z) < x || y < y0; ) ;
                break;

              case 3:
                for (;(parent = new Array(4))[i] = node, node = parent, y0 = y1 - (z *= 2), x < (x0 = x1 - z) || y < y0; ) ;
            }
            this._root && this._root.length && (this._root = node);
        }
        return this._x0 = x0, this._y0 = y0, this._x1 = x1, this._y1 = y1, this;
    }, treeProto.data = function() {
        var data = [];
        return this.visit(function(node) {
            if (!node.length) for (;data.push(node.data), node = node.next; ) ;
        }), data;
    }, treeProto.extent = function(_) {
        return arguments.length ? this.cover(+_[0][0], +_[0][1]).cover(+_[1][0], +_[1][1]) : isNaN(this._x0) ? void 0 : [ [ this._x0, this._y0 ], [ this._x1, this._y1 ] ];
    }, treeProto.find = function(x, y, radius) {
        var data, x1, y1, x2, y2, q, i, x0 = this._x0, y0 = this._y0, x3 = this._x1, y3 = this._y1, quads = [], node = this._root;
        for (node && quads.push(new Quad(node, x0, y0, x3, y3)), null == radius ? radius = 1 / 0 : (x0 = x - radius, 
        y0 = y - radius, x3 = x + radius, y3 = y + radius, radius *= radius); q = quads.pop(); ) if (!(!(node = q.node) || (x1 = q.x0) > x3 || (y1 = q.y0) > y3 || (x2 = q.x1) < x0 || (y2 = q.y1) < y0)) if (node.length) {
            var xm = (x1 + x2) / 2, ym = (y1 + y2) / 2;
            quads.push(new Quad(node[3], xm, ym, x2, y2), new Quad(node[2], x1, ym, xm, y2), new Quad(node[1], xm, y1, x2, ym), new Quad(node[0], x1, y1, xm, ym)), 
            (i = (ym <= y) << 1 | xm <= x) && (q = quads[quads.length - 1], quads[quads.length - 1] = quads[quads.length - 1 - i], 
            quads[quads.length - 1 - i] = q);
        } else {
            var dx = x - +this._x.call(null, node.data), dy = y - +this._y.call(null, node.data), d2 = dx * dx + dy * dy;
            if (d2 < radius) {
                var d = Math.sqrt(radius = d2);
                x0 = x - d, y0 = y - d, x3 = x + d, y3 = y + d, data = node.data;
            }
        }
        return data;
    }, treeProto.remove = function(d) {
        if (isNaN(x = +this._x.call(null, d)) || isNaN(y = +this._y.call(null, d))) return this;
        var parent, retainer, previous, next, x, y, xm, ym, right, bottom, i, j, node = this._root, x0 = this._x0, y0 = this._y0, x1 = this._x1, y1 = this._y1;
        if (!node) return this;
        if (node.length) for (;;) {
            if ((right = x >= (xm = (x0 + x1) / 2)) ? x0 = xm : x1 = xm, (bottom = y >= (ym = (y0 + y1) / 2)) ? y0 = ym : y1 = ym, 
            !(node = (parent = node)[i = bottom << 1 | right])) return this;
            if (!node.length) break;
            (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) && (retainer = parent, 
            j = i);
        }
        for (;node.data !== d; ) if (!(node = (previous = node).next)) return this;
        return (next = node.next) && delete node.next, previous ? next ? previous.next = next : delete previous.next : parent ? (next ? parent[i] = next : delete parent[i], 
        (node = parent[0] || parent[1] || parent[2] || parent[3]) && node === (parent[3] || parent[2] || parent[1] || parent[0]) && !node.length && (retainer ? retainer[j] = node : this._root = node)) : this._root = next, 
        this;
    }, treeProto.removeAll = function(data) {
        for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]);
        return this;
    }, treeProto.root = function() {
        return this._root;
    }, treeProto.size = function() {
        var size = 0;
        return this.visit(function(node) {
            if (!node.length) for (;++size, node = node.next; ) ;
        }), size;
    }, treeProto.visit = function(callback) {
        var q, child, x0, y0, x1, y1, quads = [], node = this._root;
        for (node && quads.push(new Quad(node, this._x0, this._y0, this._x1, this._y1)); q = quads.pop(); ) if (!callback(node = q.node, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1) && node.length) {
            var xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
            (child = node[3]) && quads.push(new Quad(child, xm, ym, x1, y1)), (child = node[2]) && quads.push(new Quad(child, x0, ym, xm, y1)), 
            (child = node[1]) && quads.push(new Quad(child, xm, y0, x1, ym)), (child = node[0]) && quads.push(new Quad(child, x0, y0, xm, ym));
        }
        return this;
    }, treeProto.visitAfter = function(callback) {
        var q, quads = [], next = [];
        for (this._root && quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); q = quads.pop(); ) {
            var node = q.node;
            if (node.length) {
                var child, x0 = q.x0, y0 = q.y0, x1 = q.x1, y1 = q.y1, xm = (x0 + x1) / 2, ym = (y0 + y1) / 2;
                (child = node[0]) && quads.push(new Quad(child, x0, y0, xm, ym)), (child = node[1]) && quads.push(new Quad(child, xm, y0, x1, ym)), 
                (child = node[2]) && quads.push(new Quad(child, x0, ym, xm, y1)), (child = node[3]) && quads.push(new Quad(child, xm, ym, x1, y1));
            }
            next.push(q);
        }
        for (;q = next.pop(); ) callback(q.node, q.x0, q.y0, q.x1, q.y1);
        return this;
    }, treeProto.x = function(_) {
        return arguments.length ? (this._x = _, this) : this._x;
    }, treeProto.y = function(_) {
        return arguments.length ? (this._y = _, this) : this._y;
    };
    var prefixExponent, initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5));
    function formatDecimal(x, p) {
        if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null;
        var i, coefficient = x.slice(0, i);
        return [ 1 < coefficient.length ? coefficient[0] + coefficient.slice(2) : coefficient, +x.slice(i + 1) ];
    }
    function exponent$1(x) {
        return (x = formatDecimal(Math.abs(x))) ? x[1] : NaN;
    }
    function formatRounded(x, p) {
        var d = formatDecimal(x, p);
        if (!d) return x + "";
        var coefficient = d[0], exponent = d[1];
        return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) : coefficient + new Array(exponent - coefficient.length + 2).join("0");
    }
    var formatTypes = {
        "": function(x, p) {
            out: for (var i1, n = (x = x.toPrecision(p)).length, i = 1, i0 = -1; i < n; ++i) switch (x[i]) {
              case ".":
                i0 = i1 = i;
                break;

              case "0":
                0 === i0 && (i0 = i), i1 = i;
                break;

              case "e":
                break out;

              default:
                0 < i0 && (i0 = 0);
            }
            return 0 < i0 ? x.slice(0, i0) + x.slice(i1 + 1) : x;
        },
        "%": function(x, p) {
            return (100 * x).toFixed(p);
        },
        b: function(x) {
            return Math.round(x).toString(2);
        },
        c: function(x) {
            return x + "";
        },
        d: function(x) {
            return Math.round(x).toString(10);
        },
        e: function(x, p) {
            return x.toExponential(p);
        },
        f: function(x, p) {
            return x.toFixed(p);
        },
        g: function(x, p) {
            return x.toPrecision(p);
        },
        o: function(x) {
            return Math.round(x).toString(8);
        },
        p: function(x, p) {
            return formatRounded(100 * x, p);
        },
        r: formatRounded,
        s: function(x, p) {
            var d = formatDecimal(x, p);
            if (!d) return x + "";
            var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = 3 * Math.max(-8, Math.min(8, Math.floor(exponent / 3)))) + 1, n = coefficient.length;
            return i === n ? coefficient : n < i ? coefficient + new Array(i - n + 1).join("0") : 0 < i ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimal(x, Math.max(0, p + i - 1))[0];
        },
        X: function(x) {
            return Math.round(x).toString(16).toUpperCase();
        },
        x: function(x) {
            return Math.round(x).toString(16);
        }
    }, re = /^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;
    function formatSpecifier(specifier) {
        return new FormatSpecifier(specifier);
    }
    function FormatSpecifier(specifier) {
        if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier);
        var match, fill = match[1] || " ", align = match[2] || ">", sign = match[3] || "-", symbol = match[4] || "", zero = !!match[5], width = match[6] && +match[6], comma = !!match[7], precision = match[8] && +match[8].slice(1), type = match[9] || "";
        "n" === type ? (comma = !0, type = "g") : formatTypes[type] || (type = ""), (zero || "0" === fill && "=" === align) && (zero = !0, 
        fill = "0", align = "="), this.fill = fill, this.align = align, this.sign = sign, 
        this.symbol = symbol, this.zero = zero, this.width = width, this.comma = comma, 
        this.precision = precision, this.type = type;
    }
    function identity$3(x) {
        return x;
    }
    formatSpecifier.prototype = FormatSpecifier.prototype, FormatSpecifier.prototype.toString = function() {
        return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (null == this.width ? "" : Math.max(1, 0 | this.width)) + (this.comma ? "," : "") + (null == this.precision ? "" : "." + Math.max(0, 0 | this.precision)) + this.type;
    };
    var locale, prefixes = [ "y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y" ];
    function formatLocale(locale) {
        var grouping, thousands, group = locale.grouping && locale.thousands ? (grouping = locale.grouping, 
        thousands = locale.thousands, function(value, width) {
            for (var i = value.length, t = [], j = 0, g = grouping[0], length = 0; 0 < i && 0 < g && (width < length + g + 1 && (g = Math.max(1, width - length)), 
            t.push(value.substring(i -= g, i + g)), !((length += g + 1) > width)); ) g = grouping[j = (j + 1) % grouping.length];
            return t.reverse().join(thousands);
        }) : identity$3, currency = locale.currency, decimal = locale.decimal, numerals = locale.numerals ? function(numerals) {
            return function(value) {
                return value.replace(/[0-9]/g, function(i) {
                    return numerals[+i];
                });
            };
        }(locale.numerals) : identity$3, percent = locale.percent || "%";
        function newFormat(specifier) {
            var fill = (specifier = formatSpecifier(specifier)).fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, type = specifier.type, prefix = "$" === symbol ? currency[0] : "#" === symbol && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = "$" === symbol ? currency[1] : /[%p]/.test(type) ? percent : "", formatType = formatTypes[type], maybeSuffix = !type || /[defgprs%]/.test(type);
            function format(value) {
                var i, n, c, valuePrefix = prefix, valueSuffix = suffix;
                if ("c" === type) valueSuffix = formatType(value) + valueSuffix, value = ""; else {
                    var valueNegative = (value = +value) < 0;
                    if (value = formatType(Math.abs(value), precision), valueNegative && 0 == +value && (valueNegative = !1), 
                    valuePrefix = (valueNegative ? "(" === sign ? sign : "-" : "-" === sign || "(" === sign ? "" : sign) + valuePrefix, 
                    valueSuffix = ("s" === type ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && "(" === sign ? ")" : ""), 
                    maybeSuffix) for (i = -1, n = value.length; ++i < n; ) if ((c = value.charCodeAt(i)) < 48 || 57 < c) {
                        valueSuffix = (46 === c ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix, 
                        value = value.slice(0, i);
                        break;
                    }
                }
                comma && !zero && (value = group(value, 1 / 0));
                var length = valuePrefix.length + value.length + valueSuffix.length, padding = length < width ? new Array(width - length + 1).join(fill) : "";
                switch (comma && zero && (value = group(padding + value, padding.length ? width - valueSuffix.length : 1 / 0), 
                padding = ""), align) {
                  case "<":
                    value = valuePrefix + value + valueSuffix + padding;
                    break;

                  case "=":
                    value = valuePrefix + padding + value + valueSuffix;
                    break;

                  case "^":
                    value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length);
                    break;

                  default:
                    value = padding + valuePrefix + value + valueSuffix;
                }
                return numerals(value);
            }
            return precision = null == precision ? type ? 6 : 12 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)), 
            format.toString = function() {
                return specifier + "";
            }, format;
        }
        return {
            format: newFormat,
            formatPrefix: function(specifier, value) {
                var f = newFormat(((specifier = formatSpecifier(specifier)).type = "f", specifier)), e = 3 * Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))), k = Math.pow(10, -e), prefix = prefixes[8 + e / 3];
                return function(value) {
                    return f(k * value) + prefix;
                };
            }
        };
    }
    function defaultLocale(definition) {
        return locale = formatLocale(definition), exports.format = locale.format, exports.formatPrefix = locale.formatPrefix, 
        locale;
    }
    function precisionFixed(step) {
        return Math.max(0, -exponent$1(Math.abs(step)));
    }
    function precisionPrefix(step, value) {
        return Math.max(0, 3 * Math.max(-8, Math.min(8, Math.floor(exponent$1(value) / 3))) - exponent$1(Math.abs(step)));
    }
    function precisionRound(step, max) {
        return step = Math.abs(step), max = Math.abs(max) - step, Math.max(0, exponent$1(max) - exponent$1(step)) + 1;
    }
    function adder() {
        return new Adder();
    }
    function Adder() {
        this.reset();
    }
    defaultLocale({
        decimal: ".",
        thousands: ",",
        grouping: [ 3 ],
        currency: [ "$", "" ]
    }), Adder.prototype = {
        constructor: Adder,
        reset: function() {
            this.s = this.t = 0;
        },
        add: function(y) {
            add$1(temp, y, this.t), add$1(this, temp.s, this.s), this.s ? this.t += temp.t : this.s = temp.t;
        },
        valueOf: function() {
            return this.s;
        }
    };
    var temp = new Adder();
    function add$1(adder, a, b) {
        var x = adder.s = a + b, bv = x - a, av = x - bv;
        adder.t = a - av + (b - bv);
    }
    var epsilon$2 = 1e-6, epsilon2$1 = 1e-12, pi$3 = Math.PI, halfPi$2 = pi$3 / 2, quarterPi = pi$3 / 4, tau$3 = 2 * pi$3, degrees$1 = 180 / pi$3, radians = pi$3 / 180, abs = Math.abs, atan = Math.atan, atan2 = Math.atan2, cos$1 = Math.cos, ceil = Math.ceil, exp = Math.exp, log = Math.log, pow = Math.pow, sin$1 = Math.sin, sign = Math.sign || function(x) {
        return 0 < x ? 1 : x < 0 ? -1 : 0;
    }, sqrt = Math.sqrt, tan = Math.tan;
    function acos(x) {
        return 1 < x ? 0 : x < -1 ? pi$3 : Math.acos(x);
    }
    function asin(x) {
        return 1 < x ? halfPi$2 : x < -1 ? -halfPi$2 : Math.asin(x);
    }
    function haversin(x) {
        return (x = sin$1(x / 2)) * x;
    }
    function noop$1() {}
    function streamGeometry(geometry, stream) {
        geometry && streamGeometryType.hasOwnProperty(geometry.type) && streamGeometryType[geometry.type](geometry, stream);
    }
    var streamObjectType = {
        Feature: function(object, stream) {
            streamGeometry(object.geometry, stream);
        },
        FeatureCollection: function(object, stream) {
            for (var features = object.features, i = -1, n = features.length; ++i < n; ) streamGeometry(features[i].geometry, stream);
        }
    }, streamGeometryType = {
        Sphere: function(object, stream) {
            stream.sphere();
        },
        Point: function(object, stream) {
            object = object.coordinates, stream.point(object[0], object[1], object[2]);
        },
        MultiPoint: function(object, stream) {
            for (var coordinates = object.coordinates, i = -1, n = coordinates.length; ++i < n; ) object = coordinates[i], 
            stream.point(object[0], object[1], object[2]);
        },
        LineString: function(object, stream) {
            streamLine(object.coordinates, stream, 0);
        },
        MultiLineString: function(object, stream) {
            for (var coordinates = object.coordinates, i = -1, n = coordinates.length; ++i < n; ) streamLine(coordinates[i], stream, 0);
        },
        Polygon: function(object, stream) {
            streamPolygon(object.coordinates, stream);
        },
        MultiPolygon: function(object, stream) {
            for (var coordinates = object.coordinates, i = -1, n = coordinates.length; ++i < n; ) streamPolygon(coordinates[i], stream);
        },
        GeometryCollection: function(object, stream) {
            for (var geometries = object.geometries, i = -1, n = geometries.length; ++i < n; ) streamGeometry(geometries[i], stream);
        }
    };
    function streamLine(coordinates, stream, closed) {
        var coordinate, i = -1, n = coordinates.length - closed;
        for (stream.lineStart(); ++i < n; ) coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]);
        stream.lineEnd();
    }
    function streamPolygon(coordinates, stream) {
        var i = -1, n = coordinates.length;
        for (stream.polygonStart(); ++i < n; ) streamLine(coordinates[i], stream, 1);
        stream.polygonEnd();
    }
    function geoStream(object, stream) {
        object && streamObjectType.hasOwnProperty(object.type) ? streamObjectType[object.type](object, stream) : streamGeometry(object, stream);
    }
    var lambda00, phi00, lambda0, cosPhi0, sinPhi0, lambda0$1, phi0, lambda1, phi1, lambda2, lambda00$1, phi00$1, p0, areaRingSum = adder(), areaSum = adder(), areaStream = {
        point: noop$1,
        lineStart: noop$1,
        lineEnd: noop$1,
        polygonStart: function() {
            areaRingSum.reset(), areaStream.lineStart = areaRingStart, areaStream.lineEnd = areaRingEnd;
        },
        polygonEnd: function() {
            var areaRing = +areaRingSum;
            areaSum.add(areaRing < 0 ? tau$3 + areaRing : areaRing), this.lineStart = this.lineEnd = this.point = noop$1;
        },
        sphere: function() {
            areaSum.add(tau$3);
        }
    };
    function areaRingStart() {
        areaStream.point = areaPointFirst;
    }
    function areaRingEnd() {
        areaPoint(lambda00, phi00);
    }
    function areaPointFirst(lambda, phi) {
        areaStream.point = areaPoint, lambda00 = lambda, phi00 = phi, lambda0 = lambda *= radians, 
        cosPhi0 = cos$1(phi = (phi *= radians) / 2 + quarterPi), sinPhi0 = sin$1(phi);
    }
    function areaPoint(lambda, phi) {
        var dLambda = (lambda *= radians) - lambda0, sdLambda = 0 <= dLambda ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos$1(phi = (phi *= radians) / 2 + quarterPi), sinPhi = sin$1(phi), k = sinPhi0 * sinPhi, u = cosPhi0 * cosPhi + k * cos$1(adLambda), v = k * sdLambda * sin$1(adLambda);
        areaRingSum.add(atan2(v, u)), lambda0 = lambda, cosPhi0 = cosPhi, sinPhi0 = sinPhi;
    }
    function spherical(cartesian) {
        return [ atan2(cartesian[1], cartesian[0]), asin(cartesian[2]) ];
    }
    function cartesian(spherical) {
        var lambda = spherical[0], phi = spherical[1], cosPhi = cos$1(phi);
        return [ cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi) ];
    }
    function cartesianDot(a, b) {
        return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
    }
    function cartesianCross(a, b) {
        return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0] ];
    }
    function cartesianAddInPlace(a, b) {
        a[0] += b[0], a[1] += b[1], a[2] += b[2];
    }
    function cartesianScale(vector, k) {
        return [ vector[0] * k, vector[1] * k, vector[2] * k ];
    }
    function cartesianNormalizeInPlace(d) {
        var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]);
        d[0] /= l, d[1] /= l, d[2] /= l;
    }
    var ranges, range, W0, W1, X0, Y0, Z0, X1, Y1, Z1, X2, Y2, Z2, lambda00$2, phi00$2, x0, y0, z0, deltaSum = adder(), boundsStream = {
        point: boundsPoint,
        lineStart: boundsLineStart,
        lineEnd: boundsLineEnd,
        polygonStart: function() {
            boundsStream.point = boundsRingPoint, boundsStream.lineStart = boundsRingStart, 
            boundsStream.lineEnd = boundsRingEnd, deltaSum.reset(), areaStream.polygonStart();
        },
        polygonEnd: function() {
            areaStream.polygonEnd(), boundsStream.point = boundsPoint, boundsStream.lineStart = boundsLineStart, 
            boundsStream.lineEnd = boundsLineEnd, areaRingSum < 0 ? (lambda0$1 = -(lambda1 = 180), 
            phi0 = -(phi1 = 90)) : epsilon$2 < deltaSum ? phi1 = 90 : deltaSum < -epsilon$2 && (phi0 = -90), 
            range[0] = lambda0$1, range[1] = lambda1;
        }
    };
    function boundsPoint(lambda, phi) {
        ranges.push(range = [ lambda0$1 = lambda, lambda1 = lambda ]), phi < phi0 && (phi0 = phi), 
        phi1 < phi && (phi1 = phi);
    }
    function linePoint(lambda, phi) {
        var p = cartesian([ lambda * radians, phi * radians ]);
        if (p0) {
            var normal = cartesianCross(p0, p), inflection = cartesianCross([ normal[1], -normal[0], 0 ], normal);
            cartesianNormalizeInPlace(inflection), inflection = spherical(inflection);
            var phii, delta = lambda - lambda2, sign$$1 = 0 < delta ? 1 : -1, lambdai = inflection[0] * degrees$1 * sign$$1, antimeridian = 180 < abs(delta);
            antimeridian ^ (sign$$1 * lambda2 < lambdai && lambdai < sign$$1 * lambda) ? (phii = inflection[1] * degrees$1, 
            phi1 < phii && (phi1 = phii)) : antimeridian ^ (sign$$1 * lambda2 < (lambdai = (lambdai + 360) % 360 - 180) && lambdai < sign$$1 * lambda) ? (phii = -inflection[1] * degrees$1) < phi0 && (phi0 = phii) : (phi < phi0 && (phi0 = phi), 
            phi1 < phi && (phi1 = phi)), antimeridian ? lambda < lambda2 ? angle(lambda0$1, lambda) > angle(lambda0$1, lambda1) && (lambda1 = lambda) : angle(lambda, lambda1) > angle(lambda0$1, lambda1) && (lambda0$1 = lambda) : lambda0$1 <= lambda1 ? (lambda < lambda0$1 && (lambda0$1 = lambda), 
            lambda1 < lambda && (lambda1 = lambda)) : lambda2 < lambda ? angle(lambda0$1, lambda) > angle(lambda0$1, lambda1) && (lambda1 = lambda) : angle(lambda, lambda1) > angle(lambda0$1, lambda1) && (lambda0$1 = lambda);
        } else ranges.push(range = [ lambda0$1 = lambda, lambda1 = lambda ]);
        phi < phi0 && (phi0 = phi), phi1 < phi && (phi1 = phi), p0 = p, lambda2 = lambda;
    }
    function boundsLineStart() {
        boundsStream.point = linePoint;
    }
    function boundsLineEnd() {
        range[0] = lambda0$1, range[1] = lambda1, boundsStream.point = boundsPoint, p0 = null;
    }
    function boundsRingPoint(lambda, phi) {
        if (p0) {
            var delta = lambda - lambda2;
            deltaSum.add(180 < abs(delta) ? delta + (0 < delta ? 360 : -360) : delta);
        } else lambda00$1 = lambda, phi00$1 = phi;
        areaStream.point(lambda, phi), linePoint(lambda, phi);
    }
    function boundsRingStart() {
        areaStream.lineStart();
    }
    function boundsRingEnd() {
        boundsRingPoint(lambda00$1, phi00$1), areaStream.lineEnd(), abs(deltaSum) > epsilon$2 && (lambda0$1 = -(lambda1 = 180)), 
        range[0] = lambda0$1, range[1] = lambda1, p0 = null;
    }
    function angle(lambda0, lambda1) {
        return (lambda1 -= lambda0) < 0 ? lambda1 + 360 : lambda1;
    }
    function rangeCompare(a, b) {
        return a[0] - b[0];
    }
    function rangeContains(range, x) {
        return range[0] <= range[1] ? range[0] <= x && x <= range[1] : x < range[0] || range[1] < x;
    }
    var centroidStream = {
        sphere: noop$1,
        point: centroidPoint,
        lineStart: centroidLineStart,
        lineEnd: centroidLineEnd,
        polygonStart: function() {
            centroidStream.lineStart = centroidRingStart, centroidStream.lineEnd = centroidRingEnd;
        },
        polygonEnd: function() {
            centroidStream.lineStart = centroidLineStart, centroidStream.lineEnd = centroidLineEnd;
        }
    };
    function centroidPoint(lambda, phi) {
        lambda *= radians;
        var cosPhi = cos$1(phi *= radians);
        centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi));
    }
    function centroidPointCartesian(x, y, z) {
        X0 += (x - X0) / ++W0, Y0 += (y - Y0) / W0, Z0 += (z - Z0) / W0;
    }
    function centroidLineStart() {
        centroidStream.point = centroidLinePointFirst;
    }
    function centroidLinePointFirst(lambda, phi) {
        lambda *= radians;
        var cosPhi = cos$1(phi *= radians);
        x0 = cosPhi * cos$1(lambda), y0 = cosPhi * sin$1(lambda), z0 = sin$1(phi), centroidStream.point = centroidLinePoint, 
        centroidPointCartesian(x0, y0, z0);
    }
    function centroidLinePoint(lambda, phi) {
        lambda *= radians;
        var cosPhi = cos$1(phi *= radians), x = cosPhi * cos$1(lambda), y = cosPhi * sin$1(lambda), z = sin$1(phi), w = atan2(sqrt((w = y0 * z - z0 * y) * w + (w = z0 * x - x0 * z) * w + (w = x0 * y - y0 * x) * w), x0 * x + y0 * y + z0 * z);
        W1 += w, X1 += w * (x0 + (x0 = x)), Y1 += w * (y0 + (y0 = y)), Z1 += w * (z0 + (z0 = z)), 
        centroidPointCartesian(x0, y0, z0);
    }
    function centroidLineEnd() {
        centroidStream.point = centroidPoint;
    }
    function centroidRingStart() {
        centroidStream.point = centroidRingPointFirst;
    }
    function centroidRingEnd() {
        centroidRingPoint(lambda00$2, phi00$2), centroidStream.point = centroidPoint;
    }
    function centroidRingPointFirst(lambda, phi) {
        lambda00$2 = lambda, phi00$2 = phi, lambda *= radians, phi *= radians, centroidStream.point = centroidRingPoint;
        var cosPhi = cos$1(phi);
        x0 = cosPhi * cos$1(lambda), y0 = cosPhi * sin$1(lambda), z0 = sin$1(phi), centroidPointCartesian(x0, y0, z0);
    }
    function centroidRingPoint(lambda, phi) {
        lambda *= radians;
        var cosPhi = cos$1(phi *= radians), x = cosPhi * cos$1(lambda), y = cosPhi * sin$1(lambda), z = sin$1(phi), cx = y0 * z - z0 * y, cy = z0 * x - x0 * z, cz = x0 * y - y0 * x, m = sqrt(cx * cx + cy * cy + cz * cz), w = asin(m), v = m && -w / m;
        X2 += v * cx, Y2 += v * cy, Z2 += v * cz, W1 += w, X1 += w * (x0 + (x0 = x)), Y1 += w * (y0 + (y0 = y)), 
        Z1 += w * (z0 + (z0 = z)), centroidPointCartesian(x0, y0, z0);
    }
    function constant$7(x) {
        return function() {
            return x;
        };
    }
    function compose(a, b) {
        function compose(x, y) {
            return x = a(x, y), b(x[0], x[1]);
        }
        return a.invert && b.invert && (compose.invert = function(x, y) {
            return (x = b.invert(x, y)) && a.invert(x[0], x[1]);
        }), compose;
    }
    function rotationIdentity(lambda, phi) {
        return [ pi$3 < lambda ? lambda - tau$3 : lambda < -pi$3 ? lambda + tau$3 : lambda, phi ];
    }
    function rotateRadians(deltaLambda, deltaPhi, deltaGamma) {
        return (deltaLambda %= tau$3) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity;
    }
    function forwardRotationLambda(deltaLambda) {
        return function(lambda, phi) {
            return [ pi$3 < (lambda += deltaLambda) ? lambda - tau$3 : lambda < -pi$3 ? lambda + tau$3 : lambda, phi ];
        };
    }
    function rotationLambda(deltaLambda) {
        var rotation = forwardRotationLambda(deltaLambda);
        return rotation.invert = forwardRotationLambda(-deltaLambda), rotation;
    }
    function rotationPhiGamma(deltaPhi, deltaGamma) {
        var cosDeltaPhi = cos$1(deltaPhi), sinDeltaPhi = sin$1(deltaPhi), cosDeltaGamma = cos$1(deltaGamma), sinDeltaGamma = sin$1(deltaGamma);
        function rotation(lambda, phi) {
            var cosPhi = cos$1(phi), x = cos$1(lambda) * cosPhi, y = sin$1(lambda) * cosPhi, z = sin$1(phi), k = z * cosDeltaPhi + x * sinDeltaPhi;
            return [ atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), asin(k * cosDeltaGamma + y * sinDeltaGamma) ];
        }
        return rotation.invert = function(lambda, phi) {
            var cosPhi = cos$1(phi), x = cos$1(lambda) * cosPhi, y = sin$1(lambda) * cosPhi, z = sin$1(phi), k = z * cosDeltaGamma - y * sinDeltaGamma;
            return [ atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), asin(k * cosDeltaPhi - x * sinDeltaPhi) ];
        }, rotation;
    }
    function rotation(rotate) {
        function forward(coordinates) {
            return (coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians))[0] *= degrees$1, 
            coordinates[1] *= degrees$1, coordinates;
        }
        return rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, 2 < rotate.length ? rotate[2] * radians : 0), 
        forward.invert = function(coordinates) {
            return (coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians))[0] *= degrees$1, 
            coordinates[1] *= degrees$1, coordinates;
        }, forward;
    }
    function circleStream(stream, radius, delta, direction, t0, t1) {
        if (delta) {
            var cosRadius = cos$1(radius), sinRadius = sin$1(radius), step = direction * delta;
            null == t0 ? (t0 = radius + direction * tau$3, t1 = radius - step / 2) : (t0 = circleRadius(cosRadius, t0), 
            t1 = circleRadius(cosRadius, t1), (0 < direction ? t0 < t1 : t1 < t0) && (t0 += direction * tau$3));
            for (var point, t = t0; 0 < direction ? t1 < t : t < t1; t -= step) point = spherical([ cosRadius, -sinRadius * cos$1(t), -sinRadius * sin$1(t) ]), 
            stream.point(point[0], point[1]);
        }
    }
    function circleRadius(cosRadius, point) {
        (point = cartesian(point))[0] -= cosRadius, cartesianNormalizeInPlace(point);
        var radius = acos(-point[1]);
        return ((-point[2] < 0 ? -radius : radius) + tau$3 - epsilon$2) % tau$3;
    }
    function clipBuffer() {
        var line, lines = [];
        return {
            point: function(x, y) {
                line.push([ x, y ]);
            },
            lineStart: function() {
                lines.push(line = []);
            },
            lineEnd: noop$1,
            rejoin: function() {
                1 < lines.length && lines.push(lines.pop().concat(lines.shift()));
            },
            result: function() {
                var result = lines;
                return lines = [], line = null, result;
            }
        };
    }
    function pointEqual(a, b) {
        return abs(a[0] - b[0]) < epsilon$2 && abs(a[1] - b[1]) < epsilon$2;
    }
    function Intersection(point, points, other, entry) {
        this.x = point, this.z = points, this.o = other, this.e = entry, this.v = !1, this.n = this.p = null;
    }
    function clipRejoin(segments, compareIntersection, startInside, interpolate, stream) {
        var i, n, subject = [], clip = [];
        if (segments.forEach(function(segment) {
            if (!((n = segment.length - 1) <= 0)) {
                var n, x, p0 = segment[0], p1 = segment[n];
                if (pointEqual(p0, p1)) {
                    for (stream.lineStart(), i = 0; i < n; ++i) stream.point((p0 = segment[i])[0], p0[1]);
                    stream.lineEnd();
                } else subject.push(x = new Intersection(p0, segment, null, !0)), clip.push(x.o = new Intersection(p0, null, x, !1)), 
                subject.push(x = new Intersection(p1, segment, null, !1)), clip.push(x.o = new Intersection(p1, null, x, !0));
            }
        }), subject.length) {
            for (clip.sort(compareIntersection), link$1(subject), link$1(clip), i = 0, n = clip.length; i < n; ++i) clip[i].e = startInside = !startInside;
            for (var points, point, start = subject[0]; ;) {
                for (var current = start, isSubject = !0; current.v; ) if ((current = current.n) === start) return;
                points = current.z, stream.lineStart();
                do {
                    if (current.v = current.o.v = !0, current.e) {
                        if (isSubject) for (i = 0, n = points.length; i < n; ++i) stream.point((point = points[i])[0], point[1]); else interpolate(current.x, current.n.x, 1, stream);
                        current = current.n;
                    } else {
                        if (isSubject) for (points = current.p.z, i = points.length - 1; 0 <= i; --i) stream.point((point = points[i])[0], point[1]); else interpolate(current.x, current.p.x, -1, stream);
                        current = current.p;
                    }
                    points = (current = current.o).z, isSubject = !isSubject;
                } while (!current.v);
                stream.lineEnd();
            }
        }
    }
    function link$1(array) {
        if (n = array.length) {
            for (var n, b, i = 0, a = array[0]; ++i < n; ) a.n = b = array[i], b.p = a, a = b;
            a.n = b = array[0], b.p = a;
        }
    }
    rotationIdentity.invert = rotationIdentity;
    var sum$1 = adder();
    function polygonContains(polygon, point) {
        var lambda = point[0], phi = point[1], normal = [ sin$1(lambda), -cos$1(lambda), 0 ], angle = 0, winding = 0;
        sum$1.reset();
        for (var i = 0, n = polygon.length; i < n; ++i) if (m = (ring = polygon[i]).length) for (var ring, m, point0 = ring[m - 1], lambda0 = point0[0], phi0 = point0[1] / 2 + quarterPi, sinPhi0 = sin$1(phi0), cosPhi0 = cos$1(phi0), j = 0; j < m; ++j, 
        lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {
            var point1 = ring[j], lambda1 = point1[0], phi1 = point1[1] / 2 + quarterPi, sinPhi1 = sin$1(phi1), cosPhi1 = cos$1(phi1), delta = lambda1 - lambda0, sign$$1 = 0 <= delta ? 1 : -1, absDelta = sign$$1 * delta, antimeridian = pi$3 < absDelta, k = sinPhi0 * sinPhi1;
            if (sum$1.add(atan2(k * sign$$1 * sin$1(absDelta), cosPhi0 * cosPhi1 + k * cos$1(absDelta))), 
            angle += antimeridian ? delta + sign$$1 * tau$3 : delta, antimeridian ^ lambda <= lambda0 ^ lambda <= lambda1) {
                var arc = cartesianCross(cartesian(point0), cartesian(point1));
                cartesianNormalizeInPlace(arc);
                var intersection = cartesianCross(normal, arc);
                cartesianNormalizeInPlace(intersection);
                var phiArc = (antimeridian ^ 0 <= delta ? -1 : 1) * asin(intersection[2]);
                (phiArc < phi || phi === phiArc && (arc[0] || arc[1])) && (winding += antimeridian ^ 0 <= delta ? 1 : -1);
            }
        }
        return (angle < -epsilon$2 || angle < epsilon$2 && sum$1 < -epsilon$2) ^ 1 & winding;
    }
    function clip(pointVisible, clipLine, interpolate, start) {
        return function(sink) {
            var polygon, segments, ring, line = clipLine(sink), ringBuffer = clipBuffer(), ringSink = clipLine(ringBuffer), polygonStarted = !1, clip = {
                point: point,
                lineStart: lineStart,
                lineEnd: lineEnd,
                polygonStart: function() {
                    clip.point = pointRing, clip.lineStart = ringStart, clip.lineEnd = ringEnd, segments = [], 
                    polygon = [];
                },
                polygonEnd: function() {
                    clip.point = point, clip.lineStart = lineStart, clip.lineEnd = lineEnd, segments = merge(segments);
                    var startInside = polygonContains(polygon, start);
                    segments.length ? (polygonStarted || (sink.polygonStart(), polygonStarted = !0), 
                    clipRejoin(segments, compareIntersection, startInside, interpolate, sink)) : startInside && (polygonStarted || (sink.polygonStart(), 
                    polygonStarted = !0), sink.lineStart(), interpolate(null, null, 1, sink), sink.lineEnd()), 
                    polygonStarted && (sink.polygonEnd(), polygonStarted = !1), segments = polygon = null;
                },
                sphere: function() {
                    sink.polygonStart(), sink.lineStart(), interpolate(null, null, 1, sink), sink.lineEnd(), 
                    sink.polygonEnd();
                }
            };
            function point(lambda, phi) {
                pointVisible(lambda, phi) && sink.point(lambda, phi);
            }
            function pointLine(lambda, phi) {
                line.point(lambda, phi);
            }
            function lineStart() {
                clip.point = pointLine, line.lineStart();
            }
            function lineEnd() {
                clip.point = point, line.lineEnd();
            }
            function pointRing(lambda, phi) {
                ring.push([ lambda, phi ]), ringSink.point(lambda, phi);
            }
            function ringStart() {
                ringSink.lineStart(), ring = [];
            }
            function ringEnd() {
                pointRing(ring[0][0], ring[0][1]), ringSink.lineEnd();
                var i, m, segment, point, clean = ringSink.clean(), ringSegments = ringBuffer.result(), n = ringSegments.length;
                if (ring.pop(), polygon.push(ring), ring = null, n) if (1 & clean) {
                    if (0 < (m = (segment = ringSegments[0]).length - 1)) {
                        for (polygonStarted || (sink.polygonStart(), polygonStarted = !0), sink.lineStart(), 
                        i = 0; i < m; ++i) sink.point((point = segment[i])[0], point[1]);
                        sink.lineEnd();
                    }
                } else 1 < n && 2 & clean && ringSegments.push(ringSegments.pop().concat(ringSegments.shift())), 
                segments.push(ringSegments.filter(validSegment));
            }
            return clip;
        };
    }
    function validSegment(segment) {
        return 1 < segment.length;
    }
    function compareIntersection(a, b) {
        return ((a = a.x)[0] < 0 ? a[1] - halfPi$2 - epsilon$2 : halfPi$2 - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi$2 - epsilon$2 : halfPi$2 - b[1]);
    }
    var clipAntimeridian = clip(function() {
        return !0;
    }, function(stream) {
        var clean, lambda0 = NaN, phi0 = NaN, sign0 = NaN;
        return {
            lineStart: function() {
                stream.lineStart(), clean = 1;
            },
            point: function(lambda1, phi1) {
                var sign1 = 0 < lambda1 ? pi$3 : -pi$3, delta = abs(lambda1 - lambda0);
                abs(delta - pi$3) < epsilon$2 ? (stream.point(lambda0, phi0 = 0 < (phi0 + phi1) / 2 ? halfPi$2 : -halfPi$2), 
                stream.point(sign0, phi0), stream.lineEnd(), stream.lineStart(), stream.point(sign1, phi0), 
                stream.point(lambda1, phi0), clean = 0) : sign0 !== sign1 && pi$3 <= delta && (abs(lambda0 - sign0) < epsilon$2 && (lambda0 -= sign0 * epsilon$2), 
                abs(lambda1 - sign1) < epsilon$2 && (lambda1 -= sign1 * epsilon$2), phi0 = function(lambda0, phi0, lambda1, phi1) {
                    var cosPhi0, cosPhi1, sinLambda0Lambda1 = sin$1(lambda0 - lambda1);
                    return abs(sinLambda0Lambda1) > epsilon$2 ? atan((sin$1(phi0) * (cosPhi1 = cos$1(phi1)) * sin$1(lambda1) - sin$1(phi1) * (cosPhi0 = cos$1(phi0)) * sin$1(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2;
                }(lambda0, phi0, lambda1, phi1), stream.point(sign0, phi0), stream.lineEnd(), stream.lineStart(), 
                stream.point(sign1, phi0), clean = 0), stream.point(lambda0 = lambda1, phi0 = phi1), 
                sign0 = sign1;
            },
            lineEnd: function() {
                stream.lineEnd(), lambda0 = phi0 = NaN;
            },
            clean: function() {
                return 2 - clean;
            }
        };
    }, function(from, to, direction, stream) {
        var phi;
        if (null == from) phi = direction * halfPi$2, stream.point(-pi$3, phi), stream.point(0, phi), 
        stream.point(pi$3, phi), stream.point(pi$3, 0), stream.point(pi$3, -phi), stream.point(0, -phi), 
        stream.point(-pi$3, -phi), stream.point(-pi$3, 0), stream.point(-pi$3, phi); else if (abs(from[0] - to[0]) > epsilon$2) {
            var lambda = from[0] < to[0] ? pi$3 : -pi$3;
            phi = direction * lambda / 2, stream.point(-lambda, phi), stream.point(0, phi), 
            stream.point(lambda, phi);
        } else stream.point(to[0], to[1]);
    }, [ -pi$3, -halfPi$2 ]);
    function clipCircle(radius) {
        var cr = cos$1(radius), delta = 6 * radians, smallRadius = 0 < cr, notHemisphere = abs(cr) > epsilon$2;
        function visible(lambda, phi) {
            return cos$1(lambda) * cos$1(phi) > cr;
        }
        function intersect(a, b, two) {
            var n1 = [ 1, 0, 0 ], n2 = cartesianCross(cartesian(a), cartesian(b)), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2;
            if (!determinant) return !two && a;
            var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A = cartesianScale(n1, c1);
            cartesianAddInPlace(A, cartesianScale(n2, c2));
            var u = n1xn2, w = cartesianDot(A, u), uu = cartesianDot(u, u), t2 = w * w - uu * (cartesianDot(A, A) - 1);
            if (!(t2 < 0)) {
                var t = sqrt(t2), q = cartesianScale(u, (-w - t) / uu);
                if (cartesianAddInPlace(q, A), q = spherical(q), !two) return q;
                var z, lambda0 = a[0], lambda1 = b[0], phi0 = a[1], phi1 = b[1];
                lambda1 < lambda0 && (z = lambda0, lambda0 = lambda1, lambda1 = z);
                var delta = lambda1 - lambda0, polar = abs(delta - pi$3) < epsilon$2;
                if (!polar && phi1 < phi0 && (z = phi0, phi0 = phi1, phi1 = z), polar || delta < epsilon$2 ? polar ? 0 < phi0 + phi1 ^ q[1] < (abs(q[0] - lambda0) < epsilon$2 ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : pi$3 < delta ^ (lambda0 <= q[0] && q[0] <= lambda1)) {
                    var q1 = cartesianScale(u, (-w + t) / uu);
                    return cartesianAddInPlace(q1, A), [ q, spherical(q1) ];
                }
            }
        }
        function code(lambda, phi) {
            var r = smallRadius ? radius : pi$3 - radius, code = 0;
            return lambda < -r ? code |= 1 : r < lambda && (code |= 2), phi < -r ? code |= 4 : r < phi && (code |= 8), 
            code;
        }
        return clip(visible, function(stream) {
            var point0, c0, v0, v00, clean;
            return {
                lineStart: function() {
                    v00 = v0 = !1, clean = 1;
                },
                point: function(lambda, phi) {
                    var point2, point1 = [ lambda, phi ], v = visible(lambda, phi), c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi$3 : -pi$3), phi) : 0;
                    if (!point0 && (v00 = v0 = v) && stream.lineStart(), v !== v0 && (!(point2 = intersect(point0, point1)) || pointEqual(point0, point2) || pointEqual(point1, point2)) && (point1[0] += epsilon$2, 
                    point1[1] += epsilon$2, v = visible(point1[0], point1[1])), v !== v0) clean = 0, 
                    v ? (stream.lineStart(), point2 = intersect(point1, point0), stream.point(point2[0], point2[1])) : (point2 = intersect(point0, point1), 
                    stream.point(point2[0], point2[1]), stream.lineEnd()), point0 = point2; else if (notHemisphere && point0 && smallRadius ^ v) {
                        var t;
                        c & c0 || !(t = intersect(point1, point0, !0)) || (clean = 0, smallRadius ? (stream.lineStart(), 
                        stream.point(t[0][0], t[0][1]), stream.point(t[1][0], t[1][1]), stream.lineEnd()) : (stream.point(t[1][0], t[1][1]), 
                        stream.lineEnd(), stream.lineStart(), stream.point(t[0][0], t[0][1])));
                    }
                    !v || point0 && pointEqual(point0, point1) || stream.point(point1[0], point1[1]), 
                    point0 = point1, v0 = v, c0 = c;
                },
                lineEnd: function() {
                    v0 && stream.lineEnd(), point0 = null;
                },
                clean: function() {
                    return clean | (v00 && v0) << 1;
                }
            };
        }, function(from, to, direction, stream) {
            circleStream(stream, radius, delta, direction, from, to);
        }, smallRadius ? [ 0, -radius ] : [ -pi$3, radius - pi$3 ]);
    }
    var clipMax = 1e9, clipMin = -clipMax;
    function clipRectangle(x0, y0, x1, y1) {
        function visible(x, y) {
            return x0 <= x && x <= x1 && y0 <= y && y <= y1;
        }
        function interpolate(from, to, direction, stream) {
            var a = 0, a1 = 0;
            if (null == from || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ 0 < direction) for (;stream.point(0 === a || 3 === a ? x0 : x1, 1 < a ? y1 : y0), 
            (a = (a + direction + 4) % 4) !== a1; ) ; else stream.point(to[0], to[1]);
        }
        function corner(p, direction) {
            return abs(p[0] - x0) < epsilon$2 ? 0 < direction ? 0 : 3 : abs(p[0] - x1) < epsilon$2 ? 0 < direction ? 2 : 1 : abs(p[1] - y0) < epsilon$2 ? 0 < direction ? 1 : 0 : 0 < direction ? 3 : 2;
        }
        function compareIntersection(a, b) {
            return comparePoint(a.x, b.x);
        }
        function comparePoint(a, b) {
            var ca = corner(a, 1), cb = corner(b, 1);
            return ca !== cb ? ca - cb : 0 === ca ? b[1] - a[1] : 1 === ca ? a[0] - b[0] : 2 === ca ? a[1] - b[1] : b[0] - a[0];
        }
        return function(stream) {
            var segments, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean, activeStream = stream, bufferStream = clipBuffer(), clipStream = {
                point: point,
                lineStart: function() {
                    clipStream.point = linePoint, polygon && polygon.push(ring = []);
                    first = !0, v_ = !1, x_ = y_ = NaN;
                },
                lineEnd: function() {
                    segments && (linePoint(x__, y__), v__ && v_ && bufferStream.rejoin(), segments.push(bufferStream.result()));
                    clipStream.point = point, v_ && activeStream.lineEnd();
                },
                polygonStart: function() {
                    activeStream = bufferStream, segments = [], polygon = [], clean = !0;
                },
                polygonEnd: function() {
                    var startInside = function() {
                        for (var winding = 0, i = 0, n = polygon.length; i < n; ++i) for (var a0, a1, ring = polygon[i], j = 1, m = ring.length, point = ring[0], b0 = point[0], b1 = point[1]; j < m; ++j) a0 = b0, 
                        a1 = b1, point = ring[j], b0 = point[0], b1 = point[1], a1 <= y1 ? y1 < b1 && (b1 - a1) * (x0 - a0) < (b0 - a0) * (y1 - a1) && ++winding : b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0) && --winding;
                        return winding;
                    }(), cleanInside = clean && startInside, visible = (segments = merge(segments)).length;
                    (cleanInside || visible) && (stream.polygonStart(), cleanInside && (stream.lineStart(), 
                    interpolate(null, null, 1, stream), stream.lineEnd()), visible && clipRejoin(segments, compareIntersection, startInside, interpolate, stream), 
                    stream.polygonEnd());
                    activeStream = stream, segments = polygon = ring = null;
                }
            };
            function point(x, y) {
                visible(x, y) && activeStream.point(x, y);
            }
            function linePoint(x, y) {
                var v = visible(x, y);
                if (polygon && ring.push([ x, y ]), first) x__ = x, y__ = y, first = !1, (v__ = v) && (activeStream.lineStart(), 
                activeStream.point(x, y)); else if (v && v_) activeStream.point(x, y); else {
                    var a = [ x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_)) ], b = [ x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y)) ];
                    !function(a, b, x0, y0, x1, y1) {
                        var r, ax = a[0], ay = a[1], t0 = 0, t1 = 1, dx = b[0] - ax, dy = b[1] - ay;
                        if (r = x0 - ax, dx || !(0 < r)) {
                            if (r /= dx, dx < 0) {
                                if (r < t0) return;
                                r < t1 && (t1 = r);
                            } else if (0 < dx) {
                                if (t1 < r) return;
                                t0 < r && (t0 = r);
                            }
                            if (r = x1 - ax, dx || !(r < 0)) {
                                if (r /= dx, dx < 0) {
                                    if (t1 < r) return;
                                    t0 < r && (t0 = r);
                                } else if (0 < dx) {
                                    if (r < t0) return;
                                    r < t1 && (t1 = r);
                                }
                                if (r = y0 - ay, dy || !(0 < r)) {
                                    if (r /= dy, dy < 0) {
                                        if (r < t0) return;
                                        r < t1 && (t1 = r);
                                    } else if (0 < dy) {
                                        if (t1 < r) return;
                                        t0 < r && (t0 = r);
                                    }
                                    if (r = y1 - ay, dy || !(r < 0)) {
                                        if (r /= dy, dy < 0) {
                                            if (t1 < r) return;
                                            t0 < r && (t0 = r);
                                        } else if (0 < dy) {
                                            if (r < t0) return;
                                            r < t1 && (t1 = r);
                                        }
                                        return 0 < t0 && (a[0] = ax + t0 * dx, a[1] = ay + t0 * dy), t1 < 1 && (b[0] = ax + t1 * dx, 
                                        b[1] = ay + t1 * dy), !0;
                                    }
                                }
                            }
                        }
                    }(a, b, x0, y0, x1, y1) ? v && (activeStream.lineStart(), activeStream.point(x, y), 
                    clean = !1) : (v_ || (activeStream.lineStart(), activeStream.point(a[0], a[1])), 
                    activeStream.point(b[0], b[1]), v || activeStream.lineEnd(), clean = !1);
                }
                x_ = x, y_ = y, v_ = v;
            }
            return clipStream;
        };
    }
    var lambda0$2, sinPhi0$1, cosPhi0$1, lengthSum = adder(), lengthStream = {
        sphere: noop$1,
        point: noop$1,
        lineStart: function() {
            lengthStream.point = lengthPointFirst, lengthStream.lineEnd = lengthLineEnd;
        },
        lineEnd: noop$1,
        polygonStart: noop$1,
        polygonEnd: noop$1
    };
    function lengthLineEnd() {
        lengthStream.point = lengthStream.lineEnd = noop$1;
    }
    function lengthPointFirst(lambda, phi) {
        lambda0$2 = lambda *= radians, sinPhi0$1 = sin$1(phi *= radians), cosPhi0$1 = cos$1(phi), 
        lengthStream.point = lengthPoint;
    }
    function lengthPoint(lambda, phi) {
        lambda *= radians;
        var sinPhi = sin$1(phi *= radians), cosPhi = cos$1(phi), delta = abs(lambda - lambda0$2), cosDelta = cos$1(delta), x = cosPhi * sin$1(delta), y = cosPhi0$1 * sinPhi - sinPhi0$1 * cosPhi * cosDelta, z = sinPhi0$1 * sinPhi + cosPhi0$1 * cosPhi * cosDelta;
        lengthSum.add(atan2(sqrt(x * x + y * y), z)), lambda0$2 = lambda, sinPhi0$1 = sinPhi, 
        cosPhi0$1 = cosPhi;
    }
    function length$1(object) {
        return lengthSum.reset(), geoStream(object, lengthStream), +lengthSum;
    }
    var coordinates = [ null, null ], object$1 = {
        type: "LineString",
        coordinates: coordinates
    };
    function distance(a, b) {
        return coordinates[0] = a, coordinates[1] = b, length$1(object$1);
    }
    var containsObjectType = {
        Feature: function(object, point) {
            return containsGeometry(object.geometry, point);
        },
        FeatureCollection: function(object, point) {
            for (var features = object.features, i = -1, n = features.length; ++i < n; ) if (containsGeometry(features[i].geometry, point)) return !0;
            return !1;
        }
    }, containsGeometryType = {
        Sphere: function() {
            return !0;
        },
        Point: function(object, point) {
            return containsPoint(object.coordinates, point);
        },
        MultiPoint: function(object, point) {
            for (var coordinates = object.coordinates, i = -1, n = coordinates.length; ++i < n; ) if (containsPoint(coordinates[i], point)) return !0;
            return !1;
        },
        LineString: function(object, point) {
            return containsLine(object.coordinates, point);
        },
        MultiLineString: function(object, point) {
            for (var coordinates = object.coordinates, i = -1, n = coordinates.length; ++i < n; ) if (containsLine(coordinates[i], point)) return !0;
            return !1;
        },
        Polygon: function(object, point) {
            return containsPolygon(object.coordinates, point);
        },
        MultiPolygon: function(object, point) {
            for (var coordinates = object.coordinates, i = -1, n = coordinates.length; ++i < n; ) if (containsPolygon(coordinates[i], point)) return !0;
            return !1;
        },
        GeometryCollection: function(object, point) {
            for (var geometries = object.geometries, i = -1, n = geometries.length; ++i < n; ) if (containsGeometry(geometries[i], point)) return !0;
            return !1;
        }
    };
    function containsGeometry(geometry, point) {
        return !(!geometry || !containsGeometryType.hasOwnProperty(geometry.type)) && containsGeometryType[geometry.type](geometry, point);
    }
    function containsPoint(coordinates, point) {
        return 0 === distance(coordinates, point);
    }
    function containsLine(coordinates, point) {
        var ab = distance(coordinates[0], coordinates[1]);
        return distance(coordinates[0], point) + distance(point, coordinates[1]) <= ab + epsilon$2;
    }
    function containsPolygon(coordinates, point) {
        return !!polygonContains(coordinates.map(ringRadians), pointRadians(point));
    }
    function ringRadians(ring) {
        return (ring = ring.map(pointRadians)).pop(), ring;
    }
    function pointRadians(point) {
        return [ point[0] * radians, point[1] * radians ];
    }
    function graticuleX(y0, y1, dy) {
        var y = sequence(y0, y1 - epsilon$2, dy).concat(y1);
        return function(x) {
            return y.map(function(y) {
                return [ x, y ];
            });
        };
    }
    function graticuleY(x0, x1, dx) {
        var x = sequence(x0, x1 - epsilon$2, dx).concat(x1);
        return function(y) {
            return x.map(function(x) {
                return [ x, y ];
            });
        };
    }
    function graticule() {
        var x1, x0, X1, X0, y1, y0, Y1, Y0, x, y, X, Y, dx = 10, dy = dx, DX = 90, DY = 360, precision = 2.5;
        function graticule() {
            return {
                type: "MultiLineString",
                coordinates: lines()
            };
        }
        function lines() {
            return sequence(ceil(X0 / DX) * DX, X1, DX).map(X).concat(sequence(ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(sequence(ceil(x0 / dx) * dx, x1, dx).filter(function(x) {
                return abs(x % DX) > epsilon$2;
            }).map(x)).concat(sequence(ceil(y0 / dy) * dy, y1, dy).filter(function(y) {
                return abs(y % DY) > epsilon$2;
            }).map(y));
        }
        return graticule.lines = function() {
            return lines().map(function(coordinates) {
                return {
                    type: "LineString",
                    coordinates: coordinates
                };
            });
        }, graticule.outline = function() {
            return {
                type: "Polygon",
                coordinates: [ X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1)) ]
            };
        }, graticule.extent = function(_) {
            return arguments.length ? graticule.extentMajor(_).extentMinor(_) : graticule.extentMinor();
        }, graticule.extentMajor = function(_) {
            return arguments.length ? (X0 = +_[0][0], X1 = +_[1][0], Y0 = +_[0][1], Y1 = +_[1][1], 
            X1 < X0 && (_ = X0, X0 = X1, X1 = _), Y1 < Y0 && (_ = Y0, Y0 = Y1, Y1 = _), graticule.precision(precision)) : [ [ X0, Y0 ], [ X1, Y1 ] ];
        }, graticule.extentMinor = function(_) {
            return arguments.length ? (x0 = +_[0][0], x1 = +_[1][0], y0 = +_[0][1], y1 = +_[1][1], 
            x1 < x0 && (_ = x0, x0 = x1, x1 = _), y1 < y0 && (_ = y0, y0 = y1, y1 = _), graticule.precision(precision)) : [ [ x0, y0 ], [ x1, y1 ] ];
        }, graticule.step = function(_) {
            return arguments.length ? graticule.stepMajor(_).stepMinor(_) : graticule.stepMinor();
        }, graticule.stepMajor = function(_) {
            return arguments.length ? (DX = +_[0], DY = +_[1], graticule) : [ DX, DY ];
        }, graticule.stepMinor = function(_) {
            return arguments.length ? (dx = +_[0], dy = +_[1], graticule) : [ dx, dy ];
        }, graticule.precision = function(_) {
            return arguments.length ? (precision = +_, x = graticuleX(y0, y1, 90), y = graticuleY(x0, x1, precision), 
            X = graticuleX(Y0, Y1, 90), Y = graticuleY(X0, X1, precision), graticule) : precision;
        }, graticule.extentMajor([ [ -180, -90 + epsilon$2 ], [ 180, 90 - epsilon$2 ] ]).extentMinor([ [ -180, -80 - epsilon$2 ], [ 180, 80 + epsilon$2 ] ]);
    }
    function identity$4(x) {
        return x;
    }
    var x00, y00, x0$1, y0$1, areaSum$1 = adder(), areaRingSum$1 = adder(), areaStream$1 = {
        point: noop$1,
        lineStart: noop$1,
        lineEnd: noop$1,
        polygonStart: function() {
            areaStream$1.lineStart = areaRingStart$1, areaStream$1.lineEnd = areaRingEnd$1;
        },
        polygonEnd: function() {
            areaStream$1.lineStart = areaStream$1.lineEnd = areaStream$1.point = noop$1, areaSum$1.add(abs(areaRingSum$1)), 
            areaRingSum$1.reset();
        },
        result: function() {
            var area = areaSum$1 / 2;
            return areaSum$1.reset(), area;
        }
    };
    function areaRingStart$1() {
        areaStream$1.point = areaPointFirst$1;
    }
    function areaPointFirst$1(x, y) {
        areaStream$1.point = areaPoint$1, x00 = x0$1 = x, y00 = y0$1 = y;
    }
    function areaPoint$1(x, y) {
        areaRingSum$1.add(y0$1 * x - x0$1 * y), x0$1 = x, y0$1 = y;
    }
    function areaRingEnd$1() {
        areaPoint$1(x00, y00);
    }
    var x0$2 = 1 / 0, y0$2 = x0$2, x1 = -x0$2, y1 = x1, boundsStream$1 = {
        point: function(x, y) {
            x < x0$2 && (x0$2 = x);
            x1 < x && (x1 = x);
            y < y0$2 && (y0$2 = y);
            y1 < y && (y1 = y);
        },
        lineStart: noop$1,
        lineEnd: noop$1,
        polygonStart: noop$1,
        polygonEnd: noop$1,
        result: function() {
            var bounds = [ [ x0$2, y0$2 ], [ x1, y1 ] ];
            return x1 = y1 = -(y0$2 = x0$2 = 1 / 0), bounds;
        }
    };
    var x00$1, y00$1, x0$3, y0$3, X0$1 = 0, Y0$1 = 0, Z0$1 = 0, X1$1 = 0, Y1$1 = 0, Z1$1 = 0, X2$1 = 0, Y2$1 = 0, Z2$1 = 0, centroidStream$1 = {
        point: centroidPoint$1,
        lineStart: centroidLineStart$1,
        lineEnd: centroidLineEnd$1,
        polygonStart: function() {
            centroidStream$1.lineStart = centroidRingStart$1, centroidStream$1.lineEnd = centroidRingEnd$1;
        },
        polygonEnd: function() {
            centroidStream$1.point = centroidPoint$1, centroidStream$1.lineStart = centroidLineStart$1, 
            centroidStream$1.lineEnd = centroidLineEnd$1;
        },
        result: function() {
            var centroid = Z2$1 ? [ X2$1 / Z2$1, Y2$1 / Z2$1 ] : Z1$1 ? [ X1$1 / Z1$1, Y1$1 / Z1$1 ] : Z0$1 ? [ X0$1 / Z0$1, Y0$1 / Z0$1 ] : [ NaN, NaN ];
            return X0$1 = Y0$1 = Z0$1 = X1$1 = Y1$1 = Z1$1 = X2$1 = Y2$1 = Z2$1 = 0, centroid;
        }
    };
    function centroidPoint$1(x, y) {
        X0$1 += x, Y0$1 += y, ++Z0$1;
    }
    function centroidLineStart$1() {
        centroidStream$1.point = centroidPointFirstLine;
    }
    function centroidPointFirstLine(x, y) {
        centroidStream$1.point = centroidPointLine, centroidPoint$1(x0$3 = x, y0$3 = y);
    }
    function centroidPointLine(x, y) {
        var dx = x - x0$3, dy = y - y0$3, z = sqrt(dx * dx + dy * dy);
        X1$1 += z * (x0$3 + x) / 2, Y1$1 += z * (y0$3 + y) / 2, Z1$1 += z, centroidPoint$1(x0$3 = x, y0$3 = y);
    }
    function centroidLineEnd$1() {
        centroidStream$1.point = centroidPoint$1;
    }
    function centroidRingStart$1() {
        centroidStream$1.point = centroidPointFirstRing;
    }
    function centroidRingEnd$1() {
        centroidPointRing(x00$1, y00$1);
    }
    function centroidPointFirstRing(x, y) {
        centroidStream$1.point = centroidPointRing, centroidPoint$1(x00$1 = x0$3 = x, y00$1 = y0$3 = y);
    }
    function centroidPointRing(x, y) {
        var dx = x - x0$3, dy = y - y0$3, z = sqrt(dx * dx + dy * dy);
        X1$1 += z * (x0$3 + x) / 2, Y1$1 += z * (y0$3 + y) / 2, Z1$1 += z, X2$1 += (z = y0$3 * x - x0$3 * y) * (x0$3 + x), 
        Y2$1 += z * (y0$3 + y), Z2$1 += 3 * z, centroidPoint$1(x0$3 = x, y0$3 = y);
    }
    function PathContext(context) {
        this._context = context;
    }
    PathContext.prototype = {
        _radius: 4.5,
        pointRadius: function(_) {
            return this._radius = _, this;
        },
        polygonStart: function() {
            this._line = 0;
        },
        polygonEnd: function() {
            this._line = NaN;
        },
        lineStart: function() {
            this._point = 0;
        },
        lineEnd: function() {
            0 === this._line && this._context.closePath(), this._point = NaN;
        },
        point: function(x, y) {
            switch (this._point) {
              case 0:
                this._context.moveTo(x, y), this._point = 1;
                break;

              case 1:
                this._context.lineTo(x, y);
                break;

              default:
                this._context.moveTo(x + this._radius, y), this._context.arc(x, y, this._radius, 0, tau$3);
            }
        },
        result: noop$1
    };
    var lengthRing, x00$2, y00$2, x0$4, y0$4, lengthSum$1 = adder(), lengthStream$1 = {
        point: noop$1,
        lineStart: function() {
            lengthStream$1.point = lengthPointFirst$1;
        },
        lineEnd: function() {
            lengthRing && lengthPoint$1(x00$2, y00$2), lengthStream$1.point = noop$1;
        },
        polygonStart: function() {
            lengthRing = !0;
        },
        polygonEnd: function() {
            lengthRing = null;
        },
        result: function() {
            var length = +lengthSum$1;
            return lengthSum$1.reset(), length;
        }
    };
    function lengthPointFirst$1(x, y) {
        lengthStream$1.point = lengthPoint$1, x00$2 = x0$4 = x, y00$2 = y0$4 = y;
    }
    function lengthPoint$1(x, y) {
        x0$4 -= x, y0$4 -= y, lengthSum$1.add(sqrt(x0$4 * x0$4 + y0$4 * y0$4)), x0$4 = x, 
        y0$4 = y;
    }
    function PathString() {
        this._string = [];
    }
    function circle$1(radius) {
        return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z";
    }
    function transformer(methods) {
        return function(stream) {
            var s = new TransformStream();
            for (var key in methods) s[key] = methods[key];
            return s.stream = stream, s;
        };
    }
    function TransformStream() {}
    function fit(projection, fitBounds, object) {
        var clip = projection.clipExtent && projection.clipExtent();
        return projection.scale(150).translate([ 0, 0 ]), null != clip && projection.clipExtent(null), 
        geoStream(object, projection.stream(boundsStream$1)), fitBounds(boundsStream$1.result()), 
        null != clip && projection.clipExtent(clip), projection;
    }
    function fitExtent(projection, extent, object) {
        return fit(projection, function(b) {
            var w = extent[1][0] - extent[0][0], h = extent[1][1] - extent[0][1], k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2;
            projection.scale(150 * k).translate([ x, y ]);
        }, object);
    }
    function fitSize(projection, size, object) {
        return fitExtent(projection, [ [ 0, 0 ], size ], object);
    }
    function fitWidth(projection, width, object) {
        return fit(projection, function(b) {
            var w = +width, k = w / (b[1][0] - b[0][0]), x = (w - k * (b[1][0] + b[0][0])) / 2, y = -k * b[0][1];
            projection.scale(150 * k).translate([ x, y ]);
        }, object);
    }
    function fitHeight(projection, height, object) {
        return fit(projection, function(b) {
            var h = +height, k = h / (b[1][1] - b[0][1]), x = -k * b[0][0], y = (h - k * (b[1][1] + b[0][1])) / 2;
            projection.scale(150 * k).translate([ x, y ]);
        }, object);
    }
    PathString.prototype = {
        _radius: 4.5,
        _circle: circle$1(4.5),
        pointRadius: function(_) {
            return (_ = +_) !== this._radius && (this._radius = _, this._circle = null), this;
        },
        polygonStart: function() {
            this._line = 0;
        },
        polygonEnd: function() {
            this._line = NaN;
        },
        lineStart: function() {
            this._point = 0;
        },
        lineEnd: function() {
            0 === this._line && this._string.push("Z"), this._point = NaN;
        },
        point: function(x, y) {
            switch (this._point) {
              case 0:
                this._string.push("M", x, ",", y), this._point = 1;
                break;

              case 1:
                this._string.push("L", x, ",", y);
                break;

              default:
                null == this._circle && (this._circle = circle$1(this._radius)), this._string.push("M", x, ",", y, this._circle);
            }
        },
        result: function() {
            if (this._string.length) {
                var result = this._string.join("");
                return this._string = [], result;
            }
            return null;
        }
    }, TransformStream.prototype = {
        constructor: TransformStream,
        point: function(x, y) {
            this.stream.point(x, y);
        },
        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();
        }
    };
    var maxDepth = 16, cosMinDistance = cos$1(30 * radians);
    function resample(project, delta2) {
        return +delta2 ? function(project, delta2) {
            function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) {
                var dx = x1 - x0, dy = y1 - y0, d2 = dx * dx + dy * dy;
                if (4 * delta2 < d2 && depth--) {
                    var a = a0 + a1, b = b0 + b1, c = c0 + c1, m = sqrt(a * a + b * b + c * c), phi2 = asin(c /= m), lambda2 = abs(abs(c) - 1) < epsilon$2 || abs(lambda0 - lambda1) < epsilon$2 ? (lambda0 + lambda1) / 2 : atan2(b, a), p = project(lambda2, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x0, dy2 = y2 - y0, dz = dy * dx2 - dx * dy2;
                    (delta2 < dz * dz / d2 || .3 < abs((dx * dx2 + dy * dy2) / d2 - .5) || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) && (resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream), 
                    stream.point(x2, y2), resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream));
                }
            }
            return function(stream) {
                var lambda00, x00, y00, a00, b00, c00, lambda0, x0, y0, a0, b0, c0, resampleStream = {
                    point: point,
                    lineStart: lineStart,
                    lineEnd: lineEnd,
                    polygonStart: function() {
                        stream.polygonStart(), resampleStream.lineStart = ringStart;
                    },
                    polygonEnd: function() {
                        stream.polygonEnd(), resampleStream.lineStart = lineStart;
                    }
                };
                function point(x, y) {
                    x = project(x, y), stream.point(x[0], x[1]);
                }
                function lineStart() {
                    x0 = NaN, resampleStream.point = linePoint, stream.lineStart();
                }
                function linePoint(lambda, phi) {
                    var c = cartesian([ lambda, phi ]), p = project(lambda, phi);
                    resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream), 
                    stream.point(x0, y0);
                }
                function lineEnd() {
                    resampleStream.point = point, stream.lineEnd();
                }
                function ringStart() {
                    lineStart(), resampleStream.point = ringPoint, resampleStream.lineEnd = ringEnd;
                }
                function ringPoint(lambda, phi) {
                    linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0, 
                    resampleStream.point = linePoint;
                }
                function ringEnd() {
                    resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream), 
                    (resampleStream.lineEnd = lineEnd)();
                }
                return resampleStream;
            };
        }(project, delta2) : function(project) {
            return transformer({
                point: function(x, y) {
                    x = project(x, y), this.stream.point(x[0], x[1]);
                }
            });
        }(project);
    }
    var transformRadians = transformer({
        point: function(x, y) {
            this.stream.point(x * radians, y * radians);
        }
    });
    function projection(project) {
        return projectionMutator(function() {
            return project;
        })();
    }
    function projectionMutator(projectAt) {
        var project, dx, dy, rotate, projectRotate, y0, x1, y1, cache, cacheStream, k = 150, x = 480, y = 250, lambda = 0, phi = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, theta = null, preclip = clipAntimeridian, x0 = null, postclip = identity$4, delta2 = .5, projectResample = resample(projectTransform, delta2);
        function projection(point) {
            return [ (point = projectRotate(point[0] * radians, point[1] * radians))[0] * k + dx, dy - point[1] * k ];
        }
        function invert(point) {
            return (point = projectRotate.invert((point[0] - dx) / k, (dy - point[1]) / k)) && [ point[0] * degrees$1, point[1] * degrees$1 ];
        }
        function projectTransform(x, y) {
            return [ (x = project(x, y))[0] * k + dx, dy - x[1] * k ];
        }
        function recenter() {
            projectRotate = compose(rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma), project);
            var center = project(lambda, phi);
            return dx = x - center[0] * k, dy = y + center[1] * k, reset();
        }
        function reset() {
            return cache = cacheStream = null, projection;
        }
        return projection.stream = function(stream) {
            return cache && cacheStream === stream ? cache : cache = transformRadians(function(rotate) {
                return transformer({
                    point: function(x, y) {
                        var r = rotate(x, y);
                        return this.stream.point(r[0], r[1]);
                    }
                });
            }(rotate)(preclip(projectResample(postclip(cacheStream = stream)))));
        }, projection.preclip = function(_) {
            return arguments.length ? (preclip = _, theta = void 0, reset()) : preclip;
        }, projection.postclip = function(_) {
            return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;
        }, projection.clipAngle = function(_) {
            return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, 
            clipAntimeridian), reset()) : theta * degrees$1;
        }, projection.clipExtent = function(_) {
            return arguments.length ? (postclip = null == _ ? (x0 = y0 = x1 = y1 = null, identity$4) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), 
            reset()) : null == x0 ? null : [ [ x0, y0 ], [ x1, y1 ] ];
        }, projection.scale = function(_) {
            return arguments.length ? (k = +_, recenter()) : k;
        }, projection.translate = function(_) {
            return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [ x, y ];
        }, projection.center = function(_) {
            return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, 
            recenter()) : [ lambda * degrees$1, phi * degrees$1 ];
        }, projection.rotate = function(_) {
            return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, 
            deltaGamma = 2 < _.length ? _[2] % 360 * radians : 0, recenter()) : [ deltaLambda * degrees$1, deltaPhi * degrees$1, deltaGamma * degrees$1 ];
        }, projection.precision = function(_) {
            return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), 
            reset()) : sqrt(delta2);
        }, projection.fitExtent = function(extent, object) {
            return fitExtent(projection, extent, object);
        }, projection.fitSize = function(size, object) {
            return fitSize(projection, size, object);
        }, projection.fitWidth = function(width, object) {
            return fitWidth(projection, width, object);
        }, projection.fitHeight = function(height, object) {
            return fitHeight(projection, height, object);
        }, function() {
            return project = projectAt.apply(this, arguments), projection.invert = project.invert && invert, 
            recenter();
        };
    }
    function conicProjection(projectAt) {
        var phi0 = 0, phi1 = pi$3 / 3, m = projectionMutator(projectAt), p = m(phi0, phi1);
        return p.parallels = function(_) {
            return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [ phi0 * degrees$1, phi1 * degrees$1 ];
        }, p;
    }
    function conicEqualAreaRaw(y0, y1) {
        var sy0 = sin$1(y0), n = (sy0 + sin$1(y1)) / 2;
        if (abs(n) < epsilon$2) return function(phi0) {
            var cosPhi0 = cos$1(phi0);
            function forward(lambda, phi) {
                return [ lambda * cosPhi0, sin$1(phi) / cosPhi0 ];
            }
            return forward.invert = function(x, y) {
                return [ x / cosPhi0, asin(y * cosPhi0) ];
            }, forward;
        }(y0);
        var c = 1 + sy0 * (2 * n - sy0), r0 = sqrt(c) / n;
        function project(x, y) {
            var r = sqrt(c - 2 * n * sin$1(y)) / n;
            return [ r * sin$1(x *= n), r0 - r * cos$1(x) ];
        }
        return project.invert = function(x, y) {
            var r0y = r0 - y;
            return [ atan2(x, abs(r0y)) / n * sign(r0y), asin((c - (x * x + r0y * r0y) * n * n) / (2 * n)) ];
        }, project;
    }
    function conicEqualArea() {
        return conicProjection(conicEqualAreaRaw).scale(155.424).center([ 0, 33.6442 ]);
    }
    function albers() {
        return conicEqualArea().parallels([ 29.5, 45.5 ]).scale(1070).translate([ 480, 250 ]).rotate([ 96, 0 ]).center([ -.6, 38.7 ]);
    }
    function azimuthalRaw(scale) {
        return function(x, y) {
            var cx = cos$1(x), cy = cos$1(y), k = scale(cx * cy);
            return [ k * cy * sin$1(x), k * sin$1(y) ];
        };
    }
    function azimuthalInvert(angle) {
        return function(x, y) {
            var z = sqrt(x * x + y * y), c = angle(z), sc = sin$1(c), cc = cos$1(c);
            return [ atan2(x * sc, z * cc), asin(z && y * sc / z) ];
        };
    }
    var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) {
        return sqrt(2 / (1 + cxcy));
    });
    azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) {
        return 2 * asin(z / 2);
    });
    var azimuthalEquidistantRaw = azimuthalRaw(function(c) {
        return (c = acos(c)) && c / sin$1(c);
    });
    function mercatorRaw(lambda, phi) {
        return [ lambda, log(tan((halfPi$2 + phi) / 2)) ];
    }
    function mercatorProjection(project) {
        var y0, x1, y1, m = projection(project), center = m.center, scale = m.scale, translate = m.translate, clipExtent = m.clipExtent, x0 = null;
        function reclip() {
            var k = pi$3 * scale(), t = m(rotation(m.rotate()).invert([ 0, 0 ]));
            return clipExtent(null == x0 ? [ [ t[0] - k, t[1] - k ], [ t[0] + k, t[1] + k ] ] : project === mercatorRaw ? [ [ Math.max(t[0] - k, x0), y0 ], [ Math.min(t[0] + k, x1), y1 ] ] : [ [ x0, Math.max(t[1] - k, y0) ], [ x1, Math.min(t[1] + k, y1) ] ]);
        }
        return m.scale = function(_) {
            return arguments.length ? (scale(_), reclip()) : scale();
        }, m.translate = function(_) {
            return arguments.length ? (translate(_), reclip()) : translate();
        }, m.center = function(_) {
            return arguments.length ? (center(_), reclip()) : center();
        }, m.clipExtent = function(_) {
            return arguments.length ? (null == _ ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], 
            y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reclip()) : null == x0 ? null : [ [ x0, y0 ], [ x1, y1 ] ];
        }, reclip();
    }
    function tany(y) {
        return tan((halfPi$2 + y) / 2);
    }
    function conicConformalRaw(y0, y1) {
        var cy0 = cos$1(y0), n = y0 === y1 ? sin$1(y0) : log(cy0 / cos$1(y1)) / log(tany(y1) / tany(y0)), f = cy0 * pow(tany(y0), n) / n;
        if (!n) return mercatorRaw;
        function project(x, y) {
            0 < f ? y < -halfPi$2 + epsilon$2 && (y = -halfPi$2 + epsilon$2) : halfPi$2 - epsilon$2 < y && (y = halfPi$2 - epsilon$2);
            var r = f / pow(tany(y), n);
            return [ r * sin$1(n * x), f - r * cos$1(n * x) ];
        }
        return project.invert = function(x, y) {
            var fy = f - y, r = sign(n) * sqrt(x * x + fy * fy);
            return [ atan2(x, abs(fy)) / n * sign(fy), 2 * atan(pow(f / r, 1 / n)) - halfPi$2 ];
        }, project;
    }
    function equirectangularRaw(lambda, phi) {
        return [ lambda, phi ];
    }
    function conicEquidistantRaw(y0, y1) {
        var cy0 = cos$1(y0), n = y0 === y1 ? sin$1(y0) : (cy0 - cos$1(y1)) / (y1 - y0), g = cy0 / n + y0;
        if (abs(n) < epsilon$2) return equirectangularRaw;
        function project(x, y) {
            var gy = g - y, nx = n * x;
            return [ gy * sin$1(nx), g - gy * cos$1(nx) ];
        }
        return project.invert = function(x, y) {
            var gy = g - y;
            return [ atan2(x, abs(gy)) / n * sign(gy), g - sign(n) * sqrt(x * x + gy * gy) ];
        }, project;
    }
    function gnomonicRaw(x, y) {
        var cy = cos$1(y), k = cos$1(x) * cy;
        return [ cy * sin$1(x) / k, sin$1(y) / k ];
    }
    function scaleTranslate(kx, ky, tx, ty) {
        return 1 === kx && 1 === ky && 0 === tx && 0 === ty ? identity$4 : transformer({
            point: function(x, y) {
                this.stream.point(x * kx + tx, y * ky + ty);
            }
        });
    }
    function naturalEarth1Raw(lambda, phi) {
        var phi2 = phi * phi, phi4 = phi2 * phi2;
        return [ lambda * (.8707 - .131979 * phi2 + phi4 * (phi4 * (.003971 * phi2 - .001529 * phi4) - .013791)), phi * (1.007226 + phi2 * (.015085 + phi4 * (.028874 * phi2 - .044475 - .005916 * phi4))) ];
    }
    function orthographicRaw(x, y) {
        return [ cos$1(y) * sin$1(x), sin$1(y) ];
    }
    function stereographicRaw(x, y) {
        var cy = cos$1(y), k = 1 + cos$1(x) * cy;
        return [ cy * sin$1(x) / k, sin$1(y) / k ];
    }
    function transverseMercatorRaw(lambda, phi) {
        return [ log(tan((halfPi$2 + phi) / 2)), -lambda ];
    }
    function defaultSeparation(a, b) {
        return a.parent === b.parent ? 1 : 2;
    }
    function meanXReduce(x, c) {
        return x + c.x;
    }
    function maxYReduce(y, c) {
        return Math.max(y, c.y);
    }
    function count(node) {
        var sum = 0, children = node.children, i = children && children.length;
        if (i) for (;0 <= --i; ) sum += children[i].value; else sum = 1;
        node.value = sum;
    }
    function hierarchy(data, children) {
        var node, child, childs, i, n, root = new Node(data), valued = +data.value && (root.value = data.value), nodes = [ root ];
        for (null == children && (children = defaultChildren); node = nodes.pop(); ) if (valued && (node.value = +node.data.value), 
        (childs = children(node.data)) && (n = childs.length)) for (node.children = new Array(n), 
        i = n - 1; 0 <= i; --i) nodes.push(child = node.children[i] = new Node(childs[i])), 
        child.parent = node, child.depth = node.depth + 1;
        return root.eachBefore(computeHeight);
    }
    function defaultChildren(d) {
        return d.children;
    }
    function copyData(node) {
        node.data = node.data.data;
    }
    function computeHeight(node) {
        for (var height = 0; node.height = height, (node = node.parent) && node.height < ++height; ) ;
    }
    function Node(data) {
        this.data = data, this.depth = this.height = 0, this.parent = null;
    }
    azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) {
        return z;
    }), mercatorRaw.invert = function(x, y) {
        return [ x, 2 * atan(exp(y)) - halfPi$2 ];
    }, equirectangularRaw.invert = equirectangularRaw, gnomonicRaw.invert = azimuthalInvert(atan), 
    naturalEarth1Raw.invert = function(x, y) {
        var delta, phi = y, i = 25;
        do {
            var phi2 = phi * phi, phi4 = phi2 * phi2;
            phi -= delta = (phi * (1.007226 + phi2 * (.015085 + phi4 * (.028874 * phi2 - .044475 - .005916 * phi4))) - y) / (1.007226 + phi2 * (.045255 + phi4 * (.259866 * phi2 - .311325 - .005916 * 11 * phi4)));
        } while (abs(delta) > epsilon$2 && 0 < --i);
        return [ x / (.8707 + (phi2 = phi * phi) * (phi2 * (phi2 * phi2 * phi2 * (.003971 - .001529 * phi2) - .013791) - .131979)), phi ];
    }, orthographicRaw.invert = azimuthalInvert(asin), stereographicRaw.invert = azimuthalInvert(function(z) {
        return 2 * atan(z);
    }), transverseMercatorRaw.invert = function(x, y) {
        return [ -y, 2 * atan(exp(x)) - halfPi$2 ];
    }, Node.prototype = hierarchy.prototype = {
        constructor: Node,
        count: function() {
            return this.eachAfter(count);
        },
        each: function(callback) {
            var current, children, i, n, node = this, next = [ node ];
            do {
                for (current = next.reverse(), next = []; node = current.pop(); ) if (callback(node), 
                children = node.children) for (i = 0, n = children.length; i < n; ++i) next.push(children[i]);
            } while (next.length);
            return this;
        },
        eachAfter: function(callback) {
            for (var children, i, n, node = this, nodes = [ node ], next = []; node = nodes.pop(); ) if (next.push(node), 
            children = node.children) for (i = 0, n = children.length; i < n; ++i) nodes.push(children[i]);
            for (;node = next.pop(); ) callback(node);
            return this;
        },
        eachBefore: function(callback) {
            for (var children, i, node = this, nodes = [ node ]; node = nodes.pop(); ) if (callback(node), 
            children = node.children) for (i = children.length - 1; 0 <= i; --i) nodes.push(children[i]);
            return this;
        },
        sum: function(value) {
            return this.eachAfter(function(node) {
                for (var sum = +value(node.data) || 0, children = node.children, i = children && children.length; 0 <= --i; ) sum += children[i].value;
                node.value = sum;
            });
        },
        sort: function(compare) {
            return this.eachBefore(function(node) {
                node.children && node.children.sort(compare);
            });
        },
        path: function(end) {
            for (var start = this, ancestor = function(a, b) {
                if (a === b) return a;
                var aNodes = a.ancestors(), bNodes = b.ancestors(), c = null;
                for (a = aNodes.pop(), b = bNodes.pop(); a === b; ) c = a, a = aNodes.pop(), b = bNodes.pop();
                return c;
            }(start, end), nodes = [ start ]; start !== ancestor; ) start = start.parent, nodes.push(start);
            for (var k = nodes.length; end !== ancestor; ) nodes.splice(k, 0, end), end = end.parent;
            return nodes;
        },
        ancestors: function() {
            for (var node = this, nodes = [ node ]; node = node.parent; ) nodes.push(node);
            return nodes;
        },
        descendants: function() {
            var nodes = [];
            return this.each(function(node) {
                nodes.push(node);
            }), nodes;
        },
        leaves: function() {
            var leaves = [];
            return this.eachBefore(function(node) {
                node.children || leaves.push(node);
            }), leaves;
        },
        links: function() {
            var root = this, links = [];
            return root.each(function(node) {
                node !== root && links.push({
                    source: node.parent,
                    target: node
                });
            }), links;
        },
        copy: function() {
            return hierarchy(this).eachBefore(copyData);
        }
    };
    var slice$3 = Array.prototype.slice;
    function enclose(circles) {
        for (var p, e, i = 0, n = (circles = function(array) {
            for (var t, i, m = array.length; m; ) i = Math.random() * m-- | 0, t = array[m], 
            array[m] = array[i], array[i] = t;
            return array;
        }(slice$3.call(circles))).length, B = []; i < n; ) p = circles[i], e && enclosesWeak(e, p) ? ++i : (e = encloseBasis(B = extendBasis(B, p)), 
        i = 0);
        return e;
    }
    function extendBasis(B, p) {
        var i, j;
        if (enclosesWeakAll(p, B)) return [ p ];
        for (i = 0; i < B.length; ++i) if (enclosesNot(p, B[i]) && enclosesWeakAll(encloseBasis2(B[i], p), B)) return [ B[i], p ];
        for (i = 0; i < B.length - 1; ++i) for (j = i + 1; j < B.length; ++j) if (enclosesNot(encloseBasis2(B[i], B[j]), p) && enclosesNot(encloseBasis2(B[i], p), B[j]) && enclosesNot(encloseBasis2(B[j], p), B[i]) && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) return [ B[i], B[j], p ];
        throw new Error();
    }
    function enclosesNot(a, b) {
        var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y;
        return dr < 0 || dr * dr < dx * dx + dy * dy;
    }
    function enclosesWeak(a, b) {
        var dr = a.r - b.r + 1e-6, dx = b.x - a.x, dy = b.y - a.y;
        return 0 < dr && dx * dx + dy * dy < dr * dr;
    }
    function enclosesWeakAll(a, B) {
        for (var i = 0; i < B.length; ++i) if (!enclosesWeak(a, B[i])) return !1;
        return !0;
    }
    function encloseBasis(B) {
        switch (B.length) {
          case 1:
            return {
                x: (a = B[0]).x,
                y: a.y,
                r: a.r
            };

          case 2:
            return encloseBasis2(B[0], B[1]);

          case 3:
            return encloseBasis3(B[0], B[1], B[2]);
        }
        var a;
    }
    function encloseBasis2(a, b) {
        var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21);
        return {
            x: (x1 + x2 + x21 / l * r21) / 2,
            y: (y1 + y2 + y21 / l * r21) / 2,
            r: (l + r1 + r2) / 2
        };
    }
    function encloseBasis3(a, b, c) {
        var x1 = a.x, y1 = a.y, r1 = a.r, x2 = b.x, y2 = b.y, r2 = b.r, x3 = c.x, y3 = c.y, r3 = c.r, a2 = x1 - x2, a3 = x1 - x3, b2 = y1 - y2, b3 = y1 - y3, c2 = r2 - r1, c3 = r3 - r1, d1 = x1 * x1 + y1 * y1 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b2 - a2 * b3, xa = (b2 * d3 - b3 * d2) / (2 * ab) - x1, xb = (b3 * c2 - b2 * c3) / ab, ya = (a3 * d2 - a2 * d3) / (2 * ab) - y1, yb = (a2 * c3 - a3 * c2) / ab, A = xb * xb + yb * yb - 1, B = 2 * (r1 + xa * xb + ya * yb), C = xa * xa + ya * ya - r1 * r1, r = -(A ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B);
        return {
            x: x1 + xa + xb * r,
            y: y1 + ya + yb * r,
            r: r
        };
    }
    function place(a, b, c) {
        var ax = a.x, ay = a.y, da = b.r + c.r, db = a.r + c.r, dx = b.x - ax, dy = b.y - ay, dc = dx * dx + dy * dy;
        if (dc) {
            var x = .5 + ((db *= db) - (da *= da)) / (2 * dc), y = Math.sqrt(Math.max(0, 2 * da * (db + dc) - (db -= dc) * db - da * da)) / (2 * dc);
            c.x = ax + x * dx + y * dy, c.y = ay + x * dy - y * dx;
        } else c.x = ax + db, c.y = ay;
    }
    function intersects(a, b) {
        var dx = b.x - a.x, dy = b.y - a.y, dr = a.r + b.r;
        return dx * dx + dy * dy < dr * dr - 1e-6;
    }
    function score(node) {
        var a = node._, b = node.next._, ab = a.r + b.r, dx = (a.x * b.r + b.x * a.r) / ab, dy = (a.y * b.r + b.y * a.r) / ab;
        return dx * dx + dy * dy;
    }
    function Node$1(circle) {
        this._ = circle, this.next = null, this.previous = null;
    }
    function packEnclose(circles) {
        if (!(n = circles.length)) return 0;
        var a, b, c, n, aa, ca, i, j, k, sj, sk;
        if ((a = circles[0]).x = 0, a.y = 0, !(1 < n)) return a.r;
        if (b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0, !(2 < n)) return a.r + b.r;
        place(b, a, c = circles[2]), a = new Node$1(a), b = new Node$1(b), c = new Node$1(c), 
        a.next = c.previous = b, b.next = a.previous = c, c.next = b.previous = a;
        pack: for (i = 3; i < n; ++i) {
            place(a._, b._, c = circles[i]), c = new Node$1(c), j = b.next, k = a.previous, 
            sj = b._.r, sk = a._.r;
            do {
                if (sj <= sk) {
                    if (intersects(j._, c._)) {
                        b = j, (a.next = b).previous = a, --i;
                        continue pack;
                    }
                    sj += j._.r, j = j.next;
                } else {
                    if (intersects(k._, c._)) {
                        ((a = k).next = b).previous = a, --i;
                        continue pack;
                    }
                    sk += k._.r, k = k.previous;
                }
            } while (j !== k.next);
            for (c.previous = a, c.next = b, a.next = b.previous = b = c, aa = score(a); (c = c.next) !== b; ) (ca = score(c)) < aa && (a = c, 
            aa = ca);
            b = a.next;
        }
        for (a = [ b._ ], c = b; (c = c.next) !== b; ) a.push(c._);
        for (c = enclose(a), i = 0; i < n; ++i) (a = circles[i]).x -= c.x, a.y -= c.y;
        return c.r;
    }
    function required(f) {
        if ("function" != typeof f) throw new Error();
        return f;
    }
    function constantZero() {
        return 0;
    }
    function constant$8(x) {
        return function() {
            return x;
        };
    }
    function defaultRadius$1(d) {
        return Math.sqrt(d.value);
    }
    function radiusLeaf(radius) {
        return function(node) {
            node.children || (node.r = Math.max(0, +radius(node) || 0));
        };
    }
    function packChildren(padding, k) {
        return function(node) {
            if (children = node.children) {
                var children, i, e, n = children.length, r = padding(node) * k || 0;
                if (r) for (i = 0; i < n; ++i) children[i].r += r;
                if (e = packEnclose(children), r) for (i = 0; i < n; ++i) children[i].r -= r;
                node.r = e + r;
            }
        };
    }
    function translateChild(k) {
        return function(node) {
            var parent = node.parent;
            node.r *= k, parent && (node.x = parent.x + k * node.x, node.y = parent.y + k * node.y);
        };
    }
    function roundNode(node) {
        node.x0 = Math.round(node.x0), node.y0 = Math.round(node.y0), node.x1 = Math.round(node.x1), 
        node.y1 = Math.round(node.y1);
    }
    function treemapDice(parent, x0, y0, x1, y1) {
        for (var node, nodes = parent.children, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value; ++i < n; ) (node = nodes[i]).y0 = y0, 
        node.y1 = y1, node.x0 = x0, node.x1 = x0 += node.value * k;
    }
    var keyPrefix$1 = "$", preroot = {
        depth: -1
    }, ambiguous = {};
    function defaultId(d) {
        return d.id;
    }
    function defaultParentId(d) {
        return d.parentId;
    }
    function defaultSeparation$1(a, b) {
        return a.parent === b.parent ? 1 : 2;
    }
    function nextLeft(v) {
        var children = v.children;
        return children ? children[0] : v.t;
    }
    function nextRight(v) {
        var children = v.children;
        return children ? children[children.length - 1] : v.t;
    }
    function moveSubtree(wm, wp, shift) {
        var change = shift / (wp.i - wm.i);
        wp.c -= change, wp.s += shift, wm.c += change, wp.z += shift, wp.m += shift;
    }
    function nextAncestor(vim, v, ancestor) {
        return vim.a.parent === v.parent ? vim.a : ancestor;
    }
    function TreeNode(node, i) {
        this._ = node, this.parent = null, this.children = null, this.A = null, (this.a = this).z = 0, 
        this.m = 0, this.c = 0, this.s = 0, this.t = null, this.i = i;
    }
    function treemapSlice(parent, x0, y0, x1, y1) {
        for (var node, nodes = parent.children, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value; ++i < n; ) (node = nodes[i]).x0 = x0, 
        node.x1 = x1, node.y0 = y0, node.y1 = y0 += node.value * k;
    }
    TreeNode.prototype = Object.create(Node.prototype);
    var phi = (1 + Math.sqrt(5)) / 2;
    function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
        for (var row, nodeValue, dx, dy, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta, rows = [], nodes = parent.children, i0 = 0, i1 = 0, n = nodes.length, value = parent.value; i0 < n; ) {
            for (dx = x1 - x0, dy = y1 - y0; !(sumValue = nodes[i1++].value) && i1 < n; ) ;
            for (minValue = maxValue = sumValue, beta = sumValue * sumValue * (alpha = Math.max(dy / dx, dx / dy) / (value * ratio)), 
            minRatio = Math.max(maxValue / beta, beta / minValue); i1 < n; ++i1) {
                if (sumValue += nodeValue = nodes[i1].value, nodeValue < minValue && (minValue = nodeValue), 
                maxValue < nodeValue && (maxValue = nodeValue), beta = sumValue * sumValue * alpha, 
                minRatio < (newRatio = Math.max(maxValue / beta, beta / minValue))) {
                    sumValue -= nodeValue;
                    break;
                }
                minRatio = newRatio;
            }
            rows.push(row = {
                value: sumValue,
                dice: dx < dy,
                children: nodes.slice(i0, i1)
            }), row.dice ? treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1) : treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1), 
            value -= sumValue, i0 = i1;
        }
        return rows;
    }
    var squarify = function custom(ratio) {
        function squarify(parent, x0, y0, x1, y1) {
            squarifyRatio(ratio, parent, x0, y0, x1, y1);
        }
        return squarify.ratio = function(x) {
            return custom(1 < (x = +x) ? x : 1);
        }, squarify;
    }(phi);
    var resquarify = function custom(ratio) {
        function resquarify(parent, x0, y0, x1, y1) {
            if ((rows = parent._squarify) && rows.ratio === ratio) for (var rows, row, nodes, i, n, j = -1, m = rows.length, value = parent.value; ++j < m; ) {
                for (nodes = (row = rows[j]).children, i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;
                row.dice ? treemapDice(row, x0, y0, x1, y0 += (y1 - y0) * row.value / value) : treemapSlice(row, x0, y0, x0 += (x1 - x0) * row.value / value, y1), 
                value -= row.value;
            } else parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1), rows.ratio = ratio;
        }
        return resquarify.ratio = function(x) {
            return custom(1 < (x = +x) ? x : 1);
        }, resquarify;
    }(phi);
    function lexicographicOrder(a, b) {
        return a[0] - b[0] || a[1] - b[1];
    }
    function computeUpperHullIndexes(points) {
        for (var a, b, c, n = points.length, indexes = [ 0, 1 ], size = 2, i = 2; i < n; ++i) {
            for (;1 < size && (a = points[indexes[size - 2]], b = points[indexes[size - 1]], 
            c = points[i], (b[0] - a[0]) * (c[1] - a[1]) - (b[1] - a[1]) * (c[0] - a[0]) <= 0); ) --size;
            indexes[size++] = i;
        }
        return indexes.slice(0, size);
    }
    var slice$4 = [].slice, noabort = {};
    function Queue(size) {
        this._size = size, this._call = this._error = null, this._tasks = [], this._data = [], 
        this._waiting = this._active = this._ended = this._start = 0;
    }
    function poke$1(q) {
        if (!q._start) try {
            !function(q) {
                for (;q._start = q._waiting && q._active < q._size; ) {
                    var i = q._ended + q._active, t = q._tasks[i], j = t.length - 1, c = t[j];
                    t[j] = end(q, i), --q._waiting, ++q._active, t = c.apply(null, t), q._tasks[i] && (q._tasks[i] = t || noabort);
                }
            }(q);
        } catch (e) {
            if (q._tasks[q._ended + q._active - 1]) abort(q, e); else if (!q._data) throw e;
        }
    }
    function end(q, i) {
        return function(e, r) {
            q._tasks[i] && (--q._active, ++q._ended, (q._tasks[i] = null) == q._error && (null != e ? abort(q, e) : (q._data[i] = r, 
            q._waiting ? poke$1(q) : maybeNotify(q))));
        };
    }
    function abort(q, e) {
        var t, i = q._tasks.length;
        for (q._error = e, q._data = void 0, q._waiting = NaN; 0 <= --i; ) if ((t = q._tasks[i]) && (q._tasks[i] = null, 
        t.abort)) try {
            t.abort();
        } catch (e) {}
        q._active = NaN, maybeNotify(q);
    }
    function maybeNotify(q) {
        if (!q._active && q._call) {
            var d = q._data;
            q._data = void 0, q._call(q._error, d);
        }
    }
    function queue(concurrency) {
        if (null == concurrency) concurrency = 1 / 0; else if (!(1 <= (concurrency = +concurrency))) throw new Error("invalid concurrency");
        return new Queue(concurrency);
    }
    function defaultSource$1() {
        return Math.random();
    }
    Queue.prototype = queue.prototype = {
        constructor: Queue,
        defer: function(callback) {
            if ("function" != typeof callback) throw new Error("invalid callback");
            if (this._call) throw new Error("defer after await");
            if (null != this._error) return this;
            var t = slice$4.call(arguments, 1);
            return t.push(callback), ++this._waiting, this._tasks.push(t), poke$1(this), this;
        },
        abort: function() {
            return null == this._error && abort(this, new Error("abort")), this;
        },
        await: function(callback) {
            if ("function" != typeof callback) throw new Error("invalid callback");
            if (this._call) throw new Error("multiple await");
            return this._call = function(error, results) {
                callback.apply(null, [ error ].concat(results));
            }, maybeNotify(this), this;
        },
        awaitAll: function(callback) {
            if ("function" != typeof callback) throw new Error("invalid callback");
            if (this._call) throw new Error("multiple await");
            return this._call = callback, maybeNotify(this), this;
        }
    };
    var uniform = function sourceRandomUniform(source) {
        function randomUniform(min, max) {
            return min = null == min ? 0 : +min, max = null == max ? 1 : +max, 1 === arguments.length ? (max = min, 
            min = 0) : max -= min, function() {
                return source() * max + min;
            };
        }
        return randomUniform.source = sourceRandomUniform, randomUniform;
    }(defaultSource$1), normal = function sourceRandomNormal(source) {
        function randomNormal(mu, sigma) {
            var x, r;
            return mu = null == mu ? 0 : +mu, sigma = null == sigma ? 1 : +sigma, function() {
                var y;
                if (null != x) y = x, x = null; else for (;x = 2 * source() - 1, y = 2 * source() - 1, 
                !(r = x * x + y * y) || 1 < r; ) ;
                return mu + sigma * y * Math.sqrt(-2 * Math.log(r) / r);
            };
        }
        return randomNormal.source = sourceRandomNormal, randomNormal;
    }(defaultSource$1), logNormal = function sourceRandomLogNormal(source) {
        function randomLogNormal() {
            var randomNormal = normal.source(source).apply(this, arguments);
            return function() {
                return Math.exp(randomNormal());
            };
        }
        return randomLogNormal.source = sourceRandomLogNormal, randomLogNormal;
    }(defaultSource$1), irwinHall = function sourceRandomIrwinHall(source) {
        function randomIrwinHall(n) {
            return function() {
                for (var sum = 0, i = 0; i < n; ++i) sum += source();
                return sum;
            };
        }
        return randomIrwinHall.source = sourceRandomIrwinHall, randomIrwinHall;
    }(defaultSource$1), bates = function sourceRandomBates(source) {
        function randomBates(n) {
            var randomIrwinHall = irwinHall.source(source)(n);
            return function() {
                return randomIrwinHall() / n;
            };
        }
        return randomBates.source = sourceRandomBates, randomBates;
    }(defaultSource$1), exponential$1 = function sourceRandomExponential(source) {
        function randomExponential(lambda) {
            return function() {
                return -Math.log(1 - source()) / lambda;
            };
        }
        return randomExponential.source = sourceRandomExponential, randomExponential;
    }(defaultSource$1);
    function request(url, callback) {
        var request, mimeType, response, responseType, event = dispatch("beforesend", "progress", "load", "error"), headers = map$1(), xhr = new XMLHttpRequest(), user = null, password = null, timeout = 0;
        function respond(o) {
            var result, status = xhr.status;
            if (!status && function(xhr) {
                var type = xhr.responseType;
                return type && "text" !== type ? xhr.response : xhr.responseText;
            }(xhr) || 200 <= status && status < 300 || 304 === status) {
                if (response) try {
                    result = response.call(request, xhr);
                } catch (e) {
                    return void event.call("error", request, e);
                } else result = xhr;
                event.call("load", request, result);
            } else event.call("error", request, o);
        }
        if ("undefined" == typeof XDomainRequest || "withCredentials" in xhr || !/^(http(s)?:)?\/\//.test(url) || (xhr = new XDomainRequest()), 
        "onload" in xhr ? xhr.onload = xhr.onerror = xhr.ontimeout = respond : xhr.onreadystatechange = function(o) {
            3 < xhr.readyState && respond(o);
        }, xhr.onprogress = function(e) {
            event.call("progress", request, e);
        }, request = {
            header: function(name, value) {
                return name = (name + "").toLowerCase(), arguments.length < 2 ? headers.get(name) : (null == value ? headers.remove(name) : headers.set(name, value + ""), 
                request);
            },
            mimeType: function(value) {
                return arguments.length ? (mimeType = null == value ? null : value + "", request) : mimeType;
            },
            responseType: function(value) {
                return arguments.length ? (responseType = value, request) : responseType;
            },
            timeout: function(value) {
                return arguments.length ? (timeout = +value, request) : timeout;
            },
            user: function(value) {
                return arguments.length < 1 ? user : (user = null == value ? null : value + "", 
                request);
            },
            password: function(value) {
                return arguments.length < 1 ? password : (password = null == value ? null : value + "", 
                request);
            },
            response: function(value) {
                return response = value, request;
            },
            get: function(data, callback) {
                return request.send("GET", data, callback);
            },
            post: function(data, callback) {
                return request.send("POST", data, callback);
            },
            send: function(method, data, callback) {
                return xhr.open(method, url, !0, user, password), null == mimeType || headers.has("accept") || headers.set("accept", mimeType + ",*/*"), 
                xhr.setRequestHeader && headers.each(function(value, name) {
                    xhr.setRequestHeader(name, value);
                }), null != mimeType && xhr.overrideMimeType && xhr.overrideMimeType(mimeType), 
                null != responseType && (xhr.responseType = responseType), 0 < timeout && (xhr.timeout = timeout), 
                null == callback && "function" == typeof data && (callback = data, data = null), 
                null != callback && 1 === callback.length && (callback = function(callback) {
                    return function(error, xhr) {
                        callback(null == error ? xhr : null);
                    };
                }(callback)), null != callback && request.on("error", callback).on("load", function(xhr) {
                    callback(null, xhr);
                }), event.call("beforesend", request, xhr), xhr.send(null == data ? null : data), 
                request;
            },
            abort: function() {
                return xhr.abort(), request;
            },
            on: function() {
                var value = event.on.apply(event, arguments);
                return value === event ? request : value;
            }
        }, null != callback) {
            if ("function" != typeof callback) throw new Error("invalid callback: " + callback);
            return request.get(callback);
        }
        return request;
    }
    function type$1(defaultMimeType, response) {
        return function(url, callback) {
            var r = request(url).mimeType(defaultMimeType).response(response);
            if (null != callback) {
                if ("function" != typeof callback) throw new Error("invalid callback: " + callback);
                return r.get(callback);
            }
            return r;
        };
    }
    var html = type$1("text/html", function(xhr) {
        return document.createRange().createContextualFragment(xhr.responseText);
    }), json = type$1("application/json", function(xhr) {
        return JSON.parse(xhr.responseText);
    }), text = type$1("text/plain", function(xhr) {
        return xhr.responseText;
    }), xml = type$1("application/xml", function(xhr) {
        var xml = xhr.responseXML;
        if (!xml) throw new Error("parse error");
        return xml;
    });
    function dsv$1(defaultMimeType, parse) {
        return function(url, row, callback) {
            arguments.length < 3 && (callback = row, row = null);
            var r = request(url).mimeType(defaultMimeType);
            return r.row = function(_) {
                return arguments.length ? r.response(function(parse, row) {
                    return function(request$$1) {
                        return parse(request$$1.responseText, row);
                    };
                }(parse, row = _)) : row;
            }, r.row(row), callback ? r.get(callback) : r;
        };
    }
    var csv$1 = dsv$1("text/csv", csvParse), tsv$1 = dsv$1("text/tab-separated-values", tsvParse), array$2 = Array.prototype, map$3 = array$2.map, slice$5 = array$2.slice, implicit = {
        name: "implicit"
    };
    function ordinal(range) {
        var index = map$1(), domain = [], unknown = implicit;
        function scale(d) {
            var key = d + "", i = index.get(key);
            if (!i) {
                if (unknown !== implicit) return unknown;
                index.set(key, i = domain.push(d));
            }
            return range[(i - 1) % range.length];
        }
        return range = null == range ? [] : slice$5.call(range), scale.domain = function(_) {
            if (!arguments.length) return domain.slice();
            domain = [], index = map$1();
            for (var d, key, i = -1, n = _.length; ++i < n; ) index.has(key = (d = _[i]) + "") || index.set(key, domain.push(d));
            return scale;
        }, scale.range = function(_) {
            return arguments.length ? (range = slice$5.call(_), scale) : range.slice();
        }, scale.unknown = function(_) {
            return arguments.length ? (unknown = _, scale) : unknown;
        }, scale.copy = function() {
            return ordinal().domain(domain).range(range).unknown(unknown);
        }, scale;
    }
    function band() {
        var step, bandwidth, scale = ordinal().unknown(void 0), domain = scale.domain, ordinalRange = scale.range, range$$1 = [ 0, 1 ], round = !1, paddingInner = 0, paddingOuter = 0, align = .5;
        function rescale() {
            var n = domain().length, reverse = range$$1[1] < range$$1[0], start = range$$1[reverse - 0], stop = range$$1[1 - reverse];
            step = (stop - start) / Math.max(1, n - paddingInner + 2 * paddingOuter), round && (step = Math.floor(step)), 
            start += (stop - start - step * (n - paddingInner)) * align, bandwidth = step * (1 - paddingInner), 
            round && (start = Math.round(start), bandwidth = Math.round(bandwidth));
            var values = sequence(n).map(function(i) {
                return start + step * i;
            });
            return ordinalRange(reverse ? values.reverse() : values);
        }
        return delete scale.unknown, scale.domain = function(_) {
            return arguments.length ? (domain(_), rescale()) : domain();
        }, scale.range = function(_) {
            return arguments.length ? (range$$1 = [ +_[0], +_[1] ], rescale()) : range$$1.slice();
        }, scale.rangeRound = function(_) {
            return range$$1 = [ +_[0], +_[1] ], round = !0, rescale();
        }, scale.bandwidth = function() {
            return bandwidth;
        }, scale.step = function() {
            return step;
        }, scale.round = function(_) {
            return arguments.length ? (round = !!_, rescale()) : round;
        }, scale.padding = function(_) {
            return arguments.length ? (paddingInner = paddingOuter = Math.max(0, Math.min(1, _)), 
            rescale()) : paddingInner;
        }, scale.paddingInner = function(_) {
            return arguments.length ? (paddingInner = Math.max(0, Math.min(1, _)), rescale()) : paddingInner;
        }, scale.paddingOuter = function(_) {
            return arguments.length ? (paddingOuter = Math.max(0, Math.min(1, _)), rescale()) : paddingOuter;
        }, scale.align = function(_) {
            return arguments.length ? (align = Math.max(0, Math.min(1, _)), rescale()) : align;
        }, scale.copy = function() {
            return band().domain(domain()).range(range$$1).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align);
        }, rescale();
    }
    function constant$9(x) {
        return function() {
            return x;
        };
    }
    function number$2(x) {
        return +x;
    }
    var unit = [ 0, 1 ];
    function deinterpolateLinear(a, b) {
        return (b -= a = +a) ? function(x) {
            return (x - a) / b;
        } : constant$9(b);
    }
    function bimap(domain, range, deinterpolate, reinterpolate) {
        var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1];
        return d1 < d0 ? (d0 = deinterpolate(d1, d0), r0 = reinterpolate(r1, r0)) : (d0 = deinterpolate(d0, d1), 
        r0 = reinterpolate(r0, r1)), function(x) {
            return r0(d0(x));
        };
    }
    function polymap(domain, range, deinterpolate, reinterpolate) {
        var j = Math.min(domain.length, range.length) - 1, d = new Array(j), r = new Array(j), i = -1;
        for (domain[j] < domain[0] && (domain = domain.slice().reverse(), range = range.slice().reverse()); ++i < j; ) d[i] = deinterpolate(domain[i], domain[i + 1]), 
        r[i] = reinterpolate(range[i], range[i + 1]);
        return function(x) {
            var i = bisectRight(domain, x, 1, j) - 1;
            return r[i](d[i](x));
        };
    }
    function copy(source, target) {
        return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp());
    }
    function continuous(deinterpolate, reinterpolate) {
        var piecewise, output, input, domain = unit, range = unit, interpolate$$1 = interpolateValue, clamp = !1;
        function rescale() {
            return piecewise = 2 < Math.min(domain.length, range.length) ? polymap : bimap, 
            output = input = null, scale;
        }
        function scale(x) {
            return (output || (output = piecewise(domain, range, clamp ? function(deinterpolate) {
                return function(a, b) {
                    var d = deinterpolate(a = +a, b = +b);
                    return function(x) {
                        return x <= a ? 0 : b <= x ? 1 : d(x);
                    };
                };
            }(deinterpolate) : deinterpolate, interpolate$$1)))(+x);
        }
        return scale.invert = function(y) {
            return (input || (input = piecewise(range, domain, deinterpolateLinear, clamp ? function(reinterpolate) {
                return function(a, b) {
                    var r = reinterpolate(a = +a, b = +b);
                    return function(t) {
                        return t <= 0 ? a : 1 <= t ? b : r(t);
                    };
                };
            }(reinterpolate) : reinterpolate)))(+y);
        }, scale.domain = function(_) {
            return arguments.length ? (domain = map$3.call(_, number$2), rescale()) : domain.slice();
        }, scale.range = function(_) {
            return arguments.length ? (range = slice$5.call(_), rescale()) : range.slice();
        }, scale.rangeRound = function(_) {
            return range = slice$5.call(_), interpolate$$1 = interpolateRound, rescale();
        }, scale.clamp = function(_) {
            return arguments.length ? (clamp = !!_, rescale()) : clamp;
        }, scale.interpolate = function(_) {
            return arguments.length ? (interpolate$$1 = _, rescale()) : interpolate$$1;
        }, rescale();
    }
    function linearish(scale) {
        var domain = scale.domain;
        return scale.ticks = function(count) {
            var d = domain();
            return ticks(d[0], d[d.length - 1], null == count ? 10 : count);
        }, scale.tickFormat = function(count, specifier) {
            return function(domain, count, specifier) {
                var precision, start = domain[0], stop = domain[domain.length - 1], step = tickStep(start, stop, null == count ? 10 : count);
                switch ((specifier = formatSpecifier(null == specifier ? ",f" : specifier)).type) {
                  case "s":
                    var value = Math.max(Math.abs(start), Math.abs(stop));
                    return null != specifier.precision || isNaN(precision = precisionPrefix(step, value)) || (specifier.precision = precision), 
                    exports.formatPrefix(specifier, value);

                  case "":
                  case "e":
                  case "g":
                  case "p":
                  case "r":
                    null != specifier.precision || isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop)))) || (specifier.precision = precision - ("e" === specifier.type));
                    break;

                  case "f":
                  case "%":
                    null != specifier.precision || isNaN(precision = precisionFixed(step)) || (specifier.precision = precision - 2 * ("%" === specifier.type));
                }
                return exports.format(specifier);
            }(domain(), count, specifier);
        }, scale.nice = function(count) {
            null == count && (count = 10);
            var step, d = domain(), i0 = 0, i1 = d.length - 1, start = d[i0], stop = d[i1];
            return stop < start && (step = start, start = stop, stop = step, step = i0, i0 = i1, 
            i1 = step), 0 < (step = tickIncrement(start, stop, count)) ? step = tickIncrement(start = Math.floor(start / step) * step, stop = Math.ceil(stop / step) * step, count) : step < 0 && (step = tickIncrement(start = Math.ceil(start * step) / step, stop = Math.floor(stop * step) / step, count)), 
            0 < step ? (d[i0] = Math.floor(start / step) * step, d[i1] = Math.ceil(stop / step) * step, 
            domain(d)) : step < 0 && (d[i0] = Math.ceil(start * step) / step, d[i1] = Math.floor(stop * step) / step, 
            domain(d)), scale;
        }, scale;
    }
    function nice(domain, interval) {
        var t, i0 = 0, i1 = (domain = domain.slice()).length - 1, x0 = domain[i0], x1 = domain[i1];
        return x1 < x0 && (t = i0, i0 = i1, i1 = t, t = x0, x0 = x1, x1 = t), domain[i0] = interval.floor(x0), 
        domain[i1] = interval.ceil(x1), domain;
    }
    function deinterpolate(a, b) {
        return (b = Math.log(b / a)) ? function(x) {
            return Math.log(x / a) / b;
        } : constant$9(b);
    }
    function reinterpolate$1(a, b) {
        return a < 0 ? function(t) {
            return -Math.pow(-b, t) * Math.pow(-a, 1 - t);
        } : function(t) {
            return Math.pow(b, t) * Math.pow(a, 1 - t);
        };
    }
    function pow10(x) {
        return isFinite(x) ? +("1e" + x) : x < 0 ? 0 : x;
    }
    function powp(base) {
        return 10 === base ? pow10 : base === Math.E ? Math.exp : function(x) {
            return Math.pow(base, x);
        };
    }
    function logp(base) {
        return base === Math.E ? Math.log : 10 === base && Math.log10 || 2 === base && Math.log2 || (base = Math.log(base), 
        function(x) {
            return Math.log(x) / base;
        });
    }
    function reflect(f) {
        return function(x) {
            return -f(-x);
        };
    }
    function raise$1(x, exponent) {
        return x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
    }
    function pow$1() {
        var exponent = 1, scale = continuous(function(a, b) {
            return (b = raise$1(b, exponent) - (a = raise$1(a, exponent))) ? function(x) {
                return (raise$1(x, exponent) - a) / b;
            } : constant$9(b);
        }, function(a, b) {
            return b = raise$1(b, exponent) - (a = raise$1(a, exponent)), function(t) {
                return raise$1(a + b * t, 1 / exponent);
            };
        }), domain = scale.domain;
        return scale.exponent = function(_) {
            return arguments.length ? (exponent = +_, domain(domain())) : exponent;
        }, scale.copy = function() {
            return copy(scale, pow$1().exponent(exponent));
        }, linearish(scale);
    }
    var t0$1 = new Date(), t1$1 = new Date();
    function newInterval(floori, offseti, count, field) {
        function interval(date) {
            return floori(date = new Date(+date)), date;
        }
        return (interval.floor = interval).ceil = function(date) {
            return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
        }, interval.round = function(date) {
            var d0 = interval(date), d1 = interval.ceil(date);
            return date - d0 < d1 - date ? d0 : d1;
        }, interval.offset = function(date, step) {
            return offseti(date = new Date(+date), null == step ? 1 : Math.floor(step)), date;
        }, interval.range = function(start, stop, step) {
            var previous, range = [];
            if (start = interval.ceil(start), step = null == step ? 1 : Math.floor(step), !(start < stop && 0 < step)) return range;
            for (;range.push(previous = new Date(+start)), offseti(start, step), floori(start), 
            previous < start && start < stop; ) ;
            return range;
        }, interval.filter = function(test) {
            return newInterval(function(date) {
                if (date <= date) for (;floori(date), !test(date); ) date.setTime(date - 1);
            }, function(date, step) {
                if (date <= date) if (step < 0) for (;++step <= 0; ) for (;offseti(date, -1), !test(date); ) ; else for (;0 <= --step; ) for (;offseti(date, 1), 
                !test(date); ) ;
            });
        }, count && (interval.count = function(start, end) {
            return t0$1.setTime(+start), t1$1.setTime(+end), floori(t0$1), floori(t1$1), Math.floor(count(t0$1, t1$1));
        }, interval.every = function(step) {
            return step = Math.floor(step), isFinite(step) && 0 < step ? 1 < step ? interval.filter(field ? function(d) {
                return field(d) % step == 0;
            } : function(d) {
                return interval.count(0, d) % step == 0;
            }) : interval : null;
        }), interval;
    }
    var millisecond = newInterval(function() {}, function(date, step) {
        date.setTime(+date + step);
    }, function(start, end) {
        return end - start;
    });
    millisecond.every = function(k) {
        return k = Math.floor(k), isFinite(k) && 0 < k ? 1 < k ? newInterval(function(date) {
            date.setTime(Math.floor(date / k) * k);
        }, function(date, step) {
            date.setTime(+date + step * k);
        }, function(start, end) {
            return (end - start) / k;
        }) : millisecond : null;
    };
    var milliseconds = millisecond.range, durationMinute$1 = 6e4, durationWeek$1 = 6048e5, second = newInterval(function(date) {
        date.setTime(1e3 * Math.floor(date / 1e3));
    }, function(date, step) {
        date.setTime(+date + 1e3 * step);
    }, function(start, end) {
        return (end - start) / 1e3;
    }, function(date) {
        return date.getUTCSeconds();
    }), seconds = second.range, minute = newInterval(function(date) {
        date.setTime(Math.floor(date / durationMinute$1) * durationMinute$1);
    }, function(date, step) {
        date.setTime(+date + step * durationMinute$1);
    }, function(start, end) {
        return (end - start) / durationMinute$1;
    }, function(date) {
        return date.getMinutes();
    }), minutes = minute.range, hour = newInterval(function(date) {
        var offset = date.getTimezoneOffset() * durationMinute$1 % 36e5;
        offset < 0 && (offset += 36e5), date.setTime(36e5 * Math.floor((+date - offset) / 36e5) + offset);
    }, function(date, step) {
        date.setTime(+date + 36e5 * step);
    }, function(start, end) {
        return (end - start) / 36e5;
    }, function(date) {
        return date.getHours();
    }), hours = hour.range, day = newInterval(function(date) {
        date.setHours(0, 0, 0, 0);
    }, function(date, step) {
        date.setDate(date.getDate() + step);
    }, function(start, end) {
        return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / 864e5;
    }, function(date) {
        return date.getDate() - 1;
    }), days = day.range;
    function weekday(i) {
        return newInterval(function(date) {
            date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7), date.setHours(0, 0, 0, 0);
        }, function(date, step) {
            date.setDate(date.getDate() + 7 * step);
        }, function(start, end) {
            return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute$1) / durationWeek$1;
        });
    }
    var sunday = weekday(0), monday = weekday(1), tuesday = weekday(2), wednesday = weekday(3), thursday = weekday(4), friday = weekday(5), saturday = weekday(6), sundays = sunday.range, mondays = monday.range, tuesdays = tuesday.range, wednesdays = wednesday.range, thursdays = thursday.range, fridays = friday.range, saturdays = saturday.range, month = newInterval(function(date) {
        date.setDate(1), date.setHours(0, 0, 0, 0);
    }, function(date, step) {
        date.setMonth(date.getMonth() + step);
    }, function(start, end) {
        return end.getMonth() - start.getMonth() + 12 * (end.getFullYear() - start.getFullYear());
    }, function(date) {
        return date.getMonth();
    }), months = month.range, year = newInterval(function(date) {
        date.setMonth(0, 1), date.setHours(0, 0, 0, 0);
    }, function(date, step) {
        date.setFullYear(date.getFullYear() + step);
    }, function(start, end) {
        return end.getFullYear() - start.getFullYear();
    }, function(date) {
        return date.getFullYear();
    });
    year.every = function(k) {
        return isFinite(k = Math.floor(k)) && 0 < k ? newInterval(function(date) {
            date.setFullYear(Math.floor(date.getFullYear() / k) * k), date.setMonth(0, 1), date.setHours(0, 0, 0, 0);
        }, function(date, step) {
            date.setFullYear(date.getFullYear() + step * k);
        }) : null;
    };
    var years = year.range, utcMinute = newInterval(function(date) {
        date.setUTCSeconds(0, 0);
    }, function(date, step) {
        date.setTime(+date + step * durationMinute$1);
    }, function(start, end) {
        return (end - start) / durationMinute$1;
    }, function(date) {
        return date.getUTCMinutes();
    }), utcMinutes = utcMinute.range, utcHour = newInterval(function(date) {
        date.setUTCMinutes(0, 0, 0);
    }, function(date, step) {
        date.setTime(+date + 36e5 * step);
    }, function(start, end) {
        return (end - start) / 36e5;
    }, function(date) {
        return date.getUTCHours();
    }), utcHours = utcHour.range, utcDay = newInterval(function(date) {
        date.setUTCHours(0, 0, 0, 0);
    }, function(date, step) {
        date.setUTCDate(date.getUTCDate() + step);
    }, function(start, end) {
        return (end - start) / 864e5;
    }, function(date) {
        return date.getUTCDate() - 1;
    }), utcDays = utcDay.range;
    function utcWeekday(i) {
        return newInterval(function(date) {
            date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7), date.setUTCHours(0, 0, 0, 0);
        }, function(date, step) {
            date.setUTCDate(date.getUTCDate() + 7 * step);
        }, function(start, end) {
            return (end - start) / durationWeek$1;
        });
    }
    var utcSunday = utcWeekday(0), utcMonday = utcWeekday(1), utcTuesday = utcWeekday(2), utcWednesday = utcWeekday(3), utcThursday = utcWeekday(4), utcFriday = utcWeekday(5), utcSaturday = utcWeekday(6), utcSundays = utcSunday.range, utcMondays = utcMonday.range, utcTuesdays = utcTuesday.range, utcWednesdays = utcWednesday.range, utcThursdays = utcThursday.range, utcFridays = utcFriday.range, utcSaturdays = utcSaturday.range, utcMonth = newInterval(function(date) {
        date.setUTCDate(1), date.setUTCHours(0, 0, 0, 0);
    }, function(date, step) {
        date.setUTCMonth(date.getUTCMonth() + step);
    }, function(start, end) {
        return end.getUTCMonth() - start.getUTCMonth() + 12 * (end.getUTCFullYear() - start.getUTCFullYear());
    }, function(date) {
        return date.getUTCMonth();
    }), utcMonths = utcMonth.range, utcYear = newInterval(function(date) {
        date.setUTCMonth(0, 1), date.setUTCHours(0, 0, 0, 0);
    }, function(date, step) {
        date.setUTCFullYear(date.getUTCFullYear() + step);
    }, function(start, end) {
        return end.getUTCFullYear() - start.getUTCFullYear();
    }, function(date) {
        return date.getUTCFullYear();
    });
    utcYear.every = function(k) {
        return isFinite(k = Math.floor(k)) && 0 < k ? newInterval(function(date) {
            date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k), date.setUTCMonth(0, 1), 
            date.setUTCHours(0, 0, 0, 0);
        }, function(date, step) {
            date.setUTCFullYear(date.getUTCFullYear() + step * k);
        }) : null;
    };
    var utcYears = utcYear.range;
    function localDate(d) {
        if (0 <= d.y && d.y < 100) {
            var date = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L);
            return date.setFullYear(d.y), date;
        }
        return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L);
    }
    function utcDate(d) {
        if (0 <= d.y && d.y < 100) {
            var date = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L));
            return date.setUTCFullYear(d.y), date;
        }
        return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L));
    }
    function newYear(y) {
        return {
            y: y,
            m: 0,
            d: 1,
            H: 0,
            M: 0,
            S: 0,
            L: 0
        };
    }
    function formatLocale$1(locale) {
        var locale_dateTime = locale.dateTime, locale_date = locale.date, locale_time = locale.time, locale_periods = locale.periods, locale_weekdays = locale.days, locale_shortWeekdays = locale.shortDays, locale_months = locale.months, locale_shortMonths = locale.shortMonths, periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths), formats = {
            a: function(d) {
                return locale_shortWeekdays[d.getDay()];
            },
            A: function(d) {
                return locale_weekdays[d.getDay()];
            },
            b: function(d) {
                return locale_shortMonths[d.getMonth()];
            },
            B: function(d) {
                return locale_months[d.getMonth()];
            },
            c: null,
            d: formatDayOfMonth,
            e: formatDayOfMonth,
            f: formatMicroseconds,
            H: formatHour24,
            I: formatHour12,
            j: formatDayOfYear,
            L: formatMilliseconds,
            m: formatMonthNumber,
            M: formatMinutes,
            p: function(d) {
                return locale_periods[+(12 <= d.getHours())];
            },
            Q: formatUnixTimestamp,
            s: formatUnixTimestampSeconds,
            S: formatSeconds,
            u: formatWeekdayNumberMonday,
            U: formatWeekNumberSunday,
            V: formatWeekNumberISO,
            w: formatWeekdayNumberSunday,
            W: formatWeekNumberMonday,
            x: null,
            X: null,
            y: formatYear,
            Y: formatFullYear,
            Z: formatZone,
            "%": formatLiteralPercent
        }, utcFormats = {
            a: function(d) {
                return locale_shortWeekdays[d.getUTCDay()];
            },
            A: function(d) {
                return locale_weekdays[d.getUTCDay()];
            },
            b: function(d) {
                return locale_shortMonths[d.getUTCMonth()];
            },
            B: function(d) {
                return locale_months[d.getUTCMonth()];
            },
            c: null,
            d: formatUTCDayOfMonth,
            e: formatUTCDayOfMonth,
            f: formatUTCMicroseconds,
            H: formatUTCHour24,
            I: formatUTCHour12,
            j: formatUTCDayOfYear,
            L: formatUTCMilliseconds,
            m: formatUTCMonthNumber,
            M: formatUTCMinutes,
            p: function(d) {
                return locale_periods[+(12 <= d.getUTCHours())];
            },
            Q: formatUnixTimestamp,
            s: formatUnixTimestampSeconds,
            S: formatUTCSeconds,
            u: formatUTCWeekdayNumberMonday,
            U: formatUTCWeekNumberSunday,
            V: formatUTCWeekNumberISO,
            w: formatUTCWeekdayNumberSunday,
            W: formatUTCWeekNumberMonday,
            x: null,
            X: null,
            y: formatUTCYear,
            Y: formatUTCFullYear,
            Z: formatUTCZone,
            "%": formatLiteralPercent
        }, parses = {
            a: function(d, string, i) {
                var n = shortWeekdayRe.exec(string.slice(i));
                return n ? (d.w = shortWeekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
            },
            A: function(d, string, i) {
                var n = weekdayRe.exec(string.slice(i));
                return n ? (d.w = weekdayLookup[n[0].toLowerCase()], i + n[0].length) : -1;
            },
            b: function(d, string, i) {
                var n = shortMonthRe.exec(string.slice(i));
                return n ? (d.m = shortMonthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
            },
            B: function(d, string, i) {
                var n = monthRe.exec(string.slice(i));
                return n ? (d.m = monthLookup[n[0].toLowerCase()], i + n[0].length) : -1;
            },
            c: function(d, string, i) {
                return parseSpecifier(d, locale_dateTime, string, i);
            },
            d: parseDayOfMonth,
            e: parseDayOfMonth,
            f: parseMicroseconds,
            H: parseHour24,
            I: parseHour24,
            j: parseDayOfYear,
            L: parseMilliseconds,
            m: parseMonthNumber,
            M: parseMinutes,
            p: function(d, string, i) {
                var n = periodRe.exec(string.slice(i));
                return n ? (d.p = periodLookup[n[0].toLowerCase()], i + n[0].length) : -1;
            },
            Q: parseUnixTimestamp,
            s: parseUnixTimestampSeconds,
            S: parseSeconds,
            u: parseWeekdayNumberMonday,
            U: parseWeekNumberSunday,
            V: parseWeekNumberISO,
            w: parseWeekdayNumberSunday,
            W: parseWeekNumberMonday,
            x: function(d, string, i) {
                return parseSpecifier(d, locale_date, string, i);
            },
            X: function(d, string, i) {
                return parseSpecifier(d, locale_time, string, i);
            },
            y: parseYear,
            Y: parseFullYear,
            Z: parseZone,
            "%": parseLiteralPercent
        };
        function newFormat(specifier, formats) {
            return function(date) {
                var c, pad, format, string = [], i = -1, j = 0, n = specifier.length;
                for (date instanceof Date || (date = new Date(+date)); ++i < n; ) 37 === specifier.charCodeAt(i) && (string.push(specifier.slice(j, i)), 
                null != (pad = pads[c = specifier.charAt(++i)]) ? c = specifier.charAt(++i) : pad = "e" === c ? " " : "0", 
                (format = formats[c]) && (c = format(date, pad)), string.push(c), j = i + 1);
                return string.push(specifier.slice(j, i)), string.join("");
            };
        }
        function newParse(specifier, newDate) {
            return function(string) {
                var week, day$$1, d = newYear(1900);
                if (parseSpecifier(d, specifier, string += "", 0) != string.length) return null;
                if ("Q" in d) return new Date(d.Q);
                if ("p" in d && (d.H = d.H % 12 + 12 * d.p), "V" in d) {
                    if (d.V < 1 || 53 < d.V) return null;
                    "w" in d || (d.w = 1), "Z" in d ? (week = 4 < (day$$1 = (week = utcDate(newYear(d.y))).getUTCDay()) || 0 === day$$1 ? utcMonday.ceil(week) : utcMonday(week), 
                    week = utcDay.offset(week, 7 * (d.V - 1)), d.y = week.getUTCFullYear(), d.m = week.getUTCMonth(), 
                    d.d = week.getUTCDate() + (d.w + 6) % 7) : (week = 4 < (day$$1 = (week = newDate(newYear(d.y))).getDay()) || 0 === day$$1 ? monday.ceil(week) : monday(week), 
                    week = day.offset(week, 7 * (d.V - 1)), d.y = week.getFullYear(), d.m = week.getMonth(), 
                    d.d = week.getDate() + (d.w + 6) % 7);
                } else ("W" in d || "U" in d) && ("w" in d || (d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0), 
                day$$1 = "Z" in d ? utcDate(newYear(d.y)).getUTCDay() : newDate(newYear(d.y)).getDay(), 
                d.m = 0, d.d = "W" in d ? (d.w + 6) % 7 + 7 * d.W - (day$$1 + 5) % 7 : d.w + 7 * d.U - (day$$1 + 6) % 7);
                return "Z" in d ? (d.H += d.Z / 100 | 0, d.M += d.Z % 100, utcDate(d)) : newDate(d);
            };
        }
        function parseSpecifier(d, specifier, string, j) {
            for (var c, parse, i = 0, n = specifier.length, m = string.length; i < n; ) {
                if (m <= j) return -1;
                if (37 === (c = specifier.charCodeAt(i++))) {
                    if (c = specifier.charAt(i++), !(parse = parses[c in pads ? specifier.charAt(i++) : c]) || (j = parse(d, string, j)) < 0) return -1;
                } else if (c != string.charCodeAt(j++)) return -1;
            }
            return j;
        }
        return formats.x = newFormat(locale_date, formats), formats.X = newFormat(locale_time, formats), 
        formats.c = newFormat(locale_dateTime, formats), utcFormats.x = newFormat(locale_date, utcFormats), 
        utcFormats.X = newFormat(locale_time, utcFormats), utcFormats.c = newFormat(locale_dateTime, utcFormats), 
        {
            format: function(specifier) {
                var f = newFormat(specifier += "", formats);
                return f.toString = function() {
                    return specifier;
                }, f;
            },
            parse: function(specifier) {
                var p = newParse(specifier += "", localDate);
                return p.toString = function() {
                    return specifier;
                }, p;
            },
            utcFormat: function(specifier) {
                var f = newFormat(specifier += "", utcFormats);
                return f.toString = function() {
                    return specifier;
                }, f;
            },
            utcParse: function(specifier) {
                var p = newParse(specifier, utcDate);
                return p.toString = function() {
                    return specifier;
                }, p;
            }
        };
    }
    var locale$1, pads = {
        "-": "",
        _: " ",
        0: "0"
    }, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g;
    function pad(value, fill, width) {
        var sign = value < 0 ? "-" : "", string = (sign ? -value : value) + "", length = string.length;
        return sign + (length < width ? new Array(width - length + 1).join(fill) + string : string);
    }
    function requote(s) {
        return s.replace(requoteRe, "\\$&");
    }
    function formatRe(names) {
        return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i");
    }
    function formatLookup(names) {
        for (var map = {}, i = -1, n = names.length; ++i < n; ) map[names[i].toLowerCase()] = i;
        return map;
    }
    function parseWeekdayNumberSunday(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 1));
        return n ? (d.w = +n[0], i + n[0].length) : -1;
    }
    function parseWeekdayNumberMonday(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 1));
        return n ? (d.u = +n[0], i + n[0].length) : -1;
    }
    function parseWeekNumberSunday(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 2));
        return n ? (d.U = +n[0], i + n[0].length) : -1;
    }
    function parseWeekNumberISO(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 2));
        return n ? (d.V = +n[0], i + n[0].length) : -1;
    }
    function parseWeekNumberMonday(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 2));
        return n ? (d.W = +n[0], i + n[0].length) : -1;
    }
    function parseFullYear(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 4));
        return n ? (d.y = +n[0], i + n[0].length) : -1;
    }
    function parseYear(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 2));
        return n ? (d.y = +n[0] + (68 < +n[0] ? 1900 : 2e3), i + n[0].length) : -1;
    }
    function parseZone(d, string, i) {
        var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6));
        return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1;
    }
    function parseMonthNumber(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 2));
        return n ? (d.m = n[0] - 1, i + n[0].length) : -1;
    }
    function parseDayOfMonth(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 2));
        return n ? (d.d = +n[0], i + n[0].length) : -1;
    }
    function parseDayOfYear(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 3));
        return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1;
    }
    function parseHour24(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 2));
        return n ? (d.H = +n[0], i + n[0].length) : -1;
    }
    function parseMinutes(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 2));
        return n ? (d.M = +n[0], i + n[0].length) : -1;
    }
    function parseSeconds(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 2));
        return n ? (d.S = +n[0], i + n[0].length) : -1;
    }
    function parseMilliseconds(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 3));
        return n ? (d.L = +n[0], i + n[0].length) : -1;
    }
    function parseMicroseconds(d, string, i) {
        var n = numberRe.exec(string.slice(i, i + 6));
        return n ? (d.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1;
    }
    function parseLiteralPercent(d, string, i) {
        var n = percentRe.exec(string.slice(i, i + 1));
        return n ? i + n[0].length : -1;
    }
    function parseUnixTimestamp(d, string, i) {
        var n = numberRe.exec(string.slice(i));
        return n ? (d.Q = +n[0], i + n[0].length) : -1;
    }
    function parseUnixTimestampSeconds(d, string, i) {
        var n = numberRe.exec(string.slice(i));
        return n ? (d.Q = 1e3 * +n[0], i + n[0].length) : -1;
    }
    function formatDayOfMonth(d, p) {
        return pad(d.getDate(), p, 2);
    }
    function formatHour24(d, p) {
        return pad(d.getHours(), p, 2);
    }
    function formatHour12(d, p) {
        return pad(d.getHours() % 12 || 12, p, 2);
    }
    function formatDayOfYear(d, p) {
        return pad(1 + day.count(year(d), d), p, 3);
    }
    function formatMilliseconds(d, p) {
        return pad(d.getMilliseconds(), p, 3);
    }
    function formatMicroseconds(d, p) {
        return formatMilliseconds(d, p) + "000";
    }
    function formatMonthNumber(d, p) {
        return pad(d.getMonth() + 1, p, 2);
    }
    function formatMinutes(d, p) {
        return pad(d.getMinutes(), p, 2);
    }
    function formatSeconds(d, p) {
        return pad(d.getSeconds(), p, 2);
    }
    function formatWeekdayNumberMonday(d) {
        var day$$1 = d.getDay();
        return 0 === day$$1 ? 7 : day$$1;
    }
    function formatWeekNumberSunday(d, p) {
        return pad(sunday.count(year(d), d), p, 2);
    }
    function formatWeekNumberISO(d, p) {
        var day$$1 = d.getDay();
        return d = 4 <= day$$1 || 0 === day$$1 ? thursday(d) : thursday.ceil(d), pad(thursday.count(year(d), d) + (4 === year(d).getDay()), p, 2);
    }
    function formatWeekdayNumberSunday(d) {
        return d.getDay();
    }
    function formatWeekNumberMonday(d, p) {
        return pad(monday.count(year(d), d), p, 2);
    }
    function formatYear(d, p) {
        return pad(d.getFullYear() % 100, p, 2);
    }
    function formatFullYear(d, p) {
        return pad(d.getFullYear() % 1e4, p, 4);
    }
    function formatZone(d) {
        var z = d.getTimezoneOffset();
        return (0 < z ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2);
    }
    function formatUTCDayOfMonth(d, p) {
        return pad(d.getUTCDate(), p, 2);
    }
    function formatUTCHour24(d, p) {
        return pad(d.getUTCHours(), p, 2);
    }
    function formatUTCHour12(d, p) {
        return pad(d.getUTCHours() % 12 || 12, p, 2);
    }
    function formatUTCDayOfYear(d, p) {
        return pad(1 + utcDay.count(utcYear(d), d), p, 3);
    }
    function formatUTCMilliseconds(d, p) {
        return pad(d.getUTCMilliseconds(), p, 3);
    }
    function formatUTCMicroseconds(d, p) {
        return formatUTCMilliseconds(d, p) + "000";
    }
    function formatUTCMonthNumber(d, p) {
        return pad(d.getUTCMonth() + 1, p, 2);
    }
    function formatUTCMinutes(d, p) {
        return pad(d.getUTCMinutes(), p, 2);
    }
    function formatUTCSeconds(d, p) {
        return pad(d.getUTCSeconds(), p, 2);
    }
    function formatUTCWeekdayNumberMonday(d) {
        var dow = d.getUTCDay();
        return 0 === dow ? 7 : dow;
    }
    function formatUTCWeekNumberSunday(d, p) {
        return pad(utcSunday.count(utcYear(d), d), p, 2);
    }
    function formatUTCWeekNumberISO(d, p) {
        var day$$1 = d.getUTCDay();
        return d = 4 <= day$$1 || 0 === day$$1 ? utcThursday(d) : utcThursday.ceil(d), pad(utcThursday.count(utcYear(d), d) + (4 === utcYear(d).getUTCDay()), p, 2);
    }
    function formatUTCWeekdayNumberSunday(d) {
        return d.getUTCDay();
    }
    function formatUTCWeekNumberMonday(d, p) {
        return pad(utcMonday.count(utcYear(d), d), p, 2);
    }
    function formatUTCYear(d, p) {
        return pad(d.getUTCFullYear() % 100, p, 2);
    }
    function formatUTCFullYear(d, p) {
        return pad(d.getUTCFullYear() % 1e4, p, 4);
    }
    function formatUTCZone() {
        return "+0000";
    }
    function formatLiteralPercent() {
        return "%";
    }
    function formatUnixTimestamp(d) {
        return +d;
    }
    function formatUnixTimestampSeconds(d) {
        return Math.floor(+d / 1e3);
    }
    function defaultLocale$1(definition) {
        return locale$1 = formatLocale$1(definition), exports.timeFormat = locale$1.format, 
        exports.timeParse = locale$1.parse, exports.utcFormat = locale$1.utcFormat, exports.utcParse = locale$1.utcParse, 
        locale$1;
    }
    defaultLocale$1({
        dateTime: "%x, %X",
        date: "%-m/%-d/%Y",
        time: "%-I:%M:%S %p",
        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" ]
    });
    var formatIso = Date.prototype.toISOString ? function(date) {
        return date.toISOString();
    } : exports.utcFormat("%Y-%m-%dT%H:%M:%S.%LZ");
    var parseIso = +new Date("2000-01-01T00:00:00.000Z") ? function(string) {
        var date = new Date(string);
        return isNaN(date) ? null : date;
    } : exports.utcParse("%Y-%m-%dT%H:%M:%S.%LZ"), durationSecond = 1e3, durationMinute = 60 * durationSecond, durationHour = 60 * durationMinute, durationDay = 24 * durationHour, durationWeek = 7 * durationDay, durationMonth = 30 * durationDay, durationYear = 365 * durationDay;
    function date$1(t) {
        return new Date(t);
    }
    function number$3(t) {
        return t instanceof Date ? +t : +new Date(+t);
    }
    function calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1, millisecond$$1, format) {
        var scale = continuous(deinterpolateLinear, reinterpolate), invert = scale.invert, domain = scale.domain, formatMillisecond = format(".%L"), formatSecond = format(":%S"), formatMinute = format("%I:%M"), formatHour = format("%I %p"), formatDay = format("%a %d"), formatWeek = format("%b %d"), formatMonth = format("%B"), formatYear = format("%Y"), tickIntervals = [ [ second$$1, 1, durationSecond ], [ second$$1, 5, 5 * durationSecond ], [ second$$1, 15, 15 * durationSecond ], [ second$$1, 30, 30 * durationSecond ], [ minute$$1, 1, durationMinute ], [ minute$$1, 5, 5 * durationMinute ], [ minute$$1, 15, 15 * durationMinute ], [ minute$$1, 30, 30 * durationMinute ], [ hour$$1, 1, durationHour ], [ hour$$1, 3, 3 * durationHour ], [ hour$$1, 6, 6 * durationHour ], [ hour$$1, 12, 12 * durationHour ], [ day$$1, 1, durationDay ], [ day$$1, 2, 2 * durationDay ], [ week, 1, durationWeek ], [ month$$1, 1, durationMonth ], [ month$$1, 3, 3 * durationMonth ], [ year$$1, 1, durationYear ] ];
        function tickFormat(date) {
            return (second$$1(date) < date ? formatMillisecond : minute$$1(date) < date ? formatSecond : hour$$1(date) < date ? formatMinute : day$$1(date) < date ? formatHour : month$$1(date) < date ? week(date) < date ? formatDay : formatWeek : year$$1(date) < date ? formatMonth : formatYear)(date);
        }
        function tickInterval(interval, start, stop, step) {
            if (null == interval && (interval = 10), "number" == typeof interval) {
                var target = Math.abs(stop - start) / interval, i = bisector(function(i) {
                    return i[2];
                }).right(tickIntervals, target);
                i === tickIntervals.length ? (step = tickStep(start / durationYear, stop / durationYear, interval), 
                interval = year$$1) : i ? (step = (i = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i])[1], 
                interval = i[0]) : (step = Math.max(tickStep(start, stop, interval), 1), interval = millisecond$$1);
            }
            return null == step ? interval : interval.every(step);
        }
        return scale.invert = function(y) {
            return new Date(invert(y));
        }, scale.domain = function(_) {
            return arguments.length ? domain(map$3.call(_, number$3)) : domain().map(date$1);
        }, scale.ticks = function(interval, step) {
            var t, d = domain(), t0 = d[0], t1 = d[d.length - 1], r = t1 < t0;
            return r && (t = t0, t0 = t1, t1 = t), t = (t = tickInterval(interval, t0, t1, step)) ? t.range(t0, t1 + 1) : [], 
            r ? t.reverse() : t;
        }, scale.tickFormat = function(count, specifier) {
            return null == specifier ? tickFormat : format(specifier);
        }, scale.nice = function(interval, step) {
            var d = domain();
            return (interval = tickInterval(interval, d[0], d[d.length - 1], step)) ? domain(nice(d, interval)) : scale;
        }, scale.copy = function() {
            return copy(scale, calendar(year$$1, month$$1, week, day$$1, hour$$1, minute$$1, second$$1, millisecond$$1, format));
        }, scale;
    }
    function colors(s) {
        return s.match(/.{6}/g).map(function(x) {
            return "#" + x;
        });
    }
    var category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"), category20b = colors("393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6"), category20c = colors("3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9"), category20 = colors("1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5"), cubehelix$3 = cubehelixLong(cubehelix(300, .5, 0), cubehelix(-240, .5, 1)), warm = cubehelixLong(cubehelix(-100, .75, .35), cubehelix(80, 1.5, .8)), cool = cubehelixLong(cubehelix(260, .75, .35), cubehelix(80, 1.5, .8)), rainbow = cubehelix();
    function ramp(range) {
        var n = range.length;
        return function(t) {
            return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))];
        };
    }
    var viridis = ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")), magma = ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")), inferno = ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")), plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));
    function constant$10(x) {
        return function() {
            return x;
        };
    }
    var abs$1 = Math.abs, atan2$1 = Math.atan2, cos$2 = Math.cos, max$2 = Math.max, min$1 = Math.min, sin$2 = Math.sin, sqrt$2 = Math.sqrt, epsilon$3 = 1e-12, pi$4 = Math.PI, halfPi$3 = pi$4 / 2, tau$4 = 2 * pi$4;
    function asin$1(x) {
        return 1 <= x ? halfPi$3 : x <= -1 ? -halfPi$3 : Math.asin(x);
    }
    function arcInnerRadius(d) {
        return d.innerRadius;
    }
    function arcOuterRadius(d) {
        return d.outerRadius;
    }
    function arcStartAngle(d) {
        return d.startAngle;
    }
    function arcEndAngle(d) {
        return d.endAngle;
    }
    function arcPadAngle(d) {
        return d && d.padAngle;
    }
    function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
        var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt$2(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt$2(max$2(0, r * r * d2 - D * D)), cx0 = (D * dy - dx * d) / d2, cy0 = (-D * dx - dy * d) / d2, cx1 = (D * dy + dx * d) / d2, cy1 = (-D * dx + dy * d) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
        return dx1 * dx1 + dy1 * dy1 < dx0 * dx0 + dy0 * dy0 && (cx0 = cx1, cy0 = cy1), 
        {
            cx: cx0,
            cy: cy0,
            x01: -ox,
            y01: -oy,
            x11: cx0 * (r1 / r - 1),
            y11: cy0 * (r1 / r - 1)
        };
    }
    function Linear(context) {
        this._context = context;
    }
    function curveLinear(context) {
        return new Linear(context);
    }
    function x$3(p) {
        return p[0];
    }
    function y$3(p) {
        return p[1];
    }
    function line() {
        var x$$1 = x$3, y$$1 = y$3, defined = constant$10(!0), context = null, curve = curveLinear, output = null;
        function line(data) {
            var i, d, buffer, n = data.length, defined0 = !1;
            for (null == context && (output = curve(buffer = path())), i = 0; i <= n; ++i) !(i < n && defined(d = data[i], i, data)) === defined0 && ((defined0 = !defined0) ? output.lineStart() : output.lineEnd()), 
            defined0 && output.point(+x$$1(d, i, data), +y$$1(d, i, data));
            if (buffer) return output = null, buffer + "" || null;
        }
        return line.x = function(_) {
            return arguments.length ? (x$$1 = "function" == typeof _ ? _ : constant$10(+_), 
            line) : x$$1;
        }, line.y = function(_) {
            return arguments.length ? (y$$1 = "function" == typeof _ ? _ : constant$10(+_), 
            line) : y$$1;
        }, line.defined = function(_) {
            return arguments.length ? (defined = "function" == typeof _ ? _ : constant$10(!!_), 
            line) : defined;
        }, line.curve = function(_) {
            return arguments.length ? (curve = _, null != context && (output = curve(context)), 
            line) : curve;
        }, line.context = function(_) {
            return arguments.length ? (null == _ ? context = output = null : output = curve(context = _), 
            line) : context;
        }, line;
    }
    function area$2() {
        var x0 = x$3, x1 = null, y0 = constant$10(0), y1 = y$3, defined = constant$10(!0), context = null, curve = curveLinear, output = null;
        function area(data) {
            var i, j, k, d, buffer, n = data.length, defined0 = !1, x0z = new Array(n), y0z = new Array(n);
            for (null == context && (output = curve(buffer = path())), i = 0; i <= n; ++i) {
                if (!(i < n && defined(d = data[i], i, data)) === defined0) if (defined0 = !defined0) j = i, 
                output.areaStart(), output.lineStart(); else {
                    for (output.lineEnd(), output.lineStart(), k = i - 1; j <= k; --k) output.point(x0z[k], y0z[k]);
                    output.lineEnd(), output.areaEnd();
                }
                defined0 && (x0z[i] = +x0(d, i, data), y0z[i] = +y0(d, i, data), output.point(x1 ? +x1(d, i, data) : x0z[i], y1 ? +y1(d, i, data) : y0z[i]));
            }
            if (buffer) return output = null, buffer + "" || null;
        }
        function arealine() {
            return line().defined(defined).curve(curve).context(context);
        }
        return area.x = function(_) {
            return arguments.length ? (x0 = "function" == typeof _ ? _ : constant$10(+_), x1 = null, 
            area) : x0;
        }, area.x0 = function(_) {
            return arguments.length ? (x0 = "function" == typeof _ ? _ : constant$10(+_), area) : x0;
        }, area.x1 = function(_) {
            return arguments.length ? (x1 = null == _ ? null : "function" == typeof _ ? _ : constant$10(+_), 
            area) : x1;
        }, area.y = function(_) {
            return arguments.length ? (y0 = "function" == typeof _ ? _ : constant$10(+_), y1 = null, 
            area) : y0;
        }, area.y0 = function(_) {
            return arguments.length ? (y0 = "function" == typeof _ ? _ : constant$10(+_), area) : y0;
        }, area.y1 = function(_) {
            return arguments.length ? (y1 = null == _ ? null : "function" == typeof _ ? _ : constant$10(+_), 
            area) : y1;
        }, area.lineX0 = area.lineY0 = function() {
            return arealine().x(x0).y(y0);
        }, area.lineY1 = function() {
            return arealine().x(x0).y(y1);
        }, area.lineX1 = function() {
            return arealine().x(x1).y(y0);
        }, area.defined = function(_) {
            return arguments.length ? (defined = "function" == typeof _ ? _ : constant$10(!!_), 
            area) : defined;
        }, area.curve = function(_) {
            return arguments.length ? (curve = _, null != context && (output = curve(context)), 
            area) : curve;
        }, area.context = function(_) {
            return arguments.length ? (null == _ ? context = output = null : output = curve(context = _), 
            area) : context;
        }, area;
    }
    function descending$1(a, b) {
        return b < a ? -1 : a < b ? 1 : a <= b ? 0 : NaN;
    }
    function identity$7(d) {
        return d;
    }
    Linear.prototype = {
        areaStart: function() {
            this._line = 0;
        },
        areaEnd: function() {
            this._line = NaN;
        },
        lineStart: function() {
            this._point = 0;
        },
        lineEnd: function() {
            (this._line || 0 !== this._line && 1 === this._point) && this._context.closePath(), 
            this._line = 1 - this._line;
        },
        point: function(x, y) {
            switch (x = +x, y = +y, this._point) {
              case 0:
                this._point = 1, this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
                break;

              case 1:
                this._point = 2;

              default:
                this._context.lineTo(x, y);
            }
        }
    };
    var curveRadialLinear = curveRadial(curveLinear);
    function Radial(curve) {
        this._curve = curve;
    }
    function curveRadial(curve) {
        function radial(context) {
            return new Radial(curve(context));
        }
        return radial._curve = curve, radial;
    }
    function lineRadial(l) {
        var c = l.curve;
        return l.angle = l.x, delete l.x, l.radius = l.y, delete l.y, l.curve = function(_) {
            return arguments.length ? c(curveRadial(_)) : c()._curve;
        }, l;
    }
    function lineRadial$1() {
        return lineRadial(line().curve(curveRadialLinear));
    }
    function areaRadial() {
        var a = area$2().curve(curveRadialLinear), c = a.curve, x0 = a.lineX0, x1 = a.lineX1, y0 = a.lineY0, y1 = a.lineY1;
        return a.angle = a.x, delete a.x, a.startAngle = a.x0, delete a.x0, a.endAngle = a.x1, 
        delete a.x1, a.radius = a.y, delete a.y, a.innerRadius = a.y0, delete a.y0, a.outerRadius = a.y1, 
        delete a.y1, a.lineStartAngle = function() {
            return lineRadial(x0());
        }, delete a.lineX0, a.lineEndAngle = function() {
            return lineRadial(x1());
        }, delete a.lineX1, a.lineInnerRadius = function() {
            return lineRadial(y0());
        }, delete a.lineY0, a.lineOuterRadius = function() {
            return lineRadial(y1());
        }, delete a.lineY1, a.curve = function(_) {
            return arguments.length ? c(curveRadial(_)) : c()._curve;
        }, a;
    }
    function pointRadial(x, y) {
        return [ (y = +y) * Math.cos(x -= Math.PI / 2), y * Math.sin(x) ];
    }
    Radial.prototype = {
        areaStart: function() {
            this._curve.areaStart();
        },
        areaEnd: function() {
            this._curve.areaEnd();
        },
        lineStart: function() {
            this._curve.lineStart();
        },
        lineEnd: function() {
            this._curve.lineEnd();
        },
        point: function(a, r) {
            this._curve.point(r * Math.sin(a), r * -Math.cos(a));
        }
    };
    var slice$6 = Array.prototype.slice;
    function linkSource(d) {
        return d.source;
    }
    function linkTarget(d) {
        return d.target;
    }
    function link$2(curve) {
        var source = linkSource, target = linkTarget, x$$1 = x$3, y$$1 = y$3, context = null;
        function link() {
            var buffer, argv = slice$6.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv);
            if (context || (context = buffer = path()), curve(context, +x$$1.apply(this, (argv[0] = s, 
            argv)), +y$$1.apply(this, argv), +x$$1.apply(this, (argv[0] = t, argv)), +y$$1.apply(this, argv)), 
            buffer) return context = null, buffer + "" || null;
        }
        return link.source = function(_) {
            return arguments.length ? (source = _, link) : source;
        }, link.target = function(_) {
            return arguments.length ? (target = _, link) : target;
        }, link.x = function(_) {
            return arguments.length ? (x$$1 = "function" == typeof _ ? _ : constant$10(+_), 
            link) : x$$1;
        }, link.y = function(_) {
            return arguments.length ? (y$$1 = "function" == typeof _ ? _ : constant$10(+_), 
            link) : y$$1;
        }, link.context = function(_) {
            return arguments.length ? (context = null == _ ? null : _, link) : context;
        }, link;
    }
    function curveHorizontal(context, x0, y0, x1, y1) {
        context.moveTo(x0, y0), context.bezierCurveTo(x0 = (x0 + x1) / 2, y0, x0, y1, x1, y1);
    }
    function curveVertical(context, x0, y0, x1, y1) {
        context.moveTo(x0, y0), context.bezierCurveTo(x0, y0 = (y0 + y1) / 2, x1, y0, x1, y1);
    }
    function curveRadial$1(context, x0, y0, x1, y1) {
        var p0 = pointRadial(x0, y0), p1 = pointRadial(x0, y0 = (y0 + y1) / 2), p2 = pointRadial(x1, y0), p3 = pointRadial(x1, y1);
        context.moveTo(p0[0], p0[1]), context.bezierCurveTo(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
    }
    var circle$2 = {
        draw: function(context, size) {
            var r = Math.sqrt(size / pi$4);
            context.moveTo(r, 0), context.arc(0, 0, r, 0, tau$4);
        }
    }, cross$2 = {
        draw: function(context, size) {
            var r = Math.sqrt(size / 5) / 2;
            context.moveTo(-3 * r, -r), context.lineTo(-r, -r), context.lineTo(-r, -3 * r), 
            context.lineTo(r, -3 * r), context.lineTo(r, -r), context.lineTo(3 * r, -r), context.lineTo(3 * r, r), 
            context.lineTo(r, r), context.lineTo(r, 3 * r), context.lineTo(-r, 3 * r), context.lineTo(-r, r), 
            context.lineTo(-3 * r, r), context.closePath();
        }
    }, tan30 = Math.sqrt(1 / 3), tan30_2 = 2 * tan30, diamond = {
        draw: function(context, size) {
            var y = Math.sqrt(size / tan30_2), x = y * tan30;
            context.moveTo(0, -y), context.lineTo(x, 0), context.lineTo(0, y), context.lineTo(-x, 0), 
            context.closePath();
        }
    }, kr = Math.sin(pi$4 / 10) / Math.sin(7 * pi$4 / 10), kx = Math.sin(tau$4 / 10) * kr, ky = -Math.cos(tau$4 / 10) * kr, star = {
        draw: function(context, size) {
            var r = Math.sqrt(.8908130915292852 * size), x = kx * r, y = ky * r;
            context.moveTo(0, -r), context.lineTo(x, y);
            for (var i = 1; i < 5; ++i) {
                var a = tau$4 * i / 5, c = Math.cos(a), s = Math.sin(a);
                context.lineTo(s * r, -c * r), context.lineTo(c * x - s * y, s * x + c * y);
            }
            context.closePath();
        }
    }, square = {
        draw: function(context, size) {
            var w = Math.sqrt(size), x = -w / 2;
            context.rect(x, x, w, w);
        }
    }, sqrt3 = Math.sqrt(3), triangle = {
        draw: function(context, size) {
            var y = -Math.sqrt(size / (3 * sqrt3));
            context.moveTo(0, 2 * y), context.lineTo(-sqrt3 * y, -y), context.lineTo(sqrt3 * y, -y), 
            context.closePath();
        }
    }, c = -.5, s = Math.sqrt(3) / 2, k = 1 / Math.sqrt(12), a = 3 * (k / 2 + 1), wye = {
        draw: function(context, size) {
            var r = Math.sqrt(size / a), x0 = r / 2, y0 = r * k, x1 = x0, y1 = r * k + r, x2 = -x1, y2 = y1;
            context.moveTo(x0, y0), context.lineTo(x1, y1), context.lineTo(x2, y2), context.lineTo(c * x0 - s * y0, s * x0 + c * y0), 
            context.lineTo(c * x1 - s * y1, s * x1 + c * y1), context.lineTo(c * x2 - s * y2, s * x2 + c * y2), 
            context.lineTo(c * x0 + s * y0, c * y0 - s * x0), context.lineTo(c * x1 + s * y1, c * y1 - s * x1), 
            context.lineTo(c * x2 + s * y2, c * y2 - s * x2), context.closePath();
        }
    }, symbols = [ circle$2, cross$2, diamond, square, star, triangle, wye ];
    function noop$2() {}
    function point$2(that, x, y) {
        that._context.bezierCurveTo((2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x) / 6, (that._y0 + 4 * that._y1 + y) / 6);
    }
    function Basis(context) {
        this._context = context;
    }
    function BasisClosed(context) {
        this._context = context;
    }
    function BasisOpen(context) {
        this._context = context;
    }
    function Bundle(context, beta) {
        this._basis = new Basis(context), this._beta = beta;
    }
    Basis.prototype = {
        areaStart: function() {
            this._line = 0;
        },
        areaEnd: function() {
            this._line = NaN;
        },
        lineStart: function() {
            this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
        },
        lineEnd: function() {
            switch (this._point) {
              case 3:
                point$2(this, this._x1, this._y1);

              case 2:
                this._context.lineTo(this._x1, this._y1);
            }
            (this._line || 0 !== this._line && 1 === this._point) && this._context.closePath(), 
            this._line = 1 - this._line;
        },
        point: function(x, y) {
            switch (x = +x, y = +y, this._point) {
              case 0:
                this._point = 1, this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
                break;

              case 1:
                this._point = 2;
                break;

              case 2:
                this._point = 3, this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6);

              default:
                point$2(this, x, y);
            }
            this._x0 = this._x1, this._x1 = x, this._y0 = this._y1, this._y1 = y;
        }
    }, BasisClosed.prototype = {
        areaStart: noop$2,
        areaEnd: noop$2,
        lineStart: function() {
            this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN, 
            this._point = 0;
        },
        lineEnd: function() {
            switch (this._point) {
              case 1:
                this._context.moveTo(this._x2, this._y2), this._context.closePath();
                break;

              case 2:
                this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3), 
                this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3), 
                this._context.closePath();
                break;

              case 3:
                this.point(this._x2, this._y2), this.point(this._x3, this._y3), this.point(this._x4, this._y4);
            }
        },
        point: function(x, y) {
            switch (x = +x, y = +y, this._point) {
              case 0:
                this._point = 1, this._x2 = x, this._y2 = y;
                break;

              case 1:
                this._point = 2, this._x3 = x, this._y3 = y;
                break;

              case 2:
                this._point = 3, this._x4 = x, this._y4 = y, this._context.moveTo((this._x0 + 4 * this._x1 + x) / 6, (this._y0 + 4 * this._y1 + y) / 6);
                break;

              default:
                point$2(this, x, y);
            }
            this._x0 = this._x1, this._x1 = x, this._y0 = this._y1, this._y1 = y;
        }
    }, BasisOpen.prototype = {
        areaStart: function() {
            this._line = 0;
        },
        areaEnd: function() {
            this._line = NaN;
        },
        lineStart: function() {
            this._x0 = this._x1 = this._y0 = this._y1 = NaN, this._point = 0;
        },
        lineEnd: function() {
            (this._line || 0 !== this._line && 3 === this._point) && this._context.closePath(), 
            this._line = 1 - this._line;
        },
        point: function(x, y) {
            switch (x = +x, y = +y, this._point) {
              case 0:
                this._point = 1;
                break;

              case 1:
                this._point = 2;
                break;

              case 2:
                this._point = 3;
                var x0 = (this._x0 + 4 * this._x1 + x) / 6, y0 = (this._y0 + 4 * this._y1 + y) / 6;
                this._line ? this._context.lineTo(x0, y0) : this._context.moveTo(x0, y0);
                break;

              case 3:
                this._point = 4;

              default:
                point$2(this, x, y);
            }
            this._x0 = this._x1, this._x1 = x, this._y0 = this._y1, this._y1 = y;
        }
    }, Bundle.prototype = {
        lineStart: function() {
            this._x = [], this._y = [], this._basis.lineStart();
        },
        lineEnd: function() {
            var x = this._x, y = this._y, j = x.length - 1;
            if (0 < j) for (var t, x0 = x[0], y0 = y[0], dx = x[j] - x0, dy = y[j] - y0, i = -1; ++i <= j; ) t = i / j, 
            this._basis.point(this._beta * x[i] + (1 - this._beta) * (x0 + t * dx), this._beta * y[i] + (1 - this._beta) * (y0 + t * dy));
            this._x = this._y = null, this._basis.lineEnd();
        },
        point: function(x, y) {
            this._x.push(+x), this._y.push(+y);
        }
    };
    var bundle = function custom(beta) {
        function bundle(context) {
            return 1 === beta ? new Basis(context) : new Bundle(context, beta);
        }
        return bundle.beta = function(beta) {
            return custom(+beta);
        }, bundle;
    }(.85);
    function point$3(that, x, y) {
        that._context.bezierCurveTo(that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x), that._y2 + that._k * (that._y1 - y), that._x2, that._y2);
    }
    function Cardinal(context, tension) {
        this._context = context, this._k = (1 - tension) / 6;
    }
    Cardinal.prototype = {
        areaStart: function() {
            this._line = 0;
        },
        areaEnd: function() {
            this._line = NaN;
        },
        lineStart: function() {
            this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
        },
        lineEnd: function() {
            switch (this._point) {
              case 2:
                this._context.lineTo(this._x2, this._y2);
                break;

              case 3:
                point$3(this, this._x1, this._y1);
            }
            (this._line || 0 !== this._line && 1 === this._point) && this._context.closePath(), 
            this._line = 1 - this._line;
        },
        point: function(x, y) {
            switch (x = +x, y = +y, this._point) {
              case 0:
                this._point = 1, this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
                break;

              case 1:
                this._point = 2, this._x1 = x, this._y1 = y;
                break;

              case 2:
                this._point = 3;

              default:
                point$3(this, x, y);
            }
            this._x0 = this._x1, this._x1 = this._x2, this._x2 = x, this._y0 = this._y1, this._y1 = this._y2, 
            this._y2 = y;
        }
    };
    var cardinal = function custom(tension) {
        function cardinal(context) {
            return new Cardinal(context, tension);
        }
        return cardinal.tension = function(tension) {
            return custom(+tension);
        }, cardinal;
    }(0);
    function CardinalClosed(context, tension) {
        this._context = context, this._k = (1 - tension) / 6;
    }
    CardinalClosed.prototype = {
        areaStart: noop$2,
        areaEnd: noop$2,
        lineStart: function() {
            this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN, 
            this._point = 0;
        },
        lineEnd: function() {
            switch (this._point) {
              case 1:
                this._context.moveTo(this._x3, this._y3), this._context.closePath();
                break;

              case 2:
                this._context.lineTo(this._x3, this._y3), this._context.closePath();
                break;

              case 3:
                this.point(this._x3, this._y3), this.point(this._x4, this._y4), this.point(this._x5, this._y5);
            }
        },
        point: function(x, y) {
            switch (x = +x, y = +y, this._point) {
              case 0:
                this._point = 1, this._x3 = x, this._y3 = y;
                break;

              case 1:
                this._point = 2, this._context.moveTo(this._x4 = x, this._y4 = y);
                break;

              case 2:
                this._point = 3, this._x5 = x, this._y5 = y;
                break;

              default:
                point$3(this, x, y);
            }
            this._x0 = this._x1, this._x1 = this._x2, this._x2 = x, this._y0 = this._y1, this._y1 = this._y2, 
            this._y2 = y;
        }
    };
    var cardinalClosed = function custom(tension) {
        function cardinal$$1(context) {
            return new CardinalClosed(context, tension);
        }
        return cardinal$$1.tension = function(tension) {
            return custom(+tension);
        }, cardinal$$1;
    }(0);
    function CardinalOpen(context, tension) {
        this._context = context, this._k = (1 - tension) / 6;
    }
    CardinalOpen.prototype = {
        areaStart: function() {
            this._line = 0;
        },
        areaEnd: function() {
            this._line = NaN;
        },
        lineStart: function() {
            this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._point = 0;
        },
        lineEnd: function() {
            (this._line || 0 !== this._line && 3 === this._point) && this._context.closePath(), 
            this._line = 1 - this._line;
        },
        point: function(x, y) {
            switch (x = +x, y = +y, this._point) {
              case 0:
                this._point = 1;
                break;

              case 1:
                this._point = 2;
                break;

              case 2:
                this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
                break;

              case 3:
                this._point = 4;

              default:
                point$3(this, x, y);
            }
            this._x0 = this._x1, this._x1 = this._x2, this._x2 = x, this._y0 = this._y1, this._y1 = this._y2, 
            this._y2 = y;
        }
    };
    var cardinalOpen = function custom(tension) {
        function cardinal$$1(context) {
            return new CardinalOpen(context, tension);
        }
        return cardinal$$1.tension = function(tension) {
            return custom(+tension);
        }, cardinal$$1;
    }(0);
    function point$4(that, x, y) {
        var x1 = that._x1, y1 = that._y1, x2 = that._x2, y2 = that._y2;
        if (that._l01_a > epsilon$3) {
            var a = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a);
            x1 = (x1 * a - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n, y1 = (y1 * a - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n;
        }
        if (that._l23_a > epsilon$3) {
            var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m = 3 * that._l23_a * (that._l23_a + that._l12_a);
            x2 = (x2 * b + that._x1 * that._l23_2a - x * that._l12_2a) / m, y2 = (y2 * b + that._y1 * that._l23_2a - y * that._l12_2a) / m;
        }
        that._context.bezierCurveTo(x1, y1, x2, y2, that._x2, that._y2);
    }
    function CatmullRom(context, alpha) {
        this._context = context, this._alpha = alpha;
    }
    CatmullRom.prototype = {
        areaStart: function() {
            this._line = 0;
        },
        areaEnd: function() {
            this._line = NaN;
        },
        lineStart: function() {
            this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
        },
        lineEnd: function() {
            switch (this._point) {
              case 2:
                this._context.lineTo(this._x2, this._y2);
                break;

              case 3:
                this.point(this._x2, this._y2);
            }
            (this._line || 0 !== this._line && 1 === this._point) && this._context.closePath(), 
            this._line = 1 - this._line;
        },
        point: function(x, y) {
            if (x = +x, y = +y, this._point) {
                var x23 = this._x2 - x, y23 = this._y2 - y;
                this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
            }
            switch (this._point) {
              case 0:
                this._point = 1, this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
                break;

              case 1:
                this._point = 2;
                break;

              case 2:
                this._point = 3;

              default:
                point$4(this, x, y);
            }
            this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, 
            this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = x, 
            this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
        }
    };
    var catmullRom = function custom(alpha) {
        function catmullRom(context) {
            return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0);
        }
        return catmullRom.alpha = function(alpha) {
            return custom(+alpha);
        }, catmullRom;
    }(.5);
    function CatmullRomClosed(context, alpha) {
        this._context = context, this._alpha = alpha;
    }
    CatmullRomClosed.prototype = {
        areaStart: noop$2,
        areaEnd: noop$2,
        lineStart: function() {
            this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN, 
            this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
        },
        lineEnd: function() {
            switch (this._point) {
              case 1:
                this._context.moveTo(this._x3, this._y3), this._context.closePath();
                break;

              case 2:
                this._context.lineTo(this._x3, this._y3), this._context.closePath();
                break;

              case 3:
                this.point(this._x3, this._y3), this.point(this._x4, this._y4), this.point(this._x5, this._y5);
            }
        },
        point: function(x, y) {
            if (x = +x, y = +y, this._point) {
                var x23 = this._x2 - x, y23 = this._y2 - y;
                this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
            }
            switch (this._point) {
              case 0:
                this._point = 1, this._x3 = x, this._y3 = y;
                break;

              case 1:
                this._point = 2, this._context.moveTo(this._x4 = x, this._y4 = y);
                break;

              case 2:
                this._point = 3, this._x5 = x, this._y5 = y;
                break;

              default:
                point$4(this, x, y);
            }
            this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, 
            this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = x, 
            this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
        }
    };
    var catmullRomClosed = function custom(alpha) {
        function catmullRom$$1(context) {
            return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0);
        }
        return catmullRom$$1.alpha = function(alpha) {
            return custom(+alpha);
        }, catmullRom$$1;
    }(.5);
    function CatmullRomOpen(context, alpha) {
        this._context = context, this._alpha = alpha;
    }
    CatmullRomOpen.prototype = {
        areaStart: function() {
            this._line = 0;
        },
        areaEnd: function() {
            this._line = NaN;
        },
        lineStart: function() {
            this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN, this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0;
        },
        lineEnd: function() {
            (this._line || 0 !== this._line && 3 === this._point) && this._context.closePath(), 
            this._line = 1 - this._line;
        },
        point: function(x, y) {
            if (x = +x, y = +y, this._point) {
                var x23 = this._x2 - x, y23 = this._y2 - y;
                this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha));
            }
            switch (this._point) {
              case 0:
                this._point = 1;
                break;

              case 1:
                this._point = 2;
                break;

              case 2:
                this._point = 3, this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2);
                break;

              case 3:
                this._point = 4;

              default:
                point$4(this, x, y);
            }
            this._l01_a = this._l12_a, this._l12_a = this._l23_a, this._l01_2a = this._l12_2a, 
            this._l12_2a = this._l23_2a, this._x0 = this._x1, this._x1 = this._x2, this._x2 = x, 
            this._y0 = this._y1, this._y1 = this._y2, this._y2 = y;
        }
    };
    var catmullRomOpen = function custom(alpha) {
        function catmullRom$$1(context) {
            return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0);
        }
        return catmullRom$$1.alpha = function(alpha) {
            return custom(+alpha);
        }, catmullRom$$1;
    }(.5);
    function LinearClosed(context) {
        this._context = context;
    }
    function sign$1(x) {
        return x < 0 ? -1 : 1;
    }
    function slope3(that, x2, y2) {
        var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1);
        return (sign$1(s0) + sign$1(s1)) * Math.min(Math.abs(s0), Math.abs(s1), .5 * Math.abs(p)) || 0;
    }
    function slope2(that, t) {
        var h = that._x1 - that._x0;
        return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t;
    }
    function point$5(that, t0, t1) {
        var x0 = that._x0, y0 = that._y0, x1 = that._x1, y1 = that._y1, dx = (x1 - x0) / 3;
        that._context.bezierCurveTo(x0 + dx, y0 + dx * t0, x1 - dx, y1 - dx * t1, x1, y1);
    }
    function MonotoneX(context) {
        this._context = context;
    }
    function MonotoneY(context) {
        this._context = new ReflectContext(context);
    }
    function ReflectContext(context) {
        this._context = context;
    }
    function Natural(context) {
        this._context = context;
    }
    function controlPoints(x) {
        var i, m, n = x.length - 1, a = new Array(n), b = new Array(n), r = new Array(n);
        for (b[a[0] = 0] = 2, r[0] = x[0] + 2 * x[1], i = 1; i < n - 1; ++i) a[i] = 1, b[i] = 4, 
        r[i] = 4 * x[i] + 2 * x[i + 1];
        for (a[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x[n - 1] + x[n], i = 1; i < n; ++i) m = a[i] / b[i - 1], 
        b[i] -= m, r[i] -= m * r[i - 1];
        for (a[n - 1] = r[n - 1] / b[n - 1], i = n - 2; 0 <= i; --i) a[i] = (r[i] - a[i + 1]) / b[i];
        for (b[n - 1] = (x[n] + a[n - 1]) / 2, i = 0; i < n - 1; ++i) b[i] = 2 * x[i + 1] - a[i + 1];
        return [ a, b ];
    }
    function Step(context, t) {
        this._context = context, this._t = t;
    }
    function none$1(series, order) {
        if (1 < (n = series.length)) for (var j, s0, n, i = 1, s1 = series[order[0]], m = s1.length; i < n; ++i) for (s0 = s1, 
        s1 = series[order[i]], j = 0; j < m; ++j) s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1];
    }
    function none$2(series) {
        for (var n = series.length, o = new Array(n); 0 <= --n; ) o[n] = n;
        return o;
    }
    function stackValue(d, key) {
        return d[key];
    }
    function ascending$2(series) {
        var sums = series.map(sum$2);
        return none$2(series).sort(function(a, b) {
            return sums[a] - sums[b];
        });
    }
    function sum$2(series) {
        for (var v, s = 0, i = -1, n = series.length; ++i < n; ) (v = +series[i][1]) && (s += v);
        return s;
    }
    function constant$11(x) {
        return function() {
            return x;
        };
    }
    function x$4(d) {
        return d[0];
    }
    function y$4(d) {
        return d[1];
    }
    function RedBlackTree() {
        this._ = null;
    }
    function RedBlackNode(node) {
        node.U = node.C = node.L = node.R = node.P = node.N = null;
    }
    function RedBlackRotateLeft(tree, node) {
        var p = node, q = node.R, parent = p.U;
        parent ? parent.L === p ? parent.L = q : parent.R = q : tree._ = q, q.U = parent, 
        p.U = q, p.R = q.L, p.R && (p.R.U = p), q.L = p;
    }
    function RedBlackRotateRight(tree, node) {
        var p = node, q = node.L, parent = p.U;
        parent ? parent.L === p ? parent.L = q : parent.R = q : tree._ = q, q.U = parent, 
        p.U = q, p.L = q.R, p.L && (p.L.U = p), q.R = p;
    }
    function RedBlackFirst(node) {
        for (;node.L; ) node = node.L;
        return node;
    }
    function createEdge(left, right, v0, v1) {
        var edge = [ null, null ], index = edges.push(edge) - 1;
        return edge.left = left, edge.right = right, v0 && setEdgeEnd(edge, left, right, v0), 
        v1 && setEdgeEnd(edge, right, left, v1), cells[left.index].halfedges.push(index), 
        cells[right.index].halfedges.push(index), edge;
    }
    function createBorderEdge(left, v0, v1) {
        var edge = [ v0, v1 ];
        return edge.left = left, edge;
    }
    function setEdgeEnd(edge, left, right, vertex) {
        edge[0] || edge[1] ? edge.left === right ? edge[1] = vertex : edge[0] = vertex : (edge[0] = vertex, 
        edge.left = left, edge.right = right);
    }
    function clipEdge(edge, x0, y0, x1, y1) {
        var r, a = edge[0], b = edge[1], ax = a[0], ay = a[1], t0 = 0, t1 = 1, dx = b[0] - ax, dy = b[1] - ay;
        if (r = x0 - ax, dx || !(0 < r)) {
            if (r /= dx, dx < 0) {
                if (r < t0) return;
                r < t1 && (t1 = r);
            } else if (0 < dx) {
                if (t1 < r) return;
                t0 < r && (t0 = r);
            }
            if (r = x1 - ax, dx || !(r < 0)) {
                if (r /= dx, dx < 0) {
                    if (t1 < r) return;
                    t0 < r && (t0 = r);
                } else if (0 < dx) {
                    if (r < t0) return;
                    r < t1 && (t1 = r);
                }
                if (r = y0 - ay, dy || !(0 < r)) {
                    if (r /= dy, dy < 0) {
                        if (r < t0) return;
                        r < t1 && (t1 = r);
                    } else if (0 < dy) {
                        if (t1 < r) return;
                        t0 < r && (t0 = r);
                    }
                    if (r = y1 - ay, dy || !(r < 0)) {
                        if (r /= dy, dy < 0) {
                            if (t1 < r) return;
                            t0 < r && (t0 = r);
                        } else if (0 < dy) {
                            if (r < t0) return;
                            r < t1 && (t1 = r);
                        }
                        return (0 < t0 || t1 < 1) && (0 < t0 && (edge[0] = [ ax + t0 * dx, ay + t0 * dy ]), 
                        t1 < 1 && (edge[1] = [ ax + t1 * dx, ay + t1 * dy ])), !0;
                    }
                }
            }
        }
    }
    function connectEdge(edge, x0, y0, x1, y1) {
        var v1 = edge[1];
        if (v1) return !0;
        var fm, fb, v0 = edge[0], left = edge.left, right = edge.right, lx = left[0], ly = left[1], rx = right[0], ry = right[1], fx = (lx + rx) / 2, fy = (ly + ry) / 2;
        if (ry === ly) {
            if (fx < x0 || x1 <= fx) return;
            if (rx < lx) {
                if (v0) {
                    if (v0[1] >= y1) return;
                } else v0 = [ fx, y0 ];
                v1 = [ fx, y1 ];
            } else {
                if (v0) {
                    if (v0[1] < y0) return;
                } else v0 = [ fx, y1 ];
                v1 = [ fx, y0 ];
            }
        } else if (fb = fy - (fm = (lx - rx) / (ry - ly)) * fx, fm < -1 || 1 < fm) if (rx < lx) {
            if (v0) {
                if (v0[1] >= y1) return;
            } else v0 = [ (y0 - fb) / fm, y0 ];
            v1 = [ (y1 - fb) / fm, y1 ];
        } else {
            if (v0) {
                if (v0[1] < y0) return;
            } else v0 = [ (y1 - fb) / fm, y1 ];
            v1 = [ (y0 - fb) / fm, y0 ];
        } else if (ly < ry) {
            if (v0) {
                if (v0[0] >= x1) return;
            } else v0 = [ x0, fm * x0 + fb ];
            v1 = [ x1, fm * x1 + fb ];
        } else {
            if (v0) {
                if (v0[0] < x0) return;
            } else v0 = [ x1, fm * x1 + fb ];
            v1 = [ x0, fm * x0 + fb ];
        }
        return edge[0] = v0, edge[1] = v1, !0;
    }
    function cellHalfedgeAngle(cell, edge) {
        var site = cell.site, va = edge.left, vb = edge.right;
        return site === vb && (vb = va, va = site), vb ? Math.atan2(vb[1] - va[1], vb[0] - va[0]) : (site === va ? (va = edge[1], 
        vb = edge[0]) : (va = edge[0], vb = edge[1]), Math.atan2(va[0] - vb[0], vb[1] - va[1]));
    }
    function cellHalfedgeStart(cell, edge) {
        return edge[+(edge.left !== cell.site)];
    }
    function cellHalfedgeEnd(cell, edge) {
        return edge[+(edge.left === cell.site)];
    }
    LinearClosed.prototype = {
        areaStart: noop$2,
        areaEnd: noop$2,
        lineStart: function() {
            this._point = 0;
        },
        lineEnd: function() {
            this._point && this._context.closePath();
        },
        point: function(x, y) {
            x = +x, y = +y, this._point ? this._context.lineTo(x, y) : (this._point = 1, this._context.moveTo(x, y));
        }
    }, MonotoneX.prototype = {
        areaStart: function() {
            this._line = 0;
        },
        areaEnd: function() {
            this._line = NaN;
        },
        lineStart: function() {
            this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN, this._point = 0;
        },
        lineEnd: function() {
            switch (this._point) {
              case 2:
                this._context.lineTo(this._x1, this._y1);
                break;

              case 3:
                point$5(this, this._t0, slope2(this, this._t0));
            }
            (this._line || 0 !== this._line && 1 === this._point) && this._context.closePath(), 
            this._line = 1 - this._line;
        },
        point: function(x, y) {
            var t1 = NaN;
            if (y = +y, (x = +x) !== this._x1 || y !== this._y1) {
                switch (this._point) {
                  case 0:
                    this._point = 1, this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
                    break;

                  case 1:
                    this._point = 2;
                    break;

                  case 2:
                    this._point = 3, point$5(this, slope2(this, t1 = slope3(this, x, y)), t1);
                    break;

                  default:
                    point$5(this, this._t0, t1 = slope3(this, x, y));
                }
                this._x0 = this._x1, this._x1 = x, this._y0 = this._y1, this._y1 = y, this._t0 = t1;
            }
        }
    }, (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x, y) {
        MonotoneX.prototype.point.call(this, y, x);
    }, ReflectContext.prototype = {
        moveTo: function(x, y) {
            this._context.moveTo(y, x);
        },
        closePath: function() {
            this._context.closePath();
        },
        lineTo: function(x, y) {
            this._context.lineTo(y, x);
        },
        bezierCurveTo: function(x1, y1, x2, y2, x, y) {
            this._context.bezierCurveTo(y1, x1, y2, x2, y, x);
        }
    }, Natural.prototype = {
        areaStart: function() {
            this._line = 0;
        },
        areaEnd: function() {
            this._line = NaN;
        },
        lineStart: function() {
            this._x = [], this._y = [];
        },
        lineEnd: function() {
            var x = this._x, y = this._y, n = x.length;
            if (n) if (this._line ? this._context.lineTo(x[0], y[0]) : this._context.moveTo(x[0], y[0]), 
            2 === n) this._context.lineTo(x[1], y[1]); else for (var px = controlPoints(x), py = controlPoints(y), i0 = 0, i1 = 1; i1 < n; ++i0, 
            ++i1) this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x[i1], y[i1]);
            (this._line || 0 !== this._line && 1 === n) && this._context.closePath(), this._line = 1 - this._line, 
            this._x = this._y = null;
        },
        point: function(x, y) {
            this._x.push(+x), this._y.push(+y);
        }
    }, Step.prototype = {
        areaStart: function() {
            this._line = 0;
        },
        areaEnd: function() {
            this._line = NaN;
        },
        lineStart: function() {
            this._x = this._y = NaN, this._point = 0;
        },
        lineEnd: function() {
            0 < this._t && this._t < 1 && 2 === this._point && this._context.lineTo(this._x, this._y), 
            (this._line || 0 !== this._line && 1 === this._point) && this._context.closePath(), 
            0 <= this._line && (this._t = 1 - this._t, this._line = 1 - this._line);
        },
        point: function(x, y) {
            switch (x = +x, y = +y, this._point) {
              case 0:
                this._point = 1, this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
                break;

              case 1:
                this._point = 2;

              default:
                if (this._t <= 0) this._context.lineTo(this._x, y), this._context.lineTo(x, y); else {
                    var x1 = this._x * (1 - this._t) + x * this._t;
                    this._context.lineTo(x1, this._y), this._context.lineTo(x1, y);
                }
            }
            this._x = x, this._y = y;
        }
    }, RedBlackTree.prototype = {
        constructor: RedBlackTree,
        insert: function(after, node) {
            var parent, grandpa, uncle;
            if (after) {
                if (node.P = after, node.N = after.N, after.N && (after.N.P = node), after.N = node, 
                after.R) {
                    for (after = after.R; after.L; ) after = after.L;
                    after.L = node;
                } else after.R = node;
                parent = after;
            } else this._ ? (after = RedBlackFirst(this._), node.P = null, (node.N = after).P = after.L = node, 
            parent = after) : (node.P = node.N = null, this._ = node, parent = null);
            for (node.L = node.R = null, node.U = parent, node.C = !0, after = node; parent && parent.C; ) parent === (grandpa = parent.U).L ? (uncle = grandpa.R) && uncle.C ? (parent.C = uncle.C = !1, 
            grandpa.C = !0, after = grandpa) : (after === parent.R && (RedBlackRotateLeft(this, parent), 
            parent = (after = parent).U), parent.C = !1, grandpa.C = !0, RedBlackRotateRight(this, grandpa)) : (uncle = grandpa.L) && uncle.C ? (parent.C = uncle.C = !1, 
            grandpa.C = !0, after = grandpa) : (after === parent.L && (RedBlackRotateRight(this, parent), 
            parent = (after = parent).U), parent.C = !1, grandpa.C = !0, RedBlackRotateLeft(this, grandpa)), 
            parent = after.U;
            this._.C = !1;
        },
        remove: function(node) {
            node.N && (node.N.P = node.P), node.P && (node.P.N = node.N), node.N = node.P = null;
            var sibling, next, red, parent = node.U, left = node.L, right = node.R;
            if (next = left ? right ? RedBlackFirst(right) : left : right, parent ? parent.L === node ? parent.L = next : parent.R = next : this._ = next, 
            left && right ? (red = next.C, next.C = node.C, ((next.L = left).U = next) !== right ? (parent = next.U, 
            next.U = node.U, node = next.R, parent.L = node, (next.R = right).U = next) : (next.U = parent, 
            node = (parent = next).R)) : (red = node.C, node = next), node && (node.U = parent), 
            !red) if (node && node.C) node.C = !1; else {
                do {
                    if (node === this._) break;
                    if (node === parent.L) {
                        if ((sibling = parent.R).C && (sibling.C = !1, parent.C = !0, RedBlackRotateLeft(this, parent), 
                        sibling = parent.R), sibling.L && sibling.L.C || sibling.R && sibling.R.C) {
                            sibling.R && sibling.R.C || (sibling.L.C = !1, sibling.C = !0, RedBlackRotateRight(this, sibling), 
                            sibling = parent.R), sibling.C = parent.C, parent.C = sibling.R.C = !1, RedBlackRotateLeft(this, parent), 
                            node = this._;
                            break;
                        }
                    } else if ((sibling = parent.L).C && (sibling.C = !1, parent.C = !0, RedBlackRotateRight(this, parent), 
                    sibling = parent.L), sibling.L && sibling.L.C || sibling.R && sibling.R.C) {
                        sibling.L && sibling.L.C || (sibling.R.C = !1, sibling.C = !0, RedBlackRotateLeft(this, sibling), 
                        sibling = parent.L), sibling.C = parent.C, parent.C = sibling.L.C = !1, RedBlackRotateRight(this, parent), 
                        node = this._;
                        break;
                    }
                    sibling.C = !0, parent = (node = parent).U;
                } while (!node.C);
                node && (node.C = !1);
            }
        }
    };
    var firstCircle, circlePool = [];
    function Circle() {
        RedBlackNode(this), this.x = this.y = this.arc = this.site = this.cy = null;
    }
    function attachCircle(arc) {
        var lArc = arc.P, rArc = arc.N;
        if (lArc && rArc) {
            var lSite = lArc.site, cSite = arc.site, rSite = rArc.site;
            if (lSite !== rSite) {
                var bx = cSite[0], by = cSite[1], ax = lSite[0] - bx, ay = lSite[1] - by, cx = rSite[0] - bx, cy = rSite[1] - by, d = 2 * (ax * cy - ay * cx);
                if (!(-epsilon2$2 <= d)) {
                    var ha = ax * ax + ay * ay, hc = cx * cx + cy * cy, x = (cy * ha - ay * hc) / d, y = (ax * hc - cx * ha) / d, circle = circlePool.pop() || new Circle();
                    circle.arc = arc, circle.site = cSite, circle.x = x + bx, circle.y = (circle.cy = y + by) + Math.sqrt(x * x + y * y), 
                    arc.circle = circle;
                    for (var before = null, node = circles._; node; ) if (circle.y < node.y || circle.y === node.y && circle.x <= node.x) {
                        if (!node.L) {
                            before = node.P;
                            break;
                        }
                        node = node.L;
                    } else {
                        if (!node.R) {
                            before = node;
                            break;
                        }
                        node = node.R;
                    }
                    circles.insert(before, circle), before || (firstCircle = circle);
                }
            }
        }
    }
    function detachCircle(arc) {
        var circle = arc.circle;
        circle && (circle.P || (firstCircle = circle.N), circles.remove(circle), circlePool.push(circle), 
        RedBlackNode(circle), arc.circle = null);
    }
    var beachPool = [];
    function Beach() {
        RedBlackNode(this), this.edge = this.site = this.circle = null;
    }
    function createBeach(site) {
        var beach = beachPool.pop() || new Beach();
        return beach.site = site, beach;
    }
    function detachBeach(beach) {
        detachCircle(beach), beaches.remove(beach), beachPool.push(beach), RedBlackNode(beach);
    }
    function removeBeach(beach) {
        var circle = beach.circle, x = circle.x, y = circle.cy, vertex = [ x, y ], previous = beach.P, next = beach.N, disappearing = [ beach ];
        detachBeach(beach);
        for (var lArc = previous; lArc.circle && Math.abs(x - lArc.circle.x) < epsilon$4 && Math.abs(y - lArc.circle.cy) < epsilon$4; ) previous = lArc.P, 
        disappearing.unshift(lArc), detachBeach(lArc), lArc = previous;
        disappearing.unshift(lArc), detachCircle(lArc);
        for (var rArc = next; rArc.circle && Math.abs(x - rArc.circle.x) < epsilon$4 && Math.abs(y - rArc.circle.cy) < epsilon$4; ) next = rArc.N, 
        disappearing.push(rArc), detachBeach(rArc), rArc = next;
        disappearing.push(rArc), detachCircle(rArc);
        var iArc, nArcs = disappearing.length;
        for (iArc = 1; iArc < nArcs; ++iArc) rArc = disappearing[iArc], lArc = disappearing[iArc - 1], 
        setEdgeEnd(rArc.edge, lArc.site, rArc.site, vertex);
        lArc = disappearing[0], (rArc = disappearing[nArcs - 1]).edge = createEdge(lArc.site, rArc.site, null, vertex), 
        attachCircle(lArc), attachCircle(rArc);
    }
    function addBeach(site) {
        for (var lArc, rArc, dxl, dxr, x = site[0], directrix = site[1], node = beaches._; node; ) if (dxl = leftBreakPoint(node, directrix) - x, 
        epsilon$4 < dxl) node = node.L; else {
            if (dxr = x - rightBreakPoint(node, directrix), !(epsilon$4 < dxr)) {
                -epsilon$4 < dxl ? (lArc = node.P, rArc = node) : -epsilon$4 < dxr ? rArc = (lArc = node).N : lArc = rArc = node;
                break;
            }
            if (!node.R) {
                lArc = node;
                break;
            }
            node = node.R;
        }
        !function(site) {
            cells[site.index] = {
                site: site,
                halfedges: []
            };
        }(site);
        var newArc = createBeach(site);
        if (beaches.insert(lArc, newArc), lArc || rArc) {
            if (lArc === rArc) return detachCircle(lArc), rArc = createBeach(lArc.site), beaches.insert(newArc, rArc), 
            newArc.edge = rArc.edge = createEdge(lArc.site, newArc.site), attachCircle(lArc), 
            void attachCircle(rArc);
            if (rArc) {
                detachCircle(lArc), detachCircle(rArc);
                var lSite = lArc.site, ax = lSite[0], ay = lSite[1], bx = site[0] - ax, by = site[1] - ay, rSite = rArc.site, cx = rSite[0] - ax, cy = rSite[1] - ay, d = 2 * (bx * cy - by * cx), hb = bx * bx + by * by, hc = cx * cx + cy * cy, vertex = [ (cy * hb - by * hc) / d + ax, (bx * hc - cx * hb) / d + ay ];
                setEdgeEnd(rArc.edge, lSite, rSite, vertex), newArc.edge = createEdge(lSite, site, null, vertex), 
                rArc.edge = createEdge(site, rSite, null, vertex), attachCircle(lArc), attachCircle(rArc);
            } else newArc.edge = createEdge(lArc.site, newArc.site);
        }
    }
    function leftBreakPoint(arc, directrix) {
        var site = arc.site, rfocx = site[0], rfocy = site[1], pby2 = rfocy - directrix;
        if (!pby2) return rfocx;
        var lArc = arc.P;
        if (!lArc) return -1 / 0;
        var lfocx = (site = lArc.site)[0], lfocy = site[1], plby2 = lfocy - directrix;
        if (!plby2) return lfocx;
        var hl = lfocx - rfocx, aby2 = 1 / pby2 - 1 / plby2, b = hl / plby2;
        return aby2 ? (-b + Math.sqrt(b * b - 2 * aby2 * (hl * hl / (-2 * plby2) - lfocy + plby2 / 2 + rfocy - pby2 / 2))) / aby2 + rfocx : (rfocx + lfocx) / 2;
    }
    function rightBreakPoint(arc, directrix) {
        var rArc = arc.N;
        if (rArc) return leftBreakPoint(rArc, directrix);
        var site = arc.site;
        return site[1] === directrix ? site[0] : 1 / 0;
    }
    var beaches, cells, circles, edges, epsilon$4 = 1e-6, epsilon2$2 = 1e-12;
    function lexicographic(a, b) {
        return b[1] - a[1] || b[0] - a[0];
    }
    function Diagram(sites, extent) {
        var x, y, circle, site = sites.sort(lexicographic).pop();
        for (edges = [], cells = new Array(sites.length), beaches = new RedBlackTree(), 
        circles = new RedBlackTree(); ;) if (circle = firstCircle, site && (!circle || site[1] < circle.y || site[1] === circle.y && site[0] < circle.x)) site[0] === x && site[1] === y || (addBeach(site), 
        x = site[0], y = site[1]), site = sites.pop(); else {
            if (!circle) break;
            removeBeach(circle.arc);
        }
        if (function() {
            for (var cell, halfedges, j, m, i = 0, n = cells.length; i < n; ++i) if ((cell = cells[i]) && (m = (halfedges = cell.halfedges).length)) {
                var index = new Array(m), array = new Array(m);
                for (j = 0; j < m; ++j) index[j] = j, array[j] = cellHalfedgeAngle(cell, edges[halfedges[j]]);
                for (index.sort(function(i, j) {
                    return array[j] - array[i];
                }), j = 0; j < m; ++j) array[j] = halfedges[index[j]];
                for (j = 0; j < m; ++j) halfedges[j] = array[j];
            }
        }(), extent) {
            var x0 = +extent[0][0], y0 = +extent[0][1], x1 = +extent[1][0], y1 = +extent[1][1];
            !function(x0, y0, x1, y1) {
                for (var edge, i = edges.length; i--; ) connectEdge(edge = edges[i], x0, y0, x1, y1) && clipEdge(edge, x0, y0, x1, y1) && (Math.abs(edge[0][0] - edge[1][0]) > epsilon$4 || Math.abs(edge[0][1] - edge[1][1]) > epsilon$4) || delete edges[i];
            }(x0, y0, x1, y1), function(x0, y0, x1, y1) {
                var iCell, cell, site, iHalfedge, halfedges, nHalfedges, start, startX, startY, end, endX, endY, nCells = cells.length, cover = !0;
                for (iCell = 0; iCell < nCells; ++iCell) if (cell = cells[iCell]) {
                    for (site = cell.site, iHalfedge = (halfedges = cell.halfedges).length; iHalfedge--; ) edges[halfedges[iHalfedge]] || halfedges.splice(iHalfedge, 1);
                    for (iHalfedge = 0, nHalfedges = halfedges.length; iHalfedge < nHalfedges; ) endX = (end = cellHalfedgeEnd(cell, edges[halfedges[iHalfedge]]))[0], 
                    endY = end[1], startX = (start = cellHalfedgeStart(cell, edges[halfedges[++iHalfedge % nHalfedges]]))[0], 
                    startY = start[1], (Math.abs(endX - startX) > epsilon$4 || Math.abs(endY - startY) > epsilon$4) && (halfedges.splice(iHalfedge, 0, edges.push(createBorderEdge(site, end, Math.abs(endX - x0) < epsilon$4 && epsilon$4 < y1 - endY ? [ x0, Math.abs(startX - x0) < epsilon$4 ? startY : y1 ] : Math.abs(endY - y1) < epsilon$4 && epsilon$4 < x1 - endX ? [ Math.abs(startY - y1) < epsilon$4 ? startX : x1, y1 ] : Math.abs(endX - x1) < epsilon$4 && epsilon$4 < endY - y0 ? [ x1, Math.abs(startX - x1) < epsilon$4 ? startY : y0 ] : Math.abs(endY - y0) < epsilon$4 && epsilon$4 < endX - x0 ? [ Math.abs(startY - y0) < epsilon$4 ? startX : x0, y0 ] : null)) - 1), 
                    ++nHalfedges);
                    nHalfedges && (cover = !1);
                }
                if (cover) {
                    var dx, dy, d2, dc = 1 / 0;
                    for (iCell = 0, cover = null; iCell < nCells; ++iCell) (cell = cells[iCell]) && (d2 = (dx = (site = cell.site)[0] - x0) * dx + (dy = site[1] - y0) * dy) < dc && (dc = d2, 
                    cover = cell);
                    if (cover) {
                        var v00 = [ x0, y0 ], v01 = [ x0, y1 ], v11 = [ x1, y1 ], v10 = [ x1, y0 ];
                        cover.halfedges.push(edges.push(createBorderEdge(site = cover.site, v00, v01)) - 1, edges.push(createBorderEdge(site, v01, v11)) - 1, edges.push(createBorderEdge(site, v11, v10)) - 1, edges.push(createBorderEdge(site, v10, v00)) - 1);
                    }
                }
                for (iCell = 0; iCell < nCells; ++iCell) (cell = cells[iCell]) && (cell.halfedges.length || delete cells[iCell]);
            }(x0, y0, x1, y1);
        }
        this.edges = edges, this.cells = cells, beaches = circles = edges = cells = null;
    }
    function constant$12(x) {
        return function() {
            return x;
        };
    }
    function ZoomEvent(target, type, transform) {
        this.target = target, this.type = type, this.transform = transform;
    }
    function Transform(k, x, y) {
        this.k = k, this.x = x, this.y = y;
    }
    Diagram.prototype = {
        constructor: Diagram,
        polygons: function() {
            var edges = this.edges;
            return this.cells.map(function(cell) {
                var polygon = cell.halfedges.map(function(i) {
                    return cellHalfedgeStart(cell, edges[i]);
                });
                return polygon.data = cell.site.data, polygon;
            });
        },
        triangles: function() {
            var triangles = [], edges = this.edges;
            return this.cells.forEach(function(cell, i) {
                if (m = (halfedges = cell.halfedges).length) for (var halfedges, m, s0, a, b, c, site = cell.site, j = -1, e1 = edges[halfedges[m - 1]], s1 = e1.left === site ? e1.right : e1.left; ++j < m; ) s0 = s1, 
                s1 = (e1 = edges[halfedges[j]]).left === site ? e1.right : e1.left, s0 && s1 && i < s0.index && i < s1.index && (b = s0, 
                c = s1, ((a = site)[0] - c[0]) * (b[1] - a[1]) - (a[0] - b[0]) * (c[1] - a[1]) < 0) && triangles.push([ site.data, s0.data, s1.data ]);
            }), triangles;
        },
        links: function() {
            return this.edges.filter(function(edge) {
                return edge.right;
            }).map(function(edge) {
                return {
                    source: edge.left.data,
                    target: edge.right.data
                };
            });
        },
        find: function(x, y, radius) {
            for (var i0, cell, that = this, i1 = that._found || 0, n = that.cells.length; !(cell = that.cells[i1]); ) if (++i1 >= n) return null;
            for (var dx = x - cell.site[0], dy = y - cell.site[1], d2 = dx * dx + dy * dy; cell = that.cells[i0 = i1], 
            i1 = null, cell.halfedges.forEach(function(e) {
                var edge = that.edges[e], v = edge.left;
                if (v !== cell.site && v || (v = edge.right)) {
                    var vx = x - v[0], vy = y - v[1], v2 = vx * vx + vy * vy;
                    v2 < d2 && (d2 = v2, i1 = v.index);
                }
            }), null !== i1; ) ;
            return that._found = i0, null == radius || d2 <= radius * radius ? cell.site : null;
        }
    }, Transform.prototype = {
        constructor: Transform,
        scale: function(k) {
            return 1 === k ? this : new Transform(this.k * k, this.x, this.y);
        },
        translate: function(x, y) {
            return 0 === x & 0 === y ? this : new Transform(this.k, this.x + this.k * x, this.y + this.k * y);
        },
        apply: function(point) {
            return [ point[0] * this.k + this.x, point[1] * this.k + this.y ];
        },
        applyX: function(x) {
            return x * this.k + this.x;
        },
        applyY: function(y) {
            return y * this.k + this.y;
        },
        invert: function(location) {
            return [ (location[0] - this.x) / this.k, (location[1] - this.y) / this.k ];
        },
        invertX: function(x) {
            return (x - this.x) / this.k;
        },
        invertY: function(y) {
            return (y - this.y) / this.k;
        },
        rescaleX: function(x) {
            return x.copy().domain(x.range().map(this.invertX, this).map(x.invert, x));
        },
        rescaleY: function(y) {
            return y.copy().domain(y.range().map(this.invertY, this).map(y.invert, y));
        },
        toString: function() {
            return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")";
        }
    };
    var identity$8 = new Transform(1, 0, 0);
    function transform$1(node) {
        return node.__zoom || identity$8;
    }
    function nopropagation$2() {
        exports.event.stopImmediatePropagation();
    }
    function noevent$2() {
        exports.event.preventDefault(), exports.event.stopImmediatePropagation();
    }
    function defaultFilter$2() {
        return !exports.event.button;
    }
    function defaultExtent$1() {
        var w, h, e = this;
        return e instanceof SVGElement ? (w = (e = e.ownerSVGElement || e).width.baseVal.value, 
        h = e.height.baseVal.value) : (w = e.clientWidth, h = e.clientHeight), [ [ 0, 0 ], [ w, h ] ];
    }
    function defaultTransform() {
        return this.__zoom || identity$8;
    }
    function defaultWheelDelta() {
        return -exports.event.deltaY * (exports.event.deltaMode ? 120 : 1) / 500;
    }
    function defaultTouchable$1() {
        return "ontouchstart" in this;
    }
    function defaultConstrain(transform$$1, extent, translateExtent) {
        var dx0 = transform$$1.invertX(extent[0][0]) - translateExtent[0][0], dx1 = transform$$1.invertX(extent[1][0]) - translateExtent[1][0], dy0 = transform$$1.invertY(extent[0][1]) - translateExtent[0][1], dy1 = transform$$1.invertY(extent[1][1]) - translateExtent[1][1];
        return transform$$1.translate(dx0 < dx1 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1), dy0 < dy1 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1));
    }
    transform$1.prototype = Transform.prototype, exports.version = "4.13.0", exports.bisect = bisectRight, 
    exports.bisectRight = bisectRight, exports.bisectLeft = bisectLeft, exports.ascending = ascending, 
    exports.bisector = bisector, exports.cross = function(values0, values1, reduce) {
        var i0, i1, i, value0, n0 = values0.length, n1 = values1.length, values = new Array(n0 * n1);
        for (null == reduce && (reduce = pair), i0 = i = 0; i0 < n0; ++i0) for (value0 = values0[i0], 
        i1 = 0; i1 < n1; ++i1, ++i) values[i] = reduce(value0, values1[i1]);
        return values;
    }, exports.descending = function(a, b) {
        return b < a ? -1 : a < b ? 1 : a <= b ? 0 : NaN;
    }, exports.deviation = deviation, exports.extent = extent, exports.histogram = function() {
        var value = identity, domain = extent, threshold = sturges;
        function histogram(data) {
            var i, x, n = data.length, values = new Array(n);
            for (i = 0; i < n; ++i) values[i] = value(data[i], i, data);
            var xz = domain(values), x0 = xz[0], x1 = xz[1], tz = threshold(values, x0, x1);
            Array.isArray(tz) || (tz = tickStep(x0, x1, tz), tz = sequence(Math.ceil(x0 / tz) * tz, Math.floor(x1 / tz) * tz, tz));
            for (var m = tz.length; tz[0] <= x0; ) tz.shift(), --m;
            for (;tz[m - 1] > x1; ) tz.pop(), --m;
            var bin, bins = new Array(m + 1);
            for (i = 0; i <= m; ++i) (bin = bins[i] = []).x0 = 0 < i ? tz[i - 1] : x0, bin.x1 = i < m ? tz[i] : x1;
            for (i = 0; i < n; ++i) x0 <= (x = values[i]) && x <= x1 && bins[bisectRight(tz, x, 0, m)].push(data[i]);
            return bins;
        }
        return histogram.value = function(_) {
            return arguments.length ? (value = "function" == typeof _ ? _ : constant(_), histogram) : value;
        }, histogram.domain = function(_) {
            return arguments.length ? (domain = "function" == typeof _ ? _ : constant([ _[0], _[1] ]), 
            histogram) : domain;
        }, histogram.thresholds = function(_) {
            return arguments.length ? (threshold = "function" == typeof _ ? _ : Array.isArray(_) ? constant(slice.call(_)) : constant(_), 
            histogram) : threshold;
        }, histogram;
    }, exports.thresholdFreedmanDiaconis = function(values, min, max) {
        return values = map.call(values, number).sort(ascending), Math.ceil((max - min) / (2 * (threshold(values, .75) - threshold(values, .25)) * Math.pow(values.length, -1 / 3)));
    }, exports.thresholdScott = function(values, min, max) {
        return Math.ceil((max - min) / (3.5 * deviation(values) * Math.pow(values.length, -1 / 3)));
    }, exports.thresholdSturges = sturges, exports.max = function(values, valueof) {
        var value, max, n = values.length, i = -1;
        if (null == valueof) {
            for (;++i < n; ) if (null != (value = values[i]) && value <= value) for (max = value; ++i < n; ) null != (value = values[i]) && max < value && (max = value);
        } else for (;++i < n; ) if (null != (value = valueof(values[i], i, values)) && value <= value) for (max = value; ++i < n; ) null != (value = valueof(values[i], i, values)) && max < value && (max = value);
        return max;
    }, exports.mean = function(values, valueof) {
        var value, n = values.length, m = n, i = -1, sum = 0;
        if (null == valueof) for (;++i < n; ) isNaN(value = number(values[i])) ? --m : sum += value; else for (;++i < n; ) isNaN(value = number(valueof(values[i], i, values))) ? --m : sum += value;
        if (m) return sum / m;
    }, exports.median = function(values, valueof) {
        var value, n = values.length, i = -1, numbers = [];
        if (null == valueof) for (;++i < n; ) isNaN(value = number(values[i])) || numbers.push(value); else for (;++i < n; ) isNaN(value = number(valueof(values[i], i, values))) || numbers.push(value);
        return threshold(numbers.sort(ascending), .5);
    }, exports.merge = merge, exports.min = min, exports.pairs = function(array, f) {
        null == f && (f = pair);
        for (var i = 0, n = array.length - 1, p = array[0], pairs = new Array(n < 0 ? 0 : n); i < n; ) pairs[i] = f(p, p = array[++i]);
        return pairs;
    }, exports.permute = function(array, indexes) {
        for (var i = indexes.length, permutes = new Array(i); i--; ) permutes[i] = array[indexes[i]];
        return permutes;
    }, exports.quantile = threshold, exports.range = sequence, exports.scan = function(values, compare) {
        if (n = values.length) {
            var n, xi, i = 0, j = 0, xj = values[j];
            for (null == compare && (compare = ascending); ++i < n; ) (compare(xi = values[i], xj) < 0 || 0 !== compare(xj, xj)) && (xj = xi, 
            j = i);
            return 0 === compare(xj, xj) ? j : void 0;
        }
    }, exports.shuffle = function(array, i0, i1) {
        for (var t, i, m = (null == i1 ? array.length : i1) - (i0 = null == i0 ? 0 : +i0); m; ) i = Math.random() * m-- | 0, 
        t = array[m + i0], array[m + i0] = array[i + i0], array[i + i0] = t;
        return array;
    }, exports.sum = function(values, valueof) {
        var value, n = values.length, i = -1, sum = 0;
        if (null == valueof) for (;++i < n; ) (value = +values[i]) && (sum += value); else for (;++i < n; ) (value = +valueof(values[i], i, values)) && (sum += value);
        return sum;
    }, exports.ticks = ticks, exports.tickIncrement = tickIncrement, exports.tickStep = tickStep, 
    exports.transpose = transpose, exports.variance = variance, exports.zip = function() {
        return transpose(arguments);
    }, exports.axisTop = function(scale) {
        return axis(top, scale);
    }, exports.axisRight = function(scale) {
        return axis(right, scale);
    }, exports.axisBottom = function(scale) {
        return axis(bottom, scale);
    }, exports.axisLeft = function(scale) {
        return axis(left, scale);
    }, exports.brush = function() {
        return brush$1(XY);
    }, exports.brushX = function() {
        return brush$1(X);
    }, exports.brushY = function() {
        return brush$1(Y);
    }, exports.brushSelection = function(node) {
        var state = node.__brush;
        return state ? state.dim.output(state.selection) : null;
    }, exports.chord = function() {
        var padAngle = 0, sortGroups = null, sortSubgroups = null, sortChords = null;
        function chord(matrix) {
            var k, x, x0, dx, i, j, n = matrix.length, groupSums = [], groupIndex = sequence(n), subgroupIndex = [], chords = [], groups = chords.groups = new Array(n), subgroups = new Array(n * n);
            for (k = 0, i = -1; ++i < n; ) {
                for (x = 0, j = -1; ++j < n; ) x += matrix[i][j];
                groupSums.push(x), subgroupIndex.push(sequence(n)), k += x;
            }
            for (sortGroups && groupIndex.sort(function(a, b) {
                return sortGroups(groupSums[a], groupSums[b]);
            }), sortSubgroups && subgroupIndex.forEach(function(d, i) {
                d.sort(function(a, b) {
                    return sortSubgroups(matrix[i][a], matrix[i][b]);
                });
            }), dx = (k = max$1(0, tau$1 - padAngle * n) / k) ? padAngle : tau$1 / n, x = 0, 
            i = -1; ++i < n; ) {
                for (x0 = x, j = -1; ++j < n; ) {
                    var di = groupIndex[i], dj = subgroupIndex[di][j], v = matrix[di][dj], a0 = x, a1 = x += v * k;
                    subgroups[dj * n + di] = {
                        index: di,
                        subindex: dj,
                        startAngle: a0,
                        endAngle: a1,
                        value: v
                    };
                }
                groups[di] = {
                    index: di,
                    startAngle: x0,
                    endAngle: x,
                    value: groupSums[di]
                }, x += dx;
            }
            for (i = -1; ++i < n; ) for (j = i - 1; ++j < n; ) {
                var source = subgroups[j * n + i], target = subgroups[i * n + j];
                (source.value || target.value) && chords.push(source.value < target.value ? {
                    source: target,
                    target: source
                } : {
                    source: source,
                    target: target
                });
            }
            return sortChords ? chords.sort(sortChords) : chords;
        }
        return chord.padAngle = function(_) {
            return arguments.length ? (padAngle = max$1(0, _), chord) : padAngle;
        }, chord.sortGroups = function(_) {
            return arguments.length ? (sortGroups = _, chord) : sortGroups;
        }, chord.sortSubgroups = function(_) {
            return arguments.length ? (sortSubgroups = _, chord) : sortSubgroups;
        }, chord.sortChords = function(_) {
            return arguments.length ? (null == _ ? sortChords = null : (compare = _, sortChords = function(a, b) {
                return compare(a.source.value + a.target.value, b.source.value + b.target.value);
            })._ = _, chord) : sortChords && sortChords._;
            var compare;
        }, chord;
    }, exports.ribbon = function() {
        var source = defaultSource, target = defaultTarget, radius = defaultRadius, startAngle = defaultStartAngle, endAngle = defaultEndAngle, context = null;
        function ribbon() {
            var buffer, argv = slice$2.call(arguments), s = source.apply(this, argv), t = target.apply(this, argv), sr = +radius.apply(this, (argv[0] = s, 
            argv)), sa0 = startAngle.apply(this, argv) - halfPi$1, sa1 = endAngle.apply(this, argv) - halfPi$1, sx0 = sr * cos(sa0), sy0 = sr * sin(sa0), tr = +radius.apply(this, (argv[0] = t, 
            argv)), ta0 = startAngle.apply(this, argv) - halfPi$1, ta1 = endAngle.apply(this, argv) - halfPi$1;
            if (context || (context = buffer = path()), context.moveTo(sx0, sy0), context.arc(0, 0, sr, sa0, sa1), 
            sa0 === ta0 && sa1 === ta1 || (context.quadraticCurveTo(0, 0, tr * cos(ta0), tr * sin(ta0)), 
            context.arc(0, 0, tr, ta0, ta1)), context.quadraticCurveTo(0, 0, sx0, sy0), context.closePath(), 
            buffer) return context = null, buffer + "" || null;
        }
        return ribbon.radius = function(_) {
            return arguments.length ? (radius = "function" == typeof _ ? _ : constant$5(+_), 
            ribbon) : radius;
        }, ribbon.startAngle = function(_) {
            return arguments.length ? (startAngle = "function" == typeof _ ? _ : constant$5(+_), 
            ribbon) : startAngle;
        }, ribbon.endAngle = function(_) {
            return arguments.length ? (endAngle = "function" == typeof _ ? _ : constant$5(+_), 
            ribbon) : endAngle;
        }, ribbon.source = function(_) {
            return arguments.length ? (source = _, ribbon) : source;
        }, ribbon.target = function(_) {
            return arguments.length ? (target = _, ribbon) : target;
        }, ribbon.context = function(_) {
            return arguments.length ? (context = null == _ ? null : _, ribbon) : context;
        }, ribbon;
    }, exports.nest = function() {
        var sortValues, rollup, nest, keys = [], sortKeys = [];
        function apply(array, depth, createResult, setResult) {
            if (depth >= keys.length) return null != sortValues && array.sort(sortValues), null != rollup ? rollup(array) : array;
            for (var keyValue, value, values, i = -1, n = array.length, key = keys[depth++], valuesByKey = map$1(), result = createResult(); ++i < n; ) (values = valuesByKey.get(keyValue = key(value = array[i]) + "")) ? values.push(value) : valuesByKey.set(keyValue, [ value ]);
            return valuesByKey.each(function(values, key) {
                setResult(result, key, apply(values, depth, createResult, setResult));
            }), result;
        }
        return nest = {
            object: function(array) {
                return apply(array, 0, createObject, setObject);
            },
            map: function(array) {
                return apply(array, 0, createMap, setMap);
            },
            entries: function(array) {
                return function entries(map, depth) {
                    if (++depth > keys.length) return map;
                    var array, sortKey = sortKeys[depth - 1];
                    return null != rollup && depth >= keys.length ? array = map.entries() : (array = [], 
                    map.each(function(v, k) {
                        array.push({
                            key: k,
                            values: entries(v, depth)
                        });
                    })), null != sortKey ? array.sort(function(a, b) {
                        return sortKey(a.key, b.key);
                    }) : array;
                }(apply(array, 0, createMap, setMap), 0);
            },
            key: function(d) {
                return keys.push(d), nest;
            },
            sortKeys: function(order) {
                return sortKeys[keys.length - 1] = order, nest;
            },
            sortValues: function(order) {
                return sortValues = order, nest;
            },
            rollup: function(f) {
                return rollup = f, nest;
            }
        };
    }, exports.set = set$2, exports.map = map$1, exports.keys = function(map) {
        var keys = [];
        for (var key in map) keys.push(key);
        return keys;
    }, exports.values = function(map) {
        var values = [];
        for (var key in map) values.push(map[key]);
        return values;
    }, exports.entries = function(map) {
        var entries = [];
        for (var key in map) entries.push({
            key: key,
            value: map[key]
        });
        return entries;
    }, exports.color = color, exports.rgb = rgb, exports.hsl = hsl, exports.lab = lab, 
    exports.hcl = hcl, exports.cubehelix = cubehelix, exports.dispatch = dispatch, exports.drag = function() {
        var mousedownx, mousedowny, mousemoving, touchending, filter = defaultFilter$1, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable, gestures = {}, listeners = dispatch("start", "drag", "end"), active = 0, clickDistance2 = 0;
        function drag(selection) {
            selection.on("mousedown.drag", mousedowned).filter(touchable).on("touchstart.drag", touchstarted).on("touchmove.drag", touchmoved).on("touchend.drag touchcancel.drag", touchended).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
        }
        function mousedowned() {
            if (!touchending && filter.apply(this, arguments)) {
                var gesture = beforestart("mouse", container.apply(this, arguments), mouse, this, arguments);
                gesture && (select(exports.event.view).on("mousemove.drag", mousemoved, !0).on("mouseup.drag", mouseupped, !0), 
                dragDisable(exports.event.view), nopropagation(), mousemoving = !1, mousedownx = exports.event.clientX, 
                mousedowny = exports.event.clientY, gesture("start"));
            }
        }
        function mousemoved() {
            if (noevent(), !mousemoving) {
                var dx = exports.event.clientX - mousedownx, dy = exports.event.clientY - mousedowny;
                mousemoving = clickDistance2 < dx * dx + dy * dy;
            }
            gestures.mouse("drag");
        }
        function mouseupped() {
            select(exports.event.view).on("mousemove.drag mouseup.drag", null), yesdrag(exports.event.view, mousemoving), 
            noevent(), gestures.mouse("end");
        }
        function touchstarted() {
            if (filter.apply(this, arguments)) {
                var i, gesture, touches = exports.event.changedTouches, c = container.apply(this, arguments), n = touches.length;
                for (i = 0; i < n; ++i) (gesture = beforestart(touches[i].identifier, c, touch, this, arguments)) && (nopropagation(), 
                gesture("start"));
            }
        }
        function touchmoved() {
            var i, gesture, touches = exports.event.changedTouches, n = touches.length;
            for (i = 0; i < n; ++i) (gesture = gestures[touches[i].identifier]) && (noevent(), 
            gesture("drag"));
        }
        function touchended() {
            var i, gesture, touches = exports.event.changedTouches, n = touches.length;
            for (touchending && clearTimeout(touchending), touchending = setTimeout(function() {
                touchending = null;
            }, 500), i = 0; i < n; ++i) (gesture = gestures[touches[i].identifier]) && (nopropagation(), 
            gesture("end"));
        }
        function beforestart(id, container, point, that, args) {
            var s, dx, dy, p = point(container, id), sublisteners = listeners.copy();
            if (customEvent(new DragEvent(drag, "beforestart", s, id, active, p[0], p[1], 0, 0, sublisteners), function() {
                return null != (exports.event.subject = s = subject.apply(that, args)) && (dx = s.x - p[0] || 0, 
                dy = s.y - p[1] || 0, !0);
            })) return function gesture(type) {
                var n, p0 = p;
                switch (type) {
                  case "start":
                    gestures[id] = gesture, n = active++;
                    break;

                  case "end":
                    delete gestures[id], --active;

                  case "drag":
                    p = point(container, id), n = active;
                }
                customEvent(new DragEvent(drag, type, s, id, n, p[0] + dx, p[1] + dy, p[0] - p0[0], p[1] - p0[1], sublisteners), sublisteners.apply, sublisteners, [ type, that, args ]);
            };
        }
        return drag.filter = function(_) {
            return arguments.length ? (filter = "function" == typeof _ ? _ : constant$2(!!_), 
            drag) : filter;
        }, drag.container = function(_) {
            return arguments.length ? (container = "function" == typeof _ ? _ : constant$2(_), 
            drag) : container;
        }, drag.subject = function(_) {
            return arguments.length ? (subject = "function" == typeof _ ? _ : constant$2(_), 
            drag) : subject;
        }, drag.touchable = function(_) {
            return arguments.length ? (touchable = "function" == typeof _ ? _ : constant$2(!!_), 
            drag) : touchable;
        }, drag.on = function() {
            var value = listeners.on.apply(listeners, arguments);
            return value === listeners ? drag : value;
        }, drag.clickDistance = function(_) {
            return arguments.length ? (clickDistance2 = (_ = +_) * _, drag) : Math.sqrt(clickDistance2);
        }, drag;
    }, exports.dragDisable = dragDisable, exports.dragEnable = yesdrag, exports.dsvFormat = dsv, 
    exports.csvParse = csvParse, exports.csvParseRows = csvParseRows, exports.csvFormat = csvFormat, 
    exports.csvFormatRows = csvFormatRows, exports.tsvParse = tsvParse, exports.tsvParseRows = tsvParseRows, 
    exports.tsvFormat = tsvFormat, exports.tsvFormatRows = tsvFormatRows, exports.easeLinear = function(t) {
        return +t;
    }, exports.easeQuad = quadInOut, exports.easeQuadIn = function(t) {
        return t * t;
    }, exports.easeQuadOut = function(t) {
        return t * (2 - t);
    }, exports.easeQuadInOut = quadInOut, exports.easeCubic = cubicInOut, exports.easeCubicIn = function(t) {
        return t * t * t;
    }, exports.easeCubicOut = function(t) {
        return --t * t * t + 1;
    }, exports.easeCubicInOut = cubicInOut, exports.easePoly = polyInOut, exports.easePolyIn = polyIn, 
    exports.easePolyOut = polyOut, exports.easePolyInOut = polyInOut, exports.easeSin = sinInOut, 
    exports.easeSinIn = function(t) {
        return 1 - Math.cos(t * halfPi);
    }, exports.easeSinOut = function(t) {
        return Math.sin(t * halfPi);
    }, exports.easeSinInOut = sinInOut, exports.easeExp = expInOut, exports.easeExpIn = function(t) {
        return Math.pow(2, 10 * t - 10);
    }, exports.easeExpOut = function(t) {
        return 1 - Math.pow(2, -10 * t);
    }, exports.easeExpInOut = expInOut, exports.easeCircle = circleInOut, exports.easeCircleIn = function(t) {
        return 1 - Math.sqrt(1 - t * t);
    }, exports.easeCircleOut = function(t) {
        return Math.sqrt(1 - --t * t);
    }, exports.easeCircleInOut = circleInOut, exports.easeBounce = bounceOut, exports.easeBounceIn = function(t) {
        return 1 - bounceOut(1 - t);
    }, exports.easeBounceOut = bounceOut, exports.easeBounceInOut = function(t) {
        return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2;
    }, exports.easeBack = backInOut, exports.easeBackIn = backIn, exports.easeBackOut = backOut, 
    exports.easeBackInOut = backInOut, exports.easeElastic = elasticOut, exports.easeElasticIn = elasticIn, 
    exports.easeElasticOut = elasticOut, exports.easeElasticInOut = elasticInOut, exports.forceCenter = function(x, y) {
        var nodes;
        function force() {
            var i, node, n = nodes.length, sx = 0, sy = 0;
            for (i = 0; i < n; ++i) sx += (node = nodes[i]).x, sy += node.y;
            for (sx = sx / n - x, sy = sy / n - y, i = 0; i < n; ++i) (node = nodes[i]).x -= sx, 
            node.y -= sy;
        }
        return null == x && (x = 0), null == y && (y = 0), force.initialize = function(_) {
            nodes = _;
        }, force.x = function(_) {
            return arguments.length ? (x = +_, force) : x;
        }, force.y = function(_) {
            return arguments.length ? (y = +_, force) : y;
        }, force;
    }, exports.forceCollide = function(radius) {
        var nodes, radii, strength = 1, iterations = 1;
        function force() {
            for (var i, tree, node, xi, yi, ri, ri2, n = nodes.length, k = 0; k < iterations; ++k) for (tree = quadtree(nodes, x, y).visitAfter(prepare), 
            i = 0; i < n; ++i) node = nodes[i], ri = radii[node.index], ri2 = ri * ri, xi = node.x + node.vx, 
            yi = node.y + node.vy, tree.visit(apply);
            function apply(quad, x0, y0, x1, y1) {
                var data = quad.data, rj = quad.r, r = ri + rj;
                if (!data) return xi + r < x0 || x1 < xi - r || yi + r < y0 || y1 < yi - r;
                if (data.index > node.index) {
                    var x = xi - data.x - data.vx, y = yi - data.y - data.vy, l = x * x + y * y;
                    l < r * r && (0 === x && (l += (x = jiggle()) * x), 0 === y && (l += (y = jiggle()) * y), 
                    l = (r - (l = Math.sqrt(l))) / l * strength, node.vx += (x *= l) * (r = (rj *= rj) / (ri2 + rj)), 
                    node.vy += (y *= l) * r, data.vx -= x * (r = 1 - r), data.vy -= y * r);
                }
            }
        }
        function prepare(quad) {
            if (quad.data) return quad.r = radii[quad.data.index];
            for (var i = quad.r = 0; i < 4; ++i) quad[i] && quad[i].r > quad.r && (quad.r = quad[i].r);
        }
        function initialize() {
            if (nodes) {
                var i, node, n = nodes.length;
                for (radii = new Array(n), i = 0; i < n; ++i) node = nodes[i], radii[node.index] = +radius(node, i, nodes);
            }
        }
        return "function" != typeof radius && (radius = constant$6(null == radius ? 1 : +radius)), 
        force.initialize = function(_) {
            nodes = _, initialize();
        }, force.iterations = function(_) {
            return arguments.length ? (iterations = +_, force) : iterations;
        }, force.strength = function(_) {
            return arguments.length ? (strength = +_, force) : strength;
        }, force.radius = function(_) {
            return arguments.length ? (radius = "function" == typeof _ ? _ : constant$6(+_), 
            initialize(), force) : radius;
        }, force;
    }, exports.forceLink = function(links) {
        var strengths, distances, nodes, count, bias, id = index, strength = function(link) {
            return 1 / Math.min(count[link.source.index], count[link.target.index]);
        }, distance = constant$6(30), iterations = 1;
        function force(alpha) {
            for (var k = 0, n = links.length; k < iterations; ++k) for (var link, source, target, x, y, l, b, i = 0; i < n; ++i) source = (link = links[i]).source, 
            x = (target = link.target).x + target.vx - source.x - source.vx || jiggle(), y = target.y + target.vy - source.y - source.vy || jiggle(), 
            x *= l = ((l = Math.sqrt(x * x + y * y)) - distances[i]) / l * alpha * strengths[i], 
            y *= l, target.vx -= x * (b = bias[i]), target.vy -= y * b, source.vx += x * (b = 1 - b), 
            source.vy += y * b;
        }
        function initialize() {
            if (nodes) {
                var i, link, n = nodes.length, m = links.length, nodeById = map$1(nodes, id);
                for (i = 0, count = new Array(n); i < m; ++i) (link = links[i]).index = i, "object" != typeof link.source && (link.source = find(nodeById, link.source)), 
                "object" != typeof link.target && (link.target = find(nodeById, link.target)), count[link.source.index] = (count[link.source.index] || 0) + 1, 
                count[link.target.index] = (count[link.target.index] || 0) + 1;
                for (i = 0, bias = new Array(m); i < m; ++i) link = links[i], bias[i] = count[link.source.index] / (count[link.source.index] + count[link.target.index]);
                strengths = new Array(m), initializeStrength(), distances = new Array(m), initializeDistance();
            }
        }
        function initializeStrength() {
            if (nodes) for (var i = 0, n = links.length; i < n; ++i) strengths[i] = +strength(links[i], i, links);
        }
        function initializeDistance() {
            if (nodes) for (var i = 0, n = links.length; i < n; ++i) distances[i] = +distance(links[i], i, links);
        }
        return null == links && (links = []), force.initialize = function(_) {
            nodes = _, initialize();
        }, force.links = function(_) {
            return arguments.length ? (links = _, initialize(), force) : links;
        }, force.id = function(_) {
            return arguments.length ? (id = _, force) : id;
        }, force.iterations = function(_) {
            return arguments.length ? (iterations = +_, force) : iterations;
        }, force.strength = function(_) {
            return arguments.length ? (strength = "function" == typeof _ ? _ : constant$6(+_), 
            initializeStrength(), force) : strength;
        }, force.distance = function(_) {
            return arguments.length ? (distance = "function" == typeof _ ? _ : constant$6(+_), 
            initializeDistance(), force) : distance;
        }, force;
    }, exports.forceManyBody = function() {
        var nodes, node, alpha, strengths, strength = constant$6(-30), distanceMin2 = 1, distanceMax2 = 1 / 0, theta2 = .81;
        function force(_) {
            var i, n = nodes.length, tree = quadtree(nodes, x$1, y$1).visitAfter(accumulate);
            for (alpha = _, i = 0; i < n; ++i) node = nodes[i], tree.visit(apply);
        }
        function initialize() {
            if (nodes) {
                var i, node, n = nodes.length;
                for (strengths = new Array(n), i = 0; i < n; ++i) node = nodes[i], strengths[node.index] = +strength(node, i, nodes);
            }
        }
        function accumulate(quad) {
            var q, c, x, y, i, strength = 0, weight = 0;
            if (quad.length) {
                for (x = y = i = 0; i < 4; ++i) (q = quad[i]) && (c = Math.abs(q.value)) && (strength += q.value, 
                weight += c, x += c * q.x, y += c * q.y);
                quad.x = x / weight, quad.y = y / weight;
            } else for ((q = quad).x = q.data.x, q.y = q.data.y; strength += strengths[q.data.index], 
            q = q.next; ) ;
            quad.value = strength;
        }
        function apply(quad, x1, _, x2) {
            if (!quad.value) return !0;
            var x = quad.x - node.x, y = quad.y - node.y, w = x2 - x1, l = x * x + y * y;
            if (w * w / theta2 < l) return l < distanceMax2 && (0 === x && (l += (x = jiggle()) * x), 
            0 === y && (l += (y = jiggle()) * y), l < distanceMin2 && (l = Math.sqrt(distanceMin2 * l)), 
            node.vx += x * quad.value * alpha / l, node.vy += y * quad.value * alpha / l), !0;
            if (!(quad.length || distanceMax2 <= l)) for ((quad.data !== node || quad.next) && (0 === x && (l += (x = jiggle()) * x), 
            0 === y && (l += (y = jiggle()) * y), l < distanceMin2 && (l = Math.sqrt(distanceMin2 * l))); quad.data !== node && (w = strengths[quad.data.index] * alpha / l, 
            node.vx += x * w, node.vy += y * w), quad = quad.next; ) ;
        }
        return force.initialize = function(_) {
            nodes = _, initialize();
        }, force.strength = function(_) {
            return arguments.length ? (strength = "function" == typeof _ ? _ : constant$6(+_), 
            initialize(), force) : strength;
        }, force.distanceMin = function(_) {
            return arguments.length ? (distanceMin2 = _ * _, force) : Math.sqrt(distanceMin2);
        }, force.distanceMax = function(_) {
            return arguments.length ? (distanceMax2 = _ * _, force) : Math.sqrt(distanceMax2);
        }, force.theta = function(_) {
            return arguments.length ? (theta2 = _ * _, force) : Math.sqrt(theta2);
        }, force;
    }, exports.forceRadial = function(radius, x, y) {
        var nodes, strengths, radiuses, strength = constant$6(.1);
        function force(alpha) {
            for (var i = 0, n = nodes.length; i < n; ++i) {
                var node = nodes[i], dx = node.x - x || 1e-6, dy = node.y - y || 1e-6, r = Math.sqrt(dx * dx + dy * dy), k = (radiuses[i] - r) * strengths[i] * alpha / r;
                node.vx += dx * k, node.vy += dy * k;
            }
        }
        function initialize() {
            if (nodes) {
                var i, n = nodes.length;
                for (strengths = new Array(n), radiuses = new Array(n), i = 0; i < n; ++i) radiuses[i] = +radius(nodes[i], i, nodes), 
                strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes);
            }
        }
        return "function" != typeof radius && (radius = constant$6(+radius)), null == x && (x = 0), 
        null == y && (y = 0), force.initialize = function(_) {
            nodes = _, initialize();
        }, force.strength = function(_) {
            return arguments.length ? (strength = "function" == typeof _ ? _ : constant$6(+_), 
            initialize(), force) : strength;
        }, force.radius = function(_) {
            return arguments.length ? (radius = "function" == typeof _ ? _ : constant$6(+_), 
            initialize(), force) : radius;
        }, force.x = function(_) {
            return arguments.length ? (x = +_, force) : x;
        }, force.y = function(_) {
            return arguments.length ? (y = +_, force) : y;
        }, force;
    }, exports.forceSimulation = function(nodes) {
        var simulation, alpha = 1, alphaMin = .001, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = .6, forces = map$1(), stepper = timer(step), event = dispatch("tick", "end");
        function step() {
            tick(), event.call("tick", simulation), alpha < alphaMin && (stepper.stop(), event.call("end", simulation));
        }
        function tick() {
            var i, node, n = nodes.length;
            for (alpha += (alphaTarget - alpha) * alphaDecay, forces.each(function(force) {
                force(alpha);
            }), i = 0; i < n; ++i) null == (node = nodes[i]).fx ? node.x += node.vx *= velocityDecay : (node.x = node.fx, 
            node.vx = 0), null == node.fy ? node.y += node.vy *= velocityDecay : (node.y = node.fy, 
            node.vy = 0);
        }
        function initializeNodes() {
            for (var node, i = 0, n = nodes.length; i < n; ++i) {
                if ((node = nodes[i]).index = i, isNaN(node.x) || isNaN(node.y)) {
                    var radius = initialRadius * Math.sqrt(i), angle = i * initialAngle;
                    node.x = radius * Math.cos(angle), node.y = radius * Math.sin(angle);
                }
                (isNaN(node.vx) || isNaN(node.vy)) && (node.vx = node.vy = 0);
            }
        }
        function initializeForce(force) {
            return force.initialize && force.initialize(nodes), force;
        }
        return null == nodes && (nodes = []), initializeNodes(), simulation = {
            tick: tick,
            restart: function() {
                return stepper.restart(step), simulation;
            },
            stop: function() {
                return stepper.stop(), simulation;
            },
            nodes: function(_) {
                return arguments.length ? (nodes = _, initializeNodes(), forces.each(initializeForce), 
                simulation) : nodes;
            },
            alpha: function(_) {
                return arguments.length ? (alpha = +_, simulation) : alpha;
            },
            alphaMin: function(_) {
                return arguments.length ? (alphaMin = +_, simulation) : alphaMin;
            },
            alphaDecay: function(_) {
                return arguments.length ? (alphaDecay = +_, simulation) : +alphaDecay;
            },
            alphaTarget: function(_) {
                return arguments.length ? (alphaTarget = +_, simulation) : alphaTarget;
            },
            velocityDecay: function(_) {
                return arguments.length ? (velocityDecay = 1 - _, simulation) : 1 - velocityDecay;
            },
            force: function(name, _) {
                return 1 < arguments.length ? (null == _ ? forces.remove(name) : forces.set(name, initializeForce(_)), 
                simulation) : forces.get(name);
            },
            find: function(x, y, radius) {
                var dx, dy, d2, node, closest, i = 0, n = nodes.length;
                for (null == radius ? radius = 1 / 0 : radius *= radius, i = 0; i < n; ++i) (d2 = (dx = x - (node = nodes[i]).x) * dx + (dy = y - node.y) * dy) < radius && (closest = node, 
                radius = d2);
                return closest;
            },
            on: function(name, _) {
                return 1 < arguments.length ? (event.on(name, _), simulation) : event.on(name);
            }
        };
    }, exports.forceX = function(x) {
        var nodes, strengths, xz, strength = constant$6(.1);
        function force(alpha) {
            for (var node, i = 0, n = nodes.length; i < n; ++i) (node = nodes[i]).vx += (xz[i] - node.x) * strengths[i] * alpha;
        }
        function initialize() {
            if (nodes) {
                var i, n = nodes.length;
                for (strengths = new Array(n), xz = new Array(n), i = 0; i < n; ++i) strengths[i] = isNaN(xz[i] = +x(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
            }
        }
        return "function" != typeof x && (x = constant$6(null == x ? 0 : +x)), force.initialize = function(_) {
            nodes = _, initialize();
        }, force.strength = function(_) {
            return arguments.length ? (strength = "function" == typeof _ ? _ : constant$6(+_), 
            initialize(), force) : strength;
        }, force.x = function(_) {
            return arguments.length ? (x = "function" == typeof _ ? _ : constant$6(+_), initialize(), 
            force) : x;
        }, force;
    }, exports.forceY = function(y) {
        var nodes, strengths, yz, strength = constant$6(.1);
        function force(alpha) {
            for (var node, i = 0, n = nodes.length; i < n; ++i) (node = nodes[i]).vy += (yz[i] - node.y) * strengths[i] * alpha;
        }
        function initialize() {
            if (nodes) {
                var i, n = nodes.length;
                for (strengths = new Array(n), yz = new Array(n), i = 0; i < n; ++i) strengths[i] = isNaN(yz[i] = +y(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes);
            }
        }
        return "function" != typeof y && (y = constant$6(null == y ? 0 : +y)), force.initialize = function(_) {
            nodes = _, initialize();
        }, force.strength = function(_) {
            return arguments.length ? (strength = "function" == typeof _ ? _ : constant$6(+_), 
            initialize(), force) : strength;
        }, force.y = function(_) {
            return arguments.length ? (y = "function" == typeof _ ? _ : constant$6(+_), initialize(), 
            force) : y;
        }, force;
    }, exports.formatDefaultLocale = defaultLocale, exports.formatLocale = formatLocale, 
    exports.formatSpecifier = formatSpecifier, exports.precisionFixed = precisionFixed, 
    exports.precisionPrefix = precisionPrefix, exports.precisionRound = precisionRound, 
    exports.geoArea = function(object) {
        return areaSum.reset(), geoStream(object, areaStream), 2 * areaSum;
    }, exports.geoBounds = function(feature) {
        var i, n, a, b, merged, deltaMax, delta;
        if (phi1 = lambda1 = -(lambda0$1 = phi0 = 1 / 0), ranges = [], geoStream(feature, boundsStream), 
        n = ranges.length) {
            for (ranges.sort(rangeCompare), i = 1, merged = [ a = ranges[0] ]; i < n; ++i) rangeContains(a, (b = ranges[i])[0]) || rangeContains(a, b[1]) ? (angle(a[0], b[1]) > angle(a[0], a[1]) && (a[1] = b[1]), 
            angle(b[0], a[1]) > angle(a[0], a[1]) && (a[0] = b[0])) : merged.push(a = b);
            for (deltaMax = -1 / 0, i = 0, a = merged[n = merged.length - 1]; i <= n; a = b, 
            ++i) b = merged[i], (delta = angle(a[1], b[0])) > deltaMax && (deltaMax = delta, 
            lambda0$1 = b[0], lambda1 = a[1]);
        }
        return ranges = range = null, lambda0$1 === 1 / 0 || phi0 === 1 / 0 ? [ [ NaN, NaN ], [ NaN, NaN ] ] : [ [ lambda0$1, phi0 ], [ lambda1, phi1 ] ];
    }, exports.geoCentroid = function(object) {
        W0 = W1 = X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0, geoStream(object, centroidStream);
        var x = X2, y = Y2, z = Z2, m = x * x + y * y + z * z;
        return m < epsilon2$1 && (x = X1, y = Y1, z = Z1, W1 < epsilon$2 && (x = X0, y = Y0, 
        z = Z0), (m = x * x + y * y + z * z) < epsilon2$1) ? [ NaN, NaN ] : [ atan2(y, x) * degrees$1, asin(z / sqrt(m)) * degrees$1 ];
    }, exports.geoCircle = function() {
        var ring, rotate, center = constant$7([ 0, 0 ]), radius = constant$7(90), precision = constant$7(6), stream = {
            point: function(x, y) {
                ring.push(x = rotate(x, y)), x[0] *= degrees$1, x[1] *= degrees$1;
            }
        };
        function circle() {
            var c = center.apply(this, arguments), r = radius.apply(this, arguments) * radians, p = precision.apply(this, arguments) * radians;
            return ring = [], rotate = rotateRadians(-c[0] * radians, -c[1] * radians, 0).invert, 
            circleStream(stream, r, p, 1), c = {
                type: "Polygon",
                coordinates: [ ring ]
            }, ring = rotate = null, c;
        }
        return circle.center = function(_) {
            return arguments.length ? (center = "function" == typeof _ ? _ : constant$7([ +_[0], +_[1] ]), 
            circle) : center;
        }, circle.radius = function(_) {
            return arguments.length ? (radius = "function" == typeof _ ? _ : constant$7(+_), 
            circle) : radius;
        }, circle.precision = function(_) {
            return arguments.length ? (precision = "function" == typeof _ ? _ : constant$7(+_), 
            circle) : precision;
        }, circle;
    }, exports.geoClipAntimeridian = clipAntimeridian, exports.geoClipCircle = clipCircle, 
    exports.geoClipExtent = function() {
        var cache, cacheStream, clip, x0 = 0, y0 = 0, x1 = 960, y1 = 500;
        return clip = {
            stream: function(stream) {
                return cache && cacheStream === stream ? cache : cache = clipRectangle(x0, y0, x1, y1)(cacheStream = stream);
            },
            extent: function(_) {
                return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], 
                cache = cacheStream = null, clip) : [ [ x0, y0 ], [ x1, y1 ] ];
            }
        };
    }, exports.geoClipRectangle = clipRectangle, exports.geoContains = function(object, point) {
        return (object && containsObjectType.hasOwnProperty(object.type) ? containsObjectType[object.type] : containsGeometry)(object, point);
    }, exports.geoDistance = distance, exports.geoGraticule = graticule, exports.geoGraticule10 = function() {
        return graticule()();
    }, exports.geoInterpolate = function(a, b) {
        var x0 = a[0] * radians, y0 = a[1] * radians, x1 = b[0] * radians, y1 = b[1] * radians, cy0 = cos$1(y0), sy0 = sin$1(y0), cy1 = cos$1(y1), sy1 = sin$1(y1), kx0 = cy0 * cos$1(x0), ky0 = cy0 * sin$1(x0), kx1 = cy1 * cos$1(x1), ky1 = cy1 * sin$1(x1), d = 2 * asin(sqrt(haversin(y1 - y0) + cy0 * cy1 * haversin(x1 - x0))), k = sin$1(d), interpolate = d ? function(t) {
            var B = sin$1(t *= d) / k, A = sin$1(d - t) / k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
            return [ atan2(y, x) * degrees$1, atan2(z, sqrt(x * x + y * y)) * degrees$1 ];
        } : function() {
            return [ x0 * degrees$1, y0 * degrees$1 ];
        };
        return interpolate.distance = d, interpolate;
    }, exports.geoLength = length$1, exports.geoPath = function(projection, context) {
        var projectionStream, contextStream, pointRadius = 4.5;
        function path(object) {
            return object && ("function" == typeof pointRadius && contextStream.pointRadius(+pointRadius.apply(this, arguments)), 
            geoStream(object, projectionStream(contextStream))), contextStream.result();
        }
        return path.area = function(object) {
            return geoStream(object, projectionStream(areaStream$1)), areaStream$1.result();
        }, path.measure = function(object) {
            return geoStream(object, projectionStream(lengthStream$1)), lengthStream$1.result();
        }, path.bounds = function(object) {
            return geoStream(object, projectionStream(boundsStream$1)), boundsStream$1.result();
        }, path.centroid = function(object) {
            return geoStream(object, projectionStream(centroidStream$1)), centroidStream$1.result();
        }, path.projection = function(_) {
            return arguments.length ? (projectionStream = null == _ ? (projection = null, identity$4) : (projection = _).stream, 
            path) : projection;
        }, path.context = function(_) {
            return arguments.length ? (contextStream = null == _ ? (context = null, new PathString()) : new PathContext(context = _), 
            "function" != typeof pointRadius && contextStream.pointRadius(pointRadius), path) : context;
        }, path.pointRadius = function(_) {
            return arguments.length ? (pointRadius = "function" == typeof _ ? _ : (contextStream.pointRadius(+_), 
            +_), path) : pointRadius;
        }, path.projection(projection).context(context);
    }, exports.geoAlbers = albers, exports.geoAlbersUsa = function() {
        var cache, cacheStream, lower48Point, alaskaPoint, hawaiiPoint, point, lower48 = albers(), alaska = conicEqualArea().rotate([ 154, 0 ]).center([ -2, 58.5 ]).parallels([ 55, 65 ]), hawaii = conicEqualArea().rotate([ 157, 0 ]).center([ -3, 19.9 ]).parallels([ 8, 18 ]), pointStream = {
            point: function(x, y) {
                point = [ x, y ];
            }
        };
        function albersUsa(coordinates) {
            var x = coordinates[0], y = coordinates[1];
            return point = null, lower48Point.point(x, y), point || (alaskaPoint.point(x, y), 
            point) || (hawaiiPoint.point(x, y), point);
        }
        function reset() {
            return cache = cacheStream = null, albersUsa;
        }
        return albersUsa.invert = function(coordinates) {
            var k = lower48.scale(), t = lower48.translate(), x = (coordinates[0] - t[0]) / k, y = (coordinates[1] - t[1]) / k;
            return (.12 <= y && y < .234 && -.425 <= x && x < -.214 ? alaska : .166 <= y && y < .234 && -.214 <= x && x < -.115 ? hawaii : lower48).invert(coordinates);
        }, albersUsa.stream = function(stream) {
            return cache && cacheStream === stream ? cache : (streams = [ lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream) ], 
            n = streams.length, cache = {
                point: function(x, y) {
                    for (var i = -1; ++i < n; ) streams[i].point(x, y);
                },
                sphere: function() {
                    for (var i = -1; ++i < n; ) streams[i].sphere();
                },
                lineStart: function() {
                    for (var i = -1; ++i < n; ) streams[i].lineStart();
                },
                lineEnd: function() {
                    for (var i = -1; ++i < n; ) streams[i].lineEnd();
                },
                polygonStart: function() {
                    for (var i = -1; ++i < n; ) streams[i].polygonStart();
                },
                polygonEnd: function() {
                    for (var i = -1; ++i < n; ) streams[i].polygonEnd();
                }
            });
            var streams, n;
        }, albersUsa.precision = function(_) {
            return arguments.length ? (lower48.precision(_), alaska.precision(_), hawaii.precision(_), 
            reset()) : lower48.precision();
        }, albersUsa.scale = function(_) {
            return arguments.length ? (lower48.scale(_), alaska.scale(.35 * _), hawaii.scale(_), 
            albersUsa.translate(lower48.translate())) : lower48.scale();
        }, albersUsa.translate = function(_) {
            if (!arguments.length) return lower48.translate();
            var k = lower48.scale(), x = +_[0], y = +_[1];
            return lower48Point = lower48.translate(_).clipExtent([ [ x - .455 * k, y - .238 * k ], [ x + .455 * k, y + .238 * k ] ]).stream(pointStream), 
            alaskaPoint = alaska.translate([ x - .307 * k, y + .201 * k ]).clipExtent([ [ x - .425 * k + epsilon$2, y + .12 * k + epsilon$2 ], [ x - .214 * k - epsilon$2, y + .234 * k - epsilon$2 ] ]).stream(pointStream), 
            hawaiiPoint = hawaii.translate([ x - .205 * k, y + .212 * k ]).clipExtent([ [ x - .214 * k + epsilon$2, y + .166 * k + epsilon$2 ], [ x - .115 * k - epsilon$2, y + .234 * k - epsilon$2 ] ]).stream(pointStream), 
            reset();
        }, albersUsa.fitExtent = function(extent, object) {
            return fitExtent(albersUsa, extent, object);
        }, albersUsa.fitSize = function(size, object) {
            return fitSize(albersUsa, size, object);
        }, albersUsa.fitWidth = function(width, object) {
            return fitWidth(albersUsa, width, object);
        }, albersUsa.fitHeight = function(height, object) {
            return fitHeight(albersUsa, height, object);
        }, albersUsa.scale(1070);
    }, exports.geoAzimuthalEqualArea = function() {
        return projection(azimuthalEqualAreaRaw).scale(124.75).clipAngle(179.999);
    }, exports.geoAzimuthalEqualAreaRaw = azimuthalEqualAreaRaw, exports.geoAzimuthalEquidistant = function() {
        return projection(azimuthalEquidistantRaw).scale(79.4188).clipAngle(179.999);
    }, exports.geoAzimuthalEquidistantRaw = azimuthalEquidistantRaw, exports.geoConicConformal = function() {
        return conicProjection(conicConformalRaw).scale(109.5).parallels([ 30, 30 ]);
    }, exports.geoConicConformalRaw = conicConformalRaw, exports.geoConicEqualArea = conicEqualArea, 
    exports.geoConicEqualAreaRaw = conicEqualAreaRaw, exports.geoConicEquidistant = function() {
        return conicProjection(conicEquidistantRaw).scale(131.154).center([ 0, 13.9389 ]);
    }, exports.geoConicEquidistantRaw = conicEquidistantRaw, exports.geoEquirectangular = function() {
        return projection(equirectangularRaw).scale(152.63);
    }, exports.geoEquirectangularRaw = equirectangularRaw, exports.geoGnomonic = function() {
        return projection(gnomonicRaw).scale(144.049).clipAngle(60);
    }, exports.geoGnomonicRaw = gnomonicRaw, exports.geoIdentity = function() {
        var y0, x1, y1, cache, cacheStream, projection, k = 1, tx = 0, ty = 0, sx = 1, sy = 1, transform$$1 = identity$4, x0 = null, postclip = identity$4;
        function reset() {
            return cache = cacheStream = null, projection;
        }
        return projection = {
            stream: function(stream) {
                return cache && cacheStream === stream ? cache : cache = transform$$1(postclip(cacheStream = stream));
            },
            postclip: function(_) {
                return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip;
            },
            clipExtent: function(_) {
                return arguments.length ? (postclip = null == _ ? (x0 = y0 = x1 = y1 = null, identity$4) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), 
                reset()) : null == x0 ? null : [ [ x0, y0 ], [ x1, y1 ] ];
            },
            scale: function(_) {
                return arguments.length ? (transform$$1 = scaleTranslate((k = +_) * sx, k * sy, tx, ty), 
                reset()) : k;
            },
            translate: function(_) {
                return arguments.length ? (transform$$1 = scaleTranslate(k * sx, k * sy, tx = +_[0], ty = +_[1]), 
                reset()) : [ tx, ty ];
            },
            reflectX: function(_) {
                return arguments.length ? (transform$$1 = scaleTranslate(k * (sx = _ ? -1 : 1), k * sy, tx, ty), 
                reset()) : sx < 0;
            },
            reflectY: function(_) {
                return arguments.length ? (transform$$1 = scaleTranslate(k * sx, k * (sy = _ ? -1 : 1), tx, ty), 
                reset()) : sy < 0;
            },
            fitExtent: function(extent, object) {
                return fitExtent(projection, extent, object);
            },
            fitSize: function(size, object) {
                return fitSize(projection, size, object);
            },
            fitWidth: function(width, object) {
                return fitWidth(projection, width, object);
            },
            fitHeight: function(height, object) {
                return fitHeight(projection, height, object);
            }
        };
    }, exports.geoProjection = projection, exports.geoProjectionMutator = projectionMutator, 
    exports.geoMercator = function() {
        return mercatorProjection(mercatorRaw).scale(961 / tau$3);
    }, exports.geoMercatorRaw = mercatorRaw, exports.geoNaturalEarth1 = function() {
        return projection(naturalEarth1Raw).scale(175.295);
    }, exports.geoNaturalEarth1Raw = naturalEarth1Raw, exports.geoOrthographic = function() {
        return projection(orthographicRaw).scale(249.5).clipAngle(90 + epsilon$2);
    }, exports.geoOrthographicRaw = orthographicRaw, exports.geoStereographic = function() {
        return projection(stereographicRaw).scale(250).clipAngle(142);
    }, exports.geoStereographicRaw = stereographicRaw, exports.geoTransverseMercator = function() {
        var m = mercatorProjection(transverseMercatorRaw), center = m.center, rotate = m.rotate;
        return m.center = function(_) {
            return arguments.length ? center([ -_[1], _[0] ]) : [ (_ = center())[1], -_[0] ];
        }, m.rotate = function(_) {
            return arguments.length ? rotate([ _[0], _[1], 2 < _.length ? _[2] + 90 : 90 ]) : [ (_ = rotate())[0], _[1], _[2] - 90 ];
        }, rotate([ 0, 0, 90 ]).scale(159.155);
    }, exports.geoTransverseMercatorRaw = transverseMercatorRaw, exports.geoRotation = rotation, 
    exports.geoStream = geoStream, exports.geoTransform = function(methods) {
        return {
            stream: transformer(methods)
        };
    }, exports.cluster = function() {
        var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = !1;
        function cluster(root) {
            var previousNode, x = 0;
            root.eachAfter(function(node) {
                var children = node.children;
                children ? (node.x = function(children) {
                    return children.reduce(meanXReduce, 0) / children.length;
                }(children), node.y = function(children) {
                    return 1 + children.reduce(maxYReduce, 0);
                }(children)) : (node.x = previousNode ? x += separation(node, previousNode) : 0, 
                node.y = 0, previousNode = node);
            });
            var left = function(node) {
                for (var children; children = node.children; ) node = children[0];
                return node;
            }(root), right = function(node) {
                for (var children; children = node.children; ) node = children[children.length - 1];
                return node;
            }(root), x0 = left.x - separation(left, right) / 2, x1 = right.x + separation(right, left) / 2;
            return root.eachAfter(nodeSize ? function(node) {
                node.x = (node.x - root.x) * dx, node.y = (root.y - node.y) * dy;
            } : function(node) {
                node.x = (node.x - x0) / (x1 - x0) * dx, node.y = (1 - (root.y ? node.y / root.y : 1)) * dy;
            });
        }
        return cluster.separation = function(x) {
            return arguments.length ? (separation = x, cluster) : separation;
        }, cluster.size = function(x) {
            return arguments.length ? (nodeSize = !1, dx = +x[0], dy = +x[1], cluster) : nodeSize ? null : [ dx, dy ];
        }, cluster.nodeSize = function(x) {
            return arguments.length ? (nodeSize = !0, dx = +x[0], dy = +x[1], cluster) : nodeSize ? [ dx, dy ] : null;
        }, cluster;
    }, exports.hierarchy = hierarchy, exports.pack = function() {
        var radius = null, dx = 1, dy = 1, padding = constantZero;
        function pack(root) {
            return root.x = dx / 2, root.y = dy / 2, radius ? root.eachBefore(radiusLeaf(radius)).eachAfter(packChildren(padding, .5)).eachBefore(translateChild(1)) : root.eachBefore(radiusLeaf(defaultRadius$1)).eachAfter(packChildren(constantZero, 1)).eachAfter(packChildren(padding, root.r / Math.min(dx, dy))).eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r))), 
            root;
        }
        return pack.radius = function(x) {
            return arguments.length ? (radius = null == (f = x) ? null : required(f), pack) : radius;
            var f;
        }, pack.size = function(x) {
            return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [ dx, dy ];
        }, pack.padding = function(x) {
            return arguments.length ? (padding = "function" == typeof x ? x : constant$8(+x), 
            pack) : padding;
        }, pack;
    }, exports.packSiblings = function(circles) {
        return packEnclose(circles), circles;
    }, exports.packEnclose = enclose, exports.partition = function() {
        var dx = 1, dy = 1, padding = 0, round = !1;
        function partition(root) {
            var n = root.height + 1;
            return root.x0 = root.y0 = padding, root.x1 = dx, root.y1 = dy / n, root.eachBefore(function(dy, n) {
                return function(node) {
                    node.children && treemapDice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n);
                    var x0 = node.x0, y0 = node.y0, x1 = node.x1 - padding, y1 = node.y1 - padding;
                    x1 < x0 && (x0 = x1 = (x0 + x1) / 2), y1 < y0 && (y0 = y1 = (y0 + y1) / 2), node.x0 = x0, 
                    node.y0 = y0, node.x1 = x1, node.y1 = y1;
                };
            }(dy, n)), round && root.eachBefore(roundNode), root;
        }
        return partition.round = function(x) {
            return arguments.length ? (round = !!x, partition) : round;
        }, partition.size = function(x) {
            return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [ dx, dy ];
        }, partition.padding = function(x) {
            return arguments.length ? (padding = +x, partition) : padding;
        }, partition;
    }, exports.stratify = function() {
        var id = defaultId, parentId = defaultParentId;
        function stratify(data) {
            var d, i, root, parent, node, nodeId, nodeKey, n = data.length, nodes = new Array(n), nodeByKey = {};
            for (i = 0; i < n; ++i) d = data[i], node = nodes[i] = new Node(d), null != (nodeId = id(d, i, data)) && (nodeId += "") && (nodeByKey[nodeKey = keyPrefix$1 + (node.id = nodeId)] = nodeKey in nodeByKey ? ambiguous : node);
            for (i = 0; i < n; ++i) if (node = nodes[i], null != (nodeId = parentId(data[i], i, data)) && (nodeId += "")) {
                if (!(parent = nodeByKey[keyPrefix$1 + nodeId])) throw new Error("missing: " + nodeId);
                if (parent === ambiguous) throw new Error("ambiguous: " + nodeId);
                parent.children ? parent.children.push(node) : parent.children = [ node ], node.parent = parent;
            } else {
                if (root) throw new Error("multiple roots");
                root = node;
            }
            if (!root) throw new Error("no root");
            if (root.parent = preroot, root.eachBefore(function(node) {
                node.depth = node.parent.depth + 1, --n;
            }).eachBefore(computeHeight), root.parent = null, 0 < n) throw new Error("cycle");
            return root;
        }
        return stratify.id = function(x) {
            return arguments.length ? (id = required(x), stratify) : id;
        }, stratify.parentId = function(x) {
            return arguments.length ? (parentId = required(x), stratify) : parentId;
        }, stratify;
    }, exports.tree = function() {
        var separation = defaultSeparation$1, dx = 1, dy = 1, nodeSize = null;
        function tree(root) {
            var t = function(root) {
                for (var node, child, children, i, n, tree = new TreeNode(root, 0), nodes = [ tree ]; node = nodes.pop(); ) if (children = node._.children) for (node.children = new Array(n = children.length), 
                i = n - 1; 0 <= i; --i) nodes.push(child = node.children[i] = new TreeNode(children[i], i)), 
                child.parent = node;
                return (tree.parent = new TreeNode(null, 0)).children = [ tree ], tree;
            }(root);
            if (t.eachAfter(firstWalk), t.parent.m = -t.z, t.eachBefore(secondWalk), nodeSize) root.eachBefore(sizeNode); else {
                var left = root, right = root, bottom = root;
                root.eachBefore(function(node) {
                    node.x < left.x && (left = node), node.x > right.x && (right = node), node.depth > bottom.depth && (bottom = node);
                });
                var s = left === right ? 1 : separation(left, right) / 2, tx = s - left.x, kx = dx / (right.x + s + tx), ky = dy / (bottom.depth || 1);
                root.eachBefore(function(node) {
                    node.x = (node.x + tx) * kx, node.y = node.depth * ky;
                });
            }
            return root;
        }
        function firstWalk(v) {
            var children = v.children, siblings = v.parent.children, w = v.i ? siblings[v.i - 1] : null;
            if (children) {
                !function(v) {
                    for (var w, shift = 0, change = 0, children = v.children, i = children.length; 0 <= --i; ) (w = children[i]).z += shift, 
                    w.m += shift, shift += w.s + (change += w.c);
                }(v);
                var midpoint = (children[0].z + children[children.length - 1].z) / 2;
                w ? (v.z = w.z + separation(v._, w._), v.m = v.z - midpoint) : v.z = midpoint;
            } else w && (v.z = w.z + separation(v._, w._));
            v.parent.A = function(v, w, ancestor) {
                if (w) {
                    for (var shift, vip = v, vop = v, vim = w, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m; vim = nextRight(vim), 
                    vip = nextLeft(vip), vim && vip; ) vom = nextLeft(vom), (vop = nextRight(vop)).a = v, 
                    0 < (shift = vim.z + sim - vip.z - sip + separation(vim._, vip._)) && (moveSubtree(nextAncestor(vim, v, ancestor), v, shift), 
                    sip += shift, sop += shift), sim += vim.m, sip += vip.m, som += vom.m, sop += vop.m;
                    vim && !nextRight(vop) && (vop.t = vim, vop.m += sim - sop), vip && !nextLeft(vom) && (vom.t = vip, 
                    vom.m += sip - som, ancestor = v);
                }
                return ancestor;
            }(v, w, v.parent.A || siblings[0]);
        }
        function secondWalk(v) {
            v._.x = v.z + v.parent.m, v.m += v.parent.m;
        }
        function sizeNode(node) {
            node.x *= dx, node.y = node.depth * dy;
        }
        return tree.separation = function(x) {
            return arguments.length ? (separation = x, tree) : separation;
        }, tree.size = function(x) {
            return arguments.length ? (nodeSize = !1, dx = +x[0], dy = +x[1], tree) : nodeSize ? null : [ dx, dy ];
        }, tree.nodeSize = function(x) {
            return arguments.length ? (nodeSize = !0, dx = +x[0], dy = +x[1], tree) : nodeSize ? [ dx, dy ] : null;
        }, tree;
    }, exports.treemap = function() {
        var tile = squarify, round = !1, dx = 1, dy = 1, paddingStack = [ 0 ], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero;
        function treemap(root) {
            return root.x0 = root.y0 = 0, root.x1 = dx, root.y1 = dy, root.eachBefore(positionNode), 
            paddingStack = [ 0 ], round && root.eachBefore(roundNode), root;
        }
        function positionNode(node) {
            var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p;
            x1 < x0 && (x0 = x1 = (x0 + x1) / 2), y1 < y0 && (y0 = y1 = (y0 + y1) / 2), node.x0 = x0, 
            node.y0 = y0, node.x1 = x1, node.y1 = y1, node.children && (p = paddingStack[node.depth + 1] = paddingInner(node) / 2, 
            x0 += paddingLeft(node) - p, y0 += paddingTop(node) - p, (x1 -= paddingRight(node) - p) < x0 && (x0 = x1 = (x0 + x1) / 2), 
            (y1 -= paddingBottom(node) - p) < y0 && (y0 = y1 = (y0 + y1) / 2), tile(node, x0, y0, x1, y1));
        }
        return treemap.round = function(x) {
            return arguments.length ? (round = !!x, treemap) : round;
        }, treemap.size = function(x) {
            return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [ dx, dy ];
        }, treemap.tile = function(x) {
            return arguments.length ? (tile = required(x), treemap) : tile;
        }, treemap.padding = function(x) {
            return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();
        }, treemap.paddingInner = function(x) {
            return arguments.length ? (paddingInner = "function" == typeof x ? x : constant$8(+x), 
            treemap) : paddingInner;
        }, treemap.paddingOuter = function(x) {
            return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();
        }, treemap.paddingTop = function(x) {
            return arguments.length ? (paddingTop = "function" == typeof x ? x : constant$8(+x), 
            treemap) : paddingTop;
        }, treemap.paddingRight = function(x) {
            return arguments.length ? (paddingRight = "function" == typeof x ? x : constant$8(+x), 
            treemap) : paddingRight;
        }, treemap.paddingBottom = function(x) {
            return arguments.length ? (paddingBottom = "function" == typeof x ? x : constant$8(+x), 
            treemap) : paddingBottom;
        }, treemap.paddingLeft = function(x) {
            return arguments.length ? (paddingLeft = "function" == typeof x ? x : constant$8(+x), 
            treemap) : paddingLeft;
        }, treemap;
    }, exports.treemapBinary = function(parent, x0, y0, x1, y1) {
        var i, sum, nodes = parent.children, n = nodes.length, sums = new Array(n + 1);
        for (sums[0] = sum = i = 0; i < n; ++i) sums[i + 1] = sum += nodes[i].value;
        !function partition(i, j, value, x0, y0, x1, y1) {
            if (j - 1 <= i) {
                var node = nodes[i];
                return node.x0 = x0, node.y0 = y0, node.x1 = x1, void (node.y1 = y1);
            }
            for (var valueOffset = sums[i], valueTarget = value / 2 + valueOffset, k = i + 1, hi = j - 1; k < hi; ) {
                var mid = k + hi >>> 1;
                sums[mid] < valueTarget ? k = mid + 1 : hi = mid;
            }
            valueTarget - sums[k - 1] < sums[k] - valueTarget && i + 1 < k && --k;
            var valueLeft = sums[k] - valueOffset, valueRight = value - valueLeft;
            if (y1 - y0 < x1 - x0) {
                var xk = (x0 * valueRight + x1 * valueLeft) / value;
                partition(i, k, valueLeft, x0, y0, xk, y1), partition(k, j, valueRight, xk, y0, x1, y1);
            } else {
                var yk = (y0 * valueRight + y1 * valueLeft) / value;
                partition(i, k, valueLeft, x0, y0, x1, yk), partition(k, j, valueRight, x0, yk, x1, y1);
            }
        }(0, n, parent.value, x0, y0, x1, y1);
    }, exports.treemapDice = treemapDice, exports.treemapSlice = treemapSlice, exports.treemapSliceDice = function(parent, x0, y0, x1, y1) {
        (1 & parent.depth ? treemapSlice : treemapDice)(parent, x0, y0, x1, y1);
    }, exports.treemapSquarify = squarify, exports.treemapResquarify = resquarify, exports.interpolate = interpolateValue, 
    exports.interpolateArray = array$1, exports.interpolateBasis = basis$1, exports.interpolateBasisClosed = basisClosed, 
    exports.interpolateDate = date, exports.interpolateNumber = reinterpolate, exports.interpolateObject = object, 
    exports.interpolateRound = interpolateRound, exports.interpolateString = interpolateString, 
    exports.interpolateTransformCss = interpolateTransformCss, exports.interpolateTransformSvg = interpolateTransformSvg, 
    exports.interpolateZoom = interpolateZoom, exports.interpolateRgb = interpolateRgb, 
    exports.interpolateRgbBasis = rgbBasis, exports.interpolateRgbBasisClosed = rgbBasisClosed, 
    exports.interpolateHsl = hsl$2, exports.interpolateHslLong = hslLong, exports.interpolateLab = function(start, end) {
        var l = nogamma((start = lab(start)).l, (end = lab(end)).l), a = nogamma(start.a, end.a), b = nogamma(start.b, end.b), opacity = nogamma(start.opacity, end.opacity);
        return function(t) {
            return start.l = l(t), start.a = a(t), start.b = b(t), start.opacity = opacity(t), 
            start + "";
        };
    }, exports.interpolateHcl = hcl$2, exports.interpolateHclLong = hclLong, exports.interpolateCubehelix = cubehelix$2, 
    exports.interpolateCubehelixLong = cubehelixLong, exports.quantize = function(interpolator, n) {
        for (var samples = new Array(n), i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1));
        return samples;
    }, exports.path = path, exports.polygonArea = function(polygon) {
        for (var a, i = -1, n = polygon.length, b = polygon[n - 1], area = 0; ++i < n; ) a = b, 
        b = polygon[i], area += a[1] * b[0] - a[0] * b[1];
        return area / 2;
    }, exports.polygonCentroid = function(polygon) {
        for (var a, c, i = -1, n = polygon.length, x = 0, y = 0, b = polygon[n - 1], k = 0; ++i < n; ) a = b, 
        b = polygon[i], k += c = a[0] * b[1] - b[0] * a[1], x += (a[0] + b[0]) * c, y += (a[1] + b[1]) * c;
        return [ x / (k *= 3), y / k ];
    }, exports.polygonHull = function(points) {
        if ((n = points.length) < 3) return null;
        var i, n, sortedPoints = new Array(n), flippedPoints = new Array(n);
        for (i = 0; i < n; ++i) sortedPoints[i] = [ +points[i][0], +points[i][1], i ];
        for (sortedPoints.sort(lexicographicOrder), i = 0; i < n; ++i) flippedPoints[i] = [ sortedPoints[i][0], -sortedPoints[i][1] ];
        var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints), skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull = [];
        for (i = upperIndexes.length - 1; 0 <= i; --i) hull.push(points[sortedPoints[upperIndexes[i]][2]]);
        for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) hull.push(points[sortedPoints[lowerIndexes[i]][2]]);
        return hull;
    }, exports.polygonContains = function(polygon, point) {
        for (var x1, y1, n = polygon.length, p = polygon[n - 1], x = point[0], y = point[1], x0 = p[0], y0 = p[1], inside = !1, i = 0; i < n; ++i) x1 = (p = polygon[i])[0], 
        y < (y1 = p[1]) != y < y0 && x < (x0 - x1) * (y - y1) / (y0 - y1) + x1 && (inside = !inside), 
        x0 = x1, y0 = y1;
        return inside;
    }, exports.polygonLength = function(polygon) {
        for (var xa, ya, i = -1, n = polygon.length, b = polygon[n - 1], xb = b[0], yb = b[1], perimeter = 0; ++i < n; ) xa = xb, 
        ya = yb, xa -= xb = (b = polygon[i])[0], ya -= yb = b[1], perimeter += Math.sqrt(xa * xa + ya * ya);
        return perimeter;
    }, exports.quadtree = quadtree, exports.queue = queue, exports.randomUniform = uniform, 
    exports.randomNormal = normal, exports.randomLogNormal = logNormal, exports.randomBates = bates, 
    exports.randomIrwinHall = irwinHall, exports.randomExponential = exponential$1, 
    exports.request = request, exports.html = html, exports.json = json, exports.text = text, 
    exports.xml = xml, exports.csv = csv$1, exports.tsv = tsv$1, exports.scaleBand = band, 
    exports.scalePoint = function() {
        return function pointish(scale) {
            var copy = scale.copy;
            return scale.padding = scale.paddingOuter, delete scale.paddingInner, delete scale.paddingOuter, 
            scale.copy = function() {
                return pointish(copy());
            }, scale;
        }(band().paddingInner(1));
    }, exports.scaleIdentity = function identity$6() {
        var domain = [ 0, 1 ];
        function scale(x) {
            return +x;
        }
        return (scale.invert = scale).domain = scale.range = function(_) {
            return arguments.length ? (domain = map$3.call(_, number$2), scale) : domain.slice();
        }, scale.copy = function() {
            return identity$6().domain(domain);
        }, linearish(scale);
    }, exports.scaleLinear = function linear$2() {
        var scale = continuous(deinterpolateLinear, reinterpolate);
        return scale.copy = function() {
            return copy(scale, linear$2());
        }, linearish(scale);
    }, exports.scaleLog = function log$1() {
        var scale = continuous(deinterpolate, reinterpolate$1).domain([ 1, 10 ]), domain = scale.domain, base = 10, logs = logp(10), pows = powp(10);
        function rescale() {
            return logs = logp(base), pows = powp(base), domain()[0] < 0 && (logs = reflect(logs), 
            pows = reflect(pows)), scale;
        }
        return scale.base = function(_) {
            return arguments.length ? (base = +_, rescale()) : base;
        }, scale.domain = function(_) {
            return arguments.length ? (domain(_), rescale()) : domain();
        }, scale.ticks = function(count) {
            var r, d = domain(), u = d[0], v = d[d.length - 1];
            (r = v < u) && (i = u, u = v, v = i);
            var p, k, t, i = logs(u), j = logs(v), n = null == count ? 10 : +count, z = [];
            if (!(base % 1) && j - i < n) {
                if (i = Math.round(i) - 1, j = Math.round(j) + 1, 0 < u) {
                    for (;i < j; ++i) for (k = 1, p = pows(i); k < base; ++k) if (!((t = p * k) < u)) {
                        if (v < t) break;
                        z.push(t);
                    }
                } else for (;i < j; ++i) for (k = base - 1, p = pows(i); 1 <= k; --k) if (!((t = p * k) < u)) {
                    if (v < t) break;
                    z.push(t);
                }
            } else z = ticks(i, j, Math.min(j - i, n)).map(pows);
            return r ? z.reverse() : z;
        }, scale.tickFormat = function(count, specifier) {
            if (null == specifier && (specifier = 10 === base ? ".0e" : ","), "function" != typeof specifier && (specifier = exports.format(specifier)), 
            count === 1 / 0) return specifier;
            null == count && (count = 10);
            var k = Math.max(1, base * count / scale.ticks().length);
            return function(d) {
                var i = d / pows(Math.round(logs(d)));
                return i * base < base - .5 && (i *= base), i <= k ? specifier(d) : "";
            };
        }, scale.nice = function() {
            return domain(nice(domain(), {
                floor: function(x) {
                    return pows(Math.floor(logs(x)));
                },
                ceil: function(x) {
                    return pows(Math.ceil(logs(x)));
                }
            }));
        }, scale.copy = function() {
            return copy(scale, log$1().base(base));
        }, scale;
    }, exports.scaleOrdinal = ordinal, exports.scaleImplicit = implicit, exports.scalePow = pow$1, 
    exports.scaleSqrt = function() {
        return pow$1().exponent(.5);
    }, exports.scaleQuantile = function quantile$$1() {
        var domain = [], range = [], thresholds = [];
        function rescale() {
            var i = 0, n = Math.max(1, range.length);
            for (thresholds = new Array(n - 1); ++i < n; ) thresholds[i - 1] = threshold(domain, i / n);
            return scale;
        }
        function scale(x) {
            if (!isNaN(x = +x)) return range[bisectRight(thresholds, x)];
        }
        return scale.invertExtent = function(y) {
            var i = range.indexOf(y);
            return i < 0 ? [ NaN, NaN ] : [ 0 < i ? thresholds[i - 1] : domain[0], i < thresholds.length ? thresholds[i] : domain[domain.length - 1] ];
        }, scale.domain = function(_) {
            if (!arguments.length) return domain.slice();
            domain = [];
            for (var d, i = 0, n = _.length; i < n; ++i) null == (d = _[i]) || isNaN(d = +d) || domain.push(d);
            return domain.sort(ascending), rescale();
        }, scale.range = function(_) {
            return arguments.length ? (range = slice$5.call(_), rescale()) : range.slice();
        }, scale.quantiles = function() {
            return thresholds.slice();
        }, scale.copy = function() {
            return quantile$$1().domain(domain).range(range);
        }, scale;
    }, exports.scaleQuantize = function quantize$1() {
        var x0 = 0, x1 = 1, n = 1, domain = [ .5 ], range = [ 0, 1 ];
        function scale(x) {
            if (x <= x) return range[bisectRight(domain, x, 0, n)];
        }
        function rescale() {
            var i = -1;
            for (domain = new Array(n); ++i < n; ) domain[i] = ((i + 1) * x1 - (i - n) * x0) / (n + 1);
            return scale;
        }
        return scale.domain = function(_) {
            return arguments.length ? (x0 = +_[0], x1 = +_[1], rescale()) : [ x0, x1 ];
        }, scale.range = function(_) {
            return arguments.length ? (n = (range = slice$5.call(_)).length - 1, rescale()) : range.slice();
        }, scale.invertExtent = function(y) {
            var i = range.indexOf(y);
            return i < 0 ? [ NaN, NaN ] : i < 1 ? [ x0, domain[0] ] : n <= i ? [ domain[n - 1], x1 ] : [ domain[i - 1], domain[i] ];
        }, scale.copy = function() {
            return quantize$1().domain([ x0, x1 ]).range(range);
        }, linearish(scale);
    }, exports.scaleThreshold = function threshold$1() {
        var domain = [ .5 ], range = [ 0, 1 ], n = 1;
        function scale(x) {
            if (x <= x) return range[bisectRight(domain, x, 0, n)];
        }
        return scale.domain = function(_) {
            return arguments.length ? (domain = slice$5.call(_), n = Math.min(domain.length, range.length - 1), 
            scale) : domain.slice();
        }, scale.range = function(_) {
            return arguments.length ? (range = slice$5.call(_), n = Math.min(domain.length, range.length - 1), 
            scale) : range.slice();
        }, scale.invertExtent = function(y) {
            var i = range.indexOf(y);
            return [ domain[i - 1], domain[i] ];
        }, scale.copy = function() {
            return threshold$1().domain(domain).range(range);
        }, scale;
    }, exports.scaleTime = function() {
        return calendar(year, month, sunday, day, hour, minute, second, millisecond, exports.timeFormat).domain([ new Date(2e3, 0, 1), new Date(2e3, 0, 2) ]);
    }, exports.scaleUtc = function() {
        return calendar(utcYear, utcMonth, utcSunday, utcDay, utcHour, utcMinute, second, millisecond, exports.utcFormat).domain([ Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2) ]);
    }, exports.schemeCategory10 = category10, exports.schemeCategory20b = category20b, 
    exports.schemeCategory20c = category20c, exports.schemeCategory20 = category20, 
    exports.interpolateCubehelixDefault = cubehelix$3, exports.interpolateRainbow = function(t) {
        (t < 0 || 1 < t) && (t -= Math.floor(t));
        var ts = Math.abs(t - .5);
        return rainbow.h = 360 * t - 100, rainbow.s = 1.5 - 1.5 * ts, rainbow.l = .8 - .9 * ts, 
        rainbow + "";
    }, exports.interpolateWarm = warm, exports.interpolateCool = cool, exports.interpolateViridis = viridis, 
    exports.interpolateMagma = magma, exports.interpolateInferno = inferno, exports.interpolatePlasma = plasma, 
    exports.scaleSequential = function sequential(interpolator) {
        var x0 = 0, x1 = 1, clamp = !1;
        function scale(x) {
            var t = (x - x0) / (x1 - x0);
            return interpolator(clamp ? Math.max(0, Math.min(1, t)) : t);
        }
        return scale.domain = function(_) {
            return arguments.length ? (x0 = +_[0], x1 = +_[1], scale) : [ x0, x1 ];
        }, scale.clamp = function(_) {
            return arguments.length ? (clamp = !!_, scale) : clamp;
        }, scale.interpolator = function(_) {
            return arguments.length ? (interpolator = _, scale) : interpolator;
        }, scale.copy = function() {
            return sequential(interpolator).domain([ x0, x1 ]).clamp(clamp);
        }, linearish(scale);
    }, exports.create = function(name) {
        return select(creator(name).call(document.documentElement));
    }, exports.creator = creator, exports.local = local$1, exports.matcher = matcher$1, 
    exports.mouse = mouse, exports.namespace = namespace, exports.namespaces = namespaces, 
    exports.clientPoint = point, exports.select = select, exports.selectAll = function(selector) {
        return "string" == typeof selector ? new Selection([ document.querySelectorAll(selector) ], [ document.documentElement ]) : new Selection([ null == selector ? [] : selector ], root);
    }, exports.selection = selection, exports.selector = selector, exports.selectorAll = selectorAll, 
    exports.style = styleValue, exports.touch = touch, exports.touches = function(node, touches) {
        null == touches && (touches = sourceEvent().touches);
        for (var i = 0, n = touches ? touches.length : 0, points = new Array(n); i < n; ++i) points[i] = point(node, touches[i]);
        return points;
    }, exports.window = defaultView, exports.customEvent = customEvent, exports.arc = function() {
        var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant$10(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null;
        function arc() {
            var buffer, r, x, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi$3, a1 = endAngle.apply(this, arguments) - halfPi$3, da = abs$1(a1 - a0), cw = a0 < a1;
            if (context || (context = buffer = path()), r1 < r0 && (r = r1, r1 = r0, r0 = r), 
            epsilon$3 < r1) if (tau$4 - epsilon$3 < da) context.moveTo(r1 * cos$2(a0), r1 * sin$2(a0)), 
            context.arc(0, 0, r1, a0, a1, !cw), epsilon$3 < r0 && (context.moveTo(r0 * cos$2(a1), r0 * sin$2(a1)), 
            context.arc(0, 0, r0, a1, a0, cw)); else {
                var t0, t1, a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = epsilon$3 < ap && (padRadius ? +padRadius.apply(this, arguments) : sqrt$2(r0 * r0 + r1 * r1)), rc = min$1(abs$1(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc;
                if (epsilon$3 < rp) {
                    var p0 = asin$1(rp / r0 * sin$2(ap)), p1 = asin$1(rp / r1 * sin$2(ap));
                    (da0 -= 2 * p0) > epsilon$3 ? (a00 += p0 *= cw ? 1 : -1, a10 -= p0) : (da0 = 0, 
                    a00 = a10 = (a0 + a1) / 2), (da1 -= 2 * p1) > epsilon$3 ? (a01 += p1 *= cw ? 1 : -1, 
                    a11 -= p1) : (da1 = 0, a01 = a11 = (a0 + a1) / 2);
                }
                var x01 = r1 * cos$2(a01), y01 = r1 * sin$2(a01), x10 = r0 * cos$2(a10), y10 = r0 * sin$2(a10);
                if (epsilon$3 < rc) {
                    var x11 = r1 * cos$2(a11), y11 = r1 * sin$2(a11), x00 = r0 * cos$2(a00), y00 = r0 * sin$2(a00);
                    if (da < pi$4) {
                        var oc = epsilon$3 < da0 ? function(x0, y0, x1, y1, x2, y2, x3, y3) {
                            var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / (y32 * x10 - x32 * y10);
                            return [ x0 + t * x10, y0 + t * y10 ];
                        }(x01, y01, x00, y00, x11, y11, x10, y10) : [ x10, y10 ], ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin$2((1 < (x = (ax * bx + ay * by) / (sqrt$2(ax * ax + ay * ay) * sqrt$2(bx * bx + by * by))) ? 0 : x < -1 ? pi$4 : Math.acos(x)) / 2), lc = sqrt$2(oc[0] * oc[0] + oc[1] * oc[1]);
                        rc0 = min$1(rc, (r0 - lc) / (kc - 1)), rc1 = min$1(rc, (r1 - lc) / (kc + 1));
                    }
                }
                epsilon$3 < da1 ? epsilon$3 < rc1 ? (t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw), 
                t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw), context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01), 
                rc1 < rc ? context.arc(t0.cx, t0.cy, rc1, atan2$1(t0.y01, t0.x01), atan2$1(t1.y01, t1.x01), !cw) : (context.arc(t0.cx, t0.cy, rc1, atan2$1(t0.y01, t0.x01), atan2$1(t0.y11, t0.x11), !cw), 
                context.arc(0, 0, r1, atan2$1(t0.cy + t0.y11, t0.cx + t0.x11), atan2$1(t1.cy + t1.y11, t1.cx + t1.x11), !cw), 
                context.arc(t1.cx, t1.cy, rc1, atan2$1(t1.y11, t1.x11), atan2$1(t1.y01, t1.x01), !cw))) : (context.moveTo(x01, y01), 
                context.arc(0, 0, r1, a01, a11, !cw)) : context.moveTo(x01, y01), epsilon$3 < r0 && epsilon$3 < da0 ? epsilon$3 < rc0 ? (t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw), 
                t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw), context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01), 
                rc0 < rc ? context.arc(t0.cx, t0.cy, rc0, atan2$1(t0.y01, t0.x01), atan2$1(t1.y01, t1.x01), !cw) : (context.arc(t0.cx, t0.cy, rc0, atan2$1(t0.y01, t0.x01), atan2$1(t0.y11, t0.x11), !cw), 
                context.arc(0, 0, r0, atan2$1(t0.cy + t0.y11, t0.cx + t0.x11), atan2$1(t1.cy + t1.y11, t1.cx + t1.x11), cw), 
                context.arc(t1.cx, t1.cy, rc0, atan2$1(t1.y11, t1.x11), atan2$1(t1.y01, t1.x01), !cw))) : context.arc(0, 0, r0, a10, a00, cw) : context.lineTo(x10, y10);
            } else context.moveTo(0, 0);
            if (context.closePath(), buffer) return context = null, buffer + "" || null;
        }
        return arc.centroid = function() {
            var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi$4 / 2;
            return [ cos$2(a) * r, sin$2(a) * r ];
        }, arc.innerRadius = function(_) {
            return arguments.length ? (innerRadius = "function" == typeof _ ? _ : constant$10(+_), 
            arc) : innerRadius;
        }, arc.outerRadius = function(_) {
            return arguments.length ? (outerRadius = "function" == typeof _ ? _ : constant$10(+_), 
            arc) : outerRadius;
        }, arc.cornerRadius = function(_) {
            return arguments.length ? (cornerRadius = "function" == typeof _ ? _ : constant$10(+_), 
            arc) : cornerRadius;
        }, arc.padRadius = function(_) {
            return arguments.length ? (padRadius = null == _ ? null : "function" == typeof _ ? _ : constant$10(+_), 
            arc) : padRadius;
        }, arc.startAngle = function(_) {
            return arguments.length ? (startAngle = "function" == typeof _ ? _ : constant$10(+_), 
            arc) : startAngle;
        }, arc.endAngle = function(_) {
            return arguments.length ? (endAngle = "function" == typeof _ ? _ : constant$10(+_), 
            arc) : endAngle;
        }, arc.padAngle = function(_) {
            return arguments.length ? (padAngle = "function" == typeof _ ? _ : constant$10(+_), 
            arc) : padAngle;
        }, arc.context = function(_) {
            return arguments.length ? (context = null == _ ? null : _, arc) : context;
        }, arc;
    }, exports.area = area$2, exports.line = line, exports.pie = function() {
        var value = identity$7, sortValues = descending$1, sort = null, startAngle = constant$10(0), endAngle = constant$10(tau$4), padAngle = constant$10(0);
        function pie(data) {
            var i, j, k, a1, v, n = data.length, sum = 0, index = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau$4, Math.max(-tau$4, endAngle.apply(this, arguments) - a0)), p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1);
            for (i = 0; i < n; ++i) 0 < (v = arcs[index[i] = i] = +value(data[i], i, data)) && (sum += v);
            for (null != sortValues ? index.sort(function(i, j) {
                return sortValues(arcs[i], arcs[j]);
            }) : null != sort && index.sort(function(i, j) {
                return sort(data[i], data[j]);
            }), i = 0, k = sum ? (da - n * pa) / sum : 0; i < n; ++i, a0 = a1) j = index[i], 
            a1 = a0 + (0 < (v = arcs[j]) ? v * k : 0) + pa, arcs[j] = {
                data: data[j],
                index: i,
                value: v,
                startAngle: a0,
                endAngle: a1,
                padAngle: p
            };
            return arcs;
        }
        return pie.value = function(_) {
            return arguments.length ? (value = "function" == typeof _ ? _ : constant$10(+_), 
            pie) : value;
        }, pie.sortValues = function(_) {
            return arguments.length ? (sortValues = _, sort = null, pie) : sortValues;
        }, pie.sort = function(_) {
            return arguments.length ? (sort = _, sortValues = null, pie) : sort;
        }, pie.startAngle = function(_) {
            return arguments.length ? (startAngle = "function" == typeof _ ? _ : constant$10(+_), 
            pie) : startAngle;
        }, pie.endAngle = function(_) {
            return arguments.length ? (endAngle = "function" == typeof _ ? _ : constant$10(+_), 
            pie) : endAngle;
        }, pie.padAngle = function(_) {
            return arguments.length ? (padAngle = "function" == typeof _ ? _ : constant$10(+_), 
            pie) : padAngle;
        }, pie;
    }, exports.areaRadial = areaRadial, exports.radialArea = areaRadial, exports.lineRadial = lineRadial$1, 
    exports.radialLine = lineRadial$1, exports.pointRadial = pointRadial, exports.linkHorizontal = function() {
        return link$2(curveHorizontal);
    }, exports.linkVertical = function() {
        return link$2(curveVertical);
    }, exports.linkRadial = function() {
        var l = link$2(curveRadial$1);
        return l.angle = l.x, delete l.x, l.radius = l.y, delete l.y, l;
    }, exports.symbol = function() {
        var type = constant$10(circle$2), size = constant$10(64), context = null;
        function symbol() {
            var buffer;
            if (context || (context = buffer = path()), type.apply(this, arguments).draw(context, +size.apply(this, arguments)), 
            buffer) return context = null, buffer + "" || null;
        }
        return symbol.type = function(_) {
            return arguments.length ? (type = "function" == typeof _ ? _ : constant$10(_), symbol) : type;
        }, symbol.size = function(_) {
            return arguments.length ? (size = "function" == typeof _ ? _ : constant$10(+_), 
            symbol) : size;
        }, symbol.context = function(_) {
            return arguments.length ? (context = null == _ ? null : _, symbol) : context;
        }, symbol;
    }, exports.symbols = symbols, exports.symbolCircle = circle$2, exports.symbolCross = cross$2, 
    exports.symbolDiamond = diamond, exports.symbolSquare = square, exports.symbolStar = star, 
    exports.symbolTriangle = triangle, exports.symbolWye = wye, exports.curveBasisClosed = function(context) {
        return new BasisClosed(context);
    }, exports.curveBasisOpen = function(context) {
        return new BasisOpen(context);
    }, exports.curveBasis = function(context) {
        return new Basis(context);
    }, exports.curveBundle = bundle, exports.curveCardinalClosed = cardinalClosed, exports.curveCardinalOpen = cardinalOpen, 
    exports.curveCardinal = cardinal, exports.curveCatmullRomClosed = catmullRomClosed, 
    exports.curveCatmullRomOpen = catmullRomOpen, exports.curveCatmullRom = catmullRom, 
    exports.curveLinearClosed = function(context) {
        return new LinearClosed(context);
    }, exports.curveLinear = curveLinear, exports.curveMonotoneX = function(context) {
        return new MonotoneX(context);
    }, exports.curveMonotoneY = function(context) {
        return new MonotoneY(context);
    }, exports.curveNatural = function(context) {
        return new Natural(context);
    }, exports.curveStep = function(context) {
        return new Step(context, .5);
    }, exports.curveStepAfter = function(context) {
        return new Step(context, 1);
    }, exports.curveStepBefore = function(context) {
        return new Step(context, 0);
    }, exports.stack = function() {
        var keys = constant$10([]), order = none$2, offset = none$1, value = stackValue;
        function stack(data) {
            var i, oz, kz = keys.apply(this, arguments), m = data.length, n = kz.length, sz = new Array(n);
            for (i = 0; i < n; ++i) {
                for (var sij, ki = kz[i], si = sz[i] = new Array(m), j = 0; j < m; ++j) si[j] = sij = [ 0, +value(data[j], ki, j, data) ], 
                sij.data = data[j];
                si.key = ki;
            }
            for (i = 0, oz = order(sz); i < n; ++i) sz[oz[i]].index = i;
            return offset(sz, oz), sz;
        }
        return stack.keys = function(_) {
            return arguments.length ? (keys = "function" == typeof _ ? _ : constant$10(slice$6.call(_)), 
            stack) : keys;
        }, stack.value = function(_) {
            return arguments.length ? (value = "function" == typeof _ ? _ : constant$10(+_), 
            stack) : value;
        }, stack.order = function(_) {
            return arguments.length ? (order = null == _ ? none$2 : "function" == typeof _ ? _ : constant$10(slice$6.call(_)), 
            stack) : order;
        }, stack.offset = function(_) {
            return arguments.length ? (offset = null == _ ? none$1 : _, stack) : offset;
        }, stack;
    }, exports.stackOffsetExpand = function(series, order) {
        if (0 < (n = series.length)) {
            for (var i, n, y, j = 0, m = series[0].length; j < m; ++j) {
                for (y = i = 0; i < n; ++i) y += series[i][j][1] || 0;
                if (y) for (i = 0; i < n; ++i) series[i][j][1] /= y;
            }
            none$1(series, order);
        }
    }, exports.stackOffsetDiverging = function(series, order) {
        if (1 < (n = series.length)) for (var i, d, dy, yp, yn, n, j = 0, m = series[order[0]].length; j < m; ++j) for (yp = yn = 0, 
        i = 0; i < n; ++i) 0 <= (dy = (d = series[order[i]][j])[1] - d[0]) ? (d[0] = yp, 
        d[1] = yp += dy) : dy < 0 ? (d[1] = yn, d[0] = yn += dy) : d[0] = yp;
    }, exports.stackOffsetNone = none$1, exports.stackOffsetSilhouette = function(series, order) {
        if (0 < (n = series.length)) {
            for (var n, j = 0, s0 = series[order[0]], m = s0.length; j < m; ++j) {
                for (var i = 0, y = 0; i < n; ++i) y += series[i][j][1] || 0;
                s0[j][1] += s0[j][0] = -y / 2;
            }
            none$1(series, order);
        }
    }, exports.stackOffsetWiggle = function(series, order) {
        if (0 < (n = series.length) && 0 < (m = (s0 = series[order[0]]).length)) {
            for (var s0, m, n, y = 0, j = 1; j < m; ++j) {
                for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) {
                    for (var si = series[order[i]], sij0 = si[j][1] || 0, s3 = (sij0 - (si[j - 1][1] || 0)) / 2, k = 0; k < i; ++k) {
                        var sk = series[order[k]];
                        s3 += (sk[j][1] || 0) - (sk[j - 1][1] || 0);
                    }
                    s1 += sij0, s2 += s3 * sij0;
                }
                s0[j - 1][1] += s0[j - 1][0] = y, s1 && (y -= s2 / s1);
            }
            s0[j - 1][1] += s0[j - 1][0] = y, none$1(series, order);
        }
    }, exports.stackOrderAscending = ascending$2, exports.stackOrderDescending = function(series) {
        return ascending$2(series).reverse();
    }, exports.stackOrderInsideOut = function(series) {
        var i, j, n = series.length, sums = series.map(sum$2), order = none$2(series).sort(function(a, b) {
            return sums[b] - sums[a];
        }), top = 0, bottom = 0, tops = [], bottoms = [];
        for (i = 0; i < n; ++i) j = order[i], top < bottom ? (top += sums[j], tops.push(j)) : (bottom += sums[j], 
        bottoms.push(j));
        return bottoms.reverse().concat(tops);
    }, exports.stackOrderNone = none$2, exports.stackOrderReverse = function(series) {
        return none$2(series).reverse();
    }, exports.timeInterval = newInterval, exports.timeMillisecond = millisecond, exports.timeMilliseconds = milliseconds, 
    exports.utcMillisecond = millisecond, exports.utcMilliseconds = milliseconds, exports.timeSecond = second, 
    exports.timeSeconds = seconds, exports.utcSecond = second, exports.utcSeconds = seconds, 
    exports.timeMinute = minute, exports.timeMinutes = minutes, exports.timeHour = hour, 
    exports.timeHours = hours, exports.timeDay = day, exports.timeDays = days, exports.timeWeek = sunday, 
    exports.timeWeeks = sundays, exports.timeSunday = sunday, exports.timeSundays = sundays, 
    exports.timeMonday = monday, exports.timeMondays = mondays, exports.timeTuesday = tuesday, 
    exports.timeTuesdays = tuesdays, exports.timeWednesday = wednesday, exports.timeWednesdays = wednesdays, 
    exports.timeThursday = thursday, exports.timeThursdays = thursdays, exports.timeFriday = friday, 
    exports.timeFridays = fridays, exports.timeSaturday = saturday, exports.timeSaturdays = saturdays, 
    exports.timeMonth = month, exports.timeMonths = months, exports.timeYear = year, 
    exports.timeYears = years, exports.utcMinute = utcMinute, exports.utcMinutes = utcMinutes, 
    exports.utcHour = utcHour, exports.utcHours = utcHours, exports.utcDay = utcDay, 
    exports.utcDays = utcDays, exports.utcWeek = utcSunday, exports.utcWeeks = utcSundays, 
    exports.utcSunday = utcSunday, exports.utcSundays = utcSundays, exports.utcMonday = utcMonday, 
    exports.utcMondays = utcMondays, exports.utcTuesday = utcTuesday, exports.utcTuesdays = utcTuesdays, 
    exports.utcWednesday = utcWednesday, exports.utcWednesdays = utcWednesdays, exports.utcThursday = utcThursday, 
    exports.utcThursdays = utcThursdays, exports.utcFriday = utcFriday, exports.utcFridays = utcFridays, 
    exports.utcSaturday = utcSaturday, exports.utcSaturdays = utcSaturdays, exports.utcMonth = utcMonth, 
    exports.utcMonths = utcMonths, exports.utcYear = utcYear, exports.utcYears = utcYears, 
    exports.timeFormatDefaultLocale = defaultLocale$1, exports.timeFormatLocale = formatLocale$1, 
    exports.isoFormat = formatIso, exports.isoParse = parseIso, exports.now = now, exports.timer = timer, 
    exports.timerFlush = timerFlush, exports.timeout = timeout$1, exports.interval = function(callback, delay, time) {
        var t = new Timer(), total = delay;
        return null == delay ? t.restart(callback, delay, time) : (delay = +delay, time = null == time ? now() : +time, 
        t.restart(function tick(elapsed) {
            elapsed += total, t.restart(tick, total += delay, time), callback(elapsed);
        }, delay, time)), t;
    }, exports.transition = transition, exports.active = function(node, name) {
        var schedule$$1, i, schedules = node.__transition;
        if (schedules) for (i in name = null == name ? null : name + "", schedules) if ((schedule$$1 = schedules[i]).state > SCHEDULED && schedule$$1.name === name) return new Transition([ [ node ] ], root$1, name, +i);
        return null;
    }, exports.interrupt = interrupt, exports.voronoi = function() {
        var x$$1 = x$4, y$$1 = y$4, extent = null;
        function voronoi(data) {
            return new Diagram(data.map(function(d, i) {
                var s = [ Math.round(x$$1(d, i, data) / epsilon$4) * epsilon$4, Math.round(y$$1(d, i, data) / epsilon$4) * epsilon$4 ];
                return s.index = i, s.data = d, s;
            }), extent);
        }
        return voronoi.polygons = function(data) {
            return voronoi(data).polygons();
        }, voronoi.links = function(data) {
            return voronoi(data).links();
        }, voronoi.triangles = function(data) {
            return voronoi(data).triangles();
        }, voronoi.x = function(_) {
            return arguments.length ? (x$$1 = "function" == typeof _ ? _ : constant$11(+_), 
            voronoi) : x$$1;
        }, voronoi.y = function(_) {
            return arguments.length ? (y$$1 = "function" == typeof _ ? _ : constant$11(+_), 
            voronoi) : y$$1;
        }, voronoi.extent = function(_) {
            return arguments.length ? (extent = null == _ ? null : [ [ +_[0][0], +_[0][1] ], [ +_[1][0], +_[1][1] ] ], 
            voronoi) : extent && [ [ extent[0][0], extent[0][1] ], [ extent[1][0], extent[1][1] ] ];
        }, voronoi.size = function(_) {
            return arguments.length ? (extent = null == _ ? null : [ [ 0, 0 ], [ +_[0], +_[1] ] ], 
            voronoi) : extent && [ extent[1][0] - extent[0][0], extent[1][1] - extent[0][1] ];
        }, voronoi;
    }, exports.zoom = function() {
        var touchstarting, touchending, filter = defaultFilter$2, extent = defaultExtent$1, constrain = defaultConstrain, wheelDelta = defaultWheelDelta, touchable = defaultTouchable$1, scaleExtent = [ 0, 1 / 0 ], translateExtent = [ [ -1 / 0, -1 / 0 ], [ 1 / 0, 1 / 0 ] ], duration = 250, interpolate = interpolateZoom, gestures = [], listeners = dispatch("start", "zoom", "end"), touchDelay = 500, wheelDelay = 150, clickDistance2 = 0;
        function zoom(selection) {
            selection.property("__zoom", defaultTransform).on("wheel.zoom", wheeled).on("mousedown.zoom", mousedowned).on("dblclick.zoom", dblclicked).filter(touchable).on("touchstart.zoom", touchstarted).on("touchmove.zoom", touchmoved).on("touchend.zoom touchcancel.zoom", touchended).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)");
        }
        function scale(transform$$1, k) {
            return (k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k))) === transform$$1.k ? transform$$1 : new Transform(k, transform$$1.x, transform$$1.y);
        }
        function translate(transform$$1, p0, p1) {
            var x = p0[0] - p1[0] * transform$$1.k, y = p0[1] - p1[1] * transform$$1.k;
            return x === transform$$1.x && y === transform$$1.y ? transform$$1 : new Transform(transform$$1.k, x, y);
        }
        function centroid(extent) {
            return [ (+extent[0][0] + +extent[1][0]) / 2, (+extent[0][1] + +extent[1][1]) / 2 ];
        }
        function schedule(transition, transform$$1, center) {
            transition.on("start.zoom", function() {
                gesture(this, arguments).start();
            }).on("interrupt.zoom end.zoom", function() {
                gesture(this, arguments).end();
            }).tween("zoom", function() {
                var args = arguments, g = gesture(this, args), e = extent.apply(this, args), p = center || centroid(e), w = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a = this.__zoom, b = "function" == typeof transform$$1 ? transform$$1.apply(this, args) : transform$$1, i = interpolate(a.invert(p).concat(w / a.k), b.invert(p).concat(w / b.k));
                return function(t) {
                    if (1 === t) t = b; else {
                        var l = i(t), k = w / l[2];
                        t = new Transform(k, p[0] - l[0] * k, p[1] - l[1] * k);
                    }
                    g.zoom(null, t);
                };
            });
        }
        function gesture(that, args) {
            for (var g, i = 0, n = gestures.length; i < n; ++i) if ((g = gestures[i]).that === that) return g;
            return new Gesture(that, args);
        }
        function Gesture(that, args) {
            this.that = that, this.args = args, this.index = -1, this.active = 0, this.extent = extent.apply(that, args);
        }
        function wheeled() {
            if (filter.apply(this, arguments)) {
                var g = gesture(this, arguments), t = this.__zoom, k = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p = mouse(this);
                if (g.wheel) g.mouse[0][0] === p[0] && g.mouse[0][1] === p[1] || (g.mouse[1] = t.invert(g.mouse[0] = p)), 
                clearTimeout(g.wheel); else {
                    if (t.k === k) return;
                    g.mouse = [ p, t.invert(p) ], interrupt(this), g.start();
                }
                noevent$2(), g.wheel = setTimeout(function() {
                    g.wheel = null, g.end();
                }, wheelDelay), g.zoom("mouse", constrain(translate(scale(t, k), g.mouse[0], g.mouse[1]), g.extent, translateExtent));
            }
        }
        function mousedowned() {
            if (!touchending && filter.apply(this, arguments)) {
                var g = gesture(this, arguments), v = select(exports.event.view).on("mousemove.zoom", function() {
                    if (noevent$2(), !g.moved) {
                        var dx = exports.event.clientX - x0, dy = exports.event.clientY - y0;
                        g.moved = clickDistance2 < dx * dx + dy * dy;
                    }
                    g.zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = mouse(g.that), g.mouse[1]), g.extent, translateExtent));
                }, !0).on("mouseup.zoom", function() {
                    v.on("mousemove.zoom mouseup.zoom", null), yesdrag(exports.event.view, g.moved), 
                    noevent$2(), g.end();
                }, !0), p = mouse(this), x0 = exports.event.clientX, y0 = exports.event.clientY;
                dragDisable(exports.event.view), nopropagation$2(), g.mouse = [ p, this.__zoom.invert(p) ], 
                interrupt(this), g.start();
            }
        }
        function dblclicked() {
            if (filter.apply(this, arguments)) {
                var t0 = this.__zoom, p0 = mouse(this), p1 = t0.invert(p0), k1 = t0.k * (exports.event.shiftKey ? .5 : 2), t1 = constrain(translate(scale(t0, k1), p0, p1), extent.apply(this, arguments), translateExtent);
                noevent$2(), 0 < duration ? select(this).transition().duration(duration).call(schedule, t1, p0) : select(this).call(zoom.transform, t1);
            }
        }
        function touchstarted() {
            if (filter.apply(this, arguments)) {
                var started, i, t, p, g = gesture(this, arguments), touches = exports.event.changedTouches, n = touches.length;
                for (nopropagation$2(), i = 0; i < n; ++i) p = [ p = touch(this, touches, (t = touches[i]).identifier), this.__zoom.invert(p), t.identifier ], 
                g.touch0 ? g.touch1 || (g.touch1 = p) : (g.touch0 = p, started = !0);
                if (touchstarting && (touchstarting = clearTimeout(touchstarting), !g.touch1)) return g.end(), 
                void ((p = select(this).on("dblclick.zoom")) && p.apply(this, arguments));
                started && (touchstarting = setTimeout(function() {
                    touchstarting = null;
                }, touchDelay), interrupt(this), g.start());
            }
        }
        function touchmoved() {
            var i, t, p, l, g = gesture(this, arguments), touches = exports.event.changedTouches, n = touches.length;
            for (noevent$2(), touchstarting && (touchstarting = clearTimeout(touchstarting)), 
            i = 0; i < n; ++i) p = touch(this, touches, (t = touches[i]).identifier), g.touch0 && g.touch0[2] === t.identifier ? g.touch0[0] = p : g.touch1 && g.touch1[2] === t.identifier && (g.touch1[0] = p);
            if (t = g.that.__zoom, g.touch1) {
                var p0 = g.touch0[0], l0 = g.touch0[1], p1 = g.touch1[0], l1 = g.touch1[1], dp = (dp = p1[0] - p0[0]) * dp + (dp = p1[1] - p0[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl;
                t = scale(t, Math.sqrt(dp / dl)), p = [ (p0[0] + p1[0]) / 2, (p0[1] + p1[1]) / 2 ], 
                l = [ (l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2 ];
            } else {
                if (!g.touch0) return;
                p = g.touch0[0], l = g.touch0[1];
            }
            g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent));
        }
        function touchended() {
            var i, t, g = gesture(this, arguments), touches = exports.event.changedTouches, n = touches.length;
            for (nopropagation$2(), touchending && clearTimeout(touchending), touchending = setTimeout(function() {
                touchending = null;
            }, touchDelay), i = 0; i < n; ++i) t = touches[i], g.touch0 && g.touch0[2] === t.identifier ? delete g.touch0 : g.touch1 && g.touch1[2] === t.identifier && delete g.touch1;
            g.touch1 && !g.touch0 && (g.touch0 = g.touch1, delete g.touch1), g.touch0 ? g.touch0[1] = this.__zoom.invert(g.touch0[0]) : g.end();
        }
        return zoom.transform = function(collection, transform$$1) {
            var selection = collection.selection ? collection.selection() : collection;
            selection.property("__zoom", defaultTransform), collection !== selection ? schedule(collection, transform$$1) : selection.interrupt().each(function() {
                gesture(this, arguments).start().zoom(null, "function" == typeof transform$$1 ? transform$$1.apply(this, arguments) : transform$$1).end();
            });
        }, zoom.scaleBy = function(selection, k) {
            zoom.scaleTo(selection, function() {
                return this.__zoom.k * ("function" == typeof k ? k.apply(this, arguments) : k);
            });
        }, zoom.scaleTo = function(selection, k) {
            zoom.transform(selection, function() {
                var e = extent.apply(this, arguments), t0 = this.__zoom, p0 = centroid(e), p1 = t0.invert(p0), k1 = "function" == typeof k ? k.apply(this, arguments) : k;
                return constrain(translate(scale(t0, k1), p0, p1), e, translateExtent);
            });
        }, zoom.translateBy = function(selection, x, y) {
            zoom.transform(selection, function() {
                return constrain(this.__zoom.translate("function" == typeof x ? x.apply(this, arguments) : x, "function" == typeof y ? y.apply(this, arguments) : y), extent.apply(this, arguments), translateExtent);
            });
        }, zoom.translateTo = function(selection, x, y) {
            zoom.transform(selection, function() {
                var e = extent.apply(this, arguments), t = this.__zoom, p = centroid(e);
                return constrain(identity$8.translate(p[0], p[1]).scale(t.k).translate("function" == typeof x ? -x.apply(this, arguments) : -x, "function" == typeof y ? -y.apply(this, arguments) : -y), e, translateExtent);
            });
        }, Gesture.prototype = {
            start: function() {
                return 1 == ++this.active && (this.index = gestures.push(this) - 1, this.emit("start")), 
                this;
            },
            zoom: function(key, transform$$1) {
                return this.mouse && "mouse" !== key && (this.mouse[1] = transform$$1.invert(this.mouse[0])), 
                this.touch0 && "touch" !== key && (this.touch0[1] = transform$$1.invert(this.touch0[0])), 
                this.touch1 && "touch" !== key && (this.touch1[1] = transform$$1.invert(this.touch1[0])), 
                this.that.__zoom = transform$$1, this.emit("zoom"), this;
            },
            end: function() {
                return 0 == --this.active && (gestures.splice(this.index, 1), this.index = -1, this.emit("end")), 
                this;
            },
            emit: function(type) {
                customEvent(new ZoomEvent(zoom, type, this.that.__zoom), listeners.apply, listeners, [ type, this.that, this.args ]);
            }
        }, zoom.wheelDelta = function(_) {
            return arguments.length ? (wheelDelta = "function" == typeof _ ? _ : constant$12(+_), 
            zoom) : wheelDelta;
        }, zoom.filter = function(_) {
            return arguments.length ? (filter = "function" == typeof _ ? _ : constant$12(!!_), 
            zoom) : filter;
        }, zoom.touchable = function(_) {
            return arguments.length ? (touchable = "function" == typeof _ ? _ : constant$12(!!_), 
            zoom) : touchable;
        }, zoom.extent = function(_) {
            return arguments.length ? (extent = "function" == typeof _ ? _ : constant$12([ [ +_[0][0], +_[0][1] ], [ +_[1][0], +_[1][1] ] ]), 
            zoom) : extent;
        }, zoom.scaleExtent = function(_) {
            return arguments.length ? (scaleExtent[0] = +_[0], scaleExtent[1] = +_[1], zoom) : [ scaleExtent[0], scaleExtent[1] ];
        }, zoom.translateExtent = function(_) {
            return arguments.length ? (translateExtent[0][0] = +_[0][0], translateExtent[1][0] = +_[1][0], 
            translateExtent[0][1] = +_[0][1], translateExtent[1][1] = +_[1][1], zoom) : [ [ translateExtent[0][0], translateExtent[0][1] ], [ translateExtent[1][0], translateExtent[1][1] ] ];
        }, zoom.constrain = function(_) {
            return arguments.length ? (constrain = _, zoom) : constrain;
        }, zoom.duration = function(_) {
            return arguments.length ? (duration = +_, zoom) : duration;
        }, zoom.interpolate = function(_) {
            return arguments.length ? (interpolate = _, zoom) : interpolate;
        }, zoom.on = function() {
            var value = listeners.on.apply(listeners, arguments);
            return value === listeners ? zoom : value;
        }, zoom.clickDistance = function(_) {
            return arguments.length ? (clickDistance2 = (_ = +_) * _, zoom) : Math.sqrt(clickDistance2);
        }, zoom;
    }, exports.zoomTransform = transform$1, exports.zoomIdentity = identity$8, Object.defineProperty(exports, "__esModule", {
        value: !0
    });
}), function(f, e) {
    "object" == typeof exports && "undefined" != typeof module ? e(exports, require("d3-interpolate")) : "function" == typeof define && define.amd ? define([ "exports", "d3-interpolate" ], e) : e(f.d3 = f.d3 || {}, f.d3);
}(this, function(f, e) {
    "use strict";
    var d = function(f) {
        for (var e = f.length / 6 | 0, d = new Array(e), c = 0; c < e; ) d[c] = "#" + f.slice(6 * c, 6 * ++c);
        return d;
    }, c = d("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"), a = d("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"), b = d("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"), r = d("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"), n = d("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"), t = d("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"), o = d("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"), p = d("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"), m = function(f) {
        return e.interpolateRgbBasis(f[f.length - 1]);
    }, s = new Array(3).concat("d8b365f5f5f55ab4ac", "a6611adfc27d80cdc1018571", "a6611adfc27df5f5f580cdc1018571", "8c510ad8b365f6e8c3c7eae55ab4ac01665e", "8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e", "8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e", "8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e", "5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30", "5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(d), l = m(s), i = new Array(3).concat("af8dc3f7f7f77fbf7b", "7b3294c2a5cfa6dba0008837", "7b3294c2a5cff7f7f7a6dba0008837", "762a83af8dc3e7d4e8d9f0d37fbf7b1b7837", "762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837", "762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837", "762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837", "40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b", "40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(d), u = m(i), h = new Array(3).concat("e9a3c9f7f7f7a1d76a", "d01c8bf1b6dab8e1864dac26", "d01c8bf1b6daf7f7f7b8e1864dac26", "c51b7de9a3c9fde0efe6f5d0a1d76a4d9221", "c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221", "c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221", "c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221", "8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419", "8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(d), y = m(h), A = new Array(3).concat("998ec3f7f7f7f1a340", "5e3c99b2abd2fdb863e66101", "5e3c99b2abd2f7f7f7fdb863e66101", "542788998ec3d8daebfee0b6f1a340b35806", "542788998ec3d8daebf7f7f7fee0b6f1a340b35806", "5427888073acb2abd2d8daebfee0b6fdb863e08214b35806", "5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806", "2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08", "2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(d), w = m(A), B = new Array(3).concat("ef8a62f7f7f767a9cf", "ca0020f4a58292c5de0571b0", "ca0020f4a582f7f7f792c5de0571b0", "b2182bef8a62fddbc7d1e5f067a9cf2166ac", "b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac", "b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac", "b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac", "67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061", "67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(d), G = m(B), P = new Array(3).concat("ef8a62ffffff999999", "ca0020f4a582bababa404040", "ca0020f4a582ffffffbababa404040", "b2182bef8a62fddbc7e0e0e09999994d4d4d", "b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d", "b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d", "b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d", "67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a", "67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(d), R = m(P), Y = new Array(3).concat("fc8d59ffffbf91bfdb", "d7191cfdae61abd9e92c7bb6", "d7191cfdae61ffffbfabd9e92c7bb6", "d73027fc8d59fee090e0f3f891bfdb4575b4", "d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4", "d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4", "d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4", "a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695", "a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(d), O = m(Y), g = new Array(3).concat("fc8d59ffffbf91cf60", "d7191cfdae61a6d96a1a9641", "d7191cfdae61ffffbfa6d96a1a9641", "d73027fc8d59fee08bd9ef8b91cf601a9850", "d73027fc8d59fee08bffffbfd9ef8b91cf601a9850", "d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850", "d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850", "a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837", "a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(d), S = m(g), v = new Array(3).concat("fc8d59ffffbf99d594", "d7191cfdae61abdda42b83ba", "d7191cfdae61ffffbfabdda42b83ba", "d53e4ffc8d59fee08be6f59899d5943288bd", "d53e4ffc8d59fee08bffffbfe6f59899d5943288bd", "d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd", "d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd", "9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2", "9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(d), x = m(v), j = new Array(3).concat("e5f5f999d8c92ca25f", "edf8fbb2e2e266c2a4238b45", "edf8fbb2e2e266c2a42ca25f006d2c", "edf8fbccece699d8c966c2a42ca25f006d2c", "edf8fbccece699d8c966c2a441ae76238b45005824", "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824", "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(d), _ = m(j), k = new Array(3).concat("e0ecf49ebcda8856a7", "edf8fbb3cde38c96c688419d", "edf8fbb3cde38c96c68856a7810f7c", "edf8fbbfd3e69ebcda8c96c68856a7810f7c", "edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b", "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b", "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(d), q = m(k), D = new Array(3).concat("e0f3dba8ddb543a2ca", "f0f9e8bae4bc7bccc42b8cbe", "f0f9e8bae4bc7bccc443a2ca0868ac", "f0f9e8ccebc5a8ddb57bccc443a2ca0868ac", "f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e", "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e", "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(d), M = m(D), z = new Array(3).concat("fee8c8fdbb84e34a33", "fef0d9fdcc8afc8d59d7301f", "fef0d9fdcc8afc8d59e34a33b30000", "fef0d9fdd49efdbb84fc8d59e34a33b30000", "fef0d9fdd49efdbb84fc8d59ef6548d7301f990000", "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000", "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(d), C = m(z), E = new Array(3).concat("ece2f0a6bddb1c9099", "f6eff7bdc9e167a9cf02818a", "f6eff7bdc9e167a9cf1c9099016c59", "f6eff7d0d1e6a6bddb67a9cf1c9099016c59", "f6eff7d0d1e6a6bddb67a9cf3690c002818a016450", "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450", "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(d), F = m(E), H = new Array(3).concat("ece7f2a6bddb2b8cbe", "f1eef6bdc9e174a9cf0570b0", "f1eef6bdc9e174a9cf2b8cbe045a8d", "f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d", "f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b", "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b", "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(d), I = m(H), J = new Array(3).concat("e7e1efc994c7dd1c77", "f1eef6d7b5d8df65b0ce1256", "f1eef6d7b5d8df65b0dd1c77980043", "f1eef6d4b9dac994c7df65b0dd1c77980043", "f1eef6d4b9dac994c7df65b0e7298ace125691003f", "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f", "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(d), K = m(J), L = new Array(3).concat("fde0ddfa9fb5c51b8a", "feebe2fbb4b9f768a1ae017e", "feebe2fbb4b9f768a1c51b8a7a0177", "feebe2fcc5c0fa9fb5f768a1c51b8a7a0177", "feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177", "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177", "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(d), N = m(L), Q = new Array(3).concat("edf8b17fcdbb2c7fb8", "ffffcca1dab441b6c4225ea8", "ffffcca1dab441b6c42c7fb8253494", "ffffccc7e9b47fcdbb41b6c42c7fb8253494", "ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84", "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84", "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(d), T = m(Q), U = new Array(3).concat("f7fcb9addd8e31a354", "ffffccc2e69978c679238443", "ffffccc2e69978c67931a354006837", "ffffccd9f0a3addd8e78c67931a354006837", "ffffccd9f0a3addd8e78c67941ab5d238443005a32", "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32", "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(d), V = m(U), W = new Array(3).concat("fff7bcfec44fd95f0e", "ffffd4fed98efe9929cc4c02", "ffffd4fed98efe9929d95f0e993404", "ffffd4fee391fec44ffe9929d95f0e993404", "ffffd4fee391fec44ffe9929ec7014cc4c028c2d04", "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04", "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(d), X = m(W), Z = new Array(3).concat("ffeda0feb24cf03b20", "ffffb2fecc5cfd8d3ce31a1c", "ffffb2fecc5cfd8d3cf03b20bd0026", "ffffb2fed976feb24cfd8d3cf03b20bd0026", "ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026", "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026", "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(d), $ = m(Z), ff = new Array(3).concat("deebf79ecae13182bd", "eff3ffbdd7e76baed62171b5", "eff3ffbdd7e76baed63182bd08519c", "eff3ffc6dbef9ecae16baed63182bd08519c", "eff3ffc6dbef9ecae16baed64292c62171b5084594", "f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594", "f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(d), ef = m(ff), df = new Array(3).concat("e5f5e0a1d99b31a354", "edf8e9bae4b374c476238b45", "edf8e9bae4b374c47631a354006d2c", "edf8e9c7e9c0a1d99b74c47631a354006d2c", "edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32", "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32", "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(d), cf = m(df), af = new Array(3).concat("f0f0f0bdbdbd636363", "f7f7f7cccccc969696525252", "f7f7f7cccccc969696636363252525", "f7f7f7d9d9d9bdbdbd969696636363252525", "f7f7f7d9d9d9bdbdbd969696737373525252252525", "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525", "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(d), bf = m(af), rf = new Array(3).concat("efedf5bcbddc756bb1", "f2f0f7cbc9e29e9ac86a51a3", "f2f0f7cbc9e29e9ac8756bb154278f", "f2f0f7dadaebbcbddc9e9ac8756bb154278f", "f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486", "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486", "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(d), nf = m(rf), tf = new Array(3).concat("fee0d2fc9272de2d26", "fee5d9fcae91fb6a4acb181d", "fee5d9fcae91fb6a4ade2d26a50f15", "fee5d9fcbba1fc9272fb6a4ade2d26a50f15", "fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d", "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d", "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(d), of = m(tf), pf = new Array(3).concat("fee6cefdae6be6550d", "feeddefdbe85fd8d3cd94701", "feeddefdbe85fd8d3ce6550da63603", "feeddefdd0a2fdae6bfd8d3ce6550da63603", "feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04", "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04", "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(d), mf = m(pf);
    f.schemeAccent = c, f.schemeDark2 = a, f.schemePaired = b, f.schemePastel1 = r, 
    f.schemePastel2 = n, f.schemeSet1 = t, f.schemeSet2 = o, f.schemeSet3 = p, f.interpolateBrBG = l, 
    f.schemeBrBG = s, f.interpolatePRGn = u, f.schemePRGn = i, f.interpolatePiYG = y, 
    f.schemePiYG = h, f.interpolatePuOr = w, f.schemePuOr = A, f.interpolateRdBu = G, 
    f.schemeRdBu = B, f.interpolateRdGy = R, f.schemeRdGy = P, f.interpolateRdYlBu = O, 
    f.schemeRdYlBu = Y, f.interpolateRdYlGn = S, f.schemeRdYlGn = g, f.interpolateSpectral = x, 
    f.schemeSpectral = v, f.interpolateBuGn = _, f.schemeBuGn = j, f.interpolateBuPu = q, 
    f.schemeBuPu = k, f.interpolateGnBu = M, f.schemeGnBu = D, f.interpolateOrRd = C, 
    f.schemeOrRd = z, f.interpolatePuBuGn = F, f.schemePuBuGn = E, f.interpolatePuBu = I, 
    f.schemePuBu = H, f.interpolatePuRd = K, f.schemePuRd = J, f.interpolateRdPu = N, 
    f.schemeRdPu = L, f.interpolateYlGnBu = T, f.schemeYlGnBu = Q, f.interpolateYlGn = V, 
    f.schemeYlGn = U, f.interpolateYlOrBr = X, f.schemeYlOrBr = W, f.interpolateYlOrRd = $, 
    f.schemeYlOrRd = Z, f.interpolateBlues = ef, f.schemeBlues = ff, f.interpolateGreens = cf, 
    f.schemeGreens = df, f.interpolateGreys = bf, f.schemeGreys = af, f.interpolatePurples = nf, 
    f.schemePurples = rf, f.interpolateReds = of, f.schemeReds = tf, f.interpolateOranges = mf, 
    f.schemeOranges = pf, Object.defineProperty(f, "__esModule", {
        value: !0
    });
}), function(window) {
    "use strict";
    function minErr(module, ErrorConstructor) {
        return ErrorConstructor = ErrorConstructor || Error, function() {
            var paramPrefix, i, templateArgs = arguments, code = templateArgs[0], message = "[" + (module ? module + ":" : "") + code + "] ";
            for (message += templateArgs[1].replace(/\{\d+\}/g, function(match) {
                var shiftedIndex = +match.slice(1, -1) + 2;
                return shiftedIndex < templateArgs.length ? toDebugString(templateArgs[shiftedIndex]) : match;
            }), message += "\nhttp://errors.angularjs.org/1.5.8/" + (module ? module + "/" : "") + code, 
            i = 2, paramPrefix = "?"; i < templateArgs.length; i++, paramPrefix = "&") message += paramPrefix + "p" + (i - 2) + "=" + encodeURIComponent(toDebugString(templateArgs[i]));
            return new ErrorConstructor(message);
        };
    }
    var REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/, VALIDITY_STATE_PROPERTY = "validity", hasOwnProperty = Object.prototype.hasOwnProperty, lowercase = function(string) {
        return isString(string) ? string.toLowerCase() : string;
    }, uppercase = function(string) {
        return isString(string) ? string.toUpperCase() : string;
    };
    "i" !== "I".toLowerCase() && (lowercase = function(s) {
        return isString(s) ? s.replace(/[A-Z]/g, function(ch) {
            return String.fromCharCode(32 | ch.charCodeAt(0));
        }) : s;
    }, uppercase = function(s) {
        return isString(s) ? s.replace(/[a-z]/g, function(ch) {
            return String.fromCharCode(-33 & ch.charCodeAt(0));
        }) : s;
    });
    var msie, jqLite, jQuery, angularModule, slice = [].slice, splice = [].splice, push = [].push, toString = Object.prototype.toString, getPrototypeOf = Object.getPrototypeOf, ngMinErr = minErr("ng"), angular = window.angular || (window.angular = {}), uid = 0;
    function isArrayLike(obj) {
        if (null == obj || isWindow(obj)) return !1;
        if (isArray(obj) || isString(obj) || jqLite && obj instanceof jqLite) return !0;
        var length = "length" in Object(obj) && obj.length;
        return isNumber(length) && (0 <= length && (length - 1 in obj || obj instanceof Array) || "function" == typeof obj.item);
    }
    function forEach(obj, iterator, context) {
        var key, length;
        if (obj) if (isFunction(obj)) for (key in obj) "prototype" == key || "length" == key || "name" == key || obj.hasOwnProperty && !obj.hasOwnProperty(key) || iterator.call(context, obj[key], key, obj); else if (isArray(obj) || isArrayLike(obj)) {
            var isPrimitive = "object" != typeof obj;
            for (key = 0, length = obj.length; key < length; key++) (isPrimitive || key in obj) && iterator.call(context, obj[key], key, obj);
        } else if (obj.forEach && obj.forEach !== forEach) obj.forEach(iterator, context, obj); else if (isBlankObject(obj)) for (key in obj) iterator.call(context, obj[key], key, obj); else if ("function" == typeof obj.hasOwnProperty) for (key in obj) obj.hasOwnProperty(key) && iterator.call(context, obj[key], key, obj); else for (key in obj) hasOwnProperty.call(obj, key) && iterator.call(context, obj[key], key, obj);
        return obj;
    }
    function forEachSorted(obj, iterator, context) {
        for (var keys = Object.keys(obj).sort(), i = 0; i < keys.length; i++) iterator.call(context, obj[keys[i]], keys[i]);
        return keys;
    }
    function reverseParams(iteratorFn) {
        return function(value, key) {
            iteratorFn(key, value);
        };
    }
    function nextUid() {
        return ++uid;
    }
    function setHashKey(obj, h) {
        h ? obj.$$hashKey = h : delete obj.$$hashKey;
    }
    function baseExtend(dst, objs, deep) {
        for (var h = dst.$$hashKey, i = 0, ii = objs.length; i < ii; ++i) {
            var obj = objs[i];
            if (isObject(obj) || isFunction(obj)) for (var keys = Object.keys(obj), j = 0, jj = keys.length; j < jj; j++) {
                var key = keys[j], src = obj[key];
                deep && isObject(src) ? isDate(src) ? dst[key] = new Date(src.valueOf()) : isRegExp(src) ? dst[key] = new RegExp(src) : src.nodeName ? dst[key] = src.cloneNode(!0) : isElement(src) ? dst[key] = src.clone() : (isObject(dst[key]) || (dst[key] = isArray(src) ? [] : {}), 
                baseExtend(dst[key], [ src ], !0)) : dst[key] = src;
            }
        }
        return setHashKey(dst, h), dst;
    }
    function extend(dst) {
        return baseExtend(dst, slice.call(arguments, 1), !1);
    }
    function merge(dst) {
        return baseExtend(dst, slice.call(arguments, 1), !0);
    }
    function toInt(str) {
        return parseInt(str, 10);
    }
    function inherit(parent, extra) {
        return extend(Object.create(parent), extra);
    }
    function noop() {}
    function identity($) {
        return $;
    }
    function valueFn(value) {
        return function() {
            return value;
        };
    }
    function hasCustomToString(obj) {
        return isFunction(obj.toString) && obj.toString !== toString;
    }
    function isUndefined(value) {
        return void 0 === value;
    }
    function isDefined(value) {
        return void 0 !== value;
    }
    function isObject(value) {
        return null !== value && "object" == typeof value;
    }
    function isBlankObject(value) {
        return null !== value && "object" == typeof value && !getPrototypeOf(value);
    }
    function isString(value) {
        return "string" == typeof value;
    }
    function isNumber(value) {
        return "number" == typeof value;
    }
    function isDate(value) {
        return "[object Date]" === toString.call(value);
    }
    msie = window.document.documentMode, noop.$inject = [], identity.$inject = [];
    var isArray = Array.isArray;
    function isFunction(value) {
        return "function" == typeof value;
    }
    function isRegExp(value) {
        return "[object RegExp]" === toString.call(value);
    }
    function isWindow(obj) {
        return obj && obj.window === obj;
    }
    function isScope(obj) {
        return obj && obj.$evalAsync && obj.$watch;
    }
    function isBoolean(value) {
        return "boolean" == typeof value;
    }
    function isPromiseLike(obj) {
        return obj && isFunction(obj.then);
    }
    var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/;
    var trim = function(value) {
        return isString(value) ? value.trim() : value;
    }, escapeForRegexp = function(s) {
        return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, "\\$1").replace(/\x08/g, "\\x08");
    };
    function isElement(node) {
        return !(!node || !(node.nodeName || node.prop && node.attr && node.find));
    }
    function nodeName_(element) {
        return lowercase(element.nodeName || element[0] && element[0].nodeName);
    }
    function arrayRemove(array, value) {
        var index = array.indexOf(value);
        return 0 <= index && array.splice(index, 1), index;
    }
    function copy(source, destination) {
        var obj, value, stackSource = [], stackDest = [];
        if (destination) {
            if ((value = destination) && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value)) || (obj = destination, 
            "[object ArrayBuffer]" === toString.call(obj))) throw ngMinErr("cpta", "Can't copy! TypedArray destination cannot be mutated.");
            if (source === destination) throw ngMinErr("cpi", "Can't copy! Source and destination are identical.");
            return isArray(destination) ? destination.length = 0 : forEach(destination, function(value, key) {
                "$$hashKey" !== key && delete destination[key];
            }), stackSource.push(source), stackDest.push(destination), copyRecurse(source, destination);
        }
        return copyElement(source);
        function copyRecurse(source, destination) {
            var key, h = destination.$$hashKey;
            if (isArray(source)) for (var i = 0, ii = source.length; i < ii; i++) destination.push(copyElement(source[i])); else if (isBlankObject(source)) for (key in source) destination[key] = copyElement(source[key]); else if (source && "function" == typeof source.hasOwnProperty) for (key in source) source.hasOwnProperty(key) && (destination[key] = copyElement(source[key])); else for (key in source) hasOwnProperty.call(source, key) && (destination[key] = copyElement(source[key]));
            return setHashKey(destination, h), destination;
        }
        function copyElement(source) {
            if (!isObject(source)) return source;
            var index = stackSource.indexOf(source);
            if (-1 !== index) return stackDest[index];
            if (isWindow(source) || isScope(source)) throw ngMinErr("cpws", "Can't copy! Making copies of Window or Scope instances is not supported.");
            var needsRecurse = !1, destination = function(source) {
                switch (toString.call(source)) {
                  case "[object Int8Array]":
                  case "[object Int16Array]":
                  case "[object Int32Array]":
                  case "[object Float32Array]":
                  case "[object Float64Array]":
                  case "[object Uint8Array]":
                  case "[object Uint8ClampedArray]":
                  case "[object Uint16Array]":
                  case "[object Uint32Array]":
                    return new source.constructor(copyElement(source.buffer), source.byteOffset, source.length);

                  case "[object ArrayBuffer]":
                    if (!source.slice) {
                        var copied = new ArrayBuffer(source.byteLength);
                        return new Uint8Array(copied).set(new Uint8Array(source)), copied;
                    }
                    return source.slice(0);

                  case "[object Boolean]":
                  case "[object Number]":
                  case "[object String]":
                  case "[object Date]":
                    return new source.constructor(source.valueOf());

                  case "[object RegExp]":
                    var re = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
                    return re.lastIndex = source.lastIndex, re;

                  case "[object Blob]":
                    return new source.constructor([ source ], {
                        type: source.type
                    });
                }
                if (isFunction(source.cloneNode)) return source.cloneNode(!0);
            }(source);
            return void 0 === destination && (destination = isArray(source) ? [] : Object.create(getPrototypeOf(source)), 
            needsRecurse = !0), stackSource.push(source), stackDest.push(destination), needsRecurse ? copyRecurse(source, destination) : destination;
        }
    }
    function equals(o1, o2) {
        if (o1 === o2) return !0;
        if (null === o1 || null === o2) return !1;
        if (o1 != o1 && o2 != o2) return !0;
        var length, key, keySet, t1 = typeof o1;
        if (t1 == typeof o2 && "object" == t1) {
            if (!isArray(o1)) {
                if (isDate(o1)) return !!isDate(o2) && equals(o1.getTime(), o2.getTime());
                if (isRegExp(o1)) return !!isRegExp(o2) && o1.toString() == o2.toString();
                if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) || isArray(o2) || isDate(o2) || isRegExp(o2)) return !1;
                for (key in keySet = createMap(), o1) if ("$" !== key.charAt(0) && !isFunction(o1[key])) {
                    if (!equals(o1[key], o2[key])) return !1;
                    keySet[key] = !0;
                }
                for (key in o2) if (!(key in keySet) && "$" !== key.charAt(0) && isDefined(o2[key]) && !isFunction(o2[key])) return !1;
                return !0;
            }
            if (!isArray(o2)) return !1;
            if ((length = o1.length) == o2.length) {
                for (key = 0; key < length; key++) if (!equals(o1[key], o2[key])) return !1;
                return !0;
            }
        }
        return !1;
    }
    var csp = function() {
        if (!isDefined(csp.rules)) {
            var ngCspElement = window.document.querySelector("[ng-csp]") || window.document.querySelector("[data-ng-csp]");
            if (ngCspElement) {
                var ngCspAttribute = ngCspElement.getAttribute("ng-csp") || ngCspElement.getAttribute("data-ng-csp");
                csp.rules = {
                    noUnsafeEval: !ngCspAttribute || -1 !== ngCspAttribute.indexOf("no-unsafe-eval"),
                    noInlineStyle: !ngCspAttribute || -1 !== ngCspAttribute.indexOf("no-inline-style")
                };
            } else csp.rules = {
                noUnsafeEval: function() {
                    try {
                        return new Function(""), !1;
                    } catch (e) {
                        return !0;
                    }
                }(),
                noInlineStyle: !1
            };
        }
        return csp.rules;
    }, jq = function() {
        if (isDefined(jq.name_)) return jq.name_;
        var el, i, prefix, name, ii = ngAttrPrefixes.length;
        for (i = 0; i < ii; ++i) if (prefix = ngAttrPrefixes[i], el = window.document.querySelector("[" + prefix.replace(":", "\\:") + "jq]")) {
            name = el.getAttribute(prefix + "jq");
            break;
        }
        return jq.name_ = name;
    };
    function concat(array1, array2, index) {
        return array1.concat(slice.call(array2, index));
    }
    function sliceArgs(args, startIndex) {
        return slice.call(args, startIndex || 0);
    }
    function bind(self, fn) {
        var curryArgs = 2 < arguments.length ? sliceArgs(arguments, 2) : [];
        return !isFunction(fn) || fn instanceof RegExp ? fn : curryArgs.length ? function() {
            return arguments.length ? fn.apply(self, concat(curryArgs, arguments, 0)) : fn.apply(self, curryArgs);
        } : function() {
            return arguments.length ? fn.apply(self, arguments) : fn.call(self);
        };
    }
    function toJsonReplacer(key, value) {
        var val = value;
        return "string" == typeof key && "$" === key.charAt(0) && "$" === key.charAt(1) ? val = void 0 : isWindow(value) ? val = "$WINDOW" : value && window.document === value ? val = "$DOCUMENT" : isScope(value) && (val = "$SCOPE"), 
        val;
    }
    function toJson(obj, pretty) {
        if (!isUndefined(obj)) return isNumber(pretty) || (pretty = pretty ? 2 : null), 
        JSON.stringify(obj, toJsonReplacer, pretty);
    }
    function fromJson(json) {
        return isString(json) ? JSON.parse(json) : json;
    }
    var ALL_COLONS = /:/g;
    function timezoneToOffset(timezone, fallback) {
        timezone = timezone.replace(ALL_COLONS, "");
        var requestedTimezoneOffset = Date.parse("Jan 01, 1970 00:00:00 " + timezone) / 6e4;
        return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
    }
    function convertTimezoneToLocal(date, timezone, reverse) {
        reverse = reverse ? -1 : 1;
        var dateTimezoneOffset = date.getTimezoneOffset();
        return function(date, minutes) {
            return (date = new Date(date.getTime())).setMinutes(date.getMinutes() + minutes), 
            date;
        }(date, reverse * (timezoneToOffset(timezone, dateTimezoneOffset) - dateTimezoneOffset));
    }
    function startingTag(element) {
        element = jqLite(element).clone();
        try {
            element.empty();
        } catch (e) {}
        var elemHtml = jqLite("<div>").append(element).html();
        try {
            return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) : elemHtml.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/, function(match, nodeName) {
                return "<" + lowercase(nodeName);
            });
        } catch (e) {
            return lowercase(elemHtml);
        }
    }
    function tryDecodeURIComponent(value) {
        try {
            return decodeURIComponent(value);
        } catch (e) {}
    }
    function parseKeyValue(keyValue) {
        var obj = {};
        return forEach((keyValue || "").split("&"), function(keyValue) {
            var splitPoint, key, val;
            keyValue && (key = keyValue = keyValue.replace(/\+/g, "%20"), -1 !== (splitPoint = keyValue.indexOf("=")) && (key = keyValue.substring(0, splitPoint), 
            val = keyValue.substring(splitPoint + 1)), isDefined(key = tryDecodeURIComponent(key)) && (val = !isDefined(val) || tryDecodeURIComponent(val), 
            hasOwnProperty.call(obj, key) ? isArray(obj[key]) ? obj[key].push(val) : obj[key] = [ obj[key], val ] : obj[key] = val));
        }), obj;
    }
    function toKeyValue(obj) {
        var parts = [];
        return forEach(obj, function(value, key) {
            isArray(value) ? forEach(value, function(arrayValue) {
                parts.push(encodeUriQuery(key, !0) + (!0 === arrayValue ? "" : "=" + encodeUriQuery(arrayValue, !0)));
            }) : parts.push(encodeUriQuery(key, !0) + (!0 === value ? "" : "=" + encodeUriQuery(value, !0)));
        }), parts.length ? parts.join("&") : "";
    }
    function encodeUriSegment(val) {
        return encodeUriQuery(val, !0).replace(/%26/gi, "&").replace(/%3D/gi, "=").replace(/%2B/gi, "+");
    }
    function encodeUriQuery(val, pctEncodeSpaces) {
        return encodeURIComponent(val).replace(/%40/gi, "@").replace(/%3A/gi, ":").replace(/%24/g, "$").replace(/%2C/gi, ",").replace(/%3B/gi, ";").replace(/%20/g, pctEncodeSpaces ? "%20" : "+");
    }
    var ngAttrPrefixes = [ "ng-", "data-ng-", "ng:", "x-ng-" ];
    function angularInit(element, bootstrap) {
        var appElement, module, config = {};
        forEach(ngAttrPrefixes, function(prefix) {
            var name = prefix + "app";
            !appElement && element.hasAttribute && element.hasAttribute(name) && (module = (appElement = element).getAttribute(name));
        }), forEach(ngAttrPrefixes, function(prefix) {
            var candidate, name = prefix + "app";
            !appElement && (candidate = element.querySelector("[" + name.replace(":", "\\:") + "]")) && (module = (appElement = candidate).getAttribute(name));
        }), appElement && (config.strictDi = null !== function(element, ngAttr) {
            var attr, i, ii = ngAttrPrefixes.length;
            for (i = 0; i < ii; ++i) if (attr = ngAttrPrefixes[i] + ngAttr, isString(attr = element.getAttribute(attr))) return attr;
            return null;
        }(appElement, "strict-di"), bootstrap(appElement, module ? [ module ] : [], config));
    }
    function bootstrap(element, modules, config) {
        isObject(config) || (config = {});
        config = extend({
            strictDi: !1
        }, config);
        var doBootstrap = function() {
            if ((element = jqLite(element)).injector()) {
                var tag = element[0] === window.document ? "document" : startingTag(element);
                throw ngMinErr("btstrpd", "App already bootstrapped with this element '{0}'", tag.replace(/</, "&lt;").replace(/>/, "&gt;"));
            }
            (modules = modules || []).unshift([ "$provide", function($provide) {
                $provide.value("$rootElement", element);
            } ]), config.debugInfoEnabled && modules.push([ "$compileProvider", function($compileProvider) {
                $compileProvider.debugInfoEnabled(!0);
            } ]), modules.unshift("ng");
            var injector = createInjector(modules, config.strictDi);
            return injector.invoke([ "$rootScope", "$rootElement", "$compile", "$injector", function(scope, element, compile, injector) {
                scope.$apply(function() {
                    element.data("$injector", injector), compile(element)(scope);
                });
            } ]), injector;
        }, NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/, NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
        if (window && NG_ENABLE_DEBUG_INFO.test(window.name) && (config.debugInfoEnabled = !0, 
        window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, "")), window && !NG_DEFER_BOOTSTRAP.test(window.name)) return doBootstrap();
        window.name = window.name.replace(NG_DEFER_BOOTSTRAP, ""), angular.resumeBootstrap = function(extraModules) {
            return forEach(extraModules, function(module) {
                modules.push(module);
            }), doBootstrap();
        }, isFunction(angular.resumeDeferredBootstrap) && angular.resumeDeferredBootstrap();
    }
    function reloadWithDebugInfo() {
        window.name = "NG_ENABLE_DEBUG_INFO!" + window.name, window.location.reload();
    }
    function getTestability(rootElement) {
        var injector = angular.element(rootElement).injector();
        if (!injector) throw ngMinErr("test", "no injector found for element argument to getTestability");
        return injector.get("$$testability");
    }
    var SNAKE_CASE_REGEXP = /[A-Z]/g;
    function snake_case(name, separator) {
        return separator = separator || "_", name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
            return (pos ? separator : "") + letter.toLowerCase();
        });
    }
    var bindJQueryFired = !1;
    function assertArg(arg, name, reason) {
        if (!arg) throw ngMinErr("areq", "Argument '{0}' is {1}", name || "?", reason || "required");
        return arg;
    }
    function assertArgFn(arg, name, acceptArrayAnnotation) {
        return acceptArrayAnnotation && isArray(arg) && (arg = arg[arg.length - 1]), assertArg(isFunction(arg), name, "not a function, got " + (arg && "object" == typeof arg ? arg.constructor.name || "Object" : typeof arg)), 
        arg;
    }
    function assertNotHasOwnProperty(name, context) {
        if ("hasOwnProperty" === name) throw ngMinErr("badname", "hasOwnProperty is not a valid {0} name", context);
    }
    function getter(obj, path, bindFnToScope) {
        if (!path) return obj;
        for (var key, keys = path.split("."), lastInstance = obj, len = keys.length, i = 0; i < len; i++) key = keys[i], 
        obj && (obj = (lastInstance = obj)[key]);
        return !bindFnToScope && isFunction(obj) ? bind(lastInstance, obj) : obj;
    }
    function getBlockNodes(nodes) {
        for (var blockNodes, node = nodes[0], endNode = nodes[nodes.length - 1], i = 1; node !== endNode && (node = node.nextSibling); i++) (blockNodes || nodes[i] !== node) && (blockNodes || (blockNodes = jqLite(slice.call(nodes, 0, i))), 
        blockNodes.push(node));
        return blockNodes || nodes;
    }
    function createMap() {
        return Object.create(null);
    }
    var NODE_TYPE_ELEMENT = 1, NODE_TYPE_TEXT = 3, NODE_TYPE_COMMENT = 8, NODE_TYPE_DOCUMENT = 9, NODE_TYPE_DOCUMENT_FRAGMENT = 11;
    function shallowCopy(src, dst) {
        if (isArray(src)) {
            dst = dst || [];
            for (var i = 0, ii = src.length; i < ii; i++) dst[i] = src[i];
        } else if (isObject(src)) for (var key in dst = dst || {}, src) "$" === key.charAt(0) && "$" === key.charAt(1) || (dst[key] = src[key]);
        return dst || src;
    }
    function toDebugString(obj) {
        return "function" == typeof obj ? obj.toString().replace(/ \{[\s\S]*$/, "") : isUndefined(obj) ? "undefined" : "string" != typeof obj ? function(obj) {
            var seen = [];
            return JSON.stringify(obj, function(key, val) {
                if (isObject(val = toJsonReplacer(key, val))) {
                    if (0 <= seen.indexOf(val)) return "...";
                    seen.push(val);
                }
                return val;
            });
        }(obj) : obj;
    }
    var version = {
        full: "1.5.8",
        major: 1,
        minor: 5,
        dot: 8,
        codeName: "arbitrary-fallbacks"
    };
    JQLite.expando = "ng339";
    var jqCache = JQLite.cache = {}, jqId = 1, addEventListenerFn = function(element, type, fn) {
        element.addEventListener(type, fn, !1);
    }, removeEventListenerFn = function(element, type, fn) {
        element.removeEventListener(type, fn, !1);
    };
    JQLite._data = function(node) {
        return this.cache[node[this.expando]] || {};
    };
    var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g, MOZ_HACK_REGEXP = /^moz([A-Z])/, MOUSE_EVENT_MAP = {
        mouseleave: "mouseout",
        mouseenter: "mouseover"
    }, jqLiteMinErr = minErr("jqLite");
    function camelCase(name) {
        return name.replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
            return offset ? letter.toUpperCase() : letter;
        }).replace(MOZ_HACK_REGEXP, "Moz$1");
    }
    var SINGLE_TAG_REGEXP = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/, HTML_REGEXP = /<|&#?\w+;/, TAG_NAME_REGEXP = /<([\w:-]+)/, XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, wrapMap = {
        option: [ 1, '<select multiple="multiple">', "</select>" ],
        thead: [ 1, "<table>", "</table>" ],
        col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
        tr: [ 2, "<table><tbody>", "</tbody></table>" ],
        td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
        _default: [ 0, "", "" ]
    };
    function jqLiteIsTextNode(html) {
        return !HTML_REGEXP.test(html);
    }
    function jqLiteAcceptsData(node) {
        var nodeType = node.nodeType;
        return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;
    }
    function jqLiteBuildFragment(html, context) {
        var tmp, tag, wrap, i, fragment = context.createDocumentFragment(), nodes = [];
        if (jqLiteIsTextNode(html)) nodes.push(context.createTextNode(html)); else {
            for (tmp = fragment.appendChild(context.createElement("div")), tag = (TAG_NAME_REGEXP.exec(html) || [ "", "" ])[1].toLowerCase(), 
            wrap = wrapMap[tag] || wrapMap._default, tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2], 
            i = wrap[0]; i--; ) tmp = tmp.lastChild;
            nodes = concat(nodes, tmp.childNodes), (tmp = fragment.firstChild).textContent = "";
        }
        return fragment.textContent = "", fragment.innerHTML = "", forEach(nodes, function(node) {
            fragment.appendChild(node);
        }), fragment;
    }
    function jqLiteWrapNode(node, wrapper) {
        var parent = node.parentNode;
        parent && parent.replaceChild(wrapper, node), wrapper.appendChild(node);
    }
    wrapMap.optgroup = wrapMap.option, wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead, 
    wrapMap.th = wrapMap.td;
    var jqLiteContains = window.Node.prototype.contains || function(arg) {
        return !!(16 & this.compareDocumentPosition(arg));
    };
    function JQLite(element) {
        if (element instanceof JQLite) return element;
        var argIsString, html, context, parsed;
        if (isString(element) && (element = trim(element), argIsString = !0), !(this instanceof JQLite)) {
            if (argIsString && "<" != element.charAt(0)) throw jqLiteMinErr("nosel", "Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element");
            return new JQLite(element);
        }
        jqLiteAddNodes(this, argIsString ? (html = element, context = context || window.document, 
        (parsed = SINGLE_TAG_REGEXP.exec(html)) ? [ context.createElement(parsed[1]) ] : (parsed = jqLiteBuildFragment(html, context)) ? parsed.childNodes : []) : element);
    }
    function jqLiteClone(element) {
        return element.cloneNode(!0);
    }
    function jqLiteDealoc(element, onlyDescendants) {
        if (onlyDescendants || jqLiteRemoveData(element), element.querySelectorAll) for (var descendants = element.querySelectorAll("*"), i = 0, l = descendants.length; i < l; i++) jqLiteRemoveData(descendants[i]);
    }
    function jqLiteOff(element, type, fn, unsupported) {
        if (isDefined(unsupported)) throw jqLiteMinErr("offargs", "jqLite#off() does not support the `selector` argument");
        var expandoStore = jqLiteExpandoStore(element), events = expandoStore && expandoStore.events, handle = expandoStore && expandoStore.handle;
        if (handle) if (type) {
            var removeHandler = function(type) {
                var listenerFns = events[type];
                isDefined(fn) && arrayRemove(listenerFns || [], fn), isDefined(fn) && listenerFns && 0 < listenerFns.length || (removeEventListenerFn(element, type, handle), 
                delete events[type]);
            };
            forEach(type.split(" "), function(type) {
                removeHandler(type), MOUSE_EVENT_MAP[type] && removeHandler(MOUSE_EVENT_MAP[type]);
            });
        } else for (type in events) "$destroy" !== type && removeEventListenerFn(element, type, handle), 
        delete events[type];
    }
    function jqLiteRemoveData(element, name) {
        var expandoId = element.ng339, expandoStore = expandoId && jqCache[expandoId];
        if (expandoStore) {
            if (name) return void delete expandoStore.data[name];
            expandoStore.handle && (expandoStore.events.$destroy && expandoStore.handle({}, "$destroy"), 
            jqLiteOff(element)), delete jqCache[expandoId], element.ng339 = void 0;
        }
    }
    function jqLiteExpandoStore(element, createIfNecessary) {
        var expandoId = element.ng339, expandoStore = expandoId && jqCache[expandoId];
        return createIfNecessary && !expandoStore && (element.ng339 = expandoId = ++jqId, 
        expandoStore = jqCache[expandoId] = {
            events: {},
            data: {},
            handle: void 0
        }), expandoStore;
    }
    function jqLiteData(element, key, value) {
        if (jqLiteAcceptsData(element)) {
            var isSimpleSetter = isDefined(value), isSimpleGetter = !isSimpleSetter && key && !isObject(key), massGetter = !key, expandoStore = jqLiteExpandoStore(element, !isSimpleGetter), data = expandoStore && expandoStore.data;
            if (isSimpleSetter) data[key] = value; else {
                if (massGetter) return data;
                if (isSimpleGetter) return data && data[key];
                extend(data, key);
            }
        }
    }
    function jqLiteHasClass(element, selector) {
        return !!element.getAttribute && -1 < (" " + (element.getAttribute("class") || "") + " ").replace(/[\n\t]/g, " ").indexOf(" " + selector + " ");
    }
    function jqLiteRemoveClass(element, cssClasses) {
        cssClasses && element.setAttribute && forEach(cssClasses.split(" "), function(cssClass) {
            element.setAttribute("class", trim((" " + (element.getAttribute("class") || "") + " ").replace(/[\n\t]/g, " ").replace(" " + trim(cssClass) + " ", " ")));
        });
    }
    function jqLiteAddClass(element, cssClasses) {
        if (cssClasses && element.setAttribute) {
            var existingClasses = (" " + (element.getAttribute("class") || "") + " ").replace(/[\n\t]/g, " ");
            forEach(cssClasses.split(" "), function(cssClass) {
                cssClass = trim(cssClass), -1 === existingClasses.indexOf(" " + cssClass + " ") && (existingClasses += cssClass + " ");
            }), element.setAttribute("class", trim(existingClasses));
        }
    }
    function jqLiteAddNodes(root, elements) {
        if (elements) if (elements.nodeType) root[root.length++] = elements; else {
            var length = elements.length;
            if ("number" == typeof length && elements.window !== elements) {
                if (length) for (var i = 0; i < length; i++) root[root.length++] = elements[i];
            } else root[root.length++] = elements;
        }
    }
    function jqLiteController(element, name) {
        return jqLiteInheritedData(element, "$" + (name || "ngController") + "Controller");
    }
    function jqLiteInheritedData(element, name, value) {
        element.nodeType == NODE_TYPE_DOCUMENT && (element = element.documentElement);
        for (var names = isArray(name) ? name : [ name ]; element; ) {
            for (var i = 0, ii = names.length; i < ii; i++) if (isDefined(value = jqLite.data(element, names[i]))) return value;
            element = element.parentNode || element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host;
        }
    }
    function jqLiteEmpty(element) {
        for (jqLiteDealoc(element, !0); element.firstChild; ) element.removeChild(element.firstChild);
    }
    function jqLiteRemove(element, keepData) {
        keepData || jqLiteDealoc(element);
        var parent = element.parentNode;
        parent && parent.removeChild(element);
    }
    var JQLitePrototype = JQLite.prototype = {
        ready: function(fn) {
            var fired = !1;
            function trigger() {
                fired || (fired = !0, fn());
            }
            "complete" === window.document.readyState ? window.setTimeout(trigger) : (this.on("DOMContentLoaded", trigger), 
            JQLite(window).on("load", trigger));
        },
        toString: function() {
            var value = [];
            return forEach(this, function(e) {
                value.push("" + e);
            }), "[" + value.join(", ") + "]";
        },
        eq: function(index) {
            return jqLite(0 <= index ? this[index] : this[this.length + index]);
        },
        length: 0,
        push: push,
        sort: [].sort,
        splice: [].splice
    }, BOOLEAN_ATTR = {};
    forEach("multiple,selected,checked,disabled,readOnly,required,open".split(","), function(value) {
        BOOLEAN_ATTR[lowercase(value)] = value;
    });
    var BOOLEAN_ELEMENTS = {};
    forEach("input,select,option,textarea,button,form,details".split(","), function(value) {
        BOOLEAN_ELEMENTS[value] = !0;
    });
    var ALIASED_ATTR = {
        ngMinlength: "minlength",
        ngMaxlength: "maxlength",
        ngMin: "min",
        ngMax: "max",
        ngPattern: "pattern"
    };
    function getBooleanAttrName(element, name) {
        var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];
        return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr;
    }
    function defaultHandlerWrapper(element, event, handler) {
        handler.call(element, event);
    }
    function specialMouseHandlerWrapper(target, event, handler) {
        var related = event.relatedTarget;
        related && (related === target || jqLiteContains.call(target, related)) || handler.call(target, event);
    }
    function $$jqLiteProvider() {
        this.$get = function() {
            return extend(JQLite, {
                hasClass: function(node, classes) {
                    return node.attr && (node = node[0]), jqLiteHasClass(node, classes);
                },
                addClass: function(node, classes) {
                    return node.attr && (node = node[0]), jqLiteAddClass(node, classes);
                },
                removeClass: function(node, classes) {
                    return node.attr && (node = node[0]), jqLiteRemoveClass(node, classes);
                }
            });
        };
    }
    function hashKey(obj, nextUidFn) {
        var key = obj && obj.$$hashKey;
        if (key) return "function" == typeof key && (key = obj.$$hashKey()), key;
        var objType = typeof obj;
        return key = "function" == objType || "object" == objType && null !== obj ? obj.$$hashKey = objType + ":" + (nextUidFn || nextUid)() : objType + ":" + obj;
    }
    function HashMap(array, isolatedUid) {
        if (isolatedUid) {
            var uid = 0;
            this.nextUid = function() {
                return ++uid;
            };
        }
        forEach(array, this.put, this);
    }
    forEach({
        data: jqLiteData,
        removeData: jqLiteRemoveData,
        hasData: function(node) {
            for (var key in jqCache[node.ng339]) return !0;
            return !1;
        },
        cleanData: function(nodes) {
            for (var i = 0, ii = nodes.length; i < ii; i++) jqLiteRemoveData(nodes[i]);
        }
    }, function(fn, name) {
        JQLite[name] = fn;
    }), forEach({
        data: jqLiteData,
        inheritedData: jqLiteInheritedData,
        scope: function(element) {
            return jqLite.data(element, "$scope") || jqLiteInheritedData(element.parentNode || element, [ "$isolateScope", "$scope" ]);
        },
        isolateScope: function(element) {
            return jqLite.data(element, "$isolateScope") || jqLite.data(element, "$isolateScopeNoTemplate");
        },
        controller: jqLiteController,
        injector: function(element) {
            return jqLiteInheritedData(element, "$injector");
        },
        removeAttr: function(element, name) {
            element.removeAttribute(name);
        },
        hasClass: jqLiteHasClass,
        css: function(element, name, value) {
            if (name = camelCase(name), !isDefined(value)) return element.style[name];
            element.style[name] = value;
        },
        attr: function(element, name, value) {
            var nodeType = element.nodeType;
            if (nodeType !== NODE_TYPE_TEXT && 2 !== nodeType && nodeType !== NODE_TYPE_COMMENT) {
                var lowercasedName = lowercase(name);
                if (BOOLEAN_ATTR[lowercasedName]) {
                    if (!isDefined(value)) return element[name] || (element.attributes.getNamedItem(name) || noop).specified ? lowercasedName : void 0;
                    value ? (element[name] = !0, element.setAttribute(name, lowercasedName)) : (element[name] = !1, 
                    element.removeAttribute(lowercasedName));
                } else if (isDefined(value)) element.setAttribute(name, value); else if (element.getAttribute) {
                    var ret = element.getAttribute(name, 2);
                    return null === ret ? void 0 : ret;
                }
            }
        },
        prop: function(element, name, value) {
            if (!isDefined(value)) return element[name];
            element[name] = value;
        },
        text: function() {
            return getText.$dv = "", getText;
            function getText(element, value) {
                if (isUndefined(value)) {
                    var nodeType = element.nodeType;
                    return nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT ? element.textContent : "";
                }
                element.textContent = value;
            }
        }(),
        val: function(element, value) {
            if (isUndefined(value)) {
                if (element.multiple && "select" === nodeName_(element)) {
                    var result = [];
                    return forEach(element.options, function(option) {
                        option.selected && result.push(option.value || option.text);
                    }), 0 === result.length ? null : result;
                }
                return element.value;
            }
            element.value = value;
        },
        html: function(element, value) {
            if (isUndefined(value)) return element.innerHTML;
            jqLiteDealoc(element, !0), element.innerHTML = value;
        },
        empty: jqLiteEmpty
    }, function(fn, name) {
        JQLite.prototype[name] = function(arg1, arg2) {
            var i, key, nodeCount = this.length;
            if (fn !== jqLiteEmpty && isUndefined(2 == fn.length && fn !== jqLiteHasClass && fn !== jqLiteController ? arg1 : arg2)) {
                if (isObject(arg1)) {
                    for (i = 0; i < nodeCount; i++) if (fn === jqLiteData) fn(this[i], arg1); else for (key in arg1) fn(this[i], key, arg1[key]);
                    return this;
                }
                for (var value = fn.$dv, jj = isUndefined(value) ? Math.min(nodeCount, 1) : nodeCount, j = 0; j < jj; j++) {
                    var nodeValue = fn(this[j], arg1, arg2);
                    value = value ? value + nodeValue : nodeValue;
                }
                return value;
            }
            for (i = 0; i < nodeCount; i++) fn(this[i], arg1, arg2);
            return this;
        };
    }), forEach({
        removeData: jqLiteRemoveData,
        on: function(element, type, fn, unsupported) {
            if (isDefined(unsupported)) throw jqLiteMinErr("onargs", "jqLite#on() does not support the `selector` or `eventData` parameters");
            if (jqLiteAcceptsData(element)) {
                var expandoStore = jqLiteExpandoStore(element, !0), events = expandoStore.events, handle = expandoStore.handle;
                handle || (handle = expandoStore.handle = function(element, events) {
                    var eventHandler = function(event, type) {
                        event.isDefaultPrevented = function() {
                            return event.defaultPrevented;
                        };
                        var eventFns = events[type || event.type], eventFnsLength = eventFns ? eventFns.length : 0;
                        if (eventFnsLength) {
                            if (isUndefined(event.immediatePropagationStopped)) {
                                var originalStopImmediatePropagation = event.stopImmediatePropagation;
                                event.stopImmediatePropagation = function() {
                                    event.immediatePropagationStopped = !0, event.stopPropagation && event.stopPropagation(), 
                                    originalStopImmediatePropagation && originalStopImmediatePropagation.call(event);
                                };
                            }
                            event.isImmediatePropagationStopped = function() {
                                return !0 === event.immediatePropagationStopped;
                            };
                            var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper;
                            1 < eventFnsLength && (eventFns = shallowCopy(eventFns));
                            for (var i = 0; i < eventFnsLength; i++) event.isImmediatePropagationStopped() || handlerWrapper(element, event, eventFns[i]);
                        }
                    };
                    return eventHandler.elem = element, eventHandler;
                }(element, events));
                for (var types = 0 <= type.indexOf(" ") ? type.split(" ") : [ type ], i = types.length, addHandler = function(type, specialHandlerWrapper, noEventListener) {
                    var eventFns = events[type];
                    eventFns || ((eventFns = events[type] = []).specialHandlerWrapper = specialHandlerWrapper, 
                    "$destroy" === type || noEventListener || addEventListenerFn(element, type, handle)), 
                    eventFns.push(fn);
                }; i--; ) type = types[i], MOUSE_EVENT_MAP[type] ? (addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper), 
                addHandler(type, void 0, !0)) : addHandler(type);
            }
        },
        off: jqLiteOff,
        one: function(element, type, fn) {
            (element = jqLite(element)).on(type, function onFn() {
                element.off(type, fn), element.off(type, onFn);
            }), element.on(type, fn);
        },
        replaceWith: function(element, replaceNode) {
            var index, parent = element.parentNode;
            jqLiteDealoc(element), forEach(new JQLite(replaceNode), function(node) {
                index ? parent.insertBefore(node, index.nextSibling) : parent.replaceChild(node, element), 
                index = node;
            });
        },
        children: function(element) {
            var children = [];
            return forEach(element.childNodes, function(element) {
                element.nodeType === NODE_TYPE_ELEMENT && children.push(element);
            }), children;
        },
        contents: function(element) {
            return element.contentDocument || element.childNodes || [];
        },
        append: function(element, node) {
            var nodeType = element.nodeType;
            if (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_DOCUMENT_FRAGMENT) for (var i = 0, ii = (node = new JQLite(node)).length; i < ii; i++) {
                var child = node[i];
                element.appendChild(child);
            }
        },
        prepend: function(element, node) {
            if (element.nodeType === NODE_TYPE_ELEMENT) {
                var index = element.firstChild;
                forEach(new JQLite(node), function(child) {
                    element.insertBefore(child, index);
                });
            }
        },
        wrap: function(element, wrapNode) {
            jqLiteWrapNode(element, jqLite(wrapNode).eq(0).clone()[0]);
        },
        remove: jqLiteRemove,
        detach: function(element) {
            jqLiteRemove(element, !0);
        },
        after: function(element, newElement) {
            for (var index = element, parent = element.parentNode, i = 0, ii = (newElement = new JQLite(newElement)).length; i < ii; i++) {
                var node = newElement[i];
                parent.insertBefore(node, index.nextSibling), index = node;
            }
        },
        addClass: jqLiteAddClass,
        removeClass: jqLiteRemoveClass,
        toggleClass: function(element, selector, condition) {
            selector && forEach(selector.split(" "), function(className) {
                var classCondition = condition;
                isUndefined(classCondition) && (classCondition = !jqLiteHasClass(element, className)), 
                (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);
            });
        },
        parent: function(element) {
            var parent = element.parentNode;
            return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null;
        },
        next: function(element) {
            return element.nextElementSibling;
        },
        find: function(element, selector) {
            return element.getElementsByTagName ? element.getElementsByTagName(selector) : [];
        },
        clone: jqLiteClone,
        triggerHandler: function(element, event, extraParameters) {
            var dummyEvent, eventFnsCopy, handlerArgs, eventName = event.type || event, expandoStore = jqLiteExpandoStore(element), events = expandoStore && expandoStore.events, eventFns = events && events[eventName];
            eventFns && (dummyEvent = {
                preventDefault: function() {
                    this.defaultPrevented = !0;
                },
                isDefaultPrevented: function() {
                    return !0 === this.defaultPrevented;
                },
                stopImmediatePropagation: function() {
                    this.immediatePropagationStopped = !0;
                },
                isImmediatePropagationStopped: function() {
                    return !0 === this.immediatePropagationStopped;
                },
                stopPropagation: noop,
                type: eventName,
                target: element
            }, event.type && (dummyEvent = extend(dummyEvent, event)), eventFnsCopy = shallowCopy(eventFns), 
            handlerArgs = extraParameters ? [ dummyEvent ].concat(extraParameters) : [ dummyEvent ], 
            forEach(eventFnsCopy, function(fn) {
                dummyEvent.isImmediatePropagationStopped() || fn.apply(element, handlerArgs);
            }));
        }
    }, function(fn, name) {
        JQLite.prototype[name] = function(arg1, arg2, arg3) {
            for (var value, i = 0, ii = this.length; i < ii; i++) isUndefined(value) ? isDefined(value = fn(this[i], arg1, arg2, arg3)) && (value = jqLite(value)) : jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));
            return isDefined(value) ? value : this;
        }, JQLite.prototype.bind = JQLite.prototype.on, JQLite.prototype.unbind = JQLite.prototype.off;
    }), HashMap.prototype = {
        put: function(key, value) {
            this[hashKey(key, this.nextUid)] = value;
        },
        get: function(key) {
            return this[hashKey(key, this.nextUid)];
        },
        remove: function(key) {
            var value = this[key = hashKey(key, this.nextUid)];
            return delete this[key], value;
        }
    };
    var $$HashMapProvider = [ function() {
        this.$get = [ function() {
            return HashMap;
        } ];
    } ], ARROW_ARG = /^([^\(]+?)=>/, FN_ARGS = /^[^\(]*\(\s*([^\)]*)\)/m, FN_ARG_SPLIT = /,/, FN_ARG = /^\s*(_?)(\S+?)\1\s*$/, STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm, $injectorMinErr = minErr("$injector");
    function stringifyFn(fn) {
        return Function.prototype.toString.call(fn) + " ";
    }
    function extractArgs(fn) {
        var fnText = stringifyFn(fn).replace(STRIP_COMMENTS, "");
        return fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
    }
    function createInjector(modulesToLoad, strictDi) {
        strictDi = !0 === strictDi;
        var INSTANTIATING = {}, providerSuffix = "Provider", path = [], loadedModules = new HashMap([], !0), providerCache = {
            $provide: {
                provider: supportObject(provider),
                factory: supportObject(factory),
                service: supportObject(function(name, constructor) {
                    return factory(name, [ "$injector", function($injector) {
                        return $injector.instantiate(constructor);
                    } ]);
                }),
                value: supportObject(function(name, val) {
                    return factory(name, valueFn(val), !1);
                }),
                constant: supportObject(function(name, value) {
                    assertNotHasOwnProperty(name, "constant"), providerCache[name] = value, instanceCache[name] = value;
                }),
                decorator: function(serviceName, decorFn) {
                    var origProvider = providerInjector.get(serviceName + providerSuffix), orig$get = origProvider.$get;
                    origProvider.$get = function() {
                        var origInstance = instanceInjector.invoke(orig$get, origProvider);
                        return instanceInjector.invoke(decorFn, null, {
                            $delegate: origInstance
                        });
                    };
                }
            }
        }, providerInjector = providerCache.$injector = createInternalInjector(providerCache, function(serviceName, caller) {
            throw angular.isString(caller) && path.push(caller), $injectorMinErr("unpr", "Unknown provider: {0}", path.join(" <- "));
        }), instanceCache = {}, protoInstanceInjector = createInternalInjector(instanceCache, function(serviceName, caller) {
            var provider = providerInjector.get(serviceName + providerSuffix, caller);
            return instanceInjector.invoke(provider.$get, provider, void 0, serviceName);
        }), instanceInjector = protoInstanceInjector;
        providerCache["$injector" + providerSuffix] = {
            $get: valueFn(protoInstanceInjector)
        };
        var runBlocks = function loadModules(modulesToLoad) {
            assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), "modulesToLoad", "not an array");
            var moduleFn, runBlocks = [];
            forEach(modulesToLoad, function(module) {
                if (!loadedModules.get(module)) {
                    loadedModules.put(module, !0);
                    try {
                        isString(module) ? (moduleFn = angularModule(module), runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks), 
                        runInvokeQueue(moduleFn._invokeQueue), runInvokeQueue(moduleFn._configBlocks)) : isFunction(module) ? runBlocks.push(providerInjector.invoke(module)) : isArray(module) ? runBlocks.push(providerInjector.invoke(module)) : assertArgFn(module, "module");
                    } catch (e) {
                        throw isArray(module) && (module = module[module.length - 1]), e.message && e.stack && -1 == e.stack.indexOf(e.message) && (e = e.message + "\n" + e.stack), 
                        $injectorMinErr("modulerr", "Failed to instantiate module {0} due to:\n{1}", module, e.stack || e.message || e);
                    }
                }
                function runInvokeQueue(queue) {
                    var i, ii;
                    for (i = 0, ii = queue.length; i < ii; i++) {
                        var invokeArgs = queue[i], provider = providerInjector.get(invokeArgs[0]);
                        provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
                    }
                }
            });
            return runBlocks;
        }(modulesToLoad);
        return (instanceInjector = protoInstanceInjector.get("$injector")).strictDi = strictDi, 
        forEach(runBlocks, function(fn) {
            fn && instanceInjector.invoke(fn);
        }), instanceInjector;
        function supportObject(delegate) {
            return function(key, value) {
                if (!isObject(key)) return delegate(key, value);
                forEach(key, reverseParams(delegate));
            };
        }
        function provider(name, provider_) {
            if (assertNotHasOwnProperty(name, "service"), (isFunction(provider_) || isArray(provider_)) && (provider_ = providerInjector.instantiate(provider_)), 
            !provider_.$get) throw $injectorMinErr("pget", "Provider '{0}' must define $get factory method.", name);
            return providerCache[name + providerSuffix] = provider_;
        }
        function factory(name, factoryFn, enforce) {
            return provider(name, {
                $get: !1 !== enforce ? function(name, factory) {
                    return function() {
                        var result = instanceInjector.invoke(factory, this);
                        if (isUndefined(result)) throw $injectorMinErr("undef", "Provider '{0}' must return a value from $get factory method.", name);
                        return result;
                    };
                }(name, factoryFn) : factoryFn
            });
        }
        function createInternalInjector(cache, factory) {
            function getService(serviceName, caller) {
                if (cache.hasOwnProperty(serviceName)) {
                    if (cache[serviceName] === INSTANTIATING) throw $injectorMinErr("cdep", "Circular dependency found: {0}", serviceName + " <- " + path.join(" <- "));
                    return cache[serviceName];
                }
                try {
                    return path.unshift(serviceName), cache[serviceName] = INSTANTIATING, cache[serviceName] = factory(serviceName, caller);
                } catch (err) {
                    throw cache[serviceName] === INSTANTIATING && delete cache[serviceName], err;
                } finally {
                    path.shift();
                }
            }
            function injectionArgs(fn, locals, serviceName) {
                for (var args = [], $inject = createInjector.$$annotate(fn, strictDi, serviceName), i = 0, length = $inject.length; i < length; i++) {
                    var key = $inject[i];
                    if ("string" != typeof key) throw $injectorMinErr("itkn", "Incorrect injection token! Expected service name as string, got {0}", key);
                    args.push(locals && locals.hasOwnProperty(key) ? locals[key] : getService(key, serviceName));
                }
                return args;
            }
            return {
                invoke: function(fn, self, locals, serviceName) {
                    "string" == typeof locals && (serviceName = locals, locals = null);
                    var func, args = injectionArgs(fn, locals, serviceName);
                    return isArray(fn) && (fn = fn[fn.length - 1]), func = fn, msie <= 11 || "function" != typeof func || !/^(?:class\b|constructor\()/.test(stringifyFn(func)) ? fn.apply(self, args) : (args.unshift(null), 
                    new (Function.prototype.bind.apply(fn, args))());
                },
                instantiate: function(Type, locals, serviceName) {
                    var ctor = isArray(Type) ? Type[Type.length - 1] : Type, args = injectionArgs(Type, locals, serviceName);
                    return args.unshift(null), new (Function.prototype.bind.apply(ctor, args))();
                },
                get: getService,
                annotate: createInjector.$$annotate,
                has: function(name) {
                    return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);
                }
            };
        }
    }
    function $AnchorScrollProvider() {
        var autoScrollingEnabled = !0;
        this.disableAutoScrolling = function() {
            autoScrollingEnabled = !1;
        }, this.$get = [ "$window", "$location", "$rootScope", function($window, $location, $rootScope) {
            var document = $window.document;
            function scrollTo(elem) {
                if (elem) {
                    elem.scrollIntoView();
                    var offset = function() {
                        var offset = scroll.yOffset;
                        if (isFunction(offset)) offset = offset(); else if (isElement(offset)) {
                            var elem = offset[0];
                            offset = "fixed" !== $window.getComputedStyle(elem).position ? 0 : elem.getBoundingClientRect().bottom;
                        } else isNumber(offset) || (offset = 0);
                        return offset;
                    }();
                    if (offset) {
                        var elemTop = elem.getBoundingClientRect().top;
                        $window.scrollBy(0, elemTop - offset);
                    }
                } else $window.scrollTo(0, 0);
            }
            function scroll(hash) {
                var elm, list, result;
                (hash = isString(hash) ? hash : $location.hash()) ? (elm = document.getElementById(hash)) ? scrollTo(elm) : (list = document.getElementsByName(hash), 
                result = null, Array.prototype.some.call(list, function(element) {
                    if ("a" === nodeName_(element)) return result = element, !0;
                }), (elm = result) ? scrollTo(elm) : "top" === hash && scrollTo(null)) : scrollTo(null);
            }
            return autoScrollingEnabled && $rootScope.$watch(function() {
                return $location.hash();
            }, function(newVal, oldVal) {
                var action, win;
                newVal === oldVal && "" === newVal || (action = function() {
                    $rootScope.$evalAsync(scroll);
                }, "complete" === (win = win || window).document.readyState ? win.setTimeout(action) : jqLite(win).on("load", action));
            }), scroll;
        } ];
    }
    createInjector.$$annotate = function(fn, strictDi, name) {
        var $inject, last;
        if ("function" == typeof fn) {
            if (!($inject = fn.$inject)) {
                if ($inject = [], fn.length) {
                    if (strictDi) throw isString(name) && name || (name = fn.name || function(fn) {
                        var args = extractArgs(fn);
                        return args ? "function(" + (args[1] || "").replace(/[\s\r\n]+/, " ") + ")" : "fn";
                    }(fn)), $injectorMinErr("strictdi", "{0} is not using explicit annotation and cannot be invoked in strict mode", name);
                    forEach(extractArgs(fn)[1].split(FN_ARG_SPLIT), function(arg) {
                        arg.replace(FN_ARG, function(all, underscore, name) {
                            $inject.push(name);
                        });
                    });
                }
                fn.$inject = $inject;
            }
        } else isArray(fn) ? (assertArgFn(fn[last = fn.length - 1], "fn"), $inject = fn.slice(0, last)) : assertArgFn(fn, "fn", !0);
        return $inject;
    };
    var $animateMinErr = minErr("$animate"), ELEMENT_NODE = 1;
    function mergeClasses(a, b) {
        return a || b ? a ? b ? (isArray(a) && (a = a.join(" ")), isArray(b) && (b = b.join(" ")), 
        a + " " + b) : a : b : "";
    }
    function prepareAnimateOptions(options) {
        return isObject(options) ? options : {};
    }
    var $$CoreAnimateJsProvider = function() {
        this.$get = noop;
    }, $$CoreAnimateQueueProvider = function() {
        var postDigestQueue = new HashMap(), postDigestElements = [];
        this.$get = [ "$$AnimateRunner", "$rootScope", function($$AnimateRunner, $rootScope) {
            return {
                enabled: noop,
                on: noop,
                off: noop,
                pin: noop,
                push: function(element, event, options, domOperation) {
                    domOperation && domOperation(), (options = options || {}).from && element.css(options.from), 
                    options.to && element.css(options.to), (options.addClass || options.removeClass) && function(element, add, remove) {
                        var data = postDigestQueue.get(element) || {}, classesAdded = updateData(data, add, !0), classesRemoved = updateData(data, remove, !1);
                        (classesAdded || classesRemoved) && (postDigestQueue.put(element, data), postDigestElements.push(element), 
                        1 === postDigestElements.length && $rootScope.$$postDigest(handleCSSClassChanges));
                    }(element, options.addClass, options.removeClass);
                    var runner = new $$AnimateRunner();
                    return runner.complete(), runner;
                }
            };
            function updateData(data, classes, value) {
                var changed = !1;
                return classes && forEach(classes = isString(classes) ? classes.split(" ") : isArray(classes) ? classes : [], function(className) {
                    className && (changed = !0, data[className] = value);
                }), changed;
            }
            function handleCSSClassChanges() {
                forEach(postDigestElements, function(element) {
                    var data = postDigestQueue.get(element);
                    if (data) {
                        var existing = function(classes) {
                            isString(classes) && (classes = classes.split(" "));
                            var obj = createMap();
                            return forEach(classes, function(klass) {
                                klass.length && (obj[klass] = !0);
                            }), obj;
                        }(element.attr("class")), toAdd = "", toRemove = "";
                        forEach(data, function(status, className) {
                            status !== !!existing[className] && (status ? toAdd += (toAdd.length ? " " : "") + className : toRemove += (toRemove.length ? " " : "") + className);
                        }), forEach(element, function(elm) {
                            toAdd && jqLiteAddClass(elm, toAdd), toRemove && jqLiteRemoveClass(elm, toRemove);
                        }), postDigestQueue.remove(element);
                    }
                }), postDigestElements.length = 0;
            }
        } ];
    }, $AnimateProvider = [ "$provide", function($provide) {
        var provider = this;
        this.$$registeredAnimations = Object.create(null), this.register = function(name, factory) {
            if (name && "." !== name.charAt(0)) throw $animateMinErr("notcsel", "Expecting class selector starting with '.' got '{0}'.", name);
            var key = name + "-animation";
            provider.$$registeredAnimations[name.substr(1)] = key, $provide.factory(key, factory);
        }, this.classNameFilter = function(expression) {
            if (1 === arguments.length && (this.$$classNameFilter = expression instanceof RegExp ? expression : null, 
            this.$$classNameFilter && new RegExp("(\\s+|\\/)ng-animate(\\s+|\\/)").test(this.$$classNameFilter.toString()))) throw $animateMinErr("nongcls", '$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', "ng-animate");
            return this.$$classNameFilter;
        }, this.$get = [ "$$animateQueue", function($$animateQueue) {
            function domInsert(element, parentElement, afterElement) {
                if (afterElement) {
                    var afterNode = function(element) {
                        for (var i = 0; i < element.length; i++) {
                            var elm = element[i];
                            if (elm.nodeType === ELEMENT_NODE) return elm;
                        }
                    }(afterElement);
                    !afterNode || afterNode.parentNode || afterNode.previousElementSibling || (afterElement = null);
                }
                afterElement ? afterElement.after(element) : parentElement.prepend(element);
            }
            return {
                on: $$animateQueue.on,
                off: $$animateQueue.off,
                pin: $$animateQueue.pin,
                enabled: $$animateQueue.enabled,
                cancel: function(runner) {
                    runner.end && runner.end();
                },
                enter: function(element, parent, after, options) {
                    return parent = parent && jqLite(parent), after = after && jqLite(after), domInsert(element, parent = parent || after.parent(), after), 
                    $$animateQueue.push(element, "enter", prepareAnimateOptions(options));
                },
                move: function(element, parent, after, options) {
                    return parent = parent && jqLite(parent), after = after && jqLite(after), domInsert(element, parent = parent || after.parent(), after), 
                    $$animateQueue.push(element, "move", prepareAnimateOptions(options));
                },
                leave: function(element, options) {
                    return $$animateQueue.push(element, "leave", prepareAnimateOptions(options), function() {
                        element.remove();
                    });
                },
                addClass: function(element, className, options) {
                    return (options = prepareAnimateOptions(options)).addClass = mergeClasses(options.addclass, className), 
                    $$animateQueue.push(element, "addClass", options);
                },
                removeClass: function(element, className, options) {
                    return (options = prepareAnimateOptions(options)).removeClass = mergeClasses(options.removeClass, className), 
                    $$animateQueue.push(element, "removeClass", options);
                },
                setClass: function(element, add, remove, options) {
                    return (options = prepareAnimateOptions(options)).addClass = mergeClasses(options.addClass, add), 
                    options.removeClass = mergeClasses(options.removeClass, remove), $$animateQueue.push(element, "setClass", options);
                },
                animate: function(element, from, to, className, options) {
                    return (options = prepareAnimateOptions(options)).from = options.from ? extend(options.from, from) : from, 
                    options.to = options.to ? extend(options.to, to) : to, className = className || "ng-inline-animate", 
                    options.tempClasses = mergeClasses(options.tempClasses, className), $$animateQueue.push(element, "animate", options);
                }
            };
        } ];
    } ], $$AnimateAsyncRunFactoryProvider = function() {
        this.$get = [ "$$rAF", function($$rAF) {
            var waitQueue = [];
            function waitForTick(fn) {
                waitQueue.push(fn), 1 < waitQueue.length || $$rAF(function() {
                    for (var i = 0; i < waitQueue.length; i++) waitQueue[i]();
                    waitQueue = [];
                });
            }
            return function() {
                var passed = !1;
                return waitForTick(function() {
                    passed = !0;
                }), function(callback) {
                    passed ? callback() : waitForTick(callback);
                };
            };
        } ];
    }, $$AnimateRunnerFactoryProvider = function() {
        this.$get = [ "$q", "$sniffer", "$$animateAsyncRun", "$document", "$timeout", function($q, $sniffer, $$animateAsyncRun, $document, $timeout) {
            function AnimateRunner(host) {
                this.setHost(host);
                var rafTick = $$animateAsyncRun();
                this._doneCallbacks = [], this._tick = function(fn) {
                    var doc = $document[0];
                    doc && doc.hidden ? function(fn) {
                        $timeout(fn, 0, !1);
                    }(fn) : rafTick(fn);
                }, this._state = 0;
            }
            return AnimateRunner.chain = function(chain, callback) {
                var index = 0;
                !function next() {
                    if (index === chain.length) return void callback(!0);
                    chain[index](function(response) {
                        !1 !== response ? (index++, next()) : callback(!1);
                    });
                }();
            }, AnimateRunner.all = function(runners, callback) {
                var count = 0, status = !0;
                function onProgress(response) {
                    status = status && response, ++count === runners.length && callback(status);
                }
                forEach(runners, function(runner) {
                    runner.done(onProgress);
                });
            }, AnimateRunner.prototype = {
                setHost: function(host) {
                    this.host = host || {};
                },
                done: function(fn) {
                    2 === this._state ? fn() : this._doneCallbacks.push(fn);
                },
                progress: noop,
                getPromise: function() {
                    if (!this.promise) {
                        var self = this;
                        this.promise = $q(function(resolve, reject) {
                            self.done(function(status) {
                                !1 === status ? reject() : resolve();
                            });
                        });
                    }
                    return this.promise;
                },
                then: function(resolveHandler, rejectHandler) {
                    return this.getPromise().then(resolveHandler, rejectHandler);
                },
                catch: function(handler) {
                    return this.getPromise().catch(handler);
                },
                finally: function(handler) {
                    return this.getPromise().finally(handler);
                },
                pause: function() {
                    this.host.pause && this.host.pause();
                },
                resume: function() {
                    this.host.resume && this.host.resume();
                },
                end: function() {
                    this.host.end && this.host.end(), this._resolve(!0);
                },
                cancel: function() {
                    this.host.cancel && this.host.cancel(), this._resolve(!1);
                },
                complete: function(response) {
                    var self = this;
                    0 === self._state && (self._state = 1, self._tick(function() {
                        self._resolve(response);
                    }));
                },
                _resolve: function(response) {
                    2 !== this._state && (forEach(this._doneCallbacks, function(fn) {
                        fn(response);
                    }), this._doneCallbacks.length = 0, this._state = 2);
                }
            }, AnimateRunner;
        } ];
    }, $CoreAnimateCssProvider = function() {
        this.$get = [ "$$rAF", "$q", "$$AnimateRunner", function($$rAF, $q, $$AnimateRunner) {
            return function(element, initialOptions) {
                var options = initialOptions || {};
                options.$$prepared || (options = copy(options)), options.cleanupStyles && (options.from = options.to = null), 
                options.from && (element.css(options.from), options.from = null);
                var closed, runner = new $$AnimateRunner();
                return {
                    start: run,
                    end: run
                };
                function run() {
                    return $$rAF(function() {
                        !function() {
                            options.addClass && (element.addClass(options.addClass), options.addClass = null);
                            options.removeClass && (element.removeClass(options.removeClass), options.removeClass = null);
                            options.to && (element.css(options.to), options.to = null);
                        }(), closed || runner.complete(), closed = !0;
                    }), runner;
                }
            };
        } ];
    };
    function Browser(window, document, $log, $sniffer) {
        var self = this, location = window.location, history = window.history, setTimeout = window.setTimeout, clearTimeout = window.clearTimeout, pendingDeferIds = {};
        self.isMock = !1;
        var outstandingRequestCount = 0, outstandingRequestCallbacks = [];
        function completeOutstandingRequest(fn) {
            try {
                fn.apply(null, sliceArgs(arguments, 1));
            } finally {
                if (0 === --outstandingRequestCount) for (;outstandingRequestCallbacks.length; ) try {
                    outstandingRequestCallbacks.pop()();
                } catch (e) {
                    $log.error(e);
                }
            }
        }
        self.$$completeOutstandingRequest = completeOutstandingRequest, self.$$incOutstandingRequestCount = function() {
            outstandingRequestCount++;
        }, self.notifyWhenNoOutstandingRequests = function(callback) {
            0 === outstandingRequestCount ? callback() : outstandingRequestCallbacks.push(callback);
        };
        var cachedState, lastHistoryState, lastBrowserUrl = location.href, baseElement = document.find("base"), pendingLocation = null, getCurrentState = $sniffer.history ? function() {
            try {
                return history.state;
            } catch (e) {}
        } : noop;
        cacheState(), lastHistoryState = cachedState, self.url = function(url, replace, state) {
            if (isUndefined(state) && (state = null), location !== window.location && (location = window.location), 
            history !== window.history && (history = window.history), url) {
                var sameState = lastHistoryState === state;
                if (lastBrowserUrl === url && (!$sniffer.history || sameState)) return self;
                var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url);
                return lastBrowserUrl = url, lastHistoryState = state, !$sniffer.history || sameBase && sameState ? (sameBase || (pendingLocation = url), 
                replace ? location.replace(url) : sameBase ? location.hash = function(url) {
                    var index = url.indexOf("#");
                    return -1 === index ? "" : url.substr(index);
                }(url) : location.href = url, location.href !== url && (pendingLocation = url)) : (history[replace ? "replaceState" : "pushState"](state, "", url), 
                cacheState(), lastHistoryState = cachedState), pendingLocation && (pendingLocation = url), 
                self;
            }
            return pendingLocation || location.href.replace(/%27/g, "'");
        }, self.state = function() {
            return cachedState;
        };
        var urlChangeListeners = [], urlChangeInit = !1;
        function cacheStateAndFireUrlChange() {
            pendingLocation = null, cacheState(), fireUrlChange();
        }
        var lastCachedState = null;
        function cacheState() {
            equals(cachedState = isUndefined(cachedState = getCurrentState()) ? null : cachedState, lastCachedState) && (cachedState = lastCachedState), 
            lastCachedState = cachedState;
        }
        function fireUrlChange() {
            lastBrowserUrl === self.url() && lastHistoryState === cachedState || (lastBrowserUrl = self.url(), 
            lastHistoryState = cachedState, forEach(urlChangeListeners, function(listener) {
                listener(self.url(), cachedState);
            }));
        }
        self.onUrlChange = function(callback) {
            return urlChangeInit || ($sniffer.history && jqLite(window).on("popstate", cacheStateAndFireUrlChange), 
            jqLite(window).on("hashchange", cacheStateAndFireUrlChange), urlChangeInit = !0), 
            urlChangeListeners.push(callback), callback;
        }, self.$$applicationDestroyed = function() {
            jqLite(window).off("hashchange popstate", cacheStateAndFireUrlChange);
        }, self.$$checkUrlChange = fireUrlChange, self.baseHref = function() {
            var href = baseElement.attr("href");
            return href ? href.replace(/^(https?\:)?\/\/[^\/]*/, "") : "";
        }, self.defer = function(fn, delay) {
            var timeoutId;
            return outstandingRequestCount++, timeoutId = setTimeout(function() {
                delete pendingDeferIds[timeoutId], completeOutstandingRequest(fn);
            }, delay || 0), pendingDeferIds[timeoutId] = !0, timeoutId;
        }, self.defer.cancel = function(deferId) {
            return !!pendingDeferIds[deferId] && (delete pendingDeferIds[deferId], clearTimeout(deferId), 
            completeOutstandingRequest(noop), !0);
        };
    }
    function $BrowserProvider() {
        this.$get = [ "$window", "$log", "$sniffer", "$document", function($window, $log, $sniffer, $document) {
            return new Browser($window, $document, $log, $sniffer);
        } ];
    }
    function $CacheFactoryProvider() {
        this.$get = function() {
            var caches = {};
            function cacheFactory(cacheId, options) {
                if (cacheId in caches) throw minErr("$cacheFactory")("iid", "CacheId '{0}' is already taken!", cacheId);
                var size = 0, stats = extend({}, options, {
                    id: cacheId
                }), data = createMap(), capacity = options && options.capacity || Number.MAX_VALUE, lruHash = createMap(), freshEnd = null, staleEnd = null;
                return caches[cacheId] = {
                    put: function(key, value) {
                        if (!isUndefined(value)) {
                            if (capacity < Number.MAX_VALUE) refresh(lruHash[key] || (lruHash[key] = {
                                key: key
                            }));
                            return key in data || size++, data[key] = value, capacity < size && this.remove(staleEnd.key), 
                            value;
                        }
                    },
                    get: function(key) {
                        if (capacity < Number.MAX_VALUE) {
                            var lruEntry = lruHash[key];
                            if (!lruEntry) return;
                            refresh(lruEntry);
                        }
                        return data[key];
                    },
                    remove: function(key) {
                        if (capacity < Number.MAX_VALUE) {
                            var lruEntry = lruHash[key];
                            if (!lruEntry) return;
                            lruEntry == freshEnd && (freshEnd = lruEntry.p), lruEntry == staleEnd && (staleEnd = lruEntry.n), 
                            link(lruEntry.n, lruEntry.p), delete lruHash[key];
                        }
                        key in data && (delete data[key], size--);
                    },
                    removeAll: function() {
                        data = createMap(), size = 0, lruHash = createMap(), freshEnd = staleEnd = null;
                    },
                    destroy: function() {
                        lruHash = stats = data = null, delete caches[cacheId];
                    },
                    info: function() {
                        return extend({}, stats, {
                            size: size
                        });
                    }
                };
                function refresh(entry) {
                    entry != freshEnd && (staleEnd ? staleEnd == entry && (staleEnd = entry.n) : staleEnd = entry, 
                    link(entry.n, entry.p), link(entry, freshEnd), (freshEnd = entry).n = null);
                }
                function link(nextEntry, prevEntry) {
                    nextEntry != prevEntry && (nextEntry && (nextEntry.p = prevEntry), prevEntry && (prevEntry.n = nextEntry));
                }
            }
            return cacheFactory.info = function() {
                var info = {};
                return forEach(caches, function(cache, cacheId) {
                    info[cacheId] = cache.info();
                }), info;
            }, cacheFactory.get = function(cacheId) {
                return caches[cacheId];
            }, cacheFactory;
        };
    }
    function $TemplateCacheProvider() {
        this.$get = [ "$cacheFactory", function($cacheFactory) {
            return $cacheFactory("templates");
        } ];
    }
    var $compileMinErr = minErr("$compile");
    var _UNINITIALIZED_VALUE = new function() {}();
    function $CompileProvider($provide, $$sanitizeUriProvider) {
        var hasDirectives = {}, Suffix = "Directive", COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/, CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?:\:([^;]+))?;?)/, ALL_OR_NOTHING_ATTRS = function(str) {
            var i, obj = {}, items = str.split(",");
            for (i = 0; i < items.length; i++) obj[items[i]] = !0;
            return obj;
        }("ngSrc,ngSrcset,src,srcset"), REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/, EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/, bindingCache = createMap();
        function parseIsolateBindings(scope, directiveName, isController) {
            var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/, bindings = createMap();
            return forEach(scope, function(definition, scopeName) {
                if (definition in bindingCache) bindings[scopeName] = bindingCache[definition]; else {
                    var match = definition.match(LOCAL_REGEXP);
                    if (!match) throw $compileMinErr("iscp", "Invalid {3} for directive '{0}'. Definition: {... {1}: '{2}' ...}", directiveName, scopeName, definition, isController ? "controller bindings definition" : "isolate scope definition");
                    bindings[scopeName] = {
                        mode: match[1][0],
                        collection: "*" === match[2],
                        optional: "?" === match[3],
                        attrName: match[4] || scopeName
                    }, match[4] && (bindingCache[definition] = bindings[scopeName]);
                }
            }), bindings;
        }
        function parseDirectiveBindings(directive, directiveName) {
            var bindings = {
                isolateScope: null,
                bindToController: null
            };
            if (isObject(directive.scope) && (!0 === directive.bindToController ? (bindings.bindToController = parseIsolateBindings(directive.scope, directiveName, !0), 
            bindings.isolateScope = {}) : bindings.isolateScope = parseIsolateBindings(directive.scope, directiveName, !1)), 
            isObject(directive.bindToController) && (bindings.bindToController = parseIsolateBindings(directive.bindToController, directiveName, !0)), 
            isObject(bindings.bindToController)) {
                var controller = directive.controller, controllerAs = directive.controllerAs;
                if (!controller) throw $compileMinErr("noctrl", "Cannot bind to controller without directive '{0}'s controller.", directiveName);
                if (!identifierForController(controller, controllerAs)) throw $compileMinErr("noident", "Cannot bind to controller without identifier for directive '{0}'.", directiveName);
            }
            return bindings;
        }
        this.directive = function registerDirective(name, directiveFactory) {
            return assertNotHasOwnProperty(name, "directive"), isString(name) ? (!function(name) {
                var letter = name.charAt(0);
                if (!letter || letter !== lowercase(letter)) throw $compileMinErr("baddir", "Directive/Component name '{0}' is invalid. The first character must be a lowercase letter", name);
                if (name !== name.trim()) throw $compileMinErr("baddir", "Directive/Component name '{0}' is invalid. The name should not contain leading or trailing whitespaces", name);
            }(name), assertArg(directiveFactory, "directiveFactory"), hasDirectives.hasOwnProperty(name) || (hasDirectives[name] = [], 
            $provide.factory(name + Suffix, [ "$injector", "$exceptionHandler", function($injector, $exceptionHandler) {
                var directives = [];
                return forEach(hasDirectives[name], function(directiveFactory, index) {
                    try {
                        var directive = $injector.invoke(directiveFactory);
                        isFunction(directive) ? directive = {
                            compile: valueFn(directive)
                        } : !directive.compile && directive.link && (directive.compile = valueFn(directive.link)), 
                        directive.priority = directive.priority || 0, directive.index = index, directive.name = directive.name || name, 
                        directive.require = function(directive) {
                            var require = directive.require || directive.controller && directive.name;
                            return !isArray(require) && isObject(require) && forEach(require, function(value, key) {
                                var match = value.match(REQUIRE_PREFIX_REGEXP);
                                value.substring(match[0].length) || (require[key] = match[0] + key);
                            }), require;
                        }(directive), directive.restrict = directive.restrict || "EA", directive.$$moduleName = directiveFactory.$$moduleName, 
                        directives.push(directive);
                    } catch (e) {
                        $exceptionHandler(e);
                    }
                }), directives;
            } ])), hasDirectives[name].push(directiveFactory)) : forEach(name, reverseParams(registerDirective)), 
            this;
        }, this.component = function(name, options) {
            var controller = options.controller || function() {};
            function factory($injector) {
                function makeInjectable(fn) {
                    return isFunction(fn) || isArray(fn) ? function(tElement, tAttrs) {
                        return $injector.invoke(fn, this, {
                            $element: tElement,
                            $attrs: tAttrs
                        });
                    } : fn;
                }
                var template = options.template || options.templateUrl ? options.template : "", ddo = {
                    controller: controller,
                    controllerAs: identifierForController(options.controller) || options.controllerAs || "$ctrl",
                    template: makeInjectable(template),
                    templateUrl: makeInjectable(options.templateUrl),
                    transclude: options.transclude,
                    scope: {},
                    bindToController: options.bindings || {},
                    restrict: "E",
                    require: options.require
                };
                return forEach(options, function(val, key) {
                    "$" === key.charAt(0) && (ddo[key] = val);
                }), ddo;
            }
            return forEach(options, function(val, key) {
                "$" === key.charAt(0) && (factory[key] = val, isFunction(controller) && (controller[key] = val));
            }), factory.$inject = [ "$injector" ], this.directive(name, factory);
        }, this.aHrefSanitizationWhitelist = function(regexp) {
            return isDefined(regexp) ? ($$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp), 
            this) : $$sanitizeUriProvider.aHrefSanitizationWhitelist();
        }, this.imgSrcSanitizationWhitelist = function(regexp) {
            return isDefined(regexp) ? ($$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp), 
            this) : $$sanitizeUriProvider.imgSrcSanitizationWhitelist();
        };
        var debugInfoEnabled = !0;
        this.debugInfoEnabled = function(enabled) {
            return isDefined(enabled) ? (debugInfoEnabled = enabled, this) : debugInfoEnabled;
        };
        var TTL = 10;
        this.onChangesTtl = function(value) {
            return arguments.length ? (TTL = value, this) : TTL;
        }, this.$get = [ "$injector", "$interpolate", "$exceptionHandler", "$templateRequest", "$parse", "$controller", "$rootScope", "$sce", "$animate", "$$sanitizeUri", function($injector, $interpolate, $exceptionHandler, $templateRequest, $parse, $controller, $rootScope, $sce, $animate, $$sanitizeUri) {
            var onChangesQueue, SIMPLE_ATTR_NAME = /^\w/, specialAttrHolder = window.document.createElement("div"), onChangesTtl = TTL;
            function flushOnChangesQueue() {
                try {
                    if (!--onChangesTtl) throw onChangesQueue = void 0, $compileMinErr("infchng", "{0} $onChanges() iterations reached. Aborting!\n", TTL);
                    $rootScope.$apply(function() {
                        for (var errors = [], i = 0, ii = onChangesQueue.length; i < ii; ++i) try {
                            onChangesQueue[i]();
                        } catch (e) {
                            errors.push(e);
                        }
                        if (onChangesQueue = void 0, errors.length) throw errors;
                    });
                } finally {
                    onChangesTtl++;
                }
            }
            function Attributes(element, attributesToCopy) {
                if (attributesToCopy) {
                    var i, l, key, keys = Object.keys(attributesToCopy);
                    for (i = 0, l = keys.length; i < l; i++) this[key = keys[i]] = attributesToCopy[key];
                } else this.$attr = {};
                this.$$element = element;
            }
            function safeAddClass($element, className) {
                try {
                    $element.addClass(className);
                } catch (e) {}
            }
            Attributes.prototype = {
                $normalize: directiveNormalize,
                $addClass: function(classVal) {
                    classVal && 0 < classVal.length && $animate.addClass(this.$$element, classVal);
                },
                $removeClass: function(classVal) {
                    classVal && 0 < classVal.length && $animate.removeClass(this.$$element, classVal);
                },
                $updateClass: function(newClasses, oldClasses) {
                    var toAdd = tokenDifference(newClasses, oldClasses);
                    toAdd && toAdd.length && $animate.addClass(this.$$element, toAdd);
                    var toRemove = tokenDifference(oldClasses, newClasses);
                    toRemove && toRemove.length && $animate.removeClass(this.$$element, toRemove);
                },
                $set: function(key, value, writeAttr, attrName) {
                    var nodeName, booleanKey = getBooleanAttrName(this.$$element[0], key), aliasedKey = ALIASED_ATTR[key], observer = key;
                    if (booleanKey ? (this.$$element.prop(key, value), attrName = booleanKey) : aliasedKey && (this[aliasedKey] = value, 
                    observer = aliasedKey), this[key] = value, attrName ? this.$attr[key] = attrName : (attrName = this.$attr[key]) || (this.$attr[key] = attrName = snake_case(key, "-")), 
                    "a" === (nodeName = nodeName_(this.$$element)) && ("href" === key || "xlinkHref" === key) || "img" === nodeName && "src" === key) this[key] = value = $$sanitizeUri(value, "src" === key); else if ("img" === nodeName && "srcset" === key && isDefined(value)) {
                        for (var result = "", trimmedSrcset = trim(value), pattern = /\s/.test(trimmedSrcset) ? /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/ : /(,)/, rawUris = trimmedSrcset.split(pattern), nbrUrisWith2parts = Math.floor(rawUris.length / 2), i = 0; i < nbrUrisWith2parts; i++) {
                            var innerIdx = 2 * i;
                            result += $$sanitizeUri(trim(rawUris[innerIdx]), !0), result += " " + trim(rawUris[innerIdx + 1]);
                        }
                        var lastTuple = trim(rawUris[2 * i]).split(/\s/);
                        result += $$sanitizeUri(trim(lastTuple[0]), !0), 2 === lastTuple.length && (result += " " + trim(lastTuple[1])), 
                        this[key] = value = result;
                    }
                    !1 !== writeAttr && (null === value || isUndefined(value) ? this.$$element.removeAttr(attrName) : SIMPLE_ATTR_NAME.test(attrName) ? this.$$element.attr(attrName, value) : function(element, attrName, value) {
                        specialAttrHolder.innerHTML = "<span " + attrName + ">";
                        var attributes = specialAttrHolder.firstChild.attributes, attribute = attributes[0];
                        attributes.removeNamedItem(attribute.name), attribute.value = value, element.attributes.setNamedItem(attribute);
                    }(this.$$element[0], attrName, value));
                    var $$observers = this.$$observers;
                    $$observers && forEach($$observers[observer], function(fn) {
                        try {
                            fn(value);
                        } catch (e) {
                            $exceptionHandler(e);
                        }
                    });
                },
                $observe: function(key, fn) {
                    var attrs = this, $$observers = attrs.$$observers || (attrs.$$observers = createMap()), listeners = $$observers[key] || ($$observers[key] = []);
                    return listeners.push(fn), $rootScope.$evalAsync(function() {
                        listeners.$$inter || !attrs.hasOwnProperty(key) || isUndefined(attrs[key]) || fn(attrs[key]);
                    }), function() {
                        arrayRemove(listeners, fn);
                    };
                }
            };
            var startSymbol = $interpolate.startSymbol(), endSymbol = $interpolate.endSymbol(), denormalizeTemplate = "{{" == startSymbol && "}}" == endSymbol ? identity : function(template) {
                return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
            }, NG_ATTR_BINDING = /^ngAttr[A-Z]/, MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;
            return compile.$$addBindingInfo = debugInfoEnabled ? function($element, binding) {
                var bindings = $element.data("$binding") || [];
                isArray(binding) ? bindings = bindings.concat(binding) : bindings.push(binding), 
                $element.data("$binding", bindings);
            } : noop, compile.$$addBindingClass = debugInfoEnabled ? function($element) {
                safeAddClass($element, "ng-binding");
            } : noop, compile.$$addScopeInfo = debugInfoEnabled ? function($element, scope, isolated, noTemplate) {
                var dataName = isolated ? noTemplate ? "$isolateScopeNoTemplate" : "$isolateScope" : "$scope";
                $element.data(dataName, scope);
            } : noop, compile.$$addScopeClass = debugInfoEnabled ? function($element, isolated) {
                safeAddClass($element, isolated ? "ng-isolate-scope" : "ng-scope");
            } : noop, compile.$$createComment = function(directiveName, comment) {
                var content = "";
                return debugInfoEnabled && (content = " " + (directiveName || "") + ": ", comment && (content += comment + " ")), 
                window.document.createComment(content);
            }, compile;
            function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {
                $compileNodes instanceof jqLite || ($compileNodes = jqLite($compileNodes));
                for (var NOT_EMPTY = /\S+/, i = 0, len = $compileNodes.length; i < len; i++) {
                    var domNode = $compileNodes[i];
                    domNode.nodeType === NODE_TYPE_TEXT && domNode.nodeValue.match(NOT_EMPTY) && jqLiteWrapNode(domNode, $compileNodes[i] = window.document.createElement("span"));
                }
                var compositeLinkFn = compileNodes($compileNodes, transcludeFn, $compileNodes, maxPriority, ignoreDirective, previousCompileContext);
                compile.$$addScopeClass($compileNodes);
                var namespace = null;
                return function(scope, cloneConnectFn, options) {
                    assertArg(scope, "scope"), previousCompileContext && previousCompileContext.needsNewScope && (scope = scope.$parent.$new());
                    var parentElement, node, $linkNode, parentBoundTranscludeFn = (options = options || {}).parentBoundTranscludeFn, transcludeControllers = options.transcludeControllers, futureParentElement = options.futureParentElement;
                    if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude && (parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude), 
                    namespace || (node = (parentElement = futureParentElement) && parentElement[0], 
                    namespace = node && "foreignobject" !== nodeName_(node) && toString.call(node).match(/SVG/) ? "svg" : "html"), 
                    $linkNode = "html" !== namespace ? jqLite(wrapTemplate(namespace, jqLite("<div>").append($compileNodes).html())) : cloneConnectFn ? JQLitePrototype.clone.call($compileNodes) : $compileNodes, 
                    transcludeControllers) for (var controllerName in transcludeControllers) $linkNode.data("$" + controllerName + "Controller", transcludeControllers[controllerName].instance);
                    return compile.$$addScopeInfo($linkNode, scope), cloneConnectFn && cloneConnectFn($linkNode, scope), 
                    compositeLinkFn && compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn), 
                    $linkNode;
                };
            }
            function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective, previousCompileContext) {
                for (var attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound, linkFns = [], i = 0; i < nodeList.length; i++) attrs = new Attributes(), 
                (nodeLinkFn = (directives = collectDirectives(nodeList[i], [], attrs, 0 === i ? maxPriority : void 0, ignoreDirective)).length ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement, null, [], [], previousCompileContext) : null) && nodeLinkFn.scope && compile.$$addScopeClass(attrs.$$element), 
                childLinkFn = nodeLinkFn && nodeLinkFn.terminal || !(childNodes = nodeList[i].childNodes) || !childNodes.length ? null : compileNodes(childNodes, nodeLinkFn ? (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement) && nodeLinkFn.transclude : transcludeFn), 
                (nodeLinkFn || childLinkFn) && (linkFns.push(i, nodeLinkFn, childLinkFn), linkFnFound = !0, 
                nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn), previousCompileContext = null;
                return linkFnFound ? function(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
                    var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn, stableNodeList;
                    if (nodeLinkFnFound) {
                        var nodeListLength = nodeList.length;
                        for (stableNodeList = new Array(nodeListLength), i = 0; i < linkFns.length; i += 3) idx = linkFns[i], 
                        stableNodeList[idx] = nodeList[idx];
                    } else stableNodeList = nodeList;
                    for (i = 0, ii = linkFns.length; i < ii; ) node = stableNodeList[linkFns[i++]], 
                    nodeLinkFn = linkFns[i++], childLinkFn = linkFns[i++], nodeLinkFn ? (nodeLinkFn.scope ? (childScope = scope.$new(), 
                    compile.$$addScopeInfo(jqLite(node), childScope)) : childScope = scope, childBoundTranscludeFn = nodeLinkFn.transcludeOnThisElement ? createBoundTranscludeFn(scope, nodeLinkFn.transclude, parentBoundTranscludeFn) : !nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn ? parentBoundTranscludeFn : !parentBoundTranscludeFn && transcludeFn ? createBoundTranscludeFn(scope, transcludeFn) : null, 
                    nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn)) : childLinkFn && childLinkFn(scope, node.childNodes, void 0, parentBoundTranscludeFn);
                } : null;
            }
            function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {
                function boundTranscludeFn(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {
                    return transcludedScope || ((transcludedScope = scope.$new(!1, containingScope)).$$transcluded = !0), 
                    transcludeFn(transcludedScope, cloneFn, {
                        parentBoundTranscludeFn: previousBoundTranscludeFn,
                        transcludeControllers: controllers,
                        futureParentElement: futureParentElement
                    });
                }
                var boundSlots = boundTranscludeFn.$$slots = createMap();
                for (var slotName in transcludeFn.$$slots) transcludeFn.$$slots[slotName] ? boundSlots[slotName] = createBoundTranscludeFn(scope, transcludeFn.$$slots[slotName], previousBoundTranscludeFn) : boundSlots[slotName] = null;
                return boundTranscludeFn;
            }
            function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
                var match, className, nodeType = node.nodeType, attrsMap = attrs.$attr;
                switch (nodeType) {
                  case NODE_TYPE_ELEMENT:
                    addDirective(directives, directiveNormalize(nodeName_(node)), "E", maxPriority, ignoreDirective);
                    for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes, j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {
                        var attrStartName = !1, attrEndName = !1;
                        name = (attr = nAttrs[j]).name, value = trim(attr.value), ngAttrName = directiveNormalize(name), 
                        (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) && (name = name.replace(PREFIX_REGEXP, "").substr(8).replace(/_(.)/g, function(match, letter) {
                            return letter.toUpperCase();
                        }));
                        var multiElementMatch = ngAttrName.match(MULTI_ELEMENT_DIR_RE);
                        multiElementMatch && directiveIsMultiElement(multiElementMatch[1]) && (attrEndName = (attrStartName = name).substr(0, name.length - 5) + "end", 
                        name = name.substr(0, name.length - 6)), attrsMap[nName = directiveNormalize(name.toLowerCase())] = name, 
                        !isNgAttr && attrs.hasOwnProperty(nName) || (attrs[nName] = value, getBooleanAttrName(node, nName) && (attrs[nName] = !0)), 
                        addAttrInterpolateDirective(node, directives, value, nName, isNgAttr), addDirective(directives, nName, "A", maxPriority, ignoreDirective, attrStartName, attrEndName);
                    }
                    if (isObject(className = node.className) && (className = className.animVal), isString(className) && "" !== className) for (;match = CLASS_DIRECTIVE_REGEXP.exec(className); ) addDirective(directives, nName = directiveNormalize(match[2]), "C", maxPriority, ignoreDirective) && (attrs[nName] = trim(match[3])), 
                    className = className.substr(match.index + match[0].length);
                    break;

                  case NODE_TYPE_TEXT:
                    if (11 === msie) for (;node.parentNode && node.nextSibling && node.nextSibling.nodeType === NODE_TYPE_TEXT; ) node.nodeValue = node.nodeValue + node.nextSibling.nodeValue, 
                    node.parentNode.removeChild(node.nextSibling);
                    !function(directives, text) {
                        var interpolateFn = $interpolate(text, !0);
                        interpolateFn && directives.push({
                            priority: 0,
                            compile: function(templateNode) {
                                var templateNodeParent = templateNode.parent(), hasCompileParent = !!templateNodeParent.length;
                                return hasCompileParent && compile.$$addBindingClass(templateNodeParent), function(scope, node) {
                                    var parent = node.parent();
                                    hasCompileParent || compile.$$addBindingClass(parent), compile.$$addBindingInfo(parent, interpolateFn.expressions), 
                                    scope.$watch(interpolateFn, function(value) {
                                        node[0].nodeValue = value;
                                    });
                                };
                            }
                        });
                    }(directives, node.nodeValue);
                    break;

                  case NODE_TYPE_COMMENT:
                    !function(node, directives, attrs, maxPriority, ignoreDirective) {
                        try {
                            var match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
                            if (match) {
                                var nName = directiveNormalize(match[1]);
                                addDirective(directives, nName, "M", maxPriority, ignoreDirective) && (attrs[nName] = trim(match[2]));
                            }
                        } catch (e) {}
                    }(node, directives, attrs, maxPriority, ignoreDirective);
                }
                return directives.sort(byPriority), directives;
            }
            function groupScan(node, attrStart, attrEnd) {
                var nodes = [], depth = 0;
                if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) do {
                    if (!node) throw $compileMinErr("uterdir", "Unterminated attribute, found '{0}' but no matching '{1}' found.", attrStart, attrEnd);
                    node.nodeType == NODE_TYPE_ELEMENT && (node.hasAttribute(attrStart) && depth++, 
                    node.hasAttribute(attrEnd) && depth--), nodes.push(node), node = node.nextSibling;
                } while (0 < depth); else nodes.push(node);
                return jqLite(nodes);
            }
            function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {
                return function(scope, element, attrs, controllers, transcludeFn) {
                    return element = groupScan(element[0], attrStart, attrEnd), linkFn(scope, element, attrs, controllers, transcludeFn);
                };
            }
            function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {
                var compiled;
                return eager ? compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) : function() {
                    return compiled || (compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext), 
                    $compileNodes = transcludeFn = previousCompileContext = null), compiled.apply(this, arguments);
                };
            }
            function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn, jqCollection, originalReplaceDirective, preLinkFns, postLinkFns, previousCompileContext) {
                previousCompileContext = previousCompileContext || {};
                for (var directive, directiveName, $template, linkFn, directiveValue, terminalPriority = -Number.MAX_VALUE, newScopeDirective = previousCompileContext.newScopeDirective, controllerDirectives = previousCompileContext.controllerDirectives, newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective, templateDirective = previousCompileContext.templateDirective, nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective, hasTranscludeDirective = !1, hasTemplate = !1, hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective, $compileNode = templateAttrs.$$element = jqLite(compileNode), replaceDirective = originalReplaceDirective, childTranscludeFn = transcludeFn, didScanForMultipleTransclusion = !1, mightHaveMultipleTransclusionError = !1, i = 0, ii = directives.length; i < ii; i++) {
                    var attrStart = (directive = directives[i]).$$start, attrEnd = directive.$$end;
                    if (attrStart && ($compileNode = groupScan(compileNode, attrStart, attrEnd)), $template = void 0, 
                    terminalPriority > directive.priority) break;
                    if ((directiveValue = directive.scope) && (directive.templateUrl || (isObject(directiveValue) ? (assertNoDuplicate("new/isolated scope", newIsolateScopeDirective || newScopeDirective, directive, $compileNode), 
                    newIsolateScopeDirective = directive) : assertNoDuplicate("new/isolated scope", newIsolateScopeDirective, directive, $compileNode)), 
                    newScopeDirective = newScopeDirective || directive), directiveName = directive.name, 
                    !didScanForMultipleTransclusion && (directive.replace && (directive.templateUrl || directive.template) || directive.transclude && !directive.$$tlb)) {
                        for (var candidateDirective, scanningIndex = i + 1; candidateDirective = directives[scanningIndex++]; ) if (candidateDirective.transclude && !candidateDirective.$$tlb || candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template)) {
                            mightHaveMultipleTransclusionError = !0;
                            break;
                        }
                        didScanForMultipleTransclusion = !0;
                    }
                    if (!directive.templateUrl && directive.controller && (directiveValue = directive.controller, 
                    controllerDirectives = controllerDirectives || createMap(), assertNoDuplicate("'" + directiveName + "' controller", controllerDirectives[directiveName], directive, $compileNode), 
                    controllerDirectives[directiveName] = directive), directiveValue = directive.transclude) if (hasTranscludeDirective = !0, 
                    directive.$$tlb || (assertNoDuplicate("transclusion", nonTlbTranscludeDirective, directive, $compileNode), 
                    nonTlbTranscludeDirective = directive), "element" == directiveValue) hasElementTranscludeDirective = !0, 
                    terminalPriority = directive.priority, $template = $compileNode, $compileNode = templateAttrs.$$element = jqLite(compile.$$createComment(directiveName, templateAttrs[directiveName])), 
                    compileNode = $compileNode[0], replaceWith(jqCollection, sliceArgs($template), compileNode), 
                    $template[0].$$parentNode = $template[0].parentNode, childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, terminalPriority, replaceDirective && replaceDirective.name, {
                        nonTlbTranscludeDirective: nonTlbTranscludeDirective
                    }); else {
                        var slots = createMap();
                        if ($template = jqLite(jqLiteClone(compileNode)).contents(), isObject(directiveValue)) {
                            $template = [];
                            var slotMap = createMap(), filledSlots = createMap();
                            for (var slotName in forEach(directiveValue, function(elementSelector, slotName) {
                                var optional = "?" === elementSelector.charAt(0);
                                elementSelector = optional ? elementSelector.substring(1) : elementSelector, slotMap[elementSelector] = slotName, 
                                slots[slotName] = null, filledSlots[slotName] = optional;
                            }), forEach($compileNode.contents(), function(node) {
                                var slotName = slotMap[directiveNormalize(nodeName_(node))];
                                slotName ? (filledSlots[slotName] = !0, slots[slotName] = slots[slotName] || [], 
                                slots[slotName].push(node)) : $template.push(node);
                            }), forEach(filledSlots, function(filled, slotName) {
                                if (!filled) throw $compileMinErr("reqslot", "Required transclusion slot `{0}` was not filled.", slotName);
                            }), slots) slots[slotName] && (slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slots[slotName], transcludeFn));
                        }
                        $compileNode.empty(), (childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, void 0, void 0, {
                            needsNewScope: directive.$$isolateScope || directive.$$newScope
                        })).$$slots = slots;
                    }
                    if (directive.template) if (hasTemplate = !0, assertNoDuplicate("template", templateDirective, directive, $compileNode), 
                    directiveValue = isFunction((templateDirective = directive).template) ? directive.template($compileNode, templateAttrs) : directive.template, 
                    directiveValue = denormalizeTemplate(directiveValue), directive.replace) {
                        if (replaceDirective = directive, $template = jqLiteIsTextNode(directiveValue) ? [] : removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue))), 
                        compileNode = $template[0], 1 != $template.length || compileNode.nodeType !== NODE_TYPE_ELEMENT) throw $compileMinErr("tplrt", "Template for directive '{0}' must have exactly one root element. {1}", directiveName, "");
                        replaceWith(jqCollection, $compileNode, compileNode);
                        var newTemplateAttrs = {
                            $attr: {}
                        }, templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs), unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));
                        (newIsolateScopeDirective || newScopeDirective) && markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective), 
                        directives = directives.concat(templateDirectives).concat(unprocessedDirectives), 
                        mergeTemplateAttributes(templateAttrs, newTemplateAttrs), ii = directives.length;
                    } else $compileNode.html(directiveValue);
                    if (directive.templateUrl) hasTemplate = !0, assertNoDuplicate("template", templateDirective, directive, $compileNode), 
                    (templateDirective = directive).replace && (replaceDirective = directive), nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode, templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {
                        controllerDirectives: controllerDirectives,
                        newScopeDirective: newScopeDirective !== directive && newScopeDirective,
                        newIsolateScopeDirective: newIsolateScopeDirective,
                        templateDirective: templateDirective,
                        nonTlbTranscludeDirective: nonTlbTranscludeDirective
                    }), ii = directives.length; else if (directive.compile) try {
                        linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);
                        var context = directive.$$originalDirective || directive;
                        isFunction(linkFn) ? addLinkFns(null, bind(context, linkFn), attrStart, attrEnd) : linkFn && addLinkFns(bind(context, linkFn.pre), bind(context, linkFn.post), attrStart, attrEnd);
                    } catch (e) {
                        $exceptionHandler(e, startingTag($compileNode));
                    }
                    directive.terminal && (nodeLinkFn.terminal = !0, terminalPriority = Math.max(terminalPriority, directive.priority));
                }
                return nodeLinkFn.scope = newScopeDirective && !0 === newScopeDirective.scope, nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective, 
                nodeLinkFn.templateOnThisElement = hasTemplate, nodeLinkFn.transclude = childTranscludeFn, 
                previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective, 
                nodeLinkFn;
                function addLinkFns(pre, post, attrStart, attrEnd) {
                    pre && (attrStart && (pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd)), 
                    pre.require = directive.require, pre.directiveName = directiveName, (newIsolateScopeDirective === directive || directive.$$isolateScope) && (pre = cloneAndAnnotateFn(pre, {
                        isolateScope: !0
                    })), preLinkFns.push(pre)), post && (attrStart && (post = groupElementsLinkFnWrapper(post, attrStart, attrEnd)), 
                    post.require = directive.require, post.directiveName = directiveName, (newIsolateScopeDirective === directive || directive.$$isolateScope) && (post = cloneAndAnnotateFn(post, {
                        isolateScope: !0
                    })), postLinkFns.push(post));
                }
                function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
                    var i, ii, linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element, attrs, scopeBindingInfo;
                    for (var name in compileNode === linkNode ? $element = (attrs = templateAttrs).$$element : attrs = new Attributes($element = jqLite(linkNode), templateAttrs), 
                    controllerScope = scope, newIsolateScopeDirective ? isolateScope = scope.$new(!0) : newScopeDirective && (controllerScope = scope.$parent), 
                    boundTranscludeFn && ((transcludeFn = function(scope, cloneAttachFn, futureParentElement, slotName) {
                        var transcludeControllers;
                        isScope(scope) || (slotName = futureParentElement, futureParentElement = cloneAttachFn, 
                        cloneAttachFn = scope, scope = void 0);
                        hasElementTranscludeDirective && (transcludeControllers = elementControllers);
                        futureParentElement || (futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element);
                        {
                            if (!slotName) return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);
                            var slotTranscludeFn = boundTranscludeFn.$$slots[slotName];
                            if (slotTranscludeFn) return slotTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);
                            if (isUndefined(slotTranscludeFn)) throw $compileMinErr("noslot", 'No parent directive that requires a transclusion with slot name "{0}". Element: {1}', slotName, startingTag($element));
                        }
                    }).$$boundTransclude = boundTranscludeFn, transcludeFn.isSlotFilled = function(slotName) {
                        return !!boundTranscludeFn.$$slots[slotName];
                    }), controllerDirectives && (elementControllers = function($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) {
                        var elementControllers = createMap();
                        for (var controllerKey in controllerDirectives) {
                            var directive = controllerDirectives[controllerKey], locals = {
                                $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
                                $element: $element,
                                $attrs: attrs,
                                $transclude: transcludeFn
                            }, controller = directive.controller;
                            "@" == controller && (controller = attrs[directive.name]);
                            var controllerInstance = $controller(controller, locals, !0, directive.controllerAs);
                            elementControllers[directive.name] = controllerInstance, $element.data("$" + directive.name + "Controller", controllerInstance.instance);
                        }
                        return elementControllers;
                    }($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective)), 
                    newIsolateScopeDirective && (compile.$$addScopeInfo($element, isolateScope, !0, !(templateDirective && (templateDirective === newIsolateScopeDirective || templateDirective === newIsolateScopeDirective.$$originalDirective))), 
                    compile.$$addScopeClass($element, !0), isolateScope.$$isolateBindings = newIsolateScopeDirective.$$isolateBindings, 
                    (scopeBindingInfo = initializeDirectiveBindings(scope, attrs, isolateScope, isolateScope.$$isolateBindings, newIsolateScopeDirective)).removeWatches && isolateScope.$on("$destroy", scopeBindingInfo.removeWatches)), 
                    elementControllers) {
                        var controllerDirective = controllerDirectives[name], controller = elementControllers[name], bindings = controllerDirective.$$bindings.bindToController;
                        controller.identifier && bindings ? controller.bindingInfo = initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective) : controller.bindingInfo = {};
                        var controllerResult = controller();
                        controllerResult !== controller.instance && (controller.instance = controllerResult, 
                        $element.data("$" + controllerDirective.name + "Controller", controllerResult), 
                        controller.bindingInfo.removeWatches && controller.bindingInfo.removeWatches(), 
                        controller.bindingInfo = initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective));
                    }
                    for (forEach(controllerDirectives, function(controllerDirective, name) {
                        var require = controllerDirective.require;
                        controllerDirective.bindToController && !isArray(require) && isObject(require) && extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers));
                    }), forEach(elementControllers, function(controller) {
                        var controllerInstance = controller.instance;
                        if (isFunction(controllerInstance.$onChanges)) try {
                            controllerInstance.$onChanges(controller.bindingInfo.initialChanges);
                        } catch (e) {
                            $exceptionHandler(e);
                        }
                        if (isFunction(controllerInstance.$onInit)) try {
                            controllerInstance.$onInit();
                        } catch (e) {
                            $exceptionHandler(e);
                        }
                        isFunction(controllerInstance.$doCheck) && (controllerScope.$watch(function() {
                            controllerInstance.$doCheck();
                        }), controllerInstance.$doCheck()), isFunction(controllerInstance.$onDestroy) && controllerScope.$on("$destroy", function() {
                            controllerInstance.$onDestroy();
                        });
                    }), i = 0, ii = preLinkFns.length; i < ii; i++) invokeLinkFn(linkFn = preLinkFns[i], linkFn.isolateScope ? isolateScope : scope, $element, attrs, linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), transcludeFn);
                    var scopeToChild = scope;
                    for (newIsolateScopeDirective && (newIsolateScopeDirective.template || null === newIsolateScopeDirective.templateUrl) && (scopeToChild = isolateScope), 
                    childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, void 0, boundTranscludeFn), 
                    i = postLinkFns.length - 1; 0 <= i; i--) invokeLinkFn(linkFn = postLinkFns[i], linkFn.isolateScope ? isolateScope : scope, $element, attrs, linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers), transcludeFn);
                    forEach(elementControllers, function(controller) {
                        var controllerInstance = controller.instance;
                        isFunction(controllerInstance.$postLink) && controllerInstance.$postLink();
                    });
                }
            }
            function getControllers(directiveName, require, $element, elementControllers) {
                var value;
                if (isString(require)) {
                    var match = require.match(REQUIRE_PREFIX_REGEXP), name = require.substring(match[0].length), inheritType = match[1] || match[3], optional = "?" === match[2];
                    if ("^^" === inheritType ? $element = $element.parent() : value = (value = elementControllers && elementControllers[name]) && value.instance, 
                    !value) {
                        var dataName = "$" + name + "Controller";
                        value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName);
                    }
                    if (!value && !optional) throw $compileMinErr("ctreq", "Controller '{0}', required by directive '{1}', can't be found!", name, directiveName);
                } else if (isArray(require)) {
                    value = [];
                    for (var i = 0, ii = require.length; i < ii; i++) value[i] = getControllers(directiveName, require[i], $element, elementControllers);
                } else isObject(require) && (value = {}, forEach(require, function(controller, property) {
                    value[property] = getControllers(directiveName, controller, $element, elementControllers);
                }));
                return value || null;
            }
            function markDirectiveScope(directives, isolateScope, newScope) {
                for (var j = 0, jj = directives.length; j < jj; j++) directives[j] = inherit(directives[j], {
                    $$isolateScope: isolateScope,
                    $$newScope: newScope
                });
            }
            function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName, endAttrName) {
                if (name === ignoreDirective) return null;
                var match = null;
                if (hasDirectives.hasOwnProperty(name)) for (var directive, directives = $injector.get(name + Suffix), i = 0, ii = directives.length; i < ii; i++) try {
                    if (directive = directives[i], (isUndefined(maxPriority) || maxPriority > directive.priority) && -1 != directive.restrict.indexOf(location)) {
                        if (startAttrName && (directive = inherit(directive, {
                            $$start: startAttrName,
                            $$end: endAttrName
                        })), !directive.$$bindings) {
                            var bindings = directive.$$bindings = parseDirectiveBindings(directive, directive.name);
                            isObject(bindings.isolateScope) && (directive.$$isolateBindings = bindings.isolateScope);
                        }
                        tDirectives.push(directive), match = directive;
                    }
                } catch (e) {
                    $exceptionHandler(e);
                }
                return match;
            }
            function directiveIsMultiElement(name) {
                if (hasDirectives.hasOwnProperty(name)) for (var directives = $injector.get(name + Suffix), i = 0, ii = directives.length; i < ii; i++) if (directives[i].multiElement) return !0;
                return !1;
            }
            function mergeTemplateAttributes(dst, src) {
                var srcAttr = src.$attr, dstAttr = dst.$attr;
                dst.$$element;
                forEach(dst, function(value, key) {
                    "$" != key.charAt(0) && (src[key] && src[key] !== value && (value += ("style" === key ? ";" : " ") + src[key]), 
                    dst.$set(key, value, !0, srcAttr[key]));
                }), forEach(src, function(value, key) {
                    dst.hasOwnProperty(key) || "$" === key.charAt(0) || (dst[key] = value, "class" !== key && "style" !== key && (dstAttr[key] = srcAttr[key]));
                });
            }
            function compileTemplateUrl(directives, $compileNode, tAttrs, $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
                var afterTemplateNodeLinkFn, afterTemplateChildLinkFn, linkQueue = [], beforeTemplateCompileNode = $compileNode[0], origAsyncDirective = directives.shift(), derivedSyncDirective = inherit(origAsyncDirective, {
                    templateUrl: null,
                    transclude: null,
                    replace: null,
                    $$originalDirective: origAsyncDirective
                }), templateUrl = isFunction(origAsyncDirective.templateUrl) ? origAsyncDirective.templateUrl($compileNode, tAttrs) : origAsyncDirective.templateUrl, templateNamespace = origAsyncDirective.templateNamespace;
                return $compileNode.empty(), $templateRequest(templateUrl).then(function(content) {
                    var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;
                    if (content = denormalizeTemplate(content), origAsyncDirective.replace) {
                        if ($template = jqLiteIsTextNode(content) ? [] : removeComments(wrapTemplate(templateNamespace, trim(content))), 
                        compileNode = $template[0], 1 != $template.length || compileNode.nodeType !== NODE_TYPE_ELEMENT) throw $compileMinErr("tplrt", "Template for directive '{0}' must have exactly one root element. {1}", origAsyncDirective.name, templateUrl);
                        tempTemplateAttrs = {
                            $attr: {}
                        }, replaceWith($rootElement, $compileNode, compileNode);
                        var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);
                        isObject(origAsyncDirective.scope) && markDirectiveScope(templateDirectives, !0), 
                        directives = templateDirectives.concat(directives), mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
                    } else compileNode = beforeTemplateCompileNode, $compileNode.html(content);
                    for (directives.unshift(derivedSyncDirective), afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs, childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns, previousCompileContext), 
                    forEach($rootElement, function(node, i) {
                        node == compileNode && ($rootElement[i] = $compileNode[0]);
                    }), afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn); linkQueue.length; ) {
                        var scope = linkQueue.shift(), beforeTemplateLinkNode = linkQueue.shift(), linkRootElement = linkQueue.shift(), boundTranscludeFn = linkQueue.shift(), linkNode = $compileNode[0];
                        if (!scope.$$destroyed) {
                            if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
                                var oldClasses = beforeTemplateLinkNode.className;
                                previousCompileContext.hasElementTranscludeDirective && origAsyncDirective.replace || (linkNode = jqLiteClone(compileNode)), 
                                replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode), safeAddClass(jqLite(linkNode), oldClasses);
                            }
                            childBoundTranscludeFn = afterTemplateNodeLinkFn.transcludeOnThisElement ? createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn) : boundTranscludeFn, 
                            afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement, childBoundTranscludeFn);
                        }
                    }
                    linkQueue = null;
                }), function(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
                    var childBoundTranscludeFn = boundTranscludeFn;
                    scope.$$destroyed || (linkQueue ? linkQueue.push(scope, node, rootElement, childBoundTranscludeFn) : (afterTemplateNodeLinkFn.transcludeOnThisElement && (childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn)), 
                    afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn)));
                };
            }
            function byPriority(a, b) {
                var diff = b.priority - a.priority;
                return 0 !== diff ? diff : a.name !== b.name ? a.name < b.name ? -1 : 1 : a.index - b.index;
            }
            function assertNoDuplicate(what, previousDirective, directive, element) {
                function wrapModuleNameIfDefined(moduleName) {
                    return moduleName ? " (module: " + moduleName + ")" : "";
                }
                if (previousDirective) throw $compileMinErr("multidir", "Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}", previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName), directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element));
            }
            function wrapTemplate(type, template) {
                switch (type = lowercase(type || "html")) {
                  case "svg":
                  case "math":
                    var wrapper = window.document.createElement("div");
                    return wrapper.innerHTML = "<" + type + ">" + template + "</" + type + ">", wrapper.childNodes[0].childNodes;

                  default:
                    return template;
                }
            }
            function addAttrInterpolateDirective(node, directives, value, name, allOrNothing) {
                var trustedContext = function(node, attrNormalizedName) {
                    if ("srcdoc" == attrNormalizedName) return $sce.HTML;
                    var tag = nodeName_(node);
                    return "xlinkHref" == attrNormalizedName || "form" == tag && "action" == attrNormalizedName || "img" != tag && ("src" == attrNormalizedName || "ngSrc" == attrNormalizedName) ? $sce.RESOURCE_URL : void 0;
                }(node, name);
                allOrNothing = ALL_OR_NOTHING_ATTRS[name] || allOrNothing;
                var interpolateFn = $interpolate(value, !0, trustedContext, allOrNothing);
                if (interpolateFn) {
                    if ("multiple" === name && "select" === nodeName_(node)) throw $compileMinErr("selmulti", "Binding to the 'multiple' attribute is not supported. Element: {0}", startingTag(node));
                    directives.push({
                        priority: 100,
                        compile: function() {
                            return {
                                pre: function(scope, element, attr) {
                                    var $$observers = attr.$$observers || (attr.$$observers = createMap());
                                    if (EVENT_HANDLER_ATTR_REGEXP.test(name)) throw $compileMinErr("nodomevents", "Interpolations for HTML DOM event attributes are disallowed.  Please use the ng- versions (such as ng-click instead of onclick) instead.");
                                    var newValue = attr[name];
                                    newValue !== value && (interpolateFn = newValue && $interpolate(newValue, !0, trustedContext, allOrNothing), 
                                    value = newValue), interpolateFn && (attr[name] = interpolateFn(scope), ($$observers[name] || ($$observers[name] = [])).$$inter = !0, 
                                    (attr.$$observers && attr.$$observers[name].$$scope || scope).$watch(interpolateFn, function(newValue, oldValue) {
                                        "class" === name && newValue != oldValue ? attr.$updateClass(newValue, oldValue) : attr.$set(name, newValue);
                                    }));
                                }
                            };
                        }
                    });
                }
            }
            function replaceWith($rootElement, elementsToRemove, newNode) {
                var i, ii, firstElementToRemove = elementsToRemove[0], removeCount = elementsToRemove.length, parent = firstElementToRemove.parentNode;
                if ($rootElement) for (i = 0, ii = $rootElement.length; i < ii; i++) if ($rootElement[i] == firstElementToRemove) {
                    $rootElement[i++] = newNode;
                    for (var j = i, j2 = j + removeCount - 1, jj = $rootElement.length; j < jj; j++, 
                    j2++) j2 < jj ? $rootElement[j] = $rootElement[j2] : delete $rootElement[j];
                    $rootElement.length -= removeCount - 1, $rootElement.context === firstElementToRemove && ($rootElement.context = newNode);
                    break;
                }
                parent && parent.replaceChild(newNode, firstElementToRemove);
                var fragment = window.document.createDocumentFragment();
                for (i = 0; i < removeCount; i++) fragment.appendChild(elementsToRemove[i]);
                for (jqLite.hasData(firstElementToRemove) && (jqLite.data(newNode, jqLite.data(firstElementToRemove)), 
                jqLite(firstElementToRemove).off("$destroy")), jqLite.cleanData(fragment.querySelectorAll("*")), 
                i = 1; i < removeCount; i++) delete elementsToRemove[i];
                elementsToRemove[0] = newNode, elementsToRemove.length = 1;
            }
            function cloneAndAnnotateFn(fn, annotation) {
                return extend(function() {
                    return fn.apply(null, arguments);
                }, fn, annotation);
            }
            function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) {
                try {
                    linkFn(scope, $element, attrs, controllers, transcludeFn);
                } catch (e) {
                    $exceptionHandler(e, startingTag($element));
                }
            }
            function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) {
                var changes, removeWatchCollection = [], initialChanges = {};
                function recordChanges(key, currentValue, previousValue) {
                    isFunction(destination.$onChanges) && currentValue !== previousValue && (onChangesQueue || (scope.$$postDigest(flushOnChangesQueue), 
                    onChangesQueue = []), changes || (changes = {}, onChangesQueue.push(triggerOnChangesHook)), 
                    changes[key] && (previousValue = changes[key].previousValue), changes[key] = new SimpleChange(previousValue, currentValue));
                }
                function triggerOnChangesHook() {
                    destination.$onChanges(changes), changes = void 0;
                }
                return forEach(bindings, function(definition, scopeName) {
                    var lastValue, parentGet, parentSet, compare, removeWatch, attrName = definition.attrName, optional = definition.optional;
                    switch (definition.mode) {
                      case "@":
                        optional || hasOwnProperty.call(attrs, attrName) || (destination[scopeName] = attrs[attrName] = void 0), 
                        attrs.$observe(attrName, function(value) {
                            if (isString(value) || isBoolean(value)) {
                                var oldValue = destination[scopeName];
                                recordChanges(scopeName, value, oldValue), destination[scopeName] = value;
                            }
                        }), attrs.$$observers[attrName].$$scope = scope, isString(lastValue = attrs[attrName]) ? destination[scopeName] = $interpolate(lastValue)(scope) : isBoolean(lastValue) && (destination[scopeName] = lastValue), 
                        initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]);
                        break;

                      case "=":
                        if (!hasOwnProperty.call(attrs, attrName)) {
                            if (optional) break;
                            attrs[attrName] = void 0;
                        }
                        if (optional && !attrs[attrName]) break;
                        parentGet = $parse(attrs[attrName]), compare = parentGet.literal ? equals : function(a, b) {
                            return a === b || a != a && b != b;
                        }, parentSet = parentGet.assign || function() {
                            throw lastValue = destination[scopeName] = parentGet(scope), $compileMinErr("nonassign", "Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!", attrs[attrName], attrName, directive.name);
                        }, lastValue = destination[scopeName] = parentGet(scope);
                        var parentValueWatch = function(parentValue) {
                            return compare(parentValue, destination[scopeName]) || (compare(parentValue, lastValue) ? parentSet(scope, parentValue = destination[scopeName]) : destination[scopeName] = parentValue), 
                            lastValue = parentValue;
                        };
                        parentValueWatch.$stateful = !0, removeWatch = definition.collection ? scope.$watchCollection(attrs[attrName], parentValueWatch) : scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal), 
                        removeWatchCollection.push(removeWatch);
                        break;

                      case "<":
                        if (!hasOwnProperty.call(attrs, attrName)) {
                            if (optional) break;
                            attrs[attrName] = void 0;
                        }
                        if (optional && !attrs[attrName]) break;
                        parentGet = $parse(attrs[attrName]);
                        var initialValue = destination[scopeName] = parentGet(scope);
                        initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]), 
                        removeWatch = scope.$watch(parentGet, function(newValue, oldValue) {
                            if (oldValue === newValue) {
                                if (oldValue === initialValue) return;
                                oldValue = initialValue;
                            }
                            recordChanges(scopeName, newValue, oldValue), destination[scopeName] = newValue;
                        }, parentGet.literal), removeWatchCollection.push(removeWatch);
                        break;

                      case "&":
                        if ((parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop) === noop && optional) break;
                        destination[scopeName] = function(locals) {
                            return parentGet(scope, locals);
                        };
                    }
                }), {
                    initialChanges: initialChanges,
                    removeWatches: removeWatchCollection.length && function() {
                        for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) removeWatchCollection[i]();
                    }
                };
            }
        } ];
    }
    function SimpleChange(previous, current) {
        this.previousValue = previous, this.currentValue = current;
    }
    $CompileProvider.$inject = [ "$provide", "$$sanitizeUriProvider" ], SimpleChange.prototype.isFirstChange = function() {
        return this.previousValue === _UNINITIALIZED_VALUE;
    };
    var PREFIX_REGEXP = /^((?:x|data)[\:\-_])/i;
    function directiveNormalize(name) {
        return camelCase(name.replace(PREFIX_REGEXP, ""));
    }
    function tokenDifference(str1, str2) {
        var values = "", tokens1 = str1.split(/\s+/), tokens2 = str2.split(/\s+/);
        outer: for (var i = 0; i < tokens1.length; i++) {
            for (var token = tokens1[i], j = 0; j < tokens2.length; j++) if (token == tokens2[j]) continue outer;
            values += (0 < values.length ? " " : "") + token;
        }
        return values;
    }
    function removeComments(jqNodes) {
        var i = (jqNodes = jqLite(jqNodes)).length;
        if (i <= 1) return jqNodes;
        for (;i--; ) {
            jqNodes[i].nodeType === NODE_TYPE_COMMENT && splice.call(jqNodes, i, 1);
        }
        return jqNodes;
    }
    var $controllerMinErr = minErr("$controller"), CNTRL_REG = /^(\S+)(\s+as\s+([\w$]+))?$/;
    function identifierForController(controller, ident) {
        if (ident && isString(ident)) return ident;
        if (isString(controller)) {
            var match = CNTRL_REG.exec(controller);
            if (match) return match[3];
        }
    }
    function $ControllerProvider() {
        var controllers = {}, globals = !1;
        this.has = function(name) {
            return controllers.hasOwnProperty(name);
        }, this.register = function(name, constructor) {
            assertNotHasOwnProperty(name, "controller"), isObject(name) ? extend(controllers, name) : controllers[name] = constructor;
        }, this.allowGlobals = function() {
            globals = !0;
        }, this.$get = [ "$injector", "$window", function($injector, $window) {
            return function(expression, locals, later, ident) {
                var instance, match, constructor, identifier;
                if (later = !0 === later, ident && isString(ident) && (identifier = ident), isString(expression)) {
                    if (!(match = expression.match(CNTRL_REG))) throw $controllerMinErr("ctrlfmt", "Badly formed controller string '{0}'. Must match `__name__ as __id__` or `__name__`.", expression);
                    constructor = match[1], identifier = identifier || match[3], assertArgFn(expression = controllers.hasOwnProperty(constructor) ? controllers[constructor] : getter(locals.$scope, constructor, !0) || (globals ? getter($window, constructor, !0) : void 0), constructor, !0);
                }
                if (later) {
                    var controllerPrototype = (isArray(expression) ? expression[expression.length - 1] : expression).prototype;
                    return instance = Object.create(controllerPrototype || null), identifier && addIdentifier(locals, identifier, instance, constructor || expression.name), 
                    extend(function() {
                        var result = $injector.invoke(expression, instance, locals, constructor);
                        return result !== instance && (isObject(result) || isFunction(result)) && (instance = result, 
                        identifier && addIdentifier(locals, identifier, instance, constructor || expression.name)), 
                        instance;
                    }, {
                        instance: instance,
                        identifier: identifier
                    });
                }
                return instance = $injector.instantiate(expression, locals, constructor), identifier && addIdentifier(locals, identifier, instance, constructor || expression.name), 
                instance;
            };
            function addIdentifier(locals, identifier, instance, name) {
                if (!locals || !isObject(locals.$scope)) throw minErr("$controller")("noscp", "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.", name, identifier);
                locals.$scope[identifier] = instance;
            }
        } ];
    }
    function $DocumentProvider() {
        this.$get = [ "$window", function(window) {
            return jqLite(window.document);
        } ];
    }
    function $ExceptionHandlerProvider() {
        this.$get = [ "$log", function($log) {
            return function(exception, cause) {
                $log.error.apply($log, arguments);
            };
        } ];
    }
    var $$ForceReflowProvider = function() {
        this.$get = [ "$document", function($document) {
            return function(domNode) {
                return domNode ? !domNode.nodeType && domNode instanceof jqLite && (domNode = domNode[0]) : domNode = $document[0].body, 
                domNode.offsetWidth + 1;
            };
        } ];
    }, APPLICATION_JSON = "application/json", CONTENT_TYPE_APPLICATION_JSON = {
        "Content-Type": APPLICATION_JSON + ";charset=utf-8"
    }, JSON_START = /^\[|^\{(?!\{)/, JSON_ENDS = {
        "[": /]$/,
        "{": /}$/
    }, JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/, $httpMinErr = minErr("$http"), $httpMinErrLegacyFn = function(method) {
        return function() {
            throw $httpMinErr("legacy", "The method `{0}` on the promise returned from `$http` has been disabled.", method);
        };
    };
    function serializeValue(v) {
        return isObject(v) ? isDate(v) ? v.toISOString() : toJson(v) : v;
    }
    function $HttpParamSerializerProvider() {
        this.$get = function() {
            return function(params) {
                if (!params) return "";
                var parts = [];
                return forEachSorted(params, function(value, key) {
                    null === value || isUndefined(value) || (isArray(value) ? forEach(value, function(v) {
                        parts.push(encodeUriQuery(key) + "=" + encodeUriQuery(serializeValue(v)));
                    }) : parts.push(encodeUriQuery(key) + "=" + encodeUriQuery(serializeValue(value))));
                }), parts.join("&");
            };
        };
    }
    function $HttpParamSerializerJQLikeProvider() {
        this.$get = function() {
            return function(params) {
                if (!params) return "";
                var parts = [];
                return function serialize(toSerialize, prefix, topLevel) {
                    if (null === toSerialize || isUndefined(toSerialize)) return;
                    isArray(toSerialize) ? forEach(toSerialize, function(value, index) {
                        serialize(value, prefix + "[" + (isObject(value) ? index : "") + "]");
                    }) : isObject(toSerialize) && !isDate(toSerialize) ? forEachSorted(toSerialize, function(value, key) {
                        serialize(value, prefix + (topLevel ? "" : "[") + key + (topLevel ? "" : "]"));
                    }) : parts.push(encodeUriQuery(prefix) + "=" + encodeUriQuery(serializeValue(toSerialize)));
                }(params, "", !0), parts.join("&");
            };
        };
    }
    function defaultHttpResponseTransform(data, headers) {
        if (isString(data)) {
            var tempData = data.replace(JSON_PROTECTION_PREFIX, "").trim();
            if (tempData) {
                var contentType = headers("Content-Type");
                (contentType && 0 === contentType.indexOf(APPLICATION_JSON) || (jsonStart = (str = tempData).match(JSON_START)) && JSON_ENDS[jsonStart[0]].test(str)) && (data = fromJson(tempData));
            }
        }
        var str, jsonStart;
        return data;
    }
    function parseHeaders(headers) {
        var i, parsed = createMap();
        function fillInParsed(key, val) {
            key && (parsed[key] = parsed[key] ? parsed[key] + ", " + val : val);
        }
        return isString(headers) ? forEach(headers.split("\n"), function(line) {
            i = line.indexOf(":"), fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));
        }) : isObject(headers) && forEach(headers, function(headerVal, headerKey) {
            fillInParsed(lowercase(headerKey), trim(headerVal));
        }), parsed;
    }
    function headersGetter(headers) {
        var headersObj;
        return function(name) {
            if (headersObj || (headersObj = parseHeaders(headers)), name) {
                var value = headersObj[lowercase(name)];
                return void 0 === value && (value = null), value;
            }
            return headersObj;
        };
    }
    function transformData(data, headers, status, fns) {
        return isFunction(fns) ? fns(data, headers, status) : (forEach(fns, function(fn) {
            data = fn(data, headers, status);
        }), data);
    }
    function isSuccess(status) {
        return 200 <= status && status < 300;
    }
    function $HttpProvider() {
        var defaults = this.defaults = {
            transformResponse: [ defaultHttpResponseTransform ],
            transformRequest: [ function(d) {
                return !isObject(d) || (obj = d, "[object File]" === toString.call(obj)) || function(obj) {
                    return "[object Blob]" === toString.call(obj);
                }(d) || function(obj) {
                    return "[object FormData]" === toString.call(obj);
                }(d) ? d : toJson(d);
                var obj;
            } ],
            headers: {
                common: {
                    Accept: "application/json, text/plain, */*"
                },
                post: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
                put: shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
                patch: shallowCopy(CONTENT_TYPE_APPLICATION_JSON)
            },
            xsrfCookieName: "XSRF-TOKEN",
            xsrfHeaderName: "X-XSRF-TOKEN",
            paramSerializer: "$httpParamSerializer"
        }, useApplyAsync = !1;
        this.useApplyAsync = function(value) {
            return isDefined(value) ? (useApplyAsync = !!value, this) : useApplyAsync;
        };
        var useLegacyPromise = !0;
        this.useLegacyPromiseExtensions = function(value) {
            return isDefined(value) ? (useLegacyPromise = !!value, this) : useLegacyPromise;
        };
        var interceptorFactories = this.interceptors = [];
        this.$get = [ "$httpBackend", "$$cookieReader", "$cacheFactory", "$rootScope", "$q", "$injector", function($httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector) {
            var defaultCache = $cacheFactory("$http");
            defaults.paramSerializer = isString(defaults.paramSerializer) ? $injector.get(defaults.paramSerializer) : defaults.paramSerializer;
            var reversedInterceptors = [];
            function $http(requestConfig) {
                if (!isObject(requestConfig)) throw minErr("$http")("badreq", "Http request configuration must be an object.  Received: {0}", requestConfig);
                if (!isString(requestConfig.url)) throw minErr("$http")("badreq", "Http request configuration url must be a string.  Received: {0}", requestConfig.url);
                var config = extend({
                    method: "get",
                    transformRequest: defaults.transformRequest,
                    transformResponse: defaults.transformResponse,
                    paramSerializer: defaults.paramSerializer
                }, requestConfig);
                config.headers = function(config) {
                    var defHeaderName, lowercaseDefHeaderName, reqHeaderName, defHeaders = defaults.headers, reqHeaders = extend({}, config.headers);
                    defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);
                    defaultHeadersIteration: for (defHeaderName in defHeaders) {
                        for (reqHeaderName in lowercaseDefHeaderName = lowercase(defHeaderName), reqHeaders) if (lowercase(reqHeaderName) === lowercaseDefHeaderName) continue defaultHeadersIteration;
                        reqHeaders[defHeaderName] = defHeaders[defHeaderName];
                    }
                    return function(headers, config) {
                        var headerContent, processedHeaders = {};
                        return forEach(headers, function(headerFn, header) {
                            isFunction(headerFn) ? null != (headerContent = headerFn(config)) && (processedHeaders[header] = headerContent) : processedHeaders[header] = headerFn;
                        }), processedHeaders;
                    }(reqHeaders, shallowCopy(config));
                }(requestConfig), config.method = uppercase(config.method), config.paramSerializer = isString(config.paramSerializer) ? $injector.get(config.paramSerializer) : config.paramSerializer;
                var requestInterceptors = [], responseInterceptors = [], promise = $q.when(config);
                return forEach(reversedInterceptors, function(interceptor) {
                    (interceptor.request || interceptor.requestError) && requestInterceptors.unshift(interceptor.request, interceptor.requestError), 
                    (interceptor.response || interceptor.responseError) && responseInterceptors.push(interceptor.response, interceptor.responseError);
                }), promise = chainInterceptors(promise = (promise = chainInterceptors(promise, requestInterceptors)).then(function(config) {
                    var headers = config.headers, reqData = transformData(config.data, headersGetter(headers), void 0, config.transformRequest);
                    isUndefined(reqData) && forEach(headers, function(value, header) {
                        "content-type" === lowercase(header) && delete headers[header];
                    });
                    isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials) && (config.withCredentials = defaults.withCredentials);
                    return function(config, reqData) {
                        var cache, cachedResp, deferred = $q.defer(), promise = deferred.promise, reqHeaders = config.headers, url = function(url, serializedParams) {
                            0 < serializedParams.length && (url += (-1 == url.indexOf("?") ? "?" : "&") + serializedParams);
                            return url;
                        }(config.url, config.paramSerializer(config.params));
                        $http.pendingRequests.push(config), promise.then(removePendingReq, removePendingReq), 
                        !config.cache && !defaults.cache || !1 === config.cache || "GET" !== config.method && "JSONP" !== config.method || (cache = isObject(config.cache) ? config.cache : isObject(defaults.cache) ? defaults.cache : defaultCache);
                        cache && (isDefined(cachedResp = cache.get(url)) ? isPromiseLike(cachedResp) ? cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult) : isArray(cachedResp) ? resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]) : resolvePromise(cachedResp, 200, {}, "OK") : cache.put(url, promise));
                        if (isUndefined(cachedResp)) {
                            var xsrfValue = urlIsSameOrigin(config.url) ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName] : void 0;
                            xsrfValue && (reqHeaders[config.xsrfHeaderName || defaults.xsrfHeaderName] = xsrfValue), 
                            $httpBackend(config.method, url, reqData, function(status, response, headersString, statusText) {
                                cache && (isSuccess(status) ? cache.put(url, [ status, response, parseHeaders(headersString), statusText ]) : cache.remove(url));
                                function resolveHttpPromise() {
                                    resolvePromise(response, status, headersString, statusText);
                                }
                                useApplyAsync ? $rootScope.$applyAsync(resolveHttpPromise) : (resolveHttpPromise(), 
                                $rootScope.$$phase || $rootScope.$apply());
                            }, reqHeaders, config.timeout, config.withCredentials, config.responseType, createApplyHandlers(config.eventHandlers), createApplyHandlers(config.uploadEventHandlers));
                        }
                        return promise;
                        function createApplyHandlers(eventHandlers) {
                            if (eventHandlers) {
                                var applyHandlers = {};
                                return forEach(eventHandlers, function(eventHandler, key) {
                                    applyHandlers[key] = function(event) {
                                        function callEventHandler() {
                                            eventHandler(event);
                                        }
                                        useApplyAsync ? $rootScope.$applyAsync(callEventHandler) : $rootScope.$$phase ? callEventHandler() : $rootScope.$apply(callEventHandler);
                                    };
                                }), applyHandlers;
                            }
                        }
                        function resolvePromise(response, status, headers, statusText) {
                            (isSuccess(status = -1 <= status ? status : 0) ? deferred.resolve : deferred.reject)({
                                data: response,
                                status: status,
                                headers: headersGetter(headers),
                                config: config,
                                statusText: statusText
                            });
                        }
                        function resolvePromiseWithResult(result) {
                            resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText);
                        }
                        function removePendingReq() {
                            var idx = $http.pendingRequests.indexOf(config);
                            -1 !== idx && $http.pendingRequests.splice(idx, 1);
                        }
                    }(config, reqData).then(transformResponse, transformResponse);
                }), responseInterceptors), useLegacyPromise ? (promise.success = function(fn) {
                    return assertArgFn(fn, "fn"), promise.then(function(response) {
                        fn(response.data, response.status, response.headers, config);
                    }), promise;
                }, promise.error = function(fn) {
                    return assertArgFn(fn, "fn"), promise.then(null, function(response) {
                        fn(response.data, response.status, response.headers, config);
                    }), promise;
                }) : (promise.success = $httpMinErrLegacyFn("success"), promise.error = $httpMinErrLegacyFn("error")), 
                promise;
                function chainInterceptors(promise, interceptors) {
                    for (var i = 0, ii = interceptors.length; i < ii; ) {
                        var thenFn = interceptors[i++], rejectFn = interceptors[i++];
                        promise = promise.then(thenFn, rejectFn);
                    }
                    return interceptors.length = 0, promise;
                }
                function transformResponse(response) {
                    var resp = extend({}, response);
                    return resp.data = transformData(response.data, response.headers, response.status, config.transformResponse), 
                    isSuccess(response.status) ? resp : $q.reject(resp);
                }
            }
            return forEach(interceptorFactories, function(interceptorFactory) {
                reversedInterceptors.unshift(isString(interceptorFactory) ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));
            }), $http.pendingRequests = [], function(names) {
                forEach(arguments, function(name) {
                    $http[name] = function(url, config) {
                        return $http(extend({}, config || {}, {
                            method: name,
                            url: url
                        }));
                    };
                });
            }("get", "delete", "head", "jsonp"), function(name) {
                forEach(arguments, function(name) {
                    $http[name] = function(url, data, config) {
                        return $http(extend({}, config || {}, {
                            method: name,
                            url: url,
                            data: data
                        }));
                    };
                });
            }("post", "put", "patch"), $http.defaults = defaults, $http;
        } ];
    }
    function $xhrFactoryProvider() {
        this.$get = function() {
            return function() {
                return new window.XMLHttpRequest();
            };
        };
    }
    function $HttpBackendProvider() {
        this.$get = [ "$browser", "$jsonpCallbacks", "$document", "$xhrFactory", function($browser, $jsonpCallbacks, $document, $xhrFactory) {
            return function($browser, createXhr, $browserDefer, callbacks, rawDocument) {
                return function(method, url, post, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers) {
                    if ($browser.$$incOutstandingRequestCount(), url = url || $browser.url(), "jsonp" === lowercase(method)) var callbackPath = callbacks.createCallback(url), jsonpDone = function(url, callbackPath, done) {
                        url = url.replace("JSON_CALLBACK", callbackPath);
                        var script = rawDocument.createElement("script"), callback = null;
                        return script.type = "text/javascript", script.src = url, script.async = !0, addEventListenerFn(script, "load", callback = function(event) {
                            removeEventListenerFn(script, "load", callback), removeEventListenerFn(script, "error", callback), 
                            rawDocument.body.removeChild(script), script = null;
                            var status = -1, text = "unknown";
                            event && ("load" !== event.type || callbacks.wasCalled(callbackPath) || (event = {
                                type: "error"
                            }), text = event.type, status = "error" === event.type ? 404 : 200), done && done(status, text);
                        }), addEventListenerFn(script, "error", callback), rawDocument.body.appendChild(script), 
                        callback;
                    }(url, callbackPath, function(status, text) {
                        var response = 200 === status && callbacks.getResponse(callbackPath);
                        completeRequest(callback, status, response, "", text), callbacks.removeCallback(callbackPath);
                    }); else {
                        var xhr = createXhr(method, url);
                        xhr.open(method, url, !0), forEach(headers, function(value, key) {
                            isDefined(value) && xhr.setRequestHeader(key, value);
                        }), xhr.onload = function() {
                            var statusText = xhr.statusText || "", response = "response" in xhr ? xhr.response : xhr.responseText, status = 1223 === xhr.status ? 204 : xhr.status;
                            0 === status && (status = response ? 200 : "file" == urlResolve(url).protocol ? 404 : 0), 
                            completeRequest(callback, status, response, xhr.getAllResponseHeaders(), statusText);
                        };
                        var requestError = function() {
                            completeRequest(callback, -1, null, null, "");
                        };
                        if (xhr.onerror = requestError, xhr.onabort = requestError, forEach(eventHandlers, function(value, key) {
                            xhr.addEventListener(key, value);
                        }), forEach(uploadEventHandlers, function(value, key) {
                            xhr.upload.addEventListener(key, value);
                        }), withCredentials && (xhr.withCredentials = !0), responseType) try {
                            xhr.responseType = responseType;
                        } catch (e) {
                            if ("json" !== responseType) throw e;
                        }
                        xhr.send(isUndefined(post) ? null : post);
                    }
                    if (0 < timeout) var timeoutId = $browserDefer(timeoutRequest, timeout); else isPromiseLike(timeout) && timeout.then(timeoutRequest);
                    function timeoutRequest() {
                        jsonpDone && jsonpDone(), xhr && xhr.abort();
                    }
                    function completeRequest(callback, status, response, headersString, statusText) {
                        isDefined(timeoutId) && $browserDefer.cancel(timeoutId), jsonpDone = xhr = null, 
                        callback(status, response, headersString, statusText), $browser.$$completeOutstandingRequest(noop);
                    }
                };
            }($browser, $xhrFactory, $browser.defer, $jsonpCallbacks, $document[0]);
        } ];
    }
    var $interpolateMinErr = angular.$interpolateMinErr = minErr("$interpolate");
    function $InterpolateProvider() {
        var startSymbol = "{{", endSymbol = "}}";
        this.startSymbol = function(value) {
            return value ? (startSymbol = value, this) : startSymbol;
        }, this.endSymbol = function(value) {
            return value ? (endSymbol = value, this) : endSymbol;
        }, this.$get = [ "$parse", "$exceptionHandler", "$sce", function($parse, $exceptionHandler, $sce) {
            var startSymbolLength = startSymbol.length, endSymbolLength = endSymbol.length, escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), "g"), escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), "g");
            function escape(ch) {
                return "\\\\\\" + ch;
            }
            function unescapeText(text) {
                return text.replace(escapedStartRegexp, startSymbol).replace(escapedEndRegexp, endSymbol);
            }
            function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {
                var unwatch;
                return unwatch = scope.$watch(function(scope) {
                    return unwatch(), constantInterp(scope);
                }, listener, objectEquality);
            }
            function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
                if (!text.length || -1 === text.indexOf(startSymbol)) {
                    var constantInterp;
                    if (!mustHaveExpression) (constantInterp = valueFn(unescapeText(text))).exp = text, 
                    constantInterp.expressions = [], constantInterp.$$watchDelegate = constantWatchDelegate;
                    return constantInterp;
                }
                allOrNothing = !!allOrNothing;
                for (var startIndex, endIndex, exp, index = 0, expressions = [], parseFns = [], textLength = text.length, concat = [], expressionPositions = []; index < textLength; ) {
                    if (-1 == (startIndex = text.indexOf(startSymbol, index)) || -1 == (endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength))) {
                        index !== textLength && concat.push(unescapeText(text.substring(index)));
                        break;
                    }
                    index !== startIndex && concat.push(unescapeText(text.substring(index, startIndex))), 
                    exp = text.substring(startIndex + startSymbolLength, endIndex), expressions.push(exp), 
                    parseFns.push($parse(exp, parseStringifyInterceptor)), index = endIndex + endSymbolLength, 
                    expressionPositions.push(concat.length), concat.push("");
                }
                if (trustedContext && 1 < concat.length && $interpolateMinErr.throwNoconcat(text), 
                !mustHaveExpression || expressions.length) {
                    var compute = function(values) {
                        for (var i = 0, ii = expressions.length; i < ii; i++) {
                            if (allOrNothing && isUndefined(values[i])) return;
                            concat[expressionPositions[i]] = values[i];
                        }
                        return concat.join("");
                    }, getValue = function(value) {
                        return trustedContext ? $sce.getTrusted(trustedContext, value) : $sce.valueOf(value);
                    };
                    return extend(function(context) {
                        var i = 0, ii = expressions.length, values = new Array(ii);
                        try {
                            for (;i < ii; i++) values[i] = parseFns[i](context);
                            return compute(values);
                        } catch (err) {
                            $exceptionHandler($interpolateMinErr.interr(text, err));
                        }
                    }, {
                        exp: text,
                        expressions: expressions,
                        $$watchDelegate: function(scope, listener) {
                            var lastValue;
                            return scope.$watchGroup(parseFns, function(values, oldValues) {
                                var currValue = compute(values);
                                isFunction(listener) && listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope), 
                                lastValue = currValue;
                            });
                        }
                    });
                }
                function parseStringifyInterceptor(value) {
                    try {
                        return value = getValue(value), allOrNothing && !isDefined(value) ? value : function(value) {
                            if (null == value) return "";
                            switch (typeof value) {
                              case "string":
                                break;

                              case "number":
                                value = "" + value;
                                break;

                              default:
                                value = toJson(value);
                            }
                            return value;
                        }(value);
                    } catch (err) {
                        $exceptionHandler($interpolateMinErr.interr(text, err));
                    }
                }
            }
            return $interpolate.startSymbol = function() {
                return startSymbol;
            }, $interpolate.endSymbol = function() {
                return endSymbol;
            }, $interpolate;
        } ];
    }
    function $IntervalProvider() {
        this.$get = [ "$rootScope", "$window", "$q", "$$q", "$browser", function($rootScope, $window, $q, $$q, $browser) {
            var intervals = {};
            function interval(fn, delay, count, invokeApply) {
                var hasParams = 4 < arguments.length, args = hasParams ? sliceArgs(arguments, 4) : [], setInterval = $window.setInterval, clearInterval = $window.clearInterval, iteration = 0, skipApply = isDefined(invokeApply) && !invokeApply, deferred = (skipApply ? $$q : $q).defer(), promise = deferred.promise;
                return count = isDefined(count) ? count : 0, promise.$$intervalId = setInterval(function() {
                    skipApply ? $browser.defer(callback) : $rootScope.$evalAsync(callback), deferred.notify(iteration++), 
                    0 < count && count <= iteration && (deferred.resolve(iteration), clearInterval(promise.$$intervalId), 
                    delete intervals[promise.$$intervalId]), skipApply || $rootScope.$apply();
                }, delay), intervals[promise.$$intervalId] = deferred, promise;
                function callback() {
                    hasParams ? fn.apply(null, args) : fn(iteration);
                }
            }
            return interval.cancel = function(promise) {
                return !!(promise && promise.$$intervalId in intervals) && (intervals[promise.$$intervalId].reject("canceled"), 
                $window.clearInterval(promise.$$intervalId), delete intervals[promise.$$intervalId], 
                !0);
            }, interval;
        } ];
    }
    $interpolateMinErr.throwNoconcat = function(text) {
        throw $interpolateMinErr("noconcat", "Error while interpolating: {0}\nStrict Contextual Escaping disallows interpolations that concatenate multiple expressions when a trusted value is required.  See http://docs.angularjs.org/api/ng.$sce", text);
    }, $interpolateMinErr.interr = function(text, err) {
        return $interpolateMinErr("interr", "Can't interpolate: {0}\n{1}", text, err.toString());
    };
    var $jsonpCallbacksProvider = function() {
        this.$get = [ "$window", function($window) {
            var callbacks = $window.angular.callbacks, callbackMap = {};
            return {
                createCallback: function(url) {
                    var callbackId = "_" + (callbacks.$$counter++).toString(36), callbackPath = "angular.callbacks." + callbackId, callback = function(callbackId) {
                        var callback = function(data) {
                            callback.data = data, callback.called = !0;
                        };
                        return callback.id = callbackId, callback;
                    }(callbackId);
                    return callbackMap[callbackPath] = callbacks[callbackId] = callback, callbackPath;
                },
                wasCalled: function(callbackPath) {
                    return callbackMap[callbackPath].called;
                },
                getResponse: function(callbackPath) {
                    return callbackMap[callbackPath].data;
                },
                removeCallback: function(callbackPath) {
                    var callback = callbackMap[callbackPath];
                    delete callbacks[callback.id], delete callbackMap[callbackPath];
                }
            };
        } ];
    }, PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/, DEFAULT_PORTS = {
        http: 80,
        https: 443,
        ftp: 21
    }, $locationMinErr = minErr("$location");
    function encodePath(path) {
        for (var segments = path.split("/"), i = segments.length; i--; ) segments[i] = encodeUriSegment(segments[i]);
        return segments.join("/");
    }
    function parseAbsoluteUrl(absoluteUrl, locationObj) {
        var parsedUrl = urlResolve(absoluteUrl);
        locationObj.$$protocol = parsedUrl.protocol, locationObj.$$host = parsedUrl.hostname, 
        locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;
    }
    function parseAppUrl(relativeUrl, locationObj) {
        var prefixed = "/" !== relativeUrl.charAt(0);
        prefixed && (relativeUrl = "/" + relativeUrl);
        var match = urlResolve(relativeUrl);
        locationObj.$$path = decodeURIComponent(prefixed && "/" === match.pathname.charAt(0) ? match.pathname.substring(1) : match.pathname), 
        locationObj.$$search = parseKeyValue(match.search), locationObj.$$hash = decodeURIComponent(match.hash), 
        locationObj.$$path && "/" != locationObj.$$path.charAt(0) && (locationObj.$$path = "/" + locationObj.$$path);
    }
    function startsWith(haystack, needle) {
        return 0 === haystack.lastIndexOf(needle, 0);
    }
    function stripBaseUrl(base, url) {
        if (startsWith(url, base)) return url.substr(base.length);
    }
    function stripHash(url) {
        var index = url.indexOf("#");
        return -1 == index ? url : url.substr(0, index);
    }
    function trimEmptyHash(url) {
        return url.replace(/(#.+)|#$/, "$1");
    }
    function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
        this.$$html5 = !0, basePrefix = basePrefix || "", parseAbsoluteUrl(appBase, this), 
        this.$$parse = function(url) {
            var pathUrl = stripBaseUrl(appBaseNoFile, url);
            if (!isString(pathUrl)) throw $locationMinErr("ipthprfx", 'Invalid url "{0}", missing path prefix "{1}".', url, appBaseNoFile);
            parseAppUrl(pathUrl, this), this.$$path || (this.$$path = "/"), this.$$compose();
        }, this.$$compose = function() {
            var search = toKeyValue(this.$$search), hash = this.$$hash ? "#" + encodeUriSegment(this.$$hash) : "";
            this.$$url = encodePath(this.$$path) + (search ? "?" + search : "") + hash, this.$$absUrl = appBaseNoFile + this.$$url.substr(1);
        }, this.$$parseLinkUrl = function(url, relHref) {
            return relHref && "#" === relHref[0] ? (this.hash(relHref.slice(1)), !0) : (isDefined(appUrl = stripBaseUrl(appBase, url)) ? rewrittenUrl = isDefined(appUrl = stripBaseUrl(basePrefix, prevAppUrl = appUrl)) ? appBaseNoFile + (stripBaseUrl("/", appUrl) || appUrl) : appBase + prevAppUrl : isDefined(appUrl = stripBaseUrl(appBaseNoFile, url)) ? rewrittenUrl = appBaseNoFile + appUrl : appBaseNoFile == url + "/" && (rewrittenUrl = appBaseNoFile), 
            rewrittenUrl && this.$$parse(rewrittenUrl), !!rewrittenUrl);
            var appUrl, prevAppUrl, rewrittenUrl;
        };
    }
    function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
        parseAbsoluteUrl(appBase, this), this.$$parse = function(url) {
            var withoutHashUrl, withoutBaseUrl = stripBaseUrl(appBase, url) || stripBaseUrl(appBaseNoFile, url);
            isUndefined(withoutBaseUrl) || "#" !== withoutBaseUrl.charAt(0) ? this.$$html5 ? withoutHashUrl = withoutBaseUrl : (withoutHashUrl = "", 
            isUndefined(withoutBaseUrl) && (appBase = url, this.replace())) : isUndefined(withoutHashUrl = stripBaseUrl(hashPrefix, withoutBaseUrl)) && (withoutHashUrl = withoutBaseUrl), 
            parseAppUrl(withoutHashUrl, this), this.$$path = function(path, url, base) {
                var firstPathSegmentMatch, windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
                startsWith(url, base) && (url = url.replace(base, ""));
                if (windowsFilePathExp.exec(url)) return path;
                return (firstPathSegmentMatch = windowsFilePathExp.exec(path)) ? firstPathSegmentMatch[1] : path;
            }(this.$$path, withoutHashUrl, appBase), this.$$compose();
        }, this.$$compose = function() {
            var search = toKeyValue(this.$$search), hash = this.$$hash ? "#" + encodeUriSegment(this.$$hash) : "";
            this.$$url = encodePath(this.$$path) + (search ? "?" + search : "") + hash, this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : "");
        }, this.$$parseLinkUrl = function(url, relHref) {
            return stripHash(appBase) == stripHash(url) && (this.$$parse(url), !0);
        };
    }
    function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
        this.$$html5 = !0, LocationHashbangUrl.apply(this, arguments), this.$$parseLinkUrl = function(url, relHref) {
            return relHref && "#" === relHref[0] ? (this.hash(relHref.slice(1)), !0) : (appBase == stripHash(url) ? rewrittenUrl = url : (appUrl = stripBaseUrl(appBaseNoFile, url)) ? rewrittenUrl = appBase + hashPrefix + appUrl : appBaseNoFile === url + "/" && (rewrittenUrl = appBaseNoFile), 
            rewrittenUrl && this.$$parse(rewrittenUrl), !!rewrittenUrl);
            var rewrittenUrl, appUrl;
        }, this.$$compose = function() {
            var search = toKeyValue(this.$$search), hash = this.$$hash ? "#" + encodeUriSegment(this.$$hash) : "";
            this.$$url = encodePath(this.$$path) + (search ? "?" + search : "") + hash, this.$$absUrl = appBase + hashPrefix + this.$$url;
        };
    }
    var locationPrototype = {
        $$absUrl: "",
        $$html5: !1,
        $$replace: !1,
        absUrl: locationGetter("$$absUrl"),
        url: function(url) {
            if (isUndefined(url)) return this.$$url;
            var match = PATH_MATCH.exec(url);
            return (match[1] || "" === url) && this.path(decodeURIComponent(match[1])), (match[2] || match[1] || "" === url) && this.search(match[3] || ""), 
            this.hash(match[5] || ""), this;
        },
        protocol: locationGetter("$$protocol"),
        host: locationGetter("$$host"),
        port: locationGetter("$$port"),
        path: locationGetterSetter("$$path", function(path) {
            return "/" == (path = null !== path ? path.toString() : "").charAt(0) ? path : "/" + path;
        }),
        search: function(search, paramValue) {
            switch (arguments.length) {
              case 0:
                return this.$$search;

              case 1:
                if (isString(search) || isNumber(search)) search = search.toString(), this.$$search = parseKeyValue(search); else {
                    if (!isObject(search)) throw $locationMinErr("isrcharg", "The first argument of the `$location#search()` call must be a string or an object.");
                    forEach(search = copy(search, {}), function(value, key) {
                        null == value && delete search[key];
                    }), this.$$search = search;
                }
                break;

              default:
                isUndefined(paramValue) || null === paramValue ? delete this.$$search[search] : this.$$search[search] = paramValue;
            }
            return this.$$compose(), this;
        },
        hash: locationGetterSetter("$$hash", function(hash) {
            return null !== hash ? hash.toString() : "";
        }),
        replace: function() {
            return this.$$replace = !0, this;
        }
    };
    function locationGetter(property) {
        return function() {
            return this[property];
        };
    }
    function locationGetterSetter(property, preprocess) {
        return function(value) {
            return isUndefined(value) ? this[property] : (this[property] = preprocess(value), 
            this.$$compose(), this);
        };
    }
    function $LocationProvider() {
        var hashPrefix = "", html5Mode = {
            enabled: !1,
            requireBase: !0,
            rewriteLinks: !0
        };
        this.hashPrefix = function(prefix) {
            return isDefined(prefix) ? (hashPrefix = prefix, this) : hashPrefix;
        }, this.html5Mode = function(mode) {
            return isBoolean(mode) ? (html5Mode.enabled = mode, this) : isObject(mode) ? (isBoolean(mode.enabled) && (html5Mode.enabled = mode.enabled), 
            isBoolean(mode.requireBase) && (html5Mode.requireBase = mode.requireBase), isBoolean(mode.rewriteLinks) && (html5Mode.rewriteLinks = mode.rewriteLinks), 
            this) : html5Mode;
        }, this.$get = [ "$rootScope", "$browser", "$sniffer", "$rootElement", "$window", function($rootScope, $browser, $sniffer, $rootElement, $window) {
            var $location, LocationMode, appBase, url, baseHref = $browser.baseHref(), initialUrl = $browser.url();
            if (html5Mode.enabled) {
                if (!baseHref && html5Mode.requireBase) throw $locationMinErr("nobase", "$location in HTML5 mode requires a <base> tag to be present!");
                appBase = (url = initialUrl).substring(0, url.indexOf("/", url.indexOf("//") + 2)) + (baseHref || "/"), 
                LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;
            } else appBase = stripHash(initialUrl), LocationMode = LocationHashbangUrl;
            var appBaseNoFile = function(url) {
                return url.substr(0, stripHash(url).lastIndexOf("/") + 1);
            }(appBase);
            ($location = new LocationMode(appBase, appBaseNoFile, "#" + hashPrefix)).$$parseLinkUrl(initialUrl, initialUrl), 
            $location.$$state = $browser.state();
            var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
            function setBrowserUrlWithFallback(url, replace, state) {
                var oldUrl = $location.url(), oldState = $location.$$state;
                try {
                    $browser.url(url, replace, state), $location.$$state = $browser.state();
                } catch (e) {
                    throw $location.url(oldUrl), $location.$$state = oldState, e;
                }
            }
            $rootElement.on("click", function(event) {
                if (html5Mode.rewriteLinks && !event.ctrlKey && !event.metaKey && !event.shiftKey && 2 != event.which && 2 != event.button) {
                    for (var elm = jqLite(event.target); "a" !== nodeName_(elm[0]); ) if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;
                    var absHref = elm.prop("href"), relHref = elm.attr("href") || elm.attr("xlink:href");
                    isObject(absHref) && "[object SVGAnimatedString]" === absHref.toString() && (absHref = urlResolve(absHref.animVal).href), 
                    IGNORE_URI_REGEXP.test(absHref) || !absHref || elm.attr("target") || event.isDefaultPrevented() || $location.$$parseLinkUrl(absHref, relHref) && (event.preventDefault(), 
                    $location.absUrl() != $browser.url() && ($rootScope.$apply(), $window.angular["ff-684208-preventDefault"] = !0));
                }
            }), trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl) && $browser.url($location.absUrl(), !0);
            var initializing = !0;
            return $browser.onUrlChange(function(newUrl, newState) {
                isUndefined(stripBaseUrl(appBaseNoFile, newUrl)) ? $window.location.href = newUrl : ($rootScope.$evalAsync(function() {
                    var defaultPrevented, oldUrl = $location.absUrl(), oldState = $location.$$state;
                    newUrl = trimEmptyHash(newUrl), $location.$$parse(newUrl), $location.$$state = newState, 
                    defaultPrevented = $rootScope.$broadcast("$locationChangeStart", newUrl, oldUrl, newState, oldState).defaultPrevented, 
                    $location.absUrl() === newUrl && (defaultPrevented ? ($location.$$parse(oldUrl), 
                    setBrowserUrlWithFallback(oldUrl, !1, $location.$$state = oldState)) : (initializing = !1, 
                    afterLocationChange(oldUrl, oldState)));
                }), $rootScope.$$phase || $rootScope.$digest());
            }), $rootScope.$watch(function() {
                var oldUrl = trimEmptyHash($browser.url()), newUrl = trimEmptyHash($location.absUrl()), oldState = $browser.state(), currentReplace = $location.$$replace, urlOrStateChanged = oldUrl !== newUrl || $location.$$html5 && $sniffer.history && oldState !== $location.$$state;
                (initializing || urlOrStateChanged) && (initializing = !1, $rootScope.$evalAsync(function() {
                    var newUrl = $location.absUrl(), defaultPrevented = $rootScope.$broadcast("$locationChangeStart", newUrl, oldUrl, $location.$$state, oldState).defaultPrevented;
                    $location.absUrl() === newUrl && (defaultPrevented ? ($location.$$parse(oldUrl), 
                    $location.$$state = oldState) : (urlOrStateChanged && setBrowserUrlWithFallback(newUrl, currentReplace, oldState === $location.$$state ? null : $location.$$state), 
                    afterLocationChange(oldUrl, oldState)));
                })), $location.$$replace = !1;
            }), $location;
            function afterLocationChange(oldUrl, oldState) {
                $rootScope.$broadcast("$locationChangeSuccess", $location.absUrl(), oldUrl, $location.$$state, oldState);
            }
        } ];
    }
    function $LogProvider() {
        var debug = !0, self = this;
        this.debugEnabled = function(flag) {
            return isDefined(flag) ? (debug = flag, this) : debug;
        }, this.$get = [ "$window", function($window) {
            return {
                log: consoleLog("log"),
                info: consoleLog("info"),
                warn: consoleLog("warn"),
                error: consoleLog("error"),
                debug: (fn = consoleLog("debug"), function() {
                    debug && fn.apply(self, arguments);
                })
            };
            var fn;
            function consoleLog(type) {
                var console = $window.console || {}, logFn = console[type] || console.log || noop, hasApply = !1;
                try {
                    hasApply = !!logFn.apply;
                } catch (e) {}
                return hasApply ? function() {
                    var args = [];
                    return forEach(arguments, function(arg) {
                        args.push(function(arg) {
                            return arg instanceof Error && (arg.stack ? arg = arg.message && -1 === arg.stack.indexOf(arg.message) ? "Error: " + arg.message + "\n" + arg.stack : arg.stack : arg.sourceURL && (arg = arg.message + "\n" + arg.sourceURL + ":" + arg.line)), 
                            arg;
                        }(arg));
                    }), logFn.apply(console, args);
                } : function(arg1, arg2) {
                    logFn(arg1, null == arg2 ? "" : arg2);
                };
            }
        } ];
    }
    forEach([ LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url ], function(Location) {
        Location.prototype = Object.create(locationPrototype), Location.prototype.state = function(state) {
            if (!arguments.length) return this.$$state;
            if (Location !== LocationHtml5Url || !this.$$html5) throw $locationMinErr("nostate", "History API state support is available only in HTML5 mode and only in browsers supporting HTML5 History API");
            return this.$$state = isUndefined(state) ? null : state, this;
        };
    });
    var $parseMinErr = minErr("$parse");
    function ensureSafeMemberName(name, fullExpression) {
        if ("__defineGetter__" === name || "__defineSetter__" === name || "__lookupGetter__" === name || "__lookupSetter__" === name || "__proto__" === name) throw $parseMinErr("isecfld", "Attempting to access a disallowed field in Angular expressions! Expression: {0}", fullExpression);
        return name;
    }
    function getStringValue(name) {
        return name + "";
    }
    function ensureSafeObject(obj, fullExpression) {
        if (obj) {
            if (obj.constructor === obj) throw $parseMinErr("isecfn", "Referencing Function in Angular expressions is disallowed! Expression: {0}", fullExpression);
            if (obj.window === obj) throw $parseMinErr("isecwindow", "Referencing the Window in Angular expressions is disallowed! Expression: {0}", fullExpression);
            if (obj.children && (obj.nodeName || obj.prop && obj.attr && obj.find)) throw $parseMinErr("isecdom", "Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}", fullExpression);
            if (obj === Object) throw $parseMinErr("isecobj", "Referencing Object in Angular expressions is disallowed! Expression: {0}", fullExpression);
        }
        return obj;
    }
    var CALL = Function.prototype.call, APPLY = Function.prototype.apply, BIND = Function.prototype.bind;
    function ensureSafeFunction(obj, fullExpression) {
        if (obj) {
            if (obj.constructor === obj) throw $parseMinErr("isecfn", "Referencing Function in Angular expressions is disallowed! Expression: {0}", fullExpression);
            if (obj === CALL || obj === APPLY || obj === BIND) throw $parseMinErr("isecff", "Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}", fullExpression);
        }
    }
    function ensureSafeAssignContext(obj, fullExpression) {
        if (obj && (obj === (0).constructor || obj === (!1).constructor || obj === "".constructor || obj === {}.constructor || obj === [].constructor || obj === Function.constructor)) throw $parseMinErr("isecaf", "Assigning to a constructor is disallowed! Expression: {0}", fullExpression);
    }
    var OPERATORS = createMap();
    forEach("+ - * / % === !== == != < > <= >= && || ! = |".split(" "), function(operator) {
        OPERATORS[operator] = !0;
    });
    var ESCAPE = {
        n: "\n",
        f: "\f",
        r: "\r",
        t: "\t",
        v: "\v",
        "'": "'",
        '"': '"'
    }, Lexer = function(options) {
        this.options = options;
    };
    Lexer.prototype = {
        constructor: Lexer,
        lex: function(text) {
            for (this.text = text, this.index = 0, this.tokens = []; this.index < this.text.length; ) {
                var ch = this.text.charAt(this.index);
                if ('"' === ch || "'" === ch) this.readString(ch); else if (this.isNumber(ch) || "." === ch && this.isNumber(this.peek())) this.readNumber(); else if (this.isIdentifierStart(this.peekMultichar())) this.readIdent(); else if (this.is(ch, "(){}[].,;:?")) this.tokens.push({
                    index: this.index,
                    text: ch
                }), this.index++; else if (this.isWhitespace(ch)) this.index++; else {
                    var ch2 = ch + this.peek(), ch3 = ch2 + this.peek(2), op1 = OPERATORS[ch], op2 = OPERATORS[ch2], op3 = OPERATORS[ch3];
                    if (op1 || op2 || op3) {
                        var token = op3 ? ch3 : op2 ? ch2 : ch;
                        this.tokens.push({
                            index: this.index,
                            text: token,
                            operator: !0
                        }), this.index += token.length;
                    } else this.throwError("Unexpected next character ", this.index, this.index + 1);
                }
            }
            return this.tokens;
        },
        is: function(ch, chars) {
            return -1 !== chars.indexOf(ch);
        },
        peek: function(i) {
            var num = i || 1;
            return this.index + num < this.text.length && this.text.charAt(this.index + num);
        },
        isNumber: function(ch) {
            return "0" <= ch && ch <= "9" && "string" == typeof ch;
        },
        isWhitespace: function(ch) {
            return " " === ch || "\r" === ch || "\t" === ch || "\n" === ch || "\v" === ch || " " === ch;
        },
        isIdentifierStart: function(ch) {
            return this.options.isIdentifierStart ? this.options.isIdentifierStart(ch, this.codePointAt(ch)) : this.isValidIdentifierStart(ch);
        },
        isValidIdentifierStart: function(ch) {
            return "a" <= ch && ch <= "z" || "A" <= ch && ch <= "Z" || "_" === ch || "$" === ch;
        },
        isIdentifierContinue: function(ch) {
            return this.options.isIdentifierContinue ? this.options.isIdentifierContinue(ch, this.codePointAt(ch)) : this.isValidIdentifierContinue(ch);
        },
        isValidIdentifierContinue: function(ch, cp) {
            return this.isValidIdentifierStart(ch, cp) || this.isNumber(ch);
        },
        codePointAt: function(ch) {
            return 1 === ch.length ? ch.charCodeAt(0) : (ch.charCodeAt(0) << 10) + ch.charCodeAt(1) - 56613888;
        },
        peekMultichar: function() {
            var ch = this.text.charAt(this.index), peek = this.peek();
            if (!peek) return ch;
            var cp1 = ch.charCodeAt(0), cp2 = peek.charCodeAt(0);
            return 55296 <= cp1 && cp1 <= 56319 && 56320 <= cp2 && cp2 <= 57343 ? ch + peek : ch;
        },
        isExpOperator: function(ch) {
            return "-" === ch || "+" === ch || this.isNumber(ch);
        },
        throwError: function(error, start, end) {
            end = end || this.index;
            var colStr = isDefined(start) ? "s " + start + "-" + this.index + " [" + this.text.substring(start, end) + "]" : " " + end;
            throw $parseMinErr("lexerr", "Lexer Error: {0} at column{1} in expression [{2}].", error, colStr, this.text);
        },
        readNumber: function() {
            for (var number = "", start = this.index; this.index < this.text.length; ) {
                var ch = lowercase(this.text.charAt(this.index));
                if ("." == ch || this.isNumber(ch)) number += ch; else {
                    var peekCh = this.peek();
                    if ("e" == ch && this.isExpOperator(peekCh)) number += ch; else if (this.isExpOperator(ch) && peekCh && this.isNumber(peekCh) && "e" == number.charAt(number.length - 1)) number += ch; else {
                        if (!this.isExpOperator(ch) || peekCh && this.isNumber(peekCh) || "e" != number.charAt(number.length - 1)) break;
                        this.throwError("Invalid exponent");
                    }
                }
                this.index++;
            }
            this.tokens.push({
                index: start,
                text: number,
                constant: !0,
                value: Number(number)
            });
        },
        readIdent: function() {
            var start = this.index;
            for (this.index += this.peekMultichar().length; this.index < this.text.length; ) {
                var ch = this.peekMultichar();
                if (!this.isIdentifierContinue(ch)) break;
                this.index += ch.length;
            }
            this.tokens.push({
                index: start,
                text: this.text.slice(start, this.index),
                identifier: !0
            });
        },
        readString: function(quote) {
            var start = this.index;
            this.index++;
            for (var string = "", rawString = quote, escape = !1; this.index < this.text.length; ) {
                var ch = this.text.charAt(this.index);
                if (rawString += ch, escape) {
                    if ("u" === ch) {
                        var hex = this.text.substring(this.index + 1, this.index + 5);
                        hex.match(/[\da-f]{4}/i) || this.throwError("Invalid unicode escape [\\u" + hex + "]"), 
                        this.index += 4, string += String.fromCharCode(parseInt(hex, 16));
                    } else {
                        string += ESCAPE[ch] || ch;
                    }
                    escape = !1;
                } else if ("\\" === ch) escape = !0; else {
                    if (ch === quote) return this.index++, void this.tokens.push({
                        index: start,
                        text: rawString,
                        constant: !0,
                        value: string
                    });
                    string += ch;
                }
                this.index++;
            }
            this.throwError("Unterminated quote", start);
        }
    };
    var AST = function(lexer, options) {
        this.lexer = lexer, this.options = options;
    };
    function ifDefined(v, d) {
        return void 0 !== v ? v : d;
    }
    function plusFn(l, r) {
        return void 0 === l ? r : void 0 === r ? l : l + r;
    }
    function isStateless($filter, filterName) {
        return !$filter(filterName).$stateful;
    }
    function findConstantAndWatchExpressions(ast, $filter) {
        var allConstants, argsToWatch;
        switch (ast.type) {
          case AST.Program:
            allConstants = !0, forEach(ast.body, function(expr) {
                findConstantAndWatchExpressions(expr.expression, $filter), allConstants = allConstants && expr.expression.constant;
            }), ast.constant = allConstants;
            break;

          case AST.Literal:
            ast.constant = !0, ast.toWatch = [];
            break;

          case AST.UnaryExpression:
            findConstantAndWatchExpressions(ast.argument, $filter), ast.constant = ast.argument.constant, 
            ast.toWatch = ast.argument.toWatch;
            break;

          case AST.BinaryExpression:
            findConstantAndWatchExpressions(ast.left, $filter), findConstantAndWatchExpressions(ast.right, $filter), 
            ast.constant = ast.left.constant && ast.right.constant, ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch);
            break;

          case AST.LogicalExpression:
            findConstantAndWatchExpressions(ast.left, $filter), findConstantAndWatchExpressions(ast.right, $filter), 
            ast.constant = ast.left.constant && ast.right.constant, ast.toWatch = ast.constant ? [] : [ ast ];
            break;

          case AST.ConditionalExpression:
            findConstantAndWatchExpressions(ast.test, $filter), findConstantAndWatchExpressions(ast.alternate, $filter), 
            findConstantAndWatchExpressions(ast.consequent, $filter), ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant, 
            ast.toWatch = ast.constant ? [] : [ ast ];
            break;

          case AST.Identifier:
            ast.constant = !1, ast.toWatch = [ ast ];
            break;

          case AST.MemberExpression:
            findConstantAndWatchExpressions(ast.object, $filter), ast.computed && findConstantAndWatchExpressions(ast.property, $filter), 
            ast.constant = ast.object.constant && (!ast.computed || ast.property.constant), 
            ast.toWatch = [ ast ];
            break;

          case AST.CallExpression:
            allConstants = !!ast.filter && isStateless($filter, ast.callee.name), argsToWatch = [], 
            forEach(ast.arguments, function(expr) {
                findConstantAndWatchExpressions(expr, $filter), allConstants = allConstants && expr.constant, 
                expr.constant || argsToWatch.push.apply(argsToWatch, expr.toWatch);
            }), ast.constant = allConstants, ast.toWatch = ast.filter && isStateless($filter, ast.callee.name) ? argsToWatch : [ ast ];
            break;

          case AST.AssignmentExpression:
            findConstantAndWatchExpressions(ast.left, $filter), findConstantAndWatchExpressions(ast.right, $filter), 
            ast.constant = ast.left.constant && ast.right.constant, ast.toWatch = [ ast ];
            break;

          case AST.ArrayExpression:
            allConstants = !0, argsToWatch = [], forEach(ast.elements, function(expr) {
                findConstantAndWatchExpressions(expr, $filter), allConstants = allConstants && expr.constant, 
                expr.constant || argsToWatch.push.apply(argsToWatch, expr.toWatch);
            }), ast.constant = allConstants, ast.toWatch = argsToWatch;
            break;

          case AST.ObjectExpression:
            allConstants = !0, argsToWatch = [], forEach(ast.properties, function(property) {
                findConstantAndWatchExpressions(property.value, $filter), allConstants = allConstants && property.value.constant && !property.computed, 
                property.value.constant || argsToWatch.push.apply(argsToWatch, property.value.toWatch);
            }), ast.constant = allConstants, ast.toWatch = argsToWatch;
            break;

          case AST.ThisExpression:
          case AST.LocalsExpression:
            ast.constant = !1, ast.toWatch = [];
        }
    }
    function getInputs(body) {
        if (1 == body.length) {
            var lastExpression = body[0].expression, candidate = lastExpression.toWatch;
            return 1 !== candidate.length ? candidate : candidate[0] !== lastExpression ? candidate : void 0;
        }
    }
    function isAssignable(ast) {
        return ast.type === AST.Identifier || ast.type === AST.MemberExpression;
    }
    function assignableAST(ast) {
        if (1 === ast.body.length && isAssignable(ast.body[0].expression)) return {
            type: AST.AssignmentExpression,
            left: ast.body[0].expression,
            right: {
                type: AST.NGValueParameter
            },
            operator: "="
        };
    }
    function isLiteral(ast) {
        return 0 === ast.body.length || 1 === ast.body.length && (ast.body[0].expression.type === AST.Literal || ast.body[0].expression.type === AST.ArrayExpression || ast.body[0].expression.type === AST.ObjectExpression);
    }
    function isConstant(ast) {
        return ast.constant;
    }
    function ASTCompiler(astBuilder, $filter) {
        this.astBuilder = astBuilder, this.$filter = $filter;
    }
    function ASTInterpreter(astBuilder, $filter) {
        this.astBuilder = astBuilder, this.$filter = $filter;
    }
    AST.Program = "Program", AST.ExpressionStatement = "ExpressionStatement", AST.AssignmentExpression = "AssignmentExpression", 
    AST.ConditionalExpression = "ConditionalExpression", AST.LogicalExpression = "LogicalExpression", 
    AST.BinaryExpression = "BinaryExpression", AST.UnaryExpression = "UnaryExpression", 
    AST.CallExpression = "CallExpression", AST.MemberExpression = "MemberExpression", 
    AST.Identifier = "Identifier", AST.Literal = "Literal", AST.ArrayExpression = "ArrayExpression", 
    AST.Property = "Property", AST.ObjectExpression = "ObjectExpression", AST.ThisExpression = "ThisExpression", 
    AST.LocalsExpression = "LocalsExpression", AST.NGValueParameter = "NGValueParameter", 
    AST.prototype = {
        ast: function(text) {
            this.text = text, this.tokens = this.lexer.lex(text);
            var value = this.program();
            return 0 !== this.tokens.length && this.throwError("is an unexpected token", this.tokens[0]), 
            value;
        },
        program: function() {
            for (var body = []; ;) if (0 < this.tokens.length && !this.peek("}", ")", ";", "]") && body.push(this.expressionStatement()), 
            !this.expect(";")) return {
                type: AST.Program,
                body: body
            };
        },
        expressionStatement: function() {
            return {
                type: AST.ExpressionStatement,
                expression: this.filterChain()
            };
        },
        filterChain: function() {
            for (var left = this.expression(); this.expect("|"); ) left = this.filter(left);
            return left;
        },
        expression: function() {
            return this.assignment();
        },
        assignment: function() {
            var result = this.ternary();
            return this.expect("=") && (result = {
                type: AST.AssignmentExpression,
                left: result,
                right: this.assignment(),
                operator: "="
            }), result;
        },
        ternary: function() {
            var alternate, consequent, test = this.logicalOR();
            return this.expect("?") && (alternate = this.expression(), this.consume(":")) ? (consequent = this.expression(), 
            {
                type: AST.ConditionalExpression,
                test: test,
                alternate: alternate,
                consequent: consequent
            }) : test;
        },
        logicalOR: function() {
            for (var left = this.logicalAND(); this.expect("||"); ) left = {
                type: AST.LogicalExpression,
                operator: "||",
                left: left,
                right: this.logicalAND()
            };
            return left;
        },
        logicalAND: function() {
            for (var left = this.equality(); this.expect("&&"); ) left = {
                type: AST.LogicalExpression,
                operator: "&&",
                left: left,
                right: this.equality()
            };
            return left;
        },
        equality: function() {
            for (var token, left = this.relational(); token = this.expect("==", "!=", "===", "!=="); ) left = {
                type: AST.BinaryExpression,
                operator: token.text,
                left: left,
                right: this.relational()
            };
            return left;
        },
        relational: function() {
            for (var token, left = this.additive(); token = this.expect("<", ">", "<=", ">="); ) left = {
                type: AST.BinaryExpression,
                operator: token.text,
                left: left,
                right: this.additive()
            };
            return left;
        },
        additive: function() {
            for (var token, left = this.multiplicative(); token = this.expect("+", "-"); ) left = {
                type: AST.BinaryExpression,
                operator: token.text,
                left: left,
                right: this.multiplicative()
            };
            return left;
        },
        multiplicative: function() {
            for (var token, left = this.unary(); token = this.expect("*", "/", "%"); ) left = {
                type: AST.BinaryExpression,
                operator: token.text,
                left: left,
                right: this.unary()
            };
            return left;
        },
        unary: function() {
            var token;
            return (token = this.expect("+", "-", "!")) ? {
                type: AST.UnaryExpression,
                operator: token.text,
                prefix: !0,
                argument: this.unary()
            } : this.primary();
        },
        primary: function() {
            var primary, next;
            for (this.expect("(") ? (primary = this.filterChain(), this.consume(")")) : this.expect("[") ? primary = this.arrayDeclaration() : this.expect("{") ? primary = this.object() : this.selfReferential.hasOwnProperty(this.peek().text) ? primary = copy(this.selfReferential[this.consume().text]) : this.options.literals.hasOwnProperty(this.peek().text) ? primary = {
                type: AST.Literal,
                value: this.options.literals[this.consume().text]
            } : this.peek().identifier ? primary = this.identifier() : this.peek().constant ? primary = this.constant() : this.throwError("not a primary expression", this.peek()); next = this.expect("(", "[", "."); ) "(" === next.text ? (primary = {
                type: AST.CallExpression,
                callee: primary,
                arguments: this.parseArguments()
            }, this.consume(")")) : "[" === next.text ? (primary = {
                type: AST.MemberExpression,
                object: primary,
                property: this.expression(),
                computed: !0
            }, this.consume("]")) : "." === next.text ? primary = {
                type: AST.MemberExpression,
                object: primary,
                property: this.identifier(),
                computed: !1
            } : this.throwError("IMPOSSIBLE");
            return primary;
        },
        filter: function(baseExpression) {
            for (var args = [ baseExpression ], result = {
                type: AST.CallExpression,
                callee: this.identifier(),
                arguments: args,
                filter: !0
            }; this.expect(":"); ) args.push(this.expression());
            return result;
        },
        parseArguments: function() {
            var args = [];
            if (")" !== this.peekToken().text) for (;args.push(this.filterChain()), this.expect(","); ) ;
            return args;
        },
        identifier: function() {
            var token = this.consume();
            return token.identifier || this.throwError("is not a valid identifier", token), 
            {
                type: AST.Identifier,
                name: token.text
            };
        },
        constant: function() {
            return {
                type: AST.Literal,
                value: this.consume().value
            };
        },
        arrayDeclaration: function() {
            var elements = [];
            if ("]" !== this.peekToken().text) do {
                if (this.peek("]")) break;
                elements.push(this.expression());
            } while (this.expect(","));
            return this.consume("]"), {
                type: AST.ArrayExpression,
                elements: elements
            };
        },
        object: function() {
            var property, properties = [];
            if ("}" !== this.peekToken().text) do {
                if (this.peek("}")) break;
                property = {
                    type: AST.Property,
                    kind: "init"
                }, this.peek().constant ? (property.key = this.constant(), property.computed = !1, 
                this.consume(":"), property.value = this.expression()) : this.peek().identifier ? (property.key = this.identifier(), 
                property.computed = !1, this.peek(":") ? (this.consume(":"), property.value = this.expression()) : property.value = property.key) : this.peek("[") ? (this.consume("["), 
                property.key = this.expression(), this.consume("]"), property.computed = !0, this.consume(":"), 
                property.value = this.expression()) : this.throwError("invalid key", this.peek()), 
                properties.push(property);
            } while (this.expect(","));
            return this.consume("}"), {
                type: AST.ObjectExpression,
                properties: properties
            };
        },
        throwError: function(msg, token) {
            throw $parseMinErr("syntax", "Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].", token.text, msg, token.index + 1, this.text, this.text.substring(token.index));
        },
        consume: function(e1) {
            if (0 === this.tokens.length) throw $parseMinErr("ueoe", "Unexpected end of expression: {0}", this.text);
            var token = this.expect(e1);
            return token || this.throwError("is unexpected, expecting [" + e1 + "]", this.peek()), 
            token;
        },
        peekToken: function() {
            if (0 === this.tokens.length) throw $parseMinErr("ueoe", "Unexpected end of expression: {0}", this.text);
            return this.tokens[0];
        },
        peek: function(e1, e2, e3, e4) {
            return this.peekAhead(0, e1, e2, e3, e4);
        },
        peekAhead: function(i, e1, e2, e3, e4) {
            if (this.tokens.length > i) {
                var token = this.tokens[i], t = token.text;
                if (t === e1 || t === e2 || t === e3 || t === e4 || !e1 && !e2 && !e3 && !e4) return token;
            }
            return !1;
        },
        expect: function(e1, e2, e3, e4) {
            var token = this.peek(e1, e2, e3, e4);
            return !!token && (this.tokens.shift(), token);
        },
        selfReferential: {
            this: {
                type: AST.ThisExpression
            },
            $locals: {
                type: AST.LocalsExpression
            }
        }
    }, ASTCompiler.prototype = {
        compile: function(expression, expensiveChecks) {
            var self = this, ast = this.astBuilder.ast(expression);
            this.state = {
                nextId: 0,
                filters: {},
                expensiveChecks: expensiveChecks,
                fn: {
                    vars: [],
                    body: [],
                    own: {}
                },
                assign: {
                    vars: [],
                    body: [],
                    own: {}
                },
                inputs: []
            }, findConstantAndWatchExpressions(ast, self.$filter);
            var assignable, extra = "";
            if (this.stage = "assign", assignable = assignableAST(ast)) {
                this.state.computing = "assign";
                var result = this.nextId();
                this.recurse(assignable, result), this.return_(result), extra = "fn.assign=" + this.generateFunction("assign", "s,v,l");
            }
            var toWatch = getInputs(ast.body);
            self.stage = "inputs", forEach(toWatch, function(watch, key) {
                var fnKey = "fn" + key;
                self.state[fnKey] = {
                    vars: [],
                    body: [],
                    own: {}
                }, self.state.computing = fnKey;
                var intoId = self.nextId();
                self.recurse(watch, intoId), self.return_(intoId), self.state.inputs.push(fnKey), 
                watch.watchId = key;
            }), this.state.computing = "fn", this.stage = "main", this.recurse(ast);
            var fnString = '"' + this.USE + " " + this.STRICT + '";\n' + this.filterPrefix() + "var fn=" + this.generateFunction("fn", "s,l,a,i") + extra + this.watchFns() + "return fn;", fn = new Function("$filter", "ensureSafeMemberName", "ensureSafeObject", "ensureSafeFunction", "getStringValue", "ensureSafeAssignContext", "ifDefined", "plus", "text", fnString)(this.$filter, ensureSafeMemberName, ensureSafeObject, ensureSafeFunction, getStringValue, ensureSafeAssignContext, ifDefined, plusFn, expression);
            return this.state = this.stage = void 0, fn.literal = isLiteral(ast), fn.constant = isConstant(ast), 
            fn;
        },
        USE: "use",
        STRICT: "strict",
        watchFns: function() {
            var result = [], fns = this.state.inputs, self = this;
            return forEach(fns, function(name) {
                result.push("var " + name + "=" + self.generateFunction(name, "s"));
            }), fns.length && result.push("fn.inputs=[" + fns.join(",") + "];"), result.join("");
        },
        generateFunction: function(name, params) {
            return "function(" + params + "){" + this.varsPrefix(name) + this.body(name) + "};";
        },
        filterPrefix: function() {
            var parts = [], self = this;
            return forEach(this.state.filters, function(id, filter) {
                parts.push(id + "=$filter(" + self.escape(filter) + ")");
            }), parts.length ? "var " + parts.join(",") + ";" : "";
        },
        varsPrefix: function(section) {
            return this.state[section].vars.length ? "var " + this.state[section].vars.join(",") + ";" : "";
        },
        body: function(section) {
            return this.state[section].body.join("");
        },
        recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
            var left, right, args, expression, computed, self = this;
            if (recursionFn = recursionFn || noop, !skipWatchIdCheck && isDefined(ast.watchId)) return intoId = intoId || this.nextId(), 
            void this.if_("i", this.lazyAssign(intoId, this.computedMember("i", ast.watchId)), this.lazyRecurse(ast, intoId, nameId, recursionFn, create, !0));
            switch (ast.type) {
              case AST.Program:
                forEach(ast.body, function(expression, pos) {
                    self.recurse(expression.expression, void 0, void 0, function(expr) {
                        right = expr;
                    }), pos !== ast.body.length - 1 ? self.current().body.push(right, ";") : self.return_(right);
                });
                break;

              case AST.Literal:
                expression = this.escape(ast.value), this.assign(intoId, expression), recursionFn(expression);
                break;

              case AST.UnaryExpression:
                this.recurse(ast.argument, void 0, void 0, function(expr) {
                    right = expr;
                }), expression = ast.operator + "(" + this.ifDefined(right, 0) + ")", this.assign(intoId, expression), 
                recursionFn(expression);
                break;

              case AST.BinaryExpression:
                this.recurse(ast.left, void 0, void 0, function(expr) {
                    left = expr;
                }), this.recurse(ast.right, void 0, void 0, function(expr) {
                    right = expr;
                }), expression = "+" === ast.operator ? this.plus(left, right) : "-" === ast.operator ? this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0) : "(" + left + ")" + ast.operator + "(" + right + ")", 
                this.assign(intoId, expression), recursionFn(expression);
                break;

              case AST.LogicalExpression:
                intoId = intoId || this.nextId(), self.recurse(ast.left, intoId), self.if_("&&" === ast.operator ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId)), 
                recursionFn(intoId);
                break;

              case AST.ConditionalExpression:
                intoId = intoId || this.nextId(), self.recurse(ast.test, intoId), self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId)), 
                recursionFn(intoId);
                break;

              case AST.Identifier:
                intoId = intoId || this.nextId(), nameId && (nameId.context = "inputs" === self.stage ? "s" : this.assign(this.nextId(), this.getHasOwnProperty("l", ast.name) + "?l:s"), 
                nameId.computed = !1, nameId.name = ast.name), ensureSafeMemberName(ast.name), self.if_("inputs" === self.stage || self.not(self.getHasOwnProperty("l", ast.name)), function() {
                    self.if_("inputs" === self.stage || "s", function() {
                        create && 1 !== create && self.if_(self.not(self.nonComputedMember("s", ast.name)), self.lazyAssign(self.nonComputedMember("s", ast.name), "{}")), 
                        self.assign(intoId, self.nonComputedMember("s", ast.name));
                    });
                }, intoId && self.lazyAssign(intoId, self.nonComputedMember("l", ast.name))), (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.name)) && self.addEnsureSafeObject(intoId), 
                recursionFn(intoId);
                break;

              case AST.MemberExpression:
                left = nameId && (nameId.context = this.nextId()) || this.nextId(), intoId = intoId || this.nextId(), 
                self.recurse(ast.object, left, void 0, function() {
                    self.if_(self.notNull(left), function() {
                        create && 1 !== create && self.addEnsureSafeAssignContext(left), ast.computed ? (right = self.nextId(), 
                        self.recurse(ast.property, right), self.getStringValue(right), self.addEnsureSafeMemberName(right), 
                        create && 1 !== create && self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), "{}")), 
                        expression = self.ensureSafeObject(self.computedMember(left, right)), self.assign(intoId, expression), 
                        nameId && (nameId.computed = !0, nameId.name = right)) : (ensureSafeMemberName(ast.property.name), 
                        create && 1 !== create && self.if_(self.not(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), "{}")), 
                        expression = self.nonComputedMember(left, ast.property.name), (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.property.name)) && (expression = self.ensureSafeObject(expression)), 
                        self.assign(intoId, expression), nameId && (nameId.computed = !1, nameId.name = ast.property.name));
                    }, function() {
                        self.assign(intoId, "undefined");
                    }), recursionFn(intoId);
                }, !!create);
                break;

              case AST.CallExpression:
                intoId = intoId || this.nextId(), ast.filter ? (right = self.filter(ast.callee.name), 
                args = [], forEach(ast.arguments, function(expr) {
                    var argument = self.nextId();
                    self.recurse(expr, argument), args.push(argument);
                }), expression = right + "(" + args.join(",") + ")", self.assign(intoId, expression), 
                recursionFn(intoId)) : (right = self.nextId(), left = {}, args = [], self.recurse(ast.callee, right, left, function() {
                    self.if_(self.notNull(right), function() {
                        self.addEnsureSafeFunction(right), forEach(ast.arguments, function(expr) {
                            self.recurse(expr, self.nextId(), void 0, function(argument) {
                                args.push(self.ensureSafeObject(argument));
                            });
                        }), left.name ? (self.state.expensiveChecks || self.addEnsureSafeObject(left.context), 
                        expression = self.member(left.context, left.name, left.computed) + "(" + args.join(",") + ")") : expression = right + "(" + args.join(",") + ")", 
                        expression = self.ensureSafeObject(expression), self.assign(intoId, expression);
                    }, function() {
                        self.assign(intoId, "undefined");
                    }), recursionFn(intoId);
                }));
                break;

              case AST.AssignmentExpression:
                if (right = this.nextId(), left = {}, !isAssignable(ast.left)) throw $parseMinErr("lval", "Trying to assign a value to a non l-value");
                this.recurse(ast.left, void 0, left, function() {
                    self.if_(self.notNull(left.context), function() {
                        self.recurse(ast.right, right), self.addEnsureSafeObject(self.member(left.context, left.name, left.computed)), 
                        self.addEnsureSafeAssignContext(left.context), expression = self.member(left.context, left.name, left.computed) + ast.operator + right, 
                        self.assign(intoId, expression), recursionFn(intoId || expression);
                    });
                }, 1);
                break;

              case AST.ArrayExpression:
                args = [], forEach(ast.elements, function(expr) {
                    self.recurse(expr, self.nextId(), void 0, function(argument) {
                        args.push(argument);
                    });
                }), expression = "[" + args.join(",") + "]", this.assign(intoId, expression), recursionFn(expression);
                break;

              case AST.ObjectExpression:
                computed = !(args = []), forEach(ast.properties, function(property) {
                    property.computed && (computed = !0);
                }), computed ? (intoId = intoId || this.nextId(), this.assign(intoId, "{}"), forEach(ast.properties, function(property) {
                    property.computed ? (left = self.nextId(), self.recurse(property.key, left)) : left = property.key.type === AST.Identifier ? property.key.name : "" + property.key.value, 
                    right = self.nextId(), self.recurse(property.value, right), self.assign(self.member(intoId, left, property.computed), right);
                })) : (forEach(ast.properties, function(property) {
                    self.recurse(property.value, ast.constant ? void 0 : self.nextId(), void 0, function(expr) {
                        args.push(self.escape(property.key.type === AST.Identifier ? property.key.name : "" + property.key.value) + ":" + expr);
                    });
                }), expression = "{" + args.join(",") + "}", this.assign(intoId, expression)), recursionFn(intoId || expression);
                break;

              case AST.ThisExpression:
                this.assign(intoId, "s"), recursionFn("s");
                break;

              case AST.LocalsExpression:
                this.assign(intoId, "l"), recursionFn("l");
                break;

              case AST.NGValueParameter:
                this.assign(intoId, "v"), recursionFn("v");
            }
        },
        getHasOwnProperty: function(element, property) {
            var key = element + "." + property, own = this.current().own;
            return own.hasOwnProperty(key) || (own[key] = this.nextId(!1, element + "&&(" + this.escape(property) + " in " + element + ")")), 
            own[key];
        },
        assign: function(id, value) {
            if (id) return this.current().body.push(id, "=", value, ";"), id;
        },
        filter: function(filterName) {
            return this.state.filters.hasOwnProperty(filterName) || (this.state.filters[filterName] = this.nextId(!0)), 
            this.state.filters[filterName];
        },
        ifDefined: function(id, defaultValue) {
            return "ifDefined(" + id + "," + this.escape(defaultValue) + ")";
        },
        plus: function(left, right) {
            return "plus(" + left + "," + right + ")";
        },
        return_: function(id) {
            this.current().body.push("return ", id, ";");
        },
        if_: function(test, alternate, consequent) {
            if (!0 === test) alternate(); else {
                var body = this.current().body;
                body.push("if(", test, "){"), alternate(), body.push("}"), consequent && (body.push("else{"), 
                consequent(), body.push("}"));
            }
        },
        not: function(expression) {
            return "!(" + expression + ")";
        },
        notNull: function(expression) {
            return expression + "!=null";
        },
        nonComputedMember: function(left, right) {
            return /[$_a-zA-Z][$_a-zA-Z0-9]*/.test(right) ? left + "." + right : left + '["' + right.replace(/[^$_a-zA-Z0-9]/g, this.stringEscapeFn) + '"]';
        },
        computedMember: function(left, right) {
            return left + "[" + right + "]";
        },
        member: function(left, right, computed) {
            return computed ? this.computedMember(left, right) : this.nonComputedMember(left, right);
        },
        addEnsureSafeObject: function(item) {
            this.current().body.push(this.ensureSafeObject(item), ";");
        },
        addEnsureSafeMemberName: function(item) {
            this.current().body.push(this.ensureSafeMemberName(item), ";");
        },
        addEnsureSafeFunction: function(item) {
            this.current().body.push(this.ensureSafeFunction(item), ";");
        },
        addEnsureSafeAssignContext: function(item) {
            this.current().body.push(this.ensureSafeAssignContext(item), ";");
        },
        ensureSafeObject: function(item) {
            return "ensureSafeObject(" + item + ",text)";
        },
        ensureSafeMemberName: function(item) {
            return "ensureSafeMemberName(" + item + ",text)";
        },
        ensureSafeFunction: function(item) {
            return "ensureSafeFunction(" + item + ",text)";
        },
        getStringValue: function(item) {
            this.assign(item, "getStringValue(" + item + ")");
        },
        ensureSafeAssignContext: function(item) {
            return "ensureSafeAssignContext(" + item + ",text)";
        },
        lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
            var self = this;
            return function() {
                self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck);
            };
        },
        lazyAssign: function(id, value) {
            var self = this;
            return function() {
                self.assign(id, value);
            };
        },
        stringEscapeRegex: /[^ a-zA-Z0-9]/g,
        stringEscapeFn: function(c) {
            return "\\u" + ("0000" + c.charCodeAt(0).toString(16)).slice(-4);
        },
        escape: function(value) {
            if (isString(value)) return "'" + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + "'";
            if (isNumber(value)) return value.toString();
            if (!0 === value) return "true";
            if (!1 === value) return "false";
            if (null === value) return "null";
            if (void 0 === value) return "undefined";
            throw $parseMinErr("esc", "IMPOSSIBLE");
        },
        nextId: function(skip, init) {
            var id = "v" + this.state.nextId++;
            return skip || this.current().vars.push(id + (init ? "=" + init : "")), id;
        },
        current: function() {
            return this.state[this.state.computing];
        }
    }, ASTInterpreter.prototype = {
        compile: function(expression, expensiveChecks) {
            var assignable, assign, self = this, ast = this.astBuilder.ast(expression);
            this.expression = expression, this.expensiveChecks = expensiveChecks, findConstantAndWatchExpressions(ast, self.$filter), 
            (assignable = assignableAST(ast)) && (assign = this.recurse(assignable));
            var inputs, toWatch = getInputs(ast.body);
            toWatch && (inputs = [], forEach(toWatch, function(watch, key) {
                var input = self.recurse(watch);
                watch.input = input, inputs.push(input), watch.watchId = key;
            }));
            var expressions = [];
            forEach(ast.body, function(expression) {
                expressions.push(self.recurse(expression.expression));
            });
            var fn = 0 === ast.body.length ? noop : 1 === ast.body.length ? expressions[0] : function(scope, locals) {
                var lastValue;
                return forEach(expressions, function(exp) {
                    lastValue = exp(scope, locals);
                }), lastValue;
            };
            return assign && (fn.assign = function(scope, value, locals) {
                return assign(scope, locals, value);
            }), inputs && (fn.inputs = inputs), fn.literal = isLiteral(ast), fn.constant = isConstant(ast), 
            fn;
        },
        recurse: function(ast, context, create) {
            var left, right, args, self = this;
            if (ast.input) return this.inputs(ast.input, ast.watchId);
            switch (ast.type) {
              case AST.Literal:
                return this.value(ast.value, context);

              case AST.UnaryExpression:
                return right = this.recurse(ast.argument), this["unary" + ast.operator](right, context);

              case AST.BinaryExpression:
              case AST.LogicalExpression:
                return left = this.recurse(ast.left), right = this.recurse(ast.right), this["binary" + ast.operator](left, right, context);

              case AST.ConditionalExpression:
                return this["ternary?:"](this.recurse(ast.test), this.recurse(ast.alternate), this.recurse(ast.consequent), context);

              case AST.Identifier:
                return ensureSafeMemberName(ast.name, self.expression), self.identifier(ast.name, self.expensiveChecks || isPossiblyDangerousMemberName(ast.name), context, create, self.expression);

              case AST.MemberExpression:
                return left = this.recurse(ast.object, !1, !!create), ast.computed || (ensureSafeMemberName(ast.property.name, self.expression), 
                right = ast.property.name), ast.computed && (right = this.recurse(ast.property)), 
                ast.computed ? this.computedMember(left, right, context, create, self.expression) : this.nonComputedMember(left, right, self.expensiveChecks, context, create, self.expression);

              case AST.CallExpression:
                return args = [], forEach(ast.arguments, function(expr) {
                    args.push(self.recurse(expr));
                }), ast.filter && (right = this.$filter(ast.callee.name)), ast.filter || (right = this.recurse(ast.callee, !0)), 
                ast.filter ? function(scope, locals, assign, inputs) {
                    for (var values = [], i = 0; i < args.length; ++i) values.push(args[i](scope, locals, assign, inputs));
                    var value = right.apply(void 0, values, inputs);
                    return context ? {
                        context: void 0,
                        name: void 0,
                        value: value
                    } : value;
                } : function(scope, locals, assign, inputs) {
                    var value, rhs = right(scope, locals, assign, inputs);
                    if (null != rhs.value) {
                        ensureSafeObject(rhs.context, self.expression), ensureSafeFunction(rhs.value, self.expression);
                        for (var values = [], i = 0; i < args.length; ++i) values.push(ensureSafeObject(args[i](scope, locals, assign, inputs), self.expression));
                        value = ensureSafeObject(rhs.value.apply(rhs.context, values), self.expression);
                    }
                    return context ? {
                        value: value
                    } : value;
                };

              case AST.AssignmentExpression:
                return left = this.recurse(ast.left, !0, 1), right = this.recurse(ast.right), function(scope, locals, assign, inputs) {
                    var lhs = left(scope, locals, assign, inputs), rhs = right(scope, locals, assign, inputs);
                    return ensureSafeObject(lhs.value, self.expression), ensureSafeAssignContext(lhs.context), 
                    lhs.context[lhs.name] = rhs, context ? {
                        value: rhs
                    } : rhs;
                };

              case AST.ArrayExpression:
                return args = [], forEach(ast.elements, function(expr) {
                    args.push(self.recurse(expr));
                }), function(scope, locals, assign, inputs) {
                    for (var value = [], i = 0; i < args.length; ++i) value.push(args[i](scope, locals, assign, inputs));
                    return context ? {
                        value: value
                    } : value;
                };

              case AST.ObjectExpression:
                return args = [], forEach(ast.properties, function(property) {
                    property.computed ? args.push({
                        key: self.recurse(property.key),
                        computed: !0,
                        value: self.recurse(property.value)
                    }) : args.push({
                        key: property.key.type === AST.Identifier ? property.key.name : "" + property.key.value,
                        computed: !1,
                        value: self.recurse(property.value)
                    });
                }), function(scope, locals, assign, inputs) {
                    for (var value = {}, i = 0; i < args.length; ++i) args[i].computed ? value[args[i].key(scope, locals, assign, inputs)] = args[i].value(scope, locals, assign, inputs) : value[args[i].key] = args[i].value(scope, locals, assign, inputs);
                    return context ? {
                        value: value
                    } : value;
                };

              case AST.ThisExpression:
                return function(scope) {
                    return context ? {
                        value: scope
                    } : scope;
                };

              case AST.LocalsExpression:
                return function(scope, locals) {
                    return context ? {
                        value: locals
                    } : locals;
                };

              case AST.NGValueParameter:
                return function(scope, locals, assign) {
                    return context ? {
                        value: assign
                    } : assign;
                };
            }
        },
        "unary+": function(argument, context) {
            return function(scope, locals, assign, inputs) {
                var arg = argument(scope, locals, assign, inputs);
                return arg = isDefined(arg) ? +arg : 0, context ? {
                    value: arg
                } : arg;
            };
        },
        "unary-": function(argument, context) {
            return function(scope, locals, assign, inputs) {
                var arg = argument(scope, locals, assign, inputs);
                return arg = isDefined(arg) ? -arg : 0, context ? {
                    value: arg
                } : arg;
            };
        },
        "unary!": function(argument, context) {
            return function(scope, locals, assign, inputs) {
                var arg = !argument(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary+": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = plusFn(left(scope, locals, assign, inputs), right(scope, locals, assign, inputs));
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary-": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var lhs = left(scope, locals, assign, inputs), rhs = right(scope, locals, assign, inputs), arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary*": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary/": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary%": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary===": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary!==": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary==": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary!=": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary<": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary>": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary<=": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary>=": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary&&": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "binary||": function(left, right, context) {
            return function(scope, locals, assign, inputs) {
                var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        "ternary?:": function(test, alternate, consequent, context) {
            return function(scope, locals, assign, inputs) {
                var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs);
                return context ? {
                    value: arg
                } : arg;
            };
        },
        value: function(value, context) {
            return function() {
                return context ? {
                    context: void 0,
                    name: void 0,
                    value: value
                } : value;
            };
        },
        identifier: function(name, expensiveChecks, context, create, expression) {
            return function(scope, locals, assign, inputs) {
                var base = locals && name in locals ? locals : scope;
                create && 1 !== create && base && !base[name] && (base[name] = {});
                var value = base ? base[name] : void 0;
                return expensiveChecks && ensureSafeObject(value, expression), context ? {
                    context: base,
                    name: name,
                    value: value
                } : value;
            };
        },
        computedMember: function(left, right, context, create, expression) {
            return function(scope, locals, assign, inputs) {
                var rhs, value, lhs = left(scope, locals, assign, inputs);
                return null != lhs && (ensureSafeMemberName(rhs = getStringValue(rhs = right(scope, locals, assign, inputs)), expression), 
                create && 1 !== create && (ensureSafeAssignContext(lhs), lhs && !lhs[rhs] && (lhs[rhs] = {})), 
                ensureSafeObject(value = lhs[rhs], expression)), context ? {
                    context: lhs,
                    name: rhs,
                    value: value
                } : value;
            };
        },
        nonComputedMember: function(left, right, expensiveChecks, context, create, expression) {
            return function(scope, locals, assign, inputs) {
                var lhs = left(scope, locals, assign, inputs);
                create && 1 !== create && (ensureSafeAssignContext(lhs), lhs && !lhs[right] && (lhs[right] = {}));
                var value = null != lhs ? lhs[right] : void 0;
                return (expensiveChecks || isPossiblyDangerousMemberName(right)) && ensureSafeObject(value, expression), 
                context ? {
                    context: lhs,
                    name: right,
                    value: value
                } : value;
            };
        },
        inputs: function(input, watchId) {
            return function(scope, value, locals, inputs) {
                return inputs ? inputs[watchId] : input(scope, value, locals);
            };
        }
    };
    var Parser = function(lexer, $filter, options) {
        this.lexer = lexer, this.$filter = $filter, this.options = options, this.ast = new AST(lexer, options), 
        this.astCompiler = options.csp ? new ASTInterpreter(this.ast, $filter) : new ASTCompiler(this.ast, $filter);
    };
    function isPossiblyDangerousMemberName(name) {
        return "constructor" == name;
    }
    Parser.prototype = {
        constructor: Parser,
        parse: function(text) {
            return this.astCompiler.compile(text, this.options.expensiveChecks);
        }
    };
    var objectValueOf = Object.prototype.valueOf;
    function getValueOf(value) {
        return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value);
    }
    function $ParseProvider() {
        var identStart, identContinue, cacheDefault = createMap(), cacheExpensive = createMap(), literals = {
            true: !0,
            false: !1,
            null: null,
            undefined: void 0
        };
        this.addLiteral = function(literalName, literalValue) {
            literals[literalName] = literalValue;
        }, this.setIdentifierFns = function(identifierStart, identifierContinue) {
            return identStart = identifierStart, identContinue = identifierContinue, this;
        }, this.$get = [ "$filter", function($filter) {
            var noUnsafeEval = csp().noUnsafeEval, $parseOptions = {
                csp: noUnsafeEval,
                expensiveChecks: !1,
                literals: copy(literals),
                isIdentifierStart: isFunction(identStart) && identStart,
                isIdentifierContinue: isFunction(identContinue) && identContinue
            }, $parseOptionsExpensive = {
                csp: noUnsafeEval,
                expensiveChecks: !0,
                literals: copy(literals),
                isIdentifierStart: isFunction(identStart) && identStart,
                isIdentifierContinue: isFunction(identContinue) && identContinue
            }, runningChecksEnabled = !1;
            return $parse.$$runningExpensiveChecks = function() {
                return runningChecksEnabled;
            }, $parse;
            function $parse(exp, interceptorFn, expensiveChecks) {
                var parsedExpression, oneTime, cacheKey;
                switch (expensiveChecks = expensiveChecks || runningChecksEnabled, typeof exp) {
                  case "string":
                    exp = exp.trim();
                    var cache = expensiveChecks ? cacheExpensive : cacheDefault;
                    if (!(parsedExpression = cache[cacheKey = exp])) {
                        ":" === exp.charAt(0) && ":" === exp.charAt(1) && (oneTime = !0, exp = exp.substring(2));
                        var parseOptions = expensiveChecks ? $parseOptionsExpensive : $parseOptions, lexer = new Lexer(parseOptions);
                        (parsedExpression = new Parser(lexer, $filter, parseOptions).parse(exp)).constant ? parsedExpression.$$watchDelegate = constantWatchDelegate : oneTime ? parsedExpression.$$watchDelegate = parsedExpression.literal ? oneTimeLiteralWatchDelegate : oneTimeWatchDelegate : parsedExpression.inputs && (parsedExpression.$$watchDelegate = inputsWatchDelegate), 
                        expensiveChecks && (parsedExpression = function expensiveChecksInterceptor(fn) {
                            if (!fn) return fn;
                            expensiveCheckFn.$$watchDelegate = fn.$$watchDelegate;
                            expensiveCheckFn.assign = expensiveChecksInterceptor(fn.assign);
                            expensiveCheckFn.constant = fn.constant;
                            expensiveCheckFn.literal = fn.literal;
                            for (var i = 0; fn.inputs && i < fn.inputs.length; ++i) fn.inputs[i] = expensiveChecksInterceptor(fn.inputs[i]);
                            expensiveCheckFn.inputs = fn.inputs;
                            return expensiveCheckFn;
                            function expensiveCheckFn(scope, locals, assign, inputs) {
                                var expensiveCheckOldValue = runningChecksEnabled;
                                runningChecksEnabled = !0;
                                try {
                                    return fn(scope, locals, assign, inputs);
                                } finally {
                                    runningChecksEnabled = expensiveCheckOldValue;
                                }
                            }
                        }(parsedExpression)), cache[cacheKey] = parsedExpression;
                    }
                    return addInterceptor(parsedExpression, interceptorFn);

                  case "function":
                    return addInterceptor(exp, interceptorFn);

                  default:
                    return addInterceptor(noop, interceptorFn);
                }
            }
            function expressionInputDirtyCheck(newValue, oldValueOfValue) {
                return null == newValue || null == oldValueOfValue ? newValue === oldValueOfValue : ("object" != typeof newValue || "object" != typeof (newValue = getValueOf(newValue))) && (newValue === oldValueOfValue || newValue != newValue && oldValueOfValue != oldValueOfValue);
            }
            function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {
                var lastResult, inputExpressions = parsedExpression.inputs;
                if (1 === inputExpressions.length) {
                    var oldInputValueOf = expressionInputDirtyCheck;
                    return inputExpressions = inputExpressions[0], scope.$watch(function(scope) {
                        var newInputValue = inputExpressions(scope);
                        return expressionInputDirtyCheck(newInputValue, oldInputValueOf) || (lastResult = parsedExpression(scope, void 0, void 0, [ newInputValue ]), 
                        oldInputValueOf = newInputValue && getValueOf(newInputValue)), lastResult;
                    }, listener, objectEquality, prettyPrintExpression);
                }
                for (var oldInputValueOfValues = [], oldInputValues = [], i = 0, ii = inputExpressions.length; i < ii; i++) oldInputValueOfValues[i] = expressionInputDirtyCheck, 
                oldInputValues[i] = null;
                return scope.$watch(function(scope) {
                    for (var changed = !1, i = 0, ii = inputExpressions.length; i < ii; i++) {
                        var newInputValue = inputExpressions[i](scope);
                        (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) && (oldInputValues[i] = newInputValue, 
                        oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue));
                    }
                    return changed && (lastResult = parsedExpression(scope, void 0, void 0, oldInputValues)), 
                    lastResult;
                }, listener, objectEquality, prettyPrintExpression);
            }
            function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression) {
                var unwatch, lastValue;
                return unwatch = scope.$watch(function(scope) {
                    return parsedExpression(scope);
                }, function(value, old, scope) {
                    lastValue = value, isFunction(listener) && listener.apply(this, arguments), isDefined(value) && scope.$$postDigest(function() {
                        isDefined(lastValue) && unwatch();
                    });
                }, objectEquality);
            }
            function oneTimeLiteralWatchDelegate(scope, listener, objectEquality, parsedExpression) {
                var unwatch, lastValue;
                return unwatch = scope.$watch(function(scope) {
                    return parsedExpression(scope);
                }, function(value, old, scope) {
                    lastValue = value, isFunction(listener) && listener.call(this, value, old, scope), 
                    isAllDefined(value) && scope.$$postDigest(function() {
                        isAllDefined(lastValue) && unwatch();
                    });
                }, objectEquality);
                function isAllDefined(value) {
                    var allDefined = !0;
                    return forEach(value, function(val) {
                        isDefined(val) || (allDefined = !1);
                    }), allDefined;
                }
            }
            function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) {
                var unwatch;
                return unwatch = scope.$watch(function(scope) {
                    return unwatch(), parsedExpression(scope);
                }, listener, objectEquality);
            }
            function addInterceptor(parsedExpression, interceptorFn) {
                if (!interceptorFn) return parsedExpression;
                var watchDelegate = parsedExpression.$$watchDelegate, useInputs = !1, fn = watchDelegate !== oneTimeLiteralWatchDelegate && watchDelegate !== oneTimeWatchDelegate ? function(scope, locals, assign, inputs) {
                    var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);
                    return interceptorFn(value, scope, locals);
                } : function(scope, locals, assign, inputs) {
                    var value = parsedExpression(scope, locals, assign, inputs), result = interceptorFn(value, scope, locals);
                    return isDefined(value) ? result : value;
                };
                return parsedExpression.$$watchDelegate && parsedExpression.$$watchDelegate !== inputsWatchDelegate ? fn.$$watchDelegate = parsedExpression.$$watchDelegate : interceptorFn.$stateful || (fn.$$watchDelegate = inputsWatchDelegate, 
                useInputs = !parsedExpression.inputs, fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [ parsedExpression ]), 
                fn;
            }
        } ];
    }
    function $QProvider() {
        this.$get = [ "$rootScope", "$exceptionHandler", function($rootScope, $exceptionHandler) {
            return qFactory(function(callback) {
                $rootScope.$evalAsync(callback);
            }, $exceptionHandler);
        } ];
    }
    function $$QProvider() {
        this.$get = [ "$browser", "$exceptionHandler", function($browser, $exceptionHandler) {
            return qFactory(function(callback) {
                $browser.defer(callback);
            }, $exceptionHandler);
        } ];
    }
    function qFactory(nextTick, exceptionHandler) {
        var $qMinErr = minErr("$q", TypeError), defer = function() {
            var d = new Deferred();
            return d.resolve = simpleBind(d, d.resolve), d.reject = simpleBind(d, d.reject), 
            d.notify = simpleBind(d, d.notify), d;
        };
        function Promise() {
            this.$$state = {
                status: 0
            };
        }
        function simpleBind(context, fn) {
            return function(value) {
                fn.call(context, value);
            };
        }
        function scheduleProcessQueue(state) {
            !state.processScheduled && state.pending && (state.processScheduled = !0, nextTick(function() {
                !function(state) {
                    var fn, deferred, pending;
                    pending = state.pending, state.processScheduled = !1, state.pending = void 0;
                    for (var i = 0, ii = pending.length; i < ii; ++i) {
                        deferred = pending[i][0], fn = pending[i][state.status];
                        try {
                            isFunction(fn) ? deferred.resolve(fn(state.value)) : 1 === state.status ? deferred.resolve(state.value) : deferred.reject(state.value);
                        } catch (e) {
                            deferred.reject(e), exceptionHandler(e);
                        }
                    }
                }(state);
            }));
        }
        function Deferred() {
            this.promise = new Promise();
        }
        extend(Promise.prototype, {
            then: function(onFulfilled, onRejected, progressBack) {
                if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) return this;
                var result = new Deferred();
                return this.$$state.pending = this.$$state.pending || [], this.$$state.pending.push([ result, onFulfilled, onRejected, progressBack ]), 
                0 < this.$$state.status && scheduleProcessQueue(this.$$state), result.promise;
            },
            catch: function(callback) {
                return this.then(null, callback);
            },
            finally: function(callback, progressBack) {
                return this.then(function(value) {
                    return handleCallback(value, !0, callback);
                }, function(error) {
                    return handleCallback(error, !1, callback);
                }, progressBack);
            }
        }), extend(Deferred.prototype, {
            resolve: function(val) {
                this.promise.$$state.status || (val === this.promise ? this.$$reject($qMinErr("qcycle", "Expected promise to be resolved with value other than itself '{0}'", val)) : this.$$resolve(val));
            },
            $$resolve: function(val) {
                var then, that = this, done = !1;
                try {
                    (isObject(val) || isFunction(val)) && (then = val && val.then), isFunction(then) ? (this.promise.$$state.status = -1, 
                    then.call(val, function(val) {
                        if (done) return;
                        done = !0, that.$$resolve(val);
                    }, rejectPromise, simpleBind(this, this.notify))) : (this.promise.$$state.value = val, 
                    this.promise.$$state.status = 1, scheduleProcessQueue(this.promise.$$state));
                } catch (e) {
                    rejectPromise(e), exceptionHandler(e);
                }
                function rejectPromise(val) {
                    done || (done = !0, that.$$reject(val));
                }
            },
            reject: function(reason) {
                this.promise.$$state.status || this.$$reject(reason);
            },
            $$reject: function(reason) {
                this.promise.$$state.value = reason, this.promise.$$state.status = 2, scheduleProcessQueue(this.promise.$$state);
            },
            notify: function(progress) {
                var callbacks = this.promise.$$state.pending;
                this.promise.$$state.status <= 0 && callbacks && callbacks.length && nextTick(function() {
                    for (var callback, result, i = 0, ii = callbacks.length; i < ii; i++) {
                        result = callbacks[i][0], callback = callbacks[i][3];
                        try {
                            result.notify(isFunction(callback) ? callback(progress) : progress);
                        } catch (e) {
                            exceptionHandler(e);
                        }
                    }
                });
            }
        });
        var makePromise = function(value, resolved) {
            var result = new Deferred();
            return resolved ? result.resolve(value) : result.reject(value), result.promise;
        }, handleCallback = function(value, isResolved, callback) {
            var callbackOutput = null;
            try {
                isFunction(callback) && (callbackOutput = callback());
            } catch (e) {
                return makePromise(e, !1);
            }
            return isPromiseLike(callbackOutput) ? callbackOutput.then(function() {
                return makePromise(value, isResolved);
            }, function(error) {
                return makePromise(error, !1);
            }) : makePromise(value, isResolved);
        }, when = function(value, callback, errback, progressBack) {
            var result = new Deferred();
            return result.resolve(value), result.promise.then(callback, errback, progressBack);
        }, resolve = when;
        var $Q = function(resolver) {
            if (!isFunction(resolver)) throw $qMinErr("norslvr", "Expected resolverFn, got '{0}'", resolver);
            var deferred = new Deferred();
            return resolver(function(value) {
                deferred.resolve(value);
            }, function(reason) {
                deferred.reject(reason);
            }), deferred.promise;
        };
        return $Q.prototype = Promise.prototype, $Q.defer = defer, $Q.reject = function(reason) {
            var result = new Deferred();
            return result.reject(reason), result.promise;
        }, $Q.when = when, $Q.resolve = resolve, $Q.all = function(promises) {
            var deferred = new Deferred(), counter = 0, results = isArray(promises) ? [] : {};
            return forEach(promises, function(promise, key) {
                counter++, when(promise).then(function(value) {
                    results.hasOwnProperty(key) || (results[key] = value, --counter || deferred.resolve(results));
                }, function(reason) {
                    results.hasOwnProperty(key) || deferred.reject(reason);
                });
            }), 0 === counter && deferred.resolve(results), deferred.promise;
        }, $Q.race = function(promises) {
            var deferred = defer();
            return forEach(promises, function(promise) {
                when(promise).then(deferred.resolve, deferred.reject);
            }), deferred.promise;
        }, $Q;
    }
    function $$RAFProvider() {
        this.$get = [ "$window", "$timeout", function($window, $timeout) {
            var requestAnimationFrame = $window.requestAnimationFrame || $window.webkitRequestAnimationFrame, cancelAnimationFrame = $window.cancelAnimationFrame || $window.webkitCancelAnimationFrame || $window.webkitCancelRequestAnimationFrame, rafSupported = !!requestAnimationFrame, raf = rafSupported ? function(fn) {
                var id = requestAnimationFrame(fn);
                return function() {
                    cancelAnimationFrame(id);
                };
            } : function(fn) {
                var timer = $timeout(fn, 16.66, !1);
                return function() {
                    $timeout.cancel(timer);
                };
            };
            return raf.supported = rafSupported, raf;
        } ];
    }
    function $RootScopeProvider() {
        var TTL = 10, $rootScopeMinErr = minErr("$rootScope"), lastDirtyWatch = null, applyAsyncId = null;
        this.digestTtl = function(value) {
            return arguments.length && (TTL = value), TTL;
        }, this.$get = [ "$exceptionHandler", "$parse", "$browser", function($exceptionHandler, $parse, $browser) {
            function destroyChildScope($event) {
                $event.currentScope.$$destroyed = !0;
            }
            function Scope() {
                this.$id = nextUid(), this.$$phase = this.$parent = this.$$watchers = this.$$nextSibling = this.$$prevSibling = this.$$childHead = this.$$childTail = null, 
                (this.$root = this).$$destroyed = !1, this.$$listeners = {}, this.$$listenerCount = {}, 
                this.$$watchersCount = 0, this.$$isolateBindings = null;
            }
            Scope.prototype = {
                constructor: Scope,
                $new: function(isolate, parent) {
                    var child;
                    return parent = parent || this, isolate ? (child = new Scope()).$root = this.$root : (this.$$ChildScope || (this.$$ChildScope = function(parent) {
                        function ChildScope() {
                            this.$$watchers = this.$$nextSibling = this.$$childHead = this.$$childTail = null, 
                            this.$$listeners = {}, this.$$listenerCount = {}, this.$$watchersCount = 0, this.$id = nextUid(), 
                            this.$$ChildScope = null;
                        }
                        return ChildScope.prototype = parent, ChildScope;
                    }(this)), child = new this.$$ChildScope()), child.$parent = parent, child.$$prevSibling = parent.$$childTail, 
                    parent.$$childHead ? (parent.$$childTail.$$nextSibling = child, parent.$$childTail = child) : parent.$$childHead = parent.$$childTail = child, 
                    (isolate || parent != this) && child.$on("$destroy", destroyChildScope), child;
                },
                $watch: function(watchExp, listener, objectEquality, prettyPrintExpression) {
                    var get = $parse(watchExp);
                    if (get.$$watchDelegate) return get.$$watchDelegate(this, listener, objectEquality, get, watchExp);
                    var scope = this, array = scope.$$watchers, watcher = {
                        fn: listener,
                        last: initWatchVal,
                        get: get,
                        exp: prettyPrintExpression || watchExp,
                        eq: !!objectEquality
                    };
                    return lastDirtyWatch = null, isFunction(listener) || (watcher.fn = noop), array || (array = scope.$$watchers = []), 
                    array.unshift(watcher), incrementWatchersCount(this, 1), function() {
                        0 <= arrayRemove(array, watcher) && incrementWatchersCount(scope, -1), lastDirtyWatch = null;
                    };
                },
                $watchGroup: function(watchExpressions, listener) {
                    var oldValues = new Array(watchExpressions.length), newValues = new Array(watchExpressions.length), deregisterFns = [], self = this, changeReactionScheduled = !1, firstRun = !0;
                    if (!watchExpressions.length) {
                        var shouldCall = !0;
                        return self.$evalAsync(function() {
                            shouldCall && listener(newValues, newValues, self);
                        }), function() {
                            shouldCall = !1;
                        };
                    }
                    if (1 === watchExpressions.length) return this.$watch(watchExpressions[0], function(value, oldValue, scope) {
                        newValues[0] = value, oldValues[0] = oldValue, listener(newValues, value === oldValue ? newValues : oldValues, scope);
                    });
                    function watchGroupAction() {
                        changeReactionScheduled = !1, firstRun ? (firstRun = !1, listener(newValues, newValues, self)) : listener(newValues, oldValues, self);
                    }
                    return forEach(watchExpressions, function(expr, i) {
                        var unwatchFn = self.$watch(expr, function(value, oldValue) {
                            newValues[i] = value, oldValues[i] = oldValue, changeReactionScheduled || (changeReactionScheduled = !0, 
                            self.$evalAsync(watchGroupAction));
                        });
                        deregisterFns.push(unwatchFn);
                    }), function() {
                        for (;deregisterFns.length; ) deregisterFns.shift()();
                    };
                },
                $watchCollection: function(obj, listener) {
                    $watchCollectionInterceptor.$stateful = !0;
                    var newValue, oldValue, veryOldValue, self = this, trackVeryOldValue = 1 < listener.length, changeDetected = 0, changeDetector = $parse(obj, $watchCollectionInterceptor), internalArray = [], internalObject = {}, initRun = !0, oldLength = 0;
                    function $watchCollectionInterceptor(_value) {
                        var newLength, key, newItem, oldItem;
                        if (!isUndefined(newValue = _value)) {
                            if (isObject(newValue)) if (isArrayLike(newValue)) {
                                oldValue !== internalArray && (oldLength = (oldValue = internalArray).length = 0, 
                                changeDetected++), newLength = newValue.length, oldLength !== newLength && (changeDetected++, 
                                oldValue.length = oldLength = newLength);
                                for (var i = 0; i < newLength; i++) oldItem = oldValue[i], newItem = newValue[i], 
                                oldItem != oldItem && newItem != newItem || oldItem === newItem || (changeDetected++, 
                                oldValue[i] = newItem);
                            } else {
                                for (key in oldValue !== internalObject && (oldValue = internalObject = {}, oldLength = 0, 
                                changeDetected++), newLength = 0, newValue) hasOwnProperty.call(newValue, key) && (newLength++, 
                                newItem = newValue[key], oldItem = oldValue[key], key in oldValue ? oldItem != oldItem && newItem != newItem || oldItem === newItem || (changeDetected++, 
                                oldValue[key] = newItem) : (oldLength++, oldValue[key] = newItem, changeDetected++));
                                if (newLength < oldLength) for (key in changeDetected++, oldValue) hasOwnProperty.call(newValue, key) || (oldLength--, 
                                delete oldValue[key]);
                            } else oldValue !== newValue && (oldValue = newValue, changeDetected++);
                            return changeDetected;
                        }
                    }
                    return this.$watch(changeDetector, function() {
                        if (initRun ? (initRun = !1, listener(newValue, newValue, self)) : listener(newValue, veryOldValue, self), 
                        trackVeryOldValue) if (isObject(newValue)) if (isArrayLike(newValue)) {
                            veryOldValue = new Array(newValue.length);
                            for (var i = 0; i < newValue.length; i++) veryOldValue[i] = newValue[i];
                        } else for (var key in veryOldValue = {}, newValue) hasOwnProperty.call(newValue, key) && (veryOldValue[key] = newValue[key]); else veryOldValue = newValue;
                    });
                },
                $digest: function() {
                    var watch, value, last, watchers, length, dirty, next, current, logIdx, asyncTask, ttl = TTL, watchLog = [];
                    beginPhase("$digest"), $browser.$$checkUrlChange(), this === $rootScope && null !== applyAsyncId && ($browser.defer.cancel(applyAsyncId), 
                    flushApplyAsync()), lastDirtyWatch = null;
                    do {
                        dirty = !1, current = this;
                        for (var asyncQueuePosition = 0; asyncQueuePosition < asyncQueue.length; asyncQueuePosition++) {
                            try {
                                (asyncTask = asyncQueue[asyncQueuePosition]).scope.$eval(asyncTask.expression, asyncTask.locals);
                            } catch (e) {
                                $exceptionHandler(e);
                            }
                            lastDirtyWatch = null;
                        }
                        asyncQueue.length = 0;
                        traverseScopesLoop: do {
                            if (watchers = current.$$watchers) for (length = watchers.length; length--; ) try {
                                if (watch = watchers[length]) if ((value = (0, watch.get)(current)) === (last = watch.last) || (watch.eq ? equals(value, last) : "number" == typeof value && "number" == typeof last && isNaN(value) && isNaN(last))) {
                                    if (watch === lastDirtyWatch) {
                                        dirty = !1;
                                        break traverseScopesLoop;
                                    }
                                } else dirty = !0, (lastDirtyWatch = watch).last = watch.eq ? copy(value, null) : value, 
                                (0, watch.fn)(value, last === initWatchVal ? value : last, current), ttl < 5 && (watchLog[logIdx = 4 - ttl] || (watchLog[logIdx] = []), 
                                watchLog[logIdx].push({
                                    msg: isFunction(watch.exp) ? "fn: " + (watch.exp.name || watch.exp.toString()) : watch.exp,
                                    newVal: value,
                                    oldVal: last
                                }));
                            } catch (e) {
                                $exceptionHandler(e);
                            }
                            if (!(next = current.$$watchersCount && current.$$childHead || current !== this && current.$$nextSibling)) for (;current !== this && !(next = current.$$nextSibling); ) current = current.$parent;
                        } while (current = next);
                        if ((dirty || asyncQueue.length) && !ttl--) throw clearPhase(), $rootScopeMinErr("infdig", "{0} $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: {1}", TTL, watchLog);
                    } while (dirty || asyncQueue.length);
                    for (clearPhase(); postDigestQueuePosition < postDigestQueue.length; ) try {
                        postDigestQueue[postDigestQueuePosition++]();
                    } catch (e) {
                        $exceptionHandler(e);
                    }
                    postDigestQueue.length = postDigestQueuePosition = 0;
                },
                $destroy: function() {
                    if (!this.$$destroyed) {
                        var parent = this.$parent;
                        for (var eventName in this.$broadcast("$destroy"), this.$$destroyed = !0, this === $rootScope && $browser.$$applicationDestroyed(), 
                        incrementWatchersCount(this, -this.$$watchersCount), this.$$listenerCount) decrementListenerCount(this, this.$$listenerCount[eventName], eventName);
                        parent && parent.$$childHead == this && (parent.$$childHead = this.$$nextSibling), 
                        parent && parent.$$childTail == this && (parent.$$childTail = this.$$prevSibling), 
                        this.$$prevSibling && (this.$$prevSibling.$$nextSibling = this.$$nextSibling), this.$$nextSibling && (this.$$nextSibling.$$prevSibling = this.$$prevSibling), 
                        this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop, 
                        this.$on = this.$watch = this.$watchGroup = function() {
                            return noop;
                        }, this.$$listeners = {}, this.$$nextSibling = null, function cleanUpScope($scope) {
                            9 === msie && ($scope.$$childHead && cleanUpScope($scope.$$childHead), $scope.$$nextSibling && cleanUpScope($scope.$$nextSibling)), 
                            $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead = $scope.$$childTail = $scope.$root = $scope.$$watchers = null;
                        }(this);
                    }
                },
                $eval: function(expr, locals) {
                    return $parse(expr)(this, locals);
                },
                $evalAsync: function(expr, locals) {
                    $rootScope.$$phase || asyncQueue.length || $browser.defer(function() {
                        asyncQueue.length && $rootScope.$digest();
                    }), asyncQueue.push({
                        scope: this,
                        expression: $parse(expr),
                        locals: locals
                    });
                },
                $$postDigest: function(fn) {
                    postDigestQueue.push(fn);
                },
                $apply: function(expr) {
                    try {
                        beginPhase("$apply");
                        try {
                            return this.$eval(expr);
                        } finally {
                            clearPhase();
                        }
                    } catch (e) {
                        $exceptionHandler(e);
                    } finally {
                        try {
                            $rootScope.$digest();
                        } catch (e) {
                            throw $exceptionHandler(e), e;
                        }
                    }
                },
                $applyAsync: function(expr) {
                    var scope = this;
                    expr && applyAsyncQueue.push(function() {
                        scope.$eval(expr);
                    }), expr = $parse(expr), null === applyAsyncId && (applyAsyncId = $browser.defer(function() {
                        $rootScope.$apply(flushApplyAsync);
                    }));
                },
                $on: function(name, listener) {
                    var namedListeners = this.$$listeners[name];
                    namedListeners || (this.$$listeners[name] = namedListeners = []), namedListeners.push(listener);
                    for (var current = this; current.$$listenerCount[name] || (current.$$listenerCount[name] = 0), 
                    current.$$listenerCount[name]++, current = current.$parent; ) ;
                    var self = this;
                    return function() {
                        var indexOfListener = namedListeners.indexOf(listener);
                        -1 !== indexOfListener && (namedListeners[indexOfListener] = null, decrementListenerCount(self, 1, name));
                    };
                },
                $emit: function(name, args) {
                    var namedListeners, i, length, empty = [], scope = this, stopPropagation = !1, event = {
                        name: name,
                        targetScope: scope,
                        stopPropagation: function() {
                            stopPropagation = !0;
                        },
                        preventDefault: function() {
                            event.defaultPrevented = !0;
                        },
                        defaultPrevented: !1
                    }, listenerArgs = concat([ event ], arguments, 1);
                    do {
                        for (namedListeners = scope.$$listeners[name] || empty, event.currentScope = scope, 
                        i = 0, length = namedListeners.length; i < length; i++) if (namedListeners[i]) try {
                            namedListeners[i].apply(null, listenerArgs);
                        } catch (e) {
                            $exceptionHandler(e);
                        } else namedListeners.splice(i, 1), i--, length--;
                        if (stopPropagation) return event.currentScope = null, event;
                        scope = scope.$parent;
                    } while (scope);
                    return event.currentScope = null, event;
                },
                $broadcast: function(name, args) {
                    var current = this, next = this, event = {
                        name: name,
                        targetScope: this,
                        preventDefault: function() {
                            event.defaultPrevented = !0;
                        },
                        defaultPrevented: !1
                    };
                    if (!this.$$listenerCount[name]) return event;
                    for (var listeners, i, length, listenerArgs = concat([ event ], arguments, 1); current = next; ) {
                        for (i = 0, length = (listeners = (event.currentScope = current).$$listeners[name] || []).length; i < length; i++) if (listeners[i]) try {
                            listeners[i].apply(null, listenerArgs);
                        } catch (e) {
                            $exceptionHandler(e);
                        } else listeners.splice(i, 1), i--, length--;
                        if (!(next = current.$$listenerCount[name] && current.$$childHead || current !== this && current.$$nextSibling)) for (;current !== this && !(next = current.$$nextSibling); ) current = current.$parent;
                    }
                    return event.currentScope = null, event;
                }
            };
            var $rootScope = new Scope(), asyncQueue = $rootScope.$$asyncQueue = [], postDigestQueue = $rootScope.$$postDigestQueue = [], applyAsyncQueue = $rootScope.$$applyAsyncQueue = [], postDigestQueuePosition = 0;
            return $rootScope;
            function beginPhase(phase) {
                if ($rootScope.$$phase) throw $rootScopeMinErr("inprog", "{0} already in progress", $rootScope.$$phase);
                $rootScope.$$phase = phase;
            }
            function clearPhase() {
                $rootScope.$$phase = null;
            }
            function incrementWatchersCount(current, count) {
                for (;current.$$watchersCount += count, current = current.$parent; ) ;
            }
            function decrementListenerCount(current, count, name) {
                for (;current.$$listenerCount[name] -= count, 0 === current.$$listenerCount[name] && delete current.$$listenerCount[name], 
                current = current.$parent; ) ;
            }
            function initWatchVal() {}
            function flushApplyAsync() {
                for (;applyAsyncQueue.length; ) try {
                    applyAsyncQueue.shift()();
                } catch (e) {
                    $exceptionHandler(e);
                }
                applyAsyncId = null;
            }
        } ];
    }
    function $$SanitizeUriProvider() {
        var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/, imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file|blob):|data:image\/)/;
        this.aHrefSanitizationWhitelist = function(regexp) {
            return isDefined(regexp) ? (aHrefSanitizationWhitelist = regexp, this) : aHrefSanitizationWhitelist;
        }, this.imgSrcSanitizationWhitelist = function(regexp) {
            return isDefined(regexp) ? (imgSrcSanitizationWhitelist = regexp, this) : imgSrcSanitizationWhitelist;
        }, this.$get = function() {
            return function(uri, isImage) {
                var normalizedVal, regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;
                return "" === (normalizedVal = urlResolve(uri).href) || normalizedVal.match(regex) ? uri : "unsafe:" + normalizedVal;
            };
        };
    }
    var $sceMinErr = minErr("$sce"), SCE_CONTEXTS = {
        HTML: "html",
        CSS: "css",
        URL: "url",
        RESOURCE_URL: "resourceUrl",
        JS: "js"
    };
    function adjustMatchers(matchers) {
        var adjustedMatchers = [];
        return isDefined(matchers) && forEach(matchers, function(matcher) {
            adjustedMatchers.push(function(matcher) {
                if ("self" === matcher) return matcher;
                if (isString(matcher)) {
                    if (-1 < matcher.indexOf("***")) throw $sceMinErr("iwcard", "Illegal sequence *** in string matcher.  String: {0}", matcher);
                    return matcher = escapeForRegexp(matcher).replace("\\*\\*", ".*").replace("\\*", "[^:/.?&;]*"), 
                    new RegExp("^" + matcher + "$");
                }
                if (isRegExp(matcher)) return new RegExp("^" + matcher.source + "$");
                throw $sceMinErr("imatcher", 'Matchers may only be "self", string patterns or RegExp objects');
            }(matcher));
        }), adjustedMatchers;
    }
    function $SceDelegateProvider() {
        this.SCE_CONTEXTS = SCE_CONTEXTS;
        var resourceUrlWhitelist = [ "self" ], resourceUrlBlacklist = [];
        this.resourceUrlWhitelist = function(value) {
            return arguments.length && (resourceUrlWhitelist = adjustMatchers(value)), resourceUrlWhitelist;
        }, this.resourceUrlBlacklist = function(value) {
            return arguments.length && (resourceUrlBlacklist = adjustMatchers(value)), resourceUrlBlacklist;
        }, this.$get = [ "$injector", function($injector) {
            var htmlSanitizer = function(html) {
                throw $sceMinErr("unsafe", "Attempting to use an unsafe value in a safe context.");
            };
            function matchUrl(matcher, parsedUrl) {
                return "self" === matcher ? urlIsSameOrigin(parsedUrl) : !!matcher.exec(parsedUrl.href);
            }
            function generateHolderType(Base) {
                var holderType = function(trustedValue) {
                    this.$$unwrapTrustedValue = function() {
                        return trustedValue;
                    };
                };
                return Base && (holderType.prototype = new Base()), holderType.prototype.valueOf = function() {
                    return this.$$unwrapTrustedValue();
                }, holderType.prototype.toString = function() {
                    return this.$$unwrapTrustedValue().toString();
                }, holderType;
            }
            $injector.has("$sanitize") && (htmlSanitizer = $injector.get("$sanitize"));
            var trustedValueHolderBase = generateHolderType(), byType = {};
            return byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase), byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase), 
            byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase), byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase), 
            byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]), 
            {
                trustAs: function(type, trustedValue) {
                    var Constructor = byType.hasOwnProperty(type) ? byType[type] : null;
                    if (!Constructor) throw $sceMinErr("icontext", "Attempted to trust a value in invalid context. Context: {0}; Value: {1}", type, trustedValue);
                    if (null === trustedValue || isUndefined(trustedValue) || "" === trustedValue) return trustedValue;
                    if ("string" != typeof trustedValue) throw $sceMinErr("itype", "Attempted to trust a non-string value in a content requiring a string: Context: {0}", type);
                    return new Constructor(trustedValue);
                },
                getTrusted: function(type, maybeTrusted) {
                    if (null === maybeTrusted || isUndefined(maybeTrusted) || "" === maybeTrusted) return maybeTrusted;
                    var constructor = byType.hasOwnProperty(type) ? byType[type] : null;
                    if (constructor && maybeTrusted instanceof constructor) return maybeTrusted.$$unwrapTrustedValue();
                    if (type === SCE_CONTEXTS.RESOURCE_URL) {
                        if (function(url) {
                            var i, n, parsedUrl = urlResolve(url.toString()), allowed = !1;
                            for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {
                                allowed = !0;
                                break;
                            }
                            if (allowed) for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {
                                allowed = !1;
                                break;
                            }
                            return allowed;
                        }(maybeTrusted)) return maybeTrusted;
                        throw $sceMinErr("insecurl", "Blocked loading resource from url not allowed by $sceDelegate policy.  URL: {0}", maybeTrusted.toString());
                    }
                    if (type === SCE_CONTEXTS.HTML) return htmlSanitizer(maybeTrusted);
                    throw $sceMinErr("unsafe", "Attempting to use an unsafe value in a safe context.");
                },
                valueOf: function(maybeTrusted) {
                    return maybeTrusted instanceof trustedValueHolderBase ? maybeTrusted.$$unwrapTrustedValue() : maybeTrusted;
                }
            };
        } ];
    }
    function $SceProvider() {
        var enabled = !0;
        this.enabled = function(value) {
            return arguments.length && (enabled = !!value), enabled;
        }, this.$get = [ "$parse", "$sceDelegate", function($parse, $sceDelegate) {
            if (enabled && msie < 8) throw $sceMinErr("iequirks", "Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks mode.  You can fix this by adding the text <!doctype html> to the top of your HTML document.  See http://docs.angularjs.org/api/ng.$sce for more information.");
            var sce = shallowCopy(SCE_CONTEXTS);
            sce.isEnabled = function() {
                return enabled;
            }, sce.trustAs = $sceDelegate.trustAs, sce.getTrusted = $sceDelegate.getTrusted, 
            sce.valueOf = $sceDelegate.valueOf, enabled || (sce.trustAs = sce.getTrusted = function(type, value) {
                return value;
            }, sce.valueOf = identity), sce.parseAs = function(type, expr) {
                var parsed = $parse(expr);
                return parsed.literal && parsed.constant ? parsed : $parse(expr, function(value) {
                    return sce.getTrusted(type, value);
                });
            };
            var parse = sce.parseAs, getTrusted = sce.getTrusted, trustAs = sce.trustAs;
            return forEach(SCE_CONTEXTS, function(enumValue, name) {
                var lName = lowercase(name);
                sce[camelCase("parse_as_" + lName)] = function(expr) {
                    return parse(enumValue, expr);
                }, sce[camelCase("get_trusted_" + lName)] = function(value) {
                    return getTrusted(enumValue, value);
                }, sce[camelCase("trust_as_" + lName)] = function(value) {
                    return trustAs(enumValue, value);
                };
            }), sce;
        } ];
    }
    function $SnifferProvider() {
        this.$get = [ "$window", "$document", function($window, $document) {
            var vendorPrefix, match, eventSupport = {}, hasHistoryPushState = !($window.chrome && $window.chrome.app && $window.chrome.app.runtime) && $window.history && $window.history.pushState, android = toInt((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]), boxee = /Boxee/i.test(($window.navigator || {}).userAgent), document = $document[0] || {}, vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/, bodyStyle = document.body && document.body.style, transitions = !1, animations = !1;
            if (bodyStyle) {
                for (var prop in bodyStyle) if (match = vendorRegex.exec(prop)) {
                    vendorPrefix = (vendorPrefix = match[0])[0].toUpperCase() + vendorPrefix.substr(1);
                    break;
                }
                vendorPrefix || (vendorPrefix = "WebkitOpacity" in bodyStyle && "webkit"), transitions = !!("transition" in bodyStyle || vendorPrefix + "Transition" in bodyStyle), 
                animations = !!("animation" in bodyStyle || vendorPrefix + "Animation" in bodyStyle), 
                !android || transitions && animations || (transitions = isString(bodyStyle.webkitTransition), 
                animations = isString(bodyStyle.webkitAnimation));
            }
            return {
                history: !(!hasHistoryPushState || android < 4 || boxee),
                hasEvent: function(event) {
                    if ("input" === event && msie <= 11) return !1;
                    if (isUndefined(eventSupport[event])) {
                        var divElm = document.createElement("div");
                        eventSupport[event] = "on" + event in divElm;
                    }
                    return eventSupport[event];
                },
                csp: csp(),
                vendorPrefix: vendorPrefix,
                transitions: transitions,
                animations: animations,
                android: android
            };
        } ];
    }
    var $templateRequestMinErr = minErr("$compile");
    function $TemplateRequestProvider() {
        var httpOptions;
        this.httpOptions = function(val) {
            return val ? (httpOptions = val, this) : httpOptions;
        }, this.$get = [ "$templateCache", "$http", "$q", "$sce", function($templateCache, $http, $q, $sce) {
            function handleRequestFn(tpl, ignoreRequestError) {
                handleRequestFn.totalPendingRequests++, isString(tpl) && !isUndefined($templateCache.get(tpl)) || (tpl = $sce.getTrustedResourceUrl(tpl));
                var transformResponse = $http.defaults && $http.defaults.transformResponse;
                return isArray(transformResponse) ? transformResponse = transformResponse.filter(function(transformer) {
                    return transformer !== defaultHttpResponseTransform;
                }) : transformResponse === defaultHttpResponseTransform && (transformResponse = null), 
                $http.get(tpl, extend({
                    cache: $templateCache,
                    transformResponse: transformResponse
                }, httpOptions)).finally(function() {
                    handleRequestFn.totalPendingRequests--;
                }).then(function(response) {
                    return $templateCache.put(tpl, response.data), response.data;
                }, function(resp) {
                    if (!ignoreRequestError) throw $templateRequestMinErr("tpload", "Failed to load template: {0} (HTTP status: {1} {2})", tpl, resp.status, resp.statusText);
                    return $q.reject(resp);
                });
            }
            return handleRequestFn.totalPendingRequests = 0, handleRequestFn;
        } ];
    }
    function $$TestabilityProvider() {
        this.$get = [ "$rootScope", "$browser", "$location", function($rootScope, $browser, $location) {
            var testability = {
                findBindings: function(element, expression, opt_exactMatch) {
                    var bindings = element.getElementsByClassName("ng-binding"), matches = [];
                    return forEach(bindings, function(binding) {
                        var dataBinding = angular.element(binding).data("$binding");
                        dataBinding && forEach(dataBinding, function(bindingName) {
                            opt_exactMatch ? new RegExp("(^|\\s)" + escapeForRegexp(expression) + "(\\s|\\||$)").test(bindingName) && matches.push(binding) : -1 != bindingName.indexOf(expression) && matches.push(binding);
                        });
                    }), matches;
                },
                findModels: function(element, expression, opt_exactMatch) {
                    for (var prefixes = [ "ng-", "data-ng-", "ng\\:" ], p = 0; p < prefixes.length; ++p) {
                        var selector = "[" + prefixes[p] + "model" + (opt_exactMatch ? "=" : "*=") + '"' + expression + '"]', elements = element.querySelectorAll(selector);
                        if (elements.length) return elements;
                    }
                },
                getLocation: function() {
                    return $location.url();
                },
                setLocation: function(url) {
                    url !== $location.url() && ($location.url(url), $rootScope.$digest());
                },
                whenStable: function(callback) {
                    $browser.notifyWhenNoOutstandingRequests(callback);
                }
            };
            return testability;
        } ];
    }
    function $TimeoutProvider() {
        this.$get = [ "$rootScope", "$browser", "$q", "$$q", "$exceptionHandler", function($rootScope, $browser, $q, $$q, $exceptionHandler) {
            var deferreds = {};
            function timeout(fn, delay, invokeApply) {
                isFunction(fn) || (invokeApply = delay, delay = fn, fn = noop);
                var timeoutId, args = sliceArgs(arguments, 3), skipApply = isDefined(invokeApply) && !invokeApply, deferred = (skipApply ? $$q : $q).defer(), promise = deferred.promise;
                return timeoutId = $browser.defer(function() {
                    try {
                        deferred.resolve(fn.apply(null, args));
                    } catch (e) {
                        deferred.reject(e), $exceptionHandler(e);
                    } finally {
                        delete deferreds[promise.$$timeoutId];
                    }
                    skipApply || $rootScope.$apply();
                }, delay), promise.$$timeoutId = timeoutId, deferreds[timeoutId] = deferred, promise;
            }
            return timeout.cancel = function(promise) {
                return !!(promise && promise.$$timeoutId in deferreds) && (deferreds[promise.$$timeoutId].reject("canceled"), 
                delete deferreds[promise.$$timeoutId], $browser.defer.cancel(promise.$$timeoutId));
            }, timeout;
        } ];
    }
    var urlParsingNode = window.document.createElement("a"), originUrl = urlResolve(window.location.href);
    function urlResolve(url) {
        var href = url;
        return msie && (urlParsingNode.setAttribute("href", href), href = urlParsingNode.href), 
        urlParsingNode.setAttribute("href", href), {
            href: urlParsingNode.href,
            protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, "") : "",
            host: urlParsingNode.host,
            search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, "") : "",
            hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, "") : "",
            hostname: urlParsingNode.hostname,
            port: urlParsingNode.port,
            pathname: "/" === urlParsingNode.pathname.charAt(0) ? urlParsingNode.pathname : "/" + urlParsingNode.pathname
        };
    }
    function urlIsSameOrigin(requestUrl) {
        var parsed = isString(requestUrl) ? urlResolve(requestUrl) : requestUrl;
        return parsed.protocol === originUrl.protocol && parsed.host === originUrl.host;
    }
    function $WindowProvider() {
        this.$get = valueFn(window);
    }
    function $$CookieReader($document) {
        var rawDocument = $document[0] || {}, lastCookies = {}, lastCookieString = "";
        function safeDecodeURIComponent(str) {
            try {
                return decodeURIComponent(str);
            } catch (e) {
                return str;
            }
        }
        return function() {
            var cookieArray, cookie, i, index, name, currentCookieString = rawDocument.cookie || "";
            if (currentCookieString !== lastCookieString) for (cookieArray = (lastCookieString = currentCookieString).split("; "), 
            lastCookies = {}, i = 0; i < cookieArray.length; i++) 0 < (index = (cookie = cookieArray[i]).indexOf("=")) && (name = safeDecodeURIComponent(cookie.substring(0, index)), 
            isUndefined(lastCookies[name]) && (lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1))));
            return lastCookies;
        };
    }
    function $$CookieReaderProvider() {
        this.$get = $$CookieReader;
    }
    function $FilterProvider($provide) {
        var suffix = "Filter";
        function register(name, factory) {
            if (isObject(name)) {
                var filters = {};
                return forEach(name, function(filter, key) {
                    filters[key] = register(key, filter);
                }), filters;
            }
            return $provide.factory(name + suffix, factory);
        }
        this.register = register, this.$get = [ "$injector", function($injector) {
            return function(name) {
                return $injector.get(name + suffix);
            };
        } ], register("currency", currencyFilter), register("date", dateFilter), register("filter", filterFilter), 
        register("json", jsonFilter), register("limitTo", limitToFilter), register("lowercase", lowercaseFilter), 
        register("number", numberFilter), register("orderBy", orderByFilter), register("uppercase", uppercaseFilter);
    }
    function filterFilter() {
        return function(array, expression, comparator, anyPropertyKey) {
            if (!isArrayLike(array)) {
                if (null == array) return array;
                throw minErr("filter")("notarray", "Expected array but received: {0}", array);
            }
            var predicateFn, matchAgainstAnyProp;
            switch (anyPropertyKey = anyPropertyKey || "$", getTypeForFilter(expression)) {
              case "function":
                predicateFn = expression;
                break;

              case "boolean":
              case "null":
              case "number":
              case "string":
                matchAgainstAnyProp = !0;

              case "object":
                predicateFn = function(expression, comparator, anyPropertyKey, matchAgainstAnyProp) {
                    var shouldMatchPrimitives = isObject(expression) && anyPropertyKey in expression;
                    !0 === comparator ? comparator = equals : isFunction(comparator) || (comparator = function(actual, expected) {
                        return !isUndefined(actual) && (null === actual || null === expected ? actual === expected : !(isObject(expected) || isObject(actual) && !hasCustomToString(actual)) && (actual = lowercase("" + actual), 
                        expected = lowercase("" + expected), -1 !== actual.indexOf(expected)));
                    });
                    return function(item) {
                        return shouldMatchPrimitives && !isObject(item) ? deepCompare(item, expression[anyPropertyKey], comparator, anyPropertyKey, !1) : deepCompare(item, expression, comparator, anyPropertyKey, matchAgainstAnyProp);
                    };
                }(expression, comparator, anyPropertyKey, matchAgainstAnyProp);
                break;

              default:
                return array;
            }
            return Array.prototype.filter.call(array, predicateFn);
        };
    }
    function deepCompare(actual, expected, comparator, anyPropertyKey, matchAgainstAnyProp, dontMatchWholeObject) {
        var actualType = getTypeForFilter(actual), expectedType = getTypeForFilter(expected);
        if ("string" === expectedType && "!" === expected.charAt(0)) return !deepCompare(actual, expected.substring(1), comparator, anyPropertyKey, matchAgainstAnyProp);
        if (isArray(actual)) return actual.some(function(item) {
            return deepCompare(item, expected, comparator, anyPropertyKey, matchAgainstAnyProp);
        });
        switch (actualType) {
          case "object":
            var key;
            if (matchAgainstAnyProp) {
                for (key in actual) if ("$" !== key.charAt(0) && deepCompare(actual[key], expected, comparator, anyPropertyKey, !0)) return !0;
                return !dontMatchWholeObject && deepCompare(actual, expected, comparator, anyPropertyKey, !1);
            }
            if ("object" === expectedType) {
                for (key in expected) {
                    var expectedVal = expected[key];
                    if (!isFunction(expectedVal) && !isUndefined(expectedVal)) {
                        var matchAnyProperty = key === anyPropertyKey;
                        if (!deepCompare(matchAnyProperty ? actual : actual[key], expectedVal, comparator, anyPropertyKey, matchAnyProperty, matchAnyProperty)) return !1;
                    }
                }
                return !0;
            }
            return comparator(actual, expected);

          case "function":
            return !1;

          default:
            return comparator(actual, expected);
        }
    }
    function getTypeForFilter(val) {
        return null === val ? "null" : typeof val;
    }
    $$CookieReader.$inject = [ "$document" ], $FilterProvider.$inject = [ "$provide" ];
    var MAX_DIGITS = 22, DECIMAL_SEP = ".", ZERO_CHAR = "0";
    function currencyFilter($locale) {
        var formats = $locale.NUMBER_FORMATS;
        return function(amount, currencySymbol, fractionSize) {
            return isUndefined(currencySymbol) && (currencySymbol = formats.CURRENCY_SYM), isUndefined(fractionSize) && (fractionSize = formats.PATTERNS[1].maxFrac), 
            null == amount ? amount : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize).replace(/\u00A4/g, currencySymbol);
        };
    }
    function numberFilter($locale) {
        var formats = $locale.NUMBER_FORMATS;
        return function(number, fractionSize) {
            return null == number ? number : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize);
        };
    }
    function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
        if (!isString(number) && !isNumber(number) || isNaN(number)) return "";
        var parsedNumber, isInfinity = !isFinite(number), isZero = !1, numStr = Math.abs(number) + "", formattedText = "";
        if (isInfinity) formattedText = "∞"; else {
            (function(parsedNumber, fractionSize, minFrac, maxFrac) {
                var digits = parsedNumber.d, fractionLen = digits.length - parsedNumber.i, roundAt = (fractionSize = isUndefined(fractionSize) ? Math.min(Math.max(minFrac, fractionLen), maxFrac) : +fractionSize) + parsedNumber.i, digit = digits[roundAt];
                if (0 < roundAt) {
                    digits.splice(Math.max(parsedNumber.i, roundAt));
                    for (var j = roundAt; j < digits.length; j++) digits[j] = 0;
                } else {
                    fractionLen = Math.max(0, fractionLen), parsedNumber.i = 1, digits.length = Math.max(1, roundAt = fractionSize + 1), 
                    digits[0] = 0;
                    for (var i = 1; i < roundAt; i++) digits[i] = 0;
                }
                if (5 <= digit) if (roundAt - 1 < 0) {
                    for (var k = 0; roundAt < k; k--) digits.unshift(0), parsedNumber.i++;
                    digits.unshift(1), parsedNumber.i++;
                } else digits[roundAt - 1]++;
                for (;fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0);
                var carry = digits.reduceRight(function(carry, d, i, digits) {
                    return d += carry, digits[i] = d % 10, Math.floor(d / 10);
                }, 0);
                carry && (digits.unshift(carry), parsedNumber.i++);
            })(parsedNumber = function(numStr) {
                var digits, numberOfIntegerDigits, i, j, zeros, exponent = 0;
                for (-1 < (numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) && (numStr = numStr.replace(DECIMAL_SEP, "")), 
                0 < (i = numStr.search(/e/i)) ? (numberOfIntegerDigits < 0 && (numberOfIntegerDigits = i), 
                numberOfIntegerDigits += +numStr.slice(i + 1), numStr = numStr.substring(0, i)) : numberOfIntegerDigits < 0 && (numberOfIntegerDigits = numStr.length), 
                i = 0; numStr.charAt(i) == ZERO_CHAR; i++) ;
                if (i == (zeros = numStr.length)) digits = [ 0 ], numberOfIntegerDigits = 1; else {
                    for (zeros--; numStr.charAt(zeros) == ZERO_CHAR; ) zeros--;
                    for (numberOfIntegerDigits -= i, digits = [], j = 0; i <= zeros; i++, j++) digits[j] = +numStr.charAt(i);
                }
                return MAX_DIGITS < numberOfIntegerDigits && (digits = digits.splice(0, MAX_DIGITS - 1), 
                exponent = numberOfIntegerDigits - 1, numberOfIntegerDigits = 1), {
                    d: digits,
                    e: exponent,
                    i: numberOfIntegerDigits
                };
            }(numStr), fractionSize, pattern.minFrac, pattern.maxFrac);
            var digits = parsedNumber.d, integerLen = parsedNumber.i, exponent = parsedNumber.e, decimals = [];
            for (isZero = digits.reduce(function(isZero, d) {
                return isZero && !d;
            }, !0); integerLen < 0; ) digits.unshift(0), integerLen++;
            0 < integerLen ? decimals = digits.splice(integerLen, digits.length) : (decimals = digits, 
            digits = [ 0 ]);
            var groups = [];
            for (digits.length >= pattern.lgSize && groups.unshift(digits.splice(-pattern.lgSize, digits.length).join("")); digits.length > pattern.gSize; ) groups.unshift(digits.splice(-pattern.gSize, digits.length).join(""));
            digits.length && groups.unshift(digits.join("")), formattedText = groups.join(groupSep), 
            decimals.length && (formattedText += decimalSep + decimals.join("")), exponent && (formattedText += "e+" + exponent);
        }
        return number < 0 && !isZero ? pattern.negPre + formattedText + pattern.negSuf : pattern.posPre + formattedText + pattern.posSuf;
    }
    function padNumber(num, digits, trim, negWrap) {
        var neg = "";
        for ((num < 0 || negWrap && num <= 0) && (negWrap ? num = 1 - num : (num = -num, 
        neg = "-")), num = "" + num; num.length < digits; ) num = ZERO_CHAR + num;
        return trim && (num = num.substr(num.length - digits)), neg + num;
    }
    function dateGetter(name, size, offset, trim, negWrap) {
        return offset = offset || 0, function(date) {
            var value = date["get" + name]();
            return (0 < offset || -offset < value) && (value += offset), 0 === value && -12 == offset && (value = 12), 
            padNumber(value, size, trim, negWrap);
        };
    }
    function dateStrGetter(name, shortForm, standAlone) {
        return function(date, formats) {
            var value = date["get" + name]();
            return formats[uppercase((standAlone ? "STANDALONE" : "") + (shortForm ? "SHORT" : "") + name)][value];
        };
    }
    function getFirstThursdayOfYear(year) {
        var dayOfWeekOnFirst = new Date(year, 0, 1).getDay();
        return new Date(year, 0, (dayOfWeekOnFirst <= 4 ? 5 : 12) - dayOfWeekOnFirst);
    }
    function weekGetter(size) {
        return function(date) {
            var datetime, firstThurs = getFirstThursdayOfYear(date.getFullYear()), diff = +(datetime = date, 
            new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (4 - datetime.getDay()))) - +firstThurs;
            return padNumber(1 + Math.round(diff / 6048e5), size);
        };
    }
    function eraGetter(date, formats) {
        return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1];
    }
    currencyFilter.$inject = [ "$locale" ];
    var DATE_FORMATS = {
        yyyy: dateGetter("FullYear", 4, 0, !(numberFilter.$inject = [ "$locale" ]), !0),
        yy: dateGetter("FullYear", 2, 0, !0, !0),
        y: dateGetter("FullYear", 1, 0, !1, !0),
        MMMM: dateStrGetter("Month"),
        MMM: dateStrGetter("Month", !0),
        MM: dateGetter("Month", 2, 1),
        M: dateGetter("Month", 1, 1),
        LLLL: dateStrGetter("Month", !1, !0),
        dd: dateGetter("Date", 2),
        d: dateGetter("Date", 1),
        HH: dateGetter("Hours", 2),
        H: dateGetter("Hours", 1),
        hh: dateGetter("Hours", 2, -12),
        h: dateGetter("Hours", 1, -12),
        mm: dateGetter("Minutes", 2),
        m: dateGetter("Minutes", 1),
        ss: dateGetter("Seconds", 2),
        s: dateGetter("Seconds", 1),
        sss: dateGetter("Milliseconds", 3),
        EEEE: dateStrGetter("Day"),
        EEE: dateStrGetter("Day", !0),
        a: function(date, formats) {
            return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
        },
        Z: function(date, formats, offset) {
            var zone = -1 * offset, paddedZone = 0 <= zone ? "+" : "";
            return paddedZone += padNumber(Math[0 < zone ? "floor" : "ceil"](zone / 60), 2) + padNumber(Math.abs(zone % 60), 2);
        },
        ww: weekGetter(2),
        w: weekGetter(1),
        G: eraGetter,
        GG: eraGetter,
        GGG: eraGetter,
        GGGG: function(date, formats) {
            return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1];
        }
    }, DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/, NUMBER_STRING = /^\-?\d+$/;
    function dateFilter($locale) {
        var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
        return function(date, format, timezone) {
            var fn, match, text = "", parts = [];
            if (format = format || "mediumDate", format = $locale.DATETIME_FORMATS[format] || format, 
            isString(date) && (date = NUMBER_STRING.test(date) ? toInt(date) : function(string) {
                var match;
                if (match = string.match(R_ISO8601_STR)) {
                    var date = new Date(0), tzHour = 0, tzMin = 0, dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear, timeSetter = match[8] ? date.setUTCHours : date.setHours;
                    match[9] && (tzHour = toInt(match[9] + match[10]), tzMin = toInt(match[9] + match[11])), 
                    dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3]));
                    var h = toInt(match[4] || 0) - tzHour, m = toInt(match[5] || 0) - tzMin, s = toInt(match[6] || 0), ms = Math.round(1e3 * parseFloat("0." + (match[7] || 0)));
                    return timeSetter.call(date, h, m, s, ms), date;
                }
                return string;
            }(date)), isNumber(date) && (date = new Date(date)), !isDate(date) || !isFinite(date.getTime())) return date;
            for (;format; ) (match = DATE_FORMATS_SPLIT.exec(format)) ? format = (parts = concat(parts, match, 1)).pop() : (parts.push(format), 
            format = null);
            var dateTimezoneOffset = date.getTimezoneOffset();
            return timezone && (dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset), 
            date = convertTimezoneToLocal(date, timezone, !0)), forEach(parts, function(value) {
                fn = DATE_FORMATS[value], text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset) : "''" === value ? "'" : value.replace(/(^'|'$)/g, "").replace(/''/g, "'");
            }), text;
        };
    }
    function jsonFilter() {
        return function(object, spacing) {
            return isUndefined(spacing) && (spacing = 2), toJson(object, spacing);
        };
    }
    dateFilter.$inject = [ "$locale" ];
    var lowercaseFilter = valueFn(lowercase), uppercaseFilter = valueFn(uppercase);
    function limitToFilter() {
        return function(input, limit, begin) {
            return limit = Math.abs(Number(limit)) === 1 / 0 ? Number(limit) : toInt(limit), 
            isNaN(limit) ? input : (isNumber(input) && (input = input.toString()), isArrayLike(input) ? (begin = (begin = !begin || isNaN(begin) ? 0 : toInt(begin)) < 0 ? Math.max(0, input.length + begin) : begin, 
            0 <= limit ? sliceFn(input, begin, begin + limit) : 0 === begin ? sliceFn(input, limit, input.length) : sliceFn(input, Math.max(0, begin + limit), begin)) : input);
        };
    }
    function sliceFn(input, begin, end) {
        return isString(input) ? input.slice(begin, end) : slice.call(input, begin, end);
    }
    function orderByFilter($parse) {
        return function(array, sortPredicate, reverseOrder, compareFn) {
            if (null == array) return array;
            if (!isArrayLike(array)) throw minErr("orderBy")("notarray", "Expected array but received: {0}", array);
            isArray(sortPredicate) || (sortPredicate = [ sortPredicate ]), 0 === sortPredicate.length && (sortPredicate = [ "+" ]);
            var predicates = sortPredicate.map(function(predicate) {
                var descending = 1, get = identity;
                if (isFunction(predicate)) get = predicate; else if (isString(predicate) && ("+" != predicate.charAt(0) && "-" != predicate.charAt(0) || (descending = "-" == predicate.charAt(0) ? -1 : 1, 
                predicate = predicate.substring(1)), "" !== predicate && (get = $parse(predicate)).constant)) {
                    var key = get();
                    get = function(value) {
                        return value[key];
                    };
                }
                return {
                    get: get,
                    descending: descending
                };
            }), descending = reverseOrder ? -1 : 1, compare = isFunction(compareFn) ? compareFn : defaultCompare, compareValues = Array.prototype.map.call(array, function(value, index) {
                return {
                    value: value,
                    tieBreaker: {
                        value: index,
                        type: "number",
                        index: index
                    },
                    predicateValues: predicates.map(function(predicate) {
                        return function(value, index) {
                            var type = typeof value;
                            null === value ? (type = "string", value = "null") : "object" === type && (value = function(value) {
                                if (isFunction(value.valueOf) && isPrimitive(value = value.valueOf())) return value;
                                if (hasCustomToString(value) && isPrimitive(value = value.toString())) return value;
                                return value;
                            }(value));
                            return {
                                value: value,
                                type: type,
                                index: index
                            };
                        }(predicate.get(value), index);
                    })
                };
            });
            return compareValues.sort(function(v1, v2) {
                for (var i = 0, ii = predicates.length; i < ii; i++) {
                    var result = compare(v1.predicateValues[i], v2.predicateValues[i]);
                    if (result) return result * predicates[i].descending * descending;
                }
                return compare(v1.tieBreaker, v2.tieBreaker) * descending;
            }), array = compareValues.map(function(item) {
                return item.value;
            });
        };
        function isPrimitive(value) {
            switch (typeof value) {
              case "number":
              case "boolean":
              case "string":
                return !0;

              default:
                return !1;
            }
        }
        function defaultCompare(v1, v2) {
            var result = 0, type1 = v1.type, type2 = v2.type;
            if (type1 === type2) {
                var value1 = v1.value, value2 = v2.value;
                "string" === type1 ? (value1 = value1.toLowerCase(), value2 = value2.toLowerCase()) : "object" === type1 && (isObject(value1) && (value1 = v1.index), 
                isObject(value2) && (value2 = v2.index)), value1 !== value2 && (result = value1 < value2 ? -1 : 1);
            } else result = type1 < type2 ? -1 : 1;
            return result;
        }
    }
    function ngDirective(directive) {
        return isFunction(directive) && (directive = {
            link: directive
        }), directive.restrict = directive.restrict || "AC", valueFn(directive);
    }
    orderByFilter.$inject = [ "$parse" ];
    var htmlAnchorDirective = valueFn({
        restrict: "E",
        compile: function(element, attr) {
            if (!attr.href && !attr.xlinkHref) return function(scope, element) {
                if ("a" === element[0].nodeName.toLowerCase()) {
                    var href = "[object SVGAnimatedString]" === toString.call(element.prop("href")) ? "xlink:href" : "href";
                    element.on("click", function(event) {
                        element.attr(href) || event.preventDefault();
                    });
                }
            };
        }
    }), ngAttributeAliasDirectives = {};
    forEach(BOOLEAN_ATTR, function(propName, attrName) {
        if ("multiple" != propName) {
            var normalized = directiveNormalize("ng-" + attrName), linkFn = defaultLinkFn;
            "checked" === propName && (linkFn = function(scope, element, attr) {
                attr.ngModel !== attr[normalized] && defaultLinkFn(scope, 0, attr);
            }), ngAttributeAliasDirectives[normalized] = function() {
                return {
                    restrict: "A",
                    priority: 100,
                    link: linkFn
                };
            };
        }
        function defaultLinkFn(scope, element, attr) {
            scope.$watch(attr[normalized], function(value) {
                attr.$set(attrName, !!value);
            });
        }
    }), forEach(ALIASED_ATTR, function(htmlAttr, ngAttr) {
        ngAttributeAliasDirectives[ngAttr] = function() {
            return {
                priority: 100,
                link: function(scope, element, attr) {
                    if ("ngPattern" === ngAttr && "/" == attr.ngPattern.charAt(0)) {
                        var match = attr.ngPattern.match(REGEX_STRING_REGEXP);
                        if (match) return void attr.$set("ngPattern", new RegExp(match[1], match[2]));
                    }
                    scope.$watch(attr[ngAttr], function(value) {
                        attr.$set(ngAttr, value);
                    });
                }
            };
        };
    }), forEach([ "src", "srcset", "href" ], function(attrName) {
        var normalized = directiveNormalize("ng-" + attrName);
        ngAttributeAliasDirectives[normalized] = function() {
            return {
                priority: 99,
                link: function(scope, element, attr) {
                    var propName = attrName, name = attrName;
                    "href" === attrName && "[object SVGAnimatedString]" === toString.call(element.prop("href")) && (name = "xlinkHref", 
                    attr.$attr[name] = "xlink:href", propName = null), attr.$observe(normalized, function(value) {
                        value ? (attr.$set(name, value), msie && propName && element.prop(propName, attr[name])) : "href" === attrName && attr.$set(name, null);
                    });
                }
            };
        };
    });
    var nullFormCtrl = {
        $addControl: noop,
        $$renameControl: function(control, name) {
            control.$name = name;
        },
        $removeControl: noop,
        $setValidity: noop,
        $setDirty: noop,
        $setPristine: noop,
        $setSubmitted: noop
    }, SUBMITTED_CLASS = "ng-submitted";
    function FormController(element, attrs, $scope, $animate, $interpolate) {
        var form = this, controls = [];
        form.$error = {}, form.$$success = {}, form.$pending = void 0, form.$name = $interpolate(attrs.name || attrs.ngForm || "")($scope), 
        form.$dirty = !1, form.$pristine = !0, form.$valid = !0, form.$invalid = !1, form.$submitted = !1, 
        form.$$parentForm = nullFormCtrl, form.$rollbackViewValue = function() {
            forEach(controls, function(control) {
                control.$rollbackViewValue();
            });
        }, form.$commitViewValue = function() {
            forEach(controls, function(control) {
                control.$commitViewValue();
            });
        }, form.$addControl = function(control) {
            assertNotHasOwnProperty(control.$name, "input"), controls.push(control), control.$name && (form[control.$name] = control), 
            control.$$parentForm = form;
        }, form.$$renameControl = function(control, newName) {
            var oldName = control.$name;
            form[oldName] === control && delete form[oldName], (form[newName] = control).$name = newName;
        }, form.$removeControl = function(control) {
            control.$name && form[control.$name] === control && delete form[control.$name], 
            forEach(form.$pending, function(value, name) {
                form.$setValidity(name, null, control);
            }), forEach(form.$error, function(value, name) {
                form.$setValidity(name, null, control);
            }), forEach(form.$$success, function(value, name) {
                form.$setValidity(name, null, control);
            }), arrayRemove(controls, control), control.$$parentForm = nullFormCtrl;
        }, addSetValidityMethod({
            ctrl: this,
            $element: element,
            set: function(object, property, controller) {
                var list = object[property];
                list ? -1 === list.indexOf(controller) && list.push(controller) : object[property] = [ controller ];
            },
            unset: function(object, property, controller) {
                var list = object[property];
                list && (arrayRemove(list, controller), 0 === list.length && delete object[property]);
            },
            $animate: $animate
        }), form.$setDirty = function() {
            $animate.removeClass(element, PRISTINE_CLASS), $animate.addClass(element, DIRTY_CLASS), 
            form.$dirty = !0, form.$pristine = !1, form.$$parentForm.$setDirty();
        }, form.$setPristine = function() {
            $animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + " " + SUBMITTED_CLASS), 
            form.$dirty = !1, form.$pristine = !0, form.$submitted = !1, forEach(controls, function(control) {
                control.$setPristine();
            });
        }, form.$setUntouched = function() {
            forEach(controls, function(control) {
                control.$setUntouched();
            });
        }, form.$setSubmitted = function() {
            $animate.addClass(element, SUBMITTED_CLASS), form.$submitted = !0, form.$$parentForm.$setSubmitted();
        };
    }
    FormController.$inject = [ "$element", "$attrs", "$scope", "$animate", "$interpolate" ];
    var formDirectiveFactory = function(isNgForm) {
        return [ "$timeout", "$parse", function($timeout, $parse) {
            return {
                name: "form",
                restrict: isNgForm ? "EAC" : "E",
                require: [ "form", "^^?form" ],
                controller: FormController,
                compile: function(formElement, attr) {
                    formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);
                    var nameAttr = attr.name ? "name" : !(!isNgForm || !attr.ngForm) && "ngForm";
                    return {
                        pre: function(scope, formElement, attr, ctrls) {
                            var controller = ctrls[0];
                            if (!("action" in attr)) {
                                var handleFormSubmission = function(event) {
                                    scope.$apply(function() {
                                        controller.$commitViewValue(), controller.$setSubmitted();
                                    }), event.preventDefault();
                                };
                                addEventListenerFn(formElement[0], "submit", handleFormSubmission), formElement.on("$destroy", function() {
                                    $timeout(function() {
                                        removeEventListenerFn(formElement[0], "submit", handleFormSubmission);
                                    }, 0, !1);
                                });
                            }
                            (ctrls[1] || controller.$$parentForm).$addControl(controller);
                            var setter = nameAttr ? getSetter(controller.$name) : noop;
                            nameAttr && (setter(scope, controller), attr.$observe(nameAttr, function(newValue) {
                                controller.$name !== newValue && (setter(scope, void 0), controller.$$parentForm.$$renameControl(controller, newValue), 
                                (setter = getSetter(controller.$name))(scope, controller));
                            })), formElement.on("$destroy", function() {
                                controller.$$parentForm.$removeControl(controller), setter(scope, void 0), extend(controller, nullFormCtrl);
                            });
                        }
                    };
                }
            };
            function getSetter(expression) {
                return "" === expression ? $parse('this[""]').assign : $parse(expression).assign || noop;
            }
        } ];
    }, formDirective = formDirectiveFactory(), ngFormDirective = formDirectiveFactory(!0), ISO_DATE_REGEXP = /^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/, URL_REGEXP = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+\])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i, EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/, NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/, DATE_REGEXP = /^(\d{4,})-(\d{2})-(\d{2})$/, DATETIMELOCAL_REGEXP = /^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/, WEEK_REGEXP = /^(\d{4,})-W(\d\d)$/, MONTH_REGEXP = /^(\d{4,})-(\d\d)$/, TIME_REGEXP = /^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/, PARTIAL_VALIDATION_EVENTS = "keydown wheel mousedown", PARTIAL_VALIDATION_TYPES = createMap();
    forEach("date,datetime-local,month,time,week".split(","), function(type) {
        PARTIAL_VALIDATION_TYPES[type] = !0;
    });
    var inputType = {
        text: function(scope, element, attr, ctrl, $sniffer, $browser) {
            baseInputType(scope, element, attr, ctrl, $sniffer, $browser), stringBasedInputType(ctrl);
        },
        date: createDateInputType("date", DATE_REGEXP, createDateParser(DATE_REGEXP, [ "yyyy", "MM", "dd" ]), "yyyy-MM-dd"),
        "datetime-local": createDateInputType("datetimelocal", DATETIMELOCAL_REGEXP, createDateParser(DATETIMELOCAL_REGEXP, [ "yyyy", "MM", "dd", "HH", "mm", "ss", "sss" ]), "yyyy-MM-ddTHH:mm:ss.sss"),
        time: createDateInputType("time", TIME_REGEXP, createDateParser(TIME_REGEXP, [ "HH", "mm", "ss", "sss" ]), "HH:mm:ss.sss"),
        week: createDateInputType("week", WEEK_REGEXP, function(isoWeek, existingDate) {
            if (isDate(isoWeek)) return isoWeek;
            if (isString(isoWeek)) {
                WEEK_REGEXP.lastIndex = 0;
                var parts = WEEK_REGEXP.exec(isoWeek);
                if (parts) {
                    var year = +parts[1], week = +parts[2], hours = 0, minutes = 0, seconds = 0, milliseconds = 0, firstThurs = getFirstThursdayOfYear(year), addDays = 7 * (week - 1);
                    return existingDate && (hours = existingDate.getHours(), minutes = existingDate.getMinutes(), 
                    seconds = existingDate.getSeconds(), milliseconds = existingDate.getMilliseconds()), 
                    new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds);
                }
            }
            return NaN;
        }, "yyyy-Www"),
        month: createDateInputType("month", MONTH_REGEXP, createDateParser(MONTH_REGEXP, [ "yyyy", "MM" ]), "yyyy-MM"),
        number: function(scope, element, attr, ctrl, $sniffer, $browser) {
            if (badInputChecker(scope, element, attr, ctrl), baseInputType(scope, element, attr, ctrl, $sniffer, $browser), 
            ctrl.$$parserName = "number", ctrl.$parsers.push(function(value) {
                return ctrl.$isEmpty(value) ? null : NUMBER_REGEXP.test(value) ? parseFloat(value) : void 0;
            }), ctrl.$formatters.push(function(value) {
                if (!ctrl.$isEmpty(value)) {
                    if (!isNumber(value)) throw ngModelMinErr("numfmt", "Expected `{0}` to be a number", value);
                    value = value.toString();
                }
                return value;
            }), isDefined(attr.min) || attr.ngMin) {
                var minVal;
                ctrl.$validators.min = function(value) {
                    return ctrl.$isEmpty(value) || isUndefined(minVal) || minVal <= value;
                }, attr.$observe("min", function(val) {
                    isDefined(val) && !isNumber(val) && (val = parseFloat(val)), minVal = isNumber(val) && !isNaN(val) ? val : void 0, 
                    ctrl.$validate();
                });
            }
            if (isDefined(attr.max) || attr.ngMax) {
                var maxVal;
                ctrl.$validators.max = function(value) {
                    return ctrl.$isEmpty(value) || isUndefined(maxVal) || value <= maxVal;
                }, attr.$observe("max", function(val) {
                    isDefined(val) && !isNumber(val) && (val = parseFloat(val)), maxVal = isNumber(val) && !isNaN(val) ? val : void 0, 
                    ctrl.$validate();
                });
            }
        },
        url: function(scope, element, attr, ctrl, $sniffer, $browser) {
            baseInputType(scope, element, attr, ctrl, $sniffer, $browser), stringBasedInputType(ctrl), 
            ctrl.$$parserName = "url", ctrl.$validators.url = function(modelValue, viewValue) {
                var value = modelValue || viewValue;
                return ctrl.$isEmpty(value) || URL_REGEXP.test(value);
            };
        },
        email: function(scope, element, attr, ctrl, $sniffer, $browser) {
            baseInputType(scope, element, attr, ctrl, $sniffer, $browser), stringBasedInputType(ctrl), 
            ctrl.$$parserName = "email", ctrl.$validators.email = function(modelValue, viewValue) {
                var value = modelValue || viewValue;
                return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value);
            };
        },
        radio: function(scope, element, attr, ctrl) {
            isUndefined(attr.name) && element.attr("name", nextUid());
            element.on("click", function(ev) {
                element[0].checked && ctrl.$setViewValue(attr.value, ev && ev.type);
            }), ctrl.$render = function() {
                var value = attr.value;
                element[0].checked = value == ctrl.$viewValue;
            }, attr.$observe("value", ctrl.$render);
        },
        checkbox: function(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
            var trueValue = parseConstantExpr($parse, scope, "ngTrueValue", attr.ngTrueValue, !0), falseValue = parseConstantExpr($parse, scope, "ngFalseValue", attr.ngFalseValue, !1);
            element.on("click", function(ev) {
                ctrl.$setViewValue(element[0].checked, ev && ev.type);
            }), ctrl.$render = function() {
                element[0].checked = ctrl.$viewValue;
            }, ctrl.$isEmpty = function(value) {
                return !1 === value;
            }, ctrl.$formatters.push(function(value) {
                return equals(value, trueValue);
            }), ctrl.$parsers.push(function(value) {
                return value ? trueValue : falseValue;
            });
        },
        hidden: noop,
        button: noop,
        submit: noop,
        reset: noop,
        file: noop
    };
    function stringBasedInputType(ctrl) {
        ctrl.$formatters.push(function(value) {
            return ctrl.$isEmpty(value) ? value : value.toString();
        });
    }
    function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
        var timeout, type = lowercase(element[0].type);
        if (!$sniffer.android) {
            var composing = !1;
            element.on("compositionstart", function() {
                composing = !0;
            }), element.on("compositionend", function() {
                composing = !1, listener();
            });
        }
        var listener = function(ev) {
            if (timeout && ($browser.defer.cancel(timeout), timeout = null), !composing) {
                var value = element.val(), event = ev && ev.type;
                "password" === type || attr.ngTrim && "false" === attr.ngTrim || (value = trim(value)), 
                (ctrl.$viewValue !== value || "" === value && ctrl.$$hasNativeValidators) && ctrl.$setViewValue(value, event);
            }
        };
        if ($sniffer.hasEvent("input")) element.on("input", listener); else {
            var deferListener = function(ev, input, origValue) {
                timeout || (timeout = $browser.defer(function() {
                    timeout = null, input && input.value === origValue || listener(ev);
                }));
            };
            element.on("keydown", function(event) {
                var key = event.keyCode;
                91 === key || 15 < key && key < 19 || 37 <= key && key <= 40 || deferListener(event, this, this.value);
            }), $sniffer.hasEvent("paste") && element.on("paste cut", deferListener);
        }
        element.on("change", listener), PARTIAL_VALIDATION_TYPES[type] && ctrl.$$hasNativeValidators && type === attr.type && element.on(PARTIAL_VALIDATION_EVENTS, function(ev) {
            if (!timeout) {
                var validity = this[VALIDITY_STATE_PROPERTY], origBadInput = validity.badInput, origTypeMismatch = validity.typeMismatch;
                timeout = $browser.defer(function() {
                    timeout = null, validity.badInput === origBadInput && validity.typeMismatch === origTypeMismatch || listener(ev);
                });
            }
        }), ctrl.$render = function() {
            var value = ctrl.$isEmpty(ctrl.$viewValue) ? "" : ctrl.$viewValue;
            element.val() !== value && element.val(value);
        };
    }
    function createDateParser(regexp, mapping) {
        return function(iso, date) {
            var parts, map;
            if (isDate(iso)) return iso;
            if (isString(iso)) {
                if ('"' == iso.charAt(0) && '"' == iso.charAt(iso.length - 1) && (iso = iso.substring(1, iso.length - 1)), 
                ISO_DATE_REGEXP.test(iso)) return new Date(iso);
                if (regexp.lastIndex = 0, parts = regexp.exec(iso)) return parts.shift(), map = date ? {
                    yyyy: date.getFullYear(),
                    MM: date.getMonth() + 1,
                    dd: date.getDate(),
                    HH: date.getHours(),
                    mm: date.getMinutes(),
                    ss: date.getSeconds(),
                    sss: date.getMilliseconds() / 1e3
                } : {
                    yyyy: 1970,
                    MM: 1,
                    dd: 1,
                    HH: 0,
                    mm: 0,
                    ss: 0,
                    sss: 0
                }, forEach(parts, function(part, index) {
                    index < mapping.length && (map[mapping[index]] = +part);
                }), new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, 1e3 * map.sss || 0);
            }
            return NaN;
        };
    }
    function createDateInputType(type, regexp, parseDate, format) {
        return function(scope, element, attr, ctrl, $sniffer, $browser, $filter) {
            badInputChecker(scope, element, attr, ctrl), baseInputType(0, element, attr, ctrl, $sniffer, $browser);
            var previousDate, minVal, maxVal, timezone = ctrl && ctrl.$options && ctrl.$options.timezone;
            (ctrl.$$parserName = type, ctrl.$parsers.push(function(value) {
                if (ctrl.$isEmpty(value)) return null;
                if (regexp.test(value)) {
                    var parsedDate = parseDate(value, previousDate);
                    return timezone && (parsedDate = convertTimezoneToLocal(parsedDate, timezone)), 
                    parsedDate;
                }
            }), ctrl.$formatters.push(function(value) {
                if (value && !isDate(value)) throw ngModelMinErr("datefmt", "Expected `{0}` to be a date", value);
                return isValidDate(value) ? ((previousDate = value) && timezone && (previousDate = convertTimezoneToLocal(previousDate, timezone, !0)), 
                $filter("date")(value, format, timezone)) : (previousDate = null, "");
            }), isDefined(attr.min) || attr.ngMin) && (ctrl.$validators.min = function(value) {
                return !isValidDate(value) || isUndefined(minVal) || parseDate(value) >= minVal;
            }, attr.$observe("min", function(val) {
                minVal = parseObservedDateValue(val), ctrl.$validate();
            }));
            (isDefined(attr.max) || attr.ngMax) && (ctrl.$validators.max = function(value) {
                return !isValidDate(value) || isUndefined(maxVal) || parseDate(value) <= maxVal;
            }, attr.$observe("max", function(val) {
                maxVal = parseObservedDateValue(val), ctrl.$validate();
            }));
            function isValidDate(value) {
                return value && !(value.getTime && value.getTime() != value.getTime());
            }
            function parseObservedDateValue(val) {
                return isDefined(val) && !isDate(val) ? parseDate(val) || void 0 : val;
            }
        };
    }
    function badInputChecker(scope, element, attr, ctrl) {
        var node = element[0];
        (ctrl.$$hasNativeValidators = isObject(node.validity)) && ctrl.$parsers.push(function(value) {
            var validity = element.prop(VALIDITY_STATE_PROPERTY) || {};
            return validity.badInput || validity.typeMismatch ? void 0 : value;
        });
    }
    function parseConstantExpr($parse, context, name, expression, fallback) {
        var parseFn;
        if (isDefined(expression)) {
            if (!(parseFn = $parse(expression)).constant) throw ngModelMinErr("constexpr", "Expected constant expression for `{0}`, but saw `{1}`.", name, expression);
            return parseFn(context);
        }
        return fallback;
    }
    var inputDirective = [ "$browser", "$sniffer", "$filter", "$parse", function($browser, $sniffer, $filter, $parse) {
        return {
            restrict: "E",
            require: [ "?ngModel" ],
            link: {
                pre: function(scope, element, attr, ctrls) {
                    ctrls[0] && (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer, $browser, $filter, $parse);
                }
            }
        };
    } ], CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/, ngValueDirective = function() {
        return {
            restrict: "A",
            priority: 100,
            compile: function(tpl, tplAttr) {
                return CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue) ? function(scope, elm, attr) {
                    attr.$set("value", scope.$eval(attr.ngValue));
                } : function(scope, elm, attr) {
                    scope.$watch(attr.ngValue, function(value) {
                        attr.$set("value", value);
                    });
                };
            }
        };
    }, ngBindDirective = [ "$compile", function($compile) {
        return {
            restrict: "AC",
            compile: function(templateElement) {
                return $compile.$$addBindingClass(templateElement), function(scope, element, attr) {
                    $compile.$$addBindingInfo(element, attr.ngBind), element = element[0], scope.$watch(attr.ngBind, function(value) {
                        element.textContent = isUndefined(value) ? "" : value;
                    });
                };
            }
        };
    } ], ngBindTemplateDirective = [ "$interpolate", "$compile", function($interpolate, $compile) {
        return {
            compile: function(templateElement) {
                return $compile.$$addBindingClass(templateElement), function(scope, element, attr) {
                    var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));
                    $compile.$$addBindingInfo(element, interpolateFn.expressions), element = element[0], 
                    attr.$observe("ngBindTemplate", function(value) {
                        element.textContent = isUndefined(value) ? "" : value;
                    });
                };
            }
        };
    } ], ngBindHtmlDirective = [ "$sce", "$parse", "$compile", function($sce, $parse, $compile) {
        return {
            restrict: "A",
            compile: function(tElement, tAttrs) {
                var ngBindHtmlGetter = $parse(tAttrs.ngBindHtml), ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function(val) {
                    return $sce.valueOf(val);
                });
                return $compile.$$addBindingClass(tElement), function(scope, element, attr) {
                    $compile.$$addBindingInfo(element, attr.ngBindHtml), scope.$watch(ngBindHtmlWatch, function() {
                        var value = ngBindHtmlGetter(scope);
                        element.html($sce.getTrustedHtml(value) || "");
                    });
                };
            }
        };
    } ], ngChangeDirective = valueFn({
        restrict: "A",
        require: "ngModel",
        link: function(scope, element, attr, ctrl) {
            ctrl.$viewChangeListeners.push(function() {
                scope.$eval(attr.ngChange);
            });
        }
    });
    function classDirective(name, selector) {
        return name = "ngClass" + name, [ "$animate", function($animate) {
            return {
                restrict: "AC",
                link: function(scope, element, attr) {
                    var oldVal;
                    function addClasses(classes) {
                        var newClasses = digestClassCounts(classes, 1);
                        attr.$addClass(newClasses);
                    }
                    function digestClassCounts(classes, count) {
                        var classCounts = element.data("$classCounts") || createMap(), classesToUpdate = [];
                        return forEach(classes, function(className) {
                            (0 < count || classCounts[className]) && (classCounts[className] = (classCounts[className] || 0) + count, 
                            classCounts[className] === +(0 < count) && classesToUpdate.push(className));
                        }), element.data("$classCounts", classCounts), classesToUpdate.join(" ");
                    }
                    function ngClassWatchAction(newVal) {
                        if (!0 === selector || (1 & scope.$index) === selector) {
                            var newClasses = arrayClasses(newVal || []);
                            if (oldVal) {
                                if (!equals(newVal, oldVal)) {
                                    !function(oldClasses, newClasses) {
                                        var toAdd = arrayDifference(newClasses, oldClasses), toRemove = arrayDifference(oldClasses, newClasses);
                                        toAdd = digestClassCounts(toAdd, 1), toRemove = digestClassCounts(toRemove, -1), 
                                        toAdd && toAdd.length && $animate.addClass(element, toAdd), toRemove && toRemove.length && $animate.removeClass(element, toRemove);
                                    }(arrayClasses(oldVal), newClasses);
                                }
                            } else addClasses(newClasses);
                        }
                        oldVal = isArray(newVal) ? newVal.map(function(v) {
                            return shallowCopy(v);
                        }) : shallowCopy(newVal);
                    }
                    scope.$watch(attr[name], ngClassWatchAction, !0), attr.$observe("class", function(value) {
                        ngClassWatchAction(scope.$eval(attr[name]));
                    }), "ngClass" !== name && scope.$watch("$index", function($index, old$index) {
                        var mod = 1 & $index;
                        if (mod !== (1 & old$index)) {
                            var classes = arrayClasses(scope.$eval(attr[name]));
                            mod === selector ? addClasses(classes) : function(classes) {
                                var newClasses = digestClassCounts(classes, -1);
                                attr.$removeClass(newClasses);
                            }(classes);
                        }
                    });
                }
            };
            function arrayDifference(tokens1, tokens2) {
                var values = [];
                outer: for (var i = 0; i < tokens1.length; i++) {
                    for (var token = tokens1[i], j = 0; j < tokens2.length; j++) if (token == tokens2[j]) continue outer;
                    values.push(token);
                }
                return values;
            }
            function arrayClasses(classVal) {
                var classes = [];
                return isArray(classVal) ? (forEach(classVal, function(v) {
                    classes = classes.concat(arrayClasses(v));
                }), classes) : isString(classVal) ? classVal.split(" ") : isObject(classVal) ? (forEach(classVal, function(v, k) {
                    v && (classes = classes.concat(k.split(" ")));
                }), classes) : classVal;
            }
        } ];
    }
    var ngClassDirective = classDirective("", !0), ngClassOddDirective = classDirective("Odd", 0), ngClassEvenDirective = classDirective("Even", 1), ngCloakDirective = ngDirective({
        compile: function(element, attr) {
            attr.$set("ngCloak", void 0), element.removeClass("ng-cloak");
        }
    }), ngControllerDirective = [ function() {
        return {
            restrict: "A",
            scope: !0,
            controller: "@",
            priority: 500
        };
    } ], ngEventDirectives = {}, forceAsyncEvents = {
        blur: !0,
        focus: !0
    };
    forEach("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "), function(eventName) {
        var directiveName = directiveNormalize("ng-" + eventName);
        ngEventDirectives[directiveName] = [ "$parse", "$rootScope", function($parse, $rootScope) {
            return {
                restrict: "A",
                compile: function($element, attr) {
                    var fn = $parse(attr[directiveName], null, !0);
                    return function(scope, element) {
                        element.on(eventName, function(event) {
                            var callback = function() {
                                fn(scope, {
                                    $event: event
                                });
                            };
                            forceAsyncEvents[eventName] && $rootScope.$$phase ? scope.$evalAsync(callback) : scope.$apply(callback);
                        });
                    };
                }
            };
        } ];
    });
    var ngIfDirective = [ "$animate", "$compile", function($animate, $compile) {
        return {
            multiElement: !0,
            transclude: "element",
            priority: 600,
            terminal: !0,
            restrict: "A",
            $$tlb: !0,
            link: function($scope, $element, $attr, ctrl, $transclude) {
                var block, childScope, previousElements;
                $scope.$watch($attr.ngIf, function(value) {
                    value ? childScope || $transclude(function(clone, newScope) {
                        childScope = newScope, clone[clone.length++] = $compile.$$createComment("end ngIf", $attr.ngIf), 
                        block = {
                            clone: clone
                        }, $animate.enter(clone, $element.parent(), $element);
                    }) : (previousElements && (previousElements.remove(), previousElements = null), 
                    childScope && (childScope.$destroy(), childScope = null), block && (previousElements = getBlockNodes(block.clone), 
                    $animate.leave(previousElements).then(function() {
                        previousElements = null;
                    }), block = null));
                });
            }
        };
    } ], ngIncludeDirective = [ "$templateRequest", "$anchorScroll", "$animate", function($templateRequest, $anchorScroll, $animate) {
        return {
            restrict: "ECA",
            priority: 400,
            terminal: !0,
            transclude: "element",
            controller: angular.noop,
            compile: function(element, attr) {
                var srcExp = attr.ngInclude || attr.src, onloadExp = attr.onload || "", autoScrollExp = attr.autoscroll;
                return function(scope, $element, $attr, ctrl, $transclude) {
                    var currentScope, previousElement, currentElement, changeCounter = 0, cleanupLastIncludeContent = function() {
                        previousElement && (previousElement.remove(), previousElement = null), currentScope && (currentScope.$destroy(), 
                        currentScope = null), currentElement && ($animate.leave(currentElement).then(function() {
                            previousElement = null;
                        }), previousElement = currentElement, currentElement = null);
                    };
                    scope.$watch(srcExp, function(src) {
                        var afterAnimation = function() {
                            !isDefined(autoScrollExp) || autoScrollExp && !scope.$eval(autoScrollExp) || $anchorScroll();
                        }, thisChangeId = ++changeCounter;
                        src ? ($templateRequest(src, !0).then(function(response) {
                            if (!scope.$$destroyed && thisChangeId === changeCounter) {
                                var newScope = scope.$new();
                                ctrl.template = response;
                                var clone = $transclude(newScope, function(clone) {
                                    cleanupLastIncludeContent(), $animate.enter(clone, null, $element).then(afterAnimation);
                                });
                                currentElement = clone, (currentScope = newScope).$emit("$includeContentLoaded", src), 
                                scope.$eval(onloadExp);
                            }
                        }, function() {
                            scope.$$destroyed || thisChangeId === changeCounter && (cleanupLastIncludeContent(), 
                            scope.$emit("$includeContentError", src));
                        }), scope.$emit("$includeContentRequested", src)) : (cleanupLastIncludeContent(), 
                        ctrl.template = null);
                    });
                };
            }
        };
    } ], ngIncludeFillContentDirective = [ "$compile", function($compile) {
        return {
            restrict: "ECA",
            priority: -400,
            require: "ngInclude",
            link: function(scope, $element, $attr, ctrl) {
                if (toString.call($element[0]).match(/SVG/)) return $element.empty(), void $compile(jqLiteBuildFragment(ctrl.template, window.document).childNodes)(scope, function(clone) {
                    $element.append(clone);
                }, {
                    futureParentElement: $element
                });
                $element.html(ctrl.template), $compile($element.contents())(scope);
            }
        };
    } ], ngInitDirective = ngDirective({
        priority: 450,
        compile: function() {
            return {
                pre: function(scope, element, attrs) {
                    scope.$eval(attrs.ngInit);
                }
            };
        }
    }), ngListDirective = function() {
        return {
            restrict: "A",
            priority: 100,
            require: "ngModel",
            link: function(scope, element, attr, ctrl) {
                var ngList = element.attr(attr.$attr.ngList) || ", ", trimValues = "false" !== attr.ngTrim, separator = trimValues ? trim(ngList) : ngList;
                ctrl.$parsers.push(function(viewValue) {
                    if (!isUndefined(viewValue)) {
                        var list = [];
                        return viewValue && forEach(viewValue.split(separator), function(value) {
                            value && list.push(trimValues ? trim(value) : value);
                        }), list;
                    }
                }), ctrl.$formatters.push(function(value) {
                    if (isArray(value)) return value.join(ngList);
                }), ctrl.$isEmpty = function(value) {
                    return !value || !value.length;
                };
            }
        };
    }, VALID_CLASS = "ng-valid", INVALID_CLASS = "ng-invalid", PRISTINE_CLASS = "ng-pristine", DIRTY_CLASS = "ng-dirty", PENDING_CLASS = "ng-pending", ngModelMinErr = minErr("ngModel"), NgModelController = [ "$scope", "$exceptionHandler", "$attrs", "$element", "$parse", "$animate", "$timeout", "$rootScope", "$q", "$interpolate", function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) {
        this.$viewValue = Number.NaN, this.$modelValue = Number.NaN, this.$$rawModelValue = void 0, 
        this.$validators = {}, this.$asyncValidators = {}, this.$parsers = [], this.$formatters = [], 
        this.$viewChangeListeners = [], this.$untouched = !0, this.$touched = !1, this.$pristine = !0, 
        this.$dirty = !1, this.$valid = !0, this.$invalid = !1, this.$error = {}, this.$$success = {}, 
        this.$pending = void 0, this.$name = $interpolate($attr.name || "", !1)($scope), 
        this.$$parentForm = nullFormCtrl;
        var parserValid, parsedNgModel = $parse($attr.ngModel), parsedNgModelAssign = parsedNgModel.assign, ngModelGet = parsedNgModel, ngModelSet = parsedNgModelAssign, pendingDebounce = null, ctrl = this;
        this.$$setOptions = function(options) {
            if ((ctrl.$options = options) && options.getterSetter) {
                var invokeModelGetter = $parse($attr.ngModel + "()"), invokeModelSetter = $parse($attr.ngModel + "($$$p)");
                ngModelGet = function($scope) {
                    var modelValue = parsedNgModel($scope);
                    return isFunction(modelValue) && (modelValue = invokeModelGetter($scope)), modelValue;
                }, ngModelSet = function($scope, newValue) {
                    isFunction(parsedNgModel($scope)) ? invokeModelSetter($scope, {
                        $$$p: newValue
                    }) : parsedNgModelAssign($scope, newValue);
                };
            } else if (!parsedNgModel.assign) throw ngModelMinErr("nonassign", "Expression '{0}' is non-assignable. Element: {1}", $attr.ngModel, startingTag($element));
        }, this.$render = noop, this.$isEmpty = function(value) {
            return isUndefined(value) || "" === value || null === value || value != value;
        }, this.$$updateEmptyClasses = function(value) {
            ctrl.$isEmpty(value) ? ($animate.removeClass($element, "ng-not-empty"), $animate.addClass($element, "ng-empty")) : ($animate.removeClass($element, "ng-empty"), 
            $animate.addClass($element, "ng-not-empty"));
        };
        var currentValidationRunId = 0;
        addSetValidityMethod({
            ctrl: this,
            $element: $element,
            set: function(object, property) {
                object[property] = !0;
            },
            unset: function(object, property) {
                delete object[property];
            },
            $animate: $animate
        }), this.$setPristine = function() {
            ctrl.$dirty = !1, ctrl.$pristine = !0, $animate.removeClass($element, DIRTY_CLASS), 
            $animate.addClass($element, PRISTINE_CLASS);
        }, this.$setDirty = function() {
            ctrl.$dirty = !0, ctrl.$pristine = !1, $animate.removeClass($element, PRISTINE_CLASS), 
            $animate.addClass($element, DIRTY_CLASS), ctrl.$$parentForm.$setDirty();
        }, this.$setUntouched = function() {
            ctrl.$touched = !1, ctrl.$untouched = !0, $animate.setClass($element, "ng-untouched", "ng-touched");
        }, this.$setTouched = function() {
            ctrl.$touched = !0, ctrl.$untouched = !1, $animate.setClass($element, "ng-touched", "ng-untouched");
        }, this.$rollbackViewValue = function() {
            $timeout.cancel(pendingDebounce), ctrl.$viewValue = ctrl.$$lastCommittedViewValue, 
            ctrl.$render();
        }, this.$validate = function() {
            if (!isNumber(ctrl.$modelValue) || !isNaN(ctrl.$modelValue)) {
                var viewValue = ctrl.$$lastCommittedViewValue, modelValue = ctrl.$$rawModelValue, prevValid = ctrl.$valid, prevModelValue = ctrl.$modelValue, allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;
                ctrl.$$runValidators(modelValue, viewValue, function(allValid) {
                    allowInvalid || prevValid === allValid || (ctrl.$modelValue = allValid ? modelValue : void 0, 
                    ctrl.$modelValue !== prevModelValue && ctrl.$$writeModelToScope());
                });
            }
        }, this.$$runValidators = function(modelValue, viewValue, doneCallback) {
            var validatorPromises, allValid, localValidationRunId = ++currentValidationRunId;
            (function() {
                var errorKey = ctrl.$$parserName || "parse";
                {
                    if (!isUndefined(parserValid)) return parserValid || (forEach(ctrl.$validators, function(v, name) {
                        setValidity(name, null);
                    }), forEach(ctrl.$asyncValidators, function(v, name) {
                        setValidity(name, null);
                    })), setValidity(errorKey, parserValid), parserValid;
                    setValidity(errorKey, null);
                }
                return !0;
            })() ? !function() {
                var syncValidatorsValid = !0;
                if (forEach(ctrl.$validators, function(validator, name) {
                    var result = validator(modelValue, viewValue);
                    syncValidatorsValid = syncValidatorsValid && result, setValidity(name, result);
                }), !syncValidatorsValid) return forEach(ctrl.$asyncValidators, function(v, name) {
                    setValidity(name, null);
                }), !1;
                return !0;
            }() ? validationDone(!1) : (validatorPromises = [], allValid = !0, forEach(ctrl.$asyncValidators, function(validator, name) {
                var promise = validator(modelValue, viewValue);
                if (!isPromiseLike(promise)) throw ngModelMinErr("nopromise", "Expected asynchronous validator to return a promise but got '{0}' instead.", promise);
                setValidity(name, void 0), validatorPromises.push(promise.then(function() {
                    setValidity(name, !0);
                }, function() {
                    setValidity(name, allValid = !1);
                }));
            }), validatorPromises.length ? $q.all(validatorPromises).then(function() {
                validationDone(allValid);
            }, noop) : validationDone(!0)) : validationDone(!1);
            function setValidity(name, isValid) {
                localValidationRunId === currentValidationRunId && ctrl.$setValidity(name, isValid);
            }
            function validationDone(allValid) {
                localValidationRunId === currentValidationRunId && doneCallback(allValid);
            }
        }, this.$commitViewValue = function() {
            var viewValue = ctrl.$viewValue;
            $timeout.cancel(pendingDebounce), (ctrl.$$lastCommittedViewValue !== viewValue || "" === viewValue && ctrl.$$hasNativeValidators) && (ctrl.$$updateEmptyClasses(viewValue), 
            ctrl.$$lastCommittedViewValue = viewValue, ctrl.$pristine && this.$setDirty(), this.$$parseAndValidate());
        }, this.$$parseAndValidate = function() {
            var modelValue = ctrl.$$lastCommittedViewValue;
            if (parserValid = !isUndefined(modelValue) || void 0) for (var i = 0; i < ctrl.$parsers.length; i++) if (isUndefined(modelValue = ctrl.$parsers[i](modelValue))) {
                parserValid = !1;
                break;
            }
            isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue) && (ctrl.$modelValue = ngModelGet($scope));
            var prevModelValue = ctrl.$modelValue, allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;
            function writeToModelIfNeeded() {
                ctrl.$modelValue !== prevModelValue && ctrl.$$writeModelToScope();
            }
            ctrl.$$rawModelValue = modelValue, allowInvalid && (ctrl.$modelValue = modelValue, 
            writeToModelIfNeeded()), ctrl.$$runValidators(modelValue, ctrl.$$lastCommittedViewValue, function(allValid) {
                allowInvalid || (ctrl.$modelValue = allValid ? modelValue : void 0, writeToModelIfNeeded());
            });
        }, this.$$writeModelToScope = function() {
            ngModelSet($scope, ctrl.$modelValue), forEach(ctrl.$viewChangeListeners, function(listener) {
                try {
                    listener();
                } catch (e) {
                    $exceptionHandler(e);
                }
            });
        }, this.$setViewValue = function(value, trigger) {
            ctrl.$viewValue = value, ctrl.$options && !ctrl.$options.updateOnDefault || ctrl.$$debounceViewValueCommit(trigger);
        }, this.$$debounceViewValueCommit = function(trigger) {
            var debounce, debounceDelay = 0, options = ctrl.$options;
            options && isDefined(options.debounce) && (isNumber(debounce = options.debounce) ? debounceDelay = debounce : isNumber(debounce[trigger]) ? debounceDelay = debounce[trigger] : isNumber(debounce.default) && (debounceDelay = debounce.default)), 
            $timeout.cancel(pendingDebounce), debounceDelay ? pendingDebounce = $timeout(function() {
                ctrl.$commitViewValue();
            }, debounceDelay) : $rootScope.$$phase ? ctrl.$commitViewValue() : $scope.$apply(function() {
                ctrl.$commitViewValue();
            });
        }, $scope.$watch(function() {
            var modelValue = ngModelGet($scope);
            if (modelValue !== ctrl.$modelValue && (ctrl.$modelValue == ctrl.$modelValue || modelValue == modelValue)) {
                ctrl.$modelValue = ctrl.$$rawModelValue = modelValue, parserValid = void 0;
                for (var formatters = ctrl.$formatters, idx = formatters.length, viewValue = modelValue; idx--; ) viewValue = formatters[idx](viewValue);
                ctrl.$viewValue !== viewValue && (ctrl.$$updateEmptyClasses(viewValue), ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue, 
                ctrl.$render(), ctrl.$$runValidators(modelValue, viewValue, noop));
            }
            return modelValue;
        });
    } ], ngModelDirective = [ "$rootScope", function($rootScope) {
        return {
            restrict: "A",
            require: [ "ngModel", "^?form", "^?ngModelOptions" ],
            controller: NgModelController,
            priority: 1,
            compile: function(element) {
                return element.addClass(PRISTINE_CLASS).addClass("ng-untouched").addClass(VALID_CLASS), 
                {
                    pre: function(scope, element, attr, ctrls) {
                        var modelCtrl = ctrls[0], formCtrl = ctrls[1] || modelCtrl.$$parentForm;
                        modelCtrl.$$setOptions(ctrls[2] && ctrls[2].$options), console.log("DEBUG - Pre-linking new control:"), 
                        console.log(modelCtrl), console.log(formCtrl), formCtrl.$addControl(modelCtrl), 
                        attr.$observe("name", function(newValue) {
                            modelCtrl.$name !== newValue && modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);
                        }), scope.$on("$destroy", function() {
                            modelCtrl.$$parentForm.$removeControl(modelCtrl);
                        });
                    },
                    post: function(scope, element, attr, ctrls) {
                        var modelCtrl = ctrls[0];
                        modelCtrl.$options && modelCtrl.$options.updateOn && element.on(modelCtrl.$options.updateOn, function(ev) {
                            modelCtrl.$$debounceViewValueCommit(ev && ev.type);
                        }), element.on("blur", function() {
                            modelCtrl.$touched || ($rootScope.$$phase ? scope.$evalAsync(modelCtrl.$setTouched) : scope.$apply(modelCtrl.$setTouched));
                        });
                    }
                };
            }
        };
    } ], DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/, ngModelOptionsDirective = function() {
        return {
            restrict: "A",
            controller: [ "$scope", "$attrs", function($scope, $attrs) {
                var that = this;
                this.$options = copy($scope.$eval($attrs.ngModelOptions)), isDefined(this.$options.updateOn) ? (this.$options.updateOnDefault = !1, 
                this.$options.updateOn = trim(this.$options.updateOn.replace(DEFAULT_REGEXP, function() {
                    return that.$options.updateOnDefault = !0, " ";
                }))) : this.$options.updateOnDefault = !0;
            } ]
        };
    };
    function addSetValidityMethod(context) {
        var ctrl = context.ctrl, $element = context.$element, classCache = {}, set = context.set, unset = context.unset, $animate = context.$animate;
        function cachedToggleClass(className, switchValue) {
            switchValue && !classCache[className] ? ($animate.addClass($element, className), 
            classCache[className] = !0) : !switchValue && classCache[className] && ($animate.removeClass($element, className), 
            classCache[className] = !1);
        }
        function toggleValidationCss(validationErrorKey, isValid) {
            validationErrorKey = validationErrorKey ? "-" + snake_case(validationErrorKey, "-") : "", 
            cachedToggleClass(VALID_CLASS + validationErrorKey, !0 === isValid), cachedToggleClass(INVALID_CLASS + validationErrorKey, !1 === isValid);
        }
        classCache[INVALID_CLASS] = !(classCache[VALID_CLASS] = $element.hasClass(VALID_CLASS)), 
        ctrl.$setValidity = function(validationErrorKey, state, controller) {
            isUndefined(state) ? function(name, value, controller) {
                ctrl[name] || (ctrl[name] = {});
                set(ctrl[name], value, controller);
            }("$pending", validationErrorKey, controller) : function(name, value, controller) {
                ctrl[name] && unset(ctrl[name], value, controller);
                isObjectEmpty(ctrl[name]) && (ctrl[name] = void 0);
            }("$pending", validationErrorKey, controller);
            isBoolean(state) ? state ? (unset(ctrl.$error, validationErrorKey, controller), 
            set(ctrl.$$success, validationErrorKey, controller)) : (set(ctrl.$error, validationErrorKey, controller), 
            unset(ctrl.$$success, validationErrorKey, controller)) : (unset(ctrl.$error, validationErrorKey, controller), 
            unset(ctrl.$$success, validationErrorKey, controller));
            ctrl.$pending ? (cachedToggleClass(PENDING_CLASS, !0), ctrl.$valid = ctrl.$invalid = void 0, 
            toggleValidationCss("", null)) : (cachedToggleClass(PENDING_CLASS, !1), ctrl.$valid = isObjectEmpty(ctrl.$error), 
            ctrl.$invalid = !ctrl.$valid, toggleValidationCss("", ctrl.$valid));
            var combinedState;
            combinedState = ctrl.$pending && ctrl.$pending[validationErrorKey] ? void 0 : !ctrl.$error[validationErrorKey] && (!!ctrl.$$success[validationErrorKey] || null);
            toggleValidationCss(validationErrorKey, combinedState), ctrl.$$parentForm.$setValidity(validationErrorKey, combinedState, ctrl);
        };
    }
    function isObjectEmpty(obj) {
        if (obj) for (var prop in obj) if (obj.hasOwnProperty(prop)) return !1;
        return !0;
    }
    var ngNonBindableDirective = ngDirective({
        terminal: !0,
        priority: 1e3
    }), ngOptionsMinErr = minErr("ngOptions"), NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/, ngOptionsDirective = [ "$compile", "$document", "$parse", function($compile, $document, $parse) {
        var optionTemplate = window.document.createElement("option"), optGroupTemplate = window.document.createElement("optgroup");
        return {
            restrict: "A",
            terminal: !0,
            require: [ "select", "ngModel" ],
            link: {
                pre: function(scope, selectElement, attr, ctrls) {
                    ctrls[0].registerOption = noop;
                },
                post: function(scope, selectElement, attr, ctrls) {
                    for (var emptyOption, selectCtrl = ctrls[0], ngModelCtrl = ctrls[1], multiple = attr.multiple, i = 0, children = selectElement.children(), ii = children.length; i < ii; i++) if ("" === children[i].value) {
                        emptyOption = children.eq(i);
                        break;
                    }
                    var options, providedEmptyOption = !!emptyOption, unknownOption = jqLite(optionTemplate.cloneNode(!1));
                    unknownOption.val("?");
                    var ngOptions = function(optionsExp, selectElement, scope) {
                        var match = optionsExp.match(NG_OPTIONS_REGEXP);
                        if (!match) throw ngOptionsMinErr("iexp", "Expected expression in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '{0}'. Element: {1}", optionsExp, startingTag(selectElement));
                        var valueName = match[5] || match[7], keyName = match[6], selectAs = / as /.test(match[0]) && match[1], trackBy = match[9], valueFn = $parse(match[2] ? match[1] : valueName), viewValueFn = selectAs && $parse(selectAs) || valueFn, trackByFn = trackBy && $parse(trackBy), getTrackByValueFn = trackBy ? function(value, locals) {
                            return trackByFn(scope, locals);
                        } : function(value) {
                            return hashKey(value);
                        }, getTrackByValue = function(value, key) {
                            return getTrackByValueFn(value, getLocals(value, key));
                        }, displayFn = $parse(match[2] || match[1]), groupByFn = $parse(match[3] || ""), disableWhenFn = $parse(match[4] || ""), valuesFn = $parse(match[8]), locals = {}, getLocals = keyName ? function(value, key) {
                            return locals[keyName] = key, locals[valueName] = value, locals;
                        } : function(value) {
                            return locals[valueName] = value, locals;
                        };
                        function Option(selectValue, viewValue, label, group, disabled) {
                            this.selectValue = selectValue, this.viewValue = viewValue, this.label = label, 
                            this.group = group, this.disabled = disabled;
                        }
                        function getOptionValuesKeys(optionValues) {
                            var optionValuesKeys;
                            if (!keyName && isArrayLike(optionValues)) optionValuesKeys = optionValues; else for (var itemKey in optionValuesKeys = [], 
                            optionValues) optionValues.hasOwnProperty(itemKey) && "$" !== itemKey.charAt(0) && optionValuesKeys.push(itemKey);
                            return optionValuesKeys;
                        }
                        return {
                            trackBy: trackBy,
                            getTrackByValue: getTrackByValue,
                            getWatchables: $parse(valuesFn, function(optionValues) {
                                for (var watchedArray = [], optionValuesKeys = getOptionValuesKeys(optionValues = optionValues || []), optionValuesLength = optionValuesKeys.length, index = 0; index < optionValuesLength; index++) {
                                    var key = optionValues === optionValuesKeys ? index : optionValuesKeys[index], value = optionValues[key], locals = getLocals(value, key), selectValue = getTrackByValueFn(value, locals);
                                    if (watchedArray.push(selectValue), match[2] || match[1]) {
                                        var label = displayFn(scope, locals);
                                        watchedArray.push(label);
                                    }
                                    if (match[4]) {
                                        var disableWhen = disableWhenFn(scope, locals);
                                        watchedArray.push(disableWhen);
                                    }
                                }
                                return watchedArray;
                            }),
                            getOptions: function() {
                                for (var optionItems = [], selectValueMap = {}, optionValues = valuesFn(scope) || [], optionValuesKeys = getOptionValuesKeys(optionValues), optionValuesLength = optionValuesKeys.length, index = 0; index < optionValuesLength; index++) {
                                    var key = optionValues === optionValuesKeys ? index : optionValuesKeys[index], value = optionValues[key], locals = getLocals(value, key), viewValue = viewValueFn(scope, locals), selectValue = getTrackByValueFn(viewValue, locals), optionItem = new Option(selectValue, viewValue, displayFn(scope, locals), groupByFn(scope, locals), disableWhenFn(scope, locals));
                                    optionItems.push(optionItem), selectValueMap[selectValue] = optionItem;
                                }
                                return {
                                    items: optionItems,
                                    selectValueMap: selectValueMap,
                                    getOptionFromViewValue: function(value) {
                                        return selectValueMap[getTrackByValue(value)];
                                    },
                                    getViewValueFromOption: function(option) {
                                        return trackBy ? angular.copy(option.viewValue) : option.viewValue;
                                    }
                                };
                            }
                        };
                    }(attr.ngOptions, selectElement, scope), listFragment = $document[0].createDocumentFragment(), removeEmptyOption = function() {
                        providedEmptyOption || emptyOption.remove();
                    }, removeUnknownOption = function() {
                        unknownOption.remove();
                    };
                    function addOptionElement(option, parent) {
                        var optionElement = optionTemplate.cloneNode(!1);
                        parent.appendChild(optionElement), function(option, element) {
                            (option.element = element).disabled = option.disabled, option.label !== element.label && (element.label = option.label, 
                            element.textContent = option.label), option.value !== element.value && (element.value = option.selectValue);
                        }(option, optionElement);
                    }
                    function updateOptions() {
                        var previousValue = options && selectCtrl.readValue();
                        if (options) for (var i = options.items.length - 1; 0 <= i; i--) {
                            var option = options.items[i];
                            isDefined(option.group) ? jqLiteRemove(option.element.parentNode) : jqLiteRemove(option.element);
                        }
                        options = ngOptions.getOptions();
                        var groupElementMap = {};
                        if (providedEmptyOption && selectElement.prepend(emptyOption), options.items.forEach(function(option) {
                            var groupElement;
                            isDefined(option.group) ? ((groupElement = groupElementMap[option.group]) || (groupElement = optGroupTemplate.cloneNode(!1), 
                            listFragment.appendChild(groupElement), groupElement.label = null === option.group ? "null" : option.group, 
                            groupElementMap[option.group] = groupElement), addOptionElement(option, groupElement)) : addOptionElement(option, listFragment);
                        }), selectElement[0].appendChild(listFragment), ngModelCtrl.$render(), !ngModelCtrl.$isEmpty(previousValue)) {
                            var nextValue = selectCtrl.readValue();
                            (ngOptions.trackBy || multiple ? equals(previousValue, nextValue) : previousValue === nextValue) || (ngModelCtrl.$setViewValue(nextValue), 
                            ngModelCtrl.$render());
                        }
                    }
                    multiple ? (ngModelCtrl.$isEmpty = function(value) {
                        return !value || 0 === value.length;
                    }, selectCtrl.writeValue = function(value) {
                        options.items.forEach(function(option) {
                            option.element.selected = !1;
                        }), value && value.forEach(function(item) {
                            var option = options.getOptionFromViewValue(item);
                            option && (option.element.selected = !0);
                        });
                    }, selectCtrl.readValue = function() {
                        var selectedValues = selectElement.val() || [], selections = [];
                        return forEach(selectedValues, function(value) {
                            var option = options.selectValueMap[value];
                            option && !option.disabled && selections.push(options.getViewValueFromOption(option));
                        }), selections;
                    }, ngOptions.trackBy && scope.$watchCollection(function() {
                        if (isArray(ngModelCtrl.$viewValue)) return ngModelCtrl.$viewValue.map(function(value) {
                            return ngOptions.getTrackByValue(value);
                        });
                    }, function() {
                        ngModelCtrl.$render();
                    })) : (selectCtrl.writeValue = function(value) {
                        var option = options.getOptionFromViewValue(value);
                        option ? (selectElement[0].value !== option.selectValue && (removeUnknownOption(), 
                        removeEmptyOption(), selectElement[0].value = option.selectValue, option.element.selected = !0), 
                        option.element.setAttribute("selected", "selected")) : null === value || providedEmptyOption ? (removeUnknownOption(), 
                        providedEmptyOption || selectElement.prepend(emptyOption), selectElement.val(""), 
                        emptyOption.prop("selected", !0), emptyOption.attr("selected", !0)) : (removeEmptyOption(), 
                        selectElement.prepend(unknownOption), selectElement.val("?"), unknownOption.prop("selected", !0), 
                        unknownOption.attr("selected", !0));
                    }, selectCtrl.readValue = function() {
                        var selectedOption = options.selectValueMap[selectElement.val()];
                        return selectedOption && !selectedOption.disabled ? (removeEmptyOption(), removeUnknownOption(), 
                        options.getViewValueFromOption(selectedOption)) : null;
                    }, ngOptions.trackBy && scope.$watch(function() {
                        return ngOptions.getTrackByValue(ngModelCtrl.$viewValue);
                    }, function() {
                        ngModelCtrl.$render();
                    })), providedEmptyOption ? (emptyOption.remove(), $compile(emptyOption)(scope), 
                    emptyOption.removeClass("ng-scope")) : emptyOption = jqLite(optionTemplate.cloneNode(!1)), 
                    selectElement.empty(), updateOptions(), scope.$watchCollection(ngOptions.getWatchables, updateOptions);
                }
            }
        };
    } ], ngPluralizeDirective = [ "$locale", "$interpolate", "$log", function($locale, $interpolate, $log) {
        var BRACE = /{}/g, IS_WHEN = /^when(Minus)?(.+)$/;
        return {
            link: function(scope, element, attr) {
                var lastCount, numberExp = attr.count, whenExp = attr.$attr.when && element.attr(attr.$attr.when), offset = attr.offset || 0, whens = scope.$eval(whenExp) || {}, whensExpFns = {}, startSymbol = $interpolate.startSymbol(), endSymbol = $interpolate.endSymbol(), braceReplacement = startSymbol + numberExp + "-" + offset + endSymbol, watchRemover = angular.noop;
                function updateElementText(newText) {
                    element.text(newText || "");
                }
                forEach(attr, function(expression, attributeName) {
                    var tmpMatch = IS_WHEN.exec(attributeName);
                    if (tmpMatch) {
                        var whenKey = (tmpMatch[1] ? "-" : "") + lowercase(tmpMatch[2]);
                        whens[whenKey] = element.attr(attr.$attr[attributeName]);
                    }
                }), forEach(whens, function(expression, key) {
                    whensExpFns[key] = $interpolate(expression.replace(BRACE, braceReplacement));
                }), scope.$watch(numberExp, function(newVal) {
                    var count = parseFloat(newVal), countIsNaN = isNaN(count);
                    if (countIsNaN || count in whens || (count = $locale.pluralCat(count - offset)), 
                    count !== lastCount && !(countIsNaN && isNumber(lastCount) && isNaN(lastCount))) {
                        watchRemover();
                        var whenExpFn = whensExpFns[count];
                        isUndefined(whenExpFn) ? (null != newVal && $log.debug("ngPluralize: no rule defined for '" + count + "' in " + whenExp), 
                        watchRemover = noop, updateElementText()) : watchRemover = scope.$watch(whenExpFn, updateElementText), 
                        lastCount = count;
                    }
                });
            }
        };
    } ], ngRepeatDirective = [ "$parse", "$animate", "$compile", function($parse, $animate, $compile) {
        var ngRepeatMinErr = minErr("ngRepeat"), updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {
            scope[valueIdentifier] = value, keyIdentifier && (scope[keyIdentifier] = key), scope.$index = index, 
            scope.$first = 0 === index, scope.$last = index === arrayLength - 1, scope.$middle = !(scope.$first || scope.$last), 
            scope.$odd = !(scope.$even = 0 == (1 & index));
        }, getBlockStart = function(block) {
            return block.clone[0];
        }, getBlockEnd = function(block) {
            return block.clone[block.clone.length - 1];
        };
        return {
            restrict: "A",
            multiElement: !0,
            transclude: "element",
            priority: 1e3,
            terminal: !0,
            $$tlb: !0,
            compile: function($element, $attr) {
                var expression = $attr.ngRepeat, ngRepeatEndComment = $compile.$$createComment("end ngRepeat", expression), match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
                if (!match) throw ngRepeatMinErr("iexp", "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.", expression);
                var lhs = match[1], rhs = match[2], aliasAs = match[3], trackByExp = match[4];
                if (!(match = lhs.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/))) throw ngRepeatMinErr("iidexp", "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.", lhs);
                var trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn, valueIdentifier = match[3] || match[1], keyIdentifier = match[2];
                if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) || /^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(aliasAs))) throw ngRepeatMinErr("badident", "alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.", aliasAs);
                var hashFnLocals = {
                    $id: hashKey
                };
                return trackByExp ? trackByExpGetter = $parse(trackByExp) : (trackByIdArrayFn = function(key, value) {
                    return hashKey(value);
                }, trackByIdObjFn = function(key) {
                    return key;
                }), function($scope, $element, $attr, ctrl, $transclude) {
                    trackByExpGetter && (trackByIdExpFn = function(key, value, index) {
                        return keyIdentifier && (hashFnLocals[keyIdentifier] = key), hashFnLocals[valueIdentifier] = value, 
                        hashFnLocals.$index = index, trackByExpGetter($scope, hashFnLocals);
                    });
                    var lastBlockMap = createMap();
                    $scope.$watchCollection(rhs, function(collection) {
                        var index, length, nextNode, collectionLength, key, value, trackById, trackByIdFn, collectionKeys, block, nextBlockOrder, elementsToRemove, previousNode = $element[0], nextBlockMap = createMap();
                        if (aliasAs && ($scope[aliasAs] = collection), isArrayLike(collection)) collectionKeys = collection, 
                        trackByIdFn = trackByIdExpFn || trackByIdArrayFn; else for (var itemKey in trackByIdFn = trackByIdExpFn || trackByIdObjFn, 
                        collectionKeys = [], collection) hasOwnProperty.call(collection, itemKey) && "$" !== itemKey.charAt(0) && collectionKeys.push(itemKey);
                        for (collectionLength = collectionKeys.length, nextBlockOrder = new Array(collectionLength), 
                        index = 0; index < collectionLength; index++) if (key = collection === collectionKeys ? index : collectionKeys[index], 
                        value = collection[key], trackById = trackByIdFn(key, value, index), lastBlockMap[trackById]) block = lastBlockMap[trackById], 
                        delete lastBlockMap[trackById], nextBlockMap[trackById] = block, nextBlockOrder[index] = block; else {
                            if (nextBlockMap[trackById]) throw forEach(nextBlockOrder, function(block) {
                                block && block.scope && (lastBlockMap[block.id] = block);
                            }), ngRepeatMinErr("dupes", "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}", expression, trackById, value);
                            nextBlockOrder[index] = {
                                id: trackById,
                                scope: void 0,
                                clone: void 0
                            }, nextBlockMap[trackById] = !0;
                        }
                        for (var blockKey in lastBlockMap) {
                            if (elementsToRemove = getBlockNodes((block = lastBlockMap[blockKey]).clone), $animate.leave(elementsToRemove), 
                            elementsToRemove[0].parentNode) for (index = 0, length = elementsToRemove.length; index < length; index++) elementsToRemove[index].$$NG_REMOVED = !0;
                            block.scope.$destroy();
                        }
                        for (index = 0; index < collectionLength; index++) if (key = collection === collectionKeys ? index : collectionKeys[index], 
                        value = collection[key], (block = nextBlockOrder[index]).scope) {
                            for (nextNode = previousNode; (nextNode = nextNode.nextSibling) && nextNode.$$NG_REMOVED; ) ;
                            getBlockStart(block) != nextNode && $animate.move(getBlockNodes(block.clone), null, previousNode), 
                            previousNode = getBlockEnd(block), updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);
                        } else $transclude(function(clone, scope) {
                            block.scope = scope;
                            var endNode = ngRepeatEndComment.cloneNode(!1);
                            clone[clone.length++] = endNode, $animate.enter(clone, null, previousNode), previousNode = endNode, 
                            block.clone = clone, nextBlockMap[block.id] = block, updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);
                        });
                        lastBlockMap = nextBlockMap;
                    });
                };
            }
        };
    } ], ngShowDirective = [ "$animate", function($animate) {
        return {
            restrict: "A",
            multiElement: !0,
            link: function(scope, element, attr) {
                scope.$watch(attr.ngShow, function(value) {
                    $animate[value ? "removeClass" : "addClass"](element, "ng-hide", {
                        tempClasses: "ng-hide-animate"
                    });
                });
            }
        };
    } ], ngHideDirective = [ "$animate", function($animate) {
        return {
            restrict: "A",
            multiElement: !0,
            link: function(scope, element, attr) {
                scope.$watch(attr.ngHide, function(value) {
                    $animate[value ? "addClass" : "removeClass"](element, "ng-hide", {
                        tempClasses: "ng-hide-animate"
                    });
                });
            }
        };
    } ], ngStyleDirective = ngDirective(function(scope, element, attr) {
        scope.$watch(attr.ngStyle, function(newStyles, oldStyles) {
            oldStyles && newStyles !== oldStyles && forEach(oldStyles, function(val, style) {
                element.css(style, "");
            }), newStyles && element.css(newStyles);
        }, !0);
    }), ngSwitchDirective = [ "$animate", "$compile", function($animate, $compile) {
        return {
            require: "ngSwitch",
            controller: [ "$scope", function() {
                this.cases = {};
            } ],
            link: function(scope, element, attr, ngSwitchController) {
                var watchExpr = attr.ngSwitch || attr.on, selectedTranscludes = [], selectedElements = [], previousLeaveAnimations = [], selectedScopes = [], spliceFactory = function(array, index) {
                    return function() {
                        array.splice(index, 1);
                    };
                };
                scope.$watch(watchExpr, function(value) {
                    var i, ii;
                    for (i = 0, ii = previousLeaveAnimations.length; i < ii; ++i) $animate.cancel(previousLeaveAnimations[i]);
                    for (i = previousLeaveAnimations.length = 0, ii = selectedScopes.length; i < ii; ++i) {
                        var selected = getBlockNodes(selectedElements[i].clone);
                        selectedScopes[i].$destroy(), (previousLeaveAnimations[i] = $animate.leave(selected)).then(spliceFactory(previousLeaveAnimations, i));
                    }
                    selectedElements.length = 0, selectedScopes.length = 0, (selectedTranscludes = ngSwitchController.cases["!" + value] || ngSwitchController.cases["?"]) && forEach(selectedTranscludes, function(selectedTransclude) {
                        selectedTransclude.transclude(function(caseElement, selectedScope) {
                            selectedScopes.push(selectedScope);
                            var anchor = selectedTransclude.element;
                            caseElement[caseElement.length++] = $compile.$$createComment("end ngSwitchWhen");
                            var block = {
                                clone: caseElement
                            };
                            selectedElements.push(block), $animate.enter(caseElement, anchor.parent(), anchor);
                        });
                    });
                });
            }
        };
    } ], ngSwitchWhenDirective = ngDirective({
        transclude: "element",
        priority: 1200,
        require: "^ngSwitch",
        multiElement: !0,
        link: function(scope, element, attrs, ctrl, $transclude) {
            ctrl.cases["!" + attrs.ngSwitchWhen] = ctrl.cases["!" + attrs.ngSwitchWhen] || [], 
            ctrl.cases["!" + attrs.ngSwitchWhen].push({
                transclude: $transclude,
                element: element
            });
        }
    }), ngSwitchDefaultDirective = ngDirective({
        transclude: "element",
        priority: 1200,
        require: "^ngSwitch",
        multiElement: !0,
        link: function(scope, element, attr, ctrl, $transclude) {
            ctrl.cases["?"] = ctrl.cases["?"] || [], ctrl.cases["?"].push({
                transclude: $transclude,
                element: element
            });
        }
    }), ngTranscludeMinErr = minErr("ngTransclude"), ngTranscludeDirective = [ "$compile", function($compile) {
        return {
            restrict: "EAC",
            terminal: !0,
            compile: function(tElement) {
                var fallbackLinkFn = $compile(tElement.contents());
                return tElement.empty(), function($scope, $element, $attrs, controller, $transclude) {
                    if (!$transclude) throw ngTranscludeMinErr("orphan", "Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found. Element: {0}", startingTag($element));
                    $attrs.ngTransclude === $attrs.$attr.ngTransclude && ($attrs.ngTransclude = "");
                    var slotName = $attrs.ngTransclude || $attrs.ngTranscludeSlot;
                    function useFallbackContent() {
                        fallbackLinkFn($scope, function(clone) {
                            $element.append(clone);
                        });
                    }
                    $transclude(function(clone, transcludedScope) {
                        clone.length ? $element.append(clone) : (useFallbackContent(), transcludedScope.$destroy());
                    }, null, slotName), slotName && !$transclude.isSlotFilled(slotName) && useFallbackContent();
                };
            }
        };
    } ], scriptDirective = [ "$templateCache", function($templateCache) {
        return {
            restrict: "E",
            terminal: !0,
            compile: function(element, attr) {
                if ("text/ng-template" == attr.type) {
                    var templateUrl = attr.id, text = element[0].text;
                    $templateCache.put(templateUrl, text);
                }
            }
        };
    } ], noopNgModelController = {
        $setViewValue: noop,
        $render: noop
    };
    var SelectController = [ "$element", "$scope", function($element, $scope) {
        var self = this, optionsMap = new HashMap();
        self.ngModelCtrl = noopNgModelController, self.unknownOption = jqLite(window.document.createElement("option")), 
        self.renderUnknownOption = function(val) {
            var unknownVal = "? " + hashKey(val) + " ?";
            self.unknownOption.val(unknownVal), $element.prepend(self.unknownOption), $element.val(unknownVal);
        }, $scope.$on("$destroy", function() {
            self.renderUnknownOption = noop;
        }), self.removeUnknownOption = function() {
            self.unknownOption.parent() && self.unknownOption.remove();
        }, self.readValue = function() {
            return self.removeUnknownOption(), $element.val();
        }, self.writeValue = function(value) {
            self.hasOption(value) ? (self.removeUnknownOption(), $element.val(value), "" === value && self.emptyOption.prop("selected", !0)) : null == value && self.emptyOption ? (self.removeUnknownOption(), 
            $element.val("")) : self.renderUnknownOption(value);
        }, self.addOption = function(value, element) {
            if (element[0].nodeType !== NODE_TYPE_COMMENT) {
                assertNotHasOwnProperty(value, '"option value"'), "" === value && (self.emptyOption = element);
                var optionElement, count = optionsMap.get(value) || 0;
                optionsMap.put(value, count + 1), self.ngModelCtrl.$render(), (optionElement = element)[0].hasAttribute("selected") && (optionElement[0].selected = !0);
            }
        }, self.removeOption = function(value) {
            var count = optionsMap.get(value);
            count && (1 === count ? (optionsMap.remove(value), "" === value && (self.emptyOption = void 0)) : optionsMap.put(value, count - 1));
        }, self.hasOption = function(value) {
            return !!optionsMap.get(value);
        }, self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {
            var oldVal;
            interpolateValueFn ? optionAttrs.$observe("value", function(newVal) {
                isDefined(oldVal) && self.removeOption(oldVal), oldVal = newVal, self.addOption(newVal, optionElement);
            }) : interpolateTextFn ? optionScope.$watch(interpolateTextFn, function(newVal, oldVal) {
                optionAttrs.$set("value", newVal), oldVal !== newVal && self.removeOption(oldVal), 
                self.addOption(newVal, optionElement);
            }) : self.addOption(optionAttrs.value, optionElement);
            optionElement.on("$destroy", function() {
                self.removeOption(optionAttrs.value), self.ngModelCtrl.$render();
            });
        };
    } ], selectDirective = function() {
        return {
            restrict: "E",
            require: [ "select", "?ngModel" ],
            controller: SelectController,
            priority: 1,
            link: {
                pre: function(scope, element, attr, ctrls) {
                    var ngModelCtrl = ctrls[1];
                    if (!ngModelCtrl) return;
                    var selectCtrl = ctrls[0];
                    if (selectCtrl.ngModelCtrl = ngModelCtrl, element.on("change", function() {
                        scope.$apply(function() {
                            ngModelCtrl.$setViewValue(selectCtrl.readValue());
                        });
                    }), attr.multiple) {
                        selectCtrl.readValue = function() {
                            var array = [];
                            return forEach(element.find("option"), function(option) {
                                option.selected && array.push(option.value);
                            }), array;
                        }, selectCtrl.writeValue = function(value) {
                            var items = new HashMap(value);
                            forEach(element.find("option"), function(option) {
                                option.selected = isDefined(items.get(option.value));
                            });
                        };
                        var lastView, lastViewRef = NaN;
                        scope.$watch(function() {
                            lastViewRef !== ngModelCtrl.$viewValue || equals(lastView, ngModelCtrl.$viewValue) || (lastView = shallowCopy(ngModelCtrl.$viewValue), 
                            ngModelCtrl.$render()), lastViewRef = ngModelCtrl.$viewValue;
                        }), ngModelCtrl.$isEmpty = function(value) {
                            return !value || 0 === value.length;
                        };
                    }
                },
                post: function(scope, element, attrs, ctrls) {
                    var ngModelCtrl = ctrls[1];
                    if (!ngModelCtrl) return;
                    var selectCtrl = ctrls[0];
                    ngModelCtrl.$render = function() {
                        selectCtrl.writeValue(ngModelCtrl.$viewValue);
                    };
                }
            }
        };
    }, optionDirective = [ "$interpolate", function($interpolate) {
        return {
            restrict: "E",
            priority: 100,
            compile: function(element, attr) {
                if (isDefined(attr.value)) var interpolateValueFn = $interpolate(attr.value, !0); else {
                    var interpolateTextFn = $interpolate(element.text(), !0);
                    interpolateTextFn || attr.$set("value", element.text());
                }
                return function(scope, element, attr) {
                    var parent = element.parent(), selectCtrl = parent.data("$selectController") || parent.parent().data("$selectController");
                    selectCtrl && selectCtrl.registerOption(scope, element, attr, interpolateValueFn, interpolateTextFn);
                };
            }
        };
    } ], styleDirective = valueFn({
        restrict: "E",
        terminal: !1
    }), requiredDirective = function() {
        return {
            restrict: "A",
            require: "?ngModel",
            link: function(scope, elm, attr, ctrl) {
                ctrl && (attr.required = !0, ctrl.$validators.required = function(modelValue, viewValue) {
                    return !attr.required || !ctrl.$isEmpty(viewValue);
                }, attr.$observe("required", function() {
                    ctrl.$validate();
                }));
            }
        };
    }, patternDirective = function() {
        return {
            restrict: "A",
            require: "?ngModel",
            link: function(scope, elm, attr, ctrl) {
                if (ctrl) {
                    var regexp, patternExp = attr.ngPattern || attr.pattern;
                    attr.$observe("pattern", function(regex) {
                        if (isString(regex) && 0 < regex.length && (regex = new RegExp("^" + regex + "$")), 
                        regex && !regex.test) throw minErr("ngPattern")("noregexp", "Expected {0} to be a RegExp but was {1}. Element: {2}", patternExp, regex, startingTag(elm));
                        regexp = regex || void 0, ctrl.$validate();
                    }), ctrl.$validators.pattern = function(modelValue, viewValue) {
                        return ctrl.$isEmpty(viewValue) || isUndefined(regexp) || regexp.test(viewValue);
                    };
                }
            }
        };
    }, maxlengthDirective = function() {
        return {
            restrict: "A",
            require: "?ngModel",
            link: function(scope, elm, attr, ctrl) {
                if (ctrl) {
                    var maxlength = -1;
                    attr.$observe("maxlength", function(value) {
                        var intVal = toInt(value);
                        maxlength = isNaN(intVal) ? -1 : intVal, ctrl.$validate();
                    }), ctrl.$validators.maxlength = function(modelValue, viewValue) {
                        return maxlength < 0 || ctrl.$isEmpty(viewValue) || viewValue.length <= maxlength;
                    };
                }
            }
        };
    }, minlengthDirective = function() {
        return {
            restrict: "A",
            require: "?ngModel",
            link: function(scope, elm, attr, ctrl) {
                if (ctrl) {
                    var minlength = 0;
                    attr.$observe("minlength", function(value) {
                        minlength = toInt(value) || 0, ctrl.$validate();
                    }), ctrl.$validators.minlength = function(modelValue, viewValue) {
                        return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;
                    };
                }
            }
        };
    };
    window.angular.bootstrap ? window.console && console.log("WARNING: Tried to load angular more than once.") : (!function() {
        var originalCleanData;
        if (!bindJQueryFired) {
            var jqName = jq();
            (jQuery = isUndefined(jqName) ? window.jQuery : jqName ? window[jqName] : void 0) && jQuery.fn.on ? (extend((jqLite = jQuery).fn, {
                scope: JQLitePrototype.scope,
                isolateScope: JQLitePrototype.isolateScope,
                controller: JQLitePrototype.controller,
                injector: JQLitePrototype.injector,
                inheritedData: JQLitePrototype.inheritedData
            }), originalCleanData = jQuery.cleanData, jQuery.cleanData = function(elems) {
                for (var events, elem, i = 0; null != (elem = elems[i]); i++) (events = jQuery._data(elem, "events")) && events.$destroy && jQuery(elem).triggerHandler("$destroy");
                originalCleanData(elems);
            }) : jqLite = JQLite, angular.element = jqLite, bindJQueryFired = !0;
        }
    }(), function(angular) {
        extend(angular, {
            bootstrap: bootstrap,
            copy: copy,
            extend: extend,
            merge: merge,
            equals: equals,
            element: jqLite,
            forEach: forEach,
            injector: createInjector,
            noop: noop,
            bind: bind,
            toJson: toJson,
            fromJson: fromJson,
            identity: identity,
            isUndefined: isUndefined,
            isDefined: isDefined,
            isString: isString,
            isFunction: isFunction,
            isObject: isObject,
            isNumber: isNumber,
            isElement: isElement,
            isArray: isArray,
            version: version,
            isDate: isDate,
            lowercase: lowercase,
            uppercase: uppercase,
            callbacks: {
                $$counter: 0
            },
            getTestability: getTestability,
            $$minErr: minErr,
            $$csp: csp,
            reloadWithDebugInfo: reloadWithDebugInfo
        }), (angularModule = function(window) {
            var $injectorMinErr = minErr("$injector"), ngMinErr = minErr("ng");
            function ensure(obj, name, factory) {
                return obj[name] || (obj[name] = factory());
            }
            var angular = ensure(window, "angular", Object);
            return angular.$$minErr = angular.$$minErr || minErr, ensure(angular, "module", function() {
                var modules = {};
                return function(name, requires, configFn) {
                    return function(name, context) {
                        if ("hasOwnProperty" === name) throw ngMinErr("badname", "hasOwnProperty is not a valid {0} name", context);
                    }(name, "module"), requires && modules.hasOwnProperty(name) && (modules[name] = null), 
                    ensure(modules, name, function() {
                        if (!requires) throw $injectorMinErr("nomod", "Module '{0}' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.", name);
                        var invokeQueue = [], configBlocks = [], runBlocks = [], config = invokeLater("$injector", "invoke", "push", configBlocks), moduleInstance = {
                            _invokeQueue: invokeQueue,
                            _configBlocks: configBlocks,
                            _runBlocks: runBlocks,
                            requires: requires,
                            name: name,
                            provider: invokeLaterAndSetModuleName("$provide", "provider"),
                            factory: invokeLaterAndSetModuleName("$provide", "factory"),
                            service: invokeLaterAndSetModuleName("$provide", "service"),
                            value: invokeLater("$provide", "value"),
                            constant: invokeLater("$provide", "constant", "unshift"),
                            decorator: invokeLaterAndSetModuleName("$provide", "decorator"),
                            animation: invokeLaterAndSetModuleName("$animateProvider", "register"),
                            filter: invokeLaterAndSetModuleName("$filterProvider", "register"),
                            controller: invokeLaterAndSetModuleName("$controllerProvider", "register"),
                            directive: invokeLaterAndSetModuleName("$compileProvider", "directive"),
                            component: invokeLaterAndSetModuleName("$compileProvider", "component"),
                            config: config,
                            run: function(block) {
                                return runBlocks.push(block), this;
                            }
                        };
                        return configFn && config(configFn), moduleInstance;
                        function invokeLater(provider, method, insertMethod, queue) {
                            return queue || (queue = invokeQueue), function() {
                                return queue[insertMethod || "push"]([ provider, method, arguments ]), moduleInstance;
                            };
                        }
                        function invokeLaterAndSetModuleName(provider, method) {
                            return function(recipeName, factoryFunction) {
                                return factoryFunction && isFunction(factoryFunction) && (factoryFunction.$$moduleName = name), 
                                invokeQueue.push([ provider, method, arguments ]), moduleInstance;
                            };
                        }
                    });
                };
            });
        }(window))("ng", [ "ngLocale" ], [ "$provide", function($provide) {
            $provide.provider({
                $$sanitizeUri: $$SanitizeUriProvider
            }), $provide.provider("$compile", $CompileProvider).directive({
                a: htmlAnchorDirective,
                input: inputDirective,
                textarea: inputDirective,
                form: formDirective,
                script: scriptDirective,
                select: selectDirective,
                style: styleDirective,
                option: optionDirective,
                ngBind: ngBindDirective,
                ngBindHtml: ngBindHtmlDirective,
                ngBindTemplate: ngBindTemplateDirective,
                ngClass: ngClassDirective,
                ngClassEven: ngClassEvenDirective,
                ngClassOdd: ngClassOddDirective,
                ngCloak: ngCloakDirective,
                ngController: ngControllerDirective,
                ngForm: ngFormDirective,
                ngHide: ngHideDirective,
                ngIf: ngIfDirective,
                ngInclude: ngIncludeDirective,
                ngInit: ngInitDirective,
                ngNonBindable: ngNonBindableDirective,
                ngPluralize: ngPluralizeDirective,
                ngRepeat: ngRepeatDirective,
                ngShow: ngShowDirective,
                ngStyle: ngStyleDirective,
                ngSwitch: ngSwitchDirective,
                ngSwitchWhen: ngSwitchWhenDirective,
                ngSwitchDefault: ngSwitchDefaultDirective,
                ngOptions: ngOptionsDirective,
                ngTransclude: ngTranscludeDirective,
                ngModel: ngModelDirective,
                ngList: ngListDirective,
                ngChange: ngChangeDirective,
                pattern: patternDirective,
                ngPattern: patternDirective,
                required: requiredDirective,
                ngRequired: requiredDirective,
                minlength: minlengthDirective,
                ngMinlength: minlengthDirective,
                maxlength: maxlengthDirective,
                ngMaxlength: maxlengthDirective,
                ngValue: ngValueDirective,
                ngModelOptions: ngModelOptionsDirective
            }).directive({
                ngInclude: ngIncludeFillContentDirective
            }).directive(ngAttributeAliasDirectives).directive(ngEventDirectives), $provide.provider({
                $anchorScroll: $AnchorScrollProvider,
                $animate: $AnimateProvider,
                $animateCss: $CoreAnimateCssProvider,
                $$animateJs: $$CoreAnimateJsProvider,
                $$animateQueue: $$CoreAnimateQueueProvider,
                $$AnimateRunner: $$AnimateRunnerFactoryProvider,
                $$animateAsyncRun: $$AnimateAsyncRunFactoryProvider,
                $browser: $BrowserProvider,
                $cacheFactory: $CacheFactoryProvider,
                $controller: $ControllerProvider,
                $document: $DocumentProvider,
                $exceptionHandler: $ExceptionHandlerProvider,
                $filter: $FilterProvider,
                $$forceReflow: $$ForceReflowProvider,
                $interpolate: $InterpolateProvider,
                $interval: $IntervalProvider,
                $http: $HttpProvider,
                $httpParamSerializer: $HttpParamSerializerProvider,
                $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,
                $httpBackend: $HttpBackendProvider,
                $xhrFactory: $xhrFactoryProvider,
                $jsonpCallbacks: $jsonpCallbacksProvider,
                $location: $LocationProvider,
                $log: $LogProvider,
                $parse: $ParseProvider,
                $rootScope: $RootScopeProvider,
                $q: $QProvider,
                $$q: $$QProvider,
                $sce: $SceProvider,
                $sceDelegate: $SceDelegateProvider,
                $sniffer: $SnifferProvider,
                $templateCache: $TemplateCacheProvider,
                $templateRequest: $TemplateRequestProvider,
                $$testability: $$TestabilityProvider,
                $timeout: $TimeoutProvider,
                $window: $WindowProvider,
                $$rAF: $$RAFProvider,
                $$jqLite: $$jqLiteProvider,
                $$HashMap: $$HashMapProvider,
                $$cookieReader: $$CookieReaderProvider
            });
        } ]);
    }(angular), angular.module("ngLocale", [], [ "$provide", function($provide) {
        var PLURAL_CATEGORY_ONE = "one", PLURAL_CATEGORY_OTHER = "other";
        $provide.value("$locale", {
            DATETIME_FORMATS: {
                AMPMS: [ "AM", "PM" ],
                DAY: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ],
                ERANAMES: [ "Before Christ", "Anno Domini" ],
                ERAS: [ "BC", "AD" ],
                FIRSTDAYOFWEEK: 6,
                MONTH: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ],
                SHORTDAY: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ],
                SHORTMONTH: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ],
                STANDALONEMONTH: [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ],
                WEEKENDRANGE: [ 5, 6 ],
                fullDate: "EEEE, MMMM d, y",
                longDate: "MMMM d, y",
                medium: "MMM d, y h:mm:ss a",
                mediumDate: "MMM d, y",
                mediumTime: "h:mm:ss a",
                short: "M/d/yy h:mm a",
                shortDate: "M/d/yy",
                shortTime: "h:mm a"
            },
            NUMBER_FORMATS: {
                CURRENCY_SYM: "$",
                DECIMAL_SEP: ".",
                GROUP_SEP: ",",
                PATTERNS: [ {
                    gSize: 3,
                    lgSize: 3,
                    maxFrac: 3,
                    minFrac: 0,
                    minInt: 1,
                    negPre: "-",
                    negSuf: "",
                    posPre: "",
                    posSuf: ""
                }, {
                    gSize: 3,
                    lgSize: 3,
                    maxFrac: 2,
                    minFrac: 2,
                    minInt: 1,
                    negPre: "-¤",
                    negSuf: "",
                    posPre: "¤",
                    posSuf: ""
                } ]
            },
            id: "en-us",
            localeID: "en_US",
            pluralCat: function(n, opt_precision) {
                var i = 0 | n, vf = function(n, opt_precision) {
                    var v = opt_precision;
                    void 0 === v && (v = Math.min(function(n) {
                        var i = (n += "").indexOf(".");
                        return -1 == i ? 0 : n.length - i - 1;
                    }(n), 3));
                    var base = Math.pow(10, v);
                    return {
                        v: v,
                        f: (n * base | 0) % base
                    };
                }(n, opt_precision);
                return 1 == i && 0 == vf.v ? PLURAL_CATEGORY_ONE : PLURAL_CATEGORY_OTHER;
            }
        });
    } ]), jqLite(window.document).ready(function() {
        angularInit(window.document, bootstrap);
    }));
}(window), !window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>'), 
function(t, e) {
    "object" == typeof exports && "undefined" != typeof module ? e(exports, require("angular")) : "function" == typeof define && define.amd ? define([ "exports", "angular" ], e) : e(t["@uirouter/angularjs"] = {}, t.angular);
}(this, function(t, e) {
    "use strict";
    var r = angular, n = e && e.module ? e : r;
    function i(t) {
        var e = [].slice.apply(arguments, [ 1 ]), r = t.length;
        return function e(n) {
            return n.length >= r ? t.apply(null, n) : function() {
                return e(n.concat([].slice.apply(arguments)));
            };
        }(e);
    }
    function o() {
        var t = arguments, e = t.length - 1;
        return function() {
            for (var r = e, n = t[e].apply(this, arguments); r--; ) n = t[r].call(this, n);
            return n;
        };
    }
    function a() {
        for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
        return o.apply(null, [].slice.call(arguments).reverse());
    }
    var u = function(t) {
        return function(e) {
            return e && e[t];
        };
    }, s = i(function(t, e, r) {
        return r && r[t] === e;
    }), c = function(t) {
        return a.apply(null, t.split(".").map(u));
    }, f = function(t) {
        return function() {
            for (var e = [], r = 0; r < arguments.length; r++) e[r] = arguments[r];
            return !t.apply(null, e);
        };
    };
    function l(t, e) {
        return function() {
            for (var r = [], n = 0; n < arguments.length; n++) r[n] = arguments[n];
            return t.apply(null, r) && e.apply(null, r);
        };
    }
    function h(t, e) {
        return function() {
            for (var r = [], n = 0; n < arguments.length; n++) r[n] = arguments[n];
            return t.apply(null, r) || e.apply(null, r);
        };
    }
    var p = function(t) {
        return function(e) {
            return e.reduce(function(e, r) {
                return e && !!t(r);
            }, !0);
        };
    }, v = function(t) {
        return function(e) {
            return e.reduce(function(e, r) {
                return e || !!t(r);
            }, !1);
        };
    }, d = function(t) {
        return function(e) {
            return null != e && e.constructor === t || e instanceof t;
        };
    }, m = function(t) {
        return function(e) {
            return t === e;
        };
    }, y = function(t) {
        return function() {
            return t;
        };
    };
    function g(t, e) {
        return function(r) {
            return r[t].apply(r, e);
        };
    }
    function _(t) {
        return function(e) {
            for (var r = 0; r < t.length; r++) if (t[r][0](e)) return t[r][1](e);
        };
    }
    var w = function() {
        function t(t) {
            this.text = t, this.glob = t.split(".");
            var e = this.text.split(".").map(function(t) {
                return "**" === t ? "(?:|(?:\\.[^.]*)*)" : "*" === t ? "\\.[^.]*" : "\\." + t;
            }).join("");
            this.regexp = new RegExp("^" + e + "$");
        }
        return t.is = function(t) {
            return !!/[!,*]+/.exec(t);
        }, t.fromString = function(e) {
            return t.is(e) ? new t(e) : null;
        }, t.prototype.matches = function(t) {
            return this.regexp.test("." + t);
        }, t;
    }(), $ = function() {
        function t(e) {
            return t.create(e || {});
        }
        return t.create = function(e) {
            e = t.isStateClass(e) ? new e() : e;
            var r = K(K(e, t.prototype));
            return e.$$state = function() {
                return r;
            }, r.self = e, r.__stateObjectCache = {
                nameGlob: w.fromString(r.name)
            }, r;
        }, t.prototype.is = function(t) {
            return this === t || this.self === t || this.fqn() === t;
        }, t.prototype.fqn = function() {
            if (!(this.parent && this.parent instanceof this.constructor)) return this.name;
            var t = this.parent.fqn();
            return t ? t + "." + this.name : this.name;
        }, t.prototype.root = function() {
            return this.parent && this.parent.root() || this;
        }, t.prototype.parameters = function(t) {
            return ((t = it(t, {
                inherit: !0,
                matchingKeys: null
            })).inherit && this.parent && this.parent.parameters() || []).concat(vt(this.params)).filter(function(e) {
                return !t.matchingKeys || t.matchingKeys.hasOwnProperty(e.id);
            });
        }, t.prototype.parameter = function(t, e) {
            return void 0 === e && (e = {}), this.url && this.url.parameter(t, e) || lt(vt(this.params), s("id", t)) || e.inherit && this.parent && this.parent.parameter(t);
        }, t.prototype.toString = function() {
            return this.fqn();
        }, t.isStateClass = function(t) {
            return P(t) && !0 === t.__uiRouterState;
        }, t.isState = function(t) {
            return x(t.__stateObjectCache);
        }, t;
    }(), S = Object.prototype.toString, b = function(t) {
        return function(e) {
            return typeof e === t;
        };
    }, R = b("undefined"), E = f(R), C = function(t) {
        return null === t;
    }, T = h(C, R), P = b("function"), k = b("number"), O = b("string"), x = function(t) {
        return null !== t && "object" == typeof t;
    }, V = Array.isArray, I = function(t) {
        return "[object Date]" === S.call(t);
    }, j = function(t) {
        return "[object RegExp]" === S.call(t);
    }, A = $.isState;
    function H(t) {
        if (V(t) && t.length) {
            var e = t.slice(0, -1), r = t.slice(-1);
            return !(e.filter(f(O)).length || r.filter(f(P)).length);
        }
        return P(t);
    }
    var D = l(x, a(u("then"), P)), q = function(t) {
        return function() {
            throw new Error(t + "(): No coreservices implementation for UI-Router is loaded.");
        };
    }, N = {
        $q: void 0,
        $injector: void 0
    }, F = "object" == typeof self && self.self === self && self || "object" == typeof global && global.global === global && global || void 0, U = F.angular || {}, L = U.fromJson || JSON.parse.bind(JSON), M = U.toJson || JSON.stringify.bind(JSON), B = U.forEach || function(t, e, r) {
        if (V(t)) return t.forEach(e, r);
        Object.keys(t).forEach(function(r) {
            return e(t[r], r);
        });
    }, G = Object.assign || xt, W = U.equals || function Vt(t, e) {
        if (t === e) return !0;
        if (null === t || null === e) return !1;
        if (t != t && e != e) return !0;
        var r = typeof t;
        if (r !== typeof e || "object" !== r) return !1;
        var n, i, o = [ t, e ];
        if (p(V)(o)) return i = e, (n = t).length === i.length && Tt(n, i).reduce(function(t, e) {
            return t && Vt(e[0], e[1]);
        }, !0);
        if (p(I)(o)) return t.getTime() === e.getTime();
        if (p(j)(o)) return t.toString() === e.toString();
        if (p(P)(o)) return !0;
        if ([ P, V, I, j ].map(v).reduce(function(t, e) {
            return t || !!e(o);
        }, !1)) return !1;
        var a = {};
        for (var u in t) {
            if (!Vt(t[u], e[u])) return !1;
            a[u] = !0;
        }
        for (var u in e) if (!a[u]) return !1;
        return !0;
    };
    function z(t) {
        return t;
    }
    function J() {}
    function Q(t, e, r, n, i) {
        void 0 === i && (i = !1);
        var o = function(e) {
            return t()[e].bind(r());
        };
        return (n = n || Object.keys(t())).reduce(function(t, r) {
            var n;
            return t[r] = i ? (n = r, function() {
                return e[n] = o(n), e[n].apply(null, arguments);
            }) : o(r), t;
        }, e);
    }
    var K = function(t, e) {
        return G(Object.create(t), e);
    }, Y = i(Z);
    function Z(t, e) {
        return -1 !== t.indexOf(e);
    }
    var X = i(tt);
    function tt(t, e) {
        var r = t.indexOf(e);
        return 0 <= r && t.splice(r, 1), t;
    }
    var et = i(rt);
    function rt(t, e) {
        return t.push(e), e;
    }
    var nt = function(t) {
        return t.slice().forEach(function(e) {
            "function" == typeof e && e(), X(t, e);
        });
    };
    function it(t) {
        for (var e = [], r = 1; r < arguments.length; r++) e[r - 1] = arguments[r];
        var n = e.concat({}).reverse(), i = G.apply(null, n);
        return G({}, i, ut(t || {}, Object.keys(i)));
    }
    var ot = function(t, e) {
        return G(t, e);
    };
    function at(t, e) {
        var r = [];
        for (var n in t.path) {
            if (t.path[n] !== e.path[n]) break;
            r.push(t.path[n]);
        }
        return r;
    }
    function ut(t, e) {
        var r = {};
        for (var n in t) -1 !== e.indexOf(n) && (r[n] = t[n]);
        return r;
    }
    function st(t, e) {
        return Object.keys(t).filter(f(Y(e))).reduce(function(e, r) {
            return e[r] = t[r], e;
        }, {});
    }
    function ct(t, e) {
        return pt(t, u(e));
    }
    function ft(t, e) {
        var r = V(t), n = r ? [] : {}, i = r ? function(t) {
            return n.push(t);
        } : function(t, e) {
            return n[e] = t;
        };
        return B(t, function(t, r) {
            e(t, r) && i(t, r);
        }), n;
    }
    function lt(t, e) {
        var r;
        return B(t, function(t, n) {
            r || e(t, n) && (r = t);
        }), r;
    }
    var ht = pt;
    function pt(t, e, r) {
        return r = r || (V(t) ? [] : {}), B(t, function(t, n) {
            return r[n] = e(t, n);
        }), r;
    }
    var vt = function(t) {
        return Object.keys(t).map(function(e) {
            return t[e];
        });
    }, dt = function(t, e) {
        return t && e;
    }, mt = function(t, e) {
        return t || e;
    }, yt = function(t, e) {
        return t.concat(e);
    }, gt = function(t, e) {
        return V(e) ? t.concat(e.reduce(gt, [])) : _t(t, e);
    };
    function _t(t, e) {
        return t.push(e), t;
    }
    var wt = function(t, e) {
        return Y(t, e) ? t : _t(t, e);
    }, $t = function(t) {
        return t.reduce(yt, []);
    }, St = function(t) {
        return t.reduce(gt, []);
    }, bt = Et, Rt = Et;
    function Et(t, e) {
        return void 0 === e && (e = "assert failure"), function(r) {
            var n = t(r);
            if (!n) throw new Error(P(e) ? e(r) : e);
            return n;
        };
    }
    var Ct = function(t) {
        return Object.keys(t).map(function(e) {
            return [ e, t[e] ];
        });
    };
    function Tt() {
        for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
        if (0 === t.length) return [];
        for (var r = t.reduce(function(t, e) {
            return Math.min(e.length, t);
        }, 9007199254740991), n = [], i = function(e) {
            switch (t.length) {
              case 1:
                n.push([ t[0][e] ]);
                break;

              case 2:
                n.push([ t[0][e], t[1][e] ]);
                break;

              case 3:
                n.push([ t[0][e], t[1][e], t[2][e] ]);
                break;

              case 4:
                n.push([ t[0][e], t[1][e], t[2][e], t[3][e] ]);
                break;

              default:
                n.push(t.map(function(t) {
                    return t[e];
                }));
            }
        }, o = 0; o < r; o++) i(o);
        return n;
    }
    function Pt(t, e) {
        var r, n;
        if (V(e) && (r = e[0], n = e[1]), !O(r)) throw new Error("invalid parameters to applyPairs");
        return t[r] = n, t;
    }
    function kt(t) {
        return t.length && t[t.length - 1] || void 0;
    }
    function Ot(t, e) {
        return e && Object.keys(e).forEach(function(t) {
            return delete e[t];
        }), e || (e = {}), G(e, t);
    }
    function xt(t) {
        for (var e = 1; e < arguments.length; e++) {
            var r = arguments[e];
            if (r) for (var n = Object.keys(r), i = 0; i < n.length; i++) t[n[i]] = r[n[i]];
        }
        return t;
    }
    var It, jt = function(t) {
        return t.catch(function(t) {
            return 0;
        }) && t;
    }, At = function(t) {
        return jt(N.$q.reject(t));
    }, Ht = function() {
        function t(t, e) {
            void 0 === t && (t = []), void 0 === e && (e = null), this._items = t, this._limit = e, 
            this._evictListeners = [], this.onEvict = et(this._evictListeners);
        }
        return t.prototype.enqueue = function(t) {
            var e = this._items;
            return e.push(t), this._limit && e.length > this._limit && this.evict(), t;
        }, t.prototype.evict = function() {
            var t = this._items.shift();
            return this._evictListeners.forEach(function(e) {
                return e(t);
            }), t;
        }, t.prototype.dequeue = function() {
            if (this.size()) return this._items.splice(0, 1)[0];
        }, t.prototype.clear = function() {
            var t = this._items;
            return this._items = [], t;
        }, t.prototype.size = function() {
            return this._items.length;
        }, t.prototype.remove = function(t) {
            var e = this._items.indexOf(t);
            return -1 < e && this._items.splice(e, 1)[0];
        }, t.prototype.peekTail = function() {
            return this._items[this._items.length - 1];
        }, t.prototype.peekHead = function() {
            if (this.size()) return this._items[0];
        }, t;
    }();
    (It = t.RejectType || (t.RejectType = {}))[It.SUPERSEDED = 2] = "SUPERSEDED", It[It.ABORTED = 3] = "ABORTED", 
    It[It.INVALID = 4] = "INVALID", It[It.IGNORED = 5] = "IGNORED", It[It.ERROR = 6] = "ERROR";
    var Dt = 0, qt = function() {
        function e(t, e, r) {
            this.$id = Dt++, this.type = t, this.message = e, this.detail = r;
        }
        return e.isRejectionPromise = function(t) {
            return t && "function" == typeof t.then && d(e)(t._transitionRejection);
        }, e.superseded = function(r, n) {
            var i = new e(t.RejectType.SUPERSEDED, "The transition has been superseded by a different transition", r);
            return n && n.redirected && (i.redirected = !0), i;
        }, e.redirected = function(t) {
            return e.superseded(t, {
                redirected: !0
            });
        }, e.invalid = function(r) {
            return new e(t.RejectType.INVALID, "This transition is invalid", r);
        }, e.ignored = function(r) {
            return new e(t.RejectType.IGNORED, "The transition was ignored", r);
        }, e.aborted = function(r) {
            return new e(t.RejectType.ABORTED, "The transition has been aborted", r);
        }, e.errored = function(r) {
            return new e(t.RejectType.ERROR, "The transition errored", r);
        }, e.normalize = function(t) {
            return d(e)(t) ? t : e.errored(t);
        }, e.prototype.toString = function() {
            var t, e = (t = this.detail) && t.toString !== Object.prototype.toString ? t.toString() : ke(t);
            return "Transition Rejection($id: " + this.$id + " type: " + this.type + ", message: " + this.message + ", detail: " + e + ")";
        }, e.prototype.toPromise = function() {
            return G(At(this), {
                _transitionRejection: this
            });
        }, e;
    }();
    function Nt(t) {
        if (!t) return "ui-view (defunct)";
        var e = t.creationContext ? t.creationContext.name || "(root)" : "(none)";
        return "[ui-view#" + t.id + " " + t.$type + ":" + t.fqn + " (" + t.name + "@" + e + ")]";
    }
    function Ft(e) {
        return k(e) ? t.Category[e] : t.Category[t.Category[e]];
    }
    var Ut, Lt = Function.prototype.bind.call(console.log, console), Mt = P(console.table) ? console.table.bind(console) : Lt.bind(console);
    (Ut = t.Category || (t.Category = {}))[Ut.RESOLVE = 0] = "RESOLVE", Ut[Ut.TRANSITION = 1] = "TRANSITION", 
    Ut[Ut.HOOK = 2] = "HOOK", Ut[Ut.UIVIEW = 3] = "UIVIEW", Ut[Ut.VIEWCONFIG = 4] = "VIEWCONFIG";
    var Bt, Gt, Wt = c("$id"), zt = c("router.$id"), Jt = function(t) {
        return "Transition #" + Wt(t) + "-" + zt(t);
    }, Qt = function() {
        function e() {
            this._enabled = {}, this.approximateDigests = 0;
        }
        return e.prototype._set = function(e, r) {
            var n = this;
            r.length || (r = Object.keys(t.Category).map(function(t) {
                return parseInt(t, 10);
            }).filter(function(t) {
                return !isNaN(t);
            }).map(function(e) {
                return t.Category[e];
            })), r.map(Ft).forEach(function(t) {
                return n._enabled[t] = e;
            });
        }, e.prototype.enable = function() {
            for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
            this._set(!0, t);
        }, e.prototype.disable = function() {
            for (var t = [], e = 0; e < arguments.length; e++) t[e] = arguments[e];
            this._set(!1, t);
        }, e.prototype.enabled = function(t) {
            return !!this._enabled[Ft(t)];
        }, e.prototype.traceTransitionStart = function(e) {
            this.enabled(t.Category.TRANSITION) && console.log(Jt(e) + ": Started  -> " + ke(e));
        }, e.prototype.traceTransitionIgnored = function(e) {
            this.enabled(t.Category.TRANSITION) && console.log(Jt(e) + ": Ignored  <> " + ke(e));
        }, e.prototype.traceHookInvocation = function(e, r, n) {
            if (this.enabled(t.Category.HOOK)) {
                var i = c("traceData.hookType")(n) || "internal", o = c("traceData.context.state.name")(n) || c("traceData.context")(n) || "unknown", a = Ee(e.registeredHook.callback);
                console.log(Jt(r) + ":   Hook -> " + i + " context: " + o + ", " + Se(200, a));
            }
        }, e.prototype.traceHookResult = function(e, r, n) {
            this.enabled(t.Category.HOOK) && console.log(Jt(r) + ":   <- Hook returned: " + Se(200, ke(e)));
        }, e.prototype.traceResolvePath = function(e, r, n) {
            this.enabled(t.Category.RESOLVE) && console.log(Jt(n) + ":         Resolving " + e + " (" + r + ")");
        }, e.prototype.traceResolvableResolved = function(e, r) {
            this.enabled(t.Category.RESOLVE) && console.log(Jt(r) + ":               <- Resolved  " + e + " to: " + Se(200, ke(e.data)));
        }, e.prototype.traceError = function(e, r) {
            this.enabled(t.Category.TRANSITION) && console.log(Jt(r) + ": <- Rejected " + ke(r) + ", reason: " + e);
        }, e.prototype.traceSuccess = function(e, r) {
            this.enabled(t.Category.TRANSITION) && console.log(Jt(r) + ": <- Success  " + ke(r) + ", final state: " + e.name);
        }, e.prototype.traceUIViewEvent = function(e, r, n) {
            void 0 === n && (n = ""), this.enabled(t.Category.UIVIEW) && console.log("ui-view: " + be(30, e) + " " + Nt(r) + n);
        }, e.prototype.traceUIViewConfigUpdated = function(e, r) {
            this.enabled(t.Category.UIVIEW) && this.traceUIViewEvent("Updating", e, " with ViewConfig from context='" + r + "'");
        }, e.prototype.traceUIViewFill = function(e, r) {
            this.enabled(t.Category.UIVIEW) && this.traceUIViewEvent("Fill", e, " with: " + Se(200, r));
        }, e.prototype.traceViewSync = function(e) {
            if (this.enabled(t.Category.VIEWCONFIG)) {
                var r = "uiview component fqn", n = e.map(function(t) {
                    var e, n = t.uiView, i = t.viewConfig, o = n && n.fqn, a = i && i.viewDecl.$context.name + ": (" + i.viewDecl.$name + ")";
                    return (e = {})[r] = o, e["view config state (view name)"] = a, e;
                }).sort(function(t, e) {
                    return (t[r] || "").localeCompare(e[r] || "");
                });
                Mt(n);
            }
        }, e.prototype.traceViewServiceEvent = function(e, r) {
            this.enabled(t.Category.VIEWCONFIG) && console.log("VIEWCONFIG: " + e + " " + function(t) {
                var e = t.viewDecl, r = e.$context.name || "(root)";
                return "[View#" + t.$id + " from '" + r + "' state]: target ui-view: '" + e.$uiViewName + "@" + e.$uiViewContextAnchor + "'";
            }(r));
        }, e.prototype.traceViewServiceUIViewEvent = function(e, r) {
            this.enabled(t.Category.VIEWCONFIG) && console.log("VIEWCONFIG: " + e + " " + Nt(r));
        }, e;
    }(), Kt = new Qt();
    (Bt = t.TransitionHookPhase || (t.TransitionHookPhase = {}))[Bt.CREATE = 0] = "CREATE", 
    Bt[Bt.BEFORE = 1] = "BEFORE", Bt[Bt.RUN = 2] = "RUN", Bt[Bt.SUCCESS = 3] = "SUCCESS", 
    Bt[Bt.ERROR = 4] = "ERROR", (Gt = t.TransitionHookScope || (t.TransitionHookScope = {}))[Gt.TRANSITION = 0] = "TRANSITION", 
    Gt[Gt.STATE = 1] = "STATE";
    var Yt = function() {
        function t(t, e, r, n) {
            this._stateRegistry = t, this._identifier = e, this._identifier = e, this._params = G({}, r || {}), 
            this._options = G({}, n || {}), this._definition = t.matcher.find(e, this._options.relative);
        }
        return t.prototype.name = function() {
            return this._definition && this._definition.name || this._identifier;
        }, t.prototype.identifier = function() {
            return this._identifier;
        }, t.prototype.params = function() {
            return this._params;
        }, t.prototype.$state = function() {
            return this._definition;
        }, t.prototype.state = function() {
            return this._definition && this._definition.self;
        }, t.prototype.options = function() {
            return this._options;
        }, t.prototype.exists = function() {
            return !(!this._definition || !this._definition.self);
        }, t.prototype.valid = function() {
            return !this.error();
        }, t.prototype.error = function() {
            var t = this.options().relative;
            if (!this._definition && t) {
                var e = t.name ? t.name : t;
                return "Could not resolve '" + this.name() + "' from state '" + e + "'";
            }
            return this._definition ? this._definition.self ? void 0 : "State '" + this.name() + "' has an invalid definition" : "No such state '" + this.name() + "'";
        }, t.prototype.toString = function() {
            return "'" + this.name() + "'" + ke(this.params());
        }, t.prototype.withState = function(e) {
            return new t(this._stateRegistry, e, this._params, this._options);
        }, t.prototype.withParams = function(e, r) {
            void 0 === r && (r = !1);
            var n = r ? e : G({}, this._params, e);
            return new t(this._stateRegistry, this._identifier, n, this._options);
        }, t.prototype.withOptions = function(e, r) {
            void 0 === r && (r = !1);
            var n = r ? e : G({}, this._options, e);
            return new t(this._stateRegistry, this._identifier, this._params, n);
        }, t.isDef = function(t) {
            return t && t.state && (O(t.state) || O(t.state.name));
        }, t;
    }(), Zt = {
        current: J,
        transition: null,
        traceData: {},
        bind: null
    }, Xt = function() {
        function e(e, r, n, i) {
            var o = this;
            this.transition = e, this.stateContext = r, this.registeredHook = n, this.options = i, 
            this.isSuperseded = function() {
                return o.type.hookPhase === t.TransitionHookPhase.RUN && !o.options.transition.isActive();
            }, this.options = it(i, Zt), this.type = n.eventType;
        }
        return e.chain = function(t, e) {
            return t.reduce(function(t, e) {
                return t.then(function() {
                    return e.invokeHook();
                });
            }, e || N.$q.when());
        }, e.invokeHooks = function(t, r) {
            for (var n = 0; n < t.length; n++) {
                var i = t[n].invokeHook();
                if (D(i)) {
                    var o = t.slice(n + 1);
                    return e.chain(o, i).then(r);
                }
            }
            return r();
        }, e.runAllHooks = function(t) {
            t.forEach(function(t) {
                return t.invokeHook();
            });
        }, e.prototype.logError = function(t) {
            this.transition.router.stateService.defaultErrorHandler()(t);
        }, e.prototype.invokeHook = function() {
            var t = this, e = this.registeredHook;
            if (!e._deregistered) {
                var r = this.getNotCurrentRejection();
                if (r) return r;
                var n = this.options;
                Kt.traceHookInvocation(this, this.transition, n);
                var i = function(r) {
                    return e.eventType.getErrorHandler(t)(r);
                }, o = function(r) {
                    return e.eventType.getResultHandler(t)(r);
                };
                try {
                    var a = e.callback.call(n.bind, t.transition, t.stateContext);
                    return !this.type.synchronous && D(a) ? a.catch(function(t) {
                        return qt.normalize(t).toPromise();
                    }).then(o, i) : o(a);
                } catch (t) {
                    return i(qt.normalize(t));
                } finally {
                    e.invokeLimit && ++e.invokeCount >= e.invokeLimit && e.deregister();
                }
            }
        }, e.prototype.handleHookResult = function(t) {
            var e = this;
            return this.getNotCurrentRejection() || (D(t) ? t.then(function(t) {
                return e.handleHookResult(t);
            }) : (Kt.traceHookResult(t, this.transition, this.options), !1 === t ? qt.aborted("Hook aborted transition").toPromise() : d(Yt)(t) ? qt.redirected(t).toPromise() : void 0));
        }, e.prototype.getNotCurrentRejection = function() {
            var t = this.transition.router;
            return t._disposed ? qt.aborted("UIRouter instance #" + t.$id + " has been stopped (disposed)").toPromise() : this.transition._aborted ? qt.aborted().toPromise() : this.isSuperseded() ? qt.superseded(this.options.current()).toPromise() : void 0;
        }, e.prototype.toString = function() {
            var t = this.options, e = this.registeredHook;
            return (c("traceData.hookType")(t) || "internal") + " context: " + (c("traceData.context.state.name")(t) || c("traceData.context")(t) || "unknown") + ", " + Se(200, Ce(e.callback));
        }, e.HANDLE_RESULT = function(t) {
            return function(e) {
                return t.handleHookResult(e);
            };
        }, e.LOG_REJECTED_RESULT = function(t) {
            return function(e) {
                D(e) && e.catch(function(e) {
                    return t.logError(qt.normalize(e));
                });
            };
        }, e.LOG_ERROR = function(t) {
            return function(e) {
                return t.logError(e);
            };
        }, e.REJECT_ERROR = function(t) {
            return function(t) {
                return At(t);
            };
        }, e.THROW_ERROR = function(t) {
            return function(t) {
                throw t;
            };
        }, e;
    }();
    function te(t, e) {
        var r = O(e) ? [ e ] : e;
        return !!(P(r) ? r : function(t) {
            for (var e = r, n = 0; n < e.length; n++) {
                var i = new w(e[n]);
                if (i && i.matches(t.name) || !i && e[n] === t.name) return !0;
            }
            return !1;
        })(t);
    }
    var ee = function() {
        function e(t, e, r, n, i, o) {
            void 0 === o && (o = {}), this.tranSvc = t, this.eventType = e, this.callback = r, 
            this.matchCriteria = n, this.removeHookFromRegistry = i, this.invokeCount = 0, this._deregistered = !1, 
            this.priority = o.priority || 0, this.bind = o.bind || null, this.invokeLimit = o.invokeLimit;
        }
        return e.prototype._matchingNodes = function(t, e) {
            if (!0 === e) return t;
            var r = t.filter(function(t) {
                return te(t.state, e);
            });
            return r.length ? r : null;
        }, e.prototype._getDefaultMatchCriteria = function() {
            return ht(this.tranSvc._pluginapi._getPathTypes(), function() {
                return !0;
            });
        }, e.prototype._getMatchingNodes = function(e) {
            var r = this, n = G(this._getDefaultMatchCriteria(), this.matchCriteria);
            return vt(this.tranSvc._pluginapi._getPathTypes()).reduce(function(i, o) {
                var a = o.scope === t.TransitionHookScope.STATE, u = e[o.name] || [], s = a ? u : [ kt(u) ];
                return i[o.name] = r._matchingNodes(s, n[o.name]), i;
            }, {});
        }, e.prototype.matches = function(t) {
            var e = this._getMatchingNodes(t);
            return vt(e).every(z) ? e : null;
        }, e.prototype.deregister = function() {
            this.removeHookFromRegistry(this), this._deregistered = !0;
        }, e;
    }();
    function re(t, e, r) {
        var n = (t._registeredHooks = t._registeredHooks || {})[r.name] = [], i = X(n);
        function o(t, o, a) {
            void 0 === a && (a = {});
            var u = new ee(e, r, o, t, i, a);
            return n.push(u), u.deregister.bind(u);
        }
        return t[r.name] = o;
    }
    var oe, ne = function() {
        function e(t) {
            this.transition = t;
        }
        return e.prototype.buildHooksForPhase = function(t) {
            var e = this;
            return this.transition.router.transitionService._pluginapi._getEvents(t).map(function(t) {
                return e.buildHooks(t);
            }).reduce(yt, []).filter(z);
        }, e.prototype.buildHooks = function(e) {
            var r = this.transition, n = r.treeChanges(), i = this.getMatchingHooks(e, n);
            if (!i) return [];
            var o = {
                transition: r,
                current: r.options().current
            };
            return i.map(function(i) {
                return i.matches(n)[e.criteriaMatchPath.name].map(function(n) {
                    var a = G({
                        bind: i.bind,
                        traceData: {
                            hookType: e.name,
                            context: n
                        }
                    }, o), u = e.criteriaMatchPath.scope === t.TransitionHookScope.STATE ? n.state.self : null, s = new Xt(r, u, i, a);
                    return {
                        hook: i,
                        node: n,
                        transitionHook: s
                    };
                });
            }).reduce(yt, []).sort(function(t) {
                return void 0 === t && (t = !1), function(e, r) {
                    var n = t ? -1 : 1, i = (e.node.state.path.length - r.node.state.path.length) * n;
                    return 0 !== i ? i : r.hook.priority - e.hook.priority;
                };
            }(e.reverseSort)).map(function(t) {
                return t.transitionHook;
            });
        }, e.prototype.getMatchingHooks = function(e, r) {
            var n = e.hookPhase === t.TransitionHookPhase.CREATE, i = this.transition.router.transitionService;
            return (n ? [ i ] : [ this.transition, i ]).map(function(t) {
                return t.getHooks(e.name);
            }).filter(bt(V, "broken event named: " + e.name)).reduce(yt, []).filter(function(t) {
                return t.matches(r);
            });
        }, e;
    }(), ie = function() {
        function t(t) {
            this.pattern = /.*/, this.inherit = !0, G(this, t);
        }
        return t.prototype.is = function(t, e) {
            return !0;
        }, t.prototype.encode = function(t, e) {
            return t;
        }, t.prototype.decode = function(t, e) {
            return t;
        }, t.prototype.equals = function(t, e) {
            return t == e;
        }, t.prototype.$subPattern = function() {
            var t = this.pattern.toString();
            return t.substr(1, t.length - 2);
        }, t.prototype.toString = function() {
            return "{ParamType:" + this.name + "}";
        }, t.prototype.$normalize = function(t) {
            return this.is(t) ? t : this.decode(t);
        }, t.prototype.$asArray = function(t, e) {
            if (!t) return this;
            if ("auto" === t && !e) throw new Error("'auto' array mode is for query parameters only");
            return new function(t, e) {
                var r = this;
                function n(t) {
                    return V(t) ? t : E(t) ? [ t ] : [];
                }
                function i(t, r) {
                    return function(i) {
                        if (V(i) && 0 === i.length) return i;
                        var a = pt(n(i), t);
                        return !0 === r ? 0 === ft(a, function(t) {
                            return !t;
                        }).length : function(t) {
                            switch (t.length) {
                              case 0:
                                return;

                              case 1:
                                return "auto" === e ? t[0] : t;

                              default:
                                return t;
                            }
                        }(a);
                    };
                }
                function o(t) {
                    return function(e, r) {
                        var i = n(e), o = n(r);
                        if (i.length !== o.length) return !1;
                        for (var a = 0; a < i.length; a++) if (!t(i[a], o[a])) return !1;
                        return !0;
                    };
                }
                [ "encode", "decode", "equals", "$normalize" ].forEach(function(e) {
                    var n = t[e].bind(t), a = "equals" === e ? o : i;
                    r[e] = a(n);
                }), G(this, {
                    dynamic: t.dynamic,
                    name: t.name,
                    pattern: t.pattern,
                    inherit: t.inherit,
                    is: i(t.is.bind(t), !0),
                    $arrayMode: e
                });
            }(this, t);
        }, t;
    }(), ae = Object.prototype.hasOwnProperty, ue = function(t) {
        return 0 === [ "value", "type", "squash", "array", "dynamic" ].filter(ae.bind(t || {})).length;
    };
    (oe = t.DefType || (t.DefType = {}))[oe.PATH = 0] = "PATH", oe[oe.SEARCH = 1] = "SEARCH", 
    oe[oe.CONFIG = 2] = "CONFIG";
    var se = function() {
        function e(e, r, n, i, o) {
            r = function(e, r, n, i, o) {
                if (e.type && r && "string" !== r.name) throw new Error("Param '" + i + "' has two type configurations.");
                if (e.type && r && "string" === r.name && o.type(e.type)) return o.type(e.type);
                if (r) return r;
                if (!e.type) {
                    var a = n === t.DefType.CONFIG ? "any" : n === t.DefType.PATH ? "path" : n === t.DefType.SEARCH ? "query" : "string";
                    return o.type(a);
                }
                return e.type instanceof ie ? e.type : o.type(e.type);
            }(n = function(t) {
                function e() {
                    return t.value;
                }
                return t = ue(t) && {
                    value: t
                } || t, e.__cacheable = !0, G(t, {
                    $$fn: H(t.value) ? t.value : e
                });
            }(n), r, i, e, o.paramTypes);
            var a, s, c = (a = {
                array: i === t.DefType.SEARCH && "auto"
            }, s = e.match(/\[\]$/) ? {
                array: !0
            } : {}, G(a, s, n).array);
            r = c ? r.$asArray(c, i === t.DefType.SEARCH) : r;
            var f = void 0 !== n.value || i === t.DefType.SEARCH, l = E(n.dynamic) ? !!n.dynamic : !!r.dynamic, h = E(n.raw) ? !!n.raw : !!r.raw, p = function(t, e, r) {
                var n = t.squash;
                if (!e || !1 === n) return !1;
                if (!E(n) || null == n) return r;
                if (!0 === n || O(n)) return n;
                throw new Error("Invalid squash policy: '" + n + "'. Valid policies: false, true, or arbitrary string");
            }(n, f, o.defaultSquashPolicy()), v = function(t, e, r, n) {
                var i = [ {
                    from: "",
                    to: f || c ? void 0 : ""
                }, {
                    from: null,
                    to: f || c ? void 0 : ""
                } ], o = V(t.replace) ? t.replace : [];
                O(n) && o.push({
                    from: n,
                    to: void 0
                });
                var a = pt(o, u("from"));
                return ft(i, function(t) {
                    return -1 === a.indexOf(t.from);
                }).concat(o);
            }(n, 0, 0, p), d = E(n.inherit) ? !!n.inherit : !!r.inherit;
            G(this, {
                id: e,
                type: r,
                location: i,
                isOptional: f,
                dynamic: l,
                raw: h,
                squash: p,
                replace: v,
                inherit: d,
                array: c,
                config: n
            });
        }
        return e.values = function(t, e) {
            void 0 === e && (e = {});
            for (var r = {}, n = 0, i = t; n < i.length; n++) {
                var o = i[n];
                r[o.id] = o.value(e[o.id]);
            }
            return r;
        }, e.changed = function(t, e, r) {
            return void 0 === e && (e = {}), void 0 === r && (r = {}), t.filter(function(t) {
                return !t.type.equals(e[t.id], r[t.id]);
            });
        }, e.equals = function(t, r, n) {
            return void 0 === r && (r = {}), void 0 === n && (n = {}), 0 === e.changed(t, r, n).length;
        }, e.validates = function(t, e) {
            return void 0 === e && (e = {}), t.map(function(t) {
                return t.validates(e[t.id]);
            }).reduce(dt, !0);
        }, e.prototype.isDefaultValue = function(t) {
            return this.isOptional && this.type.equals(this.value(), t);
        }, e.prototype.value = function(t) {
            var e = this;
            return t = function(t) {
                for (var r = 0, n = e.replace; r < n.length; r++) {
                    var i = n[r];
                    if (i.from === t) return i.to;
                }
                return t;
            }(t), R(t) ? function() {
                if (e._defaultValueCache) return e._defaultValueCache.defaultValue;
                if (!N.$injector) throw new Error("Injectable functions cannot be called at configuration time");
                var t = N.$injector.invoke(e.config.$$fn);
                if (null != t && !e.type.is(t)) throw new Error("Default value (" + t + ") for parameter '" + e.id + "' is not an instance of ParamType (" + e.type.name + ")");
                return e.config.$$fn.__cacheable && (e._defaultValueCache = {
                    defaultValue: t
                }), t;
            }() : this.type.$normalize(t);
        }, e.prototype.isSearch = function() {
            return this.location === t.DefType.SEARCH;
        }, e.prototype.validates = function(t) {
            if ((R(t) || null === t) && this.isOptional) return !0;
            var e = this.type.$normalize(t);
            if (!this.type.is(e)) return !1;
            var r = this.type.encode(e);
            return !(O(r) && !this.type.pattern.exec(r));
        }, e.prototype.toString = function() {
            return "{Param:" + this.id + " " + this.type + " squash: '" + this.squash + "' optional: " + this.isOptional + "}";
        }, e;
    }(), ce = function() {
        function t(e) {
            if (e instanceof t) {
                var r = e;
                this.state = r.state, this.paramSchema = r.paramSchema.slice(), this.paramValues = G({}, r.paramValues), 
                this.resolvables = r.resolvables.slice(), this.views = r.views && r.views.slice();
            } else {
                var n = e;
                this.state = n, this.paramSchema = n.parameters({
                    inherit: !1
                }), this.paramValues = {}, this.resolvables = n.resolvables.map(function(t) {
                    return t.clone();
                });
            }
        }
        return t.prototype.clone = function() {
            return new t(this);
        }, t.prototype.applyRawParams = function(t) {
            return this.paramValues = this.paramSchema.reduce(function(e, r) {
                return Pt(e, [ (n = r).id, n.value(t[n.id]) ]);
                var n;
            }, {}), this;
        }, t.prototype.parameter = function(t) {
            return lt(this.paramSchema, s("id", t));
        }, t.prototype.equals = function(t, e) {
            var r = this.diff(t, e);
            return r && 0 === r.length;
        }, t.prototype.diff = function(t, e) {
            if (this.state !== t.state) return !1;
            var r = e ? e(this) : this.paramSchema;
            return se.changed(r, this.paramValues, t.paramValues);
        }, t.clone = function(t) {
            return t.clone();
        }, t;
    }(), fe = function() {
        function t() {}
        return t.makeTargetState = function(t, e) {
            var r = kt(e).state;
            return new Yt(t, r, e.map(u("paramValues")).reduce(ot, {}), {});
        }, t.buildPath = function(t) {
            var e = t.params();
            return t.$state().path.map(function(t) {
                return new ce(t).applyRawParams(e);
            });
        }, t.buildToPath = function(e, r) {
            var n = t.buildPath(r);
            return r.options().inherit ? t.inheritParams(e, n, Object.keys(r.params())) : n;
        }, t.applyViewConfigs = function(e, r, n) {
            r.filter(function(t) {
                return Y(n, t.state);
            }).forEach(function(n) {
                var i = vt(n.state.views || {}), o = t.subPath(r, function(t) {
                    return t === n;
                }), a = i.map(function(t) {
                    return e.createViewConfig(o, t);
                });
                n.views = a.reduce(yt, []);
            });
        }, t.inheritParams = function(t, e, r) {
            void 0 === r && (r = []);
            var n = t.map(function(t) {
                return t.paramSchema;
            }).reduce(yt, []).filter(function(t) {
                return !t.inherit;
            }).map(u("id"));
            return e.map(function(e) {
                var i = G({}, e && e.paramValues), o = ut(i, r);
                i = st(i, r);
                var a, u, c, f = st((a = t, u = e.state, c = lt(a, s("state", u)), G({}, c && c.paramValues) || {}), n), l = G(i, f, o);
                return new ce(e.state).applyRawParams(l);
            });
        }, t.treeChanges = function(e, r, n) {
            for (var i, o, a, u, s, c, f = Math.min(e.length, r.length), l = 0; l < f && e[l].state !== n && (i = e[l], 
            o = r[l], i.equals(o, t.nonDynamicParams)); ) l++;
            u = (a = e).slice(0, l), s = a.slice(l);
            var h = u.map(function(t, e) {
                var n = t.clone();
                return n.paramValues = r[e].paramValues, n;
            });
            return c = r.slice(l), {
                from: a,
                to: h.concat(c),
                retained: u,
                retainedWithToParams: h,
                exiting: s,
                entering: c
            };
        }, t.matching = function(t, e, r) {
            var n = !1;
            return Tt(t, e).reduce(function(t, e) {
                var i = e[0], o = e[1];
                return (n = n || !i.equals(o, r)) ? t : t.concat(i);
            }, []);
        }, t.equals = function(e, r, n) {
            return e.length === r.length && t.matching(e, r, n).length === e.length;
        }, t.subPath = function(t, e) {
            var r = lt(t, e), n = t.indexOf(r);
            return -1 === n ? void 0 : t.slice(0, n + 1);
        }, t.nonDynamicParams = function(t) {
            return t.state.parameters({
                inherit: !1
            }).filter(function(t) {
                return !t.dynamic;
            });
        }, t.paramValues = function(t) {
            return t.reduce(function(t, e) {
                return G(t, e.paramValues);
            }, {});
        }, t;
    }(), le = {
        when: "LAZY",
        async: "WAIT"
    }, he = function() {
        function t(e, r, n, i, o) {
            if (this.resolved = !1, this.promise = void 0, e instanceof t) G(this, e); else if (P(r)) {
                if (T(e)) throw new Error("new Resolvable(): token argument is required");
                if (!P(r)) throw new Error("new Resolvable(): resolveFn argument must be a function");
                this.token = e, this.policy = i, this.resolveFn = r, this.deps = n || [], this.data = o, 
                this.resolved = void 0 !== o, this.promise = this.resolved ? N.$q.when(this.data) : void 0;
            } else if (x(e) && e.token && (e.hasOwnProperty("resolveFn") || e.hasOwnProperty("data"))) {
                var a = e;
                return new t(a.token, a.resolveFn, a.deps, a.policy, a.data);
            }
        }
        return t.prototype.getPolicy = function(t) {
            var e = this.policy || {}, r = t && t.resolvePolicy || {};
            return {
                when: e.when || r.when || le.when,
                async: e.async || r.async || le.async
            };
        }, t.prototype.resolve = function(t, e) {
            var r = this, n = N.$q, i = t.findNode(this), o = i && i.state, a = "RXWAIT" === this.getPolicy(o).async ? function(t) {
                var e = t.cache(1);
                return e.take(1).toPromise().then(function() {
                    return e;
                });
            } : z;
            return this.promise = n.when().then(function() {
                return n.all(t.getDependencies(r).map(function(r) {
                    return r.get(t, e);
                }));
            }).then(function(t) {
                return r.resolveFn.apply(null, t);
            }).then(a).then(function(t) {
                return r.data = t, r.resolved = !0, r.resolveFn = null, Kt.traceResolvableResolved(r, e), 
                r.data;
            });
        }, t.prototype.get = function(t, e) {
            return this.promise || this.resolve(t, e);
        }, t.prototype.toString = function() {
            return "Resolvable(token: " + ke(this.token) + ", requires: [" + this.deps.map(ke) + "])";
        }, t.prototype.clone = function() {
            return new t(this);
        }, t.fromData = function(e, r) {
            return new t(e, function() {
                return r;
            }, null, null, r);
        }, t;
    }(), pe = {
        when: {
            LAZY: "LAZY",
            EAGER: "EAGER"
        },
        async: {
            WAIT: "WAIT",
            NOWAIT: "NOWAIT",
            RXWAIT: "RXWAIT"
        }
    }, ve = pe.when, de = [ ve.EAGER, ve.LAZY ], me = [ ve.EAGER ], ye = "Native Injector", ge = function() {
        function t(t) {
            this._path = t;
        }
        return t.prototype.getTokens = function() {
            return this._path.reduce(function(t, e) {
                return t.concat(e.resolvables.map(function(t) {
                    return t.token;
                }));
            }, []).reduce(wt, []);
        }, t.prototype.getResolvable = function(t) {
            return kt(this._path.map(function(t) {
                return t.resolvables;
            }).reduce(yt, []).filter(function(e) {
                return e.token === t;
            }));
        }, t.prototype.getPolicy = function(t) {
            var e = this.findNode(t);
            return t.getPolicy(e.state);
        }, t.prototype.subContext = function(e) {
            return new t(fe.subPath(this._path, function(t) {
                return t.state === e;
            }));
        }, t.prototype.addResolvables = function(t, e) {
            var r = lt(this._path, s("state", e)), n = t.map(function(t) {
                return t.token;
            });
            r.resolvables = r.resolvables.filter(function(t) {
                return -1 === n.indexOf(t.token);
            }).concat(t);
        }, t.prototype.resolvePath = function(t, e) {
            var r = this;
            void 0 === t && (t = "LAZY");
            var n = (Y(de, t) ? t : "LAZY") === pe.when.EAGER ? me : de;
            Kt.traceResolvePath(this._path, t, e);
            var i = function(t, e) {
                return function(n) {
                    return Y(t, r.getPolicy(n)[e]);
                };
            }, o = this._path.reduce(function(t, o) {
                var a = o.resolvables.filter(i(n, "when")), u = a.filter(i([ "NOWAIT" ], "async")), s = a.filter(f(i([ "NOWAIT" ], "async"))), c = r.subContext(o.state), l = function(t) {
                    return t.get(c, e).then(function(e) {
                        return {
                            token: t.token,
                            value: e
                        };
                    });
                };
                return u.forEach(l), t.concat(s.map(l));
            }, []);
            return N.$q.all(o);
        }, t.prototype.injector = function() {
            return this._injector || (this._injector = new _e(this));
        }, t.prototype.findNode = function(t) {
            return lt(this._path, function(e) {
                return Y(e.resolvables, t);
            });
        }, t.prototype.getDependencies = function(t) {
            var e = this, r = this.findNode(t), n = (fe.subPath(this._path, function(t) {
                return t === r;
            }) || this._path).reduce(function(t, e) {
                return t.concat(e.resolvables);
            }, []).filter(function(e) {
                return e !== t;
            });
            return t.deps.map(function(t) {
                var r = n.filter(function(e) {
                    return e.token === t;
                });
                if (r.length) return kt(r);
                var i = e.injector().getNative(t);
                if (R(i)) throw new Error("Could not find Dependency Injection token: " + ke(t));
                return new he(t, function() {
                    return i;
                }, [], i);
            });
        }, t;
    }(), _e = function() {
        function t(t) {
            this.context = t, this.native = this.get(ye) || N.$injector;
        }
        return t.prototype.get = function(t) {
            var e = this.context.getResolvable(t);
            if (e) {
                if ("NOWAIT" === this.context.getPolicy(e).async) return e.get(this.context);
                if (!e.resolved) throw new Error("Resolvable async .get() not complete:" + ke(e.token));
                return e.data;
            }
            return this.getNative(t);
        }, t.prototype.getAsync = function(t) {
            var e = this.context.getResolvable(t);
            return e ? e.get(this.context) : N.$q.when(this.native.get(t));
        }, t.prototype.getNative = function(t) {
            return this.native && this.native.get(t);
        }, t;
    }(), we = u("self"), $e = function() {
        function e(e, r, n) {
            var i = this;
            if (this._deferred = N.$q.defer(), this.promise = this._deferred.promise, this._registeredHooks = {}, 
            this._hookBuilder = new ne(this), this.isActive = function() {
                return i.router.globals.transition === i;
            }, this.router = n, !(this._targetState = r).valid()) throw new Error(r.error());
            this._options = G({
                current: y(this)
            }, r.options()), this.$id = n.transitionService._transitionCount++;
            var o = fe.buildToPath(e, r);
            this._treeChanges = fe.treeChanges(e, o, this._options.reloadState), this.createTransitionHookRegFns();
            var a = this._hookBuilder.buildHooksForPhase(t.TransitionHookPhase.CREATE);
            Xt.invokeHooks(a, function() {
                return null;
            }), this.applyViewConfigs(n);
        }
        return e.prototype.onBefore = function(t, e, r) {}, e.prototype.onStart = function(t, e, r) {}, 
        e.prototype.onExit = function(t, e, r) {}, e.prototype.onRetain = function(t, e, r) {}, 
        e.prototype.onEnter = function(t, e, r) {}, e.prototype.onFinish = function(t, e, r) {}, 
        e.prototype.onSuccess = function(t, e, r) {}, e.prototype.onError = function(t, e, r) {}, 
        e.prototype.createTransitionHookRegFns = function() {
            var e = this;
            this.router.transitionService._pluginapi._getEvents().filter(function(e) {
                return e.hookPhase !== t.TransitionHookPhase.CREATE;
            }).forEach(function(t) {
                return re(e, e.router.transitionService, t);
            });
        }, e.prototype.getHooks = function(t) {
            return this._registeredHooks[t];
        }, e.prototype.applyViewConfigs = function(t) {
            var e = this._treeChanges.entering.map(function(t) {
                return t.state;
            });
            fe.applyViewConfigs(t.transitionService.$view, this._treeChanges.to, e);
        }, e.prototype.$from = function() {
            return kt(this._treeChanges.from).state;
        }, e.prototype.$to = function() {
            return kt(this._treeChanges.to).state;
        }, e.prototype.from = function() {
            return this.$from().self;
        }, e.prototype.to = function() {
            return this.$to().self;
        }, e.prototype.targetState = function() {
            return this._targetState;
        }, e.prototype.is = function(t) {
            return t instanceof e ? this.is({
                to: t.$to().name,
                from: t.$from().name
            }) : !(t.to && !te(this.$to(), t.to) || t.from && !te(this.$from(), t.from));
        }, e.prototype.params = function(t) {
            return void 0 === t && (t = "to"), Object.freeze(this._treeChanges[t].map(u("paramValues")).reduce(ot, {}));
        }, e.prototype.injector = function(t, e) {
            void 0 === e && (e = "to");
            var r = this._treeChanges[e];
            return t && (r = fe.subPath(r, function(e) {
                return e.state === t || e.state.name === t;
            })), new ge(r).injector();
        }, e.prototype.getResolveTokens = function(t) {
            return void 0 === t && (t = "to"), new ge(this._treeChanges[t]).getTokens();
        }, e.prototype.addResolvable = function(t, e) {
            void 0 === e && (e = ""), t = d(he)(t) ? t : new he(t);
            var r = "string" == typeof e ? e : e.name, n = this._treeChanges.to, i = lt(n, function(t) {
                return t.state.name === r;
            });
            new ge(n).addResolvables([ t ], i.state);
        }, e.prototype.redirectedFrom = function() {
            return this._options.redirectedFrom || null;
        }, e.prototype.originalTransition = function() {
            var t = this.redirectedFrom();
            return t && t.originalTransition() || this;
        }, e.prototype.options = function() {
            return this._options;
        }, e.prototype.entering = function() {
            return pt(this._treeChanges.entering, u("state")).map(we);
        }, e.prototype.exiting = function() {
            return pt(this._treeChanges.exiting, u("state")).map(we).reverse();
        }, e.prototype.retained = function() {
            return pt(this._treeChanges.retained, u("state")).map(we);
        }, e.prototype.views = function(t, e) {
            void 0 === t && (t = "entering");
            var r = this._treeChanges[t];
            return (r = e ? r.filter(s("state", e)) : r).map(u("views")).filter(z).reduce(yt, []);
        }, e.prototype.treeChanges = function(t) {
            return t ? this._treeChanges[t] : this._treeChanges;
        }, e.prototype.redirect = function(t) {
            for (var e = 1, r = this; null != (r = r.redirectedFrom()); ) if (20 < ++e) throw new Error("Too many consecutive Transition redirects (20+)");
            var n = {
                redirectedFrom: this,
                source: "redirect"
            };
            "url" === this.options().source && !1 !== t.options().location && (n.location = "replace");
            var i = G({}, this.options(), t.options(), n);
            t = t.withOptions(i, !0);
            var o, a = this.router.transitionService.create(this._treeChanges.from, t), u = this._treeChanges.entering, s = a._treeChanges.entering;
            return fe.matching(s, u, fe.nonDynamicParams).filter(f((o = t.options().reloadState, 
            function(t) {
                return o && t.state.includes[o.name];
            }))).forEach(function(t, e) {
                t.resolvables = u[e].resolvables;
            }), a;
        }, e.prototype._changedParams = function() {
            var t = this._treeChanges;
            if (!(this._options.reload || t.exiting.length || t.entering.length || t.to.length !== t.from.length || Tt(t.to, t.from).map(function(t) {
                return t[0].state !== t[1].state;
            }).reduce(mt, !1))) {
                var e = t.to.map(function(t) {
                    return t.paramSchema;
                }), r = [ t.to, t.from ].map(function(t) {
                    return t.map(function(t) {
                        return t.paramValues;
                    });
                });
                return Tt(e, r[0], r[1]).map(function(t) {
                    var e = t[0], r = t[1], n = t[2];
                    return se.changed(e, r, n);
                }).reduce(yt, []);
            }
        }, e.prototype.dynamic = function() {
            var t = this._changedParams();
            return !!t && t.map(function(t) {
                return t.dynamic;
            }).reduce(mt, !1);
        }, e.prototype.ignored = function() {
            return !!this._ignoredReason();
        }, e.prototype._ignoredReason = function() {
            var t = this.router.globals.transition, e = this._options.reloadState, r = function(t, r) {
                if (t.length !== r.length) return !1;
                var n = fe.matching(t, r);
                return t.length === n.filter(function(t) {
                    return !e || !t.state.includes[e.name];
                }).length;
            }, n = this.treeChanges(), i = t && t.treeChanges();
            return i && r(i.to, n.to) && r(i.exiting, n.exiting) ? "SameAsPending" : 0 === n.exiting.length && 0 === n.entering.length && r(n.from, n.to) ? "SameAsCurrent" : void 0;
        }, e.prototype.run = function() {
            var e = this, r = Xt.runAllHooks, n = function(t) {
                return e._hookBuilder.buildHooksForPhase(t);
            }, i = n(t.TransitionHookPhase.BEFORE);
            return Xt.invokeHooks(i, function() {
                var t = e.router.globals;
                return t.lastStartedTransitionId = e.$id, t.transition = e, t.transitionHistory.enqueue(e), 
                Kt.traceTransitionStart(e), N.$q.when(void 0);
            }).then(function() {
                var e = n(t.TransitionHookPhase.RUN);
                return Xt.invokeHooks(e, function() {
                    return N.$q.when(void 0);
                });
            }).then(function() {
                Kt.traceSuccess(e.$to(), e), e.success = !0, e._deferred.resolve(e.to()), r(n(t.TransitionHookPhase.SUCCESS));
            }, function(i) {
                Kt.traceError(i, e), e.success = !1, e._deferred.reject(i), e._error = i, r(n(t.TransitionHookPhase.ERROR));
            }), this.promise;
        }, e.prototype.valid = function() {
            return !this.error() || void 0 !== this.success;
        }, e.prototype.abort = function() {
            R(this.success) && (this._aborted = !0);
        }, e.prototype.error = function() {
            var t = this.$to();
            if (t.self.abstract) return qt.invalid("Cannot transition to abstract state '" + t.name + "'");
            var e = t.parameters(), r = this.params(), n = e.filter(function(t) {
                return !t.validates(r[t.id]);
            });
            if (n.length) {
                var i = n.map(function(t) {
                    return "[" + t.id + ":" + ke(r[t.id]) + "]";
                }).join(", "), o = "The following parameter values are not valid for state '" + t.name + "': " + i;
                return qt.invalid(o);
            }
            return !1 === this.success ? this._error : void 0;
        }, e.prototype.toString = function() {
            var t = this.from(), e = this.to(), r = function(t) {
                return null !== t["#"] && void 0 !== t["#"] ? t : st(t, [ "#" ]);
            };
            return "Transition#" + this.$id + "( '" + (x(t) ? t.name : t) + "'" + ke(r(this._treeChanges.from.map(u("paramValues")).reduce(ot, {}))) + " -> " + (this.valid() ? "" : "(X) ") + "'" + (x(e) ? e.name : e) + "'" + ke(r(this.params())) + " )";
        }, e.diToken = e;
    }();
    function Se(t, e) {
        return e.length <= t ? e : e.substr(0, t - 3) + "...";
    }
    function be(t, e) {
        for (;e.length < t; ) e += " ";
        return e;
    }
    function Re(t) {
        return t.replace(/^([A-Z])/, function(t) {
            return t.toLowerCase();
        }).replace(/([A-Z])/g, function(t) {
            return "-" + t.toLowerCase();
        });
    }
    function Ee(t) {
        var e = Ce(t), r = e.match(/^(function [^ ]+\([^)]*\))/), n = r ? r[1] : e, i = t.name || "";
        return i && n.match(/function \(/) ? "function " + i + n.substr(9) : n;
    }
    function Ce(t) {
        var e = V(t) ? t.slice(-1)[0] : t;
        return e && e.toString() || "undefined";
    }
    var Te = null, Pe = function(t) {
        var e = qt.isRejectionPromise;
        return (Te = Te || _([ [ f(E), y("undefined") ], [ C, y("null") ], [ D, y("[Promise]") ], [ e, function(t) {
            return t._transitionRejection.toString();
        } ], [ d(qt), g("toString") ], [ d($e), g("toString") ], [ d(he), g("toString") ], [ H, Ee ], [ y(!0), z ] ]))(t);
    };
    function ke(t) {
        var e = [];
        return JSON.stringify(t, function(t, r) {
            return function(t) {
                if (x(t)) {
                    if (-1 !== e.indexOf(t)) return "[circular ref]";
                    e.push(t);
                }
                return Pe(t);
            }(r);
        }).replace(/\\"/g, '"');
    }
    var Oe = function(t) {
        return function(e) {
            if (!e) return [ "", "" ];
            var r = e.indexOf(t);
            return -1 === r ? [ e, "" ] : [ e.substr(0, r), e.substr(r + 1) ];
        };
    }, xe = new RegExp("^(?:[a-z]+:)?//[^/]+/"), Ve = function(t) {
        return t.replace(/\/[^/]*$/, "");
    }, Ie = Oe("#"), je = Oe("?"), Ae = Oe("="), He = function(t) {
        return t ? t.replace(/^#/, "") : "";
    };
    function De(t) {
        var e = new RegExp("(" + t + ")", "g");
        return function(t) {
            return t.split(e).filter(z);
        };
    }
    function qe(t, e) {
        return O(kt(t)) && O(e) ? t.slice(0, -1).concat(kt(t) + e) : _t(t, e);
    }
    var Ne, Fe = function() {
        function t() {
            this.enqueue = !0, this.typeQueue = [], this.defaultTypes = ut(t.prototype, [ "hash", "string", "query", "path", "int", "bool", "date", "json", "any" ]), 
            this.types = K(pt(this.defaultTypes, function(t, e) {
                return new ie(G({
                    name: e
                }, t));
            }), {});
        }
        return t.prototype.dispose = function() {
            this.types = {};
        }, t.prototype.type = function(t, e, r) {
            if (!E(e)) return this.types[t];
            if (this.types.hasOwnProperty(t)) throw new Error("A type named '" + t + "' has already been defined.");
            return this.types[t] = new ie(G({
                name: t
            }, e)), r && (this.typeQueue.push({
                name: t,
                def: r
            }), this.enqueue || this._flushTypeQueue()), this;
        }, t.prototype._flushTypeQueue = function() {
            for (;this.typeQueue.length; ) {
                var t = this.typeQueue.shift();
                if (t.pattern) throw new Error("You cannot override a type's .pattern at runtime.");
                G(this.types[t.name], N.$injector.invoke(t.def));
            }
        }, t;
    }();
    Ne = function(t) {
        var e = function(t) {
            return null != t ? t.toString() : t;
        }, r = {
            encode: e,
            decode: e,
            is: d(String),
            pattern: /.*/,
            equals: function(t, e) {
                return t == e;
            }
        };
        return G({}, r, t);
    }, G(Fe.prototype, {
        string: Ne({}),
        path: Ne({
            pattern: /[^/]*/
        }),
        query: Ne({}),
        hash: Ne({
            inherit: !1
        }),
        int: Ne({
            decode: function(t) {
                return parseInt(t, 10);
            },
            is: function(t) {
                return !T(t) && this.decode(t.toString()) === t;
            },
            pattern: /-?\d+/
        }),
        bool: Ne({
            encode: function(t) {
                return t ? 1 : 0;
            },
            decode: function(t) {
                return 0 !== parseInt(t, 10);
            },
            is: d(Boolean),
            pattern: /0|1/
        }),
        date: Ne({
            encode: function(t) {
                return this.is(t) ? [ t.getFullYear(), ("0" + (t.getMonth() + 1)).slice(-2), ("0" + t.getDate()).slice(-2) ].join("-") : void 0;
            },
            decode: function(t) {
                if (this.is(t)) return t;
                var e = this.capture.exec(t);
                return e ? new Date(e[1], e[2] - 1, e[3]) : void 0;
            },
            is: function(t) {
                return t instanceof Date && !isNaN(t.valueOf());
            },
            equals: function(t, e) {
                return [ "getFullYear", "getMonth", "getDate" ].reduce(function(r, n) {
                    return r && t[n]() === e[n]();
                }, !0);
            },
            pattern: /[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[1-2][0-9]|3[0-1])/,
            capture: /([0-9]{4})-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/
        }),
        json: Ne({
            encode: M,
            decode: L,
            is: d(Object),
            equals: W,
            pattern: /[^/]*/
        }),
        any: Ne({
            encode: z,
            decode: z,
            is: function() {
                return !0;
            },
            equals: W
        })
    });
    var Ue = function() {
        function t(t) {
            void 0 === t && (t = {}), G(this, t);
        }
        return t.prototype.$inherit = function(t, e, r) {
            var n, i = at(e, r), o = {}, a = [];
            for (var u in i) if (i[u] && i[u].params && (n = Object.keys(i[u].params)).length) for (var s in n) 0 <= a.indexOf(n[s]) || (a.push(n[s]), 
            o[n[s]] = this[n[s]]);
            return G({}, o, t);
        }, t;
    }();
    function Le(t) {
        return t.name;
    }
    function Me(t) {
        return t.self.$$state = function() {
            return t;
        }, t.self;
    }
    function Be(t) {
        return t.parent && t.parent.data && (t.data = t.self.data = K(t.parent.data, t.data)), 
        t.data;
    }
    var Ge = function(t, e) {
        return function(r) {
            var n = r;
            n && n.url && n.name && n.name.match(/\.\*\*$/) && (n.url += "{remainder:any}");
            var i = function(t) {
                if (!O(t)) return !1;
                var e = "^" === t.charAt(0);
                return {
                    val: e ? t.substring(1) : t,
                    root: e
                };
            }(n.url), o = r.parent, a = i ? t.compile(i.val, {
                params: r.params || {},
                paramMap: function(t, e) {
                    return !1 === n.reloadOnSearch && e && (t = G(t || {}, {
                        dynamic: !0
                    })), t;
                }
            }) : n.url;
            if (!a) return null;
            if (!t.isMatcher(a)) throw new Error("Invalid url '" + a + "' in state '" + r + "'");
            return i && i.root ? a : (o && o.navigable || e()).url.append(a);
        };
    }, We = function(t) {
        return function(e) {
            return !t(e) && e.url ? e : e.parent ? e.parent.navigable : null;
        };
    }, ze = function(t) {
        return function(e) {
            var r = e.url && e.url.parameters({
                inherit: !1
            }) || [], n = vt(ht(st(e.params || {}, r.map(u("id"))), function(e, r) {
                return t.fromConfig(r, null, e);
            }));
            return r.concat(n).map(function(t) {
                return [ t.id, t ];
            }).reduce(Pt, {});
        };
    };
    function Je(t) {
        return t.parent ? t.parent.path.concat(t) : [ t ];
    }
    function Qe(t) {
        var e = t.parent ? G({}, t.parent.includes) : {};
        return e[t.name] = !0, e;
    }
    function Ke(t) {
        var e, r, n = function(t) {
            return t.provide || t.token;
        }, i = _([ [ u("resolveFn"), function(t) {
            return new he(n(t), t.resolveFn, t.deps, t.policy);
        } ], [ u("useFactory"), function(t) {
            return new he(n(t), t.useFactory, t.deps || t.dependencies, t.policy);
        } ], [ u("useClass"), function(t) {
            return new he(n(t), function() {
                return new t.useClass();
            }, [], t.policy);
        } ], [ u("useValue"), function(t) {
            return new he(n(t), function() {
                return t.useValue;
            }, [], t.policy, t.useValue);
        } ], [ u("useExisting"), function(t) {
            return new he(n(t), z, [ t.useExisting ], t.policy);
        } ] ]), o = _([ [ a(u("val"), O), function(t) {
            return new he(t.token, z, [ t.val ], t.policy);
        } ], [ a(u("val"), V), function(t) {
            return new he(t.token, kt(t.val), t.val.slice(0, -1), t.policy);
        } ], [ a(u("val"), P), function(t) {
            return new he(t.token, t.val, (e = t.val, r = N.$injector, e.$inject || r && r.annotate(e, r.strictDi) || "deferred"), t.policy);
            var e, r;
        } ] ]), s = _([ [ d(he), function(t) {
            return t;
        } ], [ function(t) {
            return !(!t.token || !t.resolveFn);
        }, i ], [ function(t) {
            return !(!t.provide && !t.token || !(t.useValue || t.useFactory || t.useExisting || t.useClass));
        }, i ], [ function(t) {
            return !!(t && t.val && (O(t.val) || V(t.val) || P(t.val)));
        }, o ], [ y(!0), function(t) {
            throw new Error("Invalid resolve value: " + ke(t));
        } ] ]), c = t.resolve;
        return (V(c) ? c : (e = c, r = t.resolvePolicy || {}, Object.keys(e || {}).map(function(t) {
            return {
                token: t,
                val: e[t],
                deps: void 0,
                policy: r[t]
            };
        }))).map(s);
    }
    var Ye = function() {
        function t(t, e) {
            this.matcher = t;
            var r = this, n = function() {
                return t.find("");
            }, i = function(t) {
                return "" === t.name;
            };
            this.builders = {
                name: [ Le ],
                self: [ Me ],
                parent: [ function(e) {
                    return i(e) ? null : t.find(r.parentName(e)) || n();
                } ],
                data: [ Be ],
                url: [ Ge(e, n) ],
                navigable: [ We(i) ],
                params: [ ze(e.paramFactory) ],
                views: [],
                path: [ Je ],
                includes: [ Qe ],
                resolvables: [ Ke ]
            };
        }
        return t.prototype.builder = function(t, e) {
            var r = this.builders, n = r[t] || [];
            return O(t) && !E(e) ? 1 < n.length ? n : n[0] : O(t) && P(e) ? (r[t] = n, r[t].push(e), 
            function() {
                return r[t].splice(r[t].indexOf(e, 1)) && null;
            }) : void 0;
        }, t.prototype.build = function(t) {
            var e = this.matcher, r = this.builders, n = this.parentName(t);
            if (n && !e.find(n, void 0, !1)) return null;
            for (var i in r) if (r.hasOwnProperty(i)) {
                var o = r[i].reduce(function(t, e) {
                    return function(r) {
                        return e(r, t);
                    };
                }, J);
                t[i] = o(t);
            }
            return t;
        }, t.prototype.parentName = function(t) {
            var e = t.name || "", r = e.split(".");
            if ("**" === r.pop() && r.pop(), r.length) {
                if (t.parent) throw new Error("States that specify the 'parent:' property should not have a '.' in their name (" + e + ")");
                return r.join(".");
            }
            return t.parent ? O(t.parent) ? t.parent : t.parent.name : "";
        }, t.prototype.name = function(t) {
            var e = t.name;
            if (-1 !== e.indexOf(".") || !t.parent) return e;
            var r = O(t.parent) ? t.parent : t.parent.name;
            return r ? r + "." + e : e;
        }, t;
    }(), Ze = function() {
        function t(t) {
            this._states = t;
        }
        return t.prototype.isRelative = function(t) {
            return 0 === (t = t || "").indexOf(".") || 0 === t.indexOf("^");
        }, t.prototype.find = function(t, e, r) {
            if (void 0 === r && (r = !0), t || "" === t) {
                var n = O(t), i = n ? t : t.name;
                this.isRelative(i) && (i = this.resolvePath(i, e));
                var o = this._states[i];
                if (o && (n || !(n || o !== t && o.self !== t))) return o;
                if (n && r) {
                    var a = vt(this._states).filter(function(t) {
                        return t.__stateObjectCache.nameGlob && t.__stateObjectCache.nameGlob.matches(i);
                    });
                    return 1 < a.length && console.log("stateMatcher.find: Found multiple matches for " + i + " using glob: ", a.map(function(t) {
                        return t.name;
                    })), a[0];
                }
            }
        }, t.prototype.resolvePath = function(t, e) {
            if (!e) throw new Error("No reference point given for path '" + t + "'");
            for (var r = this.find(e), n = t.split("."), i = n.length, o = 0, a = r; o < i; o++) if ("" !== n[o] || 0 !== o) {
                if ("^" !== n[o]) break;
                if (!a.parent) throw new Error("Path '" + t + "' not valid for state '" + r.name + "'");
                a = a.parent;
            } else a = r;
            var u = n.slice(o).join(".");
            return a.name + (a.name && u ? "." : "") + u;
        }, t;
    }(), Xe = function() {
        function t(t, e, r, n, i) {
            this.$registry = t, this.$urlRouter = e, this.states = r, this.builder = n, this.listeners = i, 
            this.queue = [], this.matcher = t.matcher;
        }
        return t.prototype.dispose = function() {
            this.queue = [];
        }, t.prototype.register = function(t) {
            var e = this.queue, r = $.create(t), n = r.name;
            if (!O(n)) throw new Error("State must have a valid name");
            if (this.states.hasOwnProperty(n) || Y(e.map(u("name")), n)) throw new Error("State '" + n + "' is already defined");
            return e.push(r), this.flush(), r;
        }, t.prototype.flush = function() {
            for (var t = this, e = this.queue, r = this.states, n = this.builder, i = [], o = [], a = {}, u = function(e) {
                return t.states.hasOwnProperty(e) && t.states[e];
            }, s = function() {
                i.length && t.listeners.forEach(function(t) {
                    return t("registered", i.map(function(t) {
                        return t.self;
                    }));
                });
            }; 0 < e.length; ) {
                var c = e.shift(), f = c.name, l = n.build(c), h = o.indexOf(c);
                if (l) {
                    var p = u(f);
                    if (p && p.name === f) throw new Error("State '" + f + "' is already defined");
                    var v = u(f + ".**");
                    v && this.$registry.deregister(v), r[f] = c, this.attachRoute(c), 0 <= h && o.splice(h, 1), 
                    i.push(c);
                } else {
                    var d = a[f];
                    if (a[f] = e.length, 0 <= h && d === e.length) return e.push(c), s(), r;
                    h < 0 && o.push(c), e.push(c);
                }
            }
            return s(), r;
        }, t.prototype.attachRoute = function(t) {
            !t.abstract && t.url && this.$urlRouter.rule(this.$urlRouter.urlRuleFactory.create(t));
        }, t;
    }(), tr = function() {
        function t(t) {
            this._router = t, this.states = {}, this.listeners = [], this.matcher = new Ze(this.states), 
            this.builder = new Ye(this.matcher, t.urlMatcherFactory), this.stateQueue = new Xe(this, t.urlRouter, this.states, this.builder, this.listeners), 
            this._registerRoot();
        }
        return t.prototype._registerRoot = function() {
            (this._root = this.stateQueue.register({
                name: "",
                url: "^",
                views: null,
                params: {
                    "#": {
                        value: null,
                        type: "hash",
                        dynamic: !0
                    }
                },
                abstract: !0
            })).navigable = null;
        }, t.prototype.dispose = function() {
            var t = this;
            this.stateQueue.dispose(), this.listeners = [], this.get().forEach(function(e) {
                return t.get(e) && t.deregister(e);
            });
        }, t.prototype.onStatesChanged = function(t) {
            return this.listeners.push(t), function() {
                X(this.listeners)(t);
            }.bind(this);
        }, t.prototype.root = function() {
            return this._root;
        }, t.prototype.register = function(t) {
            return this.stateQueue.register(t);
        }, t.prototype._deregisterTree = function(t) {
            var e = this, r = this.get().map(function(t) {
                return t.$$state();
            }), n = function(t) {
                var e = r.filter(function(e) {
                    return -1 !== t.indexOf(e.parent);
                });
                return 0 === e.length ? e : e.concat(n(e));
            }, i = n([ t ]), o = [ t ].concat(i).reverse();
            return o.forEach(function(t) {
                var r = e._router.urlRouter;
                r.rules().filter(s("state", t)).forEach(r.removeRule.bind(r)), delete e.states[t.name];
            }), o;
        }, t.prototype.deregister = function(t) {
            var e = this.get(t);
            if (!e) throw new Error("Can't deregister state; not found: " + t);
            var r = this._deregisterTree(e.$$state());
            return this.listeners.forEach(function(t) {
                return t("deregistered", r.map(function(t) {
                    return t.self;
                }));
            }), r;
        }, t.prototype.get = function(t, e) {
            var r = this;
            if (0 === arguments.length) return Object.keys(this.states).map(function(t) {
                return r.states[t].self;
            });
            var n = this.matcher.find(t, e);
            return n && n.self || null;
        }, t.prototype.decorator = function(t, e) {
            return this.builder.builder(t, e);
        }, t;
    }();
    function er(t, e) {
        var r = [ "", "" ], n = t.replace(/[\\\[\]\^$*+?.()|{}]/g, "\\$&");
        if (!e) return n;
        switch (e.squash) {
          case !1:
            r = [ "(", ")" + (e.isOptional ? "?" : "") ];
            break;

          case !0:
            n = n.replace(/\/$/, ""), r = [ "(?:/(", ")|/)?" ];
            break;

          default:
            r = [ "(" + e.squash + "|", ")?" ];
        }
        return n + r[0] + e.type.pattern.source + r[1];
    }
    var ur, rr = De("/"), nr = function() {
        function e(t, r, n, i) {
            var o = this;
            this.config = i, this._cache = {
                path: [ this ]
            }, this._children = [], this._params = [], this._segments = [], this._compiled = [], 
            this.pattern = t, this.config = it(this.config, {
                params: {},
                strict: !0,
                caseInsensitive: !1,
                paramMap: z
            });
            for (var a, u, c, f = /([:*])([\w\[\]]+)|\{([\w\[\]]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g, l = /([:]?)([\w\[\].-]+)|\{([\w\[\].-]+)(?:\:\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g, h = [], p = 0, v = function(r) {
                if (!e.nameValidator.test(r)) throw new Error("Invalid parameter name '" + r + "' in pattern '" + t + "'");
                if (lt(o._params, s("id", r))) throw new Error("Duplicate parameter name '" + r + "' in pattern '" + t + "'");
            }, d = function(e, n) {
                var i, a = e[2] || e[3], u = n ? e[4] : e[4] || ("*" === e[1] ? "[\\s\\S]*" : null);
                return {
                    id: a,
                    regexp: u,
                    cfg: o.config.params[a],
                    segment: t.substring(p, e.index),
                    type: u ? r.type(u) || (i = u, K(r.type(n ? "query" : "path"), {
                        pattern: new RegExp(i, o.config.caseInsensitive ? "i" : void 0)
                    })) : null
                };
            }; (a = f.exec(t)) && !(0 <= (u = d(a, !1)).segment.indexOf("?")); ) v(u.id), this._params.push(n.fromPath(u.id, u.type, this.config.paramMap(u.cfg, !1))), 
            this._segments.push(u.segment), h.push([ u.segment, kt(this._params) ]), p = f.lastIndex;
            var m = (c = t.substring(p)).indexOf("?");
            if (0 <= m) {
                var y = c.substring(m);
                if (c = c.substring(0, m), 0 < y.length) for (p = 0; a = l.exec(y); ) v((u = d(a, !0)).id), 
                this._params.push(n.fromSearch(u.id, u.type, this.config.paramMap(u.cfg, !0))), 
                p = f.lastIndex;
            }
            this._segments.push(c), this._compiled = h.map(function(t) {
                return er.apply(null, t);
            }).concat(er(c));
        }
        return e.encodeDashes = function(t) {
            return encodeURIComponent(t).replace(/-/g, function(t) {
                return "%5C%" + t.charCodeAt(0).toString(16).toUpperCase();
            });
        }, e.pathSegmentsAndParams = function(e) {
            return Tt(e._segments, e._params.filter(function(e) {
                return e.location === t.DefType.PATH;
            }).concat(void 0)).reduce(yt, []).filter(function(t) {
                return "" !== t && E(t);
            });
        }, e.queryParams = function(e) {
            return e._params.filter(function(e) {
                return e.location === t.DefType.SEARCH;
            });
        }, e.compare = function(t, r) {
            var n = function(t) {
                return t._cache.weights = t._cache.weights || function(t) {
                    return t._cache.segments = t._cache.segments || t._cache.path.map(e.pathSegmentsAndParams).reduce(yt, []).reduce(qe, []).map(function(t) {
                        return O(t) ? rr(t) : t;
                    }).reduce(yt, []);
                }(t).map(function(t) {
                    return "/" === t ? 1 : O(t) ? 2 : t instanceof se ? 3 : void 0;
                });
            }, i = n(t), o = n(r);
            !function(t, e, r) {
                for (var n = Math.max(t.length, e.length); t.length < n; ) t.push(0);
                for (;e.length < n; ) e.push(0);
            }(i, o);
            var a, u, s = Tt(i, o);
            for (u = 0; u < s.length; u++) if (0 != (a = s[u][0] - s[u][1])) return a;
            return 0;
        }, e.prototype.append = function(t) {
            return this._children.push(t), t._cache = {
                path: this._cache.path.concat(t),
                parent: this,
                pattern: null
            }, t;
        }, e.prototype.isRoot = function() {
            return this._cache.path[0] === this;
        }, e.prototype.toString = function() {
            return this.pattern;
        }, e.prototype.exec = function(t, e, r, n) {
            var i = this;
            void 0 === e && (e = {}), void 0 === n && (n = {});
            var o, a, s, c = (o = this._cache, a = "pattern", s = function() {
                return new RegExp([ "^", $t(i._cache.path.map(u("_compiled"))).join(""), !1 === i.config.strict ? "/?" : "", "$" ].join(""), i.config.caseInsensitive ? "i" : void 0);
            }, o[a] = o[a] || s()).exec(t);
            if (!c) return null;
            var f, l = this.parameters(), h = l.filter(function(t) {
                return !t.isSearch();
            }), p = l.filter(function(t) {
                return t.isSearch();
            }), v = this._cache.path.map(function(t) {
                return t._segments.length - 1;
            }).reduce(function(t, e) {
                return t + e;
            }), d = {};
            if (v !== c.length - 1) throw new Error("Unbalanced capture group in route '" + this.pattern + "'");
            for (var m = 0; m < v; m++) {
                for (var y = h[m], g = c[m + 1], _ = 0; _ < y.replace.length; _++) y.replace[_].from === g && (g = y.replace[_].to);
                g && !0 === y.array && (g = pt(pt((f = function(t) {
                    return t.split("").reverse().join("");
                })(g).split(/-(?!\\)/), f), function(t) {
                    return t.replace(/\\-/g, "-");
                }).reverse()), E(g) && (g = y.type.decode(g)), d[y.id] = y.value(g);
            }
            return p.forEach(function(t) {
                for (var r = e[t.id], n = 0; n < t.replace.length; n++) t.replace[n].from === r && (r = t.replace[n].to);
                E(r) && (r = t.type.decode(r)), d[t.id] = t.value(r);
            }), r && (d["#"] = r), d;
        }, e.prototype.parameters = function(t) {
            return void 0 === t && (t = {}), !1 === t.inherit ? this._params : $t(this._cache.path.map(function(t) {
                return t._params;
            }));
        }, e.prototype.parameter = function(t, e) {
            var r = this;
            void 0 === e && (e = {});
            var n = this._cache.parent;
            return function() {
                for (var e = 0, n = r._params; e < n.length; e++) {
                    var i = n[e];
                    if (i.id === t) return i;
                }
            }() || !1 !== e.inherit && n && n.parameter(t, e) || null;
        }, e.prototype.validates = function(t) {
            return t = t || {}, this.parameters().filter(function(e) {
                return t.hasOwnProperty(e.id);
            }).map(function(e) {
                return n = t[(r = e).id], !r || r.validates(n);
                var r, n;
            }).reduce(dt, !0);
        }, e.prototype.format = function(t) {
            void 0 === t && (t = {});
            var r = this._cache.path, n = r.map(e.pathSegmentsAndParams).reduce(yt, []).map(function(t) {
                return O(t) ? t : o(t);
            }), i = r.map(e.queryParams).reduce(yt, []).map(o);
            if (n.concat(i).filter(function(t) {
                return !1 === t.isValid;
            }).length) return null;
            function o(e) {
                var r = e.value(t[e.id]), n = e.validates(r), i = e.isDefaultValue(r);
                return {
                    param: e,
                    value: r,
                    isValid: n,
                    isDefaultValue: i,
                    squash: !!i && e.squash,
                    encoded: e.type.encode(r)
                };
            }
            var a = n.reduce(function(t, r) {
                if (O(r)) return t + r;
                var n = r.squash, i = r.encoded, o = r.param;
                return !0 === n ? t.match(/\/$/) ? t.slice(0, -1) : t : O(n) ? t + n : !1 !== n ? t : null == i ? t : V(i) ? t + pt(i, e.encodeDashes).join("-") : o.raw ? t + i : t + encodeURIComponent(i);
            }, ""), u = i.map(function(t) {
                var e = t.param, r = t.squash, n = t.encoded, i = t.isDefaultValue;
                if (!(null == n || i && !1 !== r) && (V(n) || (n = [ n ]), 0 !== n.length)) return e.raw || (n = pt(n, encodeURIComponent)), 
                n.map(function(t) {
                    return e.id + "=" + t;
                });
            }).filter(z).reduce(yt, []).join("&");
            return a + (u ? "?" + u : "") + (t["#"] ? "#" + t["#"] : "");
        }, e.nameValidator = /^\w+([-.]+\w+)*(?:\[\])?$/, e;
    }(), ir = function() {
        function e() {
            var e = this;
            this.paramTypes = new Fe(), this._isCaseInsensitive = !1, this._isStrictMode = !0, 
            this._defaultSquashPolicy = !1, this.paramFactory = {
                fromConfig: function(r, n, i) {
                    return new se(r, n, i, t.DefType.CONFIG, e);
                },
                fromPath: function(r, n, i) {
                    return new se(r, n, i, t.DefType.PATH, e);
                },
                fromSearch: function(r, n, i) {
                    return new se(r, n, i, t.DefType.SEARCH, e);
                }
            }, this._getConfig = function(t) {
                return G({
                    strict: e._isStrictMode,
                    caseInsensitive: e._isCaseInsensitive
                }, t);
            }, G(this, {
                UrlMatcher: nr,
                Param: se
            });
        }
        return e.prototype.caseInsensitive = function(t) {
            return this._isCaseInsensitive = E(t) ? t : this._isCaseInsensitive;
        }, e.prototype.strictMode = function(t) {
            return this._isStrictMode = E(t) ? t : this._isStrictMode;
        }, e.prototype.defaultSquashPolicy = function(t) {
            if (E(t) && !0 !== t && !1 !== t && !O(t)) throw new Error("Invalid squash policy: " + t + ". Valid policies: false, true, arbitrary-string");
            return this._defaultSquashPolicy = E(t) ? t : this._defaultSquashPolicy;
        }, e.prototype.compile = function(t, e) {
            return new nr(t, this.paramTypes, this.paramFactory, this._getConfig(e));
        }, e.prototype.isMatcher = function(t) {
            if (!x(t)) return !1;
            var e = !0;
            return B(nr.prototype, function(r, n) {
                P(r) && (e = e && E(t[n]) && P(t[n]));
            }), e;
        }, e.prototype.type = function(t, e, r) {
            var n = this.paramTypes.type(t, e, r);
            return E(e) ? this : n;
        }, e.prototype.$get = function() {
            return this.paramTypes.enqueue = !1, this.paramTypes._flushTypeQueue(), this;
        }, e.prototype.dispose = function() {
            this.paramTypes.dispose();
        }, e;
    }(), or = function() {
        function t(t) {
            this.router = t;
        }
        return t.prototype.compile = function(t) {
            return this.router.urlMatcherFactory.compile(t);
        }, t.prototype.create = function(t, e) {
            var r = this, n = _([ [ O, function(t) {
                return n(r.compile(t));
            } ], [ d(nr), function(t) {
                return r.fromUrlMatcher(t, e);
            } ], [ A, function(t) {
                return r.fromState(t, r.router);
            } ], [ d(RegExp), function(t) {
                return r.fromRegExp(t, e);
            } ], [ P, function(t) {
                return new ar(t, e);
            } ] ]), i = n(t);
            if (!i) throw new Error("invalid 'what' in when()");
            return i;
        }, t.prototype.fromUrlMatcher = function(t, e) {
            var r = e;
            O(e) && (e = this.router.urlMatcherFactory.compile(e)), d(nr)(e) && (r = function(t) {
                return e.format(t);
            });
            var n = {
                urlMatcher: t,
                matchPriority: function(e) {
                    var r = t.parameters().filter(function(t) {
                        return t.isOptional;
                    });
                    return r.length ? r.filter(function(t) {
                        return e[t.id];
                    }).length / r.length : 1e-6;
                },
                type: "URLMATCHER"
            };
            return G(new ar(function(e) {
                var r = t.exec(e.path, e.search, e.hash);
                return t.validates(r) && r;
            }, r), n);
        }, t.prototype.fromState = function(t, e) {
            var r = {
                state: t,
                type: "STATE"
            };
            return G(this.fromUrlMatcher(t.url, function(r) {
                var n = e.stateService, i = e.globals;
                n.href(t, r) !== n.href(i.current, i.params) && n.transitionTo(t, r, {
                    inherit: !0,
                    source: "url"
                });
            }), r);
        }, t.prototype.fromRegExp = function(t, e) {
            if (t.global || t.sticky) throw new Error("Rule RegExp must not be global or sticky");
            var r = O(e) ? function(t) {
                return e.replace(/\$(\$|\d{1,2})/, function(e, r) {
                    return t["$" === r ? 0 : Number(r)];
                });
            } : e, n = {
                regexp: t,
                type: "REGEXP"
            };
            return G(new ar(function(e) {
                return t.exec(e.path);
            }, r), n);
        }, t.isUrlRule = function(t) {
            return t && [ "type", "match", "handler" ].every(function(e) {
                return E(t[e]);
            });
        }, t;
    }(), ar = function(t, e) {
        var r = this;
        this.match = t, this.type = "RAW", this.matchPriority = function(t) {
            return 0 - r.$id;
        }, this.handler = e || z;
    };
    ur = function(t, e) {
        var r = function(t, e) {
            return (e.priority || 0) - (t.priority || 0);
        }(t, e);
        return 0 !== r ? r : 0 !== (r = function(t, e) {
            var r = {
                STATE: 4,
                URLMATCHER: 4,
                REGEXP: 3,
                RAW: 2,
                OTHER: 1
            };
            return (r[t.type] || 0) - (r[e.type] || 0);
        }(t, e)) ? r : 0 !== (r = function(t, e) {
            return t.urlMatcher && e.urlMatcher ? nr.compare(t.urlMatcher, e.urlMatcher) : 0;
        }(t, e)) ? r : function(t, e) {
            var r = {
                STATE: !0,
                URLMATCHER: !0
            };
            return r[t.type] && r[e.type] ? 0 : (t.$id || 0) - (e.$id || 0);
        }(t, e);
    };
    var sr = function() {
        function t(e) {
            this._sortFn = ur, this._rules = [], this.interceptDeferred = !1, this._id = 0, 
            this._sorted = !1, this._router = e, this.urlRuleFactory = new or(e), Q(y(t.prototype), this, y(this));
        }
        return t.prototype.dispose = function() {
            this.listen(!1), this._rules = [], delete this._otherwiseFn;
        }, t.prototype.sort = function(t) {
            this._rules = this.stableSort(this._rules, this._sortFn = t || this._sortFn), this._sorted = !0;
        }, t.prototype.ensureSorted = function() {
            this._sorted || this.sort();
        }, t.prototype.stableSort = function(t, e) {
            var r = t.map(function(t, e) {
                return {
                    elem: t,
                    idx: e
                };
            });
            return r.sort(function(t, r) {
                var n = e(t.elem, r.elem);
                return 0 === n ? t.idx - r.idx : n;
            }), r.map(function(t) {
                return t.elem;
            });
        }, t.prototype.match = function(t) {
            this.ensureSorted(), t = G({
                path: "",
                search: {},
                hash: ""
            }, t);
            var r = this.rules();
            this._otherwiseFn && r.push(this._otherwiseFn);
            for (var n, i, o, a = 0; a < r.length && (!n || 0 === this._sortFn(r[a], n.rule)); a++) {
                var u = (o = (i = r[a]).match(t, this._router)) && {
                    match: o,
                    rule: i,
                    weight: i.matchPriority(o)
                };
                n = !n || u && u.weight > n.weight ? u : n;
            }
            return n;
        }, t.prototype.sync = function(t) {
            if (!t || !t.defaultPrevented) {
                var e = this._router, r = e.urlService, n = e.stateService, i = {
                    path: r.path(),
                    search: r.search(),
                    hash: r.hash()
                }, o = this.match(i);
                _([ [ O, function(t) {
                    return r.url(t, !0);
                } ], [ Yt.isDef, function(t) {
                    return n.go(t.state, t.params, t.options);
                } ], [ d(Yt), function(t) {
                    return n.go(t.state(), t.params(), t.options());
                } ] ])(o && o.rule.handler(o.match, i, e));
            }
        }, t.prototype.listen = function(t) {
            var e = this;
            if (!1 !== t) return this._stopFn = this._stopFn || this._router.urlService.onChange(function(t) {
                return e.sync(t);
            });
            this._stopFn && this._stopFn(), delete this._stopFn;
        }, t.prototype.update = function(t) {
            var e = this._router.locationService;
            t ? this.location = e.url() : e.url() !== this.location && e.url(this.location, !0);
        }, t.prototype.push = function(t, e, r) {
            var n = r && !!r.replace;
            this._router.urlService.url(t.format(e || {}), n);
        }, t.prototype.href = function(t, e, r) {
            var n = t.format(e);
            if (null == n) return null;
            r = r || {
                absolute: !1
            };
            var i = this._router.urlService.config, o = i.html5Mode();
            if (o || null === n || (n = "#" + i.hashPrefix() + n), n = function(t, e, r, n) {
                return "/" === n ? t : e ? Ve(n) + t : r ? n.slice(1) + t : t;
            }(n, o, r.absolute, i.baseHref()), !r.absolute || !n) return n;
            var a = !o && n ? "/" : "", u = i.port(), s = 80 === u || 443 === u ? "" : ":" + u;
            return [ i.protocol(), "://", i.host(), s, a, n ].join("");
        }, t.prototype.rule = function(t) {
            var e = this;
            if (!or.isUrlRule(t)) throw new Error("invalid rule");
            return t.$id = this._id++, t.priority = t.priority || 0, this._rules.push(t), this._sorted = !1, 
            function() {
                return e.removeRule(t);
            };
        }, t.prototype.removeRule = function(t) {
            X(this._rules, t);
        }, t.prototype.rules = function() {
            return this.ensureSorted(), this._rules.slice();
        }, t.prototype.otherwise = function(t) {
            var e = cr(t);
            this._otherwiseFn = this.urlRuleFactory.create(y(!0), e), this._sorted = !1;
        }, t.prototype.initial = function(t) {
            var e = cr(t);
            this.rule(this.urlRuleFactory.create(function(t, e) {
                return 0 === e.globals.transitionHistory.size() && !!/^\/?$/.exec(t.path);
            }, e));
        }, t.prototype.when = function(t, e, r) {
            var n = this.urlRuleFactory.create(t, e);
            return E(r && r.priority) && (n.priority = r.priority), this.rule(n), n;
        }, t.prototype.deferIntercept = function(t) {
            void 0 === t && (t = !0), this.interceptDeferred = t;
        }, t;
    }();
    function cr(t) {
        if (!(P(t) || O(t) || d(Yt)(t) || Yt.isDef(t))) throw new Error("'handler' must be a string, function, TargetState, or have a state: 'newtarget' property");
        return P(t) ? t : y(t);
    }
    var fr = function() {
        function t() {
            var t = this;
            this._uiViews = [], this._viewConfigs = [], this._viewConfigFactories = {}, this._listeners = [], 
            this._pluginapi = {
                _rootViewContext: this._rootViewContext.bind(this),
                _viewConfigFactory: this._viewConfigFactory.bind(this),
                _registeredUIViews: function() {
                    return t._uiViews;
                },
                _activeViewConfigs: function() {
                    return t._viewConfigs;
                },
                _onSync: function(e) {
                    return t._listeners.push(e), function() {
                        return X(t._listeners, e);
                    };
                }
            };
        }
        return t.normalizeUIViewTarget = function(t, e) {
            void 0 === e && (e = "");
            var r = e.split("@"), n = r[0] || "$default", i = O(r[1]) ? r[1] : "^", o = /^(\^(?:\.\^)*)\.(.*$)/.exec(n);
            return o && (i = o[1], n = o[2]), "!" === n.charAt(0) && (n = n.substr(1), i = ""), 
            /^(\^(?:\.\^)*)$/.exec(i) ? i = i.split(".").reduce(function(t, e) {
                return t.parent;
            }, t).name : "." === i && (i = t.name), {
                uiViewName: n,
                uiViewContextAnchor: i
            };
        }, t.prototype._rootViewContext = function(t) {
            return this._rootContext = t || this._rootContext;
        }, t.prototype._viewConfigFactory = function(t, e) {
            this._viewConfigFactories[t] = e;
        }, t.prototype.createViewConfig = function(t, e) {
            var r = this._viewConfigFactories[e.$type];
            if (!r) throw new Error("ViewService: No view config factory registered for type " + e.$type);
            var n = r(t, e);
            return V(n) ? n : [ n ];
        }, t.prototype.deactivateViewConfig = function(t) {
            Kt.traceViewServiceEvent("<- Removing", t), X(this._viewConfigs, t);
        }, t.prototype.activateViewConfig = function(t) {
            Kt.traceViewServiceEvent("-> Registering", t), this._viewConfigs.push(t);
        }, t.prototype.sync = function() {
            var e = this, r = this._uiViews.map(function(t) {
                return [ t.fqn, t ];
            }).reduce(Pt, {});
            function n(t) {
                for (var e = t.viewDecl.$context, r = 0; ++r && e.parent; ) e = e.parent;
                return r;
            }
            var o = i(function(t, e, r, n) {
                return e * (t(r) - t(n));
            }), a = this._uiViews.sort(o(function(t) {
                var e = function(t) {
                    return t && t.parent ? e(t.parent) + 1 : 1;
                };
                return 1e4 * t.fqn.split(".").length + e(t.creationContext);
            }, 1)).map(function(i) {
                var a = e._viewConfigs.filter(t.matches(r, i));
                return 1 < a.length && a.sort(o(n, -1)), {
                    uiView: i,
                    viewConfig: a[0]
                };
            }), u = a.map(function(t) {
                return t.viewConfig;
            }), s = this._viewConfigs.filter(function(t) {
                return !Y(u, t);
            }).map(function(t) {
                return {
                    uiView: void 0,
                    viewConfig: t
                };
            });
            a.forEach(function(t) {
                -1 !== e._uiViews.indexOf(t.uiView) && t.uiView.configUpdated(t.viewConfig);
            });
            var c = a.concat(s);
            this._listeners.forEach(function(t) {
                return t(c);
            }), Kt.traceViewSync(c);
        }, t.prototype.registerUIView = function(t) {
            Kt.traceViewServiceUIViewEvent("-> Registering", t);
            var e = this._uiViews;
            return e.filter(function(e) {
                return e.fqn === t.fqn && e.$type === t.$type;
            }).length && Kt.traceViewServiceUIViewEvent("!!!! duplicate uiView named:", t), 
            e.push(t), this.sync(), function() {
                -1 !== e.indexOf(t) ? (Kt.traceViewServiceUIViewEvent("<- Deregistering", t), X(e)(t)) : Kt.traceViewServiceUIViewEvent("Tried removing non-registered uiView", t);
            };
        }, t.prototype.available = function() {
            return this._uiViews.map(u("fqn"));
        }, t.prototype.active = function() {
            return this._uiViews.filter(u("$config")).map(u("name"));
        }, t.matches = function(t, e) {
            return function(r) {
                if (e.$type !== r.viewDecl.$type) return !1;
                var n = r.viewDecl, i = n.$uiViewName.split("."), o = e.fqn.split(".");
                if (!W(i, o.slice(0 - i.length))) return !1;
                var a = 1 - i.length || void 0, u = o.slice(0, a).join("."), s = t[u].creationContext;
                return n.$uiViewContextAnchor === (s && s.name);
            };
        }, t;
    }(), lr = function() {
        function t() {
            this.params = new Ue(), this.lastStartedTransitionId = -1, this.transitionHistory = new Ht([], 1), 
            this.successfulTransitions = new Ht([], 1);
        }
        return t.prototype.dispose = function() {
            this.transitionHistory.clear(), this.successfulTransitions.clear(), this.transition = null;
        }, t;
    }(), hr = function(t) {
        return t.reduce(function(t, e) {
            return t[e] = q(e), t;
        }, {
            dispose: J
        });
    }, pr = [ "url", "path", "search", "hash", "onChange" ], vr = [ "port", "protocol", "host", "baseHref", "html5Mode", "hashPrefix" ], dr = [ "type", "caseInsensitive", "strictMode", "defaultSquashPolicy" ], mr = [ "sort", "when", "initial", "otherwise", "rules", "rule", "removeRule" ], yr = [ "deferIntercept", "listen", "sync", "match" ], gr = function() {
        function t(t, e) {
            void 0 === e && (e = !0), this.router = t, this.rules = {}, this.config = {};
            var r = function() {
                return t.locationService;
            };
            Q(r, this, r, pr, e);
            var n = function() {
                return t.locationConfig;
            };
            Q(n, this.config, n, vr, e);
            var i = function() {
                return t.urlMatcherFactory;
            };
            Q(i, this.config, i, dr);
            var o = function() {
                return t.urlRouter;
            };
            Q(o, this.rules, o, mr), Q(o, this, o, yr);
        }
        return t.prototype.url = function(t, e, r) {}, t.prototype.path = function() {}, 
        t.prototype.search = function() {}, t.prototype.hash = function() {}, t.prototype.onChange = function(t) {}, 
        t.prototype.parts = function() {
            return {
                path: this.path(),
                search: this.search(),
                hash: this.hash()
            };
        }, t.prototype.dispose = function() {}, t.prototype.sync = function(t) {}, t.prototype.listen = function(t) {}, 
        t.prototype.deferIntercept = function(t) {}, t.prototype.match = function(t) {}, 
        t.locationServiceStub = hr(pr), t.locationConfigStub = hr(vr), t;
    }(), _r = 0, wr = function() {
        function t(t, e) {
            void 0 === t && (t = gr.locationServiceStub), void 0 === e && (e = gr.locationConfigStub), 
            this.locationService = t, this.locationConfig = e, this.$id = _r++, this._disposed = !1, 
            this._disposables = [], this.trace = Kt, this.viewService = new fr(), this.globals = new lr(), 
            this.transitionService = new Lr(this), this.urlMatcherFactory = new ir(), this.urlRouter = new sr(this), 
            this.stateRegistry = new tr(this), this.stateService = new Mr(this), this.urlService = new gr(this), 
            this._plugins = {}, this.viewService._pluginapi._rootViewContext(this.stateRegistry.root()), 
            this.globals.$current = this.stateRegistry.root(), this.globals.current = this.globals.$current.self, 
            this.disposable(this.globals), this.disposable(this.stateService), this.disposable(this.stateRegistry), 
            this.disposable(this.transitionService), this.disposable(this.urlRouter), this.disposable(t), 
            this.disposable(e);
        }
        return t.prototype.disposable = function(t) {
            this._disposables.push(t);
        }, t.prototype.dispose = function(t) {
            var e = this;
            t && P(t.dispose) ? t.dispose(this) : (this._disposed = !0, this._disposables.slice().forEach(function(t) {
                try {
                    "function" == typeof t.dispose && t.dispose(e), X(e._disposables, t);
                } catch (t) {}
            }));
        }, t.prototype.plugin = function(t, e) {
            void 0 === e && (e = {});
            var r = new t(this, e);
            if (!r.name) throw new Error("Required property `name` missing on plugin: " + r);
            return this._disposables.push(r), this._plugins[r.name] = r;
        }, t.prototype.getPlugin = function(t) {
            return t ? this._plugins[t] : vt(this._plugins);
        }, t;
    }();
    function $r(t) {
        t.addResolvable(he.fromData(wr, t.router), ""), t.addResolvable(he.fromData($e, t), ""), 
        t.addResolvable(he.fromData("$transition$", t), ""), t.addResolvable(he.fromData("$stateParams", t.params()), ""), 
        t.entering().forEach(function(e) {
            t.addResolvable(he.fromData("$state$", e), e);
        });
    }
    var Sr = Y([ "$transition$", $e ]), br = function(t) {
        var e = function(t) {
            return Sr(t.token) ? he.fromData(t.token, null) : t;
        };
        vt(t.treeChanges()).reduce(yt, []).reduce(wt, []).forEach(function(t) {
            t.resolvables = t.resolvables.map(e);
        });
    }, Rr = function(t) {
        var e = t.to().redirectTo;
        if (e) {
            var r = t.router.stateService;
            return P(e) ? N.$q.when(e(t)).then(n) : n(e);
        }
        function n(e) {
            if (e) return e instanceof Yt ? e : O(e) ? r.target(e, t.params(), t.options()) : e.state || e.params ? r.target(e.state || t.to(), e.params || t.params(), t.options()) : void 0;
        }
    };
    function Er(t) {
        return function(e, r) {
            return (0, r.$$state()[t])(e, r);
        };
    }
    var Cr = Er("onExit"), Tr = Er("onRetain"), Pr = Er("onEnter"), kr = function(t) {
        return new ge(t.treeChanges().to).resolvePath("EAGER", t).then(J);
    }, Or = function(t, e) {
        return new ge(t.treeChanges().to).subContext(e.$$state()).resolvePath("LAZY", t).then(J);
    }, xr = function(t) {
        return new ge(t.treeChanges().to).resolvePath("LAZY", t).then(J);
    }, Vr = function(t) {
        var e = N.$q, r = t.views("entering");
        if (r.length) return e.all(r.map(function(t) {
            return e.when(t.load());
        })).then(J);
    }, Ir = function(t) {
        var e = t.views("entering"), r = t.views("exiting");
        if (e.length || r.length) {
            var n = t.router.viewService;
            r.forEach(function(t) {
                return n.deactivateViewConfig(t);
            }), e.forEach(function(t) {
                return n.activateViewConfig(t);
            }), n.sync();
        }
    }, jr = function(t) {
        var e = t.router.globals, r = function() {
            e.transition === t && (e.transition = null);
        };
        t.onSuccess({}, function() {
            e.successfulTransitions.enqueue(t), e.$current = t.$to(), e.current = e.$current.self, 
            Ot(t.params(), e.params);
        }, {
            priority: 1e4
        }), t.promise.then(r, r);
    }, Ar = function(t) {
        var e = t.options(), r = t.router.stateService, n = t.router.urlRouter;
        if ("url" !== e.source && e.location && r.$current.navigable) {
            var i = {
                replace: "replace" === e.location
            };
            n.push(r.$current.navigable.url, r.params, i);
        }
        n.update(!0);
    }, Hr = function(t) {
        var e = t.router, r = t.entering().filter(function(t) {
            return !!t.$$state().lazyLoad;
        }).map(function(e) {
            return Dr(t, e);
        });
        return N.$q.all(r).then(function() {
            if ("url" !== t.originalTransition().options().source) {
                var r = t.targetState();
                return e.stateService.target(r.identifier(), r.params(), r.options());
            }
            var n = e.urlService, i = n.match(n.parts()), o = i && i.rule;
            if (o && "STATE" === o.type) {
                var a = o.state, u = i.match;
                return e.stateService.target(a, u, t.options());
            }
            e.urlService.sync();
        });
    };
    function Dr(t, e) {
        var r = e.$$state().lazyLoad, n = r._promise;
        return n || (n = r._promise = N.$q.when(r(t, e)).then(function(e) {
            return e && Array.isArray(e.states) && e.states.forEach(function(e) {
                return t.router.stateRegistry.register(e);
            }), e;
        }).then(function(t) {
            return delete e.lazyLoad, delete e.$$state().lazyLoad, delete r._promise, t;
        }, function(t) {
            return delete r._promise, N.$q.reject(t);
        })), n;
    }
    var qr = function(t, e, r, n, i, o, a, u) {
        void 0 === i && (i = !1), void 0 === o && (o = Xt.HANDLE_RESULT), void 0 === a && (a = Xt.REJECT_ERROR), 
        void 0 === u && (u = !1), this.name = t, this.hookPhase = e, this.hookOrder = r, 
        this.criteriaMatchPath = n, this.reverseSort = i, this.getResultHandler = o, this.getErrorHandler = a, 
        this.synchronous = u;
    };
    function Nr(t) {
        var e = t._ignoredReason();
        if (e) {
            Kt.traceTransitionIgnored(t);
            var r = t.router.globals.transition;
            return "SameAsCurrent" === e && r && r.abort(), qt.ignored().toPromise();
        }
    }
    function Fr(t) {
        if (!t.valid()) throw new Error(t.error().toString());
    }
    var Ur = {
        location: !0,
        relative: null,
        inherit: !1,
        notify: !0,
        reload: !1,
        custom: {},
        current: function() {
            return null;
        },
        source: "unknown"
    }, Lr = function() {
        function e(t) {
            this._transitionCount = 0, this._eventTypes = [], this._registeredHooks = {}, this._criteriaPaths = {}, 
            this._router = t, this.$view = t.viewService, this._deregisterHookFns = {}, this._pluginapi = Q(y(this), {}, y(this), [ "_definePathType", "_defineEvent", "_getPathTypes", "_getEvents", "getHooks" ]), 
            this._defineCorePaths(), this._defineCoreEvents(), this._registerCoreTransitionHooks(), 
            t.globals.successfulTransitions.onEvict(br);
        }
        return e.prototype.onCreate = function(t, e, r) {}, e.prototype.onBefore = function(t, e, r) {}, 
        e.prototype.onStart = function(t, e, r) {}, e.prototype.onExit = function(t, e, r) {}, 
        e.prototype.onRetain = function(t, e, r) {}, e.prototype.onEnter = function(t, e, r) {}, 
        e.prototype.onFinish = function(t, e, r) {}, e.prototype.onSuccess = function(t, e, r) {}, 
        e.prototype.onError = function(t, e, r) {}, e.prototype.dispose = function(t) {
            vt(this._registeredHooks).forEach(function(t) {
                return t.forEach(function(e) {
                    e._deregistered = !0, X(t, e);
                });
            });
        }, e.prototype.create = function(t, e) {
            return new $e(t, e, this._router);
        }, e.prototype._defineCoreEvents = function() {
            var e = t.TransitionHookPhase, r = Xt, n = this._criteriaPaths;
            this._defineEvent("onCreate", e.CREATE, 0, n.to, !1, r.LOG_REJECTED_RESULT, r.THROW_ERROR, !0), 
            this._defineEvent("onBefore", e.BEFORE, 0, n.to), this._defineEvent("onStart", e.RUN, 0, n.to), 
            this._defineEvent("onExit", e.RUN, 100, n.exiting, !0), this._defineEvent("onRetain", e.RUN, 200, n.retained), 
            this._defineEvent("onEnter", e.RUN, 300, n.entering), this._defineEvent("onFinish", e.RUN, 400, n.to), 
            this._defineEvent("onSuccess", e.SUCCESS, 0, n.to, !1, r.LOG_REJECTED_RESULT, r.LOG_ERROR, !0), 
            this._defineEvent("onError", e.ERROR, 0, n.to, !1, r.LOG_REJECTED_RESULT, r.LOG_ERROR, !0);
        }, e.prototype._defineCorePaths = function() {
            var e = t.TransitionHookScope.STATE, r = t.TransitionHookScope.TRANSITION;
            this._definePathType("to", r), this._definePathType("from", r), this._definePathType("exiting", e), 
            this._definePathType("retained", e), this._definePathType("entering", e);
        }, e.prototype._defineEvent = function(t, e, r, n, i, o, a, u) {
            void 0 === i && (i = !1), void 0 === o && (o = Xt.HANDLE_RESULT), void 0 === a && (a = Xt.REJECT_ERROR), 
            void 0 === u && (u = !1);
            var s = new qr(t, e, r, n, i, o, a, u);
            this._eventTypes.push(s), re(this, this, s);
        }, e.prototype._getEvents = function(t) {
            return (E(t) ? this._eventTypes.filter(function(e) {
                return e.hookPhase === t;
            }) : this._eventTypes.slice()).sort(function(t, e) {
                var r = t.hookPhase - e.hookPhase;
                return 0 === r ? t.hookOrder - e.hookOrder : r;
            });
        }, e.prototype._definePathType = function(t, e) {
            this._criteriaPaths[t] = {
                name: t,
                scope: e
            };
        }, e.prototype._getPathTypes = function() {
            return this._criteriaPaths;
        }, e.prototype.getHooks = function(t) {
            return this._registeredHooks[t];
        }, e.prototype._registerCoreTransitionHooks = function() {
            var t = this._deregisterHookFns;
            t.addCoreResolves = this.onCreate({}, $r), t.ignored = function(t) {
                return t.onBefore({}, Nr, {
                    priority: -9999
                });
            }(this), t.invalid = function(t) {
                return t.onBefore({}, Fr, {
                    priority: -1e4
                });
            }(this), t.redirectTo = function(t) {
                return t.onStart({
                    to: function(t) {
                        return !!t.redirectTo;
                    }
                }, Rr);
            }(this), t.onExit = function(t) {
                return t.onExit({
                    exiting: function(t) {
                        return !!t.onExit;
                    }
                }, Cr);
            }(this), t.onRetain = function(t) {
                return t.onRetain({
                    retained: function(t) {
                        return !!t.onRetain;
                    }
                }, Tr);
            }(this), t.onEnter = function(t) {
                return t.onEnter({
                    entering: function(t) {
                        return !!t.onEnter;
                    }
                }, Pr);
            }(this), t.eagerResolve = function(t) {
                return t.onStart({}, kr, {
                    priority: 1e3
                });
            }(this), t.lazyResolve = function(t) {
                return t.onEnter({
                    entering: y(!0)
                }, Or, {
                    priority: 1e3
                });
            }(this), t.resolveAll = function(t) {
                return t.onFinish({}, xr, {
                    priority: 1e3
                });
            }(this), t.loadViews = function(t) {
                return t.onFinish({}, Vr);
            }(this), t.activateViews = function(t) {
                return t.onSuccess({}, Ir);
            }(this), t.updateGlobals = function(t) {
                return t.onCreate({}, jr);
            }(this), t.updateUrl = function(t) {
                return t.onSuccess({}, Ar, {
                    priority: 9999
                });
            }(this), t.lazyLoad = function(t) {
                return t.onBefore({
                    entering: function(t) {
                        return !!t.lazyLoad;
                    }
                }, Hr);
            }(this);
        }, e;
    }(), Mr = function() {
        function e(t) {
            this.router = t, this.invalidCallbacks = [], this._defaultErrorHandler = function(t) {
                t instanceof Error && t.stack ? (console.error(t), console.error(t.stack)) : t instanceof qt ? (console.error(t.toString()), 
                t.detail && t.detail.stack && console.error(t.detail.stack)) : console.error(t);
            };
            var r = Object.keys(e.prototype).filter(f(Y([ "current", "$current", "params", "transition" ])));
            Q(y(e.prototype), this, y(this), r);
        }
        return Object.defineProperty(e.prototype, "transition", {
            get: function() {
                return this.router.globals.transition;
            },
            enumerable: !0,
            configurable: !0
        }), Object.defineProperty(e.prototype, "params", {
            get: function() {
                return this.router.globals.params;
            },
            enumerable: !0,
            configurable: !0
        }), Object.defineProperty(e.prototype, "current", {
            get: function() {
                return this.router.globals.current;
            },
            enumerable: !0,
            configurable: !0
        }), Object.defineProperty(e.prototype, "$current", {
            get: function() {
                return this.router.globals.$current;
            },
            enumerable: !0,
            configurable: !0
        }), e.prototype.dispose = function() {
            this.defaultErrorHandler(J), this.invalidCallbacks = [];
        }, e.prototype._handleInvalidTargetState = function(t, e) {
            var r = this, n = fe.makeTargetState(this.router.stateRegistry, t), i = this.router.globals, o = function() {
                return i.transitionHistory.peekTail();
            }, a = o(), u = new Ht(this.invalidCallbacks.slice()), s = new ge(t).injector(), c = function(t) {
                if (t instanceof Yt) {
                    var e = t;
                    return (e = r.target(e.identifier(), e.params(), e.options())).valid() ? o() !== a ? qt.superseded().toPromise() : r.transitionTo(e.identifier(), e.params(), e.options()) : qt.invalid(e.error()).toPromise();
                }
            };
            return function t() {
                var r = u.dequeue();
                return void 0 === r ? qt.invalid(e.error()).toPromise() : N.$q.when(r(e, n, s)).then(c).then(function(e) {
                    return e || t();
                });
            }();
        }, e.prototype.onInvalid = function(t) {
            return this.invalidCallbacks.push(t), function() {
                X(this.invalidCallbacks)(t);
            }.bind(this);
        }, e.prototype.reload = function(t) {
            return this.transitionTo(this.current, this.params, {
                reload: !E(t) || t,
                inherit: !1,
                notify: !1
            });
        }, e.prototype.go = function(t, e, r) {
            var n = it(r, {
                relative: this.$current,
                inherit: !0
            }, Ur);
            return this.transitionTo(t, e, n);
        }, e.prototype.target = function(t, e, r) {
            if (void 0 === r && (r = {}), x(r.reload) && !r.reload.name) throw new Error("Invalid reload state object");
            var n = this.router.stateRegistry;
            if (r.reloadState = !0 === r.reload ? n.root() : n.matcher.find(r.reload, r.relative), 
            r.reload && !r.reloadState) throw new Error("No such reload state '" + (O(r.reload) ? r.reload : r.reload.name) + "'");
            return new Yt(this.router.stateRegistry, t, e, r);
        }, e.prototype.getCurrentPath = function() {
            var e = this.router.globals.successfulTransitions.peekTail();
            return e ? e.treeChanges().to : [ new ce(this.router.stateRegistry.root()) ];
        }, e.prototype.transitionTo = function(e, r, n) {
            var i = this;
            void 0 === r && (r = {}), void 0 === n && (n = {});
            var o = this.router, a = o.globals;
            n = it(n, Ur), n = G(n, {
                current: function() {
                    return a.transition;
                }
            });
            var u = this.target(e, r, n), s = this.getCurrentPath();
            if (!u.exists()) return this._handleInvalidTargetState(s, u);
            if (!u.valid()) return At(u.error());
            var c = function(e) {
                return function(r) {
                    if (r instanceof qt) {
                        var n = o.globals.lastStartedTransitionId === e.$id;
                        if (r.type === t.RejectType.IGNORED) return n && o.urlRouter.update(), N.$q.when(a.current);
                        var u = r.detail;
                        if (r.type === t.RejectType.SUPERSEDED && r.redirected && u instanceof Yt) {
                            var s = e.redirect(u);
                            return s.run().catch(c(s));
                        }
                        if (r.type === t.RejectType.ABORTED) return n && o.urlRouter.update(), N.$q.reject(r);
                    }
                    return i.defaultErrorHandler()(r), N.$q.reject(r);
                };
            }, f = this.router.transitionService.create(s, u), l = f.run().catch(c(f));
            return jt(l), G(l, {
                transition: f
            });
        }, e.prototype.is = function(t, e, r) {
            r = it(r, {
                relative: this.$current
            });
            var n = this.router.stateRegistry.matcher.find(t, r.relative);
            if (E(n)) {
                if (this.$current !== n) return !1;
                if (!e) return !0;
                var i = n.parameters({
                    inherit: !0,
                    matchingKeys: e
                });
                return se.equals(i, se.values(i, e), this.params);
            }
        }, e.prototype.includes = function(t, e, r) {
            r = it(r, {
                relative: this.$current
            });
            var n = O(t) && w.fromString(t);
            if (n) {
                if (!n.matches(this.$current.name)) return !1;
                t = this.$current.name;
            }
            var i = this.router.stateRegistry.matcher.find(t, r.relative), o = this.$current.includes;
            if (E(i)) {
                if (!E(o[i.name])) return !1;
                if (!e) return !0;
                var a = i.parameters({
                    inherit: !0,
                    matchingKeys: e
                });
                return se.equals(a, se.values(a, e), this.params);
            }
        }, e.prototype.href = function(t, e, r) {
            r = it(r, {
                lossy: !0,
                inherit: !0,
                absolute: !1,
                relative: this.$current
            }), e = e || {};
            var n = this.router.stateRegistry.matcher.find(t, r.relative);
            if (!E(n)) return null;
            r.inherit && (e = this.params.$inherit(e, this.$current, n));
            var i = n && r.lossy ? n.navigable : n;
            return i && void 0 !== i.url && null !== i.url ? this.router.urlRouter.href(i.url, e, {
                absolute: r.absolute
            }) : null;
        }, e.prototype.defaultErrorHandler = function(t) {
            return this._defaultErrorHandler = t || this._defaultErrorHandler;
        }, e.prototype.get = function(t, e) {
            var r = this.router.stateRegistry;
            return 0 === arguments.length ? r.get() : r.get(t, e || this.$current);
        }, e.prototype.lazyLoad = function(t, e) {
            var r = this.get(t);
            if (!r || !r.lazyLoad) throw new Error("Can not lazy load " + t);
            var n = this.getCurrentPath(), i = fe.makeTargetState(this.router.stateRegistry, n);
            return Dr(e = e || this.router.transitionService.create(n, i), r);
        }, e;
    }(), Br = {
        when: function(t) {
            return new Promise(function(e, r) {
                return e(t);
            });
        },
        reject: function(t) {
            return new Promise(function(e, r) {
                r(t);
            });
        },
        defer: function() {
            var t = {};
            return t.promise = new Promise(function(e, r) {
                t.resolve = e, t.reject = r;
            }), t;
        },
        all: function(t) {
            if (V(t)) return Promise.all(t);
            if (x(t)) {
                var e = Object.keys(t).map(function(e) {
                    return t[e].then(function(t) {
                        return {
                            key: e,
                            val: t
                        };
                    });
                });
                return Br.all(e).then(function(t) {
                    return t.reduce(function(t, e) {
                        return t[e.key] = e.val, t;
                    }, {});
                });
            }
        }
    }, Gr = {}, Wr = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm, zr = /([^\s,]+)/g, Jr = {
        get: function(t) {
            return Gr[t];
        },
        has: function(t) {
            return null != Jr.get(t);
        },
        invoke: function(t, e, r) {
            var n = G({}, Gr, r || {}), i = Jr.annotate(t), o = bt(function(t) {
                return n.hasOwnProperty(t);
            }, function(t) {
                return "DI can't find injectable: '" + t + "'";
            }), a = i.filter(o).map(function(t) {
                return n[t];
            });
            return P(t) ? t.apply(e, a) : t.slice(-1)[0].apply(e, a);
        },
        annotate: function(t) {
            if (!H(t)) throw new Error("Not an injectable function: " + t);
            if (t && t.$inject) return t.$inject;
            if (V(t)) return t.slice(0, -1);
            var e = t.toString().replace(Wr, "");
            return e.slice(e.indexOf("(") + 1, e.indexOf(")")).match(zr) || [];
        }
    }, Qr = function(t, e) {
        var r = e[0], n = e[1];
        return t.hasOwnProperty(r) ? V(t[r]) ? t[r].push(n) : t[r] = [ t[r], n ] : t[r] = n, 
        t;
    }, Kr = function(t) {
        return t.split("&").filter(z).map(Ae).reduce(Qr, {});
    };
    function Yr(t) {
        var e = function(t) {
            return t || "";
        }, r = Ie(t).map(e), n = r[0], i = r[1], o = je(n).map(e);
        return {
            path: o[0],
            search: o[1],
            hash: i,
            url: t
        };
    }
    var Zr = function(t) {
        var e = t.path(), r = t.search(), n = t.hash(), i = Object.keys(r).map(function(t) {
            var e = r[t];
            return (V(e) ? e : [ e ]).map(function(e) {
                return t + "=" + e;
            });
        }).reduce(yt, []).join("&");
        return e + (i ? "?" + i : "") + (n ? "#" + n : "");
    };
    function Xr(t, e, r, n) {
        return function(i) {
            var o = i.locationService = new r(i), a = i.locationConfig = new n(i, e);
            return {
                name: t,
                service: o,
                configuration: a,
                dispose: function(t) {
                    t.dispose(o), t.dispose(a);
                }
            };
        };
    }
    var tn, en = function() {
        function t(t, e) {
            var r = this;
            this.fireAfterUpdate = e, this._listeners = [], this._listener = function(t) {
                return r._listeners.forEach(function(e) {
                    return e(t);
                });
            }, this.hash = function() {
                return Yr(r._get()).hash;
            }, this.path = function() {
                return Yr(r._get()).path;
            }, this.search = function() {
                return Kr(Yr(r._get()).search);
            }, this._location = F.location, this._history = F.history;
        }
        return t.prototype.url = function(t, e) {
            return void 0 === e && (e = !0), E(t) && t !== this._get() && (this._set(null, null, t, e), 
            this.fireAfterUpdate && this._listeners.forEach(function(e) {
                return e({
                    url: t
                });
            })), Zr(this);
        }, t.prototype.onChange = function(t) {
            var e = this;
            return this._listeners.push(t), function() {
                return X(e._listeners, t);
            };
        }, t.prototype.dispose = function(t) {
            nt(this._listeners);
        }, t;
    }(), rn = (tn = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(t, e) {
        t.__proto__ = e;
    } || function(t, e) {
        for (var r in e) e.hasOwnProperty(r) && (t[r] = e[r]);
    }, function(t, e) {
        function r() {
            this.constructor = t;
        }
        tn(t, e), t.prototype = null === e ? Object.create(e) : (r.prototype = e.prototype, 
        new r());
    }), nn = function(t) {
        function e(e) {
            var r = t.call(this, e, !1) || this;
            return F.addEventListener("hashchange", r._listener, !1), r;
        }
        return rn(e, t), e.prototype._get = function() {
            return He(this._location.hash);
        }, e.prototype._set = function(t, e, r, n) {
            this._location.hash = r;
        }, e.prototype.dispose = function(e) {
            t.prototype.dispose.call(this, e), F.removeEventListener("hashchange", this._listener);
        }, e;
    }(en), on = function() {
        var t = Object.setPrototypeOf || {
            __proto__: []
        } instanceof Array && function(t, e) {
            t.__proto__ = e;
        } || function(t, e) {
            for (var r in e) e.hasOwnProperty(r) && (t[r] = e[r]);
        };
        return function(e, r) {
            function n() {
                this.constructor = e;
            }
            t(e, r), e.prototype = null === r ? Object.create(r) : (n.prototype = r.prototype, 
            new n());
        };
    }(), an = function(t) {
        function e(e) {
            return t.call(this, e, !0) || this;
        }
        return on(e, t), e.prototype._get = function() {
            return this._url;
        }, e.prototype._set = function(t, e, r, n) {
            this._url = r;
        }, e;
    }(en), un = function() {
        var t = Object.setPrototypeOf || {
            __proto__: []
        } instanceof Array && function(t, e) {
            t.__proto__ = e;
        } || function(t, e) {
            for (var r in e) e.hasOwnProperty(r) && (t[r] = e[r]);
        };
        return function(e, r) {
            function n() {
                this.constructor = e;
            }
            t(e, r), e.prototype = null === r ? Object.create(r) : (n.prototype = r.prototype, 
            new n());
        };
    }(), sn = function(t) {
        function e(e) {
            var r = t.call(this, e, !0) || this;
            return r._config = e.urlService.config, F.addEventListener("popstate", r._listener, !1), 
            r;
        }
        return un(e, t), e.prototype._getBasePrefix = function() {
            return Ve(this._config.baseHref());
        }, e.prototype._get = function() {
            var t = this._location, e = t.pathname, r = t.hash, n = t.search;
            n = je(n)[1], r = Ie(r)[1];
            var i = this._getBasePrefix(), o = e === this._config.baseHref(), a = e.substr(0, i.length) === i;
            return (e = o ? "/" : a ? e.substring(i.length) : e) + (n ? "?" + n : "") + (r ? "#" + r : "");
        }, e.prototype._set = function(t, e, r, n) {
            var i = this._getBasePrefix(), o = r && "/" !== r[0] ? "/" : "", a = "" === r || "/" === r ? this._config.baseHref() : i + o + r;
            n ? this._history.replaceState(t, e, a) : this._history.pushState(t, e, a);
        }, e.prototype.dispose = function(e) {
            t.prototype.dispose.call(this, e), F.removeEventListener("popstate", this._listener);
        }, e;
    }(en), cn = function() {
        var t = this;
        this.dispose = J, this._baseHref = "", this._port = 80, this._protocol = "http", 
        this._host = "localhost", this._hashPrefix = "", this.port = function() {
            return t._port;
        }, this.protocol = function() {
            return t._protocol;
        }, this.host = function() {
            return t._host;
        }, this.baseHref = function() {
            return t._baseHref;
        }, this.html5Mode = function() {
            return !1;
        }, this.hashPrefix = function(e) {
            return E(e) ? t._hashPrefix = e : t._hashPrefix;
        };
    }, fn = function() {
        function t(t, e) {
            void 0 === e && (e = !1), this._isHtml5 = e, this._baseHref = void 0, this._hashPrefix = "";
        }
        return t.prototype.port = function() {
            return location.port ? Number(location.port) : "https" === this.protocol() ? 443 : 80;
        }, t.prototype.protocol = function() {
            return location.protocol.replace(/:/g, "");
        }, t.prototype.host = function() {
            return location.hostname;
        }, t.prototype.html5Mode = function() {
            return this._isHtml5;
        }, t.prototype.hashPrefix = function(t) {
            return E(t) ? this._hashPrefix = t : this._hashPrefix;
        }, t.prototype.baseHref = function(t) {
            return E(t) ? this._baseHref = t : E(this._baseHref) ? this._baseHref : this.applyDocumentBaseHref();
        }, t.prototype.applyDocumentBaseHref = function() {
            var t = document.getElementsByTagName("base")[0];
            return this._baseHref = t ? t.href.substr(location.origin.length) : location.pathname || "/";
        }, t.prototype.dispose = function() {}, t;
    }();
    function ln(t) {
        return N.$injector = Jr, {
            name: "vanilla.services",
            $q: N.$q = Br,
            $injector: Jr,
            dispose: function() {
                return null;
            }
        };
    }
    var hn = Xr("vanilla.hashBangLocation", !1, nn, fn), pn = Xr("vanilla.pushStateLocation", !0, sn, fn), vn = Xr("vanilla.memoryLocation", !1, an, cn), dn = function() {
        function t() {}
        return t.prototype.dispose = function(t) {}, t;
    }(), mn = Object.freeze({
        root: F,
        fromJson: L,
        toJson: M,
        forEach: B,
        extend: G,
        equals: W,
        identity: z,
        noop: J,
        createProxyFunctions: Q,
        inherit: K,
        inArray: Y,
        _inArray: Z,
        removeFrom: X,
        _removeFrom: tt,
        pushTo: et,
        _pushTo: rt,
        deregAll: nt,
        defaults: it,
        mergeR: ot,
        ancestors: at,
        pick: ut,
        omit: st,
        pluck: ct,
        filter: ft,
        find: lt,
        mapObj: ht,
        map: pt,
        values: vt,
        allTrueR: dt,
        anyTrueR: mt,
        unnestR: yt,
        flattenR: gt,
        pushR: _t,
        uniqR: wt,
        unnest: $t,
        flatten: St,
        assertPredicate: bt,
        assertMap: Rt,
        assertFn: Et,
        pairs: Ct,
        arrayTuples: Tt,
        applyPairs: Pt,
        tail: kt,
        copy: Ot,
        _extend: xt,
        silenceUncaughtInPromise: jt,
        silentRejection: At,
        notImplemented: q,
        services: N,
        Glob: w,
        curry: i,
        compose: o,
        pipe: a,
        prop: u,
        propEq: s,
        parse: c,
        not: f,
        and: l,
        or: h,
        all: p,
        any: v,
        is: d,
        eq: m,
        val: y,
        invoke: g,
        pattern: _,
        isUndefined: R,
        isDefined: E,
        isNull: C,
        isNullOrUndefined: T,
        isFunction: P,
        isNumber: k,
        isString: O,
        isObject: x,
        isArray: V,
        isDate: I,
        isRegExp: j,
        isState: A,
        isInjectable: H,
        isPromise: D,
        Queue: Ht,
        maxLength: Se,
        padString: be,
        kebobString: Re,
        functionToString: Ee,
        fnToString: Ce,
        stringify: ke,
        beforeAfterSubstr: Oe,
        hostRegex: xe,
        stripLastPathElement: Ve,
        splitHash: Ie,
        splitQuery: je,
        splitEqual: Ae,
        trimHashVal: He,
        splitOnDelim: De,
        joinNeighborsR: qe,
        get Category() {
            return t.Category;
        },
        Trace: Qt,
        trace: Kt,
        get DefType() {
            return t.DefType;
        },
        Param: se,
        ParamTypes: Fe,
        StateParams: Ue,
        ParamType: ie,
        PathNode: ce,
        PathUtils: fe,
        resolvePolicies: pe,
        defaultResolvePolicy: le,
        Resolvable: he,
        NATIVE_INJECTOR_TOKEN: ye,
        ResolveContext: ge,
        resolvablesBuilder: Ke,
        StateBuilder: Ye,
        StateObject: $,
        StateMatcher: Ze,
        StateQueueManager: Xe,
        StateRegistry: tr,
        StateService: Mr,
        TargetState: Yt,
        get TransitionHookPhase() {
            return t.TransitionHookPhase;
        },
        get TransitionHookScope() {
            return t.TransitionHookScope;
        },
        HookBuilder: ne,
        matchState: te,
        RegisteredHook: ee,
        makeEvent: re,
        get RejectType() {
            return t.RejectType;
        },
        Rejection: qt,
        Transition: $e,
        TransitionHook: Xt,
        TransitionEventType: qr,
        defaultTransOpts: Ur,
        TransitionService: Lr,
        UrlMatcher: nr,
        UrlMatcherFactory: ir,
        UrlRouter: sr,
        UrlRuleFactory: or,
        BaseUrlRule: ar,
        UrlService: gr,
        ViewService: fr,
        UIRouterGlobals: lr,
        UIRouter: wr,
        $q: Br,
        $injector: Jr,
        BaseLocationServices: en,
        HashLocationService: nn,
        MemoryLocationService: an,
        PushStateLocationService: sn,
        MemoryLocationConfig: cn,
        BrowserLocationConfig: fn,
        keyValsToObjectR: Qr,
        getParams: Kr,
        parseUrl: Yr,
        buildUrl: Zr,
        locationPluginFactory: Xr,
        servicesPlugin: ln,
        hashLocationPlugin: hn,
        pushStateLocationPlugin: pn,
        memoryLocationPlugin: vn,
        UIRouterPluginBase: dn
    });
    function yn() {
        var t = null;
        return function(e, r) {
            return t = t || N.$injector.get("$templateFactory"), [ new $n(e, r, t) ];
        };
    }
    var gn = function(t, e) {
        return t.reduce(function(t, r) {
            return t || E(e[r]);
        }, !1);
    };
    function _n(t) {
        if (!t.parent) return {};
        var e = [ "component", "bindings", "componentProvider" ], r = [ "templateProvider", "templateUrl", "template", "notify", "async" ].concat([ "controller", "controllerProvider", "controllerAs", "resolveAs" ]), n = e.concat(r);
        if (E(t.views) && gn(n, t)) throw new Error("State '" + t.name + "' has a 'views' object. It cannot also have \"view properties\" at the state level.  Move the following properties into a view (in the 'views' object):  " + n.filter(function(e) {
            return E(t[e]);
        }).join(", "));
        var i = {}, o = t.views || {
            $default: ut(t, n)
        };
        return B(o, function(n, o) {
            if (o = o || "$default", O(n) && (n = {
                component: n
            }), n = G({}, n), gn(e, n) && gn(r, n)) throw new Error("Cannot combine: " + e.join("|") + " with: " + r.join("|") + " in stateview: '" + o + "@" + t.name + "'");
            n.resolveAs = n.resolveAs || "$resolve", n.$type = "ng1", n.$context = t, n.$name = o;
            var a = fr.normalizeUIViewTarget(n.$context, n.$name);
            n.$uiViewName = a.uiViewName, n.$uiViewContextAnchor = a.uiViewContextAnchor, i[o] = n;
        }), i;
    }
    var wn = 0, $n = function() {
        function t(t, e, r) {
            var n = this;
            this.path = t, this.viewDecl = e, this.factory = r, this.$id = wn++, this.loaded = !1, 
            this.getTemplate = function(t, e) {
                return n.component ? n.factory.makeComponentTemplate(t, e, n.component, n.viewDecl.bindings) : n.template;
            };
        }
        return t.prototype.load = function() {
            var t = this, e = N.$q, r = new ge(this.path), n = this.path.reduce(function(t, e) {
                return G(t, e.paramValues);
            }, {}), i = {
                template: e.when(this.factory.fromConfig(this.viewDecl, n, r)),
                controller: e.when(this.getController(r))
            };
            return e.all(i).then(function(e) {
                return Kt.traceViewServiceEvent("Loaded", t), t.controller = e.controller, G(t, e.template), 
                t;
            });
        }, t.prototype.getController = function(t) {
            var e = this.viewDecl.controllerProvider;
            if (!H(e)) return this.viewDecl.controller;
            var r = N.$injector.annotate(e), n = V(e) ? kt(e) : e;
            return new he("", n, r).get(t);
        }, t;
    }(), Sn = function() {
        function t() {
            var t = this;
            this._useHttp = n.version.minor < 3, this.$get = [ "$http", "$templateCache", "$injector", function(e, r, n) {
                return t.$templateRequest = n.has && n.has("$templateRequest") && n.get("$templateRequest"), 
                t.$http = e, t.$templateCache = r, t;
            } ];
        }
        return t.prototype.useHttpService = function(t) {
            this._useHttp = t;
        }, t.prototype.fromConfig = function(t, e, r) {
            var n = function(t) {
                return N.$q.when(t).then(function(t) {
                    return {
                        template: t
                    };
                });
            }, i = function(t) {
                return N.$q.when(t).then(function(t) {
                    return {
                        component: t
                    };
                });
            };
            return E(t.template) ? n(this.fromString(t.template, e)) : E(t.templateUrl) ? n(this.fromUrl(t.templateUrl, e)) : E(t.templateProvider) ? n(this.fromProvider(t.templateProvider, e, r)) : E(t.component) ? i(t.component) : E(t.componentProvider) ? i(this.fromComponentProvider(t.componentProvider, e, r)) : n("<ui-view></ui-view>");
        }, t.prototype.fromString = function(t, e) {
            return P(t) ? t(e) : t;
        }, t.prototype.fromUrl = function(t, e) {
            return P(t) && (t = t(e)), null == t ? null : this._useHttp ? this.$http.get(t, {
                cache: this.$templateCache,
                headers: {
                    Accept: "text/html"
                }
            }).then(function(t) {
                return t.data;
            }) : this.$templateRequest(t);
        }, t.prototype.fromProvider = function(t, e, r) {
            var n = N.$injector.annotate(t), i = V(t) ? kt(t) : t;
            return new he("", i, n).get(r);
        }, t.prototype.fromComponentProvider = function(t, e, r) {
            var n = N.$injector.annotate(t), i = V(t) ? kt(t) : t;
            return new he("", i, n).get(r);
        }, t.prototype.makeComponentTemplate = function(t, e, r, i) {
            i = i || {};
            var o = 3 <= n.version.minor ? "::" : "", a = function(t) {
                var e = Re(t);
                return /^(x|data)-/.exec(e) ? "x-" + e : e;
            }, u = function(t) {
                var e = N.$injector.get(t + "Directive");
                if (!e || !e.length) throw new Error("Unable to find component named '" + t + "'");
                return e.map(bn).reduce(yt, []);
            }(r).map(function(r) {
                var n = r.name, u = r.type, s = a(n);
                if (t.attr(s) && !i[n]) return s + "='" + t.attr(s) + "'";
                var c = i[n] || n;
                if ("@" === u) return s + "='{{" + o + "$resolve." + c + "}}'";
                if ("&" === u) {
                    var f = e.getResolvable(c), l = f && f.data, h = l && N.$injector.annotate(l) || [];
                    return s + "='$resolve." + c + (V(l) ? "[" + (l.length - 1) + "]" : "") + "(" + h.join(",") + ")'";
                }
                return s + "='" + o + "$resolve." + c + "'";
            }).join(" "), s = a(r);
            return "<" + s + " " + u + "></" + s + ">";
        }, t;
    }(), bn = function(t) {
        return x(t.bindToController) ? Rn(t.bindToController) : Rn(t.scope);
    }, Rn = function(t) {
        return Object.keys(t || {}).map(function(e) {
            return [ e, /^([=<@&])[?]?(.*)/.exec(t[e]) ];
        }).filter(function(t) {
            return E(t) && V(t[1]);
        }).map(function(t) {
            return {
                name: t[1][2] || t[0],
                type: t[1][1]
            };
        });
    }, En = function() {
        function t(e, r) {
            this.stateRegistry = e, this.stateService = r, Q(y(t.prototype), this, y(this));
        }
        return t.prototype.decorator = function(t, e) {
            return this.stateRegistry.decorator(t, e) || this;
        }, t.prototype.state = function(t, e) {
            return x(t) ? e = t : e.name = t, this.stateRegistry.register(e), this;
        }, t.prototype.onInvalid = function(t) {
            return this.stateService.onInvalid(t);
        }, t;
    }(), Cn = function(t) {
        return function(e, r) {
            var n = e[t], i = "onExit" === t ? "from" : "to";
            return n ? function(t, e) {
                var r = new ge(t.treeChanges(i)).subContext(e.$$state()), o = G(Mn(r), {
                    $state$: e,
                    $transition$: t
                });
                return N.$injector.invoke(n, this, o);
            } : void 0;
        };
    }, Tn = function() {
        function t(t) {
            this._urlListeners = [], this.$locationProvider = t;
            var e = y(t);
            Q(e, this, e, [ "hashPrefix" ]);
        }
        return t.monkeyPatchPathParameterType = function(t) {
            var e = t.urlMatcherFactory.type("path");
            e.encode = function(t) {
                return null != t ? t.toString().replace(/(~|\/)/g, function(t) {
                    return {
                        "~": "~~",
                        "/": "~2F"
                    }[t];
                }) : t;
            }, e.decode = function(t) {
                return null != t ? t.toString().replace(/(~~|~2F)/g, function(t) {
                    return {
                        "~~": "~",
                        "~2F": "/"
                    }[t];
                }) : t;
            };
        }, t.prototype.dispose = function() {}, t.prototype.onChange = function(t) {
            var e = this;
            return this._urlListeners.push(t), function() {
                return X(e._urlListeners)(t);
            };
        }, t.prototype.html5Mode = function() {
            var t = this.$locationProvider.html5Mode();
            return (t = x(t) ? t.enabled : t) && this.$sniffer.history;
        }, t.prototype.url = function(t, e, r) {
            return void 0 === e && (e = !1), E(t) && this.$location.url(t), e && this.$location.replace(), 
            r && this.$location.state(r), this.$location.url();
        }, t.prototype._runtimeServices = function(t, e, r, n) {
            var i = this;
            this.$location = e, this.$sniffer = r, t.$on("$locationChangeSuccess", function(t) {
                return i._urlListeners.forEach(function(e) {
                    return e(t);
                });
            });
            var o = y(e), a = y(n);
            Q(o, this, o, [ "replace", "path", "search", "hash" ]), Q(o, this, o, [ "port", "protocol", "host" ]), 
            Q(a, this, a, [ "baseHref" ]);
        }, t;
    }(), Pn = function() {
        function t(t) {
            this._router = t, this._urlRouter = t.urlRouter;
        }
        return t.injectableHandler = function(t, e) {
            return function(r) {
                return N.$injector.invoke(e, null, {
                    $match: r,
                    $stateParams: t.globals.params
                });
            };
        }, t.prototype.$get = function() {
            var t = this._urlRouter;
            return t.update(!0), t.interceptDeferred || t.listen(), t;
        }, t.prototype.rule = function(t) {
            var e = this;
            if (!P(t)) throw new Error("'rule' must be a function");
            var r = new ar(function() {
                return t(N.$injector, e._router.locationService);
            }, z);
            return this._urlRouter.rule(r), this;
        }, t.prototype.otherwise = function(t) {
            var e = this, r = this._urlRouter;
            if (O(t)) r.otherwise(t); else {
                if (!P(t)) throw new Error("'rule' must be a string or function");
                r.otherwise(function() {
                    return t(N.$injector, e._router.locationService);
                });
            }
            return this;
        }, t.prototype.when = function(e, r) {
            return (V(r) || P(r)) && (r = t.injectableHandler(this._router, r)), this._urlRouter.when(e, r), 
            this;
        }, t.prototype.deferIntercept = function(t) {
            this._urlRouter.deferIntercept(t);
        }, t;
    }();
    n.module("ui.router.angular1", []);
    var kn = n.module("ui.router.init", [ "ng" ]), On = n.module("ui.router.util", [ "ui.router.init" ]), xn = n.module("ui.router.router", [ "ui.router.util" ]), Vn = n.module("ui.router.state", [ "ui.router.router", "ui.router.util", "ui.router.angular1" ]), In = n.module("ui.router", [ "ui.router.init", "ui.router.state", "ui.router.angular1" ]), jn = (n.module("ui.router.compat", [ "ui.router" ]), 
    null);
    function An(t) {
        (jn = this.router = new wr()).stateProvider = new En(jn.stateRegistry, jn.stateService), 
        jn.stateRegistry.decorator("views", _n), jn.stateRegistry.decorator("onExit", Cn("onExit")), 
        jn.stateRegistry.decorator("onRetain", Cn("onRetain")), jn.stateRegistry.decorator("onEnter", Cn("onEnter")), 
        jn.viewService._pluginapi._viewConfigFactory("ng1", yn());
        var e = jn.locationService = jn.locationConfig = new Tn(t);
        function r(t, r, n, i, o, a) {
            return e._runtimeServices(i, t, n, r), delete jn.router, delete jn.$get, jn;
        }
        return Tn.monkeyPatchPathParameterType(jn), ((jn.router = jn).$get = r).$inject = [ "$location", "$browser", "$sniffer", "$rootScope", "$http", "$templateCache" ], 
        jn;
    }
    An.$inject = [ "$locationProvider" ];
    var Hn = function(t) {
        return [ "$uiRouterProvider", function(e) {
            var r = e.router[t];
            return r.$get = function() {
                return r;
            }, r;
        } ];
    };
    function Dn(t, e, r) {
        N.$injector = t, N.$q = e, r.stateRegistry.get().map(function(t) {
            return t.$$state().resolvables;
        }).reduce(yt, []).filter(function(t) {
            return "deferred" === t.deps;
        }).forEach(function(e) {
            return e.deps = t.annotate(e.resolveFn, t.strictDi);
        });
    }
    function qn(t) {
        t.$watch(function() {
            Kt.approximateDigests++;
        });
    }
    Dn.$inject = [ "$injector", "$q", "$uiRouter" ], qn.$inject = [ "$rootScope" ], 
    kn.provider("$uiRouter", An), xn.provider("$urlRouter", [ "$uiRouterProvider", function(t) {
        return t.urlRouterProvider = new Pn(t);
    } ]), On.provider("$urlService", Hn("urlService")), On.provider("$urlMatcherFactory", [ "$uiRouterProvider", function() {
        return jn.urlMatcherFactory;
    } ]), On.provider("$templateFactory", function() {
        return new Sn();
    }), Vn.provider("$stateRegistry", Hn("stateRegistry")), Vn.provider("$uiRouterGlobals", Hn("globals")), 
    Vn.provider("$transitions", Hn("transitionService")), Vn.provider("$state", [ "$uiRouterProvider", function() {
        return G(jn.stateProvider, {
            $get: function() {
                return jn.stateService;
            }
        });
    } ]), Vn.factory("$stateParams", [ "$uiRouter", function(t) {
        return t.globals.params;
    } ]), In.factory("$view", function() {
        return jn.viewService;
    }), In.service("$trace", function() {
        return Kt;
    }), In.run(qn), On.run([ "$urlMatcherFactory", function(t) {} ]), Vn.run([ "$state", function(t) {} ]), 
    xn.run([ "$urlRouter", function(t) {} ]), kn.run(Dn);
    var Nn, Fn, Un, Ln, Mn = function(t) {
        return t.getTokens().filter(O).map(function(e) {
            var r = t.getResolvable(e);
            return [ e, "NOWAIT" === t.getPolicy(r).async ? r.promise : r.data ];
        }).reduce(Pt, {});
    };
    function Bn(t) {
        var e, r = t.match(/^\s*({[^}]*})\s*$/);
        if (r && (t = "(" + r[1] + ")"), !(e = t.replace(/\n/g, " ").match(/^\s*([^(]*?)\s*(\((.*)\))?\s*$/)) || 4 !== e.length) throw new Error("Invalid state ref '" + t + "'");
        return {
            state: e[1] || null,
            paramExpr: e[3] || null
        };
    }
    function Gn(t) {
        var e = t.parent().inheritedData("$uiView"), r = c("$cfg.path")(e);
        return r ? kt(r).state.name : void 0;
    }
    function Wn(t, e, r) {
        var n = r.uiState || t.current.name, i = G(function(t, e) {
            return {
                relative: Gn(t) || e.$current,
                inherit: !0,
                source: "sref"
            };
        }(e, t), r.uiStateOpts || {}), o = t.href(n, r.uiStateParams, i);
        return {
            uiState: n,
            uiStateParams: r.uiStateParams,
            uiStateOpts: i,
            href: o
        };
    }
    function zn(t) {
        var e = "[object SVGAnimatedString]" === Object.prototype.toString.call(t.prop("href")), r = "FORM" === t[0].nodeName;
        return {
            attr: r ? "action" : e ? "xlink:href" : "href",
            isAnchor: "A" === t.prop("tagName").toUpperCase(),
            clickable: !r
        };
    }
    function Jn(t, e, r, n, i) {
        return function(o) {
            var a = o.which || o.button, u = i();
            if (!(1 < a || o.ctrlKey || o.metaKey || o.shiftKey || t.attr("target"))) {
                var s = r(function() {
                    t.attr("disabled") || e.go(u.uiState, u.uiStateParams, u.uiStateOpts);
                });
                o.preventDefault();
                var c = n.isAnchor && !u.href ? 1 : 0;
                o.preventDefault = function() {
                    c-- <= 0 && r.cancel(s);
                };
            }
        };
    }
    function Qn(t, e, r, n) {
        var i;
        n && (i = n.events), V(i) || (i = [ "click" ]);
        for (var o = t.on ? "on" : "bind", a = 0, u = i; a < u.length; a++) {
            var s = u[a];
            t[o](s, r);
        }
        e.$on("$destroy", function() {
            for (var e = t.off ? "off" : "unbind", n = 0, o = i; n < o.length; n++) {
                var a = o[n];
                t[e](a, r);
            }
        });
    }
    function Kn(t) {
        var e = function(e, r, n) {
            return t.is(e, r, n);
        };
        return e.$stateful = !0, e;
    }
    function Yn(t) {
        var e = function(e, r, n) {
            return t.includes(e, r, n);
        };
        return e.$stateful = !0, e;
    }
    function Zn(t, e, r, i, o, a) {
        var u = c("viewDecl.controllerAs"), s = c("viewDecl.resolveAs");
        return {
            restrict: "ECA",
            priority: -400,
            compile: function(i) {
                var a = i.html();
                return i.empty(), function(i, c) {
                    var f = c.data("$uiView");
                    if (!f) return c.html(a), void t(c.contents())(i);
                    var l = f.$cfg || {
                        viewDecl: {},
                        getTemplate: J
                    }, h = l.path && new ge(l.path);
                    c.html(l.getTemplate(c, h) || a), Kt.traceUIViewFill(f.$uiView, c.html());
                    var p = t(c.contents()), v = l.controller, d = u(l), m = s(l), y = h && Mn(h);
                    if (i[m] = y, v) {
                        var g = e(v, G({}, y, {
                            $scope: i,
                            $element: c
                        }));
                        d && (i[d] = g, i[d][m] = y), c.data("$ngControllerController", g), c.children().data("$ngControllerController", g), 
                        ei(o, r, g, i, l);
                    }
                    if (O(l.viewDecl.component)) var _ = l.viewDecl.component, w = Re(_), $ = new RegExp("^(x-|data-)?" + w + "$", "i"), S = i.$watch(function() {
                        var t = [].slice.call(c[0].children).filter(function(t) {
                            return t && t.tagName && $.exec(t.tagName);
                        });
                        return t && n.element(t).data("$" + _ + "Controller");
                    }, function(t) {
                        t && (ei(o, r, t, i, l), S());
                    });
                    p(i);
                };
            }
        };
    }
    Nn = [ "$uiRouter", "$timeout", function(t, e) {
        var r = t.stateService;
        return {
            restrict: "A",
            require: [ "?^uiSrefActive", "?^uiSrefActiveEq" ],
            link: function(n, i, o, a) {
                var u, s = zn(i), c = a[1] || a[0], f = null, l = {}, h = function() {
                    return Wn(r, i, l);
                }, p = Bn(o.uiSref);
                function v() {
                    var t = h();
                    f && f(), c && (f = c.$$addStateInfo(t.uiState, t.uiStateParams)), null != t.href && o.$set(s.attr, t.href);
                }
                l.uiState = p.state, l.uiStateOpts = o.uiSrefOpts ? n.$eval(o.uiSrefOpts) : {}, 
                p.paramExpr && (n.$watch(p.paramExpr, function(t) {
                    l.uiStateParams = G({}, t), v();
                }, !0), l.uiStateParams = G({}, n.$eval(p.paramExpr))), v(), n.$on("$destroy", t.stateRegistry.onStatesChanged(v)), 
                n.$on("$destroy", t.transitionService.onSuccess({}, v)), s.clickable && (u = Jn(i, r, e, s, h), 
                Qn(i, n, u, l.uiStateOpts));
            }
        };
    } ], Fn = [ "$uiRouter", "$timeout", function(t, e) {
        var r = t.stateService;
        return {
            restrict: "A",
            require: [ "?^uiSrefActive", "?^uiSrefActiveEq" ],
            link: function(n, i, o, a) {
                var u, s = zn(i), c = a[1] || a[0], f = null, l = {}, h = function() {
                    return Wn(r, i, l);
                }, p = [ "uiState", "uiStateParams", "uiStateOpts" ], v = p.reduce(function(t, e) {
                    return t[e] = J, t;
                }, {});
                function d() {
                    var t = h();
                    f && f(), c && (f = c.$$addStateInfo(t.uiState, t.uiStateParams)), null != t.href && o.$set(s.attr, t.href);
                }
                p.forEach(function(t) {
                    l[t] = o[t] ? n.$eval(o[t]) : null, o.$observe(t, function(e) {
                        v[t](), v[t] = n.$watch(e, function(e) {
                            l[t] = e, d();
                        }, !0);
                    });
                }), d(), n.$on("$destroy", t.stateRegistry.onStatesChanged(d)), n.$on("$destroy", t.transitionService.onSuccess({}, d)), 
                s.clickable && (u = Jn(i, r, e, s, h), Qn(i, n, u, l.uiStateOpts));
            }
        };
    } ], Un = [ "$state", "$stateParams", "$interpolate", "$uiRouter", function(t, e, r, n) {
        return {
            restrict: "A",
            controller: [ "$scope", "$element", "$attrs", function(e, i, o) {
                var a, u, s, c, f, l = [];
                a = r(o.uiSrefActiveEq || "", !1)(e);
                try {
                    u = e.$eval(o.uiSrefActive);
                } catch (t) {}
                function h(t) {
                    t.promise.then(m, J);
                }
                function v(t) {
                    x(t) && (l = [], B(t, function(t, r) {
                        var n = function(t, r) {
                            var n = Bn(t);
                            d(n.state, e.$eval(n.paramExpr), r);
                        };
                        O(t) ? n(t, r) : V(t) && B(t, function(t) {
                            n(t, r);
                        });
                    }));
                }
                function d(e, r, n) {
                    var o = {
                        state: t.get(e, Gn(i)) || {
                            name: e
                        },
                        params: r,
                        activeClass: n
                    };
                    return l.push(o), function() {
                        X(l)(o);
                    };
                }
                function m() {
                    var r = function(t) {
                        return t.split(/\s/).filter(z);
                    }, n = function(t) {
                        return t.map(function(t) {
                            return t.activeClass;
                        }).map(r).reduce(yt, []);
                    }, o = n(l).concat(r(a)).reduce(wt, []), u = n(l.filter(function(e) {
                        return t.includes(e.state.name, e.params);
                    })), s = l.filter(function(e) {
                        return t.is(e.state.name, e.params);
                    }).length ? r(a) : [], c = u.concat(s).reduce(wt, []), f = o.filter(function(t) {
                        return !Y(c, t);
                    });
                    e.$evalAsync(function() {
                        c.forEach(function(t) {
                            return i.addClass(t);
                        }), f.forEach(function(t) {
                            return i.removeClass(t);
                        });
                    });
                }
                v(u = u || r(o.uiSrefActive || "", !1)(e)), this.$$addStateInfo = function(t, e) {
                    if (!(x(u) && 0 < l.length)) {
                        var r = d(t, e, u);
                        return m(), r;
                    }
                }, e.$on("$destroy", (s = n.stateRegistry.onStatesChanged(function() {
                    v(u);
                }), c = n.transitionService.onStart({}, h), f = e.$on("$stateChangeSuccess", m), 
                function() {
                    s(), c(), f();
                })), n.globals.transition && h(n.globals.transition), m();
            } ]
        };
    } ], n.module("ui.router.state").directive("uiSref", Nn).directive("uiSrefActive", Un).directive("uiSrefActiveEq", Un).directive("uiState", Fn), 
    Kn.$inject = [ "$state" ], Yn.$inject = [ "$state" ], n.module("ui.router.state").filter("isState", Kn).filter("includedByState", Yn), 
    Ln = [ "$view", "$animate", "$uiViewScroll", "$interpolate", "$q", function(t, e, r, i, o) {
        var a = {
            $cfg: {
                viewDecl: {
                    $context: t._pluginapi._rootViewContext()
                }
            },
            $uiView: {}
        }, u = {
            count: 0,
            restrict: "ECA",
            terminal: !0,
            priority: 400,
            transclude: "element",
            compile: function(s, f, l) {
                return function(s, f, h) {
                    var p, v, d, m, y, g = h.onload || "", _ = h.autoscroll, w = {
                        enter: function(t, r, i) {
                            2 < n.version.minor ? e.enter(t, null, r).then(i) : e.enter(t, null, r, i);
                        },
                        leave: function(t, r) {
                            2 < n.version.minor ? e.leave(t).then(r) : e.leave(t, r);
                        }
                    }, $ = f.inheritedData("$uiView") || a, S = i(h.uiView || h.name || "")(s) || "$default", b = {
                        $type: "ng1",
                        id: u.count++,
                        name: S,
                        fqn: $.$uiView.fqn ? $.$uiView.fqn + "." + S : S,
                        config: null,
                        configUpdated: function(t) {
                            (!t || t instanceof $n) && (m !== t && (Kt.traceUIViewConfigUpdated(b, t && t.viewDecl && t.viewDecl.$context), 
                            R(m = t)));
                        },
                        get creationContext() {
                            var t = c("$cfg.viewDecl.$context")($), e = c("$uiView.creationContext")($);
                            return t || e;
                        }
                    };
                    function R(t) {
                        var e = s.$new(), n = o.defer(), i = o.defer(), a = {
                            $cfg: t,
                            $uiView: b
                        }, u = {
                            $animEnter: n.promise,
                            $animLeave: i.promise,
                            $$animLeave: i
                        };
                        e.$emit("$viewContentLoading", S), v = l(e, function(t) {
                            t.data("$uiViewAnim", u), t.data("$uiView", a), w.enter(t, f, function() {
                                n.resolve(), d && d.$emit("$viewContentAnimationEnded"), (E(_) && !_ || s.$eval(_)) && r(t);
                            }), function() {
                                if (p && (Kt.traceUIViewEvent("Removing (previous) el", p.data("$uiView")), p.remove(), 
                                p = null), d && (Kt.traceUIViewEvent("Destroying scope", b), d.$destroy(), d = null), 
                                v) {
                                    var t = v.data("$uiViewAnim");
                                    Kt.traceUIViewEvent("Animate out", t), w.leave(v, function() {
                                        t.$$animLeave.resolve(), p = null;
                                    }), p = v, v = null;
                                }
                            }();
                        }), (d = e).$emit("$viewContentLoaded", t || m), d.$eval(g);
                    }
                    Kt.traceUIViewEvent("Linking", b), f.data("$uiView", {
                        $uiView: b
                    }), R(), y = t.registerUIView(b), s.$on("$destroy", function() {
                        Kt.traceUIViewEvent("Destroying/Unregistering", b), y();
                    });
                };
            }
        };
        return u;
    } ], Zn.$inject = [ "$compile", "$controller", "$transitions", "$view", "$q", "$timeout" ];
    var Xn = "function" == typeof n.module("ui.router").component, ti = 0;
    function ei(t, e, r, n, i) {
        !P(r.$onInit) || i.viewDecl.component && Xn || r.$onInit();
        var o = kt(i.path).state.self, a = {
            bind: r
        };
        if (P(r.uiOnParamsChanged)) {
            var u = new ge(i.path).getResolvable("$transition$").data;
            n.$on("$destroy", e.onSuccess({}, function(t) {
                if (t !== u && -1 === t.exiting().indexOf(o)) {
                    var e = t.params("to"), n = t.params("from"), i = function(t) {
                        return t.paramSchema;
                    }, a = t.treeChanges("to").map(i).reduce(yt, []), s = t.treeChanges("from").map(i).reduce(yt, []), c = a.filter(function(t) {
                        var r = s.indexOf(t);
                        return -1 === r || !s[r].type.equals(e[t.id], n[t.id]);
                    });
                    if (c.length) {
                        var f = c.map(function(t) {
                            return t.id;
                        }), l = ft(e, function(t, e) {
                            return -1 !== f.indexOf(e);
                        });
                        r.uiOnParamsChanged(l, t);
                    }
                }
            }, a));
        }
        if (P(r.uiCanExit)) {
            var s = ti++, c = function(t) {
                return !!t && (t._uiCanExitIds && !0 === t._uiCanExitIds[s] || c(t.redirectedFrom()));
            }, f = {
                exiting: o.name
            };
            n.$on("$destroy", e.onBefore(f, function(e) {
                var n, i = e._uiCanExitIds = e._uiCanExitIds || {};
                return c(e) || (n = t.when(r.uiCanExit(e))).then(function(t) {
                    return i[s] = !1 !== t;
                }), n;
            }, a));
        }
    }
    n.module("ui.router.state").directive("uiView", Ln), n.module("ui.router.state").directive("uiView", Zn), 
    n.module("ui.router.state").provider("$uiViewScroll", function() {
        var t = !1;
        this.useAnchorScroll = function() {
            t = !0;
        }, this.$get = [ "$anchorScroll", "$timeout", function(e, r) {
            return t ? e : function(t) {
                return r(function() {
                    t[0].scrollIntoView();
                }, 0, !1);
            };
        } ];
    }), t.default = "ui.router", t.core = mn, t.watchDigests = qn, t.getLocals = Mn, 
    t.getNg1ViewConfigFactory = yn, t.ng1ViewsBuilder = _n, t.Ng1ViewConfig = $n, t.StateProvider = En, 
    t.UrlRouterProvider = Pn, t.root = F, t.fromJson = L, t.toJson = M, t.forEach = B, 
    t.extend = G, t.equals = W, t.identity = z, t.noop = J, t.createProxyFunctions = Q, 
    t.inherit = K, t.inArray = Y, t._inArray = Z, t.removeFrom = X, t._removeFrom = tt, 
    t.pushTo = et, t._pushTo = rt, t.deregAll = nt, t.defaults = it, t.mergeR = ot, 
    t.ancestors = at, t.pick = ut, t.omit = st, t.pluck = ct, t.filter = ft, t.find = lt, 
    t.mapObj = ht, t.map = pt, t.values = vt, t.allTrueR = dt, t.anyTrueR = mt, t.unnestR = yt, 
    t.flattenR = gt, t.pushR = _t, t.uniqR = wt, t.unnest = $t, t.flatten = St, t.assertPredicate = bt, 
    t.assertMap = Rt, t.assertFn = Et, t.pairs = Ct, t.arrayTuples = Tt, t.applyPairs = Pt, 
    t.tail = kt, t.copy = Ot, t._extend = xt, t.silenceUncaughtInPromise = jt, t.silentRejection = At, 
    t.notImplemented = q, t.services = N, t.Glob = w, t.curry = i, t.compose = o, t.pipe = a, 
    t.prop = u, t.propEq = s, t.parse = c, t.not = f, t.and = l, t.or = h, t.all = p, 
    t.any = v, t.is = d, t.eq = m, t.val = y, t.invoke = g, t.pattern = _, t.isUndefined = R, 
    t.isDefined = E, t.isNull = C, t.isNullOrUndefined = T, t.isFunction = P, t.isNumber = k, 
    t.isString = O, t.isObject = x, t.isArray = V, t.isDate = I, t.isRegExp = j, t.isState = A, 
    t.isInjectable = H, t.isPromise = D, t.Queue = Ht, t.maxLength = Se, t.padString = be, 
    t.kebobString = Re, t.functionToString = Ee, t.fnToString = Ce, t.stringify = ke, 
    t.beforeAfterSubstr = Oe, t.hostRegex = xe, t.stripLastPathElement = Ve, t.splitHash = Ie, 
    t.splitQuery = je, t.splitEqual = Ae, t.trimHashVal = He, t.splitOnDelim = De, t.joinNeighborsR = qe, 
    t.Trace = Qt, t.trace = Kt, t.Param = se, t.ParamTypes = Fe, t.StateParams = Ue, 
    t.ParamType = ie, t.PathNode = ce, t.PathUtils = fe, t.resolvePolicies = pe, t.defaultResolvePolicy = le, 
    t.Resolvable = he, t.NATIVE_INJECTOR_TOKEN = ye, t.ResolveContext = ge, t.resolvablesBuilder = Ke, 
    t.StateBuilder = Ye, t.StateObject = $, t.StateMatcher = Ze, t.StateQueueManager = Xe, 
    t.StateRegistry = tr, t.StateService = Mr, t.TargetState = Yt, t.HookBuilder = ne, 
    t.matchState = te, t.RegisteredHook = ee, t.makeEvent = re, t.Rejection = qt, t.Transition = $e, 
    t.TransitionHook = Xt, t.TransitionEventType = qr, t.defaultTransOpts = Ur, t.TransitionService = Lr, 
    t.UrlMatcher = nr, t.UrlMatcherFactory = ir, t.UrlRouter = sr, t.UrlRuleFactory = or, 
    t.BaseUrlRule = ar, t.UrlService = gr, t.ViewService = fr, t.UIRouterGlobals = lr, 
    t.UIRouter = wr, t.$q = Br, t.$injector = Jr, t.BaseLocationServices = en, t.HashLocationService = nn, 
    t.MemoryLocationService = an, t.PushStateLocationService = sn, t.MemoryLocationConfig = cn, 
    t.BrowserLocationConfig = fn, t.keyValsToObjectR = Qr, t.getParams = Kr, t.parseUrl = Yr, 
    t.buildUrl = Zr, t.locationPluginFactory = Xr, t.servicesPlugin = ln, t.hashLocationPlugin = hn, 
    t.pushStateLocationPlugin = pn, t.memoryLocationPlugin = vn, t.UIRouterPluginBase = dn, 
    Object.defineProperty(t, "__esModule", {
        value: !0
    });
}), function(a, b) {
    "function" == typeof define && define.amd ? define(a) : "undefined" != typeof module && "object" == typeof exports ? module.exports = a() : b.rangy = a();
}(function() {
    function a(a, b) {
        var c = typeof a[b];
        return c == u || !(c != t || !a[b]) || "unknown" == c;
    }
    function b(a, b) {
        return !(typeof a[b] != t || !a[b]);
    }
    function c(a, b) {
        return typeof a[b] != v;
    }
    function d(a) {
        return function(b, c) {
            for (var d = c.length; d--; ) if (!a(b, c[d])) return !1;
            return !0;
        };
    }
    function e(a) {
        return a && A(a, z) && C(a, y);
    }
    function f(a) {
        return b(a, "body") ? a.body : a.getElementsByTagName("body")[0];
    }
    function g(b) {
        typeof console != v && a(console, "log") && console.log(b);
    }
    function h(a, b) {
        F && b ? alert(a) : g(a);
    }
    function i(a) {
        H.initialized = !0, H.supported = !1, h("Rangy is not supported in this environment. Reason: " + a, H.config.alertOnFail);
    }
    function k(a) {
        return a.message || a.description || String(a);
    }
    function l() {
        if (F && !H.initialized) {
            var b, c = !1, d = !1;
            a(document, "createRange") && (b = document.createRange(), A(b, x) && C(b, w) && (c = !0));
            var j, h = f(document);
            if (!h || "body" != h.nodeName.toLowerCase()) return void i("No body element found");
            if (h && a(h, "createTextRange") && (e(b = h.createTextRange()) && (d = !0)), !c && !d) return void i("Neither Range nor TextRange are available");
            for (var m in H.initialized = !0, H.features = {
                implementsDomRange: c,
                implementsTextRange: d
            }, E) (j = E[m]) instanceof p && j.init(j, H);
            for (var n = 0, o = K.length; n < o; ++n) try {
                K[n](H);
            } catch (a) {
                g("Rangy init listener threw an exception. Continuing. Detail: " + k(a));
            }
        }
    }
    function m(a, b, c) {
        c && (a += " in module " + c.name), H.warn("DEPRECATED: " + a + " is deprecated. Please use " + b + " instead.");
    }
    function n(a, b, c, d) {
        a[b] = function() {
            return m(b, c, d), a[c].apply(a, G.toArray(arguments));
        };
    }
    function p(a, b, c) {
        this.name = a, this.dependencies = b, this.initialized = !1, this.supported = !1, 
        this.initializer = c;
    }
    function q(a, b, c) {
        var d = new p(a, b, function(b) {
            if (!b.initialized) {
                b.initialized = !0;
                try {
                    c(H, b), b.supported = !0;
                } catch (b) {
                    g("Module '" + a + "' failed to load: " + k(b)), b.stack && g(b.stack);
                }
            }
        });
        return E[a] = d;
    }
    function r() {}
    var I, J, t = "object", u = "function", v = "undefined", w = [ "startContainer", "startOffset", "endContainer", "endOffset", "collapsed", "commonAncestorContainer" ], x = [ "setStart", "setStartBefore", "setStartAfter", "setEnd", "setEndBefore", "setEndAfter", "collapse", "selectNode", "selectNodeContents", "compareBoundaryPoints", "deleteContents", "extractContents", "cloneContents", "insertNode", "surroundContents", "cloneRange", "toString", "detach" ], y = [ "boundingHeight", "boundingLeft", "boundingTop", "boundingWidth", "htmlText", "text" ], z = [ "collapse", "compareEndPoints", "duplicate", "moveToElementText", "parentElement", "select", "setEndPoint", "getBoundingClientRect" ], A = d(a), B = d(b), C = d(c), D = [].forEach ? function(a, b) {
        a.forEach(b);
    } : function(a, b) {
        for (var c = 0, d = a.length; c < d; ++c) b(a[c], c);
    }, E = {}, F = typeof window != v && typeof document != v, G = {
        isHostMethod: a,
        isHostObject: b,
        isHostProperty: c,
        areHostMethods: A,
        areHostObjects: B,
        areHostProperties: C,
        isTextRange: e,
        getBody: f,
        forEach: D
    }, H = {
        version: "1.3.0",
        initialized: !1,
        isBrowser: F,
        supported: !0,
        util: G,
        features: {},
        modules: E,
        config: {
            alertOnFail: !1,
            alertOnWarn: !1,
            preferTextRange: !1,
            autoInitialize: typeof rangyAutoInitialize == v || rangyAutoInitialize
        }
    };
    H.fail = i, H.warn = function(a) {
        h("Rangy warning: " + a, H.config.alertOnWarn);
    }, !{}.hasOwnProperty ? i("hasOwnProperty not supported") : (G.extend = I = function(a, b, c) {
        var d, e;
        for (var f in b) b.hasOwnProperty(f) && (d = a[f], e = b[f], c && null !== d && "object" == typeof d && null !== e && "object" == typeof e && I(d, e, !0), 
        a[f] = e);
        return b.hasOwnProperty("toString") && (a.toString = b.toString), a;
    }, G.createOptions = function(a, b) {
        var c = {};
        return I(c, b), a && I(c, a), c;
    }), F || i("Rangy can only run in a browser"), function() {
        var a;
        if (F) {
            var b = document.createElement("div");
            b.appendChild(document.createElement("span"));
            var c = [].slice;
            try {
                1 == c.call(b.childNodes, 0)[0].nodeType && (a = function(a) {
                    return c.call(a, 0);
                });
            } catch (a) {}
        }
        a || (a = function(a) {
            for (var b = [], c = 0, d = a.length; c < d; ++c) b[c] = a[c];
            return b;
        }), G.toArray = a;
    }(), F && (a(document, "addEventListener") ? J = function(a, b, c) {
        a.addEventListener(b, c, !1);
    } : a(document, "attachEvent") ? J = function(a, b, c) {
        a.attachEvent("on" + b, c);
    } : i("Document does not have required addEventListener or attachEvent method"), 
    G.addListener = J);
    var K = [];
    G.deprecationNotice = m, G.createAliasForDeprecatedMethod = n, H.init = l, H.addInitListener = function(a) {
        H.initialized ? a(H) : K.push(a);
    };
    var L = [];
    H.addShimListener = function(a) {
        L.push(a);
    }, F && (H.shim = H.createMissingNativeApi = function(a) {
        a = a || window, l();
        for (var b = 0, c = L.length; b < c; ++b) L[b](a);
    }, n(H, "createMissingNativeApi", "shim")), p.prototype = {
        init: function() {
            for (var a, b, c = this.dependencies || [], d = 0, e = c.length; d < e; ++d) {
                if (b = c[d], !((a = E[b]) && a instanceof p)) throw new Error("required module '" + b + "' not found");
                if (a.init(), !a.supported) throw new Error("required module '" + b + "' not supported");
            }
            this.initializer(this);
        },
        fail: function(a) {
            throw this.initialized = !0, this.supported = !1, new Error(a);
        },
        warn: function(a) {
            H.warn("Module " + this.name + ": " + a);
        },
        deprecationNotice: function(a, b) {
            H.warn("DEPRECATED: " + a + " in module " + this.name + " is deprecated. Please use " + b + " instead");
        },
        createError: function(a) {
            return new Error("Error in Rangy " + this.name + " module: " + a);
        }
    }, H.createModule = function(a) {
        var b, c;
        2 == arguments.length ? (b = arguments[1], c = []) : (b = arguments[2], c = arguments[1]);
        var d = q(a, c, b);
        H.initialized && H.supported && d.init();
    }, H.createCoreModule = function(a, b, c) {
        q(a, b, c);
    }, H.RangePrototype = r, H.rangePrototype = new r(), H.selectionPrototype = new function() {}(), 
    H.createCoreModule("DomUtil", [], function(a, b) {
        function e(a) {
            for (var b = 0; a = a.previousSibling; ) ++b;
            return b;
        }
        function g(a, b) {
            var c, d = [];
            for (c = a; c; c = c.parentNode) d.push(c);
            for (c = b; c; c = c.parentNode) if (K(d, c)) return c;
            return null;
        }
        function h(a, b, c) {
            for (var d = c ? b : b.parentNode; d; ) {
                if (d === a) return !0;
                d = d.parentNode;
            }
            return !1;
        }
        function j(a, b, c) {
            for (var d, e = c ? a : a.parentNode; e; ) {
                if ((d = e.parentNode) === b) return e;
                e = d;
            }
            return null;
        }
        function k(a) {
            var b = a.nodeType;
            return 3 == b || 4 == b || 8 == b;
        }
        function m(a, b) {
            var c = b.nextSibling, d = b.parentNode;
            return c ? d.insertBefore(a, c) : d.appendChild(a), a;
        }
        function o(a) {
            if (9 == a.nodeType) return a;
            if (typeof a.ownerDocument != F) return a.ownerDocument;
            if (typeof a.document != F) return a.document;
            if (a.parentNode) return o(a.parentNode);
            throw b.createError("getDocument: no document found for node");
        }
        function p(a) {
            var c = o(a);
            if (typeof c.defaultView != F) return c.defaultView;
            if (typeof c.parentWindow != F) return c.parentWindow;
            throw b.createError("Cannot get a window object for node");
        }
        function q(a) {
            if (typeof a.contentDocument != F) return a.contentDocument;
            if (typeof a.contentWindow != F) return a.contentWindow.document;
            throw b.createError("getIframeDocument: No Document object found for iframe element");
        }
        function s(a) {
            return a && G.isHostMethod(a, "setTimeout") && G.isHostObject(a, "document");
        }
        function w(a) {
            try {
                return a.parentNode, !1;
            } catch (a) {
                return !0;
            }
        }
        function x(a) {
            if (!a) return "[No node]";
            if (L && w(a)) return "[Broken node]";
            if (k(a)) return '"' + a.data + '"';
            if (1 == a.nodeType) {
                var b = a.id ? ' id="' + a.id + '"' : "";
                return "<" + a.nodeName + b + ">[index:" + e(a) + ",length:" + a.childNodes.length + "][" + (a.innerHTML || "[innerHTML not supported]").slice(0, 25) + "]";
            }
            return a.nodeName;
        }
        function B(a) {
            this.root = a, this._next = a;
        }
        function D(a, b) {
            this.node = a, this.offset = b;
        }
        function E(a) {
            this.code = this[a], this.codeName = a, this.message = "DOMException: " + this.codeName;
        }
        var F = "undefined", G = a.util, H = G.getBody;
        G.areHostMethods(document, [ "createDocumentFragment", "createElement", "createTextNode" ]) || b.fail("document missing a Node creation method"), 
        G.isHostMethod(document, "getElementsByTagName") || b.fail("document missing getElementsByTagName method");
        var I = document.createElement("div");
        G.areHostMethods(I, [ "insertBefore", "appendChild", "cloneNode" ]) || b.fail("Incomplete Element implementation"), 
        G.isHostProperty(I, "innerHTML") || b.fail("Element is missing innerHTML property");
        var J = document.createTextNode("test");
        G.areHostMethods(J, [ "splitText", "deleteData", "insertData", "appendData", "cloneNode" ]) || b.fail("Incomplete Text Node implementation");
        var M, K = function(a, b) {
            for (var c = a.length; c--; ) if (a[c] === b) return !0;
            return !1;
        }, L = !1;
        !function() {
            var b = document.createElement("b");
            b.innerHTML = "1";
            var c = b.firstChild;
            b.innerHTML = "<br />", L = w(c), a.features.crashyTextNodes = L;
        }(), typeof window.getComputedStyle != F ? M = function(a, b) {
            return p(a).getComputedStyle(a, null)[b];
        } : typeof document.documentElement.currentStyle != F ? M = function(a, b) {
            return a.currentStyle ? a.currentStyle[b] : "";
        } : b.fail("No means of obtaining computed style properties found"), B.prototype = {
            _current: null,
            hasNext: function() {
                return !!this._next;
            },
            next: function() {
                var a, b, c = this._current = this._next;
                if (this._current) if (a = c.firstChild) this._next = a; else {
                    for (b = null; c !== this.root && !(b = c.nextSibling); ) c = c.parentNode;
                    this._next = b;
                }
                return this._current;
            },
            detach: function() {
                this._current = this._next = this.root = null;
            }
        }, D.prototype = {
            equals: function(a) {
                return !!a && this.node === a.node && this.offset == a.offset;
            },
            inspect: function() {
                return "[DomPosition(" + x(this.node) + ":" + this.offset + ")]";
            },
            toString: function() {
                return this.inspect();
            }
        }, (E.prototype = {
            INDEX_SIZE_ERR: 1,
            HIERARCHY_REQUEST_ERR: 3,
            WRONG_DOCUMENT_ERR: 4,
            NO_MODIFICATION_ALLOWED_ERR: 7,
            NOT_FOUND_ERR: 8,
            NOT_SUPPORTED_ERR: 9,
            INVALID_STATE_ERR: 11,
            INVALID_NODE_TYPE_ERR: 24
        }).toString = function() {
            return this.message;
        }, a.dom = {
            arrayContains: K,
            isHtmlNamespace: function(a) {
                var b;
                return typeof a.namespaceURI == F || null === (b = a.namespaceURI) || "http://www.w3.org/1999/xhtml" == b;
            },
            parentElement: function(a) {
                var b = a.parentNode;
                return 1 == b.nodeType ? b : null;
            },
            getNodeIndex: e,
            getNodeLength: function(a) {
                switch (a.nodeType) {
                  case 7:
                  case 10:
                    return 0;

                  case 3:
                  case 8:
                    return a.length;

                  default:
                    return a.childNodes.length;
                }
            },
            getCommonAncestor: g,
            isAncestorOf: h,
            isOrIsAncestorOf: function(a, b) {
                return h(a, b, !0);
            },
            getClosestAncestorIn: j,
            isCharacterDataNode: k,
            isTextOrCommentNode: function(a) {
                if (!a) return !1;
                var b = a.nodeType;
                return 3 == b || 8 == b;
            },
            insertAfter: m,
            splitDataNode: function(a, b, c) {
                var d = a.cloneNode(!1);
                if (d.deleteData(0, b), a.deleteData(b, a.length - b), m(d, a), c) for (var f, g = 0; f = c[g++]; ) f.node == a && f.offset > b ? (f.node = d, 
                f.offset -= b) : f.node == a.parentNode && f.offset > e(a) && ++f.offset;
                return d;
            },
            getDocument: o,
            getWindow: p,
            getIframeWindow: function(a) {
                if (typeof a.contentWindow != F) return a.contentWindow;
                if (typeof a.contentDocument != F) return a.contentDocument.defaultView;
                throw b.createError("getIframeWindow: No Window object found for iframe element");
            },
            getIframeDocument: q,
            getBody: H,
            isWindow: s,
            getContentDocument: function(a, b, c) {
                var d;
                if (a ? G.isHostProperty(a, "nodeType") ? d = 1 == a.nodeType && "iframe" == a.tagName.toLowerCase() ? q(a) : o(a) : s(a) && (d = a.document) : d = document, 
                !d) throw b.createError(c + "(): Parameter must be a Window object or DOM node");
                return d;
            },
            getRootContainer: function(a) {
                for (var b; b = a.parentNode; ) a = b;
                return a;
            },
            comparePoints: function(a, c, d, f) {
                var h, i, k, l, m;
                if (a == d) return c === f ? 0 : c < f ? -1 : 1;
                if (h = j(d, a, !0)) return c <= e(h) ? -1 : 1;
                if (h = j(a, d, !0)) return e(h) < f ? -1 : 1;
                if (!(i = g(a, d))) throw new Error("comparePoints error: nodes have no common ancestor");
                if ((k = a === i ? i : j(a, i, !0)) === (l = d === i ? i : j(d, i, !0))) throw b.createError("comparePoints got to case 4 and childA and childB are the same!");
                for (m = i.firstChild; m; ) {
                    if (m === k) return -1;
                    if (m === l) return 1;
                    m = m.nextSibling;
                }
            },
            isBrokenNode: w,
            inspectNode: x,
            getComputedStyleProperty: M,
            createTestElement: function(a, b, c) {
                var d = H(a), e = a.createElement("div");
                e.contentEditable = "" + !!c, b && (e.innerHTML = b);
                var f = d.firstChild;
                return f ? d.insertBefore(e, f) : d.appendChild(e), e;
            },
            removeNode: function(a) {
                return a.parentNode.removeChild(a);
            },
            fragmentFromNodeChildren: function(a) {
                for (var b, c = o(a).createDocumentFragment(); b = a.firstChild; ) c.appendChild(b);
                return c;
            },
            createIterator: function(a) {
                return new B(a);
            },
            DomPosition: D
        }, a.DOMException = E;
    }), H.createCoreModule("DomRange", [ "DomUtil" ], function(a, b) {
        function c(a, b) {
            return 3 != a.nodeType && (P(a, b.startContainer) || P(a, b.endContainer));
        }
        function d(a) {
            return a.document || Q(a.startContainer);
        }
        function f(a) {
            return new L(a.parentNode, O(a));
        }
        function g(a) {
            return new L(a.parentNode, O(a) + 1);
        }
        function h(a, b, c) {
            var d = 11 == a.nodeType ? a.firstChild : a;
            return N(b) ? c == b.length ? J.insertAfter(a, b) : b.parentNode.insertBefore(a, 0 == c ? b : S(b, c)) : c >= b.childNodes.length ? b.appendChild(a) : b.insertBefore(a, b.childNodes[c]), 
            d;
        }
        function i(a, b, c) {
            if (z(a), z(b), d(b) != d(a)) throw new M("WRONG_DOCUMENT_ERR");
            var e = R(a.startContainer, a.startOffset, b.endContainer, b.endOffset), f = R(a.endContainer, a.endOffset, b.startContainer, b.startOffset);
            return c ? e <= 0 && 0 <= f : e < 0 && 0 < f;
        }
        function k(a, b, c) {
            var d, e, f, g;
            for (c = c || {
                stop: !1
            }; f = a.next(); ) if (a.isPartiallySelectedSubtree()) {
                if (!1 === b(f)) return void (c.stop = !0);
                if (k(g = a.getSubtreeIterator(), b, c), g.detach(), c.stop) return;
            } else for (d = J.createIterator(f); e = d.next(); ) if (!1 === b(e)) return void (c.stop = !0);
        }
        function l(a) {
            for (var b; a.next(); ) a.isPartiallySelectedSubtree() ? (l(b = a.getSubtreeIterator()), 
            b.detach()) : a.remove();
        }
        function m(a) {
            for (var b, c, e = d(a.range).createDocumentFragment(); b = a.next(); ) {
                if (a.isPartiallySelectedSubtree() ? (b = b.cloneNode(!1), c = a.getSubtreeIterator(), 
                b.appendChild(m(c)), c.detach()) : a.remove(), 10 == b.nodeType) throw new M("HIERARCHY_REQUEST_ERR");
                e.appendChild(b);
            }
            return e;
        }
        function o(a) {
            return "[" + (void 0 === a.getName ? "Range" : a.getName()) + "(" + J.inspectNode(a.startContainer) + ":" + a.startOffset + ", " + J.inspectNode(a.endContainer) + ":" + a.endOffset + ")]";
        }
        function p(a, b) {
            if (this.range = a, this.clonePartiallySelectedTextNodes = b, !a.collapsed) {
                this.sc = a.startContainer, this.so = a.startOffset, this.ec = a.endContainer, this.eo = a.endOffset;
                var c = a.commonAncestorContainer;
                this.sc === this.ec && N(this.sc) ? (this.isSingleCharacterDataNode = !0, this._first = this._last = this._next = this.sc) : (this._first = this._next = this.sc !== c || N(this.sc) ? T(this.sc, c, !0) : this.sc.childNodes[this.so], 
                this._last = this.ec !== c || N(this.ec) ? T(this.ec, c, !0) : this.ec.childNodes[this.eo - 1]);
            }
        }
        function q(a) {
            return function(b, c) {
                for (var d, e = c ? b : b.parentNode; e; ) {
                    if (d = e.nodeType, V(a, d)) return e;
                    e = e.parentNode;
                }
                return null;
            };
        }
        function r(a, b) {
            if (ea(a, b)) throw new M("INVALID_NODE_TYPE_ERR");
        }
        function s(a, b) {
            if (!V(b, a.nodeType)) throw new M("INVALID_NODE_TYPE_ERR");
        }
        function t(a, b) {
            if (b < 0 || b > (N(a) ? a.length : a.childNodes.length)) throw new M("INDEX_SIZE_ERR");
        }
        function u(a, b) {
            if (ca(a, !0) !== ca(b, !0)) throw new M("WRONG_DOCUMENT_ERR");
        }
        function v(a) {
            if (da(a, !0)) throw new M("NO_MODIFICATION_ALLOWED_ERR");
        }
        function w(a, b) {
            if (!a) throw new M(b);
        }
        function x(a, b) {
            return b <= (N(a) ? a.length : a.childNodes.length);
        }
        function y(a) {
            return !!a.startContainer && !!a.endContainer && !(X && (J.isBrokenNode(a.startContainer) || J.isBrokenNode(a.endContainer))) && W(a.startContainer) == W(a.endContainer) && x(a.startContainer, a.startOffset) && x(a.endContainer, a.endOffset);
        }
        function z(a) {
            if (!y(a)) throw new Error("Range error: Range is not valid. This usually happens after DOM mutation. Range: (" + a.inspect() + ")");
        }
        function A(a, b) {
            z(a);
            var c = a.startContainer, d = a.startOffset, e = a.endContainer, f = a.endOffset, g = c === e;
            N(e) && 0 < f && f < e.length && S(e, f, b), N(c) && 0 < d && d < c.length && (c = S(c, d, b), 
            g ? (f -= d, e = c) : e == c.parentNode && f >= O(c) && f++, d = 0), a.setStartAndEnd(c, d, e, f);
        }
        function B(a) {
            z(a);
            var b = a.commonAncestorContainer.parentNode.cloneNode(!1);
            return b.appendChild(a.cloneContents()), b.innerHTML;
        }
        function C(a) {
            a.START_TO_START = ja, a.START_TO_END = ka, a.END_TO_END = la, a.END_TO_START = ma, 
            a.NODE_BEFORE = na, a.NODE_AFTER = oa, a.NODE_BEFORE_AND_AFTER = pa, a.NODE_INSIDE = qa;
        }
        function D(a) {
            C(a), C(a.prototype);
        }
        function E(a, b) {
            return function() {
                z(this);
                var d, e = this.startContainer, f = this.startOffset, h = this.commonAncestorContainer, i = new p(this, !0);
                e !== h && (e = (d = g(T(e, h, !0))).node, f = d.offset), k(i, v), i.reset();
                var j = a(i);
                return i.detach(), b(this, e, f, e, f), j;
            };
        }
        function F(b, d) {
            function e(a, b) {
                return function(c) {
                    s(c, Z), s(W(c), $);
                    var d = (a ? f : g)(c);
                    (b ? h : i)(this, d.node, d.offset);
                };
            }
            function h(a, b, c) {
                var e = a.endContainer, f = a.endOffset;
                b === a.startContainer && c === a.startOffset || (W(b) == W(e) && 1 != R(b, c, e, f) || (e = b, 
                f = c), d(a, b, c, e, f));
            }
            function i(a, b, c) {
                var e = a.startContainer, f = a.startOffset;
                b === a.endContainer && c === a.endOffset || (W(b) == W(e) && -1 != R(b, c, e, f) || (e = b, 
                f = c), d(a, e, f, b, c));
            }
            var j = function() {};
            j.prototype = a.rangePrototype, b.prototype = new j(), K.extend(b.prototype, {
                setStart: function(a, b) {
                    r(a, !0), t(a, b), h(this, a, b);
                },
                setEnd: function(a, b) {
                    r(a, !0), t(a, b), i(this, a, b);
                },
                setStartAndEnd: function() {
                    var a = arguments, b = a[0], c = a[1], e = b, f = c;
                    switch (a.length) {
                      case 3:
                        f = a[2];
                        break;

                      case 4:
                        e = a[2], f = a[3];
                    }
                    d(this, b, c, e, f);
                },
                setBoundary: function(a, b, c) {
                    this["set" + (c ? "Start" : "End")](a, b);
                },
                setStartBefore: e(!0, !0),
                setStartAfter: e(!1, !0),
                setEndBefore: e(!0, !1),
                setEndAfter: e(!1, !1),
                collapse: function(a) {
                    z(this), a ? d(this, this.startContainer, this.startOffset, this.startContainer, this.startOffset) : d(this, this.endContainer, this.endOffset, this.endContainer, this.endOffset);
                },
                selectNodeContents: function(a) {
                    r(a, !0), d(this, a, 0, a, U(a));
                },
                selectNode: function(a) {
                    r(a, !1), s(a, Z);
                    var b = f(a), c = g(a);
                    d(this, b.node, b.offset, c.node, c.offset);
                },
                extractContents: E(m, d),
                deleteContents: E(l, d),
                canSurroundContents: function() {
                    z(this), v(this.startContainer), v(this.endContainer);
                    var a = new p(this, !0), b = a._first && c(a._first, this) || a._last && c(a._last, this);
                    return a.detach(), !b;
                },
                splitBoundaries: function() {
                    A(this);
                },
                splitBoundariesPreservingPositions: function(a) {
                    A(this, a);
                },
                normalizeBoundaries: function() {
                    z(this);
                    var a, b = this.startContainer, c = this.startOffset, e = this.endContainer, f = this.endOffset, g = function(a) {
                        var b = a.nextSibling;
                        b && b.nodeType == a.nodeType && (f = (e = a).length, a.appendData(b.data), Y(b));
                    }, h = function(a) {
                        var d = a.previousSibling;
                        if (d && d.nodeType == a.nodeType) {
                            var g = (b = a).length;
                            if (c = d.length, a.insertData(0, d.data), Y(d), b == e) f += c, e = b; else if (e == a.parentNode) {
                                var h = O(a);
                                f == h ? (e = a, f = g) : h < f && f--;
                            }
                        }
                    }, i = !0;
                    if (N(e)) f == e.length ? g(e) : 0 == f && ((a = e.previousSibling) && a.nodeType == e.nodeType && (f = a.length, 
                    b == e && (i = !1), a.appendData(e.data), Y(e), e = a)); else {
                        if (0 < f) {
                            var j = e.childNodes[f - 1];
                            j && N(j) && g(j);
                        }
                        i = !this.collapsed;
                    }
                    if (i) {
                        if (N(b)) 0 == c ? h(b) : c == b.length && ((a = b.nextSibling) && a.nodeType == b.nodeType && (e == a && (f += (e = b).length), 
                        b.appendData(a.data), Y(a))); else if (c < b.childNodes.length) {
                            var k = b.childNodes[c];
                            k && N(k) && h(k);
                        }
                    } else b = e, c = f;
                    d(this, b, c, e, f);
                },
                collapseToPoint: function(a, b) {
                    r(a, !0), t(a, b), this.setStartAndEnd(a, b);
                }
            }), D(b);
        }
        function G(a) {
            a.collapsed = a.startContainer === a.endContainer && a.startOffset === a.endOffset, 
            a.commonAncestorContainer = a.collapsed ? a.startContainer : J.getCommonAncestor(a.startContainer, a.endContainer);
        }
        function H(a, b, c, d, e) {
            a.startContainer = b, a.startOffset = c, a.endContainer = d, a.endOffset = e, a.document = J.getDocument(b), 
            G(a);
        }
        function I(a) {
            this.startContainer = a, this.startOffset = 0, this.endContainer = a, this.endOffset = 0, 
            this.document = a, G(this);
        }
        var J = a.dom, K = a.util, L = J.DomPosition, M = a.DOMException, N = J.isCharacterDataNode, O = J.getNodeIndex, P = J.isOrIsAncestorOf, Q = J.getDocument, R = J.comparePoints, S = J.splitDataNode, T = J.getClosestAncestorIn, U = J.getNodeLength, V = J.arrayContains, W = J.getRootContainer, X = a.features.crashyTextNodes, Y = J.removeNode;
        p.prototype = {
            _current: null,
            _next: null,
            _first: null,
            _last: null,
            isSingleCharacterDataNode: !1,
            reset: function() {
                this._current = null, this._next = this._first;
            },
            hasNext: function() {
                return !!this._next;
            },
            next: function() {
                var a = this._current = this._next;
                return a && (this._next = a !== this._last ? a.nextSibling : null, N(a) && this.clonePartiallySelectedTextNodes && (a === this.ec && (a = a.cloneNode(!0)).deleteData(this.eo, a.length - this.eo), 
                this._current === this.sc && (a = a.cloneNode(!0)).deleteData(0, this.so))), a;
            },
            remove: function() {
                var a, b, c = this._current;
                !N(c) || c !== this.sc && c !== this.ec ? c.parentNode && Y(c) : (a = c === this.sc ? this.so : 0) != (b = c === this.ec ? this.eo : c.length) && c.deleteData(a, b - a);
            },
            isPartiallySelectedSubtree: function() {
                return c(this._current, this.range);
            },
            getSubtreeIterator: function() {
                var a;
                if (this.isSingleCharacterDataNode) (a = this.range.cloneRange()).collapse(!1); else {
                    a = new I(d(this.range));
                    var b = this._current, c = b, e = 0, f = b, g = U(b);
                    P(b, this.sc) && (c = this.sc, e = this.so), P(b, this.ec) && (f = this.ec, g = this.eo), 
                    H(a, c, e, f, g);
                }
                return new p(a, this.clonePartiallySelectedTextNodes);
            },
            detach: function() {
                this.range = this._current = this._next = this._first = this._last = this.sc = this.so = this.ec = this.eo = null;
            }
        };
        var Z = [ 1, 3, 4, 5, 7, 8, 10 ], $ = [ 2, 9, 11 ], aa = [ 1, 3, 4, 5, 7, 8, 10, 11 ], ba = [ 1, 3, 4, 5, 7, 8 ], ca = q([ 9, 11 ]), da = q([ 5, 6, 10, 12 ]), ea = q([ 6, 10, 12 ]), fa = document.createElement("style"), ga = !1;
        try {
            fa.innerHTML = "<b>x</b>", ga = 3 == fa.firstChild.nodeType;
        } catch (a) {}
        var ha = (a.features.htmlParsingConforms = ga) ? function(a) {
            var b = this.startContainer, c = Q(b);
            if (!b) throw new M("INVALID_STATE_ERR");
            var d = null;
            return 1 == b.nodeType ? d = b : N(b) && (d = J.parentElement(b)), (d = null === d || "HTML" == d.nodeName && J.isHtmlNamespace(Q(d).documentElement) && J.isHtmlNamespace(d) ? c.createElement("body") : d.cloneNode(!1)).innerHTML = a, 
            J.fragmentFromNodeChildren(d);
        } : function(a) {
            var c = d(this).createElement("body");
            return c.innerHTML = a, J.fragmentFromNodeChildren(c);
        }, ia = [ "startContainer", "startOffset", "endContainer", "endOffset", "collapsed", "commonAncestorContainer" ], ja = 0, ka = 1, la = 2, ma = 3, na = 0, oa = 1, pa = 2, qa = 3;
        K.extend(a.rangePrototype, {
            compareBoundaryPoints: function(a, b) {
                z(this), u(this.startContainer, b.startContainer);
                var c, d, e, f, g = a == ma || a == ja ? "start" : "end", h = a == ka || a == ja ? "start" : "end";
                return c = this[g + "Container"], d = this[g + "Offset"], e = b[h + "Container"], 
                f = b[h + "Offset"], R(c, d, e, f);
            },
            insertNode: function(a) {
                if (z(this), s(a, aa), v(this.startContainer), P(a, this.startContainer)) throw new M("HIERARCHY_REQUEST_ERR");
                var b = h(a, this.startContainer, this.startOffset);
                this.setStartBefore(b);
            },
            cloneContents: function() {
                var a, b;
                if (z(this), this.collapsed) return d(this).createDocumentFragment();
                if (this.startContainer === this.endContainer && N(this.startContainer)) return (a = this.startContainer.cloneNode(!0)).data = a.data.slice(this.startOffset, this.endOffset), 
                (b = d(this).createDocumentFragment()).appendChild(a), b;
                var c = new p(this, !0);
                return a = function j(a) {
                    for (var b, c, e, f = d(a.range).createDocumentFragment(); c = a.next(); ) {
                        if (b = a.isPartiallySelectedSubtree(), c = c.cloneNode(!b), b && (e = a.getSubtreeIterator(), 
                        c.appendChild(j(e)), e.detach()), 10 == c.nodeType) throw new M("HIERARCHY_REQUEST_ERR");
                        f.appendChild(c);
                    }
                    return f;
                }(c), c.detach(), a;
            },
            canSurroundContents: function() {
                z(this), v(this.startContainer), v(this.endContainer);
                var a = new p(this, !0), b = a._first && c(a._first, this) || a._last && c(a._last, this);
                return a.detach(), !b;
            },
            surroundContents: function(a) {
                if (s(a, ba), !this.canSurroundContents()) throw new M("INVALID_STATE_ERR");
                var b = this.extractContents();
                if (a.hasChildNodes()) for (;a.lastChild; ) a.removeChild(a.lastChild);
                h(a, this.startContainer, this.startOffset), a.appendChild(b), this.selectNode(a);
            },
            cloneRange: function() {
                z(this);
                for (var a, b = new I(d(this)), c = ia.length; c--; ) b[a = ia[c]] = this[a];
                return b;
            },
            toString: function() {
                z(this);
                var a = this.startContainer;
                if (a === this.endContainer && N(a)) return 3 == a.nodeType || 4 == a.nodeType ? a.data.slice(this.startOffset, this.endOffset) : "";
                var b = [], c = new p(this, !0);
                return k(c, function(a) {
                    3 != a.nodeType && 4 != a.nodeType || b.push(a.data);
                }), c.detach(), b.join("");
            },
            compareNode: function(a) {
                z(this);
                var b = a.parentNode, c = O(a);
                if (!b) throw new M("NOT_FOUND_ERR");
                var d = this.comparePoint(b, c), e = this.comparePoint(b, c + 1);
                return d < 0 ? 0 < e ? pa : na : 0 < e ? oa : qa;
            },
            comparePoint: function(a, b) {
                return z(this), w(a, "HIERARCHY_REQUEST_ERR"), u(a, this.startContainer), R(a, b, this.startContainer, this.startOffset) < 0 ? -1 : 0 < R(a, b, this.endContainer, this.endOffset) ? 1 : 0;
            },
            createContextualFragment: ha,
            toHtml: function() {
                return B(this);
            },
            intersectsNode: function(a, b) {
                if (z(this), W(a) != function(a) {
                    return W(a.startContainer);
                }(this)) return !1;
                var c = a.parentNode, d = O(a);
                if (!c) return !0;
                var f = R(c, d, this.endContainer, this.endOffset), g = R(c, d + 1, this.startContainer, this.startOffset);
                return b ? f <= 0 && 0 <= g : f < 0 && 0 < g;
            },
            isPointInRange: function(a, b) {
                return z(this), w(a, "HIERARCHY_REQUEST_ERR"), u(a, this.startContainer), 0 <= R(a, b, this.startContainer, this.startOffset) && R(a, b, this.endContainer, this.endOffset) <= 0;
            },
            intersectsRange: function(a) {
                return i(this, a, !1);
            },
            intersectsOrTouchesRange: function(a) {
                return i(this, a, !0);
            },
            intersection: function(a) {
                if (this.intersectsRange(a)) {
                    var b = R(this.startContainer, this.startOffset, a.startContainer, a.startOffset), c = R(this.endContainer, this.endOffset, a.endContainer, a.endOffset), d = this.cloneRange();
                    return -1 == b && d.setStart(a.startContainer, a.startOffset), 1 == c && d.setEnd(a.endContainer, a.endOffset), 
                    d;
                }
                return null;
            },
            union: function(a) {
                if (this.intersectsOrTouchesRange(a)) {
                    var b = this.cloneRange();
                    return -1 == R(a.startContainer, a.startOffset, this.startContainer, this.startOffset) && b.setStart(a.startContainer, a.startOffset), 
                    1 == R(a.endContainer, a.endOffset, this.endContainer, this.endOffset) && b.setEnd(a.endContainer, a.endOffset), 
                    b;
                }
                throw new M("Ranges do not intersect");
            },
            containsNode: function(a, b) {
                return b ? this.intersectsNode(a, !1) : this.compareNode(a) == qa;
            },
            containsNodeContents: function(a) {
                return 0 <= this.comparePoint(a, 0) && this.comparePoint(a, U(a)) <= 0;
            },
            containsRange: function(a) {
                var b = this.intersection(a);
                return null !== b && a.equals(b);
            },
            containsNodeText: function(a) {
                var b = this.cloneRange();
                b.selectNode(a);
                var c = b.getNodes([ 3 ]);
                if (0 < c.length) {
                    b.setStart(c[0], 0);
                    var d = c.pop();
                    return b.setEnd(d, d.length), this.containsRange(b);
                }
                return this.containsNodeContents(a);
            },
            getNodes: function(a, b) {
                return z(this), function(a, b, c) {
                    var d, e = !(!b || !b.length), f = !!c;
                    e && (d = new RegExp("^(" + b.join("|") + ")$"));
                    var g = [];
                    return k(new p(a, !1), function(b) {
                        if ((!e || d.test(b.nodeType)) && (!f || c(b))) {
                            var h = a.startContainer;
                            if (b != h || !N(h) || a.startOffset != h.length) {
                                var i = a.endContainer;
                                b == i && N(i) && 0 == a.endOffset || g.push(b);
                            }
                        }
                    }), g;
                }(this, a, b);
            },
            getDocument: function() {
                return d(this);
            },
            collapseBefore: function(a) {
                this.setEndBefore(a), this.collapse(!1);
            },
            collapseAfter: function(a) {
                this.setStartAfter(a), this.collapse(!0);
            },
            getBookmark: function(b) {
                var c = d(this), e = a.createRange(c);
                b = b || J.getBody(c), e.selectNodeContents(b);
                var f = this.intersection(e), g = 0, h = 0;
                return f && (e.setEnd(f.startContainer, f.startOffset), h = (g = e.toString().length) + f.toString().length), 
                {
                    start: g,
                    end: h,
                    containerNode: b
                };
            },
            moveToBookmark: function(a) {
                var b = a.containerNode, c = 0;
                this.setStart(b, 0), this.collapse(!0);
                for (var d, e, f, g, h = [ b ], i = !1, j = !1; !j && (d = h.pop()); ) if (3 == d.nodeType) e = c + d.length, 
                !i && a.start >= c && a.start <= e && (this.setStart(d, a.start - c), i = !0), i && a.end >= c && a.end <= e && (this.setEnd(d, a.end - c), 
                j = !0), c = e; else for (f = (g = d.childNodes).length; f--; ) h.push(g[f]);
            },
            getName: function() {
                return "DomRange";
            },
            equals: function(a) {
                return I.rangesEqual(this, a);
            },
            isValid: function() {
                return y(this);
            },
            inspect: function() {
                return o(this);
            },
            detach: function() {}
        }), F(I, H), K.extend(I, {
            rangeProperties: ia,
            RangeIterator: p,
            copyComparisonConstants: D,
            createPrototypeRange: F,
            inspect: o,
            toHtml: B,
            getRangeDocument: d,
            rangesEqual: function(a, b) {
                return a.startContainer === b.startContainer && a.startOffset === b.startOffset && a.endContainer === b.endContainer && a.endOffset === b.endOffset;
            }
        }), a.DomRange = I;
    }), H.createCoreModule("WrappedRange", [ "DomRange" ], function(a, b) {
        var c, d, e = a.dom, f = a.util, g = e.DomPosition, h = a.DomRange, i = e.getBody, j = e.getContentDocument, k = e.isCharacterDataNode;
        if (a.features.implementsDomRange && function() {
            function d(a) {
                for (var b, c = m.length; c--; ) a[b = m[c]] = a.nativeRange[b];
                a.collapsed = a.startContainer === a.endContainer && a.startOffset === a.endOffset;
            }
            var k, l, m = h.rangeProperties;
            c = function(a) {
                if (!a) throw b.createError("WrappedRange: Range must be specified");
                this.nativeRange = a, d(this);
            }, h.createPrototypeRange(c, function(a, b, c, d, e) {
                var f = a.startContainer !== b || a.startOffset != c, g = a.endContainer !== d || a.endOffset != e, h = !a.equals(a.nativeRange);
                (f || g || h) && (a.setEnd(d, e), a.setStart(b, c));
            }), (k = c.prototype).selectNode = function(a) {
                this.nativeRange.selectNode(a), d(this);
            }, k.cloneContents = function() {
                return this.nativeRange.cloneContents();
            }, k.surroundContents = function(a) {
                this.nativeRange.surroundContents(a), d(this);
            }, k.collapse = function(a) {
                this.nativeRange.collapse(a), d(this);
            }, k.cloneRange = function() {
                return new c(this.nativeRange.cloneRange());
            }, k.refresh = function() {
                d(this);
            }, k.toString = function() {
                return this.nativeRange.toString();
            };
            var n = document.createTextNode("test");
            i(document).appendChild(n);
            var o = document.createRange();
            o.setStart(n, 0), o.setEnd(n, 0);
            try {
                o.setStart(n, 1), k.setStart = function(a, b) {
                    this.nativeRange.setStart(a, b), d(this);
                }, k.setEnd = function(a, b) {
                    this.nativeRange.setEnd(a, b), d(this);
                }, l = function(a) {
                    return function(b) {
                        this.nativeRange[a](b), d(this);
                    };
                };
            } catch (a) {
                k.setStart = function(a, b) {
                    try {
                        this.nativeRange.setStart(a, b);
                    } catch (c) {
                        this.nativeRange.setEnd(a, b), this.nativeRange.setStart(a, b);
                    }
                    d(this);
                }, k.setEnd = function(a, b) {
                    try {
                        this.nativeRange.setEnd(a, b);
                    } catch (c) {
                        this.nativeRange.setStart(a, b), this.nativeRange.setEnd(a, b);
                    }
                    d(this);
                }, l = function(a, b) {
                    return function(c) {
                        try {
                            this.nativeRange[a](c);
                        } catch (d) {
                            this.nativeRange[b](c), this.nativeRange[a](c);
                        }
                        d(this);
                    };
                };
            }
            k.setStartBefore = l("setStartBefore", "setEndBefore"), k.setStartAfter = l("setStartAfter", "setEndAfter"), 
            k.setEndBefore = l("setEndBefore", "setStartBefore"), k.setEndAfter = l("setEndAfter", "setStartAfter"), 
            k.selectNodeContents = function(a) {
                this.setStartAndEnd(a, 0, e.getNodeLength(a));
            }, o.selectNodeContents(n), o.setEnd(n, 3);
            var p = document.createRange();
            p.selectNodeContents(n), p.setEnd(n, 4), p.setStart(n, 2), -1 == o.compareBoundaryPoints(o.START_TO_END, p) && 1 == o.compareBoundaryPoints(o.END_TO_START, p) ? k.compareBoundaryPoints = function(a, b) {
                return a == (b = b.nativeRange || b).START_TO_END ? a = b.END_TO_START : a == b.END_TO_START && (a = b.START_TO_END), 
                this.nativeRange.compareBoundaryPoints(a, b);
            } : k.compareBoundaryPoints = function(a, b) {
                return this.nativeRange.compareBoundaryPoints(a, b.nativeRange || b);
            };
            var q = document.createElement("div");
            q.innerHTML = "123";
            var r = q.firstChild, s = i(document);
            s.appendChild(q), o.setStart(r, 1), o.setEnd(r, 2), o.deleteContents(), "13" == r.data && (k.deleteContents = function() {
                this.nativeRange.deleteContents(), d(this);
            }, k.extractContents = function() {
                var a = this.nativeRange.extractContents();
                return d(this), a;
            }), s.removeChild(q), s = null, f.isHostMethod(o, "createContextualFragment") && (k.createContextualFragment = function(a) {
                return this.nativeRange.createContextualFragment(a);
            }), i(document).removeChild(n), k.getName = function() {
                return "WrappedRange";
            }, a.WrappedRange = c, a.createNativeRange = function(a) {
                return (a = j(a, b, "createNativeRange")).createRange();
            };
        }(), a.features.implementsTextRange) {
            var n = function(a, b, c, d, f) {
                var h = a.duplicate();
                h.collapse(c);
                var i = h.parentElement();
                if (e.isOrIsAncestorOf(b, i) || (i = b), !i.canHaveHTML) {
                    var j = new g(i.parentNode, e.getNodeIndex(i));
                    return {
                        boundaryPosition: j,
                        nodeInfo: {
                            nodeIndex: j.offset,
                            containerElement: j.node
                        }
                    };
                }
                var l = e.getDocument(i).createElement("span");
                l.parentNode && e.removeNode(l);
                for (var m, n, o, p, q, r = c ? "StartToStart" : "StartToEnd", s = f && f.containerElement == i ? f.nodeIndex : 0, t = i.childNodes.length, u = t, v = u; v == t ? i.appendChild(l) : i.insertBefore(l, i.childNodes[v]), 
                h.moveToElementText(l), 0 != (m = h.compareEndPoints(r, a)) && s != u; ) {
                    if (-1 == m) {
                        if (u == s + 1) break;
                        s = v;
                    } else u = u == s + 1 ? s : v;
                    v = Math.floor((s + u) / 2), i.removeChild(l);
                }
                if (q = l.nextSibling, -1 == m && q && k(q)) {
                    var w;
                    if (h.setEndPoint(c ? "EndToStart" : "EndToEnd", a), /[\r\n]/.test(q.data)) {
                        var x = h.duplicate(), y = x.text.replace(/\r\n/g, "\r").length;
                        for (w = x.moveStart("character", y); -1 == (m = x.compareEndPoints("StartToEnd", x)); ) w++, 
                        x.moveStart("character", 1);
                    } else w = h.text.length;
                    p = new g(q, w);
                } else n = (d || !c) && l.previousSibling, p = (o = (d || c) && l.nextSibling) && k(o) ? new g(o, 0) : n && k(n) ? new g(n, n.data.length) : new g(i, e.getNodeIndex(l));
                return e.removeNode(l), {
                    boundaryPosition: p,
                    nodeInfo: {
                        nodeIndex: v,
                        containerElement: i
                    }
                };
            }, o = function(a, b) {
                var c, d, f, g, h = a.offset, j = e.getDocument(a.node), l = i(j).createTextRange(), m = k(a.node);
                return m ? d = (c = a.node).parentNode : (c = h < (g = a.node.childNodes).length ? g[h] : null, 
                d = a.node), (f = j.createElement("span")).innerHTML = "&#feff;", c ? d.insertBefore(f, c) : d.appendChild(f), 
                l.moveToElementText(f), l.collapse(!b), d.removeChild(f), m && l[b ? "moveStart" : "moveEnd"]("character", h), 
                l;
            };
            ((d = function(a) {
                this.textRange = a, this.refresh();
            }).prototype = new h(document)).refresh = function() {
                var a, b, c, d = function(a) {
                    var b = a.parentElement(), c = a.duplicate();
                    c.collapse(!0);
                    var d = c.parentElement();
                    (c = a.duplicate()).collapse(!1);
                    var f = c.parentElement(), g = d == f ? d : e.getCommonAncestor(d, f);
                    return g == b ? g : e.getCommonAncestor(b, g);
                }(this.textRange);
                !function(a) {
                    return 0 == a.compareEndPoints("StartToEnd", a);
                }(this.textRange) ? (a = (c = n(this.textRange, d, !0, !1)).boundaryPosition, b = n(this.textRange, d, !1, !1, c.nodeInfo).boundaryPosition) : b = a = n(this.textRange, d, !0, !0).boundaryPosition, 
                this.setStart(a.node, a.offset), this.setEnd(b.node, b.offset);
            }, d.prototype.getName = function() {
                return "WrappedTextRange";
            }, h.copyComparisonConstants(d);
            var p = function(a) {
                if (a.collapsed) return o(new g(a.startContainer, a.startOffset), !0);
                var b = o(new g(a.startContainer, a.startOffset), !0), c = o(new g(a.endContainer, a.endOffset), !1), d = i(h.getRangeDocument(a)).createTextRange();
                return d.setEndPoint("StartToStart", b), d.setEndPoint("EndToEnd", c), d;
            };
            if (d.rangeToTextRange = p, d.prototype.toTextRange = function() {
                return p(this);
            }, a.WrappedTextRange = d, !a.features.implementsDomRange || a.config.preferTextRange) {
                var q = Function("return this;")();
                void 0 === q.Range && (q.Range = d), a.createNativeRange = function(a) {
                    return a = j(a, b, "createNativeRange"), i(a).createTextRange();
                }, a.WrappedRange = d;
            }
        }
        a.createRange = function(c) {
            return c = j(c, b, "createRange"), new a.WrappedRange(a.createNativeRange(c));
        }, a.createRangyRange = function(a) {
            return a = j(a, b, "createRangyRange"), new h(a);
        }, f.createAliasForDeprecatedMethod(a, "createIframeRange", "createRange"), f.createAliasForDeprecatedMethod(a, "createIframeRangyRange", "createRangyRange"), 
        a.addShimListener(function(b) {
            var c = b.document;
            void 0 === c.createRange && (c.createRange = function() {
                return a.createRange(c);
            }), c = b = null;
        });
    }), H.createCoreModule("WrappedSelection", [ "DomRange", "WrappedRange" ], function(a, b) {
        function c(a) {
            return "string" == typeof a ? /^backward(s)?$/i.test(a) : !!a;
        }
        function d(a, c) {
            if (a) {
                if (C.isWindow(a)) return a;
                if (a instanceof r) return a.win;
                var d = C.getContentDocument(a, b, c);
                return C.getWindow(d);
            }
            return window;
        }
        function f(a) {
            return d(a, "getDocSelection").document.selection;
        }
        function g(a) {
            var b = !1;
            return a.anchorNode && (b = 1 == C.comparePoints(a.anchorNode, a.anchorOffset, a.focusNode, a.focusOffset)), 
            b;
        }
        function h(a, b, c) {
            var d = c ? "end" : "start", e = c ? "start" : "end";
            a.anchorNode = b[d + "Container"], a.anchorOffset = b[d + "Offset"], a.focusNode = b[e + "Container"], 
            a.focusOffset = b[e + "Offset"];
        }
        function j(a) {
            a.anchorNode = a.focusNode = null, a.anchorOffset = a.focusOffset = 0, a.rangeCount = 0, 
            a.isCollapsed = !0, a._ranges.length = 0;
        }
        function k(b) {
            var c;
            return b instanceof F ? ((c = a.createNativeRange(b.getDocument())).setEnd(b.endContainer, b.endOffset), 
            c.setStart(b.startContainer, b.startOffset)) : b instanceof G ? c = b.nativeRange : J.implementsDomRange && b instanceof C.getWindow(b.startContainer).Range && (c = b), 
            c;
        }
        function m(a) {
            var c = a.getNodes();
            if (!function(a) {
                if (!a.length || 1 != a[0].nodeType) return !1;
                for (var b = 1, c = a.length; b < c; ++b) if (!C.isAncestorOf(a[0], a[b])) return !1;
                return !0;
            }(c)) throw b.createError("getSingleElementFromRange: range " + a.inspect() + " did not consist of a single element");
            return c[0];
        }
        function n(a) {
            return !!a && void 0 !== a.text;
        }
        function o(a, b) {
            var c = new G(b);
            a._ranges = [ c ], h(a, c, !1), a.rangeCount = 1, a.isCollapsed = c.collapsed;
        }
        function p(b) {
            if (b._ranges.length = 0, "None" == b.docSelection.type) j(b); else {
                var c = b.docSelection.createRange();
                if (n(c)) o(b, c); else {
                    b.rangeCount = c.length;
                    for (var d, e = L(c.item(0)), f = 0; f < b.rangeCount; ++f) (d = a.createRange(e)).selectNode(c.item(f)), 
                    b._ranges.push(d);
                    b.isCollapsed = 1 == b.rangeCount && b._ranges[0].collapsed, h(b, b._ranges[b.rangeCount - 1], !1);
                }
            }
        }
        function q(a, c) {
            for (var d = a.docSelection.createRange(), e = m(c), f = L(d.item(0)), g = M(f).createControlRange(), h = 0, i = d.length; h < i; ++h) g.add(d.item(h));
            try {
                g.add(e);
            } catch (a) {
                throw b.createError("addRange(): Element within the specified Range could not be added to control selection (does it have layout?)");
            }
            g.select(), p(a);
        }
        function r(a, b, c) {
            this.nativeSelection = a, this.docSelection = b, this._ranges = [], this.win = c, 
            this.refresh();
        }
        function s(a) {
            a.win = a.anchorNode = a.focusNode = a._ranges = null, a.rangeCount = a.anchorOffset = a.focusOffset = 0, 
            a.detached = !0;
        }
        function t(a, b) {
            for (var c, d, e = ba.length; e--; ) if (d = (c = ba[e]).selection, "deleteAll" == b) s(d); else if (c.win == a) return "delete" == b ? (ba.splice(e, 1), 
            !0) : d;
            return "deleteAll" == b && (ba.length = 0), null;
        }
        function u(a, c) {
            for (var d, e = L(c[0].startContainer), f = M(e).createControlRange(), g = 0, h = c.length; g < h; ++g) {
                d = m(c[g]);
                try {
                    f.add(d);
                } catch (a) {
                    throw b.createError("setRanges(): Element within one of the specified Ranges could not be added to control selection (does it have layout?)");
                }
            }
            f.select(), p(a);
        }
        function v(a, b) {
            if (a.win.document != L(b)) throw new H("WRONG_DOCUMENT_ERR");
        }
        function w(b) {
            return function(c, d) {
                var e;
                this.rangeCount ? (e = this.getRangeAt(0))["set" + (b ? "Start" : "End")](c, d) : (e = a.createRange(this.win.document)).setStartAndEnd(c, d), 
                this.setSingleRange(e, this.isBackward());
            };
        }
        function x(a) {
            var b = [], c = new I(a.anchorNode, a.anchorOffset), d = new I(a.focusNode, a.focusOffset), e = "function" == typeof a.getName ? a.getName() : "Selection";
            if (void 0 !== a.rangeCount) for (var f = 0, g = a.rangeCount; f < g; ++f) b[f] = F.inspect(a.getRangeAt(f));
            return "[" + e + "(Ranges: " + b.join(", ") + ")(anchor: " + c.inspect() + ", focus: " + d.inspect() + "]";
        }
        a.config.checkSelectionRanges = !0;
        var y, z, A = "boolean", B = "number", C = a.dom, D = a.util, E = D.isHostMethod, F = a.DomRange, G = a.WrappedRange, H = a.DOMException, I = C.DomPosition, J = a.features, K = "Control", L = C.getDocument, M = C.getBody, N = F.rangesEqual, O = E(window, "getSelection"), P = D.isHostObject(document, "selection");
        J.implementsWinGetSelection = O;
        var Q = (J.implementsDocSelection = P) && (!O || a.config.preferTextRange);
        if (Q) y = f, a.isSelectionValid = function(a) {
            var b = d(a, "isSelectionValid").document, c = b.selection;
            return "None" != c.type || L(c.createRange().parentElement()) == b;
        }; else {
            if (!O) return b.fail("Neither document.selection or window.getSelection() detected."), 
            !1;
            y = function(a) {
                return d(a, "getWinSelection").getSelection();
            }, a.isSelectionValid = function() {
                return !0;
            };
        }
        var R = (a.getNativeSelection = y)();
        if (!R) return b.fail("Native selection was null (possibly issue 138?)"), !1;
        var S = a.createNativeRange(document), T = M(document), U = D.areHostProperties(R, [ "anchorNode", "focusNode", "anchorOffset", "focusOffset" ]);
        J.selectionHasAnchorAndFocus = U;
        var V = E(R, "extend");
        J.selectionHasExtend = V;
        var W = typeof R.rangeCount == B;
        J.selectionHasRangeCount = W;
        var X = !1, Y = !0, Z = V ? function(b, c) {
            var d = F.getRangeDocument(c), e = a.createRange(d);
            e.collapseToPoint(c.endContainer, c.endOffset), b.addRange(k(e)), b.extend(c.startContainer, c.startOffset);
        } : null;
        D.areHostMethods(R, [ "addRange", "getRangeAt", "removeAllRanges" ]) && typeof R.rangeCount == B && J.implementsDomRange && function() {
            var b = window.getSelection();
            if (b) {
                for (var c = b.rangeCount, d = 1 < c, e = [], f = g(b), h = 0; h < c; ++h) e[h] = b.getRangeAt(h);
                var i = C.createTestElement(document, "", !1), j = i.appendChild(document.createTextNode("   ")), k = document.createRange();
                if (k.setStart(j, 1), k.collapse(!0), b.removeAllRanges(), b.addRange(k), Y = 1 == b.rangeCount, 
                b.removeAllRanges(), !d) {
                    var l = window.navigator.appVersion.match(/Chrome\/(.*?) /);
                    if (l && 36 <= parseInt(l[1])) X = !1; else {
                        var m = k.cloneRange();
                        k.setStart(j, 0), m.setEnd(j, 3), m.setStart(j, 2), b.addRange(k), b.addRange(m), 
                        X = 2 == b.rangeCount;
                    }
                }
                for (C.removeNode(i), b.removeAllRanges(), h = 0; h < c; ++h) 0 == h && f ? Z ? Z(b, e[h]) : (a.warn("Rangy initialization: original selection was backwards but selection has been restored forwards because the browser does not support Selection.extend"), 
                b.addRange(e[h])) : b.addRange(e[h]);
            }
        }(), J.selectionSupportsMultipleRanges = X, J.collapsedNonEditableSelectionsSupported = Y;
        var $, aa, _ = !1;
        T && E(T, "createControlRange") && ($ = T.createControlRange(), D.areHostProperties($, [ "item", "add" ]) && (_ = !0)), 
        J.implementsControlRange = _, z = U ? function(a) {
            return a.anchorNode === a.focusNode && a.anchorOffset === a.focusOffset;
        } : function(a) {
            return !!a.rangeCount && a.getRangeAt(a.rangeCount - 1).collapsed;
        }, E(R, "getRangeAt") ? aa = function(a, b) {
            try {
                return a.getRangeAt(b);
            } catch (a) {
                return null;
            }
        } : U && (aa = function(b) {
            var c = L(b.anchorNode), d = a.createRange(c);
            return d.setStartAndEnd(b.anchorNode, b.anchorOffset, b.focusNode, b.focusOffset), 
            d.collapsed !== this.isCollapsed && d.setStartAndEnd(b.focusNode, b.focusOffset, b.anchorNode, b.anchorOffset), 
            d;
        }), r.prototype = a.selectionPrototype;
        var ba = [], ca = function(a) {
            if (a && a instanceof r) return a.refresh(), a;
            var b = t(a = d(a, "getNativeSelection")), c = y(a), e = P ? f(a) : null;
            return b ? (b.nativeSelection = c, b.docSelection = e, b.refresh()) : (b = new r(c, e, a), 
            ba.push({
                win: a,
                selection: b
            })), b;
        };
        a.getSelection = ca, D.createAliasForDeprecatedMethod(a, "getIframeSelection", "getSelection");
        var fa, da = r.prototype;
        if (!Q && U && D.areHostMethods(R, [ "removeAllRanges", "addRange" ])) {
            da.removeAllRanges = function() {
                this.nativeSelection.removeAllRanges(), j(this);
            };
            var ea = function(a, b) {
                Z(a.nativeSelection, b), a.refresh();
            };
            da.addRange = W ? function(b, d) {
                if (_ && P && this.docSelection.type == K) q(this, b); else if (c(d) && V) ea(this, b); else {
                    var e;
                    X ? e = this.rangeCount : (this.removeAllRanges(), e = 0);
                    var f = k(b).cloneRange();
                    try {
                        this.nativeSelection.addRange(f);
                    } catch (a) {}
                    if (this.rangeCount = this.nativeSelection.rangeCount, this.rangeCount == e + 1) {
                        if (a.config.checkSelectionRanges) {
                            var g = aa(this.nativeSelection, this.rangeCount - 1);
                            g && !N(g, b) && (b = new G(g));
                        }
                        this._ranges[this.rangeCount - 1] = b, h(this, b, ha(this.nativeSelection)), this.isCollapsed = z(this);
                    } else this.refresh();
                }
            } : function(a, b) {
                c(b) && V ? ea(this, a) : (this.nativeSelection.addRange(k(a)), this.refresh());
            }, da.setRanges = function(a) {
                if (_ && P && 1 < a.length) u(this, a); else {
                    this.removeAllRanges();
                    for (var b = 0, c = a.length; b < c; ++b) this.addRange(a[b]);
                }
            };
        } else {
            if (!(E(R, "empty") && E(S, "select") && _ && Q)) return b.fail("No means of selecting a Range or TextRange was found"), 
            !1;
            da.removeAllRanges = function() {
                try {
                    if (this.docSelection.empty(), "None" != this.docSelection.type) {
                        var a;
                        if (this.anchorNode) a = L(this.anchorNode); else if (this.docSelection.type == K) {
                            var b = this.docSelection.createRange();
                            b.length && (a = L(b.item(0)));
                        }
                        if (a) M(a).createTextRange().select(), this.docSelection.empty();
                    }
                } catch (a) {}
                j(this);
            }, da.addRange = function(b) {
                this.docSelection.type == K ? q(this, b) : (a.WrappedTextRange.rangeToTextRange(b).select(), 
                this._ranges[0] = b, this.rangeCount = 1, this.isCollapsed = this._ranges[0].collapsed, 
                h(this, b, !1));
            }, da.setRanges = function(a) {
                this.removeAllRanges();
                var b = a.length;
                1 < b ? u(this, a) : b && this.addRange(a[0]);
            };
        }
        if (da.getRangeAt = function(a) {
            if (a < 0 || a >= this.rangeCount) throw new H("INDEX_SIZE_ERR");
            return this._ranges[a].cloneRange();
        }, Q) fa = function(b) {
            var c;
            a.isSelectionValid(b.win) ? c = b.docSelection.createRange() : (c = M(b.win.document).createTextRange()).collapse(!0), 
            b.docSelection.type == K ? p(b) : n(c) ? o(b, c) : j(b);
        }; else if (E(R, "getRangeAt") && typeof R.rangeCount == B) fa = function(b) {
            if (_ && P && b.docSelection.type == K) p(b); else if (b._ranges.length = b.rangeCount = b.nativeSelection.rangeCount, 
            b.rangeCount) {
                for (var c = 0, d = b.rangeCount; c < d; ++c) b._ranges[c] = new a.WrappedRange(b.nativeSelection.getRangeAt(c));
                h(b, b._ranges[b.rangeCount - 1], ha(b.nativeSelection)), b.isCollapsed = z(b);
            } else j(b);
        }; else {
            if (!U || typeof R.isCollapsed != A || typeof S.collapsed != A || !J.implementsDomRange) return b.fail("No means of obtaining a Range or TextRange from the user's selection was found"), 
            !1;
            fa = function(a) {
                var b, c = a.nativeSelection;
                c.anchorNode ? (b = aa(c, 0), a._ranges = [ b ], a.rangeCount = 1, function(a) {
                    var b = a.nativeSelection;
                    a.anchorNode = b.anchorNode, a.anchorOffset = b.anchorOffset, a.focusNode = b.focusNode, 
                    a.focusOffset = b.focusOffset;
                }(a), a.isCollapsed = z(a)) : j(a);
            };
        }
        da.refresh = function(a) {
            var b = a ? this._ranges.slice(0) : null, c = this.anchorNode, d = this.anchorOffset;
            if (fa(this), a) {
                var e = b.length;
                if (e != this._ranges.length) return !0;
                if (this.anchorNode != c || this.anchorOffset != d) return !0;
                for (;e--; ) if (!N(b[e], this._ranges[e])) return !0;
                return !1;
            }
        };
        var ha, ga = function(a, b) {
            var c = a.getAllRanges();
            a.removeAllRanges();
            for (var d = 0, e = c.length; d < e; ++d) N(b, c[d]) || a.addRange(c[d]);
            a.rangeCount || j(a);
        };
        da.removeRange = _ && P ? function(a) {
            if (this.docSelection.type == K) {
                for (var c = this.docSelection.createRange(), d = m(a), e = L(c.item(0)), f = M(e).createControlRange(), g = !1, h = 0, i = c.length; h < i; ++h) c.item(h) !== d || g ? f.add(c.item(h)) : g = !0;
                f.select(), p(this);
            } else ga(this, a);
        } : function(a) {
            ga(this, a);
        }, !Q && U && J.implementsDomRange ? (ha = g, da.isBackward = function() {
            return ha(this);
        }) : ha = da.isBackward = function() {
            return !1;
        }, da.isBackwards = da.isBackward, da.toString = function() {
            for (var a = [], b = 0, c = this.rangeCount; b < c; ++b) a[b] = "" + this._ranges[b];
            return a.join("");
        }, da.collapse = function(b, c) {
            v(this, b);
            var d = a.createRange(b);
            d.collapseToPoint(b, c), this.setSingleRange(d), this.isCollapsed = !0;
        }, da.collapseToStart = function() {
            if (!this.rangeCount) throw new H("INVALID_STATE_ERR");
            var a = this._ranges[0];
            this.collapse(a.startContainer, a.startOffset);
        }, da.collapseToEnd = function() {
            if (!this.rangeCount) throw new H("INVALID_STATE_ERR");
            var a = this._ranges[this.rangeCount - 1];
            this.collapse(a.endContainer, a.endOffset);
        }, da.selectAllChildren = function(b) {
            v(this, b);
            var c = a.createRange(b);
            c.selectNodeContents(b), this.setSingleRange(c);
        }, da.deleteFromDocument = function() {
            if (_ && P && this.docSelection.type == K) {
                for (var a, b = this.docSelection.createRange(); b.length; ) a = b.item(0), b.remove(a), 
                C.removeNode(a);
                this.refresh();
            } else if (this.rangeCount) {
                var c = this.getAllRanges();
                if (c.length) {
                    this.removeAllRanges();
                    for (var d = 0, e = c.length; d < e; ++d) c[d].deleteContents();
                    this.addRange(c[e - 1]);
                }
            }
        }, da.eachRange = function(a, b) {
            for (var c = 0, d = this._ranges.length; c < d; ++c) if (a(this.getRangeAt(c))) return b;
        }, da.getAllRanges = function() {
            var a = [];
            return this.eachRange(function(b) {
                a.push(b);
            }), a;
        }, da.setSingleRange = function(a, b) {
            this.removeAllRanges(), this.addRange(a, b);
        }, da.callMethodOnEachRange = function(a, b) {
            var c = [];
            return this.eachRange(function(d) {
                c.push(d[a].apply(d, b || []));
            }), c;
        }, da.setStart = w(!0), da.setEnd = w(!1), a.rangePrototype.select = function(a) {
            ca(this.getDocument()).setSingleRange(this, a);
        }, da.changeEachRange = function(a) {
            var b = [], c = this.isBackward();
            this.eachRange(function(c) {
                a(c), b.push(c);
            }), this.removeAllRanges(), c && 1 == b.length ? this.addRange(b[0], "backward") : this.setRanges(b);
        }, da.containsNode = function(a, b) {
            return this.eachRange(function(c) {
                return c.containsNode(a, b);
            }, !0) || !1;
        }, da.getBookmark = function(a) {
            return {
                backward: this.isBackward(),
                rangeBookmarks: this.callMethodOnEachRange("getBookmark", [ a ])
            };
        }, da.moveToBookmark = function(b) {
            for (var c, d, e = [], f = 0; c = b.rangeBookmarks[f++]; ) (d = a.createRange(this.win)).moveToBookmark(c), 
            e.push(d);
            b.backward ? this.setSingleRange(e[0], "backward") : this.setRanges(e);
        }, da.saveRanges = function() {
            return {
                backward: this.isBackward(),
                ranges: this.callMethodOnEachRange("cloneRange")
            };
        }, da.restoreRanges = function(a) {
            this.removeAllRanges();
            for (var b, c = 0; b = a.ranges[c]; ++c) this.addRange(b, a.backward && 0 == c);
        }, da.toHtml = function() {
            var a = [];
            return this.eachRange(function(b) {
                a.push(F.toHtml(b));
            }), a.join("");
        }, J.implementsTextRange && (da.getNativeTextRange = function() {
            var c;
            if (c = this.docSelection) {
                var d = c.createRange();
                if (n(d)) return d;
                throw b.createError("getNativeTextRange: selection is a control selection");
            }
            if (0 < this.rangeCount) return a.WrappedTextRange.rangeToTextRange(this.getRangeAt(0));
            throw b.createError("getNativeTextRange: selection contains no range");
        }), da.getName = function() {
            return "WrappedSelection";
        }, da.inspect = function() {
            return x(this);
        }, da.detach = function() {
            t(this.win, "delete"), s(this);
        }, r.detachAll = function() {
            t(null, "deleteAll");
        }, r.inspect = x, r.isDirectionBackward = c, a.Selection = r, a.selectionPrototype = da, 
        a.addShimListener(function(a) {
            void 0 === a.getSelection && (a.getSelection = function() {
                return ca(a);
            }), a = null;
        });
    });
    var M = !1, N = function(a) {
        M || (M = !0, !H.initialized && H.config.autoInitialize && l());
    };
    return F && ("complete" == document.readyState ? N() : (a(document, "addEventListener") && document.addEventListener("DOMContentLoaded", N, !1), 
    J(window, "load", N))), H;
}, this), function(a, b) {
    "function" == typeof define && define.amd ? define([ "./rangy-core" ], a) : "undefined" != typeof module && "object" == typeof exports ? module.exports = a(require("rangy")) : a(b.rangy);
}(function(a) {
    return a.createModule("SaveRestore", [ "WrappedRange" ], function(a, b) {
        function c(a, b) {
            return (b || document).getElementById(a);
        }
        function d(a, b) {
            var c, d = "selectionBoundary_" + +new Date() + "_" + ("" + Math.random()).slice(2), e = o.getDocument(a.startContainer), f = a.cloneRange();
            return f.collapse(b), (c = e.createElement("span")).id = d, c.style.lineHeight = "0", 
            c.style.display = "none", c.className = "rangySelectionBoundary", c.appendChild(e.createTextNode(r)), 
            f.insertNode(c), c;
        }
        function e(a, d, e, f) {
            var g = c(e, a);
            g ? (d[f ? "setStartBefore" : "setEndBefore"](g), p(g)) : b.warn("Marker element has been removed. Cannot restore selection.");
        }
        function f(a, b) {
            return b.compareBoundaryPoints(a.START_TO_START, a);
        }
        function g(b, c) {
            var f, g = a.DomRange.getRangeDocument(b), h = b.toString(), i = q(c);
            return b.collapsed ? {
                document: g,
                markerId: (f = d(b, !1)).id,
                collapsed: !0
            } : (f = d(b, !1), {
                document: g,
                startMarkerId: d(b, !0).id,
                endMarkerId: f.id,
                collapsed: !1,
                backward: i,
                toString: function() {
                    return "original text: '" + h + "', new text: '" + b.toString() + "'";
                }
            });
        }
        function h(d, f) {
            var g = d.document;
            void 0 === f && (f = !0);
            var h = a.createRange(g);
            if (d.collapsed) {
                var i = c(d.markerId, g);
                if (i) {
                    i.style.display = "inline";
                    var j = i.previousSibling;
                    j && 3 == j.nodeType ? (p(i), h.collapseToPoint(j, j.length)) : (h.collapseBefore(i), 
                    p(i));
                } else b.warn("Marker element has been removed. Cannot restore selection.");
            } else e(g, h, d.startMarkerId, !0), e(g, h, d.endMarkerId, !1);
            return f && h.normalizeBoundaries(), h;
        }
        function i(b, d) {
            var e, h, i = [], j = q(d);
            (b = b.slice(0)).sort(f);
            for (var k = 0, l = b.length; k < l; ++k) i[k] = g(b[k], j);
            for (k = l - 1; 0 <= k; --k) e = b[k], h = a.DomRange.getRangeDocument(e), e.collapsed ? e.collapseAfter(c(i[k].markerId, h)) : (e.setEndBefore(c(i[k].endMarkerId, h)), 
            e.setStartAfter(c(i[k].startMarkerId, h)));
            return i;
        }
        function k(a) {
            for (var b = [], d = a.length - 1; 0 <= d; d--) b[d] = h(a[d], !0);
            return b;
        }
        function m(a, b) {
            var d = c(b, a);
            d && p(d);
        }
        var o = a.dom, p = o.removeNode, q = a.Selection.isDirectionBackward, r = "\ufeff";
        a.util.extend(a, {
            saveRange: g,
            restoreRange: h,
            saveRanges: i,
            restoreRanges: k,
            saveSelection: function(c) {
                if (!a.isSelectionValid(c)) return b.warn("Cannot save selection. This usually happens when the selection is collapsed and the selection document has lost focus."), 
                null;
                var d = a.getSelection(c), e = d.getAllRanges(), f = 1 == e.length && d.isBackward(), g = i(e, f);
                return f ? d.setSingleRange(e[0], f) : d.setRanges(e), {
                    win: c,
                    rangeInfos: g,
                    restored: !1
                };
            },
            restoreSelection: function(b, c) {
                if (!b.restored) {
                    var d = b.rangeInfos, e = a.getSelection(b.win), f = k(d);
                    1 == d.length && c && a.features.selectionHasExtend && d[0].backward ? (e.removeAllRanges(), 
                    e.addRange(f[0], !0)) : e.setRanges(f), b.restored = !0;
                }
            },
            removeMarkerElement: m,
            removeMarkers: function(a) {
                for (var b, c = a.rangeInfos, d = 0, e = c.length; d < e; ++d) (b = c[d]).collapsed ? m(a.doc, b.markerId) : (m(a.doc, b.startMarkerId), 
                m(a.doc, b.endMarkerId));
            }
        });
    }), a;
}, this), function(a, b, c) {
    "use strict";
    function e(a) {
        var c = [];
        return l(c, b.noop).chars(a), c.join("");
    }
    function f(a) {
        var b, c = {}, d = a.split(",");
        for (b = 0; b < d.length; b++) c[d[b]] = !0;
        return c;
    }
    function g(a, c) {
        function d(a, d, f, g) {
            if (d = b.lowercase(d), D[d]) for (;k.last() && E[k.last()]; ) e("", k.last());
            C[d] && k.last() == d && e("", d), (g = z[d] || !!g) || k.push(d);
            var i = {};
            f.replace(p, function(a, b, c, d, e) {
                var f = c || d || e || "";
                i[b] = h(f);
            }), c.start && c.start(d, i, g);
        }
        function e(a, d) {
            var e, f = 0;
            if (d = b.lowercase(d)) for (f = k.length - 1; 0 <= f && k[f] != d; f--) ;
            if (0 <= f) {
                for (e = k.length - 1; f <= e; e--) c.end && c.end(k[e]);
                k.length = f;
            }
        }
        "string" != typeof a && (a = null == a ? "" : "" + a);
        var f, g, i, j, k = [], l = a;
        for (k.last = function() {
            return k[k.length - 1];
        }; a; ) {
            if (g = !(j = ""), k.last() && G[k.last()] ? (a = a.replace(new RegExp("([^]*)<\\s*\\/\\s*" + k.last() + "[^>]*>", "i"), function(a, b) {
                return b = b.replace(s, "$1").replace(v, "$1"), c.chars && c.chars(h(b)), "";
            }), e(0, k.last())) : (y.test(a) ? (i = a.match(y)) && (i[0], c.whitespace && c.whitespace(i[0]), 
            a = a.replace(i[0], ""), g = !1) : t.test(a) ? (i = a.match(t)) && (c.comment && c.comment(i[1]), 
            a = a.replace(i[0], ""), g = !1) : u.test(a) ? (i = a.match(u)) && (a = a.replace(i[0], ""), 
            g = !1) : r.test(a) ? (i = a.match(o)) && (a = a.substring(i[0].length), i[0].replace(o, e), 
            g = !1) : q.test(a) && ((i = a.match(n)) ? (i[4] && (a = a.substring(i[0].length), 
            i[0].replace(n, d)), g = !1) : (j += "<", a = a.substring(1))), g && (j += (f = a.indexOf("<")) < 0 ? a : a.substring(0, f), 
            a = f < 0 ? "" : a.substring(f), c.chars && c.chars(h(j)))), a == l) throw m("badparse", "The sanitizer was unable to parse the following block of html: {0}", a);
            l = a;
        }
        e();
    }
    function h(a) {
        if (!a) return "";
        var b = N.exec(a), c = b[1], d = b[3], e = b[2];
        return e && (M.innerHTML = e.replace(/</g, "&lt;"), e = "textContent" in M ? M.textContent : M.innerText), 
        c + e + d;
    }
    function i(a) {
        return a.replace(/&/g, "&amp;").replace(w, function(a) {
            return "&#" + (1024 * (a.charCodeAt(0) - 55296) + (a.charCodeAt(1) - 56320) + 65536) + ";";
        }).replace(x, function(a) {
            var b = a.charCodeAt(0);
            return b <= 159 || 173 == b || 1536 <= b && b <= 1540 || 1807 == b || 6068 == b || 6069 == b || 8204 <= b && b <= 8207 || 8232 <= b && b <= 8239 || 8288 <= b && b <= 8303 || 65279 == b || 65520 <= b && b <= 65535 ? "&#" + b + ";" : a;
        }).replace(/</g, "&lt;").replace(/>/g, "&gt;");
    }
    function l(a, c) {
        var d = !1, e = b.bind(a, a.push);
        return {
            start: function(a, f, g) {
                a = b.lowercase(a), !d && G[a] && (d = a), d || !0 !== H[a] || (e("<"), e(a), b.forEach(f, function(d, g) {
                    var h = b.lowercase(g), l = "img" === a && "src" === h || "background" === h;
                    ("style" === h && "" !== (d = function(a) {
                        var c = "", d = a.split(";");
                        return b.forEach(d, function(a) {
                            var d = a.split(":");
                            if (2 == d.length) {
                                var e = O(b.lowercase(d[0]));
                                a = O(b.lowercase(d[1])), (("color" === e || "background-color" === e) && (a.match(/^rgb\([0-9%,\. ]*\)$/i) || a.match(/^rgba\([0-9%,\. ]*\)$/i) || a.match(/^hsl\([0-9%,\. ]*\)$/i) || a.match(/^hsla\([0-9%,\. ]*\)$/i) || a.match(/^#[0-9a-f]{3,6}$/i) || a.match(/^[a-z]*$/i)) || "text-align" === e && ("left" === a || "right" === a || "center" === a || "justify" === a) || "text-decoration" === e && ("underline" === a || "line-through" === a) || "font-weight" === e && "bold" === a || "font-style" === e && "italic" === a || "float" === e && ("left" === a || "right" === a || "none" === a) || "vertical-align" === e && ("baseline" === a || "sub" === a || "super" === a || "test-top" === a || "text-bottom" === a || "middle" === a || "top" === a || "bottom" === a || a.match(/[0-9]*(px|em)/) || a.match(/[0-9]+?%/)) || "font-size" === e && ("xx-small" === a || "x-small" === a || "small" === a || "medium" === a || "large" === a || "x-large" === a || "xx-large" === a || "larger" === a || "smaller" === a || a.match(/[0-9]*\.?[0-9]*(px|em|rem|mm|q|cm|in|pt|pc|%)/)) || ("width" === e || "height" === e) && a.match(/[0-9\.]*(px|em|rem|%)/) || "direction" === e && a.match(/^ltr|rtl|initial|inherit$/)) && (c += e + ": " + a + ";");
                            }
                        }), c;
                    }(d)) || function(a, b, c, d) {
                        return !("img" !== a || !b["ta-insert-video"] || "ta-insert-video" !== c && "allowfullscreen" !== c && "frameborder" !== c && ("contenteditable" !== c || "false" !== d));
                    }(a, f, h, d) || !0 === L[h] && (!0 !== I[h] || c(d, l))) && (e(" "), e(g), e('="'), 
                    e(i(d)), e('"'));
                }), e(g ? "/>" : ">"));
            },
            comment: function(a) {
                e(a);
            },
            whitespace: function(a) {
                e(i(a));
            },
            end: function(a) {
                a = b.lowercase(a), d || !0 !== H[a] || (e("</"), e(a), e(">")), a == d && (d = !1);
            },
            chars: function(a) {
                d || e(i(a));
            }
        };
    }
    var m = b.$$minErr("$sanitize"), n = /^<((?:[a-zA-Z])[\w:-]*)((?:\s+[\w:-]+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)\s*(>?)/, o = /^<\/\s*([\w:-]+)[^>]*>/, p = /([\w:-]+)(?:\s*=\s*(?:(?:"((?:[^"])*)")|(?:'((?:[^'])*)')|([^>\s]+)))?/g, q = /^</, r = /^<\//, s = /<!--(.*?)-->/g, t = /(^<!--.*?-->)/, u = /<!DOCTYPE([^>]*?)>/i, v = /<!\[CDATA\[(.*?)]]>/g, w = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g, x = /([^\#-~| |!])/g, y = /^(\s+)/, z = f("area,br,col,hr,img,wbr,input"), A = f("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"), B = f("rp,rt"), C = b.extend({}, B, A), D = b.extend({}, A, f("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,script,section,table,ul")), E = b.extend({}, B, f("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")), F = f("animate,animateColor,animateMotion,animateTransform,circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,set,stop,svg,switch,text,title,tspan,use"), G = f("script,style"), H = b.extend({}, z, D, E, C, F), I = f("background,cite,href,longdesc,src,usemap,xlink:href"), J = f("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,id,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,target,title,type,valign,value,vspace,width"), K = f("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,attributeName,attributeType,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan"), L = b.extend({}, I, K, J), M = document.createElement("pre"), N = /^(\s*)([\s\S]*?)(\s*)$/, O = String.prototype.trim ? function(a) {
        return b.isString(a) ? a.trim() : a;
    } : function(a) {
        return b.isString(a) ? a.replace(/^\s\s*/, "").replace(/\s\s*$/, "") : a;
    };
    b.module("ngSanitize", []).provider("$sanitize", function() {
        this.$get = [ "$$sanitizeUri", function(a) {
            return function(b) {
                void 0 !== arguments[1] && (arguments[1].version = "taSanitize");
                var c = [];
                return g(b, l(c, function(b, c) {
                    return !/^unsafe/.test(a(b, c));
                })), c.join("");
            };
        } ];
    }), b.module("ngSanitize").filter("linky", [ "$sanitize", function(a) {
        var c = /((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"”’]/, d = /^mailto:/;
        return function(f, g) {
            function h(a) {
                a && n.push(e(a));
            }
            function i(a, c) {
                n.push("<a "), b.isDefined(g) && n.push('target="', g, '" '), n.push('href="', a.replace(/"/g, "&quot;"), '">'), 
                h(c), n.push("</a>");
            }
            if (!f) return f;
            for (var j, k, l, m = f, n = []; j = m.match(c); ) k = j[0], j[2] || j[4] || (k = (j[3] ? "http://" : "mailto:") + k), 
            l = j.index, h(m.substr(0, l)), i(k, j[0].replace(d, "")), m = m.substring(l + j[0].length);
            return h(m), a(n.join(""));
        };
    } ]);
}(window, window.angular), function(a, b) {
    "function" == typeof define && define.amd ? define("textAngular", [ "rangy", "rangy/lib/rangy-selectionsaverestore" ], function(c, d) {
        return a["textAngular.name"] = b(c);
    }) : "object" == typeof exports ? module.exports = b(require("rangy"), require("rangy/lib/rangy-selectionsaverestore")) : a.textAngular = b(rangy);
}(this, function(a) {
    var e = {};
    angular.module("textAngularSetup", []).constant("taRegisterTool", function(a, c) {
        if (!a || "" === a || e.hasOwnProperty(a)) throw "textAngular Error: A unique name is required for a Tool Definition";
        if (c.display && ("" === c.display || !function(a) {
            try {
                return 0 !== angular.element(a).length;
            } catch (a) {
                return !1;
            }
        }(c.display)) || !c.display && !c.buttontext && !c.iconclass) throw 'textAngular Error: Tool Definition for "' + a + '" does not have a valid display/iconclass/buttontext value';
        e[a] = c;
    }).value("taTools", e).value("taOptions", {
        forceTextAngularSanitize: !0,
        keyMappings: [],
        toolbar: [ [ "h1", "h2", "h3", "h4", "h5", "h6", "p", "pre", "quote" ], [ "bold", "italics", "underline", "strikeThrough", "ul", "ol", "redo", "undo", "clear" ], [ "justifyLeft", "justifyCenter", "justifyRight", "justifyFull", "indent", "outdent" ], [ "html", "insertImage", "insertLink", "insertVideo", "wordcount", "charcount" ] ],
        classes: {
            focussed: "focussed",
            toolbar: "btn-toolbar",
            toolbarGroup: "btn-group",
            toolbarButton: "btn btn-default",
            toolbarButtonActive: "active",
            disabled: "disabled",
            textEditor: "form-control",
            htmlEditor: "form-control"
        },
        defaultTagAttributes: {
            a: {
                target: ""
            }
        },
        setup: {
            textEditorSetup: function(a) {},
            htmlEditorSetup: function(a) {}
        },
        defaultFileDropHandler: function(a, b) {
            var c = new FileReader();
            return "image" === a.type.substring(0, 5) && (c.onload = function() {
                "" !== c.result && b("insertImage", c.result, !0);
            }, c.readAsDataURL(a), !0);
        }
    }).value("taSelectableElements", [ "a", "img" ]).value("taCustomRenderers", [ {
        selector: "img",
        customAttribute: "ta-insert-video",
        renderLogic: function(a) {
            var b = angular.element("<iframe></iframe>"), c = a.prop("attributes");
            angular.forEach(c, function(a) {
                b.attr(a.name, a.value);
            }), b.attr("src", b.attr("ta-insert-video")), a.replaceWith(b);
        }
    } ]).value("taTranslations", {
        html: {
            tooltip: "Toggle html / Rich Text"
        },
        heading: {
            tooltip: "Heading "
        },
        p: {
            tooltip: "Paragraph"
        },
        pre: {
            tooltip: "Preformatted text"
        },
        ul: {
            tooltip: "Unordered List"
        },
        ol: {
            tooltip: "Ordered List"
        },
        quote: {
            tooltip: "Quote/unquote selection or paragraph"
        },
        undo: {
            tooltip: "Undo"
        },
        redo: {
            tooltip: "Redo"
        },
        bold: {
            tooltip: "Bold"
        },
        italic: {
            tooltip: "Italic"
        },
        underline: {
            tooltip: "Underline"
        },
        strikeThrough: {
            tooltip: "Strikethrough"
        },
        justifyLeft: {
            tooltip: "Align text left"
        },
        justifyRight: {
            tooltip: "Align text right"
        },
        justifyFull: {
            tooltip: "Justify text"
        },
        justifyCenter: {
            tooltip: "Center"
        },
        indent: {
            tooltip: "Increase indent"
        },
        outdent: {
            tooltip: "Decrease indent"
        },
        clear: {
            tooltip: "Clear formatting"
        },
        insertImage: {
            dialogPrompt: "Please enter an image URL to insert",
            tooltip: "Insert image",
            hotkey: "the - possibly language dependent hotkey ... for some future implementation"
        },
        insertVideo: {
            tooltip: "Insert video",
            dialogPrompt: "Please enter a youtube URL to embed"
        },
        insertLink: {
            tooltip: "Insert / edit link",
            dialogPrompt: "Please enter a URL to insert"
        },
        editLink: {
            reLinkButton: {
                tooltip: "Relink"
            },
            unLinkButton: {
                tooltip: "Unlink"
            },
            targetToggle: {
                buttontext: "Open in New Window"
            }
        },
        wordcount: {
            tooltip: "Display words Count"
        },
        charcount: {
            tooltip: "Display characters Count"
        }
    }).factory("taToolFunctions", [ "$window", "taTranslations", function(a, b) {
        return {
            imgOnSelectAction: function(a, b, c) {
                var d = function() {
                    c.updateTaBindtaTextElement(), c.hidePopover();
                };
                a.preventDefault(), c.displayElements.popover.css("width", "375px");
                var e = c.displayElements.popoverContainer;
                e.empty();
                var f = angular.element('<div class="btn-group" style="padding-right: 6px;">'), g = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1">100% </button>');
                g.on("click", function(a) {
                    a.preventDefault(), b.css({
                        width: "100%",
                        height: ""
                    }), d();
                });
                var h = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1">50% </button>');
                h.on("click", function(a) {
                    a.preventDefault(), b.css({
                        width: "50%",
                        height: ""
                    }), d();
                });
                var i = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1">25% </button>');
                i.on("click", function(a) {
                    a.preventDefault(), b.css({
                        width: "25%",
                        height: ""
                    }), d();
                });
                var j = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1">Reset</button>');
                j.on("click", function(a) {
                    a.preventDefault(), b.css({
                        width: "",
                        height: ""
                    }), d();
                }), f.append(g), f.append(h), f.append(i), f.append(j), e.append(f), f = angular.element('<div class="btn-group" style="padding-right: 6px;">');
                var k = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1"><i class="fa fa-align-left"></i></button>');
                k.on("click", function(a) {
                    a.preventDefault(), b.css("float", "left"), b.css("cssFloat", "left"), b.css("styleFloat", "left"), 
                    d();
                });
                var l = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1"><i class="fa fa-align-right"></i></button>');
                l.on("click", function(a) {
                    a.preventDefault(), b.css("float", "right"), b.css("cssFloat", "right"), b.css("styleFloat", "right"), 
                    d();
                });
                var m = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1"><i class="fa fa-align-justify"></i></button>');
                m.on("click", function(a) {
                    a.preventDefault(), b.css("float", ""), b.css("cssFloat", ""), b.css("styleFloat", ""), 
                    d();
                }), f.append(k), f.append(m), f.append(l), e.append(f), f = angular.element('<div class="btn-group">');
                var n = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" unselectable="on" tabindex="-1"><i class="fa fa-trash-o"></i></button>');
                n.on("click", function(a) {
                    a.preventDefault(), b.remove(), d();
                }), f.append(n), e.append(f), c.showPopover(b), c.showResizeOverlay(b);
            },
            aOnSelectAction: function(c, d, e) {
                c.preventDefault(), e.displayElements.popover.css("width", "436px");
                var f = e.displayElements.popoverContainer;
                f.empty(), f.css("line-height", "28px");
                var g = angular.element('<a href="' + d.attr("href") + '" target="_blank">' + d.attr("href") + "</a>");
                g.css({
                    display: "inline-block",
                    "max-width": "200px",
                    overflow: "hidden",
                    "text-overflow": "ellipsis",
                    "white-space": "nowrap",
                    "vertical-align": "middle"
                }), f.append(g);
                var h = angular.element('<div class="btn-group pull-right">'), i = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" tabindex="-1" unselectable="on" title="' + b.editLink.reLinkButton.tooltip + '"><i class="fa fa-edit icon-edit"></i></button>');
                i.on("click", function(c) {
                    c.preventDefault();
                    var f = a.prompt(b.insertLink.dialogPrompt, d.attr("href"));
                    f && "" !== f && "http://" !== f && (d.attr("href", f), e.updateTaBindtaTextElement()), 
                    e.hidePopover();
                }), h.append(i);
                var j = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" tabindex="-1" unselectable="on" title="' + b.editLink.unLinkButton.tooltip + '"><i class="fa fa-unlink icon-unlink"></i></button>');
                j.on("click", function(a) {
                    a.preventDefault(), d.replaceWith(d.contents()), e.updateTaBindtaTextElement(), 
                    e.hidePopover();
                }), h.append(j);
                var k = angular.element('<button type="button" class="btn btn-default btn-sm btn-small" tabindex="-1" unselectable="on">' + b.editLink.targetToggle.buttontext + "</button>");
                "_blank" === d.attr("target") && k.addClass("active"), k.on("click", function(a) {
                    a.preventDefault(), d.attr("target", "_blank" === d.attr("target") ? "" : "_blank"), 
                    k.toggleClass("active"), e.updateTaBindtaTextElement();
                }), h.append(k), f.append(h), e.showPopover(d);
            },
            extractYoutubeVideoId: function(a) {
                var c = a.match(/(?:youtube(?:-nocookie)?\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|\S*?[?&]v=)|youtu\.be\/)([a-zA-Z0-9_-]{11})/i);
                return c && c[1] || null;
            }
        };
    } ]).run([ "taRegisterTool", "$window", "taTranslations", "taSelection", "taToolFunctions", "$sanitize", "taOptions", "$log", function(a, b, c, d, e, f, g, h) {
        var i = {};
        if (f("", i), !0 === g.forceTextAngularSanitize && "taSanitize" !== i.version) throw angular.$$minErr("textAngular")("textAngularSetup", "The textAngular-sanitize provider has been replaced by another -- have you included angular-sanitize by mistake?");
        a("html", {
            iconclass: "fa fa-code",
            tooltiptext: c.html.tooltip,
            action: function() {
                this.$editor().switchView();
            },
            activeState: function() {
                return this.$editor().showHtml;
            }
        });
        var k = function() {
            return this.$editor().wrapSelection("formatBlock", "<" + this.name.toUpperCase() + ">");
        };
        angular.forEach([ "h1", "h2", "h3", "h4", "h5", "h6" ], function(b) {
            a(b.toLowerCase(), {
                buttontext: b.toUpperCase(),
                tooltiptext: c.heading.tooltip + b.charAt(1),
                action: k,
                activeState: function(a) {
                    return function() {
                        return this.$editor().queryFormatBlockState(a);
                    };
                }(b.toLowerCase())
            });
        }), a("p", {
            buttontext: "P",
            tooltiptext: c.p.tooltip,
            action: function() {
                return this.$editor().wrapSelection("formatBlock", "<P>");
            },
            activeState: function() {
                return this.$editor().queryFormatBlockState("p");
            }
        }), a("pre", {
            buttontext: "pre",
            tooltiptext: c.pre.tooltip,
            action: function() {
                return this.$editor().wrapSelection("formatBlock", "<PRE>");
            },
            activeState: function() {
                return this.$editor().queryFormatBlockState("pre");
            }
        }), a("ul", {
            iconclass: "fa fa-list-ul",
            tooltiptext: c.ul.tooltip,
            action: function() {
                return this.$editor().wrapSelection("insertUnorderedList", null);
            },
            activeState: function() {
                return this.$editor().queryCommandState("insertUnorderedList");
            }
        }), a("ol", {
            iconclass: "fa fa-list-ol",
            tooltiptext: c.ol.tooltip,
            action: function() {
                return this.$editor().wrapSelection("insertOrderedList", null);
            },
            activeState: function() {
                return this.$editor().queryCommandState("insertOrderedList");
            }
        }), a("quote", {
            iconclass: "fa fa-quote-right",
            tooltiptext: c.quote.tooltip,
            action: function() {
                return this.$editor().wrapSelection("formatBlock", "<BLOCKQUOTE>");
            },
            activeState: function() {
                return this.$editor().queryFormatBlockState("blockquote");
            }
        }), a("undo", {
            iconclass: "fa fa-undo",
            tooltiptext: c.undo.tooltip,
            action: function() {
                return this.$editor().wrapSelection("undo", null);
            }
        }), a("redo", {
            iconclass: "fa fa-repeat",
            tooltiptext: c.redo.tooltip,
            action: function() {
                return this.$editor().wrapSelection("redo", null);
            }
        }), a("bold", {
            iconclass: "fa fa-bold",
            tooltiptext: c.bold.tooltip,
            action: function() {
                return this.$editor().wrapSelection("bold", null);
            },
            activeState: function() {
                return this.$editor().queryCommandState("bold");
            },
            commandKeyCode: 98
        }), a("justifyLeft", {
            iconclass: "fa fa-align-left",
            tooltiptext: c.justifyLeft.tooltip,
            action: function() {
                return this.$editor().wrapSelection("justifyLeft", null);
            },
            activeState: function(a) {
                if (a && "#document" === a.nodeName) return !1;
                var b = !1;
                if (a) try {
                    b = "left" === a.css("text-align") || "left" === a.attr("align") || "right" !== a.css("text-align") && "center" !== a.css("text-align") && "justify" !== a.css("text-align") && !this.$editor().queryCommandState("justifyRight") && !this.$editor().queryCommandState("justifyCenter") && !this.$editor().queryCommandState("justifyFull");
                } catch (a) {
                    b = !1;
                }
                return b || this.$editor().queryCommandState("justifyLeft");
            }
        }), a("justifyRight", {
            iconclass: "fa fa-align-right",
            tooltiptext: c.justifyRight.tooltip,
            action: function() {
                return this.$editor().wrapSelection("justifyRight", null);
            },
            activeState: function(a) {
                if (a && "#document" === a.nodeName) return !1;
                var b = !1;
                if (a) try {
                    b = "right" === a.css("text-align");
                } catch (a) {
                    b = !1;
                }
                return b || this.$editor().queryCommandState("justifyRight");
            }
        }), a("justifyFull", {
            iconclass: "fa fa-align-justify",
            tooltiptext: c.justifyFull.tooltip,
            action: function() {
                return this.$editor().wrapSelection("justifyFull", null);
            },
            activeState: function(a) {
                var b = !1;
                if (a) try {
                    b = "justify" === a.css("text-align");
                } catch (a) {
                    b = !1;
                }
                return b || this.$editor().queryCommandState("justifyFull");
            }
        }), a("justifyCenter", {
            iconclass: "fa fa-align-center",
            tooltiptext: c.justifyCenter.tooltip,
            action: function() {
                return this.$editor().wrapSelection("justifyCenter", null);
            },
            activeState: function(a) {
                if (a && "#document" === a.nodeName) return !1;
                var b = !1;
                if (a) try {
                    b = "center" === a.css("text-align");
                } catch (a) {
                    b = !1;
                }
                return b || this.$editor().queryCommandState("justifyCenter");
            }
        }), a("indent", {
            iconclass: "fa fa-indent",
            tooltiptext: c.indent.tooltip,
            action: function() {
                return this.$editor().wrapSelection("indent", null);
            },
            activeState: function() {
                return this.$editor().queryFormatBlockState("blockquote");
            },
            commandKeyCode: "TabKey"
        }), a("outdent", {
            iconclass: "fa fa-outdent",
            tooltiptext: c.outdent.tooltip,
            action: function() {
                return this.$editor().wrapSelection("outdent", null);
            },
            activeState: function() {
                return !1;
            },
            commandKeyCode: "ShiftTabKey"
        }), a("italics", {
            iconclass: "fa fa-italic",
            tooltiptext: c.italic.tooltip,
            action: function() {
                return this.$editor().wrapSelection("italic", null);
            },
            activeState: function() {
                return this.$editor().queryCommandState("italic");
            },
            commandKeyCode: 105
        }), a("underline", {
            iconclass: "fa fa-underline",
            tooltiptext: c.underline.tooltip,
            action: function() {
                return this.$editor().wrapSelection("underline", null);
            },
            activeState: function() {
                return this.$editor().queryCommandState("underline");
            },
            commandKeyCode: 117
        }), a("strikeThrough", {
            iconclass: "fa fa-strikethrough",
            tooltiptext: c.strikeThrough.tooltip,
            action: function() {
                return this.$editor().wrapSelection("strikeThrough", null);
            },
            activeState: function() {
                return document.queryCommandState("strikeThrough");
            }
        }), a("clear", {
            iconclass: "fa fa-ban",
            tooltiptext: c.clear.tooltip,
            action: function(a, b) {
                var c;
                this.$editor().wrapSelection("removeFormat", null);
                var e = angular.element(d.getSelectionElement());
                c = d.getAllSelectedElements();
                var f = function(a, b) {
                    a = angular.element(a);
                    var c = b;
                    return b || (c = a), angular.forEach(a.children(), function(a) {
                        if ("ul" === a.tagName.toLowerCase() || "ol" === a.tagName.toLowerCase()) c = f(a, c); else {
                            var b = angular.element("<p></p>");
                            b.html(angular.element(a).html()), c.after(b), c = b;
                        }
                    }), a.remove(), c;
                };
                angular.forEach(c, function(a) {
                    "ul" !== a.nodeName.toLowerCase() && "ol" !== a.nodeName.toLowerCase() || f(a);
                }), angular.forEach(e.find("ul"), f), angular.forEach(e.find("ol"), f);
                var g = this.$editor(), h = function(a) {
                    (a = angular.element(a))[0] !== g.displayElements.text[0] && a.removeAttr("class"), 
                    angular.forEach(a.children(), h);
                };
                angular.forEach(e, h), e[0] && "li" !== e[0].tagName.toLowerCase() && "ol" !== e[0].tagName.toLowerCase() && "ul" !== e[0].tagName.toLowerCase() && "true" !== e[0].getAttribute("contenteditable") && this.$editor().wrapSelection("formatBlock", "default"), 
                b();
            }
        });
        var l = function(a) {
            return -1 !== a.toLowerCase().indexOf("javascript");
        };
        a("insertImage", {
            iconclass: "fa fa-picture-o",
            tooltiptext: c.insertImage.tooltip,
            action: function() {
                var a;
                if ((a = b.prompt(c.insertImage.dialogPrompt, "http://")) && "" !== a && "http://" !== a && !l(a)) {
                    d.getSelectionElement().tagName && "a" === d.getSelectionElement().tagName.toLowerCase() && d.setSelectionAfterElement(d.getSelectionElement());
                    var e = '<img src="' + a + '">';
                    return this.$editor().wrapSelection("insertHTML", e, !0);
                }
            },
            onElementSelect: {
                element: "img",
                action: e.imgOnSelectAction
            }
        }), a("insertVideo", {
            iconclass: "fa fa-youtube-play",
            tooltiptext: c.insertVideo.tooltip,
            action: function() {
                var a;
                if (a = b.prompt(c.insertVideo.dialogPrompt, "https://"), !l(a) && a && "" !== a && "https://" !== a && (videoId = e.extractYoutubeVideoId(a), 
                videoId)) {
                    var f = "https://www.youtube.com/embed/" + videoId, g = '<img class="ta-insert-video" src="https://img.youtube.com/vi/' + videoId + '/hqdefault.jpg" ta-insert-video="' + f + '" contenteditable="false" allowfullscreen="true" frameborder="0" />';
                    return d.getSelectionElement().tagName && "a" === d.getSelectionElement().tagName.toLowerCase() && d.setSelectionAfterElement(d.getSelectionElement()), 
                    this.$editor().wrapSelection("insertHTML", g, !0);
                }
            },
            onElementSelect: {
                element: "img",
                onlyWithAttrs: [ "ta-insert-video" ],
                action: e.imgOnSelectAction
            }
        }), a("insertLink", {
            tooltiptext: c.insertLink.tooltip,
            iconclass: "fa fa-link",
            action: function() {
                var a;
                if ((a = d.getSelectionElement().tagName && "a" === d.getSelectionElement().tagName.toLowerCase() ? b.prompt(c.insertLink.dialogPrompt, d.getSelectionElement().href) : b.prompt(c.insertLink.dialogPrompt, "http://")) && "" !== a && "http://" !== a && !l(a)) return this.$editor().wrapSelection("createLink", a, !0);
            },
            activeState: function(a) {
                return !!a && "A" === a[0].tagName;
            },
            onElementSelect: {
                element: "a",
                action: e.aOnSelectAction
            }
        }), a("wordcount", {
            display: '<div id="toolbarWC" style="display:block; min-width:100px;">Words: <span ng-bind="wordcount"></span></div>',
            disabled: !0,
            wordcount: 0,
            activeState: function() {
                var b = this.$editor().displayElements.text[0].innerHTML || "", c = 0;
                return "" !== b.replace(/\s*<[^>]*?>\s*/g, "") && "" !== b.trim() && (c = b.replace(/<\/?(b|i|em|strong|span|u|strikethrough|a|img|small|sub|sup|label)( [^>*?])?>/gi, "").replace(/(<[^>]*?>\s*<[^>]*?>)/gi, " ").replace(/(<[^>]*?>)/gi, "").replace(/\s+/gi, " ").match(/\S+/g).length), 
                this.wordcount = c, this.$editor().wordcount = c, !1;
            }
        }), a("charcount", {
            display: '<div id="toolbarCC" style="display:block; min-width:120px;">Characters: <span ng-bind="charcount"></span></div>',
            disabled: !0,
            charcount: 0,
            activeState: function() {
                var a = this.$editor().displayElements.text, c = (a[0].innerText || a[0].textContent).replace(/(\r\n|\n|\r)/gm, "").replace(/^\s+/g, " ").replace(/\s+$/g, " ").length;
                return this.charcount = c, this.$editor().charcount = c, !1;
            }
        });
    } ]);
    var g_ie = function() {
        for (var b = 3, c = document.createElement("div"), d = c.getElementsByTagName("i"); c.innerHTML = "\x3c!--[if gt IE " + ++b + "]><i></i><![endif]--\x3e", 
        d[0]; ) ;
        return 4 < b ? b : void 0;
    }(), g_webkit = /AppleWebKit\/([\d.]+)/i.test(navigator.userAgent), h = (navigator.userAgent.toLowerCase().indexOf("firefox"), 
    h || {});
    h.now = h.now || h.mozNow || h.msNow || h.oNow || h.webkitNow || function() {
        return new Date().getTime();
    };
    var l, m, n, o, p, q, i = /^(address|article|aside|audio|blockquote|canvas|center|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video)$/i, j = /^(ul|li|ol)$/i, k = /^(#text|span|address|article|aside|audio|blockquote|canvas|center|dd|div|dl|fieldset|figcaption|figure|footer|form|h1|h2|h3|h4|h5|h6|header|hgroup|hr|noscript|ol|output|p|pre|section|table|tfoot|ul|video|li)$/i;
    if (String.prototype.trim || (String.prototype.trim = function() {
        return this.replace(/^\s+|\s+$/g, "");
    }), 8 < g_ie || void 0 === g_ie) {
        for (var r = document.styleSheets, s = 0; s < r.length; s++) if ((0 === r[s].media.length || r[s].media.mediaText.match(/(all|screen)/gi)) && r[s].href && r[s].href.match(/textangular\.(min\.|)css/gi)) {
            l = r[s];
            break;
        }
        l || (l = function() {
            var a = document.createElement("style");
            return g_webkit && a.appendChild(document.createTextNode("")), document.getElementsByTagName("head")[0].appendChild(a), 
            a.sheet;
        }()), m = function(a, b) {
            return o(l, a, b);
        }, o = function(a, b, c) {
            var d, e;
            return a.cssRules ? d = Math.max(a.cssRules.length - 1, 0) : a.rules && (d = Math.max(a.rules.length - 1, 0)), 
            a.insertRule ? a.insertRule(b + "{" + c + "}", d) : a.addRule(b, c, d), l.rules ? e = l.rules[d] : l.cssRules && (e = l.cssRules[d]), 
            e;
        }, q = function(a, b) {
            var c, d;
            for (c = 0; c < b.length; c++) if (b[c].cssText === a.cssText) {
                d = c;
                break;
            }
            return d;
        }, n = function(a) {
            p(l, a);
        }, p = function(a, b) {
            var c = a.cssRules || a.rules;
            if (c && 0 !== c.length) {
                var d = q(b, c);
                a.removeRule ? a.removeRule(d) : a.deleteRule(d);
            }
        };
    }
    angular.module("textAngular.factories", []).factory("taBrowserTag", [ function() {
        return function(a) {
            return a ? "" === a ? void 0 === g_ie ? "div" : g_ie <= 8 ? "P" : "p" : g_ie <= 8 ? a.toUpperCase() : a : g_ie <= 8 ? "P" : "p";
        };
    } ]).factory("taApplyCustomRenderers", [ "taCustomRenderers", "taDOM", function(a, b) {
        return function(c) {
            var d = angular.element("<div></div>");
            return d[0].innerHTML = c, angular.forEach(a, function(a) {
                var c = [];
                a.selector && "" !== a.selector ? c = d.find(a.selector) : a.customAttribute && "" !== a.customAttribute && (c = b.getByAttribute(d, a.customAttribute)), 
                angular.forEach(c, function(b) {
                    b = angular.element(b), a.selector && "" !== a.selector && a.customAttribute && "" !== a.customAttribute ? void 0 !== b.attr(a.customAttribute) && a.renderLogic(b) : a.renderLogic(b);
                });
            }), d[0].innerHTML;
        };
    } ]).factory("taFixChrome", function() {
        return function(a, b) {
            if (!a || !angular.isString(a) || a.length <= 0) return a;
            for (var c, d, e, f = /style\s?=\s?(["'])(?:(?=(\\?))\2.)*?\1/gi, g = /<span class="Apple-converted-space">([^<]+)<\/span>/gi, h = "", i = 0; c = g.exec(a); ) e = (e = c[1]).replace(/&nbsp;/gi, " "), 
            h += a.substring(i, c.index) + e, i = c.index + c[0].length;
            if (i && (a = h += a.substring(i), h = "", i = 0), !b) {
                for (;c = f.exec(a); ) h += a.substring(i, c.index - 1), d = c[0], (c = /font-family: inherit;|line-height: 1.[0-9]{3,12};|color: inherit; line-height: 1.1;|color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);|background-color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);/gi.exec(d)) ? 8 < (d = d.replace(/( |)font-family: inherit;|( |)line-height: 1.[0-9]{3,12};|( |)color: inherit;|( |)color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);|( |)background-color: rgb\(\d{1,3}, \d{1,3}, \d{1,3}\);/gi, "")).length && (h += " " + d) : h += " " + d, 
                i = f.lastIndex;
                h += a.substring(i);
            }
            return 0 < i ? h.replace(/<span\s?>(.*?)<\/span>(<br(\/|)>|)/gi, "$1") : a;
        };
    }).factory("taSanitize", [ "$sanitize", function(a) {
        function b(a, b) {
            for (var c, d = 0, e = 0, f = /<[^>]*>/gi; c = f.exec(a); ) if (e = c.index, "/" === c[0].substr(1, 1)) {
                if (0 === d) break;
                d--;
            } else d++;
            return b + a.substring(0, e) + angular.element(b)[0].outerHTML.substring(b.length) + a.substring(e);
        }
        function c(a) {
            if (!a || !angular.isString(a) || a.length <= 0) return a;
            for (var d, f, g, h, i, k, l = /<([^>\/]+?)style=("([^"]+)"|'([^']+)')([^>]*)>/gi, m = "", n = "", o = 0; f = l.exec(a); ) {
                h = f[3] || f[4];
                var p = new RegExp(j, "i");
                if (angular.isString(h) && p.test(h)) {
                    i = "";
                    for (var q = new RegExp(j, "ig"); g = q.exec(h); ) for (d = 0; d < e.length; d++) g[2 * d + 2] && (i += "<" + e[d].tag + ">");
                    k = c(a.substring(o, f.index)), n += 0 < m.length ? b(k, m) : k, h = h.replace(new RegExp(j, "ig"), ""), 
                    n += "<" + f[1].trim(), 0 < h.length && (n += ' style="' + h + '"'), n += f[5] + ">", 
                    o = f.index + f[0].length, m = i;
                }
            }
            return n + (0 < m.length ? b(a.substring(o), m) : a.substring(o));
        }
        for (var e = [ {
            property: "font-weight",
            values: [ "bold" ],
            tag: "b"
        }, {
            property: "font-style",
            values: [ "italic" ],
            tag: "i"
        } ], f = [], g = 0; g < e.length; g++) {
            for (var h = "(" + e[g].property + ":\\s*(", i = 0; i < e[g].values.length; i++) 0 < i && (h += "|"), 
            h += e[g].values[i];
            h += ");)", f.push(h);
        }
        var j = "(" + f.join("|") + ")", k = new RegExp(/<span id="selectionBoundary_\d+_\d+" class="rangySelectionBoundary">[^<>]+?<\/span>/gi), l = new RegExp(/<span class="rangySelectionBoundary" id="selectionBoundary_\d+_\d+">[^<>]+?<\/span>/gi), m = new RegExp(/<span id="selectionBoundary_\d+_\d+" class="rangySelectionBoundary">[^<>]+?<\/span>/gi);
        return function(b, e, f) {
            if (!f) try {
                b = c(b);
            } catch (a) {}
            if (b = function(a) {
                if (!a || !angular.isString(a) || a.length <= 0) return a;
                for (var b, c = /<([^>\/]+?)align=("([^"]+)"|'([^']+)')([^>]*)>/gi, d = "", e = 0; b = c.exec(a); ) {
                    d += a.substring(e, b.index), e = b.index + b[0].length;
                    var f = "<" + b[1] + b[5];
                    /style=("([^"]+)"|'([^']+)')/gi.test(f) ? f = f.replace(/style=("([^"]+)"|'([^']+)')/i, 'style="$2$3 text-align:' + (b[3] || b[4]) + ';"') : f += ' style="text-align:' + (b[3] || b[4]) + ';"', 
                    d += f += ">";
                }
                return d + a.substring(e);
            }(b)) try {
                b = (b = (b = (b = b.replace(k, "")).replace(l, "")).replace(k, "")).replace(m, "");
            } catch (a) {}
            var g;
            try {
                g = a(b), f && (g = b);
            } catch (a) {
                g = e || "";
            }
            var h, i = g.match(/(<pre[^>]*>.*?<\/pre[^>]*>)/gi), j = g.replace(/(&#(9|10);)*/gi, ""), n = /<pre[^>]*>.*?<\/pre[^>]*>/gi, o = 0, p = 0;
            for (g = ""; null !== (h = n.exec(j)) && o < i.length; ) g += j.substring(p, h.index) + i[o], 
            p = h.index + h[0].length, o++;
            return g + j.substring(p);
        };
    } ]).factory("taToolExecuteAction", [ "$q", "$log", function(a, b) {
        return function(c) {
            void 0 !== c && (this.$editor = function() {
                return c;
            });
            var d, e = a.defer(), f = e.promise, g = this.$editor();
            try {
                d = this.action(e, g.startAction()), f.finally(function() {
                    g.endAction.call(g);
                });
            } catch (a) {
                b.error(a);
            }
            (d || void 0 === d) && e.resolve();
        };
    } ]), angular.module("textAngular.DOM", [ "textAngular.factories" ]).factory("taExecCommand", [ "taSelection", "taBrowserTag", "$document", function(b, c, d) {
        var e = function(a, c) {
            var d, e, f = a.find("li");
            for (e = f.length - 1; 0 <= e; e--) d = angular.element("<" + c + ">" + f[e].innerHTML + "</" + c + ">"), 
            a.after(d);
            a.remove(), b.setSelectionToElementEnd(d[0]);
        }, f = function(a, d, e, f, g) {
            var h, i, j, k, l, m = a.find("li");
            for (i = 0; i < m.length; i++) if (m[i].outerHTML === d[0].outerHTML) {
                0 < (l = i) && (j = m[i - 1]), i + 1 < m.length && (k = m[i + 1]);
                break;
            }
            var n = "";
            if (f ? n += "<" + g + ">" + d[0].innerHTML + "</" + g + ">" : (n += "<" + c(e) + ">", 
            n += "<li>" + d[0].innerHTML + "</li>", n += "</" + c(e) + ">"), h = angular.element(n), 
            !j) return d.remove(), a.after(angular.element(a[0].outerHTML)), a.after(h), a.remove(), 
            void b.setSelectionToElementEnd(h[0]);
            if (k) {
                var o = (a.parent(), ""), p = a[0].nodeName.toLowerCase();
                for (o += "<" + p + ">", i = 0; i < l; i++) o += "<li>" + m[i].innerHTML + "</li>";
                o += "</" + p + ">";
                var q = "";
                for (q += "<" + p + ">", i = l + 1; i < m.length; i++) q += "<li>" + m[i].innerHTML + "</li>";
                q += "</" + p + ">", a.after(angular.element(q)), a.after(h), a.after(angular.element(o)), 
                a.remove(), b.setSelectionToElementEnd(h[0]);
            } else d.remove(), a.after(h), b.setSelectionToElementEnd(h[0]);
        }, h = function(a) {
            /(<br(|\/)>)$/i.test(a.innerHTML.trim()) ? b.setSelectionBeforeElement(angular.element(a).find("br")[0]) : b.setSelectionToElementEnd(a);
        }, k = function(a, b) {
            var c = angular.element("<" + b + ">" + a[0].innerHTML + "</" + b + ">");
            a.after(c), a.remove(), h(c.find("li")[0]);
        }, l = function(a, b, d) {
            for (var e = "", f = 0; f < a.length; f++) e += "<" + c("li") + ">" + a[f].innerHTML + "</" + c("li") + ">";
            var g = angular.element("<" + d + ">" + e + "</" + d + ">");
            b.after(g), b.remove(), h(g.find("li")[0]);
        }, m = function(a, b) {
            for (var c = 0; c < a.childNodes.length; c++) {
                var d = a.childNodes[c];
                d.tagName && d.tagName.match(i) && m(d, b);
            }
            if (null === a.parentNode) return a;
            if ("<br>" === b) return a;
            var e = angular.element(b);
            return e[0].innerHTML = a.innerHTML, a.parentNode.insertBefore(e[0], a), a.parentNode.removeChild(a), 
            e;
        };
        return function(h, n) {
            return h = c(h), function(o, p, q, r) {
                var s, t, u, v, w, x, y, z, A = angular.element("<" + h + ">");
                try {
                    var B, C;
                    b.getSelection && (z = b.getSelection()), void 0 !== (y = b.getSelectionElement()).tagName && ("div" === y.tagName.toLowerCase() && /taTextElement.+/.test(y.id) && z && z.start && 1 === z.start.offset && 1 === z.end.offset ? (B = y.innerHTML, 
                    /<br>/i.test(B) && (B = B.replace(/<br>/i, "&#8203;")), /<br\/>/i.test(B) && (B = B.replace(/<br\/>/i, "&#8203;")), 
                    /<span>(<span>)+/i.test(B) && (B = __.replace(/<span>(<span>)+/i, "<span>")), /<\/span>(<\/span>)+/i.test(B) && (B = __.replace(/<\/span>(<\/span>)+/i, "</span>")), 
                    /<span><\/span>/i.test(B) && (B = B.replace(/<span><\/span>/i, "")), C = "<div>" + B + "</div>", 
                    y.innerHTML = C, b.setSelectionToElementEnd(y.childNodes[0]), y = b.getSelectionElement()) : "span" === y.tagName.toLowerCase() && z && z.start && 1 === z.start.offset && 1 === z.end.offset ? (B = y.innerHTML, 
                    /<br>/i.test(B) && (B = B.replace(/<br>/i, "&#8203;")), /<br\/>/i.test(B) && (B = B.replace(/<br\/>/i, "&#8203;")), 
                    /<span>(<span>)+/i.test(B) && (B = __.replace(/<span>(<span>)+/i, "<span>")), /<\/span>(<\/span>)+/i.test(B) && (B = __.replace(/<\/span>(<\/span>)+/i, "</span>")), 
                    /<span><\/span>/i.test(B) && (B = B.replace(/<span><\/span>/i, "")), C = "<div>" + B + "</div>", 
                    y.innerHTML = C, b.setSelectionToElementEnd(y.childNodes[0]), y = b.getSelectionElement()) : "p" === y.tagName.toLowerCase() && z && z.start && 1 === z.start.offset && 1 === z.end.offset ? (B = y.innerHTML, 
                    /<br>/i.test(B) && (B = B.replace(/<br>/i, "&#8203;"), y.innerHTML = B)) : "li" === y.tagName.toLowerCase() && z && z.start && z.start.offset === z.end.offset && (B = y.innerHTML, 
                    /<br>/i.test(B) && (B = B.replace(/<br>/i, ""), y.innerHTML = B)));
                } catch (a) {}
                if (y) {
                    var D = angular.element(y), E = y && y.tagName && y.tagName.toLowerCase() || "";
                    if ("insertorderedlist" === o.toLowerCase() || "insertunorderedlist" === o.toLowerCase()) {
                        var F = c("insertorderedlist" === o.toLowerCase() ? "ol" : "ul"), G = b.getOnlySelectedElements();
                        if (1 < G.length && ("ol" === E || "ul" === E)) return function(a, d, e, f, g) {
                            var h, i, j, k, l, m = a.find("li"), n = [];
                            for (i = 0; i < m.length; i++) for (j = 0; j < d.length; j++) m[i].isEqualNode(d[j]) && (n[j] = i);
                            0 < n[0] && (k = m[n[0] - 1]), n[d.length - 1] + 1 < m.length && (l = m[n[d.length - 1] + 1]);
                            var o = "";
                            if (f) for (j = 0; j < d.length; j++) o += "<" + g + ">" + d[j].innerHTML + "</" + g + ">", 
                            d[j].remove(); else {
                                for (o += "<" + c(e) + ">", j = 0; j < d.length; j++) o += d[j].outerHTML, d[j].remove();
                                o += "</" + c(e) + ">";
                            }
                            if (h = angular.element(o), !k) return a.after(angular.element(a[0].outerHTML)), 
                            a.after(h), a.remove(), void b.setSelectionToElementEnd(h[0]);
                            if (!l) return a.after(h), void b.setSelectionToElementEnd(h[0]);
                            var p = "", q = a[0].nodeName.toLowerCase();
                            for (p += "<" + q + ">", i = 0; i < n[0]; i++) p += "<li>" + m[i].innerHTML + "</li>";
                            p += "</" + q + ">";
                            var r = "";
                            for (r += "<" + q + ">", i = n[d.length - 1] + 1; i < m.length; i++) r += "<li>" + m[i].innerHTML + "</li>";
                            r += "</" + q + ">", a.after(angular.element(r)), a.after(h), a.after(angular.element(p)), 
                            a.remove(), b.setSelectionToElementEnd(h[0]);
                        }(D, G, F, F === E, h);
                        if (E === F) return D[0].childNodes.length !== G.length && 1 === G.length ? (D = angular.element(G[0]), 
                        f(D.parent(), D, F, !0, h)) : e(D, h);
                        if ("li" === E && D.parent()[0].tagName.toLowerCase() === F && 1 === D.parent().children().length) return e(D.parent(), h);
                        if ("li" === E && D.parent()[0].tagName.toLowerCase() !== F && 1 === D.parent().children().length) return k(D.parent(), F);
                        if (E.match(i) && !D.hasClass("ta-bind")) {
                            if (G.length && D[0].childNodes.length !== G.length && 1 === G.length) return D = angular.element(G[0]), 
                            f(D.parent(), D, F, F === E, h);
                            if ("ol" === E || "ul" === E) return k(D, F);
                            var H = !1;
                            return angular.forEach(D.children(), function(a) {
                                a.tagName.match(i) && (H = !0);
                            }), l(H ? D.children() : [ angular.element("<div>" + y.innerHTML + "</div>")[0] ], D, F);
                        }
                        if (E.match(i)) {
                            if (0 === (v = b.getOnlySelectedElements()).length) t = angular.element("<" + F + "><li>" + y.innerHTML + "</li></" + F + ">"), 
                            D.html(""), D.append(t); else {
                                if (1 === v.length && ("ol" === v[0].tagName.toLowerCase() || "ul" === v[0].tagName.toLowerCase())) return v[0].tagName.toLowerCase() === F ? e(angular.element(v[0]), h) : k(angular.element(v[0]), F);
                                u = "";
                                var I = [];
                                for (s = 0; s < v.length; s++) if (3 !== v[s].nodeType) {
                                    var J = angular.element(v[s]);
                                    if ("li" === v[s].tagName.toLowerCase()) continue;
                                    u += "ol" === v[s].tagName.toLowerCase() || "ul" === v[s].tagName.toLowerCase() ? J[0].innerHTML : "span" !== v[s].tagName.toLowerCase() || "ol" !== v[s].childNodes[0].tagName.toLowerCase() && "ul" !== v[s].childNodes[0].tagName.toLowerCase() ? "<" + c("li") + ">" + J[0].innerHTML + "</" + c("li") + ">" : J[0].childNodes[0].innerHTML, 
                                    I.unshift(J);
                                }
                                t = angular.element("<" + F + ">" + u + "</" + F + ">"), I.pop().replaceWith(t), 
                                angular.forEach(I, function(a) {
                                    a.remove();
                                });
                            }
                            return void b.setSelectionToElementEnd(t[0]);
                        }
                    } else {
                        if ("formatblock" === o.toLowerCase()) {
                            for ("default" === (x = q.toLowerCase().replace(/[<>]/gi, "")).trim() && (q = "<" + (x = h) + ">"), 
                            t = "li" === E ? D.parent() : D; !t[0].tagName || !t[0].tagName.match(i) && !t.parent().attr("contenteditable"); ) E = ((t = t.parent())[0].tagName || "").toLowerCase();
                            if (E === x) {
                                v = t.children();
                                var K = !1;
                                for (s = 0; s < v.length; s++) K = K || v[s].tagName.match(i);
                                K ? (t.after(v), w = t.next(), t.remove(), t = w) : (A.append(t[0].childNodes), 
                                t.after(A), t.remove(), t = A);
                            } else if (t.parent()[0].tagName.toLowerCase() !== x || t.parent().hasClass("ta-bind")) if (E.match(j)) t.wrap(q); else {
                                for (0 === (v = b.getOnlySelectedElements()).length && (v = [ t[0] ]), s = 0; s < v.length; s++) if (3 === v[s].nodeType || !v[s].tagName.match(i)) for (;3 === v[s].nodeType || !v[s].tagName || !v[s].tagName.match(i); ) v[s] = v[s].parentNode;
                                if (1 < (v = v.filter(function(a, b, c) {
                                    return c.indexOf(a) === b;
                                })).length && (v = v.filter(function(a, b, c) {
                                    return !("div" === a.nodeName.toLowerCase() && /^taTextElement/.test(a.id));
                                })), angular.element(v[0]).hasClass("ta-bind")) (t = angular.element(q))[0].innerHTML = v[0].innerHTML, 
                                v[0].innerHTML = t[0].outerHTML; else if ("blockquote" === x) {
                                    for (u = "", s = 0; s < v.length; s++) u += v[s].outerHTML;
                                    for ((t = angular.element(q))[0].innerHTML = u, v[0].parentNode.insertBefore(t[0], v[0]), 
                                    s = v.length - 1; 0 <= s; s--) v[s].parentNode && v[s].parentNode.removeChild(v[s]);
                                } else if ("pre" === x && b.getStateShiftKey()) {
                                    for (u = "", s = 0; s < v.length; s++) u += v[s].outerHTML;
                                    for ((t = angular.element(q))[0].innerHTML = u, v[0].parentNode.insertBefore(t[0], v[0]), 
                                    s = v.length - 1; 0 <= s; s--) v[s].parentNode && v[s].parentNode.removeChild(v[s]);
                                } else for (s = 0; s < v.length; s++) {
                                    var L = m(v[s], q);
                                    v[s] === t[0] && (t = angular.element(L));
                                }
                            } else {
                                var M = t.parent(), N = M.contents();
                                for (s = 0; s < N.length; s++) M.parent().hasClass("ta-bind") && 3 === N[s].nodeType && ((A = angular.element("<" + h + ">"))[0].innerHTML = N[s].outerHTML, 
                                N[s] = A[0]), M.parent()[0].insertBefore(N[s], M[0]);
                                M.remove();
                            }
                            return b.setSelectionToElementEnd(t[0]), void t[0].focus();
                        }
                        if ("createlink" === o.toLowerCase()) {
                            if ("a" === E) return void (b.getSelectionElement().href = q);
                            var O = '<a href="' + q + '" target="' + (r.a.target ? r.a.target : "") + '">', P = "</a>";
                            if (b.getSelection().collapsed) b.insertHtml(O + q + P, n); else if (a.getSelection().getRangeAt(0).canSurroundContents()) {
                                var R = angular.element(O + P)[0];
                                a.getSelection().getRangeAt(0).surroundContents(R);
                            }
                            return;
                        }
                        if ("inserthtml" === o.toLowerCase()) return void b.insertHtml(q, n);
                    }
                    try {
                        d[0].execCommand(o, p, q);
                    } catch (a) {}
                }
            };
        };
    } ]).service("taSelection", [ "$document", "taDOM", "$log", function(b, c, d) {
        var e, f = b[0], g = function(a, b) {
            return a.tagName && a.tagName.match(/^br$/i) && 0 === b && !a.previousSibling ? {
                element: a.parentNode,
                offset: 0
            } : {
                element: a,
                offset: b
            };
        }, h = {
            getSelection: function() {
                var b;
                try {
                    b = a.getSelection().getRangeAt(0);
                } catch (a) {
                    return;
                }
                var c = b.commonAncestorContainer, d = {
                    start: g(b.startContainer, b.startOffset),
                    end: g(b.endContainer, b.endOffset),
                    collapsed: b.collapsed
                };
                return 3 === c.nodeType && ("div" === c.parentNode.nodeName.toLowerCase() && /^taTextElement/.test(c.parentNode.id) || (c = c.parentNode)), 
                "div" === c.nodeName.toLowerCase() && /^taTextElement/.test(c.id) ? (d.start.element = c.childNodes[d.start.offset], 
                d.end.element = c.childNodes[d.end.offset], d.container = c) : c.parentNode === d.start.element || c.parentNode === d.end.element ? d.container = c.parentNode : d.container = c, 
                d;
            },
            updateLeftArrowKey: function(b) {
                var c = a.getSelection().getRangeAt(0);
                if (c && c.collapsed) {
                    var d = h.getFlattenedDom(c);
                    if (!d.findIndex) return;
                    var f, j, g = c.startContainer, i = d.findIndex(function(a, b) {
                        return a.node === g || -1 !== a.parents.indexOf(g);
                    });
                    if (d.forEach(function(a, b) {
                        a.parents.forEach(function(a, b) {});
                    }), i + 1 < d.length && (f = d[i + 1].node), f && f.textContent && /^\ufeff([^\ufeff]*)$/.exec(f.textContent)) return;
                    if (0 < i && (j = d[i - 1].node), 0 === c.startOffset && j && /^\ufeff([^\ufeff]*)$/.exec(j.textContent)) return void h.setSelectionToElementEnd(j);
                }
            },
            updateRightArrowKey: function(a) {},
            getFlattenedDom: function(a) {
                var c = a.commonAncestorContainer.parentNode;
                if (!c) return a.commonAncestorContainer.childNodes;
                var d = Array.prototype.slice.call(c.childNodes), e = d.indexOf(a.startContainer);
                return e + 1 < d.length && 0 < e || c.parentNode && (c = c.parentNode), d = [], 
                function b(a) {
                    a.node.childNodes.length ? Array.prototype.slice.call(a.node.childNodes).forEach(function(c) {
                        var d = a.parents.slice();
                        d.slice(-1)[0] !== a.node && d.push(a.node), b({
                            parents: d,
                            node: c
                        });
                    }) : d.push({
                        parents: a.parents,
                        node: a.node
                    });
                }({
                    parents: [ c ],
                    node: c
                }), d;
            },
            getOnlySelectedElements: function() {
                var b = a.getSelection().getRangeAt(0), c = b.commonAncestorContainer;
                return c = 3 === c.nodeType ? c.parentNode : c, b.getNodes([ 1 ], function(a) {
                    return a.parentNode === c;
                });
            },
            getAllSelectedElements: function() {
                var b = a.getSelection().getRangeAt(0), c = b.commonAncestorContainer;
                c = 3 === c.nodeType ? c.parentNode : c;
                var d = b.getNodes([ 1 ], function(a) {
                    return a.parentNode === c;
                }), e = c.innerHTML;
                if ((e = e.replace(/<span id=.selectionBoundary[^>]+>\ufeff?<\/span>/gi, "")) === b.toHtml() && ("div" !== c.nodeName.toLowerCase() || !/^taTextElement/.test(c.id))) {
                    for (var f = [], g = d.length; g--; f.unshift(d[g])) ;
                    (d = f).push(c);
                }
                return d;
            },
            getSelectionElement: function() {
                return h.getSelection() ? h.getSelection().container : void 0;
            },
            setSelection: function(b, c, d, e) {
                var f = a.createRange();
                f.setStart(b, d), f.setEnd(c, e), a.getSelection().setSingleRange(f);
            },
            setSelectionBeforeElement: function(b) {
                var c = a.createRange();
                c.selectNode(b), c.collapse(!0), a.getSelection().setSingleRange(c);
            },
            setSelectionAfterElement: function(b) {
                var c = a.createRange();
                c.selectNode(b), c.collapse(!1), a.getSelection().setSingleRange(c);
            },
            setSelectionToElementStart: function(b) {
                var c = a.createRange();
                c.selectNodeContents(b), c.collapse(!0), a.getSelection().setSingleRange(c);
            },
            setSelectionToElementEnd: function(b) {
                var c = a.createRange();
                c.selectNodeContents(b), c.collapse(!1), b.childNodes && b.childNodes[b.childNodes.length - 1] && "br" === b.childNodes[b.childNodes.length - 1].nodeName && (c.startOffset = c.endOffset = c.startOffset - 1), 
                a.getSelection().setSingleRange(c);
            },
            setStateShiftKey: function(a) {
                e = a;
            },
            getStateShiftKey: function() {
                return e;
            },
            insertHtml: function(b, d) {
                var e, g, j, l, m, n, o, p = angular.element("<div>" + b + "</div>"), q = a.getSelection().getRangeAt(0), r = f.createDocumentFragment(), s = p[0].childNodes, t = !0;
                if (0 < s.length) {
                    for (l = [], j = 0; j < s.length; j++) {
                        var u = s[j];
                        "p" === u.nodeName.toLowerCase() && "" === u.innerHTML.trim() || (t = t && !i.test(u.nodeName), 
                        l.push(u));
                    }
                    for (var v = 0; v < l.length; v++) n = r.appendChild(l[v]);
                    !t && q.collapsed && /^(|<br(|\/)>)$/i.test(q.startContainer.innerHTML) && q.selectNode(q.startContainer);
                } else t = !0, n = r = f.createTextNode(b);
                if (t) q.deleteContents(); else if (q.collapsed && q.startContainer !== d) if (q.startContainer.innerHTML && q.startContainer.innerHTML.match(/^<[^>]*>$/i)) e = q.startContainer, 
                1 === q.startOffset ? (q.setStartAfter(e), q.setEndAfter(e)) : (q.setStartBefore(e), 
                q.setEndBefore(e)); else {
                    if (3 === q.startContainer.nodeType && q.startContainer.parentNode !== d) for (g = (e = q.startContainer.parentNode).cloneNode(), 
                    c.splitNodes(e.childNodes, e, g, q.startContainer, q.startOffset); !k.test(e.nodeName); ) {
                        angular.element(e).after(g);
                        var w = g;
                        g = (e = e.parentNode).cloneNode(), c.splitNodes(e.childNodes, e, g, w);
                    } else g = (e = q.startContainer).cloneNode(), c.splitNodes(e.childNodes, e, g, void 0, void 0, q.startOffset);
                    if (angular.element(e).after(g), q.setStartAfter(e), q.setEndAfter(e), /^(|<br(|\/)>)$/i.test(e.innerHTML.trim()) && (q.setStartBefore(e), 
                    q.setEndBefore(e), angular.element(e).remove()), /^(|<br(|\/)>)$/i.test(g.innerHTML.trim()) && angular.element(g).remove(), 
                    "li" === e.nodeName.toLowerCase()) {
                        for (o = f.createDocumentFragment(), m = 0; m < r.childNodes.length; m++) p = angular.element("<li>"), 
                        c.transferChildNodes(r.childNodes[m], p[0]), c.transferNodeAttributes(r.childNodes[m], p[0]), 
                        o.appendChild(p[0]);
                        r = o, n && (n = (n = r.childNodes[r.childNodes.length - 1]).childNodes[n.childNodes.length - 1]);
                    }
                } else q.deleteContents();
                q.insertNode(r), n && h.setSelectionToElementEnd(n);
            }
        };
        return h;
    } ]).service("taDOM", function() {
        var a = {
            getByAttribute: function(b, c) {
                var d = [], e = b.children();
                return e.length && angular.forEach(e, function(b) {
                    d = d.concat(a.getByAttribute(angular.element(b), c));
                }), void 0 !== b.attr(c) && d.push(b), d;
            },
            transferChildNodes: function(a, b) {
                for (b.innerHTML = ""; 0 < a.childNodes.length; ) b.appendChild(a.childNodes[0]);
                return b;
            },
            splitNodes: function(b, c, d, e, f, g) {
                if (!e && isNaN(g)) throw new Error("taDOM.splitNodes requires a splitNode or splitIndex");
                for (var h = document.createDocumentFragment(), i = document.createDocumentFragment(), j = 0; 0 < b.length && (isNaN(g) || g !== j) && b[0] !== e; ) h.appendChild(b[0]), 
                j++;
                for (!isNaN(f) && 0 <= f && b[0] && (h.appendChild(document.createTextNode(b[0].nodeValue.substring(0, f))), 
                b[0].nodeValue = b[0].nodeValue.substring(f)); 0 < b.length; ) i.appendChild(b[0]);
                a.transferChildNodes(h, c), a.transferChildNodes(i, d);
            },
            transferNodeAttributes: function(a, b) {
                for (var c = 0; c < a.attributes.length; c++) b.setAttribute(a.attributes[c].name, a.attributes[c].value);
                return b;
            }
        };
        return a;
    }), angular.module("textAngular.validators", []).directive("taMaxText", function() {
        return {
            restrict: "A",
            require: "ngModel",
            link: function(a, b, c, d) {
                var e = parseInt(a.$eval(c.taMaxText));
                if (isNaN(e)) throw "Max text must be an integer";
                c.$observe("taMaxText", function(a) {
                    if (e = parseInt(a), isNaN(e)) throw "Max text must be an integer";
                    d.$dirty && d.$validate();
                }), d.$validators.taMaxText = function(a) {
                    var b = angular.element("<div/>");
                    return b.html(a), b.text().length <= e;
                };
            }
        };
    }).directive("taMinText", function() {
        return {
            restrict: "A",
            require: "ngModel",
            link: function(a, b, c, d) {
                var e = parseInt(a.$eval(c.taMinText));
                if (isNaN(e)) throw "Min text must be an integer";
                c.$observe("taMinText", function(a) {
                    if (e = parseInt(a), isNaN(e)) throw "Min text must be an integer";
                    d.$dirty && d.$validate();
                }), d.$validators.taMinText = function(a) {
                    var b = angular.element("<div/>");
                    return b.html(a), !b.text().length || b.text().length >= e;
                };
            }
        };
    }), angular.module("textAngular.taBind", [ "textAngular.factories", "textAngular.DOM" ]).service("_taBlankTest", [ function() {
        return function(a) {
            return !a || "" === function(a) {
                var b = document.createElement("DIV");
                b.innerHTML = a;
                var c = b.textContent || b.innerText || "";
                return c.replace("​", ""), c.trim();
            }(a) && !/<img[^>]+>/.test(a);
        };
    } ]).directive("taButton", [ function() {
        return {
            link: function(a, b, c) {
                b.attr("unselectable", "on"), b.on("mousedown", function(a, b) {
                    return b && angular.extend(a, b), a.preventDefault(), !1;
                });
            }
        };
    } ]).directive("taBind", [ "taSanitize", "$timeout", "$document", "taFixChrome", "taBrowserTag", "taSelection", "taSelectableElements", "taApplyCustomRenderers", "taOptions", "_taBlankTest", "$parse", "taDOM", "textAngularManager", function(b, c, d, e, f, h, j, l, o, p, q, r, s) {
        return {
            priority: 2,
            require: [ "ngModel", "?ngModelOptions" ],
            link: function(f, r, u, v) {
                var x, y, z, B = v[0], C = v[1] || {}, D = void 0 !== r.attr("contenteditable") && r.attr("contenteditable"), E = D || "textarea" === r[0].tagName.toLowerCase() || "input" === r[0].tagName.toLowerCase(), F = !1, G = !1, H = !1, I = u.taUnsafeSanitizer || o.disableSanitizer, J = u.taKeepStyles || o.keepStyles, K = /^(9|19|20|27|33|34|35|36|37|38|39|40|45|112|113|114|115|116|117|118|119|120|121|122|123|144|145)$/i, L = /^(8|13|32|46|59|61|107|109|173|186|187|188|189|190|191|192|219|220|221|222)$/i, M = 1, N = 2, O = 4, P = 8, V = [ {
                    specialKey: "UndoKey",
                    forbiddenModifiers: O + P,
                    mustHaveModifiers: [ N + M ],
                    keyCode: 90
                }, {
                    specialKey: "RedoKey",
                    forbiddenModifiers: O,
                    mustHaveModifiers: [ N + M, P ],
                    keyCode: 90
                }, {
                    specialKey: "RedoKey",
                    forbiddenModifiers: O + P,
                    mustHaveModifiers: [ N + M ],
                    keyCode: 89
                }, {
                    specialKey: "TabKey",
                    forbiddenModifiers: N + P + O + M,
                    mustHaveModifiers: [],
                    keyCode: 9
                }, {
                    specialKey: "ShiftTabKey",
                    forbiddenModifiers: N + O + M,
                    mustHaveModifiers: [ P ],
                    keyCode: 9
                } ];
                void 0 === u.taDefaultWrap && (u.taDefaultWrap = "p"), "" === u.taDefaultWrap ? z = "" : (z = void 0 === g_ie || 11 <= g_ie ? "br" === u.taDefaultWrap.toLowerCase() ? "<BR><BR>" : "<" + u.taDefaultWrap + "><br></" + u.taDefaultWrap + ">" : g_ie <= 8 ? "<" + u.taDefaultWrap.toUpperCase() + "></" + u.taDefaultWrap.toUpperCase() + ">" : "<" + u.taDefaultWrap + "></" + u.taDefaultWrap + ">", 
                void 0 === g_ie || 11 <= g_ie ? "br" === u.taDefaultWrap.toLowerCase() || (u.taDefaultWrap, 
                u.taDefaultWrap) : g_ie <= 8 ? (u.taDefaultWrap.toUpperCase(), u.taDefaultWrap.toUpperCase()) : (u.taDefaultWrap, 
                u.taDefaultWrap)), C.$options || (C.$options = {});
                var X, W = function(a) {
                    if (p(a)) return a;
                    var b = angular.element("<div>" + a + "</div>");
                    if (0 === b.children().length) a = "<" + u.taDefaultWrap + ">" + a + "</" + u.taDefaultWrap + ">"; else {
                        var c, d = b[0].childNodes, e = !1;
                        for (c = 0; c < d.length && !(e = d[c].nodeName.toLowerCase().match(i)); c++) ;
                        if (e) for (a = "", c = 0; c < d.length; c++) {
                            var f = d[c], g = f.nodeName.toLowerCase();
                            if ("#comment" === g) a += "\x3c!--" + f.nodeValue + "--\x3e"; else if ("#text" === g) {
                                var h = f.textContent;
                                a += h.trim() ? "<" + u.taDefaultWrap + ">" + h + "</" + u.taDefaultWrap + ">" : h;
                            } else if (g.match(i)) a += f.outerHTML; else {
                                var j = f.outerHTML || f.nodeValue;
                                a += "" !== j.trim() ? "<" + u.taDefaultWrap + ">" + j + "</" + u.taDefaultWrap + ">" : j;
                            }
                        } else a = "<" + u.taDefaultWrap + ">" + a + "</" + u.taDefaultWrap + ">";
                    }
                    return a;
                };
                u.taPaste && (y = q(u.taPaste)), r.addClass("ta-bind"), f["$undoManager" + (u.id || "")] = B.$undoManager = {
                    _stack: [],
                    _index: 0,
                    _max: 1e3,
                    push: function(a) {
                        return null == a || void 0 !== this.current() && null !== this.current() && a === this.current() || (this._index < this._stack.length - 1 && (this._stack = this._stack.slice(0, this._index + 1)), 
                        this._stack.push(a), X && c.cancel(X), this._stack.length > this._max && this._stack.shift(), 
                        this._index = this._stack.length - 1), a;
                    },
                    undo: function() {
                        return this.setToIndex(this._index - 1);
                    },
                    redo: function() {
                        return this.setToIndex(this._index + 1);
                    },
                    setToIndex: function(a) {
                        if (!(a < 0 || a > this._stack.length - 1)) return this._index = a, this.current();
                    },
                    current: function() {
                        return this._stack[this._index];
                    }
                };
                var Y, Z = function() {
                    if (D) return r[0].innerHTML;
                    if (E) return r.val();
                    throw "textAngular Error: attempting to update non-editable taBind";
                }, $ = function(a) {
                    return f.$emit("ta-element-select", this), a.preventDefault(), !1;
                }, _ = f["reApplyOnSelectorHandlers" + (u.id || "")] = function() {
                    F || angular.forEach(j, function(a) {
                        r.find(a).off("click", $).on("click", $);
                    });
                }, aa = function(a, b, c) {
                    H = c || !1, null != b || (b = D), null != a || (a = Z()), p(a) ? ("" !== B.$viewValue && B.$setViewValue(""), 
                    b && "" !== B.$undoManager.current() && B.$undoManager.push("")) : (_(), B.$viewValue !== a && (B.$setViewValue(a), 
                    b && B.$undoManager.push(a))), B.$render();
                }, ba = function(a) {
                    r[0].innerHTML = a;
                }, ca = f["$undoTaBind" + (u.id || "")] = function() {
                    if (!F && D) {
                        var a = B.$undoManager.undo();
                        null != a && (ba(a), aa(a, !1), Y && c.cancel(Y), Y = c(function() {
                            r[0].focus(), h.setSelectionToElementEnd(r[0]);
                        }, 1));
                    }
                }, da = f["$redoTaBind" + (u.id || "")] = function() {
                    if (!F && D) {
                        var a = B.$undoManager.redo();
                        null != a && (ba(a), aa(a, !1), Y && c.cancel(Y), Y = c(function() {
                            r[0].focus(), h.setSelectionToElementEnd(r[0]);
                        }, 1));
                    }
                };
                f["updateTaBind" + (u.id || "")] = function() {
                    F || aa(void 0, void 0, !0);
                };
                var ea = function(a) {
                    return B.$oldViewValue = b(e(a, J), B.$oldViewValue, I);
                };
                if (r.attr("required") && (B.$validators.required = function(a, b) {
                    return !p(a || b);
                }), B.$parsers.push(ea), B.$parsers.unshift(W), B.$formatters.push(ea), B.$formatters.unshift(W), 
                B.$formatters.unshift(function(a) {
                    return B.$undoManager.push(a || "");
                }), E) if (f.events = {}, D) {
                    var ha, ia, fa = !1, ga = function(a) {
                        var d = void 0 !== a && a.match(/content=["']*OneNote.File/i);
                        if (a && a.trim().length) {
                            if (a.match(/class=["']*Mso(Normal|List)/i) || a.match(/content=["']*Word.Document/i) || a.match(/content=["']*OneNote.File/i)) {
                                var e = a.match(/<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/i);
                                e = (e = e ? e[1] : a).replace(/<o:p>[\s\S]*?<\/o:p>/gi, "").replace(/class=(["']|)MsoNormal(["']|)/gi, "");
                                var g = angular.element("<div>" + e + "</div>"), i = angular.element("<div></div>"), j = {
                                    element: null,
                                    lastIndent: [],
                                    lastLi: null,
                                    isUl: !1
                                };
                                j.lastIndent.peek = function() {
                                    var a = this.length;
                                    if (0 < a) return this[a - 1];
                                };
                                for (var k = function(a) {
                                    j.isUl = a, j.element = angular.element(a ? "<ul>" : "<ol>"), j.lastIndent = [], 
                                    j.lastIndent.peek = function() {
                                        var a = this.length;
                                        if (0 < a) return this[a - 1];
                                    }, j.lastLevelMatch = null;
                                }, l = 0; l <= g[0].childNodes.length; l++) if (g[0].childNodes[l] && "#text" !== g[0].childNodes[l].nodeName) {
                                    var m = g[0].childNodes[l].tagName.toLowerCase();
                                    if ("p" === m || "ul" === m || "h1" === m || "h2" === m || "h3" === m || "h4" === m || "h5" === m || "h6" === m || "table" === m) {
                                        var n = angular.element(g[0].childNodes[l]), o = (n.attr("class") || "").match(/MsoList(Bullet|Number|Paragraph)(CxSp(First|Middle|Last)|)/i);
                                        if (o) {
                                            if (n[0].childNodes.length < 2 || n[0].childNodes[1].childNodes.length < 1) continue;
                                            var p = "bullet" === o[1].toLowerCase() || "number" !== o[1].toLowerCase() && !(/^[^0-9a-z<]*[0-9a-z]+[^0-9a-z<>]</i.test(n[0].childNodes[1].innerHTML) || /^[^0-9a-z<]*[0-9a-z]+[^0-9a-z<>]</i.test(n[0].childNodes[1].childNodes[0].innerHTML)), q = (n.attr("style") || "").match(/margin-left:([\-\.0-9]*)/i), s = parseFloat(q ? q[1] : 0), t = (n.attr("style") || "").match(/mso-list:l([0-9]+) level([0-9]+) lfo[0-9+]($|;)/i);
                                            if (t && t[2] && (s = parseInt(t[2])), t && (!j.lastLevelMatch || t[1] !== j.lastLevelMatch[1]) || !o[3] || "first" === o[3].toLowerCase() || null === j.lastIndent.peek() || j.isUl !== p && j.lastIndent.peek() === s) k(p), 
                                            i.append(j.element); else if (null != j.lastIndent.peek() && j.lastIndent.peek() < s) j.element = angular.element(p ? "<ul>" : "<ol>"), 
                                            j.lastLi.append(j.element); else if (null != j.lastIndent.peek() && j.lastIndent.peek() > s) {
                                                for (;null != j.lastIndent.peek() && j.lastIndent.peek() > s; ) if ("li" !== j.element.parent()[0].tagName.toLowerCase()) {
                                                    if (!/[uo]l/i.test(j.element.parent()[0].tagName.toLowerCase())) break;
                                                    j.element = j.element.parent(), j.lastIndent.pop();
                                                } else j.element = j.element.parent();
                                                j.isUl = "ul" === j.element[0].tagName.toLowerCase(), p !== j.isUl && (k(p), i.append(j.element));
                                            }
                                            j.lastLevelMatch = t, s !== j.lastIndent.peek() && j.lastIndent.push(s), j.lastLi = angular.element("<li>"), 
                                            j.element.append(j.lastLi), j.lastLi.html(n.html().replace(/<!(--|)\[if !supportLists\](--|)>[\s\S]*?<!(--|)\[endif\](--|)>/gi, "")), 
                                            n.remove();
                                        } else k(!1), i.append(n);
                                    }
                                }
                                var u = function(a) {
                                    for (var b = (a = angular.element(a))[0].childNodes.length - 1; 0 <= b; b--) a.after(a[0].childNodes[b]);
                                    a.remove();
                                };
                                angular.forEach(i.find("span"), function(a) {
                                    a.removeAttribute("lang"), a.attributes.length <= 0 && u(a);
                                }), angular.forEach(i.find("font"), u), a = i.html(), d && (a = i.html() || g.html()), 
                                a = a.replace(/\n/g, " ");
                            } else {
                                if ((a = a.replace(/<(|\/)meta[^>]*?>/gi, "")).match(/<[^>]*?(ta-bind)[^>]*?>/)) {
                                    if (a.match(/<[^>]*?(text-angular)[^>]*?>/)) {
                                        var v = angular.element("<div>" + a + "</div>");
                                        v.find("textarea").remove();
                                        for (var w = 0; w < binds.length; w++) {
                                            for (var x = binds[w][0].parentNode.parentNode, z = 0; z < binds[w][0].childNodes.length; z++) x.parentNode.insertBefore(binds[w][0].childNodes[z], x);
                                            x.parentNode.removeChild(x);
                                        }
                                        a = v.html().replace('<br class="Apple-interchange-newline">', "");
                                    }
                                } else a.match(/^<span/) && (a.match(/<span class=(\"Apple-converted-space\"|\'Apple-converted-space\')>.<\/span>/gi) || (a = a.replace(/<(|\/)span[^>]*?>/gi, "")));
                                a = a.replace(/<br class="Apple-interchange-newline"[^>]*?>/gi, "").replace(/<span class="Apple-converted-space">( |&nbsp;)<\/span>/gi, "&nbsp;");
                            }
                            /<li(\s.*)?>/i.test(a) && !1 === /(<ul(\s.*)?>|<ol(\s.*)?>).*<li(\s.*)?>/i.test(a) && (a = a.replace(/<li(\s.*)?>.*<\/li(\s.*)?>/i, "<ul>$&</ul>")), 
                            a = a.replace(/^[ |\u00A0]+/gm, function(a) {
                                for (var b = "", c = 0; c < a.length; c++) b += "&nbsp;";
                                return b;
                            }).replace(/\n|\r\n|\r/g, "<br />").replace(/\t/g, "&nbsp;&nbsp;&nbsp;&nbsp;"), 
                            y && (a = y(f, {
                                $html: a
                            }) || a), a = a.replace(/<span style=("|')([^<]*?)vertical-align\s*:\s*super;?([^>]*?)("|')>([^<]+?)<\/span>/g, "<sup style='$2$3'>$5</sup>"), 
                            a = b(a, "", I), h.insertHtml(a, r[0]), c(function() {
                                B.$setViewValue(Z()), fa = !1, r.removeClass("processing-paste");
                            }, 0);
                        } else fa = !1, r.removeClass("processing-paste");
                    };
                    if (r.on("paste", f.events.paste = function(b, e) {
                        if (e && angular.extend(b, e), F || fa) return b.stopPropagation(), b.preventDefault(), 
                        !1;
                        fa = !0, r.addClass("processing-paste");
                        var f, g = (b.originalEvent || b).clipboardData;
                        if (!g && window.clipboardData && window.clipboardData.getData) return f = window.clipboardData.getData("Text"), 
                        ga(f), b.stopPropagation(), b.preventDefault(), !1;
                        if (g && g.getData && 0 < g.types.length) {
                            for (var h = "", i = 0; i < g.types.length; i++) h += " " + g.types[i];
                            return /text\/html/i.test(h) ? f = g.getData("text/html") : /text\/plain/i.test(h) && (f = g.getData("text/plain")), 
                            ga(f), b.stopPropagation(), b.preventDefault(), !1;
                        }
                        var j = a.saveSelection(), k = angular.element('<div class="ta-hidden-input" contenteditable="true"></div>');
                        d.find("body").append(k), k[0].focus(), c(function() {
                            a.restoreSelection(j), ga(k[0].innerHTML), r[0].focus(), k.remove();
                        }, 0);
                    }), r.on("cut", f.events.cut = function(a) {
                        F ? a.preventDefault() : c(function() {
                            B.$setViewValue(Z());
                        }, 0);
                    }), r.on("keydown", f.events.keydown = function(a, b) {
                        var c;
                        if (b && angular.extend(a, b), 16 === a.keyCode ? h.setStateShiftKey(!0) : h.setStateShiftKey(!1), 
                        a.specialKey = function(a) {
                            var b;
                            return V.forEach(function(c) {
                                if (c.keyCode === a.keyCode) {
                                    var d = (a.metaKey ? N : 0) + (a.ctrlKey ? M : 0) + (a.shiftKey ? P : 0) + (a.altKey ? O : 0);
                                    if (c.forbiddenModifiers & d) return;
                                    c.mustHaveModifiers.every(function(a) {
                                        return d & a;
                                    }) && (b = c.specialKey);
                                }
                            }), b;
                        }(a), o.keyMappings.forEach(function(b) {
                            a.specialKey === b.commandKeyCode && (a.specialKey = void 0), b.testForKey(a) && (c = b.commandKeyCode), 
                            "UndoKey" !== b.commandKeyCode && "RedoKey" !== b.commandKeyCode || b.enablePropagation || a.preventDefault();
                        }), void 0 !== c && (a.specialKey = c), void 0 === a.specialKey || "UndoKey" === a.specialKey && "RedoKey" === a.specialKey || (a.preventDefault(), 
                        s.sendKeyCommand(f, a)), !(F || ("UndoKey" === a.specialKey && (ca(), a.preventDefault()), 
                        "RedoKey" === a.specialKey && (da(), a.preventDefault()), 13 !== a.keyCode || a.shiftKey || a.ctrlKey || a.metaKey || a.altKey))) {
                            var d, g = h.getSelectionElement();
                            if (!g.nodeName.match(k)) return;
                            var i = angular.element(z);
                            if (function(a, b) {
                                for (var c = 0; c < a.length; c++) if (a[c] === b) return !0;
                                return !1;
                            }([ "blockquote", "ul", "ol" ], g.parentNode.tagName.toLowerCase())) {
                                if (/^<br(|\/)>$/i.test(g.innerHTML.trim()) && !g.nextSibling) {
                                    var l = (d = angular.element(g)).parent();
                                    l.after(i), d.remove(), 0 === l.children().length && l.remove(), h.setSelectionToElementStart(i[0]), 
                                    a.preventDefault();
                                }
                                /^<[^>]+><br(|\/)><\/[^>]+>$/i.test(g.innerHTML.trim()) && ((d = angular.element(g)).after(i), 
                                d.remove(), h.setSelectionToElementStart(i[0]), a.preventDefault());
                            }
                        }
                    }), r.on("keyup", f.events.keyup = function(a, b) {
                        if (b && angular.extend(a, b), h.setStateShiftKey(!1), 9 !== a.keyCode) {
                            if (37 !== a.keyCode || a.shiftKey || h.updateLeftArrowKey(r), 39 !== a.keyCode || a.shiftKey || h.updateRightArrowKey(r), 
                            X && c.cancel(X), !F && !K.test(a.keyCode)) if (13 === a.keyCode && (a.ctrlKey || a.metaKey || a.altKey)) ; else {
                                if ("" !== z && "<BR><BR>" !== z && 13 === a.keyCode && !a.ctrlKey && !a.metaKey && !a.altKey) {
                                    for (var e = h.getSelectionElement(); !e.nodeName.match(k) && e !== r[0]; ) e = e.parentNode;
                                    if (a.shiftKey) {
                                        var f = e.tagName.toLowerCase();
                                        if ((f === u.taDefaultWrap || "li" === f || "pre" === f || "div" === f) && !/.+<br><br>/.test(e.innerHTML.trim())) {
                                            var g = e.previousSibling;
                                            g && (g.innerHTML = g.innerHTML + "<br><br>", angular.element(e).remove(), h.setSelectionToElementEnd(g));
                                        }
                                    } else if (e.tagName.toLowerCase() !== u.taDefaultWrap && "li" !== e.nodeName.toLowerCase() && ("" === e.innerHTML.trim() || "<br>" === e.innerHTML.trim())) {
                                        var i = angular.element(z);
                                        angular.element(e).replaceWith(i), h.setSelectionToElementStart(i[0]);
                                    }
                                }
                                var j = Z();
                                "" === z || "" !== j.trim() && "<br>" !== j.trim() ? "<" !== j.substring(0, 1) && u.taDefaultWrap : (ba(z), 
                                h.setSelectionToElementStart(r.children()[0]));
                                var l = x !== a.keyCode && L.test(a.keyCode);
                                ha && c.cancel(ha), ha = c(function() {
                                    aa(j, l, !0);
                                }, C.$options.debounce || 400), l || (X = c(function() {
                                    B.$undoManager.push(j);
                                }, 250)), x = a.keyCode;
                            }
                        } else h.getSelection().start.element === r[0] && r.children().length && h.setSelectionToElementStart(r.children()[0]);
                    }), r.on("input", function() {
                        Z() !== B.$viewValue && (ia && c.cancel(ia), ia = c(function() {
                            var b = a.saveSelection(), c = Z();
                            c !== B.$viewValue && aa(c, !0), 0 !== B.$viewValue.length && a.restoreSelection(b);
                        }, 1e3));
                    }), r.on("blur", f.events.blur = function() {
                        G = !1, F ? (H = !0, B.$render()) : aa(void 0, void 0, !0);
                    }), u.placeholder && (8 < g_ie || void 0 === g_ie)) {
                        var ja;
                        if (!u.id) throw "textAngular Error: An unique ID is required for placeholders to work";
                        ja = m("#" + u.id + ".placeholder-text:before", 'content: "' + u.placeholder + '"'), 
                        f.$on("$destroy", function() {
                            n(ja);
                        });
                    }
                    r.on("focus", f.events.focus = function() {
                        G = !0, r.removeClass("placeholder-text"), _();
                    }), r.on("mouseup", f.events.mouseup = function() {
                        var a = h.getSelection();
                        a && a.start.element === r[0] && r.children().length && h.setSelectionToElementStart(r.children()[0]);
                    }), r.on("mousedown", f.events.mousedown = function(a, b) {
                        b && angular.extend(a, b), a.stopPropagation();
                    });
                } else {
                    r.on("change blur", f.events.change = f.events.blur = function() {
                        F || B.$setViewValue(Z());
                    }), r.on("keydown", f.events.keydown = function(a, b) {
                        if (b && angular.extend(a, b), 9 === a.keyCode) {
                            var c = this.selectionStart, d = this.selectionEnd, e = r.val();
                            if (a.shiftKey) {
                                var f = e.lastIndexOf("\n", c), g = e.lastIndexOf("\t", c);
                                -1 !== g && f <= g && (r.val(e.substring(0, g) + e.substring(g + 1)), this.selectionStart = this.selectionEnd = c - 1);
                            } else r.val(e.substring(0, c) + "\t" + e.substring(d)), this.selectionStart = this.selectionEnd = c + 1;
                            a.preventDefault();
                        }
                    });
                    var ka = function(a, b) {
                        for (var c = "", d = 0; d < b; d++) c += a;
                        return c;
                    }, la = function(a, b, c) {
                        for (var d = 0; d < a.length; d++) b.call(c, d, a[d]);
                    }, ma = function(a, b) {
                        var c = "", d = a.childNodes;
                        return c += ka("\t", ++b - 1) + a.outerHTML.substring(0, 4), la(d, function(a, d) {
                            var e = d.nodeName.toLowerCase();
                            return "#comment" === e ? void (c += "\x3c!--" + d.nodeValue + "--\x3e") : "#text" === e ? void (c += d.textContent) : void (d.outerHTML && (c += "ul" === e || "ol" === e ? "\n" + ma(d, b) : "\n" + ka("\t", b) + d.outerHTML));
                        }), c += "\n" + ka("\t", b - 1) + a.outerHTML.substring(a.outerHTML.lastIndexOf("<"));
                    };
                    B.$formatters.unshift(function(a) {
                        var b = angular.element("<div>" + a + "</div>")[0].childNodes;
                        return 0 < b.length && (a = "", la(b, function(b, c) {
                            var d = c.nodeName.toLowerCase();
                            return "#comment" === d ? void (a += "\x3c!--" + c.nodeValue + "--\x3e") : "#text" === d ? void (a += c.textContent) : void (c.outerHTML && (0 < a.length && (a += "\n"), 
                            a += "ul" === d || "ol" === d ? "" + ma(c, 0) : "" + c.outerHTML));
                        })), a;
                    });
                }
                var na, oa = function(a, b) {
                    var d;
                    (b && angular.extend(a, b), t || F) || (t = !0, d = a.originalEvent ? a.originalEvent.dataTransfer : a.dataTransfer, 
                    f.$emit("ta-drop-event", this, a, d), c(function() {
                        aa(void 0, void 0, !(t = !1));
                    }, 100));
                }, pa = !1;
                B.$render = function() {
                    if (!pa) {
                        pa = !0;
                        var a = B.$viewValue || "";
                        H || (D && G && (r.removeClass("placeholder-text"), na && c.cancel(na), na = c(function() {
                            G || (r[0].focus(), h.setSelectionToElementEnd(r.children()[r.children().length - 1])), 
                            na = void 0;
                        }, 1)), D ? (ba((u.placeholder, "" === a ? z : a)), F ? r.off("drop", oa) : (_(), 
                        r.on("drop", oa))) : "textarea" !== r[0].tagName.toLowerCase() && "input" !== r[0].tagName.toLowerCase() ? ba(l(a)) : r.val(a)), 
                        D && u.placeholder && ("" === a ? G ? r.removeClass("placeholder-text") : r.addClass("placeholder-text") : r.removeClass("placeholder-text")), 
                        pa = H = !1;
                    }
                }, u.taReadonly && ((F = f.$eval(u.taReadonly)) ? (r.addClass("ta-readonly"), "textarea" !== r[0].tagName.toLowerCase() && "input" !== r[0].tagName.toLowerCase() || r.attr("disabled", "disabled"), 
                void 0 !== r.attr("contenteditable") && r.attr("contenteditable") && r.removeAttr("contenteditable")) : (r.removeClass("ta-readonly"), 
                "textarea" === r[0].tagName.toLowerCase() || "input" === r[0].tagName.toLowerCase() ? r.removeAttr("disabled") : D && r.attr("contenteditable", "true")), 
                f.$watch(u.taReadonly, function(a, b) {
                    b !== a && (a ? (r.addClass("ta-readonly"), "textarea" !== r[0].tagName.toLowerCase() && "input" !== r[0].tagName.toLowerCase() || r.attr("disabled", "disabled"), 
                    void 0 !== r.attr("contenteditable") && r.attr("contenteditable") && r.removeAttr("contenteditable"), 
                    angular.forEach(j, function(a) {
                        r.find(a).on("click", $);
                    }), r.off("drop", oa)) : (r.removeClass("ta-readonly"), "textarea" === r[0].tagName.toLowerCase() || "input" === r[0].tagName.toLowerCase() ? r.removeAttr("disabled") : D && r.attr("contenteditable", "true"), 
                    angular.forEach(j, function(a) {
                        r.find(a).off("click", $);
                    }), r.on("drop", oa)), F = a);
                })), D && !F && (angular.forEach(j, function(a) {
                    r.find(a).on("click", $);
                }), r.on("drop", oa));
            }
        };
    } ]);
    var t = !1, u = angular.module("textAngular", [ "ngSanitize", "textAngularSetup", "textAngular.factories", "textAngular.DOM", "textAngular.validators", "textAngular.taBind" ]);
    return u.config([ function() {
        angular.forEach(e, function(a, b) {
            delete e[b];
        });
    } ]), u.directive("textAngular", [ "$compile", "$timeout", "taOptions", "taSelection", "taExecCommand", "textAngularManager", "$document", "$animate", "$log", "$q", "$parse", function(b, c, d, e, f, g, h, i, j, k, l) {
        return {
            require: "?ngModel",
            scope: {},
            restrict: "EA",
            priority: 2,
            link: function(m, n, o, p) {
                var q, r, s, t, u, v, w, x, y, z, A, B, C = o.serial ? o.serial : Math.floor(1e16 * Math.random());
                m._name = o.name ? o.name : "textAngularEditor" + C;
                var D = function(a, b, d) {
                    c(function() {
                        a.one(b, d);
                    }, 100);
                };
                if (y = f(o.taDefaultWrap), angular.extend(m, angular.copy(d), {
                    wrapSelection: function(a, b, c) {
                        "undo" === a.toLowerCase() ? m["$undoTaBindtaTextElement" + C]() : "redo" === a.toLowerCase() ? m["$redoTaBindtaTextElement" + C]() : (y(a, !1, b, m.defaultTagAttributes), 
                        c && m["reApplyOnSelectorHandlerstaTextElement" + C](), m.displayElements.text[0].focus());
                    },
                    showHtml: m.$eval(o.taShowHtml) || !1
                }), o.taFocussedClass && (m.classes.focussed = o.taFocussedClass), o.taTextEditorClass && (m.classes.textEditor = o.taTextEditorClass), 
                o.taHtmlEditorClass && (m.classes.htmlEditor = o.taHtmlEditorClass), o.taDefaultTagAttributes) try {
                    angular.extend(m.defaultTagAttributes, angular.fromJson(o.taDefaultTagAttributes));
                } catch (a) {
                    j.error(a);
                }
                o.taTextEditorSetup && (m.setup.textEditorSetup = m.$parent.$eval(o.taTextEditorSetup)), 
                o.taHtmlEditorSetup && (m.setup.htmlEditorSetup = m.$parent.$eval(o.taHtmlEditorSetup)), 
                o.taFileDrop ? m.fileDropHandler = m.$parent.$eval(o.taFileDrop) : m.fileDropHandler = m.defaultFileDropHandler, 
                w = n[0].innerHTML, n[0].innerHTML = "", m.displayElements = {
                    forminput: angular.element("<input type='hidden' tabindex='-1' style='display: none;'>"),
                    html: angular.element("<textarea></textarea>"),
                    text: angular.element("<div></div>"),
                    scrollWindow: angular.element("<div class='ta-scroll-window'></div>"),
                    popover: angular.element('<div class="popover fade bottom" style="max-width: none; width: 305px;"></div>'),
                    popoverArrow: angular.element('<div class="arrow"></div>'),
                    popoverContainer: angular.element('<div class="popover-content"></div>'),
                    resize: {
                        overlay: angular.element('<div class="ta-resizer-handle-overlay"></div>'),
                        background: angular.element('<div class="ta-resizer-handle-background"></div>'),
                        anchors: [ angular.element('<div class="ta-resizer-handle-corner ta-resizer-handle-corner-tl"></div>'), angular.element('<div class="ta-resizer-handle-corner ta-resizer-handle-corner-tr"></div>'), angular.element('<div class="ta-resizer-handle-corner ta-resizer-handle-corner-bl"></div>'), angular.element('<div class="ta-resizer-handle-corner ta-resizer-handle-corner-br"></div>') ],
                        info: angular.element('<div class="ta-resizer-handle-info"></div>')
                    }
                }, m.displayElements.popover.append(m.displayElements.popoverArrow), m.displayElements.popover.append(m.displayElements.popoverContainer), 
                m.displayElements.scrollWindow.append(m.displayElements.popover), m.displayElements.popover.on("mousedown", function(a, b) {
                    return b && angular.extend(a, b), a.preventDefault(), !1;
                }), m.handlePopoverEvents = function() {
                    "block" === m.displayElements.popover.css("display") && (B && c.cancel(B), B = c(function() {
                        m.reflowPopover(m.resizeElement), m.reflowResizeOverlay(m.resizeElement);
                    }, 100));
                }, angular.element(window).on("resize", m.handlePopoverEvents), angular.element(window).on("scroll", m.handlePopoverEvents);
                m.getScrollTop = function(a, b) {
                    var c = a.scrollTop;
                    return void 0 === c && (c = 0), b && function(a) {
                        var b, c = {
                            vertical: !1,
                            horizontal: !1
                        };
                        try {
                            if (null === (b = window.getComputedStyle(a))) return c;
                        } catch (a) {
                            return c;
                        }
                        var d = b["overflow-y"], e = b["overflow-x"];
                        return {
                            vertical: ("scroll" === d || "auto" === d) && a.scrollHeight > a.clientHeight,
                            horizontal: ("scroll" === e || "auto" === e) && a.scrollWidth > a.clientWidth
                        };
                    }(a).vertical && (a.removeEventListener("scroll", m._scrollListener, !1), a.addEventListener("scroll", m._scrollListener, !1)), 
                    0 !== c ? {
                        node: a.nodeName,
                        top: c
                    } : a.parentNode ? m.getScrollTop(a.parentNode, b) : {
                        node: "<none>",
                        top: 0
                    };
                }, m.showPopover = function(a) {
                    m.getScrollTop(m.displayElements.scrollWindow[0], !0), m.displayElements.popover.css("display", "block"), 
                    c(function() {
                        m.displayElements.resize.overlay.css("display", "block");
                    }), m.resizeElement = a, m.reflowPopover(a), i.addClass(m.displayElements.popover, "in"), 
                    D(h.find("body"), "click keyup", function() {
                        m.hidePopover();
                    });
                }, m._scrollListener = function(a, b) {
                    m.handlePopoverEvents();
                }, m.reflowPopover = function(a) {
                    var b = m.getScrollTop(m.displayElements.scrollWindow[0], !1);
                    a[0].offsetTop - b.top < 51 ? (m.displayElements.popover.css("top", a[0].offsetTop + a[0].offsetHeight + m.displayElements.scrollWindow[0].scrollTop + "px"), 
                    m.displayElements.popover.removeClass("top").addClass("bottom")) : (m.displayElements.popover.css("top", a[0].offsetTop - 54 + m.displayElements.scrollWindow[0].scrollTop + "px"), 
                    m.displayElements.popover.removeClass("bottom").addClass("top"));
                    var d = m.displayElements.text[0].offsetWidth - m.displayElements.popover[0].offsetWidth, e = a[0].offsetLeft + a[0].offsetWidth / 2 - m.displayElements.popover[0].offsetWidth / 2, f = Math.max(0, Math.min(d, e)), g = Math.min(e, Math.max(0, e - d)) - 11;
                    f += window.scrollX, g -= window.scrollX, m.displayElements.popover.css("left", f + "px"), 
                    m.displayElements.popoverArrow.css("margin-left", g + "px");
                }, m.hidePopover = function() {
                    m.displayElements.popover.css("display", "none"), m.displayElements.popoverContainer.attr("style", ""), 
                    m.displayElements.popoverContainer.attr("class", "popover-content"), m.displayElements.popover.removeClass("in"), 
                    m.displayElements.resize.overlay.css("display", "none");
                }, m.displayElements.resize.overlay.append(m.displayElements.resize.background), 
                angular.forEach(m.displayElements.resize.anchors, function(a) {
                    m.displayElements.resize.overlay.append(a);
                }), m.displayElements.resize.overlay.append(m.displayElements.resize.info), m.displayElements.scrollWindow.append(m.displayElements.resize.overlay), 
                m.displayElements.resize.background.on("click", function(a) {
                    m.displayElements.text[0].focus();
                }), m.reflowResizeOverlay = function(a) {
                    a = angular.element(a)[0], m.displayElements.resize.overlay.css({
                        display: "block",
                        left: a.offsetLeft - 5 + "px",
                        top: a.offsetTop - 5 + "px",
                        width: a.offsetWidth + 10 + "px",
                        height: a.offsetHeight + 10 + "px"
                    }), m.displayElements.resize.info.text(a.offsetWidth + " x " + a.offsetHeight);
                }, m.showResizeOverlay = function(a) {
                    var b = h.find("body");
                    z = function(c) {
                        var d = {
                            width: parseInt(a.attr("width")),
                            height: parseInt(a.attr("height")),
                            x: c.clientX,
                            y: c.clientY
                        };
                        (void 0 === d.width || isNaN(d.width)) && (d.width = a[0].offsetWidth), (void 0 === d.height || isNaN(d.height)) && (d.height = a[0].offsetHeight), 
                        m.hidePopover();
                        var e = d.height / d.width, f = function(b) {
                            function c(a) {
                                return Math.round(Math.max(0, a));
                            }
                            var f = {
                                x: Math.max(0, d.width + (b.clientX - d.x)),
                                y: Math.max(0, d.height + (b.clientY - d.y))
                            }, g = void 0 !== o.taResizeForceAspectRatio, h = o.taResizeMaintainAspectRatio;
                            if (g || h && !b.shiftKey) {
                                var j = f.y / f.x;
                                f.x = j < e ? f.x : f.y / e, f.y = j < e ? f.x * e : f.y;
                            }
                            var k = angular.element(a);
                            k.css("height", c(f.y) + "px"), k.css("width", c(f.x) + "px"), m.reflowResizeOverlay(a);
                        };
                        b.on("mousemove", f), D(b, "mouseup", function(a) {
                            a.preventDefault(), a.stopPropagation(), b.off("mousemove", f), m.$apply(function() {
                                m.hidePopover(), m.updateTaBindtaTextElement();
                            }, 100);
                        }), c.stopPropagation(), c.preventDefault();
                    }, m.displayElements.resize.anchors[3].off("mousedown"), m.displayElements.resize.anchors[3].on("mousedown", z), 
                    m.reflowResizeOverlay(a), D(b, "click", function() {
                        m.hideResizeOverlay();
                    });
                }, m.hideResizeOverlay = function() {
                    m.displayElements.resize.anchors[3].off("mousedown", z), m.displayElements.resize.overlay.css("display", "none");
                }, m.setup.htmlEditorSetup(m.displayElements.html), m.setup.textEditorSetup(m.displayElements.text), 
                m.displayElements.html.attr({
                    id: "taHtmlElement" + C,
                    "ng-show": "showHtml",
                    "ta-bind": "ta-bind",
                    "ng-model": "html",
                    "ng-model-options": n.attr("ng-model-options")
                }), m.displayElements.text.attr({
                    id: "taTextElement" + C,
                    contentEditable: "true",
                    "ta-bind": "ta-bind",
                    "ng-model": "html",
                    "ng-model-options": n.attr("ng-model-options")
                }), m.displayElements.scrollWindow.attr({
                    "ng-hide": "showHtml"
                }), o.taDefaultWrap && m.displayElements.text.attr("ta-default-wrap", o.taDefaultWrap), 
                o.taUnsafeSanitizer && (m.displayElements.text.attr("ta-unsafe-sanitizer", o.taUnsafeSanitizer), 
                m.displayElements.html.attr("ta-unsafe-sanitizer", o.taUnsafeSanitizer)), o.taKeepStyles && (m.displayElements.text.attr("ta-keep-styles", o.taKeepStyles), 
                m.displayElements.html.attr("ta-keep-styles", o.taKeepStyles)), m.displayElements.scrollWindow.append(m.displayElements.text), 
                n.append(m.displayElements.scrollWindow), n.append(m.displayElements.html), m.displayElements.forminput.attr("name", m._name), 
                n.append(m.displayElements.forminput), o.tabindex && (n.removeAttr("tabindex"), 
                m.displayElements.text.attr("tabindex", o.tabindex), m.displayElements.html.attr("tabindex", o.tabindex)), 
                o.placeholder && (m.displayElements.text.attr("placeholder", o.placeholder), m.displayElements.html.attr("placeholder", o.placeholder)), 
                o.taDisabled && (m.displayElements.text.attr("ta-readonly", "disabled"), m.displayElements.html.attr("ta-readonly", "disabled"), 
                m.disabled = m.$parent.$eval(o.taDisabled), m.$parent.$watch(o.taDisabled, function(a) {
                    m.disabled = a, m.disabled ? n.addClass(m.classes.disabled) : n.removeClass(m.classes.disabled);
                })), o.taPaste && (m._pasteHandler = function(a) {
                    return l(o.taPaste)(m.$parent, {
                        $html: a
                    });
                }, m.displayElements.text.attr("ta-paste", "_pasteHandler($html)")), b(m.displayElements.scrollWindow)(m), 
                b(m.displayElements.html)(m), m.updateTaBindtaTextElement = m["updateTaBindtaTextElement" + C], 
                m.updateTaBindtaHtmlElement = m["updateTaBindtaHtmlElement" + C], n.addClass("ta-root"), 
                m.displayElements.scrollWindow.addClass("ta-text ta-editor " + m.classes.textEditor), 
                m.displayElements.html.addClass("ta-html ta-editor " + m.classes.htmlEditor);
                var F = function(a, b) {
                    b !== h[0].queryCommandState(a) && h[0].execCommand(a, !1, null);
                }, G = m._actionRunning = !1;
                if (m.startAction = function() {
                    var b, c, d, e;
                    return m._actionRunning = !0, b = h[0].queryCommandState("bold"), c = h[0].queryCommandState("italic"), 
                    d = h[0].queryCommandState("underline"), e = h[0].queryCommandState("strikeThrough"), 
                    G = a.saveSelection(), F("bold", b), F("italic", c), F("underline", d), F("strikeThrough", e), 
                    function() {
                        G && a.restoreSelection(G);
                    };
                }, m.endAction = function() {
                    m._actionRunning = !1, G && (m.showHtml ? m.displayElements.html[0].focus() : m.displayElements.text[0].focus(), 
                    a.removeMarkers(G)), G = !1, m.updateSelectedStyles(), m.showHtml || m["updateTaBindtaTextElement" + C]();
                }, u = function(a) {
                    m.focussed = !0, n.addClass(m.classes.focussed), x.focus(), n.triggerHandler("focus"), 
                    m.updateSelectedStyles && !m._bUpdateSelectedStyles && c(function() {
                        m.updateSelectedStyles();
                    }, 0);
                }, m.displayElements.html.on("focus", u), m.displayElements.text.on("focus", u), 
                v = function(a) {
                    return m._actionRunning || h[0].activeElement === m.displayElements.html[0] || h[0].activeElement === m.displayElements.text[0] || (n.removeClass(m.classes.focussed), 
                    x.unfocus(), c(function() {
                        m._bUpdateSelectedStyles = !1, n.triggerHandler("blur"), m.focussed = !1;
                    }, 0)), a.preventDefault(), !1;
                }, m.displayElements.html.on("blur", v), m.displayElements.text.on("blur", v), m.displayElements.text.on("paste", function(a) {
                    n.triggerHandler("paste", a);
                }), m.queryFormatBlockState = function(a) {
                    return !m.showHtml && a.toLowerCase() === h[0].queryCommandValue("formatBlock").toLowerCase();
                }, m.queryCommandState = function(a) {
                    return m.showHtml ? "" : h[0].queryCommandState(a);
                }, m.switchView = function() {
                    m.showHtml = !m.showHtml, i.enabled(!1, m.displayElements.html), i.enabled(!1, m.displayElements.text), 
                    m.showHtml ? c(function() {
                        return i.enabled(!0, m.displayElements.html), i.enabled(!0, m.displayElements.text), 
                        m.displayElements.html[0].focus();
                    }, 100) : c(function() {
                        return i.enabled(!0, m.displayElements.html), i.enabled(!0, m.displayElements.text), 
                        m.displayElements.text[0].focus();
                    }, 100);
                }, o.ngModel) {
                    var H = !0;
                    p.$render = function() {
                        if (H) {
                            H = !1;
                            var a = m.$parent.$eval(o.ngModel);
                            null != a || !w || "" === w || p.$setViewValue(w);
                        }
                        m.displayElements.forminput.val(p.$viewValue), m.html = p.$viewValue || "";
                    }, n.attr("required") && (p.$validators.required = function(a, b) {
                        var c = a || b;
                        return !(!c || "" === c.trim());
                    });
                } else m.displayElements.forminput.val(w), m.html = w;
                if (m.$watch("html", function(a, b) {
                    a !== b && (o.ngModel && p.$viewValue !== a && p.$setViewValue(a), m.displayElements.forminput.val(a));
                }), o.taTargetToolbars) x = g.registerEditor(m._name, m, o.taTargetToolbars.split(",")); else {
                    var I = angular.element('<div text-angular-toolbar name="textAngularToolbar' + C + '">');
                    o.taToolbar && I.attr("ta-toolbar", o.taToolbar), o.taToolbarClass && I.attr("ta-toolbar-class", o.taToolbarClass), 
                    o.taToolbarGroupClass && I.attr("ta-toolbar-group-class", o.taToolbarGroupClass), 
                    o.taToolbarButtonClass && I.attr("ta-toolbar-button-class", o.taToolbarButtonClass), 
                    o.taToolbarActiveButtonClass && I.attr("ta-toolbar-active-button-class", o.taToolbarActiveButtonClass), 
                    o.taFocussedClass && I.attr("ta-focussed-class", o.taFocussedClass), n.prepend(I), 
                    b(I)(m.$parent), x = g.registerEditor(m._name, m, [ "textAngularToolbar" + C ]);
                }
                m.$on("$destroy", function() {
                    g.unregisterEditor(m._name), angular.element(window).off("blur"), angular.element(window).off("resize", m.handlePopoverEvents), 
                    angular.element(window).off("scroll", m.handlePopoverEvents);
                }), m.$on("ta-element-select", function(a, b) {
                    x.triggerElementSelect(a, b) && m["reApplyOnSelectorHandlerstaTextElement" + C]();
                }), m.$on("ta-drop-event", function(a, b, d, f) {
                    f && f.files && 0 < f.files.length ? (m.displayElements.text[0].focus(), e.setSelectionToElementEnd(d.target), 
                    angular.forEach(f.files, function(a) {
                        try {
                            k.when(m.fileDropHandler(a, m.wrapSelection) || m.fileDropHandler !== m.defaultFileDropHandler && k.when(m.defaultFileDropHandler(a, m.wrapSelection))).then(function() {
                                m["updateTaBindtaTextElement" + C]();
                            });
                        } catch (a) {
                            j.error(a);
                        }
                    }), d.preventDefault(), d.stopPropagation()) : c(function() {
                        m["updateTaBindtaTextElement" + C]();
                    }, 0);
                }), m._bUpdateSelectedStyles = !1, angular.element(window).on("blur", function() {
                    m._bUpdateSelectedStyles = !1, m.focussed = !1;
                }), m.updateSelectedStyles = function() {
                    var a;
                    A && c.cancel(A), void 0 !== (a = e.getSelectionElement()) && a.parentNode !== m.displayElements.text[0] ? x.updateSelectedStyles(angular.element(a)) : x.updateSelectedStyles(), 
                    m._bUpdateSelectedStyles && (A = c(m.updateSelectedStyles, 200));
                }, q = function() {
                    return m.focussed ? void (m._bUpdateSelectedStyles || (m._bUpdateSelectedStyles = !0, 
                    m.$apply(function() {
                        m.updateSelectedStyles();
                    }))) : void (m._bUpdateSelectedStyles = !1);
                }, m.displayElements.html.on("keydown", q), m.displayElements.text.on("keydown", q), 
                r = function() {
                    m._bUpdateSelectedStyles = !1;
                }, m.displayElements.html.on("keyup", r), m.displayElements.text.on("keyup", r), 
                s = function(a, b) {
                    if (e.getSelection) {
                        var c = e.getSelection();
                        e.getSelectionElement() && "a" === e.getSelectionElement().nodeName.toLowerCase() && (3 === c.start.element.nodeType && c.start.element.textContent.length === c.end.offset && e.setSelectionAfterElement(e.getSelectionElement()), 
                        3 === c.start.element.nodeType && 0 === c.start.offset && e.setSelectionBeforeElement(e.getSelectionElement()));
                    }
                    b && angular.extend(a, b), m.$apply(function() {
                        if (x.sendKeyCommand(a)) return m._bUpdateSelectedStyles || m.updateSelectedStyles(), 
                        a.preventDefault(), !1;
                    });
                }, m.displayElements.html.on("keypress", s), m.displayElements.text.on("keypress", s), 
                t = function() {
                    m._bUpdateSelectedStyles = !1, c(function() {
                        m.updateSelectedStyles();
                    }, 0);
                }, m.displayElements.html.on("mouseup", t), m.displayElements.text.on("mouseup", t);
            }
        };
    } ]), u.service("textAngularManager", [ "taToolExecuteAction", "taTools", "taRegisterTool", "$interval", "$rootScope", "$log", function(a, b, c, d, e, g) {
        var h, i = {}, j = {}, k = 0, l = function(a) {
            angular.forEach(j, function(b) {
                b.editorFunctions.updateSelectedStyles(a);
            });
        };
        e.$on("destroy", function() {
            h && (d.cancel(h), h = void 0);
        });
        var o = function() {
            50 < Math.abs(Date.now() - k) && (k = Date.now(), h = d(function() {
                l(), h = void 0;
            }, 50, 1));
        };
        return {
            registerEditor: function(c, d, e) {
                if (!c || "" === c) throw "textAngular Error: An editor requires a name";
                if (!d) throw "textAngular Error: An editor requires a scope";
                if (j[c]) throw 'textAngular Error: An Editor with name "' + c + '" already exists';
                return j[c] = {
                    scope: d,
                    toolbars: e,
                    toolbarScopes: [],
                    _registerToolbarScope: function(a) {
                        0 <= this.toolbars.indexOf(a.name) && this.toolbarScopes.push(a);
                    },
                    editorFunctions: {
                        disable: function() {
                            angular.forEach(j[c].toolbarScopes, function(a) {
                                a.disabled = !0;
                            });
                        },
                        enable: function() {
                            angular.forEach(j[c].toolbarScopes, function(a) {
                                a.disabled = !1;
                            });
                        },
                        focus: function() {
                            angular.forEach(j[c].toolbarScopes, function(a) {
                                a._parent = d, a.disabled = !1, a.focussed = !0;
                            }), d.focussed = !0;
                        },
                        unfocus: function() {
                            angular.forEach(j[c].toolbarScopes, function(a) {
                                a.disabled = !0, a.focussed = !1;
                            }), d.focussed = !1;
                        },
                        updateSelectedStyles: function(a) {
                            angular.forEach(j[c].toolbarScopes, function(b) {
                                angular.forEach(b.tools, function(c) {
                                    c.activeState && (b._parent = d, c.active = c.activeState(a));
                                });
                            });
                        },
                        sendKeyCommand: function(e) {
                            var f = !1;
                            return (e.ctrlKey || e.metaKey || e.specialKey) && angular.forEach(b, function(b, g) {
                                if (b.commandKeyCode && (b.commandKeyCode === e.which || b.commandKeyCode === e.specialKey)) for (var h = 0; h < j[c].toolbarScopes.length; h++) if (void 0 !== j[c].toolbarScopes[h].tools[g]) {
                                    a.call(j[c].toolbarScopes[h].tools[g], d), f = !0;
                                    break;
                                }
                            }), f;
                        },
                        triggerElementSelect: function(a, e) {
                            var f = function(a, b) {
                                for (var c = !0, d = 0; d < b.length; d++) c = c && a.attr(b[d]);
                                return c;
                            }, g = [], h = {}, i = !1;
                            e = angular.element(e);
                            var k = !1;
                            if (angular.forEach(b, function(a, b) {
                                a.onElementSelect && a.onElementSelect.element && a.onElementSelect.element.toLowerCase() === e[0].tagName.toLowerCase() && (!a.onElementSelect.filter || a.onElementSelect.filter(e)) && (k = k || angular.isArray(a.onElementSelect.onlyWithAttrs) && f(e, a.onElementSelect.onlyWithAttrs), 
                                a.onElementSelect.onlyWithAttrs && !f(e, a.onElementSelect.onlyWithAttrs) || (h[b] = a));
                            }), k ? (angular.forEach(h, function(a, b) {
                                a.onElementSelect.onlyWithAttrs && f(e, a.onElementSelect.onlyWithAttrs) && g.push({
                                    name: b,
                                    tool: a
                                });
                            }), g.sort(function(a, b) {
                                return b.tool.onElementSelect.onlyWithAttrs.length - a.tool.onElementSelect.onlyWithAttrs.length;
                            })) : angular.forEach(h, function(a, b) {
                                g.push({
                                    name: b,
                                    tool: a
                                });
                            }), 0 < g.length) for (var l = 0; l < g.length; l++) {
                                for (var m = g[l].tool, n = g[l].name, o = 0; o < j[c].toolbarScopes.length; o++) if (void 0 !== j[c].toolbarScopes[o].tools[n]) {
                                    m.onElementSelect.action.call(j[c].toolbarScopes[o].tools[n], a, e, d), i = !0;
                                    break;
                                }
                                if (i) break;
                            }
                            return i;
                        }
                    }
                }, angular.forEach(e, function(a) {
                    i[a] && j[c].toolbarScopes.push(i[a]);
                }), o(), j[c].editorFunctions;
            },
            retrieveEditor: function(a) {
                return j[a];
            },
            unregisterEditor: function(a) {
                delete j[a], o();
            },
            registerToolbar: function(a) {
                if (!a) throw "textAngular Error: A toolbar requires a scope";
                if (!a.name || "" === a.name) throw "textAngular Error: A toolbar requires a name";
                if (i[a.name]) throw 'textAngular Error: A toolbar with name "' + a.name + '" already exists';
                i[a.name] = a, angular.forEach(j, function(b) {
                    b._registerToolbarScope(a);
                }), o();
            },
            retrieveToolbar: function(a) {
                return i[a];
            },
            retrieveToolbarsViaEditor: function(a) {
                var b = [], c = this;
                return angular.forEach(this.retrieveEditor(a).toolbars, function(a) {
                    b.push(c.retrieveToolbar(a));
                }), b;
            },
            unregisterToolbar: function(a) {
                delete i[a], o();
            },
            updateToolsDisplay: function(a) {
                var b = this;
                angular.forEach(a, function(a, c) {
                    b.updateToolDisplay(c, a);
                });
            },
            resetToolsDisplay: function() {
                var a = this;
                angular.forEach(b, function(b, c) {
                    a.resetToolDisplay(c);
                }), o();
            },
            updateToolDisplay: function(a, b) {
                var c = this;
                angular.forEach(i, function(d, e) {
                    c.updateToolbarToolDisplay(e, a, b);
                }), o();
            },
            resetToolDisplay: function(a) {
                var b = this;
                angular.forEach(i, function(c, d) {
                    b.resetToolbarToolDisplay(d, a);
                }), o();
            },
            updateToolbarToolDisplay: function(a, b, c) {
                if (!i[a]) throw 'textAngular Error: No Toolbar with name "' + a + '" exists';
                i[a].updateToolDisplay(b, c);
            },
            resetToolbarToolDisplay: function(a, c) {
                if (!i[a]) throw 'textAngular Error: No Toolbar with name "' + a + '" exists';
                i[a].updateToolDisplay(c, b[c], !0);
            },
            removeTool: function(a) {
                delete b[a], angular.forEach(i, function(b) {
                    delete b.tools[a];
                    for (var c = 0; c < b.toolbar.length; c++) {
                        for (var d, e = 0; e < b.toolbar[c].length; e++) {
                            if (b.toolbar[c][e] === a) {
                                d = {
                                    group: c,
                                    index: e
                                };
                                break;
                            }
                            if (void 0 !== d) break;
                        }
                        void 0 !== d && (b.toolbar[d.group].slice(d.index, 1), b._$element.children().eq(d.group).children().eq(d.index).remove());
                    }
                }), o();
            },
            addTool: function(a, b, d, e) {
                c(a, b), angular.forEach(i, function(c) {
                    c.addTool(a, b, d, e);
                }), o();
            },
            addToolToToolbar: function(a, b, d, e, f) {
                c(a, b), i[d].addTool(a, b, e, f), o();
            },
            refreshEditor: function(a) {
                if (!j[a]) throw 'textAngular Error: No Editor with name "' + a + '" exists';
                j[a].scope.updateTaBindtaTextElement(), j[a].scope.$$phase || j[a].scope.$digest(), 
                o();
            },
            sendKeyCommand: function(a, b) {
                var c = j[a._name];
                if (c && c.editorFunctions.sendKeyCommand(b)) return a._bUpdateSelectedStyles || a.updateSelectedStyles(), 
                b.preventDefault(), !1;
            },
            updateStyles: l,
            getVersion: function() {
                return "v1.5.16";
            },
            getToolbarScopes: function() {
                var a = [];
                return angular.forEach(j, function(b) {
                    a = a.concat(b.toolbarScopes);
                }), a;
            }
        };
    } ]), u.directive("textAngularToolbar", [ "$compile", "textAngularManager", "taOptions", "taTools", "taToolExecuteAction", "$window", function(a, b, c, d, e, f) {
        return {
            scope: {
                name: "@"
            },
            restrict: "EA",
            link: function(g, h, i) {
                if (!g.name || "" === g.name) throw "textAngular Error: A toolbar requires a name";
                angular.extend(g, angular.copy(c)), i.taToolbar && (g.toolbar = g.$parent.$eval(i.taToolbar)), 
                i.taToolbarClass && (g.classes.toolbar = i.taToolbarClass), i.taToolbarGroupClass && (g.classes.toolbarGroup = i.taToolbarGroupClass), 
                i.taToolbarButtonClass && (g.classes.toolbarButton = i.taToolbarButtonClass), i.taToolbarActiveButtonClass && (g.classes.toolbarButtonActive = i.taToolbarActiveButtonClass), 
                i.taFocussedClass && (g.classes.focussed = i.taFocussedClass), g.disabled = !0, 
                g.focussed = !1, (g._$element = h)[0].innerHTML = "", h.addClass("ta-toolbar " + g.classes.toolbar), 
                g.$watch("focussed", function() {
                    g.focussed ? h.addClass(g.classes.focussed) : h.removeClass(g.classes.focussed);
                });
                var j = function(b, c) {
                    var d;
                    if (d = b && b.display ? angular.element(b.display) : angular.element("<button type='button'>"), 
                    b && b.class ? d.addClass(b.class) : d.addClass(g.classes.toolbarButton), d.attr("name", c.name), 
                    d.attr("ta-button", "ta-button"), d.attr("ng-disabled", "isDisabled()"), d.attr("tabindex", "-1"), 
                    d.attr("ng-click", "executeAction()"), d.attr("ng-class", "displayActiveToolClass(active)"), 
                    b && b.tooltiptext && d.attr("title", b.tooltiptext), b && !b.display && !c._display && (d[0].innerHTML = "", 
                    b.buttontext && (d[0].innerHTML = b.buttontext), b.iconclass)) {
                        var e = angular.element("<i>"), f = d[0].innerHTML;
                        e.addClass(b.iconclass), d[0].innerHTML = "", d.append(e), f && "" !== f && d.append("&nbsp;" + f);
                    }
                    return c._lastToolDefinition = angular.copy(b), a(d)(c);
                };
                g.tools = {}, g._parent = {
                    disabled: !0,
                    showHtml: !1,
                    queryFormatBlockState: function() {
                        return !1;
                    },
                    queryCommandState: function() {
                        return !1;
                    }
                };
                var k = {
                    $window: f,
                    $editor: function() {
                        return g._parent;
                    },
                    isDisabled: function() {
                        return ("html" !== this.name || !g._parent.startAction) && ("function" != typeof this.$eval("disabled") && this.$eval("disabled") || this.$eval("disabled()") || "html" !== this.name && this.$editor().showHtml || this.$parent.disabled || this.$editor().disabled);
                    },
                    displayActiveToolClass: function(a) {
                        return a ? g.classes.toolbarButtonActive : "";
                    },
                    executeAction: e
                };
                angular.forEach(g.toolbar, function(a) {
                    var b = angular.element("<div>");
                    b.addClass(g.classes.toolbarGroup), angular.forEach(a, function(a) {
                        g.tools[a] = angular.extend(g.$new(!0), d[a], k, {
                            name: a
                        }), g.tools[a].$element = j(d[a], g.tools[a]), b.append(g.tools[a].$element);
                    }), h.append(b);
                }), g.updateToolDisplay = function(a, b, c) {
                    var d = g.tools[a];
                    if (d) {
                        if (d._lastToolDefinition && !c && (b = angular.extend({}, d._lastToolDefinition, b)), 
                        null === b.buttontext && null === b.iconclass && null === b.display) throw 'textAngular Error: Tool Definition for updating "' + a + '" does not have a valid display/iconclass/buttontext value';
                        null === b.buttontext && delete b.buttontext, null === b.iconclass && delete b.iconclass, 
                        null === b.display && delete b.display;
                        var e = j(b, d);
                        d.$element.replaceWith(e), d.$element = e;
                    }
                }, g.addTool = function(a, b, c, e) {
                    var f;
                    g.tools[a] = angular.extend(g.$new(!0), d[a], k, {
                        name: a
                    }), g.tools[a].$element = j(d[a], g.tools[a]), void 0 === c && (c = g.toolbar.length - 1), 
                    f = angular.element(h.children()[c]), void 0 === e ? (f.append(g.tools[a].$element), 
                    g.toolbar[c][g.toolbar[c].length - 1] = a) : (f.children().eq(e).after(g.tools[a].$element), 
                    g.toolbar[c][e] = a);
                }, b.registerToolbar(g), g.$on("$destroy", function() {
                    b.unregisterToolbar(g.name);
                });
            }
        };
    } ]), u.directive("textAngularVersion", [ "textAngularManager", function(a) {
        var b = a.getVersion();
        return {
            restrict: "EA",
            link: function(a, c, d) {
                c.html(b);
            }
        };
    } ]), u.name;
}), function() {
    "use strict";
    var KEYS_backspace = 8, KEYS_tab = 9, KEYS_enter = 13, KEYS_escape = 27, KEYS_space = 32, KEYS_up = 38, KEYS_down = 40, KEYS_left = 37, KEYS_right = 39, KEYS_delete = 46, KEYS_comma = 188, SUPPORTED_INPUT_TYPES = [ "text", "email", "url" ], tagsInput = angular.module("ngTagsInput", []);
    tagsInput.directive("tagsInput", [ "$timeout", "$document", "$window", "$q", "tagsInputConfig", "tiUtil", function($timeout, $document, $window, $q, tagsInputConfig, tiUtil) {
        function TagList(options, events, onTagAdding, onTagRemoving) {
            var getTagText, setTagText, canAddTag, canRemoveTag, self = {};
            return getTagText = function(tag) {
                return tiUtil.safeToString(tag[options.displayProperty]);
            }, setTagText = function(tag, text) {
                tag[options.displayProperty] = text;
            }, canAddTag = function(tag) {
                var tagText = getTagText(tag), valid = tagText && tagText.length >= options.minLength && tagText.length <= options.maxLength && options.allowedTagsPattern.test(tagText) && !tiUtil.findInObjectArray(self.items, tag, options.keyProperty || options.displayProperty);
                return $q.when(valid && onTagAdding({
                    $tag: tag
                })).then(tiUtil.promisifyValue);
            }, canRemoveTag = function(tag) {
                return $q.when(onTagRemoving({
                    $tag: tag
                })).then(tiUtil.promisifyValue);
            }, self.items = [], self.addText = function(text) {
                var tag = {};
                return setTagText(tag, text), self.add(tag);
            }, self.add = function(tag) {
                var tagText = getTagText(tag);
                return options.replaceSpacesWithDashes && (tagText = tiUtil.replaceSpacesWithDashes(tagText)), 
                setTagText(tag, tagText), canAddTag(tag).then(function() {
                    self.items.push(tag), events.trigger("tag-added", {
                        $tag: tag
                    });
                }).catch(function() {
                    tagText && events.trigger("invalid-tag", {
                        $tag: tag
                    });
                });
            }, self.remove = function(index) {
                var tag = self.items[index];
                return canRemoveTag(tag).then(function() {
                    return self.items.splice(index, 1), self.clearSelection(), events.trigger("tag-removed", {
                        $tag: tag
                    }), tag;
                });
            }, self.select = function(index) {
                index < 0 ? index = self.items.length - 1 : index >= self.items.length && (index = 0), 
                self.index = index, self.selected = self.items[index];
            }, self.selectPrior = function() {
                self.select(--self.index);
            }, self.selectNext = function() {
                self.select(++self.index);
            }, self.removeSelected = function() {
                return self.remove(self.index);
            }, self.clearSelection = function() {
                self.selected = null, self.index = -1;
            }, self.getItems = function() {
                return options.useStrings ? self.items.map(getTagText) : self.items;
            }, self.clearSelection(), self;
        }
        function validateType(type) {
            return -1 !== SUPPORTED_INPUT_TYPES.indexOf(type);
        }
        return {
            restrict: "E",
            require: "ngModel",
            scope: {
                tags: "=ngModel",
                text: "=?",
                templateScope: "=?",
                tagClass: "&",
                onTagAdding: "&",
                onTagAdded: "&",
                onInvalidTag: "&",
                onTagRemoving: "&",
                onTagRemoved: "&",
                onTagClicked: "&"
            },
            replace: !1,
            transclude: !0,
            templateUrl: "ngTagsInput/tags-input.html",
            controller: [ "$scope", "$attrs", "$element", function($scope, $attrs, $element) {
                $scope.events = tiUtil.simplePubSub(), tagsInputConfig.load("tagsInput", $scope, $attrs, {
                    template: [ String, "ngTagsInput/tag-item.html" ],
                    type: [ String, "text", validateType ],
                    placeholder: [ String, "Add a tag" ],
                    tabindex: [ Number, null ],
                    removeTagSymbol: [ String, String.fromCharCode(215) ],
                    replaceSpacesWithDashes: [ Boolean, !0 ],
                    minLength: [ Number, 3 ],
                    maxLength: [ Number, 9007199254740991 ],
                    addOnEnter: [ Boolean, !0 ],
                    addOnSpace: [ Boolean, !1 ],
                    addOnComma: [ Boolean, !0 ],
                    addOnBlur: [ Boolean, !0 ],
                    addOnPaste: [ Boolean, !1 ],
                    pasteSplitPattern: [ RegExp, /,/ ],
                    allowedTagsPattern: [ RegExp, /.+/ ],
                    enableEditingLastTag: [ Boolean, !1 ],
                    minTags: [ Number, 0 ],
                    maxTags: [ Number, 9007199254740991 ],
                    displayProperty: [ String, "text" ],
                    keyProperty: [ String, "" ],
                    allowLeftoverText: [ Boolean, !1 ],
                    addFromAutocompleteOnly: [ Boolean, !1 ],
                    spellcheck: [ Boolean, !0 ],
                    useStrings: [ Boolean, !1 ]
                }), $scope.tagList = new TagList($scope.options, $scope.events, tiUtil.handleUndefinedResult($scope.onTagAdding, !0), tiUtil.handleUndefinedResult($scope.onTagRemoving, !0)), 
                this.registerAutocomplete = function() {
                    $element.find("input");
                    return {
                        addTag: function(tag) {
                            return $scope.tagList.add(tag);
                        },
                        getTags: function() {
                            return $scope.tagList.items;
                        },
                        getCurrentTagText: function() {
                            return $scope.newTag.text();
                        },
                        getOptions: function() {
                            return $scope.options;
                        },
                        getTemplateScope: function() {
                            return $scope.templateScope;
                        },
                        on: function(name, handler) {
                            return $scope.events.on(name, handler, !0), this;
                        }
                    };
                }, this.registerTagItem = function() {
                    return {
                        getOptions: function() {
                            return $scope.options;
                        },
                        removeTag: function(index) {
                            $scope.disabled || $scope.tagList.remove(index);
                        }
                    };
                };
            } ],
            link: function(scope, element, attrs, ngModelCtrl) {
                var setElementValidity, focusInput, hotkeys = [ KEYS_enter, KEYS_comma, KEYS_space, KEYS_backspace, KEYS_delete, KEYS_left, KEYS_right ], tagList = scope.tagList, events = scope.events, options = scope.options, input = element.find("input"), validationOptions = [ "minTags", "maxTags", "allowLeftoverText" ];
                setElementValidity = function() {
                    ngModelCtrl.$setValidity("maxTags", tagList.items.length <= options.maxTags), ngModelCtrl.$setValidity("minTags", tagList.items.length >= options.minTags), 
                    ngModelCtrl.$setValidity("leftoverText", !(!scope.hasFocus && !options.allowLeftoverText) || !scope.newTag.text());
                }, focusInput = function() {
                    $timeout(function() {
                        input[0].focus();
                    });
                }, ngModelCtrl.$isEmpty = function(value) {
                    return !value || !value.length;
                }, scope.newTag = {
                    text: function(value) {
                        if (!angular.isDefined(value)) return scope.text || "";
                        scope.text = value, events.trigger("input-change", value);
                    },
                    invalid: null
                }, scope.track = function(tag) {
                    return tag[options.keyProperty || options.displayProperty];
                }, scope.getTagClass = function(tag, index) {
                    var selected = tag === tagList.selected;
                    return [ scope.tagClass({
                        $tag: tag,
                        $index: index,
                        $selected: selected
                    }), {
                        selected: selected
                    } ];
                }, scope.$watch("tags", function(value) {
                    if (value) {
                        if (tagList.items = tiUtil.makeObjectArray(value, options.displayProperty), options.useStrings) return;
                        scope.tags = tagList.items;
                    } else tagList.items = [];
                }), scope.$watch("tags.length", function() {
                    setElementValidity(), ngModelCtrl.$validate();
                }), attrs.$observe("disabled", function(value) {
                    scope.disabled = value;
                }), scope.eventHandlers = {
                    input: {
                        keydown: function($event) {
                            events.trigger("input-keydown", $event);
                        },
                        focus: function() {
                            scope.hasFocus || (scope.hasFocus = !0, events.trigger("input-focus"));
                        },
                        blur: function() {
                            $timeout(function() {
                                var activeElement = $document.prop("activeElement"), lostFocusToBrowserWindow = activeElement === input[0], lostFocusToChildElement = element[0].contains(activeElement);
                                !lostFocusToBrowserWindow && lostFocusToChildElement || (scope.hasFocus = !1, events.trigger("input-blur"));
                            });
                        },
                        paste: function($event) {
                            $event.getTextData = function() {
                                var clipboardData = $event.clipboardData || $event.originalEvent && $event.originalEvent.clipboardData;
                                return clipboardData ? clipboardData.getData("text/plain") : $window.clipboardData.getData("Text");
                            }, events.trigger("input-paste", $event);
                        }
                    },
                    host: {
                        click: function() {
                            scope.disabled || focusInput();
                        }
                    },
                    tag: {
                        click: function(tag) {
                            events.trigger("tag-clicked", {
                                $tag: tag
                            });
                        }
                    }
                }, events.on("tag-added", scope.onTagAdded).on("invalid-tag", scope.onInvalidTag).on("tag-removed", scope.onTagRemoved).on("tag-clicked", scope.onTagClicked).on("tag-added", function() {
                    scope.newTag.text("");
                }).on("tag-added tag-removed", function() {
                    scope.tags = tagList.getItems(), ngModelCtrl.$setDirty(), focusInput();
                }).on("invalid-tag", function() {
                    scope.newTag.invalid = !0;
                }).on("option-change", function(e) {
                    -1 !== validationOptions.indexOf(e.name) && setElementValidity();
                }).on("input-change", function() {
                    tagList.clearSelection(), scope.newTag.invalid = null;
                }).on("input-focus", function() {
                    element.triggerHandler("focus"), ngModelCtrl.$setValidity("leftoverText", !0);
                }).on("input-blur", function() {
                    options.addOnBlur && !options.addFromAutocompleteOnly && tagList.addText(scope.newTag.text()), 
                    element.triggerHandler("blur"), setElementValidity();
                }).on("input-keydown", function(event) {
                    var shouldAdd, shouldRemove, shouldSelect, shouldEditLastTag, key = event.keyCode, addKeys = {};
                    tiUtil.isModifierOn(event) || -1 === hotkeys.indexOf(key) || (addKeys[KEYS_enter] = options.addOnEnter, 
                    addKeys[KEYS_comma] = options.addOnComma, addKeys[KEYS_space] = options.addOnSpace, 
                    shouldAdd = !options.addFromAutocompleteOnly && addKeys[key], shouldRemove = (key === KEYS_backspace || key === KEYS_delete) && tagList.selected, 
                    shouldEditLastTag = key === KEYS_backspace && 0 === scope.newTag.text().length && options.enableEditingLastTag, 
                    shouldSelect = (key === KEYS_backspace || key === KEYS_left || key === KEYS_right) && 0 === scope.newTag.text().length && !options.enableEditingLastTag, 
                    shouldAdd ? tagList.addText(scope.newTag.text()) : shouldEditLastTag ? (tagList.selectPrior(), 
                    tagList.removeSelected().then(function(tag) {
                        tag && scope.newTag.text(tag[options.displayProperty]);
                    })) : shouldRemove ? tagList.removeSelected() : shouldSelect && (key === KEYS_left || key === KEYS_backspace ? tagList.selectPrior() : key === KEYS_right && tagList.selectNext()), 
                    (shouldAdd || shouldSelect || shouldRemove || shouldEditLastTag) && event.preventDefault());
                }).on("input-paste", function(event) {
                    if (options.addOnPaste) {
                        var tags = event.getTextData().split(options.pasteSplitPattern);
                        1 < tags.length && (tags.forEach(function(tag) {
                            tagList.addText(tag);
                        }), event.preventDefault());
                    }
                });
            }
        };
    } ]), tagsInput.directive("tiTagItem", [ "tiUtil", function(tiUtil) {
        return {
            restrict: "E",
            require: "^tagsInput",
            template: '<ng-include src="$$template"></ng-include>',
            scope: {
                $scope: "=scope",
                data: "="
            },
            link: function(scope, element, attrs, tagsInputCtrl) {
                var tagsInput = tagsInputCtrl.registerTagItem(), options = tagsInput.getOptions();
                scope.$$template = options.template, scope.$$removeTagSymbol = options.removeTagSymbol, 
                scope.$getDisplayText = function() {
                    return tiUtil.safeToString(scope.data[options.displayProperty]);
                }, scope.$removeTag = function() {
                    tagsInput.removeTag(scope.$index);
                }, scope.$watch("$parent.$index", function(value) {
                    scope.$index = value;
                });
            }
        };
    } ]), tagsInput.directive("autoComplete", [ "$document", "$timeout", "$sce", "$q", "tagsInputConfig", "tiUtil", function($document, $timeout, $sce, $q, tagsInputConfig, tiUtil) {
        function SuggestionList(loadFn, options, events) {
            var getDifference, lastPromise, getTagId, self = {};
            return getTagId = function() {
                return options.tagsInput.keyProperty || options.tagsInput.displayProperty;
            }, getDifference = function(array1, array2) {
                return array1.filter(function(item) {
                    return !tiUtil.findInObjectArray(array2, item, getTagId(), function(a, b) {
                        return options.tagsInput.replaceSpacesWithDashes && (a = tiUtil.replaceSpacesWithDashes(a), 
                        b = tiUtil.replaceSpacesWithDashes(b)), tiUtil.defaultComparer(a, b);
                    });
                });
            }, self.reset = function() {
                lastPromise = null, self.items = [], self.visible = !1, self.index = -1, self.selected = null, 
                self.query = null;
            }, self.show = function() {
                options.selectFirstMatch ? self.select(0) : self.selected = null, self.visible = !0;
            }, self.load = tiUtil.debounce(function(query, tags) {
                self.query = query;
                var promise = $q.when(loadFn({
                    $query: query
                }));
                (lastPromise = promise).then(function(items) {
                    promise === lastPromise && (items = tiUtil.makeObjectArray(items.data || items, getTagId()), 
                    items = getDifference(items, tags), self.items = items.slice(0, options.maxResultsToShow), 
                    0 < self.items.length ? self.show() : self.reset());
                });
            }, options.debounceDelay), self.selectNext = function() {
                self.select(++self.index);
            }, self.selectPrior = function() {
                self.select(--self.index);
            }, self.select = function(index) {
                index < 0 ? index = self.items.length - 1 : index >= self.items.length && (index = 0), 
                self.index = index, self.selected = self.items[index], events.trigger("suggestion-selected", index);
            }, self.reset(), self;
        }
        return {
            restrict: "E",
            require: "^tagsInput",
            scope: {
                source: "&",
                matchClass: "&"
            },
            templateUrl: "ngTagsInput/auto-complete.html",
            controller: [ "$scope", "$element", "$attrs", function($scope, $element, $attrs) {
                $scope.events = tiUtil.simplePubSub(), tagsInputConfig.load("autoComplete", $scope, $attrs, {
                    template: [ String, "ngTagsInput/auto-complete-match.html" ],
                    debounceDelay: [ Number, 100 ],
                    minLength: [ Number, 3 ],
                    highlightMatchedText: [ Boolean, !0 ],
                    maxResultsToShow: [ Number, 10 ],
                    loadOnDownArrow: [ Boolean, !1 ],
                    loadOnEmpty: [ Boolean, !1 ],
                    loadOnFocus: [ Boolean, !1 ],
                    selectFirstMatch: [ Boolean, !0 ],
                    displayProperty: [ String, "" ]
                }), $scope.suggestionList = new SuggestionList($scope.source, $scope.options, $scope.events), 
                this.registerAutocompleteMatch = function() {
                    return {
                        getOptions: function() {
                            return $scope.options;
                        },
                        getQuery: function() {
                            return $scope.suggestionList.query;
                        }
                    };
                };
            } ],
            link: function(scope, element, attrs, tagsInputCtrl) {
                var shouldLoadSuggestions, hotkeys = [ KEYS_enter, KEYS_tab, KEYS_escape, KEYS_up, KEYS_down ], suggestionList = scope.suggestionList, tagsInput = tagsInputCtrl.registerAutocomplete(), options = scope.options, events = scope.events;
                options.tagsInput = tagsInput.getOptions(), shouldLoadSuggestions = function(value) {
                    return value && value.length >= options.minLength || !value && options.loadOnEmpty;
                }, scope.templateScope = tagsInput.getTemplateScope(), scope.addSuggestionByIndex = function(index) {
                    suggestionList.select(index), scope.addSuggestion();
                }, scope.addSuggestion = function() {
                    var added = !1;
                    return suggestionList.selected && (tagsInput.addTag(angular.copy(suggestionList.selected)), 
                    suggestionList.reset(), added = !0), added;
                }, scope.track = function(item) {
                    return item[options.tagsInput.keyProperty || options.tagsInput.displayProperty];
                }, scope.getSuggestionClass = function(item, index) {
                    var selected = item === suggestionList.selected;
                    return [ scope.matchClass({
                        $match: item,
                        $index: index,
                        $selected: selected
                    }), {
                        selected: selected
                    } ];
                }, tagsInput.on("tag-added tag-removed invalid-tag input-blur", function() {
                    suggestionList.reset();
                }).on("input-change", function(value) {
                    shouldLoadSuggestions(value) ? suggestionList.load(value, tagsInput.getTags()) : suggestionList.reset();
                }).on("input-focus", function() {
                    var value = tagsInput.getCurrentTagText();
                    options.loadOnFocus && shouldLoadSuggestions(value) && suggestionList.load(value, tagsInput.getTags());
                }).on("input-keydown", function(event) {
                    var key = event.keyCode, handled = !1;
                    if (!tiUtil.isModifierOn(event) && -1 !== hotkeys.indexOf(key)) return suggestionList.visible ? key === KEYS_down ? (suggestionList.selectNext(), 
                    handled = !0) : key === KEYS_up ? (suggestionList.selectPrior(), handled = !0) : key === KEYS_escape ? (suggestionList.reset(), 
                    handled = !0) : key !== KEYS_enter && key !== KEYS_tab || (handled = scope.addSuggestion()) : key === KEYS_down && scope.options.loadOnDownArrow && (suggestionList.load(tagsInput.getCurrentTagText(), tagsInput.getTags()), 
                    handled = !0), handled ? (event.preventDefault(), event.stopImmediatePropagation(), 
                    !1) : void 0;
                }), events.on("suggestion-selected", function(index) {
                    !function(root, index) {
                        var element = root.find("li").eq(index), parent = element.parent(), elementTop = element.prop("offsetTop"), elementHeight = element.prop("offsetHeight"), parentHeight = parent.prop("clientHeight"), parentScrollTop = parent.prop("scrollTop");
                        elementTop < parentScrollTop ? parent.prop("scrollTop", elementTop) : parentHeight + parentScrollTop < elementTop + elementHeight && parent.prop("scrollTop", elementTop + elementHeight - parentHeight);
                    }(element, index);
                });
            }
        };
    } ]), tagsInput.directive("tiAutocompleteMatch", [ "$sce", "tiUtil", function($sce, tiUtil) {
        return {
            restrict: "E",
            require: "^autoComplete",
            template: '<ng-include src="$$template"></ng-include>',
            scope: {
                $scope: "=scope",
                data: "="
            },
            link: function(scope, element, attrs, autoCompleteCtrl) {
                var autoComplete = autoCompleteCtrl.registerAutocompleteMatch(), options = autoComplete.getOptions();
                scope.$$template = options.template, scope.$index = scope.$parent.$index, scope.$highlight = function(text) {
                    return options.highlightMatchedText && (text = tiUtil.safeHighlight(text, autoComplete.getQuery())), 
                    $sce.trustAsHtml(text);
                }, scope.$getDisplayText = function() {
                    return tiUtil.safeToString(scope.data[options.displayProperty || options.tagsInput.displayProperty]);
                };
            }
        };
    } ]), tagsInput.directive("tiTranscludeAppend", function() {
        return function(scope, element, attrs, ctrl, transcludeFn) {
            transcludeFn(function(clone) {
                element.append(clone);
            });
        };
    }), tagsInput.directive("tiAutosize", [ "tagsInputConfig", function(tagsInputConfig) {
        return {
            restrict: "A",
            require: "ngModel",
            link: function(scope, element, attrs, ctrl) {
                var span, resize, threshold = tagsInputConfig.getTextAutosizeThreshold();
                (span = angular.element('<span class="input"></span>')).css("display", "none").css("visibility", "hidden").css("width", "auto").css("white-space", "pre"), 
                element.parent().append(span), resize = function(originalValue) {
                    var width, value = originalValue;
                    return angular.isString(value) && 0 === value.length && (value = attrs.placeholder), 
                    value && (span.text(value), span.css("display", ""), width = span.prop("offsetWidth"), 
                    span.css("display", "none")), element.css("width", width ? width + threshold + "px" : ""), 
                    originalValue;
                }, ctrl.$parsers.unshift(resize), ctrl.$formatters.unshift(resize), attrs.$observe("placeholder", function(value) {
                    ctrl.$modelValue || resize(value);
                });
            }
        };
    } ]), tagsInput.directive("tiBindAttrs", function() {
        return function(scope, element, attrs) {
            scope.$watch(attrs.tiBindAttrs, function(value) {
                angular.forEach(value, function(value, key) {
                    attrs.$set(key, value);
                });
            }, !0);
        };
    }), tagsInput.provider("tagsInputConfig", function() {
        var globalDefaults = {}, interpolationStatus = {}, autosizeThreshold = 3;
        this.setDefaults = function(directive, defaults) {
            return globalDefaults[directive] = defaults, this;
        }, this.setActiveInterpolation = function(directive, options) {
            return interpolationStatus[directive] = options, this;
        }, this.setTextAutosizeThreshold = function(threshold) {
            return autosizeThreshold = threshold, this;
        }, this.$get = [ "$interpolate", function($interpolate) {
            var converters = {};
            return converters[String] = function(value) {
                return value;
            }, converters[Number] = function(value) {
                return parseInt(value, 10);
            }, converters[Boolean] = function(value) {
                return "true" === value.toLowerCase();
            }, converters[RegExp] = function(value) {
                return new RegExp(value);
            }, {
                load: function(directive, scope, attrs, options) {
                    var defaultValidator = function() {
                        return !0;
                    };
                    scope.options = {}, angular.forEach(options, function(value, key) {
                        var type, localDefault, validator, converter, getDefault, updateValue;
                        type = value[0], localDefault = value[1], validator = value[2] || defaultValidator, 
                        converter = converters[type], getDefault = function() {
                            var globalValue = globalDefaults[directive] && globalDefaults[directive][key];
                            return angular.isDefined(globalValue) ? globalValue : localDefault;
                        }, updateValue = function(value) {
                            scope.options[key] = value && validator(value) ? converter(value) : getDefault();
                        }, interpolationStatus[directive] && interpolationStatus[directive][key] ? attrs.$observe(key, function(value) {
                            updateValue(value), scope.events.trigger("option-change", {
                                name: key,
                                newValue: value
                            });
                        }) : updateValue(attrs[key] && $interpolate(attrs[key])(scope.$parent));
                    });
                },
                getTextAutosizeThreshold: function() {
                    return autosizeThreshold;
                }
            };
        } ];
    }), tagsInput.factory("tiUtil", [ "$timeout", "$q", function($timeout, $q) {
        var self = {
            debounce: function(fn, delay) {
                var timeoutId;
                return function() {
                    var args = arguments;
                    $timeout.cancel(timeoutId), timeoutId = $timeout(function() {
                        fn.apply(null, args);
                    }, delay);
                };
            },
            makeObjectArray: function(array, key) {
                if (!angular.isArray(array) || 0 === array.length || angular.isObject(array[0])) return array;
                var newArray = [];
                return array.forEach(function(item) {
                    var obj = {};
                    obj[key] = item, newArray.push(obj);
                }), newArray;
            },
            findInObjectArray: function(array, obj, key, comparer) {
                var item = null;
                return comparer = comparer || self.defaultComparer, array.some(function(element) {
                    if (comparer(element[key], obj[key])) return item = element, !0;
                }), item;
            },
            defaultComparer: function(a, b) {
                return self.safeToString(a).toLowerCase() === self.safeToString(b).toLowerCase();
            },
            safeHighlight: function(str, value) {
                if (str = self.encodeHTML(str), !(value = self.encodeHTML(value))) return str;
                var expression = new RegExp("&[^;]+;|" + function(str) {
                    return str.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1");
                }(value), "gi");
                return str.replace(expression, function(match) {
                    return match.toLowerCase() === value.toLowerCase() ? "<em>" + match + "</em>" : match;
                });
            },
            safeToString: function(value) {
                return angular.isUndefined(value) || null == value ? "" : value.toString().trim();
            },
            encodeHTML: function(value) {
                return self.safeToString(value).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
            },
            handleUndefinedResult: function(fn, valueIfUndefined) {
                return function() {
                    var result = fn.apply(null, arguments);
                    return angular.isUndefined(result) ? valueIfUndefined : result;
                };
            },
            replaceSpacesWithDashes: function(str) {
                return self.safeToString(str).replace(/\s/g, "-");
            },
            isModifierOn: function(event) {
                return event.shiftKey || event.ctrlKey || event.altKey || event.metaKey;
            },
            promisifyValue: function(value) {
                return value = !!angular.isUndefined(value) || value, $q[value ? "when" : "reject"]();
            },
            simplePubSub: function() {
                var events = {};
                return {
                    on: function(names, handler, first) {
                        return names.split(" ").forEach(function(name) {
                            events[name] || (events[name] = []), (first ? [].unshift : [].push).call(events[name], handler);
                        }), this;
                    },
                    trigger: function(name, args) {
                        return (events[name] || []).every(function(handler) {
                            return self.handleUndefinedResult(handler, !0)(args);
                        }), this;
                    }
                };
            }
        };
        return self;
    } ]), tagsInput.run([ "$templateCache", function($templateCache) {
        $templateCache.put("ngTagsInput/tags-input.html", '<div class="host" tabindex="-1" ng-click="eventHandlers.host.click()" ti-transclude-append><div class="tags" ng-class="{focused: hasFocus}"><ul class="tag-list"><li class="tag-item" ng-repeat="tag in tagList.items track by track(tag)" ng-class="getTagClass(tag, $index)" ng-click="eventHandlers.tag.click(tag)"><ti-tag-item scope="templateScope" data="::tag"></ti-tag-item></li></ul><input class="input" autocomplete="off" ng-model="newTag.text" ng-model-options="{getterSetter: true}" ng-keydown="eventHandlers.input.keydown($event)" ng-focus="eventHandlers.input.focus($event)" ng-blur="eventHandlers.input.blur($event)" ng-paste="eventHandlers.input.paste($event)" ng-trim="false" ng-class="{\'invalid-tag\': newTag.invalid}" ng-disabled="disabled" ti-bind-attrs="{type: options.type, placeholder: options.placeholder, tabindex: options.tabindex, spellcheck: options.spellcheck}" ti-autosize></div></div>'), 
        $templateCache.put("ngTagsInput/tag-item.html", '<span ng-bind="$getDisplayText()"></span> <a class="remove-button" ng-click="$removeTag()" ng-bind="::$$removeTagSymbol"></a>'), 
        $templateCache.put("ngTagsInput/auto-complete.html", '<div class="autocomplete" ng-if="suggestionList.visible"><ul class="suggestion-list"><li class="suggestion-item" ng-repeat="item in suggestionList.items track by track(item)" ng-class="getSuggestionClass(item, $index)" ng-click="addSuggestionByIndex($index)" ng-mouseenter="suggestionList.select($index)"><ti-autocomplete-match scope="templateScope" data="::item"></ti-autocomplete-match></li></ul></div>'), 
        $templateCache.put("ngTagsInput/auto-complete-match.html", '<span ng-bind-html="$highlight($getDisplayText())"></span>');
    } ]);
}(), function(root, factory) {
    "undefined" != typeof module && module.exports ? ("undefined" == typeof angular ? factory(require("angular")) : factory(angular), 
    module.exports = "ngDialog") : "function" == typeof define && define.amd ? define([ "angular" ], factory) : factory(root.angular);
}(this, function(angular) {
    "use strict";
    var m = angular.module("ngDialog", []), $el = angular.element, isDef = angular.isDefined, style = (document.body || document.documentElement).style, animationEndSupport = isDef(style.animation) || isDef(style.WebkitAnimation) || isDef(style.MozAnimation) || isDef(style.MsAnimation) || isDef(style.OAnimation), animationEndEvent = "animationend webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend", forceElementsReload = {
        html: !1,
        body: !1
    }, scopes = {}, openIdStack = [], keydownIsBound = !1, openOnePerName = !1;
    return m.provider("ngDialog", function() {
        var defaults = this.defaults = {
            className: "ngdialog-theme-default",
            appendClassName: "",
            disableAnimation: !1,
            plain: !1,
            showClose: !0,
            closeByDocument: !0,
            closeByEscape: !0,
            closeByNavigation: !1,
            appendTo: !1,
            preCloseCallback: !1,
            overlay: !0,
            cache: !0,
            trapFocus: !0,
            preserveFocus: !0,
            ariaAuto: !0,
            ariaRole: null,
            ariaLabelledById: null,
            ariaLabelledBySelector: null,
            ariaDescribedById: null,
            ariaDescribedBySelector: null,
            bodyClassName: "ngdialog-open",
            width: null,
            height: null
        };
        this.setForceHtmlReload = function(_useIt) {
            forceElementsReload.html = _useIt || !1;
        }, this.setForceBodyReload = function(_useIt) {
            forceElementsReload.body = _useIt || !1;
        }, this.setDefaults = function(newDefaults) {
            angular.extend(defaults, newDefaults);
        }, this.setOpenOnePerName = function(isOpenOne) {
            openOnePerName = isOpenOne || !1;
        };
        var closeByDocumentHandler, globalID = 0, dialogsCount = 0, defers = {};
        this.$get = [ "$document", "$templateCache", "$compile", "$q", "$http", "$rootScope", "$timeout", "$window", "$controller", "$injector", function($document, $templateCache, $compile, $q, $http, $rootScope, $timeout, $window, $controller, $injector) {
            var $elements = [], privateMethods = {
                onDocumentKeydown: function(event) {
                    27 === event.keyCode && publicMethods.close("$escape");
                },
                activate: function($dialog) {
                    $dialog.data("$ngDialogOptions").trapFocus && ($dialog.on("keydown", privateMethods.onTrapFocusKeydown), 
                    $elements.body.on("keydown", privateMethods.onTrapFocusKeydown));
                },
                deactivate: function($dialog) {
                    $dialog.off("keydown", privateMethods.onTrapFocusKeydown), $elements.body.off("keydown", privateMethods.onTrapFocusKeydown);
                },
                deactivateAll: function(els) {
                    angular.forEach(els, function(el) {
                        var $dialog = angular.element(el);
                        privateMethods.deactivate($dialog);
                    });
                },
                setBodyPadding: function(width) {
                    var originalBodyPadding = parseInt($elements.body.css("padding-right") || 0, 10);
                    $elements.body.css("padding-right", originalBodyPadding + width + "px"), $elements.body.data("ng-dialog-original-padding", originalBodyPadding), 
                    $rootScope.$broadcast("ngDialog.setPadding", width);
                },
                resetBodyPadding: function() {
                    var originalBodyPadding = $elements.body.data("ng-dialog-original-padding");
                    originalBodyPadding ? $elements.body.css("padding-right", originalBodyPadding + "px") : $elements.body.css("padding-right", ""), 
                    $rootScope.$broadcast("ngDialog.setPadding", 0);
                },
                performCloseDialog: function($dialog, value) {
                    var options = $dialog.data("$ngDialogOptions"), id = $dialog.attr("id"), scope = scopes[id];
                    if (scope) {
                        if (void 0 !== $window.Hammer) {
                            var hammerTime = scope.hammerTime;
                            hammerTime.off("tap", closeByDocumentHandler), hammerTime.destroy && hammerTime.destroy(), 
                            delete scope.hammerTime;
                        } else $dialog.unbind("click");
                        1 === dialogsCount && $elements.body.unbind("keydown", privateMethods.onDocumentKeydown), 
                        $dialog.hasClass("ngdialog-closing") || (dialogsCount -= 1);
                        var previousFocus = $dialog.data("$ngDialogPreviousFocus");
                        previousFocus && previousFocus.focus && previousFocus.focus(), $rootScope.$broadcast("ngDialog.closing", $dialog, value), 
                        dialogsCount = dialogsCount < 0 ? 0 : dialogsCount, animationEndSupport && !options.disableAnimation ? (scope.$destroy(), 
                        $dialog.unbind(animationEndEvent).bind(animationEndEvent, function() {
                            privateMethods.closeDialogElement($dialog, value);
                        }).addClass("ngdialog-closing")) : (scope.$destroy(), privateMethods.closeDialogElement($dialog, value)), 
                        defers[id] && (defers[id].resolve({
                            id: id,
                            value: value,
                            $dialog: $dialog,
                            remainingDialogs: dialogsCount
                        }), delete defers[id]), scopes[id] && delete scopes[id], openIdStack.splice(openIdStack.indexOf(id), 1), 
                        openIdStack.length || ($elements.body.unbind("keydown", privateMethods.onDocumentKeydown), 
                        keydownIsBound = !1);
                    }
                },
                closeDialogElement: function($dialog, value) {
                    var options = $dialog.data("$ngDialogOptions");
                    $dialog.remove(), 0 === dialogsCount && ($elements.html.removeClass(options.bodyClassName), 
                    $elements.body.removeClass(options.bodyClassName), privateMethods.resetBodyPadding()), 
                    $rootScope.$broadcast("ngDialog.closed", $dialog, value);
                },
                closeDialog: function($dialog, value) {
                    var preCloseCallback = $dialog.data("$ngDialogPreCloseCallback");
                    if (preCloseCallback && angular.isFunction(preCloseCallback)) {
                        var preCloseCallbackResult = preCloseCallback.call($dialog, value);
                        if (angular.isObject(preCloseCallbackResult)) preCloseCallbackResult.closePromise ? preCloseCallbackResult.closePromise.then(function() {
                            privateMethods.performCloseDialog($dialog, value);
                        }, function() {
                            return !1;
                        }) : preCloseCallbackResult.then(function() {
                            privateMethods.performCloseDialog($dialog, value);
                        }, function() {
                            return !1;
                        }); else {
                            if (!1 === preCloseCallbackResult) return !1;
                            privateMethods.performCloseDialog($dialog, value);
                        }
                    } else privateMethods.performCloseDialog($dialog, value);
                },
                onTrapFocusKeydown: function(ev) {
                    var $dialog, el = angular.element(ev.currentTarget);
                    if (el.hasClass("ngdialog")) $dialog = el; else if (null === ($dialog = privateMethods.getActiveDialog())) return;
                    var isTab = 9 === ev.keyCode, backward = !0 === ev.shiftKey;
                    isTab && privateMethods.handleTab($dialog, ev, backward);
                },
                handleTab: function($dialog, ev, backward) {
                    var focusableElements = privateMethods.getFocusableElements($dialog);
                    if (0 !== focusableElements.length) {
                        var currentFocus = document.activeElement, focusIndex = Array.prototype.indexOf.call(focusableElements, currentFocus), isFocusIndexUnknown = -1 === focusIndex, isFirstElementFocused = 0 === focusIndex, isLastElementFocused = focusIndex === focusableElements.length - 1, cancelEvent = !1;
                        backward ? (isFocusIndexUnknown || isFirstElementFocused) && (focusableElements[focusableElements.length - 1].focus(), 
                        cancelEvent = !0) : (isFocusIndexUnknown || isLastElementFocused) && (focusableElements[0].focus(), 
                        cancelEvent = !0), cancelEvent && (ev.preventDefault(), ev.stopPropagation());
                    } else document.activeElement && document.activeElement.blur && document.activeElement.blur();
                },
                autoFocus: function($dialog) {
                    var dialogEl = $dialog[0], autoFocusEl = dialogEl.querySelector("*[autofocus]");
                    if (null === autoFocusEl || (autoFocusEl.focus(), document.activeElement !== autoFocusEl)) {
                        var focusableElements = privateMethods.getFocusableElements($dialog);
                        if (0 < focusableElements.length) focusableElements[0].focus(); else {
                            var contentElements = privateMethods.filterVisibleElements(dialogEl.querySelectorAll("h1,h2,h3,h4,h5,h6,p,span"));
                            if (0 < contentElements.length) {
                                var contentElement = contentElements[0];
                                $el(contentElement).attr("tabindex", "-1").css("outline", "0"), contentElement.focus();
                            }
                        }
                    }
                },
                getFocusableElements: function($dialog) {
                    var rawElements = $dialog[0].querySelectorAll("a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]"), tabbableElements = privateMethods.filterTabbableElements(rawElements);
                    return privateMethods.filterVisibleElements(tabbableElements);
                },
                filterTabbableElements: function(els) {
                    for (var tabbableFocusableElements = [], i = 0; i < els.length; i++) {
                        var el = els[i];
                        "-1" !== $el(el).attr("tabindex") && tabbableFocusableElements.push(el);
                    }
                    return tabbableFocusableElements;
                },
                filterVisibleElements: function(els) {
                    for (var visibleFocusableElements = [], i = 0; i < els.length; i++) {
                        var el = els[i];
                        (0 < el.offsetWidth || 0 < el.offsetHeight) && visibleFocusableElements.push(el);
                    }
                    return visibleFocusableElements;
                },
                getActiveDialog: function() {
                    var dialogs = document.querySelectorAll(".ngdialog");
                    return 0 === dialogs.length ? null : $el(dialogs[dialogs.length - 1]);
                },
                applyAriaAttributes: function($dialog, options) {
                    if (options.ariaAuto) {
                        if (!options.ariaRole) {
                            var detectedRole = 0 < privateMethods.getFocusableElements($dialog).length ? "dialog" : "alertdialog";
                            options.ariaRole = detectedRole;
                        }
                        options.ariaLabelledBySelector || (options.ariaLabelledBySelector = "h1,h2,h3,h4,h5,h6"), 
                        options.ariaDescribedBySelector || (options.ariaDescribedBySelector = "article,section,p");
                    }
                    options.ariaRole && $dialog.attr("role", options.ariaRole), privateMethods.applyAriaAttribute($dialog, "aria-labelledby", options.ariaLabelledById, options.ariaLabelledBySelector), 
                    privateMethods.applyAriaAttribute($dialog, "aria-describedby", options.ariaDescribedById, options.ariaDescribedBySelector);
                },
                applyAriaAttribute: function($dialog, attr, id, selector) {
                    if (id && $dialog.attr(attr, id), selector) {
                        var dialogId = $dialog.attr("id"), firstMatch = $dialog[0].querySelector(selector);
                        if (!firstMatch) return;
                        var generatedId = dialogId + "-" + attr;
                        return $el(firstMatch).attr("id", generatedId), $dialog.attr(attr, generatedId), 
                        generatedId;
                    }
                },
                detectUIRouter: function() {
                    try {
                        return angular.module("ui.router"), !0;
                    } catch (err) {
                        return !1;
                    }
                },
                getRouterLocationEventName: function() {
                    return privateMethods.detectUIRouter() ? "$stateChangeStart" : "$locationChangeStart";
                }
            }, publicMethods = {
                __PRIVATE__: privateMethods,
                open: function(opts) {
                    var dialogID = null;
                    if (opts = opts || {}, !(openOnePerName && opts.name && (dialogID = opts.name.toLowerCase().replace(/\s/g, "-") + "-dialog", 
                    this.isOpen(dialogID)))) {
                        var defer, scope, $dialog, $dialogParent, $dialogContent, options = angular.copy(defaults), localID = ++globalID;
                        dialogID = dialogID || "ngdialog" + localID, openIdStack.push(dialogID), void 0 !== options.data && (void 0 === opts.data && (opts.data = {}), 
                        opts.data = angular.merge(angular.copy(options.data), opts.data)), angular.extend(options, opts), 
                        defers[dialogID] = defer = $q.defer(), scopes[dialogID] = scope = angular.isObject(options.scope) ? options.scope.$new() : $rootScope.$new();
                        var resolve = angular.extend({}, options.resolve);
                        return angular.forEach(resolve, function(value, key) {
                            resolve[key] = angular.isString(value) ? $injector.get(value) : $injector.invoke(value, null, null, key);
                        }), $q.all({
                            template: function(tmpl) {
                                if (!tmpl) return "Empty template";
                                if (angular.isString(tmpl) && options.plain) return tmpl;
                                if ("boolean" == typeof options.cache && !options.cache) return loadTemplateUrl(tmpl, {
                                    cache: !1
                                });
                                return loadTemplateUrl(tmpl, {
                                    cache: $templateCache
                                });
                            }(options.template || options.templateUrl),
                            locals: $q.all(resolve)
                        }).then(function(setup) {
                            var template = setup.template, locals = setup.locals;
                            options.showClose && (template += '<div class="ngdialog-close"></div>');
                            var preCloseCallback, hasOverlayClass = options.overlay ? "" : " ngdialog-no-overlay";
                            if (($dialog = $el('<div id="' + dialogID + '" class="ngdialog' + hasOverlayClass + '"></div>')).html(options.overlay ? '<div class="ngdialog-overlay"></div><div class="ngdialog-content" role="document">' + template + "</div>" : '<div class="ngdialog-content" role="document">' + template + "</div>"), 
                            $dialog.data("$ngDialogOptions", options), scope.ngDialogId = dialogID, options.data && angular.isString(options.data)) {
                                var firstLetter = options.data.replace(/^\s*/, "")[0];
                                scope.ngDialogData = "{" === firstLetter || "[" === firstLetter ? angular.fromJson(options.data) : new String(options.data), 
                                scope.ngDialogData.ngDialogId = dialogID;
                            } else options.data && angular.isObject(options.data) && (scope.ngDialogData = options.data, 
                            scope.ngDialogData.ngDialogId = dialogID);
                            (options.className && $dialog.addClass(options.className), options.appendClassName && $dialog.addClass(options.appendClassName), 
                            options.width && ($dialogContent = $dialog[0].querySelector(".ngdialog-content"), 
                            angular.isString(options.width) ? $dialogContent.style.width = options.width : $dialogContent.style.width = options.width + "px"), 
                            options.height && ($dialogContent = $dialog[0].querySelector(".ngdialog-content"), 
                            angular.isString(options.height) ? $dialogContent.style.height = options.height : $dialogContent.style.height = options.height + "px"), 
                            options.disableAnimation && $dialog.addClass("ngdialog-disabled-animation"), $dialogParent = options.appendTo && angular.isString(options.appendTo) ? angular.element(document.querySelector(options.appendTo)) : $elements.body, 
                            privateMethods.applyAriaAttributes($dialog, options), options.preCloseCallback) && (angular.isFunction(options.preCloseCallback) ? preCloseCallback = options.preCloseCallback : angular.isString(options.preCloseCallback) && scope && (angular.isFunction(scope[options.preCloseCallback]) ? preCloseCallback = scope[options.preCloseCallback] : scope.$parent && angular.isFunction(scope.$parent[options.preCloseCallback]) ? preCloseCallback = scope.$parent[options.preCloseCallback] : $rootScope && angular.isFunction($rootScope[options.preCloseCallback]) && (preCloseCallback = $rootScope[options.preCloseCallback])), 
                            preCloseCallback && $dialog.data("$ngDialogPreCloseCallback", preCloseCallback));
                            if (scope.closeThisDialog = function(value) {
                                privateMethods.closeDialog($dialog, value);
                            }, options.controller && (angular.isString(options.controller) || angular.isArray(options.controller) || angular.isFunction(options.controller))) {
                                var label;
                                options.controllerAs && angular.isString(options.controllerAs) && (label = options.controllerAs);
                                var controllerInstance = $controller(options.controller, angular.extend(locals, {
                                    $scope: scope,
                                    $element: $dialog
                                }), !0, label);
                                options.bindToController && angular.extend(controllerInstance.instance, {
                                    ngDialogId: scope.ngDialogId,
                                    ngDialogData: scope.ngDialogData,
                                    closeThisDialog: scope.closeThisDialog,
                                    confirm: scope.confirm
                                }), "function" == typeof controllerInstance ? $dialog.data("$ngDialogControllerController", controllerInstance()) : $dialog.data("$ngDialogControllerController", controllerInstance);
                            }
                            if ($timeout(function() {
                                var $activeDialogs = document.querySelectorAll(".ngdialog");
                                privateMethods.deactivateAll($activeDialogs), $compile($dialog)(scope);
                                var widthDiffs = $window.innerWidth - $elements.body.prop("clientWidth");
                                $elements.html.addClass(options.bodyClassName), $elements.body.addClass(options.bodyClassName);
                                var scrollBarWidth = widthDiffs - ($window.innerWidth - $elements.body.prop("clientWidth"));
                                0 < scrollBarWidth && privateMethods.setBodyPadding(scrollBarWidth), $dialogParent.append($dialog), 
                                privateMethods.activate($dialog), options.trapFocus && privateMethods.autoFocus($dialog), 
                                options.name ? $rootScope.$broadcast("ngDialog.opened", {
                                    dialog: $dialog,
                                    name: options.name
                                }) : $rootScope.$broadcast("ngDialog.opened", $dialog);
                            }), keydownIsBound || ($elements.body.bind("keydown", privateMethods.onDocumentKeydown), 
                            keydownIsBound = !0), options.closeByNavigation) {
                                var eventName = privateMethods.getRouterLocationEventName();
                                $rootScope.$on(eventName, function($event) {
                                    !1 === privateMethods.closeDialog($dialog) && $event.preventDefault();
                                });
                            }
                            (options.preserveFocus && $dialog.data("$ngDialogPreviousFocus", document.activeElement), 
                            closeByDocumentHandler = function(event) {
                                var isOverlay = !!options.closeByDocument && $el(event.target).hasClass("ngdialog-overlay"), isCloseBtn = $el(event.target).hasClass("ngdialog-close");
                                (isOverlay || isCloseBtn) && publicMethods.close($dialog.attr("id"), isCloseBtn ? "$closeButton" : "$document");
                            }, void 0 !== $window.Hammer) ? (scope.hammerTime = $window.Hammer($dialog[0])).on("tap", closeByDocumentHandler) : $dialog.bind("click", closeByDocumentHandler);
                            return dialogsCount += 1, publicMethods;
                        }), {
                            id: dialogID,
                            closePromise: defer.promise,
                            close: function(value) {
                                privateMethods.closeDialog($dialog, value);
                            }
                        };
                    }
                    function loadTemplateUrl(tmpl, config) {
                        return (config = config || {}).headers = config.headers || {}, angular.extend(config.headers, {
                            Accept: "text/html"
                        }), $rootScope.$broadcast("ngDialog.templateLoading", tmpl), $http.get(tmpl, config).then(function(res) {
                            return $rootScope.$broadcast("ngDialog.templateLoaded", tmpl), res.data || "";
                        });
                    }
                },
                openConfirm: function(opts) {
                    var defer = $q.defer(), options = angular.copy(defaults);
                    opts = opts || {}, void 0 !== options.data && (void 0 === opts.data && (opts.data = {}), 
                    opts.data = angular.merge(angular.copy(options.data), opts.data)), angular.extend(options, opts), 
                    options.scope = angular.isObject(options.scope) ? options.scope.$new() : $rootScope.$new(), 
                    options.scope.confirm = function(value) {
                        defer.resolve(value);
                        var $dialog = $el(document.getElementById(openResult.id));
                        privateMethods.performCloseDialog($dialog, value);
                    };
                    var openResult = publicMethods.open(options);
                    if (openResult) return openResult.closePromise.then(function(data) {
                        return data ? defer.reject(data.value) : defer.reject();
                    }), defer.promise;
                },
                isOpen: function(id) {
                    return 0 < $el(document.getElementById(id)).length;
                },
                close: function(id, value) {
                    var $dialog = $el(document.getElementById(id));
                    if ($dialog.length) privateMethods.closeDialog($dialog, value); else if ("$escape" === id) {
                        var topDialogId = openIdStack[openIdStack.length - 1];
                        ($dialog = $el(document.getElementById(topDialogId))).data("$ngDialogOptions").closeByEscape && privateMethods.closeDialog($dialog, "$escape");
                    } else publicMethods.closeAll(value);
                    return publicMethods;
                },
                closeAll: function(value) {
                    for (var $all = document.querySelectorAll(".ngdialog"), i = $all.length - 1; 0 <= i; i--) {
                        var dialog = $all[i];
                        privateMethods.closeDialog($el(dialog), value);
                    }
                },
                getOpenDialogs: function() {
                    return openIdStack;
                },
                getDefaults: function() {
                    return defaults;
                }
            };
            return angular.forEach([ "html", "body" ], function(elementName) {
                if ($elements[elementName] = $document.find(elementName), forceElementsReload[elementName]) {
                    var eventName = privateMethods.getRouterLocationEventName();
                    $rootScope.$on(eventName, function() {
                        $elements[elementName] = $document.find(elementName);
                    });
                }
            }), publicMethods;
        } ];
    }), m.directive("ngDialog", [ "ngDialog", function(ngDialog) {
        return {
            restrict: "A",
            scope: {
                ngDialogScope: "="
            },
            link: function(scope, elem, attrs) {
                elem.on("click", function(e) {
                    e.preventDefault();
                    var ngDialogScope = angular.isDefined(scope.ngDialogScope) ? scope.ngDialogScope : "noScope";
                    angular.isDefined(attrs.ngDialogClosePrevious) && ngDialog.close(attrs.ngDialogClosePrevious);
                    var defaults = ngDialog.getDefaults();
                    ngDialog.open({
                        template: attrs.ngDialog,
                        className: attrs.ngDialogClass || defaults.className,
                        appendClassName: attrs.ngDialogAppendClass,
                        controller: attrs.ngDialogController,
                        controllerAs: attrs.ngDialogControllerAs,
                        bindToController: attrs.ngDialogBindToController,
                        disableAnimation: attrs.ngDialogDisableAnimation,
                        scope: ngDialogScope,
                        data: attrs.ngDialogData,
                        showClose: "false" !== attrs.ngDialogShowClose && ("true" === attrs.ngDialogShowClose || defaults.showClose),
                        closeByDocument: "false" !== attrs.ngDialogCloseByDocument && ("true" === attrs.ngDialogCloseByDocument || defaults.closeByDocument),
                        closeByEscape: "false" !== attrs.ngDialogCloseByEscape && ("true" === attrs.ngDialogCloseByEscape || defaults.closeByEscape),
                        overlay: "false" !== attrs.ngDialogOverlay && ("true" === attrs.ngDialogOverlay || defaults.overlay),
                        preCloseCallback: attrs.ngDialogPreCloseCallback || defaults.preCloseCallback,
                        bodyClassName: attrs.ngDialogBodyClass || defaults.bodyClassName
                    });
                });
            }
        };
    } ]), m;
}), angular.module("gettext", []), angular.module("gettext").constant("gettext", function(t) {
    return t;
}), angular.module("gettext").factory("gettextCatalog", [ "gettextPlurals", "gettextFallbackLanguage", "$http", "$cacheFactory", "$interpolate", "$rootScope", function(i, u, e, t, c, r) {
    var a, l = "$$noContext", n = '<span id="test" title="test" class="tested">test</span>', g = angular.element("<span>" + n + "</span>").html() !== n, o = function(t) {
        return a.debug && a.currentLanguage !== a.baseLanguage ? a.debugPrefix + t : t;
    }, f = function(t) {
        return a.showTranslatedMarkers ? a.translatedMarkerPrefix + t + a.translatedMarkerSuffix : t;
    };
    function h() {
        r.$broadcast("gettextLanguageChanged");
    }
    return a = {
        debug: !1,
        debugPrefix: "[MISSING]: ",
        showTranslatedMarkers: !1,
        translatedMarkerPrefix: "[",
        translatedMarkerSuffix: "]",
        strings: {},
        baseLanguage: "en",
        currentLanguage: "en",
        cache: t("strings"),
        setCurrentLanguage: function(t) {
            this.currentLanguage = t, h();
        },
        getCurrentLanguage: function() {
            return this.currentLanguage;
        },
        setStrings: function(t, e) {
            this.strings[t] || (this.strings[t] = {});
            var r = i(t, 1);
            for (var a in e) {
                var n = e[a];
                if (g && (a = angular.element("<span>" + a + "</span>").html()), angular.isString(n) || angular.isArray(n)) {
                    var s = {};
                    s[l] = n, n = s;
                }
                for (var u in this.strings[t][a] || (this.strings[t][a] = {}), n) {
                    var c = n[u];
                    angular.isArray(c) ? this.strings[t][a][u] = c : (this.strings[t][a][u] = [], this.strings[t][a][u][r] = c);
                }
            }
            h();
        },
        getStringFormFor: function(t, e, r, a) {
            return t ? (((this.strings[t] || {})[e] || {})[a || l] || [])[i(t, r)] : null;
        },
        getString: function(t, e, r) {
            var a = u(this.currentLanguage);
            return t = this.getStringFormFor(this.currentLanguage, t, 1, r) || this.getStringFormFor(a, t, 1, r) || o(t), 
            t = e ? c(t)(e) : t, f(t);
        },
        getPlural: function(t, e, r, a, n) {
            var s = u(this.currentLanguage);
            return e = this.getStringFormFor(this.currentLanguage, e, t, n) || this.getStringFormFor(s, e, t, n) || o(1 === t ? e : r), 
            a && (a.$count = t, e = c(e)(a)), f(e);
        },
        loadRemote: function(t) {
            return e({
                method: "GET",
                url: t,
                cache: a.cache
            }).then(function(t) {
                var e = t.data;
                for (var r in e) a.setStrings(r, e[r]);
                return t;
            });
        }
    };
} ]), angular.module("gettext").directive("translate", [ "gettextCatalog", "$parse", "$animate", "$compile", "$window", "gettextUtil", function(h, a, m, d, t, x) {
    var e = angular.$$lowercase || angular.lowercase, r = parseInt((/msie (\d+)/.exec(e(t.navigator.userAgent)) || [])[1], 10), c = "translateParams";
    function n(e, r, n) {
        var t = Object.keys(r).filter(function(t) {
            return x.startsWith(t, c) && t !== c;
        });
        if (!t.length) return null;
        var s = angular.extend({}, e), u = [];
        return t.forEach(function(a) {
            var t = e.$watch(r[a], function(t) {
                var e, r = (e = a, x.lcFirst(e.replace(c, "")));
                s[r] = t, n(s);
            });
            u.push(t);
        }), e.$on("$destroy", function() {
            u.forEach(function(t) {
                t();
            });
        }), s;
    }
    return {
        restrict: "AE",
        terminal: !0,
        compile: function(t, e) {
            x.assert(!e.translatePlural || e.translateN, "translate-n", "translate-plural"), 
            x.assert(!e.translateN || e.translatePlural, "translate-plural", "translate-n");
            var g = x.trim(t.html()), o = e.translatePlural, f = e.translateContext;
            return r <= 8 && "\x3c!--IE fix--\x3e" === g.slice(-13) && (g = g.slice(0, -13)), 
            {
                post: function(s, u, t) {
                    var c = a(t.translateN), i = null, l = !0;
                    function e(t) {
                        var e;
                        t = t || null, o ? ((s = i || (i = s.$new())).$count = c(s), e = h.getPlural(s.$count, g, o, t, f)) : e = h.getString(g, t, f);
                        var r = u.contents();
                        if (r || e) if (e !== x.trim(r.html())) {
                            var a = angular.element("<span>" + e + "</span>");
                            d(a.contents())(s);
                            var n = a.contents();
                            m.enter(n, u), m.leave(r);
                        } else l && d(r)(s);
                    }
                    var r = n(s, t, e);
                    e(r), l = !1, t.translateN && s.$watch(t.translateN, function() {
                        e(r);
                    }), s.$on("gettextLanguageChanged", function() {
                        e(r);
                    });
                }
            };
        }
    };
} ]), angular.module("gettext").factory("gettextFallbackLanguage", function() {
    var r = {}, a = /([^_]+)_[^_]+$/;
    return function(t) {
        if (r[t]) return r[t];
        var e = a.exec(t);
        return e ? (r[t] = e[1], e[1]) : null;
    };
}), angular.module("gettext").filter("translate", [ "gettextCatalog", function(r) {
    function t(t, e) {
        return r.getString(t, null, e);
    }
    return t.$stateful = !0, t;
} ]), angular.module("gettext").factory("gettextPlurals", function() {
    var r = {
        pt_BR: "pt_BR",
        "pt-BR": "pt_BR"
    };
    return function(t, e) {
        switch (function(t) {
            return r[t] || (r[t] = t.split(/\-|_/).shift()), r[t];
        }(t)) {
          case "ay":
          case "bo":
          case "cgg":
          case "dz":
          case "fa":
          case "id":
          case "ja":
          case "jbo":
          case "ka":
          case "kk":
          case "km":
          case "ko":
          case "ky":
          case "lo":
          case "ms":
          case "my":
          case "sah":
          case "su":
          case "th":
          case "tt":
          case "ug":
          case "vi":
          case "wo":
          case "zh":
            return 0;

          case "is":
            return e % 10 != 1 || e % 100 == 11 ? 1 : 0;

          case "jv":
            return 0 != e ? 1 : 0;

          case "mk":
            return 1 == e || e % 10 == 1 ? 0 : 1;

          case "ach":
          case "ak":
          case "am":
          case "arn":
          case "br":
          case "fil":
          case "fr":
          case "gun":
          case "ln":
          case "mfe":
          case "mg":
          case "mi":
          case "oc":
          case "pt_BR":
          case "tg":
          case "ti":
          case "tr":
          case "uz":
          case "wa":
          case "zh":
            return 1 < e ? 1 : 0;

          case "lv":
            return e % 10 == 1 && e % 100 != 11 ? 0 : 0 != e ? 1 : 2;

          case "lt":
            return e % 10 == 1 && e % 100 != 11 ? 0 : 2 <= e % 10 && (e % 100 < 10 || 20 <= e % 100) ? 1 : 2;

          case "be":
          case "bs":
          case "hr":
          case "ru":
          case "sr":
          case "uk":
            return e % 10 == 1 && e % 100 != 11 ? 0 : 2 <= e % 10 && e % 10 <= 4 && (e % 100 < 10 || 20 <= e % 100) ? 1 : 2;

          case "mnk":
            return 0 == e ? 0 : 1 == e ? 1 : 2;

          case "ro":
            return 1 == e ? 0 : 0 == e || 0 < e % 100 && e % 100 < 20 ? 1 : 2;

          case "pl":
            return 1 == e ? 0 : 2 <= e % 10 && e % 10 <= 4 && (e % 100 < 10 || 20 <= e % 100) ? 1 : 2;

          case "cs":
          case "sk":
            return 1 == e ? 0 : 2 <= e && e <= 4 ? 1 : 2;

          case "sl":
            return e % 100 == 1 ? 1 : e % 100 == 2 ? 2 : e % 100 == 3 || e % 100 == 4 ? 3 : 0;

          case "mt":
            return 1 == e ? 0 : 0 == e || 1 < e % 100 && e % 100 < 11 ? 1 : 10 < e % 100 && e % 100 < 20 ? 2 : 3;

          case "gd":
            return 1 == e || 11 == e ? 0 : 2 == e || 12 == e ? 1 : 2 < e && e < 20 ? 2 : 3;

          case "cy":
            return 1 == e ? 0 : 2 == e ? 1 : 8 != e && 11 != e ? 2 : 3;

          case "kw":
            return 1 == e ? 0 : 2 == e ? 1 : 3 == e ? 2 : 3;

          case "ga":
            return 1 == e ? 0 : 2 == e ? 1 : e < 7 ? 2 : e < 11 ? 3 : 4;

          case "ar":
            return 0 == e ? 0 : 1 == e ? 1 : 2 == e ? 2 : 3 <= e % 100 && e % 100 <= 10 ? 3 : 11 <= e % 100 ? 4 : 5;

          default:
            return 1 != e ? 1 : 0;
        }
    };
}), angular.module("gettext").factory("gettextUtil", function() {
    return {
        trim: String.prototype.trim ? function(t) {
            return "string" == typeof t ? t.trim() : t;
        } : function(t) {
            return "string" == typeof t ? t.replace(/^\s*/, "").replace(/\s*$/, "") : t;
        },
        assert: function(t, e, r) {
            if (!t) throw new Error("You should add a " + e + " attribute whenever you add a " + r + " attribute.");
        },
        startsWith: function(t, e) {
            return 0 === t.indexOf(e);
        },
        lcFirst: function(t) {
            return t.charAt(0).toLowerCase() + t.substr(1);
        }
    };
}), function() {
    "use strict";
    angular.module("ui.tree", []).constant("treeConfig", {
        treeClass: "angular-ui-tree",
        emptyTreeClass: "angular-ui-tree-empty",
        dropzoneClass: "angular-ui-tree-dropzone",
        hiddenClass: "angular-ui-tree-hidden",
        nodesClass: "angular-ui-tree-nodes",
        nodeClass: "angular-ui-tree-node",
        handleClass: "angular-ui-tree-handle",
        placeholderClass: "angular-ui-tree-placeholder",
        dragClass: "angular-ui-tree-drag",
        dragThreshold: 3,
        defaultCollapsed: !1,
        appendChildOnHover: !0
    });
}(), function() {
    "use strict";
    angular.module("ui.tree").controller("TreeHandleController", [ "$scope", "$element", function($scope, $element) {
        (this.scope = $scope).$element = $element, $scope.$nodeScope = null, $scope.$type = "uiTreeHandle";
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.tree").controller("TreeNodeController", [ "$scope", "$element", function($scope, $element) {
        (this.scope = $scope).$element = $element, $scope.$modelValue = null, $scope.$parentNodeScope = null, 
        $scope.$childNodesScope = null, $scope.$parentNodesScope = null, $scope.$treeScope = null, 
        $scope.$handleScope = null, $scope.$type = "uiTreeNode", $scope.$$allowNodeDrop = !1, 
        $scope.collapsed = !1, $scope.expandOnHover = !1, $scope.init = function(controllersArr) {
            var treeNodesCtrl = controllersArr[0];
            $scope.$treeScope = controllersArr[1] ? controllersArr[1].scope : null, $scope.$parentNodeScope = treeNodesCtrl.scope.$nodeScope, 
            $scope.$modelValue = treeNodesCtrl.scope.$modelValue[$scope.$index], $scope.$parentNodesScope = treeNodesCtrl.scope, 
            treeNodesCtrl.scope.initSubNode($scope), $element.on("$destroy", function() {
                treeNodesCtrl.scope.destroySubNode($scope);
            });
        }, $scope.index = function() {
            return $scope.$parentNodesScope.$modelValue.indexOf($scope.$modelValue);
        }, $scope.dragEnabled = function() {
            return !($scope.$treeScope && !$scope.$treeScope.dragEnabled);
        }, $scope.isSibling = function(targetNode) {
            return $scope.$parentNodesScope == targetNode.$parentNodesScope;
        }, $scope.isChild = function(targetNode) {
            var nodes = $scope.childNodes();
            return nodes && -1 < nodes.indexOf(targetNode);
        }, $scope.prev = function() {
            var index = $scope.index();
            return 0 < index ? $scope.siblings()[index - 1] : null;
        }, $scope.siblings = function() {
            return $scope.$parentNodesScope.childNodes();
        }, $scope.childNodesCount = function() {
            return $scope.childNodes() ? $scope.childNodes().length : 0;
        }, $scope.hasChild = function() {
            return 0 < $scope.childNodesCount();
        }, $scope.childNodes = function() {
            return $scope.$childNodesScope && $scope.$childNodesScope.$modelValue ? $scope.$childNodesScope.childNodes() : null;
        }, $scope.accept = function(sourceNode, destIndex) {
            return $scope.$childNodesScope && $scope.$childNodesScope.$modelValue && $scope.$childNodesScope.accept(sourceNode, destIndex);
        }, $scope.remove = function() {
            return $scope.$parentNodesScope.removeNode($scope);
        }, $scope.toggle = function() {
            $scope.collapsed = !$scope.collapsed, $scope.$treeScope.$callbacks.toggle($scope.collapsed, $scope);
        }, $scope.collapse = function() {
            $scope.collapsed = !0;
        }, $scope.expand = function() {
            $scope.collapsed = !1;
        }, $scope.depth = function() {
            var parentNode = $scope.$parentNodeScope;
            return parentNode ? parentNode.depth() + 1 : 1;
        }, $scope.maxSubDepth = function() {
            return $scope.$childNodesScope ? function countSubTreeDepth(scope) {
                if (!scope) return 0;
                var childDepth, i, thisLevelDepth = 0, childNodes = scope.childNodes();
                if (!childNodes || 0 === childNodes.length) return 0;
                for (i = childNodes.length - 1; 0 <= i; i--) childDepth = 1 + countSubTreeDepth(childNodes[i]), 
                thisLevelDepth = Math.max(thisLevelDepth, childDepth);
                return thisLevelDepth;
            }($scope.$childNodesScope) : 0;
        };
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.tree").controller("TreeNodesController", [ "$scope", "$element", "$timeout", function($scope, $element, $timeout) {
        (this.scope = $scope).$element = $element, $scope.$modelValue = null, $scope.$nodeScope = null, 
        $scope.$treeScope = null, $scope.$type = "uiTreeNodes", $scope.$nodesMap = {}, $scope.nodropEnabled = !1, 
        $scope.maxDepth = 0, $scope.cloneEnabled = !1, $scope.initSubNode = function(subNode) {
            if (!subNode.$modelValue) return null;
            $scope.$nodesMap[subNode.$modelValue.$$hashKey] = subNode;
        }, $scope.destroySubNode = function(subNode) {
            if (!subNode.$modelValue) return null;
            $scope.$nodesMap[subNode.$modelValue.$$hashKey] = null;
        }, $scope.accept = function(sourceNode, destIndex) {
            return $scope.$treeScope.$callbacks.accept(sourceNode, $scope, destIndex);
        }, $scope.beforeDrag = function(sourceNode) {
            return $scope.$treeScope.$callbacks.beforeDrag(sourceNode);
        }, $scope.isParent = function(node) {
            return node.$parentNodesScope == $scope;
        }, $scope.hasChild = function() {
            return 0 < $scope.$modelValue.length;
        }, $scope.removeNode = function(node) {
            var index = $scope.$modelValue.indexOf(node.$modelValue);
            return -1 < index ? ($timeout(function() {
                $scope.$modelValue.splice(index, 1)[0];
            }), $scope.$treeScope.$callbacks.removed(node)) : null;
        }, $scope.insertNode = function(index, nodeData) {
            $timeout(function() {
                $scope.$modelValue.splice(index, 0, nodeData);
            });
        }, $scope.childNodes = function() {
            var i, nodes = [];
            if ($scope.$modelValue) for (i = 0; i < $scope.$modelValue.length; i++) nodes.push($scope.$nodesMap[$scope.$modelValue[i].$$hashKey]);
            return nodes;
        }, $scope.depth = function() {
            return $scope.$nodeScope ? $scope.$nodeScope.depth() : 0;
        }, $scope.outOfDepth = function(sourceNode) {
            var maxDepth = $scope.maxDepth || $scope.$treeScope.maxDepth;
            return 0 < maxDepth && $scope.depth() + sourceNode.maxSubDepth() + 1 > maxDepth;
        };
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.tree").controller("TreeController", [ "$scope", "$element", function($scope, $element) {
        (this.scope = $scope).$element = $element, $scope.$nodesScope = null, $scope.$type = "uiTree", 
        $scope.$emptyElm = null, $scope.$dropzoneElm = null, $scope.$callbacks = null, $scope.dragEnabled = !0, 
        $scope.emptyPlaceholderEnabled = !0, $scope.maxDepth = 0, $scope.dragDelay = 0, 
        $scope.cloneEnabled = !1, $scope.nodropEnabled = !1, $scope.dropzoneEnabled = !1, 
        $scope.isEmpty = function() {
            return $scope.$nodesScope && $scope.$nodesScope.$modelValue && 0 === $scope.$nodesScope.$modelValue.length;
        }, $scope.place = function(placeElm) {
            $scope.$nodesScope.$element.append(placeElm), $scope.$emptyElm.remove();
        }, this.resetEmptyElement = function() {
            $scope.$nodesScope.$modelValue && 0 !== $scope.$nodesScope.$modelValue.length || !$scope.emptyPlaceholderEnabled ? $scope.$emptyElm.remove() : $element.append($scope.$emptyElm);
        }, this.resetDropzoneElement = function() {
            $scope.$nodesScope.$modelValue && 0 === $scope.$nodesScope.$modelValue.length || !$scope.dropzoneEnabled ? $scope.$dropzoneElm.remove() : $element.append($scope.$dropzoneElm);
        }, $scope.resetEmptyElement = this.resetEmptyElement, $scope.resetDropzoneElement = this.resetDropzoneElement;
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.tree").directive("uiTree", [ "treeConfig", "$window", function(treeConfig, $window) {
        return {
            restrict: "A",
            scope: !0,
            controller: "TreeController",
            link: function(scope, element, attrs, ctrl) {
                var tdElm, $trElm, emptyElmColspan, callbacks = {
                    accept: null,
                    beforeDrag: null
                }, config = {};
                angular.extend(config, treeConfig), config.treeClass && element.addClass(config.treeClass), 
                "table" === element.prop("tagName").toLowerCase() ? (scope.$emptyElm = angular.element($window.document.createElement("tr")), 
                emptyElmColspan = 0 < ($trElm = element.find("tr")).length ? angular.element($trElm).children().length : 1e6, 
                tdElm = angular.element($window.document.createElement("td")).attr("colspan", emptyElmColspan), 
                scope.$emptyElm.append(tdElm)) : (scope.$emptyElm = angular.element($window.document.createElement("div")), 
                scope.$dropzoneElm = angular.element($window.document.createElement("div"))), config.emptyTreeClass && scope.$emptyElm.addClass(config.emptyTreeClass), 
                config.dropzoneClass && scope.$dropzoneElm.addClass(config.dropzoneClass), scope.$watch("$nodesScope.$modelValue.length", function(val) {
                    angular.isNumber(val) && (ctrl.resetEmptyElement(), ctrl.resetDropzoneElement());
                }, !0), scope.$watch(attrs.dragEnabled, function(val) {
                    "boolean" == typeof val && (scope.dragEnabled = val);
                }), scope.$watch(attrs.emptyPlaceholderEnabled, function(val) {
                    "boolean" == typeof val && (scope.emptyPlaceholderEnabled = val, ctrl.resetEmptyElement());
                }), scope.$watch(attrs.nodropEnabled, function(val) {
                    "boolean" == typeof val && (scope.nodropEnabled = val);
                }), scope.$watch(attrs.dropzoneEnabled, function(val) {
                    "boolean" == typeof val && (scope.dropzoneEnabled = val, ctrl.resetDropzoneElement());
                }), scope.$watch(attrs.cloneEnabled, function(val) {
                    "boolean" == typeof val && (scope.cloneEnabled = val);
                }), scope.$watch(attrs.maxDepth, function(val) {
                    "number" == typeof val && (scope.maxDepth = val);
                }), scope.$watch(attrs.dragDelay, function(val) {
                    "number" == typeof val && (scope.dragDelay = val);
                }), callbacks.accept = function(sourceNodeScope, destNodesScope, destIndex) {
                    return !(destNodesScope.nodropEnabled || destNodesScope.$treeScope.nodropEnabled || destNodesScope.outOfDepth(sourceNodeScope));
                }, callbacks.beforeDrag = function(sourceNodeScope) {
                    return !0;
                }, callbacks.expandTimeoutStart = function() {}, callbacks.expandTimeoutCancel = function() {}, 
                callbacks.expandTimeoutEnd = function() {}, callbacks.removed = function(node) {}, 
                callbacks.dropped = function(event) {}, callbacks.dragStart = function(event) {}, 
                callbacks.dragMove = function(event) {}, callbacks.dragStop = function(event) {}, 
                callbacks.beforeDrop = function(event) {}, callbacks.toggle = function(collapsed, sourceNodeScope) {}, 
                scope.$watch(attrs.uiTree, function(newVal, oldVal) {
                    angular.forEach(newVal, function(value, key) {
                        callbacks[key] && "function" == typeof value && (callbacks[key] = value);
                    }), scope.$callbacks = callbacks;
                }, !0);
            }
        };
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.tree").directive("uiTreeHandle", [ "treeConfig", function(treeConfig) {
        return {
            require: "^uiTreeNode",
            restrict: "A",
            scope: !0,
            controller: "TreeHandleController",
            link: function(scope, element, attrs, treeNodeCtrl) {
                var config = {};
                angular.extend(config, treeConfig), config.handleClass && element.addClass(config.handleClass), 
                scope != treeNodeCtrl.scope && (scope.$nodeScope = treeNodeCtrl.scope, treeNodeCtrl.scope.$handleScope = scope);
            }
        };
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.tree").directive("uiTreeNode", [ "treeConfig", "UiTreeHelper", "$window", "$document", "$timeout", "$q", function(treeConfig, UiTreeHelper, $window, $document, $timeout, $q) {
        return {
            require: [ "^uiTreeNodes", "^uiTree" ],
            restrict: "A",
            controller: "TreeNodeController",
            link: function(scope, element, attrs, controllersArr) {
                var firstMoving, dragInfo, pos, placeElm, hiddenPlaceElm, dragElm, scrollContainerElm, unhover, elements, document_height, document_width, dragStart, dragMove, dragEnd, dragStartEvent, dragMoveEvent, dragEndEvent, dragCancelEvent, dragDelay, bindDragStartEvents, bindDragMoveEvents, unbindDragMoveEvents, keydownHandler, isHandleChild, el, isUiTreeRoot, treeOfOrigin, to, config = {}, hasTouch = "ontouchstart" in window, treeScope = null, body = document.body, html = document.documentElement;
                angular.extend(config, treeConfig), config.nodeClass && element.addClass(config.nodeClass), 
                scope.init(controllersArr), scope.collapsed = !!UiTreeHelper.getNodeAttribute(scope, "collapsed") || treeConfig.defaultCollapsed, 
                scope.expandOnHover = !!UiTreeHelper.getNodeAttribute(scope, "expandOnHover"), scope.scrollContainer = UiTreeHelper.getNodeAttribute(scope, "scrollContainer") || attrs.scrollContainer || null, 
                scope.sourceOnly = scope.nodropEnabled || scope.$treeScope.nodropEnabled, scope.$watch(attrs.collapsed, function(val) {
                    "boolean" == typeof val && (scope.collapsed = val);
                }), scope.$watch("collapsed", function(val) {
                    UiTreeHelper.setNodeAttribute(scope, "collapsed", val), attrs.$set("collapsed", val);
                }), scope.$watch(attrs.expandOnHover, function(val) {
                    "boolean" != typeof val && "number" != typeof val || (scope.expandOnHover = val);
                }), scope.$watch("expandOnHover", function(val) {
                    UiTreeHelper.setNodeAttribute(scope, "expandOnHover", val), attrs.$set("expandOnHover", val);
                }), attrs.$observe("scrollContainer", function(val) {
                    "string" == typeof val && (scope.scrollContainer = val);
                }), scope.$watch("scrollContainer", function(val) {
                    UiTreeHelper.setNodeAttribute(scope, "scrollContainer", val), attrs.$set("scrollContainer", val), 
                    scrollContainerElm = document.querySelector(val);
                }), scope.$on("angular-ui-tree:collapse-all", function() {
                    scope.collapsed = !0;
                }), scope.$on("angular-ui-tree:expand-all", function() {
                    scope.collapsed = !1;
                }), dragStart = function(e) {
                    if ((hasTouch || 2 !== e.button && 3 !== e.which) && !(e.uiTreeDragging || e.originalEvent && e.originalEvent.uiTreeDragging)) {
                        var isHandleChild, cloneElm, eventElmTagName, tagName, eventObj, tdElm, hStyle, isTreeNode, isTreeNodeHandle, eventElm = angular.element(e.target);
                        if ((isHandleChild = UiTreeHelper.treeNodeHandlerContainerOfElement(eventElm)) && (eventElm = angular.element(isHandleChild)), 
                        cloneElm = element.clone(), isTreeNode = UiTreeHelper.elementIsTreeNode(eventElm), 
                        isTreeNodeHandle = UiTreeHelper.elementIsTreeNodeHandle(eventElm), (isTreeNode || isTreeNodeHandle) && !(isTreeNode && UiTreeHelper.elementContainsTreeNodeHandler(eventElm) || "input" == (eventElmTagName = eventElm.prop("tagName").toLowerCase()) || "textarea" == eventElmTagName || "button" == eventElmTagName || "select" == eventElmTagName)) {
                            for (el = angular.element(e.target), isUiTreeRoot = el[0].attributes["ui-tree"]; el && el[0] && el[0] !== element && !isUiTreeRoot; ) {
                                if (el[0].attributes && (isUiTreeRoot = el[0].attributes["ui-tree"]), UiTreeHelper.nodrag(el)) return;
                                el = el.parent();
                            }
                            scope.beforeDrag(scope) && (e.uiTreeDragging = !0, e.originalEvent && (e.originalEvent.uiTreeDragging = !0), 
                            e.preventDefault(), eventObj = UiTreeHelper.eventObj(e), firstMoving = !0, dragInfo = UiTreeHelper.dragInfo(scope), 
                            treeOfOrigin = dragInfo.source.$treeScope.$id, "tr" === (tagName = element.prop("tagName")).toLowerCase() ? (placeElm = angular.element($window.document.createElement(tagName)), 
                            tdElm = angular.element($window.document.createElement("td")).addClass(config.placeholderClass).attr("colspan", element[0].children.length), 
                            placeElm.append(tdElm)) : placeElm = angular.element($window.document.createElement(tagName)).addClass(config.placeholderClass), 
                            hiddenPlaceElm = angular.element($window.document.createElement(tagName)), config.hiddenClass && hiddenPlaceElm.addClass(config.hiddenClass), 
                            pos = UiTreeHelper.positionStarted(eventObj, element), placeElm.css("height", element.prop("offsetHeight") + "px"), 
                            (dragElm = angular.element($window.document.createElement(scope.$parentNodesScope.$element.prop("tagName"))).addClass(scope.$parentNodesScope.$element.attr("class")).addClass(config.dragClass)).css("width", UiTreeHelper.width(element) + "px"), 
                            dragElm.css("z-index", 9999), (hStyle = (element[0].querySelector(".angular-ui-tree-handle") || element[0]).currentStyle) && (document.body.setAttribute("ui-tree-cursor", $document.find("body").css("cursor") || ""), 
                            $document.find("body").css({
                                cursor: hStyle.cursor + "!important"
                            })), scope.sourceOnly && placeElm.css("display", "none"), element.after(placeElm), 
                            element.after(hiddenPlaceElm), dragInfo.isClone() && scope.sourceOnly ? dragElm.append(cloneElm) : dragElm.append(element), 
                            $document.find("body").append(dragElm), dragElm.css({
                                left: eventObj.pageX - pos.offsetX + "px",
                                top: eventObj.pageY - pos.offsetY + "px"
                            }), elements = {
                                placeholder: placeElm,
                                dragging: dragElm
                            }, bindDragMoveEvents(), scope.$apply(function() {
                                scope.$treeScope.$callbacks.dragStart(dragInfo.eventArgs(elements, pos));
                            }), document_height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight), 
                            document_width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth));
                        }
                    }
                }, dragMove = function(e) {
                    var prev, leftElmPos, topElmPos, top_scroll, bottom_scroll, scrollContainerElmRect, target, targetX, targetY, displayElm, targetNode, targetElm, isEmpty, scrollDownBy, scrollUpBy, targetOffset, targetBefore, targetBeforeBuffer, targetHeight, targetChildElm, isDropzone, eventObj = UiTreeHelper.eventObj(e);
                    if (dragElm) {
                        if (e.preventDefault(), $window.getSelection ? $window.getSelection().removeAllRanges() : $window.document.selection && $window.document.selection.empty(), 
                        (leftElmPos = eventObj.pageX - pos.offsetX) < 0 && (leftElmPos = 0), (topElmPos = eventObj.pageY - pos.offsetY) < 0 && (topElmPos = 0), 
                        document_height < topElmPos + 10 && (topElmPos = document_height - 10), document_width < leftElmPos + 10 && (leftElmPos = document_width - 10), 
                        dragElm.css({
                            left: leftElmPos + "px",
                            top: topElmPos + "px"
                        }), scrollContainerElm ? (scrollContainerElmRect = scrollContainerElm.getBoundingClientRect(), 
                        bottom_scroll = (top_scroll = scrollContainerElm.scrollTop) + scrollContainerElm.clientHeight, 
                        scrollContainerElmRect.bottom < eventObj.clientY && bottom_scroll < scrollContainerElm.scrollHeight && (scrollDownBy = Math.min(scrollContainerElm.scrollHeight - bottom_scroll, 10), 
                        scrollContainerElm.scrollTop += scrollDownBy), scrollContainerElmRect.top > eventObj.clientY && 0 < top_scroll && (scrollUpBy = Math.min(top_scroll, 10), 
                        scrollContainerElm.scrollTop -= scrollUpBy)) : ((bottom_scroll = (top_scroll = window.pageYOffset || $window.document.documentElement.scrollTop) + (window.innerHeight || $window.document.clientHeight || $window.document.clientHeight)) < eventObj.pageY && bottom_scroll < document_height && (scrollDownBy = Math.min(document_height - bottom_scroll, 10), 
                        window.scrollBy(0, scrollDownBy)), top_scroll > eventObj.pageY && (scrollUpBy = Math.min(top_scroll, 10), 
                        window.scrollBy(0, -scrollUpBy))), UiTreeHelper.positionMoved(e, pos, firstMoving), 
                        firstMoving) return void (firstMoving = !1);
                        if (targetX = eventObj.pageX - ($window.pageXOffset || $window.document.body.scrollLeft || $window.document.documentElement.scrollLeft) - ($window.document.documentElement.clientLeft || 0), 
                        targetY = eventObj.pageY - ($window.pageYOffset || $window.document.body.scrollTop || $window.document.documentElement.scrollTop) - ($window.document.documentElement.clientTop || 0), 
                        angular.isFunction(dragElm.hide) ? dragElm.hide() : (displayElm = dragElm[0].style.display, 
                        dragElm[0].style.display = "none"), $window.document.elementFromPoint(targetX, targetY), 
                        targetElm = angular.element($window.document.elementFromPoint(targetX, targetY)), 
                        (isHandleChild = UiTreeHelper.treeNodeHandlerContainerOfElement(targetElm)) && (targetElm = angular.element(isHandleChild)), 
                        angular.isFunction(dragElm.show) ? dragElm.show() : dragElm[0].style.display = displayElm, 
                        UiTreeHelper.elementIsTree(targetElm) ? targetNode = targetElm.controller("uiTree").scope : UiTreeHelper.elementIsTreeNodeHandle(targetElm) ? targetNode = targetElm.controller("uiTreeHandle").scope : UiTreeHelper.elementIsTreeNode(targetElm) ? targetNode = targetElm.controller("uiTreeNode").scope : UiTreeHelper.elementIsTreeNodes(targetElm) ? targetNode = targetElm.controller("uiTreeNodes").scope : UiTreeHelper.elementIsPlaceholder(targetElm) ? targetNode = targetElm.controller("uiTreeNodes").scope : UiTreeHelper.elementIsDropzone(targetElm) ? (targetNode = targetElm.controller("uiTree").scope, 
                        isDropzone = !0) : targetElm.controller("uiTreeNode") && (targetNode = targetElm.controller("uiTreeNode").scope), 
                        targetNode && targetNode.$treeScope && targetNode.$treeScope.$id && targetNode.$treeScope.$id === treeOfOrigin && pos.dirAx) 0 < pos.distX && (prev = dragInfo.prev()) && !prev.collapsed && prev.accept(scope, prev.childNodesCount()) && (prev.$childNodesScope.$element.append(placeElm), 
                        dragInfo.moveTo(prev.$childNodesScope, prev.childNodes(), prev.childNodesCount())), 
                        pos.distX < 0 && (dragInfo.next() || (target = dragInfo.parentNode()) && target.$parentNodesScope.accept(scope, target.index() + 1) && (target.$element.after(placeElm), 
                        dragInfo.moveTo(target.$parentNodesScope, target.siblings(), target.index() + 1))); else {
                            if (isEmpty = !1, !targetNode) return;
                            if (!targetNode.$treeScope || targetNode.$parent.nodropEnabled || targetNode.$treeScope.nodropEnabled || placeElm.css("display", ""), 
                            "uiTree" === targetNode.$type && targetNode.dragEnabled && (isEmpty = targetNode.isEmpty()), 
                            "uiTreeHandle" === targetNode.$type && (targetNode = targetNode.$nodeScope), "uiTreeNode" !== targetNode.$type && !isEmpty && !isDropzone) return void (config.appendChildOnHover && !dragInfo.next() && unhover && ((target = dragInfo.parentNode()).$element.after(placeElm), 
                            dragInfo.moveTo(target.$parentNodesScope, target.siblings(), target.index() + 1), 
                            unhover = !1));
                            treeScope && placeElm.parent()[0] != treeScope.$element[0] && (treeScope.resetEmptyElement(), 
                            treeScope.resetDropzoneElement(), treeScope = null), isEmpty ? (treeScope = targetNode).$nodesScope.accept(scope, 0) && dragInfo.moveTo(targetNode.$nodesScope, targetNode.$nodesScope.childNodes(), 0) : isDropzone ? (treeScope = targetNode).$nodesScope.accept(scope, targetNode.$nodesScope.childNodes().length) && dragInfo.moveTo(targetNode.$nodesScope, targetNode.$nodesScope.childNodes(), targetNode.$nodesScope.childNodes().length) : targetNode.dragEnabled() && (angular.isDefined(scope.expandTimeoutOn) && scope.expandTimeoutOn !== targetNode.id && ($timeout.cancel(scope.expandTimeout), 
                            delete scope.expandTimeout, delete scope.expandTimeoutOn, scope.$callbacks.expandTimeoutCancel()), 
                            targetNode.collapsed && (!0 === scope.expandOnHover || angular.isNumber(scope.expandOnHover) && 0 === scope.expandOnHover ? (targetNode.collapsed = !1, 
                            targetNode.$treeScope.$callbacks.toggle(!1, targetNode)) : !1 !== scope.expandOnHover && angular.isNumber(scope.expandOnHover) && 0 < scope.expandOnHover && angular.isUndefined(scope.expandTimeoutOn) && (scope.expandTimeoutOn = targetNode.$id, 
                            scope.$callbacks.expandTimeoutStart(), scope.expandTimeout = $timeout(function() {
                                scope.$callbacks.expandTimeoutEnd(), targetNode.collapsed = !1, targetNode.$treeScope.$callbacks.toggle(!1, targetNode);
                            }, scope.expandOnHover))), targetElm = targetNode.$element, targetOffset = UiTreeHelper.offset(targetElm), 
                            targetHeight = UiTreeHelper.height(targetElm), targetHeight -= (targetChildElm = targetNode.$childNodesScope ? targetNode.$childNodesScope.$element : null) ? UiTreeHelper.height(targetChildElm) : 0, 
                            targetBeforeBuffer = config.appendChildOnHover ? .25 * targetHeight : UiTreeHelper.height(targetElm) / 2, 
                            targetBefore = eventObj.pageY < targetOffset.top + targetBeforeBuffer, targetNode.$parentNodesScope.accept(scope, targetNode.index()) ? targetBefore ? (targetElm[0].parentNode.insertBefore(placeElm[0], targetElm[0]), 
                            dragInfo.moveTo(targetNode.$parentNodesScope, targetNode.siblings(), targetNode.index())) : config.appendChildOnHover && targetNode.accept(scope, targetNode.childNodesCount()) ? (targetNode.$childNodesScope.$element.prepend(placeElm), 
                            dragInfo.moveTo(targetNode.$childNodesScope, targetNode.childNodes(), 0), unhover = !0) : (targetElm.after(placeElm), 
                            dragInfo.moveTo(targetNode.$parentNodesScope, targetNode.siblings(), targetNode.index() + 1)) : !targetBefore && targetNode.accept(scope, targetNode.childNodesCount()) && (targetNode.$childNodesScope.$element.append(placeElm), 
                            dragInfo.moveTo(targetNode.$childNodesScope, targetNode.childNodes(), targetNode.childNodesCount())));
                        }
                        scope.$apply(function() {
                            scope.$treeScope.$callbacks.dragMove(dragInfo.eventArgs(elements, pos));
                        });
                    }
                }, dragEnd = function(e) {
                    var dragEventArgs = dragInfo.eventArgs(elements, pos);
                    e.preventDefault(), unbindDragMoveEvents(), $timeout.cancel(scope.expandTimeout), 
                    scope.$treeScope.$apply(function() {
                        $q.when(scope.$treeScope.$callbacks.beforeDrop(dragEventArgs)).then(function(allowDrop) {
                            !1 !== allowDrop && scope.$$allowNodeDrop ? (dragInfo.apply(), scope.$treeScope.$callbacks.dropped(dragEventArgs)) : bindDragStartEvents();
                        }).catch(function() {
                            bindDragStartEvents();
                        }).finally(function() {
                            hiddenPlaceElm.replaceWith(scope.$element), placeElm.remove(), dragElm && (dragElm.remove(), 
                            dragElm = null), scope.$treeScope.$callbacks.dragStop(dragEventArgs), scope.$$allowNodeDrop = !1, 
                            dragInfo = null;
                            var oldCur = document.body.getAttribute("ui-tree-cursor");
                            null !== oldCur && ($document.find("body").css({
                                cursor: oldCur
                            }), document.body.removeAttribute("ui-tree-cursor"));
                        });
                    });
                }, dragStartEvent = function(e) {
                    scope.dragEnabled() && dragStart(e);
                }, dragMoveEvent = function(e) {
                    dragMove(e);
                }, dragEndEvent = function(e) {
                    scope.$$allowNodeDrop = !0, dragEnd(e);
                }, dragCancelEvent = function(e) {
                    dragEnd(e);
                }, dragDelay = {
                    exec: function(fn, ms) {
                        ms || (ms = 0), this.cancel(), to = $timeout(fn, ms);
                    },
                    cancel: function() {
                        $timeout.cancel(to);
                    }
                }, keydownHandler = function(e) {
                    27 === e.keyCode && dragEndEvent(e);
                }, (bindDragStartEvents = function() {
                    element.bind("touchstart mousedown", function(e) {
                        0 < scope.dragDelay ? dragDelay.exec(function() {
                            dragStartEvent(e);
                        }, scope.dragDelay) : dragStartEvent(e);
                    }), element.bind("touchend touchcancel mouseup", function() {
                        0 < scope.dragDelay && dragDelay.cancel();
                    });
                })(), bindDragMoveEvents = function() {
                    angular.element($document).bind("touchend", dragEndEvent), angular.element($document).bind("touchcancel", dragEndEvent), 
                    angular.element($document).bind("touchmove", dragMoveEvent), angular.element($document).bind("mouseup", dragEndEvent), 
                    angular.element($document).bind("mousemove", dragMoveEvent), angular.element($document).bind("mouseleave", dragCancelEvent), 
                    angular.element($document).bind("keydown", keydownHandler);
                }, unbindDragMoveEvents = function() {
                    angular.element($document).unbind("touchend", dragEndEvent), angular.element($document).unbind("touchcancel", dragEndEvent), 
                    angular.element($document).unbind("touchmove", dragMoveEvent), angular.element($document).unbind("mouseup", dragEndEvent), 
                    angular.element($document).unbind("mousemove", dragMoveEvent), angular.element($document).unbind("mouseleave", dragCancelEvent), 
                    angular.element($document).unbind("keydown", keydownHandler);
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.tree").directive("uiTreeNodes", [ "treeConfig", "$window", function(treeConfig) {
        return {
            require: [ "ngModel", "?^uiTreeNode", "^uiTree" ],
            restrict: "A",
            scope: !0,
            controller: "TreeNodesController",
            link: function(scope, element, attrs, controllersArr) {
                var config = {}, ngModel = controllersArr[0], treeNodeCtrl = controllersArr[1], treeCtrl = controllersArr[2];
                angular.extend(config, treeConfig), config.nodesClass && element.addClass(config.nodesClass), 
                treeNodeCtrl ? (treeNodeCtrl.scope.$childNodesScope = scope).$nodeScope = treeNodeCtrl.scope : treeCtrl.scope.$nodesScope = scope, 
                scope.$treeScope = treeCtrl.scope, ngModel && (ngModel.$render = function() {
                    scope.$modelValue = ngModel.$modelValue;
                }), scope.$watch(function() {
                    return attrs.maxDepth;
                }, function(val) {
                    "number" == typeof val && (scope.maxDepth = val);
                }), scope.$watch(function() {
                    return attrs.nodropEnabled;
                }, function(newVal) {
                    void 0 !== newVal && (scope.nodropEnabled = !0);
                }, !0);
            }
        };
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.tree").factory("UiTreeHelper", [ "$document", "$window", "treeConfig", function($document, $window, treeConfig) {
        return {
            nodesData: {},
            setNodeAttribute: function(scope, attrName, val) {
                if (!scope.$modelValue) return null;
                var data = this.nodesData[scope.$modelValue.$$hashKey];
                data || (data = {}, this.nodesData[scope.$modelValue.$$hashKey] = data), data[attrName] = val;
            },
            getNodeAttribute: function(scope, attrName) {
                if (!scope.$modelValue) return null;
                var data = this.nodesData[scope.$modelValue.$$hashKey];
                return data ? data[attrName] : null;
            },
            nodrag: function(targetElm) {
                return void 0 !== targetElm.attr("data-nodrag") && "false" !== targetElm.attr("data-nodrag");
            },
            eventObj: function(e) {
                var obj = e;
                return void 0 !== e.targetTouches ? obj = e.targetTouches.item(0) : void 0 !== e.originalEvent && void 0 !== e.originalEvent.targetTouches && (obj = e.originalEvent.targetTouches.item(0)), 
                obj;
            },
            dragInfo: function(node) {
                return {
                    source: node,
                    sourceInfo: {
                        cloneModel: !0 === node.$treeScope.cloneEnabled ? angular.copy(node.$modelValue) : void 0,
                        nodeScope: node,
                        index: node.index(),
                        nodesScope: node.$parentNodesScope
                    },
                    index: node.index(),
                    siblings: node.siblings().slice(0),
                    parent: node.$parentNodesScope,
                    resetParent: function() {
                        this.parent = node.$parentNodesScope;
                    },
                    moveTo: function(parent, siblings, index) {
                        this.parent = parent, this.siblings = siblings.slice(0);
                        var i = this.siblings.indexOf(this.source);
                        -1 < i && (this.siblings.splice(i, 1), this.source.index() < index && index--), 
                        this.siblings.splice(index, 0, this.source), this.index = index;
                    },
                    parentNode: function() {
                        return this.parent.$nodeScope;
                    },
                    prev: function() {
                        return 0 < this.index ? this.siblings[this.index - 1] : null;
                    },
                    next: function() {
                        return this.index < this.siblings.length - 1 ? this.siblings[this.index + 1] : null;
                    },
                    isClone: function() {
                        return !0 === this.source.$treeScope.cloneEnabled;
                    },
                    clonedNode: function(node) {
                        return angular.copy(node);
                    },
                    isDirty: function() {
                        return this.source.$parentNodesScope != this.parent || this.source.index() != this.index;
                    },
                    isForeign: function() {
                        return this.source.$treeScope !== this.parent.$treeScope;
                    },
                    eventArgs: function(elements, pos) {
                        return {
                            source: this.sourceInfo,
                            dest: {
                                index: this.index,
                                nodesScope: this.parent
                            },
                            elements: elements,
                            pos: pos
                        };
                    },
                    apply: function() {
                        var nodeData = this.source.$modelValue;
                        this.parent.nodropEnabled || this.parent.$treeScope.nodropEnabled || this.isDirty() && (this.isClone() && this.isForeign() ? this.parent.insertNode(this.index, this.sourceInfo.cloneModel) : (this.source.remove(), 
                        this.parent.insertNode(this.index, nodeData)));
                    }
                };
            },
            height: function(element) {
                return element.prop("scrollHeight");
            },
            width: function(element) {
                return element.prop("scrollWidth");
            },
            offset: function(element) {
                var boundingClientRect = element[0].getBoundingClientRect();
                return {
                    width: element.prop("offsetWidth"),
                    height: element.prop("offsetHeight"),
                    top: boundingClientRect.top + ($window.pageYOffset || $document[0].body.scrollTop || $document[0].documentElement.scrollTop),
                    left: boundingClientRect.left + ($window.pageXOffset || $document[0].body.scrollLeft || $document[0].documentElement.scrollLeft)
                };
            },
            positionStarted: function(e, target) {
                var pos = {}, pageX = e.pageX, pageY = e.pageY;
                return e.originalEvent && e.originalEvent.touches && 0 < e.originalEvent.touches.length && (pageX = e.originalEvent.touches[0].pageX, 
                pageY = e.originalEvent.touches[0].pageY), pos.offsetX = pageX - this.offset(target).left, 
                pos.offsetY = pageY - this.offset(target).top, pos.startX = pos.lastX = pageX, pos.startY = pos.lastY = pageY, 
                pos.nowX = pos.nowY = pos.distX = pos.distY = pos.dirAx = 0, pos.dirX = pos.dirY = pos.lastDirX = pos.lastDirY = pos.distAxX = pos.distAxY = 0, 
                pos;
            },
            positionMoved: function(e, pos, firstMoving) {
                var newAx, pageX = e.pageX, pageY = e.pageY;
                if (e.originalEvent && e.originalEvent.touches && 0 < e.originalEvent.touches.length && (pageX = e.originalEvent.touches[0].pageX, 
                pageY = e.originalEvent.touches[0].pageY), pos.lastX = pos.nowX, pos.lastY = pos.nowY, 
                pos.nowX = pageX, pos.nowY = pageY, pos.distX = pos.nowX - pos.lastX, pos.distY = pos.nowY - pos.lastY, 
                pos.lastDirX = pos.dirX, pos.lastDirY = pos.dirY, pos.dirX = 0 === pos.distX ? 0 : 0 < pos.distX ? 1 : -1, 
                pos.dirY = 0 === pos.distY ? 0 : 0 < pos.distY ? 1 : -1, newAx = Math.abs(pos.distX) > Math.abs(pos.distY) ? 1 : 0, 
                firstMoving) return pos.dirAx = newAx, void (pos.moving = !0);
                pos.dirAx !== newAx ? (pos.distAxX = 0, pos.distAxY = 0) : (pos.distAxX += Math.abs(pos.distX), 
                0 !== pos.dirX && pos.dirX !== pos.lastDirX && (pos.distAxX = 0), pos.distAxY += Math.abs(pos.distY), 
                0 !== pos.dirY && pos.dirY !== pos.lastDirY && (pos.distAxY = 0)), pos.dirAx = newAx;
            },
            elementIsTreeNode: function(element) {
                return void 0 !== element.attr("ui-tree-node");
            },
            elementIsTreeNodeHandle: function(element) {
                return void 0 !== element.attr("ui-tree-handle");
            },
            elementIsTree: function(element) {
                return void 0 !== element.attr("ui-tree");
            },
            elementIsTreeNodes: function(element) {
                return void 0 !== element.attr("ui-tree-nodes");
            },
            elementIsPlaceholder: function(element) {
                return element.hasClass(treeConfig.placeholderClass);
            },
            elementIsDropzone: function(element) {
                return element.hasClass(treeConfig.dropzoneClass);
            },
            elementContainsTreeNodeHandler: function(element) {
                return 1 <= element[0].querySelectorAll("[ui-tree-handle]").length;
            },
            treeNodeHandlerContainerOfElement: function(element) {
                return function(attributeName, childObj) {
                    if (void 0 === childObj) return null;
                    var testObj = childObj.parentNode, res = "function" == typeof testObj.setAttribute && testObj.hasAttribute(attributeName) ? testObj : null;
                    for (;testObj && "function" == typeof testObj.setAttribute && !testObj.hasAttribute(attributeName); ) {
                        if (testObj = testObj.parentNode, (res = testObj) === document.documentElement) {
                            res = null;
                            break;
                        }
                        0;
                    }
                    return res;
                }("ui-tree-handle", element[0]);
            }
        };
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.grid.i18n", []), angular.module("ui.grid", [ "ui.grid.i18n" ]);
}(), function() {
    "use strict";
    angular.module("ui.grid").constant("uiGridConstants", {
        LOG_DEBUG_MESSAGES: !0,
        LOG_WARN_MESSAGES: !0,
        LOG_ERROR_MESSAGES: !0,
        CUSTOM_FILTERS: /CUSTOM_FILTERS/g,
        COL_FIELD: /COL_FIELD/g,
        MODEL_COL_FIELD: /MODEL_COL_FIELD/g,
        TOOLTIP: /title=\"TOOLTIP\"/g,
        DISPLAY_CELL_TEMPLATE: /DISPLAY_CELL_TEMPLATE/g,
        TEMPLATE_REGEXP: /<.+>/,
        FUNC_REGEXP: /(\([^)]*\))?$/,
        DOT_REGEXP: /\./g,
        APOS_REGEXP: /'/g,
        BRACKET_REGEXP: /^(.*)((?:\s*\[\s*\d+\s*\]\s*)|(?:\s*\[\s*"(?:[^"\\]|\\.)*"\s*\]\s*)|(?:\s*\[\s*'(?:[^'\\]|\\.)*'\s*\]\s*))(.*)$/,
        COL_CLASS_PREFIX: "ui-grid-col",
        ENTITY_BINDING: "$$this",
        events: {
            GRID_SCROLL: "uiGridScroll",
            COLUMN_MENU_SHOWN: "uiGridColMenuShown",
            ITEM_DRAGGING: "uiGridItemDragStart",
            COLUMN_HEADER_CLICK: "uiGridColumnHeaderClick"
        },
        keymap: {
            TAB: 9,
            STRG: 17,
            CAPSLOCK: 20,
            CTRL: 17,
            CTRLRIGHT: 18,
            CTRLR: 18,
            SHIFT: 16,
            RETURN: 13,
            ENTER: 13,
            BACKSPACE: 8,
            BCKSP: 8,
            ALT: 18,
            ALTR: 17,
            ALTRIGHT: 17,
            SPACE: 32,
            WIN: 91,
            MAC: 91,
            FN: null,
            PG_UP: 33,
            PG_DOWN: 34,
            UP: 38,
            DOWN: 40,
            LEFT: 37,
            RIGHT: 39,
            ESC: 27,
            DEL: 46,
            F1: 112,
            F2: 113,
            F3: 114,
            F4: 115,
            F5: 116,
            F6: 117,
            F7: 118,
            F8: 119,
            F9: 120,
            F10: 121,
            F11: 122,
            F12: 123
        },
        ASC: "asc",
        DESC: "desc",
        filter: {
            STARTS_WITH: 2,
            ENDS_WITH: 4,
            EXACT: 8,
            CONTAINS: 16,
            GREATER_THAN: 32,
            GREATER_THAN_OR_EQUAL: 64,
            LESS_THAN: 128,
            LESS_THAN_OR_EQUAL: 256,
            NOT_EQUAL: 512,
            SELECT: "select",
            INPUT: "input"
        },
        aggregationTypes: {
            sum: 2,
            count: 4,
            avg: 8,
            min: 16,
            max: 32
        },
        CURRENCY_SYMBOLS: [ "¤", "؋", "Ar", "Ƀ", "฿", "B/.", "Br", "Bs.", "Bs.F.", "GH₵", "¢", "c", "Ch.", "₡", "C$", "D", "ден", "دج", ".د.ب", "د.ع", "JD", "د.ك", "ل.د", "дин", "د.ت", "د.م.", "د.إ", "Db", "$", "₫", "Esc", "€", "ƒ", "Ft", "FBu", "FCFA", "CFA", "Fr", "FRw", "G", "gr", "₲", "h", "₴", "₭", "Kč", "kr", "kn", "MK", "ZK", "Kz", "K", "L", "Le", "лв", "E", "lp", "M", "KM", "MT", "₥", "Nfk", "₦", "Nu.", "UM", "T$", "MOP$", "₱", "Pt.", "£", "ج.م.", "LL", "LS", "P", "Q", "q", "R", "R$", "ر.ع.", "ر.ق", "ر.س", "៛", "RM", "p", "Rf.", "₹", "₨", "SRe", "Rp", "₪", "Ksh", "Sh.So.", "USh", "S/", "SDR", "сом", "৳\t", "WS$", "₮", "VT", "₩", "¥", "zł" ],
        scrollDirection: {
            UP: "up",
            DOWN: "down",
            LEFT: "left",
            RIGHT: "right",
            NONE: "none"
        },
        dataChange: {
            ALL: "all",
            EDIT: "edit",
            ROW: "row",
            COLUMN: "column",
            OPTIONS: "options"
        },
        scrollbars: {
            NEVER: 0,
            ALWAYS: 1,
            WHEN_NEEDED: 2
        }
    });
}(), angular.module("ui.grid").directive("uiGridCell", [ "$compile", "$parse", "gridUtil", "uiGridConstants", function($compile, $parse, gridUtil, uiGridConstants) {
    return {
        priority: 0,
        scope: !1,
        require: "?^uiGrid",
        compile: function() {
            return {
                pre: function($scope, $elm, $attrs, uiGridCtrl) {
                    if (uiGridCtrl && $scope.col.compiledElementFn) (0, $scope.col.compiledElementFn)($scope, function(clonedElement, scope) {
                        $elm.append(clonedElement);
                    }); else if (uiGridCtrl && !$scope.col.compiledElementFn) $scope.col.getCompiledElementFn().then(function(compiledElementFn) {
                        compiledElementFn($scope, function(clonedElement, scope) {
                            $elm.append(clonedElement);
                        });
                    }).catch(angular.noop); else {
                        var html = $scope.col.cellTemplate.replace(uiGridConstants.MODEL_COL_FIELD, "row.entity." + gridUtil.preEval($scope.col.field)).replace(uiGridConstants.COL_FIELD, "grid.getCellValue(row, col)"), cellElement = $compile(html)($scope);
                        $elm.append(cellElement);
                    }
                },
                post: function($scope, $elm, $attrs, uiGridCtrl) {
                    var classAdded, initColClass = $scope.col.getColClass(!1);
                    $elm.addClass(initColClass);
                    var updateClass = function(grid) {
                        var contents = $elm;
                        classAdded && (contents.removeClass(classAdded), classAdded = null), classAdded = angular.isFunction($scope.col.cellClass) ? $scope.col.cellClass($scope.grid, $scope.row, $scope.col, $scope.rowRenderIndex, $scope.colRenderIndex) : $scope.col.cellClass, 
                        contents.addClass(classAdded);
                    };
                    $scope.col.cellClass && updateClass();
                    var dataChangeDereg = $scope.grid.registerDataChangeCallback(updateClass, [ uiGridConstants.dataChange.COLUMN, uiGridConstants.dataChange.EDIT ]), rowWatchDereg = $scope.$watch("row", function(n, o) {
                        if (n !== o) {
                            (classAdded || $scope.col.cellClass) && updateClass();
                            var newColClass = $scope.col.getColClass(!1);
                            newColClass !== initColClass && ($elm.removeClass(initColClass), $elm.addClass(newColClass), 
                            initColClass = newColClass);
                        }
                    }), deregisterFunction = function() {
                        dataChangeDereg(), rowWatchDereg();
                    };
                    $scope.$on("$destroy", deregisterFunction), $elm.on("$destroy", deregisterFunction);
                }
            };
        }
    };
} ]), angular.module("ui.grid").service("uiGridColumnMenuService", [ "i18nService", "uiGridConstants", "gridUtil", function(i18nService, uiGridConstants, gridUtil) {
    var service = {
        initialize: function($scope, uiGridCtrl) {
            $scope.grid = uiGridCtrl.grid, (uiGridCtrl.columnMenuScope = $scope).menuShown = !1;
        },
        setColMenuItemWatch: function($scope) {
            var deregFunction = $scope.$watch("col.menuItems", function(n) {
                void 0 !== n && n && angular.isArray(n) ? (n.forEach(function(item) {
                    void 0 !== item.context && item.context || (item.context = {}), item.context.col = $scope.col;
                }), $scope.menuItems = $scope.defaultMenuItems.concat(n)) : $scope.menuItems = $scope.defaultMenuItems;
            });
            $scope.$on("$destroy", deregFunction);
        },
        sortable: function($scope) {
            return !!($scope.grid.options.enableSorting && void 0 !== $scope.col && $scope.col && $scope.col.enableSorting);
        },
        isActiveSort: function($scope, direction) {
            return void 0 !== $scope.col && void 0 !== $scope.col.sort && void 0 !== $scope.col.sort.direction && $scope.col.sort.direction === direction;
        },
        suppressRemoveSort: function($scope) {
            return !(!$scope.col || !$scope.col.suppressRemoveSort);
        },
        hideable: function($scope) {
            return void 0 === $scope.col || !$scope.col || !$scope.col.colDef || !1 !== $scope.col.colDef.enableHiding;
        },
        getDefaultMenuItems: function($scope) {
            return [ {
                title: function() {
                    return i18nService.getSafeText("sort.ascending");
                },
                icon: "ui-grid-icon-sort-alt-up",
                action: function($event) {
                    $event.stopPropagation(), $scope.sortColumn($event, uiGridConstants.ASC);
                },
                shown: function() {
                    return service.sortable($scope);
                },
                active: function() {
                    return service.isActiveSort($scope, uiGridConstants.ASC);
                }
            }, {
                title: function() {
                    return i18nService.getSafeText("sort.descending");
                },
                icon: "ui-grid-icon-sort-alt-down",
                action: function($event) {
                    $event.stopPropagation(), $scope.sortColumn($event, uiGridConstants.DESC);
                },
                shown: function() {
                    return service.sortable($scope);
                },
                active: function() {
                    return service.isActiveSort($scope, uiGridConstants.DESC);
                }
            }, {
                title: function() {
                    return i18nService.getSafeText("sort.remove");
                },
                icon: "ui-grid-icon-cancel",
                action: function($event) {
                    $event.stopPropagation(), $scope.unsortColumn();
                },
                shown: function() {
                    return service.sortable($scope) && void 0 !== $scope.col && void 0 !== $scope.col.sort && void 0 !== $scope.col.sort.direction && null !== $scope.col.sort.direction && !service.suppressRemoveSort($scope);
                }
            }, {
                title: function() {
                    return i18nService.getSafeText("column.hide");
                },
                icon: "ui-grid-icon-cancel",
                shown: function() {
                    return service.hideable($scope);
                },
                action: function($event) {
                    $event.stopPropagation(), $scope.hideColumn();
                }
            } ];
        },
        getColumnElementPosition: function($scope, column, $columnElement) {
            var positionData = {};
            return positionData.left = $columnElement[0].offsetLeft, positionData.top = $columnElement[0].offsetTop, 
            positionData.parentLeft = $columnElement[0].offsetParent.offsetLeft, positionData.offset = 0, 
            column.grid.options.offsetLeft && (positionData.offset = column.grid.options.offsetLeft), 
            positionData.height = gridUtil.elementHeight($columnElement, !0), positionData.width = gridUtil.elementWidth($columnElement, !0), 
            positionData;
        },
        repositionMenu: function($scope, column, positionData, $elm, $columnElement) {
            var menu = $elm[0].querySelectorAll(".ui-grid-menu"), renderContainerElm = gridUtil.closestElm($columnElement, ".ui-grid-render-container"), renderContainerOffset = renderContainerElm.getBoundingClientRect().left - $scope.grid.element[0].getBoundingClientRect().left, containerScrollLeft = renderContainerElm.querySelectorAll(".ui-grid-viewport")[0].scrollLeft, myWidth = gridUtil.elementWidth(menu, !0), paddingRight = column.lastMenuPaddingRight ? column.lastMenuPaddingRight : $scope.lastMenuPaddingRight ? $scope.lastMenuPaddingRight : 10;
            0 !== menu.length && 0 !== menu[0].querySelectorAll(".ui-grid-menu-mid").length && (paddingRight = parseInt(gridUtil.getStyles(angular.element(menu)[0]).paddingRight, 10), 
            $scope.lastMenuPaddingRight = paddingRight, column.lastMenuPaddingRight = paddingRight);
            var left = positionData.left + renderContainerOffset - containerScrollLeft + positionData.parentLeft + positionData.width + paddingRight;
            left < positionData.offset + myWidth && (left = Math.max(positionData.left - containerScrollLeft + positionData.parentLeft - paddingRight + myWidth, positionData.offset + myWidth)), 
            $elm.css("left", left + "px"), $elm.css("top", positionData.top + positionData.height + "px");
        }
    };
    return service;
} ]).directive("uiGridColumnMenu", [ "$timeout", "gridUtil", "uiGridConstants", "uiGridColumnMenuService", "$document", function($timeout, gridUtil, uiGridConstants, uiGridColumnMenuService, $document) {
    return {
        priority: 0,
        scope: !0,
        require: "^uiGrid",
        templateUrl: "ui-grid/uiGridColumnMenu",
        replace: !0,
        link: function($scope, $elm, $attrs, uiGridCtrl) {
            uiGridColumnMenuService.initialize($scope, uiGridCtrl), $scope.defaultMenuItems = uiGridColumnMenuService.getDefaultMenuItems($scope), 
            $scope.menuItems = $scope.defaultMenuItems, uiGridColumnMenuService.setColMenuItemWatch($scope), 
            $scope.showMenu = function(column, $columnElement, event) {
                $scope.col = column;
                var colElementPosition = uiGridColumnMenuService.getColumnElementPosition($scope, column, $columnElement);
                $scope.menuShown ? ($scope.colElement = $columnElement, $scope.colElementPosition = colElementPosition, 
                $scope.hideThenShow = !0, $scope.$broadcast("hide-menu", {
                    originalEvent: event
                })) : ($scope.menuShown = !0, $scope.colElement = $columnElement, $scope.colElementPosition = colElementPosition, 
                $scope.$broadcast("show-menu", {
                    originalEvent: event
                }));
            }, $scope.hideMenu = function(broadcastTrigger) {
                $scope.menuShown = !1, broadcastTrigger || $scope.$broadcast("hide-menu");
            }, $scope.$on("menu-hidden", function() {
                var menuItems = angular.element($elm[0].querySelector(".ui-grid-menu-items"))[0];
                $elm[0].removeAttribute("style"), $scope.hideThenShow ? (delete $scope.hideThenShow, 
                $scope.$broadcast("show-menu"), $scope.menuShown = !0) : ($scope.hideMenu(!0), $scope.col && gridUtil.focus.bySelector($document, ".ui-grid-header-cell." + $scope.col.getColClass() + " .ui-grid-column-menu-button", $scope.col.grid, !1)), 
                menuItems && (menuItems.onkeydown = null, angular.forEach(menuItems.children, function(item) {
                    item.onkeydown = null;
                }));
            }), $scope.$on("menu-shown", function() {
                $timeout(function() {
                    uiGridColumnMenuService.repositionMenu($scope, $scope.col, $scope.colElementPosition, $elm, $scope.colElement), 
                    gridUtil.focus.bySelector($document, ".ui-grid-menu-items .ui-grid-menu-item:not(.ng-hide)", !0), 
                    delete $scope.colElementPosition, delete $scope.columnElement, function() {
                        var menuItems, menu = angular.element($elm[0].querySelector(".ui-grid-menu-items"))[0], visibleMenuItems = [];
                        function circularFocusHandler(event, isSingleItem, shiftKeyStatus, index) {
                            event.keyCode === uiGridConstants.keymap.TAB && (isSingleItem ? event.preventDefault() : shiftKeyStatus && (event.preventDefault(), 
                            visibleMenuItems[index].focus()));
                        }
                        menu && (menu.onkeydown = function(event) {
                            event.keyCode === uiGridConstants.keymap.ESC && (event.preventDefault(), $scope.hideMenu());
                        }, menuItems = menu.querySelectorAll(".ui-grid-menu-item:not(.ng-hide)"), angular.forEach(menuItems, function(item) {
                            null !== item.offsetParent && this.push(item);
                        }, visibleMenuItems), visibleMenuItems.length && (1 === visibleMenuItems.length ? visibleMenuItems[0].onkeydown = function(event) {
                            circularFocusHandler(event, !0);
                        } : (visibleMenuItems[0].onkeydown = function(event) {
                            circularFocusHandler(event, !1, event.shiftKey, visibleMenuItems.length - 1);
                        }, visibleMenuItems[visibleMenuItems.length - 1].onkeydown = function(event) {
                            circularFocusHandler(event, !1, !event.shiftKey, 0);
                        })));
                    }();
                });
            }), $scope.sortColumn = function(event, dir) {
                event.stopPropagation(), $scope.grid.sortColumn($scope.col, dir, !0).then(function() {
                    $scope.grid.refresh(), $scope.hideMenu();
                }).catch(angular.noop);
            }, $scope.unsortColumn = function() {
                $scope.col.unsort(), $scope.grid.refresh(), $scope.hideMenu();
            }, $scope.hideColumn = function() {
                $scope.col.colDef.visible = !1, $scope.col.visible = !1, $scope.grid.queueGridRefresh(), 
                $scope.hideMenu(), $scope.grid.api.core.notifyDataChange(uiGridConstants.dataChange.COLUMN), 
                $scope.grid.api.core.raise.columnVisibilityChanged($scope.col), $timeout(function() {
                    var thisIndex, previousVisibleCol, focusToGridMenu = function() {
                        return gridUtil.focus.byId("grid-menu", $scope.grid);
                    };
                    if ($scope.grid.columns.some(function(element, index) {
                        if (angular.equals(element, $scope.col)) return thisIndex = index, !0;
                    }), $scope.grid.columns.some(function(element, index) {
                        if (!element.visible) return !1;
                        if (index < thisIndex) previousVisibleCol = element; else {
                            if (thisIndex < index && !previousVisibleCol) return previousVisibleCol = element, 
                            !0;
                            if (thisIndex < index && previousVisibleCol) return !0;
                        }
                    }), previousVisibleCol) {
                        var colClass = previousVisibleCol.getColClass();
                        gridUtil.focus.bySelector($document, ".ui-grid-header-cell." + colClass + " .ui-grid-header-cell-primary-focus", !0).then(angular.noop, function(reason) {
                            if ("canceled" !== reason) return focusToGridMenu();
                        }).catch(angular.noop);
                    } else focusToGridMenu();
                });
            };
        },
        controller: [ "$scope", function($scope) {
            var self = this;
            $scope.$watch("menuItems", function(n) {
                self.menuItems = n;
            });
        } ]
    };
} ]), function() {
    "use strict";
    angular.module("ui.grid").directive("uiGridFilter", [ "$compile", "$templateCache", "i18nService", "gridUtil", function($compile, $templateCache, i18nService, gridUtil) {
        return {
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, controllers) {
                        $scope.col.updateFilters = function(filterable) {
                            if ($elm.children().remove(), filterable) {
                                var template = $scope.col.filterHeaderTemplate;
                                void 0 === template && "" !== $scope.col.providedFilterHeaderTemplate ? $scope.col.filterHeaderTemplatePromise && $scope.col.filterHeaderTemplatePromise.then(function() {
                                    template = $scope.col.filterHeaderTemplate, $elm.append($compile(template)($scope));
                                }) : $elm.append($compile(template)($scope));
                            }
                        }, $scope.$on("$destroy", function() {
                            delete $scope.col.updateFilters;
                        });
                    },
                    post: function($scope, $elm, $attrs, controllers) {
                        $scope.aria = i18nService.getSafeText("headerCell.aria"), $scope.removeFilter = function(colFilter, index) {
                            colFilter.term = null, gridUtil.focus.bySelector($elm, ".ui-grid-filter-input-" + index);
                        };
                    }
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.grid").directive("uiGridFooterCell", [ "$timeout", "gridUtil", "uiGridConstants", "$compile", function($timeout, gridUtil, uiGridConstants, $compile) {
        return {
            priority: 0,
            scope: {
                col: "=",
                row: "=",
                renderIndex: "="
            },
            replace: !0,
            require: "^uiGrid",
            compile: function(tElement, tAttrs, transclude) {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        var template = $scope.col.footerCellTemplate;
                        void 0 === template && "" !== $scope.col.providedFooterCellTemplate ? $scope.col.footerCellTemplatePromise && $scope.col.footerCellTemplatePromise.then(function() {
                            template = $scope.col.footerCellTemplate, $elm.append($compile(template)($scope));
                        }) : $elm.append($compile(template)($scope));
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {
                        $scope.grid = uiGridCtrl.grid;
                        var classAdded, initColClass = $scope.col.getColClass(!1);
                        $elm.addClass(initColClass);
                        var updateClass = function(grid) {
                            var contents = $elm;
                            classAdded && (contents.removeClass(classAdded), classAdded = null), classAdded = angular.isFunction($scope.col.footerCellClass) ? $scope.col.footerCellClass($scope.grid, $scope.row, $scope.col, $scope.rowRenderIndex, $scope.colRenderIndex) : $scope.col.footerCellClass, 
                            contents.addClass(classAdded);
                        };
                        $scope.col.footerCellClass && updateClass(), $scope.col.updateAggregationValue();
                        var dataChangeDereg = $scope.grid.registerDataChangeCallback(updateClass, [ uiGridConstants.dataChange.COLUMN ]);
                        $scope.grid.api.core.on.rowsRendered($scope, $scope.col.updateAggregationValue), 
                        $scope.grid.api.core.on.rowsRendered($scope, updateClass), $scope.$on("$destroy", dataChangeDereg);
                    }
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.grid").directive("uiGridFooter", [ "$templateCache", "$compile", "uiGridConstants", "gridUtil", "$timeout", function($templateCache, $compile, uiGridConstants, gridUtil, $timeout) {
        return {
            restrict: "EA",
            replace: !0,
            require: [ "^uiGrid", "^uiGridRenderContainer" ],
            scope: !0,
            compile: function($elm, $attrs) {
                return {
                    pre: function($scope, $elm, $attrs, controllers) {
                        var uiGridCtrl = controllers[0], containerCtrl = controllers[1];
                        $scope.grid = uiGridCtrl.grid, $scope.colContainer = containerCtrl.colContainer, 
                        containerCtrl.footer = $elm;
                        var footerTemplate = $scope.grid.options.footerTemplate;
                        gridUtil.getTemplate(footerTemplate).then(function(contents) {
                            var template = angular.element(contents), newElm = $compile(template)($scope);
                            if ($elm.append(newElm), containerCtrl) {
                                var footerViewport = $elm[0].getElementsByClassName("ui-grid-footer-viewport")[0];
                                footerViewport && (containerCtrl.footerViewport = footerViewport);
                            }
                        }).catch(angular.noop);
                    },
                    post: function($scope, $elm, $attrs, controllers) {
                        var uiGridCtrl = controllers[0], containerCtrl = controllers[1];
                        uiGridCtrl.grid;
                        gridUtil.disableAnimations($elm);
                        var footerViewport = (containerCtrl.footer = $elm)[0].getElementsByClassName("ui-grid-footer-viewport")[0];
                        footerViewport && (containerCtrl.footerViewport = footerViewport);
                    }
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.grid").directive("uiGridGridFooter", [ "$templateCache", "$compile", "uiGridConstants", "gridUtil", "$timeout", function($templateCache, $compile, uiGridConstants, gridUtil, $timeout) {
        return {
            restrict: "EA",
            replace: !0,
            require: "^uiGrid",
            scope: !0,
            compile: function($elm, $attrs) {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        $scope.grid = uiGridCtrl.grid;
                        var footerTemplate = $scope.grid.options.gridFooterTemplate;
                        gridUtil.getTemplate(footerTemplate).then(function(contents) {
                            var template = angular.element(contents), newElm = $compile(template)($scope);
                            $elm.append(newElm);
                        }).catch(angular.noop);
                    },
                    post: function($scope, $elm, $attrs, controllers) {}
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.grid").directive("uiGridHeaderCell", [ "$compile", "$timeout", "$window", "$document", "gridUtil", "uiGridConstants", "ScrollEvent", "i18nService", function($compile, $timeout, $window, $document, gridUtil, uiGridConstants, ScrollEvent, i18nService) {
        return {
            priority: 0,
            scope: {
                col: "=",
                row: "=",
                renderIndex: "="
            },
            require: [ "^uiGrid", "^uiGridRenderContainer" ],
            replace: !0,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs) {
                        var template = $scope.col.headerCellTemplate;
                        void 0 === template && "" !== $scope.col.providedHeaderCellTemplate ? $scope.col.headerCellTemplatePromise && $scope.col.headerCellTemplatePromise.then(function() {
                            template = $scope.col.headerCellTemplate, $elm.append($compile(template)($scope));
                        }) : $elm.append($compile(template)($scope));
                    },
                    post: function($scope, $elm, $attrs, controllers) {
                        var uiGridCtrl = controllers[0], renderContainerCtrl = controllers[1];
                        $scope.i18n = {
                            headerCell: i18nService.getSafeText("headerCell"),
                            sort: i18nService.getSafeText("sort")
                        }, $scope.isSortPriorityVisible = function() {
                            return angular.isNumber($scope.col.sort.priority) && $scope.grid.columns.some(function(element, index) {
                                return angular.isNumber(element.sort.priority) && element !== $scope.col;
                            });
                        }, $scope.getSortDirectionAriaLabel = function() {
                            var col = $scope.col, label = col.sort.direction === uiGridConstants.ASC ? $scope.i18n.sort.ascending : col.sort.direction === uiGridConstants.DESC ? $scope.i18n.sort.descending : $scope.i18n.sort.none;
                            return $scope.isSortPriorityVisible() && (label = label + ". " + $scope.i18n.headerCell.priority + " " + (col.sort.priority + 1)), 
                            label;
                        }, $scope.grid = uiGridCtrl.grid, $scope.renderContainer = uiGridCtrl.grid.renderContainers[renderContainerCtrl.containerId];
                        var initColClass = $scope.col.getColClass(!1);
                        $elm.addClass(initColClass), $scope.menuShown = !1, $scope.asc = uiGridConstants.ASC, 
                        $scope.desc = uiGridConstants.DESC;
                        angular.element($elm[0].querySelectorAll(".ui-grid-header-cell-menu"));
                        var classAdded, previousMouseX, $contentsElm = angular.element($elm[0].querySelectorAll(".ui-grid-cell-contents")), filterDeregisters = [];
                        $scope.downFn = function(event) {
                            event.stopPropagation(), void 0 !== event.originalEvent && void 0 !== event.originalEvent && (event = event.originalEvent), 
                            event.button && 0 !== event.button || (previousMouseX = event.pageX, $scope.mousedownStartTime = new Date().getTime(), 
                            $scope.mousedownTimeout = $timeout(function() {}, 500), $scope.mousedownTimeout.then(function() {
                                $scope.colMenu && uiGridCtrl.columnMenuScope.showMenu($scope.col, $elm, event);
                            }).catch(angular.noop), uiGridCtrl.fireEvent(uiGridConstants.events.COLUMN_HEADER_CLICK, {
                                event: event,
                                columnName: $scope.col.colDef.name
                            }), $scope.offAllEvents(), "touchstart" === event.type ? ($document.on("touchend", $scope.upFn), 
                            $document.on("touchmove", $scope.moveFn)) : "mousedown" === event.type && ($document.on("mouseup", $scope.upFn), 
                            $document.on("mousemove", $scope.moveFn)));
                        }, $scope.upFn = function(event) {
                            event.stopPropagation(), $timeout.cancel($scope.mousedownTimeout), $scope.offAllEvents(), 
                            $scope.onDownEvents(event.type), 500 < new Date().getTime() - $scope.mousedownStartTime || $scope.sortable && $scope.handleClick(event);
                        }, $scope.handleKeyDown = function(event) {
                            32 === event.keyCode && event.preventDefault();
                        }, $scope.moveFn = function(event) {
                            0 !== event.pageX - previousMouseX && ($timeout.cancel($scope.mousedownTimeout), 
                            $scope.offAllEvents(), $scope.onDownEvents(event.type));
                        }, $scope.clickFn = function(event) {
                            event.stopPropagation(), $contentsElm.off("click", $scope.clickFn);
                        }, $scope.offAllEvents = function() {
                            $contentsElm.off("touchstart", $scope.downFn), $contentsElm.off("mousedown", $scope.downFn), 
                            $document.off("touchend", $scope.upFn), $document.off("mouseup", $scope.upFn), $document.off("touchmove", $scope.moveFn), 
                            $document.off("mousemove", $scope.moveFn), $contentsElm.off("click", $scope.clickFn);
                        }, $scope.onDownEvents = function(type) {
                            switch (type) {
                              case "touchmove":
                              case "touchend":
                                $contentsElm.on("click", $scope.clickFn), $contentsElm.on("touchstart", $scope.downFn), 
                                $timeout(function() {
                                    $contentsElm.on("mousedown", $scope.downFn);
                                }, 500);
                                break;

                              case "mousemove":
                              case "mouseup":
                                $contentsElm.on("click", $scope.clickFn), $contentsElm.on("mousedown", $scope.downFn), 
                                $timeout(function() {
                                    $contentsElm.on("touchstart", $scope.downFn);
                                }, 500);
                                break;

                              default:
                                $contentsElm.on("click", $scope.clickFn), $contentsElm.on("touchstart", $scope.downFn), 
                                $contentsElm.on("mousedown", $scope.downFn);
                            }
                        };
                        var updateHeaderOptions = function(grid) {
                            var contents = $elm;
                            classAdded && (contents.removeClass(classAdded), classAdded = null), classAdded = angular.isFunction($scope.col.headerCellClass) ? $scope.col.headerCellClass($scope.grid, $scope.row, $scope.col, $scope.rowRenderIndex, $scope.colRenderIndex) : $scope.col.headerCellClass, 
                            contents.addClass(classAdded), $scope.$applyAsync(function() {
                                var rightMostContainer = $scope.grid.renderContainers.right && $scope.grid.renderContainers.right.visibleColumnCache.length ? $scope.grid.renderContainers.right : $scope.grid.renderContainers.body;
                                $scope.isLastCol = uiGridCtrl.grid.options && uiGridCtrl.grid.options.enableGridMenu && $scope.col === rightMostContainer.visibleColumnCache[rightMostContainer.visibleColumnCache.length - 1];
                            }), $scope.sortable = Boolean($scope.col.enableSorting);
                            var oldFilterable = $scope.filterable;
                            $scope.filterable = Boolean(uiGridCtrl.grid.options.enableFiltering && $scope.col.enableFiltering), 
                            oldFilterable !== $scope.filterable && (void 0 !== $scope.col.updateFilters && $scope.col.updateFilters($scope.filterable), 
                            $scope.filterable ? ($scope.col.filters.forEach(function(filter, i) {
                                filterDeregisters.push($scope.$watch("col.filters[" + i + "].term", function(n, o) {
                                    n !== o && (uiGridCtrl.grid.api.core.raise.filterChanged(), uiGridCtrl.grid.api.core.notifyDataChange(uiGridConstants.dataChange.COLUMN), 
                                    uiGridCtrl.grid.queueGridRefresh());
                                }));
                            }), $scope.$on("$destroy", function() {
                                filterDeregisters.forEach(function(filterDeregister) {
                                    filterDeregister();
                                });
                            })) : filterDeregisters.forEach(function(filterDeregister) {
                                filterDeregister();
                            })), $scope.col.grid.options && !1 !== $scope.col.grid.options.enableColumnMenus && $scope.col.colDef && !1 !== $scope.col.colDef.enableColumnMenu ? $scope.colMenu = !0 : $scope.colMenu = !1, 
                            $scope.offAllEvents(), ($scope.sortable || $scope.colMenu) && ($scope.onDownEvents(), 
                            $scope.$on("$destroy", function() {
                                $scope.offAllEvents();
                            }));
                        };
                        updateHeaderOptions();
                        var dataChangeDereg = $scope.grid.registerDataChangeCallback(updateHeaderOptions, [ uiGridConstants.dataChange.COLUMN ]);
                        $scope.$on("$destroy", dataChangeDereg), $scope.handleClick = function(event) {
                            var add = !1;
                            event.shiftKey && (add = !0), uiGridCtrl.grid.sortColumn($scope.col, add).then(function() {
                                uiGridCtrl.columnMenuScope && uiGridCtrl.columnMenuScope.hideMenu(), uiGridCtrl.grid.refresh();
                            }).catch(angular.noop);
                        }, $scope.headerCellArrowKeyDown = function(event) {
                            32 !== event.keyCode && 13 !== event.keyCode || (event.preventDefault(), $scope.toggleMenu(event));
                        }, $scope.toggleMenu = function(event) {
                            event.stopPropagation(), uiGridCtrl.columnMenuScope.menuShown && uiGridCtrl.columnMenuScope.col === $scope.col ? uiGridCtrl.columnMenuScope.hideMenu() : uiGridCtrl.columnMenuScope.showMenu($scope.col, $elm);
                        };
                    }
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    angular.module("ui.grid").directive("uiGridHeader", [ "$templateCache", "$compile", "uiGridConstants", "gridUtil", "$timeout", "ScrollEvent", function($templateCache, $compile, uiGridConstants, gridUtil, $timeout, ScrollEvent) {
        return {
            restrict: "EA",
            replace: !0,
            require: [ "^uiGrid", "^uiGridRenderContainer" ],
            scope: !0,
            compile: function($elm, $attrs) {
                return {
                    pre: function($scope, $elm, $attrs, controllers) {
                        var headerTemplate, uiGridCtrl = controllers[0], containerCtrl = controllers[1];
                        function updateHeaderReferences() {
                            containerCtrl.header = containerCtrl.colContainer.header = $elm;
                            var headerCanvases = $elm[0].getElementsByClassName("ui-grid-header-canvas");
                            0 < headerCanvases.length ? containerCtrl.headerCanvas = containerCtrl.colContainer.headerCanvas = headerCanvases[0] : containerCtrl.headerCanvas = null;
                        }
                        function scrollHandler(evt) {
                            if (!uiGridCtrl.grid.isScrollingHorizontally) {
                                var newScrollLeft = gridUtil.normalizeScrollLeft(containerCtrl.headerViewport, uiGridCtrl.grid), horizScrollPercentage = containerCtrl.colContainer.scrollHorizontal(newScrollLeft), scrollEvent = new ScrollEvent(uiGridCtrl.grid, null, containerCtrl.colContainer, ScrollEvent.Sources.ViewPortScroll);
                                scrollEvent.newScrollLeft = newScrollLeft, -1 < horizScrollPercentage && (scrollEvent.x = {
                                    percentage: horizScrollPercentage
                                }), uiGridCtrl.grid.scrollContainers(null, scrollEvent);
                            }
                        }
                        $scope.grid = uiGridCtrl.grid, $scope.colContainer = containerCtrl.colContainer, 
                        updateHeaderReferences(), headerTemplate = $scope.grid.options.showHeader ? $scope.grid.options.headerTemplate ? $scope.grid.options.headerTemplate : "ui-grid/ui-grid-header" : "ui-grid/ui-grid-no-header", 
                        gridUtil.getTemplate(headerTemplate).then(function(contents) {
                            var template = angular.element(contents), newElm = $compile(template)($scope);
                            if ($elm.replaceWith(newElm), $elm = newElm, updateHeaderReferences(), containerCtrl) {
                                var headerViewport = $elm[0].getElementsByClassName("ui-grid-header-viewport")[0];
                                headerViewport && (containerCtrl.headerViewport = headerViewport, angular.element(headerViewport).on("scroll", scrollHandler), 
                                $scope.$on("$destroy", function() {
                                    angular.element(headerViewport).off("scroll", scrollHandler);
                                }));
                            }
                            $scope.grid.queueRefresh();
                        }).catch(angular.noop);
                    },
                    post: function($scope, $elm, $attrs, controllers) {
                        var uiGridCtrl = controllers[0], containerCtrl = controllers[1];
                        uiGridCtrl.grid;
                        gridUtil.disableAnimations($elm);
                        var headerViewport = (containerCtrl.header = $elm)[0].getElementsByClassName("ui-grid-header-viewport")[0];
                        headerViewport && (containerCtrl.headerViewport = headerViewport), uiGridCtrl && uiGridCtrl.grid.registerStyleComputation({
                            priority: 15,
                            func: function() {
                                var columnCache = containerCtrl.colContainer.visibleColumnCache, ret = "", canvasWidth = 0;
                                return columnCache.forEach(function(column) {
                                    ret += column.getColClassDefinition(), canvasWidth += column.drawnWidth;
                                }), containerCtrl.colContainer.canvasWidth = canvasWidth, ret;
                            }
                        });
                    }
                };
            }
        };
    } ]);
}(), angular.module("ui.grid").service("uiGridGridMenuService", [ "gridUtil", "i18nService", "uiGridConstants", function(gridUtil, i18nService, uiGridConstants) {
    var service = {
        initialize: function($scope, grid) {
            (grid.gridMenuScope = $scope).grid = grid, $scope.registeredMenuItems = [], $scope.$on("$destroy", function() {
                $scope.grid && $scope.grid.gridMenuScope && ($scope.grid.gridMenuScope = null), 
                $scope.grid && ($scope.grid = null), $scope.registeredMenuItems && ($scope.registeredMenuItems = null);
            }), $scope.registeredMenuItems = [], grid.api.registerMethod("core", "addToGridMenu", service.addToGridMenu), 
            grid.api.registerMethod("core", "removeFromGridMenu", service.removeFromGridMenu);
        },
        addToGridMenu: function(grid, menuItems) {
            angular.isArray(menuItems) ? grid.gridMenuScope ? (grid.gridMenuScope.registeredMenuItems = grid.gridMenuScope.registeredMenuItems ? grid.gridMenuScope.registeredMenuItems : [], 
            grid.gridMenuScope.registeredMenuItems = grid.gridMenuScope.registeredMenuItems.concat(menuItems)) : gridUtil.logError("Asked to addToGridMenu, but gridMenuScope not present.  Timing issue?  Please log issue with ui-grid") : gridUtil.logError("addToGridMenu: menuItems must be an array, and is not, not adding any items");
        },
        removeFromGridMenu: function(grid, id) {
            var foundIndex = -1;
            grid && grid.gridMenuScope && grid.gridMenuScope.registeredMenuItems.forEach(function(value, index) {
                value.id === id && (-1 < foundIndex ? gridUtil.logError("removeFromGridMenu: found multiple items with the same id, removing only the last") : foundIndex = index);
            }), -1 < foundIndex && grid.gridMenuScope.registeredMenuItems.splice(foundIndex, 1);
        },
        getMenuItems: function($scope) {
            var menuItems = [];
            $scope.grid.options.gridMenuCustomItems && (angular.isArray($scope.grid.options.gridMenuCustomItems) ? menuItems = menuItems.concat($scope.grid.options.gridMenuCustomItems) : gridUtil.logError("gridOptions.gridMenuCustomItems must be an array, and is not"));
            var clearFilters = [ {
                title: i18nService.getSafeText("gridMenu.clearAllFilters"),
                action: function($event) {
                    $scope.grid.clearAllFilters();
                },
                shown: function() {
                    return $scope.grid.options.enableFiltering;
                },
                order: 100
            } ];
            return menuItems = (menuItems = menuItems.concat(clearFilters)).concat($scope.registeredMenuItems), 
            !1 !== $scope.grid.options.gridMenuShowHideColumns && (menuItems = menuItems.concat(service.showHideColumns($scope))), 
            menuItems.sort(function(a, b) {
                return a.order - b.order;
            }), menuItems;
        },
        showHideColumns: function($scope) {
            var showHideColumns = [];
            if (!$scope.grid.options.columnDefs || 0 === $scope.grid.options.columnDefs.length || 0 === $scope.grid.columns.length) return showHideColumns;
            function isColumnVisible(colDef) {
                return !0 === colDef.visible || void 0 === colDef.visible;
            }
            return showHideColumns.push({
                title: i18nService.getSafeText("gridMenu.columns"),
                order: 300,
                templateUrl: "ui-grid/ui-grid-menu-header-item"
            }), $scope.grid.options.gridMenuTitleFilter = $scope.grid.options.gridMenuTitleFilter ? $scope.grid.options.gridMenuTitleFilter : function(title) {
                return title;
            }, $scope.grid.options.columnDefs.forEach(function(colDef, index) {
                if (!1 !== colDef.enableHiding) {
                    var menuItem = {
                        icon: isColumnVisible(colDef) ? "ui-grid-icon-ok" : "ui-grid-icon-cancel",
                        action: function($event) {
                            $event.stopPropagation(), service.toggleColumnVisibility(this.context.gridCol), 
                            $event.target && $event.target.firstChild && ($event.target.firstChild.className = isColumnVisible(this.context.gridCol.colDef) ? "ui-grid-icon-ok" : "ui-grid-icon-cancel");
                        },
                        shown: function() {
                            return !1 !== this.context.gridCol.colDef.enableHiding;
                        },
                        context: {
                            gridCol: $scope.grid.getColumn(colDef.name || colDef.field)
                        },
                        leaveOpen: !0,
                        order: 301 + index
                    };
                    service.setMenuItemTitle(menuItem, colDef, $scope.grid), showHideColumns.push(menuItem);
                }
            }), showHideColumns;
        },
        setMenuItemTitle: function(menuItem, colDef, grid) {
            var title = grid.options.gridMenuTitleFilter(colDef.displayName || gridUtil.readableColumnName(colDef.name) || colDef.field);
            "string" == typeof title ? menuItem.title = title : title.then ? (menuItem.title = "", 
            title.then(function(successValue) {
                menuItem.title = successValue;
            }, function(errorValue) {
                menuItem.title = errorValue;
            }).catch(angular.noop)) : (gridUtil.logError("Expected gridMenuTitleFilter to return a string or a promise, it has returned neither, bad config"), 
            menuItem.title = "badconfig");
        },
        toggleColumnVisibility: function(gridCol) {
            gridCol.colDef.visible = !(!0 === gridCol.colDef.visible || void 0 === gridCol.colDef.visible), 
            gridCol.grid.refresh(), gridCol.grid.api.core.notifyDataChange(uiGridConstants.dataChange.COLUMN), 
            gridCol.grid.api.core.raise.columnVisibilityChanged(gridCol);
        }
    };
    return service;
} ]).directive("uiGridMenuButton", [ "gridUtil", "uiGridConstants", "uiGridGridMenuService", "i18nService", function(gridUtil, uiGridConstants, uiGridGridMenuService, i18nService) {
    return {
        priority: 0,
        scope: !0,
        require: [ "^uiGrid" ],
        templateUrl: "ui-grid/ui-grid-menu-button",
        replace: !0,
        link: function($scope, $elm, $attrs, controllers) {
            var uiGridCtrl = controllers[0];
            $scope.i18n = {
                aria: i18nService.getSafeText("gridMenu.aria")
            }, uiGridGridMenuService.initialize($scope, uiGridCtrl.grid), $scope.shown = !1, 
            $scope.toggleMenu = function() {
                $scope.shown ? ($scope.$broadcast("hide-menu"), $scope.shown = !1) : ($scope.menuItems = uiGridGridMenuService.getMenuItems($scope), 
                $scope.$broadcast("show-menu"), $scope.shown = !0);
            }, $scope.$on("menu-hidden", function() {
                $scope.shown = !1, gridUtil.focus.bySelector($elm, ".ui-grid-icon-container");
            });
        }
    };
} ]), angular.module("ui.grid").directive("uiGridMenu", [ "$compile", "$timeout", "$window", "$document", "gridUtil", "uiGridConstants", "i18nService", function($compile, $timeout, $window, $document, gridUtil, uiGridConstants, i18nService) {
    return {
        priority: 0,
        scope: {
            menuItems: "=",
            autoHide: "=?"
        },
        require: "?^uiGrid",
        templateUrl: "ui-grid/uiGridMenu",
        replace: !1,
        link: function($scope, $elm, $attrs, uiGridCtrl) {
            if ($scope.dynamicStyles = "", uiGridCtrl && uiGridCtrl.grid && uiGridCtrl.grid.options && uiGridCtrl.grid.options.gridMenuTemplate) {
                var gridMenuTemplate = uiGridCtrl.grid.options.gridMenuTemplate;
                gridUtil.getTemplate(gridMenuTemplate).then(function(contents) {
                    var template = angular.element(contents), newElm = $compile(template)($scope);
                    $elm.replaceWith(newElm);
                }).catch(angular.noop);
            }
            var setupHeightStyle = function(gridHeight) {
                var gridMenuMaxHeight = gridHeight - uiGridCtrl.grid.headerHeight - 20;
                $scope.dynamicStyles = [ ".grid" + uiGridCtrl.grid.id + " .ui-grid-menu-mid {", "max-height: " + gridMenuMaxHeight + "px;", "}" ].join(" ");
            };
            uiGridCtrl && (setupHeightStyle(uiGridCtrl.grid.gridHeight), uiGridCtrl.grid.api.core.on.gridDimensionChanged($scope, function(oldGridHeight, oldGridWidth, newGridHeight, newGridWidth) {
                setupHeightStyle(newGridHeight);
            })), $scope.i18n = {
                close: i18nService.getSafeText("columnMenu.close")
            }, $scope.showMenu = function(event, args) {
                $scope.shown ? $scope.shownMid || ($scope.shownMid = !0, $scope.$emit("menu-shown")) : ($scope.shown = !0, 
                $timeout(function() {
                    $scope.shownMid = !0, $scope.$emit("menu-shown");
                }));
                var docEventType = "click";
                args && args.originalEvent && args.originalEvent.type && "touchstart" === args.originalEvent.type && (docEventType = args.originalEvent.type), 
                angular.element(document).off("click touchstart", applyHideMenu), $elm.off("keyup", checkKeyUp), 
                $elm.off("keydown", checkKeyDown), $timeout(function() {
                    angular.element(document).on(docEventType, applyHideMenu), $elm.on("keyup", checkKeyUp), 
                    $elm.on("keydown", checkKeyDown);
                });
            }, $scope.hideMenu = function(event) {
                $scope.shown && ($scope.shownMid = !1, $timeout(function() {
                    $scope.shownMid || ($scope.shown = !1, $scope.$emit("menu-hidden"));
                }, 40)), angular.element(document).off("click touchstart", applyHideMenu), $elm.off("keyup", checkKeyUp), 
                $elm.off("keydown", checkKeyDown);
            }, $scope.$on("hide-menu", function(event, args) {
                $scope.hideMenu(event, args);
            }), $scope.$on("show-menu", function(event, args) {
                $scope.showMenu(event, args);
            });
            var applyHideMenu = function() {
                $scope.shown && $scope.$apply(function() {
                    $scope.hideMenu();
                });
            }, checkKeyUp = function(event) {
                27 === event.keyCode && $scope.hideMenu();
            }, checkKeyDown = function(event) {
                var setFocus = function(elm) {
                    return elm.focus(), event.preventDefault(), !1;
                };
                if (9 === event.keyCode) {
                    var firstMenuItem, lastMenuItem, menuItemButtons = $elm[0].querySelectorAll("button:not(.ng-hide)");
                    0 < menuItemButtons.length && (firstMenuItem = menuItemButtons[0], lastMenuItem = menuItemButtons[menuItemButtons.length - 1], 
                    event.target !== lastMenuItem || event.shiftKey ? event.target === firstMenuItem && event.shiftKey && setFocus(lastMenuItem) : setFocus(firstMenuItem));
                }
            };
            void 0 !== $scope.autoHide && void 0 !== $scope.autoHide || ($scope.autoHide = !0), 
            $scope.autoHide && angular.element($window).on("resize", applyHideMenu), $scope.$on("$destroy", function() {
                angular.element($window).off("resize", applyHideMenu), angular.element(document).off("click touchstart", applyHideMenu), 
                $elm.off("keyup", checkKeyUp), $elm.off("keydown", checkKeyDown);
            }), uiGridCtrl && $scope.$on("$destroy", uiGridCtrl.grid.api.core.on.scrollBegin($scope, applyHideMenu)), 
            $scope.$on("$destroy", $scope.$on(uiGridConstants.events.ITEM_DRAGGING, applyHideMenu));
        }
    };
} ]).directive("uiGridMenuItem", [ "gridUtil", "$compile", "i18nService", function(gridUtil, $compile, i18nService) {
    return {
        priority: 0,
        scope: {
            name: "=",
            active: "=",
            action: "=",
            icon: "=",
            shown: "=",
            context: "=",
            templateUrl: "=",
            leaveOpen: "=",
            screenReaderOnly: "="
        },
        require: [ "?^uiGrid" ],
        templateUrl: "ui-grid/uiGridMenuItem",
        replace: !1,
        compile: function() {
            return {
                pre: function($scope, $elm) {
                    $scope.templateUrl && gridUtil.getTemplate($scope.templateUrl).then(function(contents) {
                        var template = angular.element(contents), newElm = $compile(template)($scope);
                        $elm.replaceWith(newElm);
                    }).catch(angular.noop);
                },
                post: function($scope, $elm, $attrs, controllers) {
                    var uiGridCtrl = controllers[0];
                    void 0 !== $scope.shown && null !== $scope.shown || ($scope.shown = function() {
                        return !0;
                    }), $scope.itemShown = function() {
                        var context = {};
                        return $scope.context && (context.context = $scope.context), void 0 !== uiGridCtrl && uiGridCtrl && (context.grid = uiGridCtrl.grid), 
                        $scope.shown.call(context);
                    }, $scope.itemAction = function($event, title) {
                        if ($event.stopPropagation(), "function" == typeof $scope.action) {
                            var context = {};
                            if ($scope.context && (context.context = $scope.context), void 0 !== uiGridCtrl && uiGridCtrl && (context.grid = uiGridCtrl.grid), 
                            $scope.action.call(context, $event, title), $scope.leaveOpen) {
                                var correctParent = $event.target.parentElement;
                                "I" === angular.element($event.target)[0].nodeName && (correctParent = correctParent.parentElement), 
                                gridUtil.focus.bySelector(correctParent, "button[type=button]", !0);
                            } else $scope.$emit("hide-menu");
                        }
                    }, $scope.label = function() {
                        var toBeDisplayed = $scope.name;
                        return "function" == typeof $scope.name && (toBeDisplayed = $scope.name.call()), 
                        toBeDisplayed;
                    }, $scope.i18n = i18nService.get();
                }
            };
        }
    };
} ]), function() {
    "use strict";
    var oneBinders = angular.module("ui.grid");
    angular.forEach([ {
        tag: "Src",
        method: "attr"
    }, {
        tag: "Text",
        method: "text"
    }, {
        tag: "Href",
        method: "attr"
    }, {
        tag: "Class",
        method: "addClass"
    }, {
        tag: "Html",
        method: "html"
    }, {
        tag: "Alt",
        method: "attr"
    }, {
        tag: "Style",
        method: "css"
    }, {
        tag: "Value",
        method: "attr"
    }, {
        tag: "Id",
        method: "attr"
    }, {
        tag: "Id",
        directiveName: "IdGrid",
        method: "attr",
        appendGridId: !0
    }, {
        tag: "Title",
        method: "attr"
    }, {
        tag: "Label",
        method: "attr",
        aria: !0
    }, {
        tag: "Labelledby",
        method: "attr",
        aria: !0
    }, {
        tag: "Labelledby",
        directiveName: "LabelledbyGrid",
        appendGridId: !0,
        method: "attr",
        aria: !0
    }, {
        tag: "Describedby",
        method: "attr",
        aria: !0
    }, {
        tag: "Describedby",
        directiveName: "DescribedbyGrid",
        appendGridId: !0,
        method: "attr",
        aria: !0
    } ], function(v) {
        var directiveName = (v.aria ? "uiGridOneBindAria" : "uiGridOneBind") + (v.directiveName ? v.directiveName : v.tag);
        oneBinders.directive(directiveName, [ "gridUtil", function(gridUtil) {
            return {
                restrict: "A",
                require: [ "?uiGrid", "?^uiGrid" ],
                link: function(scope, iElement, iAttrs, controllers) {
                    var rmWatcher = scope.$watch(iAttrs[directiveName], function(newV) {
                        if (newV) {
                            if (v.appendGridId) {
                                var newIdString = null;
                                angular.forEach(newV.split(" "), function(s) {
                                    newIdString = (newIdString ? newIdString + " " : "") + function(val) {
                                        var grid;
                                        if (scope.grid) grid = scope.grid; else if (scope.col && scope.col.grid) grid = scope.col.grid; else if (!controllers.some(function(controller) {
                                            if (controller && controller.grid) return grid = controller.grid, !0;
                                        })) throw gridUtil.logError("[" + directiveName + "] A valid grid could not be found to bind id. Are you using this directive within the correct scope? Trying to generate id: [gridID]-" + val), 
                                        new Error("No valid grid could be found");
                                        grid && (new RegExp(grid.id.toString()).test(val) || (val = grid.id.toString() + "-" + val));
                                        return val;
                                    }(s);
                                }), newV = newIdString;
                            }
                            switch (v.method) {
                              case "attr":
                                v.aria ? iElement[v.method]("aria-" + v.tag.toLowerCase(), newV) : iElement[v.method](v.tag.toLowerCase(), newV);
                                break;

                              case "addClass":
                                if (angular.isObject(newV) && !angular.isArray(newV)) {
                                    var results = [], nonNullFound = !1;
                                    if (angular.forEach(newV, function(value, index) {
                                        null != value && (nonNullFound = !0, value && results.push(index));
                                    }), !nonNullFound) return;
                                    newV = results;
                                }
                                if (!newV) return;
                                iElement.addClass(angular.isArray(newV) ? newV.join(" ") : newV);
                                break;

                              default:
                                iElement[v.method](newV);
                            }
                            rmWatcher();
                        }
                    }, !0);
                }
            };
        } ]);
    });
}(), function() {
    "use strict";
    var module = angular.module("ui.grid");
    module.directive("uiGridRenderContainer", [ "$timeout", "$document", "uiGridConstants", "gridUtil", "ScrollEvent", function($timeout, $document, uiGridConstants, gridUtil, ScrollEvent) {
        return {
            replace: !0,
            transclude: !0,
            templateUrl: "ui-grid/uiGridRenderContainer",
            require: [ "^uiGrid", "uiGridRenderContainer" ],
            scope: {
                containerId: "=",
                rowContainerName: "=",
                colContainerName: "=",
                bindScrollHorizontal: "=",
                bindScrollVertical: "=",
                enableVerticalScrollbar: "=",
                enableHorizontalScrollbar: "="
            },
            controller: "uiGridRenderContainer as RenderContainer",
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, controllers) {
                        var uiGridCtrl = controllers[0], containerCtrl = controllers[1], grid = $scope.grid = uiGridCtrl.grid;
                        if (!$scope.rowContainerName) throw new Error("No row render container name specified");
                        if (!$scope.colContainerName) throw new Error("No column render container name specified");
                        if (!grid.renderContainers[$scope.rowContainerName]) throw new Error("Row render container '" + $scope.rowContainerName + "' is not registered.");
                        if (!grid.renderContainers[$scope.colContainerName]) throw new Error("Column render container '" + $scope.colContainerName + "' is not registered.");
                        var rowContainer = $scope.rowContainer = grid.renderContainers[$scope.rowContainerName], colContainer = $scope.colContainer = grid.renderContainers[$scope.colContainerName];
                        containerCtrl.containerId = $scope.containerId, containerCtrl.rowContainer = rowContainer, 
                        containerCtrl.colContainer = colContainer;
                    },
                    post: function($scope, $elm, $attrs, controllers) {
                        var uiGridCtrl = controllers[0], containerCtrl = controllers[1], grid = uiGridCtrl.grid, rowContainer = containerCtrl.rowContainer, colContainer = containerCtrl.colContainer, scrollTop = null, scrollLeft = null, renderContainer = grid.renderContainers[$scope.containerId];
                        $elm.addClass("ui-grid-render-container-" + $scope.containerId), gridUtil.on.mousewheel($elm, function(event) {
                            var scrollEvent = new ScrollEvent(grid, rowContainer, colContainer, ScrollEvent.Sources.RenderContainerMouseWheel);
                            if (0 !== event.deltaY) {
                                var scrollYAmount = -1 * event.deltaY * event.deltaFactor;
                                scrollTop = containerCtrl.viewport[0].scrollTop, scrollEvent.verticalScrollLength = rowContainer.getVerticalScrollLength();
                                var scrollYPercentage = (scrollTop + scrollYAmount) / scrollEvent.verticalScrollLength;
                                1 <= scrollYPercentage && scrollTop < scrollEvent.verticalScrollLength && (containerCtrl.viewport[0].scrollTop = scrollEvent.verticalScrollLength), 
                                scrollYPercentage < 0 ? scrollYPercentage = 0 : 1 < scrollYPercentage && (scrollYPercentage = 1), 
                                scrollEvent.y = {
                                    percentage: scrollYPercentage,
                                    pixels: scrollYAmount
                                };
                            }
                            if (0 !== event.deltaX) {
                                var scrollXAmount = event.deltaX * event.deltaFactor;
                                scrollLeft = gridUtil.normalizeScrollLeft(containerCtrl.viewport, grid), scrollEvent.horizontalScrollLength = colContainer.getCanvasWidth() - colContainer.getViewportWidth();
                                var scrollXPercentage = (scrollLeft + scrollXAmount) / scrollEvent.horizontalScrollLength;
                                scrollXPercentage < 0 ? scrollXPercentage = 0 : 1 < scrollXPercentage && (scrollXPercentage = 1), 
                                scrollEvent.x = {
                                    percentage: scrollXPercentage,
                                    pixels: scrollXAmount
                                };
                            }
                            0 !== event.deltaY && (scrollEvent.atTop(scrollTop) || scrollEvent.atBottom(scrollTop)) || 0 !== event.deltaX && (scrollEvent.atLeft(scrollLeft) || scrollEvent.atRight(scrollLeft)) || (event.preventDefault(), 
                            event.stopPropagation(), scrollEvent.fireThrottledScrollingEvent("", scrollEvent));
                        }), $elm.bind("$destroy", function() {
                            $elm.unbind("keydown"), [ "touchstart", "touchmove", "touchend", "keydown", "wheel", "mousewheel", "DomMouseScroll", "MozMousePixelScroll" ].forEach(function(eventName) {
                                $elm.unbind(eventName);
                            });
                        }), uiGridCtrl.grid.registerStyleComputation({
                            priority: 6,
                            func: function() {
                                var headerViewportWidth, footerViewportWidth, ret = "", canvasWidth = colContainer.canvasWidth, viewportWidth = colContainer.getViewportWidth(), canvasHeight = rowContainer.getCanvasHeight(), viewportHeight = rowContainer.getViewportHeight();
                                if (colContainer.needsHScrollbarPlaceholder() && (viewportHeight -= grid.scrollbarHeight), 
                                headerViewportWidth = footerViewportWidth = colContainer.getHeaderViewportWidth(), 
                                ret += "\n .grid" + uiGridCtrl.grid.id + " .ui-grid-render-container-" + $scope.containerId + " .ui-grid-canvas { width: " + canvasWidth + "px; height: " + canvasHeight + "px; }", 
                                ret += "\n .grid" + uiGridCtrl.grid.id + " .ui-grid-render-container-" + $scope.containerId + " .ui-grid-header-canvas { width: " + (canvasWidth + grid.scrollbarWidth) + "px; }", 
                                renderContainer.explicitHeaderCanvasHeight) {
                                    var reHCHeight = document.querySelector(".grid" + uiGridCtrl.grid.id + " .ui-grid-render-container-body .ui-grid-header-canvas");
                                    reHCHeight && (renderContainer.explicitHeaderCanvasHeight = reHCHeight.offsetHeight), 
                                    ret += "\n .grid" + uiGridCtrl.grid.id + " .ui-grid-render-container-" + $scope.containerId + " .ui-grid-header-canvas { height: " + renderContainer.explicitHeaderCanvasHeight + "px; }";
                                } else ret += "\n .grid" + uiGridCtrl.grid.id + " .ui-grid-render-container-" + $scope.containerId + " .ui-grid-header-canvas { height: inherit; }";
                                return ret += "\n .grid" + uiGridCtrl.grid.id + " .ui-grid-render-container-" + $scope.containerId + " .ui-grid-viewport { width: " + viewportWidth + "px; height: " + viewportHeight + "px; }", 
                                ret += "\n .grid" + uiGridCtrl.grid.id + " .ui-grid-render-container-" + $scope.containerId + " .ui-grid-header-viewport { width: " + headerViewportWidth + "px; }", 
                                ret += "\n .grid" + uiGridCtrl.grid.id + " .ui-grid-render-container-" + $scope.containerId + " .ui-grid-footer-canvas { width: " + (canvasWidth + grid.scrollbarWidth) + "px; }", 
                                ret += "\n .grid" + uiGridCtrl.grid.id + " .ui-grid-render-container-" + $scope.containerId + " .ui-grid-footer-viewport { width: " + footerViewportWidth + "px; }";
                            }
                        });
                    }
                };
            }
        };
    } ]), module.controller("uiGridRenderContainer", [ "$scope", "gridUtil", function($scope, gridUtil) {} ]);
}(), function() {
    "use strict";
    angular.module("ui.grid").directive("uiGridRow", [ "gridUtil", function(gridUtil) {
        return {
            replace: !0,
            require: [ "^uiGrid", "^uiGridRenderContainer" ],
            scope: {
                row: "=uiGridRow",
                rowRenderIndex: "="
            },
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, controllers) {
                        var clonedElement, cloneScope, uiGridCtrl = controllers[0], containerCtrl = controllers[1];
                        uiGridCtrl.grid;
                        function compileTemplate() {
                            $scope.row.getRowTemplateFn.then(function(compiledElementFn) {
                                var newScope = $scope.$new();
                                compiledElementFn(newScope, function(newElm, scope) {
                                    clonedElement && (clonedElement.remove(), cloneScope.$destroy()), $elm.empty().append(newElm), 
                                    clonedElement = newElm, cloneScope = newScope;
                                });
                            }).catch(angular.noop);
                        }
                        $scope.grid = uiGridCtrl.grid, $scope.colContainer = containerCtrl.colContainer, 
                        compileTemplate(), $scope.$watch("row.getRowTemplateFn", function(newFunc, oldFunc) {
                            newFunc !== oldFunc && compileTemplate();
                        });
                    },
                    post: function($scope, $elm, $attrs, controllers) {}
                };
            }
        };
    } ]);
}(), angular.module("ui.grid").directive("uiGridStyle", [ "gridUtil", "$interpolate", function(gridUtil, $interpolate) {
    return {
        link: function($scope, $elm, $attrs, uiGridCtrl) {
            var interpolateFn = $interpolate($elm.text(), !0);
            interpolateFn && $scope.$watch(interpolateFn, function(value) {
                $elm.text(value);
            });
        }
    };
} ]), function() {
    "use strict";
    angular.module("ui.grid").directive("uiGridViewport", [ "gridUtil", "ScrollEvent", "uiGridConstants", "$log", function(gridUtil, ScrollEvent, uiGridConstants, $log) {
        return {
            replace: !0,
            scope: {},
            controllerAs: "Viewport",
            templateUrl: "ui-grid/uiGridViewport",
            require: [ "^uiGrid", "^uiGridRenderContainer" ],
            link: function($scope, $elm, $attrs, controllers) {
                var uiGridCtrl = controllers[0], containerCtrl = controllers[1], rowContainer = ($scope.containerCtrl = containerCtrl).rowContainer, colContainer = containerCtrl.colContainer, grid = uiGridCtrl.grid;
                $scope.grid = uiGridCtrl.grid, $scope.rowContainer = containerCtrl.rowContainer, 
                $scope.colContainer = containerCtrl.colContainer, containerCtrl.viewport = $elm, 
                grid && grid.options && grid.options.customScroller ? grid.options.customScroller($elm, scrollHandler) : $elm.on("scroll", scrollHandler);
                function scrollHandler(evt) {
                    var newScrollTop = $elm[0].scrollTop, newScrollLeft = gridUtil.normalizeScrollLeft($elm, grid), vertScrollPercentage = rowContainer.scrollVertical(newScrollTop), horizScrollPercentage = colContainer.scrollHorizontal(newScrollLeft), scrollEvent = new ScrollEvent(grid, rowContainer, colContainer, ScrollEvent.Sources.ViewPortScroll);
                    scrollEvent.newScrollLeft = newScrollLeft, scrollEvent.newScrollTop = newScrollTop, 
                    -1 < horizScrollPercentage && (scrollEvent.x = {
                        percentage: horizScrollPercentage
                    }), -1 < vertScrollPercentage && (scrollEvent.y = {
                        percentage: vertScrollPercentage
                    }), grid.scrollContainers($scope.$parent.containerId, scrollEvent);
                }
                $scope.$parent.bindScrollVertical && grid.addVerticalScrollSync($scope.$parent.containerId, function(scrollEvent) {
                    var newScrollTop = (containerCtrl.prevScrollArgs = scrollEvent).getNewScrollTop(rowContainer, containerCtrl.viewport);
                    $elm[0].scrollTop = newScrollTop;
                }), $scope.$parent.bindScrollHorizontal && (grid.addHorizontalScrollSync($scope.$parent.containerId, function(scrollEvent) {
                    var newScrollLeft = (containerCtrl.prevScrollArgs = scrollEvent).getNewScrollLeft(colContainer, containerCtrl.viewport);
                    $elm[0].scrollLeft = gridUtil.denormalizeScrollLeft(containerCtrl.viewport, newScrollLeft, grid);
                }), grid.addHorizontalScrollSync($scope.$parent.containerId + "header", function(scrollEvent) {
                    var newScrollLeft = scrollEvent.getNewScrollLeft(colContainer, containerCtrl.viewport);
                    containerCtrl.headerViewport && (containerCtrl.headerViewport.scrollLeft = gridUtil.denormalizeScrollLeft(containerCtrl.viewport, newScrollLeft, grid));
                }), grid.addHorizontalScrollSync($scope.$parent.containerId + "footer", function(scrollEvent) {
                    var newScrollLeft = scrollEvent.getNewScrollLeft(colContainer, containerCtrl.viewport);
                    containerCtrl.footerViewport && (containerCtrl.footerViewport.scrollLeft = gridUtil.denormalizeScrollLeft(containerCtrl.viewport, newScrollLeft, grid));
                })), $scope.$on("$destroy", function() {
                    $elm.off();
                });
            },
            controller: [ "$scope", function($scope) {
                this.rowStyle = function(index) {
                    var rowContainer = $scope.rowContainer, colContainer = $scope.colContainer, styles = {};
                    if (0 !== rowContainer.currentTopRow) {
                        var translateY = "translateY(" + rowContainer.currentTopRow * rowContainer.grid.options.rowHeight + "px)";
                        styles.transform = translateY, styles["-webkit-transform"] = translateY, styles["-ms-transform"] = translateY;
                    }
                    return 0 !== colContainer.currentFirstColumn && (colContainer.grid.isRTL() ? styles["margin-right"] = colContainer.columnOffset + "px" : styles["margin-left"] = colContainer.columnOffset + "px"), 
                    styles;
                };
            } ]
        };
    } ]);
}(), angular.module("ui.grid").directive("uiGridVisible", function() {
    return function($scope, $elm, $attr) {
        $scope.$watch($attr.uiGridVisible, function(visible) {
            $elm[visible ? "removeClass" : "addClass"]("ui-grid-invisible");
        });
    };
}), function() {
    "use strict";
    function uiGridDirective($window, gridUtil, uiGridConstants) {
        return {
            templateUrl: "ui-grid/ui-grid",
            scope: {
                uiGrid: "="
            },
            replace: !0,
            transclude: !0,
            controller: "uiGridController",
            compile: function() {
                return {
                    post: function($scope, $elm, $attrs, uiGridCtrl) {
                        var grid = uiGridCtrl.grid;
                        uiGridCtrl.scrollbars = [], grid.element = $elm;
                        var deregisterLeftWatcher, deregisterRightWatcher, sizeCheckInterval = 100, maxSizeChecks = 20, sizeChecks = 0;
                        function init() {
                            grid.gridWidth = $scope.gridWidth = gridUtil.elementWidth($elm), grid.canvasWidth = uiGridCtrl.grid.gridWidth, 
                            grid.gridHeight = $scope.gridHeight = gridUtil.elementHeight($elm), grid.gridHeight - grid.scrollbarHeight <= grid.options.rowHeight && grid.options.enableMinHeightCheck && function() {
                                var contentHeight = grid.options.minRowsToShow * grid.options.rowHeight, headerHeight = grid.options.showHeader ? grid.options.headerRowHeight : 0, footerHeight = grid.calcFooterHeight(), scrollbarHeight = 0;
                                grid.options.enableHorizontalScrollbar === uiGridConstants.scrollbars.ALWAYS && (scrollbarHeight = gridUtil.getScrollbarWidth());
                                var maxNumberOfFilters = 0;
                                if (angular.forEach(grid.options.columnDefs, function(col) {
                                    col.hasOwnProperty("filter") ? maxNumberOfFilters < 1 && (maxNumberOfFilters = 1) : col.hasOwnProperty("filters") && maxNumberOfFilters < col.filters.length && (maxNumberOfFilters = col.filters.length);
                                }), grid.options.enableFiltering && !maxNumberOfFilters) {
                                    var allColumnsHaveFilteringTurnedOff = grid.options.columnDefs.length && grid.options.columnDefs.every(function(col) {
                                        return !1 === col.enableFiltering;
                                    });
                                    allColumnsHaveFilteringTurnedOff || (maxNumberOfFilters = 1);
                                }
                                var newHeight = headerHeight + contentHeight + footerHeight + scrollbarHeight + maxNumberOfFilters * headerHeight;
                                $elm.css("height", newHeight + "px"), grid.gridHeight = $scope.gridHeight = gridUtil.elementHeight($elm);
                            }(), grid.refreshCanvas(!0);
                        }
                        function gridResize() {
                            grid.gridWidth = $scope.gridWidth = gridUtil.elementWidth($elm), grid.gridHeight = $scope.gridHeight = gridUtil.elementHeight($elm), 
                            grid.refreshCanvas(!0);
                        }
                        angular.element($window).on("resize", gridResize), $elm.on("$destroy", function() {
                            angular.element($window).off("resize", gridResize), deregisterLeftWatcher(), deregisterRightWatcher();
                        }), deregisterLeftWatcher = $scope.$watch(function() {
                            return grid.hasLeftContainer();
                        }, function(newValue, oldValue) {
                            newValue !== oldValue && grid.refreshCanvas(!0);
                        }), deregisterRightWatcher = $scope.$watch(function() {
                            return grid.hasRightContainer();
                        }, function(newValue, oldValue) {
                            newValue !== oldValue && grid.refreshCanvas(!0);
                        }), init(), grid.renderingComplete(), function checkSize() {
                            $elm[0].offsetWidth <= 0 && sizeChecks < maxSizeChecks ? (setTimeout(checkSize, sizeCheckInterval), 
                            sizeChecks++) : $scope.$applyAsync(init);
                        }();
                    }
                };
            }
        };
    }
    angular.module("ui.grid").controller("uiGridController", [ "$scope", "$element", "$attrs", "gridUtil", "$q", "uiGridConstants", "gridClassFactory", "$parse", "$compile", function($scope, $elm, $attrs, gridUtil, $q, uiGridConstants, gridClassFactory, $parse, $compile) {
        var mostRecentData, self = this, deregFunctions = [];
        function getSize(array) {
            return array ? array.length : 0;
        }
        function columnDefsWatchFunction(n, o) {
            n && n !== o && (self.grid.options.columnDefs = $scope.uiGrid.columnDefs, self.grid.callDataChangeCallbacks(uiGridConstants.dataChange.COLUMN, {
                orderByColumnDefs: !0,
                preCompileCellTemplates: !0
            }));
        }
        function dataWatchFunction(newData) {
            var promises = [];
            if (self.grid.options.fastWatch && (newData = angular.isString($scope.uiGrid.data) ? self.grid.appScope.$eval($scope.uiGrid.data) : $scope.uiGrid.data), 
            mostRecentData = newData) {
                var hasColumns = self.grid.columns.length > (self.grid.rowHeaderColumns ? self.grid.rowHeaderColumns.length : 0);
                !hasColumns && !$attrs.uiGridColumns && 0 === self.grid.options.columnDefs.length && 0 < newData.length && self.grid.buildColumnDefsFromData(newData), 
                !hasColumns && (0 < self.grid.options.columnDefs.length || 0 < newData.length) && promises.push(self.grid.buildColumns().then(function() {
                    self.grid.preCompileCellTemplates();
                }).catch(angular.noop)), $q.all(promises).then(function() {
                    self.grid.modifyRows(mostRecentData).then(function() {
                        self.grid.redrawInPlace(!0), $scope.$evalAsync(function() {
                            self.grid.refreshCanvas(!0), self.grid.callDataChangeCallbacks(uiGridConstants.dataChange.ROW);
                        });
                    }).catch(angular.noop);
                }).catch(angular.noop);
            }
        }
        self.grid = gridClassFactory.createGrid($scope.uiGrid), self.grid.appScope = self.grid.appScope || $scope.$parent, 
        $elm.addClass("grid" + self.grid.id), self.grid.rtl = "rtl" === gridUtil.getStyles($elm[0]).direction, 
        $scope.grid = self.grid, $attrs.uiGridColumns && deregFunctions.push($attrs.$observe("uiGridColumns", function(value) {
            self.grid.options.columnDefs = angular.isString(value) ? angular.fromJson(value) : value, 
            self.grid.buildColumns().then(function() {
                self.grid.preCompileCellTemplates(), self.grid.refreshCanvas(!0);
            }).catch(angular.noop);
        })), self.grid.options.fastWatch ? (self.uiGrid = $scope.uiGrid, angular.isString($scope.uiGrid.data) ? (deregFunctions.push($scope.$parent.$watch($scope.uiGrid.data, dataWatchFunction)), 
        deregFunctions.push($scope.$parent.$watch(function() {
            return self.grid.appScope[$scope.uiGrid.data] ? self.grid.appScope[$scope.uiGrid.data].length : void 0;
        }, dataWatchFunction))) : (deregFunctions.push($scope.$parent.$watch(function() {
            return $scope.uiGrid.data;
        }, dataWatchFunction)), deregFunctions.push($scope.$parent.$watch(function() {
            return getSize($scope.uiGrid.data);
        }, function() {
            dataWatchFunction($scope.uiGrid.data);
        }))), deregFunctions.push($scope.$parent.$watch(function() {
            return $scope.uiGrid.columnDefs;
        }, columnDefsWatchFunction)), deregFunctions.push($scope.$parent.$watch(function() {
            return getSize($scope.uiGrid.columnDefs);
        }, function() {
            columnDefsWatchFunction($scope.uiGrid.columnDefs);
        }))) : (angular.isString($scope.uiGrid.data) ? deregFunctions.push($scope.$parent.$watchCollection($scope.uiGrid.data, dataWatchFunction)) : deregFunctions.push($scope.$parent.$watchCollection(function() {
            return $scope.uiGrid.data;
        }, dataWatchFunction)), deregFunctions.push($scope.$parent.$watchCollection(function() {
            return $scope.uiGrid.columnDefs;
        }, columnDefsWatchFunction)));
        var styleWatchDereg = $scope.$watch(function() {
            return self.grid.styleComputations;
        }, function() {
            self.grid.refreshCanvas(!0);
        });
        $scope.$on("$destroy", function() {
            deregFunctions.forEach(function(deregFn) {
                deregFn();
            }), styleWatchDereg();
        }), self.fireEvent = function(eventName, args) {
            args = args || {}, angular.isUndefined(args.grid) && (args.grid = self.grid), $scope.$broadcast(eventName, args);
        }, self.innerCompile = function(elm) {
            $compile(elm)($scope);
        };
    } ]), angular.module("ui.grid").directive("uiGrid", uiGridDirective), uiGridDirective.$inject = [ "$window", "gridUtil", "uiGridConstants" ];
}(), function() {
    "use strict";
    angular.module("ui.grid").directive("uiGridPinnedContainer", [ "gridUtil", function(gridUtil) {
        return {
            restrict: "EA",
            replace: !0,
            template: '<div class="ui-grid-pinned-container"><div ui-grid-render-container container-id="side" row-container-name="\'body\'" col-container-name="side" bind-scroll-vertical="true" class="{{ side }} ui-grid-render-container-{{ side }}"></div></div>',
            scope: {
                side: "=uiGridPinnedContainer"
            },
            require: "^uiGrid",
            compile: function() {
                return {
                    post: function($scope, $elm, $attrs, uiGridCtrl) {
                        var grid = uiGridCtrl.grid, myWidth = 0;
                        function updateContainerWidth() {
                            if ("left" === $scope.side || "right" === $scope.side) {
                                for (var cols = grid.renderContainers[$scope.side].visibleColumnCache, width = 0, i = 0; i < cols.length; i++) {
                                    var col = cols[i];
                                    width += col.drawnWidth || col.width || 0;
                                }
                                return width;
                            }
                        }
                        $elm.addClass("ui-grid-pinned-container-" + $scope.side), "left" !== $scope.side && "right" !== $scope.side || (grid.renderContainers[$scope.side].getViewportWidth = function() {
                            var viewportWidth = 0;
                            this.visibleColumnCache.forEach(function(column) {
                                viewportWidth += column.drawnWidth;
                            });
                            var adjustment = this.getViewportAdjustment();
                            return viewportWidth += adjustment.width;
                        }), grid.renderContainers.body.registerViewportAdjuster(function(adjustment) {
                            return myWidth = updateContainerWidth(), adjustment.width -= myWidth, adjustment.side = $scope.side, 
                            adjustment;
                        }), grid.registerStyleComputation({
                            priority: 15,
                            func: function() {
                                var ret = "";
                                return "left" !== $scope.side && "right" !== $scope.side || (myWidth = updateContainerWidth(), 
                                $elm.attr("style", null), ret += ".grid" + grid.id + " .ui-grid-pinned-container-" + $scope.side + ", .grid" + grid.id + " .ui-grid-pinned-container-" + $scope.side + " .ui-grid-render-container-" + $scope.side + " .ui-grid-viewport { width: " + myWidth + "px; } "), 
                                ret;
                            }
                        });
                    }
                };
            }
        };
    } ]);
}(), angular.module("ui.grid").factory("Grid", [ "$q", "$compile", "$parse", "gridUtil", "uiGridConstants", "GridOptions", "GridColumn", "GridRow", "GridApi", "rowSorter", "rowSearcher", "GridRenderContainer", "$timeout", "ScrollEvent", function($q, $compile, $parse, gridUtil, uiGridConstants, GridOptions, GridColumn, GridRow, GridApi, rowSorter, rowSearcher, GridRenderContainer, $timeout, ScrollEvent) {
    var Grid = function(options) {
        var self = this;
        if (void 0 === options || void 0 === options.id || !options.id) throw new Error("No ID provided. An ID must be given when creating a grid.");
        if (!/^[_a-zA-Z0-9-]+$/.test(options.id)) throw new Error("Grid id '" + options.id + '" is invalid. It must follow CSS selector syntax rules.');
        function vertical(scrollEvent) {
            self.isScrollingVertically = !1, self.api.core.raise.scrollEnd(scrollEvent), self.scrollDirection = uiGridConstants.scrollDirection.NONE;
        }
        self.id = options.id, delete options.id, self.options = GridOptions.initialize(options), 
        self.appScope = self.options.appScopeProvider, self.headerHeight = self.options.headerRowHeight, 
        self.footerHeight = self.calcFooterHeight(), self.columnFooterHeight = self.calcColumnFooterHeight(), 
        self.rtl = !1, self.gridHeight = 0, self.gridWidth = 0, self.columnBuilders = [], 
        self.rowBuilders = [], self.rowsProcessors = [], self.columnsProcessors = [], self.styleComputations = [], 
        self.viewportAdjusters = [], self.rowHeaderColumns = [], self.dataChangeCallbacks = {}, 
        self.verticalScrollSyncCallBackFns = {}, self.horizontalScrollSyncCallBackFns = {}, 
        self.renderContainers = {}, self.renderContainers.body = new GridRenderContainer("body", self), 
        self.cellValueGetterCache = {}, self.getRowTemplateFn = null, self.rows = [], self.columns = [], 
        self.isScrollingVertically = !1, self.isScrollingHorizontally = !1, self.scrollDirection = uiGridConstants.scrollDirection.NONE, 
        self.disableScrolling = !1;
        var debouncedVertical = gridUtil.debounce(vertical, self.options.scrollDebounce), debouncedVerticalMinDelay = gridUtil.debounce(vertical, 0);
        function horizontal(scrollEvent) {
            self.isScrollingHorizontally = !1, self.api.core.raise.scrollEnd(scrollEvent), self.scrollDirection = uiGridConstants.scrollDirection.NONE;
        }
        var debouncedHorizontal = gridUtil.debounce(horizontal, self.options.scrollDebounce), debouncedHorizontalMinDelay = gridUtil.debounce(horizontal, 0);
        self.flagScrollingVertically = function(scrollEvent) {
            self.isScrollingVertically || self.isScrollingHorizontally || self.api.core.raise.scrollBegin(scrollEvent), 
            self.isScrollingVertically = !0, 0 !== self.options.scrollDebounce && scrollEvent.withDelay ? debouncedVertical(scrollEvent) : debouncedVerticalMinDelay(scrollEvent);
        }, self.flagScrollingHorizontally = function(scrollEvent) {
            self.isScrollingVertically || self.isScrollingHorizontally || self.api.core.raise.scrollBegin(scrollEvent), 
            self.isScrollingHorizontally = !0, 0 !== self.options.scrollDebounce && scrollEvent.withDelay ? debouncedHorizontal(scrollEvent) : debouncedHorizontalMinDelay(scrollEvent);
        }, self.scrollbarHeight = 0, self.scrollbarWidth = 0, self.options.enableHorizontalScrollbar !== uiGridConstants.scrollbars.NEVER && (self.scrollbarHeight = gridUtil.getScrollbarWidth()), 
        self.options.enableVerticalScrollbar !== uiGridConstants.scrollbars.NEVER && (self.scrollbarWidth = gridUtil.getScrollbarWidth()), 
        self.api = new GridApi(self), self.api.registerMethod("core", "refresh", this.refresh), 
        self.api.registerMethod("core", "queueGridRefresh", this.queueGridRefresh), self.api.registerMethod("core", "refreshRows", this.refreshRows), 
        self.api.registerMethod("core", "queueRefresh", this.queueRefresh), self.api.registerMethod("core", "handleWindowResize", this.handleWindowResize), 
        self.api.registerMethod("core", "addRowHeaderColumn", this.addRowHeaderColumn), 
        self.api.registerMethod("core", "scrollToIfNecessary", function(gridRow, gridCol) {
            return self.scrollToIfNecessary(gridRow, gridCol);
        }), self.api.registerMethod("core", "scrollTo", function(rowEntity, colDef) {
            return self.scrollTo(rowEntity, colDef);
        }), self.api.registerMethod("core", "registerRowsProcessor", this.registerRowsProcessor), 
        self.api.registerMethod("core", "registerColumnsProcessor", this.registerColumnsProcessor), 
        self.api.registerMethod("core", "sortHandleNulls", rowSorter.handleNulls), self.api.registerEvent("core", "sortChanged"), 
        self.api.registerEvent("core", "columnVisibilityChanged"), self.api.registerMethod("core", "notifyDataChange", this.notifyDataChange), 
        self.api.registerMethod("core", "clearAllFilters", this.clearAllFilters), self.registerDataChangeCallback(self.columnRefreshCallback, [ uiGridConstants.dataChange.COLUMN ]), 
        self.registerDataChangeCallback(self.processRowsCallback, [ uiGridConstants.dataChange.EDIT ]), 
        self.registerDataChangeCallback(self.updateFooterHeightCallback, [ uiGridConstants.dataChange.OPTIONS ]), 
        self.registerStyleComputation({
            priority: 10,
            func: self.getFooterStyles
        });
    };
    Grid.prototype.calcFooterHeight = function() {
        if (!this.hasFooter()) return 0;
        var height = 0;
        return this.options.showGridFooter && (height += this.options.gridFooterHeight), 
        height += this.calcColumnFooterHeight();
    }, Grid.prototype.calcColumnFooterHeight = function() {
        var height = 0;
        return this.options.showColumnFooter && (height += this.options.columnFooterHeight), 
        height;
    }, Grid.prototype.getFooterStyles = function() {
        var style = ".grid" + this.id + " .ui-grid-footer-aggregates-row { height: " + this.options.columnFooterHeight + "px; }";
        return style += " .grid" + this.id + " .ui-grid-footer-info { height: " + this.options.gridFooterHeight + "px; }";
    }, Grid.prototype.hasFooter = function() {
        return this.options.showGridFooter || this.options.showColumnFooter;
    }, Grid.prototype.isRTL = function() {
        return this.rtl;
    }, Grid.prototype.registerColumnBuilder = function(columnBuilder) {
        this.columnBuilders.push(columnBuilder);
    }, Grid.prototype.buildColumnDefsFromData = function(dataRows) {
        this.options.columnDefs = gridUtil.getColumnsFromData(dataRows, this.options.excludeProperties);
    }, Grid.prototype.registerRowBuilder = function(rowBuilder) {
        this.rowBuilders.push(rowBuilder);
    }, Grid.prototype.registerDataChangeCallback = function(callback, types, _this) {
        var uid = gridUtil.nextUid();
        types || (types = [ uiGridConstants.dataChange.ALL ]), Array.isArray(types) || gridUtil.logError("Expected types to be an array or null in registerDataChangeCallback, value passed was: " + types), 
        this.dataChangeCallbacks[uid] = {
            callback: callback,
            types: types,
            _this: _this
        };
        var self = this;
        return function() {
            delete self.dataChangeCallbacks[uid];
        };
    }, Grid.prototype.callDataChangeCallbacks = function(type, options) {
        angular.forEach(this.dataChangeCallbacks, function(callback, uid) {
            -1 === callback.types.indexOf(uiGridConstants.dataChange.ALL) && -1 === callback.types.indexOf(type) && type !== uiGridConstants.dataChange.ALL || (callback._this ? callback.callback.apply(callback._this, this, options) : callback.callback(this, options));
        }, this);
    }, Grid.prototype.notifyDataChange = function(type) {
        var constants = uiGridConstants.dataChange;
        type === constants.ALL || type === constants.COLUMN || type === constants.EDIT || type === constants.ROW || type === constants.OPTIONS ? this.callDataChangeCallbacks(type) : gridUtil.logError("Notified of a data change, but the type was not recognised, so no action taken, type was: " + type);
    }, Grid.prototype.columnRefreshCallback = function(grid, options) {
        grid.buildColumns(options), grid.queueGridRefresh();
    }, Grid.prototype.processRowsCallback = function(grid) {
        grid.queueGridRefresh();
    }, Grid.prototype.updateFooterHeightCallback = function(grid) {
        grid.footerHeight = grid.calcFooterHeight(), grid.columnFooterHeight = grid.calcColumnFooterHeight();
    }, Grid.prototype.getColumn = function(name) {
        var columns = this.columns.filter(function(column) {
            return column.colDef.name === name;
        });
        return 0 < columns.length ? columns[0] : null;
    }, Grid.prototype.getColDef = function(name) {
        var colDefs = this.options.columnDefs.filter(function(colDef) {
            return colDef.name === name;
        });
        return 0 < colDefs.length ? colDefs[0] : null;
    }, Grid.prototype.assignTypes = function() {
        var self = this;
        self.options.columnDefs.forEach(function(colDef, index) {
            if (!colDef.type) {
                var col = new GridColumn(colDef, index, self), firstRow = 0 < self.rows.length ? self.rows[0] : null;
                colDef.type = firstRow ? gridUtil.guessType(self.getCellValue(firstRow, col)) : "string";
            }
        });
    }, Grid.prototype.isRowHeaderColumn = function(column) {
        return -1 !== this.rowHeaderColumns.indexOf(column);
    }, Grid.prototype.addRowHeaderColumn = function(colDef, order, stopColumnBuild) {
        var self = this;
        void 0 === order && (order = 0);
        var rowHeaderCol = new GridColumn(colDef, gridUtil.nextUid(), self);
        rowHeaderCol.isRowHeader = !0, self.isRTL() ? (self.createRightContainer(), rowHeaderCol.renderContainer = "right") : (self.createLeftContainer(), 
        rowHeaderCol.renderContainer = "left"), self.columnBuilders[0](colDef, rowHeaderCol, self.options).then(function() {
            rowHeaderCol.enableFiltering = !1, rowHeaderCol.enableSorting = !1, rowHeaderCol.enableHiding = !1, 
            rowHeaderCol.headerPriority = order, self.rowHeaderColumns.push(rowHeaderCol), self.rowHeaderColumns = self.rowHeaderColumns.sort(function(a, b) {
                return a.headerPriority - b.headerPriority;
            }), stopColumnBuild || self.buildColumns().then(function() {
                self.preCompileCellTemplates(), self.queueGridRefresh();
            }).catch(angular.noop);
        }).catch(angular.noop);
    }, Grid.prototype.getOnlyDataColumns = function() {
        var self = this, cols = [];
        return self.columns.forEach(function(col) {
            -1 === self.rowHeaderColumns.indexOf(col) && cols.push(col);
        }), cols;
    }, Grid.prototype.buildColumns = function(opts) {
        var options = {
            orderByColumnDefs: !1
        };
        angular.extend(options, opts);
        var i, self = this, builderPromises = [], headerOffset = self.rowHeaderColumns.length;
        for (i = 0; i < self.columns.length; i++) self.getColDef(self.columns[i].name) || (self.columns.splice(i, 1), 
        i--);
        for (var j = self.rowHeaderColumns.length - 1; 0 <= j; j--) self.columns.unshift(self.rowHeaderColumns[j]);
        if (self.options.columnDefs.forEach(function(colDef, index) {
            self.preprocessColDef(colDef);
            var col = self.getColumn(colDef.name);
            col ? col.updateColumnDef(colDef, !1) : (col = new GridColumn(colDef, gridUtil.nextUid(), self), 
            self.columns.splice(index + headerOffset, 0, col)), self.columnBuilders.forEach(function(builder) {
                builderPromises.push(builder.call(self, colDef, col, self.options));
            });
        }), options.orderByColumnDefs) {
            var columnCache = self.columns.slice(0), len = Math.min(self.options.columnDefs.length, self.columns.length);
            for (i = 0; i < len; i++) self.columns[i + headerOffset].name !== self.options.columnDefs[i].name ? columnCache[i + headerOffset] = self.getColumn(self.options.columnDefs[i].name) : columnCache[i + headerOffset] = self.columns[i + headerOffset];
            self.columns.length = 0, Array.prototype.splice.apply(self.columns, [ 0, 0 ].concat(columnCache));
        }
        return $q.all(builderPromises).then(function() {
            0 < self.rows.length && self.assignTypes(), options.preCompileCellTemplates && self.preCompileCellTemplates();
        }).catch(angular.noop);
    }, Grid.prototype.preCompileCellTemplate = function(col) {
        var html = col.cellTemplate.replace(uiGridConstants.MODEL_COL_FIELD, this.getQualifiedColField(col));
        html = html.replace(uiGridConstants.COL_FIELD, "grid.getCellValue(row, col)"), col.compiledElementFn = $compile(html), 
        col.compiledElementFnDefer && col.compiledElementFnDefer.resolve(col.compiledElementFn);
    }, Grid.prototype.preCompileCellTemplates = function() {
        var self = this;
        self.columns.forEach(function(col) {
            col.cellTemplate ? self.preCompileCellTemplate(col) : col.cellTemplatePromise && col.cellTemplatePromise.then(function() {
                self.preCompileCellTemplate(col);
            }).catch(angular.noop);
        });
    }, Grid.prototype.getQualifiedColField = function(col) {
        return col.field === uiGridConstants.ENTITY_BINDING ? "row.entity" : gridUtil.preEval("row.entity." + col.field);
    }, Grid.prototype.createLeftContainer = function() {
        this.hasLeftContainer() || (this.renderContainers.left = new GridRenderContainer("left", this, {
            disableColumnOffset: !0
        }));
    }, Grid.prototype.createRightContainer = function() {
        this.hasRightContainer() || (this.renderContainers.right = new GridRenderContainer("right", this, {
            disableColumnOffset: !0
        }));
    }, Grid.prototype.hasLeftContainer = function() {
        return void 0 !== this.renderContainers.left;
    }, Grid.prototype.hasRightContainer = function() {
        return void 0 !== this.renderContainers.right;
    }, Grid.prototype.preprocessColDef = function(colDef) {
        if (!colDef.field && !colDef.name) throw new Error("colDef.name or colDef.field property is required");
        if (void 0 === colDef.name && void 0 !== colDef.field) {
            for (var newName = colDef.field, counter = 2; this.getColumn(newName); ) newName = colDef.field + counter.toString(), 
            counter++;
            colDef.name = newName;
        }
    }, Grid.prototype.newInN = function(o, n, oAccessor, nAccessor) {
        for (var t = [], i = 0; i < n.length; i++) {
            for (var nV = nAccessor ? n[i][nAccessor] : n[i], found = !1, j = 0; j < o.length; j++) {
                var oV = oAccessor ? o[j][oAccessor] : o[j];
                if (this.options.rowEquality(nV, oV)) {
                    found = !0;
                    break;
                }
            }
            found || t.push(nV);
        }
        return t;
    }, Grid.prototype.getRow = function(rowEntity, lookInRows) {
        var self = this, rows = (lookInRows = void 0 === lookInRows ? self.rows : lookInRows).filter(function(row) {
            return self.options.rowEquality(row.entity, rowEntity);
        });
        return 0 < rows.length ? rows[0] : null;
    }, Grid.prototype.modifyRows = function(newRawData) {
        var self = this, oldRows = self.rows.slice(0), oldRowHash = self.rowHashMap || self.createRowHashMap(), allRowsSelected = !0;
        self.rowHashMap = self.createRowHashMap(), self.rows.length = 0, newRawData.forEach(function(newEntity, i) {
            var newRow, oldRow;
            (oldRow = self.options.enableRowHashing ? oldRowHash.get(newEntity) : self.getRow(newEntity, oldRows)) && ((newRow = oldRow).entity = newEntity), 
            newRow || (newRow = self.processRowBuilders(new GridRow(newEntity, i, self))), self.rows.push(newRow), 
            self.rowHashMap.put(newEntity, newRow), newRow.isSelected || (allRowsSelected = !1);
        }), self.selection && self.rows.length && (self.selection.selectAll = allRowsSelected), 
        self.assignTypes();
        var p1 = $q.when(self.processRowsProcessors(self.rows)).then(function(renderableRows) {
            return self.setVisibleRows(renderableRows);
        }).catch(angular.noop), p2 = $q.when(self.processColumnsProcessors(self.columns)).then(function(renderableColumns) {
            return self.setVisibleColumns(renderableColumns);
        }).catch(angular.noop);
        return $q.all([ p1, p2 ]);
    }, Grid.prototype.addRows = function(newRawData) {
        for (var existingRowCount = this.rows.length, i = 0; i < newRawData.length; i++) {
            var newRow = this.processRowBuilders(new GridRow(newRawData[i], i + existingRowCount, this));
            if (this.options.enableRowHashing) {
                var found = this.rowHashMap.get(newRow.entity);
                found && (found.row = newRow);
            }
            this.rows.push(newRow);
        }
    }, Grid.prototype.processRowBuilders = function(gridRow) {
        var self = this;
        return self.rowBuilders.forEach(function(builder) {
            builder.call(self, gridRow, self.options);
        }), gridRow;
    }, Grid.prototype.registerStyleComputation = function(styleComputationInfo) {
        this.styleComputations.push(styleComputationInfo);
    }, Grid.prototype.registerRowsProcessor = function(processor, priority) {
        if (!angular.isFunction(processor)) throw "Attempt to register non-function rows processor: " + processor;
        this.rowsProcessors.push({
            processor: processor,
            priority: priority
        }), this.rowsProcessors.sort(function(a, b) {
            return a.priority - b.priority;
        });
    }, Grid.prototype.removeRowsProcessor = function(processor) {
        var idx = -1;
        this.rowsProcessors.forEach(function(rowsProcessor, index) {
            rowsProcessor.processor === processor && (idx = index);
        }), -1 !== idx && this.rowsProcessors.splice(idx, 1);
    }, Grid.prototype.processRowsProcessors = function(renderableRows) {
        var self = this, myRenderableRows = renderableRows.slice(0);
        if (0 === self.rowsProcessors.length) return $q.when(myRenderableRows);
        var finished = $q.defer();
        return function startProcessor(i, renderedRowsToProcess) {
            var processor = self.rowsProcessors[i].processor;
            return $q.when(processor.call(self, renderedRowsToProcess, self.columns)).then(function(processedRows) {
                if (!processedRows) throw "Processor at index " + i + " did not return a set of renderable rows";
                if (!angular.isArray(processedRows)) throw "Processor at index " + i + " did not return an array";
                if (++i <= self.rowsProcessors.length - 1) return startProcessor(i, processedRows);
                finished.resolve(processedRows);
            }).catch(function(error) {
                throw error;
            });
        }(0, myRenderableRows), finished.promise;
    }, Grid.prototype.setVisibleRows = function(rows) {
        for (var i in this.renderContainers) {
            var container = this.renderContainers[i];
            container.canvasHeightShouldUpdate = !0, void 0 === container.visibleRowCache ? container.visibleRowCache = [] : container.visibleRowCache.length = 0;
        }
        for (var ri = 0; ri < rows.length; ri++) {
            var row = rows[ri], targetContainer = void 0 !== row.renderContainer && row.renderContainer ? row.renderContainer : "body";
            row.visible && this.renderContainers[targetContainer].visibleRowCache.push(row);
        }
        this.api.core.raise.rowsVisibleChanged(this.api), this.api.core.raise.rowsRendered(this.api);
    }, Grid.prototype.registerColumnsProcessor = function(processor, priority) {
        if (!angular.isFunction(processor)) throw "Attempt to register non-function rows processor: " + processor;
        this.columnsProcessors.push({
            processor: processor,
            priority: priority
        }), this.columnsProcessors.sort(function(a, b) {
            return a.priority - b.priority;
        });
    }, Grid.prototype.removeColumnsProcessor = function(processor) {
        var idx = this.columnsProcessors.indexOf(processor);
        void 0 !== idx && void 0 !== idx && this.columnsProcessors.splice(idx, 1);
    }, Grid.prototype.processColumnsProcessors = function(renderableColumns) {
        var self = this, myRenderableColumns = renderableColumns.slice(0);
        if (0 === self.columnsProcessors.length) return $q.when(myRenderableColumns);
        var finished = $q.defer();
        return function startProcessor(i, renderedColumnsToProcess) {
            var processor = self.columnsProcessors[i].processor;
            return $q.when(processor.call(self, renderedColumnsToProcess, self.rows)).then(function(processedColumns) {
                if (!processedColumns) throw "Processor at index " + i + " did not return a set of renderable rows";
                if (!angular.isArray(processedColumns)) throw "Processor at index " + i + " did not return an array";
                if (++i <= self.columnsProcessors.length - 1) return startProcessor(i, myRenderableColumns);
                finished.resolve(myRenderableColumns);
            }).catch(angular.noop);
        }(0, myRenderableColumns), finished.promise;
    }, Grid.prototype.setVisibleColumns = function(columns) {
        for (var i in this.renderContainers) this.renderContainers[i].visibleColumnCache.length = 0;
        for (var ci = 0; ci < columns.length; ci++) {
            var column = columns[ci];
            column.visible && (void 0 !== column.renderContainer && column.renderContainer ? this.renderContainers[column.renderContainer].visibleColumnCache.push(column) : this.renderContainers.body.visibleColumnCache.push(column));
        }
    }, Grid.prototype.handleWindowResize = function($event) {
        return this.gridWidth = gridUtil.elementWidth(this.element), this.gridHeight = gridUtil.elementHeight(this.element), 
        this.queueRefresh();
    }, Grid.prototype.queueRefresh = function() {
        var self = this;
        return self.refreshCanceller && $timeout.cancel(self.refreshCanceller), self.refreshCanceller = $timeout(function() {
            self.refreshCanvas(!0);
        }), self.refreshCanceller.then(function() {
            self.refreshCanceller = null;
        }).catch(angular.noop), self.refreshCanceller;
    }, Grid.prototype.queueGridRefresh = function() {
        var self = this;
        return self.gridRefreshCanceller && $timeout.cancel(self.gridRefreshCanceller), 
        self.gridRefreshCanceller = $timeout(function() {
            self.refresh(!0);
        }), self.gridRefreshCanceller.then(function() {
            self.gridRefreshCanceller = null;
        }).catch(angular.noop), self.gridRefreshCanceller;
    }, Grid.prototype.updateCanvasHeight = function() {
        for (var containerId in this.renderContainers) this.renderContainers.hasOwnProperty(containerId) && (this.renderContainers[containerId].canvasHeightShouldUpdate = !0);
    }, Grid.prototype.buildStyles = function() {
        var self = this;
        self.customStyles = "", self.styleComputations.sort(function(a, b) {
            return null === a.priority ? 1 : null === b.priority ? -1 : null === a.priority && null === b.priority ? 0 : a.priority - b.priority;
        }).forEach(function(compInfo) {
            var ret = compInfo.func.call(self);
            angular.isString(ret) && (self.customStyles += "\n" + ret);
        });
    }, Grid.prototype.minColumnsToRender = function() {
        var self = this, viewport = this.getViewportWidth(), min = 0, totalWidth = 0;
        return self.columns.forEach(function(col, i) {
            if (totalWidth < viewport) totalWidth += col.drawnWidth, min++; else {
                for (var currWidth = 0, j = i; i - min <= j; j--) currWidth += self.columns[j].drawnWidth;
                currWidth < viewport && min++;
            }
        }), min;
    }, Grid.prototype.getBodyHeight = function() {
        return this.getViewportHeight();
    }, Grid.prototype.getViewportHeight = function() {
        var viewPortHeight = this.gridHeight - this.headerHeight - this.footerHeight;
        return viewPortHeight += this.getViewportAdjustment().height;
    }, Grid.prototype.getViewportWidth = function() {
        var viewPortWidth = this.gridWidth;
        return viewPortWidth += this.getViewportAdjustment().width;
    }, Grid.prototype.getHeaderViewportWidth = function() {
        return this.getViewportWidth();
    }, Grid.prototype.addVerticalScrollSync = function(containerId, callBackFn) {
        this.verticalScrollSyncCallBackFns[containerId] = callBackFn;
    }, Grid.prototype.addHorizontalScrollSync = function(containerId, callBackFn) {
        this.horizontalScrollSyncCallBackFns[containerId] = callBackFn;
    }, Grid.prototype.scrollContainers = function(sourceContainerId, scrollEvent) {
        if (scrollEvent.y) {
            var verts = [ "body", "left", "right" ];
            this.flagScrollingVertically(scrollEvent), "body" === sourceContainerId ? verts = [ "left", "right" ] : "left" === sourceContainerId ? verts = [ "body", "right" ] : "right" === sourceContainerId && (verts = [ "body", "left" ]);
            for (var i = 0; i < verts.length; i++) {
                var id = verts[i];
                this.verticalScrollSyncCallBackFns[id] && this.verticalScrollSyncCallBackFns[id](scrollEvent);
            }
        }
        if (scrollEvent.x) {
            var horizs = [ "body", "bodyheader", "bodyfooter" ];
            this.flagScrollingHorizontally(scrollEvent), "body" === sourceContainerId && (horizs = [ "bodyheader", "bodyfooter" ]);
            for (var j = 0; j < horizs.length; j++) {
                var idh = horizs[j];
                this.horizontalScrollSyncCallBackFns[idh] && this.horizontalScrollSyncCallBackFns[idh](scrollEvent);
            }
        }
    }, Grid.prototype.registerViewportAdjuster = function(func) {
        this.viewportAdjusters.push(func);
    }, Grid.prototype.removeViewportAdjuster = function(func) {
        var idx = this.viewportAdjusters.indexOf(func);
        void 0 !== idx && void 0 !== idx && this.viewportAdjusters.splice(idx, 1);
    }, Grid.prototype.getViewportAdjustment = function() {
        var adjustment = {
            height: 0,
            width: 0
        };
        return this.viewportAdjusters.forEach(function(func) {
            adjustment = func.call(this, adjustment);
        }), adjustment;
    }, Grid.prototype.getVisibleRowCount = function() {
        return this.renderContainers.body.visibleRowCache.length;
    }, Grid.prototype.getVisibleRows = function() {
        return this.renderContainers.body.visibleRowCache;
    }, Grid.prototype.getVisibleColumnCount = function() {
        return this.renderContainers.body.visibleColumnCache.length;
    }, Grid.prototype.searchRows = function(renderableRows) {
        return rowSearcher.search(this, renderableRows, this.columns);
    }, Grid.prototype.sortByColumn = function(renderableRows) {
        return rowSorter.sort(this, renderableRows, this.columns);
    }, Grid.prototype.getCellValue = function(row, col) {
        return void 0 !== row.entity["$$" + col.uid] ? row.entity["$$" + col.uid].rendered : this.options.flatEntityAccess && void 0 !== col.field ? row.entity[col.field] : (col.cellValueGetterCache || (col.cellValueGetterCache = $parse(row.getEntityQualifiedColField(col))), 
        col.cellValueGetterCache(row));
    }, Grid.prototype.getCellDisplayValue = function(row, col) {
        if (!col.cellDisplayGetterCache) {
            var custom_filter = col.cellFilter ? " | " + col.cellFilter : "";
            if (void 0 !== row.entity["$$" + col.uid]) col.cellDisplayGetterCache = $parse(row.entity["$$" + col.uid].rendered + custom_filter); else if (this.options.flatEntityAccess && void 0 !== col.field) {
                var colField = col.field.replace(/(')|(\\)/g, "\\$&");
                col.cellDisplayGetterCache = $parse("entity['" + colField + "']" + custom_filter);
            } else col.cellDisplayGetterCache = $parse(row.getEntityQualifiedColField(col) + custom_filter);
        }
        var rowWithCol = angular.extend({}, row, {
            col: col
        });
        return col.cellDisplayGetterCache(rowWithCol);
    }, Grid.prototype.getNextColumnSortPriority = function() {
        var p = 0;
        return this.columns.forEach(function(col) {
            col.sort && void 0 !== col.sort.priority && col.sort.priority >= p && (p = col.sort.priority + 1);
        }), p;
    }, Grid.prototype.resetColumnSorting = function(excludeCol) {
        this.columns.forEach(function(col) {
            col === excludeCol || col.suppressRemoveSort || (col.sort = {});
        });
    }, Grid.prototype.getColumnSorting = function() {
        var sortedCols = [];
        return this.columns.slice(0).sort(rowSorter.prioritySort).forEach(function(col) {
            col.sort && void 0 !== col.sort.direction && col.sort.direction && (col.sort.direction === uiGridConstants.ASC || col.sort.direction === uiGridConstants.DESC) && sortedCols.push(col);
        }), sortedCols;
    }, Grid.prototype.sortColumn = function(column, directionOrAdd, add) {
        var direction = null;
        if (void 0 === column || !column) throw new Error("No column parameter provided");
        if ("boolean" == typeof directionOrAdd ? add = directionOrAdd : direction = directionOrAdd, 
        add ? void 0 === column.sort.priority && (column.sort.priority = this.getNextColumnSortPriority()) : (this.resetColumnSorting(column), 
        column.sort.priority = void 0, column.sort.priority = this.getNextColumnSortPriority()), 
        direction) column.sort.direction = direction; else {
            var i = column.sortDirectionCycle.indexOf(column.sort.direction ? column.sort.direction : null);
            i = (i + 1) % column.sortDirectionCycle.length, column.colDef && column.suppressRemoveSort && !column.sortDirectionCycle[i] && (i = (i + 1) % column.sortDirectionCycle.length), 
            column.sortDirectionCycle[i] ? column.sort.direction = column.sortDirectionCycle[i] : removeSortOfColumn(column, this);
        }
        return this.api.core.raise.sortChanged(this, this.getColumnSorting()), $q.when(column);
    };
    var removeSortOfColumn = function(column, grid) {
        grid.columns.forEach(function(col) {
            col.sort && void 0 !== col.sort.priority && col.sort.priority > column.sort.priority && (col.sort.priority -= 1);
        }), column.sort = {};
    };
    function getScrollPercentage(scrollPixels, scrollLength) {
        var percentage = scrollPixels / scrollLength;
        return percentage <= 1 ? percentage : 1;
    }
    function getScrollY(scrollPixels, scrollLength, prevScrolltopPercentage) {
        if (getScrollPercentage(scrollPixels, scrollLength) !== prevScrolltopPercentage) return {
            percentage: getScrollPercentage(scrollPixels, scrollLength)
        };
    }
    function getScrollX(horizScrollPixels, horizScrollLength, prevScrollleftPercentage) {
        var horizPercentage = horizScrollPixels / horizScrollLength;
        if ((horizPercentage = 1 < horizPercentage ? 1 : horizPercentage) !== prevScrollleftPercentage) return {
            percentage: horizPercentage
        };
    }
    function RowHashMap() {}
    return Grid.prototype.renderingComplete = function() {
        angular.isFunction(this.options.onRegisterApi) && this.options.onRegisterApi(this.api), 
        this.api.core.raise.renderingComplete(this.api);
    }, Grid.prototype.createRowHashMap = function() {
        var hashMap = new RowHashMap();
        return hashMap.grid = this, hashMap;
    }, Grid.prototype.refresh = function(rowsAltered) {
        var self = this, p1 = self.processRowsProcessors(self.rows).then(function(renderableRows) {
            self.setVisibleRows(renderableRows);
        }).catch(angular.noop), p2 = self.processColumnsProcessors(self.columns).then(function(renderableColumns) {
            self.setVisibleColumns(renderableColumns);
        }).catch(angular.noop);
        return $q.all([ p1, p2 ]).then(function() {
            self.refreshCanvas(!0), self.redrawInPlace(rowsAltered);
        }).catch(angular.noop);
    }, Grid.prototype.refreshRows = function() {
        var self = this;
        return self.processRowsProcessors(self.rows).then(function(renderableRows) {
            self.setVisibleRows(renderableRows), self.redrawInPlace(), self.refreshCanvas(!0);
        }).catch(angular.noop);
    }, Grid.prototype.refreshCanvas = function(buildStyles) {
        var self = this, p = $q.defer(), containerHeadersToRecalc = [];
        for (var containerId in self.renderContainers) if (self.renderContainers.hasOwnProperty(containerId)) {
            var container = self.renderContainers[containerId];
            if (null === container.canvasWidth || isNaN(container.canvasWidth)) continue;
            (container.header || container.headerCanvas) && (container.explicitHeaderHeight = container.explicitHeaderHeight || null, 
            container.explicitHeaderCanvasHeight = container.explicitHeaderCanvasHeight || null, 
            containerHeadersToRecalc.push(container));
        }
        return buildStyles && self.buildStyles(), 0 < containerHeadersToRecalc.length ? $timeout(function() {
            var i, container, rebuildStyles = !1, maxHeaderHeight = 0, maxHeaderCanvasHeight = 0, getHeight = function(oldVal, newVal) {
                return oldVal !== newVal && (rebuildStyles = !0), newVal;
            };
            for (i = 0; i < containerHeadersToRecalc.length; i++) if (null !== (container = containerHeadersToRecalc[i]).canvasWidth && !isNaN(container.canvasWidth)) {
                if (container.header) {
                    var headerHeight = container.headerHeight = getHeight(container.headerHeight, gridUtil.outerElementHeight(container.header)), topBorder = gridUtil.getBorderSize(container.header, "top"), bottomBorder = gridUtil.getBorderSize(container.header, "bottom"), innerHeaderHeight = parseInt(headerHeight - topBorder - bottomBorder, 10);
                    innerHeaderHeight = innerHeaderHeight < 0 ? 0 : innerHeaderHeight, container.innerHeaderHeight = innerHeaderHeight, 
                    !container.explicitHeaderHeight && maxHeaderHeight < innerHeaderHeight && (maxHeaderHeight = innerHeaderHeight);
                }
                if (container.headerCanvas) {
                    var headerCanvasHeight = container.headerCanvasHeight = getHeight(container.headerCanvasHeight, parseInt(gridUtil.outerElementHeight(container.headerCanvas), 10));
                    !container.explicitHeaderCanvasHeight && maxHeaderCanvasHeight < headerCanvasHeight && (maxHeaderCanvasHeight = headerCanvasHeight);
                }
            }
            for (i = 0; i < containerHeadersToRecalc.length; i++) container = containerHeadersToRecalc[i], 
            0 < maxHeaderHeight && void 0 !== container.headerHeight && null !== container.headerHeight && (container.explicitHeaderHeight || container.headerHeight < maxHeaderHeight) && (container.explicitHeaderHeight = getHeight(container.explicitHeaderHeight, maxHeaderHeight)), 
            0 < maxHeaderCanvasHeight && void 0 !== container.headerCanvasHeight && null !== container.headerCanvasHeight && (container.explicitHeaderCanvasHeight || container.headerCanvasHeight < maxHeaderCanvasHeight) && (container.explicitHeaderCanvasHeight = getHeight(container.explicitHeaderCanvasHeight, maxHeaderCanvasHeight));
            buildStyles && rebuildStyles && self.buildStyles(), p.resolve();
        }) : $timeout(function() {
            p.resolve();
        }), p.promise;
    }, Grid.prototype.redrawInPlace = function(rowsAdded) {
        for (var i in this.renderContainers) {
            var container = this.renderContainers[i];
            rowsAdded ? (container.adjustRows(container.prevScrollTop, null), container.adjustColumns(container.prevScrollLeft, null)) : (container.adjustRows(null, container.prevScrolltopPercentage), 
            container.adjustColumns(null, container.prevScrollleftPercentage));
        }
    }, Grid.prototype.hasLeftContainerColumns = function() {
        return this.hasLeftContainer() && 0 < this.renderContainers.left.renderedColumns.length;
    }, Grid.prototype.hasRightContainerColumns = function() {
        return this.hasRightContainer() && 0 < this.renderContainers.right.renderedColumns.length;
    }, Grid.prototype.scrollToIfNecessary = function(gridRow, gridCol) {
        var scrollEvent = new ScrollEvent(this, "uiGrid.scrollToIfNecessary"), visRowCache = this.renderContainers.body.visibleRowCache, visColCache = this.renderContainers.body.visibleColumnCache, topBound = this.renderContainers.body.prevScrollTop + this.headerHeight;
        topBound = topBound < 0 ? 0 : topBound;
        var leftBound = this.renderContainers.body.prevScrollLeft, bottomBound = this.renderContainers.body.prevScrollTop + this.gridHeight - this.renderContainers.body.headerHeight - this.footerHeight - this.scrollbarHeight, rightBound = this.renderContainers.body.prevScrollLeft + Math.ceil(this.renderContainers.body.getViewportWidth());
        if (null !== gridRow) {
            var scrollPixels, seekRowIndex = visRowCache.indexOf(gridRow), scrollLength = this.renderContainers.body.getCanvasHeight() - this.renderContainers.body.getViewportHeight(), pixelsToSeeRow = seekRowIndex * this.options.rowHeight + this.headerHeight;
            (pixelsToSeeRow = pixelsToSeeRow < 0 ? 0 : pixelsToSeeRow) < Math.floor(topBound) ? (scrollPixels = this.renderContainers.body.prevScrollTop - (topBound - pixelsToSeeRow), 
            gridCol && gridCol.colDef && gridCol.colDef.enableCellEditOnFocus && (scrollPixels = scrollPixels - this.footerHeight - this.scrollbarHeight), 
            scrollEvent.y = getScrollY(scrollPixels, scrollLength, this.renderContainers.body.prevScrolltopPercentage)) : pixelsToSeeRow > Math.ceil(bottomBound) && (scrollPixels = pixelsToSeeRow - bottomBound + this.renderContainers.body.prevScrollTop, 
            scrollEvent.y = getScrollY(scrollPixels, scrollLength, this.renderContainers.body.prevScrolltopPercentage));
        }
        if (null !== gridCol) {
            for (var seekColumnIndex = visColCache.indexOf(gridCol), horizScrollLength = this.renderContainers.body.getCanvasWidth() - this.renderContainers.body.getViewportWidth(), columnLeftEdge = 0, i = 0; i < seekColumnIndex; i++) columnLeftEdge += visColCache[i].drawnWidth;
            var horizScrollPixels, columnRightEdge = (columnLeftEdge = columnLeftEdge < 0 ? 0 : columnLeftEdge) + gridCol.drawnWidth;
            columnRightEdge = columnRightEdge < 0 ? 0 : columnRightEdge, columnLeftEdge < leftBound ? (horizScrollPixels = this.renderContainers.body.prevScrollLeft - (leftBound - columnLeftEdge), 
            scrollEvent.x = getScrollX(horizScrollPixels, horizScrollLength, this.renderContainers.body.prevScrollleftPercentage)) : rightBound < columnRightEdge && (horizScrollPixels = columnRightEdge - rightBound + this.renderContainers.body.prevScrollLeft, 
            scrollEvent.x = getScrollX(horizScrollPixels, horizScrollLength, this.renderContainers.body.prevScrollleftPercentage));
        }
        var deferred = $q.defer();
        if (scrollEvent.y || scrollEvent.x) {
            scrollEvent.withDelay = !1, this.scrollContainers("", scrollEvent);
            var dereg = this.api.core.on.scrollEnd(null, function() {
                deferred.resolve(scrollEvent), dereg();
            });
        } else deferred.resolve();
        return deferred.promise;
    }, Grid.prototype.scrollTo = function(rowEntity, colDef) {
        var gridRow = null, gridCol = null;
        return null != rowEntity && (gridRow = this.getRow(rowEntity)), null != colDef && (gridCol = this.getColumn(colDef.name ? colDef.name : colDef.field)), 
        this.scrollToIfNecessary(gridRow, gridCol);
    }, Grid.prototype.clearAllFilters = function(refreshRows, clearConditions, clearFlags) {
        if (void 0 === refreshRows && (refreshRows = !0), void 0 === clearConditions && (clearConditions = !1), 
        void 0 === clearFlags && (clearFlags = !1), this.columns.forEach(function(column) {
            column.filters.forEach(function(filter) {
                filter.term = void 0, clearConditions && (filter.condition = void 0), clearFlags && (filter.flags = void 0);
            });
        }), refreshRows) return this.refreshRows();
    }, RowHashMap.prototype = {
        put: function(key, value) {
            this[this.grid.options.rowIdentity(key)] = value;
        },
        get: function(key) {
            return this[this.grid.options.rowIdentity(key)];
        },
        remove: function(key) {
            var value = this[key = this.grid.options.rowIdentity(key)];
            return delete this[key], value;
        }
    }, Grid;
} ]), angular.module("ui.grid").factory("GridApi", [ "$q", "$rootScope", "gridUtil", "uiGridConstants", "GridRow", "uiGridGridMenuService", function($q, $rootScope, gridUtil, uiGridConstants, GridRow, uiGridGridMenuService) {
    var GridApi = function(grid) {
        this.grid = grid, this.listeners = [], this.registerEvent("core", "renderingComplete"), 
        this.registerEvent("core", "filterChanged"), this.registerMethod("core", "setRowInvisible", GridRow.prototype.setRowInvisible), 
        this.registerMethod("core", "clearRowInvisible", GridRow.prototype.clearRowInvisible), 
        this.registerMethod("core", "getVisibleRows", this.grid.getVisibleRows), this.registerEvent("core", "rowsVisibleChanged"), 
        this.registerEvent("core", "rowsRendered"), this.registerEvent("core", "scrollBegin"), 
        this.registerEvent("core", "scrollEnd"), this.registerEvent("core", "canvasHeightChanged"), 
        this.registerEvent("core", "gridDimensionChanged");
    };
    function registerEventWithAngular(eventId, handler, grid, _this) {
        return $rootScope.$on(eventId, function(event) {
            var args = Array.prototype.slice.call(arguments);
            args.splice(0, 1), handler.apply(_this || grid.api, args);
        });
    }
    return GridApi.prototype.suppressEvents = function(listenerFuncs, callBackFn) {
        var self = this, listeners = angular.isArray(listenerFuncs) ? listenerFuncs : [ listenerFuncs ], foundListeners = self.listeners.filter(function(listener) {
            return listeners.some(function(l) {
                return listener.handler === l;
            });
        });
        foundListeners.forEach(function(l) {
            l.dereg();
        }), callBackFn(), foundListeners.forEach(function(l) {
            l.dereg = registerEventWithAngular(l.eventId, l.handler, self.grid, l._this);
        });
    }, GridApi.prototype.registerEvent = function(featureName, eventName) {
        var self = this;
        self[featureName] || (self[featureName] = {});
        var feature = self[featureName];
        feature.on || (feature.on = {}, feature.raise = {});
        var eventId = self.grid.id + featureName + eventName;
        feature.raise[eventName] = function() {
            $rootScope.$emit.apply($rootScope, [ eventId ].concat(Array.prototype.slice.call(arguments)));
        }, feature.on[eventName] = function(scope, handler, _this) {
            if (null === scope || void 0 !== scope.$on) {
                var listener = {
                    handler: handler,
                    dereg: registerEventWithAngular(eventId, handler, self.grid, _this),
                    eventId: eventId,
                    scope: scope,
                    _this: _this
                };
                self.listeners.push(listener);
                var removeListener = function() {
                    listener.dereg();
                    var index = self.listeners.indexOf(listener);
                    self.listeners.splice(index, 1);
                };
                return scope && scope.$on("$destroy", function() {
                    removeListener();
                }), removeListener;
            }
            gridUtil.logError("asked to listen on " + featureName + ".on." + eventName + " but scope wasn't passed in the input parameters.  It is legitimate to pass null, but you've passed something else, so you probably forgot to provide scope rather than did it deliberately, not registering");
        };
    }, GridApi.prototype.registerEventsFromObject = function(eventObjectMap) {
        var self = this, features = [];
        angular.forEach(eventObjectMap, function(featProp, featPropName) {
            var feature = {
                name: featPropName,
                events: []
            };
            angular.forEach(featProp, function(prop, propName) {
                feature.events.push(propName);
            }), features.push(feature);
        }), features.forEach(function(feature) {
            feature.events.forEach(function(event) {
                self.registerEvent(feature.name, event);
            });
        });
    }, GridApi.prototype.registerMethod = function(featureName, methodName, callBackFn, _this) {
        this[featureName] || (this[featureName] = {}), this[featureName][methodName] = gridUtil.createBoundedWrapper(_this || this.grid, callBackFn);
    }, GridApi.prototype.registerMethodsFromObject = function(methodMap, _this) {
        var self = this, features = [];
        angular.forEach(methodMap, function(featProp, featPropName) {
            var feature = {
                name: featPropName,
                methods: []
            };
            angular.forEach(featProp, function(prop, propName) {
                feature.methods.push({
                    name: propName,
                    fn: prop
                });
            }), features.push(feature);
        }), features.forEach(function(feature) {
            feature.methods.forEach(function(method) {
                self.registerMethod(feature.name, method.name, method.fn, _this);
            });
        });
    }, GridApi;
} ]), angular.module("ui.grid").factory("GridColumn", [ "gridUtil", "uiGridConstants", "i18nService", function(gridUtil, uiGridConstants, i18nService) {
    function GridColumn(colDef, uid, grid) {
        var self = this;
        self.grid = grid, self.uid = uid, self.updateColumnDef(colDef, !0), self.aggregationValue = void 0, 
        self.updateAggregationValue = function() {
            if (self.aggregationType) {
                var result = 0, visibleRows = self.grid.getVisibleRows(), cellValues = function() {
                    var values = [];
                    return visibleRows.forEach(function(row) {
                        var cellValue = self.grid.getCellValue(row, self), cellNumber = Number(cellValue);
                        isNaN(cellNumber) || values.push(cellNumber);
                    }), values;
                };
                angular.isFunction(self.aggregationType) ? self.aggregationValue = self.aggregationType(visibleRows, self) : self.aggregationType === uiGridConstants.aggregationTypes.count ? self.aggregationValue = self.grid.getVisibleRowCount() : self.aggregationType === uiGridConstants.aggregationTypes.sum ? (cellValues().forEach(function(value) {
                    result += value;
                }), self.aggregationValue = result) : self.aggregationType === uiGridConstants.aggregationTypes.avg ? (cellValues().forEach(function(value) {
                    result += value;
                }), result /= cellValues().length, self.aggregationValue = result) : self.aggregationType === uiGridConstants.aggregationTypes.min ? self.aggregationValue = Math.min.apply(null, cellValues()) : self.aggregationType === uiGridConstants.aggregationTypes.max ? self.aggregationValue = Math.max.apply(null, cellValues()) : self.aggregationValue = " ";
            } else self.aggregationValue = void 0;
        }, this.getAggregationValue = function() {
            return self.aggregationValue;
        };
    }
    return GridColumn.prototype.hideColumn = function() {
        this.colDef.visible = !1;
    }, GridColumn.prototype.setPropertyOrDefault = function(colDef, propName, defaultValue) {
        void 0 !== colDef[propName] && colDef[propName] ? this[propName] = colDef[propName] : void 0 !== this[propName] ? this[propName] = this[propName] : this[propName] = defaultValue || {};
    }, GridColumn.prototype.updateColumnDef = function(colDef, isNew) {
        var self = this;
        if (void 0 === (self.colDef = colDef).name) throw new Error("colDef.name is required for column at index " + self.grid.options.columnDefs.indexOf(colDef));
        if (self.displayName = void 0 === colDef.displayName ? gridUtil.readableColumnName(colDef.name) : colDef.displayName, 
        !angular.isNumber(self.width) || !self.hasCustomWidth || colDef.allowCustomWidthOverride) {
            var colDefWidth = colDef.width, parseErrorMsg = "Cannot parse column width '" + colDefWidth + "' for column named '" + colDef.name + "'";
            if (self.hasCustomWidth = !1, angular.isString(colDefWidth) || angular.isNumber(colDefWidth)) if (angular.isString(colDefWidth)) if (gridUtil.endsWith(colDefWidth, "%")) {
                var percentStr = colDefWidth.replace(/%/g, ""), percent = parseInt(percentStr, 10);
                if (isNaN(percent)) throw new Error(parseErrorMsg);
                self.width = colDefWidth;
            } else if (colDefWidth.match(/^(\d+)$/)) self.width = parseInt(colDefWidth.match(/^(\d+)$/)[1], 10); else {
                if (!colDefWidth.match(/^\*+$/)) throw new Error(parseErrorMsg);
                self.width = colDefWidth;
            } else self.width = colDefWidth; else self.width = "*";
        }
        function isValidWidthValue(value) {
            return angular.isString(value) || angular.isNumber(value);
        }
        [ "minWidth", "maxWidth" ].forEach(function(name) {
            var minOrMaxWidth = colDef[name], parseErrorMsg = "Cannot parse column " + name + " '" + minOrMaxWidth + "' for column named '" + colDef.name + "'";
            if ("minWidth" === name && !isValidWidthValue(minOrMaxWidth) && angular.isDefined(self.grid.options.minimumColumnSize) && (minOrMaxWidth = self.grid.options.minimumColumnSize), 
            isValidWidthValue(minOrMaxWidth)) if (angular.isString(minOrMaxWidth)) {
                if (!minOrMaxWidth.match(/^(\d+)$/)) throw new Error(parseErrorMsg);
                self[name] = parseInt(minOrMaxWidth.match(/^(\d+)$/)[1], 10);
            } else self[name] = minOrMaxWidth; else self[name] = "minWidth" === name ? 30 : 9e3;
        }), self.field = void 0 === colDef.field ? colDef.name : colDef.field, "string" != typeof self.field && gridUtil.logError("Field is not a string, this is likely to break the code, Field is: " + self.field), 
        self.name = colDef.name, self.displayName = void 0 === colDef.displayName ? gridUtil.readableColumnName(colDef.name) : colDef.displayName, 
        self.aggregationType = angular.isDefined(colDef.aggregationType) ? colDef.aggregationType : null, 
        self.footerCellTemplate = angular.isDefined(colDef.footerCellTemplate) ? colDef.footerCellTemplate : null, 
        void 0 === colDef.cellTooltip || !1 === colDef.cellTooltip ? self.cellTooltip = !1 : !0 === colDef.cellTooltip ? self.cellTooltip = function(row, col) {
            return self.grid.getCellValue(row, col);
        } : "function" == typeof colDef.cellTooltip ? self.cellTooltip = colDef.cellTooltip : self.cellTooltip = function(row, col) {
            return col.colDef.cellTooltip;
        }, void 0 === colDef.headerTooltip || !1 === colDef.headerTooltip ? self.headerTooltip = !1 : !0 === colDef.headerTooltip ? self.headerTooltip = function(col) {
            return col.displayName;
        } : "function" == typeof colDef.headerTooltip ? self.headerTooltip = colDef.headerTooltip : self.headerTooltip = function(col) {
            return col.colDef.headerTooltip;
        }, self.footerCellClass = colDef.footerCellClass, self.cellClass = colDef.cellClass, 
        self.headerCellClass = colDef.headerCellClass, self.cellFilter = colDef.cellFilter ? colDef.cellFilter : "", 
        self.sortCellFiltered = !!colDef.sortCellFiltered, self.filterCellFiltered = !!colDef.filterCellFiltered, 
        self.headerCellFilter = colDef.headerCellFilter ? colDef.headerCellFilter : "", 
        self.footerCellFilter = colDef.footerCellFilter ? colDef.footerCellFilter : "", 
        self.visible = gridUtil.isNullOrUndefined(colDef.visible) || colDef.visible, self.headerClass = colDef.headerClass, 
        self.enableSorting = void 0 !== colDef.enableSorting ? colDef.enableSorting : self.grid.options.enableSorting, 
        self.sortingAlgorithm = colDef.sortingAlgorithm, self.sortDirectionCycle = void 0 !== colDef.sortDirectionCycle ? colDef.sortDirectionCycle : [ null, uiGridConstants.ASC, uiGridConstants.DESC ], 
        void 0 === self.suppressRemoveSort && (self.suppressRemoveSort = void 0 !== colDef.suppressRemoveSort && colDef.suppressRemoveSort), 
        self.enableFiltering = void 0 === colDef.enableFiltering || colDef.enableFiltering, 
        self.setPropertyOrDefault(colDef, "menuItems", []), isNew && self.setPropertyOrDefault(colDef, "sort"), 
        self.setPropertyOrDefault(colDef, "defaultSort");
        var defaultFilters = [];
        colDef.filter ? defaultFilters.push(colDef.filter) : colDef.filters ? defaultFilters = colDef.filters : defaultFilters.push({}), 
        isNew ? (self.setPropertyOrDefault(colDef, "filter"), self.setPropertyOrDefault(colDef, "extraStyle"), 
        self.setPropertyOrDefault(colDef, "filters", defaultFilters)) : self.filters.length === defaultFilters.length && self.filters.forEach(function(filter, index) {
            void 0 !== defaultFilters[index].placeholder && (filter.placeholder = defaultFilters[index].placeholder), 
            void 0 !== defaultFilters[index].ariaLabel && (filter.ariaLabel = defaultFilters[index].ariaLabel), 
            void 0 !== defaultFilters[index].flags && (filter.flags = defaultFilters[index].flags), 
            void 0 !== defaultFilters[index].type && (filter.type = defaultFilters[index].type), 
            void 0 !== defaultFilters[index].selectOptions && (filter.selectOptions = defaultFilters[index].selectOptions);
        });
    }, GridColumn.prototype.unsort = function() {
        var thisPriority = this.sort.priority;
        this.grid.columns.forEach(function(col) {
            col.sort && void 0 !== col.sort.priority && col.sort.priority > thisPriority && (col.sort.priority -= 1);
        }), this.sort = {}, this.grid.api.core.raise.sortChanged(this.grid, this.grid.getColumnSorting());
    }, GridColumn.prototype.getColClass = function(prefixDot) {
        var cls = uiGridConstants.COL_CLASS_PREFIX + this.uid;
        return prefixDot ? "." + cls : cls;
    }, GridColumn.prototype.isPinnedLeft = function() {
        return "left" === this.renderContainer;
    }, GridColumn.prototype.isPinnedRight = function() {
        return "right" === this.renderContainer;
    }, GridColumn.prototype.getColClassDefinition = function() {
        return " .grid" + this.grid.id + " " + this.getColClass(!0) + " { min-width: " + this.drawnWidth + "px; max-width: " + this.drawnWidth + "px; }";
    }, GridColumn.prototype.getRenderContainer = function() {
        var containerId = this.renderContainer;
        return null !== containerId && "" !== containerId && void 0 !== containerId || (containerId = "body"), 
        this.grid.renderContainers[containerId];
    }, GridColumn.prototype.showColumn = function() {
        this.colDef.visible = !0;
    }, GridColumn.prototype.getAggregationText = function() {
        if (this.colDef.aggregationHideLabel) return "";
        if (this.colDef.aggregationLabel) return this.colDef.aggregationLabel;
        switch (this.colDef.aggregationType) {
          case uiGridConstants.aggregationTypes.count:
            return i18nService.getSafeText("aggregation.count");

          case uiGridConstants.aggregationTypes.sum:
            return i18nService.getSafeText("aggregation.sum");

          case uiGridConstants.aggregationTypes.avg:
            return i18nService.getSafeText("aggregation.avg");

          case uiGridConstants.aggregationTypes.min:
            return i18nService.getSafeText("aggregation.min");

          case uiGridConstants.aggregationTypes.max:
            return i18nService.getSafeText("aggregation.max");

          default:
            return "";
        }
    }, GridColumn.prototype.getCellTemplate = function() {
        return this.cellTemplatePromise;
    }, GridColumn.prototype.getCompiledElementFn = function() {
        return this.compiledElementFnDefer.promise;
    }, GridColumn;
} ]), angular.module("ui.grid").factory("GridOptions", [ "gridUtil", "uiGridConstants", function(gridUtil, uiGridConstants) {
    return {
        initialize: function(baseOptions) {
            return baseOptions.onRegisterApi = baseOptions.onRegisterApi || angular.noop(), 
            baseOptions.data = baseOptions.data || [], baseOptions.columnDefs = baseOptions.columnDefs || [], 
            baseOptions.excludeProperties = baseOptions.excludeProperties || [ "$$hashKey" ], 
            baseOptions.enableRowHashing = !1 !== baseOptions.enableRowHashing, baseOptions.rowIdentity = baseOptions.rowIdentity || function(row) {
                return gridUtil.hashKey(row);
            }, baseOptions.getRowIdentity = baseOptions.getRowIdentity || function(row) {
                return row.$$hashKey;
            }, baseOptions.flatEntityAccess = !0 === baseOptions.flatEntityAccess, baseOptions.showHeader = void 0 === baseOptions.showHeader || baseOptions.showHeader, 
            baseOptions.showHeader ? baseOptions.headerRowHeight = void 0 !== baseOptions.headerRowHeight ? baseOptions.headerRowHeight : 30 : baseOptions.headerRowHeight = 0, 
            "string" == typeof baseOptions.rowHeight ? baseOptions.rowHeight = parseInt(baseOptions.rowHeight) || 30 : baseOptions.rowHeight = baseOptions.rowHeight || 30, 
            baseOptions.minRowsToShow = void 0 !== baseOptions.minRowsToShow ? baseOptions.minRowsToShow : 10, 
            baseOptions.showGridFooter = !0 === baseOptions.showGridFooter, baseOptions.showColumnFooter = !0 === baseOptions.showColumnFooter, 
            baseOptions.columnFooterHeight = void 0 !== baseOptions.columnFooterHeight ? baseOptions.columnFooterHeight : 30, 
            baseOptions.gridFooterHeight = void 0 !== baseOptions.gridFooterHeight ? baseOptions.gridFooterHeight : 30, 
            baseOptions.columnWidth = void 0 !== baseOptions.columnWidth ? baseOptions.columnWidth : 50, 
            baseOptions.maxVisibleColumnCount = void 0 !== baseOptions.maxVisibleColumnCount ? baseOptions.maxVisibleColumnCount : 200, 
            baseOptions.virtualizationThreshold = void 0 !== baseOptions.virtualizationThreshold ? baseOptions.virtualizationThreshold : 20, 
            baseOptions.columnVirtualizationThreshold = void 0 !== baseOptions.columnVirtualizationThreshold ? baseOptions.columnVirtualizationThreshold : 10, 
            baseOptions.excessRows = void 0 !== baseOptions.excessRows ? baseOptions.excessRows : 4, 
            baseOptions.scrollThreshold = void 0 !== baseOptions.scrollThreshold ? baseOptions.scrollThreshold : 4, 
            baseOptions.excessColumns = void 0 !== baseOptions.excessColumns ? baseOptions.excessColumns : 4, 
            baseOptions.horizontalScrollThreshold = void 0 !== baseOptions.horizontalScrollThreshold ? baseOptions.horizontalScrollThreshold : 2, 
            baseOptions.aggregationCalcThrottle = void 0 !== baseOptions.aggregationCalcThrottle ? baseOptions.aggregationCalcThrottle : 500, 
            baseOptions.wheelScrollThrottle = void 0 !== baseOptions.wheelScrollThrottle ? baseOptions.wheelScrollThrottle : 70, 
            baseOptions.scrollDebounce = void 0 !== baseOptions.scrollDebounce ? baseOptions.scrollDebounce : 300, 
            baseOptions.enableSorting = !1 !== baseOptions.enableSorting, baseOptions.enableFiltering = !0 === baseOptions.enableFiltering, 
            baseOptions.enableColumnMenus = !1 !== baseOptions.enableColumnMenus, baseOptions.enableVerticalScrollbar = void 0 !== baseOptions.enableVerticalScrollbar ? baseOptions.enableVerticalScrollbar : uiGridConstants.scrollbars.ALWAYS, 
            baseOptions.enableHorizontalScrollbar = void 0 !== baseOptions.enableHorizontalScrollbar ? baseOptions.enableHorizontalScrollbar : uiGridConstants.scrollbars.ALWAYS, 
            baseOptions.enableMinHeightCheck = !1 !== baseOptions.enableMinHeightCheck, baseOptions.minimumColumnSize = void 0 !== baseOptions.minimumColumnSize ? baseOptions.minimumColumnSize : 30, 
            baseOptions.rowEquality = baseOptions.rowEquality || function(entityA, entityB) {
                return entityA === entityB;
            }, baseOptions.headerTemplate = baseOptions.headerTemplate || null, baseOptions.footerTemplate = baseOptions.footerTemplate || "ui-grid/ui-grid-footer", 
            baseOptions.gridFooterTemplate = baseOptions.gridFooterTemplate || "ui-grid/ui-grid-grid-footer", 
            baseOptions.rowTemplate = baseOptions.rowTemplate || "ui-grid/ui-grid-row", baseOptions.gridMenuTemplate = baseOptions.gridMenuTemplate || "ui-grid/uiGridMenu", 
            baseOptions.appScopeProvider = baseOptions.appScopeProvider || null, baseOptions;
        }
    };
} ]), angular.module("ui.grid").factory("GridRenderContainer", [ "gridUtil", "uiGridConstants", function(gridUtil, uiGridConstants) {
    function GridRenderContainer(name, grid, options) {
        var self = this;
        self.name = name, self.grid = grid, self.visibleRowCache = [], self.visibleColumnCache = [], 
        self.renderedRows = [], self.renderedColumns = [], self.prevScrollTop = 0, self.prevScrolltopPercentage = 0, 
        self.prevRowScrollIndex = 0, self.prevScrollLeft = 0, self.prevScrollleftPercentage = 0, 
        self.prevColumnScrollIndex = 0, self.columnStyles = "", self.viewportAdjusters = [], 
        self.hasHScrollbar = !1, self.hasVScrollbar = !1, self.canvasHeightShouldUpdate = !0, 
        self.$$canvasHeight = 0, options && angular.isObject(options) && angular.extend(self, options), 
        grid.registerStyleComputation({
            priority: 5,
            func: function() {
                return self.updateColumnWidths(), self.columnStyles;
            }
        });
    }
    return GridRenderContainer.prototype.reset = function() {
        this.visibleColumnCache.length = 0, this.visibleRowCache.length = 0, this.renderedRows.length = 0, 
        this.renderedColumns.length = 0;
    }, GridRenderContainer.prototype.containsColumn = function(col) {
        return -1 !== this.visibleColumnCache.indexOf(col);
    }, GridRenderContainer.prototype.minRowsToRender = function() {
        for (var minRows = 0, rowAddedHeight = 0, viewPortHeight = this.getViewportHeight(), i = this.visibleRowCache.length - 1; rowAddedHeight < viewPortHeight && 0 <= i; i--) rowAddedHeight += this.visibleRowCache[i].height, 
        minRows++;
        return minRows;
    }, GridRenderContainer.prototype.minColumnsToRender = function() {
        for (var viewportWidth = this.getViewportWidth(), min = 0, totalWidth = 0, i = 0; i < this.visibleColumnCache.length; i++) {
            var col = this.visibleColumnCache[i];
            if (totalWidth < viewportWidth) totalWidth += col.drawnWidth ? col.drawnWidth : 0, 
            min++; else {
                for (var currWidth = 0, j = i; i - min <= j; j--) currWidth += this.visibleColumnCache[j].drawnWidth ? this.visibleColumnCache[j].drawnWidth : 0;
                currWidth < viewportWidth && min++;
            }
        }
        return min;
    }, GridRenderContainer.prototype.getVisibleRowCount = function() {
        return this.visibleRowCache.length;
    }, GridRenderContainer.prototype.registerViewportAdjuster = function(func) {
        this.viewportAdjusters.push(func);
    }, GridRenderContainer.prototype.removeViewportAdjuster = function(func) {
        var idx = this.viewportAdjusters.indexOf(func);
        -1 < idx && this.viewportAdjusters.splice(idx, 1);
    }, GridRenderContainer.prototype.getViewportAdjustment = function() {
        var adjustment = {
            height: 0,
            width: 0
        };
        return this.viewportAdjusters.forEach(function(func) {
            adjustment = func.call(this, adjustment);
        }), adjustment;
    }, GridRenderContainer.prototype.getMargin = function(side) {
        var amount = 0;
        return this.viewportAdjusters.forEach(function(func) {
            var adjustment = func.call(this, {
                height: 0,
                width: 0
            });
            adjustment.side && adjustment.side === side && (amount += -1 * adjustment.width);
        }), amount;
    }, GridRenderContainer.prototype.getViewportHeight = function() {
        var headerHeight = this.headerHeight ? this.headerHeight : this.grid.headerHeight, viewPortHeight = this.grid.gridHeight - headerHeight - this.grid.footerHeight;
        return viewPortHeight += this.getViewportAdjustment().height;
    }, GridRenderContainer.prototype.getViewportWidth = function() {
        var viewportWidth = this.grid.gridWidth;
        return viewportWidth += this.getViewportAdjustment().width;
    }, GridRenderContainer.prototype.getHeaderViewportWidth = function() {
        return this.getViewportWidth();
    }, GridRenderContainer.prototype.getCanvasHeight = function() {
        var self = this;
        if (!self.canvasHeightShouldUpdate) return self.$$canvasHeight;
        var oldCanvasHeight = self.$$canvasHeight;
        return self.$$canvasHeight = 0, self.visibleRowCache.forEach(function(row) {
            self.$$canvasHeight += row.height;
        }), self.canvasHeightShouldUpdate = !1, self.grid.api.core.raise.canvasHeightChanged(oldCanvasHeight, self.$$canvasHeight), 
        self.$$canvasHeight;
    }, GridRenderContainer.prototype.getVerticalScrollLength = function() {
        return this.getCanvasHeight() - this.getViewportHeight() + this.grid.scrollbarHeight !== 0 ? this.getCanvasHeight() - this.getViewportHeight() + this.grid.scrollbarHeight : -1;
    }, GridRenderContainer.prototype.getHorizontalScrollLength = function() {
        return this.getCanvasWidth() - this.getViewportWidth() + this.grid.scrollbarWidth !== 0 ? this.getCanvasWidth() - this.getViewportWidth() + this.grid.scrollbarWidth : -1;
    }, GridRenderContainer.prototype.getCanvasWidth = function() {
        return this.canvasWidth;
    }, GridRenderContainer.prototype.setRenderedRows = function(newRows) {
        this.renderedRows.length = newRows.length;
        for (var i = 0; i < newRows.length; i++) this.renderedRows[i] = newRows[i];
    }, GridRenderContainer.prototype.setRenderedColumns = function(newColumns) {
        this.renderedColumns.length = newColumns.length;
        for (var i = 0; i < newColumns.length; i++) this.renderedColumns[i] = newColumns[i];
        this.updateColumnOffset();
    }, GridRenderContainer.prototype.updateColumnOffset = function() {
        for (var hiddenColumnsWidth = 0, i = 0; i < this.currentFirstColumn; i++) hiddenColumnsWidth += this.visibleColumnCache[i].drawnWidth;
        this.columnOffset = hiddenColumnsWidth;
    }, GridRenderContainer.prototype.scrollVertical = function(newScrollTop) {
        var vertScrollPercentage = -1;
        if (newScrollTop !== this.prevScrollTop) {
            var yDiff = newScrollTop - this.prevScrollTop;
            return 0 < yDiff && (this.grid.scrollDirection = uiGridConstants.scrollDirection.DOWN), 
            yDiff < 0 && (this.grid.scrollDirection = uiGridConstants.scrollDirection.UP), 1 < (vertScrollPercentage = newScrollTop / this.getVerticalScrollLength()) && (vertScrollPercentage = 1), 
            vertScrollPercentage < 0 && (vertScrollPercentage = 0), this.adjustScrollVertical(newScrollTop, vertScrollPercentage), 
            vertScrollPercentage;
        }
    }, GridRenderContainer.prototype.scrollHorizontal = function(newScrollLeft) {
        var horizScrollPercentage = -1;
        if (newScrollLeft !== this.prevScrollLeft) {
            var xDiff = newScrollLeft - this.prevScrollLeft;
            0 < xDiff && (this.grid.scrollDirection = uiGridConstants.scrollDirection.RIGHT), 
            xDiff < 0 && (this.grid.scrollDirection = uiGridConstants.scrollDirection.LEFT);
            var horizScrollLength = this.getHorizontalScrollLength();
            return horizScrollPercentage = 0 !== horizScrollLength ? newScrollLeft / horizScrollLength : 0, 
            this.adjustScrollHorizontal(newScrollLeft, horizScrollPercentage), horizScrollPercentage;
        }
    }, GridRenderContainer.prototype.adjustScrollVertical = function(scrollTop, scrollPercentage, force) {
        (this.prevScrollTop !== scrollTop || force) && (void 0 !== scrollTop && null != scrollTop || (scrollTop = (this.getCanvasHeight() - this.getViewportHeight()) * scrollPercentage), 
        this.adjustRows(scrollTop, scrollPercentage, !1), this.prevScrollTop = scrollTop, 
        this.prevScrolltopPercentage = scrollPercentage, this.grid.queueRefresh());
    }, GridRenderContainer.prototype.adjustScrollHorizontal = function(scrollLeft, scrollPercentage, force) {
        (this.prevScrollLeft !== scrollLeft || force) && (void 0 !== scrollLeft && null != scrollLeft || (scrollLeft = (this.getCanvasWidth() - this.getViewportWidth()) * scrollPercentage), 
        this.adjustColumns(scrollLeft, scrollPercentage), this.prevScrollLeft = scrollLeft, 
        this.prevScrollleftPercentage = scrollPercentage, this.grid.queueRefresh());
    }, GridRenderContainer.prototype.adjustRows = function(scrollTop, scrollPercentage, postDataLoaded) {
        var minRows = this.minRowsToRender(), rowCache = this.visibleRowCache, maxRowIndex = rowCache.length - minRows;
        null == scrollPercentage && scrollTop && (scrollPercentage = scrollTop / this.getVerticalScrollLength());
        var rowIndex = Math.ceil(Math.min(maxRowIndex, maxRowIndex * scrollPercentage));
        maxRowIndex < rowIndex && (rowIndex = maxRowIndex);
        var newRange = [];
        if (rowCache.length > this.grid.options.virtualizationThreshold) {
            if (null != scrollTop) {
                if (!this.grid.suppressParentScrollDown && this.prevScrollTop < scrollTop && rowIndex < this.prevRowScrollIndex + this.grid.options.scrollThreshold && rowIndex < maxRowIndex) return;
                if (!this.grid.suppressParentScrollUp && this.prevScrollTop > scrollTop && rowIndex > this.prevRowScrollIndex - this.grid.options.scrollThreshold && rowIndex < maxRowIndex) return;
            }
            newRange = [ Math.max(0, rowIndex - this.grid.options.excessRows), Math.min(rowCache.length, rowIndex + minRows + this.grid.options.excessRows) ];
        } else {
            var maxLen = this.visibleRowCache.length;
            newRange = [ 0, Math.max(maxLen, minRows + this.grid.options.excessRows) ];
        }
        this.updateViewableRowRange(newRange), this.prevRowScrollIndex = rowIndex;
    }, GridRenderContainer.prototype.adjustColumns = function(scrollLeft, scrollPercentage) {
        var minCols = this.minColumnsToRender(), columnCache = this.visibleColumnCache, maxColumnIndex = columnCache.length - minCols;
        null == scrollPercentage && scrollLeft && (scrollPercentage = scrollLeft / this.getHorizontalScrollLength());
        var colIndex = Math.ceil(Math.min(maxColumnIndex, maxColumnIndex * scrollPercentage));
        maxColumnIndex < colIndex && (colIndex = maxColumnIndex);
        var newRange = [];
        if (columnCache.length > this.grid.options.columnVirtualizationThreshold && this.getCanvasWidth() > this.getViewportWidth()) newRange = [ Math.max(0, colIndex - this.grid.options.excessColumns), Math.min(columnCache.length, colIndex + minCols + this.grid.options.excessColumns) ]; else {
            var maxLen = this.visibleColumnCache.length;
            newRange = [ 0, Math.max(maxLen, minCols + this.grid.options.excessColumns) ];
        }
        this.updateViewableColumnRange(newRange), this.prevColumnScrollIndex = colIndex;
    }, GridRenderContainer.prototype.updateViewableRowRange = function(renderedRange) {
        var rowArr = this.visibleRowCache.slice(renderedRange[0], renderedRange[1]);
        this.currentTopRow = renderedRange[0], this.setRenderedRows(rowArr);
    }, GridRenderContainer.prototype.updateViewableColumnRange = function(renderedRange) {
        var columnArr = this.visibleColumnCache.slice(renderedRange[0], renderedRange[1]);
        this.currentFirstColumn = renderedRange[0], this.setRenderedColumns(columnArr);
    }, GridRenderContainer.prototype.headerCellWrapperStyle = function() {
        if (0 !== this.currentFirstColumn) {
            var offset = this.columnOffset;
            return this.grid.isRTL() ? {
                "margin-right": offset + "px"
            } : {
                "margin-left": offset + "px"
            };
        }
        return null;
    }, GridRenderContainer.prototype.updateColumnWidths = function() {
        var self = this, asterisksArray = [], asteriskNum = 0, usedWidthSum = 0, ret = "", pinRightColumn = !1, fixedNumberArray = [], percentageArray = [], totalPercentage = 0, availableWidth = self.grid.getViewportWidth() - self.grid.scrollbarWidth, columnCache = [];
        angular.forEach(self.grid.renderContainers, function(container) {
            columnCache = columnCache.concat(container.visibleColumnCache);
        }), columnCache.forEach(function(column) {
            var width = 0;
            if (column.visible) if (pinRightColumn && (availableWidth += self.grid.scrollbarWidth), 
            !pinRightColumn && column.colDef.pinnedRight && (pinRightColumn = !0), angular.isNumber(column.width)) width = parseInt(column.width, 10), 
            usedWidthSum += width, column.drawnWidth = width, fixedNumberArray.push(column); else if (gridUtil.endsWith(column.width, "%")) {
                var percentageIntegerValue = parseInt(column.width.replace(/%/g, ""), 10);
                (width = parseInt(percentageIntegerValue / 100 * availableWidth)) > column.maxWidth && (width = column.maxWidth), 
                width < column.minWidth && (width = column.minWidth), usedWidthSum += width, column.drawnWidth = width, 
                totalPercentage += percentageIntegerValue, percentageArray.push(column);
            } else angular.isString(column.width) && -1 !== column.width.indexOf("*") && (asteriskNum += column.width.length, 
            asterisksArray.push(column));
        });
        var variableWidthColumnArray, remainingWidth = availableWidth - usedWidthSum;
        if (0 < asterisksArray.length) {
            var asteriskVal = remainingWidth / asteriskNum;
            asterisksArray.forEach(function(column) {
                var width = parseInt(column.width.length * asteriskVal, 10);
                width > column.maxWidth && (width = column.maxWidth), width < column.minWidth && (width = column.minWidth), 
                usedWidthSum += width, column.drawnWidth = width;
            });
        }
        if (0 < asterisksArray.length ? variableWidthColumnArray = asterisksArray : 0 < percentageArray.length && 0 === fixedNumberArray.length && 100 === totalPercentage && (variableWidthColumnArray = percentageArray), 
        !angular.isUndefined(variableWidthColumnArray)) {
            for (var processColumnUpwards = function(column) {
                column.drawnWidth < column.maxWidth && 0 < leftoverWidth && (column.drawnWidth++, 
                usedWidthSum++, leftoverWidth--, columnsToChange = !0);
            }, leftoverWidth = availableWidth - usedWidthSum, columnsToChange = !0; 0 < leftoverWidth && columnsToChange; ) columnsToChange = !1, 
            variableWidthColumnArray.forEach(processColumnUpwards);
            var processColumnDownwards = function(column) {
                column.drawnWidth > column.minWidth && 0 < excessWidth && (column.drawnWidth--, 
                usedWidthSum--, excessWidth--, columnsToChange = !0);
            }, excessWidth = usedWidthSum - availableWidth;
            for (columnsToChange = !0; 0 < excessWidth && columnsToChange; ) columnsToChange = !1, 
            variableWidthColumnArray.forEach(processColumnDownwards);
        }
        var canvasWidth = 0;
        self.visibleColumnCache.forEach(function(column) {
            column.visible && (canvasWidth += column.drawnWidth);
        }), columnCache.forEach(function(column) {
            ret += column.getColClassDefinition();
        }), self.canvasWidth = canvasWidth, this.columnStyles = ret;
    }, GridRenderContainer.prototype.needsHScrollbarPlaceholder = function() {
        var containerBody;
        return ("left" === this.name || "right" === this.name && !this.hasHScrollbar && !this.grid.disableScrolling) && (this.grid.options.enableHorizontalScrollbar === uiGridConstants.scrollbars.ALWAYS || (containerBody = this.grid.element[0].querySelector(".ui-grid-render-container-body .ui-grid-viewport")).scrollWidth > containerBody.offsetWidth);
    }, GridRenderContainer.prototype.getViewportStyle = function() {
        var styles = {}, scrollbarVisibility = {};
        return scrollbarVisibility[uiGridConstants.scrollbars.ALWAYS] = "scroll", scrollbarVisibility[uiGridConstants.scrollbars.WHEN_NEEDED] = "auto", 
        this.hasHScrollbar = !1, this.hasVScrollbar = !1, this.grid.disableScrolling ? (styles["overflow-x"] = "hidden", 
        styles["overflow-y"] = "hidden") : ("body" === this.name ? (this.hasHScrollbar = this.grid.options.enableHorizontalScrollbar !== uiGridConstants.scrollbars.NEVER, 
        this.grid.isRTL() ? this.grid.hasLeftContainerColumns() || (this.hasVScrollbar = this.grid.options.enableVerticalScrollbar !== uiGridConstants.scrollbars.NEVER) : this.grid.hasRightContainerColumns() || (this.hasVScrollbar = this.grid.options.enableVerticalScrollbar !== uiGridConstants.scrollbars.NEVER)) : "left" === this.name ? this.hasVScrollbar = !!this.grid.isRTL() && this.grid.options.enableVerticalScrollbar !== uiGridConstants.scrollbars.NEVER : this.hasVScrollbar = !this.grid.isRTL() && this.grid.options.enableVerticalScrollbar !== uiGridConstants.scrollbars.NEVER, 
        styles["overflow-x"] = this.hasHScrollbar ? scrollbarVisibility[this.grid.options.enableHorizontalScrollbar] : "hidden", 
        styles["overflow-y"] = this.hasVScrollbar ? scrollbarVisibility[this.grid.options.enableVerticalScrollbar] : "hidden"), 
        styles;
    }, GridRenderContainer;
} ]), angular.module("ui.grid").factory("GridRow", [ "gridUtil", "uiGridConstants", function(gridUtil, uiGridConstants) {
    function GridRow(entity, index, grid) {
        this.grid = grid, this.entity = entity, this.uid = gridUtil.nextUid(), this.visible = !0, 
        this.isSelected = !1, this.$$height = grid.options.rowHeight;
    }
    return Object.defineProperty(GridRow.prototype, "height", {
        get: function() {
            return this.$$height;
        },
        set: function(height) {
            height !== this.$$height && (this.grid.updateCanvasHeight(), this.$$height = height);
        }
    }), GridRow.prototype.getQualifiedColField = function(col) {
        return "row." + this.getEntityQualifiedColField(col);
    }, GridRow.prototype.getEntityQualifiedColField = function(col) {
        return col.field === uiGridConstants.ENTITY_BINDING ? "entity" : gridUtil.preEval("entity." + col.field);
    }, GridRow.prototype.setRowInvisible = function(row) {
        row && row.setThisRowInvisible && row.setThisRowInvisible("user");
    }, GridRow.prototype.clearRowInvisible = function(row) {
        row && row.clearThisRowInvisible && row.clearThisRowInvisible("user");
    }, GridRow.prototype.setThisRowInvisible = function(reason, fromRowsProcessor) {
        this.invisibleReason || (this.invisibleReason = {}), this.invisibleReason[reason] = !0, 
        this.evaluateRowVisibility(fromRowsProcessor);
    }, GridRow.prototype.clearThisRowInvisible = function(reason, fromRowsProcessor) {
        void 0 !== this.invisibleReason && delete this.invisibleReason[reason], this.evaluateRowVisibility(fromRowsProcessor);
    }, GridRow.prototype.evaluateRowVisibility = function(fromRowProcessor) {
        var newVisibility = !0;
        void 0 !== this.invisibleReason && angular.forEach(this.invisibleReason, function(value, key) {
            value && (newVisibility = !1);
        }), void 0 !== this.visible && this.visible === newVisibility || (this.visible = newVisibility, 
        fromRowProcessor || (this.grid.queueGridRefresh(), this.grid.api.core.raise.rowsVisibleChanged(this)));
    }, GridRow;
} ]), function() {
    "use strict";
    angular.module("ui.grid").factory("GridRowColumn", [ "$parse", "$filter", function($parse, $filter) {
        var GridRowColumn = function GridRowColumn(row, col) {
            if (!(this instanceof GridRowColumn)) throw "Using GridRowColumn as a function insead of as a constructor. Must be called with `new` keyword";
            this.row = row, this.col = col;
        };
        return GridRowColumn.prototype.getIntersectionValueRaw = function() {
            return $parse(this.row.getEntityQualifiedColField(this.col))(this.row);
        }, GridRowColumn;
    } ]);
}(), angular.module("ui.grid").factory("ScrollEvent", [ "gridUtil", function(gridUtil) {
    function ScrollEvent(grid, sourceRowContainer, sourceColContainer, source) {
        var self = this;
        if (!grid) throw new Error("grid argument is required");
        self.grid = grid, self.source = source, self.withDelay = !0, self.sourceRowContainer = sourceRowContainer, 
        self.sourceColContainer = sourceColContainer, self.newScrollLeft = null, self.newScrollTop = null, 
        self.x = null, self.y = null, self.verticalScrollLength = -9999999, self.horizontalScrollLength = -999999, 
        self.fireThrottledScrollingEvent = gridUtil.throttle(function(sourceContainerId) {
            self.grid.scrollContainers(sourceContainerId, self);
        }, self.grid.options.wheelScrollThrottle, {
            trailing: !0
        });
    }
    return ScrollEvent.prototype.getNewScrollLeft = function(colContainer, viewport) {
        if (!this.newScrollLeft) {
            var scrollXPercentage, scrollWidth = colContainer.getCanvasWidth() - colContainer.getViewportWidth(), oldScrollLeft = gridUtil.normalizeScrollLeft(viewport, this.grid);
            if (void 0 !== this.x.percentage && void 0 !== this.x.percentage) scrollXPercentage = this.x.percentage; else {
                if (void 0 === this.x.pixels || void 0 === this.x.pixels) throw new Error("No percentage or pixel value provided for scroll event X axis");
                scrollXPercentage = this.x.percentage = (oldScrollLeft + this.x.pixels) / scrollWidth;
            }
            return Math.max(0, scrollXPercentage * scrollWidth);
        }
        return this.newScrollLeft;
    }, ScrollEvent.prototype.getNewScrollTop = function(rowContainer, viewport) {
        if (!this.newScrollTop) {
            var scrollYPercentage, scrollLength = rowContainer.getVerticalScrollLength(), oldScrollTop = viewport[0].scrollTop;
            if (void 0 !== this.y.percentage && void 0 !== this.y.percentage) scrollYPercentage = this.y.percentage; else {
                if (void 0 === this.y.pixels || void 0 === this.y.pixels) throw new Error("No percentage or pixel value provided for scroll event Y axis");
                scrollYPercentage = this.y.percentage = (oldScrollTop + this.y.pixels) / scrollLength;
            }
            return Math.max(0, scrollYPercentage * scrollLength);
        }
        return this.newScrollTop;
    }, ScrollEvent.prototype.atTop = function(scrollTop) {
        return this.y && (0 === this.y.percentage || this.verticalScrollLength < 0) && 0 === scrollTop;
    }, ScrollEvent.prototype.atBottom = function(scrollTop) {
        return this.y && (1 === this.y.percentage || 0 === this.verticalScrollLength) && 0 < scrollTop;
    }, ScrollEvent.prototype.atLeft = function(scrollLeft) {
        return this.x && (0 === this.x.percentage || this.horizontalScrollLength < 0) && 0 === scrollLeft;
    }, ScrollEvent.prototype.atRight = function(scrollLeft) {
        return this.x && (1 === this.x.percentage || 0 === this.horizontalScrollLength) && 0 < scrollLeft;
    }, ScrollEvent.Sources = {
        ViewPortScroll: "ViewPortScroll",
        RenderContainerMouseWheel: "RenderContainerMouseWheel",
        RenderContainerTouchMove: "RenderContainerTouchMove",
        Other: 99
    }, ScrollEvent;
} ]), function() {
    "use strict";
    angular.module("ui.grid").service("gridClassFactory", [ "gridUtil", "$q", "$compile", "$templateCache", "uiGridConstants", "Grid", "GridColumn", "GridRow", function(gridUtil, $q, $compile, $templateCache, uiGridConstants, Grid, GridColumn, GridRow) {
        var service = {
            createGrid: function(options) {
                (options = void 0 !== options ? options : {}).id = gridUtil.newId();
                var grid = new Grid(options);
                if (grid.options.rowTemplate) {
                    var rowTemplateFnPromise = $q.defer();
                    grid.getRowTemplateFn = rowTemplateFnPromise.promise, gridUtil.getTemplate(grid.options.rowTemplate).then(function(template) {
                        var rowTemplateFn = $compile(template);
                        rowTemplateFnPromise.resolve(rowTemplateFn);
                    }, function(res) {
                        throw new Error("Couldn't fetch/use row template '" + grid.options.rowTemplate + "'");
                    }).catch(angular.noop);
                }
                return grid.registerColumnBuilder(service.defaultColumnBuilder), grid.registerRowBuilder(service.rowTemplateAssigner), 
                grid.registerRowsProcessor(function(rows) {
                    return rows.forEach(function(row) {
                        row.evaluateRowVisibility(!0);
                    }), rows;
                }, 50), grid.registerColumnsProcessor(function(columns) {
                    return columns.forEach(function(column) {
                        column.visible = !angular.isDefined(column.colDef.visible) || column.colDef.visible;
                    }), columns;
                }, 50), grid.registerRowsProcessor(grid.searchRows, 100), grid.options.externalSort && angular.isFunction(grid.options.externalSort) ? grid.registerRowsProcessor(grid.options.externalSort, 200) : grid.registerRowsProcessor(grid.sortByColumn, 200), 
                grid;
            },
            defaultColumnBuilder: function(colDef, col, gridOptions) {
                var templateGetPromises = [], processTemplate = function(templateType, providedType, defaultTemplate, filterType, tooltipType) {
                    colDef[templateType] ? col[providedType] = colDef[templateType] : col[providedType] = defaultTemplate;
                    var templatePromise = gridUtil.getTemplate(col[providedType]).then(function(template) {
                        angular.isFunction(template) && (template = template());
                        var tooltipCall = "cellTooltip" === tooltipType ? "col.cellTooltip(row,col)" : "col.headerTooltip(col)";
                        tooltipType && !1 === col[tooltipType] ? template = template.replace(uiGridConstants.TOOLTIP, "") : tooltipType && col[tooltipType] && (template = template.replace(uiGridConstants.TOOLTIP, 'title="{{' + tooltipCall + ' CUSTOM_FILTERS }}"')), 
                        col[templateType] = filterType ? template.replace(uiGridConstants.CUSTOM_FILTERS, function() {
                            return col[filterType] ? "|" + col[filterType] : "";
                        }) : template;
                    }, function(res) {
                        throw new Error("Couldn't fetch/use colDef." + templateType + " '" + colDef[templateType] + "'");
                    }).catch(angular.noop);
                    return templateGetPromises.push(templatePromise), templatePromise;
                };
                return col.cellTemplatePromise = processTemplate("cellTemplate", "providedCellTemplate", "ui-grid/uiGridCell", "cellFilter", "cellTooltip"), 
                col.headerCellTemplatePromise = processTemplate("headerCellTemplate", "providedHeaderCellTemplate", "ui-grid/uiGridHeaderCell", "headerCellFilter", "headerTooltip"), 
                col.footerCellTemplatePromise = processTemplate("footerCellTemplate", "providedFooterCellTemplate", "ui-grid/uiGridFooterCell", "footerCellFilter"), 
                col.filterHeaderTemplatePromise = processTemplate("filterHeaderTemplate", "providedFilterHeaderTemplate", "ui-grid/ui-grid-filter"), 
                col.compiledElementFnDefer = $q.defer(), $q.all(templateGetPromises);
            },
            rowTemplateAssigner: function(row) {
                if (row.rowTemplate) {
                    var perRowTemplateFnPromise = $q.defer();
                    row.getRowTemplateFn = perRowTemplateFnPromise.promise, gridUtil.getTemplate(row.rowTemplate).then(function(template) {
                        var rowTemplateFn = $compile(template);
                        perRowTemplateFnPromise.resolve(rowTemplateFn);
                    }, function(res) {
                        throw new Error("Couldn't fetch/use row template '" + row.rowTemplate + "'");
                    });
                } else row.rowTemplate = this.options.rowTemplate, row.getRowTemplateFn = this.getRowTemplateFn;
                return row.getRowTemplateFn;
            }
        };
        return service;
    } ]);
}(), angular.module("ui.grid").service("rowSearcher", [ "gridUtil", "uiGridConstants", function(gridUtil, uiGridConstants) {
    var defaultCondition = uiGridConstants.filter.CONTAINS, rowSearcher = {
        getTerm: function(filter) {
            if (void 0 === filter.term) return filter.term;
            var term = filter.term;
            return "string" == typeof term && (term = term.trim()), term;
        },
        stripTerm: function(filter) {
            var term = rowSearcher.getTerm(filter);
            return "string" == typeof term ? term.replace(/(^\*|\*$)/g, "").replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&") : term;
        },
        guessCondition: function(filter) {
            if (void 0 === filter.term || !filter.term) return defaultCondition;
            var term = rowSearcher.getTerm(filter);
            if (/\*/.test(term)) {
                var regexpFlags = "";
                filter.flags && filter.flags.caseSensitive || (regexpFlags += "i");
                var reText = term.replace(/(\\)?\*/g, function($0, $1) {
                    return $1 ? $0 : "[\\s\\S]*?";
                });
                return new RegExp("^" + reText + "$", regexpFlags);
            }
            return defaultCondition;
        },
        setupFilters: function(filters) {
            for (var newFilters = [], filtersLength = filters.length, i = 0; i < filtersLength; i++) {
                var filter = filters[i];
                if (filter.noTerm || !gridUtil.isNullOrUndefined(filter.term)) {
                    var newFilter = {}, regexpFlags = "";
                    filter.flags && filter.flags.caseSensitive || (regexpFlags += "i"), gridUtil.isNullOrUndefined(filter.term) || (filter.rawTerm ? newFilter.term = filter.term : newFilter.term = rowSearcher.stripTerm(filter)), 
                    newFilter.noTerm = filter.noTerm, filter.condition ? newFilter.condition = filter.condition : newFilter.condition = rowSearcher.guessCondition(filter), 
                    newFilter.flags = angular.extend({
                        caseSensitive: !1,
                        date: !1
                    }, filter.flags), newFilter.condition === uiGridConstants.filter.STARTS_WITH && (newFilter.startswithRE = new RegExp("^" + newFilter.term, regexpFlags)), 
                    newFilter.condition === uiGridConstants.filter.ENDS_WITH && (newFilter.endswithRE = new RegExp(newFilter.term + "$", regexpFlags)), 
                    newFilter.condition === uiGridConstants.filter.CONTAINS && (newFilter.containsRE = new RegExp(newFilter.term, regexpFlags)), 
                    newFilter.condition === uiGridConstants.filter.EXACT && (newFilter.exactRE = new RegExp("^" + newFilter.term + "$", regexpFlags)), 
                    newFilters.push(newFilter);
                }
            }
            return newFilters;
        },
        runColumnFilter: function(grid, row, column, filter) {
            var value, conditionType = typeof filter.condition, term = filter.term;
            if (value = column.filterCellFiltered ? grid.getCellDisplayValue(row, column) : grid.getCellValue(row, column), 
            filter.condition instanceof RegExp) return filter.condition.test(value);
            if ("function" === conditionType) return filter.condition(term, value, row, column);
            if (filter.startswithRE) return filter.startswithRE.test(value);
            if (filter.endswithRE) return filter.endswithRE.test(value);
            if (filter.containsRE) return filter.containsRE.test(value);
            if (filter.exactRE) return filter.exactRE.test(value);
            if (filter.condition === uiGridConstants.filter.NOT_EQUAL) return !new RegExp("^" + term + "$").exec(value);
            if ("number" == typeof value && "string" == typeof term) {
                var tempFloat = parseFloat(term.replace(/\\\./, ".").replace(/\\\-/, "-"));
                isNaN(tempFloat) || (term = tempFloat);
            }
            return !0 === filter.flags.date && (value = new Date(value), term = new Date(term.replace(/\\/g, ""))), 
            filter.condition === uiGridConstants.filter.GREATER_THAN ? term < value : filter.condition === uiGridConstants.filter.GREATER_THAN_OR_EQUAL ? term <= value : filter.condition === uiGridConstants.filter.LESS_THAN ? value < term : filter.condition !== uiGridConstants.filter.LESS_THAN_OR_EQUAL || value <= term;
        },
        searchColumn: function(grid, row, column, filters) {
            if (grid.options.useExternalFiltering) return !0;
            for (var filtersLength = filters.length, i = 0; i < filtersLength; i++) {
                var filter = filters[i];
                if ((!gridUtil.isNullOrUndefined(filter.term) && "" !== filter.term || filter.noTerm) && !rowSearcher.runColumnFilter(grid, row, column, filter)) return !1;
            }
            return !0;
        },
        search: function(grid, rows, columns) {
            if (rows) {
                if (!grid.options.enableFiltering) return rows;
                for (var filterData = [], colsLength = columns.length, hasTerm = function(filters) {
                    var hasTerm = !1;
                    return filters.forEach(function(filter) {
                        (!gridUtil.isNullOrUndefined(filter.term) && "" !== filter.term || filter.noTerm) && (hasTerm = !0);
                    }), hasTerm;
                }, i = 0; i < colsLength; i++) {
                    var col = columns[i];
                    void 0 !== col.filters && hasTerm(col.filters) && filterData.push({
                        col: col,
                        filters: rowSearcher.setupFilters(col.filters)
                    });
                }
                if (0 < filterData.length) {
                    for (var foreachRow = function(grid, row, col, filters) {
                        row.visible && !rowSearcher.searchColumn(grid, row, col, filters) && (row.visible = !1);
                    }, foreachFilterCol = function(grid, filterData) {
                        for (var rowsLength = rows.length, i = 0; i < rowsLength; i++) foreachRow(grid, rows[i], filterData.col, filterData.filters);
                    }, filterDataLength = filterData.length, j = 0; j < filterDataLength; j++) foreachFilterCol(grid, filterData[j]);
                    grid.api.core.raise.rowsVisibleChanged && grid.api.core.raise.rowsVisibleChanged();
                }
                return rows;
            }
        }
    };
    return rowSearcher;
} ]), angular.module("ui.grid").service("rowSorter", [ "$parse", "uiGridConstants", function($parse, uiGridConstants) {
    var currencyRegexStr = "(" + uiGridConstants.CURRENCY_SYMBOLS.map(function(a) {
        return "\\" + a;
    }).join("|") + ")?", rowSorter = (new RegExp("^[-+]?" + currencyRegexStr + "[\\d,.]+" + currencyRegexStr + "%?$"), 
    {
        colSortFnCache: {},
        guessSortFn: function(itemType) {
            switch (itemType) {
              case "number":
                return rowSorter.sortNumber;

              case "numberStr":
                return rowSorter.sortNumberStr;

              case "boolean":
                return rowSorter.sortBool;

              case "string":
                return rowSorter.sortAlpha;

              case "date":
                return rowSorter.sortDate;

              case "object":
                return rowSorter.basicSort;

              default:
                throw new Error("No sorting function found for type:" + itemType);
            }
        },
        handleNulls: function(a, b) {
            if (!a && 0 !== a && !1 !== a || !b && 0 !== b && !1 !== b) {
                if (!a && 0 !== a && !1 !== a && !b && 0 !== b && !1 !== b) return 0;
                if (!a && 0 !== a && !1 !== a) return 1;
                if (!b && 0 !== b && !1 !== b) return -1;
            }
            return null;
        },
        basicSort: function(a, b) {
            var nulls = rowSorter.handleNulls(a, b);
            return null !== nulls ? nulls : a === b ? 0 : a < b ? -1 : 1;
        },
        sortNumber: function(a, b) {
            var nulls = rowSorter.handleNulls(a, b);
            return null !== nulls ? nulls : a - b;
        },
        sortNumberStr: function(a, b) {
            var nulls = rowSorter.handleNulls(a, b);
            if (null !== nulls) return nulls;
            var numA, numB, badA = !1, badB = !1;
            return numA = parseFloat(a.replace(/[^0-9.-]/g, "")), isNaN(numA) && (badA = !0), 
            numB = parseFloat(b.replace(/[^0-9.-]/g, "")), isNaN(numB) && (badB = !0), badA && badB ? 0 : badA ? 1 : badB ? -1 : numA - numB;
        },
        sortAlpha: function(a, b) {
            var nulls = rowSorter.handleNulls(a, b);
            if (null !== nulls) return nulls;
            var strA = a.toString().toLowerCase(), strB = b.toString().toLowerCase();
            return strA === strB ? 0 : strA.localeCompare(strB);
        },
        sortDate: function(a, b) {
            var nulls = rowSorter.handleNulls(a, b);
            if (null !== nulls) return nulls;
            a instanceof Date || (a = new Date(a)), b instanceof Date || (b = new Date(b));
            var timeA = a.getTime(), timeB = b.getTime();
            return timeA === timeB ? 0 : timeA < timeB ? -1 : 1;
        },
        sortBool: function(a, b) {
            var nulls = rowSorter.handleNulls(a, b);
            return null !== nulls ? nulls : a && b ? 0 : a || b ? a ? 1 : -1 : 0;
        },
        getSortFn: function(grid, col, rows) {
            var sortFn;
            return rowSorter.colSortFnCache[col.colDef.name] ? sortFn = rowSorter.colSortFnCache[col.colDef.name] : void 0 !== col.sortingAlgorithm ? (sortFn = col.sortingAlgorithm, 
            rowSorter.colSortFnCache[col.colDef.name] = col.sortingAlgorithm) : col.sortCellFiltered && col.cellFilter ? (sortFn = rowSorter.sortAlpha, 
            rowSorter.colSortFnCache[col.colDef.name] = sortFn) : (sortFn = rowSorter.guessSortFn(col.colDef.type)) ? rowSorter.colSortFnCache[col.colDef.name] = sortFn : sortFn = rowSorter.sortAlpha, 
            sortFn;
        },
        prioritySort: function(a, b) {
            return void 0 !== a.sort.priority && void 0 !== b.sort.priority ? a.sort.priority < b.sort.priority ? -1 : a.sort.priority === b.sort.priority ? 0 : 1 : void 0 !== a.sort.priority ? -1 : void 0 !== b.sort.priority ? 1 : 0;
        },
        sort: function(grid, rows, columns) {
            if (rows) {
                if (grid.options.useExternalSorting) return rows;
                var col, direction, sortCols = [], defaultSortCols = [];
                if (columns.forEach(function(col) {
                    !col.sort || col.sort.ignoreSort || !col.sort.direction || col.sort.direction !== uiGridConstants.ASC && col.sort.direction !== uiGridConstants.DESC ? col.defaultSort && col.defaultSort.direction && (col.defaultSort.direction === uiGridConstants.ASC || col.defaultSort.direction === uiGridConstants.DESC) && defaultSortCols.push({
                        col: col,
                        sort: col.defaultSort
                    }) : sortCols.push({
                        col: col,
                        sort: col.sort
                    });
                }), sortCols = sortCols.sort(rowSorter.prioritySort), defaultSortCols = defaultSortCols.sort(rowSorter.prioritySort), 
                0 === (sortCols = sortCols.concat(defaultSortCols)).length) return rows;
                rows.forEach(function(row, idx) {
                    row.entity.$$uiGridIndex = idx;
                });
                var r = rows.slice(0), newRows = rows.sort(function(rowA, rowB) {
                    for (var sortFn, tem = 0, idx = 0; 0 === tem && idx < sortCols.length; ) {
                        var propA, propB;
                        col = sortCols[idx].col, direction = sortCols[idx].sort.direction, sortFn = rowSorter.getSortFn(grid, col, r), 
                        col.sortCellFiltered ? (propA = grid.getCellDisplayValue(rowA, col), propB = grid.getCellDisplayValue(rowB, col)) : (propA = grid.getCellValue(rowA, col), 
                        propB = grid.getCellValue(rowB, col)), tem = sortFn(propA, propB, rowA, rowB, direction, col), 
                        idx++;
                    }
                    return 0 === tem ? rowA.entity.$$uiGridIndex - rowB.entity.$$uiGridIndex : direction === uiGridConstants.ASC ? tem : 0 - tem;
                });
                return rows.forEach(function(row, idx) {
                    delete row.entity.$$uiGridIndex;
                }), newRows;
            }
        }
    });
    return rowSorter;
} ]), function() {
    var bindPolyfill, module = angular.module("ui.grid");
    function getStyles(elem) {
        var e = elem;
        return void 0 !== e.length && e.length && (e = elem[0]), e.ownerDocument.defaultView.getComputedStyle(e, null);
    }
    "function" != typeof Function.prototype.bind && (bindPolyfill = function() {
        var slice = Array.prototype.slice;
        return function(context) {
            var fn = this, args = slice.call(arguments, 1);
            return args.length ? function() {
                return arguments.length ? fn.apply(context, args.concat(slice.call(arguments))) : fn.apply(context, args);
            } : function() {
                return arguments.length ? fn.apply(context, arguments) : fn.call(context);
            };
        };
    });
    var rnumnonpx = new RegExp("^(" + /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source + ")(?!px)[a-z%]+$", "i"), rdisplayswap = /^(block|none|table(?!-c[ea]).+)/, cssShow = {
        position: "absolute",
        visibility: "hidden",
        display: "block"
    };
    function augmentWidthOrHeight(elem, name, extra, isBorderBox, styles) {
        for (var i = extra === (isBorderBox ? "border" : "content") ? 4 : "width" === name ? 1 : 0, val = 0, sides = [ "Top", "Right", "Bottom", "Left" ]; i < 4; i += 2) {
            var side = sides[i];
            if ("margin" === extra) {
                var marg = parseFloat(styles[extra + side]);
                isNaN(marg) || (val += marg);
            }
            if (isBorderBox) {
                if ("content" === extra) {
                    var padd = parseFloat(styles["padding" + side]);
                    isNaN(padd) || (val -= padd);
                }
                if ("margin" !== extra) {
                    var bordermarg = parseFloat(styles["border" + side + "Width"]);
                    isNaN(bordermarg) || (val -= bordermarg);
                }
            } else {
                var nocontentPad = parseFloat(styles["padding" + side]);
                if (isNaN(nocontentPad) || (val += nocontentPad), "padding" !== extra) {
                    var nocontentnopad = parseFloat(styles["border" + side + "Width"]);
                    isNaN(nocontentnopad) || (val += nocontentnopad);
                }
            }
        }
        return val;
    }
    function getWidthOrHeight(elem, name, extra) {
        var val, valueIsBorderBox = !0, styles = getStyles(elem), isBorderBox = "border-box" === styles.boxSizing;
        if (val <= 0 || null == val) {
            if (((val = styles[name]) < 0 || null == val) && (val = elem.style[name]), rnumnonpx.test(val)) return val;
            valueIsBorderBox = isBorderBox && !0, val = parseFloat(val) || 0;
        }
        return val + augmentWidthOrHeight(0, name, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles);
    }
    var uid = [ "0", "0", "0", "0" ];
    module.service("gridUtil", [ "$log", "$window", "$document", "$http", "$templateCache", "$timeout", "$interval", "$injector", "$q", "$interpolate", "uiGridConstants", function($log, $window, $document, $http, $templateCache, $timeout, $interval, $injector, $q, $interpolate, uiGridConstants) {
        var seedId, s = {
            augmentWidthOrHeight: augmentWidthOrHeight,
            getStyles: getStyles,
            createBoundedWrapper: function(object, method) {
                return function() {
                    return method.apply(object, arguments);
                };
            },
            readableColumnName: function(columnName) {
                return void 0 === columnName || null == columnName ? columnName : ("string" != typeof columnName && (columnName = String(columnName)), 
                columnName.replace(/_+/g, " ").replace(/^[A-Z]+$/, function(match) {
                    return match.toLowerCase();
                }).replace(/([\w\u00C0-\u017F]+)/g, function(match) {
                    return match.charAt(0).toUpperCase() + match.slice(1);
                }).replace(/(\w+?(?=[A-Z]))/g, "$1 "));
            },
            getColumnsFromData: function(data, excludeProperties) {
                var columnDefs = [];
                if (!data || void 0 === data[0] || void 0 === data[0]) return [];
                angular.isUndefined(excludeProperties) && (excludeProperties = []);
                var item = data[0];
                return angular.forEach(item, function(prop, propName) {
                    -1 === excludeProperties.indexOf(propName) && columnDefs.push({
                        name: propName
                    });
                }), columnDefs;
            },
            newId: (seedId = new Date().getTime(), function() {
                return seedId += 1;
            }),
            getTemplate: function(template) {
                if ($templateCache.get(template)) return s.postProcessTemplate($templateCache.get(template));
                if (angular.isFunction(template.then)) return template.then(s.postProcessTemplate).catch(angular.noop);
                try {
                    if (0 < angular.element(template).length) return $q.when(template).then(s.postProcessTemplate).catch(angular.noop);
                } catch (err) {}
                return $http({
                    method: "GET",
                    url: template
                }).then(function(result) {
                    var templateHtml = result.data.trim();
                    return $templateCache.put(template, templateHtml), templateHtml;
                }, function(err) {
                    throw new Error("Could not get template " + template + ": " + err);
                }).then(s.postProcessTemplate).catch(angular.noop);
            },
            postProcessTemplate: function(template) {
                var startSym = $interpolate.startSymbol(), endSym = $interpolate.endSymbol();
                return "{{" === startSym && "}}" === endSym || (template = (template = template.replace(/\{\{/g, startSym)).replace(/\}\}/g, endSym)), 
                $q.when(template);
            },
            guessType: function(item) {
                var itemType = typeof item;
                switch (itemType) {
                  case "number":
                  case "boolean":
                  case "string":
                    return itemType;

                  default:
                    return angular.isDate(item) ? "date" : "object";
                }
            },
            elementWidth: function(elem) {},
            elementHeight: function(elem) {},
            getScrollbarWidth: function() {
                var outer = document.createElement("div");
                outer.style.visibility = "hidden", outer.style.width = "100px", outer.style.msOverflowStyle = "scrollbar", 
                document.body.appendChild(outer);
                var widthNoScroll = outer.offsetWidth;
                outer.style.overflow = "scroll";
                var inner = document.createElement("div");
                inner.style.width = "100%", outer.appendChild(inner);
                var widthWithScroll = inner.offsetWidth;
                return outer.parentNode.removeChild(outer), widthNoScroll - widthWithScroll;
            },
            swap: function(elem, options, callback, args) {
                var ret, name, old = {};
                for (name in options) old[name] = elem.style[name], elem.style[name] = options[name];
                for (name in ret = callback.apply(elem, args || []), options) elem.style[name] = old[name];
                return ret;
            },
            fakeElement: function(elem, options, callback, args) {
                var ret, name, newElement = angular.element(elem).clone()[0];
                for (name in options) newElement.style[name] = options[name];
                return angular.element(document.body).append(newElement), ret = callback.call(newElement, newElement), 
                angular.element(newElement).remove(), ret;
            },
            normalizeWheelEvent: function(event) {
                var lowestDelta, lowestDeltaXY, absDelta, absDeltaXY, fn, orgEvent = event || window.event, delta = ([].slice.call(arguments, 1), 
                0), deltaX = 0, deltaY = 0;
                return orgEvent.originalEvent && (orgEvent = orgEvent.originalEvent), orgEvent.wheelDelta && (delta = orgEvent.wheelDelta), 
                orgEvent.detail && (delta = -1 * orgEvent.detail), deltaY = delta, void 0 !== orgEvent.axis && orgEvent.axis === orgEvent.HORIZONTAL_AXIS && (deltaY = 0, 
                deltaX = -1 * delta), orgEvent.deltaY && (delta = deltaY = -1 * orgEvent.deltaY), 
                orgEvent.deltaX && (delta = -1 * (deltaX = orgEvent.deltaX)), void 0 !== orgEvent.wheelDeltaY && (deltaY = orgEvent.wheelDeltaY), 
                void 0 !== orgEvent.wheelDeltaX && (deltaX = orgEvent.wheelDeltaX), absDelta = Math.abs(delta), 
                (!lowestDelta || absDelta < lowestDelta) && (lowestDelta = absDelta), absDeltaXY = Math.max(Math.abs(deltaY), Math.abs(deltaX)), 
                (!lowestDeltaXY || absDeltaXY < lowestDeltaXY) && (lowestDeltaXY = absDeltaXY), 
                fn = 0 < delta ? "floor" : "ceil", {
                    delta: delta = Math[fn](delta / lowestDelta),
                    deltaX: deltaX = Math[fn](deltaX / lowestDeltaXY),
                    deltaY: deltaY = Math[fn](deltaY / lowestDeltaXY)
                };
            },
            isTouchEnabled: function() {
                var bool;
                return ("ontouchstart" in $window || $window.DocumentTouch && $document instanceof DocumentTouch) && (bool = !0), 
                bool;
            },
            isNullOrUndefined: function(obj) {
                return null == obj;
            },
            endsWith: function(str, suffix) {
                return !(!str || !suffix || "string" != typeof str) && -1 !== str.indexOf(suffix, str.length - suffix.length);
            },
            arrayContainsObjectWithProperty: function(array, propertyName, propertyValue) {
                var found = !1;
                return angular.forEach(array, function(object) {
                    object[propertyName] === propertyValue && (found = !0);
                }), found;
            },
            numericAndNullSort: function(a, b) {
                return null === a ? 1 : null === b ? -1 : null === a && null === b ? 0 : a - b;
            },
            disableAnimations: function(element) {
                var $animate;
                try {
                    $animate = $injector.get("$animate"), 1 < angular.version.major || 1 === angular.version.major && 4 <= angular.version.minor ? $animate.enabled(element, !1) : $animate.enabled(!1, element);
                } catch (e) {}
            },
            enableAnimations: function(element) {
                var $animate;
                try {
                    return $animate = $injector.get("$animate"), 1 < angular.version.major || 1 === angular.version.major && 4 <= angular.version.minor ? $animate.enabled(element, !0) : $animate.enabled(!0, element), 
                    $animate;
                } catch (e) {}
            },
            nextUid: function() {
                for (var digit, index = uid.length; index; ) {
                    if (57 === (digit = uid[--index].charCodeAt(0))) return uid[index] = "A", "uiGrid-" + uid.join("");
                    if (90 !== digit) return uid[index] = String.fromCharCode(digit + 1), "uiGrid-" + uid.join("");
                    uid[index] = "0";
                }
                return uid.unshift("0"), "uiGrid-" + uid.join("");
            },
            hashKey: function(obj) {
                var key, objType = typeof obj;
                return "object" === objType && null !== obj ? "function" == typeof (key = obj.$$hashKey) ? key = obj.$$hashKey() : void 0 !== obj.$$hashKey && obj.$$hashKey ? key = obj.$$hashKey : void 0 === key && (key = obj.$$hashKey = s.nextUid()) : key = obj, 
                objType + ":" + key;
            },
            resetUids: function() {
                uid = [ "0", "0", "0" ];
            },
            logError: function(logMessage) {
                uiGridConstants.LOG_ERROR_MESSAGES && $log.error(logMessage);
            },
            logWarn: function(logMessage) {
                uiGridConstants.LOG_WARN_MESSAGES && $log.warn(logMessage);
            },
            logDebug: function() {
                uiGridConstants.LOG_DEBUG_MESSAGES && $log.debug.apply($log, arguments);
            }
        };
        s.focus = {
            queue: [],
            byId: function(id, Grid) {
                this._purgeQueue();
                var promise = $timeout(function() {
                    var elementID = (Grid && Grid.id ? Grid.id + "-" : "") + id, element = $window.document.getElementById(elementID);
                    element ? element.focus() : s.logWarn("[focus.byId] Element id " + elementID + " was not found.");
                }, 0, !1);
                return this.queue.push(promise), promise;
            },
            byElement: function(element) {
                if (!angular.isElement(element)) return s.logWarn("Trying to focus on an element that isn't an element."), 
                $q.reject("not-element");
                element = angular.element(element), this._purgeQueue();
                var promise = $timeout(function() {
                    element && element[0].focus();
                }, 0, !1);
                return this.queue.push(promise), promise;
            },
            bySelector: function(parentElement, querySelector, aSync) {
                var self = this;
                if (!angular.isElement(parentElement)) throw new Error("The parent element is not an element.");
                parentElement = angular.element(parentElement);
                var focusBySelector = function() {
                    var element = parentElement[0].querySelector(querySelector);
                    return self.byElement(element);
                };
                if (this._purgeQueue(), aSync) {
                    var promise = $timeout(focusBySelector, 0, !1);
                    return this.queue.push(promise), promise;
                }
                return focusBySelector();
            },
            _purgeQueue: function() {
                this.queue.forEach(function(element) {
                    $timeout.cancel(element);
                }), this.queue = [];
            }
        }, [ "width", "height" ].forEach(function(name) {
            var capsName = name.charAt(0).toUpperCase() + name.substr(1);
            s["element" + capsName] = function(elem, extra) {
                var e = elem;
                if (e && void 0 !== e.length && e.length && (e = elem[0]), e && null !== e) {
                    var styles = getStyles(e);
                    return 0 === e.offsetWidth && rdisplayswap.test(styles.display) ? s.swap(e, cssShow, function() {
                        return getWidthOrHeight(e, name, extra);
                    }) : getWidthOrHeight(e, name, extra);
                }
                return null;
            }, s["outerElement" + capsName] = function(elem, margin) {
                return elem ? s["element" + capsName].call(this, elem, margin ? "margin" : "border") : null;
            };
        }), s.closestElm = function(el, selector) {
            var matchesFn, parent;
            for (void 0 !== el.length && el.length && (el = el[0]), [ "matches", "webkitMatchesSelector", "mozMatchesSelector", "msMatchesSelector", "oMatchesSelector" ].some(function(fn) {
                return "function" == typeof document.body[fn] && (matchesFn = fn, !0);
            }); null !== el; ) {
                if (null !== (parent = el.parentElement) && parent[matchesFn](selector)) return parent;
                el = parent;
            }
            return null;
        }, s.type = function(obj) {
            return Function.prototype.toString.call(obj.constructor).match(/function (.*?)\(/)[1];
        }, s.getBorderSize = function(elem, borderType) {
            void 0 !== elem.length && elem.length && (elem = elem[0]);
            var styles = getStyles(elem);
            borderType = borderType ? "border" + borderType.charAt(0).toUpperCase() + borderType.slice(1) : "border", 
            borderType += "Width";
            var val = parseInt(styles[borderType], 10);
            return isNaN(val) ? 0 : val;
        }, s.detectBrowser = function() {
            var userAgent = $window.navigator.userAgent, browsers = {
                chrome: /chrome/i,
                safari: /safari/i,
                firefox: /firefox/i,
                ie: /internet explorer|trident\//i
            };
            for (var key in browsers) if (browsers[key].test(userAgent)) return key;
            return "unknown";
        }, s.rtlScrollType = function rtlScrollType() {
            if (rtlScrollType.type) return rtlScrollType.type;
            var definer = angular.element('<div dir="rtl" style="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll">A</div>')[0], type = "reverse";
            return document.body.appendChild(definer), 0 < definer.scrollLeft ? type = "default" : (definer.scrollLeft = 1, 
            0 === definer.scrollLeft && (type = "negative")), angular.element(definer).remove(), 
            rtlScrollType.type = type;
        }, s.normalizeScrollLeft = function(element, grid) {
            void 0 !== element.length && element.length && (element = element[0]);
            var scrollLeft = element.scrollLeft;
            if (grid.isRTL()) switch (s.rtlScrollType()) {
              case "default":
                return element.scrollWidth - scrollLeft - element.clientWidth;

              case "negative":
                return Math.abs(scrollLeft);

              case "reverse":
                return scrollLeft;
            }
            return scrollLeft;
        }, s.denormalizeScrollLeft = function(element, scrollLeft, grid) {
            if (void 0 !== element.length && element.length && (element = element[0]), grid.isRTL()) switch (s.rtlScrollType()) {
              case "default":
                return element.scrollWidth - element.clientWidth - scrollLeft;

              case "negative":
                return -1 * scrollLeft;

              case "reverse":
                return scrollLeft;
            }
            return scrollLeft;
        }, s.preEval = function(path) {
            var m = uiGridConstants.BRACKET_REGEXP.exec(path);
            if (m) return (m[1] ? s.preEval(m[1]) : m[1]) + m[2] + (m[3] ? s.preEval(m[3]) : m[3]);
            var parts = (path = path.replace(uiGridConstants.APOS_REGEXP, "\\'")).split(uiGridConstants.DOT_REGEXP), preparsed = [ parts.shift() ];
            return angular.forEach(parts, function(part) {
                preparsed.push(part.replace(uiGridConstants.FUNC_REGEXP, "']$1"));
            }), preparsed.join("['");
        }, s.debounce = function(func, wait, immediate) {
            var timeout, args, context, result;
            function debounce() {
                context = this, args = arguments;
                var callNow = immediate && !timeout;
                return timeout && $timeout.cancel(timeout), timeout = $timeout(function() {
                    timeout = null, immediate || (result = func.apply(context, args));
                }, wait, !1), callNow && (result = func.apply(context, args)), result;
            }
            return debounce.cancel = function() {
                $timeout.cancel(timeout), timeout = null;
            }, debounce;
        }, s.throttle = function(func, wait, options) {
            options = options || {};
            var context, args, lastCall = 0, queued = null;
            function runFunc(endDate) {
                lastCall = +new Date(), func.apply(context, args), $interval(function() {
                    queued = null;
                }, 0, 1, !1);
            }
            return function() {
                if (context = this, args = arguments, null === queued) {
                    var sinceLast = +new Date() - lastCall;
                    wait < sinceLast ? runFunc() : options.trailing && (queued = $interval(runFunc, wait - sinceLast, 1, !1));
                }
            };
        }, s.on = {}, s.off = {}, s._events = {}, s.addOff = function(eventName) {
            s.off[eventName] = function(elm, fn) {
                var idx = s._events[eventName].indexOf(fn);
                0 < idx && s._events[eventName].removeAt(idx);
            };
        };
        var nullLowestDeltaTimeout, lowestDelta, mouseWheeltoBind = "onwheel" in document || 9 <= document.documentMode ? [ "wheel" ] : [ "mousewheel", "DomMouseScroll", "MozMousePixelScroll" ];
        function mousewheelHandler(fn, event) {
            var absDelta, $elm = angular.element(this), delta = 0, deltaX = 0, deltaY = 0;
            if (event.originalEvent && (event = event.originalEvent), "detail" in event && (deltaY = -1 * event.detail), 
            "wheelDelta" in event && (deltaY = event.wheelDelta), "wheelDeltaY" in event && (deltaY = event.wheelDeltaY), 
            "wheelDeltaX" in event && (deltaX = -1 * event.wheelDeltaX), "axis" in event && event.axis === event.HORIZONTAL_AXIS && (deltaX = -1 * deltaY, 
            deltaY = 0), delta = 0 === deltaY ? deltaX : deltaY, "deltaY" in event && (delta = deltaY = -1 * event.deltaY), 
            "deltaX" in event && (deltaX = event.deltaX, 0 === deltaY && (delta = -1 * deltaX)), 
            0 !== deltaY || 0 !== deltaX) {
                if (1 === event.deltaMode) {
                    var lineHeight = $elm.data("mousewheel-line-height");
                    delta *= lineHeight, deltaY *= lineHeight, deltaX *= lineHeight;
                } else if (2 === event.deltaMode) {
                    var pageHeight = $elm.data("mousewheel-page-height");
                    delta *= pageHeight, deltaY *= pageHeight, deltaX *= pageHeight;
                }
                absDelta = Math.max(Math.abs(deltaY), Math.abs(deltaX)), (!lowestDelta || absDelta < lowestDelta) && function(orgEvent, absDelta) {
                    return "mousewheel" === orgEvent.type && absDelta % 120 == 0;
                }(event, lowestDelta = absDelta) && (lowestDelta /= 40), delta = Math[1 <= delta ? "floor" : "ceil"](delta / lowestDelta), 
                deltaX = Math[1 <= deltaX ? "floor" : "ceil"](deltaX / lowestDelta), deltaY = Math[1 <= deltaY ? "floor" : "ceil"](deltaY / lowestDelta);
                var newEvent = {
                    originalEvent: event,
                    deltaX: deltaX,
                    deltaY: deltaY,
                    deltaFactor: lowestDelta,
                    preventDefault: function() {
                        event.preventDefault();
                    },
                    stopPropagation: function() {
                        event.stopPropagation();
                    }
                };
                nullLowestDeltaTimeout && clearTimeout(nullLowestDeltaTimeout), nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200), 
                fn.call($elm[0], newEvent);
            }
        }
        function nullLowestDelta() {
            lowestDelta = null;
        }
        return s.on.mousewheel = function(elm, fn) {
            if (elm && fn) {
                var $elm = angular.element(elm);
                $elm.data("mousewheel-line-height", function(elm) {
                    var parent = (elm = angular.element(elm)[0]).parentElement;
                    return parent || (parent = document.getElementsByTagName("body")[0]), parseInt(getStyles(parent).fontSize) || parseInt(getStyles(elm).fontSize) || 16;
                }($elm)), $elm.data("mousewheel-page-height", s.elementHeight($elm)), $elm.data("mousewheel-callbacks") || $elm.data("mousewheel-callbacks", {});
                var cbs = $elm.data("mousewheel-callbacks");
                cbs[fn] = (Function.prototype.bind || bindPolyfill).call(mousewheelHandler, $elm[0], fn);
                for (var i = mouseWheeltoBind.length; i; ) $elm.on(mouseWheeltoBind[--i], cbs[fn]);
                $elm.on("$destroy", function() {
                    for (var i = mouseWheeltoBind.length; i; ) $elm.off(mouseWheeltoBind[--i], cbs[fn]);
                });
            }
        }, s.off.mousewheel = function(elm, fn) {
            var $elm = angular.element(elm), cbs = $elm.data("mousewheel-callbacks"), handler = cbs[fn];
            if (handler) for (var i = mouseWheeltoBind.length; i; ) $elm.off(mouseWheeltoBind[--i], handler);
            delete cbs[fn], 0 === Object.keys(cbs).length && ($elm.removeData("mousewheel-line-height"), 
            $elm.removeData("mousewheel-page-height"), $elm.removeData("mousewheel-callbacks"));
        }, s;
    } ]), module.filter("px", function() {
        return function(str) {
            return str.match(/^[\d\.]+$/) ? str + "px" : str;
        };
    });
}(), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("ar", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "التصفيه بالعمود",
                    removeFilter: "محو التصفيه",
                    columnMenuButtonLabel: "قاءمه الاعمده"
                },
                priority: "أولويه : ",
                filterLabel: "تصفيه بالاعمده :"
            },
            aggregate: {
                label: "العناصر"
            },
            groupPanel: {
                description: "اسحب رأس العمود هنا وأسقطه لإنشاء مجموعه"
            },
            search: {
                placeholder: "بحث  ...",
                showingItems: "العناصر الظاهره :",
                selectedItems: "العناصر المحدده :",
                totalItems: "عدد العناصر :",
                size: "حجم الصفحه :",
                first: "اول صفحه",
                next: "الصفحه التاليه",
                previous: "الصفحه الصابقه",
                last: "الصفحه الاخيره"
            },
            menu: {
                text: "اختيار العمود :"
            },
            sort: {
                ascending: "ترتيب تصاعدى",
                descending: "ترتيب تنازلى",
                none: "عدم التحديد",
                remove: "حذف الترتيب"
            },
            column: {
                hide: "إخفاء عمود"
            },
            aggregation: {
                count: "عدد الصفوف: ",
                sum: "جمع: ",
                avg: "المتوسط الحسابى: ",
                min: "الادنى: ",
                max: "الاقصى: "
            },
            pinning: {
                pinLeft: "تثبيت لليسار",
                pinRight: "تثبيت لليمين",
                unpin: "فك التثبيت"
            },
            columnMenu: {
                close: "غلق"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "قائمه الجدول"
                },
                columns: "الاعمده:",
                importerTitle: "إدخال ملف",
                exporterAllAsCsv: "إخراج كل البيانات ك(csv)",
                exporterVisibleAsCsv: "إخراج كل البيانات الواضحه ك (csv)",
                exporterSelectedAsCsv: "إخراج كل البيانات المحدده ك (csv)",
                exporterAllAsPdf: "إخراج كل البيانات ك(pdf)",
                exporterVisibleAsPdf: "إخراج كل البيانات الواضحه ك (pdf)",
                exporterSelectedAsPdf: "إخراج كل البيانات المحدده ك (pdf)",
                clearAllFilters: "محو كل الترشيح"
            },
            importer: {
                noHeaders: "اسماء هؤلاء الاعمده غير واضحه، هل يوجد رأس للملف؟",
                noObjects: "Objects were not able to be derived, was there data in the file other than headers?",
                invalidCsv: "الملف غير قادر على الاتمام ، هل ال (CSV) صحيح؟",
                invalidJson: "الملف غير قادر على الاتمام ، هل ال (JSON) صحيح؟",
                jsonNotArray: "Imported json file must contain an array, aborting."
            },
            pagination: {
                aria: {
                    pageToFirst: "الصفحه الاولى",
                    pageBack: "الصفه السابقه",
                    pageSelected: "الصفحه المحدده",
                    pageForward: "الصفحه التاليه",
                    pageToLast: "الصفحه الاخيره"
                },
                sizes: "عدد العناصر فى الصفحه",
                totalItems: "عناصر",
                through: "إلى",
                of: "من"
            },
            grouping: {
                group: "جمع",
                ungroup: "فك الجمع",
                aggregate_count: "جمله : العدد",
                aggregate_sum: "جمله : الحاصل",
                aggregate_max: "جمله : الاقصى",
                aggregate_min: "جمله : الاقل",
                aggregate_avg: "جمله :المتوسط ",
                aggregate_remove: "جمله : حذف"
            },
            validate: {
                error: "خطأ :",
                minLength: "القيمه لابد ان لا تقل عن THRESHOLD حرف.",
                maxLength: "القيمه لابد ان لا تزيد عن THRESHOLD حرف.",
                required: "مطلوب قيمه"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("bg", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Филттър за колоната",
                    removeFilter: "Премахни филтър",
                    columnMenuButtonLabel: "Меню на колоната"
                },
                priority: "Приоритет:",
                filterLabel: "Филтър за колоната: "
            },
            aggregate: {
                label: "обекти"
            },
            search: {
                placeholder: "Търсене...",
                showingItems: "Показани обекти:",
                selectedItems: "избрани обекти:",
                totalItems: "Общо:",
                size: "Размер на страницата:",
                first: "Първа страница",
                next: "Следваща страница",
                previous: "Предишна страница",
                last: "Последна страница"
            },
            menu: {
                text: "Избери колони:"
            },
            sort: {
                ascending: "Сортиране по възходящ ред",
                descending: "Сортиране по низходящ ред",
                none: "Без сортиране",
                remove: "Премахни сортирането"
            },
            column: {
                hide: "Скрий колоната"
            },
            aggregation: {
                count: "Общо редове: ",
                sum: "общо: ",
                avg: "средно: ",
                min: "най-малко: ",
                max: "най-много: "
            },
            pinning: {
                pinLeft: "Прикрепи вляво",
                pinRight: "Прикрепи вдясно",
                unpin: "Премахване"
            },
            columnMenu: {
                close: "Затвори"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Меню на таблицата"
                },
                columns: "Колони:",
                importerTitle: "Импортиране на файл",
                exporterAllAsCsv: "Експортиране на данните като csv",
                exporterVisibleAsCsv: "Експортиране на видимите данни като csv",
                exporterSelectedAsCsv: "Експортиране на избраните данни като csv",
                exporterAllAsPdf: "Експортиране на данните като pdf",
                exporterVisibleAsPdf: "Експортиране на видимите данни като pdf",
                exporterSelectedAsPdf: "Експортиране на избраните данни като pdf",
                clearAllFilters: "Премахни всички филтри"
            },
            importer: {
                noHeaders: "Имената на колоните не успяха да бъдат извлечени, файлът има ли хедър?",
                noObjects: "Обектите не успяха да бъдат извлечени, файлът съдържа ли данни, различни от хедър?",
                invalidCsv: "Файлът не може да бъде обработеб, уверете се, че е валиден CSV файл",
                invalidJson: "Файлът не може да бъде обработеб, уверете се, че е валиден JSON файл",
                jsonNotArray: "Импортираният JSON файл трябва да съдържа масив, прекратяване."
            },
            pagination: {
                aria: {
                    pageToFirst: "Към първа страница",
                    pageBack: "Страница назад",
                    pageSelected: "Избрана страница",
                    pageForward: "Страница напред",
                    pageToLast: "Към последна страница"
                },
                sizes: "обекта на страница",
                totalItems: "обекта",
                through: "до",
                of: "от"
            },
            grouping: {
                group: "Групиране",
                ungroup: "Премахване на групирането",
                aggregate_count: "Сбор: Брой",
                aggregate_sum: "Сбор: Сума",
                aggregate_max: "Сбор: Максимум",
                aggregate_min: "Сбор: Минимум",
                aggregate_avg: "Сбор: Средно",
                aggregate_remove: "Сбор: Премахване"
            },
            validate: {
                error: "Грешка:",
                minLength: "Стойността трябва да съдържа поне THRESHOLD символа.",
                maxLength: "Стойността не трябва да съдържа повече от THRESHOLD символа.",
                required: "Необходима е стойност."
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        var lang = {
            aggregate: {
                label: "položky"
            },
            groupPanel: {
                description: "Přesuňte záhlaví zde pro vytvoření skupiny dle sloupce."
            },
            search: {
                placeholder: "Hledat...",
                showingItems: "Zobrazuji položky:",
                selectedItems: "Vybrané položky:",
                totalItems: "Celkem položek:",
                size: "Velikost strany:",
                first: "První strana",
                next: "Další strana",
                previous: "Předchozí strana",
                last: "Poslední strana"
            },
            menu: {
                text: "Vyberte sloupec:"
            },
            sort: {
                ascending: "Seřadit od A-Z",
                descending: "Seřadit od Z-A",
                remove: "Odebrat seřazení"
            },
            column: {
                hide: "Schovat sloupec"
            },
            aggregation: {
                count: "celkem řádků: ",
                sum: "celkem: ",
                avg: "avg: ",
                min: "min.: ",
                max: "max.: "
            },
            pinning: {
                pinLeft: "Zamknout vlevo",
                pinRight: "Zamknout vpravo",
                unpin: "Odemknout"
            },
            gridMenu: {
                columns: "Sloupce:",
                importerTitle: "Importovat soubor",
                exporterAllAsCsv: "Exportovat všechna data do csv",
                exporterVisibleAsCsv: "Exportovat viditelná data do csv",
                exporterSelectedAsCsv: "Exportovat vybraná data do csv",
                exporterAllAsPdf: "Exportovat všechna data do pdf",
                exporterVisibleAsPdf: "Exportovat viditelná data do pdf",
                exporterSelectedAsPdf: "Exportovat vybraná data do pdf",
                exporterAllAsExcel: "Exportovat všechna data do excel",
                exporterVisibleAsExcel: "Exportovat viditelná data do excel",
                exporterSelectedAsExcel: "Exportovat vybraná data do excel",
                clearAllFilters: "Odstranit všechny filtry"
            },
            importer: {
                noHeaders: "Názvy sloupců se nepodařilo získat, obsahuje soubor záhlaví?",
                noObjects: "Data se nepodařilo zpracovat, obsahuje soubor řádky mimo záhlaví?",
                invalidCsv: "Soubor nelze zpracovat, jedná se o CSV?",
                invalidJson: "Soubor nelze zpracovat, je to JSON?",
                jsonNotArray: "Soubor musí obsahovat json. Ukončuji.."
            },
            pagination: {
                sizes: "položek na stránku",
                totalItems: "položek"
            },
            grouping: {
                group: "Seskupit",
                ungroup: "Odebrat seskupení",
                aggregate_count: "Agregace: Count",
                aggregate_sum: "Agregace: Sum",
                aggregate_max: "Agregace: Max",
                aggregate_min: "Agregace: Min",
                aggregate_avg: "Agregace: Avg",
                aggregate_remove: "Agregace: Odebrat"
            }
        };
        return $delegate.add("cs", lang), $delegate.add("cz", lang), $delegate.add("cs-cz", lang), 
        $delegate.add("cs-CZ", lang), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("da", {
            aggregate: {
                label: "artikler"
            },
            groupPanel: {
                description: "Grupér rækker udfra en kolonne ved at trække dens overskift hertil."
            },
            search: {
                placeholder: "Søg...",
                showingItems: "Viste rækker:",
                selectedItems: "Valgte rækker:",
                totalItems: "Rækker totalt:",
                size: "Side størrelse:",
                first: "Første side",
                next: "Næste side",
                previous: "Forrige side",
                last: "Sidste side"
            },
            menu: {
                text: "Vælg kolonner:"
            },
            sort: {
                ascending: "Sorter stigende",
                descending: "Sorter faldende",
                none: "Sorter ingen",
                remove: "Fjern sortering"
            },
            column: {
                hide: "Skjul kolonne"
            },
            aggregation: {
                count: "antal rækker: ",
                sum: "sum: ",
                avg: "gns: ",
                min: "min: ",
                max: "max: "
            },
            gridMenu: {
                columns: "Kolonner:",
                importerTitle: "Importer fil",
                exporterAllAsCsv: "Eksporter alle data som csv",
                exporterVisibleAsCsv: "Eksporter synlige data som csv",
                exporterSelectedAsCsv: "Eksporter markerede data som csv",
                exporterAllAsPdf: "Eksporter alle data som pdf",
                exporterVisibleAsPdf: "Eksporter synlige data som pdf",
                exporterSelectedAsPdf: "Eksporter markerede data som pdf",
                exporterAllAsExcel: "Eksporter alle data som excel",
                exporterVisibleAsExcel: "Eksporter synlige data som excel",
                exporterSelectedAsExcel: "Eksporter markerede data som excel",
                clearAllFilters: "Clear all filters"
            },
            importer: {
                noHeaders: "Column names were unable to be derived, does the file have a header?",
                noObjects: "Objects were not able to be derived, was there data in the file other than headers?",
                invalidCsv: "File was unable to be processed, is it valid CSV?",
                invalidJson: "File was unable to be processed, is it valid Json?",
                jsonNotArray: "Imported json file must contain an array, aborting."
            },
            pagination: {
                aria: {
                    pageToFirst: "Gå til første",
                    pageBack: "Gå tilbage",
                    pageSelected: "Valgte side",
                    pageForward: "Gå frem",
                    pageToLast: "Gå til sidste"
                },
                sizes: "genstande per side",
                totalItems: "genstande",
                through: "gennem",
                of: "af"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("de", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Filter für Spalte",
                    removeFilter: "Filter löschen",
                    columnMenuButtonLabel: "Spaltenmenü",
                    column: "Spalte"
                },
                priority: "Priorität:",
                filterLabel: "Filter für Spalte: "
            },
            aggregate: {
                label: "Eintrag"
            },
            groupPanel: {
                description: "Ziehen Sie eine Spaltenüberschrift hierhin, um nach dieser Spalte zu gruppieren."
            },
            search: {
                aria: {
                    selected: "Zeile markiert",
                    notSelected: "Zeile nicht markiert"
                },
                placeholder: "Suche...",
                showingItems: "Zeige Einträge:",
                selectedItems: "Ausgewählte Einträge:",
                totalItems: "Einträge gesamt:",
                size: "Einträge pro Seite:",
                first: "Erste Seite",
                next: "Nächste Seite",
                previous: "Vorherige Seite",
                last: "Letzte Seite"
            },
            menu: {
                text: "Spalten auswählen:"
            },
            sort: {
                ascending: "aufsteigend sortieren",
                descending: "absteigend sortieren",
                none: "keine Sortierung",
                remove: "Sortierung zurücksetzen"
            },
            column: {
                hide: "Spalte ausblenden"
            },
            aggregation: {
                count: "Zeilen insgesamt: ",
                sum: "gesamt: ",
                avg: "Durchschnitt: ",
                min: "min: ",
                max: "max: "
            },
            pinning: {
                pinLeft: "Links anheften",
                pinRight: "Rechts anheften",
                unpin: "Lösen"
            },
            columnMenu: {
                close: "Schließen"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Tabellenmenü"
                },
                columns: "Spalten:",
                importerTitle: "Datei importieren",
                exporterAllAsCsv: "Alle Daten als CSV exportieren",
                exporterVisibleAsCsv: "Sichtbare Daten als CSV exportieren",
                exporterSelectedAsCsv: "Markierte Daten als CSV exportieren",
                exporterAllAsPdf: "Alle Daten als PDF exportieren",
                exporterVisibleAsPdf: "Sichtbare Daten als PDF exportieren",
                exporterSelectedAsPdf: "Markierte Daten als PDF exportieren",
                exporterAllAsExcel: "Alle Daten als Excel exportieren",
                exporterVisibleAsExcel: "Sichtbare Daten als Excel exportieren",
                exporterSelectedAsExcel: "Markierte Daten als Excel exportieren",
                clearAllFilters: "Alle Filter zurücksetzen"
            },
            importer: {
                noHeaders: "Es konnten keine Spaltennamen ermittelt werden. Sind in der Datei Spaltendefinitionen enthalten?",
                noObjects: "Es konnten keine Zeileninformationen gelesen werden, Sind in der Datei außer den Spaltendefinitionen auch Daten enthalten?",
                invalidCsv: "Die Datei konnte nicht eingelesen werden, ist es eine gültige CSV-Datei?",
                invalidJson: "Die Datei konnte nicht eingelesen werden. Enthält sie gültiges JSON?",
                jsonNotArray: "Die importierte JSON-Datei muß ein Array enthalten. Breche Import ab."
            },
            pagination: {
                aria: {
                    pageToFirst: "Zum Anfang",
                    pageBack: "Seite zurück",
                    pageSelected: "Ausgewählte Seite",
                    pageForward: "Seite vor",
                    pageToLast: "Zum Ende"
                },
                sizes: "Einträge pro Seite",
                totalItems: "Einträgen",
                through: "bis",
                of: "von"
            },
            grouping: {
                group: "Gruppieren",
                ungroup: "Gruppierung aufheben",
                aggregate_count: "Agg: Anzahl",
                aggregate_sum: "Agg: Summe",
                aggregate_max: "Agg: Maximum",
                aggregate_min: "Agg: Minimum",
                aggregate_avg: "Agg: Mittelwert",
                aggregate_remove: "Aggregation entfernen"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("en", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Filter for column",
                    removeFilter: "Remove Filter",
                    columnMenuButtonLabel: "Column Menu",
                    column: "Column"
                },
                priority: "Priority:",
                filterLabel: "Filter for column: "
            },
            aggregate: {
                label: "items"
            },
            groupPanel: {
                description: "Drag a column header here and drop it to group by that column."
            },
            search: {
                aria: {
                    selected: "Row selected",
                    notSelected: "Row not selected"
                },
                placeholder: "Search...",
                showingItems: "Showing Items:",
                selectedItems: "Selected Items:",
                totalItems: "Total Items:",
                size: "Page Size:",
                first: "First Page",
                next: "Next Page",
                previous: "Previous Page",
                last: "Last Page"
            },
            menu: {
                text: "Choose Columns:"
            },
            sort: {
                ascending: "Sort Ascending",
                descending: "Sort Descending",
                none: "Sort None",
                remove: "Remove Sort"
            },
            column: {
                hide: "Hide Column"
            },
            aggregation: {
                count: "total rows: ",
                sum: "total: ",
                avg: "avg: ",
                min: "min: ",
                max: "max: "
            },
            pinning: {
                pinLeft: "Pin Left",
                pinRight: "Pin Right",
                unpin: "Unpin"
            },
            columnMenu: {
                close: "Close"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Grid Menu"
                },
                columns: "Columns:",
                importerTitle: "Import file",
                exporterAllAsCsv: "Export all data as csv",
                exporterVisibleAsCsv: "Export visible data as csv",
                exporterSelectedAsCsv: "Export selected data as csv",
                exporterAllAsPdf: "Export all data as pdf",
                exporterVisibleAsPdf: "Export visible data as pdf",
                exporterSelectedAsPdf: "Export selected data as pdf",
                exporterAllAsExcel: "Export all data as excel",
                exporterVisibleAsExcel: "Export visible data as excel",
                exporterSelectedAsExcel: "Export selected data as excel",
                clearAllFilters: "Clear all filters"
            },
            importer: {
                noHeaders: "Column names were unable to be derived, does the file have a header?",
                noObjects: "Objects were not able to be derived, was there data in the file other than headers?",
                invalidCsv: "File was unable to be processed, is it valid CSV?",
                invalidJson: "File was unable to be processed, is it valid Json?",
                jsonNotArray: "Imported json file must contain an array, aborting."
            },
            pagination: {
                aria: {
                    pageToFirst: "Page to first",
                    pageBack: "Page back",
                    pageSelected: "Selected page",
                    pageForward: "Page forward",
                    pageToLast: "Page to last"
                },
                sizes: "items per page",
                totalItems: "items",
                through: "through",
                of: "of"
            },
            grouping: {
                group: "Group",
                ungroup: "Ungroup",
                aggregate_count: "Agg: Count",
                aggregate_sum: "Agg: Sum",
                aggregate_max: "Agg: Max",
                aggregate_min: "Agg: Min",
                aggregate_avg: "Agg: Avg",
                aggregate_remove: "Agg: Remove"
            },
            validate: {
                error: "Error:",
                minLength: "Value should be at least THRESHOLD characters long.",
                maxLength: "Value should be at most THRESHOLD characters long.",
                required: "A value is needed."
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("es", {
            aggregate: {
                label: "Artículos"
            },
            groupPanel: {
                description: "Arrastre un encabezado de columna aquí y suéltelo para agrupar por esa columna."
            },
            search: {
                placeholder: "Buscar...",
                showingItems: "Artículos Mostrados:",
                selectedItems: "Artículos Seleccionados:",
                totalItems: "Artículos Totales:",
                size: "Tamaño de Página:",
                first: "Primera Página",
                next: "Página Siguiente",
                previous: "Página Anterior",
                last: "Última Página"
            },
            menu: {
                text: "Elegir columnas:"
            },
            sort: {
                ascending: "Orden Ascendente",
                descending: "Orden Descendente",
                remove: "Sin Ordenar"
            },
            column: {
                hide: "Ocultar la columna"
            },
            aggregation: {
                count: "filas totales: ",
                sum: "total: ",
                avg: "media: ",
                min: "min: ",
                max: "max: "
            },
            pinning: {
                pinLeft: "Fijar a la Izquierda",
                pinRight: "Fijar a la Derecha",
                unpin: "Quitar Fijación"
            },
            gridMenu: {
                columns: "Columnas:",
                importerTitle: "Importar archivo",
                exporterAllAsCsv: "Exportar todo como csv",
                exporterVisibleAsCsv: "Exportar vista como csv",
                exporterSelectedAsCsv: "Exportar selección como csv",
                exporterAllAsPdf: "Exportar todo como pdf",
                exporterVisibleAsPdf: "Exportar vista como pdf",
                exporterSelectedAsPdf: "Exportar selección como pdf",
                exporterAllAsExcel: "Exportar todo como excel",
                exporterVisibleAsExcel: "Exportar vista como excel",
                exporterSelectedAsExcel: "Exportar selección como excel",
                clearAllFilters: "Limpiar todos los filtros"
            },
            importer: {
                noHeaders: "No fue posible derivar los nombres de las columnas, ¿tiene encabezados el archivo?",
                noObjects: "No fue posible obtener registros, ¿contiene datos el archivo, aparte de los encabezados?",
                invalidCsv: "No fue posible procesar el archivo, ¿es un CSV válido?",
                invalidJson: "No fue posible procesar el archivo, ¿es un Json válido?",
                jsonNotArray: "El archivo json importado debe contener un array, abortando."
            },
            pagination: {
                sizes: "registros por página",
                totalItems: "registros",
                of: "de"
            },
            grouping: {
                group: "Agrupar",
                ungroup: "Desagrupar",
                aggregate_count: "Agr: Cont",
                aggregate_sum: "Agr: Sum",
                aggregate_max: "Agr: Máx",
                aggregate_min: "Agr: Min",
                aggregate_avg: "Agr: Prom",
                aggregate_remove: "Agr: Quitar"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("fa", {
            aggregate: {
                label: "قلم"
            },
            groupPanel: {
                description: "عنوان یک ستون را بگیر و به گروهی از آن ستون رها کن."
            },
            search: {
                placeholder: "جستجو...",
                showingItems: "نمایش اقلام:",
                selectedItems: "قلم‌های انتخاب شده:",
                totalItems: "مجموع اقلام:",
                size: "اندازه‌ی صفحه:",
                first: "اولین صفحه",
                next: "صفحه‌ی‌بعدی",
                previous: "صفحه‌ی‌ قبلی",
                last: "آخرین صفحه"
            },
            menu: {
                text: "ستون‌های انتخابی:"
            },
            sort: {
                ascending: "ترتیب صعودی",
                descending: "ترتیب نزولی",
                remove: "حذف مرتب کردن"
            },
            column: {
                hide: "پنهان‌کردن ستون"
            },
            aggregation: {
                count: "تعداد: ",
                sum: "مجموع: ",
                avg: "میانگین: ",
                min: "کمترین: ",
                max: "بیشترین: "
            },
            pinning: {
                pinLeft: "پین کردن سمت چپ",
                pinRight: "پین کردن سمت راست",
                unpin: "حذف پین"
            },
            gridMenu: {
                columns: "ستون‌ها:",
                importerTitle: "وارد کردن فایل",
                exporterAllAsCsv: "خروجی تمام داده‌ها در فایل csv",
                exporterVisibleAsCsv: "خروجی داده‌های قابل مشاهده در فایل csv",
                exporterSelectedAsCsv: "خروجی داده‌های انتخاب‌شده در فایل csv",
                exporterAllAsPdf: "خروجی تمام داده‌ها در فایل pdf",
                exporterVisibleAsPdf: "خروجی داده‌های قابل مشاهده در فایل pdf",
                exporterSelectedAsPdf: "خروجی داده‌های انتخاب‌شده در فایل pdf",
                clearAllFilters: "پاک کردن تمام فیلتر"
            },
            importer: {
                noHeaders: "نام ستون قابل استخراج نیست. آیا فایل عنوان دارد؟",
                noObjects: "اشیا قابل استخراج نیستند. آیا به جز عنوان‌ها در فایل داده وجود دارد؟",
                invalidCsv: "فایل قابل پردازش نیست. آیا فرمت  csv  معتبر است؟",
                invalidJson: "فایل قابل پردازش نیست. آیا فرمت json   معتبر است؟",
                jsonNotArray: "فایل json وارد شده باید حاوی آرایه باشد. عملیات ساقط شد."
            },
            pagination: {
                sizes: "اقلام در هر صفحه",
                totalItems: "اقلام",
                of: "از"
            },
            grouping: {
                group: "گروه‌بندی",
                ungroup: "حذف گروه‌بندی",
                aggregate_count: "Agg: تعداد",
                aggregate_sum: "Agg: جمع",
                aggregate_max: "Agg: بیشینه",
                aggregate_min: "Agg: کمینه",
                aggregate_avg: "Agg: میانگین",
                aggregate_remove: "Agg: حذف"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("fi", {
            aggregate: {
                label: "rivit"
            },
            groupPanel: {
                description: "Raahaa ja pudota otsikko tähän ryhmittääksesi sarakkeen mukaan."
            },
            search: {
                placeholder: "Hae...",
                showingItems: "Näytetään rivejä:",
                selectedItems: "Valitut rivit:",
                totalItems: "Rivejä yht.:",
                size: "Näytä:",
                first: "Ensimmäinen sivu",
                next: "Seuraava sivu",
                previous: "Edellinen sivu",
                last: "Viimeinen sivu"
            },
            menu: {
                text: "Valitse sarakkeet:"
            },
            sort: {
                ascending: "Järjestä nouseva",
                descending: "Järjestä laskeva",
                remove: "Poista järjestys"
            },
            column: {
                hide: "Piilota sarake"
            },
            aggregation: {
                count: "Rivejä yht.: ",
                sum: "Summa: ",
                avg: "K.a.: ",
                min: "Min: ",
                max: "Max: "
            },
            pinning: {
                pinLeft: "Lukitse vasemmalle",
                pinRight: "Lukitse oikealle",
                unpin: "Poista lukitus"
            },
            gridMenu: {
                columns: "Sarakkeet:",
                importerTitle: "Tuo tiedosto",
                exporterAllAsCsv: "Vie tiedot csv-muodossa",
                exporterVisibleAsCsv: "Vie näkyvä tieto csv-muodossa",
                exporterSelectedAsCsv: "Vie valittu tieto csv-muodossa",
                exporterAllAsPdf: "Vie tiedot pdf-muodossa",
                exporterVisibleAsPdf: "Vie näkyvä tieto pdf-muodossa",
                exporterSelectedAsPdf: "Vie valittu tieto pdf-muodossa",
                exporterAllAsExcel: "Vie tiedot excel-muodossa",
                exporterVisibleAsExcel: "Vie näkyvä tieto excel-muodossa",
                exporterSelectedAsExcel: "Vie valittu tieto excel-muodossa",
                clearAllFilters: "Puhdista kaikki suodattimet"
            },
            importer: {
                noHeaders: "Sarakkeen nimiä ei voitu päätellä, onko tiedostossa otsikkoriviä?",
                noObjects: "Tietoja ei voitu lukea, onko tiedostossa muuta kuin otsikkot?",
                invalidCsv: "Tiedostoa ei voitu käsitellä, oliko se CSV-muodossa?",
                invalidJson: "Tiedostoa ei voitu käsitellä, oliko se JSON-muodossa?",
                jsonNotArray: "Tiedosto ei sisältänyt taulukkoa, lopetetaan."
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("fr", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Filtre de la colonne",
                    removeFilter: "Supprimer le filtre",
                    columnMenuButtonLabel: "Menu de la colonne"
                },
                priority: "Priorité:",
                filterLabel: "Filtre de la colonne: "
            },
            aggregate: {
                label: "éléments"
            },
            groupPanel: {
                description: "Faites glisser une en-tête de colonne ici pour créer un groupe de colonnes."
            },
            search: {
                placeholder: "Recherche...",
                showingItems: "Affichage des éléments :",
                selectedItems: "Éléments sélectionnés :",
                totalItems: "Nombre total d'éléments:",
                size: "Taille de page:",
                first: "Première page",
                next: "Page Suivante",
                previous: "Page précédente",
                last: "Dernière page"
            },
            menu: {
                text: "Choisir des colonnes :"
            },
            sort: {
                ascending: "Trier par ordre croissant",
                descending: "Trier par ordre décroissant",
                none: "Aucun tri",
                remove: "Enlever le tri"
            },
            column: {
                hide: "Cacher la colonne"
            },
            aggregation: {
                count: "lignes totales: ",
                sum: "total: ",
                avg: "moy: ",
                min: "min: ",
                max: "max: "
            },
            pinning: {
                pinLeft: "Épingler à gauche",
                pinRight: "Épingler à droite",
                unpin: "Détacher"
            },
            columnMenu: {
                close: "Fermer"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Menu du tableau"
                },
                columns: "Colonnes:",
                importerTitle: "Importer un fichier",
                exporterAllAsCsv: "Exporter toutes les données en CSV",
                exporterVisibleAsCsv: "Exporter les données visibles en CSV",
                exporterSelectedAsCsv: "Exporter les données sélectionnées en CSV",
                exporterAllAsPdf: "Exporter toutes les données en PDF",
                exporterVisibleAsPdf: "Exporter les données visibles en PDF",
                exporterSelectedAsPdf: "Exporter les données sélectionnées en PDF",
                exporterAllAsExcel: "Exporter toutes les données en Excel",
                exporterVisibleAsExcel: "Exporter les données visibles en Excel",
                exporterSelectedAsExcel: "Exporter les données sélectionnées en Excel",
                clearAllFilters: "Nettoyez tous les filtres"
            },
            importer: {
                noHeaders: "Impossible de déterminer le nom des colonnes, le fichier possède-t-il une en-tête ?",
                noObjects: "Aucun objet trouvé, le fichier possède-t-il des données autres que l'en-tête ?",
                invalidCsv: "Le fichier n'a pas pu être traité, le CSV est-il valide ?",
                invalidJson: "Le fichier n'a pas pu être traité, le JSON est-il valide ?",
                jsonNotArray: "Le fichier JSON importé doit contenir un tableau, abandon."
            },
            pagination: {
                aria: {
                    pageToFirst: "Aller à la première page",
                    pageBack: "Page précédente",
                    pageSelected: "Page sélectionnée",
                    pageForward: "Page suivante",
                    pageToLast: "Aller à la dernière page"
                },
                sizes: "éléments par page",
                totalItems: "éléments",
                through: "à",
                of: "sur"
            },
            grouping: {
                group: "Grouper",
                ungroup: "Dégrouper",
                aggregate_count: "Agg: Compter",
                aggregate_sum: "Agg: Somme",
                aggregate_max: "Agg: Max",
                aggregate_min: "Agg: Min",
                aggregate_avg: "Agg: Moy",
                aggregate_remove: "Agg: Retirer"
            },
            validate: {
                error: "Erreur:",
                minLength: "La valeur doit être supérieure ou égale à THRESHOLD caractères.",
                maxLength: "La valeur doit être inférieure ou égale à THRESHOLD caractères.",
                required: "Une valeur est nécéssaire."
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("he", {
            aggregate: {
                label: "items"
            },
            groupPanel: {
                description: "גרור עמודה לכאן ושחרר בכדי לקבץ עמודה זו."
            },
            search: {
                placeholder: "חפש...",
                showingItems: "מציג:",
                selectedItems: 'סה"כ נבחרו:',
                totalItems: 'סה"כ רשומות:',
                size: "תוצאות בדף:",
                first: "דף ראשון",
                next: "דף הבא",
                previous: "דף קודם",
                last: "דף אחרון"
            },
            menu: {
                text: "בחר עמודות:"
            },
            sort: {
                ascending: "סדר עולה",
                descending: "סדר יורד",
                remove: "בטל"
            },
            column: {
                hide: "טור הסתר"
            },
            aggregation: {
                count: "total rows: ",
                sum: "total: ",
                avg: "avg: ",
                min: "min: ",
                max: "max: "
            },
            gridMenu: {
                columns: "Columns:",
                importerTitle: "Import file",
                exporterAllAsCsv: "Export all data as csv",
                exporterVisibleAsCsv: "Export visible data as csv",
                exporterSelectedAsCsv: "Export selected data as csv",
                exporterAllAsPdf: "Export all data as pdf",
                exporterVisibleAsPdf: "Export visible data as pdf",
                exporterSelectedAsPdf: "Export selected data as pdf",
                exporterAllAsExcel: "Export all data as excel",
                exporterVisibleAsExcel: "Export visible data as excel",
                exporterSelectedAsExcel: "Export selected data as excel",
                clearAllFilters: "Clean all filters"
            },
            importer: {
                noHeaders: "Column names were unable to be derived, does the file have a header?",
                noObjects: "Objects were not able to be derived, was there data in the file other than headers?",
                invalidCsv: "File was unable to be processed, is it valid CSV?",
                invalidJson: "File was unable to be processed, is it valid Json?",
                jsonNotArray: "Imported json file must contain an array, aborting."
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("hy", {
            aggregate: {
                label: "տվյալներ"
            },
            groupPanel: {
                description: "Ըստ սյան խմբավորելու համար քաշեք և գցեք վերնագիրն այստեղ։"
            },
            search: {
                placeholder: "Փնտրում...",
                showingItems: "Ցուցադրված տվյալներ՝",
                selectedItems: "Ընտրված:",
                totalItems: "Ընդամենը՝",
                size: "Տողերի քանակը էջում՝",
                first: "Առաջին էջ",
                next: "Հաջորդ էջ",
                previous: "Նախորդ էջ",
                last: "Վերջին էջ"
            },
            menu: {
                text: "Ընտրել սյուները:"
            },
            sort: {
                ascending: "Աճման կարգով",
                descending: "Նվազման կարգով",
                remove: "Հանել "
            },
            column: {
                hide: "Թաքցնել սյունը"
            },
            aggregation: {
                count: "ընդամենը տող՝ ",
                sum: "ընդամենը՝ ",
                avg: "միջին՝ ",
                min: "մին՝ ",
                max: "մաքս՝ "
            },
            pinning: {
                pinLeft: "Կպցնել ձախ կողմում",
                pinRight: "Կպցնել աջ կողմում",
                unpin: "Արձակել"
            },
            gridMenu: {
                columns: "Սյուներ:",
                importerTitle: "Ներմուծել ֆայլ",
                exporterAllAsCsv: "Արտահանել ամբողջը CSV",
                exporterVisibleAsCsv: "Արտահանել երևացող տվյալները CSV",
                exporterSelectedAsCsv: "Արտահանել ընտրված տվյալները CSV",
                exporterAllAsPdf: "Արտահանել PDF",
                exporterVisibleAsPdf: "Արտահանել երևացող տվյալները PDF",
                exporterSelectedAsPdf: "Արտահանել ընտրված տվյալները PDF",
                exporterAllAsExcel: "Արտահանել excel",
                exporterVisibleAsExcel: "Արտահանել երևացող տվյալները excel",
                exporterSelectedAsExcel: "Արտահանել ընտրված տվյալները excel",
                clearAllFilters: "Մաքրել բոլոր ֆիլտրերը"
            },
            importer: {
                noHeaders: "Հնարավոր չեղավ որոշել սյան վերնագրերը։ Արդյո՞ք ֆայլը ունի վերնագրեր։",
                noObjects: "Հնարավոր չեղավ կարդալ տվյալները։ Արդյո՞ք ֆայլում կան տվյալներ։",
                invalidCsv: "Հնարավոր չեղավ մշակել ֆայլը։ Արդյո՞ք այն վավեր CSV է։",
                invalidJson: "Հնարավոր չեղավ մշակել ֆայլը։ Արդյո՞ք այն վավեր Json է։",
                jsonNotArray: "Ներմուծված json ֆայլը պետք է պարունակի զանգված, կասեցվում է։"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("is", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Sía fyrir dálk",
                    removeFilter: "Fjarlægja síu",
                    columnMenuButtonLabel: "Dálkavalmynd"
                },
                priority: "Forgangsröðun:",
                filterLabel: "Sía fyrir dálka: "
            },
            aggregate: {
                label: "hlutir"
            },
            groupPanel: {
                description: "Dragðu dálkhaus hingað til að flokka saman eftir þeim dálki."
            },
            search: {
                placeholder: "Leita...",
                showingItems: "Sýni hluti:",
                selectedItems: "Valdir hlutir:",
                totalItems: "Hlutir alls:",
                size: "Stærð síðu:",
                first: "Fyrsta síða",
                next: "Næsta síða",
                previous: "Fyrri síða",
                last: "Síðasta síða"
            },
            menu: {
                text: "Veldu dálka:"
            },
            sort: {
                ascending: "Raða hækkandi",
                descending: "Raða lækkandi",
                none: "Engin röðun",
                remove: "Fjarlægja röðun"
            },
            column: {
                hide: "Fela dálk"
            },
            aggregation: {
                count: "fjöldi raða: ",
                sum: "summa: ",
                avg: "meðaltal: ",
                min: "lágmark: ",
                max: "hámark: "
            },
            pinning: {
                pinLeft: "Festa til vinstri",
                pinRight: "Festa til hægri",
                unpin: "Losa"
            },
            columnMenu: {
                close: "Loka"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Töflu valmynd"
                },
                columns: "Dálkar:",
                importerTitle: "Flytja inn skjal",
                exporterAllAsCsv: "Flytja út gögn sem csv",
                exporterVisibleAsCsv: "Flytja út sýnileg gögn sem csv",
                exporterSelectedAsCsv: "Flytja út valin gögn sem csv",
                exporterAllAsPdf: "Flytja út öll gögn sem pdf",
                exporterVisibleAsPdf: "Flytja út sýnileg gögn sem pdf",
                exporterSelectedAsPdf: "Flytja út valin gögn sem pdf",
                clearAllFilters: "Hreinsa allar síur"
            },
            importer: {
                noHeaders: "Ekki hægt að vinna dálkanöfn úr skjalinu, er skjalið örugglega með haus?",
                noObjects: "Ekki hægt að vinna hluti úr skjalinu, voru örugglega gögn í skjalinu önnur en hausinn?",
                invalidCsv: "Tókst ekki að vinna skjal, er það örggulega gilt CSV?",
                invalidJson: "Tókst ekki að vinna skjal, er það örugglega gilt Json?",
                jsonNotArray: "Innflutt json skjal verður að innihalda fylki, hætti við."
            },
            pagination: {
                aria: {
                    pageToFirst: "Fletta að fyrstu",
                    pageBack: "Fletta til baka",
                    pageSelected: "Valin síða",
                    pageForward: "Fletta áfram",
                    pageToLast: "Fletta að síðustu"
                },
                sizes: "hlutir á síðu",
                totalItems: "hlutir",
                through: "gegnum",
                of: "af"
            },
            grouping: {
                group: "Flokka",
                ungroup: "Sundurliða",
                aggregate_count: "Fjöldi: ",
                aggregate_sum: "Summa: ",
                aggregate_max: "Hámark: ",
                aggregate_min: "Lágmark: ",
                aggregate_avg: "Meðaltal: ",
                aggregate_remove: "Fjarlægja: "
            },
            validate: {
                error: "Villa:",
                minLength: "Gildi ætti að vera a.m.k. THRESHOLD stafa langt.",
                maxLength: "Gildi ætti að vera í mesta lagi THRESHOLD stafa langt.",
                required: "Þarf að hafa gildi."
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("it", {
            aggregate: {
                label: "elementi"
            },
            groupPanel: {
                description: "Trascina un'intestazione all'interno del gruppo della colonna."
            },
            search: {
                placeholder: "Ricerca...",
                showingItems: "Mostra:",
                selectedItems: "Selezionati:",
                totalItems: "Totali:",
                size: "Tot Pagine:",
                first: "Prima",
                next: "Prossima",
                previous: "Precedente",
                last: "Ultima"
            },
            menu: {
                text: "Scegli le colonne:"
            },
            sort: {
                ascending: "Asc.",
                descending: "Desc.",
                remove: "Annulla ordinamento"
            },
            column: {
                hide: "Nascondi"
            },
            aggregation: {
                count: "righe totali: ",
                sum: "tot: ",
                avg: "media: ",
                min: "minimo: ",
                max: "massimo: "
            },
            pinning: {
                pinLeft: "Blocca a sx",
                pinRight: "Blocca a dx",
                unpin: "Blocca in alto"
            },
            gridMenu: {
                columns: "Colonne:",
                importerTitle: "Importa",
                exporterAllAsCsv: "Esporta tutti i dati in CSV",
                exporterVisibleAsCsv: "Esporta i dati visibili in CSV",
                exporterSelectedAsCsv: "Esporta i dati selezionati in CSV",
                exporterAllAsPdf: "Esporta tutti i dati in PDF",
                exporterVisibleAsPdf: "Esporta i dati visibili in PDF",
                exporterSelectedAsPdf: "Esporta i dati selezionati in PDF",
                exporterAllAsExcel: "Esporta tutti i dati in excel",
                exporterVisibleAsExcel: "Esporta i dati visibili in excel",
                exporterSelectedAsExcel: "Esporta i dati selezionati in excel",
                clearAllFilters: "Pulire tutti i filtri"
            },
            importer: {
                noHeaders: "Impossibile reperire i nomi delle colonne, sicuro che siano indicati all'interno del file?",
                noObjects: "Impossibile reperire gli oggetti, sicuro che siano indicati all'interno del file?",
                invalidCsv: "Impossibile elaborare il file, sicuro che sia un CSV?",
                invalidJson: "Impossibile elaborare il file, sicuro che sia un JSON valido?",
                jsonNotArray: "Errore! Il file JSON da importare deve contenere un array."
            },
            pagination: {
                aria: {
                    pageToFirst: "Prima",
                    pageBack: "Indietro",
                    pageSelected: "Pagina selezionata",
                    pageForward: "Avanti",
                    pageToLast: "Ultima"
                },
                sizes: "elementi per pagina",
                totalItems: "elementi",
                through: "a",
                of: "di"
            },
            grouping: {
                group: "Raggruppa",
                ungroup: "Separa",
                aggregate_count: "Agg: N. Elem.",
                aggregate_sum: "Agg: Somma",
                aggregate_max: "Agg: Massimo",
                aggregate_min: "Agg: Minimo",
                aggregate_avg: "Agg: Media",
                aggregate_remove: "Agg: Rimuovi"
            },
            validate: {
                error: "Errore:",
                minLength: "Lunghezza minima pari a THRESHOLD caratteri.",
                maxLength: "Lunghezza massima pari a THRESHOLD caratteri.",
                required: "Necessario inserire un valore."
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("ja", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "列のフィルター",
                    removeFilter: "フィルターの解除",
                    columnMenuButtonLabel: "列のメニュー"
                },
                priority: "優先度:",
                filterLabel: "列フィルター: "
            },
            aggregate: {
                label: "項目"
            },
            groupPanel: {
                description: "ここに列ヘッダをドラッグアンドドロップして、その列でグループ化します。"
            },
            search: {
                placeholder: "検索...",
                showingItems: "表示中の項目:",
                selectedItems: "選択した項目:",
                totalItems: "項目の総数:",
                size: "ページサイズ:",
                first: "最初のページ",
                next: "次のページ",
                previous: "前のページ",
                last: "前のページ"
            },
            menu: {
                text: "列の選択:"
            },
            sort: {
                ascending: "昇順に並べ替え",
                descending: "降順に並べ替え",
                none: "並べ替え無し",
                remove: "並べ替えの解除"
            },
            column: {
                hide: "列の非表示"
            },
            aggregation: {
                count: "行数: ",
                sum: "合計: ",
                avg: "平均: ",
                min: "最小: ",
                max: "最大: "
            },
            pinning: {
                pinLeft: "左に固定",
                pinRight: "右に固定",
                unpin: "固定解除"
            },
            columnMenu: {
                close: "閉じる"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "グリッドメニュー"
                },
                columns: "列の表示/非表示:",
                importerTitle: "ファイルのインポート",
                exporterAllAsCsv: "すべてのデータをCSV形式でエクスポート",
                exporterVisibleAsCsv: "表示中のデータをCSV形式でエクスポート",
                exporterSelectedAsCsv: "選択したデータをCSV形式でエクスポート",
                exporterAllAsPdf: "すべてのデータをPDF形式でエクスポート",
                exporterVisibleAsPdf: "表示中のデータをPDF形式でエクスポート",
                exporterSelectedAsPdf: "選択したデータをPDF形式でエクスポート",
                clearAllFilters: "すべてのフィルタをクリア"
            },
            importer: {
                noHeaders: "列名を取得できません。ファイルにヘッダが含まれていることを確認してください。",
                noObjects: "オブジェクトを取得できません。ファイルにヘッダ以外のデータが含まれていることを確認してください。",
                invalidCsv: "ファイルを処理できません。ファイルが有効なCSV形式であることを確認してください。",
                invalidJson: "ファイルを処理できません。ファイルが有効なJSON形式であることを確認してください。",
                jsonNotArray: "インポートしたJSONファイルには配列が含まれている必要があります。処理を中止します。"
            },
            pagination: {
                aria: {
                    pageToFirst: "最初のページ",
                    pageBack: "前のページ",
                    pageSelected: "現在のページ",
                    pageForward: "次のページ",
                    pageToLast: "最後のページ"
                },
                sizes: "項目/ページ",
                totalItems: "項目",
                through: "から",
                of: "項目/全"
            },
            grouping: {
                group: "グループ化",
                ungroup: "グループ化の解除",
                aggregate_count: "集計表示: 行数",
                aggregate_sum: "集計表示: 合計",
                aggregate_max: "集計表示: 最大",
                aggregate_min: "集計表示: 最小",
                aggregate_avg: "集計表示: 平均",
                aggregate_remove: "集計表示: 解除"
            },
            validate: {
                error: "Error:",
                minLength: "THRESHOLD 文字以上で入力してください。",
                maxLength: "THRESHOLD 文字以下で入力してください。",
                required: "値が必要です。"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("ko", {
            aggregate: {
                label: "아이템"
            },
            groupPanel: {
                description: "컬럼으로 그룹핑하기 위해서는 컬럼 헤더를 끌어 떨어뜨려 주세요."
            },
            search: {
                placeholder: "검색...",
                showingItems: "항목 보여주기:",
                selectedItems: "선택 항목:",
                totalItems: "전체 항목:",
                size: "페이지 크기:",
                first: "첫번째 페이지",
                next: "다음 페이지",
                previous: "이전 페이지",
                last: "마지막 페이지"
            },
            menu: {
                text: "컬럼을 선택하세요:"
            },
            sort: {
                ascending: "오름차순 정렬",
                descending: "내림차순 정렬",
                remove: "소팅 제거"
            },
            column: {
                hide: "컬럼 제거"
            },
            aggregation: {
                count: "전체 갯수: ",
                sum: "전체: ",
                avg: "평균: ",
                min: "최소: ",
                max: "최대: "
            },
            pinning: {
                pinLeft: "왼쪽 핀",
                pinRight: "오른쪽 핀",
                unpin: "핀 제거"
            },
            gridMenu: {
                columns: "컬럼:",
                importerTitle: "파일 가져오기",
                exporterAllAsCsv: "csv로 모든 데이터 내보내기",
                exporterVisibleAsCsv: "csv로 보이는 데이터 내보내기",
                exporterSelectedAsCsv: "csv로 선택된 데이터 내보내기",
                exporterAllAsPdf: "pdf로 모든 데이터 내보내기",
                exporterVisibleAsPdf: "pdf로 보이는 데이터 내보내기",
                exporterSelectedAsPdf: "pdf로 선택 데이터 내보내기",
                clearAllFilters: "모든 필터를 청소"
            },
            importer: {
                noHeaders: "컬럼명이 지정되어 있지 않습니다. 파일에 헤더가 명시되어 있는지 확인해 주세요.",
                noObjects: "데이터가 지정되어 있지 않습니다. 데이터가 파일에 있는지 확인해 주세요.",
                invalidCsv: "파일을 처리할 수 없습니다. 올바른 csv인지 확인해 주세요.",
                invalidJson: "파일을 처리할 수 없습니다. 올바른 json인지 확인해 주세요.",
                jsonNotArray: "json 파일은 배열을 포함해야 합니다."
            },
            pagination: {
                sizes: "페이지당 항목",
                totalItems: "전체 항목"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("nl", {
            aggregate: {
                label: "items"
            },
            groupPanel: {
                description: "Sleep hier een kolomnaam heen om op te groeperen."
            },
            search: {
                placeholder: "Zoeken...",
                showingItems: "Getoonde items:",
                selectedItems: "Geselecteerde items:",
                totalItems: "Totaal aantal items:",
                size: "Items per pagina:",
                first: "Eerste pagina",
                next: "Volgende pagina",
                previous: "Vorige pagina",
                last: "Laatste pagina"
            },
            menu: {
                text: "Kies kolommen:"
            },
            sort: {
                ascending: "Sorteer oplopend",
                descending: "Sorteer aflopend",
                remove: "Verwijder sortering"
            },
            column: {
                hide: "Verberg kolom"
            },
            aggregation: {
                count: "Aantal rijen: ",
                sum: "Som: ",
                avg: "Gemiddelde: ",
                min: "Min: ",
                max: "Max: "
            },
            pinning: {
                pinLeft: "Zet links vast",
                pinRight: "Zet rechts vast",
                unpin: "Maak los"
            },
            gridMenu: {
                columns: "Kolommen:",
                importerTitle: "Importeer bestand",
                exporterAllAsCsv: "Exporteer alle data als csv",
                exporterVisibleAsCsv: "Exporteer zichtbare data als csv",
                exporterSelectedAsCsv: "Exporteer geselecteerde data als csv",
                exporterAllAsPdf: "Exporteer alle data als pdf",
                exporterVisibleAsPdf: "Exporteer zichtbare data als pdf",
                exporterSelectedAsPdf: "Exporteer geselecteerde data als pdf",
                exporterAllAsExcel: "Exporteer alle data als excel",
                exporterVisibleAsExcel: "Exporteer zichtbare data als excel",
                exporterSelectedAsExcel: "Exporteer alle data als excel",
                clearAllFilters: "Reinig alle filters"
            },
            importer: {
                noHeaders: "Kolomnamen kunnen niet worden afgeleid. Heeft het bestand een header?",
                noObjects: "Objecten kunnen niet worden afgeleid. Bevat het bestand data naast de headers?",
                invalidCsv: "Het bestand kan niet verwerkt worden. Is het een valide csv bestand?",
                invalidJson: "Het bestand kan niet verwerkt worden. Is het valide json?",
                jsonNotArray: "Het json bestand moet een array bevatten. De actie wordt geannuleerd."
            },
            pagination: {
                sizes: "items per pagina",
                totalItems: "items",
                of: "van de"
            },
            grouping: {
                group: "Groepeer",
                ungroup: "Groepering opheffen",
                aggregate_count: "Agg: Aantal",
                aggregate_sum: "Agg: Som",
                aggregate_max: "Agg: Max",
                aggregate_min: "Agg: Min",
                aggregate_avg: "Agg: Gem",
                aggregate_remove: "Agg: Verwijder"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("no", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Filter for kolonne",
                    removeFilter: "Fjern filter",
                    columnMenuButtonLabel: "Kolonnemeny"
                },
                priority: "Prioritet:",
                filterLabel: "Filter for kolonne: "
            },
            aggregate: {
                label: "elementer"
            },
            groupPanel: {
                description: "Trekk en kolonneoverskrift hit og slipp den for å gruppere etter den kolonnen."
            },
            search: {
                placeholder: "Søk...",
                showingItems: "Viste elementer:",
                selectedItems: "Valgte elementer:",
                totalItems: "Antall elementer:",
                size: "Sidestørrelse:",
                first: "Første side",
                next: "Neste side",
                previous: "Forrige side",
                last: "Siste side"
            },
            menu: {
                text: "Velg kolonner:"
            },
            sort: {
                ascending: "Sortere stigende",
                descending: "Sortere fallende",
                none: "Ingen sortering",
                remove: "Fjern sortering"
            },
            column: {
                hide: "Skjul kolonne"
            },
            aggregation: {
                count: "antall rader: ",
                sum: "total: ",
                avg: "gjennomsnitt: ",
                min: "minimum: ",
                max: "maksimum: "
            },
            pinning: {
                pinLeft: "Fest til venstre",
                pinRight: "Fest til høyre",
                unpin: "Løsne"
            },
            columnMenu: {
                close: "Lukk"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Grid Menu"
                },
                columns: "Kolonner:",
                importerTitle: "Importer fil",
                exporterAllAsCsv: "Eksporter alle data som csv",
                exporterVisibleAsCsv: "Eksporter synlige data som csv",
                exporterSelectedAsCsv: "Eksporter utvalgte data som csv",
                exporterAllAsPdf: "Eksporter alle data som pdf",
                exporterVisibleAsPdf: "Eksporter synlige data som pdf",
                exporterSelectedAsPdf: "Eksporter utvalgte data som pdf",
                exporterAllAsExcel: "Eksporter alle data som excel",
                exporterVisibleAsExcel: "Eksporter synlige data som excel",
                exporterSelectedAsExcel: "Eksporter utvalgte data som excel",
                clearAllFilters: "Clear all filters"
            },
            importer: {
                noHeaders: "Kolonnenavn kunne ikke avledes. Har filen en overskrift?",
                noObjects: "Objekter kunne ikke avledes. Er der andre data i filen enn overskriften?",
                invalidCsv: "Filen kunne ikke behandles. Er den gyldig CSV?",
                invalidJson: "Filen kunne ikke behandles. Er den gyldig JSON?",
                jsonNotArray: "Importert JSON-fil må inneholde en liste. Avbryter."
            },
            pagination: {
                aria: {
                    pageToFirst: "Gå til første side",
                    pageBack: "Gå til forrige side",
                    pageSelected: "Valgte side",
                    pageForward: "Gå til neste side",
                    pageToLast: "Gå til siste side"
                },
                sizes: "elementer per side",
                totalItems: "elementer",
                through: "til",
                of: "av"
            },
            grouping: {
                group: "Gruppere",
                ungroup: "Fjerne gruppering",
                aggregate_count: "Agr: Antall",
                aggregate_sum: "Agr: Sum",
                aggregate_max: "Agr: Maksimum",
                aggregate_min: "Agr: Minimum",
                aggregate_avg: "Agr: Gjennomsnitt",
                aggregate_remove: "Agr: Fjern"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("pl", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Filtr dla kolumny",
                    removeFilter: "Usuń filtr",
                    columnMenuButtonLabel: "Opcje kolumny",
                    column: "Kolumna"
                },
                priority: "Priorytet:",
                filterLabel: "Filtr dla kolumny: "
            },
            aggregate: {
                label: "pozycji"
            },
            groupPanel: {
                description: "Przeciągnij nagłówek kolumny tutaj, aby pogrupować według niej."
            },
            search: {
                aria: {
                    selected: "Wiersz zaznaczony",
                    notSelected: "Wiersz niezaznaczony"
                },
                placeholder: "Szukaj...",
                showingItems: "Widoczne pozycje:",
                selectedItems: "Zaznaczone pozycje:",
                totalItems: "Wszystkich pozycji:",
                size: "Rozmiar strony:",
                first: "Pierwsza strona",
                next: "Następna strona",
                previous: "Poprzednia strona",
                last: "Ostatnia strona"
            },
            menu: {
                text: "Wybierz kolumny:"
            },
            sort: {
                ascending: "Sortuj rosnąco",
                descending: "Sortuj malejąco",
                none: "Brak sortowania",
                remove: "Wyłącz sortowanie"
            },
            column: {
                hide: "Ukryj kolumnę"
            },
            aggregation: {
                count: "Razem pozycji: ",
                sum: "Razem: ",
                avg: "Średnia: ",
                min: "Min: ",
                max: "Max: "
            },
            pinning: {
                pinLeft: "Przypnij do lewej",
                pinRight: "Przypnij do prawej",
                unpin: "Odepnij"
            },
            columnMenu: {
                close: "Zamknij"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Opcje tabeli"
                },
                columns: "Kolumny:",
                importerTitle: "Importuj plik",
                exporterAllAsCsv: "Eksportuj wszystkie dane do csv",
                exporterVisibleAsCsv: "Eksportuj widoczne dane do csv",
                exporterSelectedAsCsv: "Eksportuj zaznaczone dane do csv",
                exporterAllAsPdf: "Eksportuj wszystkie dane do pdf",
                exporterVisibleAsPdf: "Eksportuj widoczne dane do pdf",
                exporterSelectedAsPdf: "Eksportuj zaznaczone dane do pdf",
                exporterAllAsExcel: "Eksportuj wszystkie dane do excel",
                exporterVisibleAsExcel: "Eksportuj widoczne dane do excel",
                exporterSelectedAsExcel: "Eksportuj zaznaczone dane do excel",
                clearAllFilters: "Wyczyść filtry"
            },
            importer: {
                noHeaders: "Nie udało się wczytać nazw kolumn. Czy plik posiada nagłówek?",
                noObjects: "Nie udalo się wczytać pozycji. Czy plik zawiera dane?",
                invalidCsv: "Nie udało się przetworzyć pliku. Czy to prawidłowy plik CSV?",
                invalidJson: "Nie udało się przetworzyć pliku. Czy to prawidłowy plik JSON?",
                jsonNotArray: "Importowany plik JSON musi zawierać tablicę. Importowanie przerwane."
            },
            pagination: {
                aria: {
                    pageToFirst: "Pierwsza strona",
                    pageBack: "Poprzednia strona",
                    pageSelected: "Wybrana strona",
                    pageForward: "Następna strona",
                    pageToLast: "Ostatnia strona"
                },
                sizes: "pozycji na stronę",
                totalItems: "pozycji",
                through: "do",
                of: "z"
            },
            grouping: {
                group: "Grupuj",
                ungroup: "Rozgrupuj",
                aggregate_count: "Zbiorczo: Razem",
                aggregate_sum: "Zbiorczo: Suma",
                aggregate_max: "Zbiorczo: Max",
                aggregate_min: "Zbiorczo: Min",
                aggregate_avg: "Zbiorczo: Średnia",
                aggregate_remove: "Zbiorczo: Usuń"
            },
            validate: {
                error: "Błąd:",
                minLength: "Wartość powinna składać się z co najmniej THRESHOLD znaków.",
                maxLength: "Wartość powinna składać się z przynajmniej THRESHOLD znaków.",
                required: "Wartość jest wymagana."
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("pt-br", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Filtro por coluna",
                    removeFilter: "Remover filtro",
                    columnMenuButtonLabel: "Menu coluna",
                    column: "Coluna"
                },
                priority: "Prioridade:",
                filterLabel: "Filtro por coluna: "
            },
            aggregate: {
                label: "itens"
            },
            groupPanel: {
                description: "Arraste e solte uma coluna aqui para agrupar por essa coluna"
            },
            search: {
                aria: {
                    selected: "Linha selecionada",
                    notSelected: "Linha não está selecionada"
                },
                placeholder: "Procurar...",
                showingItems: "Mostrando os Itens:",
                selectedItems: "Items Selecionados:",
                totalItems: "Total de Itens:",
                size: "Tamanho da Página:",
                first: "Primeira Página",
                next: "Próxima Página",
                previous: "Página Anterior",
                last: "Última Página"
            },
            menu: {
                text: "Selecione as colunas:"
            },
            sort: {
                ascending: "Ordenar Ascendente",
                descending: "Ordenar Descendente",
                none: "Nenhuma Ordem",
                remove: "Remover Ordenação"
            },
            column: {
                hide: "Esconder coluna"
            },
            aggregation: {
                count: "total de linhas: ",
                sum: "total: ",
                avg: "med: ",
                min: "min: ",
                max: "max: "
            },
            pinning: {
                pinLeft: "Fixar Esquerda",
                pinRight: "Fixar Direita",
                unpin: "Desprender"
            },
            columnMenu: {
                close: "Fechar"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Menu Grid"
                },
                columns: "Colunas:",
                importerTitle: "Importar arquivo",
                exporterAllAsCsv: "Exportar todos os dados como csv",
                exporterVisibleAsCsv: "Exportar dados visíveis como csv",
                exporterSelectedAsCsv: "Exportar dados selecionados como csv",
                exporterAllAsPdf: "Exportar todos os dados como pdf",
                exporterVisibleAsPdf: "Exportar dados visíveis como pdf",
                exporterSelectedAsPdf: "Exportar dados selecionados como pdf",
                exporterAllAsExcel: "Exportar todos os dados como excel",
                exporterVisibleAsExcel: "Exportar dados visíveis como excel",
                exporterSelectedAsExcel: "Exportar dados selecionados como excel",
                clearAllFilters: "Limpar todos os filtros"
            },
            importer: {
                noHeaders: "Nomes de colunas não puderam ser derivados. O arquivo tem um cabeçalho?",
                noObjects: "Objetos não puderam ser derivados. Havia dados no arquivo, além dos cabeçalhos?",
                invalidCsv: "Arquivo não pode ser processado. É um CSV válido?",
                invalidJson: "Arquivo não pode ser processado. É um Json válido?",
                jsonNotArray: "Arquivo json importado tem que conter um array. Abortando."
            },
            pagination: {
                aria: {
                    pageToFirst: "Primeira página",
                    pageBack: "Página anterior",
                    pageSelected: "Página Selecionada",
                    pageForward: "Proxima",
                    pageToLast: "Anterior"
                },
                sizes: "itens por página",
                totalItems: "itens",
                through: "através dos",
                of: "de"
            },
            grouping: {
                group: "Agrupar",
                ungroup: "Desagrupar",
                aggregate_count: "Agr: Contar",
                aggregate_sum: "Agr: Soma",
                aggregate_max: "Agr: Max",
                aggregate_min: "Agr: Min",
                aggregate_avg: "Agr: Med",
                aggregate_remove: "Agr: Remover"
            },
            validate: {
                error: "Erro:",
                minLength: "O valor deve ter, no minimo, THRESHOLD caracteres.",
                maxLength: "O valor deve ter, no máximo, THRESHOLD caracteres.",
                required: "Um valor é necessário."
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("pt", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Filtro por coluna",
                    removeFilter: "Remover filtro",
                    columnMenuButtonLabel: "Menu coluna",
                    column: "Coluna"
                },
                priority: "Prioridade:",
                filterLabel: "Filtro por coluna: "
            },
            aggregate: {
                label: "itens"
            },
            groupPanel: {
                description: "Arraste e solte uma coluna aqui para agrupar por essa coluna"
            },
            search: {
                aria: {
                    selected: "Linha selecionada",
                    notSelected: "Linha não está selecionada"
                },
                placeholder: "Procurar...",
                showingItems: "Mostrando os Itens:",
                selectedItems: "Itens Selecionados:",
                totalItems: "Total de Itens:",
                size: "Tamanho da Página:",
                first: "Primeira Página",
                next: "Próxima Página",
                previous: "Página Anterior",
                last: "Última Página"
            },
            menu: {
                text: "Selecione as colunas:"
            },
            sort: {
                ascending: "Ordenar Ascendente",
                descending: "Ordenar Descendente",
                none: "Nenhuma Ordem",
                remove: "Remover Ordenação"
            },
            column: {
                hide: "Esconder coluna"
            },
            aggregation: {
                count: "total de linhas: ",
                sum: "total: ",
                avg: "med: ",
                min: "min: ",
                max: "max: "
            },
            pinning: {
                pinLeft: "Fixar Esquerda",
                pinRight: "Fixar Direita",
                unpin: "Desprender"
            },
            columnMenu: {
                close: "Fechar"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Menu Grid"
                },
                columns: "Colunas:",
                importerTitle: "Importar ficheiro",
                exporterAllAsCsv: "Exportar todos os dados como csv",
                exporterVisibleAsCsv: "Exportar dados visíveis como csv",
                exporterSelectedAsCsv: "Exportar dados selecionados como csv",
                exporterAllAsPdf: "Exportar todos os dados como pdf",
                exporterVisibleAsPdf: "Exportar dados visíveis como pdf",
                exporterSelectedAsPdf: "Exportar dados selecionados como pdf",
                exporterAllAsExcel: "Exportar todos os dados como excel",
                exporterVisibleAsExcel: "Exportar dados visíveis como excel",
                exporterSelectedAsExcel: "Exportar dados selecionados como excel",
                clearAllFilters: "Limpar todos os filtros"
            },
            importer: {
                noHeaders: "Nomes de colunas não puderam ser derivados. O ficheiro tem um cabeçalho?",
                noObjects: "Objetos não puderam ser derivados. Havia dados no ficheiro, além dos cabeçalhos?",
                invalidCsv: "Ficheiro não pode ser processado. É um CSV válido?",
                invalidJson: "Ficheiro não pode ser processado. É um Json válido?",
                jsonNotArray: "Ficheiro json importado tem que conter um array. Interrompendo."
            },
            pagination: {
                aria: {
                    pageToFirst: "Primeira página",
                    pageBack: "Página anterior",
                    pageSelected: "Página Selecionada",
                    pageForward: "Próxima",
                    pageToLast: "Anterior"
                },
                sizes: "itens por página",
                totalItems: "itens",
                through: "a",
                of: "de"
            },
            grouping: {
                group: "Agrupar",
                ungroup: "Desagrupar",
                aggregate_count: "Agr: Contar",
                aggregate_sum: "Agr: Soma",
                aggregate_max: "Agr: Max",
                aggregate_min: "Agr: Min",
                aggregate_avg: "Agr: Med",
                aggregate_remove: "Agr: Remover"
            },
            validate: {
                error: "Erro:",
                minLength: "O valor deve ter, no minimo, THRESHOLD caracteres.",
                maxLength: "O valor deve ter, no máximo, THRESHOLD caracteres.",
                required: "Um valor é necessário."
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("ro", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Filtru pentru coloana",
                    removeFilter: "Sterge filtru",
                    columnMenuButtonLabel: "Column Menu"
                },
                priority: "Prioritate:",
                filterLabel: "Filtru pentru coloana:"
            },
            aggregate: {
                label: "Elemente"
            },
            groupPanel: {
                description: "Trage un cap de coloana aici pentru a grupa elementele dupa coloana respectiva"
            },
            search: {
                placeholder: "Cauta...",
                showingItems: "Arata elementele:",
                selectedItems: "Elementele selectate:",
                totalItems: "Total elemente:",
                size: "Marime pagina:",
                first: "Prima pagina",
                next: "Pagina urmatoare",
                previous: "Pagina anterioara",
                last: "Ultima pagina"
            },
            menu: {
                text: "Alege coloane:"
            },
            sort: {
                ascending: "Ordoneaza crescator",
                descending: "Ordoneaza descrescator",
                none: "Fara ordonare",
                remove: "Sterge ordonarea"
            },
            column: {
                hide: "Ascunde coloana"
            },
            aggregation: {
                count: "total linii: ",
                sum: "total: ",
                avg: "medie: ",
                min: "min: ",
                max: "max: "
            },
            pinning: {
                pinLeft: "Pin la stanga",
                pinRight: "Pin la dreapta",
                unpin: "Sterge pinul"
            },
            columnMenu: {
                close: "Inchide"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Grid Menu"
                },
                columns: "Coloane:",
                importerTitle: "Incarca fisier",
                exporterAllAsCsv: "Exporta toate datele ca csv",
                exporterVisibleAsCsv: "Exporta datele vizibile ca csv",
                exporterSelectedAsCsv: "Exporta datele selectate ca csv",
                exporterAllAsPdf: "Exporta toate datele ca pdf",
                exporterVisibleAsPdf: "Exporta datele vizibile ca pdf",
                exporterSelectedAsPdf: "Exporta datele selectate ca csv pdf",
                clearAllFilters: "Sterge toate filtrele"
            },
            importer: {
                noHeaders: "Numele coloanelor nu a putut fi incarcat, acest fisier are un header?",
                noObjects: "Datele nu au putut fi incarcate, exista date in fisier in afara numelor de coloane?",
                invalidCsv: "Fisierul nu a putut fi procesat, ati incarcat un CSV valid ?",
                invalidJson: "Fisierul nu a putut fi procesat, ati incarcat un Json valid?",
                jsonNotArray: "Json-ul incarcat trebuie sa contina un array, inchidere."
            },
            pagination: {
                aria: {
                    pageToFirst: "Prima pagina",
                    pageBack: "O pagina inapoi",
                    pageSelected: "Pagina selectata",
                    pageForward: "O pagina inainte",
                    pageToLast: "Ultima pagina"
                },
                sizes: "Elemente per pagina",
                totalItems: "elemente",
                through: "prin",
                of: "of"
            },
            grouping: {
                group: "Grupeaza",
                ungroup: "Opreste gruparea",
                aggregate_count: "Agg: Count",
                aggregate_sum: "Agg: Sum",
                aggregate_max: "Agg: Max",
                aggregate_min: "Agg: Min",
                aggregate_avg: "Agg: Avg",
                aggregate_remove: "Agg: Remove"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("ru", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Фильтр столбца",
                    removeFilter: "Удалить фильтр",
                    columnMenuButtonLabel: "Меню столбца"
                },
                priority: "Приоритет:",
                filterLabel: "Фильтр столбца: "
            },
            aggregate: {
                label: "элементы"
            },
            groupPanel: {
                description: "Для группировки по столбцу перетащите сюда его название."
            },
            search: {
                placeholder: "Поиск...",
                showingItems: "Показать элементы:",
                selectedItems: "Выбранные элементы:",
                totalItems: "Всего элементов:",
                size: "Размер страницы:",
                first: "Первая страница",
                next: "Следующая страница",
                previous: "Предыдущая страница",
                last: "Последняя страница"
            },
            menu: {
                text: "Выбрать столбцы:"
            },
            sort: {
                ascending: "По возрастанию",
                descending: "По убыванию",
                none: "Без сортировки",
                remove: "Убрать сортировку"
            },
            column: {
                hide: "Спрятать столбец"
            },
            aggregation: {
                count: "всего строк: ",
                sum: "итого: ",
                avg: "среднее: ",
                min: "мин: ",
                max: "макс: "
            },
            pinning: {
                pinLeft: "Закрепить слева",
                pinRight: "Закрепить справа",
                unpin: "Открепить"
            },
            columnMenu: {
                close: "Закрыть"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Меню"
                },
                columns: "Столбцы:",
                importerTitle: "Импортировать файл",
                exporterAllAsCsv: "Экспортировать всё в CSV",
                exporterVisibleAsCsv: "Экспортировать видимые данные в CSV",
                exporterSelectedAsCsv: "Экспортировать выбранные данные в CSV",
                exporterAllAsPdf: "Экспортировать всё в PDF",
                exporterVisibleAsPdf: "Экспортировать видимые данные в PDF",
                exporterSelectedAsPdf: "Экспортировать выбранные данные в PDF",
                clearAllFilters: "Очистите все фильтры"
            },
            importer: {
                noHeaders: "Не удалось получить названия столбцов, есть ли в файле заголовок?",
                noObjects: "Не удалось получить данные, есть ли в файле строки кроме заголовка?",
                invalidCsv: "Не удалось обработать файл, это правильный CSV-файл?",
                invalidJson: "Не удалось обработать файл, это правильный JSON?",
                jsonNotArray: "Импортируемый JSON-файл должен содержать массив, операция отменена."
            },
            pagination: {
                aria: {
                    pageToFirst: "Первая страница",
                    pageBack: "Предыдущая страница",
                    pageSelected: "Выбранная страница",
                    pageForward: "Следующая страница",
                    pageToLast: "Последняя страница"
                },
                sizes: "строк на страницу",
                totalItems: "строк",
                through: "по",
                of: "из"
            },
            grouping: {
                group: "Группировать",
                ungroup: "Разгруппировать",
                aggregate_count: "Группировать: Count",
                aggregate_sum: "Для группы: Сумма",
                aggregate_max: "Для группы: Максимум",
                aggregate_min: "Для группы: Минимум",
                aggregate_avg: "Для группы: Среднее",
                aggregate_remove: "Для группы: Пусто"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("sk", {
            aggregate: {
                label: "items"
            },
            groupPanel: {
                description: "Pretiahni sem názov stĺpca pre zoskupenie podľa toho stĺpca."
            },
            search: {
                placeholder: "Hľadaj...",
                showingItems: "Zobrazujem položky:",
                selectedItems: "Vybraté položky:",
                totalItems: "Počet položiek:",
                size: "Počet:",
                first: "Prvá strana",
                next: "Ďalšia strana",
                previous: "Predchádzajúca strana",
                last: "Posledná strana"
            },
            menu: {
                text: "Vyberte stĺpce:"
            },
            sort: {
                ascending: "Zotriediť vzostupne",
                descending: "Zotriediť zostupne",
                remove: "Vymazať triedenie"
            },
            aggregation: {
                count: "total rows: ",
                sum: "total: ",
                avg: "avg: ",
                min: "min: ",
                max: "max: "
            },
            gridMenu: {
                columns: "Columns:",
                importerTitle: "Import file",
                exporterAllAsCsv: "Export all data as csv",
                exporterVisibleAsCsv: "Export visible data as csv",
                exporterSelectedAsCsv: "Export selected data as csv",
                exporterAllAsPdf: "Export all data as pdf",
                exporterVisibleAsPdf: "Export visible data as pdf",
                exporterSelectedAsPdf: "Export selected data as pdf",
                exporterAllAsExcel: "Export all data as excel",
                exporterVisibleAsExcel: "Export visible data as excel",
                exporterSelectedAsExcel: "Export selected data as excel",
                clearAllFilters: "Clear all filters"
            },
            importer: {
                noHeaders: "Column names were unable to be derived, does the file have a header?",
                noObjects: "Objects were not able to be derived, was there data in the file other than headers?",
                invalidCsv: "File was unable to be processed, is it valid CSV?",
                invalidJson: "File was unable to be processed, is it valid Json?",
                jsonNotArray: "Imported json file must contain an array, aborting."
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("sv", {
            aggregate: {
                label: "Artiklar"
            },
            groupPanel: {
                description: "Dra en kolumnrubrik hit och släpp den för att gruppera efter den kolumnen."
            },
            search: {
                placeholder: "Sök...",
                showingItems: "Visar artiklar:",
                selectedItems: "Valda artiklar:",
                totalItems: "Antal artiklar:",
                size: "Sidstorlek:",
                first: "Första sidan",
                next: "Nästa sida",
                previous: "Föregående sida",
                last: "Sista sidan"
            },
            menu: {
                text: "Välj kolumner:"
            },
            sort: {
                ascending: "Sortera stigande",
                descending: "Sortera fallande",
                remove: "Inaktivera sortering"
            },
            column: {
                hide: "Göm kolumn"
            },
            aggregation: {
                count: "Antal rader: ",
                sum: "Summa: ",
                avg: "Genomsnitt: ",
                min: "Min: ",
                max: "Max: "
            },
            pinning: {
                pinLeft: "Fäst vänster",
                pinRight: "Fäst höger",
                unpin: "Lösgör"
            },
            gridMenu: {
                columns: "Kolumner:",
                importerTitle: "Importera fil",
                exporterAllAsCsv: "Exportera all data som CSV",
                exporterVisibleAsCsv: "Exportera synlig data som CSV",
                exporterSelectedAsCsv: "Exportera markerad data som CSV",
                exporterAllAsPdf: "Exportera all data som PDF",
                exporterVisibleAsPdf: "Exportera synlig data som PDF",
                exporterSelectedAsPdf: "Exportera markerad data som PDF",
                clearAllFilters: "Rengör alla filter"
            },
            importer: {
                noHeaders: "Kolumnnamn kunde inte härledas. Har filen ett sidhuvud?",
                noObjects: "Objekt kunde inte härledas. Har filen data undantaget sidhuvud?",
                invalidCsv: "Filen kunde inte behandlas, är den en giltig CSV?",
                invalidJson: "Filen kunde inte behandlas, är den en giltig JSON?",
                jsonNotArray: "Importerad JSON-fil måste innehålla ett fält. Import avbruten."
            },
            pagination: {
                sizes: "Artiklar per sida",
                totalItems: "Artiklar"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("ta", {
            aggregate: {
                label: "உருப்படிகள்"
            },
            groupPanel: {
                description: "ஒரு பத்தியை குழுவாக அமைக்க அப்பத்தியின் தலைப்பை இங்கே  இழுத்து வரவும் "
            },
            search: {
                placeholder: "தேடல் ...",
                showingItems: "உருப்படிகளை காண்பித்தல்:",
                selectedItems: "தேர்ந்தெடுக்கப்பட்ட  உருப்படிகள்:",
                totalItems: "மொத்த உருப்படிகள்:",
                size: "பக்க அளவு: ",
                first: "முதல் பக்கம்",
                next: "அடுத்த பக்கம்",
                previous: "முந்தைய பக்கம் ",
                last: "இறுதி பக்கம்"
            },
            menu: {
                text: "பத்திகளை தேர்ந்தெடு:"
            },
            sort: {
                ascending: "மேலிருந்து கீழாக",
                descending: "கீழிருந்து மேலாக",
                remove: "வரிசையை நீக்கு"
            },
            column: {
                hide: "பத்தியை மறைத்து வை "
            },
            aggregation: {
                count: "மொத்த வரிகள்:",
                sum: "மொத்தம்: ",
                avg: "சராசரி: ",
                min: "குறைந்தபட்ச: ",
                max: "அதிகபட்ச: "
            },
            pinning: {
                pinLeft: "இடதுபுறமாக தைக்க ",
                pinRight: "வலதுபுறமாக தைக்க",
                unpin: "பிரி"
            },
            gridMenu: {
                columns: "பத்திகள்:",
                importerTitle: "கோப்பு : படித்தல்",
                exporterAllAsCsv: "எல்லா தரவுகளையும் கோப்பாக்கு: csv",
                exporterVisibleAsCsv: "இருக்கும் தரவுகளை கோப்பாக்கு: csv",
                exporterSelectedAsCsv: "தேர்ந்தெடுத்த தரவுகளை கோப்பாக்கு: csv",
                exporterAllAsPdf: "எல்லா தரவுகளையும் கோப்பாக்கு: pdf",
                exporterVisibleAsPdf: "இருக்கும் தரவுகளை கோப்பாக்கு: pdf",
                exporterSelectedAsPdf: "தேர்ந்தெடுத்த தரவுகளை கோப்பாக்கு: pdf",
                clearAllFilters: "Clear all filters"
            },
            importer: {
                noHeaders: "பத்தியின் தலைப்புகளை பெற இயலவில்லை, கோப்பிற்கு தலைப்பு உள்ளதா?",
                noObjects: "இலக்குகளை உருவாக்க முடியவில்லை, கோப்பில் தலைப்புகளை தவிர தரவு ஏதேனும் உள்ளதா? ",
                invalidCsv: "சரிவர நடைமுறை படுத்த இயலவில்லை, கோப்பு சரிதானா? - csv",
                invalidJson: "சரிவர நடைமுறை படுத்த இயலவில்லை, கோப்பு சரிதானா? - json",
                jsonNotArray: "படித்த கோப்பில் வரிசைகள் உள்ளது, நடைமுறை ரத்து செய் : json"
            },
            pagination: {
                sizes: "உருப்படிகள் / பக்கம்",
                totalItems: "உருப்படிகள் "
            },
            grouping: {
                group: "குழு",
                ungroup: "பிரி",
                aggregate_count: "மதிப்பீட்டு : எண்ணு",
                aggregate_sum: "மதிப்பீட்டு : கூட்டல்",
                aggregate_max: "மதிப்பீட்டு : அதிகபட்சம்",
                aggregate_min: "மதிப்பீட்டு : குறைந்தபட்சம்",
                aggregate_avg: "மதிப்பீட்டு : சராசரி",
                aggregate_remove: "மதிப்பீட்டு : நீக்கு"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("tr", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Sütun için filtre",
                    removeFilter: "Filtreyi Kaldır",
                    columnMenuButtonLabel: "Sütun Menüsü"
                },
                priority: "Öncelik:",
                filterLabel: "Sütun için filtre: "
            },
            aggregate: {
                label: "kayıtlar"
            },
            groupPanel: {
                description: "Sütuna göre gruplamak için sütun başlığını buraya sürükleyin ve bırakın."
            },
            search: {
                placeholder: "Arama...",
                showingItems: "Gösterilen Kayıt:",
                selectedItems: "Seçili Kayıt:",
                totalItems: "Toplam Kayıt:",
                size: "Sayfa Boyutu:",
                first: "İlk Sayfa",
                next: "Sonraki Sayfa",
                previous: "Önceki Sayfa",
                last: "Son Sayfa"
            },
            menu: {
                text: "Sütunları Seç:"
            },
            sort: {
                ascending: "Artan Sırada Sırala",
                descending: "Azalan Sırada Sırala",
                none: "Sıralama Yapma",
                remove: "Sıralamayı Kaldır"
            },
            column: {
                hide: "Sütunu Gizle"
            },
            aggregation: {
                count: "toplam satır: ",
                sum: "toplam: ",
                avg: "ort: ",
                min: "min: ",
                max: "maks: "
            },
            pinning: {
                pinLeft: "Sola Sabitle",
                pinRight: "Sağa Sabitle",
                unpin: "Sabitlemeyi Kaldır"
            },
            columnMenu: {
                close: "Kapat"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Tablo Menü"
                },
                columns: "Sütunlar:",
                importerTitle: "Dosya içeri aktar",
                exporterAllAsCsv: "Bütün veriyi CSV olarak dışarı aktar",
                exporterVisibleAsCsv: "Görünen veriyi CSV olarak dışarı aktar",
                exporterSelectedAsCsv: "Seçili veriyi CSV olarak dışarı aktar",
                exporterAllAsPdf: "Bütün veriyi PDF olarak dışarı aktar",
                exporterVisibleAsPdf: "Görünen veriyi PDF olarak dışarı aktar",
                exporterSelectedAsPdf: "Seçili veriyi PDF olarak dışarı aktar",
                clearAllFilters: "Bütün filtreleri kaldır"
            },
            importer: {
                noHeaders: "Sütun isimleri üretilemiyor, dosyanın bir başlığı var mı?",
                noObjects: "Nesneler üretilemiyor, dosyada başlıktan başka bir veri var mı?",
                invalidCsv: "Dosya işlenemedi, geçerli bir CSV dosyası mı?",
                invalidJson: "Dosya işlenemedi, geçerli bir Json dosyası mı?",
                jsonNotArray: "Alınan Json dosyasında bir dizi bulunmalıdır, işlem iptal ediliyor."
            },
            pagination: {
                aria: {
                    pageToFirst: "İlk sayfaya",
                    pageBack: "Geri git",
                    pageSelected: "Seçili sayfa",
                    pageForward: "İleri git",
                    pageToLast: "Sona git"
                },
                sizes: "Sayfadaki nesne sayısı",
                totalItems: "kayıtlar",
                through: "",
                of: ""
            },
            grouping: {
                group: "Grupla",
                ungroup: "Gruplama",
                aggregate_count: "Yekun: Sayı",
                aggregate_sum: "Yekun: Toplam",
                aggregate_max: "Yekun: Maks",
                aggregate_min: "Yekun: Min",
                aggregate_avg: "Yekun: Ort",
                aggregate_remove: "Yekun: Sil"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("ua", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "Фільтр стовпчика",
                    removeFilter: "Видалити фільтр",
                    columnMenuButtonLabel: "Меню ствпчика"
                },
                priority: "Пріоритет:",
                filterLabel: "Фільтр стовпчика: "
            },
            aggregate: {
                label: "елементи"
            },
            groupPanel: {
                description: "Для групування за стовпчиком перетягніть сюди його назву."
            },
            search: {
                placeholder: "Пошук...",
                showingItems: "Показати елементи:",
                selectedItems: "Обрані елементи:",
                totalItems: "Усього елементів:",
                size: "Розмір сторінки:",
                first: "Перша сторінка",
                next: "Наступна сторінка",
                previous: "Попередня сторінка",
                last: "Остання сторінка"
            },
            menu: {
                text: "Обрати ствпчики:"
            },
            sort: {
                ascending: "За зростанням",
                descending: "За спаданням",
                none: "Без сортування",
                remove: "Прибрати сортування"
            },
            column: {
                hide: "Приховати стовпчик"
            },
            aggregation: {
                count: "усього рядків: ",
                sum: "ітого: ",
                avg: "середнє: ",
                min: "мін: ",
                max: "макс: "
            },
            pinning: {
                pinLeft: "Закріпити ліворуч",
                pinRight: "Закріпити праворуч",
                unpin: "Відкріпити"
            },
            columnMenu: {
                close: "Закрити"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "Меню"
                },
                columns: "Стовпчики:",
                importerTitle: "Імпортувати файл",
                exporterAllAsCsv: "Експортувати все в CSV",
                exporterVisibleAsCsv: "Експортувати видимі дані в CSV",
                exporterSelectedAsCsv: "Експортувати обрані дані в CSV",
                exporterAllAsPdf: "Експортувати все в PDF",
                exporterVisibleAsPdf: "Експортувати видимі дані в PDF",
                exporterSelectedAsPdf: "Експортувати обрані дані в PDF",
                clearAllFilters: "Очистити всі фільтри"
            },
            importer: {
                noHeaders: "Не вдалося отримати назви стовпчиків, чи є в файлі заголовок?",
                noObjects: "Не вдалося отримати дані, чи є в файлі рядки окрім заголовка?",
                invalidCsv: "Не вдалося обробити файл, чи це коректний CSV-файл?",
                invalidJson: "Не вдалося обробити файл, чи це коректний JSON?",
                jsonNotArray: "JSON-файл що імпортується повинен містити масив, операцію скасовано."
            },
            pagination: {
                aria: {
                    pageToFirst: "Перша сторінка",
                    pageBack: "Попередня сторінка",
                    pageSelected: "Обрана сторінка",
                    pageForward: "Наступна сторінка",
                    pageToLast: "Остання сторінка"
                },
                sizes: "рядків на сторінку",
                totalItems: "рядків",
                through: "по",
                of: "з"
            },
            grouping: {
                group: "Групувати",
                ungroup: "Розгрупувати",
                aggregate_count: "Групувати: Кількість",
                aggregate_sum: "Для групи: Сума",
                aggregate_max: "Для групи: Максимум",
                aggregate_min: "Для групи: Мінімум",
                aggregate_avg: "Для групи: Серднє",
                aggregate_remove: "Для групи: Пусто"
            }
        }), $delegate;
    } ]);
} ]), function() {
    var DIRECTIVE_ALIASES = [ "uiT", "uiTranslate" ], module = angular.module("ui.grid.i18n");
    module.constant("i18nConstants", {
        MISSING: "[MISSING]",
        UPDATE_EVENT: "$uiI18n",
        LOCALE_DIRECTIVE_ALIAS: "uiI18n",
        DEFAULT_LANG: "en"
    }), module.service("i18nService", [ "$log", "i18nConstants", "$rootScope", function($log, i18nConstants, $rootScope) {
        var langCache = {
            _langs: {},
            current: null,
            get: function(lang) {
                return this._langs[lang.toLowerCase()];
            },
            add: function(lang, strings) {
                var lower = lang.toLowerCase();
                this._langs[lower] || (this._langs[lower] = {}), angular.merge(this._langs[lower], strings);
            },
            getAllLangs: function() {
                var langs = [];
                if (!this._langs) return langs;
                for (var key in this._langs) langs.push(key);
                return langs;
            },
            setCurrent: function(lang) {
                this.current = lang.toLowerCase();
            },
            getCurrentLang: function() {
                return this.current;
            }
        }, service = {
            add: function(langs, stringMaps) {
                "object" == typeof langs ? angular.forEach(langs, function(lang) {
                    lang && langCache.add(lang, stringMaps);
                }) : langCache.add(langs, stringMaps);
            },
            getAllLangs: function() {
                return langCache.getAllLangs();
            },
            get: function(lang) {
                var language = lang || service.getCurrentLang();
                return langCache.get(language);
            },
            getSafeText: function(path, lang) {
                var language = lang || service.getCurrentLang(), trans = langCache.get(language);
                if (!trans) return i18nConstants.MISSING;
                for (var paths = path.split("."), current = trans, i = 0; i < paths.length; ++i) {
                    if (void 0 === current[paths[i]] || null === current[paths[i]]) return i18nConstants.MISSING;
                    current = current[paths[i]];
                }
                return current;
            },
            setCurrentLang: function(lang) {
                lang && (langCache.setCurrent(lang), $rootScope.$broadcast(i18nConstants.UPDATE_EVENT));
            },
            getCurrentLang: function() {
                var lang = langCache.getCurrentLang();
                return lang || (lang = i18nConstants.DEFAULT_LANG, langCache.setCurrent(lang)), 
                lang;
            }
        };
        return service;
    } ]);
    module.directive("uiI18n", [ "i18nService", "i18nConstants", function(i18nService, i18nConstants) {
        return {
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs) {
                        var alias = i18nConstants.LOCALE_DIRECTIVE_ALIAS, lang = $scope.$eval($attrs[alias]);
                        lang ? $scope.$watch($attrs[alias], function() {
                            i18nService.setCurrentLang(lang);
                        }) : $attrs.$$observers && $attrs.$observe(alias, function() {
                            i18nService.setCurrentLang($attrs[alias] || i18nConstants.DEFAULT_LANG);
                        });
                    }
                };
            }
        };
    } ]);
    var uitDirective = function($parse, i18nService, i18nConstants) {
        return {
            restrict: "EA",
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs) {
                        var observer, alias1 = DIRECTIVE_ALIASES[0], alias2 = DIRECTIVE_ALIASES[1], token = $attrs[alias1] || $attrs[alias2] || $elm.html(), missing = i18nConstants.MISSING + token;
                        if ($attrs.$$observers) {
                            var prop = $attrs[alias1] ? alias1 : alias2;
                            observer = $attrs.$observe(prop, function(result) {
                                result && $elm.html($parse(result)(i18nService.getCurrentLang()) || missing);
                            });
                        }
                        var getter = $parse(token), listener = $scope.$on(i18nConstants.UPDATE_EVENT, function(evt) {
                            observer ? observer($attrs[alias1] || $attrs[alias2]) : $elm.html(getter(i18nService.get()) || missing);
                        });
                        $scope.$on("$destroy", listener), $elm.html(getter(i18nService.get()) || missing);
                    }
                };
            }
        };
    };
    angular.forEach(DIRECTIVE_ALIASES, function(alias) {
        module.directive(alias, [ "$parse", "i18nService", "i18nConstants", uitDirective ]);
    });
    var uitFilter = function($parse, i18nService, i18nConstants) {
        return function(data) {
            return $parse(data)(i18nService.get()) || i18nConstants.MISSING + data;
        };
    };
    angular.forEach([ "t", "uiTranslate" ], function(alias) {
        module.filter(alias, [ "$parse", "i18nService", "i18nConstants", uitFilter ]);
    });
}(), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("zh-cn", {
            headerCell: {
                aria: {
                    defaultFilterLabel: "列过滤器",
                    removeFilter: "移除过滤器",
                    columnMenuButtonLabel: "列菜单"
                },
                priority: "优先级:",
                filterLabel: "列过滤器: "
            },
            aggregate: {
                label: "行"
            },
            groupPanel: {
                description: "拖曳表头到此处进行分组"
            },
            search: {
                placeholder: "查找",
                showingItems: "已显示行数：",
                selectedItems: "已选择行数：",
                totalItems: "总行数：",
                size: "每页显示行数：",
                first: "首页",
                next: "下一页",
                previous: "上一页",
                last: "末页"
            },
            menu: {
                text: "选择列："
            },
            sort: {
                ascending: "升序",
                descending: "降序",
                none: "无序",
                remove: "取消排序"
            },
            column: {
                hide: "隐藏列"
            },
            aggregation: {
                count: "计数：",
                sum: "求和：",
                avg: "均值：",
                min: "最小值：",
                max: "最大值："
            },
            pinning: {
                pinLeft: "左侧固定",
                pinRight: "右侧固定",
                unpin: "取消固定"
            },
            columnMenu: {
                close: "关闭"
            },
            gridMenu: {
                aria: {
                    buttonLabel: "表格菜单"
                },
                columns: "列：",
                importerTitle: "导入文件",
                exporterAllAsCsv: "导出全部数据到CSV",
                exporterVisibleAsCsv: "导出可见数据到CSV",
                exporterSelectedAsCsv: "导出已选数据到CSV",
                exporterAllAsPdf: "导出全部数据到PDF",
                exporterVisibleAsPdf: "导出可见数据到PDF",
                exporterSelectedAsPdf: "导出已选数据到PDF",
                clearAllFilters: "清除所有过滤器"
            },
            importer: {
                noHeaders: "无法获取列名，确定文件包含表头？",
                noObjects: "无法获取数据，确定文件包含数据？",
                invalidCsv: "无法处理文件，确定是合法的CSV文件？",
                invalidJson: "无法处理文件，确定是合法的JSON文件？",
                jsonNotArray: "导入的文件不是JSON数组！"
            },
            pagination: {
                aria: {
                    pageToFirst: "第一页",
                    pageBack: "上一页",
                    pageSelected: "当前页",
                    pageForward: "下一页",
                    pageToLast: "最后一页"
                },
                sizes: "行每页",
                totalItems: "行",
                through: "至",
                of: "共"
            },
            grouping: {
                group: "分组",
                ungroup: "取消分组",
                aggregate_count: "合计: 计数",
                aggregate_sum: "合计: 求和",
                aggregate_max: "合计: 最大",
                aggregate_min: "合计: 最小",
                aggregate_avg: "合计: 平均",
                aggregate_remove: "合计: 移除"
            }
        }), $delegate;
    } ]);
} ]), angular.module("ui.grid").config([ "$provide", function($provide) {
    $provide.decorator("i18nService", [ "$delegate", function($delegate) {
        return $delegate.add("zh-tw", {
            aggregate: {
                label: "行"
            },
            groupPanel: {
                description: "拖曳表頭到此處進行分組"
            },
            search: {
                placeholder: "查找",
                showingItems: "已顯示行數：",
                selectedItems: "已選擇行數：",
                totalItems: "總行數：",
                size: "每頁顯示行數：",
                first: "首頁",
                next: "下壹頁",
                previous: "上壹頁",
                last: "末頁"
            },
            menu: {
                text: "選擇列："
            },
            sort: {
                ascending: "升序",
                descending: "降序",
                remove: "取消排序"
            },
            column: {
                hide: "隱藏列"
            },
            aggregation: {
                count: "計數：",
                sum: "求和：",
                avg: "均值：",
                min: "最小值：",
                max: "最大值："
            },
            pinning: {
                pinLeft: "左側固定",
                pinRight: "右側固定",
                unpin: "取消固定"
            },
            gridMenu: {
                columns: "列：",
                importerTitle: "導入文件",
                exporterAllAsCsv: "導出全部數據到CSV",
                exporterVisibleAsCsv: "導出可見數據到CSV",
                exporterSelectedAsCsv: "導出已選數據到CSV",
                exporterAllAsPdf: "導出全部數據到PDF",
                exporterVisibleAsPdf: "導出可見數據到PDF",
                exporterSelectedAsPdf: "導出已選數據到PDF",
                clearAllFilters: "清除所有过滤器"
            },
            importer: {
                noHeaders: "無法獲取列名，確定文件包含表頭？",
                noObjects: "無法獲取數據，確定文件包含數據？",
                invalidCsv: "無法處理文件，確定是合法的CSV文件？",
                invalidJson: "無法處理文件，確定是合法的JSON文件？",
                jsonNotArray: "導入的文件不是JSON數組！"
            },
            pagination: {
                sizes: "行每頁",
                totalItems: "行"
            }
        }), $delegate;
    } ]);
} ]), function() {
    "use strict";
    angular.module("ui.grid.autoResize", [ "ui.grid" ]).directive("uiGridAutoResize", [ "gridUtil", function(gridUtil) {
        return {
            require: "uiGrid",
            scope: !1,
            link: function($scope, $elm, $attrs, uiGridCtrl) {
                var elementWidth, elementHeight, updateWidth = gridUtil.throttle(function() {
                    elementWidth = gridUtil.elementWidth($elm);
                }, 200), updateHeight = gridUtil.throttle(function() {
                    elementHeight = gridUtil.elementHeight($elm);
                }, 200), refresh = gridUtil.throttle(function(width, height) {
                    uiGridCtrl.grid.gridWidth = width, uiGridCtrl.grid.gridHeight = height, uiGridCtrl.grid.refresh();
                }, 300);
                $scope.$watchGroup([ function() {
                    return updateWidth(), elementWidth;
                }, function() {
                    return updateHeight(), elementHeight;
                } ], function(newValues, oldValues, scope) {
                    angular.equals(newValues, oldValues) || refresh(newValues[0], newValues[1]);
                });
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.cellNav", [ "ui.grid" ]);
    module.constant("uiGridCellNavConstants", {
        FEATURE_NAME: "gridCellNav",
        CELL_NAV_EVENT: "cellNav",
        direction: {
            LEFT: 0,
            RIGHT: 1,
            UP: 2,
            DOWN: 3,
            PG_UP: 4,
            PG_DOWN: 5
        },
        EVENT_TYPE: {
            KEYDOWN: 0,
            CLICK: 1,
            CLEAR: 2
        }
    }), module.factory("uiGridCellNavFactory", [ "gridUtil", "uiGridConstants", "uiGridCellNavConstants", "GridRowColumn", "$q", function(gridUtil, uiGridConstants, uiGridCellNavConstants, GridRowColumn, $q) {
        var UiGridCellNav = function(rowContainer, colContainer, leftColContainer, rightColContainer) {
            this.rows = rowContainer.visibleRowCache, this.columns = colContainer.visibleColumnCache, 
            this.leftColumns = leftColContainer ? leftColContainer.visibleColumnCache : [], 
            this.rightColumns = rightColContainer ? rightColContainer.visibleColumnCache : [], 
            this.bodyContainer = rowContainer;
        };
        return UiGridCellNav.prototype.getFocusableCols = function() {
            return this.leftColumns.concat(this.columns, this.rightColumns).filter(function(col) {
                return col.colDef.allowCellFocus;
            });
        }, UiGridCellNav.prototype.getFocusableRows = function() {
            return this.rows.filter(function(row) {
                return !1 !== row.allowCellFocus;
            });
        }, UiGridCellNav.prototype.getNextRowCol = function(direction, curRow, curCol) {
            switch (direction) {
              case uiGridCellNavConstants.direction.LEFT:
                return this.getRowColLeft(curRow, curCol);

              case uiGridCellNavConstants.direction.RIGHT:
                return this.getRowColRight(curRow, curCol);

              case uiGridCellNavConstants.direction.UP:
                return this.getRowColUp(curRow, curCol);

              case uiGridCellNavConstants.direction.DOWN:
                return this.getRowColDown(curRow, curCol);

              case uiGridCellNavConstants.direction.PG_UP:
                return this.getRowColPageUp(curRow, curCol);

              case uiGridCellNavConstants.direction.PG_DOWN:
                return this.getRowColPageDown(curRow, curCol);
            }
        }, UiGridCellNav.prototype.initializeSelection = function() {
            var focusableCols = this.getFocusableCols(), focusableRows = this.getFocusableRows();
            if (0 === focusableCols.length || 0 === focusableRows.length) return null;
            return new GridRowColumn(focusableRows[0], focusableCols[0]);
        }, UiGridCellNav.prototype.getRowColLeft = function(curRow, curCol) {
            var focusableCols = this.getFocusableCols(), focusableRows = this.getFocusableRows(), curColIndex = focusableCols.indexOf(curCol), curRowIndex = focusableRows.indexOf(curRow);
            -1 === curColIndex && (curColIndex = 1);
            var nextColIndex = 0 === curColIndex ? focusableCols.length - 1 : curColIndex - 1;
            return new GridRowColumn(curColIndex <= nextColIndex ? 0 === curRowIndex ? curRow : focusableRows[curRowIndex - 1] : curRow, focusableCols[nextColIndex]);
        }, UiGridCellNav.prototype.getRowColRight = function(curRow, curCol) {
            var focusableCols = this.getFocusableCols(), focusableRows = this.getFocusableRows(), curColIndex = focusableCols.indexOf(curCol), curRowIndex = focusableRows.indexOf(curRow);
            -1 === curColIndex && (curColIndex = 0);
            var nextColIndex = curColIndex === focusableCols.length - 1 ? 0 : curColIndex + 1;
            return nextColIndex <= curColIndex ? curRowIndex === focusableRows.length - 1 ? new GridRowColumn(curRow, focusableCols[nextColIndex]) : new GridRowColumn(focusableRows[curRowIndex + 1], focusableCols[nextColIndex]) : new GridRowColumn(curRow, focusableCols[nextColIndex]);
        }, UiGridCellNav.prototype.getRowColDown = function(curRow, curCol) {
            var focusableCols = this.getFocusableCols(), focusableRows = this.getFocusableRows(), curColIndex = focusableCols.indexOf(curCol), curRowIndex = focusableRows.indexOf(curRow);
            return -1 === curColIndex && (curColIndex = 0), curRowIndex === focusableRows.length - 1 ? new GridRowColumn(curRow, focusableCols[curColIndex]) : new GridRowColumn(focusableRows[curRowIndex + 1], focusableCols[curColIndex]);
        }, UiGridCellNav.prototype.getRowColPageDown = function(curRow, curCol) {
            var focusableCols = this.getFocusableCols(), focusableRows = this.getFocusableRows(), curColIndex = focusableCols.indexOf(curCol), curRowIndex = focusableRows.indexOf(curRow);
            -1 === curColIndex && (curColIndex = 0);
            var pageSize = this.bodyContainer.minRowsToRender();
            return curRowIndex >= focusableRows.length - pageSize ? new GridRowColumn(focusableRows[focusableRows.length - 1], focusableCols[curColIndex]) : new GridRowColumn(focusableRows[curRowIndex + pageSize], focusableCols[curColIndex]);
        }, UiGridCellNav.prototype.getRowColUp = function(curRow, curCol) {
            var focusableCols = this.getFocusableCols(), focusableRows = this.getFocusableRows(), curColIndex = focusableCols.indexOf(curCol), curRowIndex = focusableRows.indexOf(curRow);
            return -1 === curColIndex && (curColIndex = 0), new GridRowColumn(0 === curRowIndex ? curRow : focusableRows[curRowIndex - 1], focusableCols[curColIndex]);
        }, UiGridCellNav.prototype.getRowColPageUp = function(curRow, curCol) {
            var focusableCols = this.getFocusableCols(), focusableRows = this.getFocusableRows(), curColIndex = focusableCols.indexOf(curCol), curRowIndex = focusableRows.indexOf(curRow);
            -1 === curColIndex && (curColIndex = 0);
            var pageSize = this.bodyContainer.minRowsToRender();
            return new GridRowColumn(curRowIndex - pageSize < 0 ? focusableRows[0] : focusableRows[curRowIndex - pageSize], focusableCols[curColIndex]);
        }, UiGridCellNav;
    } ]), module.service("uiGridCellNavService", [ "gridUtil", "uiGridConstants", "uiGridCellNavConstants", "$q", "uiGridCellNavFactory", "GridRowColumn", "ScrollEvent", function(gridUtil, uiGridConstants, uiGridCellNavConstants, $q, UiGridCellNav, GridRowColumn, ScrollEvent) {
        var service = {
            initializeGrid: function(grid) {
                grid.registerColumnBuilder(service.cellNavColumnBuilder), grid.cellNav = {}, grid.cellNav.lastRowCol = null, 
                grid.cellNav.focusedCells = [], service.defaultGridOptions(grid.options);
                var publicApi = {
                    events: {
                        cellNav: {
                            navigate: function(newRowCol, oldRowCol) {},
                            viewPortKeyDown: function(event, rowCol) {},
                            viewPortKeyPress: function(event, rowCol) {}
                        }
                    },
                    methods: {
                        cellNav: {
                            scrollToFocus: function(rowEntity, colDef) {
                                return service.scrollToFocus(grid, rowEntity, colDef);
                            },
                            getFocusedCell: function() {
                                return grid.cellNav.lastRowCol;
                            },
                            getCurrentSelection: function() {
                                return grid.cellNav.focusedCells;
                            },
                            rowColSelectIndex: function(rowCol) {
                                for (var index = -1, i = 0; i < grid.cellNav.focusedCells.length; i++) if (grid.cellNav.focusedCells[i].col.uid === rowCol.col.uid && grid.cellNav.focusedCells[i].row.uid === rowCol.row.uid) {
                                    index = i;
                                    break;
                                }
                                return index;
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods);
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.modifierKeysToMultiSelectCells = !0 === gridOptions.modifierKeysToMultiSelectCells, 
                gridOptions.keyDownOverrides = gridOptions.keyDownOverrides || [];
            },
            decorateRenderContainers: function(grid) {
                var rightContainer = grid.hasRightContainer() ? grid.renderContainers.right : null, leftContainer = grid.hasLeftContainer() ? grid.renderContainers.left : null;
                null !== leftContainer && (grid.renderContainers.left.cellNav = new UiGridCellNav(grid.renderContainers.body, leftContainer, rightContainer, grid.renderContainers.body)), 
                null !== rightContainer && (grid.renderContainers.right.cellNav = new UiGridCellNav(grid.renderContainers.body, rightContainer, grid.renderContainers.body, leftContainer)), 
                grid.renderContainers.body.cellNav = new UiGridCellNav(grid.renderContainers.body, grid.renderContainers.body, leftContainer, rightContainer);
            },
            getDirection: function(evt) {
                return evt.keyCode === uiGridConstants.keymap.LEFT || evt.keyCode === uiGridConstants.keymap.TAB && evt.shiftKey ? uiGridCellNavConstants.direction.LEFT : evt.keyCode === uiGridConstants.keymap.RIGHT || evt.keyCode === uiGridConstants.keymap.TAB ? uiGridCellNavConstants.direction.RIGHT : evt.keyCode === uiGridConstants.keymap.UP || evt.keyCode === uiGridConstants.keymap.ENTER && evt.shiftKey ? uiGridCellNavConstants.direction.UP : evt.keyCode === uiGridConstants.keymap.PG_UP ? uiGridCellNavConstants.direction.PG_UP : evt.keyCode === uiGridConstants.keymap.DOWN || evt.keyCode === uiGridConstants.keymap.ENTER && !evt.ctrlKey && !evt.altKey ? uiGridCellNavConstants.direction.DOWN : evt.keyCode === uiGridConstants.keymap.PG_DOWN ? uiGridCellNavConstants.direction.PG_DOWN : null;
            },
            cellNavColumnBuilder: function(colDef, col, gridOptions) {
                return colDef.allowCellFocus = void 0 === colDef.allowCellFocus || colDef.allowCellFocus, 
                $q.all([]);
            },
            scrollToFocus: function(grid, rowEntity, colDef) {
                var gridRow = null, gridCol = null;
                return null != rowEntity && (gridRow = grid.getRow(rowEntity)), null != colDef && (gridCol = grid.getColumn(colDef.name ? colDef.name : colDef.field)), 
                grid.api.core.scrollToIfNecessary(gridRow, gridCol).then(function() {
                    var rowCol = {
                        row: gridRow,
                        col: gridCol
                    };
                    null !== gridRow && null !== gridCol && grid.cellNav.broadcastCellNav(rowCol, null, null);
                });
            },
            getLeftWidth: function(grid, upToCol) {
                var width = 0;
                if (!upToCol) return width;
                var lastIndex = grid.renderContainers.body.visibleColumnCache.indexOf(upToCol);
                grid.renderContainers.body.visibleColumnCache.forEach(function(col, index) {
                    index < lastIndex && (width += col.drawnWidth);
                });
                var percentage = 0 === lastIndex ? 0 : (lastIndex + 1) / grid.renderContainers.body.visibleColumnCache.length;
                return width += upToCol.drawnWidth * percentage;
            }
        };
        return service;
    } ]), module.directive("uiGridCellnav", [ "gridUtil", "uiGridCellNavService", "uiGridCellNavConstants", "uiGridConstants", "GridRowColumn", "$timeout", "$compile", "i18nService", function(gridUtil, uiGridCellNavService, uiGridCellNavConstants, uiGridConstants, GridRowColumn, $timeout, $compile, i18nService) {
        return {
            replace: !0,
            priority: -150,
            require: "^uiGrid",
            scope: !1,
            controller: function() {},
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        var _scope = $scope, grid = uiGridCtrl.grid;
                        uiGridCellNavService.initializeGrid(grid), uiGridCtrl.cellNav = {}, uiGridCtrl.cellNav.makeRowCol = function(obj) {
                            return obj instanceof GridRowColumn || (obj = new GridRowColumn(obj.row, obj.col)), 
                            obj;
                        }, uiGridCtrl.cellNav.getActiveCell = function() {
                            var elms = $elm[0].getElementsByClassName("ui-grid-cell-focus");
                            if (0 < elms.length) return elms[0];
                        }, uiGridCtrl.cellNav.broadcastCellNav = grid.cellNav.broadcastCellNav = function(newRowCol, modifierDown, originEvt) {
                            modifierDown = !(void 0 === modifierDown || !modifierDown), newRowCol = uiGridCtrl.cellNav.makeRowCol(newRowCol), 
                            uiGridCtrl.cellNav.broadcastFocus(newRowCol, modifierDown, originEvt), _scope.$broadcast(uiGridCellNavConstants.CELL_NAV_EVENT, newRowCol, modifierDown, originEvt);
                        }, uiGridCtrl.cellNav.clearFocus = grid.cellNav.clearFocus = function() {
                            grid.cellNav.focusedCells = [], _scope.$broadcast(uiGridCellNavConstants.CELL_NAV_EVENT);
                        }, uiGridCtrl.cellNav.broadcastFocus = function(rowCol, modifierDown, originEvt) {
                            modifierDown = !(void 0 === modifierDown || !modifierDown);
                            var row = (rowCol = uiGridCtrl.cellNav.makeRowCol(rowCol)).row, col = rowCol.col, rowColSelectIndex = uiGridCtrl.grid.api.cellNav.rowColSelectIndex(rowCol);
                            if (null === grid.cellNav.lastRowCol || -1 === rowColSelectIndex || grid.cellNav.lastRowCol.col === col && grid.cellNav.lastRowCol.row === row) {
                                var newRowCol = new GridRowColumn(row, col);
                                (null === grid.cellNav.lastRowCol || grid.cellNav.lastRowCol.row !== newRowCol.row || grid.cellNav.lastRowCol.col !== newRowCol.col || grid.options.enableCellEditOnFocus) && (grid.api.cellNav.raise.navigate(newRowCol, grid.cellNav.lastRowCol, originEvt), 
                                grid.cellNav.lastRowCol = newRowCol), uiGridCtrl.grid.options.modifierKeysToMultiSelectCells && modifierDown ? grid.cellNav.focusedCells.push(rowCol) : grid.cellNav.focusedCells = [ rowCol ];
                            } else grid.options.modifierKeysToMultiSelectCells && modifierDown && 0 <= rowColSelectIndex && grid.cellNav.focusedCells.splice(rowColSelectIndex, 1);
                        }, uiGridCtrl.cellNav.handleKeyDown = function(evt) {
                            var direction = uiGridCellNavService.getDirection(evt);
                            if (null === direction) return null;
                            var containerId = "body";
                            evt.uiGridTargetRenderContainerId && (containerId = evt.uiGridTargetRenderContainerId);
                            var lastRowCol = uiGridCtrl.grid.api.cellNav.getFocusedCell();
                            if (lastRowCol) {
                                var rowCol = uiGridCtrl.grid.renderContainers[containerId].cellNav.getNextRowCol(direction, lastRowCol.row, lastRowCol.col), focusableCols = uiGridCtrl.grid.renderContainers[containerId].cellNav.getFocusableCols(), rowColSelectIndex = uiGridCtrl.grid.api.cellNav.rowColSelectIndex(rowCol);
                                return direction === uiGridCellNavConstants.direction.LEFT && rowCol.col === focusableCols[focusableCols.length - 1] && rowCol.row === lastRowCol.row && evt.keyCode === uiGridConstants.keymap.TAB && evt.shiftKey ? (grid.cellNav.focusedCells.splice(rowColSelectIndex, 1), 
                                uiGridCtrl.cellNav.clearFocus(), !0) : direction !== uiGridCellNavConstants.direction.RIGHT || rowCol.col !== focusableCols[0] || rowCol.row !== lastRowCol.row || evt.keyCode !== uiGridConstants.keymap.TAB || evt.shiftKey ? (grid.scrollToIfNecessary(rowCol.row, rowCol.col).then(function() {
                                    uiGridCtrl.cellNav.broadcastCellNav(rowCol, null, evt);
                                }), evt.stopPropagation(), evt.preventDefault(), !1) : (grid.cellNav.focusedCells.splice(rowColSelectIndex, 1), 
                                uiGridCtrl.cellNav.clearFocus(), !0);
                            }
                        };
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {
                        var ariaNotifierDomElt, ariaNotifier, grid = uiGridCtrl.grid, usesAria = !0;
                        try {
                            angular.module("ngAria");
                        } catch (err) {
                            usesAria = !1;
                        }
                        usesAria && (ariaNotifierDomElt = '<div id="' + grid.id + '-aria-speakable" class="ui-grid-a11y-ariascreenreader-speakable ui-grid-offscreen" aria-live="assertive" role="alert" aria-atomic="true" aria-hidden="false" aria-relevant="additions" >&nbsp;</div>', 
                        ariaNotifier = $compile(ariaNotifierDomElt)($scope), $elm.prepend(ariaNotifier), 
                        $scope.$on(uiGridCellNavConstants.CELL_NAV_EVENT, function(evt, rowCol, modifierDown, originEvt) {
                            if (!originEvt || "focus" !== originEvt.type) {
                                for (var col, currentRowColumn, values = [], currentSelection = grid.api.cellNav.getCurrentSelection(), i = 0; i < currentSelection.length; i++) {
                                    var cellDisplayValue = ("selectionRowHeaderCol" === (currentRowColumn = currentSelection[i]).col.field ? currentRowColumn.row.isSelected ? i18nService.getSafeText("search.aria.selected") : i18nService.getSafeText("search.aria.notSelected") : grid.getCellDisplayValue(currentRowColumn.row, currentRowColumn.col)) + (col = currentSelection[i].col, 
                                    ", " + i18nService.getSafeText("headerCell.aria.column") + " " + col.displayName);
                                    values.push(cellDisplayValue);
                                }
                                var text, cellText = values.toString();
                                (text = cellText) !== ariaNotifier.text().trim() && (ariaNotifier[0].style.clip = "rect(0px,0px,0px,0px)", 
                                ariaNotifier[0].innerHTML = "", ariaNotifier[0].style.visibility = "hidden", ariaNotifier[0].style.visibility = "visible", 
                                "" !== text && (ariaNotifier[0].style.clip = "auto", ariaNotifier[0].appendChild(document.createTextNode(text + " ")), 
                                ariaNotifier[0].style.visibility = "hidden", ariaNotifier[0].style.visibility = "visible"));
                            }
                        }));
                    }
                };
            }
        };
    } ]), module.directive("uiGridRenderContainer", [ "$timeout", "$document", "gridUtil", "uiGridConstants", "uiGridCellNavService", "$compile", "uiGridCellNavConstants", function($timeout, $document, gridUtil, uiGridConstants, uiGridCellNavService, $compile, uiGridCellNavConstants) {
        return {
            replace: !0,
            priority: -99999,
            require: [ "^uiGrid", "uiGridRenderContainer", "?^uiGridCellnav" ],
            scope: !1,
            compile: function() {
                return {
                    post: function($scope, $elm, $attrs, controllers) {
                        var uiGridCtrl = controllers[0], renderContainerCtrl = controllers[1], uiGridCellnavCtrl = controllers[2];
                        if (uiGridCtrl.grid.api.cellNav) {
                            var containerId = renderContainerCtrl.containerId, grid = uiGridCtrl.grid;
                            if (uiGridCellNavService.decorateRenderContainers(grid), "body" === containerId) {
                                uiGridCtrl.grid.options.modifierKeysToMultiSelectCells ? $elm.attr("aria-multiselectable", !0) : $elm.attr("aria-multiselectable", !1);
                                var focuser = $compile('<div class="ui-grid-focuser" role="region" aria-live="assertive" aria-atomic="false" tabindex="0" aria-controls="' + grid.id + "-aria-speakable " + grid.id + '-grid-container" aria-owns="' + grid.id + '-grid-container"></div>')($scope);
                                $elm.append(focuser), focuser.on("focus", function(evt) {
                                    evt.uiGridTargetRenderContainerId = containerId;
                                    var rowCol = uiGridCtrl.grid.api.cellNav.getFocusedCell();
                                    null === rowCol && (rowCol = uiGridCtrl.grid.renderContainers[containerId].cellNav.getNextRowCol(uiGridCellNavConstants.direction.DOWN, null, null)).row && rowCol.col && uiGridCtrl.cellNav.broadcastCellNav(rowCol);
                                }), uiGridCellnavCtrl.setAriaActivedescendant = function(id) {
                                    $elm.attr("aria-activedescendant", id);
                                }, uiGridCellnavCtrl.removeAriaActivedescendant = function(id) {
                                    $elm.attr("aria-activedescendant") === id && $elm.attr("aria-activedescendant", "");
                                }, uiGridCtrl.focus = function() {
                                    gridUtil.focus.byElement(focuser[0]);
                                };
                                var viewPortKeyDownWasRaisedForRowCol = null;
                                focuser.on("keydown", function(evt) {
                                    evt.uiGridTargetRenderContainerId = containerId;
                                    var rowCol = uiGridCtrl.grid.api.cellNav.getFocusedCell();
                                    null === (uiGridCtrl.grid.options.keyDownOverrides.some(function(override) {
                                        return Object.keys(override).every(function(property) {
                                            return override[property] === evt[property];
                                        });
                                    }) ? null : uiGridCtrl.cellNav.handleKeyDown(evt)) && (uiGridCtrl.grid.api.cellNav.raise.viewPortKeyDown(evt, rowCol, uiGridCtrl.cellNav.handleKeyDown), 
                                    viewPortKeyDownWasRaisedForRowCol = rowCol);
                                }), focuser.on("keypress", function(evt) {
                                    viewPortKeyDownWasRaisedForRowCol && ($timeout(function() {
                                        uiGridCtrl.grid.api.cellNav.raise.viewPortKeyPress(evt, viewPortKeyDownWasRaisedForRowCol);
                                    }, 4), viewPortKeyDownWasRaisedForRowCol = null);
                                }), $scope.$on("$destroy", function() {
                                    focuser.off();
                                });
                            }
                        }
                    }
                };
            }
        };
    } ]), module.directive("uiGridViewport", [ "$timeout", "$document", "gridUtil", "uiGridConstants", "uiGridCellNavService", "uiGridCellNavConstants", "$log", "$compile", function($timeout, $document, gridUtil, uiGridConstants, uiGridCellNavService, uiGridCellNavConstants, $log, $compile) {
        return {
            replace: !0,
            priority: -99999,
            require: [ "^uiGrid", "^uiGridRenderContainer", "?^uiGridCellnav" ],
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {},
                    post: function($scope, $elm, $attrs, controllers) {
                        var uiGridCtrl = controllers[0], renderContainerCtrl = controllers[1];
                        if (uiGridCtrl.grid.api.cellNav && "body" === renderContainerCtrl.containerId) {
                            var grid = uiGridCtrl.grid;
                            grid.api.core.on.scrollBegin($scope, function(args) {
                                var lastRowCol = uiGridCtrl.grid.api.cellNav.getFocusedCell();
                                null !== lastRowCol && renderContainerCtrl.colContainer.containsColumn(lastRowCol.col) && uiGridCtrl.cellNav.clearFocus();
                            }), grid.api.core.on.scrollEnd($scope, function(args) {
                                var lastRowCol = uiGridCtrl.grid.api.cellNav.getFocusedCell();
                                null !== lastRowCol && renderContainerCtrl.colContainer.containsColumn(lastRowCol.col) && uiGridCtrl.cellNav.broadcastCellNav(lastRowCol);
                            }), grid.api.cellNav.on.navigate($scope, function() {
                                uiGridCtrl.focus();
                            });
                        }
                    }
                };
            }
        };
    } ]), module.directive("uiGridCell", [ "$timeout", "$document", "uiGridCellNavService", "gridUtil", "uiGridCellNavConstants", "uiGridConstants", "GridRowColumn", function($timeout, $document, uiGridCellNavService, gridUtil, uiGridCellNavConstants, uiGridConstants, GridRowColumn) {
        return {
            priority: -150,
            restrict: "A",
            require: [ "^uiGrid", "?^uiGridCellnav" ],
            scope: !1,
            link: function($scope, $elm, $attrs, controllers) {
                var uiGridCtrl = controllers[0], uiGridCellnavCtrl = controllers[1];
                if (uiGridCtrl.grid.api.cellNav && $scope.col.colDef.allowCellFocus) {
                    var grid = uiGridCtrl.grid;
                    $scope.focused = !1, $elm.attr("tabindex", -1), $elm.find("div").on("click", function(evt) {
                        uiGridCtrl.cellNav.broadcastCellNav(new GridRowColumn($scope.row, $scope.col), evt.ctrlKey || evt.metaKey, evt), 
                        evt.stopPropagation(), $scope.$apply();
                    }), $elm.on("mousedown", preventMouseDown), uiGridCtrl.grid.api.edit && (uiGridCtrl.grid.api.edit.on.beginCellEdit($scope, function() {
                        $elm.off("mousedown", preventMouseDown);
                    }), uiGridCtrl.grid.api.edit.on.afterCellEdit($scope, function() {
                        $elm.on("mousedown", preventMouseDown);
                    }), uiGridCtrl.grid.api.edit.on.cancelCellEdit($scope, function() {
                        $elm.on("mousedown", preventMouseDown);
                    })), refreshCellFocus(), $elm.on("focus", function(evt) {
                        uiGridCtrl.cellNav.broadcastCellNav(new GridRowColumn($scope.row, $scope.col), !1, evt), 
                        evt.stopPropagation(), $scope.$apply();
                    }), $scope.$on(uiGridCellNavConstants.CELL_NAV_EVENT, refreshCellFocus);
                    var dataChangeDereg = uiGridCtrl.grid.registerDataChangeCallback(function(grid) {
                        clearFocus(), $scope.$applyAsync(refreshCellFocus);
                    }, [ uiGridConstants.dataChange.ROW ]);
                    $scope.$on("$destroy", function() {
                        dataChangeDereg(), $elm.find("div").off(), $elm.off();
                    });
                }
                function preventMouseDown(evt) {
                    evt.preventDefault();
                }
                function refreshCellFocus() {
                    grid.cellNav.focusedCells.some(function(focusedRowCol, index) {
                        return focusedRowCol.row === $scope.row && focusedRowCol.col === $scope.col;
                    }) ? function() {
                        if (!$scope.focused) {
                            var div = $elm.find("div");
                            div.addClass("ui-grid-cell-focus"), $elm.attr("aria-selected", !0), uiGridCellnavCtrl.setAriaActivedescendant($elm.attr("id")), 
                            $scope.focused = !0;
                        }
                    }() : clearFocus();
                }
                function clearFocus() {
                    $scope.focused && ($elm.find("div").removeClass("ui-grid-cell-focus"), $elm.attr("aria-selected", !1), 
                    uiGridCellnavCtrl.removeAriaActivedescendant($elm.attr("id")), $scope.focused = !1);
                }
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.edit", [ "ui.grid" ]);
    module.constant("uiGridEditConstants", {
        EDITABLE_CELL_TEMPLATE: /EDITABLE_CELL_TEMPLATE/g,
        EDITABLE_CELL_DIRECTIVE: /editable_cell_directive/g,
        events: {
            BEGIN_CELL_EDIT: "uiGridEventBeginCellEdit",
            END_CELL_EDIT: "uiGridEventEndCellEdit",
            CANCEL_CELL_EDIT: "uiGridEventCancelCellEdit"
        }
    }), module.service("uiGridEditService", [ "$q", "uiGridConstants", "gridUtil", function($q, uiGridConstants, gridUtil) {
        var service = {
            initializeGrid: function(grid) {
                service.defaultGridOptions(grid.options), grid.registerColumnBuilder(service.editColumnBuilder), 
                grid.edit = {};
                grid.api.registerEventsFromObject({
                    edit: {
                        afterCellEdit: function(rowEntity, colDef, newValue, oldValue) {},
                        beginCellEdit: function(rowEntity, colDef, triggerEvent) {},
                        cancelCellEdit: function(rowEntity, colDef) {}
                    }
                });
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.cellEditableCondition = void 0 === gridOptions.cellEditableCondition || gridOptions.cellEditableCondition, 
                gridOptions.enableCellEditOnFocus = void 0 !== gridOptions.enableCellEditOnFocus && gridOptions.enableCellEditOnFocus;
            },
            editColumnBuilder: function(colDef, col, gridOptions) {
                var promises = [];
                return colDef.enableCellEdit = void 0 === colDef.enableCellEdit ? void 0 === gridOptions.enableCellEdit ? "object" !== colDef.type : gridOptions.enableCellEdit : colDef.enableCellEdit, 
                colDef.cellEditableCondition = void 0 === colDef.cellEditableCondition ? gridOptions.cellEditableCondition : colDef.cellEditableCondition, 
                colDef.enableCellEdit && (colDef.editableCellTemplate = colDef.editableCellTemplate || gridOptions.editableCellTemplate || "ui-grid/cellEditor", 
                promises.push(gridUtil.getTemplate(colDef.editableCellTemplate).then(function(template) {
                    col.editableCellTemplate = template;
                }, function(res) {
                    throw new Error("Couldn't fetch/use colDef.editableCellTemplate '" + colDef.editableCellTemplate + "'");
                }))), colDef.enableCellEditOnFocus = void 0 === colDef.enableCellEditOnFocus ? gridOptions.enableCellEditOnFocus : colDef.enableCellEditOnFocus, 
                $q.all(promises);
            },
            isStartEditKey: function(evt) {
                return !(evt.metaKey || evt.keyCode === uiGridConstants.keymap.ESC || evt.keyCode === uiGridConstants.keymap.SHIFT || evt.keyCode === uiGridConstants.keymap.CTRL || evt.keyCode === uiGridConstants.keymap.ALT || evt.keyCode === uiGridConstants.keymap.WIN || evt.keyCode === uiGridConstants.keymap.CAPSLOCK || evt.keyCode === uiGridConstants.keymap.LEFT || evt.keyCode === uiGridConstants.keymap.TAB && evt.shiftKey || evt.keyCode === uiGridConstants.keymap.RIGHT || evt.keyCode === uiGridConstants.keymap.TAB || evt.keyCode === uiGridConstants.keymap.UP || evt.keyCode === uiGridConstants.keymap.ENTER && evt.shiftKey || evt.keyCode === uiGridConstants.keymap.DOWN || evt.keyCode === uiGridConstants.keymap.ENTER);
            }
        };
        return service;
    } ]), module.directive("uiGridEdit", [ "gridUtil", "uiGridEditService", function(gridUtil, uiGridEditService) {
        return {
            replace: !0,
            priority: 0,
            require: "^uiGrid",
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        uiGridEditService.initializeGrid(uiGridCtrl.grid);
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {}
                };
            }
        };
    } ]), module.directive("uiGridViewport", [ "uiGridEditConstants", function(uiGridEditConstants) {
        return {
            replace: !0,
            priority: -99998,
            require: [ "^uiGrid", "^uiGridRenderContainer" ],
            scope: !1,
            compile: function() {
                return {
                    post: function($scope, $elm, $attrs, controllers) {
                        var uiGridCtrl = controllers[0];
                        uiGridCtrl.grid.api.edit && uiGridCtrl.grid.api.cellNav && ("body" === controllers[1].containerId && ($scope.$on(uiGridEditConstants.events.CANCEL_CELL_EDIT, function() {
                            uiGridCtrl.focus();
                        }), $scope.$on(uiGridEditConstants.events.END_CELL_EDIT, function() {
                            uiGridCtrl.focus();
                        })));
                    }
                };
            }
        };
    } ]), module.directive("uiGridCell", [ "$compile", "$injector", "$timeout", "uiGridConstants", "uiGridEditConstants", "gridUtil", "$parse", "uiGridEditService", "$rootScope", "$q", function($compile, $injector, $timeout, uiGridConstants, uiGridEditConstants, gridUtil, $parse, uiGridEditService, $rootScope, $q) {
        var touchstartTimeout = 500;
        if ($injector.has("uiGridCellNavService")) $injector.get("uiGridCellNavService");
        return {
            priority: -100,
            restrict: "A",
            scope: !1,
            require: "?^uiGrid",
            link: function($scope, $elm, $attrs, uiGridCtrl) {
                var html, origCellValue, cellModel, cancelTouchstartTimeout, editCellScope, inEdit = !1;
                if ($scope.col.colDef.enableCellEdit) {
                    var cellNavNavigateDereg = function() {}, viewPortKeyDownDereg = function() {}, setEditable = function() {
                        $scope.col.colDef.enableCellEdit && !1 !== $scope.row.enableCellEdit ? $scope.beginEditEventsWired || registerBeginEditEvents() : $scope.beginEditEventsWired && cancelBeginEditEvents();
                    };
                    setEditable();
                    var rowWatchDereg = $scope.$watch("row", function(n, o) {
                        n !== o && setEditable();
                    });
                    $scope.$on("$destroy", function() {
                        rowWatchDereg(), $elm.off();
                    });
                }
                function registerBeginEditEvents() {
                    $elm.on("dblclick", beginEdit), $elm.on("touchstart", touchStart), uiGridCtrl && uiGridCtrl.grid.api.cellNav && (viewPortKeyDownDereg = uiGridCtrl.grid.api.cellNav.on.viewPortKeyDown($scope, function(evt, rowCol) {
                        null !== rowCol && (rowCol.row !== $scope.row || rowCol.col !== $scope.col || $scope.col.colDef.enableCellEditOnFocus || beginEditKeyDown(evt));
                    }), cellNavNavigateDereg = uiGridCtrl.grid.api.cellNav.on.navigate($scope, function(newRowCol, oldRowCol, evt) {
                        $scope.col.colDef.enableCellEditOnFocus && (newRowCol.row !== $scope.row || newRowCol.col !== $scope.col || null !== evt && (!evt || "click" !== evt.type && "keydown" !== evt.type) || $timeout(function() {
                            beginEdit(evt);
                        }));
                    })), $scope.beginEditEventsWired = !0;
                }
                function touchStart(event) {
                    void 0 !== event.originalEvent && void 0 !== event.originalEvent && (event = event.originalEvent), 
                    $elm.on("touchend", touchEnd), (cancelTouchstartTimeout = $timeout(function() {}, touchstartTimeout)).then(function() {
                        setTimeout(beginEdit, 0), $elm.off("touchend", touchEnd);
                    });
                }
                function touchEnd(event) {
                    $timeout.cancel(cancelTouchstartTimeout), $elm.off("touchend", touchEnd);
                }
                function cancelBeginEditEvents() {
                    $elm.off("dblclick", beginEdit), $elm.off("keydown", beginEditKeyDown), $elm.off("touchstart", touchStart), 
                    cellNavNavigateDereg(), viewPortKeyDownDereg(), $scope.beginEditEventsWired = !1;
                }
                function beginEditKeyDown(evt) {
                    uiGridEditService.isStartEditKey(evt) && beginEdit(evt);
                }
                function beginEdit(triggerEvent) {
                    $scope.grid.api.core.scrollToIfNecessary($scope.row, $scope.col).then(function() {
                        !function(triggerEvent) {
                            if (inEdit) return;
                            if (!function(col, row, triggerEvent) {
                                return !row.isSaving && (angular.isFunction(col.colDef.cellEditableCondition) ? col.colDef.cellEditableCondition($scope, triggerEvent) : col.colDef.cellEditableCondition);
                            }($scope.col, $scope.row, triggerEvent)) return;
                            var modelField = $scope.row.getQualifiedColField($scope.col);
                            $scope.col.colDef.editModelField && (modelField = gridUtil.preEval("row.entity." + $scope.col.colDef.editModelField));
                            cellModel = $parse(modelField), origCellValue = cellModel($scope), html = (html = (html = $scope.col.editableCellTemplate).replace(uiGridConstants.MODEL_COL_FIELD, modelField)).replace(uiGridConstants.COL_FIELD, "grid.getCellValue(row, col)");
                            var optionFilter = $scope.col.colDef.editDropdownFilter ? "|" + $scope.col.colDef.editDropdownFilter : "";
                            html = html.replace(uiGridConstants.CUSTOM_FILTERS, optionFilter);
                            var inputType = "text";
                            switch ($scope.col.colDef.type) {
                              case "boolean":
                                inputType = "checkbox";
                                break;

                              case "number":
                                inputType = "number";
                                break;

                              case "date":
                                inputType = "date";
                            }
                            html = html.replace("INPUT_TYPE", inputType);
                            var editDropdownOptionsFunction = $scope.col.colDef.editDropdownOptionsFunction;
                            if (editDropdownOptionsFunction) $q.when(editDropdownOptionsFunction($scope.row.entity, $scope.col.colDef)).then(function(result) {
                                $scope.editDropdownOptionsArray = result;
                            }); else {
                                var editDropdownRowEntityOptionsArrayPath = $scope.col.colDef.editDropdownRowEntityOptionsArrayPath;
                                $scope.editDropdownOptionsArray = editDropdownRowEntityOptionsArrayPath ? function(object, path) {
                                    var a = (path = (path = path.replace(/\[(\w+)\]/g, ".$1")).replace(/^\./, "")).split(".");
                                    for (;a.length; ) {
                                        var n = a.shift();
                                        if (!(n in object)) return;
                                        object = object[n];
                                    }
                                    return object;
                                }($scope.row.entity, editDropdownRowEntityOptionsArrayPath) : $scope.col.colDef.editDropdownOptionsArray;
                            }
                            $scope.editDropdownIdLabel = $scope.col.colDef.editDropdownIdLabel ? $scope.col.colDef.editDropdownIdLabel : "id", 
                            $scope.editDropdownValueLabel = $scope.col.colDef.editDropdownValueLabel ? $scope.col.colDef.editDropdownValueLabel : "value";
                            var createEditor = function() {
                                inEdit = !0, cancelBeginEditEvents();
                                var cellElement = angular.element(html);
                                $elm.append(cellElement), editCellScope = $scope.$new(), $compile(cellElement)(editCellScope);
                                var gridCellContentsEl = angular.element($elm.children()[0]);
                                gridCellContentsEl.addClass("ui-grid-cell-contents-hidden");
                            };
                            $rootScope.$$phase ? createEditor() : $scope.$apply(createEditor);
                            var deregOnGridScroll = $scope.col.grid.api.core.on.scrollBegin($scope, function() {
                                $scope.grid.disableScrolling || (endEdit(), $scope.grid.api.edit.raise.afterCellEdit($scope.row.entity, $scope.col.colDef, cellModel($scope), origCellValue), 
                                deregOnGridScroll(), deregOnEndCellEdit(), deregOnCancelCellEdit());
                            }), deregOnEndCellEdit = $scope.$on(uiGridEditConstants.events.END_CELL_EDIT, function() {
                                endEdit(), $scope.grid.api.edit.raise.afterCellEdit($scope.row.entity, $scope.col.colDef, cellModel($scope), origCellValue), 
                                deregOnEndCellEdit(), deregOnGridScroll(), deregOnCancelCellEdit();
                            }), deregOnCancelCellEdit = $scope.$on(uiGridEditConstants.events.CANCEL_CELL_EDIT, function() {
                                !function() {
                                    if ($scope.grid.disableScrolling = !1, !inEdit) return;
                                    cellModel.assign($scope, origCellValue), $scope.$apply(), $scope.grid.api.edit.raise.cancelCellEdit($scope.row.entity, $scope.col.colDef), 
                                    endEdit();
                                }(), deregOnCancelCellEdit(), deregOnGridScroll(), deregOnEndCellEdit();
                            });
                            $scope.$broadcast(uiGridEditConstants.events.BEGIN_CELL_EDIT, triggerEvent), $timeout(function() {
                                $scope.grid.api.edit.raise.beginCellEdit($scope.row.entity, $scope.col.colDef, triggerEvent);
                            });
                        }(triggerEvent);
                    });
                }
                function endEdit() {
                    if ($scope.grid.disableScrolling = !1, inEdit) {
                        uiGridCtrl && uiGridCtrl.grid.api.cellNav && uiGridCtrl.focus();
                        var gridCellContentsEl = angular.element($elm.children()[0]);
                        editCellScope.$destroy();
                        for (var children = $elm.children(), i = 1; i < children.length; i++) angular.element(children[i]).remove();
                        gridCellContentsEl.removeClass("ui-grid-cell-contents-hidden"), inEdit = !1, registerBeginEditEvents(), 
                        $scope.grid.api.core.notifyDataChange(uiGridConstants.dataChange.EDIT);
                    }
                }
            }
        };
    } ]), module.directive("uiGridEditor", [ "gridUtil", "uiGridConstants", "uiGridEditConstants", "$timeout", "uiGridEditService", function(gridUtil, uiGridConstants, uiGridEditConstants, $timeout, uiGridEditService) {
        return {
            scope: !0,
            require: [ "?^uiGrid", "?^uiGridRenderContainer", "ngModel" ],
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs) {},
                    post: function($scope, $elm, $attrs, controllers) {
                        var uiGridCtrl, renderContainerCtrl, ngModel;
                        controllers[0] && (uiGridCtrl = controllers[0]), controllers[1] && (renderContainerCtrl = controllers[1]), 
                        controllers[2] && (ngModel = controllers[2]), $scope.$on(uiGridEditConstants.events.BEGIN_CELL_EDIT, function(evt, triggerEvent) {
                            if ($timeout(function() {
                                if ($elm[0].focus(), !$elm[0].select || !$scope.col.colDef.enableCellEditOnFocus && uiGridCtrl && uiGridCtrl.grid.api.cellNav) try {
                                    $elm[0].setSelectionRange($elm[0].value.length, $elm[0].value.length);
                                } catch (ex) {} else $elm[0].select();
                            }), uiGridCtrl && uiGridCtrl.grid.api.cellNav) var viewPortKeyDownUnregister = uiGridCtrl.grid.api.cellNav.on.viewPortKeyPress($scope, function(evt, rowCol) {
                                if (uiGridEditService.isStartEditKey(evt)) {
                                    var code = "number" == typeof evt.which ? evt.which : evt.keyCode;
                                    0 < code && (ngModel.$setViewValue(String.fromCharCode(code), evt), ngModel.$render());
                                }
                                viewPortKeyDownUnregister();
                            });
                            $elm.on("mousedown", function(evt) {
                                "checkbox" === $elm[0].type && ($elm.off("blur", $scope.stopEdit), $timeout(function() {
                                    $elm[0].focus(), $elm.on("blur", $scope.stopEdit);
                                }));
                            }), $elm.on("blur", $scope.stopEdit);
                        }), $scope.deepEdit = !1, $scope.stopEdit = function(evt) {
                            $scope.inputForm && !$scope.inputForm.$valid ? (evt.stopPropagation(), $scope.$emit(uiGridEditConstants.events.CANCEL_CELL_EDIT)) : $scope.$emit(uiGridEditConstants.events.END_CELL_EDIT), 
                            $scope.deepEdit = !1;
                        }, $elm.on("click", function(evt) {
                            "checkbox" !== $elm[0].type && ($scope.deepEdit = !0, $scope.$applyAsync(function() {
                                $scope.grid.disableScrolling = !0;
                            }));
                        }), $elm.on("keydown", function(evt) {
                            switch (evt.keyCode) {
                              case uiGridConstants.keymap.ESC:
                                evt.stopPropagation(), $scope.$emit(uiGridEditConstants.events.CANCEL_CELL_EDIT);
                            }
                            if (!$scope.deepEdit || evt.keyCode !== uiGridConstants.keymap.LEFT && evt.keyCode !== uiGridConstants.keymap.RIGHT && evt.keyCode !== uiGridConstants.keymap.UP && evt.keyCode !== uiGridConstants.keymap.DOWN) if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) evt.uiGridTargetRenderContainerId = renderContainerCtrl.containerId, 
                            null !== uiGridCtrl.cellNav.handleKeyDown(evt) && $scope.stopEdit(evt); else switch (evt.keyCode) {
                              case uiGridConstants.keymap.ENTER:
                              case uiGridConstants.keymap.TAB:
                                evt.stopPropagation(), evt.preventDefault(), $scope.stopEdit(evt);
                            } else evt.stopPropagation();
                            return !0;
                        }), $scope.$on("$destroy", function() {
                            $elm.off();
                        });
                    }
                };
            }
        };
    } ]), module.directive("uiGridEditor", [ "$filter", function($filter) {
        return {
            priority: -100,
            require: "?ngModel",
            link: function(scope, element, attrs, ngModel) {
                2 === angular.version.minor && attrs.type && "date" === attrs.type && ngModel && (ngModel.$formatters.push(function(modelValue) {
                    return ngModel.$setValidity(null, !modelValue || !isNaN(modelValue.getTime())), 
                    $filter("date")(modelValue, "yyyy-MM-dd");
                }), ngModel.$parsers.push(function(viewValue) {
                    if (viewValue && 0 < viewValue.length) {
                        var dateValue = function(dateString) {
                            if (void 0 === dateString || "" === dateString) return null;
                            var parts = dateString.split("-");
                            if (3 !== parts.length) return null;
                            var year = parseInt(parts[0], 10), month = parseInt(parts[1], 10), day = parseInt(parts[2], 10);
                            return month < 1 || year < 1 || day < 1 ? null : new Date(year, month - 1, day);
                        }(viewValue);
                        return ngModel.$setValidity(null, dateValue && !isNaN(dateValue.getTime())), dateValue;
                    }
                    return ngModel.$setValidity(null, !0), null;
                }));
            }
        };
    } ]), module.directive("uiGridEditDropdown", [ "uiGridConstants", "uiGridEditConstants", "$timeout", function(uiGridConstants, uiGridEditConstants, $timeout) {
        return {
            require: [ "?^uiGrid", "?^uiGridRenderContainer" ],
            scope: !0,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs) {},
                    post: function($scope, $elm, $attrs, controllers) {
                        var uiGridCtrl = controllers[0], renderContainerCtrl = controllers[1];
                        $scope.$on(uiGridEditConstants.events.BEGIN_CELL_EDIT, function() {
                            $timeout(function() {
                                $elm[0].focus();
                            }), $elm[0].style.width = $elm[0].parentElement.offsetWidth - 1 + "px", $elm.on("blur", function(evt) {
                                $scope.stopEdit(evt);
                            });
                        }), $scope.stopEdit = function(evt) {
                            $scope.$emit(uiGridEditConstants.events.END_CELL_EDIT);
                        }, $elm.on("keydown", function(evt) {
                            switch (evt.keyCode) {
                              case uiGridConstants.keymap.ESC:
                                evt.stopPropagation(), $scope.$emit(uiGridEditConstants.events.CANCEL_CELL_EDIT);
                            }
                            if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) evt.uiGridTargetRenderContainerId = renderContainerCtrl.containerId, 
                            null !== uiGridCtrl.cellNav.handleKeyDown(evt) && $scope.stopEdit(evt); else switch (evt.keyCode) {
                              case uiGridConstants.keymap.ENTER:
                              case uiGridConstants.keymap.TAB:
                                evt.stopPropagation(), evt.preventDefault(), $scope.stopEdit(evt);
                            }
                            return !0;
                        }), $scope.$on("$destroy", function() {
                            $elm.off();
                        });
                    }
                };
            }
        };
    } ]), module.directive("uiGridEditFileChooser", [ "gridUtil", "uiGridConstants", "uiGridEditConstants", function(gridUtil, uiGridConstants, uiGridEditConstants) {
        return {
            scope: !0,
            require: [ "?^uiGrid", "?^uiGridRenderContainer" ],
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs) {},
                    post: function($scope, $elm) {
                        $elm[0].addEventListener("change", function handleFileSelect(event) {
                            var target = event.srcElement || event.target;
                            target && target.files && 0 < target.files.length ? ("function" == typeof $scope.col.colDef.editFileChooserCallback ? $scope.col.colDef.editFileChooserCallback($scope.row, $scope.col, target.files) : gridUtil.logError("You need to set colDef.editFileChooserCallback to use the file chooser"), 
                            target.form.reset(), $scope.$emit(uiGridEditConstants.events.END_CELL_EDIT)) : $scope.$emit(uiGridEditConstants.events.CANCEL_CELL_EDIT), 
                            $elm[0].removeEventListener("change", handleFileSelect, !1);
                        }, !1), $scope.$on(uiGridEditConstants.events.BEGIN_CELL_EDIT, function() {
                            $elm[0].focus(), $elm[0].select(), $elm.on("blur", function() {
                                $scope.$emit(uiGridEditConstants.events.END_CELL_EDIT), $elm.off();
                            });
                        });
                    }
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.emptyBaseLayer", [ "ui.grid" ]);
    module.service("uiGridBaseLayerService", [ "gridUtil", "$compile", function(gridUtil, $compile) {
        return {
            initializeGrid: function(grid, disableEmptyBaseLayer) {
                !(grid.baseLayer = {
                    emptyRows: []
                }) !== grid.options.enableEmptyGridBaseLayer && (grid.options.enableEmptyGridBaseLayer = !disableEmptyBaseLayer);
            },
            setNumberOfEmptyRows: function(viewportHeight, grid) {
                var rowHeight = grid.options.rowHeight, rows = Math.ceil(viewportHeight / rowHeight);
                if (0 < rows) {
                    grid.baseLayer.emptyRows = [];
                    for (var i = 0; i < rows; i++) grid.baseLayer.emptyRows.push({});
                }
            }
        };
    } ]), module.directive("uiGridEmptyBaseLayer", [ "gridUtil", "uiGridBaseLayerService", "$parse", function(gridUtil, uiGridBaseLayerService, $parse) {
        return {
            require: "^uiGrid",
            scope: !1,
            compile: function($elm, $attrs) {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        var disableEmptyBaseLayer = !1 === $parse($attrs.uiGridEmptyBaseLayer)($scope);
                        uiGridBaseLayerService.initializeGrid(uiGridCtrl.grid, disableEmptyBaseLayer);
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {
                        if (uiGridCtrl.grid.options.enableEmptyGridBaseLayer) {
                            var renderBodyContainer = uiGridCtrl.grid.renderContainers.body, viewportHeight = renderBodyContainer.getViewportHeight();
                            uiGridCtrl.grid.registerStyleComputation({
                                func: function() {
                                    var newViewPortHeight;
                                    return (newViewPortHeight = renderBodyContainer.getViewportHeight()) !== viewportHeight && (viewportHeight = newViewPortHeight, 
                                    1) && uiGridBaseLayerService.setNumberOfEmptyRows(viewportHeight, uiGridCtrl.grid), 
                                    function(viewportHeight) {
                                        return ".grid" + uiGridCtrl.grid.id + " .ui-grid-render-container .ui-grid-empty-base-layer-container.ui-grid-canvas { height: " + viewportHeight + "px; }";
                                    }(viewportHeight);
                                }
                            });
                        }
                    }
                };
            }
        };
    } ]), module.directive("uiGridViewport", [ "$compile", "gridUtil", "$templateCache", function($compile, gridUtil, $templateCache) {
        return {
            priority: -200,
            scope: !1,
            compile: function($elm, $attrs) {
                var emptyBaseLayerContainer = $templateCache.get("ui-grid/emptyBaseLayerContainer");
                return $elm.prepend(emptyBaseLayerContainer), {
                    pre: function($scope, $elm, $attrs, controllers) {},
                    post: function($scope, $elm, $attrs, controllers) {}
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.expandable", [ "ui.grid" ]);
    module.service("uiGridExpandableService", [ "gridUtil", "$compile", function(gridUtil, $compile) {
        var service = {
            initializeGrid: function(grid) {
                grid.expandable = {}, grid.expandable.expandedAll = !1, grid.options.enableExpandable = !1 !== grid.options.enableExpandable, 
                grid.options.showExpandAllButton = !1 !== grid.options.showExpandAllButton, grid.options.expandableRowHeight = grid.options.expandableRowHeight || 150, 
                grid.options.expandableRowHeaderWidth = grid.options.expandableRowHeaderWidth || 40, 
                grid.options.enableExpandable && !grid.options.expandableRowTemplate && (gridUtil.logError("You have not set the expandableRowTemplate, disabling expandable module"), 
                grid.options.enableExpandable = !1);
                var publicApi = {
                    events: {
                        expandable: {
                            rowExpandedBeforeStateChanged: function(scope, row) {},
                            rowExpandedStateChanged: function(scope, row) {}
                        }
                    },
                    methods: {
                        expandable: {
                            toggleRowExpansion: function(rowEntity) {
                                var row = grid.getRow(rowEntity);
                                null !== row && service.toggleRowExpansion(grid, row);
                            },
                            expandAllRows: function() {
                                service.expandAllRows(grid);
                            },
                            collapseAllRows: function() {
                                service.collapseAllRows(grid);
                            },
                            toggleAllRows: function() {
                                service.toggleAllRows(grid);
                            },
                            expandRow: function(rowEntity) {
                                var row = grid.getRow(rowEntity);
                                null === row || row.isExpanded || service.toggleRowExpansion(grid, row);
                            },
                            collapseRow: function(rowEntity) {
                                var row = grid.getRow(rowEntity);
                                null !== row && row.isExpanded && service.toggleRowExpansion(grid, row);
                            },
                            getExpandedRows: function() {
                                return service.getExpandedRows(grid).map(function(gridRow) {
                                    return gridRow.entity;
                                });
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods);
            },
            toggleRowExpansion: function(grid, row) {
                grid.api.expandable.raise.rowExpandedBeforeStateChanged(row), row.isExpanded = !row.isExpanded, 
                angular.isUndefined(row.expandedRowHeight) && (row.expandedRowHeight = grid.options.expandableRowHeight), 
                row.isExpanded ? (row.height = row.grid.options.rowHeight + row.expandedRowHeight, 
                grid.expandable.expandedAll = service.getExpandedRows(grid).length === grid.rows.length) : (row.height = row.grid.options.rowHeight, 
                grid.expandable.expandedAll = !1), grid.api.expandable.raise.rowExpandedStateChanged(row);
            },
            expandAllRows: function(grid) {
                grid.renderContainers.body.visibleRowCache.forEach(function(row) {
                    row.isExpanded || row.entity.subGridOptions && row.entity.subGridOptions.disableRowExpandable || service.toggleRowExpansion(grid, row);
                }), grid.expandable.expandedAll = !0, grid.queueGridRefresh();
            },
            collapseAllRows: function(grid) {
                grid.renderContainers.body.visibleRowCache.forEach(function(row) {
                    row.isExpanded && service.toggleRowExpansion(grid, row);
                }), grid.expandable.expandedAll = !1, grid.queueGridRefresh();
            },
            toggleAllRows: function(grid) {
                grid.expandable.expandedAll ? service.collapseAllRows(grid) : service.expandAllRows(grid);
            },
            getExpandedRows: function(grid) {
                return grid.rows.filter(function(row) {
                    return row.isExpanded;
                });
            }
        };
        return service;
    } ]), module.directive("uiGridExpandable", [ "uiGridExpandableService", "$templateCache", function(uiGridExpandableService, $templateCache) {
        return {
            replace: !0,
            priority: 0,
            require: "^uiGrid",
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        if (uiGridExpandableService.initializeGrid(uiGridCtrl.grid), uiGridCtrl.grid.options.enableExpandable && !1 !== uiGridCtrl.grid.options.enableExpandableRowHeader) {
                            var expandableRowHeaderColDef = {
                                name: "expandableButtons",
                                displayName: "",
                                exporterSuppressExport: !0,
                                enableColumnResizing: !1,
                                enableColumnMenu: !1,
                                width: uiGridCtrl.grid.options.expandableRowHeaderWidth || 40
                            };
                            expandableRowHeaderColDef.cellTemplate = $templateCache.get("ui-grid/expandableRowHeader"), 
                            expandableRowHeaderColDef.headerCellTemplate = $templateCache.get("ui-grid/expandableTopRowHeader"), 
                            uiGridCtrl.grid.addRowHeaderColumn(expandableRowHeaderColDef, -90);
                        }
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {}
                };
            }
        };
    } ]), module.directive("uiGrid", [ "uiGridExpandableService", "$templateCache", function(uiGridExpandableService, $templateCache) {
        return {
            replace: !0,
            priority: 599,
            require: "^uiGrid",
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        uiGridCtrl.grid.api.core.on.renderingComplete($scope, function() {
                            $scope.row && $scope.row.grid && $scope.row.grid.options && $scope.row.grid.options.enableExpandable && (uiGridCtrl.grid.parentRow = $scope.row);
                        });
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {}
                };
            }
        };
    } ]), module.directive("uiGridExpandableRow", [ "uiGridExpandableService", "$timeout", "$compile", "uiGridConstants", "gridUtil", "$interval", "$log", function(uiGridExpandableService, $timeout, $compile, uiGridConstants, gridUtil, $interval, $log) {
        return {
            replace: !1,
            priority: 0,
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        gridUtil.getTemplate($scope.grid.options.expandableRowTemplate).then(function(template) {
                            if ($scope.grid.options.expandableRowScope) {
                                var expandableRowScope = $scope.grid.options.expandableRowScope;
                                for (var property in expandableRowScope) expandableRowScope.hasOwnProperty(property) && ($scope[property] = expandableRowScope[property]);
                            }
                            var expandedRowElement = angular.element(template);
                            $elm.append(expandedRowElement), expandedRowElement = $compile(expandedRowElement)($scope), 
                            $scope.row.expandedRendered = !0;
                        });
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {
                        $scope.$on("$destroy", function() {
                            $scope.row.expandedRendered = !1;
                        });
                    }
                };
            }
        };
    } ]), module.directive("uiGridRow", [ "$compile", "gridUtil", "$templateCache", function($compile, gridUtil, $templateCache) {
        return {
            priority: -200,
            scope: !1,
            compile: function($elm, $attrs) {
                return {
                    pre: function($scope, $elm, $attrs, controllers) {
                        $scope.grid.options.enableExpandable && ($scope.expandableRow = {}, $scope.expandableRow.shouldRenderExpand = function() {
                            return "body" === $scope.colContainer.name && !1 !== $scope.grid.options.enableExpandable && $scope.row.isExpanded && (!$scope.grid.isScrollingVertically || $scope.row.expandedRendered);
                        }, $scope.expandableRow.shouldRenderFiller = function() {
                            return $scope.row.isExpanded && ("body" !== $scope.colContainer.name || $scope.grid.isScrollingVertically && !$scope.row.expandedRendered);
                        });
                    },
                    post: function($scope, $elm, $attrs, controllers) {}
                };
            }
        };
    } ]), module.directive("uiGridViewport", [ "$compile", "gridUtil", "$templateCache", function($compile, gridUtil, $templateCache) {
        return {
            priority: -200,
            scope: !1,
            compile: function($elm, $attrs) {
                var rowRepeatDiv = angular.element($elm.children().children()[0]), expandedRowFillerElement = $templateCache.get("ui-grid/expandableScrollFiller"), expandedRowElement = $templateCache.get("ui-grid/expandableRow");
                return rowRepeatDiv.append(expandedRowElement), rowRepeatDiv.append(expandedRowFillerElement), 
                {
                    pre: function($scope, $elm, $attrs, controllers) {},
                    post: function($scope, $elm, $attrs, controllers) {}
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.exporter", [ "ui.grid" ]);
    module.constant("uiGridExporterConstants", {
        featureName: "exporter",
        rowHeaderColName: "treeBaseRowHeaderCol",
        selectionRowHeaderColName: "selectionRowHeaderCol",
        ALL: "all",
        VISIBLE: "visible",
        SELECTED: "selected",
        CSV_CONTENT: "CSV_CONTENT",
        BUTTON_LABEL: "BUTTON_LABEL",
        FILE_NAME: "FILE_NAME"
    }), module.service("uiGridExporterService", [ "$filter", "$q", "uiGridExporterConstants", "gridUtil", "$compile", "$interval", "i18nService", function($filter, $q, uiGridExporterConstants, gridUtil, $compile, $interval, i18nService) {
        var service = {
            delay: 100,
            initializeGrid: function(grid) {
                grid.exporter = {}, this.defaultGridOptions(grid.options);
                var publicApi = {
                    events: {
                        exporter: {}
                    },
                    methods: {
                        exporter: {
                            csvExport: function(rowTypes, colTypes) {
                                service.csvExport(grid, rowTypes, colTypes);
                            },
                            pdfExport: function(rowTypes, colTypes) {
                                service.pdfExport(grid, rowTypes, colTypes);
                            },
                            excelExport: function(rowTypes, colTypes) {
                                service.excelExport(grid, rowTypes, colTypes);
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods), 
                grid.api.core.addToGridMenu ? service.addToMenu(grid) : $interval(function() {
                    grid.api.core.addToGridMenu && service.addToMenu(grid);
                }, this.delay, 1);
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.exporterSuppressMenu = !0 === gridOptions.exporterSuppressMenu, gridOptions.exporterMenuLabel = gridOptions.exporterMenuLabel ? gridOptions.exporterMenuLabel : "Export", 
                gridOptions.exporterSuppressColumns = gridOptions.exporterSuppressColumns ? gridOptions.exporterSuppressColumns : [], 
                gridOptions.exporterCsvColumnSeparator = gridOptions.exporterCsvColumnSeparator ? gridOptions.exporterCsvColumnSeparator : ",", 
                gridOptions.exporterCsvFilename = gridOptions.exporterCsvFilename ? gridOptions.exporterCsvFilename : "download.csv", 
                gridOptions.exporterPdfFilename = gridOptions.exporterPdfFilename ? gridOptions.exporterPdfFilename : "download.pdf", 
                gridOptions.exporterExcelFilename = gridOptions.exporterExcelFilename ? gridOptions.exporterExcelFilename : "download.xlsx", 
                gridOptions.exporterExcelSheetName = gridOptions.exporterExcelSheetName ? gridOptions.exporterExcelSheetName : "Sheet1", 
                gridOptions.exporterOlderExcelCompatibility = !0 === gridOptions.exporterOlderExcelCompatibility, 
                gridOptions.exporterIsExcelCompatible = !0 === gridOptions.exporterIsExcelCompatible, 
                gridOptions.exporterMenuItemOrder = gridOptions.exporterMenuItemOrder ? gridOptions.exporterMenuItemOrder : 200, 
                gridOptions.exporterPdfDefaultStyle = gridOptions.exporterPdfDefaultStyle ? gridOptions.exporterPdfDefaultStyle : {
                    fontSize: 11
                }, gridOptions.exporterPdfTableStyle = gridOptions.exporterPdfTableStyle ? gridOptions.exporterPdfTableStyle : {
                    margin: [ 0, 5, 0, 15 ]
                }, gridOptions.exporterPdfTableHeaderStyle = gridOptions.exporterPdfTableHeaderStyle ? gridOptions.exporterPdfTableHeaderStyle : {
                    bold: !0,
                    fontSize: 12,
                    color: "black"
                }, gridOptions.exporterPdfHeader = gridOptions.exporterPdfHeader ? gridOptions.exporterPdfHeader : null, 
                gridOptions.exporterPdfFooter = gridOptions.exporterPdfFooter ? gridOptions.exporterPdfFooter : null, 
                gridOptions.exporterPdfOrientation = gridOptions.exporterPdfOrientation ? gridOptions.exporterPdfOrientation : "landscape", 
                gridOptions.exporterPdfPageSize = gridOptions.exporterPdfPageSize ? gridOptions.exporterPdfPageSize : "A4", 
                gridOptions.exporterPdfMaxGridWidth = gridOptions.exporterPdfMaxGridWidth ? gridOptions.exporterPdfMaxGridWidth : 720, 
                gridOptions.exporterMenuAllData = void 0 === gridOptions.exporterMenuAllData || gridOptions.exporterMenuAllData, 
                gridOptions.exporterMenuVisibleData = void 0 === gridOptions.exporterMenuVisibleData || gridOptions.exporterMenuVisibleData, 
                gridOptions.exporterMenuSelectedData = void 0 === gridOptions.exporterMenuSelectedData || gridOptions.exporterMenuSelectedData, 
                gridOptions.exporterMenuCsv = void 0 === gridOptions.exporterMenuCsv || gridOptions.exporterMenuCsv, 
                gridOptions.exporterMenuPdf = void 0 === gridOptions.exporterMenuPdf || gridOptions.exporterMenuPdf, 
                gridOptions.exporterMenuExcel = void 0 === gridOptions.exporterMenuExcel || gridOptions.exporterMenuExcel, 
                gridOptions.exporterPdfCustomFormatter = gridOptions.exporterPdfCustomFormatter && "function" == typeof gridOptions.exporterPdfCustomFormatter ? gridOptions.exporterPdfCustomFormatter : function(docDef) {
                    return docDef;
                }, gridOptions.exporterHeaderFilterUseName = !0 === gridOptions.exporterHeaderFilterUseName, 
                gridOptions.exporterFieldCallback = gridOptions.exporterFieldCallback ? gridOptions.exporterFieldCallback : defaultExporterFieldCallback, 
                gridOptions.exporterFieldFormatCallback = gridOptions.exporterFieldFormatCallback ? gridOptions.exporterFieldFormatCallback : function(grid, row, col, value) {
                    return null;
                }, gridOptions.exporterExcelCustomFormatters = gridOptions.exporterExcelCustomFormatters ? gridOptions.exporterExcelCustomFormatters : function(grid, workbook, docDefinition) {
                    return null;
                }, gridOptions.exporterExcelHeader = gridOptions.exporterExcelHeader ? gridOptions.exporterExcelHeader : function(grid, workbook, sheet, docDefinition) {
                    return null;
                }, gridOptions.exporterColumnScaleFactor = gridOptions.exporterColumnScaleFactor ? gridOptions.exporterColumnScaleFactor : 3.5, 
                gridOptions.exporterFieldApplyFilters = !0 === gridOptions.exporterFieldApplyFilters, 
                gridOptions.exporterAllDataFn = gridOptions.exporterAllDataFn ? gridOptions.exporterAllDataFn : null, 
                null === gridOptions.exporterAllDataFn && gridOptions.exporterAllDataPromise && (gridOptions.exporterAllDataFn = gridOptions.exporterAllDataPromise);
            },
            addToMenu: function(grid) {
                grid.api.core.addToGridMenu(grid, [ {
                    title: i18nService.getSafeText("gridMenu.exporterAllAsCsv"),
                    action: function($event) {
                        grid.api.exporter.csvExport(uiGridExporterConstants.ALL, uiGridExporterConstants.ALL);
                    },
                    shown: function() {
                        return grid.options.exporterMenuCsv && grid.options.exporterMenuAllData;
                    },
                    order: grid.options.exporterMenuItemOrder
                }, {
                    title: i18nService.getSafeText("gridMenu.exporterVisibleAsCsv"),
                    action: function($event) {
                        grid.api.exporter.csvExport(uiGridExporterConstants.VISIBLE, uiGridExporterConstants.VISIBLE);
                    },
                    shown: function() {
                        return grid.options.exporterMenuCsv && grid.options.exporterMenuVisibleData;
                    },
                    order: grid.options.exporterMenuItemOrder + 1
                }, {
                    title: i18nService.getSafeText("gridMenu.exporterSelectedAsCsv"),
                    action: function($event) {
                        grid.api.exporter.csvExport(uiGridExporterConstants.SELECTED, uiGridExporterConstants.VISIBLE);
                    },
                    shown: function() {
                        return grid.options.exporterMenuCsv && grid.options.exporterMenuSelectedData && grid.api.selection && 0 < grid.api.selection.getSelectedRows().length;
                    },
                    order: grid.options.exporterMenuItemOrder + 2
                }, {
                    title: i18nService.getSafeText("gridMenu.exporterAllAsPdf"),
                    action: function($event) {
                        grid.api.exporter.pdfExport(uiGridExporterConstants.ALL, uiGridExporterConstants.ALL);
                    },
                    shown: function() {
                        return grid.options.exporterMenuPdf && grid.options.exporterMenuAllData;
                    },
                    order: grid.options.exporterMenuItemOrder + 3
                }, {
                    title: i18nService.getSafeText("gridMenu.exporterVisibleAsPdf"),
                    action: function($event) {
                        grid.api.exporter.pdfExport(uiGridExporterConstants.VISIBLE, uiGridExporterConstants.VISIBLE);
                    },
                    shown: function() {
                        return grid.options.exporterMenuPdf && grid.options.exporterMenuVisibleData;
                    },
                    order: grid.options.exporterMenuItemOrder + 4
                }, {
                    title: i18nService.getSafeText("gridMenu.exporterSelectedAsPdf"),
                    action: function($event) {
                        grid.api.exporter.pdfExport(uiGridExporterConstants.SELECTED, uiGridExporterConstants.VISIBLE);
                    },
                    shown: function() {
                        return grid.options.exporterMenuPdf && grid.options.exporterMenuSelectedData && grid.api.selection && 0 < grid.api.selection.getSelectedRows().length;
                    },
                    order: grid.options.exporterMenuItemOrder + 5
                }, {
                    title: i18nService.getSafeText("gridMenu.exporterAllAsExcel"),
                    action: function($event) {
                        grid.api.exporter.excelExport(uiGridExporterConstants.ALL, uiGridExporterConstants.ALL);
                    },
                    shown: function() {
                        return grid.options.exporterMenuExcel && grid.options.exporterMenuAllData;
                    },
                    order: grid.options.exporterMenuItemOrder + 6
                }, {
                    title: i18nService.getSafeText("gridMenu.exporterVisibleAsExcel"),
                    action: function($event) {
                        grid.api.exporter.excelExport(uiGridExporterConstants.VISIBLE, uiGridExporterConstants.VISIBLE);
                    },
                    shown: function() {
                        return grid.options.exporterMenuExcel && grid.options.exporterMenuVisibleData;
                    },
                    order: grid.options.exporterMenuItemOrder + 7
                }, {
                    title: i18nService.getSafeText("gridMenu.exporterSelectedAsExcel"),
                    action: function($event) {
                        grid.api.exporter.excelExport(uiGridExporterConstants.SELECTED, uiGridExporterConstants.VISIBLE);
                    },
                    shown: function() {
                        return grid.options.exporterMenuExcel && grid.options.exporterMenuSelectedData && grid.api.selection && 0 < grid.api.selection.getSelectedRows().length;
                    },
                    order: grid.options.exporterMenuItemOrder + 8
                } ]);
            },
            csvExport: function(grid, rowTypes, colTypes) {
                var self = this;
                this.loadAllDataIfNeeded(grid, rowTypes, colTypes).then(function() {
                    var exportColumnHeaders = grid.options.showHeader ? self.getColumnHeaders(grid, colTypes) : [], exportData = self.getData(grid, rowTypes, colTypes), csvContent = self.formatAsCsv(exportColumnHeaders, exportData, grid.options.exporterCsvColumnSeparator);
                    self.downloadFile(grid.options.exporterCsvFilename, csvContent, grid.options.exporterCsvColumnSeparator, grid.options.exporterOlderExcelCompatibility, grid.options.exporterIsExcelCompatible);
                });
            },
            loadAllDataIfNeeded: function(grid, rowTypes, colTypes) {
                if (rowTypes === uiGridExporterConstants.ALL && grid.rows.length !== grid.options.totalItems && grid.options.exporterAllDataFn) return grid.options.exporterAllDataFn().then(function(allData) {
                    grid.modifyRows(allData);
                });
                var deferred = $q.defer();
                return deferred.resolve(), deferred.promise;
            },
            getColumnHeaders: function(grid, colTypes) {
                var columns, headers = [];
                if (colTypes === uiGridExporterConstants.ALL) columns = grid.columns; else {
                    var leftColumns = grid.renderContainers.left ? grid.renderContainers.left.visibleColumnCache.filter(function(column) {
                        return column.visible;
                    }) : [], bodyColumns = grid.renderContainers.body ? grid.renderContainers.body.visibleColumnCache.filter(function(column) {
                        return column.visible;
                    }) : [], rightColumns = grid.renderContainers.right ? grid.renderContainers.right.visibleColumnCache.filter(function(column) {
                        return column.visible;
                    }) : [];
                    columns = leftColumns.concat(bodyColumns, rightColumns);
                }
                return columns.forEach(function(gridCol) {
                    if (!0 !== gridCol.colDef.exporterSuppressExport && "$$hashKey" !== gridCol.field && -1 === grid.options.exporterSuppressColumns.indexOf(gridCol.name)) {
                        var headerEntry = {
                            name: gridCol.field,
                            displayName: function(grid, gridCol) {
                                if (grid.options.exporterHeaderFilter) return grid.options.exporterHeaderFilterUseName ? grid.options.exporterHeaderFilter(gridCol.name) : grid.options.exporterHeaderFilter(gridCol.displayName);
                                return gridCol.headerCellFilter ? $filter(gridCol.headerCellFilter)(gridCol.displayName) : gridCol.displayName;
                            }(grid, gridCol),
                            width: gridCol.drawnWidth ? gridCol.drawnWidth : gridCol.width,
                            align: gridCol.colDef.align ? gridCol.colDef.align : "number" === gridCol.colDef.type ? "right" : "left"
                        };
                        headers.push(headerEntry);
                    }
                }), headers;
            },
            getRowsFromNode: function(aNode) {
                for (var rows = [], i = 0; i < aNode.children.length; i++) if (aNode.children[i].children && 0 === aNode.children[i].children.length) rows.push(aNode.children[i]); else {
                    var nodeRows = this.getRowsFromNode(aNode.children[i]);
                    rows = rows.concat(nodeRows);
                }
                return rows;
            },
            getDataSorted: function(grid, rowTypes, colTypes, applyCellFilters) {
                if (!grid.treeBase || 0 === grid.treeBase.numberLevels) return grid.rows;
                for (var rows = [], i = 0; i < grid.treeBase.tree.length; i++) for (var nodeRows = this.getRowsFromNode(grid.treeBase.tree[i]), j = 0; j < nodeRows.length; j++) rows.push(nodeRows[j].row);
                return rows;
            },
            getData: function(grid, rowTypes, colTypes, applyCellFilters) {
                var rows, columns, data = [];
                switch (rowTypes) {
                  case uiGridExporterConstants.ALL:
                    rows = this.getDataSorted(grid, rowTypes, colTypes, applyCellFilters);
                    break;

                  case uiGridExporterConstants.VISIBLE:
                    rows = grid.getVisibleRows();
                    break;

                  case uiGridExporterConstants.SELECTED:
                    grid.api.selection ? rows = grid.api.selection.getSelectedGridRows() : gridUtil.logError("selection feature must be enabled to allow selected rows to be exported");
                }
                if (colTypes === uiGridExporterConstants.ALL) columns = grid.columns; else {
                    var leftColumns = grid.renderContainers.left ? grid.renderContainers.left.visibleColumnCache.filter(function(column) {
                        return column.visible;
                    }) : [], bodyColumns = grid.renderContainers.body ? grid.renderContainers.body.visibleColumnCache.filter(function(column) {
                        return column.visible;
                    }) : [], rightColumns = grid.renderContainers.right ? grid.renderContainers.right.visibleColumnCache.filter(function(column) {
                        return column.visible;
                    }) : [];
                    columns = leftColumns.concat(bodyColumns, rightColumns);
                }
                return rows.forEach(function(row, index) {
                    if (!1 !== row.exporterEnableExporting) {
                        var extractedRow = [];
                        columns.forEach(function(gridCol, index) {
                            if ((gridCol.visible || colTypes === uiGridExporterConstants.ALL) && !0 !== gridCol.colDef.exporterSuppressExport && "$$hashKey" !== gridCol.field && -1 === grid.options.exporterSuppressColumns.indexOf(gridCol.name)) {
                                var cellValue = applyCellFilters ? grid.getCellDisplayValue(row, gridCol) : grid.getCellValue(row, gridCol), extractedField = {
                                    value: grid.options.exporterFieldCallback(grid, row, gridCol, cellValue)
                                }, extension = grid.options.exporterFieldFormatCallback(grid, row, gridCol, cellValue);
                                extension && Object.assign(extractedField, extension), gridCol.colDef.exporterPdfAlign && (extractedField.alignment = gridCol.colDef.exporterPdfAlign), 
                                extractedRow.push(extractedField);
                            }
                        }), data.push(extractedRow);
                    }
                }), data;
            },
            formatAsCsv: function(exportColumnHeaders, exportData, separator) {
                var bareHeaders = exportColumnHeaders.map(function(header) {
                    return {
                        value: header.displayName
                    };
                }), csv = 0 < bareHeaders.length ? this.formatRowAsCsv(this, separator)(bareHeaders) + "\n" : "";
                return csv += exportData.map(this.formatRowAsCsv(this, separator)).join("\n");
            },
            formatRowAsCsv: function(exporter, separator) {
                return function(row) {
                    return row.map(exporter.formatFieldAsCsv).join(separator);
                };
            },
            formatFieldAsCsv: function(field) {
                return null == field.value ? "" : "number" == typeof field.value ? field.value : "boolean" == typeof field.value ? field.value ? "TRUE" : "FALSE" : "string" == typeof field.value ? '"' + field.value.replace(/"/g, '""') + '"' : JSON.stringify(field.value);
            },
            isIE: function() {
                var isIE = !1;
                return -1 !== navigator.userAgent.search(/(?:Edge|MSIE|Trident\/.*; rv:)/) && (isIE = !0), 
                isIE;
            },
            downloadFile: function(fileName, csvContent, columnSeparator, exporterOlderExcelCompatibility, exporterIsExcelCompatible) {
                var rawFile, D = document, a = D.createElement("a"), strMimeType = "application/octet-stream;charset=utf-8", ieVersion = this.isIE();
                if (exporterIsExcelCompatible && (csvContent = "sep=" + columnSeparator + "\r\n" + csvContent), 
                navigator.msSaveBlob) return navigator.msSaveOrOpenBlob(new Blob([ exporterOlderExcelCompatibility ? "\ufeff" : "", csvContent ], {
                    type: strMimeType
                }), fileName);
                if (ieVersion) {
                    var frame = D.createElement("iframe");
                    return document.body.appendChild(frame), frame.contentWindow.document.open("text/html", "replace"), 
                    frame.contentWindow.document.write(csvContent), frame.contentWindow.document.close(), 
                    frame.contentWindow.focus(), frame.contentWindow.document.execCommand("SaveAs", !0, fileName), 
                    document.body.removeChild(frame), !0;
                }
                if ("download" in a) {
                    var blob = new Blob([ exporterOlderExcelCompatibility ? "\ufeff" : "", csvContent ], {
                        type: strMimeType
                    });
                    rawFile = URL.createObjectURL(blob), a.setAttribute("download", fileName);
                } else rawFile = "data:" + strMimeType + "," + encodeURIComponent(csvContent), a.setAttribute("target", "_blank");
                a.href = rawFile, a.setAttribute("style", "display:none;"), D.body.appendChild(a), 
                setTimeout(function() {
                    if (a.click) a.click(); else if (document.createEvent) {
                        var eventObj = document.createEvent("MouseEvents");
                        eventObj.initEvent("click", !0, !0), a.dispatchEvent(eventObj);
                    }
                    D.body.removeChild(a);
                }, this.delay);
            },
            pdfExport: function(grid, rowTypes, colTypes) {
                var self = this;
                this.loadAllDataIfNeeded(grid, rowTypes, colTypes).then(function() {
                    var exportColumnHeaders = self.getColumnHeaders(grid, colTypes), exportData = self.getData(grid, rowTypes, colTypes), docDefinition = self.prepareAsPdf(grid, exportColumnHeaders, exportData);
                    self.isIE() || -1 !== navigator.appVersion.indexOf("Edge") ? self.downloadPDF(grid.options.exporterPdfFilename, docDefinition) : pdfMake.createPdf(docDefinition).open();
                });
            },
            downloadPDF: function(fileName, docDefinition) {
                var ieVersion, blob, D = document;
                D.createElement("a");
                ieVersion = this.isIE(), pdfMake.createPdf(docDefinition).getBuffer(function(buffer) {
                    if (blob = new Blob([ buffer ]), navigator.msSaveBlob) return navigator.msSaveBlob(blob, fileName);
                    if (ieVersion) {
                        var frame = D.createElement("iframe");
                        return document.body.appendChild(frame), frame.contentWindow.document.open("text/html", "replace"), 
                        frame.contentWindow.document.write(blob), frame.contentWindow.document.close(), 
                        frame.contentWindow.focus(), frame.contentWindow.document.execCommand("SaveAs", !0, fileName), 
                        document.body.removeChild(frame), !0;
                    }
                });
            },
            prepareAsPdf: function(grid, exportColumnHeaders, exportData) {
                var headerWidths = this.calculatePdfHeaderWidths(grid, exportColumnHeaders), headerColumns = exportColumnHeaders.map(function(header) {
                    return {
                        text: header.displayName,
                        style: "tableHeader"
                    };
                }), stringData = exportData.map(this.formatRowAsPdf(this)), allData = [ headerColumns ].concat(stringData), docDefinition = {
                    pageOrientation: grid.options.exporterPdfOrientation,
                    pageSize: grid.options.exporterPdfPageSize,
                    content: [ {
                        style: "tableStyle",
                        table: {
                            headerRows: 1,
                            widths: headerWidths,
                            body: allData
                        }
                    } ],
                    styles: {
                        tableStyle: grid.options.exporterPdfTableStyle,
                        tableHeader: grid.options.exporterPdfTableHeaderStyle
                    },
                    defaultStyle: grid.options.exporterPdfDefaultStyle
                };
                return grid.options.exporterPdfLayout && (docDefinition.layout = grid.options.exporterPdfLayout), 
                grid.options.exporterPdfHeader && (docDefinition.header = grid.options.exporterPdfHeader), 
                grid.options.exporterPdfFooter && (docDefinition.footer = grid.options.exporterPdfFooter), 
                grid.options.exporterPdfCustomFormatter && (docDefinition = grid.options.exporterPdfCustomFormatter(docDefinition)), 
                docDefinition;
            },
            calculatePdfHeaderWidths: function(grid, exportHeaders) {
                var baseGridWidth = 0;
                exportHeaders.forEach(function(value) {
                    "number" == typeof value.width && (baseGridWidth += value.width);
                });
                var extraColumns = 0;
                exportHeaders.forEach(function(value) {
                    if ("*" === value.width && (extraColumns += 100), "string" == typeof value.width && value.width.match(/(\d)*%/)) {
                        var percent = parseInt(value.width.match(/(\d)*%/)[0]);
                        value.width = baseGridWidth * percent / 100, extraColumns += value.width;
                    }
                });
                var gridWidth = baseGridWidth + extraColumns;
                return exportHeaders.map(function(header) {
                    return "*" === header.width ? header.width : header.width * grid.options.exporterPdfMaxGridWidth / gridWidth;
                });
            },
            formatRowAsPdf: function(exporter) {
                return function(row) {
                    return row.map(exporter.formatFieldAsPdfString);
                };
            },
            formatFieldAsPdfString: function(field) {
                var returnVal;
                return returnVal = null == field.value ? "" : "number" == typeof field.value ? field.value.toString() : "boolean" == typeof field.value ? field.value ? "TRUE" : "FALSE" : "string" == typeof field.value ? field.value.replace(/"/g, '""') : field.value instanceof Date ? JSON.stringify(field.value).replace(/^"/, "").replace(/"$/, "") : "object" == typeof field.value ? field.value : JSON.stringify(field.value).replace(/^"/, "").replace(/"$/, ""), 
                field.alignment && "string" == typeof field.alignment && (returnVal = {
                    text: returnVal,
                    alignment: field.alignment
                }), returnVal;
            },
            formatAsExcel: function(exportColumnHeaders, exportData, workbook, sheet, docDefinition) {
                for (var bareHeaders = exportColumnHeaders.map(function(header) {
                    return {
                        value: header.displayName
                    };
                }), sheetData = [], headerData = [], i = 0; i < bareHeaders.length; i++) {
                    var exportStyle = "header";
                    switch (exportColumnHeaders[i].align) {
                      case "center":
                        exportStyle = "headerCenter";
                        break;

                      case "right":
                        exportStyle = "headerRight";
                    }
                    var metadata = docDefinition.styles && docDefinition.styles[exportStyle] ? {
                        style: docDefinition.styles[exportStyle].id
                    } : null;
                    headerData.push({
                        value: bareHeaders[i].value,
                        metadata: metadata
                    });
                }
                sheetData.push(headerData);
                for (var result = exportData.map(this.formatRowAsExcel(this, workbook, sheet)), j = 0; j < result.length; j++) sheetData.push(result[j]);
                return sheetData;
            },
            formatRowAsExcel: function(exporter, workbook, sheet) {
                return function(row) {
                    for (var values = [], i = 0; i < row.length; i++) {
                        var value = exporter.formatFieldAsExcel(row[i], workbook, sheet);
                        values.push({
                            value: value,
                            metadata: row[i].metadata
                        });
                    }
                    return values;
                };
            },
            formatFieldAsExcel: function(field, workbook, sheet, formatters) {
                return null == field.value ? "" : "number" == typeof field.value ? field.value : "boolean" == typeof field.value ? field.value ? "TRUE" : "FALSE" : "string" == typeof field.value ? field.value.replace(/"/g, '""') : JSON.stringify(field.value);
            },
            prepareAsExcel: function(grid, workbook, sheet) {
                var docDefinition = {
                    styles: {}
                };
                if (grid.options.exporterExcelCustomFormatters && (docDefinition = grid.options.exporterExcelCustomFormatters(grid, workbook, docDefinition)), 
                grid.options.exporterExcelHeader) if (angular.isFunction(grid.options.exporterExcelHeader)) grid.options.exporterExcelHeader(grid, workbook, sheet, docDefinition); else {
                    var headerText = grid.options.exporterExcelHeader.text, style = grid.options.exporterExcelHeader.style;
                    sheet.data.push([ {
                        value: headerText,
                        metadata: {
                            style: docDefinition.styles[style].id
                        }
                    } ]);
                }
                return docDefinition;
            },
            excelExport: function(grid, rowTypes, colTypes) {
                var self = this;
                this.loadAllDataIfNeeded(grid, rowTypes, colTypes).then(function() {
                    var exportColumnHeaders = grid.options.showHeader ? self.getColumnHeaders(grid, colTypes) : [], workbook = new ExcelBuilder.Workbook(), aName = grid.options.exporterExcelSheetName ? grid.options.exporterExcelSheetName : "Sheet1", sheet = new ExcelBuilder.Worksheet({
                        name: aName
                    });
                    workbook.addWorksheet(sheet);
                    for (var docDefinition = self.prepareAsExcel(grid, workbook, sheet), colWidths = [], i = grid.treeBase ? grid.treeBase.numberLevels : grid.enableRowSelection ? 1 : 0; i < grid.columns.length; i++) grid.columns[i].field !== uiGridExporterConstants.rowHeaderColName && grid.columns[i].field !== uiGridExporterConstants.selectionRowHeaderColName && colWidths.push({
                        width: grid.columns[i].drawnWidth / grid.options.exporterColumnScaleFactor
                    });
                    sheet.setColumns(colWidths);
                    var exportData = self.getData(grid, rowTypes, colTypes, grid.options.exporterFieldApplyFilters), excelContent = self.formatAsExcel(exportColumnHeaders, exportData, workbook, sheet, docDefinition);
                    sheet.setData(sheet.data.concat(excelContent)), ExcelBuilder.Builder.createFile(workbook, {
                        type: "blob"
                    }).then(function(result) {
                        self.downloadFile(grid.options.exporterExcelFilename, result, grid.options.exporterCsvColumnSeparator, grid.options.exporterOlderExcelCompatibility);
                    });
                });
            }
        };
        function defaultExporterFieldCallback(grid, row, col, value) {
            return col.cellFilter ? $filter(col.cellFilter.split(":")[0].trim())(value) : value;
        }
        return service;
    } ]), module.directive("uiGridExporter", [ "uiGridExporterConstants", "uiGridExporterService", "gridUtil", "$compile", function(uiGridExporterConstants, uiGridExporterService, gridUtil, $compile) {
        return {
            replace: !0,
            priority: 0,
            require: "^uiGrid",
            scope: !1,
            link: function($scope, $elm, $attrs, uiGridCtrl) {
                uiGridExporterService.initializeGrid(uiGridCtrl.grid), uiGridCtrl.grid.exporter.$scope = $scope;
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.grouping", [ "ui.grid", "ui.grid.treeBase" ]);
    module.constant("uiGridGroupingConstants", {
        featureName: "grouping",
        rowHeaderColName: "treeBaseRowHeaderCol",
        EXPANDED: "expanded",
        COLLAPSED: "collapsed",
        aggregation: {
            COUNT: "count",
            SUM: "sum",
            MAX: "max",
            MIN: "min",
            AVG: "avg"
        }
    }), module.service("uiGridGroupingService", [ "$q", "uiGridGroupingConstants", "gridUtil", "rowSorter", "GridRow", "gridClassFactory", "i18nService", "uiGridConstants", "uiGridTreeBaseService", function($q, uiGridGroupingConstants, gridUtil, rowSorter, GridRow, gridClassFactory, i18nService, uiGridConstants, uiGridTreeBaseService) {
        var service = {
            initializeGrid: function(grid, $scope) {
                uiGridTreeBaseService.initializeGrid(grid, $scope), grid.grouping = {}, grid.grouping.groupHeaderCache = {}, 
                service.defaultGridOptions(grid.options), grid.registerRowsProcessor(service.groupRows, 400), 
                grid.registerColumnBuilder(service.groupingColumnBuilder), grid.registerColumnsProcessor(service.groupingColumnProcessor, 400);
                var publicApi = {
                    events: {
                        grouping: {
                            aggregationChanged: {},
                            groupingChanged: {}
                        }
                    },
                    methods: {
                        grouping: {
                            getGrouping: function(getExpanded) {
                                var grouping = service.getGrouping(grid);
                                return grouping.grouping.forEach(function(group) {
                                    group.colName = group.col.name, delete group.col;
                                }), grouping.aggregations.forEach(function(aggregation) {
                                    aggregation.colName = aggregation.col.name, delete aggregation.col;
                                }), grouping.aggregations = grouping.aggregations.filter(function(aggregation) {
                                    return !aggregation.aggregation.source || "grouping" !== aggregation.aggregation.source;
                                }), getExpanded && (grouping.rowExpandedStates = service.getRowExpandedStates(grid.grouping.groupingHeaderCache)), 
                                grouping;
                            },
                            setGrouping: function(config) {
                                service.setGrouping(grid, config);
                            },
                            groupColumn: function(columnName) {
                                var column = grid.getColumn(columnName);
                                service.groupColumn(grid, column);
                            },
                            ungroupColumn: function(columnName) {
                                var column = grid.getColumn(columnName);
                                service.ungroupColumn(grid, column);
                            },
                            clearGrouping: function() {
                                service.clearGrouping(grid);
                            },
                            aggregateColumn: function(columnName, aggregationDef, aggregationLabel) {
                                var column = grid.getColumn(columnName);
                                service.aggregateColumn(grid, column, aggregationDef, aggregationLabel);
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods), 
                grid.api.core.on.sortChanged($scope, service.tidyPriorities);
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.enableGrouping = !1 !== gridOptions.enableGrouping, gridOptions.groupingShowCounts = !1 !== gridOptions.groupingShowCounts, 
                gridOptions.groupingNullLabel = void 0 === gridOptions.groupingNullLabel ? "Null" : gridOptions.groupingNullLabel, 
                gridOptions.enableGroupHeaderSelection = !0 === gridOptions.enableGroupHeaderSelection;
            },
            groupingColumnBuilder: function(colDef, col, gridOptions) {
                if (!1 !== colDef.enableGrouping) {
                    void 0 === col.grouping && void 0 !== colDef.grouping ? (col.grouping = angular.copy(colDef.grouping), 
                    void 0 !== col.grouping.groupPriority && -1 < col.grouping.groupPriority && (col.treeAggregationFn = uiGridTreeBaseService.nativeAggregations()[uiGridGroupingConstants.aggregation.COUNT].aggregationFn, 
                    col.treeAggregationFinalizerFn = service.groupedFinalizerFn)) : void 0 === col.grouping && (col.grouping = {}), 
                    void 0 !== col.grouping && void 0 !== col.grouping.groupPriority && 0 <= col.grouping.groupPriority && (col.suppressRemoveSort = !0);
                    var groupColumn = {
                        name: "ui.grid.grouping.group",
                        title: i18nService.get().grouping.group,
                        icon: "ui-grid-icon-indent-right",
                        shown: function() {
                            return void 0 === this.context.col.grouping || void 0 === this.context.col.grouping.groupPriority || this.context.col.grouping.groupPriority < 0;
                        },
                        action: function() {
                            service.groupColumn(this.context.col.grid, this.context.col);
                        }
                    }, ungroupColumn = {
                        name: "ui.grid.grouping.ungroup",
                        title: i18nService.get().grouping.ungroup,
                        icon: "ui-grid-icon-indent-left",
                        shown: function() {
                            return void 0 !== this.context.col.grouping && void 0 !== this.context.col.grouping.groupPriority && 0 <= this.context.col.grouping.groupPriority;
                        },
                        action: function() {
                            service.ungroupColumn(this.context.col.grid, this.context.col);
                        }
                    }, aggregateRemove = {
                        name: "ui.grid.grouping.aggregateRemove",
                        title: i18nService.get().grouping.aggregate_remove,
                        shown: function() {
                            return void 0 !== this.context.col.treeAggregationFn;
                        },
                        action: function() {
                            service.aggregateColumn(this.context.col.grid, this.context.col, null);
                        }
                    }, addAggregationMenu = function(type, title) {
                        title = title || i18nService.get().grouping["aggregate_" + type] || type;
                        var menuItem = {
                            name: "ui.grid.grouping.aggregate" + type,
                            title: title,
                            shown: function() {
                                return void 0 === this.context.col.treeAggregation || void 0 === this.context.col.treeAggregation.type || this.context.col.treeAggregation.type !== type;
                            },
                            action: function() {
                                service.aggregateColumn(this.context.col.grid, this.context.col, type);
                            }
                        };
                        gridUtil.arrayContainsObjectWithProperty(col.menuItems, "name", "ui.grid.grouping.aggregate" + type) || col.menuItems.push(menuItem);
                    };
                    !1 !== col.colDef.groupingShowGroupingMenu && (gridUtil.arrayContainsObjectWithProperty(col.menuItems, "name", "ui.grid.grouping.group") || col.menuItems.push(groupColumn), 
                    gridUtil.arrayContainsObjectWithProperty(col.menuItems, "name", "ui.grid.grouping.ungroup") || col.menuItems.push(ungroupColumn)), 
                    !1 !== col.colDef.groupingShowAggregationMenu && (angular.forEach(uiGridTreeBaseService.nativeAggregations(), function(aggregationDef, name) {
                        addAggregationMenu(name);
                    }), angular.forEach(gridOptions.treeCustomAggregations, function(aggregationDef, name) {
                        addAggregationMenu(name, aggregationDef.menuTitle);
                    }), gridUtil.arrayContainsObjectWithProperty(col.menuItems, "name", "ui.grid.grouping.aggregateRemove") || col.menuItems.push(aggregateRemove));
                }
            },
            groupingColumnProcessor: function(columns, rows) {
                return columns = service.moveGroupColumns(this, columns, rows);
            },
            groupedFinalizerFn: function(aggregation) {
                void 0 !== aggregation.groupVal ? (aggregation.rendered = aggregation.groupVal, 
                this.grid.options.groupingShowCounts && "date" !== this.colDef.type && "object" !== this.colDef.type && (aggregation.rendered += " (" + aggregation.value + ")")) : aggregation.rendered = null;
            },
            moveGroupColumns: function(grid, columns, rows) {
                return !1 === grid.options.moveGroupColumns || (columns.forEach(function(column, index) {
                    column.groupingPosition = index;
                }), columns.sort(function(a, b) {
                    var a_group, b_group;
                    return a_group = a.isRowHeader ? a.headerPriority : void 0 === a.grouping || void 0 === a.grouping.groupPriority || a.grouping.groupPriority < 0 ? null : a.grouping.groupPriority, 
                    b_group = b.isRowHeader ? b.headerPriority : void 0 === b.grouping || void 0 === b.grouping.groupPriority || b.grouping.groupPriority < 0 ? null : b.grouping.groupPriority, 
                    null !== a_group && null === b_group ? -1 : null !== b_group && null === a_group ? 1 : null !== a_group && null !== b_group ? a_group - b_group : a.groupingPosition - b.groupingPosition;
                }), columns.forEach(function(column, index) {
                    delete column.groupingPosition;
                })), columns;
            },
            groupColumn: function(grid, column) {
                void 0 === column.grouping && (column.grouping = {});
                var existingGrouping = service.getGrouping(grid);
                column.grouping.groupPriority = existingGrouping.grouping.length, column.previousSort = angular.copy(column.sort), 
                column.sort ? void 0 !== column.sort.direction && null !== column.sort.direction || (column.sort.direction = uiGridConstants.ASC) : column.sort = {
                    direction: uiGridConstants.ASC
                }, column.treeAggregation = {
                    type: uiGridGroupingConstants.aggregation.COUNT,
                    source: "grouping"
                }, column.treeAggregationFn = uiGridTreeBaseService.nativeAggregations()[uiGridGroupingConstants.aggregation.COUNT].aggregationFn, 
                column.treeAggregationFinalizerFn = service.groupedFinalizerFn, grid.api.grouping.raise.groupingChanged(column), 
                grid.api.core.raise.sortChanged(grid, grid.getColumnSorting()), grid.queueGridRefresh();
            },
            ungroupColumn: function(grid, column) {
                void 0 !== column.grouping && (delete column.grouping.groupPriority, delete column.treeAggregation, 
                delete column.customTreeAggregationFinalizer, column.previousSort && (column.sort = column.previousSort, 
                delete column.previousSort), service.tidyPriorities(grid), grid.api.grouping.raise.groupingChanged(column), 
                grid.api.core.raise.sortChanged(grid, grid.getColumnSorting()), grid.queueGridRefresh());
            },
            aggregateColumn: function(grid, column, aggregationType) {
                void 0 !== column.grouping && void 0 !== column.grouping.groupPriority && 0 <= column.grouping.groupPriority && service.ungroupColumn(grid, column);
                var aggregationDef = {};
                void 0 !== grid.options.treeCustomAggregations[aggregationType] ? aggregationDef = grid.options.treeCustomAggregations[aggregationType] : void 0 !== uiGridTreeBaseService.nativeAggregations()[aggregationType] && (aggregationDef = uiGridTreeBaseService.nativeAggregations()[aggregationType]), 
                column.treeAggregation = {
                    type: aggregationType,
                    label: i18nService.get().aggregation[aggregationDef.label] || aggregationDef.label
                }, column.treeAggregationFn = aggregationDef.aggregationFn, column.treeAggregationFinalizerFn = aggregationDef.finalizerFn, 
                grid.api.grouping.raise.aggregationChanged(column), grid.queueGridRefresh();
            },
            setGrouping: function(grid, config) {
                void 0 !== config && (service.clearGrouping(grid), config.grouping && config.grouping.length && 0 < config.grouping.length && config.grouping.forEach(function(group) {
                    var col = grid.getColumn(group.colName);
                    col && service.groupColumn(grid, col);
                }), config.aggregations && config.aggregations.length && config.aggregations.forEach(function(aggregation) {
                    var col = grid.getColumn(aggregation.colName);
                    col && service.aggregateColumn(grid, col, aggregation.aggregation.type);
                }), config.rowExpandedStates && service.applyRowExpandedStates(grid.grouping.groupingHeaderCache, config.rowExpandedStates));
            },
            clearGrouping: function(grid) {
                var currentGrouping = service.getGrouping(grid);
                0 < currentGrouping.grouping.length && currentGrouping.grouping.forEach(function(group) {
                    group.col || (group.col = grid.getColumn(group.colName)), service.ungroupColumn(grid, group.col);
                }), 0 < currentGrouping.aggregations.length && currentGrouping.aggregations.forEach(function(aggregation) {
                    aggregation.col || (aggregation.col = grid.getColumn(aggregation.colName)), service.aggregateColumn(grid, aggregation.col, null);
                });
            },
            tidyPriorities: function(grid) {
                void 0 !== grid && void 0 === grid.grid || void 0 === this.grid || (grid = this.grid);
                var groupArray = [], sortArray = [];
                grid.columns.forEach(function(column, index) {
                    void 0 !== column.grouping && void 0 !== column.grouping.groupPriority && 0 <= column.grouping.groupPriority ? groupArray.push(column) : void 0 !== column.sort && void 0 !== column.sort.priority && 0 <= column.sort.priority && sortArray.push(column);
                }), groupArray.sort(function(a, b) {
                    return a.grouping.groupPriority - b.grouping.groupPriority;
                }), groupArray.forEach(function(column, index) {
                    column.grouping.groupPriority = index, column.suppressRemoveSort = !0, void 0 === column.sort && (column.sort = {}), 
                    column.sort.priority = index;
                });
                var i = groupArray.length;
                sortArray.sort(function(a, b) {
                    return a.sort.priority - b.sort.priority;
                }), sortArray.forEach(function(column, index) {
                    column.sort.priority = i, column.suppressRemoveSort = column.colDef.suppressRemoveSort, 
                    i++;
                });
            },
            groupRows: function(renderableRows) {
                if (0 === renderableRows.length) return renderableRows;
                var grid = this;
                grid.grouping.oldGroupingHeaderCache = grid.grouping.groupingHeaderCache || {}, 
                grid.grouping.groupingHeaderCache = {};
                for (var processingState = service.initialiseProcessingState(grid), updateProcessingState = function(groupFieldState, stateIndex) {
                    var fieldValue = grid.getCellValue(row, groupFieldState.col);
                    groupFieldState.initialised && 0 === rowSorter.getSortFn(grid, groupFieldState.col, renderableRows)(fieldValue, groupFieldState.currentValue) || (service.insertGroupHeader(grid, renderableRows, i, processingState, stateIndex), 
                    i++);
                }, i = 0; i < renderableRows.length; i++) {
                    var row = renderableRows[i];
                    row.visible && processingState.forEach(updateProcessingState);
                }
                return delete grid.grouping.oldGroupingHeaderCache, renderableRows;
            },
            initialiseProcessingState: function(grid) {
                var processingState = [];
                return service.getGrouping(grid).grouping.forEach(function(groupItem, index) {
                    processingState.push({
                        fieldName: groupItem.field,
                        col: groupItem.col,
                        initialised: !1,
                        currentValue: null,
                        currentRow: null
                    });
                }), processingState;
            },
            getGrouping: function(grid) {
                var groupArray = [], aggregateArray = [];
                return grid.columns.forEach(function(column, columnIndex) {
                    column.grouping && void 0 !== column.grouping.groupPriority && 0 <= column.grouping.groupPriority && groupArray.push({
                        field: column.field,
                        col: column,
                        groupPriority: column.grouping.groupPriority,
                        grouping: column.grouping
                    }), column.treeAggregation && column.treeAggregation.type && aggregateArray.push({
                        field: column.field,
                        col: column,
                        aggregation: column.treeAggregation
                    });
                }), groupArray.sort(function(a, b) {
                    return a.groupPriority - b.groupPriority;
                }), groupArray.forEach(function(group, index) {
                    group.grouping.groupPriority = index, group.groupPriority = index, delete group.grouping;
                }), {
                    grouping: groupArray,
                    aggregations: aggregateArray
                };
            },
            insertGroupHeader: function(grid, renderableRows, rowIndex, processingState, stateIndex) {
                processingState[stateIndex].fieldName;
                var col = processingState[stateIndex].col, newValue = grid.getCellValue(renderableRows[rowIndex], col), newDisplayValue = newValue;
                null == newValue && (newDisplayValue = grid.options.groupingNullLabel);
                for (var headerRow, getKeyAsValueForCacheMap = function(key) {
                    return angular.isObject(key) ? JSON.stringify(key) : key;
                }, cacheItem = grid.grouping.oldGroupingHeaderCache, i = 0; i < stateIndex; i++) cacheItem && cacheItem[getKeyAsValueForCacheMap(processingState[i].currentValue)] && (cacheItem = cacheItem[getKeyAsValueForCacheMap(processingState[i].currentValue)].children);
                for (cacheItem && cacheItem[getKeyAsValueForCacheMap(newValue)] ? (headerRow = cacheItem[getKeyAsValueForCacheMap(newValue)].row).entity = {} : (headerRow = new GridRow({}, null, grid), 
                gridClassFactory.rowTemplateAssigner.call(grid, headerRow)), headerRow.entity["$$" + processingState[stateIndex].col.uid] = {
                    groupVal: newDisplayValue
                }, headerRow.treeLevel = stateIndex, headerRow.groupHeader = !0, headerRow.internalRow = !0, 
                headerRow.enableCellEdit = !1, headerRow.enableSelection = grid.options.enableGroupHeaderSelection, 
                processingState[stateIndex].initialised = !0, processingState[stateIndex].currentValue = newValue, 
                processingState[stateIndex].currentRow = headerRow, service.finaliseProcessingState(processingState, stateIndex + 1), 
                renderableRows.splice(rowIndex, 0, headerRow), cacheItem = grid.grouping.groupingHeaderCache, 
                i = 0; i < stateIndex; i++) cacheItem = cacheItem[getKeyAsValueForCacheMap(processingState[i].currentValue)].children;
                cacheItem[getKeyAsValueForCacheMap(newValue)] = {
                    row: headerRow,
                    children: {}
                };
            },
            finaliseProcessingState: function(processingState, stateIndex) {
                for (var i = stateIndex; i < processingState.length; i++) processingState[i].initialised = !1, 
                processingState[i].currentRow = null, processingState[i].currentValue = null;
            },
            getRowExpandedStates: function(treeChildren) {
                if (void 0 === treeChildren) return {};
                var newChildren = {};
                return angular.forEach(treeChildren, function(value, key) {
                    newChildren[key] = {
                        state: value.row.treeNode.state
                    }, value.children ? newChildren[key].children = service.getRowExpandedStates(value.children) : newChildren[key].children = {};
                }), newChildren;
            },
            applyRowExpandedStates: function(currentNode, expandedStates) {
                void 0 !== expandedStates && angular.forEach(expandedStates, function(value, key) {
                    currentNode[key] && (currentNode[key].row.treeNode.state = value.state, value.children && currentNode[key].children && service.applyRowExpandedStates(currentNode[key].children, value.children));
                });
            }
        };
        return service;
    } ]), module.directive("uiGridGrouping", [ "uiGridGroupingConstants", "uiGridGroupingService", function(uiGridGroupingConstants, uiGridGroupingService) {
        return {
            replace: !0,
            priority: 0,
            require: "^uiGrid",
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        !1 !== uiGridCtrl.grid.options.enableGrouping && uiGridGroupingService.initializeGrid(uiGridCtrl.grid, $scope);
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {}
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.importer", [ "ui.grid" ]);
    module.constant("uiGridImporterConstants", {
        featureName: "importer"
    }), module.service("uiGridImporterService", [ "$q", "uiGridConstants", "uiGridImporterConstants", "gridUtil", "$compile", "$interval", "i18nService", "$window", function($q, uiGridConstants, uiGridImporterConstants, gridUtil, $compile, $interval, i18nService, $window) {
        var service = {
            initializeGrid: function($scope, grid) {
                grid.importer = {
                    $scope: $scope
                }, this.defaultGridOptions(grid.options);
                var publicApi = {
                    events: {
                        importer: {}
                    },
                    methods: {
                        importer: {
                            importFile: function(fileObject) {
                                service.importThisFile(grid, fileObject);
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods), 
                grid.options.enableImporter && grid.options.importerShowMenu && (grid.api.core.addToGridMenu ? service.addToMenu(grid) : $interval(function() {
                    grid.api.core.addToGridMenu && service.addToMenu(grid);
                }, 100, 1));
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.enableImporter || void 0 === gridOptions.enableImporter ? $window.hasOwnProperty("File") && $window.hasOwnProperty("FileReader") && $window.hasOwnProperty("FileList") && $window.hasOwnProperty("Blob") ? gridOptions.enableImporter = !0 : (gridUtil.logError("The File APIs are not fully supported in this browser, grid importer cannot be used."), 
                gridOptions.enableImporter = !1) : gridOptions.enableImporter = !1, gridOptions.importerProcessHeaders = gridOptions.importerProcessHeaders || service.processHeaders, 
                gridOptions.importerHeaderFilter = gridOptions.importerHeaderFilter || function(displayName) {
                    return displayName;
                }, gridOptions.importerErrorCallback && "function" == typeof gridOptions.importerErrorCallback || delete gridOptions.importerErrorCallback, 
                !0 !== gridOptions.enableImporter || gridOptions.importerDataAddCallback || (gridUtil.logError("You have not set an importerDataAddCallback, importer is disabled"), 
                gridOptions.enableImporter = !1), gridOptions.importerShowMenu = !1 !== gridOptions.importerShowMenu, 
                gridOptions.importerObjectCallback = gridOptions.importerObjectCallback || function(grid, newObject) {
                    return newObject;
                };
            },
            addToMenu: function(grid) {
                grid.api.core.addToGridMenu(grid, [ {
                    title: i18nService.getSafeText("gridMenu.importerTitle"),
                    order: 150
                }, {
                    templateUrl: "ui-grid/importerMenuItemContainer",
                    action: function($event) {
                        this.grid.api.importer.importAFile(grid);
                    },
                    order: 151
                } ]);
            },
            importThisFile: function(grid, fileObject) {
                if (fileObject) {
                    var reader = new FileReader();
                    switch (fileObject.type) {
                      case "application/json":
                        reader.onload = service.importJsonClosure(grid);
                        break;

                      default:
                        reader.onload = service.importCsvClosure(grid);
                    }
                    reader.readAsText(fileObject);
                } else gridUtil.logError("No file object provided to importThisFile, should be impossible, aborting");
            },
            importJsonClosure: function(grid) {
                return function(importFile) {
                    var newObject, newObjects = [], importArray = service.parseJson(grid, importFile);
                    null !== importArray && (importArray.forEach(function(value, index) {
                        newObject = service.newObject(grid), angular.extend(newObject, value), newObject = grid.options.importerObjectCallback(grid, newObject), 
                        newObjects.push(newObject);
                    }), service.addObjects(grid, newObjects));
                };
            },
            parseJson: function(grid, importFile) {
                var loadedObjects;
                try {
                    loadedObjects = JSON.parse(importFile.target.result);
                } catch (e) {
                    return void service.alertError(grid, "importer.invalidJson", "File could not be processed, is it valid json? Content was: ", importFile.target.result);
                }
                return Array.isArray(loadedObjects) ? loadedObjects : (service.alertError(grid, "importer.jsonNotarray", "Import failed, file is not an array, file was: ", importFile.target.result), 
                []);
            },
            importCsvClosure: function(grid) {
                return function(importFile) {
                    var importArray = service.parseCsv(importFile);
                    if (!importArray || importArray.length < 1) service.alertError(grid, "importer.invalidCsv", "File could not be processed, is it valid csv? Content was: ", importFile.target.result); else {
                        var newObjects = service.createCsvObjects(grid, importArray);
                        newObjects && 0 !== newObjects.length ? service.addObjects(grid, newObjects) : service.alertError(grid, "importer.noObjects", "Objects were not able to be derived, content was: ", importFile.target.result);
                    }
                };
            },
            parseCsv: function(importFile) {
                var csv = importFile.target.result;
                return CSV.parse(csv);
            },
            createCsvObjects: function(grid, importArray) {
                var headerMapping = grid.options.importerProcessHeaders(grid, importArray.shift());
                if (!headerMapping || 0 === headerMapping.length) return service.alertError(grid, "importer.noHeaders", "Column names could not be derived, content was: ", importArray), 
                [];
                var newObject, newObjects = [];
                return importArray.forEach(function(row, index) {
                    newObject = service.newObject(grid), null !== row && row.forEach(function(field, index) {
                        null !== headerMapping[index] && (newObject[headerMapping[index]] = field);
                    }), newObject = grid.options.importerObjectCallback(grid, newObject), newObjects.push(newObject);
                }), newObjects;
            },
            processHeaders: function(grid, headerRow) {
                var headers = [];
                if (grid.options.columnDefs && 0 !== grid.options.columnDefs.length) {
                    var lookupHash = service.flattenColumnDefs(grid, grid.options.columnDefs);
                    return headerRow.forEach(function(value, index) {
                        lookupHash[value] ? headers.push(lookupHash[value]) : lookupHash[value.toLowerCase()] ? headers.push(lookupHash[value.toLowerCase()]) : headers.push(null);
                    }), headers;
                }
                return headerRow.forEach(function(value, index) {
                    headers.push(value.replace(/[^0-9a-zA-Z\-_]/g, "_"));
                }), headers;
            },
            flattenColumnDefs: function(grid, columnDefs) {
                var flattenedHash = {};
                return columnDefs.forEach(function(columnDef, index) {
                    columnDef.name && (flattenedHash[columnDef.name] = columnDef.field || columnDef.name, 
                    flattenedHash[columnDef.name.toLowerCase()] = columnDef.field || columnDef.name), 
                    columnDef.field && (flattenedHash[columnDef.field] = columnDef.field || columnDef.name, 
                    flattenedHash[columnDef.field.toLowerCase()] = columnDef.field || columnDef.name), 
                    columnDef.displayName && (flattenedHash[columnDef.displayName] = columnDef.field || columnDef.name, 
                    flattenedHash[columnDef.displayName.toLowerCase()] = columnDef.field || columnDef.name), 
                    columnDef.displayName && grid.options.importerHeaderFilter && (flattenedHash[grid.options.importerHeaderFilter(columnDef.displayName)] = columnDef.field || columnDef.name, 
                    flattenedHash[grid.options.importerHeaderFilter(columnDef.displayName).toLowerCase()] = columnDef.field || columnDef.name);
                }), flattenedHash;
            },
            addObjects: function(grid, newObjects, $scope) {
                if (grid.api.rowEdit) {
                    var dataChangeDereg = grid.registerDataChangeCallback(function() {
                        grid.api.rowEdit.setRowsDirty(newObjects), dataChangeDereg();
                    }, [ uiGridConstants.dataChange.ROW ]);
                    grid.importer.$scope.$on("$destroy", dataChangeDereg);
                }
                grid.importer.$scope.$apply(grid.options.importerDataAddCallback(grid, newObjects));
            },
            newObject: function(grid) {
                return void 0 !== grid.options && void 0 !== grid.options.importerNewObject ? new grid.options.importerNewObject() : {};
            },
            alertError: function(grid, alertI18nToken, consoleMessage, context) {
                grid.options.importerErrorCallback ? grid.options.importerErrorCallback(grid, alertI18nToken, consoleMessage, context) : ($window.alert(i18nService.getSafeText(alertI18nToken)), 
                gridUtil.logError(consoleMessage + context));
            }
        };
        return service;
    } ]), module.directive("uiGridImporter", [ "uiGridImporterConstants", "uiGridImporterService", "gridUtil", "$compile", function(uiGridImporterConstants, uiGridImporterService, gridUtil, $compile) {
        return {
            replace: !0,
            priority: 0,
            require: "^uiGrid",
            scope: !1,
            link: function($scope, $elm, $attrs, uiGridCtrl) {
                uiGridImporterService.initializeGrid($scope, uiGridCtrl.grid);
            }
        };
    } ]), module.directive("uiGridImporterMenuItem", [ "uiGridImporterConstants", "uiGridImporterService", "gridUtil", "$compile", function(uiGridImporterConstants, uiGridImporterService, gridUtil, $compile) {
        return {
            replace: !0,
            priority: 0,
            require: "?^uiGrid",
            scope: !1,
            templateUrl: "ui-grid/importerMenuItem",
            link: function($scope, $elm, $attrs, uiGridCtrl) {
                var grid;
                var fileChooser = $elm[0].querySelectorAll(".ui-grid-importer-file-chooser");
                1 !== fileChooser.length ? gridUtil.logError("Found > 1 or < 1 file choosers within the menu item, error, cannot continue") : fileChooser[0].addEventListener("change", function(event) {
                    var target = event.srcElement || event.target;
                    if (target && target.files && 1 === target.files.length) {
                        var fileObject = target.files[0];
                        void 0 !== uiGridCtrl && uiGridCtrl ? (grid = uiGridCtrl.grid, uiGridImporterService.importThisFile(grid, fileObject), 
                        target.form.reset()) : gridUtil.logError("Could not import file because UI Grid was not found.");
                    }
                }, !1);
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.infiniteScroll", [ "ui.grid" ]);
    module.service("uiGridInfiniteScrollService", [ "gridUtil", "$compile", "$rootScope", "uiGridConstants", "ScrollEvent", "$q", function(gridUtil, $compile, $rootScope, uiGridConstants, ScrollEvent, $q) {
        var service = {
            initializeGrid: function(grid, $scope) {
                if (service.defaultGridOptions(grid.options), grid.options.enableInfiniteScroll) {
                    grid.infiniteScroll = {
                        dataLoading: !1
                    }, service.setScrollDirections(grid, grid.options.infiniteScrollUp, grid.options.infiniteScrollDown), 
                    grid.api.core.on.scrollEnd($scope, service.handleScroll);
                    var publicApi = {
                        events: {
                            infiniteScroll: {
                                needLoadMoreData: function($scope, fn) {},
                                needLoadMoreDataTop: function($scope, fn) {}
                            }
                        },
                        methods: {
                            infiniteScroll: {
                                dataLoaded: function(scrollUp, scrollDown) {
                                    return service.setScrollDirections(grid, scrollUp, scrollDown), service.adjustScroll(grid).then(function() {
                                        grid.infiniteScroll.dataLoading = !1;
                                    });
                                },
                                resetScroll: function(scrollUp, scrollDown) {
                                    service.setScrollDirections(grid, scrollUp, scrollDown), service.adjustInfiniteScrollPosition(grid, 0);
                                },
                                saveScrollPercentage: function() {
                                    grid.infiniteScroll.prevScrollTop = grid.renderContainers.body.prevScrollTop, grid.infiniteScroll.previousVisibleRows = grid.getVisibleRowCount();
                                },
                                dataRemovedTop: function(scrollUp, scrollDown) {
                                    service.dataRemovedTop(grid, scrollUp, scrollDown);
                                },
                                dataRemovedBottom: function(scrollUp, scrollDown) {
                                    service.dataRemovedBottom(grid, scrollUp, scrollDown);
                                },
                                setScrollDirections: function(scrollUp, scrollDown) {
                                    service.setScrollDirections(grid, scrollUp, scrollDown);
                                }
                            }
                        }
                    };
                    grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods);
                }
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.enableInfiniteScroll = !1 !== gridOptions.enableInfiniteScroll, gridOptions.infiniteScrollRowsFromEnd = gridOptions.infiniteScrollRowsFromEnd || 20, 
                gridOptions.infiniteScrollUp = !0 === gridOptions.infiniteScrollUp, gridOptions.infiniteScrollDown = !1 !== gridOptions.infiniteScrollDown;
            },
            setScrollDirections: function(grid, scrollUp, scrollDown) {
                grid.infiniteScroll.scrollUp = !0 === scrollUp, grid.suppressParentScrollUp = !0 === scrollUp, 
                grid.infiniteScroll.scrollDown = !1 !== scrollDown, grid.suppressParentScrollDown = !1 !== scrollDown;
            },
            handleScroll: function(args) {
                if (!(args.grid.infiniteScroll && args.grid.infiniteScroll.dataLoading || "ui.grid.adjustInfiniteScrollPosition" === args.source) && args.y) if (0 === args.y.percentage) args.grid.scrollDirection = uiGridConstants.scrollDirection.UP, 
                service.loadData(args.grid); else if (1 === args.y.percentage) args.grid.scrollDirection = uiGridConstants.scrollDirection.DOWN, 
                service.loadData(args.grid); else {
                    var targetPercentage = args.grid.options.infiniteScrollRowsFromEnd / args.grid.renderContainers.body.visibleRowCache.length;
                    args.grid.scrollDirection === uiGridConstants.scrollDirection.UP ? args.y.percentage <= targetPercentage && service.loadData(args.grid) : args.grid.scrollDirection === uiGridConstants.scrollDirection.DOWN && 1 - args.y.percentage <= targetPercentage && service.loadData(args.grid);
                }
            },
            loadData: function(grid) {
                grid.infiniteScroll.previousVisibleRows = grid.renderContainers.body.visibleRowCache.length, 
                grid.infiniteScroll.direction = grid.scrollDirection, delete grid.infiniteScroll.prevScrollTop, 
                grid.scrollDirection === uiGridConstants.scrollDirection.UP && grid.infiniteScroll.scrollUp ? (grid.infiniteScroll.dataLoading = !0, 
                grid.api.infiniteScroll.raise.needLoadMoreDataTop()) : grid.scrollDirection === uiGridConstants.scrollDirection.DOWN && grid.infiniteScroll.scrollDown && (grid.infiniteScroll.dataLoading = !0, 
                grid.api.infiniteScroll.raise.needLoadMoreData());
            },
            adjustScroll: function(grid) {
                var promise = $q.defer();
                return $rootScope.$applyAsync(function() {
                    var viewportHeight, rowHeight, newVisibleRows, newTop;
                    viewportHeight = grid.getViewportHeight() + grid.headerHeight - grid.renderContainers.body.headerHeight - grid.scrollbarHeight, 
                    rowHeight = grid.options.rowHeight, void 0 === grid.infiniteScroll.direction && service.adjustInfiniteScrollPosition(grid, 0);
                    var canvasHeight = rowHeight * (newVisibleRows = grid.getVisibleRowCount());
                    grid.infiniteScroll.scrollDown && canvasHeight < viewportHeight && grid.api.infiniteScroll.raise.needLoadMoreData(), 
                    grid.infiniteScroll.direction === uiGridConstants.scrollDirection.UP && (newTop = (grid.infiniteScroll.prevScrollTop || 0) + (newVisibleRows - grid.infiniteScroll.previousVisibleRows) * rowHeight, 
                    service.adjustInfiniteScrollPosition(grid, newTop), $rootScope.$applyAsync(function() {
                        promise.resolve();
                    })), grid.infiniteScroll.direction === uiGridConstants.scrollDirection.DOWN && (newTop = grid.infiniteScroll.prevScrollTop || grid.infiniteScroll.previousVisibleRows * rowHeight - viewportHeight, 
                    service.adjustInfiniteScrollPosition(grid, newTop), $rootScope.$applyAsync(function() {
                        promise.resolve();
                    }));
                }, 0), promise.promise;
            },
            adjustInfiniteScrollPosition: function(grid, scrollTop) {
                var scrollEvent = new ScrollEvent(grid, null, null, "ui.grid.adjustInfiniteScrollPosition"), visibleRows = grid.getVisibleRowCount(), viewportHeight = grid.getViewportHeight() + grid.headerHeight - grid.renderContainers.body.headerHeight - grid.scrollbarHeight, scrollHeight = visibleRows * grid.options.rowHeight - viewportHeight;
                0 === scrollTop && grid.infiniteScroll.scrollUp ? scrollEvent.y = {
                    percentage: 1 / scrollHeight
                } : scrollEvent.y = {
                    percentage: scrollTop / scrollHeight
                }, grid.scrollContainers("", scrollEvent);
            },
            dataRemovedTop: function(grid, scrollUp, scrollDown) {
                var newVisibleRows, oldTop, newTop, rowHeight;
                service.setScrollDirections(grid, scrollUp, scrollDown), newVisibleRows = grid.renderContainers.body.visibleRowCache.length, 
                oldTop = grid.infiniteScroll.prevScrollTop, rowHeight = grid.options.rowHeight, 
                newTop = oldTop - (grid.infiniteScroll.previousVisibleRows - newVisibleRows) * rowHeight, 
                service.adjustInfiniteScrollPosition(grid, newTop);
            },
            dataRemovedBottom: function(grid, scrollUp, scrollDown) {
                var newTop;
                service.setScrollDirections(grid, scrollUp, scrollDown), newTop = grid.infiniteScroll.prevScrollTop, 
                service.adjustInfiniteScrollPosition(grid, newTop);
            }
        };
        return service;
    } ]), module.directive("uiGridInfiniteScroll", [ "uiGridInfiniteScrollService", function(uiGridInfiniteScrollService) {
        return {
            priority: -200,
            scope: !1,
            require: "^uiGrid",
            compile: function($scope, $elm, $attr) {
                return {
                    pre: function($scope, $elm, $attr, uiGridCtrl) {
                        uiGridInfiniteScrollService.initializeGrid(uiGridCtrl.grid, $scope);
                    },
                    post: function($scope, $elm, $attr) {}
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.moveColumns", [ "ui.grid" ]);
    module.service("uiGridMoveColumnService", [ "$q", "$rootScope", "$log", "ScrollEvent", "uiGridConstants", "gridUtil", function($q, $rootScope, $log, ScrollEvent, uiGridConstants, gridUtil) {
        var service = {
            initializeGrid: function(grid) {
                this.registerPublicApi(grid), this.defaultGridOptions(grid.options), grid.moveColumns = {
                    orderCache: []
                }, grid.registerColumnBuilder(this.movableColumnBuilder), grid.registerDataChangeCallback(this.verifyColumnOrder, [ uiGridConstants.dataChange.COLUMN ]);
            },
            registerPublicApi: function(grid) {
                var self = this, publicApi = {
                    events: {
                        colMovable: {
                            columnPositionChanged: function(colDef, originalPosition, newPosition) {}
                        }
                    },
                    methods: {
                        colMovable: {
                            moveColumn: function(originalPosition, finalPosition) {
                                var columns = grid.columns;
                                if (angular.isNumber(originalPosition) && angular.isNumber(finalPosition)) {
                                    for (var nonMovableColumns = 0, i = 0; i < columns.length; i++) (angular.isDefined(columns[i].colDef.visible) && !1 === columns[i].colDef.visible || !0 === columns[i].isRowHeader) && nonMovableColumns++;
                                    if (originalPosition >= columns.length - nonMovableColumns || finalPosition >= columns.length - nonMovableColumns) gridUtil.logError("MoveColumn: Invalid values for originalPosition, finalPosition"); else {
                                        var findPositionForRenderIndex = function(index) {
                                            for (var position = index, i = 0; i <= position; i++) angular.isDefined(columns[i]) && (angular.isDefined(columns[i].colDef.visible) && !1 === columns[i].colDef.visible || !0 === columns[i].isRowHeader) && position++;
                                            return position;
                                        };
                                        self.redrawColumnAtPosition(grid, findPositionForRenderIndex(originalPosition), findPositionForRenderIndex(finalPosition));
                                    }
                                } else gridUtil.logError("MoveColumn: Please provide valid values for originalPosition and finalPosition");
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods);
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.enableColumnMoving = !1 !== gridOptions.enableColumnMoving;
            },
            movableColumnBuilder: function(colDef, col, gridOptions) {
                return colDef.enableColumnMoving = void 0 === colDef.enableColumnMoving ? gridOptions.enableColumnMoving : colDef.enableColumnMoving, 
                $q.all([]);
            },
            updateColumnCache: function(grid) {
                grid.moveColumns.orderCache = grid.getOnlyDataColumns();
            },
            verifyColumnOrder: function(grid) {
                var newIndex, headerRowOffset = grid.rowHeaderColumns.length;
                angular.forEach(grid.moveColumns.orderCache, function(cacheCol, cacheIndex) {
                    if (-1 !== (newIndex = grid.columns.indexOf(cacheCol)) && newIndex - headerRowOffset !== cacheIndex) {
                        var column = grid.columns.splice(newIndex, 1)[0];
                        grid.columns.splice(cacheIndex + headerRowOffset, 0, column);
                    }
                });
            },
            redrawColumnAtPosition: function(grid, originalPosition, newPosition) {
                var columns = grid.columns;
                if (originalPosition !== newPosition) {
                    for (var pos = originalPosition < newPosition ? originalPosition + 1 : originalPosition - 1, i0 = Math.min(pos, newPosition); i0 <= Math.max(pos, newPosition) && !columns[i0].visible; i0++) ;
                    if (!(i0 > Math.max(pos, newPosition))) {
                        var originalColumn = columns[originalPosition];
                        if (originalColumn.colDef.enableColumnMoving) {
                            if (newPosition < originalPosition) for (var i1 = originalPosition; newPosition < i1; i1--) columns[i1] = columns[i1 - 1]; else if (originalPosition < newPosition) for (var i2 = originalPosition; i2 < newPosition; i2++) columns[i2] = columns[i2 + 1];
                            columns[newPosition] = originalColumn, service.updateColumnCache(grid), grid.queueGridRefresh(), 
                            $rootScope.$applyAsync(function() {
                                grid.api.core.notifyDataChange(uiGridConstants.dataChange.COLUMN), grid.api.colMovable.raise.columnPositionChanged(originalColumn.colDef, originalPosition, newPosition);
                            });
                        }
                    }
                }
            }
        };
        return service;
    } ]), module.directive("uiGridMoveColumns", [ "uiGridMoveColumnService", function(uiGridMoveColumnService) {
        return {
            replace: !0,
            priority: 0,
            require: "^uiGrid",
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        uiGridMoveColumnService.initializeGrid(uiGridCtrl.grid);
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {}
                };
            }
        };
    } ]), module.directive("uiGridHeaderCell", [ "$q", "gridUtil", "uiGridMoveColumnService", "$document", "$log", "uiGridConstants", "ScrollEvent", function($q, gridUtil, uiGridMoveColumnService, $document, $log, uiGridConstants, ScrollEvent) {
        return {
            priority: -10,
            require: "^uiGrid",
            compile: function() {
                return {
                    post: function($scope, $elm, $attrs, uiGridCtrl) {
                        if ($scope.col.colDef.enableColumnMoving) {
                            var gridLeft, previousMouseX, totalMouseMovement, rightMoveLimit, movingElm, reducedWidth, $contentsElm = angular.element($elm[0].querySelectorAll(".ui-grid-cell-contents")), elmCloned = !1, moveOccurred = !1, downFn = function(event) {
                                gridLeft = $scope.grid.element[0].getBoundingClientRect().left, $scope.grid.hasLeftContainer() && (gridLeft += $scope.grid.renderContainers.left.header[0].getBoundingClientRect().width), 
                                previousMouseX = event.pageX || (event.originalEvent ? event.originalEvent.pageX : 0), 
                                totalMouseMovement = 0, rightMoveLimit = gridLeft + $scope.grid.getViewportWidth(), 
                                "mousedown" === event.type ? ($document.on("mousemove", moveFn), $document.on("mouseup", upFn)) : "touchstart" === event.type && ($document.on("touchmove", moveFn), 
                                $document.on("touchend", upFn));
                            }, moveFn = function(event) {
                                var pageX = event.pageX || (event.originalEvent ? event.originalEvent.pageX : 0), changeValue = pageX - previousMouseX;
                                0 !== changeValue && (document.onselectstart = function() {
                                    return !1;
                                }, moveOccurred = !0, elmCloned ? elmCloned && (moveElement(changeValue), previousMouseX = pageX) : cloneElement());
                            }, upFn = function(event) {
                                if (document.onselectstart = null, movingElm && (movingElm.remove(), elmCloned = !1), 
                                offAllEvents(), onDownEvents(), moveOccurred) {
                                    for (var targetIndex, columns = $scope.grid.columns, columnIndex = 0, i = 0; i < columns.length && columns[i].colDef.name !== $scope.col.colDef.name; i++) columnIndex++;
                                    if (totalMouseMovement < 0) {
                                        var il, totalColumnsLeftWidth = 0;
                                        if ($scope.grid.isRTL()) {
                                            for (il = columnIndex + 1; il < columns.length; il++) if ((angular.isUndefined(columns[il].colDef.visible) || !0 === columns[il].colDef.visible) && (totalColumnsLeftWidth += columns[il].drawnWidth || columns[il].width || columns[il].colDef.width) > Math.abs(totalMouseMovement)) {
                                                uiGridMoveColumnService.redrawColumnAtPosition($scope.grid, columnIndex, il - 1);
                                                break;
                                            }
                                        } else for (il = columnIndex - 1; 0 <= il; il--) if ((angular.isUndefined(columns[il].colDef.visible) || !0 === columns[il].colDef.visible) && (totalColumnsLeftWidth += columns[il].drawnWidth || columns[il].width || columns[il].colDef.width) > Math.abs(totalMouseMovement)) {
                                            uiGridMoveColumnService.redrawColumnAtPosition($scope.grid, columnIndex, il + 1);
                                            break;
                                        }
                                        totalColumnsLeftWidth < Math.abs(totalMouseMovement) && (targetIndex = 0, $scope.grid.isRTL() && (targetIndex = columns.length - 1), 
                                        uiGridMoveColumnService.redrawColumnAtPosition($scope.grid, columnIndex, targetIndex));
                                    } else if (0 < totalMouseMovement) {
                                        var ir, totalColumnsRightWidth = 0;
                                        if ($scope.grid.isRTL()) {
                                            for (ir = columnIndex - 1; 0 < ir; ir--) if ((angular.isUndefined(columns[ir].colDef.visible) || !0 === columns[ir].colDef.visible) && (totalColumnsRightWidth += columns[ir].drawnWidth || columns[ir].width || columns[ir].colDef.width, 
                                            totalMouseMovement < totalColumnsRightWidth)) {
                                                uiGridMoveColumnService.redrawColumnAtPosition($scope.grid, columnIndex, ir);
                                                break;
                                            }
                                        } else for (ir = columnIndex + 1; ir < columns.length; ir++) if ((angular.isUndefined(columns[ir].colDef.visible) || !0 === columns[ir].colDef.visible) && (totalColumnsRightWidth += columns[ir].drawnWidth || columns[ir].width || columns[ir].colDef.width, 
                                        totalMouseMovement < totalColumnsRightWidth)) {
                                            uiGridMoveColumnService.redrawColumnAtPosition($scope.grid, columnIndex, ir - 1);
                                            break;
                                        }
                                        totalColumnsRightWidth < totalMouseMovement && (targetIndex = columns.length - 1, 
                                        $scope.grid.isRTL() && (targetIndex = 0), uiGridMoveColumnService.redrawColumnAtPosition($scope.grid, columnIndex, targetIndex));
                                    }
                                }
                            }, onDownEvents = function() {
                                $contentsElm.on("touchstart", downFn), $contentsElm.on("mousedown", downFn);
                            }, offAllEvents = function() {
                                $contentsElm.off("touchstart", downFn), $contentsElm.off("mousedown", downFn), $document.off("mousemove", moveFn), 
                                $document.off("touchmove", moveFn), $document.off("mouseup", upFn), $document.off("touchend", upFn);
                            };
                            onDownEvents();
                            var cloneElement = function() {
                                elmCloned = !0, movingElm = $elm.clone(), $elm.parent().append(movingElm), movingElm.addClass("movingColumn");
                                var movingElementStyles = {};
                                movingElementStyles.left = $elm[0].offsetLeft + "px";
                                var gridRight = $scope.grid.element[0].getBoundingClientRect().right, elmRight = $elm[0].getBoundingClientRect().right;
                                gridRight < elmRight && (reducedWidth = $scope.col.drawnWidth + (gridRight - elmRight), 
                                movingElementStyles.width = reducedWidth + "px"), movingElm.css(movingElementStyles);
                            }, moveElement = function(changeValue) {
                                for (var columns = $scope.grid.columns, totalColumnWidth = 0, i = 0; i < columns.length; i++) (angular.isUndefined(columns[i].colDef.visible) || !0 === columns[i].colDef.visible) && (totalColumnWidth += columns[i].drawnWidth || columns[i].width || columns[i].colDef.width);
                                var newElementLeft, currentElmLeft = movingElm[0].getBoundingClientRect().left - 1, currentElmRight = movingElm[0].getBoundingClientRect().right;
                                if (newElementLeft = (newElementLeft = currentElmLeft - gridLeft + changeValue) < rightMoveLimit ? newElementLeft : rightMoveLimit, 
                                (gridLeft <= currentElmLeft || 0 < changeValue) && (currentElmRight <= rightMoveLimit || changeValue < 0)) movingElm.css({
                                    visibility: "visible",
                                    left: movingElm[0].offsetLeft + (newElementLeft < rightMoveLimit ? changeValue : rightMoveLimit - currentElmLeft) + "px"
                                }); else if (totalColumnWidth > Math.ceil(uiGridCtrl.grid.gridWidth)) {
                                    changeValue *= 8;
                                    var scrollEvent = new ScrollEvent($scope.col.grid, null, null, "uiGridHeaderCell.moveElement");
                                    scrollEvent.x = {
                                        pixels: changeValue
                                    }, scrollEvent.grid.scrollContainers("", scrollEvent);
                                }
                                for (var totalColumnsLeftWidth = 0, il = 0; il < columns.length; il++) if (angular.isUndefined(columns[il].colDef.visible) || !0 === columns[il].colDef.visible) {
                                    if (columns[il].colDef.name === $scope.col.colDef.name) break;
                                    totalColumnsLeftWidth += columns[il].drawnWidth || columns[il].width || columns[il].colDef.width;
                                }
                                void 0 === $scope.newScrollLeft ? totalMouseMovement += changeValue : totalMouseMovement = $scope.newScrollLeft + newElementLeft - totalColumnsLeftWidth, 
                                reducedWidth < $scope.col.drawnWidth && (reducedWidth += Math.abs(changeValue), 
                                movingElm.css({
                                    width: reducedWidth + "px"
                                }));
                            };
                            $scope.$on("$destroy", offAllEvents);
                        }
                    }
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.pagination", [ "ng", "ui.grid" ]);
    module.service("uiGridPaginationService", [ "gridUtil", function(gridUtil) {
        var service = {
            initializeGrid: function(grid) {
                service.defaultGridOptions(grid.options);
                var publicApi = {
                    events: {
                        pagination: {
                            paginationChanged: function(currentPage, pageSize) {}
                        }
                    },
                    methods: {
                        pagination: {
                            getPage: function() {
                                return grid.options.enablePagination ? grid.options.paginationCurrentPage : null;
                            },
                            getFirstRowIndex: function() {
                                return grid.options.useCustomPagination ? grid.options.paginationPageSizes.reduce(function(result, size, index) {
                                    return index < grid.options.paginationCurrentPage - 1 ? result + size : result;
                                }, 0) : (grid.options.paginationCurrentPage - 1) * grid.options.paginationPageSize;
                            },
                            getLastRowIndex: function() {
                                return grid.options.useCustomPagination ? publicApi.methods.pagination.getFirstRowIndex() + grid.options.paginationPageSizes[grid.options.paginationCurrentPage - 1] - 1 : Math.min(grid.options.paginationCurrentPage * grid.options.paginationPageSize, grid.options.totalItems) - 1;
                            },
                            getTotalPages: function() {
                                return grid.options.enablePagination ? grid.options.useCustomPagination ? grid.options.paginationPageSizes.length : 0 === grid.options.totalItems ? 1 : Math.ceil(grid.options.totalItems / grid.options.paginationPageSize) : null;
                            },
                            nextPage: function() {
                                grid.options.enablePagination && (0 < grid.options.totalItems ? grid.options.paginationCurrentPage = Math.min(grid.options.paginationCurrentPage + 1, publicApi.methods.pagination.getTotalPages()) : grid.options.paginationCurrentPage++);
                            },
                            previousPage: function() {
                                grid.options.enablePagination && (grid.options.paginationCurrentPage = Math.max(grid.options.paginationCurrentPage - 1, 1));
                            },
                            seek: function(page) {
                                if (grid.options.enablePagination) {
                                    if (!angular.isNumber(page) || page < 1) throw "Invalid page number: " + page;
                                    grid.options.paginationCurrentPage = Math.min(page, publicApi.methods.pagination.getTotalPages());
                                }
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods);
                grid.registerRowsProcessor(function(renderableRows) {
                    if (grid.options.useExternalPagination || !grid.options.enablePagination) return renderableRows;
                    var pageSize = parseInt(grid.options.paginationPageSize, 10), visibleRows = (parseInt(grid.options.paginationCurrentPage, 10), 
                    renderableRows.filter(function(row) {
                        return row.visible;
                    }));
                    grid.options.totalItems = visibleRows.length;
                    var firstRow = publicApi.methods.pagination.getFirstRowIndex(), lastRow = publicApi.methods.pagination.getLastRowIndex();
                    return firstRow > visibleRows.length && (firstRow = ((grid.options.paginationCurrentPage = 1) - 1) * pageSize), 
                    visibleRows.slice(firstRow, lastRow + 1);
                }, 900);
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.enablePagination = !1 !== gridOptions.enablePagination, gridOptions.enablePaginationControls = !1 !== gridOptions.enablePaginationControls, 
                gridOptions.useExternalPagination = !0 === gridOptions.useExternalPagination, gridOptions.useCustomPagination = !0 === gridOptions.useCustomPagination, 
                gridUtil.isNullOrUndefined(gridOptions.totalItems) && (gridOptions.totalItems = 0), 
                gridUtil.isNullOrUndefined(gridOptions.paginationPageSizes) && (gridOptions.paginationPageSizes = [ 250, 500, 1e3 ]), 
                gridUtil.isNullOrUndefined(gridOptions.paginationPageSize) && (0 < gridOptions.paginationPageSizes.length ? gridOptions.paginationPageSize = gridOptions.paginationPageSizes[0] : gridOptions.paginationPageSize = 0), 
                gridUtil.isNullOrUndefined(gridOptions.paginationCurrentPage) && (gridOptions.paginationCurrentPage = 1), 
                gridUtil.isNullOrUndefined(gridOptions.paginationTemplate) && (gridOptions.paginationTemplate = "ui-grid/pagination");
            },
            onPaginationChanged: function(grid, currentPage, pageSize) {
                grid.api.pagination.raise.paginationChanged(currentPage, pageSize), grid.options.useExternalPagination || grid.queueGridRefresh();
            }
        };
        return service;
    } ]), module.directive("uiGridPagination", [ "gridUtil", "uiGridPaginationService", function(gridUtil, uiGridPaginationService) {
        return {
            priority: -200,
            scope: !1,
            require: "uiGrid",
            link: {
                pre: function($scope, $elm, $attr, uiGridCtrl) {
                    uiGridPaginationService.initializeGrid(uiGridCtrl.grid), gridUtil.getTemplate(uiGridCtrl.grid.options.paginationTemplate).then(function(contents) {
                        var template = angular.element(contents);
                        $elm.append(template), uiGridCtrl.innerCompile(template);
                    });
                }
            }
        };
    } ]), module.directive("uiGridPager", [ "uiGridPaginationService", "uiGridConstants", "gridUtil", "i18nService", "i18nConstants", function(uiGridPaginationService, uiGridConstants, gridUtil, i18nService, i18nConstants) {
        return {
            priority: -200,
            scope: !0,
            require: "^uiGrid",
            link: function($scope, $elm, $attr, uiGridCtrl) {
                $scope.aria = i18nService.getSafeText("pagination.aria");
                var updateLabels = function() {
                    $scope.paginationApi = uiGridCtrl.grid.api.pagination, $scope.sizesLabel = i18nService.getSafeText("pagination.sizes"), 
                    $scope.totalItemsLabel = i18nService.getSafeText("pagination.totalItems"), $scope.paginationOf = i18nService.getSafeText("pagination.of"), 
                    $scope.paginationThrough = i18nService.getSafeText("pagination.through");
                };
                updateLabels(), $scope.$on(i18nConstants.UPDATE_EVENT, updateLabels);
                var options = uiGridCtrl.grid.options;
                uiGridCtrl.grid.renderContainers.body.registerViewportAdjuster(function(adjustment) {
                    return options.enablePaginationControls && (adjustment.height = adjustment.height - gridUtil.elementHeight($elm, "padding")), 
                    adjustment;
                });
                var dataChangeDereg = uiGridCtrl.grid.registerDataChangeCallback(function(grid) {
                    grid.options.useExternalPagination || (grid.options.totalItems = grid.rows.length);
                }, [ uiGridConstants.dataChange.ROW ]);
                $scope.$on("$destroy", dataChangeDereg);
                var deregP = $scope.$watch("grid.options.paginationCurrentPage + grid.options.paginationPageSize", function(newValues, oldValues) {
                    newValues !== oldValues && void 0 !== oldValues && (!angular.isNumber(options.paginationCurrentPage) || options.paginationCurrentPage < 1 ? options.paginationCurrentPage = 1 : 0 < options.totalItems && options.paginationCurrentPage > $scope.paginationApi.getTotalPages() ? options.paginationCurrentPage = $scope.paginationApi.getTotalPages() : uiGridPaginationService.onPaginationChanged($scope.grid, options.paginationCurrentPage, options.paginationPageSize));
                });
                $scope.$on("$destroy", function() {
                    deregP();
                }), $scope.cantPageForward = function() {
                    return $scope.paginationApi.getTotalPages() ? $scope.cantPageToLast() : options.data.length < 1;
                }, $scope.cantPageToLast = function() {
                    var totalPages = $scope.paginationApi.getTotalPages();
                    return !totalPages || options.paginationCurrentPage >= totalPages;
                }, $scope.cantPageBackward = function() {
                    return options.paginationCurrentPage <= 1;
                };
                var focusToInputIf = function(condition) {
                    condition && gridUtil.focus.bySelector($elm, ".ui-grid-pager-control-input");
                };
                $scope.pageFirstPageClick = function() {
                    $scope.paginationApi.seek(1), focusToInputIf($scope.cantPageBackward());
                }, $scope.pagePreviousPageClick = function() {
                    $scope.paginationApi.previousPage(), focusToInputIf($scope.cantPageBackward());
                }, $scope.pageNextPageClick = function() {
                    $scope.paginationApi.nextPage(), focusToInputIf($scope.cantPageForward());
                }, $scope.pageLastPageClick = function() {
                    $scope.paginationApi.seek($scope.paginationApi.getTotalPages()), focusToInputIf($scope.cantPageToLast());
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.pinning", [ "ui.grid" ]);
    module.constant("uiGridPinningConstants", {
        container: {
            LEFT: "left",
            RIGHT: "right",
            NONE: ""
        }
    }), module.service("uiGridPinningService", [ "gridUtil", "GridRenderContainer", "i18nService", "uiGridPinningConstants", function(gridUtil, GridRenderContainer, i18nService, uiGridPinningConstants) {
        var service = {
            initializeGrid: function(grid) {
                service.defaultGridOptions(grid.options), grid.registerColumnBuilder(service.pinningColumnBuilder);
                var publicApi = {
                    events: {
                        pinning: {
                            columnPinned: function(colDef, container) {}
                        }
                    },
                    methods: {
                        pinning: {
                            pinColumn: function(col, container) {
                                service.pinColumn(grid, col, container);
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods);
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.enablePinning = !1 !== gridOptions.enablePinning, gridOptions.hidePinLeft = gridOptions.enablePinning && gridOptions.hidePinLeft, 
                gridOptions.hidePinRight = gridOptions.enablePinning && gridOptions.hidePinRight;
            },
            pinningColumnBuilder: function(colDef, col, gridOptions) {
                if (colDef.enablePinning = void 0 === colDef.enablePinning ? gridOptions.enablePinning : colDef.enablePinning, 
                colDef.hidePinLeft = void 0 === colDef.hidePinLeft ? gridOptions.hidePinLeft : colDef.hidePinLeft, 
                colDef.hidePinRight = void 0 === colDef.hidePinRight ? gridOptions.hidePinRight : colDef.hidePinRight, 
                colDef.pinnedLeft ? (col.renderContainer = "left", col.grid.createLeftContainer()) : colDef.pinnedRight && (col.renderContainer = "right", 
                col.grid.createRightContainer()), colDef.enablePinning) {
                    var pinColumnLeftAction = {
                        name: "ui.grid.pinning.pinLeft",
                        title: i18nService.get().pinning.pinLeft,
                        icon: "ui-grid-icon-left-open",
                        shown: function() {
                            return void 0 === this.context.col.renderContainer || !this.context.col.renderContainer || "left" !== this.context.col.renderContainer;
                        },
                        action: function() {
                            service.pinColumn(this.context.col.grid, this.context.col, uiGridPinningConstants.container.LEFT);
                        }
                    }, pinColumnRightAction = {
                        name: "ui.grid.pinning.pinRight",
                        title: i18nService.get().pinning.pinRight,
                        icon: "ui-grid-icon-right-open",
                        shown: function() {
                            return void 0 === this.context.col.renderContainer || !this.context.col.renderContainer || "right" !== this.context.col.renderContainer;
                        },
                        action: function() {
                            service.pinColumn(this.context.col.grid, this.context.col, uiGridPinningConstants.container.RIGHT);
                        }
                    }, removePinAction = {
                        name: "ui.grid.pinning.unpin",
                        title: i18nService.get().pinning.unpin,
                        icon: "ui-grid-icon-cancel",
                        shown: function() {
                            return void 0 !== this.context.col.renderContainer && null !== this.context.col.renderContainer && "body" !== this.context.col.renderContainer;
                        },
                        action: function() {
                            service.pinColumn(this.context.col.grid, this.context.col, uiGridPinningConstants.container.NONE);
                        }
                    };
                    colDef.hidePinLeft || gridUtil.arrayContainsObjectWithProperty(col.menuItems, "name", "ui.grid.pinning.pinLeft") || col.menuItems.push(pinColumnLeftAction), 
                    colDef.hidePinRight || gridUtil.arrayContainsObjectWithProperty(col.menuItems, "name", "ui.grid.pinning.pinRight") || col.menuItems.push(pinColumnRightAction), 
                    gridUtil.arrayContainsObjectWithProperty(col.menuItems, "name", "ui.grid.pinning.unpin") || col.menuItems.push(removePinAction);
                }
            },
            pinColumn: function(grid, col, container) {
                container === uiGridPinningConstants.container.NONE ? (col.renderContainer = null, 
                col.colDef.pinnedLeft = col.colDef.pinnedRight = !1) : (col.renderContainer = container) === uiGridPinningConstants.container.LEFT ? grid.createLeftContainer() : container === uiGridPinningConstants.container.RIGHT && grid.createRightContainer(), 
                grid.refresh().then(function() {
                    grid.api.pinning.raise.columnPinned(col.colDef, container);
                });
            }
        };
        return service;
    } ]), module.directive("uiGridPinning", [ "gridUtil", "uiGridPinningService", function(gridUtil, uiGridPinningService) {
        return {
            require: "uiGrid",
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        uiGridPinningService.initializeGrid(uiGridCtrl.grid);
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {}
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.resizeColumns", [ "ui.grid" ]);
    module.service("uiGridResizeColumnsService", [ "gridUtil", "$q", "$rootScope", function(gridUtil, $q, $rootScope) {
        return {
            defaultGridOptions: function(gridOptions) {
                gridOptions.enableColumnResizing = !1 !== gridOptions.enableColumnResizing, !1 === gridOptions.enableColumnResize && (gridOptions.enableColumnResizing = !1);
            },
            colResizerColumnBuilder: function(colDef, col, gridOptions) {
                return colDef.enableColumnResizing = void 0 === colDef.enableColumnResizing ? gridOptions.enableColumnResizing : colDef.enableColumnResizing, 
                !1 === colDef.enableColumnResize && (colDef.enableColumnResizing = !1), $q.all([]);
            },
            registerPublicApi: function(grid) {
                grid.api.registerEventsFromObject({
                    colResizable: {
                        columnSizeChanged: function(colDef, deltaChange) {}
                    }
                });
            },
            fireColumnSizeChanged: function(grid, colDef, deltaChange) {
                $rootScope.$applyAsync(function() {
                    grid.api.colResizable ? grid.api.colResizable.raise.columnSizeChanged(colDef, deltaChange) : gridUtil.logError("The resizeable api is not registered, this may indicate that you've included the module but not added the 'ui-grid-resize-columns' directive to your grid definition.  Cannot raise any events.");
                });
            },
            findTargetCol: function(col, position, rtlMultiplier) {
                var renderContainer = col.getRenderContainer();
                if ("left" === position) {
                    var colIndex = renderContainer.visibleColumnCache.indexOf(col);
                    return renderContainer.visibleColumnCache[colIndex - 1 * rtlMultiplier];
                }
                return col;
            }
        };
    } ]), module.directive("uiGridResizeColumns", [ "gridUtil", "uiGridResizeColumnsService", function(gridUtil, uiGridResizeColumnsService) {
        return {
            replace: !0,
            priority: 0,
            require: "^uiGrid",
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        uiGridResizeColumnsService.defaultGridOptions(uiGridCtrl.grid.options), uiGridCtrl.grid.registerColumnBuilder(uiGridResizeColumnsService.colResizerColumnBuilder), 
                        uiGridResizeColumnsService.registerPublicApi(uiGridCtrl.grid);
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {}
                };
            }
        };
    } ]), module.directive("uiGridHeaderCell", [ "gridUtil", "$templateCache", "$compile", "$q", "uiGridResizeColumnsService", "uiGridConstants", function(gridUtil, $templateCache, $compile, $q, uiGridResizeColumnsService, uiGridConstants) {
        return {
            priority: -10,
            require: "^uiGrid",
            compile: function() {
                return {
                    post: function($scope, $elm, $attrs, uiGridCtrl) {
                        var grid = uiGridCtrl.grid;
                        if (grid.options.enableColumnResizing) {
                            var columnResizerElm = $templateCache.get("ui-grid/columnResizer"), rtlMultiplier = 1;
                            grid.isRTL() && ($scope.position = "left", rtlMultiplier = -1);
                            var displayResizers = function() {
                                for (var resizers = $elm[0].getElementsByClassName("ui-grid-column-resizer"), i = 0; i < resizers.length; i++) angular.element(resizers[i]).remove();
                                var otherCol = uiGridResizeColumnsService.findTargetCol($scope.col, "left", rtlMultiplier), renderContainer = $scope.col.getRenderContainer();
                                if (otherCol && 0 !== renderContainer.visibleColumnCache.indexOf($scope.col) && !1 !== otherCol.colDef.enableColumnResizing) {
                                    var resizerLeft = angular.element(columnResizerElm).clone();
                                    resizerLeft.attr("position", "left"), $elm.prepend(resizerLeft), $compile(resizerLeft)($scope);
                                }
                                if (!1 !== $scope.col.colDef.enableColumnResizing) {
                                    var resizerRight = angular.element(columnResizerElm).clone();
                                    resizerRight.attr("position", "right"), $elm.append(resizerRight), $compile(resizerRight)($scope);
                                }
                            };
                            displayResizers();
                            var dataChangeDereg = grid.registerDataChangeCallback(function() {
                                $scope.$applyAsync(displayResizers);
                            }, [ uiGridConstants.dataChange.COLUMN ]);
                            $scope.$on("$destroy", dataChangeDereg);
                        }
                    }
                };
            }
        };
    } ]), module.directive("uiGridColumnResizer", [ "$document", "gridUtil", "uiGridConstants", "uiGridResizeColumnsService", function($document, gridUtil, uiGridConstants, uiGridResizeColumnsService) {
        var resizeOverlay = angular.element('<div class="ui-grid-resize-overlay"></div>');
        return {
            priority: 0,
            scope: {
                col: "=",
                position: "@",
                renderIndex: "="
            },
            require: "?^uiGrid",
            link: function($scope, $elm, $attrs, uiGridCtrl) {
                var startX = 0, x = 0, gridLeft = 0, rtlMultiplier = 1;
                function refreshCanvas(xDiff) {
                    uiGridCtrl.grid.refreshCanvas(!0).then(function() {
                        uiGridCtrl.grid.queueGridRefresh();
                    });
                }
                function constrainWidth(col, width) {
                    var newWidth = width;
                    return col.minWidth && newWidth < col.minWidth ? newWidth = col.minWidth : col.maxWidth && newWidth > col.maxWidth && (newWidth = col.maxWidth), 
                    newWidth;
                }
                function moveFunction(event, args) {
                    event.originalEvent && (event = event.originalEvent), event.preventDefault(), (x = (event.targetTouches ? event.targetTouches[0] : event).clientX - gridLeft) < 0 ? x = 0 : x > uiGridCtrl.grid.gridWidth && (x = uiGridCtrl.grid.gridWidth);
                    var col = uiGridResizeColumnsService.findTargetCol($scope.col, $scope.position, rtlMultiplier);
                    if (!1 !== col.colDef.enableColumnResizing) {
                        uiGridCtrl.grid.element.hasClass("column-resizing") || uiGridCtrl.grid.element.addClass("column-resizing");
                        var xDiff = x - startX, newWidth = parseInt(col.drawnWidth + xDiff * rtlMultiplier, 10);
                        x += (constrainWidth(col, newWidth) - newWidth) * rtlMultiplier, resizeOverlay.css({
                            left: x + "px"
                        }), uiGridCtrl.fireEvent(uiGridConstants.events.ITEM_DRAGGING);
                    }
                }
                function upFunction(event, args) {
                    event.originalEvent && (event = event.originalEvent), event.preventDefault(), uiGridCtrl.grid.element.removeClass("column-resizing"), 
                    resizeOverlay.remove();
                    var xDiff = (x = (event.changedTouches ? event.changedTouches[0] : event).clientX - gridLeft) - startX;
                    if (0 === xDiff) return offAllEvents(), void onDownEvents();
                    var col = uiGridResizeColumnsService.findTargetCol($scope.col, $scope.position, rtlMultiplier);
                    if (!1 !== col.colDef.enableColumnResizing) {
                        var newWidth = parseInt(col.drawnWidth + xDiff * rtlMultiplier, 10);
                        col.width = constrainWidth(col, newWidth), col.hasCustomWidth = !0, refreshCanvas(), 
                        uiGridResizeColumnsService.fireColumnSizeChanged(uiGridCtrl.grid, col.colDef, xDiff), 
                        offAllEvents(), onDownEvents();
                    }
                }
                uiGridCtrl.grid.isRTL() && ($scope.position = "left", rtlMultiplier = -1), "left" === $scope.position ? $elm.addClass("left") : "right" === $scope.position && $elm.addClass("right");
                var downFunction = function(event, args) {
                    event.originalEvent && (event = event.originalEvent), event.stopPropagation(), gridLeft = uiGridCtrl.grid.element[0].getBoundingClientRect().left, 
                    startX = (event.targetTouches ? event.targetTouches[0] : event).clientX - gridLeft, 
                    uiGridCtrl.grid.element.append(resizeOverlay), resizeOverlay.css({
                        left: startX
                    }), "touchstart" === event.type ? ($document.on("touchend", upFunction), $document.on("touchmove", moveFunction), 
                    $elm.off("mousedown", downFunction)) : ($document.on("mouseup", upFunction), $document.on("mousemove", moveFunction), 
                    $elm.off("touchstart", downFunction));
                }, onDownEvents = function() {
                    $elm.on("mousedown", downFunction), $elm.on("touchstart", downFunction);
                }, offAllEvents = function() {
                    $document.off("mouseup", upFunction), $document.off("touchend", upFunction), $document.off("mousemove", moveFunction), 
                    $document.off("touchmove", moveFunction), $elm.off("mousedown", downFunction), $elm.off("touchstart", downFunction);
                };
                onDownEvents();
                var dblClickFn = function(event, args) {
                    event.stopPropagation();
                    var col = uiGridResizeColumnsService.findTargetCol($scope.col, $scope.position, rtlMultiplier);
                    if (!1 !== col.colDef.enableColumnResizing) {
                        var xDiff, maxWidth = 0, cells = gridUtil.closestElm($elm, ".ui-grid-render-container").querySelectorAll("." + uiGridConstants.COL_CLASS_PREFIX + col.uid + " .ui-grid-cell-contents");
                        Array.prototype.forEach.call(cells, function(cell) {
                            var menuButton;
                            angular.element(cell).parent().hasClass("ui-grid-header-cell") && (menuButton = angular.element(cell).parent()[0].querySelectorAll(".ui-grid-column-menu-button")), 
                            gridUtil.fakeElement(cell, {}, function(newElm) {
                                var e = angular.element(newElm);
                                e.attr("style", "float: left");
                                var width = gridUtil.elementWidth(e);
                                menuButton && (width += gridUtil.elementWidth(menuButton));
                                maxWidth < width && (maxWidth = width);
                            });
                        });
                        var newWidth = constrainWidth(col, maxWidth);
                        xDiff = newWidth - col.drawnWidth, col.width = newWidth, col.hasCustomWidth = !0, 
                        refreshCanvas(), uiGridResizeColumnsService.fireColumnSizeChanged(uiGridCtrl.grid, col.colDef, xDiff);
                    }
                };
                $elm.on("dblclick", dblClickFn), $elm.on("$destroy", function() {
                    $elm.off("dblclick", dblClickFn), offAllEvents();
                });
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.rowEdit", [ "ui.grid", "ui.grid.edit", "ui.grid.cellNav" ]);
    module.constant("uiGridRowEditConstants", {}), module.service("uiGridRowEditService", [ "$interval", "$q", "uiGridConstants", "uiGridRowEditConstants", "gridUtil", function($interval, $q, uiGridConstants, uiGridRowEditConstants, gridUtil) {
        var service = {
            initializeGrid: function(scope, grid) {
                grid.rowEdit = {};
                var publicApi = {
                    events: {
                        rowEdit: {
                            saveRow: function(rowEntity) {}
                        }
                    },
                    methods: {
                        rowEdit: {
                            setSavePromise: function(rowEntity, savePromise) {
                                service.setSavePromise(grid, rowEntity, savePromise);
                            },
                            getDirtyRows: function() {
                                return grid.rowEdit.dirtyRows ? grid.rowEdit.dirtyRows : [];
                            },
                            getErrorRows: function() {
                                return grid.rowEdit.errorRows ? grid.rowEdit.errorRows : [];
                            },
                            flushDirtyRows: function() {
                                return service.flushDirtyRows(grid);
                            },
                            setRowsDirty: function(dataRows) {
                                service.setRowsDirty(grid, dataRows);
                            },
                            setRowsClean: function(dataRows) {
                                service.setRowsClean(grid, dataRows);
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods), 
                grid.api.core.on.renderingComplete(scope, function(gridApi) {
                    grid.api.edit.on.afterCellEdit(scope, service.endEditCell), grid.api.edit.on.beginCellEdit(scope, service.beginEditCell), 
                    grid.api.edit.on.cancelCellEdit(scope, service.cancelEditCell), grid.api.cellNav && grid.api.cellNav.on.navigate(scope, service.navigate);
                });
            },
            defaultGridOptions: function(gridOptions) {},
            saveRow: function(grid, gridRow) {
                var self = this;
                return function() {
                    if (gridRow.isSaving = !0, gridRow.rowEditSavePromise) return gridRow.rowEditSavePromise;
                    var promise = grid.api.rowEdit.raise.saveRow(gridRow.entity);
                    return gridRow.rowEditSavePromise ? gridRow.rowEditSavePromise.then(self.processSuccessPromise(grid, gridRow), self.processErrorPromise(grid, gridRow)) : gridUtil.logError("A promise was not returned when saveRow event was raised, either nobody is listening to event, or event handler did not return a promise"), 
                    promise;
                };
            },
            setSavePromise: function(grid, rowEntity, savePromise) {
                grid.getRow(rowEntity).rowEditSavePromise = savePromise;
            },
            processSuccessPromise: function(grid, gridRow) {
                var self = this;
                return function() {
                    delete gridRow.isSaving, delete gridRow.isDirty, delete gridRow.isError, delete gridRow.rowEditSaveTimer, 
                    delete gridRow.rowEditSavePromise, self.removeRow(grid.rowEdit.errorRows, gridRow), 
                    self.removeRow(grid.rowEdit.dirtyRows, gridRow);
                };
            },
            processErrorPromise: function(grid, gridRow) {
                return function() {
                    delete gridRow.isSaving, delete gridRow.rowEditSaveTimer, delete gridRow.rowEditSavePromise, 
                    gridRow.isError = !0, grid.rowEdit.errorRows || (grid.rowEdit.errorRows = []), service.isRowPresent(grid.rowEdit.errorRows, gridRow) || grid.rowEdit.errorRows.push(gridRow);
                };
            },
            removeRow: function(rowArray, removeGridRow) {
                null != rowArray && rowArray.forEach(function(gridRow, index) {
                    gridRow.uid === removeGridRow.uid && rowArray.splice(index, 1);
                });
            },
            isRowPresent: function(rowArray, removeGridRow) {
                var present = !1;
                return rowArray.forEach(function(gridRow, index) {
                    gridRow.uid === removeGridRow.uid && (present = !0);
                }), present;
            },
            flushDirtyRows: function(grid) {
                var promises = [];
                return grid.api.rowEdit.getDirtyRows().forEach(function(gridRow) {
                    service.cancelTimer(grid, gridRow), service.saveRow(grid, gridRow)(), promises.push(gridRow.rowEditSavePromise);
                }), $q.all(promises);
            },
            endEditCell: function(rowEntity, colDef, newValue, previousValue) {
                var grid = this.grid, gridRow = grid.getRow(rowEntity);
                gridRow ? (newValue !== previousValue || gridRow.isDirty) && (grid.rowEdit.dirtyRows || (grid.rowEdit.dirtyRows = []), 
                gridRow.isDirty || (gridRow.isDirty = !0, grid.rowEdit.dirtyRows.push(gridRow)), 
                delete gridRow.isError, service.considerSetTimer(grid, gridRow)) : gridUtil.logError("Unable to find rowEntity in grid data, dirty flag cannot be set");
            },
            beginEditCell: function(rowEntity, colDef) {
                var grid = this.grid, gridRow = grid.getRow(rowEntity);
                gridRow ? service.cancelTimer(grid, gridRow) : gridUtil.logError("Unable to find rowEntity in grid data, timer cannot be cancelled");
            },
            cancelEditCell: function(rowEntity, colDef) {
                var grid = this.grid, gridRow = grid.getRow(rowEntity);
                gridRow ? service.considerSetTimer(grid, gridRow) : gridUtil.logError("Unable to find rowEntity in grid data, timer cannot be set");
            },
            navigate: function(newRowCol, oldRowCol) {
                var grid = this.grid;
                newRowCol.row.rowEditSaveTimer && service.cancelTimer(grid, newRowCol.row), oldRowCol && oldRowCol.row && oldRowCol.row !== newRowCol.row && service.considerSetTimer(grid, oldRowCol.row);
            },
            considerSetTimer: function(grid, gridRow) {
                if (service.cancelTimer(grid, gridRow), gridRow.isDirty && !gridRow.isSaving && -1 !== grid.options.rowEditWaitInterval) {
                    var waitTime = grid.options.rowEditWaitInterval ? grid.options.rowEditWaitInterval : 2e3;
                    gridRow.rowEditSaveTimer = $interval(service.saveRow(grid, gridRow), waitTime, 1);
                }
            },
            cancelTimer: function(grid, gridRow) {
                gridRow.rowEditSaveTimer && !gridRow.isSaving && ($interval.cancel(gridRow.rowEditSaveTimer), 
                delete gridRow.rowEditSaveTimer);
            },
            setRowsDirty: function(grid, myDataRows) {
                var gridRow;
                myDataRows.forEach(function(value, index) {
                    (gridRow = grid.getRow(value)) ? (grid.rowEdit.dirtyRows || (grid.rowEdit.dirtyRows = []), 
                    gridRow.isDirty || (gridRow.isDirty = !0, grid.rowEdit.dirtyRows.push(gridRow)), 
                    delete gridRow.isError, service.considerSetTimer(grid, gridRow)) : gridUtil.logError("requested row not found in rowEdit.setRowsDirty, row was: " + value);
                });
            },
            setRowsClean: function(grid, myDataRows) {
                var gridRow;
                myDataRows.forEach(function(value, index) {
                    (gridRow = grid.getRow(value)) ? (delete gridRow.isDirty, service.removeRow(grid.rowEdit.dirtyRows, gridRow), 
                    service.cancelTimer(grid, gridRow), delete gridRow.isError, service.removeRow(grid.rowEdit.errorRows, gridRow)) : gridUtil.logError("requested row not found in rowEdit.setRowsClean, row was: " + value);
                });
            }
        };
        return service;
    } ]), module.directive("uiGridRowEdit", [ "gridUtil", "uiGridRowEditService", "uiGridEditConstants", function(gridUtil, uiGridRowEditService, uiGridEditConstants) {
        return {
            replace: !0,
            priority: 0,
            require: "^uiGrid",
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        uiGridRowEditService.initializeGrid($scope, uiGridCtrl.grid);
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {}
                };
            }
        };
    } ]), module.directive("uiGridViewport", [ "$compile", "uiGridConstants", "gridUtil", "$parse", function($compile, uiGridConstants, gridUtil, $parse) {
        return {
            priority: -200,
            scope: !1,
            compile: function($elm, $attrs) {
                var rowRepeatDiv = angular.element($elm.children().children()[0]), existingNgClass = rowRepeatDiv.attr("ng-class"), newNgClass = "";
                return newNgClass = existingNgClass ? existingNgClass.slice(0, -1) + ", 'ui-grid-row-dirty': row.isDirty, 'ui-grid-row-saving': row.isSaving, 'ui-grid-row-error': row.isError}" : "{'ui-grid-row-dirty': row.isDirty, 'ui-grid-row-saving': row.isSaving, 'ui-grid-row-error': row.isError}", 
                rowRepeatDiv.attr("ng-class", newNgClass), {
                    pre: function($scope, $elm, $attrs, controllers) {},
                    post: function($scope, $elm, $attrs, controllers) {}
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.saveState", [ "ui.grid", "ui.grid.selection", "ui.grid.cellNav", "ui.grid.grouping", "ui.grid.pinning", "ui.grid.treeView" ]);
    module.constant("uiGridSaveStateConstants", {
        featureName: "saveState"
    }), module.service("uiGridSaveStateService", [ "$q", "uiGridSaveStateConstants", "gridUtil", "$compile", "$interval", "uiGridConstants", function($q, uiGridSaveStateConstants, gridUtil, $compile, $interval, uiGridConstants) {
        var service = {
            initializeGrid: function(grid) {
                grid.saveState = {}, this.defaultGridOptions(grid.options);
                var publicApi = {
                    events: {
                        saveState: {}
                    },
                    methods: {
                        saveState: {
                            save: function() {
                                return service.save(grid);
                            },
                            restore: function($scope, state) {
                                return service.restore(grid, $scope, state);
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods);
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.saveWidths = !1 !== gridOptions.saveWidths, gridOptions.saveOrder = !1 !== gridOptions.saveOrder, 
                gridOptions.saveScroll = !0 === gridOptions.saveScroll, gridOptions.saveFocus = !0 !== gridOptions.saveScroll && !1 !== gridOptions.saveFocus, 
                gridOptions.saveVisible = !1 !== gridOptions.saveVisible, gridOptions.saveSort = !1 !== gridOptions.saveSort, 
                gridOptions.saveFilter = !1 !== gridOptions.saveFilter, gridOptions.saveSelection = !1 !== gridOptions.saveSelection, 
                gridOptions.saveGrouping = !1 !== gridOptions.saveGrouping, gridOptions.saveGroupingExpandedStates = !0 === gridOptions.saveGroupingExpandedStates, 
                gridOptions.savePinning = !1 !== gridOptions.savePinning, gridOptions.saveTreeView = !1 !== gridOptions.saveTreeView;
            },
            save: function(grid) {
                var savedState = {};
                return savedState.columns = service.saveColumns(grid), savedState.scrollFocus = service.saveScrollFocus(grid), 
                savedState.selection = service.saveSelection(grid), savedState.grouping = service.saveGrouping(grid), 
                savedState.treeView = service.saveTreeView(grid), savedState.pagination = service.savePagination(grid), 
                savedState;
            },
            restore: function(grid, $scope, state) {
                return state.columns && service.restoreColumns(grid, state.columns), state.scrollFocus && service.restoreScrollFocus(grid, $scope, state.scrollFocus), 
                state.selection && service.restoreSelection(grid, state.selection), state.grouping && service.restoreGrouping(grid, state.grouping), 
                state.treeView && service.restoreTreeView(grid, state.treeView), state.pagination && service.restorePagination(grid, state.pagination), 
                grid.refresh();
            },
            saveColumns: function(grid) {
                var columns = [];
                return grid.getOnlyDataColumns().forEach(function(column) {
                    var savedColumn = {};
                    savedColumn.name = column.name, grid.options.saveVisible && (savedColumn.visible = column.visible), 
                    grid.options.saveWidths && (savedColumn.width = column.width), grid.options.saveSort && (savedColumn.sort = angular.copy(column.sort)), 
                    grid.options.saveFilter && (savedColumn.filters = [], column.filters.forEach(function(filter) {
                        var copiedFilter = {};
                        angular.forEach(filter, function(value, key) {
                            "condition" !== key && "$$hashKey" !== key && "placeholder" !== key && (copiedFilter[key] = value);
                        }), savedColumn.filters.push(copiedFilter);
                    })), grid.api.pinning && grid.options.savePinning && (savedColumn.pinned = column.renderContainer ? column.renderContainer : ""), 
                    columns.push(savedColumn);
                }), columns;
            },
            saveScrollFocus: function(grid) {
                if (!grid.api.cellNav) return {};
                var scrollFocus = {};
                if (grid.options.saveFocus) {
                    scrollFocus.focus = !0;
                    var rowCol = grid.api.cellNav.getFocusedCell();
                    null !== rowCol && (null !== rowCol.col && (scrollFocus.colName = rowCol.col.colDef.name), 
                    null !== rowCol.row && (scrollFocus.rowVal = service.getRowVal(grid, rowCol.row)));
                }
                return (grid.options.saveScroll || grid.options.saveFocus && !scrollFocus.colName && !scrollFocus.rowVal) && (scrollFocus.focus = !1, 
                grid.renderContainers.body.prevRowScrollIndex && (scrollFocus.rowVal = service.getRowVal(grid, grid.renderContainers.body.visibleRowCache[grid.renderContainers.body.prevRowScrollIndex])), 
                grid.renderContainers.body.prevColScrollIndex && (scrollFocus.colName = grid.renderContainers.body.visibleColumnCache[grid.renderContainers.body.prevColScrollIndex].name)), 
                scrollFocus;
            },
            saveSelection: function(grid) {
                return grid.api.selection && grid.options.saveSelection ? grid.api.selection.getSelectedGridRows().map(function(gridRow) {
                    return service.getRowVal(grid, gridRow);
                }) : [];
            },
            saveGrouping: function(grid) {
                return grid.api.grouping && grid.options.saveGrouping ? grid.api.grouping.getGrouping(grid.options.saveGroupingExpandedStates) : {};
            },
            savePagination: function(grid) {
                return grid.api.pagination && grid.options.paginationPageSize ? {
                    paginationCurrentPage: grid.options.paginationCurrentPage,
                    paginationPageSize: grid.options.paginationPageSize
                } : {};
            },
            saveTreeView: function(grid) {
                return grid.api.treeView && grid.options.saveTreeView ? grid.api.treeView.getTreeView() : {};
            },
            getRowVal: function(grid, gridRow) {
                if (!gridRow) return null;
                var rowVal = {};
                return grid.options.saveRowIdentity ? (rowVal.identity = !0, rowVal.row = grid.options.saveRowIdentity(gridRow.entity)) : (rowVal.identity = !1, 
                rowVal.row = grid.renderContainers.body.visibleRowCache.indexOf(gridRow)), rowVal;
            },
            restoreColumns: function(grid, columnsState) {
                var isSortChanged = !1;
                columnsState.forEach(function(columnState, index) {
                    var currentCol = grid.getColumn(columnState.name);
                    if (currentCol && !grid.isRowHeaderColumn(currentCol)) {
                        !grid.options.saveVisible || currentCol.visible === columnState.visible && currentCol.colDef.visible === columnState.visible || (currentCol.visible = columnState.visible, 
                        currentCol.colDef.visible = columnState.visible, grid.api.core.raise.columnVisibilityChanged(currentCol)), 
                        grid.options.saveWidths && currentCol.width !== columnState.width && (currentCol.width = columnState.width, 
                        currentCol.hasCustomWidth = !0), !grid.options.saveSort || angular.equals(currentCol.sort, columnState.sort) || void 0 === currentCol.sort && angular.isEmpty(columnState.sort) || (currentCol.sort = angular.copy(columnState.sort), 
                        isSortChanged = !0), grid.options.saveFilter && !angular.equals(currentCol.filters, columnState.filters) && (columnState.filters.forEach(function(filter, index) {
                            angular.extend(currentCol.filters[index], filter), void 0 !== filter.term && null !== filter.term || delete currentCol.filters[index].term;
                        }), grid.api.core.raise.filterChanged()), grid.api.pinning && grid.options.savePinning && currentCol.renderContainer !== columnState.pinned && grid.api.pinning.pinColumn(currentCol, columnState.pinned);
                        var currentIndex = grid.getOnlyDataColumns().indexOf(currentCol);
                        if (-1 !== currentIndex && grid.options.saveOrder && currentIndex !== index) {
                            var column = grid.columns.splice(currentIndex + grid.rowHeaderColumns.length, 1)[0];
                            grid.columns.splice(index + grid.rowHeaderColumns.length, 0, column);
                        }
                    }
                }), isSortChanged && grid.api.core.raise.sortChanged(grid, grid.getColumnSorting());
            },
            restoreScrollFocus: function(grid, $scope, scrollFocusState) {
                if (grid.api.cellNav) {
                    var colDef, row;
                    if (scrollFocusState.colName) {
                        var colDefs = grid.options.columnDefs.filter(function(colDef) {
                            return colDef.name === scrollFocusState.colName;
                        });
                        0 < colDefs.length && (colDef = colDefs[0]);
                    }
                    scrollFocusState.rowVal && scrollFocusState.rowVal.row && (row = scrollFocusState.rowVal.identity ? service.findRowByIdentity(grid, scrollFocusState.rowVal) : grid.renderContainers.body.visibleRowCache[scrollFocusState.rowVal.row]);
                    var entity = row && row.entity ? row.entity : null;
                    (colDef || entity) && (scrollFocusState.focus ? grid.api.cellNav.scrollToFocus(entity, colDef) : grid.scrollTo(entity, colDef));
                }
            },
            restoreSelection: function(grid, selectionState) {
                grid.api.selection && (grid.api.selection.clearSelectedRows(), selectionState.forEach(function(rowVal) {
                    if (rowVal.identity) {
                        var foundRow = service.findRowByIdentity(grid, rowVal);
                        foundRow && grid.api.selection.selectRow(foundRow.entity);
                    } else grid.api.selection.selectRowByVisibleIndex(rowVal.row);
                }));
            },
            restoreGrouping: function(grid, groupingState) {
                grid.api.grouping && null != groupingState && !angular.equals(groupingState, {}) && grid.api.grouping.setGrouping(groupingState);
            },
            restoreTreeView: function(grid, treeViewState) {
                grid.api.treeView && null != treeViewState && !angular.equals(treeViewState, {}) && grid.api.treeView.setTreeView(treeViewState);
            },
            restorePagination: function(grid, pagination) {
                grid.api.pagination && grid.options.paginationPageSize && (grid.options.paginationCurrentPage = pagination.paginationCurrentPage, 
                grid.options.paginationPageSize = pagination.paginationPageSize);
            },
            findRowByIdentity: function(grid, rowVal) {
                if (!grid.options.saveRowIdentity) return null;
                var filteredRows = grid.rows.filter(function(gridRow) {
                    return grid.options.saveRowIdentity(gridRow.entity) === rowVal.row;
                });
                return 0 < filteredRows.length ? filteredRows[0] : null;
            }
        };
        return service;
    } ]), module.directive("uiGridSaveState", [ "uiGridSaveStateConstants", "uiGridSaveStateService", "gridUtil", "$compile", function(uiGridSaveStateConstants, uiGridSaveStateService, gridUtil, $compile) {
        return {
            replace: !0,
            priority: 0,
            require: "^uiGrid",
            scope: !1,
            link: function($scope, $elm, $attrs, uiGridCtrl) {
                uiGridSaveStateService.initializeGrid(uiGridCtrl.grid);
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.selection", [ "ui.grid" ]);
    module.constant("uiGridSelectionConstants", {
        featureName: "selection",
        selectionRowHeaderColName: "selectionRowHeaderCol"
    }), angular.module("ui.grid").config([ "$provide", function($provide) {
        $provide.decorator("GridRow", [ "$delegate", function($delegate) {
            return $delegate.prototype.setSelected = function(selected) {
                selected !== this.isSelected && (this.isSelected = selected, this.grid.selection.selectedCount += selected ? 1 : -1);
            }, $delegate;
        } ]);
    } ]), module.service("uiGridSelectionService", [ "$q", "$templateCache", "uiGridSelectionConstants", "gridUtil", function($q, $templateCache, uiGridSelectionConstants, gridUtil) {
        var service = {
            initializeGrid: function(grid) {
                grid.selection = {}, grid.selection.lastSelectedRow = null, grid.selection.selectAll = !1, 
                grid.selection.selectedCount = 0, service.defaultGridOptions(grid.options);
                var publicApi = {
                    events: {
                        selection: {
                            rowSelectionChanged: function(scope, row, evt) {},
                            rowSelectionChangedBatch: function(scope, rows, evt) {}
                        }
                    },
                    methods: {
                        selection: {
                            toggleRowSelection: function(rowEntity, evt) {
                                var row = grid.getRow(rowEntity);
                                null !== row && service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
                            },
                            selectRow: function(rowEntity, evt) {
                                var row = grid.getRow(rowEntity);
                                null === row || row.isSelected || service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
                            },
                            selectRowByVisibleIndex: function(rowNum, evt) {
                                var row = grid.renderContainers.body.visibleRowCache[rowNum];
                                null == row || row.isSelected || service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
                            },
                            unSelectRow: function(rowEntity, evt) {
                                var row = grid.getRow(rowEntity);
                                null !== row && row.isSelected && service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
                            },
                            unSelectRowByVisibleIndex: function(rowNum, evt) {
                                var row = grid.renderContainers.body.visibleRowCache[rowNum];
                                null != row && row.isSelected && service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
                            },
                            selectAllRows: function(evt) {
                                if (!1 !== grid.options.multiSelect) {
                                    var changedRows = [];
                                    grid.rows.forEach(function(row) {
                                        row.isSelected || !1 === row.enableSelection || !1 === grid.options.isRowSelectable(row) || (row.setSelected(!0), 
                                        service.decideRaiseSelectionEvent(grid, row, changedRows, evt));
                                    }), grid.selection.selectAll = !0, service.decideRaiseSelectionBatchEvent(grid, changedRows, evt);
                                }
                            },
                            selectAllVisibleRows: function(evt) {
                                if (!1 !== grid.options.multiSelect) {
                                    var changedRows = [];
                                    grid.rows.forEach(function(row) {
                                        row.visible ? row.isSelected || !1 === row.enableSelection || !1 === grid.options.isRowSelectable(row) || (row.setSelected(!0), 
                                        service.decideRaiseSelectionEvent(grid, row, changedRows, evt)) : row.isSelected && (row.setSelected(!1), 
                                        service.decideRaiseSelectionEvent(grid, row, changedRows, evt));
                                    }), grid.selection.selectAll = !0, service.decideRaiseSelectionBatchEvent(grid, changedRows, evt);
                                }
                            },
                            clearSelectedRows: function(evt) {
                                service.clearSelectedRows(grid, evt);
                            },
                            getSelectedRows: function() {
                                return service.getSelectedRows(grid).map(function(gridRow) {
                                    return gridRow.entity;
                                }).filter(function(entity) {
                                    return entity.hasOwnProperty("$$hashKey") || !angular.isObject(entity);
                                });
                            },
                            getSelectedGridRows: function() {
                                return service.getSelectedRows(grid);
                            },
                            getSelectedCount: function() {
                                return grid.selection.selectedCount;
                            },
                            setMultiSelect: function(multiSelect) {
                                grid.options.multiSelect = multiSelect;
                            },
                            setModifierKeysToMultiSelect: function(modifierKeysToMultiSelect) {
                                grid.options.modifierKeysToMultiSelect = modifierKeysToMultiSelect;
                            },
                            getSelectAllState: function() {
                                return grid.selection.selectAll;
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods);
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.enableRowSelection = !1 !== gridOptions.enableRowSelection, gridOptions.multiSelect = !1 !== gridOptions.multiSelect, 
                gridOptions.noUnselect = !0 === gridOptions.noUnselect, gridOptions.modifierKeysToMultiSelect = !0 === gridOptions.modifierKeysToMultiSelect, 
                gridOptions.enableRowHeaderSelection = !1 !== gridOptions.enableRowHeaderSelection, 
                void 0 === gridOptions.enableFullRowSelection && (gridOptions.enableFullRowSelection = !gridOptions.enableRowHeaderSelection), 
                gridOptions.enableSelectAll = !1 !== gridOptions.enableSelectAll, gridOptions.enableSelectionBatchEvent = !1 !== gridOptions.enableSelectionBatchEvent, 
                gridOptions.selectionRowHeaderWidth = angular.isDefined(gridOptions.selectionRowHeaderWidth) ? gridOptions.selectionRowHeaderWidth : 30, 
                gridOptions.enableFooterTotalSelected = !1 !== gridOptions.enableFooterTotalSelected, 
                gridOptions.isRowSelectable = angular.isDefined(gridOptions.isRowSelectable) ? gridOptions.isRowSelectable : angular.noop;
            },
            toggleRowSelection: function(grid, row, evt, multiSelect, noUnselect) {
                var selectedRows, selected = row.isSelected;
                !1 !== row.enableSelection && (multiSelect || selected ? !multiSelect && selected && 1 < (selectedRows = service.getSelectedRows(grid)).length && (selected = !1, 
                service.clearSelectedRows(grid, evt)) : service.clearSelectedRows(grid, evt), selected && noUnselect || (row.setSelected(!selected), 
                !0 === row.isSelected && (grid.selection.lastSelectedRow = row), selectedRows = service.getSelectedRows(grid), 
                grid.selection.selectAll = grid.rows.length === selectedRows.length, grid.api.selection.raise.rowSelectionChanged(row, evt)));
            },
            shiftSelect: function(grid, row, evt, multiSelect) {
                if (multiSelect) {
                    var fromRow = 0 < service.getSelectedRows(grid).length ? grid.renderContainers.body.visibleRowCache.indexOf(grid.selection.lastSelectedRow) : 0, toRow = grid.renderContainers.body.visibleRowCache.indexOf(row);
                    if (toRow < fromRow) {
                        var tmp = fromRow;
                        fromRow = toRow, toRow = tmp;
                    }
                    for (var changedRows = [], i = fromRow; i <= toRow; i++) {
                        var rowToSelect = grid.renderContainers.body.visibleRowCache[i];
                        rowToSelect && (rowToSelect.isSelected || !1 === rowToSelect.enableSelection || (rowToSelect.setSelected(!0), 
                        grid.selection.lastSelectedRow = rowToSelect, service.decideRaiseSelectionEvent(grid, rowToSelect, changedRows, evt)));
                    }
                    service.decideRaiseSelectionBatchEvent(grid, changedRows, evt);
                }
            },
            getSelectedRows: function(grid) {
                return grid.rows.filter(function(row) {
                    return row.isSelected;
                });
            },
            clearSelectedRows: function(grid, evt) {
                var changedRows = [];
                service.getSelectedRows(grid).forEach(function(row) {
                    row.isSelected && (row.setSelected(!1), service.decideRaiseSelectionEvent(grid, row, changedRows, evt));
                }), grid.selection.selectAll = !1, grid.selection.selectedCount = 0, service.decideRaiseSelectionBatchEvent(grid, changedRows, evt);
            },
            decideRaiseSelectionEvent: function(grid, row, changedRows, evt) {
                grid.options.enableSelectionBatchEvent ? changedRows.push(row) : grid.api.selection.raise.rowSelectionChanged(row, evt);
            },
            decideRaiseSelectionBatchEvent: function(grid, changedRows, evt) {
                0 < changedRows.length && grid.api.selection.raise.rowSelectionChangedBatch(changedRows, evt);
            }
        };
        return service;
    } ]), module.directive("uiGridSelection", [ "uiGridSelectionConstants", "uiGridSelectionService", "$templateCache", "uiGridConstants", function(uiGridSelectionConstants, uiGridSelectionService, $templateCache, uiGridConstants) {
        return {
            replace: !0,
            priority: 0,
            require: "^uiGrid",
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        if (uiGridSelectionService.initializeGrid(uiGridCtrl.grid), uiGridCtrl.grid.options.enableRowHeaderSelection) {
                            var selectionRowHeaderDef = {
                                name: uiGridSelectionConstants.selectionRowHeaderColName,
                                displayName: "",
                                width: uiGridCtrl.grid.options.selectionRowHeaderWidth,
                                minWidth: 10,
                                cellTemplate: "ui-grid/selectionRowHeader",
                                headerCellTemplate: "ui-grid/selectionHeaderCell",
                                enableColumnResizing: !1,
                                enableColumnMenu: !1,
                                exporterSuppressExport: !0,
                                allowCellFocus: !0
                            };
                            uiGridCtrl.grid.addRowHeaderColumn(selectionRowHeaderDef, 0);
                        }
                        var processorSet = !1, processSelectableRows = function(rows) {
                            return rows.forEach(function(row) {
                                row.enableSelection = uiGridCtrl.grid.options.isRowSelectable(row);
                            }), rows;
                        }, updateOptions = function() {
                            uiGridCtrl.grid.options.isRowSelectable !== angular.noop && !0 !== processorSet && (uiGridCtrl.grid.registerRowsProcessor(processSelectableRows, 500), 
                            processorSet = !0);
                        };
                        updateOptions();
                        var dataChangeDereg = uiGridCtrl.grid.registerDataChangeCallback(updateOptions, [ uiGridConstants.dataChange.OPTIONS ]);
                        $scope.$on("$destroy", dataChangeDereg);
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {}
                };
            }
        };
    } ]), module.directive("uiGridSelectionRowHeaderButtons", [ "$templateCache", "uiGridSelectionService", "gridUtil", function($templateCache, uiGridSelectionService, gridUtil) {
        return {
            replace: !0,
            restrict: "E",
            template: $templateCache.get("ui-grid/selectionRowHeaderButtons"),
            scope: !0,
            require: "^uiGrid",
            link: function($scope, $elm, $attrs, uiGridCtrl) {
                var self = uiGridCtrl.grid;
                function selectButtonClick(row, evt) {
                    if (evt.stopPropagation(), evt.shiftKey) uiGridSelectionService.shiftSelect(self, row, evt, self.options.multiSelect); else if (evt.ctrlKey || evt.metaKey) uiGridSelectionService.toggleRowSelection(self, row, evt, self.options.multiSelect, self.options.noUnselect); else if (row.groupHeader) {
                        uiGridSelectionService.toggleRowSelection(self, row, evt, self.options.multiSelect, self.options.noUnselect);
                        for (var i = 0; i < row.treeNode.children.length; i++) uiGridSelectionService.toggleRowSelection(self, row.treeNode.children[i].row, evt, self.options.multiSelect, self.options.noUnselect);
                    } else uiGridSelectionService.toggleRowSelection(self, row, evt, self.options.multiSelect && !self.options.modifierKeysToMultiSelect, self.options.noUnselect);
                }
                $scope.selectButtonClick = selectButtonClick, $scope.selectButtonKeyDown = function(row, evt) {
                    32 === evt.keyCode && (evt.preventDefault(), selectButtonClick(row, evt));
                }, "ie" === gridUtil.detectBrowser() && $elm.on("mousedown", function(evt) {
                    (evt.ctrlKey || evt.shiftKey) && (evt.target.onselectstart = function() {
                        return !1;
                    }, window.setTimeout(function() {
                        evt.target.onselectstart = null;
                    }, 0));
                }), $scope.$on("$destroy", function() {
                    $elm.off();
                });
            }
        };
    } ]), module.directive("uiGridSelectionSelectAllButtons", [ "$templateCache", "uiGridSelectionService", function($templateCache, uiGridSelectionService) {
        return {
            replace: !0,
            restrict: "E",
            template: $templateCache.get("ui-grid/selectionSelectAllButtons"),
            scope: !1,
            link: function($scope, $elm, $attrs, uiGridCtrl) {
                var self = $scope.col.grid;
                $scope.headerButtonKeyDown = function(evt) {
                    32 !== evt.keyCode && 13 !== evt.keyCode || (evt.preventDefault(), $scope.headerButtonClick(evt));
                }, $scope.headerButtonClick = function(evt) {
                    self.selection.selectAll ? (uiGridSelectionService.clearSelectedRows(self, evt), 
                    self.options.noUnselect && self.api.selection.selectRowByVisibleIndex(0, evt), self.selection.selectAll = !1) : self.options.multiSelect && (self.api.selection.selectAllVisibleRows(evt), 
                    self.selection.selectAll = !0);
                };
            }
        };
    } ]), module.directive("uiGridViewport", [ "$compile", "uiGridConstants", "uiGridSelectionConstants", "gridUtil", "$parse", "uiGridSelectionService", function($compile, uiGridConstants, uiGridSelectionConstants, gridUtil, $parse, uiGridSelectionService) {
        return {
            priority: -200,
            scope: !1,
            compile: function($elm, $attrs) {
                var rowRepeatDiv = angular.element($elm[0].querySelector(".ui-grid-canvas:not(.ui-grid-empty-base-layer-container)").children[0]), existingNgClass = rowRepeatDiv.attr("ng-class"), newNgClass = "";
                return newNgClass = existingNgClass ? existingNgClass.slice(0, -1) + ",'ui-grid-row-selected': row.isSelected}" : "{'ui-grid-row-selected': row.isSelected}", 
                rowRepeatDiv.attr("ng-class", newNgClass), {
                    pre: function($scope, $elm, $attrs, controllers) {},
                    post: function($scope, $elm, $attrs, controllers) {}
                };
            }
        };
    } ]), module.directive("uiGridCell", [ "$compile", "uiGridConstants", "uiGridSelectionConstants", "gridUtil", "$parse", "uiGridSelectionService", "$timeout", function($compile, uiGridConstants, uiGridSelectionConstants, gridUtil, $parse, uiGridSelectionService, $timeout) {
        return {
            priority: -200,
            restrict: "A",
            require: "?^uiGrid",
            scope: !1,
            link: function($scope, $elm, $attrs, uiGridCtrl) {
                var touchStartTime = 0;
                uiGridCtrl.grid.api.cellNav && uiGridCtrl.grid.api.cellNav.on.viewPortKeyDown($scope, function(evt, rowCol) {
                    null !== rowCol && rowCol.row === $scope.row && rowCol.col === $scope.col && 32 === evt.keyCode && "selectionRowHeaderCol" === $scope.col.colDef.name && (evt.preventDefault(), 
                    uiGridSelectionService.toggleRowSelection($scope.grid, $scope.row, evt, $scope.grid.options.multiSelect && !$scope.grid.options.modifierKeysToMultiSelect, $scope.grid.options.noUnselect), 
                    $scope.$apply());
                });
                var selectCells = function(evt) {
                    "ui-grid-icon-minus-squared" !== evt.target.className && "ui-grid-icon-plus-squared" !== evt.target.className && ($elm.off("touchend", touchEnd), 
                    evt.shiftKey ? uiGridSelectionService.shiftSelect($scope.grid, $scope.row, evt, $scope.grid.options.multiSelect) : evt.ctrlKey || evt.metaKey ? uiGridSelectionService.toggleRowSelection($scope.grid, $scope.row, evt, $scope.grid.options.multiSelect, $scope.grid.options.noUnselect) : uiGridSelectionService.toggleRowSelection($scope.grid, $scope.row, evt, $scope.grid.options.multiSelect && !$scope.grid.options.modifierKeysToMultiSelect, $scope.grid.options.noUnselect), 
                    $scope.$apply(), $timeout(function() {
                        $elm.on("touchend", touchEnd);
                    }, 300));
                }, touchStart = function(evt) {
                    touchStartTime = new Date().getTime(), $elm.off("click", selectCells);
                }, touchEnd = function(evt) {
                    new Date().getTime() - touchStartTime < 300 && selectCells(evt), $timeout(function() {
                        $elm.on("click", selectCells);
                    }, 300);
                };
                function registerRowSelectionEvents() {
                    $scope.grid.options.enableRowSelection && $scope.grid.options.enableFullRowSelection && "selectionRowHeaderCol" !== $scope.col.colDef.name && ($elm.addClass("ui-grid-disable-selection"), 
                    $elm.on("touchstart", touchStart), $elm.on("touchend", touchEnd), $elm.on("click", selectCells), 
                    $scope.registered = !0);
                }
                registerRowSelectionEvents();
                var dataChangeDereg = $scope.grid.registerDataChangeCallback(function() {
                    $scope.grid.options.enableRowSelection && $scope.grid.options.enableFullRowSelection && !$scope.registered ? registerRowSelectionEvents() : $scope.grid.options.enableRowSelection && $scope.grid.options.enableFullRowSelection || !$scope.registered || $scope.registered && ($elm.removeClass("ui-grid-disable-selection"), 
                    $elm.off("touchstart", touchStart), $elm.off("touchend", touchEnd), $elm.off("click", selectCells), 
                    $scope.registered = !1);
                }, [ uiGridConstants.dataChange.OPTIONS ]);
                $elm.on("$destroy", dataChangeDereg);
            }
        };
    } ]), module.directive("uiGridGridFooter", [ "$compile", "uiGridConstants", "gridUtil", function($compile, uiGridConstants, gridUtil) {
        return {
            restrict: "EA",
            replace: !0,
            priority: -1e3,
            require: "^uiGrid",
            scope: !0,
            compile: function($elm, $attrs) {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        uiGridCtrl.grid.options.showGridFooter && gridUtil.getTemplate("ui-grid/gridFooterSelectedItems").then(function(contents) {
                            var template = angular.element(contents), newElm = $compile(template)($scope);
                            angular.element($elm[0].getElementsByClassName("ui-grid-grid-footer")[0]).append(newElm);
                        });
                    },
                    post: function($scope, $elm, $attrs, controllers) {}
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.treeBase", [ "ui.grid" ]);
    module.constant("uiGridTreeBaseConstants", {
        featureName: "treeBase",
        rowHeaderColName: "treeBaseRowHeaderCol",
        EXPANDED: "expanded",
        COLLAPSED: "collapsed",
        aggregation: {
            COUNT: "count",
            SUM: "sum",
            MAX: "max",
            MIN: "min",
            AVG: "avg"
        }
    }), module.service("uiGridTreeBaseService", [ "$q", "uiGridTreeBaseConstants", "gridUtil", "GridRow", "gridClassFactory", "i18nService", "uiGridConstants", "rowSorter", function($q, uiGridTreeBaseConstants, gridUtil, GridRow, gridClassFactory, i18nService, uiGridConstants, rowSorter) {
        var service = {
            initializeGrid: function(grid, $scope) {
                grid.treeBase = {}, grid.treeBase.numberLevels = 0, grid.treeBase.expandAll = !1, 
                grid.treeBase.tree = [], service.defaultGridOptions(grid.options), grid.registerRowsProcessor(service.treeRows, 410), 
                grid.registerColumnBuilder(service.treeBaseColumnBuilder), service.createRowHeader(grid);
                var publicApi = {
                    events: {
                        treeBase: {
                            rowExpanded: {},
                            rowCollapsed: {}
                        }
                    },
                    methods: {
                        treeBase: {
                            expandAllRows: function() {
                                service.expandAllRows(grid);
                            },
                            collapseAllRows: function() {
                                service.collapseAllRows(grid);
                            },
                            toggleRowTreeState: function(row) {
                                service.toggleRowTreeState(grid, row);
                            },
                            expandRow: function(row, recursive) {
                                service.expandRow(grid, row, recursive);
                            },
                            expandRowChildren: function(row) {
                                service.expandRowChildren(grid, row);
                            },
                            collapseRow: function(row) {
                                service.collapseRow(grid, row);
                            },
                            collapseRowChildren: function(row) {
                                service.collapseRowChildren(grid, row);
                            },
                            getTreeExpandedState: function() {
                                return {
                                    expandedState: service.getTreeState(grid)
                                };
                            },
                            setTreeState: function(config) {
                                service.setTreeState(grid, config);
                            },
                            getRowChildren: function(row) {
                                return row.treeNode.children.map(function(childNode) {
                                    return childNode.row;
                                });
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods);
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.treeRowHeaderBaseWidth = gridOptions.treeRowHeaderBaseWidth || 30, gridOptions.treeIndent = null != gridOptions.treeIndent ? gridOptions.treeIndent : 10, 
                gridOptions.showTreeRowHeader = !1 !== gridOptions.showTreeRowHeader, gridOptions.showTreeExpandNoChildren = !1 !== gridOptions.showTreeExpandNoChildren, 
                gridOptions.treeRowHeaderAlwaysVisible = !1 !== gridOptions.treeRowHeaderAlwaysVisible, 
                gridOptions.treeCustomAggregations = gridOptions.treeCustomAggregations || {}, gridOptions.enableExpandAll = !1 !== gridOptions.enableExpandAll;
            },
            treeBaseColumnBuilder: function(colDef, col, gridOptions) {
                void 0 !== colDef.customTreeAggregationFn && (col.treeAggregationFn = colDef.customTreeAggregationFn), 
                void 0 !== colDef.treeAggregationType && (col.treeAggregation = {
                    type: colDef.treeAggregationType
                }, void 0 !== gridOptions.treeCustomAggregations[colDef.treeAggregationType] ? (col.treeAggregationFn = gridOptions.treeCustomAggregations[colDef.treeAggregationType].aggregationFn, 
                col.treeAggregationFinalizerFn = gridOptions.treeCustomAggregations[colDef.treeAggregationType].finalizerFn, 
                col.treeAggregation.label = gridOptions.treeCustomAggregations[colDef.treeAggregationType].label) : void 0 !== service.nativeAggregations()[colDef.treeAggregationType] && (col.treeAggregationFn = service.nativeAggregations()[colDef.treeAggregationType].aggregationFn, 
                col.treeAggregation.label = service.nativeAggregations()[colDef.treeAggregationType].label)), 
                void 0 !== colDef.treeAggregationLabel && (void 0 === col.treeAggregation && (col.treeAggregation = {}), 
                col.treeAggregation.label = colDef.treeAggregationLabel), col.treeAggregationUpdateEntity = !1 !== colDef.treeAggregationUpdateEntity, 
                void 0 === col.customTreeAggregationFinalizerFn && (col.customTreeAggregationFinalizerFn = colDef.customTreeAggregationFinalizerFn);
            },
            createRowHeader: function(grid) {
                var rowHeaderColumnDef = {
                    name: uiGridTreeBaseConstants.rowHeaderColName,
                    displayName: "",
                    width: grid.options.treeRowHeaderBaseWidth,
                    minWidth: 10,
                    cellTemplate: "ui-grid/treeBaseRowHeader",
                    headerCellTemplate: "ui-grid/treeBaseHeaderCell",
                    enableColumnResizing: !1,
                    enableColumnMenu: !1,
                    exporterSuppressExport: !0,
                    allowCellFocus: !0
                };
                rowHeaderColumnDef.visible = grid.options.treeRowHeaderAlwaysVisible, grid.addRowHeaderColumn(rowHeaderColumnDef, -100);
            },
            expandAllRows: function(grid) {
                grid.treeBase.tree.forEach(function(node) {
                    service.setAllNodes(grid, node, uiGridTreeBaseConstants.EXPANDED);
                }), grid.treeBase.expandAll = !0, grid.queueGridRefresh();
            },
            collapseAllRows: function(grid) {
                grid.treeBase.tree.forEach(function(node) {
                    service.setAllNodes(grid, node, uiGridTreeBaseConstants.COLLAPSED);
                }), grid.treeBase.expandAll = !1, grid.queueGridRefresh();
            },
            setAllNodes: function(grid, treeNode, targetState) {
                void 0 !== treeNode.state && treeNode.state !== targetState && ((treeNode.state = targetState) === uiGridTreeBaseConstants.EXPANDED ? grid.api.treeBase.raise.rowExpanded(treeNode.row) : grid.api.treeBase.raise.rowCollapsed(treeNode.row)), 
                treeNode.children && treeNode.children.forEach(function(childNode) {
                    service.setAllNodes(grid, childNode, targetState);
                });
            },
            toggleRowTreeState: function(grid, row) {
                void 0 === row.treeLevel || null === row.treeLevel || row.treeLevel < 0 || (row.treeNode.state === uiGridTreeBaseConstants.EXPANDED ? service.collapseRow(grid, row) : service.expandRow(grid, row, !1), 
                grid.queueGridRefresh());
            },
            expandRow: function(grid, row, recursive) {
                if (recursive) {
                    for (var parents = []; row && void 0 !== row.treeLevel && null !== row.treeLevel && 0 <= row.treeLevel && row.treeNode.state !== uiGridTreeBaseConstants.EXPANDED; ) parents.push(row), 
                    row = row.treeNode.parentRow;
                    if (0 < parents.length) {
                        for (row = parents.pop(); row; ) row.treeNode.state = uiGridTreeBaseConstants.EXPANDED, 
                        grid.api.treeBase.raise.rowExpanded(row), row = parents.pop();
                        grid.treeBase.expandAll = service.allExpanded(grid.treeBase.tree), grid.queueGridRefresh();
                    }
                } else {
                    if (void 0 === row.treeLevel || null === row.treeLevel || row.treeLevel < 0) return;
                    row.treeNode.state !== uiGridTreeBaseConstants.EXPANDED && (row.treeNode.state = uiGridTreeBaseConstants.EXPANDED, 
                    grid.api.treeBase.raise.rowExpanded(row), grid.treeBase.expandAll = service.allExpanded(grid.treeBase.tree), 
                    grid.queueGridRefresh());
                }
            },
            expandRowChildren: function(grid, row) {
                void 0 === row.treeLevel || null === row.treeLevel || row.treeLevel < 0 || (service.setAllNodes(grid, row.treeNode, uiGridTreeBaseConstants.EXPANDED), 
                grid.treeBase.expandAll = service.allExpanded(grid.treeBase.tree), grid.queueGridRefresh());
            },
            collapseRow: function(grid, row) {
                void 0 === row.treeLevel || null === row.treeLevel || row.treeLevel < 0 || row.treeNode.state !== uiGridTreeBaseConstants.COLLAPSED && (row.treeNode.state = uiGridTreeBaseConstants.COLLAPSED, 
                grid.treeBase.expandAll = !1, grid.api.treeBase.raise.rowCollapsed(row), grid.queueGridRefresh());
            },
            collapseRowChildren: function(grid, row) {
                void 0 === row.treeLevel || null === row.treeLevel || row.treeLevel < 0 || (service.setAllNodes(grid, row.treeNode, uiGridTreeBaseConstants.COLLAPSED), 
                grid.treeBase.expandAll = !1, grid.queueGridRefresh());
            },
            allExpanded: function(tree) {
                var allExpanded = !0;
                return tree.forEach(function(node) {
                    service.allExpandedInternal(node) || (allExpanded = !1);
                }), allExpanded;
            },
            allExpandedInternal: function(treeNode) {
                if (treeNode.children && 0 < treeNode.children.length) {
                    if (treeNode.state === uiGridTreeBaseConstants.COLLAPSED) return !1;
                    var allExpanded = !0;
                    return treeNode.children.forEach(function(node) {
                        service.allExpandedInternal(node) || (allExpanded = !1);
                    }), allExpanded;
                }
                return !0;
            },
            treeRows: function(renderableRows) {
                return 0 === renderableRows.length ? (service.updateRowHeaderWidth(this), renderableRows) : (this.treeBase.tree = service.createTree(this, renderableRows), 
                service.updateRowHeaderWidth(this), service.sortTree(this), service.fixFilter(this), 
                service.renderTree(this.treeBase.tree));
            },
            updateRowHeaderWidth: function(grid) {
                var rowHeader = grid.getColumn(uiGridTreeBaseConstants.rowHeaderColName), newWidth = grid.options.treeRowHeaderBaseWidth + grid.options.treeIndent * Math.max(grid.treeBase.numberLevels - 1, 0);
                rowHeader && newWidth !== rowHeader.width && (rowHeader.width = newWidth, grid.queueRefresh());
                var newVisibility = !0;
                !1 === grid.options.showTreeRowHeader && (newVisibility = !1), !1 === grid.options.treeRowHeaderAlwaysVisible && grid.treeBase.numberLevels <= 0 && (newVisibility = !1), 
                rowHeader && rowHeader.visible !== newVisibility && (rowHeader.visible = newVisibility, 
                rowHeader.colDef.visible = newVisibility, grid.queueGridRefresh());
            },
            renderTree: function(nodeList) {
                var renderableRows = [];
                return nodeList.forEach(function(node) {
                    node.row.visible && renderableRows.push(node.row), node.state === uiGridTreeBaseConstants.EXPANDED && node.children && 0 < node.children.length && (renderableRows = renderableRows.concat(service.renderTree(node.children)));
                }), renderableRows;
            },
            createTree: function(grid, renderableRows) {
                var currentLevel = -1, parents = [];
                grid.treeBase.tree = [], grid.treeBase.numberLevels = 0;
                var aggregations = service.getAggregations(grid);
                for (renderableRows.forEach(function(row) {
                    if (void 0 !== row.entity.$$treeLevel && row.treeLevel !== row.entity.$$treeLevel && (row.treeLevel = row.entity.$$treeLevel), 
                    row.treeLevel <= currentLevel) {
                        for (;row.treeLevel <= currentLevel; ) {
                            var lastParent = parents.pop();
                            service.finaliseAggregations(lastParent), currentLevel--;
                        }
                        0 < parents.length ? service.setCurrentState(parents) : uiGridTreeBaseConstants.EXPANDED;
                    }
                    (void 0 === row.treeLevel || null === row.treeLevel || row.treeLevel < 0) && row.visible && service.aggregate(grid, row, parents), 
                    service.addOrUseNode(grid, row, parents, aggregations), void 0 !== row.treeLevel && null !== row.treeLevel && 0 <= row.treeLevel && (parents.push(row), 
                    currentLevel++, service.setCurrentState(parents)), grid.treeBase.numberLevels < row.treeLevel + 1 && (grid.treeBase.numberLevels = row.treeLevel + 1);
                }); 0 < parents.length; ) {
                    var lastParent = parents.pop();
                    service.finaliseAggregations(lastParent);
                }
                return grid.treeBase.tree;
            },
            addOrUseNode: function(grid, row, parents, aggregationBase) {
                var newAggregations = [];
                aggregationBase.forEach(function(aggregation) {
                    newAggregations.push(service.buildAggregationObject(aggregation.col));
                });
                var newNode = {
                    state: uiGridTreeBaseConstants.COLLAPSED,
                    row: row,
                    parentRow: null,
                    aggregations: newAggregations,
                    children: []
                };
                row.treeNode && (newNode.state = row.treeNode.state), 0 < parents.length && (newNode.parentRow = parents[parents.length - 1]), 
                row.treeNode = newNode, 0 === parents.length ? grid.treeBase.tree.push(newNode) : parents[parents.length - 1].treeNode.children.push(newNode);
            },
            setCurrentState: function(parents) {
                var currentState = uiGridTreeBaseConstants.EXPANDED;
                return parents.forEach(function(parent) {
                    parent.treeNode.state === uiGridTreeBaseConstants.COLLAPSED && (currentState = uiGridTreeBaseConstants.COLLAPSED);
                }), currentState;
            },
            sortTree: function(grid) {
                grid.columns.forEach(function(column) {
                    column.sort && column.sort.ignoreSort && delete column.sort.ignoreSort;
                }), grid.treeBase.tree = service.sortInternal(grid, grid.treeBase.tree);
            },
            sortInternal: function(grid, treeList) {
                var rows = treeList.map(function(node) {
                    return node.row;
                }), treeNodes = (rows = rowSorter.sort(grid, rows, grid.columns)).map(function(row) {
                    return row.treeNode;
                });
                return treeNodes.forEach(function(node) {
                    node.state === uiGridTreeBaseConstants.EXPANDED && node.children && 0 < node.children.length && (node.children = service.sortInternal(grid, node.children));
                }), treeNodes;
            },
            fixFilter: function(grid) {
                var parentsVisible;
                grid.treeBase.tree.forEach(function(node) {
                    node.children && 0 < node.children.length && (parentsVisible = node.row.visible, 
                    service.fixFilterInternal(node.children, parentsVisible));
                });
            },
            fixFilterInternal: function(nodes, parentsVisible) {
                return nodes.forEach(function(node) {
                    node.row.visible && !parentsVisible && (service.setParentsVisible(node), parentsVisible = !0), 
                    node.children && 0 < node.children.length && service.fixFilterInternal(node.children, parentsVisible && node.row.visible) && (parentsVisible = !0);
                }), parentsVisible;
            },
            setParentsVisible: function(node) {
                for (;node.parentRow; ) node.parentRow.visible = !0, node = node.parentRow.treeNode;
            },
            buildAggregationObject: function(column) {
                var newAggregation = {
                    col: column
                };
                return column.treeAggregation && column.treeAggregation.type && (newAggregation.type = column.treeAggregation.type), 
                column.treeAggregation && column.treeAggregation.label && (newAggregation.label = column.treeAggregation.label), 
                newAggregation;
            },
            getAggregations: function(grid) {
                var aggregateArray = [];
                return grid.columns.forEach(function(column) {
                    void 0 !== column.treeAggregationFn && (aggregateArray.push(service.buildAggregationObject(column)), 
                    grid.options.showColumnFooter && void 0 === column.colDef.aggregationType && column.treeAggregation && (column.treeFooterAggregation = service.buildAggregationObject(column), 
                    column.aggregationType = service.treeFooterAggregationType));
                }), aggregateArray;
            },
            aggregate: function(grid, row, parents) {
                0 === parents.length && row.treeNode && row.treeNode.aggregations && row.treeNode.aggregations.forEach(function(aggregation) {
                    if (void 0 !== aggregation.col.treeFooterAggregation) {
                        var fieldValue = grid.getCellValue(row, aggregation.col), numValue = Number(fieldValue);
                        aggregation.col.treeAggregationFn(aggregation.col.treeFooterAggregation, fieldValue, numValue, row);
                    }
                }), parents.forEach(function(parent, index) {
                    parent.treeNode.aggregations && parent.treeNode.aggregations.forEach(function(aggregation) {
                        var fieldValue = grid.getCellValue(row, aggregation.col), numValue = Number(fieldValue);
                        aggregation.col.treeAggregationFn(aggregation, fieldValue, numValue, row), 0 === index && void 0 !== aggregation.col.treeFooterAggregation && aggregation.col.treeAggregationFn(aggregation.col.treeFooterAggregation, fieldValue, numValue, row);
                    });
                });
            },
            nativeAggregations: function() {
                return {
                    count: {
                        label: i18nService.get().aggregation.count,
                        menuTitle: i18nService.get().grouping.aggregate_count,
                        aggregationFn: function(aggregation, fieldValue, numValue) {
                            void 0 === aggregation.value ? aggregation.value = 1 : aggregation.value++;
                        }
                    },
                    sum: {
                        label: i18nService.get().aggregation.sum,
                        menuTitle: i18nService.get().grouping.aggregate_sum,
                        aggregationFn: function(aggregation, fieldValue, numValue) {
                            isNaN(numValue) || (void 0 === aggregation.value ? aggregation.value = numValue : aggregation.value += numValue);
                        }
                    },
                    min: {
                        label: i18nService.get().aggregation.min,
                        menuTitle: i18nService.get().grouping.aggregate_min,
                        aggregationFn: function(aggregation, fieldValue, numValue) {
                            void 0 === aggregation.value ? aggregation.value = fieldValue : null != fieldValue && (fieldValue < aggregation.value || null === aggregation.value) && (aggregation.value = fieldValue);
                        }
                    },
                    max: {
                        label: i18nService.get().aggregation.max,
                        menuTitle: i18nService.get().grouping.aggregate_max,
                        aggregationFn: function(aggregation, fieldValue, numValue) {
                            void 0 === aggregation.value ? aggregation.value = fieldValue : null != fieldValue && (fieldValue > aggregation.value || null === aggregation.value) && (aggregation.value = fieldValue);
                        }
                    },
                    avg: {
                        label: i18nService.get().aggregation.avg,
                        menuTitle: i18nService.get().grouping.aggregate_avg,
                        aggregationFn: function(aggregation, fieldValue, numValue) {
                            void 0 === aggregation.count ? aggregation.count = 1 : aggregation.count++, isNaN(numValue) || (void 0 === aggregation.value || void 0 === aggregation.sum ? (aggregation.value = numValue, 
                            aggregation.sum = numValue) : (aggregation.sum += numValue, aggregation.value = aggregation.sum / aggregation.count));
                        }
                    }
                };
            },
            finaliseAggregation: function(row, aggregation) {
                aggregation.col.treeAggregationUpdateEntity && void 0 !== row && void 0 !== row.entity["$$" + aggregation.col.uid] && angular.extend(aggregation, row.entity["$$" + aggregation.col.uid]), 
                "function" == typeof aggregation.col.treeAggregationFinalizerFn && aggregation.col.treeAggregationFinalizerFn(aggregation), 
                "function" == typeof aggregation.col.customTreeAggregationFinalizerFn && aggregation.col.customTreeAggregationFinalizerFn(aggregation), 
                void 0 === aggregation.rendered && (aggregation.rendered = aggregation.label ? aggregation.label + aggregation.value : aggregation.value);
            },
            finaliseAggregations: function(row) {
                null != row && void 0 !== row.treeNode.aggregations && row.treeNode.aggregations.forEach(function(aggregation) {
                    if (service.finaliseAggregation(row, aggregation), aggregation.col.treeAggregationUpdateEntity) {
                        var aggregationCopy = {};
                        angular.forEach(aggregation, function(value, key) {
                            aggregation.hasOwnProperty(key) && "col" !== key && (aggregationCopy[key] = value);
                        }), row.entity["$$" + aggregation.col.uid] = aggregationCopy;
                    }
                });
            },
            treeFooterAggregationType: function(rows, column) {
                return service.finaliseAggregation(void 0, column.treeFooterAggregation), void 0 === column.treeFooterAggregation.value || null === column.treeFooterAggregation.rendered ? "" : column.treeFooterAggregation.rendered;
            }
        };
        return service;
    } ]), module.directive("uiGridTreeBaseRowHeaderButtons", [ "$templateCache", "uiGridTreeBaseService", function($templateCache, uiGridTreeBaseService) {
        return {
            replace: !0,
            restrict: "E",
            template: $templateCache.get("ui-grid/treeBaseRowHeaderButtons"),
            scope: !0,
            require: "^uiGrid",
            link: function($scope, $elm, $attrs, uiGridCtrl) {
                var self = uiGridCtrl.grid;
                $scope.treeButtonClass = function(row) {
                    if (self.options.showTreeExpandNoChildren && -1 < row.treeLevel || row.treeNode.children && 0 < row.treeNode.children.length) {
                        if ("expanded" === row.treeNode.state) return "ui-grid-icon-minus-squared";
                        if ("collapsed" === row.treeNode.state) return "ui-grid-icon-plus-squared";
                    }
                }, $scope.treeButtonClick = function(row, evt) {
                    evt.stopPropagation(), uiGridTreeBaseService.toggleRowTreeState(self, row, evt);
                };
            }
        };
    } ]), module.directive("uiGridTreeBaseExpandAllButtons", [ "$templateCache", "uiGridTreeBaseService", function($templateCache, uiGridTreeBaseService) {
        return {
            replace: !0,
            restrict: "E",
            template: $templateCache.get("ui-grid/treeBaseExpandAllButtons"),
            scope: !1,
            link: function($scope, $elm, $attrs, uiGridCtrl) {
                var self = $scope.col.grid;
                $scope.headerButtonClass = function() {
                    return 0 < self.treeBase.numberLevels && self.treeBase.expandAll ? "ui-grid-icon-minus-squared" : 0 < self.treeBase.numberLevels && !self.treeBase.expandAll ? "ui-grid-icon-plus-squared" : void 0;
                }, $scope.headerButtonClick = function(row, evt) {
                    self.treeBase.expandAll ? uiGridTreeBaseService.collapseAllRows(self, evt) : uiGridTreeBaseService.expandAllRows(self, evt);
                };
            }
        };
    } ]), module.directive("uiGridViewport", [ "$compile", "uiGridConstants", "gridUtil", "$parse", function($compile, uiGridConstants, gridUtil, $parse) {
        return {
            priority: -200,
            scope: !1,
            compile: function($elm, $attrs) {
                var rowRepeatDiv = angular.element($elm.children().children()[0]), existingNgClass = rowRepeatDiv.attr("ng-class"), newNgClass = "";
                return newNgClass = existingNgClass ? existingNgClass.slice(0, -1) + ",'ui-grid-tree-header-row': row.treeLevel > -1}" : "{'ui-grid-tree-header-row': row.treeLevel > -1}", 
                rowRepeatDiv.attr("ng-class", newNgClass), {
                    pre: function($scope, $elm, $attrs, controllers) {},
                    post: function($scope, $elm, $attrs, controllers) {}
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.treeView", [ "ui.grid", "ui.grid.treeBase" ]);
    module.constant("uiGridTreeViewConstants", {
        featureName: "treeView",
        rowHeaderColName: "treeBaseRowHeaderCol",
        EXPANDED: "expanded",
        COLLAPSED: "collapsed",
        aggregation: {
            COUNT: "count",
            SUM: "sum",
            MAX: "max",
            MIN: "min",
            AVG: "avg"
        }
    }), module.service("uiGridTreeViewService", [ "$q", "uiGridTreeViewConstants", "uiGridTreeBaseConstants", "uiGridTreeBaseService", "gridUtil", "GridRow", "gridClassFactory", "i18nService", "uiGridConstants", function($q, uiGridTreeViewConstants, uiGridTreeBaseConstants, uiGridTreeBaseService, gridUtil, GridRow, gridClassFactory, i18nService, uiGridConstants) {
        var service = {
            initializeGrid: function(grid, $scope) {
                uiGridTreeBaseService.initializeGrid(grid, $scope), grid.treeView = {}, grid.registerRowsProcessor(service.adjustSorting, 60);
                var publicApi_events = {
                    treeView: {}
                }, publicApi_methods = {
                    treeView: {}
                };
                grid.api.registerEventsFromObject(publicApi_events), grid.api.registerMethodsFromObject(publicApi_methods);
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.enableTreeView = !1 !== gridOptions.enableTreeView;
            },
            adjustSorting: function(renderableRows) {
                return this.columns.forEach(function(column) {
                    column.sort && (column.sort.ignoreSort = !0);
                }), renderableRows;
            }
        };
        return service;
    } ]), module.directive("uiGridTreeView", [ "uiGridTreeViewConstants", "uiGridTreeViewService", "$templateCache", function(uiGridTreeViewConstants, uiGridTreeViewService, $templateCache) {
        return {
            replace: !0,
            priority: 0,
            require: "^uiGrid",
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        !1 !== uiGridCtrl.grid.options.enableTreeView && uiGridTreeViewService.initializeGrid(uiGridCtrl.grid, $scope);
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {}
                };
            }
        };
    } ]);
}(), function() {
    "use strict";
    var module = angular.module("ui.grid.validate", [ "ui.grid" ]);
    module.service("uiGridValidateService", [ "$sce", "$q", "$http", "i18nService", "uiGridConstants", function($sce, $q, $http, i18nService, uiGridConstants) {
        var service = {
            validatorFactories: {},
            setExternalFactoryFunction: function(externalFactoryFunction) {
                service.externalFactoryFunction = externalFactoryFunction;
            },
            clearExternalFactory: function() {
                delete service.externalFactoryFunction;
            },
            getValidatorFromExternalFactory: function(name, argument) {
                return service.externalFactoryFunction(name, argument).validatorFactory(argument);
            },
            getMessageFromExternalFactory: function(name, argument) {
                return service.externalFactoryFunction(name, argument).messageFunction(argument);
            },
            setValidator: function(name, validatorFactory, messageFunction) {
                service.validatorFactories[name] = {
                    validatorFactory: validatorFactory,
                    messageFunction: messageFunction
                };
            },
            getValidator: function(name, argument) {
                if (service.externalFactoryFunction) {
                    var validator = service.getValidatorFromExternalFactory(name, argument);
                    if (validator) return validator;
                }
                if (!service.validatorFactories[name]) throw "Invalid validator name: " + name;
                return service.validatorFactories[name].validatorFactory(argument);
            },
            getMessage: function(name, argument) {
                if (service.externalFactoryFunction) {
                    var message = service.getMessageFromExternalFactory(name, argument);
                    if (message) return message;
                }
                return service.validatorFactories[name].messageFunction(argument);
            },
            isInvalid: function(rowEntity, colDef) {
                return rowEntity["$$invalid" + colDef.name];
            },
            setInvalid: function(rowEntity, colDef) {
                rowEntity["$$invalid" + colDef.name] = !0;
            },
            setValid: function(rowEntity, colDef) {
                delete rowEntity["$$invalid" + colDef.name];
            },
            setError: function(rowEntity, colDef, validatorName) {
                rowEntity["$$errors" + colDef.name] || (rowEntity["$$errors" + colDef.name] = {}), 
                rowEntity["$$errors" + colDef.name][validatorName] = !0;
            },
            clearError: function(rowEntity, colDef, validatorName) {
                rowEntity["$$errors" + colDef.name] && validatorName in rowEntity["$$errors" + colDef.name] && delete rowEntity["$$errors" + colDef.name][validatorName];
            },
            getErrorMessages: function(rowEntity, colDef) {
                var errors = [];
                return rowEntity["$$errors" + colDef.name] && 0 !== Object.keys(rowEntity["$$errors" + colDef.name]).length && Object.keys(rowEntity["$$errors" + colDef.name]).sort().forEach(function(validatorName) {
                    errors.push(service.getMessage(validatorName, colDef.validators[validatorName]));
                }), errors;
            },
            getFormattedErrors: function(rowEntity, colDef) {
                var msgString = "", errors = service.getErrorMessages(rowEntity, colDef);
                if (errors.length) return errors.forEach(function(errorMsg) {
                    msgString += errorMsg + "<br/>";
                }), $sce.trustAsHtml("<p><b>" + i18nService.getSafeText("validate.error") + "</b></p>" + msgString);
            },
            getTitleFormattedErrors: function(rowEntity, colDef) {
                var msgString = "", errors = service.getErrorMessages(rowEntity, colDef);
                if (errors.length) return errors.forEach(function(errorMsg) {
                    msgString += errorMsg + "\n";
                }), $sce.trustAsHtml(i18nService.getSafeText("validate.error") + "\n" + msgString);
            },
            runValidators: function(rowEntity, colDef, newValue, oldValue, grid) {
                if (newValue !== oldValue) {
                    if (void 0 === colDef.name || !colDef.name) throw new Error("colDef.name is required to perform validation");
                    service.setValid(rowEntity, colDef);
                    var validateClosureFactory = function(rowEntity, colDef, validatorName) {
                        return function(value) {
                            value || (service.setInvalid(rowEntity, colDef), service.setError(rowEntity, colDef, validatorName), 
                            grid && grid.api.validate.raise.validationFailed(rowEntity, colDef, newValue, oldValue));
                        };
                    }, promises = [];
                    for (var validatorName in colDef.validators) {
                        service.clearError(rowEntity, colDef, validatorName);
                        var validatorFunction = service.getValidator(validatorName, colDef.validators[validatorName]), promise = $q.when(validatorFunction(oldValue, newValue, rowEntity, colDef)).then(validateClosureFactory(rowEntity, colDef, validatorName));
                        promises.push(promise);
                    }
                    return $q.all(promises);
                }
            },
            createDefaultValidators: function() {
                service.setValidator("minLength", function(argument) {
                    return function(oldValue, newValue, rowEntity, colDef) {
                        return null == newValue || "" === newValue || newValue.length >= argument;
                    };
                }, function(argument) {
                    return i18nService.getSafeText("validate.minLength").replace("THRESHOLD", argument);
                }), service.setValidator("maxLength", function(argument) {
                    return function(oldValue, newValue, rowEntity, colDef) {
                        return null == newValue || "" === newValue || newValue.length <= argument;
                    };
                }, function(threshold) {
                    return i18nService.getSafeText("validate.maxLength").replace("THRESHOLD", threshold);
                }), service.setValidator("required", function(argument) {
                    return function(oldValue, newValue, rowEntity, colDef) {
                        return !argument || !(null == newValue || "" === newValue);
                    };
                }, function(argument) {
                    return i18nService.getSafeText("validate.required");
                });
            },
            initializeGrid: function(scope, grid) {
                grid.validate = {
                    isInvalid: service.isInvalid,
                    getFormattedErrors: service.getFormattedErrors,
                    getTitleFormattedErrors: service.getTitleFormattedErrors,
                    runValidators: service.runValidators
                };
                var publicApi = {
                    events: {
                        validate: {
                            validationFailed: function(rowEntity, colDef, newValue, oldValue) {}
                        }
                    },
                    methods: {
                        validate: {
                            isInvalid: function(rowEntity, colDef) {
                                return grid.validate.isInvalid(rowEntity, colDef);
                            },
                            getErrorMessages: function(rowEntity, colDef) {
                                return grid.validate.getErrorMessages(rowEntity, colDef);
                            },
                            getFormattedErrors: function(rowEntity, colDef) {
                                return grid.validate.getFormattedErrors(rowEntity, colDef);
                            },
                            getTitleFormattedErrors: function(rowEntity, colDef) {
                                return grid.validate.getTitleFormattedErrors(rowEntity, colDef);
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods), 
                grid.edit && grid.api.edit.on.afterCellEdit(scope, function(rowEntity, colDef, newValue, oldValue) {
                    grid.validate.runValidators(rowEntity, colDef, newValue, oldValue, grid);
                }), service.createDefaultValidators();
            }
        };
        return service;
    } ]), module.directive("uiGridValidate", [ "gridUtil", "uiGridValidateService", function(gridUtil, uiGridValidateService) {
        return {
            priority: 0,
            replace: !0,
            require: "^uiGrid",
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        uiGridValidateService.initializeGrid($scope, uiGridCtrl.grid);
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {}
                };
            }
        };
    } ]);
}(), angular.module("ui.grid").run([ "$templateCache", function($templateCache) {
    "use strict";
    $templateCache.put("ui-grid/ui-grid-filter", '<div class="ui-grid-filter-container" ng-style="col.extraStyle" ng-repeat="colFilter in col.filters" ng-class="{\'ui-grid-filter-cancel-button-hidden\' : colFilter.disableCancelFilterButton === true }"><div ng-if="colFilter.type !== \'select\'"><input type="text" class="ui-grid-filter-input ui-grid-filter-input-{{$index}}" ng-model="colFilter.term" ng-attr-placeholder="{{colFilter.placeholder || \'\'}}" aria-label="{{colFilter.ariaLabel || aria.defaultFilterLabel}}"><div role="button" class="ui-grid-filter-button" ng-click="removeFilter(colFilter, $index)" ng-if="!colFilter.disableCancelFilterButton" ng-disabled="colFilter.term === undefined || colFilter.term === null || colFilter.term === \'\'" ng-show="colFilter.term !== undefined && colFilter.term !== null && colFilter.term !== \'\'"><i class="ui-grid-icon-cancel" ui-grid-one-bind-aria-label="aria.removeFilter">&nbsp;</i></div></div><div ng-if="colFilter.type === \'select\'"><select class="ui-grid-filter-select ui-grid-filter-input-{{$index}}" ng-model="colFilter.term" ng-show="colFilter.selectOptions.length > 0" ng-attr-placeholder="{{colFilter.placeholder || aria.defaultFilterLabel}}" aria-label="{{colFilter.ariaLabel || \'\'}}" ng-options="option.value as option.label for option in colFilter.selectOptions"><option value=""></option></select><div role="button" class="ui-grid-filter-button-select" ng-click="removeFilter(colFilter, $index)" ng-if="!colFilter.disableCancelFilterButton" ng-disabled="colFilter.term === undefined || colFilter.term === null || colFilter.term === \'\'" ng-show="colFilter.term !== undefined && colFilter.term != null"><i class="ui-grid-icon-cancel" ui-grid-one-bind-aria-label="aria.removeFilter">&nbsp;</i></div></div></div>'), 
    $templateCache.put("ui-grid/ui-grid-footer", '<div class="ui-grid-footer-panel ui-grid-footer-aggregates-row">\x3c!-- tfooter --\x3e<div class="ui-grid-footer ui-grid-footer-viewport"><div class="ui-grid-footer-canvas"><div class="ui-grid-footer-cell-wrapper" ng-style="colContainer.headerCellWrapperStyle()"><div role="row" class="ui-grid-footer-cell-row"><div ui-grid-footer-cell role="gridcell" ng-repeat="col in colContainer.renderedColumns track by col.uid" col="col" render-index="$index" class="ui-grid-footer-cell ui-grid-clearfix"></div></div></div></div></div></div>'), 
    $templateCache.put("ui-grid/ui-grid-grid-footer", '<div class="ui-grid-footer-info ui-grid-grid-footer"><span>{{\'search.totalItems\' | t}} {{grid.rows.length}}</span> <span ng-if="grid.renderContainers.body.visibleRowCache.length !== grid.rows.length" class="ngLabel">({{"search.showingItems" | t}} {{grid.renderContainers.body.visibleRowCache.length}})</span></div>'), 
    $templateCache.put("ui-grid/ui-grid-header", '<div role="rowgroup" class="ui-grid-header">\x3c!-- theader --\x3e<div class="ui-grid-top-panel"><div class="ui-grid-header-viewport"><div class="ui-grid-header-canvas"><div class="ui-grid-header-cell-wrapper" ng-style="colContainer.headerCellWrapperStyle()"><div role="row" class="ui-grid-header-cell-row"><div class="ui-grid-header-cell ui-grid-clearfix" ng-repeat="col in colContainer.renderedColumns track by col.uid" ui-grid-header-cell col="col" render-index="$index"></div></div></div></div></div></div></div>'), 
    $templateCache.put("ui-grid/ui-grid-menu-button", '<div class="ui-grid-menu-button"><div role="button" ui-grid-one-bind-id-grid="\'grid-menu\'" class="ui-grid-icon-container" ng-click="toggleMenu()" aria-haspopup="true"><i class="ui-grid-icon-menu" ui-grid-one-bind-aria-label="i18n.aria.buttonLabel">&nbsp;</i></div><div ui-grid-menu menu-items="menuItems"></div></div>'), 
    $templateCache.put("ui-grid/ui-grid-menu-header-item", '<li role="menuitem"><div class="ui-grid-menu-item" role="heading" aria-level="2" ng-show="itemShown()"><i aria-hidden="true">&nbsp; </i><span ng-bind="label()"></span></div></li>'), 
    $templateCache.put("ui-grid/ui-grid-no-header", '<div class="ui-grid-top-panel"></div>'), 
    $templateCache.put("ui-grid/ui-grid-row", "<div ng-repeat=\"(colRenderIndex, col) in colContainer.renderedColumns track by col.uid\" ui-grid-one-bind-id-grid=\"rowRenderIndex + '-' + col.uid + '-cell'\" class=\"ui-grid-cell\" ng-class=\"{ 'ui-grid-row-header-cell': col.isRowHeader }\" role=\"{{col.isRowHeader ? 'rowheader' : 'gridcell'}}\" ui-grid-cell></div>"), 
    $templateCache.put("ui-grid/ui-grid", '<div ui-i18n="en" class="ui-grid">\x3c!-- TODO (c0bra): add "scoped" attr here, eventually? --\x3e<style ui-grid-style>.grid{{ grid.id }} {\n      /* Styles for the grid */\n    }\n\n    .grid{{ grid.id }} .ui-grid-row, .grid{{ grid.id }} .ui-grid-cell, .grid{{ grid.id }} .ui-grid-cell .ui-grid-vertical-bar {\n      height: {{ grid.options.rowHeight }}px;\n    }\n\n    .grid{{ grid.id }} .ui-grid-row:last-child .ui-grid-cell {\n      border-bottom-width: {{ (((grid.getVisibleRowCount() * grid.options.rowHeight) < grid.getViewportHeight()) && \'1\') || \'0\' }}px;\n    }\n\n    {{ grid.verticalScrollbarStyles }}\n    {{ grid.horizontalScrollbarStyles }}\n\n    /*\n    .ui-grid[dir=rtl] .ui-grid-viewport {\n      padding-left: {{ grid.verticalScrollbarWidth }}px;\n    }\n    */\n\n    {{ grid.customStyles }}</style><div class="ui-grid-contents-wrapper" role="grid"><div ui-grid-menu-button ng-if="grid.options.enableGridMenu"></div><div ng-if="grid.hasLeftContainer()" style="width: 0" ui-grid-pinned-container="\'left\'"></div><div ui-grid-render-container container-id="\'body\'" col-container-name="\'body\'" row-container-name="\'body\'" bind-scroll-horizontal="true" bind-scroll-vertical="true" enable-horizontal-scrollbar="grid.options.enableHorizontalScrollbar" enable-vertical-scrollbar="grid.options.enableVerticalScrollbar"></div><div ng-if="grid.hasRightContainer()" style="width: 0" ui-grid-pinned-container="\'right\'"></div><div ui-grid-grid-footer ng-if="grid.options.showGridFooter"></div><div ui-grid-column-menu ng-if="grid.options.enableColumnMenus"></div><div ng-transclude></div></div></div>'), 
    $templateCache.put("ui-grid/uiGridCell", '<div class="ui-grid-cell-contents" title="TOOLTIP">{{COL_FIELD CUSTOM_FILTERS}}</div>'), 
    $templateCache.put("ui-grid/uiGridColumnMenu", '<div class="ui-grid-column-menu"><div ui-grid-menu menu-items="menuItems">\x3c!-- <div class="ui-grid-column-menu">\n    <div class="inner" ng-show="menuShown">\n      <ul>\n        <div ng-show="grid.options.enableSorting">\n          <li ng-click="sortColumn($event, asc)" ng-class="{ \'selected\' : col.sort.direction == asc }"><i class="ui-grid-icon-sort-alt-up"></i> Sort Ascending</li>\n          <li ng-click="sortColumn($event, desc)" ng-class="{ \'selected\' : col.sort.direction == desc }"><i class="ui-grid-icon-sort-alt-down"></i> Sort Descending</li>\n          <li ng-show="col.sort.direction" ng-click="unsortColumn()"><i class="ui-grid-icon-cancel"></i> Remove Sort</li>\n        </div>\n      </ul>\n    </div>\n  </div> --\x3e</div></div>'), 
    $templateCache.put("ui-grid/uiGridFooterCell", '<div class="ui-grid-cell-contents" col-index="renderIndex"><div>{{ col.getAggregationText() + ( col.getAggregationValue() CUSTOM_FILTERS ) }}</div></div>'), 
    $templateCache.put("ui-grid/uiGridHeaderCell", '<div role="columnheader" ng-class="{ \'sortable\': sortable, \'ui-grid-header-cell-last-col\': isLastCol }" ui-grid-one-bind-aria-labelledby-grid="col.uid + \'-header-text \' + col.uid + \'-sortdir-text\'" aria-sort="{{col.sort.direction == asc ? \'ascending\' : ( col.sort.direction == desc ? \'descending\' : (!col.sort.direction ? \'none\' : \'other\'))}}"><div role="button" tabindex="0" ng-keydown="handleKeyDown($event)" class="ui-grid-cell-contents ui-grid-header-cell-primary-focus" col-index="renderIndex" title="TOOLTIP"><span class="ui-grid-header-cell-label" ui-grid-one-bind-id-grid="col.uid + \'-header-text\'">{{ col.displayName CUSTOM_FILTERS }} </span><span ui-grid-one-bind-id-grid="col.uid + \'-sortdir-text\'" ui-grid-visible="col.sort.direction" aria-label="{{getSortDirectionAriaLabel()}}"><i ng-class="{ \'ui-grid-icon-up-dir\': col.sort.direction == asc, \'ui-grid-icon-down-dir\': col.sort.direction == desc, \'ui-grid-icon-blank\': !col.sort.direction }" title="{{isSortPriorityVisible() ? i18n.headerCell.priority + \' \' + ( col.sort.priority + 1 )  : null}}" aria-hidden="true"></i> <sub ui-grid-visible="isSortPriorityVisible()" class="ui-grid-sort-priority-number">{{col.sort.priority + 1}}</sub></span></div><div role="button" tabindex="0" ui-grid-one-bind-id-grid="col.uid + \'-menu-button\'" class="ui-grid-column-menu-button" ng-if="grid.options.enableColumnMenus && !col.isRowHeader  && col.colDef.enableColumnMenu !== false" ng-click="toggleMenu($event)" ng-keydown="headerCellArrowKeyDown($event)" ui-grid-one-bind-aria-label="i18n.headerCell.aria.columnMenuButtonLabel" aria-haspopup="true"><i class="ui-grid-icon-angle-down" aria-hidden="true">&nbsp;</i></div><div ui-grid-filter></div></div>'), 
    $templateCache.put("ui-grid/uiGridMenu", '<div class="ui-grid-menu" ng-show="shown"><style ui-grid-style>{{dynamicStyles}}</style><div class="ui-grid-menu-mid" ng-show="shownMid"><div class="ui-grid-menu-inner" ng-if="shown"><ul role="menu" class="ui-grid-menu-items"><li ng-repeat="item in menuItems" role="menuitem" ui-grid-menu-item ui-grid-one-bind-id="\'menuitem-\'+$index" action="item.action" name="item.title" active="item.active" icon="item.icon" shown="item.shown" context="item.context" template-url="item.templateUrl" leave-open="item.leaveOpen" screen-reader-only="item.screenReaderOnly"></li></ul></div></div></div>'), 
    $templateCache.put("ui-grid/uiGridMenuItem", '<button type="button" class="ui-grid-menu-item" ng-click="itemAction($event, title)" ng-show="itemShown()" ng-class="{ \'ui-grid-menu-item-active\': active(), \'ui-grid-sr-only\': (!focus && screenReaderOnly) }" aria-pressed="{{active()}}" tabindex="0" ng-focus="focus=true" ng-blur="focus=false"><i ng-class="icon" aria-hidden="true">&nbsp; </i>{{ label() }}</button>'), 
    $templateCache.put("ui-grid/uiGridRenderContainer", "<div role=\"presentation\" ui-grid-one-bind-id-grid=\"containerId + '-grid-container'\" class=\"ui-grid-render-container\" ng-style=\"{ 'margin-left': colContainer.getMargin('left') + 'px', 'margin-right': colContainer.getMargin('right') + 'px' }\">\x3c!-- All of these dom elements are replaced in place --\x3e<div ui-grid-header></div><div ui-grid-viewport></div><div ng-if=\"colContainer.needsHScrollbarPlaceholder()\" class=\"ui-grid-scrollbar-placeholder\" ng-style=\"{height:colContainer.grid.scrollbarHeight + 'px'}\"></div><ui-grid-footer ng-if=\"grid.options.showColumnFooter\"></ui-grid-footer></div>"), 
    $templateCache.put("ui-grid/uiGridViewport", '<div role="rowgroup" class="ui-grid-viewport" ng-style="colContainer.getViewportStyle()">\x3c!-- tbody --\x3e<div class="ui-grid-canvas"><div ng-repeat="(rowRenderIndex, row) in rowContainer.renderedRows track by $index" class="ui-grid-row" ng-style="Viewport.rowStyle(rowRenderIndex)"><div role="row" ui-grid-row="row" row-render-index="rowRenderIndex"></div></div></div></div>'), 
    $templateCache.put("ui-grid/cellEditor", '<div><form name="inputForm"><input type="INPUT_TYPE" ng-class="\'colt\' + col.uid" ui-grid-editor ng-model="MODEL_COL_FIELD"></form></div>'), 
    $templateCache.put("ui-grid/dropdownEditor", '<div><form name="inputForm"><select ng-class="\'colt\' + col.uid" ui-grid-edit-dropdown ng-model="MODEL_COL_FIELD" ng-options="field[editDropdownIdLabel] as field[editDropdownValueLabel] CUSTOM_FILTERS for field in editDropdownOptionsArray"></select></form></div>'), 
    $templateCache.put("ui-grid/fileChooserEditor", '<div><form name="inputForm"><input ng-class="\'colt\' + col.uid" ui-grid-edit-file-chooser type="file" id="files" name="files[]" ng-model="MODEL_COL_FIELD"></form></div>'), 
    $templateCache.put("ui-grid/emptyBaseLayerContainer", '<div class="ui-grid-empty-base-layer-container ui-grid-canvas"><div class="ui-grid-row" ng-repeat="(rowRenderIndex, row) in grid.baseLayer.emptyRows track by $index" ng-style="Viewport.rowStyle(rowRenderIndex)"><div><div><div ng-repeat="(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name" class="ui-grid-cell {{ col.getColClass(false) }}"></div></div></div></div></div>'), 
    $templateCache.put("ui-grid/expandableRow", '<div ui-grid-expandable-row ng-if="expandableRow.shouldRenderExpand()" class="expandableRow" style="float:left; margin-top: 1px; margin-bottom: 1px" ng-style="{width: (grid.renderContainers.body.getCanvasWidth()) + \'px\', height: row.expandedRowHeight + \'px\'}"></div>'), 
    $templateCache.put("ui-grid/expandableRowHeader", '<div class="ui-grid-row-header-cell ui-grid-expandable-buttons-cell"><div class="ui-grid-cell-contents"><i ng-if="!(row.groupHeader==true || row.entity.subGridOptions.disableRowExpandable)" ng-class="{ \'ui-grid-icon-plus-squared\' : !row.isExpanded, \'ui-grid-icon-minus-squared\' : row.isExpanded }" ng-click="grid.api.expandable.toggleRowExpansion(row.entity)"></i></div></div>'), 
    $templateCache.put("ui-grid/expandableScrollFiller", "<div ng-if=\"expandableRow.shouldRenderFiller()\" ng-class=\"{scrollFiller:true, scrollFillerClass:(colContainer.name === 'body')}\" ng-style=\"{ width: (grid.getViewportWidth()) + 'px', height: row.expandedRowHeight + 2 + 'px', 'margin-left': grid.options.rowHeader.rowHeaderWidth + 'px' }\"><i class=\"ui-grid-icon-spin5 ui-grid-animate-spin\" ng-style=\"{'margin-top': ( row.expandedRowHeight/2 - 5) + 'px', 'margin-left' : ((grid.getViewportWidth() - grid.options.rowHeader.rowHeaderWidth)/2 - 5) + 'px'}\"></i></div>"), 
    $templateCache.put("ui-grid/expandableTopRowHeader", '<div class="ui-grid-row-header-cell ui-grid-expandable-buttons-cell"><div class="ui-grid-cell-contents"><span class="ui-grid-cell-empty" ng-if="!grid.options.showExpandAllButton"></span> <button type="button" class="ui-grid-icon-button" ng-if="grid.options.showExpandAllButton" ng-class="{ \'ui-grid-icon-plus-squared\' : !grid.expandable.expandedAll, \'ui-grid-icon-minus-squared\' : grid.expandable.expandedAll }" ng-click="grid.api.expandable.toggleAllRows()"></button></div></div>'), 
    $templateCache.put("ui-grid/csvLink", '<span class="ui-grid-exporter-csv-link-span"><a href="data:text/csv;charset=UTF-8,CSV_CONTENT" download="FILE_NAME">LINK_LABEL</a></span>'), 
    $templateCache.put("ui-grid/importerMenuItem", '<li class="ui-grid-menu-item"><form><input class="ui-grid-importer-file-chooser" type="file" id="files" name="files[]"></form></li>'), 
    $templateCache.put("ui-grid/importerMenuItemContainer", "<div ui-grid-importer-menu-item></div>"), 
    $templateCache.put("ui-grid/pagination", '<div class="ui-grid-pager-panel" ui-grid-pager ng-show="grid.options.enablePaginationControls"><div role="navigation" class="ui-grid-pager-container"><div class="ui-grid-pager-control"><button type="button" class="ui-grid-pager-first" ui-grid-one-bind-title="aria.pageToFirst" ui-grid-one-bind-aria-label="aria.pageToFirst" ng-click="pageFirstPageClick()" ng-disabled="cantPageBackward()"><div ng-class="grid.isRTL() ? \'last-triangle\' : \'first-triangle\'"><div ng-class="grid.isRTL() ? \'last-bar-rtl\' : \'first-bar\'"></div></div></button> <button type="button" class="ui-grid-pager-previous" ui-grid-one-bind-title="aria.pageBack" ui-grid-one-bind-aria-label="aria.pageBack" ng-click="pagePreviousPageClick()" ng-disabled="cantPageBackward()"><div ng-class="grid.isRTL() ? \'last-triangle prev-triangle\' : \'first-triangle prev-triangle\'"></div></button> <input type="number" ui-grid-one-bind-title="aria.pageSelected" ui-grid-one-bind-aria-label="aria.pageSelected" class="ui-grid-pager-control-input" ng-model="grid.options.paginationCurrentPage" min="1" max="{{ paginationApi.getTotalPages() }}" step="1" required> <span class="ui-grid-pager-max-pages-number" ng-show="paginationApi.getTotalPages() > 0"><abbr ui-grid-one-bind-title="paginationOf">/ </abbr>{{ paginationApi.getTotalPages() }} </span><button type="button" class="ui-grid-pager-next" ui-grid-one-bind-title="aria.pageForward" ui-grid-one-bind-aria-label="aria.pageForward" ng-click="pageNextPageClick()" ng-disabled="cantPageForward()"><div ng-class="grid.isRTL() ? \'first-triangle next-triangle\' : \'last-triangle next-triangle\'"></div></button> <button type="button" class="ui-grid-pager-last" ui-grid-one-bind-title="aria.pageToLast" ui-grid-one-bind-aria-label="aria.pageToLast" ng-click="pageLastPageClick()" ng-disabled="cantPageToLast()"><div ng-class="grid.isRTL() ? \'first-triangle\' : \'last-triangle\'"><div ng-class="grid.isRTL() ? \'first-bar-rtl\' : \'last-bar\'"></div></div></button></div><div class="ui-grid-pager-row-count-picker" ng-if="grid.options.paginationPageSizes.length > 1 && !grid.options.useCustomPagination"><select ui-grid-one-bind-aria-labelledby-grid="\'items-per-page-label\'" ng-model="grid.options.paginationPageSize" ng-options="o as o for o in grid.options.paginationPageSizes"></select><span ui-grid-one-bind-id-grid="\'items-per-page-label\'" class="ui-grid-pager-row-count-label">&nbsp;{{sizesLabel}}</span></div><span ng-if="grid.options.paginationPageSizes.length <= 1" class="ui-grid-pager-row-count-label">{{grid.options.paginationPageSize}}&nbsp;{{sizesLabel}}</span></div><div class="ui-grid-pager-count-container"><div class="ui-grid-pager-count"><span ng-show="grid.options.totalItems > 0">{{ 1 + paginationApi.getFirstRowIndex() }} <abbr ui-grid-one-bind-title="paginationThrough">- </abbr>{{ 1 + paginationApi.getLastRowIndex() }} {{paginationOf}} {{grid.options.totalItems}} {{totalItemsLabel}}</span></div></div></div>'), 
    $templateCache.put("ui-grid/columnResizer", '<div ui-grid-column-resizer ng-if="grid.options.enableColumnResizing" class="ui-grid-column-resizer" col="col" position="right" render-index="renderIndex" unselectable="on"></div>'), 
    $templateCache.put("ui-grid/gridFooterSelectedItems", '<span ng-if="grid.selection.selectedCount !== 0 && grid.options.enableFooterTotalSelected">({{"search.selectedItems" | t}} {{grid.selection.selectedCount}})</span>'), 
    $templateCache.put("ui-grid/selectionHeaderCell", '<div>\x3c!-- <div class="ui-grid-vertical-bar">&nbsp;</div> --\x3e<div class="ui-grid-cell-contents" col-index="renderIndex"><ui-grid-selection-select-all-buttons ng-if="grid.options.enableSelectAll" role="checkbox" ng-model="grid.selection.selectAll"></ui-grid-selection-select-all-buttons></div></div>'), 
    $templateCache.put("ui-grid/selectionRowHeader", '<div class="ui-grid-cell-contents ui-grid-disable-selection"><ui-grid-selection-row-header-buttons></ui-grid-selection-row-header-buttons></div>'), 
    $templateCache.put("ui-grid/selectionRowHeaderButtons", '<div class="ui-grid-selection-row-header-buttons ui-grid-icon-ok" ng-class="{\'ui-grid-row-selected\': row.isSelected}" ng-click="selectButtonClick(row, $event)" ng-keydown="selectButtonKeyDown(row, $event)" role="checkbox" ng-model="row.isSelected">&nbsp;</div>'), 
    $templateCache.put("ui-grid/selectionSelectAllButtons", '<div role="button" class="ui-grid-selection-row-header-buttons ui-grid-icon-ok" ng-class="{\'ui-grid-all-selected\': grid.selection.selectAll}" ng-click="headerButtonClick($event)" ng-keydown="headerButtonKeyDown($event)"></div>'), 
    $templateCache.put("ui-grid/treeBaseExpandAllButtons", '<div class="ui-grid-tree-base-row-header-buttons" ng-class="headerButtonClass()" ng-click="headerButtonClick($event)"></div>'), 
    $templateCache.put("ui-grid/treeBaseHeaderCell", '<div><div class="ui-grid-cell-contents" col-index="renderIndex"><ui-grid-tree-base-expand-all-buttons ng-if="grid.options.enableExpandAll"></ui-grid-tree-base-expand-all-buttons></div></div>'), 
    $templateCache.put("ui-grid/treeBaseRowHeader", '<div class="ui-grid-cell-contents"><ui-grid-tree-base-row-header-buttons></ui-grid-tree-base-row-header-buttons></div>'), 
    $templateCache.put("ui-grid/treeBaseRowHeaderButtons", '<div class="ui-grid-tree-base-row-header-buttons" ng-class="{\'ui-grid-tree-base-header\': row.treeLevel > -1 }" ng-click="treeButtonClick(row, $event)"><i ng-class="treeButtonClass(row)" ng-style="{\'padding-left\': grid.options.treeIndent * row.treeLevel + \'px\'}"></i> &nbsp;</div>'), 
    $templateCache.put("ui-grid/cellTitleValidator", '<div class="ui-grid-cell-contents" ng-class="{invalid:grid.validate.isInvalid(row.entity,col.colDef)}" title="{{grid.validate.getTitleFormattedErrors(row.entity,col.colDef)}}">{{COL_FIELD CUSTOM_FILTERS}}</div>'), 
    $templateCache.put("ui-grid/cellTooltipValidator", '<div class="ui-grid-cell-contents" ng-class="{invalid:grid.validate.isInvalid(row.entity,col.colDef)}" tooltip-html-unsafe="{{grid.validate.getFormattedErrors(row.entity,col.colDef)}}" tooltip-enable="grid.validate.isInvalid(row.entity,col.colDef)" tooltip-append-to-body="true" tooltip-placement="top" title="TOOLTIP">{{COL_FIELD CUSTOM_FILTERS}}</div>');
} ]), function() {
    "use strict";
    var module = angular.module("ui.grid.pinning", [ "ui.grid" ]);
    module.constant("uiGridPinningConstants", {
        container: {
            LEFT: "left",
            RIGHT: "right",
            NONE: ""
        }
    }), module.service("uiGridPinningService", [ "gridUtil", "GridRenderContainer", "i18nService", "uiGridPinningConstants", function(gridUtil, GridRenderContainer, i18nService, uiGridPinningConstants) {
        var service = {
            initializeGrid: function(grid) {
                service.defaultGridOptions(grid.options), grid.registerColumnBuilder(service.pinningColumnBuilder);
                var publicApi = {
                    events: {
                        pinning: {
                            columnPinned: function(colDef, container) {}
                        }
                    },
                    methods: {
                        pinning: {
                            pinColumn: function(col, container) {
                                service.pinColumn(grid, col, container);
                            }
                        }
                    }
                };
                grid.api.registerEventsFromObject(publicApi.events), grid.api.registerMethodsFromObject(publicApi.methods);
            },
            defaultGridOptions: function(gridOptions) {
                gridOptions.enablePinning = !1 !== gridOptions.enablePinning, gridOptions.hidePinLeft = gridOptions.enablePinning && gridOptions.hidePinLeft, 
                gridOptions.hidePinRight = gridOptions.enablePinning && gridOptions.hidePinRight;
            },
            pinningColumnBuilder: function(colDef, col, gridOptions) {
                if (colDef.enablePinning = void 0 === colDef.enablePinning ? gridOptions.enablePinning : colDef.enablePinning, 
                colDef.hidePinLeft = void 0 === colDef.hidePinLeft ? gridOptions.hidePinLeft : colDef.hidePinLeft, 
                colDef.hidePinRight = void 0 === colDef.hidePinRight ? gridOptions.hidePinRight : colDef.hidePinRight, 
                colDef.pinnedLeft ? (col.renderContainer = "left", col.grid.createLeftContainer()) : colDef.pinnedRight && (col.renderContainer = "right", 
                col.grid.createRightContainer()), colDef.enablePinning) {
                    var pinColumnLeftAction = {
                        name: "ui.grid.pinning.pinLeft",
                        title: i18nService.get().pinning.pinLeft,
                        icon: "ui-grid-icon-left-open",
                        shown: function() {
                            return void 0 === this.context.col.renderContainer || !this.context.col.renderContainer || "left" !== this.context.col.renderContainer;
                        },
                        action: function() {
                            service.pinColumn(this.context.col.grid, this.context.col, uiGridPinningConstants.container.LEFT);
                        }
                    }, pinColumnRightAction = {
                        name: "ui.grid.pinning.pinRight",
                        title: i18nService.get().pinning.pinRight,
                        icon: "ui-grid-icon-right-open",
                        shown: function() {
                            return void 0 === this.context.col.renderContainer || !this.context.col.renderContainer || "right" !== this.context.col.renderContainer;
                        },
                        action: function() {
                            service.pinColumn(this.context.col.grid, this.context.col, uiGridPinningConstants.container.RIGHT);
                        }
                    }, removePinAction = {
                        name: "ui.grid.pinning.unpin",
                        title: i18nService.get().pinning.unpin,
                        icon: "ui-grid-icon-cancel",
                        shown: function() {
                            return void 0 !== this.context.col.renderContainer && null !== this.context.col.renderContainer && "body" !== this.context.col.renderContainer;
                        },
                        action: function() {
                            service.pinColumn(this.context.col.grid, this.context.col, uiGridPinningConstants.container.NONE);
                        }
                    };
                    colDef.hidePinLeft || gridUtil.arrayContainsObjectWithProperty(col.menuItems, "name", "ui.grid.pinning.pinLeft") || col.menuItems.push(pinColumnLeftAction), 
                    colDef.hidePinRight || gridUtil.arrayContainsObjectWithProperty(col.menuItems, "name", "ui.grid.pinning.pinRight") || col.menuItems.push(pinColumnRightAction), 
                    gridUtil.arrayContainsObjectWithProperty(col.menuItems, "name", "ui.grid.pinning.unpin") || col.menuItems.push(removePinAction);
                }
            },
            pinColumn: function(grid, col, container) {
                container === uiGridPinningConstants.container.NONE ? (col.renderContainer = null, 
                col.colDef.pinnedLeft = col.colDef.pinnedRight = !1) : (col.renderContainer = container) === uiGridPinningConstants.container.LEFT ? grid.createLeftContainer() : container === uiGridPinningConstants.container.RIGHT && grid.createRightContainer(), 
                grid.refresh().then(function() {
                    grid.api.pinning.raise.columnPinned(col.colDef, container);
                });
            }
        };
        return service;
    } ]), module.directive("uiGridPinning", [ "gridUtil", "uiGridPinningService", function(gridUtil, uiGridPinningService) {
        return {
            require: "uiGrid",
            scope: !1,
            compile: function() {
                return {
                    pre: function($scope, $elm, $attrs, uiGridCtrl) {
                        uiGridPinningService.initializeGrid(uiGridCtrl.grid);
                    },
                    post: function($scope, $elm, $attrs, uiGridCtrl) {}
                };
            }
        };
    } ]);
}();

var saveAs = saveAs || function(view) {
    "use strict";
    if (!(void 0 === view || "undefined" != typeof navigator && /MSIE [1-9]\./.test(navigator.userAgent))) {
        var doc = view.document, get_URL = function() {
            return view.URL || view.webkitURL || view;
        }, save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a"), can_use_save_link = "download" in save_link, is_safari = /constructor/i.test(view.HTMLElement) || view.safari, is_chrome_ios = /CriOS\/[\d]+/.test(navigator.userAgent), throw_outside = function(ex) {
            (view.setImmediate || view.setTimeout)(function() {
                throw ex;
            }, 0);
        }, revoke = function(file) {
            setTimeout(function() {
                "string" == typeof file ? get_URL().revokeObjectURL(file) : file.remove();
            }, 4e4);
        }, auto_bom = function(blob) {
            return /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type) ? new Blob([ String.fromCharCode(65279), blob ], {
                type: blob.type
            }) : blob;
        }, FileSaver = function(blob, name, no_auto_bom) {
            no_auto_bom || (blob = auto_bom(blob));
            var object_url, filesaver = this, force = "application/octet-stream" === blob.type, dispatch_all = function() {
                !function(filesaver, event_types, event) {
                    for (var i = (event_types = [].concat(event_types)).length; i--; ) {
                        var listener = filesaver["on" + event_types[i]];
                        if ("function" == typeof listener) try {
                            listener.call(filesaver, event || filesaver);
                        } catch (ex) {
                            throw_outside(ex);
                        }
                    }
                }(filesaver, "writestart progress write writeend".split(" "));
            };
            if (filesaver.readyState = filesaver.INIT, can_use_save_link) return object_url = get_URL().createObjectURL(blob), 
            void setTimeout(function() {
                var node, event;
                save_link.href = object_url, save_link.download = name, node = save_link, event = new MouseEvent("click"), 
                node.dispatchEvent(event), dispatch_all(), revoke(object_url), filesaver.readyState = filesaver.DONE;
            });
            !function() {
                if ((is_chrome_ios || force && is_safari) && view.FileReader) {
                    var reader = new FileReader();
                    return reader.onloadend = function() {
                        var url = is_chrome_ios ? reader.result : reader.result.replace(/^data:[^;]*;/, "data:attachment/file;");
                        view.open(url, "_blank") || (view.location.href = url), url = void 0, filesaver.readyState = filesaver.DONE, 
                        dispatch_all();
                    }, reader.readAsDataURL(blob), filesaver.readyState = filesaver.INIT;
                }
                object_url || (object_url = get_URL().createObjectURL(blob)), force ? view.location.href = object_url : view.open(object_url, "_blank") || (view.location.href = object_url);
                filesaver.readyState = filesaver.DONE, dispatch_all(), revoke(object_url);
            }();
        }, FS_proto = FileSaver.prototype;
        return "undefined" != typeof navigator && navigator.msSaveOrOpenBlob ? function(blob, name, no_auto_bom) {
            return name = name || blob.name || "download", no_auto_bom || (blob = auto_bom(blob)), 
            navigator.msSaveOrOpenBlob(blob, name);
        } : (FS_proto.abort = function() {}, FS_proto.readyState = FS_proto.INIT = 0, FS_proto.WRITING = 1, 
        FS_proto.DONE = 2, FS_proto.error = FS_proto.onwritestart = FS_proto.onprogress = FS_proto.onwrite = FS_proto.onabort = FS_proto.onerror = FS_proto.onwriteend = null, 
        function(blob, name, no_auto_bom) {
            return new FileSaver(blob, name || blob.name || "download", no_auto_bom);
        });
    }
}("undefined" != typeof self && self || "undefined" != typeof window && window || this.content);

"undefined" != typeof module && module.exports ? module.exports.saveAs = saveAs : "undefined" != typeof define && null !== define && null !== define.amd && define("FileSaver.js", function() {
    return saveAs;
}), function(f) {
    if ("object" == typeof exports && "undefined" != typeof module) module.exports = f(); else if ("function" == typeof define && define.amd) define([], f); else {
        ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).XlsxPopulate = f();
    }
}(function() {
    var define, module, exports;
    return function e(t, n, r) {
        function s(o, u) {
            if (!n[o]) {
                if (!t[o]) {
                    var a = "function" == typeof require && 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 || e);
                }, l, l.exports, e, t, n, r);
            }
            return n[o].exports;
        }
        for (var i = "function" == typeof require && require, o = 0; o < r.length; o++) s(r[o]);
        return s;
    }({
        1: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            require("lodash");
            var xmlq = require("./xmlq"), ArgHandler = require("./ArgHandler"), AppProperties = function() {
                function AppProperties(node) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, AppProperties), this._node = node;
                }
                return _createClass(AppProperties, [ {
                    key: "isSecure",
                    value: function(value) {
                        var _this = this;
                        return new ArgHandler("Range.formula").case(function() {
                            var docSecurityNode = xmlq.findChild(_this._node, "DocSecurity");
                            return !!docSecurityNode && 1 === docSecurityNode.children[0];
                        }).case("boolean", function(value) {
                            return xmlq.appendChildIfNotFound(_this._node, "DocSecurity").children = [ value ? 1 : 0 ], 
                            _this;
                        }).handle(arguments);
                    }
                }, {
                    key: "toXml",
                    value: function() {
                        return this._node;
                    }
                } ]), AppProperties;
            }();
            module.exports = AppProperties;
        }, {
            "./ArgHandler": 2,
            "./xmlq": 26,
            lodash: 191
        } ],
        2: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var _ = require("lodash"), ArgHandler = function() {
                function ArgHandler(name) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, ArgHandler), this._name = name, this._cases = [];
                }
                return _createClass(ArgHandler, [ {
                    key: "case",
                    value: function(types, handler) {
                        return 1 === arguments.length && (handler = types, types = []), Array.isArray(types) || (types = [ types ]), 
                        this._cases.push({
                            types: types,
                            handler: handler
                        }), this;
                    }
                }, {
                    key: "handle",
                    value: function(args) {
                        for (var i = 0; i < this._cases.length; i++) {
                            var c = this._cases[i];
                            if (this._argsMatchTypes(args, c.types)) return c.handler.apply(null, args);
                        }
                        throw new Error(this._name + ": Invalid arguments.");
                    }
                }, {
                    key: "_argsMatchTypes",
                    value: function(args, types) {
                        return args.length === types.length && _.every(args, function(arg, i) {
                            var type = types[i];
                            if ("*" === type) return !0;
                            if ("nil" === type) return _.isNil(arg);
                            if ("string" === type) return "string" == typeof arg;
                            if ("boolean" === type) return "boolean" == typeof arg;
                            if ("number" === type) return "number" == typeof arg;
                            if ("integer" === type) return "number" == typeof arg && _.isInteger(arg);
                            if ("function" === type) return "function" == typeof arg;
                            if ("array" === type) return Array.isArray(arg);
                            if ("date" === type) return arg && arg.constructor === Date;
                            if ("object" === type) return arg && arg.constructor === Object;
                            if (arg && arg.constructor && arg.constructor.name === type) return !0;
                            throw new Error("Unknown type: " + type);
                        });
                    }
                } ]), ArgHandler;
            }();
            module.exports = ArgHandler;
        }, {
            lodash: 191
        } ],
        3: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var _ = require("lodash"), ArgHandler = require("./ArgHandler"), addressConverter = require("./addressConverter"), dateConverter = require("./dateConverter"), regexify = require("./regexify"), xmlq = require("./xmlq"), FormulaError = require("./FormulaError"), Style = require("./Style"), Cell = function() {
                function Cell(row, node, styleId) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, Cell), this._row = row, this._init(node, styleId);
                }
                return _createClass(Cell, [ {
                    key: "active",
                    value: function() {
                        var _this = this;
                        return new ArgHandler("Cell.active").case(function() {
                            return _this.sheet().activeCell() === _this;
                        }).case("boolean", function(active) {
                            if (!active) throw new Error("Deactivating cell directly not supported. Activate a different cell instead.");
                            return _this.sheet().activeCell(_this), _this;
                        }).handle(arguments);
                    }
                }, {
                    key: "address",
                    value: function(opts) {
                        return addressConverter.toAddress({
                            type: "cell",
                            rowNumber: this.rowNumber(),
                            columnNumber: this.columnNumber(),
                            sheetName: opts && opts.includeSheetName && this.sheet().name(),
                            rowAnchored: opts && (opts.rowAnchored || opts.anchored),
                            columnAnchored: opts && (opts.columnAnchored || opts.anchored)
                        });
                    }
                }, {
                    key: "column",
                    value: function() {
                        return this.sheet().column(this.columnNumber());
                    }
                }, {
                    key: "clear",
                    value: function() {
                        var hostSharedFormulaId = this._formulaRef && this._sharedFormulaId;
                        return delete this._value, delete this._formulaType, delete this._formula, delete this._sharedFormulaId, 
                        delete this._formulaRef, _.isNil(hostSharedFormulaId) || this.sheet().clearCellsUsingSharedFormula(hostSharedFormulaId), 
                        this;
                    }
                }, {
                    key: "columnName",
                    value: function() {
                        return addressConverter.columnNumberToName(this.columnNumber());
                    }
                }, {
                    key: "columnNumber",
                    value: function() {
                        return this._columnNumber;
                    }
                }, {
                    key: "find",
                    value: function(pattern, replacement) {
                        pattern = regexify(pattern);
                        var value = this.value();
                        if ("string" != typeof value) return !1;
                        if (_.isNil(replacement)) return pattern.test(value);
                        var replaced = value.replace(pattern, replacement);
                        return replaced !== value && (this.value(replaced), !0);
                    }
                }, {
                    key: "formula",
                    value: function() {
                        var _this2 = this;
                        return new ArgHandler("Cell.formula").case(function() {
                            return "shared" !== _this2._formulaType || _this2._formulaRef ? _this2._formula : "SHARED";
                        }).case("nil", function() {
                            return _this2.clear(), _this2;
                        }).case("string", function(formula) {
                            return _this2.clear(), _this2._formulaType = "normal", _this2._formula = formula, 
                            _this2;
                        }).handle(arguments);
                    }
                }, {
                    key: "hyperlink",
                    value: function() {
                        var _this3 = this;
                        return new ArgHandler("Cell.hyperlink").case(function() {
                            return _this3.sheet().hyperlink(_this3.address());
                        }).case("*", function(hyperlink) {
                            return _this3.sheet().hyperlink(_this3.address(), hyperlink), _this3;
                        }).handle(arguments);
                    }
                }, {
                    key: "dataValidation",
                    value: function() {
                        var _this4 = this;
                        return new ArgHandler("Cell.dataValidation").case(function() {
                            return _this4.sheet().dataValidation(_this4.address());
                        }).case("boolean", function(obj) {
                            return _this4.sheet().dataValidation(_this4.address(), obj);
                        }).case("*", function(obj) {
                            return _this4.sheet().dataValidation(_this4.address(), obj), _this4;
                        }).handle(arguments);
                    }
                }, {
                    key: "tap",
                    value: function(callback) {
                        return callback(this), this;
                    }
                }, {
                    key: "thru",
                    value: function(callback) {
                        return callback(this);
                    }
                }, {
                    key: "rangeTo",
                    value: function(cell) {
                        return this.sheet().range(this, cell);
                    }
                }, {
                    key: "relativeCell",
                    value: function(rowOffset, columnOffset) {
                        var row = rowOffset + this.rowNumber(), column = columnOffset + this.columnNumber();
                        return this.sheet().cell(row, column);
                    }
                }, {
                    key: "row",
                    value: function() {
                        return this._row;
                    }
                }, {
                    key: "rowNumber",
                    value: function() {
                        return this.row().rowNumber();
                    }
                }, {
                    key: "sheet",
                    value: function() {
                        return this.row().sheet();
                    }
                }, {
                    key: "style",
                    value: function() {
                        var _this5 = this;
                        return this._style || arguments[0] instanceof Style || (this._style = this.workbook().styleSheet().createStyle(this._styleId)), 
                        new ArgHandler("Cell.style").case("string", function(name) {
                            return _this5._style.style(name);
                        }).case("array", function(names) {
                            var values = {};
                            return names.forEach(function(name) {
                                values[name] = _this5.style(name);
                            }), values;
                        }).case([ "string", "array" ], function(name, values) {
                            var numRows = values.length, numCols = values[0].length;
                            return _this5.rangeTo(_this5.relativeCell(numRows - 1, numCols - 1)).style(name, values);
                        }).case([ "string", "*" ], function(name, value) {
                            return _this5._style.style(name, value), _this5;
                        }).case("object", function(nameValues) {
                            for (var name in nameValues) if (nameValues.hasOwnProperty(name)) {
                                var value = nameValues[name];
                                _this5.style(name, value);
                            }
                            return _this5;
                        }).case("Style", function(style) {
                            return _this5._style = style, _this5._styleId = style.id(), _this5;
                        }).handle(arguments);
                    }
                }, {
                    key: "value",
                    value: function() {
                        var _this6 = this;
                        return new ArgHandler("Cell.value").case(function() {
                            return _this6._value;
                        }).case("array", function(values) {
                            var numRows = values.length, numCols = values[0].length;
                            return _this6.rangeTo(_this6.relativeCell(numRows - 1, numCols - 1)).value(values);
                        }).case("*", function(value) {
                            return _this6.clear(), _this6._value = value, _this6;
                        }).handle(arguments);
                    }
                }, {
                    key: "workbook",
                    value: function() {
                        return this.row().workbook();
                    }
                }, {
                    key: "getSharedRefFormula",
                    value: function() {
                        return "shared" === this._formulaType ? this._formulaRef && this._formula : void 0;
                    }
                }, {
                    key: "sharesFormula",
                    value: function(id) {
                        return "shared" === this._formulaType && this._sharedFormulaId === id;
                    }
                }, {
                    key: "setSharedFormula",
                    value: function(id, formula, sharedRef) {
                        this.clear(), this._formulaType = "shared", this._sharedFormulaId = id, this._formula = formula, 
                        this._formulaRef = sharedRef;
                    }
                }, {
                    key: "toXml",
                    value: function() {
                        var node = {
                            name: "c",
                            attributes: this._remainingAttributes || {},
                            children: []
                        };
                        if (node.attributes.r = this.address(), _.isNil(this._formulaType)) {
                            if (!_.isNil(this._value)) {
                                var type = void 0, text = void 0;
                                "string" == typeof this._value || _.isArray(this._value) ? (type = "s", text = this.workbook().sharedStrings().getIndexForString(this._value)) : "boolean" == typeof this._value ? (type = "b", 
                                text = this._value ? 1 : 0) : "number" == typeof this._value ? text = this._value : this._value instanceof Date && (text = dateConverter.dateToNumber(this._value)), 
                                type && (node.attributes.t = type);
                                var vNode = {
                                    name: "v",
                                    children: [ text ]
                                };
                                node.children.push(vNode);
                            }
                        } else {
                            var fNode = {
                                name: "f",
                                attributes: this._remainingFormulaAttributes || {}
                            };
                            "normal" !== this._formulaType && (fNode.attributes.t = this._formulaType), _.isNil(this._formulaRef) || (fNode.attributes.ref = this._formulaRef), 
                            _.isNil(this._sharedFormulaId) || (fNode.attributes.si = this._sharedFormulaId), 
                            _.isNil(this._formula) || (fNode.children = [ this._formula ]), node.children.push(fNode);
                        }
                        return _.isNil(this._style) ? _.isNil(this._styleId) || (node.attributes.s = this._styleId) : node.attributes.s = this._style.id(), 
                        this._remainingChildren && (node.children = node.children.concat(this._remainingChildren)), 
                        node;
                    }
                }, {
                    key: "_init",
                    value: function(nodeOrColumnNumber, styleId) {
                        _.isObject(nodeOrColumnNumber) ? this._parseNode(nodeOrColumnNumber) : (this._columnNumber = nodeOrColumnNumber, 
                        _.isNil(styleId) || (this._styleId = styleId));
                    }
                }, {
                    key: "_parseNode",
                    value: function(node) {
                        var ref = addressConverter.fromAddress(node.attributes.r);
                        this._columnNumber = ref.columnNumber, _.isNil(node.attributes.s) || (this._styleId = node.attributes.s);
                        var fNode = xmlq.findChild(node, "f");
                        fNode && (this._formulaType = fNode.attributes.t || "normal", this._formulaRef = fNode.attributes.ref, 
                        this._formula = fNode.children[0], this._sharedFormulaId = fNode.attributes.si, 
                        _.isNil(this._sharedFormulaId) || this.sheet().updateMaxSharedFormulaId(this._sharedFormulaId), 
                        delete fNode.attributes.t, delete fNode.attributes.ref, delete fNode.attributes.si, 
                        _.isEmpty(fNode.attributes) || (this._remainingFormulaAttributes = fNode.attributes));
                        var type = node.attributes.t;
                        if ("s" === type) {
                            var sharedIndex = xmlq.findChild(node, "v").children[0];
                            this._value = this.workbook().sharedStrings().getStringByIndex(sharedIndex);
                        } else if ("str" === type) {
                            var vNode = xmlq.findChild(node, "v");
                            this._value = vNode && vNode.children[0];
                        } else if ("inlineStr" === type) {
                            var isNode = xmlq.findChild(node, "is");
                            if ("t" === isNode.children[0].name) {
                                var tNode = isNode.children[0];
                                this._value = tNode.children[0];
                            } else this._value = isNode.children;
                        } else if ("b" === type) this._value = 1 === xmlq.findChild(node, "v").children[0]; else if ("e" === type) {
                            var error = xmlq.findChild(node, "v").children[0];
                            this._value = FormulaError.getError(error);
                        } else {
                            var _vNode = xmlq.findChild(node, "v");
                            this._value = _vNode && Number(_vNode.children[0]);
                        }
                        delete node.attributes.r, delete node.attributes.s, delete node.attributes.t, _.isEmpty(node.attributes) || (this._remainingAttributes = node.attributes), 
                        xmlq.removeChild(node, "f"), xmlq.removeChild(node, "v"), xmlq.removeChild(node, "is"), 
                        _.isEmpty(node.children) || (this._remainingChildren = node.children);
                    }
                } ]), Cell;
            }();
            module.exports = Cell;
        }, {
            "./ArgHandler": 2,
            "./FormulaError": 8,
            "./Style": 14,
            "./addressConverter": 20,
            "./dateConverter": 23,
            "./regexify": 25,
            "./xmlq": 26,
            lodash: 191
        } ],
        4: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var ArgHandler = require("./ArgHandler"), addressConverter = require("./addressConverter"), Column = function() {
                function Column(sheet, node) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, Column), this._sheet = sheet, this._node = node;
                }
                return _createClass(Column, [ {
                    key: "address",
                    value: function(opts) {
                        return addressConverter.toAddress({
                            type: "column",
                            columnName: this.columnName(),
                            sheetName: opts && opts.includeSheetName && this.sheet().name(),
                            columnAnchored: opts && opts.anchored
                        });
                    }
                }, {
                    key: "cell",
                    value: function(rowNumber) {
                        return this.sheet().cell(rowNumber, this.columnNumber());
                    }
                }, {
                    key: "columnName",
                    value: function() {
                        return addressConverter.columnNumberToName(this.columnNumber());
                    }
                }, {
                    key: "columnNumber",
                    value: function() {
                        return this._node.attributes.min;
                    }
                }, {
                    key: "hidden",
                    value: function() {
                        var _this = this;
                        return new ArgHandler("Column.hidden").case(function() {
                            return 1 === _this._node.attributes.hidden;
                        }).case("boolean", function(hidden) {
                            return hidden ? _this._node.attributes.hidden = 1 : delete _this._node.attributes.hidden, 
                            _this;
                        }).handle(arguments);
                    }
                }, {
                    key: "sheet",
                    value: function() {
                        return this._sheet;
                    }
                }, {
                    key: "style",
                    value: function() {
                        var _this2 = this;
                        return new ArgHandler("Column.style").case("string", function(name) {
                            return _this2._createStyleIfNeeded(), _this2._style.style(name);
                        }).case("array", function(names) {
                            var values = {};
                            return names.forEach(function(name) {
                                values[name] = _this2.style(name);
                            }), values;
                        }).case([ "string", "*" ], function(name, value) {
                            return _this2.sheet().forEachExistingRow(function(row) {
                                (row.hasStyle() || row.hasCell(_this2.columnNumber())) && row.cell(_this2.columnNumber()).style(name, value);
                            }), _this2._createStyleIfNeeded(), _this2._style.style(name, value), _this2;
                        }).case("object", function(nameValues) {
                            for (var name in nameValues) if (nameValues.hasOwnProperty(name)) {
                                var value = nameValues[name];
                                _this2.style(name, value);
                            }
                            return _this2;
                        }).case("Style", function(style) {
                            return _this2.sheet().forEachExistingRow(function(row) {
                                (row.hasStyle() || row.hasCell(_this2.columnNumber())) && row.cell(_this2.columnNumber()).style(style);
                            }), _this2._style = style, _this2._node.attributes.style = style.id(), _this2;
                        }).handle(arguments);
                    }
                }, {
                    key: "width",
                    value: function(_width) {
                        var _this3 = this;
                        return new ArgHandler("Column.width").case(function() {
                            return _this3._node.attributes.customWidth ? _this3._node.attributes.width : void 0;
                        }).case("number", function(width) {
                            return _this3._node.attributes.width = width, _this3._node.attributes.customWidth = 1, 
                            _this3;
                        }).case("nil", function() {
                            return delete _this3._node.attributes.width, delete _this3._node.attributes.customWidth, 
                            _this3;
                        }).handle(arguments);
                    }
                }, {
                    key: "workbook",
                    value: function() {
                        return this.sheet().workbook();
                    }
                }, {
                    key: "toXml",
                    value: function() {
                        return this._node;
                    }
                }, {
                    key: "_createStyleIfNeeded",
                    value: function() {
                        if (!this._style) {
                            var styleId = this._node.attributes.style;
                            this._style = this.workbook().styleSheet().createStyle(styleId), this._node.attributes.style = this._style.id(), 
                            this.width() || this.width(9.140625);
                        }
                    }
                } ]), Column;
            }();
            module.exports = Column;
        }, {
            "./ArgHandler": 2,
            "./addressConverter": 20
        } ],
        5: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var _ = require("lodash"), ContentTypes = function() {
                function ContentTypes(node) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, ContentTypes), this._node = node;
                }
                return _createClass(ContentTypes, [ {
                    key: "add",
                    value: function(partName, contentType) {
                        var node = {
                            name: "Override",
                            attributes: {
                                PartName: partName,
                                ContentType: contentType
                            }
                        };
                        return this._node.children.push(node), node;
                    }
                }, {
                    key: "findByPartName",
                    value: function(partName) {
                        return _.find(this._node.children, function(node) {
                            return node.attributes.PartName === partName;
                        });
                    }
                }, {
                    key: "toXml",
                    value: function() {
                        return this._node;
                    }
                } ]), ContentTypes;
            }();
            module.exports = ContentTypes;
        }, {
            lodash: 191
        } ],
        6: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var allowedProperties = {
                title: "dc:title",
                subject: "dc:subject",
                author: "dc:creator",
                creator: "dc:creator",
                description: "dc:description",
                keywords: "cp:keywords",
                category: "cp:category"
            }, CoreProperties = function() {
                function CoreProperties(node) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, CoreProperties), this._node = node, this._properties = {};
                }
                return _createClass(CoreProperties, [ {
                    key: "set",
                    value: function(name, value) {
                        var key = name.toLowerCase();
                        if (void 0 === allowedProperties[key]) throw new Error('Unknown property name: "' + name + '"');
                        return this._properties[key] = value, this;
                    }
                }, {
                    key: "get",
                    value: function(name) {
                        var key = name.toLowerCase();
                        if (void 0 === allowedProperties[key]) throw new Error('Unknown property name: "' + name + '"');
                        return this._properties[key];
                    }
                }, {
                    key: "toXml",
                    value: function() {
                        for (var key in this._properties) this._properties.hasOwnProperty(key) && this._node.children.push({
                            name: allowedProperties[key],
                            children: [ this._properties[key] ]
                        });
                        return this._node;
                    }
                } ]), CoreProperties;
            }();
            module.exports = CoreProperties;
        }, {} ],
        7: [ function(require, module, exports) {
            (function(Buffer) {
                "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 || !1, descriptor.configurable = !0, 
                            "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                        }
                    }
                    return function(Constructor, protoProps, staticProps) {
                        return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                        Constructor;
                    };
                }();
                var _ = require("lodash"), cfb = require("cfb"), crypto = require("crypto"), externals = require("./externals"), XmlParser = require("./XmlParser"), XmlBuilder = require("./XmlBuilder"), xmlq = require("./xmlq"), ENCRYPTION_INFO_PREFIX = Buffer.from([ 4, 0, 4, 0, 64, 0, 0, 0 ]), BLOCK_KEYS = {
                    dataIntegrity: {
                        hmacKey: Buffer.from([ 95, 178, 173, 1, 12, 185, 225, 246 ]),
                        hmacValue: Buffer.from([ 160, 103, 127, 2, 178, 44, 132, 51 ])
                    },
                    key: Buffer.from([ 20, 110, 11, 231, 171, 172, 208, 214 ]),
                    verifierHash: {
                        input: Buffer.from([ 254, 167, 210, 118, 59, 75, 158, 121 ]),
                        value: Buffer.from([ 215, 170, 15, 109, 48, 97, 52, 78 ])
                    }
                }, Encryptor = function() {
                    function Encryptor() {
                        !function(instance, Constructor) {
                            if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                        }(this, Encryptor);
                    }
                    return _createClass(Encryptor, [ {
                        key: "encrypt",
                        value: function(data, password) {
                            var packageKey = crypto.randomBytes(32), encryptionInfo = {
                                package: {
                                    cipherAlgorithm: "AES",
                                    cipherChaining: "ChainingModeCBC",
                                    saltValue: crypto.randomBytes(16),
                                    hashAlgorithm: "SHA512",
                                    hashSize: 64,
                                    blockSize: 16,
                                    keyBits: 8 * packageKey.length
                                },
                                key: {
                                    cipherAlgorithm: "AES",
                                    cipherChaining: "ChainingModeCBC",
                                    saltValue: crypto.randomBytes(16),
                                    hashAlgorithm: "SHA512",
                                    hashSize: 64,
                                    blockSize: 16,
                                    spinCount: 1e5,
                                    keyBits: 256
                                }
                            }, encryptedPackage = this._cryptPackage(!0, encryptionInfo.package.cipherAlgorithm, encryptionInfo.package.cipherChaining, encryptionInfo.package.hashAlgorithm, encryptionInfo.package.blockSize, encryptionInfo.package.saltValue, packageKey, data), hmacKey = crypto.randomBytes(64), hmacKeyIV = this._createIV(encryptionInfo.package.hashAlgorithm, encryptionInfo.package.saltValue, encryptionInfo.package.blockSize, BLOCK_KEYS.dataIntegrity.hmacKey), encryptedHmacKey = this._crypt(!0, encryptionInfo.package.cipherAlgorithm, encryptionInfo.package.cipherChaining, packageKey, hmacKeyIV, hmacKey), hmacValue = this._hmac(encryptionInfo.package.hashAlgorithm, hmacKey, encryptedPackage), hmacValueIV = this._createIV(encryptionInfo.package.hashAlgorithm, encryptionInfo.package.saltValue, encryptionInfo.package.blockSize, BLOCK_KEYS.dataIntegrity.hmacValue), encryptedHmacValue = this._crypt(!0, encryptionInfo.package.cipherAlgorithm, encryptionInfo.package.cipherChaining, packageKey, hmacValueIV, hmacValue);
                            encryptionInfo.dataIntegrity = {
                                encryptedHmacKey: encryptedHmacKey,
                                encryptedHmacValue: encryptedHmacValue
                            };
                            var key = this._convertPasswordToKey(password, encryptionInfo.key.hashAlgorithm, encryptionInfo.key.saltValue, encryptionInfo.key.spinCount, encryptionInfo.key.keyBits, BLOCK_KEYS.key);
                            encryptionInfo.key.encryptedKeyValue = this._crypt(!0, encryptionInfo.key.cipherAlgorithm, encryptionInfo.key.cipherChaining, key, encryptionInfo.key.saltValue, packageKey);
                            var verifierHashInput = crypto.randomBytes(16), verifierHashInputKey = this._convertPasswordToKey(password, encryptionInfo.key.hashAlgorithm, encryptionInfo.key.saltValue, encryptionInfo.key.spinCount, encryptionInfo.key.keyBits, BLOCK_KEYS.verifierHash.input);
                            encryptionInfo.key.encryptedVerifierHashInput = this._crypt(!0, encryptionInfo.key.cipherAlgorithm, encryptionInfo.key.cipherChaining, verifierHashInputKey, encryptionInfo.key.saltValue, verifierHashInput);
                            var verifierHashValue = this._hash(encryptionInfo.key.hashAlgorithm, verifierHashInput), verifierHashValueKey = this._convertPasswordToKey(password, encryptionInfo.key.hashAlgorithm, encryptionInfo.key.saltValue, encryptionInfo.key.spinCount, encryptionInfo.key.keyBits, BLOCK_KEYS.verifierHash.value);
                            encryptionInfo.key.encryptedVerifierHashValue = this._crypt(!0, encryptionInfo.key.cipherAlgorithm, encryptionInfo.key.cipherChaining, verifierHashValueKey, encryptionInfo.key.saltValue, verifierHashValue);
                            var encryptionInfoBuffer = this._buildEncryptionInfo(encryptionInfo), output = cfb.utils.cfb_new();
                            return cfb.utils.cfb_add(output, "EncryptionInfo", encryptionInfoBuffer), cfb.utils.cfb_add(output, "EncryptedPackage", encryptedPackage), 
                            cfb.utils.cfb_del(output, "Sh33tJ5"), output = cfb.write(output), Buffer.isBuffer(output) || (output = Buffer.from(output)), 
                            output;
                        }
                    }, {
                        key: "decryptAsync",
                        value: function(data, password) {
                            var _this = this, parsed = cfb.parse(data), encryptionInfoBuffer = _.find(parsed.FileIndex, {
                                name: "EncryptionInfo"
                            }).content, encryptedPackageBuffer = _.find(parsed.FileIndex, {
                                name: "EncryptedPackage"
                            }).content;
                            return Buffer.isBuffer(encryptionInfoBuffer) || (encryptionInfoBuffer = Buffer.from(encryptionInfoBuffer)), 
                            Buffer.isBuffer(encryptedPackageBuffer) || (encryptedPackageBuffer = Buffer.from(encryptedPackageBuffer)), 
                            externals.Promise.resolve().then(function() {
                                return _this._parseEncryptionInfoAsync(encryptionInfoBuffer);
                            }).then(function(encryptionInfo) {
                                var key = _this._convertPasswordToKey(password, encryptionInfo.key.hashAlgorithm, encryptionInfo.key.saltValue, encryptionInfo.key.spinCount, encryptionInfo.key.keyBits, BLOCK_KEYS.key), packageKey = _this._crypt(!1, encryptionInfo.key.cipherAlgorithm, encryptionInfo.key.cipherChaining, key, encryptionInfo.key.saltValue, encryptionInfo.key.encryptedKeyValue);
                                return _this._cryptPackage(!1, encryptionInfo.package.cipherAlgorithm, encryptionInfo.package.cipherChaining, encryptionInfo.package.hashAlgorithm, encryptionInfo.package.blockSize, encryptionInfo.package.saltValue, packageKey, encryptedPackageBuffer);
                            });
                        }
                    }, {
                        key: "_buildEncryptionInfo",
                        value: function(encryptionInfo) {
                            var encryptionInfoNode = {
                                name: "encryption",
                                attributes: {
                                    xmlns: "http://schemas.microsoft.com/office/2006/encryption",
                                    "xmlns:p": "http://schemas.microsoft.com/office/2006/keyEncryptor/password",
                                    "xmlns:c": "http://schemas.microsoft.com/office/2006/keyEncryptor/certificate"
                                },
                                children: [ {
                                    name: "keyData",
                                    attributes: {
                                        saltSize: encryptionInfo.package.saltValue.length,
                                        blockSize: encryptionInfo.package.blockSize,
                                        keyBits: encryptionInfo.package.keyBits,
                                        hashSize: encryptionInfo.package.hashSize,
                                        cipherAlgorithm: encryptionInfo.package.cipherAlgorithm,
                                        cipherChaining: encryptionInfo.package.cipherChaining,
                                        hashAlgorithm: encryptionInfo.package.hashAlgorithm,
                                        saltValue: encryptionInfo.package.saltValue.toString("base64")
                                    }
                                }, {
                                    name: "dataIntegrity",
                                    attributes: {
                                        encryptedHmacKey: encryptionInfo.dataIntegrity.encryptedHmacKey.toString("base64"),
                                        encryptedHmacValue: encryptionInfo.dataIntegrity.encryptedHmacValue.toString("base64")
                                    }
                                }, {
                                    name: "keyEncryptors",
                                    children: [ {
                                        name: "keyEncryptor",
                                        attributes: {
                                            uri: "http://schemas.microsoft.com/office/2006/keyEncryptor/password"
                                        },
                                        children: [ {
                                            name: "p:encryptedKey",
                                            attributes: {
                                                spinCount: encryptionInfo.key.spinCount,
                                                saltSize: encryptionInfo.key.saltValue.length,
                                                blockSize: encryptionInfo.key.blockSize,
                                                keyBits: encryptionInfo.key.keyBits,
                                                hashSize: encryptionInfo.key.hashSize,
                                                cipherAlgorithm: encryptionInfo.key.cipherAlgorithm,
                                                cipherChaining: encryptionInfo.key.cipherChaining,
                                                hashAlgorithm: encryptionInfo.key.hashAlgorithm,
                                                saltValue: encryptionInfo.key.saltValue.toString("base64"),
                                                encryptedVerifierHashInput: encryptionInfo.key.encryptedVerifierHashInput.toString("base64"),
                                                encryptedVerifierHashValue: encryptionInfo.key.encryptedVerifierHashValue.toString("base64"),
                                                encryptedKeyValue: encryptionInfo.key.encryptedKeyValue.toString("base64")
                                            }
                                        } ]
                                    } ]
                                } ]
                            }, encryptionInfoXml = new XmlBuilder().build(encryptionInfoNode);
                            return Buffer.concat([ ENCRYPTION_INFO_PREFIX, Buffer.from(encryptionInfoXml, "utf8") ]);
                        }
                    }, {
                        key: "_parseEncryptionInfoAsync",
                        value: function(buffer) {
                            var xml = buffer.slice(ENCRYPTION_INFO_PREFIX.length).toString("utf8");
                            return new XmlParser().parseAsync(xml).then(function(doc) {
                                var keyDataNode = xmlq.findChild(doc, "keyData"), keyEncryptorsNode = xmlq.findChild(doc, "keyEncryptors"), keyEncryptorNode = xmlq.findChild(keyEncryptorsNode, "keyEncryptor"), encryptedKeyNode = xmlq.findChild(keyEncryptorNode, "p:encryptedKey");
                                return {
                                    package: {
                                        cipherAlgorithm: keyDataNode.attributes.cipherAlgorithm,
                                        cipherChaining: keyDataNode.attributes.cipherChaining,
                                        saltValue: Buffer.from(keyDataNode.attributes.saltValue, "base64"),
                                        hashAlgorithm: keyDataNode.attributes.hashAlgorithm,
                                        blockSize: keyDataNode.attributes.blockSize
                                    },
                                    key: {
                                        encryptedKeyValue: Buffer.from(encryptedKeyNode.attributes.encryptedKeyValue, "base64"),
                                        cipherAlgorithm: encryptedKeyNode.attributes.cipherAlgorithm,
                                        cipherChaining: encryptedKeyNode.attributes.cipherChaining,
                                        saltValue: Buffer.from(encryptedKeyNode.attributes.saltValue, "base64"),
                                        hashAlgorithm: encryptedKeyNode.attributes.hashAlgorithm,
                                        spinCount: encryptedKeyNode.attributes.spinCount,
                                        keyBits: encryptedKeyNode.attributes.keyBits
                                    }
                                };
                            });
                        }
                    }, {
                        key: "_hash",
                        value: function(algorithm) {
                            if (algorithm = algorithm.toLowerCase(), crypto.getHashes().indexOf(algorithm) < 0) throw new Error("Hash algorithm '" + algorithm + "' not supported!");
                            for (var hash = crypto.createHash(algorithm), _len = arguments.length, buffers = Array(1 < _len ? _len - 1 : 0), _key = 1; _key < _len; _key++) buffers[_key - 1] = arguments[_key];
                            return hash.update(Buffer.concat(buffers)), hash.digest();
                        }
                    }, {
                        key: "_hmac",
                        value: function(algorithm, key) {
                            if (algorithm = algorithm.toLowerCase(), crypto.getHashes().indexOf(algorithm) < 0) throw new Error("HMAC algorithm '" + algorithm + "' not supported!");
                            for (var hmac = crypto.createHmac(algorithm, key), _len2 = arguments.length, buffers = Array(2 < _len2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) buffers[_key2 - 2] = arguments[_key2];
                            return hmac.update(Buffer.concat(buffers)), hmac.digest();
                        }
                    }, {
                        key: "_crypt",
                        value: function(encrypt, cipherAlgorithm, cipherChaining, key, iv, input) {
                            var algorithm = cipherAlgorithm.toLowerCase() + "-" + 8 * key.length;
                            if ("ChainingModeCBC" !== cipherChaining) throw new Error("Unknown cipher chaining: " + cipherChaining);
                            algorithm += "-cbc";
                            var cipher = crypto[encrypt ? "createCipheriv" : "createDecipheriv"](algorithm, key, iv);
                            cipher.setAutoPadding(!1);
                            var output = cipher.update(input);
                            return output = Buffer.concat([ output, cipher.final() ]);
                        }
                    }, {
                        key: "_cryptPackage",
                        value: function(encrypt, cipherAlgorithm, cipherChaining, hashAlgorithm, blockSize, saltValue, key, input) {
                            for (var outputChunks = [], offset = encrypt ? 0 : 8, i = 0, start = 0, end = 0; end < input.length; ) {
                                (end = (start = end) + 4096) > input.length && (end = input.length);
                                var inputChunk = input.slice(start + offset, end + offset), remainder = inputChunk.length % blockSize;
                                remainder && (inputChunk = Buffer.concat([ inputChunk, Buffer.alloc(blockSize - remainder) ]));
                                var iv = this._createIV(hashAlgorithm, saltValue, blockSize, i), outputChunk = this._crypt(encrypt, cipherAlgorithm, cipherChaining, key, iv, inputChunk);
                                outputChunks.push(outputChunk), i++;
                            }
                            var output = Buffer.concat(outputChunks);
                            if (encrypt) output = Buffer.concat([ this._createUInt32LEBuffer(input.length, 8), output ]); else {
                                var length = input.readUInt32LE(0);
                                output = output.slice(0, length);
                            }
                            return output;
                        }
                    }, {
                        key: "_createUInt32LEBuffer",
                        value: function(value) {
                            var bufferSize = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : 4, buffer = new Buffer(bufferSize);
                            return buffer.writeUInt32LE(value, 0), buffer;
                        }
                    }, {
                        key: "_convertPasswordToKey",
                        value: function(password, hashAlgorithm, saltValue, spinCount, keyBits, blockKey) {
                            for (var passwordBuffer = Buffer.from(password, "utf16le"), key = this._hash(hashAlgorithm, saltValue, passwordBuffer), i = 0; i < spinCount; i++) {
                                var iterator = this._createUInt32LEBuffer(i);
                                key = this._hash(hashAlgorithm, iterator, key);
                            }
                            var keyBytes = keyBits / 8;
                            if ((key = this._hash(hashAlgorithm, key, blockKey)).length < keyBytes) {
                                var tmp = Buffer.alloc(keyBytes, 54);
                                key.copy(tmp), key = tmp;
                            } else key.length > keyBytes && (key = key.slice(0, keyBytes));
                            return key;
                        }
                    }, {
                        key: "_createIV",
                        value: function(hashAlgorithm, saltValue, blockSize, blockKey) {
                            "number" == typeof blockKey && (blockKey = this._createUInt32LEBuffer(blockKey));
                            var iv = this._hash(hashAlgorithm, saltValue, blockKey);
                            if (iv.length < blockSize) {
                                var tmp = Buffer.alloc(blockSize, 54);
                                iv.copy(tmp), iv = tmp;
                            } else iv.length > blockSize && (iv = iv.slice(0, blockSize));
                            return iv;
                        }
                    } ]), Encryptor;
                }();
                module.exports = Encryptor;
            }).call(this, require("buffer").Buffer);
        }, {
            "./XmlBuilder": 18,
            "./XmlParser": 19,
            "./externals": 24,
            "./xmlq": 26,
            buffer: 77,
            cfb: 78,
            crypto: 108,
            lodash: 191
        } ],
        8: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var _ = require("lodash"), FormulaError = function() {
                function FormulaError(error) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, FormulaError), this._error = error;
                }
                return _createClass(FormulaError, [ {
                    key: "error",
                    value: function() {
                        return this._error;
                    }
                } ]), FormulaError;
            }();
            FormulaError.DIV0 = new FormulaError("#DIV/0!"), FormulaError.NA = new FormulaError("#N/A"), 
            FormulaError.NAME = new FormulaError("#NAME?"), FormulaError.NULL = new FormulaError("#NULL!"), 
            FormulaError.NUM = new FormulaError("#NUM!"), FormulaError.REF = new FormulaError("#REF!"), 
            FormulaError.VALUE = new FormulaError("#VALUE!"), FormulaError.getError = function(error) {
                return _.find(FormulaError, function(value) {
                    return value instanceof FormulaError && value.error() === error;
                }) || new FormulaError(error);
            }, module.exports = FormulaError;
        }, {
            lodash: 191
        } ],
        9: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var ArgHandler = require("./ArgHandler"), addressConverter = require("./addressConverter"), Range = function() {
                function Range(startCell, endCell) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, Range), this._startCell = startCell, this._endCell = endCell, this._findRangeExtent(startCell, endCell);
                }
                return _createClass(Range, [ {
                    key: "address",
                    value: function(opts) {
                        return addressConverter.toAddress({
                            type: "range",
                            startRowNumber: this.startCell().rowNumber(),
                            startRowAnchored: opts && (opts.startRowAnchored || opts.anchored),
                            startColumnName: this.startCell().columnName(),
                            startColumnAnchored: opts && (opts.startColumnAnchored || opts.anchored),
                            endRowNumber: this.endCell().rowNumber(),
                            endRowAnchored: opts && (opts.endRowAnchored || opts.anchored),
                            endColumnName: this.endCell().columnName(),
                            endColumnAnchored: opts && (opts.endColumnAnchored || opts.anchored),
                            sheetName: opts && opts.includeSheetName && this.sheet().name()
                        });
                    }
                }, {
                    key: "cell",
                    value: function(ri, ci) {
                        return this.sheet().cell(this._minRowNumber + ri, this._minColumnNumber + ci);
                    }
                }, {
                    key: "autoFilter",
                    value: function() {
                        return this.sheet().autoFilter(this), this;
                    }
                }, {
                    key: "cells",
                    value: function() {
                        return this.map(function(cell) {
                            return cell;
                        });
                    }
                }, {
                    key: "clear",
                    value: function() {
                        return this.value(void 0);
                    }
                }, {
                    key: "endCell",
                    value: function() {
                        return this._endCell;
                    }
                }, {
                    key: "forEach",
                    value: function(callback) {
                        for (var ri = 0; ri < this._numRows; ri++) for (var ci = 0; ci < this._numColumns; ci++) callback(this.cell(ri, ci), ri, ci, this);
                        return this;
                    }
                }, {
                    key: "formula",
                    value: function() {
                        var _this = this;
                        return new ArgHandler("Range.formula").case(function() {
                            return _this.startCell().getSharedRefFormula();
                        }).case("string", function(formula) {
                            var sharedFormulaId = _this.sheet().incrementMaxSharedFormulaId();
                            return _this.forEach(function(cell, ri, ci) {
                                0 === ri && 0 === ci ? cell.setSharedFormula(sharedFormulaId, formula, _this.address()) : cell.setSharedFormula(sharedFormulaId);
                            }), _this;
                        }).handle(arguments);
                    }
                }, {
                    key: "map",
                    value: function(callback) {
                        var _this2 = this, result = [];
                        return this.forEach(function(cell, ri, ci) {
                            result[ri] || (result[ri] = []), result[ri][ci] = callback(cell, ri, ci, _this2);
                        }), result;
                    }
                }, {
                    key: "merged",
                    value: function(_merged) {
                        var _this3 = this;
                        return new ArgHandler("Range.merged").case(function() {
                            return _this3.sheet().merged(_this3.address());
                        }).case("*", function(merged) {
                            return _this3.sheet().merged(_this3.address(), merged), _this3;
                        }).handle(arguments);
                    }
                }, {
                    key: "dataValidation",
                    value: function() {
                        var _this4 = this;
                        return new ArgHandler("Range.dataValidation").case(function() {
                            return _this4.sheet().dataValidation(_this4.address());
                        }).case("boolean", function(obj) {
                            return _this4.sheet().dataValidation(_this4.address(), obj);
                        }).case("*", function(obj) {
                            return _this4.sheet().dataValidation(_this4.address(), obj), _this4;
                        }).handle(arguments);
                    }
                }, {
                    key: "reduce",
                    value: function(callback, initialValue) {
                        var _this5 = this, accumulator = initialValue;
                        return this.forEach(function(cell, ri, ci) {
                            accumulator = callback(accumulator, cell, ri, ci, _this5);
                        }), accumulator;
                    }
                }, {
                    key: "sheet",
                    value: function() {
                        return this.startCell().sheet();
                    }
                }, {
                    key: "startCell",
                    value: function() {
                        return this._startCell;
                    }
                }, {
                    key: "style",
                    value: function() {
                        var _this6 = this;
                        return new ArgHandler("Range.style").case("string", function(name) {
                            return _this6.map(function(cell) {
                                return cell.style(name);
                            });
                        }).case("array", function(names) {
                            var values = {};
                            return names.forEach(function(name) {
                                values[name] = _this6.style(name);
                            }), values;
                        }).case([ "string", "function" ], function(name, callback) {
                            return _this6.forEach(function(cell, ri, ci) {
                                cell.style(name, callback(cell, ri, ci, _this6));
                            });
                        }).case([ "string", "array" ], function(name, values) {
                            return _this6.forEach(function(cell, ri, ci) {
                                values[ri] && void 0 !== values[ri][ci] && cell.style(name, values[ri][ci]);
                            });
                        }).case([ "string", "*" ], function(name, value) {
                            return _this6.forEach(function(cell) {
                                return cell.style(name, value);
                            });
                        }).case("object", function(nameValues) {
                            for (var name in nameValues) if (nameValues.hasOwnProperty(name)) {
                                var value = nameValues[name];
                                _this6.style(name, value);
                            }
                            return _this6;
                        }).case("Style", function(style) {
                            return _this6._style = style, _this6.forEach(function(cell) {
                                return cell.style(style);
                            });
                        }).handle(arguments);
                    }
                }, {
                    key: "tap",
                    value: function(callback) {
                        return callback(this), this;
                    }
                }, {
                    key: "thru",
                    value: function(callback) {
                        return callback(this);
                    }
                }, {
                    key: "value",
                    value: function() {
                        var _this7 = this;
                        return new ArgHandler("Range.value").case(function() {
                            return _this7.map(function(cell) {
                                return cell.value();
                            });
                        }).case("function", function(callback) {
                            return _this7.forEach(function(cell, ri, ci) {
                                cell.value(callback(cell, ri, ci, _this7));
                            });
                        }).case("array", function(values) {
                            return _this7.forEach(function(cell, ri, ci) {
                                values[ri] && void 0 !== values[ri][ci] && cell.value(values[ri][ci]);
                            });
                        }).case("*", function(value) {
                            return _this7.forEach(function(cell) {
                                return cell.value(value);
                            });
                        }).handle(arguments);
                    }
                }, {
                    key: "workbook",
                    value: function() {
                        return this.sheet().workbook();
                    }
                }, {
                    key: "_findRangeExtent",
                    value: function() {
                        this._minRowNumber = Math.min(this._startCell.rowNumber(), this._endCell.rowNumber()), 
                        this._maxRowNumber = Math.max(this._startCell.rowNumber(), this._endCell.rowNumber()), 
                        this._minColumnNumber = Math.min(this._startCell.columnNumber(), this._endCell.columnNumber()), 
                        this._maxColumnNumber = Math.max(this._startCell.columnNumber(), this._endCell.columnNumber()), 
                        this._numRows = this._maxRowNumber - this._minRowNumber + 1, this._numColumns = this._maxColumnNumber - this._minColumnNumber + 1;
                    }
                } ]), Range;
            }();
            module.exports = Range;
        }, {
            "./ArgHandler": 2,
            "./addressConverter": 20
        } ],
        10: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var _ = require("lodash"), Relationships = function() {
                function Relationships(node) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, Relationships), this._init(node), this._getStartingId();
                }
                return _createClass(Relationships, [ {
                    key: "add",
                    value: function(type, target, targetMode) {
                        var node = {
                            name: "Relationship",
                            attributes: {
                                Id: "rId" + this._nextId++,
                                Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" + type,
                                Target: target
                            }
                        };
                        return targetMode && (node.attributes.TargetMode = targetMode), this._node.children.push(node), 
                        node;
                    }
                }, {
                    key: "findById",
                    value: function(id) {
                        return _.find(this._node.children, function(node) {
                            return node.attributes.Id === id;
                        });
                    }
                }, {
                    key: "findByType",
                    value: function(type) {
                        return _.find(this._node.children, function(node) {
                            return node.attributes.Type === "http://schemas.openxmlformats.org/officeDocument/2006/relationships/" + type;
                        });
                    }
                }, {
                    key: "toXml",
                    value: function() {
                        if (this._node.children.length) return this._node;
                    }
                }, {
                    key: "_getStartingId",
                    value: function() {
                        var _this = this;
                        this._nextId = 1, this._node.children.forEach(function(node) {
                            var id = parseInt(node.attributes.Id.substr(3));
                            id >= _this._nextId && (_this._nextId = id + 1);
                        });
                    }
                }, {
                    key: "_init",
                    value: function(node) {
                        node || (node = {
                            name: "Relationships",
                            attributes: {
                                xmlns: "http://schemas.openxmlformats.org/package/2006/relationships"
                            },
                            children: []
                        }), this._node = node;
                    }
                } ]), Relationships;
            }();
            module.exports = Relationships;
        }, {
            lodash: 191
        } ],
        11: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var _ = require("lodash"), Cell = require("./Cell"), regexify = require("./regexify"), ArgHandler = require("./ArgHandler"), addressConverter = require("./addressConverter"), Row = function() {
                function Row(sheet, node) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, Row), this._sheet = sheet, this._init(node);
                }
                return _createClass(Row, [ {
                    key: "address",
                    value: function(opts) {
                        return addressConverter.toAddress({
                            type: "row",
                            rowNumber: this.rowNumber(),
                            sheetName: opts && opts.includeSheetName && this.sheet().name(),
                            rowAnchored: opts && opts.anchored
                        });
                    }
                }, {
                    key: "cell",
                    value: function(columnNameOrNumber) {
                        var columnNumber = columnNameOrNumber;
                        if ("string" == typeof columnNameOrNumber && (columnNumber = addressConverter.columnNameToNumber(columnNameOrNumber)), 
                        this._cells[columnNumber]) return this._cells[columnNumber];
                        var styleId = void 0, rowStyleId = this._node.attributes.s, columnStyleId = this.sheet().existingColumnStyleId(columnNumber);
                        _.isNil(rowStyleId) ? _.isNil(columnStyleId) || (styleId = columnStyleId) : styleId = rowStyleId;
                        var cell = new Cell(this, columnNumber, styleId);
                        return this._cells[columnNumber] = cell;
                    }
                }, {
                    key: "height",
                    value: function() {
                        var _this = this;
                        return new ArgHandler("Row.height").case(function() {
                            return _this._node.attributes.customHeight ? _this._node.attributes.ht : void 0;
                        }).case("number", function(height) {
                            return _this._node.attributes.ht = height, _this._node.attributes.customHeight = 1, 
                            _this;
                        }).case("nil", function() {
                            return delete _this._node.attributes.ht, delete _this._node.attributes.customHeight, 
                            _this;
                        }).handle(arguments);
                    }
                }, {
                    key: "hidden",
                    value: function() {
                        var _this2 = this;
                        return new ArgHandler("Row.hidden").case(function() {
                            return 1 === _this2._node.attributes.hidden;
                        }).case("boolean", function(hidden) {
                            return hidden ? _this2._node.attributes.hidden = 1 : delete _this2._node.attributes.hidden, 
                            _this2;
                        }).handle(arguments);
                    }
                }, {
                    key: "rowNumber",
                    value: function() {
                        return this._node.attributes.r;
                    }
                }, {
                    key: "sheet",
                    value: function() {
                        return this._sheet;
                    }
                }, {
                    key: "style",
                    value: function() {
                        var _this3 = this;
                        return new ArgHandler("Row.style").case("string", function(name) {
                            return _this3._createStyleIfNeeded(), _this3._style.style(name);
                        }).case("array", function(names) {
                            var values = {};
                            return names.forEach(function(name) {
                                values[name] = _this3.style(name);
                            }), values;
                        }).case([ "string", "*" ], function(name, value) {
                            return _this3._createCellStylesIfNeeded(), _.forEach(_this3._cells, function(cell) {
                                cell && cell.style(name, value);
                            }), _this3._createStyleIfNeeded(), _this3._style.style(name, value), _this3;
                        }).case("object", function(nameValues) {
                            for (var name in nameValues) if (nameValues.hasOwnProperty(name)) {
                                var value = nameValues[name];
                                _this3.style(name, value);
                            }
                            return _this3;
                        }).case("Style", function(style) {
                            return _this3._createCellStylesIfNeeded(), _.forEach(_this3._cells, function(cell) {
                                cell && cell.style(style);
                            }), _this3._style = style, _this3._node.attributes.s = style.id(), _this3._node.attributes.customFormat = 1, 
                            _this3;
                        }).handle(arguments);
                    }
                }, {
                    key: "workbook",
                    value: function() {
                        return this.sheet().workbook();
                    }
                }, {
                    key: "clearCellsUsingSharedFormula",
                    value: function(sharedFormulaId) {
                        this._cells.forEach(function(cell) {
                            cell && cell.sharesFormula(sharedFormulaId) && cell.clear();
                        });
                    }
                }, {
                    key: "find",
                    value: function(pattern, replacement) {
                        pattern = regexify(pattern);
                        var matches = [];
                        return this._cells.forEach(function(cell) {
                            cell && cell.find(pattern, replacement) && matches.push(cell);
                        }), matches;
                    }
                }, {
                    key: "hasCell",
                    value: function(columnNumber) {
                        return !!this._cells[columnNumber];
                    }
                }, {
                    key: "hasStyle",
                    value: function() {
                        return !_.isNil(this._node.attributes.s);
                    }
                }, {
                    key: "minUsedColumnNumber",
                    value: function() {
                        return _.findIndex(this._cells);
                    }
                }, {
                    key: "maxUsedColumnNumber",
                    value: function() {
                        return this._cells.length - 1;
                    }
                }, {
                    key: "toXml",
                    value: function() {
                        return this._node;
                    }
                }, {
                    key: "_createCellStylesIfNeeded",
                    value: function() {
                        var _this4 = this;
                        this.sheet().forEachExistingColumnNumber(function(columnNumber) {
                            _.isNil(_this4.sheet().existingColumnStyleId(columnNumber)) || _this4.cell(columnNumber);
                        });
                    }
                }, {
                    key: "_createStyleIfNeeded",
                    value: function() {
                        if (!this._style) {
                            var styleId = this._node.attributes.s;
                            this._style = this.workbook().styleSheet().createStyle(styleId), this._node.attributes.s = this._style.id(), 
                            this._node.attributes.customFormat = 1;
                        }
                    }
                }, {
                    key: "_init",
                    value: function(node) {
                        var _this5 = this;
                        this._node = node, this._cells = [], this._node.children.forEach(function(cellNode) {
                            var cell = new Cell(_this5, cellNode);
                            _this5._cells[cell.columnNumber()] = cell;
                        }), this._node.children = this._cells;
                    }
                } ]), Row;
            }();
            module.exports = Row;
        }, {
            "./ArgHandler": 2,
            "./Cell": 3,
            "./addressConverter": 20,
            "./regexify": 25,
            lodash: 191
        } ],
        12: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var _ = require("lodash"), SharedStrings = function() {
                function SharedStrings(node) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, SharedStrings), this._stringArray = [], this._indexMap = {}, this._init(node), 
                    this._cacheExistingSharedStrings();
                }
                return _createClass(SharedStrings, [ {
                    key: "getIndexForString",
                    value: function(string) {
                        var key = _.isArray(string) ? JSON.stringify(string) : string, index = this._indexMap[key];
                        return 0 <= index || (index = this._stringArray.length, this._stringArray.push(string), 
                        this._indexMap[key] = index, this._node.children.push({
                            name: "si",
                            children: _.isArray(string) ? string : [ {
                                name: "t",
                                attributes: {
                                    "xml:space": "preserve"
                                },
                                children: [ string ]
                            } ]
                        })), index;
                    }
                }, {
                    key: "getStringByIndex",
                    value: function(index) {
                        return this._stringArray[index];
                    }
                }, {
                    key: "toXml",
                    value: function() {
                        return this._node;
                    }
                }, {
                    key: "_cacheExistingSharedStrings",
                    value: function() {
                        var _this = this;
                        this._node.children.forEach(function(node, i) {
                            var content = node.children[0];
                            if ("t" === content.name) {
                                var string = content.children[0];
                                _this._stringArray.push(string), _this._indexMap[string] = i;
                            } else _this._stringArray.push(node.children), _this._indexMap[JSON.stringify(node.children)] = i;
                        });
                    }
                }, {
                    key: "_init",
                    value: function(node) {
                        node || (node = {
                            name: "sst",
                            attributes: {
                                xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main"
                            },
                            children: []
                        }), this._node = node, delete this._node.attributes.count, delete this._node.attributes.uniqueCount;
                    }
                } ]), SharedStrings;
            }();
            module.exports = SharedStrings;
        }, {
            lodash: 191
        } ],
        13: [ function(require, module, exports) {
            "use strict";
            var _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
                return typeof obj;
            } : function(obj) {
                return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
            }, _createClass = function() {
                function defineProperties(target, props) {
                    for (var i = 0; i < props.length; i++) {
                        var descriptor = props[i];
                        descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var _ = require("lodash"), Cell = require("./Cell"), Row = require("./Row"), Column = require("./Column"), Range = require("./Range"), Relationships = require("./Relationships"), xmlq = require("./xmlq"), regexify = require("./regexify"), addressConverter = require("./addressConverter"), ArgHandler = require("./ArgHandler"), colorIndexes = require("./colorIndexes"), nodeOrder = [ "sheetPr", "dimension", "sheetViews", "sheetFormatPr", "cols", "sheetData", "sheetCalcPr", "sheetProtection", "autoFilter", "protectedRanges", "scenarios", "autoFilter", "sortState", "dataConsolidate", "customSheetViews", "mergeCells", "phoneticPr", "conditionalFormatting", "dataValidations", "hyperlinks", "printOptions", "pageMargins", "pageSetup", "headerFooter", "rowBreaks", "colBreaks", "customProperties", "cellWatches", "ignoredErrors", "smartTags", "drawing", "drawingHF", "picture", "oleObjects", "controls", "webPublishItems", "tableParts", "extLst" ], Sheet = function() {
                function Sheet(workbook, idNode, node, relationshipsNode) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, Sheet), this._init(workbook, idNode, node, relationshipsNode);
                }
                return _createClass(Sheet, [ {
                    key: "active",
                    value: function() {
                        var _this = this;
                        return new ArgHandler("Sheet.active").case(function() {
                            return _this.workbook().activeSheet() === _this;
                        }).case("boolean", function(active) {
                            if (!active) throw new Error("Deactivating sheet directly not supported. Activate a different sheet instead.");
                            return _this.workbook().activeSheet(_this), _this;
                        }).handle(arguments);
                    }
                }, {
                    key: "activeCell",
                    value: function() {
                        var _this2 = this, sheetViewNode = this._getOrCreateSheetViewNode(), selectionNode = xmlq.findChild(sheetViewNode, "selection");
                        return new ArgHandler("Sheet.activeCell").case(function() {
                            var cellAddress = selectionNode ? selectionNode.attributes.activeCell : "A1";
                            return _this2.cell(cellAddress);
                        }).case([ "number", "*" ], function(rowNumber, columnNameOrNumber) {
                            var cell = _this2.cell(rowNumber, columnNameOrNumber);
                            return _this2.activeCell(cell);
                        }).case("*", function(cell) {
                            return selectionNode || (selectionNode = {
                                name: "selection",
                                attributes: {},
                                children: []
                            }, xmlq.appendChild(sheetViewNode, selectionNode)), cell instanceof Cell || (cell = _this2.cell(cell)), 
                            selectionNode.attributes.activeCell = selectionNode.attributes.sqref = cell.address(), 
                            _this2;
                        }).handle(arguments);
                    }
                }, {
                    key: "cell",
                    value: function() {
                        var _this3 = this;
                        return new ArgHandler("Sheet.cell").case("string", function(address) {
                            var ref = addressConverter.fromAddress(address);
                            if ("cell" !== ref.type) throw new Error("Sheet.cell: Invalid address.");
                            return _this3.row(ref.rowNumber).cell(ref.columnNumber);
                        }).case([ "number", "*" ], function(rowNumber, columnNameOrNumber) {
                            return _this3.row(rowNumber).cell(columnNameOrNumber);
                        }).handle(arguments);
                    }
                }, {
                    key: "column",
                    value: function(columnNameOrNumber) {
                        var columnNumber = "string" == typeof columnNameOrNumber ? addressConverter.columnNameToNumber(columnNameOrNumber) : columnNameOrNumber;
                        if (this._columns[columnNumber]) return this._columns[columnNumber];
                        var existingColNode = this._colNodes[columnNumber], colNode = void 0;
                        if (existingColNode) {
                            if (existingColNode.attributes.min < columnNumber) {
                                var beforeColNode = _.cloneDeep(existingColNode);
                                beforeColNode.attributes.max = columnNumber - 1;
                                for (var i = beforeColNode.attributes.min; i <= beforeColNode.attributes.max; i++) this._colNodes[i] = beforeColNode;
                            }
                            if ((colNode = _.cloneDeep(existingColNode)).attributes.min = columnNumber, colNode.attributes.max = columnNumber, 
                            this._colNodes[columnNumber] = colNode, existingColNode.attributes.max > columnNumber) {
                                var afterColNode = _.cloneDeep(existingColNode);
                                afterColNode.attributes.min = columnNumber + 1;
                                for (var _i = afterColNode.attributes.min; _i <= afterColNode.attributes.max; _i++) this._colNodes[_i] = afterColNode;
                            }
                        } else colNode = {
                            name: "col",
                            attributes: {
                                min: columnNumber,
                                max: columnNumber
                            },
                            children: []
                        }, this._colNodes[columnNumber] = colNode;
                        var column = new Column(this, colNode);
                        return this._columns[columnNumber] = column;
                    }
                }, {
                    key: "definedName",
                    value: function() {
                        var _this4 = this;
                        return new ArgHandler("Workbook.definedName").case("string", function(name) {
                            return _this4.workbook().scopedDefinedName(_this4, name);
                        }).case([ "string", "*" ], function(name, refersTo) {
                            return _this4.workbook().scopedDefinedName(_this4, name, refersTo), _this4;
                        }).handle(arguments);
                    }
                }, {
                    key: "delete",
                    value: function() {
                        return this.workbook().deleteSheet(this), this.workbook();
                    }
                }, {
                    key: "find",
                    value: function(pattern, replacement) {
                        pattern = regexify(pattern);
                        var matches = [];
                        return this._rows.forEach(function(row) {
                            row && (matches = matches.concat(row.find(pattern, replacement)));
                        }), matches;
                    }
                }, {
                    key: "gridLinesVisible",
                    value: function() {
                        var _this5 = this, sheetViewNode = this._getOrCreateSheetViewNode();
                        return new ArgHandler("Sheet.gridLinesVisible").case(function() {
                            return 1 === sheetViewNode.attributes.showGridLines || void 0 === sheetViewNode.attributes.showGridLines;
                        }).case("boolean", function(visible) {
                            return sheetViewNode.attributes.showGridLines = visible ? 1 : 0, _this5;
                        }).handle(arguments);
                    }
                }, {
                    key: "hidden",
                    value: function() {
                        var _this6 = this;
                        return new ArgHandler("Sheet.hidden").case(function() {
                            return "hidden" === _this6._idNode.attributes.state || "veryHidden" === _this6._idNode.attributes.state && "very";
                        }).case("*", function(hidden) {
                            if (hidden) {
                                var visibleSheets = _.filter(_this6.workbook().sheets(), function(sheet) {
                                    return !sheet.hidden();
                                });
                                if (1 === visibleSheets.length && visibleSheets[0] === _this6) throw new Error("This sheet may not be hidden as a workbook must contain at least one visible sheet.");
                                if (_this6.active()) visibleSheets[visibleSheets[0] === _this6 ? 1 : 0].active(!0);
                            }
                            return "very" === hidden ? _this6._idNode.attributes.state = "veryHidden" : hidden ? _this6._idNode.attributes.state = "hidden" : delete _this6._idNode.attributes.state, 
                            _this6;
                        }).handle(arguments);
                    }
                }, {
                    key: "move",
                    value: function(indexOrBeforeSheet) {
                        return this.workbook().moveSheet(this, indexOrBeforeSheet), this;
                    }
                }, {
                    key: "name",
                    value: function() {
                        var _this7 = this;
                        return new ArgHandler("Sheet.name").case(function() {
                            return _this7._idNode.attributes.name;
                        }).case("string", function(name) {
                            return _this7._idNode.attributes.name = name, _this7;
                        }).handle(arguments);
                    }
                }, {
                    key: "range",
                    value: function() {
                        var _this8 = this;
                        return new ArgHandler("Sheet.range").case("string", function(address) {
                            var ref = addressConverter.fromAddress(address);
                            if ("range" !== ref.type) throw new Error("Sheet.range: Invalid address");
                            return _this8.range(ref.startRowNumber, ref.startColumnNumber, ref.endRowNumber, ref.endColumnNumber);
                        }).case([ "*", "*" ], function(startCell, endCell) {
                            return "string" == typeof startCell && (startCell = _this8.cell(startCell)), "string" == typeof endCell && (endCell = _this8.cell(endCell)), 
                            new Range(startCell, endCell);
                        }).case([ "number", "*", "number", "*" ], function(startRowNumber, startColumnNameOrNumber, endRowNumber, endColumnNameOrNumber) {
                            return _this8.range(_this8.cell(startRowNumber, startColumnNameOrNumber), _this8.cell(endRowNumber, endColumnNameOrNumber));
                        }).handle(arguments);
                    }
                }, {
                    key: "autoFilter",
                    value: function(range) {
                        return this._autoFilter = range, this;
                    }
                }, {
                    key: "row",
                    value: function(rowNumber) {
                        if (this._rows[rowNumber]) return this._rows[rowNumber];
                        var row = new Row(this, {
                            name: "row",
                            attributes: {
                                r: rowNumber
                            },
                            children: []
                        });
                        return this._rows[rowNumber] = row;
                    }
                }, {
                    key: "tabColor",
                    value: function() {
                        var _this9 = this;
                        return new ArgHandler("Sheet.tabColor").case(function() {
                            var tabColorNode = xmlq.findChild(_this9._sheetPrNode, "tabColor");
                            if (tabColorNode) {
                                var color = {};
                                return tabColorNode.attributes.hasOwnProperty("rgb") ? color.rgb = tabColorNode.attributes.rgb : tabColorNode.attributes.hasOwnProperty("theme") ? color.theme = tabColorNode.attributes.theme : tabColorNode.attributes.hasOwnProperty("indexed") && (color.rgb = colorIndexes[tabColorNode.attributes.indexed]), 
                                tabColorNode.attributes.hasOwnProperty("tint") && (color.tint = tabColorNode.attributes.tint), 
                                color;
                            }
                        }).case("string", function(rgb) {
                            return _this9.tabColor({
                                rgb: rgb
                            });
                        }).case("integer", function(theme) {
                            return _this9.tabColor({
                                theme: theme
                            });
                        }).case("nil", function() {
                            return xmlq.removeChild(_this9._sheetPrNode, "tabColor"), _this9;
                        }).case("object", function(color) {
                            var tabColorNode = xmlq.appendChildIfNotFound(_this9._sheetPrNode, "tabColor");
                            return xmlq.setAttributes(tabColorNode, {
                                rgb: color.rgb && color.rgb.toUpperCase(),
                                indexed: null,
                                theme: color.theme,
                                tint: color.tint
                            }), _this9;
                        }).handle(arguments);
                    }
                }, {
                    key: "tabSelected",
                    value: function() {
                        var _this10 = this, sheetViewNode = this._getOrCreateSheetViewNode();
                        return new ArgHandler("Sheet.tabSelected").case(function() {
                            return 1 === sheetViewNode.attributes.tabSelected;
                        }).case("boolean", function(selected) {
                            return selected ? sheetViewNode.attributes.tabSelected = 1 : delete sheetViewNode.attributes.tabSelected, 
                            _this10;
                        }).handle(arguments);
                    }
                }, {
                    key: "usedRange",
                    value: function() {
                        for (var minRowNumber = _.findIndex(this._rows), maxRowNumber = this._rows.length - 1, minColumnNumber = 0, maxColumnNumber = 0, i = 0; i < this._rows.length; i++) {
                            var row = this._rows[i];
                            if (row) {
                                var minUsedColumnNumber = row.minUsedColumnNumber(), maxUsedColumnNumber = row.maxUsedColumnNumber();
                                0 < minUsedColumnNumber && (!minColumnNumber || minUsedColumnNumber < minColumnNumber) && (minColumnNumber = minUsedColumnNumber), 
                                0 < maxUsedColumnNumber && (!maxColumnNumber || maxColumnNumber < maxUsedColumnNumber) && (maxColumnNumber = maxUsedColumnNumber);
                            }
                        }
                        if (!(minRowNumber <= 0 || minColumnNumber <= 0 || maxRowNumber <= 0 || maxColumnNumber <= 0)) return this.range(minRowNumber, minColumnNumber, maxRowNumber, maxColumnNumber);
                    }
                }, {
                    key: "workbook",
                    value: function() {
                        return this._workbook;
                    }
                }, {
                    key: "clearCellsUsingSharedFormula",
                    value: function(sharedFormulaId) {
                        this._rows.forEach(function(row) {
                            row && row.clearCellsUsingSharedFormula(sharedFormulaId);
                        });
                    }
                }, {
                    key: "existingColumnStyleId",
                    value: function(columnNumber) {
                        var colNode = this._colNodes[columnNumber];
                        return colNode && colNode.attributes.style;
                    }
                }, {
                    key: "forEachExistingColumnNumber",
                    value: function(callback) {
                        _.forEach(this._colNodes, function(node, columnNumber) {
                            node && callback(columnNumber);
                        });
                    }
                }, {
                    key: "forEachExistingRow",
                    value: function(callback) {
                        return _.forEach(this._rows, function(row, rowNumber) {
                            row && callback(row, rowNumber);
                        }), this;
                    }
                }, {
                    key: "hyperlink",
                    value: function() {
                        var _this11 = this;
                        return new ArgHandler("Sheet.hyperlink").case("string", function(address) {
                            var hyperlinkNode = _this11._hyperlinks[address];
                            if (hyperlinkNode) {
                                var relationship = _this11._relationships.findById(hyperlinkNode.attributes["r:id"]);
                                return relationship && relationship.attributes.Target;
                            }
                        }).case([ "string", "nil" ], function(address) {
                            return delete _this11._hyperlinks[address], _this11;
                        }).case([ "string", "string" ], function(address, hyperlink) {
                            var relationship = _this11._relationships.add("hyperlink", hyperlink, "External");
                            return _this11._hyperlinks[address] = {
                                name: "hyperlink",
                                attributes: {
                                    ref: address,
                                    "r:id": relationship.attributes.Id
                                },
                                children: []
                            }, _this11;
                        }).handle(arguments);
                    }
                }, {
                    key: "incrementMaxSharedFormulaId",
                    value: function() {
                        return ++this._maxSharedFormulaId;
                    }
                }, {
                    key: "merged",
                    value: function() {
                        var _this12 = this;
                        return new ArgHandler("Sheet.merge").case("string", function(address) {
                            return _this12._mergeCells.hasOwnProperty(address);
                        }).case([ "string", "*" ], function(address, merge) {
                            return merge ? _this12._mergeCells[address] = {
                                name: "mergeCell",
                                attributes: {
                                    ref: address
                                },
                                children: []
                            } : delete _this12._mergeCells[address], _this12;
                        }).handle(arguments);
                    }
                }, {
                    key: "dataValidation",
                    value: function() {
                        var _this13 = this;
                        return new ArgHandler("Sheet.dataValidation").case("string", function(address) {
                            return !!_this13._dataValidations[address] && {
                                type: _this13._dataValidations[address].attributes.type,
                                allowBlank: _this13._dataValidations[address].attributes.allowBlank,
                                showInputMessage: _this13._dataValidations[address].attributes.showInputMessage,
                                prompt: _this13._dataValidations[address].attributes.prompt,
                                promptTitle: _this13._dataValidations[address].attributes.promptTitle,
                                showErrorMessage: _this13._dataValidations[address].attributes.showErrorMessage,
                                error: _this13._dataValidations[address].attributes.error,
                                errorTitle: _this13._dataValidations[address].attributes.errorTitle,
                                operator: _this13._dataValidations[address].attributes.operator,
                                formula1: _this13._dataValidations[address].children[0].children[0],
                                formula2: _this13._dataValidations[address].children[1] ? _this13._dataValidations[address].children[1].children[0] : void 0
                            };
                        }).case([ "string", "boolean" ], function(address, obj) {
                            return !!_this13._dataValidations[address] && (!1 === obj ? delete _this13._dataValidations[address] : void 0);
                        }).case([ "string", "*" ], function(address, obj) {
                            return "string" == typeof obj ? _this13._dataValidations[address] = {
                                name: "dataValidation",
                                attributes: {
                                    type: "list",
                                    allowBlank: !1,
                                    showInputMessage: !1,
                                    prompt: "",
                                    promptTitle: "",
                                    showErrorMessage: !1,
                                    error: "",
                                    errorTitle: "",
                                    operator: "",
                                    sqref: address
                                },
                                children: [ {
                                    name: "formula1",
                                    atrributes: {},
                                    children: [ obj ]
                                }, {
                                    name: "formula2",
                                    atrributes: {},
                                    children: [ "" ]
                                } ]
                            } : "object" === (void 0 === obj ? "undefined" : _typeof(obj)) && (_this13._dataValidations[address] = {
                                name: "dataValidation",
                                attributes: {
                                    type: obj.type ? obj.type : "list",
                                    allowBlank: obj.allowBlank,
                                    showInputMessage: obj.showInputMessage,
                                    prompt: obj.prompt,
                                    promptTitle: obj.promptTitle,
                                    showErrorMessage: obj.showErrorMessage,
                                    error: obj.error,
                                    errorTitle: obj.errorTitle,
                                    operator: obj.operator,
                                    sqref: address
                                },
                                children: [ {
                                    name: "formula1",
                                    atrributes: {},
                                    children: [ obj.formula1 ]
                                }, {
                                    name: "formula2",
                                    atrributes: {},
                                    children: [ obj.formula2 ]
                                } ]
                            }), _this13;
                        }).handle(arguments);
                    }
                }, {
                    key: "toXmls",
                    value: function() {
                        var node = _.clone(this._node);
                        return node.children = node.children.slice(), this._colsNode.children = _.filter(this._colNodes, function(colNode, i) {
                            return colNode && i === colNode.attributes.min && 2 < Object.keys(colNode.attributes).length;
                        }), this._colsNode.children.length && xmlq.insertInOrder(node, this._colsNode, nodeOrder), 
                        this._hyperlinksNode.children = _.values(this._hyperlinks), this._hyperlinksNode.children.length && xmlq.insertInOrder(node, this._hyperlinksNode, nodeOrder), 
                        this._mergeCellsNode.children = _.values(this._mergeCells), this._mergeCellsNode.children.length && xmlq.insertInOrder(node, this._mergeCellsNode, nodeOrder), 
                        this._dataValidationsNode.children = _.values(this._dataValidations), this._dataValidationsNode.children.length && xmlq.insertInOrder(node, this._dataValidationsNode, nodeOrder), 
                        this._autoFilter && xmlq.insertInOrder(node, {
                            name: "autoFilter",
                            children: [],
                            attributes: {
                                ref: this._autoFilter.address()
                            }
                        }, nodeOrder), {
                            id: this._idNode,
                            sheet: node,
                            relationships: this._relationships
                        };
                    }
                }, {
                    key: "updateMaxSharedFormulaId",
                    value: function(sharedFormulaId) {
                        sharedFormulaId > this._maxSharedFormulaId && (this._maxSharedFormulaId = sharedFormulaId);
                    }
                }, {
                    key: "_getOrCreateSheetViewNode",
                    value: function() {
                        var sheetViewsNode = xmlq.findChild(this._node, "sheetViews");
                        return sheetViewsNode || (sheetViewsNode = {
                            name: "sheetViews",
                            attributes: {},
                            children: [ {
                                name: "sheetView",
                                attributes: {
                                    workbookViewId: 0
                                },
                                children: []
                            } ]
                        }, xmlq.insertInOrder(this._node, sheetViewsNode, nodeOrder)), xmlq.findChild(sheetViewsNode, "sheetView");
                    }
                }, {
                    key: "_init",
                    value: function(workbook, idNode, node, relationshipsNode) {
                        var _this14 = this;
                        node || (node = {
                            name: "worksheet",
                            attributes: {
                                xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
                                "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
                                "xmlns:mc": "http://schemas.openxmlformats.org/markup-compatibility/2006",
                                "mc:Ignorable": "x14ac",
                                "xmlns:x14ac": "http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"
                            },
                            children: [ {
                                name: "sheetData",
                                attributes: {},
                                children: []
                            } ]
                        }), this._workbook = workbook, this._idNode = idNode, this._node = node, this._maxSharedFormulaId = -1, 
                        this._mergeCells = {}, this._dataValidations = {}, this._hyperlinks = {}, this._autoFilter = null, 
                        this._relationships = new Relationships(relationshipsNode), xmlq.removeChild(this._node, "dimension"), 
                        this._rows = [], this._sheetDataNode = xmlq.findChild(this._node, "sheetData"), 
                        this._sheetDataNode.children.forEach(function(rowNode) {
                            var row = new Row(_this14, rowNode);
                            _this14._rows[row.rowNumber()] = row;
                        }), this._sheetDataNode.children = this._rows, this._columns = [], this._colsNode = xmlq.findChild(this._node, "cols"), 
                        this._colsNode ? xmlq.removeChild(this._node, this._colsNode) : this._colsNode = {
                            name: "cols",
                            attributes: {},
                            children: []
                        }, this._colNodes = [], _.forEach(this._colsNode.children, function(colNode) {
                            for (var min = colNode.attributes.min, max = colNode.attributes.max, i = min; i <= max; i++) _this14._colNodes[i] = colNode;
                        }), this._sheetPrNode = xmlq.findChild(this._node, "sheetPr"), this._sheetPrNode || (this._sheetPrNode = {
                            name: "sheetPr",
                            attributes: {},
                            children: []
                        }, xmlq.insertInOrder(this._node, this._sheetPrNode, nodeOrder)), this._mergeCellsNode = xmlq.findChild(this._node, "mergeCells"), 
                        this._mergeCellsNode ? xmlq.removeChild(this._node, this._mergeCellsNode) : this._mergeCellsNode = {
                            name: "mergeCells",
                            attributes: {},
                            children: []
                        };
                        var mergeCellNodes = this._mergeCellsNode.children;
                        this._mergeCellsNode.children = [], mergeCellNodes.forEach(function(mergeCellNode) {
                            _this14._mergeCells[mergeCellNode.attributes.ref] = mergeCellNode;
                        }), this._dataValidationsNode = xmlq.findChild(this._node, "dataValidations"), this._dataValidationsNode ? xmlq.removeChild(this._node, this._dataValidationsNode) : this._dataValidationsNode = {
                            name: "dataValidations",
                            attributes: {},
                            children: []
                        };
                        var dataValidationNodes = this._dataValidationsNode.children;
                        this._dataValidationsNode.children = [], dataValidationNodes.forEach(function(dataValidationNode) {
                            _this14._dataValidations[dataValidationNode.attributes.sqref] = dataValidationNode;
                        }), this._hyperlinksNode = xmlq.findChild(this._node, "hyperlinks"), this._hyperlinksNode ? xmlq.removeChild(this._node, this._hyperlinksNode) : this._hyperlinksNode = {
                            name: "hyperlinks",
                            attributes: {},
                            children: []
                        };
                        var hyperlinkNodes = this._hyperlinksNode.children;
                        this._hyperlinksNode.children = [], hyperlinkNodes.forEach(function(hyperlinkNode) {
                            _this14._hyperlinks[hyperlinkNode.attributes.ref] = hyperlinkNode;
                        });
                    }
                } ]), Sheet;
            }();
            module.exports = Sheet;
        }, {
            "./ArgHandler": 2,
            "./Cell": 3,
            "./Column": 4,
            "./Range": 9,
            "./Relationships": 10,
            "./Row": 11,
            "./addressConverter": 20,
            "./colorIndexes": 22,
            "./regexify": 25,
            "./xmlq": 26,
            lodash: 191
        } ],
        14: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            function _defineProperty(obj, key, value) {
                return key in obj ? Object.defineProperty(obj, key, {
                    value: value,
                    enumerable: !0,
                    configurable: !0,
                    writable: !0
                }) : obj[key] = value, obj;
            }
            var ArgHandler = require("./ArgHandler"), _ = require("lodash"), xmlq = require("./xmlq"), colorIndexes = require("./colorIndexes"), Style = function() {
                function Style(styleSheet, id, xfNode, fontNode, fillNode, borderNode) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, Style), this._styleSheet = styleSheet, this._id = id, this._xfNode = xfNode, 
                    this._fontNode = fontNode, this._fillNode = fillNode, this._borderNode = borderNode;
                }
                return _createClass(Style, [ {
                    key: "id",
                    value: function() {
                        return this._id;
                    }
                }, {
                    key: "style",
                    value: function() {
                        var _this = this;
                        return new ArgHandler("_Style.style").case("string", function(name) {
                            var getterName = "_get_" + name;
                            if (!_this[getterName]) throw new Error("_Style.style: '" + name + "' is not a valid style");
                            return _this[getterName]();
                        }).case([ "string", "*" ], function(name, value) {
                            var setterName = "_set_" + name;
                            if (!_this[setterName]) throw new Error("_Style.style: '" + name + "' is not a valid style");
                            return _this[setterName](value), _this;
                        }).handle(arguments);
                    }
                }, {
                    key: "_getColor",
                    value: function(node, name) {
                        var child = xmlq.findChild(node, name);
                        if (child && child.attributes) {
                            var color = {};
                            if (child.attributes.hasOwnProperty("rgb") ? color.rgb = child.attributes.rgb : child.attributes.hasOwnProperty("theme") ? color.theme = child.attributes.theme : child.attributes.hasOwnProperty("indexed") && (color.rgb = colorIndexes[child.attributes.indexed]), 
                            child.attributes.hasOwnProperty("tint") && (color.tint = child.attributes.tint), 
                            !_.isEmpty(color)) return color;
                        }
                    }
                }, {
                    key: "_setColor",
                    value: function(node, name, color) {
                        "string" == typeof color ? color = {
                            rgb: color
                        } : "number" == typeof color && (color = {
                            theme: color
                        }), xmlq.setChildAttributes(node, name, {
                            rgb: color && color.rgb && color.rgb.toUpperCase(),
                            indexed: null,
                            theme: color && color.theme,
                            tint: color && color.tint
                        }), xmlq.removeChildIfEmpty(node, "color");
                    }
                }, {
                    key: "_get_bold",
                    value: function() {
                        return xmlq.hasChild(this._fontNode, "b");
                    }
                }, {
                    key: "_set_bold",
                    value: function(bold) {
                        bold ? xmlq.appendChildIfNotFound(this._fontNode, "b") : xmlq.removeChild(this._fontNode, "b");
                    }
                }, {
                    key: "_get_italic",
                    value: function() {
                        return xmlq.hasChild(this._fontNode, "i");
                    }
                }, {
                    key: "_set_italic",
                    value: function(italic) {
                        italic ? xmlq.appendChildIfNotFound(this._fontNode, "i") : xmlq.removeChild(this._fontNode, "i");
                    }
                }, {
                    key: "_get_underline",
                    value: function() {
                        var uNode = xmlq.findChild(this._fontNode, "u");
                        return !!uNode && (uNode.attributes.val || !0);
                    }
                }, {
                    key: "_set_underline",
                    value: function(underline) {
                        if (underline) {
                            var uNode = xmlq.appendChildIfNotFound(this._fontNode, "u"), val = "string" == typeof underline ? underline : null;
                            xmlq.setAttributes(uNode, {
                                val: val
                            });
                        } else xmlq.removeChild(this._fontNode, "u");
                    }
                }, {
                    key: "_get_strikethrough",
                    value: function() {
                        return xmlq.hasChild(this._fontNode, "strike");
                    }
                }, {
                    key: "_set_strikethrough",
                    value: function(strikethrough) {
                        strikethrough ? xmlq.appendChildIfNotFound(this._fontNode, "strike") : xmlq.removeChild(this._fontNode, "strike");
                    }
                }, {
                    key: "_getFontVerticalAlignment",
                    value: function() {
                        return xmlq.getChildAttribute(this._fontNode, "vertAlign", "val");
                    }
                }, {
                    key: "_setFontVerticalAlignment",
                    value: function(alignment) {
                        xmlq.setChildAttributes(this._fontNode, "vertAlign", {
                            val: alignment
                        }), xmlq.removeChildIfEmpty(this._fontNode, "vertAlign");
                    }
                }, {
                    key: "_get_subscript",
                    value: function() {
                        return "subscript" === this._getFontVerticalAlignment();
                    }
                }, {
                    key: "_set_subscript",
                    value: function(subscript) {
                        this._setFontVerticalAlignment(subscript ? "subscript" : null);
                    }
                }, {
                    key: "_get_superscript",
                    value: function() {
                        return "superscript" === this._getFontVerticalAlignment();
                    }
                }, {
                    key: "_set_superscript",
                    value: function(superscript) {
                        this._setFontVerticalAlignment(superscript ? "superscript" : null);
                    }
                }, {
                    key: "_get_fontSize",
                    value: function() {
                        return xmlq.getChildAttribute(this._fontNode, "sz", "val");
                    }
                }, {
                    key: "_set_fontSize",
                    value: function(size) {
                        xmlq.setChildAttributes(this._fontNode, "sz", {
                            val: size
                        }), xmlq.removeChildIfEmpty(this._fontNode, "sz");
                    }
                }, {
                    key: "_get_fontFamily",
                    value: function() {
                        return xmlq.getChildAttribute(this._fontNode, "name", "val");
                    }
                }, {
                    key: "_set_fontFamily",
                    value: function(family) {
                        xmlq.setChildAttributes(this._fontNode, "name", {
                            val: family
                        }), xmlq.removeChildIfEmpty(this._fontNode, "name");
                    }
                }, {
                    key: "_get_fontColor",
                    value: function() {
                        return this._getColor(this._fontNode, "color");
                    }
                }, {
                    key: "_set_fontColor",
                    value: function(color) {
                        this._setColor(this._fontNode, "color", color);
                    }
                }, {
                    key: "_get_horizontalAlignment",
                    value: function() {
                        return xmlq.getChildAttribute(this._xfNode, "alignment", "horizontal");
                    }
                }, {
                    key: "_set_horizontalAlignment",
                    value: function(alignment) {
                        xmlq.setChildAttributes(this._xfNode, "alignment", {
                            horizontal: alignment
                        }), xmlq.removeChildIfEmpty(this._xfNode, "alignment");
                    }
                }, {
                    key: "_get_justifyLastLine",
                    value: function() {
                        return 1 === xmlq.getChildAttribute(this._xfNode, "alignment", "justifyLastLine");
                    }
                }, {
                    key: "_set_justifyLastLine",
                    value: function(justifyLastLine) {
                        xmlq.setChildAttributes(this._xfNode, "alignment", {
                            justifyLastLine: justifyLastLine ? 1 : null
                        }), xmlq.removeChildIfEmpty(this._xfNode, "alignment");
                    }
                }, {
                    key: "_get_indent",
                    value: function() {
                        return xmlq.getChildAttribute(this._xfNode, "alignment", "indent");
                    }
                }, {
                    key: "_set_indent",
                    value: function(indent) {
                        xmlq.setChildAttributes(this._xfNode, "alignment", {
                            indent: indent
                        }), xmlq.removeChildIfEmpty(this._xfNode, "alignment");
                    }
                }, {
                    key: "_get_verticalAlignment",
                    value: function() {
                        return xmlq.getChildAttribute(this._xfNode, "alignment", "vertical");
                    }
                }, {
                    key: "_set_verticalAlignment",
                    value: function(alignment) {
                        xmlq.setChildAttributes(this._xfNode, "alignment", {
                            vertical: alignment
                        }), xmlq.removeChildIfEmpty(this._xfNode, "alignment");
                    }
                }, {
                    key: "_get_wrapText",
                    value: function() {
                        return 1 === xmlq.getChildAttribute(this._xfNode, "alignment", "wrapText");
                    }
                }, {
                    key: "_set_wrapText",
                    value: function(wrapText) {
                        xmlq.setChildAttributes(this._xfNode, "alignment", {
                            wrapText: wrapText ? 1 : null
                        }), xmlq.removeChildIfEmpty(this._xfNode, "alignment");
                    }
                }, {
                    key: "_get_shrinkToFit",
                    value: function() {
                        return 1 === xmlq.getChildAttribute(this._xfNode, "alignment", "shrinkToFit");
                    }
                }, {
                    key: "_set_shrinkToFit",
                    value: function(shrinkToFit) {
                        xmlq.setChildAttributes(this._xfNode, "alignment", {
                            shrinkToFit: shrinkToFit ? 1 : null
                        }), xmlq.removeChildIfEmpty(this._xfNode, "alignment");
                    }
                }, {
                    key: "_get_textDirection",
                    value: function() {
                        var readingOrder = xmlq.getChildAttribute(this._xfNode, "alignment", "readingOrder");
                        return 1 === readingOrder ? "left-to-right" : 2 === readingOrder ? "right-to-left" : readingOrder;
                    }
                }, {
                    key: "_set_textDirection",
                    value: function(textDirection) {
                        var readingOrder = void 0;
                        "left-to-right" === textDirection ? readingOrder = 1 : "right-to-left" === textDirection && (readingOrder = 2), 
                        xmlq.setChildAttributes(this._xfNode, "alignment", {
                            readingOrder: readingOrder
                        }), xmlq.removeChildIfEmpty(this._xfNode, "alignment");
                    }
                }, {
                    key: "_getTextRotation",
                    value: function() {
                        return xmlq.getChildAttribute(this._xfNode, "alignment", "textRotation");
                    }
                }, {
                    key: "_setTextRotation",
                    value: function(textRotation) {
                        xmlq.setChildAttributes(this._xfNode, "alignment", {
                            textRotation: textRotation
                        }), xmlq.removeChildIfEmpty(this._xfNode, "alignment");
                    }
                }, {
                    key: "_get_textRotation",
                    value: function() {
                        var textRotation = this._getTextRotation();
                        return 90 < textRotation && (textRotation = 90 - textRotation), textRotation;
                    }
                }, {
                    key: "_set_textRotation",
                    value: function(textRotation) {
                        textRotation < 0 && (textRotation = 90 - textRotation), this._setTextRotation(textRotation);
                    }
                }, {
                    key: "_get_angleTextCounterclockwise",
                    value: function() {
                        return 45 === this._getTextRotation();
                    }
                }, {
                    key: "_set_angleTextCounterclockwise",
                    value: function(value) {
                        this._setTextRotation(value ? 45 : null);
                    }
                }, {
                    key: "_get_angleTextClockwise",
                    value: function() {
                        return 135 === this._getTextRotation();
                    }
                }, {
                    key: "_set_angleTextClockwise",
                    value: function(value) {
                        this._setTextRotation(value ? 135 : null);
                    }
                }, {
                    key: "_get_rotateTextUp",
                    value: function() {
                        return 90 === this._getTextRotation();
                    }
                }, {
                    key: "_set_rotateTextUp",
                    value: function(value) {
                        this._setTextRotation(value ? 90 : null);
                    }
                }, {
                    key: "_get_rotateTextDown",
                    value: function() {
                        return 180 === this._getTextRotation();
                    }
                }, {
                    key: "_set_rotateTextDown",
                    value: function(value) {
                        this._setTextRotation(value ? 180 : null);
                    }
                }, {
                    key: "_get_verticalText",
                    value: function() {
                        return 255 === this._getTextRotation();
                    }
                }, {
                    key: "_set_verticalText",
                    value: function(value) {
                        this._setTextRotation(value ? 255 : null);
                    }
                }, {
                    key: "_get_fill",
                    value: function() {
                        var _this2 = this, patternFillNode = xmlq.findChild(this._fillNode, "patternFill"), gradientFillNode = xmlq.findChild(this._fillNode, "gradientFill"), patternType = patternFillNode && patternFillNode.attributes.patternType;
                        if ("solid" === patternType) return {
                            type: "solid",
                            color: this._getColor(patternFillNode, "fgColor")
                        };
                        if (patternType) return {
                            type: "pattern",
                            pattern: patternType,
                            foreground: this._getColor(patternFillNode, "fgColor"),
                            background: this._getColor(patternFillNode, "bgColor")
                        };
                        if (gradientFillNode) {
                            var gradientType = gradientFillNode.attributes.type || "linear", fill = {
                                type: "gradient",
                                gradientType: gradientType,
                                stops: _.map(gradientFillNode.children, function(stop) {
                                    return {
                                        position: stop.attributes.position,
                                        color: _this2._getColor(stop, "color")
                                    };
                                })
                            };
                            return "linear" === gradientType ? fill.angle = gradientFillNode.attributes.degree : (fill.left = gradientFillNode.attributes.left, 
                            fill.right = gradientFillNode.attributes.right, fill.top = gradientFillNode.attributes.top, 
                            fill.bottom = gradientFillNode.attributes.bottom), fill;
                        }
                    }
                }, {
                    key: "_set_fill",
                    value: function(fill) {
                        var _this3 = this;
                        if (this._fillNode.children = [], !_.isNil(fill)) {
                            if ("pattern" === fill.type) {
                                var _patternFill = {
                                    name: "patternFill",
                                    attributes: {
                                        patternType: fill.pattern
                                    },
                                    children: []
                                };
                                return this._fillNode.children.push(_patternFill), this._setColor(_patternFill, "fgColor", fill.foreground), 
                                void this._setColor(_patternFill, "bgColor", fill.background);
                            }
                            if ("gradient" === fill.type) {
                                var gradientFill = {
                                    name: "gradientFill",
                                    attributes: {},
                                    children: []
                                };
                                return this._fillNode.children.push(gradientFill), xmlq.setAttributes(gradientFill, {
                                    type: "path" === fill.gradientType ? "path" : void 0,
                                    left: fill.left,
                                    right: fill.right,
                                    top: fill.top,
                                    bottom: fill.bottom,
                                    degree: fill.angle
                                }), void _.forEach(fill.stops, function(fillStop, i) {
                                    var stop = {
                                        name: "stop",
                                        attributes: {
                                            position: fillStop.position
                                        },
                                        children: []
                                    };
                                    gradientFill.children.push(stop), _this3._setColor(stop, "color", fillStop.color);
                                });
                            }
                            _.isObject(fill) ? (fill.hasOwnProperty("rgb") || fill.hasOwnProperty("theme")) && (fill = {
                                color: fill
                            }) : fill = {
                                type: "solid",
                                color: fill
                            };
                            var patternFill = {
                                name: "patternFill",
                                attributes: {
                                    patternType: "solid"
                                }
                            };
                            this._fillNode.children.push(patternFill), this._setColor(patternFill, "fgColor", fill.color);
                        }
                    }
                }, {
                    key: "_getBorder",
                    value: function() {
                        var _this4 = this, result = {};
                        return [ "left", "right", "top", "bottom", "diagonal" ].forEach(function(side) {
                            var sideNode = xmlq.findChild(_this4._borderNode, side), sideResult = {}, style = xmlq.getChildAttribute(_this4._borderNode, side, "style");
                            style && (sideResult.style = style);
                            var color = _this4._getColor(sideNode, "color");
                            if (color && (sideResult.color = color), "diagonal" === side) {
                                var up = _this4._borderNode.attributes.diagonalUp, down = _this4._borderNode.attributes.diagonalDown, direction = void 0;
                                up && down ? direction = "both" : up ? direction = "up" : down && (direction = "down"), 
                                direction && (sideResult.direction = direction);
                            }
                            _.isEmpty(sideResult) || (result[side] = sideResult);
                        }), result;
                    }
                }, {
                    key: "_setBorder",
                    value: function(settings) {
                        var _this5 = this;
                        _.forOwn(settings, function(setting, side) {
                            if ("boolean" == typeof setting ? setting = {
                                style: setting ? "thin" : null
                            } : "string" == typeof setting ? setting = {
                                style: setting
                            } : null == setting && (setting = {
                                style: null,
                                color: null,
                                direction: null
                            }), setting.hasOwnProperty("style") && xmlq.setChildAttributes(_this5._borderNode, side, {
                                style: setting.style
                            }), setting.hasOwnProperty("color")) {
                                var sideNode = xmlq.findChild(_this5._borderNode, side);
                                _this5._setColor(sideNode, "color", setting.color);
                            }
                            "diagonal" === side && xmlq.setAttributes(_this5._borderNode, {
                                diagonalUp: "up" === setting.direction || "both" === setting.direction ? 1 : null,
                                diagonalDown: "down" === setting.direction || "both" === setting.direction ? 1 : null
                            });
                        });
                    }
                }, {
                    key: "_get_border",
                    value: function() {
                        return this._getBorder();
                    }
                }, {
                    key: "_set_border",
                    value: function(settings) {
                        !_.isObject(settings) || settings.hasOwnProperty("style") || settings.hasOwnProperty("color") ? this._setBorder({
                            left: settings,
                            right: settings,
                            top: settings,
                            bottom: settings
                        }) : (settings = _.defaults(settings, {
                            left: null,
                            right: null,
                            top: null,
                            bottom: null,
                            diagonal: null
                        }), this._setBorder(settings));
                    }
                }, {
                    key: "_get_borderColor",
                    value: function() {
                        return _.mapValues(this._getBorder(), function(value) {
                            return value.color;
                        });
                    }
                }, {
                    key: "_set_borderColor",
                    value: function(color) {
                        _.isObject(color) ? this._setBorder(_.mapValues(color, function(color) {
                            return {
                                color: color
                            };
                        })) : this._setBorder({
                            left: {
                                color: color
                            },
                            right: {
                                color: color
                            },
                            top: {
                                color: color
                            },
                            bottom: {
                                color: color
                            },
                            diagonal: {
                                color: color
                            }
                        });
                    }
                }, {
                    key: "_get_borderStyle",
                    value: function() {
                        return _.mapValues(this._getBorder(), function(value) {
                            return value.style;
                        });
                    }
                }, {
                    key: "_set_borderStyle",
                    value: function(style) {
                        _.isObject(style) ? this._setBorder(_.mapValues(style, function(style) {
                            return {
                                style: style
                            };
                        })) : this._setBorder({
                            left: {
                                style: style
                            },
                            right: {
                                style: style
                            },
                            top: {
                                style: style
                            },
                            bottom: {
                                style: style
                            }
                        });
                    }
                }, {
                    key: "_get_diagonalBorderDirection",
                    value: function() {
                        var border = this._getBorder().diagonal;
                        return border && border.direction;
                    }
                }, {
                    key: "_set_diagonalBorderDirection",
                    value: function(direction) {
                        this._setBorder({
                            diagonal: {
                                direction: direction
                            }
                        });
                    }
                }, {
                    key: "_get_numberFormat",
                    value: function() {
                        var numFmtId = this._xfNode.attributes.numFmtId || 0;
                        return this._styleSheet.getNumberFormatCode(numFmtId);
                    }
                }, {
                    key: "_set_numberFormat",
                    value: function(formatCode) {
                        this._xfNode.attributes.numFmtId = this._styleSheet.getNumberFormatId(formatCode);
                    }
                } ]), Style;
            }();
            [ "left", "right", "top", "bottom", "diagonal" ].forEach(function(side) {
                Style.prototype["_get_" + side + "Border"] = function() {
                    return this._getBorder()[side];
                }, Style.prototype["_set_" + side + "Border"] = function(settings) {
                    this._setBorder(_defineProperty({}, side, settings));
                }, Style.prototype["_get_" + side + "BorderColor"] = function() {
                    var border = this._getBorder()[side];
                    return border && border.color;
                }, Style.prototype["_set_" + side + "BorderColor"] = function(color) {
                    this._setBorder(_defineProperty({}, side, {
                        color: color
                    }));
                }, Style.prototype["_get_" + side + "BorderStyle"] = function() {
                    var border = this._getBorder()[side];
                    return border && border.style;
                }, Style.prototype["_set_" + side + "BorderStyle"] = function(style) {
                    this._setBorder(_defineProperty({}, side, {
                        style: style
                    }));
                };
            }), Style.name || (Style.name = "Style"), module.exports = Style;
        }, {
            "./ArgHandler": 2,
            "./colorIndexes": 22,
            "./xmlq": 26,
            lodash: 191
        } ],
        15: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var _ = require("lodash"), xmlq = require("./xmlq"), Style = require("./Style"), STANDARD_CODES = {
                0: "General",
                1: "0",
                2: "0.00",
                3: "#,##0",
                4: "#,##0.00",
                9: "0%",
                10: "0.00%",
                11: "0.00E+00",
                12: "# ?/?",
                13: "# ??/??",
                14: "mm-dd-yy",
                15: "d-mmm-yy",
                16: "d-mmm",
                17: "mmm-yy",
                18: "h:mm AM/PM",
                19: "h:mm:ss AM/PM",
                20: "h:mm",
                21: "h:mm:ss",
                22: "m/d/yy h:mm",
                37: "#,##0 ;(#,##0)",
                38: "#,##0 ;[Red](#,##0)",
                39: "#,##0.00;(#,##0.00)",
                40: "#,##0.00;[Red](#,##0.00)",
                45: "mm:ss",
                46: "[h]:mm:ss",
                47: "mmss.0",
                48: "##0.0E+0",
                49: "@"
            }, StyleSheet = function() {
                function StyleSheet(node) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, StyleSheet), this._init(node), this._cacheNumberFormats();
                }
                return _createClass(StyleSheet, [ {
                    key: "createStyle",
                    value: function(sourceId) {
                        var fontNode = void 0, fillNode = void 0, borderNode = void 0, xfNode = void 0;
                        if (0 <= sourceId) {
                            var sourceXfNode = this._cellXfsNode.children[sourceId];
                            if (xfNode = _.cloneDeep(sourceXfNode), sourceXfNode.attributes.applyFont) {
                                var fontId = sourceXfNode.attributes.fontId;
                                fontNode = _.cloneDeep(this._fontsNode.children[fontId]);
                            }
                            if (sourceXfNode.attributes.applyFill) {
                                var fillId = sourceXfNode.attributes.fillId;
                                fillNode = _.cloneDeep(this._fillsNode.children[fillId]);
                            }
                            if (sourceXfNode.attributes.applyBorder) {
                                var borderId = sourceXfNode.attributes.borderId;
                                borderNode = _.cloneDeep(this._bordersNode.children[borderId]);
                            }
                        }
                        return fontNode || (fontNode = {
                            name: "font",
                            attributes: {},
                            children: []
                        }), this._fontsNode.children.push(fontNode), fillNode || (fillNode = {
                            name: "fill",
                            attributes: {},
                            children: []
                        }), this._fillsNode.children.push(fillNode), borderNode || (borderNode = {
                            name: "border",
                            attributes: {},
                            children: []
                        }), borderNode.children = [ xmlq.findChild(borderNode, "left") || {
                            name: "left",
                            attributes: {},
                            children: []
                        }, xmlq.findChild(borderNode, "right") || {
                            name: "right",
                            attributes: {},
                            children: []
                        }, xmlq.findChild(borderNode, "top") || {
                            name: "top",
                            attributes: {},
                            children: []
                        }, xmlq.findChild(borderNode, "bottom") || {
                            name: "bottom",
                            attributes: {},
                            children: []
                        }, xmlq.findChild(borderNode, "diagonal") || {
                            name: "diagonal",
                            attributes: {},
                            children: []
                        } ], this._bordersNode.children.push(borderNode), xfNode || (xfNode = {
                            name: "xf",
                            attributes: {},
                            children: []
                        }), _.assign(xfNode.attributes, {
                            fontId: this._fontsNode.children.length - 1,
                            fillId: this._fillsNode.children.length - 1,
                            borderId: this._bordersNode.children.length - 1,
                            applyFont: 1,
                            applyFill: 1,
                            applyBorder: 1
                        }), this._cellXfsNode.children.push(xfNode), new Style(this, this._cellXfsNode.children.length - 1, xfNode, fontNode, fillNode, borderNode);
                    }
                }, {
                    key: "getNumberFormatCode",
                    value: function(id) {
                        return this._numberFormatCodesById[id];
                    }
                }, {
                    key: "getNumberFormatId",
                    value: function(code) {
                        var id = this._numberFormatIdsByCode[code];
                        return void 0 === id && (id = this._nextNumFormatId++, this._numberFormatCodesById[id] = code, 
                        this._numberFormatIdsByCode[code] = id, this._numFmtsNode.children.push({
                            name: "numFmt",
                            attributes: {
                                numFmtId: id,
                                formatCode: code
                            }
                        })), id;
                    }
                }, {
                    key: "toXml",
                    value: function() {
                        return this._node;
                    }
                }, {
                    key: "_cacheNumberFormats",
                    value: function() {
                        var _this = this;
                        for (var id in this._numberFormatCodesById = {}, this._numberFormatIdsByCode = {}, 
                        STANDARD_CODES) if (STANDARD_CODES.hasOwnProperty(id)) {
                            var code = STANDARD_CODES[id];
                            this._numberFormatCodesById[id] = code, this._numberFormatIdsByCode[code] = parseInt(id);
                        }
                        this._nextNumFormatId = 164, this._numFmtsNode.children.forEach(function(node) {
                            var id = node.attributes.numFmtId, code = node.attributes.formatCode;
                            _this._numberFormatCodesById[id] = code, (_this._numberFormatIdsByCode[code] = id) >= _this._nextNumFormatId && (_this._nextNumFormatId = id + 1);
                        });
                    }
                }, {
                    key: "_init",
                    value: function(node) {
                        this._node = node, this._numFmtsNode = xmlq.findChild(this._node, "numFmts"), this._fontsNode = xmlq.findChild(this._node, "fonts"), 
                        this._fillsNode = xmlq.findChild(this._node, "fills"), this._bordersNode = xmlq.findChild(this._node, "borders"), 
                        this._cellXfsNode = xmlq.findChild(this._node, "cellXfs"), this._numFmtsNode || (this._numFmtsNode = {
                            name: "numFmts",
                            attributes: {},
                            children: []
                        }, xmlq.insertBefore(this._node, this._numFmtsNode, this._fontsNode)), delete this._numFmtsNode.attributes.count, 
                        delete this._fontsNode.attributes.count, delete this._fillsNode.attributes.count, 
                        delete this._bordersNode.attributes.count, delete this._cellXfsNode.attributes.count;
                    }
                } ]), StyleSheet;
            }();
            module.exports = StyleSheet;
        }, {
            "./Style": 14,
            "./xmlq": 26,
            lodash: 191
        } ],
        16: [ function(require, module, exports) {
            (function(process, Buffer) {
                "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 || !1, descriptor.configurable = !0, 
                            "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                        }
                    }
                    return function(Constructor, protoProps, staticProps) {
                        return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                        Constructor;
                    };
                }();
                var _ = require("lodash"), fs = require("fs"), JSZip = require("jszip"), externals = require("./externals"), regexify = require("./regexify"), blank = require("./blank")(), xmlq = require("./xmlq"), Sheet = require("./Sheet"), ContentTypes = require("./ContentTypes"), AppProperties = require("./AppProperties"), CoreProperties = require("./CoreProperties"), Relationships = require("./Relationships"), SharedStrings = require("./SharedStrings"), StyleSheet = require("./StyleSheet"), Encryptor = require("./Encryptor"), XmlParser = require("./XmlParser"), XmlBuilder = require("./XmlBuilder"), ArgHandler = require("./ArgHandler"), addressConverter = require("./addressConverter"), zipFileOpts = {
                    date: new Date(0),
                    createFolders: !1
                }, xmlParser = new XmlParser(), xmlBuilder = new XmlBuilder(), encryptor = "function" == typeof Encryptor && new Encryptor(), badSheetNameChars = [ "\\", "/", "*", "[", "]", ":", "?" ], nodeOrder = [ "fileVersion", "fileSharing", "workbookPr", "workbookProtection", "bookViews", "sheets", "functionGroups", "externalReferences", "definedNames", "calcPr", "oleSize", "customWorkbookViews", "pivotCaches", "smartTagPr", "smartTagTypes", "webPublishing", "fileRecoveryPr", "webPublishObjects", "extLst" ], Workbook = function() {
                    function Workbook() {
                        !function(instance, Constructor) {
                            if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                        }(this, Workbook);
                    }
                    return _createClass(Workbook, [ {
                        key: "activeSheet",
                        value: function() {
                            var _this = this;
                            return new ArgHandler("Workbook.activeSheet").case(function() {
                                return _this._activeSheet;
                            }).case("*", function(sheet) {
                                if (sheet instanceof Sheet || (sheet = _this.sheet(sheet)), sheet.hidden()) throw new Error("You may not activate a hidden sheet.");
                                return _.forEach(_this._sheets, function(current) {
                                    current.tabSelected(current === sheet);
                                }), _this._activeSheet = sheet, _this;
                            }).handle(arguments);
                        }
                    }, {
                        key: "addSheet",
                        value: function(name, indexOrBeforeSheet) {
                            if (!name || "string" != typeof name) throw new Error("Invalid sheet name.");
                            if (_.some(badSheetNameChars, function(char) {
                                return 0 <= name.indexOf(char);
                            })) throw new Error("Sheet name may not contain any of the following characters: " + badSheetNameChars.join(" "));
                            if (31 < name.length) throw new Error("Sheet name may not be greater than 31 characters.");
                            if (this.sheet(name)) throw new Error('Sheet with name "' + name + '" already exists.');
                            var index = void 0;
                            if (_.isNil(indexOrBeforeSheet)) index = this._sheets.length; else if (_.isInteger(indexOrBeforeSheet)) index = indexOrBeforeSheet; else {
                                if (!(indexOrBeforeSheet instanceof Sheet || (indexOrBeforeSheet = this.sheet(indexOrBeforeSheet)))) throw new Error("Invalid before sheet reference.");
                                index = this._sheets.indexOf(indexOrBeforeSheet);
                            }
                            var relationship = this._relationships.add("worksheet"), sheetIdNode = {
                                name: "sheet",
                                attributes: {
                                    name: name,
                                    sheetId: ++this._maxSheetId,
                                    "r:id": relationship.attributes.Id
                                },
                                children: []
                            }, sheet = new Sheet(this, sheetIdNode);
                            return this._sheets.splice(index, 0, sheet), sheet;
                        }
                    }, {
                        key: "definedName",
                        value: function() {
                            var _this2 = this;
                            return new ArgHandler("Workbook.definedName").case("string", function(name) {
                                return _this2.scopedDefinedName(void 0, name);
                            }).case([ "string", "*" ], function(name, refersTo) {
                                return _this2.scopedDefinedName(void 0, name, refersTo), _this2;
                            }).handle(arguments);
                        }
                    }, {
                        key: "deleteSheet",
                        value: function(sheet) {
                            if (!(sheet instanceof Sheet || (sheet = this.sheet(sheet)))) throw new Error("Invalid move sheet reference.");
                            var visibleSheets = _.filter(this._sheets, function(sheet) {
                                return !sheet.hidden();
                            });
                            if (1 === visibleSheets.length && visibleSheets[0] === sheet) throw new Error("This sheet may not be deleted as a workbook must contain at least one visible sheet.");
                            var index = this._sheets.indexOf(sheet);
                            return this._sheets.splice(index, 1), sheet === this.activeSheet() && (index >= this._sheets.length && index--, 
                            this.activeSheet(index)), this;
                        }
                    }, {
                        key: "find",
                        value: function(pattern, replacement) {
                            pattern = regexify(pattern);
                            var matches = [];
                            return this._sheets.forEach(function(sheet) {
                                matches = matches.concat(sheet.find(pattern, replacement));
                            }), matches;
                        }
                    }, {
                        key: "moveSheet",
                        value: function(sheet, indexOrBeforeSheet) {
                            if (!(sheet instanceof Sheet || (sheet = this.sheet(sheet)))) throw new Error("Invalid move sheet reference.");
                            var from = this._sheets.indexOf(sheet), to = void 0;
                            if (_.isNil(indexOrBeforeSheet)) to = this._sheets.length - 1; else if (_.isInteger(indexOrBeforeSheet)) to = indexOrBeforeSheet; else {
                                if (!(indexOrBeforeSheet instanceof Sheet || (indexOrBeforeSheet = this.sheet(indexOrBeforeSheet)))) throw new Error("Invalid before sheet reference.");
                                to = this._sheets.indexOf(indexOrBeforeSheet);
                            }
                            return this._sheets.splice(to, 0, this._sheets.splice(from, 1)[0]), this;
                        }
                    }, {
                        key: "outputAsync",
                        value: function(opts) {
                            var _this3 = this;
                            "string" == typeof (opts = opts || {}) && (opts = {
                                type: opts
                            }), this._setSheetRefs();
                            var definedNamesNode = xmlq.findChild(this._node, "definedNames");
                            return this._sheets.forEach(function(sheet, i) {
                                sheet._autoFilter && (definedNamesNode || (definedNamesNode = {
                                    name: "definedNames",
                                    attributes: {},
                                    children: []
                                }, xmlq.insertInOrder(_this3._node, definedNamesNode, nodeOrder)), xmlq.appendChild(definedNamesNode, {
                                    name: "definedName",
                                    attributes: {
                                        name: "_xlnm._FilterDatabase",
                                        localSheetId: i,
                                        hidden: "1"
                                    },
                                    children: [ sheet._autoFilter.address({
                                        includeSheetName: !0,
                                        anchored: !0
                                    }) ]
                                }));
                            }), this._sheetsNode.children = [], this._sheets.forEach(function(sheet, i) {
                                var sheetPath = "xl/worksheets/sheet" + (i + 1) + ".xml", sheetRelsPath = "xl/worksheets/_rels/sheet" + (i + 1) + ".xml.rels", sheetXmls = sheet.toXmls();
                                _this3._relationships.findById(sheetXmls.id.attributes["r:id"]).attributes.Target = "worksheets/sheet" + (i + 1) + ".xml", 
                                _this3._sheetsNode.children.push(sheetXmls.id), _this3._zip.file(sheetPath, xmlBuilder.build(sheetXmls.sheet), zipFileOpts);
                                var relationshipsXml = xmlBuilder.build(sheetXmls.relationships);
                                relationshipsXml ? _this3._zip.file(sheetRelsPath, relationshipsXml, zipFileOpts) : _this3._zip.remove(sheetRelsPath);
                            }), this._zip.file("[Content_Types].xml", xmlBuilder.build(this._contentTypes), zipFileOpts), 
                            this._zip.file("docProps/app.xml", xmlBuilder.build(this._appProperties), zipFileOpts), 
                            this._zip.file("docProps/core.xml", xmlBuilder.build(this._coreProperties), zipFileOpts), 
                            this._zip.file("xl/_rels/workbook.xml.rels", xmlBuilder.build(this._relationships), zipFileOpts), 
                            this._zip.file("xl/sharedStrings.xml", xmlBuilder.build(this._sharedStrings), zipFileOpts), 
                            this._zip.file("xl/styles.xml", xmlBuilder.build(this._styleSheet), zipFileOpts), 
                            this._zip.file("xl/workbook.xml", xmlBuilder.build(this._node), zipFileOpts), this._zip.generateAsync({
                                type: "nodebuffer",
                                compression: "DEFLATE"
                            }).then(function(output) {
                                return opts.password && (output = encryptor.encrypt(output, opts.password)), _this3._convertBufferToOutput(output, opts.type);
                            });
                        }
                    }, {
                        key: "sheet",
                        value: function(sheetNameOrIndex) {
                            return _.isInteger(sheetNameOrIndex) ? this._sheets[sheetNameOrIndex] : _.find(this._sheets, function(sheet) {
                                return sheet.name() === sheetNameOrIndex;
                            });
                        }
                    }, {
                        key: "sheets",
                        value: function() {
                            return this._sheets.slice();
                        }
                    }, {
                        key: "property",
                        value: function() {
                            var _this4 = this;
                            return new ArgHandler("Workbook.property").case("string", function(name) {
                                return _this4._coreProperties.get(name);
                            }).case("array", function(names) {
                                var values = {};
                                return names.forEach(function(name) {
                                    values[name] = _this4._coreProperties.get(name);
                                }), values;
                            }).case([ "string", "*" ], function(name, value) {
                                return _this4._coreProperties.set(name, value), _this4;
                            }).case("object", function(nameValues) {
                                for (var name in nameValues) if (nameValues.hasOwnProperty(name)) {
                                    var value = nameValues[name];
                                    _this4._coreProperties.set(name, value);
                                }
                                return _this4;
                            }).handle(arguments);
                        }
                    }, {
                        key: "properties",
                        value: function() {
                            return this._coreProperties;
                        }
                    }, {
                        key: "toFileAsync",
                        value: function(path, opts) {
                            if (process.browser) throw new Error("Workbook.toFileAsync is not supported in the browser.");
                            return this.outputAsync(opts).then(function(data) {
                                return new externals.Promise(function(resolve, reject) {
                                    fs.writeFile(path, data, function(err) {
                                        if (err) return reject(err);
                                        resolve();
                                    });
                                });
                            });
                        }
                    }, {
                        key: "scopedDefinedName",
                        value: function(sheetScope, name, refersTo) {
                            var _this5 = this, definedNamesNode = xmlq.findChild(this._node, "definedNames"), definedNameNode = definedNamesNode && _.find(definedNamesNode.children, function(node) {
                                return node.attributes.name === name && node.localSheet === sheetScope;
                            });
                            return new ArgHandler("Workbook.scopedDefinedName").case([ "*", "string" ], function() {
                                var refersTo = definedNameNode && definedNameNode.children[0];
                                if (refersTo) {
                                    var ref = addressConverter.fromAddress(refersTo);
                                    if (!ref) return refersTo;
                                    var sheet = _this5.sheet(ref.sheetName);
                                    return "cell" === ref.type ? sheet.cell(ref.rowNumber, ref.columnNumber) : "range" === ref.type ? sheet.range(ref.startRowNumber, ref.startColumnNumber, ref.endRowNumber, ref.endColumnNumber) : "row" === ref.type ? sheet.row(ref.rowNumber) : "column" === ref.type ? sheet.column(ref.columnNumber) : refersTo;
                                }
                            }).case([ "*", "string", "nil" ], function() {
                                return definedNameNode && xmlq.removeChild(definedNamesNode, definedNameNode), definedNamesNode && !definedNamesNode.children.length && xmlq.removeChild(_this5._node, definedNamesNode), 
                                _this5;
                            }).case([ "*", "string", "*" ], function() {
                                return "string" != typeof refersTo && (refersTo = refersTo.address({
                                    includeSheetName: !0,
                                    anchored: !0
                                })), definedNamesNode || (definedNamesNode = {
                                    name: "definedNames",
                                    attributes: {},
                                    children: []
                                }, xmlq.insertInOrder(_this5._node, definedNamesNode, nodeOrder)), definedNameNode || (definedNameNode = {
                                    name: "definedName",
                                    attributes: {
                                        name: name
                                    },
                                    children: [ refersTo ]
                                }, sheetScope && (definedNameNode.localSheet = sheetScope), xmlq.appendChild(definedNamesNode, definedNameNode)), 
                                definedNameNode.children = [ refersTo ], _this5;
                            }).handle(arguments);
                        }
                    }, {
                        key: "sharedStrings",
                        value: function() {
                            return this._sharedStrings;
                        }
                    }, {
                        key: "styleSheet",
                        value: function() {
                            return this._styleSheet;
                        }
                    }, {
                        key: "_initAsync",
                        value: function(data, opts) {
                            var _this6 = this;
                            return opts = opts || {}, this._maxSheetId = 0, this._sheets = [], externals.Promise.resolve().then(function() {
                                return _this6._convertInputToBufferAsync(data, opts.base64).then(function(buffer) {
                                    data = buffer;
                                });
                            }).then(function() {
                                if (opts.password) return encryptor.decryptAsync(data, opts.password).then(function(decrypted) {
                                    data = decrypted;
                                });
                            }).then(function() {
                                return JSZip.loadAsync(data);
                            }).then(function(zip) {
                                return _this6._zip = zip, _this6._parseNodesAsync([ "[Content_Types].xml", "docProps/app.xml", "docProps/core.xml", "xl/_rels/workbook.xml.rels", "xl/sharedStrings.xml", "xl/styles.xml", "xl/workbook.xml" ]);
                            }).then(function(nodes) {
                                var contentTypesNode = nodes[0], appPropertiesNode = nodes[1], corePropertiesNode = nodes[2], relationshipsNode = nodes[3], sharedStringsNode = nodes[4], styleSheetNode = nodes[5], workbookNode = nodes[6];
                                return _this6._contentTypes = new ContentTypes(contentTypesNode), _this6._appProperties = new AppProperties(appPropertiesNode), 
                                _this6._coreProperties = new CoreProperties(corePropertiesNode), _this6._relationships = new Relationships(relationshipsNode), 
                                _this6._sharedStrings = new SharedStrings(sharedStringsNode), _this6._styleSheet = new StyleSheet(styleSheetNode), 
                                _this6._node = workbookNode, _this6._relationships.findByType("sharedStrings") || _this6._relationships.add("sharedStrings", "sharedStrings.xml"), 
                                _this6._contentTypes.findByPartName("/xl/sharedStrings.xml") || _this6._contentTypes.add("/xl/sharedStrings.xml", "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"), 
                                _this6._zip.remove("xl/calcChain.xml"), _this6._sheetsNode = xmlq.findChild(_this6._node, "sheets"), 
                                externals.Promise.all(_.map(_this6._sheetsNode.children, function(sheetIdNode, i) {
                                    return sheetIdNode.attributes.sheetId > _this6._maxSheetId && (_this6._maxSheetId = sheetIdNode.attributes.sheetId), 
                                    _this6._parseNodesAsync([ "xl/worksheets/sheet" + (i + 1) + ".xml", "xl/worksheets/_rels/sheet" + (i + 1) + ".xml.rels" ]).then(function(nodes) {
                                        var sheetNode = nodes[0], sheetRelationshipsNode = nodes[1];
                                        _this6._sheets[i] = new Sheet(_this6, sheetIdNode, sheetNode, sheetRelationshipsNode);
                                    });
                                }));
                            }).then(function() {
                                return _this6._parseSheetRefs();
                            }).then(function() {
                                return _this6;
                            });
                        }
                    }, {
                        key: "_parseNodesAsync",
                        value: function(names) {
                            var _this7 = this;
                            return externals.Promise.all(_.map(names, function(name) {
                                return _this7._zip.file(name);
                            })).then(function(files) {
                                return externals.Promise.all(_.map(files, function(file) {
                                    return file && file.async("string");
                                }));
                            }).then(function(texts) {
                                return externals.Promise.all(_.map(texts, function(text) {
                                    return text && xmlParser.parseAsync(text);
                                }));
                            });
                        }
                    }, {
                        key: "_parseSheetRefs",
                        value: function() {
                            var _this8 = this, bookViewsNode = xmlq.findChild(this._node, "bookViews"), workbookViewNode = bookViewsNode && xmlq.findChild(bookViewsNode, "workbookView"), activeTabId = workbookViewNode && workbookViewNode.attributes.activeTab || 0;
                            this._activeSheet = this._sheets[activeTabId];
                            var definedNamesNode = xmlq.findChild(this._node, "definedNames");
                            definedNamesNode && _.forEach(definedNamesNode.children, function(definedNameNode) {
                                definedNameNode.attributes.hasOwnProperty("localSheetId") && (definedNameNode.localSheet = _this8._sheets[definedNameNode.attributes.localSheetId]);
                            });
                        }
                    }, {
                        key: "_setSheetRefs",
                        value: function() {
                            var _this9 = this, bookViewsNode = xmlq.findChild(this._node, "bookViews");
                            bookViewsNode || (bookViewsNode = {
                                name: "bookViews",
                                attributes: {},
                                children: []
                            }, xmlq.insertInOrder(this._node, bookViewsNode, nodeOrder));
                            var workbookViewNode = xmlq.findChild(bookViewsNode, "workbookView");
                            workbookViewNode || (workbookViewNode = {
                                name: "workbookView",
                                attributes: {},
                                children: []
                            }, xmlq.appendChild(bookViewsNode, workbookViewNode)), workbookViewNode.attributes.activeTab = this._sheets.indexOf(this._activeSheet);
                            var definedNamesNode = xmlq.findChild(this._node, "definedNames");
                            definedNamesNode && _.forEach(definedNamesNode.children, function(definedNameNode) {
                                definedNameNode.localSheet && (definedNameNode.attributes.localSheetId = _this9._sheets.indexOf(definedNameNode.localSheet));
                            });
                        }
                    }, {
                        key: "_convertBufferToOutput",
                        value: function(buffer, type) {
                            if (type || (type = process.browser ? "blob" : "nodebuffer"), "buffer" === type || "nodebuffer" === type) return buffer;
                            if (process.browser && "blob" === type) return new Blob([ buffer ], {
                                type: Workbook.MIME_TYPE
                            });
                            if ("base64" === type) return buffer.toString("base64");
                            if ("binarystring" === type) return buffer.toString("utf8");
                            if ("uint8array" === type) return new Uint8Array(buffer);
                            if ("arraybuffer" === type) return new Uint8Array(buffer).buffer;
                            throw new Error("Output type '" + type + "' not supported.");
                        }
                    }, {
                        key: "_convertInputToBufferAsync",
                        value: function(input, base64) {
                            return externals.Promise.resolve().then(function() {
                                if (Buffer.isBuffer(input)) return input;
                                if (process.browser && input instanceof Blob) return new externals.Promise(function(resolve) {
                                    var fileReader = new FileReader();
                                    fileReader.onload = function(event) {
                                        resolve(Buffer.from(event.target.result));
                                    }, fileReader.readAsArrayBuffer(input);
                                });
                                if ("string" == typeof input && base64) return Buffer.from(input, "base64");
                                if ("string" == typeof input && !base64) return Buffer.from(input, "utf8");
                                if (input instanceof Uint8Array || input instanceof ArrayBuffer) return Buffer.from(input);
                                throw new Error("Input type unknown.");
                            });
                        }
                    } ], [ {
                        key: "fromBlankAsync",
                        value: function() {
                            return Workbook.fromDataAsync(blank);
                        }
                    }, {
                        key: "fromDataAsync",
                        value: function(data, opts) {
                            return new Workbook()._initAsync(data, opts);
                        }
                    }, {
                        key: "fromFileAsync",
                        value: function(path, opts) {
                            if (process.browser) throw new Error("Workbook.fromFileAsync is not supported in the browser");
                            return new externals.Promise(function(resolve, reject) {
                                fs.readFile(path, function(err, data) {
                                    if (err) return reject(err);
                                    resolve(data);
                                });
                            }).then(function(data) {
                                return Workbook.fromDataAsync(data, opts);
                            });
                        }
                    } ]), Workbook;
                }();
                Workbook.MIME_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", 
                module.exports = Workbook;
            }).call(this, require("_process"), require("buffer").Buffer);
        }, {
            "./AppProperties": 1,
            "./ArgHandler": 2,
            "./ContentTypes": 5,
            "./CoreProperties": 6,
            "./Encryptor": 7,
            "./Relationships": 10,
            "./SharedStrings": 12,
            "./Sheet": 13,
            "./StyleSheet": 15,
            "./XmlBuilder": 18,
            "./XmlParser": 19,
            "./addressConverter": 20,
            "./blank": 21,
            "./externals": 24,
            "./regexify": 25,
            "./xmlq": 26,
            _process: 224,
            buffer: 77,
            fs: 72,
            jszip: 164,
            lodash: 191
        } ],
        17: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var externals = require("./externals"), Workbook = require("./Workbook"), FormulaError = require("./FormulaError"), dateConverter = require("./dateConverter"), XlsxPopulate = function() {
                function XlsxPopulate() {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, XlsxPopulate);
                }
                return _createClass(XlsxPopulate, null, [ {
                    key: "dateToNumber",
                    value: function(date) {
                        return dateConverter.dateToNumber(date);
                    }
                }, {
                    key: "fromBlankAsync",
                    value: function() {
                        return Workbook.fromBlankAsync();
                    }
                }, {
                    key: "fromDataAsync",
                    value: function(data, opts) {
                        return Workbook.fromDataAsync(data, opts);
                    }
                }, {
                    key: "fromFileAsync",
                    value: function(path, opts) {
                        return Workbook.fromFileAsync(path, opts);
                    }
                }, {
                    key: "numberToDate",
                    value: function(number) {
                        return dateConverter.numberToDate(number);
                    }
                }, {
                    key: "Promise",
                    get: function() {
                        return externals.Promise;
                    },
                    set: function(Promise) {
                        externals.Promise = Promise;
                    }
                } ]), XlsxPopulate;
            }();
            XlsxPopulate.MIME_TYPE = Workbook.MIME_TYPE, XlsxPopulate.FormulaError = FormulaError, 
            module.exports = XlsxPopulate;
        }, {
            "./FormulaError": 8,
            "./Workbook": 16,
            "./dateConverter": 23,
            "./externals": 24
        } ],
        18: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var _ = require("lodash"), XmlBuilder = function() {
                function XmlBuilder() {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, XmlBuilder);
                }
                return _createClass(XmlBuilder, [ {
                    key: "build",
                    value: function(node) {
                        this._i = 0;
                        var xml = this._build(node, "");
                        if ("" !== xml) return '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' + xml;
                    }
                }, {
                    key: "_build",
                    value: function(node, xml) {
                        var _this = this;
                        if (this._i++ % 1e6 == 0 && (this._c = xml[0]), node && _.isFunction(node.toXml) && (node = node.toXml()), 
                        _.isObject(node)) {
                            if (!node.name) throw new Error("XML node does not have name: " + JSON.stringify(node));
                            xml += "<" + node.name, _.forOwn(node.attributes, function(value, name) {
                                xml += " " + name + '="' + _this._escapeString(value, !0) + '"';
                            }), _.isEmpty(node.children) ? xml += "/>" : (xml += ">", _.forEach(node.children, function(child) {
                                xml = _this._build(child, xml);
                            }), xml += "</" + node.name + ">");
                        } else _.isNil(node) || (xml += this._escapeString(node));
                        return xml;
                    }
                }, {
                    key: "_escapeString",
                    value: function(value, isAttribute) {
                        return _.isNil(value) || (value = value.toString().replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), 
                        isAttribute && (value = value.replace(/"/g, "&quot;"))), value;
                    }
                } ]), XmlBuilder;
            }();
            module.exports = XmlBuilder;
        }, {
            lodash: 191
        } ],
        19: [ function(require, module, exports) {
            "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 || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var sax = require("sax"), externals = require("./externals"), allWhitespaceRegex = /^\s+$/, XmlParser = function() {
                function XmlParser() {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, XmlParser);
                }
                return _createClass(XmlParser, [ {
                    key: "parseAsync",
                    value: function(xmlText) {
                        var _this = this;
                        return new externals.Promise(function(resolve, reject) {
                            var parser = sax.parser(!0), parsed = void 0, current = void 0, stack = [];
                            parser.onerror = reject, parser.ontext = function(text) {
                                allWhitespaceRegex.test(text) ? current && "preserve" === current.attributes["xml:space"] && current.children.push(text) : current.children.push(_this._covertToNumberIfNumber(text));
                            }, parser.onopentagstart = function(node) {
                                var child = {
                                    name: node.name,
                                    attributes: {},
                                    children: []
                                };
                                current ? current.children.push(child) : parsed = child, stack.push(child), current = child;
                            }, parser.onclosetag = function(node) {
                                stack.pop(), current = stack[stack.length - 1];
                            }, parser.onattribute = function(attribute) {
                                current.attributes[attribute.name] = _this._covertToNumberIfNumber(attribute.value);
                            }, parser.onend = function() {
                                return resolve(parsed);
                            }, parser.write(xmlText).close();
                        });
                    }
                }, {
                    key: "_covertToNumberIfNumber",
                    value: function(str) {
                        var num = Number(str);
                        return num.toString() === str ? num : str;
                    }
                } ]), XmlParser;
            }();
            module.exports = XmlParser;
        }, {
            "./externals": 24,
            sax: 245
        } ],
        20: [ function(require, module, exports) {
            "use strict";
            require("lodash");
            var ADDRESS_REGEX = /^(?:'?(.+?)'?!)?(?:(\$)?([A-Z]+)(\$)?(\d+)(?::(\$)?([A-Z]+)(\$)?(\d+))?|(\$)?([A-Z]+):(\$)?([A-Z]+)|(\$)?(\d+):(\$)?(\d+))$/;
            module.exports = {
                columnNameToNumber: function(name) {
                    if (name && "string" == typeof name) {
                        name = name.toUpperCase();
                        for (var sum = 0, i = 0; i < name.length; i++) sum *= 26, sum += name[i].charCodeAt(0) - "A".charCodeAt(0) + 1;
                        return sum;
                    }
                },
                columnNumberToName: function(number) {
                    for (var dividend = number, name = "", modulo = 0; 0 < dividend; ) modulo = (dividend - 1) % 26, 
                    name = String.fromCharCode("A".charCodeAt(0) + modulo) + name, dividend = Math.floor((dividend - modulo) / 26);
                    return name;
                },
                fromAddress: function(address) {
                    var match = address.match(ADDRESS_REGEX);
                    if (match) {
                        var ref = {};
                        return match[1] && (ref.sheetName = match[1].replace(/''/g, "'")), match[3] && match[7] ? (ref.type = "range", 
                        ref.startColumnAnchored = !!match[2], ref.startColumnName = match[3], ref.startColumnNumber = this.columnNameToNumber(ref.startColumnName), 
                        ref.startRowAnchored = !!match[4], ref.startRowNumber = parseInt(match[5]), ref.endColumnAnchored = !!match[6], 
                        ref.endColumnName = match[7], ref.endColumnNumber = this.columnNameToNumber(ref.endColumnName), 
                        ref.endRowAnchored = !!match[8], ref.endRowNumber = parseInt(match[9])) : match[3] ? (ref.type = "cell", 
                        ref.columnAnchored = !!match[2], ref.columnName = match[3], ref.columnNumber = this.columnNameToNumber(ref.columnName), 
                        ref.rowAnchored = !!match[4], ref.rowNumber = parseInt(match[5])) : match[11] && match[11] !== match[13] ? (ref.type = "columnRange", 
                        ref.startColumnAnchored = !!match[10], ref.startColumnName = match[11], ref.startColumnNumber = this.columnNameToNumber(ref.startColumnName), 
                        ref.endColumnAnchored = !!match[12], ref.endColumnName = match[13], ref.endColumnNumber = this.columnNameToNumber(ref.endColumnName)) : match[11] ? (ref.type = "column", 
                        ref.columnAnchored = !!match[10], ref.columnName = match[11], ref.columnNumber = this.columnNameToNumber(ref.columnName)) : match[15] && match[15] !== match[17] ? (ref.type = "rowRange", 
                        ref.startRowAnchored = !!match[14], ref.startRowNumber = parseInt(match[15]), ref.endRowAnchored = !!match[16], 
                        ref.endRowNumber = parseInt(match[17])) : match[15] && (ref.type = "row", ref.rowAnchored = !!match[14], 
                        ref.rowNumber = parseInt(match[15])), ref;
                    }
                },
                toAddress: function(ref) {
                    var a = void 0, b = void 0, sheetName = ref.sheetName;
                    "cell" === ref.type ? a = {
                        columnName: ref.columnName,
                        columnNumber: ref.columnNumber,
                        columnAnchored: ref.columnAnchored,
                        rowNumber: ref.rowNumber,
                        rowAnchored: ref.rowAnchored
                    } : "range" === ref.type ? (a = {
                        columnName: ref.startColumnName,
                        columnNumber: ref.startColumnNumber,
                        columnAnchored: ref.startColumnAnchored,
                        rowNumber: ref.startRowNumber,
                        rowAnchored: ref.startRowAnchored
                    }, b = {
                        columnName: ref.endColumnName,
                        columnNumber: ref.endColumnNumber,
                        columnAnchored: ref.endColumnAnchored,
                        rowNumber: ref.endRowNumber,
                        rowAnchored: ref.endRowAnchored
                    }) : "column" === ref.type ? a = b = {
                        columnName: ref.columnName,
                        columnNumber: ref.columnNumber,
                        columnAnchored: ref.columnAnchored
                    } : "row" === ref.type ? a = b = {
                        rowNumber: ref.rowNumber,
                        rowAnchored: ref.rowAnchored
                    } : "columnRange" === ref.type ? (a = {
                        columnName: ref.startColumnName,
                        columnNumber: ref.startColumnNumber,
                        columnAnchored: ref.startColumnAnchored
                    }, b = {
                        columnName: ref.endColumnName,
                        columnNumber: ref.endColumnNumber,
                        columnAnchored: ref.endColumnAnchored
                    }) : "rowRange" === ref.type && (a = {
                        rowNumber: ref.startRowNumber,
                        rowAnchored: ref.startRowAnchored
                    }, b = {
                        rowNumber: ref.endRowNumber,
                        rowAnchored: ref.endRowAnchored
                    });
                    var address = "";
                    return sheetName && (address = address + "'" + sheetName.replace(/'/g, "''") + "'!"), 
                    a.columnAnchored && (address += "$"), a.columnName ? address += a.columnName : a.columnNumber && (address += this.columnNumberToName(a.columnNumber)), 
                    a.rowAnchored && (address += "$"), a.rowNumber && (address += a.rowNumber), b && (address += ":", 
                    b.columnAnchored && (address += "$"), b.columnName ? address += b.columnName : b.columnNumber && (address += this.columnNumberToName(b.columnNumber)), 
                    b.rowAnchored && (address += "$"), b.rowNumber && (address += b.rowNumber)), address;
                }
            };
        }, {
            lodash: 191
        } ],
        21: [ function(require, module, exports) {
            (function(Buffer) {
                "use strict";
                module.exports = function() {
                    return new Buffer(" ", "base64");
                };
            }).call(this, require("buffer").Buffer);
        }, {
            buffer: 77
        } ],
        22: [ function(require, module, exports) {
            "use strict";
            module.exports = [ "000000", "FFFFFF", "FF0000", "00FF00", "0000FF", "FFFF00", "FF00FF", "00FFFF", "000000", "FFFFFF", "FF0000", "00FF00", "0000FF", "FFFF00", "FF00FF", "00FFFF", "800000", "008000", "000080", "808000", "800080", "008080", "C0C0C0", "808080", "9999FF", "993366", "FFFFCC", "CCFFFF", "660066", "FF8080", "0066CC", "CCCCFF", "000080", "FF00FF", "FFFF00", "00FFFF", "800080", "800000", "008080", "0000FF", "00CCFF", "CCFFFF", "CCFFCC", "FFFF99", "99CCFF", "FF99CC", "CC99FF", "FFCC99", "3366FF", "33CCCC", "99CC00", "FFCC00", "FF9900", "FF6600", "666699", "969696", "003366", "339966", "003300", "333300", "993300", "993366", "333399", "333333", "System Foreground", "System Background" ];
        }, {} ],
        23: [ function(require, module, exports) {
            "use strict";
            var dateBase = new Date(1900, 0, 0), incorrectLeapDate = new Date(1900, 1, 28);
            module.exports = {
                dateToNumber: function(date) {
                    var dateOnly = new Date(date.getTime());
                    dateOnly.setHours(0, 0, 0, 0);
                    var number = Math.round((dateOnly - dateBase) / 864e5);
                    return number += (date - dateOnly) / 864e5, incorrectLeapDate < date && (number += 1), 
                    number;
                },
                numberToDate: function(number) {
                    number > this.dateToNumber(incorrectLeapDate) && number--;
                    var fullDays = Math.floor(number), partialMilliseconds = Math.round(864e5 * (number - fullDays)), date = new Date(dateBase.getTime() + partialMilliseconds);
                    return date.setDate(date.getDate() + fullDays), date;
                }
            };
        }, {} ],
        24: [ function(require, module, exports) {
            "use strict";
            var JSZip = require("jszip");
            module.exports = {
                get Promise() {
                    return JSZip.external.Promise;
                },
                set Promise(Promise) {
                    JSZip.external.Promise = Promise;
                }
            };
        }, {
            jszip: 164
        } ],
        25: [ function(require, module, exports) {
            "use strict";
            var _ = require("lodash");
            module.exports = function(pattern) {
                return "string" == typeof pattern && (pattern = new RegExp(_.escapeRegExp(pattern), "igm")), 
                pattern.lastIndex = 0, pattern;
            };
        }, {
            lodash: 191
        } ],
        26: [ function(require, module, exports) {
            "use strict";
            var _ = require("lodash");
            module.exports = {
                appendChild: function(node, child) {
                    node.children || (node.children = []), node.children.push(child);
                },
                appendChildIfNotFound: function(node, name) {
                    var child = this.findChild(node, name);
                    return child || (child = {
                        name: name,
                        attributes: {},
                        children: []
                    }, this.appendChild(node, child)), child;
                },
                findChild: function(node, name) {
                    return _.find(node.children, {
                        name: name
                    });
                },
                getChildAttribute: function(node, name, attribute) {
                    var child = this.findChild(node, name);
                    if (child) return child.attributes && child.attributes[attribute];
                },
                hasChild: function(node, name) {
                    return _.some(node.children, {
                        name: name
                    });
                },
                insertAfter: function(node, child, after) {
                    node.children || (node.children = []);
                    var index = node.children.indexOf(after);
                    node.children.splice(index + 1, 0, child);
                },
                insertBefore: function(node, child, before) {
                    node.children || (node.children = []);
                    var index = node.children.indexOf(before);
                    node.children.splice(index, 0, child);
                },
                insertInOrder: function(node, child, nodeOrder) {
                    var childIndex = nodeOrder.indexOf(child.name);
                    if (node.children && 0 <= childIndex) for (var i = childIndex + 1; i < nodeOrder.length; i++) {
                        var sibling = this.findChild(node, nodeOrder[i]);
                        if (sibling) return void this.insertBefore(node, child, sibling);
                    }
                    this.appendChild(node, child);
                },
                isEmpty: function(node) {
                    return _.isEmpty(node.children) && _.isEmpty(node.attributes);
                },
                removeChild: function(node, child) {
                    if (node.children) if ("string" == typeof child) _.remove(node.children, {
                        name: child
                    }); else {
                        var index = node.children.indexOf(child);
                        0 <= index && node.children.splice(index, 1);
                    }
                },
                setAttributes: function(node, attributes) {
                    _.forOwn(attributes, function(value, attribute) {
                        _.isNil(value) ? node.attributes && delete node.attributes[attribute] : (node.attributes || (node.attributes = {}), 
                        node.attributes[attribute] = value);
                    });
                },
                setChildAttributes: function(node, name, attributes) {
                    var _this = this, child = this.findChild(node, name);
                    return _.forOwn(attributes, function(value, attribute) {
                        _.isNil(value) ? child && child.attributes && delete child.attributes[attribute] : (child || (child = {
                            name: name,
                            attributes: {},
                            children: []
                        }, _this.appendChild(node, child)), child.attributes || (child.attributes = {}), 
                        child.attributes[attribute] = value);
                    }), child;
                },
                removeChildIfEmpty: function(node, child) {
                    "string" == typeof child && (child = this.findChild(node, child)), child && this.isEmpty(child) && this.removeChild(node, child);
                }
            };
        }, {
            lodash: 191
        } ],
        27: [ function(require, module, exports) {
            var asn1 = exports;
            asn1.bignum = require("bn.js"), asn1.define = require("./asn1/api").define, asn1.base = require("./asn1/base"), 
            asn1.constants = require("./asn1/constants"), asn1.decoders = require("./asn1/decoders"), 
            asn1.encoders = require("./asn1/encoders");
        }, {
            "./asn1/api": 28,
            "./asn1/base": 30,
            "./asn1/constants": 34,
            "./asn1/decoders": 36,
            "./asn1/encoders": 39,
            "bn.js": 42
        } ],
        28: [ function(require, module, exports) {
            var asn1 = require("../asn1"), inherits = require("inherits");
            function Entity(name, body) {
                this.name = name, this.body = body, this.decoders = {}, this.encoders = {};
            }
            exports.define = function(name, body) {
                return new Entity(name, body);
            }, Entity.prototype._createNamed = function(base) {
                var named;
                try {
                    named = require("vm").runInThisContext("(function " + this.name + "(entity) {\n  this._initNamed(entity);\n})");
                } catch (e) {
                    named = function(entity) {
                        this._initNamed(entity);
                    };
                }
                return inherits(named, base), named.prototype._initNamed = function(entity) {
                    base.call(this, entity);
                }, new named(this);
            }, Entity.prototype._getDecoder = function(enc) {
                return enc = enc || "der", this.decoders.hasOwnProperty(enc) || (this.decoders[enc] = this._createNamed(asn1.decoders[enc])), 
                this.decoders[enc];
            }, Entity.prototype.decode = function(data, enc, options) {
                return this._getDecoder(enc).decode(data, options);
            }, Entity.prototype._getEncoder = function(enc) {
                return enc = enc || "der", this.encoders.hasOwnProperty(enc) || (this.encoders[enc] = this._createNamed(asn1.encoders[enc])), 
                this.encoders[enc];
            }, Entity.prototype.encode = function(data, enc, reporter) {
                return this._getEncoder(enc).encode(data, reporter);
            };
        }, {
            "../asn1": 27,
            inherits: 152,
            vm: 75
        } ],
        29: [ function(require, module, exports) {
            var inherits = require("inherits"), Reporter = require("../base").Reporter, Buffer = require("buffer").Buffer;
            function DecoderBuffer(base, options) {
                Reporter.call(this, options), Buffer.isBuffer(base) ? (this.base = base, this.offset = 0, 
                this.length = base.length) : this.error("Input not Buffer");
            }
            function EncoderBuffer(value, reporter) {
                if (Array.isArray(value)) this.length = 0, this.value = value.map(function(item) {
                    return item instanceof EncoderBuffer || (item = new EncoderBuffer(item, reporter)), 
                    this.length += item.length, item;
                }, this); else if ("number" == typeof value) {
                    if (!(0 <= value && value <= 255)) return reporter.error("non-byte EncoderBuffer value");
                    this.value = value, this.length = 1;
                } else if ("string" == typeof value) this.value = value, this.length = Buffer.byteLength(value); else {
                    if (!Buffer.isBuffer(value)) return reporter.error("Unsupported type: " + typeof value);
                    this.value = value, this.length = value.length;
                }
            }
            inherits(DecoderBuffer, Reporter), (exports.DecoderBuffer = DecoderBuffer).prototype.save = function() {
                return {
                    offset: this.offset,
                    reporter: Reporter.prototype.save.call(this)
                };
            }, DecoderBuffer.prototype.restore = function(save) {
                var res = new DecoderBuffer(this.base);
                return res.offset = save.offset, res.length = this.offset, this.offset = save.offset, 
                Reporter.prototype.restore.call(this, save.reporter), res;
            }, DecoderBuffer.prototype.isEmpty = function() {
                return this.offset === this.length;
            }, DecoderBuffer.prototype.readUInt8 = function(fail) {
                return this.offset + 1 <= this.length ? this.base.readUInt8(this.offset++, !0) : this.error(fail || "DecoderBuffer overrun");
            }, DecoderBuffer.prototype.skip = function(bytes, fail) {
                if (!(this.offset + bytes <= this.length)) return this.error(fail || "DecoderBuffer overrun");
                var res = new DecoderBuffer(this.base);
                return res._reporterState = this._reporterState, res.offset = this.offset, res.length = this.offset + bytes, 
                this.offset += bytes, res;
            }, DecoderBuffer.prototype.raw = function(save) {
                return this.base.slice(save ? save.offset : this.offset, this.length);
            }, (exports.EncoderBuffer = EncoderBuffer).prototype.join = function(out, offset) {
                return out || (out = new Buffer(this.length)), offset || (offset = 0), 0 === this.length || (Array.isArray(this.value) ? this.value.forEach(function(item) {
                    item.join(out, offset), offset += item.length;
                }) : ("number" == typeof this.value ? out[offset] = this.value : "string" == typeof this.value ? out.write(this.value, offset) : Buffer.isBuffer(this.value) && this.value.copy(out, offset), 
                offset += this.length)), out;
            };
        }, {
            "../base": 30,
            buffer: 77,
            inherits: 152
        } ],
        30: [ function(require, module, exports) {
            var base = exports;
            base.Reporter = require("./reporter").Reporter, base.DecoderBuffer = require("./buffer").DecoderBuffer, 
            base.EncoderBuffer = require("./buffer").EncoderBuffer, base.Node = require("./node");
        }, {
            "./buffer": 29,
            "./node": 31,
            "./reporter": 32
        } ],
        31: [ function(require, module, exports) {
            var Reporter = require("../base").Reporter, EncoderBuffer = require("../base").EncoderBuffer, DecoderBuffer = require("../base").DecoderBuffer, assert = require("minimalistic-assert"), tags = [ "seq", "seqof", "set", "setof", "objid", "bool", "gentime", "utctime", "null_", "enum", "int", "objDesc", "bitstr", "bmpstr", "charstr", "genstr", "graphstr", "ia5str", "iso646str", "numstr", "octstr", "printstr", "t61str", "unistr", "utf8str", "videostr" ], methods = [ "key", "obj", "use", "optional", "explicit", "implicit", "def", "choice", "any", "contains" ].concat(tags);
            function Node(enc, parent) {
                var state = {};
                (this._baseState = state).enc = enc, state.parent = parent || null, state.children = null, 
                state.tag = null, state.args = null, state.reverseArgs = null, state.choice = null, 
                state.optional = !1, state.any = !1, state.obj = !1, state.use = null, state.useDecoder = null, 
                state.key = null, state.default = null, state.explicit = null, state.implicit = null, 
                state.contains = null, state.parent || (state.children = [], this._wrap());
            }
            module.exports = Node;
            var stateProps = [ "enc", "parent", "children", "tag", "args", "reverseArgs", "choice", "optional", "any", "obj", "use", "alteredUse", "key", "default", "explicit", "implicit", "contains" ];
            Node.prototype.clone = function() {
                var state = this._baseState, cstate = {};
                stateProps.forEach(function(prop) {
                    cstate[prop] = state[prop];
                });
                var res = new this.constructor(cstate.parent);
                return res._baseState = cstate, res;
            }, Node.prototype._wrap = function() {
                var state = this._baseState;
                methods.forEach(function(method) {
                    this[method] = function() {
                        var clone = new this.constructor(this);
                        return state.children.push(clone), clone[method].apply(clone, arguments);
                    };
                }, this);
            }, Node.prototype._init = function(body) {
                var state = this._baseState;
                assert(null === state.parent), body.call(this), state.children = state.children.filter(function(child) {
                    return child._baseState.parent === this;
                }, this), assert.equal(state.children.length, 1, "Root node can have only one child");
            }, Node.prototype._useArgs = function(args) {
                var state = this._baseState, children = args.filter(function(arg) {
                    return arg instanceof this.constructor;
                }, this);
                args = args.filter(function(arg) {
                    return !(arg instanceof this.constructor);
                }, this), 0 !== children.length && (assert(null === state.children), (state.children = children).forEach(function(child) {
                    child._baseState.parent = this;
                }, this)), 0 !== args.length && (assert(null === state.args), state.args = args, 
                state.reverseArgs = args.map(function(arg) {
                    if ("object" != typeof arg || arg.constructor !== Object) return arg;
                    var res = {};
                    return Object.keys(arg).forEach(function(key) {
                        key == (0 | key) && (key |= 0);
                        var value = arg[key];
                        res[value] = key;
                    }), res;
                }));
            }, [ "_peekTag", "_decodeTag", "_use", "_decodeStr", "_decodeObjid", "_decodeTime", "_decodeNull", "_decodeInt", "_decodeBool", "_decodeList", "_encodeComposite", "_encodeStr", "_encodeObjid", "_encodeTime", "_encodeNull", "_encodeInt", "_encodeBool" ].forEach(function(method) {
                Node.prototype[method] = function() {
                    var state = this._baseState;
                    throw new Error(method + " not implemented for encoding: " + state.enc);
                };
            }), tags.forEach(function(tag) {
                Node.prototype[tag] = function() {
                    var state = this._baseState, args = Array.prototype.slice.call(arguments);
                    return assert(null === state.tag), state.tag = tag, this._useArgs(args), this;
                };
            }), Node.prototype.use = function(item) {
                assert(item);
                var state = this._baseState;
                return assert(null === state.use), state.use = item, this;
            }, Node.prototype.optional = function() {
                return this._baseState.optional = !0, this;
            }, Node.prototype.def = function(val) {
                var state = this._baseState;
                return assert(null === state.default), state.default = val, state.optional = !0, 
                this;
            }, Node.prototype.explicit = function(num) {
                var state = this._baseState;
                return assert(null === state.explicit && null === state.implicit), state.explicit = num, 
                this;
            }, Node.prototype.implicit = function(num) {
                var state = this._baseState;
                return assert(null === state.explicit && null === state.implicit), state.implicit = num, 
                this;
            }, Node.prototype.obj = function() {
                var state = this._baseState, args = Array.prototype.slice.call(arguments);
                return state.obj = !0, 0 !== args.length && this._useArgs(args), this;
            }, Node.prototype.key = function(newKey) {
                var state = this._baseState;
                return assert(null === state.key), state.key = newKey, this;
            }, Node.prototype.any = function() {
                return this._baseState.any = !0, this;
            }, Node.prototype.choice = function(obj) {
                var state = this._baseState;
                return assert(null === state.choice), state.choice = obj, this._useArgs(Object.keys(obj).map(function(key) {
                    return obj[key];
                })), this;
            }, Node.prototype.contains = function(item) {
                var state = this._baseState;
                return assert(null === state.use), state.contains = item, this;
            }, Node.prototype._decode = function(input, options) {
                var state = this._baseState;
                if (null === state.parent) return input.wrapResult(state.children[0]._decode(input, options));
                var prevObj, result = state.default, present = !0, prevKey = null;
                if (null !== state.key && (prevKey = input.enterKey(state.key)), state.optional) {
                    var tag = null;
                    if (null !== state.explicit ? tag = state.explicit : null !== state.implicit ? tag = state.implicit : null !== state.tag && (tag = state.tag), 
                    null !== tag || state.any) {
                        if (present = this._peekTag(input, tag, state.any), input.isError(present)) return present;
                    } else {
                        var save = input.save();
                        try {
                            null === state.choice ? this._decodeGeneric(state.tag, input, options) : this._decodeChoice(input, options), 
                            present = !0;
                        } catch (e) {
                            present = !1;
                        }
                        input.restore(save);
                    }
                }
                if (state.obj && present && (prevObj = input.enterObject()), present) {
                    if (null !== state.explicit) {
                        var explicit = this._decodeTag(input, state.explicit);
                        if (input.isError(explicit)) return explicit;
                        input = explicit;
                    }
                    var start = input.offset;
                    if (null === state.use && null === state.choice) {
                        if (state.any) save = input.save();
                        var body = this._decodeTag(input, null !== state.implicit ? state.implicit : state.tag, state.any);
                        if (input.isError(body)) return body;
                        state.any ? result = input.raw(save) : input = body;
                    }
                    if (options && options.track && null !== state.tag && options.track(input.path(), start, input.length, "tagged"), 
                    options && options.track && null !== state.tag && options.track(input.path(), input.offset, input.length, "content"), 
                    result = state.any ? result : null === state.choice ? this._decodeGeneric(state.tag, input, options) : this._decodeChoice(input, options), 
                    input.isError(result)) return result;
                    if (state.any || null !== state.choice || null === state.children || state.children.forEach(function(child) {
                        child._decode(input, options);
                    }), state.contains && ("octstr" === state.tag || "bitstr" === state.tag)) {
                        var data = new DecoderBuffer(result);
                        result = this._getUse(state.contains, input._reporterState.obj)._decode(data, options);
                    }
                }
                return state.obj && present && (result = input.leaveObject(prevObj)), null === state.key || null === result && !0 !== present ? null !== prevKey && input.exitKey(prevKey) : input.leaveKey(prevKey, state.key, result), 
                result;
            }, Node.prototype._decodeGeneric = function(tag, input, options) {
                var state = this._baseState;
                return "seq" === tag || "set" === tag ? null : "seqof" === tag || "setof" === tag ? this._decodeList(input, tag, state.args[0], options) : /str$/.test(tag) ? this._decodeStr(input, tag, options) : "objid" === tag && state.args ? this._decodeObjid(input, state.args[0], state.args[1], options) : "objid" === tag ? this._decodeObjid(input, null, null, options) : "gentime" === tag || "utctime" === tag ? this._decodeTime(input, tag, options) : "null_" === tag ? this._decodeNull(input, options) : "bool" === tag ? this._decodeBool(input, options) : "objDesc" === tag ? this._decodeStr(input, tag, options) : "int" === tag || "enum" === tag ? this._decodeInt(input, state.args && state.args[0], options) : null !== state.use ? this._getUse(state.use, input._reporterState.obj)._decode(input, options) : input.error("unknown tag: " + tag);
            }, Node.prototype._getUse = function(entity, obj) {
                var state = this._baseState;
                return state.useDecoder = this._use(entity, obj), assert(null === state.useDecoder._baseState.parent), 
                state.useDecoder = state.useDecoder._baseState.children[0], state.implicit !== state.useDecoder._baseState.implicit && (state.useDecoder = state.useDecoder.clone(), 
                state.useDecoder._baseState.implicit = state.implicit), state.useDecoder;
            }, Node.prototype._decodeChoice = function(input, options) {
                var state = this._baseState, result = null, match = !1;
                return Object.keys(state.choice).some(function(key) {
                    var save = input.save(), node = state.choice[key];
                    try {
                        var value = node._decode(input, options);
                        if (input.isError(value)) return !1;
                        result = {
                            type: key,
                            value: value
                        }, match = !0;
                    } catch (e) {
                        return input.restore(save), !1;
                    }
                    return !0;
                }, this), match ? result : input.error("Choice not matched");
            }, Node.prototype._createEncoderBuffer = function(data) {
                return new EncoderBuffer(data, this.reporter);
            }, Node.prototype._encode = function(data, reporter, parent) {
                var state = this._baseState;
                if (null === state.default || state.default !== data) {
                    var result = this._encodeValue(data, reporter, parent);
                    if (void 0 !== result && !this._skipDefault(result, reporter, parent)) return result;
                }
            }, Node.prototype._encodeValue = function(data, reporter, parent) {
                var state = this._baseState;
                if (null === state.parent) return state.children[0]._encode(data, reporter || new Reporter());
                var result = null;
                if (this.reporter = reporter, state.optional && void 0 === data) {
                    if (null === state.default) return;
                    data = state.default;
                }
                var content = null, primitive = !1;
                if (state.any) result = this._createEncoderBuffer(data); else if (state.choice) result = this._encodeChoice(data, reporter); else if (state.contains) content = this._getUse(state.contains, parent)._encode(data, reporter), 
                primitive = !0; else if (state.children) content = state.children.map(function(child) {
                    if ("null_" === child._baseState.tag) return child._encode(null, reporter, data);
                    if (null === child._baseState.key) return reporter.error("Child should have a key");
                    var prevKey = reporter.enterKey(child._baseState.key);
                    if ("object" != typeof data) return reporter.error("Child expected, but input is not object");
                    var res = child._encode(data[child._baseState.key], reporter, data);
                    return reporter.leaveKey(prevKey), res;
                }, this).filter(function(child) {
                    return child;
                }), content = this._createEncoderBuffer(content); else if ("seqof" === state.tag || "setof" === state.tag) {
                    if (!state.args || 1 !== state.args.length) return reporter.error("Too many args for : " + state.tag);
                    if (!Array.isArray(data)) return reporter.error("seqof/setof, but data is not Array");
                    var child = this.clone();
                    child._baseState.implicit = null, content = this._createEncoderBuffer(data.map(function(item) {
                        var state = this._baseState;
                        return this._getUse(state.args[0], data)._encode(item, reporter);
                    }, child));
                } else null !== state.use ? result = this._getUse(state.use, parent)._encode(data, reporter) : (content = this._encodePrimitive(state.tag, data), 
                primitive = !0);
                if (!state.any && null === state.choice) {
                    var tag = null !== state.implicit ? state.implicit : state.tag, cls = null === state.implicit ? "universal" : "context";
                    null === tag ? null === state.use && reporter.error("Tag could be omitted only for .use()") : null === state.use && (result = this._encodeComposite(tag, primitive, cls, content));
                }
                return null !== state.explicit && (result = this._encodeComposite(state.explicit, !1, "context", result)), 
                result;
            }, Node.prototype._encodeChoice = function(data, reporter) {
                var state = this._baseState, node = state.choice[data.type];
                return node || assert(!1, data.type + " not found in " + JSON.stringify(Object.keys(state.choice))), 
                node._encode(data.value, reporter);
            }, Node.prototype._encodePrimitive = function(tag, data) {
                var state = this._baseState;
                if (/str$/.test(tag)) return this._encodeStr(data, tag);
                if ("objid" === tag && state.args) return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);
                if ("objid" === tag) return this._encodeObjid(data, null, null);
                if ("gentime" === tag || "utctime" === tag) return this._encodeTime(data, tag);
                if ("null_" === tag) return this._encodeNull();
                if ("int" === tag || "enum" === tag) return this._encodeInt(data, state.args && state.reverseArgs[0]);
                if ("bool" === tag) return this._encodeBool(data);
                if ("objDesc" === tag) return this._encodeStr(data, tag);
                throw new Error("Unsupported tag: " + tag);
            }, Node.prototype._isNumstr = function(str) {
                return /^[0-9 ]*$/.test(str);
            }, Node.prototype._isPrintstr = function(str) {
                return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str);
            };
        }, {
            "../base": 30,
            "minimalistic-assert": 195
        } ],
        32: [ function(require, module, exports) {
            var inherits = require("inherits");
            function Reporter(options) {
                this._reporterState = {
                    obj: null,
                    path: [],
                    options: options || {},
                    errors: []
                };
            }
            function ReporterError(path, msg) {
                this.path = path, this.rethrow(msg);
            }
            (exports.Reporter = Reporter).prototype.isError = function(obj) {
                return obj instanceof ReporterError;
            }, Reporter.prototype.save = function() {
                var state = this._reporterState;
                return {
                    obj: state.obj,
                    pathLen: state.path.length
                };
            }, Reporter.prototype.restore = function(data) {
                var state = this._reporterState;
                state.obj = data.obj, state.path = state.path.slice(0, data.pathLen);
            }, Reporter.prototype.enterKey = function(key) {
                return this._reporterState.path.push(key);
            }, Reporter.prototype.exitKey = function(index) {
                var state = this._reporterState;
                state.path = state.path.slice(0, index - 1);
            }, Reporter.prototype.leaveKey = function(index, key, value) {
                var state = this._reporterState;
                this.exitKey(index), null !== state.obj && (state.obj[key] = value);
            }, Reporter.prototype.path = function() {
                return this._reporterState.path.join("/");
            }, Reporter.prototype.enterObject = function() {
                var state = this._reporterState, prev = state.obj;
                return state.obj = {}, prev;
            }, Reporter.prototype.leaveObject = function(prev) {
                var state = this._reporterState, now = state.obj;
                return state.obj = prev, now;
            }, Reporter.prototype.error = function(msg) {
                var err, state = this._reporterState, inherited = msg instanceof ReporterError;
                if (err = inherited ? msg : new ReporterError(state.path.map(function(elem) {
                    return "[" + JSON.stringify(elem) + "]";
                }).join(""), msg.message || msg, msg.stack), !state.options.partial) throw err;
                return inherited || state.errors.push(err), err;
            }, Reporter.prototype.wrapResult = function(result) {
                var state = this._reporterState;
                return state.options.partial ? {
                    result: this.isError(result) ? null : result,
                    errors: state.errors
                } : result;
            }, inherits(ReporterError, Error), ReporterError.prototype.rethrow = function(msg) {
                if (this.message = msg + " at: " + (this.path || "(shallow)"), Error.captureStackTrace && Error.captureStackTrace(this, ReporterError), 
                !this.stack) try {
                    throw new Error(this.message);
                } catch (e) {
                    this.stack = e.stack;
                }
                return this;
            };
        }, {
            inherits: 152
        } ],
        33: [ function(require, module, exports) {
            var constants = require("../constants");
            exports.tagClass = {
                0: "universal",
                1: "application",
                2: "context",
                3: "private"
            }, exports.tagClassByName = constants._reverse(exports.tagClass), exports.tag = {
                0: "end",
                1: "bool",
                2: "int",
                3: "bitstr",
                4: "octstr",
                5: "null_",
                6: "objid",
                7: "objDesc",
                8: "external",
                9: "real",
                10: "enum",
                11: "embed",
                12: "utf8str",
                13: "relativeOid",
                16: "seq",
                17: "set",
                18: "numstr",
                19: "printstr",
                20: "t61str",
                21: "videostr",
                22: "ia5str",
                23: "utctime",
                24: "gentime",
                25: "graphstr",
                26: "iso646str",
                27: "genstr",
                28: "unistr",
                29: "charstr",
                30: "bmpstr"
            }, exports.tagByName = constants._reverse(exports.tag);
        }, {
            "../constants": 34
        } ],
        34: [ function(require, module, exports) {
            var constants = exports;
            constants._reverse = function(map) {
                var res = {};
                return Object.keys(map).forEach(function(key) {
                    (0 | key) == key && (key |= 0);
                    var value = map[key];
                    res[value] = key;
                }), res;
            }, constants.der = require("./der");
        }, {
            "./der": 33
        } ],
        35: [ function(require, module, exports) {
            var inherits = require("inherits"), asn1 = require("../../asn1"), base = asn1.base, bignum = asn1.bignum, der = asn1.constants.der;
            function DERDecoder(entity) {
                this.enc = "der", this.name = entity.name, this.entity = entity, this.tree = new DERNode(), 
                this.tree._init(entity.body);
            }
            function DERNode(parent) {
                base.Node.call(this, "der", parent);
            }
            function derDecodeTag(buf, fail) {
                var tag = buf.readUInt8(fail);
                if (buf.isError(tag)) return tag;
                var cls = der.tagClass[tag >> 6], primitive = 0 == (32 & tag);
                if (31 == (31 & tag)) {
                    var oct = tag;
                    for (tag = 0; 128 == (128 & oct); ) {
                        if (oct = buf.readUInt8(fail), buf.isError(oct)) return oct;
                        tag <<= 7, tag |= 127 & oct;
                    }
                } else tag &= 31;
                return {
                    cls: cls,
                    primitive: primitive,
                    tag: tag,
                    tagStr: der.tag[tag]
                };
            }
            function derDecodeLen(buf, primitive, fail) {
                var len = buf.readUInt8(fail);
                if (buf.isError(len)) return len;
                if (!primitive && 128 === len) return null;
                if (0 == (128 & len)) return len;
                var num = 127 & len;
                if (4 < num) return buf.error("length octect is too long");
                for (var i = len = 0; i < num; i++) {
                    len <<= 8;
                    var j = buf.readUInt8(fail);
                    if (buf.isError(j)) return j;
                    len |= j;
                }
                return len;
            }
            (module.exports = DERDecoder).prototype.decode = function(data, options) {
                return data instanceof base.DecoderBuffer || (data = new base.DecoderBuffer(data, options)), 
                this.tree._decode(data, options);
            }, inherits(DERNode, base.Node), DERNode.prototype._peekTag = function(buffer, tag, any) {
                if (buffer.isEmpty()) return !1;
                var state = buffer.save(), decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"');
                return buffer.isError(decodedTag) ? decodedTag : (buffer.restore(state), decodedTag.tag === tag || decodedTag.tagStr === tag || decodedTag.tagStr + "of" === tag || any);
            }, DERNode.prototype._decodeTag = function(buffer, tag, any) {
                var decodedTag = derDecodeTag(buffer, 'Failed to decode tag of "' + tag + '"');
                if (buffer.isError(decodedTag)) return decodedTag;
                var len = derDecodeLen(buffer, decodedTag.primitive, 'Failed to get length of "' + tag + '"');
                if (buffer.isError(len)) return len;
                if (!any && decodedTag.tag !== tag && decodedTag.tagStr !== tag && decodedTag.tagStr + "of" !== tag) return buffer.error('Failed to match tag: "' + tag + '"');
                if (decodedTag.primitive || null !== len) return buffer.skip(len, 'Failed to match body of: "' + tag + '"');
                var state = buffer.save(), res = this._skipUntilEnd(buffer, 'Failed to skip indefinite length body: "' + this.tag + '"');
                return buffer.isError(res) ? res : (len = buffer.offset - state.offset, buffer.restore(state), 
                buffer.skip(len, 'Failed to match body of: "' + tag + '"'));
            }, DERNode.prototype._skipUntilEnd = function(buffer, fail) {
                for (;;) {
                    var tag = derDecodeTag(buffer, fail);
                    if (buffer.isError(tag)) return tag;
                    var res, len = derDecodeLen(buffer, tag.primitive, fail);
                    if (buffer.isError(len)) return len;
                    if (res = tag.primitive || null !== len ? buffer.skip(len) : this._skipUntilEnd(buffer, fail), 
                    buffer.isError(res)) return res;
                    if ("end" === tag.tagStr) break;
                }
            }, DERNode.prototype._decodeList = function(buffer, tag, decoder, options) {
                for (var result = []; !buffer.isEmpty(); ) {
                    var possibleEnd = this._peekTag(buffer, "end");
                    if (buffer.isError(possibleEnd)) return possibleEnd;
                    var res = decoder.decode(buffer, "der", options);
                    if (buffer.isError(res) && possibleEnd) break;
                    result.push(res);
                }
                return result;
            }, DERNode.prototype._decodeStr = function(buffer, tag) {
                if ("bitstr" === tag) {
                    var unused = buffer.readUInt8();
                    return buffer.isError(unused) ? unused : {
                        unused: unused,
                        data: buffer.raw()
                    };
                }
                if ("bmpstr" === tag) {
                    var raw = buffer.raw();
                    if (raw.length % 2 == 1) return buffer.error("Decoding of string type: bmpstr length mismatch");
                    for (var str = "", i = 0; i < raw.length / 2; i++) str += String.fromCharCode(raw.readUInt16BE(2 * i));
                    return str;
                }
                if ("numstr" === tag) {
                    var numstr = buffer.raw().toString("ascii");
                    return this._isNumstr(numstr) ? numstr : buffer.error("Decoding of string type: numstr unsupported characters");
                }
                if ("octstr" === tag) return buffer.raw();
                if ("objDesc" === tag) return buffer.raw();
                if ("printstr" === tag) {
                    var printstr = buffer.raw().toString("ascii");
                    return this._isPrintstr(printstr) ? printstr : buffer.error("Decoding of string type: printstr unsupported characters");
                }
                return /str$/.test(tag) ? buffer.raw().toString() : buffer.error("Decoding of string type: " + tag + " unsupported");
            }, DERNode.prototype._decodeObjid = function(buffer, values, relative) {
                for (var result, identifiers = [], ident = 0; !buffer.isEmpty(); ) {
                    var subident = buffer.readUInt8();
                    ident <<= 7, ident |= 127 & subident, 0 == (128 & subident) && (identifiers.push(ident), 
                    ident = 0);
                }
                128 & subident && identifiers.push(ident);
                var first = identifiers[0] / 40 | 0, second = identifiers[0] % 40;
                if (result = relative ? identifiers : [ first, second ].concat(identifiers.slice(1)), 
                values) {
                    var tmp = values[result.join(" ")];
                    void 0 === tmp && (tmp = values[result.join(".")]), void 0 !== tmp && (result = tmp);
                }
                return result;
            }, DERNode.prototype._decodeTime = function(buffer, tag) {
                var str = buffer.raw().toString();
                if ("gentime" === tag) var year = 0 | str.slice(0, 4), mon = 0 | str.slice(4, 6), day = 0 | str.slice(6, 8), hour = 0 | str.slice(8, 10), min = 0 | str.slice(10, 12), sec = 0 | str.slice(12, 14); else {
                    if ("utctime" !== tag) return buffer.error("Decoding " + tag + " time is not supported yet");
                    year = 0 | str.slice(0, 2), mon = 0 | str.slice(2, 4), day = 0 | str.slice(4, 6), 
                    hour = 0 | str.slice(6, 8), min = 0 | str.slice(8, 10), sec = 0 | str.slice(10, 12);
                    year = year < 70 ? 2e3 + year : 1900 + year;
                }
                return Date.UTC(year, mon - 1, day, hour, min, sec, 0);
            }, DERNode.prototype._decodeNull = function(buffer) {
                return null;
            }, DERNode.prototype._decodeBool = function(buffer) {
                var res = buffer.readUInt8();
                return buffer.isError(res) ? res : 0 !== res;
            }, DERNode.prototype._decodeInt = function(buffer, values) {
                var raw = buffer.raw(), res = new bignum(raw);
                return values && (res = values[res.toString(10)] || res), res;
            }, DERNode.prototype._use = function(entity, obj) {
                return "function" == typeof entity && (entity = entity(obj)), entity._getDecoder("der").tree;
            };
        }, {
            "../../asn1": 27,
            inherits: 152
        } ],
        36: [ function(require, module, exports) {
            var decoders = exports;
            decoders.der = require("./der"), decoders.pem = require("./pem");
        }, {
            "./der": 35,
            "./pem": 37
        } ],
        37: [ function(require, module, exports) {
            var inherits = require("inherits"), Buffer = require("buffer").Buffer, DERDecoder = require("./der");
            function PEMDecoder(entity) {
                DERDecoder.call(this, entity), this.enc = "pem";
            }
            inherits(PEMDecoder, DERDecoder), (module.exports = PEMDecoder).prototype.decode = function(data, options) {
                for (var lines = data.toString().split(/[\r\n]+/g), label = options.label.toUpperCase(), re = /^-----(BEGIN|END) ([^-]+)-----$/, start = -1, end = -1, i = 0; i < lines.length; i++) {
                    var match = lines[i].match(re);
                    if (null !== match && match[2] === label) {
                        if (-1 !== start) {
                            if ("END" !== match[1]) break;
                            end = i;
                            break;
                        }
                        if ("BEGIN" !== match[1]) break;
                        start = i;
                    }
                }
                if (-1 === start || -1 === end) throw new Error("PEM section not found for: " + label);
                var base64 = lines.slice(start + 1, end).join("");
                base64.replace(/[^a-z0-9\+\/=]+/gi, "");
                var input = new Buffer(base64, "base64");
                return DERDecoder.prototype.decode.call(this, input, options);
            };
        }, {
            "./der": 35,
            buffer: 77,
            inherits: 152
        } ],
        38: [ function(require, module, exports) {
            var inherits = require("inherits"), Buffer = require("buffer").Buffer, asn1 = require("../../asn1"), base = asn1.base, der = asn1.constants.der;
            function DEREncoder(entity) {
                this.enc = "der", this.name = entity.name, this.entity = entity, this.tree = new DERNode(), 
                this.tree._init(entity.body);
            }
            function DERNode(parent) {
                base.Node.call(this, "der", parent);
            }
            function two(num) {
                return num < 10 ? "0" + num : num;
            }
            (module.exports = DEREncoder).prototype.encode = function(data, reporter) {
                return this.tree._encode(data, reporter).join();
            }, inherits(DERNode, base.Node), DERNode.prototype._encodeComposite = function(tag, primitive, cls, content) {
                var header, encodedTag = function(tag, primitive, cls, reporter) {
                    var res;
                    "seqof" === tag ? tag = "seq" : "setof" === tag && (tag = "set");
                    if (der.tagByName.hasOwnProperty(tag)) res = der.tagByName[tag]; else {
                        if ("number" != typeof tag || (0 | tag) !== tag) return reporter.error("Unknown tag: " + tag);
                        res = tag;
                    }
                    if (31 <= res) return reporter.error("Multi-octet tag encoding unsupported");
                    primitive || (res |= 32);
                    return res |= der.tagClassByName[cls || "universal"] << 6;
                }(tag, primitive, cls, this.reporter);
                if (content.length < 128) return (header = new Buffer(2))[0] = encodedTag, header[1] = content.length, 
                this._createEncoderBuffer([ header, content ]);
                for (var lenOctets = 1, i = content.length; 256 <= i; i >>= 8) lenOctets++;
                (header = new Buffer(2 + lenOctets))[0] = encodedTag, header[1] = 128 | lenOctets;
                i = 1 + lenOctets;
                for (var j = content.length; 0 < j; i--, j >>= 8) header[i] = 255 & j;
                return this._createEncoderBuffer([ header, content ]);
            }, DERNode.prototype._encodeStr = function(str, tag) {
                if ("bitstr" === tag) return this._createEncoderBuffer([ 0 | str.unused, str.data ]);
                if ("bmpstr" === tag) {
                    for (var buf = new Buffer(2 * str.length), i = 0; i < str.length; i++) buf.writeUInt16BE(str.charCodeAt(i), 2 * i);
                    return this._createEncoderBuffer(buf);
                }
                return "numstr" === tag ? this._isNumstr(str) ? this._createEncoderBuffer(str) : this.reporter.error("Encoding of string type: numstr supports only digits and space") : "printstr" === tag ? this._isPrintstr(str) ? this._createEncoderBuffer(str) : this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark") : /str$/.test(tag) ? this._createEncoderBuffer(str) : "objDesc" === tag ? this._createEncoderBuffer(str) : this.reporter.error("Encoding of string type: " + tag + " unsupported");
            }, DERNode.prototype._encodeObjid = function(id, values, relative) {
                if ("string" == typeof id) {
                    if (!values) return this.reporter.error("string objid given, but no values map found");
                    if (!values.hasOwnProperty(id)) return this.reporter.error("objid not found in values map");
                    id = values[id].split(/[\s\.]+/g);
                    for (var i = 0; i < id.length; i++) id[i] |= 0;
                } else if (Array.isArray(id)) {
                    id = id.slice();
                    for (i = 0; i < id.length; i++) id[i] |= 0;
                }
                if (!Array.isArray(id)) return this.reporter.error("objid() should be either array or string, got: " + JSON.stringify(id));
                if (!relative) {
                    if (40 <= id[1]) return this.reporter.error("Second objid identifier OOB");
                    id.splice(0, 2, 40 * id[0] + id[1]);
                }
                var size = 0;
                for (i = 0; i < id.length; i++) {
                    var ident = id[i];
                    for (size++; 128 <= ident; ident >>= 7) size++;
                }
                var objid = new Buffer(size), offset = objid.length - 1;
                for (i = id.length - 1; 0 <= i; i--) {
                    ident = id[i];
                    for (objid[offset--] = 127 & ident; 0 < (ident >>= 7); ) objid[offset--] = 128 | 127 & ident;
                }
                return this._createEncoderBuffer(objid);
            }, DERNode.prototype._encodeTime = function(time, tag) {
                var str, date = new Date(time);
                return "gentime" === tag ? str = [ two(date.getFullYear()), two(date.getUTCMonth() + 1), two(date.getUTCDate()), two(date.getUTCHours()), two(date.getUTCMinutes()), two(date.getUTCSeconds()), "Z" ].join("") : "utctime" === tag ? str = [ two(date.getFullYear() % 100), two(date.getUTCMonth() + 1), two(date.getUTCDate()), two(date.getUTCHours()), two(date.getUTCMinutes()), two(date.getUTCSeconds()), "Z" ].join("") : this.reporter.error("Encoding " + tag + " time is not supported yet"), 
                this._encodeStr(str, "octstr");
            }, DERNode.prototype._encodeNull = function() {
                return this._createEncoderBuffer("");
            }, DERNode.prototype._encodeInt = function(num, values) {
                if ("string" == typeof num) {
                    if (!values) return this.reporter.error("String int or enum given, but no values map");
                    if (!values.hasOwnProperty(num)) return this.reporter.error("Values map doesn't contain: " + JSON.stringify(num));
                    num = values[num];
                }
                if ("number" != typeof num && !Buffer.isBuffer(num)) {
                    var numArray = num.toArray();
                    !num.sign && 128 & numArray[0] && numArray.unshift(0), num = new Buffer(numArray);
                }
                if (Buffer.isBuffer(num)) {
                    var size = num.length;
                    0 === num.length && size++;
                    var out = new Buffer(size);
                    return num.copy(out), 0 === num.length && (out[0] = 0), this._createEncoderBuffer(out);
                }
                if (num < 128) return this._createEncoderBuffer(num);
                if (num < 256) return this._createEncoderBuffer([ 0, num ]);
                size = 1;
                for (var i = num; 256 <= i; i >>= 8) size++;
                for (i = (out = new Array(size)).length - 1; 0 <= i; i--) out[i] = 255 & num, num >>= 8;
                return 128 & out[0] && out.unshift(0), this._createEncoderBuffer(new Buffer(out));
            }, DERNode.prototype._encodeBool = function(value) {
                return this._createEncoderBuffer(value ? 255 : 0);
            }, DERNode.prototype._use = function(entity, obj) {
                return "function" == typeof entity && (entity = entity(obj)), entity._getEncoder("der").tree;
            }, DERNode.prototype._skipDefault = function(dataBuffer, reporter, parent) {
                var i, state = this._baseState;
                if (null === state.default) return !1;
                var data = dataBuffer.join();
                if (void 0 === state.defaultBuffer && (state.defaultBuffer = this._encodeValue(state.default, reporter, parent).join()), 
                data.length !== state.defaultBuffer.length) return !1;
                for (i = 0; i < data.length; i++) if (data[i] !== state.defaultBuffer[i]) return !1;
                return !0;
            };
        }, {
            "../../asn1": 27,
            buffer: 77,
            inherits: 152
        } ],
        39: [ function(require, module, exports) {
            var encoders = exports;
            encoders.der = require("./der"), encoders.pem = require("./pem");
        }, {
            "./der": 38,
            "./pem": 40
        } ],
        40: [ function(require, module, exports) {
            var inherits = require("inherits"), DEREncoder = require("./der");
            function PEMEncoder(entity) {
                DEREncoder.call(this, entity), this.enc = "pem";
            }
            inherits(PEMEncoder, DEREncoder), (module.exports = PEMEncoder).prototype.encode = function(data, options) {
                for (var p = DEREncoder.prototype.encode.call(this, data).toString("base64"), out = [ "-----BEGIN " + options.label + "-----" ], i = 0; i < p.length; i += 64) out.push(p.slice(i, i + 64));
                return out.push("-----END " + options.label + "-----"), out.join("\n");
            };
        }, {
            "./der": 38,
            inherits: 152
        } ],
        41: [ function(require, module, exports) {
            "use strict";
            exports.byteLength = function(b64) {
                return 3 * b64.length / 4 - placeHoldersCount(b64);
            }, exports.toByteArray = function(b64) {
                var i, l, tmp, placeHolders, arr, len = b64.length;
                placeHolders = placeHoldersCount(b64), arr = new Arr(3 * len / 4 - placeHolders), 
                l = 0 < placeHolders ? len - 4 : len;
                var L = 0;
                for (i = 0; i < l; i += 4) tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)], 
                arr[L++] = tmp >> 16 & 255, arr[L++] = tmp >> 8 & 255, arr[L++] = 255 & tmp;
                2 === placeHolders ? (tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4, 
                arr[L++] = 255 & tmp) : 1 === placeHolders && (tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2, 
                arr[L++] = tmp >> 8 & 255, arr[L++] = 255 & tmp);
                return arr;
            }, exports.fromByteArray = function(uint8) {
                for (var tmp, len = uint8.length, extraBytes = len % 3, output = "", parts = [], i = 0, len2 = len - extraBytes; i < len2; i += 16383) parts.push(encodeChunk(uint8, i, len2 < i + 16383 ? len2 : i + 16383));
                1 === extraBytes ? (tmp = uint8[len - 1], output += lookup[tmp >> 2], output += lookup[tmp << 4 & 63], 
                output += "==") : 2 === extraBytes && (tmp = (uint8[len - 2] << 8) + uint8[len - 1], 
                output += lookup[tmp >> 10], output += lookup[tmp >> 4 & 63], output += lookup[tmp << 2 & 63], 
                output += "=");
                return parts.push(output), parts.join("");
            };
            for (var lookup = [], revLookup = [], Arr = "undefined" != typeof Uint8Array ? Uint8Array : Array, code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = 0, len = code.length; i < len; ++i) lookup[i] = code[i], 
            revLookup[code.charCodeAt(i)] = i;
            function placeHoldersCount(b64) {
                var len = b64.length;
                if (0 < len % 4) throw new Error("Invalid string. Length must be a multiple of 4");
                return "=" === b64[len - 2] ? 2 : "=" === b64[len - 1] ? 1 : 0;
            }
            function encodeChunk(uint8, start, end) {
                for (var tmp, num, output = [], i = start; i < end; i += 3) tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + uint8[i + 2], 
                output.push(lookup[(num = tmp) >> 18 & 63] + lookup[num >> 12 & 63] + lookup[num >> 6 & 63] + lookup[63 & num]);
                return output.join("");
            }
            revLookup["-".charCodeAt(0)] = 62, revLookup["_".charCodeAt(0)] = 63;
        }, {} ],
        42: [ function(require, module, exports) {
            !function(module, exports) {
                "use strict";
                function assert(val, msg) {
                    if (!val) throw new Error(msg || "Assertion failed");
                }
                function inherits(ctor, superCtor) {
                    ctor.super_ = superCtor;
                    var TempCtor = function() {};
                    TempCtor.prototype = superCtor.prototype, ctor.prototype = new TempCtor(), ctor.prototype.constructor = ctor;
                }
                function BN(number, base, endian) {
                    if (BN.isBN(number)) return number;
                    this.negative = 0, this.words = null, this.length = 0, (this.red = null) !== number && ("le" !== base && "be" !== base || (endian = base, 
                    base = 10), this._init(number || 0, base || 10, endian || "be"));
                }
                var Buffer;
                "object" == typeof module ? module.exports = BN : exports.BN = BN, (BN.BN = BN).wordSize = 26;
                try {
                    Buffer = require("buffer").Buffer;
                } catch (e) {}
                function parseHex(str, start, end) {
                    for (var r = 0, len = Math.min(str.length, end), i = start; i < len; i++) {
                        var c = str.charCodeAt(i) - 48;
                        r <<= 4, r |= 49 <= c && c <= 54 ? c - 49 + 10 : 17 <= c && c <= 22 ? c - 17 + 10 : 15 & c;
                    }
                    return r;
                }
                function parseBase(str, start, end, mul) {
                    for (var r = 0, len = Math.min(str.length, end), i = start; i < len; i++) {
                        var c = str.charCodeAt(i) - 48;
                        r *= mul, r += 49 <= c ? c - 49 + 10 : 17 <= c ? c - 17 + 10 : c;
                    }
                    return r;
                }
                BN.isBN = function(num) {
                    return num instanceof BN || null !== num && "object" == typeof num && num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);
                }, BN.max = function(left, right) {
                    return 0 < left.cmp(right) ? left : right;
                }, BN.min = function(left, right) {
                    return left.cmp(right) < 0 ? left : right;
                }, BN.prototype._init = function(number, base, endian) {
                    if ("number" == typeof number) return this._initNumber(number, base, endian);
                    if ("object" == typeof number) return this._initArray(number, base, endian);
                    "hex" === base && (base = 16), assert(base === (0 | base) && 2 <= base && base <= 36);
                    var start = 0;
                    "-" === (number = number.toString().replace(/\s+/g, ""))[0] && start++, 16 === base ? this._parseHex(number, start) : this._parseBase(number, base, start), 
                    "-" === number[0] && (this.negative = 1), this.strip(), "le" === endian && this._initArray(this.toArray(), base, endian);
                }, BN.prototype._initNumber = function(number, base, endian) {
                    number < 0 && (this.negative = 1, number = -number), number < 67108864 ? (this.words = [ 67108863 & number ], 
                    this.length = 1) : number < 4503599627370496 ? (this.words = [ 67108863 & number, number / 67108864 & 67108863 ], 
                    this.length = 2) : (assert(number < 9007199254740992), this.words = [ 67108863 & number, number / 67108864 & 67108863, 1 ], 
                    this.length = 3), "le" === endian && this._initArray(this.toArray(), base, endian);
                }, BN.prototype._initArray = function(number, base, endian) {
                    if (assert("number" == typeof number.length), number.length <= 0) return this.words = [ 0 ], 
                    this.length = 1, this;
                    this.length = Math.ceil(number.length / 3), this.words = new Array(this.length);
                    for (var i = 0; i < this.length; i++) this.words[i] = 0;
                    var j, w, off = 0;
                    if ("be" === endian) for (i = number.length - 1, j = 0; 0 <= i; i -= 3) w = number[i] | number[i - 1] << 8 | number[i - 2] << 16, 
                    this.words[j] |= w << off & 67108863, this.words[j + 1] = w >>> 26 - off & 67108863, 
                    26 <= (off += 24) && (off -= 26, j++); else if ("le" === endian) for (j = i = 0; i < number.length; i += 3) w = number[i] | number[i + 1] << 8 | number[i + 2] << 16, 
                    this.words[j] |= w << off & 67108863, this.words[j + 1] = w >>> 26 - off & 67108863, 
                    26 <= (off += 24) && (off -= 26, j++);
                    return this.strip();
                }, BN.prototype._parseHex = function(number, start) {
                    this.length = Math.ceil((number.length - start) / 6), this.words = new Array(this.length);
                    for (var i = 0; i < this.length; i++) this.words[i] = 0;
                    var j, w, off = 0;
                    for (i = number.length - 6, j = 0; start <= i; i -= 6) w = parseHex(number, i, i + 6), 
                    this.words[j] |= w << off & 67108863, this.words[j + 1] |= w >>> 26 - off & 4194303, 
                    26 <= (off += 24) && (off -= 26, j++);
                    i + 6 !== start && (w = parseHex(number, start, i + 6), this.words[j] |= w << off & 67108863, 
                    this.words[j + 1] |= w >>> 26 - off & 4194303), this.strip();
                }, BN.prototype._parseBase = function(number, base, start) {
                    this.words = [ 0 ];
                    for (var limbLen = 0, limbPow = this.length = 1; limbPow <= 67108863; limbPow *= base) limbLen++;
                    limbLen--, limbPow = limbPow / base | 0;
                    for (var total = number.length - start, mod = total % limbLen, end = Math.min(total, total - mod) + start, word = 0, i = start; i < end; i += limbLen) word = parseBase(number, i, i + limbLen, base), 
                    this.imuln(limbPow), this.words[0] + word < 67108864 ? this.words[0] += word : this._iaddn(word);
                    if (0 !== mod) {
                        var pow = 1;
                        for (word = parseBase(number, i, number.length, base), i = 0; i < mod; i++) pow *= base;
                        this.imuln(pow), this.words[0] + word < 67108864 ? this.words[0] += word : this._iaddn(word);
                    }
                }, BN.prototype.copy = function(dest) {
                    dest.words = new Array(this.length);
                    for (var i = 0; i < this.length; i++) dest.words[i] = this.words[i];
                    dest.length = this.length, dest.negative = this.negative, dest.red = this.red;
                }, BN.prototype.clone = function() {
                    var r = new BN(null);
                    return this.copy(r), r;
                }, BN.prototype._expand = function(size) {
                    for (;this.length < size; ) this.words[this.length++] = 0;
                    return this;
                }, BN.prototype.strip = function() {
                    for (;1 < this.length && 0 === this.words[this.length - 1]; ) this.length--;
                    return this._normSign();
                }, BN.prototype._normSign = function() {
                    return 1 === this.length && 0 === this.words[0] && (this.negative = 0), this;
                }, BN.prototype.inspect = function() {
                    return (this.red ? "<BN-R: " : "<BN: ") + this.toString(16) + ">";
                };
                var zeros = [ "", "0", "00", "000", "0000", "00000", "000000", "0000000", "00000000", "000000000", "0000000000", "00000000000", "000000000000", "0000000000000", "00000000000000", "000000000000000", "0000000000000000", "00000000000000000", "000000000000000000", "0000000000000000000", "00000000000000000000", "000000000000000000000", "0000000000000000000000", "00000000000000000000000", "000000000000000000000000", "0000000000000000000000000" ], groupSizes = [ 0, 0, 25, 16, 12, 11, 10, 9, 8, 8, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ], groupBases = [ 0, 0, 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, 43046721, 1e7, 19487171, 35831808, 62748517, 7529536, 11390625, 16777216, 24137569, 34012224, 47045881, 64e6, 4084101, 5153632, 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, 243e5, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 ];
                function smallMulTo(self, num, out) {
                    out.negative = num.negative ^ self.negative;
                    var len = self.length + num.length | 0;
                    len = (out.length = len) - 1 | 0;
                    var a = 0 | self.words[0], b = 0 | num.words[0], r = a * b, lo = 67108863 & r, carry = r / 67108864 | 0;
                    out.words[0] = lo;
                    for (var k = 1; k < len; k++) {
                        for (var ncarry = carry >>> 26, rword = 67108863 & carry, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
                            var i = k - j | 0;
                            ncarry += (r = (a = 0 | self.words[i]) * (b = 0 | num.words[j]) + rword) / 67108864 | 0, 
                            rword = 67108863 & r;
                        }
                        out.words[k] = 0 | rword, carry = 0 | ncarry;
                    }
                    return 0 !== carry ? out.words[k] = 0 | carry : out.length--, out.strip();
                }
                BN.prototype.toString = function(base, padding) {
                    var out;
                    if (padding = 0 | padding || 1, 16 === (base = base || 10) || "hex" === base) {
                        out = "";
                        for (var off = 0, carry = 0, i = 0; i < this.length; i++) {
                            var w = this.words[i], word = (16777215 & (w << off | carry)).toString(16);
                            out = 0 !== (carry = w >>> 24 - off & 16777215) || i !== this.length - 1 ? zeros[6 - word.length] + word + out : word + out, 
                            26 <= (off += 2) && (off -= 26, i--);
                        }
                        for (0 !== carry && (out = carry.toString(16) + out); out.length % padding != 0; ) out = "0" + out;
                        return 0 !== this.negative && (out = "-" + out), out;
                    }
                    if (base === (0 | base) && 2 <= base && base <= 36) {
                        var groupSize = groupSizes[base], groupBase = groupBases[base];
                        out = "";
                        var c = this.clone();
                        for (c.negative = 0; !c.isZero(); ) {
                            var r = c.modn(groupBase).toString(base);
                            out = (c = c.idivn(groupBase)).isZero() ? r + out : zeros[groupSize - r.length] + r + out;
                        }
                        for (this.isZero() && (out = "0" + out); out.length % padding != 0; ) out = "0" + out;
                        return 0 !== this.negative && (out = "-" + out), out;
                    }
                    assert(!1, "Base should be between 2 and 36");
                }, BN.prototype.toNumber = function() {
                    var ret = this.words[0];
                    return 2 === this.length ? ret += 67108864 * this.words[1] : 3 === this.length && 1 === this.words[2] ? ret += 4503599627370496 + 67108864 * this.words[1] : 2 < this.length && assert(!1, "Number can only safely store up to 53 bits"), 
                    0 !== this.negative ? -ret : ret;
                }, BN.prototype.toJSON = function() {
                    return this.toString(16);
                }, BN.prototype.toBuffer = function(endian, length) {
                    return assert(void 0 !== Buffer), this.toArrayLike(Buffer, endian, length);
                }, BN.prototype.toArray = function(endian, length) {
                    return this.toArrayLike(Array, endian, length);
                }, BN.prototype.toArrayLike = function(ArrayType, endian, length) {
                    var byteLength = this.byteLength(), reqLength = length || Math.max(1, byteLength);
                    assert(byteLength <= reqLength, "byte array longer than desired length"), assert(0 < reqLength, "Requested array length <= 0"), 
                    this.strip();
                    var b, i, littleEndian = "le" === endian, res = new ArrayType(reqLength), q = this.clone();
                    if (littleEndian) {
                        for (i = 0; !q.isZero(); i++) b = q.andln(255), q.iushrn(8), res[i] = b;
                        for (;i < reqLength; i++) res[i] = 0;
                    } else {
                        for (i = 0; i < reqLength - byteLength; i++) res[i] = 0;
                        for (i = 0; !q.isZero(); i++) b = q.andln(255), q.iushrn(8), res[reqLength - i - 1] = b;
                    }
                    return res;
                }, BN.prototype._countBits = Math.clz32 ? function(w) {
                    return 32 - Math.clz32(w);
                } : function(w) {
                    var t = w, r = 0;
                    return 4096 <= t && (r += 13, t >>>= 13), 64 <= t && (r += 7, t >>>= 7), 8 <= t && (r += 4, 
                    t >>>= 4), 2 <= t && (r += 2, t >>>= 2), r + t;
                }, BN.prototype._zeroBits = function(w) {
                    if (0 === w) return 26;
                    var t = w, r = 0;
                    return 0 == (8191 & t) && (r += 13, t >>>= 13), 0 == (127 & t) && (r += 7, t >>>= 7), 
                    0 == (15 & t) && (r += 4, t >>>= 4), 0 == (3 & t) && (r += 2, t >>>= 2), 0 == (1 & t) && r++, 
                    r;
                }, BN.prototype.bitLength = function() {
                    var w = this.words[this.length - 1], hi = this._countBits(w);
                    return 26 * (this.length - 1) + hi;
                }, BN.prototype.zeroBits = function() {
                    if (this.isZero()) return 0;
                    for (var r = 0, i = 0; i < this.length; i++) {
                        var b = this._zeroBits(this.words[i]);
                        if (r += b, 26 !== b) break;
                    }
                    return r;
                }, BN.prototype.byteLength = function() {
                    return Math.ceil(this.bitLength() / 8);
                }, BN.prototype.toTwos = function(width) {
                    return 0 !== this.negative ? this.abs().inotn(width).iaddn(1) : this.clone();
                }, BN.prototype.fromTwos = function(width) {
                    return this.testn(width - 1) ? this.notn(width).iaddn(1).ineg() : this.clone();
                }, BN.prototype.isNeg = function() {
                    return 0 !== this.negative;
                }, BN.prototype.neg = function() {
                    return this.clone().ineg();
                }, BN.prototype.ineg = function() {
                    return this.isZero() || (this.negative ^= 1), this;
                }, BN.prototype.iuor = function(num) {
                    for (;this.length < num.length; ) this.words[this.length++] = 0;
                    for (var i = 0; i < num.length; i++) this.words[i] = this.words[i] | num.words[i];
                    return this.strip();
                }, BN.prototype.ior = function(num) {
                    return assert(0 == (this.negative | num.negative)), this.iuor(num);
                }, BN.prototype.or = function(num) {
                    return this.length > num.length ? this.clone().ior(num) : num.clone().ior(this);
                }, BN.prototype.uor = function(num) {
                    return this.length > num.length ? this.clone().iuor(num) : num.clone().iuor(this);
                }, BN.prototype.iuand = function(num) {
                    var b;
                    b = this.length > num.length ? num : this;
                    for (var i = 0; i < b.length; i++) this.words[i] = this.words[i] & num.words[i];
                    return this.length = b.length, this.strip();
                }, BN.prototype.iand = function(num) {
                    return assert(0 == (this.negative | num.negative)), this.iuand(num);
                }, BN.prototype.and = function(num) {
                    return this.length > num.length ? this.clone().iand(num) : num.clone().iand(this);
                }, BN.prototype.uand = function(num) {
                    return this.length > num.length ? this.clone().iuand(num) : num.clone().iuand(this);
                }, BN.prototype.iuxor = function(num) {
                    var a, b;
                    this.length > num.length ? (a = this, b = num) : (a = num, b = this);
                    for (var i = 0; i < b.length; i++) this.words[i] = a.words[i] ^ b.words[i];
                    if (this !== a) for (;i < a.length; i++) this.words[i] = a.words[i];
                    return this.length = a.length, this.strip();
                }, BN.prototype.ixor = function(num) {
                    return assert(0 == (this.negative | num.negative)), this.iuxor(num);
                }, BN.prototype.xor = function(num) {
                    return this.length > num.length ? this.clone().ixor(num) : num.clone().ixor(this);
                }, BN.prototype.uxor = function(num) {
                    return this.length > num.length ? this.clone().iuxor(num) : num.clone().iuxor(this);
                }, BN.prototype.inotn = function(width) {
                    assert("number" == typeof width && 0 <= width);
                    var bytesNeeded = 0 | Math.ceil(width / 26), bitsLeft = width % 26;
                    this._expand(bytesNeeded), 0 < bitsLeft && bytesNeeded--;
                    for (var i = 0; i < bytesNeeded; i++) this.words[i] = 67108863 & ~this.words[i];
                    return 0 < bitsLeft && (this.words[i] = ~this.words[i] & 67108863 >> 26 - bitsLeft), 
                    this.strip();
                }, BN.prototype.notn = function(width) {
                    return this.clone().inotn(width);
                }, BN.prototype.setn = function(bit, val) {
                    assert("number" == typeof bit && 0 <= bit);
                    var off = bit / 26 | 0, wbit = bit % 26;
                    return this._expand(off + 1), this.words[off] = val ? this.words[off] | 1 << wbit : this.words[off] & ~(1 << wbit), 
                    this.strip();
                }, BN.prototype.iadd = function(num) {
                    var r, a, b;
                    if (0 !== this.negative && 0 === num.negative) return this.negative = 0, r = this.isub(num), 
                    this.negative ^= 1, this._normSign();
                    if (0 === this.negative && 0 !== num.negative) return num.negative = 0, r = this.isub(num), 
                    num.negative = 1, r._normSign();
                    this.length > num.length ? (a = this, b = num) : (a = num, b = this);
                    for (var carry = 0, i = 0; i < b.length; i++) r = (0 | a.words[i]) + (0 | b.words[i]) + carry, 
                    this.words[i] = 67108863 & r, carry = r >>> 26;
                    for (;0 !== carry && i < a.length; i++) r = (0 | a.words[i]) + carry, this.words[i] = 67108863 & r, 
                    carry = r >>> 26;
                    if (this.length = a.length, 0 !== carry) this.words[this.length] = carry, this.length++; else if (a !== this) for (;i < a.length; i++) this.words[i] = a.words[i];
                    return this;
                }, BN.prototype.add = function(num) {
                    var res;
                    return 0 !== num.negative && 0 === this.negative ? (num.negative = 0, res = this.sub(num), 
                    num.negative ^= 1, res) : 0 === num.negative && 0 !== this.negative ? (this.negative = 0, 
                    res = num.sub(this), this.negative = 1, res) : this.length > num.length ? this.clone().iadd(num) : num.clone().iadd(this);
                }, BN.prototype.isub = function(num) {
                    if (0 !== num.negative) {
                        num.negative = 0;
                        var r = this.iadd(num);
                        return num.negative = 1, r._normSign();
                    }
                    if (0 !== this.negative) return this.negative = 0, this.iadd(num), this.negative = 1, 
                    this._normSign();
                    var a, b, cmp = this.cmp(num);
                    if (0 === cmp) return this.negative = 0, this.length = 1, this.words[0] = 0, this;
                    0 < cmp ? (a = this, b = num) : (a = num, b = this);
                    for (var carry = 0, i = 0; i < b.length; i++) carry = (r = (0 | a.words[i]) - (0 | b.words[i]) + carry) >> 26, 
                    this.words[i] = 67108863 & r;
                    for (;0 !== carry && i < a.length; i++) carry = (r = (0 | a.words[i]) + carry) >> 26, 
                    this.words[i] = 67108863 & r;
                    if (0 === carry && i < a.length && a !== this) for (;i < a.length; i++) this.words[i] = a.words[i];
                    return this.length = Math.max(this.length, i), a !== this && (this.negative = 1), 
                    this.strip();
                }, BN.prototype.sub = function(num) {
                    return this.clone().isub(num);
                };
                var comb10MulTo = function(self, num, out) {
                    var lo, mid, hi, a = self.words, b = num.words, o = out.words, c = 0, a0 = 0 | a[0], al0 = 8191 & a0, ah0 = a0 >>> 13, a1 = 0 | a[1], al1 = 8191 & a1, ah1 = a1 >>> 13, a2 = 0 | a[2], al2 = 8191 & a2, ah2 = a2 >>> 13, a3 = 0 | a[3], al3 = 8191 & a3, ah3 = a3 >>> 13, a4 = 0 | a[4], al4 = 8191 & a4, ah4 = a4 >>> 13, a5 = 0 | a[5], al5 = 8191 & a5, ah5 = a5 >>> 13, a6 = 0 | a[6], al6 = 8191 & a6, ah6 = a6 >>> 13, a7 = 0 | a[7], al7 = 8191 & a7, ah7 = a7 >>> 13, a8 = 0 | a[8], al8 = 8191 & a8, ah8 = a8 >>> 13, a9 = 0 | a[9], al9 = 8191 & a9, ah9 = a9 >>> 13, b0 = 0 | b[0], bl0 = 8191 & b0, bh0 = b0 >>> 13, b1 = 0 | b[1], bl1 = 8191 & b1, bh1 = b1 >>> 13, b2 = 0 | b[2], bl2 = 8191 & b2, bh2 = b2 >>> 13, b3 = 0 | b[3], bl3 = 8191 & b3, bh3 = b3 >>> 13, b4 = 0 | b[4], bl4 = 8191 & b4, bh4 = b4 >>> 13, b5 = 0 | b[5], bl5 = 8191 & b5, bh5 = b5 >>> 13, b6 = 0 | b[6], bl6 = 8191 & b6, bh6 = b6 >>> 13, b7 = 0 | b[7], bl7 = 8191 & b7, bh7 = b7 >>> 13, b8 = 0 | b[8], bl8 = 8191 & b8, bh8 = b8 >>> 13, b9 = 0 | b[9], bl9 = 8191 & b9, bh9 = b9 >>> 13;
                    out.negative = self.negative ^ num.negative, out.length = 19;
                    var w0 = (c + (lo = Math.imul(al0, bl0)) | 0) + ((8191 & (mid = (mid = Math.imul(al0, bh0)) + Math.imul(ah0, bl0) | 0)) << 13) | 0;
                    c = ((hi = Math.imul(ah0, bh0)) + (mid >>> 13) | 0) + (w0 >>> 26) | 0, w0 &= 67108863, 
                    lo = Math.imul(al1, bl0), mid = (mid = Math.imul(al1, bh0)) + Math.imul(ah1, bl0) | 0, 
                    hi = Math.imul(ah1, bh0);
                    var w1 = (c + (lo = lo + Math.imul(al0, bl1) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al0, bh1) | 0) + Math.imul(ah0, bl1) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah0, bh1) | 0) + (mid >>> 13) | 0) + (w1 >>> 26) | 0, 
                    w1 &= 67108863, lo = Math.imul(al2, bl0), mid = (mid = Math.imul(al2, bh0)) + Math.imul(ah2, bl0) | 0, 
                    hi = Math.imul(ah2, bh0), lo = lo + Math.imul(al1, bl1) | 0, mid = (mid = mid + Math.imul(al1, bh1) | 0) + Math.imul(ah1, bl1) | 0, 
                    hi = hi + Math.imul(ah1, bh1) | 0;
                    var w2 = (c + (lo = lo + Math.imul(al0, bl2) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al0, bh2) | 0) + Math.imul(ah0, bl2) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah0, bh2) | 0) + (mid >>> 13) | 0) + (w2 >>> 26) | 0, 
                    w2 &= 67108863, lo = Math.imul(al3, bl0), mid = (mid = Math.imul(al3, bh0)) + Math.imul(ah3, bl0) | 0, 
                    hi = Math.imul(ah3, bh0), lo = lo + Math.imul(al2, bl1) | 0, mid = (mid = mid + Math.imul(al2, bh1) | 0) + Math.imul(ah2, bl1) | 0, 
                    hi = hi + Math.imul(ah2, bh1) | 0, lo = lo + Math.imul(al1, bl2) | 0, mid = (mid = mid + Math.imul(al1, bh2) | 0) + Math.imul(ah1, bl2) | 0, 
                    hi = hi + Math.imul(ah1, bh2) | 0;
                    var w3 = (c + (lo = lo + Math.imul(al0, bl3) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al0, bh3) | 0) + Math.imul(ah0, bl3) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah0, bh3) | 0) + (mid >>> 13) | 0) + (w3 >>> 26) | 0, 
                    w3 &= 67108863, lo = Math.imul(al4, bl0), mid = (mid = Math.imul(al4, bh0)) + Math.imul(ah4, bl0) | 0, 
                    hi = Math.imul(ah4, bh0), lo = lo + Math.imul(al3, bl1) | 0, mid = (mid = mid + Math.imul(al3, bh1) | 0) + Math.imul(ah3, bl1) | 0, 
                    hi = hi + Math.imul(ah3, bh1) | 0, lo = lo + Math.imul(al2, bl2) | 0, mid = (mid = mid + Math.imul(al2, bh2) | 0) + Math.imul(ah2, bl2) | 0, 
                    hi = hi + Math.imul(ah2, bh2) | 0, lo = lo + Math.imul(al1, bl3) | 0, mid = (mid = mid + Math.imul(al1, bh3) | 0) + Math.imul(ah1, bl3) | 0, 
                    hi = hi + Math.imul(ah1, bh3) | 0;
                    var w4 = (c + (lo = lo + Math.imul(al0, bl4) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al0, bh4) | 0) + Math.imul(ah0, bl4) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah0, bh4) | 0) + (mid >>> 13) | 0) + (w4 >>> 26) | 0, 
                    w4 &= 67108863, lo = Math.imul(al5, bl0), mid = (mid = Math.imul(al5, bh0)) + Math.imul(ah5, bl0) | 0, 
                    hi = Math.imul(ah5, bh0), lo = lo + Math.imul(al4, bl1) | 0, mid = (mid = mid + Math.imul(al4, bh1) | 0) + Math.imul(ah4, bl1) | 0, 
                    hi = hi + Math.imul(ah4, bh1) | 0, lo = lo + Math.imul(al3, bl2) | 0, mid = (mid = mid + Math.imul(al3, bh2) | 0) + Math.imul(ah3, bl2) | 0, 
                    hi = hi + Math.imul(ah3, bh2) | 0, lo = lo + Math.imul(al2, bl3) | 0, mid = (mid = mid + Math.imul(al2, bh3) | 0) + Math.imul(ah2, bl3) | 0, 
                    hi = hi + Math.imul(ah2, bh3) | 0, lo = lo + Math.imul(al1, bl4) | 0, mid = (mid = mid + Math.imul(al1, bh4) | 0) + Math.imul(ah1, bl4) | 0, 
                    hi = hi + Math.imul(ah1, bh4) | 0;
                    var w5 = (c + (lo = lo + Math.imul(al0, bl5) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al0, bh5) | 0) + Math.imul(ah0, bl5) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah0, bh5) | 0) + (mid >>> 13) | 0) + (w5 >>> 26) | 0, 
                    w5 &= 67108863, lo = Math.imul(al6, bl0), mid = (mid = Math.imul(al6, bh0)) + Math.imul(ah6, bl0) | 0, 
                    hi = Math.imul(ah6, bh0), lo = lo + Math.imul(al5, bl1) | 0, mid = (mid = mid + Math.imul(al5, bh1) | 0) + Math.imul(ah5, bl1) | 0, 
                    hi = hi + Math.imul(ah5, bh1) | 0, lo = lo + Math.imul(al4, bl2) | 0, mid = (mid = mid + Math.imul(al4, bh2) | 0) + Math.imul(ah4, bl2) | 0, 
                    hi = hi + Math.imul(ah4, bh2) | 0, lo = lo + Math.imul(al3, bl3) | 0, mid = (mid = mid + Math.imul(al3, bh3) | 0) + Math.imul(ah3, bl3) | 0, 
                    hi = hi + Math.imul(ah3, bh3) | 0, lo = lo + Math.imul(al2, bl4) | 0, mid = (mid = mid + Math.imul(al2, bh4) | 0) + Math.imul(ah2, bl4) | 0, 
                    hi = hi + Math.imul(ah2, bh4) | 0, lo = lo + Math.imul(al1, bl5) | 0, mid = (mid = mid + Math.imul(al1, bh5) | 0) + Math.imul(ah1, bl5) | 0, 
                    hi = hi + Math.imul(ah1, bh5) | 0;
                    var w6 = (c + (lo = lo + Math.imul(al0, bl6) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al0, bh6) | 0) + Math.imul(ah0, bl6) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah0, bh6) | 0) + (mid >>> 13) | 0) + (w6 >>> 26) | 0, 
                    w6 &= 67108863, lo = Math.imul(al7, bl0), mid = (mid = Math.imul(al7, bh0)) + Math.imul(ah7, bl0) | 0, 
                    hi = Math.imul(ah7, bh0), lo = lo + Math.imul(al6, bl1) | 0, mid = (mid = mid + Math.imul(al6, bh1) | 0) + Math.imul(ah6, bl1) | 0, 
                    hi = hi + Math.imul(ah6, bh1) | 0, lo = lo + Math.imul(al5, bl2) | 0, mid = (mid = mid + Math.imul(al5, bh2) | 0) + Math.imul(ah5, bl2) | 0, 
                    hi = hi + Math.imul(ah5, bh2) | 0, lo = lo + Math.imul(al4, bl3) | 0, mid = (mid = mid + Math.imul(al4, bh3) | 0) + Math.imul(ah4, bl3) | 0, 
                    hi = hi + Math.imul(ah4, bh3) | 0, lo = lo + Math.imul(al3, bl4) | 0, mid = (mid = mid + Math.imul(al3, bh4) | 0) + Math.imul(ah3, bl4) | 0, 
                    hi = hi + Math.imul(ah3, bh4) | 0, lo = lo + Math.imul(al2, bl5) | 0, mid = (mid = mid + Math.imul(al2, bh5) | 0) + Math.imul(ah2, bl5) | 0, 
                    hi = hi + Math.imul(ah2, bh5) | 0, lo = lo + Math.imul(al1, bl6) | 0, mid = (mid = mid + Math.imul(al1, bh6) | 0) + Math.imul(ah1, bl6) | 0, 
                    hi = hi + Math.imul(ah1, bh6) | 0;
                    var w7 = (c + (lo = lo + Math.imul(al0, bl7) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al0, bh7) | 0) + Math.imul(ah0, bl7) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah0, bh7) | 0) + (mid >>> 13) | 0) + (w7 >>> 26) | 0, 
                    w7 &= 67108863, lo = Math.imul(al8, bl0), mid = (mid = Math.imul(al8, bh0)) + Math.imul(ah8, bl0) | 0, 
                    hi = Math.imul(ah8, bh0), lo = lo + Math.imul(al7, bl1) | 0, mid = (mid = mid + Math.imul(al7, bh1) | 0) + Math.imul(ah7, bl1) | 0, 
                    hi = hi + Math.imul(ah7, bh1) | 0, lo = lo + Math.imul(al6, bl2) | 0, mid = (mid = mid + Math.imul(al6, bh2) | 0) + Math.imul(ah6, bl2) | 0, 
                    hi = hi + Math.imul(ah6, bh2) | 0, lo = lo + Math.imul(al5, bl3) | 0, mid = (mid = mid + Math.imul(al5, bh3) | 0) + Math.imul(ah5, bl3) | 0, 
                    hi = hi + Math.imul(ah5, bh3) | 0, lo = lo + Math.imul(al4, bl4) | 0, mid = (mid = mid + Math.imul(al4, bh4) | 0) + Math.imul(ah4, bl4) | 0, 
                    hi = hi + Math.imul(ah4, bh4) | 0, lo = lo + Math.imul(al3, bl5) | 0, mid = (mid = mid + Math.imul(al3, bh5) | 0) + Math.imul(ah3, bl5) | 0, 
                    hi = hi + Math.imul(ah3, bh5) | 0, lo = lo + Math.imul(al2, bl6) | 0, mid = (mid = mid + Math.imul(al2, bh6) | 0) + Math.imul(ah2, bl6) | 0, 
                    hi = hi + Math.imul(ah2, bh6) | 0, lo = lo + Math.imul(al1, bl7) | 0, mid = (mid = mid + Math.imul(al1, bh7) | 0) + Math.imul(ah1, bl7) | 0, 
                    hi = hi + Math.imul(ah1, bh7) | 0;
                    var w8 = (c + (lo = lo + Math.imul(al0, bl8) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al0, bh8) | 0) + Math.imul(ah0, bl8) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah0, bh8) | 0) + (mid >>> 13) | 0) + (w8 >>> 26) | 0, 
                    w8 &= 67108863, lo = Math.imul(al9, bl0), mid = (mid = Math.imul(al9, bh0)) + Math.imul(ah9, bl0) | 0, 
                    hi = Math.imul(ah9, bh0), lo = lo + Math.imul(al8, bl1) | 0, mid = (mid = mid + Math.imul(al8, bh1) | 0) + Math.imul(ah8, bl1) | 0, 
                    hi = hi + Math.imul(ah8, bh1) | 0, lo = lo + Math.imul(al7, bl2) | 0, mid = (mid = mid + Math.imul(al7, bh2) | 0) + Math.imul(ah7, bl2) | 0, 
                    hi = hi + Math.imul(ah7, bh2) | 0, lo = lo + Math.imul(al6, bl3) | 0, mid = (mid = mid + Math.imul(al6, bh3) | 0) + Math.imul(ah6, bl3) | 0, 
                    hi = hi + Math.imul(ah6, bh3) | 0, lo = lo + Math.imul(al5, bl4) | 0, mid = (mid = mid + Math.imul(al5, bh4) | 0) + Math.imul(ah5, bl4) | 0, 
                    hi = hi + Math.imul(ah5, bh4) | 0, lo = lo + Math.imul(al4, bl5) | 0, mid = (mid = mid + Math.imul(al4, bh5) | 0) + Math.imul(ah4, bl5) | 0, 
                    hi = hi + Math.imul(ah4, bh5) | 0, lo = lo + Math.imul(al3, bl6) | 0, mid = (mid = mid + Math.imul(al3, bh6) | 0) + Math.imul(ah3, bl6) | 0, 
                    hi = hi + Math.imul(ah3, bh6) | 0, lo = lo + Math.imul(al2, bl7) | 0, mid = (mid = mid + Math.imul(al2, bh7) | 0) + Math.imul(ah2, bl7) | 0, 
                    hi = hi + Math.imul(ah2, bh7) | 0, lo = lo + Math.imul(al1, bl8) | 0, mid = (mid = mid + Math.imul(al1, bh8) | 0) + Math.imul(ah1, bl8) | 0, 
                    hi = hi + Math.imul(ah1, bh8) | 0;
                    var w9 = (c + (lo = lo + Math.imul(al0, bl9) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al0, bh9) | 0) + Math.imul(ah0, bl9) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah0, bh9) | 0) + (mid >>> 13) | 0) + (w9 >>> 26) | 0, 
                    w9 &= 67108863, lo = Math.imul(al9, bl1), mid = (mid = Math.imul(al9, bh1)) + Math.imul(ah9, bl1) | 0, 
                    hi = Math.imul(ah9, bh1), lo = lo + Math.imul(al8, bl2) | 0, mid = (mid = mid + Math.imul(al8, bh2) | 0) + Math.imul(ah8, bl2) | 0, 
                    hi = hi + Math.imul(ah8, bh2) | 0, lo = lo + Math.imul(al7, bl3) | 0, mid = (mid = mid + Math.imul(al7, bh3) | 0) + Math.imul(ah7, bl3) | 0, 
                    hi = hi + Math.imul(ah7, bh3) | 0, lo = lo + Math.imul(al6, bl4) | 0, mid = (mid = mid + Math.imul(al6, bh4) | 0) + Math.imul(ah6, bl4) | 0, 
                    hi = hi + Math.imul(ah6, bh4) | 0, lo = lo + Math.imul(al5, bl5) | 0, mid = (mid = mid + Math.imul(al5, bh5) | 0) + Math.imul(ah5, bl5) | 0, 
                    hi = hi + Math.imul(ah5, bh5) | 0, lo = lo + Math.imul(al4, bl6) | 0, mid = (mid = mid + Math.imul(al4, bh6) | 0) + Math.imul(ah4, bl6) | 0, 
                    hi = hi + Math.imul(ah4, bh6) | 0, lo = lo + Math.imul(al3, bl7) | 0, mid = (mid = mid + Math.imul(al3, bh7) | 0) + Math.imul(ah3, bl7) | 0, 
                    hi = hi + Math.imul(ah3, bh7) | 0, lo = lo + Math.imul(al2, bl8) | 0, mid = (mid = mid + Math.imul(al2, bh8) | 0) + Math.imul(ah2, bl8) | 0, 
                    hi = hi + Math.imul(ah2, bh8) | 0;
                    var w10 = (c + (lo = lo + Math.imul(al1, bl9) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al1, bh9) | 0) + Math.imul(ah1, bl9) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah1, bh9) | 0) + (mid >>> 13) | 0) + (w10 >>> 26) | 0, 
                    w10 &= 67108863, lo = Math.imul(al9, bl2), mid = (mid = Math.imul(al9, bh2)) + Math.imul(ah9, bl2) | 0, 
                    hi = Math.imul(ah9, bh2), lo = lo + Math.imul(al8, bl3) | 0, mid = (mid = mid + Math.imul(al8, bh3) | 0) + Math.imul(ah8, bl3) | 0, 
                    hi = hi + Math.imul(ah8, bh3) | 0, lo = lo + Math.imul(al7, bl4) | 0, mid = (mid = mid + Math.imul(al7, bh4) | 0) + Math.imul(ah7, bl4) | 0, 
                    hi = hi + Math.imul(ah7, bh4) | 0, lo = lo + Math.imul(al6, bl5) | 0, mid = (mid = mid + Math.imul(al6, bh5) | 0) + Math.imul(ah6, bl5) | 0, 
                    hi = hi + Math.imul(ah6, bh5) | 0, lo = lo + Math.imul(al5, bl6) | 0, mid = (mid = mid + Math.imul(al5, bh6) | 0) + Math.imul(ah5, bl6) | 0, 
                    hi = hi + Math.imul(ah5, bh6) | 0, lo = lo + Math.imul(al4, bl7) | 0, mid = (mid = mid + Math.imul(al4, bh7) | 0) + Math.imul(ah4, bl7) | 0, 
                    hi = hi + Math.imul(ah4, bh7) | 0, lo = lo + Math.imul(al3, bl8) | 0, mid = (mid = mid + Math.imul(al3, bh8) | 0) + Math.imul(ah3, bl8) | 0, 
                    hi = hi + Math.imul(ah3, bh8) | 0;
                    var w11 = (c + (lo = lo + Math.imul(al2, bl9) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al2, bh9) | 0) + Math.imul(ah2, bl9) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah2, bh9) | 0) + (mid >>> 13) | 0) + (w11 >>> 26) | 0, 
                    w11 &= 67108863, lo = Math.imul(al9, bl3), mid = (mid = Math.imul(al9, bh3)) + Math.imul(ah9, bl3) | 0, 
                    hi = Math.imul(ah9, bh3), lo = lo + Math.imul(al8, bl4) | 0, mid = (mid = mid + Math.imul(al8, bh4) | 0) + Math.imul(ah8, bl4) | 0, 
                    hi = hi + Math.imul(ah8, bh4) | 0, lo = lo + Math.imul(al7, bl5) | 0, mid = (mid = mid + Math.imul(al7, bh5) | 0) + Math.imul(ah7, bl5) | 0, 
                    hi = hi + Math.imul(ah7, bh5) | 0, lo = lo + Math.imul(al6, bl6) | 0, mid = (mid = mid + Math.imul(al6, bh6) | 0) + Math.imul(ah6, bl6) | 0, 
                    hi = hi + Math.imul(ah6, bh6) | 0, lo = lo + Math.imul(al5, bl7) | 0, mid = (mid = mid + Math.imul(al5, bh7) | 0) + Math.imul(ah5, bl7) | 0, 
                    hi = hi + Math.imul(ah5, bh7) | 0, lo = lo + Math.imul(al4, bl8) | 0, mid = (mid = mid + Math.imul(al4, bh8) | 0) + Math.imul(ah4, bl8) | 0, 
                    hi = hi + Math.imul(ah4, bh8) | 0;
                    var w12 = (c + (lo = lo + Math.imul(al3, bl9) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al3, bh9) | 0) + Math.imul(ah3, bl9) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah3, bh9) | 0) + (mid >>> 13) | 0) + (w12 >>> 26) | 0, 
                    w12 &= 67108863, lo = Math.imul(al9, bl4), mid = (mid = Math.imul(al9, bh4)) + Math.imul(ah9, bl4) | 0, 
                    hi = Math.imul(ah9, bh4), lo = lo + Math.imul(al8, bl5) | 0, mid = (mid = mid + Math.imul(al8, bh5) | 0) + Math.imul(ah8, bl5) | 0, 
                    hi = hi + Math.imul(ah8, bh5) | 0, lo = lo + Math.imul(al7, bl6) | 0, mid = (mid = mid + Math.imul(al7, bh6) | 0) + Math.imul(ah7, bl6) | 0, 
                    hi = hi + Math.imul(ah7, bh6) | 0, lo = lo + Math.imul(al6, bl7) | 0, mid = (mid = mid + Math.imul(al6, bh7) | 0) + Math.imul(ah6, bl7) | 0, 
                    hi = hi + Math.imul(ah6, bh7) | 0, lo = lo + Math.imul(al5, bl8) | 0, mid = (mid = mid + Math.imul(al5, bh8) | 0) + Math.imul(ah5, bl8) | 0, 
                    hi = hi + Math.imul(ah5, bh8) | 0;
                    var w13 = (c + (lo = lo + Math.imul(al4, bl9) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al4, bh9) | 0) + Math.imul(ah4, bl9) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah4, bh9) | 0) + (mid >>> 13) | 0) + (w13 >>> 26) | 0, 
                    w13 &= 67108863, lo = Math.imul(al9, bl5), mid = (mid = Math.imul(al9, bh5)) + Math.imul(ah9, bl5) | 0, 
                    hi = Math.imul(ah9, bh5), lo = lo + Math.imul(al8, bl6) | 0, mid = (mid = mid + Math.imul(al8, bh6) | 0) + Math.imul(ah8, bl6) | 0, 
                    hi = hi + Math.imul(ah8, bh6) | 0, lo = lo + Math.imul(al7, bl7) | 0, mid = (mid = mid + Math.imul(al7, bh7) | 0) + Math.imul(ah7, bl7) | 0, 
                    hi = hi + Math.imul(ah7, bh7) | 0, lo = lo + Math.imul(al6, bl8) | 0, mid = (mid = mid + Math.imul(al6, bh8) | 0) + Math.imul(ah6, bl8) | 0, 
                    hi = hi + Math.imul(ah6, bh8) | 0;
                    var w14 = (c + (lo = lo + Math.imul(al5, bl9) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al5, bh9) | 0) + Math.imul(ah5, bl9) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah5, bh9) | 0) + (mid >>> 13) | 0) + (w14 >>> 26) | 0, 
                    w14 &= 67108863, lo = Math.imul(al9, bl6), mid = (mid = Math.imul(al9, bh6)) + Math.imul(ah9, bl6) | 0, 
                    hi = Math.imul(ah9, bh6), lo = lo + Math.imul(al8, bl7) | 0, mid = (mid = mid + Math.imul(al8, bh7) | 0) + Math.imul(ah8, bl7) | 0, 
                    hi = hi + Math.imul(ah8, bh7) | 0, lo = lo + Math.imul(al7, bl8) | 0, mid = (mid = mid + Math.imul(al7, bh8) | 0) + Math.imul(ah7, bl8) | 0, 
                    hi = hi + Math.imul(ah7, bh8) | 0;
                    var w15 = (c + (lo = lo + Math.imul(al6, bl9) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al6, bh9) | 0) + Math.imul(ah6, bl9) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah6, bh9) | 0) + (mid >>> 13) | 0) + (w15 >>> 26) | 0, 
                    w15 &= 67108863, lo = Math.imul(al9, bl7), mid = (mid = Math.imul(al9, bh7)) + Math.imul(ah9, bl7) | 0, 
                    hi = Math.imul(ah9, bh7), lo = lo + Math.imul(al8, bl8) | 0, mid = (mid = mid + Math.imul(al8, bh8) | 0) + Math.imul(ah8, bl8) | 0, 
                    hi = hi + Math.imul(ah8, bh8) | 0;
                    var w16 = (c + (lo = lo + Math.imul(al7, bl9) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al7, bh9) | 0) + Math.imul(ah7, bl9) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah7, bh9) | 0) + (mid >>> 13) | 0) + (w16 >>> 26) | 0, 
                    w16 &= 67108863, lo = Math.imul(al9, bl8), mid = (mid = Math.imul(al9, bh8)) + Math.imul(ah9, bl8) | 0, 
                    hi = Math.imul(ah9, bh8);
                    var w17 = (c + (lo = lo + Math.imul(al8, bl9) | 0) | 0) + ((8191 & (mid = (mid = mid + Math.imul(al8, bh9) | 0) + Math.imul(ah8, bl9) | 0)) << 13) | 0;
                    c = ((hi = hi + Math.imul(ah8, bh9) | 0) + (mid >>> 13) | 0) + (w17 >>> 26) | 0, 
                    w17 &= 67108863;
                    var w18 = (c + (lo = Math.imul(al9, bl9)) | 0) + ((8191 & (mid = (mid = Math.imul(al9, bh9)) + Math.imul(ah9, bl9) | 0)) << 13) | 0;
                    return c = ((hi = Math.imul(ah9, bh9)) + (mid >>> 13) | 0) + (w18 >>> 26) | 0, w18 &= 67108863, 
                    o[0] = w0, o[1] = w1, o[2] = w2, o[3] = w3, o[4] = w4, o[5] = w5, o[6] = w6, o[7] = w7, 
                    o[8] = w8, o[9] = w9, o[10] = w10, o[11] = w11, o[12] = w12, o[13] = w13, o[14] = w14, 
                    o[15] = w15, o[16] = w16, o[17] = w17, o[18] = w18, 0 !== c && (o[19] = c, out.length++), 
                    out;
                };
                function jumboMulTo(self, num, out) {
                    return new FFTM().mulp(self, num, out);
                }
                function FFTM(x, y) {
                    this.x = x, this.y = y;
                }
                Math.imul || (comb10MulTo = smallMulTo), BN.prototype.mulTo = function(num, out) {
                    var len = this.length + num.length;
                    return 10 === this.length && 10 === num.length ? comb10MulTo(this, num, out) : len < 63 ? smallMulTo(this, num, out) : len < 1024 ? function(self, num, out) {
                        out.negative = num.negative ^ self.negative, out.length = self.length + num.length;
                        for (var carry = 0, hncarry = 0, k = 0; k < out.length - 1; k++) {
                            var ncarry = hncarry;
                            hncarry = 0;
                            for (var rword = 67108863 & carry, maxJ = Math.min(k, num.length - 1), j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {
                                var i = k - j, r = (0 | self.words[i]) * (0 | num.words[j]), lo = 67108863 & r;
                                rword = 67108863 & (lo = lo + rword | 0), hncarry += (ncarry = (ncarry = ncarry + (r / 67108864 | 0) | 0) + (lo >>> 26) | 0) >>> 26, 
                                ncarry &= 67108863;
                            }
                            out.words[k] = rword, carry = ncarry, ncarry = hncarry;
                        }
                        return 0 !== carry ? out.words[k] = carry : out.length--, out.strip();
                    }(this, num, out) : jumboMulTo(this, num, out);
                }, FFTM.prototype.makeRBT = function(N) {
                    for (var t = new Array(N), l = BN.prototype._countBits(N) - 1, i = 0; i < N; i++) t[i] = this.revBin(i, l, N);
                    return t;
                }, FFTM.prototype.revBin = function(x, l, N) {
                    if (0 === x || x === N - 1) return x;
                    for (var rb = 0, i = 0; i < l; i++) rb |= (1 & x) << l - i - 1, x >>= 1;
                    return rb;
                }, FFTM.prototype.permute = function(rbt, rws, iws, rtws, itws, N) {
                    for (var i = 0; i < N; i++) rtws[i] = rws[rbt[i]], itws[i] = iws[rbt[i]];
                }, FFTM.prototype.transform = function(rws, iws, rtws, itws, N, rbt) {
                    this.permute(rbt, rws, iws, rtws, itws, N);
                    for (var s = 1; s < N; s <<= 1) for (var l = s << 1, rtwdf = Math.cos(2 * Math.PI / l), itwdf = Math.sin(2 * Math.PI / l), p = 0; p < N; p += l) for (var rtwdf_ = rtwdf, itwdf_ = itwdf, j = 0; j < s; j++) {
                        var re = rtws[p + j], ie = itws[p + j], ro = rtws[p + j + s], io = itws[p + j + s], rx = rtwdf_ * ro - itwdf_ * io;
                        io = rtwdf_ * io + itwdf_ * ro, ro = rx, rtws[p + j] = re + ro, itws[p + j] = ie + io, 
                        rtws[p + j + s] = re - ro, itws[p + j + s] = ie - io, j !== l && (rx = rtwdf * rtwdf_ - itwdf * itwdf_, 
                        itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_, rtwdf_ = rx);
                    }
                }, FFTM.prototype.guessLen13b = function(n, m) {
                    var N = 1 | Math.max(m, n), odd = 1 & N, i = 0;
                    for (N = N / 2 | 0; N; N >>>= 1) i++;
                    return 1 << i + 1 + odd;
                }, FFTM.prototype.conjugate = function(rws, iws, N) {
                    if (!(N <= 1)) for (var i = 0; i < N / 2; i++) {
                        var t = rws[i];
                        rws[i] = rws[N - i - 1], rws[N - i - 1] = t, t = iws[i], iws[i] = -iws[N - i - 1], 
                        iws[N - i - 1] = -t;
                    }
                }, FFTM.prototype.normalize13b = function(ws, N) {
                    for (var carry = 0, i = 0; i < N / 2; i++) {
                        var w = 8192 * Math.round(ws[2 * i + 1] / N) + Math.round(ws[2 * i] / N) + carry;
                        ws[i] = 67108863 & w, carry = w < 67108864 ? 0 : w / 67108864 | 0;
                    }
                    return ws;
                }, FFTM.prototype.convert13b = function(ws, len, rws, N) {
                    for (var carry = 0, i = 0; i < len; i++) carry += 0 | ws[i], rws[2 * i] = 8191 & carry, 
                    carry >>>= 13, rws[2 * i + 1] = 8191 & carry, carry >>>= 13;
                    for (i = 2 * len; i < N; ++i) rws[i] = 0;
                    assert(0 === carry), assert(0 == (-8192 & carry));
                }, FFTM.prototype.stub = function(N) {
                    for (var ph = new Array(N), i = 0; i < N; i++) ph[i] = 0;
                    return ph;
                }, FFTM.prototype.mulp = function(x, y, out) {
                    var N = 2 * this.guessLen13b(x.length, y.length), rbt = this.makeRBT(N), _ = this.stub(N), rws = new Array(N), rwst = new Array(N), iwst = new Array(N), nrws = new Array(N), nrwst = new Array(N), niwst = new Array(N), rmws = out.words;
                    rmws.length = N, this.convert13b(x.words, x.length, rws, N), this.convert13b(y.words, y.length, nrws, N), 
                    this.transform(rws, _, rwst, iwst, N, rbt), this.transform(nrws, _, nrwst, niwst, N, rbt);
                    for (var i = 0; i < N; i++) {
                        var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];
                        iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i], rwst[i] = rx;
                    }
                    return this.conjugate(rwst, iwst, N), this.transform(rwst, iwst, rmws, _, N, rbt), 
                    this.conjugate(rmws, _, N), this.normalize13b(rmws, N), out.negative = x.negative ^ y.negative, 
                    out.length = x.length + y.length, out.strip();
                }, BN.prototype.mul = function(num) {
                    var out = new BN(null);
                    return out.words = new Array(this.length + num.length), this.mulTo(num, out);
                }, BN.prototype.mulf = function(num) {
                    var out = new BN(null);
                    return out.words = new Array(this.length + num.length), jumboMulTo(this, num, out);
                }, BN.prototype.imul = function(num) {
                    return this.clone().mulTo(num, this);
                }, BN.prototype.imuln = function(num) {
                    assert("number" == typeof num), assert(num < 67108864);
                    for (var carry = 0, i = 0; i < this.length; i++) {
                        var w = (0 | this.words[i]) * num, lo = (67108863 & w) + (67108863 & carry);
                        carry >>= 26, carry += w / 67108864 | 0, carry += lo >>> 26, this.words[i] = 67108863 & lo;
                    }
                    return 0 !== carry && (this.words[i] = carry, this.length++), this;
                }, BN.prototype.muln = function(num) {
                    return this.clone().imuln(num);
                }, BN.prototype.sqr = function() {
                    return this.mul(this);
                }, BN.prototype.isqr = function() {
                    return this.imul(this.clone());
                }, BN.prototype.pow = function(num) {
                    var w = function(num) {
                        for (var w = new Array(num.bitLength()), bit = 0; bit < w.length; bit++) {
                            var off = bit / 26 | 0, wbit = bit % 26;
                            w[bit] = (num.words[off] & 1 << wbit) >>> wbit;
                        }
                        return w;
                    }(num);
                    if (0 === w.length) return new BN(1);
                    for (var res = this, i = 0; i < w.length && 0 === w[i]; i++, res = res.sqr()) ;
                    if (++i < w.length) for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) 0 !== w[i] && (res = res.mul(q));
                    return res;
                }, BN.prototype.iushln = function(bits) {
                    assert("number" == typeof bits && 0 <= bits);
                    var i, r = bits % 26, s = (bits - r) / 26, carryMask = 67108863 >>> 26 - r << 26 - r;
                    if (0 !== r) {
                        var carry = 0;
                        for (i = 0; i < this.length; i++) {
                            var newCarry = this.words[i] & carryMask, c = (0 | this.words[i]) - newCarry << r;
                            this.words[i] = c | carry, carry = newCarry >>> 26 - r;
                        }
                        carry && (this.words[i] = carry, this.length++);
                    }
                    if (0 !== s) {
                        for (i = this.length - 1; 0 <= i; i--) this.words[i + s] = this.words[i];
                        for (i = 0; i < s; i++) this.words[i] = 0;
                        this.length += s;
                    }
                    return this.strip();
                }, BN.prototype.ishln = function(bits) {
                    return assert(0 === this.negative), this.iushln(bits);
                }, BN.prototype.iushrn = function(bits, hint, extended) {
                    var h;
                    assert("number" == typeof bits && 0 <= bits), h = hint ? (hint - hint % 26) / 26 : 0;
                    var r = bits % 26, s = Math.min((bits - r) / 26, this.length), mask = 67108863 ^ 67108863 >>> r << r, maskedWords = extended;
                    if (h -= s, h = Math.max(0, h), maskedWords) {
                        for (var i = 0; i < s; i++) maskedWords.words[i] = this.words[i];
                        maskedWords.length = s;
                    }
                    if (0 === s) ; else if (this.length > s) for (this.length -= s, i = 0; i < this.length; i++) this.words[i] = this.words[i + s]; else this.words[0] = 0, 
                    this.length = 1;
                    var carry = 0;
                    for (i = this.length - 1; 0 <= i && (0 !== carry || h <= i); i--) {
                        var word = 0 | this.words[i];
                        this.words[i] = carry << 26 - r | word >>> r, carry = word & mask;
                    }
                    return maskedWords && 0 !== carry && (maskedWords.words[maskedWords.length++] = carry), 
                    0 === this.length && (this.words[0] = 0, this.length = 1), this.strip();
                }, BN.prototype.ishrn = function(bits, hint, extended) {
                    return assert(0 === this.negative), this.iushrn(bits, hint, extended);
                }, BN.prototype.shln = function(bits) {
                    return this.clone().ishln(bits);
                }, BN.prototype.ushln = function(bits) {
                    return this.clone().iushln(bits);
                }, BN.prototype.shrn = function(bits) {
                    return this.clone().ishrn(bits);
                }, BN.prototype.ushrn = function(bits) {
                    return this.clone().iushrn(bits);
                }, BN.prototype.testn = function(bit) {
                    assert("number" == typeof bit && 0 <= bit);
                    var r = bit % 26, s = (bit - r) / 26, q = 1 << r;
                    return !(this.length <= s) && !!(this.words[s] & q);
                }, BN.prototype.imaskn = function(bits) {
                    assert("number" == typeof bits && 0 <= bits);
                    var r = bits % 26, s = (bits - r) / 26;
                    if (assert(0 === this.negative, "imaskn works only with positive numbers"), this.length <= s) return this;
                    if (0 !== r && s++, this.length = Math.min(s, this.length), 0 !== r) {
                        var mask = 67108863 ^ 67108863 >>> r << r;
                        this.words[this.length - 1] &= mask;
                    }
                    return this.strip();
                }, BN.prototype.maskn = function(bits) {
                    return this.clone().imaskn(bits);
                }, BN.prototype.iaddn = function(num) {
                    return assert("number" == typeof num), assert(num < 67108864), num < 0 ? this.isubn(-num) : 0 !== this.negative ? (1 === this.length && (0 | this.words[0]) < num ? (this.words[0] = num - (0 | this.words[0]), 
                    this.negative = 0) : (this.negative = 0, this.isubn(num), this.negative = 1), this) : this._iaddn(num);
                }, BN.prototype._iaddn = function(num) {
                    this.words[0] += num;
                    for (var i = 0; i < this.length && 67108864 <= this.words[i]; i++) this.words[i] -= 67108864, 
                    i === this.length - 1 ? this.words[i + 1] = 1 : this.words[i + 1]++;
                    return this.length = Math.max(this.length, i + 1), this;
                }, BN.prototype.isubn = function(num) {
                    if (assert("number" == typeof num), assert(num < 67108864), num < 0) return this.iaddn(-num);
                    if (0 !== this.negative) return this.negative = 0, this.iaddn(num), this.negative = 1, 
                    this;
                    if (this.words[0] -= num, 1 === this.length && this.words[0] < 0) this.words[0] = -this.words[0], 
                    this.negative = 1; else for (var i = 0; i < this.length && this.words[i] < 0; i++) this.words[i] += 67108864, 
                    this.words[i + 1] -= 1;
                    return this.strip();
                }, BN.prototype.addn = function(num) {
                    return this.clone().iaddn(num);
                }, BN.prototype.subn = function(num) {
                    return this.clone().isubn(num);
                }, BN.prototype.iabs = function() {
                    return this.negative = 0, this;
                }, BN.prototype.abs = function() {
                    return this.clone().iabs();
                }, BN.prototype._ishlnsubmul = function(num, mul, shift) {
                    var i, w, len = num.length + shift;
                    this._expand(len);
                    var carry = 0;
                    for (i = 0; i < num.length; i++) {
                        w = (0 | this.words[i + shift]) + carry;
                        var right = (0 | num.words[i]) * mul;
                        carry = ((w -= 67108863 & right) >> 26) - (right / 67108864 | 0), this.words[i + shift] = 67108863 & w;
                    }
                    for (;i < this.length - shift; i++) carry = (w = (0 | this.words[i + shift]) + carry) >> 26, 
                    this.words[i + shift] = 67108863 & w;
                    if (0 === carry) return this.strip();
                    for (assert(-1 === carry), i = carry = 0; i < this.length; i++) carry = (w = -(0 | this.words[i]) + carry) >> 26, 
                    this.words[i] = 67108863 & w;
                    return this.negative = 1, this.strip();
                }, BN.prototype._wordDiv = function(num, mode) {
                    var shift = (this.length, num.length), a = this.clone(), b = num, bhi = 0 | b.words[b.length - 1];
                    0 !== (shift = 26 - this._countBits(bhi)) && (b = b.ushln(shift), a.iushln(shift), 
                    bhi = 0 | b.words[b.length - 1]);
                    var q, m = a.length - b.length;
                    if ("mod" !== mode) {
                        (q = new BN(null)).length = m + 1, q.words = new Array(q.length);
                        for (var i = 0; i < q.length; i++) q.words[i] = 0;
                    }
                    var diff = a.clone()._ishlnsubmul(b, 1, m);
                    0 === diff.negative && (a = diff, q && (q.words[m] = 1));
                    for (var j = m - 1; 0 <= j; j--) {
                        var qj = 67108864 * (0 | a.words[b.length + j]) + (0 | a.words[b.length + j - 1]);
                        for (qj = Math.min(qj / bhi | 0, 67108863), a._ishlnsubmul(b, qj, j); 0 !== a.negative; ) qj--, 
                        a.negative = 0, a._ishlnsubmul(b, 1, j), a.isZero() || (a.negative ^= 1);
                        q && (q.words[j] = qj);
                    }
                    return q && q.strip(), a.strip(), "div" !== mode && 0 !== shift && a.iushrn(shift), 
                    {
                        div: q || null,
                        mod: a
                    };
                }, BN.prototype.divmod = function(num, mode, positive) {
                    return assert(!num.isZero()), this.isZero() ? {
                        div: new BN(0),
                        mod: new BN(0)
                    } : 0 !== this.negative && 0 === num.negative ? (res = this.neg().divmod(num, mode), 
                    "mod" !== mode && (div = res.div.neg()), "div" !== mode && (mod = res.mod.neg(), 
                    positive && 0 !== mod.negative && mod.iadd(num)), {
                        div: div,
                        mod: mod
                    }) : 0 === this.negative && 0 !== num.negative ? (res = this.divmod(num.neg(), mode), 
                    "mod" !== mode && (div = res.div.neg()), {
                        div: div,
                        mod: res.mod
                    }) : 0 != (this.negative & num.negative) ? (res = this.neg().divmod(num.neg(), mode), 
                    "div" !== mode && (mod = res.mod.neg(), positive && 0 !== mod.negative && mod.isub(num)), 
                    {
                        div: res.div,
                        mod: mod
                    }) : num.length > this.length || this.cmp(num) < 0 ? {
                        div: new BN(0),
                        mod: this
                    } : 1 === num.length ? "div" === mode ? {
                        div: this.divn(num.words[0]),
                        mod: null
                    } : "mod" === mode ? {
                        div: null,
                        mod: new BN(this.modn(num.words[0]))
                    } : {
                        div: this.divn(num.words[0]),
                        mod: new BN(this.modn(num.words[0]))
                    } : this._wordDiv(num, mode);
                    var div, mod, res;
                }, BN.prototype.div = function(num) {
                    return this.divmod(num, "div", !1).div;
                }, BN.prototype.mod = function(num) {
                    return this.divmod(num, "mod", !1).mod;
                }, BN.prototype.umod = function(num) {
                    return this.divmod(num, "mod", !0).mod;
                }, BN.prototype.divRound = function(num) {
                    var dm = this.divmod(num);
                    if (dm.mod.isZero()) return dm.div;
                    var mod = 0 !== dm.div.negative ? dm.mod.isub(num) : dm.mod, half = num.ushrn(1), r2 = num.andln(1), cmp = mod.cmp(half);
                    return cmp < 0 || 1 === r2 && 0 === cmp ? dm.div : 0 !== dm.div.negative ? dm.div.isubn(1) : dm.div.iaddn(1);
                }, BN.prototype.modn = function(num) {
                    assert(num <= 67108863);
                    for (var p = (1 << 26) % num, acc = 0, i = this.length - 1; 0 <= i; i--) acc = (p * acc + (0 | this.words[i])) % num;
                    return acc;
                }, BN.prototype.idivn = function(num) {
                    assert(num <= 67108863);
                    for (var carry = 0, i = this.length - 1; 0 <= i; i--) {
                        var w = (0 | this.words[i]) + 67108864 * carry;
                        this.words[i] = w / num | 0, carry = w % num;
                    }
                    return this.strip();
                }, BN.prototype.divn = function(num) {
                    return this.clone().idivn(num);
                }, BN.prototype.egcd = function(p) {
                    assert(0 === p.negative), assert(!p.isZero());
                    var x = this, y = p.clone();
                    x = 0 !== x.negative ? x.umod(p) : x.clone();
                    for (var A = new BN(1), B = new BN(0), C = new BN(0), D = new BN(1), g = 0; x.isEven() && y.isEven(); ) x.iushrn(1), 
                    y.iushrn(1), ++g;
                    for (var yp = y.clone(), xp = x.clone(); !x.isZero(); ) {
                        for (var i = 0, im = 1; 0 == (x.words[0] & im) && i < 26; ++i, im <<= 1) ;
                        if (0 < i) for (x.iushrn(i); 0 < i--; ) (A.isOdd() || B.isOdd()) && (A.iadd(yp), 
                        B.isub(xp)), A.iushrn(1), B.iushrn(1);
                        for (var j = 0, jm = 1; 0 == (y.words[0] & jm) && j < 26; ++j, jm <<= 1) ;
                        if (0 < j) for (y.iushrn(j); 0 < j--; ) (C.isOdd() || D.isOdd()) && (C.iadd(yp), 
                        D.isub(xp)), C.iushrn(1), D.iushrn(1);
                        0 <= x.cmp(y) ? (x.isub(y), A.isub(C), B.isub(D)) : (y.isub(x), C.isub(A), D.isub(B));
                    }
                    return {
                        a: C,
                        b: D,
                        gcd: y.iushln(g)
                    };
                }, BN.prototype._invmp = function(p) {
                    assert(0 === p.negative), assert(!p.isZero());
                    var a = this, b = p.clone();
                    a = 0 !== a.negative ? a.umod(p) : a.clone();
                    for (var res, x1 = new BN(1), x2 = new BN(0), delta = b.clone(); 0 < a.cmpn(1) && 0 < b.cmpn(1); ) {
                        for (var i = 0, im = 1; 0 == (a.words[0] & im) && i < 26; ++i, im <<= 1) ;
                        if (0 < i) for (a.iushrn(i); 0 < i--; ) x1.isOdd() && x1.iadd(delta), x1.iushrn(1);
                        for (var j = 0, jm = 1; 0 == (b.words[0] & jm) && j < 26; ++j, jm <<= 1) ;
                        if (0 < j) for (b.iushrn(j); 0 < j--; ) x2.isOdd() && x2.iadd(delta), x2.iushrn(1);
                        0 <= a.cmp(b) ? (a.isub(b), x1.isub(x2)) : (b.isub(a), x2.isub(x1));
                    }
                    return (res = 0 === a.cmpn(1) ? x1 : x2).cmpn(0) < 0 && res.iadd(p), res;
                }, BN.prototype.gcd = function(num) {
                    if (this.isZero()) return num.abs();
                    if (num.isZero()) return this.abs();
                    var a = this.clone(), b = num.clone();
                    a.negative = 0;
                    for (var shift = b.negative = 0; a.isEven() && b.isEven(); shift++) a.iushrn(1), 
                    b.iushrn(1);
                    for (;;) {
                        for (;a.isEven(); ) a.iushrn(1);
                        for (;b.isEven(); ) b.iushrn(1);
                        var r = a.cmp(b);
                        if (r < 0) {
                            var t = a;
                            a = b, b = t;
                        } else if (0 === r || 0 === b.cmpn(1)) break;
                        a.isub(b);
                    }
                    return b.iushln(shift);
                }, BN.prototype.invm = function(num) {
                    return this.egcd(num).a.umod(num);
                }, BN.prototype.isEven = function() {
                    return 0 == (1 & this.words[0]);
                }, BN.prototype.isOdd = function() {
                    return 1 == (1 & this.words[0]);
                }, BN.prototype.andln = function(num) {
                    return this.words[0] & num;
                }, BN.prototype.bincn = function(bit) {
                    assert("number" == typeof bit);
                    var r = bit % 26, s = (bit - r) / 26, q = 1 << r;
                    if (this.length <= s) return this._expand(s + 1), this.words[s] |= q, this;
                    for (var carry = q, i = s; 0 !== carry && i < this.length; i++) {
                        var w = 0 | this.words[i];
                        carry = (w += carry) >>> 26, w &= 67108863, this.words[i] = w;
                    }
                    return 0 !== carry && (this.words[i] = carry, this.length++), this;
                }, BN.prototype.isZero = function() {
                    return 1 === this.length && 0 === this.words[0];
                }, BN.prototype.cmpn = function(num) {
                    var res, negative = num < 0;
                    if (0 !== this.negative && !negative) return -1;
                    if (0 === this.negative && negative) return 1;
                    if (this.strip(), 1 < this.length) res = 1; else {
                        negative && (num = -num), assert(num <= 67108863, "Number is too big");
                        var w = 0 | this.words[0];
                        res = w === num ? 0 : w < num ? -1 : 1;
                    }
                    return 0 !== this.negative ? 0 | -res : res;
                }, BN.prototype.cmp = function(num) {
                    if (0 !== this.negative && 0 === num.negative) return -1;
                    if (0 === this.negative && 0 !== num.negative) return 1;
                    var res = this.ucmp(num);
                    return 0 !== this.negative ? 0 | -res : res;
                }, BN.prototype.ucmp = function(num) {
                    if (this.length > num.length) return 1;
                    if (this.length < num.length) return -1;
                    for (var res = 0, i = this.length - 1; 0 <= i; i--) {
                        var a = 0 | this.words[i], b = 0 | num.words[i];
                        if (a !== b) {
                            a < b ? res = -1 : b < a && (res = 1);
                            break;
                        }
                    }
                    return res;
                }, BN.prototype.gtn = function(num) {
                    return 1 === this.cmpn(num);
                }, BN.prototype.gt = function(num) {
                    return 1 === this.cmp(num);
                }, BN.prototype.gten = function(num) {
                    return 0 <= this.cmpn(num);
                }, BN.prototype.gte = function(num) {
                    return 0 <= this.cmp(num);
                }, BN.prototype.ltn = function(num) {
                    return -1 === this.cmpn(num);
                }, BN.prototype.lt = function(num) {
                    return -1 === this.cmp(num);
                }, BN.prototype.lten = function(num) {
                    return this.cmpn(num) <= 0;
                }, BN.prototype.lte = function(num) {
                    return this.cmp(num) <= 0;
                }, BN.prototype.eqn = function(num) {
                    return 0 === this.cmpn(num);
                }, BN.prototype.eq = function(num) {
                    return 0 === this.cmp(num);
                }, BN.red = function(num) {
                    return new Red(num);
                }, BN.prototype.toRed = function(ctx) {
                    return assert(!this.red, "Already a number in reduction context"), assert(0 === this.negative, "red works only with positives"), 
                    ctx.convertTo(this)._forceRed(ctx);
                }, BN.prototype.fromRed = function() {
                    return assert(this.red, "fromRed works only with numbers in reduction context"), 
                    this.red.convertFrom(this);
                }, BN.prototype._forceRed = function(ctx) {
                    return this.red = ctx, this;
                }, BN.prototype.forceRed = function(ctx) {
                    return assert(!this.red, "Already a number in reduction context"), this._forceRed(ctx);
                }, BN.prototype.redAdd = function(num) {
                    return assert(this.red, "redAdd works only with red numbers"), this.red.add(this, num);
                }, BN.prototype.redIAdd = function(num) {
                    return assert(this.red, "redIAdd works only with red numbers"), this.red.iadd(this, num);
                }, BN.prototype.redSub = function(num) {
                    return assert(this.red, "redSub works only with red numbers"), this.red.sub(this, num);
                }, BN.prototype.redISub = function(num) {
                    return assert(this.red, "redISub works only with red numbers"), this.red.isub(this, num);
                }, BN.prototype.redShl = function(num) {
                    return assert(this.red, "redShl works only with red numbers"), this.red.shl(this, num);
                }, BN.prototype.redMul = function(num) {
                    return assert(this.red, "redMul works only with red numbers"), this.red._verify2(this, num), 
                    this.red.mul(this, num);
                }, BN.prototype.redIMul = function(num) {
                    return assert(this.red, "redMul works only with red numbers"), this.red._verify2(this, num), 
                    this.red.imul(this, num);
                }, BN.prototype.redSqr = function() {
                    return assert(this.red, "redSqr works only with red numbers"), this.red._verify1(this), 
                    this.red.sqr(this);
                }, BN.prototype.redISqr = function() {
                    return assert(this.red, "redISqr works only with red numbers"), this.red._verify1(this), 
                    this.red.isqr(this);
                }, BN.prototype.redSqrt = function() {
                    return assert(this.red, "redSqrt works only with red numbers"), this.red._verify1(this), 
                    this.red.sqrt(this);
                }, BN.prototype.redInvm = function() {
                    return assert(this.red, "redInvm works only with red numbers"), this.red._verify1(this), 
                    this.red.invm(this);
                }, BN.prototype.redNeg = function() {
                    return assert(this.red, "redNeg works only with red numbers"), this.red._verify1(this), 
                    this.red.neg(this);
                }, BN.prototype.redPow = function(num) {
                    return assert(this.red && !num.red, "redPow(normalNum)"), this.red._verify1(this), 
                    this.red.pow(this, num);
                };
                var primes = {
                    k256: null,
                    p224: null,
                    p192: null,
                    p25519: null
                };
                function MPrime(name, p) {
                    this.name = name, this.p = new BN(p, 16), this.n = this.p.bitLength(), this.k = new BN(1).iushln(this.n).isub(this.p), 
                    this.tmp = this._tmp();
                }
                function K256() {
                    MPrime.call(this, "k256", "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f");
                }
                function P224() {
                    MPrime.call(this, "p224", "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001");
                }
                function P192() {
                    MPrime.call(this, "p192", "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff");
                }
                function P25519() {
                    MPrime.call(this, "25519", "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed");
                }
                function Red(m) {
                    if ("string" == typeof m) {
                        var prime = BN._prime(m);
                        this.m = prime.p, this.prime = prime;
                    } else assert(m.gtn(1), "modulus must be greater than 1"), this.m = m, this.prime = null;
                }
                function Mont(m) {
                    Red.call(this, m), this.shift = this.m.bitLength(), this.shift % 26 != 0 && (this.shift += 26 - this.shift % 26), 
                    this.r = new BN(1).iushln(this.shift), this.r2 = this.imod(this.r.sqr()), this.rinv = this.r._invmp(this.m), 
                    this.minv = this.rinv.mul(this.r).isubn(1).div(this.m), this.minv = this.minv.umod(this.r), 
                    this.minv = this.r.sub(this.minv);
                }
                MPrime.prototype._tmp = function() {
                    var tmp = new BN(null);
                    return tmp.words = new Array(Math.ceil(this.n / 13)), tmp;
                }, MPrime.prototype.ireduce = function(num) {
                    for (var rlen, r = num; this.split(r, this.tmp), (rlen = (r = (r = this.imulK(r)).iadd(this.tmp)).bitLength()) > this.n; ) ;
                    var cmp = rlen < this.n ? -1 : r.ucmp(this.p);
                    return 0 === cmp ? (r.words[0] = 0, r.length = 1) : 0 < cmp ? r.isub(this.p) : r.strip(), 
                    r;
                }, MPrime.prototype.split = function(input, out) {
                    input.iushrn(this.n, 0, out);
                }, MPrime.prototype.imulK = function(num) {
                    return num.imul(this.k);
                }, inherits(K256, MPrime), K256.prototype.split = function(input, output) {
                    for (var outLen = Math.min(input.length, 9), i = 0; i < outLen; i++) output.words[i] = input.words[i];
                    if (output.length = outLen, input.length <= 9) return input.words[0] = 0, void (input.length = 1);
                    var prev = input.words[9];
                    for (output.words[output.length++] = 4194303 & prev, i = 10; i < input.length; i++) {
                        var next = 0 | input.words[i];
                        input.words[i - 10] = (4194303 & next) << 4 | prev >>> 22, prev = next;
                    }
                    prev >>>= 22, 0 === (input.words[i - 10] = prev) && 10 < input.length ? input.length -= 10 : input.length -= 9;
                }, K256.prototype.imulK = function(num) {
                    num.words[num.length] = 0, num.words[num.length + 1] = 0, num.length += 2;
                    for (var lo = 0, i = 0; i < num.length; i++) {
                        var w = 0 | num.words[i];
                        lo += 977 * w, num.words[i] = 67108863 & lo, lo = 64 * w + (lo / 67108864 | 0);
                    }
                    return 0 === num.words[num.length - 1] && (num.length--, 0 === num.words[num.length - 1] && num.length--), 
                    num;
                }, inherits(P224, MPrime), inherits(P192, MPrime), inherits(P25519, MPrime), P25519.prototype.imulK = function(num) {
                    for (var carry = 0, i = 0; i < num.length; i++) {
                        var hi = 19 * (0 | num.words[i]) + carry, lo = 67108863 & hi;
                        hi >>>= 26, num.words[i] = lo, carry = hi;
                    }
                    return 0 !== carry && (num.words[num.length++] = carry), num;
                }, BN._prime = function(name) {
                    if (primes[name]) return primes[name];
                    var prime;
                    if ("k256" === name) prime = new K256(); else if ("p224" === name) prime = new P224(); else if ("p192" === name) prime = new P192(); else {
                        if ("p25519" !== name) throw new Error("Unknown prime " + name);
                        prime = new P25519();
                    }
                    return primes[name] = prime;
                }, Red.prototype._verify1 = function(a) {
                    assert(0 === a.negative, "red works only with positives"), assert(a.red, "red works only with red numbers");
                }, Red.prototype._verify2 = function(a, b) {
                    assert(0 == (a.negative | b.negative), "red works only with positives"), assert(a.red && a.red === b.red, "red works only with red numbers");
                }, Red.prototype.imod = function(a) {
                    return this.prime ? this.prime.ireduce(a)._forceRed(this) : a.umod(this.m)._forceRed(this);
                }, Red.prototype.neg = function(a) {
                    return a.isZero() ? a.clone() : this.m.sub(a)._forceRed(this);
                }, Red.prototype.add = function(a, b) {
                    this._verify2(a, b);
                    var res = a.add(b);
                    return 0 <= res.cmp(this.m) && res.isub(this.m), res._forceRed(this);
                }, Red.prototype.iadd = function(a, b) {
                    this._verify2(a, b);
                    var res = a.iadd(b);
                    return 0 <= res.cmp(this.m) && res.isub(this.m), res;
                }, Red.prototype.sub = function(a, b) {
                    this._verify2(a, b);
                    var res = a.sub(b);
                    return res.cmpn(0) < 0 && res.iadd(this.m), res._forceRed(this);
                }, Red.prototype.isub = function(a, b) {
                    this._verify2(a, b);
                    var res = a.isub(b);
                    return res.cmpn(0) < 0 && res.iadd(this.m), res;
                }, Red.prototype.shl = function(a, num) {
                    return this._verify1(a), this.imod(a.ushln(num));
                }, Red.prototype.imul = function(a, b) {
                    return this._verify2(a, b), this.imod(a.imul(b));
                }, Red.prototype.mul = function(a, b) {
                    return this._verify2(a, b), this.imod(a.mul(b));
                }, Red.prototype.isqr = function(a) {
                    return this.imul(a, a.clone());
                }, Red.prototype.sqr = function(a) {
                    return this.mul(a, a);
                }, Red.prototype.sqrt = function(a) {
                    if (a.isZero()) return a.clone();
                    var mod3 = this.m.andln(3);
                    if (assert(mod3 % 2 == 1), 3 === mod3) {
                        var pow = this.m.add(new BN(1)).iushrn(2);
                        return this.pow(a, pow);
                    }
                    for (var q = this.m.subn(1), s = 0; !q.isZero() && 0 === q.andln(1); ) s++, q.iushrn(1);
                    assert(!q.isZero());
                    var one = new BN(1).toRed(this), nOne = one.redNeg(), lpow = this.m.subn(1).iushrn(1), z = this.m.bitLength();
                    for (z = new BN(2 * z * z).toRed(this); 0 !== this.pow(z, lpow).cmp(nOne); ) z.redIAdd(nOne);
                    for (var c = this.pow(z, q), r = this.pow(a, q.addn(1).iushrn(1)), t = this.pow(a, q), m = s; 0 !== t.cmp(one); ) {
                        for (var tmp = t, i = 0; 0 !== tmp.cmp(one); i++) tmp = tmp.redSqr();
                        assert(i < m);
                        var b = this.pow(c, new BN(1).iushln(m - i - 1));
                        r = r.redMul(b), c = b.redSqr(), t = t.redMul(c), m = i;
                    }
                    return r;
                }, Red.prototype.invm = function(a) {
                    var inv = a._invmp(this.m);
                    return 0 !== inv.negative ? (inv.negative = 0, this.imod(inv).redNeg()) : this.imod(inv);
                }, Red.prototype.pow = function(a, num) {
                    if (num.isZero()) return new BN(1).toRed(this);
                    if (0 === num.cmpn(1)) return a.clone();
                    var wnd = new Array(16);
                    wnd[0] = new BN(1).toRed(this), wnd[1] = a;
                    for (var i = 2; i < wnd.length; i++) wnd[i] = this.mul(wnd[i - 1], a);
                    var res = wnd[0], current = 0, currentLen = 0, start = num.bitLength() % 26;
                    for (0 === start && (start = 26), i = num.length - 1; 0 <= i; i--) {
                        for (var word = num.words[i], j = start - 1; 0 <= j; j--) {
                            var bit = word >> j & 1;
                            res !== wnd[0] && (res = this.sqr(res)), 0 !== bit || 0 !== current ? (current <<= 1, 
                            current |= bit, (4 === ++currentLen || 0 === i && 0 === j) && (res = this.mul(res, wnd[current]), 
                            current = currentLen = 0)) : currentLen = 0;
                        }
                        start = 26;
                    }
                    return res;
                }, Red.prototype.convertTo = function(num) {
                    var r = num.umod(this.m);
                    return r === num ? r.clone() : r;
                }, Red.prototype.convertFrom = function(num) {
                    var res = num.clone();
                    return res.red = null, res;
                }, BN.mont = function(num) {
                    return new Mont(num);
                }, inherits(Mont, Red), Mont.prototype.convertTo = function(num) {
                    return this.imod(num.ushln(this.shift));
                }, Mont.prototype.convertFrom = function(num) {
                    var r = this.imod(num.mul(this.rinv));
                    return r.red = null, r;
                }, Mont.prototype.imul = function(a, b) {
                    if (a.isZero() || b.isZero()) return a.words[0] = 0, a.length = 1, a;
                    var t = a.imul(b), c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), u = t.isub(c).iushrn(this.shift), res = u;
                    return 0 <= u.cmp(this.m) ? res = u.isub(this.m) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), 
                    res._forceRed(this);
                }, Mont.prototype.mul = function(a, b) {
                    if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);
                    var t = a.mul(b), c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m), u = t.isub(c).iushrn(this.shift), res = u;
                    return 0 <= u.cmp(this.m) ? res = u.isub(this.m) : u.cmpn(0) < 0 && (res = u.iadd(this.m)), 
                    res._forceRed(this);
                }, Mont.prototype.invm = function(a) {
                    return this.imod(a._invmp(this.m).mul(this.r2))._forceRed(this);
                };
            }(void 0 === module || module, this);
        }, {
            buffer: 44
        } ],
        43: [ function(require, module, exports) {
            var r;
            function Rand(rand) {
                this.rand = rand;
            }
            if (module.exports = function(len) {
                return r || (r = new Rand(null)), r.generate(len);
            }, (module.exports.Rand = Rand).prototype.generate = function(len) {
                return this._rand(len);
            }, Rand.prototype._rand = function(n) {
                if (this.rand.getBytes) return this.rand.getBytes(n);
                for (var res = new Uint8Array(n), i = 0; i < res.length; i++) res[i] = this.rand.getByte();
                return res;
            }, "object" == typeof self) self.crypto && self.crypto.getRandomValues ? Rand.prototype._rand = function(n) {
                var arr = new Uint8Array(n);
                return self.crypto.getRandomValues(arr), arr;
            } : self.msCrypto && self.msCrypto.getRandomValues ? Rand.prototype._rand = function(n) {
                var arr = new Uint8Array(n);
                return self.msCrypto.getRandomValues(arr), arr;
            } : "object" == typeof window && (Rand.prototype._rand = function() {
                throw new Error("Not implemented yet");
            }); else try {
                var crypto = require("crypto");
                if ("function" != typeof crypto.randomBytes) throw new Error("Not supported");
                Rand.prototype._rand = function(n) {
                    return crypto.randomBytes(n);
                };
            } catch (e) {}
        }, {
            crypto: 44
        } ],
        44: [ function(require, module, exports) {}, {} ],
        45: [ function(require, module, exports) {
            var Buffer = require("safe-buffer").Buffer;
            function asUInt32Array(buf) {
                Buffer.isBuffer(buf) || (buf = Buffer.from(buf));
                for (var len = buf.length / 4 | 0, out = new Array(len), i = 0; i < len; i++) out[i] = buf.readUInt32BE(4 * i);
                return out;
            }
            function scrubVec(v) {
                for (;0 < v.length; v++) v[0] = 0;
            }
            function cryptBlock(M, keySchedule, SUB_MIX, SBOX, nRounds) {
                for (var t0, t1, t2, t3, SUB_MIX0 = SUB_MIX[0], SUB_MIX1 = SUB_MIX[1], SUB_MIX2 = SUB_MIX[2], SUB_MIX3 = SUB_MIX[3], s0 = M[0] ^ keySchedule[0], s1 = M[1] ^ keySchedule[1], s2 = M[2] ^ keySchedule[2], s3 = M[3] ^ keySchedule[3], ksRow = 4, round = 1; round < nRounds; round++) t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[s1 >>> 16 & 255] ^ SUB_MIX2[s2 >>> 8 & 255] ^ SUB_MIX3[255 & s3] ^ keySchedule[ksRow++], 
                t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[s2 >>> 16 & 255] ^ SUB_MIX2[s3 >>> 8 & 255] ^ SUB_MIX3[255 & s0] ^ keySchedule[ksRow++], 
                t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[s3 >>> 16 & 255] ^ SUB_MIX2[s0 >>> 8 & 255] ^ SUB_MIX3[255 & s1] ^ keySchedule[ksRow++], 
                t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[s0 >>> 16 & 255] ^ SUB_MIX2[s1 >>> 8 & 255] ^ SUB_MIX3[255 & s2] ^ keySchedule[ksRow++], 
                s0 = t0, s1 = t1, s2 = t2, s3 = t3;
                return t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 255] << 16 | SBOX[s2 >>> 8 & 255] << 8 | SBOX[255 & s3]) ^ keySchedule[ksRow++], 
                t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 255] << 16 | SBOX[s3 >>> 8 & 255] << 8 | SBOX[255 & s0]) ^ keySchedule[ksRow++], 
                t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 255] << 16 | SBOX[s0 >>> 8 & 255] << 8 | SBOX[255 & s1]) ^ keySchedule[ksRow++], 
                t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 255] << 16 | SBOX[s1 >>> 8 & 255] << 8 | SBOX[255 & s2]) ^ keySchedule[ksRow++], 
                [ t0 >>>= 0, t1 >>>= 0, t2 >>>= 0, t3 >>>= 0 ];
            }
            var RCON = [ 0, 1, 2, 4, 8, 16, 32, 64, 128, 27, 54 ], G = function() {
                for (var d = new Array(256), j = 0; j < 256; j++) d[j] = j < 128 ? j << 1 : j << 1 ^ 283;
                for (var SBOX = [], INV_SBOX = [], SUB_MIX = [ [], [], [], [] ], INV_SUB_MIX = [ [], [], [], [] ], x = 0, xi = 0, i = 0; i < 256; ++i) {
                    var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4;
                    sx = sx >>> 8 ^ 255 & sx ^ 99;
                    var x2 = d[INV_SBOX[SBOX[x] = sx] = x], x4 = d[x2], x8 = d[x4], t = 257 * d[sx] ^ 16843008 * sx;
                    SUB_MIX[0][x] = t << 24 | t >>> 8, SUB_MIX[1][x] = t << 16 | t >>> 16, SUB_MIX[2][x] = t << 8 | t >>> 24, 
                    SUB_MIX[3][x] = t, t = 16843009 * x8 ^ 65537 * x4 ^ 257 * x2 ^ 16843008 * x, INV_SUB_MIX[0][sx] = t << 24 | t >>> 8, 
                    INV_SUB_MIX[1][sx] = t << 16 | t >>> 16, INV_SUB_MIX[2][sx] = t << 8 | t >>> 24, 
                    INV_SUB_MIX[3][sx] = t, 0 === x ? x = xi = 1 : (x = x2 ^ d[d[d[x8 ^ x2]]], xi ^= d[d[xi]]);
                }
                return {
                    SBOX: SBOX,
                    INV_SBOX: INV_SBOX,
                    SUB_MIX: SUB_MIX,
                    INV_SUB_MIX: INV_SUB_MIX
                };
            }();
            function AES(key) {
                this._key = asUInt32Array(key), this._reset();
            }
            AES.blockSize = 16, AES.keySize = 32, AES.prototype.blockSize = AES.blockSize, AES.prototype.keySize = AES.keySize, 
            AES.prototype._reset = function() {
                for (var keyWords = this._key, keySize = keyWords.length, nRounds = keySize + 6, ksRows = 4 * (nRounds + 1), keySchedule = [], k = 0; k < keySize; k++) keySchedule[k] = keyWords[k];
                for (k = keySize; k < ksRows; k++) {
                    var t = keySchedule[k - 1];
                    k % keySize == 0 ? (t = t << 8 | t >>> 24, t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 255] << 16 | G.SBOX[t >>> 8 & 255] << 8 | G.SBOX[255 & t], 
                    t ^= RCON[k / keySize | 0] << 24) : 6 < keySize && k % keySize == 4 && (t = G.SBOX[t >>> 24] << 24 | G.SBOX[t >>> 16 & 255] << 16 | G.SBOX[t >>> 8 & 255] << 8 | G.SBOX[255 & t]), 
                    keySchedule[k] = keySchedule[k - keySize] ^ t;
                }
                for (var invKeySchedule = [], ik = 0; ik < ksRows; ik++) {
                    var ksR = ksRows - ik, tt = keySchedule[ksR - (ik % 4 ? 0 : 4)];
                    invKeySchedule[ik] = ik < 4 || ksR <= 4 ? tt : G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[tt >>> 16 & 255]] ^ G.INV_SUB_MIX[2][G.SBOX[tt >>> 8 & 255]] ^ G.INV_SUB_MIX[3][G.SBOX[255 & tt]];
                }
                this._nRounds = nRounds, this._keySchedule = keySchedule, this._invKeySchedule = invKeySchedule;
            }, AES.prototype.encryptBlockRaw = function(M) {
                return cryptBlock(M = asUInt32Array(M), this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds);
            }, AES.prototype.encryptBlock = function(M) {
                var out = this.encryptBlockRaw(M), buf = Buffer.allocUnsafe(16);
                return buf.writeUInt32BE(out[0], 0), buf.writeUInt32BE(out[1], 4), buf.writeUInt32BE(out[2], 8), 
                buf.writeUInt32BE(out[3], 12), buf;
            }, AES.prototype.decryptBlock = function(M) {
                var m1 = (M = asUInt32Array(M))[1];
                M[1] = M[3], M[3] = m1;
                var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds), buf = Buffer.allocUnsafe(16);
                return buf.writeUInt32BE(out[0], 0), buf.writeUInt32BE(out[3], 4), buf.writeUInt32BE(out[2], 8), 
                buf.writeUInt32BE(out[1], 12), buf;
            }, AES.prototype.scrub = function() {
                scrubVec(this._keySchedule), scrubVec(this._invKeySchedule), scrubVec(this._key);
            }, module.exports.AES = AES;
        }, {
            "safe-buffer": 244
        } ],
        46: [ function(require, module, exports) {
            var aes = require("./aes"), Buffer = require("safe-buffer").Buffer, Transform = require("cipher-base"), inherits = require("inherits"), GHASH = require("./ghash"), xor = require("buffer-xor"), incr32 = require("./incr32");
            function StreamCipher(mode, key, iv, decrypt) {
                Transform.call(this);
                var h = Buffer.alloc(4, 0);
                this._cipher = new aes.AES(key);
                var ck = this._cipher.encryptBlock(h);
                this._ghash = new GHASH(ck), iv = function(self, iv, ck) {
                    if (12 === iv.length) return self._finID = Buffer.concat([ iv, Buffer.from([ 0, 0, 0, 1 ]) ]), 
                    Buffer.concat([ iv, Buffer.from([ 0, 0, 0, 2 ]) ]);
                    var ghash = new GHASH(ck), len = iv.length, toPad = len % 16;
                    ghash.update(iv), toPad && (toPad = 16 - toPad, ghash.update(Buffer.alloc(toPad, 0))), 
                    ghash.update(Buffer.alloc(8, 0));
                    var ivBits = 8 * len, tail = Buffer.alloc(8);
                    tail.writeUIntBE(ivBits, 0, 8), ghash.update(tail), self._finID = ghash.state;
                    var out = Buffer.from(self._finID);
                    return incr32(out), out;
                }(this, iv, ck), this._prev = Buffer.from(iv), this._cache = Buffer.allocUnsafe(0), 
                this._secCache = Buffer.allocUnsafe(0), this._decrypt = decrypt, this._alen = 0, 
                this._len = 0, this._mode = mode, this._authTag = null, this._called = !1;
            }
            inherits(StreamCipher, Transform), StreamCipher.prototype._update = function(chunk) {
                if (!this._called && this._alen) {
                    var rump = 16 - this._alen % 16;
                    rump < 16 && (rump = Buffer.alloc(rump, 0), this._ghash.update(rump));
                }
                this._called = !0;
                var out = this._mode.encrypt(this, chunk);
                return this._decrypt ? this._ghash.update(chunk) : this._ghash.update(out), this._len += chunk.length, 
                out;
            }, StreamCipher.prototype._final = function() {
                if (this._decrypt && !this._authTag) throw new Error("Unsupported state or unable to authenticate data");
                var tag = xor(this._ghash.final(8 * this._alen, 8 * this._len), this._cipher.encryptBlock(this._finID));
                if (this._decrypt && function(a, b) {
                    var out = 0;
                    a.length !== b.length && out++;
                    for (var len = Math.min(a.length, b.length), i = 0; i < len; ++i) out += a[i] ^ b[i];
                    return out;
                }(tag, this._authTag)) throw new Error("Unsupported state or unable to authenticate data");
                this._authTag = tag, this._cipher.scrub();
            }, StreamCipher.prototype.getAuthTag = function() {
                if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error("Attempting to get auth tag in unsupported state");
                return this._authTag;
            }, StreamCipher.prototype.setAuthTag = function(tag) {
                if (!this._decrypt) throw new Error("Attempting to set auth tag in unsupported state");
                this._authTag = tag;
            }, StreamCipher.prototype.setAAD = function(buf) {
                if (this._called) throw new Error("Attempting to set AAD in unsupported state");
                this._ghash.update(buf), this._alen += buf.length;
            }, module.exports = StreamCipher;
        }, {
            "./aes": 45,
            "./ghash": 50,
            "./incr32": 51,
            "buffer-xor": 76,
            "cipher-base": 79,
            inherits: 152,
            "safe-buffer": 244
        } ],
        47: [ function(require, module, exports) {
            var ciphers = require("./encrypter"), deciphers = require("./decrypter"), modes = require("./modes/list.json");
            exports.createCipher = exports.Cipher = ciphers.createCipher, exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv, 
            exports.createDecipher = exports.Decipher = deciphers.createDecipher, exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv, 
            exports.listCiphers = exports.getCiphers = function() {
                return Object.keys(modes);
            };
        }, {
            "./decrypter": 48,
            "./encrypter": 49,
            "./modes/list.json": 59
        } ],
        48: [ function(require, module, exports) {
            var AuthCipher = require("./authCipher"), Buffer = require("safe-buffer").Buffer, MODES = require("./modes"), StreamCipher = require("./streamCipher"), Transform = require("cipher-base"), aes = require("./aes"), ebtk = require("evp_bytestokey");
            function Decipher(mode, key, iv) {
                Transform.call(this), this._cache = new Splitter(), this._last = void 0, this._cipher = new aes.AES(key), 
                this._prev = Buffer.from(iv), this._mode = mode, this._autopadding = !0;
            }
            function Splitter() {
                this.cache = Buffer.allocUnsafe(0);
            }
            function createDecipheriv(suite, password, iv) {
                var config = MODES[suite.toLowerCase()];
                if (!config) throw new TypeError("invalid suite type");
                if ("string" == typeof iv && (iv = Buffer.from(iv)), "GCM" !== config.mode && iv.length !== config.iv) throw new TypeError("invalid iv length " + iv.length);
                if ("string" == typeof password && (password = Buffer.from(password)), password.length !== config.key / 8) throw new TypeError("invalid key length " + password.length);
                return "stream" === config.type ? new StreamCipher(config.module, password, iv, !0) : "auth" === config.type ? new AuthCipher(config.module, password, iv, !0) : new Decipher(config.module, password, iv);
            }
            require("inherits")(Decipher, Transform), Decipher.prototype._update = function(data) {
                var chunk, thing;
                this._cache.add(data);
                for (var out = []; chunk = this._cache.get(this._autopadding); ) thing = this._mode.decrypt(this, chunk), 
                out.push(thing);
                return Buffer.concat(out);
            }, Decipher.prototype._final = function() {
                var chunk = this._cache.flush();
                if (this._autopadding) return function(last) {
                    var padded = last[15], i = -1;
                    for (;++i < padded; ) if (last[i + (16 - padded)] !== padded) throw new Error("unable to decrypt data");
                    if (16 === padded) return;
                    return last.slice(0, 16 - padded);
                }(this._mode.decrypt(this, chunk));
                if (chunk) throw new Error("data not multiple of block length");
            }, Decipher.prototype.setAutoPadding = function(setTo) {
                return this._autopadding = !!setTo, this;
            }, Splitter.prototype.add = function(data) {
                this.cache = Buffer.concat([ this.cache, data ]);
            }, Splitter.prototype.get = function(autoPadding) {
                var out;
                if (autoPadding) {
                    if (16 < this.cache.length) return out = this.cache.slice(0, 16), this.cache = this.cache.slice(16), 
                    out;
                } else if (16 <= this.cache.length) return out = this.cache.slice(0, 16), this.cache = this.cache.slice(16), 
                out;
                return null;
            }, Splitter.prototype.flush = function() {
                if (this.cache.length) return this.cache;
            }, exports.createDecipher = function(suite, password) {
                var config = MODES[suite.toLowerCase()];
                if (!config) throw new TypeError("invalid suite type");
                var keys = ebtk(password, !1, config.key, config.iv);
                return createDecipheriv(suite, keys.key, keys.iv);
            }, exports.createDecipheriv = createDecipheriv;
        }, {
            "./aes": 45,
            "./authCipher": 46,
            "./modes": 58,
            "./streamCipher": 61,
            "cipher-base": 79,
            evp_bytestokey: 135,
            inherits: 152,
            "safe-buffer": 244
        } ],
        49: [ function(require, module, exports) {
            var MODES = require("./modes"), AuthCipher = require("./authCipher"), Buffer = require("safe-buffer").Buffer, StreamCipher = require("./streamCipher"), Transform = require("cipher-base"), aes = require("./aes"), ebtk = require("evp_bytestokey");
            function Cipher(mode, key, iv) {
                Transform.call(this), this._cache = new Splitter(), this._cipher = new aes.AES(key), 
                this._prev = Buffer.from(iv), this._mode = mode, this._autopadding = !0;
            }
            require("inherits")(Cipher, Transform), Cipher.prototype._update = function(data) {
                var chunk, thing;
                this._cache.add(data);
                for (var out = []; chunk = this._cache.get(); ) thing = this._mode.encrypt(this, chunk), 
                out.push(thing);
                return Buffer.concat(out);
            };
            var PADDING = Buffer.alloc(16, 16);
            function Splitter() {
                this.cache = Buffer.allocUnsafe(0);
            }
            function createCipheriv(suite, password, iv) {
                var config = MODES[suite.toLowerCase()];
                if (!config) throw new TypeError("invalid suite type");
                if ("string" == typeof password && (password = Buffer.from(password)), password.length !== config.key / 8) throw new TypeError("invalid key length " + password.length);
                if ("string" == typeof iv && (iv = Buffer.from(iv)), "GCM" !== config.mode && iv.length !== config.iv) throw new TypeError("invalid iv length " + iv.length);
                return "stream" === config.type ? new StreamCipher(config.module, password, iv) : "auth" === config.type ? new AuthCipher(config.module, password, iv) : new Cipher(config.module, password, iv);
            }
            Cipher.prototype._final = function() {
                var chunk = this._cache.flush();
                if (this._autopadding) return chunk = this._mode.encrypt(this, chunk), this._cipher.scrub(), 
                chunk;
                if (!chunk.equals(PADDING)) throw this._cipher.scrub(), new Error("data not multiple of block length");
            }, Cipher.prototype.setAutoPadding = function(setTo) {
                return this._autopadding = !!setTo, this;
            }, Splitter.prototype.add = function(data) {
                this.cache = Buffer.concat([ this.cache, data ]);
            }, Splitter.prototype.get = function() {
                if (15 < this.cache.length) {
                    var out = this.cache.slice(0, 16);
                    return this.cache = this.cache.slice(16), out;
                }
                return null;
            }, Splitter.prototype.flush = function() {
                for (var len = 16 - this.cache.length, padBuff = Buffer.allocUnsafe(len), i = -1; ++i < len; ) padBuff.writeUInt8(len, i);
                return Buffer.concat([ this.cache, padBuff ]);
            }, exports.createCipheriv = createCipheriv, exports.createCipher = function(suite, password) {
                var config = MODES[suite.toLowerCase()];
                if (!config) throw new TypeError("invalid suite type");
                var keys = ebtk(password, !1, config.key, config.iv);
                return createCipheriv(suite, keys.key, keys.iv);
            };
        }, {
            "./aes": 45,
            "./authCipher": 46,
            "./modes": 58,
            "./streamCipher": 61,
            "cipher-base": 79,
            evp_bytestokey: 135,
            inherits: 152,
            "safe-buffer": 244
        } ],
        50: [ function(require, module, exports) {
            var Buffer = require("safe-buffer").Buffer, ZEROES = Buffer.alloc(16, 0);
            function fromArray(out) {
                var buf = Buffer.allocUnsafe(16);
                return buf.writeUInt32BE(out[0] >>> 0, 0), buf.writeUInt32BE(out[1] >>> 0, 4), buf.writeUInt32BE(out[2] >>> 0, 8), 
                buf.writeUInt32BE(out[3] >>> 0, 12), buf;
            }
            function GHASH(key) {
                this.h = key, this.state = Buffer.alloc(16, 0), this.cache = Buffer.allocUnsafe(0);
            }
            GHASH.prototype.ghash = function(block) {
                for (var i = -1; ++i < block.length; ) this.state[i] ^= block[i];
                this._multiply();
            }, GHASH.prototype._multiply = function() {
                for (var buf, j, lsbVi, Vi = [ (buf = this.h).readUInt32BE(0), buf.readUInt32BE(4), buf.readUInt32BE(8), buf.readUInt32BE(12) ], Zi = [ 0, 0, 0, 0 ], i = -1; ++i < 128; ) {
                    for (0 != (this.state[~~(i / 8)] & 1 << 7 - i % 8) && (Zi[0] ^= Vi[0], Zi[1] ^= Vi[1], 
                    Zi[2] ^= Vi[2], Zi[3] ^= Vi[3]), lsbVi = 0 != (1 & Vi[3]), j = 3; 0 < j; j--) Vi[j] = Vi[j] >>> 1 | (1 & Vi[j - 1]) << 31;
                    Vi[0] = Vi[0] >>> 1, lsbVi && (Vi[0] = Vi[0] ^ 225 << 24);
                }
                this.state = fromArray(Zi);
            }, GHASH.prototype.update = function(buf) {
                var chunk;
                for (this.cache = Buffer.concat([ this.cache, buf ]); 16 <= this.cache.length; ) chunk = this.cache.slice(0, 16), 
                this.cache = this.cache.slice(16), this.ghash(chunk);
            }, GHASH.prototype.final = function(abl, bl) {
                return this.cache.length && this.ghash(Buffer.concat([ this.cache, ZEROES ], 16)), 
                this.ghash(fromArray([ 0, abl, 0, bl ])), this.state;
            }, module.exports = GHASH;
        }, {
            "safe-buffer": 244
        } ],
        51: [ function(require, module, exports) {
            module.exports = function(iv) {
                for (var item, len = iv.length; len--; ) {
                    if (255 !== (item = iv.readUInt8(len))) {
                        item++, iv.writeUInt8(item, len);
                        break;
                    }
                    iv.writeUInt8(0, len);
                }
            };
        }, {} ],
        52: [ function(require, module, exports) {
            var xor = require("buffer-xor");
            exports.encrypt = function(self, block) {
                var data = xor(block, self._prev);
                return self._prev = self._cipher.encryptBlock(data), self._prev;
            }, exports.decrypt = function(self, block) {
                var pad = self._prev;
                self._prev = block;
                var out = self._cipher.decryptBlock(block);
                return xor(out, pad);
            };
        }, {
            "buffer-xor": 76
        } ],
        53: [ function(require, module, exports) {
            var Buffer = require("safe-buffer").Buffer, xor = require("buffer-xor");
            function encryptStart(self, data, decrypt) {
                var len = data.length, out = xor(data, self._cache);
                return self._cache = self._cache.slice(len), self._prev = Buffer.concat([ self._prev, decrypt ? data : out ]), 
                out;
            }
            exports.encrypt = function(self, data, decrypt) {
                for (var len, out = Buffer.allocUnsafe(0); data.length; ) {
                    if (0 === self._cache.length && (self._cache = self._cipher.encryptBlock(self._prev), 
                    self._prev = Buffer.allocUnsafe(0)), !(self._cache.length <= data.length)) {
                        out = Buffer.concat([ out, encryptStart(self, data, decrypt) ]);
                        break;
                    }
                    len = self._cache.length, out = Buffer.concat([ out, encryptStart(self, data.slice(0, len), decrypt) ]), 
                    data = data.slice(len);
                }
                return out;
            };
        }, {
            "buffer-xor": 76,
            "safe-buffer": 244
        } ],
        54: [ function(require, module, exports) {
            var Buffer = require("safe-buffer").Buffer;
            function encryptByte(self, byteParam, decrypt) {
                for (var bit, value, i = -1, out = 0; ++i < 8; ) bit = byteParam & 1 << 7 - i ? 128 : 0, 
                out += (128 & (value = self._cipher.encryptBlock(self._prev)[0] ^ bit)) >> i % 8, 
                self._prev = shiftIn(self._prev, decrypt ? bit : value);
                return out;
            }
            function shiftIn(buffer, value) {
                var len = buffer.length, i = -1, out = Buffer.allocUnsafe(buffer.length);
                for (buffer = Buffer.concat([ buffer, Buffer.from([ value ]) ]); ++i < len; ) out[i] = buffer[i] << 1 | buffer[i + 1] >> 7;
                return out;
            }
            exports.encrypt = function(self, chunk, decrypt) {
                for (var len = chunk.length, out = Buffer.allocUnsafe(len), i = -1; ++i < len; ) out[i] = encryptByte(self, chunk[i], decrypt);
                return out;
            };
        }, {
            "safe-buffer": 244
        } ],
        55: [ function(require, module, exports) {
            var Buffer = require("safe-buffer").Buffer;
            function encryptByte(self, byteParam, decrypt) {
                var out = self._cipher.encryptBlock(self._prev)[0] ^ byteParam;
                return self._prev = Buffer.concat([ self._prev.slice(1), Buffer.from([ decrypt ? byteParam : out ]) ]), 
                out;
            }
            exports.encrypt = function(self, chunk, decrypt) {
                for (var len = chunk.length, out = Buffer.allocUnsafe(len), i = -1; ++i < len; ) out[i] = encryptByte(self, chunk[i], decrypt);
                return out;
            };
        }, {
            "safe-buffer": 244
        } ],
        56: [ function(require, module, exports) {
            var xor = require("buffer-xor"), Buffer = require("safe-buffer").Buffer, incr32 = require("../incr32");
            function getBlock(self) {
                var out = self._cipher.encryptBlockRaw(self._prev);
                return incr32(self._prev), out;
            }
            exports.encrypt = function(self, chunk) {
                var chunkNum = Math.ceil(chunk.length / 16), start = self._cache.length;
                self._cache = Buffer.concat([ self._cache, Buffer.allocUnsafe(16 * chunkNum) ]);
                for (var i = 0; i < chunkNum; i++) {
                    var out = getBlock(self), offset = start + 16 * i;
                    self._cache.writeUInt32BE(out[0], offset + 0), self._cache.writeUInt32BE(out[1], offset + 4), 
                    self._cache.writeUInt32BE(out[2], offset + 8), self._cache.writeUInt32BE(out[3], offset + 12);
                }
                var pad = self._cache.slice(0, chunk.length);
                return self._cache = self._cache.slice(chunk.length), xor(chunk, pad);
            };
        }, {
            "../incr32": 51,
            "buffer-xor": 76,
            "safe-buffer": 244
        } ],
        57: [ function(require, module, exports) {
            exports.encrypt = function(self, block) {
                return self._cipher.encryptBlock(block);
            }, exports.decrypt = function(self, block) {
                return self._cipher.decryptBlock(block);
            };
        }, {} ],
        58: [ function(require, module, exports) {
            var modeModules = {
                ECB: require("./ecb"),
                CBC: require("./cbc"),
                CFB: require("./cfb"),
                CFB8: require("./cfb8"),
                CFB1: require("./cfb1"),
                OFB: require("./ofb"),
                CTR: require("./ctr"),
                GCM: require("./ctr")
            }, modes = require("./list.json");
            for (var key in modes) modes[key].module = modeModules[modes[key].mode];
            module.exports = modes;
        }, {
            "./cbc": 52,
            "./cfb": 53,
            "./cfb1": 54,
            "./cfb8": 55,
            "./ctr": 56,
            "./ecb": 57,
            "./list.json": 59,
            "./ofb": 60
        } ],
        59: [ function(require, module, exports) {
            module.exports = {
                "aes-128-ecb": {
                    cipher: "AES",
                    key: 128,
                    iv: 0,
                    mode: "ECB",
                    type: "block"
                },
                "aes-192-ecb": {
                    cipher: "AES",
                    key: 192,
                    iv: 0,
                    mode: "ECB",
                    type: "block"
                },
                "aes-256-ecb": {
                    cipher: "AES",
                    key: 256,
                    iv: 0,
                    mode: "ECB",
                    type: "block"
                },
                "aes-128-cbc": {
                    cipher: "AES",
                    key: 128,
                    iv: 16,
                    mode: "CBC",
                    type: "block"
                },
                "aes-192-cbc": {
                    cipher: "AES",
                    key: 192,
                    iv: 16,
                    mode: "CBC",
                    type: "block"
                },
                "aes-256-cbc": {
                    cipher: "AES",
                    key: 256,
                    iv: 16,
                    mode: "CBC",
                    type: "block"
                },
                aes128: {
                    cipher: "AES",
                    key: 128,
                    iv: 16,
                    mode: "CBC",
                    type: "block"
                },
                aes192: {
                    cipher: "AES",
                    key: 192,
                    iv: 16,
                    mode: "CBC",
                    type: "block"
                },
                aes256: {
                    cipher: "AES",
                    key: 256,
                    iv: 16,
                    mode: "CBC",
                    type: "block"
                },
                "aes-128-cfb": {
                    cipher: "AES",
                    key: 128,
                    iv: 16,
                    mode: "CFB",
                    type: "stream"
                },
                "aes-192-cfb": {
                    cipher: "AES",
                    key: 192,
                    iv: 16,
                    mode: "CFB",
                    type: "stream"
                },
                "aes-256-cfb": {
                    cipher: "AES",
                    key: 256,
                    iv: 16,
                    mode: "CFB",
                    type: "stream"
                },
                "aes-128-cfb8": {
                    cipher: "AES",
                    key: 128,
                    iv: 16,
                    mode: "CFB8",
                    type: "stream"
                },
                "aes-192-cfb8": {
                    cipher: "AES",
                    key: 192,
                    iv: 16,
                    mode: "CFB8",
                    type: "stream"
                },
                "aes-256-cfb8": {
                    cipher: "AES",
                    key: 256,
                    iv: 16,
                    mode: "CFB8",
                    type: "stream"
                },
                "aes-128-cfb1": {
                    cipher: "AES",
                    key: 128,
                    iv: 16,
                    mode: "CFB1",
                    type: "stream"
                },
                "aes-192-cfb1": {
                    cipher: "AES",
                    key: 192,
                    iv: 16,
                    mode: "CFB1",
                    type: "stream"
                },
                "aes-256-cfb1": {
                    cipher: "AES",
                    key: 256,
                    iv: 16,
                    mode: "CFB1",
                    type: "stream"
                },
                "aes-128-ofb": {
                    cipher: "AES",
                    key: 128,
                    iv: 16,
                    mode: "OFB",
                    type: "stream"
                },
                "aes-192-ofb": {
                    cipher: "AES",
                    key: 192,
                    iv: 16,
                    mode: "OFB",
                    type: "stream"
                },
                "aes-256-ofb": {
                    cipher: "AES",
                    key: 256,
                    iv: 16,
                    mode: "OFB",
                    type: "stream"
                },
                "aes-128-ctr": {
                    cipher: "AES",
                    key: 128,
                    iv: 16,
                    mode: "CTR",
                    type: "stream"
                },
                "aes-192-ctr": {
                    cipher: "AES",
                    key: 192,
                    iv: 16,
                    mode: "CTR",
                    type: "stream"
                },
                "aes-256-ctr": {
                    cipher: "AES",
                    key: 256,
                    iv: 16,
                    mode: "CTR",
                    type: "stream"
                },
                "aes-128-gcm": {
                    cipher: "AES",
                    key: 128,
                    iv: 12,
                    mode: "GCM",
                    type: "auth"
                },
                "aes-192-gcm": {
                    cipher: "AES",
                    key: 192,
                    iv: 12,
                    mode: "GCM",
                    type: "auth"
                },
                "aes-256-gcm": {
                    cipher: "AES",
                    key: 256,
                    iv: 12,
                    mode: "GCM",
                    type: "auth"
                }
            };
        }, {} ],
        60: [ function(require, module, exports) {
            (function(Buffer) {
                var xor = require("buffer-xor");
                function getBlock(self) {
                    return self._prev = self._cipher.encryptBlock(self._prev), self._prev;
                }
                exports.encrypt = function(self, chunk) {
                    for (;self._cache.length < chunk.length; ) self._cache = Buffer.concat([ self._cache, getBlock(self) ]);
                    var pad = self._cache.slice(0, chunk.length);
                    return self._cache = self._cache.slice(chunk.length), xor(chunk, pad);
                };
            }).call(this, require("buffer").Buffer);
        }, {
            buffer: 77,
            "buffer-xor": 76
        } ],
        61: [ function(require, module, exports) {
            var aes = require("./aes"), Buffer = require("safe-buffer").Buffer, Transform = require("cipher-base");
            function StreamCipher(mode, key, iv, decrypt) {
                Transform.call(this), this._cipher = new aes.AES(key), this._prev = Buffer.from(iv), 
                this._cache = Buffer.allocUnsafe(0), this._secCache = Buffer.allocUnsafe(0), this._decrypt = decrypt, 
                this._mode = mode;
            }
            require("inherits")(StreamCipher, Transform), StreamCipher.prototype._update = function(chunk) {
                return this._mode.encrypt(this, chunk, this._decrypt);
            }, StreamCipher.prototype._final = function() {
                this._cipher.scrub();
            }, module.exports = StreamCipher;
        }, {
            "./aes": 45,
            "cipher-base": 79,
            inherits: 152,
            "safe-buffer": 244
        } ],
        62: [ function(require, module, exports) {
            var ebtk = require("evp_bytestokey"), aes = require("browserify-aes/browser"), DES = require("browserify-des"), desModes = require("browserify-des/modes"), aesModes = require("browserify-aes/modes");
            function createCipheriv(suite, key, iv) {
                if (suite = suite.toLowerCase(), aesModes[suite]) return aes.createCipheriv(suite, key, iv);
                if (desModes[suite]) return new DES({
                    key: key,
                    iv: iv,
                    mode: suite
                });
                throw new TypeError("invalid suite type");
            }
            function createDecipheriv(suite, key, iv) {
                if (suite = suite.toLowerCase(), aesModes[suite]) return aes.createDecipheriv(suite, key, iv);
                if (desModes[suite]) return new DES({
                    key: key,
                    iv: iv,
                    mode: suite,
                    decrypt: !0
                });
                throw new TypeError("invalid suite type");
            }
            exports.createCipher = exports.Cipher = function(suite, password) {
                var keyLen, ivLen;
                if (suite = suite.toLowerCase(), aesModes[suite]) keyLen = aesModes[suite].key, 
                ivLen = aesModes[suite].iv; else {
                    if (!desModes[suite]) throw new TypeError("invalid suite type");
                    keyLen = 8 * desModes[suite].key, ivLen = desModes[suite].iv;
                }
                var keys = ebtk(password, !1, keyLen, ivLen);
                return createCipheriv(suite, keys.key, keys.iv);
            }, exports.createCipheriv = exports.Cipheriv = createCipheriv, exports.createDecipher = exports.Decipher = function(suite, password) {
                var keyLen, ivLen;
                if (suite = suite.toLowerCase(), aesModes[suite]) keyLen = aesModes[suite].key, 
                ivLen = aesModes[suite].iv; else {
                    if (!desModes[suite]) throw new TypeError("invalid suite type");
                    keyLen = 8 * desModes[suite].key, ivLen = desModes[suite].iv;
                }
                var keys = ebtk(password, !1, keyLen, ivLen);
                return createDecipheriv(suite, keys.key, keys.iv);
            }, exports.createDecipheriv = exports.Decipheriv = createDecipheriv, exports.listCiphers = exports.getCiphers = function() {
                return Object.keys(desModes).concat(aes.getCiphers());
            };
        }, {
            "browserify-aes/browser": 47,
            "browserify-aes/modes": 58,
            "browserify-des": 63,
            "browserify-des/modes": 64,
            evp_bytestokey: 135
        } ],
        63: [ function(require, module, exports) {
            (function(Buffer) {
                var CipherBase = require("cipher-base"), des = require("des.js"), inherits = require("inherits"), modes = {
                    "des-ede3-cbc": des.CBC.instantiate(des.EDE),
                    "des-ede3": des.EDE,
                    "des-ede-cbc": des.CBC.instantiate(des.EDE),
                    "des-ede": des.EDE,
                    "des-cbc": des.CBC.instantiate(des.DES),
                    "des-ecb": des.DES
                };
                function DES(opts) {
                    CipherBase.call(this);
                    var type, modeName = opts.mode.toLowerCase(), mode = modes[modeName];
                    type = opts.decrypt ? "decrypt" : "encrypt";
                    var key = opts.key;
                    "des-ede" !== modeName && "des-ede-cbc" !== modeName || (key = Buffer.concat([ key, key.slice(0, 8) ]));
                    var iv = opts.iv;
                    this._des = mode.create({
                        key: key,
                        iv: iv,
                        type: type
                    });
                }
                modes.des = modes["des-cbc"], modes.des3 = modes["des-ede3-cbc"], inherits(module.exports = DES, CipherBase), 
                DES.prototype._update = function(data) {
                    return new Buffer(this._des.update(data));
                }, DES.prototype._final = function() {
                    return new Buffer(this._des.final());
                };
            }).call(this, require("buffer").Buffer);
        }, {
            buffer: 77,
            "cipher-base": 79,
            "des.js": 109,
            inherits: 152
        } ],
        64: [ function(require, module, exports) {
            exports["des-ecb"] = {
                key: 8,
                iv: 0
            }, exports["des-cbc"] = exports.des = {
                key: 8,
                iv: 8
            }, exports["des-ede3-cbc"] = exports.des3 = {
                key: 24,
                iv: 8
            }, exports["des-ede3"] = {
                key: 24,
                iv: 0
            }, exports["des-ede-cbc"] = {
                key: 16,
                iv: 8
            }, exports["des-ede"] = {
                key: 16,
                iv: 0
            };
        }, {} ],
        65: [ function(require, module, exports) {
            (function(Buffer) {
                var bn = require("bn.js"), randomBytes = require("randombytes");
                function crt(msg, priv) {
                    var blinds = function(priv) {
                        var r = getr(priv);
                        return {
                            blinder: r.toRed(bn.mont(priv.modulus)).redPow(new bn(priv.publicExponent)).fromRed(),
                            unblinder: r.invm(priv.modulus)
                        };
                    }(priv), len = priv.modulus.byteLength(), blinded = (bn.mont(priv.modulus), new bn(msg).mul(blinds.blinder).umod(priv.modulus)), c1 = blinded.toRed(bn.mont(priv.prime1)), c2 = blinded.toRed(bn.mont(priv.prime2)), qinv = priv.coefficient, p = priv.prime1, q = priv.prime2, m1 = c1.redPow(priv.exponent1), m2 = c2.redPow(priv.exponent2);
                    m1 = m1.fromRed(), m2 = m2.fromRed();
                    var h = m1.isub(m2).imul(qinv).umod(p);
                    return h.imul(q), m2.iadd(h), new Buffer(m2.imul(blinds.unblinder).umod(priv.modulus).toArray(!1, len));
                }
                function getr(priv) {
                    for (var len = priv.modulus.byteLength(), r = new bn(randomBytes(len)); 0 <= r.cmp(priv.modulus) || !r.umod(priv.prime1) || !r.umod(priv.prime2); ) r = new bn(randomBytes(len));
                    return r;
                }
                (module.exports = crt).getr = getr;
            }).call(this, require("buffer").Buffer);
        }, {
            "bn.js": 42,
            buffer: 77,
            randombytes: 231
        } ],
        66: [ function(require, module, exports) {
            module.exports = require("./browser/algorithms.json");
        }, {
            "./browser/algorithms.json": 67
        } ],
        67: [ function(require, module, exports) {
            module.exports = {
                sha224WithRSAEncryption: {
                    sign: "rsa",
                    hash: "sha224",
                    id: "302d300d06096086480165030402040500041c"
                },
                "RSA-SHA224": {
                    sign: "ecdsa/rsa",
                    hash: "sha224",
                    id: "302d300d06096086480165030402040500041c"
                },
                sha256WithRSAEncryption: {
                    sign: "rsa",
                    hash: "sha256",
                    id: "3031300d060960864801650304020105000420"
                },
                "RSA-SHA256": {
                    sign: "ecdsa/rsa",
                    hash: "sha256",
                    id: "3031300d060960864801650304020105000420"
                },
                sha384WithRSAEncryption: {
                    sign: "rsa",
                    hash: "sha384",
                    id: "3041300d060960864801650304020205000430"
                },
                "RSA-SHA384": {
                    sign: "ecdsa/rsa",
                    hash: "sha384",
                    id: "3041300d060960864801650304020205000430"
                },
                sha512WithRSAEncryption: {
                    sign: "rsa",
                    hash: "sha512",
                    id: "3051300d060960864801650304020305000440"
                },
                "RSA-SHA512": {
                    sign: "ecdsa/rsa",
                    hash: "sha512",
                    id: "3051300d060960864801650304020305000440"
                },
                "RSA-SHA1": {
                    sign: "rsa",
                    hash: "sha1",
                    id: "3021300906052b0e03021a05000414"
                },
                "ecdsa-with-SHA1": {
                    sign: "ecdsa",
                    hash: "sha1",
                    id: ""
                },
                sha256: {
                    sign: "ecdsa",
                    hash: "sha256",
                    id: ""
                },
                sha224: {
                    sign: "ecdsa",
                    hash: "sha224",
                    id: ""
                },
                sha384: {
                    sign: "ecdsa",
                    hash: "sha384",
                    id: ""
                },
                sha512: {
                    sign: "ecdsa",
                    hash: "sha512",
                    id: ""
                },
                "DSA-SHA": {
                    sign: "dsa",
                    hash: "sha1",
                    id: ""
                },
                "DSA-SHA1": {
                    sign: "dsa",
                    hash: "sha1",
                    id: ""
                },
                DSA: {
                    sign: "dsa",
                    hash: "sha1",
                    id: ""
                },
                "DSA-WITH-SHA224": {
                    sign: "dsa",
                    hash: "sha224",
                    id: ""
                },
                "DSA-SHA224": {
                    sign: "dsa",
                    hash: "sha224",
                    id: ""
                },
                "DSA-WITH-SHA256": {
                    sign: "dsa",
                    hash: "sha256",
                    id: ""
                },
                "DSA-SHA256": {
                    sign: "dsa",
                    hash: "sha256",
                    id: ""
                },
                "DSA-WITH-SHA384": {
                    sign: "dsa",
                    hash: "sha384",
                    id: ""
                },
                "DSA-SHA384": {
                    sign: "dsa",
                    hash: "sha384",
                    id: ""
                },
                "DSA-WITH-SHA512": {
                    sign: "dsa",
                    hash: "sha512",
                    id: ""
                },
                "DSA-SHA512": {
                    sign: "dsa",
                    hash: "sha512",
                    id: ""
                },
                "DSA-RIPEMD160": {
                    sign: "dsa",
                    hash: "rmd160",
                    id: ""
                },
                ripemd160WithRSA: {
                    sign: "rsa",
                    hash: "rmd160",
                    id: "3021300906052b2403020105000414"
                },
                "RSA-RIPEMD160": {
                    sign: "rsa",
                    hash: "rmd160",
                    id: "3021300906052b2403020105000414"
                },
                md5WithRSAEncryption: {
                    sign: "rsa",
                    hash: "md5",
                    id: "3020300c06082a864886f70d020505000410"
                },
                "RSA-MD5": {
                    sign: "rsa",
                    hash: "md5",
                    id: "3020300c06082a864886f70d020505000410"
                }
            };
        }, {} ],
        68: [ function(require, module, exports) {
            module.exports = {
                "1.3.132.0.10": "secp256k1",
                "1.3.132.0.33": "p224",
                "1.2.840.10045.3.1.1": "p192",
                "1.2.840.10045.3.1.7": "p256",
                "1.3.132.0.34": "p384",
                "1.3.132.0.35": "p521"
            };
        }, {} ],
        69: [ function(require, module, exports) {
            (function(Buffer) {
                var createHash = require("create-hash"), stream = require("stream"), inherits = require("inherits"), sign = require("./sign"), verify = require("./verify"), algorithms = require("./algorithms.json");
                function Sign(algorithm) {
                    stream.Writable.call(this);
                    var data = algorithms[algorithm];
                    if (!data) throw new Error("Unknown message digest");
                    this._hashType = data.hash, this._hash = createHash(data.hash), this._tag = data.id, 
                    this._signType = data.sign;
                }
                function Verify(algorithm) {
                    stream.Writable.call(this);
                    var data = algorithms[algorithm];
                    if (!data) throw new Error("Unknown message digest");
                    this._hash = createHash(data.hash), this._tag = data.id, this._signType = data.sign;
                }
                function createSign(algorithm) {
                    return new Sign(algorithm);
                }
                function createVerify(algorithm) {
                    return new Verify(algorithm);
                }
                Object.keys(algorithms).forEach(function(key) {
                    algorithms[key].id = new Buffer(algorithms[key].id, "hex"), algorithms[key.toLowerCase()] = algorithms[key];
                }), inherits(Sign, stream.Writable), Sign.prototype._write = function(data, _, done) {
                    this._hash.update(data), done();
                }, Sign.prototype.update = function(data, enc) {
                    return "string" == typeof data && (data = new Buffer(data, enc)), this._hash.update(data), 
                    this;
                }, Sign.prototype.sign = function(key, enc) {
                    this.end();
                    var hash = this._hash.digest(), sig = sign(hash, key, this._hashType, this._signType, this._tag);
                    return enc ? sig.toString(enc) : sig;
                }, inherits(Verify, stream.Writable), Verify.prototype._write = function(data, _, done) {
                    this._hash.update(data), done();
                }, Verify.prototype.update = function(data, enc) {
                    return "string" == typeof data && (data = new Buffer(data, enc)), this._hash.update(data), 
                    this;
                }, Verify.prototype.verify = function(key, sig, enc) {
                    "string" == typeof sig && (sig = new Buffer(sig, enc)), this.end();
                    var hash = this._hash.digest();
                    return verify(sig, hash, key, this._signType, this._tag);
                }, module.exports = {
                    Sign: createSign,
                    Verify: createVerify,
                    createSign: createSign,
                    createVerify: createVerify
                };
            }).call(this, require("buffer").Buffer);
        }, {
            "./algorithms.json": 67,
            "./sign": 70,
            "./verify": 71,
            buffer: 77,
            "create-hash": 103,
            inherits: 152,
            stream: 254
        } ],
        70: [ function(require, module, exports) {
            (function(Buffer) {
                var createHmac = require("create-hmac"), crt = require("browserify-rsa"), EC = require("elliptic").ec, BN = require("bn.js"), parseKeys = require("parse-asn1"), curves = require("./curves.json");
                function getKey(x, q, hash, algo) {
                    if ((x = new Buffer(x.toArray())).length < q.byteLength()) {
                        var zeros = new Buffer(q.byteLength() - x.length);
                        zeros.fill(0), x = Buffer.concat([ zeros, x ]);
                    }
                    var hlen = hash.length, hbits = function(bits, q) {
                        bits = (bits = bits2int(bits, q)).mod(q);
                        var out = new Buffer(bits.toArray());
                        if (out.length < q.byteLength()) {
                            var zeros = new Buffer(q.byteLength() - out.length);
                            zeros.fill(0), out = Buffer.concat([ zeros, out ]);
                        }
                        return out;
                    }(hash, q), v = new Buffer(hlen);
                    v.fill(1);
                    var k = new Buffer(hlen);
                    return k.fill(0), k = createHmac(algo, k).update(v).update(new Buffer([ 0 ])).update(x).update(hbits).digest(), 
                    v = createHmac(algo, k).update(v).digest(), {
                        k: k = createHmac(algo, k).update(v).update(new Buffer([ 1 ])).update(x).update(hbits).digest(),
                        v: v = createHmac(algo, k).update(v).digest()
                    };
                }
                function bits2int(obits, q) {
                    var bits = new BN(obits), shift = (obits.length << 3) - q.bitLength();
                    return 0 < shift && bits.ishrn(shift), bits;
                }
                function makeKey(q, kv, algo) {
                    var t, k;
                    do {
                        for (t = new Buffer(0); 8 * t.length < q.bitLength(); ) kv.v = createHmac(algo, kv.k).update(kv.v).digest(), 
                        t = Buffer.concat([ t, kv.v ]);
                        k = bits2int(t, q), kv.k = createHmac(algo, kv.k).update(kv.v).update(new Buffer([ 0 ])).digest(), 
                        kv.v = createHmac(algo, kv.k).update(kv.v).digest();
                    } while (-1 !== k.cmp(q));
                    return k;
                }
                function makeR(g, k, p, q) {
                    return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q);
                }
                module.exports = function(hash, key, hashType, signType, tag) {
                    var priv = parseKeys(key);
                    if (priv.curve) {
                        if ("ecdsa" !== signType && "ecdsa/rsa" !== signType) throw new Error("wrong private key type");
                        return function(hash, priv) {
                            var curveId = curves[priv.curve.join(".")];
                            if (!curveId) throw new Error("unknown curve " + priv.curve.join("."));
                            var out = new EC(curveId).keyFromPrivate(priv.privateKey).sign(hash);
                            return new Buffer(out.toDER());
                        }(hash, priv);
                    }
                    if ("dsa" === priv.type) {
                        if ("dsa" !== signType) throw new Error("wrong private key type");
                        return function(hash, priv, algo) {
                            for (var k, x = priv.params.priv_key, p = priv.params.p, q = priv.params.q, g = priv.params.g, r = new BN(0), H = bits2int(hash, q).mod(q), s = !1, kv = getKey(x, q, hash, algo); !1 === s; ) k = makeKey(q, kv, algo), 
                            r = makeR(g, k, p, q), 0 === (s = k.invm(q).imul(H.add(x.mul(r))).mod(q)).cmpn(0) && (s = !1, 
                            r = new BN(0));
                            return function(r, s) {
                                r = r.toArray(), s = s.toArray(), 128 & r[0] && (r = [ 0 ].concat(r)), 128 & s[0] && (s = [ 0 ].concat(s));
                                var res = [ 48, r.length + s.length + 4, 2, r.length ];
                                return res = res.concat(r, [ 2, s.length ], s), new Buffer(res);
                            }(r, s);
                        }(hash, priv, hashType);
                    }
                    if ("rsa" !== signType && "ecdsa/rsa" !== signType) throw new Error("wrong private key type");
                    hash = Buffer.concat([ tag, hash ]);
                    for (var len = priv.modulus.byteLength(), pad = [ 0, 1 ]; hash.length + pad.length + 1 < len; ) pad.push(255);
                    pad.push(0);
                    for (var i = -1; ++i < hash.length; ) pad.push(hash[i]);
                    return crt(pad, priv);
                }, module.exports.getKey = getKey, module.exports.makeKey = makeKey;
            }).call(this, require("buffer").Buffer);
        }, {
            "./curves.json": 68,
            "bn.js": 42,
            "browserify-rsa": 65,
            buffer: 77,
            "create-hmac": 106,
            elliptic: 119,
            "parse-asn1": 217
        } ],
        71: [ function(require, module, exports) {
            (function(Buffer) {
                var BN = require("bn.js"), EC = require("elliptic").ec, parseKeys = require("parse-asn1"), curves = require("./curves.json");
                function checkValue(b, q) {
                    if (b.cmpn(0) <= 0) throw new Error("invalid sig");
                    if (b.cmp(q) >= q) throw new Error("invalid sig");
                }
                module.exports = function(sig, hash, key, signType, tag) {
                    var pub = parseKeys(key);
                    if ("ec" === pub.type) {
                        if ("ecdsa" !== signType && "ecdsa/rsa" !== signType) throw new Error("wrong public key type");
                        return function(sig, hash, pub) {
                            var curveId = curves[pub.data.algorithm.curve.join(".")];
                            if (!curveId) throw new Error("unknown curve " + pub.data.algorithm.curve.join("."));
                            var curve = new EC(curveId), pubkey = pub.data.subjectPrivateKey.data;
                            return curve.verify(hash, sig, pubkey);
                        }(sig, hash, pub);
                    }
                    if ("dsa" === pub.type) {
                        if ("dsa" !== signType) throw new Error("wrong public key type");
                        return function(sig, hash, pub) {
                            var p = pub.data.p, q = pub.data.q, g = pub.data.g, y = pub.data.pub_key, unpacked = parseKeys.signature.decode(sig, "der"), s = unpacked.s, r = unpacked.r;
                            checkValue(s, q), checkValue(r, q);
                            var montp = BN.mont(p), w = s.invm(q);
                            return 0 === g.toRed(montp).redPow(new BN(hash).mul(w).mod(q)).fromRed().mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed()).mod(p).mod(q).cmp(r);
                        }(sig, hash, pub);
                    }
                    if ("rsa" !== signType && "ecdsa/rsa" !== signType) throw new Error("wrong public key type");
                    hash = Buffer.concat([ tag, hash ]);
                    for (var len = pub.modulus.byteLength(), pad = [ 1 ], padNum = 0; hash.length + pad.length + 2 < len; ) pad.push(255), 
                    padNum++;
                    pad.push(0);
                    for (var i = -1; ++i < hash.length; ) pad.push(hash[i]);
                    pad = new Buffer(pad);
                    var red = BN.mont(pub.modulus);
                    sig = (sig = new BN(sig).toRed(red)).redPow(new BN(pub.publicExponent)), sig = new Buffer(sig.fromRed().toArray());
                    var out = padNum < 8 ? 1 : 0;
                    for (len = Math.min(sig.length, pad.length), sig.length !== pad.length && (out = 1), 
                    i = -1; ++i < len; ) out |= sig[i] ^ pad[i];
                    return 0 === out;
                };
            }).call(this, require("buffer").Buffer);
        }, {
            "./curves.json": 68,
            "bn.js": 42,
            buffer: 77,
            elliptic: 119,
            "parse-asn1": 217
        } ],
        72: [ function(require, module, exports) {
            arguments[4][44][0].apply(exports, arguments);
        }, {
            dup: 44
        } ],
        73: [ function(require, module, exports) {
            var objectCreate = Object.create || function(proto) {
                var F = function() {};
                return F.prototype = proto, new F();
            }, objectKeys = Object.keys || function(obj) {
                var keys = [];
                for (var k in obj) Object.prototype.hasOwnProperty.call(obj, k) && keys.push(k);
                return k;
            }, bind = Function.prototype.bind || function(context) {
                var fn = this;
                return function() {
                    return fn.apply(context, arguments);
                };
            };
            function EventEmitter() {
                this._events && Object.prototype.hasOwnProperty.call(this, "_events") || (this._events = objectCreate(null), 
                this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
            }
            ((module.exports = EventEmitter).EventEmitter = EventEmitter).prototype._events = void 0, 
            EventEmitter.prototype._maxListeners = void 0;
            var hasDefineProperty, defaultMaxListeners = 10;
            try {
                var o = {};
                Object.defineProperty && Object.defineProperty(o, "x", {
                    value: 0
                }), hasDefineProperty = 0 === o.x;
            } catch (err) {
                hasDefineProperty = !1;
            }
            function $getMaxListeners(that) {
                return void 0 === that._maxListeners ? EventEmitter.defaultMaxListeners : that._maxListeners;
            }
            function _addListener(target, type, listener, prepend) {
                var m, events, existing;
                if ("function" != typeof listener) throw new TypeError('"listener" argument must be a function');
                if ((events = target._events) ? (events.newListener && (target.emit("newListener", type, listener.listener ? listener.listener : listener), 
                events = target._events), existing = events[type]) : (events = target._events = objectCreate(null), 
                target._eventsCount = 0), existing) {
                    if ("function" == typeof existing ? existing = events[type] = prepend ? [ listener, existing ] : [ existing, listener ] : prepend ? existing.unshift(listener) : existing.push(listener), 
                    !existing.warned && (m = $getMaxListeners(target)) && 0 < m && existing.length > m) {
                        existing.warned = !0;
                        var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + ' "' + String(type) + '" listeners added. Use emitter.setMaxListeners() to increase limit.');
                        w.name = "MaxListenersExceededWarning", w.emitter = target, w.type = type, w.count = existing.length, 
                        "object" == typeof console && console.warn && console.warn("%s: %s", w.name, w.message);
                    }
                } else existing = events[type] = listener, ++target._eventsCount;
                return target;
            }
            function onceWrapper() {
                if (!this.fired) switch (this.target.removeListener(this.type, this.wrapFn), this.fired = !0, 
                arguments.length) {
                  case 0:
                    return this.listener.call(this.target);

                  case 1:
                    return this.listener.call(this.target, arguments[0]);

                  case 2:
                    return this.listener.call(this.target, arguments[0], arguments[1]);

                  case 3:
                    return this.listener.call(this.target, arguments[0], arguments[1], arguments[2]);

                  default:
                    for (var args = new Array(arguments.length), i = 0; i < args.length; ++i) args[i] = arguments[i];
                    this.listener.apply(this.target, args);
                }
            }
            function _onceWrap(target, type, listener) {
                var state = {
                    fired: !1,
                    wrapFn: void 0,
                    target: target,
                    type: type,
                    listener: listener
                }, wrapped = bind.call(onceWrapper, state);
                return wrapped.listener = listener, state.wrapFn = wrapped;
            }
            function _listeners(target, type, unwrap) {
                var events = target._events;
                if (!events) return [];
                var evlistener = events[type];
                return evlistener ? "function" == typeof evlistener ? unwrap ? [ evlistener.listener || evlistener ] : [ evlistener ] : unwrap ? function(arr) {
                    for (var ret = new Array(arr.length), i = 0; i < ret.length; ++i) ret[i] = arr[i].listener || arr[i];
                    return ret;
                }(evlistener) : arrayClone(evlistener, evlistener.length) : [];
            }
            function listenerCount(type) {
                var events = this._events;
                if (events) {
                    var evlistener = events[type];
                    if ("function" == typeof evlistener) return 1;
                    if (evlistener) return evlistener.length;
                }
                return 0;
            }
            function arrayClone(arr, n) {
                for (var copy = new Array(n), i = 0; i < n; ++i) copy[i] = arr[i];
                return copy;
            }
            hasDefineProperty ? Object.defineProperty(EventEmitter, "defaultMaxListeners", {
                enumerable: !0,
                get: function() {
                    return defaultMaxListeners;
                },
                set: function(arg) {
                    if ("number" != typeof arg || arg < 0 || arg != arg) throw new TypeError('"defaultMaxListeners" must be a positive number');
                    defaultMaxListeners = arg;
                }
            }) : EventEmitter.defaultMaxListeners = defaultMaxListeners, EventEmitter.prototype.setMaxListeners = function(n) {
                if ("number" != typeof n || n < 0 || isNaN(n)) throw new TypeError('"n" argument must be a positive number');
                return this._maxListeners = n, this;
            }, EventEmitter.prototype.getMaxListeners = function() {
                return $getMaxListeners(this);
            }, EventEmitter.prototype.emit = function(type) {
                var er, handler, len, args, i, events, doError = "error" === type;
                if (events = this._events) doError = doError && null == events.error; else if (!doError) return !1;
                if (doError) {
                    if (1 < arguments.length && (er = arguments[1]), er instanceof Error) throw er;
                    var err = new Error('Unhandled "error" event. (' + er + ")");
                    throw err.context = er, err;
                }
                if (!(handler = events[type])) return !1;
                var isFn = "function" == typeof handler;
                switch (len = arguments.length) {
                  case 1:
                    !function(handler, isFn, self) {
                        if (isFn) handler.call(self); else for (var len = handler.length, listeners = arrayClone(handler, len), i = 0; i < len; ++i) listeners[i].call(self);
                    }(handler, isFn, this);
                    break;

                  case 2:
                    !function(handler, isFn, self, arg1) {
                        if (isFn) handler.call(self, arg1); else for (var len = handler.length, listeners = arrayClone(handler, len), i = 0; i < len; ++i) listeners[i].call(self, arg1);
                    }(handler, isFn, this, arguments[1]);
                    break;

                  case 3:
                    !function(handler, isFn, self, arg1, arg2) {
                        if (isFn) handler.call(self, arg1, arg2); else for (var len = handler.length, listeners = arrayClone(handler, len), i = 0; i < len; ++i) listeners[i].call(self, arg1, arg2);
                    }(handler, isFn, this, arguments[1], arguments[2]);
                    break;

                  case 4:
                    !function(handler, isFn, self, arg1, arg2, arg3) {
                        if (isFn) handler.call(self, arg1, arg2, arg3); else for (var len = handler.length, listeners = arrayClone(handler, len), i = 0; i < len; ++i) listeners[i].call(self, arg1, arg2, arg3);
                    }(handler, isFn, this, arguments[1], arguments[2], arguments[3]);
                    break;

                  default:
                    for (args = new Array(len - 1), i = 1; i < len; i++) args[i - 1] = arguments[i];
                    !function(handler, isFn, self, args) {
                        if (isFn) handler.apply(self, args); else for (var len = handler.length, listeners = arrayClone(handler, len), i = 0; i < len; ++i) listeners[i].apply(self, args);
                    }(handler, isFn, this, args);
                }
                return !0;
            }, EventEmitter.prototype.on = EventEmitter.prototype.addListener = function(type, listener) {
                return _addListener(this, type, listener, !1);
            }, EventEmitter.prototype.prependListener = function(type, listener) {
                return _addListener(this, type, listener, !0);
            }, EventEmitter.prototype.once = function(type, listener) {
                if ("function" != typeof listener) throw new TypeError('"listener" argument must be a function');
                return this.on(type, _onceWrap(this, type, listener)), this;
            }, EventEmitter.prototype.prependOnceListener = function(type, listener) {
                if ("function" != typeof listener) throw new TypeError('"listener" argument must be a function');
                return this.prependListener(type, _onceWrap(this, type, listener)), this;
            }, EventEmitter.prototype.removeListener = function(type, listener) {
                var list, events, position, i, originalListener;
                if ("function" != typeof listener) throw new TypeError('"listener" argument must be a function');
                if (!(events = this._events)) return this;
                if (!(list = events[type])) return this;
                if (list === listener || list.listener === listener) 0 == --this._eventsCount ? this._events = objectCreate(null) : (delete events[type], 
                events.removeListener && this.emit("removeListener", type, list.listener || listener)); else if ("function" != typeof list) {
                    for (position = -1, i = list.length - 1; 0 <= i; i--) if (list[i] === listener || list[i].listener === listener) {
                        originalListener = list[i].listener, position = i;
                        break;
                    }
                    if (position < 0) return this;
                    0 === position ? list.shift() : function(list, index) {
                        for (var i = index, k = i + 1, n = list.length; k < n; i += 1, k += 1) list[i] = list[k];
                        list.pop();
                    }(list, position), 1 === list.length && (events[type] = list[0]), events.removeListener && this.emit("removeListener", type, originalListener || listener);
                }
                return this;
            }, EventEmitter.prototype.removeAllListeners = function(type) {
                var listeners, events, i;
                if (!(events = this._events)) return this;
                if (!events.removeListener) return 0 === arguments.length ? (this._events = objectCreate(null), 
                this._eventsCount = 0) : events[type] && (0 == --this._eventsCount ? this._events = objectCreate(null) : delete events[type]), 
                this;
                if (0 === arguments.length) {
                    var key, keys = objectKeys(events);
                    for (i = 0; i < keys.length; ++i) "removeListener" !== (key = keys[i]) && this.removeAllListeners(key);
                    return this.removeAllListeners("removeListener"), this._events = objectCreate(null), 
                    this._eventsCount = 0, this;
                }
                if ("function" == typeof (listeners = events[type])) this.removeListener(type, listeners); else if (listeners) for (i = listeners.length - 1; 0 <= i; i--) this.removeListener(type, listeners[i]);
                return this;
            }, EventEmitter.prototype.listeners = function(type) {
                return _listeners(this, type, !0);
            }, EventEmitter.prototype.rawListeners = function(type) {
                return _listeners(this, type, !1);
            }, EventEmitter.listenerCount = function(emitter, type) {
                return "function" == typeof emitter.listenerCount ? emitter.listenerCount(type) : listenerCount.call(emitter, type);
            }, EventEmitter.prototype.listenerCount = listenerCount, EventEmitter.prototype.eventNames = function() {
                return 0 < this._eventsCount ? Reflect.ownKeys(this._events) : [];
            };
        }, {} ],
        74: [ function(require, module, exports) {
            "use strict";
            var Buffer = require("safe-buffer").Buffer, isEncoding = Buffer.isEncoding || function(encoding) {
                switch ((encoding = "" + 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 !0;

                  default:
                    return !1;
                }
            };
            function StringDecoder(encoding) {
                var nb;
                switch (this.encoding = function(enc) {
                    var nenc = function(enc) {
                        if (!enc) return "utf8";
                        for (var retried; ;) switch (enc) {
                          case "utf8":
                          case "utf-8":
                            return "utf8";

                          case "ucs2":
                          case "ucs-2":
                          case "utf16le":
                          case "utf-16le":
                            return "utf16le";

                          case "latin1":
                          case "binary":
                            return "latin1";

                          case "base64":
                          case "ascii":
                          case "hex":
                            return enc;

                          default:
                            if (retried) return;
                            enc = ("" + enc).toLowerCase(), retried = !0;
                        }
                    }(enc);
                    if ("string" != typeof nenc && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error("Unknown encoding: " + enc);
                    return nenc || enc;
                }(encoding), this.encoding) {
                  case "utf16le":
                    this.text = utf16Text, this.end = utf16End, nb = 4;
                    break;

                  case "utf8":
                    this.fillLast = utf8FillLast, nb = 4;
                    break;

                  case "base64":
                    this.text = base64Text, this.end = base64End, nb = 3;
                    break;

                  default:
                    return this.write = simpleWrite, void (this.end = simpleEnd);
                }
                this.lastNeed = 0, this.lastTotal = 0, this.lastChar = Buffer.allocUnsafe(nb);
            }
            function utf8CheckByte(byte) {
                return byte <= 127 ? 0 : byte >> 5 == 6 ? 2 : byte >> 4 == 14 ? 3 : byte >> 3 == 30 ? 4 : byte >> 6 == 2 ? -1 : -2;
            }
            function utf8FillLast(buf) {
                var p = this.lastTotal - this.lastNeed, r = function(self, buf, p) {
                    if (128 != (192 & buf[0])) return self.lastNeed = 0, "�";
                    if (1 < self.lastNeed && 1 < buf.length) {
                        if (128 != (192 & buf[1])) return self.lastNeed = 1, "�";
                        if (2 < self.lastNeed && 2 < buf.length && 128 != (192 & buf[2])) return self.lastNeed = 2, 
                        "�";
                    }
                }(this, buf);
                return void 0 !== r ? r : this.lastNeed <= buf.length ? (buf.copy(this.lastChar, p, 0, this.lastNeed), 
                this.lastChar.toString(this.encoding, 0, this.lastTotal)) : (buf.copy(this.lastChar, p, 0, buf.length), 
                void (this.lastNeed -= buf.length));
            }
            function utf16Text(buf, i) {
                if ((buf.length - i) % 2 == 0) {
                    var r = buf.toString("utf16le", i);
                    if (r) {
                        var c = r.charCodeAt(r.length - 1);
                        if (55296 <= c && c <= 56319) return this.lastNeed = 2, this.lastTotal = 4, this.lastChar[0] = buf[buf.length - 2], 
                        this.lastChar[1] = buf[buf.length - 1], r.slice(0, -1);
                    }
                    return r;
                }
                return this.lastNeed = 1, this.lastTotal = 2, this.lastChar[0] = buf[buf.length - 1], 
                buf.toString("utf16le", i, buf.length - 1);
            }
            function utf16End(buf) {
                var r = buf && buf.length ? this.write(buf) : "";
                if (this.lastNeed) {
                    var end = this.lastTotal - this.lastNeed;
                    return r + this.lastChar.toString("utf16le", 0, end);
                }
                return r;
            }
            function base64Text(buf, i) {
                var n = (buf.length - i) % 3;
                return 0 === n ? buf.toString("base64", i) : (this.lastNeed = 3 - n, this.lastTotal = 3, 
                1 === n ? this.lastChar[0] = buf[buf.length - 1] : (this.lastChar[0] = buf[buf.length - 2], 
                this.lastChar[1] = buf[buf.length - 1]), buf.toString("base64", i, buf.length - n));
            }
            function base64End(buf) {
                var r = buf && buf.length ? this.write(buf) : "";
                return this.lastNeed ? r + this.lastChar.toString("base64", 0, 3 - this.lastNeed) : r;
            }
            function simpleWrite(buf) {
                return buf.toString(this.encoding);
            }
            function simpleEnd(buf) {
                return buf && buf.length ? this.write(buf) : "";
            }
            (exports.StringDecoder = StringDecoder).prototype.write = function(buf) {
                if (0 === buf.length) return "";
                var r, i;
                if (this.lastNeed) {
                    if (void 0 === (r = this.fillLast(buf))) return "";
                    i = this.lastNeed, this.lastNeed = 0;
                } else i = 0;
                return i < buf.length ? r ? r + this.text(buf, i) : this.text(buf, i) : r || "";
            }, StringDecoder.prototype.end = function(buf) {
                var r = buf && buf.length ? this.write(buf) : "";
                return this.lastNeed ? r + "�" : r;
            }, StringDecoder.prototype.text = function(buf, i) {
                var total = function(self, buf, i) {
                    var j = buf.length - 1;
                    if (j < i) return 0;
                    var nb = utf8CheckByte(buf[j]);
                    if (0 <= nb) return 0 < nb && (self.lastNeed = nb - 1), nb;
                    if (--j < i || -2 === nb) return 0;
                    if (0 <= (nb = utf8CheckByte(buf[j]))) return 0 < nb && (self.lastNeed = nb - 2), 
                    nb;
                    if (--j < i || -2 === nb) return 0;
                    if (0 <= (nb = utf8CheckByte(buf[j]))) return 0 < nb && (2 === nb ? nb = 0 : self.lastNeed = nb - 3), 
                    nb;
                    return 0;
                }(this, buf, i);
                if (!this.lastNeed) return buf.toString("utf8", i);
                this.lastTotal = total;
                var end = buf.length - (total - this.lastNeed);
                return buf.copy(this.lastChar, 0, end), buf.toString("utf8", i, end);
            }, StringDecoder.prototype.fillLast = function(buf) {
                if (this.lastNeed <= buf.length) return buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed), 
                this.lastChar.toString(this.encoding, 0, this.lastTotal);
                buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length), this.lastNeed -= buf.length;
            };
        }, {
            "safe-buffer": 244
        } ],
        75: [ function(require, module, exports) {
            var indexOf = function(xs, item) {
                if (xs.indexOf) return xs.indexOf(item);
                for (var i = 0; i < xs.length; i++) if (xs[i] === item) return i;
                return -1;
            }, Object_keys = function(obj) {
                if (Object.keys) return Object.keys(obj);
                var res = [];
                for (var key in obj) res.push(key);
                return res;
            }, forEach = function(xs, fn) {
                if (xs.forEach) return xs.forEach(fn);
                for (var i = 0; i < xs.length; i++) fn(xs[i], i, xs);
            }, defineProp = function() {
                try {
                    return Object.defineProperty({}, "_", {}), function(obj, name, value) {
                        Object.defineProperty(obj, name, {
                            writable: !0,
                            enumerable: !1,
                            configurable: !0,
                            value: value
                        });
                    };
                } catch (e) {
                    return function(obj, name, value) {
                        obj[name] = value;
                    };
                }
            }(), globals = [ "Array", "Boolean", "Date", "Error", "EvalError", "Function", "Infinity", "JSON", "Math", "NaN", "Number", "Object", "RangeError", "ReferenceError", "RegExp", "String", "SyntaxError", "TypeError", "URIError", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "escape", "eval", "isFinite", "isNaN", "parseFloat", "parseInt", "undefined", "unescape" ];
            function Context() {}
            Context.prototype = {};
            var Script = exports.Script = function(code) {
                if (!(this instanceof Script)) return new Script(code);
                this.code = code;
            };
            Script.prototype.runInContext = function(context) {
                if (!(context instanceof Context)) throw new TypeError("needs a 'context' argument.");
                var iframe = document.createElement("iframe");
                iframe.style || (iframe.style = {}), iframe.style.display = "none", document.body.appendChild(iframe);
                var win = iframe.contentWindow, wEval = win.eval, wExecScript = win.execScript;
                !wEval && wExecScript && (wExecScript.call(win, "null"), wEval = win.eval), forEach(Object_keys(context), function(key) {
                    win[key] = context[key];
                }), forEach(globals, function(key) {
                    context[key] && (win[key] = context[key]);
                });
                var winKeys = Object_keys(win), res = wEval.call(win, this.code);
                return forEach(Object_keys(win), function(key) {
                    (key in context || -1 === indexOf(winKeys, key)) && (context[key] = win[key]);
                }), forEach(globals, function(key) {
                    key in context || defineProp(context, key, win[key]);
                }), document.body.removeChild(iframe), res;
            }, Script.prototype.runInThisContext = function() {
                return eval(this.code);
            }, Script.prototype.runInNewContext = function(context) {
                var ctx = Script.createContext(context), res = this.runInContext(ctx);
                return context && forEach(Object_keys(ctx), function(key) {
                    context[key] = ctx[key];
                }), res;
            }, forEach(Object_keys(Script.prototype), function(name) {
                exports[name] = Script[name] = function(code) {
                    var s = Script(code);
                    return s[name].apply(s, [].slice.call(arguments, 1));
                };
            }), exports.createScript = function(code) {
                return exports.Script(code);
            }, exports.createContext = Script.createContext = function(context) {
                var copy = new Context();
                return "object" == typeof context && forEach(Object_keys(context), function(key) {
                    copy[key] = context[key];
                }), copy;
            };
        }, {} ],
        76: [ function(require, module, exports) {
            (function(Buffer) {
                module.exports = function(a, b) {
                    for (var length = Math.min(a.length, b.length), buffer = new Buffer(length), i = 0; i < length; ++i) buffer[i] = a[i] ^ b[i];
                    return buffer;
                };
            }).call(this, require("buffer").Buffer);
        }, {
            buffer: 77
        } ],
        77: [ function(require, module, exports) {
            "use strict";
            var base64 = require("base64-js"), ieee754 = require("ieee754");
            exports.Buffer = Buffer, exports.SlowBuffer = function(length) {
                +length != length && (length = 0);
                return Buffer.alloc(+length);
            }, exports.INSPECT_MAX_BYTES = 50;
            var K_MAX_LENGTH = 2147483647;
            function createBuffer(length) {
                if (K_MAX_LENGTH < length) throw new RangeError("Invalid typed array length");
                var buf = new Uint8Array(length);
                return buf.__proto__ = Buffer.prototype, buf;
            }
            function Buffer(arg, encodingOrOffset, length) {
                if ("number" == typeof arg) {
                    if ("string" == typeof encodingOrOffset) throw new Error("If encoding is specified then the first argument must be a string");
                    return allocUnsafe(arg);
                }
                return from(arg, encodingOrOffset, length);
            }
            function from(value, encodingOrOffset, length) {
                if ("number" == typeof value) throw new TypeError('"value" argument must not be a number');
                return isArrayBuffer(value) ? function(array, byteOffset, length) {
                    if (byteOffset < 0 || array.byteLength < byteOffset) throw new RangeError("'offset' is out of bounds");
                    if (array.byteLength < byteOffset + (length || 0)) throw new RangeError("'length' is out of bounds");
                    var buf;
                    buf = void 0 === byteOffset && void 0 === length ? new Uint8Array(array) : void 0 === length ? new Uint8Array(array, byteOffset) : new Uint8Array(array, byteOffset, length);
                    return buf.__proto__ = Buffer.prototype, buf;
                }(value, encodingOrOffset, length) : "string" == typeof value ? function(string, encoding) {
                    "string" == typeof encoding && "" !== encoding || (encoding = "utf8");
                    if (!Buffer.isEncoding(encoding)) throw new TypeError('"encoding" must be a valid string encoding');
                    var length = 0 | byteLength(string, encoding), buf = createBuffer(length), actual = buf.write(string, encoding);
                    actual !== length && (buf = buf.slice(0, actual));
                    return buf;
                }(value, encodingOrOffset) : function(obj) {
                    if (Buffer.isBuffer(obj)) {
                        var len = 0 | checked(obj.length), buf = createBuffer(len);
                        return 0 === buf.length || obj.copy(buf, 0, 0, len), buf;
                    }
                    if (obj) {
                        if (isArrayBufferView(obj) || "length" in obj) return "number" != typeof obj.length || numberIsNaN(obj.length) ? createBuffer(0) : fromArrayLike(obj);
                        if ("Buffer" === obj.type && Array.isArray(obj.data)) return fromArrayLike(obj.data);
                    }
                    throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
                }(value);
            }
            function assertSize(size) {
                if ("number" != typeof size) throw new TypeError('"size" argument must be a number');
                if (size < 0) throw new RangeError('"size" argument must not be negative');
            }
            function allocUnsafe(size) {
                return assertSize(size), createBuffer(size < 0 ? 0 : 0 | checked(size));
            }
            function fromArrayLike(array) {
                for (var length = array.length < 0 ? 0 : 0 | checked(array.length), buf = createBuffer(length), i = 0; i < length; i += 1) buf[i] = 255 & array[i];
                return buf;
            }
            function checked(length) {
                if (K_MAX_LENGTH <= length) throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + K_MAX_LENGTH.toString(16) + " bytes");
                return 0 | length;
            }
            function byteLength(string, encoding) {
                if (Buffer.isBuffer(string)) return string.length;
                if (isArrayBufferView(string) || isArrayBuffer(string)) return string.byteLength;
                "string" != typeof string && (string = "" + string);
                var len = string.length;
                if (0 === len) return 0;
                for (var loweredCase = !1; ;) switch (encoding) {
                  case "ascii":
                  case "latin1":
                  case "binary":
                    return len;

                  case "utf8":
                  case "utf-8":
                  case void 0:
                    return utf8ToBytes(string).length;

                  case "ucs2":
                  case "ucs-2":
                  case "utf16le":
                  case "utf-16le":
                    return 2 * len;

                  case "hex":
                    return len >>> 1;

                  case "base64":
                    return base64ToBytes(string).length;

                  default:
                    if (loweredCase) return utf8ToBytes(string).length;
                    encoding = ("" + encoding).toLowerCase(), loweredCase = !0;
                }
            }
            function swap(b, n, m) {
                var i = b[n];
                b[n] = b[m], b[m] = i;
            }
            function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
                if (0 === buffer.length) return -1;
                if ("string" == typeof byteOffset ? (encoding = byteOffset, byteOffset = 0) : 2147483647 < byteOffset ? byteOffset = 2147483647 : byteOffset < -2147483648 && (byteOffset = -2147483648), 
                numberIsNaN(byteOffset = +byteOffset) && (byteOffset = dir ? 0 : buffer.length - 1), 
                byteOffset < 0 && (byteOffset = buffer.length + byteOffset), byteOffset >= buffer.length) {
                    if (dir) return -1;
                    byteOffset = buffer.length - 1;
                } else if (byteOffset < 0) {
                    if (!dir) return -1;
                    byteOffset = 0;
                }
                if ("string" == typeof val && (val = Buffer.from(val, encoding)), Buffer.isBuffer(val)) return 0 === val.length ? -1 : arrayIndexOf(buffer, val, byteOffset, encoding, dir);
                if ("number" == typeof val) return val &= 255, "function" == typeof Uint8Array.prototype.indexOf ? dir ? Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) : Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) : arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir);
                throw new TypeError("val must be string, number or Buffer");
            }
            function arrayIndexOf(arr, val, byteOffset, encoding, dir) {
                var i, indexSize = 1, arrLength = arr.length, valLength = val.length;
                if (void 0 !== encoding && ("ucs2" === (encoding = String(encoding).toLowerCase()) || "ucs-2" === encoding || "utf16le" === encoding || "utf-16le" === encoding)) {
                    if (arr.length < 2 || val.length < 2) return -1;
                    arrLength /= indexSize = 2, valLength /= 2, byteOffset /= 2;
                }
                function read(buf, i) {
                    return 1 === indexSize ? buf[i] : buf.readUInt16BE(i * indexSize);
                }
                if (dir) {
                    var foundIndex = -1;
                    for (i = byteOffset; i < arrLength; i++) if (read(arr, i) === read(val, -1 === foundIndex ? 0 : i - foundIndex)) {
                        if (-1 === foundIndex && (foundIndex = i), i - foundIndex + 1 === valLength) return foundIndex * indexSize;
                    } else -1 !== foundIndex && (i -= i - foundIndex), foundIndex = -1;
                } else for (arrLength < byteOffset + valLength && (byteOffset = arrLength - valLength), 
                i = byteOffset; 0 <= i; i--) {
                    for (var found = !0, j = 0; j < valLength; j++) if (read(arr, i + j) !== read(val, j)) {
                        found = !1;
                        break;
                    }
                    if (found) return i;
                }
                return -1;
            }
            function hexWrite(buf, string, offset, length) {
                offset = Number(offset) || 0;
                var remaining = buf.length - offset;
                length ? remaining < (length = Number(length)) && (length = remaining) : length = remaining;
                var strLen = string.length;
                if (strLen % 2 != 0) throw new TypeError("Invalid hex string");
                strLen / 2 < length && (length = strLen / 2);
                for (var i = 0; i < length; ++i) {
                    var parsed = parseInt(string.substr(2 * i, 2), 16);
                    if (numberIsNaN(parsed)) return i;
                    buf[offset + i] = parsed;
                }
                return i;
            }
            function utf8Write(buf, string, offset, length) {
                return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length);
            }
            function asciiWrite(buf, string, offset, length) {
                return blitBuffer(function(str) {
                    for (var byteArray = [], i = 0; i < str.length; ++i) byteArray.push(255 & str.charCodeAt(i));
                    return byteArray;
                }(string), buf, offset, length);
            }
            function latin1Write(buf, string, offset, length) {
                return asciiWrite(buf, string, offset, length);
            }
            function base64Write(buf, string, offset, length) {
                return blitBuffer(base64ToBytes(string), buf, offset, length);
            }
            function ucs2Write(buf, string, offset, length) {
                return blitBuffer(function(str, units) {
                    for (var c, hi, lo, byteArray = [], i = 0; i < str.length && !((units -= 2) < 0); ++i) c = str.charCodeAt(i), 
                    hi = c >> 8, lo = c % 256, byteArray.push(lo), byteArray.push(hi);
                    return byteArray;
                }(string, buf.length - offset), buf, offset, length);
            }
            function base64Slice(buf, start, end) {
                return 0 === start && end === buf.length ? base64.fromByteArray(buf) : base64.fromByteArray(buf.slice(start, end));
            }
            function utf8Slice(buf, start, end) {
                end = Math.min(buf.length, end);
                for (var res = [], i = start; i < end; ) {
                    var secondByte, thirdByte, fourthByte, tempCodePoint, firstByte = buf[i], codePoint = null, bytesPerSequence = 239 < firstByte ? 4 : 223 < firstByte ? 3 : 191 < firstByte ? 2 : 1;
                    if (i + bytesPerSequence <= end) switch (bytesPerSequence) {
                      case 1:
                        firstByte < 128 && (codePoint = firstByte);
                        break;

                      case 2:
                        128 == (192 & (secondByte = buf[i + 1])) && 127 < (tempCodePoint = (31 & firstByte) << 6 | 63 & secondByte) && (codePoint = tempCodePoint);
                        break;

                      case 3:
                        secondByte = buf[i + 1], thirdByte = buf[i + 2], 128 == (192 & secondByte) && 128 == (192 & thirdByte) && 2047 < (tempCodePoint = (15 & firstByte) << 12 | (63 & secondByte) << 6 | 63 & thirdByte) && (tempCodePoint < 55296 || 57343 < tempCodePoint) && (codePoint = tempCodePoint);
                        break;

                      case 4:
                        secondByte = buf[i + 1], thirdByte = buf[i + 2], fourthByte = buf[i + 3], 128 == (192 & secondByte) && 128 == (192 & thirdByte) && 128 == (192 & fourthByte) && 65535 < (tempCodePoint = (15 & firstByte) << 18 | (63 & secondByte) << 12 | (63 & thirdByte) << 6 | 63 & fourthByte) && tempCodePoint < 1114112 && (codePoint = tempCodePoint);
                    }
                    null === codePoint ? (codePoint = 65533, bytesPerSequence = 1) : 65535 < codePoint && (codePoint -= 65536, 
                    res.push(codePoint >>> 10 & 1023 | 55296), codePoint = 56320 | 1023 & codePoint), 
                    res.push(codePoint), i += bytesPerSequence;
                }
                return function(codePoints) {
                    var len = codePoints.length;
                    if (len <= MAX_ARGUMENTS_LENGTH) return String.fromCharCode.apply(String, codePoints);
                    var res = "", i = 0;
                    for (;i < len; ) res += String.fromCharCode.apply(String, codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH));
                    return res;
                }(res);
            }
            exports.kMaxLength = K_MAX_LENGTH, (Buffer.TYPED_ARRAY_SUPPORT = function() {
                try {
                    var arr = new Uint8Array(1);
                    return arr.__proto__ = {
                        __proto__: Uint8Array.prototype,
                        foo: function() {
                            return 42;
                        }
                    }, 42 === arr.foo();
                } catch (e) {
                    return !1;
                }
            }()) || "undefined" == typeof console || "function" != typeof console.error || console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."), 
            "undefined" != typeof Symbol && Symbol.species && Buffer[Symbol.species] === Buffer && Object.defineProperty(Buffer, Symbol.species, {
                value: null,
                configurable: !0,
                enumerable: !1,
                writable: !1
            }), Buffer.poolSize = 8192, Buffer.from = function(value, encodingOrOffset, length) {
                return from(value, encodingOrOffset, length);
            }, Buffer.prototype.__proto__ = Uint8Array.prototype, Buffer.__proto__ = Uint8Array, 
            Buffer.alloc = function(size, fill, encoding) {
                return function(size, fill, encoding) {
                    return assertSize(size), size <= 0 ? createBuffer(size) : void 0 !== fill ? "string" == typeof encoding ? createBuffer(size).fill(fill, encoding) : createBuffer(size).fill(fill) : createBuffer(size);
                }(size, fill, encoding);
            }, Buffer.allocUnsafe = function(size) {
                return allocUnsafe(size);
            }, Buffer.allocUnsafeSlow = function(size) {
                return allocUnsafe(size);
            }, Buffer.isBuffer = function(b) {
                return null != b && !0 === b._isBuffer;
            }, Buffer.compare = function(a, b) {
                if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) throw new TypeError("Arguments must be Buffers");
                if (a === b) return 0;
                for (var x = a.length, y = b.length, i = 0, len = Math.min(x, y); i < len; ++i) if (a[i] !== b[i]) {
                    x = a[i], y = b[i];
                    break;
                }
                return x < y ? -1 : y < x ? 1 : 0;
            }, Buffer.isEncoding = function(encoding) {
                switch (String(encoding).toLowerCase()) {
                  case "hex":
                  case "utf8":
                  case "utf-8":
                  case "ascii":
                  case "latin1":
                  case "binary":
                  case "base64":
                  case "ucs2":
                  case "ucs-2":
                  case "utf16le":
                  case "utf-16le":
                    return !0;

                  default:
                    return !1;
                }
            }, Buffer.concat = function(list, length) {
                if (!Array.isArray(list)) throw new TypeError('"list" argument must be an Array of Buffers');
                if (0 === list.length) return Buffer.alloc(0);
                var i;
                if (void 0 === length) for (i = length = 0; i < list.length; ++i) length += list[i].length;
                var buffer = Buffer.allocUnsafe(length), pos = 0;
                for (i = 0; i < list.length; ++i) {
                    var buf = list[i];
                    if (!Buffer.isBuffer(buf)) throw new TypeError('"list" argument must be an Array of Buffers');
                    buf.copy(buffer, pos), pos += buf.length;
                }
                return buffer;
            }, Buffer.byteLength = byteLength, Buffer.prototype._isBuffer = !0, Buffer.prototype.swap16 = function() {
                var len = this.length;
                if (len % 2 != 0) throw new RangeError("Buffer size must be a multiple of 16-bits");
                for (var i = 0; i < len; i += 2) swap(this, i, i + 1);
                return this;
            }, Buffer.prototype.swap32 = function() {
                var len = this.length;
                if (len % 4 != 0) throw new RangeError("Buffer size must be a multiple of 32-bits");
                for (var i = 0; i < len; i += 4) swap(this, i, i + 3), swap(this, i + 1, i + 2);
                return this;
            }, Buffer.prototype.swap64 = function() {
                var len = this.length;
                if (len % 8 != 0) throw new RangeError("Buffer size must be a multiple of 64-bits");
                for (var i = 0; i < len; i += 8) swap(this, i, i + 7), swap(this, i + 1, i + 6), 
                swap(this, i + 2, i + 5), swap(this, i + 3, i + 4);
                return this;
            }, Buffer.prototype.toString = function() {
                var length = this.length;
                return 0 === length ? "" : 0 === arguments.length ? utf8Slice(this, 0, length) : function(encoding, start, end) {
                    var loweredCase = !1;
                    if ((void 0 === start || start < 0) && (start = 0), start > this.length) return "";
                    if ((void 0 === end || end > this.length) && (end = this.length), end <= 0) return "";
                    if ((end >>>= 0) <= (start >>>= 0)) return "";
                    for (encoding || (encoding = "utf8"); ;) 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 "latin1":
                      case "binary":
                        return latin1Slice(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 = !0;
                    }
                }.apply(this, arguments);
            }, Buffer.prototype.equals = function(b) {
                if (!Buffer.isBuffer(b)) throw new TypeError("Argument must be a Buffer");
                return this === b || 0 === Buffer.compare(this, b);
            }, Buffer.prototype.inspect = function() {
                var str = "", max = exports.INSPECT_MAX_BYTES;
                return 0 < this.length && (str = this.toString("hex", 0, max).match(/.{2}/g).join(" "), 
                this.length > max && (str += " ... ")), "<Buffer " + str + ">";
            }, Buffer.prototype.compare = function(target, start, end, thisStart, thisEnd) {
                if (!Buffer.isBuffer(target)) throw new TypeError("Argument must be a Buffer");
                if (void 0 === start && (start = 0), void 0 === end && (end = target ? target.length : 0), 
                void 0 === thisStart && (thisStart = 0), void 0 === thisEnd && (thisEnd = this.length), 
                start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) throw new RangeError("out of range index");
                if (thisEnd <= thisStart && end <= start) return 0;
                if (thisEnd <= thisStart) return -1;
                if (end <= start) return 1;
                if (this === target) return 0;
                for (var x = (thisEnd >>>= 0) - (thisStart >>>= 0), y = (end >>>= 0) - (start >>>= 0), len = Math.min(x, y), thisCopy = this.slice(thisStart, thisEnd), targetCopy = target.slice(start, end), i = 0; i < len; ++i) if (thisCopy[i] !== targetCopy[i]) {
                    x = thisCopy[i], y = targetCopy[i];
                    break;
                }
                return x < y ? -1 : y < x ? 1 : 0;
            }, Buffer.prototype.includes = function(val, byteOffset, encoding) {
                return -1 !== this.indexOf(val, byteOffset, encoding);
            }, Buffer.prototype.indexOf = function(val, byteOffset, encoding) {
                return bidirectionalIndexOf(this, val, byteOffset, encoding, !0);
            }, Buffer.prototype.lastIndexOf = function(val, byteOffset, encoding) {
                return bidirectionalIndexOf(this, val, byteOffset, encoding, !1);
            }, Buffer.prototype.write = function(string, offset, length, encoding) {
                if (void 0 === offset) encoding = "utf8", length = this.length, offset = 0; else if (void 0 === length && "string" == typeof offset) encoding = offset, 
                length = this.length, offset = 0; else {
                    if (!isFinite(offset)) throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
                    offset >>>= 0, isFinite(length) ? (length >>>= 0, void 0 === encoding && (encoding = "utf8")) : (encoding = length, 
                    length = void 0);
                }
                var remaining = this.length - offset;
                if ((void 0 === length || remaining < length) && (length = remaining), 0 < string.length && (length < 0 || offset < 0) || offset > this.length) throw new RangeError("Attempt to write outside buffer bounds");
                encoding || (encoding = "utf8");
                for (var loweredCase = !1; ;) switch (encoding) {
                  case "hex":
                    return hexWrite(this, string, offset, length);

                  case "utf8":
                  case "utf-8":
                    return utf8Write(this, string, offset, length);

                  case "ascii":
                    return asciiWrite(this, string, offset, length);

                  case "latin1":
                  case "binary":
                    return latin1Write(this, string, offset, length);

                  case "base64":
                    return base64Write(this, string, offset, length);

                  case "ucs2":
                  case "ucs-2":
                  case "utf16le":
                  case "utf-16le":
                    return ucs2Write(this, string, offset, length);

                  default:
                    if (loweredCase) throw new TypeError("Unknown encoding: " + encoding);
                    encoding = ("" + encoding).toLowerCase(), loweredCase = !0;
                }
            }, Buffer.prototype.toJSON = function() {
                return {
                    type: "Buffer",
                    data: Array.prototype.slice.call(this._arr || this, 0)
                };
            };
            var MAX_ARGUMENTS_LENGTH = 4096;
            function asciiSlice(buf, start, end) {
                var ret = "";
                end = Math.min(buf.length, end);
                for (var i = start; i < end; ++i) ret += String.fromCharCode(127 & buf[i]);
                return ret;
            }
            function latin1Slice(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;
                (!start || start < 0) && (start = 0), (!end || end < 0 || len < end) && (end = len);
                for (var out = "", i = start; i < end; ++i) out += toHex(buf[i]);
                return out;
            }
            function utf16leSlice(buf, start, end) {
                for (var bytes = buf.slice(start, end), res = "", i = 0; i < bytes.length; i += 2) res += String.fromCharCode(bytes[i] + 256 * bytes[i + 1]);
                return res;
            }
            function checkOffset(offset, ext, length) {
                if (offset % 1 != 0 || offset < 0) throw new RangeError("offset is not uint");
                if (length < offset + ext) throw new RangeError("Trying to access beyond buffer length");
            }
            function checkInt(buf, value, offset, ext, max, min) {
                if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance');
                if (max < value || value < min) throw new RangeError('"value" argument is out of bounds');
                if (offset + ext > buf.length) throw new RangeError("Index out of range");
            }
            function checkIEEE754(buf, value, offset, ext, max, min) {
                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) {
                return value = +value, offset >>>= 0, noAssert || checkIEEE754(buf, 0, offset, 4), 
                ieee754.write(buf, value, offset, littleEndian, 23, 4), offset + 4;
            }
            function writeDouble(buf, value, offset, littleEndian, noAssert) {
                return value = +value, offset >>>= 0, noAssert || checkIEEE754(buf, 0, offset, 8), 
                ieee754.write(buf, value, offset, littleEndian, 52, 8), offset + 8;
            }
            Buffer.prototype.slice = function(start, end) {
                var len = this.length;
                (start = ~~start) < 0 ? (start += len) < 0 && (start = 0) : len < start && (start = len), 
                (end = void 0 === end ? len : ~~end) < 0 ? (end += len) < 0 && (end = 0) : len < end && (end = len), 
                end < start && (end = start);
                var newBuf = this.subarray(start, end);
                return newBuf.__proto__ = Buffer.prototype, newBuf;
            }, Buffer.prototype.readUIntLE = function(offset, byteLength, noAssert) {
                offset >>>= 0, byteLength >>>= 0, noAssert || checkOffset(offset, byteLength, this.length);
                for (var val = this[offset], mul = 1, i = 0; ++i < byteLength && (mul *= 256); ) val += this[offset + i] * mul;
                return val;
            }, Buffer.prototype.readUIntBE = function(offset, byteLength, noAssert) {
                offset >>>= 0, byteLength >>>= 0, noAssert || checkOffset(offset, byteLength, this.length);
                for (var val = this[offset + --byteLength], mul = 1; 0 < byteLength && (mul *= 256); ) val += this[offset + --byteLength] * mul;
                return val;
            }, Buffer.prototype.readUInt8 = function(offset, noAssert) {
                return offset >>>= 0, noAssert || checkOffset(offset, 1, this.length), this[offset];
            }, Buffer.prototype.readUInt16LE = function(offset, noAssert) {
                return offset >>>= 0, noAssert || checkOffset(offset, 2, this.length), this[offset] | this[offset + 1] << 8;
            }, Buffer.prototype.readUInt16BE = function(offset, noAssert) {
                return offset >>>= 0, noAssert || checkOffset(offset, 2, this.length), this[offset] << 8 | this[offset + 1];
            }, Buffer.prototype.readUInt32LE = function(offset, noAssert) {
                return offset >>>= 0, noAssert || checkOffset(offset, 4, this.length), (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + 16777216 * this[offset + 3];
            }, Buffer.prototype.readUInt32BE = function(offset, noAssert) {
                return offset >>>= 0, noAssert || checkOffset(offset, 4, this.length), 16777216 * this[offset] + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
            }, Buffer.prototype.readIntLE = function(offset, byteLength, noAssert) {
                offset >>>= 0, byteLength >>>= 0, noAssert || checkOffset(offset, byteLength, this.length);
                for (var val = this[offset], mul = 1, i = 0; ++i < byteLength && (mul *= 256); ) val += this[offset + i] * mul;
                return (mul *= 128) <= val && (val -= Math.pow(2, 8 * byteLength)), val;
            }, Buffer.prototype.readIntBE = function(offset, byteLength, noAssert) {
                offset >>>= 0, byteLength >>>= 0, noAssert || checkOffset(offset, byteLength, this.length);
                for (var i = byteLength, mul = 1, val = this[offset + --i]; 0 < i && (mul *= 256); ) val += this[offset + --i] * mul;
                return (mul *= 128) <= val && (val -= Math.pow(2, 8 * byteLength)), val;
            }, Buffer.prototype.readInt8 = function(offset, noAssert) {
                return offset >>>= 0, noAssert || checkOffset(offset, 1, this.length), 128 & this[offset] ? -1 * (255 - this[offset] + 1) : this[offset];
            }, Buffer.prototype.readInt16LE = function(offset, noAssert) {
                offset >>>= 0, noAssert || checkOffset(offset, 2, this.length);
                var val = this[offset] | this[offset + 1] << 8;
                return 32768 & val ? 4294901760 | val : val;
            }, Buffer.prototype.readInt16BE = function(offset, noAssert) {
                offset >>>= 0, noAssert || checkOffset(offset, 2, this.length);
                var val = this[offset + 1] | this[offset] << 8;
                return 32768 & val ? 4294901760 | val : val;
            }, Buffer.prototype.readInt32LE = function(offset, noAssert) {
                return offset >>>= 0, noAssert || checkOffset(offset, 4, this.length), this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
            }, Buffer.prototype.readInt32BE = function(offset, noAssert) {
                return offset >>>= 0, noAssert || checkOffset(offset, 4, this.length), this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
            }, Buffer.prototype.readFloatLE = function(offset, noAssert) {
                return offset >>>= 0, noAssert || checkOffset(offset, 4, this.length), ieee754.read(this, offset, !0, 23, 4);
            }, Buffer.prototype.readFloatBE = function(offset, noAssert) {
                return offset >>>= 0, noAssert || checkOffset(offset, 4, this.length), ieee754.read(this, offset, !1, 23, 4);
            }, Buffer.prototype.readDoubleLE = function(offset, noAssert) {
                return offset >>>= 0, noAssert || checkOffset(offset, 8, this.length), ieee754.read(this, offset, !0, 52, 8);
            }, Buffer.prototype.readDoubleBE = function(offset, noAssert) {
                return offset >>>= 0, noAssert || checkOffset(offset, 8, this.length), ieee754.read(this, offset, !1, 52, 8);
            }, Buffer.prototype.writeUIntLE = function(value, offset, byteLength, noAssert) {
                (value = +value, offset >>>= 0, byteLength >>>= 0, noAssert) || checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength) - 1, 0);
                var mul = 1, i = 0;
                for (this[offset] = 255 & value; ++i < byteLength && (mul *= 256); ) this[offset + i] = value / mul & 255;
                return offset + byteLength;
            }, Buffer.prototype.writeUIntBE = function(value, offset, byteLength, noAssert) {
                (value = +value, offset >>>= 0, byteLength >>>= 0, noAssert) || checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength) - 1, 0);
                var i = byteLength - 1, mul = 1;
                for (this[offset + i] = 255 & value; 0 <= --i && (mul *= 256); ) this[offset + i] = value / mul & 255;
                return offset + byteLength;
            }, Buffer.prototype.writeUInt8 = function(value, offset, noAssert) {
                return value = +value, offset >>>= 0, noAssert || checkInt(this, value, offset, 1, 255, 0), 
                this[offset] = 255 & value, offset + 1;
            }, Buffer.prototype.writeUInt16LE = function(value, offset, noAssert) {
                return value = +value, offset >>>= 0, noAssert || checkInt(this, value, offset, 2, 65535, 0), 
                this[offset] = 255 & value, this[offset + 1] = value >>> 8, offset + 2;
            }, Buffer.prototype.writeUInt16BE = function(value, offset, noAssert) {
                return value = +value, offset >>>= 0, noAssert || checkInt(this, value, offset, 2, 65535, 0), 
                this[offset] = value >>> 8, this[offset + 1] = 255 & value, offset + 2;
            }, Buffer.prototype.writeUInt32LE = function(value, offset, noAssert) {
                return value = +value, offset >>>= 0, noAssert || checkInt(this, value, offset, 4, 4294967295, 0), 
                this[offset + 3] = value >>> 24, this[offset + 2] = value >>> 16, this[offset + 1] = value >>> 8, 
                this[offset] = 255 & value, offset + 4;
            }, Buffer.prototype.writeUInt32BE = function(value, offset, noAssert) {
                return value = +value, offset >>>= 0, noAssert || checkInt(this, value, offset, 4, 4294967295, 0), 
                this[offset] = value >>> 24, this[offset + 1] = value >>> 16, this[offset + 2] = value >>> 8, 
                this[offset + 3] = 255 & value, offset + 4;
            }, Buffer.prototype.writeIntLE = function(value, offset, byteLength, noAssert) {
                if (value = +value, offset >>>= 0, !noAssert) {
                    var limit = Math.pow(2, 8 * byteLength - 1);
                    checkInt(this, value, offset, byteLength, limit - 1, -limit);
                }
                var i = 0, mul = 1, sub = 0;
                for (this[offset] = 255 & value; ++i < byteLength && (mul *= 256); ) value < 0 && 0 === sub && 0 !== this[offset + i - 1] && (sub = 1), 
                this[offset + i] = (value / mul >> 0) - sub & 255;
                return offset + byteLength;
            }, Buffer.prototype.writeIntBE = function(value, offset, byteLength, noAssert) {
                if (value = +value, offset >>>= 0, !noAssert) {
                    var limit = Math.pow(2, 8 * byteLength - 1);
                    checkInt(this, value, offset, byteLength, limit - 1, -limit);
                }
                var i = byteLength - 1, mul = 1, sub = 0;
                for (this[offset + i] = 255 & value; 0 <= --i && (mul *= 256); ) value < 0 && 0 === sub && 0 !== this[offset + i + 1] && (sub = 1), 
                this[offset + i] = (value / mul >> 0) - sub & 255;
                return offset + byteLength;
            }, Buffer.prototype.writeInt8 = function(value, offset, noAssert) {
                return value = +value, offset >>>= 0, noAssert || checkInt(this, value, offset, 1, 127, -128), 
                value < 0 && (value = 255 + value + 1), this[offset] = 255 & value, offset + 1;
            }, Buffer.prototype.writeInt16LE = function(value, offset, noAssert) {
                return value = +value, offset >>>= 0, noAssert || checkInt(this, value, offset, 2, 32767, -32768), 
                this[offset] = 255 & value, this[offset + 1] = value >>> 8, offset + 2;
            }, Buffer.prototype.writeInt16BE = function(value, offset, noAssert) {
                return value = +value, offset >>>= 0, noAssert || checkInt(this, value, offset, 2, 32767, -32768), 
                this[offset] = value >>> 8, this[offset + 1] = 255 & value, offset + 2;
            }, Buffer.prototype.writeInt32LE = function(value, offset, noAssert) {
                return value = +value, offset >>>= 0, noAssert || checkInt(this, value, offset, 4, 2147483647, -2147483648), 
                this[offset] = 255 & value, this[offset + 1] = value >>> 8, this[offset + 2] = value >>> 16, 
                this[offset + 3] = value >>> 24, offset + 4;
            }, Buffer.prototype.writeInt32BE = function(value, offset, noAssert) {
                return value = +value, offset >>>= 0, noAssert || checkInt(this, value, offset, 4, 2147483647, -2147483648), 
                value < 0 && (value = 4294967295 + value + 1), this[offset] = value >>> 24, this[offset + 1] = value >>> 16, 
                this[offset + 2] = value >>> 8, this[offset + 3] = 255 & value, offset + 4;
            }, Buffer.prototype.writeFloatLE = function(value, offset, noAssert) {
                return writeFloat(this, value, offset, !0, noAssert);
            }, Buffer.prototype.writeFloatBE = function(value, offset, noAssert) {
                return writeFloat(this, value, offset, !1, noAssert);
            }, Buffer.prototype.writeDoubleLE = function(value, offset, noAssert) {
                return writeDouble(this, value, offset, !0, noAssert);
            }, Buffer.prototype.writeDoubleBE = function(value, offset, noAssert) {
                return writeDouble(this, value, offset, !1, noAssert);
            }, Buffer.prototype.copy = function(target, targetStart, start, end) {
                if (start || (start = 0), end || 0 === end || (end = this.length), targetStart >= target.length && (targetStart = target.length), 
                targetStart || (targetStart = 0), 0 < end && end < start && (end = start), end === start) return 0;
                if (0 === target.length || 0 === this.length) return 0;
                if (targetStart < 0) throw new RangeError("targetStart out of bounds");
                if (start < 0 || start >= this.length) throw new RangeError("sourceStart out of bounds");
                if (end < 0) throw new RangeError("sourceEnd out of bounds");
                end > this.length && (end = this.length), target.length - targetStart < end - start && (end = target.length - targetStart + start);
                var i, len = end - start;
                if (this === target && start < targetStart && targetStart < end) for (i = len - 1; 0 <= i; --i) target[i + targetStart] = this[i + start]; else if (len < 1e3) for (i = 0; i < len; ++i) target[i + targetStart] = this[i + start]; else Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
                return len;
            }, Buffer.prototype.fill = function(val, start, end, encoding) {
                if ("string" == typeof val) {
                    if ("string" == typeof start ? (encoding = start, start = 0, end = this.length) : "string" == typeof end && (encoding = end, 
                    end = this.length), 1 === val.length) {
                        var code = val.charCodeAt(0);
                        code < 256 && (val = code);
                    }
                    if (void 0 !== encoding && "string" != typeof encoding) throw new TypeError("encoding must be a string");
                    if ("string" == typeof encoding && !Buffer.isEncoding(encoding)) throw new TypeError("Unknown encoding: " + encoding);
                } else "number" == typeof val && (val &= 255);
                if (start < 0 || this.length < start || this.length < end) throw new RangeError("Out of range index");
                if (end <= start) return this;
                var i;
                if (start >>>= 0, end = void 0 === end ? this.length : end >>> 0, val || (val = 0), 
                "number" == typeof val) for (i = start; i < end; ++i) this[i] = val; else {
                    var bytes = Buffer.isBuffer(val) ? val : new Buffer(val, encoding), len = bytes.length;
                    for (i = 0; i < end - start; ++i) this[i + start] = bytes[i % len];
                }
                return this;
            };
            var INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g;
            function toHex(n) {
                return n < 16 ? "0" + n.toString(16) : n.toString(16);
            }
            function utf8ToBytes(string, units) {
                var codePoint;
                units = units || 1 / 0;
                for (var length = string.length, leadSurrogate = null, bytes = [], i = 0; i < length; ++i) {
                    if (55295 < (codePoint = string.charCodeAt(i)) && codePoint < 57344) {
                        if (!leadSurrogate) {
                            if (56319 < codePoint) {
                                -1 < (units -= 3) && bytes.push(239, 191, 189);
                                continue;
                            }
                            if (i + 1 === length) {
                                -1 < (units -= 3) && bytes.push(239, 191, 189);
                                continue;
                            }
                            leadSurrogate = codePoint;
                            continue;
                        }
                        if (codePoint < 56320) {
                            -1 < (units -= 3) && bytes.push(239, 191, 189), leadSurrogate = codePoint;
                            continue;
                        }
                        codePoint = 65536 + (leadSurrogate - 55296 << 10 | codePoint - 56320);
                    } else leadSurrogate && -1 < (units -= 3) && bytes.push(239, 191, 189);
                    if (leadSurrogate = null, codePoint < 128) {
                        if ((units -= 1) < 0) break;
                        bytes.push(codePoint);
                    } else if (codePoint < 2048) {
                        if ((units -= 2) < 0) break;
                        bytes.push(codePoint >> 6 | 192, 63 & codePoint | 128);
                    } else if (codePoint < 65536) {
                        if ((units -= 3) < 0) break;
                        bytes.push(codePoint >> 12 | 224, codePoint >> 6 & 63 | 128, 63 & codePoint | 128);
                    } else {
                        if (!(codePoint < 1114112)) throw new Error("Invalid code point");
                        if ((units -= 4) < 0) break;
                        bytes.push(codePoint >> 18 | 240, codePoint >> 12 & 63 | 128, codePoint >> 6 & 63 | 128, 63 & codePoint | 128);
                    }
                }
                return bytes;
            }
            function base64ToBytes(str) {
                return base64.toByteArray(function(str) {
                    if ((str = str.trim().replace(INVALID_BASE64_RE, "")).length < 2) return "";
                    for (;str.length % 4 != 0; ) str += "=";
                    return str;
                }(str));
            }
            function blitBuffer(src, dst, offset, length) {
                for (var i = 0; i < length && !(i + offset >= dst.length || i >= src.length); ++i) dst[i + offset] = src[i];
                return i;
            }
            function isArrayBuffer(obj) {
                return obj instanceof ArrayBuffer || null != obj && null != obj.constructor && "ArrayBuffer" === obj.constructor.name && "number" == typeof obj.byteLength;
            }
            function isArrayBufferView(obj) {
                return "function" == typeof ArrayBuffer.isView && ArrayBuffer.isView(obj);
            }
            function numberIsNaN(obj) {
                return obj != obj;
            }
        }, {
            "base64-js": 41,
            ieee754: 150
        } ],
        78: [ function(require, module, exports) {
            (function(process, Buffer) {
                var map, Base64 = (map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", 
                {
                    encode: function(input) {
                        for (var o = "", c1 = 0, c2 = 0, c3 = 0, e1 = 0, e2 = 0, e3 = 0, e4 = 0, i = 0; i < input.length; ) e1 = (c1 = input.charCodeAt(i++)) >> 2, 
                        e2 = (3 & c1) << 4 | (c2 = input.charCodeAt(i++)) >> 4, e3 = (15 & c2) << 2 | (c3 = input.charCodeAt(i++)) >> 6, 
                        e4 = 63 & c3, isNaN(c2) ? e3 = e4 = 64 : isNaN(c3) && (e4 = 64), o += map.charAt(e1) + map.charAt(e2) + map.charAt(e3) + map.charAt(e4);
                        return o;
                    },
                    decode: function(input) {
                        var o = "", c1 = 0, c2 = 0, c3 = 0, e2 = 0, e3 = 0, e4 = 0;
                        input = input.replace(/[^\w\+\/\=]/g, "");
                        for (var i = 0; i < input.length; ) c1 = map.indexOf(input.charAt(i++)) << 2 | (e2 = map.indexOf(input.charAt(i++))) >> 4, 
                        o += String.fromCharCode(c1), c2 = (15 & e2) << 4 | (e3 = map.indexOf(input.charAt(i++))) >> 2, 
                        64 !== e3 && (o += String.fromCharCode(c2)), c3 = (3 & e3) << 6 | (e4 = map.indexOf(input.charAt(i++))), 
                        64 !== e4 && (o += String.fromCharCode(c3));
                        return o;
                    }
                }), has_buf = void 0 !== Buffer && void 0 !== process && void 0 !== process.versions && process.versions.node;
                void 0 !== Buffer && (Buffer.from || (Buffer.from = function(buf, enc) {
                    return enc ? new Buffer(buf, enc) : new Buffer(buf);
                }), Buffer.alloc || (Buffer.alloc = function(n) {
                    return new Buffer(n);
                }));
                var s2a = function(s) {
                    return has_buf ? Buffer.from(s, "binary") : s.split("").map(function(x) {
                        return 255 & x.charCodeAt(0);
                    });
                }, chr0 = /\u0000/g, chr1 = /[\u0001-\u0006]/g, __toBuffer = function(bufs) {
                    for (var x = [], i = 0; i < bufs[0].length; ++i) x.push.apply(x, bufs[0][i]);
                    return x;
                }, ___toBuffer = __toBuffer, __utf16le = function(b, s, e) {
                    for (var ss = [], i = s; i < e; i += 2) ss.push(String.fromCharCode(__readUInt16LE(b, i)));
                    return ss.join("").replace(chr0, "");
                }, ___utf16le = __utf16le, __hexlify = function(b, s, l) {
                    for (var ss = [], i = s; i < s + l; ++i) ss.push(("0" + b[i].toString(16)).slice(-2));
                    return ss.join("");
                }, ___hexlify = __hexlify, __bconcat = function(bufs) {
                    if (Array.isArray(bufs[0])) return [].concat.apply([], bufs);
                    var maxlen = 0, i = 0;
                    for (i = 0; i < bufs.length; ++i) maxlen += bufs[i].length;
                    var o = new Uint8Array(maxlen);
                    for (maxlen = i = 0; i < bufs.length; maxlen += bufs[i].length, ++i) o.set(bufs[i], maxlen);
                    return o;
                }, bconcat = __bconcat;
                has_buf && (__utf16le = function(b, s, e) {
                    return Buffer.isBuffer(b) ? b.toString("utf16le", s, e).replace(chr0, "") : ___utf16le(b, s, e);
                }, __hexlify = function(b, s, l) {
                    return Buffer.isBuffer(b) ? b.toString("hex", s, s + l) : ___hexlify(b, s, l);
                }, __toBuffer = function(bufs) {
                    return 0 < bufs[0].length && Buffer.isBuffer(bufs[0][0]) ? Buffer.concat(bufs[0]) : ___toBuffer(bufs);
                }, s2a = function(s) {
                    return Buffer.from(s, "binary");
                }, bconcat = function(bufs) {
                    return Buffer.isBuffer(bufs[0]) ? Buffer.concat(bufs) : __bconcat(bufs);
                });
                var __readUInt8 = function(b, idx) {
                    return b[idx];
                }, __readUInt16LE = function(b, idx) {
                    return 256 * b[idx + 1] + b[idx];
                }, __readInt16LE = function(b, idx) {
                    var u = 256 * b[idx + 1] + b[idx];
                    return u < 32768 ? u : -1 * (65535 - u + 1);
                }, __readUInt32LE = function(b, idx) {
                    return b[idx + 3] * (1 << 24) + (b[idx + 2] << 16) + (b[idx + 1] << 8) + b[idx];
                }, __readInt32LE = function(b, idx) {
                    return (b[idx + 3] << 24) + (b[idx + 2] << 16) + (b[idx + 1] << 8) + b[idx];
                };
                function ReadShift(size, t) {
                    var oI, oS, type = 0;
                    switch (size) {
                      case 1:
                        oI = __readUInt8(this, this.l);
                        break;

                      case 2:
                        oI = ("i" !== t ? __readUInt16LE : __readInt16LE)(this, this.l);
                        break;

                      case 4:
                        oI = __readInt32LE(this, this.l);
                        break;

                      case 16:
                        type = 2, oS = __hexlify(this, this.l, size);
                    }
                    return this.l += size, 0 === type ? oI : oS;
                }
                var __writeUInt32LE = function(b, val, idx) {
                    b[idx] = 255 & val, b[idx + 1] = val >>> 8 & 255, b[idx + 2] = val >>> 16 & 255, 
                    b[idx + 3] = val >>> 24 & 255;
                }, __writeInt32LE = function(b, val, idx) {
                    b[idx] = 255 & val, b[idx + 1] = val >> 8 & 255, b[idx + 2] = val >> 16 & 255, b[idx + 3] = val >> 24 & 255;
                };
                function WriteShift(t, val, f) {
                    var size = 0, i = 0;
                    switch (f) {
                      case "hex":
                        for (;i < t; ++i) this[this.l++] = parseInt(val.slice(2 * i, 2 * i + 2), 16) || 0;
                        return this;

                      case "utf16le":
                        var end = this.l + t;
                        for (i = 0; i < Math.min(val.length, t); ++i) {
                            var cc = val.charCodeAt(i);
                            this[this.l++] = 255 & cc, this[this.l++] = cc >> 8;
                        }
                        for (;this.l < end; ) this[this.l++] = 0;
                        return this;
                    }
                    switch (t) {
                      case 1:
                        size = 1, this[this.l] = 255 & val;
                        break;

                      case 2:
                        size = 2, this[this.l] = 255 & val, val >>>= 8, this[this.l + 1] = 255 & val;
                        break;

                      case 4:
                        size = 4, __writeUInt32LE(this, val, this.l);
                        break;

                      case -4:
                        size = 4, __writeInt32LE(this, val, this.l);
                    }
                    return this.l += size, this;
                }
                function CheckField(hexstr, fld) {
                    var m = __hexlify(this, this.l, hexstr.length >> 1);
                    if (m !== hexstr) throw new Error(fld + "Expected " + hexstr + " saw " + m);
                    this.l += hexstr.length >> 1;
                }
                function prep_blob(blob, pos) {
                    blob.l = pos, blob.read_shift = ReadShift, blob.chk = CheckField, blob.write_shift = WriteShift;
                }
                function new_buf(sz) {
                    var len, o = (len = sz, has_buf ? Buffer.alloc(len) : new Array(len));
                    return prep_blob(o, 0), o;
                }
                var CFB = function() {
                    var fs, exports = {};
                    function dirname(p) {
                        if ("/" == p.charAt(p.length - 1)) return -1 === p.slice(0, -1).indexOf("/") ? p : dirname(p.slice(0, -1));
                        var c = p.lastIndexOf("/");
                        return -1 === c ? p : p.slice(0, c + 1);
                    }
                    function filename(p) {
                        if ("/" == p.charAt(p.length - 1)) return filename(p.slice(0, -1));
                        var c = p.lastIndexOf("/");
                        return -1 === c ? p : p.slice(c + 1);
                    }
                    function get_fs() {
                        return fs || (fs = require("fs"));
                    }
                    function parse(file, options) {
                        if (file.length < 512) throw new Error("CFB file size " + file.length + " < 512");
                        var mver, nmfs, difat_sec_cnt, dir_start, minifat_start, difat_start, ssz = 512, fat_addrs = [], blob = file.slice(0, 512);
                        switch (prep_blob(blob, 0), mver = function(blob) {
                            blob.chk(HEADER_SIGNATURE, "Header Signature: "), blob.chk(HEADER_CLSID, "CLSID: ");
                            var mver = blob.read_shift(2, "u");
                            return [ blob.read_shift(2, "u"), mver ];
                        }(blob)[0]) {
                          case 3:
                            ssz = 512;
                            break;

                          case 4:
                            ssz = 4096;
                            break;

                          default:
                            throw new Error("Major Version: Expected 3 or 4 saw " + mver);
                        }
                        512 !== ssz && prep_blob(blob = file.slice(0, ssz), 28);
                        var header = file.slice(0, ssz);
                        !function(blob, mver) {
                            var shift = 9;
                            switch (blob.l += 2, shift = blob.read_shift(2)) {
                              case 9:
                                if (3 != mver) throw new Error("Sector Shift: Expected 9 saw " + shift);
                                break;

                              case 12:
                                if (4 != mver) throw new Error("Sector Shift: Expected 12 saw " + shift);
                                break;

                              default:
                                throw new Error("Sector Shift: Expected 9 or 12 saw " + shift);
                            }
                            blob.chk("0600", "Mini Sector Shift: "), blob.chk("000000000000", "Reserved: ");
                        }(blob, mver);
                        var dir_cnt = blob.read_shift(4, "i");
                        if (3 === mver && 0 !== dir_cnt) throw new Error("# Directory Sectors: Expected 0 saw " + dir_cnt);
                        blob.l += 4, dir_start = blob.read_shift(4, "i"), blob.l += 4, blob.chk("00100000", "Mini Stream Cutoff Size: "), 
                        minifat_start = blob.read_shift(4, "i"), nmfs = blob.read_shift(4, "i"), difat_start = blob.read_shift(4, "i"), 
                        difat_sec_cnt = blob.read_shift(4, "i");
                        for (var q = -1, j = 0; j < 109 && !((q = blob.read_shift(4, "i")) < 0); ++j) fat_addrs[j] = q;
                        var sectors = function(file, ssz) {
                            for (var nsectors = Math.ceil(file.length / ssz) - 1, sectors = [], i = 1; i < nsectors; ++i) sectors[i - 1] = file.slice(i * ssz, (i + 1) * ssz);
                            return sectors[nsectors - 1] = file.slice(nsectors * ssz), sectors;
                        }(file, ssz);
                        !function sleuth_fat(idx, cnt, sectors, ssz, fat_addrs) {
                            var q = ENDOFCHAIN;
                            if (idx === ENDOFCHAIN) {
                                if (0 !== cnt) throw new Error("DIFAT chain shorter than expected");
                            } else if (-1 !== idx) {
                                var sector = sectors[idx], m = (ssz >>> 2) - 1;
                                if (!sector) return;
                                for (var i = 0; i < m && (q = __readInt32LE(sector, 4 * i)) !== ENDOFCHAIN; ++i) fat_addrs.push(q);
                                sleuth_fat(__readInt32LE(sector, ssz - 4), cnt - 1, sectors, ssz, fat_addrs);
                            }
                        }(difat_start, difat_sec_cnt, sectors, ssz, fat_addrs);
                        var sector_list = function(sectors, dir_start, fat_addrs, ssz) {
                            var sl = sectors.length, sector_list = [], chkd = [], buf = [], buf_chain = [], modulus = ssz - 1, i = 0, j = 0, k = 0, jj = 0;
                            for (i = 0; i < sl; ++i) if (buf = [], sl <= (k = i + dir_start) && (k -= sl), !chkd[k]) {
                                for (buf_chain = [], j = k; 0 <= j; ) {
                                    chkd[j] = !0, buf[buf.length] = j, buf_chain.push(sectors[j]);
                                    var addr = fat_addrs[Math.floor(4 * j / ssz)];
                                    if (ssz < 4 + (jj = 4 * j & modulus)) throw new Error("FAT boundary crossed: " + j + " 4 " + ssz);
                                    if (!sectors[addr]) break;
                                    j = __readInt32LE(sectors[addr], jj);
                                }
                                sector_list[k] = {
                                    nodes: buf,
                                    data: __toBuffer([ buf_chain ])
                                };
                            }
                            return sector_list;
                        }(sectors, dir_start, fat_addrs, ssz);
                        sector_list[dir_start].name = "!Directory", 0 < nmfs && minifat_start !== ENDOFCHAIN && (sector_list[minifat_start].name = "!MiniFAT"), 
                        sector_list[fat_addrs[0]].name = "!FAT", sector_list.fat_addrs = fat_addrs, sector_list.ssz = ssz;
                        var Paths = [], FileIndex = [], FullPaths = [];
                        !function(dir_start, sector_list, sectors, Paths, nmfs, files, FileIndex, mini) {
                            for (var name, minifat_store = 0, pl = Paths.length ? 2 : 0, sector = sector_list[dir_start].data, i = 0, namelen = 0; i < sector.length; i += 128) {
                                var blob = sector.slice(i, i + 128);
                                prep_blob(blob, 64), namelen = blob.read_shift(2), name = __utf16le(blob, 0, namelen - pl), 
                                Paths.push(name);
                                var o = {
                                    name: name,
                                    type: blob.read_shift(1),
                                    color: blob.read_shift(1),
                                    L: blob.read_shift(4, "i"),
                                    R: blob.read_shift(4, "i"),
                                    C: blob.read_shift(4, "i"),
                                    clsid: blob.read_shift(16),
                                    state: blob.read_shift(4, "i"),
                                    start: 0,
                                    size: 0
                                }, ctime = blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2);
                                0 !== ctime && (o.ct = read_date(blob, blob.l - 8));
                                var mtime = blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2) + blob.read_shift(2);
                                0 !== mtime && (o.mt = read_date(blob, blob.l - 8)), o.start = blob.read_shift(4, "i"), 
                                o.size = blob.read_shift(4, "i"), o.size < 0 && o.start < 0 && (o.size = o.type = 0, 
                                o.start = ENDOFCHAIN, o.name = ""), 5 === o.type ? (minifat_store = o.start, 0 < nmfs && minifat_store !== ENDOFCHAIN && (sector_list[minifat_store].name = "!StreamData")) : 4096 <= o.size ? (o.storage = "fat", 
                                void 0 === sector_list[o.start] && (sector_list[o.start] = get_sector_list(sectors, o.start, sector_list.fat_addrs, sector_list.ssz)), 
                                sector_list[o.start].name = o.name, o.content = sector_list[o.start].data.slice(0, o.size)) : (o.storage = "minifat", 
                                o.size < 0 ? o.size = 0 : minifat_store !== ENDOFCHAIN && o.start !== ENDOFCHAIN && sector_list[minifat_store] && (o.content = get_mfat_entry(o, sector_list[minifat_store].data, (sector_list[mini] || {}).data))), 
                                o.content && prep_blob(o.content, 0), files[name] = o, FileIndex.push(o);
                            }
                        }(dir_start, sector_list, sectors, Paths, nmfs, {}, FileIndex, minifat_start), function(FI, FP, Paths) {
                            for (var i = 0, L = 0, R = 0, C = 0, j = 0, pl = Paths.length, dad = [], q = []; i < pl; ++i) dad[i] = q[i] = i, 
                            FP[i] = Paths[i];
                            for (;j < q.length; ++j) i = q[j], L = FI[i].L, R = FI[i].R, C = FI[i].C, dad[i] === i && (-1 !== L && dad[L] !== L && (dad[i] = dad[L]), 
                            -1 !== R && dad[R] !== R && (dad[i] = dad[R])), -1 !== C && (dad[C] = i), -1 !== L && (dad[L] = dad[i], 
                            q.lastIndexOf(L) < j && q.push(L)), -1 !== R && (dad[R] = dad[i], q.lastIndexOf(R) < j && q.push(R));
                            for (i = 1; i < pl; ++i) dad[i] === i && (-1 !== R && dad[R] !== R ? dad[i] = dad[R] : -1 !== L && dad[L] !== L && (dad[i] = dad[L]));
                            for (i = 1; i < pl; ++i) if (0 !== FI[i].type) {
                                if (0 === (j = dad[i])) FP[i] = FP[0] + "/" + FP[i]; else for (;0 !== j && j !== dad[j]; ) FP[i] = FP[j] + "/" + FP[i], 
                                j = dad[j];
                                dad[i] = 0;
                            }
                            for (FP[0] += "/", i = 1; i < pl; ++i) 2 !== FI[i].type && (FP[i] += "/");
                        }(FileIndex, FullPaths, Paths), Paths.shift();
                        var o = {
                            FileIndex: FileIndex,
                            FullPaths: FullPaths
                        };
                        return options && options.raw && (o.raw = {
                            header: header,
                            sectors: sectors
                        }), o;
                    }
                    function get_mfat_entry(entry, payload, mini) {
                        for (var start = entry.start, size = entry.size, o = [], idx = start; mini && 0 < size && 0 <= idx; ) o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ)), 
                        size -= MSSZ, idx = __readInt32LE(mini, 4 * idx);
                        return 0 === o.length ? new_buf(0) : bconcat(o).slice(0, entry.size);
                    }
                    function get_sector_list(sectors, start, fat_addrs, ssz, chkd) {
                        var buf = [], buf_chain = [];
                        chkd || (chkd = []);
                        var modulus = ssz - 1, j = 0, jj = 0;
                        for (j = start; 0 <= j; ) {
                            chkd[j] = !0, buf[buf.length] = j, buf_chain.push(sectors[j]);
                            var addr = fat_addrs[Math.floor(4 * j / ssz)];
                            if (ssz < 4 + (jj = 4 * j & modulus)) throw new Error("FAT boundary crossed: " + j + " 4 " + ssz);
                            if (!sectors[addr]) break;
                            j = __readInt32LE(sectors[addr], jj);
                        }
                        return {
                            nodes: buf,
                            data: __toBuffer([ buf_chain ])
                        };
                    }
                    function read_date(blob, offset) {
                        return new Date(1e3 * (__readUInt32LE(blob, offset + 4) / 1e7 * Math.pow(2, 32) + __readUInt32LE(blob, offset) / 1e7 - 11644473600));
                    }
                    function init_cfb(cfb, opts) {
                        var o = opts || {}, root = o.root || "Root Entry";
                        if (cfb.FullPaths || (cfb.FullPaths = []), cfb.FileIndex || (cfb.FileIndex = []), 
                        cfb.FullPaths.length !== cfb.FileIndex.length) throw new Error("inconsistent CFB structure");
                        0 === cfb.FullPaths.length && (cfb.FullPaths[0] = root + "/", cfb.FileIndex[0] = {
                            name: root,
                            type: 5
                        }), o.CLSID && (cfb.FileIndex[0].clsid = o.CLSID), function(cfb) {
                            var nm = "Sh33tJ5";
                            if (CFB.find(cfb, "/" + nm)) return;
                            var p = new_buf(4);
                            p[0] = 55, p[1] = p[3] = 50, p[2] = 54, cfb.FileIndex.push({
                                name: nm,
                                type: 2,
                                content: p,
                                size: 4,
                                L: 69,
                                R: 69,
                                C: 69
                            }), cfb.FullPaths.push(cfb.FullPaths[0] + nm), rebuild_cfb(cfb);
                        }(cfb);
                    }
                    function rebuild_cfb(cfb, f) {
                        init_cfb(cfb);
                        for (var gc = !1, s = !1, i = cfb.FullPaths.length - 1; 0 <= i; --i) {
                            var _file = cfb.FileIndex[i];
                            switch (_file.type) {
                              case 0:
                                s ? gc = !0 : (cfb.FileIndex.pop(), cfb.FullPaths.pop());
                                break;

                              case 1:
                              case 2:
                              case 5:
                                s = !0, isNaN(_file.R * _file.L * _file.C) && (gc = !0), -1 < _file.R && -1 < _file.L && _file.R == _file.L && (gc = !0);
                                break;

                              default:
                                gc = !0;
                            }
                        }
                        if (gc || f) {
                            var now = new Date(1987, 1, 19), j = 0, data = [];
                            for (i = 0; i < cfb.FullPaths.length; ++i) 0 !== cfb.FileIndex[i].type && data.push([ cfb.FullPaths[i], cfb.FileIndex[i] ]);
                            for (i = 0; i < data.length; ++i) {
                                var dad = dirname(data[i][0]);
                                for (s = !1, j = 0; j < data.length; ++j) data[j][0] === dad && (s = !0);
                                s || data.push([ dad, {
                                    name: filename(dad).replace("/", ""),
                                    type: 1,
                                    clsid: HEADER_CLSID,
                                    ct: now,
                                    mt: now,
                                    content: null
                                } ]);
                            }
                            for (data.sort(function(x, y) {
                                return function(l, r) {
                                    for (var L = l.split("/"), R = r.split("/"), i = 0, c = 0, Z = Math.min(L.length, R.length); i < Z; ++i) {
                                        if (c = L[i].length - R[i].length) return c;
                                        if (L[i] != R[i]) return L[i] < R[i] ? -1 : 1;
                                    }
                                    return L.length - R.length;
                                }(x[0], y[0]);
                            }), cfb.FullPaths = [], cfb.FileIndex = [], i = 0; i < data.length; ++i) cfb.FullPaths[i] = data[i][0], 
                            cfb.FileIndex[i] = data[i][1];
                            for (i = 0; i < data.length; ++i) {
                                var elt = cfb.FileIndex[i], nm = cfb.FullPaths[i];
                                if (elt.name = filename(nm).replace("/", ""), elt.L = elt.R = elt.C = -(elt.color = 1), 
                                elt.size = elt.content ? elt.content.length : 0, elt.start = 0, elt.clsid = elt.clsid || HEADER_CLSID, 
                                0 === i) elt.C = 1 < data.length ? 1 : -1, elt.size = 0, elt.type = 5; else if ("/" == nm.slice(-1)) {
                                    for (j = i + 1; j < data.length && dirname(cfb.FullPaths[j]) != nm; ++j) ;
                                    for (elt.C = j >= data.length ? -1 : j, j = i + 1; j < data.length && dirname(cfb.FullPaths[j]) != dirname(nm); ++j) ;
                                    elt.R = j >= data.length ? -1 : j, elt.type = 1;
                                } else dirname(cfb.FullPaths[i + 1] || "") == dirname(nm) && (elt.R = i + 1), elt.type = 2;
                            }
                        }
                    }
                    function _write(cfb, options) {
                        var _opts = options || {};
                        rebuild_cfb(cfb);
                        var L = function(cfb) {
                            for (var mini_size = 0, fat_size = 0, i = 0; i < cfb.FileIndex.length; ++i) {
                                var file = cfb.FileIndex[i];
                                if (file.content) {
                                    var flen = file.content.length;
                                    0 < flen && (flen < 4096 ? mini_size += flen + 63 >> 6 : fat_size += flen + 511 >> 9);
                                }
                            }
                            for (var dir_cnt = cfb.FullPaths.length + 3 >> 2, mfat_cnt = mini_size + 127 >> 7, fat_base = (mini_size + 7 >> 3) + fat_size + dir_cnt + mfat_cnt, fat_cnt = fat_base + 127 >> 7, difat_cnt = fat_cnt <= 109 ? 0 : Math.ceil((fat_cnt - 109) / 127); fat_cnt < fat_base + fat_cnt + difat_cnt + 127 >> 7; ) difat_cnt = ++fat_cnt <= 109 ? 0 : Math.ceil((fat_cnt - 109) / 127);
                            var L = [ 1, difat_cnt, fat_cnt, mfat_cnt, dir_cnt, fat_size, mini_size, 0 ];
                            return cfb.FileIndex[0].size = mini_size << 6, L[7] = (cfb.FileIndex[0].start = L[0] + L[1] + L[2] + L[3] + L[4] + L[5]) + (L[6] + 7 >> 3), 
                            L;
                        }(cfb), o = new_buf(L[7] << 9), i = 0, T = 0;
                        for (i = 0; i < 8; ++i) o.write_shift(1, HEADER_SIG[i]);
                        for (i = 0; i < 8; ++i) o.write_shift(2, 0);
                        for (o.write_shift(2, 62), o.write_shift(2, 3), o.write_shift(2, 65534), o.write_shift(2, 9), 
                        o.write_shift(2, 6), i = 0; i < 3; ++i) o.write_shift(2, 0);
                        for (o.write_shift(4, 0), o.write_shift(4, L[2]), o.write_shift(4, L[0] + L[1] + L[2] + L[3] - 1), 
                        o.write_shift(4, 0), o.write_shift(4, 4096), o.write_shift(4, L[3] ? L[0] + L[1] + L[2] - 1 : ENDOFCHAIN), 
                        o.write_shift(4, L[3]), o.write_shift(-4, L[1] ? L[0] - 1 : ENDOFCHAIN), o.write_shift(4, L[1]), 
                        i = 0; i < 109; ++i) o.write_shift(-4, i < L[2] ? L[1] + i : -1);
                        if (L[1]) for (T = 0; T < L[1]; ++T) {
                            for (;i < 236 + 127 * T; ++i) o.write_shift(-4, i < L[2] ? L[1] + i : -1);
                            o.write_shift(-4, T === L[1] - 1 ? ENDOFCHAIN : T + 1);
                        }
                        var chainit = function(w) {
                            for (T += w; i < T - 1; ++i) o.write_shift(-4, i + 1);
                            w && (++i, o.write_shift(-4, ENDOFCHAIN));
                        };
                        for (T = i = 0, T += L[1]; i < T; ++i) o.write_shift(-4, consts.DIFSECT);
                        for (T += L[2]; i < T; ++i) o.write_shift(-4, consts.FATSECT);
                        chainit(L[3]), chainit(L[4]);
                        for (var j = 0, flen = 0, file = cfb.FileIndex[0]; j < cfb.FileIndex.length; ++j) (file = cfb.FileIndex[j]).content && ((flen = file.content.length) < 4096 || (file.start = T, 
                        chainit(flen + 511 >> 9)));
                        for (chainit(L[6] + 7 >> 3); 511 & o.l; ) o.write_shift(-4, consts.ENDOFCHAIN);
                        for (T = i = 0, j = 0; j < cfb.FileIndex.length; ++j) (file = cfb.FileIndex[j]).content && (!(flen = file.content.length) || 4096 <= flen || (file.start = T, 
                        chainit(flen + 63 >> 6)));
                        for (;511 & o.l; ) o.write_shift(-4, consts.ENDOFCHAIN);
                        for (i = 0; i < L[4] << 2; ++i) {
                            var nm = cfb.FullPaths[i];
                            if (nm && 0 !== nm.length) {
                                file = cfb.FileIndex[i], 0 === i && (file.start = file.size ? file.start - 1 : ENDOFCHAIN);
                                var _nm = 0 === i && _opts.root || file.name;
                                if (flen = 2 * (_nm.length + 1), o.write_shift(64, _nm, "utf16le"), o.write_shift(2, flen), 
                                o.write_shift(1, file.type), o.write_shift(1, file.color), o.write_shift(-4, file.L), 
                                o.write_shift(-4, file.R), o.write_shift(-4, file.C), file.clsid) o.write_shift(16, file.clsid, "hex"); else for (j = 0; j < 4; ++j) o.write_shift(4, 0);
                                o.write_shift(4, file.state || 0), o.write_shift(4, 0), o.write_shift(4, 0), o.write_shift(4, 0), 
                                o.write_shift(4, 0), o.write_shift(4, file.start), o.write_shift(4, file.size), 
                                o.write_shift(4, 0);
                            } else {
                                for (j = 0; j < 17; ++j) o.write_shift(4, 0);
                                for (j = 0; j < 3; ++j) o.write_shift(4, -1);
                                for (j = 0; j < 12; ++j) o.write_shift(4, 0);
                            }
                        }
                        for (i = 1; i < cfb.FileIndex.length; ++i) if (4096 <= (file = cfb.FileIndex[i]).size) {
                            for (o.l = file.start + 1 << 9, j = 0; j < file.size; ++j) o.write_shift(1, file.content[j]);
                            for (;511 & j; ++j) o.write_shift(1, 0);
                        }
                        for (i = 1; i < cfb.FileIndex.length; ++i) if (0 < (file = cfb.FileIndex[i]).size && file.size < 4096) {
                            for (j = 0; j < file.size; ++j) o.write_shift(1, file.content[j]);
                            for (;63 & j; ++j) o.write_shift(1, 0);
                        }
                        for (;o.l < o.length; ) o.write_shift(1, 0);
                        return o;
                    }
                    exports.version = "1.0.7";
                    var MSSZ = 64, ENDOFCHAIN = -2, HEADER_SIGNATURE = "d0cf11e0a1b11ae1", HEADER_SIG = [ 208, 207, 17, 224, 161, 177, 26, 225 ], HEADER_CLSID = "00000000000000000000000000000000", consts = {
                        MAXREGSECT: -6,
                        DIFSECT: -4,
                        FATSECT: -3,
                        ENDOFCHAIN: ENDOFCHAIN,
                        FREESECT: -1,
                        HEADER_SIGNATURE: HEADER_SIGNATURE,
                        HEADER_MINOR_VERSION: "3e00",
                        MAXREGSID: -6,
                        NOSTREAM: -1,
                        HEADER_CLSID: HEADER_CLSID,
                        EntryTypes: [ "unknown", "storage", "stream", "lockbytes", "property", "root" ]
                    };
                    function a2s(o) {
                        for (var out = new Array(o.length), i = 0; i < o.length; ++i) out[i] = String.fromCharCode(o[i]);
                        return out.join("");
                    }
                    return exports.find = function(cfb, path) {
                        var UCFullPaths = cfb.FullPaths.map(function(x) {
                            return x.toUpperCase();
                        }), UCPaths = UCFullPaths.map(function(x) {
                            var y = x.split("/");
                            return y[y.length - ("/" == x.slice(-1) ? 2 : 1)];
                        }), k = !1;
                        47 === path.charCodeAt(0) ? (k = !0, path = UCFullPaths[0].slice(0, -1) + path) : k = -1 !== path.indexOf("/");
                        var UCPath = path.toUpperCase(), w = !0 === k ? UCFullPaths.indexOf(UCPath) : UCPaths.indexOf(UCPath);
                        if (-1 !== w) return cfb.FileIndex[w];
                        var m = !UCPath.match(chr1);
                        for (UCPath = UCPath.replace(chr0, ""), m && (UCPath = UCPath.replace(chr1, "!")), 
                        w = 0; w < UCFullPaths.length; ++w) {
                            if ((m ? UCFullPaths[w].replace(chr1, "!") : UCFullPaths[w]).replace(chr0, "") == UCPath) return cfb.FileIndex[w];
                            if ((m ? UCPaths[w].replace(chr1, "!") : UCPaths[w]).replace(chr0, "") == UCPath) return cfb.FileIndex[w];
                        }
                        return null;
                    }, exports.read = function(blob, options) {
                        switch (options && options.type || "base64") {
                          case "file":
                            return function(filename, options) {
                                return get_fs(), parse(fs.readFileSync(filename), options);
                            }(blob, options);

                          case "base64":
                            return parse(s2a(Base64.decode(blob)), options);

                          case "binary":
                            return parse(s2a(blob), options);
                        }
                        return parse(blob, options);
                    }, exports.parse = parse, exports.write = function(cfb, options) {
                        var o = _write(cfb, options);
                        switch (options && options.type) {
                          case "file":
                            return get_fs(), fs.writeFileSync(options.filename, o), o;

                          case "binary":
                            return a2s(o);

                          case "base64":
                            return Base64.encode(a2s(o));
                        }
                        return o;
                    }, exports.writeFile = function(cfb, filename, options) {
                        get_fs();
                        var o = _write(cfb, options);
                        fs.writeFileSync(filename, o);
                    }, exports.utils = {
                        cfb_new: function(opts) {
                            var o = {};
                            return init_cfb(o, opts), o;
                        },
                        cfb_add: function(cfb, name, content, opts) {
                            var unsafe = opts && opts.unsafe;
                            unsafe || init_cfb(cfb);
                            var file = !unsafe && CFB.find(cfb, name);
                            if (!file) {
                                var fpath = cfb.FullPaths[0];
                                name.slice(0, fpath.length) == fpath ? fpath = name : ("/" != fpath.slice(-1) && (fpath += "/"), 
                                fpath = (fpath + name).replace("//", "/")), file = {
                                    name: filename(name),
                                    type: 2
                                }, cfb.FileIndex.push(file), cfb.FullPaths.push(fpath), unsafe || CFB.utils.cfb_gc(cfb);
                            }
                            return file.content = content, file.size = content ? content.length : 0, opts && opts.CLSID && (file.clsid = opts.CLSID), 
                            file;
                        },
                        cfb_del: function(cfb, name) {
                            init_cfb(cfb);
                            var file = CFB.find(cfb, name);
                            if (file) for (var j = 0; j < cfb.FileIndex.length; ++j) if (cfb.FileIndex[j] == file) return cfb.FileIndex.splice(j, 1), 
                            cfb.FullPaths.splice(j, 1), !0;
                            return !1;
                        },
                        cfb_mov: function(cfb, old_name, new_name) {
                            init_cfb(cfb);
                            var file = CFB.find(cfb, old_name);
                            if (file) for (var j = 0; j < cfb.FileIndex.length; ++j) if (cfb.FileIndex[j] == file) return cfb.FileIndex[j].name = filename(new_name), 
                            cfb.FullPaths[j] = new_name, !0;
                            return !1;
                        },
                        cfb_gc: function(cfb) {
                            rebuild_cfb(cfb, !0);
                        },
                        ReadShift: ReadShift,
                        CheckField: CheckField,
                        prep_blob: prep_blob,
                        bconcat: bconcat,
                        consts: consts
                    }, exports;
                }();
                void 0 !== require && void 0 !== module && "undefined" == typeof DO_NOT_EXPORT_CFB && (module.exports = CFB);
            }).call(this, require("_process"), require("buffer").Buffer);
        }, {
            _process: 224,
            buffer: 77,
            fs: 44
        } ],
        79: [ function(require, module, exports) {
            var Buffer = require("safe-buffer").Buffer, Transform = require("stream").Transform, StringDecoder = require("string_decoder").StringDecoder;
            function CipherBase(hashMode) {
                Transform.call(this), this.hashMode = "string" == typeof hashMode, this.hashMode ? this[hashMode] = this._finalOrDigest : this.final = this._finalOrDigest, 
                this._final && (this.__final = this._final, this._final = null), this._decoder = null, 
                this._encoding = null;
            }
            require("inherits")(CipherBase, Transform), CipherBase.prototype.update = function(data, inputEnc, outputEnc) {
                "string" == typeof data && (data = Buffer.from(data, inputEnc));
                var outData = this._update(data);
                return this.hashMode ? this : (outputEnc && (outData = this._toString(outData, outputEnc)), 
                outData);
            }, CipherBase.prototype.setAutoPadding = function() {}, CipherBase.prototype.getAuthTag = function() {
                throw new Error("trying to get auth tag in unsupported state");
            }, CipherBase.prototype.setAuthTag = function() {
                throw new Error("trying to set auth tag in unsupported state");
            }, CipherBase.prototype.setAAD = function() {
                throw new Error("trying to set aad in unsupported state");
            }, CipherBase.prototype._transform = function(data, _, next) {
                var err;
                try {
                    this.hashMode ? this._update(data) : this.push(this._update(data));
                } catch (e) {
                    err = e;
                } finally {
                    next(err);
                }
            }, CipherBase.prototype._flush = function(done) {
                var err;
                try {
                    this.push(this.__final());
                } catch (e) {
                    err = e;
                }
                done(err);
            }, CipherBase.prototype._finalOrDigest = function(outputEnc) {
                var outData = this.__final() || Buffer.alloc(0);
                return outputEnc && (outData = this._toString(outData, outputEnc, !0)), outData;
            }, CipherBase.prototype._toString = function(value, enc, fin) {
                if (this._decoder || (this._decoder = new StringDecoder(enc), this._encoding = enc), 
                this._encoding !== enc) throw new Error("can't switch encodings");
                var out = this._decoder.write(value);
                return fin && (out += this._decoder.end()), out;
            }, module.exports = CipherBase;
        }, {
            inherits: 152,
            "safe-buffer": 244,
            stream: 254,
            string_decoder: 74
        } ],
        80: [ function(require, module, exports) {
            require("../modules/web.immediate"), module.exports = require("../modules/_core").setImmediate;
        }, {
            "../modules/_core": 84,
            "../modules/web.immediate": 100
        } ],
        81: [ function(require, module, exports) {
            module.exports = function(it) {
                if ("function" != typeof it) throw TypeError(it + " is not a function!");
                return it;
            };
        }, {} ],
        82: [ function(require, module, exports) {
            var isObject = require("./_is-object");
            module.exports = function(it) {
                if (!isObject(it)) throw TypeError(it + " is not an object!");
                return it;
            };
        }, {
            "./_is-object": 95
        } ],
        83: [ function(require, module, exports) {
            var toString = {}.toString;
            module.exports = function(it) {
                return toString.call(it).slice(8, -1);
            };
        }, {} ],
        84: [ function(require, module, exports) {
            var core = module.exports = {
                version: "2.3.0"
            };
            "number" == typeof __e && (__e = core);
        }, {} ],
        85: [ function(require, module, exports) {
            var aFunction = require("./_a-function");
            module.exports = function(fn, that, length) {
                if (aFunction(fn), void 0 === that) 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);
                };
            };
        }, {
            "./_a-function": 81
        } ],
        86: [ function(require, module, exports) {
            module.exports = !require("./_fails")(function() {
                return 7 != Object.defineProperty({}, "a", {
                    get: function() {
                        return 7;
                    }
                }).a;
            });
        }, {
            "./_fails": 89
        } ],
        87: [ function(require, module, exports) {
            var isObject = require("./_is-object"), document = require("./_global").document, is = isObject(document) && isObject(document.createElement);
            module.exports = function(it) {
                return is ? document.createElement(it) : {};
            };
        }, {
            "./_global": 90,
            "./_is-object": 95
        } ],
        88: [ function(require, module, exports) {
            var global = require("./_global"), core = require("./_core"), ctx = require("./_ctx"), hide = require("./_hide"), $export = function(type, name, source) {
                var key, own, out, 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, IS_WRAP = type & $export.W, exports = IS_GLOBAL ? core : core[name] || (core[name] = {}), expProto = exports.prototype, target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {}).prototype;
                for (key in IS_GLOBAL && (source = name), source) (own = !IS_FORCED && target && void 0 !== target[key]) && key in exports || (out = own ? target[key] : source[key], 
                exports[key] = IS_GLOBAL && "function" != typeof target[key] ? source[key] : IS_BIND && own ? ctx(out, global) : IS_WRAP && target[key] == out ? function(C) {
                    var F = function(a, b, c) {
                        if (this instanceof C) {
                            switch (arguments.length) {
                              case 0:
                                return new C();

                              case 1:
                                return new C(a);

                              case 2:
                                return new C(a, b);
                            }
                            return new C(a, b, c);
                        }
                        return C.apply(this, arguments);
                    };
                    return F.prototype = C.prototype, F;
                }(out) : IS_PROTO && "function" == typeof out ? ctx(Function.call, out) : out, IS_PROTO && ((exports.virtual || (exports.virtual = {}))[key] = out, 
                type & $export.R && expProto && !expProto[key] && hide(expProto, key, out)));
            };
            $export.F = 1, $export.G = 2, $export.S = 4, $export.P = 8, $export.B = 16, $export.W = 32, 
            $export.U = 64, $export.R = 128, module.exports = $export;
        }, {
            "./_core": 84,
            "./_ctx": 85,
            "./_global": 90,
            "./_hide": 91
        } ],
        89: [ function(require, module, exports) {
            module.exports = function(exec) {
                try {
                    return !!exec();
                } catch (e) {
                    return !0;
                }
            };
        }, {} ],
        90: [ function(require, module, exports) {
            var global = module.exports = "undefined" != typeof window && window.Math == Math ? window : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();
            "number" == typeof __g && (__g = global);
        }, {} ],
        91: [ function(require, module, exports) {
            var dP = require("./_object-dp"), createDesc = require("./_property-desc");
            module.exports = require("./_descriptors") ? function(object, key, value) {
                return dP.f(object, key, createDesc(1, value));
            } : function(object, key, value) {
                return object[key] = value, object;
            };
        }, {
            "./_descriptors": 86,
            "./_object-dp": 96,
            "./_property-desc": 97
        } ],
        92: [ function(require, module, exports) {
            module.exports = require("./_global").document && document.documentElement;
        }, {
            "./_global": 90
        } ],
        93: [ function(require, module, exports) {
            module.exports = !require("./_descriptors") && !require("./_fails")(function() {
                return 7 != Object.defineProperty(require("./_dom-create")("div"), "a", {
                    get: function() {
                        return 7;
                    }
                }).a;
            });
        }, {
            "./_descriptors": 86,
            "./_dom-create": 87,
            "./_fails": 89
        } ],
        94: [ function(require, module, exports) {
            module.exports = function(fn, args, that) {
                var un = void 0 === that;
                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);
            };
        }, {} ],
        95: [ function(require, module, exports) {
            module.exports = function(it) {
                return "object" == typeof it ? null !== it : "function" == typeof it;
            };
        }, {} ],
        96: [ function(require, module, exports) {
            var anObject = require("./_an-object"), IE8_DOM_DEFINE = require("./_ie8-dom-define"), toPrimitive = require("./_to-primitive"), dP = Object.defineProperty;
            exports.f = require("./_descriptors") ? Object.defineProperty : function(O, P, Attributes) {
                if (anObject(O), P = toPrimitive(P, !0), anObject(Attributes), IE8_DOM_DEFINE) try {
                    return dP(O, P, Attributes);
                } catch (e) {}
                if ("get" in Attributes || "set" in Attributes) throw TypeError("Accessors not supported!");
                return "value" in Attributes && (O[P] = Attributes.value), O;
            };
        }, {
            "./_an-object": 82,
            "./_descriptors": 86,
            "./_ie8-dom-define": 93,
            "./_to-primitive": 99
        } ],
        97: [ function(require, module, exports) {
            module.exports = function(bitmap, value) {
                return {
                    enumerable: !(1 & bitmap),
                    configurable: !(2 & bitmap),
                    writable: !(4 & bitmap),
                    value: value
                };
            };
        }, {} ],
        98: [ function(require, module, exports) {
            var defer, channel, port, ctx = require("./_ctx"), invoke = require("./_invoke"), html = require("./_html"), cel = require("./_dom-create"), global = require("./_global"), process = global.process, setTask = global.setImmediate, clearTask = global.clearImmediate, MessageChannel = global.MessageChannel, counter = 0, queue = {}, run = function() {
                var id = +this;
                if (queue.hasOwnProperty(id)) {
                    var fn = queue[id];
                    delete queue[id], fn();
                }
            }, listener = function(event) {
                run.call(event.data);
            };
            setTask && clearTask || (setTask = function(fn) {
                for (var args = [], i = 1; arguments.length > i; ) args.push(arguments[i++]);
                return queue[++counter] = function() {
                    invoke("function" == typeof fn ? fn : Function(fn), args);
                }, defer(counter), counter;
            }, clearTask = function(id) {
                delete queue[id];
            }, "process" == require("./_cof")(process) ? defer = function(id) {
                process.nextTick(ctx(run, id, 1));
            } : MessageChannel ? (port = (channel = new MessageChannel()).port2, channel.port1.onmessage = listener, 
            defer = ctx(port.postMessage, port, 1)) : global.addEventListener && "function" == typeof postMessage && !global.importScripts ? (defer = function(id) {
                global.postMessage(id + "", "*");
            }, global.addEventListener("message", listener, !1)) : defer = "onreadystatechange" in cel("script") ? function(id) {
                html.appendChild(cel("script")).onreadystatechange = function() {
                    html.removeChild(this), run.call(id);
                };
            } : function(id) {
                setTimeout(ctx(run, id, 1), 0);
            }), module.exports = {
                set: setTask,
                clear: clearTask
            };
        }, {
            "./_cof": 83,
            "./_ctx": 85,
            "./_dom-create": 87,
            "./_global": 90,
            "./_html": 92,
            "./_invoke": 94
        } ],
        99: [ function(require, module, exports) {
            var isObject = require("./_is-object");
            module.exports = function(it, S) {
                if (!isObject(it)) return it;
                var fn, val;
                if (S && "function" == typeof (fn = it.toString) && !isObject(val = fn.call(it))) return val;
                if ("function" == typeof (fn = it.valueOf) && !isObject(val = fn.call(it))) return val;
                if (!S && "function" == typeof (fn = it.toString) && !isObject(val = fn.call(it))) return val;
                throw TypeError("Can't convert object to primitive value");
            };
        }, {
            "./_is-object": 95
        } ],
        100: [ function(require, module, exports) {
            var $export = require("./_export"), $task = require("./_task");
            $export($export.G + $export.B, {
                setImmediate: $task.set,
                clearImmediate: $task.clear
            });
        }, {
            "./_export": 88,
            "./_task": 98
        } ],
        101: [ function(require, module, exports) {
            (function(Buffer) {
                function objectToString(o) {
                    return Object.prototype.toString.call(o);
                }
                exports.isArray = function(arg) {
                    return Array.isArray ? Array.isArray(arg) : "[object Array]" === objectToString(arg);
                }, exports.isBoolean = function(arg) {
                    return "boolean" == typeof arg;
                }, exports.isNull = function(arg) {
                    return null === arg;
                }, exports.isNullOrUndefined = function(arg) {
                    return null == arg;
                }, exports.isNumber = function(arg) {
                    return "number" == typeof arg;
                }, exports.isString = function(arg) {
                    return "string" == typeof arg;
                }, exports.isSymbol = function(arg) {
                    return "symbol" == typeof arg;
                }, exports.isUndefined = function(arg) {
                    return void 0 === arg;
                }, exports.isRegExp = function(re) {
                    return "[object RegExp]" === objectToString(re);
                }, exports.isObject = function(arg) {
                    return "object" == typeof arg && null !== arg;
                }, exports.isDate = function(d) {
                    return "[object Date]" === objectToString(d);
                }, exports.isError = function(e) {
                    return "[object Error]" === objectToString(e) || e instanceof Error;
                }, exports.isFunction = function(arg) {
                    return "function" == typeof arg;
                }, exports.isPrimitive = function(arg) {
                    return null === arg || "boolean" == typeof arg || "number" == typeof arg || "string" == typeof arg || "symbol" == typeof arg || void 0 === arg;
                }, exports.isBuffer = Buffer.isBuffer;
            }).call(this, {
                isBuffer: require("../../is-buffer/index.js")
            });
        }, {
            "../../is-buffer/index.js": 153
        } ],
        102: [ function(require, module, exports) {
            (function(Buffer) {
                var elliptic = require("elliptic"), BN = require("bn.js");
                module.exports = function(curve) {
                    return new ECDH(curve);
                };
                var aliases = {
                    secp256k1: {
                        name: "secp256k1",
                        byteLength: 32
                    },
                    secp224r1: {
                        name: "p224",
                        byteLength: 28
                    },
                    prime256v1: {
                        name: "p256",
                        byteLength: 32
                    },
                    prime192v1: {
                        name: "p192",
                        byteLength: 24
                    },
                    ed25519: {
                        name: "ed25519",
                        byteLength: 32
                    },
                    secp384r1: {
                        name: "p384",
                        byteLength: 48
                    },
                    secp521r1: {
                        name: "p521",
                        byteLength: 66
                    }
                };
                function ECDH(curve) {
                    this.curveType = aliases[curve], this.curveType || (this.curveType = {
                        name: curve
                    }), this.curve = new elliptic.ec(this.curveType.name), this.keys = void 0;
                }
                function formatReturnValue(bn, enc, len) {
                    Array.isArray(bn) || (bn = bn.toArray());
                    var buf = new Buffer(bn);
                    if (len && buf.length < len) {
                        var zeros = new Buffer(len - buf.length);
                        zeros.fill(0), buf = Buffer.concat([ zeros, buf ]);
                    }
                    return enc ? buf.toString(enc) : buf;
                }
                aliases.p224 = aliases.secp224r1, aliases.p256 = aliases.secp256r1 = aliases.prime256v1, 
                aliases.p192 = aliases.secp192r1 = aliases.prime192v1, aliases.p384 = aliases.secp384r1, 
                aliases.p521 = aliases.secp521r1, ECDH.prototype.generateKeys = function(enc, format) {
                    return this.keys = this.curve.genKeyPair(), this.getPublicKey(enc, format);
                }, ECDH.prototype.computeSecret = function(other, inenc, enc) {
                    return inenc = inenc || "utf8", Buffer.isBuffer(other) || (other = new Buffer(other, inenc)), 
                    formatReturnValue(this.curve.keyFromPublic(other).getPublic().mul(this.keys.getPrivate()).getX(), enc, this.curveType.byteLength);
                }, ECDH.prototype.getPublicKey = function(enc, format) {
                    var key = this.keys.getPublic("compressed" === format, !0);
                    return "hybrid" === format && (key[key.length - 1] % 2 ? key[0] = 7 : key[0] = 6), 
                    formatReturnValue(key, enc);
                }, ECDH.prototype.getPrivateKey = function(enc) {
                    return formatReturnValue(this.keys.getPrivate(), enc);
                }, ECDH.prototype.setPublicKey = function(pub, enc) {
                    return enc = enc || "utf8", Buffer.isBuffer(pub) || (pub = new Buffer(pub, enc)), 
                    this.keys._importPublic(pub), this;
                }, ECDH.prototype.setPrivateKey = function(priv, enc) {
                    enc = enc || "utf8", Buffer.isBuffer(priv) || (priv = new Buffer(priv, enc));
                    var _priv = new BN(priv);
                    return _priv = _priv.toString(16), this.keys._importPrivate(_priv), this;
                };
            }).call(this, require("buffer").Buffer);
        }, {
            "bn.js": 42,
            buffer: 77,
            elliptic: 119
        } ],
        103: [ function(require, module, exports) {
            (function(Buffer) {
                "use strict";
                var inherits = require("inherits"), md5 = require("./md5"), RIPEMD160 = require("ripemd160"), sha = require("sha.js"), Base = require("cipher-base");
                function HashNoConstructor(hash) {
                    Base.call(this, "digest"), this._hash = hash, this.buffers = [];
                }
                function Hash(hash) {
                    Base.call(this, "digest"), this._hash = hash;
                }
                inherits(HashNoConstructor, Base), HashNoConstructor.prototype._update = function(data) {
                    this.buffers.push(data);
                }, HashNoConstructor.prototype._final = function() {
                    var buf = Buffer.concat(this.buffers), r = this._hash(buf);
                    return this.buffers = null, r;
                }, inherits(Hash, Base), Hash.prototype._update = function(data) {
                    this._hash.update(data);
                }, Hash.prototype._final = function() {
                    return this._hash.digest();
                }, module.exports = function(alg) {
                    return "md5" === (alg = alg.toLowerCase()) ? new HashNoConstructor(md5) : new Hash("rmd160" === alg || "ripemd160" === alg ? new RIPEMD160() : sha(alg));
                };
            }).call(this, require("buffer").Buffer);
        }, {
            "./md5": 105,
            buffer: 77,
            "cipher-base": 79,
            inherits: 152,
            ripemd160: 243,
            "sha.js": 247
        } ],
        104: [ function(require, module, exports) {
            (function(Buffer) {
                "use strict";
                var intSize = 4, zeroBuffer = new Buffer(intSize);
                zeroBuffer.fill(0);
                module.exports = function(buf, fn) {
                    var arr = fn(function(buf) {
                        if (buf.length % intSize != 0) {
                            var len = buf.length + (intSize - buf.length % intSize);
                            buf = Buffer.concat([ buf, zeroBuffer ], len);
                        }
                        for (var arr = new Array(buf.length >>> 2), i = 0, j = 0; i < buf.length; i += intSize, 
                        j++) arr[j] = buf.readInt32LE(i);
                        return arr;
                    }(buf), 8 * buf.length);
                    buf = new Buffer(16);
                    for (var i = 0; i < arr.length; i++) buf.writeInt32LE(arr[i], i << 2, !0);
                    return buf;
                };
            }).call(this, require("buffer").Buffer);
        }, {
            buffer: 77
        } ],
        105: [ function(require, module, exports) {
            "use strict";
            var makeHash = require("./make-hash");
            function core_md5(x, len) {
                x[len >> 5] |= 128 << len % 32, x[14 + (len + 64 >>> 9 << 4)] = len;
                for (var a = 1732584193, b = -271733879, c = -1732584194, d = 271733878, i = 0; i < x.length; i += 16) {
                    var olda = a, oldb = b, oldc = c, oldd = d;
                    b = md5_ii(b = md5_ii(b = md5_ii(b = md5_ii(b = md5_hh(b = md5_hh(b = md5_hh(b = md5_hh(b = md5_gg(b = md5_gg(b = md5_gg(b = md5_gg(b = md5_ff(b = md5_ff(b = md5_ff(b = md5_ff(b, c = md5_ff(c, d = md5_ff(d, a = md5_ff(a, b, c, d, x[i + 0], 7, -680876936), b, c, x[i + 1], 12, -389564586), a, b, x[i + 2], 17, 606105819), d, a, x[i + 3], 22, -1044525330), c = md5_ff(c, d = md5_ff(d, a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897), b, c, x[i + 5], 12, 1200080426), a, b, x[i + 6], 17, -1473231341), d, a, x[i + 7], 22, -45705983), c = md5_ff(c, d = md5_ff(d, a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416), b, c, x[i + 9], 12, -1958414417), a, b, x[i + 10], 17, -42063), d, a, x[i + 11], 22, -1990404162), c = md5_ff(c, d = md5_ff(d, a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682), b, c, x[i + 13], 12, -40341101), a, b, x[i + 14], 17, -1502002290), d, a, x[i + 15], 22, 1236535329), c = md5_gg(c, d = md5_gg(d, a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510), b, c, x[i + 6], 9, -1069501632), a, b, x[i + 11], 14, 643717713), d, a, x[i + 0], 20, -373897302), c = md5_gg(c, d = md5_gg(d, a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691), b, c, x[i + 10], 9, 38016083), a, b, x[i + 15], 14, -660478335), d, a, x[i + 4], 20, -405537848), c = md5_gg(c, d = md5_gg(d, a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438), b, c, x[i + 14], 9, -1019803690), a, b, x[i + 3], 14, -187363961), d, a, x[i + 8], 20, 1163531501), c = md5_gg(c, d = md5_gg(d, a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467), b, c, x[i + 2], 9, -51403784), a, b, x[i + 7], 14, 1735328473), d, a, x[i + 12], 20, -1926607734), c = md5_hh(c, d = md5_hh(d, a = md5_hh(a, b, c, d, x[i + 5], 4, -378558), b, c, x[i + 8], 11, -2022574463), a, b, x[i + 11], 16, 1839030562), d, a, x[i + 14], 23, -35309556), c = md5_hh(c, d = md5_hh(d, a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060), b, c, x[i + 4], 11, 1272893353), a, b, x[i + 7], 16, -155497632), d, a, x[i + 10], 23, -1094730640), c = md5_hh(c, d = md5_hh(d, a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174), b, c, x[i + 0], 11, -358537222), a, b, x[i + 3], 16, -722521979), d, a, x[i + 6], 23, 76029189), c = md5_hh(c, d = md5_hh(d, a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487), b, c, x[i + 12], 11, -421815835), a, b, x[i + 15], 16, 530742520), d, a, x[i + 2], 23, -995338651), c = md5_ii(c, d = md5_ii(d, a = md5_ii(a, b, c, d, x[i + 0], 6, -198630844), b, c, x[i + 7], 10, 1126891415), a, b, x[i + 14], 15, -1416354905), d, a, x[i + 5], 21, -57434055), c = md5_ii(c, d = md5_ii(d, a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571), b, c, x[i + 3], 10, -1894986606), a, b, x[i + 10], 15, -1051523), d, a, x[i + 1], 21, -2054922799), c = md5_ii(c, d = md5_ii(d, a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359), b, c, x[i + 15], 10, -30611744), a, b, x[i + 6], 15, -1560198380), d, a, x[i + 13], 21, 1309151649), c = md5_ii(c, d = md5_ii(d, a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070), b, c, x[i + 11], 10, -1120210379), a, b, x[i + 2], 15, 718787259), d, a, x[i + 9], 21, -343485551), 
                    a = safe_add(a, olda), b = safe_add(b, oldb), c = safe_add(c, oldc), d = safe_add(d, oldd);
                }
                return [ a, b, c, d ];
            }
            function md5_cmn(q, a, b, x, s, t) {
                return safe_add((num = safe_add(safe_add(a, q), safe_add(x, t))) << (cnt = s) | num >>> 32 - cnt, b);
                var num, cnt;
            }
            function md5_ff(a, b, c, d, x, s, t) {
                return md5_cmn(b & c | ~b & d, a, b, x, s, t);
            }
            function md5_gg(a, b, c, d, x, s, t) {
                return md5_cmn(b & d | c & ~d, a, b, x, s, t);
            }
            function md5_hh(a, b, c, d, x, s, t) {
                return md5_cmn(b ^ c ^ d, a, b, x, s, t);
            }
            function md5_ii(a, b, c, d, x, s, t) {
                return md5_cmn(c ^ (b | ~d), a, b, x, s, t);
            }
            function safe_add(x, y) {
                var lsw = (65535 & x) + (65535 & y);
                return (x >> 16) + (y >> 16) + (lsw >> 16) << 16 | 65535 & lsw;
            }
            module.exports = function(buf) {
                return makeHash(buf, core_md5);
            };
        }, {
            "./make-hash": 104
        } ],
        106: [ function(require, module, exports) {
            "use strict";
            var inherits = require("inherits"), Legacy = require("./legacy"), Base = require("cipher-base"), Buffer = require("safe-buffer").Buffer, md5 = require("create-hash/md5"), RIPEMD160 = require("ripemd160"), sha = require("sha.js"), ZEROS = Buffer.alloc(128);
            function Hmac(alg, key) {
                Base.call(this, "digest"), "string" == typeof key && (key = Buffer.from(key));
                var blocksize = "sha512" === alg || "sha384" === alg ? 128 : 64;
                (this._alg = alg, (this._key = key).length > blocksize) ? key = ("rmd160" === alg ? new RIPEMD160() : sha(alg)).update(key).digest() : key.length < blocksize && (key = Buffer.concat([ key, ZEROS ], blocksize));
                for (var ipad = this._ipad = Buffer.allocUnsafe(blocksize), opad = this._opad = Buffer.allocUnsafe(blocksize), i = 0; i < blocksize; i++) ipad[i] = 54 ^ key[i], 
                opad[i] = 92 ^ key[i];
                this._hash = "rmd160" === alg ? new RIPEMD160() : sha(alg), this._hash.update(ipad);
            }
            inherits(Hmac, Base), Hmac.prototype._update = function(data) {
                this._hash.update(data);
            }, Hmac.prototype._final = function() {
                var h = this._hash.digest();
                return ("rmd160" === this._alg ? new RIPEMD160() : sha(this._alg)).update(this._opad).update(h).digest();
            }, module.exports = function(alg, key) {
                return "rmd160" === (alg = alg.toLowerCase()) || "ripemd160" === alg ? new Hmac("rmd160", key) : "md5" === alg ? new Legacy(md5, key) : new Hmac(alg, key);
            };
        }, {
            "./legacy": 107,
            "cipher-base": 79,
            "create-hash/md5": 105,
            inherits: 152,
            ripemd160: 243,
            "safe-buffer": 244,
            "sha.js": 247
        } ],
        107: [ function(require, module, exports) {
            "use strict";
            var inherits = require("inherits"), Buffer = require("safe-buffer").Buffer, Base = require("cipher-base"), ZEROS = Buffer.alloc(128), blocksize = 64;
            function Hmac(alg, key) {
                Base.call(this, "digest"), "string" == typeof key && (key = Buffer.from(key)), this._alg = alg, 
                (this._key = key).length > blocksize ? key = alg(key) : key.length < blocksize && (key = Buffer.concat([ key, ZEROS ], blocksize));
                for (var ipad = this._ipad = Buffer.allocUnsafe(blocksize), opad = this._opad = Buffer.allocUnsafe(blocksize), i = 0; i < blocksize; i++) ipad[i] = 54 ^ key[i], 
                opad[i] = 92 ^ key[i];
                this._hash = [ ipad ];
            }
            inherits(Hmac, Base), Hmac.prototype._update = function(data) {
                this._hash.push(data);
            }, Hmac.prototype._final = function() {
                var h = this._alg(Buffer.concat(this._hash));
                return this._alg(Buffer.concat([ this._opad, h ]));
            }, module.exports = Hmac;
        }, {
            "cipher-base": 79,
            inherits: 152,
            "safe-buffer": 244
        } ],
        108: [ function(require, module, exports) {
            "use strict";
            exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = require("randombytes"), 
            exports.createHash = exports.Hash = require("create-hash"), exports.createHmac = exports.Hmac = require("create-hmac");
            var algos = require("browserify-sign/algos"), algoKeys = Object.keys(algos), hashes = [ "sha1", "sha224", "sha256", "sha384", "sha512", "md5", "rmd160" ].concat(algoKeys);
            exports.getHashes = function() {
                return hashes;
            };
            var p = require("pbkdf2");
            exports.pbkdf2 = p.pbkdf2, exports.pbkdf2Sync = p.pbkdf2Sync;
            var aes = require("browserify-cipher");
            exports.Cipher = aes.Cipher, exports.createCipher = aes.createCipher, exports.Cipheriv = aes.Cipheriv, 
            exports.createCipheriv = aes.createCipheriv, exports.Decipher = aes.Decipher, exports.createDecipher = aes.createDecipher, 
            exports.Decipheriv = aes.Decipheriv, exports.createDecipheriv = aes.createDecipheriv, 
            exports.getCiphers = aes.getCiphers, exports.listCiphers = aes.listCiphers;
            var dh = require("diffie-hellman");
            exports.DiffieHellmanGroup = dh.DiffieHellmanGroup, exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup, 
            exports.getDiffieHellman = dh.getDiffieHellman, exports.createDiffieHellman = dh.createDiffieHellman, 
            exports.DiffieHellman = dh.DiffieHellman;
            var sign = require("browserify-sign");
            exports.createSign = sign.createSign, exports.Sign = sign.Sign, exports.createVerify = sign.createVerify, 
            exports.Verify = sign.Verify, exports.createECDH = require("create-ecdh");
            var publicEncrypt = require("public-encrypt");
            exports.publicEncrypt = publicEncrypt.publicEncrypt, exports.privateEncrypt = publicEncrypt.privateEncrypt, 
            exports.publicDecrypt = publicEncrypt.publicDecrypt, exports.privateDecrypt = publicEncrypt.privateDecrypt;
            var rf = require("randomfill");
            exports.randomFill = rf.randomFill, exports.randomFillSync = rf.randomFillSync, 
            exports.createCredentials = function() {
                throw new Error([ "sorry, createCredentials is not implemented yet", "we accept pull requests", "https://github.com/crypto-browserify/crypto-browserify" ].join("\n"));
            }, exports.constants = {
                DH_CHECK_P_NOT_SAFE_PRIME: 2,
                DH_CHECK_P_NOT_PRIME: 1,
                DH_UNABLE_TO_CHECK_GENERATOR: 4,
                DH_NOT_SUITABLE_GENERATOR: 8,
                NPN_ENABLED: 1,
                ALPN_ENABLED: 1,
                RSA_PKCS1_PADDING: 1,
                RSA_SSLV23_PADDING: 2,
                RSA_NO_PADDING: 3,
                RSA_PKCS1_OAEP_PADDING: 4,
                RSA_X931_PADDING: 5,
                RSA_PKCS1_PSS_PADDING: 6,
                POINT_CONVERSION_COMPRESSED: 2,
                POINT_CONVERSION_UNCOMPRESSED: 4,
                POINT_CONVERSION_HYBRID: 6
            };
        }, {
            "browserify-cipher": 62,
            "browserify-sign": 69,
            "browserify-sign/algos": 66,
            "create-ecdh": 102,
            "create-hash": 103,
            "create-hmac": 106,
            "diffie-hellman": 115,
            pbkdf2: 218,
            "public-encrypt": 225,
            randombytes: 231,
            randomfill: 232
        } ],
        109: [ function(require, module, exports) {
            "use strict";
            exports.utils = require("./des/utils"), exports.Cipher = require("./des/cipher"), 
            exports.DES = require("./des/des"), exports.CBC = require("./des/cbc"), exports.EDE = require("./des/ede");
        }, {
            "./des/cbc": 110,
            "./des/cipher": 111,
            "./des/des": 112,
            "./des/ede": 113,
            "./des/utils": 114
        } ],
        110: [ function(require, module, exports) {
            "use strict";
            var assert = require("minimalistic-assert"), inherits = require("inherits"), proto = {};
            function CBCState(iv) {
                assert.equal(iv.length, 8, "Invalid IV length"), this.iv = new Array(8);
                for (var i = 0; i < this.iv.length; i++) this.iv[i] = iv[i];
            }
            exports.instantiate = function(Base) {
                function CBC(options) {
                    Base.call(this, options), this._cbcInit();
                }
                inherits(CBC, Base);
                for (var keys = Object.keys(proto), i = 0; i < keys.length; i++) {
                    var key = keys[i];
                    CBC.prototype[key] = proto[key];
                }
                return CBC.create = function(options) {
                    return new CBC(options);
                }, CBC;
            }, proto._cbcInit = function() {
                var state = new CBCState(this.options.iv);
                this._cbcState = state;
            }, proto._update = function(inp, inOff, out, outOff) {
                var state = this._cbcState, superProto = this.constructor.super_.prototype, iv = state.iv;
                if ("encrypt" === this.type) {
                    for (var i = 0; i < this.blockSize; i++) iv[i] ^= inp[inOff + i];
                    superProto._update.call(this, iv, 0, out, outOff);
                    for (i = 0; i < this.blockSize; i++) iv[i] = out[outOff + i];
                } else {
                    superProto._update.call(this, inp, inOff, out, outOff);
                    for (i = 0; i < this.blockSize; i++) out[outOff + i] ^= iv[i];
                    for (i = 0; i < this.blockSize; i++) iv[i] = inp[inOff + i];
                }
            };
        }, {
            inherits: 152,
            "minimalistic-assert": 195
        } ],
        111: [ function(require, module, exports) {
            "use strict";
            var assert = require("minimalistic-assert");
            function Cipher(options) {
                this.options = options, this.type = this.options.type, this.blockSize = 8, this._init(), 
                this.buffer = new Array(this.blockSize), this.bufferOff = 0;
            }
            (module.exports = Cipher).prototype._init = function() {}, Cipher.prototype.update = function(data) {
                return 0 === data.length ? [] : "decrypt" === this.type ? this._updateDecrypt(data) : this._updateEncrypt(data);
            }, Cipher.prototype._buffer = function(data, off) {
                for (var min = Math.min(this.buffer.length - this.bufferOff, data.length - off), i = 0; i < min; i++) this.buffer[this.bufferOff + i] = data[off + i];
                return this.bufferOff += min, min;
            }, Cipher.prototype._flushBuffer = function(out, off) {
                return this._update(this.buffer, 0, out, off), this.bufferOff = 0, this.blockSize;
            }, Cipher.prototype._updateEncrypt = function(data) {
                var inputOff = 0, outputOff = 0, count = (this.bufferOff + data.length) / this.blockSize | 0, out = new Array(count * this.blockSize);
                0 !== this.bufferOff && (inputOff += this._buffer(data, inputOff), this.bufferOff === this.buffer.length && (outputOff += this._flushBuffer(out, outputOff)));
                for (var max = data.length - (data.length - inputOff) % this.blockSize; inputOff < max; inputOff += this.blockSize) this._update(data, inputOff, out, outputOff), 
                outputOff += this.blockSize;
                for (;inputOff < data.length; inputOff++, this.bufferOff++) this.buffer[this.bufferOff] = data[inputOff];
                return out;
            }, Cipher.prototype._updateDecrypt = function(data) {
                for (var inputOff = 0, outputOff = 0, count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1, out = new Array(count * this.blockSize); 0 < count; count--) inputOff += this._buffer(data, inputOff), 
                outputOff += this._flushBuffer(out, outputOff);
                return inputOff += this._buffer(data, inputOff), out;
            }, Cipher.prototype.final = function(buffer) {
                var first, last;
                return buffer && (first = this.update(buffer)), last = "encrypt" === this.type ? this._finalEncrypt() : this._finalDecrypt(), 
                first ? first.concat(last) : last;
            }, Cipher.prototype._pad = function(buffer, off) {
                if (0 === off) return !1;
                for (;off < buffer.length; ) buffer[off++] = 0;
                return !0;
            }, Cipher.prototype._finalEncrypt = function() {
                if (!this._pad(this.buffer, this.bufferOff)) return [];
                var out = new Array(this.blockSize);
                return this._update(this.buffer, 0, out, 0), out;
            }, Cipher.prototype._unpad = function(buffer) {
                return buffer;
            }, Cipher.prototype._finalDecrypt = function() {
                assert.equal(this.bufferOff, this.blockSize, "Not enough data to decrypt");
                var out = new Array(this.blockSize);
                return this._flushBuffer(out, 0), this._unpad(out);
            };
        }, {
            "minimalistic-assert": 195
        } ],
        112: [ function(require, module, exports) {
            "use strict";
            var assert = require("minimalistic-assert"), inherits = require("inherits"), des = require("../des"), utils = des.utils, Cipher = des.Cipher;
            function DESState() {
                this.tmp = new Array(2), this.keys = null;
            }
            function DES(options) {
                Cipher.call(this, options);
                var state = new DESState();
                this._desState = state, this.deriveKeys(state, options.key);
            }
            inherits(DES, Cipher), (module.exports = DES).create = function(options) {
                return new DES(options);
            };
            var shiftTable = [ 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1 ];
            DES.prototype.deriveKeys = function(state, key) {
                state.keys = new Array(32), assert.equal(key.length, this.blockSize, "Invalid key length");
                var kL = utils.readUInt32BE(key, 0), kR = utils.readUInt32BE(key, 4);
                utils.pc1(kL, kR, state.tmp, 0), kL = state.tmp[0], kR = state.tmp[1];
                for (var i = 0; i < state.keys.length; i += 2) {
                    var shift = shiftTable[i >>> 1];
                    kL = utils.r28shl(kL, shift), kR = utils.r28shl(kR, shift), utils.pc2(kL, kR, state.keys, i);
                }
            }, DES.prototype._update = function(inp, inOff, out, outOff) {
                var state = this._desState, l = utils.readUInt32BE(inp, inOff), r = utils.readUInt32BE(inp, inOff + 4);
                utils.ip(l, r, state.tmp, 0), l = state.tmp[0], r = state.tmp[1], "encrypt" === this.type ? this._encrypt(state, l, r, state.tmp, 0) : this._decrypt(state, l, r, state.tmp, 0), 
                l = state.tmp[0], r = state.tmp[1], utils.writeUInt32BE(out, l, outOff), utils.writeUInt32BE(out, r, outOff + 4);
            }, DES.prototype._pad = function(buffer, off) {
                for (var value = buffer.length - off, i = off; i < buffer.length; i++) buffer[i] = value;
                return !0;
            }, DES.prototype._unpad = function(buffer) {
                for (var pad = buffer[buffer.length - 1], i = buffer.length - pad; i < buffer.length; i++) assert.equal(buffer[i], pad);
                return buffer.slice(0, buffer.length - pad);
            }, DES.prototype._encrypt = function(state, lStart, rStart, out, off) {
                for (var l = lStart, r = rStart, i = 0; i < state.keys.length; i += 2) {
                    var keyL = state.keys[i], keyR = state.keys[i + 1];
                    utils.expand(r, state.tmp, 0), keyL ^= state.tmp[0], keyR ^= state.tmp[1];
                    var s = utils.substitute(keyL, keyR), t = r;
                    r = (l ^ utils.permute(s)) >>> 0, l = t;
                }
                utils.rip(r, l, out, off);
            }, DES.prototype._decrypt = function(state, lStart, rStart, out, off) {
                for (var l = rStart, r = lStart, i = state.keys.length - 2; 0 <= i; i -= 2) {
                    var keyL = state.keys[i], keyR = state.keys[i + 1];
                    utils.expand(l, state.tmp, 0), keyL ^= state.tmp[0], keyR ^= state.tmp[1];
                    var s = utils.substitute(keyL, keyR), t = l;
                    l = (r ^ utils.permute(s)) >>> 0, r = t;
                }
                utils.rip(l, r, out, off);
            };
        }, {
            "../des": 109,
            inherits: 152,
            "minimalistic-assert": 195
        } ],
        113: [ function(require, module, exports) {
            "use strict";
            var assert = require("minimalistic-assert"), inherits = require("inherits"), des = require("../des"), Cipher = des.Cipher, DES = des.DES;
            function EDEState(type, key) {
                assert.equal(key.length, 24, "Invalid key length");
                var k1 = key.slice(0, 8), k2 = key.slice(8, 16), k3 = key.slice(16, 24);
                this.ciphers = "encrypt" === type ? [ DES.create({
                    type: "encrypt",
                    key: k1
                }), DES.create({
                    type: "decrypt",
                    key: k2
                }), DES.create({
                    type: "encrypt",
                    key: k3
                }) ] : [ DES.create({
                    type: "decrypt",
                    key: k3
                }), DES.create({
                    type: "encrypt",
                    key: k2
                }), DES.create({
                    type: "decrypt",
                    key: k1
                }) ];
            }
            function EDE(options) {
                Cipher.call(this, options);
                var state = new EDEState(this.type, this.options.key);
                this._edeState = state;
            }
            inherits(EDE, Cipher), (module.exports = EDE).create = function(options) {
                return new EDE(options);
            }, EDE.prototype._update = function(inp, inOff, out, outOff) {
                var state = this._edeState;
                state.ciphers[0]._update(inp, inOff, out, outOff), state.ciphers[1]._update(out, outOff, out, outOff), 
                state.ciphers[2]._update(out, outOff, out, outOff);
            }, EDE.prototype._pad = DES.prototype._pad, EDE.prototype._unpad = DES.prototype._unpad;
        }, {
            "../des": 109,
            inherits: 152,
            "minimalistic-assert": 195
        } ],
        114: [ function(require, module, exports) {
            "use strict";
            exports.readUInt32BE = function(bytes, off) {
                return (bytes[0 + off] << 24 | bytes[1 + off] << 16 | bytes[2 + off] << 8 | bytes[3 + off]) >>> 0;
            }, exports.writeUInt32BE = function(bytes, value, off) {
                bytes[0 + off] = value >>> 24, bytes[1 + off] = value >>> 16 & 255, bytes[2 + off] = value >>> 8 & 255, 
                bytes[3 + off] = 255 & value;
            }, exports.ip = function(inL, inR, out, off) {
                for (var outL = 0, outR = 0, i = 6; 0 <= i; i -= 2) {
                    for (var j = 0; j <= 24; j += 8) outL <<= 1, outL |= inR >>> j + i & 1;
                    for (j = 0; j <= 24; j += 8) outL <<= 1, outL |= inL >>> j + i & 1;
                }
                for (i = 6; 0 <= i; i -= 2) {
                    for (j = 1; j <= 25; j += 8) outR <<= 1, outR |= inR >>> j + i & 1;
                    for (j = 1; j <= 25; j += 8) outR <<= 1, outR |= inL >>> j + i & 1;
                }
                out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;
            }, exports.rip = function(inL, inR, out, off) {
                for (var outL = 0, outR = 0, i = 0; i < 4; i++) for (var j = 24; 0 <= j; j -= 8) outL <<= 1, 
                outL |= inR >>> j + i & 1, outL <<= 1, outL |= inL >>> j + i & 1;
                for (i = 4; i < 8; i++) for (j = 24; 0 <= j; j -= 8) outR <<= 1, outR |= inR >>> j + i & 1, 
                outR <<= 1, outR |= inL >>> j + i & 1;
                out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;
            }, exports.pc1 = function(inL, inR, out, off) {
                for (var outL = 0, outR = 0, i = 7; 5 <= i; i--) {
                    for (var j = 0; j <= 24; j += 8) outL <<= 1, outL |= inR >> j + i & 1;
                    for (j = 0; j <= 24; j += 8) outL <<= 1, outL |= inL >> j + i & 1;
                }
                for (j = 0; j <= 24; j += 8) outL <<= 1, outL |= inR >> j + i & 1;
                for (i = 1; i <= 3; i++) {
                    for (j = 0; j <= 24; j += 8) outR <<= 1, outR |= inR >> j + i & 1;
                    for (j = 0; j <= 24; j += 8) outR <<= 1, outR |= inL >> j + i & 1;
                }
                for (j = 0; j <= 24; j += 8) outR <<= 1, outR |= inL >> j + i & 1;
                out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;
            }, exports.r28shl = function(num, shift) {
                return num << shift & 268435455 | num >>> 28 - shift;
            };
            var pc2table = [ 14, 11, 17, 4, 27, 23, 25, 0, 13, 22, 7, 18, 5, 9, 16, 24, 2, 20, 12, 21, 1, 8, 15, 26, 15, 4, 25, 19, 9, 1, 26, 16, 5, 11, 23, 8, 12, 7, 17, 0, 22, 3, 10, 14, 6, 20, 27, 24 ];
            exports.pc2 = function(inL, inR, out, off) {
                for (var outL = 0, outR = 0, len = pc2table.length >>> 1, i = 0; i < len; i++) outL <<= 1, 
                outL |= inL >>> pc2table[i] & 1;
                for (i = len; i < pc2table.length; i++) outR <<= 1, outR |= inR >>> pc2table[i] & 1;
                out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;
            }, exports.expand = function(r, out, off) {
                var outL = 0, outR = 0;
                outL = (1 & r) << 5 | r >>> 27;
                for (var i = 23; 15 <= i; i -= 4) outL <<= 6, outL |= r >>> i & 63;
                for (i = 11; 3 <= i; i -= 4) outR |= r >>> i & 63, outR <<= 6;
                outR |= (31 & r) << 1 | r >>> 31, out[off + 0] = outL >>> 0, out[off + 1] = outR >>> 0;
            };
            var sTable = [ 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11 ];
            exports.substitute = function(inL, inR) {
                for (var out = 0, i = 0; i < 4; i++) {
                    out <<= 4, out |= sTable[64 * i + (inL >>> 18 - 6 * i & 63)];
                }
                for (i = 0; i < 4; i++) {
                    out <<= 4, out |= sTable[256 + 64 * i + (inR >>> 18 - 6 * i & 63)];
                }
                return out >>> 0;
            };
            var permuteTable = [ 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7 ];
            exports.permute = function(num) {
                for (var out = 0, i = 0; i < permuteTable.length; i++) out <<= 1, out |= num >>> permuteTable[i] & 1;
                return out >>> 0;
            }, exports.padSplit = function(num, size, group) {
                for (var str = num.toString(2); str.length < size; ) str = "0" + str;
                for (var out = [], i = 0; i < size; i += group) out.push(str.slice(i, i + group));
                return out.join(" ");
            };
        }, {} ],
        115: [ function(require, module, exports) {
            (function(Buffer) {
                var generatePrime = require("./lib/generatePrime"), primes = require("./lib/primes.json"), DH = require("./lib/dh");
                var ENCODINGS = {
                    binary: !0,
                    hex: !0,
                    base64: !0
                };
                exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = function(mod) {
                    var prime = new Buffer(primes[mod].prime, "hex"), gen = new Buffer(primes[mod].gen, "hex");
                    return new DH(prime, gen);
                }, exports.createDiffieHellman = exports.DiffieHellman = function createDiffieHellman(prime, enc, generator, genc) {
                    return Buffer.isBuffer(enc) || void 0 === ENCODINGS[enc] ? createDiffieHellman(prime, "binary", enc, generator) : (enc = enc || "binary", 
                    genc = genc || "binary", generator = generator || new Buffer([ 2 ]), Buffer.isBuffer(generator) || (generator = new Buffer(generator, genc)), 
                    "number" == typeof prime ? new DH(generatePrime(prime, generator), generator, !0) : (Buffer.isBuffer(prime) || (prime = new Buffer(prime, enc)), 
                    new DH(prime, generator, !0)));
                };
            }).call(this, require("buffer").Buffer);
        }, {
            "./lib/dh": 116,
            "./lib/generatePrime": 117,
            "./lib/primes.json": 118,
            buffer: 77
        } ],
        116: [ function(require, module, exports) {
            (function(Buffer) {
                var BN = require("bn.js"), millerRabin = new (require("miller-rabin"))(), TWENTYFOUR = new BN(24), ELEVEN = new BN(11), TEN = new BN(10), THREE = new BN(3), SEVEN = new BN(7), primes = require("./generatePrime"), randomBytes = require("randombytes");
                function setPublicKey(pub, enc) {
                    return enc = enc || "utf8", Buffer.isBuffer(pub) || (pub = new Buffer(pub, enc)), 
                    this._pub = new BN(pub), this;
                }
                function setPrivateKey(priv, enc) {
                    return enc = enc || "utf8", Buffer.isBuffer(priv) || (priv = new Buffer(priv, enc)), 
                    this._priv = new BN(priv), this;
                }
                module.exports = DH;
                var primeCache = {};
                function DH(prime, generator, malleable) {
                    this.setGenerator(generator), this.__prime = new BN(prime), this._prime = BN.mont(this.__prime), 
                    this._primeLen = prime.length, this._pub = void 0, this._priv = void 0, this._primeCode = void 0, 
                    malleable ? (this.setPublicKey = setPublicKey, this.setPrivateKey = setPrivateKey) : this._primeCode = 8;
                }
                function formatReturnValue(bn, enc) {
                    var buf = new Buffer(bn.toArray());
                    return enc ? buf.toString(enc) : buf;
                }
                Object.defineProperty(DH.prototype, "verifyError", {
                    enumerable: !0,
                    get: function() {
                        return "number" != typeof this._primeCode && (this._primeCode = function(prime, generator) {
                            var gen = generator.toString("hex"), hex = [ gen, prime.toString(16) ].join("_");
                            if (hex in primeCache) return primeCache[hex];
                            var rem, error = 0;
                            if (prime.isEven() || !primes.simpleSieve || !primes.fermatTest(prime) || !millerRabin.test(prime)) return error += 1, 
                            error += "02" === gen || "05" === gen ? 8 : 4, primeCache[hex] = error;
                            switch (millerRabin.test(prime.shrn(1)) || (error += 2), gen) {
                              case "02":
                                prime.mod(TWENTYFOUR).cmp(ELEVEN) && (error += 8);
                                break;

                              case "05":
                                (rem = prime.mod(TEN)).cmp(THREE) && rem.cmp(SEVEN) && (error += 8);
                                break;

                              default:
                                error += 4;
                            }
                            return primeCache[hex] = error;
                        }(this.__prime, this.__gen)), this._primeCode;
                    }
                }), DH.prototype.generateKeys = function() {
                    return this._priv || (this._priv = new BN(randomBytes(this._primeLen))), this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed(), 
                    this.getPublicKey();
                }, DH.prototype.computeSecret = function(other) {
                    var secret = (other = (other = new BN(other)).toRed(this._prime)).redPow(this._priv).fromRed(), out = new Buffer(secret.toArray()), prime = this.getPrime();
                    if (out.length < prime.length) {
                        var front = new Buffer(prime.length - out.length);
                        front.fill(0), out = Buffer.concat([ front, out ]);
                    }
                    return out;
                }, DH.prototype.getPublicKey = function(enc) {
                    return formatReturnValue(this._pub, enc);
                }, DH.prototype.getPrivateKey = function(enc) {
                    return formatReturnValue(this._priv, enc);
                }, DH.prototype.getPrime = function(enc) {
                    return formatReturnValue(this.__prime, enc);
                }, DH.prototype.getGenerator = function(enc) {
                    return formatReturnValue(this._gen, enc);
                }, DH.prototype.setGenerator = function(gen, enc) {
                    return enc = enc || "utf8", Buffer.isBuffer(gen) || (gen = new Buffer(gen, enc)), 
                    this.__gen = gen, this._gen = new BN(gen), this;
                };
            }).call(this, require("buffer").Buffer);
        }, {
            "./generatePrime": 117,
            "bn.js": 42,
            buffer: 77,
            "miller-rabin": 194,
            randombytes: 231
        } ],
        117: [ function(require, module, exports) {
            var randomBytes = require("randombytes");
            (module.exports = findPrime).simpleSieve = simpleSieve, findPrime.fermatTest = fermatTest;
            var BN = require("bn.js"), TWENTYFOUR = new BN(24), millerRabin = new (require("miller-rabin"))(), ONE = new BN(1), TWO = new BN(2), FIVE = new BN(5), TEN = (new BN(16), 
            new BN(8), new BN(10)), THREE = new BN(3), ELEVEN = (new BN(7), new BN(11)), FOUR = new BN(4), primes = (new BN(12), 
            null);
            function _getPrimes() {
                if (null !== primes) return primes;
                var res = [];
                res[0] = 2;
                for (var i = 1, k = 3; k < 1048576; k += 2) {
                    for (var sqrt = Math.ceil(Math.sqrt(k)), j = 0; j < i && res[j] <= sqrt && k % res[j] != 0; j++) ;
                    i !== j && res[j] <= sqrt || (res[i++] = k);
                }
                return primes = res;
            }
            function simpleSieve(p) {
                for (var primes = _getPrimes(), i = 0; i < primes.length; i++) if (0 === p.modn(primes[i])) return 0 === p.cmpn(primes[i]);
                return !0;
            }
            function fermatTest(p) {
                var red = BN.mont(p);
                return 0 === TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1);
            }
            function findPrime(bits, gen) {
                if (bits < 16) return new BN(2 === gen || 5 === gen ? [ 140, 123 ] : [ 140, 39 ]);
                var num, n2;
                for (gen = new BN(gen); ;) {
                    for (num = new BN(randomBytes(Math.ceil(bits / 8))); num.bitLength() > bits; ) num.ishrn(1);
                    if (num.isEven() && num.iadd(ONE), num.testn(1) || num.iadd(TWO), gen.cmp(TWO)) {
                        if (!gen.cmp(FIVE)) for (;num.mod(TEN).cmp(THREE); ) num.iadd(FOUR);
                    } else for (;num.mod(TWENTYFOUR).cmp(ELEVEN); ) num.iadd(FOUR);
                    if (simpleSieve(n2 = num.shrn(1)) && simpleSieve(num) && fermatTest(n2) && fermatTest(num) && millerRabin.test(n2) && millerRabin.test(num)) return num;
                }
            }
        }, {
            "bn.js": 42,
            "miller-rabin": 194,
            randombytes: 231
        } ],
        118: [ function(require, module, exports) {
            module.exports = {
                modp1: {
                    gen: "02",
                    prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"
                },
                modp2: {
                    gen: "02",
                    prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"
                },
                modp5: {
                    gen: "02",
                    prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"
                },
                modp14: {
                    gen: "02",
                    prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"
                },
                modp15: {
                    gen: "02",
                    prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"
                },
                modp16: {
                    gen: "02",
                    prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"
                },
                modp17: {
                    gen: "02",
                    prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"
                },
                modp18: {
                    gen: "02",
                    prime: "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"
                }
            };
        }, {} ],
        119: [ function(require, module, exports) {
            "use strict";
            var elliptic = exports;
            elliptic.version = require("../package.json").version, elliptic.utils = require("./elliptic/utils"), 
            elliptic.rand = require("brorand"), elliptic.curve = require("./elliptic/curve"), 
            elliptic.curves = require("./elliptic/curves"), elliptic.ec = require("./elliptic/ec"), 
            elliptic.eddsa = require("./elliptic/eddsa");
        }, {
            "../package.json": 134,
            "./elliptic/curve": 122,
            "./elliptic/curves": 125,
            "./elliptic/ec": 126,
            "./elliptic/eddsa": 129,
            "./elliptic/utils": 133,
            brorand: 43
        } ],
        120: [ function(require, module, exports) {
            "use strict";
            var BN = require("bn.js"), utils = require("../../elliptic").utils, getNAF = utils.getNAF, getJSF = utils.getJSF, assert = utils.assert;
            function BaseCurve(type, conf) {
                this.type = type, this.p = new BN(conf.p, 16), this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p), 
                this.zero = new BN(0).toRed(this.red), this.one = new BN(1).toRed(this.red), this.two = new BN(2).toRed(this.red), 
                this.n = conf.n && new BN(conf.n, 16), this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed), 
                this._wnafT1 = new Array(4), this._wnafT2 = new Array(4), this._wnafT3 = new Array(4), 
                this._wnafT4 = new Array(4);
                var adjustCount = this.n && this.p.div(this.n);
                !adjustCount || 0 < adjustCount.cmpn(100) ? this.redN = null : (this._maxwellTrick = !0, 
                this.redN = this.n.toRed(this.red));
            }
            function BasePoint(curve, type) {
                this.curve = curve, this.type = type, this.precomputed = null;
            }
            (module.exports = BaseCurve).prototype.point = function() {
                throw new Error("Not implemented");
            }, BaseCurve.prototype.validate = function() {
                throw new Error("Not implemented");
            }, BaseCurve.prototype._fixedNafMul = function(p, k) {
                assert(p.precomputed);
                var doubles = p._getDoubles(), naf = getNAF(k, 1), I = (1 << doubles.step + 1) - (doubles.step % 2 == 0 ? 2 : 1);
                I /= 3;
                for (var repr = [], j = 0; j < naf.length; j += doubles.step) {
                    var nafW = 0;
                    for (k = j + doubles.step - 1; j <= k; k--) nafW = (nafW << 1) + naf[k];
                    repr.push(nafW);
                }
                for (var a = this.jpoint(null, null, null), b = this.jpoint(null, null, null), i = I; 0 < i; i--) {
                    for (j = 0; j < repr.length; j++) {
                        (nafW = repr[j]) === i ? b = b.mixedAdd(doubles.points[j]) : nafW === -i && (b = b.mixedAdd(doubles.points[j].neg()));
                    }
                    a = a.add(b);
                }
                return a.toP();
            }, BaseCurve.prototype._wnafMul = function(p, k) {
                var w = 4, nafPoints = p._getNAFPoints(w);
                w = nafPoints.wnd;
                for (var wnd = nafPoints.points, naf = getNAF(k, w), acc = this.jpoint(null, null, null), i = naf.length - 1; 0 <= i; i--) {
                    for (k = 0; 0 <= i && 0 === naf[i]; i--) k++;
                    if (0 <= i && k++, acc = acc.dblp(k), i < 0) break;
                    var z = naf[i];
                    assert(0 !== z), acc = "affine" === p.type ? 0 < z ? acc.mixedAdd(wnd[z - 1 >> 1]) : acc.mixedAdd(wnd[-z - 1 >> 1].neg()) : 0 < z ? acc.add(wnd[z - 1 >> 1]) : acc.add(wnd[-z - 1 >> 1].neg());
                }
                return "affine" === p.type ? acc.toP() : acc;
            }, BaseCurve.prototype._wnafMulAdd = function(defW, points, coeffs, len, jacobianResult) {
                for (var wndWidth = this._wnafT1, wnd = this._wnafT2, naf = this._wnafT3, max = 0, i = 0; i < len; i++) {
                    var nafPoints = (p = points[i])._getNAFPoints(defW);
                    wndWidth[i] = nafPoints.wnd, wnd[i] = nafPoints.points;
                }
                for (i = len - 1; 1 <= i; i -= 2) {
                    var a = i - 1, b = i;
                    if (1 === wndWidth[a] && 1 === wndWidth[b]) {
                        var comb = [ points[a], null, null, points[b] ];
                        0 === points[a].y.cmp(points[b].y) ? (comb[1] = points[a].add(points[b]), comb[2] = points[a].toJ().mixedAdd(points[b].neg())) : 0 === points[a].y.cmp(points[b].y.redNeg()) ? (comb[1] = points[a].toJ().mixedAdd(points[b]), 
                        comb[2] = points[a].add(points[b].neg())) : (comb[1] = points[a].toJ().mixedAdd(points[b]), 
                        comb[2] = points[a].toJ().mixedAdd(points[b].neg()));
                        var index = [ -3, -1, -5, -7, 0, 7, 5, 1, 3 ], jsf = getJSF(coeffs[a], coeffs[b]);
                        max = Math.max(jsf[0].length, max), naf[a] = new Array(max), naf[b] = new Array(max);
                        for (var j = 0; j < max; j++) {
                            var ja = 0 | jsf[0][j], jb = 0 | jsf[1][j];
                            naf[a][j] = index[3 * (ja + 1) + (jb + 1)], naf[b][j] = 0, wnd[a] = comb;
                        }
                    } else naf[a] = getNAF(coeffs[a], wndWidth[a]), naf[b] = getNAF(coeffs[b], wndWidth[b]), 
                    max = Math.max(naf[a].length, max), max = Math.max(naf[b].length, max);
                }
                var acc = this.jpoint(null, null, null), tmp = this._wnafT4;
                for (i = max; 0 <= i; i--) {
                    for (var k = 0; 0 <= i; ) {
                        var zero = !0;
                        for (j = 0; j < len; j++) tmp[j] = 0 | naf[j][i], 0 !== tmp[j] && (zero = !1);
                        if (!zero) break;
                        k++, i--;
                    }
                    if (0 <= i && k++, acc = acc.dblp(k), i < 0) break;
                    for (j = 0; j < len; j++) {
                        var p, z = tmp[j];
                        0 !== z && (0 < z ? p = wnd[j][z - 1 >> 1] : z < 0 && (p = wnd[j][-z - 1 >> 1].neg()), 
                        acc = "affine" === p.type ? acc.mixedAdd(p) : acc.add(p));
                    }
                }
                for (i = 0; i < len; i++) wnd[i] = null;
                return jacobianResult ? acc : acc.toP();
            }, (BaseCurve.BasePoint = BasePoint).prototype.eq = function() {
                throw new Error("Not implemented");
            }, BasePoint.prototype.validate = function() {
                return this.curve.validate(this);
            }, BaseCurve.prototype.decodePoint = function(bytes, enc) {
                bytes = utils.toArray(bytes, enc);
                var len = this.p.byteLength();
                if ((4 === bytes[0] || 6 === bytes[0] || 7 === bytes[0]) && bytes.length - 1 == 2 * len) return 6 === bytes[0] ? assert(bytes[bytes.length - 1] % 2 == 0) : 7 === bytes[0] && assert(bytes[bytes.length - 1] % 2 == 1), 
                this.point(bytes.slice(1, 1 + len), bytes.slice(1 + len, 1 + 2 * len));
                if ((2 === bytes[0] || 3 === bytes[0]) && bytes.length - 1 === len) return this.pointFromX(bytes.slice(1, 1 + len), 3 === bytes[0]);
                throw new Error("Unknown point format");
            }, BasePoint.prototype.encodeCompressed = function(enc) {
                return this.encode(enc, !0);
            }, BasePoint.prototype._encode = function(compact) {
                var len = this.curve.p.byteLength(), x = this.getX().toArray("be", len);
                return compact ? [ this.getY().isEven() ? 2 : 3 ].concat(x) : [ 4 ].concat(x, this.getY().toArray("be", len));
            }, BasePoint.prototype.encode = function(enc, compact) {
                return utils.encode(this._encode(compact), enc);
            }, BasePoint.prototype.precompute = function(power) {
                if (this.precomputed) return this;
                var precomputed = {
                    doubles: null,
                    naf: null,
                    beta: null
                };
                return precomputed.naf = this._getNAFPoints(8), precomputed.doubles = this._getDoubles(4, power), 
                precomputed.beta = this._getBeta(), this.precomputed = precomputed, this;
            }, BasePoint.prototype._hasDoubles = function(k) {
                if (!this.precomputed) return !1;
                var doubles = this.precomputed.doubles;
                return !!doubles && doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);
            }, BasePoint.prototype._getDoubles = function(step, power) {
                if (this.precomputed && this.precomputed.doubles) return this.precomputed.doubles;
                for (var doubles = [ this ], acc = this, i = 0; i < power; i += step) {
                    for (var j = 0; j < step; j++) acc = acc.dbl();
                    doubles.push(acc);
                }
                return {
                    step: step,
                    points: doubles
                };
            }, BasePoint.prototype._getNAFPoints = function(wnd) {
                if (this.precomputed && this.precomputed.naf) return this.precomputed.naf;
                for (var res = [ this ], max = (1 << wnd) - 1, dbl = 1 === max ? null : this.dbl(), i = 1; i < max; i++) res[i] = res[i - 1].add(dbl);
                return {
                    wnd: wnd,
                    points: res
                };
            }, BasePoint.prototype._getBeta = function() {
                return null;
            }, BasePoint.prototype.dblp = function(k) {
                for (var r = this, i = 0; i < k; i++) r = r.dbl();
                return r;
            };
        }, {
            "../../elliptic": 119,
            "bn.js": 42
        } ],
        121: [ function(require, module, exports) {
            "use strict";
            var curve = require("../curve"), elliptic = require("../../elliptic"), BN = require("bn.js"), inherits = require("inherits"), Base = curve.base, assert = elliptic.utils.assert;
            function EdwardsCurve(conf) {
                this.twisted = 1 != (0 | conf.a), this.mOneA = this.twisted && -1 == (0 | conf.a), 
                this.extended = this.mOneA, Base.call(this, "edwards", conf), this.a = new BN(conf.a, 16).umod(this.red.m), 
                this.a = this.a.toRed(this.red), this.c = new BN(conf.c, 16).toRed(this.red), this.c2 = this.c.redSqr(), 
                this.d = new BN(conf.d, 16).toRed(this.red), this.dd = this.d.redAdd(this.d), assert(!this.twisted || 0 === this.c.fromRed().cmpn(1)), 
                this.oneC = 1 == (0 | conf.c);
            }
            function Point(curve, x, y, z, t) {
                Base.BasePoint.call(this, curve, "projective"), null === x && null === y && null === z ? (this.x = this.curve.zero, 
                this.y = this.curve.one, this.z = this.curve.one, this.t = this.curve.zero, this.zOne = !0) : (this.x = new BN(x, 16), 
                this.y = new BN(y, 16), this.z = z ? new BN(z, 16) : this.curve.one, this.t = t && new BN(t, 16), 
                this.x.red || (this.x = this.x.toRed(this.curve.red)), this.y.red || (this.y = this.y.toRed(this.curve.red)), 
                this.z.red || (this.z = this.z.toRed(this.curve.red)), this.t && !this.t.red && (this.t = this.t.toRed(this.curve.red)), 
                this.zOne = this.z === this.curve.one, this.curve.extended && !this.t && (this.t = this.x.redMul(this.y), 
                this.zOne || (this.t = this.t.redMul(this.z.redInvm()))));
            }
            inherits(EdwardsCurve, Base), (module.exports = EdwardsCurve).prototype._mulA = function(num) {
                return this.mOneA ? num.redNeg() : this.a.redMul(num);
            }, EdwardsCurve.prototype._mulC = function(num) {
                return this.oneC ? num : this.c.redMul(num);
            }, EdwardsCurve.prototype.jpoint = function(x, y, z, t) {
                return this.point(x, y, z, t);
            }, EdwardsCurve.prototype.pointFromX = function(x, odd) {
                (x = new BN(x, 16)).red || (x = x.toRed(this.red));
                var x2 = x.redSqr(), rhs = this.c2.redSub(this.a.redMul(x2)), lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)), y2 = rhs.redMul(lhs.redInvm()), y = y2.redSqrt();
                if (0 !== y.redSqr().redSub(y2).cmp(this.zero)) throw new Error("invalid point");
                var isOdd = y.fromRed().isOdd();
                return (odd && !isOdd || !odd && isOdd) && (y = y.redNeg()), this.point(x, y);
            }, EdwardsCurve.prototype.pointFromY = function(y, odd) {
                (y = new BN(y, 16)).red || (y = y.toRed(this.red));
                var y2 = y.redSqr(), lhs = y2.redSub(this.one), rhs = y2.redMul(this.d).redAdd(this.one), x2 = lhs.redMul(rhs.redInvm());
                if (0 === x2.cmp(this.zero)) {
                    if (odd) throw new Error("invalid point");
                    return this.point(this.zero, y);
                }
                var x = x2.redSqrt();
                if (0 !== x.redSqr().redSub(x2).cmp(this.zero)) throw new Error("invalid point");
                return x.isOdd() !== odd && (x = x.redNeg()), this.point(x, y);
            }, EdwardsCurve.prototype.validate = function(point) {
                if (point.isInfinity()) return !0;
                point.normalize();
                var x2 = point.x.redSqr(), y2 = point.y.redSqr(), lhs = x2.redMul(this.a).redAdd(y2), rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2)));
                return 0 === lhs.cmp(rhs);
            }, inherits(Point, Base.BasePoint), EdwardsCurve.prototype.pointFromJSON = function(obj) {
                return Point.fromJSON(this, obj);
            }, EdwardsCurve.prototype.point = function(x, y, z, t) {
                return new Point(this, x, y, z, t);
            }, Point.fromJSON = function(curve, obj) {
                return new Point(curve, obj[0], obj[1], obj[2]);
            }, Point.prototype.inspect = function() {
                return this.isInfinity() ? "<EC Point Infinity>" : "<EC Point x: " + this.x.fromRed().toString(16, 2) + " y: " + this.y.fromRed().toString(16, 2) + " z: " + this.z.fromRed().toString(16, 2) + ">";
            }, Point.prototype.isInfinity = function() {
                return 0 === this.x.cmpn(0) && 0 === this.y.cmp(this.z);
            }, Point.prototype._extDbl = function() {
                var a = this.x.redSqr(), b = this.y.redSqr(), c = this.z.redSqr();
                c = c.redIAdd(c);
                var d = this.curve._mulA(a), e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b), g = d.redAdd(b), f = g.redSub(c), h = d.redSub(b), nx = e.redMul(f), ny = g.redMul(h), nt = e.redMul(h), nz = f.redMul(g);
                return this.curve.point(nx, ny, nz, nt);
            }, Point.prototype._projDbl = function() {
                var nx, ny, nz, b = this.x.redAdd(this.y).redSqr(), c = this.x.redSqr(), d = this.y.redSqr();
                if (this.curve.twisted) {
                    var f = (e = this.curve._mulA(c)).redAdd(d);
                    if (this.zOne) nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)), ny = f.redMul(e.redSub(d)), 
                    nz = f.redSqr().redSub(f).redSub(f); else {
                        var h = this.z.redSqr(), j = f.redSub(h).redISub(h);
                        nx = b.redSub(c).redISub(d).redMul(j), ny = f.redMul(e.redSub(d)), nz = f.redMul(j);
                    }
                } else {
                    var e = c.redAdd(d);
                    h = this.curve._mulC(this.c.redMul(this.z)).redSqr(), j = e.redSub(h).redSub(h);
                    nx = this.curve._mulC(b.redISub(e)).redMul(j), ny = this.curve._mulC(e).redMul(c.redISub(d)), 
                    nz = e.redMul(j);
                }
                return this.curve.point(nx, ny, nz);
            }, Point.prototype.dbl = function() {
                return this.isInfinity() ? this : this.curve.extended ? this._extDbl() : this._projDbl();
            }, Point.prototype._extAdd = function(p) {
                var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)), b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)), c = this.t.redMul(this.curve.dd).redMul(p.t), d = this.z.redMul(p.z.redAdd(p.z)), e = b.redSub(a), f = d.redSub(c), g = d.redAdd(c), h = b.redAdd(a), nx = e.redMul(f), ny = g.redMul(h), nt = e.redMul(h), nz = f.redMul(g);
                return this.curve.point(nx, ny, nz, nt);
            }, Point.prototype._projAdd = function(p) {
                var ny, nz, a = this.z.redMul(p.z), b = a.redSqr(), c = this.x.redMul(p.x), d = this.y.redMul(p.y), e = this.curve.d.redMul(c).redMul(d), f = b.redSub(e), g = b.redAdd(e), tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d), nx = a.redMul(f).redMul(tmp);
                return this.curve.twisted ? (ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))), 
                nz = f.redMul(g)) : (ny = a.redMul(g).redMul(d.redSub(c)), nz = this.curve._mulC(f).redMul(g)), 
                this.curve.point(nx, ny, nz);
            }, Point.prototype.add = function(p) {
                return this.isInfinity() ? p : p.isInfinity() ? this : this.curve.extended ? this._extAdd(p) : this._projAdd(p);
            }, Point.prototype.mul = function(k) {
                return this._hasDoubles(k) ? this.curve._fixedNafMul(this, k) : this.curve._wnafMul(this, k);
            }, Point.prototype.mulAdd = function(k1, p, k2) {
                return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, !1);
            }, Point.prototype.jmulAdd = function(k1, p, k2) {
                return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, !0);
            }, Point.prototype.normalize = function() {
                if (this.zOne) return this;
                var zi = this.z.redInvm();
                return this.x = this.x.redMul(zi), this.y = this.y.redMul(zi), this.t && (this.t = this.t.redMul(zi)), 
                this.z = this.curve.one, this.zOne = !0, this;
            }, Point.prototype.neg = function() {
                return this.curve.point(this.x.redNeg(), this.y, this.z, this.t && this.t.redNeg());
            }, Point.prototype.getX = function() {
                return this.normalize(), this.x.fromRed();
            }, Point.prototype.getY = function() {
                return this.normalize(), this.y.fromRed();
            }, Point.prototype.eq = function(other) {
                return this === other || 0 === this.getX().cmp(other.getX()) && 0 === this.getY().cmp(other.getY());
            }, Point.prototype.eqXToP = function(x) {
                var rx = x.toRed(this.curve.red).redMul(this.z);
                if (0 === this.x.cmp(rx)) return !0;
                for (var xc = x.clone(), t = this.curve.redN.redMul(this.z); ;) {
                    if (xc.iadd(this.curve.n), 0 <= xc.cmp(this.curve.p)) return !1;
                    if (rx.redIAdd(t), 0 === this.x.cmp(rx)) return !0;
                }
                return !1;
            }, Point.prototype.toP = Point.prototype.normalize, Point.prototype.mixedAdd = Point.prototype.add;
        }, {
            "../../elliptic": 119,
            "../curve": 122,
            "bn.js": 42,
            inherits: 152
        } ],
        122: [ function(require, module, exports) {
            "use strict";
            var curve = exports;
            curve.base = require("./base"), curve.short = require("./short"), curve.mont = require("./mont"), 
            curve.edwards = require("./edwards");
        }, {
            "./base": 120,
            "./edwards": 121,
            "./mont": 123,
            "./short": 124
        } ],
        123: [ function(require, module, exports) {
            "use strict";
            var curve = require("../curve"), BN = require("bn.js"), inherits = require("inherits"), Base = curve.base, utils = require("../../elliptic").utils;
            function MontCurve(conf) {
                Base.call(this, "mont", conf), this.a = new BN(conf.a, 16).toRed(this.red), this.b = new BN(conf.b, 16).toRed(this.red), 
                this.i4 = new BN(4).toRed(this.red).redInvm(), this.two = new BN(2).toRed(this.red), 
                this.a24 = this.i4.redMul(this.a.redAdd(this.two));
            }
            function Point(curve, x, z) {
                Base.BasePoint.call(this, curve, "projective"), null === x && null === z ? (this.x = this.curve.one, 
                this.z = this.curve.zero) : (this.x = new BN(x, 16), this.z = new BN(z, 16), this.x.red || (this.x = this.x.toRed(this.curve.red)), 
                this.z.red || (this.z = this.z.toRed(this.curve.red)));
            }
            inherits(MontCurve, Base), (module.exports = MontCurve).prototype.validate = function(point) {
                var x = point.normalize().x, x2 = x.redSqr(), rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x);
                return 0 === rhs.redSqrt().redSqr().cmp(rhs);
            }, inherits(Point, Base.BasePoint), MontCurve.prototype.decodePoint = function(bytes, enc) {
                return this.point(utils.toArray(bytes, enc), 1);
            }, MontCurve.prototype.point = function(x, z) {
                return new Point(this, x, z);
            }, MontCurve.prototype.pointFromJSON = function(obj) {
                return Point.fromJSON(this, obj);
            }, Point.prototype.precompute = function() {}, Point.prototype._encode = function() {
                return this.getX().toArray("be", this.curve.p.byteLength());
            }, Point.fromJSON = function(curve, obj) {
                return new Point(curve, obj[0], obj[1] || curve.one);
            }, Point.prototype.inspect = function() {
                return this.isInfinity() ? "<EC Point Infinity>" : "<EC Point x: " + this.x.fromRed().toString(16, 2) + " z: " + this.z.fromRed().toString(16, 2) + ">";
            }, Point.prototype.isInfinity = function() {
                return 0 === this.z.cmpn(0);
            }, Point.prototype.dbl = function() {
                var aa = this.x.redAdd(this.z).redSqr(), bb = this.x.redSub(this.z).redSqr(), c = aa.redSub(bb), nx = aa.redMul(bb), nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c)));
                return this.curve.point(nx, nz);
            }, Point.prototype.add = function() {
                throw new Error("Not supported on Montgomery curve");
            }, Point.prototype.diffAdd = function(p, diff) {
                var a = this.x.redAdd(this.z), b = this.x.redSub(this.z), c = p.x.redAdd(p.z), da = p.x.redSub(p.z).redMul(a), cb = c.redMul(b), nx = diff.z.redMul(da.redAdd(cb).redSqr()), nz = diff.x.redMul(da.redISub(cb).redSqr());
                return this.curve.point(nx, nz);
            }, Point.prototype.mul = function(k) {
                for (var t = k.clone(), a = this, b = this.curve.point(null, null), bits = []; 0 !== t.cmpn(0); t.iushrn(1)) bits.push(t.andln(1));
                for (var i = bits.length - 1; 0 <= i; i--) 0 === bits[i] ? (a = a.diffAdd(b, this), 
                b = b.dbl()) : (b = a.diffAdd(b, this), a = a.dbl());
                return b;
            }, Point.prototype.mulAdd = function() {
                throw new Error("Not supported on Montgomery curve");
            }, Point.prototype.jumlAdd = function() {
                throw new Error("Not supported on Montgomery curve");
            }, Point.prototype.eq = function(other) {
                return 0 === this.getX().cmp(other.getX());
            }, Point.prototype.normalize = function() {
                return this.x = this.x.redMul(this.z.redInvm()), this.z = this.curve.one, this;
            }, Point.prototype.getX = function() {
                return this.normalize(), this.x.fromRed();
            };
        }, {
            "../../elliptic": 119,
            "../curve": 122,
            "bn.js": 42,
            inherits: 152
        } ],
        124: [ function(require, module, exports) {
            "use strict";
            var curve = require("../curve"), elliptic = require("../../elliptic"), BN = require("bn.js"), inherits = require("inherits"), Base = curve.base, assert = elliptic.utils.assert;
            function ShortCurve(conf) {
                Base.call(this, "short", conf), this.a = new BN(conf.a, 16).toRed(this.red), this.b = new BN(conf.b, 16).toRed(this.red), 
                this.tinv = this.two.redInvm(), this.zeroA = 0 === this.a.fromRed().cmpn(0), this.threeA = 0 === this.a.fromRed().sub(this.p).cmpn(-3), 
                this.endo = this._getEndomorphism(conf), this._endoWnafT1 = new Array(4), this._endoWnafT2 = new Array(4);
            }
            function Point(curve, x, y, isRed) {
                Base.BasePoint.call(this, curve, "affine"), null === x && null === y ? (this.x = null, 
                this.y = null, this.inf = !0) : (this.x = new BN(x, 16), this.y = new BN(y, 16), 
                isRed && (this.x.forceRed(this.curve.red), this.y.forceRed(this.curve.red)), this.x.red || (this.x = this.x.toRed(this.curve.red)), 
                this.y.red || (this.y = this.y.toRed(this.curve.red)), this.inf = !1);
            }
            function JPoint(curve, x, y, z) {
                Base.BasePoint.call(this, curve, "jacobian"), null === x && null === y && null === z ? (this.x = this.curve.one, 
                this.y = this.curve.one, this.z = new BN(0)) : (this.x = new BN(x, 16), this.y = new BN(y, 16), 
                this.z = new BN(z, 16)), this.x.red || (this.x = this.x.toRed(this.curve.red)), 
                this.y.red || (this.y = this.y.toRed(this.curve.red)), this.z.red || (this.z = this.z.toRed(this.curve.red)), 
                this.zOne = this.z === this.curve.one;
            }
            inherits(ShortCurve, Base), (module.exports = ShortCurve).prototype._getEndomorphism = function(conf) {
                if (this.zeroA && this.g && this.n && 1 === this.p.modn(3)) {
                    var beta, lambda;
                    if (conf.beta) beta = new BN(conf.beta, 16).toRed(this.red); else {
                        var betas = this._getEndoRoots(this.p);
                        beta = (beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]).toRed(this.red);
                    }
                    if (conf.lambda) lambda = new BN(conf.lambda, 16); else {
                        var lambdas = this._getEndoRoots(this.n);
                        0 === this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) ? lambda = lambdas[0] : (lambda = lambdas[1], 
                        assert(0 === this.g.mul(lambda).x.cmp(this.g.x.redMul(beta))));
                    }
                    return {
                        beta: beta,
                        lambda: lambda,
                        basis: conf.basis ? conf.basis.map(function(vec) {
                            return {
                                a: new BN(vec.a, 16),
                                b: new BN(vec.b, 16)
                            };
                        }) : this._getEndoBasis(lambda)
                    };
                }
            }, ShortCurve.prototype._getEndoRoots = function(num) {
                var red = num === this.p ? this.red : BN.mont(num), tinv = new BN(2).toRed(red).redInvm(), ntinv = tinv.redNeg(), s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv);
                return [ ntinv.redAdd(s).fromRed(), ntinv.redSub(s).fromRed() ];
            }, ShortCurve.prototype._getEndoBasis = function(lambda) {
                for (var a0, b0, a1, b1, a2, b2, prevR, r, x, aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)), u = lambda, v = this.n.clone(), x1 = new BN(1), y1 = new BN(0), x2 = new BN(0), y2 = new BN(1), i = 0; 0 !== u.cmpn(0); ) {
                    var q = v.div(u);
                    r = v.sub(q.mul(u)), x = x2.sub(q.mul(x1));
                    var y = y2.sub(q.mul(y1));
                    if (!a1 && r.cmp(aprxSqrt) < 0) a0 = prevR.neg(), b0 = x1, a1 = r.neg(), b1 = x; else if (a1 && 2 == ++i) break;
                    v = u, u = prevR = r, x2 = x1, x1 = x, y2 = y1, y1 = y;
                }
                a2 = r.neg(), b2 = x;
                var len1 = a1.sqr().add(b1.sqr());
                return 0 <= a2.sqr().add(b2.sqr()).cmp(len1) && (a2 = a0, b2 = b0), a1.negative && (a1 = a1.neg(), 
                b1 = b1.neg()), a2.negative && (a2 = a2.neg(), b2 = b2.neg()), [ {
                    a: a1,
                    b: b1
                }, {
                    a: a2,
                    b: b2
                } ];
            }, ShortCurve.prototype._endoSplit = function(k) {
                var basis = this.endo.basis, v1 = basis[0], v2 = basis[1], c1 = v2.b.mul(k).divRound(this.n), c2 = v1.b.neg().mul(k).divRound(this.n), p1 = c1.mul(v1.a), p2 = c2.mul(v2.a), q1 = c1.mul(v1.b), q2 = c2.mul(v2.b);
                return {
                    k1: k.sub(p1).sub(p2),
                    k2: q1.add(q2).neg()
                };
            }, ShortCurve.prototype.pointFromX = function(x, odd) {
                (x = new BN(x, 16)).red || (x = x.toRed(this.red));
                var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b), y = y2.redSqrt();
                if (0 !== y.redSqr().redSub(y2).cmp(this.zero)) throw new Error("invalid point");
                var isOdd = y.fromRed().isOdd();
                return (odd && !isOdd || !odd && isOdd) && (y = y.redNeg()), this.point(x, y);
            }, ShortCurve.prototype.validate = function(point) {
                if (point.inf) return !0;
                var x = point.x, y = point.y, ax = this.a.redMul(x), rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b);
                return 0 === y.redSqr().redISub(rhs).cmpn(0);
            }, ShortCurve.prototype._endoWnafMulAdd = function(points, coeffs, jacobianResult) {
                for (var npoints = this._endoWnafT1, ncoeffs = this._endoWnafT2, i = 0; i < points.length; i++) {
                    var split = this._endoSplit(coeffs[i]), p = points[i], beta = p._getBeta();
                    split.k1.negative && (split.k1.ineg(), p = p.neg(!0)), split.k2.negative && (split.k2.ineg(), 
                    beta = beta.neg(!0)), npoints[2 * i] = p, npoints[2 * i + 1] = beta, ncoeffs[2 * i] = split.k1, 
                    ncoeffs[2 * i + 1] = split.k2;
                }
                for (var res = this._wnafMulAdd(1, npoints, ncoeffs, 2 * i, jacobianResult), j = 0; j < 2 * i; j++) npoints[j] = null, 
                ncoeffs[j] = null;
                return res;
            }, inherits(Point, Base.BasePoint), ShortCurve.prototype.point = function(x, y, isRed) {
                return new Point(this, x, y, isRed);
            }, ShortCurve.prototype.pointFromJSON = function(obj, red) {
                return Point.fromJSON(this, obj, red);
            }, Point.prototype._getBeta = function() {
                if (this.curve.endo) {
                    var pre = this.precomputed;
                    if (pre && pre.beta) return pre.beta;
                    var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y);
                    if (pre) {
                        var curve = this.curve, endoMul = function(p) {
                            return curve.point(p.x.redMul(curve.endo.beta), p.y);
                        };
                        (pre.beta = beta).precomputed = {
                            beta: null,
                            naf: pre.naf && {
                                wnd: pre.naf.wnd,
                                points: pre.naf.points.map(endoMul)
                            },
                            doubles: pre.doubles && {
                                step: pre.doubles.step,
                                points: pre.doubles.points.map(endoMul)
                            }
                        };
                    }
                    return beta;
                }
            }, Point.prototype.toJSON = function() {
                return this.precomputed ? [ this.x, this.y, this.precomputed && {
                    doubles: this.precomputed.doubles && {
                        step: this.precomputed.doubles.step,
                        points: this.precomputed.doubles.points.slice(1)
                    },
                    naf: this.precomputed.naf && {
                        wnd: this.precomputed.naf.wnd,
                        points: this.precomputed.naf.points.slice(1)
                    }
                } ] : [ this.x, this.y ];
            }, Point.fromJSON = function(curve, obj, red) {
                "string" == typeof obj && (obj = JSON.parse(obj));
                var res = curve.point(obj[0], obj[1], red);
                if (!obj[2]) return res;
                function obj2point(obj) {
                    return curve.point(obj[0], obj[1], red);
                }
                var pre = obj[2];
                return res.precomputed = {
                    beta: null,
                    doubles: pre.doubles && {
                        step: pre.doubles.step,
                        points: [ res ].concat(pre.doubles.points.map(obj2point))
                    },
                    naf: pre.naf && {
                        wnd: pre.naf.wnd,
                        points: [ res ].concat(pre.naf.points.map(obj2point))
                    }
                }, res;
            }, Point.prototype.inspect = function() {
                return this.isInfinity() ? "<EC Point Infinity>" : "<EC Point x: " + this.x.fromRed().toString(16, 2) + " y: " + this.y.fromRed().toString(16, 2) + ">";
            }, Point.prototype.isInfinity = function() {
                return this.inf;
            }, Point.prototype.add = function(p) {
                if (this.inf) return p;
                if (p.inf) return this;
                if (this.eq(p)) return this.dbl();
                if (this.neg().eq(p)) return this.curve.point(null, null);
                if (0 === this.x.cmp(p.x)) return this.curve.point(null, null);
                var c = this.y.redSub(p.y);
                0 !== c.cmpn(0) && (c = c.redMul(this.x.redSub(p.x).redInvm()));
                var nx = c.redSqr().redISub(this.x).redISub(p.x), ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
                return this.curve.point(nx, ny);
            }, Point.prototype.dbl = function() {
                if (this.inf) return this;
                var ys1 = this.y.redAdd(this.y);
                if (0 === ys1.cmpn(0)) return this.curve.point(null, null);
                var a = this.curve.a, x2 = this.x.redSqr(), dyinv = ys1.redInvm(), c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv), nx = c.redSqr().redISub(this.x.redAdd(this.x)), ny = c.redMul(this.x.redSub(nx)).redISub(this.y);
                return this.curve.point(nx, ny);
            }, Point.prototype.getX = function() {
                return this.x.fromRed();
            }, Point.prototype.getY = function() {
                return this.y.fromRed();
            }, Point.prototype.mul = function(k) {
                return k = new BN(k, 16), this._hasDoubles(k) ? this.curve._fixedNafMul(this, k) : this.curve.endo ? this.curve._endoWnafMulAdd([ this ], [ k ]) : this.curve._wnafMul(this, k);
            }, Point.prototype.mulAdd = function(k1, p2, k2) {
                var points = [ this, p2 ], coeffs = [ k1, k2 ];
                return this.curve.endo ? this.curve._endoWnafMulAdd(points, coeffs) : this.curve._wnafMulAdd(1, points, coeffs, 2);
            }, Point.prototype.jmulAdd = function(k1, p2, k2) {
                var points = [ this, p2 ], coeffs = [ k1, k2 ];
                return this.curve.endo ? this.curve._endoWnafMulAdd(points, coeffs, !0) : this.curve._wnafMulAdd(1, points, coeffs, 2, !0);
            }, Point.prototype.eq = function(p) {
                return this === p || this.inf === p.inf && (this.inf || 0 === this.x.cmp(p.x) && 0 === this.y.cmp(p.y));
            }, Point.prototype.neg = function(_precompute) {
                if (this.inf) return this;
                var res = this.curve.point(this.x, this.y.redNeg());
                if (_precompute && this.precomputed) {
                    var pre = this.precomputed, negate = function(p) {
                        return p.neg();
                    };
                    res.precomputed = {
                        naf: pre.naf && {
                            wnd: pre.naf.wnd,
                            points: pre.naf.points.map(negate)
                        },
                        doubles: pre.doubles && {
                            step: pre.doubles.step,
                            points: pre.doubles.points.map(negate)
                        }
                    };
                }
                return res;
            }, Point.prototype.toJ = function() {
                return this.inf ? this.curve.jpoint(null, null, null) : this.curve.jpoint(this.x, this.y, this.curve.one);
            }, inherits(JPoint, Base.BasePoint), ShortCurve.prototype.jpoint = function(x, y, z) {
                return new JPoint(this, x, y, z);
            }, JPoint.prototype.toP = function() {
                if (this.isInfinity()) return this.curve.point(null, null);
                var zinv = this.z.redInvm(), zinv2 = zinv.redSqr(), ax = this.x.redMul(zinv2), ay = this.y.redMul(zinv2).redMul(zinv);
                return this.curve.point(ax, ay);
            }, JPoint.prototype.neg = function() {
                return this.curve.jpoint(this.x, this.y.redNeg(), this.z);
            }, JPoint.prototype.add = function(p) {
                if (this.isInfinity()) return p;
                if (p.isInfinity()) return this;
                var pz2 = p.z.redSqr(), z2 = this.z.redSqr(), u1 = this.x.redMul(pz2), u2 = p.x.redMul(z2), s1 = this.y.redMul(pz2.redMul(p.z)), s2 = p.y.redMul(z2.redMul(this.z)), h = u1.redSub(u2), r = s1.redSub(s2);
                if (0 === h.cmpn(0)) return 0 !== r.cmpn(0) ? this.curve.jpoint(null, null, null) : this.dbl();
                var h2 = h.redSqr(), h3 = h2.redMul(h), v = u1.redMul(h2), nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v), ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)), nz = this.z.redMul(p.z).redMul(h);
                return this.curve.jpoint(nx, ny, nz);
            }, JPoint.prototype.mixedAdd = function(p) {
                if (this.isInfinity()) return p.toJ();
                if (p.isInfinity()) return this;
                var z2 = this.z.redSqr(), u1 = this.x, u2 = p.x.redMul(z2), s1 = this.y, s2 = p.y.redMul(z2).redMul(this.z), h = u1.redSub(u2), r = s1.redSub(s2);
                if (0 === h.cmpn(0)) return 0 !== r.cmpn(0) ? this.curve.jpoint(null, null, null) : this.dbl();
                var h2 = h.redSqr(), h3 = h2.redMul(h), v = u1.redMul(h2), nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v), ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)), nz = this.z.redMul(h);
                return this.curve.jpoint(nx, ny, nz);
            }, JPoint.prototype.dblp = function(pow) {
                if (0 === pow) return this;
                if (this.isInfinity()) return this;
                if (!pow) return this.dbl();
                if (this.curve.zeroA || this.curve.threeA) {
                    for (var r = this, i = 0; i < pow; i++) r = r.dbl();
                    return r;
                }
                var a = this.curve.a, tinv = this.curve.tinv, jx = this.x, jy = this.y, jz = this.z, jz4 = jz.redSqr().redSqr(), jyd = jy.redAdd(jy);
                for (i = 0; i < pow; i++) {
                    var jx2 = jx.redSqr(), jyd2 = jyd.redSqr(), jyd4 = jyd2.redSqr(), c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)), t1 = jx.redMul(jyd2), nx = c.redSqr().redISub(t1.redAdd(t1)), t2 = t1.redISub(nx), dny = c.redMul(t2);
                    dny = dny.redIAdd(dny).redISub(jyd4);
                    var nz = jyd.redMul(jz);
                    i + 1 < pow && (jz4 = jz4.redMul(jyd4)), jx = nx, jz = nz, jyd = dny;
                }
                return this.curve.jpoint(jx, jyd.redMul(tinv), jz);
            }, JPoint.prototype.dbl = function() {
                return this.isInfinity() ? this : this.curve.zeroA ? this._zeroDbl() : this.curve.threeA ? this._threeDbl() : this._dbl();
            }, JPoint.prototype._zeroDbl = function() {
                var nx, ny, nz;
                if (this.zOne) {
                    var xx = this.x.redSqr(), yy = this.y.redSqr(), yyyy = yy.redSqr(), s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
                    s = s.redIAdd(s);
                    var m = xx.redAdd(xx).redIAdd(xx), t = m.redSqr().redISub(s).redISub(s), yyyy8 = yyyy.redIAdd(yyyy);
                    yyyy8 = (yyyy8 = yyyy8.redIAdd(yyyy8)).redIAdd(yyyy8), nx = t, ny = m.redMul(s.redISub(t)).redISub(yyyy8), 
                    nz = this.y.redAdd(this.y);
                } else {
                    var a = this.x.redSqr(), b = this.y.redSqr(), c = b.redSqr(), d = this.x.redAdd(b).redSqr().redISub(a).redISub(c);
                    d = d.redIAdd(d);
                    var e = a.redAdd(a).redIAdd(a), f = e.redSqr(), c8 = c.redIAdd(c);
                    c8 = (c8 = c8.redIAdd(c8)).redIAdd(c8), nx = f.redISub(d).redISub(d), ny = e.redMul(d.redISub(nx)).redISub(c8), 
                    nz = (nz = this.y.redMul(this.z)).redIAdd(nz);
                }
                return this.curve.jpoint(nx, ny, nz);
            }, JPoint.prototype._threeDbl = function() {
                var nx, ny, nz;
                if (this.zOne) {
                    var xx = this.x.redSqr(), yy = this.y.redSqr(), yyyy = yy.redSqr(), s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy);
                    s = s.redIAdd(s);
                    var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a), t = m.redSqr().redISub(s).redISub(s);
                    nx = t;
                    var yyyy8 = yyyy.redIAdd(yyyy);
                    yyyy8 = (yyyy8 = yyyy8.redIAdd(yyyy8)).redIAdd(yyyy8), ny = m.redMul(s.redISub(t)).redISub(yyyy8), 
                    nz = this.y.redAdd(this.y);
                } else {
                    var delta = this.z.redSqr(), gamma = this.y.redSqr(), beta = this.x.redMul(gamma), alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta));
                    alpha = alpha.redAdd(alpha).redIAdd(alpha);
                    var beta4 = beta.redIAdd(beta), beta8 = (beta4 = beta4.redIAdd(beta4)).redAdd(beta4);
                    nx = alpha.redSqr().redISub(beta8), nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta);
                    var ggamma8 = gamma.redSqr();
                    ggamma8 = (ggamma8 = (ggamma8 = ggamma8.redIAdd(ggamma8)).redIAdd(ggamma8)).redIAdd(ggamma8), 
                    ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8);
                }
                return this.curve.jpoint(nx, ny, nz);
            }, JPoint.prototype._dbl = function() {
                var a = this.curve.a, jx = this.x, jy = this.y, jz = this.z, jz4 = jz.redSqr().redSqr(), jx2 = jx.redSqr(), jy2 = jy.redSqr(), c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)), jxd4 = jx.redAdd(jx), t1 = (jxd4 = jxd4.redIAdd(jxd4)).redMul(jy2), nx = c.redSqr().redISub(t1.redAdd(t1)), t2 = t1.redISub(nx), jyd8 = jy2.redSqr();
                jyd8 = (jyd8 = (jyd8 = jyd8.redIAdd(jyd8)).redIAdd(jyd8)).redIAdd(jyd8);
                var ny = c.redMul(t2).redISub(jyd8), nz = jy.redAdd(jy).redMul(jz);
                return this.curve.jpoint(nx, ny, nz);
            }, JPoint.prototype.trpl = function() {
                if (!this.curve.zeroA) return this.dbl().add(this);
                var xx = this.x.redSqr(), yy = this.y.redSqr(), zz = this.z.redSqr(), yyyy = yy.redSqr(), m = xx.redAdd(xx).redIAdd(xx), mm = m.redSqr(), e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy), ee = (e = (e = (e = e.redIAdd(e)).redAdd(e).redIAdd(e)).redISub(mm)).redSqr(), t = yyyy.redIAdd(yyyy);
                t = (t = (t = t.redIAdd(t)).redIAdd(t)).redIAdd(t);
                var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t), yyu4 = yy.redMul(u);
                yyu4 = (yyu4 = yyu4.redIAdd(yyu4)).redIAdd(yyu4);
                var nx = this.x.redMul(ee).redISub(yyu4);
                nx = (nx = nx.redIAdd(nx)).redIAdd(nx);
                var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee)));
                ny = (ny = (ny = ny.redIAdd(ny)).redIAdd(ny)).redIAdd(ny);
                var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee);
                return this.curve.jpoint(nx, ny, nz);
            }, JPoint.prototype.mul = function(k, kbase) {
                return k = new BN(k, kbase), this.curve._wnafMul(this, k);
            }, JPoint.prototype.eq = function(p) {
                if ("affine" === p.type) return this.eq(p.toJ());
                if (this === p) return !0;
                var z2 = this.z.redSqr(), pz2 = p.z.redSqr();
                if (0 !== this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0)) return !1;
                var z3 = z2.redMul(this.z), pz3 = pz2.redMul(p.z);
                return 0 === this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0);
            }, JPoint.prototype.eqXToP = function(x) {
                var zs = this.z.redSqr(), rx = x.toRed(this.curve.red).redMul(zs);
                if (0 === this.x.cmp(rx)) return !0;
                for (var xc = x.clone(), t = this.curve.redN.redMul(zs); ;) {
                    if (xc.iadd(this.curve.n), 0 <= xc.cmp(this.curve.p)) return !1;
                    if (rx.redIAdd(t), 0 === this.x.cmp(rx)) return !0;
                }
                return !1;
            }, JPoint.prototype.inspect = function() {
                return this.isInfinity() ? "<EC JPoint Infinity>" : "<EC JPoint x: " + this.x.toString(16, 2) + " y: " + this.y.toString(16, 2) + " z: " + this.z.toString(16, 2) + ">";
            }, JPoint.prototype.isInfinity = function() {
                return 0 === this.z.cmpn(0);
            };
        }, {
            "../../elliptic": 119,
            "../curve": 122,
            "bn.js": 42,
            inherits: 152
        } ],
        125: [ function(require, module, exports) {
            "use strict";
            var pre, curves = exports, hash = require("hash.js"), elliptic = require("../elliptic"), assert = elliptic.utils.assert;
            function PresetCurve(options) {
                "short" === options.type ? this.curve = new elliptic.curve.short(options) : "edwards" === options.type ? this.curve = new elliptic.curve.edwards(options) : this.curve = new elliptic.curve.mont(options), 
                this.g = this.curve.g, this.n = this.curve.n, this.hash = options.hash, assert(this.g.validate(), "Invalid curve"), 
                assert(this.g.mul(this.n).isInfinity(), "Invalid curve, G*N != O");
            }
            function defineCurve(name, options) {
                Object.defineProperty(curves, name, {
                    configurable: !0,
                    enumerable: !0,
                    get: function() {
                        var curve = new PresetCurve(options);
                        return Object.defineProperty(curves, name, {
                            configurable: !0,
                            enumerable: !0,
                            value: curve
                        }), curve;
                    }
                });
            }
            curves.PresetCurve = PresetCurve, defineCurve("p192", {
                type: "short",
                prime: "p192",
                p: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",
                a: "ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",
                b: "64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",
                n: "ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",
                hash: hash.sha256,
                gRed: !1,
                g: [ "188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012", "07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811" ]
            }), defineCurve("p224", {
                type: "short",
                prime: "p224",
                p: "ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",
                a: "ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",
                b: "b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",
                n: "ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",
                hash: hash.sha256,
                gRed: !1,
                g: [ "b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21", "bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34" ]
            }), defineCurve("p256", {
                type: "short",
                prime: null,
                p: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",
                a: "ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",
                b: "5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",
                n: "ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",
                hash: hash.sha256,
                gRed: !1,
                g: [ "6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296", "4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5" ]
            }), defineCurve("p384", {
                type: "short",
                prime: null,
                p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",
                a: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",
                b: "b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",
                n: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",
                hash: hash.sha384,
                gRed: !1,
                g: [ "aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7", "3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f" ]
            }), defineCurve("p521", {
                type: "short",
                prime: null,
                p: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",
                a: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",
                b: "00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",
                n: "000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",
                hash: hash.sha512,
                gRed: !1,
                g: [ "000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66", "00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650" ]
            }), defineCurve("curve25519", {
                type: "mont",
                prime: "p25519",
                p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",
                a: "76d06",
                b: "1",
                n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",
                hash: hash.sha256,
                gRed: !1,
                g: [ "9" ]
            }), defineCurve("ed25519", {
                type: "edwards",
                prime: "p25519",
                p: "7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",
                a: "-1",
                c: "1",
                d: "52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",
                n: "1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",
                hash: hash.sha256,
                gRed: !1,
                g: [ "216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a", "6666666666666666666666666666666666666666666666666666666666666658" ]
            });
            try {
                pre = require("./precomputed/secp256k1");
            } catch (e) {
                pre = void 0;
            }
            defineCurve("secp256k1", {
                type: "short",
                prime: "k256",
                p: "ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",
                a: "0",
                b: "7",
                n: "ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",
                h: "1",
                hash: hash.sha256,
                beta: "7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",
                lambda: "5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",
                basis: [ {
                    a: "3086d221a7d46bcde86c90e49284eb15",
                    b: "-e4437ed6010e88286f547fa90abfe4c3"
                }, {
                    a: "114ca50f7a8e2f3f657c1108d9d44cfd8",
                    b: "3086d221a7d46bcde86c90e49284eb15"
                } ],
                gRed: !1,
                g: [ "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798", "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8", pre ]
            });
        }, {
            "../elliptic": 119,
            "./precomputed/secp256k1": 132,
            "hash.js": 137
        } ],
        126: [ function(require, module, exports) {
            "use strict";
            var BN = require("bn.js"), HmacDRBG = require("hmac-drbg"), elliptic = require("../../elliptic"), assert = elliptic.utils.assert, KeyPair = require("./key"), Signature = require("./signature");
            function EC(options) {
                if (!(this instanceof EC)) return new EC(options);
                "string" == typeof options && (assert(elliptic.curves.hasOwnProperty(options), "Unknown curve " + options), 
                options = elliptic.curves[options]), options instanceof elliptic.curves.PresetCurve && (options = {
                    curve: options
                }), this.curve = options.curve.curve, this.n = this.curve.n, this.nh = this.n.ushrn(1), 
                this.g = this.curve.g, this.g = options.curve.g, this.g.precompute(options.curve.n.bitLength() + 1), 
                this.hash = options.hash || options.curve.hash;
            }
            (module.exports = EC).prototype.keyPair = function(options) {
                return new KeyPair(this, options);
            }, EC.prototype.keyFromPrivate = function(priv, enc) {
                return KeyPair.fromPrivate(this, priv, enc);
            }, EC.prototype.keyFromPublic = function(pub, enc) {
                return KeyPair.fromPublic(this, pub, enc);
            }, EC.prototype.genKeyPair = function(options) {
                options || (options = {});
                for (var drbg = new HmacDRBG({
                    hash: this.hash,
                    pers: options.pers,
                    persEnc: options.persEnc || "utf8",
                    entropy: options.entropy || elliptic.rand(this.hash.hmacStrength),
                    entropyEnc: options.entropy && options.entropyEnc || "utf8",
                    nonce: this.n.toArray()
                }), bytes = this.n.byteLength(), ns2 = this.n.sub(new BN(2)); ;) {
                    var priv = new BN(drbg.generate(bytes));
                    if (!(0 < priv.cmp(ns2))) return priv.iaddn(1), this.keyFromPrivate(priv);
                }
            }, EC.prototype._truncateToN = function(msg, truncOnly) {
                var delta = 8 * msg.byteLength() - this.n.bitLength();
                return 0 < delta && (msg = msg.ushrn(delta)), !truncOnly && 0 <= msg.cmp(this.n) ? msg.sub(this.n) : msg;
            }, EC.prototype.sign = function(msg, key, enc, options) {
                "object" == typeof enc && (options = enc, enc = null), options || (options = {}), 
                key = this.keyFromPrivate(key, enc), msg = this._truncateToN(new BN(msg, 16));
                for (var bytes = this.n.byteLength(), bkey = key.getPrivate().toArray("be", bytes), nonce = msg.toArray("be", bytes), drbg = new HmacDRBG({
                    hash: this.hash,
                    entropy: bkey,
                    nonce: nonce,
                    pers: options.pers,
                    persEnc: options.persEnc || "utf8"
                }), ns1 = this.n.sub(new BN(1)), iter = 0; ;iter++) {
                    var k = options.k ? options.k(iter) : new BN(drbg.generate(this.n.byteLength()));
                    if (!((k = this._truncateToN(k, !0)).cmpn(1) <= 0 || 0 <= k.cmp(ns1))) {
                        var kp = this.g.mul(k);
                        if (!kp.isInfinity()) {
                            var kpX = kp.getX(), r = kpX.umod(this.n);
                            if (0 !== r.cmpn(0)) {
                                var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg));
                                if (0 !== (s = s.umod(this.n)).cmpn(0)) {
                                    var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | (0 !== kpX.cmp(r) ? 2 : 0);
                                    return options.canonical && 0 < s.cmp(this.nh) && (s = this.n.sub(s), recoveryParam ^= 1), 
                                    new Signature({
                                        r: r,
                                        s: s,
                                        recoveryParam: recoveryParam
                                    });
                                }
                            }
                        }
                    }
                }
            }, EC.prototype.verify = function(msg, signature, key, enc) {
                msg = this._truncateToN(new BN(msg, 16)), key = this.keyFromPublic(key, enc);
                var r = (signature = new Signature(signature, "hex")).r, s = signature.s;
                if (r.cmpn(1) < 0 || 0 <= r.cmp(this.n)) return !1;
                if (s.cmpn(1) < 0 || 0 <= s.cmp(this.n)) return !1;
                var p, sinv = s.invm(this.n), u1 = sinv.mul(msg).umod(this.n), u2 = sinv.mul(r).umod(this.n);
                return this.curve._maxwellTrick ? !(p = this.g.jmulAdd(u1, key.getPublic(), u2)).isInfinity() && p.eqXToP(r) : !(p = this.g.mulAdd(u1, key.getPublic(), u2)).isInfinity() && 0 === p.getX().umod(this.n).cmp(r);
            }, EC.prototype.recoverPubKey = function(msg, signature, j, enc) {
                assert((3 & j) === j, "The recovery param is more than two bits"), signature = new Signature(signature, enc);
                var n = this.n, e = new BN(msg), r = signature.r, s = signature.s, isYOdd = 1 & j, isSecondKey = j >> 1;
                if (0 <= r.cmp(this.curve.p.umod(this.curve.n)) && isSecondKey) throw new Error("Unable to find sencond key candinate");
                r = isSecondKey ? this.curve.pointFromX(r.add(this.curve.n), isYOdd) : this.curve.pointFromX(r, isYOdd);
                var rInv = signature.r.invm(n), s1 = n.sub(e).mul(rInv).umod(n), s2 = s.mul(rInv).umod(n);
                return this.g.mulAdd(s1, r, s2);
            }, EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) {
                if (null !== (signature = new Signature(signature, enc)).recoveryParam) return signature.recoveryParam;
                for (var i = 0; i < 4; i++) {
                    var Qprime;
                    try {
                        Qprime = this.recoverPubKey(e, signature, i);
                    } catch (e) {
                        continue;
                    }
                    if (Qprime.eq(Q)) return i;
                }
                throw new Error("Unable to find valid recovery factor");
            };
        }, {
            "../../elliptic": 119,
            "./key": 127,
            "./signature": 128,
            "bn.js": 42,
            "hmac-drbg": 149
        } ],
        127: [ function(require, module, exports) {
            "use strict";
            var BN = require("bn.js"), assert = require("../../elliptic").utils.assert;
            function KeyPair(ec, options) {
                this.ec = ec, this.priv = null, this.pub = null, options.priv && this._importPrivate(options.priv, options.privEnc), 
                options.pub && this._importPublic(options.pub, options.pubEnc);
            }
            (module.exports = KeyPair).fromPublic = function(ec, pub, enc) {
                return pub instanceof KeyPair ? pub : new KeyPair(ec, {
                    pub: pub,
                    pubEnc: enc
                });
            }, KeyPair.fromPrivate = function(ec, priv, enc) {
                return priv instanceof KeyPair ? priv : new KeyPair(ec, {
                    priv: priv,
                    privEnc: enc
                });
            }, KeyPair.prototype.validate = function() {
                var pub = this.getPublic();
                return pub.isInfinity() ? {
                    result: !1,
                    reason: "Invalid public key"
                } : pub.validate() ? pub.mul(this.ec.curve.n).isInfinity() ? {
                    result: !0,
                    reason: null
                } : {
                    result: !1,
                    reason: "Public key * N != O"
                } : {
                    result: !1,
                    reason: "Public key is not a point"
                };
            }, KeyPair.prototype.getPublic = function(compact, enc) {
                return "string" == typeof compact && (enc = compact, compact = null), this.pub || (this.pub = this.ec.g.mul(this.priv)), 
                enc ? this.pub.encode(enc, compact) : this.pub;
            }, KeyPair.prototype.getPrivate = function(enc) {
                return "hex" === enc ? this.priv.toString(16, 2) : this.priv;
            }, KeyPair.prototype._importPrivate = function(key, enc) {
                this.priv = new BN(key, enc || 16), this.priv = this.priv.umod(this.ec.curve.n);
            }, KeyPair.prototype._importPublic = function(key, enc) {
                if (key.x || key.y) return "mont" === this.ec.curve.type ? assert(key.x, "Need x coordinate") : "short" !== this.ec.curve.type && "edwards" !== this.ec.curve.type || assert(key.x && key.y, "Need both x and y coordinate"), 
                void (this.pub = this.ec.curve.point(key.x, key.y));
                this.pub = this.ec.curve.decodePoint(key, enc);
            }, KeyPair.prototype.derive = function(pub) {
                return pub.mul(this.priv).getX();
            }, KeyPair.prototype.sign = function(msg, enc, options) {
                return this.ec.sign(msg, this, enc, options);
            }, KeyPair.prototype.verify = function(msg, signature) {
                return this.ec.verify(msg, signature, this);
            }, KeyPair.prototype.inspect = function() {
                return "<Key priv: " + (this.priv && this.priv.toString(16, 2)) + " pub: " + (this.pub && this.pub.inspect()) + " >";
            };
        }, {
            "../../elliptic": 119,
            "bn.js": 42
        } ],
        128: [ function(require, module, exports) {
            "use strict";
            var BN = require("bn.js"), utils = require("../../elliptic").utils, assert = utils.assert;
            function Signature(options, enc) {
                if (options instanceof Signature) return options;
                this._importDER(options, enc) || (assert(options.r && options.s, "Signature without r or s"), 
                this.r = new BN(options.r, 16), this.s = new BN(options.s, 16), void 0 === options.recoveryParam ? this.recoveryParam = null : this.recoveryParam = options.recoveryParam);
            }
            function Position() {
                this.place = 0;
            }
            function getLength(buf, p) {
                var initial = buf[p.place++];
                if (!(128 & initial)) return initial;
                for (var octetLen = 15 & initial, val = 0, i = 0, off = p.place; i < octetLen; i++, 
                off++) val <<= 8, val |= buf[off];
                return p.place = off, val;
            }
            function rmPadding(buf) {
                for (var i = 0, len = buf.length - 1; !buf[i] && !(128 & buf[i + 1]) && i < len; ) i++;
                return 0 === i ? buf : buf.slice(i);
            }
            function constructLength(arr, len) {
                if (len < 128) arr.push(len); else {
                    var octets = 1 + (Math.log(len) / Math.LN2 >>> 3);
                    for (arr.push(128 | octets); --octets; ) arr.push(len >>> (octets << 3) & 255);
                    arr.push(len);
                }
            }
            (module.exports = Signature).prototype._importDER = function(data, enc) {
                data = utils.toArray(data, enc);
                var p = new Position();
                if (48 !== data[p.place++]) return !1;
                if (getLength(data, p) + p.place !== data.length) return !1;
                if (2 !== data[p.place++]) return !1;
                var rlen = getLength(data, p), r = data.slice(p.place, rlen + p.place);
                if (p.place += rlen, 2 !== data[p.place++]) return !1;
                var slen = getLength(data, p);
                if (data.length !== slen + p.place) return !1;
                var s = data.slice(p.place, slen + p.place);
                return 0 === r[0] && 128 & r[1] && (r = r.slice(1)), 0 === s[0] && 128 & s[1] && (s = s.slice(1)), 
                this.r = new BN(r), this.s = new BN(s), !(this.recoveryParam = null);
            }, Signature.prototype.toDER = function(enc) {
                var r = this.r.toArray(), s = this.s.toArray();
                for (128 & r[0] && (r = [ 0 ].concat(r)), 128 & s[0] && (s = [ 0 ].concat(s)), r = rmPadding(r), 
                s = rmPadding(s); !(s[0] || 128 & s[1]); ) s = s.slice(1);
                var arr = [ 2 ];
                constructLength(arr, r.length), (arr = arr.concat(r)).push(2), constructLength(arr, s.length);
                var backHalf = arr.concat(s), res = [ 48 ];
                return constructLength(res, backHalf.length), res = res.concat(backHalf), utils.encode(res, enc);
            };
        }, {
            "../../elliptic": 119,
            "bn.js": 42
        } ],
        129: [ function(require, module, exports) {
            "use strict";
            var hash = require("hash.js"), elliptic = require("../../elliptic"), utils = elliptic.utils, assert = utils.assert, parseBytes = utils.parseBytes, KeyPair = require("./key"), Signature = require("./signature");
            function EDDSA(curve) {
                if (assert("ed25519" === curve, "only tested with ed25519 so far"), !(this instanceof EDDSA)) return new EDDSA(curve);
                curve = elliptic.curves[curve].curve;
                this.curve = curve, this.g = curve.g, this.g.precompute(curve.n.bitLength() + 1), 
                this.pointClass = curve.point().constructor, this.encodingLength = Math.ceil(curve.n.bitLength() / 8), 
                this.hash = hash.sha512;
            }
            (module.exports = EDDSA).prototype.sign = function(message, secret) {
                message = parseBytes(message);
                var key = this.keyFromSecret(secret), r = this.hashInt(key.messagePrefix(), message), R = this.g.mul(r), Rencoded = this.encodePoint(R), s_ = this.hashInt(Rencoded, key.pubBytes(), message).mul(key.priv()), S = r.add(s_).umod(this.curve.n);
                return this.makeSignature({
                    R: R,
                    S: S,
                    Rencoded: Rencoded
                });
            }, EDDSA.prototype.verify = function(message, sig, pub) {
                message = parseBytes(message), sig = this.makeSignature(sig);
                var key = this.keyFromPublic(pub), h = this.hashInt(sig.Rencoded(), key.pubBytes(), message), SG = this.g.mul(sig.S());
                return sig.R().add(key.pub().mul(h)).eq(SG);
            }, EDDSA.prototype.hashInt = function() {
                for (var hash = this.hash(), i = 0; i < arguments.length; i++) hash.update(arguments[i]);
                return utils.intFromLE(hash.digest()).umod(this.curve.n);
            }, EDDSA.prototype.keyFromPublic = function(pub) {
                return KeyPair.fromPublic(this, pub);
            }, EDDSA.prototype.keyFromSecret = function(secret) {
                return KeyPair.fromSecret(this, secret);
            }, EDDSA.prototype.makeSignature = function(sig) {
                return sig instanceof Signature ? sig : new Signature(this, sig);
            }, EDDSA.prototype.encodePoint = function(point) {
                var enc = point.getY().toArray("le", this.encodingLength);
                return enc[this.encodingLength - 1] |= point.getX().isOdd() ? 128 : 0, enc;
            }, EDDSA.prototype.decodePoint = function(bytes) {
                var lastIx = (bytes = utils.parseBytes(bytes)).length - 1, normed = bytes.slice(0, lastIx).concat(-129 & bytes[lastIx]), xIsOdd = 0 != (128 & bytes[lastIx]), y = utils.intFromLE(normed);
                return this.curve.pointFromY(y, xIsOdd);
            }, EDDSA.prototype.encodeInt = function(num) {
                return num.toArray("le", this.encodingLength);
            }, EDDSA.prototype.decodeInt = function(bytes) {
                return utils.intFromLE(bytes);
            }, EDDSA.prototype.isPoint = function(val) {
                return val instanceof this.pointClass;
            };
        }, {
            "../../elliptic": 119,
            "./key": 130,
            "./signature": 131,
            "hash.js": 137
        } ],
        130: [ function(require, module, exports) {
            "use strict";
            var utils = require("../../elliptic").utils, assert = utils.assert, parseBytes = utils.parseBytes, cachedProperty = utils.cachedProperty;
            function KeyPair(eddsa, params) {
                this.eddsa = eddsa, this._secret = parseBytes(params.secret), eddsa.isPoint(params.pub) ? this._pub = params.pub : this._pubBytes = parseBytes(params.pub);
            }
            KeyPair.fromPublic = function(eddsa, pub) {
                return pub instanceof KeyPair ? pub : new KeyPair(eddsa, {
                    pub: pub
                });
            }, KeyPair.fromSecret = function(eddsa, secret) {
                return secret instanceof KeyPair ? secret : new KeyPair(eddsa, {
                    secret: secret
                });
            }, KeyPair.prototype.secret = function() {
                return this._secret;
            }, cachedProperty(KeyPair, "pubBytes", function() {
                return this.eddsa.encodePoint(this.pub());
            }), cachedProperty(KeyPair, "pub", function() {
                return this._pubBytes ? this.eddsa.decodePoint(this._pubBytes) : this.eddsa.g.mul(this.priv());
            }), cachedProperty(KeyPair, "privBytes", function() {
                var eddsa = this.eddsa, hash = this.hash(), lastIx = eddsa.encodingLength - 1, a = hash.slice(0, eddsa.encodingLength);
                return a[0] &= 248, a[lastIx] &= 127, a[lastIx] |= 64, a;
            }), cachedProperty(KeyPair, "priv", function() {
                return this.eddsa.decodeInt(this.privBytes());
            }), cachedProperty(KeyPair, "hash", function() {
                return this.eddsa.hash().update(this.secret()).digest();
            }), cachedProperty(KeyPair, "messagePrefix", function() {
                return this.hash().slice(this.eddsa.encodingLength);
            }), KeyPair.prototype.sign = function(message) {
                return assert(this._secret, "KeyPair can only verify"), this.eddsa.sign(message, this);
            }, KeyPair.prototype.verify = function(message, sig) {
                return this.eddsa.verify(message, sig, this);
            }, KeyPair.prototype.getSecret = function(enc) {
                return assert(this._secret, "KeyPair is public only"), utils.encode(this.secret(), enc);
            }, KeyPair.prototype.getPublic = function(enc) {
                return utils.encode(this.pubBytes(), enc);
            }, module.exports = KeyPair;
        }, {
            "../../elliptic": 119
        } ],
        131: [ function(require, module, exports) {
            "use strict";
            var BN = require("bn.js"), utils = require("../../elliptic").utils, assert = utils.assert, cachedProperty = utils.cachedProperty, parseBytes = utils.parseBytes;
            function Signature(eddsa, sig) {
                this.eddsa = eddsa, "object" != typeof sig && (sig = parseBytes(sig)), Array.isArray(sig) && (sig = {
                    R: sig.slice(0, eddsa.encodingLength),
                    S: sig.slice(eddsa.encodingLength)
                }), assert(sig.R && sig.S, "Signature without R or S"), eddsa.isPoint(sig.R) && (this._R = sig.R), 
                sig.S instanceof BN && (this._S = sig.S), this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded, 
                this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded;
            }
            cachedProperty(Signature, "S", function() {
                return this.eddsa.decodeInt(this.Sencoded());
            }), cachedProperty(Signature, "R", function() {
                return this.eddsa.decodePoint(this.Rencoded());
            }), cachedProperty(Signature, "Rencoded", function() {
                return this.eddsa.encodePoint(this.R());
            }), cachedProperty(Signature, "Sencoded", function() {
                return this.eddsa.encodeInt(this.S());
            }), Signature.prototype.toBytes = function() {
                return this.Rencoded().concat(this.Sencoded());
            }, Signature.prototype.toHex = function() {
                return utils.encode(this.toBytes(), "hex").toUpperCase();
            }, module.exports = Signature;
        }, {
            "../../elliptic": 119,
            "bn.js": 42
        } ],
        132: [ function(require, module, exports) {
            module.exports = {
                doubles: {
                    step: 4,
                    points: [ [ "e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a", "f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821" ], [ "8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508", "11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf" ], [ "175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739", "d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695" ], [ "363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640", "4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9" ], [ "8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c", "4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36" ], [ "723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda", "96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f" ], [ "eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa", "5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999" ], [ "100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0", "cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09" ], [ "e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d", "9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d" ], [ "feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d", "e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088" ], [ "da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1", "9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d" ], [ "53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0", "5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8" ], [ "8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047", "10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a" ], [ "385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862", "283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453" ], [ "6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7", "7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160" ], [ "3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd", "56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0" ], [ "85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83", "7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6" ], [ "948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a", "53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589" ], [ "6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8", "bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17" ], [ "e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d", "4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda" ], [ "e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725", "7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd" ], [ "213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754", "4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2" ], [ "4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c", "17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6" ], [ "fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6", "6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f" ], [ "76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39", "c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01" ], [ "c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891", "893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3" ], [ "d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b", "febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f" ], [ "b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03", "2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7" ], [ "e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d", "eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78" ], [ "a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070", "7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1" ], [ "90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4", "e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150" ], [ "8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da", "662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82" ], [ "e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11", "1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc" ], [ "8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e", "efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b" ], [ "e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41", "2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51" ], [ "b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef", "67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45" ], [ "d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8", "db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120" ], [ "324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d", "648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84" ], [ "4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96", "35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d" ], [ "9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd", "ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d" ], [ "6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5", "9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8" ], [ "a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266", "40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8" ], [ "7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71", "34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac" ], [ "928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac", "c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f" ], [ "85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751", "1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962" ], [ "ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e", "493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907" ], [ "827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241", "c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec" ], [ "eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3", "be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d" ], [ "e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f", "4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414" ], [ "1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19", "aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd" ], [ "146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be", "b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0" ], [ "fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9", "6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811" ], [ "da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2", "8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1" ], [ "a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13", "7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c" ], [ "174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c", "ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73" ], [ "959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba", "2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd" ], [ "d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151", "e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405" ], [ "64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073", "d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589" ], [ "8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458", "38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e" ], [ "13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b", "69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27" ], [ "bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366", "d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1" ], [ "8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa", "40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482" ], [ "8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0", "620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945" ], [ "dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787", "7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573" ], [ "f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e", "ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82" ] ]
                },
                naf: {
                    wnd: 7,
                    points: [ [ "f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9", "388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672" ], [ "2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4", "d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6" ], [ "5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc", "6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da" ], [ "acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe", "cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37" ], [ "774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb", "d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b" ], [ "f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8", "ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81" ], [ "d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e", "581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58" ], [ "defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34", "4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77" ], [ "2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c", "85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a" ], [ "352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5", "321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c" ], [ "2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f", "2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67" ], [ "9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714", "73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402" ], [ "daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729", "a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55" ], [ "c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db", "2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482" ], [ "6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4", "e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82" ], [ "1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5", "b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396" ], [ "605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479", "2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49" ], [ "62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d", "80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf" ], [ "80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f", "1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a" ], [ "7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb", "d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7" ], [ "d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9", "eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933" ], [ "49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963", "758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a" ], [ "77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74", "958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6" ], [ "f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530", "e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37" ], [ "463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b", "5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e" ], [ "f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247", "cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6" ], [ "caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1", "cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476" ], [ "2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120", "4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40" ], [ "7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435", "91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61" ], [ "754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18", "673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683" ], [ "e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8", "59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5" ], [ "186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb", "3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b" ], [ "df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f", "55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417" ], [ "5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143", "efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868" ], [ "290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba", "e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a" ], [ "af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45", "f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6" ], [ "766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a", "744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996" ], [ "59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e", "c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e" ], [ "f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8", "e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d" ], [ "7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c", "30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2" ], [ "948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519", "e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e" ], [ "7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab", "100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437" ], [ "3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca", "ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311" ], [ "d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf", "8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4" ], [ "1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610", "68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575" ], [ "733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4", "f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d" ], [ "15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c", "d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d" ], [ "a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940", "edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629" ], [ "e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980", "a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06" ], [ "311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3", "66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374" ], [ "34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf", "9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee" ], [ "f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63", "4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1" ], [ "d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448", "fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b" ], [ "32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf", "5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661" ], [ "7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5", "8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6" ], [ "ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6", "8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e" ], [ "16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5", "5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d" ], [ "eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99", "f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc" ], [ "78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51", "f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4" ], [ "494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5", "42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c" ], [ "a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5", "204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b" ], [ "c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997", "4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913" ], [ "841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881", "73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154" ], [ "5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5", "39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865" ], [ "36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66", "d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc" ], [ "336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726", "ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224" ], [ "8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede", "6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e" ], [ "1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94", "60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6" ], [ "85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31", "3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511" ], [ "29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51", "b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b" ], [ "a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252", "ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2" ], [ "4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5", "cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c" ], [ "d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b", "6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3" ], [ "ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4", "322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d" ], [ "af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f", "6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700" ], [ "e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889", "2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4" ], [ "591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246", "b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196" ], [ "11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984", "998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4" ], [ "3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a", "b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257" ], [ "cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030", "bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13" ], [ "c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197", "6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096" ], [ "c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593", "c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38" ], [ "a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef", "21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f" ], [ "347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38", "60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448" ], [ "da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a", "49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a" ], [ "c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111", "5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4" ], [ "4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502", "7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437" ], [ "3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea", "be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7" ], [ "cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26", "8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d" ], [ "b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986", "39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a" ], [ "d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e", "62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54" ], [ "48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4", "25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77" ], [ "dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda", "ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517" ], [ "6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859", "cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10" ], [ "e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f", "f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125" ], [ "eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c", "6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e" ], [ "13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942", "fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1" ], [ "ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a", "1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2" ], [ "b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80", "5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423" ], [ "ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d", "438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8" ], [ "8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1", "cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758" ], [ "52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63", "c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375" ], [ "e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352", "6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d" ], [ "7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193", "ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec" ], [ "5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00", "9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0" ], [ "32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58", "ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c" ], [ "e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7", "d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4" ], [ "8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8", "c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f" ], [ "4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e", "67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649" ], [ "3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d", "cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826" ], [ "674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b", "299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5" ], [ "d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f", "f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87" ], [ "30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6", "462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b" ], [ "be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297", "62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc" ], [ "93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a", "7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c" ], [ "b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c", "ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f" ], [ "d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52", "4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a" ], [ "d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb", "bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46" ], [ "463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065", "bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f" ], [ "7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917", "603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03" ], [ "74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9", "cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08" ], [ "30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3", "553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8" ], [ "9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57", "712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373" ], [ "176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66", "ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3" ], [ "75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8", "9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8" ], [ "809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721", "9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1" ], [ "1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180", "4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9" ] ]
                }
            };
        }, {} ],
        133: [ function(require, module, exports) {
            "use strict";
            var utils = exports, BN = require("bn.js"), minAssert = require("minimalistic-assert"), minUtils = require("minimalistic-crypto-utils");
            utils.assert = minAssert, utils.toArray = minUtils.toArray, utils.zero2 = minUtils.zero2, 
            utils.toHex = minUtils.toHex, utils.encode = minUtils.encode, utils.getNAF = function(num, w) {
                for (var naf = [], ws = 1 << w + 1, k = num.clone(); 0 <= k.cmpn(1); ) {
                    var z;
                    if (k.isOdd()) {
                        var mod = k.andln(ws - 1);
                        z = (ws >> 1) - 1 < mod ? (ws >> 1) - mod : mod, k.isubn(z);
                    } else z = 0;
                    naf.push(z);
                    for (var shift = 0 !== k.cmpn(0) && 0 === k.andln(ws - 1) ? w + 1 : 1, i = 1; i < shift; i++) naf.push(0);
                    k.iushrn(shift);
                }
                return naf;
            }, utils.getJSF = function(k1, k2) {
                var jsf = [ [], [] ];
                k1 = k1.clone(), k2 = k2.clone();
                for (var d1 = 0, d2 = 0; 0 < k1.cmpn(-d1) || 0 < k2.cmpn(-d2); ) {
                    var u1, u2, m8, m14 = k1.andln(3) + d1 & 3, m24 = k2.andln(3) + d2 & 3;
                    3 === m14 && (m14 = -1), 3 === m24 && (m24 = -1), u1 = 0 == (1 & m14) ? 0 : 3 != (m8 = k1.andln(7) + d1 & 7) && 5 !== m8 || 2 !== m24 ? m14 : -m14, 
                    jsf[0].push(u1), u2 = 0 == (1 & m24) ? 0 : 3 != (m8 = k2.andln(7) + d2 & 7) && 5 !== m8 || 2 !== m14 ? m24 : -m24, 
                    jsf[1].push(u2), 2 * d1 === u1 + 1 && (d1 = 1 - d1), 2 * d2 === u2 + 1 && (d2 = 1 - d2), 
                    k1.iushrn(1), k2.iushrn(1);
                }
                return jsf;
            }, utils.cachedProperty = function(obj, name, computer) {
                var key = "_" + name;
                obj.prototype[name] = function() {
                    return void 0 !== this[key] ? this[key] : this[key] = computer.call(this);
                };
            }, utils.parseBytes = function(bytes) {
                return "string" == typeof bytes ? utils.toArray(bytes, "hex") : bytes;
            }, utils.intFromLE = function(bytes) {
                return new BN(bytes, "hex", "le");
            };
        }, {
            "bn.js": 42,
            "minimalistic-assert": 195,
            "minimalistic-crypto-utils": 196
        } ],
        134: [ function(require, module, exports) {
            module.exports = {
                _args: [ [ "elliptic@6.4.0", "C:\\Users\\djohnson\\Code\\xlsx-populate" ] ],
                _development: !0,
                _from: "elliptic@6.4.0",
                _id: "elliptic@6.4.0",
                _inBundle: !1,
                _integrity: "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=",
                _location: "/elliptic",
                _phantomChildren: {},
                _requested: {
                    type: "version",
                    registry: !0,
                    raw: "elliptic@6.4.0",
                    name: "elliptic",
                    escapedName: "elliptic",
                    rawSpec: "6.4.0",
                    saveSpec: null,
                    fetchSpec: "6.4.0"
                },
                _requiredBy: [ "/browserify-sign", "/create-ecdh" ],
                _resolved: "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz",
                _spec: "6.4.0",
                _where: "C:\\Users\\djohnson\\Code\\xlsx-populate",
                author: {
                    name: "Fedor Indutny",
                    email: "fedor@indutny.com"
                },
                bugs: {
                    url: "https://github.com/indutny/elliptic/issues"
                },
                dependencies: {
                    "bn.js": "^4.4.0",
                    brorand: "^1.0.1",
                    "hash.js": "^1.0.0",
                    "hmac-drbg": "^1.0.0",
                    inherits: "^2.0.1",
                    "minimalistic-assert": "^1.0.0",
                    "minimalistic-crypto-utils": "^1.0.0"
                },
                description: "EC cryptography",
                devDependencies: {
                    brfs: "^1.4.3",
                    coveralls: "^2.11.3",
                    grunt: "^0.4.5",
                    "grunt-browserify": "^5.0.0",
                    "grunt-cli": "^1.2.0",
                    "grunt-contrib-connect": "^1.0.0",
                    "grunt-contrib-copy": "^1.0.0",
                    "grunt-contrib-uglify": "^1.0.1",
                    "grunt-mocha-istanbul": "^3.0.1",
                    "grunt-saucelabs": "^8.6.2",
                    istanbul: "^0.4.2",
                    jscs: "^2.9.0",
                    jshint: "^2.6.0",
                    mocha: "^2.1.0"
                },
                files: [ "lib" ],
                homepage: "https://github.com/indutny/elliptic",
                keywords: [ "EC", "Elliptic", "curve", "Cryptography" ],
                license: "MIT",
                main: "lib/elliptic.js",
                name: "elliptic",
                repository: {
                    type: "git",
                    url: "git+ssh://git@github.com/indutny/elliptic.git"
                },
                scripts: {
                    jscs: "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
                    jshint: "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",
                    lint: "npm run jscs && npm run jshint",
                    test: "npm run lint && npm run unit",
                    unit: "istanbul test _mocha --reporter=spec test/index.js",
                    version: "grunt dist && git add dist/"
                },
                version: "6.4.0"
            };
        }, {} ],
        135: [ function(require, module, exports) {
            var Buffer = require("safe-buffer").Buffer, MD5 = require("md5.js");
            module.exports = function(password, salt, keyBits, ivLen) {
                if (Buffer.isBuffer(password) || (password = Buffer.from(password, "binary")), salt && (Buffer.isBuffer(salt) || (salt = Buffer.from(salt, "binary")), 
                8 !== salt.length)) throw new RangeError("salt should be Buffer with 8 byte length");
                for (var keyLen = keyBits / 8, key = Buffer.alloc(keyLen), iv = Buffer.alloc(ivLen || 0), tmp = Buffer.alloc(0); 0 < keyLen || 0 < ivLen; ) {
                    var hash = new MD5();
                    hash.update(tmp), hash.update(password), salt && hash.update(salt), tmp = hash.digest();
                    var used = 0;
                    if (0 < keyLen) {
                        var keyStart = key.length - keyLen;
                        used = Math.min(keyLen, tmp.length), tmp.copy(key, keyStart, 0, used), keyLen -= used;
                    }
                    if (used < tmp.length && 0 < ivLen) {
                        var ivStart = iv.length - ivLen, length = Math.min(ivLen, tmp.length - used);
                        tmp.copy(iv, ivStart, used, used + length), ivLen -= length;
                    }
                }
                return tmp.fill(0), {
                    key: key,
                    iv: iv
                };
            };
        }, {
            "md5.js": 192,
            "safe-buffer": 244
        } ],
        136: [ function(require, module, exports) {
            (function(Buffer) {
                "use strict";
                var Transform = require("stream").Transform;
                function HashBase(blockSize) {
                    Transform.call(this), this._block = new Buffer(blockSize), this._blockSize = blockSize, 
                    this._blockOffset = 0, this._length = [ 0, 0, 0, 0 ], this._finalized = !1;
                }
                require("inherits")(HashBase, Transform), HashBase.prototype._transform = function(chunk, encoding, callback) {
                    var error = null;
                    try {
                        "buffer" !== encoding && (chunk = new Buffer(chunk, encoding)), this.update(chunk);
                    } catch (err) {
                        error = err;
                    }
                    callback(error);
                }, HashBase.prototype._flush = function(callback) {
                    var error = null;
                    try {
                        this.push(this._digest());
                    } catch (err) {
                        error = err;
                    }
                    callback(error);
                }, HashBase.prototype.update = function(data, encoding) {
                    if (!Buffer.isBuffer(data) && "string" != typeof data) throw new TypeError("Data must be a string or a buffer");
                    if (this._finalized) throw new Error("Digest already called");
                    Buffer.isBuffer(data) || (data = new Buffer(data, encoding || "binary"));
                    for (var block = this._block, offset = 0; this._blockOffset + data.length - offset >= this._blockSize; ) {
                        for (var i = this._blockOffset; i < this._blockSize; ) block[i++] = data[offset++];
                        this._update(), this._blockOffset = 0;
                    }
                    for (;offset < data.length; ) block[this._blockOffset++] = data[offset++];
                    for (var j = 0, carry = 8 * data.length; 0 < carry; ++j) this._length[j] += carry, 
                    0 < (carry = this._length[j] / 4294967296 | 0) && (this._length[j] -= 4294967296 * carry);
                    return this;
                }, HashBase.prototype._update = function(data) {
                    throw new Error("_update is not implemented");
                }, HashBase.prototype.digest = function(encoding) {
                    if (this._finalized) throw new Error("Digest already called");
                    this._finalized = !0;
                    var digest = this._digest();
                    return void 0 !== encoding && (digest = digest.toString(encoding)), digest;
                }, HashBase.prototype._digest = function() {
                    throw new Error("_digest is not implemented");
                }, module.exports = HashBase;
            }).call(this, require("buffer").Buffer);
        }, {
            buffer: 77,
            inherits: 152,
            stream: 254
        } ],
        137: [ function(require, module, exports) {
            var hash = exports;
            hash.utils = require("./hash/utils"), hash.common = require("./hash/common"), hash.sha = require("./hash/sha"), 
            hash.ripemd = require("./hash/ripemd"), hash.hmac = require("./hash/hmac"), hash.sha1 = hash.sha.sha1, 
            hash.sha256 = hash.sha.sha256, hash.sha224 = hash.sha.sha224, hash.sha384 = hash.sha.sha384, 
            hash.sha512 = hash.sha.sha512, hash.ripemd160 = hash.ripemd.ripemd160;
        }, {
            "./hash/common": 138,
            "./hash/hmac": 139,
            "./hash/ripemd": 140,
            "./hash/sha": 141,
            "./hash/utils": 148
        } ],
        138: [ function(require, module, exports) {
            "use strict";
            var utils = require("./utils"), assert = require("minimalistic-assert");
            function BlockHash() {
                this.pending = null, this.pendingTotal = 0, this.blockSize = this.constructor.blockSize, 
                this.outSize = this.constructor.outSize, this.hmacStrength = this.constructor.hmacStrength, 
                this.padLength = this.constructor.padLength / 8, this.endian = "big", this._delta8 = this.blockSize / 8, 
                this._delta32 = this.blockSize / 32;
            }
            (exports.BlockHash = BlockHash).prototype.update = function(msg, enc) {
                if (msg = utils.toArray(msg, enc), this.pending ? this.pending = this.pending.concat(msg) : this.pending = msg, 
                this.pendingTotal += msg.length, this.pending.length >= this._delta8) {
                    var r = (msg = this.pending).length % this._delta8;
                    this.pending = msg.slice(msg.length - r, msg.length), 0 === this.pending.length && (this.pending = null), 
                    msg = utils.join32(msg, 0, msg.length - r, this.endian);
                    for (var i = 0; i < msg.length; i += this._delta32) this._update(msg, i, i + this._delta32);
                }
                return this;
            }, BlockHash.prototype.digest = function(enc) {
                return this.update(this._pad()), assert(null === this.pending), this._digest(enc);
            }, BlockHash.prototype._pad = function() {
                var len = this.pendingTotal, bytes = this._delta8, k = bytes - (len + this.padLength) % bytes, res = new Array(k + this.padLength);
                res[0] = 128;
                for (var i = 1; i < k; i++) res[i] = 0;
                if (len <<= 3, "big" === this.endian) {
                    for (var t = 8; t < this.padLength; t++) res[i++] = 0;
                    res[i++] = 0, res[i++] = 0, res[i++] = 0, res[i++] = 0, res[i++] = len >>> 24 & 255, 
                    res[i++] = len >>> 16 & 255, res[i++] = len >>> 8 & 255, res[i++] = 255 & len;
                } else for (res[i++] = 255 & len, res[i++] = len >>> 8 & 255, res[i++] = len >>> 16 & 255, 
                res[i++] = len >>> 24 & 255, res[i++] = 0, res[i++] = 0, res[i++] = 0, res[i++] = 0, 
                t = 8; t < this.padLength; t++) res[i++] = 0;
                return res;
            };
        }, {
            "./utils": 148,
            "minimalistic-assert": 195
        } ],
        139: [ function(require, module, exports) {
            "use strict";
            var utils = require("./utils"), assert = require("minimalistic-assert");
            function Hmac(hash, key, enc) {
                if (!(this instanceof Hmac)) return new Hmac(hash, key, enc);
                this.Hash = hash, this.blockSize = hash.blockSize / 8, this.outSize = hash.outSize / 8, 
                this.inner = null, this.outer = null, this._init(utils.toArray(key, enc));
            }
            (module.exports = Hmac).prototype._init = function(key) {
                key.length > this.blockSize && (key = new this.Hash().update(key).digest()), assert(key.length <= this.blockSize);
                for (var i = key.length; i < this.blockSize; i++) key.push(0);
                for (i = 0; i < key.length; i++) key[i] ^= 54;
                for (this.inner = new this.Hash().update(key), i = 0; i < key.length; i++) key[i] ^= 106;
                this.outer = new this.Hash().update(key);
            }, Hmac.prototype.update = function(msg, enc) {
                return this.inner.update(msg, enc), this;
            }, Hmac.prototype.digest = function(enc) {
                return this.outer.update(this.inner.digest()), this.outer.digest(enc);
            };
        }, {
            "./utils": 148,
            "minimalistic-assert": 195
        } ],
        140: [ function(require, module, exports) {
            "use strict";
            var utils = require("./utils"), common = require("./common"), rotl32 = utils.rotl32, sum32 = utils.sum32, sum32_3 = utils.sum32_3, sum32_4 = utils.sum32_4, BlockHash = common.BlockHash;
            function RIPEMD160() {
                if (!(this instanceof RIPEMD160)) return new RIPEMD160();
                BlockHash.call(this), this.h = [ 1732584193, 4023233417, 2562383102, 271733878, 3285377520 ], 
                this.endian = "little";
            }
            function f(j, x, y, z) {
                return j <= 15 ? x ^ y ^ z : j <= 31 ? x & y | ~x & z : j <= 47 ? (x | ~y) ^ z : j <= 63 ? x & z | y & ~z : x ^ (y | ~z);
            }
            function K(j) {
                return j <= 15 ? 0 : j <= 31 ? 1518500249 : j <= 47 ? 1859775393 : j <= 63 ? 2400959708 : 2840853838;
            }
            function Kh(j) {
                return j <= 15 ? 1352829926 : j <= 31 ? 1548603684 : j <= 47 ? 1836072691 : j <= 63 ? 2053994217 : 0;
            }
            utils.inherits(RIPEMD160, BlockHash), (exports.ripemd160 = RIPEMD160).blockSize = 512, 
            RIPEMD160.outSize = 160, RIPEMD160.hmacStrength = 192, RIPEMD160.padLength = 64, 
            RIPEMD160.prototype._update = function(msg, start) {
                for (var A = this.h[0], B = this.h[1], C = this.h[2], D = this.h[3], E = this.h[4], Ah = A, Bh = B, Ch = C, Dh = D, Eh = E, j = 0; j < 80; j++) {
                    var T = sum32(rotl32(sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), s[j]), E);
                    A = E, E = D, D = rotl32(C, 10), C = B, B = T, T = sum32(rotl32(sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), sh[j]), Eh), 
                    Ah = Eh, Eh = Dh, Dh = rotl32(Ch, 10), Ch = Bh, Bh = T;
                }
                T = sum32_3(this.h[1], C, Dh), this.h[1] = sum32_3(this.h[2], D, Eh), this.h[2] = sum32_3(this.h[3], E, Ah), 
                this.h[3] = sum32_3(this.h[4], A, Bh), this.h[4] = sum32_3(this.h[0], B, Ch), this.h[0] = T;
            }, RIPEMD160.prototype._digest = function(enc) {
                return "hex" === enc ? utils.toHex32(this.h, "little") : utils.split32(this.h, "little");
            };
            var r = [ 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 ], rh = [ 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 ], s = [ 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 ], sh = [ 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 ];
        }, {
            "./common": 138,
            "./utils": 148
        } ],
        141: [ function(require, module, exports) {
            "use strict";
            exports.sha1 = require("./sha/1"), exports.sha224 = require("./sha/224"), exports.sha256 = require("./sha/256"), 
            exports.sha384 = require("./sha/384"), exports.sha512 = require("./sha/512");
        }, {
            "./sha/1": 142,
            "./sha/224": 143,
            "./sha/256": 144,
            "./sha/384": 145,
            "./sha/512": 146
        } ],
        142: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils"), common = require("../common"), shaCommon = require("./common"), rotl32 = utils.rotl32, sum32 = utils.sum32, sum32_5 = utils.sum32_5, ft_1 = shaCommon.ft_1, BlockHash = common.BlockHash, sha1_K = [ 1518500249, 1859775393, 2400959708, 3395469782 ];
            function SHA1() {
                if (!(this instanceof SHA1)) return new SHA1();
                BlockHash.call(this), this.h = [ 1732584193, 4023233417, 2562383102, 271733878, 3285377520 ], 
                this.W = new Array(80);
            }
            utils.inherits(SHA1, BlockHash), (module.exports = SHA1).blockSize = 512, SHA1.outSize = 160, 
            SHA1.hmacStrength = 80, SHA1.padLength = 64, SHA1.prototype._update = function(msg, start) {
                for (var W = this.W, i = 0; i < 16; i++) W[i] = msg[start + i];
                for (;i < W.length; i++) W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
                var a = this.h[0], b = this.h[1], c = this.h[2], d = this.h[3], e = this.h[4];
                for (i = 0; i < W.length; i++) {
                    var s = ~~(i / 20), t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]);
                    e = d, d = c, c = rotl32(b, 30), b = a, a = t;
                }
                this.h[0] = sum32(this.h[0], a), this.h[1] = sum32(this.h[1], b), this.h[2] = sum32(this.h[2], c), 
                this.h[3] = sum32(this.h[3], d), this.h[4] = sum32(this.h[4], e);
            }, SHA1.prototype._digest = function(enc) {
                return "hex" === enc ? utils.toHex32(this.h, "big") : utils.split32(this.h, "big");
            };
        }, {
            "../common": 138,
            "../utils": 148,
            "./common": 147
        } ],
        143: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils"), SHA256 = require("./256");
            function SHA224() {
                if (!(this instanceof SHA224)) return new SHA224();
                SHA256.call(this), this.h = [ 3238371032, 914150663, 812702999, 4144912697, 4290775857, 1750603025, 1694076839, 3204075428 ];
            }
            utils.inherits(SHA224, SHA256), (module.exports = SHA224).blockSize = 512, SHA224.outSize = 224, 
            SHA224.hmacStrength = 192, SHA224.padLength = 64, SHA224.prototype._digest = function(enc) {
                return "hex" === enc ? utils.toHex32(this.h.slice(0, 7), "big") : utils.split32(this.h.slice(0, 7), "big");
            };
        }, {
            "../utils": 148,
            "./256": 144
        } ],
        144: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils"), common = require("../common"), shaCommon = require("./common"), assert = require("minimalistic-assert"), sum32 = utils.sum32, sum32_4 = utils.sum32_4, sum32_5 = utils.sum32_5, ch32 = shaCommon.ch32, maj32 = shaCommon.maj32, s0_256 = shaCommon.s0_256, s1_256 = shaCommon.s1_256, g0_256 = shaCommon.g0_256, g1_256 = shaCommon.g1_256, BlockHash = common.BlockHash, sha256_K = [ 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298 ];
            function SHA256() {
                if (!(this instanceof SHA256)) return new SHA256();
                BlockHash.call(this), this.h = [ 1779033703, 3144134277, 1013904242, 2773480762, 1359893119, 2600822924, 528734635, 1541459225 ], 
                this.k = sha256_K, this.W = new Array(64);
            }
            utils.inherits(SHA256, BlockHash), (module.exports = SHA256).blockSize = 512, SHA256.outSize = 256, 
            SHA256.hmacStrength = 192, SHA256.padLength = 64, SHA256.prototype._update = function(msg, start) {
                for (var W = this.W, i = 0; i < 16; i++) W[i] = msg[start + i];
                for (;i < W.length; i++) W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);
                var a = this.h[0], b = this.h[1], c = this.h[2], d = this.h[3], e = this.h[4], f = this.h[5], g = this.h[6], h = this.h[7];
                for (assert(this.k.length === W.length), i = 0; i < W.length; i++) {
                    var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]), T2 = sum32(s0_256(a), maj32(a, b, c));
                    h = g, g = f, f = e, e = sum32(d, T1), d = c, c = b, b = a, a = sum32(T1, T2);
                }
                this.h[0] = sum32(this.h[0], a), this.h[1] = sum32(this.h[1], b), this.h[2] = sum32(this.h[2], c), 
                this.h[3] = sum32(this.h[3], d), this.h[4] = sum32(this.h[4], e), this.h[5] = sum32(this.h[5], f), 
                this.h[6] = sum32(this.h[6], g), this.h[7] = sum32(this.h[7], h);
            }, SHA256.prototype._digest = function(enc) {
                return "hex" === enc ? utils.toHex32(this.h, "big") : utils.split32(this.h, "big");
            };
        }, {
            "../common": 138,
            "../utils": 148,
            "./common": 147,
            "minimalistic-assert": 195
        } ],
        145: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils"), SHA512 = require("./512");
            function SHA384() {
                if (!(this instanceof SHA384)) return new SHA384();
                SHA512.call(this), this.h = [ 3418070365, 3238371032, 1654270250, 914150663, 2438529370, 812702999, 355462360, 4144912697, 1731405415, 4290775857, 2394180231, 1750603025, 3675008525, 1694076839, 1203062813, 3204075428 ];
            }
            utils.inherits(SHA384, SHA512), (module.exports = SHA384).blockSize = 1024, SHA384.outSize = 384, 
            SHA384.hmacStrength = 192, SHA384.padLength = 128, SHA384.prototype._digest = function(enc) {
                return "hex" === enc ? utils.toHex32(this.h.slice(0, 12), "big") : utils.split32(this.h.slice(0, 12), "big");
            };
        }, {
            "../utils": 148,
            "./512": 146
        } ],
        146: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils"), common = require("../common"), assert = require("minimalistic-assert"), rotr64_hi = utils.rotr64_hi, rotr64_lo = utils.rotr64_lo, shr64_hi = utils.shr64_hi, shr64_lo = utils.shr64_lo, sum64 = utils.sum64, sum64_hi = utils.sum64_hi, sum64_lo = utils.sum64_lo, sum64_4_hi = utils.sum64_4_hi, sum64_4_lo = utils.sum64_4_lo, sum64_5_hi = utils.sum64_5_hi, sum64_5_lo = utils.sum64_5_lo, BlockHash = common.BlockHash, sha512_K = [ 1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394, 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139, 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879, 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964, 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344, 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403, 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573, 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315, 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, 1607167915, 987167468, 1816402316, 1246189591 ];
            function SHA512() {
                if (!(this instanceof SHA512)) return new SHA512();
                BlockHash.call(this), this.h = [ 1779033703, 4089235720, 3144134277, 2227873595, 1013904242, 4271175723, 2773480762, 1595750129, 1359893119, 2917565137, 2600822924, 725511199, 528734635, 4215389547, 1541459225, 327033209 ], 
                this.k = sha512_K, this.W = new Array(160);
            }
            function ch64_hi(xh, xl, yh, yl, zh) {
                var r = xh & yh ^ ~xh & zh;
                return r < 0 && (r += 4294967296), r;
            }
            function ch64_lo(xh, xl, yh, yl, zh, zl) {
                var r = xl & yl ^ ~xl & zl;
                return r < 0 && (r += 4294967296), r;
            }
            function maj64_hi(xh, xl, yh, yl, zh) {
                var r = xh & yh ^ xh & zh ^ yh & zh;
                return r < 0 && (r += 4294967296), r;
            }
            function maj64_lo(xh, xl, yh, yl, zh, zl) {
                var r = xl & yl ^ xl & zl ^ yl & zl;
                return r < 0 && (r += 4294967296), r;
            }
            function s0_512_hi(xh, xl) {
                var r = rotr64_hi(xh, xl, 28) ^ rotr64_hi(xl, xh, 2) ^ rotr64_hi(xl, xh, 7);
                return r < 0 && (r += 4294967296), r;
            }
            function s0_512_lo(xh, xl) {
                var r = rotr64_lo(xh, xl, 28) ^ rotr64_lo(xl, xh, 2) ^ rotr64_lo(xl, xh, 7);
                return r < 0 && (r += 4294967296), r;
            }
            function s1_512_hi(xh, xl) {
                var r = rotr64_hi(xh, xl, 14) ^ rotr64_hi(xh, xl, 18) ^ rotr64_hi(xl, xh, 9);
                return r < 0 && (r += 4294967296), r;
            }
            function s1_512_lo(xh, xl) {
                var r = rotr64_lo(xh, xl, 14) ^ rotr64_lo(xh, xl, 18) ^ rotr64_lo(xl, xh, 9);
                return r < 0 && (r += 4294967296), r;
            }
            function g0_512_hi(xh, xl) {
                var r = rotr64_hi(xh, xl, 1) ^ rotr64_hi(xh, xl, 8) ^ shr64_hi(xh, xl, 7);
                return r < 0 && (r += 4294967296), r;
            }
            function g0_512_lo(xh, xl) {
                var r = rotr64_lo(xh, xl, 1) ^ rotr64_lo(xh, xl, 8) ^ shr64_lo(xh, xl, 7);
                return r < 0 && (r += 4294967296), r;
            }
            function g1_512_hi(xh, xl) {
                var r = rotr64_hi(xh, xl, 19) ^ rotr64_hi(xl, xh, 29) ^ shr64_hi(xh, xl, 6);
                return r < 0 && (r += 4294967296), r;
            }
            function g1_512_lo(xh, xl) {
                var r = rotr64_lo(xh, xl, 19) ^ rotr64_lo(xl, xh, 29) ^ shr64_lo(xh, xl, 6);
                return r < 0 && (r += 4294967296), r;
            }
            utils.inherits(SHA512, BlockHash), (module.exports = SHA512).blockSize = 1024, SHA512.outSize = 512, 
            SHA512.hmacStrength = 192, SHA512.padLength = 128, SHA512.prototype._prepareBlock = function(msg, start) {
                for (var W = this.W, i = 0; i < 32; i++) W[i] = msg[start + i];
                for (;i < W.length; i += 2) {
                    var c0_hi = g1_512_hi(W[i - 4], W[i - 3]), c0_lo = g1_512_lo(W[i - 4], W[i - 3]), c1_hi = W[i - 14], c1_lo = W[i - 13], c2_hi = g0_512_hi(W[i - 30], W[i - 29]), c2_lo = g0_512_lo(W[i - 30], W[i - 29]), c3_hi = W[i - 32], c3_lo = W[i - 31];
                    W[i] = sum64_4_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo), W[i + 1] = sum64_4_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo);
                }
            }, SHA512.prototype._update = function(msg, start) {
                this._prepareBlock(msg, start);
                var W = this.W, ah = this.h[0], al = this.h[1], bh = this.h[2], bl = this.h[3], ch = this.h[4], cl = this.h[5], dh = this.h[6], dl = this.h[7], eh = this.h[8], el = this.h[9], fh = this.h[10], fl = this.h[11], gh = this.h[12], gl = this.h[13], hh = this.h[14], hl = this.h[15];
                assert(this.k.length === W.length);
                for (var i = 0; i < W.length; i += 2) {
                    var c0_hi = hh, c0_lo = hl, c1_hi = s1_512_hi(eh, el), c1_lo = s1_512_lo(eh, el), c2_hi = ch64_hi(eh, el, fh, fl, gh), c2_lo = ch64_lo(eh, el, fh, fl, gh, gl), c3_hi = this.k[i], c3_lo = this.k[i + 1], c4_hi = W[i], c4_lo = W[i + 1], T1_hi = sum64_5_hi(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo), T1_lo = sum64_5_lo(c0_hi, c0_lo, c1_hi, c1_lo, c2_hi, c2_lo, c3_hi, c3_lo, c4_hi, c4_lo);
                    c0_hi = s0_512_hi(ah, al), c0_lo = s0_512_lo(ah, al), c1_hi = maj64_hi(ah, al, bh, bl, ch), 
                    c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);
                    var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo), T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);
                    hh = gh, hl = gl, gh = fh, gl = fl, fh = eh, fl = el, eh = sum64_hi(dh, dl, T1_hi, T1_lo), 
                    el = sum64_lo(dl, dl, T1_hi, T1_lo), dh = ch, dl = cl, ch = bh, cl = bl, bh = ah, 
                    bl = al, ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo), al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);
                }
                sum64(this.h, 0, ah, al), sum64(this.h, 2, bh, bl), sum64(this.h, 4, ch, cl), sum64(this.h, 6, dh, dl), 
                sum64(this.h, 8, eh, el), sum64(this.h, 10, fh, fl), sum64(this.h, 12, gh, gl), 
                sum64(this.h, 14, hh, hl);
            }, SHA512.prototype._digest = function(enc) {
                return "hex" === enc ? utils.toHex32(this.h, "big") : utils.split32(this.h, "big");
            };
        }, {
            "../common": 138,
            "../utils": 148,
            "minimalistic-assert": 195
        } ],
        147: [ function(require, module, exports) {
            "use strict";
            var rotr32 = require("../utils").rotr32;
            function ch32(x, y, z) {
                return x & y ^ ~x & z;
            }
            function maj32(x, y, z) {
                return x & y ^ x & z ^ y & z;
            }
            function p32(x, y, z) {
                return x ^ y ^ z;
            }
            exports.ft_1 = function(s, x, y, z) {
                return 0 === s ? ch32(x, y, z) : 1 === s || 3 === s ? p32(x, y, z) : 2 === s ? maj32(x, y, z) : void 0;
            }, exports.ch32 = ch32, exports.maj32 = maj32, exports.p32 = p32, exports.s0_256 = function(x) {
                return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);
            }, exports.s1_256 = function(x) {
                return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);
            }, exports.g0_256 = function(x) {
                return rotr32(x, 7) ^ rotr32(x, 18) ^ x >>> 3;
            }, exports.g1_256 = function(x) {
                return rotr32(x, 17) ^ rotr32(x, 19) ^ x >>> 10;
            };
        }, {
            "../utils": 148
        } ],
        148: [ function(require, module, exports) {
            "use strict";
            var assert = require("minimalistic-assert"), inherits = require("inherits");
            function htonl(w) {
                return (w >>> 24 | w >>> 8 & 65280 | w << 8 & 16711680 | (255 & w) << 24) >>> 0;
            }
            function zero2(word) {
                return 1 === word.length ? "0" + word : word;
            }
            function zero8(word) {
                return 7 === word.length ? "0" + word : 6 === word.length ? "00" + word : 5 === word.length ? "000" + word : 4 === word.length ? "0000" + word : 3 === word.length ? "00000" + word : 2 === word.length ? "000000" + word : 1 === word.length ? "0000000" + word : word;
            }
            exports.inherits = inherits, exports.toArray = function(msg, enc) {
                if (Array.isArray(msg)) return msg.slice();
                if (!msg) return [];
                var res = [];
                if ("string" == typeof msg) if (enc) {
                    if ("hex" === enc) for ((msg = msg.replace(/[^a-z0-9]+/gi, "")).length % 2 != 0 && (msg = "0" + msg), 
                    i = 0; i < msg.length; i += 2) res.push(parseInt(msg[i] + msg[i + 1], 16));
                } else for (var i = 0; i < msg.length; i++) {
                    var c = msg.charCodeAt(i), hi = c >> 8, lo = 255 & c;
                    hi ? res.push(hi, lo) : res.push(lo);
                } else for (i = 0; i < msg.length; i++) res[i] = 0 | msg[i];
                return res;
            }, exports.toHex = function(msg) {
                for (var res = "", i = 0; i < msg.length; i++) res += zero2(msg[i].toString(16));
                return res;
            }, exports.htonl = htonl, exports.toHex32 = function(msg, endian) {
                for (var res = "", i = 0; i < msg.length; i++) {
                    var w = msg[i];
                    "little" === endian && (w = htonl(w)), res += zero8(w.toString(16));
                }
                return res;
            }, exports.zero2 = zero2, exports.zero8 = zero8, exports.join32 = function(msg, start, end, endian) {
                var len = end - start;
                assert(len % 4 == 0);
                for (var res = new Array(len / 4), i = 0, k = start; i < res.length; i++, k += 4) {
                    var w;
                    w = "big" === endian ? msg[k] << 24 | msg[k + 1] << 16 | msg[k + 2] << 8 | msg[k + 3] : msg[k + 3] << 24 | msg[k + 2] << 16 | msg[k + 1] << 8 | msg[k], 
                    res[i] = w >>> 0;
                }
                return res;
            }, exports.split32 = function(msg, endian) {
                for (var res = new Array(4 * msg.length), i = 0, k = 0; i < msg.length; i++, k += 4) {
                    var m = msg[i];
                    "big" === endian ? (res[k] = m >>> 24, res[k + 1] = m >>> 16 & 255, res[k + 2] = m >>> 8 & 255, 
                    res[k + 3] = 255 & m) : (res[k + 3] = m >>> 24, res[k + 2] = m >>> 16 & 255, res[k + 1] = m >>> 8 & 255, 
                    res[k] = 255 & m);
                }
                return res;
            }, exports.rotr32 = function(w, b) {
                return w >>> b | w << 32 - b;
            }, exports.rotl32 = function(w, b) {
                return w << b | w >>> 32 - b;
            }, exports.sum32 = function(a, b) {
                return a + b >>> 0;
            }, exports.sum32_3 = function(a, b, c) {
                return a + b + c >>> 0;
            }, exports.sum32_4 = function(a, b, c, d) {
                return a + b + c + d >>> 0;
            }, exports.sum32_5 = function(a, b, c, d, e) {
                return a + b + c + d + e >>> 0;
            }, exports.sum64 = function(buf, pos, ah, al) {
                var bh = buf[pos], lo = al + buf[pos + 1] >>> 0, hi = (lo < al ? 1 : 0) + ah + bh;
                buf[pos] = hi >>> 0, buf[pos + 1] = lo;
            }, exports.sum64_hi = function(ah, al, bh, bl) {
                return (al + bl >>> 0 < al ? 1 : 0) + ah + bh >>> 0;
            }, exports.sum64_lo = function(ah, al, bh, bl) {
                return al + bl >>> 0;
            }, exports.sum64_4_hi = function(ah, al, bh, bl, ch, cl, dh, dl) {
                var carry = 0, lo = al;
                return carry += (lo = lo + bl >>> 0) < al ? 1 : 0, carry += (lo = lo + cl >>> 0) < cl ? 1 : 0, 
                ah + bh + ch + dh + (carry += (lo = lo + dl >>> 0) < dl ? 1 : 0) >>> 0;
            }, exports.sum64_4_lo = function(ah, al, bh, bl, ch, cl, dh, dl) {
                return al + bl + cl + dl >>> 0;
            }, exports.sum64_5_hi = function(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
                var carry = 0, lo = al;
                return carry += (lo = lo + bl >>> 0) < al ? 1 : 0, carry += (lo = lo + cl >>> 0) < cl ? 1 : 0, 
                carry += (lo = lo + dl >>> 0) < dl ? 1 : 0, ah + bh + ch + dh + eh + (carry += (lo = lo + el >>> 0) < el ? 1 : 0) >>> 0;
            }, exports.sum64_5_lo = function(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {
                return al + bl + cl + dl + el >>> 0;
            }, exports.rotr64_hi = function(ah, al, num) {
                return (al << 32 - num | ah >>> num) >>> 0;
            }, exports.rotr64_lo = function(ah, al, num) {
                return (ah << 32 - num | al >>> num) >>> 0;
            }, exports.shr64_hi = function(ah, al, num) {
                return ah >>> num;
            }, exports.shr64_lo = function(ah, al, num) {
                return (ah << 32 - num | al >>> num) >>> 0;
            };
        }, {
            inherits: 152,
            "minimalistic-assert": 195
        } ],
        149: [ function(require, module, exports) {
            "use strict";
            var hash = require("hash.js"), utils = require("minimalistic-crypto-utils"), assert = require("minimalistic-assert");
            function HmacDRBG(options) {
                if (!(this instanceof HmacDRBG)) return new HmacDRBG(options);
                this.hash = options.hash, this.predResist = !!options.predResist, this.outLen = this.hash.outSize, 
                this.minEntropy = options.minEntropy || this.hash.hmacStrength, this._reseed = null, 
                this.reseedInterval = null, this.K = null, this.V = null;
                var entropy = utils.toArray(options.entropy, options.entropyEnc || "hex"), nonce = utils.toArray(options.nonce, options.nonceEnc || "hex"), pers = utils.toArray(options.pers, options.persEnc || "hex");
                assert(entropy.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits"), 
                this._init(entropy, nonce, pers);
            }
            (module.exports = HmacDRBG).prototype._init = function(entropy, nonce, pers) {
                var seed = entropy.concat(nonce).concat(pers);
                this.K = new Array(this.outLen / 8), this.V = new Array(this.outLen / 8);
                for (var i = 0; i < this.V.length; i++) this.K[i] = 0, this.V[i] = 1;
                this._update(seed), this._reseed = 1, this.reseedInterval = 281474976710656;
            }, HmacDRBG.prototype._hmac = function() {
                return new hash.hmac(this.hash, this.K);
            }, HmacDRBG.prototype._update = function(seed) {
                var kmac = this._hmac().update(this.V).update([ 0 ]);
                seed && (kmac = kmac.update(seed)), this.K = kmac.digest(), this.V = this._hmac().update(this.V).digest(), 
                seed && (this.K = this._hmac().update(this.V).update([ 1 ]).update(seed).digest(), 
                this.V = this._hmac().update(this.V).digest());
            }, HmacDRBG.prototype.reseed = function(entropy, entropyEnc, add, addEnc) {
                "string" != typeof entropyEnc && (addEnc = add, add = entropyEnc, entropyEnc = null), 
                entropy = utils.toArray(entropy, entropyEnc), add = utils.toArray(add, addEnc), 
                assert(entropy.length >= this.minEntropy / 8, "Not enough entropy. Minimum is: " + this.minEntropy + " bits"), 
                this._update(entropy.concat(add || [])), this._reseed = 1;
            }, HmacDRBG.prototype.generate = function(len, enc, add, addEnc) {
                if (this._reseed > this.reseedInterval) throw new Error("Reseed is required");
                "string" != typeof enc && (addEnc = add, add = enc, enc = null), add && (add = utils.toArray(add, addEnc || "hex"), 
                this._update(add));
                for (var temp = []; temp.length < len; ) this.V = this._hmac().update(this.V).digest(), 
                temp = temp.concat(this.V);
                var res = temp.slice(0, len);
                return this._update(add), this._reseed++, utils.encode(res, enc);
            };
        }, {
            "hash.js": 137,
            "minimalistic-assert": 195,
            "minimalistic-crypto-utils": 196
        } ],
        150: [ function(require, module, exports) {
            exports.read = function(buffer, offset, isLE, mLen, nBytes) {
                var e, m, eLen = 8 * nBytes - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, nBits = -7, i = isLE ? nBytes - 1 : 0, d = isLE ? -1 : 1, s = buffer[offset + i];
                for (i += d, e = s & (1 << -nBits) - 1, s >>= -nBits, nBits += eLen; 0 < nBits; e = 256 * e + buffer[offset + i], 
                i += d, nBits -= 8) ;
                for (m = e & (1 << -nBits) - 1, e >>= -nBits, nBits += mLen; 0 < nBits; m = 256 * m + buffer[offset + i], 
                i += d, nBits -= 8) ;
                if (0 === e) e = 1 - eBias; else {
                    if (e === eMax) return m ? NaN : 1 / 0 * (s ? -1 : 1);
                    m += Math.pow(2, mLen), 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 = 8 * nBytes - mLen - 1, eMax = (1 << eLen) - 1, eBias = eMax >> 1, rt = 23 === mLen ? Math.pow(2, -24) - Math.pow(2, -77) : 0, i = isLE ? 0 : nBytes - 1, d = isLE ? 1 : -1, s = value < 0 || 0 === value && 1 / value < 0 ? 1 : 0;
                for (value = Math.abs(value), isNaN(value) || value === 1 / 0 ? (m = isNaN(value) ? 1 : 0, 
                e = eMax) : (e = Math.floor(Math.log(value) / Math.LN2), value * (c = Math.pow(2, -e)) < 1 && (e--, 
                c *= 2), 2 <= (value += 1 <= e + eBias ? rt / c : rt * Math.pow(2, 1 - eBias)) * c && (e++, 
                c /= 2), eMax <= e + eBias ? (m = 0, e = eMax) : 1 <= e + eBias ? (m = (value * c - 1) * Math.pow(2, mLen), 
                e += eBias) : (m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen), e = 0)); 8 <= mLen; buffer[offset + i] = 255 & m, 
                i += d, m /= 256, mLen -= 8) ;
                for (e = e << mLen | m, eLen += mLen; 0 < eLen; buffer[offset + i] = 255 & e, i += d, 
                e /= 256, eLen -= 8) ;
                buffer[offset + i - d] |= 128 * s;
            };
        }, {} ],
        151: [ function(require, module, exports) {
            (function(global) {
                "use strict";
                var scheduleDrain, draining, Mutation = global.MutationObserver || global.WebKitMutationObserver;
                if (Mutation) {
                    var called = 0, observer = new Mutation(nextTick), element = global.document.createTextNode("");
                    observer.observe(element, {
                        characterData: !0
                    }), scheduleDrain = function() {
                        element.data = called = ++called % 2;
                    };
                } else if (global.setImmediate || void 0 === global.MessageChannel) scheduleDrain = "document" in global && "onreadystatechange" in global.document.createElement("script") ? function() {
                    var scriptEl = global.document.createElement("script");
                    scriptEl.onreadystatechange = function() {
                        nextTick(), scriptEl.onreadystatechange = null, scriptEl.parentNode.removeChild(scriptEl), 
                        scriptEl = null;
                    }, global.document.documentElement.appendChild(scriptEl);
                } : function() {
                    setTimeout(nextTick, 0);
                }; else {
                    var channel = new global.MessageChannel();
                    channel.port1.onmessage = nextTick, scheduleDrain = function() {
                        channel.port2.postMessage(0);
                    };
                }
                var queue = [];
                function nextTick() {
                    var i, oldQueue;
                    draining = !0;
                    for (var len = queue.length; len; ) {
                        for (oldQueue = queue, queue = [], i = -1; ++i < len; ) oldQueue[i]();
                        len = queue.length;
                    }
                    draining = !1;
                }
                module.exports = function(task) {
                    1 !== queue.push(task) || draining || scheduleDrain();
                };
            }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
        }, {} ],
        152: [ function(require, module, exports) {
            "function" == typeof Object.create ? module.exports = function(ctor, superCtor) {
                ctor.super_ = superCtor, ctor.prototype = Object.create(superCtor.prototype, {
                    constructor: {
                        value: ctor,
                        enumerable: !1,
                        writable: !0,
                        configurable: !0
                    }
                });
            } : module.exports = function(ctor, superCtor) {
                ctor.super_ = superCtor;
                var TempCtor = function() {};
                TempCtor.prototype = superCtor.prototype, ctor.prototype = new TempCtor(), ctor.prototype.constructor = ctor;
            };
        }, {} ],
        153: [ function(require, module, exports) {
            function isBuffer(obj) {
                return !!obj.constructor && "function" == typeof obj.constructor.isBuffer && obj.constructor.isBuffer(obj);
            }
            module.exports = function(obj) {
                return null != obj && (isBuffer(obj) || function(obj) {
                    return "function" == typeof obj.readFloatLE && "function" == typeof obj.slice && isBuffer(obj.slice(0, 0));
                }(obj) || !!obj._isBuffer);
            };
        }, {} ],
        154: [ function(require, module, exports) {
            var toString = {}.toString;
            module.exports = Array.isArray || function(arr) {
                return "[object Array]" == toString.call(arr);
            };
        }, {} ],
        155: [ function(require, module, exports) {
            "use strict";
            var utils = require("./utils"), support = require("./support"), _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
            exports.encode = function(input) {
                for (var chr1, chr2, chr3, enc1, enc2, enc3, enc4, output = [], i = 0, len = input.length, remainingBytes = len, isArray = "string" !== utils.getTypeOf(input); i < input.length; ) remainingBytes = len - i, 
                isArray ? (chr1 = input[i++], chr2 = i < len ? input[i++] : 0, chr3 = i < len ? input[i++] : 0) : (chr1 = input.charCodeAt(i++), 
                chr2 = i < len ? input.charCodeAt(i++) : 0, chr3 = i < len ? input.charCodeAt(i++) : 0), 
                enc1 = chr1 >> 2, enc2 = (3 & chr1) << 4 | chr2 >> 4, enc3 = 1 < remainingBytes ? (15 & chr2) << 2 | chr3 >> 6 : 64, 
                enc4 = 2 < remainingBytes ? 63 & chr3 : 64, output.push(_keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4));
                return output.join("");
            }, exports.decode = function(input) {
                var chr1, chr2, chr3, enc2, enc3, enc4, i = 0, resultIndex = 0;
                if ("data:" === input.substr(0, "data:".length)) throw new Error("Invalid base64 input, it looks like a data url.");
                var output, totalLength = 3 * (input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "")).length / 4;
                if (input.charAt(input.length - 1) === _keyStr.charAt(64) && totalLength--, input.charAt(input.length - 2) === _keyStr.charAt(64) && totalLength--, 
                totalLength % 1 != 0) throw new Error("Invalid base64 input, bad content length.");
                for (output = support.uint8array ? new Uint8Array(0 | totalLength) : new Array(0 | totalLength); i < input.length; ) chr1 = _keyStr.indexOf(input.charAt(i++)) << 2 | (enc2 = _keyStr.indexOf(input.charAt(i++))) >> 4, 
                chr2 = (15 & enc2) << 4 | (enc3 = _keyStr.indexOf(input.charAt(i++))) >> 2, chr3 = (3 & enc3) << 6 | (enc4 = _keyStr.indexOf(input.charAt(i++))), 
                output[resultIndex++] = chr1, 64 !== enc3 && (output[resultIndex++] = chr2), 64 !== enc4 && (output[resultIndex++] = chr3);
                return output;
            };
        }, {
            "./support": 184,
            "./utils": 186
        } ],
        156: [ function(require, module, exports) {
            "use strict";
            var external = require("./external"), DataWorker = require("./stream/DataWorker"), DataLengthProbe = require("./stream/DataLengthProbe"), Crc32Probe = require("./stream/Crc32Probe");
            DataLengthProbe = require("./stream/DataLengthProbe");
            function CompressedObject(compressedSize, uncompressedSize, crc32, compression, data) {
                this.compressedSize = compressedSize, this.uncompressedSize = uncompressedSize, 
                this.crc32 = crc32, this.compression = compression, this.compressedContent = data;
            }
            CompressedObject.prototype = {
                getContentWorker: function() {
                    var worker = new DataWorker(external.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new DataLengthProbe("data_length")), that = this;
                    return worker.on("end", function() {
                        if (this.streamInfo.data_length !== that.uncompressedSize) throw new Error("Bug : uncompressed data size mismatch");
                    }), worker;
                },
                getCompressedWorker: function() {
                    return new DataWorker(external.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize", this.compressedSize).withStreamInfo("uncompressedSize", this.uncompressedSize).withStreamInfo("crc32", this.crc32).withStreamInfo("compression", this.compression);
                }
            }, CompressedObject.createWorkerFrom = function(uncompressedWorker, compression, compressionOptions) {
                return uncompressedWorker.pipe(new Crc32Probe()).pipe(new DataLengthProbe("uncompressedSize")).pipe(compression.compressWorker(compressionOptions)).pipe(new DataLengthProbe("compressedSize")).withStreamInfo("compression", compression);
            }, module.exports = CompressedObject;
        }, {
            "./external": 160,
            "./stream/Crc32Probe": 179,
            "./stream/DataLengthProbe": 180,
            "./stream/DataWorker": 181
        } ],
        157: [ function(require, module, exports) {
            "use strict";
            var GenericWorker = require("./stream/GenericWorker");
            exports.STORE = {
                magic: "\0\0",
                compressWorker: function(compressionOptions) {
                    return new GenericWorker("STORE compression");
                },
                uncompressWorker: function() {
                    return new GenericWorker("STORE decompression");
                }
            }, exports.DEFLATE = require("./flate");
        }, {
            "./flate": 161,
            "./stream/GenericWorker": 182
        } ],
        158: [ function(require, module, exports) {
            "use strict";
            var utils = require("./utils");
            var crcTable = function() {
                for (var c, table = [], n = 0; n < 256; n++) {
                    c = n;
                    for (var k = 0; k < 8; k++) c = 1 & c ? 3988292384 ^ c >>> 1 : c >>> 1;
                    table[n] = c;
                }
                return table;
            }();
            module.exports = function(input, crc) {
                return void 0 !== input && input.length ? "string" !== utils.getTypeOf(input) ? function(crc, buf, len, pos) {
                    var t = crcTable, end = pos + len;
                    crc ^= -1;
                    for (var i = pos; i < end; i++) crc = crc >>> 8 ^ t[255 & (crc ^ buf[i])];
                    return -1 ^ crc;
                }(0 | crc, input, input.length, 0) : function(crc, str, len, pos) {
                    var t = crcTable, end = pos + len;
                    crc ^= -1;
                    for (var i = pos; i < end; i++) crc = crc >>> 8 ^ t[255 & (crc ^ str.charCodeAt(i))];
                    return -1 ^ crc;
                }(0 | crc, input, input.length, 0) : 0;
            };
        }, {
            "./utils": 186
        } ],
        159: [ function(require, module, exports) {
            "use strict";
            exports.base64 = !1, exports.binary = !1, exports.dir = !1, exports.createFolders = !0, 
            exports.date = null, exports.compression = null, exports.compressionOptions = null, 
            exports.comment = null, exports.unixPermissions = null, exports.dosPermissions = null;
        }, {} ],
        160: [ function(require, module, exports) {
            "use strict";
            var ES6Promise = null;
            ES6Promise = "undefined" != typeof Promise ? Promise : require("lie"), module.exports = {
                Promise: ES6Promise
            };
        }, {
            lie: 190
        } ],
        161: [ function(require, module, exports) {
            "use strict";
            var USE_TYPEDARRAY = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Uint32Array, pako = require("pako"), utils = require("./utils"), GenericWorker = require("./stream/GenericWorker"), ARRAY_TYPE = USE_TYPEDARRAY ? "uint8array" : "array";
            function FlateWorker(action, options) {
                GenericWorker.call(this, "FlateWorker/" + action), this._pako = null, this._pakoAction = action, 
                this._pakoOptions = options, this.meta = {};
            }
            exports.magic = "\b\0", utils.inherits(FlateWorker, GenericWorker), FlateWorker.prototype.processChunk = function(chunk) {
                this.meta = chunk.meta, null === this._pako && this._createPako(), this._pako.push(utils.transformTo(ARRAY_TYPE, chunk.data), !1);
            }, FlateWorker.prototype.flush = function() {
                GenericWorker.prototype.flush.call(this), null === this._pako && this._createPako(), 
                this._pako.push([], !0);
            }, FlateWorker.prototype.cleanUp = function() {
                GenericWorker.prototype.cleanUp.call(this), this._pako = null;
            }, FlateWorker.prototype._createPako = function() {
                this._pako = new pako[this._pakoAction]({
                    raw: !0,
                    level: this._pakoOptions.level || -1
                });
                var self = this;
                this._pako.onData = function(data) {
                    self.push({
                        data: data,
                        meta: self.meta
                    });
                };
            }, exports.compressWorker = function(compressionOptions) {
                return new FlateWorker("Deflate", compressionOptions);
            }, exports.uncompressWorker = function() {
                return new FlateWorker("Inflate", {});
            };
        }, {
            "./stream/GenericWorker": 182,
            "./utils": 186,
            pako: 197
        } ],
        162: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils"), GenericWorker = require("../stream/GenericWorker"), utf8 = require("../utf8"), crc32 = require("../crc32"), signature = require("../signature"), decToHex = function(dec, bytes) {
                var i, hex = "";
                for (i = 0; i < bytes; i++) hex += String.fromCharCode(255 & dec), dec >>>= 8;
                return hex;
            }, generateZipParts = function(streamInfo, streamedContent, streamingEnded, offset, platform, encodeFileName) {
                var dosTime, dosDate, file = streamInfo.file, compression = streamInfo.compression, useCustomEncoding = encodeFileName !== utf8.utf8encode, encodedFileName = utils.transformTo("string", encodeFileName(file.name)), utfEncodedFileName = utils.transformTo("string", utf8.utf8encode(file.name)), comment = file.comment, encodedComment = utils.transformTo("string", encodeFileName(comment)), utfEncodedComment = utils.transformTo("string", utf8.utf8encode(comment)), useUTF8ForFileName = utfEncodedFileName.length !== file.name.length, useUTF8ForComment = utfEncodedComment.length !== comment.length, extraFields = "", unicodePathExtraField = "", unicodeCommentExtraField = "", dir = file.dir, date = file.date, dataInfo = {
                    crc32: 0,
                    compressedSize: 0,
                    uncompressedSize: 0
                };
                streamedContent && !streamingEnded || (dataInfo.crc32 = streamInfo.crc32, dataInfo.compressedSize = streamInfo.compressedSize, 
                dataInfo.uncompressedSize = streamInfo.uncompressedSize);
                var bitflag = 0;
                streamedContent && (bitflag |= 8), useCustomEncoding || !useUTF8ForFileName && !useUTF8ForComment || (bitflag |= 2048);
                var unixPermissions, isDir, result, extFileAttr = 0, versionMadeBy = 0;
                dir && (extFileAttr |= 16), "UNIX" === platform ? (versionMadeBy = 798, extFileAttr |= (unixPermissions = file.unixPermissions, 
                isDir = dir, (result = unixPermissions) || (result = isDir ? 16893 : 33204), (65535 & result) << 16)) : (versionMadeBy = 20, 
                extFileAttr |= 63 & (file.dosPermissions || 0)), dosTime = date.getUTCHours(), dosTime <<= 6, 
                dosTime |= date.getUTCMinutes(), dosTime <<= 5, dosTime |= date.getUTCSeconds() / 2, 
                dosDate = date.getUTCFullYear() - 1980, dosDate <<= 4, dosDate |= date.getUTCMonth() + 1, 
                dosDate <<= 5, dosDate |= date.getUTCDate(), useUTF8ForFileName && (unicodePathExtraField = decToHex(1, 1) + decToHex(crc32(encodedFileName), 4) + utfEncodedFileName, 
                extraFields += "up" + decToHex(unicodePathExtraField.length, 2) + unicodePathExtraField), 
                useUTF8ForComment && (unicodeCommentExtraField = decToHex(1, 1) + decToHex(crc32(encodedComment), 4) + utfEncodedComment, 
                extraFields += "uc" + decToHex(unicodeCommentExtraField.length, 2) + unicodeCommentExtraField);
                var header = "";
                return header += "\n\0", header += decToHex(bitflag, 2), header += compression.magic, 
                header += decToHex(dosTime, 2), header += decToHex(dosDate, 2), header += decToHex(dataInfo.crc32, 4), 
                header += decToHex(dataInfo.compressedSize, 4), header += decToHex(dataInfo.uncompressedSize, 4), 
                header += decToHex(encodedFileName.length, 2), header += decToHex(extraFields.length, 2), 
                {
                    fileRecord: signature.LOCAL_FILE_HEADER + header + encodedFileName + extraFields,
                    dirRecord: signature.CENTRAL_FILE_HEADER + decToHex(versionMadeBy, 2) + header + decToHex(encodedComment.length, 2) + "\0\0\0\0" + decToHex(extFileAttr, 4) + decToHex(offset, 4) + encodedFileName + extraFields + encodedComment
                };
            };
            function ZipFileWorker(streamFiles, comment, platform, encodeFileName) {
                GenericWorker.call(this, "ZipFileWorker"), this.bytesWritten = 0, this.zipComment = comment, 
                this.zipPlatform = platform, this.encodeFileName = encodeFileName, this.streamFiles = streamFiles, 
                this.accumulate = !1, this.contentBuffer = [], this.dirRecords = [], this.currentSourceOffset = 0, 
                this.entriesCount = 0, this.currentFile = null, this._sources = [];
            }
            utils.inherits(ZipFileWorker, GenericWorker), ZipFileWorker.prototype.push = function(chunk) {
                var currentFilePercent = chunk.meta.percent || 0, entriesCount = this.entriesCount, remainingFiles = this._sources.length;
                this.accumulate ? this.contentBuffer.push(chunk) : (this.bytesWritten += chunk.data.length, 
                GenericWorker.prototype.push.call(this, {
                    data: chunk.data,
                    meta: {
                        currentFile: this.currentFile,
                        percent: entriesCount ? (currentFilePercent + 100 * (entriesCount - remainingFiles - 1)) / entriesCount : 100
                    }
                }));
            }, ZipFileWorker.prototype.openedSource = function(streamInfo) {
                this.currentSourceOffset = this.bytesWritten, this.currentFile = streamInfo.file.name;
                var streamedContent = this.streamFiles && !streamInfo.file.dir;
                if (streamedContent) {
                    var record = generateZipParts(streamInfo, streamedContent, !1, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
                    this.push({
                        data: record.fileRecord,
                        meta: {
                            percent: 0
                        }
                    });
                } else this.accumulate = !0;
            }, ZipFileWorker.prototype.closedSource = function(streamInfo) {
                this.accumulate = !1;
                var streamedContent = this.streamFiles && !streamInfo.file.dir, record = generateZipParts(streamInfo, streamedContent, !0, this.currentSourceOffset, this.zipPlatform, this.encodeFileName);
                if (this.dirRecords.push(record.dirRecord), streamedContent) this.push({
                    data: function(streamInfo) {
                        return signature.DATA_DESCRIPTOR + decToHex(streamInfo.crc32, 4) + decToHex(streamInfo.compressedSize, 4) + decToHex(streamInfo.uncompressedSize, 4);
                    }(streamInfo),
                    meta: {
                        percent: 100
                    }
                }); else for (this.push({
                    data: record.fileRecord,
                    meta: {
                        percent: 0
                    }
                }); this.contentBuffer.length; ) this.push(this.contentBuffer.shift());
                this.currentFile = null;
            }, ZipFileWorker.prototype.flush = function() {
                for (var localDirLength = this.bytesWritten, i = 0; i < this.dirRecords.length; i++) this.push({
                    data: this.dirRecords[i],
                    meta: {
                        percent: 100
                    }
                });
                var centralDirLength = this.bytesWritten - localDirLength, dirEnd = function(entriesCount, centralDirLength, localDirLength, comment, encodeFileName) {
                    var encodedComment = utils.transformTo("string", encodeFileName(comment));
                    return signature.CENTRAL_DIRECTORY_END + "\0\0\0\0" + decToHex(entriesCount, 2) + decToHex(entriesCount, 2) + decToHex(centralDirLength, 4) + decToHex(localDirLength, 4) + decToHex(encodedComment.length, 2) + encodedComment;
                }(this.dirRecords.length, centralDirLength, localDirLength, this.zipComment, this.encodeFileName);
                this.push({
                    data: dirEnd,
                    meta: {
                        percent: 100
                    }
                });
            }, ZipFileWorker.prototype.prepareNextSource = function() {
                this.previous = this._sources.shift(), this.openedSource(this.previous.streamInfo), 
                this.isPaused ? this.previous.pause() : this.previous.resume();
            }, ZipFileWorker.prototype.registerPrevious = function(previous) {
                this._sources.push(previous);
                var self = this;
                return previous.on("data", function(chunk) {
                    self.processChunk(chunk);
                }), previous.on("end", function() {
                    self.closedSource(self.previous.streamInfo), self._sources.length ? self.prepareNextSource() : self.end();
                }), previous.on("error", function(e) {
                    self.error(e);
                }), this;
            }, ZipFileWorker.prototype.resume = function() {
                return !!GenericWorker.prototype.resume.call(this) && (!this.previous && this._sources.length ? (this.prepareNextSource(), 
                !0) : this.previous || this._sources.length || this.generatedError ? void 0 : (this.end(), 
                !0));
            }, ZipFileWorker.prototype.error = function(e) {
                var sources = this._sources;
                if (!GenericWorker.prototype.error.call(this, e)) return !1;
                for (var i = 0; i < sources.length; i++) try {
                    sources[i].error(e);
                } catch (e) {}
                return !0;
            }, ZipFileWorker.prototype.lock = function() {
                GenericWorker.prototype.lock.call(this);
                for (var sources = this._sources, i = 0; i < sources.length; i++) sources[i].lock();
            }, module.exports = ZipFileWorker;
        }, {
            "../crc32": 158,
            "../signature": 177,
            "../stream/GenericWorker": 182,
            "../utf8": 185,
            "../utils": 186
        } ],
        163: [ function(require, module, exports) {
            "use strict";
            var compressions = require("../compressions"), ZipFileWorker = require("./ZipFileWorker");
            exports.generateWorker = function(zip, options, comment) {
                var zipFileWorker = new ZipFileWorker(options.streamFiles, comment, options.platform, options.encodeFileName), entriesCount = 0;
                try {
                    zip.forEach(function(relativePath, file) {
                        entriesCount++;
                        var compression = function(fileCompression, zipCompression) {
                            var compressionName = fileCompression || zipCompression, compression = compressions[compressionName];
                            if (!compression) throw new Error(compressionName + " is not a valid compression method !");
                            return compression;
                        }(file.options.compression, options.compression), compressionOptions = file.options.compressionOptions || options.compressionOptions || {}, dir = file.dir, date = file.date;
                        file._compressWorker(compression, compressionOptions).withStreamInfo("file", {
                            name: relativePath,
                            dir: dir,
                            date: date,
                            comment: file.comment || "",
                            unixPermissions: file.unixPermissions,
                            dosPermissions: file.dosPermissions
                        }).pipe(zipFileWorker);
                    }), zipFileWorker.entriesCount = entriesCount;
                } catch (e) {
                    zipFileWorker.error(e);
                }
                return zipFileWorker;
            };
        }, {
            "../compressions": 157,
            "./ZipFileWorker": 162
        } ],
        164: [ function(require, module, exports) {
            "use strict";
            function JSZip() {
                if (!(this instanceof JSZip)) return new JSZip();
                if (arguments.length) throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");
                this.files = {}, this.comment = null, this.root = "", this.clone = function() {
                    var newObj = new JSZip();
                    for (var i in this) "function" != typeof this[i] && (newObj[i] = this[i]);
                    return newObj;
                };
            }
            (JSZip.prototype = require("./object")).loadAsync = require("./load"), JSZip.support = require("./support"), 
            JSZip.defaults = require("./defaults"), JSZip.version = "3.1.5", JSZip.loadAsync = function(content, options) {
                return new JSZip().loadAsync(content, options);
            }, JSZip.external = require("./external"), module.exports = JSZip;
        }, {
            "./defaults": 159,
            "./external": 160,
            "./load": 165,
            "./object": 169,
            "./support": 184
        } ],
        165: [ function(require, module, exports) {
            "use strict";
            var utils = require("./utils"), external = require("./external"), utf8 = require("./utf8"), ZipEntries = (utils = require("./utils"), 
            require("./zipEntries")), Crc32Probe = require("./stream/Crc32Probe"), nodejsUtils = require("./nodejsUtils");
            function checkEntryCRC32(zipEntry) {
                return new external.Promise(function(resolve, reject) {
                    var worker = zipEntry.decompressed.getContentWorker().pipe(new Crc32Probe());
                    worker.on("error", function(e) {
                        reject(e);
                    }).on("end", function() {
                        worker.streamInfo.crc32 !== zipEntry.decompressed.crc32 ? reject(new Error("Corrupted zip : CRC32 mismatch")) : resolve();
                    }).resume();
                });
            }
            module.exports = function(data, options) {
                var zip = this;
                return options = utils.extend(options || {}, {
                    base64: !1,
                    checkCRC32: !1,
                    optimizedBinaryString: !1,
                    createFolders: !1,
                    decodeFileName: utf8.utf8decode
                }), nodejsUtils.isNode && nodejsUtils.isStream(data) ? external.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")) : utils.prepareContent("the loaded zip file", data, !0, options.optimizedBinaryString, options.base64).then(function(data) {
                    var zipEntries = new ZipEntries(options);
                    return zipEntries.load(data), zipEntries;
                }).then(function(zipEntries) {
                    var promises = [ external.Promise.resolve(zipEntries) ], files = zipEntries.files;
                    if (options.checkCRC32) for (var i = 0; i < files.length; i++) promises.push(checkEntryCRC32(files[i]));
                    return external.Promise.all(promises);
                }).then(function(results) {
                    for (var zipEntries = results.shift(), files = zipEntries.files, i = 0; i < files.length; i++) {
                        var input = files[i];
                        zip.file(input.fileNameStr, input.decompressed, {
                            binary: !0,
                            optimizedBinaryString: !0,
                            date: input.date,
                            dir: input.dir,
                            comment: input.fileCommentStr.length ? input.fileCommentStr : null,
                            unixPermissions: input.unixPermissions,
                            dosPermissions: input.dosPermissions,
                            createFolders: options.createFolders
                        });
                    }
                    return zipEntries.zipComment.length && (zip.comment = zipEntries.zipComment), zip;
                });
            };
        }, {
            "./external": 160,
            "./nodejsUtils": 166,
            "./stream/Crc32Probe": 179,
            "./utf8": 185,
            "./utils": 186,
            "./zipEntries": 187
        } ],
        166: [ function(require, module, exports) {
            (function(Buffer) {
                "use strict";
                module.exports = {
                    isNode: void 0 !== Buffer,
                    newBufferFrom: function(data, encoding) {
                        return new Buffer(data, encoding);
                    },
                    allocBuffer: function(size) {
                        return Buffer.alloc ? Buffer.alloc(size) : new Buffer(size);
                    },
                    isBuffer: function(b) {
                        return Buffer.isBuffer(b);
                    },
                    isStream: function(obj) {
                        return obj && "function" == typeof obj.on && "function" == typeof obj.pause && "function" == typeof obj.resume;
                    }
                };
            }).call(this, require("buffer").Buffer);
        }, {
            buffer: 77
        } ],
        167: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils"), GenericWorker = require("../stream/GenericWorker");
            function NodejsStreamInputAdapter(filename, stream) {
                GenericWorker.call(this, "Nodejs stream input adapter for " + filename), this._upstreamEnded = !1, 
                this._bindStream(stream);
            }
            utils.inherits(NodejsStreamInputAdapter, GenericWorker), NodejsStreamInputAdapter.prototype._bindStream = function(stream) {
                var self = this;
                (this._stream = stream).pause(), stream.on("data", function(chunk) {
                    self.push({
                        data: chunk,
                        meta: {
                            percent: 0
                        }
                    });
                }).on("error", function(e) {
                    self.isPaused ? this.generatedError = e : self.error(e);
                }).on("end", function() {
                    self.isPaused ? self._upstreamEnded = !0 : self.end();
                });
            }, NodejsStreamInputAdapter.prototype.pause = function() {
                return !!GenericWorker.prototype.pause.call(this) && (this._stream.pause(), !0);
            }, NodejsStreamInputAdapter.prototype.resume = function() {
                return !!GenericWorker.prototype.resume.call(this) && (this._upstreamEnded ? this.end() : this._stream.resume(), 
                !0);
            }, module.exports = NodejsStreamInputAdapter;
        }, {
            "../stream/GenericWorker": 182,
            "../utils": 186
        } ],
        168: [ function(require, module, exports) {
            "use strict";
            var Readable = require("readable-stream").Readable;
            function NodejsStreamOutputAdapter(helper, options, updateCb) {
                Readable.call(this, options), this._helper = helper;
                var self = this;
                helper.on("data", function(data, meta) {
                    self.push(data) || self._helper.pause(), updateCb && updateCb(meta);
                }).on("error", function(e) {
                    self.emit("error", e);
                }).on("end", function() {
                    self.push(null);
                });
            }
            require("../utils").inherits(NodejsStreamOutputAdapter, Readable), NodejsStreamOutputAdapter.prototype._read = function() {
                this._helper.resume();
            }, module.exports = NodejsStreamOutputAdapter;
        }, {
            "../utils": 186,
            "readable-stream": 170
        } ],
        169: [ function(require, module, exports) {
            "use strict";
            var utf8 = require("./utf8"), utils = require("./utils"), GenericWorker = require("./stream/GenericWorker"), StreamHelper = require("./stream/StreamHelper"), defaults = require("./defaults"), CompressedObject = require("./compressedObject"), ZipObject = require("./zipObject"), generate = require("./generate"), nodejsUtils = require("./nodejsUtils"), NodejsStreamInputAdapter = require("./nodejs/NodejsStreamInputAdapter"), fileAdd = function(name, data, originalOptions) {
                var parent, dataType = utils.getTypeOf(data), o = utils.extend(originalOptions || {}, defaults);
                o.date = o.date || new Date(), null !== o.compression && (o.compression = o.compression.toUpperCase()), 
                "string" == typeof o.unixPermissions && (o.unixPermissions = parseInt(o.unixPermissions, 8)), 
                o.unixPermissions && 16384 & o.unixPermissions && (o.dir = !0), o.dosPermissions && 16 & o.dosPermissions && (o.dir = !0), 
                o.dir && (name = forceTrailingSlash(name)), o.createFolders && (parent = parentFolder(name)) && folderAdd.call(this, parent, !0);
                var isUnicodeString = "string" === dataType && !1 === o.binary && !1 === o.base64;
                originalOptions && void 0 !== originalOptions.binary || (o.binary = !isUnicodeString), 
                (data instanceof CompressedObject && 0 === data.uncompressedSize || o.dir || !data || 0 === data.length) && (o.base64 = !1, 
                o.binary = !0, data = "", o.compression = "STORE", dataType = "string");
                var zipObjectContent = null;
                zipObjectContent = data instanceof CompressedObject || data instanceof GenericWorker ? data : nodejsUtils.isNode && nodejsUtils.isStream(data) ? new NodejsStreamInputAdapter(name, data) : utils.prepareContent(name, data, o.binary, o.optimizedBinaryString, o.base64);
                var object = new ZipObject(name, zipObjectContent, o);
                this.files[name] = object;
            }, parentFolder = function(path) {
                "/" === path.slice(-1) && (path = path.substring(0, path.length - 1));
                var lastSlash = path.lastIndexOf("/");
                return 0 < lastSlash ? path.substring(0, lastSlash) : "";
            }, forceTrailingSlash = function(path) {
                return "/" !== path.slice(-1) && (path += "/"), path;
            }, folderAdd = function(name, createFolders) {
                return createFolders = void 0 !== createFolders ? createFolders : defaults.createFolders, 
                name = forceTrailingSlash(name), this.files[name] || fileAdd.call(this, name, null, {
                    dir: !0,
                    createFolders: createFolders
                }), this.files[name];
            };
            function isRegExp(object) {
                return "[object RegExp]" === Object.prototype.toString.call(object);
            }
            var out = {
                load: function() {
                    throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
                },
                forEach: function(cb) {
                    var filename, relativePath, file;
                    for (filename in this.files) this.files.hasOwnProperty(filename) && (file = this.files[filename], 
                    (relativePath = filename.slice(this.root.length, filename.length)) && filename.slice(0, this.root.length) === this.root && cb(relativePath, file));
                },
                filter: function(search) {
                    var result = [];
                    return this.forEach(function(relativePath, entry) {
                        search(relativePath, entry) && result.push(entry);
                    }), result;
                },
                file: function(name, data, o) {
                    if (1 === arguments.length) {
                        if (isRegExp(name)) {
                            var regexp = name;
                            return this.filter(function(relativePath, file) {
                                return !file.dir && regexp.test(relativePath);
                            });
                        }
                        var obj = this.files[this.root + name];
                        return obj && !obj.dir ? obj : null;
                    }
                    return name = this.root + name, fileAdd.call(this, name, data, o), this;
                },
                folder: function(arg) {
                    if (!arg) return this;
                    if (isRegExp(arg)) return this.filter(function(relativePath, file) {
                        return file.dir && arg.test(relativePath);
                    });
                    var name = this.root + arg, newFolder = folderAdd.call(this, name), ret = this.clone();
                    return ret.root = newFolder.name, ret;
                },
                remove: function(name) {
                    name = this.root + name;
                    var file = this.files[name];
                    if (file || ("/" !== name.slice(-1) && (name += "/"), file = this.files[name]), 
                    file && !file.dir) delete this.files[name]; else for (var kids = this.filter(function(relativePath, file) {
                        return file.name.slice(0, name.length) === name;
                    }), i = 0; i < kids.length; i++) delete this.files[kids[i].name];
                    return this;
                },
                generate: function(options) {
                    throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
                },
                generateInternalStream: function(options) {
                    var worker, opts = {};
                    try {
                        if ((opts = utils.extend(options || {}, {
                            streamFiles: !1,
                            compression: "STORE",
                            compressionOptions: null,
                            type: "",
                            platform: "DOS",
                            comment: null,
                            mimeType: "application/zip",
                            encodeFileName: utf8.utf8encode
                        })).type = opts.type.toLowerCase(), opts.compression = opts.compression.toUpperCase(), 
                        "binarystring" === opts.type && (opts.type = "string"), !opts.type) throw new Error("No output type specified.");
                        utils.checkSupport(opts.type), "darwin" !== opts.platform && "freebsd" !== opts.platform && "linux" !== opts.platform && "sunos" !== opts.platform || (opts.platform = "UNIX"), 
                        "win32" === opts.platform && (opts.platform = "DOS");
                        var comment = opts.comment || this.comment || "";
                        worker = generate.generateWorker(this, opts, comment);
                    } catch (e) {
                        (worker = new GenericWorker("error")).error(e);
                    }
                    return new StreamHelper(worker, opts.type || "string", opts.mimeType);
                },
                generateAsync: function(options, onUpdate) {
                    return this.generateInternalStream(options).accumulate(onUpdate);
                },
                generateNodeStream: function(options, onUpdate) {
                    return (options = options || {}).type || (options.type = "nodebuffer"), this.generateInternalStream(options).toNodejsStream(onUpdate);
                }
            };
            module.exports = out;
        }, {
            "./compressedObject": 156,
            "./defaults": 159,
            "./generate": 163,
            "./nodejs/NodejsStreamInputAdapter": 167,
            "./nodejsUtils": 166,
            "./stream/GenericWorker": 182,
            "./stream/StreamHelper": 183,
            "./utf8": 185,
            "./utils": 186,
            "./zipObject": 189
        } ],
        170: [ function(require, module, exports) {
            module.exports = require("stream");
        }, {
            stream: 254
        } ],
        171: [ function(require, module, exports) {
            "use strict";
            var DataReader = require("./DataReader");
            function ArrayReader(data) {
                DataReader.call(this, data);
                for (var i = 0; i < this.data.length; i++) data[i] = 255 & data[i];
            }
            require("../utils").inherits(ArrayReader, DataReader), ArrayReader.prototype.byteAt = function(i) {
                return this.data[this.zero + i];
            }, ArrayReader.prototype.lastIndexOfSignature = function(sig) {
                for (var sig0 = sig.charCodeAt(0), sig1 = sig.charCodeAt(1), sig2 = sig.charCodeAt(2), sig3 = sig.charCodeAt(3), i = this.length - 4; 0 <= i; --i) if (this.data[i] === sig0 && this.data[i + 1] === sig1 && this.data[i + 2] === sig2 && this.data[i + 3] === sig3) return i - this.zero;
                return -1;
            }, ArrayReader.prototype.readAndCheckSignature = function(sig) {
                var sig0 = sig.charCodeAt(0), sig1 = sig.charCodeAt(1), sig2 = sig.charCodeAt(2), sig3 = sig.charCodeAt(3), data = this.readData(4);
                return sig0 === data[0] && sig1 === data[1] && sig2 === data[2] && sig3 === data[3];
            }, ArrayReader.prototype.readData = function(size) {
                if (this.checkOffset(size), 0 === size) return [];
                var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
                return this.index += size, result;
            }, module.exports = ArrayReader;
        }, {
            "../utils": 186,
            "./DataReader": 172
        } ],
        172: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils");
            function DataReader(data) {
                this.data = data, this.length = data.length, this.index = 0, this.zero = 0;
            }
            DataReader.prototype = {
                checkOffset: function(offset) {
                    this.checkIndex(this.index + offset);
                },
                checkIndex: function(newIndex) {
                    if (this.length < this.zero + newIndex || newIndex < 0) throw new Error("End of data reached (data length = " + this.length + ", asked index = " + newIndex + "). Corrupted zip ?");
                },
                setIndex: function(newIndex) {
                    this.checkIndex(newIndex), this.index = newIndex;
                },
                skip: function(n) {
                    this.setIndex(this.index + n);
                },
                byteAt: function(i) {},
                readInt: function(size) {
                    var i, result = 0;
                    for (this.checkOffset(size), i = this.index + size - 1; i >= this.index; i--) result = (result << 8) + this.byteAt(i);
                    return this.index += size, result;
                },
                readString: function(size) {
                    return utils.transformTo("string", this.readData(size));
                },
                readData: function(size) {},
                lastIndexOfSignature: function(sig) {},
                readAndCheckSignature: function(sig) {},
                readDate: function() {
                    var dostime = this.readInt(4);
                    return new Date(Date.UTC(1980 + (dostime >> 25 & 127), (dostime >> 21 & 15) - 1, dostime >> 16 & 31, dostime >> 11 & 31, dostime >> 5 & 63, (31 & dostime) << 1));
                }
            }, module.exports = DataReader;
        }, {
            "../utils": 186
        } ],
        173: [ function(require, module, exports) {
            "use strict";
            var Uint8ArrayReader = require("./Uint8ArrayReader");
            function NodeBufferReader(data) {
                Uint8ArrayReader.call(this, data);
            }
            require("../utils").inherits(NodeBufferReader, Uint8ArrayReader), NodeBufferReader.prototype.readData = function(size) {
                this.checkOffset(size);
                var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
                return this.index += size, result;
            }, module.exports = NodeBufferReader;
        }, {
            "../utils": 186,
            "./Uint8ArrayReader": 175
        } ],
        174: [ function(require, module, exports) {
            "use strict";
            var DataReader = require("./DataReader");
            function StringReader(data) {
                DataReader.call(this, data);
            }
            require("../utils").inherits(StringReader, DataReader), StringReader.prototype.byteAt = function(i) {
                return this.data.charCodeAt(this.zero + i);
            }, StringReader.prototype.lastIndexOfSignature = function(sig) {
                return this.data.lastIndexOf(sig) - this.zero;
            }, StringReader.prototype.readAndCheckSignature = function(sig) {
                return sig === this.readData(4);
            }, StringReader.prototype.readData = function(size) {
                this.checkOffset(size);
                var result = this.data.slice(this.zero + this.index, this.zero + this.index + size);
                return this.index += size, result;
            }, module.exports = StringReader;
        }, {
            "../utils": 186,
            "./DataReader": 172
        } ],
        175: [ function(require, module, exports) {
            "use strict";
            var ArrayReader = require("./ArrayReader");
            function Uint8ArrayReader(data) {
                ArrayReader.call(this, data);
            }
            require("../utils").inherits(Uint8ArrayReader, ArrayReader), Uint8ArrayReader.prototype.readData = function(size) {
                if (this.checkOffset(size), 0 === size) return new Uint8Array(0);
                var result = this.data.subarray(this.zero + this.index, this.zero + this.index + size);
                return this.index += size, result;
            }, module.exports = Uint8ArrayReader;
        }, {
            "../utils": 186,
            "./ArrayReader": 171
        } ],
        176: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils"), support = require("../support"), ArrayReader = require("./ArrayReader"), StringReader = require("./StringReader"), NodeBufferReader = require("./NodeBufferReader"), Uint8ArrayReader = require("./Uint8ArrayReader");
            module.exports = function(data) {
                var type = utils.getTypeOf(data);
                return utils.checkSupport(type), "string" !== type || support.uint8array ? "nodebuffer" === type ? new NodeBufferReader(data) : support.uint8array ? new Uint8ArrayReader(utils.transformTo("uint8array", data)) : new ArrayReader(utils.transformTo("array", data)) : new StringReader(data);
            };
        }, {
            "../support": 184,
            "../utils": 186,
            "./ArrayReader": 171,
            "./NodeBufferReader": 173,
            "./StringReader": 174,
            "./Uint8ArrayReader": 175
        } ],
        177: [ function(require, module, exports) {
            "use strict";
            exports.LOCAL_FILE_HEADER = "PK", exports.CENTRAL_FILE_HEADER = "PK", exports.CENTRAL_DIRECTORY_END = "PK", 
            exports.ZIP64_CENTRAL_DIRECTORY_LOCATOR = "PK", exports.ZIP64_CENTRAL_DIRECTORY_END = "PK", 
            exports.DATA_DESCRIPTOR = "PK\b";
        }, {} ],
        178: [ function(require, module, exports) {
            "use strict";
            var GenericWorker = require("./GenericWorker"), utils = require("../utils");
            function ConvertWorker(destType) {
                GenericWorker.call(this, "ConvertWorker to " + destType), this.destType = destType;
            }
            utils.inherits(ConvertWorker, GenericWorker), ConvertWorker.prototype.processChunk = function(chunk) {
                this.push({
                    data: utils.transformTo(this.destType, chunk.data),
                    meta: chunk.meta
                });
            }, module.exports = ConvertWorker;
        }, {
            "../utils": 186,
            "./GenericWorker": 182
        } ],
        179: [ function(require, module, exports) {
            "use strict";
            var GenericWorker = require("./GenericWorker"), crc32 = require("../crc32");
            function Crc32Probe() {
                GenericWorker.call(this, "Crc32Probe"), this.withStreamInfo("crc32", 0);
            }
            require("../utils").inherits(Crc32Probe, GenericWorker), Crc32Probe.prototype.processChunk = function(chunk) {
                this.streamInfo.crc32 = crc32(chunk.data, this.streamInfo.crc32 || 0), this.push(chunk);
            }, module.exports = Crc32Probe;
        }, {
            "../crc32": 158,
            "../utils": 186,
            "./GenericWorker": 182
        } ],
        180: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils"), GenericWorker = require("./GenericWorker");
            function DataLengthProbe(propName) {
                GenericWorker.call(this, "DataLengthProbe for " + propName), this.propName = propName, 
                this.withStreamInfo(propName, 0);
            }
            utils.inherits(DataLengthProbe, GenericWorker), DataLengthProbe.prototype.processChunk = function(chunk) {
                if (chunk) {
                    var length = this.streamInfo[this.propName] || 0;
                    this.streamInfo[this.propName] = length + chunk.data.length;
                }
                GenericWorker.prototype.processChunk.call(this, chunk);
            }, module.exports = DataLengthProbe;
        }, {
            "../utils": 186,
            "./GenericWorker": 182
        } ],
        181: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils"), GenericWorker = require("./GenericWorker");
            function DataWorker(dataP) {
                GenericWorker.call(this, "DataWorker");
                var self = this;
                this.dataIsReady = !1, this.index = 0, this.max = 0, this.data = null, this.type = "", 
                this._tickScheduled = !1, dataP.then(function(data) {
                    self.dataIsReady = !0, self.data = data, self.max = data && data.length || 0, self.type = utils.getTypeOf(data), 
                    self.isPaused || self._tickAndRepeat();
                }, function(e) {
                    self.error(e);
                });
            }
            utils.inherits(DataWorker, GenericWorker), DataWorker.prototype.cleanUp = function() {
                GenericWorker.prototype.cleanUp.call(this), this.data = null;
            }, DataWorker.prototype.resume = function() {
                return !!GenericWorker.prototype.resume.call(this) && (!this._tickScheduled && this.dataIsReady && (this._tickScheduled = !0, 
                utils.delay(this._tickAndRepeat, [], this)), !0);
            }, DataWorker.prototype._tickAndRepeat = function() {
                this._tickScheduled = !1, this.isPaused || this.isFinished || (this._tick(), this.isFinished || (utils.delay(this._tickAndRepeat, [], this), 
                this._tickScheduled = !0));
            }, DataWorker.prototype._tick = function() {
                if (this.isPaused || this.isFinished) return !1;
                var data = null, nextIndex = Math.min(this.max, this.index + 16384);
                if (this.index >= this.max) return this.end();
                switch (this.type) {
                  case "string":
                    data = this.data.substring(this.index, nextIndex);
                    break;

                  case "uint8array":
                    data = this.data.subarray(this.index, nextIndex);
                    break;

                  case "array":
                  case "nodebuffer":
                    data = this.data.slice(this.index, nextIndex);
                }
                return this.index = nextIndex, this.push({
                    data: data,
                    meta: {
                        percent: this.max ? this.index / this.max * 100 : 0
                    }
                });
            }, module.exports = DataWorker;
        }, {
            "../utils": 186,
            "./GenericWorker": 182
        } ],
        182: [ function(require, module, exports) {
            "use strict";
            function GenericWorker(name) {
                this.name = name || "default", this.streamInfo = {}, this.generatedError = null, 
                this.extraStreamInfo = {}, this.isPaused = !0, this.isFinished = !1, this.isLocked = !1, 
                this._listeners = {
                    data: [],
                    end: [],
                    error: []
                }, this.previous = null;
            }
            GenericWorker.prototype = {
                push: function(chunk) {
                    this.emit("data", chunk);
                },
                end: function() {
                    if (this.isFinished) return !1;
                    this.flush();
                    try {
                        this.emit("end"), this.cleanUp(), this.isFinished = !0;
                    } catch (e) {
                        this.emit("error", e);
                    }
                    return !0;
                },
                error: function(e) {
                    return !this.isFinished && (this.isPaused ? this.generatedError = e : (this.isFinished = !0, 
                    this.emit("error", e), this.previous && this.previous.error(e), this.cleanUp()), 
                    !0);
                },
                on: function(name, listener) {
                    return this._listeners[name].push(listener), this;
                },
                cleanUp: function() {
                    this.streamInfo = this.generatedError = this.extraStreamInfo = null, this._listeners = [];
                },
                emit: function(name, arg) {
                    if (this._listeners[name]) for (var i = 0; i < this._listeners[name].length; i++) this._listeners[name][i].call(this, arg);
                },
                pipe: function(next) {
                    return next.registerPrevious(this);
                },
                registerPrevious: function(previous) {
                    if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
                    this.streamInfo = previous.streamInfo, this.mergeStreamInfo(), this.previous = previous;
                    var self = this;
                    return previous.on("data", function(chunk) {
                        self.processChunk(chunk);
                    }), previous.on("end", function() {
                        self.end();
                    }), previous.on("error", function(e) {
                        self.error(e);
                    }), this;
                },
                pause: function() {
                    return !this.isPaused && !this.isFinished && (this.isPaused = !0, this.previous && this.previous.pause(), 
                    !0);
                },
                resume: function() {
                    if (!this.isPaused || this.isFinished) return !1;
                    var withError = this.isPaused = !1;
                    return this.generatedError && (this.error(this.generatedError), withError = !0), 
                    this.previous && this.previous.resume(), !withError;
                },
                flush: function() {},
                processChunk: function(chunk) {
                    this.push(chunk);
                },
                withStreamInfo: function(key, value) {
                    return this.extraStreamInfo[key] = value, this.mergeStreamInfo(), this;
                },
                mergeStreamInfo: function() {
                    for (var key in this.extraStreamInfo) this.extraStreamInfo.hasOwnProperty(key) && (this.streamInfo[key] = this.extraStreamInfo[key]);
                },
                lock: function() {
                    if (this.isLocked) throw new Error("The stream '" + this + "' has already been used.");
                    this.isLocked = !0, this.previous && this.previous.lock();
                },
                toString: function() {
                    var me = "Worker " + this.name;
                    return this.previous ? this.previous + " -> " + me : me;
                }
            }, module.exports = GenericWorker;
        }, {} ],
        183: [ function(require, module, exports) {
            (function(Buffer) {
                "use strict";
                var utils = require("../utils"), ConvertWorker = require("./ConvertWorker"), GenericWorker = require("./GenericWorker"), base64 = require("../base64"), support = require("../support"), external = require("../external"), NodejsStreamOutputAdapter = null;
                if (support.nodestream) try {
                    NodejsStreamOutputAdapter = require("../nodejs/NodejsStreamOutputAdapter");
                } catch (e) {}
                function accumulate(helper, updateCallback) {
                    return new external.Promise(function(resolve, reject) {
                        var dataArray = [], chunkType = helper._internalType, resultType = helper._outputType, mimeType = helper._mimeType;
                        helper.on("data", function(data, meta) {
                            dataArray.push(data), updateCallback && updateCallback(meta);
                        }).on("error", function(err) {
                            dataArray = [], reject(err);
                        }).on("end", function() {
                            try {
                                var result = function(type, content, mimeType) {
                                    switch (type) {
                                      case "blob":
                                        return utils.newBlob(utils.transformTo("arraybuffer", content), mimeType);

                                      case "base64":
                                        return base64.encode(content);

                                      default:
                                        return utils.transformTo(type, content);
                                    }
                                }(resultType, function(type, dataArray) {
                                    var i, index = 0, res = null, totalLength = 0;
                                    for (i = 0; i < dataArray.length; i++) totalLength += dataArray[i].length;
                                    switch (type) {
                                      case "string":
                                        return dataArray.join("");

                                      case "array":
                                        return Array.prototype.concat.apply([], dataArray);

                                      case "uint8array":
                                        for (res = new Uint8Array(totalLength), i = 0; i < dataArray.length; i++) res.set(dataArray[i], index), 
                                        index += dataArray[i].length;
                                        return res;

                                      case "nodebuffer":
                                        return Buffer.concat(dataArray);

                                      default:
                                        throw new Error("concat : unsupported type '" + type + "'");
                                    }
                                }(chunkType, dataArray), mimeType);
                                resolve(result);
                            } catch (e) {
                                reject(e);
                            }
                            dataArray = [];
                        }).resume();
                    });
                }
                function StreamHelper(worker, outputType, mimeType) {
                    var internalType = outputType;
                    switch (outputType) {
                      case "blob":
                      case "arraybuffer":
                        internalType = "uint8array";
                        break;

                      case "base64":
                        internalType = "string";
                    }
                    try {
                        this._internalType = internalType, this._outputType = outputType, this._mimeType = mimeType, 
                        utils.checkSupport(internalType), this._worker = worker.pipe(new ConvertWorker(internalType)), 
                        worker.lock();
                    } catch (e) {
                        this._worker = new GenericWorker("error"), this._worker.error(e);
                    }
                }
                StreamHelper.prototype = {
                    accumulate: function(updateCb) {
                        return accumulate(this, updateCb);
                    },
                    on: function(evt, fn) {
                        var self = this;
                        return "data" === evt ? this._worker.on(evt, function(chunk) {
                            fn.call(self, chunk.data, chunk.meta);
                        }) : this._worker.on(evt, function() {
                            utils.delay(fn, arguments, self);
                        }), this;
                    },
                    resume: function() {
                        return utils.delay(this._worker.resume, [], this._worker), this;
                    },
                    pause: function() {
                        return this._worker.pause(), this;
                    },
                    toNodejsStream: function(updateCb) {
                        if (utils.checkSupport("nodestream"), "nodebuffer" !== this._outputType) throw new Error(this._outputType + " is not supported by this method");
                        return new NodejsStreamOutputAdapter(this, {
                            objectMode: "nodebuffer" !== this._outputType
                        }, updateCb);
                    }
                }, module.exports = StreamHelper;
            }).call(this, require("buffer").Buffer);
        }, {
            "../base64": 155,
            "../external": 160,
            "../nodejs/NodejsStreamOutputAdapter": 168,
            "../support": 184,
            "../utils": 186,
            "./ConvertWorker": 178,
            "./GenericWorker": 182,
            buffer: 77
        } ],
        184: [ function(require, module, exports) {
            (function(Buffer) {
                "use strict";
                if (exports.base64 = !0, exports.array = !0, exports.string = !0, exports.arraybuffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array, 
                exports.nodebuffer = void 0 !== Buffer, exports.uint8array = "undefined" != typeof Uint8Array, 
                "undefined" == typeof ArrayBuffer) exports.blob = !1; else {
                    var buffer = new ArrayBuffer(0);
                    try {
                        exports.blob = 0 === new Blob([ buffer ], {
                            type: "application/zip"
                        }).size;
                    } catch (e) {
                        try {
                            var builder = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
                            builder.append(buffer), exports.blob = 0 === builder.getBlob("application/zip").size;
                        } catch (e) {
                            exports.blob = !1;
                        }
                    }
                }
                try {
                    exports.nodestream = !!require("readable-stream").Readable;
                } catch (e) {
                    exports.nodestream = !1;
                }
            }).call(this, require("buffer").Buffer);
        }, {
            buffer: 77,
            "readable-stream": 170
        } ],
        185: [ function(require, module, exports) {
            "use strict";
            for (var utils = require("./utils"), support = require("./support"), nodejsUtils = require("./nodejsUtils"), GenericWorker = require("./stream/GenericWorker"), _utf8len = new Array(256), i = 0; i < 256; i++) _utf8len[i] = 252 <= i ? 6 : 248 <= i ? 5 : 240 <= i ? 4 : 224 <= i ? 3 : 192 <= i ? 2 : 1;
            _utf8len[254] = _utf8len[254] = 1;
            function Utf8DecodeWorker() {
                GenericWorker.call(this, "utf-8 decode"), this.leftOver = null;
            }
            function Utf8EncodeWorker() {
                GenericWorker.call(this, "utf-8 encode");
            }
            exports.utf8encode = function(str) {
                return support.nodebuffer ? nodejsUtils.newBufferFrom(str, "utf-8") : function(str) {
                    var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;
                    for (m_pos = 0; m_pos < str_len; m_pos++) 55296 == (64512 & (c = str.charCodeAt(m_pos))) && m_pos + 1 < str_len && 56320 == (64512 & (c2 = str.charCodeAt(m_pos + 1))) && (c = 65536 + (c - 55296 << 10) + (c2 - 56320), 
                    m_pos++), buf_len += c < 128 ? 1 : c < 2048 ? 2 : c < 65536 ? 3 : 4;
                    for (buf = support.uint8array ? new Uint8Array(buf_len) : new Array(buf_len), m_pos = i = 0; i < buf_len; m_pos++) 55296 == (64512 & (c = str.charCodeAt(m_pos))) && m_pos + 1 < str_len && 56320 == (64512 & (c2 = str.charCodeAt(m_pos + 1))) && (c = 65536 + (c - 55296 << 10) + (c2 - 56320), 
                    m_pos++), c < 128 ? buf[i++] = c : (c < 2048 ? buf[i++] = 192 | c >>> 6 : (c < 65536 ? buf[i++] = 224 | c >>> 12 : (buf[i++] = 240 | c >>> 18, 
                    buf[i++] = 128 | c >>> 12 & 63), buf[i++] = 128 | c >>> 6 & 63), buf[i++] = 128 | 63 & c);
                    return buf;
                }(str);
            }, exports.utf8decode = function(buf) {
                return support.nodebuffer ? utils.transformTo("nodebuffer", buf).toString("utf-8") : function(buf) {
                    var i, out, c, c_len, len = buf.length, utf16buf = new Array(2 * len);
                    for (i = out = 0; i < len; ) if ((c = buf[i++]) < 128) utf16buf[out++] = c; else if (4 < (c_len = _utf8len[c])) utf16buf[out++] = 65533, 
                    i += c_len - 1; else {
                        for (c &= 2 === c_len ? 31 : 3 === c_len ? 15 : 7; 1 < c_len && i < len; ) c = c << 6 | 63 & buf[i++], 
                        c_len--;
                        1 < c_len ? utf16buf[out++] = 65533 : c < 65536 ? utf16buf[out++] = c : (c -= 65536, 
                        utf16buf[out++] = 55296 | c >> 10 & 1023, utf16buf[out++] = 56320 | 1023 & c);
                    }
                    return utf16buf.length !== out && (utf16buf.subarray ? utf16buf = utf16buf.subarray(0, out) : utf16buf.length = out), 
                    utils.applyFromCharCode(utf16buf);
                }(buf = utils.transformTo(support.uint8array ? "uint8array" : "array", buf));
            }, utils.inherits(Utf8DecodeWorker, GenericWorker), Utf8DecodeWorker.prototype.processChunk = function(chunk) {
                var data = utils.transformTo(support.uint8array ? "uint8array" : "array", chunk.data);
                if (this.leftOver && this.leftOver.length) {
                    if (support.uint8array) {
                        var previousData = data;
                        (data = new Uint8Array(previousData.length + this.leftOver.length)).set(this.leftOver, 0), 
                        data.set(previousData, this.leftOver.length);
                    } else data = this.leftOver.concat(data);
                    this.leftOver = null;
                }
                var nextBoundary = function(buf, max) {
                    var pos;
                    for ((max = max || buf.length) > buf.length && (max = buf.length), pos = max - 1; 0 <= pos && 128 == (192 & buf[pos]); ) pos--;
                    return pos < 0 ? max : 0 === pos ? max : pos + _utf8len[buf[pos]] > max ? pos : max;
                }(data), usableData = data;
                nextBoundary !== data.length && (support.uint8array ? (usableData = data.subarray(0, nextBoundary), 
                this.leftOver = data.subarray(nextBoundary, data.length)) : (usableData = data.slice(0, nextBoundary), 
                this.leftOver = data.slice(nextBoundary, data.length))), this.push({
                    data: exports.utf8decode(usableData),
                    meta: chunk.meta
                });
            }, Utf8DecodeWorker.prototype.flush = function() {
                this.leftOver && this.leftOver.length && (this.push({
                    data: exports.utf8decode(this.leftOver),
                    meta: {}
                }), this.leftOver = null);
            }, exports.Utf8DecodeWorker = Utf8DecodeWorker, utils.inherits(Utf8EncodeWorker, GenericWorker), 
            Utf8EncodeWorker.prototype.processChunk = function(chunk) {
                this.push({
                    data: exports.utf8encode(chunk.data),
                    meta: chunk.meta
                });
            }, exports.Utf8EncodeWorker = Utf8EncodeWorker;
        }, {
            "./nodejsUtils": 166,
            "./stream/GenericWorker": 182,
            "./support": 184,
            "./utils": 186
        } ],
        186: [ function(require, module, exports) {
            "use strict";
            var support = require("./support"), base64 = require("./base64"), nodejsUtils = require("./nodejsUtils"), setImmediate = require("core-js/library/fn/set-immediate"), external = require("./external");
            function identity(input) {
                return input;
            }
            function stringToArrayLike(str, array) {
                for (var i = 0; i < str.length; ++i) array[i] = 255 & str.charCodeAt(i);
                return array;
            }
            exports.newBlob = function(part, type) {
                exports.checkSupport("blob");
                try {
                    return new Blob([ part ], {
                        type: type
                    });
                } catch (e) {
                    try {
                        var builder = new (self.BlobBuilder || self.WebKitBlobBuilder || self.MozBlobBuilder || self.MSBlobBuilder)();
                        return builder.append(part), builder.getBlob(type);
                    } catch (e) {
                        throw new Error("Bug : can't construct the Blob.");
                    }
                }
            };
            var arrayToStringHelper = {
                stringifyByChunk: function(array, type, chunk) {
                    var result = [], k = 0, len = array.length;
                    if (len <= chunk) return String.fromCharCode.apply(null, array);
                    for (;k < len; ) "array" === type || "nodebuffer" === type ? result.push(String.fromCharCode.apply(null, array.slice(k, Math.min(k + chunk, len)))) : result.push(String.fromCharCode.apply(null, array.subarray(k, Math.min(k + chunk, len)))), 
                    k += chunk;
                    return result.join("");
                },
                stringifyByChar: function(array) {
                    for (var resultStr = "", i = 0; i < array.length; i++) resultStr += String.fromCharCode(array[i]);
                    return resultStr;
                },
                applyCanBeUsed: {
                    uint8array: function() {
                        try {
                            return support.uint8array && 1 === String.fromCharCode.apply(null, new Uint8Array(1)).length;
                        } catch (e) {
                            return !1;
                        }
                    }(),
                    nodebuffer: function() {
                        try {
                            return support.nodebuffer && 1 === String.fromCharCode.apply(null, nodejsUtils.allocBuffer(1)).length;
                        } catch (e) {
                            return !1;
                        }
                    }()
                }
            };
            function arrayLikeToString(array) {
                var chunk = 65536, type = exports.getTypeOf(array), canUseApply = !0;
                if ("uint8array" === type ? canUseApply = arrayToStringHelper.applyCanBeUsed.uint8array : "nodebuffer" === type && (canUseApply = arrayToStringHelper.applyCanBeUsed.nodebuffer), 
                canUseApply) for (;1 < chunk; ) try {
                    return arrayToStringHelper.stringifyByChunk(array, type, chunk);
                } catch (e) {
                    chunk = Math.floor(chunk / 2);
                }
                return arrayToStringHelper.stringifyByChar(array);
            }
            function arrayLikeToArrayLike(arrayFrom, arrayTo) {
                for (var i = 0; i < arrayFrom.length; i++) arrayTo[i] = arrayFrom[i];
                return arrayTo;
            }
            exports.applyFromCharCode = arrayLikeToString;
            var transform = {};
            transform.string = {
                string: identity,
                array: function(input) {
                    return stringToArrayLike(input, new Array(input.length));
                },
                arraybuffer: function(input) {
                    return transform.string.uint8array(input).buffer;
                },
                uint8array: function(input) {
                    return stringToArrayLike(input, new Uint8Array(input.length));
                },
                nodebuffer: function(input) {
                    return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length));
                }
            }, transform.array = {
                string: arrayLikeToString,
                array: identity,
                arraybuffer: function(input) {
                    return new Uint8Array(input).buffer;
                },
                uint8array: function(input) {
                    return new Uint8Array(input);
                },
                nodebuffer: function(input) {
                    return nodejsUtils.newBufferFrom(input);
                }
            }, transform.arraybuffer = {
                string: function(input) {
                    return arrayLikeToString(new Uint8Array(input));
                },
                array: function(input) {
                    return arrayLikeToArrayLike(new Uint8Array(input), new Array(input.byteLength));
                },
                arraybuffer: identity,
                uint8array: function(input) {
                    return new Uint8Array(input);
                },
                nodebuffer: function(input) {
                    return nodejsUtils.newBufferFrom(new Uint8Array(input));
                }
            }, transform.uint8array = {
                string: arrayLikeToString,
                array: function(input) {
                    return arrayLikeToArrayLike(input, new Array(input.length));
                },
                arraybuffer: function(input) {
                    return input.buffer;
                },
                uint8array: identity,
                nodebuffer: function(input) {
                    return nodejsUtils.newBufferFrom(input);
                }
            }, transform.nodebuffer = {
                string: arrayLikeToString,
                array: function(input) {
                    return arrayLikeToArrayLike(input, new Array(input.length));
                },
                arraybuffer: function(input) {
                    return transform.nodebuffer.uint8array(input).buffer;
                },
                uint8array: function(input) {
                    return arrayLikeToArrayLike(input, new Uint8Array(input.length));
                },
                nodebuffer: identity
            }, exports.transformTo = function(outputType, input) {
                if (input || (input = ""), !outputType) return input;
                exports.checkSupport(outputType);
                var inputType = exports.getTypeOf(input);
                return transform[inputType][outputType](input);
            }, exports.getTypeOf = function(input) {
                return "string" == typeof input ? "string" : "[object Array]" === Object.prototype.toString.call(input) ? "array" : support.nodebuffer && nodejsUtils.isBuffer(input) ? "nodebuffer" : support.uint8array && input instanceof Uint8Array ? "uint8array" : support.arraybuffer && input instanceof ArrayBuffer ? "arraybuffer" : void 0;
            }, exports.checkSupport = function(type) {
                if (!support[type.toLowerCase()]) throw new Error(type + " is not supported by this platform");
            }, exports.MAX_VALUE_16BITS = 65535, exports.MAX_VALUE_32BITS = -1, exports.pretty = function(str) {
                var code, i, res = "";
                for (i = 0; i < (str || "").length; i++) res += "\\x" + ((code = str.charCodeAt(i)) < 16 ? "0" : "") + code.toString(16).toUpperCase();
                return res;
            }, exports.delay = function(callback, args, self) {
                setImmediate(function() {
                    callback.apply(self || null, args || []);
                });
            }, exports.inherits = function(ctor, superCtor) {
                var Obj = function() {};
                Obj.prototype = superCtor.prototype, ctor.prototype = new Obj();
            }, exports.extend = function() {
                var i, attr, result = {};
                for (i = 0; i < arguments.length; i++) for (attr in arguments[i]) arguments[i].hasOwnProperty(attr) && void 0 === result[attr] && (result[attr] = arguments[i][attr]);
                return result;
            }, exports.prepareContent = function(name, inputData, isBinary, isOptimizedBinaryString, isBase64) {
                return external.Promise.resolve(inputData).then(function(data) {
                    return support.blob && (data instanceof Blob || -1 !== [ "[object File]", "[object Blob]" ].indexOf(Object.prototype.toString.call(data))) && "undefined" != typeof FileReader ? new external.Promise(function(resolve, reject) {
                        var reader = new FileReader();
                        reader.onload = function(e) {
                            resolve(e.target.result);
                        }, reader.onerror = function(e) {
                            reject(e.target.error);
                        }, reader.readAsArrayBuffer(data);
                    }) : data;
                }).then(function(data) {
                    var str, dataType = exports.getTypeOf(data);
                    return dataType ? ("arraybuffer" === dataType ? data = exports.transformTo("uint8array", data) : "string" === dataType && (isBase64 ? data = base64.decode(data) : isBinary && !0 !== isOptimizedBinaryString && (data = stringToArrayLike(str = data, support.uint8array ? new Uint8Array(str.length) : new Array(str.length)))), 
                    data) : external.Promise.reject(new Error("Can't read the data of '" + name + "'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"));
                });
            };
        }, {
            "./base64": 155,
            "./external": 160,
            "./nodejsUtils": 166,
            "./support": 184,
            "core-js/library/fn/set-immediate": 80
        } ],
        187: [ function(require, module, exports) {
            "use strict";
            var readerFor = require("./reader/readerFor"), utils = require("./utils"), sig = require("./signature"), ZipEntry = require("./zipEntry"), support = (require("./utf8"), 
            require("./support"));
            function ZipEntries(loadOptions) {
                this.files = [], this.loadOptions = loadOptions;
            }
            ZipEntries.prototype = {
                checkSignature: function(expectedSignature) {
                    if (!this.reader.readAndCheckSignature(expectedSignature)) {
                        this.reader.index -= 4;
                        var signature = this.reader.readString(4);
                        throw new Error("Corrupted zip or bug: unexpected signature (" + utils.pretty(signature) + ", expected " + utils.pretty(expectedSignature) + ")");
                    }
                },
                isSignature: function(askedIndex, expectedSignature) {
                    var currentIndex = this.reader.index;
                    this.reader.setIndex(askedIndex);
                    var result = this.reader.readString(4) === expectedSignature;
                    return this.reader.setIndex(currentIndex), result;
                },
                readBlockEndOfCentral: function() {
                    this.diskNumber = this.reader.readInt(2), this.diskWithCentralDirStart = this.reader.readInt(2), 
                    this.centralDirRecordsOnThisDisk = this.reader.readInt(2), this.centralDirRecords = this.reader.readInt(2), 
                    this.centralDirSize = this.reader.readInt(4), this.centralDirOffset = this.reader.readInt(4), 
                    this.zipCommentLength = this.reader.readInt(2);
                    var zipComment = this.reader.readData(this.zipCommentLength), decodeParamType = support.uint8array ? "uint8array" : "array", decodeContent = utils.transformTo(decodeParamType, zipComment);
                    this.zipComment = this.loadOptions.decodeFileName(decodeContent);
                },
                readBlockZip64EndOfCentral: function() {
                    this.zip64EndOfCentralSize = this.reader.readInt(8), this.reader.skip(4), this.diskNumber = this.reader.readInt(4), 
                    this.diskWithCentralDirStart = this.reader.readInt(4), this.centralDirRecordsOnThisDisk = this.reader.readInt(8), 
                    this.centralDirRecords = this.reader.readInt(8), this.centralDirSize = this.reader.readInt(8), 
                    this.centralDirOffset = this.reader.readInt(8), this.zip64ExtensibleData = {};
                    for (var extraFieldId, extraFieldLength, extraFieldValue, extraDataSize = this.zip64EndOfCentralSize - 44; 0 < extraDataSize; ) extraFieldId = this.reader.readInt(2), 
                    extraFieldLength = this.reader.readInt(4), extraFieldValue = this.reader.readData(extraFieldLength), 
                    this.zip64ExtensibleData[extraFieldId] = {
                        id: extraFieldId,
                        length: extraFieldLength,
                        value: extraFieldValue
                    };
                },
                readBlockZip64EndOfCentralLocator: function() {
                    if (this.diskWithZip64CentralDirStart = this.reader.readInt(4), this.relativeOffsetEndOfZip64CentralDir = this.reader.readInt(8), 
                    this.disksCount = this.reader.readInt(4), 1 < this.disksCount) throw new Error("Multi-volumes zip are not supported");
                },
                readLocalFiles: function() {
                    var i, file;
                    for (i = 0; i < this.files.length; i++) file = this.files[i], this.reader.setIndex(file.localHeaderOffset), 
                    this.checkSignature(sig.LOCAL_FILE_HEADER), file.readLocalPart(this.reader), file.handleUTF8(), 
                    file.processAttributes();
                },
                readCentralDir: function() {
                    var file;
                    for (this.reader.setIndex(this.centralDirOffset); this.reader.readAndCheckSignature(sig.CENTRAL_FILE_HEADER); ) (file = new ZipEntry({
                        zip64: this.zip64
                    }, this.loadOptions)).readCentralPart(this.reader), this.files.push(file);
                    if (this.centralDirRecords !== this.files.length && 0 !== this.centralDirRecords && 0 === this.files.length) throw new Error("Corrupted zip or bug: expected " + this.centralDirRecords + " records in central dir, got " + this.files.length);
                },
                readEndOfCentral: function() {
                    var offset = this.reader.lastIndexOfSignature(sig.CENTRAL_DIRECTORY_END);
                    if (offset < 0) throw !this.isSignature(0, sig.LOCAL_FILE_HEADER) ? new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html") : new Error("Corrupted zip: can't find end of central directory");
                    this.reader.setIndex(offset);
                    var endOfCentralDirOffset = offset;
                    if (this.checkSignature(sig.CENTRAL_DIRECTORY_END), this.readBlockEndOfCentral(), 
                    this.diskNumber === utils.MAX_VALUE_16BITS || this.diskWithCentralDirStart === utils.MAX_VALUE_16BITS || this.centralDirRecordsOnThisDisk === utils.MAX_VALUE_16BITS || this.centralDirRecords === utils.MAX_VALUE_16BITS || this.centralDirSize === utils.MAX_VALUE_32BITS || this.centralDirOffset === utils.MAX_VALUE_32BITS) {
                        if (this.zip64 = !0, (offset = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR)) < 0) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");
                        if (this.reader.setIndex(offset), this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_LOCATOR), 
                        this.readBlockZip64EndOfCentralLocator(), !this.isSignature(this.relativeOffsetEndOfZip64CentralDir, sig.ZIP64_CENTRAL_DIRECTORY_END) && (this.relativeOffsetEndOfZip64CentralDir = this.reader.lastIndexOfSignature(sig.ZIP64_CENTRAL_DIRECTORY_END), 
                        this.relativeOffsetEndOfZip64CentralDir < 0)) throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");
                        this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir), this.checkSignature(sig.ZIP64_CENTRAL_DIRECTORY_END), 
                        this.readBlockZip64EndOfCentral();
                    }
                    var expectedEndOfCentralDirOffset = this.centralDirOffset + this.centralDirSize;
                    this.zip64 && (expectedEndOfCentralDirOffset += 20, expectedEndOfCentralDirOffset += 12 + this.zip64EndOfCentralSize);
                    var extraBytes = endOfCentralDirOffset - expectedEndOfCentralDirOffset;
                    if (0 < extraBytes) this.isSignature(endOfCentralDirOffset, sig.CENTRAL_FILE_HEADER) || (this.reader.zero = extraBytes); else if (extraBytes < 0) throw new Error("Corrupted zip: missing " + Math.abs(extraBytes) + " bytes.");
                },
                prepareReader: function(data) {
                    this.reader = readerFor(data);
                },
                load: function(data) {
                    this.prepareReader(data), this.readEndOfCentral(), this.readCentralDir(), this.readLocalFiles();
                }
            }, module.exports = ZipEntries;
        }, {
            "./reader/readerFor": 176,
            "./signature": 177,
            "./support": 184,
            "./utf8": 185,
            "./utils": 186,
            "./zipEntry": 188
        } ],
        188: [ function(require, module, exports) {
            "use strict";
            var readerFor = require("./reader/readerFor"), utils = require("./utils"), CompressedObject = require("./compressedObject"), crc32fn = require("./crc32"), utf8 = require("./utf8"), compressions = require("./compressions"), support = require("./support");
            function ZipEntry(options, loadOptions) {
                this.options = options, this.loadOptions = loadOptions;
            }
            ZipEntry.prototype = {
                isEncrypted: function() {
                    return 1 == (1 & this.bitFlag);
                },
                useUTF8: function() {
                    return 2048 == (2048 & this.bitFlag);
                },
                readLocalPart: function(reader) {
                    var compression, localExtraFieldsLength;
                    if (reader.skip(22), this.fileNameLength = reader.readInt(2), localExtraFieldsLength = reader.readInt(2), 
                    this.fileName = reader.readData(this.fileNameLength), reader.skip(localExtraFieldsLength), 
                    -1 === this.compressedSize || -1 === this.uncompressedSize) throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize === -1 || uncompressedSize === -1)");
                    if (null === (compression = function(compressionMethod) {
                        for (var method in compressions) if (compressions.hasOwnProperty(method) && compressions[method].magic === compressionMethod) return compressions[method];
                        return null;
                    }(this.compressionMethod))) throw new Error("Corrupted zip : compression " + utils.pretty(this.compressionMethod) + " unknown (inner file : " + utils.transformTo("string", this.fileName) + ")");
                    this.decompressed = new CompressedObject(this.compressedSize, this.uncompressedSize, this.crc32, compression, reader.readData(this.compressedSize));
                },
                readCentralPart: function(reader) {
                    this.versionMadeBy = reader.readInt(2), reader.skip(2), this.bitFlag = reader.readInt(2), 
                    this.compressionMethod = reader.readString(2), this.date = reader.readDate(), this.crc32 = reader.readInt(4), 
                    this.compressedSize = reader.readInt(4), this.uncompressedSize = reader.readInt(4);
                    var fileNameLength = reader.readInt(2);
                    if (this.extraFieldsLength = reader.readInt(2), this.fileCommentLength = reader.readInt(2), 
                    this.diskNumberStart = reader.readInt(2), this.internalFileAttributes = reader.readInt(2), 
                    this.externalFileAttributes = reader.readInt(4), this.localHeaderOffset = reader.readInt(4), 
                    this.isEncrypted()) throw new Error("Encrypted zip are not supported");
                    reader.skip(fileNameLength), this.readExtraFields(reader), this.parseZIP64ExtraField(reader), 
                    this.fileComment = reader.readData(this.fileCommentLength);
                },
                processAttributes: function() {
                    this.unixPermissions = null, this.dosPermissions = null;
                    var madeBy = this.versionMadeBy >> 8;
                    this.dir = !!(16 & this.externalFileAttributes), 0 === madeBy && (this.dosPermissions = 63 & this.externalFileAttributes), 
                    3 === madeBy && (this.unixPermissions = this.externalFileAttributes >> 16 & 65535), 
                    this.dir || "/" !== this.fileNameStr.slice(-1) || (this.dir = !0);
                },
                parseZIP64ExtraField: function(reader) {
                    if (this.extraFields[1]) {
                        var extraReader = readerFor(this.extraFields[1].value);
                        this.uncompressedSize === utils.MAX_VALUE_32BITS && (this.uncompressedSize = extraReader.readInt(8)), 
                        this.compressedSize === utils.MAX_VALUE_32BITS && (this.compressedSize = extraReader.readInt(8)), 
                        this.localHeaderOffset === utils.MAX_VALUE_32BITS && (this.localHeaderOffset = extraReader.readInt(8)), 
                        this.diskNumberStart === utils.MAX_VALUE_32BITS && (this.diskNumberStart = extraReader.readInt(4));
                    }
                },
                readExtraFields: function(reader) {
                    var extraFieldId, extraFieldLength, extraFieldValue, end = reader.index + this.extraFieldsLength;
                    for (this.extraFields || (this.extraFields = {}); reader.index < end; ) extraFieldId = reader.readInt(2), 
                    extraFieldLength = reader.readInt(2), extraFieldValue = reader.readData(extraFieldLength), 
                    this.extraFields[extraFieldId] = {
                        id: extraFieldId,
                        length: extraFieldLength,
                        value: extraFieldValue
                    };
                },
                handleUTF8: function() {
                    var decodeParamType = support.uint8array ? "uint8array" : "array";
                    if (this.useUTF8()) this.fileNameStr = utf8.utf8decode(this.fileName), this.fileCommentStr = utf8.utf8decode(this.fileComment); else {
                        var upath = this.findExtraFieldUnicodePath();
                        if (null !== upath) this.fileNameStr = upath; else {
                            var fileNameByteArray = utils.transformTo(decodeParamType, this.fileName);
                            this.fileNameStr = this.loadOptions.decodeFileName(fileNameByteArray);
                        }
                        var ucomment = this.findExtraFieldUnicodeComment();
                        if (null !== ucomment) this.fileCommentStr = ucomment; else {
                            var commentByteArray = utils.transformTo(decodeParamType, this.fileComment);
                            this.fileCommentStr = this.loadOptions.decodeFileName(commentByteArray);
                        }
                    }
                },
                findExtraFieldUnicodePath: function() {
                    var upathField = this.extraFields[28789];
                    if (upathField) {
                        var extraReader = readerFor(upathField.value);
                        return 1 !== extraReader.readInt(1) ? null : crc32fn(this.fileName) !== extraReader.readInt(4) ? null : utf8.utf8decode(extraReader.readData(upathField.length - 5));
                    }
                    return null;
                },
                findExtraFieldUnicodeComment: function() {
                    var ucommentField = this.extraFields[25461];
                    if (ucommentField) {
                        var extraReader = readerFor(ucommentField.value);
                        return 1 !== extraReader.readInt(1) ? null : crc32fn(this.fileComment) !== extraReader.readInt(4) ? null : utf8.utf8decode(extraReader.readData(ucommentField.length - 5));
                    }
                    return null;
                }
            }, module.exports = ZipEntry;
        }, {
            "./compressedObject": 156,
            "./compressions": 157,
            "./crc32": 158,
            "./reader/readerFor": 176,
            "./support": 184,
            "./utf8": 185,
            "./utils": 186
        } ],
        189: [ function(require, module, exports) {
            "use strict";
            var StreamHelper = require("./stream/StreamHelper"), DataWorker = require("./stream/DataWorker"), utf8 = require("./utf8"), CompressedObject = require("./compressedObject"), GenericWorker = require("./stream/GenericWorker"), ZipObject = function(name, data, options) {
                this.name = name, this.dir = options.dir, this.date = options.date, this.comment = options.comment, 
                this.unixPermissions = options.unixPermissions, this.dosPermissions = options.dosPermissions, 
                this._data = data, this._dataBinary = options.binary, this.options = {
                    compression: options.compression,
                    compressionOptions: options.compressionOptions
                };
            };
            ZipObject.prototype = {
                internalStream: function(type) {
                    var result = null, outputType = "string";
                    try {
                        if (!type) throw new Error("No output type specified.");
                        var askUnicodeString = "string" === (outputType = type.toLowerCase()) || "text" === outputType;
                        "binarystring" !== outputType && "text" !== outputType || (outputType = "string"), 
                        result = this._decompressWorker();
                        var isUnicodeString = !this._dataBinary;
                        isUnicodeString && !askUnicodeString && (result = result.pipe(new utf8.Utf8EncodeWorker())), 
                        !isUnicodeString && askUnicodeString && (result = result.pipe(new utf8.Utf8DecodeWorker()));
                    } catch (e) {
                        (result = new GenericWorker("error")).error(e);
                    }
                    return new StreamHelper(result, outputType, "");
                },
                async: function(type, onUpdate) {
                    return this.internalStream(type).accumulate(onUpdate);
                },
                nodeStream: function(type, onUpdate) {
                    return this.internalStream(type || "nodebuffer").toNodejsStream(onUpdate);
                },
                _compressWorker: function(compression, compressionOptions) {
                    if (this._data instanceof CompressedObject && this._data.compression.magic === compression.magic) return this._data.getCompressedWorker();
                    var result = this._decompressWorker();
                    return this._dataBinary || (result = result.pipe(new utf8.Utf8EncodeWorker())), 
                    CompressedObject.createWorkerFrom(result, compression, compressionOptions);
                },
                _decompressWorker: function() {
                    return this._data instanceof CompressedObject ? this._data.getContentWorker() : this._data instanceof GenericWorker ? this._data : new DataWorker(this._data);
                }
            };
            for (var removedMethods = [ "asText", "asBinary", "asNodeBuffer", "asUint8Array", "asArrayBuffer" ], removedFn = function() {
                throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.");
            }, i = 0; i < removedMethods.length; i++) ZipObject.prototype[removedMethods[i]] = removedFn;
            module.exports = ZipObject;
        }, {
            "./compressedObject": 156,
            "./stream/DataWorker": 181,
            "./stream/GenericWorker": 182,
            "./stream/StreamHelper": 183,
            "./utf8": 185
        } ],
        190: [ function(require, module, exports) {
            "use strict";
            var immediate = require("immediate");
            function INTERNAL() {}
            var handlers = {}, REJECTED = [ "REJECTED" ], FULFILLED = [ "FULFILLED" ], PENDING = [ "PENDING" ];
            function Promise(resolver) {
                if ("function" != typeof resolver) throw new TypeError("resolver must be a function");
                this.state = PENDING, this.queue = [], this.outcome = void 0, resolver !== INTERNAL && safelyResolveThenable(this, resolver);
            }
            function QueueItem(promise, onFulfilled, onRejected) {
                this.promise = promise, "function" == typeof onFulfilled && (this.onFulfilled = onFulfilled, 
                this.callFulfilled = this.otherCallFulfilled), "function" == typeof onRejected && (this.onRejected = onRejected, 
                this.callRejected = this.otherCallRejected);
            }
            function unwrap(promise, func, value) {
                immediate(function() {
                    var returnValue;
                    try {
                        returnValue = func(value);
                    } catch (e) {
                        return handlers.reject(promise, e);
                    }
                    returnValue === promise ? handlers.reject(promise, new TypeError("Cannot resolve promise with itself")) : handlers.resolve(promise, returnValue);
                });
            }
            function getThen(obj) {
                var then = obj && obj.then;
                if (obj && ("object" == typeof obj || "function" == typeof obj) && "function" == typeof then) return function() {
                    then.apply(obj, arguments);
                };
            }
            function safelyResolveThenable(self, thenable) {
                var called = !1;
                function onError(value) {
                    called || (called = !0, handlers.reject(self, value));
                }
                function onSuccess(value) {
                    called || (called = !0, handlers.resolve(self, value));
                }
                var result = tryCatch(function() {
                    thenable(onSuccess, onError);
                });
                "error" === result.status && onError(result.value);
            }
            function tryCatch(func, value) {
                var out = {};
                try {
                    out.value = func(value), out.status = "success";
                } catch (e) {
                    out.status = "error", out.value = e;
                }
                return out;
            }
            (module.exports = Promise).prototype.catch = function(onRejected) {
                return this.then(null, onRejected);
            }, Promise.prototype.then = function(onFulfilled, onRejected) {
                if ("function" != typeof onFulfilled && this.state === FULFILLED || "function" != typeof onRejected && this.state === REJECTED) return this;
                var promise = new this.constructor(INTERNAL);
                this.state !== PENDING ? unwrap(promise, this.state === FULFILLED ? onFulfilled : onRejected, this.outcome) : this.queue.push(new QueueItem(promise, onFulfilled, onRejected));
                return promise;
            }, QueueItem.prototype.callFulfilled = function(value) {
                handlers.resolve(this.promise, value);
            }, QueueItem.prototype.otherCallFulfilled = function(value) {
                unwrap(this.promise, this.onFulfilled, value);
            }, QueueItem.prototype.callRejected = function(value) {
                handlers.reject(this.promise, value);
            }, QueueItem.prototype.otherCallRejected = function(value) {
                unwrap(this.promise, this.onRejected, value);
            }, handlers.resolve = function(self, value) {
                var result = tryCatch(getThen, value);
                if ("error" === result.status) return handlers.reject(self, result.value);
                var thenable = result.value;
                if (thenable) safelyResolveThenable(self, thenable); else {
                    self.state = FULFILLED, self.outcome = value;
                    for (var i = -1, len = self.queue.length; ++i < len; ) self.queue[i].callFulfilled(value);
                }
                return self;
            }, handlers.reject = function(self, error) {
                self.state = REJECTED, self.outcome = error;
                for (var i = -1, len = self.queue.length; ++i < len; ) self.queue[i].callRejected(error);
                return self;
            }, Promise.resolve = function(value) {
                if (value instanceof this) return value;
                return handlers.resolve(new this(INTERNAL), value);
            }, Promise.reject = function(reason) {
                var promise = new this(INTERNAL);
                return handlers.reject(promise, reason);
            }, Promise.all = function(iterable) {
                var self = this;
                if ("[object Array]" !== Object.prototype.toString.call(iterable)) return this.reject(new TypeError("must be an array"));
                var len = iterable.length, called = !1;
                if (!len) return this.resolve([]);
                var values = new Array(len), resolved = 0, i = -1, promise = new this(INTERNAL);
                for (;++i < len; ) allResolver(iterable[i], i);
                return promise;
                function allResolver(value, i) {
                    self.resolve(value).then(function(outValue) {
                        values[i] = outValue, ++resolved !== len || called || (called = !0, handlers.resolve(promise, values));
                    }, function(error) {
                        called || (called = !0, handlers.reject(promise, error));
                    });
                }
            }, Promise.race = function(iterable) {
                var self = this;
                if ("[object Array]" !== Object.prototype.toString.call(iterable)) return this.reject(new TypeError("must be an array"));
                var len = iterable.length, called = !1;
                if (!len) return this.resolve([]);
                var i = -1, promise = new this(INTERNAL);
                for (;++i < len; ) value = iterable[i], self.resolve(value).then(function(response) {
                    called || (called = !0, handlers.resolve(promise, response));
                }, function(error) {
                    called || (called = !0, handlers.reject(promise, error));
                });
                var value;
                return promise;
            };
        }, {
            immediate: 151
        } ],
        191: [ function(require, module, exports) {
            (function(global) {
                (function() {
                    var undefined, LARGE_ARRAY_SIZE = 200, CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.", FUNC_ERROR_TEXT = "Expected a function", HASH_UNDEFINED = "__lodash_hash_undefined__", MAX_MEMOIZE_SIZE = 500, PLACEHOLDER = "__lodash_placeholder__", CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4, COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2, WRAP_BIND_FLAG = 1, WRAP_BIND_KEY_FLAG = 2, WRAP_CURRY_BOUND_FLAG = 4, WRAP_CURRY_FLAG = 8, WRAP_CURRY_RIGHT_FLAG = 16, WRAP_PARTIAL_FLAG = 32, WRAP_PARTIAL_RIGHT_FLAG = 64, WRAP_ARY_FLAG = 128, WRAP_REARG_FLAG = 256, WRAP_FLIP_FLAG = 512, DEFAULT_TRUNC_LENGTH = 30, DEFAULT_TRUNC_OMISSION = "...", HOT_COUNT = 800, HOT_SPAN = 16, LAZY_FILTER_FLAG = 1, LAZY_MAP_FLAG = 2, INFINITY = 1 / 0, MAX_SAFE_INTEGER = 9007199254740991, MAX_INTEGER = 17976931348623157e292, NAN = NaN, MAX_ARRAY_LENGTH = 4294967295, MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH - 1, HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1, wrapFlags = [ [ "ary", WRAP_ARY_FLAG ], [ "bind", WRAP_BIND_FLAG ], [ "bindKey", WRAP_BIND_KEY_FLAG ], [ "curry", WRAP_CURRY_FLAG ], [ "curryRight", WRAP_CURRY_RIGHT_FLAG ], [ "flip", WRAP_FLIP_FLAG ], [ "partial", WRAP_PARTIAL_FLAG ], [ "partialRight", WRAP_PARTIAL_RIGHT_FLAG ], [ "rearg", WRAP_REARG_FLAG ] ], argsTag = "[object Arguments]", arrayTag = "[object Array]", asyncTag = "[object AsyncFunction]", boolTag = "[object Boolean]", dateTag = "[object Date]", domExcTag = "[object DOMException]", errorTag = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag = "[object Map]", numberTag = "[object Number]", nullTag = "[object Null]", objectTag = "[object Object]", proxyTag = "[object Proxy]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]", undefinedTag = "[object Undefined]", weakMapTag = "[object WeakMap]", weakSetTag = "[object WeakSet]", arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", 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]", reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g, reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, reUnescapedHtml = /[&<>"']/g, reHasEscapedHtml = RegExp(reEscapedHtml.source), reHasUnescapedHtml = RegExp(reUnescapedHtml.source), reEscape = /<%-([\s\S]+?)%>/g, reEvaluate = /<%([\s\S]+?)%>/g, reInterpolate = /<%=([\s\S]+?)%>/g, reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/, rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, reRegExpChar = /[\\^$.*+?()[\]{}|]/g, reHasRegExpChar = RegExp(reRegExpChar.source), reTrim = /^\s+|\s+$/g, reTrimStart = /^\s+/, reTrimEnd = /\s+$/, reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/, reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/, reSplitDetails = /,? & /, reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, reEscapeChar = /\\(\\)?/g, reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, reFlags = /\w*$/, reIsBadHex = /^[-+]0x[0-9a-f]+$/i, reIsBinary = /^0b[01]+$/i, reIsHostCtor = /^\[object .+?Constructor\]$/, reIsOctal = /^0o[0-7]+$/i, reIsUint = /^(?:0|[1-9]\d*)$/, reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, reNoMatch = /($^)/, reUnescapedString = /['\n\r\u2028\u2029\\]/g, rsComboRange = "\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff", rsBreakRange = "\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", rsAstral = "[\\ud800-\\udfff]", rsBreak = "[" + rsBreakRange + "]", rsCombo = "[" + rsComboRange + "]", rsDigits = "\\d+", rsDingbat = "[\\u2700-\\u27bf]", rsLower = "[a-z\\xdf-\\xf6\\xf8-\\xff]", rsMisc = "[^\\ud800-\\udfff" + rsBreakRange + rsDigits + "\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]", rsFitz = "\\ud83c[\\udffb-\\udfff]", rsNonAstral = "[^\\ud800-\\udfff]", rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}", rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]", rsUpper = "[A-Z\\xc0-\\xd6\\xd8-\\xde]", rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")", rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")", reOptMod = "(?:" + rsCombo + "|" + rsFitz + ")" + "?", rsSeq = "[\\ufe0e\\ufe0f]?" + reOptMod + ("(?:\\u200d(?:" + [ rsNonAstral, rsRegional, rsSurrPair ].join("|") + ")[\\ufe0e\\ufe0f]?" + reOptMod + ")*"), rsEmoji = "(?:" + [ rsDingbat, rsRegional, rsSurrPair ].join("|") + ")" + rsSeq, rsSymbol = "(?:" + [ rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral ].join("|") + ")", reApos = RegExp("['’]", "g"), reComboMark = RegExp(rsCombo, "g"), reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g"), reUnicodeWord = RegExp([ rsUpper + "?" + rsLower + "+(?:['’](?:d|ll|m|re|s|t|ve))?(?=" + [ rsBreak, rsUpper, "$" ].join("|") + ")", rsMiscUpper + "+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=" + [ rsBreak, rsUpper + rsMiscLower, "$" ].join("|") + ")", rsUpper + "?" + rsMiscLower + "+(?:['’](?:d|ll|m|re|s|t|ve))?", rsUpper + "+(?:['’](?:D|LL|M|RE|S|T|VE))?", "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])", "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])", rsDigits, rsEmoji ].join("|"), "g"), reHasUnicode = RegExp("[\\u200d\\ud800-\\udfff" + rsComboRange + "\\ufe0e\\ufe0f]"), reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, contextProps = [ "Array", "Buffer", "DataView", "Date", "Error", "Float32Array", "Float64Array", "Function", "Int8Array", "Int16Array", "Int32Array", "Map", "Math", "Object", "Promise", "RegExp", "Set", "String", "Symbol", "TypeError", "Uint8Array", "Uint8ClampedArray", "Uint16Array", "Uint32Array", "WeakMap", "_", "clearTimeout", "isFinite", "parseInt", "setTimeout" ], templateCounter = -1, typedArrayTags = {};
                    typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = !0, 
                    typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = !1;
                    var cloneableTags = {};
                    cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = !0, 
                    cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = !1;
                    var stringEscapes = {
                        "\\": "\\",
                        "'": "'",
                        "\n": "n",
                        "\r": "r",
                        "\u2028": "u2028",
                        "\u2029": "u2029"
                    }, freeParseFloat = parseFloat, freeParseInt = parseInt, freeGlobal = "object" == typeof global && global && global.Object === Object && global, freeSelf = "object" == typeof self && self && self.Object === Object && self, root = freeGlobal || freeSelf || Function("return this")(), freeExports = "object" == typeof exports && exports && !exports.nodeType && exports, freeModule = freeExports && "object" == typeof module && module && !module.nodeType && module, moduleExports = freeModule && freeModule.exports === freeExports, freeProcess = moduleExports && freeGlobal.process, nodeUtil = function() {
                        try {
                            var types = freeModule && freeModule.require && freeModule.require("util").types;
                            return types || freeProcess && freeProcess.binding && freeProcess.binding("util");
                        } catch (e) {}
                    }(), nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer, nodeIsDate = nodeUtil && nodeUtil.isDate, nodeIsMap = nodeUtil && nodeUtil.isMap, nodeIsRegExp = nodeUtil && nodeUtil.isRegExp, nodeIsSet = nodeUtil && nodeUtil.isSet, nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
                    function apply(func, thisArg, args) {
                        switch (args.length) {
                          case 0:
                            return func.call(thisArg);

                          case 1:
                            return func.call(thisArg, args[0]);

                          case 2:
                            return func.call(thisArg, args[0], args[1]);

                          case 3:
                            return func.call(thisArg, args[0], args[1], args[2]);
                        }
                        return func.apply(thisArg, args);
                    }
                    function arrayAggregator(array, setter, iteratee, accumulator) {
                        for (var index = -1, length = null == array ? 0 : array.length; ++index < length; ) {
                            var value = array[index];
                            setter(accumulator, value, iteratee(value), array);
                        }
                        return accumulator;
                    }
                    function arrayEach(array, iteratee) {
                        for (var index = -1, length = null == array ? 0 : array.length; ++index < length && !1 !== iteratee(array[index], index, array); ) ;
                        return array;
                    }
                    function arrayEachRight(array, iteratee) {
                        for (var length = null == array ? 0 : array.length; length-- && !1 !== iteratee(array[length], length, array); ) ;
                        return array;
                    }
                    function arrayEvery(array, predicate) {
                        for (var index = -1, length = null == array ? 0 : array.length; ++index < length; ) if (!predicate(array[index], index, array)) return !1;
                        return !0;
                    }
                    function arrayFilter(array, predicate) {
                        for (var index = -1, length = null == array ? 0 : array.length, resIndex = 0, result = []; ++index < length; ) {
                            var value = array[index];
                            predicate(value, index, array) && (result[resIndex++] = value);
                        }
                        return result;
                    }
                    function arrayIncludes(array, value) {
                        return !!(null == array ? 0 : array.length) && -1 < baseIndexOf(array, value, 0);
                    }
                    function arrayIncludesWith(array, value, comparator) {
                        for (var index = -1, length = null == array ? 0 : array.length; ++index < length; ) if (comparator(value, array[index])) return !0;
                        return !1;
                    }
                    function arrayMap(array, iteratee) {
                        for (var index = -1, length = null == array ? 0 : array.length, result = Array(length); ++index < length; ) result[index] = iteratee(array[index], index, array);
                        return result;
                    }
                    function arrayPush(array, values) {
                        for (var index = -1, length = values.length, offset = array.length; ++index < length; ) array[offset + index] = values[index];
                        return array;
                    }
                    function arrayReduce(array, iteratee, accumulator, initAccum) {
                        var index = -1, length = null == array ? 0 : array.length;
                        for (initAccum && length && (accumulator = array[++index]); ++index < length; ) accumulator = iteratee(accumulator, array[index], index, array);
                        return accumulator;
                    }
                    function arrayReduceRight(array, iteratee, accumulator, initAccum) {
                        var length = null == array ? 0 : array.length;
                        for (initAccum && length && (accumulator = array[--length]); length--; ) accumulator = iteratee(accumulator, array[length], length, array);
                        return accumulator;
                    }
                    function arraySome(array, predicate) {
                        for (var index = -1, length = null == array ? 0 : array.length; ++index < length; ) if (predicate(array[index], index, array)) return !0;
                        return !1;
                    }
                    var asciiSize = baseProperty("length");
                    function baseFindKey(collection, predicate, eachFunc) {
                        var result;
                        return eachFunc(collection, function(value, key, collection) {
                            if (predicate(value, key, collection)) return result = key, !1;
                        }), result;
                    }
                    function baseFindIndex(array, predicate, fromIndex, fromRight) {
                        for (var length = array.length, index = fromIndex + (fromRight ? 1 : -1); fromRight ? index-- : ++index < length; ) if (predicate(array[index], index, array)) return index;
                        return -1;
                    }
                    function baseIndexOf(array, value, fromIndex) {
                        return value == value ? function(array, value, fromIndex) {
                            var index = fromIndex - 1, length = array.length;
                            for (;++index < length; ) if (array[index] === value) return index;
                            return -1;
                        }(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
                    }
                    function baseIndexOfWith(array, value, fromIndex, comparator) {
                        for (var index = fromIndex - 1, length = array.length; ++index < length; ) if (comparator(array[index], value)) return index;
                        return -1;
                    }
                    function baseIsNaN(value) {
                        return value != value;
                    }
                    function baseMean(array, iteratee) {
                        var length = null == array ? 0 : array.length;
                        return length ? baseSum(array, iteratee) / length : NAN;
                    }
                    function baseProperty(key) {
                        return function(object) {
                            return null == object ? undefined : object[key];
                        };
                    }
                    function basePropertyOf(object) {
                        return function(key) {
                            return null == object ? undefined : object[key];
                        };
                    }
                    function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
                        return eachFunc(collection, function(value, index, collection) {
                            accumulator = initAccum ? (initAccum = !1, value) : iteratee(accumulator, value, index, collection);
                        }), accumulator;
                    }
                    function baseSum(array, iteratee) {
                        for (var result, index = -1, length = array.length; ++index < length; ) {
                            var current = iteratee(array[index]);
                            current !== undefined && (result = result === undefined ? current : result + current);
                        }
                        return result;
                    }
                    function baseTimes(n, iteratee) {
                        for (var index = -1, result = Array(n); ++index < n; ) result[index] = iteratee(index);
                        return result;
                    }
                    function baseUnary(func) {
                        return function(value) {
                            return func(value);
                        };
                    }
                    function baseValues(object, props) {
                        return arrayMap(props, function(key) {
                            return object[key];
                        });
                    }
                    function cacheHas(cache, key) {
                        return cache.has(key);
                    }
                    function charsStartIndex(strSymbols, chrSymbols) {
                        for (var index = -1, length = strSymbols.length; ++index < length && -1 < baseIndexOf(chrSymbols, strSymbols[index], 0); ) ;
                        return index;
                    }
                    function charsEndIndex(strSymbols, chrSymbols) {
                        for (var index = strSymbols.length; index-- && -1 < baseIndexOf(chrSymbols, strSymbols[index], 0); ) ;
                        return index;
                    }
                    var deburrLetter = basePropertyOf({
                        "À": "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",
                        "Ā": "A",
                        "Ă": "A",
                        "Ą": "A",
                        "ā": "a",
                        "ă": "a",
                        "ą": "a",
                        "Ć": "C",
                        "Ĉ": "C",
                        "Ċ": "C",
                        "Č": "C",
                        "ć": "c",
                        "ĉ": "c",
                        "ċ": "c",
                        "č": "c",
                        "Ď": "D",
                        "Đ": "D",
                        "ď": "d",
                        "đ": "d",
                        "Ē": "E",
                        "Ĕ": "E",
                        "Ė": "E",
                        "Ę": "E",
                        "Ě": "E",
                        "ē": "e",
                        "ĕ": "e",
                        "ė": "e",
                        "ę": "e",
                        "ě": "e",
                        "Ĝ": "G",
                        "Ğ": "G",
                        "Ġ": "G",
                        "Ģ": "G",
                        "ĝ": "g",
                        "ğ": "g",
                        "ġ": "g",
                        "ģ": "g",
                        "Ĥ": "H",
                        "Ħ": "H",
                        "ĥ": "h",
                        "ħ": "h",
                        "Ĩ": "I",
                        "Ī": "I",
                        "Ĭ": "I",
                        "Į": "I",
                        "İ": "I",
                        "ĩ": "i",
                        "ī": "i",
                        "ĭ": "i",
                        "į": "i",
                        "ı": "i",
                        "Ĵ": "J",
                        "ĵ": "j",
                        "Ķ": "K",
                        "ķ": "k",
                        "ĸ": "k",
                        "Ĺ": "L",
                        "Ļ": "L",
                        "Ľ": "L",
                        "Ŀ": "L",
                        "Ł": "L",
                        "ĺ": "l",
                        "ļ": "l",
                        "ľ": "l",
                        "ŀ": "l",
                        "ł": "l",
                        "Ń": "N",
                        "Ņ": "N",
                        "Ň": "N",
                        "Ŋ": "N",
                        "ń": "n",
                        "ņ": "n",
                        "ň": "n",
                        "ŋ": "n",
                        "Ō": "O",
                        "Ŏ": "O",
                        "Ő": "O",
                        "ō": "o",
                        "ŏ": "o",
                        "ő": "o",
                        "Ŕ": "R",
                        "Ŗ": "R",
                        "Ř": "R",
                        "ŕ": "r",
                        "ŗ": "r",
                        "ř": "r",
                        "Ś": "S",
                        "Ŝ": "S",
                        "Ş": "S",
                        "Š": "S",
                        "ś": "s",
                        "ŝ": "s",
                        "ş": "s",
                        "š": "s",
                        "Ţ": "T",
                        "Ť": "T",
                        "Ŧ": "T",
                        "ţ": "t",
                        "ť": "t",
                        "ŧ": "t",
                        "Ũ": "U",
                        "Ū": "U",
                        "Ŭ": "U",
                        "Ů": "U",
                        "Ű": "U",
                        "Ų": "U",
                        "ũ": "u",
                        "ū": "u",
                        "ŭ": "u",
                        "ů": "u",
                        "ű": "u",
                        "ų": "u",
                        "Ŵ": "W",
                        "ŵ": "w",
                        "Ŷ": "Y",
                        "ŷ": "y",
                        "Ÿ": "Y",
                        "Ź": "Z",
                        "Ż": "Z",
                        "Ž": "Z",
                        "ź": "z",
                        "ż": "z",
                        "ž": "z",
                        "Ĳ": "IJ",
                        "ĳ": "ij",
                        "Œ": "Oe",
                        "œ": "oe",
                        "ŉ": "'n",
                        "ſ": "s"
                    }), escapeHtmlChar = basePropertyOf({
                        "&": "&amp;",
                        "<": "&lt;",
                        ">": "&gt;",
                        '"': "&quot;",
                        "'": "&#39;"
                    });
                    function escapeStringChar(chr) {
                        return "\\" + stringEscapes[chr];
                    }
                    function hasUnicode(string) {
                        return reHasUnicode.test(string);
                    }
                    function mapToArray(map) {
                        var index = -1, result = Array(map.size);
                        return map.forEach(function(value, key) {
                            result[++index] = [ key, value ];
                        }), result;
                    }
                    function overArg(func, transform) {
                        return function(arg) {
                            return func(transform(arg));
                        };
                    }
                    function replaceHolders(array, placeholder) {
                        for (var index = -1, length = array.length, resIndex = 0, result = []; ++index < length; ) {
                            var value = array[index];
                            value !== placeholder && value !== PLACEHOLDER || (array[index] = PLACEHOLDER, result[resIndex++] = index);
                        }
                        return result;
                    }
                    function safeGet(object, key) {
                        return "__proto__" == key ? undefined : object[key];
                    }
                    function setToArray(set) {
                        var index = -1, result = Array(set.size);
                        return set.forEach(function(value) {
                            result[++index] = value;
                        }), result;
                    }
                    function setToPairs(set) {
                        var index = -1, result = Array(set.size);
                        return set.forEach(function(value) {
                            result[++index] = [ value, value ];
                        }), result;
                    }
                    function stringSize(string) {
                        return hasUnicode(string) ? function(string) {
                            var result = reUnicode.lastIndex = 0;
                            for (;reUnicode.test(string); ) ++result;
                            return result;
                        }(string) : asciiSize(string);
                    }
                    function stringToArray(string) {
                        return hasUnicode(string) ? function(string) {
                            return string.match(reUnicode) || [];
                        }(string) : function(string) {
                            return string.split("");
                        }(string);
                    }
                    var unescapeHtmlChar = basePropertyOf({
                        "&amp;": "&",
                        "&lt;": "<",
                        "&gt;": ">",
                        "&quot;": '"',
                        "&#39;": "'"
                    });
                    var _ = function runInContext(context) {
                        var uid, Array = (context = null == context ? root : _.defaults(root.Object(), context, _.pick(root, contextProps))).Array, Date = context.Date, Error = context.Error, Function = context.Function, Math = context.Math, Object = context.Object, RegExp = context.RegExp, String = context.String, TypeError = context.TypeError, arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype, coreJsData = context["__core-js_shared__"], funcToString = funcProto.toString, hasOwnProperty = objectProto.hasOwnProperty, idCounter = 0, maskSrcKey = (uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "")) ? "Symbol(src)_1." + uid : "", nativeObjectToString = objectProto.toString, objectCtorString = funcToString.call(Object), oldDash = root._, reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"), Buffer = moduleExports ? context.Buffer : undefined, Symbol = context.Symbol, Uint8Array = context.Uint8Array, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, getPrototype = overArg(Object.getPrototypeOf, Object), objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined, symIterator = Symbol ? Symbol.iterator : undefined, symToStringTag = Symbol ? Symbol.toStringTag : undefined, defineProperty = function() {
                            try {
                                var func = getNative(Object, "defineProperty");
                                return func({}, "", {}), func;
                            } catch (e) {}
                        }(), ctxClearTimeout = context.clearTimeout !== root.clearTimeout && context.clearTimeout, ctxNow = Date && Date.now !== root.Date.now && Date.now, ctxSetTimeout = context.setTimeout !== root.setTimeout && context.setTimeout, nativeCeil = Math.ceil, nativeFloor = Math.floor, nativeGetSymbols = Object.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeIsFinite = context.isFinite, nativeJoin = arrayProto.join, nativeKeys = overArg(Object.keys, Object), nativeMax = Math.max, nativeMin = Math.min, nativeNow = Date.now, nativeParseInt = context.parseInt, nativeRandom = Math.random, nativeReverse = arrayProto.reverse, DataView = getNative(context, "DataView"), Map = getNative(context, "Map"), Promise = getNative(context, "Promise"), Set = getNative(context, "Set"), WeakMap = getNative(context, "WeakMap"), nativeCreate = getNative(Object, "create"), metaMap = WeakMap && new WeakMap(), realNames = {}, dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap), symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined;
                        function lodash(value) {
                            if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) {
                                if (value instanceof LodashWrapper) return value;
                                if (hasOwnProperty.call(value, "__wrapped__")) return wrapperClone(value);
                            }
                            return new LodashWrapper(value);
                        }
                        var baseCreate = function() {
                            function object() {}
                            return function(proto) {
                                if (!isObject(proto)) return {};
                                if (objectCreate) return objectCreate(proto);
                                object.prototype = proto;
                                var result = new object();
                                return object.prototype = undefined, result;
                            };
                        }();
                        function baseLodash() {}
                        function LodashWrapper(value, chainAll) {
                            this.__wrapped__ = value, this.__actions__ = [], this.__chain__ = !!chainAll, this.__index__ = 0, 
                            this.__values__ = undefined;
                        }
                        function LazyWrapper(value) {
                            this.__wrapped__ = value, this.__actions__ = [], this.__dir__ = 1, this.__filtered__ = !1, 
                            this.__iteratees__ = [], this.__takeCount__ = MAX_ARRAY_LENGTH, this.__views__ = [];
                        }
                        function Hash(entries) {
                            var index = -1, length = null == entries ? 0 : entries.length;
                            for (this.clear(); ++index < length; ) {
                                var entry = entries[index];
                                this.set(entry[0], entry[1]);
                            }
                        }
                        function ListCache(entries) {
                            var index = -1, length = null == entries ? 0 : entries.length;
                            for (this.clear(); ++index < length; ) {
                                var entry = entries[index];
                                this.set(entry[0], entry[1]);
                            }
                        }
                        function MapCache(entries) {
                            var index = -1, length = null == entries ? 0 : entries.length;
                            for (this.clear(); ++index < length; ) {
                                var entry = entries[index];
                                this.set(entry[0], entry[1]);
                            }
                        }
                        function SetCache(values) {
                            var index = -1, length = null == values ? 0 : values.length;
                            for (this.__data__ = new MapCache(); ++index < length; ) this.add(values[index]);
                        }
                        function Stack(entries) {
                            var data = this.__data__ = new ListCache(entries);
                            this.size = data.size;
                        }
                        function arrayLikeKeys(value, inherited) {
                            var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
                            for (var key in value) !inherited && !hasOwnProperty.call(value, key) || skipIndexes && ("length" == key || isBuff && ("offset" == key || "parent" == key) || isType && ("buffer" == key || "byteLength" == key || "byteOffset" == key) || isIndex(key, length)) || result.push(key);
                            return result;
                        }
                        function arraySample(array) {
                            var length = array.length;
                            return length ? array[baseRandom(0, length - 1)] : undefined;
                        }
                        function arraySampleSize(array, n) {
                            return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
                        }
                        function arrayShuffle(array) {
                            return shuffleSelf(copyArray(array));
                        }
                        function assignMergeValue(object, key, value) {
                            (value === undefined || eq(object[key], value)) && (value !== undefined || key in object) || baseAssignValue(object, key, value);
                        }
                        function assignValue(object, key, value) {
                            var objValue = object[key];
                            hasOwnProperty.call(object, key) && eq(objValue, value) && (value !== undefined || key in object) || baseAssignValue(object, key, value);
                        }
                        function assocIndexOf(array, key) {
                            for (var length = array.length; length--; ) if (eq(array[length][0], key)) return length;
                            return -1;
                        }
                        function baseAggregator(collection, setter, iteratee, accumulator) {
                            return baseEach(collection, function(value, key, collection) {
                                setter(accumulator, value, iteratee(value), collection);
                            }), accumulator;
                        }
                        function baseAssign(object, source) {
                            return object && copyObject(source, keys(source), object);
                        }
                        function baseAssignValue(object, key, value) {
                            "__proto__" == key && defineProperty ? defineProperty(object, key, {
                                configurable: !0,
                                enumerable: !0,
                                value: value,
                                writable: !0
                            }) : object[key] = value;
                        }
                        function baseAt(object, paths) {
                            for (var index = -1, length = paths.length, result = Array(length), skip = null == object; ++index < length; ) result[index] = skip ? undefined : get(object, paths[index]);
                            return result;
                        }
                        function baseClamp(number, lower, upper) {
                            return number == number && (upper !== undefined && (number = number <= upper ? number : upper), 
                            lower !== undefined && (number = lower <= number ? number : lower)), number;
                        }
                        function baseClone(value, bitmask, customizer, key, object, stack) {
                            var result, isDeep = bitmask & CLONE_DEEP_FLAG, isFlat = bitmask & CLONE_FLAT_FLAG, isFull = bitmask & CLONE_SYMBOLS_FLAG;
                            if (customizer && (result = object ? customizer(value, key, object, stack) : customizer(value)), 
                            result !== undefined) return result;
                            if (!isObject(value)) return value;
                            var isArr = isArray(value);
                            if (isArr) {
                                if (result = function(array) {
                                    var length = array.length, result = new array.constructor(length);
                                    return length && "string" == typeof array[0] && hasOwnProperty.call(array, "index") && (result.index = array.index, 
                                    result.input = array.input), result;
                                }(value), !isDeep) return copyArray(value, result);
                            } else {
                                var tag = getTag(value), isFunc = tag == funcTag || tag == genTag;
                                if (isBuffer(value)) return cloneBuffer(value, isDeep);
                                if (tag == objectTag || tag == argsTag || isFunc && !object) {
                                    if (result = isFlat || isFunc ? {} : initCloneObject(value), !isDeep) return isFlat ? function(source, object) {
                                        return copyObject(source, getSymbolsIn(source), object);
                                    }(value, function(object, source) {
                                        return object && copyObject(source, keysIn(source), object);
                                    }(result, value)) : function(source, object) {
                                        return copyObject(source, getSymbols(source), object);
                                    }(value, baseAssign(result, value));
                                } else {
                                    if (!cloneableTags[tag]) return object ? value : {};
                                    result = function(object, tag, isDeep) {
                                        var symbol, regexp, result, Ctor = object.constructor;
                                        switch (tag) {
                                          case arrayBufferTag:
                                            return cloneArrayBuffer(object);

                                          case boolTag:
                                          case dateTag:
                                            return new Ctor(+object);

                                          case dataViewTag:
                                            return function(dataView, isDeep) {
                                                var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
                                                return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
                                            }(object, isDeep);

                                          case float32Tag:
                                          case float64Tag:
                                          case int8Tag:
                                          case int16Tag:
                                          case int32Tag:
                                          case uint8Tag:
                                          case uint8ClampedTag:
                                          case uint16Tag:
                                          case uint32Tag:
                                            return cloneTypedArray(object, isDeep);

                                          case mapTag:
                                            return new Ctor();

                                          case numberTag:
                                          case stringTag:
                                            return new Ctor(object);

                                          case regexpTag:
                                            return (result = new (regexp = object).constructor(regexp.source, reFlags.exec(regexp))).lastIndex = regexp.lastIndex, 
                                            result;

                                          case setTag:
                                            return new Ctor();

                                          case symbolTag:
                                            return symbol = object, symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
                                        }
                                    }(value, tag, isDeep);
                                }
                            }
                            stack || (stack = new Stack());
                            var stacked = stack.get(value);
                            if (stacked) return stacked;
                            if (stack.set(value, result), isSet(value)) return value.forEach(function(subValue) {
                                result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
                            }), result;
                            if (isMap(value)) return value.forEach(function(subValue, key) {
                                result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
                            }), result;
                            var props = isArr ? undefined : (isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys)(value);
                            return arrayEach(props || value, function(subValue, key) {
                                props && (subValue = value[key = subValue]), assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
                            }), result;
                        }
                        function baseConformsTo(object, source, props) {
                            var length = props.length;
                            if (null == object) return !length;
                            for (object = Object(object); length--; ) {
                                var key = props[length], predicate = source[key], value = object[key];
                                if (value === undefined && !(key in object) || !predicate(value)) return !1;
                            }
                            return !0;
                        }
                        function baseDelay(func, wait, args) {
                            if ("function" != typeof func) throw new TypeError(FUNC_ERROR_TEXT);
                            return setTimeout(function() {
                                func.apply(undefined, args);
                            }, wait);
                        }
                        function baseDifference(array, values, iteratee, comparator) {
                            var index = -1, includes = arrayIncludes, isCommon = !0, length = array.length, result = [], valuesLength = values.length;
                            if (!length) return result;
                            iteratee && (values = arrayMap(values, baseUnary(iteratee))), comparator ? (includes = arrayIncludesWith, 
                            isCommon = !1) : values.length >= LARGE_ARRAY_SIZE && (includes = cacheHas, isCommon = !1, 
                            values = new SetCache(values));
                            outer: for (;++index < length; ) {
                                var value = array[index], computed = null == iteratee ? value : iteratee(value);
                                if (value = comparator || 0 !== value ? value : 0, isCommon && computed == computed) {
                                    for (var valuesIndex = valuesLength; valuesIndex--; ) if (values[valuesIndex] === computed) continue outer;
                                    result.push(value);
                                } else includes(values, computed, comparator) || result.push(value);
                            }
                            return result;
                        }
                        lodash.templateSettings = {
                            escape: reEscape,
                            evaluate: reEvaluate,
                            interpolate: reInterpolate,
                            variable: "",
                            imports: {
                                _: lodash
                            }
                        }, (lodash.prototype = baseLodash.prototype).constructor = lodash, (LodashWrapper.prototype = baseCreate(baseLodash.prototype)).constructor = LodashWrapper, 
                        (LazyWrapper.prototype = baseCreate(baseLodash.prototype)).constructor = LazyWrapper, 
                        Hash.prototype.clear = function() {
                            this.__data__ = nativeCreate ? nativeCreate(null) : {}, this.size = 0;
                        }, Hash.prototype.delete = function(key) {
                            var result = this.has(key) && delete this.__data__[key];
                            return this.size -= result ? 1 : 0, result;
                        }, Hash.prototype.get = function(key) {
                            var data = this.__data__;
                            if (nativeCreate) {
                                var result = data[key];
                                return result === HASH_UNDEFINED ? undefined : result;
                            }
                            return hasOwnProperty.call(data, key) ? data[key] : undefined;
                        }, Hash.prototype.has = function(key) {
                            var data = this.__data__;
                            return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
                        }, Hash.prototype.set = function(key, value) {
                            var data = this.__data__;
                            return this.size += this.has(key) ? 0 : 1, data[key] = nativeCreate && value === undefined ? HASH_UNDEFINED : value, 
                            this;
                        }, ListCache.prototype.clear = function() {
                            this.__data__ = [], this.size = 0;
                        }, ListCache.prototype.delete = function(key) {
                            var data = this.__data__, index = assocIndexOf(data, key);
                            return !(index < 0 || (index == data.length - 1 ? data.pop() : splice.call(data, index, 1), 
                            --this.size, 0));
                        }, ListCache.prototype.get = function(key) {
                            var data = this.__data__, index = assocIndexOf(data, key);
                            return index < 0 ? undefined : data[index][1];
                        }, ListCache.prototype.has = function(key) {
                            return -1 < assocIndexOf(this.__data__, key);
                        }, ListCache.prototype.set = function(key, value) {
                            var data = this.__data__, index = assocIndexOf(data, key);
                            return index < 0 ? (++this.size, data.push([ key, value ])) : data[index][1] = value, 
                            this;
                        }, MapCache.prototype.clear = function() {
                            this.size = 0, this.__data__ = {
                                hash: new Hash(),
                                map: new (Map || ListCache)(),
                                string: new Hash()
                            };
                        }, MapCache.prototype.delete = function(key) {
                            var result = getMapData(this, key).delete(key);
                            return this.size -= result ? 1 : 0, result;
                        }, MapCache.prototype.get = function(key) {
                            return getMapData(this, key).get(key);
                        }, MapCache.prototype.has = function(key) {
                            return getMapData(this, key).has(key);
                        }, MapCache.prototype.set = function(key, value) {
                            var data = getMapData(this, key), size = data.size;
                            return data.set(key, value), this.size += data.size == size ? 0 : 1, this;
                        }, SetCache.prototype.add = SetCache.prototype.push = function(value) {
                            return this.__data__.set(value, HASH_UNDEFINED), this;
                        }, SetCache.prototype.has = function(value) {
                            return this.__data__.has(value);
                        }, Stack.prototype.clear = function() {
                            this.__data__ = new ListCache(), this.size = 0;
                        }, Stack.prototype.delete = function(key) {
                            var data = this.__data__, result = data.delete(key);
                            return this.size = data.size, result;
                        }, Stack.prototype.get = function(key) {
                            return this.__data__.get(key);
                        }, Stack.prototype.has = function(key) {
                            return this.__data__.has(key);
                        }, Stack.prototype.set = function(key, value) {
                            var data = this.__data__;
                            if (data instanceof ListCache) {
                                var pairs = data.__data__;
                                if (!Map || pairs.length < LARGE_ARRAY_SIZE - 1) return pairs.push([ key, value ]), 
                                this.size = ++data.size, this;
                                data = this.__data__ = new MapCache(pairs);
                            }
                            return data.set(key, value), this.size = data.size, this;
                        };
                        var baseEach = createBaseEach(baseForOwn), baseEachRight = createBaseEach(baseForOwnRight, !0);
                        function baseEvery(collection, predicate) {
                            var result = !0;
                            return baseEach(collection, function(value, index, collection) {
                                return result = !!predicate(value, index, collection);
                            }), result;
                        }
                        function baseExtremum(array, iteratee, comparator) {
                            for (var index = -1, length = array.length; ++index < length; ) {
                                var value = array[index], current = iteratee(value);
                                if (null != current && (computed === undefined ? current == current && !isSymbol(current) : comparator(current, computed))) var computed = current, result = value;
                            }
                            return result;
                        }
                        function baseFilter(collection, predicate) {
                            var result = [];
                            return baseEach(collection, function(value, index, collection) {
                                predicate(value, index, collection) && result.push(value);
                            }), result;
                        }
                        function baseFlatten(array, depth, predicate, isStrict, result) {
                            var index = -1, length = array.length;
                            for (predicate || (predicate = isFlattenable), result || (result = []); ++index < length; ) {
                                var value = array[index];
                                0 < depth && predicate(value) ? 1 < depth ? baseFlatten(value, depth - 1, predicate, isStrict, result) : arrayPush(result, value) : isStrict || (result[result.length] = value);
                            }
                            return result;
                        }
                        var baseFor = createBaseFor(), baseForRight = createBaseFor(!0);
                        function baseForOwn(object, iteratee) {
                            return object && baseFor(object, iteratee, keys);
                        }
                        function baseForOwnRight(object, iteratee) {
                            return object && baseForRight(object, iteratee, keys);
                        }
                        function baseFunctions(object, props) {
                            return arrayFilter(props, function(key) {
                                return isFunction(object[key]);
                            });
                        }
                        function baseGet(object, path) {
                            for (var index = 0, length = (path = castPath(path, object)).length; null != object && index < length; ) object = object[toKey(path[index++])];
                            return index && index == length ? object : undefined;
                        }
                        function baseGetAllKeys(object, keysFunc, symbolsFunc) {
                            var result = keysFunc(object);
                            return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
                        }
                        function baseGetTag(value) {
                            return null == value ? value === undefined ? undefinedTag : nullTag : symToStringTag && symToStringTag in Object(value) ? function(value) {
                                var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
                                try {
                                    value[symToStringTag] = undefined;
                                    var unmasked = !0;
                                } catch (e) {}
                                var result = nativeObjectToString.call(value);
                                return unmasked && (isOwn ? value[symToStringTag] = tag : delete value[symToStringTag]), 
                                result;
                            }(value) : function(value) {
                                return nativeObjectToString.call(value);
                            }(value);
                        }
                        function baseGt(value, other) {
                            return other < value;
                        }
                        function baseHas(object, key) {
                            return null != object && hasOwnProperty.call(object, key);
                        }
                        function baseHasIn(object, key) {
                            return null != object && key in Object(object);
                        }
                        function baseIntersection(arrays, iteratee, comparator) {
                            for (var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = 1 / 0, result = []; othIndex--; ) {
                                var array = arrays[othIndex];
                                othIndex && iteratee && (array = arrayMap(array, baseUnary(iteratee))), maxLength = nativeMin(array.length, maxLength), 
                                caches[othIndex] = !comparator && (iteratee || 120 <= length && 120 <= array.length) ? new SetCache(othIndex && array) : undefined;
                            }
                            array = arrays[0];
                            var index = -1, seen = caches[0];
                            outer: for (;++index < length && result.length < maxLength; ) {
                                var value = array[index], computed = iteratee ? iteratee(value) : value;
                                if (value = comparator || 0 !== value ? value : 0, !(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) {
                                    for (othIndex = othLength; --othIndex; ) {
                                        var cache = caches[othIndex];
                                        if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) continue outer;
                                    }
                                    seen && seen.push(computed), result.push(value);
                                }
                            }
                            return result;
                        }
                        function baseInvoke(object, path, args) {
                            var func = null == (object = parent(object, path = castPath(path, object))) ? object : object[toKey(last(path))];
                            return null == func ? undefined : apply(func, object, args);
                        }
                        function baseIsArguments(value) {
                            return isObjectLike(value) && baseGetTag(value) == argsTag;
                        }
                        function baseIsEqual(value, other, bitmask, customizer, stack) {
                            return value === other || (null == value || null == other || !isObjectLike(value) && !isObjectLike(other) ? value != value && other != other : function(object, other, bitmask, customizer, equalFunc, stack) {
                                var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other), objIsObj = (objTag = objTag == argsTag ? objectTag : objTag) == objectTag, othIsObj = (othTag = othTag == argsTag ? objectTag : othTag) == objectTag, isSameTag = objTag == othTag;
                                if (isSameTag && isBuffer(object)) {
                                    if (!isBuffer(other)) return !1;
                                    objIsObj = !(objIsArr = !0);
                                }
                                if (isSameTag && !objIsObj) return stack || (stack = new Stack()), objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : function(object, other, tag, bitmask, customizer, equalFunc, stack) {
                                    switch (tag) {
                                      case dataViewTag:
                                        if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) return !1;
                                        object = object.buffer, other = other.buffer;

                                      case arrayBufferTag:
                                        return !(object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other)));

                                      case boolTag:
                                      case dateTag:
                                      case numberTag:
                                        return eq(+object, +other);

                                      case errorTag:
                                        return object.name == other.name && object.message == other.message;

                                      case regexpTag:
                                      case stringTag:
                                        return object == other + "";

                                      case mapTag:
                                        var convert = mapToArray;

                                      case setTag:
                                        var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
                                        if (convert || (convert = setToArray), object.size != other.size && !isPartial) return !1;
                                        var stacked = stack.get(object);
                                        if (stacked) return stacked == other;
                                        bitmask |= COMPARE_UNORDERED_FLAG, stack.set(object, other);
                                        var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
                                        return stack.delete(object), result;

                                      case symbolTag:
                                        if (symbolValueOf) return symbolValueOf.call(object) == symbolValueOf.call(other);
                                    }
                                    return !1;
                                }(object, other, objTag, bitmask, customizer, equalFunc, stack);
                                if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
                                    var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
                                    if (objIsWrapped || othIsWrapped) {
                                        var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
                                        return stack || (stack = new Stack()), equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
                                    }
                                }
                                return !!isSameTag && (stack || (stack = new Stack()), function(object, other, bitmask, customizer, equalFunc, stack) {
                                    var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othLength = getAllKeys(other).length;
                                    if (objLength != othLength && !isPartial) return !1;
                                    for (var index = objLength; index--; ) {
                                        var key = objProps[index];
                                        if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) return !1;
                                    }
                                    var stacked = stack.get(object);
                                    if (stacked && stack.get(other)) return stacked == other;
                                    var result = !0;
                                    stack.set(object, other), stack.set(other, object);
                                    for (var skipCtor = isPartial; ++index < objLength; ) {
                                        key = objProps[index];
                                        var objValue = object[key], othValue = other[key];
                                        if (customizer) var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
                                        if (!(compared === undefined ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
                                            result = !1;
                                            break;
                                        }
                                        skipCtor || (skipCtor = "constructor" == key);
                                    }
                                    if (result && !skipCtor) {
                                        var objCtor = object.constructor, othCtor = other.constructor;
                                        objCtor != othCtor && "constructor" in object && "constructor" in other && !("function" == typeof objCtor && objCtor instanceof objCtor && "function" == typeof othCtor && othCtor instanceof othCtor) && (result = !1);
                                    }
                                    return stack.delete(object), stack.delete(other), result;
                                }(object, other, bitmask, customizer, equalFunc, stack));
                            }(value, other, bitmask, customizer, baseIsEqual, stack));
                        }
                        function baseIsMatch(object, source, matchData, customizer) {
                            var index = matchData.length, length = index, noCustomizer = !customizer;
                            if (null == object) return !length;
                            for (object = Object(object); index--; ) {
                                var data = matchData[index];
                                if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) return !1;
                            }
                            for (;++index < length; ) {
                                var key = (data = matchData[index])[0], objValue = object[key], srcValue = data[1];
                                if (noCustomizer && data[2]) {
                                    if (objValue === undefined && !(key in object)) return !1;
                                } else {
                                    var stack = new Stack();
                                    if (customizer) var result = customizer(objValue, srcValue, key, object, source, stack);
                                    if (!(result === undefined ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG, customizer, stack) : result)) return !1;
                                }
                            }
                            return !0;
                        }
                        function baseIsNative(value) {
                            return !(!isObject(value) || (func = value, maskSrcKey && maskSrcKey in func)) && (isFunction(value) ? reIsNative : reIsHostCtor).test(toSource(value));
                            var func;
                        }
                        function baseIteratee(value) {
                            return "function" == typeof value ? value : null == value ? identity : "object" == typeof value ? isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value) : property(value);
                        }
                        function baseKeys(object) {
                            if (!isPrototype(object)) return nativeKeys(object);
                            var result = [];
                            for (var key in Object(object)) hasOwnProperty.call(object, key) && "constructor" != key && result.push(key);
                            return result;
                        }
                        function baseKeysIn(object) {
                            if (!isObject(object)) return function(object) {
                                var result = [];
                                if (null != object) for (var key in Object(object)) result.push(key);
                                return result;
                            }(object);
                            var isProto = isPrototype(object), result = [];
                            for (var key in object) ("constructor" != key || !isProto && hasOwnProperty.call(object, key)) && result.push(key);
                            return result;
                        }
                        function baseLt(value, other) {
                            return value < other;
                        }
                        function baseMap(collection, iteratee) {
                            var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
                            return baseEach(collection, function(value, key, collection) {
                                result[++index] = iteratee(value, key, collection);
                            }), result;
                        }
                        function baseMatches(source) {
                            var matchData = getMatchData(source);
                            return 1 == matchData.length && matchData[0][2] ? matchesStrictComparable(matchData[0][0], matchData[0][1]) : function(object) {
                                return object === source || baseIsMatch(object, source, matchData);
                            };
                        }
                        function baseMatchesProperty(path, srcValue) {
                            return isKey(path) && isStrictComparable(srcValue) ? matchesStrictComparable(toKey(path), srcValue) : function(object) {
                                var objValue = get(object, path);
                                return objValue === undefined && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
                            };
                        }
                        function baseMerge(object, source, srcIndex, customizer, stack) {
                            object !== source && baseFor(source, function(srcValue, key) {
                                if (isObject(srcValue)) stack || (stack = new Stack()), function(object, source, key, srcIndex, mergeFunc, customizer, stack) {
                                    var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
                                    if (stacked) return assignMergeValue(object, key, stacked);
                                    var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : undefined, isCommon = newValue === undefined;
                                    if (isCommon) {
                                        var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
                                        newValue = srcValue, isArr || isBuff || isTyped ? newValue = isArray(objValue) ? objValue : isArrayLikeObject(objValue) ? copyArray(objValue) : isBuff ? cloneBuffer(srcValue, !(isCommon = !1)) : isTyped ? cloneTypedArray(srcValue, !(isCommon = !1)) : [] : isPlainObject(srcValue) || isArguments(srcValue) ? isArguments(newValue = objValue) ? newValue = toPlainObject(objValue) : (!isObject(objValue) || srcIndex && isFunction(objValue)) && (newValue = initCloneObject(srcValue)) : isCommon = !1;
                                    }
                                    isCommon && (stack.set(srcValue, newValue), mergeFunc(newValue, srcValue, srcIndex, customizer, stack), 
                                    stack.delete(srcValue)), assignMergeValue(object, key, newValue);
                                }(object, source, key, srcIndex, baseMerge, customizer, stack); else {
                                    var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : undefined;
                                    newValue === undefined && (newValue = srcValue), assignMergeValue(object, key, newValue);
                                }
                            }, keysIn);
                        }
                        function baseNth(array, n) {
                            var length = array.length;
                            if (length) return isIndex(n += n < 0 ? length : 0, length) ? array[n] : undefined;
                        }
                        function baseOrderBy(collection, iteratees, orders) {
                            var index = -1;
                            return iteratees = arrayMap(iteratees.length ? iteratees : [ identity ], baseUnary(getIteratee())), 
                            function(array, comparer) {
                                var length = array.length;
                                for (array.sort(comparer); length--; ) array[length] = array[length].value;
                                return array;
                            }(baseMap(collection, function(value, key, collection) {
                                return {
                                    criteria: arrayMap(iteratees, function(iteratee) {
                                        return iteratee(value);
                                    }),
                                    index: ++index,
                                    value: value
                                };
                            }), function(object, other) {
                                return function(object, other, orders) {
                                    for (var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length; ++index < length; ) {
                                        var result = compareAscending(objCriteria[index], othCriteria[index]);
                                        if (result) {
                                            if (ordersLength <= index) return result;
                                            var order = orders[index];
                                            return result * ("desc" == order ? -1 : 1);
                                        }
                                    }
                                    return object.index - other.index;
                                }(object, other, orders);
                            });
                        }
                        function basePickBy(object, paths, predicate) {
                            for (var index = -1, length = paths.length, result = {}; ++index < length; ) {
                                var path = paths[index], value = baseGet(object, path);
                                predicate(value, path) && baseSet(result, castPath(path, object), value);
                            }
                            return result;
                        }
                        function basePullAll(array, values, iteratee, comparator) {
                            var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array;
                            for (array === values && (values = copyArray(values)), iteratee && (seen = arrayMap(array, baseUnary(iteratee))); ++index < length; ) for (var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value; -1 < (fromIndex = indexOf(seen, computed, fromIndex, comparator)); ) seen !== array && splice.call(seen, fromIndex, 1), 
                            splice.call(array, fromIndex, 1);
                            return array;
                        }
                        function basePullAt(array, indexes) {
                            for (var length = array ? indexes.length : 0, lastIndex = length - 1; length--; ) {
                                var index = indexes[length];
                                if (length == lastIndex || index !== previous) {
                                    var previous = index;
                                    isIndex(index) ? splice.call(array, index, 1) : baseUnset(array, index);
                                }
                            }
                            return array;
                        }
                        function baseRandom(lower, upper) {
                            return lower + nativeFloor(nativeRandom() * (upper - lower + 1));
                        }
                        function baseRepeat(string, n) {
                            var result = "";
                            if (!string || n < 1 || MAX_SAFE_INTEGER < n) return result;
                            for (;n % 2 && (result += string), (n = nativeFloor(n / 2)) && (string += string), 
                            n; ) ;
                            return result;
                        }
                        function baseRest(func, start) {
                            return setToString(overRest(func, start, identity), func + "");
                        }
                        function baseSample(collection) {
                            return arraySample(values(collection));
                        }
                        function baseSampleSize(collection, n) {
                            var array = values(collection);
                            return shuffleSelf(array, baseClamp(n, 0, array.length));
                        }
                        function baseSet(object, path, value, customizer) {
                            if (!isObject(object)) return object;
                            for (var index = -1, length = (path = castPath(path, object)).length, lastIndex = length - 1, nested = object; null != nested && ++index < length; ) {
                                var key = toKey(path[index]), newValue = value;
                                if (index != lastIndex) {
                                    var objValue = nested[key];
                                    (newValue = customizer ? customizer(objValue, key, nested) : undefined) === undefined && (newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {});
                                }
                                assignValue(nested, key, newValue), nested = nested[key];
                            }
                            return object;
                        }
                        var baseSetData = metaMap ? function(func, data) {
                            return metaMap.set(func, data), func;
                        } : identity, baseSetToString = defineProperty ? function(func, string) {
                            return defineProperty(func, "toString", {
                                configurable: !0,
                                enumerable: !1,
                                value: constant(string),
                                writable: !0
                            });
                        } : identity;
                        function baseShuffle(collection) {
                            return shuffleSelf(values(collection));
                        }
                        function baseSlice(array, start, end) {
                            var index = -1, length = array.length;
                            start < 0 && (start = length < -start ? 0 : length + start), (end = length < end ? length : end) < 0 && (end += length), 
                            length = end < start ? 0 : end - start >>> 0, start >>>= 0;
                            for (var result = Array(length); ++index < length; ) result[index] = array[index + start];
                            return result;
                        }
                        function baseSome(collection, predicate) {
                            var result;
                            return baseEach(collection, function(value, index, collection) {
                                return !(result = predicate(value, index, collection));
                            }), !!result;
                        }
                        function baseSortedIndex(array, value, retHighest) {
                            var low = 0, high = null == array ? low : array.length;
                            if ("number" == typeof value && value == value && high <= HALF_MAX_ARRAY_LENGTH) {
                                for (;low < high; ) {
                                    var mid = low + high >>> 1, computed = array[mid];
                                    null !== computed && !isSymbol(computed) && (retHighest ? computed <= value : computed < value) ? low = mid + 1 : high = mid;
                                }
                                return high;
                            }
                            return baseSortedIndexBy(array, value, identity, retHighest);
                        }
                        function baseSortedIndexBy(array, value, iteratee, retHighest) {
                            value = iteratee(value);
                            for (var low = 0, high = null == array ? 0 : array.length, valIsNaN = value != value, valIsNull = null === value, valIsSymbol = isSymbol(value), valIsUndefined = value === undefined; low < high; ) {
                                var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== undefined, othIsNull = null === computed, othIsReflexive = computed == computed, othIsSymbol = isSymbol(computed);
                                if (valIsNaN) var setLow = retHighest || othIsReflexive; else setLow = valIsUndefined ? othIsReflexive && (retHighest || othIsDefined) : valIsNull ? othIsReflexive && othIsDefined && (retHighest || !othIsNull) : valIsSymbol ? othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol) : !othIsNull && !othIsSymbol && (retHighest ? computed <= value : computed < value);
                                setLow ? low = mid + 1 : high = mid;
                            }
                            return nativeMin(high, MAX_ARRAY_INDEX);
                        }
                        function baseSortedUniq(array, iteratee) {
                            for (var index = -1, length = array.length, resIndex = 0, result = []; ++index < length; ) {
                                var value = array[index], computed = iteratee ? iteratee(value) : value;
                                if (!index || !eq(computed, seen)) {
                                    var seen = computed;
                                    result[resIndex++] = 0 === value ? 0 : value;
                                }
                            }
                            return result;
                        }
                        function baseToNumber(value) {
                            return "number" == typeof value ? value : isSymbol(value) ? NAN : +value;
                        }
                        function baseToString(value) {
                            if ("string" == typeof value) return value;
                            if (isArray(value)) return arrayMap(value, baseToString) + "";
                            if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : "";
                            var result = value + "";
                            return "0" == result && 1 / value == -INFINITY ? "-0" : result;
                        }
                        function baseUniq(array, iteratee, comparator) {
                            var index = -1, includes = arrayIncludes, length = array.length, isCommon = !0, result = [], seen = result;
                            if (comparator) isCommon = !1, includes = arrayIncludesWith; else if (LARGE_ARRAY_SIZE <= length) {
                                var set = iteratee ? null : createSet(array);
                                if (set) return setToArray(set);
                                isCommon = !1, includes = cacheHas, seen = new SetCache();
                            } else seen = iteratee ? [] : result;
                            outer: for (;++index < length; ) {
                                var value = array[index], computed = iteratee ? iteratee(value) : value;
                                if (value = comparator || 0 !== value ? value : 0, isCommon && computed == computed) {
                                    for (var seenIndex = seen.length; seenIndex--; ) if (seen[seenIndex] === computed) continue outer;
                                    iteratee && seen.push(computed), result.push(value);
                                } else includes(seen, computed, comparator) || (seen !== result && seen.push(computed), 
                                result.push(value));
                            }
                            return result;
                        }
                        function baseUnset(object, path) {
                            return null == (object = parent(object, path = castPath(path, object))) || delete object[toKey(last(path))];
                        }
                        function baseUpdate(object, path, updater, customizer) {
                            return baseSet(object, path, updater(baseGet(object, path)), customizer);
                        }
                        function baseWhile(array, predicate, isDrop, fromRight) {
                            for (var length = array.length, index = fromRight ? length : -1; (fromRight ? index-- : ++index < length) && predicate(array[index], index, array); ) ;
                            return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
                        }
                        function baseWrapperValue(value, actions) {
                            var result = value;
                            return result instanceof LazyWrapper && (result = result.value()), arrayReduce(actions, function(result, action) {
                                return action.func.apply(action.thisArg, arrayPush([ result ], action.args));
                            }, result);
                        }
                        function baseXor(arrays, iteratee, comparator) {
                            var length = arrays.length;
                            if (length < 2) return length ? baseUniq(arrays[0]) : [];
                            for (var index = -1, result = Array(length); ++index < length; ) for (var array = arrays[index], othIndex = -1; ++othIndex < length; ) othIndex != index && (result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator));
                            return baseUniq(baseFlatten(result, 1), iteratee, comparator);
                        }
                        function baseZipObject(props, values, assignFunc) {
                            for (var index = -1, length = props.length, valsLength = values.length, result = {}; ++index < length; ) {
                                var value = index < valsLength ? values[index] : undefined;
                                assignFunc(result, props[index], value);
                            }
                            return result;
                        }
                        function castArrayLikeObject(value) {
                            return isArrayLikeObject(value) ? value : [];
                        }
                        function castFunction(value) {
                            return "function" == typeof value ? value : identity;
                        }
                        function castPath(value, object) {
                            return isArray(value) ? value : isKey(value, object) ? [ value ] : stringToPath(toString(value));
                        }
                        var castRest = baseRest;
                        function castSlice(array, start, end) {
                            var length = array.length;
                            return end = end === undefined ? length : end, !start && length <= end ? array : baseSlice(array, start, end);
                        }
                        var clearTimeout = ctxClearTimeout || function(id) {
                            return root.clearTimeout(id);
                        };
                        function cloneBuffer(buffer, isDeep) {
                            if (isDeep) return buffer.slice();
                            var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
                            return buffer.copy(result), result;
                        }
                        function cloneArrayBuffer(arrayBuffer) {
                            var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
                            return new Uint8Array(result).set(new Uint8Array(arrayBuffer)), result;
                        }
                        function cloneTypedArray(typedArray, isDeep) {
                            var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
                            return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
                        }
                        function compareAscending(value, other) {
                            if (value !== other) {
                                var valIsDefined = value !== undefined, valIsNull = null === value, valIsReflexive = value == value, valIsSymbol = isSymbol(value), othIsDefined = other !== undefined, othIsNull = null === other, othIsReflexive = other == other, othIsSymbol = isSymbol(other);
                                if (!othIsNull && !othIsSymbol && !valIsSymbol && other < value || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) return 1;
                                if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) return -1;
                            }
                            return 0;
                        }
                        function composeArgs(args, partials, holders, isCurried) {
                            for (var argsIndex = -1, argsLength = args.length, holdersLength = holders.length, leftIndex = -1, leftLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result = Array(leftLength + rangeLength), isUncurried = !isCurried; ++leftIndex < leftLength; ) result[leftIndex] = partials[leftIndex];
                            for (;++argsIndex < holdersLength; ) (isUncurried || argsIndex < argsLength) && (result[holders[argsIndex]] = args[argsIndex]);
                            for (;rangeLength--; ) result[leftIndex++] = args[argsIndex++];
                            return result;
                        }
                        function composeArgsRight(args, partials, holders, isCurried) {
                            for (var argsIndex = -1, argsLength = args.length, holdersIndex = -1, holdersLength = holders.length, rightIndex = -1, rightLength = partials.length, rangeLength = nativeMax(argsLength - holdersLength, 0), result = Array(rangeLength + rightLength), isUncurried = !isCurried; ++argsIndex < rangeLength; ) result[argsIndex] = args[argsIndex];
                            for (var offset = argsIndex; ++rightIndex < rightLength; ) result[offset + rightIndex] = partials[rightIndex];
                            for (;++holdersIndex < holdersLength; ) (isUncurried || argsIndex < argsLength) && (result[offset + holders[holdersIndex]] = args[argsIndex++]);
                            return result;
                        }
                        function copyArray(source, array) {
                            var index = -1, length = source.length;
                            for (array || (array = Array(length)); ++index < length; ) array[index] = source[index];
                            return array;
                        }
                        function copyObject(source, props, object, customizer) {
                            var isNew = !object;
                            object || (object = {});
                            for (var index = -1, length = props.length; ++index < length; ) {
                                var key = props[index], newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined;
                                newValue === undefined && (newValue = source[key]), isNew ? baseAssignValue(object, key, newValue) : assignValue(object, key, newValue);
                            }
                            return object;
                        }
                        function createAggregator(setter, initializer) {
                            return function(collection, iteratee) {
                                var func = isArray(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
                                return func(collection, setter, getIteratee(iteratee, 2), accumulator);
                            };
                        }
                        function createAssigner(assigner) {
                            return baseRest(function(object, sources) {
                                var index = -1, length = sources.length, customizer = 1 < length ? sources[length - 1] : undefined, guard = 2 < length ? sources[2] : undefined;
                                for (customizer = 3 < assigner.length && "function" == typeof customizer ? (length--, 
                                customizer) : undefined, guard && isIterateeCall(sources[0], sources[1], guard) && (customizer = length < 3 ? undefined : customizer, 
                                length = 1), object = Object(object); ++index < length; ) {
                                    var source = sources[index];
                                    source && assigner(object, source, index, customizer);
                                }
                                return object;
                            });
                        }
                        function createBaseEach(eachFunc, fromRight) {
                            return function(collection, iteratee) {
                                if (null == collection) return collection;
                                if (!isArrayLike(collection)) return eachFunc(collection, iteratee);
                                for (var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection); (fromRight ? index-- : ++index < length) && !1 !== iteratee(iterable[index], index, iterable); ) ;
                                return collection;
                            };
                        }
                        function createBaseFor(fromRight) {
                            return function(object, iteratee, keysFunc) {
                                for (var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; length--; ) {
                                    var key = props[fromRight ? length : ++index];
                                    if (!1 === iteratee(iterable[key], key, iterable)) break;
                                }
                                return object;
                            };
                        }
                        function createCaseFirst(methodName) {
                            return function(string) {
                                var strSymbols = hasUnicode(string = toString(string)) ? stringToArray(string) : undefined, chr = strSymbols ? strSymbols[0] : string.charAt(0), trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
                                return chr[methodName]() + trailing;
                            };
                        }
                        function createCompounder(callback) {
                            return function(string) {
                                return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
                            };
                        }
                        function createCtor(Ctor) {
                            return function() {
                                var args = arguments;
                                switch (args.length) {
                                  case 0:
                                    return new Ctor();

                                  case 1:
                                    return new Ctor(args[0]);

                                  case 2:
                                    return new Ctor(args[0], args[1]);

                                  case 3:
                                    return new Ctor(args[0], args[1], args[2]);

                                  case 4:
                                    return new Ctor(args[0], args[1], args[2], args[3]);

                                  case 5:
                                    return new Ctor(args[0], args[1], args[2], args[3], args[4]);

                                  case 6:
                                    return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);

                                  case 7:
                                    return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
                                }
                                var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args);
                                return isObject(result) ? result : thisBinding;
                            };
                        }
                        function createFind(findIndexFunc) {
                            return function(collection, predicate, fromIndex) {
                                var iterable = Object(collection);
                                if (!isArrayLike(collection)) {
                                    var iteratee = getIteratee(predicate, 3);
                                    collection = keys(collection), predicate = function(key) {
                                        return iteratee(iterable[key], key, iterable);
                                    };
                                }
                                var index = findIndexFunc(collection, predicate, fromIndex);
                                return -1 < index ? iterable[iteratee ? collection[index] : index] : undefined;
                            };
                        }
                        function createFlow(fromRight) {
                            return flatRest(function(funcs) {
                                var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
                                for (fromRight && funcs.reverse(); index--; ) {
                                    var func = funcs[index];
                                    if ("function" != typeof func) throw new TypeError(FUNC_ERROR_TEXT);
                                    if (prereq && !wrapper && "wrapper" == getFuncName(func)) var wrapper = new LodashWrapper([], !0);
                                }
                                for (index = wrapper ? index : length; ++index < length; ) {
                                    var funcName = getFuncName(func = funcs[index]), data = "wrapper" == funcName ? getData(func) : undefined;
                                    wrapper = data && isLaziable(data[0]) && data[1] == (WRAP_ARY_FLAG | WRAP_CURRY_FLAG | WRAP_PARTIAL_FLAG | WRAP_REARG_FLAG) && !data[4].length && 1 == data[9] ? wrapper[getFuncName(data[0])].apply(wrapper, data[3]) : 1 == func.length && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
                                }
                                return function() {
                                    var args = arguments, value = args[0];
                                    if (wrapper && 1 == args.length && isArray(value)) return wrapper.plant(value).value();
                                    for (var index = 0, result = length ? funcs[index].apply(this, args) : value; ++index < length; ) result = funcs[index].call(this, result);
                                    return result;
                                };
                            });
                        }
                        function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
                            var isAry = bitmask & WRAP_ARY_FLAG, isBind = bitmask & WRAP_BIND_FLAG, isBindKey = bitmask & WRAP_BIND_KEY_FLAG, isCurried = bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG), isFlip = bitmask & WRAP_FLIP_FLAG, Ctor = isBindKey ? undefined : createCtor(func);
                            return function wrapper() {
                                for (var length = arguments.length, args = Array(length), index = length; index--; ) args[index] = arguments[index];
                                if (isCurried) var placeholder = getHolder(wrapper), holdersCount = function(array, placeholder) {
                                    for (var length = array.length, result = 0; length--; ) array[length] === placeholder && ++result;
                                    return result;
                                }(args, placeholder);
                                if (partials && (args = composeArgs(args, partials, holders, isCurried)), partialsRight && (args = composeArgsRight(args, partialsRight, holdersRight, isCurried)), 
                                length -= holdersCount, isCurried && length < arity) {
                                    var newHolders = replaceHolders(args, placeholder);
                                    return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length);
                                }
                                var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
                                return length = args.length, argPos ? args = function(array, indexes) {
                                    for (var arrLength = array.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array); length--; ) {
                                        var index = indexes[length];
                                        array[length] = isIndex(index, arrLength) ? oldArray[index] : undefined;
                                    }
                                    return array;
                                }(args, argPos) : isFlip && 1 < length && args.reverse(), isAry && ary < length && (args.length = ary), 
                                this && this !== root && this instanceof wrapper && (fn = Ctor || createCtor(fn)), 
                                fn.apply(thisBinding, args);
                            };
                        }
                        function createInverter(setter, toIteratee) {
                            return function(object, iteratee) {
                                return function(object, setter, iteratee, accumulator) {
                                    return baseForOwn(object, function(value, key, object) {
                                        setter(accumulator, iteratee(value), key, object);
                                    }), accumulator;
                                }(object, setter, toIteratee(iteratee), {});
                            };
                        }
                        function createMathOperation(operator, defaultValue) {
                            return function(value, other) {
                                var result;
                                if (value === undefined && other === undefined) return defaultValue;
                                if (value !== undefined && (result = value), other !== undefined) {
                                    if (result === undefined) return other;
                                    "string" == typeof value || "string" == typeof other ? (value = baseToString(value), 
                                    other = baseToString(other)) : (value = baseToNumber(value), other = baseToNumber(other)), 
                                    result = operator(value, other);
                                }
                                return result;
                            };
                        }
                        function createOver(arrayFunc) {
                            return flatRest(function(iteratees) {
                                return iteratees = arrayMap(iteratees, baseUnary(getIteratee())), baseRest(function(args) {
                                    var thisArg = this;
                                    return arrayFunc(iteratees, function(iteratee) {
                                        return apply(iteratee, thisArg, args);
                                    });
                                });
                            });
                        }
                        function createPadding(length, chars) {
                            var charsLength = (chars = chars === undefined ? " " : baseToString(chars)).length;
                            if (charsLength < 2) return charsLength ? baseRepeat(chars, length) : chars;
                            var result = baseRepeat(chars, nativeCeil(length / stringSize(chars)));
                            return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join("") : result.slice(0, length);
                        }
                        function createRange(fromRight) {
                            return function(start, end, step) {
                                return step && "number" != typeof step && isIterateeCall(start, end, step) && (end = step = undefined), 
                                start = toFinite(start), end === undefined ? (end = start, start = 0) : end = toFinite(end), 
                                function(start, end, step, fromRight) {
                                    for (var index = -1, length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), result = Array(length); length--; ) result[fromRight ? length : ++index] = start, 
                                    start += step;
                                    return result;
                                }(start, end, step = step === undefined ? start < end ? 1 : -1 : toFinite(step), fromRight);
                            };
                        }
                        function createRelationalOperation(operator) {
                            return function(value, other) {
                                return "string" == typeof value && "string" == typeof other || (value = toNumber(value), 
                                other = toNumber(other)), operator(value, other);
                            };
                        }
                        function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
                            var isCurry = bitmask & WRAP_CURRY_FLAG;
                            bitmask |= isCurry ? WRAP_PARTIAL_FLAG : WRAP_PARTIAL_RIGHT_FLAG, (bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG : WRAP_PARTIAL_FLAG)) & WRAP_CURRY_BOUND_FLAG || (bitmask &= ~(WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG));
                            var newData = [ func, bitmask, thisArg, isCurry ? partials : undefined, isCurry ? holders : undefined, isCurry ? undefined : partials, isCurry ? undefined : holders, argPos, ary, arity ], result = wrapFunc.apply(undefined, newData);
                            return isLaziable(func) && setData(result, newData), result.placeholder = placeholder, 
                            setWrapToString(result, func, bitmask);
                        }
                        function createRound(methodName) {
                            var func = Math[methodName];
                            return function(number, precision) {
                                if (number = toNumber(number), precision = null == precision ? 0 : nativeMin(toInteger(precision), 292)) {
                                    var pair = (toString(number) + "e").split("e");
                                    return +((pair = (toString(func(pair[0] + "e" + (+pair[1] + precision))) + "e").split("e"))[0] + "e" + (+pair[1] - precision));
                                }
                                return func(number);
                            };
                        }
                        var createSet = Set && 1 / setToArray(new Set([ , -0 ]))[1] == INFINITY ? function(values) {
                            return new Set(values);
                        } : noop;
                        function createToPairs(keysFunc) {
                            return function(object) {
                                var tag = getTag(object);
                                return tag == mapTag ? mapToArray(object) : tag == setTag ? setToPairs(object) : function(object, props) {
                                    return arrayMap(props, function(key) {
                                        return [ key, object[key] ];
                                    });
                                }(object, keysFunc(object));
                            };
                        }
                        function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
                            var isBindKey = bitmask & WRAP_BIND_KEY_FLAG;
                            if (!isBindKey && "function" != typeof func) throw new TypeError(FUNC_ERROR_TEXT);
                            var length = partials ? partials.length : 0;
                            if (length || (bitmask &= ~(WRAP_PARTIAL_FLAG | WRAP_PARTIAL_RIGHT_FLAG), partials = holders = undefined), 
                            ary = ary === undefined ? ary : nativeMax(toInteger(ary), 0), arity = arity === undefined ? arity : toInteger(arity), 
                            length -= holders ? holders.length : 0, bitmask & WRAP_PARTIAL_RIGHT_FLAG) {
                                var partialsRight = partials, holdersRight = holders;
                                partials = holders = undefined;
                            }
                            var data = isBindKey ? undefined : getData(func), newData = [ func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity ];
                            if (data && function(data, source) {
                                var bitmask = data[1], srcBitmask = source[1], newBitmask = bitmask | srcBitmask, isCommon = newBitmask < (WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG | WRAP_ARY_FLAG), isCombo = srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_CURRY_FLAG || srcBitmask == WRAP_ARY_FLAG && bitmask == WRAP_REARG_FLAG && data[7].length <= source[8] || srcBitmask == (WRAP_ARY_FLAG | WRAP_REARG_FLAG) && source[7].length <= source[8] && bitmask == WRAP_CURRY_FLAG;
                                if (isCommon || isCombo) {
                                    srcBitmask & WRAP_BIND_FLAG && (data[2] = source[2], newBitmask |= bitmask & WRAP_BIND_FLAG ? 0 : WRAP_CURRY_BOUND_FLAG);
                                    var value = source[3];
                                    if (value) {
                                        var partials = data[3];
                                        data[3] = partials ? composeArgs(partials, value, source[4]) : value, data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
                                    }
                                    (value = source[5]) && (partials = data[5], data[5] = partials ? composeArgsRight(partials, value, source[6]) : value, 
                                    data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6]), (value = source[7]) && (data[7] = value), 
                                    srcBitmask & WRAP_ARY_FLAG && (data[8] = null == data[8] ? source[8] : nativeMin(data[8], source[8])), 
                                    null == data[9] && (data[9] = source[9]), data[0] = source[0], data[1] = newBitmask;
                                }
                            }(newData, data), func = newData[0], bitmask = newData[1], thisArg = newData[2], 
                            partials = newData[3], holders = newData[4], !(arity = newData[9] = newData[9] === undefined ? isBindKey ? 0 : func.length : nativeMax(newData[9] - length, 0)) && bitmask & (WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG) && (bitmask &= ~(WRAP_CURRY_FLAG | WRAP_CURRY_RIGHT_FLAG)), 
                            bitmask && bitmask != WRAP_BIND_FLAG) result = bitmask == WRAP_CURRY_FLAG || bitmask == WRAP_CURRY_RIGHT_FLAG ? function(func, bitmask, arity) {
                                var Ctor = createCtor(func);
                                return function wrapper() {
                                    for (var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper); index--; ) args[index] = arguments[index];
                                    var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
                                    return (length -= holders.length) < arity ? createRecurry(func, bitmask, createHybrid, wrapper.placeholder, undefined, args, holders, undefined, undefined, arity - length) : apply(this && this !== root && this instanceof wrapper ? Ctor : func, this, args);
                                };
                            }(func, bitmask, arity) : bitmask != WRAP_PARTIAL_FLAG && bitmask != (WRAP_BIND_FLAG | WRAP_PARTIAL_FLAG) || holders.length ? createHybrid.apply(undefined, newData) : function(func, bitmask, thisArg, partials) {
                                var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
                                return function wrapper() {
                                    for (var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func; ++leftIndex < leftLength; ) args[leftIndex] = partials[leftIndex];
                                    for (;argsLength--; ) args[leftIndex++] = arguments[++argsIndex];
                                    return apply(fn, isBind ? thisArg : this, args);
                                };
                            }(func, bitmask, thisArg, partials); else var result = function(func, bitmask, thisArg) {
                                var isBind = bitmask & WRAP_BIND_FLAG, Ctor = createCtor(func);
                                return function wrapper() {
                                    return (this && this !== root && this instanceof wrapper ? Ctor : func).apply(isBind ? thisArg : this, arguments);
                                };
                            }(func, bitmask, thisArg);
                            return setWrapToString((data ? baseSetData : setData)(result, newData), func, bitmask);
                        }
                        function customDefaultsAssignIn(objValue, srcValue, key, object) {
                            return objValue === undefined || eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key) ? srcValue : objValue;
                        }
                        function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
                            return isObject(objValue) && isObject(srcValue) && (stack.set(srcValue, objValue), 
                            baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack), stack.delete(srcValue)), 
                            objValue;
                        }
                        function customOmitClone(value) {
                            return isPlainObject(value) ? undefined : value;
                        }
                        function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
                            var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
                            if (arrLength != othLength && !(isPartial && arrLength < othLength)) return !1;
                            var stacked = stack.get(array);
                            if (stacked && stack.get(other)) return stacked == other;
                            var index = -1, result = !0, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : undefined;
                            for (stack.set(array, other), stack.set(other, array); ++index < arrLength; ) {
                                var arrValue = array[index], othValue = other[index];
                                if (customizer) var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
                                if (compared !== undefined) {
                                    if (compared) continue;
                                    result = !1;
                                    break;
                                }
                                if (seen) {
                                    if (!arraySome(other, function(othValue, othIndex) {
                                        if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) return seen.push(othIndex);
                                    })) {
                                        result = !1;
                                        break;
                                    }
                                } else if (arrValue !== othValue && !equalFunc(arrValue, othValue, bitmask, customizer, stack)) {
                                    result = !1;
                                    break;
                                }
                            }
                            return stack.delete(array), stack.delete(other), result;
                        }
                        function flatRest(func) {
                            return setToString(overRest(func, undefined, flatten), func + "");
                        }
                        function getAllKeys(object) {
                            return baseGetAllKeys(object, keys, getSymbols);
                        }
                        function getAllKeysIn(object) {
                            return baseGetAllKeys(object, keysIn, getSymbolsIn);
                        }
                        var getData = metaMap ? function(func) {
                            return metaMap.get(func);
                        } : noop;
                        function getFuncName(func) {
                            for (var result = func.name + "", array = realNames[result], length = hasOwnProperty.call(realNames, result) ? array.length : 0; length--; ) {
                                var data = array[length], otherFunc = data.func;
                                if (null == otherFunc || otherFunc == func) return data.name;
                            }
                            return result;
                        }
                        function getHolder(func) {
                            return (hasOwnProperty.call(lodash, "placeholder") ? lodash : func).placeholder;
                        }
                        function getIteratee() {
                            var result = lodash.iteratee || iteratee;
                            return result = result === iteratee ? baseIteratee : result, arguments.length ? result(arguments[0], arguments[1]) : result;
                        }
                        function getMapData(map, key) {
                            var value, type, data = map.__data__;
                            return ("string" == (type = typeof (value = key)) || "number" == type || "symbol" == type || "boolean" == type ? "__proto__" !== value : null === value) ? data["string" == typeof key ? "string" : "hash"] : data.map;
                        }
                        function getMatchData(object) {
                            for (var result = keys(object), length = result.length; length--; ) {
                                var key = result[length], value = object[key];
                                result[length] = [ key, value, isStrictComparable(value) ];
                            }
                            return result;
                        }
                        function getNative(object, key) {
                            var value = function(object, key) {
                                return null == object ? undefined : object[key];
                            }(object, key);
                            return baseIsNative(value) ? value : undefined;
                        }
                        var getSymbols = nativeGetSymbols ? function(object) {
                            return null == object ? [] : (object = Object(object), arrayFilter(nativeGetSymbols(object), function(symbol) {
                                return propertyIsEnumerable.call(object, symbol);
                            }));
                        } : stubArray, getSymbolsIn = nativeGetSymbols ? function(object) {
                            for (var result = []; object; ) arrayPush(result, getSymbols(object)), object = getPrototype(object);
                            return result;
                        } : stubArray, getTag = baseGetTag;
                        function hasPath(object, path, hasFunc) {
                            for (var index = -1, length = (path = castPath(path, object)).length, result = !1; ++index < length; ) {
                                var key = toKey(path[index]);
                                if (!(result = null != object && hasFunc(object, key))) break;
                                object = object[key];
                            }
                            return result || ++index != length ? result : !!(length = null == object ? 0 : object.length) && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
                        }
                        function initCloneObject(object) {
                            return "function" != typeof object.constructor || isPrototype(object) ? {} : baseCreate(getPrototype(object));
                        }
                        function isFlattenable(value) {
                            return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
                        }
                        function isIndex(value, length) {
                            var type = typeof value;
                            return !!(length = null == length ? MAX_SAFE_INTEGER : length) && ("number" == type || "symbol" != type && reIsUint.test(value)) && -1 < value && value % 1 == 0 && value < length;
                        }
                        function isIterateeCall(value, index, object) {
                            if (!isObject(object)) return !1;
                            var type = typeof index;
                            return !!("number" == type ? isArrayLike(object) && isIndex(index, object.length) : "string" == type && index in object) && eq(object[index], value);
                        }
                        function isKey(value, object) {
                            if (isArray(value)) return !1;
                            var type = typeof value;
                            return !("number" != type && "symbol" != type && "boolean" != type && null != value && !isSymbol(value)) || reIsPlainProp.test(value) || !reIsDeepProp.test(value) || null != object && value in Object(object);
                        }
                        function isLaziable(func) {
                            var funcName = getFuncName(func), other = lodash[funcName];
                            if ("function" != typeof other || !(funcName in LazyWrapper.prototype)) return !1;
                            if (func === other) return !0;
                            var data = getData(other);
                            return !!data && func === data[0];
                        }
                        (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map && getTag(new Map()) != mapTag || Promise && "[object Promise]" != getTag(Promise.resolve()) || Set && getTag(new Set()) != setTag || WeakMap && getTag(new WeakMap()) != weakMapTag) && (getTag = function(value) {
                            var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : "";
                            if (ctorString) switch (ctorString) {
                              case dataViewCtorString:
                                return dataViewTag;

                              case mapCtorString:
                                return mapTag;

                              case promiseCtorString:
                                return "[object Promise]";

                              case setCtorString:
                                return setTag;

                              case weakMapCtorString:
                                return weakMapTag;
                            }
                            return result;
                        });
                        var isMaskable = coreJsData ? isFunction : stubFalse;
                        function isPrototype(value) {
                            var Ctor = value && value.constructor;
                            return value === ("function" == typeof Ctor && Ctor.prototype || objectProto);
                        }
                        function isStrictComparable(value) {
                            return value == value && !isObject(value);
                        }
                        function matchesStrictComparable(key, srcValue) {
                            return function(object) {
                                return null != object && object[key] === srcValue && (srcValue !== undefined || key in Object(object));
                            };
                        }
                        function overRest(func, start, transform) {
                            return start = nativeMax(start === undefined ? func.length - 1 : start, 0), function() {
                                for (var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); ++index < length; ) array[index] = args[start + index];
                                index = -1;
                                for (var otherArgs = Array(start + 1); ++index < start; ) otherArgs[index] = args[index];
                                return otherArgs[start] = transform(array), apply(func, this, otherArgs);
                            };
                        }
                        function parent(object, path) {
                            return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
                        }
                        var setData = shortOut(baseSetData), setTimeout = ctxSetTimeout || function(func, wait) {
                            return root.setTimeout(func, wait);
                        }, setToString = shortOut(baseSetToString);
                        function setWrapToString(wrapper, reference, bitmask) {
                            var source = reference + "";
                            return setToString(wrapper, function(source, details) {
                                var length = details.length;
                                if (!length) return source;
                                var lastIndex = length - 1;
                                return details[lastIndex] = (1 < length ? "& " : "") + details[lastIndex], details = details.join(2 < length ? ", " : " "), 
                                source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
                            }(source, function(details, bitmask) {
                                return arrayEach(wrapFlags, function(pair) {
                                    var value = "_." + pair[0];
                                    bitmask & pair[1] && !arrayIncludes(details, value) && details.push(value);
                                }), details.sort();
                            }(function(source) {
                                var match = source.match(reWrapDetails);
                                return match ? match[1].split(reSplitDetails) : [];
                            }(source), bitmask)));
                        }
                        function shortOut(func) {
                            var count = 0, lastCalled = 0;
                            return function() {
                                var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
                                if (lastCalled = stamp, 0 < remaining) {
                                    if (++count >= HOT_COUNT) return arguments[0];
                                } else count = 0;
                                return func.apply(undefined, arguments);
                            };
                        }
                        function shuffleSelf(array, size) {
                            var index = -1, length = array.length, lastIndex = length - 1;
                            for (size = size === undefined ? length : size; ++index < size; ) {
                                var rand = baseRandom(index, lastIndex), value = array[rand];
                                array[rand] = array[index], array[index] = value;
                            }
                            return array.length = size, array;
                        }
                        var stringToPath = function(func) {
                            var result = memoize(func, function(key) {
                                return cache.size === MAX_MEMOIZE_SIZE && cache.clear(), key;
                            }), cache = result.cache;
                            return result;
                        }(function(string) {
                            var result = [];
                            return 46 === string.charCodeAt(0) && result.push(""), string.replace(rePropName, function(match, number, quote, subString) {
                                result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
                            }), result;
                        });
                        function toKey(value) {
                            if ("string" == typeof value || isSymbol(value)) return value;
                            var result = value + "";
                            return "0" == result && 1 / value == -INFINITY ? "-0" : result;
                        }
                        function toSource(func) {
                            if (null != func) {
                                try {
                                    return funcToString.call(func);
                                } catch (e) {}
                                try {
                                    return func + "";
                                } catch (e) {}
                            }
                            return "";
                        }
                        function wrapperClone(wrapper) {
                            if (wrapper instanceof LazyWrapper) return wrapper.clone();
                            var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
                            return result.__actions__ = copyArray(wrapper.__actions__), result.__index__ = wrapper.__index__, 
                            result.__values__ = wrapper.__values__, result;
                        }
                        var difference = baseRest(function(array, values) {
                            return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, !0)) : [];
                        }), differenceBy = baseRest(function(array, values) {
                            var iteratee = last(values);
                            return isArrayLikeObject(iteratee) && (iteratee = undefined), isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, !0), getIteratee(iteratee, 2)) : [];
                        }), differenceWith = baseRest(function(array, values) {
                            var comparator = last(values);
                            return isArrayLikeObject(comparator) && (comparator = undefined), isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, !0), undefined, comparator) : [];
                        });
                        function findIndex(array, predicate, fromIndex) {
                            var length = null == array ? 0 : array.length;
                            if (!length) return -1;
                            var index = null == fromIndex ? 0 : toInteger(fromIndex);
                            return index < 0 && (index = nativeMax(length + index, 0)), baseFindIndex(array, getIteratee(predicate, 3), index);
                        }
                        function findLastIndex(array, predicate, fromIndex) {
                            var length = null == array ? 0 : array.length;
                            if (!length) return -1;
                            var index = length - 1;
                            return fromIndex !== undefined && (index = toInteger(fromIndex), index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1)), 
                            baseFindIndex(array, getIteratee(predicate, 3), index, !0);
                        }
                        function flatten(array) {
                            return null != array && array.length ? baseFlatten(array, 1) : [];
                        }
                        function head(array) {
                            return array && array.length ? array[0] : undefined;
                        }
                        var intersection = baseRest(function(arrays) {
                            var mapped = arrayMap(arrays, castArrayLikeObject);
                            return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
                        }), intersectionBy = baseRest(function(arrays) {
                            var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
                            return iteratee === last(mapped) ? iteratee = undefined : mapped.pop(), mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, getIteratee(iteratee, 2)) : [];
                        }), intersectionWith = baseRest(function(arrays) {
                            var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
                            return (comparator = "function" == typeof comparator ? comparator : undefined) && mapped.pop(), 
                            mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined, comparator) : [];
                        });
                        function last(array) {
                            var length = null == array ? 0 : array.length;
                            return length ? array[length - 1] : undefined;
                        }
                        var pull = baseRest(pullAll);
                        function pullAll(array, values) {
                            return array && array.length && values && values.length ? basePullAll(array, values) : array;
                        }
                        var pullAt = flatRest(function(array, indexes) {
                            var length = null == array ? 0 : array.length, result = baseAt(array, indexes);
                            return basePullAt(array, arrayMap(indexes, function(index) {
                                return isIndex(index, length) ? +index : index;
                            }).sort(compareAscending)), result;
                        });
                        function reverse(array) {
                            return null == array ? array : nativeReverse.call(array);
                        }
                        var union = baseRest(function(arrays) {
                            return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, !0));
                        }), unionBy = baseRest(function(arrays) {
                            var iteratee = last(arrays);
                            return isArrayLikeObject(iteratee) && (iteratee = undefined), baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, !0), getIteratee(iteratee, 2));
                        }), unionWith = baseRest(function(arrays) {
                            var comparator = last(arrays);
                            return comparator = "function" == typeof comparator ? comparator : undefined, baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, !0), undefined, comparator);
                        });
                        function unzip(array) {
                            if (!array || !array.length) return [];
                            var length = 0;
                            return array = arrayFilter(array, function(group) {
                                if (isArrayLikeObject(group)) return length = nativeMax(group.length, length), !0;
                            }), baseTimes(length, function(index) {
                                return arrayMap(array, baseProperty(index));
                            });
                        }
                        function unzipWith(array, iteratee) {
                            if (!array || !array.length) return [];
                            var result = unzip(array);
                            return null == iteratee ? result : arrayMap(result, function(group) {
                                return apply(iteratee, undefined, group);
                            });
                        }
                        var without = baseRest(function(array, values) {
                            return isArrayLikeObject(array) ? baseDifference(array, values) : [];
                        }), xor = baseRest(function(arrays) {
                            return baseXor(arrayFilter(arrays, isArrayLikeObject));
                        }), xorBy = baseRest(function(arrays) {
                            var iteratee = last(arrays);
                            return isArrayLikeObject(iteratee) && (iteratee = undefined), baseXor(arrayFilter(arrays, isArrayLikeObject), getIteratee(iteratee, 2));
                        }), xorWith = baseRest(function(arrays) {
                            var comparator = last(arrays);
                            return comparator = "function" == typeof comparator ? comparator : undefined, baseXor(arrayFilter(arrays, isArrayLikeObject), undefined, comparator);
                        }), zip = baseRest(unzip);
                        var zipWith = baseRest(function(arrays) {
                            var length = arrays.length, iteratee = 1 < length ? arrays[length - 1] : undefined;
                            return unzipWith(arrays, iteratee = "function" == typeof iteratee ? (arrays.pop(), 
                            iteratee) : undefined);
                        });
                        function chain(value) {
                            var result = lodash(value);
                            return result.__chain__ = !0, result;
                        }
                        function thru(value, interceptor) {
                            return interceptor(value);
                        }
                        var wrapperAt = flatRest(function(paths) {
                            var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
                                return baseAt(object, paths);
                            };
                            return !(1 < length || this.__actions__.length) && value instanceof LazyWrapper && isIndex(start) ? ((value = value.slice(start, +start + (length ? 1 : 0))).__actions__.push({
                                func: thru,
                                args: [ interceptor ],
                                thisArg: undefined
                            }), new LodashWrapper(value, this.__chain__).thru(function(array) {
                                return length && !array.length && array.push(undefined), array;
                            })) : this.thru(interceptor);
                        });
                        var countBy = createAggregator(function(result, value, key) {
                            hasOwnProperty.call(result, key) ? ++result[key] : baseAssignValue(result, key, 1);
                        });
                        var find = createFind(findIndex), findLast = createFind(findLastIndex);
                        function forEach(collection, iteratee) {
                            return (isArray(collection) ? arrayEach : baseEach)(collection, getIteratee(iteratee, 3));
                        }
                        function forEachRight(collection, iteratee) {
                            return (isArray(collection) ? arrayEachRight : baseEachRight)(collection, getIteratee(iteratee, 3));
                        }
                        var groupBy = createAggregator(function(result, value, key) {
                            hasOwnProperty.call(result, key) ? result[key].push(value) : baseAssignValue(result, key, [ value ]);
                        });
                        var invokeMap = baseRest(function(collection, path, args) {
                            var index = -1, isFunc = "function" == typeof path, result = isArrayLike(collection) ? Array(collection.length) : [];
                            return baseEach(collection, function(value) {
                                result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
                            }), result;
                        }), keyBy = createAggregator(function(result, value, key) {
                            baseAssignValue(result, key, value);
                        });
                        function map(collection, iteratee) {
                            return (isArray(collection) ? arrayMap : baseMap)(collection, getIteratee(iteratee, 3));
                        }
                        var partition = createAggregator(function(result, value, key) {
                            result[key ? 0 : 1].push(value);
                        }, function() {
                            return [ [], [] ];
                        });
                        var sortBy = baseRest(function(collection, iteratees) {
                            if (null == collection) return [];
                            var length = iteratees.length;
                            return 1 < length && isIterateeCall(collection, iteratees[0], iteratees[1]) ? iteratees = [] : 2 < length && isIterateeCall(iteratees[0], iteratees[1], iteratees[2]) && (iteratees = [ iteratees[0] ]), 
                            baseOrderBy(collection, baseFlatten(iteratees, 1), []);
                        }), now = ctxNow || function() {
                            return root.Date.now();
                        };
                        function ary(func, n, guard) {
                            return n = guard ? undefined : n, n = func && null == n ? func.length : n, createWrap(func, WRAP_ARY_FLAG, undefined, undefined, undefined, undefined, n);
                        }
                        function before(n, func) {
                            var result;
                            if ("function" != typeof func) throw new TypeError(FUNC_ERROR_TEXT);
                            return n = toInteger(n), function() {
                                return 0 < --n && (result = func.apply(this, arguments)), n <= 1 && (func = undefined), 
                                result;
                            };
                        }
                        var bind = baseRest(function(func, thisArg, partials) {
                            var bitmask = WRAP_BIND_FLAG;
                            if (partials.length) {
                                var holders = replaceHolders(partials, getHolder(bind));
                                bitmask |= WRAP_PARTIAL_FLAG;
                            }
                            return createWrap(func, bitmask, thisArg, partials, holders);
                        }), bindKey = baseRest(function(object, key, partials) {
                            var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
                            if (partials.length) {
                                var holders = replaceHolders(partials, getHolder(bindKey));
                                bitmask |= WRAP_PARTIAL_FLAG;
                            }
                            return createWrap(key, bitmask, object, partials, holders);
                        });
                        function debounce(func, wait, options) {
                            var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = !1, maxing = !1, trailing = !0;
                            if ("function" != typeof func) throw new TypeError(FUNC_ERROR_TEXT);
                            function invokeFunc(time) {
                                var args = lastArgs, thisArg = lastThis;
                                return lastArgs = lastThis = undefined, lastInvokeTime = time, result = func.apply(thisArg, args);
                            }
                            function shouldInvoke(time) {
                                var timeSinceLastCall = time - lastCallTime;
                                return lastCallTime === undefined || wait <= timeSinceLastCall || timeSinceLastCall < 0 || maxing && maxWait <= time - lastInvokeTime;
                            }
                            function timerExpired() {
                                var time = now();
                                if (shouldInvoke(time)) return trailingEdge(time);
                                timerId = setTimeout(timerExpired, function(time) {
                                    var timeWaiting = wait - (time - lastCallTime);
                                    return maxing ? nativeMin(timeWaiting, maxWait - (time - lastInvokeTime)) : timeWaiting;
                                }(time));
                            }
                            function trailingEdge(time) {
                                return timerId = undefined, trailing && lastArgs ? invokeFunc(time) : (lastArgs = lastThis = undefined, 
                                result);
                            }
                            function debounced() {
                                var time = now(), isInvoking = shouldInvoke(time);
                                if (lastArgs = arguments, lastThis = this, lastCallTime = time, isInvoking) {
                                    if (timerId === undefined) return function(time) {
                                        return lastInvokeTime = time, timerId = setTimeout(timerExpired, wait), leading ? invokeFunc(time) : result;
                                    }(lastCallTime);
                                    if (maxing) return timerId = setTimeout(timerExpired, wait), invokeFunc(lastCallTime);
                                }
                                return timerId === undefined && (timerId = setTimeout(timerExpired, wait)), result;
                            }
                            return wait = toNumber(wait) || 0, isObject(options) && (leading = !!options.leading, 
                            maxWait = (maxing = "maxWait" in options) ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait, 
                            trailing = "trailing" in options ? !!options.trailing : trailing), debounced.cancel = function() {
                                timerId !== undefined && clearTimeout(timerId), lastInvokeTime = 0, lastArgs = lastCallTime = lastThis = timerId = undefined;
                            }, debounced.flush = function() {
                                return timerId === undefined ? result : trailingEdge(now());
                            }, debounced;
                        }
                        var defer = baseRest(function(func, args) {
                            return baseDelay(func, 1, args);
                        }), delay = baseRest(function(func, wait, args) {
                            return baseDelay(func, toNumber(wait) || 0, args);
                        });
                        function memoize(func, resolver) {
                            if ("function" != typeof func || null != resolver && "function" != typeof resolver) throw new TypeError(FUNC_ERROR_TEXT);
                            var memoized = function() {
                                var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
                                if (cache.has(key)) return cache.get(key);
                                var result = func.apply(this, args);
                                return memoized.cache = cache.set(key, result) || cache, result;
                            };
                            return memoized.cache = new (memoize.Cache || MapCache)(), memoized;
                        }
                        function negate(predicate) {
                            if ("function" != typeof predicate) throw new TypeError(FUNC_ERROR_TEXT);
                            return function() {
                                var args = arguments;
                                switch (args.length) {
                                  case 0:
                                    return !predicate.call(this);

                                  case 1:
                                    return !predicate.call(this, args[0]);

                                  case 2:
                                    return !predicate.call(this, args[0], args[1]);

                                  case 3:
                                    return !predicate.call(this, args[0], args[1], args[2]);
                                }
                                return !predicate.apply(this, args);
                            };
                        }
                        memoize.Cache = MapCache;
                        var overArgs = castRest(function(func, transforms) {
                            var funcsLength = (transforms = 1 == transforms.length && isArray(transforms[0]) ? arrayMap(transforms[0], baseUnary(getIteratee())) : arrayMap(baseFlatten(transforms, 1), baseUnary(getIteratee()))).length;
                            return baseRest(function(args) {
                                for (var index = -1, length = nativeMin(args.length, funcsLength); ++index < length; ) args[index] = transforms[index].call(this, args[index]);
                                return apply(func, this, args);
                            });
                        }), partial = baseRest(function(func, partials) {
                            var holders = replaceHolders(partials, getHolder(partial));
                            return createWrap(func, WRAP_PARTIAL_FLAG, undefined, partials, holders);
                        }), partialRight = baseRest(function(func, partials) {
                            var holders = replaceHolders(partials, getHolder(partialRight));
                            return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, undefined, partials, holders);
                        }), rearg = flatRest(function(func, indexes) {
                            return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
                        });
                        function eq(value, other) {
                            return value === other || value != value && other != other;
                        }
                        var gt = createRelationalOperation(baseGt), gte = createRelationalOperation(function(value, other) {
                            return other <= value;
                        }), isArguments = baseIsArguments(function() {
                            return arguments;
                        }()) ? baseIsArguments : function(value) {
                            return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
                        }, isArray = Array.isArray, isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : function(value) {
                            return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
                        };
                        function isArrayLike(value) {
                            return null != value && isLength(value.length) && !isFunction(value);
                        }
                        function isArrayLikeObject(value) {
                            return isObjectLike(value) && isArrayLike(value);
                        }
                        var isBuffer = nativeIsBuffer || stubFalse, isDate = nodeIsDate ? baseUnary(nodeIsDate) : function(value) {
                            return isObjectLike(value) && baseGetTag(value) == dateTag;
                        };
                        function isError(value) {
                            if (!isObjectLike(value)) return !1;
                            var tag = baseGetTag(value);
                            return tag == errorTag || tag == domExcTag || "string" == typeof value.message && "string" == typeof value.name && !isPlainObject(value);
                        }
                        function isFunction(value) {
                            if (!isObject(value)) return !1;
                            var tag = baseGetTag(value);
                            return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
                        }
                        function isInteger(value) {
                            return "number" == typeof value && value == toInteger(value);
                        }
                        function isLength(value) {
                            return "number" == typeof value && -1 < value && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
                        }
                        function isObject(value) {
                            var type = typeof value;
                            return null != value && ("object" == type || "function" == type);
                        }
                        function isObjectLike(value) {
                            return null != value && "object" == typeof value;
                        }
                        var isMap = nodeIsMap ? baseUnary(nodeIsMap) : function(value) {
                            return isObjectLike(value) && getTag(value) == mapTag;
                        };
                        function isNumber(value) {
                            return "number" == typeof value || isObjectLike(value) && baseGetTag(value) == numberTag;
                        }
                        function isPlainObject(value) {
                            if (!isObjectLike(value) || baseGetTag(value) != objectTag) return !1;
                            var proto = getPrototype(value);
                            if (null === proto) return !0;
                            var Ctor = hasOwnProperty.call(proto, "constructor") && proto.constructor;
                            return "function" == typeof Ctor && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
                        }
                        var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : function(value) {
                            return isObjectLike(value) && baseGetTag(value) == regexpTag;
                        };
                        var isSet = nodeIsSet ? baseUnary(nodeIsSet) : function(value) {
                            return isObjectLike(value) && getTag(value) == setTag;
                        };
                        function isString(value) {
                            return "string" == typeof value || !isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
                        }
                        function isSymbol(value) {
                            return "symbol" == typeof value || isObjectLike(value) && baseGetTag(value) == symbolTag;
                        }
                        var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : function(value) {
                            return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
                        };
                        var lt = createRelationalOperation(baseLt), lte = createRelationalOperation(function(value, other) {
                            return value <= other;
                        });
                        function toArray(value) {
                            if (!value) return [];
                            if (isArrayLike(value)) return isString(value) ? stringToArray(value) : copyArray(value);
                            if (symIterator && value[symIterator]) return function(iterator) {
                                for (var data, result = []; !(data = iterator.next()).done; ) result.push(data.value);
                                return result;
                            }(value[symIterator]());
                            var tag = getTag(value);
                            return (tag == mapTag ? mapToArray : tag == setTag ? setToArray : values)(value);
                        }
                        function toFinite(value) {
                            return value ? (value = toNumber(value)) === INFINITY || value === -INFINITY ? (value < 0 ? -1 : 1) * MAX_INTEGER : value == value ? value : 0 : 0 === value ? value : 0;
                        }
                        function toInteger(value) {
                            var result = toFinite(value), remainder = result % 1;
                            return result == result ? remainder ? result - remainder : result : 0;
                        }
                        function toLength(value) {
                            return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH) : 0;
                        }
                        function toNumber(value) {
                            if ("number" == typeof value) return value;
                            if (isSymbol(value)) return NAN;
                            if (isObject(value)) {
                                var other = "function" == typeof value.valueOf ? value.valueOf() : value;
                                value = isObject(other) ? other + "" : other;
                            }
                            if ("string" != typeof value) return 0 === value ? value : +value;
                            value = value.replace(reTrim, "");
                            var isBinary = reIsBinary.test(value);
                            return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
                        }
                        function toPlainObject(value) {
                            return copyObject(value, keysIn(value));
                        }
                        function toString(value) {
                            return null == value ? "" : baseToString(value);
                        }
                        var assign = createAssigner(function(object, source) {
                            if (isPrototype(source) || isArrayLike(source)) copyObject(source, keys(source), object); else for (var key in source) hasOwnProperty.call(source, key) && assignValue(object, key, source[key]);
                        }), assignIn = createAssigner(function(object, source) {
                            copyObject(source, keysIn(source), object);
                        }), assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
                            copyObject(source, keysIn(source), object, customizer);
                        }), assignWith = createAssigner(function(object, source, srcIndex, customizer) {
                            copyObject(source, keys(source), object, customizer);
                        }), at = flatRest(baseAt);
                        var defaults = baseRest(function(object, sources) {
                            object = Object(object);
                            var index = -1, length = sources.length, guard = 2 < length ? sources[2] : undefined;
                            for (guard && isIterateeCall(sources[0], sources[1], guard) && (length = 1); ++index < length; ) for (var source = sources[index], props = keysIn(source), propsIndex = -1, propsLength = props.length; ++propsIndex < propsLength; ) {
                                var key = props[propsIndex], value = object[key];
                                (value === undefined || eq(value, objectProto[key]) && !hasOwnProperty.call(object, key)) && (object[key] = source[key]);
                            }
                            return object;
                        }), defaultsDeep = baseRest(function(args) {
                            return args.push(undefined, customDefaultsMerge), apply(mergeWith, undefined, args);
                        });
                        function get(object, path, defaultValue) {
                            var result = null == object ? undefined : baseGet(object, path);
                            return result === undefined ? defaultValue : result;
                        }
                        function hasIn(object, path) {
                            return null != object && hasPath(object, path, baseHasIn);
                        }
                        var invert = createInverter(function(result, value, key) {
                            null != value && "function" != typeof value.toString && (value = nativeObjectToString.call(value)), 
                            result[value] = key;
                        }, constant(identity)), invertBy = createInverter(function(result, value, key) {
                            null != value && "function" != typeof value.toString && (value = nativeObjectToString.call(value)), 
                            hasOwnProperty.call(result, value) ? result[value].push(key) : result[value] = [ key ];
                        }, getIteratee), invoke = baseRest(baseInvoke);
                        function keys(object) {
                            return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
                        }
                        function keysIn(object) {
                            return isArrayLike(object) ? arrayLikeKeys(object, !0) : baseKeysIn(object);
                        }
                        var merge = createAssigner(function(object, source, srcIndex) {
                            baseMerge(object, source, srcIndex);
                        }), mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
                            baseMerge(object, source, srcIndex, customizer);
                        }), omit = flatRest(function(object, paths) {
                            var result = {};
                            if (null == object) return result;
                            var isDeep = !1;
                            paths = arrayMap(paths, function(path) {
                                return path = castPath(path, object), isDeep || (isDeep = 1 < path.length), path;
                            }), copyObject(object, getAllKeysIn(object), result), isDeep && (result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone));
                            for (var length = paths.length; length--; ) baseUnset(result, paths[length]);
                            return result;
                        });
                        var pick = flatRest(function(object, paths) {
                            return null == object ? {} : function(object, paths) {
                                return basePickBy(object, paths, function(value, path) {
                                    return hasIn(object, path);
                                });
                            }(object, paths);
                        });
                        function pickBy(object, predicate) {
                            if (null == object) return {};
                            var props = arrayMap(getAllKeysIn(object), function(prop) {
                                return [ prop ];
                            });
                            return predicate = getIteratee(predicate), basePickBy(object, props, function(value, path) {
                                return predicate(value, path[0]);
                            });
                        }
                        var toPairs = createToPairs(keys), toPairsIn = createToPairs(keysIn);
                        function values(object) {
                            return null == object ? [] : baseValues(object, keys(object));
                        }
                        var camelCase = createCompounder(function(result, word, index) {
                            return word = word.toLowerCase(), result + (index ? capitalize(word) : word);
                        });
                        function capitalize(string) {
                            return upperFirst(toString(string).toLowerCase());
                        }
                        function deburr(string) {
                            return (string = toString(string)) && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
                        }
                        var kebabCase = createCompounder(function(result, word, index) {
                            return result + (index ? "-" : "") + word.toLowerCase();
                        }), lowerCase = createCompounder(function(result, word, index) {
                            return result + (index ? " " : "") + word.toLowerCase();
                        }), lowerFirst = createCaseFirst("toLowerCase");
                        var snakeCase = createCompounder(function(result, word, index) {
                            return result + (index ? "_" : "") + word.toLowerCase();
                        });
                        var startCase = createCompounder(function(result, word, index) {
                            return result + (index ? " " : "") + upperFirst(word);
                        });
                        var upperCase = createCompounder(function(result, word, index) {
                            return result + (index ? " " : "") + word.toUpperCase();
                        }), upperFirst = createCaseFirst("toUpperCase");
                        function words(string, pattern, guard) {
                            return string = toString(string), (pattern = guard ? undefined : pattern) === undefined ? function(string) {
                                return reHasUnicodeWord.test(string);
                            }(string) ? function(string) {
                                return string.match(reUnicodeWord) || [];
                            }(string) : function(string) {
                                return string.match(reAsciiWord) || [];
                            }(string) : string.match(pattern) || [];
                        }
                        var attempt = baseRest(function(func, args) {
                            try {
                                return apply(func, undefined, args);
                            } catch (e) {
                                return isError(e) ? e : new Error(e);
                            }
                        }), bindAll = flatRest(function(object, methodNames) {
                            return arrayEach(methodNames, function(key) {
                                key = toKey(key), baseAssignValue(object, key, bind(object[key], object));
                            }), object;
                        });
                        function constant(value) {
                            return function() {
                                return value;
                            };
                        }
                        var flow = createFlow(), flowRight = createFlow(!0);
                        function identity(value) {
                            return value;
                        }
                        function iteratee(func) {
                            return baseIteratee("function" == typeof func ? func : baseClone(func, CLONE_DEEP_FLAG));
                        }
                        var method = baseRest(function(path, args) {
                            return function(object) {
                                return baseInvoke(object, path, args);
                            };
                        }), methodOf = baseRest(function(object, args) {
                            return function(path) {
                                return baseInvoke(object, path, args);
                            };
                        });
                        function mixin(object, source, options) {
                            var props = keys(source), methodNames = baseFunctions(source, props);
                            null != options || isObject(source) && (methodNames.length || !props.length) || (options = source, 
                            source = object, object = this, methodNames = baseFunctions(source, keys(source)));
                            var chain = !(isObject(options) && "chain" in options && !options.chain), isFunc = isFunction(object);
                            return arrayEach(methodNames, function(methodName) {
                                var func = source[methodName];
                                object[methodName] = func, isFunc && (object.prototype[methodName] = function() {
                                    var chainAll = this.__chain__;
                                    if (chain || chainAll) {
                                        var result = object(this.__wrapped__);
                                        return (result.__actions__ = copyArray(this.__actions__)).push({
                                            func: func,
                                            args: arguments,
                                            thisArg: object
                                        }), result.__chain__ = chainAll, result;
                                    }
                                    return func.apply(object, arrayPush([ this.value() ], arguments));
                                });
                            }), object;
                        }
                        function noop() {}
                        var over = createOver(arrayMap), overEvery = createOver(arrayEvery), overSome = createOver(arraySome);
                        function property(path) {
                            return isKey(path) ? baseProperty(toKey(path)) : function(path) {
                                return function(object) {
                                    return baseGet(object, path);
                                };
                            }(path);
                        }
                        var range = createRange(), rangeRight = createRange(!0);
                        function stubArray() {
                            return [];
                        }
                        function stubFalse() {
                            return !1;
                        }
                        var add = createMathOperation(function(augend, addend) {
                            return augend + addend;
                        }, 0), ceil = createRound("ceil"), divide = createMathOperation(function(dividend, divisor) {
                            return dividend / divisor;
                        }, 1), floor = createRound("floor");
                        var source, multiply = createMathOperation(function(multiplier, multiplicand) {
                            return multiplier * multiplicand;
                        }, 1), round = createRound("round"), subtract = createMathOperation(function(minuend, subtrahend) {
                            return minuend - subtrahend;
                        }, 0);
                        return lodash.after = function(n, func) {
                            if ("function" != typeof func) throw new TypeError(FUNC_ERROR_TEXT);
                            return n = toInteger(n), function() {
                                if (--n < 1) return func.apply(this, arguments);
                            };
                        }, lodash.ary = ary, lodash.assign = assign, lodash.assignIn = assignIn, lodash.assignInWith = assignInWith, 
                        lodash.assignWith = assignWith, lodash.at = at, lodash.before = before, lodash.bind = bind, 
                        lodash.bindAll = bindAll, lodash.bindKey = bindKey, lodash.castArray = function() {
                            if (!arguments.length) return [];
                            var value = arguments[0];
                            return isArray(value) ? value : [ value ];
                        }, lodash.chain = chain, lodash.chunk = function(array, size, guard) {
                            size = (guard ? isIterateeCall(array, size, guard) : size === undefined) ? 1 : nativeMax(toInteger(size), 0);
                            var length = null == array ? 0 : array.length;
                            if (!length || size < 1) return [];
                            for (var index = 0, resIndex = 0, result = Array(nativeCeil(length / size)); index < length; ) result[resIndex++] = baseSlice(array, index, index += size);
                            return result;
                        }, lodash.compact = function(array) {
                            for (var index = -1, length = null == array ? 0 : array.length, resIndex = 0, result = []; ++index < length; ) {
                                var value = array[index];
                                value && (result[resIndex++] = value);
                            }
                            return result;
                        }, lodash.concat = function() {
                            var length = arguments.length;
                            if (!length) return [];
                            for (var args = Array(length - 1), array = arguments[0], index = length; index--; ) args[index - 1] = arguments[index];
                            return arrayPush(isArray(array) ? copyArray(array) : [ array ], baseFlatten(args, 1));
                        }, lodash.cond = function(pairs) {
                            var length = null == pairs ? 0 : pairs.length, toIteratee = getIteratee();
                            return pairs = length ? arrayMap(pairs, function(pair) {
                                if ("function" != typeof pair[1]) throw new TypeError(FUNC_ERROR_TEXT);
                                return [ toIteratee(pair[0]), pair[1] ];
                            }) : [], baseRest(function(args) {
                                for (var index = -1; ++index < length; ) {
                                    var pair = pairs[index];
                                    if (apply(pair[0], this, args)) return apply(pair[1], this, args);
                                }
                            });
                        }, lodash.conforms = function(source) {
                            return function(source) {
                                var props = keys(source);
                                return function(object) {
                                    return baseConformsTo(object, source, props);
                                };
                            }(baseClone(source, CLONE_DEEP_FLAG));
                        }, lodash.constant = constant, lodash.countBy = countBy, lodash.create = function(prototype, properties) {
                            var result = baseCreate(prototype);
                            return null == properties ? result : baseAssign(result, properties);
                        }, lodash.curry = function curry(func, arity, guard) {
                            var result = createWrap(func, WRAP_CURRY_FLAG, undefined, undefined, undefined, undefined, undefined, arity = guard ? undefined : arity);
                            return result.placeholder = curry.placeholder, result;
                        }, lodash.curryRight = function curryRight(func, arity, guard) {
                            var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, undefined, undefined, undefined, undefined, undefined, arity = guard ? undefined : arity);
                            return result.placeholder = curryRight.placeholder, result;
                        }, lodash.debounce = debounce, lodash.defaults = defaults, lodash.defaultsDeep = defaultsDeep, 
                        lodash.defer = defer, lodash.delay = delay, lodash.difference = difference, lodash.differenceBy = differenceBy, 
                        lodash.differenceWith = differenceWith, lodash.drop = function(array, n, guard) {
                            var length = null == array ? 0 : array.length;
                            return length ? baseSlice(array, (n = guard || n === undefined ? 1 : toInteger(n)) < 0 ? 0 : n, length) : [];
                        }, lodash.dropRight = function(array, n, guard) {
                            var length = null == array ? 0 : array.length;
                            return length ? baseSlice(array, 0, (n = length - (n = guard || n === undefined ? 1 : toInteger(n))) < 0 ? 0 : n) : [];
                        }, lodash.dropRightWhile = function(array, predicate) {
                            return array && array.length ? baseWhile(array, getIteratee(predicate, 3), !0, !0) : [];
                        }, lodash.dropWhile = function(array, predicate) {
                            return array && array.length ? baseWhile(array, getIteratee(predicate, 3), !0) : [];
                        }, lodash.fill = function(array, value, start, end) {
                            var length = null == array ? 0 : array.length;
                            return length ? (start && "number" != typeof start && isIterateeCall(array, value, start) && (start = 0, 
                            end = length), function(array, value, start, end) {
                                var length = array.length;
                                for ((start = toInteger(start)) < 0 && (start = length < -start ? 0 : length + start), 
                                (end = end === undefined || length < end ? length : toInteger(end)) < 0 && (end += length), 
                                end = end < start ? 0 : toLength(end); start < end; ) array[start++] = value;
                                return array;
                            }(array, value, start, end)) : [];
                        }, lodash.filter = function(collection, predicate) {
                            return (isArray(collection) ? arrayFilter : baseFilter)(collection, getIteratee(predicate, 3));
                        }, lodash.flatMap = function(collection, iteratee) {
                            return baseFlatten(map(collection, iteratee), 1);
                        }, lodash.flatMapDeep = function(collection, iteratee) {
                            return baseFlatten(map(collection, iteratee), INFINITY);
                        }, lodash.flatMapDepth = function(collection, iteratee, depth) {
                            return depth = depth === undefined ? 1 : toInteger(depth), baseFlatten(map(collection, iteratee), depth);
                        }, lodash.flatten = flatten, lodash.flattenDeep = function(array) {
                            return null != array && array.length ? baseFlatten(array, INFINITY) : [];
                        }, lodash.flattenDepth = function(array, depth) {
                            return null != array && array.length ? baseFlatten(array, depth = depth === undefined ? 1 : toInteger(depth)) : [];
                        }, lodash.flip = function(func) {
                            return createWrap(func, WRAP_FLIP_FLAG);
                        }, lodash.flow = flow, lodash.flowRight = flowRight, lodash.fromPairs = function(pairs) {
                            for (var index = -1, length = null == pairs ? 0 : pairs.length, result = {}; ++index < length; ) {
                                var pair = pairs[index];
                                result[pair[0]] = pair[1];
                            }
                            return result;
                        }, lodash.functions = function(object) {
                            return null == object ? [] : baseFunctions(object, keys(object));
                        }, lodash.functionsIn = function(object) {
                            return null == object ? [] : baseFunctions(object, keysIn(object));
                        }, lodash.groupBy = groupBy, lodash.initial = function(array) {
                            return null != array && array.length ? baseSlice(array, 0, -1) : [];
                        }, lodash.intersection = intersection, lodash.intersectionBy = intersectionBy, lodash.intersectionWith = intersectionWith, 
                        lodash.invert = invert, lodash.invertBy = invertBy, lodash.invokeMap = invokeMap, 
                        lodash.iteratee = iteratee, lodash.keyBy = keyBy, lodash.keys = keys, lodash.keysIn = keysIn, 
                        lodash.map = map, lodash.mapKeys = function(object, iteratee) {
                            var result = {};
                            return iteratee = getIteratee(iteratee, 3), baseForOwn(object, function(value, key, object) {
                                baseAssignValue(result, iteratee(value, key, object), value);
                            }), result;
                        }, lodash.mapValues = function(object, iteratee) {
                            var result = {};
                            return iteratee = getIteratee(iteratee, 3), baseForOwn(object, function(value, key, object) {
                                baseAssignValue(result, key, iteratee(value, key, object));
                            }), result;
                        }, lodash.matches = function(source) {
                            return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
                        }, lodash.matchesProperty = function(path, srcValue) {
                            return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG));
                        }, lodash.memoize = memoize, lodash.merge = merge, lodash.mergeWith = mergeWith, 
                        lodash.method = method, lodash.methodOf = methodOf, lodash.mixin = mixin, lodash.negate = negate, 
                        lodash.nthArg = function(n) {
                            return n = toInteger(n), baseRest(function(args) {
                                return baseNth(args, n);
                            });
                        }, lodash.omit = omit, lodash.omitBy = function(object, predicate) {
                            return pickBy(object, negate(getIteratee(predicate)));
                        }, lodash.once = function(func) {
                            return before(2, func);
                        }, lodash.orderBy = function(collection, iteratees, orders, guard) {
                            return null == collection ? [] : (isArray(iteratees) || (iteratees = null == iteratees ? [] : [ iteratees ]), 
                            isArray(orders = guard ? undefined : orders) || (orders = null == orders ? [] : [ orders ]), 
                            baseOrderBy(collection, iteratees, orders));
                        }, lodash.over = over, lodash.overArgs = overArgs, lodash.overEvery = overEvery, 
                        lodash.overSome = overSome, lodash.partial = partial, lodash.partialRight = partialRight, 
                        lodash.partition = partition, lodash.pick = pick, lodash.pickBy = pickBy, lodash.property = property, 
                        lodash.propertyOf = function(object) {
                            return function(path) {
                                return null == object ? undefined : baseGet(object, path);
                            };
                        }, lodash.pull = pull, lodash.pullAll = pullAll, lodash.pullAllBy = function(array, values, iteratee) {
                            return array && array.length && values && values.length ? basePullAll(array, values, getIteratee(iteratee, 2)) : array;
                        }, lodash.pullAllWith = function(array, values, comparator) {
                            return array && array.length && values && values.length ? basePullAll(array, values, undefined, comparator) : array;
                        }, lodash.pullAt = pullAt, lodash.range = range, lodash.rangeRight = rangeRight, 
                        lodash.rearg = rearg, lodash.reject = function(collection, predicate) {
                            return (isArray(collection) ? arrayFilter : baseFilter)(collection, negate(getIteratee(predicate, 3)));
                        }, lodash.remove = function(array, predicate) {
                            var result = [];
                            if (!array || !array.length) return result;
                            var index = -1, indexes = [], length = array.length;
                            for (predicate = getIteratee(predicate, 3); ++index < length; ) {
                                var value = array[index];
                                predicate(value, index, array) && (result.push(value), indexes.push(index));
                            }
                            return basePullAt(array, indexes), result;
                        }, lodash.rest = function(func, start) {
                            if ("function" != typeof func) throw new TypeError(FUNC_ERROR_TEXT);
                            return baseRest(func, start = start === undefined ? start : toInteger(start));
                        }, lodash.reverse = reverse, lodash.sampleSize = function(collection, n, guard) {
                            return n = (guard ? isIterateeCall(collection, n, guard) : n === undefined) ? 1 : toInteger(n), 
                            (isArray(collection) ? arraySampleSize : baseSampleSize)(collection, n);
                        }, lodash.set = function(object, path, value) {
                            return null == object ? object : baseSet(object, path, value);
                        }, lodash.setWith = function(object, path, value, customizer) {
                            return customizer = "function" == typeof customizer ? customizer : undefined, null == object ? object : baseSet(object, path, value, customizer);
                        }, lodash.shuffle = function(collection) {
                            return (isArray(collection) ? arrayShuffle : baseShuffle)(collection);
                        }, lodash.slice = function(array, start, end) {
                            var length = null == array ? 0 : array.length;
                            return length ? (end && "number" != typeof end && isIterateeCall(array, start, end) ? (start = 0, 
                            end = length) : (start = null == start ? 0 : toInteger(start), end = end === undefined ? length : toInteger(end)), 
                            baseSlice(array, start, end)) : [];
                        }, lodash.sortBy = sortBy, lodash.sortedUniq = function(array) {
                            return array && array.length ? baseSortedUniq(array) : [];
                        }, lodash.sortedUniqBy = function(array, iteratee) {
                            return array && array.length ? baseSortedUniq(array, getIteratee(iteratee, 2)) : [];
                        }, lodash.split = function(string, separator, limit) {
                            return limit && "number" != typeof limit && isIterateeCall(string, separator, limit) && (separator = limit = undefined), 
                            (limit = limit === undefined ? MAX_ARRAY_LENGTH : limit >>> 0) ? (string = toString(string)) && ("string" == typeof separator || null != separator && !isRegExp(separator)) && !(separator = baseToString(separator)) && hasUnicode(string) ? castSlice(stringToArray(string), 0, limit) : string.split(separator, limit) : [];
                        }, lodash.spread = function(func, start) {
                            if ("function" != typeof func) throw new TypeError(FUNC_ERROR_TEXT);
                            return start = null == start ? 0 : nativeMax(toInteger(start), 0), baseRest(function(args) {
                                var array = args[start], otherArgs = castSlice(args, 0, start);
                                return array && arrayPush(otherArgs, array), apply(func, this, otherArgs);
                            });
                        }, lodash.tail = function(array) {
                            var length = null == array ? 0 : array.length;
                            return length ? baseSlice(array, 1, length) : [];
                        }, lodash.take = function(array, n, guard) {
                            return array && array.length ? baseSlice(array, 0, (n = guard || n === undefined ? 1 : toInteger(n)) < 0 ? 0 : n) : [];
                        }, lodash.takeRight = function(array, n, guard) {
                            var length = null == array ? 0 : array.length;
                            return length ? baseSlice(array, (n = length - (n = guard || n === undefined ? 1 : toInteger(n))) < 0 ? 0 : n, length) : [];
                        }, lodash.takeRightWhile = function(array, predicate) {
                            return array && array.length ? baseWhile(array, getIteratee(predicate, 3), !1, !0) : [];
                        }, lodash.takeWhile = function(array, predicate) {
                            return array && array.length ? baseWhile(array, getIteratee(predicate, 3)) : [];
                        }, lodash.tap = function(value, interceptor) {
                            return interceptor(value), value;
                        }, lodash.throttle = function(func, wait, options) {
                            var leading = !0, trailing = !0;
                            if ("function" != typeof func) throw new TypeError(FUNC_ERROR_TEXT);
                            return isObject(options) && (leading = "leading" in options ? !!options.leading : leading, 
                            trailing = "trailing" in options ? !!options.trailing : trailing), debounce(func, wait, {
                                leading: leading,
                                maxWait: wait,
                                trailing: trailing
                            });
                        }, lodash.thru = thru, lodash.toArray = toArray, lodash.toPairs = toPairs, lodash.toPairsIn = toPairsIn, 
                        lodash.toPath = function(value) {
                            return isArray(value) ? arrayMap(value, toKey) : isSymbol(value) ? [ value ] : copyArray(stringToPath(toString(value)));
                        }, lodash.toPlainObject = toPlainObject, lodash.transform = function(object, iteratee, accumulator) {
                            var isArr = isArray(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
                            if (iteratee = getIteratee(iteratee, 4), null == accumulator) {
                                var Ctor = object && object.constructor;
                                accumulator = isArrLike ? isArr ? new Ctor() : [] : isObject(object) && isFunction(Ctor) ? baseCreate(getPrototype(object)) : {};
                            }
                            return (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object) {
                                return iteratee(accumulator, value, index, object);
                            }), accumulator;
                        }, lodash.unary = function(func) {
                            return ary(func, 1);
                        }, lodash.union = union, lodash.unionBy = unionBy, lodash.unionWith = unionWith, 
                        lodash.uniq = function(array) {
                            return array && array.length ? baseUniq(array) : [];
                        }, lodash.uniqBy = function(array, iteratee) {
                            return array && array.length ? baseUniq(array, getIteratee(iteratee, 2)) : [];
                        }, lodash.uniqWith = function(array, comparator) {
                            return comparator = "function" == typeof comparator ? comparator : undefined, array && array.length ? baseUniq(array, undefined, comparator) : [];
                        }, lodash.unset = function(object, path) {
                            return null == object || baseUnset(object, path);
                        }, lodash.unzip = unzip, lodash.unzipWith = unzipWith, lodash.update = function(object, path, updater) {
                            return null == object ? object : baseUpdate(object, path, castFunction(updater));
                        }, lodash.updateWith = function(object, path, updater, customizer) {
                            return customizer = "function" == typeof customizer ? customizer : undefined, null == object ? object : baseUpdate(object, path, castFunction(updater), customizer);
                        }, lodash.values = values, lodash.valuesIn = function(object) {
                            return null == object ? [] : baseValues(object, keysIn(object));
                        }, lodash.without = without, lodash.words = words, lodash.wrap = function(value, wrapper) {
                            return partial(castFunction(wrapper), value);
                        }, lodash.xor = xor, lodash.xorBy = xorBy, lodash.xorWith = xorWith, lodash.zip = zip, 
                        lodash.zipObject = function(props, values) {
                            return baseZipObject(props || [], values || [], assignValue);
                        }, lodash.zipObjectDeep = function(props, values) {
                            return baseZipObject(props || [], values || [], baseSet);
                        }, lodash.zipWith = zipWith, lodash.entries = toPairs, lodash.entriesIn = toPairsIn, 
                        lodash.extend = assignIn, lodash.extendWith = assignInWith, mixin(lodash, lodash), 
                        lodash.add = add, lodash.attempt = attempt, lodash.camelCase = camelCase, lodash.capitalize = capitalize, 
                        lodash.ceil = ceil, lodash.clamp = function(number, lower, upper) {
                            return upper === undefined && (upper = lower, lower = undefined), upper !== undefined && (upper = (upper = toNumber(upper)) == upper ? upper : 0), 
                            lower !== undefined && (lower = (lower = toNumber(lower)) == lower ? lower : 0), 
                            baseClamp(toNumber(number), lower, upper);
                        }, lodash.clone = function(value) {
                            return baseClone(value, CLONE_SYMBOLS_FLAG);
                        }, lodash.cloneDeep = function(value) {
                            return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);
                        }, lodash.cloneDeepWith = function(value, customizer) {
                            return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG, customizer = "function" == typeof customizer ? customizer : undefined);
                        }, lodash.cloneWith = function(value, customizer) {
                            return baseClone(value, CLONE_SYMBOLS_FLAG, customizer = "function" == typeof customizer ? customizer : undefined);
                        }, lodash.conformsTo = function(object, source) {
                            return null == source || baseConformsTo(object, source, keys(source));
                        }, lodash.deburr = deburr, lodash.defaultTo = function(value, defaultValue) {
                            return null == value || value != value ? defaultValue : value;
                        }, lodash.divide = divide, lodash.endsWith = function(string, target, position) {
                            string = toString(string), target = baseToString(target);
                            var length = string.length, end = position = position === undefined ? length : baseClamp(toInteger(position), 0, length);
                            return 0 <= (position -= target.length) && string.slice(position, end) == target;
                        }, lodash.eq = eq, lodash.escape = function(string) {
                            return (string = toString(string)) && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
                        }, lodash.escapeRegExp = function(string) {
                            return (string = toString(string)) && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
                        }, lodash.every = function(collection, predicate, guard) {
                            var func = isArray(collection) ? arrayEvery : baseEvery;
                            return guard && isIterateeCall(collection, predicate, guard) && (predicate = undefined), 
                            func(collection, getIteratee(predicate, 3));
                        }, lodash.find = find, lodash.findIndex = findIndex, lodash.findKey = function(object, predicate) {
                            return baseFindKey(object, getIteratee(predicate, 3), baseForOwn);
                        }, lodash.findLast = findLast, lodash.findLastIndex = findLastIndex, lodash.findLastKey = function(object, predicate) {
                            return baseFindKey(object, getIteratee(predicate, 3), baseForOwnRight);
                        }, lodash.floor = floor, lodash.forEach = forEach, lodash.forEachRight = forEachRight, 
                        lodash.forIn = function(object, iteratee) {
                            return null == object ? object : baseFor(object, getIteratee(iteratee, 3), keysIn);
                        }, lodash.forInRight = function(object, iteratee) {
                            return null == object ? object : baseForRight(object, getIteratee(iteratee, 3), keysIn);
                        }, lodash.forOwn = function(object, iteratee) {
                            return object && baseForOwn(object, getIteratee(iteratee, 3));
                        }, lodash.forOwnRight = function(object, iteratee) {
                            return object && baseForOwnRight(object, getIteratee(iteratee, 3));
                        }, lodash.get = get, lodash.gt = gt, lodash.gte = gte, lodash.has = function(object, path) {
                            return null != object && hasPath(object, path, baseHas);
                        }, lodash.hasIn = hasIn, lodash.head = head, lodash.identity = identity, lodash.includes = function(collection, value, fromIndex, guard) {
                            collection = isArrayLike(collection) ? collection : values(collection), fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
                            var length = collection.length;
                            return fromIndex < 0 && (fromIndex = nativeMax(length + fromIndex, 0)), isString(collection) ? fromIndex <= length && -1 < collection.indexOf(value, fromIndex) : !!length && -1 < baseIndexOf(collection, value, fromIndex);
                        }, lodash.indexOf = function(array, value, fromIndex) {
                            var length = null == array ? 0 : array.length;
                            if (!length) return -1;
                            var index = null == fromIndex ? 0 : toInteger(fromIndex);
                            return index < 0 && (index = nativeMax(length + index, 0)), baseIndexOf(array, value, index);
                        }, lodash.inRange = function(number, start, end) {
                            return start = toFinite(start), end === undefined ? (end = start, start = 0) : end = toFinite(end), 
                            function(number, start, end) {
                                return number >= nativeMin(start, end) && number < nativeMax(start, end);
                            }(number = toNumber(number), start, end);
                        }, lodash.invoke = invoke, lodash.isArguments = isArguments, lodash.isArray = isArray, 
                        lodash.isArrayBuffer = isArrayBuffer, lodash.isArrayLike = isArrayLike, lodash.isArrayLikeObject = isArrayLikeObject, 
                        lodash.isBoolean = function(value) {
                            return !0 === value || !1 === value || isObjectLike(value) && baseGetTag(value) == boolTag;
                        }, lodash.isBuffer = isBuffer, lodash.isDate = isDate, lodash.isElement = function(value) {
                            return isObjectLike(value) && 1 === value.nodeType && !isPlainObject(value);
                        }, lodash.isEmpty = function(value) {
                            if (null == value) return !0;
                            if (isArrayLike(value) && (isArray(value) || "string" == typeof value || "function" == typeof value.splice || isBuffer(value) || isTypedArray(value) || isArguments(value))) return !value.length;
                            var tag = getTag(value);
                            if (tag == mapTag || tag == setTag) return !value.size;
                            if (isPrototype(value)) return !baseKeys(value).length;
                            for (var key in value) if (hasOwnProperty.call(value, key)) return !1;
                            return !0;
                        }, lodash.isEqual = function(value, other) {
                            return baseIsEqual(value, other);
                        }, lodash.isEqualWith = function(value, other, customizer) {
                            var result = (customizer = "function" == typeof customizer ? customizer : undefined) ? customizer(value, other) : undefined;
                            return result === undefined ? baseIsEqual(value, other, undefined, customizer) : !!result;
                        }, lodash.isError = isError, lodash.isFinite = function(value) {
                            return "number" == typeof value && nativeIsFinite(value);
                        }, lodash.isFunction = isFunction, lodash.isInteger = isInteger, lodash.isLength = isLength, 
                        lodash.isMap = isMap, lodash.isMatch = function(object, source) {
                            return object === source || baseIsMatch(object, source, getMatchData(source));
                        }, lodash.isMatchWith = function(object, source, customizer) {
                            return customizer = "function" == typeof customizer ? customizer : undefined, baseIsMatch(object, source, getMatchData(source), customizer);
                        }, lodash.isNaN = function(value) {
                            return isNumber(value) && value != +value;
                        }, lodash.isNative = function(value) {
                            if (isMaskable(value)) throw new Error(CORE_ERROR_TEXT);
                            return baseIsNative(value);
                        }, lodash.isNil = function(value) {
                            return null == value;
                        }, lodash.isNull = function(value) {
                            return null === value;
                        }, lodash.isNumber = isNumber, lodash.isObject = isObject, lodash.isObjectLike = isObjectLike, 
                        lodash.isPlainObject = isPlainObject, lodash.isRegExp = isRegExp, lodash.isSafeInteger = function(value) {
                            return isInteger(value) && -MAX_SAFE_INTEGER <= value && value <= MAX_SAFE_INTEGER;
                        }, lodash.isSet = isSet, lodash.isString = isString, lodash.isSymbol = isSymbol, 
                        lodash.isTypedArray = isTypedArray, lodash.isUndefined = function(value) {
                            return value === undefined;
                        }, lodash.isWeakMap = function(value) {
                            return isObjectLike(value) && getTag(value) == weakMapTag;
                        }, lodash.isWeakSet = function(value) {
                            return isObjectLike(value) && baseGetTag(value) == weakSetTag;
                        }, lodash.join = function(array, separator) {
                            return null == array ? "" : nativeJoin.call(array, separator);
                        }, lodash.kebabCase = kebabCase, lodash.last = last, lodash.lastIndexOf = function(array, value, fromIndex) {
                            var length = null == array ? 0 : array.length;
                            if (!length) return -1;
                            var index = length;
                            return fromIndex !== undefined && (index = (index = toInteger(fromIndex)) < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1)), 
                            value == value ? function(array, value, fromIndex) {
                                for (var index = fromIndex + 1; index--; ) if (array[index] === value) return index;
                                return index;
                            }(array, value, index) : baseFindIndex(array, baseIsNaN, index, !0);
                        }, lodash.lowerCase = lowerCase, lodash.lowerFirst = lowerFirst, lodash.lt = lt, 
                        lodash.lte = lte, lodash.max = function(array) {
                            return array && array.length ? baseExtremum(array, identity, baseGt) : undefined;
                        }, lodash.maxBy = function(array, iteratee) {
                            return array && array.length ? baseExtremum(array, getIteratee(iteratee, 2), baseGt) : undefined;
                        }, lodash.mean = function(array) {
                            return baseMean(array, identity);
                        }, lodash.meanBy = function(array, iteratee) {
                            return baseMean(array, getIteratee(iteratee, 2));
                        }, lodash.min = function(array) {
                            return array && array.length ? baseExtremum(array, identity, baseLt) : undefined;
                        }, lodash.minBy = function(array, iteratee) {
                            return array && array.length ? baseExtremum(array, getIteratee(iteratee, 2), baseLt) : undefined;
                        }, lodash.stubArray = stubArray, lodash.stubFalse = stubFalse, lodash.stubObject = function() {
                            return {};
                        }, lodash.stubString = function() {
                            return "";
                        }, lodash.stubTrue = function() {
                            return !0;
                        }, lodash.multiply = multiply, lodash.nth = function(array, n) {
                            return array && array.length ? baseNth(array, toInteger(n)) : undefined;
                        }, lodash.noConflict = function() {
                            return root._ === this && (root._ = oldDash), this;
                        }, lodash.noop = noop, lodash.now = now, lodash.pad = function(string, length, chars) {
                            string = toString(string);
                            var strLength = (length = toInteger(length)) ? stringSize(string) : 0;
                            if (!length || length <= strLength) return string;
                            var mid = (length - strLength) / 2;
                            return createPadding(nativeFloor(mid), chars) + string + createPadding(nativeCeil(mid), chars);
                        }, lodash.padEnd = function(string, length, chars) {
                            string = toString(string);
                            var strLength = (length = toInteger(length)) ? stringSize(string) : 0;
                            return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
                        }, lodash.padStart = function(string, length, chars) {
                            string = toString(string);
                            var strLength = (length = toInteger(length)) ? stringSize(string) : 0;
                            return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
                        }, lodash.parseInt = function(string, radix, guard) {
                            return guard || null == radix ? radix = 0 : radix && (radix = +radix), nativeParseInt(toString(string).replace(reTrimStart, ""), radix || 0);
                        }, lodash.random = function(lower, upper, floating) {
                            if (floating && "boolean" != typeof floating && isIterateeCall(lower, upper, floating) && (upper = floating = undefined), 
                            floating === undefined && ("boolean" == typeof upper ? (floating = upper, upper = undefined) : "boolean" == typeof lower && (floating = lower, 
                            lower = undefined)), lower === undefined && upper === undefined ? (lower = 0, upper = 1) : (lower = toFinite(lower), 
                            upper === undefined ? (upper = lower, lower = 0) : upper = toFinite(upper)), upper < lower) {
                                var temp = lower;
                                lower = upper, upper = temp;
                            }
                            if (floating || lower % 1 || upper % 1) {
                                var rand = nativeRandom();
                                return nativeMin(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
                            }
                            return baseRandom(lower, upper);
                        }, lodash.reduce = function(collection, iteratee, accumulator) {
                            var func = isArray(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
                            return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEach);
                        }, lodash.reduceRight = function(collection, iteratee, accumulator) {
                            var func = isArray(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
                            return func(collection, getIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
                        }, lodash.repeat = function(string, n, guard) {
                            return n = (guard ? isIterateeCall(string, n, guard) : n === undefined) ? 1 : toInteger(n), 
                            baseRepeat(toString(string), n);
                        }, lodash.replace = function() {
                            var args = arguments, string = toString(args[0]);
                            return args.length < 3 ? string : string.replace(args[1], args[2]);
                        }, lodash.result = function(object, path, defaultValue) {
                            var index = -1, length = (path = castPath(path, object)).length;
                            for (length || (length = 1, object = undefined); ++index < length; ) {
                                var value = null == object ? undefined : object[toKey(path[index])];
                                value === undefined && (index = length, value = defaultValue), object = isFunction(value) ? value.call(object) : value;
                            }
                            return object;
                        }, lodash.round = round, lodash.runInContext = runInContext, lodash.sample = function(collection) {
                            return (isArray(collection) ? arraySample : baseSample)(collection);
                        }, lodash.size = function(collection) {
                            if (null == collection) return 0;
                            if (isArrayLike(collection)) return isString(collection) ? stringSize(collection) : collection.length;
                            var tag = getTag(collection);
                            return tag == mapTag || tag == setTag ? collection.size : baseKeys(collection).length;
                        }, lodash.snakeCase = snakeCase, lodash.some = function(collection, predicate, guard) {
                            var func = isArray(collection) ? arraySome : baseSome;
                            return guard && isIterateeCall(collection, predicate, guard) && (predicate = undefined), 
                            func(collection, getIteratee(predicate, 3));
                        }, lodash.sortedIndex = function(array, value) {
                            return baseSortedIndex(array, value);
                        }, lodash.sortedIndexBy = function(array, value, iteratee) {
                            return baseSortedIndexBy(array, value, getIteratee(iteratee, 2));
                        }, lodash.sortedIndexOf = function(array, value) {
                            var length = null == array ? 0 : array.length;
                            if (length) {
                                var index = baseSortedIndex(array, value);
                                if (index < length && eq(array[index], value)) return index;
                            }
                            return -1;
                        }, lodash.sortedLastIndex = function(array, value) {
                            return baseSortedIndex(array, value, !0);
                        }, lodash.sortedLastIndexBy = function(array, value, iteratee) {
                            return baseSortedIndexBy(array, value, getIteratee(iteratee, 2), !0);
                        }, lodash.sortedLastIndexOf = function(array, value) {
                            if (null != array && array.length) {
                                var index = baseSortedIndex(array, value, !0) - 1;
                                if (eq(array[index], value)) return index;
                            }
                            return -1;
                        }, lodash.startCase = startCase, lodash.startsWith = function(string, target, position) {
                            return string = toString(string), position = null == position ? 0 : baseClamp(toInteger(position), 0, string.length), 
                            target = baseToString(target), string.slice(position, position + target.length) == target;
                        }, lodash.subtract = subtract, lodash.sum = function(array) {
                            return array && array.length ? baseSum(array, identity) : 0;
                        }, lodash.sumBy = function(array, iteratee) {
                            return array && array.length ? baseSum(array, getIteratee(iteratee, 2)) : 0;
                        }, lodash.template = function(string, options, guard) {
                            var settings = lodash.templateSettings;
                            guard && isIterateeCall(string, options, guard) && (options = undefined), string = toString(string), 
                            options = assignInWith({}, options, settings, customDefaultsAssignIn);
                            var isEscaping, isEvaluating, imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys), index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '", reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g"), sourceURL = "//# sourceURL=" + ("sourceURL" in options ? options.sourceURL : "lodash.templateSources[" + ++templateCounter + "]") + "\n";
                            string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
                                return interpolateValue || (interpolateValue = esTemplateValue), source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar), 
                                escapeValue && (isEscaping = !0, source += "' +\n__e(" + escapeValue + ") +\n'"), 
                                evaluateValue && (isEvaluating = !0, source += "';\n" + evaluateValue + ";\n__p += '"), 
                                interpolateValue && (source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"), 
                                index = offset + match.length, match;
                            }), source += "';\n";
                            var variable = options.variable;
                            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;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + source + "return __p\n}";
                            var result = attempt(function() {
                                return Function(importsKeys, sourceURL + "return " + source).apply(undefined, importsValues);
                            });
                            if (result.source = source, isError(result)) throw result;
                            return result;
                        }, lodash.times = function(n, iteratee) {
                            if ((n = toInteger(n)) < 1 || MAX_SAFE_INTEGER < n) return [];
                            var index = MAX_ARRAY_LENGTH, length = nativeMin(n, MAX_ARRAY_LENGTH);
                            iteratee = getIteratee(iteratee), n -= MAX_ARRAY_LENGTH;
                            for (var result = baseTimes(length, iteratee); ++index < n; ) iteratee(index);
                            return result;
                        }, lodash.toFinite = toFinite, lodash.toInteger = toInteger, lodash.toLength = toLength, 
                        lodash.toLower = function(value) {
                            return toString(value).toLowerCase();
                        }, lodash.toNumber = toNumber, lodash.toSafeInteger = function(value) {
                            return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : 0 === value ? value : 0;
                        }, lodash.toString = toString, lodash.toUpper = function(value) {
                            return toString(value).toUpperCase();
                        }, lodash.trim = function(string, chars, guard) {
                            if ((string = toString(string)) && (guard || chars === undefined)) return string.replace(reTrim, "");
                            if (!string || !(chars = baseToString(chars))) return string;
                            var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars);
                            return castSlice(strSymbols, charsStartIndex(strSymbols, chrSymbols), charsEndIndex(strSymbols, chrSymbols) + 1).join("");
                        }, lodash.trimEnd = function(string, chars, guard) {
                            if ((string = toString(string)) && (guard || chars === undefined)) return string.replace(reTrimEnd, "");
                            if (!string || !(chars = baseToString(chars))) return string;
                            var strSymbols = stringToArray(string);
                            return castSlice(strSymbols, 0, charsEndIndex(strSymbols, stringToArray(chars)) + 1).join("");
                        }, lodash.trimStart = function(string, chars, guard) {
                            if ((string = toString(string)) && (guard || chars === undefined)) return string.replace(reTrimStart, "");
                            if (!string || !(chars = baseToString(chars))) return string;
                            var strSymbols = stringToArray(string);
                            return castSlice(strSymbols, charsStartIndex(strSymbols, stringToArray(chars))).join("");
                        }, lodash.truncate = function(string, options) {
                            var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
                            if (isObject(options)) {
                                var separator = "separator" in options ? options.separator : separator;
                                length = "length" in options ? toInteger(options.length) : length, omission = "omission" in options ? baseToString(options.omission) : omission;
                            }
                            var strLength = (string = toString(string)).length;
                            if (hasUnicode(string)) {
                                var strSymbols = stringToArray(string);
                                strLength = strSymbols.length;
                            }
                            if (strLength <= length) return string;
                            var end = length - stringSize(omission);
                            if (end < 1) return omission;
                            var result = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
                            if (separator === undefined) return result + omission;
                            if (strSymbols && (end += result.length - end), isRegExp(separator)) {
                                if (string.slice(end).search(separator)) {
                                    var match, substring = result;
                                    for (separator.global || (separator = RegExp(separator.source, toString(reFlags.exec(separator)) + "g")), 
                                    separator.lastIndex = 0; match = separator.exec(substring); ) var newEnd = match.index;
                                    result = result.slice(0, newEnd === undefined ? end : newEnd);
                                }
                            } else if (string.indexOf(baseToString(separator), end) != end) {
                                var index = result.lastIndexOf(separator);
                                -1 < index && (result = result.slice(0, index));
                            }
                            return result + omission;
                        }, lodash.unescape = function(string) {
                            return (string = toString(string)) && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
                        }, lodash.uniqueId = function(prefix) {
                            var id = ++idCounter;
                            return toString(prefix) + id;
                        }, lodash.upperCase = upperCase, lodash.upperFirst = upperFirst, lodash.each = forEach, 
                        lodash.eachRight = forEachRight, lodash.first = head, mixin(lodash, (source = {}, 
                        baseForOwn(lodash, function(func, methodName) {
                            hasOwnProperty.call(lodash.prototype, methodName) || (source[methodName] = func);
                        }), source), {
                            chain: !1
                        }), lodash.VERSION = "4.17.10", arrayEach([ "bind", "bindKey", "curry", "curryRight", "partial", "partialRight" ], function(methodName) {
                            lodash[methodName].placeholder = lodash;
                        }), arrayEach([ "drop", "take" ], function(methodName, index) {
                            LazyWrapper.prototype[methodName] = function(n) {
                                n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
                                var result = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
                                return result.__filtered__ ? result.__takeCount__ = nativeMin(n, result.__takeCount__) : result.__views__.push({
                                    size: nativeMin(n, MAX_ARRAY_LENGTH),
                                    type: methodName + (result.__dir__ < 0 ? "Right" : "")
                                }), result;
                            }, LazyWrapper.prototype[methodName + "Right"] = function(n) {
                                return this.reverse()[methodName](n).reverse();
                            };
                        }), arrayEach([ "filter", "map", "takeWhile" ], function(methodName, index) {
                            var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || 3 == type;
                            LazyWrapper.prototype[methodName] = function(iteratee) {
                                var result = this.clone();
                                return result.__iteratees__.push({
                                    iteratee: getIteratee(iteratee, 3),
                                    type: type
                                }), result.__filtered__ = result.__filtered__ || isFilter, result;
                            };
                        }), arrayEach([ "head", "last" ], function(methodName, index) {
                            var takeName = "take" + (index ? "Right" : "");
                            LazyWrapper.prototype[methodName] = function() {
                                return this[takeName](1).value()[0];
                            };
                        }), arrayEach([ "initial", "tail" ], function(methodName, index) {
                            var dropName = "drop" + (index ? "" : "Right");
                            LazyWrapper.prototype[methodName] = function() {
                                return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
                            };
                        }), LazyWrapper.prototype.compact = function() {
                            return this.filter(identity);
                        }, LazyWrapper.prototype.find = function(predicate) {
                            return this.filter(predicate).head();
                        }, LazyWrapper.prototype.findLast = function(predicate) {
                            return this.reverse().find(predicate);
                        }, LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
                            return "function" == typeof path ? new LazyWrapper(this) : this.map(function(value) {
                                return baseInvoke(value, path, args);
                            });
                        }), LazyWrapper.prototype.reject = function(predicate) {
                            return this.filter(negate(getIteratee(predicate)));
                        }, LazyWrapper.prototype.slice = function(start, end) {
                            start = toInteger(start);
                            var result = this;
                            return result.__filtered__ && (0 < start || end < 0) ? new LazyWrapper(result) : (start < 0 ? result = result.takeRight(-start) : start && (result = result.drop(start)), 
                            end !== undefined && (result = (end = toInteger(end)) < 0 ? result.dropRight(-end) : result.take(end - start)), 
                            result);
                        }, LazyWrapper.prototype.takeRightWhile = function(predicate) {
                            return this.reverse().takeWhile(predicate).reverse();
                        }, LazyWrapper.prototype.toArray = function() {
                            return this.take(MAX_ARRAY_LENGTH);
                        }, baseForOwn(LazyWrapper.prototype, function(func, methodName) {
                            var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName), isTaker = /^(?:head|last)$/.test(methodName), lodashFunc = lodash[isTaker ? "take" + ("last" == methodName ? "Right" : "") : methodName], retUnwrapped = isTaker || /^find/.test(methodName);
                            lodashFunc && (lodash.prototype[methodName] = function() {
                                var value = this.__wrapped__, args = isTaker ? [ 1 ] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray(value), interceptor = function(value) {
                                    var result = lodashFunc.apply(lodash, arrayPush([ value ], args));
                                    return isTaker && chainAll ? result[0] : result;
                                };
                                useLazy && checkIteratee && "function" == typeof iteratee && 1 != iteratee.length && (isLazy = useLazy = !1);
                                var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
                                if (!retUnwrapped && useLazy) {
                                    value = onlyLazy ? value : new LazyWrapper(this);
                                    var result = func.apply(value, args);
                                    return result.__actions__.push({
                                        func: thru,
                                        args: [ interceptor ],
                                        thisArg: undefined
                                    }), new LodashWrapper(result, chainAll);
                                }
                                return isUnwrapped && onlyLazy ? func.apply(this, args) : (result = this.thru(interceptor), 
                                isUnwrapped ? isTaker ? result.value()[0] : result.value() : result);
                            });
                        }), arrayEach([ "pop", "push", "shift", "sort", "splice", "unshift" ], function(methodName) {
                            var func = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
                            lodash.prototype[methodName] = function() {
                                var args = arguments;
                                if (retUnwrapped && !this.__chain__) {
                                    var value = this.value();
                                    return func.apply(isArray(value) ? value : [], args);
                                }
                                return this[chainName](function(value) {
                                    return func.apply(isArray(value) ? value : [], args);
                                });
                            };
                        }), baseForOwn(LazyWrapper.prototype, function(func, methodName) {
                            var lodashFunc = lodash[methodName];
                            if (lodashFunc) {
                                var key = lodashFunc.name + "";
                                (realNames[key] || (realNames[key] = [])).push({
                                    name: methodName,
                                    func: lodashFunc
                                });
                            }
                        }), realNames[createHybrid(undefined, WRAP_BIND_KEY_FLAG).name] = [ {
                            name: "wrapper",
                            func: undefined
                        } ], LazyWrapper.prototype.clone = function() {
                            var result = new LazyWrapper(this.__wrapped__);
                            return result.__actions__ = copyArray(this.__actions__), result.__dir__ = this.__dir__, 
                            result.__filtered__ = this.__filtered__, result.__iteratees__ = copyArray(this.__iteratees__), 
                            result.__takeCount__ = this.__takeCount__, result.__views__ = copyArray(this.__views__), 
                            result;
                        }, LazyWrapper.prototype.reverse = function() {
                            if (this.__filtered__) {
                                var result = new LazyWrapper(this);
                                result.__dir__ = -1, result.__filtered__ = !0;
                            } else (result = this.clone()).__dir__ *= -1;
                            return result;
                        }, LazyWrapper.prototype.value = function() {
                            var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray(array), isRight = dir < 0, arrLength = isArr ? array.length : 0, view = function(start, end, transforms) {
                                for (var index = -1, length = transforms.length; ++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);
                                    }
                                }
                                return {
                                    start: start,
                                    end: end
                                };
                            }(0, arrLength, this.__views__), start = view.start, end = view.end, length = end - start, index = isRight ? end : start - 1, iteratees = this.__iteratees__, iterLength = iteratees.length, resIndex = 0, takeCount = nativeMin(length, this.__takeCount__);
                            if (!isArr || !isRight && arrLength == length && takeCount == length) return baseWrapperValue(array, this.__actions__);
                            var result = [];
                            outer: for (;length-- && resIndex < takeCount; ) {
                                for (var iterIndex = -1, value = array[index += dir]; ++iterIndex < iterLength; ) {
                                    var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value);
                                    if (type == LAZY_MAP_FLAG) value = computed; else if (!computed) {
                                        if (type == LAZY_FILTER_FLAG) continue outer;
                                        break outer;
                                    }
                                }
                                result[resIndex++] = value;
                            }
                            return result;
                        }, lodash.prototype.at = wrapperAt, lodash.prototype.chain = function() {
                            return chain(this);
                        }, lodash.prototype.commit = function() {
                            return new LodashWrapper(this.value(), this.__chain__);
                        }, lodash.prototype.next = function() {
                            this.__values__ === undefined && (this.__values__ = toArray(this.value()));
                            var done = this.__index__ >= this.__values__.length;
                            return {
                                done: done,
                                value: done ? undefined : this.__values__[this.__index__++]
                            };
                        }, lodash.prototype.plant = function(value) {
                            for (var result, parent = this; parent instanceof baseLodash; ) {
                                var clone = wrapperClone(parent);
                                clone.__index__ = 0, clone.__values__ = undefined, result ? previous.__wrapped__ = clone : result = clone;
                                var previous = clone;
                                parent = parent.__wrapped__;
                            }
                            return previous.__wrapped__ = value, result;
                        }, lodash.prototype.reverse = function() {
                            var value = this.__wrapped__;
                            if (value instanceof LazyWrapper) {
                                var wrapped = value;
                                return this.__actions__.length && (wrapped = new LazyWrapper(this)), (wrapped = wrapped.reverse()).__actions__.push({
                                    func: thru,
                                    args: [ reverse ],
                                    thisArg: undefined
                                }), new LodashWrapper(wrapped, this.__chain__);
                            }
                            return this.thru(reverse);
                        }, lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = function() {
                            return baseWrapperValue(this.__wrapped__, this.__actions__);
                        }, lodash.prototype.first = lodash.prototype.head, symIterator && (lodash.prototype[symIterator] = function() {
                            return this;
                        }), lodash;
                    }();
                    "function" == typeof define && "object" == typeof define.amd && define.amd ? (root._ = _, 
                    define(function() {
                        return _;
                    })) : freeModule ? ((freeModule.exports = _)._ = _, freeExports._ = _) : root._ = _;
                }).call(this);
            }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
        }, {} ],
        192: [ function(require, module, exports) {
            (function(Buffer) {
                "use strict";
                var inherits = require("inherits"), HashBase = require("hash-base"), ARRAY16 = new Array(16);
                function MD5() {
                    HashBase.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, 
                    this._d = 271733878;
                }
                function rotl(x, n) {
                    return x << n | x >>> 32 - n;
                }
                function fnF(a, b, c, d, m, k, s) {
                    return rotl(a + (b & c | ~b & d) + m + k | 0, s) + b | 0;
                }
                function fnG(a, b, c, d, m, k, s) {
                    return rotl(a + (b & d | c & ~d) + m + k | 0, s) + b | 0;
                }
                function fnH(a, b, c, d, m, k, s) {
                    return rotl(a + (b ^ c ^ d) + m + k | 0, s) + b | 0;
                }
                function fnI(a, b, c, d, m, k, s) {
                    return rotl(a + (c ^ (b | ~d)) + m + k | 0, s) + b | 0;
                }
                inherits(MD5, HashBase), MD5.prototype._update = function() {
                    for (var M = ARRAY16, i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(4 * i);
                    var a = this._a, b = this._b, c = this._c, d = this._d;
                    b = fnI(b = fnI(b = fnI(b = fnI(b = fnH(b = fnH(b = fnH(b = fnH(b = fnG(b = fnG(b = fnG(b = fnG(b = fnF(b = fnF(b = fnF(b = fnF(b, c = fnF(c, d = fnF(d, a = fnF(a, b, c, d, M[0], 3614090360, 7), b, c, M[1], 3905402710, 12), a, b, M[2], 606105819, 17), d, a, M[3], 3250441966, 22), c = fnF(c, d = fnF(d, a = fnF(a, b, c, d, M[4], 4118548399, 7), b, c, M[5], 1200080426, 12), a, b, M[6], 2821735955, 17), d, a, M[7], 4249261313, 22), c = fnF(c, d = fnF(d, a = fnF(a, b, c, d, M[8], 1770035416, 7), b, c, M[9], 2336552879, 12), a, b, M[10], 4294925233, 17), d, a, M[11], 2304563134, 22), c = fnF(c, d = fnF(d, a = fnF(a, b, c, d, M[12], 1804603682, 7), b, c, M[13], 4254626195, 12), a, b, M[14], 2792965006, 17), d, a, M[15], 1236535329, 22), c = fnG(c, d = fnG(d, a = fnG(a, b, c, d, M[1], 4129170786, 5), b, c, M[6], 3225465664, 9), a, b, M[11], 643717713, 14), d, a, M[0], 3921069994, 20), c = fnG(c, d = fnG(d, a = fnG(a, b, c, d, M[5], 3593408605, 5), b, c, M[10], 38016083, 9), a, b, M[15], 3634488961, 14), d, a, M[4], 3889429448, 20), c = fnG(c, d = fnG(d, a = fnG(a, b, c, d, M[9], 568446438, 5), b, c, M[14], 3275163606, 9), a, b, M[3], 4107603335, 14), d, a, M[8], 1163531501, 20), c = fnG(c, d = fnG(d, a = fnG(a, b, c, d, M[13], 2850285829, 5), b, c, M[2], 4243563512, 9), a, b, M[7], 1735328473, 14), d, a, M[12], 2368359562, 20), c = fnH(c, d = fnH(d, a = fnH(a, b, c, d, M[5], 4294588738, 4), b, c, M[8], 2272392833, 11), a, b, M[11], 1839030562, 16), d, a, M[14], 4259657740, 23), c = fnH(c, d = fnH(d, a = fnH(a, b, c, d, M[1], 2763975236, 4), b, c, M[4], 1272893353, 11), a, b, M[7], 4139469664, 16), d, a, M[10], 3200236656, 23), c = fnH(c, d = fnH(d, a = fnH(a, b, c, d, M[13], 681279174, 4), b, c, M[0], 3936430074, 11), a, b, M[3], 3572445317, 16), d, a, M[6], 76029189, 23), c = fnH(c, d = fnH(d, a = fnH(a, b, c, d, M[9], 3654602809, 4), b, c, M[12], 3873151461, 11), a, b, M[15], 530742520, 16), d, a, M[2], 3299628645, 23), c = fnI(c, d = fnI(d, a = fnI(a, b, c, d, M[0], 4096336452, 6), b, c, M[7], 1126891415, 10), a, b, M[14], 2878612391, 15), d, a, M[5], 4237533241, 21), c = fnI(c, d = fnI(d, a = fnI(a, b, c, d, M[12], 1700485571, 6), b, c, M[3], 2399980690, 10), a, b, M[10], 4293915773, 15), d, a, M[1], 2240044497, 21), c = fnI(c, d = fnI(d, a = fnI(a, b, c, d, M[8], 1873313359, 6), b, c, M[15], 4264355552, 10), a, b, M[6], 2734768916, 15), d, a, M[13], 1309151649, 21), c = fnI(c, d = fnI(d, a = fnI(a, b, c, d, M[4], 4149444226, 6), b, c, M[11], 3174756917, 10), a, b, M[2], 718787259, 15), d, a, M[9], 3951481745, 21), 
                    this._a = this._a + a | 0, this._b = this._b + b | 0, this._c = this._c + c | 0, 
                    this._d = this._d + d | 0;
                }, MD5.prototype._digest = function() {
                    this._block[this._blockOffset++] = 128, 56 < this._blockOffset && (this._block.fill(0, this._blockOffset, 64), 
                    this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), 
                    this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), 
                    this._update();
                    var buffer = new Buffer(16);
                    return buffer.writeInt32LE(this._a, 0), buffer.writeInt32LE(this._b, 4), buffer.writeInt32LE(this._c, 8), 
                    buffer.writeInt32LE(this._d, 12), buffer;
                }, module.exports = MD5;
            }).call(this, require("buffer").Buffer);
        }, {
            buffer: 77,
            "hash-base": 193,
            inherits: 152
        } ],
        193: [ function(require, module, exports) {
            "use strict";
            var Buffer = require("safe-buffer").Buffer, Transform = require("stream").Transform;
            function HashBase(blockSize) {
                Transform.call(this), this._block = Buffer.allocUnsafe(blockSize), this._blockSize = blockSize, 
                this._blockOffset = 0, this._length = [ 0, 0, 0, 0 ], this._finalized = !1;
            }
            require("inherits")(HashBase, Transform), HashBase.prototype._transform = function(chunk, encoding, callback) {
                var error = null;
                try {
                    this.update(chunk, encoding);
                } catch (err) {
                    error = err;
                }
                callback(error);
            }, HashBase.prototype._flush = function(callback) {
                var error = null;
                try {
                    this.push(this.digest());
                } catch (err) {
                    error = err;
                }
                callback(error);
            }, HashBase.prototype.update = function(data, encoding) {
                if (function(val, prefix) {
                    if (!Buffer.isBuffer(val) && "string" != typeof val) throw new TypeError(prefix + " must be a string or a buffer");
                }(data, "Data"), this._finalized) throw new Error("Digest already called");
                Buffer.isBuffer(data) || (data = Buffer.from(data, encoding));
                for (var block = this._block, offset = 0; this._blockOffset + data.length - offset >= this._blockSize; ) {
                    for (var i = this._blockOffset; i < this._blockSize; ) block[i++] = data[offset++];
                    this._update(), this._blockOffset = 0;
                }
                for (;offset < data.length; ) block[this._blockOffset++] = data[offset++];
                for (var j = 0, carry = 8 * data.length; 0 < carry; ++j) this._length[j] += carry, 
                0 < (carry = this._length[j] / 4294967296 | 0) && (this._length[j] -= 4294967296 * carry);
                return this;
            }, HashBase.prototype._update = function() {
                throw new Error("_update is not implemented");
            }, HashBase.prototype.digest = function(encoding) {
                if (this._finalized) throw new Error("Digest already called");
                this._finalized = !0;
                var digest = this._digest();
                void 0 !== encoding && (digest = digest.toString(encoding)), this._block.fill(0);
                for (var i = this._blockOffset = 0; i < 4; ++i) this._length[i] = 0;
                return digest;
            }, HashBase.prototype._digest = function() {
                throw new Error("_digest is not implemented");
            }, module.exports = HashBase;
        }, {
            inherits: 152,
            "safe-buffer": 244,
            stream: 254
        } ],
        194: [ function(require, module, exports) {
            var bn = require("bn.js"), brorand = require("brorand");
            function MillerRabin(rand) {
                this.rand = rand || new brorand.Rand();
            }
            (module.exports = MillerRabin).create = function(rand) {
                return new MillerRabin(rand);
            }, MillerRabin.prototype._randbelow = function(n) {
                var len = n.bitLength(), min_bytes = Math.ceil(len / 8);
                do {
                    var a = new bn(this.rand.generate(min_bytes));
                } while (0 <= a.cmp(n));
                return a;
            }, MillerRabin.prototype._randrange = function(start, stop) {
                var size = stop.sub(start);
                return start.add(this._randbelow(size));
            }, MillerRabin.prototype.test = function(n, k, cb) {
                var len = n.bitLength(), red = bn.mont(n), rone = new bn(1).toRed(red);
                k || (k = Math.max(1, len / 48 | 0));
                for (var n1 = n.subn(1), s = 0; !n1.testn(s); s++) ;
                for (var d = n.shrn(s), rn1 = n1.toRed(red); 0 < k; k--) {
                    var a = this._randrange(new bn(2), n1);
                    cb && cb(a);
                    var x = a.toRed(red).redPow(d);
                    if (0 !== x.cmp(rone) && 0 !== x.cmp(rn1)) {
                        for (var i = 1; i < s; i++) {
                            if (0 === (x = x.redSqr()).cmp(rone)) return !1;
                            if (0 === x.cmp(rn1)) break;
                        }
                        if (i === s) return !1;
                    }
                }
                return !0;
            }, MillerRabin.prototype.getDivisor = function(n, k) {
                var len = n.bitLength(), red = bn.mont(n), rone = new bn(1).toRed(red);
                k || (k = Math.max(1, len / 48 | 0));
                for (var n1 = n.subn(1), s = 0; !n1.testn(s); s++) ;
                for (var d = n.shrn(s), rn1 = n1.toRed(red); 0 < k; k--) {
                    var a = this._randrange(new bn(2), n1), g = n.gcd(a);
                    if (0 !== g.cmpn(1)) return g;
                    var x = a.toRed(red).redPow(d);
                    if (0 !== x.cmp(rone) && 0 !== x.cmp(rn1)) {
                        for (var i = 1; i < s; i++) {
                            if (0 === (x = x.redSqr()).cmp(rone)) return x.fromRed().subn(1).gcd(n);
                            if (0 === x.cmp(rn1)) break;
                        }
                        if (i === s) return (x = x.redSqr()).fromRed().subn(1).gcd(n);
                    }
                }
                return !1;
            };
        }, {
            "bn.js": 42,
            brorand: 43
        } ],
        195: [ function(require, module, exports) {
            function assert(val, msg) {
                if (!val) throw new Error(msg || "Assertion failed");
            }
            (module.exports = assert).equal = function(l, r, msg) {
                if (l != r) throw new Error(msg || "Assertion failed: " + l + " != " + r);
            };
        }, {} ],
        196: [ function(require, module, exports) {
            "use strict";
            var utils = exports;
            function zero2(word) {
                return 1 === word.length ? "0" + word : word;
            }
            function toHex(msg) {
                for (var res = "", i = 0; i < msg.length; i++) res += zero2(msg[i].toString(16));
                return res;
            }
            utils.toArray = function(msg, enc) {
                if (Array.isArray(msg)) return msg.slice();
                if (!msg) return [];
                var res = [];
                if ("string" != typeof msg) {
                    for (var i = 0; i < msg.length; i++) res[i] = 0 | msg[i];
                    return res;
                }
                if ("hex" === enc) for ((msg = msg.replace(/[^a-z0-9]+/gi, "")).length % 2 != 0 && (msg = "0" + msg), 
                i = 0; i < msg.length; i += 2) res.push(parseInt(msg[i] + msg[i + 1], 16)); else for (i = 0; i < msg.length; i++) {
                    var c = msg.charCodeAt(i), hi = c >> 8, lo = 255 & c;
                    hi ? res.push(hi, lo) : res.push(lo);
                }
                return res;
            }, utils.zero2 = zero2, utils.toHex = toHex, utils.encode = function(arr, enc) {
                return "hex" === enc ? toHex(arr) : arr;
            };
        }, {} ],
        197: [ function(require, module, exports) {
            "use strict";
            var pako = {};
            (0, require("./lib/utils/common").assign)(pako, require("./lib/deflate"), require("./lib/inflate"), require("./lib/zlib/constants")), 
            module.exports = pako;
        }, {
            "./lib/deflate": 198,
            "./lib/inflate": 199,
            "./lib/utils/common": 200,
            "./lib/zlib/constants": 203
        } ],
        198: [ function(require, module, exports) {
            "use strict";
            var zlib_deflate = require("./zlib/deflate"), utils = require("./utils/common"), strings = require("./utils/strings"), msg = require("./zlib/messages"), ZStream = require("./zlib/zstream"), toString = Object.prototype.toString, Z_OK = 0, Z_DEFAULT_COMPRESSION = -1, Z_DEFAULT_STRATEGY = 0, Z_DEFLATED = 8;
            function Deflate(options) {
                if (!(this instanceof Deflate)) return new Deflate(options);
                this.options = utils.assign({
                    level: Z_DEFAULT_COMPRESSION,
                    method: Z_DEFLATED,
                    chunkSize: 16384,
                    windowBits: 15,
                    memLevel: 8,
                    strategy: Z_DEFAULT_STRATEGY,
                    to: ""
                }, options || {});
                var opt = this.options;
                opt.raw && 0 < opt.windowBits ? opt.windowBits = -opt.windowBits : opt.gzip && 0 < opt.windowBits && opt.windowBits < 16 && (opt.windowBits += 16), 
                this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new ZStream(), 
                this.strm.avail_out = 0;
                var status = zlib_deflate.deflateInit2(this.strm, opt.level, opt.method, opt.windowBits, opt.memLevel, opt.strategy);
                if (status !== Z_OK) throw new Error(msg[status]);
                if (opt.header && zlib_deflate.deflateSetHeader(this.strm, opt.header), opt.dictionary) {
                    var dict;
                    if (dict = "string" == typeof opt.dictionary ? strings.string2buf(opt.dictionary) : "[object ArrayBuffer]" === toString.call(opt.dictionary) ? new Uint8Array(opt.dictionary) : opt.dictionary, 
                    (status = zlib_deflate.deflateSetDictionary(this.strm, dict)) !== Z_OK) throw new Error(msg[status]);
                    this._dict_set = !0;
                }
            }
            function deflate(input, options) {
                var deflator = new Deflate(options);
                if (deflator.push(input, !0), deflator.err) throw deflator.msg || msg[deflator.err];
                return deflator.result;
            }
            Deflate.prototype.push = function(data, mode) {
                var status, _mode, strm = this.strm, chunkSize = this.options.chunkSize;
                if (this.ended) return !1;
                _mode = mode === ~~mode ? mode : !0 === mode ? 4 : 0, "string" == typeof data ? strm.input = strings.string2buf(data) : "[object ArrayBuffer]" === toString.call(data) ? strm.input = new Uint8Array(data) : strm.input = data, 
                strm.next_in = 0, strm.avail_in = strm.input.length;
                do {
                    if (0 === strm.avail_out && (strm.output = new utils.Buf8(chunkSize), strm.next_out = 0, 
                    strm.avail_out = chunkSize), 1 !== (status = zlib_deflate.deflate(strm, _mode)) && status !== Z_OK) return this.onEnd(status), 
                    !(this.ended = !0);
                    0 !== strm.avail_out && (0 !== strm.avail_in || 4 !== _mode && 2 !== _mode) || ("string" === this.options.to ? this.onData(strings.buf2binstring(utils.shrinkBuf(strm.output, strm.next_out))) : this.onData(utils.shrinkBuf(strm.output, strm.next_out)));
                } while ((0 < strm.avail_in || 0 === strm.avail_out) && 1 !== status);
                return 4 === _mode ? (status = zlib_deflate.deflateEnd(this.strm), this.onEnd(status), 
                this.ended = !0, status === Z_OK) : 2 !== _mode || (this.onEnd(Z_OK), !(strm.avail_out = 0));
            }, Deflate.prototype.onData = function(chunk) {
                this.chunks.push(chunk);
            }, Deflate.prototype.onEnd = function(status) {
                status === Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = utils.flattenChunks(this.chunks)), 
                this.chunks = [], this.err = status, this.msg = this.strm.msg;
            }, exports.Deflate = Deflate, exports.deflate = deflate, exports.deflateRaw = function(input, options) {
                return (options = options || {}).raw = !0, deflate(input, options);
            }, exports.gzip = function(input, options) {
                return (options = options || {}).gzip = !0, deflate(input, options);
            };
        }, {
            "./utils/common": 200,
            "./utils/strings": 201,
            "./zlib/deflate": 205,
            "./zlib/messages": 210,
            "./zlib/zstream": 212
        } ],
        199: [ function(require, module, exports) {
            "use strict";
            var zlib_inflate = require("./zlib/inflate"), utils = require("./utils/common"), strings = require("./utils/strings"), c = require("./zlib/constants"), msg = require("./zlib/messages"), ZStream = require("./zlib/zstream"), GZheader = require("./zlib/gzheader"), toString = Object.prototype.toString;
            function Inflate(options) {
                if (!(this instanceof Inflate)) return new Inflate(options);
                this.options = utils.assign({
                    chunkSize: 16384,
                    windowBits: 0,
                    to: ""
                }, options || {});
                var opt = this.options;
                opt.raw && 0 <= opt.windowBits && opt.windowBits < 16 && (opt.windowBits = -opt.windowBits, 
                0 === opt.windowBits && (opt.windowBits = -15)), !(0 <= opt.windowBits && opt.windowBits < 16) || options && options.windowBits || (opt.windowBits += 32), 
                15 < opt.windowBits && opt.windowBits < 48 && 0 == (15 & opt.windowBits) && (opt.windowBits |= 15), 
                this.err = 0, this.msg = "", this.ended = !1, this.chunks = [], this.strm = new ZStream(), 
                this.strm.avail_out = 0;
                var status = zlib_inflate.inflateInit2(this.strm, opt.windowBits);
                if (status !== c.Z_OK) throw new Error(msg[status]);
                this.header = new GZheader(), zlib_inflate.inflateGetHeader(this.strm, this.header);
            }
            function inflate(input, options) {
                var inflator = new Inflate(options);
                if (inflator.push(input, !0), inflator.err) throw inflator.msg || msg[inflator.err];
                return inflator.result;
            }
            Inflate.prototype.push = function(data, mode) {
                var status, _mode, next_out_utf8, tail, utf8str, dict, strm = this.strm, chunkSize = this.options.chunkSize, dictionary = this.options.dictionary, allowBufError = !1;
                if (this.ended) return !1;
                _mode = mode === ~~mode ? mode : !0 === mode ? c.Z_FINISH : c.Z_NO_FLUSH, "string" == typeof data ? strm.input = strings.binstring2buf(data) : "[object ArrayBuffer]" === toString.call(data) ? strm.input = new Uint8Array(data) : strm.input = data, 
                strm.next_in = 0, strm.avail_in = strm.input.length;
                do {
                    if (0 === strm.avail_out && (strm.output = new utils.Buf8(chunkSize), strm.next_out = 0, 
                    strm.avail_out = chunkSize), (status = zlib_inflate.inflate(strm, c.Z_NO_FLUSH)) === c.Z_NEED_DICT && dictionary && (dict = "string" == typeof dictionary ? strings.string2buf(dictionary) : "[object ArrayBuffer]" === toString.call(dictionary) ? new Uint8Array(dictionary) : dictionary, 
                    status = zlib_inflate.inflateSetDictionary(this.strm, dict)), status === c.Z_BUF_ERROR && !0 === allowBufError && (status = c.Z_OK, 
                    allowBufError = !1), status !== c.Z_STREAM_END && status !== c.Z_OK) return this.onEnd(status), 
                    !(this.ended = !0);
                    strm.next_out && (0 !== strm.avail_out && status !== c.Z_STREAM_END && (0 !== strm.avail_in || _mode !== c.Z_FINISH && _mode !== c.Z_SYNC_FLUSH) || ("string" === this.options.to ? (next_out_utf8 = strings.utf8border(strm.output, strm.next_out), 
                    tail = strm.next_out - next_out_utf8, utf8str = strings.buf2string(strm.output, next_out_utf8), 
                    strm.next_out = tail, strm.avail_out = chunkSize - tail, tail && utils.arraySet(strm.output, strm.output, next_out_utf8, tail, 0), 
                    this.onData(utf8str)) : this.onData(utils.shrinkBuf(strm.output, strm.next_out)))), 
                    0 === strm.avail_in && 0 === strm.avail_out && (allowBufError = !0);
                } while ((0 < strm.avail_in || 0 === strm.avail_out) && status !== c.Z_STREAM_END);
                return status === c.Z_STREAM_END && (_mode = c.Z_FINISH), _mode === c.Z_FINISH ? (status = zlib_inflate.inflateEnd(this.strm), 
                this.onEnd(status), this.ended = !0, status === c.Z_OK) : _mode !== c.Z_SYNC_FLUSH || (this.onEnd(c.Z_OK), 
                !(strm.avail_out = 0));
            }, Inflate.prototype.onData = function(chunk) {
                this.chunks.push(chunk);
            }, Inflate.prototype.onEnd = function(status) {
                status === c.Z_OK && ("string" === this.options.to ? this.result = this.chunks.join("") : this.result = utils.flattenChunks(this.chunks)), 
                this.chunks = [], this.err = status, this.msg = this.strm.msg;
            }, exports.Inflate = Inflate, exports.inflate = inflate, exports.inflateRaw = function(input, options) {
                return (options = options || {}).raw = !0, inflate(input, options);
            }, exports.ungzip = inflate;
        }, {
            "./utils/common": 200,
            "./utils/strings": 201,
            "./zlib/constants": 203,
            "./zlib/gzheader": 206,
            "./zlib/inflate": 208,
            "./zlib/messages": 210,
            "./zlib/zstream": 212
        } ],
        200: [ function(require, module, exports) {
            "use strict";
            var TYPED_OK = "undefined" != typeof Uint8Array && "undefined" != typeof Uint16Array && "undefined" != typeof Int32Array;
            function _has(obj, key) {
                return Object.prototype.hasOwnProperty.call(obj, key);
            }
            exports.assign = function(obj) {
                for (var sources = Array.prototype.slice.call(arguments, 1); sources.length; ) {
                    var source = sources.shift();
                    if (source) {
                        if ("object" != typeof source) throw new TypeError(source + "must be non-object");
                        for (var p in source) _has(source, p) && (obj[p] = source[p]);
                    }
                }
                return obj;
            }, exports.shrinkBuf = function(buf, size) {
                return buf.length === size ? buf : buf.subarray ? buf.subarray(0, size) : (buf.length = size, 
                buf);
            };
            var fnTyped = {
                arraySet: function(dest, src, src_offs, len, dest_offs) {
                    if (src.subarray && dest.subarray) dest.set(src.subarray(src_offs, src_offs + len), dest_offs); else for (var i = 0; i < len; i++) dest[dest_offs + i] = src[src_offs + i];
                },
                flattenChunks: function(chunks) {
                    var i, l, len, pos, chunk, result;
                    for (i = len = 0, l = chunks.length; i < l; i++) len += chunks[i].length;
                    for (result = new Uint8Array(len), i = pos = 0, l = chunks.length; i < l; i++) chunk = chunks[i], 
                    result.set(chunk, pos), pos += chunk.length;
                    return result;
                }
            }, fnUntyped = {
                arraySet: function(dest, src, src_offs, len, dest_offs) {
                    for (var i = 0; i < len; i++) dest[dest_offs + i] = src[src_offs + i];
                },
                flattenChunks: function(chunks) {
                    return [].concat.apply([], chunks);
                }
            };
            exports.setTyped = function(on) {
                on ? (exports.Buf8 = Uint8Array, exports.Buf16 = Uint16Array, exports.Buf32 = Int32Array, 
                exports.assign(exports, fnTyped)) : (exports.Buf8 = Array, exports.Buf16 = Array, 
                exports.Buf32 = Array, exports.assign(exports, fnUntyped));
            }, exports.setTyped(TYPED_OK);
        }, {} ],
        201: [ function(require, module, exports) {
            "use strict";
            var utils = require("./common"), STR_APPLY_OK = !0, STR_APPLY_UIA_OK = !0;
            try {
                String.fromCharCode.apply(null, [ 0 ]);
            } catch (__) {
                STR_APPLY_OK = !1;
            }
            try {
                String.fromCharCode.apply(null, new Uint8Array(1));
            } catch (__) {
                STR_APPLY_UIA_OK = !1;
            }
            for (var _utf8len = new utils.Buf8(256), q = 0; q < 256; q++) _utf8len[q] = 252 <= q ? 6 : 248 <= q ? 5 : 240 <= q ? 4 : 224 <= q ? 3 : 192 <= q ? 2 : 1;
            function buf2binstring(buf, len) {
                if (len < 65537 && (buf.subarray && STR_APPLY_UIA_OK || !buf.subarray && STR_APPLY_OK)) return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len));
                for (var result = "", i = 0; i < len; i++) result += String.fromCharCode(buf[i]);
                return result;
            }
            _utf8len[254] = _utf8len[254] = 1, exports.string2buf = function(str) {
                var buf, c, c2, m_pos, i, str_len = str.length, buf_len = 0;
                for (m_pos = 0; m_pos < str_len; m_pos++) 55296 == (64512 & (c = str.charCodeAt(m_pos))) && m_pos + 1 < str_len && 56320 == (64512 & (c2 = str.charCodeAt(m_pos + 1))) && (c = 65536 + (c - 55296 << 10) + (c2 - 56320), 
                m_pos++), buf_len += c < 128 ? 1 : c < 2048 ? 2 : c < 65536 ? 3 : 4;
                for (buf = new utils.Buf8(buf_len), m_pos = i = 0; i < buf_len; m_pos++) 55296 == (64512 & (c = str.charCodeAt(m_pos))) && m_pos + 1 < str_len && 56320 == (64512 & (c2 = str.charCodeAt(m_pos + 1))) && (c = 65536 + (c - 55296 << 10) + (c2 - 56320), 
                m_pos++), c < 128 ? buf[i++] = c : (c < 2048 ? buf[i++] = 192 | c >>> 6 : (c < 65536 ? buf[i++] = 224 | c >>> 12 : (buf[i++] = 240 | c >>> 18, 
                buf[i++] = 128 | c >>> 12 & 63), buf[i++] = 128 | c >>> 6 & 63), buf[i++] = 128 | 63 & c);
                return buf;
            }, exports.buf2binstring = function(buf) {
                return buf2binstring(buf, buf.length);
            }, exports.binstring2buf = function(str) {
                for (var buf = new utils.Buf8(str.length), i = 0, len = buf.length; i < len; i++) buf[i] = str.charCodeAt(i);
                return buf;
            }, exports.buf2string = function(buf, max) {
                var i, out, c, c_len, len = max || buf.length, utf16buf = new Array(2 * len);
                for (i = out = 0; i < len; ) if ((c = buf[i++]) < 128) utf16buf[out++] = c; else if (4 < (c_len = _utf8len[c])) utf16buf[out++] = 65533, 
                i += c_len - 1; else {
                    for (c &= 2 === c_len ? 31 : 3 === c_len ? 15 : 7; 1 < c_len && i < len; ) c = c << 6 | 63 & buf[i++], 
                    c_len--;
                    1 < c_len ? utf16buf[out++] = 65533 : c < 65536 ? utf16buf[out++] = c : (c -= 65536, 
                    utf16buf[out++] = 55296 | c >> 10 & 1023, utf16buf[out++] = 56320 | 1023 & c);
                }
                return buf2binstring(utf16buf, out);
            }, exports.utf8border = function(buf, max) {
                var pos;
                for ((max = max || buf.length) > buf.length && (max = buf.length), pos = max - 1; 0 <= pos && 128 == (192 & buf[pos]); ) pos--;
                return pos < 0 ? max : 0 === pos ? max : pos + _utf8len[buf[pos]] > max ? pos : max;
            };
        }, {
            "./common": 200
        } ],
        202: [ function(require, module, exports) {
            "use strict";
            module.exports = function(adler, buf, len, pos) {
                for (var s1 = 65535 & adler | 0, s2 = adler >>> 16 & 65535 | 0, n = 0; 0 !== len; ) {
                    for (len -= n = 2e3 < len ? 2e3 : len; s2 = s2 + (s1 = s1 + buf[pos++] | 0) | 0, 
                    --n; ) ;
                    s1 %= 65521, s2 %= 65521;
                }
                return s1 | s2 << 16 | 0;
            };
        }, {} ],
        203: [ function(require, module, exports) {
            "use strict";
            module.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
            };
        }, {} ],
        204: [ function(require, module, exports) {
            "use strict";
            var crcTable = function() {
                for (var c, table = [], n = 0; n < 256; n++) {
                    c = n;
                    for (var k = 0; k < 8; k++) c = 1 & c ? 3988292384 ^ c >>> 1 : c >>> 1;
                    table[n] = c;
                }
                return table;
            }();
            module.exports = function(crc, buf, len, pos) {
                var t = crcTable, end = pos + len;
                crc ^= -1;
                for (var i = pos; i < end; i++) crc = crc >>> 8 ^ t[255 & (crc ^ buf[i])];
                return -1 ^ crc;
            };
        }, {} ],
        205: [ function(require, module, exports) {
            "use strict";
            var configuration_table, utils = require("../utils/common"), trees = require("./trees"), adler32 = require("./adler32"), crc32 = require("./crc32"), msg = require("./messages"), Z_NO_FLUSH = 0, Z_PARTIAL_FLUSH = 1, Z_FULL_FLUSH = 3, Z_FINISH = 4, Z_BLOCK = 5, Z_OK = 0, Z_STREAM_END = 1, Z_STREAM_ERROR = -2, Z_DATA_ERROR = -3, Z_BUF_ERROR = -5, Z_DEFAULT_COMPRESSION = -1, Z_FILTERED = 1, Z_HUFFMAN_ONLY = 2, Z_RLE = 3, Z_FIXED = 4, Z_DEFAULT_STRATEGY = 0, Z_UNKNOWN = 2, Z_DEFLATED = 8, MAX_MEM_LEVEL = 9, MAX_WBITS = 15, DEF_MEM_LEVEL = 8, L_CODES = 286, D_CODES = 30, BL_CODES = 19, HEAP_SIZE = 2 * L_CODES + 1, MAX_BITS = 15, MIN_MATCH = 3, MAX_MATCH = 258, MIN_LOOKAHEAD = MAX_MATCH + MIN_MATCH + 1, PRESET_DICT = 32, INIT_STATE = 42, EXTRA_STATE = 69, NAME_STATE = 73, COMMENT_STATE = 91, HCRC_STATE = 103, BUSY_STATE = 113, FINISH_STATE = 666, BS_NEED_MORE = 1, BS_BLOCK_DONE = 2, BS_FINISH_STARTED = 3, BS_FINISH_DONE = 4, OS_CODE = 3;
            function err(strm, errorCode) {
                return strm.msg = msg[errorCode], errorCode;
            }
            function rank(f) {
                return (f << 1) - (4 < f ? 9 : 0);
            }
            function zero(buf) {
                for (var len = buf.length; 0 <= --len; ) buf[len] = 0;
            }
            function flush_pending(strm) {
                var s = strm.state, len = s.pending;
                len > strm.avail_out && (len = strm.avail_out), 0 !== len && (utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out), 
                strm.next_out += len, s.pending_out += len, strm.total_out += len, strm.avail_out -= len, 
                s.pending -= len, 0 === s.pending && (s.pending_out = 0));
            }
            function flush_block_only(s, last) {
                trees._tr_flush_block(s, 0 <= s.block_start ? s.block_start : -1, s.strstart - s.block_start, last), 
                s.block_start = s.strstart, flush_pending(s.strm);
            }
            function put_byte(s, b) {
                s.pending_buf[s.pending++] = b;
            }
            function putShortMSB(s, b) {
                s.pending_buf[s.pending++] = b >>> 8 & 255, s.pending_buf[s.pending++] = 255 & b;
            }
            function longest_match(s, cur_match) {
                var match, len, chain_length = s.max_chain_length, scan = s.strstart, best_len = s.prev_length, nice_match = s.nice_match, limit = s.strstart > s.w_size - MIN_LOOKAHEAD ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0, _win = s.window, wmask = s.w_mask, prev = s.prev, strend = s.strstart + MAX_MATCH, scan_end1 = _win[scan + best_len - 1], scan_end = _win[scan + best_len];
                s.prev_length >= s.good_match && (chain_length >>= 2), nice_match > s.lookahead && (nice_match = s.lookahead);
                do {
                    if (_win[(match = cur_match) + best_len] === scan_end && _win[match + best_len - 1] === scan_end1 && _win[match] === _win[scan] && _win[++match] === _win[scan + 1]) {
                        scan += 2, match++;
                        do {} while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend);
                        if (len = MAX_MATCH - (strend - scan), scan = strend - MAX_MATCH, best_len < len) {
                            if (s.match_start = cur_match, nice_match <= (best_len = len)) break;
                            scan_end1 = _win[scan + best_len - 1], scan_end = _win[scan + best_len];
                        }
                    }
                } while ((cur_match = prev[cur_match & wmask]) > limit && 0 != --chain_length);
                return best_len <= s.lookahead ? best_len : s.lookahead;
            }
            function fill_window(s) {
                var p, n, m, more, str, strm, buf, start, size, len, _w_size = s.w_size;
                do {
                    if (more = s.window_size - s.lookahead - s.strstart, s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) {
                        for (utils.arraySet(s.window, s.window, _w_size, _w_size, 0), s.match_start -= _w_size, 
                        s.strstart -= _w_size, s.block_start -= _w_size, p = n = s.hash_size; m = s.head[--p], 
                        s.head[p] = _w_size <= m ? m - _w_size : 0, --n; ) ;
                        for (p = n = _w_size; m = s.prev[--p], s.prev[p] = _w_size <= m ? m - _w_size : 0, 
                        --n; ) ;
                        more += _w_size;
                    }
                    if (0 === s.strm.avail_in) break;
                    if (strm = s.strm, buf = s.window, start = s.strstart + s.lookahead, size = more, 
                    len = void 0, len = strm.avail_in, size < len && (len = size), n = 0 === len ? 0 : (strm.avail_in -= len, 
                    utils.arraySet(buf, strm.input, strm.next_in, len, start), 1 === strm.state.wrap ? strm.adler = adler32(strm.adler, buf, len, start) : 2 === strm.state.wrap && (strm.adler = crc32(strm.adler, buf, len, start)), 
                    strm.next_in += len, strm.total_in += len, len), s.lookahead += n, s.lookahead + s.insert >= MIN_MATCH) for (str = s.strstart - s.insert, 
                    s.ins_h = s.window[str], s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + 1]) & s.hash_mask; s.insert && (s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask, 
                    s.prev[str & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = str, str++, s.insert--, 
                    !(s.lookahead + s.insert < MIN_MATCH)); ) ;
                } while (s.lookahead < MIN_LOOKAHEAD && 0 !== s.strm.avail_in);
            }
            function deflate_fast(s, flush) {
                for (var hash_head, bflush; ;) {
                    if (s.lookahead < MIN_LOOKAHEAD) {
                        if (fill_window(s), s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) return BS_NEED_MORE;
                        if (0 === s.lookahead) break;
                    }
                    if (hash_head = 0, s.lookahead >= MIN_MATCH && (s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, 
                    hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart), 
                    0 !== hash_head && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD && (s.match_length = longest_match(s, hash_head)), 
                    s.match_length >= MIN_MATCH) if (bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH), 
                    s.lookahead -= s.match_length, s.match_length <= s.max_lazy_match && s.lookahead >= MIN_MATCH) {
                        for (s.match_length--; s.strstart++, s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, 
                        hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart, 
                        0 != --s.match_length; ) ;
                        s.strstart++;
                    } else s.strstart += s.match_length, s.match_length = 0, s.ins_h = s.window[s.strstart], 
                    s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + 1]) & s.hash_mask; else bflush = trees._tr_tally(s, 0, s.window[s.strstart]), 
                    s.lookahead--, s.strstart++;
                    if (bflush && (flush_block_only(s, !1), 0 === s.strm.avail_out)) return BS_NEED_MORE;
                }
                return s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1, flush === Z_FINISH ? (flush_block_only(s, !0), 
                0 === s.strm.avail_out ? BS_FINISH_STARTED : BS_FINISH_DONE) : s.last_lit && (flush_block_only(s, !1), 
                0 === s.strm.avail_out) ? BS_NEED_MORE : BS_BLOCK_DONE;
            }
            function deflate_slow(s, flush) {
                for (var hash_head, bflush, max_insert; ;) {
                    if (s.lookahead < MIN_LOOKAHEAD) {
                        if (fill_window(s), s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) return BS_NEED_MORE;
                        if (0 === s.lookahead) break;
                    }
                    if (hash_head = 0, s.lookahead >= MIN_MATCH && (s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, 
                    hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart), 
                    s.prev_length = s.match_length, s.prev_match = s.match_start, s.match_length = MIN_MATCH - 1, 
                    0 !== hash_head && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= s.w_size - MIN_LOOKAHEAD && (s.match_length = longest_match(s, hash_head), 
                    s.match_length <= 5 && (s.strategy === Z_FILTERED || s.match_length === MIN_MATCH && 4096 < s.strstart - s.match_start) && (s.match_length = MIN_MATCH - 1)), 
                    s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) {
                        for (max_insert = s.strstart + s.lookahead - MIN_MATCH, bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH), 
                        s.lookahead -= s.prev_length - 1, s.prev_length -= 2; ++s.strstart <= max_insert && (s.ins_h = (s.ins_h << s.hash_shift ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask, 
                        hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = s.strstart), 
                        0 != --s.prev_length; ) ;
                        if (s.match_available = 0, s.match_length = MIN_MATCH - 1, s.strstart++, bflush && (flush_block_only(s, !1), 
                        0 === s.strm.avail_out)) return BS_NEED_MORE;
                    } else if (s.match_available) {
                        if ((bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1])) && flush_block_only(s, !1), 
                        s.strstart++, s.lookahead--, 0 === s.strm.avail_out) return BS_NEED_MORE;
                    } else s.match_available = 1, s.strstart++, s.lookahead--;
                }
                return s.match_available && (bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]), 
                s.match_available = 0), s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1, 
                flush === Z_FINISH ? (flush_block_only(s, !0), 0 === s.strm.avail_out ? BS_FINISH_STARTED : BS_FINISH_DONE) : s.last_lit && (flush_block_only(s, !1), 
                0 === s.strm.avail_out) ? BS_NEED_MORE : BS_BLOCK_DONE;
            }
            function Config(good_length, max_lazy, nice_length, max_chain, func) {
                this.good_length = good_length, this.max_lazy = max_lazy, this.nice_length = nice_length, 
                this.max_chain = max_chain, this.func = func;
            }
            function DeflateState() {
                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_DEFLATED, 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 utils.Buf16(2 * HEAP_SIZE), 
                this.dyn_dtree = new utils.Buf16(2 * (2 * D_CODES + 1)), this.bl_tree = new utils.Buf16(2 * (2 * BL_CODES + 1)), 
                zero(this.dyn_ltree), zero(this.dyn_dtree), zero(this.bl_tree), this.l_desc = null, 
                this.d_desc = null, this.bl_desc = null, this.bl_count = new utils.Buf16(MAX_BITS + 1), 
                this.heap = new utils.Buf16(2 * L_CODES + 1), zero(this.heap), this.heap_len = 0, 
                this.heap_max = 0, this.depth = new utils.Buf16(2 * L_CODES + 1), zero(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 deflateResetKeep(strm) {
                var s;
                return strm && strm.state ? (strm.total_in = strm.total_out = 0, strm.data_type = Z_UNKNOWN, 
                (s = strm.state).pending = 0, s.pending_out = 0, s.wrap < 0 && (s.wrap = -s.wrap), 
                s.status = s.wrap ? INIT_STATE : BUSY_STATE, strm.adler = 2 === s.wrap ? 0 : 1, 
                s.last_flush = Z_NO_FLUSH, trees._tr_init(s), Z_OK) : err(strm, Z_STREAM_ERROR);
            }
            function deflateReset(strm) {
                var s, ret = deflateResetKeep(strm);
                return ret === Z_OK && ((s = strm.state).window_size = 2 * s.w_size, zero(s.head), 
                s.max_lazy_match = configuration_table[s.level].max_lazy, s.good_match = configuration_table[s.level].good_length, 
                s.nice_match = configuration_table[s.level].nice_length, s.max_chain_length = configuration_table[s.level].max_chain, 
                s.strstart = 0, s.block_start = 0, s.lookahead = 0, s.insert = 0, s.match_length = s.prev_length = MIN_MATCH - 1, 
                s.match_available = 0, s.ins_h = 0), ret;
            }
            function deflateInit2(strm, level, method, windowBits, memLevel, strategy) {
                if (!strm) return Z_STREAM_ERROR;
                var wrap = 1;
                if (level === Z_DEFAULT_COMPRESSION && (level = 6), windowBits < 0 ? (wrap = 0, 
                windowBits = -windowBits) : 15 < windowBits && (wrap = 2, windowBits -= 16), memLevel < 1 || MAX_MEM_LEVEL < memLevel || method !== Z_DEFLATED || windowBits < 8 || 15 < windowBits || level < 0 || 9 < level || strategy < 0 || Z_FIXED < strategy) return err(strm, Z_STREAM_ERROR);
                8 === windowBits && (windowBits = 9);
                var s = new DeflateState();
                return (strm.state = s).strm = strm, s.wrap = wrap, s.gzhead = null, s.w_bits = windowBits, 
                s.w_size = 1 << s.w_bits, s.w_mask = s.w_size - 1, s.hash_bits = memLevel + 7, s.hash_size = 1 << s.hash_bits, 
                s.hash_mask = s.hash_size - 1, s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH), 
                s.window = new utils.Buf8(2 * s.w_size), s.head = new utils.Buf16(s.hash_size), 
                s.prev = new utils.Buf16(s.w_size), s.lit_bufsize = 1 << memLevel + 6, s.pending_buf_size = 4 * s.lit_bufsize, 
                s.pending_buf = new utils.Buf8(s.pending_buf_size), s.d_buf = 1 * s.lit_bufsize, 
                s.l_buf = 3 * s.lit_bufsize, s.level = level, s.strategy = strategy, s.method = method, 
                deflateReset(strm);
            }
            configuration_table = [ new Config(0, 0, 0, 0, function(s, flush) {
                var max_block_size = 65535;
                for (max_block_size > s.pending_buf_size - 5 && (max_block_size = s.pending_buf_size - 5); ;) {
                    if (s.lookahead <= 1) {
                        if (fill_window(s), 0 === s.lookahead && flush === Z_NO_FLUSH) return BS_NEED_MORE;
                        if (0 === s.lookahead) break;
                    }
                    s.strstart += s.lookahead, s.lookahead = 0;
                    var max_start = s.block_start + max_block_size;
                    if ((0 === s.strstart || s.strstart >= max_start) && (s.lookahead = s.strstart - max_start, 
                    s.strstart = max_start, flush_block_only(s, !1), 0 === s.strm.avail_out)) return BS_NEED_MORE;
                    if (s.strstart - s.block_start >= s.w_size - MIN_LOOKAHEAD && (flush_block_only(s, !1), 
                    0 === s.strm.avail_out)) return BS_NEED_MORE;
                }
                return s.insert = 0, flush === Z_FINISH ? (flush_block_only(s, !0), 0 === s.strm.avail_out ? BS_FINISH_STARTED : BS_FINISH_DONE) : (s.strstart > s.block_start && (flush_block_only(s, !1), 
                s.strm.avail_out), BS_NEED_MORE);
            }), new Config(4, 4, 8, 4, deflate_fast), new Config(4, 5, 16, 8, deflate_fast), new Config(4, 6, 32, 32, deflate_fast), new Config(4, 4, 16, 16, deflate_slow), new Config(8, 16, 32, 32, deflate_slow), new Config(8, 16, 128, 128, deflate_slow), new Config(8, 32, 128, 256, deflate_slow), new Config(32, 128, 258, 1024, deflate_slow), new Config(32, 258, 258, 4096, deflate_slow) ], 
            exports.deflateInit = function(strm, level) {
                return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY);
            }, exports.deflateInit2 = deflateInit2, exports.deflateReset = deflateReset, exports.deflateResetKeep = deflateResetKeep, 
            exports.deflateSetHeader = function(strm, head) {
                return strm && strm.state ? 2 !== strm.state.wrap ? Z_STREAM_ERROR : (strm.state.gzhead = head, 
                Z_OK) : Z_STREAM_ERROR;
            }, exports.deflate = function(strm, flush) {
                var old_flush, s, beg, val;
                if (!strm || !strm.state || Z_BLOCK < flush || flush < 0) return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR;
                if (s = strm.state, !strm.output || !strm.input && 0 !== strm.avail_in || s.status === FINISH_STATE && flush !== Z_FINISH) return err(strm, 0 === strm.avail_out ? Z_BUF_ERROR : Z_STREAM_ERROR);
                if (s.strm = strm, old_flush = s.last_flush, s.last_flush = flush, s.status === INIT_STATE) if (2 === s.wrap) strm.adler = 0, 
                put_byte(s, 31), put_byte(s, 139), put_byte(s, 8), s.gzhead ? (put_byte(s, (s.gzhead.text ? 1 : 0) + (s.gzhead.hcrc ? 2 : 0) + (s.gzhead.extra ? 4 : 0) + (s.gzhead.name ? 8 : 0) + (s.gzhead.comment ? 16 : 0)), 
                put_byte(s, 255 & s.gzhead.time), put_byte(s, s.gzhead.time >> 8 & 255), put_byte(s, s.gzhead.time >> 16 & 255), 
                put_byte(s, s.gzhead.time >> 24 & 255), put_byte(s, 9 === s.level ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0), 
                put_byte(s, 255 & s.gzhead.os), s.gzhead.extra && s.gzhead.extra.length && (put_byte(s, 255 & s.gzhead.extra.length), 
                put_byte(s, s.gzhead.extra.length >> 8 & 255)), s.gzhead.hcrc && (strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0)), 
                s.gzindex = 0, s.status = EXTRA_STATE) : (put_byte(s, 0), put_byte(s, 0), put_byte(s, 0), 
                put_byte(s, 0), put_byte(s, 0), put_byte(s, 9 === s.level ? 2 : s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 4 : 0), 
                put_byte(s, OS_CODE), s.status = BUSY_STATE); else {
                    var header = Z_DEFLATED + (s.w_bits - 8 << 4) << 8;
                    header |= (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? 0 : s.level < 6 ? 1 : 6 === s.level ? 2 : 3) << 6, 
                    0 !== s.strstart && (header |= PRESET_DICT), header += 31 - header % 31, s.status = BUSY_STATE, 
                    putShortMSB(s, header), 0 !== s.strstart && (putShortMSB(s, strm.adler >>> 16), 
                    putShortMSB(s, 65535 & strm.adler)), strm.adler = 1;
                }
                if (s.status === EXTRA_STATE) if (s.gzhead.extra) {
                    for (beg = s.pending; s.gzindex < (65535 & s.gzhead.extra.length) && (s.pending !== s.pending_buf_size || (s.gzhead.hcrc && s.pending > beg && (strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg)), 
                    flush_pending(strm), beg = s.pending, s.pending !== s.pending_buf_size)); ) put_byte(s, 255 & s.gzhead.extra[s.gzindex]), 
                    s.gzindex++;
                    s.gzhead.hcrc && s.pending > beg && (strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg)), 
                    s.gzindex === s.gzhead.extra.length && (s.gzindex = 0, s.status = NAME_STATE);
                } else s.status = NAME_STATE;
                if (s.status === NAME_STATE) if (s.gzhead.name) {
                    beg = s.pending;
                    do {
                        if (s.pending === s.pending_buf_size && (s.gzhead.hcrc && s.pending > beg && (strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg)), 
                        flush_pending(strm), beg = s.pending, s.pending === s.pending_buf_size)) {
                            val = 1;
                            break;
                        }
                        put_byte(s, val = s.gzindex < s.gzhead.name.length ? 255 & s.gzhead.name.charCodeAt(s.gzindex++) : 0);
                    } while (0 !== val);
                    s.gzhead.hcrc && s.pending > beg && (strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg)), 
                    0 === val && (s.gzindex = 0, s.status = COMMENT_STATE);
                } else s.status = COMMENT_STATE;
                if (s.status === COMMENT_STATE) if (s.gzhead.comment) {
                    beg = s.pending;
                    do {
                        if (s.pending === s.pending_buf_size && (s.gzhead.hcrc && s.pending > beg && (strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg)), 
                        flush_pending(strm), beg = s.pending, s.pending === s.pending_buf_size)) {
                            val = 1;
                            break;
                        }
                        put_byte(s, val = s.gzindex < s.gzhead.comment.length ? 255 & s.gzhead.comment.charCodeAt(s.gzindex++) : 0);
                    } while (0 !== val);
                    s.gzhead.hcrc && s.pending > beg && (strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg)), 
                    0 === val && (s.status = HCRC_STATE);
                } else s.status = HCRC_STATE;
                if (s.status === HCRC_STATE && (s.gzhead.hcrc ? (s.pending + 2 > s.pending_buf_size && flush_pending(strm), 
                s.pending + 2 <= s.pending_buf_size && (put_byte(s, 255 & strm.adler), put_byte(s, strm.adler >> 8 & 255), 
                strm.adler = 0, s.status = BUSY_STATE)) : s.status = BUSY_STATE), 0 !== s.pending) {
                    if (flush_pending(strm), 0 === strm.avail_out) return s.last_flush = -1, Z_OK;
                } else if (0 === strm.avail_in && rank(flush) <= rank(old_flush) && flush !== Z_FINISH) return err(strm, Z_BUF_ERROR);
                if (s.status === FINISH_STATE && 0 !== strm.avail_in) return err(strm, Z_BUF_ERROR);
                if (0 !== strm.avail_in || 0 !== s.lookahead || flush !== Z_NO_FLUSH && s.status !== FINISH_STATE) {
                    var bstate = s.strategy === Z_HUFFMAN_ONLY ? function(s, flush) {
                        for (var bflush; ;) {
                            if (0 === s.lookahead && (fill_window(s), 0 === s.lookahead)) {
                                if (flush === Z_NO_FLUSH) return BS_NEED_MORE;
                                break;
                            }
                            if (s.match_length = 0, bflush = trees._tr_tally(s, 0, s.window[s.strstart]), s.lookahead--, 
                            s.strstart++, bflush && (flush_block_only(s, !1), 0 === s.strm.avail_out)) return BS_NEED_MORE;
                        }
                        return s.insert = 0, flush === Z_FINISH ? (flush_block_only(s, !0), 0 === s.strm.avail_out ? BS_FINISH_STARTED : BS_FINISH_DONE) : s.last_lit && (flush_block_only(s, !1), 
                        0 === s.strm.avail_out) ? BS_NEED_MORE : BS_BLOCK_DONE;
                    }(s, flush) : s.strategy === Z_RLE ? function(s, flush) {
                        for (var bflush, prev, scan, strend, _win = s.window; ;) {
                            if (s.lookahead <= MAX_MATCH) {
                                if (fill_window(s), s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) return BS_NEED_MORE;
                                if (0 === s.lookahead) break;
                            }
                            if (s.match_length = 0, s.lookahead >= MIN_MATCH && 0 < s.strstart && (prev = _win[scan = s.strstart - 1]) === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) {
                                strend = s.strstart + MAX_MATCH;
                                do {} while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend);
                                s.match_length = MAX_MATCH - (strend - scan), s.match_length > s.lookahead && (s.match_length = s.lookahead);
                            }
                            if (s.match_length >= MIN_MATCH ? (bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH), 
                            s.lookahead -= s.match_length, s.strstart += s.match_length, s.match_length = 0) : (bflush = trees._tr_tally(s, 0, s.window[s.strstart]), 
                            s.lookahead--, s.strstart++), bflush && (flush_block_only(s, !1), 0 === s.strm.avail_out)) return BS_NEED_MORE;
                        }
                        return s.insert = 0, flush === Z_FINISH ? (flush_block_only(s, !0), 0 === s.strm.avail_out ? BS_FINISH_STARTED : BS_FINISH_DONE) : s.last_lit && (flush_block_only(s, !1), 
                        0 === s.strm.avail_out) ? BS_NEED_MORE : BS_BLOCK_DONE;
                    }(s, flush) : configuration_table[s.level].func(s, flush);
                    if (bstate !== BS_FINISH_STARTED && bstate !== BS_FINISH_DONE || (s.status = FINISH_STATE), 
                    bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) return 0 === strm.avail_out && (s.last_flush = -1), 
                    Z_OK;
                    if (bstate === BS_BLOCK_DONE && (flush === Z_PARTIAL_FLUSH ? trees._tr_align(s) : flush !== Z_BLOCK && (trees._tr_stored_block(s, 0, 0, !1), 
                    flush === Z_FULL_FLUSH && (zero(s.head), 0 === s.lookahead && (s.strstart = 0, s.block_start = 0, 
                    s.insert = 0))), flush_pending(strm), 0 === strm.avail_out)) return s.last_flush = -1, 
                    Z_OK;
                }
                return flush !== Z_FINISH ? Z_OK : s.wrap <= 0 ? Z_STREAM_END : (2 === s.wrap ? (put_byte(s, 255 & strm.adler), 
                put_byte(s, strm.adler >> 8 & 255), put_byte(s, strm.adler >> 16 & 255), put_byte(s, strm.adler >> 24 & 255), 
                put_byte(s, 255 & strm.total_in), put_byte(s, strm.total_in >> 8 & 255), put_byte(s, strm.total_in >> 16 & 255), 
                put_byte(s, strm.total_in >> 24 & 255)) : (putShortMSB(s, strm.adler >>> 16), putShortMSB(s, 65535 & strm.adler)), 
                flush_pending(strm), 0 < s.wrap && (s.wrap = -s.wrap), 0 !== s.pending ? Z_OK : Z_STREAM_END);
            }, exports.deflateEnd = function(strm) {
                var status;
                return strm && strm.state ? (status = strm.state.status) !== INIT_STATE && status !== EXTRA_STATE && status !== NAME_STATE && status !== COMMENT_STATE && status !== HCRC_STATE && status !== BUSY_STATE && status !== FINISH_STATE ? err(strm, Z_STREAM_ERROR) : (strm.state = null, 
                status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK) : Z_STREAM_ERROR;
            }, exports.deflateSetDictionary = function(strm, dictionary) {
                var s, str, n, wrap, avail, next, input, tmpDict, dictLength = dictionary.length;
                if (!strm || !strm.state) return Z_STREAM_ERROR;
                if (2 === (wrap = (s = strm.state).wrap) || 1 === wrap && s.status !== INIT_STATE || s.lookahead) return Z_STREAM_ERROR;
                for (1 === wrap && (strm.adler = adler32(strm.adler, dictionary, dictLength, 0)), 
                s.wrap = 0, dictLength >= s.w_size && (0 === wrap && (zero(s.head), s.strstart = 0, 
                s.block_start = 0, s.insert = 0), tmpDict = new utils.Buf8(s.w_size), utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0), 
                dictionary = tmpDict, dictLength = s.w_size), avail = strm.avail_in, next = strm.next_in, 
                input = strm.input, strm.avail_in = dictLength, strm.next_in = 0, strm.input = dictionary, 
                fill_window(s); s.lookahead >= MIN_MATCH; ) {
                    for (str = s.strstart, n = s.lookahead - (MIN_MATCH - 1); s.ins_h = (s.ins_h << s.hash_shift ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask, 
                    s.prev[str & s.w_mask] = s.head[s.ins_h], s.head[s.ins_h] = str, str++, --n; ) ;
                    s.strstart = str, s.lookahead = MIN_MATCH - 1, fill_window(s);
                }
                return s.strstart += s.lookahead, s.block_start = s.strstart, s.insert = s.lookahead, 
                s.lookahead = 0, s.match_length = s.prev_length = MIN_MATCH - 1, s.match_available = 0, 
                strm.next_in = next, strm.input = input, strm.avail_in = avail, s.wrap = wrap, Z_OK;
            }, exports.deflateInfo = "pako deflate (from Nodeca project)";
        }, {
            "../utils/common": 200,
            "./adler32": 202,
            "./crc32": 204,
            "./messages": 210,
            "./trees": 211
        } ],
        206: [ function(require, module, exports) {
            "use strict";
            module.exports = function() {
                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;
            };
        }, {} ],
        207: [ function(require, module, exports) {
            "use strict";
            module.exports = function(strm, start) {
                var state, _in, last, _out, beg, end, dmax, wsize, whave, wnext, s_window, hold, bits, lcode, dcode, lmask, dmask, here, op, len, dist, from, from_source, input, output;
                state = strm.state, _in = strm.next_in, input = strm.input, last = _in + (strm.avail_in - 5), 
                _out = strm.next_out, output = strm.output, beg = _out - (start - strm.avail_out), 
                end = _out + (strm.avail_out - 257), dmax = state.dmax, wsize = state.wsize, whave = state.whave, 
                wnext = state.wnext, s_window = state.window, hold = state.hold, bits = state.bits, 
                lcode = state.lencode, dcode = state.distcode, lmask = (1 << state.lenbits) - 1, 
                dmask = (1 << state.distbits) - 1;
                top: do {
                    bits < 15 && (hold += input[_in++] << bits, bits += 8, hold += input[_in++] << bits, 
                    bits += 8), here = lcode[hold & lmask];
                    dolen: for (;;) {
                        if (hold >>>= op = here >>> 24, bits -= op, 0 === (op = here >>> 16 & 255)) output[_out++] = 65535 & here; else {
                            if (!(16 & op)) {
                                if (0 == (64 & op)) {
                                    here = lcode[(65535 & here) + (hold & (1 << op) - 1)];
                                    continue dolen;
                                }
                                if (32 & op) {
                                    state.mode = 12;
                                    break top;
                                }
                                strm.msg = "invalid literal/length code", state.mode = 30;
                                break top;
                            }
                            len = 65535 & here, (op &= 15) && (bits < op && (hold += input[_in++] << bits, bits += 8), 
                            len += hold & (1 << op) - 1, hold >>>= op, bits -= op), bits < 15 && (hold += input[_in++] << bits, 
                            bits += 8, hold += input[_in++] << bits, bits += 8), here = dcode[hold & dmask];
                            dodist: for (;;) {
                                if (hold >>>= op = here >>> 24, bits -= op, !(16 & (op = here >>> 16 & 255))) {
                                    if (0 == (64 & op)) {
                                        here = dcode[(65535 & here) + (hold & (1 << op) - 1)];
                                        continue dodist;
                                    }
                                    strm.msg = "invalid distance code", state.mode = 30;
                                    break top;
                                }
                                if (dist = 65535 & here, bits < (op &= 15) && (hold += input[_in++] << bits, (bits += 8) < op && (hold += input[_in++] << bits, 
                                bits += 8)), dmax < (dist += hold & (1 << op) - 1)) {
                                    strm.msg = "invalid distance too far back", state.mode = 30;
                                    break top;
                                }
                                if (hold >>>= op, bits -= op, (op = _out - beg) < dist) {
                                    if (whave < (op = dist - op) && state.sane) {
                                        strm.msg = "invalid distance too far back", state.mode = 30;
                                        break top;
                                    }
                                    if (from_source = s_window, (from = 0) === wnext) {
                                        if (from += wsize - op, op < len) {
                                            for (len -= op; output[_out++] = s_window[from++], --op; ) ;
                                            from = _out - dist, from_source = output;
                                        }
                                    } else if (wnext < op) {
                                        if (from += wsize + wnext - op, (op -= wnext) < len) {
                                            for (len -= op; output[_out++] = s_window[from++], --op; ) ;
                                            if (from = 0, wnext < len) {
                                                for (len -= op = wnext; output[_out++] = s_window[from++], --op; ) ;
                                                from = _out - dist, from_source = output;
                                            }
                                        }
                                    } else if (from += wnext - op, op < len) {
                                        for (len -= op; output[_out++] = s_window[from++], --op; ) ;
                                        from = _out - dist, from_source = output;
                                    }
                                    for (;2 < len; ) output[_out++] = from_source[from++], output[_out++] = from_source[from++], 
                                    output[_out++] = from_source[from++], len -= 3;
                                    len && (output[_out++] = from_source[from++], 1 < len && (output[_out++] = from_source[from++]));
                                } else {
                                    for (from = _out - dist; output[_out++] = output[from++], output[_out++] = output[from++], 
                                    output[_out++] = output[from++], 2 < (len -= 3); ) ;
                                    len && (output[_out++] = output[from++], 1 < len && (output[_out++] = output[from++]));
                                }
                                break;
                            }
                        }
                        break;
                    }
                } while (_in < last && _out < end);
                _in -= len = bits >> 3, hold &= (1 << (bits -= len << 3)) - 1, strm.next_in = _in, 
                strm.next_out = _out, strm.avail_in = _in < last ? last - _in + 5 : 5 - (_in - last), 
                strm.avail_out = _out < end ? end - _out + 257 : 257 - (_out - end), state.hold = hold, 
                state.bits = bits;
            };
        }, {} ],
        208: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils/common"), adler32 = require("./adler32"), crc32 = require("./crc32"), inflate_fast = require("./inffast"), inflate_table = require("./inftrees"), CODES = 0, LENS = 1, DISTS = 2, Z_FINISH = 4, Z_BLOCK = 5, Z_TREES = 6, Z_OK = 0, Z_STREAM_END = 1, Z_NEED_DICT = 2, Z_STREAM_ERROR = -2, Z_DATA_ERROR = -3, Z_MEM_ERROR = -4, Z_BUF_ERROR = -5, Z_DEFLATED = 8, HEAD = 1, FLAGS = 2, TIME = 3, OS = 4, EXLEN = 5, EXTRA = 6, NAME = 7, COMMENT = 8, HCRC = 9, DICTID = 10, DICT = 11, TYPE = 12, TYPEDO = 13, STORED = 14, COPY_ = 15, COPY = 16, TABLE = 17, LENLENS = 18, CODELENS = 19, LEN_ = 20, LEN = 21, LENEXT = 22, DIST = 23, DISTEXT = 24, MATCH = 25, LIT = 26, CHECK = 27, LENGTH = 28, DONE = 29, BAD = 30, MEM = 31, SYNC = 32, ENOUGH_LENS = 852, ENOUGH_DISTS = 592, DEF_WBITS = 15;
            function zswap32(q) {
                return (q >>> 24 & 255) + (q >>> 8 & 65280) + ((65280 & q) << 8) + ((255 & q) << 24);
            }
            function InflateState() {
                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 utils.Buf16(320), 
                this.work = new utils.Buf16(288), this.lendyn = null, this.distdyn = null, this.sane = 0, 
                this.back = 0, this.was = 0;
            }
            function inflateResetKeep(strm) {
                var state;
                return strm && strm.state ? (state = strm.state, strm.total_in = strm.total_out = state.total = 0, 
                strm.msg = "", state.wrap && (strm.adler = 1 & state.wrap), state.mode = HEAD, state.last = 0, 
                state.havedict = 0, state.dmax = 32768, state.head = null, state.hold = 0, state.bits = 0, 
                state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS), state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS), 
                state.sane = 1, state.back = -1, Z_OK) : Z_STREAM_ERROR;
            }
            function inflateReset(strm) {
                var state;
                return strm && strm.state ? ((state = strm.state).wsize = 0, state.whave = 0, state.wnext = 0, 
                inflateResetKeep(strm)) : Z_STREAM_ERROR;
            }
            function inflateReset2(strm, windowBits) {
                var wrap, state;
                return strm && strm.state ? (state = strm.state, windowBits < 0 ? (wrap = 0, windowBits = -windowBits) : (wrap = 1 + (windowBits >> 4), 
                windowBits < 48 && (windowBits &= 15)), windowBits && (windowBits < 8 || 15 < windowBits) ? Z_STREAM_ERROR : (null !== state.window && state.wbits !== windowBits && (state.window = null), 
                state.wrap = wrap, state.wbits = windowBits, inflateReset(strm))) : Z_STREAM_ERROR;
            }
            function inflateInit2(strm, windowBits) {
                var ret, state;
                return strm ? (state = new InflateState(), (strm.state = state).window = null, (ret = inflateReset2(strm, windowBits)) !== Z_OK && (strm.state = null), 
                ret) : Z_STREAM_ERROR;
            }
            var lenfix, distfix, virgin = !0;
            function fixedtables(state) {
                if (virgin) {
                    var sym;
                    for (lenfix = new utils.Buf32(512), distfix = new utils.Buf32(32), sym = 0; sym < 144; ) state.lens[sym++] = 8;
                    for (;sym < 256; ) state.lens[sym++] = 9;
                    for (;sym < 280; ) state.lens[sym++] = 7;
                    for (;sym < 288; ) state.lens[sym++] = 8;
                    for (inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, {
                        bits: 9
                    }), sym = 0; sym < 32; ) state.lens[sym++] = 5;
                    inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, {
                        bits: 5
                    }), virgin = !1;
                }
                state.lencode = lenfix, state.lenbits = 9, state.distcode = distfix, state.distbits = 5;
            }
            function updatewindow(strm, src, end, copy) {
                var dist, state = strm.state;
                return null === state.window && (state.wsize = 1 << state.wbits, state.wnext = 0, 
                state.whave = 0, state.window = new utils.Buf8(state.wsize)), copy >= state.wsize ? (utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0), 
                state.wnext = 0, state.whave = state.wsize) : (copy < (dist = state.wsize - state.wnext) && (dist = copy), 
                utils.arraySet(state.window, src, end - copy, dist, state.wnext), (copy -= dist) ? (utils.arraySet(state.window, src, end - copy, copy, 0), 
                state.wnext = copy, state.whave = state.wsize) : (state.wnext += dist, state.wnext === state.wsize && (state.wnext = 0), 
                state.whave < state.wsize && (state.whave += dist))), 0;
            }
            exports.inflateReset = inflateReset, exports.inflateReset2 = inflateReset2, exports.inflateResetKeep = inflateResetKeep, 
            exports.inflateInit = function(strm) {
                return inflateInit2(strm, DEF_WBITS);
            }, exports.inflateInit2 = inflateInit2, exports.inflate = function(strm, flush) {
                var state, input, output, next, put, have, left, hold, bits, _in, _out, copy, from, from_source, here_bits, here_op, here_val, last_bits, last_op, last_val, len, ret, opts, n, here = 0, hbuf = new utils.Buf8(4), order = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ];
                if (!strm || !strm.state || !strm.output || !strm.input && 0 !== strm.avail_in) return Z_STREAM_ERROR;
                (state = strm.state).mode === TYPE && (state.mode = TYPEDO), put = strm.next_out, 
                output = strm.output, left = strm.avail_out, next = strm.next_in, input = strm.input, 
                have = strm.avail_in, hold = state.hold, bits = state.bits, _in = have, _out = left, 
                ret = Z_OK;
                inf_leave: for (;;) switch (state.mode) {
                  case HEAD:
                    if (0 === state.wrap) {
                        state.mode = TYPEDO;
                        break;
                    }
                    for (;bits < 16; ) {
                        if (0 === have) break inf_leave;
                        have--, hold += input[next++] << bits, bits += 8;
                    }
                    if (2 & state.wrap && 35615 === hold) {
                        hbuf[state.check = 0] = 255 & hold, hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0), 
                        bits = hold = 0, state.mode = FLAGS;
                        break;
                    }
                    if (state.flags = 0, state.head && (state.head.done = !1), !(1 & state.wrap) || (((255 & hold) << 8) + (hold >> 8)) % 31) {
                        strm.msg = "incorrect header check", state.mode = BAD;
                        break;
                    }
                    if ((15 & hold) !== Z_DEFLATED) {
                        strm.msg = "unknown compression method", state.mode = BAD;
                        break;
                    }
                    if (bits -= 4, len = 8 + (15 & (hold >>>= 4)), 0 === state.wbits) state.wbits = len; else if (len > state.wbits) {
                        strm.msg = "invalid window size", state.mode = BAD;
                        break;
                    }
                    state.dmax = 1 << len, strm.adler = state.check = 1, state.mode = 512 & hold ? DICTID : TYPE, 
                    bits = hold = 0;
                    break;

                  case FLAGS:
                    for (;bits < 16; ) {
                        if (0 === have) break inf_leave;
                        have--, hold += input[next++] << bits, bits += 8;
                    }
                    if (state.flags = hold, (255 & state.flags) !== Z_DEFLATED) {
                        strm.msg = "unknown compression method", state.mode = BAD;
                        break;
                    }
                    if (57344 & state.flags) {
                        strm.msg = "unknown header flags set", state.mode = BAD;
                        break;
                    }
                    state.head && (state.head.text = hold >> 8 & 1), 512 & state.flags && (hbuf[0] = 255 & hold, 
                    hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0)), bits = hold = 0, 
                    state.mode = TIME;

                  case TIME:
                    for (;bits < 32; ) {
                        if (0 === have) break inf_leave;
                        have--, hold += input[next++] << bits, bits += 8;
                    }
                    state.head && (state.head.time = hold), 512 & state.flags && (hbuf[0] = 255 & hold, 
                    hbuf[1] = hold >>> 8 & 255, hbuf[2] = hold >>> 16 & 255, hbuf[3] = hold >>> 24 & 255, 
                    state.check = crc32(state.check, hbuf, 4, 0)), bits = hold = 0, state.mode = OS;

                  case OS:
                    for (;bits < 16; ) {
                        if (0 === have) break inf_leave;
                        have--, hold += input[next++] << bits, bits += 8;
                    }
                    state.head && (state.head.xflags = 255 & hold, state.head.os = hold >> 8), 512 & state.flags && (hbuf[0] = 255 & hold, 
                    hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0)), bits = hold = 0, 
                    state.mode = EXLEN;

                  case EXLEN:
                    if (1024 & state.flags) {
                        for (;bits < 16; ) {
                            if (0 === have) break inf_leave;
                            have--, hold += input[next++] << bits, bits += 8;
                        }
                        state.length = hold, state.head && (state.head.extra_len = hold), 512 & state.flags && (hbuf[0] = 255 & hold, 
                        hbuf[1] = hold >>> 8 & 255, state.check = crc32(state.check, hbuf, 2, 0)), bits = hold = 0;
                    } else state.head && (state.head.extra = null);
                    state.mode = EXTRA;

                  case EXTRA:
                    if (1024 & state.flags && (have < (copy = state.length) && (copy = have), copy && (state.head && (len = state.head.extra_len - state.length, 
                    state.head.extra || (state.head.extra = new Array(state.head.extra_len)), utils.arraySet(state.head.extra, input, next, copy, len)), 
                    512 & state.flags && (state.check = crc32(state.check, input, copy, next)), have -= copy, 
                    next += copy, state.length -= copy), state.length)) break inf_leave;
                    state.length = 0, state.mode = NAME;

                  case NAME:
                    if (2048 & state.flags) {
                        if (0 === have) break inf_leave;
                        for (copy = 0; len = input[next + copy++], state.head && len && state.length < 65536 && (state.head.name += String.fromCharCode(len)), 
                        len && copy < have; ) ;
                        if (512 & state.flags && (state.check = crc32(state.check, input, copy, next)), 
                        have -= copy, next += copy, len) break inf_leave;
                    } else state.head && (state.head.name = null);
                    state.length = 0, state.mode = COMMENT;

                  case COMMENT:
                    if (4096 & state.flags) {
                        if (0 === have) break inf_leave;
                        for (copy = 0; len = input[next + copy++], state.head && len && state.length < 65536 && (state.head.comment += String.fromCharCode(len)), 
                        len && copy < have; ) ;
                        if (512 & state.flags && (state.check = crc32(state.check, input, copy, next)), 
                        have -= copy, next += copy, len) break inf_leave;
                    } else state.head && (state.head.comment = null);
                    state.mode = HCRC;

                  case HCRC:
                    if (512 & state.flags) {
                        for (;bits < 16; ) {
                            if (0 === have) break inf_leave;
                            have--, hold += input[next++] << bits, bits += 8;
                        }
                        if (hold !== (65535 & state.check)) {
                            strm.msg = "header crc mismatch", state.mode = BAD;
                            break;
                        }
                        bits = hold = 0;
                    }
                    state.head && (state.head.hcrc = state.flags >> 9 & 1, state.head.done = !0), strm.adler = state.check = 0, 
                    state.mode = TYPE;
                    break;

                  case DICTID:
                    for (;bits < 32; ) {
                        if (0 === have) break inf_leave;
                        have--, hold += input[next++] << bits, bits += 8;
                    }
                    strm.adler = state.check = zswap32(hold), bits = hold = 0, state.mode = DICT;

                  case DICT:
                    if (0 === state.havedict) return strm.next_out = put, strm.avail_out = left, strm.next_in = next, 
                    strm.avail_in = have, state.hold = hold, state.bits = bits, Z_NEED_DICT;
                    strm.adler = state.check = 1, state.mode = TYPE;

                  case TYPE:
                    if (flush === Z_BLOCK || flush === Z_TREES) break inf_leave;

                  case TYPEDO:
                    if (state.last) {
                        hold >>>= 7 & bits, bits -= 7 & bits, state.mode = CHECK;
                        break;
                    }
                    for (;bits < 3; ) {
                        if (0 === have) break inf_leave;
                        have--, hold += input[next++] << bits, bits += 8;
                    }
                    switch (state.last = 1 & hold, bits -= 1, 3 & (hold >>>= 1)) {
                      case 0:
                        state.mode = STORED;
                        break;

                      case 1:
                        if (fixedtables(state), state.mode = LEN_, flush === Z_TREES) {
                            hold >>>= 2, bits -= 2;
                            break inf_leave;
                        }
                        break;

                      case 2:
                        state.mode = TABLE;
                        break;

                      case 3:
                        strm.msg = "invalid block type", state.mode = BAD;
                    }
                    hold >>>= 2, bits -= 2;
                    break;

                  case STORED:
                    for (hold >>>= 7 & bits, bits -= 7 & bits; bits < 32; ) {
                        if (0 === have) break inf_leave;
                        have--, hold += input[next++] << bits, bits += 8;
                    }
                    if ((65535 & hold) != (hold >>> 16 ^ 65535)) {
                        strm.msg = "invalid stored block lengths", state.mode = BAD;
                        break;
                    }
                    if (state.length = 65535 & hold, bits = hold = 0, state.mode = COPY_, flush === Z_TREES) break inf_leave;

                  case COPY_:
                    state.mode = COPY;

                  case COPY:
                    if (copy = state.length) {
                        if (have < copy && (copy = have), left < copy && (copy = left), 0 === copy) break inf_leave;
                        utils.arraySet(output, input, next, copy, put), have -= copy, next += copy, left -= copy, 
                        put += copy, state.length -= copy;
                        break;
                    }
                    state.mode = TYPE;
                    break;

                  case TABLE:
                    for (;bits < 14; ) {
                        if (0 === have) break inf_leave;
                        have--, hold += input[next++] << bits, bits += 8;
                    }
                    if (state.nlen = 257 + (31 & hold), hold >>>= 5, bits -= 5, state.ndist = 1 + (31 & hold), 
                    hold >>>= 5, bits -= 5, state.ncode = 4 + (15 & hold), hold >>>= 4, bits -= 4, 286 < state.nlen || 30 < state.ndist) {
                        strm.msg = "too many length or distance symbols", state.mode = BAD;
                        break;
                    }
                    state.have = 0, state.mode = LENLENS;

                  case LENLENS:
                    for (;state.have < state.ncode; ) {
                        for (;bits < 3; ) {
                            if (0 === have) break inf_leave;
                            have--, hold += input[next++] << bits, bits += 8;
                        }
                        state.lens[order[state.have++]] = 7 & hold, hold >>>= 3, bits -= 3;
                    }
                    for (;state.have < 19; ) state.lens[order[state.have++]] = 0;
                    if (state.lencode = state.lendyn, state.lenbits = 7, opts = {
                        bits: state.lenbits
                    }, ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts), 
                    state.lenbits = opts.bits, ret) {
                        strm.msg = "invalid code lengths set", state.mode = BAD;
                        break;
                    }
                    state.have = 0, state.mode = CODELENS;

                  case CODELENS:
                    for (;state.have < state.nlen + state.ndist; ) {
                        for (;here_op = (here = state.lencode[hold & (1 << state.lenbits) - 1]) >>> 16 & 255, 
                        here_val = 65535 & here, !((here_bits = here >>> 24) <= bits); ) {
                            if (0 === have) break inf_leave;
                            have--, hold += input[next++] << bits, bits += 8;
                        }
                        if (here_val < 16) hold >>>= here_bits, bits -= here_bits, state.lens[state.have++] = here_val; else {
                            if (16 === here_val) {
                                for (n = here_bits + 2; bits < n; ) {
                                    if (0 === have) break inf_leave;
                                    have--, hold += input[next++] << bits, bits += 8;
                                }
                                if (hold >>>= here_bits, bits -= here_bits, 0 === state.have) {
                                    strm.msg = "invalid bit length repeat", state.mode = BAD;
                                    break;
                                }
                                len = state.lens[state.have - 1], copy = 3 + (3 & hold), hold >>>= 2, bits -= 2;
                            } else if (17 === here_val) {
                                for (n = here_bits + 3; bits < n; ) {
                                    if (0 === have) break inf_leave;
                                    have--, hold += input[next++] << bits, bits += 8;
                                }
                                bits -= here_bits, len = 0, copy = 3 + (7 & (hold >>>= here_bits)), hold >>>= 3, 
                                bits -= 3;
                            } else {
                                for (n = here_bits + 7; bits < n; ) {
                                    if (0 === have) break inf_leave;
                                    have--, hold += input[next++] << bits, bits += 8;
                                }
                                bits -= here_bits, len = 0, copy = 11 + (127 & (hold >>>= here_bits)), hold >>>= 7, 
                                bits -= 7;
                            }
                            if (state.have + copy > state.nlen + state.ndist) {
                                strm.msg = "invalid bit length repeat", state.mode = BAD;
                                break;
                            }
                            for (;copy--; ) state.lens[state.have++] = len;
                        }
                    }
                    if (state.mode === BAD) break;
                    if (0 === state.lens[256]) {
                        strm.msg = "invalid code -- missing end-of-block", state.mode = BAD;
                        break;
                    }
                    if (state.lenbits = 9, opts = {
                        bits: state.lenbits
                    }, ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts), 
                    state.lenbits = opts.bits, ret) {
                        strm.msg = "invalid literal/lengths set", state.mode = BAD;
                        break;
                    }
                    if (state.distbits = 6, state.distcode = state.distdyn, opts = {
                        bits: state.distbits
                    }, ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts), 
                    state.distbits = opts.bits, ret) {
                        strm.msg = "invalid distances set", state.mode = BAD;
                        break;
                    }
                    if (state.mode = LEN_, flush === Z_TREES) break inf_leave;

                  case LEN_:
                    state.mode = LEN;

                  case LEN:
                    if (6 <= have && 258 <= left) {
                        strm.next_out = put, strm.avail_out = left, strm.next_in = next, strm.avail_in = have, 
                        state.hold = hold, state.bits = bits, inflate_fast(strm, _out), put = strm.next_out, 
                        output = strm.output, left = strm.avail_out, next = strm.next_in, input = strm.input, 
                        have = strm.avail_in, hold = state.hold, bits = state.bits, state.mode === TYPE && (state.back = -1);
                        break;
                    }
                    for (state.back = 0; here_op = (here = state.lencode[hold & (1 << state.lenbits) - 1]) >>> 16 & 255, 
                    here_val = 65535 & here, !((here_bits = here >>> 24) <= bits); ) {
                        if (0 === have) break inf_leave;
                        have--, hold += input[next++] << bits, bits += 8;
                    }
                    if (here_op && 0 == (240 & here_op)) {
                        for (last_bits = here_bits, last_op = here_op, last_val = here_val; here_op = (here = state.lencode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]) >>> 16 & 255, 
                        here_val = 65535 & here, !(last_bits + (here_bits = here >>> 24) <= bits); ) {
                            if (0 === have) break inf_leave;
                            have--, hold += input[next++] << bits, bits += 8;
                        }
                        hold >>>= last_bits, bits -= last_bits, state.back += last_bits;
                    }
                    if (hold >>>= here_bits, bits -= here_bits, state.back += here_bits, state.length = here_val, 
                    0 === here_op) {
                        state.mode = LIT;
                        break;
                    }
                    if (32 & here_op) {
                        state.back = -1, state.mode = TYPE;
                        break;
                    }
                    if (64 & here_op) {
                        strm.msg = "invalid literal/length code", state.mode = BAD;
                        break;
                    }
                    state.extra = 15 & here_op, state.mode = LENEXT;

                  case LENEXT:
                    if (state.extra) {
                        for (n = state.extra; bits < n; ) {
                            if (0 === have) break inf_leave;
                            have--, hold += input[next++] << bits, bits += 8;
                        }
                        state.length += hold & (1 << state.extra) - 1, hold >>>= state.extra, bits -= state.extra, 
                        state.back += state.extra;
                    }
                    state.was = state.length, state.mode = DIST;

                  case DIST:
                    for (;here_op = (here = state.distcode[hold & (1 << state.distbits) - 1]) >>> 16 & 255, 
                    here_val = 65535 & here, !((here_bits = here >>> 24) <= bits); ) {
                        if (0 === have) break inf_leave;
                        have--, hold += input[next++] << bits, bits += 8;
                    }
                    if (0 == (240 & here_op)) {
                        for (last_bits = here_bits, last_op = here_op, last_val = here_val; here_op = (here = state.distcode[last_val + ((hold & (1 << last_bits + last_op) - 1) >> last_bits)]) >>> 16 & 255, 
                        here_val = 65535 & here, !(last_bits + (here_bits = here >>> 24) <= bits); ) {
                            if (0 === have) break inf_leave;
                            have--, hold += input[next++] << bits, bits += 8;
                        }
                        hold >>>= last_bits, bits -= last_bits, state.back += last_bits;
                    }
                    if (hold >>>= here_bits, bits -= here_bits, state.back += here_bits, 64 & here_op) {
                        strm.msg = "invalid distance code", state.mode = BAD;
                        break;
                    }
                    state.offset = here_val, state.extra = 15 & here_op, state.mode = DISTEXT;

                  case DISTEXT:
                    if (state.extra) {
                        for (n = state.extra; bits < n; ) {
                            if (0 === have) break inf_leave;
                            have--, hold += input[next++] << bits, bits += 8;
                        }
                        state.offset += hold & (1 << state.extra) - 1, hold >>>= state.extra, bits -= state.extra, 
                        state.back += state.extra;
                    }
                    if (state.offset > state.dmax) {
                        strm.msg = "invalid distance too far back", state.mode = BAD;
                        break;
                    }
                    state.mode = MATCH;

                  case MATCH:
                    if (0 === left) break inf_leave;
                    if (copy = _out - left, state.offset > copy) {
                        if ((copy = state.offset - copy) > state.whave && state.sane) {
                            strm.msg = "invalid distance too far back", state.mode = BAD;
                            break;
                        }
                        copy > state.wnext ? (copy -= state.wnext, from = state.wsize - copy) : from = state.wnext - copy, 
                        copy > state.length && (copy = state.length), from_source = state.window;
                    } else from_source = output, from = put - state.offset, copy = state.length;
                    for (left < copy && (copy = left), left -= copy, state.length -= copy; output[put++] = from_source[from++], 
                    --copy; ) ;
                    0 === state.length && (state.mode = LEN);
                    break;

                  case LIT:
                    if (0 === left) break inf_leave;
                    output[put++] = state.length, left--, state.mode = LEN;
                    break;

                  case CHECK:
                    if (state.wrap) {
                        for (;bits < 32; ) {
                            if (0 === have) break inf_leave;
                            have--, hold |= input[next++] << bits, bits += 8;
                        }
                        if (_out -= left, strm.total_out += _out, state.total += _out, _out && (strm.adler = state.check = state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)), 
                        _out = left, (state.flags ? hold : zswap32(hold)) !== state.check) {
                            strm.msg = "incorrect data check", state.mode = BAD;
                            break;
                        }
                        bits = hold = 0;
                    }
                    state.mode = LENGTH;

                  case LENGTH:
                    if (state.wrap && state.flags) {
                        for (;bits < 32; ) {
                            if (0 === have) break inf_leave;
                            have--, hold += input[next++] << bits, bits += 8;
                        }
                        if (hold !== (4294967295 & state.total)) {
                            strm.msg = "incorrect length check", state.mode = BAD;
                            break;
                        }
                        bits = hold = 0;
                    }
                    state.mode = DONE;

                  case DONE:
                    ret = Z_STREAM_END;
                    break inf_leave;

                  case BAD:
                    ret = Z_DATA_ERROR;
                    break inf_leave;

                  case MEM:
                    return Z_MEM_ERROR;

                  case SYNC:
                  default:
                    return Z_STREAM_ERROR;
                }
                return strm.next_out = put, strm.avail_out = left, strm.next_in = next, strm.avail_in = have, 
                state.hold = hold, state.bits = bits, (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH)) && updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out) ? (state.mode = MEM, 
                Z_MEM_ERROR) : (_in -= strm.avail_in, _out -= strm.avail_out, strm.total_in += _in, 
                strm.total_out += _out, state.total += _out, state.wrap && _out && (strm.adler = state.check = state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)), 
                strm.data_type = state.bits + (state.last ? 64 : 0) + (state.mode === TYPE ? 128 : 0) + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0), 
                (0 === _in && 0 === _out || flush === Z_FINISH) && ret === Z_OK && (ret = Z_BUF_ERROR), 
                ret);
            }, exports.inflateEnd = function(strm) {
                if (!strm || !strm.state) return Z_STREAM_ERROR;
                var state = strm.state;
                return state.window && (state.window = null), strm.state = null, Z_OK;
            }, exports.inflateGetHeader = function(strm, head) {
                var state;
                return strm && strm.state ? 0 == (2 & (state = strm.state).wrap) ? Z_STREAM_ERROR : ((state.head = head).done = !1, 
                Z_OK) : Z_STREAM_ERROR;
            }, exports.inflateSetDictionary = function(strm, dictionary) {
                var state, dictLength = dictionary.length;
                return strm && strm.state ? 0 !== (state = strm.state).wrap && state.mode !== DICT ? Z_STREAM_ERROR : state.mode === DICT && adler32(1, dictionary, dictLength, 0) !== state.check ? Z_DATA_ERROR : updatewindow(strm, dictionary, dictLength, dictLength) ? (state.mode = MEM, 
                Z_MEM_ERROR) : (state.havedict = 1, Z_OK) : Z_STREAM_ERROR;
            }, exports.inflateInfo = "pako inflate (from Nodeca project)";
        }, {
            "../utils/common": 200,
            "./adler32": 202,
            "./crc32": 204,
            "./inffast": 207,
            "./inftrees": 209
        } ],
        209: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils/common"), lbase = [ 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 ], lext = [ 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 ], dbase = [ 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 ], dext = [ 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 ];
            module.exports = function(type, lens, lens_index, codes, table, table_index, work, opts) {
                var incr, fill, low, mask, next, end, here_bits, here_op, here_val, bits = opts.bits, len = 0, sym = 0, min = 0, max = 0, root = 0, curr = 0, drop = 0, left = 0, used = 0, huff = 0, base = null, base_index = 0, count = new utils.Buf16(16), offs = new utils.Buf16(16), extra = null, extra_index = 0;
                for (len = 0; len <= 15; len++) count[len] = 0;
                for (sym = 0; sym < codes; sym++) count[lens[lens_index + sym]]++;
                for (root = bits, max = 15; 1 <= max && 0 === count[max]; max--) ;
                if (max < root && (root = max), 0 === max) return table[table_index++] = 20971520, 
                table[table_index++] = 20971520, opts.bits = 1, 0;
                for (min = 1; min < max && 0 === count[min]; min++) ;
                for (root < min && (root = min), len = left = 1; len <= 15; len++) if (left <<= 1, 
                (left -= count[len]) < 0) return -1;
                if (0 < left && (0 === type || 1 !== max)) return -1;
                for (offs[1] = 0, len = 1; len < 15; len++) offs[len + 1] = offs[len] + count[len];
                for (sym = 0; sym < codes; sym++) 0 !== lens[lens_index + sym] && (work[offs[lens[lens_index + sym]]++] = sym);
                if (0 === type ? (base = extra = work, end = 19) : 1 === type ? (base = lbase, base_index -= 257, 
                extra = lext, extra_index -= 257, end = 256) : (base = dbase, extra = dext, end = -1), 
                len = min, next = table_index, drop = sym = huff = 0, low = -1, mask = (used = 1 << (curr = root)) - 1, 
                1 === type && 852 < used || 2 === type && 592 < used) return 1;
                for (;;) {
                    for (here_bits = len - drop, work[sym] < end ? (here_op = 0, here_val = work[sym]) : work[sym] > end ? (here_op = extra[extra_index + work[sym]], 
                    here_val = base[base_index + work[sym]]) : (here_op = 96, here_val = 0), incr = 1 << len - drop, 
                    min = fill = 1 << curr; table[next + (huff >> drop) + (fill -= incr)] = here_bits << 24 | here_op << 16 | here_val | 0, 
                    0 !== fill; ) ;
                    for (incr = 1 << len - 1; huff & incr; ) incr >>= 1;
                    if (0 !== incr ? (huff &= incr - 1, huff += incr) : huff = 0, sym++, 0 == --count[len]) {
                        if (len === max) break;
                        len = lens[lens_index + work[sym]];
                    }
                    if (root < len && (huff & mask) !== low) {
                        for (0 === drop && (drop = root), next += min, left = 1 << (curr = len - drop); curr + drop < max && !((left -= count[curr + drop]) <= 0); ) curr++, 
                        left <<= 1;
                        if (used += 1 << curr, 1 === type && 852 < used || 2 === type && 592 < used) return 1;
                        table[low = huff & mask] = root << 24 | curr << 16 | next - table_index | 0;
                    }
                }
                return 0 !== huff && (table[next + huff] = len - drop << 24 | 64 << 16 | 0), opts.bits = root, 
                0;
            };
        }, {
            "../utils/common": 200
        } ],
        210: [ function(require, module, exports) {
            "use strict";
            module.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"
            };
        }, {} ],
        211: [ function(require, module, exports) {
            "use strict";
            var utils = require("../utils/common"), Z_FIXED = 4, Z_BINARY = 0, Z_TEXT = 1, Z_UNKNOWN = 2;
            function zero(buf) {
                for (var len = buf.length; 0 <= --len; ) buf[len] = 0;
            }
            var STORED_BLOCK = 0, STATIC_TREES = 1, DYN_TREES = 2, LENGTH_CODES = 29, LITERALS = 256, L_CODES = LITERALS + 1 + LENGTH_CODES, D_CODES = 30, BL_CODES = 19, HEAP_SIZE = 2 * L_CODES + 1, MAX_BITS = 15, Buf_size = 16, MAX_BL_BITS = 7, END_BLOCK = 256, REP_3_6 = 16, REPZ_3_10 = 17, REPZ_11_138 = 18, extra_lbits = [ 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 ], extra_dbits = [ 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 ], extra_blbits = [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 7 ], bl_order = [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ], static_ltree = new Array(2 * (L_CODES + 2));
            zero(static_ltree);
            var static_dtree = new Array(2 * D_CODES);
            zero(static_dtree);
            var _dist_code = new Array(512);
            zero(_dist_code);
            var _length_code = new Array(256);
            zero(_length_code);
            var base_length = new Array(LENGTH_CODES);
            zero(base_length);
            var static_l_desc, static_d_desc, static_bl_desc, base_dist = new Array(D_CODES);
            function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) {
                this.static_tree = static_tree, this.extra_bits = extra_bits, this.extra_base = extra_base, 
                this.elems = elems, this.max_length = max_length, this.has_stree = static_tree && static_tree.length;
            }
            function TreeDesc(dyn_tree, stat_desc) {
                this.dyn_tree = dyn_tree, this.max_code = 0, this.stat_desc = stat_desc;
            }
            function d_code(dist) {
                return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)];
            }
            function put_short(s, w) {
                s.pending_buf[s.pending++] = 255 & w, s.pending_buf[s.pending++] = w >>> 8 & 255;
            }
            function send_bits(s, value, length) {
                s.bi_valid > Buf_size - length ? (s.bi_buf |= value << s.bi_valid & 65535, put_short(s, s.bi_buf), 
                s.bi_buf = value >> Buf_size - s.bi_valid, s.bi_valid += length - Buf_size) : (s.bi_buf |= value << s.bi_valid & 65535, 
                s.bi_valid += length);
            }
            function send_code(s, c, tree) {
                send_bits(s, tree[2 * c], tree[2 * c + 1]);
            }
            function bi_reverse(code, len) {
                for (var res = 0; res |= 1 & code, code >>>= 1, res <<= 1, 0 < --len; ) ;
                return res >>> 1;
            }
            function gen_codes(tree, max_code, bl_count) {
                var bits, n, next_code = new Array(MAX_BITS + 1), code = 0;
                for (bits = 1; bits <= MAX_BITS; bits++) next_code[bits] = code = code + bl_count[bits - 1] << 1;
                for (n = 0; n <= max_code; n++) {
                    var len = tree[2 * n + 1];
                    0 !== len && (tree[2 * n] = bi_reverse(next_code[len]++, len));
                }
            }
            function init_block(s) {
                var n;
                for (n = 0; n < L_CODES; n++) s.dyn_ltree[2 * n] = 0;
                for (n = 0; n < D_CODES; n++) s.dyn_dtree[2 * n] = 0;
                for (n = 0; n < BL_CODES; n++) s.bl_tree[2 * n] = 0;
                s.dyn_ltree[2 * END_BLOCK] = 1, s.opt_len = s.static_len = 0, s.last_lit = s.matches = 0;
            }
            function bi_windup(s) {
                8 < s.bi_valid ? put_short(s, s.bi_buf) : 0 < s.bi_valid && (s.pending_buf[s.pending++] = s.bi_buf), 
                s.bi_buf = 0, s.bi_valid = 0;
            }
            function smaller(tree, n, m, depth) {
                var _n2 = 2 * n, _m2 = 2 * m;
                return tree[_n2] < tree[_m2] || tree[_n2] === tree[_m2] && depth[n] <= depth[m];
            }
            function pqdownheap(s, tree, k) {
                for (var v = s.heap[k], j = k << 1; j <= s.heap_len && (j < s.heap_len && smaller(tree, s.heap[j + 1], s.heap[j], s.depth) && j++, 
                !smaller(tree, v, s.heap[j], s.depth)); ) s.heap[k] = s.heap[j], k = j, j <<= 1;
                s.heap[k] = v;
            }
            function compress_block(s, ltree, dtree) {
                var dist, lc, code, extra, lx = 0;
                if (0 !== s.last_lit) for (;dist = s.pending_buf[s.d_buf + 2 * lx] << 8 | s.pending_buf[s.d_buf + 2 * lx + 1], 
                lc = s.pending_buf[s.l_buf + lx], lx++, 0 === dist ? send_code(s, lc, ltree) : (send_code(s, (code = _length_code[lc]) + LITERALS + 1, ltree), 
                0 !== (extra = extra_lbits[code]) && send_bits(s, lc -= base_length[code], extra), 
                send_code(s, code = d_code(--dist), dtree), 0 !== (extra = extra_dbits[code]) && send_bits(s, dist -= base_dist[code], extra)), 
                lx < s.last_lit; ) ;
                send_code(s, END_BLOCK, ltree);
            }
            function build_tree(s, desc) {
                var n, m, node, tree = desc.dyn_tree, stree = desc.stat_desc.static_tree, has_stree = desc.stat_desc.has_stree, elems = desc.stat_desc.elems, max_code = -1;
                for (s.heap_len = 0, s.heap_max = HEAP_SIZE, n = 0; n < elems; n++) 0 !== tree[2 * n] ? (s.heap[++s.heap_len] = max_code = n, 
                s.depth[n] = 0) : tree[2 * n + 1] = 0;
                for (;s.heap_len < 2; ) tree[2 * (node = s.heap[++s.heap_len] = max_code < 2 ? ++max_code : 0)] = 1, 
                s.depth[node] = 0, s.opt_len--, has_stree && (s.static_len -= stree[2 * node + 1]);
                for (desc.max_code = max_code, n = s.heap_len >> 1; 1 <= n; n--) pqdownheap(s, tree, n);
                for (node = elems; n = s.heap[1], s.heap[1] = s.heap[s.heap_len--], pqdownheap(s, tree, 1), 
                m = s.heap[1], s.heap[--s.heap_max] = n, s.heap[--s.heap_max] = m, tree[2 * node] = tree[2 * n] + tree[2 * m], 
                s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1, tree[2 * n + 1] = tree[2 * m + 1] = node, 
                s.heap[1] = node++, pqdownheap(s, tree, 1), 2 <= s.heap_len; ) ;
                s.heap[--s.heap_max] = s.heap[1], function(s, desc) {
                    var h, n, m, bits, xbits, f, tree = desc.dyn_tree, max_code = desc.max_code, stree = desc.stat_desc.static_tree, has_stree = desc.stat_desc.has_stree, extra = desc.stat_desc.extra_bits, base = desc.stat_desc.extra_base, max_length = desc.stat_desc.max_length, overflow = 0;
                    for (bits = 0; bits <= MAX_BITS; bits++) s.bl_count[bits] = 0;
                    for (tree[2 * s.heap[s.heap_max] + 1] = 0, h = s.heap_max + 1; h < HEAP_SIZE; h++) max_length < (bits = tree[2 * tree[2 * (n = s.heap[h]) + 1] + 1] + 1) && (bits = max_length, 
                    overflow++), tree[2 * n + 1] = bits, max_code < n || (s.bl_count[bits]++, xbits = 0, 
                    base <= n && (xbits = extra[n - base]), f = tree[2 * n], s.opt_len += f * (bits + xbits), 
                    has_stree && (s.static_len += f * (stree[2 * n + 1] + xbits)));
                    if (0 !== overflow) {
                        do {
                            for (bits = max_length - 1; 0 === s.bl_count[bits]; ) bits--;
                            s.bl_count[bits]--, s.bl_count[bits + 1] += 2, s.bl_count[max_length]--, overflow -= 2;
                        } while (0 < overflow);
                        for (bits = max_length; 0 !== bits; bits--) for (n = s.bl_count[bits]; 0 !== n; ) max_code < (m = s.heap[--h]) || (tree[2 * m + 1] !== bits && (s.opt_len += (bits - tree[2 * m + 1]) * tree[2 * m], 
                        tree[2 * m + 1] = bits), n--);
                    }
                }(s, desc), gen_codes(tree, max_code, s.bl_count);
            }
            function scan_tree(s, tree, max_code) {
                var n, curlen, prevlen = -1, nextlen = tree[1], count = 0, max_count = 7, min_count = 4;
                for (0 === nextlen && (max_count = 138, min_count = 3), tree[2 * (max_code + 1) + 1] = 65535, 
                n = 0; n <= max_code; n++) curlen = nextlen, nextlen = tree[2 * (n + 1) + 1], ++count < max_count && curlen === nextlen || (count < min_count ? s.bl_tree[2 * curlen] += count : 0 !== curlen ? (curlen !== prevlen && s.bl_tree[2 * curlen]++, 
                s.bl_tree[2 * REP_3_6]++) : count <= 10 ? s.bl_tree[2 * REPZ_3_10]++ : s.bl_tree[2 * REPZ_11_138]++, 
                prevlen = curlen, (count = 0) === nextlen ? (max_count = 138, min_count = 3) : curlen === nextlen ? (max_count = 6, 
                min_count = 3) : (max_count = 7, min_count = 4));
            }
            function send_tree(s, tree, max_code) {
                var n, curlen, prevlen = -1, nextlen = tree[1], count = 0, max_count = 7, min_count = 4;
                for (0 === nextlen && (max_count = 138, min_count = 3), n = 0; n <= max_code; n++) if (curlen = nextlen, 
                nextlen = tree[2 * (n + 1) + 1], !(++count < max_count && curlen === nextlen)) {
                    if (count < min_count) for (;send_code(s, curlen, s.bl_tree), 0 != --count; ) ; else 0 !== curlen ? (curlen !== prevlen && (send_code(s, curlen, s.bl_tree), 
                    count--), send_code(s, REP_3_6, s.bl_tree), send_bits(s, count - 3, 2)) : count <= 10 ? (send_code(s, REPZ_3_10, s.bl_tree), 
                    send_bits(s, count - 3, 3)) : (send_code(s, REPZ_11_138, s.bl_tree), send_bits(s, count - 11, 7));
                    prevlen = curlen, (count = 0) === nextlen ? (max_count = 138, min_count = 3) : curlen === nextlen ? (max_count = 6, 
                    min_count = 3) : (max_count = 7, min_count = 4);
                }
            }
            zero(base_dist);
            var static_init_done = !1;
            function _tr_stored_block(s, buf, stored_len, last) {
                send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3), function(s, buf, len, header) {
                    bi_windup(s), header && (put_short(s, len), put_short(s, ~len)), utils.arraySet(s.pending_buf, s.window, buf, len, s.pending), 
                    s.pending += len;
                }(s, buf, stored_len, !0);
            }
            exports._tr_init = function(s) {
                static_init_done || (function() {
                    var n, bits, length, code, dist, bl_count = new Array(MAX_BITS + 1);
                    for (code = length = 0; code < LENGTH_CODES - 1; code++) for (base_length[code] = length, 
                    n = 0; n < 1 << extra_lbits[code]; n++) _length_code[length++] = code;
                    for (_length_code[length - 1] = code, code = dist = 0; code < 16; code++) for (base_dist[code] = dist, 
                    n = 0; n < 1 << extra_dbits[code]; n++) _dist_code[dist++] = code;
                    for (dist >>= 7; code < D_CODES; code++) for (base_dist[code] = dist << 7, n = 0; n < 1 << extra_dbits[code] - 7; n++) _dist_code[256 + dist++] = code;
                    for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
                    for (n = 0; n <= 143; ) static_ltree[2 * n + 1] = 8, n++, bl_count[8]++;
                    for (;n <= 255; ) static_ltree[2 * n + 1] = 9, n++, bl_count[9]++;
                    for (;n <= 279; ) static_ltree[2 * n + 1] = 7, n++, bl_count[7]++;
                    for (;n <= 287; ) static_ltree[2 * n + 1] = 8, n++, bl_count[8]++;
                    for (gen_codes(static_ltree, L_CODES + 1, bl_count), n = 0; n < D_CODES; n++) static_dtree[2 * n + 1] = 5, 
                    static_dtree[2 * n] = bi_reverse(n, 5);
                    static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS), 
                    static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS), 
                    static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS);
                }(), static_init_done = !0), s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc), 
                s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc), s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc), 
                s.bi_buf = 0, s.bi_valid = 0, init_block(s);
            }, exports._tr_stored_block = _tr_stored_block, exports._tr_flush_block = function(s, buf, stored_len, last) {
                var opt_lenb, static_lenb, max_blindex = 0;
                0 < s.level ? (s.strm.data_type === Z_UNKNOWN && (s.strm.data_type = function(s) {
                    var n, black_mask = 4093624447;
                    for (n = 0; n <= 31; n++, black_mask >>>= 1) if (1 & black_mask && 0 !== s.dyn_ltree[2 * n]) return Z_BINARY;
                    if (0 !== s.dyn_ltree[18] || 0 !== s.dyn_ltree[20] || 0 !== s.dyn_ltree[26]) return Z_TEXT;
                    for (n = 32; n < LITERALS; n++) if (0 !== s.dyn_ltree[2 * n]) return Z_TEXT;
                    return Z_BINARY;
                }(s)), build_tree(s, s.l_desc), build_tree(s, s.d_desc), max_blindex = function(s) {
                    var max_blindex;
                    for (scan_tree(s, s.dyn_ltree, s.l_desc.max_code), scan_tree(s, s.dyn_dtree, s.d_desc.max_code), 
                    build_tree(s, s.bl_desc), max_blindex = BL_CODES - 1; 3 <= max_blindex && 0 === s.bl_tree[2 * bl_order[max_blindex] + 1]; max_blindex--) ;
                    return s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4, max_blindex;
                }(s), opt_lenb = s.opt_len + 3 + 7 >>> 3, (static_lenb = s.static_len + 3 + 7 >>> 3) <= opt_lenb && (opt_lenb = static_lenb)) : opt_lenb = static_lenb = stored_len + 5, 
                stored_len + 4 <= opt_lenb && -1 !== buf ? _tr_stored_block(s, buf, stored_len, last) : s.strategy === Z_FIXED || static_lenb === opt_lenb ? (send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3), 
                compress_block(s, static_ltree, static_dtree)) : (send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3), 
                function(s, lcodes, dcodes, blcodes) {
                    var rank;
                    for (send_bits(s, lcodes - 257, 5), send_bits(s, dcodes - 1, 5), send_bits(s, blcodes - 4, 4), 
                    rank = 0; rank < blcodes; rank++) send_bits(s, s.bl_tree[2 * bl_order[rank] + 1], 3);
                    send_tree(s, s.dyn_ltree, lcodes - 1), send_tree(s, s.dyn_dtree, dcodes - 1);
                }(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1), compress_block(s, s.dyn_ltree, s.dyn_dtree)), 
                init_block(s), last && bi_windup(s);
            }, exports._tr_tally = function(s, dist, lc) {
                return s.pending_buf[s.d_buf + 2 * s.last_lit] = dist >>> 8 & 255, s.pending_buf[s.d_buf + 2 * s.last_lit + 1] = 255 & dist, 
                s.pending_buf[s.l_buf + s.last_lit] = 255 & lc, s.last_lit++, 0 === dist ? s.dyn_ltree[2 * lc]++ : (s.matches++, 
                dist--, s.dyn_ltree[2 * (_length_code[lc] + LITERALS + 1)]++, s.dyn_dtree[2 * d_code(dist)]++), 
                s.last_lit === s.lit_bufsize - 1;
            }, exports._tr_align = function(s) {
                send_bits(s, STATIC_TREES << 1, 3), send_code(s, END_BLOCK, static_ltree), function(s) {
                    16 === s.bi_valid ? (put_short(s, s.bi_buf), s.bi_buf = 0, s.bi_valid = 0) : 8 <= s.bi_valid && (s.pending_buf[s.pending++] = 255 & s.bi_buf, 
                    s.bi_buf >>= 8, s.bi_valid -= 8);
                }(s);
            };
        }, {
            "../utils/common": 200
        } ],
        212: [ function(require, module, exports) {
            "use strict";
            module.exports = function() {
                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;
            };
        }, {} ],
        213: [ function(require, module, exports) {
            module.exports = {
                "2.16.840.1.101.3.4.1.1": "aes-128-ecb",
                "2.16.840.1.101.3.4.1.2": "aes-128-cbc",
                "2.16.840.1.101.3.4.1.3": "aes-128-ofb",
                "2.16.840.1.101.3.4.1.4": "aes-128-cfb",
                "2.16.840.1.101.3.4.1.21": "aes-192-ecb",
                "2.16.840.1.101.3.4.1.22": "aes-192-cbc",
                "2.16.840.1.101.3.4.1.23": "aes-192-ofb",
                "2.16.840.1.101.3.4.1.24": "aes-192-cfb",
                "2.16.840.1.101.3.4.1.41": "aes-256-ecb",
                "2.16.840.1.101.3.4.1.42": "aes-256-cbc",
                "2.16.840.1.101.3.4.1.43": "aes-256-ofb",
                "2.16.840.1.101.3.4.1.44": "aes-256-cfb"
            };
        }, {} ],
        214: [ function(require, module, exports) {
            "use strict";
            var asn1 = require("asn1.js");
            exports.certificate = require("./certificate");
            var RSAPrivateKey = asn1.define("RSAPrivateKey", function() {
                this.seq().obj(this.key("version").int(), this.key("modulus").int(), this.key("publicExponent").int(), this.key("privateExponent").int(), this.key("prime1").int(), this.key("prime2").int(), this.key("exponent1").int(), this.key("exponent2").int(), this.key("coefficient").int());
            });
            exports.RSAPrivateKey = RSAPrivateKey;
            var RSAPublicKey = asn1.define("RSAPublicKey", function() {
                this.seq().obj(this.key("modulus").int(), this.key("publicExponent").int());
            });
            exports.RSAPublicKey = RSAPublicKey;
            var PublicKey = asn1.define("SubjectPublicKeyInfo", function() {
                this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier), this.key("subjectPublicKey").bitstr());
            });
            exports.PublicKey = PublicKey;
            var AlgorithmIdentifier = asn1.define("AlgorithmIdentifier", function() {
                this.seq().obj(this.key("algorithm").objid(), this.key("none").null_().optional(), this.key("curve").objid().optional(), this.key("params").seq().obj(this.key("p").int(), this.key("q").int(), this.key("g").int()).optional());
            }), PrivateKeyInfo = asn1.define("PrivateKeyInfo", function() {
                this.seq().obj(this.key("version").int(), this.key("algorithm").use(AlgorithmIdentifier), this.key("subjectPrivateKey").octstr());
            });
            exports.PrivateKey = PrivateKeyInfo;
            var EncryptedPrivateKeyInfo = asn1.define("EncryptedPrivateKeyInfo", function() {
                this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(), this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(), this.key("kdeparams").seq().obj(this.key("salt").octstr(), this.key("iters").int())), this.key("cipher").seq().obj(this.key("algo").objid(), this.key("iv").octstr()))), this.key("subjectPrivateKey").octstr());
            });
            exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo;
            var DSAPrivateKey = asn1.define("DSAPrivateKey", function() {
                this.seq().obj(this.key("version").int(), this.key("p").int(), this.key("q").int(), this.key("g").int(), this.key("pub_key").int(), this.key("priv_key").int());
            });
            exports.DSAPrivateKey = DSAPrivateKey, exports.DSAparam = asn1.define("DSAparam", function() {
                this.int();
            });
            var ECPrivateKey = asn1.define("ECPrivateKey", function() {
                this.seq().obj(this.key("version").int(), this.key("privateKey").octstr(), this.key("parameters").optional().explicit(0).use(ECParameters), this.key("publicKey").optional().explicit(1).bitstr());
            });
            exports.ECPrivateKey = ECPrivateKey;
            var ECParameters = asn1.define("ECParameters", function() {
                this.choice({
                    namedCurve: this.objid()
                });
            });
            exports.signature = asn1.define("signature", function() {
                this.seq().obj(this.key("r").int(), this.key("s").int());
            });
        }, {
            "./certificate": 215,
            "asn1.js": 27
        } ],
        215: [ function(require, module, exports) {
            "use strict";
            var asn = require("asn1.js"), Time = asn.define("Time", function() {
                this.choice({
                    utcTime: this.utctime(),
                    generalTime: this.gentime()
                });
            }), AttributeTypeValue = asn.define("AttributeTypeValue", function() {
                this.seq().obj(this.key("type").objid(), this.key("value").any());
            }), AlgorithmIdentifier = asn.define("AlgorithmIdentifier", function() {
                this.seq().obj(this.key("algorithm").objid(), this.key("parameters").optional());
            }), SubjectPublicKeyInfo = asn.define("SubjectPublicKeyInfo", function() {
                this.seq().obj(this.key("algorithm").use(AlgorithmIdentifier), this.key("subjectPublicKey").bitstr());
            }), RelativeDistinguishedName = asn.define("RelativeDistinguishedName", function() {
                this.setof(AttributeTypeValue);
            }), RDNSequence = asn.define("RDNSequence", function() {
                this.seqof(RelativeDistinguishedName);
            }), Name = asn.define("Name", function() {
                this.choice({
                    rdnSequence: this.use(RDNSequence)
                });
            }), Validity = asn.define("Validity", function() {
                this.seq().obj(this.key("notBefore").use(Time), this.key("notAfter").use(Time));
            }), Extension = asn.define("Extension", function() {
                this.seq().obj(this.key("extnID").objid(), this.key("critical").bool().def(!1), this.key("extnValue").octstr());
            }), TBSCertificate = asn.define("TBSCertificate", function() {
                this.seq().obj(this.key("version").explicit(0).int(), this.key("serialNumber").int(), this.key("signature").use(AlgorithmIdentifier), this.key("issuer").use(Name), this.key("validity").use(Validity), this.key("subject").use(Name), this.key("subjectPublicKeyInfo").use(SubjectPublicKeyInfo), this.key("issuerUniqueID").implicit(1).bitstr().optional(), this.key("subjectUniqueID").implicit(2).bitstr().optional(), this.key("extensions").explicit(3).seqof(Extension).optional());
            }), X509Certificate = asn.define("X509Certificate", function() {
                this.seq().obj(this.key("tbsCertificate").use(TBSCertificate), this.key("signatureAlgorithm").use(AlgorithmIdentifier), this.key("signatureValue").bitstr());
            });
            module.exports = X509Certificate;
        }, {
            "asn1.js": 27
        } ],
        216: [ function(require, module, exports) {
            (function(Buffer) {
                var findProc = /Proc-Type: 4,ENCRYPTED\n\r?DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\n\r?\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?/m, startRegex = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n/m, fullRegex = /^-----BEGIN ((?:.* KEY)|CERTIFICATE)-----\n\r?([0-9A-z\n\r\+\/\=]+)\n\r?-----END \1-----$/m, evp = require("evp_bytestokey"), ciphers = require("browserify-aes");
                module.exports = function(okey, password) {
                    var decrypted, key = okey.toString(), match = key.match(findProc);
                    if (match) {
                        var suite = "aes" + match[1], iv = new Buffer(match[2], "hex"), cipherText = new Buffer(match[3].replace(/\r?\n/g, ""), "base64"), cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key, out = [], cipher = ciphers.createDecipheriv(suite, cipherKey, iv);
                        out.push(cipher.update(cipherText)), out.push(cipher.final()), decrypted = Buffer.concat(out);
                    } else {
                        var match2 = key.match(fullRegex);
                        decrypted = new Buffer(match2[2].replace(/\r?\n/g, ""), "base64");
                    }
                    return {
                        tag: key.match(startRegex)[1],
                        data: decrypted
                    };
                };
            }).call(this, require("buffer").Buffer);
        }, {
            "browserify-aes": 47,
            buffer: 77,
            evp_bytestokey: 135
        } ],
        217: [ function(require, module, exports) {
            (function(Buffer) {
                var asn1 = require("./asn1"), aesid = require("./aesid.json"), fixProc = require("./fixProc"), ciphers = require("browserify-aes"), compat = require("pbkdf2");
                function parseKeys(buffer) {
                    var password;
                    "object" != typeof buffer || Buffer.isBuffer(buffer) || (password = buffer.passphrase, 
                    buffer = buffer.key), "string" == typeof buffer && (buffer = new Buffer(buffer));
                    var subtype, ndata, stripped = fixProc(buffer, password), type = stripped.tag, data = stripped.data;
                    switch (type) {
                      case "CERTIFICATE":
                        ndata = asn1.certificate.decode(data, "der").tbsCertificate.subjectPublicKeyInfo;

                      case "PUBLIC KEY":
                        switch (ndata || (ndata = asn1.PublicKey.decode(data, "der")), subtype = ndata.algorithm.algorithm.join(".")) {
                          case "1.2.840.113549.1.1.1":
                            return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, "der");

                          case "1.2.840.10045.2.1":
                            return ndata.subjectPrivateKey = ndata.subjectPublicKey, {
                                type: "ec",
                                data: ndata
                            };

                          case "1.2.840.10040.4.1":
                            return ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, "der"), 
                            {
                                type: "dsa",
                                data: ndata.algorithm.params
                            };

                          default:
                            throw new Error("unknown key id " + subtype);
                        }
                        throw new Error("unknown key type " + type);

                      case "ENCRYPTED PRIVATE KEY":
                        data = function(data, password) {
                            var salt = data.algorithm.decrypt.kde.kdeparams.salt, iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10), algo = aesid[data.algorithm.decrypt.cipher.algo.join(".")], iv = data.algorithm.decrypt.cipher.iv, cipherText = data.subjectPrivateKey, keylen = parseInt(algo.split("-")[1], 10) / 8, key = compat.pbkdf2Sync(password, salt, iters, keylen), cipher = ciphers.createDecipheriv(algo, key, iv), out = [];
                            return out.push(cipher.update(cipherText)), out.push(cipher.final()), Buffer.concat(out);
                        }(data = asn1.EncryptedPrivateKey.decode(data, "der"), password);

                      case "PRIVATE KEY":
                        switch (subtype = (ndata = asn1.PrivateKey.decode(data, "der")).algorithm.algorithm.join(".")) {
                          case "1.2.840.113549.1.1.1":
                            return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, "der");

                          case "1.2.840.10045.2.1":
                            return {
                                curve: ndata.algorithm.curve,
                                privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, "der").privateKey
                            };

                          case "1.2.840.10040.4.1":
                            return ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, "der"), 
                            {
                                type: "dsa",
                                params: ndata.algorithm.params
                            };

                          default:
                            throw new Error("unknown key id " + subtype);
                        }
                        throw new Error("unknown key type " + type);

                      case "RSA PUBLIC KEY":
                        return asn1.RSAPublicKey.decode(data, "der");

                      case "RSA PRIVATE KEY":
                        return asn1.RSAPrivateKey.decode(data, "der");

                      case "DSA PRIVATE KEY":
                        return {
                            type: "dsa",
                            params: asn1.DSAPrivateKey.decode(data, "der")
                        };

                      case "EC PRIVATE KEY":
                        return {
                            curve: (data = asn1.ECPrivateKey.decode(data, "der")).parameters.value,
                            privateKey: data.privateKey
                        };

                      default:
                        throw new Error("unknown key type " + type);
                    }
                }
                (module.exports = parseKeys).signature = asn1.signature;
            }).call(this, require("buffer").Buffer);
        }, {
            "./aesid.json": 213,
            "./asn1": 214,
            "./fixProc": 216,
            "browserify-aes": 47,
            buffer: 77,
            pbkdf2: 218
        } ],
        218: [ function(require, module, exports) {
            exports.pbkdf2 = require("./lib/async"), exports.pbkdf2Sync = require("./lib/sync");
        }, {
            "./lib/async": 219,
            "./lib/sync": 222
        } ],
        219: [ function(require, module, exports) {
            (function(process, global) {
                var ZERO_BUF, checkParameters = require("./precondition"), defaultEncoding = require("./default-encoding"), sync = require("./sync"), Buffer = require("safe-buffer").Buffer, subtle = global.crypto && global.crypto.subtle, toBrowser = {
                    sha: "SHA-1",
                    "sha-1": "SHA-1",
                    sha1: "SHA-1",
                    sha256: "SHA-256",
                    "sha-256": "SHA-256",
                    sha384: "SHA-384",
                    "sha-384": "SHA-384",
                    "sha-512": "SHA-512",
                    sha512: "SHA-512"
                }, checks = [];
                function browserPbkdf2(password, salt, iterations, length, algo) {
                    return subtle.importKey("raw", password, {
                        name: "PBKDF2"
                    }, !1, [ "deriveBits" ]).then(function(key) {
                        return subtle.deriveBits({
                            name: "PBKDF2",
                            salt: salt,
                            iterations: iterations,
                            hash: {
                                name: algo
                            }
                        }, key, length << 3);
                    }).then(function(res) {
                        return Buffer.from(res);
                    });
                }
                module.exports = function(password, salt, iterations, keylen, digest, callback) {
                    if (Buffer.isBuffer(password) || (password = Buffer.from(password, defaultEncoding)), 
                    Buffer.isBuffer(salt) || (salt = Buffer.from(salt, defaultEncoding)), checkParameters(iterations, keylen), 
                    "function" == typeof digest && (callback = digest, digest = void 0), "function" != typeof callback) throw new Error("No callback provided to pbkdf2");
                    var algo = toBrowser[(digest = digest || "sha1").toLowerCase()];
                    if (!algo || "function" != typeof global.Promise) return process.nextTick(function() {
                        var out;
                        try {
                            out = sync(password, salt, iterations, keylen, digest);
                        } catch (e) {
                            return callback(e);
                        }
                        callback(null, out);
                    });
                    !function(promise, callback) {
                        promise.then(function(out) {
                            process.nextTick(function() {
                                callback(null, out);
                            });
                        }, function(e) {
                            process.nextTick(function() {
                                callback(e);
                            });
                        });
                    }(function(algo) {
                        if (global.process && !global.process.browser) return Promise.resolve(!1);
                        if (!subtle || !subtle.importKey || !subtle.deriveBits) return Promise.resolve(!1);
                        if (void 0 !== checks[algo]) return checks[algo];
                        var prom = browserPbkdf2(ZERO_BUF = ZERO_BUF || Buffer.alloc(8), ZERO_BUF, 10, 128, algo).then(function() {
                            return !0;
                        }).catch(function() {
                            return !1;
                        });
                        return checks[algo] = prom;
                    }(algo).then(function(resp) {
                        return resp ? browserPbkdf2(password, salt, iterations, keylen, algo) : sync(password, salt, iterations, keylen, digest);
                    }), callback);
                };
            }).call(this, require("_process"), "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
        }, {
            "./default-encoding": 220,
            "./precondition": 221,
            "./sync": 222,
            _process: 224,
            "safe-buffer": 244
        } ],
        220: [ function(require, module, exports) {
            (function(process) {
                var defaultEncoding;
                process.browser ? defaultEncoding = "utf-8" : defaultEncoding = 6 <= parseInt(process.version.split(".")[0].slice(1), 10) ? "utf-8" : "binary";
                module.exports = defaultEncoding;
            }).call(this, require("_process"));
        }, {
            _process: 224
        } ],
        221: [ function(require, module, exports) {
            var MAX_ALLOC = Math.pow(2, 30) - 1;
            module.exports = function(iterations, keylen) {
                if ("number" != typeof iterations) throw new TypeError("Iterations not a number");
                if (iterations < 0) throw new TypeError("Bad iterations");
                if ("number" != typeof keylen) throw new TypeError("Key length not a number");
                if (keylen < 0 || MAX_ALLOC < keylen || keylen != keylen) throw new TypeError("Bad key length");
            };
        }, {} ],
        222: [ function(require, module, exports) {
            var md5 = require("create-hash/md5"), rmd160 = require("ripemd160"), sha = require("sha.js"), checkParameters = require("./precondition"), defaultEncoding = require("./default-encoding"), Buffer = require("safe-buffer").Buffer, ZEROS = Buffer.alloc(128), sizes = {
                md5: 16,
                sha1: 20,
                sha224: 28,
                sha256: 32,
                sha384: 48,
                sha512: 64,
                rmd160: 20,
                ripemd160: 20
            };
            function Hmac(alg, key, saltLen) {
                var hash = function(alg) {
                    return "rmd160" === alg || "ripemd160" === alg ? rmd160 : "md5" === alg ? md5 : function(data) {
                        return sha(alg).update(data).digest();
                    };
                }(alg), blocksize = "sha512" === alg || "sha384" === alg ? 128 : 64;
                key.length > blocksize ? key = hash(key) : key.length < blocksize && (key = Buffer.concat([ key, ZEROS ], blocksize));
                for (var ipad = Buffer.allocUnsafe(blocksize + sizes[alg]), opad = Buffer.allocUnsafe(blocksize + sizes[alg]), i = 0; i < blocksize; i++) ipad[i] = 54 ^ key[i], 
                opad[i] = 92 ^ key[i];
                var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4);
                ipad.copy(ipad1, 0, 0, blocksize), this.ipad1 = ipad1, this.ipad2 = ipad, this.opad = opad, 
                this.alg = alg, this.blocksize = blocksize, this.hash = hash, this.size = sizes[alg];
            }
            Hmac.prototype.run = function(data, ipad) {
                return data.copy(ipad, this.blocksize), this.hash(ipad).copy(this.opad, this.blocksize), 
                this.hash(this.opad);
            }, module.exports = function(password, salt, iterations, keylen, digest) {
                Buffer.isBuffer(password) || (password = Buffer.from(password, defaultEncoding)), 
                Buffer.isBuffer(salt) || (salt = Buffer.from(salt, defaultEncoding)), checkParameters(iterations, keylen);
                var hmac = new Hmac(digest = digest || "sha1", password, salt.length), DK = Buffer.allocUnsafe(keylen), block1 = Buffer.allocUnsafe(salt.length + 4);
                salt.copy(block1, 0, 0, salt.length);
                for (var destPos = 0, hLen = sizes[digest], l = Math.ceil(keylen / hLen), i = 1; i <= l; i++) {
                    block1.writeUInt32BE(i, salt.length);
                    for (var T = hmac.run(block1, hmac.ipad1), U = T, j = 1; j < iterations; j++) {
                        U = hmac.run(U, hmac.ipad2);
                        for (var k = 0; k < hLen; k++) T[k] ^= U[k];
                    }
                    T.copy(DK, destPos), destPos += hLen;
                }
                return DK;
            };
        }, {
            "./default-encoding": 220,
            "./precondition": 221,
            "create-hash/md5": 105,
            ripemd160: 243,
            "safe-buffer": 244,
            "sha.js": 247
        } ],
        223: [ function(require, module, exports) {
            (function(process) {
                "use strict";
                !process.version || 0 === process.version.indexOf("v0.") || 0 === process.version.indexOf("v1.") && 0 !== process.version.indexOf("v1.8.") ? module.exports = function(fn, arg1, arg2, arg3) {
                    if ("function" != typeof fn) throw new TypeError('"callback" argument must be a function');
                    var args, i, len = arguments.length;
                    switch (len) {
                      case 0:
                      case 1:
                        return process.nextTick(fn);

                      case 2:
                        return process.nextTick(function() {
                            fn.call(null, arg1);
                        });

                      case 3:
                        return process.nextTick(function() {
                            fn.call(null, arg1, arg2);
                        });

                      case 4:
                        return process.nextTick(function() {
                            fn.call(null, arg1, arg2, arg3);
                        });

                      default:
                        for (args = new Array(len - 1), i = 0; i < args.length; ) args[i++] = arguments[i];
                        return process.nextTick(function() {
                            fn.apply(null, args);
                        });
                    }
                } : module.exports = process.nextTick;
            }).call(this, require("_process"));
        }, {
            _process: 224
        } ],
        224: [ function(require, module, exports) {
            var cachedSetTimeout, cachedClearTimeout, process = module.exports = {};
            function defaultSetTimout() {
                throw new Error("setTimeout has not been defined");
            }
            function defaultClearTimeout() {
                throw new Error("clearTimeout has not been defined");
            }
            function runTimeout(fun) {
                if (cachedSetTimeout === setTimeout) return setTimeout(fun, 0);
                if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) return cachedSetTimeout = setTimeout, 
                setTimeout(fun, 0);
                try {
                    return cachedSetTimeout(fun, 0);
                } catch (e) {
                    try {
                        return cachedSetTimeout.call(null, fun, 0);
                    } catch (e) {
                        return cachedSetTimeout.call(this, fun, 0);
                    }
                }
            }
            !function() {
                try {
                    cachedSetTimeout = "function" == typeof setTimeout ? setTimeout : defaultSetTimout;
                } catch (e) {
                    cachedSetTimeout = defaultSetTimout;
                }
                try {
                    cachedClearTimeout = "function" == typeof clearTimeout ? clearTimeout : defaultClearTimeout;
                } catch (e) {
                    cachedClearTimeout = defaultClearTimeout;
                }
            }();
            var currentQueue, queue = [], draining = !1, queueIndex = -1;
            function cleanUpNextTick() {
                draining && currentQueue && (draining = !1, currentQueue.length ? queue = currentQueue.concat(queue) : queueIndex = -1, 
                queue.length && drainQueue());
            }
            function drainQueue() {
                if (!draining) {
                    var timeout = runTimeout(cleanUpNextTick);
                    draining = !0;
                    for (var len = queue.length; len; ) {
                        for (currentQueue = queue, queue = []; ++queueIndex < len; ) currentQueue && currentQueue[queueIndex].run();
                        queueIndex = -1, len = queue.length;
                    }
                    currentQueue = null, draining = !1, function(marker) {
                        if (cachedClearTimeout === clearTimeout) return clearTimeout(marker);
                        if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) return cachedClearTimeout = clearTimeout, 
                        clearTimeout(marker);
                        try {
                            cachedClearTimeout(marker);
                        } catch (e) {
                            try {
                                return cachedClearTimeout.call(null, marker);
                            } catch (e) {
                                return cachedClearTimeout.call(this, marker);
                            }
                        }
                    }(timeout);
                }
            }
            function Item(fun, array) {
                this.fun = fun, this.array = array;
            }
            function noop() {}
            process.nextTick = function(fun) {
                var args = new Array(arguments.length - 1);
                if (1 < arguments.length) for (var i = 1; i < arguments.length; i++) args[i - 1] = arguments[i];
                queue.push(new Item(fun, args)), 1 !== queue.length || draining || runTimeout(drainQueue);
            }, Item.prototype.run = function() {
                this.fun.apply(null, this.array);
            }, process.title = "browser", process.browser = !0, process.env = {}, process.argv = [], 
            process.version = "", process.versions = {}, process.on = noop, process.addListener = noop, 
            process.once = noop, process.off = noop, process.removeListener = noop, process.removeAllListeners = noop, 
            process.emit = noop, process.prependListener = noop, process.prependOnceListener = noop, 
            process.listeners = function(name) {
                return [];
            }, 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;
            };
        }, {} ],
        225: [ function(require, module, exports) {
            exports.publicEncrypt = require("./publicEncrypt"), exports.privateDecrypt = require("./privateDecrypt"), 
            exports.privateEncrypt = function(key, buf) {
                return exports.publicEncrypt(key, buf, !0);
            }, exports.publicDecrypt = function(key, buf) {
                return exports.privateDecrypt(key, buf, !0);
            };
        }, {
            "./privateDecrypt": 227,
            "./publicEncrypt": 228
        } ],
        226: [ function(require, module, exports) {
            (function(Buffer) {
                var createHash = require("create-hash");
                function i2ops(c) {
                    var out = new Buffer(4);
                    return out.writeUInt32BE(c, 0), out;
                }
                module.exports = function(seed, len) {
                    for (var c, t = new Buffer(""), i = 0; t.length < len; ) c = i2ops(i++), t = Buffer.concat([ t, createHash("sha1").update(seed).update(c).digest() ]);
                    return t.slice(0, len);
                };
            }).call(this, require("buffer").Buffer);
        }, {
            buffer: 77,
            "create-hash": 103
        } ],
        227: [ function(require, module, exports) {
            (function(Buffer) {
                var parseKeys = require("parse-asn1"), mgf = require("./mgf"), xor = require("./xor"), bn = require("bn.js"), crt = require("browserify-rsa"), createHash = require("create-hash"), withPublic = require("./withPublic");
                module.exports = function(private_key, enc, reverse) {
                    var padding;
                    padding = private_key.padding ? private_key.padding : reverse ? 1 : 4;
                    var msg, key = parseKeys(private_key), k = key.modulus.byteLength();
                    if (enc.length > k || 0 <= new bn(enc).cmp(key.modulus)) throw new Error("decryption error");
                    msg = reverse ? withPublic(new bn(enc), key) : crt(enc, key);
                    var zBuffer = new Buffer(k - msg.length);
                    if (zBuffer.fill(0), msg = Buffer.concat([ zBuffer, msg ], k), 4 === padding) return function(key, msg) {
                        key.modulus;
                        var k = key.modulus.byteLength(), iHash = (msg.length, createHash("sha1").update(new Buffer("")).digest()), hLen = iHash.length;
                        if (0 !== msg[0]) throw new Error("decryption error");
                        var maskedSeed = msg.slice(1, hLen + 1), maskedDb = msg.slice(hLen + 1), seed = xor(maskedSeed, mgf(maskedDb, hLen)), db = xor(maskedDb, mgf(seed, k - hLen - 1));
                        if (function(a, b) {
                            a = new Buffer(a), b = new Buffer(b);
                            var dif = 0, len = a.length;
                            a.length !== b.length && (dif++, len = Math.min(a.length, b.length));
                            var i = -1;
                            for (;++i < len; ) dif += a[i] ^ b[i];
                            return dif;
                        }(iHash, db.slice(0, hLen))) throw new Error("decryption error");
                        var i = hLen;
                        for (;0 === db[i]; ) i++;
                        if (1 !== db[i++]) throw new Error("decryption error");
                        return db.slice(i);
                    }(key, msg);
                    if (1 === padding) return function(key, msg, reverse) {
                        var p1 = msg.slice(0, 2), i = 2, status = 0;
                        for (;0 !== msg[i++]; ) if (i >= msg.length) {
                            status++;
                            break;
                        }
                        var ps = msg.slice(2, i - 1);
                        msg.slice(i - 1, i);
                        ("0002" !== p1.toString("hex") && !reverse || "0001" !== p1.toString("hex") && reverse) && status++;
                        ps.length < 8 && status++;
                        if (status) throw new Error("decryption error");
                        return msg.slice(i);
                    }(0, msg, reverse);
                    if (3 === padding) return msg;
                    throw new Error("unknown padding");
                };
            }).call(this, require("buffer").Buffer);
        }, {
            "./mgf": 226,
            "./withPublic": 229,
            "./xor": 230,
            "bn.js": 42,
            "browserify-rsa": 65,
            buffer: 77,
            "create-hash": 103,
            "parse-asn1": 217
        } ],
        228: [ function(require, module, exports) {
            (function(Buffer) {
                var parseKeys = require("parse-asn1"), randomBytes = require("randombytes"), createHash = require("create-hash"), mgf = require("./mgf"), xor = require("./xor"), bn = require("bn.js"), withPublic = require("./withPublic"), crt = require("browserify-rsa");
                module.exports = function(public_key, msg, reverse) {
                    var padding;
                    padding = public_key.padding ? public_key.padding : reverse ? 1 : 4;
                    var paddedMsg, key = parseKeys(public_key);
                    if (4 === padding) paddedMsg = function(key, msg) {
                        var k = key.modulus.byteLength(), mLen = msg.length, iHash = createHash("sha1").update(new Buffer("")).digest(), hLen = iHash.length, hLen2 = 2 * hLen;
                        if (k - hLen2 - 2 < mLen) throw new Error("message too long");
                        var ps = new Buffer(k - mLen - hLen2 - 2);
                        ps.fill(0);
                        var dblen = k - hLen - 1, seed = randomBytes(hLen), maskedDb = xor(Buffer.concat([ iHash, ps, new Buffer([ 1 ]), msg ], dblen), mgf(seed, dblen)), maskedSeed = xor(seed, mgf(maskedDb, hLen));
                        return new bn(Buffer.concat([ new Buffer([ 0 ]), maskedSeed, maskedDb ], k));
                    }(key, msg); else if (1 === padding) paddedMsg = function(key, msg, reverse) {
                        var ps, mLen = msg.length, k = key.modulus.byteLength();
                        if (k - 11 < mLen) throw new Error("message too long");
                        reverse ? (ps = new Buffer(k - mLen - 3)).fill(255) : ps = function(len, crypto) {
                            var num, out = new Buffer(len), i = 0, cache = randomBytes(2 * len), cur = 0;
                            for (;i < len; ) cur === cache.length && (cache = randomBytes(2 * len), cur = 0), 
                            (num = cache[cur++]) && (out[i++] = num);
                            return out;
                        }(k - mLen - 3);
                        return new bn(Buffer.concat([ new Buffer([ 0, reverse ? 1 : 2 ]), ps, new Buffer([ 0 ]), msg ], k));
                    }(key, msg, reverse); else {
                        if (3 !== padding) throw new Error("unknown padding");
                        if (0 <= (paddedMsg = new bn(msg)).cmp(key.modulus)) throw new Error("data too long for modulus");
                    }
                    return reverse ? crt(paddedMsg, key) : withPublic(paddedMsg, key);
                };
            }).call(this, require("buffer").Buffer);
        }, {
            "./mgf": 226,
            "./withPublic": 229,
            "./xor": 230,
            "bn.js": 42,
            "browserify-rsa": 65,
            buffer: 77,
            "create-hash": 103,
            "parse-asn1": 217,
            randombytes: 231
        } ],
        229: [ function(require, module, exports) {
            (function(Buffer) {
                var bn = require("bn.js");
                module.exports = function(paddedMsg, key) {
                    return new Buffer(paddedMsg.toRed(bn.mont(key.modulus)).redPow(new bn(key.publicExponent)).fromRed().toArray());
                };
            }).call(this, require("buffer").Buffer);
        }, {
            "bn.js": 42,
            buffer: 77
        } ],
        230: [ function(require, module, exports) {
            module.exports = function(a, b) {
                for (var len = a.length, i = -1; ++i < len; ) a[i] ^= b[i];
                return a;
            };
        }, {} ],
        231: [ function(require, module, exports) {
            (function(process, global) {
                "use strict";
                var Buffer = require("safe-buffer").Buffer, crypto = global.crypto || global.msCrypto;
                crypto && crypto.getRandomValues ? module.exports = function(size, cb) {
                    if (65536 < size) throw new Error("requested too many random bytes");
                    var rawBytes = new global.Uint8Array(size);
                    0 < size && crypto.getRandomValues(rawBytes);
                    var bytes = Buffer.from(rawBytes.buffer);
                    if ("function" == typeof cb) return process.nextTick(function() {
                        cb(null, bytes);
                    });
                    return bytes;
                } : module.exports = function() {
                    throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11");
                };
            }).call(this, require("_process"), "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
        }, {
            _process: 224,
            "safe-buffer": 244
        } ],
        232: [ function(require, module, exports) {
            (function(process, global) {
                "use strict";
                function oldBrowser() {
                    throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11");
                }
                var safeBuffer = require("safe-buffer"), randombytes = require("randombytes"), Buffer = safeBuffer.Buffer, kBufferMaxLength = safeBuffer.kMaxLength, crypto = global.crypto || global.msCrypto, kMaxUint32 = Math.pow(2, 32) - 1;
                function assertOffset(offset, length) {
                    if ("number" != typeof offset || offset != offset) throw new TypeError("offset must be a number");
                    if (kMaxUint32 < offset || offset < 0) throw new TypeError("offset must be a uint32");
                    if (kBufferMaxLength < offset || length < offset) throw new RangeError("offset out of range");
                }
                function assertSize(size, offset, length) {
                    if ("number" != typeof size || size != size) throw new TypeError("size must be a number");
                    if (kMaxUint32 < size || size < 0) throw new TypeError("size must be a uint32");
                    if (length < size + offset || kBufferMaxLength < size) throw new RangeError("buffer too small");
                }
                function actualFill(buf, offset, size, cb) {
                    if (process.browser) {
                        var ourBuf = buf.buffer, uint = new Uint8Array(ourBuf, offset, size);
                        return crypto.getRandomValues(uint), cb ? void process.nextTick(function() {
                            cb(null, buf);
                        }) : buf;
                    }
                    if (!cb) return randombytes(size).copy(buf, offset), buf;
                    randombytes(size, function(err, bytes) {
                        if (err) return cb(err);
                        bytes.copy(buf, offset), cb(null, buf);
                    });
                }
                crypto && crypto.getRandomValues || !process.browser ? (exports.randomFill = function(buf, offset, size, cb) {
                    if (!(Buffer.isBuffer(buf) || buf instanceof global.Uint8Array)) throw new TypeError('"buf" argument must be a Buffer or Uint8Array');
                    if ("function" == typeof offset) cb = offset, offset = 0, size = buf.length; else if ("function" == typeof size) cb = size, 
                    size = buf.length - offset; else if ("function" != typeof cb) throw new TypeError('"cb" argument must be a function');
                    return assertOffset(offset, buf.length), assertSize(size, offset, buf.length), actualFill(buf, offset, size, cb);
                }, exports.randomFillSync = function(buf, offset, size) {
                    void 0 === offset && (offset = 0);
                    if (!(Buffer.isBuffer(buf) || buf instanceof global.Uint8Array)) throw new TypeError('"buf" argument must be a Buffer or Uint8Array');
                    assertOffset(offset, buf.length), void 0 === size && (size = buf.length - offset);
                    return assertSize(size, offset, buf.length), actualFill(buf, offset, size);
                }) : (exports.randomFill = oldBrowser, exports.randomFillSync = oldBrowser);
            }).call(this, require("_process"), "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
        }, {
            _process: 224,
            randombytes: 231,
            "safe-buffer": 244
        } ],
        233: [ function(require, module, exports) {
            module.exports = require("./lib/_stream_duplex.js");
        }, {
            "./lib/_stream_duplex.js": 234
        } ],
        234: [ function(require, module, exports) {
            "use strict";
            var objectKeys = Object.keys || function(obj) {
                var keys = [];
                for (var key in obj) keys.push(key);
                return keys;
            };
            module.exports = Duplex;
            var processNextTick = require("process-nextick-args"), util = require("core-util-is");
            util.inherits = require("inherits");
            var Readable = require("./_stream_readable"), Writable = require("./_stream_writable");
            util.inherits(Duplex, Readable);
            for (var keys = objectKeys(Writable.prototype), v = 0; v < keys.length; v++) {
                var method = keys[v];
                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), options && !1 === options.readable && (this.readable = !1), 
                options && !1 === options.writable && (this.writable = !1), this.allowHalfOpen = !0, 
                options && !1 === options.allowHalfOpen && (this.allowHalfOpen = !1), this.once("end", onend);
            }
            function onend() {
                this.allowHalfOpen || this._writableState.ended || processNextTick(onEndNT, this);
            }
            function onEndNT(self) {
                self.end();
            }
        }, {
            "./_stream_readable": 236,
            "./_stream_writable": 238,
            "core-util-is": 101,
            inherits: 152,
            "process-nextick-args": 223
        } ],
        235: [ function(require, module, exports) {
            "use strict";
            module.exports = PassThrough;
            var Transform = require("./_stream_transform"), util = require("core-util-is");
            function PassThrough(options) {
                if (!(this instanceof PassThrough)) return new PassThrough(options);
                Transform.call(this, options);
            }
            util.inherits = require("inherits"), util.inherits(PassThrough, Transform), PassThrough.prototype._transform = function(chunk, encoding, cb) {
                cb(null, chunk);
            };
        }, {
            "./_stream_transform": 237,
            "core-util-is": 101,
            inherits: 152
        } ],
        236: [ function(require, module, exports) {
            (function(process) {
                "use strict";
                module.exports = Readable;
                var processNextTick = require("process-nextick-args"), isArray = require("isarray"), Buffer = require("buffer").Buffer;
                Readable.ReadableState = ReadableState;
                require("events");
                var Stream, EElistenerCount = function(emitter, type) {
                    return emitter.listeners(type).length;
                };
                !function() {
                    try {
                        Stream = require("stream");
                    } catch (_) {} finally {
                        Stream || (Stream = require("events").EventEmitter);
                    }
                }();
                Buffer = require("buffer").Buffer;
                var util = require("core-util-is");
                util.inherits = require("inherits");
                var StringDecoder, Duplex, debugUtil = require("util"), debug = void 0;
                function ReadableState(options, stream) {
                    Duplex = Duplex || require("./_stream_duplex"), options = options || {}, this.objectMode = !!options.objectMode, 
                    stream instanceof Duplex && (this.objectMode = this.objectMode || !!options.readableObjectMode);
                    var hwm = options.highWaterMark, defaultHwm = this.objectMode ? 16 : 16384;
                    this.highWaterMark = hwm || 0 === hwm ? hwm : defaultHwm, this.highWaterMark = ~~this.highWaterMark, 
                    this.buffer = [], this.length = 0, this.pipes = null, this.pipesCount = 0, this.flowing = null, 
                    this.ended = !1, this.endEmitted = !1, this.reading = !1, this.sync = !0, this.needReadable = !1, 
                    this.emittedReadable = !1, this.readableListening = !1, this.resumeScheduled = !1, 
                    this.defaultEncoding = options.defaultEncoding || "utf8", this.ranOut = !1, this.awaitDrain = 0, 
                    this.readingMore = !1, this.decoder = null, this.encoding = null, options.encoding && (StringDecoder || (StringDecoder = require("string_decoder/").StringDecoder), 
                    this.decoder = new StringDecoder(options.encoding), this.encoding = options.encoding);
                }
                function Readable(options) {
                    if (Duplex = Duplex || require("./_stream_duplex"), !(this instanceof Readable)) return new Readable(options);
                    this._readableState = new ReadableState(options, this), this.readable = !0, options && "function" == typeof options.read && (this._read = options.read), 
                    Stream.call(this);
                }
                function readableAddChunk(stream, state, chunk, encoding, addToFront) {
                    var er = function(state, chunk) {
                        var er = null;
                        Buffer.isBuffer(chunk) || "string" == typeof chunk || null == chunk || state.objectMode || (er = new TypeError("Invalid non-string/buffer chunk"));
                        return er;
                    }(state, chunk);
                    if (er) stream.emit("error", er); else if (null === chunk) state.reading = !1, function(stream, state) {
                        if (state.ended) return;
                        if (state.decoder) {
                            var chunk = state.decoder.end();
                            chunk && chunk.length && (state.buffer.push(chunk), state.length += state.objectMode ? 1 : chunk.length);
                        }
                        state.ended = !0, emitReadable(stream);
                    }(stream, state); else if (state.objectMode || chunk && 0 < chunk.length) if (state.ended && !addToFront) {
                        var e = new Error("stream.push() after EOF");
                        stream.emit("error", e);
                    } else if (state.endEmitted && addToFront) {
                        e = new Error("stream.unshift() after end event");
                        stream.emit("error", e);
                    } else {
                        var skipAdd;
                        !state.decoder || addToFront || encoding || (chunk = state.decoder.write(chunk), 
                        skipAdd = !state.objectMode && 0 === chunk.length), addToFront || (state.reading = !1), 
                        skipAdd || (state.flowing && 0 === state.length && !state.sync ? (stream.emit("data", chunk), 
                        stream.read(0)) : (state.length += state.objectMode ? 1 : chunk.length, addToFront ? state.buffer.unshift(chunk) : state.buffer.push(chunk), 
                        state.needReadable && emitReadable(stream))), function(stream, state) {
                            state.readingMore || (state.readingMore = !0, processNextTick(maybeReadMore_, stream, state));
                        }(stream, state);
                    } else addToFront || (state.reading = !1);
                    return function(state) {
                        return !state.ended && (state.needReadable || state.length < state.highWaterMark || 0 === state.length);
                    }(state);
                }
                debug = debugUtil && debugUtil.debuglog ? debugUtil.debuglog("stream") : function() {}, 
                util.inherits(Readable, Stream), Readable.prototype.push = function(chunk, encoding) {
                    var state = this._readableState;
                    return state.objectMode || "string" != typeof chunk || (encoding = encoding || state.defaultEncoding) !== state.encoding && (chunk = new Buffer(chunk, encoding), 
                    encoding = ""), readableAddChunk(this, state, chunk, encoding, !1);
                }, Readable.prototype.unshift = function(chunk) {
                    return readableAddChunk(this, this._readableState, chunk, "", !0);
                }, Readable.prototype.isPaused = function() {
                    return !1 === this._readableState.flowing;
                }, Readable.prototype.setEncoding = function(enc) {
                    return StringDecoder || (StringDecoder = require("string_decoder/").StringDecoder), 
                    this._readableState.decoder = new StringDecoder(enc), this._readableState.encoding = enc, 
                    this;
                };
                var MAX_HWM = 8388608;
                function howMuchToRead(n, state) {
                    return 0 === state.length && state.ended ? 0 : state.objectMode ? 0 === n ? 0 : 1 : null === n || isNaN(n) ? state.flowing && state.buffer.length ? state.buffer[0].length : state.length : n <= 0 ? 0 : (n > state.highWaterMark && (state.highWaterMark = function(n) {
                        return MAX_HWM <= n ? n = MAX_HWM : (n--, n |= n >>> 1, n |= n >>> 2, n |= n >>> 4, 
                        n |= n >>> 8, n |= n >>> 16, n++), n;
                    }(n)), n > state.length ? state.ended ? state.length : (state.needReadable = !0, 
                    0) : n);
                }
                function emitReadable(stream) {
                    var state = stream._readableState;
                    state.needReadable = !1, state.emittedReadable || (debug("emitReadable", state.flowing), 
                    state.emittedReadable = !0, state.sync ? processNextTick(emitReadable_, stream) : emitReadable_(stream));
                }
                function emitReadable_(stream) {
                    debug("emit readable"), stream.emit("readable"), flow(stream);
                }
                function maybeReadMore_(stream, state) {
                    for (var len = state.length; !state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark && (debug("maybeReadMore read 0"), 
                    stream.read(0), len !== state.length); ) len = state.length;
                    state.readingMore = !1;
                }
                function nReadingNextTick(self) {
                    debug("readable nexttick read 0"), self.read(0);
                }
                function resume_(stream, state) {
                    state.reading || (debug("resume read 0"), stream.read(0)), state.resumeScheduled = !1, 
                    stream.emit("resume"), flow(stream), state.flowing && !state.reading && stream.read(0);
                }
                function flow(stream) {
                    var state = stream._readableState;
                    if (debug("flow", state.flowing), state.flowing) do {
                        var chunk = stream.read();
                    } while (null !== chunk && state.flowing);
                }
                function fromList(n, state) {
                    var ret, list = state.buffer, length = state.length, stringMode = !!state.decoder, objectMode = !!state.objectMode;
                    if (0 === list.length) return null;
                    if (0 === length) ret = null; else if (objectMode) ret = list.shift(); else if (!n || length <= n) ret = stringMode ? list.join("") : 1 === list.length ? list[0] : Buffer.concat(list, length), 
                    list.length = 0; else {
                        if (n < list[0].length) ret = (buf = list[0]).slice(0, n), list[0] = buf.slice(n); else if (n === list[0].length) ret = list.shift(); else {
                            ret = stringMode ? "" : new Buffer(n);
                            for (var c = 0, i = 0, l = list.length; i < l && c < n; i++) {
                                var buf = list[0], cpy = Math.min(n - c, buf.length);
                                stringMode ? ret += buf.slice(0, cpy) : buf.copy(ret, c, 0, cpy), cpy < buf.length ? list[0] = buf.slice(cpy) : list.shift(), 
                                c += cpy;
                            }
                        }
                    }
                    return ret;
                }
                function endReadable(stream) {
                    var state = stream._readableState;
                    if (0 < state.length) throw new Error("endReadable called on non-empty stream");
                    state.endEmitted || (state.ended = !0, processNextTick(endReadableNT, state, stream));
                }
                function endReadableNT(state, stream) {
                    state.endEmitted || 0 !== state.length || (state.endEmitted = !0, stream.readable = !1, 
                    stream.emit("end"));
                }
                Readable.prototype.read = function(n) {
                    debug("read", n);
                    var state = this._readableState, nOrig = n;
                    if (("number" != typeof n || 0 < n) && (state.emittedReadable = !1), 0 === n && state.needReadable && (state.length >= state.highWaterMark || state.ended)) return debug("read: emitReadable", state.length, state.ended), 
                    0 === state.length && state.ended ? endReadable(this) : emitReadable(this), null;
                    if (0 === (n = howMuchToRead(n, state)) && state.ended) return 0 === state.length && endReadable(this), 
                    null;
                    var ret, doRead = state.needReadable;
                    return debug("need readable", doRead), (0 === state.length || state.length - n < state.highWaterMark) && debug("length less than watermark", doRead = !0), 
                    (state.ended || state.reading) && debug("reading or ended", doRead = !1), doRead && (debug("do read"), 
                    state.reading = !0, state.sync = !0, 0 === state.length && (state.needReadable = !0), 
                    this._read(state.highWaterMark), state.sync = !1), doRead && !state.reading && (n = howMuchToRead(nOrig, state)), 
                    null === (ret = 0 < n ? fromList(n, state) : null) && (state.needReadable = !0, 
                    n = 0), state.length -= n, 0 !== state.length || state.ended || (state.needReadable = !0), 
                    nOrig !== n && state.ended && 0 === state.length && endReadable(this), null !== ret && this.emit("data", ret), 
                    ret;
                }, Readable.prototype._read = function(n) {
                    this.emit("error", new Error("not implemented"));
                }, Readable.prototype.pipe = function(dest, pipeOpts) {
                    var src = this, 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);
                    }
                    state.pipesCount += 1, debug("pipe count=%d opts=%j", state.pipesCount, pipeOpts);
                    var endFn = (!pipeOpts || !1 !== pipeOpts.end) && dest !== process.stdout && dest !== process.stderr ? onend : cleanup;
                    function onunpipe(readable) {
                        debug("onunpipe"), readable === src && cleanup();
                    }
                    function onend() {
                        debug("onend"), dest.end();
                    }
                    state.endEmitted ? processNextTick(endFn) : src.once("end", endFn), dest.on("unpipe", onunpipe);
                    var ondrain = function(src) {
                        return function() {
                            var state = src._readableState;
                            debug("pipeOnDrain", state.awaitDrain), state.awaitDrain && state.awaitDrain--, 
                            0 === state.awaitDrain && EElistenerCount(src, "data") && (state.flowing = !0, flow(src));
                        };
                    }(src);
                    dest.on("drain", ondrain);
                    var cleanedUp = !1;
                    function cleanup() {
                        debug("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), src.removeListener("data", ondata), 
                        cleanedUp = !0, !state.awaitDrain || dest._writableState && !dest._writableState.needDrain || ondrain();
                    }
                    function ondata(chunk) {
                        debug("ondata"), !1 === dest.write(chunk) && (1 !== state.pipesCount || state.pipes[0] !== dest || 1 !== src.listenerCount("data") || cleanedUp || (debug("false write response, pause", src._readableState.awaitDrain), 
                        src._readableState.awaitDrain++), src.pause());
                    }
                    function onerror(er) {
                        debug("onerror", er), unpipe(), dest.removeListener("error", onerror), 0 === EElistenerCount(dest, "error") && dest.emit("error", er);
                    }
                    function onclose() {
                        dest.removeListener("finish", onfinish), unpipe();
                    }
                    function onfinish() {
                        debug("onfinish"), dest.removeListener("close", onclose), unpipe();
                    }
                    function unpipe() {
                        debug("unpipe"), src.unpipe(dest);
                    }
                    return src.on("data", ondata), dest._events && dest._events.error ? isArray(dest._events.error) ? dest._events.error.unshift(onerror) : dest._events.error = [ onerror, dest._events.error ] : dest.on("error", onerror), 
                    dest.once("close", onclose), dest.once("finish", onfinish), dest.emit("pipe", src), 
                    state.flowing || (debug("pipe resume"), src.resume()), dest;
                }, Readable.prototype.unpipe = function(dest) {
                    var state = this._readableState;
                    if (0 === state.pipesCount) return this;
                    if (1 === state.pipesCount) return dest && dest !== state.pipes || (dest || (dest = state.pipes), 
                    state.pipes = null, state.pipesCount = 0, state.flowing = !1, dest && dest.emit("unpipe", this)), 
                    this;
                    if (!dest) {
                        var dests = state.pipes, len = state.pipesCount;
                        state.pipes = null, state.pipesCount = 0, state.flowing = !1;
                        for (var _i = 0; _i < len; _i++) dests[_i].emit("unpipe", this);
                        return this;
                    }
                    var i = function(xs, x) {
                        for (var i = 0, l = xs.length; i < l; i++) if (xs[i] === x) return i;
                        return -1;
                    }(state.pipes, dest);
                    return -1 === i || (state.pipes.splice(i, 1), state.pipesCount -= 1, 1 === state.pipesCount && (state.pipes = state.pipes[0]), 
                    dest.emit("unpipe", this)), this;
                }, Readable.prototype.addListener = Readable.prototype.on = function(ev, fn) {
                    var res = Stream.prototype.on.call(this, ev, fn);
                    if ("data" === ev && !1 !== this._readableState.flowing && this.resume(), "readable" === ev && !this._readableState.endEmitted) {
                        var state = this._readableState;
                        state.readableListening || (state.readableListening = !0, state.emittedReadable = !1, 
                        state.needReadable = !0, state.reading ? state.length && emitReadable(this) : processNextTick(nReadingNextTick, this));
                    }
                    return res;
                }, Readable.prototype.resume = function() {
                    var state = this._readableState;
                    return state.flowing || (debug("resume"), state.flowing = !0, function(stream, state) {
                        state.resumeScheduled || (state.resumeScheduled = !0, processNextTick(resume_, stream, state));
                    }(this, state)), this;
                }, Readable.prototype.pause = function() {
                    return debug("call pause flowing=%j", this._readableState.flowing), !1 !== this._readableState.flowing && (debug("pause"), 
                    this._readableState.flowing = !1, this.emit("pause")), this;
                }, Readable.prototype.wrap = function(stream) {
                    var state = this._readableState, paused = !1, self = this;
                    for (var i in stream.on("end", function() {
                        if (debug("wrapped end"), state.decoder && !state.ended) {
                            var chunk = state.decoder.end();
                            chunk && chunk.length && self.push(chunk);
                        }
                        self.push(null);
                    }), stream.on("data", function(chunk) {
                        (debug("wrapped data"), state.decoder && (chunk = state.decoder.write(chunk)), state.objectMode && null == chunk) || (state.objectMode || chunk && chunk.length) && (self.push(chunk) || (paused = !0, 
                        stream.pause()));
                    }), stream) void 0 === this[i] && "function" == typeof stream[i] && (this[i] = function(method) {
                        return function() {
                            return stream[method].apply(stream, arguments);
                        };
                    }(i));
                    return function(xs, f) {
                        for (var i = 0, l = xs.length; i < l; i++) f(xs[i], i);
                    }([ "error", "close", "destroy", "pause", "resume" ], function(ev) {
                        stream.on(ev, self.emit.bind(self, ev));
                    }), self._read = function(n) {
                        debug("wrapped _read", n), paused && (paused = !1, stream.resume());
                    }, self;
                }, Readable._fromList = fromList;
            }).call(this, require("_process"));
        }, {
            "./_stream_duplex": 234,
            _process: 224,
            buffer: 77,
            "core-util-is": 101,
            events: 73,
            inherits: 152,
            isarray: 154,
            "process-nextick-args": 223,
            "string_decoder/": 255,
            util: 44
        } ],
        237: [ function(require, module, exports) {
            "use strict";
            module.exports = Transform;
            var Duplex = require("./_stream_duplex"), util = require("core-util-is");
            function TransformState(stream) {
                this.afterTransform = function(er, data) {
                    return function(stream, er, data) {
                        var ts = stream._transformState;
                        ts.transforming = !1;
                        var cb = ts.writecb;
                        if (!cb) return stream.emit("error", new Error("no writecb in Transform class"));
                        ts.writechunk = null, (ts.writecb = null) != data && stream.push(data);
                        cb(er);
                        var rs = stream._readableState;
                        rs.reading = !1, (rs.needReadable || rs.length < rs.highWaterMark) && stream._read(rs.highWaterMark);
                    }(stream, er, data);
                }, this.needTransform = !1, this.transforming = !1, this.writecb = null, this.writechunk = null, 
                this.writeencoding = null;
            }
            function Transform(options) {
                if (!(this instanceof Transform)) return new Transform(options);
                Duplex.call(this, options), this._transformState = new TransformState(this);
                var stream = this;
                this._readableState.needReadable = !0, this._readableState.sync = !1, options && ("function" == typeof options.transform && (this._transform = options.transform), 
                "function" == typeof options.flush && (this._flush = options.flush)), this.once("prefinish", function() {
                    "function" == typeof this._flush ? this._flush(function(er) {
                        done(stream, er);
                    }) : done(stream);
                });
            }
            function done(stream, er) {
                if (er) return stream.emit("error", er);
                var ws = stream._writableState, 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);
            }
            util.inherits = require("inherits"), util.inherits(Transform, Duplex), Transform.prototype.push = function(chunk, encoding) {
                return this._transformState.needTransform = !1, 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;
                if (ts.writecb = cb, ts.writechunk = chunk, ts.writeencoding = encoding, !ts.transforming) {
                    var rs = this._readableState;
                    (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) && this._read(rs.highWaterMark);
                }
            }, Transform.prototype._read = function(n) {
                var ts = this._transformState;
                null !== ts.writechunk && ts.writecb && !ts.transforming ? (ts.transforming = !0, 
                this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform)) : ts.needTransform = !0;
            };
        }, {
            "./_stream_duplex": 234,
            "core-util-is": 101,
            inherits: 152
        } ],
        238: [ function(require, module, exports) {
            (function(process) {
                "use strict";
                module.exports = Writable;
                var processNextTick = require("process-nextick-args"), asyncWrite = !process.browser && -1 < [ "v0.10", "v0.9." ].indexOf(process.version.slice(0, 5)) ? setImmediate : processNextTick, Buffer = require("buffer").Buffer;
                Writable.WritableState = WritableState;
                var util = require("core-util-is");
                util.inherits = require("inherits");
                var Stream, internalUtil = {
                    deprecate: require("util-deprecate")
                };
                !function() {
                    try {
                        Stream = require("stream");
                    } catch (_) {} finally {
                        Stream || (Stream = require("events").EventEmitter);
                    }
                }();
                var Duplex;
                Buffer = require("buffer").Buffer;
                function nop() {}
                function WriteReq(chunk, encoding, cb) {
                    this.chunk = chunk, this.encoding = encoding, this.callback = cb, this.next = null;
                }
                function WritableState(options, stream) {
                    Duplex = Duplex || require("./_stream_duplex"), options = options || {}, this.objectMode = !!options.objectMode, 
                    stream instanceof Duplex && (this.objectMode = this.objectMode || !!options.writableObjectMode);
                    var hwm = options.highWaterMark, defaultHwm = this.objectMode ? 16 : 16384;
                    this.highWaterMark = hwm || 0 === hwm ? hwm : defaultHwm, this.highWaterMark = ~~this.highWaterMark, 
                    this.needDrain = !1, this.ending = !1, this.ended = !1;
                    var noDecode = (this.finished = !1) === options.decodeStrings;
                    this.decodeStrings = !noDecode, this.defaultEncoding = options.defaultEncoding || "utf8", 
                    this.length = 0, this.writing = !1, this.corked = 0, this.sync = !0, this.bufferProcessing = !1, 
                    this.onwrite = function(er) {
                        !function(stream, er) {
                            var state = stream._writableState, sync = state.sync, cb = state.writecb;
                            if (function(state) {
                                state.writing = !1, state.writecb = null, state.length -= state.writelen, state.writelen = 0;
                            }(state), er) !function(stream, state, sync, er, cb) {
                                --state.pendingcb, sync ? processNextTick(cb, er) : cb(er);
                                stream._writableState.errorEmitted = !0, stream.emit("error", er);
                            }(stream, state, sync, er, cb); else {
                                var finished = needFinish(state);
                                finished || state.corked || state.bufferProcessing || !state.bufferedRequest || clearBuffer(stream, state), 
                                sync ? asyncWrite(afterWrite, stream, state, finished, cb) : afterWrite(stream, state, finished, cb);
                            }
                        }(stream, er);
                    }, this.writecb = null, this.writelen = 0, this.bufferedRequest = null, this.lastBufferedRequest = null, 
                    this.pendingcb = 0, this.prefinished = !1, this.errorEmitted = !1, this.bufferedRequestCount = 0, 
                    this.corkedRequestsFree = new CorkedRequest(this), this.corkedRequestsFree.next = new CorkedRequest(this);
                }
                function Writable(options) {
                    if (Duplex = Duplex || require("./_stream_duplex"), !(this instanceof Writable || this instanceof Duplex)) return new Writable(options);
                    this._writableState = new WritableState(options, this), this.writable = !0, options && ("function" == typeof options.write && (this._write = options.write), 
                    "function" == typeof options.writev && (this._writev = options.writev)), Stream.call(this);
                }
                function doWrite(stream, state, writev, len, chunk, encoding, cb) {
                    state.writelen = len, state.writecb = cb, state.writing = !0, state.sync = !0, writev ? stream._writev(chunk, state.onwrite) : stream._write(chunk, encoding, state.onwrite), 
                    state.sync = !1;
                }
                function afterWrite(stream, state, finished, cb) {
                    finished || function(stream, state) {
                        0 === state.length && state.needDrain && (state.needDrain = !1, stream.emit("drain"));
                    }(stream, state), state.pendingcb--, cb(), finishMaybe(stream, state);
                }
                function clearBuffer(stream, state) {
                    state.bufferProcessing = !0;
                    var entry = state.bufferedRequest;
                    if (stream._writev && entry && entry.next) {
                        var l = state.bufferedRequestCount, buffer = new Array(l), holder = state.corkedRequestsFree;
                        holder.entry = entry;
                        for (var count = 0; entry; ) entry = (buffer[count] = entry).next, count += 1;
                        doWrite(stream, state, !0, state.length, buffer, "", holder.finish), state.pendingcb++, 
                        state.lastBufferedRequest = null, state.corkedRequestsFree = holder.next, holder.next = null;
                    } else {
                        for (;entry; ) {
                            var chunk = entry.chunk, encoding = entry.encoding, cb = entry.callback;
                            if (doWrite(stream, state, !1, state.objectMode ? 1 : chunk.length, chunk, encoding, cb), 
                            entry = entry.next, state.writing) break;
                        }
                        null === entry && (state.lastBufferedRequest = null);
                    }
                    state.bufferedRequestCount = 0, state.bufferedRequest = entry, state.bufferProcessing = !1;
                }
                function needFinish(state) {
                    return state.ending && 0 === state.length && null === state.bufferedRequest && !state.finished && !state.writing;
                }
                function prefinish(stream, state) {
                    state.prefinished || (state.prefinished = !0, stream.emit("prefinish"));
                }
                function finishMaybe(stream, state) {
                    var need = needFinish(state);
                    return need && (0 === state.pendingcb ? (prefinish(stream, state), state.finished = !0, 
                    stream.emit("finish")) : prefinish(stream, state)), need;
                }
                function CorkedRequest(state) {
                    var _this = this;
                    this.next = null, this.entry = null, this.finish = function(err) {
                        var entry = _this.entry;
                        for (_this.entry = null; entry; ) {
                            var cb = entry.callback;
                            state.pendingcb--, cb(err), entry = entry.next;
                        }
                        state.corkedRequestsFree ? state.corkedRequestsFree.next = _this : state.corkedRequestsFree = _this;
                    };
                }
                util.inherits(Writable, Stream), WritableState.prototype.getBuffer = function() {
                    for (var current = this.bufferedRequest, out = []; current; ) out.push(current), 
                    current = current.next;
                    return out;
                }, function() {
                    try {
                        Object.defineProperty(WritableState.prototype, "buffer", {
                            get: internalUtil.deprecate(function() {
                                return this.getBuffer();
                            }, "_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")
                        });
                    } catch (_) {}
                }(), Writable.prototype.pipe = function() {
                    this.emit("error", new Error("Cannot pipe. Not readable."));
                }, Writable.prototype.write = function(chunk, encoding, cb) {
                    var state = this._writableState, ret = !1;
                    return "function" == typeof encoding && (cb = encoding, encoding = null), Buffer.isBuffer(chunk) ? encoding = "buffer" : encoding || (encoding = state.defaultEncoding), 
                    "function" != typeof cb && (cb = nop), state.ended ? function(stream, cb) {
                        var er = new Error("write after end");
                        stream.emit("error", er), processNextTick(cb, er);
                    }(this, cb) : function(stream, state, chunk, cb) {
                        var valid = !0;
                        if (!Buffer.isBuffer(chunk) && "string" != typeof chunk && null != chunk && !state.objectMode) {
                            var er = new TypeError("Invalid non-string/buffer chunk");
                            stream.emit("error", er), processNextTick(cb, er), valid = !1;
                        }
                        return valid;
                    }(this, state, chunk, cb) && (state.pendingcb++, ret = function(stream, state, chunk, encoding, cb) {
                        chunk = function(state, chunk, encoding) {
                            return state.objectMode || !1 === state.decodeStrings || "string" != typeof chunk || (chunk = new Buffer(chunk, encoding)), 
                            chunk;
                        }(state, chunk, encoding), Buffer.isBuffer(chunk) && (encoding = "buffer");
                        var len = state.objectMode ? 1 : chunk.length;
                        state.length += len;
                        var ret = state.length < state.highWaterMark;
                        ret || (state.needDrain = !0);
                        if (state.writing || state.corked) {
                            var last = state.lastBufferedRequest;
                            state.lastBufferedRequest = new WriteReq(chunk, encoding, cb), last ? last.next = state.lastBufferedRequest : state.bufferedRequest = state.lastBufferedRequest, 
                            state.bufferedRequestCount += 1;
                        } else doWrite(stream, state, !1, len, chunk, encoding, cb);
                        return ret;
                    }(this, state, chunk, encoding, cb)), ret;
                }, Writable.prototype.cork = function() {
                    this._writableState.corked++;
                }, Writable.prototype.uncork = function() {
                    var state = this._writableState;
                    state.corked && (state.corked--, state.writing || state.corked || state.finished || state.bufferProcessing || !state.bufferedRequest || clearBuffer(this, state));
                }, Writable.prototype.setDefaultEncoding = function(encoding) {
                    if ("string" == typeof encoding && (encoding = encoding.toLowerCase()), !(-1 < [ "hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw" ].indexOf((encoding + "").toLowerCase()))) throw new TypeError("Unknown encoding: " + encoding);
                    this._writableState.defaultEncoding = encoding;
                }, Writable.prototype._write = function(chunk, encoding, cb) {
                    cb(new Error("not implemented"));
                }, Writable.prototype._writev = null, Writable.prototype.end = function(chunk, encoding, cb) {
                    var state = this._writableState;
                    "function" == typeof chunk ? (cb = chunk, encoding = chunk = null) : "function" == typeof encoding && (cb = encoding, 
                    encoding = null), null != chunk && this.write(chunk, encoding), state.corked && (state.corked = 1, 
                    this.uncork()), state.ending || state.finished || function(stream, state, cb) {
                        state.ending = !0, finishMaybe(stream, state), cb && (state.finished ? processNextTick(cb) : stream.once("finish", cb));
                        state.ended = !0, stream.writable = !1;
                    }(this, state, cb);
                };
            }).call(this, require("_process"));
        }, {
            "./_stream_duplex": 234,
            _process: 224,
            buffer: 77,
            "core-util-is": 101,
            events: 73,
            inherits: 152,
            "process-nextick-args": 223,
            "util-deprecate": 256
        } ],
        239: [ function(require, module, exports) {
            module.exports = require("./lib/_stream_passthrough.js");
        }, {
            "./lib/_stream_passthrough.js": 235
        } ],
        240: [ function(require, module, exports) {
            var Stream = function() {
                try {
                    return require("stream");
                } catch (_) {}
            }();
            (exports = module.exports = require("./lib/_stream_readable.js")).Stream = Stream || exports, 
            (exports.Readable = 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": 234,
            "./lib/_stream_passthrough.js": 235,
            "./lib/_stream_readable.js": 236,
            "./lib/_stream_transform.js": 237,
            "./lib/_stream_writable.js": 238
        } ],
        241: [ function(require, module, exports) {
            module.exports = require("./lib/_stream_transform.js");
        }, {
            "./lib/_stream_transform.js": 237
        } ],
        242: [ function(require, module, exports) {
            module.exports = require("./lib/_stream_writable.js");
        }, {
            "./lib/_stream_writable.js": 238
        } ],
        243: [ function(require, module, exports) {
            (function(Buffer) {
                "use strict";
                var inherits = require("inherits"), HashBase = require("hash-base");
                function RIPEMD160() {
                    HashBase.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, 
                    this._d = 271733878, this._e = 3285377520;
                }
                function rotl(x, n) {
                    return x << n | x >>> 32 - n;
                }
                function fn1(a, b, c, d, e, m, k, s) {
                    return rotl(a + (b ^ c ^ d) + m + k | 0, s) + e | 0;
                }
                function fn2(a, b, c, d, e, m, k, s) {
                    return rotl(a + (b & c | ~b & d) + m + k | 0, s) + e | 0;
                }
                function fn3(a, b, c, d, e, m, k, s) {
                    return rotl(a + ((b | ~c) ^ d) + m + k | 0, s) + e | 0;
                }
                function fn4(a, b, c, d, e, m, k, s) {
                    return rotl(a + (b & d | c & ~d) + m + k | 0, s) + e | 0;
                }
                function fn5(a, b, c, d, e, m, k, s) {
                    return rotl(a + (b ^ (c | ~d)) + m + k | 0, s) + e | 0;
                }
                inherits(RIPEMD160, HashBase), RIPEMD160.prototype._update = function() {
                    for (var m = new Array(16), i = 0; i < 16; ++i) m[i] = this._block.readInt32LE(4 * i);
                    var al = this._a, bl = this._b, cl = this._c, dl = this._d, el = this._e;
                    el = fn1(el, al = fn1(al, bl, cl, dl, el, m[0], 0, 11), bl, cl = rotl(cl, 10), dl, m[1], 0, 14), 
                    bl = fn1(bl = rotl(bl, 10), cl = fn1(cl, dl = fn1(dl, el, al, bl, cl, m[2], 0, 15), el, al = rotl(al, 10), bl, m[3], 0, 12), dl, el = rotl(el, 10), al, m[4], 0, 5), 
                    dl = fn1(dl = rotl(dl, 10), el = fn1(el, al = fn1(al, bl, cl, dl, el, m[5], 0, 8), bl, cl = rotl(cl, 10), dl, m[6], 0, 7), al, bl = rotl(bl, 10), cl, m[7], 0, 9), 
                    al = fn1(al = rotl(al, 10), bl = fn1(bl, cl = fn1(cl, dl, el, al, bl, m[8], 0, 11), dl, el = rotl(el, 10), al, m[9], 0, 13), cl, dl = rotl(dl, 10), el, m[10], 0, 14), 
                    cl = fn1(cl = rotl(cl, 10), dl = fn1(dl, el = fn1(el, al, bl, cl, dl, m[11], 0, 15), al, bl = rotl(bl, 10), cl, m[12], 0, 6), el, al = rotl(al, 10), bl, m[13], 0, 7), 
                    el = fn2(el = rotl(el, 10), al = fn1(al, bl = fn1(bl, cl, dl, el, al, m[14], 0, 9), cl, dl = rotl(dl, 10), el, m[15], 0, 8), bl, cl = rotl(cl, 10), dl, m[7], 1518500249, 7), 
                    bl = fn2(bl = rotl(bl, 10), cl = fn2(cl, dl = fn2(dl, el, al, bl, cl, m[4], 1518500249, 6), el, al = rotl(al, 10), bl, m[13], 1518500249, 8), dl, el = rotl(el, 10), al, m[1], 1518500249, 13), 
                    dl = fn2(dl = rotl(dl, 10), el = fn2(el, al = fn2(al, bl, cl, dl, el, m[10], 1518500249, 11), bl, cl = rotl(cl, 10), dl, m[6], 1518500249, 9), al, bl = rotl(bl, 10), cl, m[15], 1518500249, 7), 
                    al = fn2(al = rotl(al, 10), bl = fn2(bl, cl = fn2(cl, dl, el, al, bl, m[3], 1518500249, 15), dl, el = rotl(el, 10), al, m[12], 1518500249, 7), cl, dl = rotl(dl, 10), el, m[0], 1518500249, 12), 
                    cl = fn2(cl = rotl(cl, 10), dl = fn2(dl, el = fn2(el, al, bl, cl, dl, m[9], 1518500249, 15), al, bl = rotl(bl, 10), cl, m[5], 1518500249, 9), el, al = rotl(al, 10), bl, m[2], 1518500249, 11), 
                    el = fn2(el = rotl(el, 10), al = fn2(al, bl = fn2(bl, cl, dl, el, al, m[14], 1518500249, 7), cl, dl = rotl(dl, 10), el, m[11], 1518500249, 13), bl, cl = rotl(cl, 10), dl, m[8], 1518500249, 12), 
                    bl = fn3(bl = rotl(bl, 10), cl = fn3(cl, dl = fn3(dl, el, al, bl, cl, m[3], 1859775393, 11), el, al = rotl(al, 10), bl, m[10], 1859775393, 13), dl, el = rotl(el, 10), al, m[14], 1859775393, 6), 
                    dl = fn3(dl = rotl(dl, 10), el = fn3(el, al = fn3(al, bl, cl, dl, el, m[4], 1859775393, 7), bl, cl = rotl(cl, 10), dl, m[9], 1859775393, 14), al, bl = rotl(bl, 10), cl, m[15], 1859775393, 9), 
                    al = fn3(al = rotl(al, 10), bl = fn3(bl, cl = fn3(cl, dl, el, al, bl, m[8], 1859775393, 13), dl, el = rotl(el, 10), al, m[1], 1859775393, 15), cl, dl = rotl(dl, 10), el, m[2], 1859775393, 14), 
                    cl = fn3(cl = rotl(cl, 10), dl = fn3(dl, el = fn3(el, al, bl, cl, dl, m[7], 1859775393, 8), al, bl = rotl(bl, 10), cl, m[0], 1859775393, 13), el, al = rotl(al, 10), bl, m[6], 1859775393, 6), 
                    el = fn3(el = rotl(el, 10), al = fn3(al, bl = fn3(bl, cl, dl, el, al, m[13], 1859775393, 5), cl, dl = rotl(dl, 10), el, m[11], 1859775393, 12), bl, cl = rotl(cl, 10), dl, m[5], 1859775393, 7), 
                    bl = fn4(bl = rotl(bl, 10), cl = fn4(cl, dl = fn3(dl, el, al, bl, cl, m[12], 1859775393, 5), el, al = rotl(al, 10), bl, m[1], 2400959708, 11), dl, el = rotl(el, 10), al, m[9], 2400959708, 12), 
                    dl = fn4(dl = rotl(dl, 10), el = fn4(el, al = fn4(al, bl, cl, dl, el, m[11], 2400959708, 14), bl, cl = rotl(cl, 10), dl, m[10], 2400959708, 15), al, bl = rotl(bl, 10), cl, m[0], 2400959708, 14), 
                    al = fn4(al = rotl(al, 10), bl = fn4(bl, cl = fn4(cl, dl, el, al, bl, m[8], 2400959708, 15), dl, el = rotl(el, 10), al, m[12], 2400959708, 9), cl, dl = rotl(dl, 10), el, m[4], 2400959708, 8), 
                    cl = fn4(cl = rotl(cl, 10), dl = fn4(dl, el = fn4(el, al, bl, cl, dl, m[13], 2400959708, 9), al, bl = rotl(bl, 10), cl, m[3], 2400959708, 14), el, al = rotl(al, 10), bl, m[7], 2400959708, 5), 
                    el = fn4(el = rotl(el, 10), al = fn4(al, bl = fn4(bl, cl, dl, el, al, m[15], 2400959708, 6), cl, dl = rotl(dl, 10), el, m[14], 2400959708, 8), bl, cl = rotl(cl, 10), dl, m[5], 2400959708, 6), 
                    bl = fn5(bl = rotl(bl, 10), cl = fn4(cl, dl = fn4(dl, el, al, bl, cl, m[6], 2400959708, 5), el, al = rotl(al, 10), bl, m[2], 2400959708, 12), dl, el = rotl(el, 10), al, m[4], 2840853838, 9), 
                    dl = fn5(dl = rotl(dl, 10), el = fn5(el, al = fn5(al, bl, cl, dl, el, m[0], 2840853838, 15), bl, cl = rotl(cl, 10), dl, m[5], 2840853838, 5), al, bl = rotl(bl, 10), cl, m[9], 2840853838, 11), 
                    al = fn5(al = rotl(al, 10), bl = fn5(bl, cl = fn5(cl, dl, el, al, bl, m[7], 2840853838, 6), dl, el = rotl(el, 10), al, m[12], 2840853838, 8), cl, dl = rotl(dl, 10), el, m[2], 2840853838, 13), 
                    cl = fn5(cl = rotl(cl, 10), dl = fn5(dl, el = fn5(el, al, bl, cl, dl, m[10], 2840853838, 12), al, bl = rotl(bl, 10), cl, m[14], 2840853838, 5), el, al = rotl(al, 10), bl, m[1], 2840853838, 12), 
                    el = fn5(el = rotl(el, 10), al = fn5(al, bl = fn5(bl, cl, dl, el, al, m[3], 2840853838, 13), cl, dl = rotl(dl, 10), el, m[8], 2840853838, 14), bl, cl = rotl(cl, 10), dl, m[11], 2840853838, 11), 
                    bl = fn5(bl = rotl(bl, 10), cl = fn5(cl, dl = fn5(dl, el, al, bl, cl, m[6], 2840853838, 8), el, al = rotl(al, 10), bl, m[15], 2840853838, 5), dl, el = rotl(el, 10), al, m[13], 2840853838, 6), 
                    dl = rotl(dl, 10);
                    var ar = this._a, br = this._b, cr = this._c, dr = this._d, er = this._e;
                    er = fn5(er, ar = fn5(ar, br, cr, dr, er, m[5], 1352829926, 8), br, cr = rotl(cr, 10), dr, m[14], 1352829926, 9), 
                    br = fn5(br = rotl(br, 10), cr = fn5(cr, dr = fn5(dr, er, ar, br, cr, m[7], 1352829926, 9), er, ar = rotl(ar, 10), br, m[0], 1352829926, 11), dr, er = rotl(er, 10), ar, m[9], 1352829926, 13), 
                    dr = fn5(dr = rotl(dr, 10), er = fn5(er, ar = fn5(ar, br, cr, dr, er, m[2], 1352829926, 15), br, cr = rotl(cr, 10), dr, m[11], 1352829926, 15), ar, br = rotl(br, 10), cr, m[4], 1352829926, 5), 
                    ar = fn5(ar = rotl(ar, 10), br = fn5(br, cr = fn5(cr, dr, er, ar, br, m[13], 1352829926, 7), dr, er = rotl(er, 10), ar, m[6], 1352829926, 7), cr, dr = rotl(dr, 10), er, m[15], 1352829926, 8), 
                    cr = fn5(cr = rotl(cr, 10), dr = fn5(dr, er = fn5(er, ar, br, cr, dr, m[8], 1352829926, 11), ar, br = rotl(br, 10), cr, m[1], 1352829926, 14), er, ar = rotl(ar, 10), br, m[10], 1352829926, 14), 
                    er = fn4(er = rotl(er, 10), ar = fn5(ar, br = fn5(br, cr, dr, er, ar, m[3], 1352829926, 12), cr, dr = rotl(dr, 10), er, m[12], 1352829926, 6), br, cr = rotl(cr, 10), dr, m[6], 1548603684, 9), 
                    br = fn4(br = rotl(br, 10), cr = fn4(cr, dr = fn4(dr, er, ar, br, cr, m[11], 1548603684, 13), er, ar = rotl(ar, 10), br, m[3], 1548603684, 15), dr, er = rotl(er, 10), ar, m[7], 1548603684, 7), 
                    dr = fn4(dr = rotl(dr, 10), er = fn4(er, ar = fn4(ar, br, cr, dr, er, m[0], 1548603684, 12), br, cr = rotl(cr, 10), dr, m[13], 1548603684, 8), ar, br = rotl(br, 10), cr, m[5], 1548603684, 9), 
                    ar = fn4(ar = rotl(ar, 10), br = fn4(br, cr = fn4(cr, dr, er, ar, br, m[10], 1548603684, 11), dr, er = rotl(er, 10), ar, m[14], 1548603684, 7), cr, dr = rotl(dr, 10), er, m[15], 1548603684, 7), 
                    cr = fn4(cr = rotl(cr, 10), dr = fn4(dr, er = fn4(er, ar, br, cr, dr, m[8], 1548603684, 12), ar, br = rotl(br, 10), cr, m[12], 1548603684, 7), er, ar = rotl(ar, 10), br, m[4], 1548603684, 6), 
                    er = fn4(er = rotl(er, 10), ar = fn4(ar, br = fn4(br, cr, dr, er, ar, m[9], 1548603684, 15), cr, dr = rotl(dr, 10), er, m[1], 1548603684, 13), br, cr = rotl(cr, 10), dr, m[2], 1548603684, 11), 
                    br = fn3(br = rotl(br, 10), cr = fn3(cr, dr = fn3(dr, er, ar, br, cr, m[15], 1836072691, 9), er, ar = rotl(ar, 10), br, m[5], 1836072691, 7), dr, er = rotl(er, 10), ar, m[1], 1836072691, 15), 
                    dr = fn3(dr = rotl(dr, 10), er = fn3(er, ar = fn3(ar, br, cr, dr, er, m[3], 1836072691, 11), br, cr = rotl(cr, 10), dr, m[7], 1836072691, 8), ar, br = rotl(br, 10), cr, m[14], 1836072691, 6), 
                    ar = fn3(ar = rotl(ar, 10), br = fn3(br, cr = fn3(cr, dr, er, ar, br, m[6], 1836072691, 6), dr, er = rotl(er, 10), ar, m[9], 1836072691, 14), cr, dr = rotl(dr, 10), er, m[11], 1836072691, 12), 
                    cr = fn3(cr = rotl(cr, 10), dr = fn3(dr, er = fn3(er, ar, br, cr, dr, m[8], 1836072691, 13), ar, br = rotl(br, 10), cr, m[12], 1836072691, 5), er, ar = rotl(ar, 10), br, m[2], 1836072691, 14), 
                    er = fn3(er = rotl(er, 10), ar = fn3(ar, br = fn3(br, cr, dr, er, ar, m[10], 1836072691, 13), cr, dr = rotl(dr, 10), er, m[0], 1836072691, 13), br, cr = rotl(cr, 10), dr, m[4], 1836072691, 7), 
                    br = fn2(br = rotl(br, 10), cr = fn2(cr, dr = fn3(dr, er, ar, br, cr, m[13], 1836072691, 5), er, ar = rotl(ar, 10), br, m[8], 2053994217, 15), dr, er = rotl(er, 10), ar, m[6], 2053994217, 5), 
                    dr = fn2(dr = rotl(dr, 10), er = fn2(er, ar = fn2(ar, br, cr, dr, er, m[4], 2053994217, 8), br, cr = rotl(cr, 10), dr, m[1], 2053994217, 11), ar, br = rotl(br, 10), cr, m[3], 2053994217, 14), 
                    ar = fn2(ar = rotl(ar, 10), br = fn2(br, cr = fn2(cr, dr, er, ar, br, m[11], 2053994217, 14), dr, er = rotl(er, 10), ar, m[15], 2053994217, 6), cr, dr = rotl(dr, 10), er, m[0], 2053994217, 14), 
                    cr = fn2(cr = rotl(cr, 10), dr = fn2(dr, er = fn2(er, ar, br, cr, dr, m[5], 2053994217, 6), ar, br = rotl(br, 10), cr, m[12], 2053994217, 9), er, ar = rotl(ar, 10), br, m[2], 2053994217, 12), 
                    er = fn2(er = rotl(er, 10), ar = fn2(ar, br = fn2(br, cr, dr, er, ar, m[13], 2053994217, 9), cr, dr = rotl(dr, 10), er, m[9], 2053994217, 12), br, cr = rotl(cr, 10), dr, m[7], 2053994217, 5), 
                    br = fn1(br = rotl(br, 10), cr = fn2(cr, dr = fn2(dr, er, ar, br, cr, m[10], 2053994217, 15), er, ar = rotl(ar, 10), br, m[14], 2053994217, 8), dr, er = rotl(er, 10), ar, m[12], 0, 8), 
                    dr = fn1(dr = rotl(dr, 10), er = fn1(er, ar = fn1(ar, br, cr, dr, er, m[15], 0, 5), br, cr = rotl(cr, 10), dr, m[10], 0, 12), ar, br = rotl(br, 10), cr, m[4], 0, 9), 
                    ar = fn1(ar = rotl(ar, 10), br = fn1(br, cr = fn1(cr, dr, er, ar, br, m[1], 0, 12), dr, er = rotl(er, 10), ar, m[5], 0, 5), cr, dr = rotl(dr, 10), er, m[8], 0, 14), 
                    cr = fn1(cr = rotl(cr, 10), dr = fn1(dr, er = fn1(er, ar, br, cr, dr, m[7], 0, 6), ar, br = rotl(br, 10), cr, m[6], 0, 8), er, ar = rotl(ar, 10), br, m[2], 0, 13), 
                    er = fn1(er = rotl(er, 10), ar = fn1(ar, br = fn1(br, cr, dr, er, ar, m[13], 0, 6), cr, dr = rotl(dr, 10), er, m[14], 0, 5), br, cr = rotl(cr, 10), dr, m[0], 0, 15), 
                    br = fn1(br = rotl(br, 10), cr = fn1(cr, dr = fn1(dr, er, ar, br, cr, m[3], 0, 13), er, ar = rotl(ar, 10), br, m[9], 0, 11), dr, er = rotl(er, 10), ar, m[11], 0, 11), 
                    dr = rotl(dr, 10);
                    var t = this._b + cl + dr | 0;
                    this._b = this._c + dl + er | 0, this._c = this._d + el + ar | 0, this._d = this._e + al + br | 0, 
                    this._e = this._a + bl + cr | 0, this._a = t;
                }, RIPEMD160.prototype._digest = function() {
                    this._block[this._blockOffset++] = 128, 56 < this._blockOffset && (this._block.fill(0, this._blockOffset, 64), 
                    this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), 
                    this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), 
                    this._update();
                    var buffer = new Buffer(20);
                    return buffer.writeInt32LE(this._a, 0), buffer.writeInt32LE(this._b, 4), buffer.writeInt32LE(this._c, 8), 
                    buffer.writeInt32LE(this._d, 12), buffer.writeInt32LE(this._e, 16), buffer;
                }, module.exports = RIPEMD160;
            }).call(this, require("buffer").Buffer);
        }, {
            buffer: 77,
            "hash-base": 136,
            inherits: 152
        } ],
        244: [ function(require, module, exports) {
            var buffer = require("buffer"), Buffer = buffer.Buffer;
            function copyProps(src, dst) {
                for (var key in src) dst[key] = src[key];
            }
            function SafeBuffer(arg, encodingOrOffset, length) {
                return Buffer(arg, encodingOrOffset, length);
            }
            Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow ? module.exports = buffer : (copyProps(buffer, exports), 
            exports.Buffer = SafeBuffer), copyProps(Buffer, SafeBuffer), SafeBuffer.from = function(arg, encodingOrOffset, length) {
                if ("number" == typeof arg) throw new TypeError("Argument must not be a number");
                return Buffer(arg, encodingOrOffset, length);
            }, SafeBuffer.alloc = function(size, fill, encoding) {
                if ("number" != typeof size) throw new TypeError("Argument must be a number");
                var buf = Buffer(size);
                return void 0 !== fill ? "string" == typeof encoding ? buf.fill(fill, encoding) : buf.fill(fill) : buf.fill(0), 
                buf;
            }, SafeBuffer.allocUnsafe = function(size) {
                if ("number" != typeof size) throw new TypeError("Argument must be a number");
                return Buffer(size);
            }, SafeBuffer.allocUnsafeSlow = function(size) {
                if ("number" != typeof size) throw new TypeError("Argument must be a number");
                return buffer.SlowBuffer(size);
            };
        }, {
            buffer: 77
        } ],
        245: [ function(require, module, exports) {
            (function(Buffer) {
                !function(sax) {
                    sax.parser = function(strict, opt) {
                        return new SAXParser(strict, opt);
                    }, sax.SAXParser = SAXParser, sax.SAXStream = SAXStream, sax.createStream = function(strict, opt) {
                        return new SAXStream(strict, opt);
                    }, sax.MAX_BUFFER_LENGTH = 65536;
                    var Stream, buffers = [ "comment", "sgmlDecl", "textNode", "tagName", "doctype", "procInstName", "procInstBody", "entity", "attribName", "attribValue", "cdata", "script" ];
                    function SAXParser(strict, opt) {
                        if (!(this instanceof SAXParser)) return new SAXParser(strict, opt);
                        !function(parser) {
                            for (var i = 0, l = buffers.length; i < l; i++) parser[buffers[i]] = "";
                        }(this), this.q = this.c = "", this.bufferCheckPosition = sax.MAX_BUFFER_LENGTH, 
                        this.opt = opt || {}, this.opt.lowercase = this.opt.lowercase || this.opt.lowercasetags, 
                        this.looseCase = this.opt.lowercase ? "toLowerCase" : "toUpperCase", this.tags = [], 
                        this.closed = this.closedRoot = this.sawRoot = !1, this.tag = this.error = null, 
                        this.strict = !!strict, this.noscript = !(!strict && !this.opt.noscript), this.state = S.BEGIN, 
                        this.strictEntities = this.opt.strictEntities, this.ENTITIES = this.strictEntities ? Object.create(sax.XML_ENTITIES) : Object.create(sax.ENTITIES), 
                        this.attribList = [], this.opt.xmlns && (this.ns = Object.create(rootNS)), this.trackPosition = !1 !== this.opt.position, 
                        this.trackPosition && (this.position = this.line = this.column = 0), emit(this, "onready");
                    }
                    sax.EVENTS = [ "text", "processinginstruction", "sgmldeclaration", "doctype", "comment", "opentagstart", "attribute", "opentag", "closetag", "opencdata", "cdata", "closecdata", "error", "end", "ready", "script", "opennamespace", "closenamespace" ], 
                    Object.create || (Object.create = function(o) {
                        function F() {}
                        return F.prototype = o, new F();
                    }), Object.keys || (Object.keys = function(o) {
                        var a = [];
                        for (var i in o) o.hasOwnProperty(i) && a.push(i);
                        return a;
                    }), SAXParser.prototype = {
                        end: function() {
                            end(this);
                        },
                        write: function(chunk) {
                            if (this.error) throw this.error;
                            if (this.closed) return error(this, "Cannot write after close. Assign an onready handler.");
                            if (null === chunk) return end(this);
                            "object" == typeof chunk && (chunk = chunk.toString());
                            var i = 0, c = "";
                            for (;c = charAt(chunk, i++), this.c = c; ) switch (this.trackPosition && (this.position++, 
                            "\n" === c ? (this.line++, this.column = 0) : this.column++), this.state) {
                              case S.BEGIN:
                                if (this.state = S.BEGIN_WHITESPACE, "\ufeff" === c) continue;
                                beginWhiteSpace(this, c);
                                continue;

                              case S.BEGIN_WHITESPACE:
                                beginWhiteSpace(this, c);
                                continue;

                              case S.TEXT:
                                if (this.sawRoot && !this.closedRoot) {
                                    for (var starti = i - 1; c && "<" !== c && "&" !== c; ) (c = charAt(chunk, i++)) && this.trackPosition && (this.position++, 
                                    "\n" === c ? (this.line++, this.column = 0) : this.column++);
                                    this.textNode += chunk.substring(starti, i - 1);
                                }
                                "<" !== c || this.sawRoot && this.closedRoot && !this.strict ? (isWhitespace(c) || this.sawRoot && !this.closedRoot || strictFail(this, "Text data outside of root node."), 
                                "&" === c ? this.state = S.TEXT_ENTITY : this.textNode += c) : (this.state = S.OPEN_WAKA, 
                                this.startTagPosition = this.position);
                                continue;

                              case S.SCRIPT:
                                "<" === c ? this.state = S.SCRIPT_ENDING : this.script += c;
                                continue;

                              case S.SCRIPT_ENDING:
                                "/" === c ? this.state = S.CLOSE_TAG : (this.script += "<" + c, this.state = S.SCRIPT);
                                continue;

                              case S.OPEN_WAKA:
                                if ("!" === c) this.state = S.SGML_DECL, this.sgmlDecl = ""; else if (isWhitespace(c)) ; else if (isMatch(nameStart, c)) this.state = S.OPEN_TAG, 
                                this.tagName = c; else if ("/" === c) this.state = S.CLOSE_TAG, this.tagName = ""; else if ("?" === c) this.state = S.PROC_INST, 
                                this.procInstName = this.procInstBody = ""; else {
                                    if (strictFail(this, "Unencoded <"), this.startTagPosition + 1 < this.position) {
                                        var pad = this.position - this.startTagPosition;
                                        c = new Array(pad).join(" ") + c;
                                    }
                                    this.textNode += "<" + c, this.state = S.TEXT;
                                }
                                continue;

                              case S.SGML_DECL:
                                (this.sgmlDecl + c).toUpperCase() === CDATA ? (emitNode(this, "onopencdata"), this.state = S.CDATA, 
                                this.sgmlDecl = "", this.cdata = "") : this.sgmlDecl + c === "--" ? (this.state = S.COMMENT, 
                                this.comment = "", this.sgmlDecl = "") : (this.sgmlDecl + c).toUpperCase() === DOCTYPE ? (this.state = S.DOCTYPE, 
                                (this.doctype || this.sawRoot) && strictFail(this, "Inappropriately located doctype declaration"), 
                                this.doctype = "", this.sgmlDecl = "") : ">" === c ? (emitNode(this, "onsgmldeclaration", this.sgmlDecl), 
                                this.sgmlDecl = "", this.state = S.TEXT) : (isQuote(c) && (this.state = S.SGML_DECL_QUOTED), 
                                this.sgmlDecl += c);
                                continue;

                              case S.SGML_DECL_QUOTED:
                                c === this.q && (this.state = S.SGML_DECL, this.q = ""), this.sgmlDecl += c;
                                continue;

                              case S.DOCTYPE:
                                ">" === c ? (this.state = S.TEXT, emitNode(this, "ondoctype", this.doctype), this.doctype = !0) : (this.doctype += c, 
                                "[" === c ? this.state = S.DOCTYPE_DTD : isQuote(c) && (this.state = S.DOCTYPE_QUOTED, 
                                this.q = c));
                                continue;

                              case S.DOCTYPE_QUOTED:
                                this.doctype += c, c === this.q && (this.q = "", this.state = S.DOCTYPE);
                                continue;

                              case S.DOCTYPE_DTD:
                                this.doctype += c, "]" === c ? this.state = S.DOCTYPE : isQuote(c) && (this.state = S.DOCTYPE_DTD_QUOTED, 
                                this.q = c);
                                continue;

                              case S.DOCTYPE_DTD_QUOTED:
                                this.doctype += c, c === this.q && (this.state = S.DOCTYPE_DTD, this.q = "");
                                continue;

                              case S.COMMENT:
                                "-" === c ? this.state = S.COMMENT_ENDING : this.comment += c;
                                continue;

                              case S.COMMENT_ENDING:
                                "-" === c ? (this.state = S.COMMENT_ENDED, this.comment = textopts(this.opt, this.comment), 
                                this.comment && emitNode(this, "oncomment", this.comment), this.comment = "") : (this.comment += "-" + c, 
                                this.state = S.COMMENT);
                                continue;

                              case S.COMMENT_ENDED:
                                ">" !== c ? (strictFail(this, "Malformed comment"), this.comment += "--" + c, this.state = S.COMMENT) : this.state = S.TEXT;
                                continue;

                              case S.CDATA:
                                "]" === c ? this.state = S.CDATA_ENDING : this.cdata += c;
                                continue;

                              case S.CDATA_ENDING:
                                "]" === c ? this.state = S.CDATA_ENDING_2 : (this.cdata += "]" + c, this.state = S.CDATA);
                                continue;

                              case S.CDATA_ENDING_2:
                                ">" === c ? (this.cdata && emitNode(this, "oncdata", this.cdata), emitNode(this, "onclosecdata"), 
                                this.cdata = "", this.state = S.TEXT) : "]" === c ? this.cdata += "]" : (this.cdata += "]]" + c, 
                                this.state = S.CDATA);
                                continue;

                              case S.PROC_INST:
                                "?" === c ? this.state = S.PROC_INST_ENDING : isWhitespace(c) ? this.state = S.PROC_INST_BODY : this.procInstName += c;
                                continue;

                              case S.PROC_INST_BODY:
                                if (!this.procInstBody && isWhitespace(c)) continue;
                                "?" === c ? this.state = S.PROC_INST_ENDING : this.procInstBody += c;
                                continue;

                              case S.PROC_INST_ENDING:
                                ">" === c ? (emitNode(this, "onprocessinginstruction", {
                                    name: this.procInstName,
                                    body: this.procInstBody
                                }), this.procInstName = this.procInstBody = "", this.state = S.TEXT) : (this.procInstBody += "?" + c, 
                                this.state = S.PROC_INST_BODY);
                                continue;

                              case S.OPEN_TAG:
                                isMatch(nameBody, c) ? this.tagName += c : (newTag(this), ">" === c ? openTag(this) : "/" === c ? this.state = S.OPEN_TAG_SLASH : (isWhitespace(c) || strictFail(this, "Invalid character in tag name"), 
                                this.state = S.ATTRIB));
                                continue;

                              case S.OPEN_TAG_SLASH:
                                ">" === c ? (openTag(this, !0), closeTag(this)) : (strictFail(this, "Forward-slash in opening tag not followed by >"), 
                                this.state = S.ATTRIB);
                                continue;

                              case S.ATTRIB:
                                if (isWhitespace(c)) continue;
                                ">" === c ? openTag(this) : "/" === c ? this.state = S.OPEN_TAG_SLASH : isMatch(nameStart, c) ? (this.attribName = c, 
                                this.attribValue = "", this.state = S.ATTRIB_NAME) : strictFail(this, "Invalid attribute name");
                                continue;

                              case S.ATTRIB_NAME:
                                "=" === c ? this.state = S.ATTRIB_VALUE : ">" === c ? (strictFail(this, "Attribute without value"), 
                                this.attribValue = this.attribName, attrib(this), openTag(this)) : isWhitespace(c) ? this.state = S.ATTRIB_NAME_SAW_WHITE : isMatch(nameBody, c) ? this.attribName += c : strictFail(this, "Invalid attribute name");
                                continue;

                              case S.ATTRIB_NAME_SAW_WHITE:
                                if ("=" === c) this.state = S.ATTRIB_VALUE; else {
                                    if (isWhitespace(c)) continue;
                                    strictFail(this, "Attribute without value"), this.tag.attributes[this.attribName] = "", 
                                    this.attribValue = "", emitNode(this, "onattribute", {
                                        name: this.attribName,
                                        value: ""
                                    }), this.attribName = "", ">" === c ? openTag(this) : isMatch(nameStart, c) ? (this.attribName = c, 
                                    this.state = S.ATTRIB_NAME) : (strictFail(this, "Invalid attribute name"), this.state = S.ATTRIB);
                                }
                                continue;

                              case S.ATTRIB_VALUE:
                                if (isWhitespace(c)) continue;
                                isQuote(c) ? (this.q = c, this.state = S.ATTRIB_VALUE_QUOTED) : (strictFail(this, "Unquoted attribute value"), 
                                this.state = S.ATTRIB_VALUE_UNQUOTED, this.attribValue = c);
                                continue;

                              case S.ATTRIB_VALUE_QUOTED:
                                if (c !== this.q) {
                                    "&" === c ? this.state = S.ATTRIB_VALUE_ENTITY_Q : this.attribValue += c;
                                    continue;
                                }
                                attrib(this), this.q = "", this.state = S.ATTRIB_VALUE_CLOSED;
                                continue;

                              case S.ATTRIB_VALUE_CLOSED:
                                isWhitespace(c) ? this.state = S.ATTRIB : ">" === c ? openTag(this) : "/" === c ? this.state = S.OPEN_TAG_SLASH : isMatch(nameStart, c) ? (strictFail(this, "No whitespace between attributes"), 
                                this.attribName = c, this.attribValue = "", this.state = S.ATTRIB_NAME) : strictFail(this, "Invalid attribute name");
                                continue;

                              case S.ATTRIB_VALUE_UNQUOTED:
                                if (!isAttribEnd(c)) {
                                    "&" === c ? this.state = S.ATTRIB_VALUE_ENTITY_U : this.attribValue += c;
                                    continue;
                                }
                                attrib(this), ">" === c ? openTag(this) : this.state = S.ATTRIB;
                                continue;

                              case S.CLOSE_TAG:
                                if (this.tagName) ">" === c ? closeTag(this) : isMatch(nameBody, c) ? this.tagName += c : this.script ? (this.script += "</" + this.tagName, 
                                this.tagName = "", this.state = S.SCRIPT) : (isWhitespace(c) || strictFail(this, "Invalid tagname in closing tag"), 
                                this.state = S.CLOSE_TAG_SAW_WHITE); else {
                                    if (isWhitespace(c)) continue;
                                    notMatch(nameStart, c) ? this.script ? (this.script += "</" + c, this.state = S.SCRIPT) : strictFail(this, "Invalid tagname in closing tag.") : this.tagName = c;
                                }
                                continue;

                              case S.CLOSE_TAG_SAW_WHITE:
                                if (isWhitespace(c)) continue;
                                ">" === c ? closeTag(this) : strictFail(this, "Invalid characters in closing tag");
                                continue;

                              case S.TEXT_ENTITY:
                              case S.ATTRIB_VALUE_ENTITY_Q:
                              case S.ATTRIB_VALUE_ENTITY_U:
                                var returnState, buffer;
                                switch (this.state) {
                                  case S.TEXT_ENTITY:
                                    returnState = S.TEXT, buffer = "textNode";
                                    break;

                                  case S.ATTRIB_VALUE_ENTITY_Q:
                                    returnState = S.ATTRIB_VALUE_QUOTED, buffer = "attribValue";
                                    break;

                                  case S.ATTRIB_VALUE_ENTITY_U:
                                    returnState = S.ATTRIB_VALUE_UNQUOTED, buffer = "attribValue";
                                }
                                ";" === c ? (this[buffer] += parseEntity(this), this.entity = "", this.state = returnState) : isMatch(this.entity.length ? entityBody : entityStart, c) ? this.entity += c : (strictFail(this, "Invalid character in entity name"), 
                                this[buffer] += "&" + this.entity + c, this.entity = "", this.state = returnState);
                                continue;

                              default:
                                throw new Error(this, "Unknown state: " + this.state);
                            }
                            this.position >= this.bufferCheckPosition && function(parser) {
                                for (var maxAllowed = Math.max(sax.MAX_BUFFER_LENGTH, 10), maxActual = 0, i = 0, l = buffers.length; i < l; i++) {
                                    var len = parser[buffers[i]].length;
                                    if (maxAllowed < len) switch (buffers[i]) {
                                      case "textNode":
                                        closeText(parser);
                                        break;

                                      case "cdata":
                                        emitNode(parser, "oncdata", parser.cdata), parser.cdata = "";
                                        break;

                                      case "script":
                                        emitNode(parser, "onscript", parser.script), parser.script = "";
                                        break;

                                      default:
                                        error(parser, "Max buffer length exceeded: " + buffers[i]);
                                    }
                                    maxActual = Math.max(maxActual, len);
                                }
                                var m = sax.MAX_BUFFER_LENGTH - maxActual;
                                parser.bufferCheckPosition = m + parser.position;
                            }(this);
                            return this;
                        },
                        resume: function() {
                            return this.error = null, this;
                        },
                        close: function() {
                            return this.write(null);
                        },
                        flush: function() {
                            var parser;
                            closeText(parser = this), "" !== parser.cdata && (emitNode(parser, "oncdata", parser.cdata), 
                            parser.cdata = ""), "" !== parser.script && (emitNode(parser, "onscript", parser.script), 
                            parser.script = "");
                        }
                    };
                    try {
                        Stream = require("stream").Stream;
                    } catch (ex) {
                        Stream = function() {};
                    }
                    var streamWraps = sax.EVENTS.filter(function(ev) {
                        return "error" !== ev && "end" !== ev;
                    });
                    function SAXStream(strict, opt) {
                        if (!(this instanceof SAXStream)) return new SAXStream(strict, opt);
                        Stream.apply(this), this._parser = new SAXParser(strict, opt), this.writable = !0, 
                        this.readable = !0;
                        var me = this;
                        this._parser.onend = function() {
                            me.emit("end");
                        }, this._parser.onerror = function(er) {
                            me.emit("error", er), me._parser.error = null;
                        }, this._decoder = null, streamWraps.forEach(function(ev) {
                            Object.defineProperty(me, "on" + ev, {
                                get: function() {
                                    return me._parser["on" + ev];
                                },
                                set: function(h) {
                                    if (!h) return me.removeAllListeners(ev), me._parser["on" + ev] = h;
                                    me.on(ev, h);
                                },
                                enumerable: !0,
                                configurable: !1
                            });
                        });
                    }
                    (SAXStream.prototype = Object.create(Stream.prototype, {
                        constructor: {
                            value: SAXStream
                        }
                    })).write = function(data) {
                        if ("function" == typeof Buffer && "function" == typeof Buffer.isBuffer && Buffer.isBuffer(data)) {
                            if (!this._decoder) {
                                var SD = require("string_decoder").StringDecoder;
                                this._decoder = new SD("utf8");
                            }
                            data = this._decoder.write(data);
                        }
                        return this._parser.write(data.toString()), this.emit("data", data), !0;
                    }, SAXStream.prototype.end = function(chunk) {
                        return chunk && chunk.length && this.write(chunk), this._parser.end(), !0;
                    }, SAXStream.prototype.on = function(ev, handler) {
                        var me = this;
                        return me._parser["on" + ev] || -1 === streamWraps.indexOf(ev) || (me._parser["on" + ev] = function() {
                            var args = 1 === arguments.length ? [ arguments[0] ] : Array.apply(null, arguments);
                            args.splice(0, 0, ev), me.emit.apply(me, args);
                        }), Stream.prototype.on.call(me, ev, handler);
                    };
                    var CDATA = "[CDATA[", DOCTYPE = "DOCTYPE", XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace", XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/", rootNS = {
                        xml: XML_NAMESPACE,
                        xmlns: XMLNS_NAMESPACE
                    }, nameStart = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, nameBody = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, entityStart = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, entityBody = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
                    function isWhitespace(c) {
                        return " " === c || "\n" === c || "\r" === c || "\t" === c;
                    }
                    function isQuote(c) {
                        return '"' === c || "'" === c;
                    }
                    function isAttribEnd(c) {
                        return ">" === c || isWhitespace(c);
                    }
                    function isMatch(regex, c) {
                        return regex.test(c);
                    }
                    function notMatch(regex, c) {
                        return !isMatch(regex, c);
                    }
                    var stringFromCharCode, floor, fromCodePoint, S = 0;
                    for (var s in sax.STATE = {
                        BEGIN: S++,
                        BEGIN_WHITESPACE: S++,
                        TEXT: S++,
                        TEXT_ENTITY: S++,
                        OPEN_WAKA: S++,
                        SGML_DECL: S++,
                        SGML_DECL_QUOTED: S++,
                        DOCTYPE: S++,
                        DOCTYPE_QUOTED: S++,
                        DOCTYPE_DTD: S++,
                        DOCTYPE_DTD_QUOTED: S++,
                        COMMENT_STARTING: S++,
                        COMMENT: S++,
                        COMMENT_ENDING: S++,
                        COMMENT_ENDED: S++,
                        CDATA: S++,
                        CDATA_ENDING: S++,
                        CDATA_ENDING_2: S++,
                        PROC_INST: S++,
                        PROC_INST_BODY: S++,
                        PROC_INST_ENDING: S++,
                        OPEN_TAG: S++,
                        OPEN_TAG_SLASH: S++,
                        ATTRIB: S++,
                        ATTRIB_NAME: S++,
                        ATTRIB_NAME_SAW_WHITE: S++,
                        ATTRIB_VALUE: S++,
                        ATTRIB_VALUE_QUOTED: S++,
                        ATTRIB_VALUE_CLOSED: S++,
                        ATTRIB_VALUE_UNQUOTED: S++,
                        ATTRIB_VALUE_ENTITY_Q: S++,
                        ATTRIB_VALUE_ENTITY_U: S++,
                        CLOSE_TAG: S++,
                        CLOSE_TAG_SAW_WHITE: S++,
                        SCRIPT: S++,
                        SCRIPT_ENDING: S++
                    }, sax.XML_ENTITIES = {
                        amp: "&",
                        gt: ">",
                        lt: "<",
                        quot: '"',
                        apos: "'"
                    }, sax.ENTITIES = {
                        amp: "&",
                        gt: ">",
                        lt: "<",
                        quot: '"',
                        apos: "'",
                        AElig: 198,
                        Aacute: 193,
                        Acirc: 194,
                        Agrave: 192,
                        Aring: 197,
                        Atilde: 195,
                        Auml: 196,
                        Ccedil: 199,
                        ETH: 208,
                        Eacute: 201,
                        Ecirc: 202,
                        Egrave: 200,
                        Euml: 203,
                        Iacute: 205,
                        Icirc: 206,
                        Igrave: 204,
                        Iuml: 207,
                        Ntilde: 209,
                        Oacute: 211,
                        Ocirc: 212,
                        Ograve: 210,
                        Oslash: 216,
                        Otilde: 213,
                        Ouml: 214,
                        THORN: 222,
                        Uacute: 218,
                        Ucirc: 219,
                        Ugrave: 217,
                        Uuml: 220,
                        Yacute: 221,
                        aacute: 225,
                        acirc: 226,
                        aelig: 230,
                        agrave: 224,
                        aring: 229,
                        atilde: 227,
                        auml: 228,
                        ccedil: 231,
                        eacute: 233,
                        ecirc: 234,
                        egrave: 232,
                        eth: 240,
                        euml: 235,
                        iacute: 237,
                        icirc: 238,
                        igrave: 236,
                        iuml: 239,
                        ntilde: 241,
                        oacute: 243,
                        ocirc: 244,
                        ograve: 242,
                        oslash: 248,
                        otilde: 245,
                        ouml: 246,
                        szlig: 223,
                        thorn: 254,
                        uacute: 250,
                        ucirc: 251,
                        ugrave: 249,
                        uuml: 252,
                        yacute: 253,
                        yuml: 255,
                        copy: 169,
                        reg: 174,
                        nbsp: 160,
                        iexcl: 161,
                        cent: 162,
                        pound: 163,
                        curren: 164,
                        yen: 165,
                        brvbar: 166,
                        sect: 167,
                        uml: 168,
                        ordf: 170,
                        laquo: 171,
                        not: 172,
                        shy: 173,
                        macr: 175,
                        deg: 176,
                        plusmn: 177,
                        sup1: 185,
                        sup2: 178,
                        sup3: 179,
                        acute: 180,
                        micro: 181,
                        para: 182,
                        middot: 183,
                        cedil: 184,
                        ordm: 186,
                        raquo: 187,
                        frac14: 188,
                        frac12: 189,
                        frac34: 190,
                        iquest: 191,
                        times: 215,
                        divide: 247,
                        OElig: 338,
                        oelig: 339,
                        Scaron: 352,
                        scaron: 353,
                        Yuml: 376,
                        fnof: 402,
                        circ: 710,
                        tilde: 732,
                        Alpha: 913,
                        Beta: 914,
                        Gamma: 915,
                        Delta: 916,
                        Epsilon: 917,
                        Zeta: 918,
                        Eta: 919,
                        Theta: 920,
                        Iota: 921,
                        Kappa: 922,
                        Lambda: 923,
                        Mu: 924,
                        Nu: 925,
                        Xi: 926,
                        Omicron: 927,
                        Pi: 928,
                        Rho: 929,
                        Sigma: 931,
                        Tau: 932,
                        Upsilon: 933,
                        Phi: 934,
                        Chi: 935,
                        Psi: 936,
                        Omega: 937,
                        alpha: 945,
                        beta: 946,
                        gamma: 947,
                        delta: 948,
                        epsilon: 949,
                        zeta: 950,
                        eta: 951,
                        theta: 952,
                        iota: 953,
                        kappa: 954,
                        lambda: 955,
                        mu: 956,
                        nu: 957,
                        xi: 958,
                        omicron: 959,
                        pi: 960,
                        rho: 961,
                        sigmaf: 962,
                        sigma: 963,
                        tau: 964,
                        upsilon: 965,
                        phi: 966,
                        chi: 967,
                        psi: 968,
                        omega: 969,
                        thetasym: 977,
                        upsih: 978,
                        piv: 982,
                        ensp: 8194,
                        emsp: 8195,
                        thinsp: 8201,
                        zwnj: 8204,
                        zwj: 8205,
                        lrm: 8206,
                        rlm: 8207,
                        ndash: 8211,
                        mdash: 8212,
                        lsquo: 8216,
                        rsquo: 8217,
                        sbquo: 8218,
                        ldquo: 8220,
                        rdquo: 8221,
                        bdquo: 8222,
                        dagger: 8224,
                        Dagger: 8225,
                        bull: 8226,
                        hellip: 8230,
                        permil: 8240,
                        prime: 8242,
                        Prime: 8243,
                        lsaquo: 8249,
                        rsaquo: 8250,
                        oline: 8254,
                        frasl: 8260,
                        euro: 8364,
                        image: 8465,
                        weierp: 8472,
                        real: 8476,
                        trade: 8482,
                        alefsym: 8501,
                        larr: 8592,
                        uarr: 8593,
                        rarr: 8594,
                        darr: 8595,
                        harr: 8596,
                        crarr: 8629,
                        lArr: 8656,
                        uArr: 8657,
                        rArr: 8658,
                        dArr: 8659,
                        hArr: 8660,
                        forall: 8704,
                        part: 8706,
                        exist: 8707,
                        empty: 8709,
                        nabla: 8711,
                        isin: 8712,
                        notin: 8713,
                        ni: 8715,
                        prod: 8719,
                        sum: 8721,
                        minus: 8722,
                        lowast: 8727,
                        radic: 8730,
                        prop: 8733,
                        infin: 8734,
                        ang: 8736,
                        and: 8743,
                        or: 8744,
                        cap: 8745,
                        cup: 8746,
                        int: 8747,
                        there4: 8756,
                        sim: 8764,
                        cong: 8773,
                        asymp: 8776,
                        ne: 8800,
                        equiv: 8801,
                        le: 8804,
                        ge: 8805,
                        sub: 8834,
                        sup: 8835,
                        nsub: 8836,
                        sube: 8838,
                        supe: 8839,
                        oplus: 8853,
                        otimes: 8855,
                        perp: 8869,
                        sdot: 8901,
                        lceil: 8968,
                        rceil: 8969,
                        lfloor: 8970,
                        rfloor: 8971,
                        lang: 9001,
                        rang: 9002,
                        loz: 9674,
                        spades: 9824,
                        clubs: 9827,
                        hearts: 9829,
                        diams: 9830
                    }, Object.keys(sax.ENTITIES).forEach(function(key) {
                        var e = sax.ENTITIES[key], s = "number" == typeof e ? String.fromCharCode(e) : e;
                        sax.ENTITIES[key] = s;
                    }), sax.STATE) sax.STATE[sax.STATE[s]] = s;
                    function emit(parser, event, data) {
                        parser[event] && parser[event](data);
                    }
                    function emitNode(parser, nodeType, data) {
                        parser.textNode && closeText(parser), emit(parser, nodeType, data);
                    }
                    function closeText(parser) {
                        parser.textNode = textopts(parser.opt, parser.textNode), parser.textNode && emit(parser, "ontext", parser.textNode), 
                        parser.textNode = "";
                    }
                    function textopts(opt, text) {
                        return opt.trim && (text = text.trim()), opt.normalize && (text = text.replace(/\s+/g, " ")), 
                        text;
                    }
                    function error(parser, er) {
                        return closeText(parser), parser.trackPosition && (er += "\nLine: " + parser.line + "\nColumn: " + parser.column + "\nChar: " + parser.c), 
                        er = new Error(er), parser.error = er, emit(parser, "onerror", er), parser;
                    }
                    function end(parser) {
                        return parser.sawRoot && !parser.closedRoot && strictFail(parser, "Unclosed root tag"), 
                        parser.state !== S.BEGIN && parser.state !== S.BEGIN_WHITESPACE && parser.state !== S.TEXT && error(parser, "Unexpected end"), 
                        closeText(parser), parser.c = "", parser.closed = !0, emit(parser, "onend"), SAXParser.call(parser, parser.strict, parser.opt), 
                        parser;
                    }
                    function strictFail(parser, message) {
                        if ("object" != typeof parser || !(parser instanceof SAXParser)) throw new Error("bad call to strictFail");
                        parser.strict && error(parser, message);
                    }
                    function newTag(parser) {
                        parser.strict || (parser.tagName = parser.tagName[parser.looseCase]());
                        var parent = parser.tags[parser.tags.length - 1] || parser, tag = parser.tag = {
                            name: parser.tagName,
                            attributes: {}
                        };
                        parser.opt.xmlns && (tag.ns = parent.ns), parser.attribList.length = 0, emitNode(parser, "onopentagstart", tag);
                    }
                    function qname(name, attribute) {
                        var qualName = name.indexOf(":") < 0 ? [ "", name ] : name.split(":"), prefix = qualName[0], local = qualName[1];
                        return attribute && "xmlns" === name && (prefix = "xmlns", local = ""), {
                            prefix: prefix,
                            local: local
                        };
                    }
                    function attrib(parser) {
                        if (parser.strict || (parser.attribName = parser.attribName[parser.looseCase]()), 
                        -1 !== parser.attribList.indexOf(parser.attribName) || parser.tag.attributes.hasOwnProperty(parser.attribName)) parser.attribName = parser.attribValue = ""; else {
                            if (parser.opt.xmlns) {
                                var qn = qname(parser.attribName, !0), prefix = qn.prefix, local = qn.local;
                                if ("xmlns" === prefix) if ("xml" === local && parser.attribValue !== XML_NAMESPACE) strictFail(parser, "xml: prefix must be bound to " + XML_NAMESPACE + "\nActual: " + parser.attribValue); else if ("xmlns" === local && parser.attribValue !== XMLNS_NAMESPACE) strictFail(parser, "xmlns: prefix must be bound to " + XMLNS_NAMESPACE + "\nActual: " + parser.attribValue); else {
                                    var tag = parser.tag, parent = parser.tags[parser.tags.length - 1] || parser;
                                    tag.ns === parent.ns && (tag.ns = Object.create(parent.ns)), tag.ns[local] = parser.attribValue;
                                }
                                parser.attribList.push([ parser.attribName, parser.attribValue ]);
                            } else parser.tag.attributes[parser.attribName] = parser.attribValue, emitNode(parser, "onattribute", {
                                name: parser.attribName,
                                value: parser.attribValue
                            });
                            parser.attribName = parser.attribValue = "";
                        }
                    }
                    function openTag(parser, selfClosing) {
                        if (parser.opt.xmlns) {
                            var tag = parser.tag, qn = qname(parser.tagName);
                            tag.prefix = qn.prefix, tag.local = qn.local, tag.uri = tag.ns[qn.prefix] || "", 
                            tag.prefix && !tag.uri && (strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(parser.tagName)), 
                            tag.uri = qn.prefix);
                            var parent = parser.tags[parser.tags.length - 1] || parser;
                            tag.ns && parent.ns !== tag.ns && Object.keys(tag.ns).forEach(function(p) {
                                emitNode(parser, "onopennamespace", {
                                    prefix: p,
                                    uri: tag.ns[p]
                                });
                            });
                            for (var i = 0, l = parser.attribList.length; i < l; i++) {
                                var nv = parser.attribList[i], name = nv[0], value = nv[1], qualName = qname(name, !0), prefix = qualName.prefix, local = qualName.local, uri = "" === prefix ? "" : tag.ns[prefix] || "", a = {
                                    name: name,
                                    value: value,
                                    prefix: prefix,
                                    local: local,
                                    uri: uri
                                };
                                prefix && "xmlns" !== prefix && !uri && (strictFail(parser, "Unbound namespace prefix: " + JSON.stringify(prefix)), 
                                a.uri = prefix), parser.tag.attributes[name] = a, emitNode(parser, "onattribute", a);
                            }
                            parser.attribList.length = 0;
                        }
                        parser.tag.isSelfClosing = !!selfClosing, parser.sawRoot = !0, parser.tags.push(parser.tag), 
                        emitNode(parser, "onopentag", parser.tag), selfClosing || (parser.noscript || "script" !== parser.tagName.toLowerCase() ? parser.state = S.TEXT : parser.state = S.SCRIPT, 
                        parser.tag = null, parser.tagName = ""), parser.attribName = parser.attribValue = "", 
                        parser.attribList.length = 0;
                    }
                    function closeTag(parser) {
                        if (!parser.tagName) return strictFail(parser, "Weird empty close tag."), parser.textNode += "</>", 
                        void (parser.state = S.TEXT);
                        if (parser.script) {
                            if ("script" !== parser.tagName) return parser.script += "</" + parser.tagName + ">", 
                            parser.tagName = "", void (parser.state = S.SCRIPT);
                            emitNode(parser, "onscript", parser.script), parser.script = "";
                        }
                        var t = parser.tags.length, tagName = parser.tagName;
                        parser.strict || (tagName = tagName[parser.looseCase]());
                        for (var closeTo = tagName; t--; ) {
                            if (parser.tags[t].name === closeTo) break;
                            strictFail(parser, "Unexpected close tag");
                        }
                        if (t < 0) return strictFail(parser, "Unmatched closing tag: " + parser.tagName), 
                        parser.textNode += "</" + parser.tagName + ">", void (parser.state = S.TEXT);
                        parser.tagName = tagName;
                        for (var s = parser.tags.length; s-- > t; ) {
                            var tag = parser.tag = parser.tags.pop();
                            parser.tagName = parser.tag.name, emitNode(parser, "onclosetag", parser.tagName);
                            var x = {};
                            for (var i in tag.ns) x[i] = tag.ns[i];
                            var parent = parser.tags[parser.tags.length - 1] || parser;
                            parser.opt.xmlns && tag.ns !== parent.ns && Object.keys(tag.ns).forEach(function(p) {
                                var n = tag.ns[p];
                                emitNode(parser, "onclosenamespace", {
                                    prefix: p,
                                    uri: n
                                });
                            });
                        }
                        0 === t && (parser.closedRoot = !0), parser.tagName = parser.attribValue = parser.attribName = "", 
                        parser.attribList.length = 0, parser.state = S.TEXT;
                    }
                    function parseEntity(parser) {
                        var num, entity = parser.entity, entityLC = entity.toLowerCase(), numStr = "";
                        return parser.ENTITIES[entity] ? parser.ENTITIES[entity] : parser.ENTITIES[entityLC] ? parser.ENTITIES[entityLC] : ("#" === (entity = entityLC).charAt(0) && ("x" === entity.charAt(1) ? (entity = entity.slice(2), 
                        numStr = (num = parseInt(entity, 16)).toString(16)) : (entity = entity.slice(1), 
                        numStr = (num = parseInt(entity, 10)).toString(10))), entity = entity.replace(/^0+/, ""), 
                        isNaN(num) || numStr.toLowerCase() !== entity ? (strictFail(parser, "Invalid character entity"), 
                        "&" + parser.entity + ";") : String.fromCodePoint(num));
                    }
                    function beginWhiteSpace(parser, c) {
                        "<" === c ? (parser.state = S.OPEN_WAKA, parser.startTagPosition = parser.position) : isWhitespace(c) || (strictFail(parser, "Non-whitespace before first tag."), 
                        parser.textNode = c, parser.state = S.TEXT);
                    }
                    function charAt(chunk, i) {
                        var result = "";
                        return i < chunk.length && (result = chunk.charAt(i)), result;
                    }
                    S = sax.STATE, String.fromCodePoint || (stringFromCharCode = String.fromCharCode, 
                    floor = Math.floor, fromCodePoint = function() {
                        var highSurrogate, lowSurrogate, codeUnits = [], index = -1, length = arguments.length;
                        if (!length) return "";
                        for (var result = ""; ++index < length; ) {
                            var codePoint = Number(arguments[index]);
                            if (!isFinite(codePoint) || codePoint < 0 || 1114111 < codePoint || floor(codePoint) !== codePoint) throw RangeError("Invalid code point: " + codePoint);
                            codePoint <= 65535 ? codeUnits.push(codePoint) : (highSurrogate = 55296 + ((codePoint -= 65536) >> 10), 
                            lowSurrogate = codePoint % 1024 + 56320, codeUnits.push(highSurrogate, lowSurrogate)), 
                            (index + 1 === length || 16384 < codeUnits.length) && (result += stringFromCharCode.apply(null, codeUnits), 
                            codeUnits.length = 0);
                        }
                        return result;
                    }, Object.defineProperty ? Object.defineProperty(String, "fromCodePoint", {
                        value: fromCodePoint,
                        configurable: !0,
                        writable: !0
                    }) : String.fromCodePoint = fromCodePoint);
                }(void 0 === exports ? this.sax = {} : exports);
            }).call(this, require("buffer").Buffer);
        }, {
            buffer: 77,
            stream: 254,
            string_decoder: 74
        } ],
        246: [ function(require, module, exports) {
            var Buffer = require("safe-buffer").Buffer;
            function Hash(blockSize, finalSize) {
                this._block = Buffer.alloc(blockSize), this._finalSize = finalSize, this._blockSize = blockSize, 
                this._len = 0;
            }
            Hash.prototype.update = function(data, enc) {
                "string" == typeof data && (enc = enc || "utf8", data = Buffer.from(data, enc));
                for (var block = this._block, blockSize = this._blockSize, length = data.length, accum = this._len, offset = 0; offset < length; ) {
                    for (var assigned = accum % blockSize, remainder = Math.min(length - offset, blockSize - assigned), i = 0; i < remainder; i++) block[assigned + i] = data[offset + i];
                    offset += remainder, (accum += remainder) % blockSize == 0 && this._update(block);
                }
                return this._len += length, this;
            }, Hash.prototype.digest = function(enc) {
                var rem = this._len % this._blockSize;
                this._block[rem] = 128, this._block.fill(0, rem + 1), rem >= this._finalSize && (this._update(this._block), 
                this._block.fill(0));
                var bits = 8 * this._len;
                if (bits <= 4294967295) this._block.writeUInt32BE(bits, this._blockSize - 4); else {
                    var lowBits = 4294967295 & bits, highBits = (bits - lowBits) / 4294967296;
                    this._block.writeUInt32BE(highBits, this._blockSize - 8), this._block.writeUInt32BE(lowBits, this._blockSize - 4);
                }
                this._update(this._block);
                var hash = this._hash();
                return enc ? hash.toString(enc) : hash;
            }, Hash.prototype._update = function() {
                throw new Error("_update must be implemented by subclass");
            }, module.exports = Hash;
        }, {
            "safe-buffer": 244
        } ],
        247: [ function(require, module, exports) {
            (exports = module.exports = function(algorithm) {
                algorithm = algorithm.toLowerCase();
                var Algorithm = exports[algorithm];
                if (!Algorithm) throw new Error(algorithm + " is not supported (we accept pull requests)");
                return new Algorithm();
            }).sha = require("./sha"), exports.sha1 = require("./sha1"), exports.sha224 = require("./sha224"), 
            exports.sha256 = require("./sha256"), exports.sha384 = require("./sha384"), exports.sha512 = require("./sha512");
        }, {
            "./sha": 248,
            "./sha1": 249,
            "./sha224": 250,
            "./sha256": 251,
            "./sha384": 252,
            "./sha512": 253
        } ],
        248: [ function(require, module, exports) {
            var inherits = require("inherits"), Hash = require("./hash"), Buffer = require("safe-buffer").Buffer, K = [ 1518500249, 1859775393, -1894007588, -899497514 ], W = new Array(80);
            function Sha() {
                this.init(), this._w = W, Hash.call(this, 64, 56);
            }
            function rotl30(num) {
                return num << 30 | num >>> 2;
            }
            function ft(s, b, c, d) {
                return 0 === s ? b & c | ~b & d : 2 === s ? b & c | b & d | c & d : b ^ c ^ d;
            }
            inherits(Sha, Hash), Sha.prototype.init = function() {
                return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, 
                this._e = 3285377520, this;
            }, Sha.prototype._update = function(M) {
                for (var num, W = this._w, a = 0 | this._a, b = 0 | this._b, c = 0 | this._c, d = 0 | this._d, e = 0 | this._e, i = 0; i < 16; ++i) W[i] = M.readInt32BE(4 * i);
                for (;i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];
                for (var j = 0; j < 80; ++j) {
                    var s = ~~(j / 20), t = 0 | ((num = a) << 5 | num >>> 27) + ft(s, b, c, d) + e + W[j] + K[s];
                    e = d, d = c, c = rotl30(b), b = a, a = t;
                }
                this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, 
                this._d = d + this._d | 0, this._e = e + this._e | 0;
            }, Sha.prototype._hash = function() {
                var H = Buffer.allocUnsafe(20);
                return H.writeInt32BE(0 | this._a, 0), H.writeInt32BE(0 | this._b, 4), H.writeInt32BE(0 | this._c, 8), 
                H.writeInt32BE(0 | this._d, 12), H.writeInt32BE(0 | this._e, 16), H;
            }, module.exports = Sha;
        }, {
            "./hash": 246,
            inherits: 152,
            "safe-buffer": 244
        } ],
        249: [ function(require, module, exports) {
            var inherits = require("inherits"), Hash = require("./hash"), Buffer = require("safe-buffer").Buffer, K = [ 1518500249, 1859775393, -1894007588, -899497514 ], W = new Array(80);
            function Sha1() {
                this.init(), this._w = W, Hash.call(this, 64, 56);
            }
            function rotl5(num) {
                return num << 5 | num >>> 27;
            }
            function rotl30(num) {
                return num << 30 | num >>> 2;
            }
            function ft(s, b, c, d) {
                return 0 === s ? b & c | ~b & d : 2 === s ? b & c | b & d | c & d : b ^ c ^ d;
            }
            inherits(Sha1, Hash), Sha1.prototype.init = function() {
                return this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, 
                this._e = 3285377520, this;
            }, Sha1.prototype._update = function(M) {
                for (var num, W = this._w, a = 0 | this._a, b = 0 | this._b, c = 0 | this._c, d = 0 | this._d, e = 0 | this._e, i = 0; i < 16; ++i) W[i] = M.readInt32BE(4 * i);
                for (;i < 80; ++i) W[i] = (num = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]) << 1 | num >>> 31;
                for (var j = 0; j < 80; ++j) {
                    var s = ~~(j / 20), t = rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s] | 0;
                    e = d, d = c, c = rotl30(b), b = a, a = t;
                }
                this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, 
                this._d = d + this._d | 0, this._e = e + this._e | 0;
            }, Sha1.prototype._hash = function() {
                var H = Buffer.allocUnsafe(20);
                return H.writeInt32BE(0 | this._a, 0), H.writeInt32BE(0 | this._b, 4), H.writeInt32BE(0 | this._c, 8), 
                H.writeInt32BE(0 | this._d, 12), H.writeInt32BE(0 | this._e, 16), H;
            }, module.exports = Sha1;
        }, {
            "./hash": 246,
            inherits: 152,
            "safe-buffer": 244
        } ],
        250: [ function(require, module, exports) {
            var inherits = require("inherits"), Sha256 = require("./sha256"), Hash = require("./hash"), Buffer = require("safe-buffer").Buffer, W = new Array(64);
            function Sha224() {
                this.init(), this._w = W, Hash.call(this, 64, 56);
            }
            inherits(Sha224, Sha256), Sha224.prototype.init = function() {
                return this._a = 3238371032, this._b = 914150663, this._c = 812702999, this._d = 4144912697, 
                this._e = 4290775857, this._f = 1750603025, this._g = 1694076839, this._h = 3204075428, 
                this;
            }, Sha224.prototype._hash = function() {
                var H = Buffer.allocUnsafe(28);
                return H.writeInt32BE(this._a, 0), H.writeInt32BE(this._b, 4), H.writeInt32BE(this._c, 8), 
                H.writeInt32BE(this._d, 12), H.writeInt32BE(this._e, 16), H.writeInt32BE(this._f, 20), 
                H.writeInt32BE(this._g, 24), H;
            }, module.exports = Sha224;
        }, {
            "./hash": 246,
            "./sha256": 251,
            inherits: 152,
            "safe-buffer": 244
        } ],
        251: [ function(require, module, exports) {
            var inherits = require("inherits"), Hash = require("./hash"), Buffer = require("safe-buffer").Buffer, K = [ 1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298 ], W = new Array(64);
            function Sha256() {
                this.init(), this._w = W, Hash.call(this, 64, 56);
            }
            function ch(x, y, z) {
                return z ^ x & (y ^ z);
            }
            function maj(x, y, z) {
                return x & y | z & (x | y);
            }
            function sigma0(x) {
                return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10);
            }
            function sigma1(x) {
                return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7);
            }
            function gamma0(x) {
                return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ x >>> 3;
            }
            inherits(Sha256, Hash), Sha256.prototype.init = function() {
                return this._a = 1779033703, this._b = 3144134277, this._c = 1013904242, this._d = 2773480762, 
                this._e = 1359893119, this._f = 2600822924, this._g = 528734635, this._h = 1541459225, 
                this;
            }, Sha256.prototype._update = function(M) {
                for (var x, W = this._w, a = 0 | this._a, b = 0 | this._b, c = 0 | this._c, d = 0 | this._d, e = 0 | this._e, f = 0 | this._f, g = 0 | this._g, h = 0 | this._h, i = 0; i < 16; ++i) W[i] = M.readInt32BE(4 * i);
                for (;i < 64; ++i) W[i] = 0 | (((x = W[i - 2]) >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ x >>> 10) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16];
                for (var j = 0; j < 64; ++j) {
                    var T1 = h + sigma1(e) + ch(e, f, g) + K[j] + W[j] | 0, T2 = sigma0(a) + maj(a, b, c) | 0;
                    h = g, g = f, f = e, e = d + T1 | 0, d = c, c = b, b = a, a = T1 + T2 | 0;
                }
                this._a = a + this._a | 0, this._b = b + this._b | 0, this._c = c + this._c | 0, 
                this._d = d + this._d | 0, this._e = e + this._e | 0, this._f = f + this._f | 0, 
                this._g = g + this._g | 0, this._h = h + this._h | 0;
            }, Sha256.prototype._hash = function() {
                var H = Buffer.allocUnsafe(32);
                return H.writeInt32BE(this._a, 0), H.writeInt32BE(this._b, 4), H.writeInt32BE(this._c, 8), 
                H.writeInt32BE(this._d, 12), H.writeInt32BE(this._e, 16), H.writeInt32BE(this._f, 20), 
                H.writeInt32BE(this._g, 24), H.writeInt32BE(this._h, 28), H;
            }, module.exports = Sha256;
        }, {
            "./hash": 246,
            inherits: 152,
            "safe-buffer": 244
        } ],
        252: [ function(require, module, exports) {
            var inherits = require("inherits"), SHA512 = require("./sha512"), Hash = require("./hash"), Buffer = require("safe-buffer").Buffer, W = new Array(160);
            function Sha384() {
                this.init(), this._w = W, Hash.call(this, 128, 112);
            }
            inherits(Sha384, SHA512), Sha384.prototype.init = function() {
                return this._ah = 3418070365, this._bh = 1654270250, this._ch = 2438529370, this._dh = 355462360, 
                this._eh = 1731405415, this._fh = 2394180231, this._gh = 3675008525, this._hh = 1203062813, 
                this._al = 3238371032, this._bl = 914150663, this._cl = 812702999, this._dl = 4144912697, 
                this._el = 4290775857, this._fl = 1750603025, this._gl = 1694076839, this._hl = 3204075428, 
                this;
            }, Sha384.prototype._hash = function() {
                var H = Buffer.allocUnsafe(48);
                function writeInt64BE(h, l, offset) {
                    H.writeInt32BE(h, offset), H.writeInt32BE(l, offset + 4);
                }
                return writeInt64BE(this._ah, this._al, 0), writeInt64BE(this._bh, this._bl, 8), 
                writeInt64BE(this._ch, this._cl, 16), writeInt64BE(this._dh, this._dl, 24), writeInt64BE(this._eh, this._el, 32), 
                writeInt64BE(this._fh, this._fl, 40), H;
            }, module.exports = Sha384;
        }, {
            "./hash": 246,
            "./sha512": 253,
            inherits: 152,
            "safe-buffer": 244
        } ],
        253: [ function(require, module, exports) {
            var inherits = require("inherits"), Hash = require("./hash"), Buffer = require("safe-buffer").Buffer, K = [ 1116352408, 3609767458, 1899447441, 602891725, 3049323471, 3964484399, 3921009573, 2173295548, 961987163, 4081628472, 1508970993, 3053834265, 2453635748, 2937671579, 2870763221, 3664609560, 3624381080, 2734883394, 310598401, 1164996542, 607225278, 1323610764, 1426881987, 3590304994, 1925078388, 4068182383, 2162078206, 991336113, 2614888103, 633803317, 3248222580, 3479774868, 3835390401, 2666613458, 4022224774, 944711139, 264347078, 2341262773, 604807628, 2007800933, 770255983, 1495990901, 1249150122, 1856431235, 1555081692, 3175218132, 1996064986, 2198950837, 2554220882, 3999719339, 2821834349, 766784016, 2952996808, 2566594879, 3210313671, 3203337956, 3336571891, 1034457026, 3584528711, 2466948901, 113926993, 3758326383, 338241895, 168717936, 666307205, 1188179964, 773529912, 1546045734, 1294757372, 1522805485, 1396182291, 2643833823, 1695183700, 2343527390, 1986661051, 1014477480, 2177026350, 1206759142, 2456956037, 344077627, 2730485921, 1290863460, 2820302411, 3158454273, 3259730800, 3505952657, 3345764771, 106217008, 3516065817, 3606008344, 3600352804, 1432725776, 4094571909, 1467031594, 275423344, 851169720, 430227734, 3100823752, 506948616, 1363258195, 659060556, 3750685593, 883997877, 3785050280, 958139571, 3318307427, 1322822218, 3812723403, 1537002063, 2003034995, 1747873779, 3602036899, 1955562222, 1575990012, 2024104815, 1125592928, 2227730452, 2716904306, 2361852424, 442776044, 2428436474, 593698344, 2756734187, 3733110249, 3204031479, 2999351573, 3329325298, 3815920427, 3391569614, 3928383900, 3515267271, 566280711, 3940187606, 3454069534, 4118630271, 4000239992, 116418474, 1914138554, 174292421, 2731055270, 289380356, 3203993006, 460393269, 320620315, 685471733, 587496836, 852142971, 1086792851, 1017036298, 365543100, 1126000580, 2618297676, 1288033470, 3409855158, 1501505948, 4234509866, 1607167915, 987167468, 1816402316, 1246189591 ], W = new Array(160);
            function Sha512() {
                this.init(), this._w = W, Hash.call(this, 128, 112);
            }
            function Ch(x, y, z) {
                return z ^ x & (y ^ z);
            }
            function maj(x, y, z) {
                return x & y | z & (x | y);
            }
            function sigma0(x, xl) {
                return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25);
            }
            function sigma1(x, xl) {
                return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23);
            }
            function Gamma0(x, xl) {
                return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ x >>> 7;
            }
            function Gamma0l(x, xl) {
                return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25);
            }
            function Gamma1(x, xl) {
                return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ x >>> 6;
            }
            function Gamma1l(x, xl) {
                return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26);
            }
            function getCarry(a, b) {
                return a >>> 0 < b >>> 0 ? 1 : 0;
            }
            inherits(Sha512, Hash), Sha512.prototype.init = function() {
                return this._ah = 1779033703, this._bh = 3144134277, this._ch = 1013904242, this._dh = 2773480762, 
                this._eh = 1359893119, this._fh = 2600822924, this._gh = 528734635, this._hh = 1541459225, 
                this._al = 4089235720, this._bl = 2227873595, this._cl = 4271175723, this._dl = 1595750129, 
                this._el = 2917565137, this._fl = 725511199, this._gl = 4215389547, this._hl = 327033209, 
                this;
            }, Sha512.prototype._update = function(M) {
                for (var W = this._w, ah = 0 | this._ah, bh = 0 | this._bh, ch = 0 | this._ch, dh = 0 | this._dh, eh = 0 | this._eh, fh = 0 | this._fh, gh = 0 | this._gh, hh = 0 | this._hh, al = 0 | this._al, bl = 0 | this._bl, cl = 0 | this._cl, dl = 0 | this._dl, el = 0 | this._el, fl = 0 | this._fl, gl = 0 | this._gl, hl = 0 | this._hl, i = 0; i < 32; i += 2) W[i] = M.readInt32BE(4 * i), 
                W[i + 1] = M.readInt32BE(4 * i + 4);
                for (;i < 160; i += 2) {
                    var xh = W[i - 30], xl = W[i - 30 + 1], gamma0 = Gamma0(xh, xl), gamma0l = Gamma0l(xl, xh), gamma1 = Gamma1(xh = W[i - 4], xl = W[i - 4 + 1]), gamma1l = Gamma1l(xl, xh), Wi7h = W[i - 14], Wi7l = W[i - 14 + 1], Wi16h = W[i - 32], Wi16l = W[i - 32 + 1], Wil = gamma0l + Wi7l | 0, Wih = gamma0 + Wi7h + getCarry(Wil, gamma0l) | 0;
                    Wih = (Wih = Wih + gamma1 + getCarry(Wil = Wil + gamma1l | 0, gamma1l) | 0) + Wi16h + getCarry(Wil = Wil + Wi16l | 0, Wi16l) | 0, 
                    W[i] = Wih, W[i + 1] = Wil;
                }
                for (var j = 0; j < 160; j += 2) {
                    Wih = W[j], Wil = W[j + 1];
                    var majh = maj(ah, bh, ch), majl = maj(al, bl, cl), sigma0h = sigma0(ah, al), sigma0l = sigma0(al, ah), sigma1h = sigma1(eh, el), sigma1l = sigma1(el, eh), Kih = K[j], Kil = K[j + 1], chh = Ch(eh, fh, gh), chl = Ch(el, fl, gl), t1l = hl + sigma1l | 0, t1h = hh + sigma1h + getCarry(t1l, hl) | 0;
                    t1h = (t1h = (t1h = t1h + chh + getCarry(t1l = t1l + chl | 0, chl) | 0) + Kih + getCarry(t1l = t1l + Kil | 0, Kil) | 0) + Wih + getCarry(t1l = t1l + Wil | 0, Wil) | 0;
                    var t2l = sigma0l + majl | 0, t2h = sigma0h + majh + getCarry(t2l, sigma0l) | 0;
                    hh = gh, hl = gl, gh = fh, gl = fl, fh = eh, fl = el, eh = dh + t1h + getCarry(el = dl + t1l | 0, dl) | 0, 
                    dh = ch, dl = cl, ch = bh, cl = bl, bh = ah, bl = al, ah = t1h + t2h + getCarry(al = t1l + t2l | 0, t1l) | 0;
                }
                this._al = this._al + al | 0, this._bl = this._bl + bl | 0, this._cl = this._cl + cl | 0, 
                this._dl = this._dl + dl | 0, this._el = this._el + el | 0, this._fl = this._fl + fl | 0, 
                this._gl = this._gl + gl | 0, this._hl = this._hl + hl | 0, this._ah = this._ah + ah + getCarry(this._al, al) | 0, 
                this._bh = this._bh + bh + getCarry(this._bl, bl) | 0, this._ch = this._ch + ch + getCarry(this._cl, cl) | 0, 
                this._dh = this._dh + dh + getCarry(this._dl, dl) | 0, this._eh = this._eh + eh + getCarry(this._el, el) | 0, 
                this._fh = this._fh + fh + getCarry(this._fl, fl) | 0, this._gh = this._gh + gh + getCarry(this._gl, gl) | 0, 
                this._hh = this._hh + hh + getCarry(this._hl, hl) | 0;
            }, Sha512.prototype._hash = function() {
                var H = Buffer.allocUnsafe(64);
                function writeInt64BE(h, l, offset) {
                    H.writeInt32BE(h, offset), H.writeInt32BE(l, offset + 4);
                }
                return writeInt64BE(this._ah, this._al, 0), writeInt64BE(this._bh, this._bl, 8), 
                writeInt64BE(this._ch, this._cl, 16), writeInt64BE(this._dh, this._dl, 24), writeInt64BE(this._eh, this._el, 32), 
                writeInt64BE(this._fh, this._fl, 40), writeInt64BE(this._gh, this._gl, 48), writeInt64BE(this._hh, this._hl, 56), 
                H;
            }, module.exports = Sha512;
        }, {
            "./hash": 246,
            inherits: 152,
            "safe-buffer": 244
        } ],
        254: [ function(require, module, exports) {
            module.exports = Stream;
            var EE = require("events").EventEmitter;
            function Stream() {
                EE.call(this);
            }
            require("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).prototype.pipe = function(dest, options) {
                var source = this;
                function ondata(chunk) {
                    dest.writable && !1 === dest.write(chunk) && source.pause && source.pause();
                }
                function ondrain() {
                    source.readable && source.resume && source.resume();
                }
                source.on("data", ondata), dest.on("drain", ondrain), dest._isStdio || options && !1 === options.end || (source.on("end", onend), 
                source.on("close", onclose));
                var didOnEnd = !1;
                function onend() {
                    didOnEnd || (didOnEnd = !0, dest.end());
                }
                function onclose() {
                    didOnEnd || (didOnEnd = !0, "function" == typeof dest.destroy && dest.destroy());
                }
                function onerror(er) {
                    if (cleanup(), 0 === EE.listenerCount(this, "error")) throw er;
                }
                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);
                }
                return source.on("error", onerror), dest.on("error", onerror), source.on("end", cleanup), 
                source.on("close", cleanup), dest.on("close", cleanup), dest.emit("pipe", source), 
                dest;
            };
        }, {
            events: 73,
            inherits: 152,
            "readable-stream/duplex.js": 233,
            "readable-stream/passthrough.js": 239,
            "readable-stream/readable.js": 240,
            "readable-stream/transform.js": 241,
            "readable-stream/writable.js": 242
        } ],
        255: [ function(require, module, exports) {
            var Buffer = require("buffer").Buffer, 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 !0;

                  default:
                    return !1;
                }
            };
            var StringDecoder = exports.StringDecoder = function(encoding) {
                switch (this.encoding = (encoding || "utf8").toLowerCase().replace(/[-_]/, ""), 
                function(encoding) {
                    if (encoding && !isBufferEncoding(encoding)) throw new Error("Unknown encoding: " + encoding);
                }(encoding), 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:
                    return void (this.write = passThroughWrite);
                }
                this.charBuffer = new Buffer(6), this.charReceived = 0, this.charLength = 0;
            };
            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;
            }
            StringDecoder.prototype.write = function(buffer) {
                for (var charStr = ""; this.charLength; ) {
                    var available = buffer.length >= this.charLength - this.charReceived ? this.charLength - this.charReceived : buffer.length;
                    if (buffer.copy(this.charBuffer, this.charReceived, 0, available), this.charReceived += available, 
                    this.charReceived < this.charLength) return "";
                    if (buffer = buffer.slice(available, buffer.length), !(55296 <= (charCode = (charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding)).charCodeAt(charStr.length - 1)) && charCode <= 56319)) {
                        if (this.charReceived = this.charLength = 0, 0 === buffer.length) return charStr;
                        break;
                    }
                    this.charLength += this.surrogateSize, charStr = "";
                }
                this.detectIncompleteChar(buffer);
                var end = buffer.length;
                this.charLength && (buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end), 
                end -= this.charReceived);
                var charCode;
                end = (charStr += buffer.toString(this.encoding, 0, end)).length - 1;
                if (55296 <= (charCode = charStr.charCodeAt(end)) && charCode <= 56319) {
                    var size = this.surrogateSize;
                    return this.charLength += size, this.charReceived += size, this.charBuffer.copy(this.charBuffer, size, 0, size), 
                    buffer.copy(this.charBuffer, 0, 0, size), charStr.substring(0, end);
                }
                return charStr;
            }, StringDecoder.prototype.detectIncompleteChar = function(buffer) {
                for (var i = 3 <= buffer.length ? 3 : buffer.length; 0 < i; i--) {
                    var c = buffer[buffer.length - i];
                    if (1 == i && 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)), this.charReceived) {
                    var cr = this.charReceived, buf = this.charBuffer, enc = this.encoding;
                    res += buf.slice(0, cr).toString(enc);
                }
                return res;
            };
        }, {
            buffer: 77
        } ],
        256: [ function(require, module, exports) {
            (function(global) {
                function config(name) {
                    try {
                        if (!global.localStorage) return !1;
                    } catch (_) {
                        return !1;
                    }
                    var val = global.localStorage[name];
                    return null != val && "true" === String(val).toLowerCase();
                }
                module.exports = function(fn, msg) {
                    if (config("noDeprecation")) return fn;
                    var warned = !1;
                    return function() {
                        if (!warned) {
                            if (config("throwDeprecation")) throw new Error(msg);
                            config("traceDeprecation") ? console.trace(msg) : console.warn(msg), warned = !0;
                        }
                        return fn.apply(this, arguments);
                    };
                };
            }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {});
        }, {} ]
    }, {}, [ 17 ])(17);
}), function(f) {
    if ("object" == typeof exports && "undefined" != typeof module) module.exports = f(); else if ("function" == typeof define && define.amd) define([], f); else {
        ("undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this).Tribute = f();
    }
}(function() {
    return function r(e, n, t) {
        function o(i, f) {
            if (!n[i]) {
                if (!e[i]) {
                    var c = "function" == typeof require && require;
                    if (!f && c) return c(i, !0);
                    if (u) return u(i, !0);
                    var a = new Error("Cannot find module '" + i + "'");
                    throw a.code = "MODULE_NOT_FOUND", a;
                }
                var p = n[i] = {
                    exports: {}
                };
                e[i][0].call(p.exports, function(r) {
                    return o(e[i][1][r] || r);
                }, p, p.exports, r, e, n, t);
            }
            return n[i].exports;
        }
        for (var u = "function" == typeof require && require, i = 0; i < t.length; i++) o(t[i]);
        return o;
    }({
        1: [ function(require, module, exports) {
            "use strict";
            Object.defineProperty(exports, "__esModule", {
                value: !0
            });
            var _createClass = function() {
                function defineProperties(target, props) {
                    for (var i = 0; i < props.length; i++) {
                        var descriptor = props[i];
                        descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }(), _TributeEvents2 = (_interopRequireDefault(require("./utils")), _interopRequireDefault(require("./TributeEvents"))), _TributeMenuEvents2 = _interopRequireDefault(require("./TributeMenuEvents")), _TributeRange2 = _interopRequireDefault(require("./TributeRange")), _TributeSearch2 = _interopRequireDefault(require("./TributeSearch"));
            function _interopRequireDefault(obj) {
                return obj && obj.__esModule ? obj : {
                    default: obj
                };
            }
            var Tribute = function() {
                function Tribute(_ref) {
                    var _this = this, _ref$values = _ref.values, values = void 0 === _ref$values ? null : _ref$values, _ref$iframe = _ref.iframe, iframe = void 0 === _ref$iframe ? null : _ref$iframe, _ref$selectClass = _ref.selectClass, selectClass = void 0 === _ref$selectClass ? "highlight" : _ref$selectClass, _ref$trigger = _ref.trigger, trigger = void 0 === _ref$trigger ? "@" : _ref$trigger, _ref$selectTemplate = _ref.selectTemplate, selectTemplate = void 0 === _ref$selectTemplate ? null : _ref$selectTemplate, _ref$menuItemTemplate = _ref.menuItemTemplate, menuItemTemplate = void 0 === _ref$menuItemTemplate ? null : _ref$menuItemTemplate, _ref$lookup = _ref.lookup, lookup = void 0 === _ref$lookup ? "key" : _ref$lookup, _ref$fillAttr = _ref.fillAttr, fillAttr = void 0 === _ref$fillAttr ? "value" : _ref$fillAttr, _ref$collection = _ref.collection, collection = void 0 === _ref$collection ? null : _ref$collection, _ref$menuContainer = _ref.menuContainer, menuContainer = void 0 === _ref$menuContainer ? null : _ref$menuContainer, _ref$noMatchTemplate = _ref.noMatchTemplate, noMatchTemplate = void 0 === _ref$noMatchTemplate ? null : _ref$noMatchTemplate, _ref$requireLeadingSp = _ref.requireLeadingSpace, requireLeadingSpace = void 0 === _ref$requireLeadingSp || _ref$requireLeadingSp, _ref$allowSpaces = _ref.allowSpaces, allowSpaces = void 0 !== _ref$allowSpaces && _ref$allowSpaces, _ref$replaceTextSuffi = _ref.replaceTextSuffix, replaceTextSuffix = void 0 === _ref$replaceTextSuffi ? null : _ref$replaceTextSuffi, _ref$positionMenu = _ref.positionMenu, positionMenu = void 0 === _ref$positionMenu || _ref$positionMenu, _ref$spaceSelectsMatc = _ref.spaceSelectsMatch, spaceSelectsMatch = void 0 !== _ref$spaceSelectsMatc && _ref$spaceSelectsMatc, _ref$searchOpts = _ref.searchOpts, searchOpts = void 0 === _ref$searchOpts ? {} : _ref$searchOpts;
                    if (function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, Tribute), this.menuSelected = 0, this.current = {}, this.inputEvent = !1, 
                    this.isActive = !1, this.menuContainer = menuContainer, this.allowSpaces = allowSpaces, 
                    this.replaceTextSuffix = replaceTextSuffix, this.positionMenu = positionMenu, this.hasTrailingSpace = !1, 
                    this.spaceSelectsMatch = spaceSelectsMatch, values) this.collection = [ {
                        trigger: trigger,
                        iframe: iframe,
                        selectClass: selectClass,
                        selectTemplate: (selectTemplate || Tribute.defaultSelectTemplate).bind(this),
                        menuItemTemplate: (menuItemTemplate || Tribute.defaultMenuItemTemplate).bind(this),
                        noMatchTemplate: "function" == typeof noMatchTemplate ? noMatchTemplate.bind(_this) : noMatchTemplate || function() {
                            return "";
                        }.bind(_this),
                        lookup: lookup,
                        fillAttr: fillAttr,
                        values: values,
                        requireLeadingSpace: requireLeadingSpace,
                        searchOpts: searchOpts
                    } ]; else {
                        if (!collection) throw new Error("[Tribute] No collection specified.");
                        this.collection = collection.map(function(item) {
                            return {
                                trigger: item.trigger || trigger,
                                iframe: item.iframe || iframe,
                                selectClass: item.selectClass || selectClass,
                                selectTemplate: (item.selectTemplate || Tribute.defaultSelectTemplate).bind(_this),
                                menuItemTemplate: (item.menuItemTemplate || Tribute.defaultMenuItemTemplate).bind(_this),
                                noMatchTemplate: "function" == typeof noMatchTemplate ? noMatchTemplate.bind(_this) : null,
                                lookup: item.lookup || lookup,
                                fillAttr: item.fillAttr || fillAttr,
                                values: item.values,
                                requireLeadingSpace: item.requireLeadingSpace,
                                searchOpts: item.searchOpts || searchOpts
                            };
                        });
                    }
                    new _TributeRange2.default(this), new _TributeEvents2.default(this), new _TributeMenuEvents2.default(this), 
                    new _TributeSearch2.default(this);
                }
                return _createClass(Tribute, [ {
                    key: "triggers",
                    value: function() {
                        return this.collection.map(function(config) {
                            return config.trigger;
                        });
                    }
                }, {
                    key: "attach",
                    value: function(el) {
                        if (!el) throw new Error("[Tribute] Must pass in a DOM node or NodeList.");
                        if ("undefined" != typeof jQuery && el instanceof jQuery && (el = el.get()), el.constructor === NodeList || el.constructor === HTMLCollection || el.constructor === Array) for (var length = el.length, i = 0; i < length; ++i) this._attach(el[i]); else this._attach(el);
                    }
                }, {
                    key: "_attach",
                    value: function(el) {
                        el.hasAttribute("data-tribute") && console.warn("Tribute was already bound to " + el.nodeName), 
                        this.ensureEditable(el), this.events.bind(el), el.setAttribute("data-tribute", !0);
                    }
                }, {
                    key: "ensureEditable",
                    value: function(element) {
                        if (-1 === Tribute.inputTypes().indexOf(element.nodeName)) {
                            if (!element.contentEditable) throw new Error("[Tribute] Cannot bind to " + element.nodeName);
                            element.contentEditable = !0;
                        }
                    }
                }, {
                    key: "createMenu",
                    value: function() {
                        var wrapper = this.range.getDocument().createElement("div"), ul = this.range.getDocument().createElement("ul");
                        return wrapper.className = "tribute-container", wrapper.appendChild(ul), this.menuContainer ? this.menuContainer.appendChild(wrapper) : this.range.getDocument().body.appendChild(wrapper);
                    }
                }, {
                    key: "showMenuFor",
                    value: function(element, scrollTo) {
                        var _this2 = this;
                        if (!this.isActive || this.current.element !== element || this.current.mentionText !== this.currentMentionTextSnapshot) {
                            this.currentMentionTextSnapshot = this.current.mentionText, this.menu || (this.menu = this.createMenu(), 
                            element.tributeMenu = this.menu, this.menuEvents.bind(this.menu)), this.isActive = !0, 
                            this.menuSelected = 0, this.current.mentionText || (this.current.mentionText = "");
                            var processValues = function(values) {
                                if (_this2.isActive) {
                                    var items = _this2.search.filter(_this2.current.mentionText, values, {
                                        pre: _this2.current.collection.searchOpts.pre || "<span>",
                                        post: _this2.current.collection.searchOpts.post || "</span>",
                                        extract: function(el) {
                                            if ("string" == typeof _this2.current.collection.lookup) return el[_this2.current.collection.lookup];
                                            if ("function" == typeof _this2.current.collection.lookup) return _this2.current.collection.lookup(el, _this2.current.mentionText);
                                            throw new Error("Invalid lookup attribute, lookup must be string or function.");
                                        }
                                    });
                                    _this2.current.filteredItems = items;
                                    var ul = _this2.menu.querySelector("ul");
                                    if (_this2.range.positionMenuAtCaret(scrollTo), !items.length) {
                                        var noMatchEvent = new CustomEvent("tribute-no-match", {
                                            detail: _this2.menu
                                        });
                                        return _this2.current.element.dispatchEvent(noMatchEvent), void (_this2.current.collection.noMatchTemplate ? ul.innerHTML = _this2.current.collection.noMatchTemplate() : _this2.hideMenu());
                                    }
                                    ul.innerHTML = "", items.forEach(function(item, index) {
                                        var li = _this2.range.getDocument().createElement("li");
                                        li.setAttribute("data-index", index), li.addEventListener("mouseenter", function(e) {
                                            var index = e.target.getAttribute("data-index");
                                            _this2.events.setActiveLi(index);
                                        }), _this2.menuSelected === index && (li.className = _this2.current.collection.selectClass), 
                                        li.innerHTML = _this2.current.collection.menuItemTemplate(item), ul.appendChild(li);
                                    });
                                }
                            };
                            "function" == typeof this.current.collection.values ? this.current.collection.values(this.current.mentionText, processValues) : processValues(this.current.collection.values);
                        }
                    }
                }, {
                    key: "showMenuForCollection",
                    value: function(element, collectionIndex) {
                        element !== document.activeElement && this.placeCaretAtEnd(element), this.current.collection = this.collection[collectionIndex || 0], 
                        this.current.externalTrigger = !0, (this.current.element = element).isContentEditable ? this.insertTextAtCursor(this.current.collection.trigger) : this.insertAtCaret(element, this.current.collection.trigger), 
                        this.showMenuFor(element);
                    }
                }, {
                    key: "placeCaretAtEnd",
                    value: function(el) {
                        if (el.focus(), void 0 !== window.getSelection && void 0 !== document.createRange) {
                            var range = document.createRange();
                            range.selectNodeContents(el), range.collapse(!1);
                            var sel = window.getSelection();
                            sel.removeAllRanges(), sel.addRange(range);
                        } else if (void 0 !== document.body.createTextRange) {
                            var textRange = document.body.createTextRange();
                            textRange.moveToElementText(el), textRange.collapse(!1), textRange.select();
                        }
                    }
                }, {
                    key: "insertTextAtCursor",
                    value: function(text) {
                        var sel, range;
                        (range = (sel = window.getSelection()).getRangeAt(0)).deleteContents();
                        var textNode = document.createTextNode(text);
                        range.insertNode(textNode), range.selectNodeContents(textNode), range.collapse(!1), 
                        sel.removeAllRanges(), sel.addRange(range);
                    }
                }, {
                    key: "insertAtCaret",
                    value: function(textarea, text) {
                        var scrollPos = textarea.scrollTop, caretPos = textarea.selectionStart, front = textarea.value.substring(0, caretPos), back = textarea.value.substring(textarea.selectionEnd, textarea.value.length);
                        textarea.value = front + text + back, caretPos += text.length, textarea.selectionStart = caretPos, 
                        textarea.selectionEnd = caretPos, textarea.focus(), textarea.scrollTop = scrollPos;
                    }
                }, {
                    key: "hideMenu",
                    value: function() {
                        this.menu && (this.menu.style.cssText = "display: none;", this.isActive = !1, this.menuSelected = 0, 
                        this.current = {});
                    }
                }, {
                    key: "selectItemAtIndex",
                    value: function(index, originalEvent) {
                        if ("number" == typeof (index = parseInt(index))) {
                            var item = this.current.filteredItems[index], content = this.current.collection.selectTemplate(item);
                            null !== content && this.replaceText(content, originalEvent, item);
                        }
                    }
                }, {
                    key: "replaceText",
                    value: function(content, originalEvent, item) {
                        this.range.replaceTriggerText(content, !0, !0, originalEvent, item);
                    }
                }, {
                    key: "_append",
                    value: function(collection, newValues, replace) {
                        if ("function" == typeof collection.values) throw new Error("Unable to append to values, as it is a function.");
                        collection.values = replace ? newValues : collection.values.concat(newValues);
                    }
                }, {
                    key: "append",
                    value: function(collectionIndex, newValues, replace) {
                        var index = parseInt(collectionIndex);
                        if ("number" != typeof index) throw new Error("please provide an index for the collection to update.");
                        var collection = this.collection[index];
                        this._append(collection, newValues, replace);
                    }
                }, {
                    key: "appendCurrent",
                    value: function(newValues, replace) {
                        if (!this.isActive) throw new Error("No active state. Please use append instead and pass an index.");
                        this._append(this.current.collection, newValues, replace);
                    }
                }, {
                    key: "detach",
                    value: function(el) {
                        if (!el) throw new Error("[Tribute] Must pass in a DOM node or NodeList.");
                        if ("undefined" != typeof jQuery && el instanceof jQuery && (el = el.get()), el.constructor === NodeList || el.constructor === HTMLCollection || el.constructor === Array) for (var length = el.length, i = 0; i < length; ++i) this._detach(el[i]); else this._detach(el);
                    }
                }, {
                    key: "_detach",
                    value: function(el) {
                        var _this3 = this;
                        this.events.unbind(el), el.tributeMenu && this.menuEvents.unbind(el.tributeMenu), 
                        setTimeout(function() {
                            el.removeAttribute("data-tribute"), _this3.isActive = !1, el.tributeMenu && el.tributeMenu.remove();
                        });
                    }
                } ], [ {
                    key: "defaultSelectTemplate",
                    value: function(item) {
                        return void 0 === item ? null : this.range.isContentEditable(this.current.element) ? '<span class="tribute-mention">' + (this.current.collection.trigger + item.original[this.current.collection.fillAttr]) + "</span>" : this.current.collection.trigger + item.original[this.current.collection.fillAttr];
                    }
                }, {
                    key: "defaultMenuItemTemplate",
                    value: function(matchItem) {
                        return matchItem.string;
                    }
                }, {
                    key: "inputTypes",
                    value: function() {
                        return [ "TEXTAREA", "INPUT" ];
                    }
                } ]), Tribute;
            }();
            exports.default = Tribute, module.exports = exports.default;
        }, {
            "./TributeEvents": 2,
            "./TributeMenuEvents": 3,
            "./TributeRange": 4,
            "./TributeSearch": 5,
            "./utils": 7
        } ],
        2: [ function(require, module, exports) {
            "use strict";
            Object.defineProperty(exports, "__esModule", {
                value: !0
            });
            var _createClass = function() {
                function defineProperties(target, props) {
                    for (var i = 0; i < props.length; i++) {
                        var descriptor = props[i];
                        descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var TributeEvents = function() {
                function TributeEvents(tribute) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, TributeEvents), this.tribute = tribute, this.tribute.events = this;
                }
                return _createClass(TributeEvents, [ {
                    key: "bind",
                    value: function(element) {
                        element.boundKeydown = this.keydown.bind(element, this), element.boundKeyup = this.keyup.bind(element, this), 
                        element.boundInput = this.input.bind(element, this), element.addEventListener("keydown", element.boundKeydown, !1), 
                        element.addEventListener("keyup", element.boundKeyup, !1), element.addEventListener("input", element.boundInput, !1);
                    }
                }, {
                    key: "unbind",
                    value: function(element) {
                        element.removeEventListener("keydown", element.boundKeydown, !1), element.removeEventListener("keyup", element.boundKeyup, !1), 
                        element.removeEventListener("input", element.boundInput, !1), delete element.boundKeydown, 
                        delete element.boundKeyup, delete element.boundInput;
                    }
                }, {
                    key: "keydown",
                    value: function(instance, event) {
                        instance.shouldDeactivate(event) && (instance.tribute.isActive = !1, instance.tribute.hideMenu());
                        var element = this;
                        instance.commandEvent = !1, TributeEvents.keys().forEach(function(o) {
                            o.key === event.keyCode && (instance.commandEvent = !0, instance.callbacks()[o.value.toLowerCase()](event, element));
                        });
                    }
                }, {
                    key: "input",
                    value: function(instance, event) {
                        instance.inputEvent = !0, instance.keyup.call(this, instance, event);
                    }
                }, {
                    key: "click",
                    value: function(instance, event) {
                        var tribute = instance.tribute;
                        if (tribute.menu && tribute.menu.contains(event.target)) {
                            var li = event.target;
                            for (event.preventDefault(), event.stopPropagation(); "li" !== li.nodeName.toLowerCase(); ) if (!(li = li.parentNode) || li === tribute.menu) throw new Error("cannot find the <li> container for the click");
                            tribute.selectItemAtIndex(li.getAttribute("data-index"), event), tribute.hideMenu();
                        } else tribute.current.element && !tribute.current.externalTrigger && (tribute.current.externalTrigger = !1, 
                        setTimeout(function() {
                            return tribute.hideMenu();
                        }));
                    }
                }, {
                    key: "keyup",
                    value: function(instance, event) {
                        if (instance.inputEvent && (instance.inputEvent = !1), instance.updateSelection(this), 
                        27 !== event.keyCode) {
                            if (!instance.tribute.allowSpaces && instance.tribute.hasTrailingSpace) return instance.tribute.hasTrailingSpace = !1, 
                            instance.commandEvent = !0, void instance.callbacks().space(event, this);
                            if (!instance.tribute.isActive) {
                                var keyCode = instance.getKeyCode(instance, this, event);
                                if (isNaN(keyCode) || !keyCode) return;
                                var trigger = instance.tribute.triggers().find(function(trigger) {
                                    return trigger.charCodeAt(0) === keyCode;
                                });
                                void 0 !== trigger && instance.callbacks().triggerChar(event, this, trigger);
                            }
                            (instance.tribute.current.trigger && !1 === instance.commandEvent || instance.tribute.isActive && 8 === event.keyCode) && instance.tribute.showMenuFor(this, !0);
                        }
                    }
                }, {
                    key: "shouldDeactivate",
                    value: function(event) {
                        if (!this.tribute.isActive) return !1;
                        if (0 === this.tribute.current.mentionText.length) {
                            var eventKeyPressed = !1;
                            return TributeEvents.keys().forEach(function(o) {
                                event.keyCode === o.key && (eventKeyPressed = !0);
                            }), !eventKeyPressed;
                        }
                        return !1;
                    }
                }, {
                    key: "getKeyCode",
                    value: function(instance, el, event) {
                        var tribute = instance.tribute, info = tribute.range.getTriggerInfo(!1, tribute.hasTrailingSpace, !0, tribute.allowSpaces);
                        return !!info && info.mentionTriggerChar.charCodeAt(0);
                    }
                }, {
                    key: "updateSelection",
                    value: function(el) {
                        this.tribute.current.element = el;
                        var info = this.tribute.range.getTriggerInfo(!1, this.tribute.hasTrailingSpace, !0, this.tribute.allowSpaces);
                        info && (this.tribute.current.selectedPath = info.mentionSelectedPath, this.tribute.current.mentionText = info.mentionText, 
                        this.tribute.current.selectedOffset = info.mentionSelectedOffset);
                    }
                }, {
                    key: "callbacks",
                    value: function() {
                        var _this = this;
                        return {
                            triggerChar: function(e, el, trigger) {
                                var tribute = _this.tribute;
                                tribute.current.trigger = trigger;
                                var collectionItem = tribute.collection.find(function(item) {
                                    return item.trigger === trigger;
                                });
                                tribute.current.collection = collectionItem, tribute.inputEvent && tribute.showMenuFor(el, !0);
                            },
                            enter: function(e, el) {
                                _this.tribute.isActive && (e.preventDefault(), e.stopPropagation(), setTimeout(function() {
                                    _this.tribute.selectItemAtIndex(_this.tribute.menuSelected, e), _this.tribute.hideMenu();
                                }, 0));
                            },
                            escape: function(e, el) {
                                _this.tribute.isActive && (e.preventDefault(), e.stopPropagation(), _this.tribute.isActive = !1, 
                                _this.tribute.hideMenu());
                            },
                            tab: function(e, el) {
                                _this.callbacks().enter(e, el);
                            },
                            space: function(e, el) {
                                _this.tribute.isActive && (_this.tribute.spaceSelectsMatch ? _this.callbacks().enter(e, el) : _this.tribute.allowSpaces || (e.stopPropagation(), 
                                setTimeout(function() {
                                    _this.tribute.hideMenu(), _this.tribute.isActive = !1;
                                }, 0)));
                            },
                            up: function(e, el) {
                                if (_this.tribute.isActive) {
                                    e.preventDefault(), e.stopPropagation();
                                    var count = _this.tribute.current.filteredItems.length, selected = _this.tribute.menuSelected;
                                    selected < count && 0 < selected ? (_this.tribute.menuSelected--, _this.setActiveLi()) : 0 === selected && (_this.tribute.menuSelected = count - 1, 
                                    _this.setActiveLi(), _this.tribute.menu.scrollTop = _this.tribute.menu.scrollHeight);
                                }
                            },
                            down: function(e, el) {
                                if (_this.tribute.isActive) {
                                    e.preventDefault(), e.stopPropagation();
                                    var count = _this.tribute.current.filteredItems.length - 1, selected = _this.tribute.menuSelected;
                                    selected < count ? (_this.tribute.menuSelected++, _this.setActiveLi()) : count === selected && (_this.tribute.menuSelected = 0, 
                                    _this.setActiveLi(), _this.tribute.menu.scrollTop = 0);
                                }
                            },
                            delete: function(e, el) {
                                _this.tribute.isActive && _this.tribute.current.mentionText.length < 1 ? _this.tribute.hideMenu() : _this.tribute.isActive && _this.tribute.showMenuFor(el);
                            }
                        };
                    }
                }, {
                    key: "setActiveLi",
                    value: function(index) {
                        var lis = this.tribute.menu.querySelectorAll("li"), length = lis.length >>> 0, menuFullHeight = this.getFullHeight(this.tribute.menu), liHeight = this.getFullHeight(lis[0]);
                        index && (this.tribute.menuSelected = index);
                        for (var i = 0; i < length; i++) {
                            var li = lis[i];
                            if (i === this.tribute.menuSelected) {
                                var offset = liHeight * (i + 1), totalScroll = this.tribute.menu.scrollTop + menuFullHeight;
                                totalScroll < offset ? this.tribute.menu.scrollTop += liHeight : offset < totalScroll && (this.tribute.menu.scrollTop -= liHeight), 
                                li.className = this.tribute.current.collection.selectClass;
                            } else li.className = "";
                        }
                    }
                }, {
                    key: "getFullHeight",
                    value: function(elem, includeMargin) {
                        var height = elem.getBoundingClientRect().height;
                        if (includeMargin) {
                            var style = elem.currentStyle || window.getComputedStyle(elem);
                            return height + parseFloat(style.marginTop) + parseFloat(style.marginBottom);
                        }
                        return height;
                    }
                } ], [ {
                    key: "keys",
                    value: function() {
                        return [ {
                            key: 9,
                            value: "TAB"
                        }, {
                            key: 8,
                            value: "DELETE"
                        }, {
                            key: 13,
                            value: "ENTER"
                        }, {
                            key: 27,
                            value: "ESCAPE"
                        }, {
                            key: 32,
                            value: "SPACE"
                        }, {
                            key: 38,
                            value: "UP"
                        }, {
                            key: 40,
                            value: "DOWN"
                        } ];
                    }
                } ]), TributeEvents;
            }();
            exports.default = TributeEvents, module.exports = exports.default;
        }, {} ],
        3: [ function(require, module, exports) {
            "use strict";
            Object.defineProperty(exports, "__esModule", {
                value: !0
            });
            var _createClass = function() {
                function defineProperties(target, props) {
                    for (var i = 0; i < props.length; i++) {
                        var descriptor = props[i];
                        descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var TributeMenuEvents = function() {
                function TributeMenuEvents(tribute) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, TributeMenuEvents), this.tribute = tribute, (this.tribute.menuEvents = this).menu = this.tribute.menu;
                }
                return _createClass(TributeMenuEvents, [ {
                    key: "bind",
                    value: function(menu) {
                        var _this = this;
                        this.menuClickEvent = this.tribute.events.click.bind(null, this), this.menuContainerScrollEvent = this.debounce(function() {
                            _this.tribute.isActive && _this.tribute.showMenuFor(_this.tribute.current.element, !1);
                        }, 300, !1), this.windowResizeEvent = this.debounce(function() {
                            _this.tribute.isActive && _this.tribute.range.positionMenuAtCaret(!0);
                        }, 300, !1), this.tribute.range.getDocument().addEventListener("MSPointerDown", this.menuClickEvent, !1), 
                        this.tribute.range.getDocument().addEventListener("mousedown", this.menuClickEvent, !1), 
                        window.addEventListener("resize", this.windowResizeEvent), this.menuContainer ? this.menuContainer.addEventListener("scroll", this.menuContainerScrollEvent, !1) : window.addEventListener("scroll", this.menuContainerScrollEvent);
                    }
                }, {
                    key: "unbind",
                    value: function(menu) {
                        this.tribute.range.getDocument().removeEventListener("mousedown", this.menuClickEvent, !1), 
                        this.tribute.range.getDocument().removeEventListener("MSPointerDown", this.menuClickEvent, !1), 
                        window.removeEventListener("resize", this.windowResizeEvent), this.menuContainer ? this.menuContainer.removeEventListener("scroll", this.menuContainerScrollEvent, !1) : window.removeEventListener("scroll", this.menuContainerScrollEvent);
                    }
                }, {
                    key: "debounce",
                    value: function(func, wait, immediate) {
                        var timeout, _this2 = this, _arguments = arguments;
                        return function() {
                            var context = _this2, args = _arguments, callNow = immediate && !timeout;
                            clearTimeout(timeout), timeout = setTimeout(function() {
                                timeout = null, immediate || func.apply(context, args);
                            }, wait), callNow && func.apply(context, args);
                        };
                    }
                } ]), TributeMenuEvents;
            }();
            exports.default = TributeMenuEvents, module.exports = exports.default;
        }, {} ],
        4: [ function(require, module, exports) {
            "use strict";
            Object.defineProperty(exports, "__esModule", {
                value: !0
            });
            var _createClass = function() {
                function defineProperties(target, props) {
                    for (var i = 0; i < props.length; i++) {
                        var descriptor = props[i];
                        descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var TributeRange = function() {
                function TributeRange(tribute) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, TributeRange), this.tribute = tribute, this.tribute.range = this;
                }
                return _createClass(TributeRange, [ {
                    key: "getDocument",
                    value: function() {
                        var iframe = void 0;
                        return this.tribute.current.collection && (iframe = this.tribute.current.collection.iframe), 
                        iframe ? iframe.contentWindow.document : document;
                    }
                }, {
                    key: "positionMenuAtCaret",
                    value: function(scrollTo) {
                        var _this = this, context = this.tribute.current, coordinates = void 0, info = this.getTriggerInfo(!1, this.tribute.hasTrailingSpace, !0, this.tribute.allowSpaces);
                        if (void 0 !== info) {
                            if (!this.tribute.positionMenu) return void (this.tribute.menu.style.cssText = "display: block;");
                            coordinates = this.isContentEditable(context.element) ? this.getContentEditableCaretPosition(info.mentionPosition) : this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element, info.mentionPosition), 
                            this.tribute.menu.style.cssText = "top: " + coordinates.top + "px;\n                                     left: " + coordinates.left + "px;\n                                     right: " + coordinates.right + "px;\n                                     bottom: " + coordinates.bottom + "px;\n                                     position: absolute;\n                                     zIndex: 10000;\n                                     display: block;", 
                            "auto" === coordinates.left && (this.tribute.menu.style.left = "auto"), "auto" === coordinates.top && (this.tribute.menu.style.top = "auto"), 
                            scrollTo && this.scrollIntoView(), window.setTimeout(function() {
                                var menuDimensions = {
                                    width: _this.tribute.menu.offsetWidth,
                                    height: _this.tribute.menu.offsetHeight
                                }, menuIsOffScreen = _this.isMenuOffScreen(coordinates, menuDimensions), menuIsOffScreenHorizontally = window.innerWidth > menuDimensions.width && (menuIsOffScreen.left || menuIsOffScreen.right), menuIsOffScreenVertically = window.innerHeight > menuDimensions.height && (menuIsOffScreen.top || menuIsOffScreen.bottom);
                                (menuIsOffScreenHorizontally || menuIsOffScreenVertically) && (_this.tribute.menu.style.cssText = "display: none", 
                                _this.positionMenuAtCaret(scrollTo));
                            }, 0);
                        } else this.tribute.menu.style.cssText = "display: none";
                    }
                }, {
                    key: "selectElement",
                    value: function(targetElement, path, offset) {
                        var range = void 0, elem = targetElement;
                        if (path) for (var i = 0; i < path.length; i++) {
                            if (void 0 === (elem = elem.childNodes[path[i]])) return;
                            for (;elem.length < offset; ) offset -= elem.length, elem = elem.nextSibling;
                            0 !== elem.childNodes.length || elem.length || (elem = elem.previousSibling);
                        }
                        var sel = this.getWindowSelection();
                        (range = this.getDocument().createRange()).setStart(elem, offset), range.setEnd(elem, offset), 
                        range.collapse(!0);
                        try {
                            sel.removeAllRanges();
                        } catch (error) {}
                        sel.addRange(range), targetElement.focus();
                    }
                }, {
                    key: "replaceTriggerText",
                    value: function(text, requireLeadingSpace, hasTrailingSpace, originalEvent, item) {
                        var context = this.tribute.current, info = this.getTriggerInfo(!0, hasTrailingSpace, requireLeadingSpace, this.tribute.allowSpaces), replaceEvent = new CustomEvent("tribute-replaced", {
                            detail: {
                                item: item,
                                event: originalEvent
                            }
                        });
                        if (void 0 !== info) {
                            if (this.isContentEditable(context.element)) {
                                text += "string" == typeof this.tribute.replaceTextSuffix ? this.tribute.replaceTextSuffix : " ", 
                                this.pasteHtml(text, info.mentionPosition, info.mentionPosition + info.mentionText.length + 1);
                            } else {
                                var myField = this.tribute.current.element, textSuffix = "string" == typeof this.tribute.replaceTextSuffix ? this.tribute.replaceTextSuffix : " ";
                                text += textSuffix;
                                var startPos = info.mentionPosition, endPos = info.mentionPosition + info.mentionText.length + textSuffix.length;
                                myField.value = myField.value.substring(0, startPos) + text + myField.value.substring(endPos, myField.value.length), 
                                myField.selectionStart = startPos + text.length, myField.selectionEnd = startPos + text.length;
                            }
                            context.element.dispatchEvent(replaceEvent);
                        }
                    }
                }, {
                    key: "pasteHtml",
                    value: function(html, startPos, endPos) {
                        var range = void 0, sel = void 0;
                        sel = this.getWindowSelection(), (range = this.getDocument().createRange()).setStart(sel.anchorNode, startPos), 
                        range.setEnd(sel.anchorNode, endPos), range.deleteContents();
                        var el = this.getDocument().createElement("div");
                        el.innerHTML = html;
                        for (var frag = this.getDocument().createDocumentFragment(), node = void 0, lastNode = void 0; node = el.firstChild; ) lastNode = frag.appendChild(node);
                        range.insertNode(frag), lastNode && ((range = range.cloneRange()).setStartAfter(lastNode), 
                        range.collapse(!0), sel.removeAllRanges(), sel.addRange(range));
                    }
                }, {
                    key: "getWindowSelection",
                    value: function() {
                        return this.tribute.collection.iframe ? this.tribute.collection.iframe.contentWindow.getSelection() : window.getSelection();
                    }
                }, {
                    key: "getNodePositionInParent",
                    value: function(element) {
                        if (null === element.parentNode) return 0;
                        for (var i = 0; i < element.parentNode.childNodes.length; i++) {
                            if (element.parentNode.childNodes[i] === element) return i;
                        }
                    }
                }, {
                    key: "getContentEditableSelectedPath",
                    value: function(ctx) {
                        var sel = this.getWindowSelection(), selected = sel.anchorNode, path = [];
                        if (null != selected) {
                            for (var i = void 0, ce = selected.contentEditable; null !== selected && "true" !== ce; ) i = this.getNodePositionInParent(selected), 
                            path.push(i), null !== (selected = selected.parentNode) && (ce = selected.contentEditable);
                            return path.reverse(), {
                                selected: selected,
                                path: path,
                                offset: sel.getRangeAt(0).startOffset
                            };
                        }
                    }
                }, {
                    key: "getTextPrecedingCurrentSelection",
                    value: function() {
                        var context = this.tribute.current, text = "";
                        if (this.isContentEditable(context.element)) {
                            var selectedElem = this.getWindowSelection().anchorNode;
                            if (null != selectedElem) {
                                var workingNodeContent = selectedElem.textContent, selectStartOffset = this.getWindowSelection().getRangeAt(0).startOffset;
                                workingNodeContent && 0 <= selectStartOffset && (text = workingNodeContent.substring(0, selectStartOffset));
                            }
                        } else {
                            var textComponent = this.tribute.current.element;
                            if (textComponent) {
                                var startPos = textComponent.selectionStart;
                                textComponent.value && 0 <= startPos && (text = textComponent.value.substring(0, startPos));
                            }
                        }
                        return text;
                    }
                }, {
                    key: "getTriggerInfo",
                    value: function(menuAlreadyActive, hasTrailingSpace, requireLeadingSpace, allowSpaces) {
                        var _this2 = this, ctx = this.tribute.current, selected = void 0, path = void 0, offset = void 0;
                        if (this.isContentEditable(ctx.element)) {
                            var selectionInfo = this.getContentEditableSelectedPath(ctx);
                            selectionInfo && (selected = selectionInfo.selected, path = selectionInfo.path, 
                            offset = selectionInfo.offset);
                        } else selected = this.tribute.current.element;
                        var effectiveRange = this.getTextPrecedingCurrentSelection();
                        if (null != effectiveRange) {
                            var mostRecentTriggerCharPos = -1, triggerChar = void 0;
                            if (this.tribute.collection.forEach(function(config) {
                                var c = config.trigger, idx = config.requireLeadingSpace ? _this2.lastIndexWithLeadingSpace(effectiveRange, c) : effectiveRange.lastIndexOf(c);
                                mostRecentTriggerCharPos < idx && (mostRecentTriggerCharPos = idx, triggerChar = c, 
                                requireLeadingSpace = config.requireLeadingSpace);
                            }), 0 <= mostRecentTriggerCharPos && (0 === mostRecentTriggerCharPos || !requireLeadingSpace || /[\xA0\s]/g.test(effectiveRange.substring(mostRecentTriggerCharPos - 1, mostRecentTriggerCharPos)))) {
                                var currentTriggerSnippet = effectiveRange.substring(mostRecentTriggerCharPos + 1, effectiveRange.length);
                                triggerChar = effectiveRange.substring(mostRecentTriggerCharPos, mostRecentTriggerCharPos + 1);
                                var firstSnippetChar = currentTriggerSnippet.substring(0, 1), leadingSpace = 0 < currentTriggerSnippet.length && (" " === firstSnippetChar || " " === firstSnippetChar);
                                hasTrailingSpace && (currentTriggerSnippet = currentTriggerSnippet.trim());
                                var regex = allowSpaces ? /[^\S ]/g : /[\xA0\s]/g;
                                if (this.tribute.hasTrailingSpace = regex.test(currentTriggerSnippet), !leadingSpace && (menuAlreadyActive || !regex.test(currentTriggerSnippet))) return {
                                    mentionPosition: mostRecentTriggerCharPos,
                                    mentionText: currentTriggerSnippet,
                                    mentionSelectedElement: selected,
                                    mentionSelectedPath: path,
                                    mentionSelectedOffset: offset,
                                    mentionTriggerChar: triggerChar
                                };
                            }
                        }
                    }
                }, {
                    key: "lastIndexWithLeadingSpace",
                    value: function(str, char) {
                        for (var reversedStr = str.split("").reverse().join(""), index = -1, cidx = 0, len = str.length; cidx < len; cidx++) {
                            var firstChar = cidx === str.length - 1, leadingSpace = /\s/.test(reversedStr[cidx + 1]);
                            if (char === reversedStr[cidx] && (firstChar || leadingSpace)) {
                                index = str.length - 1 - cidx;
                                break;
                            }
                        }
                        return index;
                    }
                }, {
                    key: "isContentEditable",
                    value: function(element) {
                        return "INPUT" !== element.nodeName && "TEXTAREA" !== element.nodeName;
                    }
                }, {
                    key: "isMenuOffScreen",
                    value: function(coordinates, menuDimensions) {
                        var windowWidth = window.innerWidth, windowHeight = window.innerHeight, doc = document.documentElement, windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0), menuTop = "number" == typeof coordinates.top ? coordinates.top : windowTop + windowHeight - coordinates.bottom - menuDimensions.height, menuRight = "number" == typeof coordinates.right ? coordinates.right : coordinates.left + menuDimensions.width, menuBottom = "number" == typeof coordinates.bottom ? coordinates.bottom : coordinates.top + menuDimensions.height, menuLeft = "number" == typeof coordinates.left ? coordinates.left : windowLeft + windowWidth - coordinates.right - menuDimensions.width;
                        return {
                            top: menuTop < Math.floor(windowTop),
                            right: menuRight > Math.ceil(windowLeft + windowWidth),
                            bottom: menuBottom > Math.ceil(windowTop + windowHeight),
                            left: menuLeft < Math.floor(windowLeft)
                        };
                    }
                }, {
                    key: "getMenuDimensions",
                    value: function() {
                        var dimensions = {
                            width: null,
                            height: null
                        };
                        return this.tribute.menu.style.cssText = "top: 0px;\n                                 left: 0px;\n                                 position: fixed;\n                                 zIndex: 10000;\n                                 display: block;\n                                 visibility; hidden;", 
                        dimensions.width = this.tribute.menu.offsetWidth, dimensions.height = this.tribute.menu.offsetHeight, 
                        this.tribute.menu.style.cssText = "display: none;", dimensions;
                    }
                }, {
                    key: "getTextAreaOrInputUnderlinePosition",
                    value: function(element, position, flipped) {
                        var isFirefox = null !== window.mozInnerScreenX, div = this.getDocument().createElement("div");
                        div.id = "input-textarea-caret-position-mirror-div", this.getDocument().body.appendChild(div);
                        var style = div.style, computed = window.getComputedStyle ? getComputedStyle(element) : element.currentStyle;
                        style.whiteSpace = "pre-wrap", "INPUT" !== element.nodeName && (style.wordWrap = "break-word"), 
                        style.position = "absolute", style.visibility = "hidden", [ "direction", "boxSizing", "width", "height", "overflowX", "overflowY", "borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "fontStyle", "fontVariant", "fontWeight", "fontStretch", "fontSize", "fontSizeAdjust", "lineHeight", "fontFamily", "textAlign", "textTransform", "textIndent", "textDecoration", "letterSpacing", "wordSpacing" ].forEach(function(prop) {
                            style[prop] = computed[prop];
                        }), isFirefox ? (style.width = parseInt(computed.width) - 2 + "px", element.scrollHeight > parseInt(computed.height) && (style.overflowY = "scroll")) : style.overflow = "hidden", 
                        div.textContent = element.value.substring(0, position), "INPUT" === element.nodeName && (div.textContent = div.textContent.replace(/\s/g, " "));
                        var span = this.getDocument().createElement("span");
                        span.textContent = element.value.substring(position) || ".", div.appendChild(span);
                        var rect = element.getBoundingClientRect(), doc = document.documentElement, windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0), coordinates = {
                            top: rect.top + windowTop + span.offsetTop + parseInt(computed.borderTopWidth) + parseInt(computed.fontSize) - element.scrollTop,
                            left: rect.left + windowLeft + span.offsetLeft + parseInt(computed.borderLeftWidth)
                        }, windowWidth = window.innerWidth, windowHeight = window.innerHeight, menuDimensions = this.getMenuDimensions(), menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions);
                        menuIsOffScreen.right && (coordinates.right = windowWidth - coordinates.left, coordinates.left = "auto");
                        var parentHeight = this.tribute.menuContainer ? this.tribute.menuContainer.offsetHeight : this.getDocument().body.offsetHeight;
                        if (menuIsOffScreen.bottom) {
                            var scrollStillAvailable = parentHeight - (windowHeight - (this.tribute.menuContainer ? this.tribute.menuContainer.getBoundingClientRect() : this.getDocument().body.getBoundingClientRect()).top);
                            coordinates.bottom = scrollStillAvailable + (windowHeight - rect.top - span.offsetTop), 
                            coordinates.top = "auto";
                        }
                        return (menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions)).left && (coordinates.left = windowWidth > menuDimensions.width ? windowLeft + windowWidth - menuDimensions.width : windowLeft, 
                        delete coordinates.right), menuIsOffScreen.top && (coordinates.top = windowHeight > menuDimensions.height ? windowTop + windowHeight - menuDimensions.height : windowTop, 
                        delete coordinates.bottom), this.getDocument().body.removeChild(div), coordinates;
                    }
                }, {
                    key: "getContentEditableCaretPosition",
                    value: function(selectedNodePosition) {
                        var markerEl = void 0, markerId = "sel_" + new Date().getTime() + "_" + Math.random().toString().substr(2), range = void 0, sel = this.getWindowSelection(), prevRange = sel.getRangeAt(0);
                        (range = this.getDocument().createRange()).setStart(sel.anchorNode, selectedNodePosition), 
                        range.setEnd(sel.anchorNode, selectedNodePosition), range.collapse(!1), (markerEl = this.getDocument().createElement("span")).id = markerId, 
                        markerEl.appendChild(this.getDocument().createTextNode("\ufeff")), range.insertNode(markerEl), 
                        sel.removeAllRanges(), sel.addRange(prevRange);
                        var rect = markerEl.getBoundingClientRect(), doc = document.documentElement, windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0), coordinates = {
                            left: rect.left + windowLeft,
                            top: rect.top + markerEl.offsetHeight + windowTop
                        }, windowWidth = window.innerWidth, windowHeight = window.innerHeight, menuDimensions = this.getMenuDimensions(), menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions);
                        menuIsOffScreen.right && (coordinates.left = "auto", coordinates.right = windowWidth - rect.left - windowLeft);
                        var parentHeight = this.tribute.menuContainer ? this.tribute.menuContainer.offsetHeight : this.getDocument().body.offsetHeight;
                        if (menuIsOffScreen.bottom) {
                            var scrollStillAvailable = parentHeight - (windowHeight - (this.tribute.menuContainer ? this.tribute.menuContainer.getBoundingClientRect() : this.getDocument().body.getBoundingClientRect()).top);
                            coordinates.top = "auto", coordinates.bottom = scrollStillAvailable + (windowHeight - rect.top);
                        }
                        return (menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions)).left && (coordinates.left = windowWidth > menuDimensions.width ? windowLeft + windowWidth - menuDimensions.width : windowLeft, 
                        delete coordinates.right), menuIsOffScreen.top && (coordinates.top = windowHeight > menuDimensions.height ? windowTop + windowHeight - menuDimensions.height : windowTop, 
                        delete coordinates.bottom), markerEl.parentNode.removeChild(markerEl), coordinates;
                    }
                }, {
                    key: "scrollIntoView",
                    value: function(elem) {
                        var clientRect = void 0, e = this.menu;
                        if (void 0 !== e) {
                            for (;void 0 === clientRect || 0 === clientRect.height; ) if (0 === (clientRect = e.getBoundingClientRect()).height && (void 0 === (e = e.childNodes[0]) || !e.getBoundingClientRect)) return;
                            var elemTop = clientRect.top, elemBottom = elemTop + clientRect.height;
                            if (elemTop < 0) window.scrollTo(0, window.pageYOffset + clientRect.top - 20); else if (elemBottom > window.innerHeight) {
                                var maxY = window.pageYOffset + clientRect.top - 20;
                                100 < maxY - window.pageYOffset && (maxY = window.pageYOffset + 100);
                                var targetY = window.pageYOffset - (window.innerHeight - elemBottom);
                                maxY < targetY && (targetY = maxY), window.scrollTo(0, targetY);
                            }
                        }
                    }
                } ]), TributeRange;
            }();
            exports.default = TributeRange, module.exports = exports.default;
        }, {} ],
        5: [ function(require, module, exports) {
            "use strict";
            Object.defineProperty(exports, "__esModule", {
                value: !0
            });
            var _createClass = function() {
                function defineProperties(target, props) {
                    for (var i = 0; i < props.length; i++) {
                        var descriptor = props[i];
                        descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                        "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                    }
                }
                return function(Constructor, protoProps, staticProps) {
                    return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                    Constructor;
                };
            }();
            var TributeSearch = function() {
                function TributeSearch(tribute) {
                    !function(instance, Constructor) {
                        if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                    }(this, TributeSearch), this.tribute = tribute, this.tribute.search = this;
                }
                return _createClass(TributeSearch, [ {
                    key: "simpleFilter",
                    value: function(pattern, array) {
                        var _this = this;
                        return array.filter(function(string) {
                            return _this.test(pattern, string);
                        });
                    }
                }, {
                    key: "test",
                    value: function(pattern, string) {
                        return null !== this.match(pattern, string);
                    }
                }, {
                    key: "match",
                    value: function(pattern, string, opts) {
                        opts = opts || {};
                        string.length;
                        var pre = opts.pre || "", post = opts.post || "", compareString = opts.caseSensitive && string || string.toLowerCase();
                        pattern = opts.caseSensitive && pattern || pattern.toLowerCase();
                        var patternCache = this.traverse(compareString, pattern, 0, 0, []);
                        return patternCache ? {
                            rendered: this.render(string, patternCache.cache, pre, post),
                            score: patternCache.score
                        } : null;
                    }
                }, {
                    key: "traverse",
                    value: function(string, pattern, stringIndex, patternIndex, patternCache) {
                        if (pattern.length === patternIndex) return {
                            score: this.calculateScore(patternCache),
                            cache: patternCache.slice()
                        };
                        if (!(string.length === stringIndex || pattern.length - patternIndex > string.length - stringIndex)) {
                            for (var c = pattern[patternIndex], index = string.indexOf(c, stringIndex), best = void 0, temp = void 0; -1 < index; ) {
                                if (patternCache.push(index), temp = this.traverse(string, pattern, index + 1, patternIndex + 1, patternCache), 
                                patternCache.pop(), !temp) return best;
                                (!best || best.score < temp.score) && (best = temp), index = string.indexOf(c, index + 1);
                            }
                            return best;
                        }
                    }
                }, {
                    key: "calculateScore",
                    value: function(patternCache) {
                        var score = 0, temp = 1;
                        return patternCache.forEach(function(index, i) {
                            0 < i && (patternCache[i - 1] + 1 === index ? temp += temp + 1 : temp = 1), score += temp;
                        }), score;
                    }
                }, {
                    key: "render",
                    value: function(string, indices, pre, post) {
                        var rendered = string.substring(0, indices[0]);
                        return indices.forEach(function(index, i) {
                            rendered += pre + string[index] + post + string.substring(index + 1, indices[i + 1] ? indices[i + 1] : string.length);
                        }), rendered;
                    }
                }, {
                    key: "filter",
                    value: function(pattern, arr, opts) {
                        var _this2 = this;
                        return opts = opts || {}, arr.reduce(function(prev, element, idx, arr) {
                            var str = element;
                            opts.extract && ((str = opts.extract(element)) || (str = ""));
                            var rendered = _this2.match(pattern, str, opts);
                            return null != rendered && (prev[prev.length] = {
                                string: rendered.rendered,
                                score: rendered.score,
                                index: idx,
                                original: element
                            }), prev;
                        }, []).sort(function(a, b) {
                            var compare = b.score - a.score;
                            return compare || a.index - b.index;
                        });
                    }
                } ]), TributeSearch;
            }();
            exports.default = TributeSearch, module.exports = exports.default;
        }, {} ],
        6: [ function(require, module, exports) {
            "use strict";
            Object.defineProperty(exports, "__esModule", {
                value: !0
            });
            var obj, _Tribute = require("./Tribute"), _Tribute2 = (obj = _Tribute) && obj.__esModule ? obj : {
                default: obj
            };
            exports.default = _Tribute2.default, module.exports = exports.default;
        }, {
            "./Tribute": 1
        } ],
        7: [ function(require, module, exports) {
            "use strict";
            if (Array.prototype.find || (Array.prototype.find = function(predicate) {
                if (null === this) throw new TypeError("Array.prototype.find called on null or undefined");
                if ("function" != typeof predicate) throw new TypeError("predicate must be a function");
                for (var value, list = Object(this), length = list.length >>> 0, thisArg = arguments[1], i = 0; i < length; i++) if (value = list[i], 
                predicate.call(thisArg, value, i, list)) return value;
            }), window && "function" != typeof window.CustomEvent) {
                var CustomEvent = function(event, params) {
                    params = params || {
                        bubbles: !1,
                        cancelable: !1,
                        detail: void 0
                    };
                    var evt = document.createEvent("CustomEvent");
                    return evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail), 
                    evt;
                };
                void 0 !== window.Event && (CustomEvent.prototype = window.Event.prototype), window.CustomEvent = CustomEvent;
            }
        }, {} ]
    }, {}, [ 6 ])(6);
}), function(global, factory) {
    "object" == typeof exports && "undefined" != typeof module ? module.exports = factory() : "function" == typeof define && define.amd ? define(factory) : global.moment = factory();
}(this, function() {
    "use strict";
    var hookCallback;
    function hooks() {
        return hookCallback.apply(null, arguments);
    }
    function isArray(input) {
        return input instanceof Array || "[object Array]" === Object.prototype.toString.call(input);
    }
    function isObject(input) {
        return null != input && "[object Object]" === Object.prototype.toString.call(input);
    }
    function isUndefined(input) {
        return void 0 === input;
    }
    function isNumber(input) {
        return "number" == typeof input || "[object Number]" === Object.prototype.toString.call(input);
    }
    function isDate(input) {
        return input instanceof Date || "[object Date]" === Object.prototype.toString.call(input);
    }
    function map(arr, fn) {
        var i, res = [];
        for (i = 0; i < arr.length; ++i) res.push(fn(arr[i], i));
        return res;
    }
    function hasOwnProp(a, b) {
        return Object.prototype.hasOwnProperty.call(a, b);
    }
    function extend(a, b) {
        for (var i in b) hasOwnProp(b, i) && (a[i] = b[i]);
        return hasOwnProp(b, "toString") && (a.toString = b.toString), hasOwnProp(b, "valueOf") && (a.valueOf = b.valueOf), 
        a;
    }
    function createUTC(input, format, locale, strict) {
        return createLocalOrUTC(input, format, locale, strict, !0).utc();
    }
    function getParsingFlags(m) {
        return null == m._pf && (m._pf = {
            empty: !1,
            unusedTokens: [],
            unusedInput: [],
            overflow: -2,
            charsLeftOver: 0,
            nullInput: !1,
            invalidMonth: null,
            invalidFormat: !1,
            userInvalidated: !1,
            iso: !1,
            parsedDateParts: [],
            meridiem: null,
            rfc2822: !1,
            weekdayMismatch: !1
        }), m._pf;
    }
    var some$1 = Array.prototype.some ? Array.prototype.some : function(fun) {
        for (var t = Object(this), len = t.length >>> 0, i = 0; i < len; i++) if (i in t && fun.call(this, t[i], i, t)) return !0;
        return !1;
    };
    function isValid(m) {
        if (null == m._isValid) {
            var flags = getParsingFlags(m), parsedParts = some$1.call(flags.parsedDateParts, function(i) {
                return null != i;
            }), isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidMonth && !flags.invalidWeekday && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts);
            if (m._strict && (isNowValid = isNowValid && 0 === flags.charsLeftOver && 0 === flags.unusedTokens.length && void 0 === flags.bigHour), 
            null != Object.isFrozen && Object.isFrozen(m)) return isNowValid;
            m._isValid = isNowValid;
        }
        return m._isValid;
    }
    function createInvalid(flags) {
        var m = createUTC(NaN);
        return null != flags ? extend(getParsingFlags(m), flags) : getParsingFlags(m).userInvalidated = !0, 
        m;
    }
    var momentProperties = hooks.momentProperties = [];
    function copyConfig(to, from) {
        var i, prop, val;
        if (isUndefined(from._isAMomentObject) || (to._isAMomentObject = from._isAMomentObject), 
        isUndefined(from._i) || (to._i = from._i), isUndefined(from._f) || (to._f = from._f), 
        isUndefined(from._l) || (to._l = from._l), isUndefined(from._strict) || (to._strict = from._strict), 
        isUndefined(from._tzm) || (to._tzm = from._tzm), isUndefined(from._isUTC) || (to._isUTC = from._isUTC), 
        isUndefined(from._offset) || (to._offset = from._offset), isUndefined(from._pf) || (to._pf = getParsingFlags(from)), 
        isUndefined(from._locale) || (to._locale = from._locale), 0 < momentProperties.length) for (i = 0; i < momentProperties.length; i++) isUndefined(val = from[prop = momentProperties[i]]) || (to[prop] = val);
        return to;
    }
    var updateInProgress = !1;
    function Moment(config) {
        copyConfig(this, config), this._d = new Date(null != config._d ? config._d.getTime() : NaN), 
        this.isValid() || (this._d = new Date(NaN)), !1 === updateInProgress && (updateInProgress = !0, 
        hooks.updateOffset(this), updateInProgress = !1);
    }
    function isMoment(obj) {
        return obj instanceof Moment || null != obj && null != obj._isAMomentObject;
    }
    function absFloor(number) {
        return number < 0 ? Math.ceil(number) || 0 : Math.floor(number);
    }
    function toInt(argumentForCoercion) {
        var coercedNumber = +argumentForCoercion, value = 0;
        return 0 !== coercedNumber && isFinite(coercedNumber) && (value = absFloor(coercedNumber)), 
        value;
    }
    function compareArrays(array1, array2, dontConvert) {
        var i, len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0;
        for (i = 0; i < len; i++) (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) && diffs++;
        return diffs + lengthDiff;
    }
    function warn(msg) {
        !1 === hooks.suppressDeprecationWarnings && "undefined" != typeof console && console.warn && console.warn("Deprecation warning: " + msg);
    }
    function deprecate(msg, fn) {
        var firstTime = !0;
        return extend(function() {
            if (null != hooks.deprecationHandler && hooks.deprecationHandler(null, msg), firstTime) {
                for (var arg, args = [], i = 0; i < arguments.length; i++) {
                    if (arg = "", "object" == typeof arguments[i]) {
                        for (var key in arg += "\n[" + i + "] ", arguments[0]) arg += key + ": " + arguments[0][key] + ", ";
                        arg = arg.slice(0, -2);
                    } else arg = arguments[i];
                    args.push(arg);
                }
                warn(msg + "\nArguments: " + Array.prototype.slice.call(args).join("") + "\n" + new Error().stack), 
                firstTime = !1;
            }
            return fn.apply(this, arguments);
        }, fn);
    }
    var deprecations = {};
    function deprecateSimple(name, msg) {
        null != hooks.deprecationHandler && hooks.deprecationHandler(name, msg), deprecations[name] || (warn(msg), 
        deprecations[name] = !0);
    }
    function isFunction(input) {
        return input instanceof Function || "[object Function]" === Object.prototype.toString.call(input);
    }
    function mergeConfigs(parentConfig, childConfig) {
        var prop, res = extend({}, parentConfig);
        for (prop in childConfig) hasOwnProp(childConfig, prop) && (isObject(parentConfig[prop]) && isObject(childConfig[prop]) ? (res[prop] = {}, 
        extend(res[prop], parentConfig[prop]), extend(res[prop], childConfig[prop])) : null != childConfig[prop] ? res[prop] = childConfig[prop] : delete res[prop]);
        for (prop in parentConfig) hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop]) && (res[prop] = extend({}, res[prop]));
        return res;
    }
    function Locale(config) {
        null != config && this.set(config);
    }
    hooks.suppressDeprecationWarnings = !1, hooks.deprecationHandler = null;
    var keys$1 = Object.keys ? Object.keys : function(obj) {
        var i, res = [];
        for (i in obj) hasOwnProp(obj, i) && res.push(i);
        return res;
    };
    var aliases = {};
    function addUnitAlias(unit, shorthand) {
        var lowerCase = unit.toLowerCase();
        aliases[lowerCase] = aliases[lowerCase + "s"] = aliases[shorthand] = unit;
    }
    function normalizeUnits(units) {
        return "string" == typeof units ? aliases[units] || aliases[units.toLowerCase()] : void 0;
    }
    function normalizeObjectUnits(inputObject) {
        var normalizedProp, prop, normalizedInput = {};
        for (prop in inputObject) hasOwnProp(inputObject, prop) && (normalizedProp = normalizeUnits(prop)) && (normalizedInput[normalizedProp] = inputObject[prop]);
        return normalizedInput;
    }
    var priorities = {};
    function addUnitPriority(unit, priority) {
        priorities[unit] = priority;
    }
    function makeGetSet(unit, keepTime) {
        return function(value) {
            return null != value ? (set$1(this, unit, value), hooks.updateOffset(this, keepTime), 
            this) : get(this, unit);
        };
    }
    function get(mom, unit) {
        return mom.isValid() ? mom._d["get" + (mom._isUTC ? "UTC" : "") + unit]() : NaN;
    }
    function set$1(mom, unit, value) {
        mom.isValid() && mom._d["set" + (mom._isUTC ? "UTC" : "") + unit](value);
    }
    function zeroFill(number, targetLength, forceSign) {
        var absNumber = "" + Math.abs(number), zerosToFill = targetLength - absNumber.length;
        return (0 <= number ? forceSign ? "+" : "" : "-") + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber;
    }
    var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, formatFunctions = {}, formatTokenFunctions = {};
    function addFormatToken(token, padded, ordinal, callback) {
        var func = callback;
        "string" == typeof callback && (func = function() {
            return this[callback]();
        }), token && (formatTokenFunctions[token] = func), padded && (formatTokenFunctions[padded[0]] = function() {
            return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
        }), ordinal && (formatTokenFunctions[ordinal] = function() {
            return this.localeData().ordinal(func.apply(this, arguments), token);
        });
    }
    function formatMoment(m, format) {
        return m.isValid() ? (format = expandFormat(format, m.localeData()), formatFunctions[format] = formatFunctions[format] || function(format) {
            var i, length, input, array = format.match(formattingTokens);
            for (i = 0, length = array.length; i < length; i++) formatTokenFunctions[array[i]] ? array[i] = formatTokenFunctions[array[i]] : array[i] = (input = array[i]).match(/\[[\s\S]/) ? input.replace(/^\[|\]$/g, "") : input.replace(/\\/g, "");
            return function(mom) {
                var i, output = "";
                for (i = 0; i < length; i++) output += isFunction(array[i]) ? array[i].call(mom, format) : array[i];
                return output;
            };
        }(format), formatFunctions[format](m)) : m.localeData().invalidDate();
    }
    function expandFormat(format, locale) {
        var i = 5;
        function replaceLongDateFormatTokens(input) {
            return locale.longDateFormat(input) || input;
        }
        for (localFormattingTokens.lastIndex = 0; 0 <= i && localFormattingTokens.test(format); ) format = format.replace(localFormattingTokens, replaceLongDateFormatTokens), 
        localFormattingTokens.lastIndex = 0, i -= 1;
        return format;
    }
    var match1 = /\d/, match2 = /\d\d/, match3 = /\d{3}/, match4 = /\d{4}/, match6 = /[+-]?\d{6}/, match1to2 = /\d\d?/, match3to4 = /\d\d\d\d?/, match5to6 = /\d\d\d\d\d\d?/, match1to3 = /\d{1,3}/, match1to4 = /\d{1,4}/, match1to6 = /[+-]?\d{1,6}/, matchUnsigned = /\d+/, matchSigned = /[+-]?\d+/, matchOffset = /Z|[+-]\d\d:?\d\d/gi, matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, matchWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, regexes = {};
    function addRegexToken(token, regex, strictRegex) {
        regexes[token] = isFunction(regex) ? regex : function(isStrict, localeData) {
            return isStrict && strictRegex ? strictRegex : regex;
        };
    }
    function getParseRegexForToken(token, config) {
        return hasOwnProp(regexes, token) ? regexes[token](config._strict, config._locale) : new RegExp(regexEscape(token.replace("\\", "").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function(matched, p1, p2, p3, p4) {
            return p1 || p2 || p3 || p4;
        })));
    }
    function regexEscape(s) {
        return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
    }
    var tokens = {};
    function addParseToken(token, callback) {
        var i, func = callback;
        for ("string" == typeof token && (token = [ token ]), isNumber(callback) && (func = function(input, array) {
            array[callback] = toInt(input);
        }), i = 0; i < token.length; i++) tokens[token[i]] = func;
    }
    function addWeekParseToken(token, callback) {
        addParseToken(token, function(input, array, config, token) {
            config._w = config._w || {}, callback(input, config._w, config, token);
        });
    }
    function addTimeToArrayFromToken(token, input, config) {
        null != input && hasOwnProp(tokens, token) && tokens[token](input, config._a, config, token);
    }
    var YEAR = 0, MONTH = 1, DATE = 2, HOUR = 3, MINUTE = 4, SECOND = 5, MILLISECOND = 6, WEEK = 7, WEEKDAY = 8, indexOf$1 = Array.prototype.indexOf ? Array.prototype.indexOf : function(o) {
        var i;
        for (i = 0; i < this.length; ++i) if (this[i] === o) return i;
        return -1;
    };
    function daysInMonth(year, month) {
        return new Date(Date.UTC(year, month + 1, 0)).getUTCDate();
    }
    addFormatToken("M", [ "MM", 2 ], "Mo", function() {
        return this.month() + 1;
    }), addFormatToken("MMM", 0, 0, function(format) {
        return this.localeData().monthsShort(this, format);
    }), addFormatToken("MMMM", 0, 0, function(format) {
        return this.localeData().months(this, format);
    }), addUnitAlias("month", "M"), addUnitPriority("month", 8), addRegexToken("M", match1to2), 
    addRegexToken("MM", match1to2, match2), addRegexToken("MMM", function(isStrict, locale) {
        return locale.monthsShortRegex(isStrict);
    }), addRegexToken("MMMM", function(isStrict, locale) {
        return locale.monthsRegex(isStrict);
    }), addParseToken([ "M", "MM" ], function(input, array) {
        array[MONTH] = toInt(input) - 1;
    }), addParseToken([ "MMM", "MMMM" ], function(input, array, config, token) {
        var month = config._locale.monthsParse(input, token, config._strict);
        null != month ? array[MONTH] = month : getParsingFlags(config).invalidMonth = input;
    });
    var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, defaultLocaleMonths = "January_February_March_April_May_June_July_August_September_October_November_December".split("_");
    var defaultLocaleMonthsShort = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_");
    function setMonth(mom, value) {
        var dayOfMonth;
        if (!mom.isValid()) return mom;
        if ("string" == typeof value) if (/^\d+$/.test(value)) value = toInt(value); else if (!isNumber(value = mom.localeData().monthsParse(value))) return mom;
        return dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)), mom._d["set" + (mom._isUTC ? "UTC" : "") + "Month"](value, dayOfMonth), 
        mom;
    }
    function getSetMonth(value) {
        return null != value ? (setMonth(this, value), hooks.updateOffset(this, !0), this) : get(this, "Month");
    }
    var defaultMonthsShortRegex = matchWord;
    var defaultMonthsRegex = matchWord;
    function computeMonthsParse() {
        function cmpLenRev(a, b) {
            return b.length - a.length;
        }
        var i, mom, shortPieces = [], longPieces = [], mixedPieces = [];
        for (i = 0; i < 12; i++) mom = createUTC([ 2e3, i ]), shortPieces.push(this.monthsShort(mom, "")), 
        longPieces.push(this.months(mom, "")), mixedPieces.push(this.months(mom, "")), mixedPieces.push(this.monthsShort(mom, ""));
        for (shortPieces.sort(cmpLenRev), longPieces.sort(cmpLenRev), mixedPieces.sort(cmpLenRev), 
        i = 0; i < 12; i++) shortPieces[i] = regexEscape(shortPieces[i]), longPieces[i] = regexEscape(longPieces[i]);
        for (i = 0; i < 24; i++) mixedPieces[i] = regexEscape(mixedPieces[i]);
        this._monthsRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i"), this._monthsShortRegex = this._monthsRegex, 
        this._monthsStrictRegex = new RegExp("^(" + longPieces.join("|") + ")", "i"), this._monthsShortStrictRegex = new RegExp("^(" + shortPieces.join("|") + ")", "i");
    }
    function daysInYear(year) {
        return isLeapYear(year) ? 366 : 365;
    }
    function isLeapYear(year) {
        return year % 4 == 0 && year % 100 != 0 || year % 400 == 0;
    }
    addFormatToken("Y", 0, 0, function() {
        var y = this.year();
        return y <= 9999 ? "" + y : "+" + y;
    }), addFormatToken(0, [ "YY", 2 ], 0, function() {
        return this.year() % 100;
    }), addFormatToken(0, [ "YYYY", 4 ], 0, "year"), addFormatToken(0, [ "YYYYY", 5 ], 0, "year"), 
    addFormatToken(0, [ "YYYYYY", 6, !0 ], 0, "year"), addUnitAlias("year", "y"), addUnitPriority("year", 1), 
    addRegexToken("Y", matchSigned), addRegexToken("YY", match1to2, match2), addRegexToken("YYYY", match1to4, match4), 
    addRegexToken("YYYYY", match1to6, match6), addRegexToken("YYYYYY", match1to6, match6), 
    addParseToken([ "YYYYY", "YYYYYY" ], YEAR), addParseToken("YYYY", function(input, array) {
        array[YEAR] = 2 === input.length ? hooks.parseTwoDigitYear(input) : toInt(input);
    }), addParseToken("YY", function(input, array) {
        array[YEAR] = hooks.parseTwoDigitYear(input);
    }), addParseToken("Y", function(input, array) {
        array[YEAR] = parseInt(input, 10);
    }), hooks.parseTwoDigitYear = function(input) {
        return toInt(input) + (68 < toInt(input) ? 1900 : 2e3);
    };
    var getSetYear = makeGetSet("FullYear", !0);
    function createUTCDate(y) {
        var date = new Date(Date.UTC.apply(null, arguments));
        return y < 100 && 0 <= y && isFinite(date.getUTCFullYear()) && date.setUTCFullYear(y), 
        date;
    }
    function firstWeekOffset(year, dow, doy) {
        var fwd = 7 + dow - doy;
        return -((7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7) + fwd - 1;
    }
    function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
        var resYear, resDayOfYear, dayOfYear = 1 + 7 * (week - 1) + (7 + weekday - dow) % 7 + firstWeekOffset(year, dow, doy);
        return dayOfYear <= 0 ? resDayOfYear = daysInYear(resYear = year - 1) + dayOfYear : dayOfYear > daysInYear(year) ? (resYear = year + 1, 
        resDayOfYear = dayOfYear - daysInYear(year)) : (resYear = year, resDayOfYear = dayOfYear), 
        {
            year: resYear,
            dayOfYear: resDayOfYear
        };
    }
    function weekOfYear(mom, dow, doy) {
        var resWeek, resYear, weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1;
        return week < 1 ? resWeek = week + weeksInYear(resYear = mom.year() - 1, dow, doy) : week > weeksInYear(mom.year(), dow, doy) ? (resWeek = week - weeksInYear(mom.year(), dow, doy), 
        resYear = mom.year() + 1) : (resYear = mom.year(), resWeek = week), {
            week: resWeek,
            year: resYear
        };
    }
    function weeksInYear(year, dow, doy) {
        var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
        return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
    }
    addFormatToken("w", [ "ww", 2 ], "wo", "week"), addFormatToken("W", [ "WW", 2 ], "Wo", "isoWeek"), 
    addUnitAlias("week", "w"), addUnitAlias("isoWeek", "W"), addUnitPriority("week", 5), 
    addUnitPriority("isoWeek", 5), addRegexToken("w", match1to2), addRegexToken("ww", match1to2, match2), 
    addRegexToken("W", match1to2), addRegexToken("WW", match1to2, match2), addWeekParseToken([ "w", "ww", "W", "WW" ], function(input, week, config, token) {
        week[token.substr(0, 1)] = toInt(input);
    });
    addFormatToken("d", 0, "do", "day"), addFormatToken("dd", 0, 0, function(format) {
        return this.localeData().weekdaysMin(this, format);
    }), addFormatToken("ddd", 0, 0, function(format) {
        return this.localeData().weekdaysShort(this, format);
    }), addFormatToken("dddd", 0, 0, function(format) {
        return this.localeData().weekdays(this, format);
    }), addFormatToken("e", 0, 0, "weekday"), addFormatToken("E", 0, 0, "isoWeekday"), 
    addUnitAlias("day", "d"), addUnitAlias("weekday", "e"), addUnitAlias("isoWeekday", "E"), 
    addUnitPriority("day", 11), addUnitPriority("weekday", 11), addUnitPriority("isoWeekday", 11), 
    addRegexToken("d", match1to2), addRegexToken("e", match1to2), addRegexToken("E", match1to2), 
    addRegexToken("dd", function(isStrict, locale) {
        return locale.weekdaysMinRegex(isStrict);
    }), addRegexToken("ddd", function(isStrict, locale) {
        return locale.weekdaysShortRegex(isStrict);
    }), addRegexToken("dddd", function(isStrict, locale) {
        return locale.weekdaysRegex(isStrict);
    }), addWeekParseToken([ "dd", "ddd", "dddd" ], function(input, week, config, token) {
        var weekday = config._locale.weekdaysParse(input, token, config._strict);
        null != weekday ? week.d = weekday : getParsingFlags(config).invalidWeekday = input;
    }), addWeekParseToken([ "d", "e", "E" ], function(input, week, config, token) {
        week[token] = toInt(input);
    });
    var defaultLocaleWeekdays = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_");
    var defaultLocaleWeekdaysShort = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_");
    var defaultLocaleWeekdaysMin = "Su_Mo_Tu_We_Th_Fr_Sa".split("_");
    var defaultWeekdaysRegex = matchWord;
    var defaultWeekdaysShortRegex = matchWord;
    var defaultWeekdaysMinRegex = matchWord;
    function computeWeekdaysParse() {
        function cmpLenRev(a, b) {
            return b.length - a.length;
        }
        var i, mom, minp, shortp, longp, minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [];
        for (i = 0; i < 7; i++) mom = createUTC([ 2e3, 1 ]).day(i), minp = this.weekdaysMin(mom, ""), 
        shortp = this.weekdaysShort(mom, ""), longp = this.weekdays(mom, ""), minPieces.push(minp), 
        shortPieces.push(shortp), longPieces.push(longp), mixedPieces.push(minp), mixedPieces.push(shortp), 
        mixedPieces.push(longp);
        for (minPieces.sort(cmpLenRev), shortPieces.sort(cmpLenRev), longPieces.sort(cmpLenRev), 
        mixedPieces.sort(cmpLenRev), i = 0; i < 7; i++) shortPieces[i] = regexEscape(shortPieces[i]), 
        longPieces[i] = regexEscape(longPieces[i]), mixedPieces[i] = regexEscape(mixedPieces[i]);
        this._weekdaysRegex = new RegExp("^(" + mixedPieces.join("|") + ")", "i"), this._weekdaysShortRegex = this._weekdaysRegex, 
        this._weekdaysMinRegex = this._weekdaysRegex, this._weekdaysStrictRegex = new RegExp("^(" + longPieces.join("|") + ")", "i"), 
        this._weekdaysShortStrictRegex = new RegExp("^(" + shortPieces.join("|") + ")", "i"), 
        this._weekdaysMinStrictRegex = new RegExp("^(" + minPieces.join("|") + ")", "i");
    }
    function hFormat() {
        return this.hours() % 12 || 12;
    }
    function meridiem(token, lowercase) {
        addFormatToken(token, 0, 0, function() {
            return this.localeData().meridiem(this.hours(), this.minutes(), lowercase);
        });
    }
    function matchMeridiem(isStrict, locale) {
        return locale._meridiemParse;
    }
    addFormatToken("H", [ "HH", 2 ], 0, "hour"), addFormatToken("h", [ "hh", 2 ], 0, hFormat), 
    addFormatToken("k", [ "kk", 2 ], 0, function() {
        return this.hours() || 24;
    }), addFormatToken("hmm", 0, 0, function() {
        return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2);
    }), addFormatToken("hmmss", 0, 0, function() {
        return "" + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
    }), addFormatToken("Hmm", 0, 0, function() {
        return "" + this.hours() + zeroFill(this.minutes(), 2);
    }), addFormatToken("Hmmss", 0, 0, function() {
        return "" + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2);
    }), meridiem("a", !0), meridiem("A", !1), addUnitAlias("hour", "h"), addUnitPriority("hour", 13), 
    addRegexToken("a", matchMeridiem), addRegexToken("A", matchMeridiem), addRegexToken("H", match1to2), 
    addRegexToken("h", match1to2), addRegexToken("k", match1to2), addRegexToken("HH", match1to2, match2), 
    addRegexToken("hh", match1to2, match2), addRegexToken("kk", match1to2, match2), 
    addRegexToken("hmm", match3to4), addRegexToken("hmmss", match5to6), addRegexToken("Hmm", match3to4), 
    addRegexToken("Hmmss", match5to6), addParseToken([ "H", "HH" ], HOUR), addParseToken([ "k", "kk" ], function(input, array, config) {
        var kInput = toInt(input);
        array[HOUR] = 24 === kInput ? 0 : kInput;
    }), addParseToken([ "a", "A" ], function(input, array, config) {
        config._isPm = config._locale.isPM(input), config._meridiem = input;
    }), addParseToken([ "h", "hh" ], function(input, array, config) {
        array[HOUR] = toInt(input), getParsingFlags(config).bigHour = !0;
    }), addParseToken("hmm", function(input, array, config) {
        var pos = input.length - 2;
        array[HOUR] = toInt(input.substr(0, pos)), array[MINUTE] = toInt(input.substr(pos)), 
        getParsingFlags(config).bigHour = !0;
    }), addParseToken("hmmss", function(input, array, config) {
        var pos1 = input.length - 4, pos2 = input.length - 2;
        array[HOUR] = toInt(input.substr(0, pos1)), array[MINUTE] = toInt(input.substr(pos1, 2)), 
        array[SECOND] = toInt(input.substr(pos2)), getParsingFlags(config).bigHour = !0;
    }), addParseToken("Hmm", function(input, array, config) {
        var pos = input.length - 2;
        array[HOUR] = toInt(input.substr(0, pos)), array[MINUTE] = toInt(input.substr(pos));
    }), addParseToken("Hmmss", function(input, array, config) {
        var pos1 = input.length - 4, pos2 = input.length - 2;
        array[HOUR] = toInt(input.substr(0, pos1)), array[MINUTE] = toInt(input.substr(pos1, 2)), 
        array[SECOND] = toInt(input.substr(pos2));
    });
    var globalLocale, getSetHour = makeGetSet("Hours", !0), baseConfig = {
        calendar: {
            sameDay: "[Today at] LT",
            nextDay: "[Tomorrow at] LT",
            nextWeek: "dddd [at] LT",
            lastDay: "[Yesterday at] LT",
            lastWeek: "[Last] dddd [at] LT",
            sameElse: "L"
        },
        longDateFormat: {
            LTS: "h:mm:ss A",
            LT: "h:mm A",
            L: "MM/DD/YYYY",
            LL: "MMMM D, YYYY",
            LLL: "MMMM D, YYYY h:mm A",
            LLLL: "dddd, MMMM D, YYYY h:mm A"
        },
        invalidDate: "Invalid date",
        ordinal: "%d",
        dayOfMonthOrdinalParse: /\d{1,2}/,
        relativeTime: {
            future: "in %s",
            past: "%s ago",
            s: "a few seconds",
            ss: "%d seconds",
            m: "a minute",
            mm: "%d minutes",
            h: "an hour",
            hh: "%d hours",
            d: "a day",
            dd: "%d days",
            M: "a month",
            MM: "%d months",
            y: "a year",
            yy: "%d years"
        },
        months: defaultLocaleMonths,
        monthsShort: defaultLocaleMonthsShort,
        week: {
            dow: 0,
            doy: 6
        },
        weekdays: defaultLocaleWeekdays,
        weekdaysMin: defaultLocaleWeekdaysMin,
        weekdaysShort: defaultLocaleWeekdaysShort,
        meridiemParse: /[ap]\.?m?\.?/i
    }, locales = {}, localeFamilies = {};
    function normalizeLocale(key) {
        return key ? key.toLowerCase().replace("_", "-") : key;
    }
    function loadLocale(name) {
        var oldLocale = null;
        if (!locales[name] && "undefined" != typeof module && module && module.exports) try {
            oldLocale = globalLocale._abbr, require("./locale/" + name), getSetGlobalLocale(oldLocale);
        } catch (e) {}
        return locales[name];
    }
    function getSetGlobalLocale(key, values) {
        var data;
        return key && (data = isUndefined(values) ? getLocale(key) : defineLocale(key, values)) && (globalLocale = data), 
        globalLocale._abbr;
    }
    function defineLocale(name, config) {
        if (null !== config) {
            var parentConfig = baseConfig;
            if (config.abbr = name, null != locales[name]) deprecateSimple("defineLocaleOverride", "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."), 
            parentConfig = locales[name]._config; else if (null != config.parentLocale) {
                if (null == locales[config.parentLocale]) return localeFamilies[config.parentLocale] || (localeFamilies[config.parentLocale] = []), 
                localeFamilies[config.parentLocale].push({
                    name: name,
                    config: config
                }), null;
                parentConfig = locales[config.parentLocale]._config;
            }
            return locales[name] = new Locale(mergeConfigs(parentConfig, config)), localeFamilies[name] && localeFamilies[name].forEach(function(x) {
                defineLocale(x.name, x.config);
            }), getSetGlobalLocale(name), locales[name];
        }
        return delete locales[name], null;
    }
    function getLocale(key) {
        var locale;
        if (key && key._locale && key._locale._abbr && (key = key._locale._abbr), !key) return globalLocale;
        if (!isArray(key)) {
            if (locale = loadLocale(key)) return locale;
            key = [ key ];
        }
        return function(names) {
            for (var j, next, locale, split, i = 0; i < names.length; ) {
                for (j = (split = normalizeLocale(names[i]).split("-")).length, next = (next = normalizeLocale(names[i + 1])) ? next.split("-") : null; 0 < j; ) {
                    if (locale = loadLocale(split.slice(0, j).join("-"))) return locale;
                    if (next && next.length >= j && compareArrays(split, next, !0) >= j - 1) break;
                    j--;
                }
                i++;
            }
            return null;
        }(key);
    }
    function checkOverflow(m) {
        var overflow, a = m._a;
        return a && -2 === getParsingFlags(m).overflow && (overflow = a[MONTH] < 0 || 11 < a[MONTH] ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || 24 < a[HOUR] || 24 === a[HOUR] && (0 !== a[MINUTE] || 0 !== a[SECOND] || 0 !== a[MILLISECOND]) ? HOUR : a[MINUTE] < 0 || 59 < a[MINUTE] ? MINUTE : a[SECOND] < 0 || 59 < a[SECOND] ? SECOND : a[MILLISECOND] < 0 || 999 < a[MILLISECOND] ? MILLISECOND : -1, 
        getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || DATE < overflow) && (overflow = DATE), 
        getParsingFlags(m)._overflowWeeks && -1 === overflow && (overflow = WEEK), getParsingFlags(m)._overflowWeekday && -1 === overflow && (overflow = WEEKDAY), 
        getParsingFlags(m).overflow = overflow), m;
    }
    var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/, basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/, tzRegex = /Z|[+-]\d\d(?::?\d\d)?/, isoDates = [ [ "YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/ ], [ "YYYY-MM-DD", /\d{4}-\d\d-\d\d/ ], [ "GGGG-[W]WW-E", /\d{4}-W\d\d-\d/ ], [ "GGGG-[W]WW", /\d{4}-W\d\d/, !1 ], [ "YYYY-DDD", /\d{4}-\d{3}/ ], [ "YYYY-MM", /\d{4}-\d\d/, !1 ], [ "YYYYYYMMDD", /[+-]\d{10}/ ], [ "YYYYMMDD", /\d{8}/ ], [ "GGGG[W]WWE", /\d{4}W\d{3}/ ], [ "GGGG[W]WW", /\d{4}W\d{2}/, !1 ], [ "YYYYDDD", /\d{7}/ ] ], isoTimes = [ [ "HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/ ], [ "HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/ ], [ "HH:mm:ss", /\d\d:\d\d:\d\d/ ], [ "HH:mm", /\d\d:\d\d/ ], [ "HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/ ], [ "HHmmss,SSSS", /\d\d\d\d\d\d,\d+/ ], [ "HHmmss", /\d\d\d\d\d\d/ ], [ "HHmm", /\d\d\d\d/ ], [ "HH", /\d\d/ ] ], aspNetJsonRegex = /^\/?Date\((\-?\d+)/i;
    function configFromISO(config) {
        var i, l, allowTime, dateFormat, timeFormat, tzFormat, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string);
        if (match) {
            for (getParsingFlags(config).iso = !0, i = 0, l = isoDates.length; i < l; i++) if (isoDates[i][1].exec(match[1])) {
                dateFormat = isoDates[i][0], allowTime = !1 !== isoDates[i][2];
                break;
            }
            if (null == dateFormat) return void (config._isValid = !1);
            if (match[3]) {
                for (i = 0, l = isoTimes.length; i < l; i++) if (isoTimes[i][1].exec(match[3])) {
                    timeFormat = (match[2] || " ") + isoTimes[i][0];
                    break;
                }
                if (null == timeFormat) return void (config._isValid = !1);
            }
            if (!allowTime && null != timeFormat) return void (config._isValid = !1);
            if (match[4]) {
                if (!tzRegex.exec(match[4])) return void (config._isValid = !1);
                tzFormat = "Z";
            }
            config._f = dateFormat + (timeFormat || "") + (tzFormat || ""), configFromStringAndFormat(config);
        } else config._isValid = !1;
    }
    var basicRfcRegex = /^((?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d?\d\s(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(?:\d\d)?\d\d\s)(\d\d:\d\d)(\:\d\d)?(\s(?:UT|GMT|[ECMP][SD]T|[A-IK-Za-ik-z]|[+-]\d{4}))$/;
    function configFromRFC2822(config) {
        var string, match, dayFormat, dateFormat, timeFormat, timezone, timezoneIndex, timezones = {
            " GMT": " +0000",
            " EDT": " -0400",
            " EST": " -0500",
            " CDT": " -0500",
            " CST": " -0600",
            " MDT": " -0600",
            " MST": " -0700",
            " PDT": " -0700",
            " PST": " -0800"
        };
        if (string = config._i.replace(/\([^\)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s|\s$/g, ""), 
        match = basicRfcRegex.exec(string)) {
            if (dayFormat = match[1] ? "ddd" + (5 === match[1].length ? ", " : " ") : "", dateFormat = "D MMM " + (10 < match[2].length ? "YYYY " : "YY "), 
            timeFormat = "HH:mm" + (match[4] ? ":ss" : ""), match[1]) {
                var momentDay = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ][new Date(match[2]).getDay()];
                if (match[1].substr(0, 3) !== momentDay) return getParsingFlags(config).weekdayMismatch = !0, 
                void (config._isValid = !1);
            }
            switch (match[5].length) {
              case 2:
                timezone = 0 === timezoneIndex ? " +0000" : ((timezoneIndex = "YXWVUTSRQPONZABCDEFGHIKLM".indexOf(match[5][1].toUpperCase()) - 12) < 0 ? " -" : " +") + ("" + timezoneIndex).replace(/^-?/, "0").match(/..$/)[0] + "00";
                break;

              case 4:
                timezone = timezones[match[5]];
                break;

              default:
                timezone = timezones[" GMT"];
            }
            match[5] = timezone, config._i = match.splice(1).join(""), " ZZ", config._f = dayFormat + dateFormat + timeFormat + " ZZ", 
            configFromStringAndFormat(config), getParsingFlags(config).rfc2822 = !0;
        } else config._isValid = !1;
    }
    function defaults(a, b, c) {
        return null != a ? a : null != b ? b : c;
    }
    function configFromArray(config) {
        var i, date, currentDate, yearToUse, input = [];
        if (!config._d) {
            for (currentDate = function(config) {
                var nowValue = new Date(hooks.now());
                return config._useUTC ? [ nowValue.getUTCFullYear(), nowValue.getUTCMonth(), nowValue.getUTCDate() ] : [ nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate() ];
            }(config), config._w && null == config._a[DATE] && null == config._a[MONTH] && function(config) {
                var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow;
                if (null != (w = config._w).GG || null != w.W || null != w.E) dow = 1, doy = 4, 
                weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year), 
                week = defaults(w.W, 1), ((weekday = defaults(w.E, 1)) < 1 || 7 < weekday) && (weekdayOverflow = !0); else {
                    dow = config._locale._week.dow, doy = config._locale._week.doy;
                    var curWeek = weekOfYear(createLocal(), dow, doy);
                    weekYear = defaults(w.gg, config._a[YEAR], curWeek.year), week = defaults(w.w, curWeek.week), 
                    null != w.d ? ((weekday = w.d) < 0 || 6 < weekday) && (weekdayOverflow = !0) : null != w.e ? (weekday = w.e + dow, 
                    (w.e < 0 || 6 < w.e) && (weekdayOverflow = !0)) : weekday = dow;
                }
                week < 1 || week > weeksInYear(weekYear, dow, doy) ? getParsingFlags(config)._overflowWeeks = !0 : null != weekdayOverflow ? getParsingFlags(config)._overflowWeekday = !0 : (temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), 
                config._a[YEAR] = temp.year, config._dayOfYear = temp.dayOfYear);
            }(config), null != config._dayOfYear && (yearToUse = defaults(config._a[YEAR], currentDate[YEAR]), 
            (config._dayOfYear > daysInYear(yearToUse) || 0 === config._dayOfYear) && (getParsingFlags(config)._overflowDayOfYear = !0), 
            date = createUTCDate(yearToUse, 0, config._dayOfYear), config._a[MONTH] = date.getUTCMonth(), 
            config._a[DATE] = date.getUTCDate()), i = 0; i < 3 && null == config._a[i]; ++i) config._a[i] = input[i] = currentDate[i];
            for (;i < 7; i++) config._a[i] = input[i] = null == config._a[i] ? 2 === i ? 1 : 0 : config._a[i];
            24 === config._a[HOUR] && 0 === config._a[MINUTE] && 0 === config._a[SECOND] && 0 === config._a[MILLISECOND] && (config._nextDay = !0, 
            config._a[HOUR] = 0), config._d = (config._useUTC ? createUTCDate : function(y, m, d, h, M, s, ms) {
                var date = new Date(y, m, d, h, M, s, ms);
                return y < 100 && 0 <= y && isFinite(date.getFullYear()) && date.setFullYear(y), 
                date;
            }).apply(null, input), null != config._tzm && config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm), 
            config._nextDay && (config._a[HOUR] = 24);
        }
    }
    function configFromStringAndFormat(config) {
        if (config._f !== hooks.ISO_8601) if (config._f !== hooks.RFC_2822) {
            config._a = [], getParsingFlags(config).empty = !0;
            var i, parsedInput, tokens, token, skipped, string = "" + config._i, stringLength = string.length, totalParsedInputLength = 0;
            for (tokens = expandFormat(config._f, config._locale).match(formattingTokens) || [], 
            i = 0; i < tokens.length; i++) token = tokens[i], (parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]) && (0 < (skipped = string.substr(0, string.indexOf(parsedInput))).length && getParsingFlags(config).unusedInput.push(skipped), 
            string = string.slice(string.indexOf(parsedInput) + parsedInput.length), totalParsedInputLength += parsedInput.length), 
            formatTokenFunctions[token] ? (parsedInput ? getParsingFlags(config).empty = !1 : getParsingFlags(config).unusedTokens.push(token), 
            addTimeToArrayFromToken(token, parsedInput, config)) : config._strict && !parsedInput && getParsingFlags(config).unusedTokens.push(token);
            getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength, 0 < string.length && getParsingFlags(config).unusedInput.push(string), 
            config._a[HOUR] <= 12 && !0 === getParsingFlags(config).bigHour && 0 < config._a[HOUR] && (getParsingFlags(config).bigHour = void 0), 
            getParsingFlags(config).parsedDateParts = config._a.slice(0), getParsingFlags(config).meridiem = config._meridiem, 
            config._a[HOUR] = function(locale, hour, meridiem) {
                var isPm;
                if (null == meridiem) return hour;
                return null != locale.meridiemHour ? locale.meridiemHour(hour, meridiem) : (null != locale.isPM && ((isPm = locale.isPM(meridiem)) && hour < 12 && (hour += 12), 
                isPm || 12 !== hour || (hour = 0)), hour);
            }(config._locale, config._a[HOUR], config._meridiem), configFromArray(config), checkOverflow(config);
        } else configFromRFC2822(config); else configFromISO(config);
    }
    function prepareConfig(config) {
        var input = config._i, format = config._f;
        return config._locale = config._locale || getLocale(config._l), null === input || void 0 === format && "" === input ? createInvalid({
            nullInput: !0
        }) : ("string" == typeof input && (config._i = input = config._locale.preparse(input)), 
        isMoment(input) ? new Moment(checkOverflow(input)) : (isDate(input) ? config._d = input : isArray(format) ? function(config) {
            var tempConfig, bestMoment, scoreToBeat, i, currentScore;
            if (0 === config._f.length) return getParsingFlags(config).invalidFormat = !0, config._d = new Date(NaN);
            for (i = 0; i < config._f.length; i++) currentScore = 0, tempConfig = copyConfig({}, config), 
            null != config._useUTC && (tempConfig._useUTC = config._useUTC), tempConfig._f = config._f[i], 
            configFromStringAndFormat(tempConfig), isValid(tempConfig) && (currentScore += getParsingFlags(tempConfig).charsLeftOver, 
            currentScore += 10 * getParsingFlags(tempConfig).unusedTokens.length, getParsingFlags(tempConfig).score = currentScore, 
            (null == scoreToBeat || currentScore < scoreToBeat) && (scoreToBeat = currentScore, 
            bestMoment = tempConfig));
            extend(config, bestMoment || tempConfig);
        }(config) : format ? configFromStringAndFormat(config) : function(config) {
            var input = config._i;
            isUndefined(input) ? config._d = new Date(hooks.now()) : isDate(input) ? config._d = new Date(input.valueOf()) : "string" == typeof input ? function(config) {
                var matched = aspNetJsonRegex.exec(config._i);
                null === matched ? (configFromISO(config), !1 === config._isValid && (delete config._isValid, 
                configFromRFC2822(config), !1 === config._isValid && (delete config._isValid, hooks.createFromInputFallback(config)))) : config._d = new Date(+matched[1]);
            }(config) : isArray(input) ? (config._a = map(input.slice(0), function(obj) {
                return parseInt(obj, 10);
            }), configFromArray(config)) : isObject(input) ? function(config) {
                if (!config._d) {
                    var i = normalizeObjectUnits(config._i);
                    config._a = map([ i.year, i.month, i.day || i.date, i.hour, i.minute, i.second, i.millisecond ], function(obj) {
                        return obj && parseInt(obj, 10);
                    }), configFromArray(config);
                }
            }(config) : isNumber(input) ? config._d = new Date(input) : hooks.createFromInputFallback(config);
        }(config), isValid(config) || (config._d = null), config));
    }
    function createLocalOrUTC(input, format, locale, strict, isUTC) {
        var res, c = {};
        return !0 !== locale && !1 !== locale || (strict = locale, locale = void 0), (isObject(input) && function(obj) {
            var k;
            for (k in obj) return !1;
            return !0;
        }(input) || isArray(input) && 0 === input.length) && (input = void 0), c._isAMomentObject = !0, 
        c._useUTC = c._isUTC = isUTC, c._l = locale, c._i = input, c._f = format, c._strict = strict, 
        (res = new Moment(checkOverflow(prepareConfig(c))))._nextDay && (res.add(1, "d"), 
        res._nextDay = void 0), res;
    }
    function createLocal(input, format, locale, strict) {
        return createLocalOrUTC(input, format, locale, strict, !1);
    }
    hooks.createFromInputFallback = deprecate("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.", function(config) {
        config._d = new Date(config._i + (config._useUTC ? " UTC" : ""));
    }), hooks.ISO_8601 = function() {}, hooks.RFC_2822 = function() {};
    var prototypeMin = deprecate("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/", function() {
        var other = createLocal.apply(null, arguments);
        return this.isValid() && other.isValid() ? other < this ? this : other : createInvalid();
    }), prototypeMax = deprecate("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/", function() {
        var other = createLocal.apply(null, arguments);
        return this.isValid() && other.isValid() ? this < other ? this : other : createInvalid();
    });
    function pickBy(fn, moments) {
        var res, i;
        if (1 === moments.length && isArray(moments[0]) && (moments = moments[0]), !moments.length) return createLocal();
        for (res = moments[0], i = 1; i < moments.length; ++i) moments[i].isValid() && !moments[i][fn](res) || (res = moments[i]);
        return res;
    }
    var ordering = [ "year", "quarter", "month", "week", "day", "hour", "minute", "second", "millisecond" ];
    function Duration(duration) {
        var normalizedInput = normalizeObjectUnits(duration), years = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months = normalizedInput.month || 0, weeks = normalizedInput.week || 0, days = normalizedInput.day || 0, hours = normalizedInput.hour || 0, minutes = normalizedInput.minute || 0, seconds = normalizedInput.second || 0, milliseconds = normalizedInput.millisecond || 0;
        this._isValid = function(m) {
            for (var key in m) if (-1 === ordering.indexOf(key) || null != m[key] && isNaN(m[key])) return !1;
            for (var unitHasDecimal = !1, i = 0; i < ordering.length; ++i) if (m[ordering[i]]) {
                if (unitHasDecimal) return !1;
                parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]]) && (unitHasDecimal = !0);
            }
            return !0;
        }(normalizedInput), this._milliseconds = +milliseconds + 1e3 * seconds + 6e4 * minutes + 1e3 * hours * 60 * 60, 
        this._days = +days + 7 * weeks, this._months = +months + 3 * quarters + 12 * years, 
        this._data = {}, this._locale = getLocale(), this._bubble();
    }
    function isDuration(obj) {
        return obj instanceof Duration;
    }
    function absRound(number) {
        return number < 0 ? -1 * Math.round(-1 * number) : Math.round(number);
    }
    function offset(token, separator) {
        addFormatToken(token, 0, 0, function() {
            var offset = this.utcOffset(), sign = "+";
            return offset < 0 && (offset = -offset, sign = "-"), sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2);
        });
    }
    offset("Z", ":"), offset("ZZ", ""), addRegexToken("Z", matchShortOffset), addRegexToken("ZZ", matchShortOffset), 
    addParseToken([ "Z", "ZZ" ], function(input, array, config) {
        config._useUTC = !0, config._tzm = offsetFromString(matchShortOffset, input);
    });
    var chunkOffset = /([\+\-]|\d\d)/gi;
    function offsetFromString(matcher, string) {
        var matches = (string || "").match(matcher);
        if (null === matches) return null;
        var parts = ((matches[matches.length - 1] || []) + "").match(chunkOffset) || [ "-", 0, 0 ], minutes = 60 * parts[1] + toInt(parts[2]);
        return 0 === minutes ? 0 : "+" === parts[0] ? minutes : -minutes;
    }
    function cloneWithOffset(input, model) {
        var res, diff;
        return model._isUTC ? (res = model.clone(), diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(), 
        res._d.setTime(res._d.valueOf() + diff), hooks.updateOffset(res, !1), res) : createLocal(input).local();
    }
    function getDateOffset(m) {
        return 15 * -Math.round(m._d.getTimezoneOffset() / 15);
    }
    function isUtc() {
        return !!this.isValid() && (this._isUTC && 0 === this._offset);
    }
    hooks.updateOffset = function() {};
    var aspNetRegex = /^(\-)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/, isoRegex = /^(-)?P(?:(-?[0-9,.]*)Y)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)W)?(?:(-?[0-9,.]*)D)?(?:T(?:(-?[0-9,.]*)H)?(?:(-?[0-9,.]*)M)?(?:(-?[0-9,.]*)S)?)?$/;
    function createDuration(input, key) {
        var sign, ret, diffRes, duration = input, match = null;
        return isDuration(input) ? duration = {
            ms: input._milliseconds,
            d: input._days,
            M: input._months
        } : isNumber(input) ? (duration = {}, key ? duration[key] = input : duration.milliseconds = input) : (match = aspNetRegex.exec(input)) ? (sign = "-" === match[1] ? -1 : 1, 
        duration = {
            y: 0,
            d: toInt(match[DATE]) * sign,
            h: toInt(match[HOUR]) * sign,
            m: toInt(match[MINUTE]) * sign,
            s: toInt(match[SECOND]) * sign,
            ms: toInt(absRound(1e3 * match[MILLISECOND])) * sign
        }) : (match = isoRegex.exec(input)) ? (sign = "-" === match[1] ? -1 : 1, duration = {
            y: parseIso(match[2], sign),
            M: parseIso(match[3], sign),
            w: parseIso(match[4], sign),
            d: parseIso(match[5], sign),
            h: parseIso(match[6], sign),
            m: parseIso(match[7], sign),
            s: parseIso(match[8], sign)
        }) : null == duration ? duration = {} : "object" == typeof duration && ("from" in duration || "to" in duration) && (diffRes = function(base, other) {
            var res;
            if (!base.isValid() || !other.isValid()) return {
                milliseconds: 0,
                months: 0
            };
            other = cloneWithOffset(other, base), base.isBefore(other) ? res = positiveMomentsDifference(base, other) : ((res = positiveMomentsDifference(other, base)).milliseconds = -res.milliseconds, 
            res.months = -res.months);
            return res;
        }(createLocal(duration.from), createLocal(duration.to)), (duration = {}).ms = diffRes.milliseconds, 
        duration.M = diffRes.months), ret = new Duration(duration), isDuration(input) && hasOwnProp(input, "_locale") && (ret._locale = input._locale), 
        ret;
    }
    function parseIso(inp, sign) {
        var res = inp && parseFloat(inp.replace(",", "."));
        return (isNaN(res) ? 0 : res) * sign;
    }
    function positiveMomentsDifference(base, other) {
        var res = {
            milliseconds: 0,
            months: 0
        };
        return res.months = other.month() - base.month() + 12 * (other.year() - base.year()), 
        base.clone().add(res.months, "M").isAfter(other) && --res.months, res.milliseconds = +other - +base.clone().add(res.months, "M"), 
        res;
    }
    function createAdder(direction, name) {
        return function(val, period) {
            var tmp;
            return null === period || isNaN(+period) || (deprecateSimple(name, "moment()." + name + "(period, number) is deprecated. Please use moment()." + name + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."), 
            tmp = val, val = period, period = tmp), addSubtract(this, createDuration(val = "string" == typeof val ? +val : val, period), direction), 
            this;
        };
    }
    function addSubtract(mom, duration, isAdding, updateOffset) {
        var milliseconds = duration._milliseconds, days = absRound(duration._days), months = absRound(duration._months);
        mom.isValid() && (updateOffset = null == updateOffset || updateOffset, milliseconds && mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding), 
        days && set$1(mom, "Date", get(mom, "Date") + days * isAdding), months && setMonth(mom, get(mom, "Month") + months * isAdding), 
        updateOffset && hooks.updateOffset(mom, days || months));
    }
    createDuration.fn = Duration.prototype, createDuration.invalid = function() {
        return createDuration(NaN);
    };
    var add = createAdder(1, "add"), subtract = createAdder(-1, "subtract");
    function locale(key) {
        var newLocaleData;
        return void 0 === key ? this._locale._abbr : (null != (newLocaleData = getLocale(key)) && (this._locale = newLocaleData), 
        this);
    }
    hooks.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ", hooks.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]";
    var lang = deprecate("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", function(key) {
        return void 0 === key ? this.localeData() : this.locale(key);
    });
    function localeData() {
        return this._locale;
    }
    function addWeekYearFormatToken(token, getter) {
        addFormatToken(0, [ token, token.length ], 0, getter);
    }
    function getSetWeekYearHelper(input, week, weekday, dow, doy) {
        var weeksTarget;
        return null == input ? weekOfYear(this, dow, doy).year : ((weeksTarget = weeksInYear(input, dow, doy)) < week && (week = weeksTarget), 
        function(weekYear, week, weekday, dow, doy) {
            var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
            return this.year(date.getUTCFullYear()), this.month(date.getUTCMonth()), this.date(date.getUTCDate()), 
            this;
        }.call(this, input, week, weekday, dow, doy));
    }
    addFormatToken(0, [ "gg", 2 ], 0, function() {
        return this.weekYear() % 100;
    }), addFormatToken(0, [ "GG", 2 ], 0, function() {
        return this.isoWeekYear() % 100;
    }), addWeekYearFormatToken("gggg", "weekYear"), addWeekYearFormatToken("ggggg", "weekYear"), 
    addWeekYearFormatToken("GGGG", "isoWeekYear"), addWeekYearFormatToken("GGGGG", "isoWeekYear"), 
    addUnitAlias("weekYear", "gg"), addUnitAlias("isoWeekYear", "GG"), addUnitPriority("weekYear", 1), 
    addUnitPriority("isoWeekYear", 1), addRegexToken("G", matchSigned), addRegexToken("g", matchSigned), 
    addRegexToken("GG", match1to2, match2), addRegexToken("gg", match1to2, match2), 
    addRegexToken("GGGG", match1to4, match4), addRegexToken("gggg", match1to4, match4), 
    addRegexToken("GGGGG", match1to6, match6), addRegexToken("ggggg", match1to6, match6), 
    addWeekParseToken([ "gggg", "ggggg", "GGGG", "GGGGG" ], function(input, week, config, token) {
        week[token.substr(0, 2)] = toInt(input);
    }), addWeekParseToken([ "gg", "GG" ], function(input, week, config, token) {
        week[token] = hooks.parseTwoDigitYear(input);
    }), addFormatToken("Q", 0, "Qo", "quarter"), addUnitAlias("quarter", "Q"), addUnitPriority("quarter", 7), 
    addRegexToken("Q", match1), addParseToken("Q", function(input, array) {
        array[MONTH] = 3 * (toInt(input) - 1);
    }), addFormatToken("D", [ "DD", 2 ], "Do", "date"), addUnitAlias("date", "D"), addUnitPriority("date", 9), 
    addRegexToken("D", match1to2), addRegexToken("DD", match1to2, match2), addRegexToken("Do", function(isStrict, locale) {
        return isStrict ? locale._dayOfMonthOrdinalParse || locale._ordinalParse : locale._dayOfMonthOrdinalParseLenient;
    }), addParseToken([ "D", "DD" ], DATE), addParseToken("Do", function(input, array) {
        array[DATE] = toInt(input.match(match1to2)[0]);
    });
    var getSetDayOfMonth = makeGetSet("Date", !0);
    addFormatToken("DDD", [ "DDDD", 3 ], "DDDo", "dayOfYear"), addUnitAlias("dayOfYear", "DDD"), 
    addUnitPriority("dayOfYear", 4), addRegexToken("DDD", match1to3), addRegexToken("DDDD", match3), 
    addParseToken([ "DDD", "DDDD" ], function(input, array, config) {
        config._dayOfYear = toInt(input);
    }), addFormatToken("m", [ "mm", 2 ], 0, "minute"), addUnitAlias("minute", "m"), 
    addUnitPriority("minute", 14), addRegexToken("m", match1to2), addRegexToken("mm", match1to2, match2), 
    addParseToken([ "m", "mm" ], MINUTE);
    var getSetMinute = makeGetSet("Minutes", !1);
    addFormatToken("s", [ "ss", 2 ], 0, "second"), addUnitAlias("second", "s"), addUnitPriority("second", 15), 
    addRegexToken("s", match1to2), addRegexToken("ss", match1to2, match2), addParseToken([ "s", "ss" ], SECOND);
    var token, getSetSecond = makeGetSet("Seconds", !1);
    for (addFormatToken("S", 0, 0, function() {
        return ~~(this.millisecond() / 100);
    }), addFormatToken(0, [ "SS", 2 ], 0, function() {
        return ~~(this.millisecond() / 10);
    }), addFormatToken(0, [ "SSS", 3 ], 0, "millisecond"), addFormatToken(0, [ "SSSS", 4 ], 0, function() {
        return 10 * this.millisecond();
    }), addFormatToken(0, [ "SSSSS", 5 ], 0, function() {
        return 100 * this.millisecond();
    }), addFormatToken(0, [ "SSSSSS", 6 ], 0, function() {
        return 1e3 * this.millisecond();
    }), addFormatToken(0, [ "SSSSSSS", 7 ], 0, function() {
        return 1e4 * this.millisecond();
    }), addFormatToken(0, [ "SSSSSSSS", 8 ], 0, function() {
        return 1e5 * this.millisecond();
    }), addFormatToken(0, [ "SSSSSSSSS", 9 ], 0, function() {
        return 1e6 * this.millisecond();
    }), addUnitAlias("millisecond", "ms"), addUnitPriority("millisecond", 16), addRegexToken("S", match1to3, match1), 
    addRegexToken("SS", match1to3, match2), addRegexToken("SSS", match1to3, match3), 
    token = "SSSS"; token.length <= 9; token += "S") addRegexToken(token, matchUnsigned);
    function parseMs(input, array) {
        array[MILLISECOND] = toInt(1e3 * ("0." + input));
    }
    for (token = "S"; token.length <= 9; token += "S") addParseToken(token, parseMs);
    var getSetMillisecond = makeGetSet("Milliseconds", !1);
    addFormatToken("z", 0, 0, "zoneAbbr"), addFormatToken("zz", 0, 0, "zoneName");
    var proto = Moment.prototype;
    function preParsePostFormat(string) {
        return string;
    }
    proto.add = add, proto.calendar = function(time, formats) {
        var now = time || createLocal(), sod = cloneWithOffset(now, this).startOf("day"), format = hooks.calendarFormat(this, sod) || "sameElse", output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
        return this.format(output || this.localeData().calendar(format, this, createLocal(now)));
    }, proto.clone = function() {
        return new Moment(this);
    }, proto.diff = function(input, units, asFloat) {
        var that, zoneDelta, delta, output;
        return this.isValid() && (that = cloneWithOffset(input, this)).isValid() ? (zoneDelta = 6e4 * (that.utcOffset() - this.utcOffset()), 
        "year" === (units = normalizeUnits(units)) || "month" === units || "quarter" === units ? (a = this, 
        b = that, wholeMonthDiff = 12 * (b.year() - a.year()) + (b.month() - a.month()), 
        anchor = a.clone().add(wholeMonthDiff, "months"), b - anchor < 0 ? (anchor2 = a.clone().add(wholeMonthDiff - 1, "months"), 
        adjust = (b - anchor) / (anchor - anchor2)) : (anchor2 = a.clone().add(wholeMonthDiff + 1, "months"), 
        adjust = (b - anchor) / (anchor2 - anchor)), output = -(wholeMonthDiff + adjust) || 0, 
        "quarter" === units ? output /= 3 : "year" === units && (output /= 12)) : (delta = this - that, 
        output = "second" === units ? delta / 1e3 : "minute" === units ? delta / 6e4 : "hour" === units ? delta / 36e5 : "day" === units ? (delta - zoneDelta) / 864e5 : "week" === units ? (delta - zoneDelta) / 6048e5 : delta), 
        asFloat ? output : absFloor(output)) : NaN;
        var a, b, anchor2, adjust, wholeMonthDiff, anchor;
    }, proto.endOf = function(units) {
        return void 0 === (units = normalizeUnits(units)) || "millisecond" === units ? this : ("date" === units && (units = "day"), 
        this.startOf(units).add(1, "isoWeek" === units ? "week" : units).subtract(1, "ms"));
    }, proto.format = function(inputString) {
        inputString || (inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat);
        var output = formatMoment(this, inputString);
        return this.localeData().postformat(output);
    }, proto.from = function(time, withoutSuffix) {
        return this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid()) ? createDuration({
            to: this,
            from: time
        }).locale(this.locale()).humanize(!withoutSuffix) : this.localeData().invalidDate();
    }, proto.fromNow = function(withoutSuffix) {
        return this.from(createLocal(), withoutSuffix);
    }, proto.to = function(time, withoutSuffix) {
        return this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid()) ? createDuration({
            from: this,
            to: time
        }).locale(this.locale()).humanize(!withoutSuffix) : this.localeData().invalidDate();
    }, proto.toNow = function(withoutSuffix) {
        return this.to(createLocal(), withoutSuffix);
    }, proto.get = function(units) {
        return isFunction(this[units = normalizeUnits(units)]) ? this[units]() : this;
    }, proto.invalidAt = function() {
        return getParsingFlags(this).overflow;
    }, proto.isAfter = function(input, units) {
        var localInput = isMoment(input) ? input : createLocal(input);
        return !(!this.isValid() || !localInput.isValid()) && ("millisecond" === (units = normalizeUnits(isUndefined(units) ? "millisecond" : units)) ? this.valueOf() > localInput.valueOf() : localInput.valueOf() < this.clone().startOf(units).valueOf());
    }, proto.isBefore = function(input, units) {
        var localInput = isMoment(input) ? input : createLocal(input);
        return !(!this.isValid() || !localInput.isValid()) && ("millisecond" === (units = normalizeUnits(isUndefined(units) ? "millisecond" : units)) ? this.valueOf() < localInput.valueOf() : this.clone().endOf(units).valueOf() < localInput.valueOf());
    }, proto.isBetween = function(from, to, units, inclusivity) {
        return ("(" === (inclusivity = inclusivity || "()")[0] ? this.isAfter(from, units) : !this.isBefore(from, units)) && (")" === inclusivity[1] ? this.isBefore(to, units) : !this.isAfter(to, units));
    }, proto.isSame = function(input, units) {
        var inputMs, localInput = isMoment(input) ? input : createLocal(input);
        return !(!this.isValid() || !localInput.isValid()) && ("millisecond" === (units = normalizeUnits(units || "millisecond")) ? this.valueOf() === localInput.valueOf() : (inputMs = localInput.valueOf(), 
        this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf()));
    }, proto.isSameOrAfter = function(input, units) {
        return this.isSame(input, units) || this.isAfter(input, units);
    }, proto.isSameOrBefore = function(input, units) {
        return this.isSame(input, units) || this.isBefore(input, units);
    }, proto.isValid = function() {
        return isValid(this);
    }, proto.lang = lang, proto.locale = locale, proto.localeData = localeData, proto.max = prototypeMax, 
    proto.min = prototypeMin, proto.parsingFlags = function() {
        return extend({}, getParsingFlags(this));
    }, proto.set = function(units, value) {
        if ("object" == typeof units) for (var prioritized = function(unitsObj) {
            var units = [];
            for (var u in unitsObj) units.push({
                unit: u,
                priority: priorities[u]
            });
            return units.sort(function(a, b) {
                return a.priority - b.priority;
            }), units;
        }(units = normalizeObjectUnits(units)), i = 0; i < prioritized.length; i++) this[prioritized[i].unit](units[prioritized[i].unit]); else if (isFunction(this[units = normalizeUnits(units)])) return this[units](value);
        return this;
    }, proto.startOf = function(units) {
        switch (units = normalizeUnits(units)) {
          case "year":
            this.month(0);

          case "quarter":
          case "month":
            this.date(1);

          case "week":
          case "isoWeek":
          case "day":
          case "date":
            this.hours(0);

          case "hour":
            this.minutes(0);

          case "minute":
            this.seconds(0);

          case "second":
            this.milliseconds(0);
        }
        return "week" === units && this.weekday(0), "isoWeek" === units && this.isoWeekday(1), 
        "quarter" === units && this.month(3 * Math.floor(this.month() / 3)), this;
    }, proto.subtract = subtract, proto.toArray = function() {
        var m = this;
        return [ m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond() ];
    }, proto.toObject = function() {
        var m = this;
        return {
            years: m.year(),
            months: m.month(),
            date: m.date(),
            hours: m.hours(),
            minutes: m.minutes(),
            seconds: m.seconds(),
            milliseconds: m.milliseconds()
        };
    }, proto.toDate = function() {
        return new Date(this.valueOf());
    }, proto.toISOString = function() {
        if (!this.isValid()) return null;
        var m = this.clone().utc();
        return m.year() < 0 || 9999 < m.year() ? formatMoment(m, "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]") : isFunction(Date.prototype.toISOString) ? this.toDate().toISOString() : formatMoment(m, "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]");
    }, proto.inspect = function() {
        if (!this.isValid()) return "moment.invalid(/* " + this._i + " */)";
        var func = "moment", zone = "";
        this.isLocal() || (func = 0 === this.utcOffset() ? "moment.utc" : "moment.parseZone", 
        zone = "Z");
        var prefix = "[" + func + '("]', year = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY", suffix = zone + '[")]';
        return this.format(prefix + year + "-MM-DD[T]HH:mm:ss.SSS" + suffix);
    }, proto.toJSON = function() {
        return this.isValid() ? this.toISOString() : null;
    }, proto.toString = function() {
        return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ");
    }, proto.unix = function() {
        return Math.floor(this.valueOf() / 1e3);
    }, proto.valueOf = function() {
        return this._d.valueOf() - 6e4 * (this._offset || 0);
    }, proto.creationData = function() {
        return {
            input: this._i,
            format: this._f,
            locale: this._locale,
            isUTC: this._isUTC,
            strict: this._strict
        };
    }, proto.year = getSetYear, proto.isLeapYear = function() {
        return isLeapYear(this.year());
    }, proto.weekYear = function(input) {
        return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy);
    }, proto.isoWeekYear = function(input) {
        return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4);
    }, proto.quarter = proto.quarters = function(input) {
        return null == input ? Math.ceil((this.month() + 1) / 3) : this.month(3 * (input - 1) + this.month() % 3);
    }, proto.month = getSetMonth, proto.daysInMonth = function() {
        return daysInMonth(this.year(), this.month());
    }, proto.week = proto.weeks = function(input) {
        var week = this.localeData().week(this);
        return null == input ? week : this.add(7 * (input - week), "d");
    }, proto.isoWeek = proto.isoWeeks = function(input) {
        var week = weekOfYear(this, 1, 4).week;
        return null == input ? week : this.add(7 * (input - week), "d");
    }, proto.weeksInYear = function() {
        var weekInfo = this.localeData()._week;
        return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
    }, proto.isoWeeksInYear = function() {
        return weeksInYear(this.year(), 1, 4);
    }, proto.date = getSetDayOfMonth, proto.day = proto.days = function(input) {
        if (!this.isValid()) return null != input ? this : NaN;
        var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
        return null != input ? (input = function(input, locale) {
            return "string" != typeof input ? input : isNaN(input) ? "number" == typeof (input = locale.weekdaysParse(input)) ? input : null : parseInt(input, 10);
        }(input, this.localeData()), this.add(input - day, "d")) : day;
    }, proto.weekday = function(input) {
        if (!this.isValid()) return null != input ? this : NaN;
        var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
        return null == input ? weekday : this.add(input - weekday, "d");
    }, proto.isoWeekday = function(input) {
        if (!this.isValid()) return null != input ? this : NaN;
        if (null != input) {
            var weekday = function(input, locale) {
                return "string" == typeof input ? locale.weekdaysParse(input) % 7 || 7 : isNaN(input) ? null : input;
            }(input, this.localeData());
            return this.day(this.day() % 7 ? weekday : weekday - 7);
        }
        return this.day() || 7;
    }, proto.dayOfYear = function(input) {
        var dayOfYear = Math.round((this.clone().startOf("day") - this.clone().startOf("year")) / 864e5) + 1;
        return null == input ? dayOfYear : this.add(input - dayOfYear, "d");
    }, proto.hour = proto.hours = getSetHour, proto.minute = proto.minutes = getSetMinute, 
    proto.second = proto.seconds = getSetSecond, proto.millisecond = proto.milliseconds = getSetMillisecond, 
    proto.utcOffset = function(input, keepLocalTime, keepMinutes) {
        var localAdjust, offset = this._offset || 0;
        if (!this.isValid()) return null != input ? this : NaN;
        if (null != input) {
            if ("string" == typeof input) {
                if (null === (input = offsetFromString(matchShortOffset, input))) return this;
            } else Math.abs(input) < 16 && !keepMinutes && (input *= 60);
            return !this._isUTC && keepLocalTime && (localAdjust = getDateOffset(this)), this._offset = input, 
            this._isUTC = !0, null != localAdjust && this.add(localAdjust, "m"), offset !== input && (!keepLocalTime || this._changeInProgress ? addSubtract(this, createDuration(input - offset, "m"), 1, !1) : this._changeInProgress || (this._changeInProgress = !0, 
            hooks.updateOffset(this, !0), this._changeInProgress = null)), this;
        }
        return this._isUTC ? offset : getDateOffset(this);
    }, proto.utc = function(keepLocalTime) {
        return this.utcOffset(0, keepLocalTime);
    }, proto.local = function(keepLocalTime) {
        return this._isUTC && (this.utcOffset(0, keepLocalTime), this._isUTC = !1, keepLocalTime && this.subtract(getDateOffset(this), "m")), 
        this;
    }, proto.parseZone = function() {
        if (null != this._tzm) this.utcOffset(this._tzm, !1, !0); else if ("string" == typeof this._i) {
            var tZone = offsetFromString(matchOffset, this._i);
            null != tZone ? this.utcOffset(tZone) : this.utcOffset(0, !0);
        }
        return this;
    }, proto.hasAlignedHourOffset = function(input) {
        return !!this.isValid() && (input = input ? createLocal(input).utcOffset() : 0, 
        (this.utcOffset() - input) % 60 == 0);
    }, proto.isDST = function() {
        return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset();
    }, proto.isLocal = function() {
        return !!this.isValid() && !this._isUTC;
    }, proto.isUtcOffset = function() {
        return !!this.isValid() && this._isUTC;
    }, proto.isUtc = isUtc, proto.isUTC = isUtc, proto.zoneAbbr = function() {
        return this._isUTC ? "UTC" : "";
    }, proto.zoneName = function() {
        return this._isUTC ? "Coordinated Universal Time" : "";
    }, proto.dates = deprecate("dates accessor is deprecated. Use date instead.", getSetDayOfMonth), 
    proto.months = deprecate("months accessor is deprecated. Use month instead", getSetMonth), 
    proto.years = deprecate("years accessor is deprecated. Use year instead", getSetYear), 
    proto.zone = deprecate("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/", function(input, keepLocalTime) {
        return null != input ? ("string" != typeof input && (input = -input), this.utcOffset(input, keepLocalTime), 
        this) : -this.utcOffset();
    }), proto.isDSTShifted = deprecate("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information", function() {
        if (!isUndefined(this._isDSTShifted)) return this._isDSTShifted;
        var c = {};
        if (copyConfig(c, this), (c = prepareConfig(c))._a) {
            var other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
            this._isDSTShifted = this.isValid() && 0 < compareArrays(c._a, other.toArray());
        } else this._isDSTShifted = !1;
        return this._isDSTShifted;
    });
    var proto$1 = Locale.prototype;
    function get$1(format, index, field, setter) {
        var locale = getLocale(), utc = createUTC().set(setter, index);
        return locale[field](utc, format);
    }
    function listMonthsImpl(format, index, field) {
        if (isNumber(format) && (index = format, format = void 0), format = format || "", 
        null != index) return get$1(format, index, field, "month");
        var i, out = [];
        for (i = 0; i < 12; i++) out[i] = get$1(format, i, field, "month");
        return out;
    }
    function listWeekdaysImpl(localeSorted, format, index, field) {
        "boolean" == typeof localeSorted ? isNumber(format) && (index = format, format = void 0) : (format = localeSorted, 
        localeSorted = !1, isNumber(index = format) && (index = format, format = void 0)), 
        format = format || "";
        var i, locale = getLocale(), shift = localeSorted ? locale._week.dow : 0;
        if (null != index) return get$1(format, (index + shift) % 7, field, "day");
        var out = [];
        for (i = 0; i < 7; i++) out[i] = get$1(format, (i + shift) % 7, field, "day");
        return out;
    }
    proto$1.calendar = function(key, mom, now) {
        var output = this._calendar[key] || this._calendar.sameElse;
        return isFunction(output) ? output.call(mom, now) : output;
    }, proto$1.longDateFormat = function(key) {
        var format = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()];
        return format || !formatUpper ? format : (this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function(val) {
            return val.slice(1);
        }), this._longDateFormat[key]);
    }, proto$1.invalidDate = function() {
        return this._invalidDate;
    }, proto$1.ordinal = function(number) {
        return this._ordinal.replace("%d", number);
    }, proto$1.preparse = preParsePostFormat, proto$1.postformat = preParsePostFormat, 
    proto$1.relativeTime = function(number, withoutSuffix, string, isFuture) {
        var output = this._relativeTime[string];
        return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number);
    }, proto$1.pastFuture = function(diff, output) {
        var format = this._relativeTime[0 < diff ? "future" : "past"];
        return isFunction(format) ? format(output) : format.replace(/%s/i, output);
    }, proto$1.set = function(config) {
        var prop, i;
        for (i in config) isFunction(prop = config[i]) ? this[i] = prop : this["_" + i] = prop;
        this._config = config, this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source);
    }, proto$1.months = function(m, format) {
        return m ? isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? "format" : "standalone"][m.month()] : isArray(this._months) ? this._months : this._months.standalone;
    }, proto$1.monthsShort = function(m, format) {
        return m ? isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format) ? "format" : "standalone"][m.month()] : isArray(this._monthsShort) ? this._monthsShort : this._monthsShort.standalone;
    }, proto$1.monthsParse = function(monthName, format, strict) {
        var i, mom, regex;
        if (this._monthsParseExact) return function(monthName, format, strict) {
            var i, ii, mom, llc = monthName.toLocaleLowerCase();
            if (!this._monthsParse) for (this._monthsParse = [], this._longMonthsParse = [], 
            this._shortMonthsParse = [], i = 0; i < 12; ++i) mom = createUTC([ 2e3, i ]), this._shortMonthsParse[i] = this.monthsShort(mom, "").toLocaleLowerCase(), 
            this._longMonthsParse[i] = this.months(mom, "").toLocaleLowerCase();
            return strict ? "MMM" === format ? -1 !== (ii = indexOf$1.call(this._shortMonthsParse, llc)) ? ii : null : -1 !== (ii = indexOf$1.call(this._longMonthsParse, llc)) ? ii : null : "MMM" === format ? -1 !== (ii = indexOf$1.call(this._shortMonthsParse, llc)) ? ii : -1 !== (ii = indexOf$1.call(this._longMonthsParse, llc)) ? ii : null : -1 !== (ii = indexOf$1.call(this._longMonthsParse, llc)) ? ii : -1 !== (ii = indexOf$1.call(this._shortMonthsParse, llc)) ? ii : null;
        }.call(this, monthName, format, strict);
        for (this._monthsParse || (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = []), 
        i = 0; i < 12; i++) {
            if (mom = createUTC([ 2e3, i ]), strict && !this._longMonthsParse[i] && (this._longMonthsParse[i] = new RegExp("^" + this.months(mom, "").replace(".", "") + "$", "i"), 
            this._shortMonthsParse[i] = new RegExp("^" + this.monthsShort(mom, "").replace(".", "") + "$", "i")), 
            strict || this._monthsParse[i] || (regex = "^" + this.months(mom, "") + "|^" + this.monthsShort(mom, ""), 
            this._monthsParse[i] = new RegExp(regex.replace(".", ""), "i")), strict && "MMMM" === format && this._longMonthsParse[i].test(monthName)) return i;
            if (strict && "MMM" === format && this._shortMonthsParse[i].test(monthName)) return i;
            if (!strict && this._monthsParse[i].test(monthName)) return i;
        }
    }, proto$1.monthsRegex = function(isStrict) {
        return this._monthsParseExact ? (hasOwnProp(this, "_monthsRegex") || computeMonthsParse.call(this), 
        isStrict ? this._monthsStrictRegex : this._monthsRegex) : (hasOwnProp(this, "_monthsRegex") || (this._monthsRegex = defaultMonthsRegex), 
        this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex);
    }, proto$1.monthsShortRegex = function(isStrict) {
        return this._monthsParseExact ? (hasOwnProp(this, "_monthsRegex") || computeMonthsParse.call(this), 
        isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex) : (hasOwnProp(this, "_monthsShortRegex") || (this._monthsShortRegex = defaultMonthsShortRegex), 
        this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex);
    }, proto$1.week = function(mom) {
        return weekOfYear(mom, this._week.dow, this._week.doy).week;
    }, proto$1.firstDayOfYear = function() {
        return this._week.doy;
    }, proto$1.firstDayOfWeek = function() {
        return this._week.dow;
    }, proto$1.weekdays = function(m, format) {
        return m ? isArray(this._weekdays) ? this._weekdays[m.day()] : this._weekdays[this._weekdays.isFormat.test(format) ? "format" : "standalone"][m.day()] : isArray(this._weekdays) ? this._weekdays : this._weekdays.standalone;
    }, proto$1.weekdaysMin = function(m) {
        return m ? this._weekdaysMin[m.day()] : this._weekdaysMin;
    }, proto$1.weekdaysShort = function(m) {
        return m ? this._weekdaysShort[m.day()] : this._weekdaysShort;
    }, proto$1.weekdaysParse = function(weekdayName, format, strict) {
        var i, mom, regex;
        if (this._weekdaysParseExact) return function(weekdayName, format, strict) {
            var i, ii, mom, llc = weekdayName.toLocaleLowerCase();
            if (!this._weekdaysParse) for (this._weekdaysParse = [], this._shortWeekdaysParse = [], 
            this._minWeekdaysParse = [], i = 0; i < 7; ++i) mom = createUTC([ 2e3, 1 ]).day(i), 
            this._minWeekdaysParse[i] = this.weekdaysMin(mom, "").toLocaleLowerCase(), this._shortWeekdaysParse[i] = this.weekdaysShort(mom, "").toLocaleLowerCase(), 
            this._weekdaysParse[i] = this.weekdays(mom, "").toLocaleLowerCase();
            return strict ? "dddd" === format ? -1 !== (ii = indexOf$1.call(this._weekdaysParse, llc)) ? ii : null : "ddd" === format ? -1 !== (ii = indexOf$1.call(this._shortWeekdaysParse, llc)) ? ii : null : -1 !== (ii = indexOf$1.call(this._minWeekdaysParse, llc)) ? ii : null : "dddd" === format ? -1 !== (ii = indexOf$1.call(this._weekdaysParse, llc)) ? ii : -1 !== (ii = indexOf$1.call(this._shortWeekdaysParse, llc)) ? ii : -1 !== (ii = indexOf$1.call(this._minWeekdaysParse, llc)) ? ii : null : "ddd" === format ? -1 !== (ii = indexOf$1.call(this._shortWeekdaysParse, llc)) ? ii : -1 !== (ii = indexOf$1.call(this._weekdaysParse, llc)) ? ii : -1 !== (ii = indexOf$1.call(this._minWeekdaysParse, llc)) ? ii : null : -1 !== (ii = indexOf$1.call(this._minWeekdaysParse, llc)) ? ii : -1 !== (ii = indexOf$1.call(this._weekdaysParse, llc)) ? ii : -1 !== (ii = indexOf$1.call(this._shortWeekdaysParse, llc)) ? ii : null;
        }.call(this, weekdayName, format, strict);
        for (this._weekdaysParse || (this._weekdaysParse = [], this._minWeekdaysParse = [], 
        this._shortWeekdaysParse = [], this._fullWeekdaysParse = []), i = 0; i < 7; i++) {
            if (mom = createUTC([ 2e3, 1 ]).day(i), strict && !this._fullWeekdaysParse[i] && (this._fullWeekdaysParse[i] = new RegExp("^" + this.weekdays(mom, "").replace(".", ".?") + "$", "i"), 
            this._shortWeekdaysParse[i] = new RegExp("^" + this.weekdaysShort(mom, "").replace(".", ".?") + "$", "i"), 
            this._minWeekdaysParse[i] = new RegExp("^" + this.weekdaysMin(mom, "").replace(".", ".?") + "$", "i")), 
            this._weekdaysParse[i] || (regex = "^" + this.weekdays(mom, "") + "|^" + this.weekdaysShort(mom, "") + "|^" + this.weekdaysMin(mom, ""), 
            this._weekdaysParse[i] = new RegExp(regex.replace(".", ""), "i")), strict && "dddd" === format && this._fullWeekdaysParse[i].test(weekdayName)) return i;
            if (strict && "ddd" === format && this._shortWeekdaysParse[i].test(weekdayName)) return i;
            if (strict && "dd" === format && this._minWeekdaysParse[i].test(weekdayName)) return i;
            if (!strict && this._weekdaysParse[i].test(weekdayName)) return i;
        }
    }, proto$1.weekdaysRegex = function(isStrict) {
        return this._weekdaysParseExact ? (hasOwnProp(this, "_weekdaysRegex") || computeWeekdaysParse.call(this), 
        isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex) : (hasOwnProp(this, "_weekdaysRegex") || (this._weekdaysRegex = defaultWeekdaysRegex), 
        this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex);
    }, proto$1.weekdaysShortRegex = function(isStrict) {
        return this._weekdaysParseExact ? (hasOwnProp(this, "_weekdaysRegex") || computeWeekdaysParse.call(this), 
        isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex) : (hasOwnProp(this, "_weekdaysShortRegex") || (this._weekdaysShortRegex = defaultWeekdaysShortRegex), 
        this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex);
    }, proto$1.weekdaysMinRegex = function(isStrict) {
        return this._weekdaysParseExact ? (hasOwnProp(this, "_weekdaysRegex") || computeWeekdaysParse.call(this), 
        isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex) : (hasOwnProp(this, "_weekdaysMinRegex") || (this._weekdaysMinRegex = defaultWeekdaysMinRegex), 
        this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex);
    }, proto$1.isPM = function(input) {
        return "p" === (input + "").toLowerCase().charAt(0);
    }, proto$1.meridiem = function(hours, minutes, isLower) {
        return 11 < hours ? isLower ? "pm" : "PM" : isLower ? "am" : "AM";
    }, getSetGlobalLocale("en", {
        dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
        ordinal: function(number) {
            var b = number % 10;
            return number + (1 === toInt(number % 100 / 10) ? "th" : 1 === b ? "st" : 2 === b ? "nd" : 3 === b ? "rd" : "th");
        }
    }), hooks.lang = deprecate("moment.lang is deprecated. Use moment.locale instead.", getSetGlobalLocale), 
    hooks.langData = deprecate("moment.langData is deprecated. Use moment.localeData instead.", getLocale);
    var mathAbs = Math.abs;
    function addSubtract$1(duration, input, value, direction) {
        var other = createDuration(input, value);
        return duration._milliseconds += direction * other._milliseconds, duration._days += direction * other._days, 
        duration._months += direction * other._months, duration._bubble();
    }
    function absCeil(number) {
        return number < 0 ? Math.floor(number) : Math.ceil(number);
    }
    function daysToMonths(days) {
        return 4800 * days / 146097;
    }
    function monthsToDays(months) {
        return 146097 * months / 4800;
    }
    function makeAs(alias) {
        return function() {
            return this.as(alias);
        };
    }
    var asMilliseconds = makeAs("ms"), asSeconds = makeAs("s"), asMinutes = makeAs("m"), asHours = makeAs("h"), asDays = makeAs("d"), asWeeks = makeAs("w"), asMonths = makeAs("M"), asYears = makeAs("y");
    function makeGetter(name) {
        return function() {
            return this.isValid() ? this._data[name] : NaN;
        };
    }
    var milliseconds = makeGetter("milliseconds"), seconds = makeGetter("seconds"), minutes = makeGetter("minutes"), hours = makeGetter("hours"), days = makeGetter("days"), months = makeGetter("months"), years = makeGetter("years");
    var round = Math.round, thresholds = {
        ss: 44,
        s: 45,
        m: 45,
        h: 22,
        d: 26,
        M: 11
    };
    var abs$1 = Math.abs;
    function toISOString$1() {
        if (!this.isValid()) return this.localeData().invalidDate();
        var minutes, hours, seconds = abs$1(this._milliseconds) / 1e3, days = abs$1(this._days), months = abs$1(this._months);
        hours = absFloor((minutes = absFloor(seconds / 60)) / 60), seconds %= 60, minutes %= 60;
        var Y = absFloor(months / 12), M = months %= 12, D = days, h = hours, m = minutes, s = seconds, total = this.asSeconds();
        return total ? (total < 0 ? "-" : "") + "P" + (Y ? Y + "Y" : "") + (M ? M + "M" : "") + (D ? D + "D" : "") + (h || m || s ? "T" : "") + (h ? h + "H" : "") + (m ? m + "M" : "") + (s ? s + "S" : "") : "P0D";
    }
    var proto$2 = Duration.prototype;
    proto$2.isValid = function() {
        return this._isValid;
    }, proto$2.abs = function() {
        var data = this._data;
        return this._milliseconds = mathAbs(this._milliseconds), this._days = mathAbs(this._days), 
        this._months = mathAbs(this._months), data.milliseconds = mathAbs(data.milliseconds), 
        data.seconds = mathAbs(data.seconds), data.minutes = mathAbs(data.minutes), data.hours = mathAbs(data.hours), 
        data.months = mathAbs(data.months), data.years = mathAbs(data.years), this;
    }, proto$2.add = function(input, value) {
        return addSubtract$1(this, input, value, 1);
    }, proto$2.subtract = function(input, value) {
        return addSubtract$1(this, input, value, -1);
    }, proto$2.as = function(units) {
        if (!this.isValid()) return NaN;
        var days, months, milliseconds = this._milliseconds;
        if ("month" === (units = normalizeUnits(units)) || "year" === units) return days = this._days + milliseconds / 864e5, 
        months = this._months + daysToMonths(days), "month" === units ? months : months / 12;
        switch (days = this._days + Math.round(monthsToDays(this._months)), units) {
          case "week":
            return days / 7 + milliseconds / 6048e5;

          case "day":
            return days + milliseconds / 864e5;

          case "hour":
            return 24 * days + milliseconds / 36e5;

          case "minute":
            return 1440 * days + milliseconds / 6e4;

          case "second":
            return 86400 * days + milliseconds / 1e3;

          case "millisecond":
            return Math.floor(864e5 * days) + milliseconds;

          default:
            throw new Error("Unknown unit " + units);
        }
    }, proto$2.asMilliseconds = asMilliseconds, proto$2.asSeconds = asSeconds, proto$2.asMinutes = asMinutes, 
    proto$2.asHours = asHours, proto$2.asDays = asDays, proto$2.asWeeks = asWeeks, proto$2.asMonths = asMonths, 
    proto$2.asYears = asYears, proto$2.valueOf = function() {
        return this.isValid() ? this._milliseconds + 864e5 * this._days + this._months % 12 * 2592e6 + 31536e6 * toInt(this._months / 12) : NaN;
    }, proto$2._bubble = function() {
        var seconds, minutes, hours, years, monthsFromDays, milliseconds = this._milliseconds, days = this._days, months = this._months, data = this._data;
        return 0 <= milliseconds && 0 <= days && 0 <= months || milliseconds <= 0 && days <= 0 && months <= 0 || (milliseconds += 864e5 * absCeil(monthsToDays(months) + days), 
        months = days = 0), data.milliseconds = milliseconds % 1e3, seconds = absFloor(milliseconds / 1e3), 
        data.seconds = seconds % 60, minutes = absFloor(seconds / 60), data.minutes = minutes % 60, 
        hours = absFloor(minutes / 60), data.hours = hours % 24, months += monthsFromDays = absFloor(daysToMonths(days += absFloor(hours / 24))), 
        days -= absCeil(monthsToDays(monthsFromDays)), years = absFloor(months / 12), months %= 12, 
        data.days = days, data.months = months, data.years = years, this;
    }, proto$2.get = function(units) {
        return units = normalizeUnits(units), this.isValid() ? this[units + "s"]() : NaN;
    }, proto$2.milliseconds = milliseconds, proto$2.seconds = seconds, proto$2.minutes = minutes, 
    proto$2.hours = hours, proto$2.days = days, proto$2.weeks = function() {
        return absFloor(this.days() / 7);
    }, proto$2.months = months, proto$2.years = years, proto$2.humanize = function(withSuffix) {
        if (!this.isValid()) return this.localeData().invalidDate();
        var locale = this.localeData(), output = function(posNegDuration, withoutSuffix, locale) {
            var duration = createDuration(posNegDuration).abs(), seconds = round(duration.as("s")), minutes = round(duration.as("m")), hours = round(duration.as("h")), days = round(duration.as("d")), months = round(duration.as("M")), years = round(duration.as("y")), a = seconds <= thresholds.ss && [ "s", seconds ] || seconds < thresholds.s && [ "ss", seconds ] || minutes <= 1 && [ "m" ] || minutes < thresholds.m && [ "mm", minutes ] || hours <= 1 && [ "h" ] || hours < thresholds.h && [ "hh", hours ] || days <= 1 && [ "d" ] || days < thresholds.d && [ "dd", days ] || months <= 1 && [ "M" ] || months < thresholds.M && [ "MM", months ] || years <= 1 && [ "y" ] || [ "yy", years ];
            return a[2] = withoutSuffix, a[3] = 0 < +posNegDuration, a[4] = locale, function(string, number, withoutSuffix, isFuture, locale) {
                return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
            }.apply(null, a);
        }(this, !withSuffix, locale);
        return withSuffix && (output = locale.pastFuture(+this, output)), locale.postformat(output);
    }, proto$2.toISOString = toISOString$1, proto$2.toString = toISOString$1, proto$2.toJSON = toISOString$1, 
    proto$2.locale = locale, proto$2.localeData = localeData, proto$2.toIsoString = deprecate("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)", toISOString$1), 
    proto$2.lang = lang, addFormatToken("X", 0, 0, "unix"), addFormatToken("x", 0, 0, "valueOf"), 
    addRegexToken("x", matchSigned), addRegexToken("X", /[+-]?\d+(\.\d{1,3})?/), addParseToken("X", function(input, array, config) {
        config._d = new Date(1e3 * parseFloat(input, 10));
    }), addParseToken("x", function(input, array, config) {
        config._d = new Date(toInt(input));
    }), hooks.version = "2.18.1", hookCallback = createLocal, hooks.fn = proto, hooks.min = function() {
        return pickBy("isBefore", [].slice.call(arguments, 0));
    }, hooks.max = function() {
        return pickBy("isAfter", [].slice.call(arguments, 0));
    }, hooks.now = function() {
        return Date.now ? Date.now() : +new Date();
    }, hooks.utc = createUTC, hooks.unix = function(input) {
        return createLocal(1e3 * input);
    }, hooks.months = function(format, index) {
        return listMonthsImpl(format, index, "months");
    }, hooks.isDate = isDate, hooks.locale = getSetGlobalLocale, hooks.invalid = createInvalid, 
    hooks.duration = createDuration, hooks.isMoment = isMoment, hooks.weekdays = function(localeSorted, format, index) {
        return listWeekdaysImpl(localeSorted, format, index, "weekdays");
    }, hooks.parseZone = function() {
        return createLocal.apply(null, arguments).parseZone();
    }, hooks.localeData = getLocale, hooks.isDuration = isDuration, hooks.monthsShort = function(format, index) {
        return listMonthsImpl(format, index, "monthsShort");
    }, hooks.weekdaysMin = function(localeSorted, format, index) {
        return listWeekdaysImpl(localeSorted, format, index, "weekdaysMin");
    }, hooks.defineLocale = defineLocale, hooks.updateLocale = function(name, config) {
        if (null != config) {
            var locale, parentConfig = baseConfig;
            null != locales[name] && (parentConfig = locales[name]._config), (locale = new Locale(config = mergeConfigs(parentConfig, config))).parentLocale = locales[name], 
            locales[name] = locale, getSetGlobalLocale(name);
        } else null != locales[name] && (null != locales[name].parentLocale ? locales[name] = locales[name].parentLocale : null != locales[name] && delete locales[name]);
        return locales[name];
    }, hooks.locales = function() {
        return keys$1(locales);
    }, hooks.weekdaysShort = function(localeSorted, format, index) {
        return listWeekdaysImpl(localeSorted, format, index, "weekdaysShort");
    }, hooks.normalizeUnits = normalizeUnits, hooks.relativeTimeRounding = function(roundingFunction) {
        return void 0 === roundingFunction ? round : "function" == typeof roundingFunction && (round = roundingFunction, 
        !0);
    }, hooks.relativeTimeThreshold = function(threshold, limit) {
        return void 0 !== thresholds[threshold] && (void 0 === limit ? thresholds[threshold] : (thresholds[threshold] = limit, 
        "s" === threshold && (thresholds.ss = limit - 1), !0));
    }, hooks.calendarFormat = function(myMoment, now) {
        var diff = myMoment.diff(now, "days", !0);
        return diff < -6 ? "sameElse" : diff < -1 ? "lastWeek" : diff < 0 ? "lastDay" : diff < 1 ? "sameDay" : diff < 2 ? "nextDay" : diff < 7 ? "nextWeek" : "sameElse";
    }, hooks.prototype = proto, hooks.defineLocale("af", {
        months: "Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember".split("_"),
        monthsShort: "Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des".split("_"),
        weekdays: "Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag".split("_"),
        weekdaysShort: "Son_Maa_Din_Woe_Don_Vry_Sat".split("_"),
        weekdaysMin: "So_Ma_Di_Wo_Do_Vr_Sa".split("_"),
        meridiemParse: /vm|nm/i,
        isPM: function(input) {
            return /^nm$/i.test(input);
        },
        meridiem: function(hours, minutes, isLower) {
            return hours < 12 ? isLower ? "vm" : "VM" : isLower ? "nm" : "NM";
        },
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Vandag om] LT",
            nextDay: "[Môre om] LT",
            nextWeek: "dddd [om] LT",
            lastDay: "[Gister om] LT",
            lastWeek: "[Laas] dddd [om] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "oor %s",
            past: "%s gelede",
            s: "'n paar sekondes",
            m: "'n minuut",
            mm: "%d minute",
            h: "'n uur",
            hh: "%d ure",
            d: "'n dag",
            dd: "%d dae",
            M: "'n maand",
            MM: "%d maande",
            y: "'n jaar",
            yy: "%d jaar"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
        ordinal: function(number) {
            return number + (1 === number || 8 === number || 20 <= number ? "ste" : "de");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("ar-dz", {
        months: "جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),
        monthsShort: "جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),
        weekdays: "الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),
        weekdaysShort: "احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),
        weekdaysMin: "أح_إث_ثلا_أر_خم_جم_سب".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[اليوم على الساعة] LT",
            nextDay: "[غدا على الساعة] LT",
            nextWeek: "dddd [على الساعة] LT",
            lastDay: "[أمس على الساعة] LT",
            lastWeek: "dddd [على الساعة] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "في %s",
            past: "منذ %s",
            s: "ثوان",
            m: "دقيقة",
            mm: "%d دقائق",
            h: "ساعة",
            hh: "%d ساعات",
            d: "يوم",
            dd: "%d أيام",
            M: "شهر",
            MM: "%d أشهر",
            y: "سنة",
            yy: "%d سنوات"
        },
        week: {
            dow: 0,
            doy: 4
        }
    }), hooks.defineLocale("ar-kw", {
        months: "يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),
        monthsShort: "يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),
        weekdays: "الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),
        weekdaysShort: "احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),
        weekdaysMin: "ح_ن_ث_ر_خ_ج_س".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[اليوم على الساعة] LT",
            nextDay: "[غدا على الساعة] LT",
            nextWeek: "dddd [على الساعة] LT",
            lastDay: "[أمس على الساعة] LT",
            lastWeek: "dddd [على الساعة] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "في %s",
            past: "منذ %s",
            s: "ثوان",
            m: "دقيقة",
            mm: "%d دقائق",
            h: "ساعة",
            hh: "%d ساعات",
            d: "يوم",
            dd: "%d أيام",
            M: "شهر",
            MM: "%d أشهر",
            y: "سنة",
            yy: "%d سنوات"
        },
        week: {
            dow: 0,
            doy: 12
        }
    });
    var symbolMap = {
        1: "1",
        2: "2",
        3: "3",
        4: "4",
        5: "5",
        6: "6",
        7: "7",
        8: "8",
        9: "9",
        0: "0"
    }, pluralForm = function(n) {
        return 0 === n ? 0 : 1 === n ? 1 : 2 === n ? 2 : 3 <= n % 100 && n % 100 <= 10 ? 3 : 11 <= n % 100 ? 4 : 5;
    }, plurals = {
        s: [ "أقل من ثانية", "ثانية واحدة", [ "ثانيتان", "ثانيتين" ], "%d ثوان", "%d ثانية", "%d ثانية" ],
        m: [ "أقل من دقيقة", "دقيقة واحدة", [ "دقيقتان", "دقيقتين" ], "%d دقائق", "%d دقيقة", "%d دقيقة" ],
        h: [ "أقل من ساعة", "ساعة واحدة", [ "ساعتان", "ساعتين" ], "%d ساعات", "%d ساعة", "%d ساعة" ],
        d: [ "أقل من يوم", "يوم واحد", [ "يومان", "يومين" ], "%d أيام", "%d يومًا", "%d يوم" ],
        M: [ "أقل من شهر", "شهر واحد", [ "شهران", "شهرين" ], "%d أشهر", "%d شهرا", "%d شهر" ],
        y: [ "أقل من عام", "عام واحد", [ "عامان", "عامين" ], "%d أعوام", "%d عامًا", "%d عام" ]
    }, pluralize = function(u) {
        return function(number, withoutSuffix, string, isFuture) {
            var f = pluralForm(number), str = plurals[u][pluralForm(number)];
            return 2 === f && (str = str[withoutSuffix ? 0 : 1]), str.replace(/%d/i, number);
        };
    }, months$1 = [ "يناير", "فبراير", "مارس", "أبريل", "مايو", "يونيو", "يوليو", "أغسطس", "سبتمبر", "أكتوبر", "نوفمبر", "ديسمبر" ];
    hooks.defineLocale("ar-ly", {
        months: months$1,
        monthsShort: months$1,
        weekdays: "الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),
        weekdaysShort: "أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),
        weekdaysMin: "ح_ن_ث_ر_خ_ج_س".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "D/‏M/‏YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        meridiemParse: /ص|م/,
        isPM: function(input) {
            return "م" === input;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 12 ? "ص" : "م";
        },
        calendar: {
            sameDay: "[اليوم عند الساعة] LT",
            nextDay: "[غدًا عند الساعة] LT",
            nextWeek: "dddd [عند الساعة] LT",
            lastDay: "[أمس عند الساعة] LT",
            lastWeek: "dddd [عند الساعة] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "بعد %s",
            past: "منذ %s",
            s: pluralize("s"),
            m: pluralize("m"),
            mm: pluralize("m"),
            h: pluralize("h"),
            hh: pluralize("h"),
            d: pluralize("d"),
            dd: pluralize("d"),
            M: pluralize("M"),
            MM: pluralize("M"),
            y: pluralize("y"),
            yy: pluralize("y")
        },
        preparse: function(string) {
            return string.replace(/\u200f/g, "").replace(/،/g, ",");
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap[match];
            }).replace(/,/g, "،");
        },
        week: {
            dow: 6,
            doy: 12
        }
    }), hooks.defineLocale("ar-ma", {
        months: "يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),
        monthsShort: "يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر".split("_"),
        weekdays: "الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),
        weekdaysShort: "احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت".split("_"),
        weekdaysMin: "ح_ن_ث_ر_خ_ج_س".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[اليوم على الساعة] LT",
            nextDay: "[غدا على الساعة] LT",
            nextWeek: "dddd [على الساعة] LT",
            lastDay: "[أمس على الساعة] LT",
            lastWeek: "dddd [على الساعة] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "في %s",
            past: "منذ %s",
            s: "ثوان",
            m: "دقيقة",
            mm: "%d دقائق",
            h: "ساعة",
            hh: "%d ساعات",
            d: "يوم",
            dd: "%d أيام",
            M: "شهر",
            MM: "%d أشهر",
            y: "سنة",
            yy: "%d سنوات"
        },
        week: {
            dow: 6,
            doy: 12
        }
    });
    var symbolMap$1 = {
        1: "١",
        2: "٢",
        3: "٣",
        4: "٤",
        5: "٥",
        6: "٦",
        7: "٧",
        8: "٨",
        9: "٩",
        0: "٠"
    }, numberMap = {
        "١": "1",
        "٢": "2",
        "٣": "3",
        "٤": "4",
        "٥": "5",
        "٦": "6",
        "٧": "7",
        "٨": "8",
        "٩": "9",
        "٠": "0"
    };
    hooks.defineLocale("ar-sa", {
        months: "يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),
        monthsShort: "يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),
        weekdays: "الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),
        weekdaysShort: "أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),
        weekdaysMin: "ح_ن_ث_ر_خ_ج_س".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        meridiemParse: /ص|م/,
        isPM: function(input) {
            return "م" === input;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 12 ? "ص" : "م";
        },
        calendar: {
            sameDay: "[اليوم على الساعة] LT",
            nextDay: "[غدا على الساعة] LT",
            nextWeek: "dddd [على الساعة] LT",
            lastDay: "[أمس على الساعة] LT",
            lastWeek: "dddd [على الساعة] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "في %s",
            past: "منذ %s",
            s: "ثوان",
            m: "دقيقة",
            mm: "%d دقائق",
            h: "ساعة",
            hh: "%d ساعات",
            d: "يوم",
            dd: "%d أيام",
            M: "شهر",
            MM: "%d أشهر",
            y: "سنة",
            yy: "%d سنوات"
        },
        preparse: function(string) {
            return string.replace(/[١٢٣٤٥٦٧٨٩٠]/g, function(match) {
                return numberMap[match];
            }).replace(/،/g, ",");
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap$1[match];
            }).replace(/,/g, "،");
        },
        week: {
            dow: 0,
            doy: 6
        }
    }), hooks.defineLocale("ar-tn", {
        months: "جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),
        monthsShort: "جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر".split("_"),
        weekdays: "الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),
        weekdaysShort: "أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),
        weekdaysMin: "ح_ن_ث_ر_خ_ج_س".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[اليوم على الساعة] LT",
            nextDay: "[غدا على الساعة] LT",
            nextWeek: "dddd [على الساعة] LT",
            lastDay: "[أمس على الساعة] LT",
            lastWeek: "dddd [على الساعة] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "في %s",
            past: "منذ %s",
            s: "ثوان",
            m: "دقيقة",
            mm: "%d دقائق",
            h: "ساعة",
            hh: "%d ساعات",
            d: "يوم",
            dd: "%d أيام",
            M: "شهر",
            MM: "%d أشهر",
            y: "سنة",
            yy: "%d سنوات"
        },
        week: {
            dow: 1,
            doy: 4
        }
    });
    var symbolMap$2 = {
        1: "١",
        2: "٢",
        3: "٣",
        4: "٤",
        5: "٥",
        6: "٦",
        7: "٧",
        8: "٨",
        9: "٩",
        0: "٠"
    }, numberMap$1 = {
        "١": "1",
        "٢": "2",
        "٣": "3",
        "٤": "4",
        "٥": "5",
        "٦": "6",
        "٧": "7",
        "٨": "8",
        "٩": "9",
        "٠": "0"
    }, pluralForm$1 = function(n) {
        return 0 === n ? 0 : 1 === n ? 1 : 2 === n ? 2 : 3 <= n % 100 && n % 100 <= 10 ? 3 : 11 <= n % 100 ? 4 : 5;
    }, plurals$1 = {
        s: [ "أقل من ثانية", "ثانية واحدة", [ "ثانيتان", "ثانيتين" ], "%d ثوان", "%d ثانية", "%d ثانية" ],
        m: [ "أقل من دقيقة", "دقيقة واحدة", [ "دقيقتان", "دقيقتين" ], "%d دقائق", "%d دقيقة", "%d دقيقة" ],
        h: [ "أقل من ساعة", "ساعة واحدة", [ "ساعتان", "ساعتين" ], "%d ساعات", "%d ساعة", "%d ساعة" ],
        d: [ "أقل من يوم", "يوم واحد", [ "يومان", "يومين" ], "%d أيام", "%d يومًا", "%d يوم" ],
        M: [ "أقل من شهر", "شهر واحد", [ "شهران", "شهرين" ], "%d أشهر", "%d شهرا", "%d شهر" ],
        y: [ "أقل من عام", "عام واحد", [ "عامان", "عامين" ], "%d أعوام", "%d عامًا", "%d عام" ]
    }, pluralize$1 = function(u) {
        return function(number, withoutSuffix, string, isFuture) {
            var f = pluralForm$1(number), str = plurals$1[u][pluralForm$1(number)];
            return 2 === f && (str = str[withoutSuffix ? 0 : 1]), str.replace(/%d/i, number);
        };
    }, months$2 = [ "كانون الثاني يناير", "شباط فبراير", "آذار مارس", "نيسان أبريل", "أيار مايو", "حزيران يونيو", "تموز يوليو", "آب أغسطس", "أيلول سبتمبر", "تشرين الأول أكتوبر", "تشرين الثاني نوفمبر", "كانون الأول ديسمبر" ];
    hooks.defineLocale("ar", {
        months: months$2,
        monthsShort: months$2,
        weekdays: "الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت".split("_"),
        weekdaysShort: "أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت".split("_"),
        weekdaysMin: "ح_ن_ث_ر_خ_ج_س".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "D/‏M/‏YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        meridiemParse: /ص|م/,
        isPM: function(input) {
            return "م" === input;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 12 ? "ص" : "م";
        },
        calendar: {
            sameDay: "[اليوم عند الساعة] LT",
            nextDay: "[غدًا عند الساعة] LT",
            nextWeek: "dddd [عند الساعة] LT",
            lastDay: "[أمس عند الساعة] LT",
            lastWeek: "dddd [عند الساعة] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "بعد %s",
            past: "منذ %s",
            s: pluralize$1("s"),
            m: pluralize$1("m"),
            mm: pluralize$1("m"),
            h: pluralize$1("h"),
            hh: pluralize$1("h"),
            d: pluralize$1("d"),
            dd: pluralize$1("d"),
            M: pluralize$1("M"),
            MM: pluralize$1("M"),
            y: pluralize$1("y"),
            yy: pluralize$1("y")
        },
        preparse: function(string) {
            return string.replace(/\u200f/g, "").replace(/[١٢٣٤٥٦٧٨٩٠]/g, function(match) {
                return numberMap$1[match];
            }).replace(/،/g, ",");
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap$2[match];
            }).replace(/,/g, "،");
        },
        week: {
            dow: 6,
            doy: 12
        }
    });
    var suffixes = {
        1: "-inci",
        5: "-inci",
        8: "-inci",
        70: "-inci",
        80: "-inci",
        2: "-nci",
        7: "-nci",
        20: "-nci",
        50: "-nci",
        3: "-üncü",
        4: "-üncü",
        100: "-üncü",
        6: "-ncı",
        9: "-uncu",
        10: "-uncu",
        30: "-uncu",
        60: "-ıncı",
        90: "-ıncı"
    };
    function relativeTimeWithPlural(number, withoutSuffix, key) {
        var num, forms;
        return "m" === key ? withoutSuffix ? "хвіліна" : "хвіліну" : "h" === key ? withoutSuffix ? "гадзіна" : "гадзіну" : number + " " + (num = +number, 
        forms = {
            mm: withoutSuffix ? "хвіліна_хвіліны_хвілін" : "хвіліну_хвіліны_хвілін",
            hh: withoutSuffix ? "гадзіна_гадзіны_гадзін" : "гадзіну_гадзіны_гадзін",
            dd: "дзень_дні_дзён",
            MM: "месяц_месяцы_месяцаў",
            yy: "год_гады_гадоў"
        }[key].split("_"), num % 10 == 1 && num % 100 != 11 ? forms[0] : 2 <= num % 10 && num % 10 <= 4 && (num % 100 < 10 || 20 <= num % 100) ? forms[1] : forms[2]);
    }
    hooks.defineLocale("az", {
        months: "yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr".split("_"),
        monthsShort: "yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek".split("_"),
        weekdays: "Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə".split("_"),
        weekdaysShort: "Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən".split("_"),
        weekdaysMin: "Bz_BE_ÇA_Çə_CA_Cü_Şə".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[bugün saat] LT",
            nextDay: "[sabah saat] LT",
            nextWeek: "[gələn həftə] dddd [saat] LT",
            lastDay: "[dünən] LT",
            lastWeek: "[keçən həftə] dddd [saat] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s sonra",
            past: "%s əvvəl",
            s: "birneçə saniyyə",
            m: "bir dəqiqə",
            mm: "%d dəqiqə",
            h: "bir saat",
            hh: "%d saat",
            d: "bir gün",
            dd: "%d gün",
            M: "bir ay",
            MM: "%d ay",
            y: "bir il",
            yy: "%d il"
        },
        meridiemParse: /gecə|səhər|gündüz|axşam/,
        isPM: function(input) {
            return /^(gündüz|axşam)$/.test(input);
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "gecə" : hour < 12 ? "səhər" : hour < 17 ? "gündüz" : "axşam";
        },
        dayOfMonthOrdinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,
        ordinal: function(number) {
            if (0 === number) return number + "-ıncı";
            var a = number % 10;
            return number + (suffixes[a] || suffixes[number % 100 - a] || suffixes[100 <= number ? 100 : null]);
        },
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("be", {
        months: {
            format: "студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня".split("_"),
            standalone: "студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань".split("_")
        },
        monthsShort: "студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж".split("_"),
        weekdays: {
            format: "нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу".split("_"),
            standalone: "нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота".split("_"),
            isFormat: /\[ ?[Вв] ?(?:мінулую|наступную)? ?\] ?dddd/
        },
        weekdaysShort: "нд_пн_ат_ср_чц_пт_сб".split("_"),
        weekdaysMin: "нд_пн_ат_ср_чц_пт_сб".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY г.",
            LLL: "D MMMM YYYY г., HH:mm",
            LLLL: "dddd, D MMMM YYYY г., HH:mm"
        },
        calendar: {
            sameDay: "[Сёння ў] LT",
            nextDay: "[Заўтра ў] LT",
            lastDay: "[Учора ў] LT",
            nextWeek: function() {
                return "[У] dddd [ў] LT";
            },
            lastWeek: function() {
                switch (this.day()) {
                  case 0:
                  case 3:
                  case 5:
                  case 6:
                    return "[У мінулую] dddd [ў] LT";

                  case 1:
                  case 2:
                  case 4:
                    return "[У мінулы] dddd [ў] LT";
                }
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "праз %s",
            past: "%s таму",
            s: "некалькі секунд",
            m: relativeTimeWithPlural,
            mm: relativeTimeWithPlural,
            h: relativeTimeWithPlural,
            hh: relativeTimeWithPlural,
            d: "дзень",
            dd: relativeTimeWithPlural,
            M: "месяц",
            MM: relativeTimeWithPlural,
            y: "год",
            yy: relativeTimeWithPlural
        },
        meridiemParse: /ночы|раніцы|дня|вечара/,
        isPM: function(input) {
            return /^(дня|вечара)$/.test(input);
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "ночы" : hour < 12 ? "раніцы" : hour < 17 ? "дня" : "вечара";
        },
        dayOfMonthOrdinalParse: /\d{1,2}-(і|ы|га)/,
        ordinal: function(number, period) {
            switch (period) {
              case "M":
              case "d":
              case "DDD":
              case "w":
              case "W":
                return number % 10 != 2 && number % 10 != 3 || number % 100 == 12 || number % 100 == 13 ? number + "-ы" : number + "-і";

              case "D":
                return number + "-га";

              default:
                return number;
            }
        },
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("bg", {
        months: "януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември".split("_"),
        monthsShort: "янр_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек".split("_"),
        weekdays: "неделя_понеделник_вторник_сряда_четвъртък_петък_събота".split("_"),
        weekdaysShort: "нед_пон_вто_сря_чет_пет_съб".split("_"),
        weekdaysMin: "нд_пн_вт_ср_чт_пт_сб".split("_"),
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "D.MM.YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY H:mm",
            LLLL: "dddd, D MMMM YYYY H:mm"
        },
        calendar: {
            sameDay: "[Днес в] LT",
            nextDay: "[Утре в] LT",
            nextWeek: "dddd [в] LT",
            lastDay: "[Вчера в] LT",
            lastWeek: function() {
                switch (this.day()) {
                  case 0:
                  case 3:
                  case 6:
                    return "[В изминалата] dddd [в] LT";

                  case 1:
                  case 2:
                  case 4:
                  case 5:
                    return "[В изминалия] dddd [в] LT";
                }
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "след %s",
            past: "преди %s",
            s: "няколко секунди",
            m: "минута",
            mm: "%d минути",
            h: "час",
            hh: "%d часа",
            d: "ден",
            dd: "%d дни",
            M: "месец",
            MM: "%d месеца",
            y: "година",
            yy: "%d години"
        },
        dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/,
        ordinal: function(number) {
            var lastDigit = number % 10, last2Digits = number % 100;
            return 0 === number ? number + "-ев" : 0 === last2Digits ? number + "-ен" : 10 < last2Digits && last2Digits < 20 ? number + "-ти" : 1 === lastDigit ? number + "-ви" : 2 === lastDigit ? number + "-ри" : 7 === lastDigit || 8 === lastDigit ? number + "-ми" : number + "-ти";
        },
        week: {
            dow: 1,
            doy: 7
        }
    });
    var symbolMap$3 = {
        1: "১",
        2: "২",
        3: "৩",
        4: "৪",
        5: "৫",
        6: "৬",
        7: "৭",
        8: "৮",
        9: "৯",
        0: "০"
    }, numberMap$2 = {
        "১": "1",
        "২": "2",
        "৩": "3",
        "৪": "4",
        "৫": "5",
        "৬": "6",
        "৭": "7",
        "৮": "8",
        "৯": "9",
        "০": "0"
    };
    hooks.defineLocale("bn", {
        months: "জানুয়ারী_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর".split("_"),
        monthsShort: "জানু_ফেব_মার্চ_এপ্র_মে_জুন_জুল_আগ_সেপ্ট_অক্টো_নভে_ডিসে".split("_"),
        weekdays: "রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার".split("_"),
        weekdaysShort: "রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি".split("_"),
        weekdaysMin: "রবি_সোম_মঙ্গ_বুধ_বৃহঃ_শুক্র_শনি".split("_"),
        longDateFormat: {
            LT: "A h:mm সময়",
            LTS: "A h:mm:ss সময়",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY, A h:mm সময়",
            LLLL: "dddd, D MMMM YYYY, A h:mm সময়"
        },
        calendar: {
            sameDay: "[আজ] LT",
            nextDay: "[আগামীকাল] LT",
            nextWeek: "dddd, LT",
            lastDay: "[গতকাল] LT",
            lastWeek: "[গত] dddd, LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s পরে",
            past: "%s আগে",
            s: "কয়েক সেকেন্ড",
            m: "এক মিনিট",
            mm: "%d মিনিট",
            h: "এক ঘন্টা",
            hh: "%d ঘন্টা",
            d: "এক দিন",
            dd: "%d দিন",
            M: "এক মাস",
            MM: "%d মাস",
            y: "এক বছর",
            yy: "%d বছর"
        },
        preparse: function(string) {
            return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function(match) {
                return numberMap$2[match];
            });
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap$3[match];
            });
        },
        meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "রাত" === meridiem && 4 <= hour || "দুপুর" === meridiem && hour < 5 || "বিকাল" === meridiem ? hour + 12 : hour;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "রাত" : hour < 10 ? "সকাল" : hour < 17 ? "দুপুর" : hour < 20 ? "বিকাল" : "রাত";
        },
        week: {
            dow: 0,
            doy: 6
        }
    });
    var symbolMap$4 = {
        1: "༡",
        2: "༢",
        3: "༣",
        4: "༤",
        5: "༥",
        6: "༦",
        7: "༧",
        8: "༨",
        9: "༩",
        0: "༠"
    }, numberMap$3 = {
        "༡": "1",
        "༢": "2",
        "༣": "3",
        "༤": "4",
        "༥": "5",
        "༦": "6",
        "༧": "7",
        "༨": "8",
        "༩": "9",
        "༠": "0"
    };
    function relativeTimeWithMutation(number, withoutSuffix, key) {
        return number + " " + function(text, number) {
            if (2 === number) return function(text) {
                var mutationTable = {
                    m: "v",
                    b: "v",
                    d: "z"
                };
                if (void 0 === mutationTable[text.charAt(0)]) return text;
                return mutationTable[text.charAt(0)] + text.substring(1);
            }(text);
            return text;
        }({
            mm: "munutenn",
            MM: "miz",
            dd: "devezh"
        }[key], number);
    }
    function translate(number, withoutSuffix, key) {
        var result = number + " ";
        switch (key) {
          case "m":
            return withoutSuffix ? "jedna minuta" : "jedne minute";

          case "mm":
            return result += 1 === number ? "minuta" : 2 === number || 3 === number || 4 === number ? "minute" : "minuta";

          case "h":
            return withoutSuffix ? "jedan sat" : "jednog sata";

          case "hh":
            return result += 1 === number ? "sat" : 2 === number || 3 === number || 4 === number ? "sata" : "sati";

          case "dd":
            return result += 1 === number ? "dan" : "dana";

          case "MM":
            return result += 1 === number ? "mjesec" : 2 === number || 3 === number || 4 === number ? "mjeseca" : "mjeseci";

          case "yy":
            return result += 1 === number ? "godina" : 2 === number || 3 === number || 4 === number ? "godine" : "godina";
        }
    }
    hooks.defineLocale("bo", {
        months: "ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),
        monthsShort: "ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ".split("_"),
        weekdays: "གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་".split("_"),
        weekdaysShort: "ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),
        weekdaysMin: "ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་".split("_"),
        longDateFormat: {
            LT: "A h:mm",
            LTS: "A h:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY, A h:mm",
            LLLL: "dddd, D MMMM YYYY, A h:mm"
        },
        calendar: {
            sameDay: "[དི་རིང] LT",
            nextDay: "[སང་ཉིན] LT",
            nextWeek: "[བདུན་ཕྲག་རྗེས་མ], LT",
            lastDay: "[ཁ་སང] LT",
            lastWeek: "[བདུན་ཕྲག་མཐའ་མ] dddd, LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s ལ་",
            past: "%s སྔན་ལ",
            s: "ལམ་སང",
            m: "སྐར་མ་གཅིག",
            mm: "%d སྐར་མ",
            h: "ཆུ་ཚོད་གཅིག",
            hh: "%d ཆུ་ཚོད",
            d: "ཉིན་གཅིག",
            dd: "%d ཉིན་",
            M: "ཟླ་བ་གཅིག",
            MM: "%d ཟླ་བ",
            y: "ལོ་གཅིག",
            yy: "%d ལོ"
        },
        preparse: function(string) {
            return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function(match) {
                return numberMap$3[match];
            });
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap$4[match];
            });
        },
        meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "མཚན་མོ" === meridiem && 4 <= hour || "ཉིན་གུང" === meridiem && hour < 5 || "དགོང་དག" === meridiem ? hour + 12 : hour;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "མཚན་མོ" : hour < 10 ? "ཞོགས་ཀས" : hour < 17 ? "ཉིན་གུང" : hour < 20 ? "དགོང་དག" : "མཚན་མོ";
        },
        week: {
            dow: 0,
            doy: 6
        }
    }), hooks.defineLocale("br", {
        months: "Genver_C'hwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu".split("_"),
        monthsShort: "Gen_C'hwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker".split("_"),
        weekdays: "Sul_Lun_Meurzh_Merc'her_Yaou_Gwener_Sadorn".split("_"),
        weekdaysShort: "Sul_Lun_Meu_Mer_Yao_Gwe_Sad".split("_"),
        weekdaysMin: "Su_Lu_Me_Mer_Ya_Gw_Sa".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "h[e]mm A",
            LTS: "h[e]mm:ss A",
            L: "DD/MM/YYYY",
            LL: "D [a viz] MMMM YYYY",
            LLL: "D [a viz] MMMM YYYY h[e]mm A",
            LLLL: "dddd, D [a viz] MMMM YYYY h[e]mm A"
        },
        calendar: {
            sameDay: "[Hiziv da] LT",
            nextDay: "[Warc'hoazh da] LT",
            nextWeek: "dddd [da] LT",
            lastDay: "[Dec'h da] LT",
            lastWeek: "dddd [paset da] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "a-benn %s",
            past: "%s 'zo",
            s: "un nebeud segondennoù",
            m: "ur vunutenn",
            mm: relativeTimeWithMutation,
            h: "un eur",
            hh: "%d eur",
            d: "un devezh",
            dd: relativeTimeWithMutation,
            M: "ur miz",
            MM: relativeTimeWithMutation,
            y: "ur bloaz",
            yy: function(number) {
                switch (function lastNumber(number) {
                    return 9 < number ? lastNumber(number % 10) : number;
                }(number)) {
                  case 1:
                  case 3:
                  case 4:
                  case 5:
                  case 9:
                    return number + " bloaz";

                  default:
                    return number + " vloaz";
                }
            }
        },
        dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/,
        ordinal: function(number) {
            return number + (1 === number ? "añ" : "vet");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("bs", {
        months: "januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar".split("_"),
        monthsShort: "jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.".split("_"),
        monthsParseExact: !0,
        weekdays: "nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),
        weekdaysShort: "ned._pon._uto._sri._čet._pet._sub.".split("_"),
        weekdaysMin: "ne_po_ut_sr_če_pe_su".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY H:mm",
            LLLL: "dddd, D. MMMM YYYY H:mm"
        },
        calendar: {
            sameDay: "[danas u] LT",
            nextDay: "[sutra u] LT",
            nextWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[u] [nedjelju] [u] LT";

                  case 3:
                    return "[u] [srijedu] [u] LT";

                  case 6:
                    return "[u] [subotu] [u] LT";

                  case 1:
                  case 2:
                  case 4:
                  case 5:
                    return "[u] dddd [u] LT";
                }
            },
            lastDay: "[jučer u] LT",
            lastWeek: function() {
                switch (this.day()) {
                  case 0:
                  case 3:
                    return "[prošlu] dddd [u] LT";

                  case 6:
                    return "[prošle] [subote] [u] LT";

                  case 1:
                  case 2:
                  case 4:
                  case 5:
                    return "[prošli] dddd [u] LT";
                }
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "za %s",
            past: "prije %s",
            s: "par sekundi",
            m: translate,
            mm: translate,
            h: translate,
            hh: translate,
            d: "dan",
            dd: translate,
            M: "mjesec",
            MM: translate,
            y: "godinu",
            yy: translate
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("ca", {
        months: {
            standalone: "gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre".split("_"),
            format: "de gener_de febrer_de març_d'abril_de maig_de juny_de juliol_d'agost_de setembre_d'octubre_de novembre_de desembre".split("_"),
            isFormat: /D[oD]?(\s)+MMMM/
        },
        monthsShort: "gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.".split("_"),
        monthsParseExact: !0,
        weekdays: "diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte".split("_"),
        weekdaysShort: "dg._dl._dt._dc._dj._dv._ds.".split("_"),
        weekdaysMin: "Dg_Dl_Dt_Dc_Dj_Dv_Ds".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD/MM/YYYY",
            LL: "[el] D MMMM [de] YYYY",
            ll: "D MMM YYYY",
            LLL: "[el] D MMMM [de] YYYY [a les] H:mm",
            lll: "D MMM YYYY, H:mm",
            LLLL: "[el] dddd D MMMM [de] YYYY [a les] H:mm",
            llll: "ddd D MMM YYYY, H:mm"
        },
        calendar: {
            sameDay: function() {
                return "[avui a " + (1 !== this.hours() ? "les" : "la") + "] LT";
            },
            nextDay: function() {
                return "[demà a " + (1 !== this.hours() ? "les" : "la") + "] LT";
            },
            nextWeek: function() {
                return "dddd [a " + (1 !== this.hours() ? "les" : "la") + "] LT";
            },
            lastDay: function() {
                return "[ahir a " + (1 !== this.hours() ? "les" : "la") + "] LT";
            },
            lastWeek: function() {
                return "[el] dddd [passat a " + (1 !== this.hours() ? "les" : "la") + "] LT";
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "d'aquí %s",
            past: "fa %s",
            s: "uns segons",
            m: "un minut",
            mm: "%d minuts",
            h: "una hora",
            hh: "%d hores",
            d: "un dia",
            dd: "%d dies",
            M: "un mes",
            MM: "%d mesos",
            y: "un any",
            yy: "%d anys"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/,
        ordinal: function(number, period) {
            var output = 1 === number ? "r" : 2 === number ? "n" : 3 === number ? "r" : 4 === number ? "t" : "è";
            return "w" !== period && "W" !== period || (output = "a"), number + output;
        },
        week: {
            dow: 1,
            doy: 4
        }
    });
    var months$3 = "leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec".split("_"), monthsShort = "led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro".split("_");
    function plural$1(n) {
        return 1 < n && n < 5 && 1 != ~~(n / 10);
    }
    function translate$1(number, withoutSuffix, key, isFuture) {
        var result = number + " ";
        switch (key) {
          case "s":
            return withoutSuffix || isFuture ? "pár sekund" : "pár sekundami";

          case "m":
            return withoutSuffix ? "minuta" : isFuture ? "minutu" : "minutou";

          case "mm":
            return withoutSuffix || isFuture ? result + (plural$1(number) ? "minuty" : "minut") : result + "minutami";

          case "h":
            return withoutSuffix ? "hodina" : isFuture ? "hodinu" : "hodinou";

          case "hh":
            return withoutSuffix || isFuture ? result + (plural$1(number) ? "hodiny" : "hodin") : result + "hodinami";

          case "d":
            return withoutSuffix || isFuture ? "den" : "dnem";

          case "dd":
            return withoutSuffix || isFuture ? result + (plural$1(number) ? "dny" : "dní") : result + "dny";

          case "M":
            return withoutSuffix || isFuture ? "měsíc" : "měsícem";

          case "MM":
            return withoutSuffix || isFuture ? result + (plural$1(number) ? "měsíce" : "měsíců") : result + "měsíci";

          case "y":
            return withoutSuffix || isFuture ? "rok" : "rokem";

          case "yy":
            return withoutSuffix || isFuture ? result + (plural$1(number) ? "roky" : "let") : result + "lety";
        }
    }
    function processRelativeTime(number, withoutSuffix, key, isFuture) {
        var format = {
            m: [ "eine Minute", "einer Minute" ],
            h: [ "eine Stunde", "einer Stunde" ],
            d: [ "ein Tag", "einem Tag" ],
            dd: [ number + " Tage", number + " Tagen" ],
            M: [ "ein Monat", "einem Monat" ],
            MM: [ number + " Monate", number + " Monaten" ],
            y: [ "ein Jahr", "einem Jahr" ],
            yy: [ number + " Jahre", number + " Jahren" ]
        };
        return withoutSuffix ? format[key][0] : format[key][1];
    }
    function processRelativeTime$1(number, withoutSuffix, key, isFuture) {
        var format = {
            m: [ "eine Minute", "einer Minute" ],
            h: [ "eine Stunde", "einer Stunde" ],
            d: [ "ein Tag", "einem Tag" ],
            dd: [ number + " Tage", number + " Tagen" ],
            M: [ "ein Monat", "einem Monat" ],
            MM: [ number + " Monate", number + " Monaten" ],
            y: [ "ein Jahr", "einem Jahr" ],
            yy: [ number + " Jahre", number + " Jahren" ]
        };
        return withoutSuffix ? format[key][0] : format[key][1];
    }
    function processRelativeTime$2(number, withoutSuffix, key, isFuture) {
        var format = {
            m: [ "eine Minute", "einer Minute" ],
            h: [ "eine Stunde", "einer Stunde" ],
            d: [ "ein Tag", "einem Tag" ],
            dd: [ number + " Tage", number + " Tagen" ],
            M: [ "ein Monat", "einem Monat" ],
            MM: [ number + " Monate", number + " Monaten" ],
            y: [ "ein Jahr", "einem Jahr" ],
            yy: [ number + " Jahre", number + " Jahren" ]
        };
        return withoutSuffix ? format[key][0] : format[key][1];
    }
    hooks.defineLocale("cs", {
        months: months$3,
        monthsShort: monthsShort,
        monthsParse: function(months, monthsShort) {
            var i, _monthsParse = [];
            for (i = 0; i < 12; i++) _monthsParse[i] = new RegExp("^" + months[i] + "$|^" + monthsShort[i] + "$", "i");
            return _monthsParse;
        }(months$3, monthsShort),
        shortMonthsParse: function(monthsShort) {
            var i, _shortMonthsParse = [];
            for (i = 0; i < 12; i++) _shortMonthsParse[i] = new RegExp("^" + monthsShort[i] + "$", "i");
            return _shortMonthsParse;
        }(monthsShort),
        longMonthsParse: function(months) {
            var i, _longMonthsParse = [];
            for (i = 0; i < 12; i++) _longMonthsParse[i] = new RegExp("^" + months[i] + "$", "i");
            return _longMonthsParse;
        }(months$3),
        weekdays: "neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota".split("_"),
        weekdaysShort: "ne_po_út_st_čt_pá_so".split("_"),
        weekdaysMin: "ne_po_út_st_čt_pá_so".split("_"),
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY H:mm",
            LLLL: "dddd D. MMMM YYYY H:mm",
            l: "D. M. YYYY"
        },
        calendar: {
            sameDay: "[dnes v] LT",
            nextDay: "[zítra v] LT",
            nextWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[v neděli v] LT";

                  case 1:
                  case 2:
                    return "[v] dddd [v] LT";

                  case 3:
                    return "[ve středu v] LT";

                  case 4:
                    return "[ve čtvrtek v] LT";

                  case 5:
                    return "[v pátek v] LT";

                  case 6:
                    return "[v sobotu v] LT";
                }
            },
            lastDay: "[včera v] LT",
            lastWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[minulou neděli v] LT";

                  case 1:
                  case 2:
                    return "[minulé] dddd [v] LT";

                  case 3:
                    return "[minulou středu v] LT";

                  case 4:
                  case 5:
                    return "[minulý] dddd [v] LT";

                  case 6:
                    return "[minulou sobotu v] LT";
                }
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "za %s",
            past: "před %s",
            s: translate$1,
            m: translate$1,
            mm: translate$1,
            h: translate$1,
            hh: translate$1,
            d: translate$1,
            dd: translate$1,
            M: translate$1,
            MM: translate$1,
            y: translate$1,
            yy: translate$1
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("cv", {
        months: "кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав".split("_"),
        monthsShort: "кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш".split("_"),
        weekdays: "вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун".split("_"),
        weekdaysShort: "выр_тун_ытл_юн_кӗҫ_эрн_шӑм".split("_"),
        weekdaysMin: "вр_тн_ыт_юн_кҫ_эр_шм".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD-MM-YYYY",
            LL: "YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]",
            LLL: "YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm",
            LLLL: "dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm"
        },
        calendar: {
            sameDay: "[Паян] LT [сехетре]",
            nextDay: "[Ыран] LT [сехетре]",
            lastDay: "[Ӗнер] LT [сехетре]",
            nextWeek: "[Ҫитес] dddd LT [сехетре]",
            lastWeek: "[Иртнӗ] dddd LT [сехетре]",
            sameElse: "L"
        },
        relativeTime: {
            future: function(output) {
                return output + (/сехет$/i.exec(output) ? "рен" : /ҫул$/i.exec(output) ? "тан" : "ран");
            },
            past: "%s каялла",
            s: "пӗр-ик ҫеккунт",
            m: "пӗр минут",
            mm: "%d минут",
            h: "пӗр сехет",
            hh: "%d сехет",
            d: "пӗр кун",
            dd: "%d кун",
            M: "пӗр уйӑх",
            MM: "%d уйӑх",
            y: "пӗр ҫул",
            yy: "%d ҫул"
        },
        dayOfMonthOrdinalParse: /\d{1,2}-мӗш/,
        ordinal: "%d-мӗш",
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("cy", {
        months: "Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr".split("_"),
        monthsShort: "Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag".split("_"),
        weekdays: "Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn".split("_"),
        weekdaysShort: "Sul_Llun_Maw_Mer_Iau_Gwe_Sad".split("_"),
        weekdaysMin: "Su_Ll_Ma_Me_Ia_Gw_Sa".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Heddiw am] LT",
            nextDay: "[Yfory am] LT",
            nextWeek: "dddd [am] LT",
            lastDay: "[Ddoe am] LT",
            lastWeek: "dddd [diwethaf am] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "mewn %s",
            past: "%s yn ôl",
            s: "ychydig eiliadau",
            m: "munud",
            mm: "%d munud",
            h: "awr",
            hh: "%d awr",
            d: "diwrnod",
            dd: "%d diwrnod",
            M: "mis",
            MM: "%d mis",
            y: "blwyddyn",
            yy: "%d flynedd"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,
        ordinal: function(number) {
            var output = "";
            return 20 < number ? output = 40 === number || 50 === number || 60 === number || 80 === number || 100 === number ? "fed" : "ain" : 0 < number && (output = [ "", "af", "il", "ydd", "ydd", "ed", "ed", "ed", "fed", "fed", "fed", "eg", "fed", "eg", "eg", "fed", "eg", "eg", "fed", "eg", "fed" ][number]), 
            number + output;
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("da", {
        months: "januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december".split("_"),
        monthsShort: "jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),
        weekdays: "søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),
        weekdaysShort: "søn_man_tir_ons_tor_fre_lør".split("_"),
        weekdaysMin: "sø_ma_ti_on_to_fr_lø".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY HH:mm",
            LLLL: "dddd [d.] D. MMMM YYYY [kl.] HH:mm"
        },
        calendar: {
            sameDay: "[i dag kl.] LT",
            nextDay: "[i morgen kl.] LT",
            nextWeek: "på dddd [kl.] LT",
            lastDay: "[i går kl.] LT",
            lastWeek: "[i] dddd[s kl.] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "om %s",
            past: "%s siden",
            s: "få sekunder",
            m: "et minut",
            mm: "%d minutter",
            h: "en time",
            hh: "%d timer",
            d: "en dag",
            dd: "%d dage",
            M: "en måned",
            MM: "%d måneder",
            y: "et år",
            yy: "%d år"
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("de-at", {
        months: "Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),
        monthsShort: "Jän._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),
        monthsParseExact: !0,
        weekdays: "Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),
        weekdaysShort: "So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),
        weekdaysMin: "So_Mo_Di_Mi_Do_Fr_Sa".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY HH:mm",
            LLLL: "dddd, D. MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[heute um] LT [Uhr]",
            sameElse: "L",
            nextDay: "[morgen um] LT [Uhr]",
            nextWeek: "dddd [um] LT [Uhr]",
            lastDay: "[gestern um] LT [Uhr]",
            lastWeek: "[letzten] dddd [um] LT [Uhr]"
        },
        relativeTime: {
            future: "in %s",
            past: "vor %s",
            s: "ein paar Sekunden",
            m: processRelativeTime,
            mm: "%d Minuten",
            h: processRelativeTime,
            hh: "%d Stunden",
            d: processRelativeTime,
            dd: processRelativeTime,
            M: processRelativeTime,
            MM: processRelativeTime,
            y: processRelativeTime,
            yy: processRelativeTime
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("de-ch", {
        months: "Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),
        monthsShort: "Jan._Febr._März_April_Mai_Juni_Juli_Aug._Sept._Okt._Nov._Dez.".split("_"),
        monthsParseExact: !0,
        weekdays: "Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),
        weekdaysShort: "So_Mo_Di_Mi_Do_Fr_Sa".split("_"),
        weekdaysMin: "So_Mo_Di_Mi_Do_Fr_Sa".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH.mm",
            LTS: "HH.mm.ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY HH.mm",
            LLLL: "dddd, D. MMMM YYYY HH.mm"
        },
        calendar: {
            sameDay: "[heute um] LT [Uhr]",
            sameElse: "L",
            nextDay: "[morgen um] LT [Uhr]",
            nextWeek: "dddd [um] LT [Uhr]",
            lastDay: "[gestern um] LT [Uhr]",
            lastWeek: "[letzten] dddd [um] LT [Uhr]"
        },
        relativeTime: {
            future: "in %s",
            past: "vor %s",
            s: "ein paar Sekunden",
            m: processRelativeTime$1,
            mm: "%d Minuten",
            h: processRelativeTime$1,
            hh: "%d Stunden",
            d: processRelativeTime$1,
            dd: processRelativeTime$1,
            M: processRelativeTime$1,
            MM: processRelativeTime$1,
            y: processRelativeTime$1,
            yy: processRelativeTime$1
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("de", {
        months: "Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),
        monthsShort: "Jan._Febr._Mrz._Apr._Mai_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),
        monthsParseExact: !0,
        weekdays: "Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag".split("_"),
        weekdaysShort: "So._Mo._Di._Mi._Do._Fr._Sa.".split("_"),
        weekdaysMin: "So_Mo_Di_Mi_Do_Fr_Sa".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY HH:mm",
            LLLL: "dddd, D. MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[heute um] LT [Uhr]",
            sameElse: "L",
            nextDay: "[morgen um] LT [Uhr]",
            nextWeek: "dddd [um] LT [Uhr]",
            lastDay: "[gestern um] LT [Uhr]",
            lastWeek: "[letzten] dddd [um] LT [Uhr]"
        },
        relativeTime: {
            future: "in %s",
            past: "vor %s",
            s: "ein paar Sekunden",
            m: processRelativeTime$2,
            mm: "%d Minuten",
            h: processRelativeTime$2,
            hh: "%d Stunden",
            d: processRelativeTime$2,
            dd: processRelativeTime$2,
            M: processRelativeTime$2,
            MM: processRelativeTime$2,
            y: processRelativeTime$2,
            yy: processRelativeTime$2
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    });
    var months$4 = [ "ޖެނުއަރީ", "ފެބްރުއަރީ", "މާރިޗު", "އޭޕްރީލު", "މޭ", "ޖޫން", "ޖުލައި", "އޯގަސްޓު", "ސެޕްޓެމްބަރު", "އޮކްޓޯބަރު", "ނޮވެމްބަރު", "ޑިސެމްބަރު" ], weekdays = [ "އާދިއްތަ", "ހޯމަ", "އަންގާރަ", "ބުދަ", "ބުރާސްފަތި", "ހުކުރު", "ހޮނިހިރު" ];
    hooks.defineLocale("dv", {
        months: months$4,
        monthsShort: months$4,
        weekdays: weekdays,
        weekdaysShort: weekdays,
        weekdaysMin: "އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "D/M/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        meridiemParse: /މކ|މފ/,
        isPM: function(input) {
            return "މފ" === input;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 12 ? "މކ" : "މފ";
        },
        calendar: {
            sameDay: "[މިއަދު] LT",
            nextDay: "[މާދަމާ] LT",
            nextWeek: "dddd LT",
            lastDay: "[އިއްޔެ] LT",
            lastWeek: "[ފާއިތުވި] dddd LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "ތެރޭގައި %s",
            past: "ކުރިން %s",
            s: "ސިކުންތުކޮޅެއް",
            m: "މިނިޓެއް",
            mm: "މިނިޓު %d",
            h: "ގަޑިއިރެއް",
            hh: "ގަޑިއިރު %d",
            d: "ދުވަހެއް",
            dd: "ދުވަސް %d",
            M: "މަހެއް",
            MM: "މަސް %d",
            y: "އަހަރެއް",
            yy: "އަހަރު %d"
        },
        preparse: function(string) {
            return string.replace(/،/g, ",");
        },
        postformat: function(string) {
            return string.replace(/,/g, "،");
        },
        week: {
            dow: 7,
            doy: 12
        }
    }), hooks.defineLocale("el", {
        monthsNominativeEl: "Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος".split("_"),
        monthsGenitiveEl: "Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου".split("_"),
        months: function(momentToFormat, format) {
            return momentToFormat ? /D/.test(format.substring(0, format.indexOf("MMMM"))) ? this._monthsGenitiveEl[momentToFormat.month()] : this._monthsNominativeEl[momentToFormat.month()] : this._monthsNominativeEl;
        },
        monthsShort: "Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ".split("_"),
        weekdays: "Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο".split("_"),
        weekdaysShort: "Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ".split("_"),
        weekdaysMin: "Κυ_Δε_Τρ_Τε_Πε_Πα_Σα".split("_"),
        meridiem: function(hours, minutes, isLower) {
            return 11 < hours ? isLower ? "μμ" : "ΜΜ" : isLower ? "πμ" : "ΠΜ";
        },
        isPM: function(input) {
            return "μ" === (input + "").toLowerCase()[0];
        },
        meridiemParse: /[ΠΜ]\.?Μ?\.?/i,
        longDateFormat: {
            LT: "h:mm A",
            LTS: "h:mm:ss A",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY h:mm A",
            LLLL: "dddd, D MMMM YYYY h:mm A"
        },
        calendarEl: {
            sameDay: "[Σήμερα {}] LT",
            nextDay: "[Αύριο {}] LT",
            nextWeek: "dddd [{}] LT",
            lastDay: "[Χθες {}] LT",
            lastWeek: function() {
                switch (this.day()) {
                  case 6:
                    return "[το προηγούμενο] dddd [{}] LT";

                  default:
                    return "[την προηγούμενη] dddd [{}] LT";
                }
            },
            sameElse: "L"
        },
        calendar: function(key, mom) {
            var output = this._calendarEl[key], hours = mom && mom.hours();
            return isFunction(output) && (output = output.apply(mom)), output.replace("{}", hours % 12 == 1 ? "στη" : "στις");
        },
        relativeTime: {
            future: "σε %s",
            past: "%s πριν",
            s: "λίγα δευτερόλεπτα",
            m: "ένα λεπτό",
            mm: "%d λεπτά",
            h: "μία ώρα",
            hh: "%d ώρες",
            d: "μία μέρα",
            dd: "%d μέρες",
            M: "ένας μήνας",
            MM: "%d μήνες",
            y: "ένας χρόνος",
            yy: "%d χρόνια"
        },
        dayOfMonthOrdinalParse: /\d{1,2}η/,
        ordinal: "%dη",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("en-au", {
        months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
        monthsShort: "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
        weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
        weekdaysShort: "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
        weekdaysMin: "Su_Mo_Tu_We_Th_Fr_Sa".split("_"),
        longDateFormat: {
            LT: "h:mm A",
            LTS: "h:mm:ss A",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY h:mm A",
            LLLL: "dddd, D MMMM YYYY h:mm A"
        },
        calendar: {
            sameDay: "[Today at] LT",
            nextDay: "[Tomorrow at] LT",
            nextWeek: "dddd [at] LT",
            lastDay: "[Yesterday at] LT",
            lastWeek: "[Last] dddd [at] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "in %s",
            past: "%s ago",
            s: "a few seconds",
            m: "a minute",
            mm: "%d minutes",
            h: "an hour",
            hh: "%d hours",
            d: "a day",
            dd: "%d days",
            M: "a month",
            MM: "%d months",
            y: "a year",
            yy: "%d years"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
        ordinal: function(number) {
            var b = number % 10;
            return number + (1 == ~~(number % 100 / 10) ? "th" : 1 === b ? "st" : 2 === b ? "nd" : 3 === b ? "rd" : "th");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("en-ca", {
        months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
        monthsShort: "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
        weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
        weekdaysShort: "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
        weekdaysMin: "Su_Mo_Tu_We_Th_Fr_Sa".split("_"),
        longDateFormat: {
            LT: "h:mm A",
            LTS: "h:mm:ss A",
            L: "YYYY-MM-DD",
            LL: "MMMM D, YYYY",
            LLL: "MMMM D, YYYY h:mm A",
            LLLL: "dddd, MMMM D, YYYY h:mm A"
        },
        calendar: {
            sameDay: "[Today at] LT",
            nextDay: "[Tomorrow at] LT",
            nextWeek: "dddd [at] LT",
            lastDay: "[Yesterday at] LT",
            lastWeek: "[Last] dddd [at] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "in %s",
            past: "%s ago",
            s: "a few seconds",
            m: "a minute",
            mm: "%d minutes",
            h: "an hour",
            hh: "%d hours",
            d: "a day",
            dd: "%d days",
            M: "a month",
            MM: "%d months",
            y: "a year",
            yy: "%d years"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
        ordinal: function(number) {
            var b = number % 10;
            return number + (1 == ~~(number % 100 / 10) ? "th" : 1 === b ? "st" : 2 === b ? "nd" : 3 === b ? "rd" : "th");
        }
    }), hooks.defineLocale("en-gb", {
        months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
        monthsShort: "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
        weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
        weekdaysShort: "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
        weekdaysMin: "Su_Mo_Tu_We_Th_Fr_Sa".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Today at] LT",
            nextDay: "[Tomorrow at] LT",
            nextWeek: "dddd [at] LT",
            lastDay: "[Yesterday at] LT",
            lastWeek: "[Last] dddd [at] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "in %s",
            past: "%s ago",
            s: "a few seconds",
            m: "a minute",
            mm: "%d minutes",
            h: "an hour",
            hh: "%d hours",
            d: "a day",
            dd: "%d days",
            M: "a month",
            MM: "%d months",
            y: "a year",
            yy: "%d years"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
        ordinal: function(number) {
            var b = number % 10;
            return number + (1 == ~~(number % 100 / 10) ? "th" : 1 === b ? "st" : 2 === b ? "nd" : 3 === b ? "rd" : "th");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("en-ie", {
        months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
        monthsShort: "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
        weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
        weekdaysShort: "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
        weekdaysMin: "Su_Mo_Tu_We_Th_Fr_Sa".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD-MM-YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Today at] LT",
            nextDay: "[Tomorrow at] LT",
            nextWeek: "dddd [at] LT",
            lastDay: "[Yesterday at] LT",
            lastWeek: "[Last] dddd [at] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "in %s",
            past: "%s ago",
            s: "a few seconds",
            m: "a minute",
            mm: "%d minutes",
            h: "an hour",
            hh: "%d hours",
            d: "a day",
            dd: "%d days",
            M: "a month",
            MM: "%d months",
            y: "a year",
            yy: "%d years"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
        ordinal: function(number) {
            var b = number % 10;
            return number + (1 == ~~(number % 100 / 10) ? "th" : 1 === b ? "st" : 2 === b ? "nd" : 3 === b ? "rd" : "th");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("en-nz", {
        months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
        monthsShort: "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),
        weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
        weekdaysShort: "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),
        weekdaysMin: "Su_Mo_Tu_We_Th_Fr_Sa".split("_"),
        longDateFormat: {
            LT: "h:mm A",
            LTS: "h:mm:ss A",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY h:mm A",
            LLLL: "dddd, D MMMM YYYY h:mm A"
        },
        calendar: {
            sameDay: "[Today at] LT",
            nextDay: "[Tomorrow at] LT",
            nextWeek: "dddd [at] LT",
            lastDay: "[Yesterday at] LT",
            lastWeek: "[Last] dddd [at] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "in %s",
            past: "%s ago",
            s: "a few seconds",
            m: "a minute",
            mm: "%d minutes",
            h: "an hour",
            hh: "%d hours",
            d: "a day",
            dd: "%d days",
            M: "a month",
            MM: "%d months",
            y: "a year",
            yy: "%d years"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
        ordinal: function(number) {
            var b = number % 10;
            return number + (1 == ~~(number % 100 / 10) ? "th" : 1 === b ? "st" : 2 === b ? "nd" : 3 === b ? "rd" : "th");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("eo", {
        months: "januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro".split("_"),
        monthsShort: "jan_feb_mar_apr_maj_jun_jul_aŭg_sep_okt_nov_dec".split("_"),
        weekdays: "dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato".split("_"),
        weekdaysShort: "dim_lun_mard_merk_ĵaŭ_ven_sab".split("_"),
        weekdaysMin: "di_lu_ma_me_ĵa_ve_sa".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "YYYY-MM-DD",
            LL: "D[-a de] MMMM, YYYY",
            LLL: "D[-a de] MMMM, YYYY HH:mm",
            LLLL: "dddd, [la] D[-a de] MMMM, YYYY HH:mm"
        },
        meridiemParse: /[ap]\.t\.m/i,
        isPM: function(input) {
            return "p" === input.charAt(0).toLowerCase();
        },
        meridiem: function(hours, minutes, isLower) {
            return 11 < hours ? isLower ? "p.t.m." : "P.T.M." : isLower ? "a.t.m." : "A.T.M.";
        },
        calendar: {
            sameDay: "[Hodiaŭ je] LT",
            nextDay: "[Morgaŭ je] LT",
            nextWeek: "dddd [je] LT",
            lastDay: "[Hieraŭ je] LT",
            lastWeek: "[pasinta] dddd [je] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "post %s",
            past: "antaŭ %s",
            s: "sekundoj",
            m: "minuto",
            mm: "%d minutoj",
            h: "horo",
            hh: "%d horoj",
            d: "tago",
            dd: "%d tagoj",
            M: "monato",
            MM: "%d monatoj",
            y: "jaro",
            yy: "%d jaroj"
        },
        dayOfMonthOrdinalParse: /\d{1,2}a/,
        ordinal: "%da",
        week: {
            dow: 1,
            doy: 7
        }
    });
    var monthsShortDot = "ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"), monthsShort$1 = "ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_");
    hooks.defineLocale("es-do", {
        months: "enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),
        monthsShort: function(m, format) {
            return m ? /-MMM-/.test(format) ? monthsShort$1[m.month()] : monthsShortDot[m.month()] : monthsShortDot;
        },
        monthsParseExact: !0,
        weekdays: "domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),
        weekdaysShort: "dom._lun._mar._mié._jue._vie._sáb.".split("_"),
        weekdaysMin: "do_lu_ma_mi_ju_vi_sá".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "h:mm A",
            LTS: "h:mm:ss A",
            L: "DD/MM/YYYY",
            LL: "D [de] MMMM [de] YYYY",
            LLL: "D [de] MMMM [de] YYYY h:mm A",
            LLLL: "dddd, D [de] MMMM [de] YYYY h:mm A"
        },
        calendar: {
            sameDay: function() {
                return "[hoy a la" + (1 !== this.hours() ? "s" : "") + "] LT";
            },
            nextDay: function() {
                return "[mañana a la" + (1 !== this.hours() ? "s" : "") + "] LT";
            },
            nextWeek: function() {
                return "dddd [a la" + (1 !== this.hours() ? "s" : "") + "] LT";
            },
            lastDay: function() {
                return "[ayer a la" + (1 !== this.hours() ? "s" : "") + "] LT";
            },
            lastWeek: function() {
                return "[el] dddd [pasado a la" + (1 !== this.hours() ? "s" : "") + "] LT";
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "en %s",
            past: "hace %s",
            s: "unos segundos",
            m: "un minuto",
            mm: "%d minutos",
            h: "una hora",
            hh: "%d horas",
            d: "un día",
            dd: "%d días",
            M: "un mes",
            MM: "%d meses",
            y: "un año",
            yy: "%d años"
        },
        dayOfMonthOrdinalParse: /\d{1,2}º/,
        ordinal: "%dº",
        week: {
            dow: 1,
            doy: 4
        }
    });
    var monthsShortDot$1 = "ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.".split("_"), monthsShort$2 = "ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic".split("_");
    function processRelativeTime$3(number, withoutSuffix, key, isFuture) {
        var format = {
            s: [ "mõne sekundi", "mõni sekund", "paar sekundit" ],
            m: [ "ühe minuti", "üks minut" ],
            mm: [ number + " minuti", number + " minutit" ],
            h: [ "ühe tunni", "tund aega", "üks tund" ],
            hh: [ number + " tunni", number + " tundi" ],
            d: [ "ühe päeva", "üks päev" ],
            M: [ "kuu aja", "kuu aega", "üks kuu" ],
            MM: [ number + " kuu", number + " kuud" ],
            y: [ "ühe aasta", "aasta", "üks aasta" ],
            yy: [ number + " aasta", number + " aastat" ]
        };
        return withoutSuffix ? format[key][2] ? format[key][2] : format[key][1] : isFuture ? format[key][0] : format[key][1];
    }
    hooks.defineLocale("es", {
        months: "enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre".split("_"),
        monthsShort: function(m, format) {
            return m ? /-MMM-/.test(format) ? monthsShort$2[m.month()] : monthsShortDot$1[m.month()] : monthsShortDot$1;
        },
        monthsParseExact: !0,
        weekdays: "domingo_lunes_martes_miércoles_jueves_viernes_sábado".split("_"),
        weekdaysShort: "dom._lun._mar._mié._jue._vie._sáb.".split("_"),
        weekdaysMin: "do_lu_ma_mi_ju_vi_sá".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D [de] MMMM [de] YYYY",
            LLL: "D [de] MMMM [de] YYYY H:mm",
            LLLL: "dddd, D [de] MMMM [de] YYYY H:mm"
        },
        calendar: {
            sameDay: function() {
                return "[hoy a la" + (1 !== this.hours() ? "s" : "") + "] LT";
            },
            nextDay: function() {
                return "[mañana a la" + (1 !== this.hours() ? "s" : "") + "] LT";
            },
            nextWeek: function() {
                return "dddd [a la" + (1 !== this.hours() ? "s" : "") + "] LT";
            },
            lastDay: function() {
                return "[ayer a la" + (1 !== this.hours() ? "s" : "") + "] LT";
            },
            lastWeek: function() {
                return "[el] dddd [pasado a la" + (1 !== this.hours() ? "s" : "") + "] LT";
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "en %s",
            past: "hace %s",
            s: "unos segundos",
            m: "un minuto",
            mm: "%d minutos",
            h: "una hora",
            hh: "%d horas",
            d: "un día",
            dd: "%d días",
            M: "un mes",
            MM: "%d meses",
            y: "un año",
            yy: "%d años"
        },
        dayOfMonthOrdinalParse: /\d{1,2}º/,
        ordinal: "%dº",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("et", {
        months: "jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember".split("_"),
        monthsShort: "jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets".split("_"),
        weekdays: "pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev".split("_"),
        weekdaysShort: "P_E_T_K_N_R_L".split("_"),
        weekdaysMin: "P_E_T_K_N_R_L".split("_"),
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY H:mm",
            LLLL: "dddd, D. MMMM YYYY H:mm"
        },
        calendar: {
            sameDay: "[Täna,] LT",
            nextDay: "[Homme,] LT",
            nextWeek: "[Järgmine] dddd LT",
            lastDay: "[Eile,] LT",
            lastWeek: "[Eelmine] dddd LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s pärast",
            past: "%s tagasi",
            s: processRelativeTime$3,
            m: processRelativeTime$3,
            mm: processRelativeTime$3,
            h: processRelativeTime$3,
            hh: processRelativeTime$3,
            d: processRelativeTime$3,
            dd: "%d päeva",
            M: processRelativeTime$3,
            MM: processRelativeTime$3,
            y: processRelativeTime$3,
            yy: processRelativeTime$3
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("eu", {
        months: "urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),
        monthsShort: "urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),
        monthsParseExact: !0,
        weekdays: "igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),
        weekdaysShort: "ig._al._ar._az._og._ol._lr.".split("_"),
        weekdaysMin: "ig_al_ar_az_og_ol_lr".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "YYYY-MM-DD",
            LL: "YYYY[ko] MMMM[ren] D[a]",
            LLL: "YYYY[ko] MMMM[ren] D[a] HH:mm",
            LLLL: "dddd, YYYY[ko] MMMM[ren] D[a] HH:mm",
            l: "YYYY-M-D",
            ll: "YYYY[ko] MMM D[a]",
            lll: "YYYY[ko] MMM D[a] HH:mm",
            llll: "ddd, YYYY[ko] MMM D[a] HH:mm"
        },
        calendar: {
            sameDay: "[gaur] LT[etan]",
            nextDay: "[bihar] LT[etan]",
            nextWeek: "dddd LT[etan]",
            lastDay: "[atzo] LT[etan]",
            lastWeek: "[aurreko] dddd LT[etan]",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s barru",
            past: "duela %s",
            s: "segundo batzuk",
            m: "minutu bat",
            mm: "%d minutu",
            h: "ordu bat",
            hh: "%d ordu",
            d: "egun bat",
            dd: "%d egun",
            M: "hilabete bat",
            MM: "%d hilabete",
            y: "urte bat",
            yy: "%d urte"
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 7
        }
    });
    var symbolMap$5 = {
        1: "۱",
        2: "۲",
        3: "۳",
        4: "۴",
        5: "۵",
        6: "۶",
        7: "۷",
        8: "۸",
        9: "۹",
        0: "۰"
    }, numberMap$4 = {
        "۱": "1",
        "۲": "2",
        "۳": "3",
        "۴": "4",
        "۵": "5",
        "۶": "6",
        "۷": "7",
        "۸": "8",
        "۹": "9",
        "۰": "0"
    };
    hooks.defineLocale("fa", {
        months: "ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),
        monthsShort: "ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),
        weekdays: "یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),
        weekdaysShort: "یک‌شنبه_دوشنبه_سه‌شنبه_چهارشنبه_پنج‌شنبه_جمعه_شنبه".split("_"),
        weekdaysMin: "ی_د_س_چ_پ_ج_ش".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        meridiemParse: /قبل از ظهر|بعد از ظهر/,
        isPM: function(input) {
            return /بعد از ظهر/.test(input);
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 12 ? "قبل از ظهر" : "بعد از ظهر";
        },
        calendar: {
            sameDay: "[امروز ساعت] LT",
            nextDay: "[فردا ساعت] LT",
            nextWeek: "dddd [ساعت] LT",
            lastDay: "[دیروز ساعت] LT",
            lastWeek: "dddd [پیش] [ساعت] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "در %s",
            past: "%s پیش",
            s: "چند ثانیه",
            m: "یک دقیقه",
            mm: "%d دقیقه",
            h: "یک ساعت",
            hh: "%d ساعت",
            d: "یک روز",
            dd: "%d روز",
            M: "یک ماه",
            MM: "%d ماه",
            y: "یک سال",
            yy: "%d سال"
        },
        preparse: function(string) {
            return string.replace(/[۰-۹]/g, function(match) {
                return numberMap$4[match];
            }).replace(/،/g, ",");
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap$5[match];
            }).replace(/,/g, "،");
        },
        dayOfMonthOrdinalParse: /\d{1,2}م/,
        ordinal: "%dم",
        week: {
            dow: 6,
            doy: 12
        }
    });
    var numbersPast = "nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän".split(" "), numbersFuture = [ "nolla", "yhden", "kahden", "kolmen", "neljän", "viiden", "kuuden", numbersPast[7], numbersPast[8], numbersPast[9] ];
    function translate$2(number, withoutSuffix, key, isFuture) {
        var result = "";
        switch (key) {
          case "s":
            return isFuture ? "muutaman sekunnin" : "muutama sekunti";

          case "m":
            return isFuture ? "minuutin" : "minuutti";

          case "mm":
            result = isFuture ? "minuutin" : "minuuttia";
            break;

          case "h":
            return isFuture ? "tunnin" : "tunti";

          case "hh":
            result = isFuture ? "tunnin" : "tuntia";
            break;

          case "d":
            return isFuture ? "päivän" : "päivä";

          case "dd":
            result = isFuture ? "päivän" : "päivää";
            break;

          case "M":
            return isFuture ? "kuukauden" : "kuukausi";

          case "MM":
            result = isFuture ? "kuukauden" : "kuukautta";
            break;

          case "y":
            return isFuture ? "vuoden" : "vuosi";

          case "yy":
            result = isFuture ? "vuoden" : "vuotta";
        }
        return result = function(number, isFuture) {
            return number < 10 ? isFuture ? numbersFuture[number] : numbersPast[number] : number;
        }(number, isFuture) + " " + result;
    }
    hooks.defineLocale("fi", {
        months: "tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu".split("_"),
        monthsShort: "tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu".split("_"),
        weekdays: "sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai".split("_"),
        weekdaysShort: "su_ma_ti_ke_to_pe_la".split("_"),
        weekdaysMin: "su_ma_ti_ke_to_pe_la".split("_"),
        longDateFormat: {
            LT: "HH.mm",
            LTS: "HH.mm.ss",
            L: "DD.MM.YYYY",
            LL: "Do MMMM[ta] YYYY",
            LLL: "Do MMMM[ta] YYYY, [klo] HH.mm",
            LLLL: "dddd, Do MMMM[ta] YYYY, [klo] HH.mm",
            l: "D.M.YYYY",
            ll: "Do MMM YYYY",
            lll: "Do MMM YYYY, [klo] HH.mm",
            llll: "ddd, Do MMM YYYY, [klo] HH.mm"
        },
        calendar: {
            sameDay: "[tänään] [klo] LT",
            nextDay: "[huomenna] [klo] LT",
            nextWeek: "dddd [klo] LT",
            lastDay: "[eilen] [klo] LT",
            lastWeek: "[viime] dddd[na] [klo] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s päästä",
            past: "%s sitten",
            s: translate$2,
            m: translate$2,
            mm: translate$2,
            h: translate$2,
            hh: translate$2,
            d: translate$2,
            dd: translate$2,
            M: translate$2,
            MM: translate$2,
            y: translate$2,
            yy: translate$2
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("fo", {
        months: "januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember".split("_"),
        monthsShort: "jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),
        weekdays: "sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur".split("_"),
        weekdaysShort: "sun_mán_týs_mik_hós_frí_ley".split("_"),
        weekdaysMin: "su_má_tý_mi_hó_fr_le".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D. MMMM, YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Í dag kl.] LT",
            nextDay: "[Í morgin kl.] LT",
            nextWeek: "dddd [kl.] LT",
            lastDay: "[Í gjár kl.] LT",
            lastWeek: "[síðstu] dddd [kl] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "um %s",
            past: "%s síðani",
            s: "fá sekund",
            m: "ein minutt",
            mm: "%d minuttir",
            h: "ein tími",
            hh: "%d tímar",
            d: "ein dagur",
            dd: "%d dagar",
            M: "ein mánaði",
            MM: "%d mánaðir",
            y: "eitt ár",
            yy: "%d ár"
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("fr-ca", {
        months: "janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),
        monthsShort: "janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),
        monthsParseExact: !0,
        weekdays: "dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),
        weekdaysShort: "dim._lun._mar._mer._jeu._ven._sam.".split("_"),
        weekdaysMin: "Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "YYYY-MM-DD",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Aujourd’hui à] LT",
            nextDay: "[Demain à] LT",
            nextWeek: "dddd [à] LT",
            lastDay: "[Hier à] LT",
            lastWeek: "dddd [dernier à] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "dans %s",
            past: "il y a %s",
            s: "quelques secondes",
            m: "une minute",
            mm: "%d minutes",
            h: "une heure",
            hh: "%d heures",
            d: "un jour",
            dd: "%d jours",
            M: "un mois",
            MM: "%d mois",
            y: "un an",
            yy: "%d ans"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(er|e)/,
        ordinal: function(number, period) {
            switch (period) {
              default:
              case "M":
              case "Q":
              case "D":
              case "DDD":
              case "d":
                return number + (1 === number ? "er" : "e");

              case "w":
              case "W":
                return number + (1 === number ? "re" : "e");
            }
        }
    }), hooks.defineLocale("fr-ch", {
        months: "janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),
        monthsShort: "janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),
        monthsParseExact: !0,
        weekdays: "dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),
        weekdaysShort: "dim._lun._mar._mer._jeu._ven._sam.".split("_"),
        weekdaysMin: "Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Aujourd’hui à] LT",
            nextDay: "[Demain à] LT",
            nextWeek: "dddd [à] LT",
            lastDay: "[Hier à] LT",
            lastWeek: "dddd [dernier à] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "dans %s",
            past: "il y a %s",
            s: "quelques secondes",
            m: "une minute",
            mm: "%d minutes",
            h: "une heure",
            hh: "%d heures",
            d: "un jour",
            dd: "%d jours",
            M: "un mois",
            MM: "%d mois",
            y: "un an",
            yy: "%d ans"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(er|e)/,
        ordinal: function(number, period) {
            switch (period) {
              default:
              case "M":
              case "Q":
              case "D":
              case "DDD":
              case "d":
                return number + (1 === number ? "er" : "e");

              case "w":
              case "W":
                return number + (1 === number ? "re" : "e");
            }
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("fr", {
        months: "janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre".split("_"),
        monthsShort: "janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.".split("_"),
        monthsParseExact: !0,
        weekdays: "dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi".split("_"),
        weekdaysShort: "dim._lun._mar._mer._jeu._ven._sam.".split("_"),
        weekdaysMin: "Di_Lu_Ma_Me_Je_Ve_Sa".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Aujourd’hui à] LT",
            nextDay: "[Demain à] LT",
            nextWeek: "dddd [à] LT",
            lastDay: "[Hier à] LT",
            lastWeek: "dddd [dernier à] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "dans %s",
            past: "il y a %s",
            s: "quelques secondes",
            m: "une minute",
            mm: "%d minutes",
            h: "une heure",
            hh: "%d heures",
            d: "un jour",
            dd: "%d jours",
            M: "un mois",
            MM: "%d mois",
            y: "un an",
            yy: "%d ans"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(er|)/,
        ordinal: function(number, period) {
            switch (period) {
              case "D":
                return number + (1 === number ? "er" : "");

              default:
              case "M":
              case "Q":
              case "DDD":
              case "d":
                return number + (1 === number ? "er" : "e");

              case "w":
              case "W":
                return number + (1 === number ? "re" : "e");
            }
        },
        week: {
            dow: 1,
            doy: 4
        }
    });
    var monthsShortWithDots = "jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.".split("_"), monthsShortWithoutDots = "jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_");
    hooks.defineLocale("fy", {
        months: "jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber".split("_"),
        monthsShort: function(m, format) {
            return m ? /-MMM-/.test(format) ? monthsShortWithoutDots[m.month()] : monthsShortWithDots[m.month()] : monthsShortWithDots;
        },
        monthsParseExact: !0,
        weekdays: "snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon".split("_"),
        weekdaysShort: "si._mo._ti._wo._to._fr._so.".split("_"),
        weekdaysMin: "Si_Mo_Ti_Wo_To_Fr_So".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD-MM-YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[hjoed om] LT",
            nextDay: "[moarn om] LT",
            nextWeek: "dddd [om] LT",
            lastDay: "[juster om] LT",
            lastWeek: "[ôfrûne] dddd [om] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "oer %s",
            past: "%s lyn",
            s: "in pear sekonden",
            m: "ien minút",
            mm: "%d minuten",
            h: "ien oere",
            hh: "%d oeren",
            d: "ien dei",
            dd: "%d dagen",
            M: "ien moanne",
            MM: "%d moannen",
            y: "ien jier",
            yy: "%d jierren"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
        ordinal: function(number) {
            return number + (1 === number || 8 === number || 20 <= number ? "ste" : "de");
        },
        week: {
            dow: 1,
            doy: 4
        }
    });
    function processRelativeTime$4(number, withoutSuffix, key, isFuture) {
        var format = {
            s: [ "thodde secondanim", "thodde second" ],
            m: [ "eka mintan", "ek minute" ],
            mm: [ number + " mintanim", number + " mintam" ],
            h: [ "eka horan", "ek hor" ],
            hh: [ number + " horanim", number + " hor" ],
            d: [ "eka disan", "ek dis" ],
            dd: [ number + " disanim", number + " dis" ],
            M: [ "eka mhoinean", "ek mhoino" ],
            MM: [ number + " mhoineanim", number + " mhoine" ],
            y: [ "eka vorsan", "ek voros" ],
            yy: [ number + " vorsanim", number + " vorsam" ]
        };
        return withoutSuffix ? format[key][0] : format[key][1];
    }
    hooks.defineLocale("gd", {
        months: [ "Am Faoilleach", "An Gearran", "Am Màrt", "An Giblean", "An Cèitean", "An t-Ògmhios", "An t-Iuchar", "An Lùnastal", "An t-Sultain", "An Dàmhair", "An t-Samhain", "An Dùbhlachd" ],
        monthsShort: [ "Faoi", "Gear", "Màrt", "Gibl", "Cèit", "Ògmh", "Iuch", "Lùn", "Sult", "Dàmh", "Samh", "Dùbh" ],
        monthsParseExact: !0,
        weekdays: [ "Didòmhnaich", "Diluain", "Dimàirt", "Diciadain", "Diardaoin", "Dihaoine", "Disathairne" ],
        weekdaysShort: [ "Did", "Dil", "Dim", "Dic", "Dia", "Dih", "Dis" ],
        weekdaysMin: [ "Dò", "Lu", "Mà", "Ci", "Ar", "Ha", "Sa" ],
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[An-diugh aig] LT",
            nextDay: "[A-màireach aig] LT",
            nextWeek: "dddd [aig] LT",
            lastDay: "[An-dè aig] LT",
            lastWeek: "dddd [seo chaidh] [aig] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "ann an %s",
            past: "bho chionn %s",
            s: "beagan diogan",
            m: "mionaid",
            mm: "%d mionaidean",
            h: "uair",
            hh: "%d uairean",
            d: "latha",
            dd: "%d latha",
            M: "mìos",
            MM: "%d mìosan",
            y: "bliadhna",
            yy: "%d bliadhna"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(d|na|mh)/,
        ordinal: function(number) {
            return number + (1 === number ? "d" : number % 10 == 2 ? "na" : "mh");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("gl", {
        months: "xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro".split("_"),
        monthsShort: "xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.".split("_"),
        monthsParseExact: !0,
        weekdays: "domingo_luns_martes_mércores_xoves_venres_sábado".split("_"),
        weekdaysShort: "dom._lun._mar._mér._xov._ven._sáb.".split("_"),
        weekdaysMin: "do_lu_ma_mé_xo_ve_sá".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D [de] MMMM [de] YYYY",
            LLL: "D [de] MMMM [de] YYYY H:mm",
            LLLL: "dddd, D [de] MMMM [de] YYYY H:mm"
        },
        calendar: {
            sameDay: function() {
                return "[hoxe " + (1 !== this.hours() ? "ás" : "á") + "] LT";
            },
            nextDay: function() {
                return "[mañá " + (1 !== this.hours() ? "ás" : "á") + "] LT";
            },
            nextWeek: function() {
                return "dddd [" + (1 !== this.hours() ? "ás" : "a") + "] LT";
            },
            lastDay: function() {
                return "[onte " + (1 !== this.hours() ? "á" : "a") + "] LT";
            },
            lastWeek: function() {
                return "[o] dddd [pasado " + (1 !== this.hours() ? "ás" : "a") + "] LT";
            },
            sameElse: "L"
        },
        relativeTime: {
            future: function(str) {
                return 0 === str.indexOf("un") ? "n" + str : "en " + str;
            },
            past: "hai %s",
            s: "uns segundos",
            m: "un minuto",
            mm: "%d minutos",
            h: "unha hora",
            hh: "%d horas",
            d: "un día",
            dd: "%d días",
            M: "un mes",
            MM: "%d meses",
            y: "un ano",
            yy: "%d anos"
        },
        dayOfMonthOrdinalParse: /\d{1,2}º/,
        ordinal: "%dº",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("gom-latn", {
        months: "Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr".split("_"),
        monthsShort: "Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.".split("_"),
        monthsParseExact: !0,
        weekdays: "Aitar_Somar_Mongllar_Budvar_Brestar_Sukrar_Son'var".split("_"),
        weekdaysShort: "Ait._Som._Mon._Bud._Bre._Suk._Son.".split("_"),
        weekdaysMin: "Ai_Sm_Mo_Bu_Br_Su_Sn".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "A h:mm [vazta]",
            LTS: "A h:mm:ss [vazta]",
            L: "DD-MM-YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY A h:mm [vazta]",
            LLLL: "dddd, MMMM[achea] Do, YYYY, A h:mm [vazta]",
            llll: "ddd, D MMM YYYY, A h:mm [vazta]"
        },
        calendar: {
            sameDay: "[Aiz] LT",
            nextDay: "[Faleam] LT",
            nextWeek: "[Ieta to] dddd[,] LT",
            lastDay: "[Kal] LT",
            lastWeek: "[Fatlo] dddd[,] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s",
            past: "%s adim",
            s: processRelativeTime$4,
            m: processRelativeTime$4,
            mm: processRelativeTime$4,
            h: processRelativeTime$4,
            hh: processRelativeTime$4,
            d: processRelativeTime$4,
            dd: processRelativeTime$4,
            M: processRelativeTime$4,
            MM: processRelativeTime$4,
            y: processRelativeTime$4,
            yy: processRelativeTime$4
        },
        dayOfMonthOrdinalParse: /\d{1,2}(er)/,
        ordinal: function(number, period) {
            switch (period) {
              case "D":
                return number + "er";

              default:
              case "M":
              case "Q":
              case "DDD":
              case "d":
              case "w":
              case "W":
                return number;
            }
        },
        week: {
            dow: 1,
            doy: 4
        },
        meridiemParse: /rati|sokalli|donparam|sanje/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "rati" === meridiem ? hour < 4 ? hour : hour + 12 : "sokalli" === meridiem ? hour : "donparam" === meridiem ? 12 < hour ? hour : hour + 12 : "sanje" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "rati" : hour < 12 ? "sokalli" : hour < 16 ? "donparam" : hour < 20 ? "sanje" : "rati";
        }
    }), hooks.defineLocale("he", {
        months: "ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר".split("_"),
        monthsShort: "ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳".split("_"),
        weekdays: "ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת".split("_"),
        weekdaysShort: "א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳".split("_"),
        weekdaysMin: "א_ב_ג_ד_ה_ו_ש".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D [ב]MMMM YYYY",
            LLL: "D [ב]MMMM YYYY HH:mm",
            LLLL: "dddd, D [ב]MMMM YYYY HH:mm",
            l: "D/M/YYYY",
            ll: "D MMM YYYY",
            lll: "D MMM YYYY HH:mm",
            llll: "ddd, D MMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[היום ב־]LT",
            nextDay: "[מחר ב־]LT",
            nextWeek: "dddd [בשעה] LT",
            lastDay: "[אתמול ב־]LT",
            lastWeek: "[ביום] dddd [האחרון בשעה] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "בעוד %s",
            past: "לפני %s",
            s: "מספר שניות",
            m: "דקה",
            mm: "%d דקות",
            h: "שעה",
            hh: function(number) {
                return 2 === number ? "שעתיים" : number + " שעות";
            },
            d: "יום",
            dd: function(number) {
                return 2 === number ? "יומיים" : number + " ימים";
            },
            M: "חודש",
            MM: function(number) {
                return 2 === number ? "חודשיים" : number + " חודשים";
            },
            y: "שנה",
            yy: function(number) {
                return 2 === number ? "שנתיים" : number % 10 == 0 && 10 !== number ? number + " שנה" : number + " שנים";
            }
        },
        meridiemParse: /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,
        isPM: function(input) {
            return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input);
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 5 ? "לפנות בוקר" : hour < 10 ? "בבוקר" : hour < 12 ? isLower ? 'לפנה"צ' : "לפני הצהריים" : hour < 18 ? isLower ? 'אחה"צ' : "אחרי הצהריים" : "בערב";
        }
    });
    var symbolMap$6 = {
        1: "१",
        2: "२",
        3: "३",
        4: "४",
        5: "५",
        6: "६",
        7: "७",
        8: "८",
        9: "९",
        0: "०"
    }, numberMap$5 = {
        "१": "1",
        "२": "2",
        "३": "3",
        "४": "4",
        "५": "5",
        "६": "6",
        "७": "7",
        "८": "8",
        "९": "9",
        "०": "0"
    };
    function translate$3(number, withoutSuffix, key) {
        var result = number + " ";
        switch (key) {
          case "m":
            return withoutSuffix ? "jedna minuta" : "jedne minute";

          case "mm":
            return result += 1 === number ? "minuta" : 2 === number || 3 === number || 4 === number ? "minute" : "minuta";

          case "h":
            return withoutSuffix ? "jedan sat" : "jednog sata";

          case "hh":
            return result += 1 === number ? "sat" : 2 === number || 3 === number || 4 === number ? "sata" : "sati";

          case "dd":
            return result += 1 === number ? "dan" : "dana";

          case "MM":
            return result += 1 === number ? "mjesec" : 2 === number || 3 === number || 4 === number ? "mjeseca" : "mjeseci";

          case "yy":
            return result += 1 === number ? "godina" : 2 === number || 3 === number || 4 === number ? "godine" : "godina";
        }
    }
    hooks.defineLocale("hi", {
        months: "जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर".split("_"),
        monthsShort: "जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.".split("_"),
        monthsParseExact: !0,
        weekdays: "रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),
        weekdaysShort: "रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि".split("_"),
        weekdaysMin: "र_सो_मं_बु_गु_शु_श".split("_"),
        longDateFormat: {
            LT: "A h:mm बजे",
            LTS: "A h:mm:ss बजे",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY, A h:mm बजे",
            LLLL: "dddd, D MMMM YYYY, A h:mm बजे"
        },
        calendar: {
            sameDay: "[आज] LT",
            nextDay: "[कल] LT",
            nextWeek: "dddd, LT",
            lastDay: "[कल] LT",
            lastWeek: "[पिछले] dddd, LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s में",
            past: "%s पहले",
            s: "कुछ ही क्षण",
            m: "एक मिनट",
            mm: "%d मिनट",
            h: "एक घंटा",
            hh: "%d घंटे",
            d: "एक दिन",
            dd: "%d दिन",
            M: "एक महीने",
            MM: "%d महीने",
            y: "एक वर्ष",
            yy: "%d वर्ष"
        },
        preparse: function(string) {
            return string.replace(/[१२३४५६७८९०]/g, function(match) {
                return numberMap$5[match];
            });
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap$6[match];
            });
        },
        meridiemParse: /रात|सुबह|दोपहर|शाम/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "रात" === meridiem ? hour < 4 ? hour : hour + 12 : "सुबह" === meridiem ? hour : "दोपहर" === meridiem ? 10 <= hour ? hour : hour + 12 : "शाम" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "रात" : hour < 10 ? "सुबह" : hour < 17 ? "दोपहर" : hour < 20 ? "शाम" : "रात";
        },
        week: {
            dow: 0,
            doy: 6
        }
    }), hooks.defineLocale("hr", {
        months: {
            format: "siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca".split("_"),
            standalone: "siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac".split("_")
        },
        monthsShort: "sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.".split("_"),
        monthsParseExact: !0,
        weekdays: "nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),
        weekdaysShort: "ned._pon._uto._sri._čet._pet._sub.".split("_"),
        weekdaysMin: "ne_po_ut_sr_če_pe_su".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY H:mm",
            LLLL: "dddd, D. MMMM YYYY H:mm"
        },
        calendar: {
            sameDay: "[danas u] LT",
            nextDay: "[sutra u] LT",
            nextWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[u] [nedjelju] [u] LT";

                  case 3:
                    return "[u] [srijedu] [u] LT";

                  case 6:
                    return "[u] [subotu] [u] LT";

                  case 1:
                  case 2:
                  case 4:
                  case 5:
                    return "[u] dddd [u] LT";
                }
            },
            lastDay: "[jučer u] LT",
            lastWeek: function() {
                switch (this.day()) {
                  case 0:
                  case 3:
                    return "[prošlu] dddd [u] LT";

                  case 6:
                    return "[prošle] [subote] [u] LT";

                  case 1:
                  case 2:
                  case 4:
                  case 5:
                    return "[prošli] dddd [u] LT";
                }
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "za %s",
            past: "prije %s",
            s: "par sekundi",
            m: translate$3,
            mm: translate$3,
            h: translate$3,
            hh: translate$3,
            d: "dan",
            dd: translate$3,
            M: "mjesec",
            MM: translate$3,
            y: "godinu",
            yy: translate$3
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 7
        }
    });
    var weekEndings = "vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton".split(" ");
    function translate$4(number, withoutSuffix, key, isFuture) {
        var num = number;
        switch (key) {
          case "s":
            return isFuture || withoutSuffix ? "néhány másodperc" : "néhány másodperce";

          case "m":
            return "egy" + (isFuture || withoutSuffix ? " perc" : " perce");

          case "mm":
            return num + (isFuture || withoutSuffix ? " perc" : " perce");

          case "h":
            return "egy" + (isFuture || withoutSuffix ? " óra" : " órája");

          case "hh":
            return num + (isFuture || withoutSuffix ? " óra" : " órája");

          case "d":
            return "egy" + (isFuture || withoutSuffix ? " nap" : " napja");

          case "dd":
            return num + (isFuture || withoutSuffix ? " nap" : " napja");

          case "M":
            return "egy" + (isFuture || withoutSuffix ? " hónap" : " hónapja");

          case "MM":
            return num + (isFuture || withoutSuffix ? " hónap" : " hónapja");

          case "y":
            return "egy" + (isFuture || withoutSuffix ? " év" : " éve");

          case "yy":
            return num + (isFuture || withoutSuffix ? " év" : " éve");
        }
        return "";
    }
    function week(isFuture) {
        return (isFuture ? "" : "[múlt] ") + "[" + weekEndings[this.day()] + "] LT[-kor]";
    }
    function plural$2(n) {
        return n % 100 == 11 || n % 10 != 1;
    }
    function translate$5(number, withoutSuffix, key, isFuture) {
        var result = number + " ";
        switch (key) {
          case "s":
            return withoutSuffix || isFuture ? "nokkrar sekúndur" : "nokkrum sekúndum";

          case "m":
            return withoutSuffix ? "mínúta" : "mínútu";

          case "mm":
            return plural$2(number) ? result + (withoutSuffix || isFuture ? "mínútur" : "mínútum") : withoutSuffix ? result + "mínúta" : result + "mínútu";

          case "hh":
            return plural$2(number) ? result + (withoutSuffix || isFuture ? "klukkustundir" : "klukkustundum") : result + "klukkustund";

          case "d":
            return withoutSuffix ? "dagur" : isFuture ? "dag" : "degi";

          case "dd":
            return plural$2(number) ? withoutSuffix ? result + "dagar" : result + (isFuture ? "daga" : "dögum") : withoutSuffix ? result + "dagur" : result + (isFuture ? "dag" : "degi");

          case "M":
            return withoutSuffix ? "mánuður" : isFuture ? "mánuð" : "mánuði";

          case "MM":
            return plural$2(number) ? withoutSuffix ? result + "mánuðir" : result + (isFuture ? "mánuði" : "mánuðum") : withoutSuffix ? result + "mánuður" : result + (isFuture ? "mánuð" : "mánuði");

          case "y":
            return withoutSuffix || isFuture ? "ár" : "ári";

          case "yy":
            return plural$2(number) ? result + (withoutSuffix || isFuture ? "ár" : "árum") : result + (withoutSuffix || isFuture ? "ár" : "ári");
        }
    }
    hooks.defineLocale("hu", {
        months: "január_február_március_április_május_június_július_augusztus_szeptember_október_november_december".split("_"),
        monthsShort: "jan_feb_márc_ápr_máj_jún_júl_aug_szept_okt_nov_dec".split("_"),
        weekdays: "vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat".split("_"),
        weekdaysShort: "vas_hét_kedd_sze_csüt_pén_szo".split("_"),
        weekdaysMin: "v_h_k_sze_cs_p_szo".split("_"),
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "YYYY.MM.DD.",
            LL: "YYYY. MMMM D.",
            LLL: "YYYY. MMMM D. H:mm",
            LLLL: "YYYY. MMMM D., dddd H:mm"
        },
        meridiemParse: /de|du/i,
        isPM: function(input) {
            return "u" === input.charAt(1).toLowerCase();
        },
        meridiem: function(hours, minutes, isLower) {
            return hours < 12 ? !0 === isLower ? "de" : "DE" : !0 === isLower ? "du" : "DU";
        },
        calendar: {
            sameDay: "[ma] LT[-kor]",
            nextDay: "[holnap] LT[-kor]",
            nextWeek: function() {
                return week.call(this, !0);
            },
            lastDay: "[tegnap] LT[-kor]",
            lastWeek: function() {
                return week.call(this, !1);
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "%s múlva",
            past: "%s",
            s: translate$4,
            m: translate$4,
            mm: translate$4,
            h: translate$4,
            hh: translate$4,
            d: translate$4,
            dd: translate$4,
            M: translate$4,
            MM: translate$4,
            y: translate$4,
            yy: translate$4
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("hy-am", {
        months: {
            format: "հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի".split("_"),
            standalone: "հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր".split("_")
        },
        monthsShort: "հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ".split("_"),
        weekdays: "կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ".split("_"),
        weekdaysShort: "կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),
        weekdaysMin: "կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY թ.",
            LLL: "D MMMM YYYY թ., HH:mm",
            LLLL: "dddd, D MMMM YYYY թ., HH:mm"
        },
        calendar: {
            sameDay: "[այսօր] LT",
            nextDay: "[վաղը] LT",
            lastDay: "[երեկ] LT",
            nextWeek: function() {
                return "dddd [օրը ժամը] LT";
            },
            lastWeek: function() {
                return "[անցած] dddd [օրը ժամը] LT";
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "%s հետո",
            past: "%s առաջ",
            s: "մի քանի վայրկյան",
            m: "րոպե",
            mm: "%d րոպե",
            h: "ժամ",
            hh: "%d ժամ",
            d: "օր",
            dd: "%d օր",
            M: "ամիս",
            MM: "%d ամիս",
            y: "տարի",
            yy: "%d տարի"
        },
        meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,
        isPM: function(input) {
            return /^(ցերեկվա|երեկոյան)$/.test(input);
        },
        meridiem: function(hour) {
            return hour < 4 ? "գիշերվա" : hour < 12 ? "առավոտվա" : hour < 17 ? "ցերեկվա" : "երեկոյան";
        },
        dayOfMonthOrdinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/,
        ordinal: function(number, period) {
            switch (period) {
              case "DDD":
              case "w":
              case "W":
              case "DDDo":
                return 1 === number ? number + "-ին" : number + "-րդ";

              default:
                return number;
            }
        },
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("id", {
        months: "Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember".split("_"),
        monthsShort: "Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nov_Des".split("_"),
        weekdays: "Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu".split("_"),
        weekdaysShort: "Min_Sen_Sel_Rab_Kam_Jum_Sab".split("_"),
        weekdaysMin: "Mg_Sn_Sl_Rb_Km_Jm_Sb".split("_"),
        longDateFormat: {
            LT: "HH.mm",
            LTS: "HH.mm.ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY [pukul] HH.mm",
            LLLL: "dddd, D MMMM YYYY [pukul] HH.mm"
        },
        meridiemParse: /pagi|siang|sore|malam/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "pagi" === meridiem ? hour : "siang" === meridiem ? 11 <= hour ? hour : hour + 12 : "sore" === meridiem || "malam" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hours, minutes, isLower) {
            return hours < 11 ? "pagi" : hours < 15 ? "siang" : hours < 19 ? "sore" : "malam";
        },
        calendar: {
            sameDay: "[Hari ini pukul] LT",
            nextDay: "[Besok pukul] LT",
            nextWeek: "dddd [pukul] LT",
            lastDay: "[Kemarin pukul] LT",
            lastWeek: "dddd [lalu pukul] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "dalam %s",
            past: "%s yang lalu",
            s: "beberapa detik",
            m: "semenit",
            mm: "%d menit",
            h: "sejam",
            hh: "%d jam",
            d: "sehari",
            dd: "%d hari",
            M: "sebulan",
            MM: "%d bulan",
            y: "setahun",
            yy: "%d tahun"
        },
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("is", {
        months: "janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember".split("_"),
        monthsShort: "jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des".split("_"),
        weekdays: "sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur".split("_"),
        weekdaysShort: "sun_mán_þri_mið_fim_fös_lau".split("_"),
        weekdaysMin: "Su_Má_Þr_Mi_Fi_Fö_La".split("_"),
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY [kl.] H:mm",
            LLLL: "dddd, D. MMMM YYYY [kl.] H:mm"
        },
        calendar: {
            sameDay: "[í dag kl.] LT",
            nextDay: "[á morgun kl.] LT",
            nextWeek: "dddd [kl.] LT",
            lastDay: "[í gær kl.] LT",
            lastWeek: "[síðasta] dddd [kl.] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "eftir %s",
            past: "fyrir %s síðan",
            s: translate$5,
            m: translate$5,
            mm: translate$5,
            h: "klukkustund",
            hh: translate$5,
            d: translate$5,
            dd: translate$5,
            M: translate$5,
            MM: translate$5,
            y: translate$5,
            yy: translate$5
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("it", {
        months: "gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre".split("_"),
        monthsShort: "gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic".split("_"),
        weekdays: "domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato".split("_"),
        weekdaysShort: "dom_lun_mar_mer_gio_ven_sab".split("_"),
        weekdaysMin: "do_lu_ma_me_gi_ve_sa".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Oggi alle] LT",
            nextDay: "[Domani alle] LT",
            nextWeek: "dddd [alle] LT",
            lastDay: "[Ieri alle] LT",
            lastWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[la scorsa] dddd [alle] LT";

                  default:
                    return "[lo scorso] dddd [alle] LT";
                }
            },
            sameElse: "L"
        },
        relativeTime: {
            future: function(s) {
                return (/^[0-9].+$/.test(s) ? "tra" : "in") + " " + s;
            },
            past: "%s fa",
            s: "alcuni secondi",
            m: "un minuto",
            mm: "%d minuti",
            h: "un'ora",
            hh: "%d ore",
            d: "un giorno",
            dd: "%d giorni",
            M: "un mese",
            MM: "%d mesi",
            y: "un anno",
            yy: "%d anni"
        },
        dayOfMonthOrdinalParse: /\d{1,2}º/,
        ordinal: "%dº",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("ja", {
        months: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),
        monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),
        weekdays: "日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日".split("_"),
        weekdaysShort: "日_月_火_水_木_金_土".split("_"),
        weekdaysMin: "日_月_火_水_木_金_土".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "YYYY/MM/DD",
            LL: "YYYY年M月D日",
            LLL: "YYYY年M月D日 HH:mm",
            LLLL: "YYYY年M月D日 HH:mm dddd",
            l: "YYYY/MM/DD",
            ll: "YYYY年M月D日",
            lll: "YYYY年M月D日 HH:mm",
            llll: "YYYY年M月D日 HH:mm dddd"
        },
        meridiemParse: /午前|午後/i,
        isPM: function(input) {
            return "午後" === input;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 12 ? "午前" : "午後";
        },
        calendar: {
            sameDay: "[今日] LT",
            nextDay: "[明日] LT",
            nextWeek: "[来週]dddd LT",
            lastDay: "[昨日] LT",
            lastWeek: "[前週]dddd LT",
            sameElse: "L"
        },
        dayOfMonthOrdinalParse: /\d{1,2}日/,
        ordinal: function(number, period) {
            switch (period) {
              case "d":
              case "D":
              case "DDD":
                return number + "日";

              default:
                return number;
            }
        },
        relativeTime: {
            future: "%s後",
            past: "%s前",
            s: "数秒",
            m: "1分",
            mm: "%d分",
            h: "1時間",
            hh: "%d時間",
            d: "1日",
            dd: "%d日",
            M: "1ヶ月",
            MM: "%dヶ月",
            y: "1年",
            yy: "%d年"
        }
    }), hooks.defineLocale("jv", {
        months: "Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember".split("_"),
        monthsShort: "Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des".split("_"),
        weekdays: "Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu".split("_"),
        weekdaysShort: "Min_Sen_Sel_Reb_Kem_Jem_Sep".split("_"),
        weekdaysMin: "Mg_Sn_Sl_Rb_Km_Jm_Sp".split("_"),
        longDateFormat: {
            LT: "HH.mm",
            LTS: "HH.mm.ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY [pukul] HH.mm",
            LLLL: "dddd, D MMMM YYYY [pukul] HH.mm"
        },
        meridiemParse: /enjing|siyang|sonten|ndalu/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "enjing" === meridiem ? hour : "siyang" === meridiem ? 11 <= hour ? hour : hour + 12 : "sonten" === meridiem || "ndalu" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hours, minutes, isLower) {
            return hours < 11 ? "enjing" : hours < 15 ? "siyang" : hours < 19 ? "sonten" : "ndalu";
        },
        calendar: {
            sameDay: "[Dinten puniko pukul] LT",
            nextDay: "[Mbenjang pukul] LT",
            nextWeek: "dddd [pukul] LT",
            lastDay: "[Kala wingi pukul] LT",
            lastWeek: "dddd [kepengker pukul] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "wonten ing %s",
            past: "%s ingkang kepengker",
            s: "sawetawis detik",
            m: "setunggal menit",
            mm: "%d menit",
            h: "setunggal jam",
            hh: "%d jam",
            d: "sedinten",
            dd: "%d dinten",
            M: "sewulan",
            MM: "%d wulan",
            y: "setaun",
            yy: "%d taun"
        },
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("ka", {
        months: {
            standalone: "იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი".split("_"),
            format: "იანვარს_თებერვალს_მარტს_აპრილის_მაისს_ივნისს_ივლისს_აგვისტს_სექტემბერს_ოქტომბერს_ნოემბერს_დეკემბერს".split("_")
        },
        monthsShort: "იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ".split("_"),
        weekdays: {
            standalone: "კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი".split("_"),
            format: "კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს".split("_"),
            isFormat: /(წინა|შემდეგ)/
        },
        weekdaysShort: "კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ".split("_"),
        weekdaysMin: "კვ_ორ_სა_ოთ_ხუ_პა_შა".split("_"),
        longDateFormat: {
            LT: "h:mm A",
            LTS: "h:mm:ss A",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY h:mm A",
            LLLL: "dddd, D MMMM YYYY h:mm A"
        },
        calendar: {
            sameDay: "[დღეს] LT[-ზე]",
            nextDay: "[ხვალ] LT[-ზე]",
            lastDay: "[გუშინ] LT[-ზე]",
            nextWeek: "[შემდეგ] dddd LT[-ზე]",
            lastWeek: "[წინა] dddd LT-ზე",
            sameElse: "L"
        },
        relativeTime: {
            future: function(s) {
                return /(წამი|წუთი|საათი|წელი)/.test(s) ? s.replace(/ი$/, "ში") : s + "ში";
            },
            past: function(s) {
                return /(წამი|წუთი|საათი|დღე|თვე)/.test(s) ? s.replace(/(ი|ე)$/, "ის უკან") : /წელი/.test(s) ? s.replace(/წელი$/, "წლის უკან") : void 0;
            },
            s: "რამდენიმე წამი",
            m: "წუთი",
            mm: "%d წუთი",
            h: "საათი",
            hh: "%d საათი",
            d: "დღე",
            dd: "%d დღე",
            M: "თვე",
            MM: "%d თვე",
            y: "წელი",
            yy: "%d წელი"
        },
        dayOfMonthOrdinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,
        ordinal: function(number) {
            return 0 === number ? number : 1 === number ? number + "-ლი" : number < 20 || number <= 100 && number % 20 == 0 || number % 100 == 0 ? "მე-" + number : number + "-ე";
        },
        week: {
            dow: 1,
            doy: 7
        }
    });
    var suffixes$1 = {
        0: "-ші",
        1: "-ші",
        2: "-ші",
        3: "-ші",
        4: "-ші",
        5: "-ші",
        6: "-шы",
        7: "-ші",
        8: "-ші",
        9: "-шы",
        10: "-шы",
        20: "-шы",
        30: "-шы",
        40: "-шы",
        50: "-ші",
        60: "-шы",
        70: "-ші",
        80: "-ші",
        90: "-шы",
        100: "-ші"
    };
    hooks.defineLocale("kk", {
        months: "қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан".split("_"),
        monthsShort: "қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел".split("_"),
        weekdays: "жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі".split("_"),
        weekdaysShort: "жек_дүй_сей_сәр_бей_жұм_сен".split("_"),
        weekdaysMin: "жк_дй_сй_ср_бй_жм_сн".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Бүгін сағат] LT",
            nextDay: "[Ертең сағат] LT",
            nextWeek: "dddd [сағат] LT",
            lastDay: "[Кеше сағат] LT",
            lastWeek: "[Өткен аптаның] dddd [сағат] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s ішінде",
            past: "%s бұрын",
            s: "бірнеше секунд",
            m: "бір минут",
            mm: "%d минут",
            h: "бір сағат",
            hh: "%d сағат",
            d: "бір күн",
            dd: "%d күн",
            M: "бір ай",
            MM: "%d ай",
            y: "бір жыл",
            yy: "%d жыл"
        },
        dayOfMonthOrdinalParse: /\d{1,2}-(ші|шы)/,
        ordinal: function(number) {
            return number + (suffixes$1[number] || suffixes$1[number % 10] || suffixes$1[100 <= number ? 100 : null]);
        },
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("km", {
        months: "មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),
        monthsShort: "មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ".split("_"),
        weekdays: "អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),
        weekdaysShort: "អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),
        weekdaysMin: "អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[ថ្ងៃនេះ ម៉ោង] LT",
            nextDay: "[ស្អែក ម៉ោង] LT",
            nextWeek: "dddd [ម៉ោង] LT",
            lastDay: "[ម្សិលមិញ ម៉ោង] LT",
            lastWeek: "dddd [សប្តាហ៍មុន] [ម៉ោង] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%sទៀត",
            past: "%sមុន",
            s: "ប៉ុន្មានវិនាទី",
            m: "មួយនាទី",
            mm: "%d នាទី",
            h: "មួយម៉ោង",
            hh: "%d ម៉ោង",
            d: "មួយថ្ងៃ",
            dd: "%d ថ្ងៃ",
            M: "មួយខែ",
            MM: "%d ខែ",
            y: "មួយឆ្នាំ",
            yy: "%d ឆ្នាំ"
        },
        week: {
            dow: 1,
            doy: 4
        }
    });
    var symbolMap$7 = {
        1: "೧",
        2: "೨",
        3: "೩",
        4: "೪",
        5: "೫",
        6: "೬",
        7: "೭",
        8: "೮",
        9: "೯",
        0: "೦"
    }, numberMap$6 = {
        "೧": "1",
        "೨": "2",
        "೩": "3",
        "೪": "4",
        "೫": "5",
        "೬": "6",
        "೭": "7",
        "೮": "8",
        "೯": "9",
        "೦": "0"
    };
    hooks.defineLocale("kn", {
        months: "ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್".split("_"),
        monthsShort: "ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬ_ಅಕ್ಟೋಬ_ನವೆಂಬ_ಡಿಸೆಂಬ".split("_"),
        monthsParseExact: !0,
        weekdays: "ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ".split("_"),
        weekdaysShort: "ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ".split("_"),
        weekdaysMin: "ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ".split("_"),
        longDateFormat: {
            LT: "A h:mm",
            LTS: "A h:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY, A h:mm",
            LLLL: "dddd, D MMMM YYYY, A h:mm"
        },
        calendar: {
            sameDay: "[ಇಂದು] LT",
            nextDay: "[ನಾಳೆ] LT",
            nextWeek: "dddd, LT",
            lastDay: "[ನಿನ್ನೆ] LT",
            lastWeek: "[ಕೊನೆಯ] dddd, LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s ನಂತರ",
            past: "%s ಹಿಂದೆ",
            s: "ಕೆಲವು ಕ್ಷಣಗಳು",
            m: "ಒಂದು ನಿಮಿಷ",
            mm: "%d ನಿಮಿಷ",
            h: "ಒಂದು ಗಂಟೆ",
            hh: "%d ಗಂಟೆ",
            d: "ಒಂದು ದಿನ",
            dd: "%d ದಿನ",
            M: "ಒಂದು ತಿಂಗಳು",
            MM: "%d ತಿಂಗಳು",
            y: "ಒಂದು ವರ್ಷ",
            yy: "%d ವರ್ಷ"
        },
        preparse: function(string) {
            return string.replace(/[೧೨೩೪೫೬೭೮೯೦]/g, function(match) {
                return numberMap$6[match];
            });
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap$7[match];
            });
        },
        meridiemParse: /ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "ರಾತ್ರಿ" === meridiem ? hour < 4 ? hour : hour + 12 : "ಬೆಳಿಗ್ಗೆ" === meridiem ? hour : "ಮಧ್ಯಾಹ್ನ" === meridiem ? 10 <= hour ? hour : hour + 12 : "ಸಂಜೆ" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "ರಾತ್ರಿ" : hour < 10 ? "ಬೆಳಿಗ್ಗೆ" : hour < 17 ? "ಮಧ್ಯಾಹ್ನ" : hour < 20 ? "ಸಂಜೆ" : "ರಾತ್ರಿ";
        },
        dayOfMonthOrdinalParse: /\d{1,2}(ನೇ)/,
        ordinal: function(number) {
            return number + "ನೇ";
        },
        week: {
            dow: 0,
            doy: 6
        }
    }), hooks.defineLocale("ko", {
        months: "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),
        monthsShort: "1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월".split("_"),
        weekdays: "일요일_월요일_화요일_수요일_목요일_금요일_토요일".split("_"),
        weekdaysShort: "일_월_화_수_목_금_토".split("_"),
        weekdaysMin: "일_월_화_수_목_금_토".split("_"),
        longDateFormat: {
            LT: "A h:mm",
            LTS: "A h:mm:ss",
            L: "YYYY.MM.DD",
            LL: "YYYY년 MMMM D일",
            LLL: "YYYY년 MMMM D일 A h:mm",
            LLLL: "YYYY년 MMMM D일 dddd A h:mm",
            l: "YYYY.MM.DD",
            ll: "YYYY년 MMMM D일",
            lll: "YYYY년 MMMM D일 A h:mm",
            llll: "YYYY년 MMMM D일 dddd A h:mm"
        },
        calendar: {
            sameDay: "오늘 LT",
            nextDay: "내일 LT",
            nextWeek: "dddd LT",
            lastDay: "어제 LT",
            lastWeek: "지난주 dddd LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s 후",
            past: "%s 전",
            s: "몇 초",
            ss: "%d초",
            m: "1분",
            mm: "%d분",
            h: "한 시간",
            hh: "%d시간",
            d: "하루",
            dd: "%d일",
            M: "한 달",
            MM: "%d달",
            y: "일 년",
            yy: "%d년"
        },
        dayOfMonthOrdinalParse: /\d{1,2}일/,
        ordinal: "%d일",
        meridiemParse: /오전|오후/,
        isPM: function(token) {
            return "오후" === token;
        },
        meridiem: function(hour, minute, isUpper) {
            return hour < 12 ? "오전" : "오후";
        }
    });
    var suffixes$2 = {
        0: "-чү",
        1: "-чи",
        2: "-чи",
        3: "-чү",
        4: "-чү",
        5: "-чи",
        6: "-чы",
        7: "-чи",
        8: "-чи",
        9: "-чу",
        10: "-чу",
        20: "-чы",
        30: "-чу",
        40: "-чы",
        50: "-чү",
        60: "-чы",
        70: "-чи",
        80: "-чи",
        90: "-чу",
        100: "-чү"
    };
    function processRelativeTime$5(number, withoutSuffix, key, isFuture) {
        var format = {
            m: [ "eng Minutt", "enger Minutt" ],
            h: [ "eng Stonn", "enger Stonn" ],
            d: [ "een Dag", "engem Dag" ],
            M: [ "ee Mount", "engem Mount" ],
            y: [ "ee Joer", "engem Joer" ]
        };
        return withoutSuffix ? format[key][0] : format[key][1];
    }
    function eifelerRegelAppliesToNumber(number) {
        if (number = parseInt(number, 10), isNaN(number)) return !1;
        if (number < 0) return !0;
        if (number < 10) return 4 <= number && number <= 7;
        if (number < 100) {
            var lastDigit = number % 10;
            return eifelerRegelAppliesToNumber(0 === lastDigit ? number / 10 : lastDigit);
        }
        if (number < 1e4) {
            for (;10 <= number; ) number /= 10;
            return eifelerRegelAppliesToNumber(number);
        }
        return eifelerRegelAppliesToNumber(number /= 1e3);
    }
    hooks.defineLocale("ky", {
        months: "январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_"),
        monthsShort: "янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек".split("_"),
        weekdays: "Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби".split("_"),
        weekdaysShort: "Жек_Дүй_Шей_Шар_Бей_Жум_Ише".split("_"),
        weekdaysMin: "Жк_Дй_Шй_Шр_Бй_Жм_Иш".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Бүгүн саат] LT",
            nextDay: "[Эртең саат] LT",
            nextWeek: "dddd [саат] LT",
            lastDay: "[Кече саат] LT",
            lastWeek: "[Өткен аптанын] dddd [күнү] [саат] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s ичинде",
            past: "%s мурун",
            s: "бирнече секунд",
            m: "бир мүнөт",
            mm: "%d мүнөт",
            h: "бир саат",
            hh: "%d саат",
            d: "бир күн",
            dd: "%d күн",
            M: "бир ай",
            MM: "%d ай",
            y: "бир жыл",
            yy: "%d жыл"
        },
        dayOfMonthOrdinalParse: /\d{1,2}-(чи|чы|чү|чу)/,
        ordinal: function(number) {
            return number + (suffixes$2[number] || suffixes$2[number % 10] || suffixes$2[100 <= number ? 100 : null]);
        },
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("lb", {
        months: "Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember".split("_"),
        monthsShort: "Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.".split("_"),
        monthsParseExact: !0,
        weekdays: "Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg".split("_"),
        weekdaysShort: "So._Mé._Dë._Më._Do._Fr._Sa.".split("_"),
        weekdaysMin: "So_Mé_Dë_Më_Do_Fr_Sa".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "H:mm [Auer]",
            LTS: "H:mm:ss [Auer]",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY H:mm [Auer]",
            LLLL: "dddd, D. MMMM YYYY H:mm [Auer]"
        },
        calendar: {
            sameDay: "[Haut um] LT",
            sameElse: "L",
            nextDay: "[Muer um] LT",
            nextWeek: "dddd [um] LT",
            lastDay: "[Gëschter um] LT",
            lastWeek: function() {
                switch (this.day()) {
                  case 2:
                  case 4:
                    return "[Leschten] dddd [um] LT";

                  default:
                    return "[Leschte] dddd [um] LT";
                }
            }
        },
        relativeTime: {
            future: function(string) {
                return eifelerRegelAppliesToNumber(string.substr(0, string.indexOf(" "))) ? "a " + string : "an " + string;
            },
            past: function(string) {
                return eifelerRegelAppliesToNumber(string.substr(0, string.indexOf(" "))) ? "viru " + string : "virun " + string;
            },
            s: "e puer Sekonnen",
            m: processRelativeTime$5,
            mm: "%d Minutten",
            h: processRelativeTime$5,
            hh: "%d Stonnen",
            d: processRelativeTime$5,
            dd: "%d Deeg",
            M: processRelativeTime$5,
            MM: "%d Méint",
            y: processRelativeTime$5,
            yy: "%d Joer"
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("lo", {
        months: "ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),
        monthsShort: "ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ".split("_"),
        weekdays: "ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),
        weekdaysShort: "ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ".split("_"),
        weekdaysMin: "ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "ວັນdddd D MMMM YYYY HH:mm"
        },
        meridiemParse: /ຕອນເຊົ້າ|ຕອນແລງ/,
        isPM: function(input) {
            return "ຕອນແລງ" === input;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 12 ? "ຕອນເຊົ້າ" : "ຕອນແລງ";
        },
        calendar: {
            sameDay: "[ມື້ນີ້ເວລາ] LT",
            nextDay: "[ມື້ອື່ນເວລາ] LT",
            nextWeek: "[ວັນ]dddd[ໜ້າເວລາ] LT",
            lastDay: "[ມື້ວານນີ້ເວລາ] LT",
            lastWeek: "[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "ອີກ %s",
            past: "%sຜ່ານມາ",
            s: "ບໍ່ເທົ່າໃດວິນາທີ",
            m: "1 ນາທີ",
            mm: "%d ນາທີ",
            h: "1 ຊົ່ວໂມງ",
            hh: "%d ຊົ່ວໂມງ",
            d: "1 ມື້",
            dd: "%d ມື້",
            M: "1 ເດືອນ",
            MM: "%d ເດືອນ",
            y: "1 ປີ",
            yy: "%d ປີ"
        },
        dayOfMonthOrdinalParse: /(ທີ່)\d{1,2}/,
        ordinal: function(number) {
            return "ທີ່" + number;
        }
    });
    var units = {
        m: "minutė_minutės_minutę",
        mm: "minutės_minučių_minutes",
        h: "valanda_valandos_valandą",
        hh: "valandos_valandų_valandas",
        d: "diena_dienos_dieną",
        dd: "dienos_dienų_dienas",
        M: "mėnuo_mėnesio_mėnesį",
        MM: "mėnesiai_mėnesių_mėnesius",
        y: "metai_metų_metus",
        yy: "metai_metų_metus"
    };
    function translateSingular(number, withoutSuffix, key, isFuture) {
        return withoutSuffix ? forms(key)[0] : isFuture ? forms(key)[1] : forms(key)[2];
    }
    function special(number) {
        return number % 10 == 0 || 10 < number && number < 20;
    }
    function forms(key) {
        return units[key].split("_");
    }
    function translate$6(number, withoutSuffix, key, isFuture) {
        var result = number + " ";
        return 1 === number ? result + translateSingular(0, withoutSuffix, key[0], isFuture) : withoutSuffix ? result + (special(number) ? forms(key)[1] : forms(key)[0]) : isFuture ? result + forms(key)[1] : result + (special(number) ? forms(key)[1] : forms(key)[2]);
    }
    hooks.defineLocale("lt", {
        months: {
            format: "sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio".split("_"),
            standalone: "sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis".split("_"),
            isFormat: /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/
        },
        monthsShort: "sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd".split("_"),
        weekdays: {
            format: "sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį".split("_"),
            standalone: "sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis".split("_"),
            isFormat: /dddd HH:mm/
        },
        weekdaysShort: "Sek_Pir_Ant_Tre_Ket_Pen_Šeš".split("_"),
        weekdaysMin: "S_P_A_T_K_Pn_Š".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "YYYY-MM-DD",
            LL: "YYYY [m.] MMMM D [d.]",
            LLL: "YYYY [m.] MMMM D [d.], HH:mm [val.]",
            LLLL: "YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]",
            l: "YYYY-MM-DD",
            ll: "YYYY [m.] MMMM D [d.]",
            lll: "YYYY [m.] MMMM D [d.], HH:mm [val.]",
            llll: "YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]"
        },
        calendar: {
            sameDay: "[Šiandien] LT",
            nextDay: "[Rytoj] LT",
            nextWeek: "dddd LT",
            lastDay: "[Vakar] LT",
            lastWeek: "[Praėjusį] dddd LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "po %s",
            past: "prieš %s",
            s: function(number, withoutSuffix, key, isFuture) {
                return withoutSuffix ? "kelios sekundės" : isFuture ? "kelių sekundžių" : "kelias sekundes";
            },
            m: translateSingular,
            mm: translate$6,
            h: translateSingular,
            hh: translate$6,
            d: translateSingular,
            dd: translate$6,
            M: translateSingular,
            MM: translate$6,
            y: translateSingular,
            yy: translate$6
        },
        dayOfMonthOrdinalParse: /\d{1,2}-oji/,
        ordinal: function(number) {
            return number + "-oji";
        },
        week: {
            dow: 1,
            doy: 4
        }
    });
    var units$1 = {
        m: "minūtes_minūtēm_minūte_minūtes".split("_"),
        mm: "minūtes_minūtēm_minūte_minūtes".split("_"),
        h: "stundas_stundām_stunda_stundas".split("_"),
        hh: "stundas_stundām_stunda_stundas".split("_"),
        d: "dienas_dienām_diena_dienas".split("_"),
        dd: "dienas_dienām_diena_dienas".split("_"),
        M: "mēneša_mēnešiem_mēnesis_mēneši".split("_"),
        MM: "mēneša_mēnešiem_mēnesis_mēneši".split("_"),
        y: "gada_gadiem_gads_gadi".split("_"),
        yy: "gada_gadiem_gads_gadi".split("_")
    };
    function format$1(forms, number, withoutSuffix) {
        return withoutSuffix ? number % 10 == 1 && number % 100 != 11 ? forms[2] : forms[3] : number % 10 == 1 && number % 100 != 11 ? forms[0] : forms[1];
    }
    function relativeTimeWithPlural$1(number, withoutSuffix, key) {
        return number + " " + format$1(units$1[key], number, withoutSuffix);
    }
    function relativeTimeWithSingular(number, withoutSuffix, key) {
        return format$1(units$1[key], number, withoutSuffix);
    }
    hooks.defineLocale("lv", {
        months: "janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris".split("_"),
        monthsShort: "jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec".split("_"),
        weekdays: "svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena".split("_"),
        weekdaysShort: "Sv_P_O_T_C_Pk_S".split("_"),
        weekdaysMin: "Sv_P_O_T_C_Pk_S".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY.",
            LL: "YYYY. [gada] D. MMMM",
            LLL: "YYYY. [gada] D. MMMM, HH:mm",
            LLLL: "YYYY. [gada] D. MMMM, dddd, HH:mm"
        },
        calendar: {
            sameDay: "[Šodien pulksten] LT",
            nextDay: "[Rīt pulksten] LT",
            nextWeek: "dddd [pulksten] LT",
            lastDay: "[Vakar pulksten] LT",
            lastWeek: "[Pagājušā] dddd [pulksten] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "pēc %s",
            past: "pirms %s",
            s: function(number, withoutSuffix) {
                return withoutSuffix ? "dažas sekundes" : "dažām sekundēm";
            },
            m: relativeTimeWithSingular,
            mm: relativeTimeWithPlural$1,
            h: relativeTimeWithSingular,
            hh: relativeTimeWithPlural$1,
            d: relativeTimeWithSingular,
            dd: relativeTimeWithPlural$1,
            M: relativeTimeWithSingular,
            MM: relativeTimeWithPlural$1,
            y: relativeTimeWithSingular,
            yy: relativeTimeWithPlural$1
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    });
    var translator = {
        words: {
            m: [ "jedan minut", "jednog minuta" ],
            mm: [ "minut", "minuta", "minuta" ],
            h: [ "jedan sat", "jednog sata" ],
            hh: [ "sat", "sata", "sati" ],
            dd: [ "dan", "dana", "dana" ],
            MM: [ "mjesec", "mjeseca", "mjeseci" ],
            yy: [ "godina", "godine", "godina" ]
        },
        correctGrammaticalCase: function(number, wordKey) {
            return 1 === number ? wordKey[0] : 2 <= number && number <= 4 ? wordKey[1] : wordKey[2];
        },
        translate: function(number, withoutSuffix, key) {
            var wordKey = translator.words[key];
            return 1 === key.length ? withoutSuffix ? wordKey[0] : wordKey[1] : number + " " + translator.correctGrammaticalCase(number, wordKey);
        }
    };
    hooks.defineLocale("me", {
        months: "januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),
        monthsShort: "jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),
        monthsParseExact: !0,
        weekdays: "nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota".split("_"),
        weekdaysShort: "ned._pon._uto._sri._čet._pet._sub.".split("_"),
        weekdaysMin: "ne_po_ut_sr_če_pe_su".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY H:mm",
            LLLL: "dddd, D. MMMM YYYY H:mm"
        },
        calendar: {
            sameDay: "[danas u] LT",
            nextDay: "[sjutra u] LT",
            nextWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[u] [nedjelju] [u] LT";

                  case 3:
                    return "[u] [srijedu] [u] LT";

                  case 6:
                    return "[u] [subotu] [u] LT";

                  case 1:
                  case 2:
                  case 4:
                  case 5:
                    return "[u] dddd [u] LT";
                }
            },
            lastDay: "[juče u] LT",
            lastWeek: function() {
                return [ "[prošle] [nedjelje] [u] LT", "[prošlog] [ponedjeljka] [u] LT", "[prošlog] [utorka] [u] LT", "[prošle] [srijede] [u] LT", "[prošlog] [četvrtka] [u] LT", "[prošlog] [petka] [u] LT", "[prošle] [subote] [u] LT" ][this.day()];
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "za %s",
            past: "prije %s",
            s: "nekoliko sekundi",
            m: translator.translate,
            mm: translator.translate,
            h: translator.translate,
            hh: translator.translate,
            d: "dan",
            dd: translator.translate,
            M: "mjesec",
            MM: translator.translate,
            y: "godinu",
            yy: translator.translate
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("mi", {
        months: "Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea".split("_"),
        monthsShort: "Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki".split("_"),
        monthsRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,
        monthsStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,
        monthsShortRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,
        monthsShortStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i,
        weekdays: "Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei".split("_"),
        weekdaysShort: "Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),
        weekdaysMin: "Ta_Ma_Tū_We_Tāi_Pa_Hā".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY [i] HH:mm",
            LLLL: "dddd, D MMMM YYYY [i] HH:mm"
        },
        calendar: {
            sameDay: "[i teie mahana, i] LT",
            nextDay: "[apopo i] LT",
            nextWeek: "dddd [i] LT",
            lastDay: "[inanahi i] LT",
            lastWeek: "dddd [whakamutunga i] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "i roto i %s",
            past: "%s i mua",
            s: "te hēkona ruarua",
            m: "he meneti",
            mm: "%d meneti",
            h: "te haora",
            hh: "%d haora",
            d: "he ra",
            dd: "%d ra",
            M: "he marama",
            MM: "%d marama",
            y: "he tau",
            yy: "%d tau"
        },
        dayOfMonthOrdinalParse: /\d{1,2}º/,
        ordinal: "%dº",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("mk", {
        months: "јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември".split("_"),
        monthsShort: "јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек".split("_"),
        weekdays: "недела_понеделник_вторник_среда_четврток_петок_сабота".split("_"),
        weekdaysShort: "нед_пон_вто_сре_чет_пет_саб".split("_"),
        weekdaysMin: "нe_пo_вт_ср_че_пе_сa".split("_"),
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "D.MM.YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY H:mm",
            LLLL: "dddd, D MMMM YYYY H:mm"
        },
        calendar: {
            sameDay: "[Денес во] LT",
            nextDay: "[Утре во] LT",
            nextWeek: "[Во] dddd [во] LT",
            lastDay: "[Вчера во] LT",
            lastWeek: function() {
                switch (this.day()) {
                  case 0:
                  case 3:
                  case 6:
                    return "[Изминатата] dddd [во] LT";

                  case 1:
                  case 2:
                  case 4:
                  case 5:
                    return "[Изминатиот] dddd [во] LT";
                }
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "после %s",
            past: "пред %s",
            s: "неколку секунди",
            m: "минута",
            mm: "%d минути",
            h: "час",
            hh: "%d часа",
            d: "ден",
            dd: "%d дена",
            M: "месец",
            MM: "%d месеци",
            y: "година",
            yy: "%d години"
        },
        dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/,
        ordinal: function(number) {
            var lastDigit = number % 10, last2Digits = number % 100;
            return 0 === number ? number + "-ев" : 0 === last2Digits ? number + "-ен" : 10 < last2Digits && last2Digits < 20 ? number + "-ти" : 1 === lastDigit ? number + "-ви" : 2 === lastDigit ? number + "-ри" : 7 === lastDigit || 8 === lastDigit ? number + "-ми" : number + "-ти";
        },
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("ml", {
        months: "ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ".split("_"),
        monthsShort: "ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.".split("_"),
        monthsParseExact: !0,
        weekdays: "ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച".split("_"),
        weekdaysShort: "ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി".split("_"),
        weekdaysMin: "ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ".split("_"),
        longDateFormat: {
            LT: "A h:mm -നു",
            LTS: "A h:mm:ss -നു",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY, A h:mm -നു",
            LLLL: "dddd, D MMMM YYYY, A h:mm -നു"
        },
        calendar: {
            sameDay: "[ഇന്ന്] LT",
            nextDay: "[നാളെ] LT",
            nextWeek: "dddd, LT",
            lastDay: "[ഇന്നലെ] LT",
            lastWeek: "[കഴിഞ്ഞ] dddd, LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s കഴിഞ്ഞ്",
            past: "%s മുൻപ്",
            s: "അൽപ നിമിഷങ്ങൾ",
            m: "ഒരു മിനിറ്റ്",
            mm: "%d മിനിറ്റ്",
            h: "ഒരു മണിക്കൂർ",
            hh: "%d മണിക്കൂർ",
            d: "ഒരു ദിവസം",
            dd: "%d ദിവസം",
            M: "ഒരു മാസം",
            MM: "%d മാസം",
            y: "ഒരു വർഷം",
            yy: "%d വർഷം"
        },
        meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "രാത്രി" === meridiem && 4 <= hour || "ഉച്ച കഴിഞ്ഞ്" === meridiem || "വൈകുന്നേരം" === meridiem ? hour + 12 : hour;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "രാത്രി" : hour < 12 ? "രാവിലെ" : hour < 17 ? "ഉച്ച കഴിഞ്ഞ്" : hour < 20 ? "വൈകുന്നേരം" : "രാത്രി";
        }
    });
    var symbolMap$8 = {
        1: "१",
        2: "२",
        3: "३",
        4: "४",
        5: "५",
        6: "६",
        7: "७",
        8: "८",
        9: "९",
        0: "०"
    }, numberMap$7 = {
        "१": "1",
        "२": "2",
        "३": "3",
        "४": "4",
        "५": "5",
        "६": "6",
        "७": "7",
        "८": "8",
        "९": "9",
        "०": "0"
    };
    function relativeTimeMr(number, withoutSuffix, string, isFuture) {
        var output = "";
        if (withoutSuffix) switch (string) {
          case "s":
            output = "काही सेकंद";
            break;

          case "m":
            output = "एक मिनिट";
            break;

          case "mm":
            output = "%d मिनिटे";
            break;

          case "h":
            output = "एक तास";
            break;

          case "hh":
            output = "%d तास";
            break;

          case "d":
            output = "एक दिवस";
            break;

          case "dd":
            output = "%d दिवस";
            break;

          case "M":
            output = "एक महिना";
            break;

          case "MM":
            output = "%d महिने";
            break;

          case "y":
            output = "एक वर्ष";
            break;

          case "yy":
            output = "%d वर्षे";
        } else switch (string) {
          case "s":
            output = "काही सेकंदां";
            break;

          case "m":
            output = "एका मिनिटा";
            break;

          case "mm":
            output = "%d मिनिटां";
            break;

          case "h":
            output = "एका तासा";
            break;

          case "hh":
            output = "%d तासां";
            break;

          case "d":
            output = "एका दिवसा";
            break;

          case "dd":
            output = "%d दिवसां";
            break;

          case "M":
            output = "एका महिन्या";
            break;

          case "MM":
            output = "%d महिन्यां";
            break;

          case "y":
            output = "एका वर्षा";
            break;

          case "yy":
            output = "%d वर्षां";
        }
        return output.replace(/%d/i, number);
    }
    hooks.defineLocale("mr", {
        months: "जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),
        monthsShort: "जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),
        monthsParseExact: !0,
        weekdays: "रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),
        weekdaysShort: "रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि".split("_"),
        weekdaysMin: "र_सो_मं_बु_गु_शु_श".split("_"),
        longDateFormat: {
            LT: "A h:mm वाजता",
            LTS: "A h:mm:ss वाजता",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY, A h:mm वाजता",
            LLLL: "dddd, D MMMM YYYY, A h:mm वाजता"
        },
        calendar: {
            sameDay: "[आज] LT",
            nextDay: "[उद्या] LT",
            nextWeek: "dddd, LT",
            lastDay: "[काल] LT",
            lastWeek: "[मागील] dddd, LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%sमध्ये",
            past: "%sपूर्वी",
            s: relativeTimeMr,
            m: relativeTimeMr,
            mm: relativeTimeMr,
            h: relativeTimeMr,
            hh: relativeTimeMr,
            d: relativeTimeMr,
            dd: relativeTimeMr,
            M: relativeTimeMr,
            MM: relativeTimeMr,
            y: relativeTimeMr,
            yy: relativeTimeMr
        },
        preparse: function(string) {
            return string.replace(/[१२३४५६७८९०]/g, function(match) {
                return numberMap$7[match];
            });
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap$8[match];
            });
        },
        meridiemParse: /रात्री|सकाळी|दुपारी|सायंकाळी/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "रात्री" === meridiem ? hour < 4 ? hour : hour + 12 : "सकाळी" === meridiem ? hour : "दुपारी" === meridiem ? 10 <= hour ? hour : hour + 12 : "सायंकाळी" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "रात्री" : hour < 10 ? "सकाळी" : hour < 17 ? "दुपारी" : hour < 20 ? "सायंकाळी" : "रात्री";
        },
        week: {
            dow: 0,
            doy: 6
        }
    }), hooks.defineLocale("ms-my", {
        months: "Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),
        monthsShort: "Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),
        weekdays: "Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),
        weekdaysShort: "Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),
        weekdaysMin: "Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),
        longDateFormat: {
            LT: "HH.mm",
            LTS: "HH.mm.ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY [pukul] HH.mm",
            LLLL: "dddd, D MMMM YYYY [pukul] HH.mm"
        },
        meridiemParse: /pagi|tengahari|petang|malam/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "pagi" === meridiem ? hour : "tengahari" === meridiem ? 11 <= hour ? hour : hour + 12 : "petang" === meridiem || "malam" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hours, minutes, isLower) {
            return hours < 11 ? "pagi" : hours < 15 ? "tengahari" : hours < 19 ? "petang" : "malam";
        },
        calendar: {
            sameDay: "[Hari ini pukul] LT",
            nextDay: "[Esok pukul] LT",
            nextWeek: "dddd [pukul] LT",
            lastDay: "[Kelmarin pukul] LT",
            lastWeek: "dddd [lepas pukul] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "dalam %s",
            past: "%s yang lepas",
            s: "beberapa saat",
            m: "seminit",
            mm: "%d minit",
            h: "sejam",
            hh: "%d jam",
            d: "sehari",
            dd: "%d hari",
            M: "sebulan",
            MM: "%d bulan",
            y: "setahun",
            yy: "%d tahun"
        },
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("ms", {
        months: "Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember".split("_"),
        monthsShort: "Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis".split("_"),
        weekdays: "Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu".split("_"),
        weekdaysShort: "Ahd_Isn_Sel_Rab_Kha_Jum_Sab".split("_"),
        weekdaysMin: "Ah_Is_Sl_Rb_Km_Jm_Sb".split("_"),
        longDateFormat: {
            LT: "HH.mm",
            LTS: "HH.mm.ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY [pukul] HH.mm",
            LLLL: "dddd, D MMMM YYYY [pukul] HH.mm"
        },
        meridiemParse: /pagi|tengahari|petang|malam/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "pagi" === meridiem ? hour : "tengahari" === meridiem ? 11 <= hour ? hour : hour + 12 : "petang" === meridiem || "malam" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hours, minutes, isLower) {
            return hours < 11 ? "pagi" : hours < 15 ? "tengahari" : hours < 19 ? "petang" : "malam";
        },
        calendar: {
            sameDay: "[Hari ini pukul] LT",
            nextDay: "[Esok pukul] LT",
            nextWeek: "dddd [pukul] LT",
            lastDay: "[Kelmarin pukul] LT",
            lastWeek: "dddd [lepas pukul] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "dalam %s",
            past: "%s yang lepas",
            s: "beberapa saat",
            m: "seminit",
            mm: "%d minit",
            h: "sejam",
            hh: "%d jam",
            d: "sehari",
            dd: "%d hari",
            M: "sebulan",
            MM: "%d bulan",
            y: "setahun",
            yy: "%d tahun"
        },
        week: {
            dow: 1,
            doy: 7
        }
    });
    var symbolMap$9 = {
        1: "၁",
        2: "၂",
        3: "၃",
        4: "၄",
        5: "၅",
        6: "၆",
        7: "၇",
        8: "၈",
        9: "၉",
        0: "၀"
    }, numberMap$8 = {
        "၁": "1",
        "၂": "2",
        "၃": "3",
        "၄": "4",
        "၅": "5",
        "၆": "6",
        "၇": "7",
        "၈": "8",
        "၉": "9",
        "၀": "0"
    };
    hooks.defineLocale("my", {
        months: "ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ".split("_"),
        monthsShort: "ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ".split("_"),
        weekdays: "တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ".split("_"),
        weekdaysShort: "နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),
        weekdaysMin: "နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[ယနေ.] LT [မှာ]",
            nextDay: "[မနက်ဖြန်] LT [မှာ]",
            nextWeek: "dddd LT [မှာ]",
            lastDay: "[မနေ.က] LT [မှာ]",
            lastWeek: "[ပြီးခဲ့သော] dddd LT [မှာ]",
            sameElse: "L"
        },
        relativeTime: {
            future: "လာမည့် %s မှာ",
            past: "လွန်ခဲ့သော %s က",
            s: "စက္ကန်.အနည်းငယ်",
            m: "တစ်မိနစ်",
            mm: "%d မိနစ်",
            h: "တစ်နာရီ",
            hh: "%d နာရီ",
            d: "တစ်ရက်",
            dd: "%d ရက်",
            M: "တစ်လ",
            MM: "%d လ",
            y: "တစ်နှစ်",
            yy: "%d နှစ်"
        },
        preparse: function(string) {
            return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function(match) {
                return numberMap$8[match];
            });
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap$9[match];
            });
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("nb", {
        months: "januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),
        monthsShort: "jan._feb._mars_april_mai_juni_juli_aug._sep._okt._nov._des.".split("_"),
        monthsParseExact: !0,
        weekdays: "søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag".split("_"),
        weekdaysShort: "sø._ma._ti._on._to._fr._lø.".split("_"),
        weekdaysMin: "sø_ma_ti_on_to_fr_lø".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY [kl.] HH:mm",
            LLLL: "dddd D. MMMM YYYY [kl.] HH:mm"
        },
        calendar: {
            sameDay: "[i dag kl.] LT",
            nextDay: "[i morgen kl.] LT",
            nextWeek: "dddd [kl.] LT",
            lastDay: "[i går kl.] LT",
            lastWeek: "[forrige] dddd [kl.] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "om %s",
            past: "%s siden",
            s: "noen sekunder",
            m: "ett minutt",
            mm: "%d minutter",
            h: "en time",
            hh: "%d timer",
            d: "en dag",
            dd: "%d dager",
            M: "en måned",
            MM: "%d måneder",
            y: "ett år",
            yy: "%d år"
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    });
    var symbolMap$10 = {
        1: "१",
        2: "२",
        3: "३",
        4: "४",
        5: "५",
        6: "६",
        7: "७",
        8: "८",
        9: "९",
        0: "०"
    }, numberMap$9 = {
        "१": "1",
        "२": "2",
        "३": "3",
        "४": "4",
        "५": "5",
        "६": "6",
        "७": "7",
        "८": "8",
        "९": "9",
        "०": "0"
    };
    hooks.defineLocale("ne", {
        months: "जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर".split("_"),
        monthsShort: "जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.".split("_"),
        monthsParseExact: !0,
        weekdays: "आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार".split("_"),
        weekdaysShort: "आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.".split("_"),
        weekdaysMin: "आ._सो._मं._बु._बि._शु._श.".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "Aको h:mm बजे",
            LTS: "Aको h:mm:ss बजे",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY, Aको h:mm बजे",
            LLLL: "dddd, D MMMM YYYY, Aको h:mm बजे"
        },
        preparse: function(string) {
            return string.replace(/[१२३४५६७८९०]/g, function(match) {
                return numberMap$9[match];
            });
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap$10[match];
            });
        },
        meridiemParse: /राति|बिहान|दिउँसो|साँझ/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "राति" === meridiem ? hour < 4 ? hour : hour + 12 : "बिहान" === meridiem ? hour : "दिउँसो" === meridiem ? 10 <= hour ? hour : hour + 12 : "साँझ" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 3 ? "राति" : hour < 12 ? "बिहान" : hour < 16 ? "दिउँसो" : hour < 20 ? "साँझ" : "राति";
        },
        calendar: {
            sameDay: "[आज] LT",
            nextDay: "[भोलि] LT",
            nextWeek: "[आउँदो] dddd[,] LT",
            lastDay: "[हिजो] LT",
            lastWeek: "[गएको] dddd[,] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%sमा",
            past: "%s अगाडि",
            s: "केही क्षण",
            m: "एक मिनेट",
            mm: "%d मिनेट",
            h: "एक घण्टा",
            hh: "%d घण्टा",
            d: "एक दिन",
            dd: "%d दिन",
            M: "एक महिना",
            MM: "%d महिना",
            y: "एक बर्ष",
            yy: "%d बर्ष"
        },
        week: {
            dow: 0,
            doy: 6
        }
    });
    var monthsShortWithDots$1 = "jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"), monthsShortWithoutDots$1 = "jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"), monthsParse = [ /^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i ], monthsRegex$1 = /^(januari|februari|maart|april|mei|april|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
    hooks.defineLocale("nl-be", {
        months: "januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),
        monthsShort: function(m, format) {
            return m ? /-MMM-/.test(format) ? monthsShortWithoutDots$1[m.month()] : monthsShortWithDots$1[m.month()] : monthsShortWithDots$1;
        },
        monthsRegex: monthsRegex$1,
        monthsShortRegex: monthsRegex$1,
        monthsStrictRegex: /^(januari|februari|maart|mei|ju[nl]i|april|augustus|september|oktober|november|december)/i,
        monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,
        monthsParse: monthsParse,
        longMonthsParse: monthsParse,
        shortMonthsParse: monthsParse,
        weekdays: "zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),
        weekdaysShort: "zo._ma._di._wo._do._vr._za.".split("_"),
        weekdaysMin: "Zo_Ma_Di_Wo_Do_Vr_Za".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[vandaag om] LT",
            nextDay: "[morgen om] LT",
            nextWeek: "dddd [om] LT",
            lastDay: "[gisteren om] LT",
            lastWeek: "[afgelopen] dddd [om] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "over %s",
            past: "%s geleden",
            s: "een paar seconden",
            m: "één minuut",
            mm: "%d minuten",
            h: "één uur",
            hh: "%d uur",
            d: "één dag",
            dd: "%d dagen",
            M: "één maand",
            MM: "%d maanden",
            y: "één jaar",
            yy: "%d jaar"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
        ordinal: function(number) {
            return number + (1 === number || 8 === number || 20 <= number ? "ste" : "de");
        },
        week: {
            dow: 1,
            doy: 4
        }
    });
    var monthsShortWithDots$2 = "jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.".split("_"), monthsShortWithoutDots$2 = "jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec".split("_"), monthsParse$1 = [ /^jan/i, /^feb/i, /^maart|mrt.?$/i, /^apr/i, /^mei$/i, /^jun[i.]?$/i, /^jul[i.]?$/i, /^aug/i, /^sep/i, /^okt/i, /^nov/i, /^dec/i ], monthsRegex$2 = /^(januari|februari|maart|april|mei|april|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
    hooks.defineLocale("nl", {
        months: "januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december".split("_"),
        monthsShort: function(m, format) {
            return m ? /-MMM-/.test(format) ? monthsShortWithoutDots$2[m.month()] : monthsShortWithDots$2[m.month()] : monthsShortWithDots$2;
        },
        monthsRegex: monthsRegex$2,
        monthsShortRegex: monthsRegex$2,
        monthsStrictRegex: /^(januari|februari|maart|mei|ju[nl]i|april|augustus|september|oktober|november|december)/i,
        monthsShortStrictRegex: /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,
        monthsParse: monthsParse$1,
        longMonthsParse: monthsParse$1,
        shortMonthsParse: monthsParse$1,
        weekdays: "zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag".split("_"),
        weekdaysShort: "zo._ma._di._wo._do._vr._za.".split("_"),
        weekdaysMin: "Zo_Ma_Di_Wo_Do_Vr_Za".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD-MM-YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[vandaag om] LT",
            nextDay: "[morgen om] LT",
            nextWeek: "dddd [om] LT",
            lastDay: "[gisteren om] LT",
            lastWeek: "[afgelopen] dddd [om] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "over %s",
            past: "%s geleden",
            s: "een paar seconden",
            m: "één minuut",
            mm: "%d minuten",
            h: "één uur",
            hh: "%d uur",
            d: "één dag",
            dd: "%d dagen",
            M: "één maand",
            MM: "%d maanden",
            y: "één jaar",
            yy: "%d jaar"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
        ordinal: function(number) {
            return number + (1 === number || 8 === number || 20 <= number ? "ste" : "de");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("nn", {
        months: "januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember".split("_"),
        monthsShort: "jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des".split("_"),
        weekdays: "sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag".split("_"),
        weekdaysShort: "sun_mån_tys_ons_tor_fre_lau".split("_"),
        weekdaysMin: "su_må_ty_on_to_fr_lø".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY [kl.] H:mm",
            LLLL: "dddd D. MMMM YYYY [kl.] HH:mm"
        },
        calendar: {
            sameDay: "[I dag klokka] LT",
            nextDay: "[I morgon klokka] LT",
            nextWeek: "dddd [klokka] LT",
            lastDay: "[I går klokka] LT",
            lastWeek: "[Føregåande] dddd [klokka] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "om %s",
            past: "%s sidan",
            s: "nokre sekund",
            m: "eit minutt",
            mm: "%d minutt",
            h: "ein time",
            hh: "%d timar",
            d: "ein dag",
            dd: "%d dagar",
            M: "ein månad",
            MM: "%d månader",
            y: "eit år",
            yy: "%d år"
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    });
    var symbolMap$11 = {
        1: "੧",
        2: "੨",
        3: "੩",
        4: "੪",
        5: "੫",
        6: "੬",
        7: "੭",
        8: "੮",
        9: "੯",
        0: "੦"
    }, numberMap$10 = {
        "੧": "1",
        "੨": "2",
        "੩": "3",
        "੪": "4",
        "੫": "5",
        "੬": "6",
        "੭": "7",
        "੮": "8",
        "੯": "9",
        "੦": "0"
    };
    hooks.defineLocale("pa-in", {
        months: "ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),
        monthsShort: "ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ".split("_"),
        weekdays: "ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ".split("_"),
        weekdaysShort: "ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),
        weekdaysMin: "ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ".split("_"),
        longDateFormat: {
            LT: "A h:mm ਵਜੇ",
            LTS: "A h:mm:ss ਵਜੇ",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY, A h:mm ਵਜੇ",
            LLLL: "dddd, D MMMM YYYY, A h:mm ਵਜੇ"
        },
        calendar: {
            sameDay: "[ਅਜ] LT",
            nextDay: "[ਕਲ] LT",
            nextWeek: "dddd, LT",
            lastDay: "[ਕਲ] LT",
            lastWeek: "[ਪਿਛਲੇ] dddd, LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s ਵਿੱਚ",
            past: "%s ਪਿਛਲੇ",
            s: "ਕੁਝ ਸਕਿੰਟ",
            m: "ਇਕ ਮਿੰਟ",
            mm: "%d ਮਿੰਟ",
            h: "ਇੱਕ ਘੰਟਾ",
            hh: "%d ਘੰਟੇ",
            d: "ਇੱਕ ਦਿਨ",
            dd: "%d ਦਿਨ",
            M: "ਇੱਕ ਮਹੀਨਾ",
            MM: "%d ਮਹੀਨੇ",
            y: "ਇੱਕ ਸਾਲ",
            yy: "%d ਸਾਲ"
        },
        preparse: function(string) {
            return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function(match) {
                return numberMap$10[match];
            });
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap$11[match];
            });
        },
        meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "ਰਾਤ" === meridiem ? hour < 4 ? hour : hour + 12 : "ਸਵੇਰ" === meridiem ? hour : "ਦੁਪਹਿਰ" === meridiem ? 10 <= hour ? hour : hour + 12 : "ਸ਼ਾਮ" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "ਰਾਤ" : hour < 10 ? "ਸਵੇਰ" : hour < 17 ? "ਦੁਪਹਿਰ" : hour < 20 ? "ਸ਼ਾਮ" : "ਰਾਤ";
        },
        week: {
            dow: 0,
            doy: 6
        }
    });
    var monthsNominative = "styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień".split("_"), monthsSubjective = "stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia".split("_");
    function plural$3(n) {
        return n % 10 < 5 && 1 < n % 10 && ~~(n / 10) % 10 != 1;
    }
    function translate$7(number, withoutSuffix, key) {
        var result = number + " ";
        switch (key) {
          case "m":
            return withoutSuffix ? "minuta" : "minutę";

          case "mm":
            return result + (plural$3(number) ? "minuty" : "minut");

          case "h":
            return withoutSuffix ? "godzina" : "godzinę";

          case "hh":
            return result + (plural$3(number) ? "godziny" : "godzin");

          case "MM":
            return result + (plural$3(number) ? "miesiące" : "miesięcy");

          case "yy":
            return result + (plural$3(number) ? "lata" : "lat");
        }
    }
    function relativeTimeWithPlural$2(number, withoutSuffix, key) {
        var separator = " ";
        return (20 <= number % 100 || 100 <= number && number % 100 == 0) && (separator = " de "), 
        number + separator + {
            mm: "minute",
            hh: "ore",
            dd: "zile",
            MM: "luni",
            yy: "ani"
        }[key];
    }
    function relativeTimeWithPlural$3(number, withoutSuffix, key) {
        var num, forms;
        return "m" === key ? withoutSuffix ? "минута" : "минуту" : number + " " + (num = +number, 
        forms = {
            mm: withoutSuffix ? "минута_минуты_минут" : "минуту_минуты_минут",
            hh: "час_часа_часов",
            dd: "день_дня_дней",
            MM: "месяц_месяца_месяцев",
            yy: "год_года_лет"
        }[key].split("_"), num % 10 == 1 && num % 100 != 11 ? forms[0] : 2 <= num % 10 && num % 10 <= 4 && (num % 100 < 10 || 20 <= num % 100) ? forms[1] : forms[2]);
    }
    hooks.defineLocale("pl", {
        months: function(momentToFormat, format) {
            return momentToFormat ? "" === format ? "(" + monthsSubjective[momentToFormat.month()] + "|" + monthsNominative[momentToFormat.month()] + ")" : /D MMMM/.test(format) ? monthsSubjective[momentToFormat.month()] : monthsNominative[momentToFormat.month()] : monthsNominative;
        },
        monthsShort: "sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru".split("_"),
        weekdays: "niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota".split("_"),
        weekdaysShort: "ndz_pon_wt_śr_czw_pt_sob".split("_"),
        weekdaysMin: "Nd_Pn_Wt_Śr_Cz_Pt_So".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Dziś o] LT",
            nextDay: "[Jutro o] LT",
            nextWeek: "[W] dddd [o] LT",
            lastDay: "[Wczoraj o] LT",
            lastWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[W zeszłą niedzielę o] LT";

                  case 3:
                    return "[W zeszłą środę o] LT";

                  case 6:
                    return "[W zeszłą sobotę o] LT";

                  default:
                    return "[W zeszły] dddd [o] LT";
                }
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "za %s",
            past: "%s temu",
            s: "kilka sekund",
            m: translate$7,
            mm: translate$7,
            h: translate$7,
            hh: translate$7,
            d: "1 dzień",
            dd: "%d dni",
            M: "miesiąc",
            MM: translate$7,
            y: "rok",
            yy: translate$7
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("pt-br", {
        months: "Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),
        monthsShort: "Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),
        weekdays: "Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado".split("_"),
        weekdaysShort: "Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),
        weekdaysMin: "Do_2ª_3ª_4ª_5ª_6ª_Sá".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D [de] MMMM [de] YYYY",
            LLL: "D [de] MMMM [de] YYYY [às] HH:mm",
            LLLL: "dddd, D [de] MMMM [de] YYYY [às] HH:mm"
        },
        calendar: {
            sameDay: "[Hoje às] LT",
            nextDay: "[Amanhã às] LT",
            nextWeek: "dddd [às] LT",
            lastDay: "[Ontem às] LT",
            lastWeek: function() {
                return 0 === this.day() || 6 === this.day() ? "[Último] dddd [às] LT" : "[Última] dddd [às] LT";
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "em %s",
            past: "%s atrás",
            s: "poucos segundos",
            m: "um minuto",
            mm: "%d minutos",
            h: "uma hora",
            hh: "%d horas",
            d: "um dia",
            dd: "%d dias",
            M: "um mês",
            MM: "%d meses",
            y: "um ano",
            yy: "%d anos"
        },
        dayOfMonthOrdinalParse: /\d{1,2}º/,
        ordinal: "%dº"
    }), hooks.defineLocale("pt", {
        months: "Janeiro_Fevereiro_Março_Abril_Maio_Junho_Julho_Agosto_Setembro_Outubro_Novembro_Dezembro".split("_"),
        monthsShort: "Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez".split("_"),
        weekdays: "Domingo_Segunda-Feira_Terça-Feira_Quarta-Feira_Quinta-Feira_Sexta-Feira_Sábado".split("_"),
        weekdaysShort: "Dom_Seg_Ter_Qua_Qui_Sex_Sáb".split("_"),
        weekdaysMin: "Do_2ª_3ª_4ª_5ª_6ª_Sá".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D [de] MMMM [de] YYYY",
            LLL: "D [de] MMMM [de] YYYY HH:mm",
            LLLL: "dddd, D [de] MMMM [de] YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Hoje às] LT",
            nextDay: "[Amanhã às] LT",
            nextWeek: "dddd [às] LT",
            lastDay: "[Ontem às] LT",
            lastWeek: function() {
                return 0 === this.day() || 6 === this.day() ? "[Último] dddd [às] LT" : "[Última] dddd [às] LT";
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "em %s",
            past: "há %s",
            s: "segundos",
            m: "um minuto",
            mm: "%d minutos",
            h: "uma hora",
            hh: "%d horas",
            d: "um dia",
            dd: "%d dias",
            M: "um mês",
            MM: "%d meses",
            y: "um ano",
            yy: "%d anos"
        },
        dayOfMonthOrdinalParse: /\d{1,2}º/,
        ordinal: "%dº",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("ro", {
        months: "ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie".split("_"),
        monthsShort: "ian._febr._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.".split("_"),
        monthsParseExact: !0,
        weekdays: "duminică_luni_marți_miercuri_joi_vineri_sâmbătă".split("_"),
        weekdaysShort: "Dum_Lun_Mar_Mie_Joi_Vin_Sâm".split("_"),
        weekdaysMin: "Du_Lu_Ma_Mi_Jo_Vi_Sâ".split("_"),
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY H:mm",
            LLLL: "dddd, D MMMM YYYY H:mm"
        },
        calendar: {
            sameDay: "[azi la] LT",
            nextDay: "[mâine la] LT",
            nextWeek: "dddd [la] LT",
            lastDay: "[ieri la] LT",
            lastWeek: "[fosta] dddd [la] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "peste %s",
            past: "%s în urmă",
            s: "câteva secunde",
            m: "un minut",
            mm: relativeTimeWithPlural$2,
            h: "o oră",
            hh: relativeTimeWithPlural$2,
            d: "o zi",
            dd: relativeTimeWithPlural$2,
            M: "o lună",
            MM: relativeTimeWithPlural$2,
            y: "un an",
            yy: relativeTimeWithPlural$2
        },
        week: {
            dow: 1,
            doy: 7
        }
    });
    var monthsParse$2 = [ /^янв/i, /^фев/i, /^мар/i, /^апр/i, /^ма[йя]/i, /^июн/i, /^июл/i, /^авг/i, /^сен/i, /^окт/i, /^ноя/i, /^дек/i ];
    hooks.defineLocale("ru", {
        months: {
            format: "января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря".split("_"),
            standalone: "январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь".split("_")
        },
        monthsShort: {
            format: "янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.".split("_"),
            standalone: "янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.".split("_")
        },
        weekdays: {
            standalone: "воскресенье_понедельник_вторник_среда_четверг_пятница_суббота".split("_"),
            format: "воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу".split("_"),
            isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?\] ?dddd/
        },
        weekdaysShort: "вс_пн_вт_ср_чт_пт_сб".split("_"),
        weekdaysMin: "вс_пн_вт_ср_чт_пт_сб".split("_"),
        monthsParse: monthsParse$2,
        longMonthsParse: monthsParse$2,
        shortMonthsParse: monthsParse$2,
        monthsRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,
        monthsShortRegex: /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,
        monthsStrictRegex: /^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,
        monthsShortStrictRegex: /^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY г.",
            LLL: "D MMMM YYYY г., HH:mm",
            LLLL: "dddd, D MMMM YYYY г., HH:mm"
        },
        calendar: {
            sameDay: "[Сегодня в] LT",
            nextDay: "[Завтра в] LT",
            lastDay: "[Вчера в] LT",
            nextWeek: function(now) {
                if (now.week() === this.week()) return 2 === this.day() ? "[Во] dddd [в] LT" : "[В] dddd [в] LT";
                switch (this.day()) {
                  case 0:
                    return "[В следующее] dddd [в] LT";

                  case 1:
                  case 2:
                  case 4:
                    return "[В следующий] dddd [в] LT";

                  case 3:
                  case 5:
                  case 6:
                    return "[В следующую] dddd [в] LT";
                }
            },
            lastWeek: function(now) {
                if (now.week() === this.week()) return 2 === this.day() ? "[Во] dddd [в] LT" : "[В] dddd [в] LT";
                switch (this.day()) {
                  case 0:
                    return "[В прошлое] dddd [в] LT";

                  case 1:
                  case 2:
                  case 4:
                    return "[В прошлый] dddd [в] LT";

                  case 3:
                  case 5:
                  case 6:
                    return "[В прошлую] dddd [в] LT";
                }
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "через %s",
            past: "%s назад",
            s: "несколько секунд",
            m: relativeTimeWithPlural$3,
            mm: relativeTimeWithPlural$3,
            h: "час",
            hh: relativeTimeWithPlural$3,
            d: "день",
            dd: relativeTimeWithPlural$3,
            M: "месяц",
            MM: relativeTimeWithPlural$3,
            y: "год",
            yy: relativeTimeWithPlural$3
        },
        meridiemParse: /ночи|утра|дня|вечера/i,
        isPM: function(input) {
            return /^(дня|вечера)$/.test(input);
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "ночи" : hour < 12 ? "утра" : hour < 17 ? "дня" : "вечера";
        },
        dayOfMonthOrdinalParse: /\d{1,2}-(й|го|я)/,
        ordinal: function(number, period) {
            switch (period) {
              case "M":
              case "d":
              case "DDD":
                return number + "-й";

              case "D":
                return number + "-го";

              case "w":
              case "W":
                return number + "-я";

              default:
                return number;
            }
        },
        week: {
            dow: 1,
            doy: 7
        }
    });
    var months$6 = [ "جنوري", "فيبروري", "مارچ", "اپريل", "مئي", "جون", "جولاءِ", "آگسٽ", "سيپٽمبر", "آڪٽوبر", "نومبر", "ڊسمبر" ], days$1 = [ "آچر", "سومر", "اڱارو", "اربع", "خميس", "جمع", "ڇنڇر" ];
    hooks.defineLocale("sd", {
        months: months$6,
        monthsShort: months$6,
        weekdays: days$1,
        weekdaysShort: days$1,
        weekdaysMin: days$1,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd، D MMMM YYYY HH:mm"
        },
        meridiemParse: /صبح|شام/,
        isPM: function(input) {
            return "شام" === input;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 12 ? "صبح" : "شام";
        },
        calendar: {
            sameDay: "[اڄ] LT",
            nextDay: "[سڀاڻي] LT",
            nextWeek: "dddd [اڳين هفتي تي] LT",
            lastDay: "[ڪالهه] LT",
            lastWeek: "[گزريل هفتي] dddd [تي] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s پوء",
            past: "%s اڳ",
            s: "چند سيڪنڊ",
            m: "هڪ منٽ",
            mm: "%d منٽ",
            h: "هڪ ڪلاڪ",
            hh: "%d ڪلاڪ",
            d: "هڪ ڏينهن",
            dd: "%d ڏينهن",
            M: "هڪ مهينو",
            MM: "%d مهينا",
            y: "هڪ سال",
            yy: "%d سال"
        },
        preparse: function(string) {
            return string.replace(/،/g, ",");
        },
        postformat: function(string) {
            return string.replace(/,/g, "،");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("se", {
        months: "ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu".split("_"),
        monthsShort: "ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov".split("_"),
        weekdays: "sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat".split("_"),
        weekdaysShort: "sotn_vuos_maŋ_gask_duor_bear_láv".split("_"),
        weekdaysMin: "s_v_m_g_d_b_L".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "MMMM D. [b.] YYYY",
            LLL: "MMMM D. [b.] YYYY [ti.] HH:mm",
            LLLL: "dddd, MMMM D. [b.] YYYY [ti.] HH:mm"
        },
        calendar: {
            sameDay: "[otne ti] LT",
            nextDay: "[ihttin ti] LT",
            nextWeek: "dddd [ti] LT",
            lastDay: "[ikte ti] LT",
            lastWeek: "[ovddit] dddd [ti] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s geažes",
            past: "maŋit %s",
            s: "moadde sekunddat",
            m: "okta minuhta",
            mm: "%d minuhtat",
            h: "okta diimmu",
            hh: "%d diimmut",
            d: "okta beaivi",
            dd: "%d beaivvit",
            M: "okta mánnu",
            MM: "%d mánut",
            y: "okta jahki",
            yy: "%d jagit"
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("si", {
        months: "ජනවාරි_පෙබරවාරි_මාර්තු_අප්‍රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්".split("_"),
        monthsShort: "ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ".split("_"),
        weekdays: "ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්‍රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා".split("_"),
        weekdaysShort: "ඉරි_සඳු_අඟ_බදා_බ්‍රහ_සිකු_සෙන".split("_"),
        weekdaysMin: "ඉ_ස_අ_බ_බ්‍ර_සි_සෙ".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "a h:mm",
            LTS: "a h:mm:ss",
            L: "YYYY/MM/DD",
            LL: "YYYY MMMM D",
            LLL: "YYYY MMMM D, a h:mm",
            LLLL: "YYYY MMMM D [වැනි] dddd, a h:mm:ss"
        },
        calendar: {
            sameDay: "[අද] LT[ට]",
            nextDay: "[හෙට] LT[ට]",
            nextWeek: "dddd LT[ට]",
            lastDay: "[ඊයේ] LT[ට]",
            lastWeek: "[පසුගිය] dddd LT[ට]",
            sameElse: "L"
        },
        relativeTime: {
            future: "%sකින්",
            past: "%sකට පෙර",
            s: "තත්පර කිහිපය",
            m: "මිනිත්තුව",
            mm: "මිනිත්තු %d",
            h: "පැය",
            hh: "පැය %d",
            d: "දිනය",
            dd: "දින %d",
            M: "මාසය",
            MM: "මාස %d",
            y: "වසර",
            yy: "වසර %d"
        },
        dayOfMonthOrdinalParse: /\d{1,2} වැනි/,
        ordinal: function(number) {
            return number + " වැනි";
        },
        meridiemParse: /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,
        isPM: function(input) {
            return "ප.ව." === input || "පස් වරු" === input;
        },
        meridiem: function(hours, minutes, isLower) {
            return 11 < hours ? isLower ? "ප.ව." : "පස් වරු" : isLower ? "පෙ.ව." : "පෙර වරු";
        }
    });
    var months$7 = "január_február_marec_apríl_máj_jún_júl_august_september_október_november_december".split("_"), monthsShort$4 = "jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec".split("_");
    function plural$5(n) {
        return 1 < n && n < 5;
    }
    function translate$8(number, withoutSuffix, key, isFuture) {
        var result = number + " ";
        switch (key) {
          case "s":
            return withoutSuffix || isFuture ? "pár sekúnd" : "pár sekundami";

          case "m":
            return withoutSuffix ? "minúta" : isFuture ? "minútu" : "minútou";

          case "mm":
            return withoutSuffix || isFuture ? result + (plural$5(number) ? "minúty" : "minút") : result + "minútami";

          case "h":
            return withoutSuffix ? "hodina" : isFuture ? "hodinu" : "hodinou";

          case "hh":
            return withoutSuffix || isFuture ? result + (plural$5(number) ? "hodiny" : "hodín") : result + "hodinami";

          case "d":
            return withoutSuffix || isFuture ? "deň" : "dňom";

          case "dd":
            return withoutSuffix || isFuture ? result + (plural$5(number) ? "dni" : "dní") : result + "dňami";

          case "M":
            return withoutSuffix || isFuture ? "mesiac" : "mesiacom";

          case "MM":
            return withoutSuffix || isFuture ? result + (plural$5(number) ? "mesiace" : "mesiacov") : result + "mesiacmi";

          case "y":
            return withoutSuffix || isFuture ? "rok" : "rokom";

          case "yy":
            return withoutSuffix || isFuture ? result + (plural$5(number) ? "roky" : "rokov") : result + "rokmi";
        }
    }
    function processRelativeTime$6(number, withoutSuffix, key, isFuture) {
        var result = number + " ";
        switch (key) {
          case "s":
            return withoutSuffix || isFuture ? "nekaj sekund" : "nekaj sekundami";

          case "m":
            return withoutSuffix ? "ena minuta" : "eno minuto";

          case "mm":
            return result += 1 === number ? withoutSuffix ? "minuta" : "minuto" : 2 === number ? withoutSuffix || isFuture ? "minuti" : "minutama" : number < 5 ? withoutSuffix || isFuture ? "minute" : "minutami" : withoutSuffix || isFuture ? "minut" : "minutami";

          case "h":
            return withoutSuffix ? "ena ura" : "eno uro";

          case "hh":
            return result += 1 === number ? withoutSuffix ? "ura" : "uro" : 2 === number ? withoutSuffix || isFuture ? "uri" : "urama" : number < 5 ? withoutSuffix || isFuture ? "ure" : "urami" : withoutSuffix || isFuture ? "ur" : "urami";

          case "d":
            return withoutSuffix || isFuture ? "en dan" : "enim dnem";

          case "dd":
            return result += 1 === number ? withoutSuffix || isFuture ? "dan" : "dnem" : 2 === number ? withoutSuffix || isFuture ? "dni" : "dnevoma" : withoutSuffix || isFuture ? "dni" : "dnevi";

          case "M":
            return withoutSuffix || isFuture ? "en mesec" : "enim mesecem";

          case "MM":
            return result += 1 === number ? withoutSuffix || isFuture ? "mesec" : "mesecem" : 2 === number ? withoutSuffix || isFuture ? "meseca" : "mesecema" : number < 5 ? withoutSuffix || isFuture ? "mesece" : "meseci" : withoutSuffix || isFuture ? "mesecev" : "meseci";

          case "y":
            return withoutSuffix || isFuture ? "eno leto" : "enim letom";

          case "yy":
            return result += 1 === number ? withoutSuffix || isFuture ? "leto" : "letom" : 2 === number ? withoutSuffix || isFuture ? "leti" : "letoma" : number < 5 ? withoutSuffix || isFuture ? "leta" : "leti" : withoutSuffix || isFuture ? "let" : "leti";
        }
    }
    hooks.defineLocale("sk", {
        months: months$7,
        monthsShort: monthsShort$4,
        weekdays: "nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota".split("_"),
        weekdaysShort: "ne_po_ut_st_št_pi_so".split("_"),
        weekdaysMin: "ne_po_ut_st_št_pi_so".split("_"),
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY H:mm",
            LLLL: "dddd D. MMMM YYYY H:mm"
        },
        calendar: {
            sameDay: "[dnes o] LT",
            nextDay: "[zajtra o] LT",
            nextWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[v nedeľu o] LT";

                  case 1:
                  case 2:
                    return "[v] dddd [o] LT";

                  case 3:
                    return "[v stredu o] LT";

                  case 4:
                    return "[vo štvrtok o] LT";

                  case 5:
                    return "[v piatok o] LT";

                  case 6:
                    return "[v sobotu o] LT";
                }
            },
            lastDay: "[včera o] LT",
            lastWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[minulú nedeľu o] LT";

                  case 1:
                  case 2:
                    return "[minulý] dddd [o] LT";

                  case 3:
                    return "[minulú stredu o] LT";

                  case 4:
                  case 5:
                    return "[minulý] dddd [o] LT";

                  case 6:
                    return "[minulú sobotu o] LT";
                }
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "za %s",
            past: "pred %s",
            s: translate$8,
            m: translate$8,
            mm: translate$8,
            h: translate$8,
            hh: translate$8,
            d: translate$8,
            dd: translate$8,
            M: translate$8,
            MM: translate$8,
            y: translate$8,
            yy: translate$8
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("sl", {
        months: "januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december".split("_"),
        monthsShort: "jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.".split("_"),
        monthsParseExact: !0,
        weekdays: "nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota".split("_"),
        weekdaysShort: "ned._pon._tor._sre._čet._pet._sob.".split("_"),
        weekdaysMin: "ne_po_to_sr_če_pe_so".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY H:mm",
            LLLL: "dddd, D. MMMM YYYY H:mm"
        },
        calendar: {
            sameDay: "[danes ob] LT",
            nextDay: "[jutri ob] LT",
            nextWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[v] [nedeljo] [ob] LT";

                  case 3:
                    return "[v] [sredo] [ob] LT";

                  case 6:
                    return "[v] [soboto] [ob] LT";

                  case 1:
                  case 2:
                  case 4:
                  case 5:
                    return "[v] dddd [ob] LT";
                }
            },
            lastDay: "[včeraj ob] LT",
            lastWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[prejšnjo] [nedeljo] [ob] LT";

                  case 3:
                    return "[prejšnjo] [sredo] [ob] LT";

                  case 6:
                    return "[prejšnjo] [soboto] [ob] LT";

                  case 1:
                  case 2:
                  case 4:
                  case 5:
                    return "[prejšnji] dddd [ob] LT";
                }
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "čez %s",
            past: "pred %s",
            s: processRelativeTime$6,
            m: processRelativeTime$6,
            mm: processRelativeTime$6,
            h: processRelativeTime$6,
            hh: processRelativeTime$6,
            d: processRelativeTime$6,
            dd: processRelativeTime$6,
            M: processRelativeTime$6,
            MM: processRelativeTime$6,
            y: processRelativeTime$6,
            yy: processRelativeTime$6
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("sq", {
        months: "Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor".split("_"),
        monthsShort: "Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj".split("_"),
        weekdays: "E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë".split("_"),
        weekdaysShort: "Die_Hën_Mar_Mër_Enj_Pre_Sht".split("_"),
        weekdaysMin: "D_H_Ma_Më_E_P_Sh".split("_"),
        weekdaysParseExact: !0,
        meridiemParse: /PD|MD/,
        isPM: function(input) {
            return "M" === input.charAt(0);
        },
        meridiem: function(hours, minutes, isLower) {
            return hours < 12 ? "PD" : "MD";
        },
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Sot në] LT",
            nextDay: "[Nesër në] LT",
            nextWeek: "dddd [në] LT",
            lastDay: "[Dje në] LT",
            lastWeek: "dddd [e kaluar në] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "në %s",
            past: "%s më parë",
            s: "disa sekonda",
            m: "një minutë",
            mm: "%d minuta",
            h: "një orë",
            hh: "%d orë",
            d: "një ditë",
            dd: "%d ditë",
            M: "një muaj",
            MM: "%d muaj",
            y: "një vit",
            yy: "%d vite"
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    });
    var translator$1 = {
        words: {
            m: [ "један минут", "једне минуте" ],
            mm: [ "минут", "минуте", "минута" ],
            h: [ "један сат", "једног сата" ],
            hh: [ "сат", "сата", "сати" ],
            dd: [ "дан", "дана", "дана" ],
            MM: [ "месец", "месеца", "месеци" ],
            yy: [ "година", "године", "година" ]
        },
        correctGrammaticalCase: function(number, wordKey) {
            return 1 === number ? wordKey[0] : 2 <= number && number <= 4 ? wordKey[1] : wordKey[2];
        },
        translate: function(number, withoutSuffix, key) {
            var wordKey = translator$1.words[key];
            return 1 === key.length ? withoutSuffix ? wordKey[0] : wordKey[1] : number + " " + translator$1.correctGrammaticalCase(number, wordKey);
        }
    };
    hooks.defineLocale("sr-cyrl", {
        months: "јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар".split("_"),
        monthsShort: "јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.".split("_"),
        monthsParseExact: !0,
        weekdays: "недеља_понедељак_уторак_среда_четвртак_петак_субота".split("_"),
        weekdaysShort: "нед._пон._уто._сре._чет._пет._суб.".split("_"),
        weekdaysMin: "не_по_ут_ср_че_пе_су".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY H:mm",
            LLLL: "dddd, D. MMMM YYYY H:mm"
        },
        calendar: {
            sameDay: "[данас у] LT",
            nextDay: "[сутра у] LT",
            nextWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[у] [недељу] [у] LT";

                  case 3:
                    return "[у] [среду] [у] LT";

                  case 6:
                    return "[у] [суботу] [у] LT";

                  case 1:
                  case 2:
                  case 4:
                  case 5:
                    return "[у] dddd [у] LT";
                }
            },
            lastDay: "[јуче у] LT",
            lastWeek: function() {
                return [ "[прошле] [недеље] [у] LT", "[прошлог] [понедељка] [у] LT", "[прошлог] [уторка] [у] LT", "[прошле] [среде] [у] LT", "[прошлог] [четвртка] [у] LT", "[прошлог] [петка] [у] LT", "[прошле] [суботе] [у] LT" ][this.day()];
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "за %s",
            past: "пре %s",
            s: "неколико секунди",
            m: translator$1.translate,
            mm: translator$1.translate,
            h: translator$1.translate,
            hh: translator$1.translate,
            d: "дан",
            dd: translator$1.translate,
            M: "месец",
            MM: translator$1.translate,
            y: "годину",
            yy: translator$1.translate
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 7
        }
    });
    var translator$2 = {
        words: {
            m: [ "jedan minut", "jedne minute" ],
            mm: [ "minut", "minute", "minuta" ],
            h: [ "jedan sat", "jednog sata" ],
            hh: [ "sat", "sata", "sati" ],
            dd: [ "dan", "dana", "dana" ],
            MM: [ "mesec", "meseca", "meseci" ],
            yy: [ "godina", "godine", "godina" ]
        },
        correctGrammaticalCase: function(number, wordKey) {
            return 1 === number ? wordKey[0] : 2 <= number && number <= 4 ? wordKey[1] : wordKey[2];
        },
        translate: function(number, withoutSuffix, key) {
            var wordKey = translator$2.words[key];
            return 1 === key.length ? withoutSuffix ? wordKey[0] : wordKey[1] : number + " " + translator$2.correctGrammaticalCase(number, wordKey);
        }
    };
    hooks.defineLocale("sr", {
        months: "januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar".split("_"),
        monthsShort: "jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.".split("_"),
        monthsParseExact: !0,
        weekdays: "nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota".split("_"),
        weekdaysShort: "ned._pon._uto._sre._čet._pet._sub.".split("_"),
        weekdaysMin: "ne_po_ut_sr_če_pe_su".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM YYYY",
            LLL: "D. MMMM YYYY H:mm",
            LLLL: "dddd, D. MMMM YYYY H:mm"
        },
        calendar: {
            sameDay: "[danas u] LT",
            nextDay: "[sutra u] LT",
            nextWeek: function() {
                switch (this.day()) {
                  case 0:
                    return "[u] [nedelju] [u] LT";

                  case 3:
                    return "[u] [sredu] [u] LT";

                  case 6:
                    return "[u] [subotu] [u] LT";

                  case 1:
                  case 2:
                  case 4:
                  case 5:
                    return "[u] dddd [u] LT";
                }
            },
            lastDay: "[juče u] LT",
            lastWeek: function() {
                return [ "[prošle] [nedelje] [u] LT", "[prošlog] [ponedeljka] [u] LT", "[prošlog] [utorka] [u] LT", "[prošle] [srede] [u] LT", "[prošlog] [četvrtka] [u] LT", "[prošlog] [petka] [u] LT", "[prošle] [subote] [u] LT" ][this.day()];
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "za %s",
            past: "pre %s",
            s: "nekoliko sekundi",
            m: translator$2.translate,
            mm: translator$2.translate,
            h: translator$2.translate,
            hh: translator$2.translate,
            d: "dan",
            dd: translator$2.translate,
            M: "mesec",
            MM: translator$2.translate,
            y: "godinu",
            yy: translator$2.translate
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("ss", {
        months: "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split("_"),
        monthsShort: "Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo".split("_"),
        weekdays: "Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo".split("_"),
        weekdaysShort: "Lis_Umb_Lsb_Les_Lsi_Lsh_Umg".split("_"),
        weekdaysMin: "Li_Us_Lb_Lt_Ls_Lh_Ug".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "h:mm A",
            LTS: "h:mm:ss A",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY h:mm A",
            LLLL: "dddd, D MMMM YYYY h:mm A"
        },
        calendar: {
            sameDay: "[Namuhla nga] LT",
            nextDay: "[Kusasa nga] LT",
            nextWeek: "dddd [nga] LT",
            lastDay: "[Itolo nga] LT",
            lastWeek: "dddd [leliphelile] [nga] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "nga %s",
            past: "wenteka nga %s",
            s: "emizuzwana lomcane",
            m: "umzuzu",
            mm: "%d emizuzu",
            h: "lihora",
            hh: "%d emahora",
            d: "lilanga",
            dd: "%d emalanga",
            M: "inyanga",
            MM: "%d tinyanga",
            y: "umnyaka",
            yy: "%d iminyaka"
        },
        meridiemParse: /ekuseni|emini|entsambama|ebusuku/,
        meridiem: function(hours, minutes, isLower) {
            return hours < 11 ? "ekuseni" : hours < 15 ? "emini" : hours < 19 ? "entsambama" : "ebusuku";
        },
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "ekuseni" === meridiem ? hour : "emini" === meridiem ? 11 <= hour ? hour : hour + 12 : "entsambama" === meridiem || "ebusuku" === meridiem ? 0 === hour ? 0 : hour + 12 : void 0;
        },
        dayOfMonthOrdinalParse: /\d{1,2}/,
        ordinal: "%d",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("sv", {
        months: "januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),
        monthsShort: "jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),
        weekdays: "söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),
        weekdaysShort: "sön_mån_tis_ons_tor_fre_lör".split("_"),
        weekdaysMin: "sö_må_ti_on_to_fr_lö".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "YYYY-MM-DD",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY [kl.] HH:mm",
            LLLL: "dddd D MMMM YYYY [kl.] HH:mm",
            lll: "D MMM YYYY HH:mm",
            llll: "ddd D MMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Idag] LT",
            nextDay: "[Imorgon] LT",
            lastDay: "[Igår] LT",
            nextWeek: "[På] dddd LT",
            lastWeek: "[I] dddd[s] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "om %s",
            past: "för %s sedan",
            s: "några sekunder",
            m: "en minut",
            mm: "%d minuter",
            h: "en timme",
            hh: "%d timmar",
            d: "en dag",
            dd: "%d dagar",
            M: "en månad",
            MM: "%d månader",
            y: "ett år",
            yy: "%d år"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(e|a)/,
        ordinal: function(number) {
            var b = number % 10;
            return number + (1 == ~~(number % 100 / 10) ? "e" : 1 === b ? "a" : 2 === b ? "a" : "e");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("sw", {
        months: "Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba".split("_"),
        monthsShort: "Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des".split("_"),
        weekdays: "Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi".split("_"),
        weekdaysShort: "Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos".split("_"),
        weekdaysMin: "J2_J3_J4_J5_Al_Ij_J1".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[leo saa] LT",
            nextDay: "[kesho saa] LT",
            nextWeek: "[wiki ijayo] dddd [saat] LT",
            lastDay: "[jana] LT",
            lastWeek: "[wiki iliyopita] dddd [saat] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s baadaye",
            past: "tokea %s",
            s: "hivi punde",
            m: "dakika moja",
            mm: "dakika %d",
            h: "saa limoja",
            hh: "masaa %d",
            d: "siku moja",
            dd: "masiku %d",
            M: "mwezi mmoja",
            MM: "miezi %d",
            y: "mwaka mmoja",
            yy: "miaka %d"
        },
        week: {
            dow: 1,
            doy: 7
        }
    });
    var symbolMap$12 = {
        1: "௧",
        2: "௨",
        3: "௩",
        4: "௪",
        5: "௫",
        6: "௬",
        7: "௭",
        8: "௮",
        9: "௯",
        0: "௦"
    }, numberMap$11 = {
        "௧": "1",
        "௨": "2",
        "௩": "3",
        "௪": "4",
        "௫": "5",
        "௬": "6",
        "௭": "7",
        "௮": "8",
        "௯": "9",
        "௦": "0"
    };
    hooks.defineLocale("ta", {
        months: "ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),
        monthsShort: "ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்".split("_"),
        weekdays: "ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை".split("_"),
        weekdaysShort: "ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி".split("_"),
        weekdaysMin: "ஞா_தி_செ_பு_வி_வெ_ச".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY, HH:mm",
            LLLL: "dddd, D MMMM YYYY, HH:mm"
        },
        calendar: {
            sameDay: "[இன்று] LT",
            nextDay: "[நாளை] LT",
            nextWeek: "dddd, LT",
            lastDay: "[நேற்று] LT",
            lastWeek: "[கடந்த வாரம்] dddd, LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s இல்",
            past: "%s முன்",
            s: "ஒரு சில விநாடிகள்",
            m: "ஒரு நிமிடம்",
            mm: "%d நிமிடங்கள்",
            h: "ஒரு மணி நேரம்",
            hh: "%d மணி நேரம்",
            d: "ஒரு நாள்",
            dd: "%d நாட்கள்",
            M: "ஒரு மாதம்",
            MM: "%d மாதங்கள்",
            y: "ஒரு வருடம்",
            yy: "%d ஆண்டுகள்"
        },
        dayOfMonthOrdinalParse: /\d{1,2}வது/,
        ordinal: function(number) {
            return number + "வது";
        },
        preparse: function(string) {
            return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function(match) {
                return numberMap$11[match];
            });
        },
        postformat: function(string) {
            return string.replace(/\d/g, function(match) {
                return symbolMap$12[match];
            });
        },
        meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,
        meridiem: function(hour, minute, isLower) {
            return hour < 2 ? " யாமம்" : hour < 6 ? " வைகறை" : hour < 10 ? " காலை" : hour < 14 ? " நண்பகல்" : hour < 18 ? " எற்பாடு" : hour < 22 ? " மாலை" : " யாமம்";
        },
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "யாமம்" === meridiem ? hour < 2 ? hour : hour + 12 : "வைகறை" === meridiem || "காலை" === meridiem ? hour : "நண்பகல்" === meridiem && 10 <= hour ? hour : hour + 12;
        },
        week: {
            dow: 0,
            doy: 6
        }
    }), hooks.defineLocale("te", {
        months: "జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జూలై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్".split("_"),
        monthsShort: "జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జూలై_ఆగ._సెప్._అక్టో._నవ._డిసె.".split("_"),
        monthsParseExact: !0,
        weekdays: "ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం".split("_"),
        weekdaysShort: "ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని".split("_"),
        weekdaysMin: "ఆ_సో_మం_బు_గు_శు_శ".split("_"),
        longDateFormat: {
            LT: "A h:mm",
            LTS: "A h:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY, A h:mm",
            LLLL: "dddd, D MMMM YYYY, A h:mm"
        },
        calendar: {
            sameDay: "[నేడు] LT",
            nextDay: "[రేపు] LT",
            nextWeek: "dddd, LT",
            lastDay: "[నిన్న] LT",
            lastWeek: "[గత] dddd, LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s లో",
            past: "%s క్రితం",
            s: "కొన్ని క్షణాలు",
            m: "ఒక నిమిషం",
            mm: "%d నిమిషాలు",
            h: "ఒక గంట",
            hh: "%d గంటలు",
            d: "ఒక రోజు",
            dd: "%d రోజులు",
            M: "ఒక నెల",
            MM: "%d నెలలు",
            y: "ఒక సంవత్సరం",
            yy: "%d సంవత్సరాలు"
        },
        dayOfMonthOrdinalParse: /\d{1,2}వ/,
        ordinal: "%dవ",
        meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "రాత్రి" === meridiem ? hour < 4 ? hour : hour + 12 : "ఉదయం" === meridiem ? hour : "మధ్యాహ్నం" === meridiem ? 10 <= hour ? hour : hour + 12 : "సాయంత్రం" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "రాత్రి" : hour < 10 ? "ఉదయం" : hour < 17 ? "మధ్యాహ్నం" : hour < 20 ? "సాయంత్రం" : "రాత్రి";
        },
        week: {
            dow: 0,
            doy: 6
        }
    }), hooks.defineLocale("tet", {
        months: "Janeiru_Fevereiru_Marsu_Abril_Maiu_Juniu_Juliu_Augustu_Setembru_Outubru_Novembru_Dezembru".split("_"),
        monthsShort: "Jan_Fev_Mar_Abr_Mai_Jun_Jul_Aug_Set_Out_Nov_Dez".split("_"),
        weekdays: "Domingu_Segunda_Tersa_Kuarta_Kinta_Sexta_Sabadu".split("_"),
        weekdaysShort: "Dom_Seg_Ters_Kua_Kint_Sext_Sab".split("_"),
        weekdaysMin: "Do_Seg_Te_Ku_Ki_Sex_Sa".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Ohin iha] LT",
            nextDay: "[Aban iha] LT",
            nextWeek: "dddd [iha] LT",
            lastDay: "[Horiseik iha] LT",
            lastWeek: "dddd [semana kotuk] [iha] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "iha %s",
            past: "%s liuba",
            s: "minutu balun",
            m: "minutu ida",
            mm: "minutus %d",
            h: "horas ida",
            hh: "horas %d",
            d: "loron ida",
            dd: "loron %d",
            M: "fulan ida",
            MM: "fulan %d",
            y: "tinan ida",
            yy: "tinan %d"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
        ordinal: function(number) {
            var b = number % 10;
            return number + (1 == ~~(number % 100 / 10) ? "th" : 1 === b ? "st" : 2 === b ? "nd" : 3 === b ? "rd" : "th");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("th", {
        months: "มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม".split("_"),
        monthsShort: "ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.".split("_"),
        monthsParseExact: !0,
        weekdays: "อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์".split("_"),
        weekdaysShort: "อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์".split("_"),
        weekdaysMin: "อา._จ._อ._พ._พฤ._ศ._ส.".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "H:mm",
            LTS: "H:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY เวลา H:mm",
            LLLL: "วันddddที่ D MMMM YYYY เวลา H:mm"
        },
        meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/,
        isPM: function(input) {
            return "หลังเที่ยง" === input;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 12 ? "ก่อนเที่ยง" : "หลังเที่ยง";
        },
        calendar: {
            sameDay: "[วันนี้ เวลา] LT",
            nextDay: "[พรุ่งนี้ เวลา] LT",
            nextWeek: "dddd[หน้า เวลา] LT",
            lastDay: "[เมื่อวานนี้ เวลา] LT",
            lastWeek: "[วัน]dddd[ที่แล้ว เวลา] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "อีก %s",
            past: "%sที่แล้ว",
            s: "ไม่กี่วินาที",
            m: "1 นาที",
            mm: "%d นาที",
            h: "1 ชั่วโมง",
            hh: "%d ชั่วโมง",
            d: "1 วัน",
            dd: "%d วัน",
            M: "1 เดือน",
            MM: "%d เดือน",
            y: "1 ปี",
            yy: "%d ปี"
        }
    }), hooks.defineLocale("tl-ph", {
        months: "Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre".split("_"),
        monthsShort: "Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis".split("_"),
        weekdays: "Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado".split("_"),
        weekdaysShort: "Lin_Lun_Mar_Miy_Huw_Biy_Sab".split("_"),
        weekdaysMin: "Li_Lu_Ma_Mi_Hu_Bi_Sab".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "MM/D/YYYY",
            LL: "MMMM D, YYYY",
            LLL: "MMMM D, YYYY HH:mm",
            LLLL: "dddd, MMMM DD, YYYY HH:mm"
        },
        calendar: {
            sameDay: "LT [ngayong araw]",
            nextDay: "[Bukas ng] LT",
            nextWeek: "LT [sa susunod na] dddd",
            lastDay: "LT [kahapon]",
            lastWeek: "LT [noong nakaraang] dddd",
            sameElse: "L"
        },
        relativeTime: {
            future: "sa loob ng %s",
            past: "%s ang nakalipas",
            s: "ilang segundo",
            m: "isang minuto",
            mm: "%d minuto",
            h: "isang oras",
            hh: "%d oras",
            d: "isang araw",
            dd: "%d araw",
            M: "isang buwan",
            MM: "%d buwan",
            y: "isang taon",
            yy: "%d taon"
        },
        dayOfMonthOrdinalParse: /\d{1,2}/,
        ordinal: function(number) {
            return number;
        },
        week: {
            dow: 1,
            doy: 4
        }
    });
    var numbersNouns = "pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut".split("_");
    function translate$9(number, withoutSuffix, string, isFuture) {
        var numberNoun = function(number) {
            var hundred = Math.floor(number % 1e3 / 100), ten = Math.floor(number % 100 / 10), one = number % 10, word = "";
            0 < hundred && (word += numbersNouns[hundred] + "vatlh");
            0 < ten && (word += ("" !== word ? " " : "") + numbersNouns[ten] + "maH");
            0 < one && (word += ("" !== word ? " " : "") + numbersNouns[one]);
            return "" === word ? "pagh" : word;
        }(number);
        switch (string) {
          case "mm":
            return numberNoun + " tup";

          case "hh":
            return numberNoun + " rep";

          case "dd":
            return numberNoun + " jaj";

          case "MM":
            return numberNoun + " jar";

          case "yy":
            return numberNoun + " DIS";
        }
    }
    hooks.defineLocale("tlh", {
        months: "tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’".split("_"),
        monthsShort: "jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’".split("_"),
        monthsParseExact: !0,
        weekdays: "lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),
        weekdaysShort: "lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),
        weekdaysMin: "lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[DaHjaj] LT",
            nextDay: "[wa’leS] LT",
            nextWeek: "LLL",
            lastDay: "[wa’Hu’] LT",
            lastWeek: "LLL",
            sameElse: "L"
        },
        relativeTime: {
            future: function(output) {
                var time = output;
                return time = -1 !== output.indexOf("jaj") ? time.slice(0, -3) + "leS" : -1 !== output.indexOf("jar") ? time.slice(0, -3) + "waQ" : -1 !== output.indexOf("DIS") ? time.slice(0, -3) + "nem" : time + " pIq";
            },
            past: function(output) {
                var time = output;
                return time = -1 !== output.indexOf("jaj") ? time.slice(0, -3) + "Hu’" : -1 !== output.indexOf("jar") ? time.slice(0, -3) + "wen" : -1 !== output.indexOf("DIS") ? time.slice(0, -3) + "ben" : time + " ret";
            },
            s: "puS lup",
            m: "wa’ tup",
            mm: translate$9,
            h: "wa’ rep",
            hh: translate$9,
            d: "wa’ jaj",
            dd: translate$9,
            M: "wa’ jar",
            MM: translate$9,
            y: "wa’ DIS",
            yy: translate$9
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    });
    var suffixes$3 = {
        1: "'inci",
        5: "'inci",
        8: "'inci",
        70: "'inci",
        80: "'inci",
        2: "'nci",
        7: "'nci",
        20: "'nci",
        50: "'nci",
        3: "'üncü",
        4: "'üncü",
        100: "'üncü",
        6: "'ncı",
        9: "'uncu",
        10: "'uncu",
        30: "'uncu",
        60: "'ıncı",
        90: "'ıncı"
    };
    function processRelativeTime$7(number, withoutSuffix, key, isFuture) {
        var format = {
            s: [ "viensas secunds", "'iensas secunds" ],
            m: [ "'n míut", "'iens míut" ],
            mm: [ number + " míuts", number + " míuts" ],
            h: [ "'n þora", "'iensa þora" ],
            hh: [ number + " þoras", number + " þoras" ],
            d: [ "'n ziua", "'iensa ziua" ],
            dd: [ number + " ziuas", number + " ziuas" ],
            M: [ "'n mes", "'iens mes" ],
            MM: [ number + " mesen", number + " mesen" ],
            y: [ "'n ar", "'iens ar" ],
            yy: [ number + " ars", number + " ars" ]
        };
        return isFuture ? format[key][0] : withoutSuffix ? format[key][0] : format[key][1];
    }
    function relativeTimeWithPlural$4(number, withoutSuffix, key) {
        var num, forms;
        return "m" === key ? withoutSuffix ? "хвилина" : "хвилину" : "h" === key ? withoutSuffix ? "година" : "годину" : number + " " + (num = +number, 
        forms = {
            mm: withoutSuffix ? "хвилина_хвилини_хвилин" : "хвилину_хвилини_хвилин",
            hh: withoutSuffix ? "година_години_годин" : "годину_години_годин",
            dd: "день_дні_днів",
            MM: "місяць_місяці_місяців",
            yy: "рік_роки_років"
        }[key].split("_"), num % 10 == 1 && num % 100 != 11 ? forms[0] : 2 <= num % 10 && num % 10 <= 4 && (num % 100 < 10 || 20 <= num % 100) ? forms[1] : forms[2]);
    }
    function processHoursFunction(str) {
        return function() {
            return str + "о" + (11 === this.hours() ? "б" : "") + "] LT";
        };
    }
    hooks.defineLocale("tr", {
        months: "Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık".split("_"),
        monthsShort: "Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara".split("_"),
        weekdays: "Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi".split("_"),
        weekdaysShort: "Paz_Pts_Sal_Çar_Per_Cum_Cts".split("_"),
        weekdaysMin: "Pz_Pt_Sa_Ça_Pe_Cu_Ct".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[bugün saat] LT",
            nextDay: "[yarın saat] LT",
            nextWeek: "[haftaya] dddd [saat] LT",
            lastDay: "[dün] LT",
            lastWeek: "[geçen hafta] dddd [saat] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s sonra",
            past: "%s önce",
            s: "birkaç saniye",
            m: "bir dakika",
            mm: "%d dakika",
            h: "bir saat",
            hh: "%d saat",
            d: "bir gün",
            dd: "%d gün",
            M: "bir ay",
            MM: "%d ay",
            y: "bir yıl",
            yy: "%d yıl"
        },
        dayOfMonthOrdinalParse: /\d{1,2}'(inci|nci|üncü|ncı|uncu|ıncı)/,
        ordinal: function(number) {
            if (0 === number) return number + "'ıncı";
            var a = number % 10;
            return number + (suffixes$3[a] || suffixes$3[number % 100 - a] || suffixes$3[100 <= number ? 100 : null]);
        },
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("tzl", {
        months: "Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar".split("_"),
        monthsShort: "Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec".split("_"),
        weekdays: "Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi".split("_"),
        weekdaysShort: "Súl_Lún_Mai_Már_Xhú_Vié_Sát".split("_"),
        weekdaysMin: "Sú_Lú_Ma_Má_Xh_Vi_Sá".split("_"),
        longDateFormat: {
            LT: "HH.mm",
            LTS: "HH.mm.ss",
            L: "DD.MM.YYYY",
            LL: "D. MMMM [dallas] YYYY",
            LLL: "D. MMMM [dallas] YYYY HH.mm",
            LLLL: "dddd, [li] D. MMMM [dallas] YYYY HH.mm"
        },
        meridiemParse: /d\'o|d\'a/i,
        isPM: function(input) {
            return "d'o" === input.toLowerCase();
        },
        meridiem: function(hours, minutes, isLower) {
            return 11 < hours ? isLower ? "d'o" : "D'O" : isLower ? "d'a" : "D'A";
        },
        calendar: {
            sameDay: "[oxhi à] LT",
            nextDay: "[demà à] LT",
            nextWeek: "dddd [à] LT",
            lastDay: "[ieiri à] LT",
            lastWeek: "[sür el] dddd [lasteu à] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "osprei %s",
            past: "ja%s",
            s: processRelativeTime$7,
            m: processRelativeTime$7,
            mm: processRelativeTime$7,
            h: processRelativeTime$7,
            hh: processRelativeTime$7,
            d: processRelativeTime$7,
            dd: processRelativeTime$7,
            M: processRelativeTime$7,
            MM: processRelativeTime$7,
            y: processRelativeTime$7,
            yy: processRelativeTime$7
        },
        dayOfMonthOrdinalParse: /\d{1,2}\./,
        ordinal: "%d.",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("tzm-latn", {
        months: "innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),
        monthsShort: "innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir".split("_"),
        weekdays: "asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),
        weekdaysShort: "asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),
        weekdaysMin: "asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[asdkh g] LT",
            nextDay: "[aska g] LT",
            nextWeek: "dddd [g] LT",
            lastDay: "[assant g] LT",
            lastWeek: "dddd [g] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "dadkh s yan %s",
            past: "yan %s",
            s: "imik",
            m: "minuḍ",
            mm: "%d minuḍ",
            h: "saɛa",
            hh: "%d tassaɛin",
            d: "ass",
            dd: "%d ossan",
            M: "ayowr",
            MM: "%d iyyirn",
            y: "asgas",
            yy: "%d isgasn"
        },
        week: {
            dow: 6,
            doy: 12
        }
    }), hooks.defineLocale("tzm", {
        months: "ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),
        monthsShort: "ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ".split("_"),
        weekdays: "ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),
        weekdaysShort: "ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),
        weekdaysMin: "ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[ⴰⵙⴷⵅ ⴴ] LT",
            nextDay: "[ⴰⵙⴽⴰ ⴴ] LT",
            nextWeek: "dddd [ⴴ] LT",
            lastDay: "[ⴰⵚⴰⵏⵜ ⴴ] LT",
            lastWeek: "dddd [ⴴ] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s",
            past: "ⵢⴰⵏ %s",
            s: "ⵉⵎⵉⴽ",
            m: "ⵎⵉⵏⵓⴺ",
            mm: "%d ⵎⵉⵏⵓⴺ",
            h: "ⵙⴰⵄⴰ",
            hh: "%d ⵜⴰⵙⵙⴰⵄⵉⵏ",
            d: "ⴰⵙⵙ",
            dd: "%d oⵙⵙⴰⵏ",
            M: "ⴰⵢoⵓⵔ",
            MM: "%d ⵉⵢⵢⵉⵔⵏ",
            y: "ⴰⵙⴳⴰⵙ",
            yy: "%d ⵉⵙⴳⴰⵙⵏ"
        },
        week: {
            dow: 6,
            doy: 12
        }
    }), hooks.defineLocale("uk", {
        months: {
            format: "січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня".split("_"),
            standalone: "січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень".split("_")
        },
        monthsShort: "січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд".split("_"),
        weekdays: function(m, format) {
            var weekdays = {
                nominative: "неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота".split("_"),
                accusative: "неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу".split("_"),
                genitive: "неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи".split("_")
            };
            return m ? weekdays[/(\[[ВвУу]\]) ?dddd/.test(format) ? "accusative" : /\[?(?:минулої|наступної)? ?\] ?dddd/.test(format) ? "genitive" : "nominative"][m.day()] : weekdays.nominative;
        },
        weekdaysShort: "нд_пн_вт_ср_чт_пт_сб".split("_"),
        weekdaysMin: "нд_пн_вт_ср_чт_пт_сб".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD.MM.YYYY",
            LL: "D MMMM YYYY р.",
            LLL: "D MMMM YYYY р., HH:mm",
            LLLL: "dddd, D MMMM YYYY р., HH:mm"
        },
        calendar: {
            sameDay: processHoursFunction("[Сьогодні "),
            nextDay: processHoursFunction("[Завтра "),
            lastDay: processHoursFunction("[Вчора "),
            nextWeek: processHoursFunction("[У] dddd ["),
            lastWeek: function() {
                switch (this.day()) {
                  case 0:
                  case 3:
                  case 5:
                  case 6:
                    return processHoursFunction("[Минулої] dddd [").call(this);

                  case 1:
                  case 2:
                  case 4:
                    return processHoursFunction("[Минулого] dddd [").call(this);
                }
            },
            sameElse: "L"
        },
        relativeTime: {
            future: "за %s",
            past: "%s тому",
            s: "декілька секунд",
            m: relativeTimeWithPlural$4,
            mm: relativeTimeWithPlural$4,
            h: "годину",
            hh: relativeTimeWithPlural$4,
            d: "день",
            dd: relativeTimeWithPlural$4,
            M: "місяць",
            MM: relativeTimeWithPlural$4,
            y: "рік",
            yy: relativeTimeWithPlural$4
        },
        meridiemParse: /ночі|ранку|дня|вечора/,
        isPM: function(input) {
            return /^(дня|вечора)$/.test(input);
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 4 ? "ночі" : hour < 12 ? "ранку" : hour < 17 ? "дня" : "вечора";
        },
        dayOfMonthOrdinalParse: /\d{1,2}-(й|го)/,
        ordinal: function(number, period) {
            switch (period) {
              case "M":
              case "d":
              case "DDD":
              case "w":
              case "W":
                return number + "-й";

              case "D":
                return number + "-го";

              default:
                return number;
            }
        },
        week: {
            dow: 1,
            doy: 7
        }
    });
    var months$8 = [ "جنوری", "فروری", "مارچ", "اپریل", "مئی", "جون", "جولائی", "اگست", "ستمبر", "اکتوبر", "نومبر", "دسمبر" ], days$2 = [ "اتوار", "پیر", "منگل", "بدھ", "جمعرات", "جمعہ", "ہفتہ" ];
    return hooks.defineLocale("ur", {
        months: months$8,
        monthsShort: months$8,
        weekdays: days$2,
        weekdaysShort: days$2,
        weekdaysMin: days$2,
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd، D MMMM YYYY HH:mm"
        },
        meridiemParse: /صبح|شام/,
        isPM: function(input) {
            return "شام" === input;
        },
        meridiem: function(hour, minute, isLower) {
            return hour < 12 ? "صبح" : "شام";
        },
        calendar: {
            sameDay: "[آج بوقت] LT",
            nextDay: "[کل بوقت] LT",
            nextWeek: "dddd [بوقت] LT",
            lastDay: "[گذشتہ روز بوقت] LT",
            lastWeek: "[گذشتہ] dddd [بوقت] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s بعد",
            past: "%s قبل",
            s: "چند سیکنڈ",
            m: "ایک منٹ",
            mm: "%d منٹ",
            h: "ایک گھنٹہ",
            hh: "%d گھنٹے",
            d: "ایک دن",
            dd: "%d دن",
            M: "ایک ماہ",
            MM: "%d ماہ",
            y: "ایک سال",
            yy: "%d سال"
        },
        preparse: function(string) {
            return string.replace(/،/g, ",");
        },
        postformat: function(string) {
            return string.replace(/,/g, "،");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("uz-latn", {
        months: "Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr".split("_"),
        monthsShort: "Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek".split("_"),
        weekdays: "Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba".split("_"),
        weekdaysShort: "Yak_Dush_Sesh_Chor_Pay_Jum_Shan".split("_"),
        weekdaysMin: "Ya_Du_Se_Cho_Pa_Ju_Sha".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "D MMMM YYYY, dddd HH:mm"
        },
        calendar: {
            sameDay: "[Bugun soat] LT [da]",
            nextDay: "[Ertaga] LT [da]",
            nextWeek: "dddd [kuni soat] LT [da]",
            lastDay: "[Kecha soat] LT [da]",
            lastWeek: "[O'tgan] dddd [kuni soat] LT [da]",
            sameElse: "L"
        },
        relativeTime: {
            future: "Yaqin %s ichida",
            past: "Bir necha %s oldin",
            s: "soniya",
            m: "bir daqiqa",
            mm: "%d daqiqa",
            h: "bir soat",
            hh: "%d soat",
            d: "bir kun",
            dd: "%d kun",
            M: "bir oy",
            MM: "%d oy",
            y: "bir yil",
            yy: "%d yil"
        },
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("uz", {
        months: "январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр".split("_"),
        monthsShort: "янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек".split("_"),
        weekdays: "Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба".split("_"),
        weekdaysShort: "Якш_Душ_Сеш_Чор_Пай_Жум_Шан".split("_"),
        weekdaysMin: "Як_Ду_Се_Чо_Па_Жу_Ша".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "D MMMM YYYY, dddd HH:mm"
        },
        calendar: {
            sameDay: "[Бугун соат] LT [да]",
            nextDay: "[Эртага] LT [да]",
            nextWeek: "dddd [куни соат] LT [да]",
            lastDay: "[Кеча соат] LT [да]",
            lastWeek: "[Утган] dddd [куни соат] LT [да]",
            sameElse: "L"
        },
        relativeTime: {
            future: "Якин %s ичида",
            past: "Бир неча %s олдин",
            s: "фурсат",
            m: "бир дакика",
            mm: "%d дакика",
            h: "бир соат",
            hh: "%d соат",
            d: "бир кун",
            dd: "%d кун",
            M: "бир ой",
            MM: "%d ой",
            y: "бир йил",
            yy: "%d йил"
        },
        week: {
            dow: 1,
            doy: 7
        }
    }), hooks.defineLocale("vi", {
        months: "tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12".split("_"),
        monthsShort: "Th01_Th02_Th03_Th04_Th05_Th06_Th07_Th08_Th09_Th10_Th11_Th12".split("_"),
        monthsParseExact: !0,
        weekdays: "chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy".split("_"),
        weekdaysShort: "CN_T2_T3_T4_T5_T6_T7".split("_"),
        weekdaysMin: "CN_T2_T3_T4_T5_T6_T7".split("_"),
        weekdaysParseExact: !0,
        meridiemParse: /sa|ch/i,
        isPM: function(input) {
            return /^ch$/i.test(input);
        },
        meridiem: function(hours, minutes, isLower) {
            return hours < 12 ? isLower ? "sa" : "SA" : isLower ? "ch" : "CH";
        },
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "DD/MM/YYYY",
            LL: "D MMMM [năm] YYYY",
            LLL: "D MMMM [năm] YYYY HH:mm",
            LLLL: "dddd, D MMMM [năm] YYYY HH:mm",
            l: "DD/M/YYYY",
            ll: "D MMM YYYY",
            lll: "D MMM YYYY HH:mm",
            llll: "ddd, D MMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[Hôm nay lúc] LT",
            nextDay: "[Ngày mai lúc] LT",
            nextWeek: "dddd [tuần tới lúc] LT",
            lastDay: "[Hôm qua lúc] LT",
            lastWeek: "dddd [tuần rồi lúc] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "%s tới",
            past: "%s trước",
            s: "vài giây",
            m: "một phút",
            mm: "%d phút",
            h: "một giờ",
            hh: "%d giờ",
            d: "một ngày",
            dd: "%d ngày",
            M: "một tháng",
            MM: "%d tháng",
            y: "một năm",
            yy: "%d năm"
        },
        dayOfMonthOrdinalParse: /\d{1,2}/,
        ordinal: function(number) {
            return number;
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("x-pseudo", {
        months: "J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér".split("_"),
        monthsShort: "J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc".split("_"),
        monthsParseExact: !0,
        weekdays: "S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý".split("_"),
        weekdaysShort: "S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát".split("_"),
        weekdaysMin: "S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá".split("_"),
        weekdaysParseExact: !0,
        longDateFormat: {
            LT: "HH:mm",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY HH:mm",
            LLLL: "dddd, D MMMM YYYY HH:mm"
        },
        calendar: {
            sameDay: "[T~ódá~ý át] LT",
            nextDay: "[T~ómó~rró~w át] LT",
            nextWeek: "dddd [át] LT",
            lastDay: "[Ý~ést~érdá~ý át] LT",
            lastWeek: "[L~ást] dddd [át] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "í~ñ %s",
            past: "%s á~gó",
            s: "á ~féw ~sécó~ñds",
            m: "á ~míñ~úté",
            mm: "%d m~íñú~tés",
            h: "á~ñ hó~úr",
            hh: "%d h~óúrs",
            d: "á ~dáý",
            dd: "%d d~áýs",
            M: "á ~móñ~th",
            MM: "%d m~óñt~hs",
            y: "á ~ýéár",
            yy: "%d ý~éárs"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
        ordinal: function(number) {
            var b = number % 10;
            return number + (1 == ~~(number % 100 / 10) ? "th" : 1 === b ? "st" : 2 === b ? "nd" : 3 === b ? "rd" : "th");
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("yo", {
        months: "Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀".split("_"),
        monthsShort: "Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀".split("_"),
        weekdays: "Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta".split("_"),
        weekdaysShort: "Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá".split("_"),
        weekdaysMin: "Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb".split("_"),
        longDateFormat: {
            LT: "h:mm A",
            LTS: "h:mm:ss A",
            L: "DD/MM/YYYY",
            LL: "D MMMM YYYY",
            LLL: "D MMMM YYYY h:mm A",
            LLLL: "dddd, D MMMM YYYY h:mm A"
        },
        calendar: {
            sameDay: "[Ònì ni] LT",
            nextDay: "[Ọ̀la ni] LT",
            nextWeek: "dddd [Ọsẹ̀ tón'bọ] [ni] LT",
            lastDay: "[Àna ni] LT",
            lastWeek: "dddd [Ọsẹ̀ tólọ́] [ni] LT",
            sameElse: "L"
        },
        relativeTime: {
            future: "ní %s",
            past: "%s kọjá",
            s: "ìsẹjú aayá die",
            m: "ìsẹjú kan",
            mm: "ìsẹjú %d",
            h: "wákati kan",
            hh: "wákati %d",
            d: "ọjọ́ kan",
            dd: "ọjọ́ %d",
            M: "osù kan",
            MM: "osù %d",
            y: "ọdún kan",
            yy: "ọdún %d"
        },
        dayOfMonthOrdinalParse: /ọjọ́\s\d{1,2}/,
        ordinal: "ọjọ́ %d",
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("zh-cn", {
        months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),
        monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),
        weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),
        weekdaysShort: "周日_周一_周二_周三_周四_周五_周六".split("_"),
        weekdaysMin: "日_一_二_三_四_五_六".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "YYYY年MMMD日",
            LL: "YYYY年MMMD日",
            LLL: "YYYY年MMMD日Ah点mm分",
            LLLL: "YYYY年MMMD日ddddAh点mm分",
            l: "YYYY年MMMD日",
            ll: "YYYY年MMMD日",
            lll: "YYYY年MMMD日 HH:mm",
            llll: "YYYY年MMMD日dddd HH:mm"
        },
        meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "凌晨" === meridiem || "早上" === meridiem || "上午" === meridiem ? hour : "下午" === meridiem || "晚上" === meridiem ? hour + 12 : 11 <= hour ? hour : hour + 12;
        },
        meridiem: function(hour, minute, isLower) {
            var hm = 100 * hour + minute;
            return hm < 600 ? "凌晨" : hm < 900 ? "早上" : hm < 1130 ? "上午" : hm < 1230 ? "中午" : hm < 1800 ? "下午" : "晚上";
        },
        calendar: {
            sameDay: "[今天]LT",
            nextDay: "[明天]LT",
            nextWeek: "[下]ddddLT",
            lastDay: "[昨天]LT",
            lastWeek: "[上]ddddLT",
            sameElse: "L"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
        ordinal: function(number, period) {
            switch (period) {
              case "d":
              case "D":
              case "DDD":
                return number + "日";

              case "M":
                return number + "月";

              case "w":
              case "W":
                return number + "周";

              default:
                return number;
            }
        },
        relativeTime: {
            future: "%s内",
            past: "%s前",
            s: "几秒",
            m: "1 分钟",
            mm: "%d 分钟",
            h: "1 小时",
            hh: "%d 小时",
            d: "1 天",
            dd: "%d 天",
            M: "1 个月",
            MM: "%d 个月",
            y: "1 年",
            yy: "%d 年"
        },
        week: {
            dow: 1,
            doy: 4
        }
    }), hooks.defineLocale("zh-hk", {
        months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),
        monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),
        weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),
        weekdaysShort: "週日_週一_週二_週三_週四_週五_週六".split("_"),
        weekdaysMin: "日_一_二_三_四_五_六".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "YYYY年MMMD日",
            LL: "YYYY年MMMD日",
            LLL: "YYYY年MMMD日 HH:mm",
            LLLL: "YYYY年MMMD日dddd HH:mm",
            l: "YYYY年MMMD日",
            ll: "YYYY年MMMD日",
            lll: "YYYY年MMMD日 HH:mm",
            llll: "YYYY年MMMD日dddd HH:mm"
        },
        meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "凌晨" === meridiem || "早上" === meridiem || "上午" === meridiem ? hour : "中午" === meridiem ? 11 <= hour ? hour : hour + 12 : "下午" === meridiem || "晚上" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hour, minute, isLower) {
            var hm = 100 * hour + minute;
            return hm < 600 ? "凌晨" : hm < 900 ? "早上" : hm < 1130 ? "上午" : hm < 1230 ? "中午" : hm < 1800 ? "下午" : "晚上";
        },
        calendar: {
            sameDay: "[今天]LT",
            nextDay: "[明天]LT",
            nextWeek: "[下]ddddLT",
            lastDay: "[昨天]LT",
            lastWeek: "[上]ddddLT",
            sameElse: "L"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/,
        ordinal: function(number, period) {
            switch (period) {
              case "d":
              case "D":
              case "DDD":
                return number + "日";

              case "M":
                return number + "月";

              case "w":
              case "W":
                return number + "週";

              default:
                return number;
            }
        },
        relativeTime: {
            future: "%s內",
            past: "%s前",
            s: "幾秒",
            m: "1 分鐘",
            mm: "%d 分鐘",
            h: "1 小時",
            hh: "%d 小時",
            d: "1 天",
            dd: "%d 天",
            M: "1 個月",
            MM: "%d 個月",
            y: "1 年",
            yy: "%d 年"
        }
    }), hooks.defineLocale("zh-tw", {
        months: "一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月".split("_"),
        monthsShort: "1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月".split("_"),
        weekdays: "星期日_星期一_星期二_星期三_星期四_星期五_星期六".split("_"),
        weekdaysShort: "週日_週一_週二_週三_週四_週五_週六".split("_"),
        weekdaysMin: "日_一_二_三_四_五_六".split("_"),
        longDateFormat: {
            LT: "HH:mm",
            LTS: "HH:mm:ss",
            L: "YYYY年MMMD日",
            LL: "YYYY年MMMD日",
            LLL: "YYYY年MMMD日 HH:mm",
            LLLL: "YYYY年MMMD日dddd HH:mm",
            l: "YYYY年MMMD日",
            ll: "YYYY年MMMD日",
            lll: "YYYY年MMMD日 HH:mm",
            llll: "YYYY年MMMD日dddd HH:mm"
        },
        meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
        meridiemHour: function(hour, meridiem) {
            return 12 === hour && (hour = 0), "凌晨" === meridiem || "早上" === meridiem || "上午" === meridiem ? hour : "中午" === meridiem ? 11 <= hour ? hour : hour + 12 : "下午" === meridiem || "晚上" === meridiem ? hour + 12 : void 0;
        },
        meridiem: function(hour, minute, isLower) {
            var hm = 100 * hour + minute;
            return hm < 600 ? "凌晨" : hm < 900 ? "早上" : hm < 1130 ? "上午" : hm < 1230 ? "中午" : hm < 1800 ? "下午" : "晚上";
        },
        calendar: {
            sameDay: "[今天]LT",
            nextDay: "[明天]LT",
            nextWeek: "[下]ddddLT",
            lastDay: "[昨天]LT",
            lastWeek: "[上]ddddLT",
            sameElse: "L"
        },
        dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/,
        ordinal: function(number, period) {
            switch (period) {
              case "d":
              case "D":
              case "DDD":
                return number + "日";

              case "M":
                return number + "月";

              case "w":
              case "W":
                return number + "週";

              default:
                return number;
            }
        },
        relativeTime: {
            future: "%s內",
            past: "%s前",
            s: "幾秒",
            m: "1 分鐘",
            mm: "%d 分鐘",
            h: "1 小時",
            hh: "%d 小時",
            d: "1 天",
            dd: "%d 天",
            M: "1 個月",
            MM: "%d 個月",
            y: "1 年",
            yy: "%d 年"
        }
    }), hooks.locale("en"), hooks;
}), function(root, factory) {
    "use strict";
    "undefined" != typeof module && module.exports ? (factory("undefined" == typeof angular ? require("angular") : angular, "undefined" == typeof moment ? require("moment") : moment), 
    module.exports = "ui.bootstrap.datetimepicker") : "function" == typeof define && define.amd ? define([ "angular", "moment" ], factory) : factory(root.angular, root.moment);
}(this, function(angular, moment) {
    "use strict";
    function DatetimepickerDirective(defaultConfig, configurationValidator) {
        var directiveDefinition = {
            bindToController: !1,
            controller: DirectiveController,
            controllerAs: "dateTimePickerController",
            replace: !0,
            require: "ngModel",
            restrict: "E",
            scope: {
                beforeRender: "&",
                onSetTime: "&"
            },
            templateUrl: "templates/datetimepicker.html"
        };
        function DirectiveController($scope, $element, $attrs) {
            var ngModelController = $element.controller("ngModel"), configuration = createConfiguration();
            $scope.screenReader = configuration.screenReader, $scope.changeView = function(viewName, dateObject, event) {
                event && (event.stopPropagation(), event.preventDefault());
                if (viewName && dateObject.utcDateValue > -1 / 0 && dateObject.selectable && viewToModelFactory[viewName]) {
                    var result = viewToModelFactory[viewName](dateObject.utcDateValue), weekDates = [];
                    if (result.weeks) for (var i = 0; i < result.weeks.length; i += 1) for (var week = result.weeks[i], j = 0; j < week.dates.length; j += 1) {
                        var weekDate = week.dates[j];
                        weekDates.push(weekDate);
                    }
                    $scope.beforeRender({
                        $view: result.currentView,
                        $dates: result.dates || weekDates,
                        $leftDate: result.leftDate,
                        $upDate: result.previousViewDate,
                        $rightDate: result.rightDate
                    }), $scope.data = result;
                }
            }, ngModelController.$render = function() {
                $scope.changeView(configuration.startView, new DateObject({
                    utcDateValue: function(modelValue) {
                        var tempDate = new Date();
                        if (modelValue) {
                            var tempMoment = getMoment(modelValue);
                            if (!tempMoment.isValid()) throw new Error("Invalid date: " + modelValue);
                            tempDate = tempMoment.toDate();
                        }
                        return tempDate.getTime() - 6e4 * tempDate.getTimezoneOffset();
                    }(ngModelController.$viewValue)
                }));
            }, configuration.configureOn && $scope.$on(configuration.configureOn, function() {
                configuration = createConfiguration(), $scope.screenReader = configuration.screenReader, 
                ngModelController.$render();
            }), configuration.renderOn && $scope.$on(configuration.renderOn, ngModelController.$render);
            var viewToModelFactory = {
                year: function(milliseconds) {
                    for (var selectedDate = moment.utc(milliseconds).startOf("year"), startDecade = 10 * parseInt(selectedDate.year() / 10, 10), startDate = moment.utc(startOfDecade(milliseconds)).subtract(1, "year").startOf("year"), activeFormat = formatValue(ngModelController.$modelValue, "YYYY"), currentFormat = moment().format("YYYY"), result = {
                        currentView: "year",
                        nextView: "year" === configuration.minView ? "setTime" : "month",
                        previousViewDate: new DateObject({
                            utcDateValue: null,
                            display: startDecade + "-" + (startDecade + 9)
                        }),
                        leftDate: new DateObject({
                            utcDateValue: moment.utc(startDate).subtract(9, "year").valueOf()
                        }),
                        rightDate: new DateObject({
                            utcDateValue: moment.utc(startDate).add(11, "year").valueOf()
                        }),
                        dates: []
                    }, i = 0; i < 12; i += 1) {
                        var yearMoment = moment.utc(startDate).add(i, "years"), dateValue = {
                            active: yearMoment.format("YYYY") === activeFormat,
                            current: yearMoment.format("YYYY") === currentFormat,
                            display: yearMoment.format("YYYY"),
                            future: yearMoment.year() > startDecade + 9,
                            past: yearMoment.year() < startDecade,
                            utcDateValue: yearMoment.valueOf()
                        };
                        result.dates.push(new DateObject(dateValue));
                    }
                    return result;
                },
                month: function(milliseconds) {
                    for (var startDate = moment.utc(milliseconds).startOf("year"), previousViewDate = startOfDecade(milliseconds), activeFormat = formatValue(ngModelController.$modelValue, "YYYY-MMM"), currentFormat = moment().format("YYYY-MMM"), result = {
                        previousView: "year",
                        currentView: "month",
                        nextView: "month" === configuration.minView ? "setTime" : "day",
                        previousViewDate: new DateObject({
                            utcDateValue: previousViewDate.valueOf(),
                            display: startDate.format("YYYY")
                        }),
                        leftDate: new DateObject({
                            utcDateValue: moment.utc(startDate).subtract(1, "year").valueOf()
                        }),
                        rightDate: new DateObject({
                            utcDateValue: moment.utc(startDate).add(1, "year").valueOf()
                        }),
                        dates: []
                    }, i = 0; i < 12; i += 1) {
                        var monthMoment = moment.utc(startDate).add(i, "months"), dateValue = {
                            active: monthMoment.format("YYYY-MMM") === activeFormat,
                            current: monthMoment.format("YYYY-MMM") === currentFormat,
                            display: monthMoment.format("MMM"),
                            utcDateValue: monthMoment.valueOf()
                        };
                        result.dates.push(new DateObject(dateValue));
                    }
                    return result;
                },
                day: function(milliseconds) {
                    for (var selectedDate = moment.utc(milliseconds), startOfMonth = moment.utc(selectedDate).startOf("month"), previousViewDate = moment.utc(selectedDate).startOf("year"), endOfMonth = moment.utc(selectedDate).endOf("month"), startDate = moment.utc(startOfMonth).subtract(Math.abs(startOfMonth.weekday()), "days"), activeFormat = formatValue(ngModelController.$modelValue, "YYYY-MMM-DD"), currentFormat = moment().format("YYYY-MMM-DD"), result = {
                        previousView: "month",
                        currentView: "day",
                        nextView: "day" === configuration.minView ? "setTime" : "hour",
                        previousViewDate: new DateObject({
                            utcDateValue: previousViewDate.valueOf(),
                            display: startOfMonth.format("YYYY-MMM")
                        }),
                        leftDate: new DateObject({
                            utcDateValue: moment.utc(startOfMonth).subtract(1, "months").valueOf()
                        }),
                        rightDate: new DateObject({
                            utcDateValue: moment.utc(startOfMonth).add(1, "months").valueOf()
                        }),
                        dayNames: [],
                        weeks: []
                    }, dayNumber = 0; dayNumber < 7; dayNumber += 1) result.dayNames.push(moment.utc().weekday(dayNumber).format("dd"));
                    for (var i = 0; i < 6; i += 1) {
                        for (var week = {
                            dates: []
                        }, j = 0; j < 7; j += 1) {
                            var dayMoment = moment.utc(startDate).add(7 * i + j, "days"), dateValue = {
                                active: dayMoment.format("YYYY-MMM-DD") === activeFormat,
                                current: dayMoment.format("YYYY-MMM-DD") === currentFormat,
                                display: dayMoment.format("D"),
                                future: dayMoment.isAfter(endOfMonth),
                                past: dayMoment.isBefore(startOfMonth),
                                utcDateValue: dayMoment.valueOf()
                            };
                            week.dates.push(new DateObject(dateValue));
                        }
                        result.weeks.push(week);
                    }
                    return result;
                },
                hour: function(milliseconds) {
                    for (var selectedDate = moment.utc(milliseconds).startOf("day"), previousViewDate = moment.utc(selectedDate).startOf("month"), activeFormat = formatValue(ngModelController.$modelValue, "YYYY-MM-DD H"), currentFormat = moment().format("YYYY-MM-DD H"), result = {
                        previousView: "day",
                        currentView: "hour",
                        nextView: "hour" === configuration.minView ? "setTime" : "minute",
                        previousViewDate: new DateObject({
                            utcDateValue: previousViewDate.valueOf(),
                            display: selectedDate.format("ll")
                        }),
                        leftDate: new DateObject({
                            utcDateValue: moment.utc(selectedDate).subtract(1, "days").valueOf()
                        }),
                        rightDate: new DateObject({
                            utcDateValue: moment.utc(selectedDate).add(1, "days").valueOf()
                        }),
                        dates: []
                    }, i = 0; i < 24; i += 1) {
                        var hourMoment = moment.utc(selectedDate).add(i, "hours"), dateValue = {
                            active: hourMoment.format("YYYY-MM-DD H") === activeFormat,
                            current: hourMoment.format("YYYY-MM-DD H") === currentFormat,
                            display: hourMoment.format("LT"),
                            utcDateValue: hourMoment.valueOf()
                        };
                        result.dates.push(new DateObject(dateValue));
                    }
                    return result;
                },
                minute: function(milliseconds) {
                    for (var selectedDate = moment.utc(milliseconds).startOf("hour"), previousViewDate = moment.utc(selectedDate).startOf("day"), activeFormat = formatValue(ngModelController.$modelValue, "YYYY-MM-DD H:mm"), currentFormat = moment().format("YYYY-MM-DD H:mm"), result = {
                        previousView: "hour",
                        currentView: "minute",
                        nextView: "setTime",
                        previousViewDate: new DateObject({
                            utcDateValue: previousViewDate.valueOf(),
                            display: selectedDate.format("lll")
                        }),
                        leftDate: new DateObject({
                            utcDateValue: moment.utc(selectedDate).subtract(1, "hours").valueOf()
                        }),
                        rightDate: new DateObject({
                            utcDateValue: moment.utc(selectedDate).add(1, "hours").valueOf()
                        }),
                        dates: []
                    }, limit = 60 / configuration.minuteStep, i = 0; i < limit; i += 1) {
                        var hourMoment = moment.utc(selectedDate).add(i * configuration.minuteStep, "minute"), dateValue = {
                            active: hourMoment.format("YYYY-MM-DD H:mm") === activeFormat,
                            current: hourMoment.format("YYYY-MM-DD H:mm") === currentFormat,
                            display: hourMoment.format("LT"),
                            utcDateValue: hourMoment.valueOf()
                        };
                        result.dates.push(new DateObject(dateValue));
                    }
                    return result;
                },
                setTime: function(milliseconds) {
                    var tempDate = new Date(milliseconds), newDate = new Date(tempDate.getUTCFullYear(), tempDate.getUTCMonth(), tempDate.getUTCDate(), tempDate.getUTCHours(), tempDate.getUTCMinutes(), tempDate.getUTCSeconds(), tempDate.getUTCMilliseconds());
                    switch (configuration.modelType) {
                      case "Date":
                        break;

                      case "moment":
                        newDate = moment([ tempDate.getUTCFullYear(), tempDate.getUTCMonth(), tempDate.getUTCDate(), tempDate.getUTCHours(), tempDate.getUTCMinutes(), tempDate.getUTCSeconds(), tempDate.getUTCMilliseconds() ]);
                        break;

                      case "milliseconds":
                        newDate = milliseconds;
                        break;

                      default:
                        newDate = moment([ tempDate.getUTCFullYear(), tempDate.getUTCMonth(), tempDate.getUTCDate(), tempDate.getUTCHours(), tempDate.getUTCMinutes(), tempDate.getUTCSeconds(), tempDate.getUTCMilliseconds() ]).format(configuration.modelType);
                    }
                    var oldDate = ngModelController.$modelValue;
                    ngModelController.$setViewValue(newDate), configuration.dropdownSelector && jQuery(configuration.dropdownSelector).dropdown("toggle");
                    return $scope.onSetTime({
                        newDate: newDate,
                        oldDate: oldDate
                    }), viewToModelFactory[configuration.startView](milliseconds);
                }
            };
            function startOfDecade(milliseconds) {
                var startYear = 10 * parseInt(moment.utc(milliseconds).year() / 10, 10);
                return moment.utc(milliseconds).year(startYear).startOf("year");
            }
            function formatValue(timeValue, formatString) {
                return timeValue ? getMoment(timeValue).format(formatString) : "";
            }
            function getMoment(modelValue) {
                return moment(modelValue, angular.isString(modelValue) ? configuration.parseFormat : void 0);
            }
            function createConfiguration() {
                var directiveConfig = {};
                $attrs.datetimepickerConfig && (directiveConfig = $scope.$parent.$eval($attrs.datetimepickerConfig));
                var configuration = angular.extend({}, defaultConfig, directiveConfig);
                return configurationValidator.validate(configuration), configuration;
            }
        }
        function DateObject() {
            var tempDate = new Date(arguments[0].utcDateValue), localOffset = 6e4 * tempDate.getTimezoneOffset();
            this.utcDateValue = tempDate.getTime(), this.selectable = !0, this.localDateValue = function() {
                return this.utcDateValue + localOffset;
            };
            var validProperties = [ "active", "current", "display", "future", "past", "selectable", "utcDateValue" ], constructorObject = arguments[0];
            Object.keys(constructorObject).filter(function(key) {
                return 0 <= validProperties.indexOf(key);
            }).forEach(function(key) {
                this[key] = constructorObject[key];
            }, this);
        }
        return DirectiveController.$inject = [ "$scope", "$element", "$attrs" ], directiveDefinition;
    }
    function DateTimePickerValidatorService($log) {
        return {
            validate: function(configuration) {
                var validOptions = [ "configureOn", "dropdownSelector", "minuteStep", "minView", "modelType", "parseFormat", "renderOn", "startView", "screenReader" ], invalidOptions = Object.keys(configuration).filter(function(key) {
                    return validOptions.indexOf(key) < 0;
                });
                if (invalidOptions.length) throw new Error("Invalid options: " + invalidOptions.join(", "));
                var validViews = [ "minute", "hour", "day", "month", "year" ];
                if (validViews.indexOf(configuration.startView) < 0) throw new Error("invalid startView value: " + configuration.startView);
                if (validViews.indexOf(configuration.minView) < 0) throw new Error("invalid minView value: " + configuration.minView);
                if (validViews.indexOf(configuration.minView) > validViews.indexOf(configuration.startView)) throw new Error("startView must be greater than minView");
                if (!angular.isNumber(configuration.minuteStep)) throw new Error("minuteStep must be numeric");
                if (configuration.minuteStep <= 0 || 60 <= configuration.minuteStep) throw new Error("minuteStep must be greater than zero and less than 60");
                if (null !== configuration.configureOn && !angular.isString(configuration.configureOn)) throw new Error("configureOn must be a string");
                if (null !== configuration.configureOn && configuration.configureOn.length < 1) throw new Error("configureOn must not be an empty string");
                if (null !== configuration.renderOn && !angular.isString(configuration.renderOn)) throw new Error("renderOn must be a string");
                if (null !== configuration.renderOn && configuration.renderOn.length < 1) throw new Error("renderOn must not be an empty string");
                if (null !== configuration.modelType && !angular.isString(configuration.modelType)) throw new Error("modelType must be a string");
                if (null !== configuration.modelType && configuration.modelType.length < 1) throw new Error("modelType must not be an empty string");
                "Date" !== configuration.modelType && "moment" !== configuration.modelType && "milliseconds" !== configuration.modelType && (configuration.parseFormat = configuration.modelType);
                if (null !== configuration.dropdownSelector && !angular.isString(configuration.dropdownSelector)) throw new Error("dropdownSelector must be a string");
                null === configuration.dropdownSelector || "undefined" != typeof jQuery && "function" == typeof jQuery().dropdown || ($log.error("Please DO NOT specify the dropdownSelector option unless you are using jQuery AND Bootstrap.js. Please include jQuery AND Bootstrap.js, or write code to close the dropdown in the on-set-time callback. \n\nThe dropdownSelector configuration option is being removed because it will not function properly."), 
                delete configuration.dropdownSelector);
            }
        };
    }
    angular.module("ui.bootstrap.datetimepicker", []).service("dateTimePickerConfig", function() {
        var screenReader = {
            bg: {
                previous: "предишна",
                next: "следваща"
            },
            ca: {
                previous: "anterior",
                next: "següent"
            },
            da: {
                previous: "forrige",
                next: "næste"
            },
            de: {
                previous: "vorige",
                next: "weiter"
            },
            "en-au": {
                previous: "previous",
                next: "next"
            },
            "en-gb": {
                previous: "previous",
                next: "next"
            },
            en: {
                previous: "previous",
                next: "next"
            },
            "es-us": {
                previous: "atrás",
                next: "siguiente"
            },
            es: {
                previous: "atrás",
                next: "siguiente"
            },
            fi: {
                previous: "edellinen",
                next: "seuraava"
            },
            fr: {
                previous: "précédent",
                next: "suivant"
            },
            hu: {
                previous: "előző",
                next: "következő"
            },
            it: {
                previous: "precedente",
                next: "successivo"
            },
            ja: {
                previous: "前へ",
                next: "次へ"
            },
            ml: {
                previous: "മുൻപുള്ളത്",
                next: "അടുത്തത്"
            },
            nl: {
                previous: "vorige",
                next: "volgende"
            },
            pl: {
                previous: "poprzednia",
                next: "następna"
            },
            "pt-br": {
                previous: "anteriores",
                next: "próximos"
            },
            pt: {
                previous: "anterior",
                next: "próximo"
            },
            ro: {
                previous: "anterior",
                next: "următor"
            },
            ru: {
                previous: "предыдущая",
                next: "следующая"
            },
            sk: {
                previous: "predošlá",
                next: "ďalšia"
            },
            sv: {
                previous: "föregående",
                next: "nästa"
            },
            tr: {
                previous: "önceki",
                next: "sonraki"
            },
            uk: {
                previous: "назад",
                next: "далі"
            },
            "zh-cn": {
                previous: "上一页",
                next: "下一页"
            },
            "zh-tw": {
                previous: "上一頁",
                next: "下一頁"
            }
        }[moment.locale().toLowerCase()];
        return angular.extend({}, {
            configureOn: null,
            dropdownSelector: null,
            minuteStep: 5,
            minView: "minute",
            modelType: "Date",
            parseFormat: "YYYY-MM-DDTHH:mm:ss.SSSZZ",
            renderOn: null,
            startView: "day"
        }, {
            screenReader: screenReader
        });
    }).service("dateTimePickerValidator", DateTimePickerValidatorService).directive("datetimepicker", DatetimepickerDirective), 
    DatetimepickerDirective.$inject = [ "dateTimePickerConfig", "dateTimePickerValidator" ], 
    DateTimePickerValidatorService.$inject = [ "$log" ];
}), function(root, factory) {
    "use strict";
    "undefined" != typeof module && module.exports ? (factory("undefined" == typeof angular ? require("angular") : angular), 
    module.exports = "ui.bootstrap.datetimepicker.templates") : "function" == typeof define && define.amd ? define([ "angular" ], factory) : factory(root.angular, root.moment);
}(this, function(angular) {
    "use strict";
    angular.module("ui.bootstrap.datetimepicker").run([ "$templateCache", function($templateCache) {
        $templateCache.put("templates/datetimepicker.html", '<div class="datetimepicker table-responsive">\n    <table class="table table-condensed {{ data.currentView }}-view">\n        <thead>\n        <tr>\n            <th class="left" data-ng-click="changeView(data.currentView, data.leftDate, $event)" data-ng-show="data.leftDate.selectable"><i class="glyphicon glyphicon-arrow-left"><span class="sr-only">{{ screenReader.previous }}</span></i>\n            </th>\n            <th class="switch" colspan="5" data-ng-show="data.previousViewDate.selectable" data-ng-click="changeView(data.previousView, data.previousViewDate, $event)">{{ data.previousViewDate.display }}</th>\n            <th class="right" data-ng-click="changeView(data.currentView, data.rightDate, $event)" data-ng-show="data.rightDate.selectable"><i class="glyphicon glyphicon-arrow-right"><span class="sr-only">{{ screenReader.next }}</span></i>\n            </th>\n        </tr>\n        <tr>\n            <th class="dow" data-ng-repeat="day in data.dayNames">{{ day }}</th>\n        </tr>\n        </thead>\n        <tbody>\n        <tr data-ng-if="data.currentView !== \'day\'">\n            <td colspan="7">\n                          <span class="{{ data.currentView }}" data-ng-repeat="dateObject in data.dates" data-ng-class="{current: dateObject.current, active: dateObject.active, past: dateObject.past, future: dateObject.future, disabled: !dateObject.selectable}" data-ng-click="changeView(data.nextView, dateObject, $event)">{{ dateObject.display }}</span></td>\n        </tr>\n        <tr data-ng-if="data.currentView === \'day\'" data-ng-repeat="week in data.weeks">\n            <td data-ng-repeat="dateObject in week.dates" data-ng-click="changeView(data.nextView, dateObject, $event)" class="day" data-ng-class="{current: dateObject.current, active: dateObject.active, past: dateObject.past, future: dateObject.future, disabled: !dateObject.selectable}">{{ dateObject.display }}</td>\n        </tr>\n        </tbody>\n    </table>\n</div>\n');
    } ]);
}), function(root, factory) {
    "object" == typeof exports && "object" == typeof module ? module.exports = factory() : "function" == typeof define && define.amd ? define([], factory) : "object" == typeof exports ? exports.html2canvas = factory() : root.html2canvas = factory();
}(this, function() {
    return function(modules) {
        var installedModules = {};
        function __webpack_require__(moduleId) {
            if (installedModules[moduleId]) return installedModules[moduleId].exports;
            var module = installedModules[moduleId] = {
                i: moduleId,
                l: !1,
                exports: {}
            };
            return modules[moduleId].call(module.exports, module, module.exports, __webpack_require__), 
            module.l = !0, module.exports;
        }
        return __webpack_require__.m = modules, __webpack_require__.c = installedModules, 
        __webpack_require__.d = function(exports, name, getter) {
            __webpack_require__.o(exports, name) || Object.defineProperty(exports, name, {
                configurable: !1,
                enumerable: !0,
                get: getter
            });
        }, __webpack_require__.n = function(module) {
            var getter = module && module.__esModule ? function() {
                return module.default;
            } : function() {
                return module;
            };
            return __webpack_require__.d(getter, "a", getter), getter;
        }, __webpack_require__.o = function(object, property) {
            return Object.prototype.hasOwnProperty.call(object, property);
        }, __webpack_require__.p = "", __webpack_require__(__webpack_require__.s = 27);
    }([ function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var _slicedToArray = function(arr, i) {
            if (Array.isArray(arr)) return arr;
            if (Symbol.iterator in Object(arr)) return function(arr, i) {
                var _arr = [], _n = !0, _d = !1, _e = void 0;
                try {
                    for (var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), 
                    !i || _arr.length !== i); _n = !0) ;
                } catch (err) {
                    _d = !0, _e = err;
                } finally {
                    try {
                        !_n && _i.return && _i.return();
                    } finally {
                        if (_d) throw _e;
                    }
                }
                return _arr;
            }(arr, i);
            throw new TypeError("Invalid attempt to destructure non-iterable instance");
        }, _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }();
        var HEX3 = /^#([a-f0-9]{3})$/i, hex3 = function(value) {
            var match = value.match(HEX3);
            return !!match && [ parseInt(match[1][0] + match[1][0], 16), parseInt(match[1][1] + match[1][1], 16), parseInt(match[1][2] + match[1][2], 16), null ];
        }, HEX6 = /^#([a-f0-9]{6})$/i, hex6 = function(value) {
            var match = value.match(HEX6);
            return !!match && [ parseInt(match[1].substring(0, 2), 16), parseInt(match[1].substring(2, 4), 16), parseInt(match[1].substring(4, 6), 16), null ];
        }, RGB = /^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/, rgb = function(value) {
            var match = value.match(RGB);
            return !!match && [ Number(match[1]), Number(match[2]), Number(match[3]), null ];
        }, RGBA = /^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d?\.?\d+)\s*\)$/, rgba = function(value) {
            var match = value.match(RGBA);
            return !!(match && 4 < match.length) && [ Number(match[1]), Number(match[2]), Number(match[3]), Number(match[4]) ];
        }, fromArray = function(array) {
            return [ Math.min(array[0], 255), Math.min(array[1], 255), Math.min(array[2], 255), 3 < array.length ? array[3] : null ];
        }, namedColor = function(name) {
            var color = NAMED_COLORS[name.toLowerCase()];
            return color || !1;
        }, Color = function() {
            function Color(value) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, Color);
                var _ref = Array.isArray(value) ? fromArray(value) : hex3(value) || rgb(value) || rgba(value) || namedColor(value) || hex6(value) || [ 0, 0, 0, null ], _ref2 = _slicedToArray(_ref, 4), r = _ref2[0], g = _ref2[1], b = _ref2[2], a = _ref2[3];
                this.r = r, this.g = g, this.b = b, this.a = a;
            }
            return _createClass(Color, [ {
                key: "isTransparent",
                value: function() {
                    return 0 === this.a;
                }
            }, {
                key: "toString",
                value: function() {
                    return null !== this.a && 1 !== this.a ? "rgba(" + this.r + "," + this.g + "," + this.b + "," + this.a + ")" : "rgb(" + this.r + "," + this.g + "," + this.b + ")";
                }
            } ]), Color;
        }();
        exports.default = Color;
        var NAMED_COLORS = {
            transparent: [ 0, 0, 0, 0 ],
            aliceblue: [ 240, 248, 255, null ],
            antiquewhite: [ 250, 235, 215, null ],
            aqua: [ 0, 255, 255, null ],
            aquamarine: [ 127, 255, 212, null ],
            azure: [ 240, 255, 255, null ],
            beige: [ 245, 245, 220, null ],
            bisque: [ 255, 228, 196, null ],
            black: [ 0, 0, 0, null ],
            blanchedalmond: [ 255, 235, 205, null ],
            blue: [ 0, 0, 255, null ],
            blueviolet: [ 138, 43, 226, null ],
            brown: [ 165, 42, 42, null ],
            burlywood: [ 222, 184, 135, null ],
            cadetblue: [ 95, 158, 160, null ],
            chartreuse: [ 127, 255, 0, null ],
            chocolate: [ 210, 105, 30, null ],
            coral: [ 255, 127, 80, null ],
            cornflowerblue: [ 100, 149, 237, null ],
            cornsilk: [ 255, 248, 220, null ],
            crimson: [ 220, 20, 60, null ],
            cyan: [ 0, 255, 255, null ],
            darkblue: [ 0, 0, 139, null ],
            darkcyan: [ 0, 139, 139, null ],
            darkgoldenrod: [ 184, 134, 11, null ],
            darkgray: [ 169, 169, 169, null ],
            darkgreen: [ 0, 100, 0, null ],
            darkgrey: [ 169, 169, 169, null ],
            darkkhaki: [ 189, 183, 107, null ],
            darkmagenta: [ 139, 0, 139, null ],
            darkolivegreen: [ 85, 107, 47, null ],
            darkorange: [ 255, 140, 0, null ],
            darkorchid: [ 153, 50, 204, null ],
            darkred: [ 139, 0, 0, null ],
            darksalmon: [ 233, 150, 122, null ],
            darkseagreen: [ 143, 188, 143, null ],
            darkslateblue: [ 72, 61, 139, null ],
            darkslategray: [ 47, 79, 79, null ],
            darkslategrey: [ 47, 79, 79, null ],
            darkturquoise: [ 0, 206, 209, null ],
            darkviolet: [ 148, 0, 211, null ],
            deeppink: [ 255, 20, 147, null ],
            deepskyblue: [ 0, 191, 255, null ],
            dimgray: [ 105, 105, 105, null ],
            dimgrey: [ 105, 105, 105, null ],
            dodgerblue: [ 30, 144, 255, null ],
            firebrick: [ 178, 34, 34, null ],
            floralwhite: [ 255, 250, 240, null ],
            forestgreen: [ 34, 139, 34, null ],
            fuchsia: [ 255, 0, 255, null ],
            gainsboro: [ 220, 220, 220, null ],
            ghostwhite: [ 248, 248, 255, null ],
            gold: [ 255, 215, 0, null ],
            goldenrod: [ 218, 165, 32, null ],
            gray: [ 128, 128, 128, null ],
            green: [ 0, 128, 0, null ],
            greenyellow: [ 173, 255, 47, null ],
            grey: [ 128, 128, 128, null ],
            honeydew: [ 240, 255, 240, null ],
            hotpink: [ 255, 105, 180, null ],
            indianred: [ 205, 92, 92, null ],
            indigo: [ 75, 0, 130, null ],
            ivory: [ 255, 255, 240, null ],
            khaki: [ 240, 230, 140, null ],
            lavender: [ 230, 230, 250, null ],
            lavenderblush: [ 255, 240, 245, null ],
            lawngreen: [ 124, 252, 0, null ],
            lemonchiffon: [ 255, 250, 205, null ],
            lightblue: [ 173, 216, 230, null ],
            lightcoral: [ 240, 128, 128, null ],
            lightcyan: [ 224, 255, 255, null ],
            lightgoldenrodyellow: [ 250, 250, 210, null ],
            lightgray: [ 211, 211, 211, null ],
            lightgreen: [ 144, 238, 144, null ],
            lightgrey: [ 211, 211, 211, null ],
            lightpink: [ 255, 182, 193, null ],
            lightsalmon: [ 255, 160, 122, null ],
            lightseagreen: [ 32, 178, 170, null ],
            lightskyblue: [ 135, 206, 250, null ],
            lightslategray: [ 119, 136, 153, null ],
            lightslategrey: [ 119, 136, 153, null ],
            lightsteelblue: [ 176, 196, 222, null ],
            lightyellow: [ 255, 255, 224, null ],
            lime: [ 0, 255, 0, null ],
            limegreen: [ 50, 205, 50, null ],
            linen: [ 250, 240, 230, null ],
            magenta: [ 255, 0, 255, null ],
            maroon: [ 128, 0, 0, null ],
            mediumaquamarine: [ 102, 205, 170, null ],
            mediumblue: [ 0, 0, 205, null ],
            mediumorchid: [ 186, 85, 211, null ],
            mediumpurple: [ 147, 112, 219, null ],
            mediumseagreen: [ 60, 179, 113, null ],
            mediumslateblue: [ 123, 104, 238, null ],
            mediumspringgreen: [ 0, 250, 154, null ],
            mediumturquoise: [ 72, 209, 204, null ],
            mediumvioletred: [ 199, 21, 133, null ],
            midnightblue: [ 25, 25, 112, null ],
            mintcream: [ 245, 255, 250, null ],
            mistyrose: [ 255, 228, 225, null ],
            moccasin: [ 255, 228, 181, null ],
            navajowhite: [ 255, 222, 173, null ],
            navy: [ 0, 0, 128, null ],
            oldlace: [ 253, 245, 230, null ],
            olive: [ 128, 128, 0, null ],
            olivedrab: [ 107, 142, 35, null ],
            orange: [ 255, 165, 0, null ],
            orangered: [ 255, 69, 0, null ],
            orchid: [ 218, 112, 214, null ],
            palegoldenrod: [ 238, 232, 170, null ],
            palegreen: [ 152, 251, 152, null ],
            paleturquoise: [ 175, 238, 238, null ],
            palevioletred: [ 219, 112, 147, null ],
            papayawhip: [ 255, 239, 213, null ],
            peachpuff: [ 255, 218, 185, null ],
            peru: [ 205, 133, 63, null ],
            pink: [ 255, 192, 203, null ],
            plum: [ 221, 160, 221, null ],
            powderblue: [ 176, 224, 230, null ],
            purple: [ 128, 0, 128, null ],
            rebeccapurple: [ 102, 51, 153, null ],
            red: [ 255, 0, 0, null ],
            rosybrown: [ 188, 143, 143, null ],
            royalblue: [ 65, 105, 225, null ],
            saddlebrown: [ 139, 69, 19, null ],
            salmon: [ 250, 128, 114, null ],
            sandybrown: [ 244, 164, 96, null ],
            seagreen: [ 46, 139, 87, null ],
            seashell: [ 255, 245, 238, null ],
            sienna: [ 160, 82, 45, null ],
            silver: [ 192, 192, 192, null ],
            skyblue: [ 135, 206, 235, null ],
            slateblue: [ 106, 90, 205, null ],
            slategray: [ 112, 128, 144, null ],
            slategrey: [ 112, 128, 144, null ],
            snow: [ 255, 250, 250, null ],
            springgreen: [ 0, 255, 127, null ],
            steelblue: [ 70, 130, 180, null ],
            tan: [ 210, 180, 140, null ],
            teal: [ 0, 128, 128, null ],
            thistle: [ 216, 191, 216, null ],
            tomato: [ 255, 99, 71, null ],
            turquoise: [ 64, 224, 208, null ],
            violet: [ 238, 130, 238, null ],
            wheat: [ 245, 222, 179, null ],
            white: [ 255, 255, 255, null ],
            whitesmoke: [ 245, 245, 245, null ],
            yellow: [ 255, 255, 0, null ],
            yellowgreen: [ 154, 205, 50, null ]
        };
        exports.TRANSPARENT = new Color([ 0, 0, 0, 0 ]);
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.calculateLengthFromValueWithUnit = exports.LENGTH_TYPE = void 0;
        var obj, _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _NodeContainer = __webpack_require__(3);
        (obj = _NodeContainer) && obj.__esModule;
        var LENGTH_TYPE = exports.LENGTH_TYPE = {
            PX: 0,
            PERCENTAGE: 1
        }, Length = function() {
            function Length(value) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, Length), this.type = "%" === value.substr(value.length - 1) ? LENGTH_TYPE.PERCENTAGE : LENGTH_TYPE.PX;
                var parsedValue = parseFloat(value);
                isNaN(parsedValue) && console.error('Invalid value given for Length: "' + value + '"'), 
                this.value = isNaN(parsedValue) ? 0 : parsedValue;
            }
            return _createClass(Length, [ {
                key: "isPercentage",
                value: function() {
                    return this.type === LENGTH_TYPE.PERCENTAGE;
                }
            }, {
                key: "getAbsoluteValue",
                value: function(parentLength) {
                    return this.isPercentage() ? parentLength * (this.value / 100) : this.value;
                }
            } ], [ {
                key: "create",
                value: function(v) {
                    return new Length(v);
                }
            } ]), Length;
        }();
        exports.default = Length;
        exports.calculateLengthFromValueWithUnit = function(container, value, unit) {
            switch (unit) {
              case "px":
              case "%":
                return new Length(value + unit);

              case "em":
              case "rem":
                var length = new Length(value);
                return length.value *= "em" === unit ? parseFloat(container.style.font.fontSize) : function getRootFontSize(container) {
                    var parent = container.parent;
                    return parent ? getRootFontSize(parent) : parseFloat(container.style.font.fontSize);
                }(container), length;

              default:
                return new Length("0");
            }
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.parseBoundCurves = exports.calculatePaddingBoxPath = exports.calculateBorderBoxPath = exports.parsePathForBorder = exports.parseDocumentSize = exports.calculateContentBox = exports.calculatePaddingBox = exports.parseBounds = exports.Bounds = void 0;
        var _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _Vector2 = _interopRequireDefault(__webpack_require__(7)), _BezierCurve2 = _interopRequireDefault(__webpack_require__(32));
        function _interopRequireDefault(obj) {
            return obj && obj.__esModule ? obj : {
                default: obj
            };
        }
        var Bounds = exports.Bounds = function() {
            function Bounds(x, y, w, h) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, Bounds), this.left = x, this.top = y, this.width = w, this.height = h;
            }
            return _createClass(Bounds, null, [ {
                key: "fromClientRect",
                value: function(clientRect, scrollX, scrollY) {
                    return new Bounds(clientRect.left + scrollX, clientRect.top + scrollY, clientRect.width, clientRect.height);
                }
            } ]), Bounds;
        }(), createPathFromCurves = (exports.parseBounds = function(node, scrollX, scrollY) {
            return Bounds.fromClientRect(node.getBoundingClientRect(), scrollX, scrollY);
        }, exports.calculatePaddingBox = function(bounds, borders) {
            return new Bounds(bounds.left + borders[3].borderWidth, bounds.top + borders[0].borderWidth, bounds.width - (borders[1].borderWidth + borders[3].borderWidth), bounds.height - (borders[0].borderWidth + borders[2].borderWidth));
        }, exports.calculateContentBox = function(bounds, padding, borders) {
            var paddingTop = padding[0].value, paddingRight = padding[1].value, paddingBottom = padding[2].value, paddingLeft = padding[3].value;
            return new Bounds(bounds.left + paddingLeft + borders[3].borderWidth, bounds.top + paddingTop + borders[0].borderWidth, bounds.width - (borders[1].borderWidth + borders[3].borderWidth + paddingLeft + paddingRight), bounds.height - (borders[0].borderWidth + borders[2].borderWidth + paddingTop + paddingBottom));
        }, exports.parseDocumentSize = function(document) {
            var body = document.body, documentElement = document.documentElement;
            if (!body || !documentElement) throw new Error("Unable to get document size");
            var width = Math.max(Math.max(body.scrollWidth, documentElement.scrollWidth), Math.max(body.offsetWidth, documentElement.offsetWidth), Math.max(body.clientWidth, documentElement.clientWidth)), height = Math.max(Math.max(body.scrollHeight, documentElement.scrollHeight), Math.max(body.offsetHeight, documentElement.offsetHeight), Math.max(body.clientHeight, documentElement.clientHeight));
            return new Bounds(0, 0, width, height);
        }, exports.parsePathForBorder = function(curves, borderSide) {
            switch (borderSide) {
              case 0:
                return createPathFromCurves(curves.topLeftOuter, curves.topLeftInner, curves.topRightOuter, curves.topRightInner);

              case 1:
                return createPathFromCurves(curves.topRightOuter, curves.topRightInner, curves.bottomRightOuter, curves.bottomRightInner);

              case 2:
                return createPathFromCurves(curves.bottomRightOuter, curves.bottomRightInner, curves.bottomLeftOuter, curves.bottomLeftInner);

              case 3:
              default:
                return createPathFromCurves(curves.bottomLeftOuter, curves.bottomLeftInner, curves.topLeftOuter, curves.topLeftInner);
            }
        }, function(outer1, inner1, outer2, inner2) {
            var path = [];
            return outer1 instanceof _BezierCurve2.default ? path.push(outer1.subdivide(.5, !1)) : path.push(outer1), 
            outer2 instanceof _BezierCurve2.default ? path.push(outer2.subdivide(.5, !0)) : path.push(outer2), 
            inner2 instanceof _BezierCurve2.default ? path.push(inner2.subdivide(.5, !0).reverse()) : path.push(inner2), 
            inner1 instanceof _BezierCurve2.default ? path.push(inner1.subdivide(.5, !1).reverse()) : path.push(inner1), 
            path;
        }), CORNER = (exports.calculateBorderBoxPath = function(curves) {
            return [ curves.topLeftOuter, curves.topRightOuter, curves.bottomRightOuter, curves.bottomLeftOuter ];
        }, exports.calculatePaddingBoxPath = function(curves) {
            return [ curves.topLeftInner, curves.topRightInner, curves.bottomRightInner, curves.bottomLeftInner ];
        }, exports.parseBoundCurves = function(bounds, borders, borderRadius) {
            var tlh = borderRadius[CORNER.TOP_LEFT][0].getAbsoluteValue(bounds.width), tlv = borderRadius[CORNER.TOP_LEFT][1].getAbsoluteValue(bounds.height), trh = borderRadius[CORNER.TOP_RIGHT][0].getAbsoluteValue(bounds.width), trv = borderRadius[CORNER.TOP_RIGHT][1].getAbsoluteValue(bounds.height), brh = borderRadius[CORNER.BOTTOM_RIGHT][0].getAbsoluteValue(bounds.width), brv = borderRadius[CORNER.BOTTOM_RIGHT][1].getAbsoluteValue(bounds.height), blh = borderRadius[CORNER.BOTTOM_LEFT][0].getAbsoluteValue(bounds.width), blv = borderRadius[CORNER.BOTTOM_LEFT][1].getAbsoluteValue(bounds.height), factors = [];
            factors.push((tlh + trh) / bounds.width), factors.push((blh + brh) / bounds.width), 
            factors.push((tlv + blv) / bounds.height), factors.push((trv + brv) / bounds.height);
            var maxFactor = Math.max.apply(Math, factors);
            1 < maxFactor && (tlh /= maxFactor, tlv /= maxFactor, trh /= maxFactor, trv /= maxFactor, 
            brh /= maxFactor, brv /= maxFactor, blh /= maxFactor, blv /= maxFactor);
            var topWidth = bounds.width - trh, rightHeight = bounds.height - brv, bottomWidth = bounds.width - brh, leftHeight = bounds.height - blv;
            return {
                topLeftOuter: 0 < tlh || 0 < tlv ? getCurvePoints(bounds.left, bounds.top, tlh, tlv, CORNER.TOP_LEFT) : new _Vector2.default(bounds.left, bounds.top),
                topLeftInner: 0 < tlh || 0 < tlv ? getCurvePoints(bounds.left + borders[3].borderWidth, bounds.top + borders[0].borderWidth, Math.max(0, tlh - borders[3].borderWidth), Math.max(0, tlv - borders[0].borderWidth), CORNER.TOP_LEFT) : new _Vector2.default(bounds.left + borders[3].borderWidth, bounds.top + borders[0].borderWidth),
                topRightOuter: 0 < trh || 0 < trv ? getCurvePoints(bounds.left + topWidth, bounds.top, trh, trv, CORNER.TOP_RIGHT) : new _Vector2.default(bounds.left + bounds.width, bounds.top),
                topRightInner: 0 < trh || 0 < trv ? getCurvePoints(bounds.left + Math.min(topWidth, bounds.width + borders[3].borderWidth), bounds.top + borders[0].borderWidth, topWidth > bounds.width + borders[3].borderWidth ? 0 : trh - borders[3].borderWidth, trv - borders[0].borderWidth, CORNER.TOP_RIGHT) : new _Vector2.default(bounds.left + bounds.width - borders[1].borderWidth, bounds.top + borders[0].borderWidth),
                bottomRightOuter: 0 < brh || 0 < brv ? getCurvePoints(bounds.left + bottomWidth, bounds.top + rightHeight, brh, brv, CORNER.BOTTOM_RIGHT) : new _Vector2.default(bounds.left + bounds.width, bounds.top + bounds.height),
                bottomRightInner: 0 < brh || 0 < brv ? getCurvePoints(bounds.left + Math.min(bottomWidth, bounds.width - borders[3].borderWidth), bounds.top + Math.min(rightHeight, bounds.height + borders[0].borderWidth), Math.max(0, brh - borders[1].borderWidth), brv - borders[2].borderWidth, CORNER.BOTTOM_RIGHT) : new _Vector2.default(bounds.left + bounds.width - borders[1].borderWidth, bounds.top + bounds.height - borders[2].borderWidth),
                bottomLeftOuter: 0 < blh || 0 < blv ? getCurvePoints(bounds.left, bounds.top + leftHeight, blh, blv, CORNER.BOTTOM_LEFT) : new _Vector2.default(bounds.left, bounds.top + bounds.height),
                bottomLeftInner: 0 < blh || 0 < blv ? getCurvePoints(bounds.left + borders[3].borderWidth, bounds.top + leftHeight, Math.max(0, blh - borders[3].borderWidth), blv - borders[2].borderWidth, CORNER.BOTTOM_LEFT) : new _Vector2.default(bounds.left + borders[3].borderWidth, bounds.top + bounds.height - borders[2].borderWidth)
            };
        }, {
            TOP_LEFT: 0,
            TOP_RIGHT: 1,
            BOTTOM_RIGHT: 2,
            BOTTOM_LEFT: 3
        }), getCurvePoints = function(x, y, r1, r2, position) {
            var kappa = (Math.sqrt(2) - 1) / 3 * 4, ox = r1 * kappa, oy = r2 * kappa, xm = x + r1, ym = y + r2;
            switch (position) {
              case CORNER.TOP_LEFT:
                return new _BezierCurve2.default(new _Vector2.default(x, ym), new _Vector2.default(x, ym - oy), new _Vector2.default(xm - ox, y), new _Vector2.default(xm, y));

              case CORNER.TOP_RIGHT:
                return new _BezierCurve2.default(new _Vector2.default(x, y), new _Vector2.default(x + ox, y), new _Vector2.default(xm, ym - oy), new _Vector2.default(xm, ym));

              case CORNER.BOTTOM_RIGHT:
                return new _BezierCurve2.default(new _Vector2.default(xm, y), new _Vector2.default(xm, y + oy), new _Vector2.default(x + ox, ym), new _Vector2.default(x, ym));

              case CORNER.BOTTOM_LEFT:
              default:
                return new _BezierCurve2.default(new _Vector2.default(xm, ym), new _Vector2.default(xm - ox, ym), new _Vector2.default(x, y + oy), new _Vector2.default(x, y));
            }
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var obj, _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _Color = __webpack_require__(0), _Color2 = (obj = _Color) && obj.__esModule ? obj : {
            default: obj
        }, _Util = __webpack_require__(4), _background = __webpack_require__(5), _border = __webpack_require__(12), _borderRadius = __webpack_require__(33), _display = __webpack_require__(34), _float = __webpack_require__(35), _font = __webpack_require__(36), _letterSpacing = __webpack_require__(37), _lineBreak = __webpack_require__(38), _listStyle = __webpack_require__(8), _margin = __webpack_require__(39), _overflow = __webpack_require__(40), _overflowWrap = __webpack_require__(18), _padding = __webpack_require__(17), _position = __webpack_require__(19), _textDecoration = __webpack_require__(11), _textShadow = __webpack_require__(41), _textTransform = __webpack_require__(20), _transform = __webpack_require__(42), _visibility = __webpack_require__(43), _wordBreak = __webpack_require__(44), _zIndex = __webpack_require__(45), _Bounds = __webpack_require__(2), _Input = __webpack_require__(21), _ListItem = __webpack_require__(14);
        var INPUT_TAGS = [ "INPUT", "TEXTAREA", "SELECT" ], NodeContainer = function() {
            function NodeContainer(node, parent, resourceLoader, index) {
                var _this = this;
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, NodeContainer), this.parent = parent, this.tagName = node.tagName, this.index = index, 
                this.childNodes = [], this.listItems = [], "number" == typeof node.start && (this.listStart = node.start);
                var defaultView = node.ownerDocument.defaultView, scrollX = defaultView.pageXOffset, scrollY = defaultView.pageYOffset, style = defaultView.getComputedStyle(node, null), display = (0, 
                _display.parseDisplay)(style.display), IS_INPUT = "radio" === node.type || "checkbox" === node.type, position = (0, 
                _position.parsePosition)(style.position);
                if (this.style = {
                    background: IS_INPUT ? _Input.INPUT_BACKGROUND : (0, _background.parseBackground)(style, resourceLoader),
                    border: IS_INPUT ? _Input.INPUT_BORDERS : (0, _border.parseBorder)(style),
                    borderRadius: (node instanceof defaultView.HTMLInputElement || node instanceof HTMLInputElement) && IS_INPUT ? (0, 
                    _Input.getInputBorderRadius)(node) : (0, _borderRadius.parseBorderRadius)(style),
                    color: IS_INPUT ? _Input.INPUT_COLOR : new _Color2.default(style.color),
                    display: display,
                    float: (0, _float.parseCSSFloat)(style.float),
                    font: (0, _font.parseFont)(style),
                    letterSpacing: (0, _letterSpacing.parseLetterSpacing)(style.letterSpacing),
                    listStyle: display === _display.DISPLAY.LIST_ITEM ? (0, _listStyle.parseListStyle)(style) : null,
                    lineBreak: (0, _lineBreak.parseLineBreak)(style.lineBreak),
                    margin: (0, _margin.parseMargin)(style),
                    opacity: parseFloat(style.opacity),
                    overflow: -1 === INPUT_TAGS.indexOf(node.tagName) ? (0, _overflow.parseOverflow)(style.overflow) : _overflow.OVERFLOW.HIDDEN,
                    overflowWrap: (0, _overflowWrap.parseOverflowWrap)(style.overflowWrap ? style.overflowWrap : style.wordWrap),
                    padding: (0, _padding.parsePadding)(style),
                    position: position,
                    textDecoration: (0, _textDecoration.parseTextDecoration)(style),
                    textShadow: (0, _textShadow.parseTextShadow)(style.textShadow),
                    textTransform: (0, _textTransform.parseTextTransform)(style.textTransform),
                    transform: (0, _transform.parseTransform)(style),
                    visibility: (0, _visibility.parseVisibility)(style.visibility),
                    wordBreak: (0, _wordBreak.parseWordBreak)(style.wordBreak),
                    zIndex: (0, _zIndex.parseZIndex)(position !== _position.POSITION.STATIC ? style.zIndex : "auto")
                }, this.isTransformed() && (node.style.transform = "matrix(1,0,0,1,0,0)"), display === _display.DISPLAY.LIST_ITEM) {
                    var listOwner = (0, _ListItem.getListOwner)(this);
                    if (listOwner) {
                        var listIndex = listOwner.listItems.length;
                        listOwner.listItems.push(this), this.listIndex = node.hasAttribute("value") && "number" == typeof node.value ? node.value : 0 === listIndex ? "number" == typeof listOwner.listStart ? listOwner.listStart : 1 : listOwner.listItems[listIndex - 1].listIndex + 1;
                    }
                }
                "IMG" === node.tagName && node.addEventListener("load", function() {
                    _this.bounds = (0, _Bounds.parseBounds)(node, scrollX, scrollY), _this.curvedBounds = (0, 
                    _Bounds.parseBoundCurves)(_this.bounds, _this.style.border, _this.style.borderRadius);
                }), this.image = getImage(node, resourceLoader), this.bounds = IS_INPUT ? (0, _Input.reformatInputBounds)((0, 
                _Bounds.parseBounds)(node, scrollX, scrollY)) : (0, _Bounds.parseBounds)(node, scrollX, scrollY), 
                this.curvedBounds = (0, _Bounds.parseBoundCurves)(this.bounds, this.style.border, this.style.borderRadius), 
                this.name = node.tagName.toLowerCase() + (node.id ? "#" + node.id : "") + node.className.toString().split(" ").map(function(s) {
                    return s.length ? "." + s : "";
                }).join("");
            }
            return _createClass(NodeContainer, [ {
                key: "getClipPaths",
                value: function() {
                    var parentClips = this.parent ? this.parent.getClipPaths() : [];
                    return this.style.overflow !== _overflow.OVERFLOW.VISIBLE ? parentClips.concat([ (0, 
                    _Bounds.calculatePaddingBoxPath)(this.curvedBounds) ]) : parentClips;
                }
            }, {
                key: "isInFlow",
                value: function() {
                    return this.isRootElement() && !this.isFloating() && !this.isAbsolutelyPositioned();
                }
            }, {
                key: "isVisible",
                value: function() {
                    return !(0, _Util.contains)(this.style.display, _display.DISPLAY.NONE) && 0 < this.style.opacity && this.style.visibility === _visibility.VISIBILITY.VISIBLE;
                }
            }, {
                key: "isAbsolutelyPositioned",
                value: function() {
                    return this.style.position !== _position.POSITION.STATIC && this.style.position !== _position.POSITION.RELATIVE;
                }
            }, {
                key: "isPositioned",
                value: function() {
                    return this.style.position !== _position.POSITION.STATIC;
                }
            }, {
                key: "isFloating",
                value: function() {
                    return this.style.float !== _float.FLOAT.NONE;
                }
            }, {
                key: "isRootElement",
                value: function() {
                    return null === this.parent;
                }
            }, {
                key: "isTransformed",
                value: function() {
                    return null !== this.style.transform;
                }
            }, {
                key: "isPositionedWithZIndex",
                value: function() {
                    return this.isPositioned() && !this.style.zIndex.auto;
                }
            }, {
                key: "isInlineLevel",
                value: function() {
                    return (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_BLOCK) || (0, 
                    _Util.contains)(this.style.display, _display.DISPLAY.INLINE_FLEX) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_GRID) || (0, 
                    _Util.contains)(this.style.display, _display.DISPLAY.INLINE_LIST_ITEM) || (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_TABLE);
                }
            }, {
                key: "isInlineBlockOrInlineTable",
                value: function() {
                    return (0, _Util.contains)(this.style.display, _display.DISPLAY.INLINE_BLOCK) || (0, 
                    _Util.contains)(this.style.display, _display.DISPLAY.INLINE_TABLE);
                }
            } ]), NodeContainer;
        }();
        exports.default = NodeContainer;
        var getImage = function(node, resourceLoader) {
            if (node instanceof node.ownerDocument.defaultView.SVGSVGElement || node instanceof SVGSVGElement) {
                var s = new XMLSerializer();
                return resourceLoader.loadImage("data:image/svg+xml," + encodeURIComponent(s.serializeToString(node)));
            }
            switch (node.tagName) {
              case "IMG":
                var img = node;
                return resourceLoader.loadImage(img.currentSrc || img.src);

              case "CANVAS":
                var canvas = node;
                return resourceLoader.loadCanvas(canvas);

              case "IFRAME":
                var iframeKey = node.getAttribute("data-html2canvas-internal-iframe-key");
                if (iframeKey) return iframeKey;
            }
            return null;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        exports.contains = function(bit, value) {
            return 0 != (bit & value);
        }, exports.distance = function(a, b) {
            return Math.sqrt(a * a + b * b);
        }, exports.copyCSSStyles = function(style, target) {
            for (var i = style.length - 1; 0 <= i; i--) {
                var property = style.item(i);
                "content" !== property && target.style.setProperty(property, style.getPropertyValue(property));
            }
            return target;
        }, exports.SMALL_IMAGE = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.parseBackgroundImage = exports.parseBackground = exports.calculateBackgroundRepeatPath = exports.calculateBackgroundPosition = exports.calculateBackgroungPositioningArea = exports.calculateBackgroungPaintingArea = exports.calculateGradientBackgroundSize = exports.calculateBackgroundSize = exports.BACKGROUND_ORIGIN = exports.BACKGROUND_CLIP = exports.BACKGROUND_SIZE = exports.BACKGROUND_REPEAT = void 0;
        var _Color2 = _interopRequireDefault(__webpack_require__(0)), _Length2 = _interopRequireDefault(__webpack_require__(1)), _Size2 = _interopRequireDefault(__webpack_require__(31)), _Vector2 = _interopRequireDefault(__webpack_require__(7)), _Bounds = __webpack_require__(2), _padding = __webpack_require__(17);
        function _interopRequireDefault(obj) {
            return obj && obj.__esModule ? obj : {
                default: obj
            };
        }
        var BACKGROUND_REPEAT = exports.BACKGROUND_REPEAT = {
            REPEAT: 0,
            NO_REPEAT: 1,
            REPEAT_X: 2,
            REPEAT_Y: 3
        }, BACKGROUND_SIZE = exports.BACKGROUND_SIZE = {
            AUTO: 0,
            CONTAIN: 1,
            COVER: 2,
            LENGTH: 3
        }, BACKGROUND_CLIP = exports.BACKGROUND_CLIP = {
            BORDER_BOX: 0,
            PADDING_BOX: 1,
            CONTENT_BOX: 2
        }, BACKGROUND_ORIGIN = exports.BACKGROUND_ORIGIN = BACKGROUND_CLIP, BackgroundSize = function BackgroundSize(size) {
            switch (function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, BackgroundSize), size) {
              case "contain":
                this.size = BACKGROUND_SIZE.CONTAIN;
                break;

              case "cover":
                this.size = BACKGROUND_SIZE.COVER;
                break;

              case "auto":
                this.size = BACKGROUND_SIZE.AUTO;
                break;

              default:
                this.value = new _Length2.default(size);
            }
        }, AUTO_SIZE = (exports.calculateBackgroundSize = function(backgroundImage, image, bounds) {
            var width = 0, height = 0, size = backgroundImage.size;
            if (size[0].size === BACKGROUND_SIZE.CONTAIN || size[0].size === BACKGROUND_SIZE.COVER) {
                var targetRatio = bounds.width / bounds.height, currentRatio = image.width / image.height;
                return targetRatio < currentRatio != (size[0].size === BACKGROUND_SIZE.COVER) ? new _Size2.default(bounds.width, bounds.width / currentRatio) : new _Size2.default(bounds.height * currentRatio, bounds.height);
            }
            return size[0].value && (width = size[0].value.getAbsoluteValue(bounds.width)), 
            size[0].size === BACKGROUND_SIZE.AUTO && size[1].size === BACKGROUND_SIZE.AUTO ? height = image.height : size[1].size === BACKGROUND_SIZE.AUTO ? height = width / image.width * image.height : size[1].value && (height = size[1].value.getAbsoluteValue(bounds.height)), 
            size[0].size === BACKGROUND_SIZE.AUTO && (width = height / image.height * image.width), 
            new _Size2.default(width, height);
        }, exports.calculateGradientBackgroundSize = function(backgroundImage, bounds) {
            var size = backgroundImage.size, width = size[0].value ? size[0].value.getAbsoluteValue(bounds.width) : bounds.width, height = size[1].value ? size[1].value.getAbsoluteValue(bounds.height) : size[0].value ? width : bounds.height;
            return new _Size2.default(width, height);
        }, new BackgroundSize("auto")), parseBackgroundClip = (exports.calculateBackgroungPaintingArea = function(curves, clip) {
            switch (clip) {
              case BACKGROUND_CLIP.BORDER_BOX:
                return (0, _Bounds.calculateBorderBoxPath)(curves);

              case BACKGROUND_CLIP.PADDING_BOX:
              default:
                return (0, _Bounds.calculatePaddingBoxPath)(curves);
            }
        }, exports.calculateBackgroungPositioningArea = function(backgroundOrigin, bounds, padding, border) {
            var paddingBox = (0, _Bounds.calculatePaddingBox)(bounds, border);
            switch (backgroundOrigin) {
              case BACKGROUND_ORIGIN.BORDER_BOX:
                return bounds;

              case BACKGROUND_ORIGIN.CONTENT_BOX:
                var paddingLeft = padding[_padding.PADDING_SIDES.LEFT].getAbsoluteValue(bounds.width), paddingRight = padding[_padding.PADDING_SIDES.RIGHT].getAbsoluteValue(bounds.width), paddingTop = padding[_padding.PADDING_SIDES.TOP].getAbsoluteValue(bounds.width), paddingBottom = padding[_padding.PADDING_SIDES.BOTTOM].getAbsoluteValue(bounds.width);
                return new _Bounds.Bounds(paddingBox.left + paddingLeft, paddingBox.top + paddingTop, paddingBox.width - paddingLeft - paddingRight, paddingBox.height - paddingTop - paddingBottom);

              case BACKGROUND_ORIGIN.PADDING_BOX:
              default:
                return paddingBox;
            }
        }, exports.calculateBackgroundPosition = function(position, size, bounds) {
            return new _Vector2.default(position[0].getAbsoluteValue(bounds.width - size.width), position[1].getAbsoluteValue(bounds.height - size.height));
        }, exports.calculateBackgroundRepeatPath = function(background, position, size, backgroundPositioningArea, bounds) {
            switch (background.repeat) {
              case BACKGROUND_REPEAT.REPEAT_X:
                return [ new _Vector2.default(Math.round(bounds.left), Math.round(backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(bounds.left + bounds.width), Math.round(backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(bounds.left + bounds.width), Math.round(size.height + backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(bounds.left), Math.round(size.height + backgroundPositioningArea.top + position.y)) ];

              case BACKGROUND_REPEAT.REPEAT_Y:
                return [ new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x), Math.round(bounds.top)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x + size.width), Math.round(bounds.top)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x + size.width), Math.round(bounds.height + bounds.top)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x), Math.round(bounds.height + bounds.top)) ];

              case BACKGROUND_REPEAT.NO_REPEAT:
                return [ new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x), Math.round(backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x + size.width), Math.round(backgroundPositioningArea.top + position.y)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x + size.width), Math.round(backgroundPositioningArea.top + position.y + size.height)), new _Vector2.default(Math.round(backgroundPositioningArea.left + position.x), Math.round(backgroundPositioningArea.top + position.y + size.height)) ];

              default:
                return [ new _Vector2.default(Math.round(bounds.left), Math.round(bounds.top)), new _Vector2.default(Math.round(bounds.left + bounds.width), Math.round(bounds.top)), new _Vector2.default(Math.round(bounds.left + bounds.width), Math.round(bounds.height + bounds.top)), new _Vector2.default(Math.round(bounds.left), Math.round(bounds.height + bounds.top)) ];
            }
        }, exports.parseBackground = function(style, resourceLoader) {
            return {
                backgroundColor: new _Color2.default(style.backgroundColor),
                backgroundImage: parseBackgroundImages(style, resourceLoader),
                backgroundClip: parseBackgroundClip(style.backgroundClip),
                backgroundOrigin: parseBackgroundOrigin(style.backgroundOrigin)
            };
        }, function(backgroundClip) {
            switch (backgroundClip) {
              case "padding-box":
                return BACKGROUND_CLIP.PADDING_BOX;

              case "content-box":
                return BACKGROUND_CLIP.CONTENT_BOX;
            }
            return BACKGROUND_CLIP.BORDER_BOX;
        }), parseBackgroundOrigin = function(backgroundOrigin) {
            switch (backgroundOrigin) {
              case "padding-box":
                return BACKGROUND_ORIGIN.PADDING_BOX;

              case "content-box":
                return BACKGROUND_ORIGIN.CONTENT_BOX;
            }
            return BACKGROUND_ORIGIN.BORDER_BOX;
        }, parseBackgroundImages = function(style, resourceLoader) {
            var sources = parseBackgroundImage(style.backgroundImage).map(function(backgroundImage) {
                if ("url" === backgroundImage.method) {
                    var key = resourceLoader.loadImage(backgroundImage.args[0]);
                    backgroundImage.args = key ? [ key ] : [];
                }
                return backgroundImage;
            }), positions = style.backgroundPosition.split(","), repeats = style.backgroundRepeat.split(","), sizes = style.backgroundSize.split(",");
            return sources.map(function(source, index) {
                var size = (sizes[index] || "auto").trim().split(" ").map(parseBackgroundSize), position = (positions[index] || "auto").trim().split(" ").map(parseBackgoundPosition);
                return {
                    source: source,
                    repeat: function(backgroundRepeat) {
                        switch (backgroundRepeat.trim()) {
                          case "no-repeat":
                            return BACKGROUND_REPEAT.NO_REPEAT;

                          case "repeat-x":
                          case "repeat no-repeat":
                            return BACKGROUND_REPEAT.REPEAT_X;

                          case "repeat-y":
                          case "no-repeat repeat":
                            return BACKGROUND_REPEAT.REPEAT_Y;

                          case "repeat":
                            return BACKGROUND_REPEAT.REPEAT;
                        }
                        return console.error('Invalid background-repeat value "' + backgroundRepeat + '"'), 
                        BACKGROUND_REPEAT.REPEAT;
                    }("string" == typeof repeats[index] ? repeats[index] : repeats[0]),
                    size: size.length < 2 ? [ size[0], AUTO_SIZE ] : [ size[0], size[1] ],
                    position: position.length < 2 ? [ position[0], position[0] ] : [ position[0], position[1] ]
                };
            });
        }, parseBackgroundSize = function(size) {
            return "auto" === size ? AUTO_SIZE : new BackgroundSize(size);
        }, parseBackgoundPosition = function(position) {
            switch (position) {
              case "bottom":
              case "right":
                return new _Length2.default("100%");

              case "left":
              case "top":
                return new _Length2.default("0%");

              case "auto":
                return new _Length2.default("0");
            }
            return new _Length2.default(position);
        }, parseBackgroundImage = exports.parseBackgroundImage = function(image) {
            var whitespace = /^\s$/, results = [], args = [], method = "", quote = null, definition = "", mode = 0, numParen = 0, appendResult = function() {
                var prefix = "";
                if (method) {
                    '"' === definition.substr(0, 1) && (definition = definition.substr(1, definition.length - 2)), 
                    definition && args.push(definition.trim());
                    var prefix_i = method.indexOf("-", 1) + 1;
                    "-" === method.substr(0, 1) && 0 < prefix_i && (prefix = method.substr(0, prefix_i).toLowerCase(), 
                    method = method.substr(prefix_i)), "none" !== (method = method.toLowerCase()) && results.push({
                        prefix: prefix,
                        method: method,
                        args: args
                    });
                }
                args = [], method = definition = "";
            };
            return image.split("").forEach(function(c) {
                if (0 !== mode || !whitespace.test(c)) {
                    switch (c) {
                      case '"':
                        quote ? quote === c && (quote = null) : quote = c;
                        break;

                      case "(":
                        if (quote) break;
                        if (0 === mode) return void (mode = 1);
                        numParen++;
                        break;

                      case ")":
                        if (quote) break;
                        if (1 === mode) {
                            if (0 === numParen) return mode = 0, void appendResult();
                            numParen--;
                        }
                        break;

                      case ",":
                        if (quote) break;
                        if (0 === mode) return void appendResult();
                        if (1 === mode && 0 === numParen && !method.match(/^url$/i)) return args.push(definition.trim()), 
                        void (definition = "");
                    }
                    0 === mode ? method += c : definition += c;
                }
            }), appendResult(), results;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        exports.PATH = {
            VECTOR: 0,
            BEZIER_CURVE: 1,
            CIRCLE: 2
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var _Path = __webpack_require__(6);
        exports.default = function Vector(x, y) {
            !function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, Vector), this.type = _Path.PATH.VECTOR, this.x = x, this.y = y, isNaN(x) && console.error("Invalid x value given for Vector"), 
            isNaN(y) && console.error("Invalid y value given for Vector");
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.parseListStyle = exports.parseListStyleType = exports.LIST_STYLE_TYPE = exports.LIST_STYLE_POSITION = void 0;
        var _background = __webpack_require__(5), LIST_STYLE_POSITION = exports.LIST_STYLE_POSITION = {
            INSIDE: 0,
            OUTSIDE: 1
        }, LIST_STYLE_TYPE = exports.LIST_STYLE_TYPE = {
            NONE: -1,
            DISC: 0,
            CIRCLE: 1,
            SQUARE: 2,
            DECIMAL: 3,
            CJK_DECIMAL: 4,
            DECIMAL_LEADING_ZERO: 5,
            LOWER_ROMAN: 6,
            UPPER_ROMAN: 7,
            LOWER_GREEK: 8,
            LOWER_ALPHA: 9,
            UPPER_ALPHA: 10,
            ARABIC_INDIC: 11,
            ARMENIAN: 12,
            BENGALI: 13,
            CAMBODIAN: 14,
            CJK_EARTHLY_BRANCH: 15,
            CJK_HEAVENLY_STEM: 16,
            CJK_IDEOGRAPHIC: 17,
            DEVANAGARI: 18,
            ETHIOPIC_NUMERIC: 19,
            GEORGIAN: 20,
            GUJARATI: 21,
            GURMUKHI: 22,
            HEBREW: 22,
            HIRAGANA: 23,
            HIRAGANA_IROHA: 24,
            JAPANESE_FORMAL: 25,
            JAPANESE_INFORMAL: 26,
            KANNADA: 27,
            KATAKANA: 28,
            KATAKANA_IROHA: 29,
            KHMER: 30,
            KOREAN_HANGUL_FORMAL: 31,
            KOREAN_HANJA_FORMAL: 32,
            KOREAN_HANJA_INFORMAL: 33,
            LAO: 34,
            LOWER_ARMENIAN: 35,
            MALAYALAM: 36,
            MONGOLIAN: 37,
            MYANMAR: 38,
            ORIYA: 39,
            PERSIAN: 40,
            SIMP_CHINESE_FORMAL: 41,
            SIMP_CHINESE_INFORMAL: 42,
            TAMIL: 43,
            TELUGU: 44,
            THAI: 45,
            TIBETAN: 46,
            TRAD_CHINESE_FORMAL: 47,
            TRAD_CHINESE_INFORMAL: 48,
            UPPER_ARMENIAN: 49,
            DISCLOSURE_OPEN: 50,
            DISCLOSURE_CLOSED: 51
        }, parseListStyleType = exports.parseListStyleType = function(type) {
            switch (type) {
              case "disc":
                return LIST_STYLE_TYPE.DISC;

              case "circle":
                return LIST_STYLE_TYPE.CIRCLE;

              case "square":
                return LIST_STYLE_TYPE.SQUARE;

              case "decimal":
                return LIST_STYLE_TYPE.DECIMAL;

              case "cjk-decimal":
                return LIST_STYLE_TYPE.CJK_DECIMAL;

              case "decimal-leading-zero":
                return LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO;

              case "lower-roman":
                return LIST_STYLE_TYPE.LOWER_ROMAN;

              case "upper-roman":
                return LIST_STYLE_TYPE.UPPER_ROMAN;

              case "lower-greek":
                return LIST_STYLE_TYPE.LOWER_GREEK;

              case "lower-alpha":
                return LIST_STYLE_TYPE.LOWER_ALPHA;

              case "upper-alpha":
                return LIST_STYLE_TYPE.UPPER_ALPHA;

              case "arabic-indic":
                return LIST_STYLE_TYPE.ARABIC_INDIC;

              case "armenian":
                return LIST_STYLE_TYPE.ARMENIAN;

              case "bengali":
                return LIST_STYLE_TYPE.BENGALI;

              case "cambodian":
                return LIST_STYLE_TYPE.CAMBODIAN;

              case "cjk-earthly-branch":
                return LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH;

              case "cjk-heavenly-stem":
                return LIST_STYLE_TYPE.CJK_HEAVENLY_STEM;

              case "cjk-ideographic":
                return LIST_STYLE_TYPE.CJK_IDEOGRAPHIC;

              case "devanagari":
                return LIST_STYLE_TYPE.DEVANAGARI;

              case "ethiopic-numeric":
                return LIST_STYLE_TYPE.ETHIOPIC_NUMERIC;

              case "georgian":
                return LIST_STYLE_TYPE.GEORGIAN;

              case "gujarati":
                return LIST_STYLE_TYPE.GUJARATI;

              case "gurmukhi":
                return LIST_STYLE_TYPE.GURMUKHI;

              case "hebrew":
                return LIST_STYLE_TYPE.HEBREW;

              case "hiragana":
                return LIST_STYLE_TYPE.HIRAGANA;

              case "hiragana-iroha":
                return LIST_STYLE_TYPE.HIRAGANA_IROHA;

              case "japanese-formal":
                return LIST_STYLE_TYPE.JAPANESE_FORMAL;

              case "japanese-informal":
                return LIST_STYLE_TYPE.JAPANESE_INFORMAL;

              case "kannada":
                return LIST_STYLE_TYPE.KANNADA;

              case "katakana":
                return LIST_STYLE_TYPE.KATAKANA;

              case "katakana-iroha":
                return LIST_STYLE_TYPE.KATAKANA_IROHA;

              case "khmer":
                return LIST_STYLE_TYPE.KHMER;

              case "korean-hangul-formal":
                return LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL;

              case "korean-hanja-formal":
                return LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL;

              case "korean-hanja-informal":
                return LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL;

              case "lao":
                return LIST_STYLE_TYPE.LAO;

              case "lower-armenian":
                return LIST_STYLE_TYPE.LOWER_ARMENIAN;

              case "malayalam":
                return LIST_STYLE_TYPE.MALAYALAM;

              case "mongolian":
                return LIST_STYLE_TYPE.MONGOLIAN;

              case "myanmar":
                return LIST_STYLE_TYPE.MYANMAR;

              case "oriya":
                return LIST_STYLE_TYPE.ORIYA;

              case "persian":
                return LIST_STYLE_TYPE.PERSIAN;

              case "simp-chinese-formal":
                return LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL;

              case "simp-chinese-informal":
                return LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL;

              case "tamil":
                return LIST_STYLE_TYPE.TAMIL;

              case "telugu":
                return LIST_STYLE_TYPE.TELUGU;

              case "thai":
                return LIST_STYLE_TYPE.THAI;

              case "tibetan":
                return LIST_STYLE_TYPE.TIBETAN;

              case "trad-chinese-formal":
                return LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL;

              case "trad-chinese-informal":
                return LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL;

              case "upper-armenian":
                return LIST_STYLE_TYPE.UPPER_ARMENIAN;

              case "disclosure-open":
                return LIST_STYLE_TYPE.DISCLOSURE_OPEN;

              case "disclosure-closed":
                return LIST_STYLE_TYPE.DISCLOSURE_CLOSED;

              case "none":
              default:
                return LIST_STYLE_TYPE.NONE;
            }
        }, parseListStylePosition = (exports.parseListStyle = function(style) {
            var listStyleImage = (0, _background.parseBackgroundImage)(style.getPropertyValue("list-style-image"));
            return {
                listStyleType: parseListStyleType(style.getPropertyValue("list-style-type")),
                listStyleImage: listStyleImage.length ? listStyleImage[0] : null,
                listStylePosition: parseListStylePosition(style.getPropertyValue("list-style-position"))
            };
        }, function(position) {
            switch (position) {
              case "inside":
                return LIST_STYLE_POSITION.INSIDE;

              case "outside":
              default:
                return LIST_STYLE_POSITION.OUTSIDE;
            }
        });
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _textTransform = __webpack_require__(20), _TextBounds = __webpack_require__(22);
        var TextContainer = function() {
            function TextContainer(text, parent, bounds) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, TextContainer), this.text = text, this.parent = parent, this.bounds = bounds;
            }
            return _createClass(TextContainer, null, [ {
                key: "fromTextNode",
                value: function(node, parent) {
                    var text = transform(node.data, parent.style.textTransform);
                    return new TextContainer(text, parent, (0, _TextBounds.parseTextBounds)(text, parent, node));
                }
            } ]), TextContainer;
        }();
        exports.default = TextContainer;
        var CAPITALIZE = /(^|\s|:|-|\(|\))([a-z])/g, transform = function(text, _transform) {
            switch (_transform) {
              case _textTransform.TEXT_TRANSFORM.LOWERCASE:
                return text.toLowerCase();

              case _textTransform.TEXT_TRANSFORM.CAPITALIZE:
                return text.replace(CAPITALIZE, capitalize);

              case _textTransform.TEXT_TRANSFORM.UPPERCASE:
                return text.toUpperCase();

              default:
                return text;
            }
        };
        function capitalize(m, p1, p2) {
            return 0 < m.length ? p1 + p2.toUpperCase() : m;
        }
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var _ForeignObjectRenderer = __webpack_require__(23), isGreenPixel = function(data) {
            return 0 === data[0] && 255 === data[1] && 0 === data[2] && 255 === data[3];
        }, FEATURES = {
            get SUPPORT_RANGE_BOUNDS() {
                var value = function(document) {
                    if (document.createRange) {
                        var range = document.createRange();
                        if (range.getBoundingClientRect) {
                            var testElement = document.createElement("boundtest");
                            testElement.style.height = "123px", testElement.style.display = "block", document.body.appendChild(testElement), 
                            range.selectNode(testElement);
                            var rangeBounds = range.getBoundingClientRect(), rangeHeight = Math.round(rangeBounds.height);
                            if (document.body.removeChild(testElement), 123 === rangeHeight) return !0;
                        }
                    }
                    return !1;
                }(document);
                return Object.defineProperty(FEATURES, "SUPPORT_RANGE_BOUNDS", {
                    value: value
                }), value;
            },
            get SUPPORT_SVG_DRAWING() {
                var value = function(document) {
                    var img = new Image(), canvas = document.createElement("canvas"), ctx = canvas.getContext("2d");
                    img.src = "data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg'></svg>";
                    try {
                        ctx.drawImage(img, 0, 0), canvas.toDataURL();
                    } catch (e) {
                        return !1;
                    }
                    return !0;
                }(document);
                return Object.defineProperty(FEATURES, "SUPPORT_SVG_DRAWING", {
                    value: value
                }), value;
            },
            get SUPPORT_BASE64_DRAWING() {
                return function(src) {
                    var _value = function(document, src) {
                        var img = new Image(), canvas = document.createElement("canvas"), ctx = canvas.getContext("2d");
                        return new Promise(function(resolve) {
                            img.src = src;
                            var onload = function() {
                                try {
                                    ctx.drawImage(img, 0, 0), canvas.toDataURL();
                                } catch (e) {
                                    return resolve(!1);
                                }
                                return resolve(!0);
                            };
                            img.onload = onload, img.onerror = function() {
                                return resolve(!1);
                            }, !0 === img.complete && setTimeout(function() {
                                onload();
                            }, 500);
                        });
                    }(document, src);
                    return Object.defineProperty(FEATURES, "SUPPORT_BASE64_DRAWING", {
                        value: function() {
                            return _value;
                        }
                    }), _value;
                };
            },
            get SUPPORT_FOREIGNOBJECT_DRAWING() {
                var value = "function" == typeof Array.from && "function" == typeof window.fetch ? function(document) {
                    var canvas = document.createElement("canvas");
                    canvas.width = 100, canvas.height = 100;
                    var ctx = canvas.getContext("2d");
                    ctx.fillStyle = "rgb(0, 255, 0)", ctx.fillRect(0, 0, 100, 100);
                    var img = new Image(), greenImageSrc = canvas.toDataURL();
                    img.src = greenImageSrc;
                    var svg = (0, _ForeignObjectRenderer.createForeignObjectSVG)(100, 100, 0, 0, img);
                    return ctx.fillStyle = "red", ctx.fillRect(0, 0, 100, 100), (0, _ForeignObjectRenderer.loadSerializedSVG)(svg).then(function(img) {
                        ctx.drawImage(img, 0, 0);
                        var data = ctx.getImageData(0, 0, 100, 100).data;
                        ctx.fillStyle = "red", ctx.fillRect(0, 0, 100, 100);
                        var node = document.createElement("div");
                        return node.style.backgroundImage = "url(" + greenImageSrc + ")", node.style.height = "100px", 
                        isGreenPixel(data) ? (0, _ForeignObjectRenderer.loadSerializedSVG)((0, _ForeignObjectRenderer.createForeignObjectSVG)(100, 100, 0, 0, node)) : Promise.reject(!1);
                    }).then(function(img) {
                        return ctx.drawImage(img, 0, 0), isGreenPixel(ctx.getImageData(0, 0, 100, 100).data);
                    }).catch(function(e) {
                        return !1;
                    });
                }(document) : Promise.resolve(!1);
                return Object.defineProperty(FEATURES, "SUPPORT_FOREIGNOBJECT_DRAWING", {
                    value: value
                }), value;
            },
            get SUPPORT_CORS_IMAGES() {
                var value = void 0 !== new Image().crossOrigin;
                return Object.defineProperty(FEATURES, "SUPPORT_CORS_IMAGES", {
                    value: value
                }), value;
            },
            get SUPPORT_RESPONSE_TYPE() {
                var value = "string" == typeof new XMLHttpRequest().responseType;
                return Object.defineProperty(FEATURES, "SUPPORT_RESPONSE_TYPE", {
                    value: value
                }), value;
            },
            get SUPPORT_CORS_XHR() {
                var value = "withCredentials" in new XMLHttpRequest();
                return Object.defineProperty(FEATURES, "SUPPORT_CORS_XHR", {
                    value: value
                }), value;
            }
        };
        exports.default = FEATURES;
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.parseTextDecoration = exports.TEXT_DECORATION_LINE = exports.TEXT_DECORATION = exports.TEXT_DECORATION_STYLE = void 0;
        var obj, _Color = __webpack_require__(0), _Color2 = (obj = _Color) && obj.__esModule ? obj : {
            default: obj
        };
        var TEXT_DECORATION_STYLE = exports.TEXT_DECORATION_STYLE = {
            SOLID: 0,
            DOUBLE: 1,
            DOTTED: 2,
            DASHED: 3,
            WAVY: 4
        }, TEXT_DECORATION = exports.TEXT_DECORATION = {
            NONE: null
        }, TEXT_DECORATION_LINE = exports.TEXT_DECORATION_LINE = {
            UNDERLINE: 1,
            OVERLINE: 2,
            LINE_THROUGH: 3,
            BLINK: 4
        }, parseLine = function(line) {
            switch (line) {
              case "underline":
                return TEXT_DECORATION_LINE.UNDERLINE;

              case "overline":
                return TEXT_DECORATION_LINE.OVERLINE;

              case "line-through":
                return TEXT_DECORATION_LINE.LINE_THROUGH;
            }
            return TEXT_DECORATION_LINE.BLINK;
        };
        exports.parseTextDecoration = function(style) {
            var line, textDecorationLine = "none" === (line = style.textDecorationLine ? style.textDecorationLine : style.textDecoration) ? null : line.split(" ").map(parseLine);
            return null === textDecorationLine ? TEXT_DECORATION.NONE : {
                textDecorationLine: textDecorationLine,
                textDecorationColor: style.textDecorationColor ? new _Color2.default(style.textDecorationColor) : null,
                textDecorationStyle: function(style) {
                    switch (style) {
                      case "double":
                        return TEXT_DECORATION_STYLE.DOUBLE;

                      case "dotted":
                        return TEXT_DECORATION_STYLE.DOTTED;

                      case "dashed":
                        return TEXT_DECORATION_STYLE.DASHED;

                      case "wavy":
                        return TEXT_DECORATION_STYLE.WAVY;
                    }
                    return TEXT_DECORATION_STYLE.SOLID;
                }(style.textDecorationStyle)
            };
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.parseBorder = exports.BORDER_SIDES = exports.BORDER_STYLE = void 0;
        var obj, _Color = __webpack_require__(0), _Color2 = (obj = _Color) && obj.__esModule ? obj : {
            default: obj
        };
        var BORDER_STYLE = exports.BORDER_STYLE = {
            NONE: 0,
            SOLID: 1
        }, BORDER_SIDES = exports.BORDER_SIDES = {
            TOP: 0,
            RIGHT: 1,
            BOTTOM: 2,
            LEFT: 3
        }, SIDES = Object.keys(BORDER_SIDES).map(function(s) {
            return s.toLowerCase();
        });
        exports.parseBorder = function(style) {
            return SIDES.map(function(side) {
                var borderColor = new _Color2.default(style.getPropertyValue("border-" + side + "-color")), borderStyle = function(style) {
                    switch (style) {
                      case "none":
                        return BORDER_STYLE.NONE;
                    }
                    return BORDER_STYLE.SOLID;
                }(style.getPropertyValue("border-" + side + "-style")), borderWidth = parseFloat(style.getPropertyValue("border-" + side + "-width"));
                return {
                    borderColor: borderColor,
                    borderStyle: borderStyle,
                    borderWidth: isNaN(borderWidth) ? 0 : borderWidth
                };
            });
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        exports.toCodePoints = function(str) {
            for (var codePoints = [], i = 0, length = str.length; i < length; ) {
                var value = str.charCodeAt(i++);
                if (55296 <= value && value <= 56319 && i < length) {
                    var extra = str.charCodeAt(i++);
                    56320 == (64512 & extra) ? codePoints.push(((1023 & value) << 10) + (1023 & extra) + 65536) : (codePoints.push(value), 
                    i--);
                } else codePoints.push(value);
            }
            return codePoints;
        }, exports.fromCodePoint = function() {
            if (String.fromCodePoint) return String.fromCodePoint.apply(String, arguments);
            var length = arguments.length;
            if (!length) return "";
            for (var codeUnits = [], index = -1, result = ""; ++index < length; ) {
                var codePoint = arguments.length <= index ? void 0 : arguments[index];
                codePoint <= 65535 ? codeUnits.push(codePoint) : (codePoint -= 65536, codeUnits.push(55296 + (codePoint >> 10), codePoint % 1024 + 56320)), 
                (index + 1 === length || 16384 < codeUnits.length) && (result += String.fromCharCode.apply(String, codeUnits), 
                codeUnits.length = 0);
            }
            return result;
        };
        for (var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", lookup = "undefined" == typeof Uint8Array ? [] : new Uint8Array(256), i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i;
        exports.decode = function(base64) {
            var bufferLength = .75 * base64.length, len = base64.length, i = void 0, p = 0, encoded1 = void 0, encoded2 = void 0, encoded3 = void 0, encoded4 = void 0;
            "=" === base64[base64.length - 1] && (bufferLength--, "=" === base64[base64.length - 2] && bufferLength--);
            var buffer = "undefined" != typeof ArrayBuffer && "undefined" != typeof Uint8Array && void 0 !== Uint8Array.prototype.slice ? new ArrayBuffer(bufferLength) : new Array(bufferLength), bytes = Array.isArray(buffer) ? buffer : new Uint8Array(buffer);
            for (i = 0; i < len; i += 4) encoded1 = lookup[base64.charCodeAt(i)], encoded2 = lookup[base64.charCodeAt(i + 1)], 
            encoded3 = lookup[base64.charCodeAt(i + 2)], encoded4 = lookup[base64.charCodeAt(i + 3)], 
            bytes[p++] = encoded1 << 2 | encoded2 >> 4, bytes[p++] = (15 & encoded2) << 4 | encoded3 >> 2, 
            bytes[p++] = (3 & encoded3) << 6 | 63 & encoded4;
            return buffer;
        }, exports.polyUint16Array = function(buffer) {
            for (var length = buffer.length, bytes = [], _i = 0; _i < length; _i += 2) bytes.push(buffer[_i + 1] << 8 | buffer[_i]);
            return bytes;
        }, exports.polyUint32Array = function(buffer) {
            for (var length = buffer.length, bytes = [], _i2 = 0; _i2 < length; _i2 += 4) bytes.push(buffer[_i2 + 3] << 24 | buffer[_i2 + 2] << 16 | buffer[_i2 + 1] << 8 | buffer[_i2]);
            return bytes;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.createCounterText = exports.inlineListItemElement = exports.getListOwner = void 0;
        var _Util = __webpack_require__(4), _NodeContainer2 = _interopRequireDefault(__webpack_require__(3)), _TextContainer2 = _interopRequireDefault(__webpack_require__(9)), _listStyle = __webpack_require__(8), _Unicode = __webpack_require__(24);
        function _interopRequireDefault(obj) {
            return obj && obj.__esModule ? obj : {
                default: obj
            };
        }
        var ancestorTypes = [ "OL", "UL", "MENU" ], ROMAN_UPPER = (exports.getListOwner = function(container) {
            var parent = container.parent;
            if (!parent) return null;
            do {
                if (-1 !== ancestorTypes.indexOf(parent.tagName)) return parent;
                parent = parent.parent;
            } while (parent);
            return container.parent;
        }, exports.inlineListItemElement = function(node, container, resourceLoader) {
            var listStyle = container.style.listStyle;
            if (listStyle) {
                var style = node.ownerDocument.defaultView.getComputedStyle(node, null), wrapper = node.ownerDocument.createElement("html2canvaswrapper");
                switch ((0, _Util.copyCSSStyles)(style, wrapper), wrapper.style.position = "absolute", 
                wrapper.style.bottom = "auto", wrapper.style.display = "block", wrapper.style.letterSpacing = "normal", 
                listStyle.listStylePosition) {
                  case _listStyle.LIST_STYLE_POSITION.OUTSIDE:
                    wrapper.style.left = "auto", wrapper.style.right = node.ownerDocument.defaultView.innerWidth - container.bounds.left - container.style.margin[1].getAbsoluteValue(container.bounds.width) + 7 + "px", 
                    wrapper.style.textAlign = "right";
                    break;

                  case _listStyle.LIST_STYLE_POSITION.INSIDE:
                    wrapper.style.left = container.bounds.left - container.style.margin[3].getAbsoluteValue(container.bounds.width) + "px", 
                    wrapper.style.right = "auto", wrapper.style.textAlign = "left";
                }
                var text = void 0, MARGIN_TOP = container.style.margin[0].getAbsoluteValue(container.bounds.width), styleImage = listStyle.listStyleImage;
                if (styleImage) if ("url" === styleImage.method) {
                    var image = node.ownerDocument.createElement("img");
                    image.src = styleImage.args[0], wrapper.style.top = container.bounds.top - MARGIN_TOP + "px", 
                    wrapper.style.width = "auto", wrapper.style.height = "auto", wrapper.appendChild(image);
                } else {
                    var size = .5 * parseFloat(container.style.font.fontSize);
                    wrapper.style.top = container.bounds.top - MARGIN_TOP + container.bounds.height - 1.5 * size + "px", 
                    wrapper.style.width = size + "px", wrapper.style.height = size + "px", wrapper.style.backgroundImage = style.listStyleImage;
                } else "number" == typeof container.listIndex && (text = node.ownerDocument.createTextNode(createCounterText(container.listIndex, listStyle.listStyleType, !0)), 
                wrapper.appendChild(text), wrapper.style.top = container.bounds.top - MARGIN_TOP + "px");
                var body = node.ownerDocument.body;
                body.appendChild(wrapper), text ? (container.childNodes.push(_TextContainer2.default.fromTextNode(text, container)), 
                body.removeChild(wrapper)) : container.childNodes.push(new _NodeContainer2.default(wrapper, container, resourceLoader, 0));
            }
        }, {
            integers: [ 1e3, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 ],
            values: [ "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I" ]
        }), ARMENIAN = {
            integers: [ 9e3, 8e3, 7e3, 6e3, 5e3, 4e3, 3e3, 2e3, 1e3, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 ],
            values: [ "Ք", "Փ", "Ւ", "Ց", "Ր", "Տ", "Վ", "Ս", "Ռ", "Ջ", "Պ", "Չ", "Ո", "Շ", "Ն", "Յ", "Մ", "Ճ", "Ղ", "Ձ", "Հ", "Կ", "Ծ", "Խ", "Լ", "Ի", "Ժ", "Թ", "Ը", "Է", "Զ", "Ե", "Դ", "Գ", "Բ", "Ա" ]
        }, HEBREW = {
            integers: [ 1e4, 9e3, 8e3, 7e3, 6e3, 5e3, 4e3, 3e3, 2e3, 1e3, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 19, 18, 17, 16, 15, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 ],
            values: [ "י׳", "ט׳", "ח׳", "ז׳", "ו׳", "ה׳", "ד׳", "ג׳", "ב׳", "א׳", "ת", "ש", "ר", "ק", "צ", "פ", "ע", "ס", "נ", "מ", "ל", "כ", "יט", "יח", "יז", "טז", "טו", "י", "ט", "ח", "ז", "ו", "ה", "ד", "ג", "ב", "א" ]
        }, GEORGIAN = {
            integers: [ 1e4, 9e3, 8e3, 7e3, 6e3, 5e3, 4e3, 3e3, 2e3, 1e3, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 ],
            values: [ "ჵ", "ჰ", "ჯ", "ჴ", "ხ", "ჭ", "წ", "ძ", "ც", "ჩ", "შ", "ყ", "ღ", "ქ", "ფ", "ჳ", "ტ", "ს", "რ", "ჟ", "პ", "ო", "ჲ", "ნ", "მ", "ლ", "კ", "ი", "თ", "ჱ", "ზ", "ვ", "ე", "დ", "გ", "ბ", "ა" ]
        }, createAdditiveCounter = function(value, min, max, symbols, fallback, suffix) {
            return value < min || max < value ? createCounterText(value, fallback, 0 < suffix.length) : symbols.integers.reduce(function(string, integer, index) {
                for (;integer <= value; ) value -= integer, string += symbols.values[index];
                return string;
            }, "") + suffix;
        }, createCounterStyleWithSymbolResolver = function(value, codePointRangeLength, isNumeric, resolver) {
            for (var string = ""; isNumeric || value--, string = resolver(value) + string, codePointRangeLength <= (value /= codePointRangeLength) * codePointRangeLength; ) ;
            return string;
        }, createCounterStyleFromRange = function(value, codePointRangeStart, codePointRangeEnd, isNumeric, suffix) {
            var codePointRangeLength = codePointRangeEnd - codePointRangeStart + 1;
            return (value < 0 ? "-" : "") + (createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, isNumeric, function(codePoint) {
                return (0, _Unicode.fromCodePoint)(Math.floor(codePoint % codePointRangeLength) + codePointRangeStart);
            }) + suffix);
        }, createCounterStyleFromSymbols = function(value, symbols) {
            var suffix = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : ". ", codePointRangeLength = symbols.length;
            return createCounterStyleWithSymbolResolver(Math.abs(value), codePointRangeLength, !1, function(codePoint) {
                return symbols[Math.floor(codePoint % codePointRangeLength)];
            }) + suffix;
        }, createCJKCounter = function(value, numbers, multipliers, negativeSign, suffix, flags) {
            if (value < -9999 || 9999 < value) return createCounterText(value, _listStyle.LIST_STYLE_TYPE.CJK_DECIMAL, 0 < suffix.length);
            var tmp = Math.abs(value), string = suffix;
            if (0 === tmp) return numbers[0] + string;
            for (var digit = 0; 0 < tmp && digit <= 4; digit++) {
                var coefficient = tmp % 10;
                0 === coefficient && (0, _Util.contains)(flags, 1) && "" !== string ? string = numbers[coefficient] + string : 1 < coefficient || 1 === coefficient && 0 === digit || 1 === coefficient && 1 === digit && (0, 
                _Util.contains)(flags, 2) || 1 === coefficient && 1 === digit && (0, _Util.contains)(flags, 4) && 100 < value || 1 === coefficient && 1 < digit && (0, 
                _Util.contains)(flags, 8) ? string = numbers[coefficient] + (0 < digit ? multipliers[digit - 1] : "") + string : 1 === coefficient && 0 < digit && (string = multipliers[digit - 1] + string), 
                tmp = Math.floor(tmp / 10);
            }
            return (value < 0 ? negativeSign : "") + string;
        }, createCounterText = exports.createCounterText = function(value, type, appendSuffix) {
            var defaultSuffix = appendSuffix ? ". " : "", cjkSuffix = appendSuffix ? "、" : "", koreanSuffix = appendSuffix ? ", " : "";
            switch (type) {
              case _listStyle.LIST_STYLE_TYPE.DISC:
                return "•";

              case _listStyle.LIST_STYLE_TYPE.CIRCLE:
                return "◦";

              case _listStyle.LIST_STYLE_TYPE.SQUARE:
                return "◾";

              case _listStyle.LIST_STYLE_TYPE.DECIMAL_LEADING_ZERO:
                var string = createCounterStyleFromRange(value, 48, 57, !0, defaultSuffix);
                return string.length < 4 ? "0" + string : string;

              case _listStyle.LIST_STYLE_TYPE.CJK_DECIMAL:
                return createCounterStyleFromSymbols(value, "〇一二三四五六七八九", cjkSuffix);

              case _listStyle.LIST_STYLE_TYPE.LOWER_ROMAN:
                return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix).toLowerCase();

              case _listStyle.LIST_STYLE_TYPE.UPPER_ROMAN:
                return createAdditiveCounter(value, 1, 3999, ROMAN_UPPER, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.LOWER_GREEK:
                return createCounterStyleFromRange(value, 945, 969, !1, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.LOWER_ALPHA:
                return createCounterStyleFromRange(value, 97, 122, !1, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.UPPER_ALPHA:
                return createCounterStyleFromRange(value, 65, 90, !1, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.ARABIC_INDIC:
                return createCounterStyleFromRange(value, 1632, 1641, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.ARMENIAN:
              case _listStyle.LIST_STYLE_TYPE.UPPER_ARMENIAN:
                return createAdditiveCounter(value, 1, 9999, ARMENIAN, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.LOWER_ARMENIAN:
                return createAdditiveCounter(value, 1, 9999, ARMENIAN, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix).toLowerCase();

              case _listStyle.LIST_STYLE_TYPE.BENGALI:
                return createCounterStyleFromRange(value, 2534, 2543, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.CAMBODIAN:
              case _listStyle.LIST_STYLE_TYPE.KHMER:
                return createCounterStyleFromRange(value, 6112, 6121, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.CJK_EARTHLY_BRANCH:
                return createCounterStyleFromSymbols(value, "子丑寅卯辰巳午未申酉戌亥", cjkSuffix);

              case _listStyle.LIST_STYLE_TYPE.CJK_HEAVENLY_STEM:
                return createCounterStyleFromSymbols(value, "甲乙丙丁戊己庚辛壬癸", cjkSuffix);

              case _listStyle.LIST_STYLE_TYPE.CJK_IDEOGRAPHIC:
              case _listStyle.LIST_STYLE_TYPE.TRAD_CHINESE_INFORMAL:
                return createCJKCounter(value, "零一二三四五六七八九", "十百千萬", "負", cjkSuffix, 14);

              case _listStyle.LIST_STYLE_TYPE.TRAD_CHINESE_FORMAL:
                return createCJKCounter(value, "零壹貳參肆伍陸柒捌玖", "拾佰仟萬", "負", cjkSuffix, 15);

              case _listStyle.LIST_STYLE_TYPE.SIMP_CHINESE_INFORMAL:
                return createCJKCounter(value, "零一二三四五六七八九", "十百千萬", "负", cjkSuffix, 14);

              case _listStyle.LIST_STYLE_TYPE.SIMP_CHINESE_FORMAL:
                return createCJKCounter(value, "零壹贰叁肆伍陆柒捌玖", "拾佰仟萬", "负", cjkSuffix, 15);

              case _listStyle.LIST_STYLE_TYPE.JAPANESE_INFORMAL:
                return createCJKCounter(value, "〇一二三四五六七八九", "十百千万", "マイナス", cjkSuffix, 0);

              case _listStyle.LIST_STYLE_TYPE.JAPANESE_FORMAL:
                return createCJKCounter(value, "零壱弐参四伍六七八九", "拾百千万", "マイナス", cjkSuffix, 7);

              case _listStyle.LIST_STYLE_TYPE.KOREAN_HANGUL_FORMAL:
                return createCJKCounter(value, "영일이삼사오육칠팔구", "십백천만", "마이너스 ", koreanSuffix, 7);

              case _listStyle.LIST_STYLE_TYPE.KOREAN_HANJA_INFORMAL:
                return createCJKCounter(value, "零一二三四五六七八九", "十百千萬", "마이너스 ", koreanSuffix, 0);

              case _listStyle.LIST_STYLE_TYPE.KOREAN_HANJA_FORMAL:
                return createCJKCounter(value, "零壹貳參四五六七八九", "拾百千", "마이너스 ", koreanSuffix, 7);

              case _listStyle.LIST_STYLE_TYPE.DEVANAGARI:
                return createCounterStyleFromRange(value, 2406, 2415, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.GEORGIAN:
                return createAdditiveCounter(value, 1, 19999, GEORGIAN, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.GUJARATI:
                return createCounterStyleFromRange(value, 2790, 2799, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.GURMUKHI:
                return createCounterStyleFromRange(value, 2662, 2671, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.HEBREW:
                return createAdditiveCounter(value, 1, 10999, HEBREW, _listStyle.LIST_STYLE_TYPE.DECIMAL, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.HIRAGANA:
                return createCounterStyleFromSymbols(value, "あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");

              case _listStyle.LIST_STYLE_TYPE.HIRAGANA_IROHA:
                return createCounterStyleFromSymbols(value, "いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");

              case _listStyle.LIST_STYLE_TYPE.KANNADA:
                return createCounterStyleFromRange(value, 3302, 3311, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.KATAKANA:
                return createCounterStyleFromSymbols(value, "アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン", cjkSuffix);

              case _listStyle.LIST_STYLE_TYPE.KATAKANA_IROHA:
                return createCounterStyleFromSymbols(value, "イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス", cjkSuffix);

              case _listStyle.LIST_STYLE_TYPE.LAO:
                return createCounterStyleFromRange(value, 3792, 3801, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.MONGOLIAN:
                return createCounterStyleFromRange(value, 6160, 6169, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.MYANMAR:
                return createCounterStyleFromRange(value, 4160, 4169, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.ORIYA:
                return createCounterStyleFromRange(value, 2918, 2927, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.PERSIAN:
                return createCounterStyleFromRange(value, 1776, 1785, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.TAMIL:
                return createCounterStyleFromRange(value, 3046, 3055, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.TELUGU:
                return createCounterStyleFromRange(value, 3174, 3183, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.THAI:
                return createCounterStyleFromRange(value, 3664, 3673, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.TIBETAN:
                return createCounterStyleFromRange(value, 3872, 3881, !0, defaultSuffix);

              case _listStyle.LIST_STYLE_TYPE.DECIMAL:
              default:
                return createCounterStyleFromRange(value, 48, 57, !0, defaultSuffix);
            }
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _Path = __webpack_require__(6), _textDecoration = __webpack_require__(11);
        var addColorStops = function(gradient, canvasGradient) {
            var maxStop = Math.max.apply(null, gradient.colorStops.map(function(colorStop) {
                return colorStop.stop;
            })), f = 1 / Math.max(1, maxStop);
            gradient.colorStops.forEach(function(colorStop) {
                canvasGradient.addColorStop(f * colorStop.stop, colorStop.color.toString());
            });
        }, CanvasRenderer = function() {
            function CanvasRenderer(canvas) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, CanvasRenderer), this.canvas = canvas || document.createElement("canvas");
            }
            return _createClass(CanvasRenderer, [ {
                key: "render",
                value: function(options) {
                    this.ctx = this.canvas.getContext("2d"), this.options = options, this.canvas.width = Math.floor(options.width * options.scale), 
                    this.canvas.height = Math.floor(options.height * options.scale), this.canvas.style.width = options.width + "px", 
                    this.canvas.style.height = options.height + "px", this.ctx.scale(this.options.scale, this.options.scale), 
                    this.ctx.translate(-options.x, -options.y), this.ctx.textBaseline = "bottom", options.logger.log("Canvas renderer initialized (" + options.width + "x" + options.height + " at " + options.x + "," + options.y + ") with scale " + this.options.scale);
                }
            }, {
                key: "clip",
                value: function(clipPaths, callback) {
                    var _this = this;
                    clipPaths.length && (this.ctx.save(), clipPaths.forEach(function(path) {
                        _this.path(path), _this.ctx.clip();
                    })), callback(), clipPaths.length && this.ctx.restore();
                }
            }, {
                key: "drawImage",
                value: function(image, source, destination) {
                    this.ctx.drawImage(image, source.left, source.top, source.width, source.height, destination.left, destination.top, destination.width, destination.height);
                }
            }, {
                key: "drawShape",
                value: function(path, color) {
                    this.path(path), this.ctx.fillStyle = color.toString(), this.ctx.fill();
                }
            }, {
                key: "fill",
                value: function(color) {
                    this.ctx.fillStyle = color.toString(), this.ctx.fill();
                }
            }, {
                key: "getTarget",
                value: function() {
                    return this.canvas.getContext("2d").setTransform(1, 0, 0, 1, 0, 0), Promise.resolve(this.canvas);
                }
            }, {
                key: "path",
                value: function(_path) {
                    var _this2 = this;
                    this.ctx.beginPath(), Array.isArray(_path) ? _path.forEach(function(point, index) {
                        var start = point.type === _Path.PATH.VECTOR ? point : point.start;
                        0 === index ? _this2.ctx.moveTo(start.x, start.y) : _this2.ctx.lineTo(start.x, start.y), 
                        point.type === _Path.PATH.BEZIER_CURVE && _this2.ctx.bezierCurveTo(point.startControl.x, point.startControl.y, point.endControl.x, point.endControl.y, point.end.x, point.end.y);
                    }) : this.ctx.arc(_path.x + _path.radius, _path.y + _path.radius, _path.radius, 0, 2 * Math.PI, !0), 
                    this.ctx.closePath();
                }
            }, {
                key: "rectangle",
                value: function(x, y, width, height, color) {
                    this.ctx.fillStyle = color.toString(), this.ctx.fillRect(x, y, width, height);
                }
            }, {
                key: "renderLinearGradient",
                value: function(bounds, gradient) {
                    var linearGradient = this.ctx.createLinearGradient(bounds.left + gradient.direction.x1, bounds.top + gradient.direction.y1, bounds.left + gradient.direction.x0, bounds.top + gradient.direction.y0);
                    addColorStops(gradient, linearGradient), this.ctx.fillStyle = linearGradient, this.ctx.fillRect(bounds.left, bounds.top, bounds.width, bounds.height);
                }
            }, {
                key: "renderRadialGradient",
                value: function(bounds, gradient) {
                    var _this3 = this, x = bounds.left + gradient.center.x, y = bounds.top + gradient.center.y, radialGradient = this.ctx.createRadialGradient(x, y, 0, x, y, gradient.radius.x);
                    if (radialGradient) if (addColorStops(gradient, radialGradient), this.ctx.fillStyle = radialGradient, 
                    gradient.radius.x !== gradient.radius.y) {
                        var midX = bounds.left + .5 * bounds.width, midY = bounds.top + .5 * bounds.height, f = gradient.radius.y / gradient.radius.x, invF = 1 / f;
                        this.transform(midX, midY, [ 1, 0, 0, f, 0, 0 ], function() {
                            return _this3.ctx.fillRect(bounds.left, invF * (bounds.top - midY) + midY, bounds.width, bounds.height * invF);
                        });
                    } else this.ctx.fillRect(bounds.left, bounds.top, bounds.width, bounds.height);
                }
            }, {
                key: "renderRepeat",
                value: function(path, image, imageSize, offsetX, offsetY) {
                    this.path(path), this.ctx.fillStyle = this.ctx.createPattern(this.resizeImage(image, imageSize), "repeat"), 
                    this.ctx.translate(offsetX, offsetY), this.ctx.fill(), this.ctx.translate(-offsetX, -offsetY);
                }
            }, {
                key: "renderTextNode",
                value: function(textBounds, color, font, textDecoration, textShadows) {
                    var _this4 = this;
                    this.ctx.font = [ font.fontStyle, font.fontVariant, font.fontWeight, font.fontSize, font.fontFamily ].join(" "), 
                    textBounds.forEach(function(text) {
                        if (_this4.ctx.fillStyle = color.toString(), textShadows && text.text.trim().length ? textShadows.slice(0).reverse().forEach(function(textShadow) {
                            _this4.ctx.shadowColor = textShadow.color.toString(), _this4.ctx.shadowOffsetX = textShadow.offsetX * _this4.options.scale, 
                            _this4.ctx.shadowOffsetY = textShadow.offsetY * _this4.options.scale, _this4.ctx.shadowBlur = textShadow.blur, 
                            _this4.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height);
                        }) : _this4.ctx.fillText(text.text, text.bounds.left, text.bounds.top + text.bounds.height), 
                        null !== textDecoration) {
                            var textDecorationColor = textDecoration.textDecorationColor || color;
                            textDecoration.textDecorationLine.forEach(function(textDecorationLine) {
                                switch (textDecorationLine) {
                                  case _textDecoration.TEXT_DECORATION_LINE.UNDERLINE:
                                    var baseline = _this4.options.fontMetrics.getMetrics(font).baseline;
                                    _this4.rectangle(text.bounds.left, Math.round(text.bounds.top + baseline), text.bounds.width, 1, textDecorationColor);
                                    break;

                                  case _textDecoration.TEXT_DECORATION_LINE.OVERLINE:
                                    _this4.rectangle(text.bounds.left, Math.round(text.bounds.top), text.bounds.width, 1, textDecorationColor);
                                    break;

                                  case _textDecoration.TEXT_DECORATION_LINE.LINE_THROUGH:
                                    var middle = _this4.options.fontMetrics.getMetrics(font).middle;
                                    _this4.rectangle(text.bounds.left, Math.ceil(text.bounds.top + middle), text.bounds.width, 1, textDecorationColor);
                                }
                            });
                        }
                    });
                }
            }, {
                key: "resizeImage",
                value: function(image, size) {
                    if (image.width === size.width && image.height === size.height) return image;
                    var canvas = this.canvas.ownerDocument.createElement("canvas");
                    return canvas.width = size.width, canvas.height = size.height, canvas.getContext("2d").drawImage(image, 0, 0, image.width, image.height, 0, 0, size.width, size.height), 
                    canvas;
                }
            }, {
                key: "setOpacity",
                value: function(opacity) {
                    this.ctx.globalAlpha = opacity;
                }
            }, {
                key: "transform",
                value: function(offsetX, offsetY, matrix, callback) {
                    this.ctx.save(), this.ctx.translate(offsetX, offsetY), this.ctx.transform(matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]), 
                    this.ctx.translate(-offsetX, -offsetY), callback(), this.ctx.restore();
                }
            } ]), CanvasRenderer;
        }();
        exports.default = CanvasRenderer;
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }();
        var Logger = function() {
            function Logger(enabled, id, start) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, Logger), this.enabled = "undefined" != typeof window && enabled, this.start = start || Date.now(), 
                this.id = id;
            }
            return _createClass(Logger, [ {
                key: "child",
                value: function(id) {
                    return new Logger(this.enabled, id, this.start);
                }
            }, {
                key: "log",
                value: function() {
                    if (this.enabled && window.console && window.console.log) {
                        for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) args[_key] = arguments[_key];
                        Function.prototype.bind.call(window.console.log, window.console).apply(window.console, [ Date.now() - this.start + "ms", this.id ? "html2canvas (" + this.id + "):" : "html2canvas:" ].concat([].slice.call(args, 0)));
                    }
                }
            }, {
                key: "error",
                value: function() {
                    if (this.enabled && window.console && window.console.error) {
                        for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) args[_key2] = arguments[_key2];
                        Function.prototype.bind.call(window.console.error, window.console).apply(window.console, [ Date.now() - this.start + "ms", this.id ? "html2canvas (" + this.id + "):" : "html2canvas:" ].concat([].slice.call(args, 0)));
                    }
                }
            } ]), Logger;
        }();
        exports.default = Logger;
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.parsePadding = exports.PADDING_SIDES = void 0;
        var obj, _Length = __webpack_require__(1), _Length2 = (obj = _Length) && obj.__esModule ? obj : {
            default: obj
        };
        exports.PADDING_SIDES = {
            TOP: 0,
            RIGHT: 1,
            BOTTOM: 2,
            LEFT: 3
        };
        var SIDES = [ "top", "right", "bottom", "left" ];
        exports.parsePadding = function(style) {
            return SIDES.map(function(side) {
                return new _Length2.default(style.getPropertyValue("padding-" + side));
            });
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var OVERFLOW_WRAP = exports.OVERFLOW_WRAP = {
            NORMAL: 0,
            BREAK_WORD: 1
        };
        exports.parseOverflowWrap = function(overflow) {
            switch (overflow) {
              case "break-word":
                return OVERFLOW_WRAP.BREAK_WORD;

              case "normal":
              default:
                return OVERFLOW_WRAP.NORMAL;
            }
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var POSITION = exports.POSITION = {
            STATIC: 0,
            RELATIVE: 1,
            ABSOLUTE: 2,
            FIXED: 3,
            STICKY: 4
        };
        exports.parsePosition = function(position) {
            switch (position) {
              case "relative":
                return POSITION.RELATIVE;

              case "absolute":
                return POSITION.ABSOLUTE;

              case "fixed":
                return POSITION.FIXED;

              case "sticky":
                return POSITION.STICKY;
            }
            return POSITION.STATIC;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var TEXT_TRANSFORM = exports.TEXT_TRANSFORM = {
            NONE: 0,
            LOWERCASE: 1,
            UPPERCASE: 2,
            CAPITALIZE: 3
        };
        exports.parseTextTransform = function(textTransform) {
            switch (textTransform) {
              case "uppercase":
                return TEXT_TRANSFORM.UPPERCASE;

              case "lowercase":
                return TEXT_TRANSFORM.LOWERCASE;

              case "capitalize":
                return TEXT_TRANSFORM.CAPITALIZE;
            }
            return TEXT_TRANSFORM.NONE;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.reformatInputBounds = exports.inlineSelectElement = exports.inlineTextAreaElement = exports.inlineInputElement = exports.getInputBorderRadius = exports.INPUT_BACKGROUND = exports.INPUT_BORDERS = exports.INPUT_COLOR = void 0;
        var _TextContainer2 = _interopRequireDefault(__webpack_require__(9)), _background = __webpack_require__(5), _border = __webpack_require__(12), _Circle2 = _interopRequireDefault(__webpack_require__(50)), _Vector2 = _interopRequireDefault(__webpack_require__(7)), _Color2 = _interopRequireDefault(__webpack_require__(0)), _Length2 = _interopRequireDefault(__webpack_require__(1)), _Util = (__webpack_require__(2), 
        __webpack_require__(22), __webpack_require__(4));
        function _interopRequireDefault(obj) {
            return obj && obj.__esModule ? obj : {
                default: obj
            };
        }
        exports.INPUT_COLOR = new _Color2.default([ 42, 42, 42 ]);
        var INPUT_BORDER_COLOR = new _Color2.default([ 165, 165, 165 ]), INPUT_BACKGROUND_COLOR = new _Color2.default([ 222, 222, 222 ]), INPUT_BORDER = {
            borderWidth: 1,
            borderColor: INPUT_BORDER_COLOR,
            borderStyle: _border.BORDER_STYLE.SOLID
        }, RADIO_BORDER_RADIUS = (exports.INPUT_BORDERS = [ INPUT_BORDER, INPUT_BORDER, INPUT_BORDER, INPUT_BORDER ], 
        exports.INPUT_BACKGROUND = {
            backgroundColor: INPUT_BACKGROUND_COLOR,
            backgroundImage: [],
            backgroundClip: _background.BACKGROUND_CLIP.PADDING_BOX,
            backgroundOrigin: _background.BACKGROUND_ORIGIN.PADDING_BOX
        }, new _Length2.default("50%")), RADIO_BORDER_RADIUS_TUPLE = [ RADIO_BORDER_RADIUS, RADIO_BORDER_RADIUS ], INPUT_RADIO_BORDER_RADIUS = [ RADIO_BORDER_RADIUS_TUPLE, RADIO_BORDER_RADIUS_TUPLE, RADIO_BORDER_RADIUS_TUPLE, RADIO_BORDER_RADIUS_TUPLE ], CHECKBOX_BORDER_RADIUS = new _Length2.default("3px"), CHECKBOX_BORDER_RADIUS_TUPLE = [ CHECKBOX_BORDER_RADIUS, CHECKBOX_BORDER_RADIUS ], INPUT_CHECKBOX_BORDER_RADIUS = [ CHECKBOX_BORDER_RADIUS_TUPLE, CHECKBOX_BORDER_RADIUS_TUPLE, CHECKBOX_BORDER_RADIUS_TUPLE, CHECKBOX_BORDER_RADIUS_TUPLE ], inlineFormElement = (exports.getInputBorderRadius = function(node) {
            return "radio" === node.type ? INPUT_RADIO_BORDER_RADIUS : INPUT_CHECKBOX_BORDER_RADIUS;
        }, exports.inlineInputElement = function(node, container) {
            if ("radio" === node.type || "checkbox" === node.type) {
                if (node.checked) {
                    var size = Math.min(container.bounds.width, container.bounds.height);
                    container.childNodes.push("checkbox" === node.type ? [ new _Vector2.default(container.bounds.left + .39363 * size, container.bounds.top + .79 * size), new _Vector2.default(container.bounds.left + .16 * size, container.bounds.top + .5549 * size), new _Vector2.default(container.bounds.left + .27347 * size, container.bounds.top + .44071 * size), new _Vector2.default(container.bounds.left + .39694 * size, container.bounds.top + .5649 * size), new _Vector2.default(container.bounds.left + .72983 * size, container.bounds.top + .23 * size), new _Vector2.default(container.bounds.left + .84 * size, container.bounds.top + .34085 * size), new _Vector2.default(container.bounds.left + .39363 * size, container.bounds.top + .79 * size) ] : new _Circle2.default(container.bounds.left + size / 4, container.bounds.top + size / 4, size / 4));
                }
            } else inlineFormElement(getInputValue(node), node, container, !1);
        }, exports.inlineTextAreaElement = function(node, container) {
            inlineFormElement(node.value, node, container, !0);
        }, exports.inlineSelectElement = function(node, container) {
            var option = node.options[node.selectedIndex || 0];
            inlineFormElement(option && option.text || "", node, container, !1);
        }, exports.reformatInputBounds = function(bounds) {
            return bounds.width > bounds.height ? (bounds.left += (bounds.width - bounds.height) / 2, 
            bounds.width = bounds.height) : bounds.width < bounds.height && (bounds.top += (bounds.height - bounds.width) / 2, 
            bounds.height = bounds.width), bounds;
        }, function(value, node, container, allowLinebreak) {
            var body = node.ownerDocument.body;
            if (0 < value.length && body) {
                var wrapper = node.ownerDocument.createElement("html2canvaswrapper");
                (0, _Util.copyCSSStyles)(node.ownerDocument.defaultView.getComputedStyle(node, null), wrapper), 
                wrapper.style.position = "absolute", wrapper.style.left = container.bounds.left + "px", 
                wrapper.style.top = container.bounds.top + "px", allowLinebreak || (wrapper.style.whiteSpace = "nowrap");
                var text = node.ownerDocument.createTextNode(value);
                wrapper.appendChild(text), body.appendChild(wrapper), container.childNodes.push(_TextContainer2.default.fromTextNode(text, container)), 
                body.removeChild(wrapper);
            }
        }), getInputValue = function(node) {
            var value = "password" === node.type ? new Array(node.value.length + 1).join("•") : node.value;
            return 0 === value.length ? node.placeholder || "" : value;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.parseTextBounds = exports.TextBounds = void 0;
        var obj, _Bounds = __webpack_require__(2), _textDecoration = __webpack_require__(11), _Feature = __webpack_require__(10), _Feature2 = (obj = _Feature) && obj.__esModule ? obj : {
            default: obj
        }, _Unicode = __webpack_require__(24);
        var TextBounds = exports.TextBounds = function TextBounds(text, bounds) {
            !function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, TextBounds), this.text = text, this.bounds = bounds;
        }, getWrapperBounds = (exports.parseTextBounds = function(value, parent, node) {
            for (var textList = 0 !== parent.style.letterSpacing ? (0, _Unicode.toCodePoints)(value).map(function(i) {
                return (0, _Unicode.fromCodePoint)(i);
            }) : (0, _Unicode.breakWords)(value, parent), length = textList.length, defaultView = node.parentNode ? node.parentNode.ownerDocument.defaultView : null, scrollX = defaultView ? defaultView.pageXOffset : 0, scrollY = defaultView ? defaultView.pageYOffset : 0, textBounds = [], offset = 0, i = 0; i < length; i++) {
                var text = textList[i];
                if (parent.style.textDecoration !== _textDecoration.TEXT_DECORATION.NONE || 0 < text.trim().length) if (_Feature2.default.SUPPORT_RANGE_BOUNDS) textBounds.push(new TextBounds(text, getRangeBounds(node, offset, text.length, scrollX, scrollY))); else {
                    var replacementNode = node.splitText(text.length);
                    textBounds.push(new TextBounds(text, getWrapperBounds(node, scrollX, scrollY))), 
                    node = replacementNode;
                } else _Feature2.default.SUPPORT_RANGE_BOUNDS || (node = node.splitText(text.length));
                offset += text.length;
            }
            return textBounds;
        }, function(node, scrollX, scrollY) {
            var wrapper = node.ownerDocument.createElement("html2canvaswrapper");
            wrapper.appendChild(node.cloneNode(!0));
            var parentNode = node.parentNode;
            if (parentNode) {
                parentNode.replaceChild(wrapper, node);
                var bounds = (0, _Bounds.parseBounds)(wrapper, scrollX, scrollY);
                return wrapper.firstChild && parentNode.replaceChild(wrapper.firstChild, wrapper), 
                bounds;
            }
            return new _Bounds.Bounds(0, 0, 0, 0);
        }), getRangeBounds = function(node, offset, length, scrollX, scrollY) {
            var range = node.ownerDocument.createRange();
            return range.setStart(node, offset), range.setEnd(node, offset + length), _Bounds.Bounds.fromClientRect(range.getBoundingClientRect(), scrollX, scrollY);
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }();
        var ForeignObjectRenderer = function() {
            function ForeignObjectRenderer(element) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, ForeignObjectRenderer), this.element = element;
            }
            return _createClass(ForeignObjectRenderer, [ {
                key: "render",
                value: function(options) {
                    var _this = this;
                    this.options = options, this.canvas = document.createElement("canvas"), this.ctx = this.canvas.getContext("2d"), 
                    this.canvas.width = Math.floor(options.width) * options.scale, this.canvas.height = Math.floor(options.height) * options.scale, 
                    this.canvas.style.width = options.width + "px", this.canvas.style.height = options.height + "px", 
                    options.logger.log("ForeignObject renderer initialized (" + options.width + "x" + options.height + " at " + options.x + "," + options.y + ") with scale " + options.scale);
                    var svg = createForeignObjectSVG(Math.max(options.windowWidth, options.width) * options.scale, Math.max(options.windowHeight, options.height) * options.scale, options.scrollX * options.scale, options.scrollY * options.scale, this.element);
                    return loadSerializedSVG(svg).then(function(img) {
                        return options.backgroundColor && (_this.ctx.fillStyle = options.backgroundColor.toString(), 
                        _this.ctx.fillRect(0, 0, options.width * options.scale, options.height * options.scale)), 
                        _this.ctx.drawImage(img, -options.x * options.scale, -options.y * options.scale), 
                        _this.canvas;
                    });
                }
            } ]), ForeignObjectRenderer;
        }();
        exports.default = ForeignObjectRenderer;
        var createForeignObjectSVG = exports.createForeignObjectSVG = function(width, height, x, y, node) {
            var xmlns = "http://www.w3.org/2000/svg", svg = document.createElementNS(xmlns, "svg"), foreignObject = document.createElementNS(xmlns, "foreignObject");
            return svg.setAttributeNS(null, "width", width), svg.setAttributeNS(null, "height", height), 
            foreignObject.setAttributeNS(null, "width", "100%"), foreignObject.setAttributeNS(null, "height", "100%"), 
            foreignObject.setAttributeNS(null, "x", x), foreignObject.setAttributeNS(null, "y", y), 
            foreignObject.setAttributeNS(null, "externalResourcesRequired", "true"), svg.appendChild(foreignObject), 
            foreignObject.appendChild(node), svg;
        }, loadSerializedSVG = exports.loadSerializedSVG = function(svg) {
            return new Promise(function(resolve, reject) {
                var img = new Image();
                img.onload = function() {
                    return resolve(img);
                }, img.onerror = reject, img.src = "data:image/svg+xml;charset=utf-8," + encodeURIComponent(new XMLSerializer().serializeToString(svg));
            });
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.breakWords = exports.fromCodePoint = exports.toCodePoints = void 0;
        var _cssLineBreak = __webpack_require__(46);
        Object.defineProperty(exports, "toCodePoints", {
            enumerable: !0,
            get: function() {
                return _cssLineBreak.toCodePoints;
            }
        }), Object.defineProperty(exports, "fromCodePoint", {
            enumerable: !0,
            get: function() {
                return _cssLineBreak.fromCodePoint;
            }
        });
        var obj, _NodeContainer = __webpack_require__(3), _overflowWrap = ((obj = _NodeContainer) && obj.__esModule, 
        __webpack_require__(18));
        exports.breakWords = function(str, parent) {
            for (var breaker = (0, _cssLineBreak.LineBreaker)(str, {
                lineBreak: parent.style.lineBreak,
                wordBreak: parent.style.overflowWrap === _overflowWrap.OVERFLOW_WRAP.BREAK_WORD ? "break-word" : parent.style.wordBreak
            }), words = [], bk = void 0; !(bk = breaker.next()).done; ) words.push(bk.value.slice());
            return words;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.FontMetrics = void 0;
        var _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _Util = __webpack_require__(4);
        exports.FontMetrics = function() {
            function FontMetrics(document) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, FontMetrics), this._data = {}, this._document = document;
            }
            return _createClass(FontMetrics, [ {
                key: "_parseMetrics",
                value: function(font) {
                    var container = this._document.createElement("div"), img = this._document.createElement("img"), span = this._document.createElement("span"), body = this._document.body;
                    if (!body) throw new Error("No document found for font metrics");
                    container.style.visibility = "hidden", container.style.fontFamily = font.fontFamily, 
                    container.style.fontSize = font.fontSize, container.style.margin = "0", container.style.padding = "0", 
                    body.appendChild(container), img.src = _Util.SMALL_IMAGE, img.width = 1, img.height = 1, 
                    img.style.margin = "0", img.style.padding = "0", img.style.verticalAlign = "baseline", 
                    span.style.fontFamily = font.fontFamily, span.style.fontSize = font.fontSize, span.style.margin = "0", 
                    span.style.padding = "0", span.appendChild(this._document.createTextNode("Hidden Text")), 
                    container.appendChild(span), container.appendChild(img);
                    var baseline = img.offsetTop - span.offsetTop + 2;
                    container.removeChild(span), container.appendChild(this._document.createTextNode("Hidden Text")), 
                    container.style.lineHeight = "normal", img.style.verticalAlign = "super";
                    var middle = img.offsetTop - container.offsetTop + 2;
                    return body.removeChild(container), {
                        baseline: baseline,
                        middle: middle
                    };
                }
            }, {
                key: "getMetrics",
                value: function(font) {
                    var key = font.fontFamily + " " + font.fontSize;
                    return void 0 === this._data[key] && (this._data[key] = this._parseMetrics(font)), 
                    this._data[key];
                }
            } ]), FontMetrics;
        }();
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.Proxy = void 0;
        var obj, _Feature = __webpack_require__(10), _Feature2 = (obj = _Feature) && obj.__esModule ? obj : {
            default: obj
        };
        exports.Proxy = function(src, options) {
            if (!options.proxy) return Promise.reject("No proxy defined");
            var proxy = options.proxy;
            return new Promise(function(resolve, reject) {
                var responseType = _Feature2.default.SUPPORT_CORS_XHR && _Feature2.default.SUPPORT_RESPONSE_TYPE ? "blob" : "text", xhr = _Feature2.default.SUPPORT_CORS_XHR ? new XMLHttpRequest() : new XDomainRequest();
                if (xhr.onload = function() {
                    if (xhr instanceof XMLHttpRequest) if (200 === xhr.status) if ("text" === responseType) resolve(xhr.response); else {
                        var reader = new FileReader();
                        reader.addEventListener("load", function() {
                            return resolve(reader.result);
                        }, !1), reader.addEventListener("error", function(e) {
                            return reject(e);
                        }, !1), reader.readAsDataURL(xhr.response);
                    } else reject("Failed to proxy resource " + src.substring(0, 256) + " with status code " + xhr.status); else resolve(xhr.responseText);
                }, xhr.onerror = reject, xhr.open("GET", proxy + "?url=" + encodeURIComponent(src) + "&responseType=" + responseType), 
                "text" !== responseType && xhr instanceof XMLHttpRequest && (xhr.responseType = responseType), 
                options.imageTimeout) {
                    var timeout = options.imageTimeout;
                    xhr.timeout = timeout, xhr.ontimeout = function() {
                        return reject("Timed out (" + timeout + "ms) proxying " + src.substring(0, 256));
                    };
                }
                xhr.send();
            });
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        var _extends = Object.assign || function(target) {
            for (var i = 1; i < arguments.length; i++) {
                var source = arguments[i];
                for (var key in source) Object.prototype.hasOwnProperty.call(source, key) && (target[key] = source[key]);
            }
            return target;
        }, _CanvasRenderer2 = _interopRequireDefault(__webpack_require__(15)), _Logger2 = _interopRequireDefault(__webpack_require__(16)), _Window = __webpack_require__(28);
        function _interopRequireDefault(obj) {
            return obj && obj.__esModule ? obj : {
                default: obj
            };
        }
        var html2canvas = function(element, conf) {
            var config = conf || {}, logger = new _Logger2.default("boolean" != typeof config.logging || config.logging);
            logger.log("html2canvas 1.0.0-alpha.12"), "function" == typeof config.onrendered && logger.error("onrendered option is deprecated, html2canvas returns a Promise with the canvas as the value");
            var ownerDocument = element.ownerDocument;
            if (!ownerDocument) return Promise.reject("Provided element is not within a Document");
            var defaultView = ownerDocument.defaultView, defaultOptions = {
                async: !0,
                allowTaint: !1,
                backgroundColor: "#ffffff",
                imageTimeout: 15e3,
                logging: !0,
                proxy: null,
                removeContainer: !0,
                foreignObjectRendering: !1,
                scale: defaultView.devicePixelRatio || 1,
                target: new _CanvasRenderer2.default(config.canvas),
                useCORS: !1,
                windowWidth: defaultView.innerWidth,
                windowHeight: defaultView.innerHeight,
                scrollX: defaultView.pageXOffset,
                scrollY: defaultView.pageYOffset
            }, result = (0, _Window.renderElement)(element, _extends({}, defaultOptions, config), logger);
            return result.catch(function(e) {
                throw logger.error(e), e;
            });
        };
        html2canvas.CanvasRenderer = _CanvasRenderer2.default, module.exports = html2canvas;
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.renderElement = void 0;
        var _slicedToArray = function(arr, i) {
            if (Array.isArray(arr)) return arr;
            if (Symbol.iterator in Object(arr)) return function(arr, i) {
                var _arr = [], _n = !0, _d = !1, _e = void 0;
                try {
                    for (var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), 
                    !i || _arr.length !== i); _n = !0) ;
                } catch (err) {
                    _d = !0, _e = err;
                } finally {
                    try {
                        !_n && _i.return && _i.return();
                    } finally {
                        if (_d) throw _e;
                    }
                }
                return _arr;
            }(arr, i);
            throw new TypeError("Invalid attempt to destructure non-iterable instance");
        }, _NodeParser = (_interopRequireDefault(__webpack_require__(16)), __webpack_require__(29)), _Renderer2 = _interopRequireDefault(__webpack_require__(51)), _ForeignObjectRenderer2 = _interopRequireDefault(__webpack_require__(23)), _Feature2 = _interopRequireDefault(__webpack_require__(10)), _Bounds = __webpack_require__(2), _Clone = __webpack_require__(54), _Font = __webpack_require__(25), _Color = __webpack_require__(0), _Color2 = _interopRequireDefault(_Color);
        function _interopRequireDefault(obj) {
            return obj && obj.__esModule ? obj : {
                default: obj
            };
        }
        exports.renderElement = function renderElement(element, options, logger) {
            var ownerDocument = element.ownerDocument, windowBounds = new _Bounds.Bounds(options.scrollX, options.scrollY, options.windowWidth, options.windowHeight), documentBackgroundColor = ownerDocument.documentElement ? new _Color2.default(getComputedStyle(ownerDocument.documentElement).backgroundColor) : _Color.TRANSPARENT, bodyBackgroundColor = ownerDocument.body ? new _Color2.default(getComputedStyle(ownerDocument.body).backgroundColor) : _Color.TRANSPARENT, backgroundColor = element === ownerDocument.documentElement ? documentBackgroundColor.isTransparent() ? bodyBackgroundColor.isTransparent() ? options.backgroundColor ? new _Color2.default(options.backgroundColor) : null : bodyBackgroundColor : documentBackgroundColor : options.backgroundColor ? new _Color2.default(options.backgroundColor) : null;
            return (options.foreignObjectRendering ? _Feature2.default.SUPPORT_FOREIGNOBJECT_DRAWING : Promise.resolve(!1)).then(function(supportForeignObject) {
                return supportForeignObject ? (cloner = new _Clone.DocumentCloner(element, options, logger, !0, renderElement), 
                logger.log("Document cloned, using foreignObject rendering"), cloner.inlineFonts(ownerDocument).then(function() {
                    return cloner.resourceLoader.ready();
                }).then(function() {
                    var renderer = new _ForeignObjectRenderer2.default(cloner.documentElement), defaultView = ownerDocument.defaultView, scrollX = defaultView.pageXOffset, scrollY = defaultView.pageYOffset, _ref = "HTML" === element.tagName || "BODY" === element.tagName ? (0, 
                    _Bounds.parseDocumentSize)(ownerDocument) : (0, _Bounds.parseBounds)(element, scrollX, scrollY), width = _ref.width, height = _ref.height, left = _ref.left, top = _ref.top;
                    return renderer.render({
                        backgroundColor: backgroundColor,
                        logger: logger,
                        scale: options.scale,
                        x: "number" == typeof options.x ? options.x : left,
                        y: "number" == typeof options.y ? options.y : top,
                        width: "number" == typeof options.width ? options.width : Math.ceil(width),
                        height: "number" == typeof options.height ? options.height : Math.ceil(height),
                        windowWidth: options.windowWidth,
                        windowHeight: options.windowHeight,
                        scrollX: options.scrollX,
                        scrollY: options.scrollY
                    });
                })) : (0, _Clone.cloneWindow)(ownerDocument, windowBounds, element, options, logger, renderElement).then(function(_ref2) {
                    var _ref3 = _slicedToArray(_ref2, 3), container = _ref3[0], clonedElement = _ref3[1], resourceLoader = _ref3[2];
                    logger.log("Document cloned, using computed rendering");
                    var stack = (0, _NodeParser.NodeParser)(clonedElement, resourceLoader, logger), clonedDocument = clonedElement.ownerDocument;
                    return backgroundColor === stack.container.style.background.backgroundColor && (stack.container.style.background.backgroundColor = _Color.TRANSPARENT), 
                    resourceLoader.ready().then(function(imageStore) {
                        var fontMetrics = new _Font.FontMetrics(clonedDocument);
                        logger.log("Starting renderer");
                        var defaultView = clonedDocument.defaultView, scrollX = defaultView.pageXOffset, scrollY = defaultView.pageYOffset, _ref4 = "HTML" === clonedElement.tagName || "BODY" === clonedElement.tagName ? (0, 
                        _Bounds.parseDocumentSize)(ownerDocument) : (0, _Bounds.parseBounds)(clonedElement, scrollX, scrollY), width = _ref4.width, height = _ref4.height, left = _ref4.left, top = _ref4.top, renderOptions = {
                            backgroundColor: backgroundColor,
                            fontMetrics: fontMetrics,
                            imageStore: imageStore,
                            logger: logger,
                            scale: options.scale,
                            x: "number" == typeof options.x ? options.x : left,
                            y: "number" == typeof options.y ? options.y : top,
                            width: "number" == typeof options.width ? options.width : Math.ceil(width),
                            height: "number" == typeof options.height ? options.height : Math.ceil(height)
                        };
                        if (Array.isArray(options.target)) return Promise.all(options.target.map(function(target) {
                            return new _Renderer2.default(target, renderOptions).render(stack);
                        }));
                        var canvas = new _Renderer2.default(options.target, renderOptions).render(stack);
                        return !0 === options.removeContainer && (container.parentNode ? container.parentNode.removeChild(container) : logger.log("Cannot detach cloned iframe as it is not in the DOM anymore")), 
                        canvas;
                    });
                });
                var cloner;
            });
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.NodeParser = void 0;
        var _StackingContext2 = _interopRequireDefault(__webpack_require__(30)), _NodeContainer2 = _interopRequireDefault(__webpack_require__(3)), _TextContainer2 = _interopRequireDefault(__webpack_require__(9)), _Input = __webpack_require__(21), _ListItem = __webpack_require__(14), _listStyle = __webpack_require__(8);
        function _interopRequireDefault(obj) {
            return obj && obj.__esModule ? obj : {
                default: obj
            };
        }
        exports.NodeParser = function(node, resourceLoader, logger) {
            logger.log("Starting node parsing");
            var index = 0, container = new _NodeContainer2.default(node, null, resourceLoader, index++), stack = new _StackingContext2.default(container, null, !0);
            return parseNodeTree(node, container, stack, resourceLoader, 1), logger.log("Finished parsing node tree"), 
            stack;
        };
        var IGNORED_NODE_NAMES = [ "SCRIPT", "HEAD", "TITLE", "OBJECT", "BR", "OPTION" ], parseNodeTree = function parseNodeTree(node, parent, stack, resourceLoader, index) {
            if (5e4 < index) throw new Error("Recursion error while parsing node tree");
            for (var nextNode, childNode = node.firstChild; childNode; childNode = nextNode) {
                nextNode = childNode.nextSibling;
                var defaultView = childNode.ownerDocument.defaultView;
                if (childNode instanceof defaultView.Text || childNode instanceof Text || defaultView.parent && childNode instanceof defaultView.parent.Text) 0 < childNode.data.trim().length && parent.childNodes.push(_TextContainer2.default.fromTextNode(childNode, parent)); else if (childNode instanceof defaultView.HTMLElement || childNode instanceof HTMLElement || defaultView.parent && childNode instanceof defaultView.parent.HTMLElement) {
                    if (-1 === IGNORED_NODE_NAMES.indexOf(childNode.nodeName)) {
                        var container = new _NodeContainer2.default(childNode, parent, resourceLoader, index++);
                        if (container.isVisible()) {
                            "INPUT" === childNode.tagName ? (0, _Input.inlineInputElement)(childNode, container) : "TEXTAREA" === childNode.tagName ? (0, 
                            _Input.inlineTextAreaElement)(childNode, container) : "SELECT" === childNode.tagName ? (0, 
                            _Input.inlineSelectElement)(childNode, container) : container.style.listStyle && container.style.listStyle.listStyleType !== _listStyle.LIST_STYLE_TYPE.NONE && (0, 
                            _ListItem.inlineListItemElement)(childNode, container, resourceLoader);
                            var SHOULD_TRAVERSE_CHILDREN = "TEXTAREA" !== childNode.tagName, treatAsRealStackingContext = createsRealStackingContext(container, childNode);
                            if (treatAsRealStackingContext || createsStackingContext(container)) {
                                var parentStack = treatAsRealStackingContext || container.isPositioned() ? stack.getRealParentStackingContext() : stack, childStack = new _StackingContext2.default(container, parentStack, treatAsRealStackingContext);
                                parentStack.contexts.push(childStack), SHOULD_TRAVERSE_CHILDREN && parseNodeTree(childNode, container, childStack, resourceLoader, index);
                            } else stack.children.push(container), SHOULD_TRAVERSE_CHILDREN && parseNodeTree(childNode, container, stack, resourceLoader, index);
                        }
                    }
                } else if (childNode instanceof defaultView.SVGSVGElement || childNode instanceof SVGSVGElement || defaultView.parent && childNode instanceof defaultView.parent.SVGSVGElement) {
                    var _container = new _NodeContainer2.default(childNode, parent, resourceLoader, index++), _treatAsRealStackingContext = createsRealStackingContext(_container, childNode);
                    if (_treatAsRealStackingContext || createsStackingContext(_container)) {
                        var _parentStack = _treatAsRealStackingContext || _container.isPositioned() ? stack.getRealParentStackingContext() : stack, _childStack = new _StackingContext2.default(_container, _parentStack, _treatAsRealStackingContext);
                        _parentStack.contexts.push(_childStack);
                    } else stack.children.push(_container);
                }
            }
        }, createsRealStackingContext = function(container, node) {
            return container.isRootElement() || container.isPositionedWithZIndex() || container.style.opacity < 1 || container.isTransformed() || isBodyWithTransparentRoot(container, node);
        }, createsStackingContext = function(container) {
            return container.isPositioned() || container.isFloating();
        }, isBodyWithTransparentRoot = function(container, node) {
            return "BODY" === node.nodeName && container.parent instanceof _NodeContainer2.default && container.parent.style.background.backgroundColor.isTransparent();
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var obj, _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _NodeContainer = __webpack_require__(3);
        (obj = _NodeContainer) && obj.__esModule, __webpack_require__(19);
        var StackingContext = function() {
            function StackingContext(container, parent, treatAsRealStackingContext) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, StackingContext), this.container = container, this.parent = parent, this.contexts = [], 
                this.children = [], this.treatAsRealStackingContext = treatAsRealStackingContext;
            }
            return _createClass(StackingContext, [ {
                key: "getOpacity",
                value: function() {
                    return this.parent ? this.container.style.opacity * this.parent.getOpacity() : this.container.style.opacity;
                }
            }, {
                key: "getRealParentStackingContext",
                value: function() {
                    return !this.parent || this.treatAsRealStackingContext ? this : this.parent.getRealParentStackingContext();
                }
            } ]), StackingContext;
        }();
        exports.default = StackingContext;
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        exports.default = function Size(width, height) {
            !function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, Size), this.width = width, this.height = height;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var obj, _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _Path = __webpack_require__(6), _Vector = __webpack_require__(7), _Vector2 = (obj = _Vector) && obj.__esModule ? obj : {
            default: obj
        };
        var lerp = function(a, b, t) {
            return new _Vector2.default(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t);
        }, BezierCurve = function() {
            function BezierCurve(start, startControl, endControl, end) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, BezierCurve), this.type = _Path.PATH.BEZIER_CURVE, this.start = start, this.startControl = startControl, 
                this.endControl = endControl, this.end = end;
            }
            return _createClass(BezierCurve, [ {
                key: "subdivide",
                value: function(t, firstHalf) {
                    var ab = lerp(this.start, this.startControl, t), bc = lerp(this.startControl, this.endControl, t), cd = lerp(this.endControl, this.end, t), abbc = lerp(ab, bc, t), bccd = lerp(bc, cd, t), dest = lerp(abbc, bccd, t);
                    return firstHalf ? new BezierCurve(this.start, ab, abbc, dest) : new BezierCurve(dest, bccd, cd, this.end);
                }
            }, {
                key: "reverse",
                value: function() {
                    return new BezierCurve(this.end, this.endControl, this.startControl, this.start);
                }
            } ]), BezierCurve;
        }();
        exports.default = BezierCurve;
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.parseBorderRadius = void 0;
        var obj, _slicedToArray = function(arr, i) {
            if (Array.isArray(arr)) return arr;
            if (Symbol.iterator in Object(arr)) return function(arr, i) {
                var _arr = [], _n = !0, _d = !1, _e = void 0;
                try {
                    for (var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), 
                    !i || _arr.length !== i); _n = !0) ;
                } catch (err) {
                    _d = !0, _e = err;
                } finally {
                    try {
                        !_n && _i.return && _i.return();
                    } finally {
                        if (_d) throw _e;
                    }
                }
                return _arr;
            }(arr, i);
            throw new TypeError("Invalid attempt to destructure non-iterable instance");
        }, _Length = __webpack_require__(1), _Length2 = (obj = _Length) && obj.__esModule ? obj : {
            default: obj
        };
        var SIDES = [ "top-left", "top-right", "bottom-right", "bottom-left" ];
        exports.parseBorderRadius = function(style) {
            return SIDES.map(function(side) {
                var _value$split$map = style.getPropertyValue("border-" + side + "-radius").split(" ").map(_Length2.default.create), _value$split$map2 = _slicedToArray(_value$split$map, 2), horizontal = _value$split$map2[0], vertical = _value$split$map2[1];
                return void 0 === vertical ? [ horizontal, horizontal ] : [ horizontal, vertical ];
            });
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var DISPLAY = exports.DISPLAY = {
            NONE: 1,
            BLOCK: 2,
            INLINE: 4,
            RUN_IN: 8,
            FLOW: 16,
            FLOW_ROOT: 32,
            TABLE: 64,
            FLEX: 128,
            GRID: 256,
            RUBY: 512,
            SUBGRID: 1024,
            LIST_ITEM: 2048,
            TABLE_ROW_GROUP: 4096,
            TABLE_HEADER_GROUP: 8192,
            TABLE_FOOTER_GROUP: 16384,
            TABLE_ROW: 32768,
            TABLE_CELL: 65536,
            TABLE_COLUMN_GROUP: 1 << 17,
            TABLE_COLUMN: 1 << 18,
            TABLE_CAPTION: 1 << 19,
            RUBY_BASE: 1 << 20,
            RUBY_TEXT: 1 << 21,
            RUBY_BASE_CONTAINER: 1 << 22,
            RUBY_TEXT_CONTAINER: 1 << 23,
            CONTENTS: 1 << 24,
            INLINE_BLOCK: 1 << 25,
            INLINE_LIST_ITEM: 1 << 26,
            INLINE_TABLE: 1 << 27,
            INLINE_FLEX: 1 << 28,
            INLINE_GRID: 1 << 29
        }, setDisplayBit = function(bit, display) {
            return bit | function(display) {
                switch (display) {
                  case "block":
                    return DISPLAY.BLOCK;

                  case "inline":
                    return DISPLAY.INLINE;

                  case "run-in":
                    return DISPLAY.RUN_IN;

                  case "flow":
                    return DISPLAY.FLOW;

                  case "flow-root":
                    return DISPLAY.FLOW_ROOT;

                  case "table":
                    return DISPLAY.TABLE;

                  case "flex":
                    return DISPLAY.FLEX;

                  case "grid":
                    return DISPLAY.GRID;

                  case "ruby":
                    return DISPLAY.RUBY;

                  case "subgrid":
                    return DISPLAY.SUBGRID;

                  case "list-item":
                    return DISPLAY.LIST_ITEM;

                  case "table-row-group":
                    return DISPLAY.TABLE_ROW_GROUP;

                  case "table-header-group":
                    return DISPLAY.TABLE_HEADER_GROUP;

                  case "table-footer-group":
                    return DISPLAY.TABLE_FOOTER_GROUP;

                  case "table-row":
                    return DISPLAY.TABLE_ROW;

                  case "table-cell":
                    return DISPLAY.TABLE_CELL;

                  case "table-column-group":
                    return DISPLAY.TABLE_COLUMN_GROUP;

                  case "table-column":
                    return DISPLAY.TABLE_COLUMN;

                  case "table-caption":
                    return DISPLAY.TABLE_CAPTION;

                  case "ruby-base":
                    return DISPLAY.RUBY_BASE;

                  case "ruby-text":
                    return DISPLAY.RUBY_TEXT;

                  case "ruby-base-container":
                    return DISPLAY.RUBY_BASE_CONTAINER;

                  case "ruby-text-container":
                    return DISPLAY.RUBY_TEXT_CONTAINER;

                  case "contents":
                    return DISPLAY.CONTENTS;

                  case "inline-block":
                    return DISPLAY.INLINE_BLOCK;

                  case "inline-list-item":
                    return DISPLAY.INLINE_LIST_ITEM;

                  case "inline-table":
                    return DISPLAY.INLINE_TABLE;

                  case "inline-flex":
                    return DISPLAY.INLINE_FLEX;

                  case "inline-grid":
                    return DISPLAY.INLINE_GRID;
                }
                return DISPLAY.NONE;
            }(display);
        };
        exports.parseDisplay = function(display) {
            return display.split(" ").reduce(setDisplayBit, 0);
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var FLOAT = exports.FLOAT = {
            NONE: 0,
            LEFT: 1,
            RIGHT: 2,
            INLINE_START: 3,
            INLINE_END: 4
        };
        exports.parseCSSFloat = function(float) {
            switch (float) {
              case "left":
                return FLOAT.LEFT;

              case "right":
                return FLOAT.RIGHT;

              case "inline-start":
                return FLOAT.INLINE_START;

              case "inline-end":
                return FLOAT.INLINE_END;
            }
            return FLOAT.NONE;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        exports.parseFont = function(style) {
            return {
                fontFamily: style.fontFamily,
                fontSize: style.fontSize,
                fontStyle: style.fontStyle,
                fontVariant: style.fontVariant,
                fontWeight: function(weight) {
                    switch (weight) {
                      case "normal":
                        return 400;

                      case "bold":
                        return 700;
                    }
                    var value = parseInt(weight, 10);
                    return isNaN(value) ? 400 : value;
                }(style.fontWeight)
            };
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        exports.parseLetterSpacing = function(letterSpacing) {
            if ("normal" === letterSpacing) return 0;
            var value = parseFloat(letterSpacing);
            return isNaN(value) ? 0 : value;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var LINE_BREAK = exports.LINE_BREAK = {
            NORMAL: "normal",
            STRICT: "strict"
        };
        exports.parseLineBreak = function(wordBreak) {
            switch (wordBreak) {
              case "strict":
                return LINE_BREAK.STRICT;

              case "normal":
              default:
                return LINE_BREAK.NORMAL;
            }
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.parseMargin = void 0;
        var obj, _Length = __webpack_require__(1), _Length2 = (obj = _Length) && obj.__esModule ? obj : {
            default: obj
        };
        var SIDES = [ "top", "right", "bottom", "left" ];
        exports.parseMargin = function(style) {
            return SIDES.map(function(side) {
                return new _Length2.default(style.getPropertyValue("margin-" + side));
            });
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var OVERFLOW = exports.OVERFLOW = {
            VISIBLE: 0,
            HIDDEN: 1,
            SCROLL: 2,
            AUTO: 3
        };
        exports.parseOverflow = function(overflow) {
            switch (overflow) {
              case "hidden":
                return OVERFLOW.HIDDEN;

              case "scroll":
                return OVERFLOW.SCROLL;

              case "auto":
                return OVERFLOW.AUTO;

              case "visible":
              default:
                return OVERFLOW.VISIBLE;
            }
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.parseTextShadow = void 0;
        var obj, _Color = __webpack_require__(0), _Color2 = (obj = _Color) && obj.__esModule ? obj : {
            default: obj
        };
        var NUMBER = /^([+-]|\d|\.)$/i;
        exports.parseTextShadow = function(textShadow) {
            if ("none" === textShadow || "string" != typeof textShadow) return null;
            for (var currentValue = "", isLength = !1, values = [], shadows = [], numParens = 0, color = null, appendValue = function() {
                currentValue.length && (isLength ? values.push(parseFloat(currentValue)) : color = new _Color2.default(currentValue)), 
                isLength = !1, currentValue = "";
            }, appendShadow = function() {
                values.length && null !== color && shadows.push({
                    color: color,
                    offsetX: values[0] || 0,
                    offsetY: values[1] || 0,
                    blur: values[2] || 0
                }), values.splice(0, values.length), color = null;
            }, i = 0; i < textShadow.length; i++) {
                var c = textShadow[i];
                switch (c) {
                  case "(":
                    currentValue += c, numParens++;
                    break;

                  case ")":
                    currentValue += c, numParens--;
                    break;

                  case ",":
                    0 === numParens ? (appendValue(), appendShadow()) : currentValue += c;
                    break;

                  case " ":
                    0 === numParens ? appendValue() : currentValue += c;
                    break;

                  default:
                    0 === currentValue.length && NUMBER.test(c) && (isLength = !0), currentValue += c;
                }
            }
            return appendValue(), appendShadow(), 0 === shadows.length ? null : shadows;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.parseTransform = void 0;
        var obj, _Length = __webpack_require__(1), _Length2 = (obj = _Length) && obj.__esModule ? obj : {
            default: obj
        };
        var toFloat = function(s) {
            return parseFloat(s.trim());
        }, MATRIX = /(matrix|matrix3d)\((.+)\)/, parseTransformOrigin = (exports.parseTransform = function(style) {
            var transform = parseTransformMatrix(style.transform || style.webkitTransform || style.mozTransform || style.msTransform || style.oTransform);
            return null === transform ? null : {
                transform: transform,
                transformOrigin: parseTransformOrigin(style.transformOrigin || style.webkitTransformOrigin || style.mozTransformOrigin || style.msTransformOrigin || style.oTransformOrigin)
            };
        }, function(origin) {
            if ("string" != typeof origin) {
                var v = new _Length2.default("0");
                return [ v, v ];
            }
            var values = origin.split(" ").map(_Length2.default.create);
            return [ values[0], values[1] ];
        }), parseTransformMatrix = function(transform) {
            if ("none" === transform || "string" != typeof transform) return null;
            var match = transform.match(MATRIX);
            if (match) {
                if ("matrix" === match[1]) {
                    var matrix = match[2].split(",").map(toFloat);
                    return [ matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5] ];
                }
                var matrix3d = match[2].split(",").map(toFloat);
                return [ matrix3d[0], matrix3d[1], matrix3d[4], matrix3d[5], matrix3d[12], matrix3d[13] ];
            }
            return null;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var VISIBILITY = exports.VISIBILITY = {
            VISIBLE: 0,
            HIDDEN: 1,
            COLLAPSE: 2
        };
        exports.parseVisibility = function(visibility) {
            switch (visibility) {
              case "hidden":
                return VISIBILITY.HIDDEN;

              case "collapse":
                return VISIBILITY.COLLAPSE;

              case "visible":
              default:
                return VISIBILITY.VISIBLE;
            }
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var WORD_BREAK = exports.WORD_BREAK = {
            NORMAL: "normal",
            BREAK_ALL: "break-all",
            KEEP_ALL: "keep-all"
        };
        exports.parseWordBreak = function(wordBreak) {
            switch (wordBreak) {
              case "break-all":
                return WORD_BREAK.BREAK_ALL;

              case "keep-all":
                return WORD_BREAK.KEEP_ALL;

              case "normal":
              default:
                return WORD_BREAK.NORMAL;
            }
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        exports.parseZIndex = function(zIndex) {
            var auto = "auto" === zIndex;
            return {
                auto: auto,
                order: auto ? 0 : parseInt(zIndex, 10)
            };
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var _Util = __webpack_require__(13);
        Object.defineProperty(exports, "toCodePoints", {
            enumerable: !0,
            get: function() {
                return _Util.toCodePoints;
            }
        }), Object.defineProperty(exports, "fromCodePoint", {
            enumerable: !0,
            get: function() {
                return _Util.fromCodePoint;
            }
        });
        var _LineBreak = __webpack_require__(47);
        Object.defineProperty(exports, "LineBreaker", {
            enumerable: !0,
            get: function() {
                return _LineBreak.LineBreaker;
            }
        });
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.LineBreaker = exports.inlineBreakOpportunities = exports.lineBreakAtIndex = exports.codePointsToCharacterClasses = exports.UnicodeTrie = exports.BREAK_ALLOWED = exports.BREAK_NOT_ALLOWED = exports.BREAK_MANDATORY = exports.classes = exports.LETTER_NUMBER_MODIFIER = void 0;
        var obj, _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _slicedToArray = function(arr, i) {
            if (Array.isArray(arr)) return arr;
            if (Symbol.iterator in Object(arr)) return function(arr, i) {
                var _arr = [], _n = !0, _d = !1, _e = void 0;
                try {
                    for (var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), 
                    !i || _arr.length !== i); _n = !0) ;
                } catch (err) {
                    _d = !0, _e = err;
                } finally {
                    try {
                        !_n && _i.return && _i.return();
                    } finally {
                        if (_d) throw _e;
                    }
                }
                return _arr;
            }(arr, i);
            throw new TypeError("Invalid attempt to destructure non-iterable instance");
        }, _Trie = __webpack_require__(48), _linebreakTrie = __webpack_require__(49), _linebreakTrie2 = (obj = _linebreakTrie) && obj.__esModule ? obj : {
            default: obj
        }, _Util = __webpack_require__(13);
        var LETTER_NUMBER_MODIFIER = exports.LETTER_NUMBER_MODIFIER = 50, SP = 10, BA = 13, HY = 15, CL = 17, CP = 18, EX = 19, IN = 20, NS = 21, OP = 22, IS = 24, NU = 25, PO = 26, PR = 27, SY = 28, AL = 30, EB = 32, EM = 33, H2 = 34, H3 = 35, ID = 37, JL = 38, JV = 39, JT = 40, SA = 42, BREAK_MANDATORY = (exports.classes = {
            BK: 1,
            CR: 2,
            LF: 3,
            CM: 4,
            NL: 5,
            SG: 6,
            WJ: 7,
            ZW: 8,
            GL: 9,
            SP: SP,
            ZWJ: 11,
            B2: 12,
            BA: BA,
            BB: 14,
            HY: HY,
            CB: 16,
            CL: CL,
            CP: CP,
            EX: EX,
            IN: IN,
            NS: NS,
            OP: OP,
            QU: 23,
            IS: IS,
            NU: NU,
            PO: PO,
            PR: PR,
            SY: SY,
            AI: 29,
            AL: AL,
            CJ: 31,
            EB: EB,
            EM: EM,
            H2: H2,
            H3: H3,
            HL: 36,
            ID: ID,
            JL: JL,
            JV: JV,
            JT: JT,
            RI: 41,
            SA: SA,
            XX: 43
        }, exports.BREAK_MANDATORY = "!"), BREAK_NOT_ALLOWED = exports.BREAK_NOT_ALLOWED = "×", BREAK_ALLOWED = exports.BREAK_ALLOWED = "÷", UnicodeTrie = exports.UnicodeTrie = (0, 
        _Trie.createTrieFromBase64)(_linebreakTrie2.default), ALPHABETICS = [ AL, 36 ], HARD_LINE_BREAKS = [ 1, 2, 3, 5 ], SPACE = [ SP, 8 ], PREFIX_POSTFIX = [ PR, PO ], LINE_BREAKS = HARD_LINE_BREAKS.concat(SPACE), KOREAN_SYLLABLE_BLOCK = [ JL, JV, JT, H2, H3 ], HYPHEN = [ HY, BA ], codePointsToCharacterClasses = exports.codePointsToCharacterClasses = function(codePoints) {
            var lineBreak = 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : "strict", types = [], indicies = [], categories = [];
            return codePoints.forEach(function(codePoint, index) {
                var classType = UnicodeTrie.get(codePoint);
                if (LETTER_NUMBER_MODIFIER < classType ? (categories.push(!0), classType -= LETTER_NUMBER_MODIFIER) : categories.push(!1), 
                -1 !== [ "normal", "auto", "loose" ].indexOf(lineBreak) && -1 !== [ 8208, 8211, 12316, 12448 ].indexOf(codePoint)) return indicies.push(index), 
                types.push(16);
                if (4 === classType || 11 === classType) {
                    if (0 === index) return indicies.push(index), types.push(AL);
                    var prev = types[index - 1];
                    return -1 === LINE_BREAKS.indexOf(prev) ? (indicies.push(indicies[index - 1]), types.push(prev)) : (indicies.push(index), 
                    types.push(AL));
                }
                return indicies.push(index), 31 === classType ? types.push("strict" === lineBreak ? NS : ID) : classType === SA ? types.push(AL) : 29 === classType ? types.push(AL) : 43 === classType ? 131072 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141 ? types.push(ID) : types.push(AL) : void types.push(classType);
            }), [ indicies, types, categories ];
        }, isAdjacentWithSpaceIgnored = function(a, b, currentIndex, classTypes) {
            var current = classTypes[currentIndex];
            if (Array.isArray(a) ? -1 !== a.indexOf(current) : a === current) for (var i = currentIndex; i <= classTypes.length; ) {
                var next = classTypes[++i];
                if (next === b) return !0;
                if (next !== SP) break;
            }
            if (current === SP) for (var _i = currentIndex; 0 < _i; ) {
                var prev = classTypes[--_i];
                if (Array.isArray(a) ? -1 !== a.indexOf(prev) : a === prev) for (var n = currentIndex; n <= classTypes.length; ) {
                    var _next = classTypes[++n];
                    if (_next === b) return !0;
                    if (_next !== SP) break;
                }
                if (prev !== SP) break;
            }
            return !1;
        }, previousNonSpaceClassType = function(currentIndex, classTypes) {
            for (var i = currentIndex; 0 <= i; ) {
                var type = classTypes[i];
                if (type !== SP) return type;
                i--;
            }
            return 0;
        }, _lineBreakAtIndex = function(codePoints, classTypes, indicies, index, forbiddenBreaks) {
            if (0 === indicies[index]) return BREAK_NOT_ALLOWED;
            var currentIndex = index - 1;
            if (Array.isArray(forbiddenBreaks) && !0 === forbiddenBreaks[currentIndex]) return BREAK_NOT_ALLOWED;
            var beforeIndex = currentIndex - 1, afterIndex = currentIndex + 1, current = classTypes[currentIndex], before = 0 <= beforeIndex ? classTypes[beforeIndex] : 0, next = classTypes[afterIndex];
            if (2 === current && 3 === next) return BREAK_NOT_ALLOWED;
            if (-1 !== HARD_LINE_BREAKS.indexOf(current)) return BREAK_MANDATORY;
            if (-1 !== HARD_LINE_BREAKS.indexOf(next)) return BREAK_NOT_ALLOWED;
            if (-1 !== SPACE.indexOf(next)) return BREAK_NOT_ALLOWED;
            if (8 === previousNonSpaceClassType(currentIndex, classTypes)) return BREAK_ALLOWED;
            if (11 === UnicodeTrie.get(codePoints[currentIndex]) && (next === ID || next === EB || next === EM)) return BREAK_NOT_ALLOWED;
            if (7 === current || 7 === next) return BREAK_NOT_ALLOWED;
            if (9 === current) return BREAK_NOT_ALLOWED;
            if (-1 === [ SP, BA, HY ].indexOf(current) && 9 === next) return BREAK_NOT_ALLOWED;
            if (-1 !== [ CL, CP, EX, IS, SY ].indexOf(next)) return BREAK_NOT_ALLOWED;
            if (previousNonSpaceClassType(currentIndex, classTypes) === OP) return BREAK_NOT_ALLOWED;
            if (isAdjacentWithSpaceIgnored(23, OP, currentIndex, classTypes)) return BREAK_NOT_ALLOWED;
            if (isAdjacentWithSpaceIgnored([ CL, CP ], NS, currentIndex, classTypes)) return BREAK_NOT_ALLOWED;
            if (isAdjacentWithSpaceIgnored(12, 12, currentIndex, classTypes)) return BREAK_NOT_ALLOWED;
            if (current === SP) return BREAK_ALLOWED;
            if (23 === current || 23 === next) return BREAK_NOT_ALLOWED;
            if (16 === next || 16 === current) return BREAK_ALLOWED;
            if (-1 !== [ BA, HY, NS ].indexOf(next) || 14 === current) return BREAK_NOT_ALLOWED;
            if (36 === before && -1 !== HYPHEN.indexOf(current)) return BREAK_NOT_ALLOWED;
            if (current === SY && 36 === next) return BREAK_NOT_ALLOWED;
            if (next === IN && -1 !== ALPHABETICS.concat(IN, EX, NU, ID, EB, EM).indexOf(current)) return BREAK_NOT_ALLOWED;
            if (-1 !== ALPHABETICS.indexOf(next) && current === NU || -1 !== ALPHABETICS.indexOf(current) && next === NU) return BREAK_NOT_ALLOWED;
            if (current === PR && -1 !== [ ID, EB, EM ].indexOf(next) || -1 !== [ ID, EB, EM ].indexOf(current) && next === PO) return BREAK_NOT_ALLOWED;
            if (-1 !== ALPHABETICS.indexOf(current) && -1 !== PREFIX_POSTFIX.indexOf(next) || -1 !== PREFIX_POSTFIX.indexOf(current) && -1 !== ALPHABETICS.indexOf(next)) return BREAK_NOT_ALLOWED;
            if (-1 !== [ PR, PO ].indexOf(current) && (next === NU || -1 !== [ OP, HY ].indexOf(next) && classTypes[afterIndex + 1] === NU) || -1 !== [ OP, HY ].indexOf(current) && next === NU || current === NU && -1 !== [ NU, SY, IS ].indexOf(next)) return BREAK_NOT_ALLOWED;
            if (-1 !== [ NU, SY, IS, CL, CP ].indexOf(next)) for (var prevIndex = currentIndex; 0 <= prevIndex; ) {
                var type = classTypes[prevIndex];
                if (type === NU) return BREAK_NOT_ALLOWED;
                if (-1 === [ SY, IS ].indexOf(type)) break;
                prevIndex--;
            }
            if (-1 !== [ PR, PO ].indexOf(next)) for (var _prevIndex = -1 !== [ CL, CP ].indexOf(current) ? beforeIndex : currentIndex; 0 <= _prevIndex; ) {
                var _type = classTypes[_prevIndex];
                if (_type === NU) return BREAK_NOT_ALLOWED;
                if (-1 === [ SY, IS ].indexOf(_type)) break;
                _prevIndex--;
            }
            if (JL === current && -1 !== [ JL, JV, H2, H3 ].indexOf(next) || -1 !== [ JV, H2 ].indexOf(current) && -1 !== [ JV, JT ].indexOf(next) || -1 !== [ JT, H3 ].indexOf(current) && next === JT) return BREAK_NOT_ALLOWED;
            if (-1 !== KOREAN_SYLLABLE_BLOCK.indexOf(current) && -1 !== [ IN, PO ].indexOf(next) || -1 !== KOREAN_SYLLABLE_BLOCK.indexOf(next) && current === PR) return BREAK_NOT_ALLOWED;
            if (-1 !== ALPHABETICS.indexOf(current) && -1 !== ALPHABETICS.indexOf(next)) return BREAK_NOT_ALLOWED;
            if (current === IS && -1 !== ALPHABETICS.indexOf(next)) return BREAK_NOT_ALLOWED;
            if (-1 !== ALPHABETICS.concat(NU).indexOf(current) && next === OP || -1 !== ALPHABETICS.concat(NU).indexOf(next) && current === CP) return BREAK_NOT_ALLOWED;
            if (41 === current && 41 === next) {
                for (var i = indicies[currentIndex], count = 1; 0 < i && 41 === classTypes[--i]; ) count++;
                if (count % 2 != 0) return BREAK_NOT_ALLOWED;
            }
            return current === EB && next === EM ? BREAK_NOT_ALLOWED : BREAK_ALLOWED;
        }, cssFormattedClasses = (exports.lineBreakAtIndex = function(codePoints, index) {
            if (0 === index) return BREAK_NOT_ALLOWED;
            if (index >= codePoints.length) return BREAK_MANDATORY;
            var _codePointsToCharacte = codePointsToCharacterClasses(codePoints), _codePointsToCharacte2 = _slicedToArray(_codePointsToCharacte, 2), indicies = _codePointsToCharacte2[0], classTypes = _codePointsToCharacte2[1];
            return _lineBreakAtIndex(codePoints, classTypes, indicies, index);
        }, function(codePoints, options) {
            options || (options = {
                lineBreak: "normal",
                wordBreak: "normal"
            });
            var _codePointsToCharacte3 = codePointsToCharacterClasses(codePoints, options.lineBreak), _codePointsToCharacte4 = _slicedToArray(_codePointsToCharacte3, 3), indicies = _codePointsToCharacte4[0], classTypes = _codePointsToCharacte4[1], isLetterNumber = _codePointsToCharacte4[2];
            return "break-all" !== options.wordBreak && "break-word" !== options.wordBreak || (classTypes = classTypes.map(function(type) {
                return -1 !== [ NU, AL, SA ].indexOf(type) ? ID : type;
            })), [ indicies, classTypes, "keep-all" === options.wordBreak ? isLetterNumber.map(function(isLetterNumber, i) {
                return isLetterNumber && 19968 <= codePoints[i] && codePoints[i] <= 40959;
            }) : null ];
        }), Break = (exports.inlineBreakOpportunities = function(str, options) {
            var codePoints = (0, _Util.toCodePoints)(str), output = BREAK_NOT_ALLOWED, _cssFormattedClasses = cssFormattedClasses(codePoints, options), _cssFormattedClasses2 = _slicedToArray(_cssFormattedClasses, 3), indicies = _cssFormattedClasses2[0], classTypes = _cssFormattedClasses2[1], forbiddenBreakpoints = _cssFormattedClasses2[2];
            return codePoints.forEach(function(codePoint, i) {
                output += (0, _Util.fromCodePoint)(codePoint) + (i >= codePoints.length - 1 ? BREAK_MANDATORY : _lineBreakAtIndex(codePoints, classTypes, indicies, i + 1, forbiddenBreakpoints));
            }), output;
        }, function() {
            function Break(codePoints, lineBreak, start, end) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, Break), this._codePoints = codePoints, this.required = lineBreak === BREAK_MANDATORY, 
                this.start = start, this.end = end;
            }
            return _createClass(Break, [ {
                key: "slice",
                value: function() {
                    return _Util.fromCodePoint.apply(void 0, function(arr) {
                        if (Array.isArray(arr)) {
                            for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
                            return arr2;
                        }
                        return Array.from(arr);
                    }(this._codePoints.slice(this.start, this.end)));
                }
            } ]), Break;
        }());
        exports.LineBreaker = function(str, options) {
            var codePoints = (0, _Util.toCodePoints)(str), _cssFormattedClasses3 = cssFormattedClasses(codePoints, options), _cssFormattedClasses4 = _slicedToArray(_cssFormattedClasses3, 3), indicies = _cssFormattedClasses4[0], classTypes = _cssFormattedClasses4[1], forbiddenBreakpoints = _cssFormattedClasses4[2], length = codePoints.length, lastEnd = 0, nextIndex = 0;
            return {
                next: function() {
                    if (length <= nextIndex) return {
                        done: !0
                    };
                    for (var lineBreak = BREAK_NOT_ALLOWED; nextIndex < length && (lineBreak = _lineBreakAtIndex(codePoints, classTypes, indicies, ++nextIndex, forbiddenBreakpoints)) === BREAK_NOT_ALLOWED; ) ;
                    if (lineBreak !== BREAK_NOT_ALLOWED || nextIndex === length) {
                        var value = new Break(codePoints, lineBreak, lastEnd, nextIndex);
                        return lastEnd = nextIndex, {
                            value: value,
                            done: !1
                        };
                    }
                    return {
                        done: !0
                    };
                }
            };
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.Trie = exports.createTrieFromBase64 = exports.UTRIE2_INDEX_2_MASK = exports.UTRIE2_INDEX_2_BLOCK_LENGTH = exports.UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = exports.UTRIE2_INDEX_1_OFFSET = exports.UTRIE2_UTF8_2B_INDEX_2_LENGTH = exports.UTRIE2_UTF8_2B_INDEX_2_OFFSET = exports.UTRIE2_INDEX_2_BMP_LENGTH = exports.UTRIE2_LSCP_INDEX_2_LENGTH = exports.UTRIE2_DATA_MASK = exports.UTRIE2_DATA_BLOCK_LENGTH = exports.UTRIE2_LSCP_INDEX_2_OFFSET = exports.UTRIE2_SHIFT_1_2 = exports.UTRIE2_INDEX_SHIFT = exports.UTRIE2_SHIFT_1 = exports.UTRIE2_SHIFT_2 = void 0;
        var _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _Util = __webpack_require__(13);
        var UTRIE2_SHIFT_2 = exports.UTRIE2_SHIFT_2 = 5, UTRIE2_SHIFT_1 = exports.UTRIE2_SHIFT_1 = 11, UTRIE2_INDEX_SHIFT = exports.UTRIE2_INDEX_SHIFT = 2, UTRIE2_SHIFT_1_2 = exports.UTRIE2_SHIFT_1_2 = UTRIE2_SHIFT_1 - UTRIE2_SHIFT_2, UTRIE2_LSCP_INDEX_2_OFFSET = exports.UTRIE2_LSCP_INDEX_2_OFFSET = 65536 >> UTRIE2_SHIFT_2, UTRIE2_DATA_BLOCK_LENGTH = exports.UTRIE2_DATA_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_2, UTRIE2_DATA_MASK = exports.UTRIE2_DATA_MASK = UTRIE2_DATA_BLOCK_LENGTH - 1, UTRIE2_LSCP_INDEX_2_LENGTH = exports.UTRIE2_LSCP_INDEX_2_LENGTH = 1024 >> UTRIE2_SHIFT_2, UTRIE2_INDEX_2_BMP_LENGTH = exports.UTRIE2_INDEX_2_BMP_LENGTH = UTRIE2_LSCP_INDEX_2_OFFSET + UTRIE2_LSCP_INDEX_2_LENGTH, UTRIE2_UTF8_2B_INDEX_2_OFFSET = exports.UTRIE2_UTF8_2B_INDEX_2_OFFSET = UTRIE2_INDEX_2_BMP_LENGTH, UTRIE2_UTF8_2B_INDEX_2_LENGTH = exports.UTRIE2_UTF8_2B_INDEX_2_LENGTH = 32, UTRIE2_INDEX_1_OFFSET = exports.UTRIE2_INDEX_1_OFFSET = UTRIE2_UTF8_2B_INDEX_2_OFFSET + UTRIE2_UTF8_2B_INDEX_2_LENGTH, UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = exports.UTRIE2_OMITTED_BMP_INDEX_1_LENGTH = 65536 >> UTRIE2_SHIFT_1, UTRIE2_INDEX_2_BLOCK_LENGTH = exports.UTRIE2_INDEX_2_BLOCK_LENGTH = 1 << UTRIE2_SHIFT_1_2, UTRIE2_INDEX_2_MASK = exports.UTRIE2_INDEX_2_MASK = UTRIE2_INDEX_2_BLOCK_LENGTH - 1, Trie = (exports.createTrieFromBase64 = function(base64) {
            var buffer = (0, _Util.decode)(base64), view32 = Array.isArray(buffer) ? (0, _Util.polyUint32Array)(buffer) : new Uint32Array(buffer), view16 = Array.isArray(buffer) ? (0, 
            _Util.polyUint16Array)(buffer) : new Uint16Array(buffer), index = view16.slice(12, view32[4] / 2), data = 2 === view32[5] ? view16.slice((24 + view32[4]) / 2) : view32.slice(Math.ceil((24 + view32[4]) / 4));
            return new Trie(view32[0], view32[1], view32[2], view32[3], index, data);
        }, exports.Trie = function() {
            function Trie(initialValue, errorValue, highStart, highValueIndex, index, data) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, Trie), this.initialValue = initialValue, this.errorValue = errorValue, this.highStart = highStart, 
                this.highValueIndex = highValueIndex, this.index = index, this.data = data;
            }
            return _createClass(Trie, [ {
                key: "get",
                value: function(codePoint) {
                    var ix = void 0;
                    if (0 <= codePoint) {
                        if (codePoint < 55296 || 56319 < codePoint && codePoint <= 65535) return ix = ((ix = this.index[codePoint >> UTRIE2_SHIFT_2]) << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK), 
                        this.data[ix];
                        if (codePoint <= 65535) return ix = ((ix = this.index[UTRIE2_LSCP_INDEX_2_OFFSET + (codePoint - 55296 >> UTRIE2_SHIFT_2)]) << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK), 
                        this.data[ix];
                        if (codePoint < this.highStart) return ix = UTRIE2_INDEX_1_OFFSET - UTRIE2_OMITTED_BMP_INDEX_1_LENGTH + (codePoint >> UTRIE2_SHIFT_1), 
                        ix = this.index[ix], ix += codePoint >> UTRIE2_SHIFT_2 & UTRIE2_INDEX_2_MASK, ix = ((ix = this.index[ix]) << UTRIE2_INDEX_SHIFT) + (codePoint & UTRIE2_DATA_MASK), 
                        this.data[ix];
                        if (codePoint <= 1114111) return this.data[this.highValueIndex];
                    }
                    return this.errorValue;
                }
            } ]), Trie;
        }());
    }, function(module, exports, __webpack_require__) {
        "use strict";
        module.exports = " ";
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var _Path = __webpack_require__(6);
        exports.default = function Circle(x, y, radius) {
            !function(instance, Constructor) {
                if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
            }(this, Circle), this.type = _Path.PATH.CIRCLE, this.x = x, this.y = y, this.radius = radius, 
            isNaN(x) && console.error("Invalid x value given for Circle"), isNaN(y) && console.error("Invalid y value given for Circle"), 
            isNaN(radius) && console.error("Invalid radius value given for Circle");
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var obj, _slicedToArray = function(arr, i) {
            if (Array.isArray(arr)) return arr;
            if (Symbol.iterator in Object(arr)) return function(arr, i) {
                var _arr = [], _n = !0, _d = !1, _e = void 0;
                try {
                    for (var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), 
                    !i || _arr.length !== i); _n = !0) ;
                } catch (err) {
                    _d = !0, _e = err;
                } finally {
                    try {
                        !_n && _i.return && _i.return();
                    } finally {
                        if (_d) throw _e;
                    }
                }
                return _arr;
            }(arr, i);
            throw new TypeError("Invalid attempt to destructure non-iterable instance");
        }, _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _Bounds = __webpack_require__(2), _Gradient = (__webpack_require__(25), __webpack_require__(52)), _TextContainer = __webpack_require__(9), _TextContainer2 = (obj = _TextContainer) && obj.__esModule ? obj : {
            default: obj
        }, _background = __webpack_require__(5), _border = __webpack_require__(12);
        var Renderer = function() {
            function Renderer(target, options) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, Renderer), this.target = target, this.options = options, target.render(options);
            }
            return _createClass(Renderer, [ {
                key: "renderNode",
                value: function(container) {
                    container.isVisible() && (this.renderNodeBackgroundAndBorders(container), this.renderNodeContent(container));
                }
            }, {
                key: "renderNodeContent",
                value: function(container) {
                    var _this = this, callback = function() {
                        if (container.childNodes.length && container.childNodes.forEach(function(child) {
                            if (child instanceof _TextContainer2.default) {
                                var style = child.parent.style;
                                _this.target.renderTextNode(child.bounds, style.color, style.font, style.textDecoration, style.textShadow);
                            } else _this.target.drawShape(child, container.style.color);
                        }), container.image) {
                            var _image = _this.options.imageStore.get(container.image);
                            if (_image) {
                                var contentBox = (0, _Bounds.calculateContentBox)(container.bounds, container.style.padding, container.style.border), _width = "number" == typeof _image.width && 0 < _image.width ? _image.width : contentBox.width, _height = "number" == typeof _image.height && 0 < _image.height ? _image.height : contentBox.height;
                                0 < _width && 0 < _height && _this.target.clip([ (0, _Bounds.calculatePaddingBoxPath)(container.curvedBounds) ], function() {
                                    _this.target.drawImage(_image, new _Bounds.Bounds(0, 0, _width, _height), contentBox);
                                });
                            }
                        }
                    }, paths = container.getClipPaths();
                    paths.length ? this.target.clip(paths, callback) : callback();
                }
            }, {
                key: "renderNodeBackgroundAndBorders",
                value: function(container) {
                    var _this2 = this, HAS_BACKGROUND = !container.style.background.backgroundColor.isTransparent() || container.style.background.backgroundImage.length, hasRenderableBorders = container.style.border.some(function(border) {
                        return border.borderStyle !== _border.BORDER_STYLE.NONE && !border.borderColor.isTransparent();
                    }), callback = function() {
                        var backgroundPaintingArea = (0, _background.calculateBackgroungPaintingArea)(container.curvedBounds, container.style.background.backgroundClip);
                        HAS_BACKGROUND && _this2.target.clip([ backgroundPaintingArea ], function() {
                            container.style.background.backgroundColor.isTransparent() || _this2.target.fill(container.style.background.backgroundColor), 
                            _this2.renderBackgroundImage(container);
                        }), container.style.border.forEach(function(border, side) {
                            border.borderStyle === _border.BORDER_STYLE.NONE || border.borderColor.isTransparent() || _this2.renderBorder(border, side, container.curvedBounds);
                        });
                    };
                    if (HAS_BACKGROUND || hasRenderableBorders) {
                        var paths = container.parent ? container.parent.getClipPaths() : [];
                        paths.length ? this.target.clip(paths, callback) : callback();
                    }
                }
            }, {
                key: "renderBackgroundImage",
                value: function(container) {
                    var _this3 = this;
                    container.style.background.backgroundImage.slice(0).reverse().forEach(function(backgroundImage) {
                        "url" === backgroundImage.source.method && backgroundImage.source.args.length ? _this3.renderBackgroundRepeat(container, backgroundImage) : /gradient/i.test(backgroundImage.source.method) && _this3.renderBackgroundGradient(container, backgroundImage);
                    });
                }
            }, {
                key: "renderBackgroundRepeat",
                value: function(container, background) {
                    var image = this.options.imageStore.get(background.source.args[0]);
                    if (image) {
                        var backgroundPositioningArea = (0, _background.calculateBackgroungPositioningArea)(container.style.background.backgroundOrigin, container.bounds, container.style.padding, container.style.border), backgroundImageSize = (0, 
                        _background.calculateBackgroundSize)(background, image, backgroundPositioningArea), position = (0, 
                        _background.calculateBackgroundPosition)(background.position, backgroundImageSize, backgroundPositioningArea), _path = (0, 
                        _background.calculateBackgroundRepeatPath)(background, position, backgroundImageSize, backgroundPositioningArea, container.bounds), _offsetX = Math.round(backgroundPositioningArea.left + position.x), _offsetY = Math.round(backgroundPositioningArea.top + position.y);
                        this.target.renderRepeat(_path, image, backgroundImageSize, _offsetX, _offsetY);
                    }
                }
            }, {
                key: "renderBackgroundGradient",
                value: function(container, background) {
                    var backgroundPositioningArea = (0, _background.calculateBackgroungPositioningArea)(container.style.background.backgroundOrigin, container.bounds, container.style.padding, container.style.border), backgroundImageSize = (0, 
                    _background.calculateGradientBackgroundSize)(background, backgroundPositioningArea), position = (0, 
                    _background.calculateBackgroundPosition)(background.position, backgroundImageSize, backgroundPositioningArea), gradientBounds = new _Bounds.Bounds(Math.round(backgroundPositioningArea.left + position.x), Math.round(backgroundPositioningArea.top + position.y), backgroundImageSize.width, backgroundImageSize.height), gradient = (0, 
                    _Gradient.parseGradient)(container, background.source, gradientBounds);
                    if (gradient) switch (gradient.type) {
                      case _Gradient.GRADIENT_TYPE.LINEAR_GRADIENT:
                        this.target.renderLinearGradient(gradientBounds, gradient);
                        break;

                      case _Gradient.GRADIENT_TYPE.RADIAL_GRADIENT:
                        this.target.renderRadialGradient(gradientBounds, gradient);
                    }
                }
            }, {
                key: "renderBorder",
                value: function(border, side, curvePoints) {
                    this.target.drawShape((0, _Bounds.parsePathForBorder)(curvePoints, side), border.borderColor);
                }
            }, {
                key: "renderStack",
                value: function(stack) {
                    var _this4 = this;
                    if (stack.container.isVisible()) {
                        var _opacity = stack.getOpacity();
                        _opacity !== this._opacity && (this.target.setOpacity(stack.getOpacity()), this._opacity = _opacity);
                        var _transform = stack.container.style.transform;
                        null !== _transform ? this.target.transform(stack.container.bounds.left + _transform.transformOrigin[0].value, stack.container.bounds.top + _transform.transformOrigin[1].value, _transform.transform, function() {
                            return _this4.renderStackContent(stack);
                        }) : this.renderStackContent(stack);
                    }
                }
            }, {
                key: "renderStackContent",
                value: function(stack) {
                    var _splitStackingContext = splitStackingContexts(stack), _splitStackingContext2 = _slicedToArray(_splitStackingContext, 5), negativeZIndex = _splitStackingContext2[0], zeroOrAutoZIndexOrTransformedOrOpacity = _splitStackingContext2[1], positiveZIndex = _splitStackingContext2[2], nonPositionedFloats = _splitStackingContext2[3], nonPositionedInlineLevel = _splitStackingContext2[4], _splitDescendants = splitDescendants(stack), _splitDescendants2 = _slicedToArray(_splitDescendants, 2), inlineLevel = _splitDescendants2[0], nonInlineLevel = _splitDescendants2[1];
                    this.renderNodeBackgroundAndBorders(stack.container), negativeZIndex.sort(sortByZIndex).forEach(this.renderStack, this), 
                    this.renderNodeContent(stack.container), nonInlineLevel.forEach(this.renderNode, this), 
                    nonPositionedFloats.forEach(this.renderStack, this), nonPositionedInlineLevel.forEach(this.renderStack, this), 
                    inlineLevel.forEach(this.renderNode, this), zeroOrAutoZIndexOrTransformedOrOpacity.forEach(this.renderStack, this), 
                    positiveZIndex.sort(sortByZIndex).forEach(this.renderStack, this);
                }
            }, {
                key: "render",
                value: function(stack) {
                    var _this5 = this;
                    this.options.backgroundColor && this.target.rectangle(this.options.x, this.options.y, this.options.width, this.options.height, this.options.backgroundColor), 
                    this.renderStack(stack);
                    var target = this.target.getTarget();
                    return target.then(function(output) {
                        return _this5.options.logger.log("Render completed"), output;
                    });
                }
            } ]), Renderer;
        }();
        exports.default = Renderer;
        var splitDescendants = function(stack) {
            for (var inlineLevel = [], nonInlineLevel = [], length = stack.children.length, i = 0; i < length; i++) {
                var child = stack.children[i];
                child.isInlineLevel() ? inlineLevel.push(child) : nonInlineLevel.push(child);
            }
            return [ inlineLevel, nonInlineLevel ];
        }, splitStackingContexts = function(stack) {
            for (var negativeZIndex = [], zeroOrAutoZIndexOrTransformedOrOpacity = [], positiveZIndex = [], nonPositionedFloats = [], nonPositionedInlineLevel = [], length = stack.contexts.length, i = 0; i < length; i++) {
                var child = stack.contexts[i];
                child.container.isPositioned() || child.container.style.opacity < 1 || child.container.isTransformed() ? child.container.style.zIndex.order < 0 ? negativeZIndex.push(child) : 0 < child.container.style.zIndex.order ? positiveZIndex.push(child) : zeroOrAutoZIndexOrTransformedOrOpacity.push(child) : child.container.isFloating() ? nonPositionedFloats.push(child) : nonPositionedInlineLevel.push(child);
            }
            return [ negativeZIndex, zeroOrAutoZIndexOrTransformedOrOpacity, positiveZIndex, nonPositionedFloats, nonPositionedInlineLevel ];
        }, sortByZIndex = function(a, b) {
            return a.container.style.zIndex.order > b.container.style.zIndex.order ? 1 : a.container.style.zIndex.order < b.container.style.zIndex.order ? -1 : a.container.index > b.container.index ? 1 : -1;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.transformWebkitRadialGradientArgs = exports.parseGradient = exports.RadialGradient = exports.LinearGradient = exports.RADIAL_GRADIENT_SHAPE = exports.GRADIENT_TYPE = void 0;
        var _slicedToArray = function(arr, i) {
            if (Array.isArray(arr)) return arr;
            if (Symbol.iterator in Object(arr)) return function(arr, i) {
                var _arr = [], _n = !0, _d = !1, _e = void 0;
                try {
                    for (var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), 
                    !i || _arr.length !== i); _n = !0) ;
                } catch (err) {
                    _d = !0, _e = err;
                } finally {
                    try {
                        !_n && _i.return && _i.return();
                    } finally {
                        if (_d) throw _e;
                    }
                }
                return _arr;
            }(arr, i);
            throw new TypeError("Invalid attempt to destructure non-iterable instance");
        }, _Angle = (_interopRequireDefault(__webpack_require__(3)), __webpack_require__(53)), _Color2 = _interopRequireDefault(__webpack_require__(0)), _Length = __webpack_require__(1), _Length2 = _interopRequireDefault(_Length), _Util = __webpack_require__(4);
        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 SIDE_OR_CORNER = /^(to )?(left|top|right|bottom)( (left|top|right|bottom))?$/i, PERCENTAGE_ANGLES = /^([+-]?\d*\.?\d+)% ([+-]?\d*\.?\d+)%$/i, ENDS_WITH_LENGTH = /(px)|%|( 0)$/i, FROM_TO_COLORSTOP = /^(from|to|color-stop)\((?:([\d.]+)(%)?,\s*)?(.+?)\)$/i, RADIAL_SHAPE_DEFINITION = /^\s*(circle|ellipse)?\s*((?:([\d.]+)(px|r?em|%)\s*(?:([\d.]+)(px|r?em|%))?)|closest-side|closest-corner|farthest-side|farthest-corner)?\s*(?:at\s*(?:(left|center|right)|([\d.]+)(px|r?em|%))\s+(?:(top|center|bottom)|([\d.]+)(px|r?em|%)))?(?:\s|$)/i, GRADIENT_TYPE = exports.GRADIENT_TYPE = {
            LINEAR_GRADIENT: 0,
            RADIAL_GRADIENT: 1
        }, RADIAL_GRADIENT_SHAPE = exports.RADIAL_GRADIENT_SHAPE = {
            CIRCLE: 0,
            ELLIPSE: 1
        }, LENGTH_FOR_POSITION = {
            left: new _Length2.default("0%"),
            top: new _Length2.default("0%"),
            center: new _Length2.default("50%"),
            right: new _Length2.default("100%"),
            bottom: new _Length2.default("100%")
        }, LinearGradient = exports.LinearGradient = function LinearGradient(colorStops, direction) {
            _classCallCheck(this, LinearGradient), this.type = GRADIENT_TYPE.LINEAR_GRADIENT, 
            this.colorStops = colorStops, this.direction = direction;
        }, RadialGradient = exports.RadialGradient = function RadialGradient(colorStops, shape, center, radius) {
            _classCallCheck(this, RadialGradient), this.type = GRADIENT_TYPE.RADIAL_GRADIENT, 
            this.colorStops = colorStops, this.shape = shape, this.center = center, this.radius = radius;
        }, parseColorStops = (exports.parseGradient = function(container, _ref, bounds) {
            var args = _ref.args, method = _ref.method, prefix = _ref.prefix;
            return "linear-gradient" === method ? parseLinearGradient(args, bounds, !!prefix) : "gradient" === method && "linear" === args[0] ? parseLinearGradient([ "to bottom" ].concat(transformObsoleteColorStops(args.slice(3))), bounds, !!prefix) : "radial-gradient" === method ? parseRadialGradient(container, "-webkit-" === prefix ? transformWebkitRadialGradientArgs(args) : args, bounds) : "gradient" === method && "radial" === args[0] ? parseRadialGradient(container, transformObsoleteColorStops(transformWebkitRadialGradientArgs(args.slice(1))), bounds) : void 0;
        }, function(args, firstColorStopIndex, lineLength) {
            for (var colorStops = [], i = firstColorStopIndex; i < args.length; i++) {
                var value = args[i], HAS_LENGTH = ENDS_WITH_LENGTH.test(value), lastSpaceIndex = value.lastIndexOf(" "), _color = new _Color2.default(HAS_LENGTH ? value.substring(0, lastSpaceIndex) : value), _stop = HAS_LENGTH ? new _Length2.default(value.substring(lastSpaceIndex + 1)) : i === firstColorStopIndex ? new _Length2.default("0%") : i === args.length - 1 ? new _Length2.default("100%") : null;
                colorStops.push({
                    color: _color,
                    stop: _stop
                });
            }
            for (var absoluteValuedColorStops = colorStops.map(function(_ref2) {
                var color = _ref2.color, stop = _ref2.stop;
                return {
                    color: color,
                    stop: 0 === lineLength ? 0 : stop ? stop.getAbsoluteValue(lineLength) / lineLength : null
                };
            }), previousColorStop = absoluteValuedColorStops[0].stop, _i = 0; _i < absoluteValuedColorStops.length; _i++) if (null !== previousColorStop) {
                var _stop2 = absoluteValuedColorStops[_i].stop;
                if (null === _stop2) {
                    for (var n = _i; null === absoluteValuedColorStops[n].stop; ) n++;
                    for (var steps = n - _i + 1, stepSize = (absoluteValuedColorStops[n].stop - previousColorStop) / steps; _i < n; _i++) previousColorStop = absoluteValuedColorStops[_i].stop = previousColorStop + stepSize;
                } else previousColorStop = _stop2;
            }
            return absoluteValuedColorStops;
        }), parseLinearGradient = function(args, bounds, hasPrefix) {
            var angle = (0, _Angle.parseAngle)(args[0]), HAS_SIDE_OR_CORNER = SIDE_OR_CORNER.test(args[0]), HAS_DIRECTION = HAS_SIDE_OR_CORNER || null !== angle || PERCENTAGE_ANGLES.test(args[0]), direction = HAS_DIRECTION ? null !== angle ? calculateGradientDirection(hasPrefix ? angle - .5 * Math.PI : angle, bounds) : HAS_SIDE_OR_CORNER ? parseSideOrCorner(args[0], bounds) : parsePercentageAngle(args[0], bounds) : calculateGradientDirection(Math.PI, bounds), firstColorStopIndex = HAS_DIRECTION ? 1 : 0, lineLength = Math.min((0, 
            _Util.distance)(Math.abs(direction.x0) + Math.abs(direction.x1), Math.abs(direction.y0) + Math.abs(direction.y1)), 2 * bounds.width, 2 * bounds.height);
            return new LinearGradient(parseColorStops(args, firstColorStopIndex, lineLength), direction);
        }, parseRadialGradient = function(container, args, bounds) {
            var m = args[0].match(RADIAL_SHAPE_DEFINITION), shape = m && ("circle" === m[1] || void 0 !== m[3] && void 0 === m[5]) ? RADIAL_GRADIENT_SHAPE.CIRCLE : RADIAL_GRADIENT_SHAPE.ELLIPSE, radius = {}, center = {};
            m && (void 0 !== m[3] && (radius.x = (0, _Length.calculateLengthFromValueWithUnit)(container, m[3], m[4]).getAbsoluteValue(bounds.width)), 
            void 0 !== m[5] && (radius.y = (0, _Length.calculateLengthFromValueWithUnit)(container, m[5], m[6]).getAbsoluteValue(bounds.height)), 
            m[7] ? center.x = LENGTH_FOR_POSITION[m[7].toLowerCase()] : void 0 !== m[8] && (center.x = (0, 
            _Length.calculateLengthFromValueWithUnit)(container, m[8], m[9])), m[10] ? center.y = LENGTH_FOR_POSITION[m[10].toLowerCase()] : void 0 !== m[11] && (center.y = (0, 
            _Length.calculateLengthFromValueWithUnit)(container, m[11], m[12])));
            var gradientCenter = {
                x: void 0 === center.x ? bounds.width / 2 : center.x.getAbsoluteValue(bounds.width),
                y: void 0 === center.y ? bounds.height / 2 : center.y.getAbsoluteValue(bounds.height)
            }, gradientRadius = calculateRadius(m && m[2] || "farthest-corner", shape, gradientCenter, radius, bounds);
            return new RadialGradient(parseColorStops(args, m ? 1 : 0, Math.min(gradientRadius.x, gradientRadius.y)), shape, gradientCenter, gradientRadius);
        }, calculateGradientDirection = function(radian, bounds) {
            var width = bounds.width, height = bounds.height, HALF_WIDTH = .5 * width, HALF_HEIGHT = .5 * height, HALF_LINE_LENGTH = (Math.abs(width * Math.sin(radian)) + Math.abs(height * Math.cos(radian))) / 2, x0 = HALF_WIDTH + Math.sin(radian) * HALF_LINE_LENGTH, y0 = HALF_HEIGHT - Math.cos(radian) * HALF_LINE_LENGTH;
            return {
                x0: x0,
                x1: width - x0,
                y0: y0,
                y1: height - y0
            };
        }, parseTopRight = function(bounds) {
            return Math.acos(bounds.width / 2 / ((0, _Util.distance)(bounds.width, bounds.height) / 2));
        }, parseSideOrCorner = function(side, bounds) {
            switch (side) {
              case "bottom":
              case "to top":
                return calculateGradientDirection(0, bounds);

              case "left":
              case "to right":
                return calculateGradientDirection(Math.PI / 2, bounds);

              case "right":
              case "to left":
                return calculateGradientDirection(3 * Math.PI / 2, bounds);

              case "top right":
              case "right top":
              case "to bottom left":
              case "to left bottom":
                return calculateGradientDirection(Math.PI + parseTopRight(bounds), bounds);

              case "top left":
              case "left top":
              case "to bottom right":
              case "to right bottom":
                return calculateGradientDirection(Math.PI - parseTopRight(bounds), bounds);

              case "bottom left":
              case "left bottom":
              case "to top right":
              case "to right top":
                return calculateGradientDirection(parseTopRight(bounds), bounds);

              case "bottom right":
              case "right bottom":
              case "to top left":
              case "to left top":
                return calculateGradientDirection(2 * Math.PI - parseTopRight(bounds), bounds);

              case "top":
              case "to bottom":
              default:
                return calculateGradientDirection(Math.PI, bounds);
            }
        }, parsePercentageAngle = function(angle, bounds) {
            var _angle$split$map = angle.split(" ").map(parseFloat), _angle$split$map2 = _slicedToArray(_angle$split$map, 2), left = _angle$split$map2[0], top = _angle$split$map2[1], ratio = left / 100 * bounds.width / (top / 100 * bounds.height);
            return calculateGradientDirection(Math.atan(isNaN(ratio) ? 1 : ratio) + Math.PI / 2, bounds);
        }, findCorner = function(bounds, x, y, closest) {
            return [ {
                x: 0,
                y: 0
            }, {
                x: 0,
                y: bounds.height
            }, {
                x: bounds.width,
                y: 0
            }, {
                x: bounds.width,
                y: bounds.height
            } ].reduce(function(stat, corner) {
                var d = (0, _Util.distance)(x - corner.x, y - corner.y);
                return (closest ? d < stat.optimumDistance : d > stat.optimumDistance) ? {
                    optimumCorner: corner,
                    optimumDistance: d
                } : stat;
            }, {
                optimumDistance: closest ? 1 / 0 : -1 / 0,
                optimumCorner: null
            }).optimumCorner;
        }, calculateRadius = function(extent, shape, center, radius, bounds) {
            var x = center.x, y = center.y, rx = 0, ry = 0;
            switch (extent) {
              case "closest-side":
                shape === RADIAL_GRADIENT_SHAPE.CIRCLE ? rx = ry = Math.min(Math.abs(x), Math.abs(x - bounds.width), Math.abs(y), Math.abs(y - bounds.height)) : shape === RADIAL_GRADIENT_SHAPE.ELLIPSE && (rx = Math.min(Math.abs(x), Math.abs(x - bounds.width)), 
                ry = Math.min(Math.abs(y), Math.abs(y - bounds.height)));
                break;

              case "closest-corner":
                if (shape === RADIAL_GRADIENT_SHAPE.CIRCLE) rx = ry = Math.min((0, _Util.distance)(x, y), (0, 
                _Util.distance)(x, y - bounds.height), (0, _Util.distance)(x - bounds.width, y), (0, 
                _Util.distance)(x - bounds.width, y - bounds.height)); else if (shape === RADIAL_GRADIENT_SHAPE.ELLIPSE) {
                    var c = Math.min(Math.abs(y), Math.abs(y - bounds.height)) / Math.min(Math.abs(x), Math.abs(x - bounds.width)), corner = findCorner(bounds, x, y, !0);
                    ry = c * (rx = (0, _Util.distance)(corner.x - x, (corner.y - y) / c));
                }
                break;

              case "farthest-side":
                shape === RADIAL_GRADIENT_SHAPE.CIRCLE ? rx = ry = Math.max(Math.abs(x), Math.abs(x - bounds.width), Math.abs(y), Math.abs(y - bounds.height)) : shape === RADIAL_GRADIENT_SHAPE.ELLIPSE && (rx = Math.max(Math.abs(x), Math.abs(x - bounds.width)), 
                ry = Math.max(Math.abs(y), Math.abs(y - bounds.height)));
                break;

              case "farthest-corner":
                if (shape === RADIAL_GRADIENT_SHAPE.CIRCLE) rx = ry = Math.max((0, _Util.distance)(x, y), (0, 
                _Util.distance)(x, y - bounds.height), (0, _Util.distance)(x - bounds.width, y), (0, 
                _Util.distance)(x - bounds.width, y - bounds.height)); else if (shape === RADIAL_GRADIENT_SHAPE.ELLIPSE) {
                    var _c = Math.max(Math.abs(y), Math.abs(y - bounds.height)) / Math.max(Math.abs(x), Math.abs(x - bounds.width)), _corner = findCorner(bounds, x, y, !1);
                    ry = _c * (rx = (0, _Util.distance)(_corner.x - x, (_corner.y - y) / _c));
                }
                break;

              default:
                rx = radius.x || 0, ry = void 0 !== radius.y ? radius.y : rx;
            }
            return {
                x: rx,
                y: ry
            };
        }, transformWebkitRadialGradientArgs = exports.transformWebkitRadialGradientArgs = function(args) {
            var shape = "", radius = "", extent = "", position = "", idx = 0, POSITION = /^(left|center|right|\d+(?:px|r?em|%)?)(?:\s+(top|center|bottom|\d+(?:px|r?em|%)?))?$/i, RADIUS = /^\d+(px|r?em|%)?(?:\s+\d+(px|r?em|%)?)?$/i, matchStartPosition = args[idx].match(POSITION);
            matchStartPosition && idx++;
            var matchShapeExtent = args[idx].match(/^(circle|ellipse)?\s*(closest-side|closest-corner|farthest-side|farthest-corner|contain|cover)?$/i);
            matchShapeExtent && (shape = matchShapeExtent[1] || "", "contain" === (extent = matchShapeExtent[2] || "") ? extent = "closest-side" : "cover" === extent && (extent = "farthest-corner"), 
            idx++);
            var matchStartRadius = args[idx].match(RADIUS);
            matchStartRadius && idx++;
            var matchEndPosition = args[idx].match(POSITION);
            matchEndPosition && idx++;
            var matchEndRadius = args[idx].match(RADIUS);
            matchEndRadius && idx++;
            var matchPosition = matchEndPosition || matchStartPosition;
            matchPosition && matchPosition[1] && (position = matchPosition[1] + (/^\d+$/.test(matchPosition[1]) ? "px" : ""), 
            matchPosition[2] && (position += " " + matchPosition[2] + (/^\d+$/.test(matchPosition[2]) ? "px" : "")));
            var matchRadius = matchEndRadius || matchStartRadius;
            return matchRadius && (radius = matchRadius[0], matchRadius[1] || (radius += "px")), 
            !position || shape || radius || extent || (radius = position, position = ""), position && (position = "at " + position), 
            [ [ shape, extent, radius, position ].filter(function(s) {
                return !!s;
            }).join(" ") ].concat(args.slice(idx));
        }, transformObsoleteColorStops = function(args) {
            return args.map(function(color) {
                return color.match(FROM_TO_COLORSTOP);
            }).map(function(v, index) {
                if (!v) return args[index];
                switch (v[1]) {
                  case "from":
                    return v[4] + " 0%";

                  case "to":
                    return v[4] + " 100%";

                  case "color-stop":
                    return "%" === v[3] ? v[4] + " " + v[2] : v[4] + " " + 100 * parseFloat(v[2]) + "%";
                }
            });
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        });
        var ANGLE = /([+-]?\d*\.?\d+)(deg|grad|rad|turn)/i;
        exports.parseAngle = function(angle) {
            var match = angle.match(ANGLE);
            if (match) {
                var value = parseFloat(match[1]);
                switch (match[2].toLowerCase()) {
                  case "deg":
                    return Math.PI * value / 180;

                  case "grad":
                    return Math.PI / 200 * value;

                  case "rad":
                    return value;

                  case "turn":
                    return 2 * Math.PI * value;
                }
            }
            return null;
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.cloneWindow = exports.DocumentCloner = void 0;
        var _slicedToArray = function(arr, i) {
            if (Array.isArray(arr)) return arr;
            if (Symbol.iterator in Object(arr)) return function(arr, i) {
                var _arr = [], _n = !0, _d = !1, _e = void 0;
                try {
                    for (var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), 
                    !i || _arr.length !== i); _n = !0) ;
                } catch (err) {
                    _d = !0, _e = err;
                } finally {
                    try {
                        !_n && _i.return && _i.return();
                    } finally {
                        if (_d) throw _e;
                    }
                }
                return _arr;
            }(arr, i);
            throw new TypeError("Invalid attempt to destructure non-iterable instance");
        }, _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _Bounds = __webpack_require__(2), _Proxy = __webpack_require__(26), _ResourceLoader2 = _interopRequireDefault(__webpack_require__(55)), _Util = __webpack_require__(4), _background = __webpack_require__(5), _CanvasRenderer2 = _interopRequireDefault(__webpack_require__(15)), _PseudoNodeContent = __webpack_require__(56);
        function _interopRequireDefault(obj) {
            return obj && obj.__esModule ? obj : {
                default: obj
            };
        }
        var DocumentCloner = exports.DocumentCloner = function() {
            function DocumentCloner(element, options, logger, copyInline, renderer) {
                !function(instance, Constructor) {
                    if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
                }(this, DocumentCloner), this.referenceElement = element, this.scrolledElements = [], 
                this.copyStyles = copyInline, this.inlineImages = copyInline, this.logger = logger, 
                this.options = options, this.renderer = renderer, this.resourceLoader = new _ResourceLoader2.default(options, logger, window), 
                this.pseudoContentData = {
                    counters: {},
                    quoteDepth: 0
                }, this.documentElement = this.cloneNode(element.ownerDocument.documentElement);
            }
            return _createClass(DocumentCloner, [ {
                key: "inlineAllImages",
                value: function(node) {
                    var _this = this;
                    if (this.inlineImages && node) {
                        var style = node.style;
                        Promise.all((0, _background.parseBackgroundImage)(style.backgroundImage).map(function(backgroundImage) {
                            return "url" === backgroundImage.method ? _this.resourceLoader.inlineImage(backgroundImage.args[0]).then(function(img) {
                                return img && "string" == typeof img.src ? 'url("' + img.src + '")' : "none";
                            }).catch(function(e) {
                                _this.logger.log("Unable to load image", e);
                            }) : Promise.resolve("" + backgroundImage.prefix + backgroundImage.method + "(" + backgroundImage.args.join(",") + ")");
                        })).then(function(backgroundImages) {
                            1 < backgroundImages.length && (style.backgroundColor = ""), style.backgroundImage = backgroundImages.join(",");
                        }), node instanceof HTMLImageElement && this.resourceLoader.inlineImage(node.src).then(function(img) {
                            if (img && node instanceof HTMLImageElement && node.parentNode) {
                                var parentNode = node.parentNode, clonedChild = (0, _Util.copyCSSStyles)(node.style, img.cloneNode(!1));
                                parentNode.replaceChild(clonedChild, node);
                            }
                        }).catch(function(e) {
                            _this.logger.log("Unable to load image", e);
                        });
                    }
                }
            }, {
                key: "inlineFonts",
                value: function(document) {
                    var _this2 = this;
                    return Promise.all(Array.from(document.styleSheets).map(function(sheet) {
                        return sheet.href ? fetch(sheet.href).then(function(res) {
                            return res.text();
                        }).then(function(text) {
                            return createStyleSheetFontsFromText(text, sheet.href);
                        }).catch(function(e) {
                            return _this2.logger.log("Unable to load stylesheet", e), [];
                        }) : getSheetFonts(sheet, document);
                    })).then(function(fonts) {
                        return fonts.reduce(function(acc, font) {
                            return acc.concat(font);
                        }, []);
                    }).then(function(fonts) {
                        return Promise.all(fonts.map(function(font) {
                            return fetch(font.formats[0].src).then(function(response) {
                                return response.blob();
                            }).then(function(blob) {
                                return new Promise(function(resolve, reject) {
                                    var reader = new FileReader();
                                    reader.onerror = reject, reader.onload = function() {
                                        var result = reader.result;
                                        resolve(result);
                                    }, reader.readAsDataURL(blob);
                                });
                            }).then(function(dataUri) {
                                return font.fontFace.setProperty("src", 'url("' + dataUri + '")'), "@font-face {" + font.fontFace.cssText + " ";
                            });
                        }));
                    }).then(function(fontCss) {
                        var style = document.createElement("style");
                        style.textContent = fontCss.join("\n"), _this2.documentElement.appendChild(style);
                    });
                }
            }, {
                key: "createElementClone",
                value: function(node) {
                    var _this3 = this;
                    if (this.copyStyles && node instanceof HTMLCanvasElement) {
                        var img = node.ownerDocument.createElement("img");
                        try {
                            return img.src = node.toDataURL(), img;
                        } catch (e) {
                            this.logger.log("Unable to clone canvas contents, canvas is tainted");
                        }
                    }
                    if (node instanceof HTMLIFrameElement) {
                        var tempIframe = node.cloneNode(!1), iframeKey = generateIframeKey();
                        tempIframe.setAttribute("data-html2canvas-internal-iframe-key", iframeKey);
                        var _parseBounds = (0, _Bounds.parseBounds)(node, 0, 0), width = _parseBounds.width, height = _parseBounds.height;
                        return this.resourceLoader.cache[iframeKey] = getIframeDocumentElement(node, this.options).then(function(documentElement) {
                            return _this3.renderer(documentElement, {
                                async: _this3.options.async,
                                allowTaint: _this3.options.allowTaint,
                                backgroundColor: "#ffffff",
                                canvas: null,
                                imageTimeout: _this3.options.imageTimeout,
                                logging: _this3.options.logging,
                                proxy: _this3.options.proxy,
                                removeContainer: _this3.options.removeContainer,
                                scale: _this3.options.scale,
                                foreignObjectRendering: _this3.options.foreignObjectRendering,
                                useCORS: _this3.options.useCORS,
                                target: new _CanvasRenderer2.default(),
                                width: width,
                                height: height,
                                x: 0,
                                y: 0,
                                windowWidth: documentElement.ownerDocument.defaultView.innerWidth,
                                windowHeight: documentElement.ownerDocument.defaultView.innerHeight,
                                scrollX: documentElement.ownerDocument.defaultView.pageXOffset,
                                scrollY: documentElement.ownerDocument.defaultView.pageYOffset
                            }, _this3.logger.child(iframeKey));
                        }).then(function(canvas) {
                            return new Promise(function(resolve, reject) {
                                var iframeCanvas = document.createElement("img");
                                iframeCanvas.onload = function() {
                                    return resolve(canvas);
                                }, iframeCanvas.onerror = reject, iframeCanvas.src = canvas.toDataURL(), tempIframe.parentNode && tempIframe.parentNode.replaceChild((0, 
                                _Util.copyCSSStyles)(node.ownerDocument.defaultView.getComputedStyle(node), iframeCanvas), tempIframe);
                            });
                        }), tempIframe;
                    }
                    if (node instanceof HTMLStyleElement && node.sheet && node.sheet.cssRules) {
                        var css = [].slice.call(node.sheet.cssRules, 0).reduce(function(css, rule) {
                            try {
                                return rule && rule.cssText ? css + rule.cssText : css;
                            } catch (err) {
                                return _this3.logger.log("Unable to access cssText property", rule.name), css;
                            }
                        }, ""), style = node.cloneNode(!1);
                        return style.textContent = css, style;
                    }
                    return node.cloneNode(!1);
                }
            }, {
                key: "cloneNode",
                value: function(node) {
                    var clone = node.nodeType === Node.TEXT_NODE ? document.createTextNode(node.nodeValue) : this.createElementClone(node), window = node.ownerDocument.defaultView, style = node instanceof window.HTMLElement ? window.getComputedStyle(node) : null, styleBefore = node instanceof window.HTMLElement ? window.getComputedStyle(node, ":before") : null, styleAfter = node instanceof window.HTMLElement ? window.getComputedStyle(node, ":after") : null;
                    this.referenceElement === node && clone instanceof window.HTMLElement && (this.clonedReferenceElement = clone), 
                    clone instanceof window.HTMLBodyElement && createPseudoHideStyles(clone);
                    for (var counters = (0, _PseudoNodeContent.parseCounterReset)(style, this.pseudoContentData), contentBefore = (0, 
                    _PseudoNodeContent.resolvePseudoContent)(node, styleBefore, this.pseudoContentData), child = node.firstChild; child; child = child.nextSibling) child.nodeType === Node.ELEMENT_NODE && ("SCRIPT" === child.nodeName || child.hasAttribute("data-html2canvas-ignore") || "function" == typeof this.options.ignoreElements && this.options.ignoreElements(child)) || this.copyStyles && "STYLE" === child.nodeName || clone.appendChild(this.cloneNode(child));
                    var contentAfter = (0, _PseudoNodeContent.resolvePseudoContent)(node, styleAfter, this.pseudoContentData);
                    if ((0, _PseudoNodeContent.popCounters)(counters, this.pseudoContentData), node instanceof window.HTMLElement && clone instanceof window.HTMLElement) switch (styleBefore && this.inlineAllImages(inlinePseudoElement(node, clone, styleBefore, contentBefore, PSEUDO_BEFORE)), 
                    styleAfter && this.inlineAllImages(inlinePseudoElement(node, clone, styleAfter, contentAfter, PSEUDO_AFTER)), 
                    !style || !this.copyStyles || node instanceof HTMLIFrameElement || (0, _Util.copyCSSStyles)(style, clone), 
                    this.inlineAllImages(clone), 0 === node.scrollTop && 0 === node.scrollLeft || this.scrolledElements.push([ clone, node.scrollLeft, node.scrollTop ]), 
                    node.nodeName) {
                      case "CANVAS":
                        this.copyStyles || cloneCanvasContents(node, clone);
                        break;

                      case "TEXTAREA":
                      case "SELECT":
                        clone.value = node.value;
                    }
                    return clone;
                }
            } ]), DocumentCloner;
        }(), getSheetFonts = function(sheet, document) {
            return (sheet.cssRules ? Array.from(sheet.cssRules) : []).filter(function(rule) {
                return rule.type === CSSRule.FONT_FACE_RULE;
            }).map(function(rule) {
                for (var src = (0, _background.parseBackgroundImage)(rule.style.getPropertyValue("src")), formats = [], i = 0; i < src.length; i++) if ("url" === src[i].method && src[i + 1] && "format" === src[i + 1].method) {
                    var a = document.createElement("a");
                    a.href = src[i].args[0], document.body && document.body.appendChild(a);
                    var font = {
                        src: a.href,
                        format: src[i + 1].args[0]
                    };
                    formats.push(font);
                }
                return {
                    formats: formats.filter(function(font) {
                        return /^woff/i.test(font.format);
                    }),
                    fontFace: rule.style
                };
            }).filter(function(font) {
                return font.formats.length;
            });
        }, createStyleSheetFontsFromText = function(text, baseHref) {
            var doc = document.implementation.createHTMLDocument(""), base = document.createElement("base");
            base.href = baseHref;
            var style = document.createElement("style");
            return style.textContent = text, doc.head && doc.head.appendChild(base), doc.body && doc.body.appendChild(style), 
            style.sheet ? getSheetFonts(style.sheet, doc) : [];
        }, cloneCanvasContents = function(canvas, clonedCanvas) {
            try {
                if (clonedCanvas) {
                    clonedCanvas.width = canvas.width, clonedCanvas.height = canvas.height;
                    var ctx = canvas.getContext("2d"), clonedCtx = clonedCanvas.getContext("2d");
                    ctx ? clonedCtx.putImageData(ctx.getImageData(0, 0, canvas.width, canvas.height), 0, 0) : clonedCtx.drawImage(canvas, 0, 0);
                }
            } catch (e) {}
        }, inlinePseudoElement = function(node, clone, style, contentItems, pseudoElt) {
            if (style && style.content && "none" !== style.content && "-moz-alt-content" !== style.content && "none" !== style.display) {
                var anonymousReplacedElement = clone.ownerDocument.createElement("html2canvaspseudoelement");
                if ((0, _Util.copyCSSStyles)(style, anonymousReplacedElement), contentItems) for (var len = contentItems.length, i = 0; i < len; i++) {
                    var item = contentItems[i];
                    switch (item.type) {
                      case _PseudoNodeContent.PSEUDO_CONTENT_ITEM_TYPE.IMAGE:
                        var img = clone.ownerDocument.createElement("img");
                        img.src = (0, _background.parseBackgroundImage)("url(" + item.value + ")")[0].args[0], 
                        img.style.opacity = "1", anonymousReplacedElement.appendChild(img);
                        break;

                      case _PseudoNodeContent.PSEUDO_CONTENT_ITEM_TYPE.TEXT:
                        anonymousReplacedElement.appendChild(clone.ownerDocument.createTextNode(item.value));
                    }
                }
                return anonymousReplacedElement.className = PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER, 
                clone.className += pseudoElt === PSEUDO_BEFORE ? " " + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE : " " + PSEUDO_HIDE_ELEMENT_CLASS_AFTER, 
                pseudoElt === PSEUDO_BEFORE ? clone.insertBefore(anonymousReplacedElement, clone.firstChild) : clone.appendChild(anonymousReplacedElement), 
                anonymousReplacedElement;
            }
        }, PSEUDO_BEFORE = ":before", PSEUDO_AFTER = ":after", PSEUDO_HIDE_ELEMENT_CLASS_BEFORE = "___html2canvas___pseudoelement_before", PSEUDO_HIDE_ELEMENT_CLASS_AFTER = "___html2canvas___pseudoelement_after", createPseudoHideStyles = function(body) {
            createStyles(body, "." + PSEUDO_HIDE_ELEMENT_CLASS_BEFORE + PSEUDO_BEFORE + '{\n    content: "" !important;\n    display: none !important;\n}\n         .' + PSEUDO_HIDE_ELEMENT_CLASS_AFTER + PSEUDO_AFTER + '{\n    content: "" !important;\n    display: none !important;\n}');
        }, createStyles = function(body, styles) {
            var style = body.ownerDocument.createElement("style");
            style.innerHTML = styles, body.appendChild(style);
        }, initNode = function(_ref) {
            var _ref2 = _slicedToArray(_ref, 3), element = _ref2[0], x = _ref2[1], y = _ref2[2];
            element.scrollLeft = x, element.scrollTop = y;
        }, generateIframeKey = function() {
            return Math.ceil(Date.now() + 1e7 * Math.random()).toString(16);
        }, DATA_URI_REGEXP = /^data:text\/(.+);(base64)?,(.*)$/i, getIframeDocumentElement = function(node, options) {
            try {
                return Promise.resolve(node.contentWindow.document.documentElement);
            } catch (e) {
                return options.proxy ? (0, _Proxy.Proxy)(node.src, options).then(function(html) {
                    var match = html.match(DATA_URI_REGEXP);
                    return match ? "base64" === match[2] ? window.atob(decodeURIComponent(match[3])) : decodeURIComponent(match[3]) : Promise.reject();
                }).then(function(html) {
                    return createIframeContainer(node.ownerDocument, (0, _Bounds.parseBounds)(node, 0, 0)).then(function(cloneIframeContainer) {
                        var documentClone = cloneIframeContainer.contentWindow.document;
                        documentClone.open(), documentClone.write(html);
                        var iframeLoad = iframeLoader(cloneIframeContainer).then(function() {
                            return documentClone.documentElement;
                        });
                        return documentClone.close(), iframeLoad;
                    });
                }) : Promise.reject();
            }
        }, createIframeContainer = function(ownerDocument, bounds) {
            var cloneIframeContainer = ownerDocument.createElement("iframe");
            return cloneIframeContainer.className = "html2canvas-container", cloneIframeContainer.style.visibility = "hidden", 
            cloneIframeContainer.style.position = "fixed", cloneIframeContainer.style.left = "-10000px", 
            cloneIframeContainer.style.top = "0px", cloneIframeContainer.style.border = "0", 
            cloneIframeContainer.width = bounds.width.toString(), cloneIframeContainer.height = bounds.height.toString(), 
            cloneIframeContainer.scrolling = "no", cloneIframeContainer.setAttribute("data-html2canvas-ignore", "true"), 
            ownerDocument.body ? (ownerDocument.body.appendChild(cloneIframeContainer), Promise.resolve(cloneIframeContainer)) : Promise.reject("Body element not found in Document that is getting rendered");
        }, iframeLoader = function(cloneIframeContainer) {
            var cloneWindow = cloneIframeContainer.contentWindow, documentClone = cloneWindow.document;
            return new Promise(function(resolve, reject) {
                cloneWindow.onload = cloneIframeContainer.onload = documentClone.onreadystatechange = function() {
                    var interval = setInterval(function() {
                        0 < documentClone.body.childNodes.length && "complete" === documentClone.readyState && (clearInterval(interval), 
                        resolve(cloneIframeContainer));
                    }, 50);
                };
            });
        }, serializeDoctype = (exports.cloneWindow = function(ownerDocument, bounds, referenceElement, options, logger, renderer) {
            var cloner = new DocumentCloner(referenceElement, options, logger, !1, renderer), scrollX = ownerDocument.defaultView.pageXOffset, scrollY = ownerDocument.defaultView.pageYOffset;
            return createIframeContainer(ownerDocument, bounds).then(function(cloneIframeContainer) {
                var cloneWindow = cloneIframeContainer.contentWindow, documentClone = cloneWindow.document, iframeLoad = iframeLoader(cloneIframeContainer).then(function() {
                    cloner.scrolledElements.forEach(initNode), cloneWindow.scrollTo(bounds.left, bounds.top), 
                    !/(iPad|iPhone|iPod)/g.test(navigator.userAgent) || cloneWindow.scrollY === bounds.top && cloneWindow.scrollX === bounds.left || (documentClone.documentElement.style.top = -bounds.top + "px", 
                    documentClone.documentElement.style.left = -bounds.left + "px", documentClone.documentElement.style.position = "absolute");
                    var result = Promise.resolve([ cloneIframeContainer, cloner.clonedReferenceElement, cloner.resourceLoader ]), onclone = options.onclone;
                    return cloner.clonedReferenceElement instanceof cloneWindow.HTMLElement || cloner.clonedReferenceElement instanceof ownerDocument.defaultView.HTMLElement || cloner.clonedReferenceElement instanceof HTMLElement ? "function" == typeof onclone ? Promise.resolve().then(function() {
                        return onclone(documentClone);
                    }).then(function() {
                        return result;
                    }) : result : Promise.reject("Error finding the " + referenceElement.nodeName + " in the cloned document");
                });
                return documentClone.open(), documentClone.write(serializeDoctype(document.doctype) + "<html></html>"), 
                function(ownerDocument, x, y) {
                    !ownerDocument.defaultView || x === ownerDocument.defaultView.pageXOffset && y === ownerDocument.defaultView.pageYOffset || ownerDocument.defaultView.scrollTo(x, y);
                }(referenceElement.ownerDocument, scrollX, scrollY), documentClone.replaceChild(documentClone.adoptNode(cloner.documentElement), documentClone.documentElement), 
                documentClone.close(), iframeLoad;
            });
        }, function(doctype) {
            var str = "";
            return doctype && (str += "<!DOCTYPE ", doctype.name && (str += doctype.name), doctype.internalSubset && (str += doctype.internalSubset), 
            doctype.publicId && (str += '"' + doctype.publicId + '"'), doctype.systemId && (str += '"' + doctype.systemId + '"'), 
            str += ">"), str;
        });
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.ResourceStore = void 0;
        var obj, _createClass = function() {
            function defineProperties(target, props) {
                for (var i = 0; i < props.length; i++) {
                    var descriptor = props[i];
                    descriptor.enumerable = descriptor.enumerable || !1, descriptor.configurable = !0, 
                    "value" in descriptor && (descriptor.writable = !0), Object.defineProperty(target, descriptor.key, descriptor);
                }
            }
            return function(Constructor, protoProps, staticProps) {
                return protoProps && defineProperties(Constructor.prototype, protoProps), staticProps && defineProperties(Constructor, staticProps), 
                Constructor;
            };
        }(), _Feature = __webpack_require__(10), _Feature2 = (obj = _Feature) && obj.__esModule ? obj : {
            default: obj
        }, _Proxy = __webpack_require__(26);
        function _classCallCheck(instance, Constructor) {
            if (!(instance instanceof Constructor)) throw new TypeError("Cannot call a class as a function");
        }
        var ResourceLoader = function() {
            function ResourceLoader(options, logger, window) {
                _classCallCheck(this, ResourceLoader), this.options = options, this._window = window, 
                this.origin = this.getOrigin(window.location.href), this.cache = {}, this.logger = logger, 
                this._index = 0;
            }
            return _createClass(ResourceLoader, [ {
                key: "loadImage",
                value: function(src) {
                    var _this = this;
                    if (this.hasResourceInCache(src)) return src;
                    if (isBlobImage(src)) return this.cache[src] = _loadImage(src, this.options.imageTimeout || 0), 
                    src;
                    if (!isSVG(src) || _Feature2.default.SUPPORT_SVG_DRAWING) {
                        if (!0 === this.options.allowTaint || isInlineImage(src) || this.isSameOrigin(src)) return this.addImage(src, src, !1);
                        if (!this.isSameOrigin(src)) {
                            if ("string" == typeof this.options.proxy) return this.cache[src] = (0, _Proxy.Proxy)(src, this.options).then(function(src) {
                                return _loadImage(src, _this.options.imageTimeout || 0);
                            }), src;
                            if (!0 === this.options.useCORS && _Feature2.default.SUPPORT_CORS_IMAGES) return this.addImage(src, src, !0);
                        }
                    }
                }
            }, {
                key: "inlineImage",
                value: function(src) {
                    var _this2 = this;
                    return isInlineImage(src) ? _loadImage(src, this.options.imageTimeout || 0) : this.hasResourceInCache(src) ? this.cache[src] : this.isSameOrigin(src) || "string" != typeof this.options.proxy ? this.xhrImage(src) : this.cache[src] = (0, 
                    _Proxy.Proxy)(src, this.options).then(function(src) {
                        return _loadImage(src, _this2.options.imageTimeout || 0);
                    });
                }
            }, {
                key: "xhrImage",
                value: function(src) {
                    var _this3 = this;
                    return this.cache[src] = new Promise(function(resolve, reject) {
                        var xhr = new XMLHttpRequest();
                        if (xhr.onreadystatechange = function() {
                            if (4 === xhr.readyState) if (200 !== xhr.status) reject("Failed to fetch image " + src.substring(0, 256) + " with status code " + xhr.status); else {
                                var reader = new FileReader();
                                reader.addEventListener("load", function() {
                                    var result = reader.result;
                                    resolve(result);
                                }, !1), reader.addEventListener("error", function(e) {
                                    return reject(e);
                                }, !1), reader.readAsDataURL(xhr.response);
                            }
                        }, xhr.responseType = "blob", _this3.options.imageTimeout) {
                            var timeout = _this3.options.imageTimeout;
                            xhr.timeout = timeout, xhr.ontimeout = function() {
                                return reject("Timed out (" + timeout + "ms) fetching " + src.substring(0, 256));
                            };
                        }
                        xhr.open("GET", src, !0), xhr.send();
                    }).then(function(src) {
                        return _loadImage(src, _this3.options.imageTimeout || 0);
                    }), this.cache[src];
                }
            }, {
                key: "loadCanvas",
                value: function(node) {
                    var key = String(this._index++);
                    return this.cache[key] = Promise.resolve(node), key;
                }
            }, {
                key: "hasResourceInCache",
                value: function(key) {
                    return void 0 !== this.cache[key];
                }
            }, {
                key: "addImage",
                value: function(key, src, useCORS) {
                    var _this4 = this;
                    this.logger.log("Added image " + key.substring(0, 256));
                    var imageLoadHandler = function(supportsDataImages) {
                        return new Promise(function(resolve, reject) {
                            var img = new Image();
                            if (img.onload = function() {
                                return resolve(img);
                            }, supportsDataImages && !useCORS || (img.crossOrigin = "anonymous"), img.onerror = reject, 
                            img.src = src, !0 === img.complete && setTimeout(function() {
                                resolve(img);
                            }, 500), _this4.options.imageTimeout) {
                                var timeout = _this4.options.imageTimeout;
                                setTimeout(function() {
                                    return reject("Timed out (" + timeout + "ms) fetching " + src.substring(0, 256));
                                }, timeout);
                            }
                        });
                    };
                    return this.cache[key] = isInlineBase64Image(src) && !isSVG(src) ? _Feature2.default.SUPPORT_BASE64_DRAWING(src).then(imageLoadHandler) : imageLoadHandler(!0), 
                    key;
                }
            }, {
                key: "isSameOrigin",
                value: function(url) {
                    return this.getOrigin(url) === this.origin;
                }
            }, {
                key: "getOrigin",
                value: function(url) {
                    var link = this._link || (this._link = this._window.document.createElement("a"));
                    return link.href = url, link.href = link.href, link.protocol + link.hostname + link.port;
                }
            }, {
                key: "ready",
                value: function() {
                    var _this5 = this, keys = Object.keys(this.cache), values = keys.map(function(str) {
                        return _this5.cache[str].catch(function(e) {
                            return _this5.logger.log("Unable to load image", e), null;
                        });
                    });
                    return Promise.all(values).then(function(images) {
                        return _this5.logger.log("Finished loading " + images.length + " images", images), 
                        new ResourceStore(keys, images);
                    });
                }
            } ]), ResourceLoader;
        }();
        exports.default = ResourceLoader;
        var ResourceStore = exports.ResourceStore = function() {
            function ResourceStore(keys, resources) {
                _classCallCheck(this, ResourceStore), this._keys = keys, this._resources = resources;
            }
            return _createClass(ResourceStore, [ {
                key: "get",
                value: function(key) {
                    var index = this._keys.indexOf(key);
                    return -1 === index ? null : this._resources[index];
                }
            } ]), ResourceStore;
        }(), INLINE_SVG = /^data:image\/svg\+xml/i, INLINE_BASE64 = /^data:image\/.*;base64,/i, INLINE_IMG = /^data:image\/.*/i, isInlineImage = function(src) {
            return INLINE_IMG.test(src);
        }, isInlineBase64Image = function(src) {
            return INLINE_BASE64.test(src);
        }, isBlobImage = function(src) {
            return "blob" === src.substr(0, 4);
        }, isSVG = function(src) {
            return "svg" === src.substr(-3).toLowerCase() || INLINE_SVG.test(src);
        }, _loadImage = function(src, timeout) {
            return new Promise(function(resolve, reject) {
                var img = new Image();
                img.onload = function() {
                    return resolve(img);
                }, img.onerror = reject, img.src = src, !0 === img.complete && setTimeout(function() {
                    resolve(img);
                }, 500), timeout && setTimeout(function() {
                    return reject("Timed out (" + timeout + "ms) loading image");
                }, timeout);
            });
        };
    }, function(module, exports, __webpack_require__) {
        "use strict";
        Object.defineProperty(exports, "__esModule", {
            value: !0
        }), exports.parseContent = exports.resolvePseudoContent = exports.popCounters = exports.parseCounterReset = exports.TOKEN_TYPE = exports.PSEUDO_CONTENT_ITEM_TYPE = void 0;
        var _slicedToArray = function(arr, i) {
            if (Array.isArray(arr)) return arr;
            if (Symbol.iterator in Object(arr)) return function(arr, i) {
                var _arr = [], _n = !0, _d = !1, _e = void 0;
                try {
                    for (var _s, _i = arr[Symbol.iterator](); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), 
                    !i || _arr.length !== i); _n = !0) ;
                } catch (err) {
                    _d = !0, _e = err;
                } finally {
                    try {
                        !_n && _i.return && _i.return();
                    } finally {
                        if (_d) throw _e;
                    }
                }
                return _arr;
            }(arr, i);
            throw new TypeError("Invalid attempt to destructure non-iterable instance");
        }, _ListItem = __webpack_require__(14), _listStyle = __webpack_require__(8), PSEUDO_CONTENT_ITEM_TYPE = exports.PSEUDO_CONTENT_ITEM_TYPE = {
            TEXT: 0,
            IMAGE: 1
        }, TOKEN_TYPE = exports.TOKEN_TYPE = {
            STRING: 0,
            ATTRIBUTE: 1,
            URL: 2,
            COUNTER: 3,
            COUNTERS: 4,
            OPENQUOTE: 5,
            CLOSEQUOTE: 6
        }, parseContent = (exports.parseCounterReset = function(style, data) {
            if (!style || !style.counterReset || "none" === style.counterReset) return [];
            for (var counterNames = [], counterResets = style.counterReset.split(/\s*,\s*/), lenCounterResets = counterResets.length, i = 0; i < lenCounterResets; i++) {
                var _counterResets$i$spli = counterResets[i].split(/\s+/), _counterResets$i$spli2 = _slicedToArray(_counterResets$i$spli, 2), counterName = _counterResets$i$spli2[0], initialValue = _counterResets$i$spli2[1];
                counterNames.push(counterName);
                var counter = data.counters[counterName];
                counter || (counter = data.counters[counterName] = []), counter.push(parseInt(initialValue || 0, 10));
            }
            return counterNames;
        }, exports.popCounters = function(counterNames, data) {
            for (var lenCounters = counterNames.length, i = 0; i < lenCounters; i++) data.counters[counterNames[i]].pop();
        }, exports.resolvePseudoContent = function(node, style, data) {
            if (!style || !style.content || "none" === style.content || "-moz-alt-content" === style.content || "none" === style.display) return null;
            var tokens = parseContent(style.content), len = tokens.length, contentItems = [], s = "", counterIncrement = style.counterIncrement;
            if (counterIncrement && "none" !== counterIncrement) {
                var _counterIncrement$spl = counterIncrement.split(/\s+/), _counterIncrement$spl2 = _slicedToArray(_counterIncrement$spl, 2), counterName = _counterIncrement$spl2[0], incrementValue = _counterIncrement$spl2[1], counter = data.counters[counterName];
                counter && (counter[counter.length - 1] += void 0 === incrementValue ? 1 : parseInt(incrementValue, 10));
            }
            for (var i = 0; i < len; i++) {
                var token = tokens[i];
                switch (token.type) {
                  case TOKEN_TYPE.STRING:
                    s += token.value || "";
                    break;

                  case TOKEN_TYPE.ATTRIBUTE:
                    node instanceof HTMLElement && token.value && (s += node.getAttribute(token.value) || "");
                    break;

                  case TOKEN_TYPE.COUNTER:
                    var _counter = data.counters[token.name || ""];
                    _counter && (s += formatCounterValue([ _counter[_counter.length - 1] ], "", token.format));
                    break;

                  case TOKEN_TYPE.COUNTERS:
                    var _counters = data.counters[token.name || ""];
                    _counters && (s += formatCounterValue(_counters, token.glue, token.format));
                    break;

                  case TOKEN_TYPE.OPENQUOTE:
                    s += getQuote(style, !0, data.quoteDepth), data.quoteDepth++;
                    break;

                  case TOKEN_TYPE.CLOSEQUOTE:
                    data.quoteDepth--, s += getQuote(style, !1, data.quoteDepth);
                    break;

                  case TOKEN_TYPE.URL:
                    s && (contentItems.push({
                        type: PSEUDO_CONTENT_ITEM_TYPE.TEXT,
                        value: s
                    }), s = ""), contentItems.push({
                        type: PSEUDO_CONTENT_ITEM_TYPE.IMAGE,
                        value: token.value || ""
                    });
                }
            }
            return s && contentItems.push({
                type: PSEUDO_CONTENT_ITEM_TYPE.TEXT,
                value: s
            }), contentItems;
        }, exports.parseContent = function(content, cache) {
            if (cache && cache[content]) return cache[content];
            for (var tokens = [], len = content.length, isString = !1, isEscaped = !1, isFunction = !1, str = "", functionName = "", args = [], i = 0; i < len; i++) {
                var c = content.charAt(i);
                switch (c) {
                  case "'":
                  case '"':
                    isEscaped ? str += c : (isString = !isString, isFunction || isString || (tokens.push({
                        type: TOKEN_TYPE.STRING,
                        value: str
                    }), str = ""));
                    break;

                  case "\\":
                    isEscaped ? (str += c, isEscaped = !1) : isEscaped = !0;
                    break;

                  case "(":
                    isString ? str += c : (isFunction = !0, functionName = str, str = "", args = []);
                    break;

                  case ")":
                    if (isString) str += c; else if (isFunction) {
                        switch (str && args.push(str), functionName) {
                          case "attr":
                            0 < args.length && tokens.push({
                                type: TOKEN_TYPE.ATTRIBUTE,
                                value: args[0]
                            });
                            break;

                          case "counter":
                            if (0 < args.length) {
                                var counter = {
                                    type: TOKEN_TYPE.COUNTER,
                                    name: args[0]
                                };
                                1 < args.length && (counter.format = args[1]), tokens.push(counter);
                            }
                            break;

                          case "counters":
                            if (0 < args.length) {
                                var _counters2 = {
                                    type: TOKEN_TYPE.COUNTERS,
                                    name: args[0]
                                };
                                1 < args.length && (_counters2.glue = args[1]), 2 < args.length && (_counters2.format = args[2]), 
                                tokens.push(_counters2);
                            }
                            break;

                          case "url":
                            0 < args.length && tokens.push({
                                type: TOKEN_TYPE.URL,
                                value: args[0]
                            });
                        }
                        isFunction = !1, str = "";
                    }
                    break;

                  case ",":
                    isString ? str += c : isFunction && (args.push(str), str = "");
                    break;

                  case " ":
                  case "\t":
                    isString ? str += c : str && (addOtherToken(tokens, str), str = "");
                    break;

                  default:
                    str += c;
                }
                "\\" !== c && (isEscaped = !1);
            }
            return str && addOtherToken(tokens, str), cache && (cache[content] = tokens), tokens;
        }), addOtherToken = function(tokens, identifier) {
            switch (identifier) {
              case "open-quote":
                tokens.push({
                    type: TOKEN_TYPE.OPENQUOTE
                });
                break;

              case "close-quote":
                tokens.push({
                    type: TOKEN_TYPE.CLOSEQUOTE
                });
            }
        }, getQuote = function(style, isOpening, quoteDepth) {
            var quotes = style.quotes ? style.quotes.split(/\s+/) : [ "'\"'", "'\"'" ], idx = 2 * quoteDepth;
            return idx >= quotes.length && (idx = quotes.length - 2), isOpening || ++idx, quotes[idx].replace(/^["']|["']$/g, "");
        }, formatCounterValue = function(counter, glue, format) {
            for (var len = counter.length, result = "", i = 0; i < len; i++) 0 < i && (result += glue || ""), 
            result += (0, _ListItem.createCounterText)(counter[i], (0, _listStyle.parseListStyleType)(format || "decimal"), !1);
            return result;
        };
    } ]);
}), angular.module("adminServices", [ "restServices", "usersServices" ]).factory("adminService", [ "usersService", "$q", "$http", function(usersService, $q, $http) {
    var adminServ = {
        getListList: function() {
            return $http.get("assets/sharepointLists.js");
        },
        getLibraryList: function() {
            return $http.get("assets/sharepointLibraries.js");
        },
        getInitialData: function() {
            return $http.get("assets/initialData.js");
        }
    };
    return adminServ;
} ]), angular.module("auditFormsServices", [ "gettext", "ngDialog", "restServices", "socialServices", "miscServices", "usersServices" ]).service("auditFormsService", [ "$q", "gettext", "ngDialog", "restListService", "restDocumentService", "usersService", "interactionService", "subscriptionService", "miscServices", function($q, gettext, ngDialog, restListService, restDocumentService, usersService, interactionService, subscriptionService, miscServices) {
    var auditFormsPromise, auditFormsServ = {}, auditFormsDataByKeyword = {}, auditFormsDataById = {}, formatFormsData = function(restData) {
        var ret = {
            id: restData.Id,
            title: restData.Title,
            auditForm: restData.auditForm,
            sourceData: {},
            resultsData: {},
            result: restData.result,
            keywords: restData.keywords.split(",").filter(function(keyword) {
                return "" !== keyword.trim();
            }),
            createdInTask: restData.createdInTask,
            archivedTask: restData.archivedTask,
            createdInElement: restData.createdInElement,
            workflowStatus: restData.workflowStatus,
            workflowChanges: [],
            assigned_to: restData.AssignedToId,
            created_at: new Date(restData.Created),
            last_modified_at: new Date(restData.Modified),
            last_modified_by: restData.EditorId
        };
        try {
            ret.sourceData = JSON.parse(restData.sourceData);
        } catch (e) {
            console.log("ERROR in formatFormsData while parsing sourceData element:"), console.log([ restData, e ]);
        }
        try {
            ret.resultsData = JSON.parse(restData.resultsData);
        } catch (e) {
            console.log("ERROR in formatFormsData while parsing resultsData element:"), console.log([ restData, e ]);
        }
        try {
            ret.workflowChanges = JSON.parse(restData.workflowChanges);
        } catch (e) {
            console.log("ERROR in formatFormsData while parsing workflowChanges element:"), 
            console.log([ restData, e ]);
        }
        try {
            ret.interactionSummary = JSON.parse(restData.interactionSummary);
        } catch (e) {
            console.log("ERROR in formatFormsData while parsing workflowChanges element:"), 
            console.log([ restData, e ]), ret.interactionSummary = {};
        }
        return ret;
    }, includingPromiseKeys = function(keyword) {
        return Object.keys(auditFormsDataByKeyword).filter(function(key) {
            return void 0 !== auditFormsDataByKeyword[key] && keyword.match(key);
        });
    };
    return auditFormsServ.getAllForms = function() {
        return void 0 === auditFormsPromise && (auditFormsPromise = restDocumentService.getAllFiles("audit_forms").then(function(res) {
            var auditForms = {};
            if (!(res && res.data && res.data.d && res.data.d.results && Array.isArray(res.data.d.results))) return console.log("ERROR - The data returned from the server while trying to retrieve audit forms was not in the expected format:"), 
            console.log(res), $q.reject(gettext("The data returned from the server while trying to retrieve audit forms was not in the expected format."));
            var resolveUriPromise = $q.resolve();
            return res.data.d.results.forEach(function(d) {
                auditForms[d.shortKey] = {
                    id: d.Id,
                    title: d.Title,
                    shortKey: d.shortKey,
                    newFormIcon: d.newFormIcon,
                    resultExpression: d.resultExpression
                };
                try {
                    d.tabs && (auditForms[d.shortKey].tabs = JSON.parse(d.tabs));
                } catch (e) {
                    console.log("An ERROR occured trying to parse the tabs for the audit form " + d.shortKey + ":"), 
                    console.log(e), console.log("Most likely the tabs JSON for this audit form is invalid."), 
                    auditForms[d.shortKey].tabs = [];
                }
                try {
                    d.additionalSources && (auditForms[d.shortKey].additionalSources = JSON.parse(d.additionalSources));
                } catch (e) {
                    console.log("An ERROR occured trying to parse the additionalSources for the audit form " + d.shortKey + ":"), 
                    console.log(e), console.log("Most likely the additionalSources JSON for this audit form is invalid."), 
                    auditForms[d.shortKey].additionalSources = [];
                }
                try {
                    auditForms[d.shortKey].iconMap = JSON.parse(d.iconMap);
                } catch (e) {
                    console.log("An ERROR occured trying to parse the iconMap for the audit form " + d.shortKey + ":"), 
                    console.log(e), console.log("Most likely the iconMap JSON for this audit form is invalid."), 
                    auditForms[d.shortKey].iconMap = {};
                }
                resolveUriPromise = resolveUriPromise.then(function() {
                    return restDocumentService.expandFilePath(d.File.__deferred.uri);
                }).then(function(path) {
                    auditForms[d.shortKey].formUrl = path[0];
                });
            }), resolveUriPromise.then(function() {
                return auditForms;
            });
        }, function(err) {
            return console.log("An error occured retrieving audit forms:"), console.log(err), 
            $q.reject(gettext("An error occured retrieving audit forms."));
        })), auditFormsPromise;
    }, auditFormsServ.getAuditForm = function(auditFormKey) {
        return auditFormsServ.getAllForms().then(function(auditForms) {
            return auditForms[auditFormKey];
        });
    }, auditFormsServ.findFormData = function(keywords, isTemplate) {
        var ourPromise, keywordPromises = [], regexpKeywords = [];
        if (console.log("findFormData called: "), console.log([ keywords, isTemplate ]), 
        keywords.forEach(function(keyword) {
            var matchingPromises = includingPromiseKeys(keyword);
            0 < matchingPromises.length && keywordPromises.push(auditFormsDataByKeyword[matchingPromises[0]]), 
            console.log("findFormData: Tried to match existing promises:"), console.log([ keywords, keyword, matchingPromises, keywordPromises ]), 
            regexpKeywords.push(function(keyword, isTemplate) {
                return isTemplate ? keyword.split(/\{\{[^\}]+\}\}/).map(function(part) {
                    return miscServices.escapeForRegexp(part);
                }).join(".*") : miscServices.escapeForRegexp(keyword);
            }(keyword, isTemplate));
        }), keywordPromises.length < keywords.length) {
            var searchString = keywords.map(function(keywordToSplit) {
                return isTemplate ? "(" + keywordToSplit.split(/\{\{[^\}]+\}\}/).filter(function(keywordPart) {
                    return "" !== keywordPart.trim();
                }).map(function(keywordPart) {
                    return "substringof('" + keywordPart + "', keywords)";
                }).join(" and ") + ")" : "substringof('" + keywordToSplit + ",', keywords)";
            }).join(" or ");
            console.log("findFormData: Calling getMergedFilteredItems on audit_forms_data with search string: " + searchString), 
            ourPromise = restListService.getMergedFilteredItems("audit_forms_data", searchString).then(function(res) {
                return res && res.data && res.data.d && Array.isArray(res.data.d.results) ? res.data.d.results.map(formatFormsData) : (console.log("ERROR in findFormData: The obtained data object is not formatted as expected:"), 
                console.log(res), $q.reject(gettext("An error occurred: The obtained data object is not formatted as expected.")));
            }), regexpKeywords.forEach(function(regexpKeyword) {
                void 0 === auditFormsDataByKeyword[regexpKeyword] && (auditFormsDataByKeyword[regexpKeyword] = ourPromise);
            });
        } else ourPromise = $q.all(keywordPromises).then(function(arrayOfArrays) {
            console.log("findFormData: Received data from existing promises:"), console.log([ keywordPromises, arrayOfArrays ]);
            var ret = [];
            return arrayOfArrays.forEach(function(arr) {
                ret = ret.concat(arr);
            }), ret;
        });
        return ourPromise.then(function(data) {
            return console.log("findFormData: Received raw data, will now filter:"), console.log(data), 
            data.filter(function(el) {
                return -1 !== regexpKeywords.findIndex(function(regexpKeyword) {
                    return -1 !== el.keywords.findIndex(function(keyword) {
                        return keyword.match(regexpKeyword);
                    });
                });
            });
        });
    }, auditFormsServ.getFormData = function(formDataId) {
        return void 0 !== auditFormsDataById[formDataId] || (auditFormsDataById[formDataId] = restListService.getItemById("audit_forms_data", formDataId).then(function(res) {
            return res && res.data && res.data.d ? formatFormsData(res.data.d) : (console.log("ERROR in getFormData: The obtained data object is not formatted as expected:"), 
            console.log(res), $q.reject(gettext("An error occurred: The obtained data object is not formatted as expected.")));
        }, function(err) {
            return console.log("ERROR while trying to retrieve getFormData for formDataId = " + formDataId + ":"), 
            console.log(err), $q.reject(gettext("An error occured while trying to retrieve form data: ") + err);
        })), auditFormsDataById[formDataId];
    }, auditFormsServ.saveFormData = function(formsData) {
        var restData = function(formsData) {
            var cleanedSourceData = {};
            return formsData.sourceData && Object.keys(formsData.sourceData).forEach(function(key) {
                "_" !== key.substr(0, 1) && "$" !== key.substr(0, 1) && (cleanedSourceData[key] = formsData.sourceData[key]);
            }), {
                Title: formsData.title,
                auditForm: formsData.auditForm,
                sourceData: JSON.stringify(cleanedSourceData),
                resultsData: JSON.stringify(formsData.resultsData ? formsData.resultsData : {}),
                result: formsData.result,
                keywords: formsData.keywords.join(",") + ",",
                createdInTask: formsData.createdInTask,
                archivedTask: formsData.archivedTask,
                createdInElement: formsData.createdInElement,
                workflowStatus: formsData.workflowStatus,
                workflowChanges: JSON.stringify(formsData.workflowChanges ? formsData.workflowChanges : []),
                assignedToId: formsData.assigned_to
            };
        }(formsData);
        return (void 0 !== formsData.id && null !== formsData.id && -1 !== formsData.id ? restListService.updateItem("audit_forms_data", formsData.id, restData) : restListService.addItem("audit_forms_data", restData)).then(function(res) {
            return formsData.keywords.forEach(function(keyword) {
                includingPromiseKeys(keyword).forEach(function(promiseKey) {
                    auditFormsDataByKeyword[promiseKey] = void 0;
                });
            }), formsData.last_modified_at = new Date(), res.data && res.data.d && void 0 !== res.data.d.Id && (formsData.id = res.data.d.Id), 
            usersService.getCurrentUser().then(function(user) {
                return formsData.last_modified_by = user.id, formsData;
            });
        });
    }, auditFormsServ.deleteFormData = function(formDataId) {
        return restListService.deleteItem("audit_forms_data", formDataId).then(function() {
            return subscriptionService.removeNewsBySource("auditFormData", formDataId).then(function() {
                return interactionService.removeInteractionsByTarget("auditFormData", formDataId);
            }), !0;
        }, function(err) {
            return console.log("ERROR while trying to delete getFormData for formDataId = " + formDataId + ":"), 
            console.log(err), $q.reject(gettext("An error occured while trying to delete form data: ") + err);
        });
    }, auditFormsServ.archiveFormData = function(oldTaskId, archivedTaskId) {
        var currUser;
        return usersService.getCurrentUser().then(function(_currUser) {
            return currUser = _currUser, restListService.getMergedFilteredItems("audit_forms_data", "createdInTask eq " + oldTaskId + " and archivedTask eq 0", "Id, createdInTask, archivedTask, workflowStatus, workflowChanges");
        }).then(function(res) {
            if (!(res && res.data && res.data.d && Array.isArray(res.data.d.results))) return console.log("ERROR: Could not archive audit forms data: The response received was not in the expected format:"), 
            console.log(res), $q.reject(gettext("Could not archive audit forms data: The response received was not in the expected format."));
            var processPromise = $q.resolve();
            return res.data.d.results.forEach(function(formData) {
                var workflowChanges;
                try {
                    workflowChanges = JSON.parse(formData.workflowChanges);
                } catch (e) {
                    workflowChanges = [];
                }
                workflowChanges.push({
                    status: "Archived",
                    change_at: new Date(),
                    change_by: currUser.id
                });
                var updateItem = {
                    Id: formData.Id,
                    createdInTask: archivedTaskId,
                    archivedTask: !0,
                    workflowStatus: "Archived",
                    workflowChanges: JSON.stringify(workflowChanges)
                };
                processPromise = processPromise.then(function() {
                    return restListService.updateItem("audit_forms_data", formData.Id, updateItem);
                });
            }), processPromise;
        });
    }, auditFormsServ.updateWorkflowStatus = function(formsData, newStatus) {
        return usersService.getCurrentUser().then(function(currUser) {
            return formsData.workflowChanges.push({
                status: newStatus,
                change_at: new Date(),
                change_by: currUser.id
            }), formsData.workflowStatus = newStatus, restListService.updateItem("audit_forms_data", formsData.id, {
                workflowChanges: JSON.stringify(formsData.workflowChanges),
                workflowStatus: formsData.workflowStatus
            });
        });
    }, auditFormsServ.showFormData = function(formDataId) {
        return auditFormsServ.getFormData(formDataId).then(function(formData) {
            return ngDialog.open({
                template: "common/directives/auditFormsFormDialog.tmpl.html",
                className: "ngdialog-theme-default",
                data: {
                    auditFormData: formData,
                    readOnly: !0
                }
            });
        }, function(err) {
            return console.log("An ERROR occured while trying to retrieve the form data ID " + formDataId + " to display in the dialog box:"), 
            console.log(err), $q.reject(gettext("An error occured while trying to open this audit form."));
        });
    }, auditFormsServ;
} ]), angular.module("chartServices", []).factory("d3", function() {
    var availableLocales = {
        en: {
            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" ]
        },
        de: {
            decimal: ".",
            thousands: "'",
            grouping: [ 3 ],
            currency: [ "CHF ", "" ],
            dateTime: "%a %b %e %X %Y",
            date: "%d.%m.%Y",
            time: "%H:%M:%S",
            periods: [ "AM", "PM" ],
            days: [ "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag" ],
            shortDays: [ "So", "Mo", "Di", "Mi", "Do", "Fr", "Sa" ],
            months: [ "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember" ],
            shortMonths: [ "Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez" ]
        }
    };
    return d3.ourSettings = {}, d3.ourSettings.setLocale = function(locale) {
        availableLocales[locale] ? d3.formatDefaultLocale(availableLocales[locale]) : d3.formatDefaultLocale(availableLocales.en), 
        "undefined" == typeof dashboardCustomColors ? d3.ourSettings.chartColors = d3.schemeSet3 : d3.ourSettings.chartColors = dashboardCustomColors, 
        d3.ourSettings.formats = {}, d3.ourSettings.formats.time = d3.timeFormat("%Y-%m-%d %H:%M:%S"), 
        d3.ourSettings.formats.time.keyify = function(time) {
            return time.toISOString();
        }, d3.ourSettings.formats.date = function(date) {
            return date ? d3.timeFormat("%Y-%m-%d")(date) : "";
        }, d3.ourSettings.formats.date.keyify = function(date) {
            return date ? date.toISOString().substr(0, 10) : "";
        };
        var iterateDateParsers = [ d3.timeParse("%Y-%m-%d"), d3.timeParse("%d.%m.%Y"), d3.timeParse("%m/%d/%Y") ];
        d3.ourSettings.formats.date.parse = function(str) {
            for (var res, i = 0; i < iterateDateParsers.length; i++) if (null !== (res = iterateDateParsers[i](str))) return res;
            return null;
        }, d3.ourSettings.formats.number = function(num) {
            return isNaN(num) ? "" : d3.format(",.2f")(num);
        }, d3.ourSettings.formats.number.keyify = function(num) {
            return num.toFixed(2);
        }, d3.ourSettings.formats.number.parse = parseFloat, d3.ourSettings.formats.percentage = function(num) {
            return isNaN(num) ? "" : d3.format(".1%")(num);
        }, d3.ourSettings.formats.percentage.keyify = function(num) {
            return (100 * num).toFixed(1);
        }, d3.ourSettings.formats.percentage.parse = parseFloat, d3.ourSettings.formats.integer = function(num) {
            return isNaN(num) ? "" : d3.format(",d")(num);
        }, d3.ourSettings.formats.integer.keyify = function(num) {
            return num.toFixed();
        }, d3.ourSettings.formats.integer.parse = parseInt, d3.ourSettings.formats.yesNo = function(txt) {
            return "yes" === txt ? "✅" : "no" === txt ? "❌" : "";
        }, d3.ourSettings.formats.yesNo.keyify = function(txt) {
            return "yes" === txt ? "yes" : "no";
        }, d3.ourSettings.formats.yesNo.parse = function(input) {
            return "✅" === input || "yes" === input.toString().trim().toLowerCase() || "true" === input.toString().trim().toLowerCase() || 1 === input || "1" === input.toString().trim() || !0 === input ? "yes" : "❌" === input || "no" === input.toString().trim().toLowerCase() || "false" === input.toString().trim().toLowerCase() || 0 === input || "0" === input.toString().trim() || !1 === input ? "no" : "";
        }, d3.ourSettings.formats.text = function(d) {
            return d;
        }, d3.ourSettings.formats.text.parse = function(d) {
            return d;
        };
    }, d3.ourSettings.setLocale("en"), d3.wrapHelper = function(text, width) {
        text.each(function() {
            for (var word, text = d3.select(this), words = text.text().split(/\s+/).reverse(), line = [], lineNumber = 0, y = text.attr("y"), dy = parseFloat(text.attr("dy")), tspan = text.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em"); word = words.pop(); ) line.push(word), 
            tspan.text(line.join(" ")), tspan.node().getComputedTextLength() > width && (line.pop(), 
            tspan.text(line.join(" ")), line = [ word ], tspan = text.append("tspan").attr("x", 0).attr("y", y).attr("dy", 1.1 * ++lineNumber + dy + "em").text(word));
        });
    }, d3;
}), angular.module("configServices", [ "gettext", "restServices" ]).factory("configService", [ "restListService", "$q", "gettext", function(restListService, $q, gettext) {
    var configPromise, configServ = {};
    return configServ.getConfiguration = function() {
        var deferred;
        return configPromise || (deferred = $q.defer(), configPromise = deferred.promise, 
        restListService.getAllItems("configuration").then(function(res) {
            res && res.data && res.data.d && res.data.d.results && Array.isArray(res.data.d.results) || deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected."));
            var config = {};
            res.data.d.results.forEach(function(d) {
                config[d.Title] = d.Value;
            }), deferred.resolve(config);
        }, function(restErr) {
            deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }), configPromise);
    }, configServ;
} ]), angular.module("datafilesServices", [ "gettext", "restServices", "chartServices" ]).factory("datafilesService", [ "restListService", "$q", "gettext", "d3", function(restListService, $q, gettext, d3) {
    var datafilesPromise, datafilesServ = {};
    return datafilesServ.getAllDatafiles = function(forceReload) {
        if (!forceReload && datafilesPromise) return datafilesPromise;
        var deferred = $q.defer();
        return datafilesPromise = deferred.promise, restListService.getAllItems("datafiles").then(function(res) {
            if (res && res.data && res.data.d && Array.isArray(res.data.d.results)) {
                var datafilesMap = {};
                try {
                    res.data.d.results.forEach(function(d) {
                        datafilesMap[d.Title] = {
                            id: d.Id,
                            dataFile: d.Title,
                            dataFileFormat: JSON.parse(d.dataFileFormatJSON),
                            fileName: d.fileName
                        };
                    }), deferred.resolve(datafilesMap);
                } catch (err) {
                    deferred.reject(gettext("Error parsing data file format:") + " " + err.message);
                }
            } else deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected."));
        }, function(errRest) {
            deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + errRest.status + ", " + errRest.statusText);
        }), datafilesPromise;
    }, datafilesServ.getDatafile = function(dataFileName, forceReload) {
        return datafilesServ.getAllDatafiles(forceReload).then(function(datafilesMap) {
            return datafilesMap[dataFileName];
        });
    }, datafilesServ.getDatafileById = function(datafileId, forceReload) {
        return datafilesServ.getAllDatafiles(forceReload).then(function(datafilesMap) {
            var foundDatafile;
            return Object.keys(datafilesMap).some(function(k) {
                return datafilesMap[k].id === datafileId && (foundDatafile = datafilesMap[k], !0);
            }), foundDatafile;
        });
    }, datafilesServ.isValidDatafile = function(datafile, isNew) {
        var allColumnsValid = datafile.dataFileFormat && datafile.dataFileFormat.columns.every(function(col) {
            return void 0 !== col.source && "" !== col.source && void 0 !== col.display && "" !== col.display && col.keyword.match(/^[a-zA-Z0-9_-]+$/) && void 0 !== d3.ourSettings.formats[col.format];
        });
        return datafile.dataFile.match(/^[a-zA-Z0-9_-]+$/) && allColumnsValid && void 0 !== datafile.dataFileFormat.separator && "" !== datafile.separator && void 0 !== datafile.fileName && "" !== datafile.fileName && (isNew || !isNaN(datafile.id));
    }, datafilesServ.asRestData = function(datafile) {
        var dataFileFormatCopy = JSON.parse(JSON.stringify(datafile.dataFileFormat ? datafile.dataFileFormat : {}));
        dataFileFormatCopy.columns.forEach(function(d) {
            d.$$hashKey = void 0;
        });
        var restElement = {
            Title: datafile.dataFile,
            fileName: datafile.fileName,
            dataFileFormatJSON: JSON.stringify(dataFileFormatCopy)
        };
        return isNaN(datafile.id) || (restElement.Id = datafile.id), restElement;
    }, datafilesServ.addDatafile = function(datafile) {
        var deferred = $q.defer();
        return datafilesServ.isValidDatafile(datafile, !0) ? restListService.addItem("datafiles", datafilesServ.asRestData(datafile)).then(function(res) {
            console.log("Added datafile definition to SharePoint list:"), console.log(res), 
            datafilesPromise = void 0, datafile.id = res.data.d.Id, deferred.resolve(datafile);
        }, function(restErr) {
            deferred.reject(gettext("An error occurred when saving the new datafile definition to the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }) : deferred.reject(gettext("The datafile you are trying to add is not valid.")), 
        deferred.promise;
    }, datafilesServ.changeDatafile = function(datafile) {
        var deferred = $q.defer();
        return datafilesServ.isValidDatafile(datafile, !1) ? restListService.updateItem("datafiles", datafile.id, datafilesServ.asRestData(datafile)).then(function(res) {
            console.log("Updated datafile definition on SharePoint list:"), console.log(res), 
            datafilesPromise = void 0, deferred.resolve(datafile);
        }, function(restErr) {
            deferred.reject(gettext("An error occurred when saving the changed datafile definition to the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }) : deferred.reject(gettext("The datafile definition you are trying to change is not valid.")), 
        deferred.promise;
    }, datafilesServ.deleteDatafile = function(datafile) {
        return restListService.deleteItem("datafiles", datafile.id).then(function(res) {
            console.log("Removed datafile definition on SharePoint list:"), console.log(res), 
            datafilesPromise = void 0;
        }, function(restErr) {
            return gettext("An error occurred when deleting the datafile definition on the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText;
        });
    }, datafilesServ;
} ]).factory("datafileReader", [ "datafilesService", "$q", "gettext", "d3", function(datafilesService, $q, gettext, d3) {
    var datafilesRead = {}, datafilesPromises = {}, formattedFilePromises = {};
    return datafilesRead.readDatafile = function(file) {
        if (datafilesPromises[file]) return datafilesPromises[file];
        var deferred = $q.defer();
        return datafilesPromises[file] = deferred.promise, datafilesService.getDatafile(file).then(function(fileDefinition) {
            return datafilesRead.readFormattedFile(fileDefinition.fileName, fileDefinition.dataFileFormat);
        }).then(deferred.resolve, deferred.reject), datafilesPromises[file];
    }, datafilesRead.readFormattedFile = function(url, formattingSpec, skipCache) {
        if (!skipCache && formattedFilePromises[url]) return formattedFilePromises[url];
        var dsvFormat = d3.dsvFormat(formattingSpec.separator), deferred = $q.defer();
        return formattedFilePromises[url] = deferred.promise, d3.text(url, function(error, text) {
            if (error) deferred.reject(gettext("Error code") + " " + error.status + ", " + error.statusText); else {
                var rowArray = dsvFormat.parse(text), lowerToCol = {};
                rowArray.columns.forEach(function(col) {
                    lowerToCol[col.toLowerCase()] = col;
                });
                var retArray = rowArray.map(function(d) {
                    var res = {};
                    return formattingSpec.columns.forEach(function(col) {
                        res[col.display] = d3.ourSettings.formats[col.format].parse(d[lowerToCol[col.source.toLowerCase()]]);
                    }), res;
                });
                deferred.resolve([ retArray, formattingSpec.columns ]);
            }
        }), formattedFilePromises[url];
    }, datafilesRead;
} ]).factory("datafileWriter", [ "datafilesService", "$q", "gettext", "d3", function(datafilesService, $q, gettext, d3) {
    var datafilesWrite = {
        formatFile: function(data, formattingSpec) {
            var dsvFormat = d3.dsvFormat(formattingSpec.separator), columnHeader = formattingSpec.columns.map(function(col) {
                return col.source;
            });
            return dsvFormat.formatRows([ columnHeader ].concat(data.map(function(d) {
                return formattingSpec.columns.forEach(function(col) {
                    return d3.ourSettings.formats[col.format].keyify(d[col.display]);
                }), [];
            })));
        }
    };
    return datafilesWrite;
} ]), angular.module("dashboardScreenServices", [ "restServices", "miscServices", "ngDialog" ]).run([ "$rootScope", "$location", "sidebarService", function($rootScope, $location, sidebarService) {
    $rootScope.$on("$locationChangeSuccess", function() {
        var searchObject = $location.search();
        console.log("dashboardScreenServices captured locationChangeSuccess event!"), console.log(searchObject), 
        searchObject.sidebar || sidebarService.close();
    }), $rootScope.$on("ngDialog.opened", function() {
        sidebarService.updateOpenVisibility("show-over-dialog");
    }), $rootScope.$on("ngDialog.closed", function() {
        sidebarService.updateOpenVisibility("show");
    });
} ]).factory("screenService", function() {
    var setMainMargins, screenServ = {}, sidebarPixels = {}, sidebarAlign = {};
    return screenServ.getAvailableScreenSize = function(ignoreSidebar) {
        var sidebarPixelSum = Object.keys(sidebarPixels).reduce(function(prevVal, currKey) {
            return prevVal + (ignoreSidebar && currKey === ignoreSidebar ? 0 : sidebarPixels[currKey]);
        }, 0);
        return [ window.innerWidth - sidebarPixelSum, window.innerHeight - document.getElementById("mainNavbar").offsetHeight ];
    }, screenServ.updateMainMargins = function() {
        if (setMainMargins) {
            var leftMargin = Object.keys(sidebarPixels).reduce(function(prevVal, currKey) {
                return prevVal + ("left" === sidebarAlign[currKey] ? sidebarPixels[currKey] : 0);
            }, 0), rightMargin = Object.keys(sidebarPixels).reduce(function(prevVal, currKey) {
                return prevVal + ("right" === sidebarAlign[currKey] ? sidebarPixels[currKey] : 0);
            }, 0);
            setMainMargins(leftMargin, rightMargin);
        }
    }, screenServ.setSidebarPixels = function(sidebarName, noPixels, align) {
        sidebarPixels[sidebarName] = noPixels, sidebarAlign[sidebarName] = align, screenServ.updateMainMargins();
    }, screenServ.registerController = function(_setMainMargins) {
        setMainMargins = _setMainMargins;
    }, screenServ;
}).factory("sidebarService", [ "$q", "ngDialog", "miscServices", "screenService", function($q, ngDialog, miscServices, screenService) {
    var loadTemplate, setVisibility, sidebarServ = {}, currVisibility = "hide";
    return sidebarServ.open = function(template, data, asOverlay, minPixels) {
        return console.log("Sidebar: Open called..."), !(!loadTemplate || !setVisibility) && (!!template && (console.log("Sidebar: Checking minPixels..."), 
        !(minPixels && screenService.getAvailableScreenSize("main")[0] - 300 < minPixels) && (screenService.setSidebarPixels("main", asOverlay ? 0 : 300, "right"), 
        currVisibility = asOverlay ? "overlay" : "show", !asOverlay && 0 < ngDialog.getOpenDialogs().length && (currVisibility = "show-over-dialog"), 
        console.log("Sidebar: We are loading the template..."), loadTemplate(template, data), 
        setVisibility(currVisibility), !0)));
    }, sidebarServ.close = function() {
        "hide" !== currVisibility && loadTemplate && setVisibility && (setVisibility(currVisibility = "hide"), 
        screenService.setSidebarPixels("main", 0, "right"));
    }, sidebarServ.updateOpenVisibility = function(newVisibility) {
        "show" !== currVisibility && "show-over-dialog" !== currVisibility || setVisibility(currVisibility = newVisibility);
    }, sidebarServ.unload = function() {
        loadTemplate && setVisibility && (sidebarServ.close(), loadTemplate(""));
    }, sidebarServ.registerController = function(_loadTemplate, _setVisibility) {
        loadTemplate = _loadTemplate, setVisibility = _setVisibility;
    }, sidebarServ;
} ]), angular.module("dashboardTreeServices", [ "gettext", "restServices", "miscServices" ]).factory("treeService", [ "$q", "gettext", "restListService", "miscServices", function($q, gettext, restListService, miscServices) {
    var treeServ = {
        getFlatTree: function() {
            var deferred = $q.defer();
            return restListService.getMergedAllItems("tree").then(function(res) {
                var flatData, currDatetime;
                console.log("Success!"), console.log(res), res && res.data && res.data.d && Array.isArray(res.data.d.results) && !(res.data.d.results.length < 1) ? (flatData = {}, 
                currDatetime = new Date(), res.data.d.results.forEach(function(d) {
                    flatData[d.Id] = {
                        id: d.Id,
                        title: d.Title,
                        parent: d.ParentId,
                        hasDashboard: !!d.hasDashboard,
                        valid_from: miscServices.parseDatetime(d.Valid_from),
                        valid_to: miscServices.parseDatetime(d.Valid_to),
                        active: miscServices.parseDatetime(d.Valid_from) <= currDatetime && miscServices.parseDatetime(d.Valid_to) > currDatetime,
                        orderAsc: d.OrderAsc,
                        nodes: []
                    };
                }), deferred.resolve(flatData)) : deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected or the tree list is empty."));
            }, function(errRest) {
                console.log("Error!"), console.log(errRest), deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + errRest.status + ", " + errRest.statusText);
            }), deferred.promise;
        },
        getFullHierarchy: function() {
            var deferred, treeStart, multipleRoots;
            return deferred = $q.defer(), treeServ.getFlatTree().then(function(flatData) {
                treeStart = void 0, multipleRoots = !1, Object.keys(flatData).forEach(function(k) {
                    if (flatData[k].parent) {
                        var higherIndex = flatData[flatData[k].parent].nodes.findIndex(function(el) {
                            return el.orderAsc > flatData[k].orderAsc;
                        });
                        console.log("Parent nodes:"), console.log(flatData[flatData[k].parent].nodes), console.log("Element will be inserted at index: " + higherIndex), 
                        console.log(flatData[k]), 0 <= higherIndex ? flatData[flatData[k].parent].nodes.splice(higherIndex, 0, flatData[k]) : flatData[flatData[k].parent].nodes.push(flatData[k]);
                    } else flatData[k].active && (treeStart ? multipleRoots = !0 : treeStart = flatData[k]);
                }), multipleRoots ? deferred.reject(gettext("An error occurred: The tree has multiple active root nodes (=nodes without valid parent)!")) : treeStart ? (console.log("Built tree. FlatData:"), 
                console.log(flatData), console.log("Hierarchical tree:"), console.log(treeStart), 
                deferred.resolve(treeStart)) : deferred.reject(gettext("An error occurred: The tree does not have a root object without parent!"));
            }, function(err) {
                deferred.reject(err);
            }), deferred.promise;
        },
        getElementTitle: function(elementId) {
            return treeServ.getFlatTree().then(function(flatTree) {
                if (!flatTree[elementId]) {
                    var deferred = $q.defer();
                    return deferred.reject(gettext("Tree element was not found in tree.")), deferred.promise;
                }
                return flatTree[elementId].title;
            });
        },
        isValidElement: function(element, newElement) {
            return void 0 !== element.title && "" !== element.title && !isNaN(element.orderAsc) && !isNaN(element.parent) && (-1 !== element.parent || element.valid_from.getTime() < new Date().getTime() && element.valid_to.getTime() > new Date("2999-12-31").getTime()) && (!isNaN(element.id) || newElement);
        },
        asRestElement: function(element) {
            var restElement = {
                Title: element.title,
                Valid_from: element.valid_from,
                Valid_to: element.valid_to ? element.valid_to : new Date("2999-12-31T12:00:00.000Z"),
                ParentId: element.parent,
                hasDashboard: !!element.hasDashboard,
                OrderAsc: element.orderAsc
            };
            return isNaN(element.id) || (restElement.Id = element.id), restElement;
        },
        addElement: function(element) {
            var deferred = $q.defer();
            return treeServ.isValidElement(element, !0) ? restListService.addItem("tree", treeServ.asRestElement(element)).then(function(res) {
                console.log("Added element to SharePoint list:"), console.log(res), element.id = res.data.d.Id, 
                deferred.resolve(element);
            }, function(restErr) {
                deferred.reject(gettext("An error occurred when saving the new element to the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
            }) : deferred.reject(gettext("The node you are trying to add is not valid. Please complete its title.")), 
            deferred.promise;
        },
        changeElement: function(element) {
            var deferred = $q.defer();
            return treeServ.isValidElement(element, !1) ? (console.log("Sending changed element to server..."), 
            restListService.updateItem("tree", element.id, treeServ.asRestElement(element)).then(function() {
                console.log("Element changed. Returning modified item."), deferred.resolve(element);
            }, function(restErr) {
                console.log("REST error occured. Rejecting this promise."), deferred.reject(gettext("An error occurred when updating the element on the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
            })) : deferred.reject(gettext("The node you are trying to update is not valid. Please ensure it contains an ID and complete its title.")), 
            deferred.promise;
        }
    };
    return treeServ;
} ]), angular.module("dashboardViewServices", [ "gettext", "datafilesServices", "restServices" ]).value("dashboardViewTypeDescriptions", {
    html: "HTML",
    iframe: "IFrame",
    notes: "Notes",
    timeSeries: "Time Series Chart",
    stackedBars: "Stacked Bar Chart",
    scatterplot: "Scatterplot Chart",
    portfolio: "Portfolio Chart",
    table: "Table",
    riskTracker: "Risk Tracker Matrix",
    objectExplorer: "Object Explorer",
    tabDivider: "Tab Divider"
}).factory("dashboardViewService", [ "restListService", "$q", "gettext", "dashboardViewTypeDescriptions", function(restListService, $q, gettext, dashboardViewTypeDescriptions) {
    var viewServ = {}, viewsPromises = {};
    return viewServ.getDashboardElements = function(dashboardID, forceReload) {
        var deferred;
        return isNaN(dashboardID) ? ((deferred = $q.defer()).reject(gettext("Error retrieving dashboard view: Supplied dashboard ID is invalid.")), 
        deferred.promise) : (viewsPromises[dashboardID] && !forceReload || (deferred = $q.defer(), 
        viewsPromises[dashboardID] = deferred.promise, restListService.getFilteredItems("views", "treeElement eq " + dashboardID, void 0, void 0, "orderAsc").then(function(res) {
            var viewsList = [];
            if (res && res.data && res.data.d && Array.isArray(res.data.d.results)) {
                try {
                    viewsList = res.data.d.results.map(function(d) {
                        return console.log("Mapping view item: "), console.log(d), {
                            id: d.Id,
                            title: d.Title,
                            type: d.elementType,
                            viewKey: d.viewKey,
                            options: JSON.parse(d.elementOptionsJSON),
                            orderAsc: d.orderAsc
                        };
                    });
                } catch (err) {
                    deferred.reject(gettext("An error occurred parsing the dashboard view, probably some view options JSON is invalid."));
                }
                deferred.resolve(viewsList);
            } else deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected."));
        }, function(restErr) {
            deferred.reject(gettext("An error occurred loading the dashboard view from SharePoint:") + " " + gettext("Error code") + " " + restErr.status + ", " + restErr.statusText);
        })), viewsPromises[dashboardID]);
    }, viewServ.isValidElement = function(element, isNew) {
        return void 0 !== element.title && "" !== element.title && void 0 !== element.viewKey && "" !== element.viewKey && !isNaN(element.orderAsc) && void 0 !== element.options && void 0 !== dashboardViewTypeDescriptions[element.type] && (isNew || !isNaN(element.id));
    }, viewServ.asRestElement = function(dashboardID, element) {
        var restElement = {
            Title: element.title,
            viewKey: element.viewKey,
            elementType: element.type,
            elementOptionsJSON: JSON.stringify(element.options),
            orderAsc: element.orderAsc,
            treeElementId: dashboardID
        };
        return isNaN(element.id) || (restElement.Id = element.id), restElement;
    }, viewServ.addDashboardElement = function(dashboardID, element) {
        var deferred = $q.defer();
        return viewServ.isValidElement(element, !0) ? restListService.addItem("views", viewServ.asRestElement(dashboardID, element)).then(function(res) {
            console.log("Added dashboard view element to SharePoint list:"), console.log(res), 
            element.id = res.data.d.Id, deferred.resolve(element);
        }, function(restErr) {
            deferred.reject(gettext("An error occurred when saving the new element to the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }) : deferred.reject(gettext("The view element you are trying to add is not valid. Please complete its title.")), 
        deferred.promise;
    }, viewServ.changeDashboardElement = function(dashboardID, element) {
        var deferred = $q.defer();
        return viewServ.isValidElement(element, !1) ? restListService.updateItem("views", element.id, viewServ.asRestElement(dashboardID, element)).then(function(res) {
            console.log("Updated dashboard view element on SharePoint list:"), console.log(res), 
            deferred.resolve(element);
        }, function(restErr) {
            deferred.reject(gettext("An error occurred when saving the changed element to the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }) : deferred.reject(gettext("The view element you are trying to change is not valid. Please complete its title.")), 
        deferred.promise;
    }, viewServ.deleteDashboardElement = function(element) {
        return restListService.deleteItem("views", element.id).then(function(res) {
            console.log("Removed dashboard view element on SharePoint list:"), console.log(res);
        }, function(restErr) {
            return gettext("An error occurred when deleting the element on the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText;
        });
    }, viewServ;
} ]).filter("typeToDescription", [ "gettext", "dashboardViewTypeDescriptions", function(gettext, dashboardViewTypeDescriptions) {
    return function(input) {
        return dashboardViewTypeDescriptions[input] ? gettext(dashboardViewTypeDescriptions[input]) : gettext("unknown");
    };
} ]), angular.module("excelServices", [ "fileServices", "usersServices" ]).factory("excelService", [ "$q", "$http", "$location", "FileSaver", "usersService", function($q, $http, $location, FileSaver, usersService) {
    var excelServ = {};
    return XlsxPopulate.Promise = $q, excelServ.exportData = function(title, description, sheets) {
        var currUser;
        return console.log("excelService.exportData has been called:"), console.log([ title, description, sheets ]), 
        usersService.getCurrentUser().then(function(_currUser) {
            return currUser = _currUser, $http.get("assets/exportTemplate.xlsx", {
                responseType: "arraybuffer"
            });
        }).then(function(res) {
            return XlsxPopulate.fromDataAsync(res.data);
        }).then(function(workbook) {
            var setIfExists = function(definedName, value) {
                workbook.definedName(definedName) && workbook.definedName(definedName).value(value);
            };
            return setIfExists("title", title), setIfExists("description", description), setIfExists("exporter", currUser.name), 
            setIfExists("exporter_email", currUser.email), setIfExists("exporter_login", currUser.login), 
            setIfExists("exported_at", new Date()), workbook.definedName("source_url") && (workbook.definedName("source_url").value($location.absUrl()), 
            workbook.definedName("source_url").hyperlink($location.absUrl())), sheets.forEach(function(sheetDef, idx) {
                workbook.definedName("sheetNames") && workbook.definedName("sheetNames").cell(idx, 0).value(sheetDef.name), 
                workbook.definedName("sheetTitles") && workbook.definedName("sheetTitles").cell(idx, 0).value(sheetDef.title);
                var sheet = workbook.addSheet(sheetDef.name);
                sheetDef.color && sheet.tabColor(sheetDef.color), sheetDef.columns.forEach(function(col, idx) {
                    sheet.cell(1, idx + 1).value(col.source), "date" === col.format ? sheet.column(idx + 1).style("numberFormat", "yyyy-mm-dd") : "time" === col.format ? sheet.column(idx + 1).style("numberFormat", "yyyy-mm-dd hh:mm:ss") : "percentage" === col.format && sheet.column(idx + 1).style("numberFormat", "0.0%");
                }), sheet.row(1).style({
                    bold: !0,
                    rotateTextUp: !0,
                    horizontalAlignment: "center"
                });
                var headerHeight = sheetDef.columns.reduce(function(accumul, col) {
                    return Math.max(accumul, Math.min(6 * col.source.length, 200));
                }, 40);
                sheet.row(1).height(headerHeight), console.log("Header height set to: " + headerHeight), 
                sheet.cell(2, 1).value(sheetDef.rows.map(function(row) {
                    return sheetDef.columns.map(function(col) {
                        return row[col.display] != row[col.display] ? "" : row[col.display];
                    });
                })), sheetDef.columns.forEach(function(col, idx) {
                    var colWidth = 15;
                    "text" === col.format && (colWidth = sheetDef.rows.reduce(function(accumul, row) {
                        return Math.max(accumul, Math.min(angular.isString(row[col.display]) ? 1.1 * row[col.display].length : 0, 60));
                    }, colWidth)), console.log('Setting width of column "' + col.display + '" to ' + colWidth + "."), 
                    sheet.column(idx + 1).width(colWidth);
                }), sheet.usedRange().autoFilter();
            }), workbook.outputAsync();
        });
    }, excelServ.exportDataAsDownload = function(title, description, sheets, filename) {
        if (null == filename || "" === filename) {
            var now = new Date();
            filename = now.getFullYear() + "-" + (now.getMonth() < 9 ? "0" : "") + (now.getMonth() + 1) + "-" + (now.getDate() < 10 ? "0" : "") + now.getDate() + "_" + title.trim().replace(/[^0-9a-zA-Z\-]/g, "_") + ".xlsx";
        }
        return excelServ.exportData(title, description, sheets).then(function(blob) {
            FileSaver.saveAs(blob, filename);
        });
    }, excelServ.loadData = function(file, sheets) {
        return console.log("excelService.loadData called with:"), console.log([ file, sheets ]), 
        XlsxPopulate.fromDataAsync(file).then(function(workbook) {
            return console.log("Received Excel workbook."), sheets.map(function(sheetName) {
                var i, j, rowArray = [], usedRange = workbook.sheet(sheetName).usedRange(), usedColumns = usedRange.endCell().columnNumber() - usedRange.startCell().columnNumber() + 1, usedRows = usedRange.endCell().rowNumber() - usedRange.startCell().rowNumber() + 1, columnNames = [];
                for (j = 0; j < usedColumns; j++) columnNames[j] = usedRange.cell(0, j).value();
                for (i = 1; i < usedRows; i++) {
                    var rowObj = {};
                    for (j = 0; j < usedColumns; j++) if ("" !== columnNames[j]) {
                        var val = usedRange.cell(i, j).value();
                        null != val && "" !== val && (rowObj[columnNames[j]] = val);
                    }
                    0 < Object.keys(rowObj).length && rowArray.push(rowObj);
                }
                return rowArray;
            });
        });
    }, excelServ;
} ]), angular.module("feedbackServices", [ "gettext", "restServices" ]).factory("feedbackService", [ "$q", "$document", "restListService", function($q, $document, restListService) {
    var feedbackServ = {
        getScreenshot: function() {
            return html2canvas($document[0].body).then(function(canvas) {
                return canvas.toDataURL();
            });
        },
        sendFeedback: function(feedback, screenshot) {
            if (!angular.isString(feedback)) return $q.reject("Please provide a valid feedback string.");
            var restFeedback = {
                Title: "Feedback",
                Feedback: feedback
            };
            return restListService.addItem("feedback", restFeedback).then(function(res) {
                if (!res || !res.data || !res.data.d) return console.log("ERROR: The result returned by SharePoint was not in the expected format."), 
                console.log(res), $q.reject("The result returned by SharePoint was not in the expected format.");
                var screenshotContent = '<html><body><img src="' + screenshot + '" /></body></html>';
                return screenshot ? restListService.addAttachmentFromString("feedback", res.data.d.Id, "screenshot.html", screenshotContent) : res;
            });
        }
    };
    return feedbackServ;
} ]), angular.module("fileServices", []).factory("FileSaver", function() {
    return {
        saveAs: saveAs
    };
}), angular.module("learningServices", []).factory("learningService", function() {
    var learningServ = {}, existingClassifiers = {};
    return learningServ.newClassifier = function(data, columns, updateCallback) {
        var retClassifier = {};
        return retClassifier.worker = new Worker("scripts/workers/learningClassifyWorker.js"), 
        retClassifier.changeCallback = function(newCallback) {
            this.updCallback = newCallback;
        }, retClassifier.changeCallback(updateCallback), retClassifier.worker.onmessage = function(e) {
            console.log("Received data from worker: "), console.log(e), retClassifier.updCallback && retClassifier.updCallback(e.data[0], e.data[1]);
        }, retClassifier.worker.postMessage([ "init", data, columns ]), retClassifier.train = function(trainData) {
            console.log("Posting TRAIN to worker."), console.log(trainData), retClassifier.worker.postMessage([ "train", trainData ]);
        }, retClassifier.unlearn = function(unlearnData) {
            console.log("Posting UNLEARN to worker."), retClassifier.worker.postMessage([ "unlearn", unlearnData ]);
        }, retClassifier.requestUpdate = function(idxes) {
            console.log("Posting UPDATE to worker."), retClassifier.worker.postMessage([ "update", idxes ]);
        }, retClassifier.requestIterate = function() {
            console.log("Posting ITERATE to worker."), retClassifier.worker.postMessage([ "iterate" ]);
        }, retClassifier;
    }, learningServ.getClassifier = function(id) {
        return existingClassifiers[id];
    }, learningServ.endClassifier = function(id) {
        return !!existingClassifiers[id] && (existingClassifiers[id].worker.terminate(), 
        delete existingClassifiers[id], !0);
    }, learningServ.addClassifier = function(id, data, columns, updateCallback) {
        if (null != id && "" !== id) return learningServ.getClassifier(id) && learningServ.endClassifier(id), 
        existingClassifiers[id] = learningServ.newClassifier(data, columns, updateCallback), 
        existingClassifiers[id];
    }, learningServ.getOrAddClassifier = function(id, data, columns, updateCallback) {
        return learningServ.getClassifier(id) || learningServ.addClassifier(id, data, columns, updateCallback);
    }, learningServ;
}), angular.module("miscServices", [ "gettext", "chartServices" ]).filter("getColumn", function() {
    return function(input, col) {
        return Array.isArray(input) ? input.map(function(d) {
            return d[col];
        }) : input;
    };
}).filter("highlightSearchResults", function() {
    return function(input, searchText) {
        if (null == searchText || searchText.length < 3) return input;
        var searchTextUpCase = searchText.replace("<", "&lt;").replace(">", "&gt;").toUpperCase(), searchTextRegexp = new RegExp("(<[^>]+>|" + searchText.replace("<", "&lt;").replace(">", "&gt;").replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&") + ")", "i");
        return input.split(searchTextRegexp).map(function(t) {
            return t.toUpperCase() === searchTextUpCase ? "<mark>" + t + "</mark>" : t;
        }).join("");
    };
}).factory("miscServices", [ "gettextCatalog", "d3", function(gettextCatalog, d3) {
    var miscServices = {
        hashCode: function(s) {
            return s.split("").reduce(function(a, b) {
                return (a = (a << 5) - a + b.charCodeAt(0)) & a;
            }, 0);
        },
        parseDate: function(input) {
            if (angular.isString(input)) {
                var parts = input.split("T")[0].split("-");
                return new Date(Date.UTC(parts[0], parts[1] - 1, parts[2]));
            }
        },
        parseDatetime: function(input) {
            var parts = input.split(/[TZ:\-]/);
            return new Date(Date.UTC(parts[0], parts[1] - 1, parts[2], parts[3], parts[4], parts[5]));
        },
        formatDate: function(source, format) {
            return d3.timeFormat(format)(source);
        },
        translatedAlert: function(alert) {
            return window.alert(gettextCatalog.getString(alert));
        },
        translatedConfirm: function(alert) {
            return window.confirm(gettextCatalog.getString(alert));
        },
        repeatString: function(pattern, count) {
            if (count < 1) return "";
            for (var result = ""; 1 < count; ) 1 & count && (result += pattern), count >>= 1, 
            pattern += pattern;
            return result + pattern;
        },
        isInt: function(value) {
            if (isNaN(value)) return !1;
            var x = parseFloat(value);
            return (0 | x) === x;
        },
        intersect: function(a, b) {
            var t;
            return b.length > a.length && (t = b, b = a, a = t), a.filter(function(e) {
                return -1 < b.indexOf(e);
            });
        },
        htmlToText: function(html) {
            var doc = new DOMParser().parseFromString(html, "text/html");
            return doc.body && doc.body.textContent ? doc.body.textContent : "";
        },
        escapeForRegexp: function(s) {
            return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
        }
    };
    return miscServices;
} ]), angular.module("notesServices", [ "gettext", "chartServices", "restServices", "dashboardTreeServices", "miscServices", "usersServices", "dashboardScreenServices", "socialServices", "miscServices" ]).filter("keywordsPrint", function() {
    return function(input) {
        return input.map(function(d) {
            return d.name;
        }).join(", ");
    };
}).filter("mapKeywordsToName", function() {
    return function(input, keywordMapping) {
        return input.map(function(d) {
            return keywordMapping && void 0 !== keywordMapping[d] && null !== keywordMapping[d] ? keywordMapping[d] : d;
        }).join(", ");
    };
}).service("notesService", [ "$q", "gettext", "restListService", "usersService", "keywordsService", "interactionService", "subscriptionService", function($q, gettext, restListService, usersService, keywordsService, interactionService, subscriptionService) {
    var notesServ = {}, notesCache = {}, notesCacheRetrieved = {}, notesCacheNextUrl = {}, notesByIdCache = {}, onNotesChanges = [], resolveRetrievedNote = function(d) {
        var keywordsList = d.Keywords.substring(0, d.Keywords.length - 1).split(","), newNote = {
            id: d.Id,
            noteText: d.noteText,
            noteStatus: d.noteStatus,
            attachments: [],
            keywords: [],
            sourceLink: d.sourceLink,
            lastAuthor: "",
            createdDate: Date.parse(d.Created),
            lastModifiedDate: Date.parse(null !== d.realModifiedAt && void 0 !== d.realModifiedAt ? d.realModifiedAt : d.Modified)
        };
        try {
            newNote.interactionSummary = JSON.parse(d.interactionSummary);
        } catch (e) {
            console.log("An ERROR occured while trying to parse the interactionSummary of this note:"), 
            console.log(d), console.log(e);
        }
        void 0 !== newNote.interactionSummary && null !== newNote.interactionSummary || (newNote.interactionSummary = {});
        var deferred = $q.defer(), updatePromiseArr = [];
        return updatePromiseArr.push(keywordsService.getKeywordArray(keywordsList).then(function(keywordArray) {
            newNote.keywords = keywordArray, deferred.notify();
        })), updatePromiseArr.push(usersService.getUserById(null !== d.realModifiedById && void 0 !== d.realModifiedById ? d.realModifiedById : d.EditorId).then(function(editor) {
            newNote.lastAuthor = editor.name, deferred.notify();
        }, function(restErr) {
            return gettext("An error occurred loading last editor:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText;
        })), d.Attachments && updatePromiseArr.push(notesServ.getAttachments(d.Id).then(function(attachments) {
            newNote.attachments = attachments, deferred.notify();
        })), $q.all(updatePromiseArr).then(deferred.resolve), [ newNote, deferred.promise ];
    }, callListeners = function(oldNote, newNote, skipListener) {
        console.log("callListeners called: "), console.log([ oldNote, newNote ]), onNotesChanges.forEach(function(listener) {
            var inScopeBefore = oldNote && listener.filterFunc(oldNote), inScopeAfter = newNote && listener.filterFunc(newNote);
            console.log("Listener evaluated: "), console.log([ listener.filterFunc, inScopeBefore, inScopeAfter, listener.newListener, listener.removedListener ]), 
            inScopeBefore || !inScopeAfter || !listener.newListener || skipListener && listener.newListener === skipListener || listener.newListener(newNote), 
            !inScopeBefore || inScopeAfter || !listener.removedListener || skipListener && listener.removedListener === skipListener || listener.removedListener(oldNote), 
            inScopeBefore && inScopeAfter && listener.changedListener && (!skipListener || listener.changedListener !== skipListener) && listener.changedListener(oldNote, newNote);
        });
    };
    return notesServ.getNotesForKeyword = function(keywordId, doReload, isPrefix, maxRecords) {
        return notesServ.getNotesForKeywords([ keywordId ], void 0, doReload, isPrefix, maxRecords);
    }, notesServ.getNotesForKeywords = function(keywordIds, statusFilter, doReload, isPrefix, maxRecords) {
        var keywordSearch, deferred = $q.defer();
        void 0 === doReload && (doReload = !0), void 0 === isPrefix && (isPrefix = !1), 
        void 0 === maxRecords && (maxRecords = 1e4), (keywordSearch = isPrefix ? keywordIds : keywordIds.map(function(keyword) {
            return keyword + ",";
        })).sort();
        var nextUrl, keywordCacheKey = keywordSearch.join("|") + (Array.isArray(statusFilter) ? "status:" + statusFilter.sort().join(":") : "");
        if (console.log("getNotesForKeywords with CACHE KEY: " + keywordCacheKey), console.log([ keywordCacheKey, notesCache[keywordCacheKey], notesCacheRetrieved[keywordCacheKey], maxRecords, doReload ]), 
        void 0 !== notesCache[keywordCacheKey] && Array.isArray(notesCache[keywordCacheKey])) {
            if (!(doReload || notesCacheRetrieved[keywordCacheKey] < maxRecords)) return deferred.resolve(notesCache[keywordCacheKey]), 
            deferred.promise;
            deferred.notify(notesCache[keywordCacheKey]);
        }
        var additionalRecords = maxRecords;
        !doReload && notesCacheNextUrl[keywordCacheKey] && (nextUrl = notesCacheNextUrl[keywordCacheKey], 
        additionalRecords = maxRecords - notesCacheRetrieved[keywordCacheKey]);
        var searchString = keywordSearch.map(function(searchTerm) {
            return "substringof('" + searchTerm + "', Keywords)";
        }).join(" and ");
        return Array.isArray(statusFilter) && (searchString = (1 <= keywordSearch.length ? searchString + " and " : "") + "(" + statusFilter.map(function(searchTerm) {
            return "noteStatus eq '" + searchTerm + "'";
        }).join(" or ") + ")"), restListService.getMergedFilteredItems("notes", searchString, void 0, void 0, "realModifiedAt desc, Modified desc", additionalRecords, nextUrl).then(function(res) {
            console.log("Success in getting filtered notes!"), console.log(res), res && res.data && res.data.d && Array.isArray(res.data.d.results) || deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected.")), 
            nextUrl || (notesCache[keywordCacheKey] = []);
            var notesPromises = [];
            res.data.d.results.forEach(function(d) {
                var keywordsList = d.Keywords.substring(0, d.Keywords.length - 1).split(",");
                if (-1 === keywordIds.findIndex(function(keywordId) {
                    var keywordMissing = !0;
                    return keywordsList.forEach(function(k) {
                        (k === keywordId || isPrefix && k.substring(0, keywordId.length) === keywordId) && (keywordMissing = !1);
                    }), keywordMissing;
                })) {
                    var resolverArr = resolveRetrievedNote(d);
                    notesCache[keywordCacheKey].push(resolverArr[0]), notesPromises.push(resolverArr[1]);
                }
            }), notesCacheRetrieved[keywordCacheKey] = Math.max(maxRecords, notesCache[keywordCacheKey].length), 
            notesCacheNextUrl[keywordCacheKey] = res.data.d.__next, deferred.notify(notesCache[keywordCacheKey]), 
            $q.all(notesPromises).then(function() {
                console.log("We have retrieved notes using:"), console.log("maxRecords = " + maxRecords), 
                console.log("nextUrl = " + nextUrl), console.log("We now have:"), console.log("notesCacheRetrieved = " + notesCacheRetrieved[keywordCacheKey]), 
                console.log("notesCacheNextUrl = " + notesCacheNextUrl[keywordCacheKey]), console.log("notesCache:"), 
                console.log(notesCache[keywordCacheKey]), deferred.resolve(notesCache[keywordCacheKey]);
            }, function(err) {
                deferred.reject(err);
            });
        }, function(restErr) {
            deferred.reject(gettext("An error occurred while loading notes from the database:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }), deferred.promise;
    }, notesServ.getNotesById = function(notesIdArr, doReload) {
        var deferred = $q.defer();
        if (void 0 === doReload && (doReload = !1), !Array.isArray(notesIdArr) || 0 === notesIdArr.length) return $q.resolve([]);
        var cacheKey = notesIdArr.join("|");
        if (void 0 !== notesByIdCache[cacheKey] && !doReload) return notesByIdCache[cacheKey];
        notesByIdCache[cacheKey] = deferred.promise;
        var camlQuery = '<View>\n<ViewFields>\n <FieldRef Name="Id" />\n <FieldRef Name="noteText" />\n <FieldRef Name="noteStatus" />\n <FieldRef Name="Keywords" />\n <FieldRef Name="sourceLink" />\n <FieldRef Name="Modified" />\n <FieldRef Name="Editor" />\n <FieldRef Name="Link" />\n</ViewFields>\n<Query>\n <Where>\n  <In>\n   <FieldRef Name="ID" />\n   <Values>\n';
        notesIdArr.forEach(function(notesId) {
            camlQuery += '     <Value Type="Number">' + notesId + "</Value>\n";
        }), camlQuery += "   </Values>\n  </In>\n </Where>\n</Query>\n</View>";
        var notes = [];
        return restListService.getItemsViaCAML("notes", camlQuery).then(function(res) {
            return res && res.data && res.data.d && Array.isArray(res.data.d.results) ? res.data.d.results : $q.reject(gettext("An error occurred: The obtained data object is not formatted as expected."));
        }).then(function(rawNotes) {
            var notesPromises = [];
            rawNotes.forEach(function(d) {
                var resolverArr = resolveRetrievedNote(d);
                notes.push(resolverArr[0]), notesPromises.push(resolverArr[1]);
            }), deferred.notify(notes), $q.all(notesPromises).then(function() {
                deferred.resolve(notes);
            });
        }, function(err) {
            deferred.reject(err);
        }), notesByIdCache[cacheKey];
    }, notesServ.addNote = function(note, skipListener) {
        var author, deferred = $q.defer();
        return usersService.getCurrentUser().then(function(user) {
            return author = user, keywordsService.obtainKeywordIDs(note.keywords);
        }).then(function(_keywords) {
            note.keywords = _keywords;
            var restNote = {
                Title: "",
                noteText: note.noteText,
                noteStatus: note.noteStatus,
                sourceLink: note.sourceLink,
                Keywords: note.keywords.map(function(k) {
                    return k.id;
                }).join(",").concat(","),
                realModifiedAt: new Date(),
                realModifiedById: author.id
            };
            restListService.addItem("notes", restNote).then(function(res) {
                console.log("Added new note!"), console.log(res), note.id = res.data.d.Id, note.lastAuthor = author.name, 
                note.createdDate = Date.parse(res.data.d.Created), note.lastModifiedDate = Date.parse(res.data.d.Created);
                var attachmentsClean = [], iterateAttachments = function(i) {
                    i >= note.attachments.length ? (note.attachments = attachmentsClean, callListeners(void 0, note, skipListener), 
                    subscriptionService.triggerSubs("keywords", note.keywords, "note", note.id, void 0, "#" + note.sourceLink, {
                        from: author.id,
                        text: note.noteText,
                        keywords: note.keywords
                    }, "new-note"), notesCache = {}, deferred.resolve(note)) : note.attachments[i].newUploadFile && !note.attachments[i].toBeRemoved ? restListService.addAttachment("notes", note.id, note.attachments[i].name, note.attachments[i].newUploadFile).then(function(res) {
                        attachmentsClean.push({
                            link: res.data.d.ServerRelativeUrl,
                            name: res.data.d.FileName
                        }), iterateAttachments(i + 1);
                    }, function(restErr) {
                        deferred.reject(gettext("An error occurred while saving attachments:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
                    }) : iterateAttachments(i + 1);
                };
                iterateAttachments(0);
            }, function(restErr) {
                deferred.reject(gettext("An error occurred when saving the note to the server:") + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
            });
        }, function(err) {
            deferred.reject(err);
        }), deferred.promise;
    }, notesServ.updateNote = function(note, oldNote) {
        var author, modifiedDate, deferred = $q.defer();
        return usersService.getCurrentUser().then(function(user) {
            return author = user, keywordsService.obtainKeywordIDs(note.keywords);
        }).then(function(_keywords) {
            note.keywords = _keywords, modifiedDate = new Date();
            var restNote = {
                Title: "",
                noteText: note.noteText,
                noteStatus: note.noteStatus,
                sourceLink: note.sourceLink,
                Keywords: note.keywords.map(function(k) {
                    return k.id;
                }).join(",").concat(","),
                realModifiedAt: modifiedDate,
                realModifiedById: author.id
            };
            return restListService.updateItem("notes", note.id, restNote);
        }).then(function(res) {
            note.lastModifiedDate = modifiedDate, note.lastAuthor = author.name;
            var attachmentsClean = [], iterateAttachments = function(i) {
                i >= note.attachments.length ? (note.attachments = attachmentsClean, callListeners(oldNote, note), 
                notesCache = {}, deferred.resolve(res)) : note.attachments[i].newUploadFile && !note.attachments[i].toBeRemoved ? restListService.addAttachment("notes", note.id, note.attachments[i].name, note.attachments[i].newUploadFile).then(function(res) {
                    attachmentsClean.push({
                        link: res.data.d.ServerRelativeUrl,
                        name: res.data.d.FileName
                    }), iterateAttachments(i + 1);
                }, function(restErr) {
                    deferred.reject(gettext("An error occurred while saving attachments:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
                }) : !note.attachments[i].newUploadFile && note.attachments[i].toBeRemoved ? restListService.removeAttachment("notes", note.id, note.attachments[i].name).then(function() {
                    iterateAttachments(i + 1);
                }, function(restErr) {
                    deferred.reject(gettext("An error occurred while removing attachments:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
                }) : (note.attachments[i].toBeRemoved || attachmentsClean.push(note.attachments[i]), 
                iterateAttachments(i + 1));
            };
            iterateAttachments(0);
        }, function(restErr) {
            deferred.reject(gettext("An error occurred when saving the note to the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }), deferred.promise;
    }, notesServ.deleteNote = function(note) {
        return console.log("deleteNote has been called:"), console.log(note), restListService.deleteItem("notes", note.id).then(function(res) {
            return callListeners(note, void 0), notesCache = {}, subscriptionService.removeNewsBySource("note", note.id).then(function() {
                return interactionService.removeInteractionsByTarget("note", note.id);
            }), res;
        }, function(restErr) {
            return gettext("An error occurred deleting the note:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText;
        });
    }, notesServ.getAttachments = function(noteID) {
        var deferred = $q.defer();
        return restListService.getAdditionalData("notes", noteID, "AttachmentFiles").then(function(res) {
            res && res.data.d && res.data.d.results && Array.isArray(res.data.d.results) ? deferred.resolve(res.data.d.results.map(function(d) {
                return {
                    link: d.ServerRelativeUrl,
                    name: d.FileName
                };
            })) : deferred.reject(gettext("An error occurred obtaining attachments for note") + " " + noteID + ": " + gettext("Data not in expected format."));
        }, function(restErr) {
            deferred.reject(gettext("An error occurred obtaining attachments for note") + " " + noteID + ": " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }), deferred.promise;
    }, notesServ.addNoteListeners = function(filterFunc, newListener, removedListener, changedListener) {
        -1 === onNotesChanges.findIndex(function(listener) {
            return listener.filterFunc === filterFunc && listener.newListener === newListener && listener.removedListener === removedListener;
        }) && onNotesChanges.push({
            filterFunc: filterFunc,
            newListener: newListener,
            removedListener: removedListener,
            changedListener: changedListener
        });
    }, notesServ.makeNoteIntro = function(note, introLength) {
        (!introLength || introLength < 3) && (introLength = 60);
        var plainText, doc = new DOMParser().parseFromString(note.noteText.replace(/<.+?>/g, ""), "text/html");
        return doc.body ? (plainText = !doc.body.firstChild || !doc.body.firstChild.innerText || doc.body.firstChild.innerText.length < 10 ? doc.body.textContent : doc.body.firstChild.innerText).length > introLength ? plainText.substr(0, introLength - 3).trim() + "..." : plainText : "";
    }, notesServ;
} ]).service("keywordsService", [ "$q", "gettext", "d3", "restListService", "treeService", "miscServices", function($q, gettext, d3, restListService, treeService, miscServices) {
    var keywordStorePromise, keywordServ = {}, keywordStoreLoading = !1, completeKeywordStore = function(force) {
        var keywordStore, sourcePromises, deferred;
        return (void 0 === keywordStorePromise || force && !keywordStoreLoading) && (deferred = $q.defer(), 
        keywordStorePromise = deferred.promise, keywordStoreLoading = !0, keywordStore = {}, 
        (sourcePromises = []).push(treeService.getFlatTree().then(function(flatData) {
            Object.keys(flatData).forEach(function(k) {
                flatData[k].active && (keywordStore["tree/" + k + "/details"] = flatData[k].title, 
                keywordStore["tree/" + k + "/summary"] = flatData[k].title + " (Summary)");
            });
        })), sourcePromises.push(restListService.getMergedAllItems("keywords").then(function(res) {
            var localDeferred, currDatetime;
            return localDeferred = $q.defer(), console.log("Success!"), console.log(res), res && res.data && res.data.d && Array.isArray(res.data.d.results) ? (currDatetime = new Date(), 
            res.data.d.results.forEach(function(d) {
                miscServices.parseDatetime(d.Valid_from) <= currDatetime && miscServices.parseDatetime(d.Valid_to) > currDatetime && (keywordStore["keyword/" + d.Id] = d.Title);
            }), localDeferred.resolve(keywordStore)) : localDeferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected.")), 
            localDeferred;
        }, function(errRest) {
            return gettext("An error occurred:") + " " + gettext("Status code") + " " + errRest.status + ", " + errRest.statusText;
        })), $q.all(sourcePromises).then(function() {
            console.log("Keyword store is fully loaded:"), console.log(keywordStore), keywordStoreLoading = !1, 
            deferred.resolve(keywordStore);
        }, function(err) {
            keywordStoreLoading = !1, deferred.reject(err);
        })), keywordStorePromise;
    };
    return keywordServ.getDataKey = function(datafile, d, columnsSpec, columnName, skipColumns) {
        return columnsSpec.reduce(function(prev, col) {
            return Array.isArray(skipColumns) && -1 < skipColumns.indexOf(col.display) ? prev + "/*" : Array.isArray(skipColumns) || skipColumns !== col.display ? col.isKey ? void 0 === d[col.display] ? prev + "/" : d3.ourSettings.formats[col.format].keyify ? prev + "/" + d3.ourSettings.formats[col.format].keyify(d[col.display]) : prev + "/" + d3.ourSettings.formats[col.format](d[col.display]).replace("/", "-").replace(",", " ") : prev : prev + "/*";
        }, "" !== datafile && void 0 !== datafile ? "data/" + datafile.replace("/", "-").replace(",", " ") : "") + ("" !== columnName && void 0 !== columnName ? "/" + columnsSpec.find(function(col) {
            return col.display === columnName;
        }).keyword : "");
    }, keywordServ.getAllKeywords = function() {
        return completeKeywordStore(!1).then(function(keywordStore) {
            return Object.keys(keywordStore).map(function(kId) {
                return {
                    id: kId,
                    name: keywordStore[kId]
                };
            });
        });
    }, keywordServ.filterKeywords = function(searchTerm, exactMatch) {
        return void 0 === exactMatch && (exactMatch = !1), searchTerm = searchTerm.toLowerCase(), 
        completeKeywordStore(!1).then(function(keywordStore) {
            var filteredStore = {};
            return exactMatch ? Object.keys(keywordStore).forEach(function(k) {
                keywordStore[k].toLowerCase() === searchTerm && (filteredStore[k] = keywordStore[k]);
            }) : Object.keys(keywordStore).forEach(function(k) {
                -1 < keywordStore[k].toLowerCase().indexOf(searchTerm) && (filteredStore[k] = keywordStore[k]);
            }), filteredStore;
        });
    }, keywordServ.getKeywordArray = function(keywordIds) {
        return completeKeywordStore(!1).then(function(keywordStore) {
            return keywordIds.map(function(kId) {
                return {
                    id: kId,
                    name: void 0 !== keywordStore[kId] ? keywordStore[kId] : kId
                };
            });
        });
    }, keywordServ.getKeywordName = function(keywordObject) {
        return completeKeywordStore(!1).then(function(keywordStore) {
            return keywordObject.name = void 0 !== keywordStore[keywordObject.id] ? keywordStore[keywordObject.id] : keywordObject.id, 
            keywordObject;
        });
    }, keywordServ.obtainKeywordIDs = function(keywordArr) {
        var keywordPromises = [];
        return keywordArr.forEach(function(k) {
            "addKeyword/" === k.id.substring(0, 11) && keywordPromises.push(keywordServ.addKeyword(k.name).then(function(createdKeyword) {
                k.id = createdKeyword.id;
            }));
        }), $q.all(keywordPromises).then(function() {
            return keywordArr;
        });
    }, keywordServ.addKeyword = function(keywordName) {
        return keywordServ.filterKeywords(keywordName, !0).then(function(filteredKeywords) {
            return 1 <= Object.keys(filteredKeywords).length ? Object.keys(filteredKeywords)[0] : void 0;
        }).then(function(foundKeywordID) {
            var deferred = $q.defer();
            return void 0 !== foundKeywordID ? deferred.resolve(foundKeywordID) : restListService.getMergedFilteredItems("keywords", "Title eq '" + keywordName.replace("'", "''") + "'").then(function(res) {
                if (1 <= res.data.d.results.length) {
                    var i, currDatetime = new Date();
                    for (i = 0; i < res.data.d.results.length; i++) if (miscServices.parseDatetime(res.data.d.results[i].Valid_from) <= currDatetime && miscServices.parseDatetime(res.data.d.results[i].Valid_to) > currDatetime) {
                        deferred.resolve("keyword/" + res.data.d.results[i].Id);
                        break;
                    }
                    i === res.data.d.results.length && deferred.resolve(void 0);
                } else deferred.resolve(void 0);
            }, function(restErr) {
                deferred.reject(gettext("An error occurred when checking for duplicates:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
            }), deferred.promise;
        }).then(function(foundKeywordID) {
            var newItem, deferred = $q.defer();
            return void 0 !== foundKeywordID ? deferred.resolve(foundKeywordID) : (newItem = {
                Title: keywordName
            }, restListService.addItem("keywords", newItem).then(function(res) {
                console.log("Item added!"), console.log(res), deferred.resolve("keyword/" + res.data.d.Id);
            }, function(restErr) {
                deferred.reject(gettext("An error occurred while adding the new keyword:") + " " + restErr.status + ", " + restErr.statusText);
            })), deferred.promise;
        }).then(function(keywordID) {
            return completeKeywordStore(!1).then(function(keywordStore) {
                keywordStore[keywordID] = keywordName;
            }), {
                id: keywordID,
                name: keywordName
            };
        });
    }, keywordServ;
} ]).service("notesViewer", [ "$q", "notesService", "sidebarService", function($q, notesService, sidebarService) {
    var notesView = {}, notes = [], notesMap = {}, sidebarOpen = !1, prefixPromises = {}, prefixListeners = {}, listenerRegistered = {}, ourChangedListener = function(oldNote, newNote) {
        console.log("ourChangedListener called:"), console.log([ oldNote, newNote ]), notes.forEach(function(notesArr) {
            if (Array.isArray(notesArr.notes)) for (var i = 0; i < notesArr.notes.length; i++) notesArr.notes[i].id === newNote.id && (notesArr.notes[i] = newNote);
        }), Object.keys(prefixPromises).forEach(function(keywordPrefix) {
            -1 === oldNote.keywords.findIndex(function(k) {
                return k.id.substring(0, keywordPrefix.length) === keywordPrefix;
            }) && -1 === newNote.keywords.findIndex(function(k) {
                return k.id.substring(0, keywordPrefix.length) === keywordPrefix;
            }) || delete prefixPromises[keywordPrefix];
        });
    };
    return notesView.showNotes = function(keywordId) {
        keywordId && void 0 !== notesMap[keywordId] && 0 < notes[notesMap[keywordId]].notes.length ? sidebarOpen = sidebarService.open("common/services/notesViewerSidebar.tmpl.html", notes[notesMap[keywordId]], !0, 700) : sidebarOpen && sidebarService.close();
    }, notesView.loadNotes = function(keywordPrefix, notesListener) {
        if (notesListener && (prefixListeners[keywordPrefix] ? -1 === prefixListeners[keywordPrefix].indexOf(notesListener) && prefixListeners[keywordPrefix].push(notesListener) : prefixListeners[keywordPrefix] = [ notesListener ]), 
        prefixPromises[keywordPrefix]) return notesListener ? prefixPromises[keywordPrefix].then(function(allKeywords) {
            return notesListener(allKeywords), allKeywords;
        }) : prefixPromises[keywordPrefix];
        if (prefixPromises[keywordPrefix] = notesService.getNotesForKeyword(keywordPrefix, !0, !0).then(function(foundNotes) {
            var relevantKeywords = {};
            return Object.keys(notesMap).forEach(function(keyword) {
                keyword.substring(0, keywordPrefix.length) === keywordPrefix && (notes[notesMap[keyword]].notes = []);
            }), foundNotes.forEach(function(n) {
                n.keywords.forEach(function(k) {
                    if (k.id.substring(0, keywordPrefix.length) === keywordPrefix) {
                        var keywordParts = k.id.split("/");
                        k.id in notesMap ? notes[notesMap[k.id]].notes.push(n) : (notes.push({
                            keyword: k.id,
                            keywordParts: keywordParts,
                            notes: [ n ]
                        }), notesMap[k.id] = notes.length - 1), relevantKeywords[k.id] = !0, !0;
                    }
                });
            }), notesListener && notesListener(Object.keys(relevantKeywords)), Object.keys(relevantKeywords);
        }, function(err) {
            console.log("Error loading notes: "), console.log(err);
        }), !listenerRegistered[keywordPrefix]) {
            notesService.addNoteListeners(function(note) {
                return -1 !== note.keywords.findIndex(function(k) {
                    return k.id.substring(0, keywordPrefix.length) === keywordPrefix;
                });
            }, function(note) {
                !function(keywordPrefix, note) {
                    if (console.log("ourNewListener called for " + keywordPrefix), console.log(note), 
                    note.keywords.forEach(function(k) {
                        var keywordParts = k.id.split("/"), entryIndex = notesMap[k.id];
                        void 0 !== entryIndex ? -1 === notes[entryIndex].notes.findIndex(function(n) {
                            return n.id === note.id;
                        }) && notes[entryIndex].notes.push(note) : (notes.push({
                            keyword: k.id,
                            keywordParts: keywordParts,
                            notes: [ note ]
                        }), notesMap[k.id] = notes.length - 1);
                    }), prefixListeners[keywordPrefix]) {
                        var relevantKeywords = Object.keys(notesMap).filter(function(k) {
                            return keywordPrefix === k.substring(0, keywordPrefix.length);
                        });
                        prefixListeners[keywordPrefix].forEach(function(listener) {
                            listener(relevantKeywords);
                        });
                    }
                    delete prefixPromises[keywordPrefix];
                }(keywordPrefix, note);
            }, function(note) {
                !function(keywordPrefix, note) {
                    if (console.log("ourRemovedListener called: "), console.log([ keywordPrefix, note, notes, notesMap ]), 
                    note.keywords.forEach(function(k) {
                        if (void 0 !== notesMap[k.id]) {
                            var noteIdx = notes[notesMap[k.id]].notes.findIndex(function(n) {
                                return n.id === note.id;
                            });
                            -1 !== noteIdx && (notes[notesMap[k.id]].notes.splice(noteIdx, 1), 0 === notes[notesMap[k.id]].notes.length && (notes.splice(notesMap[k.id], 1), 
                            Object.keys(notesMap).forEach(function(key) {
                                notesMap[key] > notesMap[k.id] && notesMap[key]--;
                            }), delete notesMap[k.id]));
                        }
                    }), prefixListeners[keywordPrefix]) {
                        var relevantKeywords = Object.keys(notesMap).filter(function(k) {
                            return keywordPrefix === k.substring(0, keywordPrefix.length);
                        });
                        console.log("Iterating through our listeners and calling them with new relevant keywords..."), 
                        console.log([ keywordPrefix, notes, notesMap, relevantKeywords, prefixListeners[keywordPrefix] ]), 
                        prefixListeners[keywordPrefix].forEach(function(listener) {
                            listener(relevantKeywords);
                        });
                    }
                    delete prefixPromises[keywordPrefix];
                }(keywordPrefix, note);
            }, ourChangedListener), listenerRegistered[keywordPrefix] = !0;
        }
        return prefixPromises[keywordPrefix];
    }, notesView;
} ]), angular.module("objectExplorerServices", [ "gettext", "restServices", "usersServices" ]).service("objectExplorerService", [ "$q", "gettext", "restListService", "usersService", function($q, gettext, restListService, usersService) {
    var objectExplorerServ = {}, objectMappingPromise = {}, objectsByTypePromise = {}, clearPromises = function() {
        objectMappingPromise = {}, objectsByTypePromise = {};
    };
    return objectExplorerServ.formatObjectFromREST = function(restObject) {
        var retObject = {
            id: restObject.Id,
            title: restObject.Title,
            description: restObject.Description,
            link: restObject.Link
        };
        try {
            retObject.additionalColumns = JSON.parse(restObject.additionalColumnsJSON);
        } catch (err) {
            console.log("Could not parse additionalColumnsJSON for object ID " + restObject.Id + ":"), 
            console.log(err), retObject.additionalColumns = {};
        }
        return retObject;
    }, objectExplorerServ.hasMappingRights = function() {
        return usersService.hasRights("object_explorer_mapping");
    }, objectExplorerServ.getMappedObjects = function(mappingKey, element, objectType) {
        var deferred;
        return void 0 === mappingKey || "" === mappingKey || void 0 === objectType || "" === objectType ? $q.reject(gettext("You need to specify the mapping key and object type for which you want to retrieve mapped objects.")) : (void 0 === element && (element = ""), 
        objectMappingPromise[mappingKey + "|||" + element + "|||" + objectType] || (deferred = $q.defer(), 
        objectMappingPromise[mappingKey + "|||" + element + "|||" + objectType] = deferred.promise, 
        restListService.getFilteredItems("object_explorer_mapping", "MappingKey eq '" + mappingKey.replace("'", "''") + "'" + ("" !== element ? " and Element eq '" + element.replace("'", "''") + "'" : "") + " and Object/Type eq '" + objectType.replace("'", "''") + "'", "Object/ID", "Object/ID,Object/Type").then(function(res) {
            if (!(res && res.data && res.data.d && Array.isArray(res.data.d.results))) return $q.reject(gettext("An error occurred: The obtained data object is not formatted as expected."));
            if (res.data.d.results.length < 1) return [];
            var camlQuery = '<View>\n<ViewFields>\n <FieldRef Name="Id" />\n <FieldRef Name="Title" />\n <FieldRef Name="Type" />\n <FieldRef Name="Description" />\n <FieldRef Name="additionalColumnsJSON" />\n <FieldRef Name="Link" />\n</ViewFields>\n<Query>\n <Where>\n  <In>\n   <FieldRef Name="ID" />\n   <Values>\n';
            return res.data.d.results.forEach(function(d) {
                d.Object && d.Object.ID && (camlQuery += '     <Value Type="Number">' + d.Object.ID + "</Value>\n");
            }), camlQuery += "   </Values>\n  </In>\n </Where>\n</Query>\n</View>", restListService.getItemsViaCAML("object_explorer_objects", camlQuery).then(function(res) {
                return res && res.data && res.data.d && Array.isArray(res.data.d.results) ? res.data.d.results : $q.reject(gettext("An error occurred: The obtained data object is not formatted as expected."));
            });
        }).then(function(resultsList) {
            console.log("Success in getting mapped objects for mappingKey " + mappingKey + ", element " + element + ", and type " + objectType + "!"), 
            console.log(resultsList);
            var mappedObjects = resultsList.map(objectExplorerServ.formatObjectFromREST);
            deferred.resolve(mappedObjects);
        }, function(restErr) {
            return $q.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }).catch(function(err) {
            deferred.reject(err);
        })), objectMappingPromise[mappingKey + "|||" + element + "|||" + objectType]);
    }, objectExplorerServ.getObjectsByType = function(objectType) {
        var deferred;
        if (void 0 === objectType || "" === objectType) return $q.reject(gettext("You need to specify the object type for which you want to retrieve all objects."));
        if (objectsByTypePromise[objectType]) return objectsByTypePromise[objectType];
        deferred = $q.defer(), objectsByTypePromise[objectType] = deferred.promise;
        var mappingsByObject = {}, objectList = [], mappingPromise = restListService.getMergedFilteredItems("object_explorer_mapping", "Object/Type eq '" + objectType.replace("'", "''") + "'", "Object,Object/ID,Object/Type,Element", "Object/ID,Object/Type").then(function(res) {
            if (!(res && res.data && res.data.d && Array.isArray(res.data.d.results))) return $q.reject(gettext("An error occurred: The obtained mapping data is not formatted as expected."));
            res.data.d.results.forEach(function(d) {
                d.Object && Array.isArray(mappingsByObject[d.Object.ID]) ? mappingsByObject[d.Object.ID].push(d.Element) : mappingsByObject[d.Object.ID] = [ d.Element ];
            });
        }, function(restErr) {
            deferred.reject(gettext("An error occurred while retrieving mappings:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }), objectPromise = restListService.getMergedFilteredItems("object_explorer_objects", "Type eq '" + objectType.replace("'", "''") + "'", void 0, void 0, "Title").then(function(res) {
            if (!(res && res.data && res.data.d && Array.isArray(res.data.d.results))) return $q.reject(gettext("An error occurred: The obtained data object is not formatted as expected."));
            objectList = res.data.d.results.map(objectExplorerServ.formatObjectFromREST);
        }, function(restErr) {
            deferred.reject(gettext("An error occurred while retrieving objects:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        });
        return $q.all([ mappingPromise, objectPromise ]).then(function() {
            console.log("Mappings for object type " + objectType + " retrieved:"), console.log(mappingsByObject), 
            objectList.forEach(function(d) {
                d.mappings = Array.isArray(mappingsByObject[d.id]) ? mappingsByObject[d.id] : [];
            }), deferred.resolve(objectList);
        }, function(err) {
            deferred.reject(err);
        }), objectsByTypePromise[objectType];
    }, objectExplorerServ.addMapping = function(objectId, mappingKey, element) {
        var mappingItem = {
            ObjectId: objectId,
            MappingKey: mappingKey,
            Element: element
        };
        return restListService.addItem("object_explorer_mapping", mappingItem).then(function(res) {
            return res && res.data && res.data.d && void 0 !== res.data.d.Id ? (clearPromises(), 
            res.data.d.Id) : (console.log("An invalid response was received from the server while trying to add a mapping for object " + objectId + " and element " + element + ":"), 
            console.log(res), $q.reject(gettext("The response from the server when trying to add the mapping was invalid!")));
        }, function(restErr) {
            return $q.reject(gettext("An error occurred while adding the mapping:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        });
    }, objectExplorerServ.getMapping = function(objectId, mappingKey, element) {
        return restListService.getFilteredItems("object_explorer_mapping", "Object eq " + objectId + " and MappingKey eq '" + mappingKey.replace("'", "''") + "' and Element eq '" + element.replace("'", "''") + "'").then(function(res) {
            return res && res.data && res.data.d && res.data.d.results && Array.isArray(res.data.d.results) ? res.data.d.results.length < 1 ? void 0 : res.data.d.results[0] : (console.log("An invalid response was received from the server while trying to obtain the mapping for object " + objectId + ", mappingKey " + mappingKey + ", and element " + element + ":"), 
            console.log(res), $q.reject(gettext("The response from the server when trying to retrieve the mapping was invalid!")));
        }, function(restErr) {
            return $q.reject(gettext("An error occurred while retrieving the mapping:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        });
    }, objectExplorerServ.removeMapping = function(objectId, mappingKey, element) {
        return objectExplorerServ.getMapping(objectId, mappingKey, element).then(function(mapping) {
            return restListService.deleteItem("object_explorer_mapping", mapping.Id).then(function() {
                console.log("Mapping between object " + objectId + ", mappingKey " + mappingKey + ", and element " + element + " has been removed."), 
                clearPromises();
            }, function(restErr) {
                return $q.reject(gettext("An error occurred while deleting the mapping:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
            });
        });
    }, objectExplorerServ;
} ]), angular.module("printServices", [ "gettext" ]).factory("printService", [ "$timeout", "$compile", "$templateRequest", "$q", "$window", "$rootScope", "gettextCatalog", function($timeout, $compile, $templateRequest, $q, $window, $rootScope, gettextCatalog) {
    var printServ = {
        openPrintView: function(template, title, data) {
            var scope = $rootScope.$new(!0);
            scope.data = data, scope._printView = !0;
            var deferred = $q.defer();
            return $templateRequest(template).then(function(templateContent) {
                var linkedContent = $compile(templateContent)(scope);
                console.log("openPrintView: OBTAINED LINK FUNCTION."), console.log([ template, title, data, scope, linkedContent, linkedContent.html() ]), 
                $timeout(function() {
                    scope.$apply(), console.log("openPrintView: RAN DIGEST CYCLE."), console.log([ template, title, data, scope, linkedContent, linkedContent.html() ]);
                    var newWindow = $window.open("common/services/printService.aspx", "_blank", ""), loadData = function() {
                        newWindow.writeContent ? (console.log("New window has loaded!"), console.log(newWindow), 
                        newWindow.writeContent(gettextCatalog.getString(title), linkedContent.html()), deferred.resolve(), 
                        scope.$destroy()) : $timeout(loadData, 500);
                    };
                    loadData();
                }, 0);
            }), deferred.promise;
        }
    };
    return printServ;
} ]), angular.module("risksServices", [ "gettext", "restServices", "miscServices", "usersServices", "socialServices" ]).filter("riskLabel", function() {
    return function(input, labels) {
        return labels[Math.min(labels.length - 1, Math.max(0, Math.floor(input / 100 * labels.length)))];
    };
}).service("risksService", [ "$q", "gettext", "restListService", "usersService", "subscriptionService", "miscServices", function($q, gettext, restListService, usersService, subscriptionService, miscServices) {
    var risksServ = {}, risksPromises = {}, risksMinDate = {};
    return risksServ.getRisksByCategory = function(riskCategory, minDate) {
        var deferred;
        return minDate instanceof Date || (minDate = new Date(1970, 1, 1, 0, 0, 0, 0)), 
        risksPromises[riskCategory] && risksMinDate[riskCategory] <= minDate ? risksMinDate[riskCategory] < minDate ? risksPromises[riskCategory].then(function(risks) {
            return risks.filter(function(risk) {
                return risk.valid_to >= minDate;
            });
        }) : risksPromises[riskCategory] : (deferred = $q.defer(), risksPromises[riskCategory] = deferred.promise, 
        risksMinDate[riskCategory] = minDate, restListService.getMergedFilteredItems("risks", "Category eq '" + riskCategory.replace("'", "''") + "' and Valid_to gt datetime'" + minDate.toISOString() + "'", void 0, void 0, "initialID, Valid_to desc").then(function(res) {
            console.log("Success in getting risks for category " + riskCategory + "!"), console.log(res), 
            res && res.data && res.data.d && Array.isArray(res.data.d.results) || deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected."));
            var retrievedRisks = res.data.d.results.map(function(d) {
                return {
                    id: d.Id,
                    initialId: d.initialID,
                    title: d.Title,
                    description: d.Description,
                    category: d.Category,
                    riskStatus: d.riskStatus,
                    valid_from: miscServices.parseDatetime(d.Valid_from),
                    valid_to: miscServices.parseDatetime(d.Valid_to),
                    xAxis: d.xAxis,
                    yAxis: d.yAxis,
                    lastAuthorId: d.EditorId,
                    lastAuthor: "",
                    lastModifiedDate: Date.parse(d.Modified)
                };
            });
            retrievedRisks.sort(function(a, b) {
                return a.initialId === b.initialId ? b.Valid_to - a.Valid_to : a.initialId - b.initialId;
            });
            var retrieveEditors = retrievedRisks.forEach(function(d) {
                return usersService.getUserById(d.lastAuthorId).then(function(res) {
                    d.lastAuthor = res.name;
                });
            });
            $q.all(retrieveEditors).then(function() {
                deferred.resolve(retrievedRisks);
            }, function(err) {
                deferred.reject(err);
            });
        }, function(restErr) {
            deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }), risksPromises[riskCategory]);
    }, risksServ.isValidRisk = function(risk, newRisk) {
        return risk.category && "" !== risk.title && "" !== risk.description && "" !== risk.riskStatus && risk.valid_from instanceof Date && risk.valid_to instanceof Date && !isNaN(risk.xAxis) && 0 <= risk.xAxis && risk.xAxis <= 100 && !isNaN(risk.yAxis) && 0 <= risk.yAxis && risk.yAxis <= 100 && (newRisk || !isNaN(risk.id) && 0 <= risk.id && !isNaN(risk.initialId) && 0 <= risk.initialId);
    }, risksServ.asRestRisk = function(risk, newRisk) {
        var restRisk = {
            Title: risk.title,
            Description: risk.description,
            Category: risk.category,
            riskStatus: risk.riskStatus,
            Valid_from: risk.valid_from,
            Valid_to: risk.valid_to,
            xAxis: risk.xAxis,
            yAxis: risk.yAxis
        };
        return newRisk || (restRisk.Id = risk.id, restRisk.initialID = risk.initialId), 
        restRisk;
    }, risksServ.updateRisk = function(risk, triggerSubs) {
        var deferred = $q.defer();
        return risksServ.isValidRisk(risk, !1) ? restListService.updateItem("risks", risk.id, risksServ.asRestRisk(risk)).then(function() {
            risk.lastModifiedDate = new Date(), usersService.getCurrentUser().then(function(me) {
                risk.lastAuthorId = me.Id, risk.lastAuthor = me.name, risksPromises[risk.category] = void 0, 
                risksMinDate[risk.category] = void 0, triggerSubs ? subscriptionService.triggerSubs("risk", risk.initialId, "risk", risk.initialId, void 0, risk.sourceLink ? "#" + risk.sourceLink + "%2F" + risk.initialId : void 0, {
                    from: risk.lastAuthorId,
                    risk: risk
                }, "changed-risk").then(function() {
                    return subscriptionService.triggerSubs("riskCategory", risk.category, "risk", risk.initialId, void 0, risk.sourceLink ? "#" + risk.sourceLink + "%2F" + risk.initialId : void 0, {
                        from: risk.lastAuthorId,
                        risk: risk
                    }, "changed-risk");
                }).then(function() {
                    deferred.resolve(risk);
                }, function(err) {
                    console.log("An ERROR occured while triggering subscriptions to the saved risk:"), 
                    console.log(err), console.log(risk), deferred.reject(gettext("An error occured while triggering subscriptions to the saved risk. Please try again later."));
                }) : deferred.resolve(risk);
            });
        }, function(restErr) {
            deferred.reject(gettext("An error occurred when saving the note to the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }) : deferred.reject(gettext("The risk you are trying to update is not valid. Please complete title, description and select risk ratings.")), 
        deferred.promise;
    }, risksServ.addRisk = function(risk) {
        var deferred = $q.defer();
        return risksServ.isValidRisk(risk, !0) ? restListService.addItem("risks", risksServ.asRestRisk(risk)).then(function(res) {
            console.log("Added risk to SharePoint list:"), console.log(res), risk.id = res.data.d.Id, 
            risk.initialId = res.data.d.Id, risksServ.updateRisk(risk, !1).then(function(res) {
                subscriptionService.triggerSubs("riskCategory", risk.category, "risk", risk.initialId, void 0, risk.sourceLink ? "#" + risk.sourceLink + "%2F" + risk.initialId : void 0, {
                    from: res.EditorId,
                    risk: risk
                }, "new-risk").then(function() {
                    deferred.resolve(res);
                }, function(err) {
                    console.log("An ERROR occured while trying to triggerSubs for the new risk:"), console.log(err), 
                    console.log(risk), deferred.reject(gettext("An error occured while trying to trigger the subscriptions for the new risk."));
                });
            }, function(err) {
                deferred.reject(err);
            });
        }, function(restErr) {
            deferred.reject(gettext("An error occurred when saving the note to the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }) : deferred.reject(gettext("The risk you are trying to add is not valid. Please complete title, description and select risk ratings.")), 
        deferred.promise;
    }, risksServ.deleteRisk = function(risk) {
        return restListService.deleteItem("risks", risk.id).then(function(res) {
            return risksPromises[risk.category] = void 0, risksMinDate[risk.category] = void 0, 
            risk.id = -1 * risk.id, usersService.getCurrentUser().then(function(user) {
                return subscriptionService.triggerSubs("risk", risk.initialId, "risk", risk.initialId, void 0, risk.sourceLink ? "#" + risk.sourceLink : void 0, {
                    from: user.id,
                    risk: risk
                }, "deleted-risk").then(function() {
                    return subscriptionService.triggerSubs("riskCategory", risk.category, "risk", risk.initialId, void 0, risk.sourceLink ? "#" + risk.sourceLink : void 0, {
                        from: user.id,
                        risk: risk
                    }, "deleted-risk");
                }).then(function() {
                    return res;
                });
            });
        }, function(restErr) {
            return gettext("An error occurred deleting the note:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText;
        });
    }, risksServ.freezeRisk = function(risk, freezeDatetime) {
        var deferred = $q.defer();
        return risksServ.isValidRisk(risk, !1) ? (risk.valid_to = freezeDatetime, risksServ.updateRisk(risk).then(function() {
            var newRisk = {
                id: -1 * risk.id,
                initialId: risk.initialId,
                title: risk.title,
                description: risk.description,
                category: risk.category,
                riskStatus: risk.riskStatus,
                valid_from: freezeDatetime,
                valid_to: new Date(2999, 12, 31, 12, 0, 0),
                xAxis: risk.xAxis,
                yAxis: risk.yAxis
            };
            return restListService.addItem("risks", risksServ.asRestRisk(newRisk)).then(function(res) {
                return console.log("Added copy of frozen risk to SharePoint list:"), console.log(res), 
                newRisk.id = res.data.d.Id, newRisk;
            }, function(restErr) {
                deferred.reject(gettext("An error occurred when saving the note to the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
            });
        }).then(function(res) {
            risksPromises[risk.category] = void 0, risksMinDate[risk.category] = void 0, deferred.resolve(res);
        }, function(err) {
            deferred.reject(err);
        })) : deferred.reject(gettext("The risk you are trying to freeze is not valid. Please complete title, description and select risk ratings.")), 
        deferred.promise;
    }, risksServ;
} ]).service("impactsService", [ "$q", "gettext", "restListService", "interactionService", "subscriptionService", "miscServices", function($q, gettext, restListService, interactionService, subscriptionService, miscServices) {
    var impactServ = {}, impactsPromises = {}, asRestImpact = function(impact, newImpact) {
        var restImpact = {
            Title: impact.impactType,
            sourceEndpoint: impact.sourceEndpoint,
            sourceId: impact.sourceId,
            sourceKeywords: impact.sourceKeywords,
            sourceUrl: impact.sourceUrl,
            sourceDescription: impact.sourceDescription,
            targetRiskCategory: void 0 !== impact.targetRiskCategory ? impact.targetRiskCategory : "NONE",
            targetRiskInitialId: void 0 === impact.targetRiskInitialId ? -1 : impact.targetRiskInitialId
        };
        return newImpact && !impact.impactDate || (restImpact.impactDate = impact.impactDate), 
        newImpact || (restImpact.Id = impact.id), restImpact;
    }, fromRestImpact = function(restImpact) {
        return {
            id: restImpact.Id,
            impactType: restImpact.Title,
            sourceEndpoint: restImpact.sourceEndpoint,
            sourceId: restImpact.sourceId,
            sourceKeywords: restImpact.sourceKeywords,
            sourceUrl: restImpact.sourceUrl,
            sourceDescription: restImpact.sourceDescription,
            targetRiskCategory: restImpact.targetRiskCategory,
            targetRiskInitialId: restImpact.targetRiskInitialId,
            impactDate: miscServices.parseDatetime(restImpact.impactDate),
            lastAuthorId: restImpact.EditorId,
            lastModifiedDate: miscServices.parseDatetime(restImpact.Modified)
        };
    }, clearPromises = function(impact) {
        impactsPromises["CATEGORY-" + (void 0 === impact.targetRiskCategory ? "NONE" : impact.targetRiskCategory)] = void 0, 
        impactsPromises["CATEGORY-ALL"] = void 0, impactsPromises["SOURCE-" + impact.sourceEndpoint + "-" + impact.sourceId] = void 0, 
        Object.keys(impactsPromises).forEach(function(k) {
            var matched = k.match(/^SOURCE-KEYWORDS-([.+])-(FULL|PREFIX)$/);
            matched && matched[1].split("|").forEach(function(impactKeyword) {
                impact.sourceKeywords.forEach(function(sourceKeyword) {
                    var minLength = Math.min(impactKeyword.length, sourceKeyword.length);
                    (impactKeyword === sourceKeyword || "PREFIX" === matched[2] && impactKeyword.substr(0, minLength) === sourceKeyword.substr(0, minLength)) && (impactsPromises[k] = void 0);
                });
            });
        });
    };
    return impactServ.addImpact = function(impact, targetDescription) {
        var impactAuthorId;
        return restListService.addItem("impact_flags", asRestImpact(impact)).then(function(res) {
            return console.log("Added impact to SharePoint list:"), console.log(res), clearPromises(impact), 
            impact.lastModifiedDate = new Date(), impact.impactDate = miscServices.parseDatetime(res.data.d.impactDate), 
            impact.id = res.data.d.Id, impactAuthorId = res.data.d.AuthorId, void 0 !== impact.targetRiskInitialId && null !== impact.targetRiskInitialId ? subscriptionService.triggerSubs("risk", impact.targetRiskInitialId, "impact", impact.id, void 0, impact.sourceUrl, {
                from: impactAuthorId,
                impact: impact,
                targetDescription: targetDescription
            }, "new-impact") : impact.targetRiskCategory && "NONE" !== impact.targetRiskCategory ? subscriptionService.triggerSubs("riskCategory", impact.targetRiskCategory, "impact", impact.id, void 0, impact.sourceUrl, {
                from: impactAuthorId,
                impact: impact,
                targetDescription: targetDescription
            }, "new-impact") : void 0;
        }).then(function() {
            return subscriptionService.triggerSubs(subscriptionService.subscriptionTypeForEndpoint(impact.sourceEndpoint), impact.sourceId, "impact", impact.id, void 0, impact.sourceUrl, {
                from: impactAuthorId,
                impact: impact,
                targetDescription: targetDescription
            }, "new-impact");
        }).then(function() {
            return impact;
        }, function(err) {
            return console.log("An ERROR occured while trying to addImpact:"), console.log(impact), 
            console.log(err), $q.reject(gettext("An error occurred while trying to update the impacts for this note."));
        });
    }, impactServ.updateImpact = function(impact) {
        return restListService.updateItem("impact_flags", impact.id, asRestImpact(impact)).then(function() {
            return impact.lastModifiedDate = new Date(), clearPromises(impact), impact;
        }, function(restErr) {
            return $q.reject(gettext("An error occurred when saving the note to the server:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        });
    }, impactServ.deleteImpact = function(impact) {
        return restListService.deleteItem("impact_flags", impact.id).then(function() {
            clearPromises(impact), subscriptionService.removeNewsBySource("impact", impact.id).then(function() {
                return interactionService.removeInteractionsByTarget("impact", impact.id);
            });
        }, function(restErr) {
            return $q.reject(gettext("An error occurred deleting the impact flag:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        });
    }, impactServ.getImpactsByRiskCategory = function(riskCategory, fromDate, toDate) {
        var deferred, promiseKey = "CATEGORY-" + (void 0 === riskCategory ? "ALL" : riskCategory);
        if (impactsPromises[promiseKey]) {
            var foundPromise = impactsPromises[promiseKey].find(function(d) {
                return (fromDate ? !d.fromDate || d.fromDate <= fromDate : !d.FromDate) && (toDate ? !d.toDate || d.toDate >= toDate : !d.toDate);
            });
            if (foundPromise) return foundPromise.promise.then(function(impacts) {
                return impacts.filter(function(impact) {
                    return (!fromDate || impact.impactDate >= fromDate) && (!toDate || impact.impactDate <= toDate);
                });
            });
        } else impactsPromises[promiseKey] = [];
        deferred = $q.defer(), impactsPromises[promiseKey].push({
            fromDate: fromDate,
            toDate: toDate,
            promise: deferred.promise
        });
        var queryArray = [];
        return void 0 !== riskCategory && queryArray.push("targetRiskCategory eq '" + riskCategory.replace("'", "''") + "'"), 
        fromDate && queryArray.push("impactDate ge datetime'" + fromDate.toISOString().substr(0, 10) + "T00:00:00'"), 
        toDate && queryArray.push("impactDate le datetime'" + toDate.toISOString().substr(0, 10) + "T23:59:59'"), 
        restListService.getMergedFilteredItems("impact_flags", queryArray.join(" and "), void 0, void 0, "Title, impactDate").then(function(res) {
            console.log("Success in getting impacts for category " + riskCategory + "!"), console.log(res), 
            res && res.data && res.data.d && Array.isArray(res.data.d.results) || deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected."));
            var retrievedImpacts = res.data.d.results.map(fromRestImpact);
            retrievedImpacts.sort(function(a, b) {
                return a.impactType !== b.impactType ? a.impactType < b.impactType ? 1 : -1 : a.impactDate > b.impactDate ? 1 : a.impactDate < b.impactDate ? -1 : a.lastModifiedDate - b.lastModifiedDate;
            }), deferred.resolve(retrievedImpacts);
        }, function(restErr) {
            deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }), deferred.promise;
    }, impactServ.getImpactsBySource = function(sourceEndpoint, sourceId) {
        var deferred, promiseKey = "SOURCE-" + sourceEndpoint + "-" + sourceId;
        return impactsPromises[promiseKey] ? impactsPromises[promiseKey] : (deferred = $q.defer(), 
        impactsPromises[promiseKey] = deferred.promise, restListService.getMergedFilteredItems("impact_flags", "sourceEndpoint eq '" + sourceEndpoint.replace("'", "''") + "' and sourceId eq " + sourceId, void 0, void 0, "impactDate").then(function(res) {
            console.log("Success in getting impacts for source " + sourceEndpoint + " / " + sourceId + "!"), 
            console.log(res), res && res.data && res.data.d && Array.isArray(res.data.d.results) || deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected.")), 
            deferred.resolve(res.data.d.results.map(fromRestImpact));
        }, function(restErr) {
            deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }), deferred.promise);
    }, impactServ.getImpactsBySourceKeywords = function(sourceEndpoint, sourceKeywords, isPrefix) {
        var deferred, promiseKey = "SOURCE-KEYWORDS-" + sourceEndpoint + "-" + sourceKeywords.join("|") + "-" + (isPrefix ? "PREFIX" : "FULL");
        if (impactsPromises[promiseKey]) return impactsPromises[promiseKey];
        deferred = $q.defer(), impactsPromises[promiseKey] = deferred.promise;
        var searchString = "sourceEndpoint eq '" + sourceEndpoint.replace("'", "''") + "' and " + sourceKeywords.map(function(searchTerm) {
            return "substringof('" + (isPrefix ? searchTerm : searchTerm + ",") + "', sourceKeywords)";
        }).join(" and ");
        return console.log("Getting impacts for sourcesKeywords:"), console.log([ sourceEndpoint, sourceKeywords, isPrefix, searchString ]), 
        restListService.getMergedFilteredItems("impact_flags", searchString, void 0, void 0, "impactDate").then(function(res) {
            console.log("Success in getting impacts for sourcesKeywords:"), console.log([ sourceEndpoint, sourceKeywords, isPrefix ]), 
            console.log(res), res && res.data && res.data.d && Array.isArray(res.data.d.results) || deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected.")), 
            deferred.resolve(res.data.d.results.map(fromRestImpact));
        }, function(restErr) {
            deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        }), deferred.promise;
    }, impactServ;
} ]), angular.module("restServices", [ "gettext" ]).config([ "restBaseServiceProvider", "restListServiceProvider", "restUserServiceProvider", "restDocumentServiceProvider", function(restBaseServiceProvider, restListServiceProvider, restUserServiceProvider, restDocumentServiceProvider) {
    var sharepointConfig = {
        baseUrl: window.dashboardSharePointBaseUrl,
        apiBaseUrl: window.dashboardSharePointApiBaseUrl,
        maxItemsPerRequest: 200,
        listViewThreshold: window.dashboardSharePointListViewThreshold ? window.dashboardSharePointListViewThreshold : 5e3,
        httpGetConfig: {
            headers: {
                Accept: "application/json;odata=verbose"
            }
        },
        httpPostConfig: {
            headers: {
                Accept: "application/json;odata=verbose",
                "Content-Type": "application/json;odata=verbose"
            }
        },
        httpUploadConfig: {
            transformRequest: angular.identity,
            headers: {
                Accept: "application/json;odata=verbose",
                "Content-Type": "application/json;odata=verbose",
                BinaryStringRequestBody: "true"
            }
        },
        httpPutConfig: {
            headers: {
                Accept: "application/json;odata=verbose",
                "Content-Type": "application/json;odata=verbose",
                "IF-MATCH": "*",
                "X-HTTP-Method": "MERGE"
            }
        },
        httpDeleteConfig: {
            headers: {
                Accept: "application/json;odata=verbose",
                "Content-Type": "application/json;odata=verbose",
                "IF-MATCH": "*",
                "X-HTTP-Method": "DELETE"
            }
        }
    }, sharepointEndpoints = {
        tree: "web/lists/getbytitle%28'Dashboard%20-%20Tree'%29",
        views: "web/lists/getbytitle%28'Dashboard%20-%20Views'%29",
        notes: "web/lists/getbytitle%28'Dashboard%20-%20Notes'%29",
        keywords: "web/lists/getbytitle%28'Dashboard%20-%20Keywords'%29",
        datafiles: "web/lists/getbytitle%28'Dashboard%20-%20Datafiles'%29",
        risks: "web/lists/getbytitle%28'Dashboard%20-%20Risks'%29",
        configuration: "web/lists/getbytitle%28'Dashboard%20-%20Configuration'%29",
        user_settings: "web/lists/getbytitle%28'Dashboard%20-%20User%20Settings'%29",
        task_data: "web/lists/getbytitle%28'Dashboard%20-%20Task%20Data'%29",
        task_data_archive: "web/lists/getbytitle%28'Dashboard%20-%20Task%20Archive'%29",
        object_explorer_objects: "web/lists/getbytitle%28'Dashboard%20-%20Object%20Explorer%20Objects'%29",
        object_explorer_mapping: "web/lists/getbytitle%28'Dashboard%20-%20Object%20Explorer%20Mapping'%29",
        impact_flags: "web/lists/getbytitle%28'Dashboard%20-%20Impact%20Flags'%29",
        audit_forms: "web/lists/getbytitle%28'Dashboard%20-%20Audit%20Forms'%29",
        audit_forms_data: "web/lists/getbytitle%28'Dashboard%20-%20Audit%20Forms%20Data'%29",
        task_results: "web/lists/getbytitle%28'Dashboard%20-%20Task%20Results'%29",
        task_results_archive: "web/lists/getbytitle%28'Dashboard%20-%20Task%20Archive%20Results'%29",
        feedback: "web/lists/getbytitle%28'Dashboard%20-%20Feedback'%29",
        newsfeed: "web/lists/getbytitle%28'Dashboard%20-%20Newsfeed'%29",
        interactions: "web/lists/getbytitle%28'Dashboard%20-%20Interactions'%29",
        subscriptions: "web/lists/getbytitle%28'Dashboard%20-%20Subscriptions'%29"
    };
    restBaseServiceProvider.doConfig(sharepointConfig), restListServiceProvider.doConfig(sharepointEndpoints, sharepointConfig), 
    restUserServiceProvider.doConfig(sharepointEndpoints, sharepointConfig), restDocumentServiceProvider.doConfig(sharepointEndpoints, {
        task_data: "web/getfolderbyserverrelativeurl%28'Dashboard%20%20Task%20Data'%29",
        task_data_archive: "web/getfolderbyserverrelativeurl%28'Dashboard%20%20Task%20Archive'%29",
        audit_forms: "web/getfolderbyserverrelativeurl%28'Dashboard%20%20Audit%20Forms'%29",
        task_results: "web/getfolderbyserverrelativeurl%28'Dashboard%20%20Task%20Results'%29",
        task_results_archive: "web/getfolderbyserverrelativeurl%28'Dashboard%20%20Task%20Archive%20Results'%29"
    }, sharepointConfig);
} ]).provider("restBaseService", function() {
    var spContextInfo, spContextInfoLastUpdated, spContextInfoPromise, provider = {}, config = {};
    return provider.doConfig = function(configParam) {
        config = configParam;
    }, provider.$get = [ "$http", "$q", "gettext", function($http, $q, gettext) {
        var service = {
            updateFormDigest: function(configObject) {
                if (spContextInfoPromise && (!spContextInfo || !spContextInfoLastUpdated || 1e3 * spContextInfo.FormDigestTimeoutSeconds > Date.now() - spContextInfoLastUpdated)) return spContextInfoPromise.then(function(spContextInfo) {
                    return configObject && (configObject.httpPostConfig.headers["X-RequestDigest"] = spContextInfo.FormDigestValue, 
                    configObject.httpUploadConfig.headers["X-RequestDigest"] = spContextInfo.FormDigestValue, 
                    configObject.httpPutConfig.headers["X-RequestDigest"] = spContextInfo.FormDigestValue, 
                    configObject.httpDeleteConfig.headers["X-RequestDigest"] = spContextInfo.FormDigestValue), 
                    spContextInfo;
                });
                var deferred = $q.defer();
                return spContextInfoPromise = deferred.promise, $http.post(config.apiBaseUrl + "contextinfo", "", config.httpPostConfig).then(function(res) {
                    spContextInfoLastUpdated = Date.now(), spContextInfo = res.data.d.GetContextWebInformation, 
                    configObject && (configObject.httpPostConfig.headers["X-RequestDigest"] = spContextInfo.FormDigestValue, 
                    configObject.httpUploadConfig.headers["X-RequestDigest"] = spContextInfo.FormDigestValue, 
                    configObject.httpPutConfig.headers["X-RequestDigest"] = spContextInfo.FormDigestValue, 
                    configObject.httpDeleteConfig.headers["X-RequestDigest"] = spContextInfo.FormDigestValue), 
                    deferred.resolve(spContextInfo);
                }, function(restErr) {
                    deferred.reject(restErr);
                }), deferred.promise;
            },
            processRestList: function(res) {
                return res && res.data && res.data.d && res.data.d.results && Array.isArray(res.data.d.results) ? $q.resolve(res.data.d.results) : (console.log("The REST response returned by the server was not in the expected array list format:"), 
                console.log(res), $q.reject(gettext("Unexpected response from server.")));
            },
            processRestError: function(restErr) {
                return console.log("A REST error occured:"), console.log(restErr), $q.reject(gettext("Unexpected response from server."));
            }
        };
        return service;
    } ], provider;
}).provider("restListService", function() {
    var provider = {}, endpoints = {}, config = {}, spListItemTypes = {};
    return provider.doConfig = function(endpointsParam, configParam) {
        endpoints = endpointsParam, config = configParam;
    }, provider.$get = [ "$http", "$q", "gettext", "restBaseService", function($http, $q, gettext, restBaseService) {
        var service = {}, getListItemType = function(endpoint, listTitle) {
            var deferred = $q.defer(), listURL = service.getListURL(endpoint, listTitle);
            return void 0 === spListItemTypes[listURL] ? $http.get(listURL + "?$select=ListItemEntityTypeFullName", config.httpGetConfig).then(function(res) {
                console.log("Obtained list item type from server: "), console.log(res), spListItemTypes[listURL] = res.data.d.ListItemEntityTypeFullName, 
                deferred.resolve(spListItemTypes[listURL]);
            }, function(restErr) {
                deferred.reject(restErr);
            }) : deferred.resolve(spListItemTypes[listURL]), deferred.promise;
        };
        return service.getListEndpoints = function() {
            return endpoints;
        }, service.getListURL = function(endpoint, listTitle, listGUID) {
            return void 0 !== endpoint && void 0 !== endpoints[endpoint] ? config.apiBaseUrl + endpoints[endpoint] : void 0 !== listTitle ? config.apiBaseUrl + "web/lists/getbytitle%28'" + encodeURIComponent(listTitle) + "'%29" : void 0 !== listGUID ? config.apiBaseUrl + "web/lists%28guid'" + encodeURIComponent(listGUID) + "'%29" : void 0;
        }, service.getAllItems = function(endpoint) {
            return $http.get(config.apiBaseUrl + endpoints[endpoint] + "/items?$top=" + config.listViewThreshold, config.httpGetConfig);
        }, service.getMergedAllItems = function(endpoint, nextUrl, listTitle) {
            return $http.get(nextUrl || service.getListURL(endpoint, listTitle) + "/items?$top=" + config.maxItemsPerRequest, config.httpGetConfig).then(function(res) {
                return res && res.data && res.data.d && res.data.d.results && Array.isArray(res.data.d.results) ? res.data.d.__next ? service.getMergedAllItems(endpoint, res.data.d.__next, listTitle).then(function(newRes) {
                    return newRes && newRes.data && newRes.data.d && newRes.data.d.results && Array.isArray(newRes.data.d.results) ? (newRes.data.d.results = res.data.d.results.concat(newRes.data.d.results), 
                    newRes) : (console.log("When merging all items, received unexpected result: "), 
                    console.log(newRes), $q.reject("An unexpected result was received while trying to merge all items for the list."));
                }) : res : (console.log("Received unexpected result in getMergedAllItems: "), console.log(res), 
                $q.reject("An unexpected result was received while trying to merge all items for the list."));
            });
        }, service.getFilteredItems = function(endpoint, filter, select, expand, orderby, top, listTitle) {
            return console.log("getFilteredItems for list URL '" + service.getListURL(endpoint, listTitle) + "' and filter '" + filter + "' (with select = '" + select + "', expand = '" + expand + "', orderby = '" + orderby + "', top = " + top + ")"), 
            $http.get(service.getListURL(endpoint, listTitle) + "/items?$filter=" + encodeURIComponent(filter) + (void 0 !== select ? "&$select=" + encodeURIComponent(select) : "") + (void 0 !== expand ? "&$expand=" + encodeURIComponent(expand) : "") + (void 0 !== orderby ? "&$orderby=" + encodeURIComponent(orderby) : "") + (void 0 !== top ? "&$top=" + encodeURIComponent(top) : ""), config.httpGetConfig);
        }, service.getMergedFilteredItems = function(endpoint, filter, select, expand, orderby, maxRecords, nextUrl, listTitle) {
            var promise;
            console.log("getMergedFilteredItems for endpoint '" + endpoint + "' and filter '" + filter + "' (with select = '" + select + "', expand = '" + expand + "', orderby = '" + orderby + "', maxRecords = " + maxRecords + ", nextUrl = " + nextUrl + ")");
            var currMinRecords = 0;
            if (void 0 === maxRecords && (maxRecords = 1 / 0), nextUrl) {
                var viewFilter = nextUrl.match(/\(ID( |\+|%20)ge( |\+|%20)([0-9]+)( |\+|%20)and( |\+|%20)ID( |\+|%20)le( |\+|%20)([0-9]+)\)/);
                viewFilter && (currMinRecords = viewFilter[3]), console.log("Received nextUrl with viewFilter, currMinRecords = " + currMinRecords + "."), 
                console.log(viewFilter), promise = $http.get(nextUrl, config.httpGetConfig);
            } else promise = service.getFilteredItems(endpoint, "", "ID", "", "ID desc", 1, listTitle).then(function(res) {
                if (!(res.data && res.data.d && res.data.d.results && Array.isArray(res.data.d.results))) return console.log("Unexpected results set:"), 
                console.log(res), $q.reject("When trying to obtain the maximum ID in the list, the result was not as expected!");
                var modifiedFilter, maxID = 0 < res.data.d.results.length ? res.data.d.results[0].Id : 0;
                return maxID > config.listViewThreshold ? (currMinRecords = maxID - config.listViewThreshold, 
                modifiedFilter = filter + " and (ID ge " + currMinRecords + " and ID le " + maxID + ")") : (currMinRecords = 0, 
                modifiedFilter = filter), service.getFilteredItems(endpoint, modifiedFilter, select, expand, orderby, config.maxItemsPerRequest, listTitle);
            });
            return promise.then(function(res) {
                if (!(res.data && res.data.d && res.data.d.results && Array.isArray(res.data.d.results))) return console.log("Unexpected results set:"), 
                console.log(res), $q.reject("When trying to retrieve results set of filtered list items, the result was not as expected!");
                if (!res.data.d.__next && 0 < currMinRecords) {
                    var newMinRecords = currMinRecords > config.listViewThreshold ? currMinRecords - config.listViewThreshold : 0;
                    res.data.d.__next = nextUrl ? nextUrl.replace(/(%24|\$)skiptoken=(.+?)&/, "").replace(/\(ID( |\+|%20)ge( |\+|%20)([0-9]+)( |\+|%20)and( |\+|%20)ID( |\+|%20)le( |\+|%20)([0-9]+)\)/, "(ID+ge+" + newMinRecords + "+and+ID+le+" + (currMinRecords - 1) + ")") : service.getListURL(endpoint, listTitle) + "/items?$filter=" + encodeURIComponent(filter + " and (ID ge " + newMinRecords + " and ID le " + (currMinRecords - 1) + ")") + (void 0 !== select ? "&$select=" + encodeURIComponent(select) : "") + (void 0 !== expand ? "&$expand=" + encodeURIComponent(expand) : "") + (void 0 !== orderby ? "&$orderby=" + encodeURIComponent(orderby) : "") + "&$top=" + encodeURIComponent(config.maxItemsPerRequest);
                }
                return res.data.d.results.length >= maxRecords || !res.data.d.__next ? res : service.getMergedFilteredItems(endpoint, filter, select, expand, orderby, maxRecords - res.data.d.results.length, res.data.d.__next, listTitle).then(function(resNew) {
                    return resNew.data && resNew.data.d && resNew.data.d.results && Array.isArray(resNew.data.d.results) ? (resNew.data.d.results = res.data.d.results.concat(resNew.data.d.results), 
                    resNew) : (console.log("Unexpected results set:"), console.log(resNew), $q.reject("When trying to iteratively retrieve results, the result was not as expected!"));
                });
            });
        }, service.getItemsViaCAML = function(endpoint, camlXml) {
            return console.log('getItemsViaCAML for endpoint "' + endpoint + '" and camlXml: ' + camlXml), 
            restBaseService.updateFormDigest(config).then(function() {
                var queryObject = {
                    query: {
                        __metadata: {
                            type: "SP.CamlQuery"
                        },
                        ViewXml: camlXml
                    }
                };
                return $http.post(config.apiBaseUrl + endpoints[endpoint] + "/getItems", queryObject, config.httpPostConfig);
            });
        }, service.getItemById = function(endpoint, itemId) {
            return $http.get(config.apiBaseUrl + endpoints[endpoint] + "/getitembyid(" + itemId + ")", config.httpGetConfig);
        }, service.addItem = function(endpoint, item, listTitle) {
            var formDigestPromise = restBaseService.updateFormDigest(config), listTypePromise = getListItemType(endpoint, listTitle);
            return $q.all([ formDigestPromise, listTypePromise ]).then(function(res) {
                return item.__metadata = {
                    type: res[1]
                }, $http.post(service.getListURL(endpoint, listTitle) + "/items", item, config.httpPostConfig);
            });
        }, service.updateItem = function(endpoint, itemID, updateItem, listTitle) {
            var formDigestPromise = restBaseService.updateFormDigest(config), listTypePromise = getListItemType(endpoint, listTitle);
            return $q.all([ formDigestPromise, listTypePromise ]).then(function(res) {
                return updateItem.__metadata = {
                    type: res[1]
                }, $http.post(service.getListURL(endpoint, listTitle) + "/items(" + itemID + ")", updateItem, config.httpPutConfig);
            });
        }, service.updateFilteredItems = function(endpoint, searchQuery, updateItem, listTitle) {
            return service.getMergedFilteredItems(endpoint, searchQuery, "Id", void 0, "Id", void 0, void 0, listTitle).then(function(res) {
                var myPromise = $q.resolve();
                return res.data && res.data.d && res.data.d.results && Array.isArray(res.data.d.results) ? (res.data.d.results.forEach(function(item) {
                    myPromise = myPromise.then(function() {
                        return service.updateItem(endpoint, item.Id, updateItem, listTitle);
                    });
                }), myPromise) : $q.reject(gettext("An error occured while trying to update filtered items: The returned results set was not in the expected format."));
            });
        }, service.addAttachment = function(endpoint, itemID, fileName, file) {
            var deferred = $q.defer(), reader = new FileReader();
            return reader.onloadend = function() {
                reader.error ? deferred.reject({
                    status: -1,
                    statusText: reader.error.message
                }) : restBaseService.updateFormDigest(config).then(function() {
                    return $http.post(config.apiBaseUrl + endpoints[endpoint] + "/items(" + itemID + ")/AttachmentFiles/add(FileName='" + fileName.replace("'", "''") + "')", reader.result, config.httpUploadConfig);
                }).then(function(res) {
                    deferred.resolve(res);
                }, function(restErr) {
                    deferred.reject(restErr);
                });
            }, reader.readAsArrayBuffer(file), deferred.promise;
        }, service.addAttachmentFromString = function(endpoint, itemID, fileName, content) {
            return restBaseService.updateFormDigest(config).then(function() {
                return $http.post(config.apiBaseUrl + endpoints[endpoint] + "/items(" + itemID + ")/AttachmentFiles/add(FileName='" + fileName.replace("'", "''") + "')", content, config.httpUploadConfig);
            });
        }, service.removeAttachment = function(endpoint, itemID, fileName) {
            return restBaseService.updateFormDigest(config).then(function() {
                return $http.post(config.apiBaseUrl + endpoints[endpoint] + "/items(" + itemID + ")/AttachmentFiles('" + fileName.replace("'", "''") + "')", "", config.httpDeleteConfig);
            });
        }, service.deleteItem = function(endpoint, itemID, listTitle) {
            return restBaseService.updateFormDigest(config).then(function() {
                return $http.post(service.getListURL(endpoint, listTitle) + "/items(" + itemID + ")/recycle()", "", config.httpPostConfig);
            });
        }, service.deleteFilteredItems = function(endpoint, searchQuery, listTitle) {
            return service.getMergedFilteredItems(endpoint, searchQuery, "Id", void 0, "Id", void 0, void 0, listTitle).then(function(res) {
                var myPromise = $q.resolve();
                return res.data && res.data.d && res.data.d.results && Array.isArray(res.data.d.results) ? (res.data.d.results.forEach(function(item) {
                    myPromise = myPromise.then(function() {
                        return service.deleteItem(endpoint, item.Id, listTitle);
                    });
                }), myPromise) : $q.reject(gettext("An error occured while trying to delete filtered items: The returned results set was not in the expected format."));
            });
        }, service.getAdditionalData = function(endpoint, itemID, additionalData) {
            return $http.get(config.apiBaseUrl + endpoints[endpoint] + "/items(" + itemID + ")/" + additionalData, config.httpGetConfig);
        }, service.getListInfo = function(endpoint, listTitle, listGUID) {
            return $http.get(service.getListURL(endpoint, listTitle, listGUID), config.httpGetConfig);
        }, service.getListFields = function(endpoint, listTitle) {
            return $http.get(service.getListURL(endpoint, listTitle) + "/Fields", config.httpGetConfig);
        }, service.createList = function(listObject) {
            var sharepointList = {
                __metadata: {
                    type: "SP.List"
                },
                Title: listObject.Title,
                Description: listObject.Description,
                AllowContentTypes: !0,
                BaseTemplate: 100,
                ContentTypesEnabled: !1,
                EnableVersioning: !!listObject.EnableVersioning
            };
            return restBaseService.updateFormDigest(config).then(function() {
                return $http.post(config.apiBaseUrl + "web/lists", sharepointList, config.httpPostConfig);
            });
        }, service.updateListField = function(listName, fieldObject, oldTitle) {
            var sharepointListField = {
                __metadata: {
                    type: "SP.Field"
                },
                Title: fieldObject.Title,
                FieldTypeKind: fieldObject.FieldTypeKind,
                Required: fieldObject.Required,
                Indexed: fieldObject.Indexed,
                EnforceUniqueValues: fieldObject.EnforceUniqueValues,
                StaticName: fieldObject.StaticName,
                DefaultValue: fieldObject.DefaultValue
            }, needToSetUnlimited = !!fieldObject.UnlimitedLengthInDocumentLibrary;
            if (2 === fieldObject.FieldTypeKind && (sharepointListField.__metadata.type = "SP.FieldText"), 
            3 === fieldObject.FieldTypeKind && (sharepointListField.__metadata.type = "SP.FieldMultiLineText", 
            sharepointListField.RichText = "true" === fieldObject.RichText ? "true" : "false", 
            sharepointListField.NumberOfLines = fieldObject.NumberOfLines ? fieldObject.NumberOfLines : 6), 
            4 === fieldObject.FieldTypeKind && (sharepointListField.__metadata.type = "SP.FieldDateTime", 
            sharepointListField.DisplayFormat = void 0 !== fieldObject.DisplayFormat ? fieldObject.DisplayFormat : 1), 
            6 === fieldObject.FieldTypeKind && (sharepointListField.__metadata.type = "SP.FieldChoice", 
            sharepointListField.FillInChoice = "true" === fieldObject.FillInChoice ? "true" : "false", 
            sharepointListField.Choices = {
                results: fieldObject.Choices
            }), 8 === fieldObject.FieldTypeKind && (sharepointListField.__metadata.type = "SP.Field"), 
            9 === fieldObject.FieldTypeKind && (sharepointListField.__metadata.type = "SP.FieldNumber"), 
            11 === fieldObject.FieldTypeKind && (sharepointListField.__metadata.type = "SP.FieldUrl"), 
            20 === fieldObject.FieldTypeKind && (sharepointListField.__metadata.type = "SP.FieldUser", 
            sharepointListField.SelectionMode = 1 === fieldObject.SelectionMode ? 1 : 0), 7 === fieldObject.FieldTypeKind) {
                var obtainedId, currPromise;
                if (oldTitle) currPromise = restBaseService.updateFormDigest(config).then(function() {
                    return $http.post(config.apiBaseUrl + "web/lists/" + encodeURIComponent("getbytitle('" + listName + "')") + "/Fields/" + encodeURIComponent("getbytitle('" + oldTitle + "')"), fieldObject, config.httpPutConfig);
                }); else {
                    var addFieldParameters = {
                        __metadata: {
                            type: "SP.FieldCreationInformation"
                        },
                        Title: fieldObject.Title,
                        FieldTypeKind: fieldObject.FieldTypeKind,
                        Required: fieldObject.Required,
                        LookupFieldName: fieldObject.LookupField
                    };
                    currPromise = service.getListInfo(void 0, fieldObject.LookupListName).then(function(res) {
                        addFieldParameters.LookupListId = res.data.d.Id;
                    }).then(function() {
                        return restBaseService.updateFormDigest(config);
                    }).then(function() {
                        return $http.post(config.apiBaseUrl + "web/lists/" + encodeURIComponent("getbytitle('" + listName + "')") + "/Fields/AddField", {
                            parameters: addFieldParameters
                        }, config.httpPostConfig);
                    });
                }
                return currPromise = currPromise.then(function(res) {
                    console.log("We obtained data from the  Sharepoint field: "), console.log(res), 
                    obtainedId = res.data.d.Id;
                }), fieldObject.LookupOtherColumns.forEach(function(col) {
                    currPromise = currPromise.then(function() {
                        return $http.post(config.apiBaseUrl + "web/lists/" + encodeURIComponent("getbytitle('" + listName + "')") + "/Fields/adddependentlookupfield" + encodeURIComponent("(displayname='" + fieldObject.Title + "_" + col + "', primarylookupfieldid='" + obtainedId + "', showfield='" + col + "')"), "", config.httpPostConfig);
                    });
                }), (fieldObject.Indexed || fieldObject.RelationshipDeleteBehavior) && (currPromise = currPromise.then(function() {
                    var updateObject = {
                        __metadata: {
                            type: "SP.FieldLookup"
                        },
                        Indexed: !0,
                        RelationshipDeleteBehavior: fieldObject.RelationshipDeleteBehavior
                    };
                    return $http.post(config.apiBaseUrl + "web/lists/" + encodeURIComponent("getbytitle('" + listName + "')") + "/Fields('" + obtainedId + "')", updateObject, config.httpPutConfig);
                })), currPromise;
            }
            var originalResponse, newSchema, returnPromise = restBaseService.updateFormDigest(config).then(function() {
                return $http.post(config.apiBaseUrl + "web/lists/" + encodeURIComponent("getbytitle('" + listName + "')") + "/Fields" + (oldTitle ? "/" + encodeURIComponent("getbytitle('" + oldTitle + "')") : ""), sharepointListField, oldTitle ? config.httpPutConfig : config.httpPostConfig);
            });
            return 3 === fieldObject.FieldTypeKind && needToSetUnlimited && (returnPromise = returnPromise.then(function(res) {
                newSchema = (originalResponse = res).data.d.SchemaXml.replace("/>", ' UnlimitedLengthInDocumentLibrary="TRUE" />');
                var updateObject = {
                    __metadata: sharepointListField.__metadata,
                    SchemaXml: newSchema
                };
                return console.log("Updating schema for " + sharepointListField.Title + ": " + newSchema), 
                $http.post(config.apiBaseUrl + "web/lists/" + encodeURIComponent("getbytitle('" + listName + "')") + "/Fields/" + encodeURIComponent("getbytitle('" + sharepointListField.Title + "')"), updateObject, config.httpPutConfig);
            }).then(function() {
                return originalResponse.data.d.SchemaXml = newSchema, originalResponse;
            })), returnPromise;
        }, service.createListField = function(listName, fieldObject) {
            return service.updateListField(listName, fieldObject);
        }, service.deleteListField = function(listName, fieldId) {
            return restBaseService.updateFormDigest(config).then(function() {
                return $http.post(config.apiBaseUrl + "web/lists/" + encodeURIComponent("getbytitle('" + listName + "')") + "/Fields" + encodeURIComponent("(guid'" + fieldId + "')"), "", config.httpDeleteConfig);
            });
        }, service.deleteListFieldByTitle = function(listName, fieldTitle) {
            return restBaseService.updateFormDigest(config).then(function() {
                return $http.post(config.apiBaseUrl + "web/lists/" + encodeURIComponent("getbytitle('" + listName + "')") + "/Fields/" + encodeURIComponent("getbytitle('" + fieldTitle + "')"), "", config.httpDeleteConfig);
            });
        }, service.deleteList = function(listName) {
            return restBaseService.updateFormDigest(config).then(function() {
                return $http.post(config.apiBaseUrl + "web/lists/" + encodeURIComponent("getbytitle('" + listName + "')"), "", config.httpDeleteConfig);
            });
        }, service;
    } ], provider;
}).provider("restUserService", function() {
    var provider = {}, config = {};
    return provider.doConfig = function(endpointsParam, configParam) {
        endpointsParam, config = configParam;
    }, provider.$get = [ "$http", "$q", "restListService", function($http, $q, restListService) {
        var currentUserPromise, service = {}, getUserByIdPromises = {};
        service.getUserById = function(userId) {
            if (!isNaN(userId)) return getUserByIdPromises[userId.toString()] || (getUserByIdPromises[userId.toString()] = $http.get(config.apiBaseUrl + "web/GetUserById(" + userId + ")", config.httpGetConfig)), 
            getUserByIdPromises[userId.toString()];
            $q.defer().reject({
                status: -1,
                statusText: "Invalid user ID provided"
            });
        }, service.getUsersByGroup = function(groupName) {
            return $http.get(config.apiBaseUrl + "web/SiteGroups/GetByName('" + encodeURIComponent(groupName) + "')/Users", config.httpGetConfig);
        }, service.getAllUsers = function() {
            return $http.get(config.apiBaseUrl + "web/SiteUsers", config.httpGetConfig);
        }, service.getCurrentUser = function() {
            return currentUserPromise || (currentUserPromise = $http.get(config.apiBaseUrl + "web/currentUser", config.httpGetConfig)), 
            currentUserPromise;
        };
        var getSiteUserEffectivePermsPromise, getEffectiveBasePermPromises = {};
        return service.getEffectiveBasePermissions = function(endpoint, listName) {
            return getEffectiveBasePermPromises[endpoint + "_" + listName] || (getEffectiveBasePermPromises[endpoint + "_" + listName] = $http.get(restListService.getListURL(endpoint, listName) + "/EffectiveBasePermissions", config.httpGetConfig)), 
            getEffectiveBasePermPromises[endpoint + "_" + listName];
        }, service.getSiteUserEffectivePermissions = function() {
            return getSiteUserEffectivePermsPromise || (getSiteUserEffectivePermsPromise = service.getCurrentUser().then(function(res) {
                if (!res || !res.data || !res.data.d || void 0 === res.data.d.LoginName) return console.log("WRONG RESPONSE RECEIVED:"), 
                console.log(res), $q.reject({
                    status: -1,
                    statusText: "Retrieved user data is invalid"
                });
                var myUser = res.data.d.LoginName;
                return $http.get(config.apiBaseUrl + "web/GetUserEffectivePermissions(@v)?@v='" + encodeURIComponent(myUser) + "'", config.httpGetConfig);
            })), getSiteUserEffectivePermsPromise;
        }, service;
    } ], provider;
}).provider("restDocumentService", function() {
    var provider = {}, endpoints = {}, endpointsFolders = {}, config = {};
    return provider.doConfig = function(endpointsParam, endpointsFoldersParam, configParam) {
        endpoints = endpointsParam, endpointsFolders = endpointsFoldersParam, config = configParam;
    }, provider.$get = [ "$http", "$q", "gettext", "restBaseService", "restListService", function($http, $q, gettext, restBaseService, restListService) {
        var service = {
            getAllFiles: function(endpoint) {
                return $http.get(config.apiBaseUrl + endpoints[endpoint] + "/items", config.httpGetConfig);
            },
            getFileById: function(endpoint, itemId) {
                return $http.get(config.apiBaseUrl + endpoints[endpoint] + "/getitembyid(" + itemId + ")", config.httpGetConfig);
            },
            getFileByFilename: function(endpoint, fileName) {
                return $http.get(config.apiBaseUrl + endpointsFolders[endpoint] + "/Files%28'" + fileName + "'%29/ListItemAllFields", config.httpGetConfig);
            },
            expandFilePath: function(deferredUri) {
                return $http.get(deferredUri, config.httpGetConfig).then(function(res) {
                    return res.data && res.data.d && res.data.d.ServerRelativeUrl ? [ res.data.d.ServerRelativeUrl, res.data.d.Name ] : $q.reject(gettext("Returned SharePoint result is not in the expected format."));
                });
            },
            addFile: function(endpoint, fileName, metadata, file, overwrite) {
                var deferred = $q.defer(), reader = new FileReader();
                return reader.onloadend = function() {
                    reader.error ? deferred.reject({
                        status: -1,
                        statusText: reader.error.message
                    }) : restBaseService.updateFormDigest(config).then(function() {
                        return $http.post(config.apiBaseUrl + endpointsFolders[endpoint] + "/files/add(overwrite=" + (overwrite ? "true" : "false") + ",url='" + fileName.replace("'", "''") + "')", reader.result, config.httpUploadConfig);
                    }).then(function(res) {
                        metadata ? service.setFileMetadata(endpoint, fileName, metadata).then(deferred.resolve, deferred.reject) : deferred.resolve(res);
                    }, function(restErr) {
                        deferred.reject(restErr);
                    });
                }, reader.readAsArrayBuffer(file), deferred.promise;
            },
            addArrayBufferAsFile: function(endpoint, fileName, metadata, arrayBuffer, overwrite) {
                return restBaseService.updateFormDigest(config).then(function() {
                    return $http.post(config.apiBaseUrl + endpointsFolders[endpoint] + "/files/add(overwrite=" + (overwrite ? "true" : "false") + ",url='" + fileName.replace("'", "''") + "')", arrayBuffer, config.httpUploadConfig);
                }).then(function(res) {
                    return metadata ? service.setFileMetadata(endpoint, fileName, metadata) : res;
                });
            },
            setFileMetadata: function(endpoint, fileName, metadata) {
                return restBaseService.updateFormDigest(config).then(function() {
                    return $http.get(config.apiBaseUrl + endpointsFolders[endpoint] + "/Files%28'" + fileName + "'%29/ListItemAllFields", config.httpGetConfig);
                }).then(function(res) {
                    return res && res.data && res.data.d ? (metadata.__metadata = {
                        type: res.data.d.__metadata.type ? res.data.d.__metadata.type : "SP.Data.DocumentsItem"
                    }, $http.post(config.apiBaseUrl + endpointsFolders[endpoint] + "/Files%28'" + fileName + "'%29/ListItemAllFields", metadata, config.httpPutConfig).then(function() {
                        return res;
                    })) : (console.log("ERROR trying to retrieve file metadata. Unexpected response:"), 
                    console.log(res), $q.reject(gettext("An error occured trying to retrieve file metadata.")));
                });
            },
            deleteFile: function(endpoint, fileName) {
                return restBaseService.updateFormDigest(config).then(function() {
                    return $http.post(config.apiBaseUrl + endpointsFolders[endpoint] + "/Files%28'" + encodeURIComponent(fileName) + "'%29/Recycle", "", config.httpPostConfig);
                });
            },
            getLibraryInfo: function(libraryName) {
                return restListService.getListInfo(void 0, libraryName);
            },
            getLibraryFields: function(libraryName) {
                return restListService.getListFields(void 0, libraryName);
            },
            createLibrary: function(libraryObject) {
                var sharepointList = {
                    __metadata: {
                        type: "SP.List"
                    },
                    Title: libraryObject.Title,
                    Description: libraryObject.Description,
                    AllowContentTypes: !0,
                    BaseTemplate: 101,
                    ContentTypesEnabled: !1,
                    EnableVersioning: !!libraryObject.EnableVersioning
                };
                return restBaseService.updateFormDigest(config).then(function() {
                    return $http.post(config.apiBaseUrl + "web/lists", sharepointList, config.httpPostConfig);
                });
            },
            createLibraryField: function(libraryName, fieldObject) {
                return 3 === fieldObject.FieldTypeKind && (fieldObject.UnlimitedLengthInDocumentLibrary = "true"), 
                restListService.createListField(libraryName, fieldObject);
            },
            deleteLibraryField: function(libraryName, fieldId) {
                return restListService.deleteListField(libraryName, fieldId);
            },
            deleteLibrary: function(libraryName) {
                return restListService.deleteList(libraryName);
            }
        };
        return service;
    } ], provider;
}), angular.module("socialServices", [ "gettext", "restServices", "miscServices", "usersServices", "dashboardScreenServices" ]).run([ "$rootScope", "$location", "interactionService", function($rootScope, $location, interactionService) {
    $rootScope.$on("$locationChangeSuccess", function() {
        var searchObject = $location.search();
        console.log("socialServices captured locationChangeSuccess event!"), console.log(searchObject), 
        "interaction" === searchObject.sidebar && void 0 !== searchObject.targetType && void 0 !== searchObject.targetId && (console.log("Showing the interaction sidebar..."), 
        interactionService.showSidebar(searchObject.targetType, searchObject.targetId, searchObject.targetDescription, void 0, !0, !0, !0, searchObject.sourceUrl));
    });
} ]).service("subscriptionService", [ "$q", "$location", "$templateRequest", "$compile", "$rootScope", "$timeout", "gettext", "gettextCatalog", "restListService", "usersService", "miscServices", function($q, $location, $templateRequest, $compile, $rootScope, $timeout, gettext, gettextCatalog, restListService, usersService, miscServices) {
    var subServ = {}, newsfeedPromises = {}, subscriptionsPromises = {}, subscriptionsByUserPromises = {}, newsObjSelect = "Id,newsTime,userId,sourceType,sourceId,subElement,sourceUrl,subscription/Id,subscription/type,subscription/target,subscription/targetDescription,actionType,contentVariables", newsObjFromREST = function(restObj) {
        return {
            id: restObj.Id,
            newsTime: miscServices.parseDatetime(restObj.newsTime),
            userId: restObj.userId,
            sourceType: restObj.sourceType,
            sourceId: restObj.sourceId,
            subElement: restObj.subElement,
            sourceUrl: restObj.sourceUrl,
            subscriptionId: restObj.subscription.Id,
            subscriptionType: restObj.subscription.type,
            subscriptionTarget: restObj.subscription.target,
            subscriptionTargetDescription: restObj.subscription.targetDescription,
            actionType: restObj.actionType,
            contentVariables: restObj.contentVariables ? JSON.parse(restObj.contentVariables) : {},
            link: {
                description: restObj.Link ? restObj.Link.Description : "",
                url: restObj.Link ? restObj.Link.Url : ""
            }
        };
    }, newsObjTitleFromAction = {
        "new-risk": gettext("New Risk Created"),
        "changed-risk": gettext("Changed Risk"),
        "deleted-risk": gettext("Risk Has Been Removed"),
        "new-impact": gettext("New Impact"),
        "new-note": gettext("New Note"),
        "changed-task-status": gettext("OCA Task Status Has Been Changed"),
        "new-comment": gettext("New Comment"),
        "new-watch": gettext("New Item Being Watched"),
        "new-unwatch": gettext("Item No Longer Being Watched"),
        "new-highlight1": gettext("New Highlight (!)"),
        "new-highlight2": gettext("New Highlight (!!)"),
        "new-highlight3": gettext("New Highlight (!!!)"),
        mention: gettext("You Are Being Mentioned")
    }, subscriptionObjFromREST = function(restObj) {
        return {
            id: restObj.Id,
            userId: restObj.userId,
            type: restObj.type,
            target: restObj.target,
            targetDescription: restObj.targetDescription,
            actionType: "*" === restObj.actionType ? void 0 : restObj.actionType
        };
    };
    subServ.targetObjToString = function(type, targetObj) {
        if ("string" == typeof targetObj || targetObj instanceof String) return targetObj;
        if ("number" == typeof targetObj || targetObj instanceof Number) return targetObj.toString();
        if ("riskCategory" === type) return targetObj.category;
        if ("risk" === type || "task" === type || "auditFormData" === type) return targetObj.id;
        if ("keywords" === type && Array.isArray(targetObj)) {
            var keywordIds = targetObj.map(function(d) {
                return d.id;
            });
            return keywordIds.sort(), "," + keywordIds.join(",") + ",";
        }
        return "interaction" === type ? targetObj.targetType + ":" + targetObj.targetId : void 0;
    }, subServ.triggerSubs = function(type, targetObj, sourceType, sourceId, subElement, sourceUrl, contentVariables, actionType) {
        return console.log("triggerSubs called."), console.log([ type, targetObj, sourceType, sourceId, subElement, sourceUrl, contentVariables, actionType ]), 
        subServ.getSubscriptions(type, targetObj, !0).then(function(subs) {
            var addNewsPromise = $q.resolve(), newsObjs = [];
            return console.log("triggerSubs retrieved matching subscriptions:"), console.log(subs), 
            subs.forEach(function(subscriptionObj) {
                subscriptionObj.actionType && "*" !== subscriptionObj.actionType && subscriptionObj.actionType !== actionType || (addNewsPromise = addNewsPromise.then(function() {
                    return subServ.addNews({
                        userId: subscriptionObj.userId,
                        sourceType: sourceType,
                        sourceId: sourceId,
                        subElement: subElement,
                        sourceUrl: sourceUrl,
                        contentVariables: contentVariables,
                        actionType: actionType,
                        subscriptionId: subscriptionObj.id,
                        subscriptionType: subscriptionObj.type,
                        subscriptionTarget: subscriptionObj.target,
                        subscriptionTargetDescription: subscriptionObj.targetDescription
                    });
                }).then(function(newsObj) {
                    newsObjs.push(newsObj);
                }));
            }), addNewsPromise.then(function() {
                return console.log("triggerSubs added the following news items:"), console.log(newsObjs), 
                newsObjs;
            });
        });
    }, subServ.updateMentions = function(sourceType, sourceId, subElement, sourceUrl, mentionedUserIds, contentVariables) {
        return console.log("updateMentions called."), console.log([ sourceType, sourceId, subElement, sourceUrl, mentionedUserIds, contentVariables ]), 
        subServ.getNewsBySource(sourceType, sourceId, subElement, "mention").then(function(newsObjs) {
            var existingMentions = newsObjs.map(function(d) {
                return d.userId.toString();
            }), toBeAdded = mentionedUserIds.filter(function(userId) {
                return existingMentions.indexOf(userId.toString()) < 0;
            }), newEntries = [], addPromise = $q.resolve();
            return toBeAdded.forEach(function(userId) {
                addPromise = addPromise.then(function() {
                    return subServ.addNews({
                        userId: userId,
                        sourceType: sourceType,
                        sourceId: sourceId,
                        subElement: subElement,
                        sourceUrl: sourceUrl,
                        contentVariables: contentVariables,
                        subscriptionType: "mention",
                        actionType: "mention"
                    });
                }).then(function(res) {
                    newEntries.push(res), newsfeedPromises[res.userId.toString()] = void 0;
                });
            }), addPromise.then(function() {
                return console.log("Created news entries based on at-mentions:"), console.log(newEntries), 
                newEntries;
            });
        });
    }, subServ.supportedSubscriptions = function() {
        return [ "keywords", "riskCategory", "risk", "task", "note", "auditFormData", "interaction" ];
    };
    var endpointsToSubscriptionType = {
        notes: "note",
        risks: "risk",
        impact_flags: "impact",
        task_data: "task",
        audit_forms_data: "auditFormData"
    };
    return subServ.subscriptionTypeForEndpoint = function(endpoint) {
        return endpointsToSubscriptionType[endpoint];
    }, subServ.addNews = function(newsObj) {
        newsObj.newsTime || (newsObj.newsTime = new Date());
        var absoluteUrl = $location.absUrl().split("#")[0];
        return newsObj.link = {
            description: "Newsfeed",
            url: absoluteUrl
        }, console.log("addNews called:"), console.log(newsObj), $templateRequest("common/services/newsfeedDescription.tmpl.html").then(function(templateContent) {
            var scope = $rootScope.$new(!0);
            scope.item = newsObj, scope.absoluteUrl = absoluteUrl;
            var linkedContent = $compile(templateContent)(scope);
            return $timeout(function() {
                return scope.$apply(), linkedContent.html();
            });
        }).then(function(descriptionHtml) {
            newsObj.description = descriptionHtml, newsObj.title = function(newsObj) {
                var title = gettext("New Newsfeed Entry");
                return newsObjTitleFromAction[newsObj.actionType] && (title = newsObjTitleFromAction[newsObj.actionType]), 
                gettextCatalog.getString(title);
            }(newsObj);
            var restObj = function(newsObj) {
                return {
                    userId: newsObj.userId,
                    newsTime: newsObj.newsTime,
                    sourceType: newsObj.sourceType,
                    sourceId: newsObj.sourceId.toString(),
                    subElement: void 0 === newsObj.subElement || null === newsObj.subElement ? null : newsObj.subElement.toString(),
                    sourceUrl: newsObj.sourceUrl,
                    subscriptionId: newsObj.subscriptionId,
                    actionType: newsObj.actionType,
                    contentVariables: JSON.stringify(newsObj.contentVariables),
                    Title: newsObj.title,
                    Description: newsObj.description,
                    Link: {
                        Description: newsObj.link ? newsObj.link.description : "",
                        Url: newsObj.link ? newsObj.link.url : ""
                    }
                };
            }(newsObj);
            return restListService.addItem("newsfeed", restObj);
        }).then(function(res) {
            return res.data && res.data.d && void 0 !== res.data.d.Id ? (newsfeedPromises[newsObj.userId.toString()] = void 0, 
            newsObj.id = res.data.d.Id, newsObj) : (console.log("addNews: An unexpected response was received:"), 
            console.log(res), $q.reject(gettext("An unexpected response was received while trying to add a new newsfeed item.")));
        });
    }, subServ.getNewsBySource = function(sourceType, sourceId, subElement, actionType) {
        return restListService.getMergedFilteredItems("newsfeed", "sourceType eq '" + sourceType + "' and sourceId eq '" + sourceId + "'" + (null != subElement ? " and subElement eq '" + subElement + "'" : "") + (null != actionType ? " and actionType eq '" + actionType + "'" : ""), newsObjSelect, "subscription").then(function(res) {
            return res && res.data && res.data.d && Array.isArray(res.data.d.results) ? res.data.d.results.map(newsObjFromREST) : (console.log("ERROR: Could not getNewsBySource: The response received was not in the expected format:"), 
            console.log(res), $q.reject(gettext("Could not retrieve news items related to this element: The response received was not in the expected format.")));
        });
    }, subServ.removeNewsBySource = function(sourceType, sourceId, subElement) {
        return subServ.getNewsBySource(sourceType, sourceId, subElement).then(function(newsObjs) {
            var deletePromise = $q.resolve();
            return newsObjs.forEach(function(newsObj) {
                deletePromise = deletePromise.then(function() {
                    return subServ.removeNews(newsObj);
                });
            }), deletePromise.then(function() {
                return !0;
            }, function(err) {
                return console.log("ERROR: An error occured while running removeNewsBySource(" + sourceType + ", " + sourceId + "):"), 
                console.log(err), $q.reject(gettext("An error occured while trying to remove news items related to this element."));
            });
        });
    }, subServ.removeNews = function(newsObj) {
        return restListService.deleteItem("newsfeed", newsObj.id).then(function() {
            return !(newsfeedPromises[newsObj.userId.toString()] = void 0);
        });
    }, subServ.getNewsfeed = function(userId, limit, startAfter, collapseDuplicates) {
        return usersService.fillUserId(userId).then(function(_userId) {
            return limit = limit || 30, startAfter = startAfter || -1, newsfeedPromises[(userId = _userId).toString()] && newsfeedPromises[userId.toString()].age > Date.now() - 6e5 && newsfeedPromises[userId.toString()].limit >= limit && newsfeedPromises[userId.toString()].startAfter >= startAfter ? newsfeedPromises[userId.toString()].promise.then(function(newsObjs) {
                return -1 !== startAfter ? newsObjs.filter(function(d) {
                    return d.id < startAfter;
                }).slice(0, limit) : newsObjs.slice(0, limit);
            }) : (newsfeedPromises[userId.toString()] = {
                age: Date.now(),
                limit: limit,
                startAfter: startAfter
            }, newsfeedPromises[userId.toString()].promise = restListService.getFilteredItems("newsfeed", "user eq " + userId.toString() + (-1 !== startAfter ? " and Id lt " + startAfter.toString() : ""), newsObjSelect, "subscription", "newsTime desc", limit).then(function(res) {
                return res && res.data && res.data.d && Array.isArray(res.data.d.results) ? res.data.d.results.map(newsObjFromREST) : (console.log("ERROR: Could not getNewsfeed: The response received was not in the expected format:"), 
                console.log(res), $q.reject(gettext("Could not retrieve the newsfeed items: The response received was not in the expected format.")));
            }, function(err) {
                return console.log("ERROR: Could not getNewsfeed, an error occured:"), console.log(err), 
                $q.reject(gettext("An error occured while trying to retrieve the newsfeed items. Please try again later."));
            }), newsfeedPromises[userId.toString()].promise);
        }).then(function(newsfeedItems) {
            if (collapseDuplicates) {
                for (var sourceHash = {}, collapsedItems = [], i = newsfeedItems.length - 1; 0 <= i; i--) {
                    var hashKey = newsfeedItems[i].sourceType + "::" + newsfeedItems[i].sourceId.toString() + "::" + (newsfeedItems[i].contentVariables && void 0 !== newsfeedItems[i].contentVariables.from ? newsfeedItems[i].contentVariables.from.toString() : "") + "::" + (void 0 === newsfeedItems[i].subElement || null === newsfeedItems[i].subElement ? "" : newsfeedItems[i].subElement);
                    (!sourceHash[hashKey] || sourceHash[hashKey] < newsfeedItems[i].newsTime.getTime() - 36e5) && (sourceHash[hashKey] = newsfeedItems[i].newsTime.getTime(), 
                    collapsedItems.splice(0, 0, newsfeedItems[i]));
                }
                return [ collapsedItems, newsfeedItems.length === limit ];
            }
            return [ newsfeedItems, newsfeedItems.length === limit ];
        });
    }, subServ.addSubscription = function(userId, type, targetObj, targetDescription, actionType) {
        var subscriptionObj = {
            type: type,
            target: subServ.targetObjToString(type, targetObj),
            targetDescription: targetDescription,
            actionType: actionType || "*"
        };
        return console.log("addSubscription called."), console.log([ userId, type, targetObj, targetDescription, actionType ]), 
        console.log("Subscription object to be added:"), console.log(subscriptionObj), usersService.fillUserId(userId).then(function(_userId) {
            return userId = _userId, subscriptionObj.userId = userId, restListService.addItem("subscriptions", function(subscriptionObj) {
                return {
                    userId: subscriptionObj.userId,
                    type: subscriptionObj.type,
                    target: subscriptionObj.target,
                    targetDescription: subscriptionObj.targetDescription,
                    actionType: subscriptionObj.actionType ? subscriptionObj.actionType : "*"
                };
            }(subscriptionObj));
        }).then(function(res) {
            return res.data && res.data.d && void 0 !== res.data.d.Id ? (subscriptionsPromises[type + "::" + subscriptionObj.target + "::true"] = void 0, 
            subscriptionsPromises[type + "::" + subscriptionObj.target + "::false"] = void 0, 
            subscriptionsByUserPromises[subscriptionObj.userId.toString()] = {}, subscriptionObj.id = res.data.d.Id, 
            subscriptionObj) : (console.log("addSubscription: An unexpected response was received:"), 
            console.log(res), $q.reject(gettext("An unexpected response was received while trying to add a new subscription item.")));
        }, function(err) {
            return console.log("addSubscription: An ERROR occured:"), console.log(err), $q.reject(gettext("An error occured while trying to add a new subscription item."));
        });
    }, subServ.removeSubscription = function(subscriptionObj) {
        return restListService.deleteItem("subscriptions", subscriptionObj.id).then(function() {
            return subscriptionsPromises[subscriptionObj.type + "::" + subscriptionObj.target + "::true"] = void 0, 
            subscriptionsPromises[subscriptionObj.type + "::" + subscriptionObj.target + "::false"] = void 0, 
            subscriptionsByUserPromises[subscriptionObj.userId.toString()] = {}, !0;
        }, function(err) {
            return console.log("An ERROR occured while trying to removeSubscription:"), console.log(subscriptionObj), 
            console.log(err), $q.reject(gettext("An error occured while trying to remove your subscription."));
        });
    }, subServ.removeSubscriptionsByTarget = function(type, targetObj, userId) {
        return subServ.getSubscriptions(type, targetObj).then(function(subscriptionObjs) {
            var deletePromise = $q.resolve();
            return null != userId && (subscriptionObjs = subscriptionObjs.filter(function(d) {
                return d.userId.toString() === userId.toString();
            })), subscriptionObjs.forEach(function(d) {
                deletePromise = deletePromise.then(function() {
                    return restListService.deleteItem("subscriptions", d.id).then(function() {
                        subscriptionsPromises[d.type + "::" + d.target + "::true"] = void 0, subscriptionsPromises[d.type + "::" + d.target + "::false"] = void 0, 
                        subscriptionsByUserPromises[d.userId.toString()] = {};
                    });
                });
            }), deletePromise;
        }).then(function() {
            return !0;
        }, function(err) {
            return console.log("removeSubscriptionsByTarget: An ERROR occured:"), console.log(err), 
            $q.reject(gettext("An error occured while trying to remove subscriptions to this element."));
        });
    }, subServ.getSubscriptions = function(type, targetObj, matchOr) {
        var targetString = subServ.targetObjToString(type, targetObj);
        if (console.log("getSubscriptions called."), console.log([ type, targetObj, matchOr ]), 
        console.log("Calculated targetString: " + targetString), matchOr = matchOr && Array.isArray(targetObj), 
        !subscriptionsPromises[type + "::" + targetString + "::" + (matchOr ? "true" : "false")]) if (matchOr) {
            var targetObjMatch = targetObj.map(function(d) {
                return "substringof('" + subServ.targetObjToString(type, [ d ]) + "', target)";
            }).join(" or ");
            subscriptionsPromises[type + "::" + targetString + "::true"] = restListService.getMergedFilteredItems("subscriptions", "type eq '" + type + "' and (" + targetObjMatch + ")").then(function(res) {
                return res && res.data && res.data.d && Array.isArray(res.data.d.results) ? res.data.d.results.map(subscriptionObjFromREST) : (console.log("ERROR: Could not getSubscriptions: The response received was not in the expected format:"), 
                console.log(res), $q.reject(gettext("Could not get the subscriptions for this element: The response received was not in the expected format.")));
            }).then(function(subscriptionObjs) {
                return subscriptionObjs.filter(function(subscriptionObj) {
                    return subscriptionObj.target.split(",").every(function(d) {
                        return "" === d || 0 <= targetString.indexOf("," + d + ",");
                    });
                });
            });
        } else subscriptionsPromises[type + "::" + targetString + "::false"] = restListService.getMergedFilteredItems("subscriptions", "type eq '" + type + "' and target eq '" + targetString + "'").then(function(res) {
            return res && res.data && res.data.d && Array.isArray(res.data.d.results) ? res.data.d.results.map(subscriptionObjFromREST) : (console.log("ERROR: Could not getSubscriptions: The response received was not in the expected format:"), 
            console.log(res), $q.reject(gettext("Could not get the subscriptions for this element: The response received was not in the expected format.")));
        });
        return subscriptionsPromises[type + "::" + targetString + "::" + (matchOr ? "true" : "false")];
    }, subServ.getSubscriptionsByUser = function(userId, type) {
        return null == type && (type = "*"), usersService.fillUserId(userId).then(function(_userId) {
            return subscriptionsByUserPromises[(userId = _userId).toString()] && subscriptionsByUserPromises[userId.toString()][type] || (subscriptionsByUserPromises[userId.toString()] || (subscriptionsByUserPromises[userId.toString()] = {}), 
            subscriptionsByUserPromises[userId.toString()][type] = restListService.getMergedFilteredItems("subscriptions", "user eq " + userId.toString() + ("*" !== type ? " and type eq '" + type + "'" : "")).then(function(res) {
                return res && res.data && res.data.d && Array.isArray(res.data.d.results) ? res.data.d.results.map(subscriptionObjFromREST) : (console.log("ERROR: Could not getSubscriptionsByUser: The response received was not in the expected format:"), 
                console.log(res), $q.reject(gettext("Could not retrieve the subscriptions: The response received was not in the expected format.")));
            }, function(err) {
                return console.log("getSubscriptionsByUser: An ERROR occured:"), console.log(err), 
                $q.reject(gettext("An error occured while trying to retrieve subscriptions for this user."));
            })), subscriptionsByUserPromises[userId.toString()][type];
        });
    }, subServ;
} ]).service("interactionService", [ "$q", "$timeout", "$location", "gettext", "restListService", "usersService", "subscriptionService", "sidebarService", "miscServices", function($q, $timeout, $location, gettext, restListService, usersService, subscriptionService, sidebarService, miscServices) {
    var interServ = {}, interactionsPromises = {}, interactionsByUserPromises = {}, fillSourceUrl = function(url) {
        return null == url ? "#" + $location.url() : "##" === url.substr(0, 2) ? "#" + $location.path() + "#" + url.substr(2) : url;
    }, interactionObjFromREST = function(restObj) {
        var interactionObj = {
            id: restObj.Id,
            interactionTime: miscServices.parseDatetime(restObj.interactionTime),
            userId: restObj.userId,
            targetType: restObj.targetType,
            targetId: restObj.targetId,
            interactionType: restObj.interactionType,
            content: {}
        };
        try {
            restObj.content && (interactionObj.content = JSON.parse(restObj.content));
        } catch (e) {
            console.log("An ERROR occured while trying to parse interactionObj content JSON:"), 
            console.log(e), console.log("We continue with an empty content object.");
        }
        return interactionObj;
    };
    interServ.addInteraction = function(interactionObj, sourceUrl, targetDescription, skipAddWatch) {
        var interactionSummary;
        return sourceUrl = fillSourceUrl(sourceUrl), console.log("addInteraction called."), 
        console.log([ interactionObj, sourceUrl, targetDescription, skipAddWatch ]), usersService.fillUserId(interactionObj.userId).then(function(_userId) {
            return interactionObj.userId = _userId, interactionObj.interactionTime || (interactionObj.interactionTime = new Date()), 
            restListService.addItem("interactions", function(interactionObj) {
                return {
                    interactionTime: interactionObj.interactionTime,
                    userId: interactionObj.userId,
                    targetType: interactionObj.targetType,
                    targetId: interactionObj.targetId.toString(),
                    interactionType: interactionObj.interactionType,
                    content: JSON.stringify(interactionObj.content)
                };
            }(interactionObj));
        }).then(function(res) {
            return res.data && res.data.d && void 0 !== res.data.d.Id ? (interactionsPromises[interactionObj.targetType + "::" + interactionObj.targetId.toString()] = void 0, 
            interactionsByUserPromises[interactionObj.userId.toString() + "::true"] = void 0, 
            interactionsByUserPromises[interactionObj.userId.toString() + "::false"] = void 0, 
            interactionObj.id = res.data.d.Id, interServ.updateInteractionSummary(interactionObj)) : (console.log("addInteraction: An unexpected response was received:"), 
            console.log(res), $q.reject(gettext("An unexpected response was received while trying to add a new interaction item.")));
        }).then(function(_interactionSummary) {
            return interactionSummary = _interactionSummary, subscriptionService.triggerSubs("interaction", {
                targetType: interactionObj.targetType,
                targetId: interactionObj.targetId
            }, interactionObj.targetType, interactionObj.targetId, interactionObj.id, interServ.addSidebarToURL(sourceUrl, interactionObj.targetType, interactionObj.targetId, targetDescription), {
                from: interactionObj.userId,
                interactionObj: interactionObj
            }, "new-" + interactionObj.interactionType);
        }).then(function() {
            if (!0 !== skipAddWatch && (!Array.isArray(interactionSummary.watch) || interactionSummary.watch.indexOf(interactionObj.userId.toString()) < 0)) return interServ.addWatch(interactionObj.userId, interactionObj.targetType, interactionObj.targetId, targetDescription, sourceUrl);
        }).then(function() {
            return interactionListeners.forEach(function(d) {
                void 0 !== d.targetType && null !== d.targetType && d.targetType !== interactionObj.targetType || void 0 !== d.targetId && null !== d.targetId && d.targetId.toString() !== interactionObj.targetId.toString() || d.listener("add", interactionObj);
            }), interactionObj;
        }, function(err) {
            return console.log("An ERROR occured while trying to addInteraction:"), console.log([ interactionObj, sourceUrl, targetDescription, skipAddWatch ]), 
            console.log(err), $q.reject(gettext("An error occured while trying to add a new interaction to this element."));
        });
    };
    var targetTypeToEndpoint = {
        note: "notes",
        risk: "risks",
        task: "task_data",
        auditFormData: "audit_forms_data"
    };
    interServ.getInteractionSummary = function(targetType, targetId) {
        return void 0 === targetTypeToEndpoint[targetType] ? $q.resolve(void 0) : restListService.getItemById(targetTypeToEndpoint[targetType], targetId).then(function(res) {
            if (!res.data || !res.data.d || void 0 === res.data.d.Id) return console.log("getInteractionSummary: An unexpected response was received:"), 
            console.log(res), $q.reject(gettext("An unexpected response was received while trying to retrieve an interaction summary."));
            var interactionSummary;
            try {
                interactionSummary = JSON.parse(res.data.d.interactionSummary);
            } catch (e) {
                console.log("An ERROR occured while trying to parse the interactionSummary JSON, setting it to an empty object:"), 
                console.log(e);
            }
            return null == interactionSummary && (interactionSummary = {}), interactionSummary;
        }, function(err) {
            if (console.log("An ERROR occured while trying to getInteractionSummary(" + targetType + ", " + targetId + "):"), 
            console.log(err), 400 !== err.status || "-2147024809, System.ArgumentException" !== err.data.error.code) return $q.reject(gettext("An error occured while trying to retrieve the interaction list for the target."));
        });
    }, interServ.updateInteractionSummary = function(interactionObj, remove) {
        var _interactionSummary;
        return interServ.getInteractionSummary(interactionObj.targetType, interactionObj.targetId).then(function(interactionSummary) {
            var interactionType = interactionObj.interactionType;
            if ("unwatch" === interactionType && (interactionType = "watch", remove = !remove), 
            null == interactionSummary && (interactionSummary = {}), !0 === remove) {
                if (Array.isArray(interactionSummary[interactionType])) {
                    var elIndex = interactionSummary[interactionType].indexOf(interactionObj.userId.toString());
                    0 <= elIndex && interactionSummary[interactionType].splice(elIndex, 1);
                }
            } else Array.isArray(interactionSummary[interactionType]) ? interactionSummary[interactionType].indexOf(interactionObj.userId.toString()) < 0 && interactionSummary[interactionType].push(interactionObj.userId.toString()) : interactionSummary[interactionType] = [ interactionObj.userId.toString() ];
            return _interactionSummary = interactionSummary, restListService.updateItem(targetTypeToEndpoint[interactionObj.targetType], interactionObj.targetId, {
                interactionSummary: JSON.stringify(interactionSummary)
            });
        }).then(function() {
            return _interactionSummary;
        });
    }, interServ.addWatch = function(userId, targetType, targetId, targetDescription, sourceUrl) {
        sourceUrl = fillSourceUrl(sourceUrl), console.log("addWatch called."), console.log([ userId, targetType, targetId, targetDescription, sourceUrl ]);
        var interactionObj = {
            targetType: targetType,
            targetId: targetId,
            interactionType: "watch",
            content: {}
        };
        return usersService.fillUserId(userId).then(function(_userId) {
            return interactionObj.userId = _userId, interServ.addInteraction(interactionObj, sourceUrl, targetDescription, !0);
        }).then(function(_interactionObj) {
            return interactionObj = _interactionObj, subscriptionService.addSubscription(interactionObj.userId, "interaction", {
                targetType: interactionObj.targetType,
                targetId: interactionObj.targetId
            }, targetDescription);
        }).then(function() {
            if (0 <= subscriptionService.supportedSubscriptions().indexOf(interactionObj.targetType)) return subscriptionService.addSubscription(interactionObj.userId, interactionObj.targetType, interactionObj.targetId, targetDescription);
        }).then(function() {
            return interactionObj;
        });
    }, interServ.addUnwatch = function(userId, targetType, targetId, sourceUrl) {
        sourceUrl = fillSourceUrl(sourceUrl), console.log("addUnwatch called."), console.log([ userId, targetType, targetId, sourceUrl ]);
        var interactionObj = {
            targetType: targetType,
            targetId: targetId,
            interactionType: "unwatch",
            content: {}
        };
        return usersService.fillUserId(userId).then(function(_userId) {
            return interactionObj.userId = _userId, interServ.addInteraction(interactionObj, sourceUrl, void 0, !0);
        }).then(function(_interactionObj) {
            return interactionObj = _interactionObj, subscriptionService.removeSubscriptionsByTarget("interaction", {
                targetType: interactionObj.targetType,
                targetId: interactionObj.targetId
            }, interactionObj.userId);
        }).then(function() {
            if (0 <= subscriptionService.supportedSubscriptions().indexOf(interactionObj.targetType)) return subscriptionService.removeSubscriptionsByTarget(interactionObj.targetType, interactionObj.targetId, interactionObj.userId);
        }).then(function() {
            return interactionObj;
        });
    }, interServ.removeInteraction = function(interactionObj) {
        return console.log("removeInteraction called."), console.log([ interactionObj ]), 
        subscriptionService.removeNewsBySource(interactionObj.targetType, interactionObj.targetId, interactionObj.id).then(function() {
            return restListService.deleteItem("interactions", interactionObj.id);
        }).then(function() {
            return interactionsPromises[interactionObj.targetType + "::" + interactionObj.targetId.toString()] = void 0, 
            interactionsByUserPromises[interactionObj.userId.toString() + "::true"] = void 0, 
            interactionsByUserPromises[interactionObj.userId.toString() + "::false"] = void 0, 
            interactionListeners.forEach(function(d) {
                void 0 !== d.targetType && null !== d.targetType && d.targetType !== interactionObj.targetType || void 0 !== d.targetId && null !== d.targetId && d.targetId.toString() !== interactionObj.targetId.toString() || d.listener("remove", interactionObj);
            }), interServ.updateInteractionSummary(interactionObj, !0);
        }).catch(function(err) {
            return console.log("An ERROR occured while trying to removeInteraction:"), console.log(interactionObj), 
            console.log(err), $q.reject(gettext("An error occured while trying to remove an interaction."));
        });
    }, interServ.removeInteractionsByDetails = function(interaction, userId, targetType, targetId) {
        return interServ.getInteractionsByDetails(interaction, userId, targetType, targetId).then(function(interactionObjs) {
            if (!Array.isArray(interactionObjs) || interactionObjs.length < 1) return !1;
            var deletePromise = $q.resolve();
            return interactionObjs.forEach(function(interactionObj) {
                deletePromise = deletePromise.then(function() {
                    return interServ.removeInteraction(interactionObj);
                });
            }), deletePromise.then(function() {
                return !0;
            });
        });
    }, interServ.removeInteractionsByTarget = function(targetType, targetId) {
        return interServ.getInteractions(targetType, targetId).then(function(interactionObjs) {
            if (!Array.isArray(interactionObjs) || interactionObjs.length < 1) return !1;
            var deletePromise = $q.resolve();
            return interactionObjs.forEach(function(interactionObj) {
                deletePromise = deletePromise.then(function() {
                    return interServ.removeInteraction(interactionObj);
                });
            }), deletePromise.then(function() {
                return !0;
            });
        });
    }, interServ.updateInteraction = function(interactionObj) {
        return restListService.updateItem("interactions", interactionObj.id, interactionObj).then(function() {
            return interactionsPromises[interactionObj.targetType + "::" + interactionObj.targetId.toString()] = void 0, 
            interactionsByUserPromises[interactionObj.userId.toString() + "::true"] = void 0, 
            interactionsByUserPromises[interactionObj.userId.toString() + "::false"] = void 0, 
            interactionObj;
        });
    }, interServ.getInteractions = function(targetType, targetId, sortOldToNew) {
        return interactionsPromises[targetType + "::" + targetId] && interactionsPromises[targetType + "::" + targetId].age > Date.now() - 6e5 || (interactionsPromises[targetType + "::" + targetId] = {
            age: Date.now()
        }, interactionsPromises[targetType + "::" + targetId].promise = restListService.getMergedFilteredItems("interactions", "targetType eq '" + targetType + "' and targetId eq '" + targetId + "'", void 0, void 0, sortOldToNew ? "interactionTime asc" : "interactionTime desc").then(function(res) {
            return res && res.data && res.data.d && Array.isArray(res.data.d.results) ? res.data.d.results.map(interactionObjFromREST) : (console.log("ERROR: Could not getInteractions: The response received was not in the expected format:"), 
            console.log(res), $q.reject(gettext("Could not retrieve interactions related to this element: The response received was not in the expected format.")));
        })), interactionsPromises[targetType + "::" + targetId].promise;
    }, interServ.getInteractionsByDetails = function(interaction, userId, targetType, targetId) {
        return usersService.fillUserId(userId).then(function(_userId) {
            return userId = _userId, restListService.getFilteredItems("interactions", "interactionType eq '" + interaction + "'" + ("*" === userId ? "" : " and user eq " + userId.toString()) + " and targetType eq '" + targetType + "' and targetId eq '" + targetId + "'").then(function(res) {
                return res && res.data && res.data.d && Array.isArray(res.data.d.results) ? res.data.d.results.map(interactionObjFromREST) : (console.log("ERROR: Could not getInteractionsByDetails: The response received was not in the expected format:"), 
                console.log(res), $q.reject(gettext("Could not retrieve interactions for this data combination: The response received was not in the expected format.")));
            });
        });
    };
    var sidebarIsOpen = !(interServ.getInteractionsByUser = function(userId, limit, startAfter, sortOldToNew) {
        return usersService.fillUserId(userId).then(function(_userId) {
            limit = limit || 60, startAfter = startAfter || 0;
            var promiseKey = (userId = _userId).toString() + "::" + (sortOldToNew ? "true" : "false");
            return interactionsByUserPromises[promiseKey] && interactionsByUserPromises[promiseKey].age > Date.now() - 6e5 && interactionsByUserPromises[promiseKey].limit >= limit && (sortOldToNew && interactionsByUserPromises[promiseKey].startAfter <= startAfter || !sortOldToNew && interactionsByUserPromises[promiseKey].startAfter >= startAfter) ? interactionsByUserPromises[promiseKey].promise.then(function(interactionObjs) {
                return interactionObjs.filter(function(d) {
                    return sortOldToNew && d.id > startAfter || !sortOldToNew && d.id < startAfter;
                }).slice(0, limit);
            }) : (interactionsByUserPromises[promiseKey] = {
                age: Date.now(),
                limit: limit,
                startAfter: startAfter
            }, interactionsByUserPromises[promiseKey].promise = restListService.getMergedFilteredItems("interactions", "user eq '" + userId + "'" + (startAfter ? "" : " and Id " + (sortOldToNew ? "Gt" : "Lt") + " " + startAfter.toString()), void 0, void 0, sortOldToNew ? "interactionTime asc" : "interactionTime desc", 0 < limit ? limit : 60).then(function(res) {
                return res && res.data && res.data.d && Array.isArray(res.data.d.results) ? res.data.d.results.map(interactionObjFromREST) : (console.log("ERROR: Could not getInteractionsByUser: The response received was not in the expected format:"), 
                console.log(res), $q.reject(gettext("Could not retrieve interactions of this user: The response received was not in the expected format.")));
            }), interactionsByUserPromises[promiseKey].promise);
        });
    });
    interServ.showSidebar = function(targetType, targetId, targetDescription, limit, sortOldToNew, allowMore, enableNew, sourceUrl) {
        return console.log("showSidebar called."), console.log([ targetType, targetId, targetDescription, limit, sortOldToNew, allowMore, enableNew, sourceUrl ]), 
        sidebarIsOpen && (console.log("We unload the old sidebar first..."), sidebarService.unload()), 
        sidebarIsOpen = !0, $timeout(function() {
            return console.log("Opening sidebar..."), sidebarService.open("common/services/interactionsSidebar.tmpl.html", {
                targetType: targetType,
                targetId: targetId,
                targetDescription: targetDescription,
                limit: limit,
                sortOldToNew: sortOldToNew,
                allowMore: allowMore,
                enableNew: enableNew,
                sourceUrl: sourceUrl,
                closeSidebar: interServ.closeSidebarViaLink
            });
        });
    }, interServ.hideSidebar = function() {
        if (sidebarIsOpen) return sidebarIsOpen = !1, sidebarService.unload();
    }, interServ.openSidebarViaLink = function(targetType, targetId, targetDescription, sourceUrl) {
        var searchObject = $location.search();
        return "interaction" === searchObject.sidebar && searchObject.targetId === targetId.toString() && searchObject.targetType === targetType ? interServ.showSidebar(targetType, targetId, targetDescription, void 0, !0, !0, !0, sourceUrl) : ($location.search("sidebar", "interaction"), 
        $location.search("targetId", targetId), $location.search("targetType", targetType), 
        $location.search("targetDescription", targetDescription), $location.search("sourceUrl", sourceUrl), 
        !0);
    }, interServ.closeSidebarViaLink = function() {
        return $location.search().sidebar ? ($location.search("sidebar", void 0), $location.search("targetId", void 0), 
        $location.search("targetType", void 0), $location.search("targetDescription", void 0), 
        $location.search("sourceUrl", void 0), !0) : interServ.hideSidebar();
    }, interServ.addSidebarToURL = function(url, targetType, targetId, targetDescription, sourceUrl) {
        null == url && (url = "");
        var secondHashIdx = url.indexOf("#", url.indexOf("#") + 1), secondHash = 0 < secondHashIdx ? url.substr(secondHashIdx) : "", queryMatch = url.match(/\?|%3F/), cutOffAt = queryMatch ? queryMatch.index : 0 < secondHashIdx ? secondHashIdx : url.length;
        return console.log("addSidebarToURL called:"), console.log([ url, targetType, targetId, targetDescription, sourceUrl ]), 
        console.log([ secondHashIdx, secondHash, queryMatch, cutOffAt ]), url.substr(0, cutOffAt) + "?sidebar=interaction&targetType=" + encodeURIComponent(targetType) + "&targetId=" + encodeURIComponent(targetId) + "&targetDescription=" + encodeURIComponent(targetDescription) + (sourceUrl ? "&sourceUrl=" + encodeURIComponent(sourceUrl) : "") + secondHash;
    };
    var interactionListeners = [];
    return interServ.registerInteractionListener = function(listener, targetType, targetId) {
        return interactionListeners.push({
            listener: listener,
            targetType: targetType,
            targetId: targetId
        }), !0;
    }, interServ.removeInteractionListener = function(listener) {
        var listenerIdx = interactionListeners.findIndex(function(d) {
            return d.listener === listener;
        });
        return !(listenerIdx < 0) && (interactionListeners.splice(listenerIdx, 1), !0);
    }, interServ;
} ]), angular.module("tasksServices", [ "gettext", "restServices", "auditFormsServices", "miscServices", "usersServices", "socialServices", "configServices", "datafilesServices" ]).filter("taskStatus", [ "gettextCatalog", function(gettextCatalog) {
    return function(input) {
        return input ? gettextCatalog.getString(input) : "";
    };
} ]).service("tasksService", [ "$q", "$http", "gettext", "auditFormsService", "restListService", "restDocumentService", "usersService", "datafileReader", "datafileWriter", "interactionService", "subscriptionService", "miscServices", "configService", function($q, $http, gettext, auditFormsService, restListService, restDocumentService, usersService, datafileReader, datafileWriter, interactionService, subscriptionService, miscServices, configService) {
    var tasksServ = {}, tasksPromise = [ void 0, void 0 ], tasksPromiseWithResults = [ void 0, void 0 ], singleTaskPromise = [ {}, {} ], taskDataPromise = {}, taskResultsPromise = {}, taskDetails = function(task) {
        var formattedTask = {
            id: task.Id,
            title: task.Title,
            description: task.TaskDescription,
            dataDate: miscServices.parseDate(task.DataDate),
            status: task.workflowStatus,
            assigned_to: task.AssignedToId,
            created_at: new Date(task.Created),
            last_modified_at: new Date(task.Modified),
            last_modified_by: task.EditorId,
            workflowChanges: [],
            originalId: task.originalId,
            interactionSummary: {},
            deferred_file_uri: task.File.__deferred.uri
        };
        try {
            formattedTask.dataSpecification = JSON.parse(task.dataSpecification);
        } catch (err) {
            return console.log("ERROR - Invalid task data specification JSON:"), console.log(task.dataSpecification), 
            formattedTask;
        }
        try {
            formattedTask.interactionSummary = JSON.parse(task.interactionSummary);
        } catch (err) {
            console.log("interactionSummary for task could not be parsed. Using empty interactionSummary..."), 
            console.log(task.interactionSummary);
        }
        if (task.workflowChanges) {
            try {
                formattedTask.workflowChanges = JSON.parse(task.workflowChanges);
            } catch (err) {
                return console.log("ERROR - Invalid workflow change history JSON:"), console.log(task.workflowChanges), 
                formattedTask;
            }
            Array.isArray(formattedTask.workflowChanges) && (formattedTask.workflowChanges.forEach(function(workflow) {
                "Done" === workflow.status && (!formattedTask.done_at || formattedTask.done_at < new Date(workflow.change_at)) && (formattedTask.done_at = new Date(workflow.change_at), 
                formattedTask.done_by = workflow.change_by), "Reviewed" === workflow.status && (!formattedTask.reviewed_at || formattedTask.reviewed_at < new Date(workflow.change_at)) && (formattedTask.reviewed_at = new Date(workflow.change_at), 
                formattedTask.reviewed_by = workflow.change_by);
            }), formattedTask.done_at && formattedTask.reviewed_at && formattedTask.done_at > formattedTask.reviewed_at && (formattedTask.reviewed_at = void 0, 
            formattedTask.reviewed_by = void 0));
        }
        return formattedTask;
    }, taskToREST = function(task) {
        return {
            Title: task.title,
            TaskDescription: task.description,
            DataDate: task.dataDate,
            workflowStatus: task.status,
            workflowChanges: JSON.stringify(task.workflowChanges ? task.workflowChanges : []),
            dataSpecification: JSON.stringify(task.dataSpecification ? task.dataSpecification : {}),
            assignedToId: task.assigned_to
        };
    };
    return tasksServ.getTasks = function(fromArchive, resolveResults) {
        var deferred, endpoint = "task_data" + (fromArchive ? "_archive" : ""), results_endpoint = "task_results" + (fromArchive ? "_archive" : ""), relevantPromise = (resolveResults ? tasksPromiseWithResults : tasksPromise)[fromArchive ? 1 : 0];
        return relevantPromise || (deferred = $q.defer(), resolveResults ? tasksPromiseWithResults[fromArchive ? 1 : 0] = deferred.promise : tasksPromise[fromArchive ? 1 : 0] = deferred.promise, 
        restDocumentService.getAllFiles(endpoint).then(function(res) {
            if (!(res && res.data && res.data.d && res.data.d.results && Array.isArray(res.data.d.results))) return $q.reject(gettext("Unexpected response from server."));
            console.log("Received Library data: "), console.log(res.data.d);
            var taskList = [], taskHashList = {};
            return res.data.d.results.forEach(function(d) {
                var thisTask = taskDetails(d);
                taskList.push(thisTask), taskHashList[thisTask.id.toString()] = thisTask;
            }), resolveResults ? restDocumentService.getAllFiles(results_endpoint).then(function(res) {
                return res && res.data && res.data.d && res.data.d.results && Array.isArray(res.data.d.results) ? (console.log("Received results library data: "), 
                console.log(res.data.d), res.data.d.results.forEach(function(d) {
                    taskHashList[d.taskId.toString()] && (taskHashList[d.taskId.toString()].last_modified_at = new Date(d.Modified), 
                    taskHashList[d.taskId.toString()].last_modified_by = d.EditorId);
                }), taskList) : $q.reject(gettext("Unexpected response from server."));
            }) : taskList;
        }).then(function(taskList) {
            deferred.resolve(taskList);
        }, function(err) {
            console.log("Error while obtaining task items:"), console.log(err), deferred.reject(gettext("Error while obtaining task items."));
        }), deferred.promise);
    }, tasksServ.getTask = function(taskId, fromArchive) {
        var fromArchiveBinary = fromArchive ? 1 : 0, endpoint = "task_data" + (fromArchive ? "_archive" : "");
        if (!miscServices.isInt(taskId)) return $q.reject(gettext("Specified task ID is invalid."));
        var taskIdVal = parseInt(taskId);
        return singleTaskPromise[fromArchiveBinary][taskId] || (tasksPromise[fromArchiveBinary ? 1 : 0] ? singleTaskPromise[fromArchiveBinary][taskId] = tasksPromise[fromArchiveBinary ? 1 : 0].then(function(taskList) {
            return taskList.find(function(d) {
                return d.id === taskIdVal;
            });
        }) : singleTaskPromise[fromArchiveBinary][taskId] = restDocumentService.getFileById(endpoint, taskId).then(function(res) {
            return res && res.data && res.data.d ? (console.log("Retrieved task item raw data:"), 
            console.log(res.data.d), taskDetails(res.data.d)) : $q.reject(gettext("The retrieved task item was not in the expected format."));
        })), singleTaskPromise[fromArchiveBinary][taskId];
    }, tasksServ.updateTask = function(task) {
        var restTask = taskToREST(task);
        return restListService.updateItem("task_data", task.id, restTask).then(function() {
            return tasksPromise[0] = void 0, tasksPromiseWithResults[0] = void 0, singleTaskPromise[0][task.id] = void 0, 
            task.last_modified_at = new Date(), usersService.getCurrentUser().then(function(user) {
                return task.last_modified_by = user.id, task;
            });
        }, function(err) {
            return $q.reject(gettext("An error occured updating the task: ") + err);
        });
    }, tasksServ.updateTaskStatus = function(task, newStatus) {
        var currUser, updatedTask;
        return usersService.getCurrentUser().then(function(_currUser) {
            return currUser = _currUser, tasksServ.getWorkflowRule(task.id);
        }).then(function(workflowRule) {
            if ("hard" === workflowRule && "Reviewed" === newStatus) {
                if ("Done" !== task.status && "Reviewed" !== task.status) return $q.reject(gettext('A task can only be reviewed when it is marked as "done".'));
                if (void 0 === task.done_by || currUser.id.toString() === task.done_by.toString()) return $q.reject(gettext('A task cannot be reviewed by the same person who marked it as "done".'));
            }
            var currChangeAt = new Date();
            return task.workflowChanges.push({
                status: newStatus,
                change_at: currChangeAt,
                change_by: currUser.id
            }), "Done" === (task.status = newStatus) ? (task.done_at = currChangeAt, task.done_by = currUser.id) : "Reviewed" !== newStatus && (task.done_at = void 0, 
            task.done_by = void 0), "Reviewed" === newStatus ? (task.reviewed_at = currChangeAt, 
            task.reviewed_by = currUser.id) : (task.reviewed_at = void 0, task.reviewed_by = void 0), 
            tasksServ.updateTask(task);
        }).then(function(_updatedTask) {
            return updatedTask = _updatedTask, subscriptionService.triggerSubs("task", updatedTask.id, "task", updatedTask.id, void 0, "#/tasks/" + updatedTask.id, {
                from: currUser.id,
                new_status: newStatus,
                task: task
            }, "changed-task-status");
        }).then(function() {
            if (task.workflowChanges.findIndex(function(d) {
                return d.change_by.toString() === currUser.id.toString();
            }) === task.workflowChanges.length - 1) return interactionService.addWatch(currUser.id, "task", updatedTask.id, updatedTask.title, "#/tasks/" + updatedTask.id);
        }).then(function() {
            return updatedTask;
        });
    }, tasksServ.archiveTask = function(task) {
        var currUser, newArchivedId, taskFileName;
        return usersService.getCurrentUser().then(function(_currUser) {
            return currUser = _currUser, tasksServ.getWorkflowRule(task.id);
        }).then(function(_workflowRule) {
            return "hard" === _workflowRule && "Reviewed" !== task.status ? $q.reject(gettext("Only reviewed tasks can be archived.")) : (task.status = "Archived", 
            task.workflowChanges.push({
                status: "Archived",
                change_at: new Date(),
                change_by: currUser.id
            }), restDocumentService.expandFilePath(task.deferred_file_uri));
        }).then(function(path) {
            return taskFileName = path[1], $http.get(path[0], {
                responseType: "arraybuffer"
            });
        }).then(function(res) {
            if (!res.data) return console.log("ERROR: No data retrieved while retrieving the original task data:"), 
            console.log(res), $q.reject(gettext("An error occured while trying to retrieve the original task data."));
            var newTask = taskToREST(task);
            return newTask.originalId = task.id, restDocumentService.addArrayBufferAsFile("task_data_archive", new Date().toISOString().replace(/[^0-9TZ\-]/g, "-") + "_" + taskFileName, newTask, res.data, !1);
        }).then(function(addResult) {
            return newArchivedId = addResult.data.d.Id, restDocumentService.deleteFile("task_data", taskFileName);
        }).then(function() {
            return tasksServ.archiveTaskResults(task, newArchivedId);
        }).then(function() {
            return auditFormsService.archiveFormData(task.id, newArchivedId);
        });
    }, tasksServ.archiveTaskResults = function(oldTask, newArchivedId) {
        return restDocumentService.getFileByFilename("task_results", "task_" + oldTask.id + ".csv").then(function(res) {
            return res && res.data && res.data.d && res.data.d.File && res.data.d.File.__deferred && res.data.d.File.__deferred.uri ? restDocumentService.expandFilePath(res.data.d.File.__deferred.uri).then(function(path) {
                return $http.get(path[0], {
                    responseType: "arraybuffer"
                });
            }).then(function(res) {
                return res.data ? restDocumentService.addArrayBufferAsFile("task_results_archive", "task_" + newArchivedId + ".csv", {
                    taskId: newArchivedId
                }, res.data, !1) : (console.log("ERROR: No data retrieved while retrieving the original task results:"), 
                console.log(res), $q.reject(gettext("An error occured while trying to retrieve the original task results.")));
            }).then(function() {
                return restDocumentService.deleteFile("task_results", "task_" + oldTask.id + ".csv");
            }) : (console.log("ERROR: While trying to load the task results the data returned was not in the expected format:"), 
            console.log(res), $q.reject(gettext("While trying to load the task results the data returned was not in the expected format!")));
        }, function(err) {
            return 404 === err.status ? oldTask : (console.log("ERROR: An unexpected error occured while trying to load task results:"), 
            console.log(err), $q.reject(gettext("An error occured while trying to load task results.")));
        });
    }, tasksServ.getTaskData = function(task) {
        return task && task.deferred_file_uri ? (taskDataPromise[task.deferred_file_uri] || (taskDataPromise[task.deferred_file_uri] = restDocumentService.expandFilePath(task.deferred_file_uri).then(function(path) {
            return datafileReader.readFormattedFile(path[0], task.dataSpecification.dataFileFormat);
        }).then(function(readerResult) {
            return readerResult[0];
        })), taskDataPromise[task.deferred_file_uri]) : $q.reject(gettext("The task does not contain a deferred file retrieval URI."));
    }, tasksServ.getWorkflowRule = function(taskId) {
        return configService.getConfiguration().then(function(config) {
            var workflowExceptions;
            try {
                workflowExceptions = JSON.parse(config["Workflow Exceptions"]);
            } catch (e) {
                console.log("ERROR: An error occured while trying to parse workflowExceptions:"), 
                console.log(e), workflowExceptions = {};
            }
            return void 0 !== workflowExceptions["tasks/" + taskId.toString()] ? workflowExceptions["tasks/" + taskId.toString()] : void 0 !== config["Workflow Mode"] ? config["Workflow Mode"] : "soft";
        });
    }, tasksServ.saveResults = function(task, taskData) {
        var csvLines = [], keyColumns = task.dataSpecification.dataFileFormat.columns.filter(function(col) {
            return col.isKey;
        });
        csvLines.push('"' + keyColumns.map(function(col) {
            return col.source.replace(/"/g, '""');
        }).join('","') + '","result"\n'), taskData.forEach(function(d) {
            void 0 !== d.result && null !== d.result && "" !== d.result && csvLines.push(keyColumns.map(function(col) {
                return "text" === col.format ? '"' + d[col.display].replace(/"/g, '""') + '"' : d[col.display];
            }).join(",") + ',"' + d.result + '"\n');
        });
        var csvBlob = new Blob(csvLines, {
            type: "text/csv"
        });
        return restDocumentService.addFile("task_results", "task_" + task.id + ".csv", {
            taskId: task.id
        }, csvBlob, !0).then(function() {
            taskResultsPromise["live_" + task.id] = void 0, tasksPromiseWithResults[0] = void 0;
        });
    }, tasksServ.mergeResults = function(columnDef, taskData, resultData, resultsColumn) {
        void 0 === resultsColumn && (resultsColumn = "result");
        var keyColumns = columnDef.filter(function(col) {
            return col.isKey;
        }), makeHash = function(d) {
            return keyColumns.map(function(col) {
                return d[col.display];
            }).join(":::");
        }, keyHashes = {};
        return taskData.forEach(function(d) {
            (keyHashes[makeHash(d)] = d).result = void 0;
        }), resultData.forEach(function(row) {
            var thisElement = keyHashes[makeHash(row)];
            thisElement && (thisElement.result = row[resultsColumn]);
        }), taskData;
    }, tasksServ.compressTask = function(columnDef, mergedTaskData, compressColumns, compressResults, resultsColumn) {
        void 0 === resultsColumn && (resultsColumn = "result");
        var newColumnDef = columnDef.filter(function(col) {
            return !compressColumns || -1 !== compressColumns.indexOf(col.display);
        });
        compressColumns && -1 === compressColumns.indexOf(resultsColumn) || newColumnDef.push({
            source: resultsColumn,
            display: resultsColumn,
            keyword: resultsColumn.replace(/[^a-zA-Z0-9]/g, "_"),
            format: "text",
            isKey: !1
        });
        var newTaskData = [];
        return mergedTaskData.forEach(function(d) {
            if (!compressResults || -1 !== compressResults.indexOf(d[resultsColumn])) {
                var newD = {};
                Object.keys(d).forEach(function(col) {
                    compressColumns && -1 === compressColumns.indexOf(col) || (newD[col] = d[col]);
                }), newTaskData.push(newD);
            }
        }), [ newColumnDef, newTaskData ];
    }, tasksServ.newTask = function(task, taskData, fileName, overwrite) {
        overwrite = !!overwrite;
        var restTask = taskToREST(task), csvString = datafileWriter.formatFile(taskData, task.dataSpecification.dataFileFormat);
        return restDocumentService.addArrayBufferAsFile("task_data", fileName, restTask, csvString, overwrite).then(function(res) {
            return res.data && res.data.d ? (task.id = res.data.d.Id, task) : (console.log("An unexpected response was received while trying to write the OCA task to the library:"), 
            console.log(res), $q.reject(gettext("An unexpected response was received while trying to write the OCA task to the library.")));
        });
    }, tasksServ.loadResults = function(task, isArchived, taskData) {
        var cacheKey = (isArchived ? "archive_" : "live_") + task.id;
        if (taskResultsPromise[cacheKey]) return taskResultsPromise[cacheKey];
        var endpoint = isArchived ? "task_results_archive" : "task_results", dataFileFormat = {
            separator: ",",
            columns: task.dataSpecification.dataFileFormat.columns.filter(function(col) {
                return col.isKey;
            }).slice(0)
        };
        return dataFileFormat.columns.push({
            source: "result",
            display: "result",
            keyword: "result",
            format: "text",
            isKey: !1
        }), taskResultsPromise[cacheKey] = restDocumentService.getFileByFilename(endpoint, "task_" + task.id + ".csv").then(function(res) {
            return res && res.data && res.data.d && res.data.d.File && res.data.d.File.__deferred && res.data.d.File.__deferred.uri ? restDocumentService.expandFilePath(res.data.d.File.__deferred.uri).then(function(path) {
                return datafileReader.readFormattedFile(path[0], dataFileFormat, !0);
            }).then(function(readerResult) {
                return tasksServ.mergeResults(dataFileFormat.columns, taskData, readerResult[0]);
            }) : (console.log("ERROR: While trying to load the task results the data returned was not in the expected format:"), 
            console.log(res), $q.reject(gettext("While trying to load the task results the data returned was not in the expected format!")));
        }, function(err) {
            return 404 === err.status ? taskData : (console.log("ERROR: An unexpected error occured while trying to load task results:"), 
            console.log(err), $q.reject(gettext("An error occured while trying to load task results.")));
        }), taskResultsPromise[cacheKey];
    }, tasksServ.hasArchivePermissions = function() {
        return usersService.hasRights("task_data_archive");
    }, tasksServ;
} ]), angular.module("usersServices", [ "gettext", "restServices", "configServices" ]).filter("initials", function() {
    return function(input) {
        if (void 0 === input || "" === input) return "";
        if (!angular.isString(input)) return input.toString();
        var initials = "", lastFirstName = input.split(", ");
        return lastFirstName.length < 2 ? input.split(" ").forEach(function(word) {
            1 <= word.length && (initials += word[0].toUpperCase());
        }) : (lastFirstName[1].split(" ").forEach(function(word) {
            1 <= word.length && (initials += word[0].toUpperCase());
        }), initials += lastFirstName[0][0].toUpperCase()), initials;
    };
}).filter("userIdToName", [ "usersService", function(usersService) {
    var userIdToNameCache = {}, userIdToNameFilter = function(input) {
        return isNaN(input) ? input : (void 0 === userIdToNameCache[input] && (userIdToNameCache[input] = input, 
        usersService.getUserById(input).then(function(user) {
            userIdToNameCache[input] = user.name;
        })), userIdToNameCache[input]);
    };
    return userIdToNameFilter.$stateful = !0, userIdToNameFilter;
} ]).filter("userIdToInitials", [ "$filter", function($filter) {
    var userIdToInitialsFilter = function(input) {
        return $filter("initials")($filter("userIdToName")(input));
    };
    return userIdToInitialsFilter.$stateful = !0, userIdToInitialsFilter;
} ]).factory("usersService", [ "$q", "gettext", "restUserService", "restListService", "configService", function($q, gettext, restUserService, restListService, configService) {
    var currentUserPromise, usersServ = {}, usersPromises = {}, isAdminPromises = {}, isSiteAdminPromises = {}, userSettingsPromises = {}, hasRightsPromises = {}, userSettingsElements = [ "language", "watchNewNote" ];
    usersServ.getUserById = function(userId) {
        var deferred;
        return isNaN(userId) ? ((deferred = $q.defer()).reject(gettext("An error occurred while loading user data: Provided userId is invalid.")), 
        deferred.promise) : (usersPromises[userId] || (deferred = $q.defer(), usersPromises[userId] = deferred.promise, 
        restUserService.getUserById(userId).then(function(res) {
            res && res.data && res.data.d && res.data.d.Title || deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected.")), 
            deferred.resolve({
                id: res.data.d.Id,
                name: res.data.d.Title,
                login: res.data.d.LoginName,
                email: res.data.d.Email
            });
        }, function(restErr) {
            deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        })), usersPromises[userId]);
    };
    var getUsersByGroupPromises = {};
    return usersServ.getUsersByGroup = function(groupName) {
        return getUsersByGroupPromises[groupName = null != groupName && "" !== groupName ? groupName : "__all__"] || (usersRawPromise = "__all__" === groupName ? restUserService.getAllUsers() : restUserService.getUsersByGroup(groupName), 
        getUsersByGroupPromises[groupName] = usersRawPromise.then(function(res) {
            return res && res.data && res.data.d && Array.isArray(res.data.d.results) ? res.data.d.results.map(function(d) {
                return {
                    id: d.Id,
                    login: d.LoginName,
                    name: d.Title,
                    email: d.Email
                };
            }) : (console.log("An ERROR occured while getUsersByGroup. The obtained data is not in the expected format:"), 
            console.log(res), $q.reject(gettext("An error occured while trying to get group members: The returned data is not formatted as expect.")));
        }, function(err) {
            return console.log("An ERROR was returned by the REST query for getUsersByGroup(" + groupName + "):"), 
            console.log(err), $q.reject(gettext("An error occured while trying to retrieve group members. Please try again."));
        })), getUsersByGroupPromises[groupName];
        var usersRawPromise;
    }, usersServ.getCurrentUser = function() {
        var deferred;
        return void 0 !== currentUserPromise || (deferred = $q.defer(), currentUserPromise = deferred.promise, 
        restUserService.getCurrentUser().then(function(res) {
            res && res.data && res.data.d && res.data.d.Title || deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected.")), 
            deferred.resolve({
                id: res.data.d.Id,
                name: res.data.d.Title,
                login: res.data.d.LoginName,
                email: res.data.d.Email
            });
        }, function(restErr) {
            deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        })), currentUserPromise;
    }, usersServ.getUserSettings = function(userId) {
        var deferred;
        return isNaN(userId) ? ((deferred = $q.defer()).reject(gettext("An error occurred while loading user settings: Provided userId is invalid.")), 
        deferred.promise) : (userSettingsPromises[userId] || (deferred = $q.defer(), userSettingsPromises[userId] = deferred.promise, 
        restListService.getFilteredItems("user_settings", "userId eq " + userId).then(function(res) {
            console.log("We received user settings:"), console.log(res), res && res.data && res.data.d && Array.isArray(res.data.d.results) || deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected.")), 
            1 !== res.data.d.results.length && deferred.resolve({}), deferred.resolve(res.data.d.results[0]);
        }, function(restErr) {
            console.log("Error receiving user settings:"), console.log(restErr), deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        })), userSettingsPromises[userId]);
    }, usersServ.getCurrentUserSettings = function() {
        return usersServ.getCurrentUser().then(function(userData) {
            return usersServ.getUserSettings(userData.id);
        });
    }, usersServ.fillUserId = function(_userId) {
        return null != _userId ? $q.resolve(_userId) : usersServ.getCurrentUser().then(function(user) {
            return user.id;
        });
    }, usersServ.getUserLanguage = function() {
        var defaultLanguage = "en", availableLanguages = {
            en: "English",
            de: "German (Swiss)"
        };
        return configService.getConfiguration().then(function(config) {
            return config["Available Languages"] && (availableLanguages = JSON.parse(config["Available Languages"])), 
            config["Default Language"] && availableLanguages[config["Default Language"]] && (defaultLanguage = config["Default Language"]), 
            usersServ.getCurrentUserSettings();
        }).then(function(userSettings) {
            return userSettings.language && void 0 !== availableLanguages[userSettings.language] ? userSettings.language : defaultLanguage;
        });
    }, usersServ.saveUserSettings = function(settings) {
        return console.log("saveUserSettings called:"), console.log(settings), settings.Id && !settings.userIdId ? $q.reject(gettext("An existing settings object needs to have a valid userId.")) : (settings.userIdId ? $q.resolve() : usersServ.getCurrentUser().then(function(currUser) {
            settings.userIdId = currUser.id;
        })).then(function() {
            var newSettingsObject = {
                userIdId: settings.userIdId
            };
            return userSettingsElements.forEach(function(k) {
                newSettingsObject[k] = settings[k];
            }), settings.Id ? (newSettingsObject.Id = settings.Id, restListService.updateItem("user_settings", settings.Id, newSettingsObject).then(function() {
                return newSettingsObject;
            }, function(restErr) {
                return console.log("An error occured: " + restErr.status + ", " + restErr.statusText), 
                $q.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
            })) : restListService.addItem("user_settings", newSettingsObject).then(function(res) {
                return res.data.d;
            }, function(restErr) {
                return console.log("An error occured: " + restErr.status + ", " + restErr.statusText), 
                $q.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
            });
        });
    }, usersServ.isAdmin = function(highRights, lowRights) {
        var deferred;
        return void 0 === highRights && (highRights = 0), void 0 === lowRights && (lowRights = 4), 
        isAdminPromises[highRights + "_" + lowRights] || (deferred = $q.defer(), isAdminPromises[highRights + "_" + lowRights] = deferred.promise, 
        restUserService.getEffectiveBasePermissions(void 0, "Dashboard - Configuration").then(function(res) {
            res && res.data && res.data.d && res.data.d.EffectiveBasePermissions && void 0 !== res.data.d.EffectiveBasePermissions.Low || deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected.")), 
            deferred.resolve((res.data.d.EffectiveBasePermissions.Low & lowRights) === lowRights && (res.data.d.EffectiveBasePermissions.High & highRights) === highRights);
        }, function(restErr) {
            deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        })), isAdminPromises[highRights + "_" + lowRights];
    }, usersServ.isSiteAdmin = function(highRights, lowRights) {
        var deferred;
        return void 0 === highRights && (highRights = 0), void 0 === lowRights && (lowRights = 1073741824), 
        isSiteAdminPromises[highRights + "_" + lowRights] || (deferred = $q.defer(), isSiteAdminPromises[highRights + "_" + lowRights] = deferred.promise, 
        restUserService.getSiteUserEffectivePermissions().then(function(res) {
            res && res.data && res.data.d && res.data.d.GetUserEffectivePermissions && void 0 !== res.data.d.GetUserEffectivePermissions.Low || deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected.")), 
            deferred.resolve((res.data.d.GetUserEffectivePermissions.Low & lowRights) === lowRights && (res.data.d.GetUserEffectivePermissions.High & highRights) === highRights);
        }, function(restErr) {
            deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        })), isSiteAdminPromises[highRights + "_" + lowRights];
    }, usersServ.hasRights = function(endpoint, listName, highRights, lowRights) {
        var deferred;
        void 0 === highRights && (highRights = 0), void 0 === lowRights && (lowRights = 4);
        var promiseKey = (endpoint ? "_" + endpoint : listName) + "_" + highRights + "_" + lowRights;
        return hasRightsPromises[promiseKey] || (deferred = $q.defer(), hasRightsPromises[promiseKey] = deferred.promise, 
        restUserService.getEffectiveBasePermissions(endpoint, listName).then(function(res) {
            res && res.data && res.data.d && res.data.d.EffectiveBasePermissions && void 0 !== res.data.d.EffectiveBasePermissions.Low || deferred.reject(gettext("An error occurred: The obtained data object is not formatted as expected.")), 
            deferred.resolve((res.data.d.EffectiveBasePermissions.Low & lowRights) === lowRights && (res.data.d.EffectiveBasePermissions.High & highRights) === highRights);
        }, function(restErr) {
            deferred.reject(gettext("An error occurred:") + " " + gettext("Status code") + " " + restErr.status + ", " + restErr.statusText);
        })), hasRightsPromises[promiseKey];
    }, usersServ;
} ]), angular.module("auditFormsDirectives", [ "gettext", "ngDialog", "auditFormsServices", "tasksServices", "miscServices", "usersServices", "socialServices", "datafilesServices" ]).directive("auditForm", [ "$timeout", "gettext", "ngDialog", "auditFormsService", "tasksService", "usersService", "interactionService", "miscServices", "datafileReader", function($timeout, gettext, ngDialog, auditFormsService, tasksService, usersService, interactionService, miscServices, datafileReader) {
    return {
        restrict: "E",
        scope: {
            auditFormKey: "=",
            auditFormData: "=",
            readOnly: "=?",
            workflowRule: "=?",
            onChange: "=?",
            onDelete: "=?",
            autoSave: "=?",
            closeCallback: "=?"
        },
        link: function(scope) {
            scope.errMessage = void 0, scope.isSaving = !1, scope.isLoading = !1, scope.isLoadingAdditionalData = !1, 
            scope.auditForm = void 0, scope.additionalSourceSelect = void 0, scope.auditFormForm = {}, 
            scope.auditFormData.sourceData || (scope.auditFormData.sourceData = {}), scope.auditFormData.resultsData || (scope.auditFormData.resultsData = {}), 
            scope.sourceData = scope.auditFormData.sourceData, scope.resultsData = scope.auditFormData.resultsData, 
            scope.auditFormData._oldResult = scope.auditFormData.result, auditFormsService.getAuditForm(scope.auditFormKey).then(function(auditForm) {
                scope.auditForm = auditForm, scope.isLoading = !1, Array.isArray(scope.auditForm.additionalSources) && 1 <= scope.auditForm.additionalSources.length && (scope.additionalSourceSelect = scope.auditForm.additionalSources[0].datafile), 
                Array.isArray(scope.auditForm.tabs) && 1 <= scope.auditForm.tabs.length && (scope.tab = scope.auditForm.tabs[0].tabId), 
                console.log("Initialized auditForm and additionalSourceSelect:"), console.log([ scope.auditForm, scope.additionalSourceSelect ]), 
                console.log('Results expression "' + scope.auditForm.resultExpression + '" evaluates to "' + scope.$eval(scope.auditForm.resultExpression) + '"!'), 
                scope.$watch(scope.auditForm.resultExpression, function(newVal, oldVal) {
                    console.log("Value of results expression has changed: " + oldVal + " -> " + newVal), 
                    scope.auditFormData.result = newVal;
                });
            }), scope.taskData = {}, scope.auditFormData && void 0 !== scope.auditFormData.createdInTask && (scope.archivedTask = scope.auditFormData.archivedTask, 
            tasksService.getTask(scope.auditFormData.createdInTask, scope.auditFormData.archivedTask).then(function(taskData) {
                scope.taskData = taskData;
            })), scope.saveData = function() {
                console.log("saveData called, saving auditFormData..."), console.log(scope.auditFormData), 
                console.log('Results expression "' + scope.auditForm.resultExpression + '" evaluates to "' + scope.$eval(scope.auditForm.resultExpression) + '"!'), 
                scope.isSaving = !0, scope.hasSaved = !1;
                var isNewForm = void 0 === scope.auditFormData.id || null === scope.auditFormData.id;
                return auditFormsService.saveFormData(scope.auditFormData).then(function(newFormData) {
                    isNewForm && usersService.getCurrentUser().then(function(user) {
                        return scope.auditFormData.interactionSummary || (scope.auditFormData.interactionSummary = {}), 
                        scope.auditFormData.interactionSummary.watch = [ user.id.toString() ], interactionService.addWatch(user.id, "auditFormData", newFormData.id, scope.auditForm.title + " (" + scope.auditFormData.result + ")", "##" + newFormData.id);
                    }), scope.auditFormData.id = newFormData.id, scope.auditFormData.created_at = newFormData.created_at, 
                    scope.auditFormData.last_modified_at = newFormData.last_modified_at, scope.auditFormData.last_modified_by = newFormData.last_modified_by, 
                    scope.isSaving = !1, scope.hasSaved = !0, console.log("Saving audit form content..."), 
                    console.log(scope.auditFormForm), scope.auditFormForm.form && scope.auditFormForm.form.$setPristine(), 
                    scope.onChange && scope.auditFormData._oldResult !== scope.auditFormData.result && (console.log("Calling onChange callback: "), 
                    console.log([ scope.onChange, scope.auditFormData ]), scope.onChange(scope.auditFormData)), 
                    scope.auditFormData._oldResult = scope.auditFormData.result;
                }, function(err) {
                    console.log("An ERROR occured while trying to save form data:" + err), console.log(scope.auditFormData), 
                    scope.errMessage = err, scope.isSaving = !1;
                });
            };
            var autoSaveFunction = function() {
                console.log("Auto-save timeout..."), console.log([ scope, scope.autoSave, scope.auditFormForm ]), 
                scope.autoSave && !scope.readOnly && (!scope.isSaving && scope.auditFormForm.form && !scope.auditFormForm.form.$pristine && scope.auditFormForm.form.$valid && (console.log("Auto-saving audit form data (form has changed, is valid and autoSave is enabled)..."), 
                scope.saveData()), $timeout(autoSaveFunction, 1e4));
            };
            $timeout(autoSaveFunction, 1e4), scope.saveAndClose = function() {
                return scope.closeCallback ? scope.saveData().then(scope.closeCallback) : scope.saveData();
            }, scope.changeTab = function(tabId) {
                scope.tab = tabId;
            }, scope.showTabHelp = function(helpTitle, helpText, stopPropEvent) {
                stopPropEvent && stopPropEvent.stopPropagation(), ngDialog.open({
                    template: "common/directives/auditFormsHelpDialog.tmpl.html",
                    className: "ngdialog-theme-default",
                    data: {
                        helpTitle: helpTitle,
                        helpText: helpText
                    }
                });
            }, scope.changeWorkflowStatus = function(newStatus) {
                scope.auditFormData.id ? (scope.isSaving = !0, auditFormsService.updateWorkflowStatus(scope.auditFormData, newStatus).then(function() {
                    scope.isSaving = !1;
                }, function(err) {
                    console.log("ERROR while trying to changeWorkflowStatus for ID " + scope.auditFormData.id + " to " + scope.newStatus + ":"), 
                    console.log(err), miscServices.translatedAlert(gettext("An error occured while trying to update the workflow status. Please try again later.")), 
                    scope.isSaving = !1;
                })) : miscServices.translatedAlert(gettext("Please save your audit form first before you try to update the workflow status."));
            }, scope.showWorkflow = function() {
                ngDialog.open({
                    template: "common/directives/auditFormsDetailsDialog.tmpl.html",
                    className: "ngdialog-theme-default",
                    data: {
                        auditForm: scope.auditForm,
                        auditFormData: scope.auditFormData,
                        changeWorkflowStatus: scope.changeWorkflowStatus
                    }
                });
            }, scope.loadAdditionalSource = function() {
                if (miscServices.translatedConfirm(gettext("Do you really want to load additional data into this audit form?\n\nNOTE: Data loaded will overwrite existing values in the form."))) {
                    var dataSourceDatafile = 1 === scope.auditForm.additionalSources.length ? scope.auditForm.additionalSources[0].datafile : scope.additionalSourceSelect, dataSource = scope.auditForm.additionalSources.find(function(source) {
                        return source.datafile === dataSourceDatafile;
                    });
                    if (void 0 !== dataSource) return scope.isLoadingAdditionalData = !0, datafileReader.readDatafile(dataSource.datafile).then(function(datafile) {
                        console.log('loadAdditionalSource: We have retrieved the requested datafile "' + dataSourceDatafile + '":'), 
                        console.log([ dataSource, datafile, scope.sourceData ]);
                        var datum = datafile[0].find(function(d) {
                            return dataSource.keyMap.every(function(keyCol) {
                                return d[keyCol.from] === scope.sourceData[keyCol.to];
                            });
                        });
                        if (void 0 === datum) return console.log("loadAdditionalSource: We could not find a matching data element!"), 
                        console.log([ datafile, scope.sourceData, dataSource.keyMap ]), miscServices.translatedAlert(gettext("We could not find a matching entry in the data source for this audit form. Nothing has been loaded.")), 
                        void (scope.isLoadingAdditionalData = !1);
                        dataSource.dataMap.forEach(function(map) {
                            scope.resultsData[map.to] = datum[map.from];
                        }), miscServices.translatedAlert(gettext("The source data has successfully been loaded.")), 
                        scope.isLoadingAdditionalData = !1;
                    });
                    miscServices.translatedAlert(gettext("Please select the source which you want to load."));
                }
            }, scope.deleteForm = function() {
                if (miscServices.translatedConfirm(gettext("Do you really want to delete this audit form?\n\nThis action cannot be undone."))) {
                    if (scope.isSaving = !0, void 0 === scope.auditFormData.id) return scope.onDelete && scope.onDelete(scope.auditFormData), 
                    void (scope.isSaving = !1);
                    auditFormsService.deleteFormData(scope.auditFormData.id).then(function() {
                        scope.onDelete && scope.onDelete(scope.auditFormData), scope.isSaving = !1;
                    }, function() {
                        miscServices.translatedAlert(gettext("An error occured while trying to delete this audit form.")), 
                        scope.isSaving = !1;
                    });
                }
            };
        },
        templateUrl: "common/directives/auditForm.tmpl.html"
    };
} ]).directive("auditFormIcons", [ "gettext", "ngDialog", "auditFormsService", "usersService", function(gettext, ngDialog, auditFormsService, usersService) {
    return {
        restrict: "E",
        scope: {
            auditFormData: "=",
            editLink: "=?",
            workflowRule: "=",
            newFormTypes: "=?",
            onNew: "=?",
            onChange: "=?",
            onChangeObject: "=?",
            onDelete: "=?",
            autoSave: "=?",
            keywords: "=?",
            sourceTaskId: "=?",
            sourceTaskArchived: "=?",
            sourceElement: "=?",
            sourceData: "=?"
        },
        link: function(scope) {
            var onChangeWrapper;
            scope.isSaving = !1, scope.isLoading = !1, scope.sourceTaskArchived = !!scope.sourceTaskArchived, 
            scope.auditForms = {}, scope.newForm = {}, scope.isLoading = !0, auditFormsService.getAllForms().then(function(forms) {
                scope.auditForms = forms, scope.isLoading = !1;
            }, function(err) {
                console.log("An ERROR occured loading auditFormIcons forms:"), console.log(err);
            }), scope.onChange && (onChangeWrapper = function(singleFormData) {
                var allForms = 0 <= scope.auditFormData.indexOf(singleFormData) ? scope.auditFormData : scope.auditFormData.concat([ singleFormData ]);
                return scope.onChange(singleFormData, allForms, scope.onChangeObject);
            });
            var formsPicker, onDeleteWrapper = function(deletedAuditFormData) {
                scope.onDelete && scope.onDelete(deletedAuditFormData), ngDialog.close();
            };
            scope.openAuditForm = function(auditForm) {
                ngDialog.open({
                    template: "common/directives/auditFormsFormDialog.tmpl.html",
                    className: "ngdialog-theme-default",
                    data: {
                        auditFormData: auditForm,
                        readOnly: !scope.editLink || !(scope.sourceTaskId && scope.sourceElement && auditForm.createdInTask.toString() === scope.sourceTaskId.toString() && auditForm.archivedTask.toString() === scope.sourceTaskArchived.toString() && auditForm.createdInElement.toString() === scope.sourceElement.toString()),
                        workflowRule: scope.workflowRule,
                        onChange: onChangeWrapper,
                        onDelete: onDeleteWrapper,
                        autoSave: scope.autoSave
                    }
                });
            };
            var newAuditFormOfType = function(formType) {
                usersService.getCurrentUser().then(function(currUser) {
                    scope.newForm = {
                        auditForm: formType,
                        sourceData: scope.sourceData,
                        resultsData: {},
                        result: void 0,
                        keywords: scope.keywords,
                        createdInTask: scope.sourceTaskId,
                        archivedTask: !1,
                        createdInElement: scope.sourceElement,
                        workflowStatus: "New",
                        workflowChanges: [ {
                            status: "New",
                            change_at: new Date(),
                            change_by: currUser.id
                        } ],
                        assigned_to: currUser.id
                    }, formsPicker && formsPicker.close(), ngDialog.open({
                        template: "common/directives/auditFormsFormDialog.tmpl.html",
                        className: "ngdialog-theme-default",
                        data: {
                            auditFormData: scope.newForm,
                            workflowRule: scope.workflowRule,
                            onChange: onChangeWrapper,
                            onDelete: onDeleteWrapper,
                            autoSave: scope.autoSave
                        }
                    }), scope.$watch("newForm.id", function(newVal, oldVal) {
                        0 < newVal && !oldVal && -1 === scope.auditFormData.findIndex(function(d) {
                            return d.id === newVal;
                        }) && (scope.auditFormData.push(scope.newForm), scope.onNew && scope.onNew(scope.newForm));
                    });
                });
            };
            scope.newAuditForm = function() {
                if (!(void 0 === scope.newFormTypes || Array.isArray(scope.newFormTypes) && 0 === scope.newFormTypes.length)) {
                    if (Array.isArray(scope.newFormTypes) || (scope.newFormTypes = [ scope.newFormTypes ]), 
                    1 === scope.newFormTypes.length) return newAuditFormOfType(scope.newFormTypes[0]);
                    formsPicker = ngDialog.open({
                        template: "common/directives/auditFormsPickerDialog.tmpl.html",
                        className: "ngdialog-theme-default",
                        data: {
                            newFormSpecs: scope.newFormTypes.map(function(formType) {
                                return scope.auditForms[formType];
                            }),
                            newAuditFormOfType: newAuditFormOfType
                        }
                    });
                }
            };
        },
        templateUrl: "common/directives/auditFormIcons.tmpl.html"
    };
} ]), angular.module("chartDirectives", [ "chartServices", "miscServices", "datafilesServices", "notesServices", "dashboardScreenServices", "ngDialog", "gettext" ]).directive("timeSeriesChart", [ "$timeout", "ngDialog", "gettext", "d3", "miscServices", "notesViewer", "keywordsService", "sidebarService", "datafileReader", function($timeout, ngDialog, gettext, d3, miscServices, notesViewer, keywordsService, sidebarService, datafileReader) {
    var draw = function(svg, svgBrush, scope) {
        var columns, idx, margin_left = Math.round(.05 * scope.width), margin_right = Math.round(.05 * scope.width + scope.legendWidth), margin_top = Math.round(.05 * scope.height), margin_bottom = Math.round(.05 * scope.height) + 100, extra_margin_right = scope.twoAxes ? margin_left : 0;
        Array.isArray(scope.content) && 0 < scope.content.length ? -1 < (idx = (columns = Object.keys(scope.content[0])).indexOf(scope.timeColumn)) && columns.splice(idx, 1) : columns = [], 
        scope.activeColumns || (scope.activeColumns = columns.slice(0));
        var activeLineColumns = miscServices.intersect(scope.lineColumns, scope.activeColumns), activeAreaColumns = miscServices.intersect(scope.areaColumns, scope.activeColumns);
        scope.relativeAreas ? scope.areaTotal = scope.content.map(function(d) {
            return activeAreaColumns.reduce(function(prev, col) {
                return prev + d[col];
            }, 0);
        }) : scope.areaTotal = void 0, svg.attr("width", scope.width).attr("height", scope.height), 
        svg.select(".clip-rect").attr("x", margin_left).attr("y", margin_top).attr("width", scope.width - margin_left - margin_right - extra_margin_right).attr("height", scope.height - margin_top - margin_bottom);
        var overallYLeftDomain, overallYRightDomain, yLeftScale, yRightScale, yRightAxis, yRightAxisContainer, yLeftAxis, overallXDomain = d3.extent(scope.content, function(d) {
            return d[scope.timeColumn];
        }), xScale = d3.scaleTime().domain(scope.brushExtent ? scope.brushExtent : overallXDomain).range([ margin_left, scope.width - margin_right - extra_margin_right ]), xAxis = d3.axisBottom(xScale).tickFormat(d3.timeFormat("%Y-%m-%d")), xAxisContainer = svg.select(".x-axis");
        xAxisContainer.attr("transform", "translate(0, " + (scope.height - margin_bottom) + ")").call(xAxis).selectAll("text").style("text-anchor", "end").attr("dx", "-1em").attr("dy", "-.55em").attr("transform", "rotate(-90)"), 
        scope.twoAxes ? (overallYLeftDomain = getYDomain(scope.content, [], scope.areaColumns, overallXDomain, scope.timeColumn, scope.relativeAreas), 
        overallYRightDomain = getYDomain(scope.content, scope.lineColumns, [], overallXDomain, scope.timeColumn, scope.relativeAreas, scope.yAxisFix), 
        yLeftScale = d3.scaleLinear().range([ scope.height - margin_bottom, margin_top ]).domain(getYDomain(scope.content, [], activeAreaColumns, xScale.domain(), scope.timeColumn, scope.relativeAreas)), 
        yRightScale = d3.scaleLinear().range([ scope.height - margin_bottom, margin_top ]).domain(getYDomain(scope.content, activeLineColumns, [], xScale.domain(), scope.timeColumn, scope.relativeAreas, scope.yAxisFix)), 
        yRightAxis = d3.axisRight(yRightScale).tickFormat(scope.columnFormats[scope.lineColumns[0]] || d3.format("f")), 
        (yRightAxisContainer = svg.select(".y-axis-right")).attr("transform", "translate(" + (scope.width - margin_right - extra_margin_right) + ")").call(yRightAxis)) : (overallYLeftDomain = getYDomain(scope.content, scope.lineColumns, scope.areaColumns, overallXDomain, scope.timeColumn, scope.relativeAreas, scope.yAxisFix), 
        overallYRightDomain = [ 0, 0 ], yLeftScale = d3.scaleLinear().range([ scope.height - margin_bottom, margin_top ]).domain(getYDomain(scope.content, activeLineColumns, activeAreaColumns, xScale.domain(), scope.timeColumn, scope.relativeAreas, scope.yAxisFix))), 
        yLeftAxis = scope.relativeAreas ? d3.axisLeft(yLeftScale).tickFormat(d3.ourSettings.formats.percentage) : d3.axisLeft(yLeftScale).tickFormat(scope.columnFormats[scope.areaColumns[0] ? scope.areaColumns[0] : scope.lineColumns[0]] || d3.format("f"));
        var yLeftAxisContainer = svg.select(".y-axis-left");
        yLeftAxisContainer.attr("transform", "translate(" + margin_left + ")").call(yLeftAxis);
        var chartColors = d3.scaleOrdinal(d3.ourSettings.chartColors).domain(columns), stackLayout = d3.stack().keys(activeAreaColumns).offset(d3.stackOffsetDiverging), area = d3.area().x(function(d) {
            return xScale(d.data[scope.timeColumn]);
        }).y0(function(d) {
            return yLeftScale(d[0]);
        }).y1(function(d) {
            return yLeftScale(d[1]);
        });
        updateStackedArea(svg, stackLayout, area, chartColors, scope.columnColors, activeAreaColumns, scope.timeColumn, scope.content, scope.notesKeywords, scope.areaTotal), 
        updateLineChart(svg, chartColors, scope.columnColors, xScale, scope.twoAxes ? yRightScale : yLeftScale, scope.lineColumns, activeLineColumns, scope.timeColumn, scope.content, scope.notesKeywords, scope.movingAverageElements, !1);
        var legends = svg.select(".legend").selectAll("g").data(columns), enteredLegends = legends.enter().append("g").attr("class", function(d, i) {
            return "legend-" + i;
        }).attr("transform", function(d, i) {
            return "translate(0, " + (margin_top + (columns.length - 1 - i) * Math.min((scope.height - margin_top - margin_bottom) / columns.length, 30)) + ")";
        });
        enteredLegends.append("rect").attr("x", scope.width - scope.legendWidth).attr("y", function(d) {
            return -1 < scope.lineColumns.indexOf(d) ? Math.round(Math.min((scope.height - margin_top - margin_bottom) / columns.length * .2, 6) + 1) : 0;
        }).attr("width", Math.min(60, .3 * scope.legendWidth)).attr("height", function(d) {
            return -1 < scope.lineColumns.indexOf(d) ? Math.round(Math.min((scope.height - margin_top - margin_bottom) / columns.length * .2, 6)) : Math.round(Math.min((scope.height - margin_top - margin_bottom) / columns.length * .6, 18));
        }).style("fill", function(d) {
            return scope.columnColors[d] ? scope.columnColors[d] : chartColors(d);
        }), enteredLegends.append("text").attr("x", scope.width - scope.legendWidth + Math.min(70, .35 * scope.legendWidth)).attr("y", Math.round(.5 * Math.min((scope.height - margin_top - margin_bottom) / columns.length, 30))).style("fill", "black").text(function(d) {
            return d;
        });
        var processLegendChange = function() {
            scope.twoAxes ? (yLeftScale.domain(getYDomain(scope.content, [], activeAreaColumns, xScale.domain(), scope.timeColumn, scope.relativeAreas)), 
            yRightScale.domain(getYDomain(scope.content, activeLineColumns, [], xScale.domain(), scope.timeColumn, scope.relativeAreas, scope.yAxisFix)), 
            yRightAxisContainer.transition().duration(250).call(yRightAxis)) : yLeftScale.domain(getYDomain(scope.content, activeLineColumns, activeAreaColumns, xScale.domain(), scope.timeColumn, scope.relativeAreas, scope.yAxisFix)), 
            yLeftAxisContainer.transition().duration(250).call(yLeftAxis), scope.relativeAreas ? scope.areaTotal = scope.content.map(function(d) {
                return activeAreaColumns.reduce(function(prev, col) {
                    return prev + d[col];
                }, 0);
            }) : scope.areaTotal = void 0, updateStackedArea(svg, stackLayout, area, chartColors, scope.columnColors, activeAreaColumns, scope.timeColumn, scope.content, scope.notesKeywords, scope.areaTotal), 
            updateLineChart(svg, chartColors, scope.columnColors, xScale, scope.twoAxes ? yRightScale : yLeftScale, scope.lineColumns, activeLineColumns, scope.timeColumn, scope.content, scope.notesKeywords, scope.movingAverageElements, !0);
        };
        enteredLegends.merge(legends).classed("faded", function(d) {
            return -1 === scope.activeColumns.indexOf(d);
        }).on("click", function(d) {
            var setFaded = !d3.select(this).classed("faded");
            d3.select(this).classed("faded", setFaded);
            var thisColumnArray = -1 < scope.areaColumns.indexOf(d) ? activeAreaColumns : activeLineColumns;
            if (setFaded) scope.activeColumns.splice(scope.activeColumns.indexOf(d), 1), thisColumnArray.splice(thisColumnArray.indexOf(d), 1); else {
                for (var j2 = 0, j1 = 0; j1 < columns.length; j1++) scope.activeColumns[j2] === columns[j1] ? j2++ : columns[j1] === d && scope.activeColumns.splice(j2, 0, d);
                for (j1 = j2 = 0; j1 < columns.length; j1++) thisColumnArray[j2] === columns[j1] ? j2++ : columns[j1] === d && thisColumnArray.splice(j2, 0, d);
            }
            processLegendChange();
        }).on("dblclick", function(d) {
            d3.event.preventDefault(), svg.select(".legend").selectAll("g").classed("faded", !0), 
            d3.select(this).classed("faded", !1), scope.activeColumns = [ d ], -1 < scope.areaColumns.indexOf(d) ? (activeAreaColumns = [ d ], 
            activeLineColumns = []) : (activeAreaColumns = [], activeLineColumns = [ d ]), processLegendChange();
        }).on("contextmenu", function() {
            svg.select(".legend").selectAll("g").classed("faded", !1), scope.activeColumns = columns.slice(0), 
            activeLineColumns = miscServices.intersect(scope.lineColumns, scope.activeColumns), 
            activeAreaColumns = miscServices.intersect(scope.areaColumns, scope.activeColumns), 
            processLegendChange(), d3.event.preventDefault();
        });
        var xCursor = svg.select(".x-cursor"), yCursor = svg.select(".y-cursor"), xLabel = svg.select(".x-label"), yLeftLabel = svg.select(".y-label-left"), yRightLabel = svg.select(".y-label-right"), activePoint = svg.select(".data-point-active");
        svg.on("mousemove", function() {
            var yRightValue, pos = d3.mouse(this), xValue = xScale.invert(pos[0]), yLeftValue = yLeftScale.invert(pos[1]), xMin = xScale.domain()[0], xMax = xScale.domain()[1], yLeftMin = yLeftScale.domain()[0], yLeftMax = yLeftScale.domain()[1];
            scope.twoAxes && (yRightValue = yRightScale.invert(pos[1]));
            var xIndex = (0, d3.bisector(function(d) {
                return d[scope.timeColumn];
            }).left)(scope.content, xValue);
            if (pos[0] > scope.width - margin_right - extra_margin_right || pos[0] < margin_left || pos[1] > scope.height - margin_bottom || pos[1] < margin_top || 0 === xIndex || xIndex >= scope.content.length) return activePoint.classed("hidden", !0), 
            xCursor.classed("hidden", !0), xLabel.classed("hidden", !0), yCursor.classed("hidden", !0), 
            yLeftLabel.classed("hidden", !0), yRightLabel.classed("hidden", !0), void (scope.activeElement = void 0);
            var d = xValue - scope.content[xIndex - 1][scope.timeColumn] > scope.content[xIndex][scope.timeColumn] - xValue ? scope.content[xIndex] : scope.content[xIndex - 1], xValueSnapped = d[scope.timeColumn], valueStackPosCounter = 0, valueStackNegCounter = 0, ySnapped = scope.activeColumns.reduce(function(prevVal, k) {
                var valueDifference, thisValue, currScale;
                if (-1 < scope.lineColumns.indexOf(k)) {
                    if (currScale = scope.twoAxes ? yRightScale : yLeftScale, (valueDifference = Math.abs(currScale(d[k]) - currScale(scope.twoAxes ? yRightValue : yLeftValue))) < prevVal.valueDifference) return {
                        value: d[k],
                        column: k,
                        scale: scope.twoAxes ? yRightScale : yLeftScale,
                        valueDifference: valueDifference
                    };
                } else if (thisValue = 0 <= d[k] ? valueStackPosCounter += scope.relativeAreas && 0 < scope.areaTotal[xIndex - 1] ? d[k] / scope.areaTotal[xIndex - 1] : d[k] : valueStackNegCounter += scope.relativeAreas && 0 < scope.areaTotal[xIndex - 1] ? d[k] / scope.areaTotal[xIndex - 1] : d[k], 
                (valueDifference = Math.abs(yLeftScale(thisValue) - yLeftScale(yLeftValue))) < prevVal.valueDifference) return {
                    value: thisValue,
                    column: k,
                    scale: yLeftScale,
                    valueDifference: valueDifference
                };
                return prevVal;
            }, {
                value: 1 / 0,
                column: void 0,
                scale: yLeftScale,
                valueDifference: 1 / 0
            });
            console.log("Cursoring..."), console.log(scope), console.log(ySnapped), console.log(yLeftValue), 
            console.log(yRightValue), console.log(yLeftScale.domain()), console.log(yLeftScale.range());
            var myKeyword = keywordsService.getDataKey(scope.contentFile, d, scope.columnsSpec, ySnapped.column);
            scope.activeElement = {
                keyword: myKeyword,
                columnName: ySnapped.column,
                xValue: xValueSnapped
            }, scope.$apply(function() {
                notesViewer.showNotes(myKeyword);
            }), activePoint.attr("cx", xScale(xValueSnapped)).attr("cy", ySnapped.scale(ySnapped.value)).attr("r", 3).classed("hidden", !1), 
            xCursor.attr("x1", xScale(xValueSnapped)).attr("y1", yLeftScale(yLeftMin)).attr("x2", xScale(xValueSnapped)).attr("y2", yLeftScale(yLeftMax)).classed("hidden", !1), 
            xLabel.attr("transform", "translate(" + xScale(xValueSnapped) + "," + (yLeftScale(yLeftMin) + 10) + ")rotate(-90)").classed("hidden", !1), 
            xLabel.select("text").text(d3.timeFormat("%Y-%m-%d")(xValueSnapped)), yCursor.attr("x1", xScale(xMin)).attr("y1", ySnapped.scale(ySnapped.value)).attr("x2", xScale(xMax)).attr("y2", ySnapped.scale(ySnapped.value)).classed("hidden", !1), 
            ySnapped.scale === yLeftScale ? (yLeftLabel.attr("transform", "translate(" + (xScale(xMin) - 10) + "," + ySnapped.scale(ySnapped.value) + ")").classed("hidden", !1), 
            scope.relativeAreas ? yLeftLabel.select("text").text(d3.ourSettings.formats.percentage(ySnapped.value)) : yLeftLabel.select("text").text(scope.columnFormats[ySnapped.column](ySnapped.value)), 
            scope.twoAxes && yRightLabel.classed("hidden", !0)) : (yRightLabel.attr("transform", "translate(" + (xScale(xMax) + 10) + "," + ySnapped.scale(ySnapped.value) + ")").classed("hidden", !1), 
            yRightLabel.select("text").text(scope.columnFormats[ySnapped.column](ySnapped.value)), 
            yLeftLabel.classed("hidden", !0));
        }), svgBrush.attr("width", scope.width).attr("height", .1 * scope.height);
        var yRightScaleBrush, xScaleBrush = d3.scaleTime().domain(overallXDomain).range(xScale.range()), yLeftScaleBrush = d3.scaleLinear().domain(overallYLeftDomain).range([ Math.floor(.1 * scope.height), 0 ]);
        scope.twoAxes && (yRightScaleBrush = d3.scaleLinear().domain(overallYRightDomain).range([ Math.floor(.1 * scope.height), 0 ]));
        var areaBrush = d3.area().x(function(d) {
            return xScaleBrush(d.data[scope.timeColumn]);
        }).y0(function(d) {
            return yLeftScaleBrush(d[0]);
        }).y1(function(d) {
            return yLeftScaleBrush(d[1]);
        });
        updateStackedArea(svgBrush, stackLayout, areaBrush, chartColors, scope.columnColors, scope.areaColumns, scope.timeColumn, scope.content, scope.notesKeywords, scope.areaTotal), 
        updateLineChart(svgBrush, chartColors, scope.columnColors, xScaleBrush, scope.twoAxes ? yRightScaleBrush : yLeftScaleBrush, scope.lineColumns, scope.lineColumns, scope.timeColumn, scope.content, scope.notesKeywords, scope.movingAverageElements, !1);
        var brush = d3.brushX();
        brush.extent([ [ xScaleBrush.range()[0], yLeftScaleBrush.range()[1] ], [ xScaleBrush.range()[1], yLeftScaleBrush.range()[0] ] ]);
        var brushContainer = svgBrush.select(".brush").call(brush);
        brush.on("end", function() {
            d3.event.selection ? (xScale.domain(d3.event.selection.map(xScaleBrush.invert)), 
            scope.brushExtent = d3.event.selection.map(xScaleBrush.invert)) : (xScale.domain(xScaleBrush.domain()), 
            scope.brushExtent = void 0), scope.twoAxes ? (yLeftScale.domain(getYDomain(scope.content, [], activeAreaColumns, xScale.domain(), scope.timeColumn, scope.relativeAreas)), 
            yRightScale.domain(getYDomain(scope.content, activeLineColumns, [], xScale.domain(), scope.timeColumn, scope.relativeAreas, scope.yAxisFix)), 
            yRightAxisContainer.transition().duration(250).call(yRightAxis)) : yLeftScale.domain(getYDomain(scope.content, activeLineColumns, activeAreaColumns, xScale.domain(), scope.timeColumn, scope.relativeAreas, scope.yAxisFix)), 
            yLeftAxisContainer.transition().duration(250).call(yLeftAxis), xAxisContainer.transition().duration(250).call(xAxis), 
            xAxisContainer.selectAll("text").style("text-anchor", "end").attr("dx", "-1em").attr("dy", "-.55em").attr("transform", "rotate(-90)"), 
            updateStackedArea(svg, stackLayout, area, chartColors, scope.columnColors, activeAreaColumns, scope.timeColumn, scope.content, scope.notesKeywords, scope.areaTotal), 
            updateLineChart(svg, chartColors, scope.columnColors, xScale, scope.twoAxes ? yRightScale : yLeftScale, scope.lineColumns, activeLineColumns, scope.timeColumn, scope.content, scope.notesKeywords, scope.movingAverageElements, !1);
        }), console.log("Moving brush..."), console.log([ scope.brushExtent, scope.initialBrushFrom, scope.content.length ]), 
        scope.brushExtent ? (console.log("Moving brush to existing brushExtent..."), console.log([ scope.brushExtent, scope.initialBrushFrom, scope.content.length, scope.brushExtent.map(xScaleBrush) ]), 
        brushContainer.call(brush.move, scope.brushExtent.map(xScaleBrush))) : 1 <= scope.initialBrushFrom && scope.initialBrushFrom < scope.content.length && scope.usedInitialBrush !== scope.initialBrushFrom && (brushContainer.call(brush.move, [ xScaleBrush(scope.content[scope.content.length - scope.initialBrushFrom - 1][scope.timeColumn]), xScaleBrush(scope.content[scope.content.length - 1][scope.timeColumn]) ]), 
        scope.usedInitialBrush = scope.initialBrushFrom);
    }, getYDomain = function(content, lineColumns, areaColumns, xExtent, timeColumn, relativeAreas, yAxisFix) {
        var yDomainAreas, yDomain, shortenedContent = content.filter(function(d) {
            return d[timeColumn] >= xExtent[0] && d[timeColumn] <= xExtent[1];
        }), yDomainLines = [ d3.min(shortenedContent, function(d) {
            var min = 1 / 0;
            return lineColumns.forEach(function(k) {
                d[k] < min && (min = d[k]);
            }), min;
        }), d3.max(shortenedContent, function(d) {
            var max = 0;
            return lineColumns.forEach(function(k) {
                d[k] > max && (max = d[k]);
            }), max;
        }) ];
        return yAxisFix && (void 0 !== yAxisFix.minMin && "" !== yAxisFix.minMin && yDomainLines[0] < yAxisFix.minMin && (yDomainLines[0] = yAxisFix.minMin), 
        void 0 !== yAxisFix.minMax && "" !== yAxisFix.minMax && yDomainLines[0] > yAxisFix.minMax && (yDomainLines[0] = yAxisFix.minMax), 
        void 0 !== yAxisFix.maxMin && "" !== yAxisFix.maxMin && yDomainLines[1] < yAxisFix.maxMin && (yDomainLines[1] = yAxisFix.maxMin), 
        void 0 !== yAxisFix.maxMax && "" !== yAxisFix.maxMax && yDomainLines[1] > yAxisFix.maxMax && (yDomainLines[1] = yAxisFix.maxMax)), 
        yDomainAreas = relativeAreas ? [ 0, 1 ] : [ d3.min(shortenedContent, function(d) {
            return areaColumns.reduce(function(previousValue, currentValue) {
                return previousValue + (d[currentValue] < 0 ? d[currentValue] : 0);
            }, 0);
        }), d3.max(shortenedContent, function(d) {
            return areaColumns.reduce(function(previousValue, currentValue) {
                return previousValue + (0 < d[currentValue] ? d[currentValue] : 0);
            }, 0);
        }) ], (yDomain = Array.isArray(areaColumns) && 0 < areaColumns.length ? [ d3.min([ yDomainLines[0], yDomainAreas[0] ]), d3.max([ yDomainLines[1], yDomainAreas[1] ]) ] : yDomainLines)[1] = yDomain[1] + .02 * (yDomain[1] - yDomain[0]), 
        yDomain;
    }, updateLineChart = function(svg, myChartColors, myColumnColors, myXScale, myYScale, myColumns, myActiveColumns, timeColumn, myContent, myNotesKeywords, fullRedraw) {
        fullRedraw && svg.select(".data").selectAll(".chartLine").remove();
        var lines = svg.select(".data").selectAll(".chartLine").data(myColumns);
        lines.exit().remove(), lines.enter().append("path").attr("class", function(k, i) {
            return "chartLine chartPath-" + i;
        }).merge(lines).classed("faded", function(k) {
            return -1 === myActiveColumns.indexOf(k);
        }).style("stroke", function(k) {
            return myColumnColors[k] ? myColumnColors[k] : myChartColors(k);
        }).transition().duration(250).attr("d", function(k) {
            return d3.line().x(function(d) {
                return myXScale(d[timeColumn]);
            }).y(function(d) {
                return myYScale(d[k]);
            })(myContent);
        }), fullRedraw && svg.select(".data").selectAll(".notes-circles-lines").remove();
        var notesCircles = svg.select(".data").selectAll(".notes-circles-lines").data(myNotesKeywords.filter(function(note) {
            return -1 < myActiveColumns.indexOf(note.column);
        }));
        notesCircles.exit().remove(), notesCircles.enter().append("circle").attr("class", "notes-circles notes-circles-lines").attr("cx", function(d) {
            return myXScale(d.time);
        }).attr("cy", function(d) {
            var matchTime = myContent.filter(function(cont) {
                return cont[timeColumn].getTime() === d.time.getTime();
            })[0];
            return matchTime ? myYScale(matchTime[d.column]) : 0;
        }).attr("r", 3), notesCircles.transition().duration(250).attr("cx", function(d) {
            return myXScale(d.time);
        }).attr("cy", function(d) {
            var matchTime = myContent.filter(function(cont) {
                return cont[timeColumn].getTime() === d.time.getTime();
            })[0];
            return matchTime ? myYScale(matchTime[d.column]) : 0;
        });
    }, updateStackedArea = function(svg, myStackLayout, myArea, myChartColors, myColumnColors, myColumns, timeColumn, myContent, myNotesKeywords, myAreaTotal) {
        var mappedContent;
        mappedContent = myAreaTotal ? myContent.map(function(d, i) {
            var ret = {};
            return myColumns.forEach(function(k) {
                ret[k] = 0 < myAreaTotal[i] ? d[k] / myAreaTotal[i] : d[k];
            }), ret[timeColumn] = d[timeColumn], ret;
        }) : myContent, console.log("updateStackArea called:"), console.log([ myStackLayout, myColumns, myContent, myAreaTotal, mappedContent, timeColumn, myNotesKeywords ]), 
        myStackLayout.keys(myColumns);
        var stackedData = myStackLayout(mappedContent);
        console.log("Obtained stackedData:"), console.log(stackedData);
        var stackedAreas = svg.select(".data").selectAll(".stackedAreas").data(stackedData, function(d) {
            return d.key;
        });
        stackedAreas.exit().remove(), stackedAreas.enter().append("path").merge(stackedAreas).attr("d", function(d) {
            return myArea(d);
        }).style("fill", function(d) {
            return myColumnColors[d.key] ? myColumnColors[d.key] : myChartColors(d.key);
        }).attr("class", function(d, i) {
            return "stackedAreas chartPath-" + i;
        }), svg.select(".data").selectAll(".notes-circles-area").remove();
        var notesCircles = svg.select(".data").selectAll(".notes-circles-area").data(myNotesKeywords.filter(function(note) {
            return -1 < myColumns.indexOf(note.column);
        }));
        console.log("Drawing notesCircles for: "), myNotesKeywords.forEach(function(note) {
            console.log([ note, myColumns.indexOf(note.column), -1 < myColumns.indexOf(note.column) ]);
        });
        var cxAccessor = function(d) {
            var matchTime, matchColumn = stackedData.find(function(cont) {
                return cont.key.toString() === d.column.toString();
            });
            return matchColumn && (matchTime = matchColumn.find(function(cont) {
                return cont.data[timeColumn].toString() === d.time.toString();
            })), myArea.x()(matchTime);
        }, cyAccessor = function(d) {
            var matchTime, matchColumn = stackedData.find(function(cont) {
                return cont.key === d.column;
            });
            return matchColumn && (matchTime = matchColumn.find(function(cont) {
                return cont.data[timeColumn].getTime() === d.time.getTime();
            })), matchTime ? matchTime[0] < 0 ? myArea.y0()(matchTime) : myArea.y1()(matchTime) : 0;
        };
        notesCircles.enter().append("circle").attr("cx", cxAccessor).attr("cy", cyAccessor).attr("r", 3).attr("class", "notes-circles notes-circles-area"), 
        notesCircles.transition().duration(250).attr("cx", cxAccessor).attr("cy", cyAccessor);
    }, makeMovingAverage = function(source, movAvg, timeColumn) {
        if (!movAvg || movAvg <= 1 || !source || !source.length) return source;
        var columns = Object.keys(source[0]);
        columns.splice(columns.indexOf(timeColumn), 1);
        for (var ret = [], calcForEachColumn = function(c) {
            for (var newVal = 0, j = i - movAvg + 1; j <= i; j++) newVal += source[j][c];
            ret[ret.length - 1][c] = newVal / movAvg;
        }, i = movAvg; i < source.length; i++) {
            var newObj = {};
            newObj[timeColumn] = source[i][timeColumn], ret.push(newObj), columns.forEach(calcForEachColumn);
        }
        return ret;
    };
    return {
        restrict: "E",
        scope: {
            width: "=",
            height: "=",
            legendWidth: "=?",
            contentFile: "=",
            timeColumn: "=",
            lineColumns: "=?",
            areaColumns: "=?",
            relativeAreas: "=?",
            twoAxes: "=",
            yAxisFix: "=?",
            mvgAvgDefault: "=",
            initialBrushFrom: "=",
            notesEnabled: "=",
            notesOptions: "=?"
        },
        require: "?^zoomKey",
        templateUrl: "common/directives/chartTimeSeries.tmpl.html",
        link: function(scope, element, attrs, zoomKeyCtrl) {
            var svg, svgBrush, loadingIndicator;
            scope.loading = !1, scope.errorMessage = "", scope.notesKeywords = [], scope.content = [], 
            scope.contentRaw = [], scope.contentHash = "", scope.columnKeywords = {}, scope.brushExtent = void 0, 
            scope.maxMovingAverage = 1, scope.movingAverageElements = 1 <= scope.mvgAvgDefault ? scope.mvgAvgDefault : 1, 
            scope.columnsSpec = [], scope.keywordsHash = {}, scope.legendWidth || (scope.legendWidth = Math.round(.25 * scope.width)), 
            Array.isArray(scope.lineColumns) || (scope.lineColumns = []), Array.isArray(scope.areaColumns) || (scope.areaColumns = []), 
            scope.contentColumns = scope.lineColumns.concat(scope.areaColumns.filter(function(item) {
                return scope.lineColumns.indexOf(item) < 0;
            })), (svg = d3.select(element[0]).append("svg")).append("g").attr("class", "data").attr("clip-path", "url(#clip-path-" + scope.$id + ")"), 
            svg.append("g").attr("class", "x-axis axis"), svg.append("g").attr("class", "y-axis-left axis"), 
            svg.append("g").attr("class", "y-axis-right axis"), svg.append("g").attr("class", "legend"), 
            svg.append("clipPath").attr("id", "clip-path-" + scope.$id).append("rect").attr("class", "clip-rect"), 
            scope.notesEnabled && svg.on("dblclick", function() {
                return d3.event.preventDefault(), function(myElement, notesOptions, zoomKeyCtrl) {
                    myElement && ngDialog.open({
                        template: "common/directives/notesDialog.tmpl.html",
                        className: "ngdialog-theme-default",
                        closeByDocument: !1,
                        data: {
                            keywordID: myElement.keyword,
                            sourceName: myElement.columnName + " at " + d3.timeFormat("%Y-%m-%d")(myElement.xValue),
                            notesOptions: notesOptions,
                            sourceLink: zoomKeyCtrl ? zoomKeyCtrl.getZoomLink(d3.timeFormat("%Y-%m-%d")(myElement.xValue)) : ""
                        }
                    });
                }(scope.activeElement, scope.notesOptions, zoomKeyCtrl);
            });
            var cursorCont = svg.append("g").attr("class", "cursor");
            cursorCont.append("line").attr("class", "x-cursor cursor"), cursorCont.append("line").attr("class", "y-cursor cursor");
            var focusCont = svg.append("g").attr("class", "focus");
            focusCont.append("circle").attr("class", "data-point-active");
            var xLabelNode = focusCont.append("g").attr("class", "x-label label hidden");
            xLabelNode.append("rect").style("display", "block").attr("width", 60).attr("height", 15).attr("transform", "translate(-55, -11)"), 
            xLabelNode.append("text");
            var yRightLabelNode, yLeftLabelNode = focusCont.append("g").attr("class", "y-label-left label hidden");
            yLeftLabelNode.append("rect").style("display", "block").attr("width", 60).attr("height", 15).attr("transform", "translate(-55, -11)"), 
            yLeftLabelNode.append("text"), scope.twoAxes && ((yRightLabelNode = focusCont.append("g").attr("class", "y-label-right label hidden")).append("rect").style("display", "block").attr("width", 60).attr("height", 15).attr("transform", "translate(-55, -11)"), 
            yRightLabelNode.append("text")), (svgBrush = d3.select(element[0]).append("svg").attr("class", "brush-svg")).append("g").attr("class", "data"), 
            svgBrush.append("g").attr("class", "brush");
            var movingAverageTimeout, notesListener = function(allKeywords) {
                var oldNotes = scope.notesKeywords ? scope.notesKeywords.length : 0;
                scope.notesKeywords = [], allKeywords.forEach(function(k) {
                    scope.keywordsHash[k] && scope.notesKeywords.push(scope.keywordsHash[k]);
                }), console.log("notesListener received new keywords:"), console.log([ oldNotes, allKeywords, scope.notesKeywords, scope.keywordsHash ]), 
                scope.content && 0 < scope.content.length && (0 < oldNotes || 0 < scope.notesKeywords.length) && draw(svg, svgBrush, scope);
            }, zoomListener = function(zoomLink) {
                var zoomFrom, zoomTo, zoomLinkMatch = zoomLink.match(/^([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])(\/([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]))?/);
                if (null !== zoomLinkMatch && scope.content && scope.timeColumn) {
                    var timeBisector = d3.bisector(function(d) {
                        return d[scope.timeColumn];
                    });
                    if (zoomLinkMatch[3]) zoomFrom = timeBisector.left(scope.content, d3.ourSettings.formats.date.parse(zoomLinkMatch[1])), 
                    zoomTo = Math.min(timeBisector.right(scope.content, d3.ourSettings.formats.date.parse(zoomLinkMatch[3])), scope.content.length - 1); else {
                        var zoomAt = timeBisector.left(scope.content, d3.ourSettings.formats.date.parse(zoomLinkMatch[1]));
                        zoomFrom = Math.max(0, zoomAt - 5), zoomTo = Math.min(zoomAt + 5, scope.content.length - 1);
                    }
                    return scope.brushExtent = [ scope.content[zoomFrom][scope.timeColumn], scope.content[zoomTo][scope.timeColumn] ], 
                    draw(svg, svgBrush, scope), "";
                }
            };
            scope.contentFile && (scope.loading = !0, console.log("Retrieving content for chart from datafile " + scope.contentFile), 
            svg.classed("hidden", !0), loadingIndicator = d3.select(element[0]).append("div").style("height", scope.height + "px").style("width", scope.width + "px").classed("loadingIndicator", !0), 
            datafileReader.readDatafile(scope.contentFile).then(function(res) {
                var rows = res[0];
                scope.columnsSpec = res[1], console.log("Obtained data for chart: "), console.log(res), 
                scope.keywordsHash = {}, scope.contentRaw = rows.map(function(d) {
                    var ret = {};
                    return ret[scope.timeColumn] = d[scope.timeColumn], scope.contentColumns.forEach(function(c) {
                        var dNumeric = Number(d[c]);
                        ret[c] = isNaN(dNumeric) ? 0 : dNumeric;
                        var thisKey = keywordsService.getDataKey(scope.contentFile, d, scope.columnsSpec, c);
                        scope.keywordsHash[thisKey] = {
                            keyword: thisKey,
                            time: d[scope.timeColumn],
                            column: c,
                            value: ret[c]
                        };
                    }), ret;
                }), scope.columnKeywords = {}, scope.columnFormats = {}, scope.columnColors = {}, 
                scope.columnsSpec.forEach(function(colDef) {
                    scope.columnKeywords[colDef.display] = colDef.keyword, scope.columnFormats[colDef.display] = d3.ourSettings.formats[colDef.format], 
                    scope.columnColors[colDef.display] = colDef.color;
                });
                var columnsSpecSorter = function(a, b) {
                    return scope.columnsSpec.findIndex(function(d) {
                        return d.display === a;
                    }) - scope.columnsSpec.findIndex(function(d) {
                        return d.display === b;
                    });
                };
                scope.contentColumns.sort(columnsSpecSorter), scope.lineColumns.sort(columnsSpecSorter), 
                scope.areaColumns.sort(columnsSpecSorter), scope.maxMovingAverage = Math.max(0, Math.min(scope.contentRaw.length - 3, 365)), 
                scope.content = makeMovingAverage(scope.contentRaw, scope.movingAverageElements, scope.timeColumn), 
                scope.contentHash = miscServices.hashCode(JSON.stringify(scope.content)), scope.errorMessage = "", 
                scope.loading = !1;
            }, function(err) {
                console.log("An error occurred loading the graph: "), console.log(err), scope.content = [], 
                scope.contentHash = "", scope.errorMessage = gettext("An error occurred while loading this graph:") + " " + err, 
                scope.loading = !1;
            }).then(function() {
                scope.notesEnabled && notesViewer.loadNotes("data/" + scope.contentFile + "/", notesListener);
            })), scope.$watch("loading", function(newVal, oldVal, scope) {
                scope.loading ? (svg.classed("hidden", !0), loadingIndicator.attr("class", "loadingIndicator")) : scope.errorMessage ? (svg.classed("hidden", !0), 
                loadingIndicator.attr("class", "loadingErrorMessage"), loadingIndicator.text(scope.errorMessage)) : (svg.classed("hidden", !1), 
                loadingIndicator.attr("class", "loadingIndicator hidden"));
            }, !0), scope.$watch("contentHash", function(newVal, oldVal, scope) {
                scope.content && 0 < scope.content.length && (zoomKeyCtrl && zoomKeyCtrl.onZoom(zoomListener), 
                draw(svg, svgBrush, scope));
            }, !0), scope.$watch("movingAverageElements", function(newVal, oldVal, scope) {
                newVal !== oldVal && !isNaN(newVal) && 1 <= newVal && scope.contentRaw && 0 < scope.contentRaw.length && (movingAverageTimeout && $timeout.cancel(movingAverageTimeout), 
                movingAverageTimeout = $timeout(function() {
                    scope.content = makeMovingAverage(scope.contentRaw, newVal, scope.timeColumn), scope.contentHash = miscServices.hashCode(JSON.stringify(scope.content));
                }, 250));
            }, !0);
        }
    };
} ]).directive("sparklineChart", [ "gettext", "d3", function(gettext, d3) {
    var draw = function(svg, scope) {
        console.log("Drawing sparkline chart... Scope received:"), console.log(scope), svg.attr("width", scope.width).attr("height", scope.height);
        var cleanedContent = [];
        scope.content.forEach(function(d) {
            var dNumeric = Number(d);
            isNaN(dNumeric) || cleanedContent.push(dNumeric);
        });
        var xScale = d3.scaleLinear().domain([ 0, cleanedContent.length - 1 ]).range([ 0, scope.width ]), yScale = d3.scaleLinear().domain(d3.extent(cleanedContent.concat(scope.globalMin, scope.globalMax))).range([ scope.height - 3, 3 ]);
        svg.selectAll(".sparkline-path").remove();
        var line = d3.line().x(function(d, i) {
            return xScale(i);
        }).y(function(d) {
            return yScale(d);
        }), sparklinePath = svg.append("path").attr("class", "sparkline-path").attr("d", line(cleanedContent));
        scope.color && sparklinePath.style("stroke", scope.color);
    };
    return {
        restrict: "E",
        scope: {
            width: "=",
            height: "=",
            content: "=",
            globalMin: "=?",
            globalMax: "=?",
            color: "=?"
        },
        template: "",
        link: function(scope, element) {
            var svg = d3.select(element[0]).append("svg").classed("sparkline-chart", !0);
            scope.content && 0 < scope.content.length && draw(svg, scope), scope.$watch("content", function(newVal, oldVal, scope) {
                scope.content && 0 < scope.content.length && draw(svg, scope);
            }, !0), scope.$watch("color", function(newVal, oldVal, scope) {
                scope.content && 0 < scope.content.length && draw(svg, scope);
            }, !0);
        }
    };
} ]).directive("stackedBarChart", [ "$timeout", "ngDialog", "gettext", "d3", "miscServices", "notesViewer", "keywordsService", "sidebarService", "datafileReader", function($timeout, ngDialog, gettext, d3, miscServices, notesViewer, keywordsService, sidebarService, datafileReader) {
    var draw = function(svg, scope) {
        var columns, idx, contentExtract, margin_left = Math.round(.05 * scope.width), margin_right = Math.round(.05 * scope.width + scope.legendWidth), margin_top = Math.round(.05 * scope.height), margin_bottom = Math.round(.05 * scope.height) + 100;
        console.log("Drawing barchart..."), console.log(scope.content), Array.isArray(scope.content) && 0 < scope.content.length ? (-1 < (idx = (columns = Object.keys(scope.content[0])).indexOf(scope.timeColumn)) && columns.splice(idx, 1), 
        -1 < (idx = columns.indexOf(scope.barColumn)) && columns.splice(idx, 1), -1 < (idx = columns.indexOf("barColumnText")) && columns.splice(idx, 1)) : columns = [], 
        scope.activeColumns || (scope.activeColumns = columns.slice(0)), contentExtract = scope.contentBarColumns ? scope.content.filter(function(d) {
            return d[scope.timeColumn].getTime() === scope.currTime.getTime() && -1 < scope.contentBarColumns.indexOf(d.barColumnText);
        }) : scope.content.filter(function(d) {
            return d[scope.timeColumn].getTime() === scope.currTime.getTime();
        });
        var barColumnsMap = {};
        contentExtract.forEach(function(d) {
            barColumnsMap[d.barColumnText] = !0;
        });
        var currBarColumns = Object.keys(barColumnsMap);
        svg.attr("width", scope.width).attr("height", scope.height);
        var xScale = d3.scaleBand().domain(currBarColumns).rangeRound([ margin_left, scope.width - margin_right ], .05), xAxis = d3.axisBottom(xScale).tickSize(0).tickPadding(6);
        svg.select(".x-axis").attr("transform", "translate(0, " + (scope.height - margin_bottom) + ")").call(xAxis).selectAll("text").style("text-anchor", "end").attr("dx", "-1em").attr("dy", "-.55em").attr("transform", "rotate(-90)");
        var yScale = d3.scaleLinear().range([ scope.height - margin_bottom, margin_top ]);
        svg.select(".y-axis").attr("transform", "translate(" + margin_left + ")");
        var chartColors = d3.scaleOrdinal(d3.ourSettings.chartColors).domain(columns);
        drawBars(svg, contentExtract, columns, scope, xScale, yScale, chartColors);
        var legends = svg.select(".legend").selectAll("g").data(columns), enteredLegends = legends.enter().append("g").attr("class", function(d, i) {
            return "legend-" + i;
        }).attr("transform", function(d, i) {
            return "translate(0, " + (margin_top + (columns.length - 1 - i) * Math.min((scope.height - margin_top - margin_bottom) / columns.length, 30)) + ")";
        });
        enteredLegends.append("rect").attr("x", scope.width - scope.legendWidth).attr("width", Math.min(60, .3 * scope.legendWidth)).attr("height", Math.min((scope.height - margin_top - margin_bottom) / columns.length * .6, 18)).style("fill", function(d) {
            return scope.columnColors[d] ? scope.columnColors[d] : chartColors(d);
        }), enteredLegends.append("text").attr("x", scope.width - scope.legendWidth + Math.min(70, .35 * scope.legendWidth)).attr("y", .5 * Math.min((scope.height - margin_top - margin_bottom) / columns.length, 30)).style("fill", "black").text(function(d) {
            return d;
        }), enteredLegends.merge(legends).classed("faded", function(d) {
            return -1 === scope.activeColumns.indexOf(d);
        }).on("click", function(d) {
            var setFaded = !d3.select(this).classed("faded");
            if (d3.select(this).classed("faded", setFaded), setFaded) scope.activeColumns.splice(scope.activeColumns.indexOf(d), 1); else for (var j2 = 0, j1 = 0; j1 < columns.length; j1++) scope.activeColumns[j2] === columns[j1] ? j2++ : columns[j1] === d && scope.activeColumns.splice(j2, 0, d);
            drawBars(svg, contentExtract, columns, scope, xScale, yScale, chartColors);
        }).on("dblclick", function(d) {
            d3.event.preventDefault(), svg.select(".legend").selectAll("g").classed("faded", !0), 
            d3.select(this).classed("faded", !1), scope.activeColumns = [ d ], drawBars(svg, contentExtract, columns, scope, xScale, yScale, chartColors);
        }).on("contextmenu", function() {
            svg.select(".legend").selectAll(".faded").classed("faded", !1), scope.activeColumns = columns.slice(0), 
            drawBars(svg, contentExtract, columns, scope, xScale, yScale, chartColors), d3.event.preventDefault();
        });
        var mouseoverShown = !1, mouseoverBox = svg.select(".mouseover-box").attr("width", Math.floor(.9 * xScale.bandwidth())).attr("height", 20), mouseoverText = svg.select(".mouseover-text");
        svg.on("mousemove", function() {
            var pos = d3.mouse(this);
            if (pos[0] < margin_left || pos[0] > scope.width - margin_right || pos[1] < margin_top || pos[1] > scope.height - margin_bottom || "RECT" !== d3.event.target.nodeName.toUpperCase()) return mouseoverShown && (mouseoverBox.classed("hidden", !0), 
            mouseoverText.classed("hidden", !0), mouseoverShown = !1), void scope.$apply(function() {
                scope.activeElement = void 0, notesViewer.showNotes();
            });
            var d = d3.select(d3.event.target).datum(), col = d3.select(d3.event.target.parentNode).datum().key, barCol = d.data.barColumnText;
            scope.activeElement = {
                keyword: keywordsService.getDataKey(scope.contentFile, d.data, scope.columnsSpec, col),
                columnName: col,
                barColumn: barCol,
                time: scope.currTime
            }, console.log("getDataKey: "), console.log([ scope.contentFile, d, scope.columnsSpec, col ]), 
            console.log(scope.activeElement), mouseoverBox.attr("x", Math.floor(xScale(d.data.barColumnText) + .05 * xScale.bandwidth())).attr("y", yScale((d[0] + d[1]) / 2) - 10).classed("hidden", !1), 
            mouseoverText.text((scope.columnFormats[col] ? scope.columnFormats[col] : d3.format(".2f"))(d.data[col])).attr("x", Math.floor(xScale(d.data.barColumnText) + xScale.bandwidth() / 2)).attr("y", yScale((d[0] + d[1]) / 2) + 5).classed("hidden", !1), 
            mouseoverShown = !0, scope.$apply(function() {
                notesViewer.showNotes(keywordsService.getDataKey(scope.contentFile, d.data, scope.columnsSpec, col));
            });
        });
    }, drawBars = function(svg, contentExtract, columns, scope, xScale, yScale, chartColors) {
        scope.activeColumns && 0 !== scope.activeColumns.length || (scope.activeColumns = columns.map(function(d) {
            return d;
        }));
        var layers = d3.stack().keys(scope.activeColumns).order(d3.stackOrderNone).offset(d3.stackOffsetDiverging)(contentExtract), yMin = d3.min(layers, function(layer) {
            return d3.min(layer, function(ele) {
                return ele[1] > ele[0] ? ele[0] : ele[1];
            });
        }), yMax = d3.max(layers, function(layer) {
            return d3.max(layer, function(ele) {
                return ele[1] > ele[0] ? ele[1] : ele[0];
            });
        });
        yScale.domain([ yMin, yMax ]);
        var yAxis = d3.axisLeft(yScale).tickFormat(scope.columnFormats[columns[0]] || d3.format(",f"));
        svg.select(".y-axis").transition().duration(250).call(yAxis);
        var layer = svg.select(".data").selectAll(".layer").data(layers, function(d) {
            return d.key;
        });
        layer.exit().remove();
        var rect = (layer = layer.enter().append("g").attr("class", "layer").merge(layer).style("fill", function(d) {
            return scope.columnColors[d.key] ? scope.columnColors[d.key] : chartColors(d.key);
        })).selectAll("rect").data(function(d) {
            return d;
        });
        rect.exit().remove(), rect.enter().append("rect").attr("y", function(d) {
            var myKeyword = keywordsService.getDataKey(scope.contentFile, d.data, scope.columnsSpec, d3.select(this.parentNode).datum().key);
            return yScale(d3.max(d)) + (-1 < scope.notesKeywords.indexOf(myKeyword) ? 2 : 0);
        }).attr("height", function(d) {
            var myKeyword = keywordsService.getDataKey(scope.contentFile, d.data, scope.columnsSpec, d3.select(this.parentNode).datum().key);
            return Math.abs(yScale(d[0]) - yScale(d[1])) - (-1 < scope.notesKeywords.indexOf(myKeyword) ? 4 : 0);
        }).merge(rect).attr("x", function(d) {
            return xScale(d.data.barColumnText);
        }).attr("width", xScale.bandwidth()).classed("bar-has-notes", function(d) {
            var myKeyword = keywordsService.getDataKey(scope.contentFile, d.data, scope.columnsSpec, d3.select(this.parentNode).datum().key);
            return -1 < scope.notesKeywords.indexOf(myKeyword);
        }).transition().duration(250).attr("y", function(d) {
            var myKeyword = keywordsService.getDataKey(scope.contentFile, d.data, scope.columnsSpec, d3.select(this.parentNode).datum().key);
            return yScale(d3.max(d)) + (-1 < scope.notesKeywords.indexOf(myKeyword) ? 2 : 0);
        }).attr("height", function(d) {
            var myKeyword = keywordsService.getDataKey(scope.contentFile, d.data, scope.columnsSpec, d3.select(this.parentNode).datum().key);
            return Math.abs(yScale(d[0]) - yScale(d[1])) - (-1 < scope.notesKeywords.indexOf(myKeyword) ? 4 : 0);
        });
    };
    return {
        restrict: "E",
        scope: {
            width: "=",
            height: "=",
            legendWidth: "=?",
            contentFile: "=",
            timeColumn: "=",
            barColumn: "=",
            contentColumns: "=?",
            contentBarColumns: "=?",
            notesEnabled: "=",
            notesOptions: "=?"
        },
        require: "?^zoomKey",
        templateUrl: "common/directives/chartBarChart.tmpl.html",
        link: function(scope, element, attrs, zoomKeyCtrl) {
            var svg, loadingIndicator;
            scope.loading = !1, scope.errorMessage = "", scope.content = [], scope.contentHash = "", 
            scope.columnKeywords = {}, scope.notesKeywords = [], scope.currTime = void 0, scope.availableTime = [], 
            scope.columnsSpec = [], scope.animationSpeed = 0, scope.legendWidth || (scope.legendWidth = Math.round(.25 * scope.width)), 
            (svg = d3.select(element[0]).append("svg")).append("g").attr("class", "data"), svg.append("g").attr("class", "x-axis axis"), 
            svg.append("g").attr("class", "y-axis axis"), svg.append("g").attr("class", "legend"), 
            svg.append("rect").attr("class", "mouseover-box hidden"), svg.append("text").attr("class", "mouseover-text hidden"), 
            scope.notesEnabled && svg.on("dblclick", function() {
                return d3.event.preventDefault(), function(myElement, notesOptions, zoomKeyCtrl) {
                    myElement && ngDialog.open({
                        template: "common/directives/notesDialog.tmpl.html",
                        className: "ngdialog-theme-default",
                        closeByDocument: !1,
                        data: {
                            keywordID: myElement.keyword,
                            sourceName: myElement.columnName + " " + gettext("and") + " " + myElement.barColumn + " at " + d3.timeFormat("%Y-%m-%d")(myElement.time),
                            notesOptions: notesOptions,
                            sourceLink: zoomKeyCtrl ? zoomKeyCtrl.getZoomLink(d3.timeFormat("%Y-%m-%d")(myElement.time)) : ""
                        }
                    });
                }(scope.activeElement, scope.notesOptions, zoomKeyCtrl);
            });
            var notesListener = function(allKeywords) {
                var oldNotes = scope.notesKeywords ? scope.notesKeywords.length : 0;
                scope.notesKeywords = allKeywords, scope.content && 0 < scope.content.length && (0 < oldNotes || 0 < scope.notesKeywords.length) && draw(svg, scope);
            }, zoomListener = function(zoomHash) {
                if (zoomHash.match(/^([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])/)) {
                    var zoomTo = zoomHash.substr(0, 10), timeIndex = scope.availableTime.findIndex(function(d) {
                        return console.log("Comparing availableTime entry..."), console.log([ d, new Date(d) ]), 
                        console.log(d3.ourSettings.formats.date(new Date(d))), d3.ourSettings.formats.date(new Date(d)) === zoomTo;
                    });
                    return null !== timeIndex ? (scope.selectedTimeIndex = timeIndex, $timeout(function() {
                        element.find("input").val(scope.selectedTimeIndex);
                    }), "") : void 0;
                }
            };
            scope.contentFile && (scope.loading = !0, svg.classed("hidden", !0), loadingIndicator = d3.select(element[0]).append("div").style("height", scope.height + "px").style("width", scope.width + "px").classed("loadingIndicator", !0), 
            datafileReader.readDatafile(scope.contentFile).then(function(res) {
                var rows = res[0];
                if (scope.columnsSpec = res[1], scope.columnKeywords = {}, scope.columnFormats = {}, 
                scope.columnColors = {}, scope.columnsSpec.forEach(function(colDef) {
                    scope.columnKeywords[colDef.display] = colDef.keyword, scope.columnFormats[colDef.display] = d3.ourSettings.formats[colDef.format], 
                    scope.columnColors[colDef.display] = colDef.color;
                }), console.log("Obtained data for chart: "), console.log(res), scope.contentColumns) {
                    scope.contentColumns.sort(function(a, b) {
                        return scope.columnsSpec.findIndex(function(d) {
                            return d.display === a;
                        }) - scope.columnsSpec.findIndex(function(d) {
                            return d.display === b;
                        });
                    }), scope.content = rows.map(function(d) {
                        var ret = {};
                        return ret[scope.timeColumn] = d[scope.timeColumn], ret[scope.barColumn] = d[scope.barColumn], 
                        ret.barColumnText = scope.columnFormats[scope.barColumn] ? scope.columnFormats[scope.barColumn](d[scope.barColumn]) : d[scope.barColumn], 
                        scope.contentColumns.forEach(function(c) {
                            ret[c] = d[c];
                        }), ret;
                    });
                } else scope.content = rows.map(function(d) {
                    var ret = {};
                    return ret[scope.timeColumn] = d[scope.timeColumn], ret[scope.barColumn] = d[scope.barColumn], 
                    ret.barColumnText = scope.columnFormats[scope.barColumn] ? scope.columnFormats[scope.barColumn](d[scope.barColumn]) : d[scope.barColumn], 
                    Object.keys(d).forEach(function(c) {
                        c !== scope.timeColumn && c !== scope.barColumn && (ret[c] = d[c]);
                    }), ret;
                });
                var availableTimes = {};
                scope.content.forEach(function(d) {
                    availableTimes[d[scope.timeColumn].getTime()] = !0;
                }), scope.availableTime = Object.keys(availableTimes).map(function(time) {
                    return parseInt(time, 10);
                }).sort(function(a, b) {
                    return a - b;
                }), scope.selectedTimeIndex = scope.availableTime.length - 1, zoomKeyCtrl && zoomKeyCtrl.onZoom(zoomListener), 
                scope.currTime = new Date(), scope.currTime.setTime(scope.availableTime[scope.selectedTimeIndex]), 
                $timeout(function() {
                    element.find("input").val(scope.selectedTimeIndex);
                }), scope.contentHash = miscServices.hashCode(JSON.stringify(scope.content)), scope.errorMessage = "", 
                scope.loading = !1;
            }, function(err) {
                console.log("An error occurred loading the graph: "), console.log(err), scope.content = [], 
                scope.contentHash = "", scope.errorMessage = gettext("An error occurred while loading this graph:") + " " + err, 
                scope.loading = !1;
            }).then(function() {
                scope.notesEnabled && notesViewer.loadNotes("data/" + scope.contentFile + "/", notesListener);
            })), scope.startAnimation = function() {
                var nextStep;
                scope.animationSpeed ? scope.animationSpeed++ : (nextStep = function() {
                    scope.selectedTimeIndex = Number(scope.selectedTimeIndex) || 0, scope.selectedTimeIndex = scope.selectedTimeIndex === scope.availableTime.length - 1 ? 0 : scope.selectedTimeIndex + 1, 
                    scope.animationSpeed && $timeout(nextStep, 800 / scope.animationSpeed);
                }, scope.animationSpeed = 1, nextStep());
            }, scope.stopAnimation = function() {
                scope.animationSpeed = 0;
            }, scope.$watch("loading", function(newVal, oldVal, scope) {
                scope.loading ? (svg.classed("hidden", !0), loadingIndicator.attr("class", "loadingIndicator")) : scope.errorMessage ? (svg.classed("hidden", !0), 
                loadingIndicator.attr("class", "loadingErrorMessage"), loadingIndicator.text(scope.errorMessage)) : (svg.classed("hidden", !1), 
                loadingIndicator.attr("class", "loadingIndicator hidden"));
            }, !0), scope.$watch("contentHash", function(newVal, oldVal, scope) {
                scope.content && 0 < scope.content.length && draw(svg, scope);
            }, !0), scope.$watch("selectedTimeIndex", function(newVal, oldVal, scope) {
                newVal !== oldVal && scope.availableTime[newVal] && (scope.currTime.setTime(scope.availableTime[newVal]), 
                scope.content && 0 < scope.content.length && draw(svg, scope));
            });
        }
    };
} ]).directive("scatterplotChart", [ "$timeout", "ngDialog", "gettext", "d3", "miscServices", "notesViewer", "keywordsService", "sidebarService", "datafileReader", function($timeout, ngDialog, gettext, d3, miscServices, notesViewer, keywordsService, sidebarService, datafileReader) {
    var draw = function(svg, scope) {
        var margin_left = Math.round(.05 * scope.width), margin_right = Math.round(.05 * scope.width + (scope.contentGroup ? scope.legendWidth : 0)), margin_top = Math.round(.05 * scope.height), margin_bottom = Math.round(.05 * scope.height) + 100, availableGroups = [];
        if (scope.contentGroup) {
            var tmpGroupHash = {};
            scope.content.forEach(function(d) {
                tmpGroupHash[d[scope.contentGroup]] = !0;
            }), availableGroups = Object.keys(tmpGroupHash);
        }
        scope.activeGroups || (scope.activeGroups = availableGroups.slice(0)), svg.attr("width", scope.width).attr("height", scope.height), 
        svg.select(".clip-rect").attr("x", margin_left).attr("y", margin_top).attr("width", scope.width - margin_left - margin_right).attr("height", scope.height - margin_top - margin_bottom);
        var xScale = d3.scaleLinear().range([ margin_left, scope.width - margin_right ]);
        svg.select(".x-axis").attr("transform", "translate(0, " + (scope.height - margin_bottom) + ")"), 
        svg.select(".x-axis-label").text(scope.labelX).attr("x", Math.floor(margin_left + (scope.width - margin_left - margin_right) / 2)).attr("y", Math.floor(scope.height - margin_bottom / 2));
        var yScale = d3.scaleLinear().range([ scope.height - margin_bottom, margin_top ]);
        svg.select(".y-axis").attr("transform", "translate(" + margin_left + ")"), svg.select(".y-axis-label").text(scope.labelY).attr("transform", "rotate(-90)").attr("x", -1 * Math.floor(margin_top + (scope.height - margin_top - margin_bottom) / 2)).attr("y", Math.floor(margin_left / 3));
        var chartColors, sizeScale = d3.scaleSqrt().range([ Math.floor(.1 * scope.circleSize), scope.circleSize ]);
        if (scope.contentGroup) if (chartColors = d3.scaleOrdinal(d3.ourSettings.chartColors).domain(availableGroups), 
        scope.groupCustomColors) {
            var groupCustomColorsHash = {};
            scope.groupCustomColors.forEach(function(custom) {
                groupCustomColorsHash[custom.group] = custom.color;
            });
            var chartColorsDefault = d3.scaleOrdinal(d3.ourSettings.chartColors).domain(availableGroups);
            chartColors = function(group) {
                return void 0 !== groupCustomColorsHash[group] ? groupCustomColorsHash[group] : chartColorsDefault(group);
            };
        } else chartColors = d3.scaleOrdinal(d3.ourSettings.chartColors).domain(availableGroups); else {
            var oneColor = d3.ourSettings.chartColors[0];
            chartColors = function() {
                return oneColor;
            };
        }
        drawScatterplot(svg, scope, availableGroups, xScale, yScale, sizeScale, chartColors);
        var legend = svg.select(".legend");
        if (availableGroups.length) {
            legend.classed("hidden", !1);
            var legends = legend.selectAll("g").data(availableGroups);
            legends.exit().remove();
            var enteredLegends = legends.enter().append("g").attr("class", function(d, i) {
                return "legend-" + i;
            }).attr("transform", function(d, i) {
                return "translate(0, " + (margin_top + i * Math.min((scope.height - margin_top - margin_bottom) / availableGroups.length, 30)) + ")";
            });
            enteredLegends.append("rect").attr("x", scope.width - scope.legendWidth).attr("width", Math.min(60, .3 * scope.legendWidth)).attr("height", Math.min((scope.height - margin_top - margin_bottom) / availableGroups.length * .6, 18)).style("fill", function(d) {
                return chartColors(d);
            }), enteredLegends.append("text").attr("x", scope.width - scope.legendWidth + Math.min(70, .35 * scope.legendWidth)).attr("y", .5 * Math.min((scope.height - margin_top - margin_bottom) / availableGroups.length, 30)).style("fill", "black").text(function(d) {
                return d;
            }), enteredLegends.merge(legends).classed("faded", function(d) {
                return -1 === scope.activeGroups.indexOf(d);
            }).on("click", function(d) {
                var setFaded = !d3.select(this).classed("faded");
                if (d3.select(this).classed("faded", setFaded), setFaded) scope.activeGroups.splice(scope.activeGroups.indexOf(d), 1); else for (var j2 = 0, j1 = 0; j1 < availableGroups.length; j1++) scope.activeGroups[j2] === availableGroups[j1] ? j2++ : availableGroups[j1] === d && scope.activeGroups.splice(j2, 0, d);
                drawScatterplot(svg, scope, availableGroups, xScale, yScale, sizeScale, chartColors);
            }).on("dblclick", function(d) {
                d3.event.preventDefault(), svg.select(".legend").selectAll("g").classed("faded", !0), 
                d3.select(this).classed("faded", !1), scope.activeGroups = [ d ], drawScatterplot(svg, scope, availableGroups, xScale, yScale, sizeScale, chartColors);
            }).on("contextmenu", function() {
                svg.select(".legend").selectAll("g").classed("faded", !1), scope.activeGroups = availableGroups.slice(0), 
                drawScatterplot(svg, scope, availableGroups, xScale, yScale, sizeScale, chartColors), 
                d3.event.preventDefault();
            });
        } else legend.classed("hidden", !0);
        var mouseoverShown = !1, mouseoverGroup = svg.select(".scatterplot-mouseover");
        mouseoverGroup.select(".scatterplot-mouseover-box").attr("width", Math.floor(.3 * scope.width)).attr("height", Math.floor(.15 * scope.height)), 
        svg.on("mousemove", function() {
            var pos = d3.mouse(this);
            if (pos[0] < margin_left || pos[0] > scope.width - margin_right || pos[1] < margin_top || pos[1] > scope.height - margin_bottom || "CIRCLE" !== d3.event.target.nodeName.toUpperCase()) return mouseoverShown && (mouseoverGroup.classed("hidden", !0), 
            mouseoverShown = !1), void scope.$apply(function() {
                scope.activeElement = void 0, notesViewer.showNotes();
            });
            var d = d3.select(d3.event.target).datum(), myKeyword = keywordsService.getDataKey(scope.contentFile, d, scope.columnsSpec, scope.contentY);
            scope.activeElement = {
                keyword: myKeyword,
                description: scope.contentTitle ? d[scope.contentTitle] : "",
                time: scope.currTime
            }, mouseoverGroup.attr("transform", "translate(" + (xScale(d[scope.contentX]) + 10) + ", " + (yScale(d[scope.contentY]) + 10) + ")").classed("hidden", !1);
            var line, mouseoverLines = scope.tooltip.replace(/{{([^}]+)}}/g, function(match, column) {
                return scope.columnFormats[column] ? scope.columnFormats[column](d[column]) : match;
            }).split("\n");
            for (line = 1; line <= 4; line++) mouseoverGroup.select(".scatterplot-mouseover-line-" + line).text(mouseoverLines[line - 1]);
            mouseoverShown = !0, scope.$apply(function() {
                notesViewer.showNotes(myKeyword);
            });
        });
    }, drawScatterplot = function(svg, scope, availableGroups, xScale, yScale, sizeScale, chartColors) {
        var filteredContent, timedContent = scope.content.filter(function(d) {
            return d[scope.contentTime].getTime() === scope.currTime.getTime();
        });
        filteredContent = availableGroups.length && availableGroups.length > scope.activeGroups.length ? timedContent.filter(function(d) {
            return -1 !== scope.activeGroups.indexOf(d[scope.contentGroup]);
        }) : timedContent;
        var xExtent = d3.extent(filteredContent, function(d) {
            return d[scope.contentX];
        });
        console.log("x domain setting..."), console.log(xExtent), console.log(scope.circleSize), 
        console.log(xScale.range()), console.log([ xExtent[0] - scope.circleSize * (xExtent[1] - xExtent[0]) / Math.abs(xScale.range()[1] - xScale.range()[0]), xExtent[1] + scope.circleSize * (xExtent[1] - xExtent[0]) / Math.abs(xScale.range()[1] - xScale.range()[0]) ]), 
        xScale.domain([ xExtent[0] - scope.circleSize * (xExtent[1] - xExtent[0]) / Math.abs(xScale.range()[1] - xScale.range()[0]), xExtent[1] + scope.circleSize * (xExtent[1] - xExtent[0]) / Math.abs(xScale.range()[1] - xScale.range()[0]) ]);
        var yExtent = d3.extent(filteredContent, function(d) {
            return d[scope.contentY];
        });
        yScale.domain([ yExtent[0] - scope.circleSize * (yExtent[1] - yExtent[0]) / Math.abs(yScale.range()[1] - yScale.range()[0]), yExtent[1] + scope.circleSize * (yExtent[1] - yExtent[0]) / Math.abs(yScale.range()[1] - yScale.range()[0]) ]), 
        scope.contentSize ? sizeScale.domain(d3.extent(filteredContent, function(d) {
            return d[scope.contentSize];
        })) : sizeScale.domain([ 0, 1 ]);
        var xAxis = d3.axisBottom(xScale).tickFormat(scope.columnFormats[scope.contentX] || d3.format("f")), xAxisContainer = svg.select(".x-axis");
        xAxisContainer.transition().duration(250).call(xAxis), xAxisContainer.selectAll("text").style("text-anchor", "end").attr("dx", "-1em").attr("dy", "-.55em").attr("transform", "rotate(-90)");
        var yAxis = d3.axisLeft(yScale).tickFormat(scope.columnFormats[scope.contentY] || d3.format("f"));
        svg.select(".y-axis").transition().duration(250).call(yAxis);
        var relevantKeys = {};
        scope.notesKeywords.forEach(function(k) {
            relevantKeys[k] = !0;
        }), console.log("Drawing data for scatterplot:"), console.log(timedContent);
        var circles = svg.select(".data").selectAll("circle").data(timedContent, function(d) {
            return keywordsService.getDataKey(void 0, d, scope.columnsSpec, void 0, scope.contentTime);
        });
        circles.exit().remove(), circles.enter().append("circle").attr("class", "scatterplot-element").attr("cx", function(d) {
            return xScale(d[scope.contentX]);
        }).attr("cy", function(d) {
            return yScale(d[scope.contentY]);
        }).merge(circles).attr("fill", availableGroups.length ? function(d) {
            return chartColors(d[scope.contentGroup]);
        } : chartColors()).classed("scatterplot-faded-out", !!(availableGroups.length && availableGroups.length > scope.activeGroups.length) && function(d) {
            return -1 === scope.activeGroups.indexOf(d[scope.contentGroup]);
        }).classed("scatterplot-has-notes", function(d) {
            return !0 === relevantKeys[keywordsService.getDataKey(scope.contentFile, d, scope.columnsSpec, scope.contentY)];
        }).transition().duration(250).attr("cx", function(d) {
            return xScale(d[scope.contentX]);
        }).attr("cy", function(d) {
            return yScale(d[scope.contentY]);
        }).attr("r", scope.contentSize ? function(d) {
            return sizeScale(d[scope.contentSize]);
        } : sizeScale(1));
    };
    return {
        restrict: "E",
        scope: {
            width: "=",
            height: "=",
            legendWidth: "=?",
            circleSize: "=",
            contentFile: "=",
            contentTime: "=",
            contentX: "=",
            contentY: "=",
            contentSize: "=?",
            contentGroup: "=?",
            contentTitle: "=?",
            tooltip: "=?",
            labelX: "=",
            labelY: "=",
            groupCustomColors: "=?",
            notesEnabled: "=",
            notesOptions: "=?"
        },
        require: "?^zoomKey",
        templateUrl: "common/directives/chartScatterplot.tmpl.html",
        link: function(scope, element, attrs, zoomKeyCtrl) {
            var svg, loadingIndicator;
            scope.loading = !1, scope.errorMessage = "", scope.content = [], scope.contentHash = "", 
            scope.notesKeywords = [], scope.currTime = void 0, scope.availableTime = [], scope.columnsSpec = [], 
            scope.columnKeywords = {}, scope.columnFormats = {}, scope.animationSpeed = 0, scope.contentGroup && !scope.legendWidth && (scope.legendWidth = Math.round(.25 * scope.width)), 
            (svg = d3.select(element[0]).append("svg")).append("clipPath").attr("id", "clip-path-" + scope.$id).append("rect").attr("class", "clip-rect"), 
            svg.append("g").attr("class", "data").attr("clip-path", "url(#clip-path-" + scope.$id + ")"), 
            svg.append("g").attr("class", "x-axis axis"), svg.append("text").attr("class", "x-axis-label axis-label"), 
            svg.append("g").attr("class", "y-axis axis"), svg.append("text").attr("class", "y-axis-label axis-label"), 
            svg.append("g").attr("class", "legend");
            var mouseoverGroup = svg.append("g").attr("class", "scatterplot-mouseover hidden");
            mouseoverGroup.append("rect").attr("class", "scatterplot-mouseover-box");
            var mouseoverTextElement = mouseoverGroup.append("text").attr("class", "scatterplot-mouseover-text");
            mouseoverTextElement.append("tspan").attr("class", "scatterplot-mouseover-line-1").attr("x", 0).attr("dy", "1.2em"), 
            mouseoverTextElement.append("tspan").attr("class", "scatterplot-mouseover-line-2").attr("x", 0).attr("dy", "1.2em"), 
            mouseoverTextElement.append("tspan").attr("class", "scatterplot-mouseover-line-3").attr("x", 0).attr("dy", "1.2em"), 
            mouseoverTextElement.append("tspan").attr("class", "scatterplot-mouseover-line-4").attr("x", 0).attr("dy", "1.2em"), 
            scope.notesEnabled && svg.on("dblclick", function() {
                return d3.event.preventDefault(), function(myElement, notesOptions, zoomKeyCtrl) {
                    myElement && ngDialog.open({
                        template: "common/directives/notesDialog.tmpl.html",
                        className: "ngdialog-theme-default",
                        closeByDocument: !1,
                        data: {
                            keywordID: myElement.keyword,
                            sourceName: myElement.description + " at " + d3.timeFormat("%Y-%m-%d")(myElement.time),
                            notesOptions: notesOptions,
                            sourceLink: zoomKeyCtrl ? zoomKeyCtrl.getZoomLink(d3.timeFormat("%Y-%m-%d")(myElement.time)) : ""
                        }
                    });
                }(scope.activeElement, scope.notesOptions, zoomKeyCtrl);
            });
            var notesListener = function(allKeywords) {
                var oldNotes = scope.notesKeywords ? scope.notesKeywords.length : 0;
                scope.notesKeywords = allKeywords, scope.content && 0 < scope.content.length && (0 < oldNotes || 0 < scope.notesKeywords.length) && draw(svg, scope);
            }, zoomListener = function(zoomHash) {
                if (zoomHash.match(/^([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])/)) {
                    var zoomTo = zoomHash.substr(0, 10), timeIndex = scope.availableTime.findIndex(function(d) {
                        return d3.ourSettings.formats.date(new Date(d)) === zoomTo;
                    });
                    return null !== timeIndex ? (scope.selectedTimeIndex = timeIndex, $timeout(function() {
                        element.find("input").val(scope.selectedTimeIndex);
                    }), "") : void 0;
                }
            };
            scope.contentFile && (scope.loading = !0, svg.classed("hidden", !0), loadingIndicator = d3.select(element[0]).append("div").style("height", scope.height + "px").style("width", scope.width + "px").classed("loadingIndicator", !0), 
            datafileReader.readDatafile(scope.contentFile).then(function(res) {
                console.log("Obtained data for chart: "), console.log(res), scope.content = res[0], 
                scope.columnsSpec = res[1], scope.columnKeywords = {}, scope.columnFormats = {}, 
                scope.columnsSpec.forEach(function(colDef) {
                    scope.columnKeywords[colDef.display] = colDef.keyword, scope.columnFormats[colDef.display] = d3.ourSettings.formats[colDef.format];
                });
                var availableTimes = {};
                scope.content.forEach(function(d) {
                    availableTimes[d[scope.contentTime].getTime()] = !0;
                }), scope.availableTime = Object.keys(availableTimes).map(function(time) {
                    return parseInt(time, 10);
                }).sort(function(a, b) {
                    return a - b;
                }), scope.selectedTimeIndex = scope.availableTime.length - 1, zoomKeyCtrl && zoomKeyCtrl.onZoom(zoomListener), 
                scope.currTime = new Date(), scope.currTime.setTime(scope.availableTime[scope.selectedTimeIndex]), 
                $timeout(function() {
                    element.find("input").val(scope.selectedTimeIndex);
                }), scope.contentHash = miscServices.hashCode(JSON.stringify(scope.content)), scope.errorMessage = "", 
                scope.loading = !1;
            }, function(err) {
                console.log("An error occurred loading the graph: "), console.log(err), scope.content = [], 
                scope.contentHash = "", scope.errorMessage = gettext("An error occurred while loading this graph:") + " " + err, 
                scope.loading = !1;
            }).then(function() {
                scope.notesEnabled && notesViewer.loadNotes("data/" + scope.contentFile + "/", notesListener);
            })), scope.startAnimation = function() {
                var nextStep;
                scope.animationSpeed ? scope.animationSpeed++ : (nextStep = function() {
                    scope.selectedTimeIndex = Number(scope.selectedTimeIndex) || 0, scope.selectedTimeIndex = scope.selectedTimeIndex === scope.availableTime.length - 1 ? 0 : scope.selectedTimeIndex + 1, 
                    console.log(scope.selectedTimeIndex), console.log("nextStep done."), scope.animationSpeed && $timeout(nextStep, 800 / scope.animationSpeed);
                }, scope.animationSpeed = 1, nextStep());
            }, scope.stopAnimation = function() {
                scope.animationSpeed = 0;
            }, scope.$watch("loading", function(newVal, oldVal, scope) {
                scope.loading ? (svg.classed("hidden", !0), loadingIndicator.attr("class", "loadingIndicator")) : scope.errorMessage ? (svg.classed("hidden", !0), 
                loadingIndicator.attr("class", "loadingErrorMessage"), loadingIndicator.text(scope.errorMessage)) : (svg.classed("hidden", !1), 
                loadingIndicator.attr("class", "loadingIndicator hidden"));
            }, !0), scope.$watch("contentHash", function(newVal, oldVal, scope) {
                scope.content && 0 < scope.content.length && draw(svg, scope);
            }, !0), scope.$watch("selectedTimeIndex", function(newVal, oldVal, scope) {
                newVal !== oldVal && scope.availableTime[newVal] && (scope.currTime.setTime(scope.availableTime[newVal]), 
                scope.content && 0 < scope.content.length && draw(svg, scope));
            });
        }
    };
} ]).directive("tableChart", [ "$timeout", "$filter", "ngDialog", "gettext", "d3", "miscServices", "notesViewer", "keywordsService", "sidebarService", "datafileReader", function($timeout, $filter, ngDialog, gettext, d3, miscServices, notesViewer, keywordsService, sidebarService, datafileReader) {
    return {
        restrict: "E",
        scope: {
            contentFile: "=",
            contentTime: "=?",
            contentFirstColumn: "=",
            contentColumns: "=",
            columnColumn: "=?",
            valueColumn: "=?",
            heatmapFrom: "=?",
            heatmapTo: "=?",
            showSparklines: "=?",
            showColumnSparklines: "=?",
            sparklinesUseGlobalMax: "=?",
            notesEnabled: "=",
            notesOptions: "=?"
        },
        templateUrl: "common/directives/chartTable.tmpl.html",
        require: "?^zoomKey",
        link: function(scope, element, attrs, zoomKeyCtrl) {
            scope.loading = !1, scope.errorMessage = "", scope.content = [], scope.contentHash = "", 
            scope.tableMin = 0, scope.tableMax = 0, scope.notesKeywords = [], scope.currTime = void 0, 
            scope.availableTime = [], scope.notesKeywordsMap = {}, scope.dynamicRows = {}, scope.dynamicColumns = {}, 
            scope.visibleColumns = [], scope.columnsSpec = [], scope.animationSpeed = 0, scope.heatmapColor = function() {
                return "#ffffff";
            }, scope.onlyCurrTime = function(value) {
                return !scope.currTime || value[scope.contentTime].getTime() === scope.currTime.getTime();
            };
            var getContentColumns = function(d) {
                return void 0 === d ? scope.columnColumn ? scope.visibleColumns : scope.contentColumns : scope.columnColumn ? scope.dynamicColumns[d[scope.contentTime].getTime()] : scope.contentColumns;
            };
            scope.sortColumn = null, scope.sortReverse = !1, scope.toggleSort = function(col) {
                scope.sortColumn === col ? scope.sortReverse = !scope.sortReverse : (scope.sortColumn = col, 
                scope.sortReverse = !1);
            }, scope.sortColumnGetter = function(i) {
                return scope.columnFormats[scope.sortColumn] !== d3.ourSettings.formats.number && scope.columnFormats[scope.sortColumn] !== d3.ourSettings.formats.percentage && scope.columnFormats[scope.sortColumn] !== d3.ourSettings.formats.integer || !isNaN(scope.content[i][scope.sortColumn]) && "" !== scope.content[i][scope.sortColumn] ? scope.content[i][scope.sortColumn] : Number.NEGATIVE_INFINITY;
            };
            var visibleRowsColumnsUpdater = function() {
                scope.visibleRows = scope.dynamicRows[scope.currTime.getTime()], scope.columnColumn ? scope.visibleColumns = scope.dynamicColumns[scope.currTime.getTime()] : scope.visibleColumns = scope.contentColumns;
            }, sparklinesUpdater = function() {
                scope.columnSparklinesContent = {}, scope.visibleRows && scope.showColumnSparklines && getContentColumns().forEach(function(col) {
                    scope.columnSparklinesContent[col] = $filter("orderBy")(scope.visibleRows, scope.sortColumnGetter, scope.sortReverse).map(function(row) {
                        return scope.content[row][col];
                    });
                });
            };
            scope.addChartNote = function(evt) {
                if (scope.notesEnabled) {
                    console.log("Received double click event:"), console.log(evt);
                    var el = angular.element(evt.target);
                    console.log("Element and its x-notes-keyword attr:"), console.log(el), console.log(el.attr("x-notes-keyword")), 
                    el.attr("x-notes-keyword") && ngDialog.open({
                        template: "common/directives/notesDialog.tmpl.html",
                        className: "ngdialog-theme-default",
                        closeByDocument: !1,
                        data: {
                            keywordID: el.attr("x-notes-keyword"),
                            sourceName: el.attr("x-notes-column") + " for " + el.attr("x-notes-entry") + (scope.currTime ? " (at " + d3.ourSettings.formats.time(scope.currTime) + ")" : ""),
                            notesOptions: scope.notesOptions,
                            sourceLink: zoomKeyCtrl ? zoomKeyCtrl.getZoomLink(d3.timeFormat("%Y-%m-%d")(scope.currTime)) : ""
                        }
                    });
                }
            }, scope.mouseOver = function(evt) {
                if (scope.notesEnabled) {
                    console.log("Received mouseover event:"), console.log(evt);
                    var el = angular.element(evt.target);
                    el.attr("x-notes-keyword") && el.hasClass("table-chart-has-notes") ? notesViewer.showNotes(el.attr("x-notes-keyword")) : notesViewer.showNotes();
                }
            }, scope.mouseLeave = function() {
                notesViewer.showNotes();
            };
            var updateHasNotes = function() {
                var allColumns = getContentColumns().concat(scope.contentFirstColumn), i = 0, hasNotesFinder = function(c) {
                    scope.content[i]._hasNotes[c] = !0 === scope.notesKeywordsMap[scope.content[i]._notesKeywords[c]];
                };
                for (i = 0; i < scope.content.length; i++) scope.content[i]._hasNotes = {}, allColumns.forEach(hasNotesFinder);
            }, notesListener = function(allKeywords) {
                var oldNotes = scope.notesKeywords ? scope.notesKeywords.length : 0;
                scope.notesKeywords = allKeywords, scope.notesKeywordsMap = {}, scope.notesKeywords.forEach(function(k) {
                    scope.notesKeywordsMap[k] = !0;
                }), scope.content && 0 < scope.content.length && (0 < oldNotes || 0 < scope.notesKeywords.length) && updateHasNotes();
            }, zoomListener = function(zoomHash) {
                if (zoomHash.match(/^([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])/)) {
                    var zoomTo = zoomHash.substr(0, 10), timeIndex = scope.availableTime.findIndex(function(d) {
                        return d3.ourSettings.formats.date(new Date(d)) === zoomTo;
                    });
                    return null !== timeIndex ? (scope.selectedTimeIndex = timeIndex, $timeout(function() {
                        element.find("input").val(scope.selectedTimeIndex);
                    }), "") : void 0;
                }
            };
            scope.contentFile && (scope.loading = !0, datafileReader.readDatafile(scope.contentFile).then(function(res) {
                var rows = res[0];
                if (scope.columnsSpec = res[1], console.log("Obtained data for chart: "), console.log(res), 
                scope.columnKeywords = {}, scope.columnFormats = {}, scope.columnColors = {}, scope.columnsSpec.forEach(function(colDef) {
                    scope.columnKeywords[colDef.display] = colDef.keyword, scope.columnFormats[colDef.display] = d3.ourSettings.formats[colDef.format], 
                    scope.columnColors[colDef.display] = colDef.color;
                }), scope.columnColumn) {
                    var keyToLine = {};
                    scope.content = [], rows.forEach(function(d) {
                        var thisLine;
                        if (console.log("Transposing received row: "), console.log(d), d[scope.contentTime] && void 0 !== d[scope.columnColumn] && "" !== d[scope.columnColumn]) {
                            var lineKey = d[scope.contentTime] + "/" + keywordsService.getDataKey(void 0, d, scope.columnsSpec, void 0, [ scope.contentTime, scope.columnColumn ]);
                            void 0 === keyToLine[lineKey] ? ((thisLine = {})[scope.contentFirstColumn] = d[scope.contentFirstColumn], 
                            thisLine[scope.contentTime] = d[scope.contentTime], thisLine._notesKeywords = {}, 
                            thisLine._notesKeywords[scope.contentFirstColumn] = keywordsService.getDataKey(scope.contentFile, d, scope.columnsSpec, scope.contentFirstColumn, scope.columnColumn), 
                            keyToLine[lineKey] = thisLine, scope.content.push(thisLine), void 0 === scope.dynamicColumns[d[scope.contentTime].getTime()] && (scope.dynamicColumns[d[scope.contentTime].getTime()] = [])) : thisLine = keyToLine[lineKey], 
                            thisLine[d[scope.columnColumn]] = d[scope.valueColumn], thisLine._notesKeywords[d[scope.columnColumn]] = keywordsService.getDataKey(scope.contentFile, d, scope.columnsSpec, scope.valueColumn), 
                            -1 === scope.dynamicColumns[d[scope.contentTime].getTime()].indexOf(d[scope.columnColumn]) && scope.dynamicColumns[d[scope.contentTime].getTime()].push(d[scope.columnColumn]);
                        }
                    });
                } else scope.content = rows.map(function(d) {
                    var ret = {};
                    return ret[scope.contentFirstColumn] = d[scope.contentFirstColumn], ret[scope.contentTime] = d[scope.contentTime], 
                    ret._notesKeywords = {}, ret._notesKeywords[scope.contentFirstColumn] = keywordsService.getDataKey(scope.contentFile, d, scope.columnsSpec, scope.contentFirstColumn), 
                    scope.contentColumns.forEach(function(c) {
                        ret[c] = d[c], ret._notesKeywords[c] = keywordsService.getDataKey(scope.contentFile, d, scope.columnsSpec, c);
                    }), ret;
                });
                if (console.log("TABLE: Completed mapping of content from datafile:"), console.log([ scope.content, scope.contentColumns, scope.dynamicColumns ]), 
                scope.tableMin = d3.min(scope.content, function(d) {
                    return d3.min(getContentColumns(d), function(c) {
                        return d[c];
                    });
                }), scope.tableMax = d3.max(scope.content, function(d) {
                    return d3.max(getContentColumns(d), function(c) {
                        return d[c];
                    });
                }), scope.dynamicRows = {}, scope.content.forEach(function(d, i) {
                    scope.dynamicRows[d[scope.contentTime].getTime()] ? scope.dynamicRows[d[scope.contentTime].getTime()].push(i) : scope.dynamicRows[d[scope.contentTime].getTime()] = [ i ];
                }), scope.notesKeywords && 0 < scope.notesKeywords.length && updateHasNotes(), scope.showSparklines) {
                    var i = 0, getContentColumn = function(c) {
                        return scope.content[i][c];
                    };
                    for (i = 0; i < scope.content.length; i++) scope.content[i]._sparklineContent = getContentColumns(scope.content[i]).map(getContentColumn);
                }
                scope.heatmapFrom && scope.heatmapTo && (scope.heatmapColor = d3.scaleLinear().domain([ scope.tableMin, scope.tableMax ]).range([ scope.heatmapFrom, scope.heatmapTo ]));
                var availableTimes = {};
                scope.content.forEach(function(d) {
                    availableTimes[d[scope.contentTime].getTime()] = !0;
                }), scope.availableTime = Object.keys(availableTimes).map(function(time) {
                    return parseInt(time, 10);
                }).sort(function(a, b) {
                    return a - b;
                }), scope.selectedTimeIndex = scope.availableTime.length - 1, zoomKeyCtrl && zoomKeyCtrl.onZoom(zoomListener), 
                scope.currTime = new Date(), scope.currTime.setTime(scope.availableTime[scope.selectedTimeIndex]), 
                visibleRowsColumnsUpdater(), sparklinesUpdater(), $timeout(function() {
                    element.find("input").val(scope.selectedTimeIndex);
                }), scope.contentHash = miscServices.hashCode(JSON.stringify(scope.content)), scope.errorMessage = "", 
                scope.loading = !1;
            }, function(err) {
                console.log("An error occurred loading the graph: "), console.log(err), scope.content = [], 
                scope.contentHash = "", scope.errorMessage = gettext("An error occurred while loading this graph:") + " " + err, 
                scope.loading = !1;
            }).then(function() {
                scope.notesEnabled && notesViewer.loadNotes("data/" + scope.contentFile + "/", notesListener);
            })), scope.startAnimation = function() {
                var nextStep;
                scope.animationSpeed ? scope.animationSpeed++ : (nextStep = function() {
                    scope.selectedTimeIndex = Number(scope.selectedTimeIndex) || 0, scope.selectedTimeIndex = scope.selectedTimeIndex === scope.availableTime.length - 1 ? 0 : scope.selectedTimeIndex + 1, 
                    scope.animationSpeed && $timeout(nextStep, 800 / scope.animationSpeed);
                }, scope.animationSpeed = 1, nextStep());
            }, scope.stopAnimation = function() {
                scope.animationSpeed = 0;
            }, scope.$watch("selectedTimeIndex", function(newVal, oldVal, scope) {
                newVal !== oldVal && scope.availableTime[newVal] && (scope.currTime.setTime(scope.availableTime[newVal]), 
                visibleRowsColumnsUpdater(), sparklinesUpdater());
            }), scope.$watch("sortColumn", sparklinesUpdater), scope.$watch("sortReverse", sparklinesUpdater);
        }
    };
} ]).directive("portfolioChart", [ "$timeout", "ngDialog", "gettext", "d3", "miscServices", "notesViewer", "keywordsService", "sidebarService", "datafileReader", function($timeout, ngDialog, gettext, d3, miscServices, notesViewer, keywordsService, sidebarService, datafileReader) {
    var draw = function(svg, svgBrush, scope) {
        var margin_left = Math.round(.05 * scope.width), margin_right = Math.round(.05 * scope.width + (scope.contentGroup ? scope.legendWidth : 0)), margin_top = Math.round(.05 * scope.height), margin_bottom = Math.round(.05 * scope.height) + 100, availableGroups = [];
        if (scope.contentGroup) {
            var tmpGroupHash = {};
            scope.content.forEach(function(d) {
                tmpGroupHash[d[scope.contentGroup]] = !0;
            }), availableGroups = Object.keys(tmpGroupHash);
        }
        scope.activeGroups && scope.activeGroups.length || (scope.activeGroups = availableGroups.slice()), 
        Array.isArray(scope.lineColumns) && !scope.activeLines ? scope.activeLines = scope.lineColumns.slice() : scope.activeLines || (scope.activeLines = []);
        var legendEntries = [];
        availableGroups.forEach(function(d) {
            legendEntries.push({
                type: "group",
                label: d
            });
        }), Array.isArray(scope.lineColumns) && scope.lineColumns.forEach(function(d) {
            legendEntries.push({
                type: "line",
                label: d
            });
        }), svg.attr("width", scope.width).attr("height", scope.height), svg.select(".clip-rect").attr("x", margin_left).attr("y", margin_top).attr("width", scope.width - margin_left - margin_right).attr("height", scope.height - margin_top - margin_bottom);
        var xScale = d3.scaleLinear().range([ margin_left, scope.width - margin_right ]);
        svg.select(".x-axis").attr("transform", "translate(0, " + (scope.height - margin_bottom) + ")"), 
        svg.select(".x-axis-label").text(scope.labelX).attr("x", Math.floor(margin_left + (scope.width - margin_left - margin_right) / 2)).attr("y", Math.floor(scope.height - margin_bottom / 2));
        var chartColors, yScale = d3.scaleLinear().range([ scope.height - margin_bottom, margin_top ]);
        if (svg.select(".y-axis").attr("transform", "translate(" + margin_left + ")"), svg.select(".y-axis-label").text(scope.labelY).attr("transform", "rotate(-90)").attr("x", -1 * Math.floor(margin_top + (scope.height - margin_top - margin_bottom) / 2)).attr("y", Math.floor(margin_left / 3)), 
        scope.contentGroup) if (scope.groupCustomColors) {
            var groupCustomColorsHash = {};
            scope.groupCustomColors.forEach(function(custom) {
                groupCustomColorsHash[custom.group] = custom.color;
            });
            var chartColorsDefault = d3.scaleOrdinal(d3.ourSettings.chartColors).domain(legendEntries);
            chartColors = function(group) {
                return void 0 !== groupCustomColorsHash[group] ? groupCustomColorsHash[group] : chartColorsDefault(group);
            };
        } else chartColors = d3.scaleOrdinal(d3.ourSettings.chartColors).domain(legendEntries); else chartColors = d3.scaleOrdinal(d3.ourSettings.chartColors).domain([ "MAIN" ].concat(legendEntries));
        scope.brushExtent || drawBoxes(svg, scope, availableGroups, xScale, yScale, chartColors, !0), 
        svgBrush.attr("width", scope.width).attr("height", .1 * scope.height);
        var xScaleBrush = d3.scaleTime().range(xScale.range()), yScaleBrush = d3.scaleLinear().range([ Math.floor(.1 * scope.height), 0 ]);
        drawBoxes(svgBrush, scope, availableGroups, xScaleBrush, yScaleBrush, chartColors, !0);
        var brush = d3.brushX();
        brush.extent([ [ xScaleBrush.range()[0], yScaleBrush.range()[1] ], [ xScaleBrush.range()[1], yScaleBrush.range()[0] ] ]);
        var brushContainer = svgBrush.select(".brush").call(brush);
        brush.on("end", function() {
            d3.event.selection ? (xScale.domain(d3.event.selection.map(xScaleBrush.invert)), 
            scope.brushExtent = d3.event.selection.map(xScaleBrush.invert)) : (xScale.domain(xScaleBrush.domain()), 
            scope.brushExtent = void 0), drawBoxes(svg, scope, availableGroups, xScale, yScale, chartColors, !1);
        }), scope.brushExtent && (console.log("Moving brush to existing brushExtent..."), 
        console.log([ scope.brushExtent, scope.brushExtent.map(xScaleBrush) ]), brushContainer.call(brush.move, scope.brushExtent.map(xScaleBrush)));
        var legend = svg.select(".legend");
        if (legendEntries.length) {
            legend.classed("hidden", !1);
            var legends = legend.selectAll("g").data(legendEntries, function(d) {
                return d.type + "-" + d.label;
            }), enteredLegends = legends.enter().append("g").attr("class", function(d, i) {
                return "legend-" + i + " legend-" + d.type;
            }).attr("transform", function(d, i) {
                return "translate(0, " + (margin_top + i * Math.min((scope.height - margin_top - margin_bottom) / legendEntries.length, 30)) + ")";
            });
            enteredLegends.append("rect").attr("x", scope.width - scope.legendWidth).attr("y", function(d) {
                return "line" === d.type ? Math.min((scope.height - margin_top - margin_bottom) / legendEntries.length * .2, 6) : 0;
            }).attr("width", Math.min(60, .3 * scope.legendWidth)).attr("height", function(d) {
                return "line" === d.type ? Math.min((scope.height - margin_top - margin_bottom) / legendEntries.length * .2, 6) : Math.min((scope.height - margin_top - margin_bottom) / legendEntries.length * .6, 18);
            }).style("fill", function(d) {
                return chartColors(d.label);
            }), enteredLegends.append("text").attr("x", scope.width - scope.legendWidth + Math.min(70, .35 * scope.legendWidth)).attr("y", .5 * Math.min((scope.height - margin_top - margin_bottom) / legendEntries.length, 30)).style("fill", "black").text(function(d) {
                return d.label;
            }), enteredLegends.merge(legends).classed("faded", function(d) {
                return "group" === d.type && -1 === scope.activeGroups.indexOf(d.label) || "line" === d.type && -1 === scope.activeLines.indexOf(d.label);
            }).on("click", function(d) {
                var setFaded = !d3.select(this).classed("faded");
                d3.select(this).classed("faded", setFaded);
                var arrayToChange = "line" === d.type ? scope.activeLines : scope.activeGroups;
                if (setFaded) arrayToChange.splice(arrayToChange.indexOf(d.label), 1); else for (var j2 = 0, j1 = 0; j1 < legendEntries.length; j1++) arrayToChange[j2] === legendEntries[j1].label && d.type === legendEntries[j1].type ? j2++ : legendEntries[j1] === d && arrayToChange.splice(j2, 0, d.label);
                drawBoxes(svg, scope, availableGroups, xScale, yScale, chartColors, !1), drawBoxes(svgBrush, scope, availableGroups, xScaleBrush, yScaleBrush, chartColors, !1);
            }).on("dblclick", function(d) {
                d3.event.preventDefault(), svg.selectAll(".legend-" + d.type).classed("faded", !0), 
                d3.select(this).classed("faded", !1), "line" === d.type ? scope.activeLines = [ d.label ] : scope.activeGroups = [ d.label ], 
                drawBoxes(svg, scope, availableGroups, xScale, yScale, chartColors, !1), drawBoxes(svgBrush, scope, availableGroups, xScaleBrush, yScaleBrush, chartColors, !1);
            }).on("contextmenu", function(d) {
                svg.selectAll(".legend-" + d.type).classed("faded", !1), "line" === d.type ? scope.activeLines = scope.lineColumns.slice(0) : scope.activeGroups = availableGroups.slice(0), 
                drawBoxes(svg, scope, availableGroups, xScale, yScale, chartColors, !1), drawBoxes(svgBrush, scope, availableGroups, xScaleBrush, yScaleBrush, chartColors, !1), 
                d3.event.preventDefault();
            });
        } else legend.classed("hidden", !0);
        var mouseoverShown = !1, mouseoverGroup = svg.select(".portfolio-chart-mouseover");
        mouseoverGroup.select(".portfolio-chart-mouseover-box").attr("width", Math.floor(.3 * scope.width)).attr("height", Math.floor(.15 * scope.height)), 
        svg.on("mousemove", function() {
            var pos = d3.mouse(this);
            if (pos[0] < margin_left || pos[0] > scope.width - margin_right || pos[1] < margin_top || pos[1] > scope.height - margin_bottom || "RECT" !== d3.event.target.nodeName.toUpperCase()) return mouseoverShown && (mouseoverGroup.classed("hidden", !0), 
            mouseoverShown = !1), void scope.$apply(function() {
                scope.activeElement = void 0, notesViewer.showNotes();
            });
            var d = d3.select(d3.event.target).datum(), myKeyword = keywordsService.getDataKey(scope.contentFile, d, scope.columnsSpec, scope.contentY), shortKeyword = keywordsService.getDataKey(void 0, d, scope.columnsSpec);
            scope.activeElement = {
                keyword: myKeyword,
                shortKeyword: shortKeyword,
                description: scope.contentTitle ? d[scope.contentTitle] : "",
                time: scope.currTime
            }, mouseoverGroup.attr("transform", "translate(" + xScale(d._portfolioStartX + d[scope.contentX] / 2) + ", " + (yScale(d[scope.contentY]) + 10) + ")").classed("hidden", !1);
            var line, mouseoverLines = scope.tooltip.replace(/{{([^}]+)}}/g, function(match, column) {
                return scope.columnFormats[column] ? scope.columnFormats[column](d[column]) : match;
            }).split("\n");
            for (console.log("Mapped mouseover tooltip:"), console.log([ scope.tooltip, mouseoverLines ]), 
            line = 1; line <= 4; line++) mouseoverGroup.select(".portfolio-chart-mouseover-line-" + line).text(mouseoverLines[line - 1]);
            mouseoverShown = !0, scope.$apply(function() {
                notesViewer.showNotes(myKeyword);
            });
        });
    }, drawBoxes = function(svg, scope, availableGroups, xScale, yScale, chartColors, setXDomain) {
        var filteredContent, yScaleDomain, timedContent = scope.content.filter(function(d) {
            return d[scope.contentTime].getTime() === scope.currTime.getTime();
        });
        if (setXDomain) {
            var xMax = d3.max(timedContent, function(d) {
                return d._portfolioStartX + d[scope.contentX];
            });
            xScale.domain([ 0, xMax ]), console.log("Scaling xAxis:"), console.log(timedContent), 
            console.log(xMax);
        }
        filteredContent = availableGroups.length && availableGroups.length > scope.activeGroups.length ? timedContent.filter(function(d) {
            return -1 !== scope.activeGroups.indexOf(d[scope.contentGroup]) && d._portfolioStartX <= xScale.domain()[1] && d._portfolioStartX + d[scope.contentX] >= xScale.domain()[0];
        }) : timedContent.filter(function(d) {
            return d._portfolioStartX <= xScale.domain()[1] && d._portfolioStartX + d[scope.contentX] >= xScale.domain()[0];
        }), void 0 === (yScaleDomain = scope.activeLines.length ? [ d3.min([ 0, d3.min(filteredContent, function(d) {
            return d3.min([ d[scope.contentY] ].concat(scope.activeLines.map(function(lineKey) {
                return d[lineKey];
            })));
        }) ]), d3.max(filteredContent, function(d) {
            return d3.max([ d[scope.contentY] ].concat(scope.activeLines.map(function(lineKey) {
                return d[lineKey];
            })));
        }) ] : [ d3.min([ 0, d3.min(filteredContent, function(d) {
            return d[scope.contentY];
        }) ]), d3.max(filteredContent, function(d) {
            return d[scope.contentY];
        }) ])[1] && (yScaleDomain[1] = 0), yScale.domain(yScaleDomain), console.log("Scaling yAxis:"), 
        console.log(filteredContent), console.log([ 0, d3.max(filteredContent, function(d) {
            return d[scope.contentY];
        }) ]);
        var xAxis = d3.axisBottom(xScale).tickFormat(scope.columnFormats[scope.contentX] || d3.format(".2f")), xAxisContainer = svg.select(".x-axis");
        xAxisContainer.transition().duration(250).call(xAxis), xAxisContainer.selectAll("text").style("text-anchor", "end").attr("dx", "-1em").attr("dy", "-.55em").attr("transform", "rotate(-90)");
        var yAxis = d3.axisLeft(yScale).tickFormat(scope.columnFormats[scope.contentY] || d3.format(".2f"));
        svg.select(".y-axis").transition().duration(250).call(yAxis);
        var relevantKeys = {};
        scope.notesKeywords.forEach(function(k) {
            relevantKeys[k] = !0;
        }), console.log("Drawing data for portfolio chart:"), console.log(timedContent);
        var lines, rects = svg.select(".data").selectAll("rect").data(timedContent, function(d) {
            return keywordsService.getDataKey(void 0, d, scope.columnsSpec, void 0, scope.contentTime);
        });
        if (rects.exit().remove(), rects.enter().append("rect").attr("class", "portfolio-chart-element").attr("x", function(d) {
            return xScale(d._portfolioStartX);
        }).attr("width", function(d) {
            return xScale(d._portfolioStartX + d[scope.contentX]) - xScale(d._portfolioStartX);
        }).attr("y", yScale(0)).attr("height", 0).merge(rects).attr("fill", availableGroups.length ? function(d) {
            return chartColors(d[scope.contentGroup]);
        } : chartColors("MAIN")).classed("portfolio-chart-faded-out", !!(availableGroups.length && availableGroups.length > scope.activeGroups.length) && function(d) {
            return -1 === scope.activeGroups.indexOf(d[scope.contentGroup]);
        }).classed("portfolio-chart-has-notes", function(d) {
            return !0 === relevantKeys[keywordsService.getDataKey(scope.contentFile, d, scope.columnsSpec, scope.contentY)];
        }).transition().duration(250).attr("x", function(d) {
            return xScale(d._portfolioStartX);
        }).attr("y", function(d) {
            return yScale(0 <= d[scope.contentY] ? d[scope.contentY] : 0);
        }).attr("width", function(d) {
            return xScale(d._portfolioStartX + d[scope.contentX]) - xScale(d._portfolioStartX);
        }).attr("height", function(d) {
            return Math.abs(yScale(0) - yScale(d[scope.contentY]));
        }), Array.isArray(scope.lineColumns) && 1 <= scope.lineColumns.length && (rects.enter().empty() || svg.select(".data").selectAll(".chartLine").remove(), 
        (lines = svg.select(".data").selectAll(".chartLine").data(scope.lineColumns)).exit().remove(), 
        lines.enter().append("path").attr("class", function(k, i) {
            return "portfolio-chart-line chartLine chartPath-" + i;
        }).merge(lines).classed("faded", function(k) {
            return -1 === scope.activeLines.indexOf(k);
        }).style("stroke", function(k) {
            return scope.columnColors[k] ? scope.columnColors[k] : chartColors(k);
        }).transition().duration(250).attr("d", function(k) {
            return d3.line().curve(d3.curveStepBefore).x(function(d, i) {
                return xScale(d._portfolioStartX + (1 <= i ? d[scope.contentX] : 0));
            }).y(function(d) {
                return yScale(d[k]);
            })(timedContent);
        })), void 0 !== scope.contentDivide) {
            var divisionsData = [], currDivision = "";
            timedContent.forEach(function(d) {
                currDivision !== d[scope.contentDivide] && (divisionsData.push({
                    start: d._portfolioStartX,
                    label: d[scope.contentDivide]
                }), currDivision = d[scope.contentDivide]), divisionsData[divisionsData.length - 1].end = d._portfolioStartX + d[scope.contentX];
            }), (!rects.enter().empty() || lines && !lines.enter().empty()) && (svg.select(".data").selectAll(".portfolio-division-line").remove(), 
            svg.select(".data").selectAll(".portfolio-division-text").remove());
            var divisionLines = svg.select(".data").selectAll(".portfolio-division-line").data(divisionsData, function(d) {
                return d.label;
            });
            divisionLines.exit().remove(), divisionLines.enter().append("line").attr("class", "portfolio-division-line").attr("x1", function(d) {
                return xScale(d.end);
            }).attr("x2", function(d) {
                return xScale(d.end);
            }).merge(divisionLines).attr("y1", yScale.range()[0]).attr("y2", yScale.range()[1]).transition().duration(250).attr("x1", function(d) {
                return xScale(d.end);
            }).attr("x2", function(d) {
                return xScale(d.end);
            });
            var divisionTexts = svg.select(".data").selectAll(".portfolio-division-text").data(divisionsData, function(d) {
                return d.label;
            });
            divisionTexts.exit().remove(), divisionTexts.enter().append("text").attr("class", "portfolio-division-text").text(function(d) {
                return d.label;
            }).attr("x", function(d) {
                return Math.round((xScale(d.end) + xScale(d.start)) / 2);
            }).merge(divisionTexts).classed("hidden", function(d) {
                return xScale(d.end) - xScale(d.start) < 50;
            }).attr("y", Math.round(yScale.range()[0] + .8 * (yScale.range()[1] - yScale.range()[0]))).transition().duration(250).attr("x", function(d) {
                return Math.round((xScale(d.end) + xScale(d.start)) / 2);
            });
        }
    };
    return {
        restrict: "E",
        scope: {
            width: "=",
            height: "=",
            legendWidth: "=?",
            contentFile: "=",
            contentTime: "=",
            contentDivide: "=?",
            contentX: "=",
            contentY: "=",
            contentGroup: "=?",
            contentTitle: "=?",
            tooltip: "=?",
            lineColumns: "=?",
            labelX: "=",
            labelY: "=",
            groupCustomColors: "=?",
            notesEnabled: "=",
            notesOptions: "=?"
        },
        require: "?^zoomKey",
        templateUrl: "common/directives/chartPortfolio.tmpl.html",
        link: function(scope, element, attrs, zoomKeyCtrl) {
            var svg, svgBrush, loadingIndicator;
            scope.loading = !1, scope.errorMessage = "", scope.content = [], scope.contentHash = "", 
            scope.notesKeywords = [], scope.currTime = void 0, scope.availableTime = [], scope.brushExtent = void 0, 
            scope.columnFormats = {}, scope.columnColors = {}, scope.columnsSpec = [], scope.animationSpeed = 0, 
            scope.contentGroup && !scope.legendWidth && (scope.legendWidth = Math.round(.25 * scope.width)), 
            (svg = d3.select(element[0]).append("svg")).append("clipPath").attr("id", "clip-path-" + scope.$id).append("rect").attr("class", "clip-rect"), 
            svg.append("g").attr("class", "data").attr("clip-path", "url(#clip-path-" + scope.$id + ")"), 
            svg.append("g").attr("class", "x-axis axis"), svg.append("text").attr("class", "x-axis-label axis-label"), 
            svg.append("g").attr("class", "y-axis axis"), svg.append("text").attr("class", "y-axis-label axis-label"), 
            svg.append("g").attr("class", "legend");
            var mouseoverGroup = svg.append("g").attr("class", "portfolio-chart-mouseover hidden");
            mouseoverGroup.append("rect").attr("class", "portfolio-chart-mouseover-box");
            var mouseoverTextElement = mouseoverGroup.append("text").attr("class", "portfolio-chart-mouseover-text");
            mouseoverTextElement.append("tspan").attr("class", "portfolio-chart-mouseover-line-1").attr("x", 0).attr("dy", "1.2em"), 
            mouseoverTextElement.append("tspan").attr("class", "portfolio-chart-mouseover-line-2").attr("x", 0).attr("dy", "1.2em"), 
            mouseoverTextElement.append("tspan").attr("class", "portfolio-chart-mouseover-line-3").attr("x", 0).attr("dy", "1.2em"), 
            mouseoverTextElement.append("tspan").attr("class", "portfolio-chart-mouseover-line-4").attr("x", 0).attr("dy", "1.2em"), 
            (svgBrush = d3.select(element[0]).append("svg").attr("class", "brush-svg")).append("g").attr("class", "data"), 
            svgBrush.append("g").attr("class", "brush"), scope.notesEnabled && svg.on("dblclick", function() {
                return d3.event.preventDefault(), function(myElement, notesOptions, zoomKeyCtrl) {
                    myElement && ngDialog.open({
                        template: "common/directives/notesDialog.tmpl.html",
                        className: "ngdialog-theme-default",
                        closeByDocument: !1,
                        data: {
                            keywordID: myElement.keyword,
                            sourceName: myElement.description + " at " + d3.timeFormat("%Y-%m-%d")(myElement.time),
                            notesOptions: notesOptions,
                            sourceLink: zoomKeyCtrl ? zoomKeyCtrl.getZoomLink(myElement.shortKeyword.substr(1)) : ""
                        }
                    });
                }(scope.activeElement, scope.notesOptions, zoomKeyCtrl);
            });
            var notesListener = function(allKeywords) {
                var oldNotes = scope.notesKeywords ? scope.notesKeywords.length : 0;
                scope.notesKeywords = allKeywords, scope.content && 0 < scope.content.length && (0 < oldNotes || 0 < scope.notesKeywords.length) && draw(svg, svgBrush, scope);
            }, zoomListener = function(zoomHash) {
                var zoomMatch = zoomHash.match(/^([0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9])(\/.+?)?(\/[0-9]+)?$/);
                if (zoomMatch) {
                    var zoomToTime = zoomHash.substr(0, 10), timeIndex = scope.availableTime.findIndex(function(d) {
                        return d3.ourSettings.formats.date(new Date(d)) === zoomToTime;
                    });
                    if (null !== timeIndex && (scope.selectedTimeIndex = timeIndex, scope.currTime = new Date(scope.availableTime[scope.selectedTimeIndex]), 
                    $timeout(function() {
                        element.find("input").val(scope.selectedTimeIndex);
                    })), zoomMatch[2]) {
                        var searchKey = "/" + zoomMatch[1] + zoomMatch[2], contentItem = scope.content.find(function(d) {
                            return console.log('Comparing searchKey "' + searchKey + '" to dataKey "' + keywordsService.getDataKey(void 0, d, scope.columnsSpec) + '".'), 
                            console.log(d), searchKey === keywordsService.getDataKey(void 0, d, scope.columnsSpec);
                        });
                        contentItem && (scope.brushExtent = [ Math.max(0, contentItem._portfolioStartX - 2 * contentItem[scope.contentX]), contentItem._portfolioStartX + 3 * contentItem[scope.contentX] ], 
                        draw(svg, svgBrush, scope));
                    }
                    return "";
                }
            };
            scope.contentFile && (scope.loading = !0, svg.classed("hidden", !0), loadingIndicator = d3.select(element[0]).append("div").style("height", scope.height + "px").style("width", scope.width + "px").classed("loadingIndicator", !0), 
            datafileReader.readDatafile(scope.contentFile).then(function(res) {
                scope.content = res[0], scope.columnsSpec = res[1], console.log("Obtained data for chart: "), 
                console.log(res);
                var currStartX = {}, availableTimes = {};
                scope.content.forEach(function(d) {
                    availableTimes[d[scope.contentTime].getTime()] = !0, d._portfolioStartX = currStartX[d[scope.contentTime]] ? currStartX[d[scope.contentTime]] : 0, 
                    currStartX[d[scope.contentTime]] = d._portfolioStartX + d[scope.contentX];
                }), scope.columnFormats = {}, scope.columnColors = {}, scope.columnsSpec.forEach(function(colDef) {
                    scope.columnFormats[colDef.display] = d3.ourSettings.formats[colDef.format], scope.columnColors[colDef.display] = colDef.color;
                }), scope.availableTime = Object.keys(availableTimes).map(function(time) {
                    return parseInt(time, 10);
                }).sort(function(a, b) {
                    return a - b;
                }), scope.selectedTimeIndex = scope.availableTime.length - 1, scope.currTime = new Date(scope.availableTime[scope.selectedTimeIndex]), 
                scope.contentHash = miscServices.hashCode(JSON.stringify(scope.content)), zoomKeyCtrl && zoomKeyCtrl.onZoom(zoomListener), 
                $timeout(function() {
                    element.find("input").val(scope.selectedTimeIndex);
                }), scope.errorMessage = "", scope.loading = !1;
            }, function(err) {
                console.log("An error occurred loading the graph: "), console.log(err), scope.content = [], 
                scope.contentHash = "", scope.errorMessage = gettext("An error occurred while loading this graph:") + " " + err, 
                scope.loading = !1;
            }).then(function() {
                scope.notesEnabled && notesViewer.loadNotes("data/" + scope.contentFile + "/", notesListener);
            })), scope.startAnimation = function() {
                var nextStep;
                scope.animationSpeed ? scope.animationSpeed++ : (nextStep = function() {
                    scope.selectedTimeIndex = Number(scope.selectedTimeIndex) || 0, scope.selectedTimeIndex = scope.selectedTimeIndex === scope.availableTime.length - 1 ? 0 : scope.selectedTimeIndex + 1, 
                    scope.animationSpeed && $timeout(nextStep, 800 / scope.animationSpeed);
                }, scope.animationSpeed = 1, nextStep());
            }, scope.stopAnimation = function() {
                scope.animationSpeed = 0;
            }, scope.$watch("loading", function(newVal, oldVal, scope) {
                scope.loading ? (svg.classed("hidden", !0), loadingIndicator.attr("class", "loadingIndicator")) : scope.errorMessage ? (svg.classed("hidden", !0), 
                loadingIndicator.attr("class", "loadingErrorMessage"), loadingIndicator.text(scope.errorMessage)) : (svg.classed("hidden", !1), 
                loadingIndicator.attr("class", "loadingIndicator hidden"));
            }, !0), scope.$watch("contentHash", function(newVal, oldVal, scope) {
                scope.content && 0 < scope.content.length && draw(svg, svgBrush, scope);
            }, !0), scope.$watch("selectedTimeIndex", function(newVal, oldVal, scope) {
                newVal !== oldVal && scope.availableTime[newVal] && (scope.currTime.setTime(scope.availableTime[newVal]), 
                scope.content && 0 < scope.content.length && draw(svg, svgBrush, scope));
            });
        }
    };
} ]), angular.module("helperDirectives", []).directive("contenteditable", function() {
    return {
        require: "ngModel",
        link: function(scope, element, attrs, ngModel) {
            function read() {
                ngModel.$setViewValue(element.html());
            }
            ngModel.$render = function() {
                element.html(ngModel.$viewValue || "");
            }, element.bind("blur keyup change", function() {
                scope.$apply(read);
            });
        }
    };
}).directive("datetimeFormatted", function() {
    return {
        restrict: "A",
        require: "ngModel",
        link: function(scope, element, attrs, ngModel) {
            ngModel.$formatters.push(function(value) {
                return !value || value > new Date("2999-01-01T01:00:00Z") ? "" : window.moment(value).format("L LT");
            }), ngModel.$parsers.push(function(value) {
                return value ? window.moment(value, "L LT").toDate() : new Date("2999-12-31T12:00:00.000Z");
            });
        }
    };
}).directive("onlyPasteText", [ "$window", function($window) {
    function handlePaste(e) {
        var clipboardData, pastedData, text, sel, range;
        e.stopPropagation(), e.preventDefault(), clipboardData = e.originalEvent.clipboardData || $window.clipboardData, 
        console.log("Clipboard data: "), console.log(clipboardData), pastedData = clipboardData.getData("Text"), 
        text = pastedData, $window.getSelection ? (sel = $window.getSelection()).getRangeAt && sel.rangeCount && ((range = sel.getRangeAt(0)).deleteContents(), 
        range.insertNode($window.document.createTextNode(text))) : $window.document.selection && $window.document.selection.createRange && ($window.document.selection.createRange().text = text);
    }
    return {
        restrict: "A",
        link: function(scope, element) {
            element.on("paste", handlePaste);
        }
    };
} ]).directive("arrayToLines", function() {
    return {
        restrict: "A",
        require: "ngModel",
        link: function(scope, element, attrs, ngModel) {
            ngModel.$formatters.push(function(value) {
                return Array.isArray(value) ? value.join("\n") + "\n" : value + "\n";
            }), ngModel.$parsers.push(function(value) {
                return value.trim().split("\n");
            });
        }
    };
}).directive("keepVisibleOnScroll", [ "$window", function($window) {
    return {
        restrict: "A",
        scope: {
            keepVisibleOnScroll: "="
        },
        link: function(scope, element) {
            console.log("Linking keepVisibleOnScroll directive..."), console.log("Element:"), 
            console.log(element), element.addClass("animate-margin-move");
            var currPos, angularWindow = angular.element($window), parent = element.parent(), scrollFunction = function() {
                var elOffsetTop = parent.offset().top, scrollDiff = angularWindow.scrollTop() - elOffsetTop, newPos = Math.max(0, Math.min(scrollDiff + 80, parent.height() - parseInt(scope.keepVisibleOnScroll)));
                void 0 !== currPos && newPos === currPos || (currPos = newPos, element.css("margin-top", newPos + "px"));
            };
            angularWindow.on("scroll", scrollFunction), element.on("$destroy", function() {
                angularWindow.off("scroll", scrollFunction);
            });
        }
    };
} ]).directive("requiredIf", [ function() {
    return {
        require: "ngModel",
        scope: {
            requiredIf: "="
        },
        link: function(scope, elm, attrs, ctrl) {
            ctrl.$validators.requiredIf = function(modelValue) {
                return !scope.requiredIf || !ctrl.$isEmpty(modelValue);
            }, scope.$watch("requiredIf", function() {
                ctrl.$validate();
            });
        }
    };
} ]).directive("convertToNumber", function() {
    return {
        require: "ngModel",
        link: function(scope, element, attrs, ngModel) {
            ngModel.$parsers.push(function(val) {
                return parseInt(val, 10);
            }), ngModel.$formatters.push(function(val) {
                return "" + val;
            });
        }
    };
}), angular.module("impactDirectives", [ "gettext", "ngDialog", "risksServices", "helperDirectives", "miscServices" ]).directive("callOnChange", function() {
    var callbacksSave = [], callbacksDelete = [];
    return {
        restrict: "A",
        controller: function() {
            this.triggerSave = function(sourceId, sourceUrl, sourceDescription, sourceKeywords) {
                console.log("Running callback with sourceID = " + sourceId + ", sourceUrl = " + sourceUrl + ", sourceDescription = " + sourceDescription + ", sourceKeywords = " + sourceKeywords), 
                callbacksSave.forEach(function(callback) {
                    console.log("Calling callback: "), console.log(callback), callback(sourceId, sourceUrl, sourceDescription, sourceKeywords);
                });
            }, this.onSave = function(callback) {
                -1 === callbacksSave.indexOf(callback) && (console.log("Registering onSave callback."), 
                callbacksSave.push(callback));
            }, this.removeOnSave = function(callback) {
                console.log("Removing onSave callback.");
                var removeIndex = callbacksSave.indexOf(callback);
                0 <= removeIndex && callbacksSave.splice(removeIndex, 1);
            }, this.triggerDelete = function(sourceId) {
                callbacksDelete.forEach(function(callback) {
                    callback(sourceId);
                });
            }, this.onDelete = function(callback) {
                -1 === callbacksDelete.indexOf(callback) && (console.log("Registering onDelete callback."), 
                callbacksDelete.push(callback));
            }, this.removeOnDelete = function(callback) {
                var removeIndex = callbacksDelete.indexOf(callback);
                0 <= removeIndex && callbacksDelete.splice(removeIndex, 1);
            };
        }
    };
}).directive("impactManager", [ "$q", "$timeout", "gettext", "impactsService", "risksService", "miscServices", function($q, $timeout, gettext, impactsService, risksService, miscServices) {
    return {
        restrict: "E",
        require: "^^callOnChange",
        scope: {
            impacts: "=?",
            sourceEndpoint: "=",
            sourceId: "=?",
            sourceDate: "=?",
            riskCategory: "=?",
            riskCategoryDescription: "=?"
        },
        link: function(scope, element, attrs, callOnChangeCtrl) {
            var sourceUrl, sourceDescription;
            scope.errMessage = void 0, scope.isSaving = !1, scope.risks = [], scope.sourceKeywords = "", 
            scope.foreignRisks = {};
            var getForeignRisks = function(impacts) {
                impacts.forEach(function(impact) {
                    "NONE" !== impact.targetRiskCategory && void 0 !== impact.targetRiskCategory && impact.targetRiskCategory !== scope.riskCategory && void 0 === scope.foreignRisks[impact.targetRiskCategory] && (scope.foreignRisks[impact.targetRiskCategory] = {}, 
                    risksService.getRisksByCategory(impact.targetRiskCategory, scope.sourceDate ? scope.sourceDate : todayDate).then(function(risks) {
                        risks.forEach(function(risk) {
                            scope.foreignRisks[impact.targetRiskCategory][risk.initialId.toString()] = miscServices.htmlToText(risk.title);
                        }), console.log("Updated foreign risks, based on impact with foreign risk category:"), 
                        console.log([ scope.foreignRisks, impacts, impact ]);
                    }));
                });
            };
            if (scope.impacts ? (scope.impacts.forEach(function(impact) {
                impact.targetRiskInitialId = "" + impact.targetRiskInitialId, impact.oldRiskInitialId = impact.targetRiskInitialId;
            }), getForeignRisks(scope.impacts)) : (scope.impacts = [], void 0 !== scope.sourceId && null !== scope.sourceId && impactsService.getImpactsBySource(scope.sourceEndpoint, scope.sourceId).then(function(impacts) {
                impacts.forEach(function(impact) {
                    impact.targetRiskInitialId = "" + impact.targetRiskInitialId, impact.oldRiskInitialId = impact.targetRiskInitialId, 
                    scope.impacts.push(impact);
                }), getForeignRisks(impacts);
            })), void 0 !== scope.riskCategory && null !== scope.riskCategory) {
                var todayDate = new Date();
                risksService.getRisksByCategory(scope.riskCategory, scope.sourceDate ? scope.sourceDate : todayDate).then(function(risks) {
                    var currInitialId = -1;
                    risks.forEach(function(risk) {
                        risk.initialId !== currInitialId && (scope.risks.push({
                            id: risk.id,
                            initialId: risk.initialId,
                            titleText: miscServices.htmlToText(risk.title),
                            active: risk.valid_from <= todayDate && risk.valid_to >= todayDate
                        }), currInitialId = risk.initialId);
                    });
                });
            }
            var removeImpactFromArr = function(impact) {
                var removeIndex = scope.impacts.indexOf(impact);
                0 <= removeIndex && scope.impacts.splice(removeIndex, 1);
            }, prepareImpactForSave = function(impact) {
                (null === impact.targetRiskInitialId || "" === impact.targetRiskInitialId || impact.targetRiskInitialId < 0) && (impact.targetRiskInitialId = void 0), 
                impact.targetRiskCategory = scope.riskCategory, impact.sourceEndpoint = scope.sourceEndpoint, 
                impact.sourceId = scope.sourceId, impact.sourceKeywords = scope.sourceKeywords, 
                impact.sourceUrl = sourceUrl, impact.sourceDescription = sourceDescription;
            }, getTargetDescription = function(impact) {
                if (void 0 !== impact.targetRiskInitialId) {
                    var targetRisk = scope.risks.find(function(d) {
                        return d.initialId.toString() === impact.targetRiskInitialId.toString();
                    });
                    if (targetRisk) return targetRisk.titleText;
                }
                return scope.riskCategoryDescription;
            }, onSaveCallback = function(sourceId, _sourceUrl, _sourceDescription, sourceKeywordsArr) {
                if (!scope.sourceId || -1 === scope.sourceId || Number(scope.sourceId) === Number(sourceId)) {
                    var impactSavePromise = $q.resolve();
                    scope.isSaving = !0, scope.sourceId = sourceId, sourceUrl = _sourceUrl, sourceDescription = _sourceDescription, 
                    scope.sourceKeywords = sourceKeywordsArr.join(",").concat(","), console.log("onSaveCallback called with sourceId = " + sourceId + ", sourceKeywords = " + sourceKeywordsArr), 
                    scope.impacts.forEach(function(impact) {
                        impact.id < 0 && !impact.doRemove ? (prepareImpactForSave(impact), impactSavePromise = impactSavePromise.then(function() {
                            return impactsService.addImpact(impact, getTargetDescription(impact)).then(function(savedImpact) {
                                impact = savedImpact;
                            });
                        })) : impact.id < 0 && impact.doRemove ? removeImpactFromArr(impact) : 0 <= impact.id && !impact.doRemove && (impact.oldRiskInitialId !== impact.targetRiskInitialId || impact.sourceId !== sourceId || impact.sourceKeywords !== scope.sourceKeywords) ? (prepareImpactForSave(impact), 
                        impactSavePromise = impactSavePromise.then(function() {
                            return impactsService.updateImpact(impact, getTargetDescription(impact)).then(function(savedImpact) {
                                impact = savedImpact;
                            });
                        })) : 0 <= impact.id && impact.doRemove && (impactSavePromise = impactSavePromise.then(function() {
                            impactsService.deleteImpact(impact).then(function() {
                                removeImpactFromArr(impact);
                            });
                        }));
                    }), impactSavePromise.then(function() {
                        scope.isSaving = !1;
                    }, function(err) {
                        scope.isSaving = !1, window.alert(err);
                    });
                }
            };
            callOnChangeCtrl.onSave(onSaveCallback);
            var onDeleteCallback = function(sourceId) {
                if (Number(scope.sourceId) === Number(sourceId)) {
                    scope.isSaving = !0;
                    var impactDeletePromise = $q.resolve();
                    scope.impacts.forEach(function(impact) {
                        void 0 !== impact.id && (impactDeletePromise = impactDeletePromise.then(function() {
                            return impactsService.deleteImpact(impact).then(function() {
                                removeImpactFromArr(impact);
                            });
                        }));
                    }), impactDeletePromise.then(function() {
                        scope.isSaving = !1;
                    }, function(err) {
                        window.alert(err);
                    });
                }
            };
            callOnChangeCtrl.onDelete(onDeleteCallback);
            var newIdIterator = -1;
            scope.addImpact = function(impactType) {
                scope.impacts.push({
                    id: newIdIterator,
                    impactType: impactType,
                    sourceEndpoint: scope.sourceEndpoint,
                    targetRiskCategory: scope.riskCategory,
                    targetRiskInitialId: void 0,
                    impactDate: new Date()
                }), newIdIterator--;
            }, scope.removeImpact = function(impact) {
                impact.doRemove = !0;
            }, scope.restoreImpact = function(impact) {
                impact.doRemove = !1;
            }, scope.$on("$destroy", function() {
                $timeout(function() {
                    callOnChangeCtrl && (callOnChangeCtrl.removeOnSave(onSaveCallback), callOnChangeCtrl.removeOnDelete(onDeleteCallback));
                }, 1e4);
            });
        },
        templateUrl: "common/directives/impactManager.tmpl.html"
    };
} ]).directive("impactViewer", [ "gettext", "ngDialog", "impactsService", "miscServices", function(gettext, ngDialog, impactsService, miscServices) {
    return {
        restrict: "E",
        scope: {
            viewerTitle: "=?",
            riskCategory: "=?",
            riskInitialId: "=?",
            fromDate: "=?",
            toDate: "=?"
        },
        link: function(scope) {
            if (scope.errMessage = void 0, scope.isSaving = !1, scope.isLoading = !1, scope.impacts = [], 
            void 0 === scope.riskInitialId || void 0 !== scope.riskCategory) {
                var updateImpacts = function(scope) {
                    scope.isLoading = !0, impactsService.getImpactsByRiskCategory(scope.riskCategory, scope.fromDate, scope.toDate).then(function(impacts) {
                        scope.isLoading = !1, void 0 === scope.riskInitialId ? scope.impacts = impacts : scope.impacts = impacts.filter(function(impact) {
                            return void 0 !== impact.targetRiskInitialId && impact.targetRiskInitialId.toString() === scope.riskInitialId.toString();
                        }), console.log("impactViewer: Impacts loaded for " + scope.riskCategory + " and ID " + scope.riskInitialId + ":"), 
                        console.log([ impacts, scope.impacts ]);
                    }, function(err) {
                        scope.errMessage = err;
                    });
                };
                updateImpacts(scope), scope.showImpacts = function(impactType) {
                    var impactsForType = scope.impacts.filter(function(impact) {
                        return impact.impactType === impactType;
                    });
                    ngDialog.open({
                        template: "common/directives/impactViewerDialog.tmpl.html",
                        className: "ngdialog-theme-default",
                        data: {
                            impactType: impactType,
                            viewerTitle: miscServices.htmlToText(scope.viewerTitle),
                            impactsForType: impactsForType,
                            notesIds: impactsForType.filter(function(impact) {
                                return "notes" === impact.sourceEndpoint;
                            }).map(function(impact) {
                                return impact.sourceId;
                            })
                        }
                    });
                }, scope.$watch("riskCategory", function(newVal, oldVal, scope) {
                    updateImpacts(scope);
                }), scope.$watch("fromDate", function(newVal, oldVal, scope) {
                    updateImpacts(scope);
                }), scope.$watch("toDate", function(newVal, oldVal, scope) {
                    updateImpacts(scope);
                }), scope.$watch("targetRiskInitialId", function(newVal, oldVal, scope) {
                    updateImpacts(scope);
                });
            } else scope.errMessage = gettext("If you want to show impacts for a given risk, you also need to specify its risk category.");
        },
        templateUrl: "common/directives/impactViewer.tmpl.html"
    };
} ]).directive("impactDirectViewer", function() {
    return {
        restrict: "E",
        scope: {
            impacts: "="
        },
        link: function(scope) {
            console.log("Linked impactDirectViewer with impacts: "), console.log(scope.impacts);
        },
        templateUrl: "common/directives/impactDirectViewer.tmpl.html"
    };
}), angular.module("notesDirectives", [ "notesServices", "risksServices", "usersServices", "socialServices", "textAngular", "ngTagsInput", "ngDialog", "socialDirectives" ]).directive("dashboardNotes", [ "$q", "$filter", "$timeout", "$rootScope", "ngDialog", "notesService", "keywordsService", "impactsService", "interactionService", "usersService", function($q, $filter, $timeout, $rootScope, ngDialog, notesService, keywordsService, impactsService, interactionService, usersService) {
    return {
        restrict: "E",
        replace: "true",
        require: [ "?callOnChange", "?^zoomKey" ],
        scope: {
            keywordId: "=",
            enableKeywords: "=",
            showSearch: "=",
            showMore: "=",
            statusFilter: "=?",
            showStatusFilter: "=?",
            showKeywordFilter: "=?",
            limitTo: "=?",
            showImpacts: "=?",
            impactsRiskCategory: "=?",
            impactsRiskCategoryDescription: "=?",
            showNew: "=?",
            sourceLink: "@?"
        },
        link: function(scope, element, attrs, ctrls) {
            var callOnChangeCtrl = ctrls[0], zoomKeyCtrl = ctrls[1];
            isNaN(scope.limitTo) && (scope.limitTo = 1e3), scope.editorActiveNote = void 0, 
            scope.searchKey = "", scope.currLimitTo = Number(scope.limitTo), scope.zoomKey = zoomKeyCtrl ? zoomKeyCtrl.getZoomKey() : void 0, 
            scope.makeMakeNoteIntro = function(note) {
                return note.makeNoteIntro || (note.makeNoteIntro = function() {
                    return notesService.makeNoteIntro(note);
                }), note.makeNoteIntro;
            };
            var statusFilterObjUpdate = function() {
                var thisFilter;
                scope.statusFilter ? (thisFilter = "string" == typeof scope.statusFilter || scope.statusFilter instanceof String ? [ scope.statusFilter ] : scope.statusFilter, 
                scope.statusFilterObj = {
                    Draft: !1,
                    Final: !1,
                    Closed: !1,
                    Reviewed: !1
                }, thisFilter.forEach(function(status) {
                    scope.statusFilterObj[status] = !0;
                })) : scope.statusFilterObj = {
                    Draft: !0,
                    Final: !0,
                    Closed: !0,
                    Reviewed: !0
                };
            };
            statusFilterObjUpdate();
            var getCurrentStatusFilter = function() {
                return Object.keys(scope.statusFilterObj).filter(function(k) {
                    return scope.statusFilterObj[k];
                });
            };
            scope.keywordFilterLoaded = !1;
            var keywordFilterUpdate = function() {
                void 0 === scope.keywordId || "" === scope.keywordId ? scope.keywordId = [] : ("string" == typeof scope.keywordId || scope.keywordId instanceof String) && (scope.keywordId = [ scope.keywordId ]), 
                scope.keywordFilterLoaded || (scope.keywordFilter = scope.keywordId.map(function(keyword) {
                    return {
                        id: keyword,
                        name: keyword
                    };
                })), keywordsService.getKeywordArray(scope.keywordId).then(function(keywordArr) {
                    console.log("Received keywordArr from keywordsService, updating keywordFilter:"), 
                    console.log(keywordArr), scope.keywordFilter = keywordArr, scope.keywordFilterLoaded = !0;
                });
            };
            keywordFilterUpdate(), scope.notesImpacts = {
                NEW: []
            };
            var notesImpactsUpdate = function() {
                scope.showImpacts && impactsService.getImpactsBySourceKeywords("notes", scope.keywordId, !1).then(function(impacts) {
                    console.log("Received impacts: "), console.log(impacts), scope.notesImpacts = {
                        NEW: []
                    }, impacts.forEach(function(impact) {
                        Array.isArray(scope.notesImpacts["note-" + impact.sourceId.toString()]) || (scope.notesImpacts["note-" + impact.sourceId.toString()] = []), 
                        scope.notesImpacts["note-" + impact.sourceId.toString()].push(impact);
                    }), console.log("Mapped notes:"), console.log(scope.notesImpacts);
                });
            };
            notesImpactsUpdate();
            var noteListenerAdd = function(note) {
                -1 === scope.notes.findIndex(function(n) {
                    return n.id === note.id;
                }) && scope.notes.push(note);
            };
            notesService.addNoteListeners(function(note) {
                return 0 < note.keywords.filter(function(k) {
                    return -1 !== scope.keywordFilter.findIndex(function(keywordObject) {
                        return keywordObject.id === k.id;
                    });
                }).length && scope.statusFilterObj[note.noteStatus];
            }, noteListenerAdd, function(oldNote) {
                if (console.log("noteListenerRemove called:"), console.log([ oldNote, scope.notes, scope.notes.findIndex(function(note) {
                    return note.id === oldNote.id;
                }) ]), !(oldNote.id < 0)) {
                    var noteIdx = scope.notes.findIndex(function(note) {
                        return note.id === oldNote.id;
                    });
                    -1 !== noteIdx && scope.notes.splice(noteIdx, 1);
                }
            });
            var makeKeywordsNew = function() {
                return scope.keywordId.map(function(keyword) {
                    var keywordObject = {
                        id: keyword,
                        name: keyword
                    };
                    return keywordsService.getKeywordName(keywordObject), keywordObject;
                });
            };
            scope.newNote = {
                id: -1,
                noteTextNew: "",
                attachmentsNew: [],
                keywordsNew: makeKeywordsNew(),
                noteStatusNew: "Final",
                editorActive: !1
            };
            var loadNotes = function() {
                zoomKeyCtrl && zoomKeyCtrl.startedLoading(), notesService.getNotesForKeywords(scope.keywordFilter.map(function(k) {
                    return k.id;
                }), getCurrentStatusFilter(), !1, !1, 4 * scope.currLimitTo).then(function(myNotes) {
                    scope.notes = myNotes, scope.haveAllNotes = !1, console.log("Received new notes:"), 
                    console.log(myNotes), scope.notes.length < 4 * scope.currLimitTo && (scope.haveAllNotes = !0), 
                    zoomKeyCtrl && zoomKeyCtrl.stoppedLoading(), scope.notesAreLoading = !1;
                }, function(err) {
                    window.alert(err), zoomKeyCtrl && zoomKeyCtrl.stoppedLoading(), scope.notesAreLoading = !1;
                }, function(preNotes) {
                    scope.notes = preNotes, scope.haveAllNotes = !1;
                });
            };
            scope.notes = [], scope.haveAllNotes = !1, scope.notesAreLoading = !0, loadNotes(), 
            scope.$watch("keywordFilter", function(newVal, oldVal, scope) {
                if (console.log("keywordFilter has changed: "), console.log([ newVal, oldVal, scope ]), 
                Array.isArray(oldVal) && Array.isArray(newVal)) {
                    var oldKeywordIds = oldVal.map(function(k) {
                        return k.id;
                    }).sort(), newKeywordIds = newVal.map(function(k) {
                        return k.id;
                    }).sort();
                    if (angular.equals(oldKeywordIds, newKeywordIds)) return;
                }
                console.log("And it has REALLY changed... Reloadig notes."), console.log([ newVal, oldVal, scope ]), 
                loadNotes();
            }, !0), scope.$watch("keywordId", function(newVal, oldVal, scope) {
                keywordFilterUpdate(), notesImpactsUpdate(), void 0 !== oldVal && Array.isArray(oldVal) && (scope.newNote.keywordsNew = makeKeywordsNew().concat(scope.newNote.keywordsNew.filter(function(keyword) {
                    return -1 === oldVal.indexOf(keyword.id);
                })));
            }, !0), scope.$watch("statusFilter", statusFilterObjUpdate, !0), scope.$watch("statusFilterObj", loadNotes, !0), 
            scope.createNewNote = function() {
                scope.newNote.editorActive = !0, $timeout(function() {
                    element.find(".note-editor-new div.ta-bind").focus();
                });
            }, scope.newEditorCancel = function() {
                scope.newNote = {
                    id: -1,
                    noteTextNew: "",
                    attachmentsNew: [],
                    keywordsNew: makeKeywordsNew(),
                    noteStatusNew: "Final",
                    editorActive: !1
                };
            }, scope.newEditorSave = function() {
                var myNote = {
                    id: -1,
                    noteText: scope.newNote.noteTextNew,
                    attachments: scope.newNote.attachmentsNew,
                    keywords: scope.newNote.keywordsNew,
                    noteStatus: scope.newNote.noteStatusNew,
                    sourceLink: scope.sourceLink,
                    lastAuthor: "(saving)",
                    lastModifiedDate: new Date(),
                    interactionSummary: {},
                    isSaving: !0
                };
                scope.notes.push(myNote), scope.newEditorCancel(), notesService.addNote(myNote, noteListenerAdd).then(function(res) {
                    return -1 !== scope.notes.indexOf(myNote) && (scope.notes[scope.notes.indexOf(myNote)] = res), 
                    res.isSaving = !1, console.log("Does callOnChangeCtrl exist?"), console.log(callOnChangeCtrl), 
                    callOnChangeCtrl && callOnChangeCtrl.triggerSave(res.id, res.sourceLink ? "#" + res.sourceLink : void 0, notesService.makeNoteIntro(res), res.keywords.map(function(keyword) {
                        return keyword.id;
                    })), scope.showImpacts && (scope.notesImpacts["note-" + res.id.toString()] = scope.notesImpacts.NEW, 
                    scope.notesImpacts.NEW = []), usersService.getCurrentUserSettings().then(function(settings) {
                        if ("no" !== settings.watchNewNote) return usersService.getCurrentUser().then(function(user) {
                            return res.interactionSummary.watch = [ user.id.toString() ], interactionService.addWatch(user.id, "note", res.id, notesService.makeNoteIntro(res), res.sourceLink ? "#" + res.sourceLink : void 0);
                        });
                    });
                }).catch(function(err) {
                    window.alert(err);
                });
            }, scope.newEditorCancel(), scope.makeEditorActive = function(note) {
                console.log("makeEditorActive called."), console.log(scope.notes), void 0 !== note && (note.noteTextNew = note.noteText, 
                note.keywordsNew = note.keywords.slice(0), note.attachmentsNew = note.attachments.slice(0), 
                note.noteStatusNew = note.noteStatus, scope.editorActiveNote = note, $timeout(function() {
                    element.find(".note-editor-old div.ta-bind").focus();
                }));
            }, scope.editorSave = function(note) {
                if (void 0 !== note) {
                    var oldNote = {
                        id: note.id,
                        noteText: note.noteText,
                        keywords: note.keywords.slice(0),
                        attachments: note.attachments,
                        noteStatus: note.noteStatus
                    };
                    return note.noteText = note.noteTextNew, note.keywords = note.keywordsNew.slice(0), 
                    note.attachments = note.attachmentsNew, note.noteStatus = note.noteStatusNew, note.lastModifiedDate = new Date(), 
                    note.isSaving = !0, scope.editorActiveNote = void 0, notesService.updateNote(note, oldNote).then(function() {
                        note.isSaving = !1, console.log("Does callOnChangeCtrl exist?"), console.log(callOnChangeCtrl), 
                        callOnChangeCtrl && callOnChangeCtrl.triggerSave(note.id, note.sourceLink ? "#" + note.sourceLink : void 0, notesService.makeNoteIntro(note), note.keywords.map(function(keyword) {
                            return keyword.id;
                        }));
                    }, function(err) {
                        window.alert(err);
                    });
                }
                return $q.reject();
            }, scope.editorCancel = function(note) {
                void 0 !== note && (-1 === note.id ? (scope.removeNote(note), scope.newNoteActive = !1) : (scope.editorActiveNote = void 0, 
                delete note.noteTextNew, delete note.keywordsNew, delete note.attachmentsNew, delete note.noteStatusNew));
            }, scope.removeNote = function(note) {
                var deleteDialog;
                if (void 0 !== note && -1 !== scope.notes.indexOf(note)) {
                    var myID = note.id, savedAndForeign = -1 !== note.id && -1 !== note.keywordsNew.findIndex(function(keyword) {
                        return -1 === scope.keywordId.indexOf(keyword.id);
                    });
                    deleteDialog = ngDialog.open({
                        template: "common/directives/notesRemoveDialog.tmpl.html",
                        className: "ngdialog-theme-default",
                        data: {
                            note: note,
                            savedAndForeign: savedAndForeign,
                            doRemove: function() {
                                var deletedNote = scope.notes.splice(scope.notes.indexOf(note), 1)[0];
                                -1 !== myID && notesService.deleteNote(deletedNote).then(function() {
                                    callOnChangeCtrl && callOnChangeCtrl.triggerDelete(myID), deleteDialog.close();
                                }, function(err) {
                                    window.alert(err);
                                });
                            },
                            doUnlink: function() {
                                note.keywordsNew = note.keywordsNew.filter(function(keyword) {
                                    return -1 === scope.keywordId.indexOf(keyword.id);
                                }), scope.editorSave(note).then(function() {
                                    scope.notes.splice(scope.notes.indexOf(note), 1), deleteDialog.close();
                                });
                            }
                        }
                    });
                }
            }, scope.filesChanged = function(isNew, elm) {
                var i, noteScope = angular.element(elm).scope();
                if (isNew) for (i = 0; i < elm.files.length; i++) scope.newNote.attachmentsNew.push({
                    link: "",
                    name: elm.files[i].name,
                    newUploadFile: elm.files[i]
                }); else for (i = 0; i < elm.files.length; i++) noteScope.note.attachmentsNew.push({
                    link: "",
                    name: elm.files[i].name,
                    newUploadFile: elm.files[i]
                });
                scope.$apply();
            }, scope.removeAttachmentToggle = function(attachment) {
                attachment.toBeRemoved = !attachment.toBeRemoved;
            };
            var myToBeAddedID = 0;
            scope.showKeywordRemoveError = !1, scope.keywordsOnRemoving = function($tag) {
                return -1 === scope.keywordId.indexOf($tag.id) || (scope.showKeywordRemoveError = !0, 
                setTimeout(function() {
                    scope.showKeywordRemoveError = !1, scope.$digest();
                }, 1e3), !1);
            }, scope.keywordsOnAdding = function($tag) {
                void 0 === $tag.id && ($tag.id = "addKeyword/" + myToBeAddedID++);
            }, scope.keywordsLoadItems = function($query) {
                return console.log($query), keywordsService.getAllKeywords().then(function(myKeywordList) {
                    return myKeywordList.filter(function(d) {
                        return -1 < d.name.toUpperCase().indexOf($query.toUpperCase());
                    });
                });
            }, scope.keywordbarOnRemoving = function($tag) {
                return -1 === scope.keywordId.indexOf($tag.id) || (scope.showKeywordFilterRemoveError = !0, 
                setTimeout(function() {
                    scope.showKeywordFilterRemoveError = !1, scope.$digest();
                }, 1e3), !1);
            };
            var doSearchPromise, searchAdditionalNotes = function() {
                if (console.log("searchAdditionalNotes called. searchKey: " + scope.searchKey), 
                scope.searchKey.length < 3) return $q.resolve();
                if (scope.haveAllNotes) return $q.resolve();
                if ($filter("filter")(scope.notes, scope.searchKey).length > scope.currLimitTo) return $q.resolve();
                var haveNotes = scope.notes.length;
                return notesService.getNotesForKeywords(scope.keywordFilter.map(function(k) {
                    return k.id;
                }), getCurrentStatusFilter(), !1, !1, haveNotes + 200).then(function(myNotes) {
                    scope.notes = myNotes, scope.notes.length === haveNotes + 200 ? searchAdditionalNotes() : scope.haveAllNotes = !0;
                }, function(err) {
                    window.alert(err);
                });
            };
            scope.doSearch = function() {
                console.log("doSearch called. searchKey: " + scope.searchKey), doSearchPromise && ($timeout.cancel(doSearchPromise), 
                doSearchPromise = void 0), 3 <= scope.searchKey.length && (doSearchPromise = $timeout(searchAdditionalNotes, 1e3));
            }, scope.hasMoreNotes = function() {
                return void 0 === scope.searchKey || null === scope.searchKey || scope.searchKey.length < 2 ? !!scope.currLimitTo && scope.notes.length > scope.currLimitTo : !!scope.currLimitTo && $filter("filter")(scope.notes, scope.searchKey).length > scope.currLimitTo;
            }, scope.showMoreNotes = function() {
                return console.log("Paging - Increasing limitTo from " + scope.currLimitTo + " by " + scope.limitTo + " to " + (Number(scope.currLimitTo) + Number(scope.limitTo)) + "."), 
                scope.currLimitTo = Number(scope.currLimitTo) + Number(scope.limitTo), 3 <= scope.searchKey.length ? searchAdditionalNotes() : scope.haveAllNotes ? $q.resolve() : notesService.getNotesForKeywords(scope.keywordFilter.map(function(k) {
                    return k.id;
                }), getCurrentStatusFilter(), !1, !1, scope.currLimitTo + 3 * Number(scope.limitTo)).then(function(myNotes) {
                    scope.notes = myNotes, scope.notes.length < scope.currLimitTo + 3 * Number(scope.limitTo) && (scope.haveAllNotes = !0);
                }, function(err) {
                    window.alert(err);
                });
            }, zoomKeyCtrl && zoomKeyCtrl.onZoom(function(zoomHash) {
                var noteId = parseInt(zoomHash, 10);
                if (!isNaN(noteId)) {
                    scope.searchKey = "";
                    var noteIdx = scope.notes.findIndex(function(note) {
                        return note.id === noteId;
                    });
                    if (-1 !== noteIdx && noteIdx <= scope.currLimitTo) return noteId.toString();
                    var recursiveLoader = function() {
                        return console.log("recursiveLoader running..."), console.log([ scope.currLimitTo, scope.haveAllNotes, noteId, scope.notes ]), 
                        scope.haveAllNotes && scope.currLimitTo >= scope.notes.length ? void 0 : scope.showMoreNotes().then(function() {
                            var noteIdx = scope.notes.findIndex(function(note) {
                                return note.id === noteId;
                            });
                            return -1 !== noteIdx && noteIdx <= scope.currLimitTo ? noteId.toString() : recursiveLoader();
                        });
                    };
                    return recursiveLoader();
                }
            });
        },
        templateUrl: "common/directives/dashboardNotes.tmpl.html"
    };
} ]).directive("dashboardNotesViewer", [ "notesService", function(notesService) {
    return {
        restrict: "E",
        replace: "true",
        scope: {
            notesIdArr: "="
        },
        link: function(scope) {
            scope.errMessage = void 0, scope.notesAreLoading = !1, scope.makeMakeNoteIntro = function(note) {
                return note.makeNoteIntro || (note.makeNoteIntro = function() {
                    return notesService.makeNoteIntro(note);
                }), note.makeNoteIntro;
            }, scope.notes = [], scope.notesAreLoading = !0, notesService.getNotesById(scope.notesIdArr).then(function(notes) {
                scope.notes = notes, scope.notesAreLoading = !1;
            }, function(err) {
                scope.errMessage = err;
            }, function(notes) {
                scope.notes = notes;
            });
        },
        templateUrl: "common/directives/dashboardNotesViewer.tmpl.html"
    };
} ]).directive("keywordsList", [ function() {
    return {
        restrict: "E",
        scope: {
            keywords: "=",
            enableEye: "=?"
        },
        link: function() {},
        templateUrl: "common/directives/keywordsList.tmpl.html"
    };
} ]), angular.module("objectExplorerDirectives", [ "gettext", "ui.grid", "ui.grid.resizeColumns", "objectExplorerServices" ]).directive("objectExplorer", [ "$timeout", "d3", "objectExplorerService", function($timeout, d3, objectExplorerService) {
    return {
        restrict: "E",
        replace: "true",
        require: "?^zoomKey",
        scope: {
            width: "=",
            height: "=",
            mappingKey: "=",
            elements: "=",
            viewType: "=",
            views: "=",
            sourceLink: "@?"
        },
        link: function(scope, element, attrs, zoomKeyCtrl) {
            var noView = {
                icon: void 0,
                name: void 0,
                type: void 0,
                options: {}
            };
            scope.activeElement = void 0, scope.activeView = noView, scope.hasMappingRights = !1, 
            objectExplorerService.hasMappingRights().then(function(_hasMappingRights) {
                scope.hasMappingRights = _hasMappingRights;
            }), "process" !== scope.viewType && (scope.viewType = "process"), "number" != typeof scope.width && (scope.width = parseInt(scope.width)), 
            scope.width || (scope.width = 900), "number" != typeof scope.height && (scope.height = parseInt(scope.height)), 
            scope.height || (scope.height = Math.round(9 * scope.width / 16));
            var preMappingView, mappingUpdatedTimeoutPromise, oldZoomLink, svg = d3.select(element[0]).select(".object-explorer-elements"), drawElements = function(svg, scope) {
                svg.attr("width", scope.width).attr("height", scope.height).style("margin-left", Math.floor((870 - scope.width) / 2).toString() + "px");
                var elementsDistance = -1 * Math.floor(scope.width / scope.elements.length / 10), elementWidth = Math.floor((scope.width + elementsDistance) / scope.elements.length - elementsDistance);
                console.log("Drawing object explorer:"), console.log([ scope.width, scope.height, scope.elements.length, elementsDistance, elementWidth ]);
                var path = "", textBegin = 0, textEnd = 0;
                if ("process" === scope.viewType) {
                    var endArrow1 = Math.floor(1 * elementWidth / 6), beginArrow2 = Math.floor(5 * elementWidth / 6), endArrow2 = elementWidth, middleHeight = Math.floor(scope.height / 2), bottomHeight = scope.height;
                    path = "M0 0 L" + beginArrow2 + " 0 L" + endArrow2 + " " + middleHeight + " L" + beginArrow2 + " " + bottomHeight + " L0 " + bottomHeight + " L" + endArrow1 + " " + middleHeight + " Z", 
                    textBegin = Math.round(1.3 * endArrow1), textEnd = beginArrow2, console.log("Path for elements: " + path);
                }
                var svgElements = svg.selectAll("g").data(scope.elements), enteredElements = svgElements.enter().append("g").classed("explorer-elements", !0).classed("explorer-element-active", function(d) {
                    return scope.activeElement && scope.activeElement === d.key;
                });
                enteredElements.append("path").attr("d", path), enteredElements.append("text").attr("transform", "translate(" + textBegin + "," + Math.round(scope.height / 2) + ")").attr("y", 0).attr("dy", 0), 
                svgElements.exit().remove(), svgElements.attr("transform", function(d, i) {
                    return "translate(" + i * (elementWidth + elementsDistance) + ",0)";
                }), svgElements.selectAll("text").text(function(d) {
                    return d.display;
                }).call(d3.wrapHelper, textEnd - textBegin), svgElements.each(function(d) {
                    if (console.log("Do we have conditional formatting for " + d.key + "?"), d.conditionalFormat && Array.isArray(d.conditionalFormat) && 0 < d.conditionalFormat.length) {
                        var el = d3.select(this);
                        console.log("We have conditional formatting for " + d.key + ":"), console.log(d.conditionalFormat), 
                        d.conditionalFormat.forEach(function(format) {
                            console.log("Getting mapped objects for coditional format code (" + d.key + ", " + format.type + ")..."), 
                            el.classed("object-explorer-format-" + format.style, !1), objectExplorerService.getMappedObjects(scope.mappingKey, d.key, format.type).then(function(mappedObjects) {
                                console.log("Found mapped objects for conditional formatting check (" + d.key + ", " + format.type + ")."), 
                                -1 < mappedObjects.findIndex(function(obj) {
                                    var hit = !0;
                                    return format.columnFilter.forEach(function(filter) {
                                        var myHit, relevantColumn;
                                        if (console.log("Filtering entry with filter - BEFORE:"), console.log([ obj, filter, hit ]), 
                                        void 0 === (relevantColumn = "title" === filter.column || "description" === filter.column || "link" === filter.column ? obj[filter.column] : obj.additionalColumns[filter.column])) console.log('WARNING: Conditional formatting on column "' + filter.column + '": Column does not exist.'), 
                                        myHit = !1; else switch (filter.compare) {
                                          case "equals":
                                            myHit = relevantColumn === filter.value;
                                            break;

                                          case "contains":
                                            myHit = 0 <= relevantColumn.indexOf(filter.value);
                                            break;

                                          case "geq":
                                            myHit = relevantColumn >= filter.value;
                                            break;

                                          case "leq":
                                            myHit = relevantColumn <= filter.value;
                                        }
                                        console.log("Filtering entry with filter - AFTER:"), console.log([ obj, filter, hit, myHit ]), 
                                        hit = hit && (filter.invert ? !myHit : myHit);
                                    }), hit;
                                }) && el.classed("object-explorer-format-" + format.style, !0);
                            }, function(err) {
                                console.log('ERROR occured when retrieving mapped objects (key "' + d.key + '", type "' + d.type + '" for conditional formatting:'), 
                                console.log(err);
                            });
                        });
                    }
                }), svgElements.on("click", function(d) {
                    scope.$apply(function() {
                        scope.activeElement = d.key, updateActiveElement(svg, scope);
                    });
                });
            }, updateActiveElement = function(svg, scope) {
                svg.selectAll("g").classed("explorer-element-active", function(d) {
                    return scope.activeElement && scope.activeElement === d.key;
                });
            };
            scope.activateView = function(viewName) {
                void 0 === viewName ? scope.activeView = noView : (scope.activeView = scope.views.find(function(d) {
                    return d.name === viewName;
                }), void 0 === scope.activeView && (scope.activeView = noView));
            }, scope.enterMappingMode = function(objectType, addColumns) {
                preMappingView || (preMappingView = scope.activeView), scope.activeView = {
                    icon: void 0,
                    name: "Mapping",
                    type: "objectMapping",
                    options: {
                        type: objectType,
                        addColumns: addColumns
                    }
                };
            }, scope.closeMappingMode = function() {
                preMappingView && (scope.activeView = preMappingView, preMappingView = void 0);
            }, drawElements(svg, scope), scope.mappingUpdated = function() {
                console.log("mappingUpdated called. Re-drawing (debounced)..."), mappingUpdatedTimeoutPromise && $timeout.cancel(mappingUpdatedTimeoutPromise), 
                mappingUpdatedTimeoutPromise = $timeout(function() {
                    drawElements(svg, scope);
                }, 3e3);
            };
            zoomKeyCtrl && zoomKeyCtrl.onZoom(function(zoomLink) {
                if (!oldZoomLink || zoomLink !== oldZoomLink) {
                    var zoomMatch = zoomLink.match(/^([^\/]+)\/([^\/]+)\/?([0-9]*)$/);
                    if (oldZoomLink = zoomLink, console.log("zoomListener for Object Explorer called: " + zoomLink), 
                    console.log(zoomMatch), null !== zoomMatch) return zoomMatch[1] && zoomMatch[1] !== scope.activeElement && (scope.activeElement = zoomMatch[1], 
                    updateActiveElement(svg, scope)), scope.activateView(zoomMatch[2]), zoomMatch[3] ? zoomMatch[3] : "";
                }
            }), scope.$watch("elements", function(newVal, oldVal, scope) {
                scope.elements && 0 < scope.elements.length && drawElements(svg, scope);
            }, !0), scope.$watch("width", function(newVal, oldVal, scope) {
                scope.elements && 0 < scope.elements.length && drawElements(svg, scope);
            }, !0), scope.$watch("height", function(newVal, oldVal, scope) {
                scope.elements && 0 < scope.elements.length && drawElements(svg, scope);
            }, !0);
            var replaceKeywords = function(keyword, element) {
                return void 0 !== element ? Array.isArray(keyword) ? keyword.map(function(k) {
                    return k.replace("[ELEMENT]", element);
                }) : [ keyword.replace("[ELEMENT]", element) ] : keyword;
            };
            scope.$watch("activeView", function(newVal, oldVal, scope) {
                "notes" === newVal.type && (scope.activeViewKeywords = replaceKeywords(newVal.options.keywordID, scope.activeElement));
            }), scope.$watch("activeElement", function(newVal, oldVal, scope) {
                scope.activeView && "notes" === scope.activeView.type && (scope.activeViewKeywords = replaceKeywords(scope.activeView.options.keywordID, newVal));
            });
        },
        templateUrl: "common/directives/objectExplorer.tmpl.html"
    };
} ]).directive("objectExplorerTable", [ "gettext", "objectExplorerService", function(gettext, objectExplorerService) {
    return {
        restrict: "E",
        scope: {
            mappingKey: "=",
            showElement: "=",
            showType: "=",
            addColumns: "=",
            lineHeight: "=?"
        },
        link: function(scope) {
            scope.isLoading = !0, scope.errMessage = void 0, scope.showGrid = !1, scope.objectGridOptions = {
                enableSorting: !0,
                enableFiltering: !0,
                enableColumnResizing: !0,
                columnDefs: [ {
                    name: "Title",
                    field: "title",
                    cellTemplate: '<div class="ui-grid-cell-contents"><a href="{{row.entity.link}}" target="_blank" ng-if="row.entity.link">{{row.entity.title}}</a><span ng-if="!row.entity.link">{{row.entity.title}}</span><span ng-if="row.entity.description" class="object-explorer-object-description"> {{row.entity.description}}</span></div>'
                } ],
                data: []
            }, scope.lineHeight && (scope.objectGridOptions.rowHeight = scope.lineHeight), console.log("LINK on Table called: showElement = " + scope.showElement + ", showType = " + scope.showType + ", addColumns = " + scope.addColumns), 
            console.log(scope.objectGridOptions), console.log("Done.");
            var updateColumns = function(addColumns) {
                var newColumns = [ {
                    name: "Title",
                    field: "title",
                    cellTemplate: '<div class="ui-grid-cell-contents"><a href="{{row.entity.link}}" target="_blank" ng-if="row.entity.link">{{row.entity.title}}</a><span ng-if="!row.entity.link">{{row.entity.title}}</span><span ng-if="row.entity.description" class="object-explorer-object-description"> {{row.entity.description}}</span></div>'
                } ];
                Array.isArray(addColumns) || (addColumns = []), addColumns.forEach(function(col) {
                    newColumns.push({
                        name: col.name,
                        displayName: col.name,
                        field: "additionalColumns." + col.field,
                        width: col.width
                    });
                }), scope.objectGridOptions.columnDefs = newColumns;
            }, updateObjects = function(showElement, showType) {
                scope.isLoading = !0, scope.errMessage = "", scope.objectGridOptions.data = [], 
                console.log("updateObjects called. showElement = " + showElement + ", showType = " + showType), 
                void 0 === showElement || "" === showElement ? (scope.isLoading = !1, scope.showGrid = !1, 
                scope.errMessage = gettext("You need to select an element first.")) : objectExplorerService.getMappedObjects(scope.mappingKey, showElement, showType).then(function(mappedObjects) {
                    scope.objectGridOptions.data = mappedObjects, scope.isLoading = !1, scope.errMessage = "", 
                    scope.showGrid = !0;
                }, function(err) {
                    scope.isLoading = !1, scope.errMessage = err, scope.showGrid = !1;
                });
            };
            updateColumns(scope.addColumns), updateObjects(scope.showElement, scope.showType), 
            scope.$watch("addColumns", function(newVal, oldVal, scope) {
                updateColumns(scope.addColumns);
            }, !0), scope.$watch("showElement", function(newVal, oldVal, scope) {
                updateObjects(scope.showElement, scope.showType);
            }, !0), scope.$watch("showType", function(newVal, oldVal, scope) {
                updateObjects(scope.showElement, scope.showType);
            }, !0), scope.$on("$destroy", function() {
                console.log("DESTROY called on our table directive for showElement = " + scope.showElement + ", showType = " + scope.showType);
            });
        },
        templateUrl: "common/directives/objectExplorerTable.tmpl.html"
    };
} ]).directive("objectExplorerMapping", [ "gettext", "objectExplorerService", function(gettext, objectExplorerService) {
    return {
        restrict: "E",
        scope: {
            mappingKey: "=",
            activeElement: "=",
            showType: "=",
            addColumns: "=",
            onMap: "=?",
            lineHeight: "=?"
        },
        link: function(scope) {
            scope.isLoading = !0, scope.errMessage = void 0, scope.showGrid = !1, scope.mappingGridOptions = {
                enableSorting: !0,
                enableFiltering: !0,
                enableColumnResizing: !0,
                columnDefs: [ {
                    name: "Title",
                    field: "title",
                    cellTemplate: '<div class="ui-grid-cell-contents"><a href="{{row.entity.link}}" target="_blank" ng-if="row.entity.link">{{row.entity.title}}</a><span ng-if="!row.entity.link">{{row.entity.title}}</span><span ng-if="row.entity.description" class="object-explorer-object-description"> {{row.entity.description}}</span></div>'
                } ],
                data: []
            }, scope.lineHeight && (scope.mappingGridOptions.rowHeight = scope.lineHeight), 
            console.log("LINK on Mapping called: activeElement = " + scope.activeElement + ", showType = " + scope.showType + ", addColumns = " + scope.addColumns), 
            console.log(scope.mappingGridOptions), console.log("Done.");
            var updateColumns = function(addColumns) {
                var newColumns = [ {
                    name: "Title",
                    field: "title",
                    cellTemplate: '<div class="ui-grid-cell-contents"><a href="{{row.entity.link}}" target="_blank" ng-if="row.entity.link">{{row.entity.title}}</a><span ng-if="!row.entity.link">{{row.entity.title}}</span><span ng-if="row.entity.description" class="object-explorer-object-description"> {{row.entity.description}}</span></div>'
                } ];
                Array.isArray(addColumns) || (addColumns = []), addColumns.forEach(function(col) {
                    newColumns.push({
                        name: col.name,
                        displayName: col.name,
                        field: "additionalColumns." + col.field,
                        width: col.width
                    });
                }), newColumns.push({
                    name: "Unmapped",
                    field: "unmapped",
                    width: 50
                }), newColumns.push({
                    name: "Mapping",
                    field: "mapping",
                    cellTemplate: '<div class="ui-grid-cell-contents">{{row.entity.mapping}} <i class="fa fa-trash icon-as-button" title="{{ \'Remove mapping\' | translate }}" ng-show="row.entity.mapping !== \'\' && !row.entity.isSaving" ng-click="grid.appScope.removeMapping(row.entity, row.entity.mapping)"></i> <i class="fa fa-plus icon-as-button" title="{{ \'Add mapping\' | translate }}" ng-click="grid.appScope.setMapping(row.entity)"></i></div>'
                }), newColumns.push({
                    name: "Saving",
                    displayName: " ",
                    enableColumnMenu: !1,
                    enableFiltering: !1,
                    enableSorting: !1,
                    field: "isSaving",
                    cellTemplate: '<div class="ui-grid-cell-contents"><span ng-if="row.entity.isSaving" class="loadingIndicatorSmall">&nbsp;&nbsp;&nbsp;</span></div>',
                    width: 50
                }), scope.mappingGridOptions.columnDefs = newColumns;
            }, updateObjects = function(showType) {
                scope.isLoading = !0, scope.errMessage = "", scope.mappingGridOptions.data = [], 
                console.log("updateObjects for Mapping called. showType = " + showType), objectExplorerService.getObjectsByType(showType).then(function(objectsByType) {
                    var gridData = [];
                    objectsByType.forEach(function(d) {
                        d.isSaving = 0, Array.isArray(d.mappings) && 0 !== d.mappings.length ? (d.unmapped = "", 
                        d.mappings.forEach(function(mapping) {
                            d.mapping = mapping, gridData.push(Object.assign({}, d));
                        })) : (d.unmapped = "X", d.mapping = "", gridData.push(d));
                    }), scope.mappingGridOptions.data = gridData, scope.isLoading = !1, scope.errMessage = "", 
                    scope.showGrid = !0;
                }, function(err) {
                    scope.isLoading = !1, scope.errMessage = err, scope.showGrid = !1;
                });
            };
            scope.setMapping = function(entity) {
                if (void 0 !== scope.activeElement) {
                    if (!(-1 < entity.mappings.indexOf(scope.activeElement))) {
                        var newEntry;
                        if ("X" === entity.unmapped) entity.unmapped = "", entity.mapping = scope.activeElement, 
                        entity.mappings = [ scope.activeElement ], newEntry = entity; else {
                            entity.mappings.push(scope.activeElement);
                            var indexOfElement = scope.mappingGridOptions.data.indexOf(entity);
                            delete (newEntry = Object.assign({}, entity)).$$hashKey, newEntry.mapping = scope.activeElement, 
                            console.log("Old data element:"), console.log(entity), console.log("Adding new data element: "), 
                            console.log(newEntry), scope.mappingGridOptions.data.splice(indexOfElement + 1, 0, newEntry);
                        }
                        newEntry.isSaving++, objectExplorerService.addMapping(entity.id, scope.mappingKey, scope.activeElement).then(function() {
                            newEntry.isSaving--, scope.onMap && scope.onMap();
                        }, function(err) {
                            window.alert(gettext("An error occured while trying to save the new mapping: ") + err), 
                            newEntry.isSaving--;
                        });
                    }
                } else window.alert(gettext("You need to select an element to which this object should be mapped."));
            }, scope.removeMapping = function(entity, mapping) {
                var savingEntity;
                if (Array.isArray(entity.mappings) && -1 !== entity.mappings.indexOf(mapping)) {
                    if (entity.mappings.splice(entity.mappings.indexOf(mapping), 1), 1 <= entity.mappings.length) {
                        var indexOfElement = scope.mappingGridOptions.data.indexOf(entity);
                        scope.mappingGridOptions.data.splice(indexOfElement, 1), savingEntity = 0 === indexOfElement || scope.mappingGridOptions.data[indexOfElement - 1].id !== entity.id ? scope.mappingGridOptions.data[indexOfElement] : scope.mappingGridOptions.data[indexOfElement - 1];
                    } else entity.unmapped = "X", entity.mapping = "", savingEntity = entity;
                    savingEntity.isSaving++, objectExplorerService.removeMapping(entity.id, scope.mappingKey, mapping).then(function() {
                        savingEntity.isSaving--, scope.onMap && scope.onMap();
                    }, function(err) {
                        window.alert(gettext("An error occured while trying to remove the mapping: ") + err), 
                        savingEntity.isSaving--;
                    });
                }
            }, updateColumns(scope.addColumns), updateObjects(scope.showType), scope.$watch("addColumns", function(newVal, oldVal, scope) {
                updateColumns(scope.addColumns);
            }, !0), scope.$watch("showType", function(newVal, oldVal, scope) {
                updateObjects(scope.showType);
            }, !0);
        },
        templateUrl: "common/directives/objectExplorerMapping.tmpl.html"
    };
} ]), angular.module("riskTrackerDirectives", [ "gettext", "chartServices", "miscServices", "risksServices", "helperDirectives" ]).directive("riskMatrix", [ "d3", "miscServices", function(d3, miscServices) {
    var draw = function(svg, width, height, risks, xLabels, yLabels, riskXLabel, riskYLabel, elementSize, oldRisksFilter, readOnly, dispatch) {
        var margin_left = Math.round(.2 * width), margin_right = Math.round(.05 * width), margin_top = Math.round(.05 * height), margin_bottom = Math.round(.2 * height), elementHalf = Math.round(elementSize / 2);
        svg.attr("width", width).attr("height", height), svg.select(".clip-rect").attr("x", margin_left - elementHalf).attr("y", margin_top - elementHalf).attr("width", width - margin_left - margin_right + elementSize).attr("height", height - margin_top - margin_bottom + elementSize);
        var xScale = d3.scaleLinear().domain([ 0, 100 ]).range([ margin_left, width - margin_right ]), yScale = d3.scaleLinear().domain([ 0, 100 ]).range([ height - margin_bottom, margin_top ]);
        svg.select(".x-grid").selectAll("line").data(xLabels.concat([ "" ])).enter().append("line").attr("x1", function(d, i) {
            return xScale(i / xLabels.length * 100);
        }).attr("y1", yScale(0)).attr("x2", function(d, i) {
            return xScale(i / xLabels.length * 100);
        }).attr("y2", yScale(100)), svg.select(".y-grid").selectAll("line").data(yLabels.concat([ "" ])).enter().append("line").attr("x1", xScale(0)).attr("y1", function(d, i) {
            return yScale(i / yLabels.length * 100);
        }).attr("x2", xScale(100)).attr("y2", function(d, i) {
            return yScale(i / yLabels.length * 100);
        }), svg.select(".x-axis-label").attr("x", Math.round(width / 2)).attr("y", height - Math.round(margin_bottom / 3) + 5).text(riskXLabel), 
        svg.select(".x-axis").selectAll("text").data(xLabels).enter().append("text").attr("x", function(d, i) {
            return xScale((i + .5) / xLabels.length * 100);
        }).attr("y", height - Math.round(2 * margin_bottom / 3 + 5)).text(function(d) {
            return d;
        }), svg.select(".y-axis-label").attr("transform", "translate(" + Math.round(margin_left / 3 + 5) + "," + Math.round(height / 2) + ")rotate(-90)").text(riskYLabel), 
        svg.select(".y-axis").selectAll("text").data(xLabels).enter().append("text").attr("transform", function(d, i) {
            return "translate(" + Math.round(2 * margin_left / 3 + 5) + "," + yScale((i + .5) / yLabels.length * 100) + ")rotate(-90)";
        }).text(function(d) {
            return d;
        });
        var drag = d3.drag().subject(function(d) {
            return {
                x: xScale(d.xAxis),
                y: yScale(d.yAxis)
            };
        }).on("drag", function(d) {
            d.xAxis = Math.min(100, Math.max(0, xScale.invert(d3.event.x))), d.yAxis = Math.min(100, Math.max(0, yScale.invert(d3.event.y))), 
            d3.select(this).attr("transform", "translate(" + (xScale(d.xAxis) - elementHalf) + "," + (yScale(d.yAxis) - elementHalf) + ")");
        }).on("end", function(d, i) {
            dispatch.call("riskChange", this, d, i);
        });
        if (Array.isArray(risks) && 0 < risks.length) {
            var risksInactive;
            risksInactive = oldRisksFilter ? risks.filter(function(d) {
                return !d.active && !d.isDeleted && d.valid_from <= oldRisksFilter && d.valid_to > oldRisksFilter;
            }) : [];
            var riskElements = svg.select(".data").selectAll(".risk-inactive").data(risksInactive);
            riskElements.exit().remove();
            var newGroups = riskElements.enter().append("g");
            newGroups.append("rect"), newGroups.append("title"), newGroups.append("text"), newGroups.merge(riskElements).classed("risk-element", !0).classed("risk-inactive", !0).attr("transform", function(d) {
                return "translate(" + (xScale(d.xAxis) - elementHalf) + "," + (yScale(d.yAxis) - elementHalf) + ")";
            }).select("text").attr("x", elementHalf).attr("y", elementHalf + 5).text(function(d) {
                return d.number;
            }), newGroups.merge(riskElements).select("rect").attr("width", elementSize).attr("height", elementSize), 
            newGroups.merge(riskElements).select("title").text(function(d) {
                return miscServices.htmlToText(d.title);
            });
            var risksActive = risks.filter(function(d) {
                return d.active && !d.isDeleted;
            });
            svg.select(".data").selectAll(".risk-active").remove(), (riskElements = svg.select(".data").selectAll(".risk-active").data(risksActive)).exit().remove(), 
            (newGroups = riskElements.enter().append("g")).append("rect"), newGroups.append("title"), 
            newGroups.append("text");
            var mergedElements = newGroups.merge(riskElements).classed("risk-element", !0).classed("risk-active", !0).attr("transform", function(d) {
                return "translate(" + (xScale(d.xAxis) - elementHalf) + "," + (yScale(d.yAxis) - elementHalf) + ")";
            });
            readOnly || mergedElements.call(drag), newGroups.merge(riskElements).select("text").attr("x", elementHalf).attr("y", elementHalf + 5).text(function(d) {
                return d.number;
            }), newGroups.merge(riskElements).select("rect").attr("width", elementSize).attr("height", elementSize), 
            newGroups.merge(riskElements).select("title").text(function(d) {
                return miscServices.htmlToText(d.title);
            });
        }
    };
    return {
        restrict: "E",
        scope: {
            width: "=",
            height: "=",
            risks: "=",
            risksHash: "=",
            riskXLabels: "=",
            riskYLabels: "=",
            riskXLabel: "=",
            riskYLabel: "=",
            elementSize: "=",
            oldRisksFilter: "=?",
            readOnly: "=?"
        },
        link: function(scope, element) {
            var svg;
            (svg = d3.select(element[0]).append("svg")).append("g").attr("class", "x-axis axis"), 
            svg.append("g").attr("class", "y-axis axis"), svg.append("g").attr("class", "x-grid grid"), 
            svg.append("g").attr("class", "y-grid grid"), svg.append("text").attr("class", "x-axis-label"), 
            svg.append("text").attr("class", "y-axis-label"), svg.append("g").attr("class", "data").attr("clip-path", "url(#clip-path-" + scope.$id + ")"), 
            svg.append("clipPath").attr("id", "clip-path-" + scope.$id).append("rect").attr("class", "clip-rect");
            var dispatch = d3.dispatch("riskChange");
            dispatch.on("riskChange", function() {
                scope.$apply(function() {
                    scope.risksHash = miscServices.hashCode(JSON.stringify(scope.risks));
                });
            }), scope.$watch("risksHash", function(newVal, oldVal, scope) {
                draw(svg, scope.width, scope.height, scope.risks, scope.riskXLabels, scope.riskYLabels, scope.riskXLabel, scope.riskYLabel, scope.elementSize, scope.oldRisksFilter, scope.readOnly, dispatch);
            }, !0), scope.$watch("oldRisksFilter", function(newVal, oldVal, scope) {
                draw(svg, scope.width, scope.height, scope.risks, scope.riskXLabels, scope.riskYLabels, scope.riskXLabel, scope.riskYLabel, scope.elementSize, scope.oldRisksFilter, scope.readOnly, dispatch);
            }, !0);
        }
    };
} ]).directive("riskTracker", [ "miscServices", "risksService", "$q", "$filter", "gettext", function(miscServices, risksService, $q, $filter, gettext) {
    return {
        restrict: "E",
        replace: "true",
        templateUrl: "common/directives/riskTracker.tmpl.html",
        scope: {
            width: "=",
            height: "=",
            riskCategory: "=",
            riskCategoryDescription: "=",
            maxDaysOld: "=",
            riskXLabel: "=",
            riskXLabels: "=",
            riskYLabel: "=",
            riskYLabels: "=",
            showImpacts: "=?",
            sourceLink: "@?"
        },
        require: "?^zoomKey",
        link: function(scope, elems, attrs, zoomKeyCtrl) {
            var minDate;
            scope.loading = !1, scope.errorMessage = "", scope.risks = [], scope.risksHash = "", 
            scope.oldRiskDatetimes = [], scope.zoomKey = zoomKeyCtrl ? zoomKeyCtrl.getZoomKey() : void 0;
            var addedDatetimes = {}, makeOldCopy = function(risk) {
                return {
                    title: risk.title,
                    description: risk.description,
                    xAxis: risk.xAxis,
                    yAxis: risk.yAxis
                };
            }, hasRiskChanged = function(risk, exact) {
                return exact ? !risk.old || risk.title !== risk.old.title || risk.description !== risk.old.description || 0 < Math.abs(risk.xAxis - risk.old.xAxis) || 0 < Math.abs(risk.yAxis - risk.old.yAxis) : !risk.old || miscServices.htmlToText(risk.title).replace(/\s+/g, " ") !== miscServices.htmlToText(risk.old.title).replace(/\s+/g, " ") || miscServices.htmlToText(risk.description).replace(/\s+/g, " ") !== miscServices.htmlToText(risk.old.description).replace(/\s+/g, " ") || 3 < Math.abs(risk.xAxis - risk.old.xAxis) || 3 < Math.abs(risk.yAxis - risk.old.yAxis);
            }, currDatetime = new Date(), currNumber = 0, currLetter = 0, letterList = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
            void 0 === scope.riskCategory || "" === scope.riskCategory ? scope.errorMessage = gettext("No valid risk category has been specified.") : (scope.loading = !0, 
            zoomKeyCtrl && zoomKeyCtrl.startedLoading(), isNaN(scope.maxDaysOld) || scope.maxDaysOld <= 0 ? minDate = void 0 : (minDate = new Date()).setDate(minDate.getDate() - scope.maxDaysOld), 
            risksService.getRisksByCategory(scope.riskCategory, minDate).then(function(risksResult) {
                var i, hasActive = !1;
                for (i = 0; i < risksResult.length; i++) {
                    0 === i ? (hasActive = risksResult[i].valid_from <= currDatetime && risksResult[i].valid_to > currDatetime, 
                    scope.risks.push(risksResult[i]), hasActive ? (currNumber += 1, scope.risks[0].number = currNumber) : (scope.risks[0].number = miscServices.repeatString(letterList[currLetter % 52], Math.floor(currLetter / 52) + 1), 
                    currLetter += 1), scope.risks[0].head = !0, scope.risks[0].active = hasActive, scope.risks[0].hasActive = hasActive, 
                    scope.risks[0].isDeleted = !1, scope.risks[0].old = makeOldCopy(scope.risks[0])) : (risksResult[i - 1].initialId !== risksResult[i].initialId ? (hasActive = risksResult[i].valid_from <= currDatetime && risksResult[i].valid_to > currDatetime, 
                    scope.risks.push(risksResult[i]), hasActive ? (currNumber += 1, scope.risks[scope.risks.length - 1].number = currNumber) : (scope.risks[scope.risks.length - 1].number = miscServices.repeatString(letterList[currLetter % 52], Math.floor(currLetter / 52) + 1), 
                    currLetter += 1), scope.risks[scope.risks.length - 1].head = !0, scope.risks[scope.risks.length - 1].active = hasActive) : (scope.risks.push(risksResult[i]), 
                    scope.risks[scope.risks.length - 1].number = hasActive ? currNumber : miscServices.repeatString(letterList[currLetter % 52], Math.floor(currLetter / 52) + 1), 
                    scope.risks[scope.risks.length - 1].head = !1, scope.risks[scope.risks.length - 1].active = !1), 
                    scope.risks[scope.risks.length - 1].hasActive = hasActive, scope.risks[scope.risks.length - 1].isDeleted = !1, 
                    scope.risks[scope.risks.length - 1].old = makeOldCopy(scope.risks[scope.risks.length - 1]));
                    var justBefore = new Date(risksResult[i].valid_to - 1e3);
                    risksResult[i].valid_to <= currDatetime && !(justBefore.toISOString() in addedDatetimes) && (addedDatetimes[justBefore.toISOString()] = 1, 
                    scope.oldRiskDatetimes.push({
                        dt: justBefore,
                        text: $filter("date")(justBefore, "yyyy-MM-dd HH:mm")
                    }));
                }
                zoomKeyCtrl && zoomKeyCtrl.stoppedLoading(), scope.risksHash = miscServices.hashCode(JSON.stringify(scope.risks)), 
                scope.loading = !1, scope.errMessage = "";
            }, function(err) {
                scope.errorMessage = err, zoomKeyCtrl && zoomKeyCtrl.stoppedLoading(), scope.loading = !1;
            })), scope.htmlToText = miscServices.htmlToText, scope.addRisk = function() {
                currNumber += 1, scope.risks.push({
                    id: -currNumber,
                    number: currNumber,
                    title: gettext("New Title"),
                    description: gettext("New Description"),
                    riskStatus: "Final",
                    category: scope.riskCategory,
                    valid_from: currDatetime,
                    valid_to: new Date(2999, 12, 31, 12, 0, 0),
                    xAxis: 50,
                    yAxis: 50,
                    isDeleted: !1,
                    active: !0,
                    old: {
                        title: "",
                        description: "",
                        xAxis: 0,
                        yAxis: 0
                    }
                }), scope.risksHash = miscServices.hashCode(JSON.stringify(scope.risks));
            }, scope.deleteRisk = function(riskId) {
                if (miscServices.translatedConfirm(gettext("Are you sure you want to remove this risk item? Once you save your changes, you will not be able to reactive it."))) {
                    var myInitialId, i;
                    for (i = 0; i < scope.risks.length; i++) scope.risks[i].id === riskId && scope.risks[i].active && (scope.risks[i].isDeleted = !0, 
                    myInitialId = scope.risks[i].initialId);
                    if (void 0 !== myInitialId && 0 <= myInitialId) {
                        var myLetter = miscServices.repeatString(letterList[currLetter % 52], Math.floor(currLetter / 52) + 1);
                        for (currLetter += 1, i = 0; i < scope.risks.length; i++) scope.risks[i].initialId === myInitialId && (scope.risks[i].hasActive = !1, 
                        scope.risks[i].number = myLetter);
                    }
                    scope.risksHash = miscServices.hashCode(JSON.stringify(scope.risks));
                }
            }, scope.savingRisks = !1, scope.saveRisks = function(callback) {
                var updateRisksPromise = $q.resolve();
                scope.savingRisks = !0, scope.risks.forEach(function(d) {
                    scope.sourceLink && (d.sourceLink = scope.sourceLink), d.id < 0 && !d.isDeleted ? updateRisksPromise = updateRisksPromise.then(function() {
                        return risksService.addRisk(d);
                    }).then(function(res) {
                        return d.old = makeOldCopy(d), res;
                    }) : 0 <= d.id && hasRiskChanged(d, !0) && !d.isDeleted ? updateRisksPromise = updateRisksPromise.then(function() {
                        return risksService.updateRisk(d, hasRiskChanged(d, !1));
                    }).then(function(res) {
                        return d.old = makeOldCopy(d), res;
                    }) : 0 <= d.id && d.isDeleted && (updateRisksPromise = updateRisksPromise.then(function() {
                        return risksService.deleteRisk(d);
                    }).then(function(res) {
                        for (var i = 0; i < scope.risks.length; i++) scope.risks[i].initialId !== d.initialId || scope.risks[i].isDeleted || (scope.risks[i].head = !0);
                        return res;
                    }));
                }), updateRisksPromise.then(function() {
                    scope.savingRisks = !1, void 0 !== callback && callback();
                }, function(err) {
                    window.alert(err + "\n\n" + gettext("We suggest reloading the page to obtain the state currently saved in the database and to try again afterwards.")), 
                    scope.savingRisks = !1;
                });
            }, scope.freezingRisks = !1, scope.freezeRisks = function() {
                if (miscServices.translatedConfirm(gettext('Are you sure you want to freeze all risks? All changes will be saved, then a new "snapshot" of all existing risks will be created and turned into "history". Note that this action cannot be undone and that frozen risks cannot be edited or deleted.'))) {
                    scope.freezingRisks = !0;
                    var currDatetime = new Date();
                    scope.saveRisks(function() {
                        var freezeRiskPromise = $q.resolve();
                        scope.risks.forEach(function(d) {
                            !d.isDeleted && d.active && (freezeRiskPromise = freezeRiskPromise.then(function() {
                                return risksService.freezeRisk(d, currDatetime);
                            }).then(function(res) {
                                res.active = !0, res.head = !0, res.number = d.number, res.isDeleted = !1, res.old = makeOldCopy(res), 
                                d.active = !1, d.head = !1, d.id < 0 && (d.isDeleted = !0);
                                for (var i = 0; i < scope.risks.length; i++) 0 !== i && scope.risks[i - 1].initialId === res.initialId || scope.risks[i].initialId !== res.initialId || scope.risks.splice(i, 0, res);
                                return res;
                            }));
                        }), freezeRiskPromise.then(function() {
                            scope.freezingRisks = !1;
                            var justBefore = new Date(currDatetime - 1e3);
                            scope.oldRiskDatetimes.push({
                                dt: justBefore,
                                text: $filter("date")(justBefore, "yyyy-MM-dd HH:mm")
                            }), scope.risksHash = miscServices.hashCode(JSON.stringify(scope.risks));
                        }, function(err) {
                            window.alert(gettext("An error occurred while freezing risk objects:") + "\n\n" + err + "\n\n" + gettext("We suggest reloading the page to obtain the clean state from the database and to try again.")), 
                            scope.freezingRisks = !1;
                        });
                    });
                }
            }, scope.showOldRisk = function(val) {
                return !!scope.oldRisksFilter && (val.valid_from <= scope.oldRisksFilter && val.valid_to > scope.oldRisksFilter);
            }, scope.getOldRisk = function(risk) {
                if (scope.oldRisksFilter && void 0 !== risk.initialId && !(risk.initialId < 0)) return scope.risks.find(function(oldRisk) {
                    return oldRisk.initialId === risk.initialId && oldRisk !== risk && oldRisk.valid_from <= scope.oldRisksFilter && oldRisk.valid_to > scope.oldRisksFilter;
                });
            };
        }
    };
} ]), angular.module("socialDirectives", [ "gettext", "socialServices", "usersServices", "configServices", "miscServices", "notesServices" ]).filter("elementTypeToText", [ "gettext", function(gettext) {
    var elementTypesMapping = {
        note: gettext("Note"),
        risk: gettext("Risk"),
        auditFormData: gettext("Audit form"),
        task: gettext("OCA task")
    };
    return function(input) {
        return void 0 !== elementTypesMapping[input] ? elementTypesMapping[input] : input;
    };
} ]).directive("atMentions", [ "configService", "usersService", function(configService, usersService) {
    return {
        restrict: "A",
        scope: {
            atMentions: "="
        },
        require: "ngModel",
        controller: [ "$scope", function($scope) {
            this.$onDestroy = function() {
                $scope.tribute.detach($scope.atMentionElement);
            };
        } ],
        link: function(scope, element, attrs, ngModelCtrl) {
            scope.atMentionElement = element[0], scope.potentialAtMentions = {}, Array.isArray(scope.atMentions) || (scope.atMentions = []);
            var checkAtMentions = function() {
                scope.atMentions = Object.keys(scope.potentialAtMentions).filter(function(mentionedId) {
                    return 0 <= ngModelCtrl.$modelValue.indexOf(scope.potentialAtMentions[mentionedId]);
                }), console.log("checkAtMentions called."), console.log([ scope.potentialAtMentions, ngModelCtrl.$modelValue, scope.atMentions ]);
            };
            configService.getConfiguration().then(function(config) {
                return usersService.getUsersByGroup(config["At-Mentions Group"]);
            }).then(function(users) {
                var mappedUsers = users.map(function(user) {
                    return {
                        id: user.id,
                        key: user.name + " " + user.login + " " + user.email,
                        value: user.name
                    };
                });
                scope.atMentions.forEach(function(mentionId) {
                    var mentionUser = mappedUsers.find(function(d) {
                        return d.id.toString() === mentionId.toString();
                    });
                    scope.potentialAtMentions[mentionUser.id.toString()] = "@" + mentionUser.value;
                }), scope.tribute = new Tribute({
                    values: mappedUsers,
                    menuItemTemplate: function(item) {
                        return item.original.value;
                    }
                }), scope.tribute.attach(scope.atMentionElement), scope.atMentionElement.addEventListener("tribute-replaced", function(e) {
                    console.log("At-mention triggered:"), console.log(e.detail.item), scope.potentialAtMentions[e.detail.item.original.id.toString()] = "@" + e.detail.item.original.value, 
                    checkAtMentions();
                });
            }), ngModelCtrl.$viewChangeListeners.push(checkAtMentions);
        }
    };
} ]).directive("dashboardNewsFeed", [ "gettext", "subscriptionService", "miscServices", function(gettext, subscriptionService, miscServices) {
    return {
        restrict: "E",
        scope: {
            userId: "=?",
            limit: "=?",
            allowMore: "=?"
        },
        link: function(scope) {
            scope.errMessage = void 0, scope.limit = parseInt(scope.limit) ? parseInt(scope.limit) : 30, 
            scope.lastLoaded = void 0, scope.newsfeedGroups = [], scope.newsfeedGroupsHash = {}, 
            scope.hasMore = !1, scope.isLoading = !0, console.log("link called on dashboardNewsFeed..."), 
            console.log(scope);
            var addNewsfeedEntries = function(newsObjs) {
                var today = new Date(), yesterday = new Date();
                yesterday.setDate(today.getDate() - 1);
                var thisWeekString = miscServices.formatDate(today, "%Y-%V"), lastWeek = new Date();
                lastWeek.setDate(today.getDate() - 7);
                var lastWeekString = miscServices.formatDate(lastWeek, "%Y-%V"), lastMonth = new Date();
                lastMonth.setDate(15), lastMonth.setMonth(today.getMonth() - 1), newsObjs.forEach(function(entry) {
                    "changed-risk" === entry.actionType && entry.contentVariables.risk && entry.contentVariables.risk.old && (entry._riskMatrix = [ {
                        active: !0,
                        isDeleted: !1,
                        valid_from: miscServices.parseDatetime(entry.contentVariables.risk.valid_from),
                        valid_to: miscServices.parseDatetime(entry.contentVariables.risk.valid_to),
                        number: entry.contentVariables.risk.number,
                        title: entry.contentVariables.risk.title,
                        xAxis: entry.contentVariables.risk.xAxis,
                        yAxis: entry.contentVariables.risk.yAxis
                    }, {
                        active: !1,
                        isDeleted: !1,
                        valid_from: new Date("1990-01-01T01:00:00"),
                        valid_to: miscServices.parseDatetime(entry.contentVariables.risk.valid_from),
                        number: entry.contentVariables.risk.number,
                        title: entry.contentVariables.risk.old.title,
                        xAxis: entry.contentVariables.risk.old.xAxis,
                        yAxis: entry.contentVariables.risk.old.yAxis
                    } ], entry._oldRisksFilter = new Date("1991-01-01T01:00:00"));
                    var group = gettext("Older");
                    entry.newsTime.getDate() === today.getDate() && entry.newsTime.getMonth() === today.getMonth() && entry.newsTime.getFullYear() === today.getFullYear() ? group = gettext("Today") : entry.newsTime.getDate() === yesterday.getDate() && entry.newsTime.getMonth() === yesterday.getMonth() && entry.newsTime.getFullYear() === yesterday.getFullYear() ? group = gettext("Yesterday") : miscServices.formatDate(entry.newsTime, "%Y-%V") === thisWeekString ? group = gettext("This Week") : miscServices.formatDate(entry.newsTime, "%Y-%V") === lastWeekString ? group = gettext("Last Week") : entry.newsTime.getMonth() === today.getMonth() && entry.newsTime.getFullYear() === today.getFullYear() ? group = gettext("This Month") : entry.newsTime.getMonth() === lastMonth.getMonth() && entry.newsTime.getFullYear() === lastMonth.getFullYear() && (group = gettext("Last Month")), 
                    scope.newsfeedGroupsHash[group] ? scope.newsfeedGroupsHash[group].entries.push(entry) : (scope.newsfeedGroupsHash[group] = {
                        group: group,
                        entries: [ entry ]
                    }, scope.newsfeedGroups.push(scope.newsfeedGroupsHash[group]));
                });
            };
            subscriptionService.getNewsfeed(scope.userId, scope.limit, 0, !0).then(function(newsfeedData) {
                var newsObjs = newsfeedData[0];
                addNewsfeedEntries(newsObjs), scope.lastLoaded = 1 <= newsObjs.length ? newsObjs[newsObjs.length - 1].id : void 0, 
                scope.isLoading = !1, console.log("Received newsfeedGroups:"), console.log(scope.newsfeedGroups), 
                scope.hasMore = scope.allowMore && newsfeedData[1], console.log("hasMore?"), console.log([ scope.allowMore, scope.hasMore, newsObjs.length, scope.limit ]);
            }, function(err) {
                scope.errMessage = err, scope.isLoading = !1;
            }), scope.loadMore = function() {
                scope.isLoading = !0, subscriptionService.getNewsfeed(scope.userId, scope.limit, scope.lastLoaded, !0).then(function(newsfeedData) {
                    addNewsfeedEntries(newsfeedData[0]), scope.isLoading = !1, scope.hasMore = scope.allowMore && newsfeedData[1];
                }, function(err) {
                    scope.errMessage = err, scope.isLoading = !1;
                });
            }, scope.removeSubCallback = function(subscriptionId) {
                scope.newsfeedGroups.forEach(function(group) {
                    group.entries = group.entries.filter(function(newsObj) {
                        return void 0 === newsObj.subscriptionId || null === newsObj.subscriptionId || newsObj.subscriptionId.toString() !== subscriptionId.toString();
                    });
                });
            };
        },
        templateUrl: "common/directives/dashboardNewsFeed.tmpl.html"
    };
} ]).directive("dashboardNewsFeedElement", [ "$q", "keywordsService", "interactionService", "subscriptionService", "miscServices", function($q, keywordsService, interactionService, subscriptionService, miscServices) {
    return {
        restrict: "E",
        scope: {
            item: "=",
            removeSubCallback: "=?"
        },
        link: function(scope) {
            scope.keywordMapping = void 0, keywordsService.getAllKeywords().then(function(keywords) {
                scope.keywordMapping = {}, keywords.forEach(function(d) {
                    scope.keywordMapping[d.id] = d.name;
                });
            }), scope.removeSubscription = function(item, alwaysRemoveSubscription) {
                item.isUnsubscribing = !0;
                var interactionSourceType = item.subscriptionType, interactionSourceId = item.subscriptionTarget;
                "interaction" === item.subscriptionType && (interactionSourceType = item.sourceType, 
                interactionSourceId = item.sourceId), (alwaysRemoveSubscription ? $q.resolve(void 0) : interactionService.getInteractionSummary(interactionSourceType, interactionSourceId)).then(function(interactionSummary) {
                    if (interactionSummary && Array.isArray(interactionSummary.watch) && 0 <= interactionSummary.watch.indexOf(item.userId.toString())) return interactionService.addUnwatch(item.userId, interactionSourceType, interactionSourceId);
                    var subscriptionObj = {
                        id: item.subscriptionId,
                        userId: item.userId,
                        type: item.subscriptionType,
                        target: item.subscriptionTarget
                    };
                    return subscriptionService.removeSubscription(subscriptionObj);
                }).then(function() {
                    scope.removeSubCallback && scope.removeSubCallback(item.subscriptionId), item.wasUnsubscribed = !0, 
                    item.isUnsubscribing = !1;
                }, function(err) {
                    miscServices.translatedAlert(err), item.isUnsubscribing = !1;
                });
            };
        },
        templateUrl: "common/directives/dashboardNewsFeedElement.tmpl.html"
    };
} ]).directive("interactionButtons", [ "interactionService", "usersService", "miscServices", function(interactionService, usersService, miscServices) {
    return {
        restrict: "E",
        scope: {
            targetType: "=",
            targetId: "=",
            targetDescription: "=?",
            sourceUrl: "=?",
            interactionSummary: "=?",
            enabledButtons: "=?"
        },
        link: function(scope, element) {
            scope.areLoading = {};
            var interactionGroups = {
                highlight1: "highlights",
                highlight2: "highlights",
                highlight3: "highlights"
            };
            void 0 !== scope.interactionSummary && null !== scope.interactionSummary || (scope.interactionSummary = {}, 
            interactionService.getInteractionSummary(scope.targetType, scope.targetId).then(function(interactionSummary) {
                scope.interactionSummary = interactionSummary;
            })), scope.userId = void 0, usersService.getCurrentUser().then(function(user) {
                scope.userId = user.id;
            }), scope.isEnabled = function(interaction) {
                return !Array.isArray(scope.enabledButtons) || 0 <= scope.enabledButtons.indexOf(interaction);
            }, scope.interactionCount = function(interaction) {
                return Array.isArray(scope.interactionSummary[interaction]) && 0 < scope.interactionSummary[interaction].length ? scope.interactionSummary[interaction].length : "";
            }, scope.isActive = function(interaction) {
                return void 0 !== scope.userId && (Array.isArray(scope.interactionSummary[interaction]) && 0 <= scope.interactionSummary[interaction].indexOf(scope.userId.toString()));
            }, scope.openInteractions = function() {
                interactionService.openSidebarViaLink(scope.targetType, scope.targetId, scope.targetDescription instanceof Function ? scope.targetDescription() : scope.targetDescription, scope.sourceUrl);
            };
            var localAddInteraction = function(interaction) {
                void 0 !== scope.userId && (Array.isArray(scope.interactionSummary[interaction]) ? scope.interactionSummary[interaction].indexOf(scope.userId.toString()) < 0 && scope.interactionSummary[interaction].push(scope.userId.toString()) : scope.interactionSummary[interaction] = [ scope.userId.toString() ]);
            }, localRemoveInteraction = function(interaction) {
                if (void 0 !== scope.userId && Array.isArray(scope.interactionSummary[interaction])) {
                    var idxToRemove = scope.interactionSummary[interaction].indexOf(scope.userId.toString());
                    0 <= idxToRemove && scope.interactionSummary[interaction].splice(idxToRemove, 1);
                }
            }, interactionListener = function(change, interactionObj) {
                "add" === change ? localAddInteraction(interactionObj.interactionType) : "remove" === change && localRemoveInteraction(interactionObj.interactionType);
            };
            interactionService.registerInteractionListener(interactionListener, scope.targetType, scope.targetId), 
            element.on("$destroy", function() {
                interactionService.removeInteractionListener(interactionListener);
            }), scope.triggerWatch = function() {
                void 0 !== scope.userId && (scope.areLoading.watch = !0, scope.isActive("watch") ? interactionService.addUnwatch(scope.userId, scope.targetType, scope.targetId, scope.sourceUrl).then(function() {
                    localRemoveInteraction("watch"), scope.areLoading.watch = !1;
                }, function(err) {
                    miscServices.translatedAlert(err), scope.areLoading.watch = !1;
                }) : interactionService.addWatch(scope.userId, scope.targetType, scope.targetId, scope.targetDescription instanceof Function ? scope.targetDescription() : scope.targetDescription, scope.sourceUrl).then(function() {
                    localAddInteraction("watch"), scope.areLoading.watch = !1;
                }, function(err) {
                    miscServices.translatedAlert(err), scope.areLoading.watch = !1;
                }));
            }, scope.triggerInteraction = function(interaction) {
                void 0 !== scope.userId && (scope.isActive(interaction) ? (scope.areLoading[interaction] = !0, 
                interactionService.removeInteractionsByDetails(interaction, scope.userId, scope.targetType, scope.targetId).then(function() {
                    localRemoveInteraction(interaction), scope.areLoading[interaction] = !1;
                }, function(err) {
                    miscServices.translatedAlert(err), scope.areLoading[interaction] = !1;
                })) : (scope.areLoading[interaction] = !0, interactionService.addInteraction({
                    interactionTime: new Date(),
                    userId: scope.userId,
                    targetType: scope.targetType,
                    targetId: scope.targetId,
                    interactionType: interaction,
                    content: {}
                }, scope.sourceUrl, scope.targetDescription instanceof Function ? scope.targetDescription() : scope.targetDescription).then(function() {
                    localAddInteraction(interaction), localAddInteraction("watch"), scope.areLoading[interaction] = !1;
                }, function(err) {
                    miscServices.translatedAlert(err), scope.areLoading[interaction] = !1;
                }), void 0 !== interactionGroups[interaction] && Object.keys(interactionGroups).forEach(function(groupedInteraction) {
                    groupedInteraction !== interaction && interactionGroups[groupedInteraction] === interactionGroups[interaction] && scope.isActive(groupedInteraction) && (scope.areLoading[groupedInteraction] = !0, 
                    interactionService.removeInteractionsByDetails(groupedInteraction, scope.userId, scope.targetType, scope.targetId).then(function() {
                        localRemoveInteraction(groupedInteraction), scope.areLoading[groupedInteraction] = !1;
                    }, function(err) {
                        miscServices.translatedAlert(err), scope.areLoading[groupedInteraction] = !1;
                    }));
                })));
            };
        },
        templateUrl: "common/directives/interactionButtons.tmpl.html"
    };
} ]).directive("interactionComments", [ "gettext", "miscServices", "interactionService", "subscriptionService", function(gettext, miscServices, interactionService, subscriptionService) {
    return {
        restrict: "E",
        scope: {
            targetType: "=",
            targetId: "=",
            targetDescription: "=?",
            sourceUrl: "=?"
        },
        link: function(scope) {
            scope.commentText = "", scope.commentAtMentions = [], scope.isSaving = !1, scope.saveComment = function() {
                "" !== scope.commentText ? (scope.isSaving = !0, interactionService.addInteraction({
                    interactionTime: new Date(),
                    targetType: scope.targetType,
                    targetId: scope.targetId,
                    interactionType: "comment",
                    content: {
                        commentText: scope.commentText,
                        atMentions: scope.commentAtMentions
                    }
                }, scope.sourceUrl, scope.targetDescription).then(function(interactionObj) {
                    return subscriptionService.updateMentions(scope.targetType, scope.targetId, interactionObj.id, interactionService.addSidebarToURL(scope.sourceUrl, scope.targetType, scope.targetId, scope.targetDescription), scope.commentAtMentions, {
                        from: interactionObj.userId,
                        type: "comment",
                        text: scope.commentText,
                        targetDescription: scope.targetDescription
                    });
                }).then(function() {
                    scope.isSaving = !1, scope.commentText = "", scope.commentAtMentions = [];
                })) : miscServices.translatedAlert(gettext("You cannot submit an empty comment."));
            };
        },
        templateUrl: "common/directives/interactionComments.tmpl.html"
    };
} ]).directive("interactionList", [ "interactionService", "miscServices", "usersService", "gettext", function(interactionService, miscServices, usersService, gettext) {
    return {
        restrict: "E",
        scope: {
            targetType: "=",
            targetId: "=",
            targetDescription: "=?",
            limit: "=?",
            sortOldToNew: "=?",
            allowMore: "=?",
            enableNew: "=?",
            sourceUrl: "=?"
        },
        link: function(scope, element) {
            scope.interactions = [], scope.currentLimit = parseInt(scope.limit) ? parseInt(scope.limit) : 30, 
            scope.hasMore = !1, scope.currentUserId = void 0, interactionService.getInteractions(scope.targetType, scope.targetId, scope.sortOldToNew).then(function(interactions) {
                scope.interactions = interactions, scope.hasMore = scope.interactions.length > scope.currentLimit;
            }), usersService.getCurrentUser().then(function(user) {
                scope.currentUserId = user.id.toString();
            }), scope.loadMore = function() {
                scope.currentLimit += parseInt(scope.limit) ? parseInt(scope.limit) : 30, scope.hasMore = scope.interactions.length > scope.currentLimit;
            }, scope.removeInteraction = function(item) {
                miscServices.translatedConfirm(gettext("Are you sure you want to remove this element?")) && interactionService.removeInteraction(item);
            };
            var interactionListener = function(change, interactionObj) {
                "add" === change ? scope.sortOldToNew ? (scope.currentLimit < scope.interactions.length + 1 && (scope.currentLimit = scope.interactions.length + 1), 
                scope.interactions.push(interactionObj)) : scope.interactions.splice(0, 0, interactionObj) : "remove" === change && (scope.interactions = scope.interactions.filter(function(d) {
                    return d.id.toString() !== interactionObj.id.toString();
                }));
            };
            interactionService.registerInteractionListener(interactionListener, scope.targetType, scope.targetId), 
            element.on("$destroy", function() {
                interactionService.removeInteractionListener(interactionListener);
            });
        },
        templateUrl: "common/directives/interactionList.tmpl.html"
    };
} ]).directive("subscriptionEye", [ "subscriptionService", function(subscriptionService) {
    return {
        restrict: "E",
        scope: {
            type: "=",
            target: "=",
            targetDescription: "=",
            actionType: "=?"
        },
        link: function(scope) {
            var subscriptionObj;
            scope.isUpdating = !1;
            var loadSubscriptionStatus = function() {
                var targetString = subscriptionService.targetObjToString(scope.type, scope.target), actionType = void 0 === scope.actionType || null === scope.actionType ? "*" : scope.actionType;
                return console.log("loadSubscriptionStatus called for type = " + scope.type + ", target = " + targetString + ", actionType = " + actionType + "..."), 
                scope.isActive = !1, scope.isLoading = !0, subscriptionService.getSubscriptionsByUser(void 0, scope.type).then(function(subscriptionObjs) {
                    (subscriptionObj = subscriptionObjs.find(function(subscriptionObj) {
                        var thisActionType = void 0 === subscriptionObj.actionType || null === subscriptionObj.actionType ? "*" : subscriptionObj.actionType;
                        return subscriptionObj.target === targetString && thisActionType === actionType;
                    })) && (scope.isActive = !0), scope.isLoading = !1;
                });
            };
            loadSubscriptionStatus(), scope.$watch("type", loadSubscriptionStatus), scope.$watch("target", loadSubscriptionStatus, !0), 
            scope.$watch("actionType", loadSubscriptionStatus), scope.triggerSubscription = function() {
                scope.isUpdating = !0, scope.isActive && subscriptionObj ? subscriptionService.removeSubscription(subscriptionObj).then(function() {
                    scope.isActive = !1, scope.isUpdating = !1, subscriptionObj = void 0;
                }) : subscriptionService.addSubscription(void 0, scope.type, scope.target, scope.targetDescription instanceof Function ? scope.targetDescription() : scope.targetDescription, scope.actionType).then(function(_subscriptionObj) {
                    scope.isActive = !0, scope.isUpdating = !1, subscriptionObj = _subscriptionObj;
                });
            };
        },
        templateUrl: "common/directives/subscriptionEye.tmpl.html"
    };
} ]), angular.module("tasksDirectives", [ "gettext", "tasksServices", "miscServices" ]).directive("taskOverview", [ "$q", "$window", "gettext", "tasksService", "miscServices", function($q, $window, gettext, tasksService, miscServices) {
    return {
        restrict: "E",
        replace: "true",
        scope: {
            task: "=",
            fromArchive: "=?"
        },
        link: function(scope) {
            scope.errMessage = void 0, scope.isLoading = !0, scope.isSaving = !1, scope.workflowRule = "off", 
            tasksService.getWorkflowRule(scope.task.id).then(function(workflowRule) {
                scope.workflowRule = workflowRule;
            }, function(err) {
                console.log("ERROR: An error occured while trying to retrieve the workflowRule for task " + scope.task.id + ":"), 
                console.log([ err, scope.task, scope.fromArchive ]);
            }), scope.hasArchivePermissions = !1, tasksService.hasArchivePermissions().then(function(_hasPermissions) {
                scope.hasArchivePermissions = _hasPermissions;
            }), scope.changeStatus = function(newStatus) {
                miscServices.translatedConfirm(gettext("Do you really want to update the status of this task?")) && (scope.isSaving = !0, 
                tasksService.updateTaskStatus(scope.task, newStatus).then(function() {
                    scope.isSaving = !1;
                }, function(err) {
                    miscServices.translatedAlert(err), scope.isSaving = !1;
                }));
            }, scope.archiveTask = function() {
                scope.hasArchivePermissions ? miscServices.translatedConfirm(gettext("Are you sure you want to archive this task? This cannot be undone.")) && (scope.isSaving = !0, 
                tasksService.archiveTask(scope.task).then(function() {
                    miscServices.translatedAlert(gettext("The task has been archived.")), scope.isSaving = !1, 
                    $window.location.assign("#/tasks"), $window.location.reload();
                }, function(err) {
                    "string" == typeof err ? miscServices.translatedAlert(err) : (console.log("ERROR: An error occured while trying to archive the task:"), 
                    console.log(err), miscServices.translatedAlert(gettext("An error occured while trying to archive the task.")), 
                    scope.isSaving = !1);
                })) : miscServices.translatedAlert(gettext("You do not have the necessary permissions to archive tasks. Please contact your administrator."));
            };
        },
        templateUrl: "common/directives/taskOverview.tmpl.html"
    };
} ]), angular.module("zoomDirectives", []).directive("zoomKey", [ "$location", "$timeout", "$anchorScroll", "$q", function($location, $timeout, $anchorScroll, $q) {
    return {
        scope: {
            zoomKey: "@"
        },
        controller: [ "$scope", function($scope) {
            $scope.callbacks = [], $scope.loadingCount = 0;
            var processCallbacks = function(onlyCallback) {
                $timeout(function() {
                    if (0 === $scope.loadingCount && $location.hash().substr(0, $scope.zoomKey.length + 1) === $scope.zoomKey + "/") {
                        var callbackPart = $location.hash().substr($scope.zoomKey.length + 1);
                        ("function" == typeof onlyCallback ? [ onlyCallback ] : $scope.callbacks).forEach(function(callback) {
                            var doJump = callback(callbackPart);
                            void 0 !== doJump && $q.resolve(doJump).then(function(jumpTarget) {
                                $anchorScroll($scope.zoomKey + ("" !== jumpTarget ? "/" + jumpTarget : ""));
                            });
                        });
                    }
                }, 0);
            };
            this.startedLoading = function() {
                $scope.loadingCount++;
            }, this.stoppedLoading = function() {
                $scope.loadingCount--, 0 === $scope.loadingCount && processCallbacks();
            }, this.onZoom = function(callback) {
                -1 === $scope.callbacks.indexOf(callback) && (console.log("Registering onZoom callback."), 
                processCallbacks(callback), $scope.callbacks.push(callback));
            }, this.removeOnZoom = function(callback) {
                console.log("Removing onSave callback.");
                var removeIndex = $scope.callbacks.indexOf(callback);
                0 <= removeIndex && $scope.callbacks.splice(removeIndex, 1);
            }, this.getZoomKey = function() {
                return $scope.zoomKey;
            }, this.getZoomLink = function(suffix) {
                return $location.path() + "#" + encodeURIComponent($scope.zoomKey + (suffix ? "/" + suffix : ""));
            }, $scope.$on("$locationChangeSuccess", processCallbacks);
        } ]
    };
} ]), angular.module("dashboardAdmin", [ "ui.router", "ui.tree", "ui.bootstrap.datetimepicker", "dashboardApp", "dashboardTree", "usersServices", "adminServices", "miscServices", "fileServices", "helperDirectives", "ngDialog", "gettext" ]).config([ "$stateProvider", function($stateProvider) {
    $stateProvider.state("admin", {
        url: "/admin",
        views: {
            "main@": {
                templateUrl: "app/admin/index.tmpl.html",
                controller: "adminIndexController"
            }
        }
    }).state("admin.loadLoadfile", {
        url: "/load-loadfile",
        views: {
            "main@": {
                templateUrl: "app/admin/loadLoadfile.tmpl.html",
                controller: "loadLoadfileController"
            }
        }
    }).state("admin.exportLoadfile", {
        url: "/export-loadfile",
        views: {
            "main@": {
                templateUrl: "app/admin/exportLoadfile.tmpl.html",
                controller: "exportLoadfileController"
            }
        }
    }).state("admin.tree", {
        url: "/tree",
        views: {
            "main@": {
                templateUrl: "app/admin/tree.tmpl.html",
                controller: "adminTreeController"
            }
        }
    }).state("admin.dashboardViews", {
        url: "/dashboard-views",
        views: {
            "main@": {
                templateUrl: "app/admin/dashboardViews.tmpl.html",
                controller: "treeIndexController"
            }
        }
    }).state("admin.dashboardViews.details", {
        url: "/:id",
        views: {
            "main@": {
                templateUrl: "app/admin/dashboardViewsDetails.tmpl.html",
                controller: "adminDashboardViewsDetailsController"
            }
        }
    }).state("admin.datafiles", {
        url: "/datafiles",
        views: {
            "main@": {
                templateUrl: "app/admin/datafiles.tmpl.html",
                controller: "adminDatafilesController"
            }
        }
    }).state("admin.datafiles.details", {
        url: "/:id",
        views: {
            "main@": {
                templateUrl: "app/admin/datafilesDetails.tmpl.html",
                controller: "adminDatafilesDetailsController"
            }
        }
    });
} ]).controller("loadLoadfileController", [ "$scope", "$q", "$http", "gettext", "usersService", "miscServices", "restListService", "restDocumentService", function($scope, $q, $http, gettext, usersService, miscServices, restListService, restDocumentService) {
    $scope.errMessage = "", $scope.hasAccess = !1, $scope.isLoading = !1, $scope.isProcessing = !1, 
    $scope.warningAccepted = !1, $scope.loadfiles = [], $scope.loadLog = [], usersService.isSiteAdmin().then(function(res) {
        res ? ($scope.hasAccess = !0, $scope.errMessage = "") : ($scope.hasAccess = !1, 
        $scope.errMessage = gettext("You need site admin rights on SharePoint to be able to initialize the lists required by Dashboard."));
    }, function(err) {
        $scope.hasAccess = !1, $scope.errMessage = gettext("An error occurred checking access rights: ") + err;
    }), $scope.filesChanged = function(elm) {
        var i;
        for (i = 0; i < elm.files.length; i++) $scope.loadfiles.push({
            name: elm.files[i].name,
            url: void 0,
            uploadedFile: elm.files[i]
        });
        $scope.$apply();
    }, $scope.removeLoadfile = function(loadfile) {
        var idxToRemove = $scope.loadfiles.indexOf(loadfile);
        -1 < idxToRemove && $scope.loadfiles.splice(idxToRemove, 1);
    }, $scope.moveLoadfile = function(loadfile, moveBy) {
        if (-1 < $scope.loadfiles.indexOf(loadfile)) {
            var newIndex = Math.max(0, Math.min($scope.loadfiles.indexOf(loadfile) + moveBy, $scope.loadfiles.length));
            $scope.loadfiles.splice($scope.loadfiles.indexOf(loadfile), 1), $scope.loadfiles.splice(newIndex, 0, loadfile);
        }
    }, $scope.addLoadfileURL = function(loadfileURL) {
        "" === loadfileURL ? miscServices.translatedAlert(gettext("Please specify a valid URL for the loadfile to be used.")) : $scope.loadfiles.push({
            name: loadfileURL,
            url: loadfileURL,
            uploadedFile: void 0
        });
    }, $scope.processLoadfiles = function() {
        if ($scope.loadfiles && $scope.loadfiles.length) if ($scope.warningAccepted) {
            $scope.isLoading = !0, $scope.errMessage = "", $scope.loadLog = [];
            var loadfilePromise = $q.resolve(), loadfileOperations = [], idStorage = {};
            $scope.loadfiles.forEach(function(loadfile) {
                loadfile.uploadedFile ? ($scope.loadLog.push({
                    type: "info",
                    entry: loadfile.name + ": " + gettext("Getting loadfile from uploaded file.")
                }), loadfilePromise = loadfilePromise.then(function() {
                    var deferred = $q.defer(), reader = new FileReader();
                    return reader.addEventListener("loadend", function() {
                        var loadfileData;
                        try {
                            loadfileData = JSON.parse(reader.result);
                        } catch (e) {}
                        loadfileData && Array.isArray(loadfileData) ? (loadfileOperations = loadfileOperations.concat(loadfileData), 
                        deferred.resolve(loadfileData)) : deferred.reject(gettext("The file") + " " + loadfile.name + " is not a valid JSON loadfile.");
                    }), reader.readAsText(loadfile.uploadedFile), deferred.promise;
                })) : ($scope.loadLog.push({
                    type: "info",
                    entry: gettext("Getting loadfile from URL") + ": " + loadfile.url
                }), loadfilePromise = loadfilePromise.then(function() {
                    return $http.get(loadfile.url).then(function(res) {
                        return res.data && Array.isArray(res.data) ? (loadfileOperations = loadfileOperations.concat(res.data), 
                        res.data) : $q.reject(gettext("The file") + " " + loadfile.name + " " + gettext("is not a valid JSON loadfile."));
                    }, function(err) {
                        return console.log("Could not retrieve loadfile:"), console.log(err), $q.reject(gettext("Could not retrieve loadfile") + " " + loadfile.name + ": " + gettext("Error") + " " + err.status + ": " + err.statusText);
                    });
                }));
            }), loadfilePromise.then(function() {
                $scope.isLoading = !1, $scope.isProcessing = !0, $scope.currOperation = 0, $scope.totalOperations = loadfileOperations.length;
                var catchError = function(err) {
                    if ($scope.loadLog.push({
                        type: "error",
                        entry: err
                    }), !miscServices.translatedConfirm(gettext("An error occured while trying to process a loadfile operation. Do you want to continue?"))) return $q.reject(err);
                }, processingPromise = $q.resolve();
                return loadfileOperations.forEach(function(op) {
                    switch (op._action) {
                      case "createList":
                      case "createLibrary":
                        processingPromise = processingPromise.then(function() {
                            return $scope.loadLog.push({
                                type: "info",
                                entry: gettext("Creating") + " " + ("createLibrary" === op._action ? gettext("library") : gettext("list")) + ' "' + op.Title + '"'
                            }), "createLibrary" === op._action ? restDocumentService.createLibrary(op).catch(catchError) : restListService.createList(op).catch(catchError);
                        }), op.fields.forEach(function(f) {
                            processingPromise = processingPromise.then(function() {
                                return $scope.loadLog.push({
                                    type: "info",
                                    entry: gettext("Adding field") + ' "' + f.Title + '"'
                                }), "createLibrary" === op._action ? restDocumentService.createLibraryField(op.Title, f).catch(catchError) : restListService.createListField(op.Title, f).catch(catchError);
                            });
                        });
                        break;

                      case "deleteList":
                      case "deleteLibrary":
                        processingPromise = processingPromise.then(function() {
                            return $scope.loadLog.push({
                                type: "info",
                                entry: gettext("Deleting") + " " + ("deleteLibrary" === op._action ? gettext("library") : gettext("list")) + ' "' + op.Title + '"'
                            }), $scope.loadLog.push({
                                type: "info",
                                entry: gettext("Searching lookup fields on ") + " " + ("deleteLibrary" === op._action ? gettext("library") : gettext("list")) + ' "' + op.Title + '"'
                            }), restListService.getListFields(void 0, op.Title).then(function(res) {
                                var myPromise, primaryLookupFieldIds = [], secondaryLookupFieldIds = [];
                                res.data && res.data.d && res.data.d.results && Array.isArray(res.data.d.results) ? (myPromise = $q.resolve(), 
                                res.data.d.results.forEach(function(f) {
                                    7 === f.FieldTypeKind && f.CanBeDeleted && (f.PrimaryFieldId ? secondaryLookupFieldIds.push(f.Id) : primaryLookupFieldIds.push(f.Id));
                                }), $scope.loadLog.push({
                                    type: "info",
                                    entry: gettext("Deleting lookup fields on ") + " " + ("deleteLibrary" === op._action ? gettext("library") : gettext("list")) + ' "' + op.Title + '"'
                                }), secondaryLookupFieldIds.concat(primaryLookupFieldIds).forEach(function(fieldId) {
                                    myPromise = myPromise.then(function() {
                                        return restListService.deleteListField(op.Title, fieldId);
                                    });
                                })) : (console.log(res), myPromise = $q.reject(gettext("List field list is not in expected format.")));
                                return myPromise;
                            }).catch(catchError);
                        }).then(function() {
                            return $scope.loadLog.push({
                                type: "info",
                                entry: gettext("Now we can delete the ") + " " + ("deleteLibrary" === op._action ? gettext("library") : gettext("list")) + ' "' + op.Title + '"'
                            }), restListService.deleteList(op.Title).catch(catchError);
                        });
                        break;

                      case "addLibraryField":
                        $scope.loadLog.push({
                            type: "info",
                            entry: gettext("Adding field") + ' "' + op.field.Title + '" ' + gettext("to library") + ' "' + op.Title + '"'
                        }), processingPromise = processingPromise.then(function() {
                            return restDocumentService.createLibraryField(op.Title, op.field).catch(catchError);
                        });
                        break;

                      case "addListField":
                        $scope.loadLog.push({
                            type: "info",
                            entry: gettext("Adding field") + ' "' + op.field.Title + '" ' + gettext("to list") + ' "' + op.Title + '"'
                        }), processingPromise = processingPromise.then(function() {
                            return restListService.createListField(op.Title, op.field).catch(catchError);
                        });
                        break;

                      case "removeField":
                        $scope.loadLog.push({
                            type: "info",
                            entry: gettext("Removing field") + ' "' + op.fieldTitle + '" ' + gettext("from") + ' "' + op.Title + '"'
                        }), processingPromise = processingPromise.then(function() {
                            return restListService.deleteListFieldByTitle(op.Title, op.fieldTitle).catch(catchError);
                        });
                        break;

                      case "changeField":
                        if (void 0 === op.Title || void 0 === op.fieldTitle || !op.field) {
                            $scope.loadLog.push({
                                type: "warning",
                                entry: gettext("Skipping changeField because not all required values (Title, FieldTitle, field) have been specified. See console for details.")
                            }), console.log("WARNING: Skipping changeField because not all required values (Title, FieldTitle, field) have been specified:"), 
                            console.log(op);
                            break;
                        }
                        processingPromise = processingPromise.then(function() {
                            return restListService.updateListField(op.Title, op.field, op.fieldTitle).catch(catchError);
                        });
                        break;

                      case "addEntry":
                        if (void 0 === op._endpoint && void 0 === op._listTitle) {
                            $scope.loadLog.push({
                                type: "warning",
                                entry: gettext("Skipping addEntry because neither endpoint nor listTitle has been specified. See console for details.")
                            }), console.log("WARNING: Skipping addEntry because neither endpoint nor listTitle has been specified:"), 
                            console.log(op);
                            break;
                        }
                        processingPromise = processingPromise.then(function() {
                            var newItem = {}, requiresRemapping = [];
                            return Object.keys(op).forEach(function(k) {
                                "_" !== k.substring(0, 1) && ("string" == typeof op[k] ? (newItem[k] = op[k].replace(/{{(.+?)}}/g, function(match, p1) {
                                    return void 0 !== idStorage[p1] ? idStorage[p1] : match;
                                }), op._storeID && -1 !== newItem[k].indexOf("{{" + op._storeID + "}}") && (requiresRemapping.push({
                                    key: k,
                                    value: newItem[k]
                                }), newItem[k] = null)) : newItem[k] = op[k]);
                            }), restListService.addItem(op._endpoint, newItem, op._listTitle).then(function(addResult) {
                                if (op._storeID && (idStorage[op._storeID] = addResult.data.d.Id, 1 <= requiresRemapping.length)) {
                                    newItem.Id = addResult.data.d.Id;
                                    var re = new RegExp("{{" + op._storeID + "}}", "g");
                                    return requiresRemapping.forEach(function(el) {
                                        newItem[el.key] = el.value.replace(re, newItem.Id);
                                    }), restListService.updateItem(op._endpoint, newItem.Id, newItem, op._listTitle);
                                }
                            }).catch(catchError);
                        });
                        break;

                      case "addFile":
                        if (void 0 === op._endpoint) {
                            $scope.loadLog.push({
                                type: "warning",
                                entry: gettext("Skipping addFile because no endpoint has been specified. See console for details.")
                            }), console.log("WARNING: Skipping addFile because no endpoint has been specified:"), 
                            console.log(op);
                            break;
                        }
                        processingPromise = processingPromise.then(function() {
                            return $http.get(op._sourceUrl, {
                                responseType: "arraybuffer"
                            }).catch(catchError);
                        }).then(function(res) {
                            if (!res.data) return $q.reject(gettext("The file") + " " + op._sourceUrl + " " + gettext("could not be retrieved."));
                            var newItem = {}, requiresRemapping = [];
                            return Object.keys(op).forEach(function(k) {
                                "_" !== k.substring(0, 1) && ("string" == typeof op[k] ? (newItem[k] = op[k].replace(/{{(.+?)}}/g, function(match, p1) {
                                    return void 0 !== idStorage[p1] ? idStorage[p1] : match;
                                }), op._storeID && -1 !== newItem[k].indexOf("{{" + op._storeID + "}}") && (requiresRemapping.push({
                                    key: k,
                                    value: newItem[k]
                                }), newItem[k] = null)) : newItem[k] = op[k]);
                            }), restDocumentService.addArrayBufferAsFile(op._endpoint, op._filename, newItem, res.data, !!op._overwrite).then(function(addResult) {
                                if (op._storeID && (idStorage[op._storeID] = addResult.data.d.Id, 1 <= requiresRemapping.length)) {
                                    newItem.Id = addResult.data.d.Id;
                                    var re = new RegExp("{{" + op._storeID + "}}", "g");
                                    return requiresRemapping.forEach(function(el) {
                                        newItem[el.key] = el.value.replace(re, newItem.Id);
                                    }), restListService.updateItem(op._endpoint, newItem.Id, newItem);
                                }
                            }).catch(catchError);
                        });
                        break;

                      case "removeEntry":
                        if (void 0 === op._endpoint && void 0 === op._listTitle) {
                            $scope.loadLog.push({
                                type: "warning",
                                entry: gettext("Skipping removeEntry because neither endpoint nor listTitle has been specified. See console for details.")
                            }), console.log("WARNING: Skipping removeEntry because neither endpoint nor listTitle has been specified:"), 
                            console.log(op);
                            break;
                        }
                        if (!op.searchQuery) {
                            $scope.loadLog.push({
                                type: "warning",
                                entry: gettext("Skipping removeEntry because no searchQuery has been specified. See console for details.")
                            }), console.log("WARNING: Skipping removeEntry because neither endpoint nor listTitle has been specified:"), 
                            console.log(op);
                            break;
                        }
                        processingPromise = processingPromise.then(function() {
                            return restListService.deleteFilteredItems(op._endpoint, op.searchQuery, op._listTitle).catch(catchError);
                        });
                        break;

                      case "changeEntry":
                        if (void 0 === op._endpoint && void 0 === op._listTitle) {
                            $scope.loadLog.push({
                                type: "warning",
                                entry: gettext("Skipping changeEntry because neither endpoint nor listTitle has been specified. See console for details.")
                            }), console.log("WARNING: Skipping changeEntry because neither endpoint nor listTitle has been specified:"), 
                            console.log(op);
                            break;
                        }
                        if (!op.searchQuery) {
                            $scope.loadLog.push({
                                type: "warning",
                                entry: gettext("Skipping changeEntry because no searchQuery has been specified. See console for details.")
                            }), console.log("WARNING: Skipping changeEntry because neither endpoint nor listTitle has been specified:"), 
                            console.log(op);
                            break;
                        }
                        processingPromise = processingPromise.then(function() {
                            return restListService.updateFilteredItems(op._endpoint, op.searchQuery, op.entry, op._listTitle).catch(catchError);
                        });
                        break;

                      default:
                        $scope.loadLog.push({
                            type: "warning",
                            entry: gettext("Found operation without valid _action. See console for details.")
                        }), console.log("WARNING: Found operation without valid _action:"), console.log(op);
                    }
                    processingPromise = processingPromise.then(function() {
                        $scope.currOperation++;
                    });
                }), processingPromise;
            }).then(function() {
                $scope.isProcessing = !1, $scope.loadLog.push({
                    type: "success",
                    entry: gettext("All Loadfiles have been successfully loaded into the system.")
                }), miscServices.translatedAlert(gettext("All Loadfiles have been successfully loaded into the system."));
            }, function(err) {
                $scope.isProcessing = !1, $scope.isLoading = !1, $scope.errMessage = err;
            });
        } else miscServices.translatedAlert(gettext("You need to accept the warning before proceeding.")); else miscServices.translatedAlert(gettext("You need to provide at least one loadfile to be processed."));
    };
} ]).controller("exportLoadfileController", [ "$scope", "$q", "$http", "gettext", "usersService", "restListService", "FileSaver", function($scope, $q, $http, gettext, usersService, restListService, FileSaver) {
    $scope.errMessage = "", $scope.hasAccess = !1, $scope.isProcessing = !1, $scope.exportLog = [], 
    $scope.dashboardLists = [], $scope.otherLists = [], $scope.currList = 0, $scope.totalLists = 0, 
    usersService.isSiteAdmin().then(function(res) {
        res ? ($scope.hasAccess = !0, $scope.errMessage = "") : ($scope.hasAccess = !1, 
        $scope.errMessage = gettext("You need site admin rights on SharePoint to be able to initialize the lists required by Dashboard."));
    }, function(err) {
        $scope.hasAccess = !1, $scope.errMessage = gettext("An error occurred checking access rights: ") + err;
    });
    var listEndpoints = restListService.getListEndpoints();
    $scope.dashboardLists = Object.keys(listEndpoints).map(function(endpoint) {
        return {
            endpoint: endpoint,
            listURL: listEndpoints[endpoint],
            isSelected: !1,
            status: ""
        };
    }), $scope.toggleAll = function() {
        var newVal = $scope.toggleAllValue;
        $scope.dashboardLists.forEach(function(d) {
            d.isSelected = newVal;
        });
    }, $scope.removeList = function(l) {
        var myIdx = $scope.otherLists.indexOf(l);
        -1 < myIdx && $scope.otherLists.splice(myIdx, 1);
    }, $scope.addList = function(newlistTitle) {
        $scope.otherLists.push({
            endpoint: void 0,
            listTitle: newlistTitle,
            isSelected: !0,
            status: ""
        });
    }, $scope.createLoadfile = function() {
        var selectedLists = $scope.dashboardLists.concat($scope.otherLists).filter(function(l) {
            return l.isSelected;
        });
        if ($scope.errMessage = "", $scope.isProcessing = !0, $scope.currList = 0, $scope.totalLists = selectedLists.length, 
        selectedLists.length < 1) return $scope.errMessage = gettext("You need to select at least one SharePoint list that should be used to create the loadfile."), 
        void ($scope.isProcessing = !1);
        var processPromise = $q.resolve(), loadfileTasks = [ "[" ], tempListData = {}, listNameCache = {};
        selectedLists.forEach(function(l) {
            processPromise = processPromise.then(function() {
                return $scope.currList++, l.status = gettext("Loading metadata..."), restListService.getListInfo(l.endpoint, l.listTitle);
            }).then(function(res) {
                return tempListData = 101 === res.data.d.BaseTemplate ? {
                    _action: "createLibrary",
                    Title: res.data.d.Title,
                    Description: res.data.d.Description,
                    fields: [],
                    EnableVersioning: !!res.data.d.EnableVersioning
                } : {
                    _action: "createList",
                    Title: res.data.d.Title,
                    Description: res.data.d.Description,
                    fields: [],
                    EnableVersioning: !!res.data.d.EnableVersioning
                }, restListService.getListFields(l.endpoint, l.listTitle);
            }).then(function(res) {
                var lookupFields = {}, lookupFieldPromise = $q.resolve();
                return res.data.d.results.filter(function(field) {
                    return !field.FromBaseType && !field.Hidden;
                }).forEach(function(field) {
                    var fieldDef = {};
                    if ([ "Title", "FieldTypeKind", "Required", "Indexed", "EnforceUniqueValues", "StaticName", "DefaultValue", "LookupFieldName", "RichText", "NumberOfLines", "DisplayFormat", "FillInChoice", "SelectionMode" ].forEach(function(k) {
                        fieldDef[k] = field[k];
                    }), 6 === field.FieldTypeKind) fieldDef.Choices = field.Choices.results; else if (7 === field.FieldTypeKind && void 0 !== field.LookupList) {
                        if (field.PrimaryFieldId) return void (lookupFields[field.PrimaryFieldId] && lookupFields[field.PrimaryFieldId].LookupOtherColumns.push(field.LookupField));
                        fieldDef.LookupOtherColumns = [], lookupFields[field.Id] = fieldDef;
                        var lookupListGUID = field.LookupList.slice(1, -1);
                        lookupFieldPromise = lookupFieldPromise.then(function() {
                            if (void 0 === listNameCache[lookupListGUID]) return console.log("Getting list name for GUID " + lookupListGUID + "..."), 
                            restListService.getListInfo(void 0, void 0, lookupListGUID).then(function(res) {
                                listNameCache[lookupListGUID] = res.data.d.Title, fieldDef.LookupListName = res.data.d.Title;
                            });
                            fieldDef.LookupListName = listNameCache[lookupListGUID];
                        });
                    }
                    tempListData.fields.push(fieldDef);
                }), lookupFieldPromise.then(function() {
                    return loadfileTasks.push(JSON.stringify(tempListData) + ",\n"), l.status = gettext("Loading elements..."), 
                    restListService.getMergedAllItems(l.endpoint, void 0, l.listTitle);
                });
            }).then(function(res) {
                res.data.d.results.forEach(function(item) {
                    var loadfileItem = {
                        _action: "addEntry",
                        Title: item.Title,
                        _storeID: tempListData.Title + ":" + item.Id
                    };
                    l.endpoint ? loadfileItem._endpoint = l.endpoint : loadfileItem._listTitle = l.listTitle, 
                    tempListData.fields.forEach(function(field) {
                        7 === field.FieldTypeKind ? item[field.Title + "Id"] && (loadfileItem[field.Title + "Id"] = "{{" + field.LookupListName + ":" + item[field.Title + "Id"] + "}}") : loadfileItem[field.Title] = item[field.Title];
                    }), loadfileTasks.push(JSON.stringify(loadfileItem) + ",\n");
                }), l.status = gettext("Done.");
            });
        }), processPromise.then(function() {
            loadfileTasks[loadfileTasks.length - 1] = loadfileTasks[loadfileTasks.length - 1].slice(0, -2), 
            loadfileTasks.push("]");
            var blob = new Blob(loadfileTasks, {
                type: "text/plain;charset=utf-8"
            });
            FileSaver.saveAs(blob, "loadfileExport.js"), $scope.errMessage = "", $scope.isProcessing = !1;
        }, function(err) {
            $scope.errMessage = err, $scope.isProcessing = !1;
        });
    };
} ]).controller("adminTreeController", [ "$scope", "$q", "gettext", "gettextCatalog", "adminService", "usersService", "treeService", "miscServices", function($scope, $q, gettext, gettextCatalog, adminService, usersService, treeService, miscServices) {
    $scope.errMessage = "", $scope.hasAccess = !1, $scope.isLoading = !0, $scope.isProcessing = !1, 
    $scope.tree = [];
    var loadingPromises = [];
    loadingPromises.push(usersService.isSiteAdmin().then(function(res) {
        res ? ($scope.hasAccess = !0, $scope.errMessage = "") : ($scope.hasAccess = !1, 
        $scope.errMessage = gettext("You need edit rights to The Dashboard's configuration to be able to modify the Audit Universe."));
    }, function(err) {
        return $scope.hasAccess = !1, gettext("An error occurred checking access rights: ") + err;
    }));
    var dataKey = 1, infiniteDateApprox = new Date("2999-01-01T01:00:00Z").getTime(), addHelperElements = function(node) {
        node.original = {
            title: node.title,
            valid_from: node.valid_from,
            valid_to: node.valid_to,
            parent: node.parent,
            orderAsc: node.orderAsc,
            hasDashboard: node.hasDashboard
        }, node.isNew = !1, node.valid_to_editor = node.valid_to > infiniteDateApprox ? void 0 : node.valid_to, 
        node.dataKey = dataKey, dataKey += 1, node.nodes && Array.isArray(node.nodes) && node.nodes.forEach(addHelperElements);
    };
    loadingPromises.push(treeService.getFullHierarchy().then(function(treeStart) {
        addHelperElements(treeStart), treeStart.showDetails = !0, $scope.tree = [ treeStart ], 
        $scope.isLoading = !1, console.log("Tree has been loaded:"), console.log($scope.tree);
    })), $q.all(loadingPromises).then(function() {
        $scope.isLoading = !1;
    }, function(err) {
        $scope.isLoading = !1, $scope.errMessage = err || gettext("An unknown error occured.");
    }), $scope.updateValidTo = function(data) {
        data.valid_to = data.valid_to_editor ? data.valid_to_editor : new Date("2999-12-31T12:00:00.000Z");
    }, $scope.toggleDetails = function(data) {
        data.showDetails = !data.showDetails;
    }, $scope.filterActive = function(treeItem) {
        return !$scope.onlyActive || treeItem.active;
    }, $scope.isActive = function(data) {
        var currDatetime = new Date().getTime();
        return data.valid_from.getTime() <= currDatetime && data.valid_to.getTime() > currDatetime;
    }, $scope.newNode = function(data) {
        data.nodes && Array.isArray(data.nodes) || (data.nodes = []), data.nodes.push({
            title: gettextCatalog.getString("New node"),
            valid_from: new Date(),
            valid_to: new Date("2999-12-31T12:00:00.000Z"),
            valid_to_editor: void 0,
            original: {},
            active: !0,
            isNew: !0,
            showDetails: !1,
            dataKey: dataKey,
            hasDashboard: !0
        }), dataKey += 1;
    }, $scope.deleteNode = function(data) {
        if (!data.isNew) return miscServices.translatedAlert(gettext("You can only remove nodes that are not yet stored in the database.")), 
        !1;
        if (data.nodes && Array.isArray(data.nodes) && 1 <= data.nodes.length) return miscServices.translatedAlert(gettext("You cannot remove nodes that have active children. Remove or re-arrange the children first.")), 
        !1;
        var recursiveFindMe = function(start) {
            if (start.nodes && Array.isArray(start.nodes)) return start.nodes.some(function(n, idx) {
                return n === data ? (start.nodes.splice(idx, 1), !0) : recursiveFindMe(n);
            });
        };
        recursiveFindMe($scope.tree[0]) || console.log("Error: The given element was not found in the tree.");
    };
    var recalculateOrder = function(startAt, node, parentId) {
        var currOrderAsc = startAt;
        return node.orderAsc = currOrderAsc, node.parent = parentId, currOrderAsc += 1, 
        node.nodes && Array.isArray(node.nodes) && node.nodes.forEach(function(n) {
            currOrderAsc = recalculateOrder(currOrderAsc, n, node.id);
        }), currOrderAsc;
    }, findChanges = function(changes, newNodes, node) {
        console.log('findChanges running on "%s"...', node.title), node.isNew ? newNodes.push(node) : node.title === node.original.title && node.valid_from.getTime() === node.original.valid_from.getTime() && node.valid_to.getTime() === node.original.valid_to.getTime() && node.parent === node.original.parent && node.orderAsc === node.original.orderAsc && node.hasDashboard === node.original.hasDashboard || changes.push(node), 
        node.nodes && Array.isArray(node.nodes) && node.nodes.forEach(function(n) {
            findChanges(changes, newNodes, n);
        });
    };
    $scope.saveChanges = function() {
        if (miscServices.translatedConfirm(gettext("Are you sure you want to SAVE your changes? This action cannot be undone."))) {
            $scope.isProcessing = !0, recalculateOrder(1, $scope.tree[0], null), console.log("Saving changes for modified tree:"), 
            console.log($scope.tree);
            var changes = [], newNodes = [];
            findChanges(changes, newNodes, $scope.tree[0]);
            var changePromise = $q.resolve();
            newNodes.forEach(function(node) {
                changePromise = changePromise.then(function() {
                    return console.log('Adding new element "%s"...', node.title), treeService.addElement(node);
                }).then(function(newNode) {
                    console.log('New element "%s" added with ID "%s".', node.title, newNode.id), node.id = newNode.id, 
                    node.isNew = !1, node.active = $scope.isActive(node), node.original = {
                        title: node.title,
                        valid_from: node.valid_from,
                        valid_to: node.valid_to,
                        parent: node.parent,
                        orderAsc: node.orderAsc,
                        hasDashboard: node.hasDashboard
                    }, node.nodes && Array.isArray(node.nodes) && node.nodes.forEach(function(child) {
                        child.parent = newNode.id;
                    });
                });
            }), changes.forEach(function(node) {
                changePromise = changePromise.then(function() {
                    return console.log('Updating changed element "%s"...', node.title), treeService.changeElement(node);
                }).then(function() {
                    node.active = $scope.isActive(node), console.log('Updated changed element "%s".', node.title), 
                    node.original = {
                        title: node.title,
                        valid_from: node.valid_from,
                        valid_to: node.valid_to,
                        parent: node.parent,
                        orderAsc: node.orderAsc,
                        hasDashboard: node.hasDashboard
                    };
                });
            }), changePromise.then(function() {
                console.log("saveChanges completed successfully."), $scope.isProcessing = !1, $scope.treeForm.$setPristine(), 
                miscServices.translatedAlert(gettext("All changes to the Audit Universe have been saved."));
            }, function(err) {
                console.log("saveChanges reported an error."), $scope.isProcessing = !1, $scope.errMessage = gettext("An error occured saving your Audit Universe changes: ") + err;
            });
        }
    }, $scope.cancelChanges = function() {
        miscServices.translatedConfirm(gettext("Are you sure you want to CANCEL all your changes? All changes will be lost. This action cannot be undone.")) && ($scope.isLoading = !0, 
        treeService.getFullHierarchy().then(function(treeStart) {
            $scope.tree = [ treeStart ], $scope.isLoading = !1, $scope.treeForm.$setPristine();
        }));
    }, $scope.treeOptions = {
        dropped: function() {
            return !($scope.treeForm.$pristine = !1);
        }
    };
} ]).controller("adminDashboardViewsDetailsController", [ "$scope", "$transition$", "$q", "gettext", "ngDialog", "adminService", "usersService", "miscServices", "treeService", "dashboardViewService", "datafilesService", "typeToDescriptionFilter", function($scope, $transition$, $q, gettext, ngDialog, adminService, usersService, miscServices, treeService, dashboardViewService, datafilesService, typeToDescriptionFilter) {
    $scope.id = $transition$.params().id, $scope.errMessage = "", $scope.hasAccess = !1, 
    $scope.isLoading = !0, $scope.isProcessing = !1, $scope.dashboardName = "", $scope.dashboardElements = [], 
    $scope.availableDatafiles = {}, $scope.datafilesList = [], $scope.newItem = {
        type: ""
    };
    var loadingPromises = [];
    treeService.getElementTitle($scope.id).then(function(name) {
        $scope.dashboardName = name;
    }, function(err) {
        $scope.dashboardName = "(" + gettext("Error") + ")", console.log("Could not load dashboard name: " + err);
    }), loadingPromises.push(usersService.isAdmin().then(function(res) {
        res ? ($scope.hasAccess = !0, $scope.errMessage = "") : ($scope.hasAccess = !1, 
        $scope.errMessage = gettext("You need edit rights to The Dashboard's configuration to be able to modify the Dashboard Views."));
    }, function(err) {
        return $scope.hasAccess = !1, gettext("An error occurred checking access rights: ") + err;
    }));
    var processDashboardElements = function(view) {
        $scope.dashboardElements = view.map(function(el) {
            return {
                id: el.id,
                title: el.title,
                type: el.type,
                viewKey: el.viewKey,
                options: JSON.parse(JSON.stringify(el.options)),
                orderAsc: el.orderAsc,
                original: {
                    title: el.title,
                    type: el.type,
                    viewKey: el.viewKey,
                    options_string: JSON.stringify(el.options),
                    orderAsc: el.orderAsc
                },
                isNew: !1,
                showDetails: !1
            };
        });
    };
    loadingPromises.push(dashboardViewService.getDashboardElements($scope.id).then(processDashboardElements)), 
    loadingPromises.push(datafilesService.getAllDatafiles().then(function(datafilesMap) {
        $scope.availableDatafiles = datafilesMap, $scope.datafilesList = Object.keys(datafilesMap);
    })), $q.all(loadingPromises).then(function() {
        $scope.isLoading = !1;
    }, function(err) {
        $scope.isLoading = !1, $scope.errMessage = err || gettext("An unknown error occured.");
    }), $scope.toggleDetails = function(data) {
        data.showDetails = !data.showDetails;
    }, $scope.addNew = function() {
        if (!$scope.newItem || !$scope.newItem.type) return console.log($scope), void miscServices.translatedAlert(gettext("You need to select the view element type for the new element."));
        $scope.dashboardElements.push({
            title: "New " + typeToDescriptionFilter($scope.newItem.type),
            type: $scope.newItem.type,
            viewKey: "",
            options: {},
            original: {},
            isNew: !0,
            showDetails: !0
        });
    }, $scope.deleteElement = function(element) {
        $scope.elementsForm.$setDirty(), element.showDetails = !1, element.isDeleted = !0;
    }, $scope.restoreElement = function(element) {
        $scope.elementsForm.$setDirty(), element.isDeleted = !1;
    }, $scope.saveChanges = function() {
        if ($scope.elementsForm.$valid) {
            if (miscServices.translatedConfirm(gettext("Are you sure you want to SAVE your changes? This action cannot be undone."))) {
                $scope.isProcessing = !0, console.log("Saving changes for modified dashboard elements:"), 
                console.log($scope.dashboardElements);
                var changePromise = $q.resolve();
                $scope.dashboardElements.forEach(function(el, idx) {
                    el.orderAsc = idx + 1, el.isDeleted ? el.isNew || (console.log('Will delete element "%s"...', el.title), 
                    changePromise = changePromise.then(function() {
                        return dashboardViewService.deleteDashboardElement(el);
                    })) : el.isNew ? (console.log('Will add new element "%s"...', el.title), changePromise = changePromise.then(function() {
                        return dashboardViewService.addDashboardElement($scope.id, el);
                    }).then(function(newElement) {
                        el.id = newElement.id, el.isNew = !1, el.original = {
                            title: el.title,
                            type: el.type,
                            viewKey: el.viewKey,
                            options_string: JSON.stringify(el.options),
                            orderAsc: el.orderAsc
                        };
                    })) : el.title === el.original.title && el.viewKey === el.original.viewKey && el.original.options_string === JSON.stringify(el.options) && el.orderAsc === el.original.orderAsc || (console.log('Will modify existing element "%s"...', el.title), 
                    changePromise = changePromise.then(function() {
                        return dashboardViewService.changeDashboardElement($scope.id, el);
                    }).then(function() {
                        el.original = {
                            title: el.title,
                            type: el.type,
                            viewKey: el.viewKey,
                            options_string: JSON.stringify(el.options),
                            orderAsc: el.orderAsc
                        };
                    }));
                }), changePromise.then(function() {
                    return dashboardViewService.getDashboardElements($scope.id, !0).then(processDashboardElements);
                }).then(function() {
                    $scope.isProcessing = !1, $scope.elementsForm.$setPristine(), miscServices.translatedAlert(gettext("All changes to the dashboard view have been saved."));
                }, function(err) {
                    console.log("saveChanges reported an error."), $scope.isProcessing = !1, $scope.errMessage = gettext("An error occured saving your dashboard view changes: ") + err;
                });
            }
        } else miscServices.translatedAlert(gettext("Please complete all the required fields prior to saving."));
    }, $scope.cancelChanges = function() {
        miscServices.translatedConfirm(gettext("Are you sure you want to CANCEL all your changes? All changes will be lost. This action cannot be undone.")) && ($scope.isLoading = !0, 
        dashboardViewService.getDashboardElements($scope.id, !0).then(processDashboardElements).then(function() {
            $scope.isLoading = !1, $scope.elementsForm.$setPristine();
        }, function(err) {
            $scope.isLoading = !1, $scope.errMessage = gettext("An error occured reloading data from database: ") + err;
        }));
    }, $scope.treeOptions = {
        dropped: function() {
            return !($scope.elementsForm.$pristine = !1);
        }
    }, $scope.arrayNewElement = function(array, element) {
        Array.isArray(array) || (array = []);
        var targetIndex = (void 0 !== element ? array.indexOf(element) : -1) + 1;
        return array.splice(targetIndex, 0, {}), array;
    }, $scope.arrayRemoveElement = function(array, element) {
        -1 < array.indexOf(element) && array.splice(array.indexOf(element), 1);
    }, $scope.arrayMoveElement = function(array, element, moveBy) {
        if (-1 < array.indexOf(element)) {
            var newIndex = Math.max(0, Math.min(array.indexOf(element) + moveBy, array.length));
            array.splice(array.indexOf(element), 1), array.splice(newIndex, 0, element);
        }
    }, $scope.hasConditionalFormat = function(element) {
        return element.conditionalFormat && Array.isArray(element.conditionalFormat) && 0 < element.conditionalFormat.length;
    }, $scope.conditionalFormat = function(element) {
        console.log("conditionalFormat called on element:"), console.log(element), ngDialog.open({
            template: "app/admin/dashboardViewsDetails_condFormat.tmpl.html",
            className: "ngdialog-theme-default",
            closeByDocument: !1,
            scope: $scope,
            data: {
                conditionalFormat: JSON.parse(JSON.stringify(element.conditionalFormat ? element.conditionalFormat : {}))
            }
        }).closePromise.then(function(ret) {
            ret.value && ret.value.save && (element.conditionalFormat = ret.value.conditionalFormat, 
            $scope.elementsForm.$setDirty());
        });
    };
} ]).controller("adminDatafilesController", [ "$scope", "$q", "gettext", "usersService", "datafilesService", function($scope, $q, gettext, usersService, datafilesService) {
    $scope.errMessage = "", $scope.hasAccess = !1, $scope.isLoading = !0, $scope.datafilesList = [];
    var loadingPromises = [];
    loadingPromises.push(usersService.isAdmin().then(function(res) {
        res ? ($scope.hasAccess = !0, $scope.errMessage = "") : ($scope.hasAccess = !1, 
        $scope.errMessage = gettext("You need edit rights to The Dashboard's configuration to be able to modify the datafile definitions."));
    }, function(err) {
        return $scope.hasAccess = !1, gettext("An error occurred checking access rights: ") + err;
    })), loadingPromises.push(datafilesService.getAllDatafiles(!0).then(function(datafilesMap) {
        $scope.datafilesList = Object.keys(datafilesMap).map(function(key) {
            return datafilesMap[key];
        });
    })), $q.all(loadingPromises).then(function() {
        $scope.isLoading = !1;
    }, function(err) {
        $scope.isLoading = !1, $scope.errMessage = err || gettext("An unknown error occured.");
    });
} ]).controller("adminDatafilesDetailsController", [ "$scope", "$state", "$transition$", "$q", "gettext", "d3", "adminService", "usersService", "miscServices", "datafilesService", function($scope, $state, $transition$, $q, gettext, d3, adminService, usersService, miscServices, datafilesService) {
    $scope.id = Number($transition$.params().id), $scope.errMessage = "", $scope.hasAccess = !1, 
    $scope.isLoading = !0, $scope.columnFormats = Object.keys(d3.ourSettings.formats), 
    $scope.datafile = {
        dataFile: "",
        fileName: "",
        dataFileFormat: {
            separator: ",",
            columns: []
        }
    };
    var loadingPromises = [];
    loadingPromises.push(usersService.isAdmin().then(function(res) {
        res ? ($scope.hasAccess = !0, $scope.errMessage = "") : ($scope.hasAccess = !1, 
        $scope.errMessage = gettext("You need edit rights to The Dashboard's configuration to be able to modify the datafile definitions."));
    }, function(err) {
        return $scope.hasAccess = !1, gettext("An error occurred checking access rights: ") + err;
    })), console.log("Datafiles details loaded with ID:"), console.log($scope.id), isNaN($scope.id) || -1 === $scope.id || loadingPromises.push(datafilesService.getDatafileById($scope.id).then(function(datafile) {
        $scope.datafile = datafile;
    })), $q.all(loadingPromises).then(function() {
        $scope.isLoading = !1;
    }, function(err) {
        $scope.isLoading = !1, $scope.errMessage = err || gettext("An unknown error occured.");
    }), $scope.addColumn = function() {
        $scope.datafile.dataFileFormat.columns.push({
            source: "",
            display: "",
            keyword: "",
            format: "",
            isKey: !1
        }), $scope.datafileForm.$setDirty();
    }, $scope.removeColumn = function(col) {
        var removeIndex = $scope.datafile.dataFileFormat.columns.indexOf(col);
        0 <= removeIndex && ($scope.datafile.dataFileFormat.columns.splice(removeIndex, 1), 
        $scope.datafileForm.$setDirty());
    }, $scope.moveColumn = function(col, moveBy) {
        if (-1 < $scope.datafile.dataFileFormat.columns.indexOf(col)) {
            var newIndex = Math.max(0, Math.min($scope.datafile.dataFileFormat.columns.indexOf(col) + moveBy, $scope.datafile.dataFileFormat.columns.length));
            $scope.datafile.dataFileFormat.columns.splice($scope.datafile.dataFileFormat.columns.indexOf(col), 1), 
            $scope.datafile.dataFileFormat.columns.splice(newIndex, 0, col), $scope.datafileForm.$setDirty();
        }
    }, $scope.noKey = function() {
        return !Array.isArray($scope.datafile.dataFileFormat.columns) || -1 === $scope.datafile.dataFileFormat.columns.findIndex(function(col) {
            return col.isKey;
        });
    }, $scope.saveChanges = function() {
        $scope.datafileForm.$valid ? miscServices.translatedConfirm(gettext("Are you sure you want to SAVE your changes? This action cannot be undone.")) && ($scope.isProcessing = !0, 
        -1 === $scope.id ? datafilesService.addDatafile($scope.datafile).then(function(newDatafile) {
            $scope.id = newDatafile.id, $scope.datafile.id = newDatafile.id, $scope.datafileForm.$setPristine(), 
            miscServices.translatedAlert(gettext("The new datafile has successfully been stored in the database.")), 
            $scope.isProcessing = !1;
        }) : datafilesService.changeDatafile($scope.datafile).then(function() {
            $scope.datafileForm.$setPristine(), miscServices.translatedAlert(gettext("The datafile has successfully been updated in the database.")), 
            $scope.isProcessing = !1;
        })) : miscServices.translatedAlert(gettext("Please complete all the required fields prior to saving."));
    }, $scope.cancelChanges = function() {
        if (!isNaN($scope.id) && -1 !== $scope.id) {
            if (!miscServices.translatedConfirm(gettext("Are you sure you want to CANCEL all your changes? All changes will be lost. This action cannot be undone."))) return;
            $scope.isLoading = !0, datafilesService.getDatafileById($scope.id, !0).then(function(datafile) {
                $scope.datafile = datafile, $scope.isLoading = !1, $scope.datafileForm.$setPristine();
            });
        }
    }, $scope.deleteDatafile = function() {
        -1 !== $scope.id && miscServices.translatedConfirm(gettext("Are you sure you want to DELETE this datafile definition? This action cannot be undone.")) && ($scope.isProcessing = !0, 
        datafilesService.deleteDatafile($scope.datafile).then(function() {
            return miscServices.translatedAlert(gettext("The datafile definition has been removed.")), 
            $state.go("^");
        }));
    };
} ]).controller("adminIndexController", [ "$scope", "$q", "gettext", "usersService", function($scope, $q, gettext, usersService) {
    $scope.errMessage = "", $scope.userIsSiteAdmin = !1, usersService.isSiteAdmin().then(function(res) {
        $scope.userIsSiteAdmin = !!res;
    }, function(err) {
        console.log("ERROR: Could not retrieve site admin settings."), console.log(err);
    }), usersService.isAdmin().then(function(res) {
        $scope.errMessage = "", res || ($scope.errMessage = gettext('Note that you are not authorized to edit The Dashboard\'s configuration, which means that most functions below will not work for you. Please make sure that you have edit rights on the "The Dashboard - Configuration" list before you proceed.'));
    }, function() {
        $scope.errMessage = gettext('We could not retrieve your user status. Most likely this means that you have not yet initialized the base lists used by The Dashboard. If you have site admin rights on your SharePoint site, you can initialize them now by using the "Initialize SharePoint for use with Dashboard" function below.');
    });
} ]), angular.module("dashboardTasks", [ "ui.router", "ui.grid", "ui.grid.pinning", "ui.grid.resizeColumns", "ngDialog", "learningServices", "chartServices", "printServices", "tasksServices", "usersServices", "notesServices", "tasksDirectives", "auditFormsDirectives", "auditFormsServices", "excelServices", "miscServices" ]).config([ "$stateProvider", function($stateProvider) {
    $stateProvider.state("tasks", {
        url: "/tasks",
        views: {
            "main@": {
                templateUrl: "app/tasks/tasks.tmpl.html",
                controller: "tasksOverviewController"
            }
        }
    }).state("tasks.archive", {
        url: "/archive",
        views: {
            "main@": {
                templateUrl: "app/tasks/tasks.tmpl.html",
                controller: "tasksOverviewController"
            }
        },
        data: {
            archivedTasks: !0
        }
    }).state("tasks.table", {
        url: "/:id",
        views: {
            "main@": {
                templateUrl: "app/tasks/table.tmpl.html",
                controller: "tasksTableController"
            }
        }
    }).state("tasks.archive.table", {
        url: "/:id",
        views: {
            "main@": {
                templateUrl: "app/tasks/table.tmpl.html",
                controller: "tasksTableController"
            }
        },
        data: {
            archivedTasks: !0
        }
    });
} ]).controller("tasksOverviewController", [ "$scope", "$state", "gettext", "gettextCatalog", "ngDialog", "tasksService", function($scope, $state, gettext, gettextCatalog, ngDialog, tasksService) {
    $scope.loading = !0, $scope.errMessage = "", $scope.archivedTasks = !(!$state.current.data || !$state.current.data.archivedTasks), 
    $scope.taskListGridOptions = {
        enableSorting: !0,
        enableFiltering: !0,
        columnDefs: [ {
            name: gettext("Created"),
            field: "created_at",
            width: "10%",
            type: "date",
            headerCellFilter: "translate",
            cellFilter: "date:'dd.MM.yyyy'"
        }, {
            name: gettext("Title"),
            field: "title",
            headerCellFilter: "translate",
            cellTemplate: '<div class="ui-grid-cell-contents"><a ui-sref="tasks.' + ($scope.archivedTasks ? "archive." : "") + 'table({id: row.entity.id})">{{row.entity.title}}</a> <i class="fa fa-info-circle icon-as-button" aria-hidden="true" ng-click="grid.appScope.showTaskDetails(row.entity)"></i></div>',
            width: "36%"
        }, {
            name: gettext("Status"),
            field: "status",
            headerCellFilter: "translate",
            width: "12%",
            cellFilter: "taskStatus"
        }, {
            name: gettext("Modified"),
            field: "last_modified_at",
            headerCellFilter: "translate",
            width: "10%",
            type: "date",
            cellFilter: "date:'dd.MM.yyyy'"
        }, {
            name: gettext("Modified By"),
            displayName: gettext("By"),
            field: "last_modified_by",
            headerCellFilter: "translate",
            width: "4%",
            cellFilter: "userIdToInitials"
        }, {
            name: gettext("Done"),
            field: "done_at",
            headerCellFilter: "translate",
            width: "10%",
            type: "date",
            cellFilter: "date:'dd.MM.yyyy'"
        }, {
            name: gettext("Done By"),
            displayName: gettext("By"),
            field: "done_by",
            headerCellFilter: "translate",
            width: "4%",
            cellFilter: "userIdToInitials"
        }, {
            name: gettext("Reviewed"),
            field: "reviewed_at",
            headerCellFilter: "translate",
            width: "10%",
            type: "date",
            cellFilter: "date:'dd.MM.yyyy'"
        }, {
            name: gettext("Reviewed By"),
            displayName: gettext("By"),
            field: "reviewed_by",
            headerCellFilter: "translate",
            width: "4%",
            cellFilter: "userIdToInitials"
        } ],
        data: []
    }, $scope.showTaskDetails = function(task) {
        ngDialog.open({
            template: "app/tasks/taskDetailsDialog.tmpl.html",
            className: "ngdialog-theme-default",
            data: {
                task: task,
                fromArchive: $scope.archivedTasks
            }
        });
    }, tasksService.getTasks($scope.archivedTasks, !0).then(function(tasks) {
        tasks.sort(function(a, b) {
            return a.created_at > b.created_at ? -1 : a.created_at < b.created_at ? 1 : a.title < b.title ? -1 : 1;
        }), $scope.taskListGridOptions.data = tasks, $scope.errMessage = "", $scope.loading = !1;
    }, function(err) {
        $scope.errMessage = gettext("Could not load task list: ") + err, $scope.loading = !1;
    });
} ]).controller("tasksTableController", [ "$scope", "$timeout", "$transition$", "$q", "$state", "$location", "uiGridConstants", "ngDialog", "gettext", "d3", "tasksService", "keywordsService", "auditFormsService", "learningService", "excelService", "printService", "miscServices", function($scope, $timeout, $transition$, $q, $state, $location, uiGridConstants, ngDialog, gettext, d3, tasksService, keywordsService, auditFormsService, learningService, excelService, printService, miscServices) {
    $scope.id = $transition$.params().id, $scope.archivedTasks = !(!$state.current.data || !$state.current.data.archivedTasks), 
    $scope.loading = !0, $scope.errMessage = "", $scope.calcStatus = "", $scope.task = {}, 
    $scope.taskData = [], $scope.gridOptions = {}, $scope.showAuditForms = !1, $scope.newAuditForms = [], 
    $scope.machineEnabled = !1, $scope.machineEnabledResult = void 0, $scope.machineEnabledColumns = [], 
    $scope.resultsColumn = void 0, $scope.mapResults = [], $scope.resultsSelection = [], 
    $scope.resultsSelectionIterate = !1, $scope.keywords = [], $scope.thisClassifier = void 0, 
    $scope.auditFormsLoaded = !1, $scope.autoSaveEnabled = !0, $scope.readOnly = !0, 
    $scope.excelEnabled = !1;
    var autoSaveTimer, entityResultUpdated = function(entity) {
        $scope.gridApi && $scope.gridApi.core.queueRefresh(), $scope.machineEnabled && (entity._classifierUpdatePromise && $timeout.cancel(entity._classifierUpdatePromise), 
        entity._classifierUpdatePromise = $timeout(function() {
            !function(entity) {
                var resultClass, oldResultClass;
                console.log("Running classifierUpdate..."), void 0 !== entity.result && (resultClass = entity.result === $scope.machineEnabledResult ? "hit" : "noHit"), 
                void 0 !== entity._old_result && (oldResultClass = entity._old_result === $scope.machineEnabledResult ? "hit" : "noHit"), 
                resultClass !== oldResultClass && (void 0 !== oldResultClass && (console.log("Calling unlearn!"), 
                invalidateResults(), $scope.thisClassifier.unlearn([ entity._idx ]), $scope.requestUpdate(!1)), 
                void 0 !== resultClass && (console.log("Calling train!"), console.log(entity), invalidateResults(), 
                $scope.thisClassifier.train([ {
                    idx: entity._idx,
                    result: resultClass
                } ]), $scope.requestUpdate(!1)), entity._old_result = entity.result);
            }(entity);
        }, 1e3)), $scope.autoSaveEnabled && (autoSaveTimer && $timeout.cancel(autoSaveTimer), 
        autoSaveTimer = $timeout($scope.saveResults, 5e3));
    };
    $scope.updateResult = function(entity, $event) {
        if (console.log("updateResult called: "), console.log(entity), console.log([ $scope.resultsSelectionIterate, $scope.resultsSelection, $scope.resultsSelection.length ]), 
        $scope.resultsSelectionIterate && $scope.resultsSelection && !($scope.resultsSelection.length <= 1)) {
            $event.stopPropagation();
            var oldResultIdx = $scope.resultsSelection.indexOf(entity.result);
            -1 === oldResultIdx ? entity.result = $scope.resultsSelection[0] : oldResultIdx === $scope.resultsSelection.length - 1 ? entity.result = void 0 : entity.result = $scope.resultsSelection[oldResultIdx + 1], 
            entityResultUpdated(entity);
        }
    };
    var openedAuditForm, updateCallback = function(resultData, status) {
        console.log("Received data from worker: "), console.log([ resultData, status ]), 
        $scope.$apply(function() {
            $scope.calcStatus = status;
        }), resultData.forEach(function(d) {
            $scope.taskData[d[0]].guessPercentage = d[1], $scope.taskData[d[0]]._resultCurrent = !0;
        }), $scope.gridApi && $scope.gridApi.core.queueRefresh();
    }, invalidateResults = function() {
        $scope.taskData.forEach(function(d) {
            d._resultCurrent = !1;
        });
    };
    $scope.requestUpdate = function(updateAll) {
        var idxes = [];
        if (!$scope.gridApi || updateAll) {
            console.log("Updating all entries...");
            for (var i = 0; i < $scope.taskData.length; i++) $scope.taskData[i]._resultCurrent || idxes.push(i);
        } else console.log("Updating visible entries..."), console.log($scope.gridApi), 
        $scope.gridApi.grid.renderContainers.body.renderedRows.forEach(function(row) {
            $scope.taskData[row.entity._idx]._resultCurrent || idxes.push(row.entity._idx);
        });
        console.log("Request update of percentage values..."), console.log(idxes), $scope.thisClassifier.requestUpdate(idxes);
    }, $scope.iterateTraining = function() {
        $scope.thisClassifier.requestIterate(), invalidateResults();
    }, $scope.updatePercentageSort = function() {
        $scope.gridApi && $scope.gridApi.core.notifyDataChange(uiGridConstants.dataChange.EDIT);
    }, $scope.resultsAreSaving = !1, $scope.saveResults = function() {
        $scope.resultsAreSaving = !0, tasksService.saveResults($scope.task, $scope.taskData).then(function() {
            $scope.resultsAreSaving = !1;
        });
    }, $scope.downloadExcel = function() {
        var showColumns = $scope.task.dataSpecification.dataFileFormat.columns.filter(function(col) {
            return -1 !== $scope.task.dataSpecification.showColumns.indexOf(col.display);
        });
        void 0 !== $scope.resultsColumn && showColumns.push({
            source: $scope.resultsColumn,
            display: "result",
            format: "result"
        }), $scope.machineEnabled && showColumns.push({
            source: "Guess",
            display: "guessPercentage",
            format: "percentage"
        }), excelService.exportDataAsDownload($scope.task.title, $scope.task.description, [ {
            name: "OCA",
            title: $scope.task.title,
            columns: showColumns,
            rows: $scope.taskData
        } ]);
    }, $scope.excelFileChanged = function(elm) {
        elm.files[0] && (elm.files[0].name.match(/\.xlsx$/i) || miscServices.translatedConfirm(gettext("This feature only accepts Excel XLSX files. It looks like your file has a different format. Are you sure you want to continue anyways?"))) && excelService.loadData(elm.files[0], [ "OCA" ]).then(function(resultData) {
            console.log("Received Excel data. Merging:"), console.log([ $scope.task.dataSpecification.dataFileFormat.columns, $scope.taskData, resultData ]), 
            tasksService.mergeResults($scope.task.dataSpecification.dataFileFormat.columns, $scope.taskData, resultData[0], $scope.resultsColumn), 
            console.log("Post-merge:"), console.log($scope.taskData), miscServices.translatedAlert(gettext("The result data has been successfully loaded into the current view."));
        });
    }, $scope.printWork = function() {
        var data = {};
        data.taskId = $scope.id, data.task = $scope.task, data.headerRow = $scope.gridOptions.columnDefs.map(function(colDef) {
            return colDef.name;
        }), data.content = $scope.taskData.map(function(d) {
            return $scope.gridOptions.columnDefs.map(function(colDef) {
                return void 0 !== colDef.field ? d3.ourSettings.formats[colDef.dashboardFormat] ? d3.ourSettings.formats[colDef.dashboardFormat](d[colDef.field]) : d[colDef.field] : "";
            });
        }), data.auditForms = [];
        var auditFormPromise = $q.resolve();
        if ($scope.showAuditForms) {
            var auditFormColIdx = $scope.gridOptions.columnDefs.findIndex(function(colDef) {
                return "Audit Forms" === colDef.name;
            });
            auditFormPromise = auditFormsService.getAllForms().then(function(auditFormDefs) {
                $scope.taskData.forEach(function(d, contentIdx) {
                    Array.isArray(d._auditFormData) && d._auditFormData.forEach(function(form) {
                        form.createdInTask.toString() === $scope.id.toString() && !!form.archivedTask === $scope.archivedTasks && form.createdInElement === d._thisKeyword && (data.content[contentIdx][auditFormColIdx] += ("" === data.content[contentIdx][auditFormColIdx] ? "" : ", ") + (data.auditForms.length + 1).toString(), 
                        data.auditForms.push({
                            id: form.id,
                            formDef: auditFormDefs[form.auditForm],
                            sourceData: form.sourceData,
                            resultsData: form.resultsData
                        }));
                    });
                });
            });
        }
        return console.log("Calling openPrintView:"), console.log([ "app/tasks/tablePrintView.tmpl.html", gettext("Print View"), data ]), 
        auditFormPromise.then(function() {
            return printService.openPrintView("app/tasks/tablePrintView.tmpl.html", gettext("Print View"), data);
        });
    }, $scope.workflowRule = "soft", tasksService.getWorkflowRule($scope.id).then(function(workflowRule) {
        $scope.workflowRule = workflowRule;
    }, function(err) {
        console.log("ERROR: An error occured while trying to retrieve the applicable workflowRule for task ID " + $scope.id.toString() + "."), 
        console.log(err);
    }), tasksService.getTask($scope.id, $scope.archivedTasks).then(function(task) {
        return $scope.task = task, $scope.keywords = task.dataSpecification.keywords, $scope.resultsColumn = task.dataSpecification.resultsColumn, 
        void 0 !== $scope.resultsColumn && ($scope.mapResults = Array.isArray(task.dataSpecification.mapResults) ? task.dataSpecification.mapResults : [], 
        $scope.resultsSelection = Array.isArray(task.dataSpecification.resultsSelection) ? task.dataSpecification.resultsSelection : [], 
        $scope.resultsSelectionIterate = !!task.dataSpecification.resultsSelectionIterate && 1 <= $scope.resultsSelection.length), 
        "Done" === task.status || "Reviewed" === task.status || "Archived" === task.status || $scope.archivedTasks || ($scope.readOnly = !1), 
        task.dataSpecification.excelEnabled && ($scope.excelEnabled = !0), !$scope.readOnly && Array.isArray(task.dataSpecification.machineEnabledColumns) && 1 <= task.dataSpecification.machineEnabledColumns.length && void 0 !== task.dataSpecification.machineEnabledResult && ($scope.machineEnabled = !0, 
        $scope.machineEnabledResult = task.dataSpecification.machineEnabledResult, $scope.machineEnabledColumns = task.dataSpecification.machineEnabledColumns), 
        task.dataSpecification.showAuditForms && ($scope.showAuditForms = !0, !$scope.readOnly && Array.isArray(task.dataSpecification.newAuditForms) && ($scope.newAuditForms = task.dataSpecification.newAuditForms)), 
        tasksService.getTaskData(task);
    }).then(function(taskData) {
        return void 0 !== $scope.resultsColumn ? tasksService.loadResults($scope.task, $scope.archivedTasks, taskData) : taskData;
    }).then(function(taskData) {
        $scope.taskData = taskData;
        var columnDefs = $scope.task.dataSpecification.showColumns.map(function(col) {
            var columnDetails = $scope.task.dataSpecification.dataFileFormat.columns.find(function(d) {
                return d.display === col;
            }), colDef = {
                name: col,
                field: col,
                displayName: col,
                enableCellEdit: !1,
                dashboardFormat: columnDetails.format
            };
            return "integer" === columnDetails.format || "number" === columnDetails.format ? colDef.type = "number" : "date" === columnDetails.format ? (colDef.type = "date", 
            colDef.cellFilter = 'date:"yyyy-MM-dd"') : "time" === columnDetails.format && (colDef.type = "date", 
            colDef.cellFilter = 'date:"yyyy-MM-dd HH:mm:ss"'), colDef;
        });
        void 0 !== $scope.resultsColumn && (!$scope.readOnly && $scope.resultsSelectionIterate ? columnDefs.push({
            name: $scope.resultsColumn,
            displayName: $scope.resultsColumn,
            field: "result",
            enableCellEdit: !1,
            cellTemplate: '<div class="ui-grid-cell-contents result-column" ng-click="grid.appScope.updateResult(row.entity, $event)">{{row.entity.result}}</div>'
        }) : columnDefs.push({
            name: $scope.resultsColumn,
            displayName: $scope.resultsColumn,
            field: "result",
            enableCellEdit: !1,
            cellTemplate: '<div class="ui-grid-cell-contents result-column">{{row.entity.result}}</div>'
        })), $scope.machineEnabled && columnDefs.push({
            name: "Guess",
            field: "guessPercentage",
            enableCellEdit: !1,
            type: "number"
        }), $scope.showAuditForms && columnDefs.push({
            name: "Audit Forms",
            enableCellEdit: !1,
            enableFiltering: !1,
            cellTemplate: '<span ng-if="!grid.appScope.auditFormsLoaded">...</span><audit-form-icons ng-if="grid.appScope.auditFormsLoaded" audit-form-data="row.entity._auditFormData" edit-link="' + ($scope.readOnly ? "false" : "true") + '" workflow-rule="grid.appScope.workflowRule" new-form-types="grid.appScope.newAuditForms" on-new="grid.appScope.newAuditFormReceived" on-change="grid.appScope.auditFormChanged" on-change-object="row.entity" on-delete="grid.appScope.auditFormDeleted" auto-save="grid.appScope.autoSaveEnabled" keywords="row.entity._auditFormKeywords" source-task-id="grid.appScope.id" source-task-archived="grid.appScope.archivedTasks" source-element="row.entity._thisKeyword" source-data="row.entity">'
        }), columnDefs.splice(0, 0, {
            name: "Line",
            field: "_idx",
            displayName: " ",
            width: 50,
            dashboardFormat: "integer",
            type: "number",
            pinnedLeft: !0
        });
        var keywordHash = {};
        $scope.taskData.forEach(function(d, idx) {
            d._resultCurrent = !1, d._idx = idx, d._auditFormKeywords = $scope.keywords.map(function(keywordTemplate) {
                return keywordTemplate.replace(/\{\{([^\}]+)\}\}/g, function(match, p1) {
                    return void 0 !== d[p1] ? d[p1] : match;
                });
            }), d._auditFormKeywords.forEach(function(keyword) {
                void 0 === keywordHash[keyword] ? keywordHash[keyword] = [ d ] : keywordHash[keyword].push(d);
            }), d._thisKeyword = keywordsService.getDataKey(void 0, d, $scope.task.dataSpecification.dataFileFormat.columns, void 0, void 0), 
            d._auditFormData = [];
        }), $scope.newAuditFormReceived = function(auditForm) {
            var alreadyMapped = {};
            auditForm.keywords.forEach(function(keyword) {
                keywordHash[keyword] && keywordHash[keyword].forEach(function(taskData) {
                    alreadyMapped[taskData._idx] || taskData._auditFormData.length && taskData._auditFormData[taskData._auditFormData.length - 1] === auditForm || (alreadyMapped[taskData._idx] = !0, 
                    taskData._auditFormData.push(auditForm));
                });
            });
        }, $scope.auditFormChanged = function(changedForm, allForms, entity) {
            console.log("auditFormChanged called: "), console.log([ changedForm, allForms, entity ]);
            var minResult, minIdx = 1 / 0;
            allForms.forEach(function(form) {
                if (form.createdInTask.toString() === $scope.id.toString() && !form.archivedTask && form.createdInElement === entity._thisKeyword) {
                    var myResultIdx = $scope.mapResults.findIndex(function(mapObj) {
                        return mapObj.auditForm === form.auditForm && ("*" === mapObj.mapFrom || mapObj.mapFrom === form.result.toString());
                    });
                    console.log("Checking directly added audit form for match: "), console.log([ form, $scope.mapResults, myResultIdx, minIdx ]), 
                    0 <= myResultIdx && myResultIdx < minIdx && (minIdx = myResultIdx, minResult = void 0 === $scope.mapResults[myResultIdx].mapTo ? form.result : $scope.mapResults[myResultIdx].mapTo);
                }
            }), console.log("Setting new result: " + minResult), entity.result = minResult, 
            entityResultUpdated(entity);
        }, $scope.auditFormDeleted = function(deletedForm) {
            void 0 !== deletedForm.id && deletedForm.keywords.forEach(function(keyword) {
                keywordHash[keyword] && keywordHash[keyword].forEach(function(taskData) {
                    Array.isArray(taskData._auditFormData) && 0 < taskData._auditFormData.length && (taskData._auditFormData = taskData._auditFormData.filter(function(auditForm) {
                        return auditForm.id !== deletedForm.id;
                    }));
                });
            });
        }, $scope.showAuditForms && (console.log("RECEIVING audit form data for keywords: "), 
        console.log($scope.keywords), auditFormsService.findFormData($scope.keywords, !0).then(function(auditFormData) {
            console.log("RECEIVED audit form data:"), console.log(auditFormData), auditFormData.forEach($scope.newAuditFormReceived), 
            $scope.auditFormsLoaded = !0;
        })), $scope.machineEnabled && ($scope.thisClassifier = learningService.getOrAddClassifier("tasks-" + $scope.id, $scope.taskData, $scope.machineEnabledColumns, updateCallback)), 
        $scope.gridOptions = {
            enableSorting: !0,
            enableFiltering: !0,
            onRegisterApi: function(_gridApi) {
                $scope.gridApi = _gridApi, $scope.machineEnabled && $scope.gridApi.core.on.scrollEnd(null, function() {
                    console.log("scrollEnd fired."), $scope.requestUpdate(!1);
                });
            },
            scrollDebounce: 300,
            columnDefs: columnDefs,
            minimumColumnSize: 120,
            data: $scope.taskData
        }, $scope.loading = !1, $scope.errMessage = "", $scope.showTaskDetails = function() {
            ngDialog.open({
                template: "app/tasks/taskDetailsDialog.tmpl.html",
                className: "ngdialog-theme-default",
                data: {
                    task: $scope.task,
                    fromArchive: $scope.archivedTasks
                }
            });
        };
    }).catch(function(err) {
        $scope.loading = !1, console.log("An ERROR occurred while trying to retrieve this task:"), 
        console.log(err), $scope.archivedTasks ? $scope.errMessage = gettext("An error occurred trying to retrieve this task from the archive. Maybe it has been removed.") : $scope.errMessage = gettext("An error occurred trying to retrieve this task. Maybe it has been removed or archived.");
    });
    var triggerAuditFormOpen = function() {
        var formHash = $location.hash(), formDataId = parseInt(formHash);
        console.log("locationChangeSuccess triggered for audit form hash: " + formDataId.toString()), 
        openedAuditForm && openedAuditForm.then(function(ngDialog) {
            ngDialog.close(), openedAuditForm = void 0;
        }), !isNaN(formDataId) && 0 <= formDataId && (openedAuditForm = auditFormsService.showFormData(formDataId)).then(function(ngDialog) {
            return ngDialog.closePromise;
        }).then(function() {
            $location.hash() === formHash && $location.hash("");
        });
    };
    triggerAuditFormOpen(), $scope.$on("$locationChangeSuccess", triggerAuditFormOpen);
} ]), angular.module("dashboardTree", [ "ui.router", "ngDialog", "dashboardTreeServices", "dashboardViewServices", "chartServices", "chartDirectives", "notesDirectives", "impactDirectives", "riskTrackerDirectives", "objectExplorerDirectives", "zoomDirectives" ]).config([ "$stateProvider", function($stateProvider) {
    $stateProvider.state("tree", {
        url: "/tree",
        views: {
            "main@": {
                templateUrl: "app/tree/tree.tmpl.html",
                controller: "treeIndexController"
            }
        }
    }).state("tree.dashboard", {
        url: "/:id",
        views: {
            "main@": {
                templateUrl: "app/tree/dashboard.tmpl.html",
                controller: "treeDashboardController"
            }
        }
    }).state("tree.dashboard.tab", {
        url: "/:tab",
        views: {
            "main@": {
                templateUrl: "app/tree/dashboard.tmpl.html",
                controller: "treeDashboardController"
            }
        }
    });
} ]).controller("treeIndexController", [ "$scope", "treeService", function($scope, treeService) {
    $scope.tree = [], $scope.errMessage = "", $scope.loading = !0, $scope.onlyActive = !0, 
    $scope.filterActive = function(treeItem) {
        return !$scope.onlyActive || treeItem.active;
    }, treeService.getFullHierarchy().then(function(treeStart) {
        $scope.tree = [ treeStart ], $scope.loading = !1, console.log("Tree has been loaded:"), 
        console.log($scope.tree);
    }, function(err) {
        $scope.errMessage = err, $scope.loading = !1;
    });
} ]).controller("treeDashboardController", [ "$scope", "$state", "$transition$", "$sce", "gettext", "ngDialog", "dashboardViewService", "treeService", function($scope, $state, $transition$, $sce, gettext, ngDialog, dashboardViewService, treeService) {
    $scope.id = $transition$.params().id, $scope.tab = $transition$.params().tab, $scope.dashboardElements = [], 
    $scope.tabs = [], $scope.loading = !0, $scope.errMessage = "", $scope.dashboardName = "", 
    $scope.showDashboardHelp = function(helpTitle, helpText, stopPropEvent) {
        stopPropEvent && stopPropEvent.stopPropagation(), ngDialog.open({
            template: "app/tree/dashboardHelpDialog.tmpl.html",
            className: "ngdialog-theme-default",
            data: {
                helpTitle: helpTitle,
                helpText: helpText
            }
        });
    }, treeService.getElementTitle($scope.id).then(function(name) {
        $scope.dashboardName = name;
    }, function(err) {
        $scope.dashboardName = "(" + gettext("Error") + ")", console.log("Could not load dashboard name: " + err);
    });
    var filterVisibleElements = function() {
        var activeTab;
        void 0 !== $scope.tab && (activeTab = $scope.tabs.find(function(tab) {
            return tab.tabId === $scope.tab;
        })), $scope.visibleElements = activeTab ? $scope.dashboardElements.filter(function(el) {
            return el.orderAsc >= activeTab.from && el.orderAsc <= activeTab.to;
        }) : $scope.dashboardElements;
    };
    $scope.changeTab = function(tabId) {
        $scope.tab = tabId, $state.go("tree.dashboard.tab", {
            id: $scope.id,
            tab: tabId
        }, {
            notify: !1
        }), filterVisibleElements();
    }, dashboardViewService.getDashboardElements($scope.id).then(function(view) {
        var currTab;
        $scope.dashboardElements = view, $scope.tabs = [], view.forEach(function(el, i) {
            "iframe" === el.type && el.options.url && (el.options.insecureUrl = $sce.trustAsResourceUrl(el.options.url)), 
            "tabDivider" === el.type && (0 < i && (void 0 === currTab && (currTab = "", $scope.tabs.push({
                tabId: "",
                tabTitle: "Intro",
                tabText: "Intro",
                tabColor: "#ffffff",
                tabSelectedColor: "#dddddd",
                from: 0
            })), $scope.tabs[$scope.tabs.length - 1].to = el.orderAsc - 1), currTab = el.options.tabId, 
            $scope.tabs.push({
                tabId: el.options.tabId,
                tabTitle: el.title,
                tabText: el.options.tabText,
                tabColor: el.options.tabColor,
                tabSelectedColor: el.options.tabSelectedColor,
                tabHelpText: el.options.helpText,
                from: el.orderAsc,
                to: 1 / 0
            }));
        }), void 0 !== currTab && void 0 === $scope.tab && ($scope.tab = $scope.tabs[0].tabId), 
        filterVisibleElements(), $scope.loading = !1;
    }, function(err) {
        $scope.errMessage = err, $scope.loading = !1;
    });
} ]), angular.module("dashboardProfile", [ "ui.router", "ngTagsInput", "dashboardApp", "usersServices", "configServices", "chartServices", "miscServices", "notesServices" ]).config([ "$stateProvider", function($stateProvider) {
    $stateProvider.state("profile", {
        url: "/profile",
        views: {
            "main@": {
                templateUrl: "app/profile/profile.tmpl.html",
                controller: "profileController"
            }
        }
    });
} ]).controller("profileController", [ "$scope", "$q", "$timeout", "gettext", "gettextCatalog", "usersService", "configService", "d3", function($scope, $q, $timeout, gettext, gettextCatalog, usersService, configService, d3) {
    $scope.errMessage = "", $scope.isLoading = !0, $scope.isSaving = !1, $scope.hasSaved = !1, 
    $scope.availableLanguages = {};
    var loadConfig = configService.getConfiguration().then(function(config) {
        try {
            $scope.availableLanguages = JSON.parse(config["Available Languages"]);
        } catch (e) {
            console.log("Could not load available languages!"), console.log(e), $scope.availableLanguages = {
                en: "English"
            };
        }
        $scope.defaultLanguage = $scope.availableLanguages[config["Default Language"]] ? config["Default Language"] : "en";
    }), loadUserSettings = usersService.getCurrentUserSettings().then(function(settings) {
        $scope.settings = settings, void 0 !== $scope.settings.watchNewNote && null !== $scope.settings.watchNewNote || ($scope.settings.watchNewNote = "yes");
    });
    $q.all([ loadConfig, loadUserSettings ]).then(function() {
        $scope.errMessage = "", $scope.isLoading = !1;
    }, function(err) {
        $scope.errMessage = gettext("An error occured loading your settings: " + err + " Please get in touch or try again later.");
    }), $scope.changeLanguage = function() {
        console.log("Changing language to " + $scope.settings.language), gettextCatalog.setCurrentLanguage($scope.settings.language), 
        d3.ourSettings.setLocale($scope.settings.language);
    }, $scope.saveProfile = function() {
        void 0 === $scope.settings.language || $scope.availableLanguages[$scope.settings.language] ? ($scope.isSaving = !0, 
        usersService.saveUserSettings($scope.settings).then(function(settings) {
            $scope.settings = settings, $scope.isSaving = !1, $scope.hasSaved = !0, $timeout(function() {
                $scope.hasSaved = !1;
            }, 5e3);
        }, function(err) {
            $scope.errMessage = gettext("An error occured saving your changes:") + " " + err, 
            $scope.isSaving = !1, $scope.hasSaved = !1;
        })) : $scope.errMessage = gettext("Please select a valid language you want The Dashboard to be displayed in!");
    };
} ]), angular.module("dashboardApp", [ "ui.router", "gettext", "ngSanitize", "ngDialog", "dashboardTree", "dashboardAdmin", "dashboardProfile", "dashboardTasks", "socialDirectives", "dashboardScreenServices", "usersServices", "configServices", "chartServices", "feedbackServices", "miscServices", "restServices" ]).config([ "$stateProvider", "$urlServiceProvider", function($stateProvider, $urlServiceProvider) {
    $stateProvider.state("index", {
        url: "/",
        views: {
            "main@": {
                templateUrl: "app/index.tmpl.html"
            }
        }
    }).state("about", {
        url: "/about",
        views: {
            "main@": {
                templateUrl: "app/about.tmpl.html",
                controller: "languageController"
            }
        }
    }), $urlServiceProvider.rules.otherwise("/");
} ]).run([ "$anchorScroll", "gettextCatalog", "usersService", "configService", "d3", function($anchorScroll, gettextCatalog, usersService, configService, d3) {
    $anchorScroll.yOffset = 45, usersService.getUserLanguage().then(function(language) {
        gettextCatalog.setCurrentLanguage(language), d3.ourSettings.setLocale(language), 
        window.moment.locale(language);
    }, function(err) {
        console.log("An error occured trying to retrieve language settings:"), console.log(err), 
        gettextCatalog.setCurrentLanguage("en"), d3.ourSettings.setLocale("en"), window.moment.locale("en");
    });
} ]).controller("navbarController", [ "$scope", "$q", "$location", "gettext", "ngDialog", "usersService", "feedbackService", "miscServices", function($scope, $q, $location, gettext, ngDialog, usersService, feedbackService, miscServices) {
    $scope.isAdmin = !1, $scope.isTestingMode = !!window.dashboardTestEnvironment, usersService.isSiteAdmin().then(function(res) {
        return res ? $q.resolve(!0) : usersService.isAdmin();
    }).then(function(res) {
        $scope.isAdmin = res;
    }, function(err) {
        console.log("Error getting admin status:" + err);
    });
    var startFeedbackInProgress = !1;
    $scope.startFeedback = function() {
        if (!startFeedbackInProgress) {
            var sendScreenshot, feedbackDialog;
            angular.element(document).find("body").addClass("waitingCursor"), startFeedbackInProgress = !0;
            var sendFeedback = function(feedbackText, feedbackSmiley) {
                feedbackService.sendFeedback("SMILE OR FROWN: " + feedbackSmiley + "\n\n------------------------------------\n" + feedbackText + "\n------------------------------------\n\nSource URL: " + $location.absUrl(), sendScreenshot).then(function() {
                    miscServices.translatedAlert(gettext("Your feedback has been stored and we will get in touch soon.")), 
                    feedbackDialog && feedbackDialog.close();
                }, function(err) {
                    console.log("An ERROR occured while trying to save feedback:"), console.log([ feedbackText, sendScreenshot, err ]), 
                    miscServices.translatedAlert(gettext("Your feedback could not be stored. Please try again later or see the log for details.")), 
                    feedbackDialog && feedbackDialog.close();
                });
            };
            feedbackService.getScreenshot().then(function(screenshot) {
                sendScreenshot = screenshot, angular.element(document).find("body").removeClass("waitingCursor"), 
                startFeedbackInProgress = !1, feedbackDialog = ngDialog.open({
                    template: "app/feedbackDialog.tmpl.html",
                    className: "ngdialog-theme-default",
                    data: {
                        sendFeedback: sendFeedback
                    }
                });
            });
        }
    };
} ]).controller("sidebarController", [ "$scope", "$q", "$timeout", "$transitions", "sidebarService", function($scope, $q, $timeout, $transitions, sidebarService) {
    $scope.data = {}, $scope.sidebarVisibility = "hide", $scope.sidebarTemplate = "";
    sidebarService.registerController(function(newTemplate, newData) {
        $scope.sidebarTemplate = newTemplate, $scope.data = newData, console.log("Updated sidebar scope:"), 
        console.log($scope);
    }, function(newVisibility) {
        $scope.sidebarVisibility = "dashboardSidebar-" + newVisibility;
    });
} ]).controller("mainDivController", [ "$scope", "$q", "screenService", function($scope, $q, screenService) {
    $scope.mainDivStyle = {
        "margin-left": "10px",
        "margin-right": "10px"
    };
    screenService.registerController(function(leftMargin, rightMargin) {
        $scope.mainDivStyle = {
            "margin-left": leftMargin + 10 + "px",
            "margin-right": rightMargin + 10 + "px"
        };
    });
} ]).controller("languageController", [ "$scope", "gettextCatalog", function($scope, gettextCatalog) {
    $scope.currentLanguage = gettextCatalog.getCurrentLanguage(), $scope.currentLanguage || ($scope.currentLanguage = "en");
} ]), angular.module("dashboardApp").run([ "gettextCatalog", function(gettextCatalog) {
    gettextCatalog.setStrings("de", {
        "(optional, if not given will default to one line)": "(optional, falls leer wird eine Zeile angezeigt)",
        "(should be unique on this dashboard, only letters, numbers, underscore, dash allowed)": "(muss innerhalb der Ansicht eindeutig sein; nur Buchstaben, Zahlen, Unterstrich und Bindestrich sind erlaubt)",
        "(use <code>[ELEMENT]</code> to reference selected element)": "(mit <code>[ELEMENT]</code> kann das ausgewählte Element referenziert werden)",
        "*) Specifying a color is only required if you want to overwrite the standard color palette for this column. In this case you need to specify it in RGB hex format (<code>#ffffff</code>), otherwise you can leave this field empty.": "*) Eine Farbe muss nur angegeben werden, wenn die standardmässige Farbpalette übersteuert werden soll. In diesem Fall muss eine Farbe im RGB-Hexadezimal-Format (<code>#ffffff</code>) angegeben werden, ansonsten kann das Feld leer bleiben.",
        "<b>Add new datafile</b>": "<b>Neue Quelldatendefinition hinzufügen</b>",
        "<b>Note:</b> The feedback above will be sent together with a screenshot of the current dashboard view and the dashboard URL you are currently on. It will be stored unencrypted and can be retrieved by other Dashboard users.": "<b>Hinweis:</b> Das Feedback wird zusammen mit einem Screenshot der aktuellen Dashboardansicht und der Adresse, die Sie gerade offen haben, verschickt. Es wird unverschlüsselt gespeichert und kann von anderen Dashboard-Nutzern abgerufen werden.",
        '<i ng-show="!el.options.columnColumn">Or: </i>Use the following datafile column to construct table columns (transposing them):': "<i ng-show=“!el.options.columnColumn”>Oder: </i>Transponiere die folgende Spalte des Datafiles um die Tabellenspalten zu generieren:",
        "A risk was <b>deleted</b>.": "Ein Risiko wurde <b>gelöscht</b>.",
        "A risk you have been watching was <b>deleted</b>.": "Ein überwachtes Risiko wurde <b>gelöscht</b>.",
        'A task can only be reviewed when it is marked as "done".': "Ein Task kann nur als “überprüft” markiert werden, wenn er im Status “erledigt” ist.",
        'A task cannot be reviewed by the same person who marked it as "done".': "Ein Task kann nicht von der gleichen Person überprüft werden, die ihn als “erledigt” markiert hat.",
        About: "Über uns",
        "Active from:": "Aktiv ab:",
        "Active to:": "Aktiv bis:",
        "Ad-hoc-Reporting": "Ad-hoc-Reporting",
        Add: "Hinzufügen",
        "Add Risk": "Neues Risiko",
        "Add additional column": "Zusatzspalte einfügen",
        "Add additional column here": "Zusatzspalte hier einfügen",
        "Add column definition": "Neue Spaltendefinition hinzufügen",
        "Add comment": "Kommentar hinzufügen",
        "Add comments": "Kommentare hinzufügen",
        "Add conditional format": "Bedingte Formatierung hinzufügen",
        "Add formatting rule": "Formatierungsregel hinzufügen",
        "Add new Audit Form": "Neues Audit-Formular hinzufügen",
        "Add new column definition": "Neue Spaltendefinition hinzufügen",
        "Add new element": "Neues Element einfügen",
        "Add new element here": "Neues Element hier einfügen",
        "Add new impact flag:": "Neuen Impact erfassen:",
        "Add new note": "Notiz hinzufügen",
        "Add new object table": "Neue Objekttabelle einfügen",
        "Add new object table here": "Neue Objekttabelle hier einfügen",
        "Add new view": "Neue Ansicht einfügen",
        "Add new view here": "Neues Ansicht hier einfügen",
        "Add new:": "Neu hinzufügen:",
        "Add...": "Hinzufügen…",
        "Adding field": "Erstelle Feld",
        "Additional columns to be displayed (if any):": "Zusätzliche Spalten, die angezeigt werden sollen (falls vorhanden):",
        Administration: "Administration",
        "Administration - Audit Universe": "Administration - Audit Universe",
        "Administration - Dashboard &quot;{{dashboardName}}&quot;": "Administration - Dashboard &quot;{{dashboardName}}&quot;",
        "Administration - Dashboard Views": "Administration - Dashboard-Elemente",
        "Administration - Datafile &quot;{{datafile.dataFile}}&quot;": "Administration - Quelldatendefinition &quot;{{datafile.dataFile}}&quot;",
        "Administration - Datafiles": "Administration - Quelldatendefinitionen",
        "Administration - Exporting Loadfile": "Administration - Loadfile exportieren",
        "Administration - Load Loadfile": "Administration - Loadfile laden",
        "Administration - New Datafile": "Administration - Neue Quelldatendefinition",
        "All Loadfiles have been successfully loaded into the system.": "Alle Loadfiles wurden erfolgreich ins System geladen.",
        "All changes to the Audit Universe have been saved.": "Alle Änderungen am Audit Universe wurden gespeichert.",
        "All changes to the dashboard view have been saved.": "Alle Änderungen an den Dashboard-Elementen wurden gespeichert.",
        "Allow user to assign impact flags to these notes": "Benutzer darf Impacts an diese Notizen anhängen",
        "Allow user to change the status filter": "Benutzer darf den Filter für den Notizstatus anpassen",
        "Allow user to load additional notes": "Benutzer darf zusätzliche Notizen nachladen",
        "Allow user to restrict search with other keywords": "Benutzer darf die Suche mit zusätzlichen Stichwörtern einschränken",
        "Allow user to set other keywords": "Benutzer darf freie Stichwörter vergeben",
        "Allow users to create notes on this chart": "Benutzer darf an diesem Dashboard-Element Notizen erstellen",
        "Allow users to create notes on this table": "Benutzer darf an dieser Tabelle Notizen erstellen",
        "An error occured loading your settings:  Please get in touch or try again later.": "Ihre Benutzereinstellungen konnten aufgrund eines Fehlers nich geladen werden:  Bitte kontaktieren Sie den Support oder versuchen Sie es später erneut.",
        "An error occured reloading data from database:": "Beim Nachladen der Daten von der Datenbank ist ein Fehler aufgetreten:",
        "An error occured retrieving audit forms.": "Beim Abrufen der Audit-Formulare ist ein Fehler aufgetreten.",
        "An error occured saving your Audit Universe changes:": "Beim Speichern der Audit-Universe-Änderungen ist ein Fehler aufgetreten:",
        "An error occured saving your changes:": "Beim Speichern Ihrer Änderungen ist ein Fehler aufgetreten:",
        "An error occured saving your dashboard view changes:": "Beim Speichern Ihrer Änderungen an den Dashboard-Elementen ist ein Fehler aufgetreten:",
        "An error occured trying to retrieve file metadata.": "Beim Abrufen der Datei-Metadaten ist ein Fehler aufgetreten.",
        "An error occured updating the task:": "Beim Aktualisieren der Aufgabe ist ein Fehler aufgetreten:",
        "An error occured while triggering subscriptions to the saved risk. Please try again later.": "Beim Auslösen der Abonnements für das gespeicherte Risiko ist ein Fehler aufgetreten. Bitte später erneut versuchen.",
        "An error occured while trying to add a new interaction to this element.": "Beim Versuch, eine neue Interaktion für dieses Element hinzuzufügen, ist ein Fehler aufgetreten.",
        "An error occured while trying to add a new subscription item.": "Beim Versuch, ein neues Abonnement hinzuzufügen, ist ein Fehler aufgetreten.",
        "An error occured while trying to archive the task.": "Beim Archivieren der Aufgabe ist ein Fehler aufgetreten.",
        "An error occured while trying to delete filtered items: The returned results set was not in the expected format.": "Beim Löschen der gefilterten Einträge ist ein Fehler aufgetreten: Das zurückgelieferte Ergebnis war nicht im erwarteten Format.",
        "An error occured while trying to delete form data:": "Beim Löschen der Formulardaten ist ein Fehler aufgetreten:",
        "An error occured while trying to delete this audit form.": "Beim Löschen dieses Audit-Formulars ist ein Fehler aufgetreten.",
        "An error occured while trying to get group members: The returned data is not formatted as expect.": "Beim Versuch, die Gruppenmitglieder abzurufen, ist ein Fehler aufgetreten: Die erhaltenen Daten sind nicht wie erwartet formatiert.",
        "An error occured while trying to load task results.": "Beim Laden der Aufgaben-Resultate ist ein Fehler aufgetreten.",
        "An error occured while trying to open this audit form.": "Beim Öffnen dieses Audit-Formulars ist ein Fehler aufgetreten.",
        "An error occured while trying to process a loadfile operation. Do you want to continue?": "Beim Verarbeiten einer Loadfile-Operation ist ein Fehler aufgetreten. Wollen Sie trotzdem fortfahren?",
        "An error occured while trying to remove an interaction.": "Beim Versuch, eine Interaktion zu entfernen, ist ein Fehler aufgetreten.",
        "An error occured while trying to remove news items related to this element.": "Beim Versuch, Newsfeed-Einträge für dieses Element zu entfernen, ist ein Fehler aufgetreten.",
        "An error occured while trying to remove subscriptions to this element.": "Beim Versuch, Abonnements für dieses Element zu entfernen, ist ein Fehler aufgetreten.",
        "An error occured while trying to remove the mapping:": "Beim Entfernen der Objektzuordnung ist ein Fehler aufgetreten:",
        "An error occured while trying to remove your subscription.": "Beim Versuch, das Abonnement zu entfernen, ist ein Fehler aufgetreten.",
        "An error occured while trying to retrieve form data:": "Beim Laden der Formulardaten ist ein Fehler aufgetreten:",
        "An error occured while trying to retrieve group members. Please try again.": "Beim Versuch, die Gruppenmitglieder abzurufen, ist ein Fehler aufgetreten. Bitte später erneut versuchen.",
        "An error occured while trying to retrieve subscriptions for this user.": "Beim Versuch, die Abonnements dieses Benutzers abzurufen, ist ein Fehler aufgetreten.",
        "An error occured while trying to retrieve the interaction list for the target.": "Beim Versuch, die Interaktionen für dieses Element abzurufen, ist ein Fehler aufgetreten.",
        "An error occured while trying to retrieve the newsfeed items. Please try again later.": "Beim Versuch, die Newsfeed-Einträge abzurufen, ist ein Fehler aufgetreten. Bitte später erneut versuchen.",
        "An error occured while trying to retrieve the original task data.": "Beim Abrufen der ursprünglichen Daten zur Aufgabe ist ein Fehler aufgetreten.",
        "An error occured while trying to retrieve the original task results.": "Beim Abrufen der erfassten Resultate zur Aufgabe ist ein Fehler aufgetreten.",
        "An error occured while trying to save the new mapping:": "Beim Speichern der neuen Objektzuordnung ist ein Fehler aufgetreten:",
        "An error occured while trying to trigger the subscriptions for the new risk.": "Beim Versuch, die Abonnements für das neue Risiko auszulösen, ist ein Fehler aufgetreten.",
        "An error occured while trying to update filtered items: The returned results set was not in the expected format.": "Beim Aktualisieren der gefilterten Elemente ist ein Fehler aufgetreten: Das zurückgelieferte Ergebnis war nicht im erwarteten Format.",
        "An error occured while trying to update the workflow status. Please try again later.": "Beim Aktualisieren des Workflow-Status ist ein Fehler aufgetreten. Bitte versuchen Sie es später erneut.",
        "An error occurred checking access rights:": "Beim Überprüfen der Zugriffsrechte ist ein Fehler aufgetreten:",
        "An error occurred deleting the impact flag:": "Beim Löschen dieses Impacts ist ein Fehler aufgetreten:",
        "An error occurred deleting the note:": "Beim Löschen der Notiz ist ein Fehler aufgetreten:",
        "An error occurred loading last editor:": "Beim Identifizieren des letzten Bearbeiters ist ein Fehler aufgetreten:",
        "An error occurred loading the dashboard view from SharePoint:": "Das Laden der Dashboard-Ansicht von SharePoint ist fehlgeschlagen:",
        "An error occurred obtaining attachments for note": "Das Laden der Attachments ist fehlgeschlagen für Notiz",
        "An error occurred parsing the dashboard view, probably some view options JSON is invalid.": "Die Dashboard-Ansicht konnte nicht gelesen werden, vermutlich ist das JSON mit den Details der Ansicht ungültig.",
        "An error occurred trying to retrieve this task from the archive. Maybe it has been removed.": "Beim Versuch, diesen OCA-Task aus dem Archiv abzurufen, ist ein Fehler aufgetreten. Vielleicht wurde er entfernt.",
        "An error occurred trying to retrieve this task. Maybe it has been removed or archived.": "Beim Versuch, diesen OCA-Task abzurufen, ist ein Fehler aufgetreten. Vielleicht wurde er entfernt oder archiviert.",
        "An error occurred when checking for duplicates:": "Beim Prüfen auf Dubletten ist ein Fehler aufgetreten:",
        "An error occurred when deleting the datafile definition on the server:": "Beim Löschen der Quelldatendefinition auf dem Server ist ein Fehler aufgetreten:",
        "An error occurred when deleting the element on the server:": "Beim Löschen des Elements auf dem Server ist ein Fehler aufgetreten:",
        "An error occurred when saving the changed datafile definition to the server:": "Beim Speichern der geänderten Quelldatendefinition auf dem Server ist ein Fehler aufgetreten:",
        "An error occurred when saving the changed element to the server:": "Beim Speichern des geänderten Dashboard-Elements ist ein Fehler aufgetreten:",
        "An error occurred when saving the new datafile definition to the server:": "Beim Speichern der neuen Quelldatendefinition auf dem Server ist ein Fehler aufgetreten:",
        "An error occurred when saving the new element to the server:": "Beim Speichern des neuen Dashboard-Elements auf dem Server ist ein Fehler aufgetreten:",
        "An error occurred when saving the note to the server:": "Beim Speichern der Notiz auf dem Server ist ein Fehler aufgetreten:",
        "An error occurred when updating the element on the server:": "Beim Aktualisieren des Elements auf dem Server ist ein Fehler aufgetreten:",
        "An error occurred while adding the mapping:": "Beim Hinzufügen der Objektzuordnung ist ein Fehler aufgetreten:",
        "An error occurred while adding the new keyword:": "Beim Hinzufügen des neuen Keywords ist ein Fehler aufgetreten:",
        "An error occurred while deleting the mapping:": "Beim Löschen der Objektzuordnung ist ein Fehler aufgetreten:",
        "An error occurred while freezing risk objects:": "Beim Einfrieren der Risikoobjekte ist ein Fehler aufgetreten:",
        "An error occurred while loading notes from the database:": "Die Notizen konnten nicht aus der Datenbank geladen werden:",
        "An error occurred while loading this graph:": "Diese Grafik konnte nicht geladen werden:",
        "An error occurred while loading user data: Provided userId is invalid.": "Es ist ein Fehler aufgetreten: Die angegebene Benutzer-ID ist ungültig.",
        "An error occurred while loading user settings: Provided userId is invalid.": "Beim Laden der Benutzereinstellungen ist ein Fehler aufgetreten: Die angegebene userId ist ungültig.",
        "An error occurred while removing attachments:": "Beim Entfernen der Attachments ist ein Fehler aufgetreten:",
        "An error occurred while retrieving mappings:": "Beim Abrufen der Objektzuordnungen ist ein Fehler aufgetreten:",
        "An error occurred while retrieving objects:": "Beim Abrufen der Objekte ist ein Fehler aufgetreten:",
        "An error occurred while retrieving the mapping:": "Beim Abrufen der Objektzuordnung ist ein Fehler aufgetreten:",
        "An error occurred while saving attachments:": "Beim Speichern der Attachments ist ein Fehler aufgetreten:",
        "An error occurred while trying to update the impacts for this note.": "Beim Aktualisieren der Impacts für diese Notiz ist ein Fehler aufgetreten.",
        "An error occurred:": "Ein Fehler ist aufgetreten:",
        "An error occurred: The obtained data object is not formatted as expected or the tree list is empty.": "Es ist ein Fehler aufgetreten: Das erhaltene Objekt ist nicht wie erwartet formatiert oder die Baumhierarchie ist leer.",
        "An error occurred: The obtained data object is not formatted as expected.": "Es ist ein Fehler aufgetreten: Das erhaltene Objekt ist nicht wie erwartet formatiert.",
        "An error occurred: The obtained mapping data is not formatted as expected.": "Es ist ein Fehler aufgetreten: Die erhaltene Objektzuordnung ist nicht wie erwartet formatiert.",
        "An error occurred: The tree does not have a root object without parent!": "Es ist ein Fehler aufgetreten: Der Baum hat kein Wurzel-Element ohne Elternobjekt!",
        "An error occurred: The tree has multiple active root nodes (=nodes without valid parent)!": "Es ist ein Fehler aufgetreten: Der Baum hat mehrere aktive Wurzel-Elemente (=Elemente ohne gültiges Elternobjekt)!",
        "An existing settings object needs to have a valid userId.": "Eine bestehende Benutzerkonfiguration muss eine gültige userId enthalten.",
        "An unexpected response was received while trying to add a new interaction item.": "Beim Versuch, eine neue Interaktion hinzuzufügen, wurde eine unerwartete Antwort empfangen.",
        "An unexpected response was received while trying to add a new newsfeed item.": "Beim Versuch, einen neuen Newsfeed-Eintrag hinzuzufügen, wurde eine unerwartete Antwort empfangen.",
        "An unexpected response was received while trying to add a new subscription item.": "Beim Versuch, ein neues Abonnement hinzuzufügen, wurde eine unerwartete Antwort empfangen.",
        "An unexpected response was received while trying to retrieve an interaction summary.": "Beim Versuch, die Interaktionszusammenfassung abzurufen, wurde eine unerwartete Antwort empfangen.",
        "An unexpected response was received while trying to write the OCA task to the library.": "Beim Versuch, den OCA-Task in der Bibliothek zu speichern, wurde eine unerwartete Antwort empfangen.",
        "An unknown error occured.": "Es ist ein unbekannter Fehler aufgetreten.",
        "Animate over time / increase speed": "Über die Zeit animieren / Geschwindigkeit erhöhen",
        "Archive this task": "OCA-Task archivieren",
        "Archived tasks": "Archivierte OCA-Tasks",
        "Are you sure you want to CANCEL all your changes? All changes will be lost. This action cannot be undone.": "Sind Sie sicher, dass Sie alle Ihre Änderungen VERWERFEN wollen? Alle Änderungen gehen verloren. Dieser Prozess kann nicht rückgängig gemacht werden.",
        "Are you sure you want to DELETE this datafile definition? This action cannot be undone.": "Sind Sie sicher, dass Sie diese Quelldatendefinition LÖSCHEN möchten? Dieser Prozess kann nicht rückgängig gemacht werden.",
        "Are you sure you want to SAVE your changes? This action cannot be undone.": "Sind Sie sicher, dass Sie alle Ihre Änderungen SPEICHERN möchten? Dieser Prozess kann nicht rückgängig gemacht werden.",
        "Are you sure you want to archive this task? This cannot be undone.": "Sind Sie sicher, dass Sie diese Aufgabe archivieren möchten? Dieser Vorgang kann NICHT rückgängig gemacht werden.",
        'Are you sure you want to freeze all risks? All changes will be saved, then a new "snapshot" of all existing risks will be created and turned into "history". Note that this action cannot be undone and that frozen risks cannot be edited or deleted.': "Sind Sie sicher, dass Sie die Risiken einfrieren wollen? Alle Änderungen werden gespeichert, anschliessend wird ein neuer “Schnappschuss” aller existierenden Risiken erstellt und historisiert. Dieser Vorgang kann nicht rückgängig gemacht werden und eingefrorene Risiken können nicht mehr editiert oder gelöscht werden.",
        "Are you sure you want to permanently remove this note?": "Sind Sie sicher, dass Sie diese Notiz unwiderruflich löschen möchten?",
        "Are you sure you want to remove this element?": "Sind Sie sicher, dass Sie diesen Eintrag löschen möchten?",
        "Are you sure you want to remove this risk item? Once you save your changes, you will not be able to reactive it.": "Sind Sie sicher, dass Sie dieses Risiko entfernen möchten? Sobald Sie Ihre Änderungen speichern, können Sie das Risiko nicht mehr reaktivieren.",
        "Assigned to:": "Zugewiesen an:",
        Attachments: "Dateianhänge",
        "Audit form": "Audit-Formular",
        "Auto-save": "Automatisches Speichern",
        "Automatically watch notes created by you": "Selbst erstellte Notizen automatisch beobachten",
        "Automatically zoom into last n elements (zero or empty for no zoom):": "Automatischer Zoom auf die letzten n Elemente (null oder leer lassen für keinen Zoom):",
        "Available Views": "Vorhandene Ansichten",
        "Based on your keyword subscription to {{ item.subscriptionTargetDescription }}.": "Basierend auf Ihrem Stichwort-Abonnement für {{ item.subscriptionTargetDescription }}.",
        By: "Von",
        Cancel: "Abbrechen",
        "Cancel changes": "Änderungen verwerfen",
        "Change conditional formatting of element": "Bedingte Formatierung des Elements ändern",
        "Changed Risk": "Geändertes Risiko",
        "Click to hide details": "Details ausblenden",
        "Click to subscribe to": "Klicken zum Abonnieren von",
        "Click to watch": "Klicken, um dieses Element zu beobachten",
        "Close mapping": "Zuordnungsansicht schliessen",
        "Close sidebar": "Seitenleiste schliessen",
        Closed: "Abgeschlossen",
        "Color for tab when selected:": "Farbe der Lasche, wenn sie ausgewählt ist:",
        "Color for tab:": "Farbe der Lasche:",
        "Color*": "Farbe*",
        Column: "Spalte",
        "Column from datafile that specifies a label for each data element (optional):": "Spalte aus den Quelldaten, die eine Beschreibung jedes Datenelements enthält (optional):",
        "Column from datafile that specifies divisions of the portfolio (optional):": "Spalte aus den Quelldaten, die die Abtrennungen des Portfolios angeben (optional):",
        "Column from datafile that specifies the circle size:": "Spalte aus den Quelldaten, die die Grösse der Blase angibt:",
        "Column from datafile that specifies the group (color) of the box:": "Spalte aus den Quelldaten, die den Bereich (Farbe) des Elements angibt:",
        "Column from datafile that specifies the group (color) of the circle:": "Spalte aus den Quelldaten, die den Bereich (Farbe) der Blase angibt:",
        "Column from datafile that specifies the height of the box (y axis):": "Spalte aus den Quelldaten, die die Höhe (Y-Achse) des Elements angibt:",
        "Column from datafile that specifies the individual bar:": "Spalte aus den Quelldaten, die den einzelnen Balken spezifiziert:",
        "Column from datafile that specifies the width of the box (x axis):": "Spalte aus den Quelldaten, die die Breite (X-Achse) des Elements angibt:",
        "Column from datafile that specifies the x position (horizontal):": "Spalte aus den Quelldaten, die die X-Position (horizontal) der Blase angibt:",
        "Column from datafile that specifies the y position (vertical):": "Spalte aus den Quelldaten, die die Y-Position (vertikal) der Blase angibt:",
        "Column from datafile to show as first table column (row header):": "Spalte aus den Quelldaten, die als erste Tabellenspalte angezeigt werden soll (Zeilenüberschrift):",
        "Column from datafile to use as time (time selector):": "Spalte aus den Quelldaten, die den Zeitpunkt der Daten angibt (für den Zeitwählregler):",
        "Column from datafile to use as time (x axis):": "Spalte aus den Quelldaten, die die Zeit der Datenwerte angibt (X-Achse):",
        "Column from the datafile that will fill the cells of the table:": "Spalte aus den Quelldaten, die den Inhalt der Zellen der Tabelle bestimmt:",
        "Column separator:": "Spaltentrennzeichen:",
        "Columns that should be displayed as lines on top of the portfolio (optional):": "Spalten die als Liniengrafik über dem Portfolio dargestellt werden sollen (optional):",
        "Comments available": "Kommentare vorhanden",
        "Conditional Formatting": "Bedingte Formatierung",
        "Configuration for notes interface on chart:": "Einstellungen für die Notizfunktion an diesem Chart:",
        "Configure dashboard element": "Dashboard-Element konfigurieren",
        "Could not archive audit forms data: The response received was not in the expected format.": "Die Audit-Formulare konnten nicht archiviert werden: Die erhaltenen Daten waren nicht im erwarteten Format.",
        "Could not get the subscriptions for this element: The response received was not in the expected format.": "Die Abonnements für dieses Element konnten nicht abgerufen werden: Die erhaltene Antwort war nicht im erwarteten Format.",
        "Could not load task list:": "Die Aufgabenliste konnte nicht geladen werden:",
        "Could not retrieve interactions for this data combination: The response received was not in the expected format.": "Die Interaktionen für diese Kombination konnten nicht abgerufen werden: Die erhaltene Antwort war nicht im erwarteten Format.",
        "Could not retrieve interactions of this user: The response received was not in the expected format.": "Die Interaktionen dieses Benutzers konnten nicht abgerufen werden: Die erhaltene Antwort war nicht im erwarteten Format.",
        "Could not retrieve interactions related to this element: The response received was not in the expected format.": "Die Interaktionen für dieses Element konnten nicht abgerufen werden: Die erhaltene Antwort war nicht im erwarteten Format.",
        "Could not retrieve loadfile": "Der Loadfile konnte nicht abgerufen werden",
        "Could not retrieve news items related to this element: The response received was not in the expected format.": "Die Newsfeed-Einträge für dieses Element konnten nicht abgerufen werden: Die erhaltene Antwort war nicht im erwarteten Format.",
        "Could not retrieve the newsfeed items: The response received was not in the expected format.": "Die Newsfeed-Einträge konnten nicht abgerufen werden: Die erhaltene Antwort war nicht im erwarteten Format.",
        "Could not retrieve the subscriptions: The response received was not in the expected format.": "Die Abonnements konnten nicht abgerufen werden: Die erhaltene Antwort war nicht im erwarteten Format.",
        "Create Loadfile": "Loadfile erstellen",
        Created: "Erstellt",
        "Created at:": "Erstellt am:",
        Creating: "Erstelle",
        "Current status:": "Aktueller Status:",
        "Custom Color": "Farbe",
        "Custom colors for chart groups:": "Spezifische Farben für ausgewählte Gruppen:",
        "Data not in expected format.": "Daten nicht im erwarteten Format.",
        "Datafile URL:": "URL zum Abruf der Quelldaten:",
        "Datafile identifier:": "Kennzeichen der Quelldatendefinition:",
        "Datafile with source data:": "Kennzeichen der Quelldatendefinition:",
        Date: "Datum",
        "Decrease formatting rule in priority": "Priorität der Formatierungsregel reduzieren",
        "Delete Note": "Notiz löschen",
        "Delete Note Everywere": "Notiz global löschen",
        "Delete datafile definition": "Quelldatendefinition löschen",
        "Delete this audit form": "Dieses Audit-Formular löschen",
        "Deleted Risk": "Gelöschtes Risiko",
        Deleting: "Löschen",
        "Deleting lookup fields on": "Lookup-Felder werden gelöscht auf",
        "Description for this risk category (will be displayed in notifications):": "Beschreibung dieser Risikokategorie (wird in Benachrichtigungen angezeigt):",
        Details: "Details",
        "Details / Sign-offs": "Details / Abzeichnen",
        "Display Name": "Angezeigter Name",
        "Display notes for keyword IDs (one entry per line):": "Notizen für folgende Stichwort-IDs anzeigen (ein Eintrag pro Zeile):",
        "Display search bar": "Suchfunktion einblenden",
        "Display width": "Breite",
        "Displayed Description": "Beschreibung",
        "Do not show historic risks that are older than (in days):": "Keine historischen Risiken anzeigen, die (in Anzahl Tagen) älter sind als:",
        "Do you really want to delete this audit form?\n\nThis action cannot be undone.": "Sind Sie sicher, dass Sie dieses Audit-Formular löschen möchten?\n\nDieser Prozess kann nicht rückgängig gemacht werden.",
        "Do you really want to load additional data into this audit form?\n\nNOTE: Data loaded will overwrite existing values in the form.": "Wollen Sie wirklich zusätzliche Daten in dieses Audit-Formular laden?\n\nHINWEIS: Geladene Daten werden bestehende Werte im Formular überschreiben.",
        "Do you really want to update the status of this task?": "Sind Sie sicher, dass Sie den Status dieser Aufgabe aktualisieren möchten?",
        "Don't show add notes button": "Keinen Button einblenden",
        Done: "Erledigt",
        "Done By": "Erledigt",
        "Done.": "Fertig.",
        "Download Task as Excel": "Daten als Excel herunterladen",
        Draft: "Entwurf",
        "Drag and drop here to change order of dashboard elements": "Klicken und ziehen, um die Reihenfolge der Dashboard-Ansichten zu ändern",
        "Drag and drop to re-position element in tree": "Klicken und ziehen, um die Position des Elements im Baum zu ändern",
        Edit: "Editieren",
        "Effective date:": "Stichtag:",
        "Element Key": "Schlüssel",
        "Element type to be evaluated for this formatter:": "Elementtyp, das von diesem Formatieren ausgewertet wird:",
        "Enable ORA dashboard": "ORA-Dashboard aktivieren",
        Endpoint: "Endpoint",
        Error: "Fehler",
        "Error code": "Fehler-Code",
        "Error parsing data file format:": "Fehler beim Einlesen des Datenformats:",
        "Error retrieving dashboard view: Supplied dashboard ID is invalid.": "Fehler beim Einlesen der Dashboard-Ansicht: Die angegebene Dashboard-ID ist ungültig.",
        "Error while obtaining task items.": "Fehler beim Abrufen der Aufgabenelemente.",
        Export: "Export",
        "Export SharePoint lists in loadfile format": "SharePoint-Listen im Loadfile-Format exportieren",
        "Export results with details": "Ergebnisse mit Details exportieren",
        "Exporting lists into loadfile ({{currList}} / {{totalLists}})...": "Exportiere Loadfile-Vorgänge ({{currOperation}} / {{totalOperations}})…",
        "Field to show": "Anzuzeigendes Feld",
        "Filter notes": "Notizen filtern",
        Final: "Final",
        Format: "Format",
        "Formatting Rules": "Formatierungsregeln",
        "Found operation without valid _action. See console for details.": "Vorgang ohne gültige _action gefunden. Siehe Konsole für Details.",
        "Freeze Risks": "Risiken einfrieren",
        "Freezing...": "Einfrieren…",
        "Getting loadfile from URL": "Loadfile wird via URL abgerufen",
        "Getting loadfile from uploaded file.": "Loadfile wird aus der hochgeladenen Datei eingelesen.",
        "Give feedback": "Feedback geben",
        "Group Text": "Gruppenbezeichnung",
        HTML: "HTML",
        "HTML code to be displayed:": "Einzublendender HTML-Code:",
        "HTML to be displayed:": "Einzublendender HTML-Code:",
        "Height of the IFrame:": "Höhe des IFrames:",
        "Height of the graphical element view:": "Höhe der grafischen Elementsicht:",
        Help: "Hilfe",
        "Help text for this dashboard element (leave empty for no help):": "Hinweistext für dieses Dashboard-Element (leerlassen falls nicht gewünscht):",
        "Hide details and sub-items": "Details und untergeordnete Elemente ausblenden",
        "Highest value for heatmap coloring (leave empty for no heatmap):": "“Höchste” Farbe für Heatmap-Färbung (leer falls keine Heatmap gewünscht):",
        "Highlight (!!!)": "Highlight (!!!)",
        "Highlight (!!)": "Highlight (!!)",
        "Highlight (!)": "Highlight (!)",
        "Highlighted (!!!)": "Als Highlight markiert (!!!)",
        "Highlighted (!!)": "Als Highlight markiert (!!)",
        "Highlighted (!)": "Als Highlight markiert (!)",
        Home: "Hauptseite",
        "I am aware that this action has the potential to modify a large part of Dashboard data, destroying existing work, and cannot be undone.": "Mir ist bewusst, dass dieser Vorgang möglicherweise einen grossen Teil der Dashboard-Daten verändert, bestehende Arbeit zerstört und nicht rückgängig gemacht werden kann.",
        "IFrame URL to be embedded:": "URL, die im IFrame eingebettet werden soll:",
        "Icon URL for this view:": "URL des Icons für diese Ansicht:",
        "Identifier for risks to be displayed:": "Kennzeichen für die einzublendenden Risiken:",
        "If you want to show impacts for a given risk, you also need to specify its risk category.": "Um die Impacts für ein bestimmtes Risiko auszuwerten muss auch eine Risikokategorie erfasst sein.",
        "Impactful note": "Notiz mit Impact",
        "Impactful note you are watching": "Beobachtete Notiz mit Impact",
        "Impacts that are not attached to a specific risk": "Impacts, die keinem spezifischen Risiko zugeordnet sind",
        "Increase formatting rule in priority": "Priorität der Formatierungsregel erhöhen",
        "Invert?": "Umkehren?",
        "Is Key": "Schlüssel",
        "Item No Longer Being Watched": "Element wird nicht mehr beobachtet",
        "Iterate training": "Trainingsschritt ausführen",
        "Jump to source": "Zur Quelle springen",
        "Jump to source.": "Zur Quelle springen.",
        "Just Unlink Keywords": "Nur Stichwörter entfernen",
        "Key for this element:": "Schlüssel für dieses Element:",
        Keyword: "Stichwort",
        Keywords: "Stichwörter",
        "Label for the x axis:": "X-Achsen-Beschriftung:",
        "Label for the y axis:": "Y-Achsen-Beschriftung:",
        "Labels for the x axis of the risk matrix (one entry per line):": "Beschriftungen der X-Achse der Risikomatrix (ein Eintrag pro Zeile):",
        "Labels for the y axis of the risk matrix (one entry per line):": "Beschriftungen der Y-Achse der Risikomatrix (ein Eintrag pro Zeile):",
        Language: "Sprache",
        "Last Month": "Letzter Monat",
        "Last Week": "Letzte Woche",
        "Last modified at:": "Zuletzt geändert am:",
        "Last modified by {{note.lastAuthor}} at\n                    {{note.lastModifiedDate | date: 'yyyy-MM-dd HH:mm'}}.": "Zuletzt geändert von {{note.lastAuthor}} um {{note.lastModifiedDate | date: 'dd.MM.yyyy HH:mm'}}.",
        "Last modified by:": "Zuletzt geändert von:",
        "Legend width (zero or empty for default):": "Breite der Legende (null oder leer für Standardwert):",
        "Limit number of notes to:": "Anzahl Notizen limitieren auf:",
        "List field list is not in expected format.": "Angaben zu den Listenfeldern sind nicht im erwarteten Format.",
        "Lists used as Dashboard Endpoints": "Als Dashboard Endpoints genutzte Listen",
        "Load Loadfile": "Loadfile laden",
        "Load Results from Excel:": "Resultate aus Excel laden:",
        "Load additional data": "Zusätzliche Daten laden",
        "Load loadfiles into SharePoint database": "Loadfiles in die SharePoint-Datenbank laden",
        "Load more": "Weiter",
        "Load more notes": "Weitere Notizen laden",
        "Loadfile URL (if stored on SharePoint):": "Loadfile URL (im SharePoint abgelegt):",
        "Loadfile files (if stored on your computer):": "Loadfile-Datei (auf lokalem Computer abgelegt):",
        "Loading Audit Universe...": "Audit Universe wird geladen...",
        "Loading OCA data...": "OCA-Daten werden geladen…",
        "Loading OCA tasks...": "OCA-Aufgaben werden geladen…",
        "Loading audit form...": "Audit-Formular wird geladen...",
        "Loading dashboard elements...": "Dashboard-Elemente werden geladen…",
        "Loading datafile definition...": "Quelldatendefinition wird geladen...",
        "Loading elements...": "Elemente werden geladen...",
        "Loading metadata...": "Metadaten werden geladen…",
        "Loading notes...": "Notizen werden geladen...",
        "Loading risk tracker...": "Risiko-Tracker wird geladen…",
        "Loading your profile...": "Ihr Profil wird geladen…",
        "Loading...": "Lädt…",
        "Lowest value for heatmap coloring (leave empty for no heatmap):": "“Niedrigste” Farbe für Heatmap-Färbung (leer falls keine Heatmap gewünscht):",
        "Manage Datafiles": "Quelldatendefinitionen verwalten",
        "Map objects": "Objekte zuordnen",
        "Mapping key:": "Zuordnungsschlüssel:",
        "Mark feedback as negative (This annoys me!)": "Feedback als negativ kennzeichen (Das nervt mich!)",
        "Mark feedback as positive (I like this!)": "Feedback als positiv kennzeichen (Mir gefällt das!)",
        Match: "Zuordnen",
        'Maximum four lines. You can use <code ng-non-bindable="">{{columname}}</code> as placeholder, which will be replaced with the content of the column <code>columname</code> for the item the user is moving the mouse over.': "Maximal vier Zeilen. Platzhalter der Form <code ng-non-bindable>{{Spaltenname}}</code> werden mit dem Inhalt der Spalte <code>Spaltenname</code> für das jeweilige von der Maus überfahrene Element ersetzt.",
        "Maximum four lines. You can use <code>{{columname}}</code> as placeholder, which will be replaced with the content of the column <code>columname</code> for the item the user is moving the mouse over.": "Maximal vier Zeilen. Platzhalter der Form <code>{{Spaltenname}}</code> werden mit dem Inhalt der Spalte <code>Spaltenname</code> für das jeweilige von der Maus überfahrene Element ersetzt.",
        "Maximum size for circles (in pixel):": "Maximalgrösse für die Blasen (in Pixeln):",
        Mentioned: "Erwähnt",
        "Mentioned in": "Erwähnt in",
        Modified: "Geändert",
        "Modified By": "Geändert von",
        "Modify Audit Universe": "Audit Universe bearbeiten",
        "Modify Dashboard Views": "Dashboard-Ansichten ändern",
        "More...": "Mehr...",
        "Move column down (=to the right in the table)": "Spalte nach unten schieben (=nach rechts in der Tabelle)",
        "Move column down (changes order in charts etc.)": "Spalte nach unten verschieben (ändert die Reihenfolge in den Charts etc.)",
        "Move column up (=to the left in the table)": "Spalte nach oben verschieben (=nach links in der Tabelle)",
        "Move column up (changes order in charts etc.)": "Spalte nach oben verschieben (ändert die Reihenfolge in den Charts etc.)",
        "Move element down": "Element nach unten verschieben",
        "Move element up": "Element nach oben verschieben",
        "Move icon for view further down": "Icon für diese Ansicht nach unten verschieben",
        "Move icon for view further up": "Icon für diese Ansicht nach oben verschieben",
        "Move loadfile down to load later": "Loadfile nach unten schieben, damit es später geladen wird",
        "Move loadfile up to load earlier": "Loadfile nach oben schieben, damit es früher geladen wird",
        "Move object table down (=to the right in view)": "Objekttabelle nach unten verschieben (=nach rechts in der Ansicht)",
        "Move object table up (=to the left in view)": "Objekttabelle nach oben verschieben (=nach links in der Ansicht)",
        "Moving average shown by default:": "Standardmässig gewählter Moving Average:",
        NEW: "NEU",
        "Name for this view:": "Name der Ansicht:",
        New: "Neu",
        "New Comment": "Neuer Kommentar",
        "New Description": "Neue Beschreibung",
        "New Highlight (!!!)": "Neues Highlight (!!!)",
        "New Highlight (!!)": "Neues Highlight (!!)",
        "New Highlight (!)": "Neues Highlight (!)",
        "New Impact": "Neuer Impact",
        "New Item Being Watched": "Element wird neu beobachtet",
        "New Newsfeed Entry": "Neuer Newsfeed-Eintrag",
        "New Note": "Neue Notiz",
        "New Risk": "Neues Risiko",
        "New Risk Created": "Neues Risiko erstellt",
        "New Status": "Neuer Status",
        "New Title": "Neuer Titel",
        "New comment": "Neuer Kommentar",
        "New node": "Neues Element",
        "New sub-item for {{data.title}}": "Neues Unterelement für {{data.title}}",
        "Newly watching": "Neu beobachtet",
        No: "Nein",
        "No longer active risks": "Nicht mehr aktive Risiken",
        "No longer watching": "Nicht mehr beobachtet",
        "No valid risk category has been specified.": "Es wurde keine gültige Risikokategorie angegeben.",
        Note: "Notiz",
        'Note that you are not authorized to edit The Dashboard\'s configuration, which means that most functions below will not work for you. Please make sure that you have edit rights on the "The Dashboard - Configuration" list before you proceed.': "Sie sind nicht befugt, die Dashboard-Konfiguration zu ändern. Die meisten Funktionen werden deswegen nicht funktionieren. Bitte stellen Sie vor dem Zugriff auf die Administration sicher, dass Sie über Schreibrechte auf die SharePoint-Liste “The Dashboard - Configuration” verfügen.",
        Notes: "Notizen",
        "Notes for a specific keyword": "Notizen für ein spezifisches Stichwort",
        "Notes for {{ngDialogData.sourceName}}": "Notizen für {{ngDialogData.sourceName}}",
        "Now we can delete the": "Jetzt löschen wir",
        OCA: "OCA",
        "OCA Task Status Has Been Changed": "OCA-Task-Status hat sich geändert",
        "OCA task": "OCA-Task",
        "Object Explorer": "Objekt-Explorer",
        "Object types to be displayed:": "Anzuzeigende Objekttypen:",
        Older: "Älter",
        "Ongoing Control Assessment": "Ongoing Control Assessment",
        "Ongoing Risk Assessment": "Ongoing Risk Assessment",
        "Only reviewed tasks can be archived.": "Nur überprüfte Tasks können archiviert werden.",
        Open: "Offen",
        "Opening loadfile...": "Loadfile öffnen…",
        "Other SharePoint Lists to be Exported": "Andere zu exportierende SharePoint-Listen",
        "Please complete all the required fields prior to saving.": "Bitte vor dem Speichern alle Pflichtfelder vervollständigen.",
        "Please save your audit form first before you try to update the workflow status.": "Bitte speichern Sie dieses Audit-Formular bevor Sie den Workflow-Status aktualisieren.",
        "Please select a valid language you want The Dashboard to be displayed in!": "Bitte wählen Sie eine gültige Sprache aus, in der das Dashboard angezeigt werden soll!",
        "Please select an element above.": "Bitte wählen Sie oben ein Element aus.",
        "Please select the source which you want to load.": "Bitte wählen Sie die Quelle aus, die Sie einlesen möchten.",
        "Please specify a valid URL for the loadfile to be used.": "Bitte wählen Sie eine gültige Sprache aus, in der das Dashboard angezeigt werden soll.",
        "Portfolio Chart": "Portfoliodiagramm",
        "Print View": "Druckansicht",
        "Process View": "Prozesssicht",
        "Processing loadfile operations ({{currOperation}} / {{totalOperations}})...": "Verarbeite Loadfile-Vorgänge ({{currOperation}} / {{totalOperations}})…",
        Profile: "Profil",
        Remove: "Entfernen",
        "Remove column": "Spalte entfernen",
        "Remove column definition": "Spaltendefinition entfernen",
        "Remove comment": "Kommentar entfernen",
        "Remove conditional format": "Bedingte Formatierung entfernen",
        "Remove dashboard element": "Dashboard-Element entfernen",
        "Remove element": "Element entfernen",
        "Remove formatting rule": "Formatierungsregel entfernen",
        "Remove impact": "Impact entfernen",
        "Remove list from export selection": "Liste von der Exportauswahl entfernen",
        "Remove loadfile from load list": "Loadfile aus der Liste der einzulesenden Loadfiles entfernen",
        "Remove new tree element": "Neues Baumelement entfernen",
        "Remove note": "Diese Notiz entfernen",
        "Remove object table": "Objekttabelle entfernen",
        "Remove risk": "Risiko entfernen",
        "Remove this note": "Diese Notiz entfernen",
        "Remove view": "Diese Ansicht entfernen",
        "Removing field": "Entferne Feld",
        Restore: "Wiederherstellen",
        "Restore dashboard element": "Dieses Dashboard-Element entfernen",
        "Restore impact": "Diesen Impact entfernen",
        "Returned SharePoint result is not in the expected format.": "Zurückgeliefertes SharePoint-Ergebnis ist nicht im erwarteten Format.",
        Reviewed: "Überprüft",
        "Reviewed By": "Überprüft von",
        Risk: "Risiko",
        "Risk Has Been Removed": "Risiko wurde entfernt",
        "Risk Tracker Matrix": "Risiko-Matrix",
        "Risk category you are watching": "Beobachtete Risikokategorie",
        "Risk you are watching": "Beobachtetes Risiko",
        "Row height of table:": "Zeilenhöhe der Tabelle:",
        Rule: "Regel",
        Save: "Speichern",
        "Save Risks": "Risiken speichern",
        "Save and close": "Speichern und schliessen",
        "Save and continue": "Speichern und fortfahren",
        "Save changes": "Änderungen speichern",
        "Save changes to Audit Universe": "Änderungen am Audit Universe speichern",
        "Save changes to dashboard elements": "Änderungen an den Dashboard-Elementen speichern",
        "Save changes to datafiles definition": "Änderungen an der Datafile-Definition speichern",
        "Save data": "Speichern",
        "Save results": "Ergebnisse speichern",
        "Saving your changes...": "Änderungen werden gespeichert…",
        "Saving...": "Speichern…",
        "Saving... Please wait.": "Speichern... Bitte warten.",
        "Scale areas to 100% (relative) view": "Flächen auf 100% skalieren (relative Darstellung)",
        "Scatterplot Chart": "Blasen-Streudiagramm",
        "Searching lookup fields on": "Lookup-Felder werden gesucht",
        "Send Feedback": "Feedback abschicken",
        "Set by...": "Gesetzt durch…",
        "SharePoint List Title": "SharePoint-Listen-Titel",
        "SharePoint List URL": "SharePoint-Listen-URL",
        "Short text for tab:": "Kurztext für Lasche:",
        "Show button at bottom": "Unten einblenden",
        "Show button at top": "Oben einblenden",
        "Show button to add new notes:": "Button zum Hinzufügen von Notizen anzeigen:",
        "Show details and sub-items": "Details und untergeordnete Elemente einblenden",
        "Show frozen risks": "Eingefrorene Risiken zeigen",
        "Show impact flags tagged to these risks": "Impacts für diese Risiken anzeigen",
        "Show notes only with the following status types (ctrl-click to select multiple):": "Nur Notizen mit den folgenden Stati anzeigen (mehrere mit Ctrl+Klick auswählen):",
        "Show only active nodes": "Nur aktive Elemente zeigen",
        "Show only bars that match these values (one entry per line, empty for all available bars):": "Nur Balken anzeigen, die diesen Werten entsprechen (ein Eintrag pro Zeile, leer für alle Balken):",
        "Show relevant impacts": "Relevante Impacts anzeigen",
        "Show risks from this category for impact flags (leave empty if no risks should be assigned):": "Risiken aus der folgenden Risikokategorie für die Impact-Erfassung anzeigen (leer = es können keine Risiken zugeordnet werden):",
        "Show sparklines at the bottom of the table (summarizing over all lines)": "Sparklines unterhalb der Tabelle anzeigen (die alle Zeilen zusammenfassen)",
        "Show sparklines to the right of the table (summarizing over all columns)": "Sparklines rechts von der Tabelle anzeigen (die alle Spalten zusammenfassen)",
        "Show the following additional columns on the table:": "Folgende weitere Spalten in der Tabelle anzeigen:",
        "Show the following columns as area chart elements:": "Folgende Spalten als Flächendiagrammelemente darstellen:",
        "Show the following columns as chart elements (individual blocks on each bar):": "Folgende Spalten als Diagrammelemente anzeigen (einzelne Blöcke innerhalb der Balken):",
        "Show the following columns as line chart elements:": "Folgende Spalten als Liniendiagrammelemente darstellen:",
        "Skipping addEntry because neither endpoint nor listTitle has been specified. See console for details.": "Überspringe addEntry, da weder endpoint noch listTitle spezifiziert wurden. Siehe Konsole für Details.",
        "Skipping addFile because no endpoint has been specified. See console for details.": "Überspringe addFile, da kein endpoint spezifiziert wurde. Siehe Konsole für Details.",
        "Skipping changeEntry because neither endpoint nor listTitle has been specified. See console for details.": "Überspringe changeEntry, da weder endpoint noch listTitle spezifiziert wurden. Siehe Konsole für Details.",
        "Skipping changeEntry because no searchQuery has been specified. See console for details.": "Überspringe changeEntry, da kein searchQuery angegeben wurde. Siehe Konsole für Details.",
        "Skipping changeField because not all required values (Title, FieldTitle, field) have been specified. See console for details.": "Überspringe changeField, da nicht alle benötigten Werte (Title, fieldTitle, Field) angegeben wurden. Siehe Konsole für Details.",
        "Skipping removeEntry because neither endpoint nor listTitle has been specified. See console for details.": "Überspringe removeEntry, da weder endpoint noch listTitle spezifiziert wurden. Siehe Konsole für Details.",
        "Skipping removeEntry because no searchQuery has been specified. See console for details.": "Überspringe removeEntry, da kein searchQuery angegeben wurde. Siehe Konsole für Details.",
        "Source Column": "Quellspalte",
        "Sparkline range should be determined based over all table entries (if not ticked, sparklines will be scaled individually per row)": "Skalierung der Sparklines (maximale und minimale Werte) auf Basis aller Tabelleneinträge ermitteln  (falls nicht gesetzt wird die Sparkline nur über ihre eigene Zeile skaliert)",
        "Specified task ID is invalid.": "Die angegebene Task ID ist ungültig.",
        "Stacked Bar Chart": "Stapelbalkendiagramm",
        "Static Text": "Statischer Text",
        Status: "Status",
        "Status code": "Status-Code",
        "Stop animation": "Animation anhalten",
        "Stop watching": "Nicht mehr beobachten",
        "Stopped watching": "Nicht mehr beobachtet",
        "Style to be applied if formatting matches:": "Anzuwendender Stil, wenn die Regeln erfüllt sind:",
        "Subscribed to": "Abonniert auf",
        "System Administration": "Systemadministration",
        "Tab Divider": "Laschentrenner",
        "Tab ID for the URL:": "Tab ID (für die URL):",
        Table: "Tabelle",
        "Table(s) of objects": "Objekttabelle(n)",
        "Tables to be displayed": "Einzublendende Tabellen",
        Task: "OCA-Task",
        "Task status changed": "OCA-Task-Status hat sich geändert",
        "Template for the tooltip to be displayed:": "Vorlage für das anzuzeigende Mouseover-Fenster:",
        "The data returned from the server while trying to retrieve audit forms was not in the expected format.": "Die vom Server zurückgelieferte Antwort beim Abrufen der Audit-Formulare war nicht im erwarteten Format.",
        "The datafile definition has been removed.": "Die Quelldatendefinition wurde entfernt.",
        "The datafile definition you are trying to change is not valid.": "Die Quelldatendefinition, die Sie ändern möchten, ist ungültig.",
        "The datafile has successfully been updated in the database.": "Die Quelldatendefinition wurde in der Datenbank aktualisiert.",
        "The datafile you are trying to add is not valid.": "Die Quelldatendefinition, die Sie hinzufügen möchten, ist ungültig.",
        "The file": "Die Datei",
        "The new datafile has successfully been stored in the database.": "Die neue Quelldatendefinition wurde erfolgreich in der Datenbank gespeichert.",
        "The node you are trying to add is not valid. Please complete its title.": "Der Knoten, den Sie hinzufügen wollen, ist ungültig. Bitte vervollständigen Sie den Titel.",
        "The node you are trying to update is not valid. Please ensure it contains an ID and complete its title.": "Der Knoten, den Sie ändern möchten, ist ungültig. Bitte vervollständigen Sie den Titel und stellen Sie sicher, dass der Knoten eine gültige ID hat.",
        "The response from the server when trying to add the mapping was invalid!": "Die Antwort des Servers beim Versuch, das Mapping hinzuzufügen, war ungültig!",
        "The response from the server when trying to retrieve the mapping was invalid!": "Die Antwort des Servers beim Versuch, das Mapping abzurufen, war ungültig!",
        "The result data has been successfully loaded into the current view.": "Die Resultate wurden erfolgreich in die Ansicht geladen.",
        "The retrieved task item was not in the expected format.": "Das abgerufene Aufgabenobjekt war nicht im erwarteten Format.",
        "The risk you are trying to add is not valid. Please complete title, description and select risk ratings.": "Das Risiko, das Sie hinzufügen möchten, ist ungültig. Bitte vervollständigen Sie den Titel, die Beschreibung und nehmen Sie die Risikoeinstufung vor.",
        "The risk you are trying to freeze is not valid. Please complete title, description and select risk ratings.": "Das Risiko, das Sie einfrieren möchten, ist ungültig. Bitte vervollständigen Sie den Titel, die Beschreibung und nehmen Sie die Risikoeinstufung vor.",
        "The risk you are trying to update is not valid. Please complete title, description and select risk ratings.": "Das Risiko, das Sie aktualisieren möchten, ist ungültig. Bitte vervollständigen Sie den Titel, die Beschreibung und nehmen Sie die Risikoeinstufung vor.",
        "The source data has successfully been loaded.": "Die Quelldaten wurden erfolgreich geladen.",
        "The task does not contain a deferred file retrieval URI.": "Die Aufgabe enthält keine verzögerte Dateiabruf-URI.",
        "The task has been archived.": "Die Aufgabe wurde archiviert.",
        "The view element you are trying to add is not valid. Please complete its title.": "Das Dashboard-Element, das Sie hinzufügen möchten, ist ungültig. Bitte vervollständigen Sie den Titel.",
        "The view element you are trying to change is not valid. Please complete its title.": "Das Dashboard-Element, das Sie ändern möchten, ist ungültig. Bitte vervollständigen Sie den Titel.",
        "This Month": "Dieser Monat",
        "This Week": "Diese Woche",
        "This feature only accepts Excel XLSX files. It looks like your file has a different format. Are you sure you want to continue anyways?": "Diese Funktion akzeptiert nur Excel XLSX-Dateien. Es scheint, dass diese Datei ein anderes Format hat. Sind Sie sicher, dass Sie trotzdem fortfahren möchten?",
        "This is the Ongoing Risk Assessment for <b>{{dashboardName}}</b>.": "Das Ongoing Risk Assessment für <b>{{dashboardName}}</b>.",
        "This is your personal <b>profile</b>. Here you can modify how you want The Dashboard to work specifically for you.": "Dies ist Ihr persönliches <b>Profil</b>. Sie können hier The Dashboard gemäss Ihren individuellen Wünschen anpassen.",
        "This keyword is fixed.": "Dieses Stichwort ist fixiert.",
        "This note is linked to other keywords than the one for this view. It may thus also be displayed elsewhere in the Dashboard. Do you want to remove the note globally from the database or do you just want to unlink the keywords so that it will no longer be displayed here?": "Diese Notiz ist mit Stichwörtern für andere Ansichten verknüpft. Die Notiz wird möglicherweise also auch anderswo im Dashboard verwendet. Wollen Sie diese Notiz global aus der Datenbank löschen oder nur die Stichwörter entfernen, die bewirken, dass die Notiz auf dieser Ansicht dargestellt wird?",
        "Time Series Chart": "Zeitreihe",
        Title: "Titel",
        "Title of table:": "Titel der Tabelle:",
        Today: "Heute",
        "Tree element was not found in tree.": "Das Element kann im Hierarchiebaum nicht gefunden werden.",
        "Type of graphical view for the defined elements:": "Typ der grafischen Ansicht für die definierten Elemente:",
        "Type of view:": "Typ der Ansicht:",
        "Unexpected response from server.": "Unerwartete Antwort vom Server.",
        "Update all elements": "Alle Elemente aktualisieren",
        "Update sort": "Sortierung aktualisieren",
        "Update workflow status to:": "Workflow-Status aktualisieren:",
        "Use different axes for line and area elements": "Unterschiedliche Achsen für Linien- und Flächenelemente verwenden",
        "Watch this risk matrix:": "Diese Risikomatrix beobachten:",
        Watching: "Beobachtet",
        "We could not find a matching entry in the data source for this audit form. Nothing has been loaded.": "Wir konnten für dieses Audit-Formular keinen passenden Eintrag in der Datenquelle finden. Es wurden keine Daten geladen.",
        'We could not retrieve your user status. Most likely this means that you have not yet initialized the base lists used by The Dashboard. If you have site admin rights on your SharePoint site, you can initialize them now by using the "Initialize SharePoint for use with Dashboard" function below.': "Das System konnte Ihren Nutzerstatus nicht abfragen. Wahrscheinlich haben Sie die Basislisten für die Nutzung von The Dashboard noch nicht initialisiert. Falls Sie über Administrationsrechte auf dieser SharePoint-Site verfügen, können Sie die Basislisten jetzt initialisieren indem Sie die Funktion “Initialisiere SharePoint für Dashboard” unten nutzen.",
        "We suggest reloading the page to obtain the clean state from the database and to try again.": "Bitte laden Sie die Seite neu, um einen sauberen Datensatz aus der Datenbank zu laden. Versuchen Sie es anschliessend erneut.",
        "We suggest reloading the page to obtain the state currently saved in the database and to try again afterwards.": "Bitte laden Sie die Seite neu, um  den aktuellen Stand der Daten aus der Datenbank zu laden. Versuchen Sie es anschliessend erneut.",
        "Welcome to The Dashboard. Please select the Continuous Assurance module you want to use on the navigation bar at the top of this page.": "Herzlich Willkommen im Dashboard. Bitte wählen Sie oben in der Navigationsleiste das Continuous-Assurance-Modul, das Sie nutzen möchten.",
        "Welcome to our <b>Ongoing Risk Assessment</b>. Please navigate our audit universe below to access our risk dashboards.": "Willkommen in unserem <b>Ongoing Risk Assessment</b>. Das Audit Universe unten führt zu den einzelnen Risiko-Dashboards.",
        "Welcome to the <b>Ongoing Control Assessment</b>. Please select the Ongoing Control Assessment task below that you want to view or work on.": "Willkommen in unserem <b>Ongoing Control Assessment</b>. Unten finden sich alle verfügbaren Ongoing-Control-Assessment-Aufgaben.",
        "While trying to load the task results the data returned was not in the expected format!": "Beim Versuch, die Aufgabenresultate zu laden, wurden vom Server Daten in einem unerwartetem Format zurückgeliefert!",
        "Width for each table:": "Breite für jede einzelne Tabelle:",
        "Width of the IFrame:": "Breite des IFrames:",
        "Width of the object explorer area:": "Breite des Objekt-Explorers:",
        'X axis description (e.g. "Likelihood"):': "Beschreibung der X-Achse (bspw. “Wahrscheinlichkeit”):",
        'Y axis description (e.g. "Impact"):': "Beschreibung der Y-Achse (bspw. “Auswirkung”):",
        "Y-axis for lines should always start between (leave empty for full auto-sizing):": "Die Y-Achse für die Liniengrafik soll begrenzt werden durch (leer für vollautomatische Achsengrösse):",
        "Y-axis should always go to between": "Die Y-Achse soll immer enden zwischen",
        "Y-axis should always start between": "Die Y-Achse soll immer beginnen zwischen",
        Yes: "Ja",
        Yesterday: "Gestern",
        "You Are Being Mentioned": "Neue Erwähnung",
        "You are viewing the OCA task archive.": "Dies ist das Archiv mit den bereits archivierten OCA-Aufgaben.",
        "You can only make changes to audit forms added directly on the given task element and you can never save changes to audit forms if their underlying source is read-only (e.g. in reviewed state or archived).": "Audit-Formulare können nur editiert werden, wenn sie direkt vom Task-Eintrag, an dem sie erstellt wurden, geöffnet werden. Ausserdem können keine Änderungen am Audit-Formular gespeichert werden, wenn die zugrundeliegende Quelle schreibgeschützt ist (bspw. im Status “überprüft” oder archiviert).",
        "You can only remove nodes that are not yet stored in the database.": "Sie können nur noch nicht in der Datenbank gespeicherte Knoten entfernen.",
        "You cannot remove nodes that have active children. Remove or re-arrange the children first.": "Sie können keine Knoten mit Sub-Knoten entfernen. Bitte verschieben oder entfernen Sie zuerst die Sub-Knoten.",
        "You cannot remove the keyword that binds this note to this dashboard.": "Das Keyword, das diese Notiz an dieses Dashboard bindet, kann nicht entfernt werden.",
        "You cannot save changes to audit forms which are in a workflow status Done, Reviewed or Archived. Please change the workflow status prior to making any changes.": "Sie können keine Änderungen an Audit-Formularen vornehmen, die bereits in den Workflow-Stati Erledigt, Überprüft oder Archiviert sind. Bitte ändern Sie zuerst den Workflow-Status, bevor Sie Änderungen vornehmen.",
        "You cannot submit an empty comment.": "Es kann kein leerer Kommentar erfasst werden.",
        "You do not have the necessary permissions to archive tasks. Please contact your administrator.": "Sie haben nicht die notwendigen Berechtigungen, um Aufgaben zu archivieren. Bitte kontaktieren Sie Ihren Administrator.",
        "You need edit rights to The Dashboard's configuration to be able to modify the Audit Universe.": "Sie benötigen Schreibrechte auf die Dashboard-Konfiguration um das Audit Universe editieren zu können.",
        "You need edit rights to The Dashboard's configuration to be able to modify the Dashboard Views.": "Sie benötigen Schreibrechte auf die Dashboard-Konfiguration um die Dashboard-Ansichten editieren zu können.",
        "You need edit rights to The Dashboard's configuration to be able to modify the datafile definitions.": "Sie benötigen Schreibrechte auf die Dashboard-Konfiguration um die Quelldatendefinitionen editieren zu können.",
        "You need site admin rights on SharePoint to be able to initialize the lists required by Dashboard.": "Sie benötigen Administrationsrechte auf diesem SharePoint um die für das Dashboard benötigten Listen zu initialisieren.",
        "You need to accept the warning before proceeding.": "Sie müssen die Warnung akzeptieren um fortzufahren.",
        "You need to correctly complete all required fields prior to saving this form.": "Sie müssen vor dem Speichern alle Pflichtfelder korrekt ausfüllen.",
        "You need to provide at least one loadfile to be processed.": "Sie müssen mindestens einen Loadfile zur Verarbeitung auswählen.",
        "You need to select an element first.": "Sie müssen zuerst ein Element auswählen.",
        "You need to select an element to which this object should be mapped.": "Sie müssen ein Element auswählen, dem dieses Objekt zugeordnet werden soll.",
        "You need to select at least one SharePoint list that should be used to create the loadfile.": "Sie müssen mindestens eine SharePoint-Liste auswählen, aus der ein Loadfile generiert werden soll.",
        "You need to select the view element type for the new element.": "Bitte wählen Sie zuerst die Art des gewünschten neuen Dashboard-Elements aus.",
        "You need to specify at least one column that will form the primary key for uniquely identifying entries in your datafile.": "Sie müssen mindestens eine Spalte als “Schlüssel” angeben, die den primären Schlüssel bilden wird um die Einträge in den Quelldaten eindeutig zu identifizieren.",
        "You need to specify the mapping key and object type for which you want to retrieve mapped objects.": "Sie müssen den Zuordnungsschlüssel und den Objekttyp auswählen, für den Sie die Objektzuordnungen abrufen möchten.",
        "You need to specify the object type for which you want to retrieve all objects.": "Sie müssen den Objekttyp angeben, für den Sie alle Objekte abrufen wollen.",
        "Your changes have been saved!": "Ihre Änderungen wurden gespeichert!",
        "Your feedback could not be stored. Please try again later or see the log for details.": "Ihr Feedback konnte nicht abgespeichert werden. Bitte versuchen Sie es später erneut oder überprüfen Sie das Log für Details.",
        "Your feedback has been stored and we will get in touch soon.": "Ihr Feedback wurde gespeichert und wir melden uns in Kürze.",
        and: "und",
        "click to unsubscribe": "Klicken zum Kündigen des Abonnements",
        contains: "enthält",
        "could not be retrieved.": "konnte nicht abgerufen werden.",
        elements: "Elemente",
        equals: "ist",
        from: "von",
        'has <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">posted</a> a': '<a href="{{ absoluteUrl }}{{ item.sourceUrl }}">setzte</a> ein',
        'has <a href="{{ item.sourceUrl }}">posted</a> a': '<a href="{{ item.sourceUrl }}">setzte</a> ein',
        'has added <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">a new comment</a>.': 'hat <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">einen neuen Kommentar</a> erfasst.',
        'has added <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">a new impact</a>.': 'hat <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">einen neuen Impact</a> erfasst.',
        'has added <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">a new risk</a>.': 'hat <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">ein neues Risiko</a> hinzugefügt.',
        'has added <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">a new {{ item.sourceType | elementTypeToText | translate }}</a>.': 'hat ein <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">neues Element</a> vom Typ {{ item.sourceType | elementTypeToText | translate }} hinzugefügt.',
        'has added <a href="{{ item.sourceUrl }}">a new comment</a>.': 'hat <a href="{{ item.sourceUrl }}">einen neuen Kommentar</a> erfasst.',
        'has added <a href="{{ item.sourceUrl }}">a new impact</a>.': 'hat <a href="{{ item.sourceUrl }}">einen neuen Impact</a> erfasst.',
        'has added <a href="{{ item.sourceUrl }}">a new risk</a>.': 'hat <a href="{{ item.sourceUrl }}">ein neues Risiko</a> hinzugefügt.',
        'has added <a href="{{ item.sourceUrl }}">a new {{ item.sourceType | elementTypeToText | translate }}</a>.': 'hat ein <a href="{{ item.sourceUrl }}">neues Element</a> vom Typ {{ item.sourceType | elementTypeToText | translate }} hinzugefügt.',
        'has changed <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">a risk entry</a>.': 'hat <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">ein Risiko</a> editiert.',
        'has changed <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">a risk</a> you are watching.': 'hat <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">ein beobachtetes Risiko</a> geändert.',
        'has changed <a href="{{ item.sourceUrl }}">a risk entry</a>.': 'hat <a href="{{ item.sourceUrl }}">ein Risiko</a> editiert.',
        'has changed <a href="{{ item.sourceUrl }}">a risk</a> you are watching.': 'hat <a href="{{ item.sourceUrl }}">ein beobachtetes Risiko</a> geändert.',
        'has marked this item as <img class="interaction-icon" src="assets/icon-highlight1-full.png" alt="{{ \'Highlight (!)\' | translate }}">.': 'hat diesen Eintrag als <img class="interaction-icon" src="assets/icon-highlight1-full.png" alt="{{ \'Highlight (!)\' | translate }}">  markiert.',
        'has marked this item as <img class="interaction-icon" src="assets/icon-highlight2-full.png" alt="{{ \'Highlight (!!)\' | translate }}">.': 'hat diesen Eintrag als <img class="interaction-icon" src="assets/icon-highlight2-full.png" alt="{{ \'Highlight (!!)\' | translate }}"> markiert.',
        'has marked this item as <img class="interaction-icon" src="assets/icon-highlight3-full.png" alt="{{ \'Highlight (!!!)\' | translate }}">.': 'hat diesen Eintrag als <img class="interaction-icon" src="assets/icon-highlight3-full.png" alt="{{ \'Highlight (!!!)’ | translate }}"> markiert.',
        "has mentioned you.": "hat Sie erwähnt.",
        "has stopped watching this item.": "beobachtet dieses Element nicht mehr.",
        iFrame: "IFrame",
        "is no longer watching this item.": "beobachtet dieses Element nicht mehr.",
        "is not a valid JSON loadfile.": "ist kein gültiges JSON-Loadfile.",
        "is now watching this item.": "beobachtet dieses Element jetzt.",
        library: "Bibliothek",
        list: "Liste",
        "only letters, numbers, <code>-</code> and <code>_</code>": "nur Buchstaben, Zahlen, <code>-</code> und <code>_</code>",
        "risk from elsewhere": "Risiko aus anderem Bereich",
        "to library": "zur Bibliothek",
        "to list": "zur Liste",
        unknown: "unbekannt",
        'updated the status of <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">this OCA task</a>.': 'hat den Status <a href="{{ absoluteUrl }}{{ item.sourceUrl }}">dieses OCA-Tasks</a> aktualisiert.',
        'updated the status of <a href="{{ item.sourceUrl }}">this OCA task</a>.': 'hat den Status <a href="{{ item.sourceUrl }}">dieses OCA-Tasks</a> aktualisiert.',
        "{{movingAverageElements}}-points moving average": "{{movingAverageElements}}-Punkte gleitender Durchschnitt"
    });
} ]);