aurelia-bootstrap
Version:
Bootstrap components written in Aurelia.
1,244 lines (1,243 loc) • 87.1 kB
JavaScript
/* */
"format cjs";
(function(process) {
!function(t) {
if ("object" == typeof exports && "undefined" != typeof module)
module.exports = t();
else if ("function" == typeof define && define.amd)
define([], t);
else {
var e;
"undefined" != typeof window ? e = window : "undefined" != typeof global ? e = global : "undefined" != typeof self && (e = self), e.Promise = t();
}
}(function() {
var t,
e,
n;
return function r(t, e, n) {
function i(a, s) {
if (!e[a]) {
if (!t[a]) {
var c = "function" == typeof _dereq_ && _dereq_;
if (!s && c)
return c(a, !0);
if (o)
return o(a, !0);
var l = new Error("Cannot find module '" + a + "'");
throw l.code = "MODULE_NOT_FOUND", l;
}
var u = e[a] = {exports: {}};
t[a][0].call(u.exports, function(e) {
var n = t[a][1][e];
return i(n ? n : e);
}, u, u.exports, r, t, e, n);
}
return e[a].exports;
}
for (var o = "function" == typeof _dereq_ && _dereq_,
a = 0; a < n.length; a++)
i(n[a]);
return i;
}({
1: [function(t, e, n) {
"use strict";
function r() {
this._customScheduler = !1, this._isTickUsed = !1, this._lateQueue = new u(16), this._normalQueue = new u(16), this._haveDrainedQueues = !1, this._trampolineEnabled = !0;
var t = this;
this.drainQueues = function() {
t._drainQueues();
}, this._schedule = l;
}
function i(t, e, n) {
this._lateQueue.push(t, e, n), this._queueTick();
}
function o(t, e, n) {
this._normalQueue.push(t, e, n), this._queueTick();
}
function a(t) {
this._normalQueue._pushOne(t), this._queueTick();
}
var s;
try {
throw new Error;
} catch (c) {
s = c;
}
var l = t("./schedule"),
u = t("./queue"),
p = t("./util");
r.prototype.setScheduler = function(t) {
var e = this._schedule;
return this._schedule = t, this._customScheduler = !0, e;
}, r.prototype.hasCustomScheduler = function() {
return this._customScheduler;
}, r.prototype.enableTrampoline = function() {
this._trampolineEnabled = !0;
}, r.prototype.disableTrampolineIfNecessary = function() {
p.hasDevTools && (this._trampolineEnabled = !1);
}, r.prototype.haveItemsQueued = function() {
return this._isTickUsed || this._haveDrainedQueues;
}, r.prototype.fatalError = function(t, e) {
e ? (process.stderr.write("Fatal " + (t instanceof Error ? t.stack : t) + "\n"), process.exit(2)) : this.throwLater(t);
}, r.prototype.throwLater = function(t, e) {
if (1 === arguments.length && (e = t, t = function() {
throw e;
}), "undefined" != typeof setTimeout)
setTimeout(function() {
t(e);
}, 0);
else
try {
this._schedule(function() {
t(e);
});
} catch (n) {
throw new Error("No async scheduler available\n\n See http://goo.gl/MqrFmX\n");
}
}, p.hasDevTools ? (r.prototype.invokeLater = function(t, e, n) {
this._trampolineEnabled ? i.call(this, t, e, n) : this._schedule(function() {
setTimeout(function() {
t.call(e, n);
}, 100);
});
}, r.prototype.invoke = function(t, e, n) {
this._trampolineEnabled ? o.call(this, t, e, n) : this._schedule(function() {
t.call(e, n);
});
}, r.prototype.settlePromises = function(t) {
this._trampolineEnabled ? a.call(this, t) : this._schedule(function() {
t._settlePromises();
});
}) : (r.prototype.invokeLater = i, r.prototype.invoke = o, r.prototype.settlePromises = a), r.prototype.invokeFirst = function(t, e, n) {
this._normalQueue.unshift(t, e, n), this._queueTick();
}, r.prototype._drainQueue = function(t) {
for (; t.length() > 0; ) {
var e = t.shift();
if ("function" == typeof e) {
var n = t.shift(),
r = t.shift();
e.call(n, r);
} else
e._settlePromises();
}
}, r.prototype._drainQueues = function() {
this._drainQueue(this._normalQueue), this._reset(), this._haveDrainedQueues = !0, this._drainQueue(this._lateQueue);
}, r.prototype._queueTick = function() {
this._isTickUsed || (this._isTickUsed = !0, this._schedule(this.drainQueues));
}, r.prototype._reset = function() {
this._isTickUsed = !1;
}, e.exports = r, e.exports.firstLineError = s;
}, {
"./queue": 17,
"./schedule": 18,
"./util": 21
}],
2: [function(t, e, n) {
"use strict";
e.exports = function(t, e, n, r) {
var i = !1,
o = function(t, e) {
this._reject(e);
},
a = function(t, e) {
e.promiseRejectionQueued = !0, e.bindingPromise._then(o, o, null, this, t);
},
s = function(t, e) {
0 === (50397184 & this._bitField) && this._resolveCallback(e.target);
},
c = function(t, e) {
e.promiseRejectionQueued || this._reject(t);
};
t.prototype.bind = function(o) {
i || (i = !0, t.prototype._propagateFrom = r.propagateFromFunction(), t.prototype._boundValue = r.boundValueFunction());
var l = n(o),
u = new t(e);
u._propagateFrom(this, 1);
var p = this._target();
if (u._setBoundTo(l), l instanceof t) {
var f = {
promiseRejectionQueued: !1,
promise: u,
target: p,
bindingPromise: l
};
p._then(e, a, void 0, u, f), l._then(s, c, void 0, u, f), u._setOnCancel(l);
} else
u._resolveCallback(p);
return u;
}, t.prototype._setBoundTo = function(t) {
void 0 !== t ? (this._bitField = 2097152 | this._bitField, this._boundTo = t) : this._bitField = -2097153 & this._bitField;
}, t.prototype._isBound = function() {
return 2097152 === (2097152 & this._bitField);
}, t.bind = function(e, n) {
return t.resolve(n).bind(e);
};
};
}, {}],
3: [function(t, e, n) {
"use strict";
function r() {
try {
Promise === o && (Promise = i);
} catch (t) {}
return o;
}
var i;
"undefined" != typeof Promise && (i = Promise);
var o = t("./promise")();
o.noConflict = r, e.exports = o;
}, {"./promise": 15}],
4: [function(t, e, n) {
"use strict";
e.exports = function(e, n, r, i) {
var o = t("./util"),
a = o.tryCatch,
s = o.errorObj,
c = e._async;
e.prototype["break"] = e.prototype.cancel = function() {
if (!i.cancellation())
return this._warn("cancellation is disabled");
for (var t = this,
e = t; t.isCancellable(); ) {
if (!t._cancelBy(e)) {
e._isFollowing() ? e._followee().cancel() : e._cancelBranched();
break;
}
var n = t._cancellationParent;
if (null == n || !n.isCancellable()) {
t._isFollowing() ? t._followee().cancel() : t._cancelBranched();
break;
}
t._isFollowing() && t._followee().cancel(), e = t, t = n;
}
}, e.prototype._branchHasCancelled = function() {
this._branchesRemainingToCancel--;
}, e.prototype._enoughBranchesHaveCancelled = function() {
return void 0 === this._branchesRemainingToCancel || this._branchesRemainingToCancel <= 0;
}, e.prototype._cancelBy = function(t) {
return t === this ? (this._branchesRemainingToCancel = 0, this._invokeOnCancel(), !0) : (this._branchHasCancelled(), this._enoughBranchesHaveCancelled() ? (this._invokeOnCancel(), !0) : !1);
}, e.prototype._cancelBranched = function() {
this._enoughBranchesHaveCancelled() && this._cancel();
}, e.prototype._cancel = function() {
this.isCancellable() && (this._setCancelled(), c.invoke(this._cancelPromises, this, void 0));
}, e.prototype._cancelPromises = function() {
this._length() > 0 && this._settlePromises();
}, e.prototype._unsetOnCancel = function() {
this._onCancelField = void 0;
}, e.prototype.isCancellable = function() {
return this.isPending() && !this.isCancelled();
}, e.prototype._doInvokeOnCancel = function(t, e) {
if (o.isArray(t))
for (var n = 0; n < t.length; ++n)
this._doInvokeOnCancel(t[n], e);
else if (void 0 !== t)
if ("function" == typeof t) {
if (!e) {
var r = a(t).call(this._boundValue());
r === s && (this._attachExtraTrace(r.e), c.throwLater(r.e));
}
} else
t._resultCancelled(this);
}, e.prototype._invokeOnCancel = function() {
var t = this._onCancel();
this._unsetOnCancel(), c.invoke(this._doInvokeOnCancel, this, t);
}, e.prototype._invokeInternalOnCancel = function() {
this.isCancellable() && (this._doInvokeOnCancel(this._onCancel(), !0), this._unsetOnCancel());
}, e.prototype._resultCancelled = function() {
this.cancel();
};
};
}, {"./util": 21}],
5: [function(t, e, n) {
"use strict";
e.exports = function(e) {
function n(t, n, s) {
return function(c) {
var l = s._boundValue();
t: for (var u = 0; u < t.length; ++u) {
var p = t[u];
if (p === Error || null != p && p.prototype instanceof Error) {
if (c instanceof p)
return o(n).call(l, c);
} else if ("function" == typeof p) {
var f = o(p).call(l, c);
if (f === a)
return f;
if (f)
return o(n).call(l, c);
} else if (r.isObject(c)) {
for (var h = i(p),
_ = 0; _ < h.length; ++_) {
var d = h[_];
if (p[d] != c[d])
continue t;
}
return o(n).call(l, c);
}
}
return e;
};
}
var r = t("./util"),
i = t("./es5").keys,
o = r.tryCatch,
a = r.errorObj;
return n;
};
}, {
"./es5": 10,
"./util": 21
}],
6: [function(t, e, n) {
"use strict";
e.exports = function(t) {
function e() {
this._trace = new e.CapturedTrace(r());
}
function n() {
return i ? new e : void 0;
}
function r() {
var t = o.length - 1;
return t >= 0 ? o[t] : void 0;
}
var i = !1,
o = [];
return t.prototype._promiseCreated = function() {}, t.prototype._pushContext = function() {}, t.prototype._popContext = function() {
return null;
}, t._peekContext = t.prototype._peekContext = function() {}, e.prototype._pushContext = function() {
void 0 !== this._trace && (this._trace._promiseCreated = null, o.push(this._trace));
}, e.prototype._popContext = function() {
if (void 0 !== this._trace) {
var t = o.pop(),
e = t._promiseCreated;
return t._promiseCreated = null, e;
}
return null;
}, e.CapturedTrace = null, e.create = n, e.deactivateLongStackTraces = function() {}, e.activateLongStackTraces = function() {
var n = t.prototype._pushContext,
o = t.prototype._popContext,
a = t._peekContext,
s = t.prototype._peekContext,
c = t.prototype._promiseCreated;
e.deactivateLongStackTraces = function() {
t.prototype._pushContext = n, t.prototype._popContext = o, t._peekContext = a, t.prototype._peekContext = s, t.prototype._promiseCreated = c, i = !1;
}, i = !0, t.prototype._pushContext = e.prototype._pushContext, t.prototype._popContext = e.prototype._popContext, t._peekContext = t.prototype._peekContext = r, t.prototype._promiseCreated = function() {
var t = this._peekContext();
t && null == t._promiseCreated && (t._promiseCreated = this);
};
}, e;
};
}, {}],
7: [function(t, e, n) {
"use strict";
e.exports = function(e, n) {
function r(t, e) {
return {promise: e};
}
function i() {
return !1;
}
function o(t, e, n) {
var r = this;
try {
t(e, n, function(t) {
if ("function" != typeof t)
throw new TypeError("onCancel must be a function, got: " + H.toString(t));
r._attachCancellationCallback(t);
});
} catch (i) {
return i;
}
}
function a(t) {
if (!this.isCancellable())
return this;
var e = this._onCancel();
void 0 !== e ? H.isArray(e) ? e.push(t) : this._setOnCancel([e, t]) : this._setOnCancel(t);
}
function s() {
return this._onCancelField;
}
function c(t) {
this._onCancelField = t;
}
function l() {
this._cancellationParent = void 0, this._onCancelField = void 0;
}
function u(t, e) {
if (0 !== (1 & e)) {
this._cancellationParent = t;
var n = t._branchesRemainingToCancel;
void 0 === n && (n = 0), t._branchesRemainingToCancel = n + 1;
}
0 !== (2 & e) && t._isBound() && this._setBoundTo(t._boundTo);
}
function p(t, e) {
0 !== (2 & e) && t._isBound() && this._setBoundTo(t._boundTo);
}
function f() {
var t = this._boundTo;
return void 0 !== t && t instanceof e ? t.isFulfilled() ? t.value() : void 0 : t;
}
function h() {
this._trace = new S(this._peekContext());
}
function _(t, e) {
if (B(t)) {
var n = this._trace;
if (void 0 !== n && e && (n = n._parent), void 0 !== n)
n.attachExtraTrace(t);
else if (!t.__stackCleaned__) {
var r = w(t);
H.notEnumerableProp(t, "stack", r.message + "\n" + r.stack.join("\n")), H.notEnumerableProp(t, "__stackCleaned__", !0);
}
}
}
function d(t, e, n, r, i) {
if (void 0 === t && null !== e && $) {
if (void 0 !== i && i._returnedNonUndefined())
return;
if (0 === (65535 & r._bitField))
return;
n && (n += " ");
var o = "a promise was created in a " + n + "handler but was not returned from it";
r._warn(o, !0, e);
}
}
function v(t, e) {
var n = t + " is deprecated and will be removed in a future version.";
return e && (n += " Use " + e + " instead."), y(n);
}
function y(t, n, r) {
if (rt.warnings) {
var i,
o = new U(t);
if (n)
r._attachExtraTrace(o);
else if (rt.longStackTraces && (i = e._peekContext()))
i.attachExtraTrace(o);
else {
var a = w(o);
o.stack = a.message + "\n" + a.stack.join("\n");
}
Y("warning", o) || E(o, "", !0);
}
}
function g(t, e) {
for (var n = 0; n < e.length - 1; ++n)
e[n].push("From previous event:"), e[n] = e[n].join("\n");
return n < e.length && (e[n] = e[n].join("\n")), t + "\n" + e.join("\n");
}
function m(t) {
for (var e = 0; e < t.length; ++e)
(0 === t[e].length || e + 1 < t.length && t[e][0] === t[e + 1][0]) && (t.splice(e, 1), e--);
}
function b(t) {
for (var e = t[0],
n = 1; n < t.length; ++n) {
for (var r = t[n],
i = e.length - 1,
o = e[i],
a = -1,
s = r.length - 1; s >= 0; --s)
if (r[s] === o) {
a = s;
break;
}
for (var s = a; s >= 0; --s) {
var c = r[s];
if (e[i] !== c)
break;
e.pop(), i--;
}
e = r;
}
}
function C(t) {
for (var e = [],
n = 0; n < t.length; ++n) {
var r = t[n],
i = " (No stack trace)" === r || V.test(r),
o = i && tt(r);
i && !o && (q && " " !== r.charAt(0) && (r = " " + r), e.push(r));
}
return e;
}
function k(t) {
for (var e = t.stack.replace(/\s+$/g, "").split("\n"),
n = 0; n < e.length; ++n) {
var r = e[n];
if (" (No stack trace)" === r || V.test(r))
break;
}
return n > 0 && (e = e.slice(n)), e;
}
function w(t) {
var e = t.stack,
n = t.toString();
return e = "string" == typeof e && e.length > 0 ? k(t) : [" (No stack trace)"], {
message: n,
stack: C(e)
};
}
function E(t, e, n) {
if ("undefined" != typeof console) {
var r;
if (H.isObject(t)) {
var i = t.stack;
r = e + Q(i, t);
} else
r = e + String(t);
"function" == typeof N ? N(r, n) : ("function" == typeof console.log || "object" == typeof console.log) && console.log(r);
}
}
function j(t, e, n, r) {
var i = !1;
try {
"function" == typeof e && (i = !0, "rejectionHandled" === t ? e(r) : e(n, r));
} catch (o) {
I.throwLater(o);
}
"unhandledRejection" === t ? Y(t, n, r) || i || E(n, "Unhandled rejection ") : Y(t, r);
}
function F(t) {
var e;
if ("function" == typeof t)
e = "[function " + (t.name || "anonymous") + "]";
else {
e = t && "function" == typeof t.toString ? t.toString() : H.toString(t);
var n = /\[object [a-zA-Z0-9$_]+\]/;
if (n.test(e))
try {
var r = JSON.stringify(t);
e = r;
} catch (i) {}
0 === e.length && (e = "(empty array)");
}
return "(<" + T(e) + ">, no stack trace)";
}
function T(t) {
var e = 41;
return t.length < e ? t : t.substr(0, e - 3) + "...";
}
function O() {
return "function" == typeof nt;
}
function P(t) {
var e = t.match(et);
return e ? {
fileName: e[1],
line: parseInt(e[2], 10)
} : void 0;
}
function R(t, e) {
if (O()) {
for (var n,
r,
i = t.stack.split("\n"),
o = e.stack.split("\n"),
a = -1,
s = -1,
c = 0; c < i.length; ++c) {
var l = P(i[c]);
if (l) {
n = l.fileName, a = l.line;
break;
}
}
for (var c = 0; c < o.length; ++c) {
var l = P(o[c]);
if (l) {
r = l.fileName, s = l.line;
break;
}
}
0 > a || 0 > s || !n || !r || n !== r || a >= s || (tt = function(t) {
if (D.test(t))
return !0;
var e = P(t);
return e && e.fileName === n && a <= e.line && e.line <= s ? !0 : !1;
});
}
}
function S(t) {
this._parent = t, this._promisesCreated = 0;
var e = this._length = 1 + (void 0 === t ? 0 : t._length);
nt(this, S), e > 32 && this.uncycle();
}
var x,
A,
N,
L = e._getDomain,
I = e._async,
U = t("./errors").Warning,
H = t("./util"),
B = H.canAttachTrace,
D = /[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/,
V = null,
Q = null,
q = !1,
G = !(0 == H.env("BLUEBIRD_DEBUG") || !H.env("BLUEBIRD_DEBUG") && "development" !== H.env("NODE_ENV")),
M = !(0 == H.env("BLUEBIRD_WARNINGS") || !G && !H.env("BLUEBIRD_WARNINGS")),
W = !(0 == H.env("BLUEBIRD_LONG_STACK_TRACES") || !G && !H.env("BLUEBIRD_LONG_STACK_TRACES")),
$ = 0 != H.env("BLUEBIRD_W_FORGOTTEN_RETURN") && (M || !!H.env("BLUEBIRD_W_FORGOTTEN_RETURN"));
e.prototype.suppressUnhandledRejections = function() {
var t = this._target();
t._bitField = -1048577 & t._bitField | 524288;
}, e.prototype._ensurePossibleRejectionHandled = function() {
0 === (524288 & this._bitField) && (this._setRejectionIsUnhandled(), I.invokeLater(this._notifyUnhandledRejection, this, void 0));
}, e.prototype._notifyUnhandledRejectionIsHandled = function() {
j("rejectionHandled", x, void 0, this);
}, e.prototype._setReturnedNonUndefined = function() {
this._bitField = 268435456 | this._bitField;
}, e.prototype._returnedNonUndefined = function() {
return 0 !== (268435456 & this._bitField);
}, e.prototype._notifyUnhandledRejection = function() {
if (this._isRejectionUnhandled()) {
var t = this._settledValue();
this._setUnhandledRejectionIsNotified(), j("unhandledRejection", A, t, this);
}
}, e.prototype._setUnhandledRejectionIsNotified = function() {
this._bitField = 262144 | this._bitField;
}, e.prototype._unsetUnhandledRejectionIsNotified = function() {
this._bitField = -262145 & this._bitField;
}, e.prototype._isUnhandledRejectionNotified = function() {
return (262144 & this._bitField) > 0;
}, e.prototype._setRejectionIsUnhandled = function() {
this._bitField = 1048576 | this._bitField;
}, e.prototype._unsetRejectionIsUnhandled = function() {
this._bitField = -1048577 & this._bitField, this._isUnhandledRejectionNotified() && (this._unsetUnhandledRejectionIsNotified(), this._notifyUnhandledRejectionIsHandled());
}, e.prototype._isRejectionUnhandled = function() {
return (1048576 & this._bitField) > 0;
}, e.prototype._warn = function(t, e, n) {
return y(t, e, n || this);
}, e.onPossiblyUnhandledRejection = function(t) {
var e = L();
A = "function" == typeof t ? null === e ? t : e.bind(t) : void 0;
}, e.onUnhandledRejectionHandled = function(t) {
var e = L();
x = "function" == typeof t ? null === e ? t : e.bind(t) : void 0;
};
var z = function() {};
e.longStackTraces = function() {
if (I.haveItemsQueued() && !rt.longStackTraces)
throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");
if (!rt.longStackTraces && O()) {
var t = e.prototype._captureStackTrace,
r = e.prototype._attachExtraTrace;
rt.longStackTraces = !0, z = function() {
if (I.haveItemsQueued() && !rt.longStackTraces)
throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/MqrFmX\n");
e.prototype._captureStackTrace = t, e.prototype._attachExtraTrace = r, n.deactivateLongStackTraces(), I.enableTrampoline(), rt.longStackTraces = !1;
}, e.prototype._captureStackTrace = h, e.prototype._attachExtraTrace = _, n.activateLongStackTraces(), I.disableTrampolineIfNecessary();
}
}, e.hasLongStackTraces = function() {
return rt.longStackTraces && O();
};
var X = function() {
try {
var t = document.createEvent("CustomEvent");
return t.initCustomEvent("testingtheevent", !1, !0, {}), H.global.dispatchEvent(t), function(t, e) {
var n = document.createEvent("CustomEvent");
return n.initCustomEvent(t.toLowerCase(), !1, !0, e), !H.global.dispatchEvent(n);
};
} catch (e) {}
return function() {
return !1;
};
}(),
K = function() {
return H.isNode ? function() {
return process.emit.apply(process, arguments);
} : H.global ? function(t) {
var e = "on" + t.toLowerCase(),
n = H.global[e];
return n ? (n.apply(H.global, [].slice.call(arguments, 1)), !0) : !1;
} : function() {
return !1;
};
}(),
J = {
promiseCreated: r,
promiseFulfilled: r,
promiseRejected: r,
promiseResolved: r,
promiseCancelled: r,
promiseChained: function(t, e, n) {
return {
promise: e,
child: n
};
},
warning: function(t, e) {
return {warning: e};
},
unhandledRejection: function(t, e, n) {
return {
reason: e,
promise: n
};
},
rejectionHandled: r
},
Y = function(t) {
var e = !1;
try {
e = K.apply(null, arguments);
} catch (n) {
I.throwLater(n), e = !0;
}
var r = !1;
try {
r = X(t, J[t].apply(null, arguments));
} catch (n) {
I.throwLater(n), r = !0;
}
return r || e;
};
e.config = function(t) {
if (t = Object(t), "longStackTraces" in t && (t.longStackTraces ? e.longStackTraces() : !t.longStackTraces && e.hasLongStackTraces() && z()), "warnings" in t) {
var n = t.warnings;
rt.warnings = !!n, $ = rt.warnings, H.isObject(n) && "wForgottenReturn" in n && ($ = !!n.wForgottenReturn);
}
if ("cancellation" in t && t.cancellation && !rt.cancellation) {
if (I.haveItemsQueued())
throw new Error("cannot enable cancellation after promises are in use");
e.prototype._clearCancellationData = l, e.prototype._propagateFrom = u, e.prototype._onCancel = s, e.prototype._setOnCancel = c, e.prototype._attachCancellationCallback = a, e.prototype._execute = o, Z = u, rt.cancellation = !0;
}
"monitoring" in t && (t.monitoring && !rt.monitoring ? (rt.monitoring = !0, e.prototype._fireEvent = Y) : !t.monitoring && rt.monitoring && (rt.monitoring = !1, e.prototype._fireEvent = i));
}, e.prototype._fireEvent = i, e.prototype._execute = function(t, e, n) {
try {
t(e, n);
} catch (r) {
return r;
}
}, e.prototype._onCancel = function() {}, e.prototype._setOnCancel = function(t) {}, e.prototype._attachCancellationCallback = function(t) {}, e.prototype._captureStackTrace = function() {}, e.prototype._attachExtraTrace = function() {}, e.prototype._clearCancellationData = function() {}, e.prototype._propagateFrom = function(t, e) {};
var Z = p,
tt = function() {
return !1;
},
et = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;
H.inherits(S, Error), n.CapturedTrace = S, S.prototype.uncycle = function() {
var t = this._length;
if (!(2 > t)) {
for (var e = [],
n = {},
r = 0,
i = this; void 0 !== i; ++r)
e.push(i), i = i._parent;
t = this._length = r;
for (var r = t - 1; r >= 0; --r) {
var o = e[r].stack;
void 0 === n[o] && (n[o] = r);
}
for (var r = 0; t > r; ++r) {
var a = e[r].stack,
s = n[a];
if (void 0 !== s && s !== r) {
s > 0 && (e[s - 1]._parent = void 0, e[s - 1]._length = 1), e[r]._parent = void 0, e[r]._length = 1;
var c = r > 0 ? e[r - 1] : this;
t - 1 > s ? (c._parent = e[s + 1], c._parent.uncycle(), c._length = c._parent._length + 1) : (c._parent = void 0, c._length = 1);
for (var l = c._length + 1,
u = r - 2; u >= 0; --u)
e[u]._length = l, l++;
return;
}
}
}
}, S.prototype.attachExtraTrace = function(t) {
if (!t.__stackCleaned__) {
this.uncycle();
for (var e = w(t),
n = e.message,
r = [e.stack],
i = this; void 0 !== i; )
r.push(C(i.stack.split("\n"))), i = i._parent;
b(r), m(r), H.notEnumerableProp(t, "stack", g(n, r)), H.notEnumerableProp(t, "__stackCleaned__", !0);
}
};
var nt = function() {
var t = /^\s*at\s*/,
e = function(t, e) {
return "string" == typeof t ? t : void 0 !== e.name && void 0 !== e.message ? e.toString() : F(e);
};
if ("number" == typeof Error.stackTraceLimit && "function" == typeof Error.captureStackTrace) {
Error.stackTraceLimit += 6, V = t, Q = e;
var n = Error.captureStackTrace;
return tt = function(t) {
return D.test(t);
}, function(t, e) {
Error.stackTraceLimit += 6, n(t, e), Error.stackTraceLimit -= 6;
};
}
var r = new Error;
if ("string" == typeof r.stack && r.stack.split("\n")[0].indexOf("stackDetection@") >= 0)
return V = /@/, Q = e, q = !0, function(t) {
t.stack = (new Error).stack;
};
var i;
try {
throw new Error;
} catch (o) {
i = "stack" in o;
}
return "stack" in r || !i || "number" != typeof Error.stackTraceLimit ? (Q = function(t, e) {
return "string" == typeof t ? t : "object" != typeof e && "function" != typeof e || void 0 === e.name || void 0 === e.message ? F(e) : e.toString();
}, null) : (V = t, Q = e, function(t) {
Error.stackTraceLimit += 6;
try {
throw new Error;
} catch (e) {
t.stack = e.stack;
}
Error.stackTraceLimit -= 6;
});
}([]);
"undefined" != typeof console && "undefined" != typeof console.warn && (N = function(t) {
console.warn(t);
}, H.isNode && process.stderr.isTTY ? N = function(t, e) {
var n = e ? "[33m" : "[31m";
console.warn(n + t + "[0m\n");
} : H.isNode || "string" != typeof(new Error).stack || (N = function(t, e) {
console.warn("%c" + t, e ? "color: darkorange" : "color: red");
}));
var rt = {
warnings: M,
longStackTraces: !1,
cancellation: !1,
monitoring: !1
};
return W && e.longStackTraces(), {
longStackTraces: function() {
return rt.longStackTraces;
},
warnings: function() {
return rt.warnings;
},
cancellation: function() {
return rt.cancellation;
},
monitoring: function() {
return rt.monitoring;
},
propagateFromFunction: function() {
return Z;
},
boundValueFunction: function() {
return f;
},
checkForgottenReturns: d,
setBounds: R,
warn: y,
deprecated: v,
CapturedTrace: S,
fireDomEvent: X,
fireGlobalEvent: K
};
};
}, {
"./errors": 9,
"./util": 21
}],
8: [function(t, e, n) {
"use strict";
e.exports = function(t) {
function e() {
return this.value;
}
function n() {
throw this.reason;
}
t.prototype["return"] = t.prototype.thenReturn = function(n) {
return n instanceof t && n.suppressUnhandledRejections(), this._then(e, void 0, void 0, {value: n}, void 0);
}, t.prototype["throw"] = t.prototype.thenThrow = function(t) {
return this._then(n, void 0, void 0, {reason: t}, void 0);
}, t.prototype.catchThrow = function(t) {
if (arguments.length <= 1)
return this._then(void 0, n, void 0, {reason: t}, void 0);
var e = arguments[1],
r = function() {
throw e;
};
return this.caught(t, r);
}, t.prototype.catchReturn = function(n) {
if (arguments.length <= 1)
return n instanceof t && n.suppressUnhandledRejections(), this._then(void 0, e, void 0, {value: n}, void 0);
var r = arguments[1];
r instanceof t && r.suppressUnhandledRejections();
var i = function() {
return r;
};
return this.caught(n, i);
};
};
}, {}],
9: [function(t, e, n) {
"use strict";
function r(t, e) {
function n(r) {
return this instanceof n ? (p(this, "message", "string" == typeof r ? r : e), p(this, "name", t), void(Error.captureStackTrace ? Error.captureStackTrace(this, this.constructor) : Error.call(this))) : new n(r);
}
return u(n, Error), n;
}
function i(t) {
return this instanceof i ? (p(this, "name", "OperationalError"), p(this, "message", t), this.cause = t, this.isOperational = !0, void(t instanceof Error ? (p(this, "message", t.message), p(this, "stack", t.stack)) : Error.captureStackTrace && Error.captureStackTrace(this, this.constructor))) : new i(t);
}
var o,
a,
s = t("./es5"),
c = s.freeze,
l = t("./util"),
u = l.inherits,
p = l.notEnumerableProp,
f = r("Warning", "warning"),
h = r("CancellationError", "cancellation error"),
_ = r("TimeoutError", "timeout error"),
d = r("AggregateError", "aggregate error");
try {
o = TypeError, a = RangeError;
} catch (v) {
o = r("TypeError", "type error"), a = r("RangeError", "range error");
}
for (var y = "join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),
g = 0; g < y.length; ++g)
"function" == typeof Array.prototype[y[g]] && (d.prototype[y[g]] = Array.prototype[y[g]]);
s.defineProperty(d.prototype, "length", {
value: 0,
configurable: !1,
writable: !0,
enumerable: !0
}), d.prototype.isOperational = !0;
var m = 0;
d.prototype.toString = function() {
var t = Array(4 * m + 1).join(" "),
e = "\n" + t + "AggregateError of:\n";
m++, t = Array(4 * m + 1).join(" ");
for (var n = 0; n < this.length; ++n) {
for (var r = this[n] === this ? "[Circular AggregateError]" : this[n] + "",
i = r.split("\n"),
o = 0; o < i.length; ++o)
i[o] = t + i[o];
r = i.join("\n"), e += r + "\n";
}
return m--, e;
}, u(i, Error);
var b = Error.__BluebirdErrorTypes__;
b || (b = c({
CancellationError: h,
TimeoutError: _,
OperationalError: i,
RejectionError: i,
AggregateError: d
}), s.defineProperty(Error, "__BluebirdErrorTypes__", {
value: b,
writable: !1,
enumerable: !1,
configurable: !1
})), e.exports = {
Error: Error,
TypeError: o,
RangeError: a,
CancellationError: b.CancellationError,
OperationalError: b.OperationalError,
TimeoutError: b.TimeoutError,
AggregateError: b.AggregateError,
Warning: f
};
}, {
"./es5": 10,
"./util": 21
}],
10: [function(t, e, n) {
var r = function() {
"use strict";
return void 0 === this;
}();
if (r)
e.exports = {
freeze: Object.freeze,
defineProperty: Object.defineProperty,
getDescriptor: Object.getOwnPropertyDescriptor,
keys: Object.keys,
names: Object.getOwnPropertyNames,
getPrototypeOf: Object.getPrototypeOf,
isArray: Array.isArray,
isES5: r,
propertyIsWritable: function(t, e) {
var n = Object.getOwnPropertyDescriptor(t, e);
return !(n && !n.writable && !n.set);
}
};
else {
var i = {}.hasOwnProperty,
o = {}.toString,
a = {}.constructor.prototype,
s = function(t) {
var e = [];
for (var n in t)
i.call(t, n) && e.push(n);
return e;
},
c = function(t, e) {
return {value: t[e]};
},
l = function(t, e, n) {
return t[e] = n.value, t;
},
u = function(t) {
return t;
},
p = function(t) {
try {
return Object(t).constructor.prototype;
} catch (e) {
return a;
}
},
f = function(t) {
try {
return "[object Array]" === o.call(t);
} catch (e) {
return !1;
}
};
e.exports = {
isArray: f,
keys: s,
names: s,
defineProperty: l,
getDescriptor: c,
freeze: u,
getPrototypeOf: p,
isES5: r,
propertyIsWritable: function() {
return !0;
}
};
}
}, {}],
11: [function(t, e, n) {
"use strict";
e.exports = function(e, n) {
function r(t, e, n) {
this.promise = t, this.type = e, this.handler = n, this.called = !1, this.cancelPromise = null;
}
function i(t) {
this.finallyHandler = t;
}
function o(t, e) {
return null != t.cancelPromise ? (arguments.length > 1 ? t.cancelPromise._reject(e) : t.cancelPromise._cancel(), t.cancelPromise = null, !0) : !1;
}
function a() {
return c.call(this, this.promise._target()._settledValue());
}
function s(t) {
return o(this, t) ? void 0 : (p.e = t, p);
}
function c(t) {
var r = this.promise,
c = this.handler;
if (!this.called) {
this.called = !0;
var l = this.isFinallyHandler() ? c.call(r._boundValue()) : c.call(r._boundValue(), t);
if (void 0 !== l) {
r._setReturnedNonUndefined();
var f = n(l, r);
if (f instanceof e) {
if (null != this.cancelPromise) {
if (f.isCancelled()) {
var h = new u("late cancellation observer");
return r._attachExtraTrace(h), p.e = h, p;
}
f.isPending() && f._attachCancellationCallback(new i(this));
}
return f._then(a, s, void 0, this, void 0);
}
}
}
return r.isRejected() ? (o(this), p.e = t, p) : (o(this), t);
}
var l = t("./util"),
u = e.CancellationError,
p = l.errorObj;
return r.prototype.isFinallyHandler = function() {
return 0 === this.type;
}, i.prototype._resultCancelled = function() {
o(this.finallyHandler);
}, e.prototype._passThrough = function(t, e, n, i) {
return "function" != typeof t ? this.then() : this._then(n, i, void 0, new r(this, e, t), void 0);
}, e.prototype.lastly = e.prototype["finally"] = function(t) {
return this._passThrough(t, 0, c, c);
}, e.prototype.tap = function(t) {
return this._passThrough(t, 1, c);
}, r;
};
}, {"./util": 21}],
12: [function(t, e, n) {
"use strict";
e.exports = function(e, n, r, i) {
var o = t("./util");
o.canEvaluate, o.tryCatch, o.errorObj;
e.join = function() {
var t,
e = arguments.length - 1;
if (e > 0 && "function" == typeof arguments[e]) {
t = arguments[e];
var r;
}
var i = [].slice.call(arguments);
t && i.pop();
var r = new n(i).promise();
return void 0 !== t ? r.spread(t) : r;
};
};
}, {"./util": 21}],
13: [function(t, e, n) {
"use strict";
e.exports = function(e, n, r, i, o) {
var a = t("./util"),
s = a.tryCatch;
e.method = function(t) {
if ("function" != typeof t)
throw new e.TypeError("expecting a function but got " + a.classString(t));
return function() {
var r = new e(n);
r._captureStackTrace(), r._pushContext();
var i = s(t).apply(this, arguments),
a = r._popContext();
return o.checkForgottenReturns(i, a, "Promise.method", r), r._resolveFromSyncValue(i), r;
};
}, e.attempt = e["try"] = function(t) {
if ("function" != typeof t)
return i("expecting a function but got " + a.classString(t));
var r = new e(n);
r._captureStackTrace(), r._pushContext();
var c;
if (arguments.length > 1) {
o.deprecated("calling Promise.try with more than 1 argument");
var l = arguments[1],
u = arguments[2];
c = a.isArray(l) ? s(t).apply(u, l) : s(t).call(u, l);
} else
c = s(t)();
var p = r._popContext();
return o.checkForgottenReturns(c, p, "Promise.try", r), r._resolveFromSyncValue(c), r;
}, e.prototype._resolveFromSyncValue = function(t) {
t === a.errorObj ? this._rejectCallback(t.e, !1) : this._resolveCallback(t, !0);
};
};
}, {"./util": 21}],
14: [function(t, e, n) {
"use strict";
function r(t) {
return t instanceof Error && u.getPrototypeOf(t) === Error.prototype;
}
function i(t) {
var e;
if (r(t)) {
e = new l(t), e.name = t.name, e.message = t.message, e.stack = t.stack;
for (var n = u.keys(t),
i = 0; i < n.length; ++i) {
var o = n[i];
p.test(o) || (e[o] = t[o]);
}
return e;
}
return a.markAsOriginatingFromRejection(t), t;
}
function o(t, e) {
return function(n, r) {
if (null !== t) {
if (n) {
var o = i(s(n));
t._attachExtraTrace(o), t._reject(o);
} else if (e) {
var a = [].slice.call(arguments, 1);
t._fulfill(a);
} else
t._fulfill(r);
t = null;
}
};
}
var a = t("./util"),
s = a.maybeWrapAsError,
c = t("./errors"),
l = c.OperationalError,
u = t("./es5"),
p = /^(?:name|message|stack|cause)$/;
e.exports = o;
}, {
"./errors": 9,
"./es5": 10,
"./util": 21
}],
15: [function(t, e, n) {
"use strict";
e.exports = function() {
function n() {}
function r(t, e) {
if ("function" != typeof e)
throw new g("expecting a function but got " + h.classString(e));
if (t.constructor !== i)
throw new g("the promise constructor cannot be invoked directly\n\n See http://goo.gl/MqrFmX\n");
}
function i(t) {
this._bitField = 0, this._fulfillmentHandler0 = void 0, this._rejectionHandler0 = void 0, this._promise0 = void 0, this._receiver0 = void 0, t !== b && (r(this, t), this._resolveFromExecutor(t)), this._promiseCreated(), this._fireEvent("promiseCreated", this);
}
function o(t) {
this.promise._resolveCallback(t);
}
function a(t) {
this.promise._rejectCallback(t, !1);
}
function s(t) {
var e = new i(b);
e._fulfillmentHandler0 = t, e._rejectionHandler0 = t, e._promise0 = t, e._receiver0 = t;
}
var c,
l = function() {
return new g("circular promise resolution chain\n\n See http://goo.gl/MqrFmX\n");
},
u = function() {
return new i.PromiseInspection(this._target());
},
p = function(t) {
return i.reject(new g(t));
},
f = {},
h = t("./util");
c = h.isNode ? function() {
var t = process.domain;
return void 0 === t && (t = null), t;
} : function() {
return null;
}, h.notEnumerableProp(i, "_getDomain", c);
var _ = t("./es5"),
d = t("./async"),
v = new d;
_.defineProperty(i, "_async", {value: v});
var y = t("./errors"),
g = i.TypeError = y.TypeError;
i.RangeError = y.RangeError;
var m = i.CancellationError = y.CancellationError;
i.TimeoutError = y.TimeoutError, i.OperationalError = y.OperationalError, i.RejectionError = y.OperationalError, i.AggregateError = y.AggregateError;
var b = function() {},
C = {},
k = {},
w = t("./thenables")(i, b),
E = t("./promise_array")(i, b, w, p, n),
j = t("./context")(i),
F = (j.create, t("./debuggability")(i, j)),
T = (F.CapturedTrace, t("./finally")(i, w)),
O = t("./catch_filter")(k),
P = t("./nodeback"),
R = h.errorObj,
S = h.tryCatch;
return i.prototype.toString = function() {
return "[object Promise]";
}, i.prototype.caught = i.prototype["catch"] = function(t) {
var e = arguments.length;
if (e > 1) {
var n,