@tinyuploader/react
Version:
1,334 lines (1,261 loc) • 89.2 kB
JavaScript
import ce, { createContext as Lt, useContext as rt, useEffect as Ae, useState as we, useCallback as ue, forwardRef as Nt, useImperativeHandle as Wt } from "react";
import g from "prop-types";
var xe = { exports: {} }, re = {};
/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Xe;
function $t() {
if (Xe) return re;
Xe = 1;
var a = ce, n = Symbol.for("react.element"), u = Symbol.for("react.fragment"), h = Object.prototype.hasOwnProperty, d = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, _ = { key: !0, ref: !0, __self: !0, __source: !0 };
function v(m, S, E) {
var k, D = {}, N = null, q = null;
E !== void 0 && (N = "" + E), S.key !== void 0 && (N = "" + S.key), S.ref !== void 0 && (q = S.ref);
for (k in S) h.call(S, k) && !_.hasOwnProperty(k) && (D[k] = S[k]);
if (m && m.defaultProps) for (k in S = m.defaultProps, S) D[k] === void 0 && (D[k] = S[k]);
return { $$typeof: n, type: m, key: N, ref: q, props: D, _owner: d.current };
}
return re.Fragment = u, re.jsx = v, re.jsxs = v, re;
}
var se = {};
/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var Ze;
function qt() {
return Ze || (Ze = 1, process.env.NODE_ENV !== "production" && function() {
var a = ce, n = Symbol.for("react.element"), u = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), d = Symbol.for("react.strict_mode"), _ = Symbol.for("react.profiler"), v = Symbol.for("react.provider"), m = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), E = Symbol.for("react.suspense"), k = Symbol.for("react.suspense_list"), D = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), q = Symbol.for("react.offscreen"), G = Symbol.iterator, $ = "@@iterator";
function C(r) {
if (r === null || typeof r != "object")
return null;
var l = G && r[G] || r[$];
return typeof l == "function" ? l : null;
}
var c = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function o(r) {
{
for (var l = arguments.length, f = new Array(l > 1 ? l - 1 : 0), b = 1; b < l; b++)
f[b - 1] = arguments[b];
t("error", r, f);
}
}
function t(r, l, f) {
{
var b = c.ReactDebugCurrentFrame, A = b.getStackAddendum();
A !== "" && (l += "%s", f = f.concat([A]));
var T = f.map(function(R) {
return String(R);
});
T.unshift("Warning: " + l), Function.prototype.apply.call(console[r], console, T);
}
}
var e = !1, i = !1, s = !1, O = !1, U = !1, w;
w = Symbol.for("react.module.reference");
function F(r) {
return !!(typeof r == "string" || typeof r == "function" || r === h || r === _ || U || r === d || r === E || r === k || O || r === q || e || i || s || typeof r == "object" && r !== null && (r.$$typeof === N || r.$$typeof === D || r.$$typeof === v || r.$$typeof === m || r.$$typeof === S || // This needs to include all possible module reference object
// types supported by any Flight configuration anywhere since
// we don't know which Flight build this will end up being used
// with.
r.$$typeof === w || r.getModuleId !== void 0));
}
function fe(r, l, f) {
var b = r.displayName;
if (b)
return b;
var A = l.displayName || l.name || "";
return A !== "" ? f + "(" + A + ")" : f;
}
function Ee(r) {
return r.displayName || "Context";
}
function W(r) {
if (r == null)
return null;
if (typeof r.tag == "number" && o("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof r == "function")
return r.displayName || r.name || null;
if (typeof r == "string")
return r;
switch (r) {
case h:
return "Fragment";
case u:
return "Portal";
case _:
return "Profiler";
case d:
return "StrictMode";
case E:
return "Suspense";
case k:
return "SuspenseList";
}
if (typeof r == "object")
switch (r.$$typeof) {
case m:
var l = r;
return Ee(l) + ".Consumer";
case v:
var f = r;
return Ee(f._context) + ".Provider";
case S:
return fe(r, r.render, "ForwardRef");
case D:
var b = r.displayName || null;
return b !== null ? b : W(r.type) || "Memo";
case N: {
var A = r, T = A._payload, R = A._init;
try {
return W(R(T));
} catch {
return null;
}
}
}
return null;
}
var V = Object.assign, Z = 0, Te, je, Ue, Pe, Be, Oe, De;
function Me() {
}
Me.__reactDisabledLog = !0;
function dt() {
{
if (Z === 0) {
Te = console.log, je = console.info, Ue = console.warn, Pe = console.error, Be = console.group, Oe = console.groupCollapsed, De = console.groupEnd;
var r = {
configurable: !0,
enumerable: !0,
value: Me,
writable: !0
};
Object.defineProperties(console, {
info: r,
log: r,
warn: r,
error: r,
group: r,
groupCollapsed: r,
groupEnd: r
});
}
Z++;
}
}
function pt() {
{
if (Z--, Z === 0) {
var r = {
configurable: !0,
enumerable: !0,
writable: !0
};
Object.defineProperties(console, {
log: V({}, r, {
value: Te
}),
info: V({}, r, {
value: je
}),
warn: V({}, r, {
value: Ue
}),
error: V({}, r, {
value: Pe
}),
group: V({}, r, {
value: Be
}),
groupCollapsed: V({}, r, {
value: Oe
}),
groupEnd: V({}, r, {
value: De
})
});
}
Z < 0 && o("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
}
}
var de = c.ReactCurrentDispatcher, pe;
function ie(r, l, f) {
{
if (pe === void 0)
try {
throw Error();
} catch (A) {
var b = A.stack.trim().match(/\n( *(at )?)/);
pe = b && b[1] || "";
}
return `
` + pe + r;
}
}
var ge = !1, ne;
{
var gt = typeof WeakMap == "function" ? WeakMap : Map;
ne = new gt();
}
function Ie(r, l) {
if (!r || ge)
return "";
{
var f = ne.get(r);
if (f !== void 0)
return f;
}
var b;
ge = !0;
var A = Error.prepareStackTrace;
Error.prepareStackTrace = void 0;
var T;
T = de.current, de.current = null, dt();
try {
if (l) {
var R = function() {
throw Error();
};
if (Object.defineProperty(R.prototype, "props", {
set: function() {
throw Error();
}
}), typeof Reflect == "object" && Reflect.construct) {
try {
Reflect.construct(R, []);
} catch (I) {
b = I;
}
Reflect.construct(r, [], R);
} else {
try {
R.call();
} catch (I) {
b = I;
}
r.call(R.prototype);
}
} else {
try {
throw Error();
} catch (I) {
b = I;
}
r();
}
} catch (I) {
if (I && b && typeof I.stack == "string") {
for (var x = I.stack.split(`
`), M = b.stack.split(`
`), P = x.length - 1, B = M.length - 1; P >= 1 && B >= 0 && x[P] !== M[B]; )
B--;
for (; P >= 1 && B >= 0; P--, B--)
if (x[P] !== M[B]) {
if (P !== 1 || B !== 1)
do
if (P--, B--, B < 0 || x[P] !== M[B]) {
var L = `
` + x[P].replace(" at new ", " at ");
return r.displayName && L.includes("<anonymous>") && (L = L.replace("<anonymous>", r.displayName)), typeof r == "function" && ne.set(r, L), L;
}
while (P >= 1 && B >= 0);
break;
}
}
} finally {
ge = !1, de.current = T, pt(), Error.prepareStackTrace = A;
}
var J = r ? r.displayName || r.name : "", Y = J ? ie(J) : "";
return typeof r == "function" && ne.set(r, Y), Y;
}
function bt(r, l, f) {
return Ie(r, !1);
}
function mt(r) {
var l = r.prototype;
return !!(l && l.isReactComponent);
}
function ae(r, l, f) {
if (r == null)
return "";
if (typeof r == "function")
return Ie(r, mt(r));
if (typeof r == "string")
return ie(r);
switch (r) {
case E:
return ie("Suspense");
case k:
return ie("SuspenseList");
}
if (typeof r == "object")
switch (r.$$typeof) {
case S:
return bt(r.render);
case D:
return ae(r.type, l, f);
case N: {
var b = r, A = b._payload, T = b._init;
try {
return ae(T(A), l, f);
} catch {
}
}
}
return "";
}
var ee = Object.prototype.hasOwnProperty, ze = {}, Le = c.ReactDebugCurrentFrame;
function oe(r) {
if (r) {
var l = r._owner, f = ae(r.type, r._source, l ? l.type : null);
Le.setExtraStackFrame(f);
} else
Le.setExtraStackFrame(null);
}
function yt(r, l, f, b, A) {
{
var T = Function.call.bind(ee);
for (var R in r)
if (T(r, R)) {
var x = void 0;
try {
if (typeof r[R] != "function") {
var M = Error((b || "React class") + ": " + f + " type `" + R + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof r[R] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
throw M.name = "Invariant Violation", M;
}
x = r[R](l, R, b, f, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
} catch (P) {
x = P;
}
x && !(x instanceof Error) && (oe(A), o("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", b || "React class", f, R, typeof x), oe(null)), x instanceof Error && !(x.message in ze) && (ze[x.message] = !0, oe(A), o("Failed %s type: %s", f, x.message), oe(null));
}
}
}
var vt = Array.isArray;
function be(r) {
return vt(r);
}
function kt(r) {
{
var l = typeof Symbol == "function" && Symbol.toStringTag, f = l && r[Symbol.toStringTag] || r.constructor.name || "Object";
return f;
}
}
function St(r) {
try {
return Ne(r), !1;
} catch {
return !0;
}
}
function Ne(r) {
return "" + r;
}
function We(r) {
if (St(r))
return o("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", kt(r)), Ne(r);
}
var te = c.ReactCurrentOwner, wt = {
key: !0,
ref: !0,
__self: !0,
__source: !0
}, $e, qe, me;
me = {};
function xt(r) {
if (ee.call(r, "ref")) {
var l = Object.getOwnPropertyDescriptor(r, "ref").get;
if (l && l.isReactWarning)
return !1;
}
return r.ref !== void 0;
}
function _t(r) {
if (ee.call(r, "key")) {
var l = Object.getOwnPropertyDescriptor(r, "key").get;
if (l && l.isReactWarning)
return !1;
}
return r.key !== void 0;
}
function Rt(r, l) {
if (typeof r.ref == "string" && te.current && l && te.current.stateNode !== l) {
var f = W(te.current.type);
me[f] || (o('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref', W(te.current.type), r.ref), me[f] = !0);
}
}
function Ft(r, l) {
{
var f = function() {
$e || ($e = !0, o("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", l));
};
f.isReactWarning = !0, Object.defineProperty(r, "key", {
get: f,
configurable: !0
});
}
}
function At(r, l) {
{
var f = function() {
qe || (qe = !0, o("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", l));
};
f.isReactWarning = !0, Object.defineProperty(r, "ref", {
get: f,
configurable: !0
});
}
}
var Ct = function(r, l, f, b, A, T, R) {
var x = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: n,
// Built-in properties that belong on the element
type: r,
key: l,
ref: f,
props: R,
// Record the component responsible for creating this element.
_owner: T
};
return x._store = {}, Object.defineProperty(x._store, "validated", {
configurable: !1,
enumerable: !1,
writable: !0,
value: !1
}), Object.defineProperty(x, "_self", {
configurable: !1,
enumerable: !1,
writable: !1,
value: b
}), Object.defineProperty(x, "_source", {
configurable: !1,
enumerable: !1,
writable: !1,
value: A
}), Object.freeze && (Object.freeze(x.props), Object.freeze(x)), x;
};
function Et(r, l, f, b, A) {
{
var T, R = {}, x = null, M = null;
f !== void 0 && (We(f), x = "" + f), _t(l) && (We(l.key), x = "" + l.key), xt(l) && (M = l.ref, Rt(l, A));
for (T in l)
ee.call(l, T) && !wt.hasOwnProperty(T) && (R[T] = l[T]);
if (r && r.defaultProps) {
var P = r.defaultProps;
for (T in P)
R[T] === void 0 && (R[T] = P[T]);
}
if (x || M) {
var B = typeof r == "function" ? r.displayName || r.name || "Unknown" : r;
x && Ft(R, B), M && At(R, B);
}
return Ct(r, x, M, A, b, te.current, R);
}
}
var ye = c.ReactCurrentOwner, Ve = c.ReactDebugCurrentFrame;
function Q(r) {
if (r) {
var l = r._owner, f = ae(r.type, r._source, l ? l.type : null);
Ve.setExtraStackFrame(f);
} else
Ve.setExtraStackFrame(null);
}
var ve;
ve = !1;
function ke(r) {
return typeof r == "object" && r !== null && r.$$typeof === n;
}
function Ye() {
{
if (ye.current) {
var r = W(ye.current.type);
if (r)
return `
Check the render method of \`` + r + "`.";
}
return "";
}
}
function Tt(r) {
return "";
}
var He = {};
function jt(r) {
{
var l = Ye();
if (!l) {
var f = typeof r == "string" ? r : r.displayName || r.name;
f && (l = `
Check the top-level render call using <` + f + ">.");
}
return l;
}
}
function Ge(r, l) {
{
if (!r._store || r._store.validated || r.key != null)
return;
r._store.validated = !0;
var f = jt(l);
if (He[f])
return;
He[f] = !0;
var b = "";
r && r._owner && r._owner !== ye.current && (b = " It was passed a child from " + W(r._owner.type) + "."), Q(r), o('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', f, b), Q(null);
}
}
function Qe(r, l) {
{
if (typeof r != "object")
return;
if (be(r))
for (var f = 0; f < r.length; f++) {
var b = r[f];
ke(b) && Ge(b, l);
}
else if (ke(r))
r._store && (r._store.validated = !0);
else if (r) {
var A = C(r);
if (typeof A == "function" && A !== r.entries)
for (var T = A.call(r), R; !(R = T.next()).done; )
ke(R.value) && Ge(R.value, l);
}
}
}
function Ut(r) {
{
var l = r.type;
if (l == null || typeof l == "string")
return;
var f;
if (typeof l == "function")
f = l.propTypes;
else if (typeof l == "object" && (l.$$typeof === S || // Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
l.$$typeof === D))
f = l.propTypes;
else
return;
if (f) {
var b = W(l);
yt(f, r.props, "prop", b, r);
} else if (l.PropTypes !== void 0 && !ve) {
ve = !0;
var A = W(l);
o("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", A || "Unknown");
}
typeof l.getDefaultProps == "function" && !l.getDefaultProps.isReactClassApproved && o("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
}
}
function Pt(r) {
{
for (var l = Object.keys(r.props), f = 0; f < l.length; f++) {
var b = l[f];
if (b !== "children" && b !== "key") {
Q(r), o("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", b), Q(null);
break;
}
}
r.ref !== null && (Q(r), o("Invalid attribute `ref` supplied to `React.Fragment`."), Q(null));
}
}
var Je = {};
function Ke(r, l, f, b, A, T) {
{
var R = F(r);
if (!R) {
var x = "";
(r === void 0 || typeof r == "object" && r !== null && Object.keys(r).length === 0) && (x += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
var M = Tt();
M ? x += M : x += Ye();
var P;
r === null ? P = "null" : be(r) ? P = "array" : r !== void 0 && r.$$typeof === n ? (P = "<" + (W(r.type) || "Unknown") + " />", x = " Did you accidentally export a JSX literal instead of a component?") : P = typeof r, o("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", P, x);
}
var B = Et(r, l, f, A, T);
if (B == null)
return B;
if (R) {
var L = l.children;
if (L !== void 0)
if (b)
if (be(L)) {
for (var J = 0; J < L.length; J++)
Qe(L[J], r);
Object.freeze && Object.freeze(L);
} else
o("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
else
Qe(L, r);
}
if (ee.call(l, "key")) {
var Y = W(r), I = Object.keys(l).filter(function(zt) {
return zt !== "key";
}), Se = I.length > 0 ? "{key: someKey, " + I.join(": ..., ") + ": ...}" : "{key: someKey}";
if (!Je[Y + Se]) {
var It = I.length > 0 ? "{" + I.join(": ..., ") + ": ...}" : "{}";
o(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`, Se, Y, It, Y), Je[Y + Se] = !0;
}
}
return r === h ? Pt(B) : Ut(B), B;
}
}
function Bt(r, l, f) {
return Ke(r, l, f, !0);
}
function Ot(r, l, f) {
return Ke(r, l, f, !1);
}
var Dt = Ot, Mt = Bt;
se.Fragment = h, se.jsx = Dt, se.jsxs = Mt;
}()), se;
}
process.env.NODE_ENV === "production" ? xe.exports = $t() : xe.exports = qt();
var y = xe.exports;
const Ce = Lt(null);
let Vt = 0;
const _e = (a = "id") => `${a}-${+/* @__PURE__ */ new Date()}-${Vt++}`, Yt = function(a) {
return typeof a < "u";
}, K = function(a) {
return typeof a == "function";
}, et = function(a) {
return Object.prototype.toString.call(a) === "[object Object]" && Object.getPrototypeOf(a) === Object.prototype;
}, tt = Array.isArray || function(a) {
return Object.prototype.toString.call(a) === "[object Array]";
}, Re = (a) => a && K(a.then);
function X(a, n, u) {
if (Yt(a.length))
for (var h = 0, d = a.length; h < d && n.call(u, a[h], h, a) !== !1; h++)
;
else
for (var _ in a)
if (n.call(u, a[_], _, a) === !1)
break;
}
function le() {
var a, n, u, h, d, _, v = arguments[0] || {}, m = 1, S = arguments.length, E = !1;
for (typeof v == "boolean" && (E = v, v = arguments[1] || {}, m++), typeof v != "object" && !K(v) && (v = {}), m === S && (v = this, m--); m < S; m++)
if ((a = arguments[m]) != null)
for (n in a)
u = v[n], h = a[n], v !== h && (E && h && (et(h) || (d = tt(h))) ? (d ? (d = !1, _ = u && tt(u) ? u : []) : _ = u && et(u) ? u : {}, v[n] = le(E, _, h)) : h !== void 0 && (v[n] = h));
return v;
}
class Ht {
constructor() {
this.event = {};
}
on(n, u) {
this.event || (this.event = {}), this.event[n] || (this.event[n] = []), !(this.event[n].indexOf(u) > -1) && this.event[n].push(u);
}
off(n, u) {
if (!u) {
this.event[n] = [];
return;
}
if (this.event && this.event[n]) {
for (let h = 0; h < this.event[n].length; h++)
if (u === this.event[n]) {
this.event.splice(h, 1);
return;
}
}
}
emit(n, ...u) {
this.event || (this.event = {}), this.event[n] && this.event[n].forEach((h) => {
h(...u);
});
}
once(n, u) {
function h(...d) {
u.apply(this, ...d), this.off(n, h);
}
h.func = u, this.on(n, h);
}
}
var st = { exports: {} };
(function(a, n) {
(function(u) {
a.exports = u();
})(function(u) {
var h = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"];
function d(c, o) {
var t = c[0], e = c[1], i = c[2], s = c[3];
t += (e & i | ~e & s) + o[0] - 680876936 | 0, t = (t << 7 | t >>> 25) + e | 0, s += (t & e | ~t & i) + o[1] - 389564586 | 0, s = (s << 12 | s >>> 20) + t | 0, i += (s & t | ~s & e) + o[2] + 606105819 | 0, i = (i << 17 | i >>> 15) + s | 0, e += (i & s | ~i & t) + o[3] - 1044525330 | 0, e = (e << 22 | e >>> 10) + i | 0, t += (e & i | ~e & s) + o[4] - 176418897 | 0, t = (t << 7 | t >>> 25) + e | 0, s += (t & e | ~t & i) + o[5] + 1200080426 | 0, s = (s << 12 | s >>> 20) + t | 0, i += (s & t | ~s & e) + o[6] - 1473231341 | 0, i = (i << 17 | i >>> 15) + s | 0, e += (i & s | ~i & t) + o[7] - 45705983 | 0, e = (e << 22 | e >>> 10) + i | 0, t += (e & i | ~e & s) + o[8] + 1770035416 | 0, t = (t << 7 | t >>> 25) + e | 0, s += (t & e | ~t & i) + o[9] - 1958414417 | 0, s = (s << 12 | s >>> 20) + t | 0, i += (s & t | ~s & e) + o[10] - 42063 | 0, i = (i << 17 | i >>> 15) + s | 0, e += (i & s | ~i & t) + o[11] - 1990404162 | 0, e = (e << 22 | e >>> 10) + i | 0, t += (e & i | ~e & s) + o[12] + 1804603682 | 0, t = (t << 7 | t >>> 25) + e | 0, s += (t & e | ~t & i) + o[13] - 40341101 | 0, s = (s << 12 | s >>> 20) + t | 0, i += (s & t | ~s & e) + o[14] - 1502002290 | 0, i = (i << 17 | i >>> 15) + s | 0, e += (i & s | ~i & t) + o[15] + 1236535329 | 0, e = (e << 22 | e >>> 10) + i | 0, t += (e & s | i & ~s) + o[1] - 165796510 | 0, t = (t << 5 | t >>> 27) + e | 0, s += (t & i | e & ~i) + o[6] - 1069501632 | 0, s = (s << 9 | s >>> 23) + t | 0, i += (s & e | t & ~e) + o[11] + 643717713 | 0, i = (i << 14 | i >>> 18) + s | 0, e += (i & t | s & ~t) + o[0] - 373897302 | 0, e = (e << 20 | e >>> 12) + i | 0, t += (e & s | i & ~s) + o[5] - 701558691 | 0, t = (t << 5 | t >>> 27) + e | 0, s += (t & i | e & ~i) + o[10] + 38016083 | 0, s = (s << 9 | s >>> 23) + t | 0, i += (s & e | t & ~e) + o[15] - 660478335 | 0, i = (i << 14 | i >>> 18) + s | 0, e += (i & t | s & ~t) + o[4] - 405537848 | 0, e = (e << 20 | e >>> 12) + i | 0, t += (e & s | i & ~s) + o[9] + 568446438 | 0, t = (t << 5 | t >>> 27) + e | 0, s += (t & i | e & ~i) + o[14] - 1019803690 | 0, s = (s << 9 | s >>> 23) + t | 0, i += (s & e | t & ~e) + o[3] - 187363961 | 0, i = (i << 14 | i >>> 18) + s | 0, e += (i & t | s & ~t) + o[8] + 1163531501 | 0, e = (e << 20 | e >>> 12) + i | 0, t += (e & s | i & ~s) + o[13] - 1444681467 | 0, t = (t << 5 | t >>> 27) + e | 0, s += (t & i | e & ~i) + o[2] - 51403784 | 0, s = (s << 9 | s >>> 23) + t | 0, i += (s & e | t & ~e) + o[7] + 1735328473 | 0, i = (i << 14 | i >>> 18) + s | 0, e += (i & t | s & ~t) + o[12] - 1926607734 | 0, e = (e << 20 | e >>> 12) + i | 0, t += (e ^ i ^ s) + o[5] - 378558 | 0, t = (t << 4 | t >>> 28) + e | 0, s += (t ^ e ^ i) + o[8] - 2022574463 | 0, s = (s << 11 | s >>> 21) + t | 0, i += (s ^ t ^ e) + o[11] + 1839030562 | 0, i = (i << 16 | i >>> 16) + s | 0, e += (i ^ s ^ t) + o[14] - 35309556 | 0, e = (e << 23 | e >>> 9) + i | 0, t += (e ^ i ^ s) + o[1] - 1530992060 | 0, t = (t << 4 | t >>> 28) + e | 0, s += (t ^ e ^ i) + o[4] + 1272893353 | 0, s = (s << 11 | s >>> 21) + t | 0, i += (s ^ t ^ e) + o[7] - 155497632 | 0, i = (i << 16 | i >>> 16) + s | 0, e += (i ^ s ^ t) + o[10] - 1094730640 | 0, e = (e << 23 | e >>> 9) + i | 0, t += (e ^ i ^ s) + o[13] + 681279174 | 0, t = (t << 4 | t >>> 28) + e | 0, s += (t ^ e ^ i) + o[0] - 358537222 | 0, s = (s << 11 | s >>> 21) + t | 0, i += (s ^ t ^ e) + o[3] - 722521979 | 0, i = (i << 16 | i >>> 16) + s | 0, e += (i ^ s ^ t) + o[6] + 76029189 | 0, e = (e << 23 | e >>> 9) + i | 0, t += (e ^ i ^ s) + o[9] - 640364487 | 0, t = (t << 4 | t >>> 28) + e | 0, s += (t ^ e ^ i) + o[12] - 421815835 | 0, s = (s << 11 | s >>> 21) + t | 0, i += (s ^ t ^ e) + o[15] + 530742520 | 0, i = (i << 16 | i >>> 16) + s | 0, e += (i ^ s ^ t) + o[2] - 995338651 | 0, e = (e << 23 | e >>> 9) + i | 0, t += (i ^ (e | ~s)) + o[0] - 198630844 | 0, t = (t << 6 | t >>> 26) + e | 0, s += (e ^ (t | ~i)) + o[7] + 1126891415 | 0, s = (s << 10 | s >>> 22) + t | 0, i += (t ^ (s | ~e)) + o[14] - 1416354905 | 0, i = (i << 15 | i >>> 17) + s | 0, e += (s ^ (i | ~t)) + o[5] - 57434055 | 0, e = (e << 21 | e >>> 11) + i | 0, t += (i ^ (e | ~s)) + o[12] + 1700485571 | 0, t = (t << 6 | t >>> 26) + e | 0, s += (e ^ (t | ~i)) + o[3] - 1894986606 | 0, s = (s << 10 | s >>> 22) + t | 0, i += (t ^ (s | ~e)) + o[10] - 1051523 | 0, i = (i << 15 | i >>> 17) + s | 0, e += (s ^ (i | ~t)) + o[1] - 2054922799 | 0, e = (e << 21 | e >>> 11) + i | 0, t += (i ^ (e | ~s)) + o[8] + 1873313359 | 0, t = (t << 6 | t >>> 26) + e | 0, s += (e ^ (t | ~i)) + o[15] - 30611744 | 0, s = (s << 10 | s >>> 22) + t | 0, i += (t ^ (s | ~e)) + o[6] - 1560198380 | 0, i = (i << 15 | i >>> 17) + s | 0, e += (s ^ (i | ~t)) + o[13] + 1309151649 | 0, e = (e << 21 | e >>> 11) + i | 0, t += (i ^ (e | ~s)) + o[4] - 145523070 | 0, t = (t << 6 | t >>> 26) + e | 0, s += (e ^ (t | ~i)) + o[11] - 1120210379 | 0, s = (s << 10 | s >>> 22) + t | 0, i += (t ^ (s | ~e)) + o[2] + 718787259 | 0, i = (i << 15 | i >>> 17) + s | 0, e += (s ^ (i | ~t)) + o[9] - 343485551 | 0, e = (e << 21 | e >>> 11) + i | 0, c[0] = t + c[0] | 0, c[1] = e + c[1] | 0, c[2] = i + c[2] | 0, c[3] = s + c[3] | 0;
}
function _(c) {
var o = [], t;
for (t = 0; t < 64; t += 4)
o[t >> 2] = c.charCodeAt(t) + (c.charCodeAt(t + 1) << 8) + (c.charCodeAt(t + 2) << 16) + (c.charCodeAt(t + 3) << 24);
return o;
}
function v(c) {
var o = [], t;
for (t = 0; t < 64; t += 4)
o[t >> 2] = c[t] + (c[t + 1] << 8) + (c[t + 2] << 16) + (c[t + 3] << 24);
return o;
}
function m(c) {
var o = c.length, t = [1732584193, -271733879, -1732584194, 271733878], e, i, s, O, U, w;
for (e = 64; e <= o; e += 64)
d(t, _(c.substring(e - 64, e)));
for (c = c.substring(e - 64), i = c.length, s = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], e = 0; e < i; e += 1)
s[e >> 2] |= c.charCodeAt(e) << (e % 4 << 3);
if (s[e >> 2] |= 128 << (e % 4 << 3), e > 55)
for (d(t, s), e = 0; e < 16; e += 1)
s[e] = 0;
return O = o * 8, O = O.toString(16).match(/(.*?)(.{0,8})$/), U = parseInt(O[2], 16), w = parseInt(O[1], 16) || 0, s[14] = U, s[15] = w, d(t, s), t;
}
function S(c) {
var o = c.length, t = [1732584193, -271733879, -1732584194, 271733878], e, i, s, O, U, w;
for (e = 64; e <= o; e += 64)
d(t, v(c.subarray(e - 64, e)));
for (c = e - 64 < o ? c.subarray(e - 64) : new Uint8Array(0), i = c.length, s = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], e = 0; e < i; e += 1)
s[e >> 2] |= c[e] << (e % 4 << 3);
if (s[e >> 2] |= 128 << (e % 4 << 3), e > 55)
for (d(t, s), e = 0; e < 16; e += 1)
s[e] = 0;
return O = o * 8, O = O.toString(16).match(/(.*?)(.{0,8})$/), U = parseInt(O[2], 16), w = parseInt(O[1], 16) || 0, s[14] = U, s[15] = w, d(t, s), t;
}
function E(c) {
var o = "", t;
for (t = 0; t < 4; t += 1)
o += h[c >> t * 8 + 4 & 15] + h[c >> t * 8 & 15];
return o;
}
function k(c) {
var o;
for (o = 0; o < c.length; o += 1)
c[o] = E(c[o]);
return c.join("");
}
k(m("hello")), typeof ArrayBuffer < "u" && !ArrayBuffer.prototype.slice && function() {
function c(o, t) {
return o = o | 0 || 0, o < 0 ? Math.max(o + t, 0) : Math.min(o, t);
}
ArrayBuffer.prototype.slice = function(o, t) {
var e = this.byteLength, i = c(o, e), s = e, O, U, w, F;
return t !== u && (s = c(t, e)), i > s ? new ArrayBuffer(0) : (O = s - i, U = new ArrayBuffer(O), w = new Uint8Array(U), F = new Uint8Array(this, i, O), w.set(F), U);
};
}();
function D(c) {
return /[\u0080-\uFFFF]/.test(c) && (c = unescape(encodeURIComponent(c))), c;
}
function N(c, o) {
var t = c.length, e = new ArrayBuffer(t), i = new Uint8Array(e), s;
for (s = 0; s < t; s += 1)
i[s] = c.charCodeAt(s);
return o ? i : e;
}
function q(c) {
return String.fromCharCode.apply(null, new Uint8Array(c));
}
function G(c, o, t) {
var e = new Uint8Array(c.byteLength + o.byteLength);
return e.set(new Uint8Array(c)), e.set(new Uint8Array(o), c.byteLength), e;
}
function $(c) {
var o = [], t = c.length, e;
for (e = 0; e < t - 1; e += 2)
o.push(parseInt(c.substr(e, 2), 16));
return String.fromCharCode.apply(String, o);
}
function C() {
this.reset();
}
return C.prototype.append = function(c) {
return this.appendBinary(D(c)), this;
}, C.prototype.appendBinary = function(c) {
this._buff += c, this._length += c.length;
var o = this._buff.length, t;
for (t = 64; t <= o; t += 64)
d(this._hash, _(this._buff.substring(t - 64, t)));
return this._buff = this._buff.substring(t - 64), this;
}, C.prototype.end = function(c) {
var o = this._buff, t = o.length, e, i = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], s;
for (e = 0; e < t; e += 1)
i[e >> 2] |= o.charCodeAt(e) << (e % 4 << 3);
return this._finish(i, t), s = k(this._hash), c && (s = $(s)), this.reset(), s;
}, C.prototype.reset = function() {
return this._buff = "", this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this;
}, C.prototype.getState = function() {
return {
buff: this._buff,
length: this._length,
hash: this._hash.slice()
};
}, C.prototype.setState = function(c) {
return this._buff = c.buff, this._length = c.length, this._hash = c.hash, this;
}, C.prototype.destroy = function() {
delete this._hash, delete this._buff, delete this._length;
}, C.prototype._finish = function(c, o) {
var t = o, e, i, s;
if (c[t >> 2] |= 128 << (t % 4 << 3), t > 55)
for (d(this._hash, c), t = 0; t < 16; t += 1)
c[t] = 0;
e = this._length * 8, e = e.toString(16).match(/(.*?)(.{0,8})$/), i = parseInt(e[2], 16), s = parseInt(e[1], 16) || 0, c[14] = i, c[15] = s, d(this._hash, c);
}, C.hash = function(c, o) {
return C.hashBinary(D(c), o);
}, C.hashBinary = function(c, o) {
var t = m(c), e = k(t);
return o ? $(e) : e;
}, C.ArrayBuffer = function() {
this.reset();
}, C.ArrayBuffer.prototype.append = function(c) {
var o = G(this._buff.buffer, c), t = o.length, e;
for (this._length += c.byteLength, e = 64; e <= t; e += 64)
d(this._hash, v(o.subarray(e - 64, e)));
return this._buff = e - 64 < t ? new Uint8Array(o.buffer.slice(e - 64)) : new Uint8Array(0), this;
}, C.ArrayBuffer.prototype.end = function(c) {
var o = this._buff, t = o.length, e = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], i, s;
for (i = 0; i < t; i += 1)
e[i >> 2] |= o[i] << (i % 4 << 3);
return this._finish(e, t), s = k(this._hash), c && (s = $(s)), this.reset(), s;
}, C.ArrayBuffer.prototype.reset = function() {
return this._buff = new Uint8Array(0), this._length = 0, this._hash = [1732584193, -271733879, -1732584194, 271733878], this;
}, C.ArrayBuffer.prototype.getState = function() {
var c = C.prototype.getState.call(this);
return c.buff = q(c.buff), c;
}, C.ArrayBuffer.prototype.setState = function(c) {
return c.buff = N(c.buff, !0), C.prototype.setState.call(this, c);
}, C.ArrayBuffer.prototype.destroy = C.prototype.destroy, C.ArrayBuffer.prototype._finish = C.prototype._finish, C.ArrayBuffer.hash = function(c, o) {
var t = S(new Uint8Array(c)), e = k(t);
return o ? $(e) : e;
}, C;
});
})(st);
var Gt = st.exports;
const Qt = `
/*
* Fastest md5 implementation around (JKM md5).
* Credits: Joseph Myers
*
* @see http://www.myersdaily.org/joseph/javascript/md5-text.html
* @see http://jsperf.com/md5-shootout/7
*/
/* this function is much faster,
so if possible we use it. Some IEs
are the only ones I know of that
need the idiotic second function,
generated by an if clause. */
var add32 = function (a, b) {
return (a + b) & 0xffffffff
},
hex_chr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']
function cmn(q, a, b, x, s, t) {
a = add32(add32(a, q), add32(x, t))
return add32((a << s) | (a >>> (32 - s)), b)
}
function md5cycle(x, k) {
var a = x[0],
b = x[1],
c = x[2],
d = x[3]
a += (((b & c) | (~b & d)) + k[0] - 680876936) | 0
a = (((a << 7) | (a >>> 25)) + b) | 0
d += (((a & b) | (~a & c)) + k[1] - 389564586) | 0
d = (((d << 12) | (d >>> 20)) + a) | 0
c += (((d & a) | (~d & b)) + k[2] + 606105819) | 0
c = (((c << 17) | (c >>> 15)) + d) | 0
b += (((c & d) | (~c & a)) + k[3] - 1044525330) | 0
b = (((b << 22) | (b >>> 10)) + c) | 0
a += (((b & c) | (~b & d)) + k[4] - 176418897) | 0
a = (((a << 7) | (a >>> 25)) + b) | 0
d += (((a & b) | (~a & c)) + k[5] + 1200080426) | 0
d = (((d << 12) | (d >>> 20)) + a) | 0
c += (((d & a) | (~d & b)) + k[6] - 1473231341) | 0
c = (((c << 17) | (c >>> 15)) + d) | 0
b += (((c & d) | (~c & a)) + k[7] - 45705983) | 0
b = (((b << 22) | (b >>> 10)) + c) | 0
a += (((b & c) | (~b & d)) + k[8] + 1770035416) | 0
a = (((a << 7) | (a >>> 25)) + b) | 0
d += (((a & b) | (~a & c)) + k[9] - 1958414417) | 0
d = (((d << 12) | (d >>> 20)) + a) | 0
c += (((d & a) | (~d & b)) + k[10] - 42063) | 0
c = (((c << 17) | (c >>> 15)) + d) | 0
b += (((c & d) | (~c & a)) + k[11] - 1990404162) | 0
b = (((b << 22) | (b >>> 10)) + c) | 0
a += (((b & c) | (~b & d)) + k[12] + 1804603682) | 0
a = (((a << 7) | (a >>> 25)) + b) | 0
d += (((a & b) | (~a & c)) + k[13] - 40341101) | 0
d = (((d << 12) | (d >>> 20)) + a) | 0
c += (((d & a) | (~d & b)) + k[14] - 1502002290) | 0
c = (((c << 17) | (c >>> 15)) + d) | 0
b += (((c & d) | (~c & a)) + k[15] + 1236535329) | 0
b = (((b << 22) | (b >>> 10)) + c) | 0
a += (((b & d) | (c & ~d)) + k[1] - 165796510) | 0
a = (((a << 5) | (a >>> 27)) + b) | 0
d += (((a & c) | (b & ~c)) + k[6] - 1069501632) | 0
d = (((d << 9) | (d >>> 23)) + a) | 0
c += (((d & b) | (a & ~b)) + k[11] + 643717713) | 0
c = (((c << 14) | (c >>> 18)) + d) | 0
b += (((c & a) | (d & ~a)) + k[0] - 373897302) | 0
b = (((b << 20) | (b >>> 12)) + c) | 0
a += (((b & d) | (c & ~d)) + k[5] - 701558691) | 0
a = (((a << 5) | (a >>> 27)) + b) | 0
d += (((a & c) | (b & ~c)) + k[10] + 38016083) | 0
d = (((d << 9) | (d >>> 23)) + a) | 0
c += (((d & b) | (a & ~b)) + k[15] - 660478335) | 0
c = (((c << 14) | (c >>> 18)) + d) | 0
b += (((c & a) | (d & ~a)) + k[4] - 405537848) | 0
b = (((b << 20) | (b >>> 12)) + c) | 0
a += (((b & d) | (c & ~d)) + k[9] + 568446438) | 0
a = (((a << 5) | (a >>> 27)) + b) | 0
d += (((a & c) | (b & ~c)) + k[14] - 1019803690) | 0
d = (((d << 9) | (d >>> 23)) + a) | 0
c += (((d & b) | (a & ~b)) + k[3] - 187363961) | 0
c = (((c << 14) | (c >>> 18)) + d) | 0
b += (((c & a) | (d & ~a)) + k[8] + 1163531501) | 0
b = (((b << 20) | (b >>> 12)) + c) | 0
a += (((b & d) | (c & ~d)) + k[13] - 1444681467) | 0
a = (((a << 5) | (a >>> 27)) + b) | 0
d += (((a & c) | (b & ~c)) + k[2] - 51403784) | 0
d = (((d << 9) | (d >>> 23)) + a) | 0
c += (((d & b) | (a & ~b)) + k[7] + 1735328473) | 0
c = (((c << 14) | (c >>> 18)) + d) | 0
b += (((c & a) | (d & ~a)) + k[12] - 1926607734) | 0
b = (((b << 20) | (b >>> 12)) + c) | 0
a += ((b ^ c ^ d) + k[5] - 378558) | 0
a = (((a << 4) | (a >>> 28)) + b) | 0
d += ((a ^ b ^ c) + k[8] - 2022574463) | 0
d = (((d << 11) | (d >>> 21)) + a) | 0
c += ((d ^ a ^ b) + k[11] + 1839030562) | 0
c = (((c << 16) | (c >>> 16)) + d) | 0
b += ((c ^ d ^ a) + k[14] - 35309556) | 0
b = (((b << 23) | (b >>> 9)) + c) | 0
a += ((b ^ c ^ d) + k[1] - 1530992060) | 0
a = (((a << 4) | (a >>> 28)) + b) | 0
d += ((a ^ b ^ c) + k[4] + 1272893353) | 0
d = (((d << 11) | (d >>> 21)) + a) | 0
c += ((d ^ a ^ b) + k[7] - 155497632) | 0
c = (((c << 16) | (c >>> 16)) + d) | 0
b += ((c ^ d ^ a) + k[10] - 1094730640) | 0
b = (((b << 23) | (b >>> 9)) + c) | 0
a += ((b ^ c ^ d) + k[13] + 681279174) | 0
a = (((a << 4) | (a >>> 28)) + b) | 0
d += ((a ^ b ^ c) + k[0] - 358537222) | 0
d = (((d << 11) | (d >>> 21)) + a) | 0
c += ((d ^ a ^ b) + k[3] - 722521979) | 0
c = (((c << 16) | (c >>> 16)) + d) | 0
b += ((c ^ d ^ a) + k[6] + 76029189) | 0
b = (((b << 23) | (b >>> 9)) + c) | 0
a += ((b ^ c ^ d) + k[9] - 640364487) | 0
a = (((a << 4) | (a >>> 28)) + b) | 0
d += ((a ^ b ^ c) + k[12] - 421815835) | 0
d = (((d << 11) | (d >>> 21)) + a) | 0
c += ((d ^ a ^ b) + k[15] + 530742520) | 0
c = (((c << 16) | (c >>> 16)) + d) | 0
b += ((c ^ d ^ a) + k[2] - 995338651) | 0
b = (((b << 23) | (b >>> 9)) + c) | 0
a += ((c ^ (b | ~d)) + k[0] - 198630844) | 0
a = (((a << 6) | (a >>> 26)) + b) | 0
d += ((b ^ (a | ~c)) + k[7] + 1126891415) | 0
d = (((d << 10) | (d >>> 22)) + a) | 0
c += ((a ^ (d | ~b)) + k[14] - 1416354905) | 0
c = (((c << 15) | (c >>> 17)) + d) | 0
b += ((d ^ (c | ~a)) + k[5] - 57434055) | 0
b = (((b << 21) | (b >>> 11)) + c) | 0
a += ((c ^ (b | ~d)) + k[12] + 1700485571) | 0
a = (((a << 6) | (a >>> 26)) + b) | 0
d += ((b ^ (a | ~c)) + k[3] - 1894986606) | 0
d = (((d << 10) | (d >>> 22)) + a) | 0
c += ((a ^ (d | ~b)) + k[10] - 1051523) | 0
c = (((c << 15) | (c >>> 17)) + d) | 0
b += ((d ^ (c | ~a)) + k[1] - 2054922799) | 0
b = (((b << 21) | (b >>> 11)) + c) | 0
a += ((c ^ (b | ~d)) + k[8] + 1873313359) | 0
a = (((a << 6) | (a >>> 26)) + b) | 0
d += ((b ^ (a | ~c)) + k[15] - 30611744) | 0
d = (((d << 10) | (d >>> 22)) + a) | 0
c += ((a ^ (d | ~b)) + k[6] - 1560198380) | 0
c = (((c << 15) | (c >>> 17)) + d) | 0
b += ((d ^ (c | ~a)) + k[13] + 1309151649) | 0
b = (((b << 21) | (b >>> 11)) + c) | 0
a += ((c ^ (b | ~d)) + k[4] - 145523070) | 0
a = (((a << 6) | (a >>> 26)) + b) | 0
d += ((b ^ (a | ~c)) + k[11] - 1120210379) | 0
d = (((d << 10) | (d >>> 22)) + a) | 0
c += ((a ^ (d | ~b)) + k[2] + 718787259) | 0
c = (((c << 15) | (c >>> 17)) + d) | 0
b += ((d ^ (c | ~a)) + k[9] - 343485551) | 0
b = (((b << 21) | (b >>> 11)) + c) | 0
x[0] = (a + x[0]) | 0
x[1] = (b + x[1]) | 0
x[2] = (c + x[2]) | 0
x[3] = (d + x[3]) | 0
}
function md5blk(s) {
var md5blks = [],
i /* Andy King said do it this way. */
for (i = 0; i < 64; i += 4) {
md5blks[i >> 2] =
s.charCodeAt(i) +
(s.charCodeAt(i + 1) << 8) +
(s.charCodeAt(i + 2) << 16) +
(s.charCodeAt(i + 3) << 24)
}
return md5blks
}
function md5blk_array(a) {
var md5blks = [],
i /* Andy King said do it this way. */
for (i = 0; i < 64; i += 4) {
md5blks[i >> 2] = a[i] + (a[i + 1] << 8) + (a[i + 2] << 16) + (a[i + 3] << 24)
}
return md5blks
}
function md51(s) {
var n = s.length,
state = [1732584193, -271733879, -1732584194, 271733878],
i,
length,
tail,
tmp,
lo,
hi
for (i = 64; i <= n; i += 64) {
md5cycle(state, md5blk(s.substring(i - 64, i)))
}
s = s.substring(i - 64)
length = s.length
tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for (i = 0; i < length; i += 1) {
tail[i >> 2] |= s.charCodeAt(i) << (i % 4 << 3)
}
tail[i >> 2] |= 0x80 << (i % 4 << 3)
if (i > 55) {
md5cycle(state, tail)
for (i = 0; i < 16; i += 1) {
tail[i] = 0
}
}
// Beware that the final length might not fit in 32 bits so we take care of that
tmp = n * 8
tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/)
lo = parseInt(tmp[2], 16)
hi = parseInt(tmp[1], 16) || 0
tail[14] = lo
tail[15] = hi
md5cycle(state, tail)
return state
}
function md51_array(a) {
var n = a.length,
state = [1732584193, -271733879, -1732584194, 271733878],
i,
length,
tail,
tmp,
lo,
hi
for (i = 64; i <= n; i += 64) {
md5cycle(state, md5blk_array(a.subarray(i - 64, i)))
}
// Not sure if it is a bug, however IE10 will always produce a sub array of length 1
// containing the last element of the parent array if the sub array specified starts
// beyond the length of the parent array - weird.
// https://connect.microsoft.com/IE/feedback/details/771452/typed-array-subarray-issue
a = i - 64 < n ? a.subarray(i - 64) : new Uint8Array(0)
length = a.length
tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
for (i = 0; i < length; i += 1) {
tail[i >> 2] |= a[i] << (i % 4 << 3)
}
tail[i >> 2] |= 0x80 << (i % 4 << 3)
if (i > 55) {
md5cycle(state, tail)
for (i = 0; i < 16; i += 1) {
tail[i] = 0
}
}
// Beware that the final length might not fit in 32 bits so we take care of that
tmp = n * 8
tmp = tmp.toString(16).match(/(.*?)(.{0,8})$/)
lo = parseInt(tmp[2], 16)
hi = parseInt(tmp[1], 16) || 0
tail[14] = lo
tail[15] = hi
md5cycle(state, tail)
return state
}
function rhex(n) {
var s = '',
j
for (j = 0; j < 4; j += 1) {
s += hex_chr[(n >> (j * 8 + 4)) & 0x0f] + hex_chr[(n >> (j * 8)) & 0x0f]
}
return s
}
function hex(x) {
var i
for (i = 0; i < x.length; i += 1) {
x[i] = rhex(x[i])
}
return x.join('')
}
// In some cases the fast add32 function cannot be used..
if (hex(md51('hello')) !== '5d41402abc4b2a76b9719d911017c592') {
add32 = function (x, y) {
var lsw = (x & 0xffff) + (y & 0xffff),
msw = (x >> 16) + (y >> 16) + (lsw >> 16)
return (msw << 16) | (lsw & 0xffff)
}
}
// ---------------------------------------------------
/**
* ArrayBuffer slice polyfill.
*
* @see https://github.com/ttaubert/node-arraybuffer-slice
*/
if (typeof ArrayBuffer !== 'undefined' && !ArrayBuffer.prototype.slice) {
;(function () {
function clamp(val, length) {
val = val | 0 || 0
if (val < 0) {
return Math.max(val + length, 0)
}
return Math.min(val, length)
}
ArrayBuffer.prototype.slice = function (from, to) {
var length = this.byteLength,
begin = clamp(from, length),
end = length,
num,
target,
targetArray,
sourceArray
if (to !== undefined) {
end = clamp(to, length)
}
if (begin > end) {
return new ArrayBuffer(0)
}
num = end - begin
target = new ArrayBuffer(num)
targetArray = new Uint8Array(target)
sourceArray = new Uint8Array(this, begin, num)
targetArray.set(sourceArray)
return target
}
})()
}
// ---------------------------------------------------
/**
* Helpers.
*/
function toUtf8(str) {
if (/[-]/.test(str)) {
str = unescape(encodeURIComponent(str))
}
return str
}
function utf8Str2ArrayBuffer(str, returnUInt8Array) {
var length = str.length,
buff = new ArrayBuffer(length),
arr = new Uint8Array(buff),
i
for (i = 0; i < length; i += 1) {
arr[i] = str.charCodeAt(i)
}
return returnUInt8Array ? arr : buff
}
function arrayBuffer2Utf8Str(buff) {
return String.fromCharCode.apply(null, new Uint8Array(buff))
}
function concatenateArrayBuffers(first, second, returnUInt8Array) {
var result = new Uint8Array(first.byteLength + second.byteLength)
result.set(new Uint8Array(first))
result.set(new Uint8Array(second), first.byteLength)
return returnUInt8Array ? result : result.buffer
}
function hexToBinaryString(hex) {
var bytes = [],
length = hex.length,
x
for (x = 0; x < length - 1; x += 2) {
bytes.push(parseInt(hex.substr(x, 2), 16))
}
return String.fromCharCode.apply(String, bytes)
}
// ---------------------------------------------------
/**
* SparkMD5 OOP implementation.
*
* Use this class to perform an incremental md5, otherwise use the
* static methods instead.
*/
function SparkMD5() {
// call reset to init the instance
this.reset()
}
/**
* Appends a string.
* A conversion will be applied if an utf8 string is detected.
*
* @param {String} str The string to be appended
*
* @return {SparkMD5} The instance itself
*/
SparkMD5.prototype.append = function (str) {
// Converts the string to utf8 bytes if necessary
// Then append as binary
this.appendBinary(toUtf8(str))
return this
}
/**
* Appends a binary string.
*
* @param {String} contents The binary string to be appended
*
* @return {SparkMD5} The instance itself
*/
SparkMD5.prototype.appendBinary = function (contents) {
this._buff += contents
this._length += contents.length
var length = this._buff.length,
i
for (i = 64; i <= length; i += 64) {
md5cycle(this._hash, md5blk(this._buff.substring(i - 64, i)))
}
this._buff = this._buff.substring(i - 64)
return this
}
/**
* Finishes the incremental computation, reseting the internal state and
* returning the result.
*
* @param {Boolean} raw True to get the raw string, false to get the hex string
*
* @return {String} The result
*/
SparkMD5.prototype.end = function (raw) {
var buff = this._buff,
length = buff.length,
i,
tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
ret
for (i = 0; i < length; i += 1) {
tail[i >> 2] |= buff.charCodeAt(i) << (i % 4 << 3)
}
this._finish(tail, length)
ret = hex(this._hash)
if (raw) {
ret = hexToBinaryString(ret)
}
this.reset()
return ret