@wgxshh/w-ui
Version:
1,234 lines • 243 kB
JavaScript
import { defineComponent as Pn, ref as Ht, resolveComponent as St, createElementBlock as oe, openBlock as Rt, createElementVNode as De, createVNode as At, onMounted as Mf, reactive as Tg, createCommentVNode as Vs, withCtx as Ft, createTextVNode as or, computed as ur, createBlock as Ye, Fragment as si, renderList as ui, getCurrentInstance as bg, isInSSRComponentSetup as Eg, injectHook as Dg, toDisplayString as Ns } from "vue";
import { Locale as Ms, useToast as Ag } from "wot-design-uni";
var nn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
function ai(o) {
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
}
var Bf = { exports: {} };
(function(o, i) {
(function(n, s) {
o.exports = s();
})(nn, function() {
var n = 1e3, s = 6e4, f = 36e5, h = "millisecond", p = "second", d = "minute", y = "hour", C = "day", B = "week", E = "month", I = "quarter", O = "year", R = "date", D = "Invalid Date", M = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, H = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, Q = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(G) {
var F = ["th", "st", "nd", "rd"], L = G % 100;
return "[" + G + (F[(L - 20) % 10] || F[L] || F[0]) + "]";
} }, q = function(G, F, L) {
var W = String(G);
return !W || W.length >= F ? G : "" + Array(F + 1 - W.length).join(L) + G;
}, et = { s: q, z: function(G) {
var F = -G.utcOffset(), L = Math.abs(F), W = Math.floor(L / 60), P = L % 60;
return (F <= 0 ? "+" : "-") + q(W, 2, "0") + ":" + q(P, 2, "0");
}, m: function G(F, L) {
if (F.date() < L.date()) return -G(L, F);
var W = 12 * (L.year() - F.year()) + (L.month() - F.month()), P = F.clone().add(W, E), j = L - P < 0, J = F.clone().add(W + (j ? -1 : 1), E);
return +(-(W + (L - P) / (j ? P - J : J - P)) || 0);
}, a: function(G) {
return G < 0 ? Math.ceil(G) || 0 : Math.floor(G);
}, p: function(G) {
return { M: E, y: O, w: B, d: C, D: R, h: y, m: d, s: p, ms: h, Q: I }[G] || String(G || "").toLowerCase().replace(/s$/, "");
}, u: function(G) {
return G === void 0;
} }, z = "en", U = {};
U[z] = Q;
var ht = "$isDayjsObject", yt = function(G) {
return G instanceof ke || !(!G || !G[ht]);
}, _t = function G(F, L, W) {
var P;
if (!F) return z;
if (typeof F == "string") {
var j = F.toLowerCase();
U[j] && (P = j), L && (U[j] = L, P = j);
var J = F.split("-");
if (!P && J.length > 1) return G(J[0]);
} else {
var ut = F.name;
U[ut] = F, P = ut;
}
return !W && P && (z = P), P || !W && z;
}, ct = function(G, F) {
if (yt(G)) return G.clone();
var L = typeof F == "object" ? F : {};
return L.date = G, L.args = arguments, new ke(L);
}, Z = et;
Z.l = _t, Z.i = yt, Z.w = function(G, F) {
return ct(G, { locale: F.$L, utc: F.$u, x: F.$x, $offset: F.$offset });
};
var ke = function() {
function G(L) {
this.$L = _t(L.locale, null, !0), this.parse(L), this.$x = this.$x || L.x || {}, this[ht] = !0;
}
var F = G.prototype;
return F.parse = function(L) {
this.$d = function(W) {
var P = W.date, j = W.utc;
if (P === null) return /* @__PURE__ */ new Date(NaN);
if (Z.u(P)) return /* @__PURE__ */ new Date();
if (P instanceof Date) return new Date(P);
if (typeof P == "string" && !/Z$/i.test(P)) {
var J = P.match(M);
if (J) {
var ut = J[2] - 1 || 0, Tt = (J[7] || "0").substring(0, 3);
return j ? new Date(Date.UTC(J[1], ut, J[3] || 1, J[4] || 0, J[5] || 0, J[6] || 0, Tt)) : new Date(J[1], ut, J[3] || 1, J[4] || 0, J[5] || 0, J[6] || 0, Tt);
}
}
return new Date(P);
}(L), this.init();
}, F.init = function() {
var L = this.$d;
this.$y = L.getFullYear(), this.$M = L.getMonth(), this.$D = L.getDate(), this.$W = L.getDay(), this.$H = L.getHours(), this.$m = L.getMinutes(), this.$s = L.getSeconds(), this.$ms = L.getMilliseconds();
}, F.$utils = function() {
return Z;
}, F.isValid = function() {
return this.$d.toString() !== D;
}, F.isSame = function(L, W) {
var P = ct(L);
return this.startOf(W) <= P && P <= this.endOf(W);
}, F.isAfter = function(L, W) {
return ct(L) < this.startOf(W);
}, F.isBefore = function(L, W) {
return this.endOf(W) < ct(L);
}, F.$g = function(L, W, P) {
return Z.u(L) ? this[W] : this.set(P, L);
}, F.unix = function() {
return Math.floor(this.valueOf() / 1e3);
}, F.valueOf = function() {
return this.$d.getTime();
}, F.startOf = function(L, W) {
var P = this, j = !!Z.u(W) || W, J = Z.p(L), ut = function(jt, Wt) {
var te = Z.w(P.$u ? Date.UTC(P.$y, Wt, jt) : new Date(P.$y, Wt, jt), P);
return j ? te : te.endOf(C);
}, Tt = function(jt, Wt) {
return Z.w(P.toDate()[jt].apply(P.toDate("s"), (j ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(Wt)), P);
}, Mt = this.$W, Pt = this.$M, Bt = this.$D, _e = "set" + (this.$u ? "UTC" : "");
switch (J) {
case O:
return j ? ut(1, 0) : ut(31, 11);
case E:
return j ? ut(1, Pt) : ut(0, Pt + 1);
case B:
var Me = this.$locale().weekStart || 0, me = (Mt < Me ? Mt + 7 : Mt) - Me;
return ut(j ? Bt - me : Bt + (6 - me), Pt);
case C:
case R:
return Tt(_e + "Hours", 0);
case y:
return Tt(_e + "Minutes", 1);
case d:
return Tt(_e + "Seconds", 2);
case p:
return Tt(_e + "Milliseconds", 3);
default:
return this.clone();
}
}, F.endOf = function(L) {
return this.startOf(L, !1);
}, F.$set = function(L, W) {
var P, j = Z.p(L), J = "set" + (this.$u ? "UTC" : ""), ut = (P = {}, P[C] = J + "Date", P[R] = J + "Date", P[E] = J + "Month", P[O] = J + "FullYear", P[y] = J + "Hours", P[d] = J + "Minutes", P[p] = J + "Seconds", P[h] = J + "Milliseconds", P)[j], Tt = j === C ? this.$D + (W - this.$W) : W;
if (j === E || j === O) {
var Mt = this.clone().set(R, 1);
Mt.$d[ut](Tt), Mt.init(), this.$d = Mt.set(R, Math.min(this.$D, Mt.daysInMonth())).$d;
} else ut && this.$d[ut](Tt);
return this.init(), this;
}, F.set = function(L, W) {
return this.clone().$set(L, W);
}, F.get = function(L) {
return this[Z.p(L)]();
}, F.add = function(L, W) {
var P, j = this;
L = Number(L);
var J = Z.p(W), ut = function(Pt) {
var Bt = ct(j);
return Z.w(Bt.date(Bt.date() + Math.round(Pt * L)), j);
};
if (J === E) return this.set(E, this.$M + L);
if (J === O) return this.set(O, this.$y + L);
if (J === C) return ut(1);
if (J === B) return ut(7);
var Tt = (P = {}, P[d] = s, P[y] = f, P[p] = n, P)[J] || 1, Mt = this.$d.getTime() + L * Tt;
return Z.w(Mt, this);
}, F.subtract = function(L, W) {
return this.add(-1 * L, W);
}, F.format = function(L) {
var W = this, P = this.$locale();
if (!this.isValid()) return P.invalidDate || D;
var j = L || "YYYY-MM-DDTHH:mm:ssZ", J = Z.z(this), ut = this.$H, Tt = this.$m, Mt = this.$M, Pt = P.weekdays, Bt = P.months, _e = P.meridiem, Me = function(Wt, te, Ae, un) {
return Wt && (Wt[te] || Wt(W, j)) || Ae[te].slice(0, un);
}, me = function(Wt) {
return Z.s(ut % 12 || 12, Wt, "0");
}, jt = _e || function(Wt, te, Ae) {
var un = Wt < 12 ? "AM" : "PM";
return Ae ? un.toLowerCase() : un;
};
return j.replace(H, function(Wt, te) {
return te || function(Ae) {
switch (Ae) {
case "YY":
return String(W.$y).slice(-2);
case "YYYY":
return Z.s(W.$y, 4, "0");
case "M":
return Mt + 1;
case "MM":
return Z.s(Mt + 1, 2, "0");
case "MMM":
return Me(P.monthsShort, Mt, Bt, 3);
case "MMMM":
return Me(Bt, Mt);
case "D":
return W.$D;
case "DD":
return Z.s(W.$D, 2, "0");
case "d":
return String(W.$W);
case "dd":
return Me(P.weekdaysMin, W.$W, Pt, 2);
case "ddd":
return Me(P.weekdaysShort, W.$W, Pt, 3);
case "dddd":
return Pt[W.$W];
case "H":
return String(ut);
case "HH":
return Z.s(ut, 2, "0");
case "h":
return me(1);
case "hh":
return me(2);
case "a":
return jt(ut, Tt, !0);
case "A":
return jt(ut, Tt, !1);
case "m":
return String(Tt);
case "mm":
return Z.s(Tt, 2, "0");
case "s":
return String(W.$s);
case "ss":
return Z.s(W.$s, 2, "0");
case "SSS":
return Z.s(W.$ms, 3, "0");
case "Z":
return J;
}
return null;
}(Wt) || J.replace(":", "");
});
}, F.utcOffset = function() {
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
}, F.diff = function(L, W, P) {
var j, J = this, ut = Z.p(W), Tt = ct(L), Mt = (Tt.utcOffset() - this.utcOffset()) * s, Pt = this - Tt, Bt = function() {
return Z.m(J, Tt);
};
switch (ut) {
case O:
j = Bt() / 12;
break;
case E:
j = Bt();
break;
case I:
j = Bt() / 3;
break;
case B:
j = (Pt - Mt) / 6048e5;
break;
case C:
j = (Pt - Mt) / 864e5;
break;
case y:
j = Pt / f;
break;
case d:
j = Pt / s;
break;
case p:
j = Pt / n;
break;
default:
j = Pt;
}
return P ? j : Z.a(j);
}, F.daysInMonth = function() {
return this.endOf(E).$D;
}, F.$locale = function() {
return U[this.$L];
}, F.locale = function(L, W) {
if (!L) return this.$L;
var P = this.clone(), j = _t(L, W, !0);
return j && (P.$L = j), P;
}, F.clone = function() {
return Z.w(this.$d, this);
}, F.toDate = function() {
return new Date(this.valueOf());
}, F.toJSON = function() {
return this.isValid() ? this.toISOString() : null;
}, F.toISOString = function() {
return this.$d.toISOString();
}, F.toString = function() {
return this.$d.toUTCString();
}, G;
}(), Ce = ke.prototype;
return ct.prototype = Ce, [["$ms", h], ["$s", p], ["$m", d], ["$H", y], ["$W", C], ["$M", E], ["$y", O], ["$D", R]].forEach(function(G) {
Ce[G[1]] = function(F) {
return this.$g(F, G[0], G[1]);
};
}), ct.extend = function(G, F) {
return G.$i || (G(F, ke, ct), G.$i = !0), ct;
}, ct.locale = _t, ct.isDayjs = yt, ct.unix = function(G) {
return ct(1e3 * G);
}, ct.en = U[z], ct.Ls = U, ct.p = {}, ct;
});
})(Bf);
var Rg = Bf.exports;
const Bs = /* @__PURE__ */ ai(Rg);
var $f = { exports: {} };
(function(o, i) {
(function(n, s) {
o.exports = s();
})(nn, function() {
var n = { year: 0, month: 1, day: 2, hour: 3, minute: 4, second: 5 }, s = {};
return function(f, h, p) {
var d, y = function(I, O, R) {
R === void 0 && (R = {});
var D = new Date(I), M = function(H, Q) {
Q === void 0 && (Q = {});
var q = Q.timeZoneName || "short", et = H + "|" + q, z = s[et];
return z || (z = new Intl.DateTimeFormat("en-US", { hour12: !1, timeZone: H, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", timeZoneName: q }), s[et] = z), z;
}(O, R);
return M.formatToParts(D);
}, C = function(I, O) {
for (var R = y(I, O), D = [], M = 0; M < R.length; M += 1) {
var H = R[M], Q = H.type, q = H.value, et = n[Q];
et >= 0 && (D[et] = parseInt(q, 10));
}
var z = D[3], U = z === 24 ? 0 : z, ht = D[0] + "-" + D[1] + "-" + D[2] + " " + U + ":" + D[4] + ":" + D[5] + ":000", yt = +I;
return (p.utc(ht).valueOf() - (yt -= yt % 1e3)) / 6e4;
}, B = h.prototype;
B.tz = function(I, O) {
I === void 0 && (I = d);
var R, D = this.utcOffset(), M = this.toDate(), H = M.toLocaleString("en-US", { timeZone: I }), Q = Math.round((M - new Date(H)) / 1e3 / 60), q = 15 * -Math.round(M.getTimezoneOffset() / 15) - Q;
if (!Number(q)) R = this.utcOffset(0, O);
else if (R = p(H, { locale: this.$L }).$set("millisecond", this.$ms).utcOffset(q, !0), O) {
var et = R.utcOffset();
R = R.add(D - et, "minute");
}
return R.$x.$timezone = I, R;
}, B.offsetName = function(I) {
var O = this.$x.$timezone || p.tz.guess(), R = y(this.valueOf(), O, { timeZoneName: I }).find(function(D) {
return D.type.toLowerCase() === "timezonename";
});
return R && R.value;
};
var E = B.startOf;
B.startOf = function(I, O) {
if (!this.$x || !this.$x.$timezone) return E.call(this, I, O);
var R = p(this.format("YYYY-MM-DD HH:mm:ss:SSS"), { locale: this.$L });
return E.call(R, I, O).tz(this.$x.$timezone, !0);
}, p.tz = function(I, O, R) {
var D = R && O, M = R || O || d, H = C(+p(), M);
if (typeof I != "string") return p(I).tz(M);
var Q = function(U, ht, yt) {
var _t = U - 60 * ht * 1e3, ct = C(_t, yt);
if (ht === ct) return [_t, ht];
var Z = C(_t -= 60 * (ct - ht) * 1e3, yt);
return ct === Z ? [_t, ct] : [U - 60 * Math.min(ct, Z) * 1e3, Math.max(ct, Z)];
}(p.utc(I, D).valueOf(), H, M), q = Q[0], et = Q[1], z = p(q).utcOffset(et);
return z.$x.$timezone = M, z;
}, p.tz.guess = function() {
return Intl.DateTimeFormat().resolvedOptions().timeZone;
}, p.tz.setDefault = function(I) {
d = I;
};
};
});
})($f);
var Og = $f.exports;
const Ig = /* @__PURE__ */ ai(Og);
var Lf = { exports: {} };
(function(o, i) {
(function(n, s) {
o.exports = s();
})(nn, function() {
var n = "minute", s = /[+-]\d\d(?::?\d\d)?/g, f = /([+-]|\d\d)/g;
return function(h, p, d) {
var y = p.prototype;
d.utc = function(D) {
var M = { date: D, utc: !0, args: arguments };
return new p(M);
}, y.utc = function(D) {
var M = d(this.toDate(), { locale: this.$L, utc: !0 });
return D ? M.add(this.utcOffset(), n) : M;
}, y.local = function() {
return d(this.toDate(), { locale: this.$L, utc: !1 });
};
var C = y.parse;
y.parse = function(D) {
D.utc && (this.$u = !0), this.$utils().u(D.$offset) || (this.$offset = D.$offset), C.call(this, D);
};
var B = y.init;
y.init = function() {
if (this.$u) {
var D = this.$d;
this.$y = D.getUTCFullYear(), this.$M = D.getUTCMonth(), this.$D = D.getUTCDate(), this.$W = D.getUTCDay(), this.$H = D.getUTCHours(), this.$m = D.getUTCMinutes(), this.$s = D.getUTCSeconds(), this.$ms = D.getUTCMilliseconds();
} else B.call(this);
};
var E = y.utcOffset;
y.utcOffset = function(D, M) {
var H = this.$utils().u;
if (H(D)) return this.$u ? 0 : H(this.$offset) ? E.call(this) : this.$offset;
if (typeof D == "string" && (D = function(z) {
z === void 0 && (z = "");
var U = z.match(s);
if (!U) return null;
var ht = ("" + U[0]).match(f) || ["-", 0, 0], yt = ht[0], _t = 60 * +ht[1] + +ht[2];
return _t === 0 ? 0 : yt === "+" ? _t : -_t;
}(D), D === null)) return this;
var Q = Math.abs(D) <= 16 ? 60 * D : D, q = this;
if (M) return q.$offset = Q, q.$u = D === 0, q;
if (D !== 0) {
var et = this.$u ? this.toDate().getTimezoneOffset() : -1 * this.utcOffset();
(q = this.local().add(Q + et, n)).$offset = Q, q.$x.$localOffset = et;
} else q = this.utc();
return q;
};
var I = y.format;
y.format = function(D) {
var M = D || (this.$u ? "YYYY-MM-DDTHH:mm:ss[Z]" : "");
return I.call(this, M);
}, y.valueOf = function() {
var D = this.$utils().u(this.$offset) ? 0 : this.$offset + (this.$x.$localOffset || this.$d.getTimezoneOffset());
return this.$d.valueOf() - 6e4 * D;
}, y.isUTC = function() {
return !!this.$u;
}, y.toISOString = function() {
return this.toDate().toISOString();
}, y.toString = function() {
return this.toDate().toUTCString();
};
var O = y.toDate;
y.toDate = function(D) {
return D === "s" && this.$offset ? d(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate() : O.call(this);
};
var R = y.diff;
y.diff = function(D, M, H) {
if (D && this.$u === D.$u) return R.call(this, D, M, H);
var Q = this.local(), q = d(D).local();
return R.call(Q, q, M, H);
};
};
});
})(Lf);
var Cg = Lf.exports;
const Mg = /* @__PURE__ */ ai(Cg);
function Nn(o) {
const i = uni.getStorageSync("baseUrl") || "/", n = uni.getStorageSync("hydrocarbonProgramToken") || "", s = uni.getStorageSync("token") || "", f = o.header || {};
return new Promise((h, p) => {
uni.request({
url: i + o.url,
method: o.method || "GET",
data: o.data || {},
header: {
"content-type": "application/x-www-form-urlencoded",
"hydrocarbon-program-token": n,
// 项目code
"hydrocarbon-token": s,
// 登录token
"hydrocarbon-client": "MOBILE",
// #ifdef APP-PLUS
"hydrocarbon-app-version": "1.0.0",
// #endif
...f
},
dataType: "json",
// #ifndef MP-WEIXIN
responseType: "json",
// #endif
success: (d) => {
d.statusCode >= 200 && d.statusCode < 300 && h(d), d.statusCode === 401 && (uni.showToast({ title: "登录过期,请重新登录", icon: "none" }), uni.removeStorageSync("token"), uni.reLaunch({ url: "/pages/login/login" })), d.statusCode === 404 && (uni.showToast({ title: "请求失败", icon: "none" }), p(d)), d.statusCode === 500 && (uni.showToast({ title: "服务器错误", icon: "none" }), p(d));
},
fail: (d) => {
uni.showToast({ title: "请求失败", icon: "none" }), p(d);
}
});
});
}
var Bg = "0123456789abcdefghijklmnopqrstuvwxyz";
function qe(o) {
return Bg.charAt(o);
}
function $g(o, i) {
return o & i;
}
function Qr(o, i) {
return o | i;
}
function wf(o, i) {
return o ^ i;
}
function Sf(o, i) {
return o & ~i;
}
function Lg(o) {
if (o == 0)
return -1;
var i = 0;
return o & 65535 || (o >>= 16, i += 16), o & 255 || (o >>= 8, i += 8), o & 15 || (o >>= 4, i += 4), o & 3 || (o >>= 2, i += 2), o & 1 || ++i, i;
}
function Pg(o) {
for (var i = 0; o != 0; )
o &= o - 1, ++i;
return i;
}
var $n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", Pf = "=";
function oi(o) {
var i, n, s = "";
for (i = 0; i + 3 <= o.length; i += 3)
n = parseInt(o.substring(i, i + 3), 16), s += $n.charAt(n >> 6) + $n.charAt(n & 63);
for (i + 1 == o.length ? (n = parseInt(o.substring(i, i + 1), 16), s += $n.charAt(n << 2)) : i + 2 == o.length && (n = parseInt(o.substring(i, i + 2), 16), s += $n.charAt(n >> 2) + $n.charAt((n & 3) << 4)); (s.length & 3) > 0; )
s += Pf;
return s;
}
function xf(o) {
var i = "", n, s = 0, f = 0;
for (n = 0; n < o.length && o.charAt(n) != Pf; ++n) {
var h = $n.indexOf(o.charAt(n));
h < 0 || (s == 0 ? (i += qe(h >> 2), f = h & 3, s = 1) : s == 1 ? (i += qe(f << 2 | h >> 4), f = h & 15, s = 2) : s == 2 ? (i += qe(f), i += qe(h >> 2), f = h & 3, s = 3) : (i += qe(f << 2 | h >> 4), i += qe(h & 15), s = 0));
}
return s == 1 && (i += qe(f << 2)), i;
}
var Mn, Ng = {
decode: function(o) {
var i;
if (Mn === void 0) {
var n = "0123456789ABCDEF", s = ` \f
\r \u2028\u2029`;
for (Mn = {}, i = 0; i < 16; ++i)
Mn[n.charAt(i)] = i;
for (n = n.toLowerCase(), i = 10; i < 16; ++i)
Mn[n.charAt(i)] = i;
for (i = 0; i < s.length; ++i)
Mn[s.charAt(i)] = -1;
}
var f = [], h = 0, p = 0;
for (i = 0; i < o.length; ++i) {
var d = o.charAt(i);
if (d == "=")
break;
if (d = Mn[d], d != -1) {
if (d === void 0)
throw new Error("Illegal character at offset " + i);
h |= d, ++p >= 2 ? (f[f.length] = h, h = 0, p = 0) : h <<= 4;
}
}
if (p)
throw new Error("Hex encoding incomplete: 4 bits missing");
return f;
}
}, vn, Fs = {
decode: function(o) {
var i;
if (vn === void 0) {
var n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", s = `= \f
\r \u2028\u2029`;
for (vn = /* @__PURE__ */ Object.create(null), i = 0; i < 64; ++i)
vn[n.charAt(i)] = i;
for (vn["-"] = 62, vn._ = 63, i = 0; i < s.length; ++i)
vn[s.charAt(i)] = -1;
}
var f = [], h = 0, p = 0;
for (i = 0; i < o.length; ++i) {
var d = o.charAt(i);
if (d == "=")
break;
if (d = vn[d], d != -1) {
if (d === void 0)
throw new Error("Illegal character at offset " + i);
h |= d, ++p >= 4 ? (f[f.length] = h >> 16, f[f.length] = h >> 8 & 255, f[f.length] = h & 255, h = 0, p = 0) : h <<= 6;
}
}
switch (p) {
case 1:
throw new Error("Base64 encoding incomplete: at least 2 bits missing");
case 2:
f[f.length] = h >> 10;
break;
case 3:
f[f.length] = h >> 16, f[f.length] = h >> 8 & 255;
break;
}
return f;
},
re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
unarmor: function(o) {
var i = Fs.re.exec(o);
if (i)
if (i[1])
o = i[1];
else if (i[2])
o = i[2];
else
throw new Error("RegExp out of sync");
return Fs.decode(o);
}
}, Bn = 1e13, sr = (
/** @class */
function() {
function o(i) {
this.buf = [+i || 0];
}
return o.prototype.mulAdd = function(i, n) {
var s = this.buf, f = s.length, h, p;
for (h = 0; h < f; ++h)
p = s[h] * i + n, p < Bn ? n = 0 : (n = 0 | p / Bn, p -= n * Bn), s[h] = p;
n > 0 && (s[h] = n);
}, o.prototype.sub = function(i) {
var n = this.buf, s = n.length, f, h;
for (f = 0; f < s; ++f)
h = n[f] - i, h < 0 ? (h += Bn, i = 1) : i = 0, n[f] = h;
for (; n[n.length - 1] === 0; )
n.pop();
}, o.prototype.toString = function(i) {
if ((i || 10) != 10)
throw new Error("only base 10 is supported");
for (var n = this.buf, s = n[n.length - 1].toString(), f = n.length - 2; f >= 0; --f)
s += (Bn + n[f]).toString().substring(1);
return s;
}, o.prototype.valueOf = function() {
for (var i = this.buf, n = 0, s = i.length - 1; s >= 0; --s)
n = n * Bn + i[s];
return n;
}, o.prototype.simplify = function() {
var i = this.buf;
return i.length == 1 ? i[0] : this;
}, o;
}()
), Nf = "…", Fg = /^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/, Ug = /^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(Z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;
function Ln(o, i) {
return o.length > i && (o = o.substring(0, i) + Nf), o;
}
var $s = (
/** @class */
function() {
function o(i, n) {
this.hexDigits = "0123456789ABCDEF", i instanceof o ? (this.enc = i.enc, this.pos = i.pos) : (this.enc = i, this.pos = n);
}
return o.prototype.get = function(i) {
if (i === void 0 && (i = this.pos++), i >= this.enc.length)
throw new Error("Requesting byte offset ".concat(i, " on a stream of length ").concat(this.enc.length));
return typeof this.enc == "string" ? this.enc.charCodeAt(i) : this.enc[i];
}, o.prototype.hexByte = function(i) {
return this.hexDigits.charAt(i >> 4 & 15) + this.hexDigits.charAt(i & 15);
}, o.prototype.hexDump = function(i, n, s) {
for (var f = "", h = i; h < n; ++h)
if (f += this.hexByte(this.get(h)), s !== !0)
switch (h & 15) {
case 7:
f += " ";
break;
case 15:
f += `
`;
break;
default:
f += " ";
}
return f;
}, o.prototype.isASCII = function(i, n) {
for (var s = i; s < n; ++s) {
var f = this.get(s);
if (f < 32 || f > 176)
return !1;
}
return !0;
}, o.prototype.parseStringISO = function(i, n) {
for (var s = "", f = i; f < n; ++f)
s += String.fromCharCode(this.get(f));
return s;
}, o.prototype.parseStringUTF = function(i, n) {
for (var s = "", f = i; f < n; ) {
var h = this.get(f++);
h < 128 ? s += String.fromCharCode(h) : h > 191 && h < 224 ? s += String.fromCharCode((h & 31) << 6 | this.get(f++) & 63) : s += String.fromCharCode((h & 15) << 12 | (this.get(f++) & 63) << 6 | this.get(f++) & 63);
}
return s;
}, o.prototype.parseStringBMP = function(i, n) {
for (var s = "", f, h, p = i; p < n; )
f = this.get(p++), h = this.get(p++), s += String.fromCharCode(f << 8 | h);
return s;
}, o.prototype.parseTime = function(i, n, s) {
var f = this.parseStringISO(i, n), h = (s ? Fg : Ug).exec(f);
return h ? (s && (h[1] = +h[1], h[1] += +h[1] < 70 ? 2e3 : 1900), f = h[1] + "-" + h[2] + "-" + h[3] + " " + h[4], h[5] && (f += ":" + h[5], h[6] && (f += ":" + h[6], h[7] && (f += "." + h[7]))), h[8] && (f += " UTC", h[8] != "Z" && (f += h[8], h[9] && (f += ":" + h[9]))), f) : "Unrecognized time: " + f;
}, o.prototype.parseInteger = function(i, n) {
for (var s = this.get(i), f = s > 127, h = f ? 255 : 0, p, d = ""; s == h && ++i < n; )
s = this.get(i);
if (p = n - i, p === 0)
return f ? -1 : 0;
if (p > 4) {
for (d = s, p <<= 3; !((+d ^ h) & 128); )
d = +d << 1, --p;
d = "(" + p + ` bit)
`;
}
f && (s = s - 256);
for (var y = new sr(s), C = i + 1; C < n; ++C)
y.mulAdd(256, this.get(C));
return d + y.toString();
}, o.prototype.parseBitString = function(i, n, s) {
for (var f = this.get(i), h = (n - i - 1 << 3) - f, p = "(" + h + ` bit)
`, d = "", y = i + 1; y < n; ++y) {
for (var C = this.get(y), B = y == n - 1 ? f : 0, E = 7; E >= B; --E)
d += C >> E & 1 ? "1" : "0";
if (d.length > s)
return p + Ln(d, s);
}
return p + d;
}, o.prototype.parseOctetString = function(i, n, s) {
if (this.isASCII(i, n))
return Ln(this.parseStringISO(i, n), s);
var f = n - i, h = "(" + f + ` byte)
`;
s /= 2, f > s && (n = i + s);
for (var p = i; p < n; ++p)
h += this.hexByte(this.get(p));
return f > s && (h += Nf), h;
}, o.prototype.parseOID = function(i, n, s) {
for (var f = "", h = new sr(), p = 0, d = i; d < n; ++d) {
var y = this.get(d);
if (h.mulAdd(128, y & 127), p += 7, !(y & 128)) {
if (f === "")
if (h = h.simplify(), h instanceof sr)
h.sub(80), f = "2." + h.toString();
else {
var C = h < 80 ? h < 40 ? 0 : 1 : 2;
f = C + "." + (h - C * 40);
}
else
f += "." + h.toString();
if (f.length > s)
return Ln(f, s);
h = new sr(), p = 0;
}
}
return p > 0 && (f += ".incomplete"), f;
}, o;
}()
), Vg = (
/** @class */
function() {
function o(i, n, s, f, h) {
if (!(f instanceof Tf))
throw new Error("Invalid tag value.");
this.stream = i, this.header = n, this.length = s, this.tag = f, this.sub = h;
}
return o.prototype.typeName = function() {
switch (this.tag.tagClass) {
case 0:
switch (this.tag.tagNumber) {
case 0:
return "EOC";
case 1:
return "BOOLEAN";
case 2:
return "INTEGER";
case 3:
return "BIT_STRING";
case 4:
return "OCTET_STRING";
case 5:
return "NULL";
case 6:
return "OBJECT_IDENTIFIER";
case 7:
return "ObjectDescriptor";
case 8:
return "EXTERNAL";
case 9:
return "REAL";
case 10:
return "ENUMERATED";
case 11:
return "EMBEDDED_PDV";
case 12:
return "UTF8String";
case 16:
return "SEQUENCE";
case 17:
return "SET";
case 18:
return "NumericString";
case 19:
return "PrintableString";
case 20:
return "TeletexString";
case 21:
return "VideotexString";
case 22:
return "IA5String";
case 23:
return "UTCTime";
case 24:
return "GeneralizedTime";
case 25:
return "GraphicString";
case 26:
return "VisibleString";
case 27:
return "GeneralString";
case 28:
return "UniversalString";
case 30:
return "BMPString";
}
return "Universal_" + this.tag.tagNumber.toString();
case 1:
return "Application_" + this.tag.tagNumber.toString();
case 2:
return "[" + this.tag.tagNumber.toString() + "]";
case 3:
return "Private_" + this.tag.tagNumber.toString();
}
}, o.prototype.content = function(i) {
if (this.tag === void 0)
return null;
i === void 0 && (i = 1 / 0);
var n = this.posContent(), s = Math.abs(this.length);
if (!this.tag.isUniversal())
return this.sub !== null ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(n, n + s, i);
switch (this.tag.tagNumber) {
case 1:
return this.stream.get(n) === 0 ? "false" : "true";
case 2:
return this.stream.parseInteger(n, n + s);
case 3:
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(n, n + s, i);
case 4:
return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(n, n + s, i);
case 6:
return this.stream.parseOID(n, n + s, i);
case 16:
case 17:
return this.sub !== null ? "(" + this.sub.length + " elem)" : "(no elem)";
case 12:
return Ln(this.stream.parseStringUTF(n, n + s), i);
case 18:
case 19:
case 20:
case 21:
case 22:
case 26:
return Ln(this.stream.parseStringISO(n, n + s), i);
case 30:
return Ln(this.stream.parseStringBMP(n, n + s), i);
case 23:
case 24:
return this.stream.parseTime(n, n + s, this.tag.tagNumber == 23);
}
return null;
}, o.prototype.toString = function() {
return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (this.sub === null ? "null" : this.sub.length) + "]";
}, o.prototype.toPrettyString = function(i) {
i === void 0 && (i = "");
var n = i + this.typeName() + " @" + this.stream.pos;
if (this.length >= 0 && (n += "+"), n += this.length, this.tag.tagConstructed ? n += " (constructed)" : this.tag.isUniversal() && (this.tag.tagNumber == 3 || this.tag.tagNumber == 4) && this.sub !== null && (n += " (encapsulates)"), n += `
`, this.sub !== null) {
i += " ";
for (var s = 0, f = this.sub.length; s < f; ++s)
n += this.sub[s].toPrettyString(i);
}
return n;
}, o.prototype.posStart = function() {
return this.stream.pos;
}, o.prototype.posContent = function() {
return this.stream.pos + this.header;
}, o.prototype.posEnd = function() {
return this.stream.pos + this.header + Math.abs(this.length);
}, o.prototype.toHexString = function() {
return this.stream.hexDump(this.posStart(), this.posEnd(), !0);
}, o.decodeLength = function(i) {
var n = i.get(), s = n & 127;
if (s == n)
return s;
if (s > 6)
throw new Error("Length over 48 bits not supported at position " + (i.pos - 1));
if (s === 0)
return null;
n = 0;
for (var f = 0; f < s; ++f)
n = n * 256 + i.get();
return n;
}, o.prototype.getHexStringValue = function() {
var i = this.toHexString(), n = this.header * 2, s = this.length * 2;
return i.substr(n, s);
}, o.decode = function(i) {
var n;
i instanceof $s ? n = i : n = new $s(i, 0);
var s = new $s(n), f = new Tf(n), h = o.decodeLength(n), p = n.pos, d = p - s.pos, y = null, C = function() {
var E = [];
if (h !== null) {
for (var I = p + h; n.pos < I; )
E[E.length] = o.decode(n);
if (n.pos != I)
throw new Error("Content size is not correct for container starting at offset " + p);
} else
try {
for (; ; ) {
var O = o.decode(n);
if (O.tag.isEOC())
break;
E[E.length] = O;
}
h = p - n.pos;
} catch (R) {
throw new Error("Exception while decoding undefined length content: " + R);
}
return E;
};
if (f.tagConstructed)
y = C();
else if (f.isUniversal() && (f.tagNumber == 3 || f.tagNumber == 4))
try {
if (f.tagNumber == 3 && n.get() != 0)
throw new Error("BIT STRINGs with unused bits cannot encapsulate.");
y = C();
for (var B = 0; B < y.length; ++B)
if (y[B].tag.isEOC())
throw new Error("EOC is not supposed to be actual content.");
} catch {
y = null;
}
if (y === null) {
if (h === null)
throw new Error("We can't skip over an invalid tag with undefined length at offset " + p);
n.pos = p + Math.abs(h);
}
return new o(s, d, h, f, y);
}, o;
}()
), Tf = (
/** @class */
function() {
function o(i) {
var n = i.get();
if (this.tagClass = n >> 6, this.tagConstructed = (n & 32) !== 0, this.tagNumber = n & 31, this.tagNumber == 31) {
var s = new sr();
do
n = i.get(), s.mulAdd(128, n & 127);
while (n & 128);
this.tagNumber = s.simplify();
}
}
return o.prototype.isUniversal = function() {
return this.tagClass === 0;
}, o.prototype.isEOC = function() {
return this.tagClass === 0 && this.tagNumber === 0;
}, o;
}()
), sn, Hg = 244837814094590, bf = (Hg & 16777215) == 15715070, Gt = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997], Wg = (1 << 26) / Gt[Gt.length - 1], rt = (
/** @class */
function() {
function o(i, n, s) {
i != null && (typeof i == "number" ? this.fromNumber(i, n, s) : n == null && typeof i != "string" ? this.fromString(i, 256) : this.fromString(i, n));
}
return o.prototype.toString = function(i) {
if (this.s < 0)
return "-" + this.negate().toString(i);
var n;
if (i == 16)
n = 4;
else if (i == 8)
n = 3;
else if (i == 2)
n = 1;
else if (i == 32)
n = 5;
else if (i == 4)
n = 2;
else
return this.toRadix(i);
var s = (1 << n) - 1, f, h = !1, p = "", d = this.t, y = this.DB - d * this.DB % n;
if (d-- > 0)
for (y < this.DB && (f = this[d] >> y) > 0 && (h = !0, p = qe(f)); d >= 0; )
y < n ? (f = (this[d] & (1 << y) - 1) << n - y, f |= this[--d] >> (y += this.DB - n)) : (f = this[d] >> (y -= n) & s, y <= 0 && (y += this.DB, --d)), f > 0 && (h = !0), h && (p += qe(f));
return h ? p : "0";
}, o.prototype.negate = function() {
var i = ft();
return o.ZERO.subTo(this, i), i;
}, o.prototype.abs = function() {
return this.s < 0 ? this.negate() : this;
}, o.prototype.compareTo = function(i) {
var n = this.s - i.s;
if (n != 0)
return n;
var s = this.t;
if (n = s - i.t, n != 0)
return this.s < 0 ? -n : n;
for (; --s >= 0; )
if ((n = this[s] - i[s]) != 0)
return n;
return 0;
}, o.prototype.bitLength = function() {
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + jr(this[this.t - 1] ^ this.s & this.DM);
}, o.prototype.mod = function(i) {
var n = ft();
return this.abs().divRemTo(i, null, n), this.s < 0 && n.compareTo(o.ZERO) > 0 && i.subTo(n, n), n;
}, o.prototype.modPowInt = function(i, n) {
var s;
return i < 256 || n.isEven() ? s = new Ef(n) : s = new Df(n), this.exp(i, s);
}, o.prototype.clone = function() {
var i = ft();
return this.copyTo(i), i;
}, o.prototype.intValue = function() {
if (this.s < 0) {
if (this.t == 1)
return this[0] - this.DV;
if (this.t == 0)
return -1;
} else {
if (this.t == 1)
return this[0];
if (this.t == 0)
return 0;
}
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
}, o.prototype.byteValue = function() {
return this.t == 0 ? this.s : this[0] << 24 >> 24;
}, o.prototype.shortValue = function() {
return this.t == 0 ? this.s : this[0] << 16 >> 16;
}, o.prototype.signum = function() {
return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1;
}, o.prototype.toByteArray = function() {
var i = this.t, n = [];
n[0] = this.s;
var s = this.DB - i * this.DB % 8, f, h = 0;
if (i-- > 0)
for (s < this.DB && (f = this[i] >> s) != (this.s & this.DM) >> s && (n[h++] = f | this.s << this.DB - s); i >= 0; )
s < 8 ? (f = (this[i] & (1 << s) - 1) << 8 - s, f |= this[--i] >> (s += this.DB - 8)) : (f = this[i] >> (s -= 8) & 255, s <= 0 && (s += this.DB, --i)), f & 128 && (f |= -256), h == 0 && (this.s & 128) != (f & 128) && ++h, (h > 0 || f != this.s) && (n[h++] = f);
return n;
}, o.prototype.equals = function(i) {
return this.compareTo(i) == 0;
}, o.prototype.min = function(i) {
return this.compareTo(i) < 0 ? this : i;
}, o.prototype.max = function(i) {
return this.compareTo(i) > 0 ? this : i;
}, o.prototype.and = function(i) {
var n = ft();
return this.bitwiseTo(i, $g, n), n;
}, o.prototype.or = function(i) {
var n = ft();
return this.bitwiseTo(i, Qr, n), n;
}, o.prototype.xor = function(i) {
var n = ft();
return this.bitwiseTo(i, wf, n), n;
}, o.prototype.andNot = function(i) {
var n = ft();
return this.bitwiseTo(i, Sf, n), n;
}, o.prototype.not = function() {
for (var i = ft(), n = 0; n < this.t; ++n)
i[n] = this.DM & ~this[n];
return i.t = this.t, i.s = ~this.s, i;
}, o.prototype.shiftLeft = function(i) {
var n = ft();
return i < 0 ? this.rShiftTo(-i, n) : this.lShiftTo(i, n), n;
}, o.prototype.shiftRight = function(i) {
var n = ft();
return i < 0 ? this.lShiftTo(-i, n) : this.rShiftTo(i, n), n;
}, o.prototype.getLowestSetBit = function() {
for (var i = 0; i < this.t; ++i)
if (this[i] != 0)
return i * this.DB + Lg(this[i]);
return this.s < 0 ? this.t * this.DB : -1;
}, o.prototype.bitCount = function() {
for (var i = 0, n = this.s & this.DM, s = 0; s < this.t; ++s)
i += Pg(this[s] ^ n);
return i;
}, o.prototype.testBit = function(i) {
var n = Math.floor(i / this.DB);
return n >= this.t ? this.s != 0 : (this[n] & 1 << i % this.DB) != 0;
}, o.prototype.setBit = function(i) {
return this.changeBit(i, Qr);
}, o.prototype.clearBit = function(i) {
return this.changeBit(i, Sf);
}, o.prototype.flipBit = function(i) {
return this.changeBit(i, wf);
}, o.prototype.add = function(i) {
var n = ft();
return this.addTo(i, n), n;
}, o.prototype.subtract = function(i) {
var n = ft();
return this.subTo(i, n), n;
}, o.prototype.multiply = function(i) {
var n = ft();
return this.multiplyTo(i, n), n;
}, o.prototype.divide = function(i) {
var n = ft();
return this.divRemTo(i, n, null), n;
}, o.prototype.remainder = function(i) {
var n = ft();
return this.divRemTo(i, null, n), n;
}, o.prototype.divideAndRemainder = function(i) {
var n = ft(), s = ft();
return this.divRemTo(i, n, s), [n, s];
}, o.prototype.modPow = function(i, n) {
var s = i.bitLength(), f, h = en(1), p;
if (s <= 0)
return h;
s < 18 ? f = 1 : s < 48 ? f = 3 : s < 144 ? f = 4 : s < 768 ? f = 5 : f = 6, s < 8 ? p = new Ef(n) : n.isEven() ? p = new Yg(n) : p = new Df(n);
var d = [], y = 3, C = f - 1, B = (1 << f) - 1;
if (d[1] = p.convert(this), f > 1) {
var E = ft();
for (p.sqrTo(d[1], E); y <= B; )
d[y] = ft(), p.mulTo(E, d[y - 2], d[y]), y += 2;
}
var I = i.t - 1, O, R = !0, D = ft(), M;
for (s = jr(i[I]) - 1; I >= 0; ) {
for (s >= C ? O = i[I] >> s - C & B : (O = (i[I] & (1 << s + 1) - 1) << C - s, I > 0 && (O |= i[I - 1] >> this.DB + s - C)), y = f; !(O & 1); )
O >>= 1, --y;
if ((s -= y) < 0 && (s += this.DB, --I), R)
d[O].copyTo(h), R = !1;
else {
for (; y > 1; )
p.sqrTo(h, D), p.sqrTo(D, h), y -= 2;
y > 0 ? p.sqrTo(h, D) : (M = h, h = D, D = M), p.mulTo(D, d[O], h);
}
for (; I >= 0 && !(i[I] & 1 << s); )
p.sqrTo(h, D), M = h, h = D, D = M, --s < 0 && (s = this.DB - 1, --I);
}
return p.revert(h);
}, o.prototype.modInverse = function(i) {
var n = i.isEven();
if (this.isEven() && n || i.signum() == 0)
return o.ZERO;
for (var s = i.clone(), f = this.clone(), h = en(1), p = en(0), d = en(0), y = en(1); s.signum() != 0; ) {
for (; s.isEven(); )
s.rShiftTo(1, s), n ? ((!h.isEven() || !p.isEven()) && (h.addTo(this, h), p.subTo(i, p)), h.rShiftTo(1, h)) : p.isEven() || p.subTo(i, p), p.rShiftTo(1, p);
for (; f.isEven(); )
f.rShiftTo(1, f), n ? ((!d.isEven() || !y.isEven()) && (d.addTo(this, d), y.subTo(i, y)), d.rShiftTo(1, d)) : y.isEven() || y.subTo(i, y), y.rShiftTo(1, y);
s.compareTo(f) >= 0 ? (s.subTo(f, s), n && h.subTo(d, h), p.subTo(y, p)) : (f.subTo(s, f), n && d.subTo(h, d), y.subTo(p, y));
}
if (f.compareTo(o.ONE) != 0)
return o.ZERO;
if (y.compareTo(i) >= 0)
return y.subtract(i);
if (y.signum() < 0)
y.addTo(i, y);
else
return y;
return y.signum() < 0 ? y.add(i) : y;
}, o.prototype.pow = function(i) {
return this.exp(i, new qg());
}, o.prototype.gcd = function(i) {
var n = this.s < 0 ? this.negate() : this.clone(), s = i.s < 0 ? i.negate() : i.clone();
if (n.compareTo(s) < 0) {
var f = n;
n = s, s = f;
}
var h = n.getLowestSetBit(), p = s.getLowestSetBit();
if (p < 0)
return n;
for (h < p && (p = h), p > 0 && (n.rShiftTo(p, n), s.rShiftTo(p, s)); n.signum() > 0; )
(h = n.getLowestSetBit()) > 0 && n.rShiftTo(h, n), (h = s.getLowestSetBit()) > 0 && s.rShiftTo(h, s), n.compareTo(s) >= 0 ? (n.subTo(s, n), n.rShiftTo(1, n)) : (s.subTo(n, s), s.rShiftTo(1, s));
return p > 0 && s.lShiftTo(p, s), s;
}, o.prototype.isProbablePrime = function(i) {
var n, s = this.abs();
if (s.t == 1 && s[0] <= Gt[Gt.length - 1]) {
for (n = 0; n < Gt.length; ++n)
if (s[0] == Gt[n])
return !0;
return !1;
}
if (s.isEven())
return !1;
for (n = 1; n < Gt.length; ) {
for (var f = Gt[n], h = n + 1; h < Gt.length && f < Wg; )
f *= Gt[h++];
for (f = s.modInt(f); n < h; )
if (f % Gt[n++] == 0)
return !1;
}
return s.millerRabin(i);
}, o.prototype.copyTo = function(i) {
for (var n = this.t - 1; n >= 0; --n)
i[n] = this[n];
i.t = this.t, i.s = this.s;
}, o.prototype.fromInt = function(i) {
this.t = 1, this.s = i < 0 ? -1 : 0, i > 0 ? this[0] = i : i < -1 ? this[0] = i + this.DV : this.t = 0;
}, o.prototype.fromString = function(i, n) {
var s;
if (n == 16)
s = 4;
else if (n == 8)
s = 3;
else if (n == 256)
s = 8;
else if (n == 2)
s = 1;
else if (n == 32)
s = 5;
else if (n == 4)
s = 2;
else {
this.fromRadix(i, n);
return;
}
this.t = 0, this.s = 0;
for (var f = i.length, h = !1, p = 0; --f >= 0; ) {
var d = s == 8 ? +i[f] & 255 : Rf(i, f);
if (d < 0) {
i.charAt(f) == "-" && (h = !0);
continue;
}
h = !1, p == 0 ? this[this.t++] = d : p + s > this.DB ? (this[this.t - 1] |= (d & (1 << this.DB - p) - 1) << p, this[this.t++] = d >> this.DB - p) : this[this.t - 1] |= d << p, p += s, p >= this.DB && (p -= this.DB);
}
s == 8 && +i[0] & 128 && (this.s = -1, p > 0 && (this[this.t - 1] |= (1 << this.DB - p) - 1 << p)), this.clamp(), h && o.ZERO.subTo(this, this);
}, o.prototype.clamp = function() {
for (var i = this.s & this.DM; this.t > 0 && this[this.t - 1] == i; )
--this.t;
}, o.prototype.dlShiftTo = function(i, n) {
var s;
for (s = this.t - 1; s >= 0; --s)
n[s + i] = this[s];
for (s = i - 1; s >= 0; --s)
n[s] = 0;
n.t = this.t + i, n.s = this.s;
}, o.prototype.drShiftTo = function(i, n) {
for (var s = i; s < this.t; ++s)
n[s - i] = this[s];
n.t = Math.max(this.t - i, 0), n.s = this.s;
}, o.prototype.lShiftTo = function(i, n) {
for (var s = i % this.DB, f = this.DB - s, h = (1 << f) - 1, p = Math.floor(i / this.DB), d = this.s << s & this.DM, y = this.t - 1; y >= 0; --y)
n[y + p + 1] = this[y] >> f | d, d = (this[y] & h) << s;
for (var y = p - 1; y >= 0; --y)
n[y] = 0;
n[p] = d, n.t = this.t + p + 1, n.s = this.s, n.clamp();
}, o.prototype.rShiftTo = function(i, n) {
n.s = this.s;
var s = Math.floor(i / this.DB);
if (s >= this.t) {
n.t = 0;
return;
}
var f = i % this.DB, h = this.DB - f, p = (1 << f) - 1;
n[0] = this[s] >> f;
for (var d = s + 1; d < this.t; ++d)
n[d - s - 1] |= (this[d] & p) << h, n[d - s] = this[d] >> f;
f > 0 && (n[this.t - s - 1] |= (this.s & p) << h), n.t = this.t - s, n.clamp();
}, o.prototype.subTo = function(i, n) {
for (var s = 0, f = 0, h = Math.min(i.t, this.t); s < h; )
f += this[s] - i[s], n[s++] = f & this.DM, f >>= this.DB;
if (i.t < this.t) {
for (f -= i.s; s < this.t; )
f += this[s], n[s++] = f & this.DM, f >>= this.DB;
f += this.s;
} else {
for (f += this.s; s < i.t; )
f -= i[s], n[s++] = f & this.DM, f >>= this.DB;
f -= i.s;
}
n.s = f < 0 ? -1 : 0, f < -1 ? n[s++] = this.DV + f : f > 0 && (n[s++] = f), n.t = s, n.clamp();
}, o.prototype.multiplyTo = function(i, n) {
var s = this.abs(), f = i.abs(), h = s.t;
for (n.t = h + f.t; --h >= 0; )
n[h] = 0;
for (h = 0; h < f.t; ++h)
n[h + s.t] = s.am(0, f[h], n, h, 0, s.t);
n.s = 0, n.clamp(), this.s != i.s &