@pubinfo/core 2.1.10-beta.2 → 2.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AppSetting-Dl8pVkN4.js → AppSetting-7jlhUzze.js} +42 -42
- package/dist/{HButton-CzYSwI6a.js → HButton-Dt6qGhhR.js} +7 -7
- package/dist/{HCheckList-CHR-lWIq.js → HCheckList-cPBgATmv.js} +15 -15
- package/dist/{HDivider-CXS9rl4C.js → HDivider-BwvBr5OE.js} +3 -3
- package/dist/{HInput-CSVwTg1Q.js → HInput-KJ5nFBpF.js} +10 -10
- package/dist/HSlideover-DVQDc9q6.js +3151 -0
- package/dist/{HToggle-C_iVIpxv.js → HToggle-Ce_2-yhZ.js} +8 -8
- package/dist/{HTooltip-BHBHfrCD.js → HTooltip-DjAU-Evn.js} +6 -6
- package/dist/PreferencesContent-BAIH81yS.js +701 -0
- package/dist/SettingBreadcrumb-O9-PhAFT.js +45 -0
- package/dist/SettingCopyright-DIKsWTuf.js +45 -0
- package/dist/{SettingEnableTransition-BBH52KKl.js → SettingEnableTransition-61O7W00b.js} +19 -19
- package/dist/SettingHome-Sv65TPH8.js +31 -0
- package/dist/SettingMenu-BvwJOUZV.js +111 -0
- package/dist/{SettingMode-BwhhUYlz.js → SettingMode-B8H_eQc8.js} +14 -14
- package/dist/SettingNavSearch-BHsmYBA7.js +31 -0
- package/dist/SettingOther-CyyNnaDX.js +48 -0
- package/dist/SettingPage-B82lW41P.js +22 -0
- package/dist/{SettingTabbar-DuqQVRnz.js → SettingTabbar-Bky2xvH-.js} +58 -58
- package/dist/{SettingThemes-Doo6Ax3u.js → SettingThemes-CkdzS1xt.js} +44 -44
- package/dist/SettingToolbar-CD4qns1J.js +50 -0
- package/dist/SettingTopbar-1shjoe3s.js +49 -0
- package/dist/{SettingWidthMode-VaN0CrBa.js → SettingWidthMode-DlG6lXjA.js} +14 -14
- package/dist/auth-BLGKOyc5.js +4432 -0
- package/dist/built-in/layout-component/composables/useContext.d.ts +1 -0
- package/dist/{change-organization-OjxZhWST.js → change-organization-hsqeSzDu.js} +38 -38
- package/dist/{change-password-B6kO54-d.js → change-password-EtccCDRX.js} +73 -73
- package/dist/{chunk-EsrJ1IKw.js → chunk-CD4vhpVs.js} +3 -3
- package/dist/{components-DVIyiEVI.js → components-DFNyaAb9.js} +1584 -1584
- package/dist/core/request.d.ts +1 -1
- package/dist/core-DJIGzMMM.js +4885 -0
- package/dist/dist-7OjQvlya.js +468 -0
- package/dist/engine-oniguruma-CaNXwGSv.js +243 -0
- package/dist/features/settings/index.d.ts +90 -1
- package/dist/{form-EQ9eL9hv.js → form-C3VHofnN.js} +923 -443
- package/dist/index.js +4418 -3895
- package/dist/{modal-CSWipFvB.js → modal-Bl5xHbxa.js} +15510 -15790
- package/dist/{not-found-DBe-djEg.js → not-found-BCjngLzt.js} +19 -19
- package/dist/{not-permission-DQzWCpOK.js → not-permission-C26vTMvf.js} +19 -19
- package/dist/{profile-DJ3gpjsS.js → profile-BVXIFuBG.js} +3340 -3277
- package/dist/{question-line-BKVlJGUb.js → question-line-BG__Ycfv.js} +2 -2
- package/dist/{reload-DAR8dVYw.js → reload-DHx5Vwus.js} +4 -4
- package/dist/{right-VKgVtqD5.js → right-BxBlFUwj.js} +6 -6
- package/dist/style.css +1 -1
- package/dist/{tree-select-CTjWj5WT.js → tree-select-B8cTcGLa.js} +2575 -2256
- package/dist/watchDiff-CPZFtaOC.js +655 -0
- package/package.json +41 -41
- package/src/built-in/layout-component/components/Header/HeaderMenu.vue +2 -3
- package/src/built-in/layout-component/components/Menu/item.vue +2 -2
- package/src/built-in/layout-component/components/Menu/sub.vue +20 -1
- package/src/built-in/layout-component/composables/useContext.ts +1 -0
- package/src/built-in/layout-component/composables/useLayoutVisible.ts +1 -1
- package/src/built-in/layout-component/provider.ts +5 -0
- package/src/built-in/system-info/components/SystemInfo.vue +68 -66
- package/src/built-in/system-info/index.ts +4 -4
- package/src/core/ctx.ts +2 -2
- package/src/core/request.ts +1 -1
- package/src/features/components/PubinfoApp/index.vue +1 -0
- package/types/auto-imports.d.ts +63 -63
- package/types/components.d.ts +45 -1
- package/dist/HSlideover-Bc6OHPHe.js +0 -1695
- package/dist/HeaderFullMenu-BRhGliRJ.js +0 -6
- package/dist/HeaderFullMenu-DCF-gTCZ.js +0 -249
- package/dist/HeaderThinMenu-B_7vLcQX.js +0 -6
- package/dist/HeaderThinMenu-PA12XAvb.js +0 -437
- package/dist/PreferencesContent-cll4nwwl.js +0 -695
- package/dist/SettingBreadcrumb-BvSc7VUo.js +0 -45
- package/dist/SettingCopyright-DcWLKM5d.js +0 -45
- package/dist/SettingHome-Cd43oJmB.js +0 -31
- package/dist/SettingMenu-CJsN4F1l.js +0 -111
- package/dist/SettingNavSearch-BhHUWem3.js +0 -31
- package/dist/SettingOther-CDY0jSVT.js +0 -48
- package/dist/SettingPage-B0WNvUlj.js +0 -22
- package/dist/SettingToolbar-CHV_dVJ9.js +0 -50
- package/dist/SettingTopbar-CF1K_XIt.js +0 -49
- package/dist/auth-CPSkJwBz.js +0 -3968
- package/dist/core-Bg2PEcZK.js +0 -4884
- package/dist/dist-DAb-7mqe.js +0 -468
- package/dist/engine-oniguruma-CUfGsBrF.js +0 -243
- package/dist/overlayscrollbars-vue-BOGU2FK-.js +0 -1436
- package/dist/pick-C42gkI1h.js +0 -10
- package/dist/watchDiff-C4eGkl9e.js +0 -397
- /package/dist/{_plugin-vue_export-helper-DaPiLSxE.js → _plugin-vue_export-helper-sUTDUeGO.js} +0 -0
- /package/dist/{json-S7wVLDnW.js → json-Bu_Zprin.js} +0 -0
- /package/dist/{useContext-D6pJCZez.js → useContext-DLtu9F7E.js} +0 -0
- /package/dist/{vitesse-dark-BsnBIHGG.js → vitesse-dark-CTe40QT_.js} +0 -0
- /package/dist/{vitesse-light-Cs_6DF7j.js → vitesse-light-BWXC_WeB.js} +0 -0
- /package/dist/{wasm-EvDQvzqp.js → wasm-2zDVqo-C.js} +0 -0
|
@@ -0,0 +1,4432 @@
|
|
|
1
|
+
import { r as __toESM, t as __commonJSMin } from "./chunk-CD4vhpVs.js";
|
|
2
|
+
import { Fr as setupDefaultLayout, Gn as FrownOutlined, Gr as isObject, Hr as callHookAsync, Kr as baseGetTag, Pr as setupPage, Qr as getPersistedState, Wr as isFunction, Zr as createContext, qr as Symbol$1, t as modal_default } from "./modal-Bl5xHbxa.js";
|
|
3
|
+
import { A as isArrayLike, B as isArray, C as MapCache, D as isTypedArray, E as keys, F as isIndex, H as isSymbol, I as setToString, L as copyArray, M as copyObject, N as eq, O as isBuffer, P as baseAssignValue, R as apply, S as toString, T as keysIn, U as isObjectLike, V as arrayMap, _ as getPrototype, a as hasIn, b as toKey, c as baseClone, d as Uint8Array, f as _getTag_default, g as Stack, h as cloneBuffer, i as isEmpty, j as overRest, k as isArguments, l as initCloneObject, m as getAllKeys, n as basePickBy, o as hasPath, p as getAllKeysIn, r as baseSet, s as cloneDeep, t as watchDiffObject, u as cloneTypedArray, v as flatRest, w as isKey, x as castPath, y as baseGet, z as identity } from "./watchDiff-CPZFtaOC.js";
|
|
4
|
+
import { f as useToggle, s as usePreferredDark, t as computedAsync } from "./dist-7OjQvlya.js";
|
|
5
|
+
import { defineStore, getActivePinia } from "pinia";
|
|
6
|
+
import { computed, createVNode, reactive, ref, toRaw, watch } from "vue";
|
|
7
|
+
import { useRoute } from "vue-router";
|
|
8
|
+
import Message from "vue-m-message";
|
|
9
|
+
var ctx = createContext("ctx", { stateKey: "state" });
|
|
10
|
+
function createPubinfoContext(e) {
|
|
11
|
+
ctx.set(e), ctx.use();
|
|
12
|
+
}
|
|
13
|
+
function usePubinfoContext() {
|
|
14
|
+
return ctx.use();
|
|
15
|
+
}
|
|
16
|
+
let STORE_NAME = /* @__PURE__ */ function(e) {
|
|
17
|
+
return e.FAVORITES = "favorites", e.IFRAME = "iframe", e.KEEP_ALIVE = "keepAlive", e.MENU = "menu", e.NOTIFICATION = "notification", e.ROUTE = "route", e.SETTINGS = "settings", e.TABBAR = "tabbar", e.USER = "user", e;
|
|
18
|
+
}({});
|
|
19
|
+
var useFavoritesStore = defineStore(STORE_NAME.FAVORITES, () => {
|
|
20
|
+
let e = ref([]);
|
|
21
|
+
function n(e) {
|
|
22
|
+
let n = !0;
|
|
23
|
+
return e.children?.every((e) => e.meta?.sidebar === !1) && (n = !1), n;
|
|
24
|
+
}
|
|
25
|
+
function r(e, i) {
|
|
26
|
+
let a = [];
|
|
27
|
+
for (let o of e) o.meta?.sidebar !== !1 && (o.children && n(o) ? a.push(...r(o.children, resolveRoutePath(i, o.path))) : a.push(o.redirect ?? resolveRoutePath(i, o.path)));
|
|
28
|
+
return a;
|
|
29
|
+
}
|
|
30
|
+
function i(e = []) {
|
|
31
|
+
let n = [];
|
|
32
|
+
return e.forEach((e) => {
|
|
33
|
+
if (e.children) {
|
|
34
|
+
let i = r(e.children);
|
|
35
|
+
n.push(...i);
|
|
36
|
+
}
|
|
37
|
+
}), n;
|
|
38
|
+
}
|
|
39
|
+
function a(e, n = []) {
|
|
40
|
+
return i(n).includes(e);
|
|
41
|
+
}
|
|
42
|
+
function o(n) {
|
|
43
|
+
return e.value.some((e) => e.fullPath === n);
|
|
44
|
+
}
|
|
45
|
+
function s(n) {
|
|
46
|
+
let r = n.matched.at(-1)?.meta;
|
|
47
|
+
e.value.find((e) => e.fullPath === n.fullPath) || e.value.push({
|
|
48
|
+
fullPath: n.fullPath,
|
|
49
|
+
title: r?.title,
|
|
50
|
+
icon: r?.icon ?? r?.breadcrumbNeste?.findLast((e) => e.icon)?.icon
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
function c(n) {
|
|
54
|
+
e.value = e.value.filter((e) => e.fullPath !== n);
|
|
55
|
+
}
|
|
56
|
+
function l(n, r) {
|
|
57
|
+
e.value.splice(n, 0, e.value.splice(r, 1)[0]);
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
list: e,
|
|
61
|
+
canAdd: a,
|
|
62
|
+
isAdd: o,
|
|
63
|
+
add: s,
|
|
64
|
+
remove: c,
|
|
65
|
+
sort: l
|
|
66
|
+
};
|
|
67
|
+
}), reWhitespace = /\s/;
|
|
68
|
+
function trimmedEndIndex(e) {
|
|
69
|
+
for (var n = e.length; n-- && reWhitespace.test(e.charAt(n)););
|
|
70
|
+
return n;
|
|
71
|
+
}
|
|
72
|
+
var reTrimStart = /^\s+/;
|
|
73
|
+
function baseTrim(e) {
|
|
74
|
+
return e && e.slice(0, trimmedEndIndex(e) + 1).replace(reTrimStart, "");
|
|
75
|
+
}
|
|
76
|
+
var NAN = NaN, reIsBadHex = /^[-+]0x[0-9a-f]+$/i, reIsBinary = /^0b[01]+$/i, reIsOctal = /^0o[0-7]+$/i, freeParseInt = parseInt;
|
|
77
|
+
function toNumber(e) {
|
|
78
|
+
if (typeof e == "number") return e;
|
|
79
|
+
if (isSymbol(e)) return NAN;
|
|
80
|
+
if (isObject(e)) {
|
|
81
|
+
var n = typeof e.valueOf == "function" ? e.valueOf() : e;
|
|
82
|
+
e = isObject(n) ? n + "" : n;
|
|
83
|
+
}
|
|
84
|
+
if (typeof e != "string") return e === 0 ? e : +e;
|
|
85
|
+
e = baseTrim(e);
|
|
86
|
+
var r = reIsBinary.test(e);
|
|
87
|
+
return r || reIsOctal.test(e) ? freeParseInt(e.slice(2), r ? 2 : 8) : reIsBadHex.test(e) ? NAN : +e;
|
|
88
|
+
}
|
|
89
|
+
var INFINITY = Infinity, MAX_INTEGER = 17976931348623157e292;
|
|
90
|
+
function toFinite(e) {
|
|
91
|
+
return e ? (e = toNumber(e), e === INFINITY || e === -INFINITY ? (e < 0 ? -1 : 1) * MAX_INTEGER : e === e ? e : 0) : e === 0 ? e : 0;
|
|
92
|
+
}
|
|
93
|
+
function toInteger(e) {
|
|
94
|
+
var n = toFinite(e), r = n % 1;
|
|
95
|
+
return n === n ? r ? n - r : n : 0;
|
|
96
|
+
}
|
|
97
|
+
function baseFindIndex(e, n, r, i) {
|
|
98
|
+
for (var a = e.length, o = r + (i ? 1 : -1); i ? o-- : ++o < a;) if (n(e[o], o, e)) return o;
|
|
99
|
+
return -1;
|
|
100
|
+
}
|
|
101
|
+
function baseRest(e, n) {
|
|
102
|
+
return setToString(overRest(e, n, identity), e + "");
|
|
103
|
+
}
|
|
104
|
+
function isIterateeCall(e, n, r) {
|
|
105
|
+
if (!isObject(r)) return !1;
|
|
106
|
+
var i = typeof n;
|
|
107
|
+
return (i == "number" ? isArrayLike(r) && isIndex(n, r.length) : i == "string" && n in r) ? eq(r[n], e) : !1;
|
|
108
|
+
}
|
|
109
|
+
function createAssigner(e) {
|
|
110
|
+
return baseRest(function(n, r) {
|
|
111
|
+
var i = -1, a = r.length, o = a > 1 ? r[a - 1] : void 0, s = a > 2 ? r[2] : void 0;
|
|
112
|
+
for (o = e.length > 3 && typeof o == "function" ? (a--, o) : void 0, s && isIterateeCall(r[0], r[1], s) && (o = a < 3 ? void 0 : o, a = 1), n = Object(n); ++i < a;) {
|
|
113
|
+
var c = r[i];
|
|
114
|
+
c && e(n, c, i, o);
|
|
115
|
+
}
|
|
116
|
+
return n;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
var assignInWith = createAssigner(function(e, n, r, i) {
|
|
120
|
+
copyObject(n, keysIn(n), e, i);
|
|
121
|
+
});
|
|
122
|
+
function get(e, n, r) {
|
|
123
|
+
var i = e == null ? void 0 : baseGet(e, n);
|
|
124
|
+
return i === void 0 ? r : i;
|
|
125
|
+
}
|
|
126
|
+
var objectTag$1 = "[object Object]", funcProto = Function.prototype, objectProto$1 = Object.prototype, funcToString = funcProto.toString, hasOwnProperty$6 = objectProto$1.hasOwnProperty, objectCtorString = funcToString.call(Object);
|
|
127
|
+
function isPlainObject$2(e) {
|
|
128
|
+
if (!isObjectLike(e) || baseGetTag(e) != objectTag$1) return !1;
|
|
129
|
+
var n = getPrototype(e);
|
|
130
|
+
if (n === null) return !0;
|
|
131
|
+
var r = hasOwnProperty$6.call(n, "constructor") && n.constructor;
|
|
132
|
+
return typeof r == "function" && r instanceof r && funcToString.call(r) == objectCtorString;
|
|
133
|
+
}
|
|
134
|
+
var domExcTag = "[object DOMException]", errorTag$1 = "[object Error]";
|
|
135
|
+
function isError(e) {
|
|
136
|
+
if (!isObjectLike(e)) return !1;
|
|
137
|
+
var n = baseGetTag(e);
|
|
138
|
+
return n == errorTag$1 || n == domExcTag || typeof e.message == "string" && typeof e.name == "string" && !isPlainObject$2(e);
|
|
139
|
+
}
|
|
140
|
+
var attempt = baseRest(function(e, n) {
|
|
141
|
+
try {
|
|
142
|
+
return apply(e, void 0, n);
|
|
143
|
+
} catch (e) {
|
|
144
|
+
return isError(e) ? e : Error(e);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
function baseSlice(e, n, r) {
|
|
148
|
+
var i = -1, a = e.length;
|
|
149
|
+
n < 0 && (n = -n > a ? 0 : a + n), r = r > a ? a : r, r < 0 && (r += a), a = n > r ? 0 : r - n >>> 0, n >>>= 0;
|
|
150
|
+
for (var o = Array(a); ++i < a;) o[i] = e[i + n];
|
|
151
|
+
return o;
|
|
152
|
+
}
|
|
153
|
+
function arrayReduce(e, n, r, i) {
|
|
154
|
+
var a = -1, o = e == null ? 0 : e.length;
|
|
155
|
+
for (i && o && (r = e[++a]); ++a < o;) r = n(r, e[a], a, e);
|
|
156
|
+
return r;
|
|
157
|
+
}
|
|
158
|
+
function basePropertyOf(e) {
|
|
159
|
+
return function(n) {
|
|
160
|
+
return e?.[n];
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
var HASH_UNDEFINED = "__lodash_hash_undefined__";
|
|
164
|
+
function setCacheAdd(e) {
|
|
165
|
+
return this.__data__.set(e, HASH_UNDEFINED), this;
|
|
166
|
+
}
|
|
167
|
+
function setCacheHas(e) {
|
|
168
|
+
return this.__data__.has(e);
|
|
169
|
+
}
|
|
170
|
+
function SetCache(e) {
|
|
171
|
+
var n = -1, r = e == null ? 0 : e.length;
|
|
172
|
+
for (this.__data__ = new MapCache(); ++n < r;) this.add(e[n]);
|
|
173
|
+
}
|
|
174
|
+
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd, SetCache.prototype.has = setCacheHas;
|
|
175
|
+
function arraySome(e, n) {
|
|
176
|
+
for (var r = -1, i = e == null ? 0 : e.length; ++r < i;) if (n(e[r], r, e)) return !0;
|
|
177
|
+
return !1;
|
|
178
|
+
}
|
|
179
|
+
function cacheHas(e, n) {
|
|
180
|
+
return e.has(n);
|
|
181
|
+
}
|
|
182
|
+
var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2;
|
|
183
|
+
function equalArrays(e, n, r, i, a, o) {
|
|
184
|
+
var s = r & COMPARE_PARTIAL_FLAG$5, c = e.length, l = n.length;
|
|
185
|
+
if (c != l && !(s && l > c)) return !1;
|
|
186
|
+
var u = o.get(e), d = o.get(n);
|
|
187
|
+
if (u && d) return u == n && d == e;
|
|
188
|
+
var f = -1, p = !0, m = r & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
|
|
189
|
+
for (o.set(e, n), o.set(n, e); ++f < c;) {
|
|
190
|
+
var h = e[f], g = n[f];
|
|
191
|
+
if (i) var _ = s ? i(g, h, f, n, e, o) : i(h, g, f, e, n, o);
|
|
192
|
+
if (_ !== void 0) {
|
|
193
|
+
if (_) continue;
|
|
194
|
+
p = !1;
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
if (m) {
|
|
198
|
+
if (!arraySome(n, function(e, n) {
|
|
199
|
+
if (!cacheHas(m, n) && (h === e || a(h, e, r, i, o))) return m.push(n);
|
|
200
|
+
})) {
|
|
201
|
+
p = !1;
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
} else if (!(h === g || a(h, g, r, i, o))) {
|
|
205
|
+
p = !1;
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return o.delete(e), o.delete(n), p;
|
|
210
|
+
}
|
|
211
|
+
function mapToArray(e) {
|
|
212
|
+
var n = -1, r = Array(e.size);
|
|
213
|
+
return e.forEach(function(e, i) {
|
|
214
|
+
r[++n] = [i, e];
|
|
215
|
+
}), r;
|
|
216
|
+
}
|
|
217
|
+
function setToArray(e) {
|
|
218
|
+
var n = -1, r = Array(e.size);
|
|
219
|
+
return e.forEach(function(e) {
|
|
220
|
+
r[++n] = e;
|
|
221
|
+
}), r;
|
|
222
|
+
}
|
|
223
|
+
var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2, boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag$1 = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag$1 = "[object String]", symbolTag = "[object Symbol]", arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]", symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
|
|
224
|
+
function equalByTag(e, n, r, i, a, o, s) {
|
|
225
|
+
switch (r) {
|
|
226
|
+
case dataViewTag:
|
|
227
|
+
if (e.byteLength != n.byteLength || e.byteOffset != n.byteOffset) return !1;
|
|
228
|
+
e = e.buffer, n = n.buffer;
|
|
229
|
+
case arrayBufferTag: return !(e.byteLength != n.byteLength || !o(new Uint8Array(e), new Uint8Array(n)));
|
|
230
|
+
case boolTag:
|
|
231
|
+
case dateTag:
|
|
232
|
+
case numberTag$1: return eq(+e, +n);
|
|
233
|
+
case errorTag: return e.name == n.name && e.message == n.message;
|
|
234
|
+
case regexpTag:
|
|
235
|
+
case stringTag$1: return e == n + "";
|
|
236
|
+
case mapTag: var c = mapToArray;
|
|
237
|
+
case setTag:
|
|
238
|
+
var l = i & COMPARE_PARTIAL_FLAG$4;
|
|
239
|
+
if (c ||= setToArray, e.size != n.size && !l) return !1;
|
|
240
|
+
var u = s.get(e);
|
|
241
|
+
if (u) return u == n;
|
|
242
|
+
i |= COMPARE_UNORDERED_FLAG$2, s.set(e, n);
|
|
243
|
+
var d = equalArrays(c(e), c(n), i, a, o, s);
|
|
244
|
+
return s.delete(e), d;
|
|
245
|
+
case symbolTag: if (symbolValueOf) return symbolValueOf.call(e) == symbolValueOf.call(n);
|
|
246
|
+
}
|
|
247
|
+
return !1;
|
|
248
|
+
}
|
|
249
|
+
var COMPARE_PARTIAL_FLAG$3 = 1, hasOwnProperty$5 = Object.prototype.hasOwnProperty;
|
|
250
|
+
function equalObjects(e, n, r, i, a, o) {
|
|
251
|
+
var s = r & COMPARE_PARTIAL_FLAG$3, c = getAllKeys(e), l = c.length;
|
|
252
|
+
if (l != getAllKeys(n).length && !s) return !1;
|
|
253
|
+
for (var u = l; u--;) {
|
|
254
|
+
var d = c[u];
|
|
255
|
+
if (!(s ? d in n : hasOwnProperty$5.call(n, d))) return !1;
|
|
256
|
+
}
|
|
257
|
+
var f = o.get(e), p = o.get(n);
|
|
258
|
+
if (f && p) return f == n && p == e;
|
|
259
|
+
var m = !0;
|
|
260
|
+
o.set(e, n), o.set(n, e);
|
|
261
|
+
for (var h = s; ++u < l;) {
|
|
262
|
+
d = c[u];
|
|
263
|
+
var g = e[d], _ = n[d];
|
|
264
|
+
if (i) var v = s ? i(_, g, d, n, e, o) : i(g, _, d, e, n, o);
|
|
265
|
+
if (!(v === void 0 ? g === _ || a(g, _, r, i, o) : v)) {
|
|
266
|
+
m = !1;
|
|
267
|
+
break;
|
|
268
|
+
}
|
|
269
|
+
h ||= d == "constructor";
|
|
270
|
+
}
|
|
271
|
+
if (m && !h) {
|
|
272
|
+
var y = e.constructor, b = n.constructor;
|
|
273
|
+
y != b && "constructor" in e && "constructor" in n && !(typeof y == "function" && y instanceof y && typeof b == "function" && b instanceof b) && (m = !1);
|
|
274
|
+
}
|
|
275
|
+
return o.delete(e), o.delete(n), m;
|
|
276
|
+
}
|
|
277
|
+
var COMPARE_PARTIAL_FLAG$2 = 1, argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]", hasOwnProperty$4 = Object.prototype.hasOwnProperty;
|
|
278
|
+
function baseIsEqualDeep(e, n, r, i, a, o) {
|
|
279
|
+
var s = isArray(e), c = isArray(n), l = s ? arrayTag : _getTag_default(e), u = c ? arrayTag : _getTag_default(n);
|
|
280
|
+
l = l == argsTag ? objectTag : l, u = u == argsTag ? objectTag : u;
|
|
281
|
+
var d = l == objectTag, f = u == objectTag, p = l == u;
|
|
282
|
+
if (p && isBuffer(e)) {
|
|
283
|
+
if (!isBuffer(n)) return !1;
|
|
284
|
+
s = !0, d = !1;
|
|
285
|
+
}
|
|
286
|
+
if (p && !d) return o ||= new Stack(), s || isTypedArray(e) ? equalArrays(e, n, r, i, a, o) : equalByTag(e, n, l, r, i, a, o);
|
|
287
|
+
if (!(r & COMPARE_PARTIAL_FLAG$2)) {
|
|
288
|
+
var m = d && hasOwnProperty$4.call(e, "__wrapped__"), g = f && hasOwnProperty$4.call(n, "__wrapped__");
|
|
289
|
+
if (m || g) {
|
|
290
|
+
var v = m ? e.value() : e, y = g ? n.value() : n;
|
|
291
|
+
return o ||= new Stack(), a(v, y, r, i, o);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return p ? (o ||= new Stack(), equalObjects(e, n, r, i, a, o)) : !1;
|
|
295
|
+
}
|
|
296
|
+
function baseIsEqual(e, n, r, i, a) {
|
|
297
|
+
return e === n ? !0 : e == null || n == null || !isObjectLike(e) && !isObjectLike(n) ? e !== e && n !== n : baseIsEqualDeep(e, n, r, i, baseIsEqual, a);
|
|
298
|
+
}
|
|
299
|
+
var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
|
|
300
|
+
function baseIsMatch(e, n, r, i) {
|
|
301
|
+
var a = r.length, o = a, s = !i;
|
|
302
|
+
if (e == null) return !o;
|
|
303
|
+
for (e = Object(e); a--;) {
|
|
304
|
+
var c = r[a];
|
|
305
|
+
if (s && c[2] ? c[1] !== e[c[0]] : !(c[0] in e)) return !1;
|
|
306
|
+
}
|
|
307
|
+
for (; ++a < o;) {
|
|
308
|
+
c = r[a];
|
|
309
|
+
var l = c[0], u = e[l], d = c[1];
|
|
310
|
+
if (s && c[2]) {
|
|
311
|
+
if (u === void 0 && !(l in e)) return !1;
|
|
312
|
+
} else {
|
|
313
|
+
var f = new Stack();
|
|
314
|
+
if (i) var p = i(u, d, l, e, n, f);
|
|
315
|
+
if (!(p === void 0 ? baseIsEqual(d, u, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, i, f) : p)) return !1;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
return !0;
|
|
319
|
+
}
|
|
320
|
+
function isStrictComparable(e) {
|
|
321
|
+
return e === e && !isObject(e);
|
|
322
|
+
}
|
|
323
|
+
function getMatchData(e) {
|
|
324
|
+
for (var n = keys(e), r = n.length; r--;) {
|
|
325
|
+
var i = n[r], a = e[i];
|
|
326
|
+
n[r] = [
|
|
327
|
+
i,
|
|
328
|
+
a,
|
|
329
|
+
isStrictComparable(a)
|
|
330
|
+
];
|
|
331
|
+
}
|
|
332
|
+
return n;
|
|
333
|
+
}
|
|
334
|
+
function matchesStrictComparable(e, n) {
|
|
335
|
+
return function(r) {
|
|
336
|
+
return r == null ? !1 : r[e] === n && (n !== void 0 || e in Object(r));
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function baseMatches(e) {
|
|
340
|
+
var n = getMatchData(e);
|
|
341
|
+
return n.length == 1 && n[0][2] ? matchesStrictComparable(n[0][0], n[0][1]) : function(r) {
|
|
342
|
+
return r === e || baseIsMatch(r, e, n);
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
|
|
346
|
+
function baseMatchesProperty(e, n) {
|
|
347
|
+
return isKey(e) && isStrictComparable(n) ? matchesStrictComparable(toKey(e), n) : function(r) {
|
|
348
|
+
var i = get(r, e);
|
|
349
|
+
return i === void 0 && i === n ? hasIn(r, e) : baseIsEqual(n, i, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function baseProperty(e) {
|
|
353
|
+
return function(n) {
|
|
354
|
+
return n?.[e];
|
|
355
|
+
};
|
|
356
|
+
}
|
|
357
|
+
function basePropertyDeep(e) {
|
|
358
|
+
return function(n) {
|
|
359
|
+
return baseGet(n, e);
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function property(e) {
|
|
363
|
+
return isKey(e) ? baseProperty(toKey(e)) : basePropertyDeep(e);
|
|
364
|
+
}
|
|
365
|
+
function baseIteratee(e) {
|
|
366
|
+
return typeof e == "function" ? e : e == null ? identity : typeof e == "object" ? isArray(e) ? baseMatchesProperty(e[0], e[1]) : baseMatches(e) : property(e);
|
|
367
|
+
}
|
|
368
|
+
function createBaseFor(e) {
|
|
369
|
+
return function(n, r, i) {
|
|
370
|
+
for (var a = -1, o = Object(n), s = i(n), c = s.length; c--;) {
|
|
371
|
+
var l = s[e ? c : ++a];
|
|
372
|
+
if (r(o[l], l, o) === !1) break;
|
|
373
|
+
}
|
|
374
|
+
return n;
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
var baseFor = createBaseFor();
|
|
378
|
+
function baseForOwn(e, n) {
|
|
379
|
+
return e && baseFor(e, n, keys);
|
|
380
|
+
}
|
|
381
|
+
function createBaseEach(e, n) {
|
|
382
|
+
return function(r, i) {
|
|
383
|
+
if (r == null) return r;
|
|
384
|
+
if (!isArrayLike(r)) return e(r, i);
|
|
385
|
+
for (var a = r.length, o = n ? a : -1, s = Object(r); (n ? o-- : ++o < a) && i(s[o], o, s) !== !1;);
|
|
386
|
+
return r;
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
var baseEach = createBaseEach(baseForOwn);
|
|
390
|
+
function defaultTo(e, n) {
|
|
391
|
+
return e == null || e !== e ? n : e;
|
|
392
|
+
}
|
|
393
|
+
function assignMergeValue(e, n, r) {
|
|
394
|
+
(r !== void 0 && !eq(e[n], r) || r === void 0 && !(n in e)) && baseAssignValue(e, n, r);
|
|
395
|
+
}
|
|
396
|
+
function isArrayLikeObject(e) {
|
|
397
|
+
return isObjectLike(e) && isArrayLike(e);
|
|
398
|
+
}
|
|
399
|
+
function safeGet(e, n) {
|
|
400
|
+
if (!(n === "constructor" && typeof e[n] == "function") && n != "__proto__") return e[n];
|
|
401
|
+
}
|
|
402
|
+
function toPlainObject(e) {
|
|
403
|
+
return copyObject(e, keysIn(e));
|
|
404
|
+
}
|
|
405
|
+
function baseMergeDeep(e, n, r, i, o, s, c) {
|
|
406
|
+
var l = safeGet(e, r), d = safeGet(n, r), f = c.get(d);
|
|
407
|
+
if (f) {
|
|
408
|
+
assignMergeValue(e, r, f);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
var p = s ? s(l, d, r + "", e, n, c) : void 0, m = p === void 0;
|
|
412
|
+
if (m) {
|
|
413
|
+
var g = isArray(d), v = !g && isBuffer(d), y = !g && !v && isTypedArray(d);
|
|
414
|
+
p = d, g || v || y ? isArray(l) ? p = l : isArrayLikeObject(l) ? p = copyArray(l) : v ? (m = !1, p = cloneBuffer(d, !0)) : y ? (m = !1, p = cloneTypedArray(d, !0)) : p = [] : isPlainObject$2(d) || isArguments(d) ? (p = l, isArguments(l) ? p = toPlainObject(l) : (!isObject(l) || isFunction(l)) && (p = initCloneObject(d))) : m = !1;
|
|
415
|
+
}
|
|
416
|
+
m && (c.set(d, p), o(p, d, i, s, c), c.delete(d)), assignMergeValue(e, r, p);
|
|
417
|
+
}
|
|
418
|
+
function baseMerge(e, n, r, i, o) {
|
|
419
|
+
e !== n && baseFor(n, function(s, c) {
|
|
420
|
+
if (o ||= new Stack(), isObject(s)) baseMergeDeep(e, n, c, r, baseMerge, i, o);
|
|
421
|
+
else {
|
|
422
|
+
var l = i ? i(safeGet(e, c), s, c + "", e, n, o) : void 0;
|
|
423
|
+
l === void 0 && (l = s), assignMergeValue(e, c, l);
|
|
424
|
+
}
|
|
425
|
+
}, keysIn);
|
|
426
|
+
}
|
|
427
|
+
function customDefaultsMerge(e, n, r, i, o, s) {
|
|
428
|
+
return isObject(e) && isObject(n) && (s.set(n, e), baseMerge(e, n, void 0, customDefaultsMerge, s), s.delete(n)), e;
|
|
429
|
+
}
|
|
430
|
+
var mergeWith = createAssigner(function(e, n, r, i) {
|
|
431
|
+
baseMerge(e, n, r, i);
|
|
432
|
+
}), defaultsDeep = baseRest(function(e) {
|
|
433
|
+
return e.push(void 0, customDefaultsMerge), apply(mergeWith, void 0, e);
|
|
434
|
+
});
|
|
435
|
+
function last(e) {
|
|
436
|
+
var n = e == null ? 0 : e.length;
|
|
437
|
+
return n ? e[n - 1] : void 0;
|
|
438
|
+
}
|
|
439
|
+
var escapeHtmlChar = basePropertyOf({
|
|
440
|
+
"&": "&",
|
|
441
|
+
"<": "<",
|
|
442
|
+
">": ">",
|
|
443
|
+
"\"": """,
|
|
444
|
+
"'": "'"
|
|
445
|
+
}), reUnescapedHtml = /[&<>"']/g, reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
|
|
446
|
+
function escape(e) {
|
|
447
|
+
return e = toString(e), e && reHasUnescapedHtml.test(e) ? e.replace(reUnescapedHtml, escapeHtmlChar) : e;
|
|
448
|
+
}
|
|
449
|
+
function createFind(e) {
|
|
450
|
+
return function(n, r, i) {
|
|
451
|
+
var a = Object(n);
|
|
452
|
+
if (!isArrayLike(n)) {
|
|
453
|
+
var o = baseIteratee(r, 3);
|
|
454
|
+
n = keys(n), r = function(e) {
|
|
455
|
+
return o(a[e], e, a);
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
var s = e(n, r, i);
|
|
459
|
+
return s > -1 ? a[o ? n[s] : s] : void 0;
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
var nativeMax = Math.max;
|
|
463
|
+
function findIndex(e, n, r) {
|
|
464
|
+
var i = e == null ? 0 : e.length;
|
|
465
|
+
if (!i) return -1;
|
|
466
|
+
var a = r == null ? 0 : toInteger(r);
|
|
467
|
+
return a < 0 && (a = nativeMax(i + a, 0)), baseFindIndex(e, baseIteratee(n, 3), a);
|
|
468
|
+
}
|
|
469
|
+
var find = createFind(findIndex), hasOwnProperty$3 = Object.prototype.hasOwnProperty;
|
|
470
|
+
function baseHas(e, n) {
|
|
471
|
+
return e != null && hasOwnProperty$3.call(e, n);
|
|
472
|
+
}
|
|
473
|
+
function has(e, n) {
|
|
474
|
+
return e != null && hasPath(e, n, baseHas);
|
|
475
|
+
}
|
|
476
|
+
var stringTag = "[object String]";
|
|
477
|
+
function isString(e) {
|
|
478
|
+
return typeof e == "string" || !isArray(e) && isObjectLike(e) && baseGetTag(e) == stringTag;
|
|
479
|
+
}
|
|
480
|
+
function baseValues(e, n) {
|
|
481
|
+
return arrayMap(n, function(n) {
|
|
482
|
+
return e[n];
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
function parent(e, n) {
|
|
486
|
+
return n.length < 2 ? e : baseGet(e, baseSlice(n, 0, -1));
|
|
487
|
+
}
|
|
488
|
+
var numberTag = "[object Number]";
|
|
489
|
+
function isNumber(e) {
|
|
490
|
+
return typeof e == "number" || isObjectLike(e) && baseGetTag(e) == numberTag;
|
|
491
|
+
}
|
|
492
|
+
function isUndefined(e) {
|
|
493
|
+
return e === void 0;
|
|
494
|
+
}
|
|
495
|
+
var merge = createAssigner(function(e, n, r) {
|
|
496
|
+
baseMerge(e, n, r);
|
|
497
|
+
}), FUNC_ERROR_TEXT = "Expected a function";
|
|
498
|
+
function negate(e) {
|
|
499
|
+
if (typeof e != "function") throw TypeError(FUNC_ERROR_TEXT);
|
|
500
|
+
return function() {
|
|
501
|
+
var n = arguments;
|
|
502
|
+
switch (n.length) {
|
|
503
|
+
case 0: return !e.call(this);
|
|
504
|
+
case 1: return !e.call(this, n[0]);
|
|
505
|
+
case 2: return !e.call(this, n[0], n[1]);
|
|
506
|
+
case 3: return !e.call(this, n[0], n[1], n[2]);
|
|
507
|
+
}
|
|
508
|
+
return !e.apply(this, n);
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
|
|
512
|
+
function baseUnset(e, n) {
|
|
513
|
+
n = castPath(n, e);
|
|
514
|
+
var r = -1, i = n.length;
|
|
515
|
+
if (!i) return !0;
|
|
516
|
+
for (var a = e == null || typeof e != "object" && typeof e != "function"; ++r < i;) {
|
|
517
|
+
var o = n[r];
|
|
518
|
+
if (typeof o == "string") {
|
|
519
|
+
if (o === "__proto__" && !hasOwnProperty$2.call(e, "__proto__")) return !1;
|
|
520
|
+
if (o === "constructor" && r + 1 < i && typeof n[r + 1] == "string" && n[r + 1] === "prototype") {
|
|
521
|
+
if (a && r === 0) continue;
|
|
522
|
+
return !1;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
var s = parent(e, n);
|
|
527
|
+
return s == null || delete s[toKey(last(n))];
|
|
528
|
+
}
|
|
529
|
+
function customOmitClone(e) {
|
|
530
|
+
return isPlainObject$2(e) ? void 0 : e;
|
|
531
|
+
}
|
|
532
|
+
var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4, omit = flatRest(function(e, n) {
|
|
533
|
+
var r = {};
|
|
534
|
+
if (e == null) return r;
|
|
535
|
+
var i = !1;
|
|
536
|
+
n = arrayMap(n, function(n) {
|
|
537
|
+
return n = castPath(n, e), i ||= n.length > 1, n;
|
|
538
|
+
}), copyObject(e, getAllKeysIn(e), r), i && (r = baseClone(r, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone));
|
|
539
|
+
for (var a = n.length; a--;) baseUnset(r, n[a]);
|
|
540
|
+
return r;
|
|
541
|
+
});
|
|
542
|
+
function pickBy(e, n) {
|
|
543
|
+
if (e == null) return {};
|
|
544
|
+
var r = arrayMap(getAllKeysIn(e), function(e) {
|
|
545
|
+
return [e];
|
|
546
|
+
});
|
|
547
|
+
return n = baseIteratee(n), basePickBy(e, r, function(e, r) {
|
|
548
|
+
return n(e, r[0]);
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
function omitBy(e, n) {
|
|
552
|
+
return pickBy(e, negate(baseIteratee(n)));
|
|
553
|
+
}
|
|
554
|
+
function baseReduce(e, n, r, i, a) {
|
|
555
|
+
return a(e, function(e, a, o) {
|
|
556
|
+
r = i ? (i = !1, e) : n(r, e, a, o);
|
|
557
|
+
}), r;
|
|
558
|
+
}
|
|
559
|
+
function reduce(e, n, r) {
|
|
560
|
+
var i = isArray(e) ? arrayReduce : baseReduce, a = arguments.length < 3;
|
|
561
|
+
return i(e, baseIteratee(n, 4), r, a, baseEach);
|
|
562
|
+
}
|
|
563
|
+
function set(e, n, r) {
|
|
564
|
+
return e == null ? e : baseSet(e, n, r);
|
|
565
|
+
}
|
|
566
|
+
var objectProto = Object.prototype, hasOwnProperty$1 = objectProto.hasOwnProperty;
|
|
567
|
+
function customDefaultsAssignIn(e, n, r, i) {
|
|
568
|
+
return e === void 0 || eq(e, objectProto[r]) && !hasOwnProperty$1.call(i, r) ? n : e;
|
|
569
|
+
}
|
|
570
|
+
var stringEscapes = {
|
|
571
|
+
"\\": "\\",
|
|
572
|
+
"'": "'",
|
|
573
|
+
"\n": "n",
|
|
574
|
+
"\r": "r",
|
|
575
|
+
"\u2028": "u2028",
|
|
576
|
+
"\u2029": "u2029"
|
|
577
|
+
};
|
|
578
|
+
function escapeStringChar(e) {
|
|
579
|
+
return "\\" + stringEscapes[e];
|
|
580
|
+
}
|
|
581
|
+
var reInterpolate = /<%=([\s\S]+?)%>/g, templateSettings = {
|
|
582
|
+
escape: /<%-([\s\S]+?)%>/g,
|
|
583
|
+
evaluate: /<%([\s\S]+?)%>/g,
|
|
584
|
+
interpolate: reInterpolate,
|
|
585
|
+
variable: "",
|
|
586
|
+
imports: { _: { escape } }
|
|
587
|
+
}, INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`", reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g, reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/, reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g, reNoMatch = /($^)/, reUnescapedString = /['\n\r\u2028\u2029\\]/g, hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
588
|
+
function template(e, n, r) {
|
|
589
|
+
var i = templateSettings.imports._.templateSettings || templateSettings;
|
|
590
|
+
r && isIterateeCall(e, n, r) && (n = void 0), e = toString(e), n = assignInWith({}, n, i, customDefaultsAssignIn);
|
|
591
|
+
var a = assignInWith({}, n.imports, i.imports, customDefaultsAssignIn), o = keys(a), s = baseValues(a, o), c, l, u = 0, d = n.interpolate || reNoMatch, f = "__p += '", p = RegExp((n.escape || reNoMatch).source + "|" + d.source + "|" + (d === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (n.evaluate || reNoMatch).source + "|$", "g"), m = hasOwnProperty.call(n, "sourceURL") ? "//# sourceURL=" + (n.sourceURL + "").replace(/\s/g, " ") + "\n" : "";
|
|
592
|
+
e.replace(p, function(n, r, i, a, o, s) {
|
|
593
|
+
return i ||= a, f += e.slice(u, s).replace(reUnescapedString, escapeStringChar), r && (c = !0, f += "' +\n__e(" + r + ") +\n'"), o && (l = !0, f += "';\n" + o + ";\n__p += '"), i && (f += "' +\n((__t = (" + i + ")) == null ? '' : __t) +\n'"), u = s + n.length, n;
|
|
594
|
+
}), f += "';\n";
|
|
595
|
+
var h = hasOwnProperty.call(n, "variable") && n.variable;
|
|
596
|
+
if (!h) f = "with (obj) {\n" + f + "\n}\n";
|
|
597
|
+
else if (reForbiddenIdentifierChars.test(h)) throw Error(INVALID_TEMPL_VAR_ERROR_TEXT);
|
|
598
|
+
f = (l ? f.replace(reEmptyStringLeading, "") : f).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;"), f = "function(" + (h || "obj") + ") {\n" + (h ? "" : "obj || (obj = {});\n") + "var __t, __p = ''" + (c ? ", __e = _.escape" : "") + (l ? ", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n" : ";\n") + f + "return __p\n}";
|
|
599
|
+
var g = attempt(function() {
|
|
600
|
+
return Function(o, m + "return " + f).apply(void 0, s);
|
|
601
|
+
});
|
|
602
|
+
if (g.source = f, isError(g)) throw g;
|
|
603
|
+
return g;
|
|
604
|
+
}
|
|
605
|
+
var useIframeStore = defineStore(STORE_NAME.IFRAME, () => {
|
|
606
|
+
let e = ref(!1), n = ref([]), r = ref([]), i = computed(() => n.value.filter((e) => e.isOpen));
|
|
607
|
+
async function a(r, i) {
|
|
608
|
+
for (let e of r) e.meta.iframe && !e.meta.link && (isFunction(e.meta.iframe) && (e.meta.iframe = await e.meta.iframe(toRaw(i))), n.value.push({
|
|
609
|
+
path: e.path,
|
|
610
|
+
src: e.meta.iframe,
|
|
611
|
+
isOpen: !1,
|
|
612
|
+
isLoading: !0
|
|
613
|
+
}));
|
|
614
|
+
e.value = !0;
|
|
615
|
+
}
|
|
616
|
+
function o(e) {
|
|
617
|
+
let r = n.value.findIndex((n) => n.path === e);
|
|
618
|
+
n.value[r].isLoading = !~r;
|
|
619
|
+
}
|
|
620
|
+
function s(e) {
|
|
621
|
+
let i = n.value.find((n) => n.path === e);
|
|
622
|
+
if (i) {
|
|
623
|
+
i.isOpen = !0;
|
|
624
|
+
let n = r.value.findIndex((n) => n === e);
|
|
625
|
+
~n ? (r.value.splice(0, 0, r.value[n]), r.value.splice(n)) : r.value.unshift(e);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
function c(e, i = !1) {
|
|
629
|
+
function a(e) {
|
|
630
|
+
let a = n.value.findIndex((n) => n.path === e);
|
|
631
|
+
~a && i && (n.value[a].isOpen = !1, n.value[a].isLoading = !0), r.value = r.value.filter((n) => n !== e);
|
|
632
|
+
}
|
|
633
|
+
isString(e) ? a(e) : e.forEach(a);
|
|
634
|
+
}
|
|
635
|
+
function l() {
|
|
636
|
+
n.value = [], e.value = !1;
|
|
637
|
+
}
|
|
638
|
+
return {
|
|
639
|
+
isGenerate: e,
|
|
640
|
+
openedList: i,
|
|
641
|
+
generateList: a,
|
|
642
|
+
closeLoading: o,
|
|
643
|
+
open: s,
|
|
644
|
+
close: c,
|
|
645
|
+
clean: l,
|
|
646
|
+
recentPathList: r,
|
|
647
|
+
list: n
|
|
648
|
+
};
|
|
649
|
+
});
|
|
650
|
+
function useAuth() {
|
|
651
|
+
function e(e) {
|
|
652
|
+
let n = useSettingsStore(), r = useUserStore();
|
|
653
|
+
return n.settings.app.enablePermission ? r.user.permissions.includes(e) : !0;
|
|
654
|
+
}
|
|
655
|
+
function n(n) {
|
|
656
|
+
let r;
|
|
657
|
+
return r = typeof n == "string" ? n === "" ? !0 : e(n) : n.length > 0 ? n.some((n) => e(n)) : !0, r;
|
|
658
|
+
}
|
|
659
|
+
function r(n) {
|
|
660
|
+
return n.length > 0 ? n.every((n) => e(n)) : !0;
|
|
661
|
+
}
|
|
662
|
+
return {
|
|
663
|
+
auth: n,
|
|
664
|
+
authAll: r
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
var LogLevels = {
|
|
668
|
+
silent: -Infinity,
|
|
669
|
+
fatal: 0,
|
|
670
|
+
error: 0,
|
|
671
|
+
warn: 1,
|
|
672
|
+
log: 2,
|
|
673
|
+
info: 3,
|
|
674
|
+
success: 3,
|
|
675
|
+
fail: 3,
|
|
676
|
+
ready: 3,
|
|
677
|
+
start: 3,
|
|
678
|
+
box: 3,
|
|
679
|
+
debug: 4,
|
|
680
|
+
trace: 5,
|
|
681
|
+
verbose: Infinity
|
|
682
|
+
}, LogTypes = {
|
|
683
|
+
silent: { level: -1 },
|
|
684
|
+
fatal: { level: LogLevels.fatal },
|
|
685
|
+
error: { level: LogLevels.error },
|
|
686
|
+
warn: { level: LogLevels.warn },
|
|
687
|
+
log: { level: LogLevels.log },
|
|
688
|
+
info: { level: LogLevels.info },
|
|
689
|
+
success: { level: LogLevels.success },
|
|
690
|
+
fail: { level: LogLevels.fail },
|
|
691
|
+
ready: { level: LogLevels.info },
|
|
692
|
+
start: { level: LogLevels.info },
|
|
693
|
+
box: { level: LogLevels.info },
|
|
694
|
+
debug: { level: LogLevels.debug },
|
|
695
|
+
trace: { level: LogLevels.trace },
|
|
696
|
+
verbose: { level: LogLevels.verbose }
|
|
697
|
+
};
|
|
698
|
+
function isPlainObject$1(e) {
|
|
699
|
+
if (typeof e != "object" || !e) return !1;
|
|
700
|
+
let n = Object.getPrototypeOf(e);
|
|
701
|
+
return n !== null && n !== Object.prototype && Object.getPrototypeOf(n) !== null || Symbol.iterator in e ? !1 : Symbol.toStringTag in e ? Object.prototype.toString.call(e) === "[object Module]" : !0;
|
|
702
|
+
}
|
|
703
|
+
function _defu(e, n, r = ".", i) {
|
|
704
|
+
if (!isPlainObject$1(n)) return _defu(e, {}, r, i);
|
|
705
|
+
let a = Object.assign({}, n);
|
|
706
|
+
for (let n in e) {
|
|
707
|
+
if (n === "__proto__" || n === "constructor") continue;
|
|
708
|
+
let o = e[n];
|
|
709
|
+
o != null && (i && i(a, n, o, r) || (Array.isArray(o) && Array.isArray(a[n]) ? a[n] = [...o, ...a[n]] : isPlainObject$1(o) && isPlainObject$1(a[n]) ? a[n] = _defu(o, a[n], (r ? `${r}.` : "") + n.toString(), i) : a[n] = o));
|
|
710
|
+
}
|
|
711
|
+
return a;
|
|
712
|
+
}
|
|
713
|
+
function createDefu(e) {
|
|
714
|
+
return (...n) => n.reduce((n, r) => _defu(n, r, "", e), {});
|
|
715
|
+
}
|
|
716
|
+
var defu = createDefu();
|
|
717
|
+
function isPlainObject(e) {
|
|
718
|
+
return Object.prototype.toString.call(e) === "[object Object]";
|
|
719
|
+
}
|
|
720
|
+
function isLogObj(e) {
|
|
721
|
+
return !(!isPlainObject(e) || !e.message && !e.args || e.stack);
|
|
722
|
+
}
|
|
723
|
+
var paused = !1, queue = [], Consola = class e {
|
|
724
|
+
options;
|
|
725
|
+
_lastLog;
|
|
726
|
+
_mockFn;
|
|
727
|
+
constructor(e = {}) {
|
|
728
|
+
let n = e.types || LogTypes;
|
|
729
|
+
this.options = defu({
|
|
730
|
+
...e,
|
|
731
|
+
defaults: { ...e.defaults },
|
|
732
|
+
level: _normalizeLogLevel(e.level, n),
|
|
733
|
+
reporters: [...e.reporters || []]
|
|
734
|
+
}, {
|
|
735
|
+
types: LogTypes,
|
|
736
|
+
throttle: 1e3,
|
|
737
|
+
throttleMin: 5,
|
|
738
|
+
formatOptions: {
|
|
739
|
+
date: !0,
|
|
740
|
+
colors: !1,
|
|
741
|
+
compact: !0
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
for (let e in n) {
|
|
745
|
+
let r = {
|
|
746
|
+
type: e,
|
|
747
|
+
...this.options.defaults,
|
|
748
|
+
...n[e]
|
|
749
|
+
};
|
|
750
|
+
this[e] = this._wrapLogFn(r), this[e].raw = this._wrapLogFn(r, !0);
|
|
751
|
+
}
|
|
752
|
+
this.options.mockFn && this.mockTypes(), this._lastLog = {};
|
|
753
|
+
}
|
|
754
|
+
get level() {
|
|
755
|
+
return this.options.level;
|
|
756
|
+
}
|
|
757
|
+
set level(e) {
|
|
758
|
+
this.options.level = _normalizeLogLevel(e, this.options.types, this.options.level);
|
|
759
|
+
}
|
|
760
|
+
prompt(e, n) {
|
|
761
|
+
if (!this.options.prompt) throw Error("prompt is not supported!");
|
|
762
|
+
return this.options.prompt(e, n);
|
|
763
|
+
}
|
|
764
|
+
create(n) {
|
|
765
|
+
let r = new e({
|
|
766
|
+
...this.options,
|
|
767
|
+
...n
|
|
768
|
+
});
|
|
769
|
+
return this._mockFn && r.mockTypes(this._mockFn), r;
|
|
770
|
+
}
|
|
771
|
+
withDefaults(e) {
|
|
772
|
+
return this.create({
|
|
773
|
+
...this.options,
|
|
774
|
+
defaults: {
|
|
775
|
+
...this.options.defaults,
|
|
776
|
+
...e
|
|
777
|
+
}
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
withTag(e) {
|
|
781
|
+
return this.withDefaults({ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + e : e });
|
|
782
|
+
}
|
|
783
|
+
addReporter(e) {
|
|
784
|
+
return this.options.reporters.push(e), this;
|
|
785
|
+
}
|
|
786
|
+
removeReporter(e) {
|
|
787
|
+
if (e) {
|
|
788
|
+
let n = this.options.reporters.indexOf(e);
|
|
789
|
+
if (n !== -1) return this.options.reporters.splice(n, 1);
|
|
790
|
+
} else this.options.reporters.splice(0);
|
|
791
|
+
return this;
|
|
792
|
+
}
|
|
793
|
+
setReporters(e) {
|
|
794
|
+
return this.options.reporters = Array.isArray(e) ? e : [e], this;
|
|
795
|
+
}
|
|
796
|
+
wrapAll() {
|
|
797
|
+
this.wrapConsole(), this.wrapStd();
|
|
798
|
+
}
|
|
799
|
+
restoreAll() {
|
|
800
|
+
this.restoreConsole(), this.restoreStd();
|
|
801
|
+
}
|
|
802
|
+
wrapConsole() {
|
|
803
|
+
for (let e in this.options.types) console["__" + e] || (console["__" + e] = console[e]), console[e] = this[e].raw;
|
|
804
|
+
}
|
|
805
|
+
restoreConsole() {
|
|
806
|
+
for (let e in this.options.types) console["__" + e] && (console[e] = console["__" + e], delete console["__" + e]);
|
|
807
|
+
}
|
|
808
|
+
wrapStd() {
|
|
809
|
+
this._wrapStream(this.options.stdout, "log"), this._wrapStream(this.options.stderr, "log");
|
|
810
|
+
}
|
|
811
|
+
_wrapStream(e, n) {
|
|
812
|
+
e && (e.__write ||= e.write, e.write = (e) => {
|
|
813
|
+
this[n].raw(String(e).trim());
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
restoreStd() {
|
|
817
|
+
this._restoreStream(this.options.stdout), this._restoreStream(this.options.stderr);
|
|
818
|
+
}
|
|
819
|
+
_restoreStream(e) {
|
|
820
|
+
e && e.__write && (e.write = e.__write, delete e.__write);
|
|
821
|
+
}
|
|
822
|
+
pauseLogs() {
|
|
823
|
+
paused = !0;
|
|
824
|
+
}
|
|
825
|
+
resumeLogs() {
|
|
826
|
+
paused = !1;
|
|
827
|
+
let e = queue.splice(0);
|
|
828
|
+
for (let n of e) n[0]._logFn(n[1], n[2]);
|
|
829
|
+
}
|
|
830
|
+
mockTypes(e) {
|
|
831
|
+
let n = e || this.options.mockFn;
|
|
832
|
+
if (this._mockFn = n, typeof n == "function") for (let e in this.options.types) this[e] = n(e, this.options.types[e]) || this[e], this[e].raw = this[e];
|
|
833
|
+
}
|
|
834
|
+
_wrapLogFn(e, n) {
|
|
835
|
+
return (...r) => {
|
|
836
|
+
if (paused) {
|
|
837
|
+
queue.push([
|
|
838
|
+
this,
|
|
839
|
+
e,
|
|
840
|
+
r,
|
|
841
|
+
n
|
|
842
|
+
]);
|
|
843
|
+
return;
|
|
844
|
+
}
|
|
845
|
+
return this._logFn(e, r, n);
|
|
846
|
+
};
|
|
847
|
+
}
|
|
848
|
+
_logFn(e, n, r) {
|
|
849
|
+
if ((e.level || 0) > this.level) return !1;
|
|
850
|
+
let i = {
|
|
851
|
+
date: /* @__PURE__ */ new Date(),
|
|
852
|
+
args: [],
|
|
853
|
+
...e,
|
|
854
|
+
level: _normalizeLogLevel(e.level, this.options.types)
|
|
855
|
+
};
|
|
856
|
+
!r && n.length === 1 && isLogObj(n[0]) ? Object.assign(i, n[0]) : i.args = [...n], i.message && (i.args.unshift(i.message), delete i.message), i.additional && (Array.isArray(i.additional) || (i.additional = i.additional.split("\n")), i.args.push("\n" + i.additional.join("\n")), delete i.additional), i.type = typeof i.type == "string" ? i.type.toLowerCase() : "log", i.tag = typeof i.tag == "string" ? i.tag : "";
|
|
857
|
+
let a = (e = !1) => {
|
|
858
|
+
let n = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
859
|
+
if (this._lastLog.object && n > 0) {
|
|
860
|
+
let e = [...this._lastLog.object.args];
|
|
861
|
+
n > 1 && e.push(`(repeated ${n} times)`), this._log({
|
|
862
|
+
...this._lastLog.object,
|
|
863
|
+
args: e
|
|
864
|
+
}), this._lastLog.count = 1;
|
|
865
|
+
}
|
|
866
|
+
e && (this._lastLog.object = i, this._log(i));
|
|
867
|
+
};
|
|
868
|
+
clearTimeout(this._lastLog.timeout);
|
|
869
|
+
let o = this._lastLog.time && i.date ? i.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
870
|
+
if (this._lastLog.time = i.date, o < this.options.throttle) try {
|
|
871
|
+
let e = JSON.stringify([
|
|
872
|
+
i.type,
|
|
873
|
+
i.tag,
|
|
874
|
+
i.args
|
|
875
|
+
]), n = this._lastLog.serialized === e;
|
|
876
|
+
if (this._lastLog.serialized = e, n && (this._lastLog.count = (this._lastLog.count || 0) + 1, this._lastLog.count > this.options.throttleMin)) {
|
|
877
|
+
this._lastLog.timeout = setTimeout(a, this.options.throttle);
|
|
878
|
+
return;
|
|
879
|
+
}
|
|
880
|
+
} catch {}
|
|
881
|
+
a(!0);
|
|
882
|
+
}
|
|
883
|
+
_log(e) {
|
|
884
|
+
for (let n of this.options.reporters) n.log(e, { options: this.options });
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
function _normalizeLogLevel(e, n = {}, r = 3) {
|
|
888
|
+
return e === void 0 ? r : typeof e == "number" ? e : n[e] && n[e].level !== void 0 ? n[e].level : r;
|
|
889
|
+
}
|
|
890
|
+
Consola.prototype.add = Consola.prototype.addReporter, Consola.prototype.remove = Consola.prototype.removeReporter, Consola.prototype.clear = Consola.prototype.removeReporter, Consola.prototype.withScope = Consola.prototype.withTag, Consola.prototype.mock = Consola.prototype.mockTypes, Consola.prototype.pause = Consola.prototype.pauseLogs, Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
891
|
+
function createConsola$1(e = {}) {
|
|
892
|
+
return new Consola(e);
|
|
893
|
+
}
|
|
894
|
+
var BrowserReporter = class {
|
|
895
|
+
options;
|
|
896
|
+
defaultColor;
|
|
897
|
+
levelColorMap;
|
|
898
|
+
typeColorMap;
|
|
899
|
+
constructor(e) {
|
|
900
|
+
this.options = { ...e }, this.defaultColor = "#7f8c8d", this.levelColorMap = {
|
|
901
|
+
0: "#c0392b",
|
|
902
|
+
1: "#f39c12",
|
|
903
|
+
3: "#00BCD4"
|
|
904
|
+
}, this.typeColorMap = { success: "#2ecc71" };
|
|
905
|
+
}
|
|
906
|
+
_getLogFn(e) {
|
|
907
|
+
return e < 1 ? console.__error || console.error : e === 1 ? console.__warn || console.warn : console.__log || console.log;
|
|
908
|
+
}
|
|
909
|
+
log(e) {
|
|
910
|
+
let n = this._getLogFn(e.level), r = e.type === "log" ? "" : e.type, i = e.tag || "", a = `
|
|
911
|
+
background: ${this.typeColorMap[e.type] || this.levelColorMap[e.level] || this.defaultColor};
|
|
912
|
+
border-radius: 0.5em;
|
|
913
|
+
color: white;
|
|
914
|
+
font-weight: bold;
|
|
915
|
+
padding: 2px 0.5em;
|
|
916
|
+
`, o = `%c${[i, r].filter(Boolean).join(":")}`;
|
|
917
|
+
typeof e.args[0] == "string" ? n(`${o}%c ${e.args[0]}`, a, "", ...e.args.slice(1)) : n(o, a, ...e.args);
|
|
918
|
+
}
|
|
919
|
+
};
|
|
920
|
+
function createConsola(e = {}) {
|
|
921
|
+
return createConsola$1({
|
|
922
|
+
reporters: e.reporters || [new BrowserReporter({})],
|
|
923
|
+
prompt(e, n = {}) {
|
|
924
|
+
return n.type === "confirm" ? Promise.resolve(confirm(e)) : Promise.resolve(prompt(e));
|
|
925
|
+
},
|
|
926
|
+
...e
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
createConsola().withTag("[PUBINFO]");
|
|
930
|
+
var LOG_TYPE = /* @__PURE__ */ function(e) {
|
|
931
|
+
return e.ERROR = "error", e.SUCCESS = "success", e.WARN = "warn", e.INFO = "info", e.START = "start", e.BOX = "box", e;
|
|
932
|
+
}(LOG_TYPE || {}), EMOJI = /* @__PURE__ */ function(e) {
|
|
933
|
+
return e.ERROR = "🔴", e.SUCCESS = "🟢", e.WARN = "🟡", e.INFO = "🔵", e.START = "🟩", e.BOX = "🟧", e;
|
|
934
|
+
}(EMOJI || {});
|
|
935
|
+
function createLog(e, n) {
|
|
936
|
+
return (e) => {};
|
|
937
|
+
}
|
|
938
|
+
const useError = createLog(LOG_TYPE.ERROR, EMOJI.ERROR), useSuccess = createLog(LOG_TYPE.SUCCESS, EMOJI.SUCCESS), useWarn = createLog(LOG_TYPE.WARN, EMOJI.WARN), useInfo = createLog(LOG_TYPE.INFO, EMOJI.INFO), useStart = createLog(LOG_TYPE.START, EMOJI.START), useBox = createLog(LOG_TYPE.BOX, EMOJI.BOX);
|
|
939
|
+
var SUPPORTED_STORE_IDS = new Set([
|
|
940
|
+
"user",
|
|
941
|
+
"settings",
|
|
942
|
+
"menu",
|
|
943
|
+
"route",
|
|
944
|
+
"tabbar",
|
|
945
|
+
"iframe",
|
|
946
|
+
"keepAlive",
|
|
947
|
+
"favorites"
|
|
948
|
+
]), missingPiniaWarnings = /* @__PURE__ */ new Set();
|
|
949
|
+
function warnMissingPinia(e) {
|
|
950
|
+
missingPiniaWarnings.has(e) || (missingPiniaWarnings.add(e), console.warn(`[usePartyLogin] Pinia instance is not ready when trying to access the "${e}" store. Provide a Pinia instance via usePartyLogin(..., { pinia }) or ensure Pinia is registered before calling this hook.`));
|
|
951
|
+
}
|
|
952
|
+
function getNestedValue(e, n) {
|
|
953
|
+
if (!e || !n) return "";
|
|
954
|
+
let r = n.split("."), i = e;
|
|
955
|
+
for (let e of r) if (i && typeof i == "object" && e in i) i = i[e];
|
|
956
|
+
else return "";
|
|
957
|
+
return i ?? "";
|
|
958
|
+
}
|
|
959
|
+
function getStoreFromPinia(e, n) {
|
|
960
|
+
return (e?._s)?.get(n);
|
|
961
|
+
}
|
|
962
|
+
function resolveParamValue(e, n, r) {
|
|
963
|
+
switch (e.type) {
|
|
964
|
+
case "string":
|
|
965
|
+
case "number": return e.value ?? "";
|
|
966
|
+
case "boolean": return e.value === "true";
|
|
967
|
+
case "system": {
|
|
968
|
+
if (!e.field) return "";
|
|
969
|
+
let [n, i] = e.field.split(":");
|
|
970
|
+
if (!n || !i) return "";
|
|
971
|
+
try {
|
|
972
|
+
if (!SUPPORTED_STORE_IDS.has(n)) return console.warn(`Store "${n}" is not supported in usePartyLogin.`), "";
|
|
973
|
+
let e = r ?? getActivePinia();
|
|
974
|
+
if (!e) return warnMissingPinia(n), "";
|
|
975
|
+
let a = getStoreFromPinia(e, n);
|
|
976
|
+
return a ? getNestedValue(a, i) : (warnMissingStore(n), "");
|
|
977
|
+
} catch (n) {
|
|
978
|
+
return console.error(`Error accessing store field ${e.field}:`, n), "";
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
case "request": return !e.field || !n ? "" : getNestedValue(n, e.field);
|
|
982
|
+
default: return e.value ?? "";
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
function buildParams(e, n, r) {
|
|
986
|
+
let i = {};
|
|
987
|
+
return e.forEach((e) => {
|
|
988
|
+
e.key && (i[e.key] = resolveParamValue(e, n, r));
|
|
989
|
+
}), i;
|
|
990
|
+
}
|
|
991
|
+
function buildOAuthUrl(e, n, r, i) {
|
|
992
|
+
let a = buildParams(n, r, i), o = Object.entries(a);
|
|
993
|
+
if (o.length === 0) return safeDecodeUrl(e);
|
|
994
|
+
let s = new URLSearchParams();
|
|
995
|
+
o.forEach(([e, n]) => {
|
|
996
|
+
s.append(e, String(n));
|
|
997
|
+
});
|
|
998
|
+
let c = s.toString(), l = e.indexOf("#"), u = l >= 0, d = u ? e.slice(0, l) : e, f = u ? e.slice(l + 1) : "";
|
|
999
|
+
if (u && shouldAppendParamsToHash(f)) return safeDecodeUrl(`${d}#${appendParamsToHash(f, c)}`);
|
|
1000
|
+
let p = appendParamsToBaseUrl(d, s, c);
|
|
1001
|
+
return safeDecodeUrl(u ? `${p}#${f}` : p);
|
|
1002
|
+
}
|
|
1003
|
+
function shouldAppendParamsToHash(e) {
|
|
1004
|
+
if (!e) return !1;
|
|
1005
|
+
let n = e.trim();
|
|
1006
|
+
return n ? n.startsWith("/") || n.startsWith("!/") || n.startsWith("?") : !1;
|
|
1007
|
+
}
|
|
1008
|
+
function appendParamsToHash(e, n) {
|
|
1009
|
+
return n ? e ? `${e}${resolveQuerySeparator(e)}${n}` : `?${n}` : e;
|
|
1010
|
+
}
|
|
1011
|
+
function appendParamsToBaseUrl(e, n, r) {
|
|
1012
|
+
if (!r) return e;
|
|
1013
|
+
if (!e) return `?${r}`;
|
|
1014
|
+
try {
|
|
1015
|
+
let r = new URL(e);
|
|
1016
|
+
return n.forEach((e, n) => {
|
|
1017
|
+
r.searchParams.append(n, e);
|
|
1018
|
+
}), r.toString();
|
|
1019
|
+
} catch {
|
|
1020
|
+
return `${e}${resolveQuerySeparator(e)}${r}`;
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
function resolveQuerySeparator(e) {
|
|
1024
|
+
return !e || !e.includes("?") ? "?" : /[?&]$/.test(e) ? "" : "&";
|
|
1025
|
+
}
|
|
1026
|
+
function safeDecodeUrl(e) {
|
|
1027
|
+
try {
|
|
1028
|
+
return decodeURIComponent(e);
|
|
1029
|
+
} catch {
|
|
1030
|
+
return e;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
function buildQueryString(e) {
|
|
1034
|
+
let n = new URLSearchParams();
|
|
1035
|
+
return Object.entries(e).forEach(([e, r]) => {
|
|
1036
|
+
r != null && n.append(e, String(r));
|
|
1037
|
+
}), n.toString();
|
|
1038
|
+
}
|
|
1039
|
+
function serializeBody(e, n) {
|
|
1040
|
+
let r = n["Content-Type"] || n["content-type"] || "application/json";
|
|
1041
|
+
if (!e || Object.keys(e).length === 0) return;
|
|
1042
|
+
let i = r.split(";")[0].trim().toLowerCase();
|
|
1043
|
+
if (i === "application/json") return JSON.stringify(e);
|
|
1044
|
+
if (i === "application/x-www-form-urlencoded") {
|
|
1045
|
+
let n = new URLSearchParams();
|
|
1046
|
+
return Object.entries(e).forEach(([e, r]) => {
|
|
1047
|
+
r != null && n.append(e, String(r));
|
|
1048
|
+
}), n.toString();
|
|
1049
|
+
}
|
|
1050
|
+
if (i === "multipart/form-data") {
|
|
1051
|
+
let r = new FormData();
|
|
1052
|
+
return Object.entries(e).forEach(([e, n]) => {
|
|
1053
|
+
n != null && r.append(e, n);
|
|
1054
|
+
}), delete n["Content-Type"], delete n["content-type"], r;
|
|
1055
|
+
}
|
|
1056
|
+
return JSON.stringify(e);
|
|
1057
|
+
}
|
|
1058
|
+
function deepParseJSON(e) {
|
|
1059
|
+
if (e == null) return e;
|
|
1060
|
+
if (typeof e == "string") try {
|
|
1061
|
+
return deepParseJSON(JSON.parse(e));
|
|
1062
|
+
} catch {
|
|
1063
|
+
return e;
|
|
1064
|
+
}
|
|
1065
|
+
if (Array.isArray(e)) return e.map((e) => deepParseJSON(e));
|
|
1066
|
+
if (typeof e == "object") {
|
|
1067
|
+
let n = {};
|
|
1068
|
+
for (let r in e) Object.prototype.hasOwnProperty.call(e, r) && (n[r] = deepParseJSON(e[r]));
|
|
1069
|
+
return n;
|
|
1070
|
+
}
|
|
1071
|
+
return e;
|
|
1072
|
+
}
|
|
1073
|
+
async function usePartyLogin(e, n, r = {}) {
|
|
1074
|
+
let { execute: i = !0, pinia: a } = r, o = ref(""), s = ref(!1), c = ref(null);
|
|
1075
|
+
async function l() {
|
|
1076
|
+
if (!e || e.length < 2) throw Error("PartyLogin config must have at least 2 steps");
|
|
1077
|
+
if (!n) throw Error("Target URL is required for OAuth redirect");
|
|
1078
|
+
let r = e.find((e) => e.step === 1), i = e.find((e) => e.step === 2);
|
|
1079
|
+
if (!r || !i) throw Error("Step 1 and Step 2 configurations are required");
|
|
1080
|
+
if (!r.request) throw Error("Step 1 must have request configuration");
|
|
1081
|
+
if (!i.oauth) throw Error("Step 2 must have OAuth configuration");
|
|
1082
|
+
let { url: l, method: u, params: d } = r.request, f = a ?? getActivePinia(), p = d.query ? buildParams(d.query, void 0, f) : {}, m = d.body ? buildParams(d.body, void 0, f) : {}, h = d.header ? buildParams(d.header, void 0, f) : {}, g = d.cookie ? buildParams(d.cookie, void 0, f) : {}, _ = {};
|
|
1083
|
+
Object.entries(h).forEach(([e, n]) => {
|
|
1084
|
+
_[e] = String(n);
|
|
1085
|
+
});
|
|
1086
|
+
let v = Object.entries(g).map(([e, n]) => `${e}=${n}`);
|
|
1087
|
+
v.length > 0 && (_.Cookie = v.join("; "));
|
|
1088
|
+
let y = l, b = buildQueryString(p);
|
|
1089
|
+
b && (y = `${l}${l.includes("?") ? "&" : "?"}${b}`);
|
|
1090
|
+
let x;
|
|
1091
|
+
["GET", "HEAD"].includes(u) || (!_["Content-Type"] && !_["content-type"] && (_["Content-Type"] = "application/json"), x = serializeBody(m, _)), s.value = !0, c.value = null;
|
|
1092
|
+
try {
|
|
1093
|
+
let e = await fetch(y, {
|
|
1094
|
+
method: u,
|
|
1095
|
+
headers: _,
|
|
1096
|
+
body: x,
|
|
1097
|
+
credentials: v.length > 0 ? "include" : "same-origin",
|
|
1098
|
+
mode: "cors"
|
|
1099
|
+
});
|
|
1100
|
+
if (!e.ok) throw Error(`HTTP ${e.status}: ${e.statusText}`);
|
|
1101
|
+
let r = e.headers.get("content-type") || "", a = {};
|
|
1102
|
+
if (r.includes("application/json")) a = deepParseJSON(await e.json());
|
|
1103
|
+
else {
|
|
1104
|
+
let n = await e.text();
|
|
1105
|
+
try {
|
|
1106
|
+
a = deepParseJSON(JSON.parse(n));
|
|
1107
|
+
} catch {
|
|
1108
|
+
a = { data: n };
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
let s = buildOAuthUrl(n, i.oauth.params, a, f);
|
|
1112
|
+
return o.value = s, s;
|
|
1113
|
+
} catch (e) {
|
|
1114
|
+
throw c.value = /* @__PURE__ */ Error(`第一步请求失败: ${e?.message || String(e)}`), c.value;
|
|
1115
|
+
} finally {
|
|
1116
|
+
s.value = !1;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
return i && await l(), {
|
|
1120
|
+
url: o,
|
|
1121
|
+
loading: s,
|
|
1122
|
+
error: c,
|
|
1123
|
+
execute: l
|
|
1124
|
+
};
|
|
1125
|
+
}
|
|
1126
|
+
function warnMissingStore(e) {
|
|
1127
|
+
console.warn(`[usePartyLogin] Store "${e}" is not registered in Pinia.`);
|
|
1128
|
+
}
|
|
1129
|
+
function useTheme() {
|
|
1130
|
+
let e = useSettingsStore();
|
|
1131
|
+
return { isDark: computed({
|
|
1132
|
+
get() {
|
|
1133
|
+
return e.settings.app.colorScheme === "dark";
|
|
1134
|
+
},
|
|
1135
|
+
set(n) {
|
|
1136
|
+
e.settings.app.colorScheme = n ? "dark" : "light";
|
|
1137
|
+
}
|
|
1138
|
+
}) };
|
|
1139
|
+
}
|
|
1140
|
+
var useKeepAliveStore = defineStore(STORE_NAME.KEEP_ALIVE, () => {
|
|
1141
|
+
let e = ref([]);
|
|
1142
|
+
function n(r) {
|
|
1143
|
+
if (isString(r)) return !e.value.includes(r) && e.value.push(r);
|
|
1144
|
+
if (isArray(r)) {
|
|
1145
|
+
r.forEach((e) => n(e));
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
useWarn(`KeepAlive 需要接受一个字符串或者字符串数组作为参数, 但是接受到了 ${typeof r} 类型`);
|
|
1149
|
+
}
|
|
1150
|
+
function r(n) {
|
|
1151
|
+
isString(n) && (e.value = e.value.filter((e) => e !== n)), isArray(n) && (e.value = e.value.filter((e) => !n.includes(e)));
|
|
1152
|
+
}
|
|
1153
|
+
function i() {
|
|
1154
|
+
e.value = [];
|
|
1155
|
+
}
|
|
1156
|
+
return {
|
|
1157
|
+
list: e,
|
|
1158
|
+
add: n,
|
|
1159
|
+
remove: r,
|
|
1160
|
+
clean: i
|
|
1161
|
+
};
|
|
1162
|
+
}), require_dist = /* @__PURE__ */ __commonJSMin(((e) => {
|
|
1163
|
+
Object.defineProperty(e, "__esModule", { value: !0 }), e.PathError = e.TokenData = void 0, e.compile = d, e.match = m;
|
|
1164
|
+
var n = "/", r = (e) => e, i = /^[$_\p{ID_Start}]$/u, a = /^[$\u200c\u200d\p{ID_Continue}]$/u, o = {
|
|
1165
|
+
"{": "{",
|
|
1166
|
+
"}": "}",
|
|
1167
|
+
"(": "(",
|
|
1168
|
+
")": ")",
|
|
1169
|
+
"[": "[",
|
|
1170
|
+
"]": "]",
|
|
1171
|
+
"+": "+",
|
|
1172
|
+
"?": "?",
|
|
1173
|
+
"!": "!"
|
|
1174
|
+
};
|
|
1175
|
+
function s(e) {
|
|
1176
|
+
return e.replace(/[.+*?^${}()[\]|/\\]/g, "\\$&");
|
|
1177
|
+
}
|
|
1178
|
+
var c = class {
|
|
1179
|
+
constructor(e, n) {
|
|
1180
|
+
this.tokens = e, this.originalPath = n;
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
e.TokenData = c;
|
|
1184
|
+
var l = class extends TypeError {
|
|
1185
|
+
constructor(e, n) {
|
|
1186
|
+
let r = e;
|
|
1187
|
+
n && (r += `: ${n}`), r += "; visit https://git.new/pathToRegexpError for info", super(r), this.originalPath = n;
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
e.PathError = l;
|
|
1191
|
+
function u(e, n = {}) {
|
|
1192
|
+
let { encodePath: s = r } = n, u = [...e], d = [], f = 0, p = 0;
|
|
1193
|
+
function m() {
|
|
1194
|
+
let n = "";
|
|
1195
|
+
if (i.test(u[f])) do
|
|
1196
|
+
n += u[f++];
|
|
1197
|
+
while (a.test(u[f]));
|
|
1198
|
+
else if (u[f] === "\"") {
|
|
1199
|
+
let r = f;
|
|
1200
|
+
for (; f++ < u.length;) {
|
|
1201
|
+
if (u[f] === "\"") {
|
|
1202
|
+
f++, r = 0;
|
|
1203
|
+
break;
|
|
1204
|
+
}
|
|
1205
|
+
u[f] === "\\" && f++, n += u[f];
|
|
1206
|
+
}
|
|
1207
|
+
if (r) throw new l(`Unterminated quote at index ${r}`, e);
|
|
1208
|
+
}
|
|
1209
|
+
if (!n) throw new l(`Missing parameter name at index ${f}`, e);
|
|
1210
|
+
return n;
|
|
1211
|
+
}
|
|
1212
|
+
for (; f < u.length;) {
|
|
1213
|
+
let e = u[f], n = o[e];
|
|
1214
|
+
n ? d.push({
|
|
1215
|
+
type: n,
|
|
1216
|
+
index: f++,
|
|
1217
|
+
value: e
|
|
1218
|
+
}) : e === "\\" ? d.push({
|
|
1219
|
+
type: "escape",
|
|
1220
|
+
index: f++,
|
|
1221
|
+
value: u[f++]
|
|
1222
|
+
}) : e === ":" ? d.push({
|
|
1223
|
+
type: "param",
|
|
1224
|
+
index: f++,
|
|
1225
|
+
value: m()
|
|
1226
|
+
}) : e === "*" ? d.push({
|
|
1227
|
+
type: "wildcard",
|
|
1228
|
+
index: f++,
|
|
1229
|
+
value: m()
|
|
1230
|
+
}) : d.push({
|
|
1231
|
+
type: "char",
|
|
1232
|
+
index: f++,
|
|
1233
|
+
value: e
|
|
1234
|
+
});
|
|
1235
|
+
}
|
|
1236
|
+
d.push({
|
|
1237
|
+
type: "end",
|
|
1238
|
+
index: f,
|
|
1239
|
+
value: ""
|
|
1240
|
+
});
|
|
1241
|
+
function h(n) {
|
|
1242
|
+
let r = [];
|
|
1243
|
+
for (;;) {
|
|
1244
|
+
let i = d[p++];
|
|
1245
|
+
if (i.type === n) break;
|
|
1246
|
+
if (i.type === "char" || i.type === "escape") {
|
|
1247
|
+
let e = i.value, n = d[p];
|
|
1248
|
+
for (; n.type === "char" || n.type === "escape";) e += n.value, n = d[++p];
|
|
1249
|
+
r.push({
|
|
1250
|
+
type: "text",
|
|
1251
|
+
value: s(e)
|
|
1252
|
+
});
|
|
1253
|
+
continue;
|
|
1254
|
+
}
|
|
1255
|
+
if (i.type === "param" || i.type === "wildcard") {
|
|
1256
|
+
r.push({
|
|
1257
|
+
type: i.type,
|
|
1258
|
+
name: i.value
|
|
1259
|
+
});
|
|
1260
|
+
continue;
|
|
1261
|
+
}
|
|
1262
|
+
if (i.type === "{") {
|
|
1263
|
+
r.push({
|
|
1264
|
+
type: "group",
|
|
1265
|
+
tokens: h("}")
|
|
1266
|
+
});
|
|
1267
|
+
continue;
|
|
1268
|
+
}
|
|
1269
|
+
throw new l(`Unexpected ${i.type} at index ${i.index}, expected ${n}`, e);
|
|
1270
|
+
}
|
|
1271
|
+
return r;
|
|
1272
|
+
}
|
|
1273
|
+
return new c(h("end"), e);
|
|
1274
|
+
}
|
|
1275
|
+
function d(e, r = {}) {
|
|
1276
|
+
let { encode: i = encodeURIComponent, delimiter: a = n } = r, o = f((typeof e == "object" ? e : u(e, r)).tokens, a, i);
|
|
1277
|
+
return function(e = {}) {
|
|
1278
|
+
let [n, ...r] = o(e);
|
|
1279
|
+
if (r.length) throw TypeError(`Missing parameters: ${r.join(", ")}`);
|
|
1280
|
+
return n;
|
|
1281
|
+
};
|
|
1282
|
+
}
|
|
1283
|
+
function f(e, n, r) {
|
|
1284
|
+
let i = e.map((e) => p(e, n, r));
|
|
1285
|
+
return (e) => {
|
|
1286
|
+
let n = [""];
|
|
1287
|
+
for (let r of i) {
|
|
1288
|
+
let [i, ...a] = r(e);
|
|
1289
|
+
n[0] += i, n.push(...a);
|
|
1290
|
+
}
|
|
1291
|
+
return n;
|
|
1292
|
+
};
|
|
1293
|
+
}
|
|
1294
|
+
function p(e, n, i) {
|
|
1295
|
+
if (e.type === "text") return () => [e.value];
|
|
1296
|
+
if (e.type === "group") {
|
|
1297
|
+
let r = f(e.tokens, n, i);
|
|
1298
|
+
return (e) => {
|
|
1299
|
+
let [n, ...i] = r(e);
|
|
1300
|
+
return i.length ? [""] : [n];
|
|
1301
|
+
};
|
|
1302
|
+
}
|
|
1303
|
+
let a = i || r;
|
|
1304
|
+
return e.type === "wildcard" && i !== !1 ? (r) => {
|
|
1305
|
+
let i = r[e.name];
|
|
1306
|
+
if (i == null) return ["", e.name];
|
|
1307
|
+
if (!Array.isArray(i) || i.length === 0) throw TypeError(`Expected "${e.name}" to be a non-empty array`);
|
|
1308
|
+
return [i.map((n, r) => {
|
|
1309
|
+
if (typeof n != "string") throw TypeError(`Expected "${e.name}/${r}" to be a string`);
|
|
1310
|
+
return a(n);
|
|
1311
|
+
}).join(n)];
|
|
1312
|
+
} : (n) => {
|
|
1313
|
+
let r = n[e.name];
|
|
1314
|
+
if (r == null) return ["", e.name];
|
|
1315
|
+
if (typeof r != "string") throw TypeError(`Expected "${e.name}" to be a string`);
|
|
1316
|
+
return [a(r)];
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
function m(e, i = {}) {
|
|
1320
|
+
let { decode: a = decodeURIComponent, delimiter: o = n } = i, { regexp: s, keys: c } = h(e, i), l = c.map((e) => a === !1 ? r : e.type === "param" ? a : (e) => e.split(o).map(a));
|
|
1321
|
+
return function(e) {
|
|
1322
|
+
let n = s.exec(e);
|
|
1323
|
+
if (!n) return !1;
|
|
1324
|
+
let r = n[0], i = Object.create(null);
|
|
1325
|
+
for (let e = 1; e < n.length; e++) {
|
|
1326
|
+
if (n[e] === void 0) continue;
|
|
1327
|
+
let r = c[e - 1], a = l[e - 1];
|
|
1328
|
+
i[r.name] = a(n[e]);
|
|
1329
|
+
}
|
|
1330
|
+
return {
|
|
1331
|
+
path: r,
|
|
1332
|
+
params: i
|
|
1333
|
+
};
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
function h(e, r = {}) {
|
|
1337
|
+
let { delimiter: i = n, end: a = !0, sensitive: o = !1, trailing: c = !0 } = r, l = [], d = o ? "" : "i", f = [];
|
|
1338
|
+
for (let n of g(e, [])) {
|
|
1339
|
+
let e = typeof n == "object" ? n : u(n, r);
|
|
1340
|
+
for (let n of _(e.tokens, 0, [])) f.push(v(n, i, l, e.originalPath));
|
|
1341
|
+
}
|
|
1342
|
+
let p = `^(?:${f.join("|")})`;
|
|
1343
|
+
return c && (p += `(?:${s(i)}$)?`), p += a ? "$" : `(?=${s(i)}|$)`, {
|
|
1344
|
+
regexp: new RegExp(p, d),
|
|
1345
|
+
keys: l
|
|
1346
|
+
};
|
|
1347
|
+
}
|
|
1348
|
+
function g(e, n) {
|
|
1349
|
+
if (Array.isArray(e)) for (let r of e) g(r, n);
|
|
1350
|
+
else n.push(e);
|
|
1351
|
+
return n;
|
|
1352
|
+
}
|
|
1353
|
+
function* _(e, n, r) {
|
|
1354
|
+
if (n === e.length) return yield r;
|
|
1355
|
+
let i = e[n];
|
|
1356
|
+
if (i.type === "group") for (let a of _(i.tokens, 0, r.slice())) yield* _(e, n + 1, a);
|
|
1357
|
+
else r.push(i);
|
|
1358
|
+
yield* _(e, n + 1, r);
|
|
1359
|
+
}
|
|
1360
|
+
function v(e, n, r, i) {
|
|
1361
|
+
let a = "", o = "", c = !0;
|
|
1362
|
+
for (let u of e) {
|
|
1363
|
+
if (u.type === "text") {
|
|
1364
|
+
a += s(u.value), o += u.value, c ||= u.value.includes(n);
|
|
1365
|
+
continue;
|
|
1366
|
+
}
|
|
1367
|
+
if (u.type === "param" || u.type === "wildcard") {
|
|
1368
|
+
if (!c && !o) throw new l(`Missing text before "${u.name}" ${u.type}`, i);
|
|
1369
|
+
u.type === "param" ? a += `(${y(n, c ? "" : o)}+)` : a += "([\\s\\S]+)", r.push(u), o = "", c = !1;
|
|
1370
|
+
continue;
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
return a;
|
|
1374
|
+
}
|
|
1375
|
+
function y(e, n) {
|
|
1376
|
+
return n.length < 2 ? e.length < 2 ? `[^${s(e + n)}]` : `(?:(?!${s(e)})[^${s(n)}])` : e.length < 2 ? `(?:(?!${s(n)})[^${s(e)}])` : `(?:(?!${s(n)}|${s(e)})[\\s\\S])`;
|
|
1377
|
+
}
|
|
1378
|
+
}));
|
|
1379
|
+
function putRbacUserChangePassword(e, n) {
|
|
1380
|
+
return basic.Put("/rbac/user/changePassword", {}, {
|
|
1381
|
+
params: { ...e },
|
|
1382
|
+
...n || {}
|
|
1383
|
+
});
|
|
1384
|
+
}
|
|
1385
|
+
function getRbacUserUserEntireInfo(e) {
|
|
1386
|
+
return basic.Get("/rbac/user/userEntireInfo", { ...e || {} });
|
|
1387
|
+
}
|
|
1388
|
+
function getRbacResourceGrantedResources(e) {
|
|
1389
|
+
return basic.Get("/rbac/resource/grantedResources", { ...e || {} });
|
|
1390
|
+
}
|
|
1391
|
+
function postRbacResourceMineOrAllResourceTree(e, n) {
|
|
1392
|
+
return basic.Post("/rbac/resource/mineOrAllResourceTree", {}, {
|
|
1393
|
+
params: {
|
|
1394
|
+
enable: "true",
|
|
1395
|
+
...e
|
|
1396
|
+
},
|
|
1397
|
+
...n || {}
|
|
1398
|
+
});
|
|
1399
|
+
}
|
|
1400
|
+
let RESOURCE_TYPE = /* @__PURE__ */ function(e) {
|
|
1401
|
+
return e.APP = "1", e.INDEX = "2", e.MENU = "3", e.BUTTON = "4", e.NON_MENU = "5", e.DYNAMIC_APP = "7", e.IFRAME = "8", e.LINK = "9", e;
|
|
1402
|
+
}({});
|
|
1403
|
+
var rawAsyncRoutes = [];
|
|
1404
|
+
function defineAsyncRoutes(e, n) {
|
|
1405
|
+
return rawAsyncRoutes.push({
|
|
1406
|
+
routes: e,
|
|
1407
|
+
sort: n?.sort ?? 0
|
|
1408
|
+
}), e;
|
|
1409
|
+
}
|
|
1410
|
+
function getAsyncRoutes() {
|
|
1411
|
+
return rawAsyncRoutes.sort((e, n) => e?.sort - n?.sort).map((e) => e.routes).flat();
|
|
1412
|
+
}
|
|
1413
|
+
var systemRoutes = [{
|
|
1414
|
+
path: "/",
|
|
1415
|
+
meta: {
|
|
1416
|
+
title: () => useSettingsStore().settings.home.title,
|
|
1417
|
+
breadcrumb: !1
|
|
1418
|
+
},
|
|
1419
|
+
children: [{
|
|
1420
|
+
path: "profile",
|
|
1421
|
+
name: "Profile",
|
|
1422
|
+
component: () => import("./profile-BVXIFuBG.js"),
|
|
1423
|
+
meta: {
|
|
1424
|
+
title: "个人中心",
|
|
1425
|
+
icon: "i-iconamoon-profile-duotone"
|
|
1426
|
+
}
|
|
1427
|
+
}]
|
|
1428
|
+
}];
|
|
1429
|
+
function defineSystemRoutes(e) {
|
|
1430
|
+
systemRoutes[0].children?.push(...e);
|
|
1431
|
+
}
|
|
1432
|
+
function getSystemRoutes() {
|
|
1433
|
+
return systemRoutes[0].component || (systemRoutes[0].component = setupDefaultLayout()), systemRoutes;
|
|
1434
|
+
}
|
|
1435
|
+
function formatBackRoutes(e = [], n = {}) {
|
|
1436
|
+
let r = filterRoutes(e, [RESOURCE_TYPE.BUTTON]).map((e) => {
|
|
1437
|
+
let r = e?.children && e.children.length > 0 ? formatBackRoutes(e.children, e) : [], i = omitBy({
|
|
1438
|
+
id: e?.id,
|
|
1439
|
+
title: e?.name ?? "",
|
|
1440
|
+
auth: e?.code,
|
|
1441
|
+
icon: e?.icon,
|
|
1442
|
+
...e?.meta,
|
|
1443
|
+
...e.type === RESOURCE_TYPE.APP || e.type === RESOURCE_TYPE.DYNAMIC_APP ? {
|
|
1444
|
+
sidebar: !0,
|
|
1445
|
+
tabbar: !0,
|
|
1446
|
+
devText: e?.meta?.devText || "该功能暂未上线,敬请期待!"
|
|
1447
|
+
} : {},
|
|
1448
|
+
...e.type === RESOURCE_TYPE.INDEX ? { tabbar: !0 } : {}
|
|
1449
|
+
}, isUndefined), a = cloneDeep(omitBy({
|
|
1450
|
+
name: e?.meta?.routeName ?? void 0,
|
|
1451
|
+
path: e?.meta?.url ?? void 0,
|
|
1452
|
+
component: e?.meta?.component ?? void 0,
|
|
1453
|
+
children: r,
|
|
1454
|
+
meta: i
|
|
1455
|
+
}, isUndefined));
|
|
1456
|
+
switch (e.type) {
|
|
1457
|
+
case RESOURCE_TYPE.DYNAMIC_APP: return a;
|
|
1458
|
+
case RESOURCE_TYPE.INDEX: return transformIndex(a, n);
|
|
1459
|
+
case RESOURCE_TYPE.MENU:
|
|
1460
|
+
case RESOURCE_TYPE.IFRAME:
|
|
1461
|
+
case RESOURCE_TYPE.LINK: return transformMenuAndIframe(a, n);
|
|
1462
|
+
case RESOURCE_TYPE.NON_MENU: return transformNonMenu(a, n);
|
|
1463
|
+
default: return a;
|
|
1464
|
+
}
|
|
1465
|
+
});
|
|
1466
|
+
return isEmpty(n) ? filterEmptyComponentRoutes(r) : r;
|
|
1467
|
+
}
|
|
1468
|
+
function filterRoutes(e = [], n) {
|
|
1469
|
+
return e.filter((e) => e.type ? !n.includes(e.type) : !1);
|
|
1470
|
+
}
|
|
1471
|
+
function filterEmptyComponentRoutes(e, n = 3) {
|
|
1472
|
+
function r(e) {
|
|
1473
|
+
let n = e.children?.map(r).filter(Boolean);
|
|
1474
|
+
if (n && n.length > 0) return {
|
|
1475
|
+
...e,
|
|
1476
|
+
children: n
|
|
1477
|
+
};
|
|
1478
|
+
if (n?.length === 0 && e.component) {
|
|
1479
|
+
let { children: n, ...r } = e;
|
|
1480
|
+
return {
|
|
1481
|
+
...r,
|
|
1482
|
+
children: []
|
|
1483
|
+
};
|
|
1484
|
+
}
|
|
1485
|
+
return null;
|
|
1486
|
+
}
|
|
1487
|
+
function i(e) {
|
|
1488
|
+
return !e.children || e.children.length === 0 ? 1 : 1 + Math.max(...e.children.map(i));
|
|
1489
|
+
}
|
|
1490
|
+
return e.map(r).filter((e) => !!e).filter((e) => i(e) >= n);
|
|
1491
|
+
}
|
|
1492
|
+
function transformIndex(e, n = {}) {
|
|
1493
|
+
switch (n.type) {
|
|
1494
|
+
case RESOURCE_TYPE.DYNAMIC_APP: return {
|
|
1495
|
+
...e,
|
|
1496
|
+
path: startsWithSlash(e.path),
|
|
1497
|
+
component: setupDefaultLayout()
|
|
1498
|
+
};
|
|
1499
|
+
case RESOURCE_TYPE.INDEX: return {
|
|
1500
|
+
...e,
|
|
1501
|
+
path: e.path,
|
|
1502
|
+
component: void 0
|
|
1503
|
+
};
|
|
1504
|
+
default: return e;
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
function transformMenuAndIframe(e, n = {}) {
|
|
1508
|
+
!e?.component && !e?.meta?.iframe && !e?.meta?.link && console.warn(`[PUBINFO] 资源"${e.meta.title}"的component字段不存在, 将会导致未知错误!`);
|
|
1509
|
+
let i = cloneDeep(e), a = [{
|
|
1510
|
+
path: "",
|
|
1511
|
+
name: e.name,
|
|
1512
|
+
component: replaceComponent(e.component, e.meta?.scope),
|
|
1513
|
+
meta: {
|
|
1514
|
+
...e.meta,
|
|
1515
|
+
title: e.meta.title,
|
|
1516
|
+
sidebar: !1,
|
|
1517
|
+
breadcrumb: !1
|
|
1518
|
+
},
|
|
1519
|
+
children: []
|
|
1520
|
+
}, ...e.children];
|
|
1521
|
+
switch (n.type) {
|
|
1522
|
+
case RESOURCE_TYPE.DYNAMIC_APP:
|
|
1523
|
+
i = {
|
|
1524
|
+
...e,
|
|
1525
|
+
path: startsWithSlash(e.path),
|
|
1526
|
+
name: void 0,
|
|
1527
|
+
component: setupDefaultLayout(),
|
|
1528
|
+
children: a
|
|
1529
|
+
};
|
|
1530
|
+
break;
|
|
1531
|
+
case RESOURCE_TYPE.INDEX:
|
|
1532
|
+
i = {
|
|
1533
|
+
...e,
|
|
1534
|
+
path: e.path,
|
|
1535
|
+
name: void 0,
|
|
1536
|
+
component: void 0,
|
|
1537
|
+
children: a
|
|
1538
|
+
};
|
|
1539
|
+
break;
|
|
1540
|
+
}
|
|
1541
|
+
return i;
|
|
1542
|
+
}
|
|
1543
|
+
function transformNonMenu(e, n = {}) {
|
|
1544
|
+
switch (n.type) {
|
|
1545
|
+
case RESOURCE_TYPE.INDEX:
|
|
1546
|
+
case RESOURCE_TYPE.MENU:
|
|
1547
|
+
case RESOURCE_TYPE.NON_MENU: return {
|
|
1548
|
+
...e,
|
|
1549
|
+
path: e.path,
|
|
1550
|
+
component: replaceComponent(e.component, e.meta?.scope),
|
|
1551
|
+
meta: {
|
|
1552
|
+
...e.meta,
|
|
1553
|
+
sidebar: !1
|
|
1554
|
+
}
|
|
1555
|
+
};
|
|
1556
|
+
default: return e;
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
function startsWithSlash(e) {
|
|
1560
|
+
return e ? e.startsWith("/") ? e : `/${e}` : "/";
|
|
1561
|
+
}
|
|
1562
|
+
function replaceComponent(e, n) {
|
|
1563
|
+
return setupPage(e, n);
|
|
1564
|
+
}
|
|
1565
|
+
function postSysconfigAddOrEditUserThemeStyleConfig(e, n) {
|
|
1566
|
+
return basic.Post("/sysconfig/addOrEditUserThemeStyleConfig", e, {
|
|
1567
|
+
headers: { "Content-Type": "application/json" },
|
|
1568
|
+
...n || {}
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
function getSysconfigGetSysThemeStyleConfig(e) {
|
|
1572
|
+
return basic.Get("/sysconfig/getSysThemeStyleConfig", { ...e || {} });
|
|
1573
|
+
}
|
|
1574
|
+
function getSysconfigGetThemeStyleConfig(e) {
|
|
1575
|
+
return basic.Get("/sysconfig/getThemeStyleConfig", { ...e || {} });
|
|
1576
|
+
}
|
|
1577
|
+
function getSysconfigGetUserThemeStyleConfig(e) {
|
|
1578
|
+
return basic.Get("/sysconfig/getUserThemeStyleConfig", { ...e || {} });
|
|
1579
|
+
}
|
|
1580
|
+
function postSysconfigResetUserThemeStyleConfig(e) {
|
|
1581
|
+
return basic.Post("/sysconfig/resetUserThemeStyleConfig", {}, { ...e || {} });
|
|
1582
|
+
}
|
|
1583
|
+
var globalSettings = {
|
|
1584
|
+
app: {
|
|
1585
|
+
lightTheme: "classic",
|
|
1586
|
+
darkTheme: "dark",
|
|
1587
|
+
colorScheme: "light",
|
|
1588
|
+
defaultLang: "zh-cn",
|
|
1589
|
+
enablePermission: !0,
|
|
1590
|
+
enableProgress: !0,
|
|
1591
|
+
enableDynamicTitle: !0,
|
|
1592
|
+
storagePrefix: "wsy_rbac",
|
|
1593
|
+
enableUserPreferences: !0,
|
|
1594
|
+
enableSettingPreferences: !0,
|
|
1595
|
+
enableAppSetting: !0
|
|
1596
|
+
},
|
|
1597
|
+
home: {
|
|
1598
|
+
enable: !1,
|
|
1599
|
+
title: "主页"
|
|
1600
|
+
},
|
|
1601
|
+
layout: {
|
|
1602
|
+
widthMode: "adaption",
|
|
1603
|
+
enableMobileAdaptation: !1
|
|
1604
|
+
},
|
|
1605
|
+
menu: {
|
|
1606
|
+
menuMode: "head",
|
|
1607
|
+
isRounded: !0,
|
|
1608
|
+
menuActiveStyle: "",
|
|
1609
|
+
switchMainMenuAndPageJump: !0,
|
|
1610
|
+
subMenuUniqueOpened: !0,
|
|
1611
|
+
subMenuOnlyOneHide: !0,
|
|
1612
|
+
subMenuCollapse: !1,
|
|
1613
|
+
enableSubMenuCollapseButton: !0,
|
|
1614
|
+
enableHotkeys: !1,
|
|
1615
|
+
showWithoutPermission: !1
|
|
1616
|
+
},
|
|
1617
|
+
topbar: {
|
|
1618
|
+
mode: "fixed",
|
|
1619
|
+
switchTabbarAndToolbar: !1
|
|
1620
|
+
},
|
|
1621
|
+
tabbar: {
|
|
1622
|
+
enable: !0,
|
|
1623
|
+
style: "fashion",
|
|
1624
|
+
enableIcon: !0,
|
|
1625
|
+
mergeTabsBy: "activeMenu",
|
|
1626
|
+
enableMemory: !0,
|
|
1627
|
+
enableHotkeys: !0,
|
|
1628
|
+
storageTo: "local"
|
|
1629
|
+
},
|
|
1630
|
+
toolbar: {
|
|
1631
|
+
enableNotification: !0,
|
|
1632
|
+
enableFullscreen: !0,
|
|
1633
|
+
enablePageReload: !0,
|
|
1634
|
+
enableColorScheme: !0
|
|
1635
|
+
},
|
|
1636
|
+
favorites: {
|
|
1637
|
+
enable: !0,
|
|
1638
|
+
storageTo: "local"
|
|
1639
|
+
},
|
|
1640
|
+
breadcrumb: {
|
|
1641
|
+
enable: !0,
|
|
1642
|
+
style: "",
|
|
1643
|
+
enableMainMenu: !0
|
|
1644
|
+
},
|
|
1645
|
+
mainPage: {
|
|
1646
|
+
enableHotkeys: !0,
|
|
1647
|
+
iframeCacheMax: 3,
|
|
1648
|
+
enableTransition: !0,
|
|
1649
|
+
transitionMode: "fade"
|
|
1650
|
+
},
|
|
1651
|
+
navSearch: {
|
|
1652
|
+
enable: !0,
|
|
1653
|
+
enableHotkeys: !0
|
|
1654
|
+
},
|
|
1655
|
+
copyright: {
|
|
1656
|
+
enable: !1,
|
|
1657
|
+
dates: "2024-2025",
|
|
1658
|
+
company: "浙江省公众信息产业有限公司",
|
|
1659
|
+
website: "",
|
|
1660
|
+
beian: ""
|
|
1661
|
+
},
|
|
1662
|
+
watermark: {
|
|
1663
|
+
enable: !1,
|
|
1664
|
+
text: "PUBINFO",
|
|
1665
|
+
width: 150,
|
|
1666
|
+
x: 0,
|
|
1667
|
+
y: 0,
|
|
1668
|
+
x_space: 50,
|
|
1669
|
+
y_space: 50,
|
|
1670
|
+
alpha: .1
|
|
1671
|
+
}
|
|
1672
|
+
};
|
|
1673
|
+
function defineSettings(e) {
|
|
1674
|
+
return globalSettings = defaultsDeep(e, globalSettings), e;
|
|
1675
|
+
}
|
|
1676
|
+
function getSettings() {
|
|
1677
|
+
return globalSettings;
|
|
1678
|
+
}
|
|
1679
|
+
function objectToPaths(e, n = "") {
|
|
1680
|
+
return reduce(e, (e, r, i) => {
|
|
1681
|
+
let o = n.length ? `${n}.${i}` : i;
|
|
1682
|
+
return isObject(r) && !isArray(r) && !isEmpty(r) ? e = e.concat(objectToPaths(r, o)) : e.push(o), e;
|
|
1683
|
+
}, []);
|
|
1684
|
+
}
|
|
1685
|
+
var useSettingsStore = defineStore(STORE_NAME.SETTINGS, () => {
|
|
1686
|
+
let e = getSettings(), n = ref(e), r = ref({}), a = ref(e), o = ref(!1);
|
|
1687
|
+
watchDiffObject(a, (e) => {
|
|
1688
|
+
if (!o.value) return;
|
|
1689
|
+
let a = objectToPaths(e);
|
|
1690
|
+
if (objectToPaths(r.value).includes(a.at(0))) {
|
|
1691
|
+
if (storage.session.has("userSettingIsGod")) return;
|
|
1692
|
+
modal_default.confirm({
|
|
1693
|
+
title: "系统设置提示",
|
|
1694
|
+
icon: createVNode(FrownOutlined),
|
|
1695
|
+
content: "当前设置被个人设置覆盖无法预览当前全局系统配置,是否需要恢复个人设置为系统默认设置",
|
|
1696
|
+
okText: "重置个人配置",
|
|
1697
|
+
cancelText: "不在提示",
|
|
1698
|
+
onOk() {
|
|
1699
|
+
P();
|
|
1700
|
+
},
|
|
1701
|
+
onCancel() {
|
|
1702
|
+
storage.session.set("userSettingIsGod", "");
|
|
1703
|
+
}
|
|
1704
|
+
});
|
|
1705
|
+
} else {
|
|
1706
|
+
let r = get(e, a.at(0));
|
|
1707
|
+
set(n.value, a.at(0), r);
|
|
1708
|
+
}
|
|
1709
|
+
}, { flush: "post" }), watch([
|
|
1710
|
+
() => n.value.app.colorScheme,
|
|
1711
|
+
() => n.value.app.lightTheme,
|
|
1712
|
+
() => n.value.app.darkTheme
|
|
1713
|
+
], ([e, n, r]) => {
|
|
1714
|
+
switch (e === "" && (e = usePreferredDark() ? "dark" : "light"), e) {
|
|
1715
|
+
case "light":
|
|
1716
|
+
document.documentElement.classList.remove("dark"), document.body.setAttribute("data-theme", n);
|
|
1717
|
+
break;
|
|
1718
|
+
case "dark":
|
|
1719
|
+
document.documentElement.classList.add("dark"), document.body.setAttribute("data-theme", r);
|
|
1720
|
+
break;
|
|
1721
|
+
}
|
|
1722
|
+
}, { immediate: !0 }), watch(() => n.value.layout.widthMode, (e) => {
|
|
1723
|
+
document.body.setAttribute("data-app-width-mode", e);
|
|
1724
|
+
}, { immediate: !0 }), watch(() => n.value.menu.menuMode, (e) => {
|
|
1725
|
+
document.body.setAttribute("data-menu-mode", e);
|
|
1726
|
+
}, { immediate: !0 });
|
|
1727
|
+
let s = ref("other"), c = navigator.userAgent.toLowerCase();
|
|
1728
|
+
switch (!0) {
|
|
1729
|
+
case c.includes("mac os"):
|
|
1730
|
+
s.value = "mac";
|
|
1731
|
+
break;
|
|
1732
|
+
case c.includes("windows"):
|
|
1733
|
+
s.value = "windows";
|
|
1734
|
+
break;
|
|
1735
|
+
case c.includes("linux"):
|
|
1736
|
+
s.value = "linux";
|
|
1737
|
+
break;
|
|
1738
|
+
}
|
|
1739
|
+
let l = ref();
|
|
1740
|
+
function u(e) {
|
|
1741
|
+
Array.isArray(e) ? (useWarn("在使用数据范围的时候,router auth字段不能为数组"), l.value = e[0] || "") : l.value = e;
|
|
1742
|
+
}
|
|
1743
|
+
let d = ref();
|
|
1744
|
+
function f(e) {
|
|
1745
|
+
d.value = e;
|
|
1746
|
+
}
|
|
1747
|
+
let m = ref([]);
|
|
1748
|
+
function h(e, n) {
|
|
1749
|
+
let r = m.value.findIndex((n) => n.fullPath === e);
|
|
1750
|
+
r > -1 ? m.value[r].title = n : m.value.push({
|
|
1751
|
+
fullPath: e,
|
|
1752
|
+
title: n
|
|
1753
|
+
});
|
|
1754
|
+
}
|
|
1755
|
+
function g(e) {
|
|
1756
|
+
let n = m.value.findIndex((n) => n.fullPath === e);
|
|
1757
|
+
n > -1 && m.value.splice(n, 1);
|
|
1758
|
+
}
|
|
1759
|
+
let _ = ref("pc");
|
|
1760
|
+
function v(e) {
|
|
1761
|
+
n.value.layout.enableMobileAdaptation ? /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ? _.value = "mobile" : _.value = e < 992 ? "mobile" : "pc" : _.value = "pc";
|
|
1762
|
+
}
|
|
1763
|
+
let y = ref(e.menu.subMenuCollapse);
|
|
1764
|
+
function b() {
|
|
1765
|
+
n.value.menu.subMenuCollapse = !n.value.menu.subMenuCollapse, _.value === "pc" && (y.value = !y.value);
|
|
1766
|
+
}
|
|
1767
|
+
watch(_, (e) => {
|
|
1768
|
+
switch (e) {
|
|
1769
|
+
case "pc":
|
|
1770
|
+
n.value.menu.subMenuCollapse = y.value;
|
|
1771
|
+
break;
|
|
1772
|
+
case "mobile":
|
|
1773
|
+
n.value.menu.subMenuCollapse = !0;
|
|
1774
|
+
break;
|
|
1775
|
+
}
|
|
1776
|
+
document.body.setAttribute("data-mode", e);
|
|
1777
|
+
}, { immediate: !0 });
|
|
1778
|
+
function x(e) {
|
|
1779
|
+
n.value.app.defaultLang = e;
|
|
1780
|
+
}
|
|
1781
|
+
function S(e) {
|
|
1782
|
+
n.value.app.colorScheme = e;
|
|
1783
|
+
}
|
|
1784
|
+
let [C, w] = useToggle(!1);
|
|
1785
|
+
function T(r, i = !1) {
|
|
1786
|
+
n.value = defaultsDeep(r, i ? e : n.value);
|
|
1787
|
+
}
|
|
1788
|
+
function E(n) {
|
|
1789
|
+
a.value = defaultsDeep(n, e);
|
|
1790
|
+
}
|
|
1791
|
+
function D(e) {
|
|
1792
|
+
Object.keys(e).length > 0 ? r.value = defaultsDeep(e, cloneDeep(r.value)) : r.value = {};
|
|
1793
|
+
}
|
|
1794
|
+
function O(e = !0) {
|
|
1795
|
+
o.value = e;
|
|
1796
|
+
}
|
|
1797
|
+
async function k() {
|
|
1798
|
+
let e = (await getSysconfigGetThemeStyleConfig())?.data?.content;
|
|
1799
|
+
e && T(JSON.parse(e || "{}"), !0);
|
|
1800
|
+
}
|
|
1801
|
+
async function A() {
|
|
1802
|
+
let e = (await getSysconfigGetUserThemeStyleConfig())?.data?.content;
|
|
1803
|
+
e && D(JSON.parse(e || "{}"));
|
|
1804
|
+
}
|
|
1805
|
+
async function j() {
|
|
1806
|
+
let e = (await getSysconfigGetSysThemeStyleConfig())?.data?.content;
|
|
1807
|
+
e && E(JSON.parse(e || "{}"));
|
|
1808
|
+
}
|
|
1809
|
+
async function M() {
|
|
1810
|
+
await Promise.all([
|
|
1811
|
+
k(),
|
|
1812
|
+
j(),
|
|
1813
|
+
A()
|
|
1814
|
+
]), O(!0);
|
|
1815
|
+
}
|
|
1816
|
+
async function N(e) {
|
|
1817
|
+
await postSysconfigAddOrEditUserThemeStyleConfig({ content: JSON.stringify(e) }), D(e);
|
|
1818
|
+
}
|
|
1819
|
+
async function P() {
|
|
1820
|
+
await postSysconfigResetUserThemeStyleConfig(), await k(), await A(), Message.success("已还原系统设置");
|
|
1821
|
+
}
|
|
1822
|
+
return {
|
|
1823
|
+
settings: n,
|
|
1824
|
+
os: s,
|
|
1825
|
+
auth: l,
|
|
1826
|
+
setAuth: u,
|
|
1827
|
+
title: d,
|
|
1828
|
+
setTitle: f,
|
|
1829
|
+
customTitleList: m,
|
|
1830
|
+
setCustomTitle: h,
|
|
1831
|
+
resetCustomTitle: g,
|
|
1832
|
+
mode: _,
|
|
1833
|
+
setMode: v,
|
|
1834
|
+
subMenuCollapseLastStatus: y,
|
|
1835
|
+
toggleSidebarCollapse: b,
|
|
1836
|
+
setDefaultLang: x,
|
|
1837
|
+
setColorScheme: S,
|
|
1838
|
+
mainPageMaximizeStatus: C,
|
|
1839
|
+
setMainPageMaximize: w,
|
|
1840
|
+
updateSettings: T,
|
|
1841
|
+
globalSettings: a,
|
|
1842
|
+
updateGlobalSettings: E,
|
|
1843
|
+
userSettings: r,
|
|
1844
|
+
updateUserSettings: D,
|
|
1845
|
+
setGlobaleSettingsFlag: O,
|
|
1846
|
+
getPreferencesAll: M,
|
|
1847
|
+
setPreferencesSetting: N,
|
|
1848
|
+
resetSettings: P
|
|
1849
|
+
};
|
|
1850
|
+
}), useTabbarStore = defineStore(STORE_NAME.TABBAR, () => {
|
|
1851
|
+
let e = useSettingsStore(), n = useRouteStore(), r = useKeepAliveStore(), i = useIframeStore(), a = ref([]), o = ref(-1);
|
|
1852
|
+
function s() {
|
|
1853
|
+
let r = [];
|
|
1854
|
+
function i(n) {
|
|
1855
|
+
n.children && n.children.forEach((n) => {
|
|
1856
|
+
if (n.meta?.permanent && n.meta?.breadcrumbNeste && n.meta?.tabbar !== !1) {
|
|
1857
|
+
let i = n.meta.breadcrumbNeste.at(-1)?.path, a = e.settings.tabbar.mergeTabsBy === "activeMenu" && n.meta.activeMenu || i;
|
|
1858
|
+
r.push({
|
|
1859
|
+
tabId: a,
|
|
1860
|
+
fullPath: i,
|
|
1861
|
+
routeName: n.name,
|
|
1862
|
+
activeMenu: n.meta.activeMenu,
|
|
1863
|
+
title: typeof n.meta.title == "function" ? n.meta.title() : n.meta.title,
|
|
1864
|
+
iframe: n.meta.iframe,
|
|
1865
|
+
icon: n.meta?.icon ?? n.meta?.breadcrumbNeste?.findLast((e) => e.icon)?.icon,
|
|
1866
|
+
activeIcon: n.meta?.activeIcon ?? n.meta?.breadcrumbNeste?.findLast((e) => e.activeIcon)?.activeIcon,
|
|
1867
|
+
name: n.name ? [n.name] : [],
|
|
1868
|
+
customTitleList: [],
|
|
1869
|
+
isPin: n.meta?.pin === void 0 ? !1 : n.meta?.pin,
|
|
1870
|
+
isTabbar: n.meta?.tabbar !== !1,
|
|
1871
|
+
isPermanent: !0
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1876
|
+
n.flatSystemRoutes.forEach(i), n.flatRoutes.forEach(i), r.length && a.value.unshift(...r);
|
|
1877
|
+
}
|
|
1878
|
+
async function c(n) {
|
|
1879
|
+
let r = [];
|
|
1880
|
+
n.matched.forEach((e, n) => {
|
|
1881
|
+
n > 0 && e.components?.default.name && r.push(e.components.default.name);
|
|
1882
|
+
});
|
|
1883
|
+
let i = n.matched.at(-1)?.meta, s = e.settings.tabbar.mergeTabsBy === "activeMenu" ? i?.activeMenu ?? n.fullPath : n.fullPath;
|
|
1884
|
+
if (n.name !== "Reload" && i?.tabbar !== !1) {
|
|
1885
|
+
let c = a.value.find((r) => e.settings.tabbar.mergeTabsBy === "routeName" && r.routeName ? r.routeName === n.name : r.tabId === s);
|
|
1886
|
+
if (c) e.settings.tabbar.mergeTabsBy !== "" && (c.tabId = s, c.fullPath = n.fullPath, c.routeName = n.name, c.activeMenu = i?.activeMenu, c.title = typeof i?.title == "function" ? i.title() : i?.title, c.iframe = i?.iframe, c.icon = i?.icon ?? i?.breadcrumbNeste?.findLast((e) => e.icon)?.icon, c.activeIcon = i?.activeIcon ?? i?.breadcrumbNeste?.findLast((e) => e.activeIcon)?.activeIcon, c.isTabbar = i?.tabbar !== !1);
|
|
1887
|
+
else {
|
|
1888
|
+
let e = {
|
|
1889
|
+
tabId: s,
|
|
1890
|
+
fullPath: n.fullPath,
|
|
1891
|
+
routeName: n.name,
|
|
1892
|
+
activeMenu: i?.activeMenu,
|
|
1893
|
+
title: typeof i?.title == "function" ? i.title() : i?.title,
|
|
1894
|
+
iframe: i?.iframe,
|
|
1895
|
+
icon: i?.icon ?? i?.breadcrumbNeste?.findLast((e) => e.icon)?.icon,
|
|
1896
|
+
activeIcon: i?.activeIcon ?? i?.breadcrumbNeste?.findLast((e) => e.activeIcon)?.activeIcon,
|
|
1897
|
+
name: r,
|
|
1898
|
+
customTitleList: [],
|
|
1899
|
+
isPin: i?.pin === void 0 ? !1 : i?.pin,
|
|
1900
|
+
isTabbar: i?.tabbar !== !1,
|
|
1901
|
+
isPermanent: !1
|
|
1902
|
+
};
|
|
1903
|
+
o.value >= 0 ? (a.value.splice(o.value + 1, 0, e), o.value = -1) : a.value.push(e);
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
}
|
|
1907
|
+
function l(e) {
|
|
1908
|
+
let n = [], o = [], s = [];
|
|
1909
|
+
a.value.forEach((r, i) => {
|
|
1910
|
+
e(r, i) ? r.iframe ? s.push(r.tabId) : o.push(...r.name) : n.push(...r.name);
|
|
1911
|
+
}), r.remove(o.filter((e) => !n.includes(e))), i.close(s);
|
|
1912
|
+
}
|
|
1913
|
+
function u(e) {
|
|
1914
|
+
l((n) => n.tabId === e), a.value = a.value.filter((n) => n.tabId !== e);
|
|
1915
|
+
}
|
|
1916
|
+
function d(e) {
|
|
1917
|
+
l((n) => n.tabId !== e && !n.isPermanent && !n.isPin), a.value = a.value.filter((n) => n.tabId === e || n.isPermanent || n.isPin);
|
|
1918
|
+
}
|
|
1919
|
+
function f(e) {
|
|
1920
|
+
let n = a.value.findIndex((n) => n.tabId === e);
|
|
1921
|
+
l((e, r) => r < n && !e.isPermanent && !e.isPin), a.value = a.value.filter((e, r) => r >= n || e.isPermanent || e.isPin);
|
|
1922
|
+
}
|
|
1923
|
+
function p(e) {
|
|
1924
|
+
let n = a.value.findIndex((n) => n.tabId === e);
|
|
1925
|
+
l((e, r) => r > n && !e.isPermanent && !e.isPin), a.value = a.value.filter((e, r) => r <= n || e.isPermanent || e.isPin);
|
|
1926
|
+
}
|
|
1927
|
+
function m(e) {
|
|
1928
|
+
let n = a.value.findIndex((n) => n.tabId === e), r = -1;
|
|
1929
|
+
a.value.forEach((e, n) => {
|
|
1930
|
+
(e.isPermanent || e.isPin) && (r = n);
|
|
1931
|
+
}), n > r && (a.value.splice(r + 1, 0, a.value[n]), a.value.splice(n + 1, 1)), a.value.forEach((n) => {
|
|
1932
|
+
n.tabId === e && (n.isPin = !0);
|
|
1933
|
+
});
|
|
1934
|
+
}
|
|
1935
|
+
function h(e) {
|
|
1936
|
+
let n = a.value.findIndex((n) => n.tabId === e), r = -1;
|
|
1937
|
+
a.value.forEach((e, n) => {
|
|
1938
|
+
(e.isPermanent || e.isPin) && (r = n);
|
|
1939
|
+
}), a.value.splice(r + 1, 0, a.value[n]), a.value.splice(n, 1), a.value.forEach((n) => {
|
|
1940
|
+
n.tabId === e && (n.isPin = !1);
|
|
1941
|
+
});
|
|
1942
|
+
}
|
|
1943
|
+
function g() {
|
|
1944
|
+
a.value = [];
|
|
1945
|
+
}
|
|
1946
|
+
function _(e, n) {
|
|
1947
|
+
a.value.splice(e, 0, a.value.splice(n, 1)[0]);
|
|
1948
|
+
}
|
|
1949
|
+
function v({ tabId: e, title: n }) {
|
|
1950
|
+
a.value.forEach((r) => {
|
|
1951
|
+
if (r.tabId === e) {
|
|
1952
|
+
let e = r.customTitleList.find((e) => e.fullPath === r.fullPath);
|
|
1953
|
+
e ? e.title = n : r.customTitleList.push({
|
|
1954
|
+
fullPath: r.fullPath,
|
|
1955
|
+
title: n
|
|
1956
|
+
});
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
}
|
|
1960
|
+
function y(e) {
|
|
1961
|
+
a.value.forEach((n) => {
|
|
1962
|
+
if (n.tabId === e) {
|
|
1963
|
+
let e = n.customTitleList.findIndex((e) => e.fullPath === n.fullPath);
|
|
1964
|
+
e > -1 && n.customTitleList.splice(e, 1);
|
|
1965
|
+
}
|
|
1966
|
+
});
|
|
1967
|
+
}
|
|
1968
|
+
return {
|
|
1969
|
+
list: a,
|
|
1970
|
+
leaveIndex: o,
|
|
1971
|
+
initPermanentTab: s,
|
|
1972
|
+
add: c,
|
|
1973
|
+
remove: u,
|
|
1974
|
+
removeOtherSide: d,
|
|
1975
|
+
removeLeftSide: f,
|
|
1976
|
+
removeRightSide: p,
|
|
1977
|
+
pin: m,
|
|
1978
|
+
unPin: h,
|
|
1979
|
+
clean: g,
|
|
1980
|
+
sort: _,
|
|
1981
|
+
setCustomTitle: v,
|
|
1982
|
+
resetCustomTitle: y
|
|
1983
|
+
};
|
|
1984
|
+
}), useUserStore = defineStore(STORE_NAME.USER, () => {
|
|
1985
|
+
let { router: e } = usePubinfoContext(), n = reactive({
|
|
1986
|
+
account: "",
|
|
1987
|
+
userId: "",
|
|
1988
|
+
token: "",
|
|
1989
|
+
avatar: "",
|
|
1990
|
+
refreshToken: "",
|
|
1991
|
+
orgList: [],
|
|
1992
|
+
orgId: "",
|
|
1993
|
+
permissions: [],
|
|
1994
|
+
department: ""
|
|
1995
|
+
}), r = computed(() => !!n.token), i = computed(() => {
|
|
1996
|
+
let e;
|
|
1997
|
+
return e = n.orgId ? find(n.orgList, ["orgId", n.orgId])?.orgName : find(n.orgList, ["main", !0])?.orgName, e || "";
|
|
1998
|
+
});
|
|
1999
|
+
async function a(e) {
|
|
2000
|
+
let { account: n, password: r, captchaHash: i, captchas: a, loginType: o = "password" } = e, s = await postAuthLogin({
|
|
2001
|
+
loginType: o,
|
|
2002
|
+
loginName: n,
|
|
2003
|
+
loginPwd: await publicKeyEncryption(r),
|
|
2004
|
+
codeHash: i,
|
|
2005
|
+
code: a
|
|
2006
|
+
}), { accessToken: c, refreshToken: l } = s.data;
|
|
2007
|
+
return d(c, l), s;
|
|
2008
|
+
}
|
|
2009
|
+
async function o(e) {
|
|
2010
|
+
let { account: n, password: r, captchaHash: i, captchas: a, loginType: o = "password", captchaType: s } = e, c = await postAuthLoginNew({
|
|
2011
|
+
loginType: o,
|
|
2012
|
+
loginName: n,
|
|
2013
|
+
loginPwd: await publicKeyEncryption(r),
|
|
2014
|
+
codeHash: i,
|
|
2015
|
+
code: a,
|
|
2016
|
+
captchaType: s
|
|
2017
|
+
}), { accessToken: l, refreshToken: u } = c.data;
|
|
2018
|
+
return d(l, u), c;
|
|
2019
|
+
}
|
|
2020
|
+
function s() {
|
|
2021
|
+
e?.push({ name: "Login" });
|
|
2022
|
+
}
|
|
2023
|
+
function c() {
|
|
2024
|
+
n.account = "", n.userId = "", n.token = "", n.refreshToken = "", n.avatar = "", n.permissions = [], n.orgId = "", n.orgList = [];
|
|
2025
|
+
}
|
|
2026
|
+
async function l() {
|
|
2027
|
+
let e = await getRbacUserUserEntireInfo(), r = e.data;
|
|
2028
|
+
return n.account = r.realName || r.loginName, n.avatar = r.userPic, n.userId = r.id, n.orgList = r.userOrgList, r.userOrgList?.length && !n.orgId && (n.orgId = find(r.userOrgList, ["main", !0]).orgId), e;
|
|
2029
|
+
}
|
|
2030
|
+
async function u(e) {
|
|
2031
|
+
let n = {};
|
|
2032
|
+
return e.token && (n.authorization = e.token), await putRbacUserChangePassword({
|
|
2033
|
+
oldPassword: await publicKeyEncryption(e.oldPassword),
|
|
2034
|
+
newPassword: await publicKeyEncryption(e.newPassword)
|
|
2035
|
+
}, { headers: n });
|
|
2036
|
+
}
|
|
2037
|
+
function d(e, r) {
|
|
2038
|
+
n.token = e, n.refreshToken = r;
|
|
2039
|
+
}
|
|
2040
|
+
async function f() {
|
|
2041
|
+
return n.permissions = (await getRbacResourceGrantedResources()).data, n.permissions;
|
|
2042
|
+
}
|
|
2043
|
+
async function p(r) {
|
|
2044
|
+
let { accessToken: i, refreshToken: a } = (await postAuthChangeLoginOrg({ orgId: r })).data;
|
|
2045
|
+
d(i, a), n.orgId = r, e?.push({ path: "/" });
|
|
2046
|
+
}
|
|
2047
|
+
return {
|
|
2048
|
+
user: n,
|
|
2049
|
+
userOrgName: i,
|
|
2050
|
+
isLogin: r,
|
|
2051
|
+
getUserInfo: l,
|
|
2052
|
+
getPermissions: f,
|
|
2053
|
+
login: a,
|
|
2054
|
+
signIn: o,
|
|
2055
|
+
logout: s,
|
|
2056
|
+
changePassword: u,
|
|
2057
|
+
changeOrg: p,
|
|
2058
|
+
setToken: d,
|
|
2059
|
+
clean: c
|
|
2060
|
+
};
|
|
2061
|
+
}, { persist: !0 }), useRouteStore = defineStore(STORE_NAME.ROUTE, () => {
|
|
2062
|
+
let e = getAsyncRoutes(), n = useSettingsStore(), i = useUserStore(), a = useTabbarStore(), s = ref(!1), c = ref([]), l = ref([]), u = ref([]), d = ref([]), f = computed(() => {
|
|
2063
|
+
let { app: e, menu: r } = n.settings;
|
|
2064
|
+
return e.enablePermission && !r.showWithoutPermission;
|
|
2065
|
+
});
|
|
2066
|
+
function p(e, n) {
|
|
2067
|
+
let { title: r, icon: i, activeIcon: a, breadcrumb: o = !0 } = defaultTo(e.meta, {});
|
|
2068
|
+
return {
|
|
2069
|
+
path: defaultTo(n, e.path),
|
|
2070
|
+
title: r,
|
|
2071
|
+
icon: i,
|
|
2072
|
+
activeIcon: a,
|
|
2073
|
+
hide: !o
|
|
2074
|
+
};
|
|
2075
|
+
}
|
|
2076
|
+
function m(e, n, r, i) {
|
|
2077
|
+
let a = cloneDeep(i), o = p(e, n);
|
|
2078
|
+
a.push(o);
|
|
2079
|
+
function s(e) {
|
|
2080
|
+
return has(e, "children") ? omit(e, "children") : e;
|
|
2081
|
+
}
|
|
2082
|
+
let c = {
|
|
2083
|
+
path: n,
|
|
2084
|
+
meta: {
|
|
2085
|
+
auth: r,
|
|
2086
|
+
breadcrumbNeste: a
|
|
2087
|
+
}
|
|
2088
|
+
};
|
|
2089
|
+
return merge(s(cloneDeep(toRaw(e))), c);
|
|
2090
|
+
}
|
|
2091
|
+
function g(e) {
|
|
2092
|
+
return e.children &&= _(e.children, [p(e)], e.path, e.meta?.auth), e;
|
|
2093
|
+
}
|
|
2094
|
+
function _(e, n = [], r = "", i) {
|
|
2095
|
+
return toRaw(e).reduce((e, a) => {
|
|
2096
|
+
let o = resolveRoutePath(r, a.path), s = defaultTo(a.meta?.auth, i), c = m(a, o, s, n);
|
|
2097
|
+
return e.push(c), a.children && _(a.children, c?.meta?.breadcrumbNeste, o, s).forEach((n) => {
|
|
2098
|
+
e.some((e) => e.path === n.path) ? e.forEach((r, i) => {
|
|
2099
|
+
r.path === n.path && (e[i] = n);
|
|
2100
|
+
}) : e.push(n);
|
|
2101
|
+
}), e;
|
|
2102
|
+
}, []);
|
|
2103
|
+
}
|
|
2104
|
+
let v = computed(() => {
|
|
2105
|
+
let e = [];
|
|
2106
|
+
return c.value.length && (c.value.forEach((n) => {
|
|
2107
|
+
if (get(n, "meta.isDev", !1)) {
|
|
2108
|
+
useWarn(`开发模式应用"${n.meta?.title}"的子路由将不会被注册到vue-router中`);
|
|
2109
|
+
return;
|
|
2110
|
+
}
|
|
2111
|
+
if (n.children?.length) {
|
|
2112
|
+
let r = cloneDeep(n.children);
|
|
2113
|
+
r = r.map((e) => merge(e, { meta: { auth: defaultTo(e.meta?.auth, n.meta?.auth) } })), e.push(...r);
|
|
2114
|
+
}
|
|
2115
|
+
}), e.forEach((e) => g(e))), e;
|
|
2116
|
+
}), y = computed(() => {
|
|
2117
|
+
let e = [...getSystemRoutes()];
|
|
2118
|
+
return e.forEach((e) => g(e)), e;
|
|
2119
|
+
});
|
|
2120
|
+
function b(e, n) {
|
|
2121
|
+
if (isUndefined(n.meta?.auth)) return !0;
|
|
2122
|
+
let r = n.meta.auth;
|
|
2123
|
+
return toRaw(e).some((e) => isString(r) ? r === "" ? !0 : r === e : isArray(r) ? r.length === 0 ? !0 : r.includes(e) : (useWarn("路由权限类型配置错误, 请检查路由 meta.auth"), !1));
|
|
2124
|
+
}
|
|
2125
|
+
function x(e, n) {
|
|
2126
|
+
let r = [];
|
|
2127
|
+
return e.forEach((e) => {
|
|
2128
|
+
if (b(n, e)) {
|
|
2129
|
+
let i = cloneDeep(e);
|
|
2130
|
+
i.children && i.children.length > 0 ? (i.children = x(i.children, n), (i.children.length || get(i, "meta.isDev", !1)) && r.push(i)) : (get(i, "meta.isDev", !1) && (i.children = []), r.push(i));
|
|
2131
|
+
}
|
|
2132
|
+
}), r;
|
|
2133
|
+
}
|
|
2134
|
+
let S = computed(() => f.value ? x(c.value, i?.user?.permissions ?? []) : cloneDeep(c.value));
|
|
2135
|
+
function C(e) {
|
|
2136
|
+
return e.map((e) => {
|
|
2137
|
+
let n = setupDefaultLayout(e?.meta?.layoutComponent);
|
|
2138
|
+
return e.children && e.children.length > 0 && e.children.forEach((r, i, a) => {
|
|
2139
|
+
if (r.meta?.singleMenu) {
|
|
2140
|
+
let { name: e, ...o } = r;
|
|
2141
|
+
a[i] = {
|
|
2142
|
+
...o,
|
|
2143
|
+
component: n,
|
|
2144
|
+
children: [{
|
|
2145
|
+
path: "",
|
|
2146
|
+
name: e,
|
|
2147
|
+
component: r.component,
|
|
2148
|
+
meta: {
|
|
2149
|
+
title: r.meta.title,
|
|
2150
|
+
sidebar: !1,
|
|
2151
|
+
breadcrumb: !1
|
|
2152
|
+
}
|
|
2153
|
+
}]
|
|
2154
|
+
}, delete a[i].meta.singleMenu;
|
|
2155
|
+
}
|
|
2156
|
+
r.component ||= n, e.meta?.provider && (r.meta = {
|
|
2157
|
+
...r.meta,
|
|
2158
|
+
provider: e.meta.provider
|
|
2159
|
+
});
|
|
2160
|
+
}), e;
|
|
2161
|
+
}), e;
|
|
2162
|
+
}
|
|
2163
|
+
function w(e) {
|
|
2164
|
+
return e.length ? e.filter((e) => (e.children && e.children.length > 0 && (e.children = w(e.children)), e?.meta?.enabled !== !1)) : [];
|
|
2165
|
+
}
|
|
2166
|
+
async function T() {
|
|
2167
|
+
n.settings.app.enablePermission && await i.getPermissions();
|
|
2168
|
+
let r = await postRbacResourceMineOrAllResourceTree({ needAll: !f.value });
|
|
2169
|
+
if (r.success) {
|
|
2170
|
+
l.value = r?.data ?? [];
|
|
2171
|
+
let n = C(w(cloneDeep(e))), i = r.data?.map((e) => {
|
|
2172
|
+
if (e.type === RESOURCE_TYPE.APP) {
|
|
2173
|
+
let r = n.find((n) => n.meta?.auth === e.code);
|
|
2174
|
+
return r && get(r, "meta.isDev", !1) && useWarn(`静态应用"${r.meta?.title}"处于开发模式,将在TopMode中显示开发状态`), r;
|
|
2175
|
+
}
|
|
2176
|
+
return e.type === RESOURCE_TYPE.DYNAMIC_APP ? (e.meta?.isDev && useWarn(`动态应用"${e.name}"处于开发模式,将在TopMode中显示开发状态`), formatBackRoutes([e])[0]) : !1;
|
|
2177
|
+
}).filter((e) => !!e) ?? [], a = n.filter((e) => {
|
|
2178
|
+
let { auth: n } = e.meta ?? {};
|
|
2179
|
+
return isString(n) ? !r.data?.map((e) => e.code).includes(n) : !0;
|
|
2180
|
+
});
|
|
2181
|
+
c.value = await callHookAsync("route:transform", E([...i, ...a], r.data ?? []));
|
|
2182
|
+
}
|
|
2183
|
+
s.value = !0, n.settings.tabbar.enable && a.initPermanentTab();
|
|
2184
|
+
}
|
|
2185
|
+
function E(e, n) {
|
|
2186
|
+
let r = new Map(n.map((e, n) => [e.code, n])), i = e.filter((e) => r.has(e.meta?.auth)), a = e.filter((e) => !r.has(e.meta?.auth));
|
|
2187
|
+
return i.sort((e, n) => (r.get(e.meta.auth) ?? Infinity) - (r.get(n.meta.auth) ?? Infinity)), [...i, ...a];
|
|
2188
|
+
}
|
|
2189
|
+
function D(e) {
|
|
2190
|
+
d.value = e;
|
|
2191
|
+
}
|
|
2192
|
+
function O(e = !1) {
|
|
2193
|
+
s.value = !1, c.value = [], u.value = [], e ? d.value = d.value.filter((e) => e.system) : (d.value.forEach((e) => e()), d.value = []);
|
|
2194
|
+
}
|
|
2195
|
+
function k(e) {
|
|
2196
|
+
let n = e ?? (typeof useRoute == "function" ? useRoute() : void 0);
|
|
2197
|
+
if (!n) {
|
|
2198
|
+
useWarn("getRemoteRouteById: 无法获取路由对象");
|
|
2199
|
+
return;
|
|
2200
|
+
}
|
|
2201
|
+
let r = n.meta?.id;
|
|
2202
|
+
if (!r) {
|
|
2203
|
+
useWarn("getRemoteRouteById: 路由 meta 中未找到 id");
|
|
2204
|
+
return;
|
|
2205
|
+
}
|
|
2206
|
+
function i(e) {
|
|
2207
|
+
for (let n of e) {
|
|
2208
|
+
if (n.id === r) return n;
|
|
2209
|
+
if (n.children && n.children.length > 0) {
|
|
2210
|
+
let e = i(n.children);
|
|
2211
|
+
if (e) return e;
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
return i(l.value);
|
|
2216
|
+
}
|
|
2217
|
+
function A(e) {
|
|
2218
|
+
let n = e ?? (typeof useRoute == "function" ? useRoute() : void 0);
|
|
2219
|
+
if (!n) {
|
|
2220
|
+
useWarn("getRemoteAppRouteById: 无法获取路由对象");
|
|
2221
|
+
return;
|
|
2222
|
+
}
|
|
2223
|
+
let r = n.meta?.id;
|
|
2224
|
+
if (!r) {
|
|
2225
|
+
useWarn("getRemoteAppRouteById: 路由 meta 中未找到 id");
|
|
2226
|
+
return;
|
|
2227
|
+
}
|
|
2228
|
+
function i(e, n) {
|
|
2229
|
+
for (let a of e) {
|
|
2230
|
+
let e = a.type === RESOURCE_TYPE.APP || a.type === RESOURCE_TYPE.DYNAMIC_APP ? a : n;
|
|
2231
|
+
if (a.id === r) return e;
|
|
2232
|
+
if (a.children && a.children.length > 0) {
|
|
2233
|
+
let n = i(a.children, e);
|
|
2234
|
+
if (n) return n;
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
}
|
|
2238
|
+
return i(l.value);
|
|
2239
|
+
}
|
|
2240
|
+
return {
|
|
2241
|
+
isGenerate: s,
|
|
2242
|
+
routes: S,
|
|
2243
|
+
currentRemoveRoutes: d,
|
|
2244
|
+
flatRoutes: v,
|
|
2245
|
+
flatSystemRoutes: y,
|
|
2246
|
+
remoteRoutesRaw: l,
|
|
2247
|
+
generateRoutes: T,
|
|
2248
|
+
setCurrentRemoveRoutes: D,
|
|
2249
|
+
removeRoutes: O,
|
|
2250
|
+
getRemoteRouteById: k,
|
|
2251
|
+
getRemoteAppRouteById: A
|
|
2252
|
+
};
|
|
2253
|
+
}), import_dist = require_dist(), useMenuStore = defineStore(STORE_NAME.MENU, () => {
|
|
2254
|
+
let e = useSettingsStore(), n = useRouteStore(), r = ref([{
|
|
2255
|
+
meta: {},
|
|
2256
|
+
children: []
|
|
2257
|
+
}]), i = ref(0);
|
|
2258
|
+
function a(e = [], n = "") {
|
|
2259
|
+
return e.map((e) => (e.path = resolveRoutePath(n, e.path), e.children &&= a(e.children, e.path), e));
|
|
2260
|
+
}
|
|
2261
|
+
let s = computedAsync(async () => {
|
|
2262
|
+
let r = [{
|
|
2263
|
+
meta: {},
|
|
2264
|
+
children: []
|
|
2265
|
+
}];
|
|
2266
|
+
return e.settings.menu.menuMode === "single" ? (r[0].children = [], n.routes.forEach((e) => {
|
|
2267
|
+
get(e, "meta.isDev", !1) ? useWarn(`侧边栏模式(不含主导航)下省略${e.meta.title}的子集菜单,因为该菜单开启了isDev属性。`) : r[0].children?.push(...e.children);
|
|
2268
|
+
})) : r = n.routes, r.forEach((e) => a(e.children)), await callHookAsync("menu:transform", r);
|
|
2269
|
+
}, []), c = computed(() => {
|
|
2270
|
+
if (s.value.filter((e) => !get(e, "meta.isDev", !1)).length === 0) return [];
|
|
2271
|
+
for (;;) {
|
|
2272
|
+
let e = s.value[i.value];
|
|
2273
|
+
if (i.value >= s.value.length - 1 || e.children.length > 0 && !get(e, "meta.isDev", !1)) break;
|
|
2274
|
+
i.value++;
|
|
2275
|
+
}
|
|
2276
|
+
return s.value[i.value].children ?? [];
|
|
2277
|
+
}), l = computed(() => c.value.length > 0 ? u(c.value[0]) : "/");
|
|
2278
|
+
function u(e, n = "") {
|
|
2279
|
+
let r = "";
|
|
2280
|
+
if (e.children && e.children.length > 0) {
|
|
2281
|
+
let i = e.children.find((e) => e.meta?.sidebar !== !1);
|
|
2282
|
+
i ? r = u(i, resolveRoutePath(n, e.path)) : e.children.some((e) => e.meta?.sidebar !== !1 || e.children && e.children.length > 0) ? r = u(e.children[0], resolveRoutePath(n, e.path)) : (useWarn(`目录"${e.meta?.title || e.path}"下没有可显示的菜单项`), r = resolveRoutePath(n, e.path));
|
|
2283
|
+
} else r = resolveRoutePath(n, e.path);
|
|
2284
|
+
return r;
|
|
2285
|
+
}
|
|
2286
|
+
let d = computed(() => {
|
|
2287
|
+
let e = [];
|
|
2288
|
+
return s.value.forEach((n) => {
|
|
2289
|
+
e.push(...f(n.children));
|
|
2290
|
+
}), e;
|
|
2291
|
+
});
|
|
2292
|
+
function f(e = [], n = "") {
|
|
2293
|
+
let r = [];
|
|
2294
|
+
return e.forEach((e) => {
|
|
2295
|
+
if (e.meta?.defaultOpened && e.children) {
|
|
2296
|
+
r.push(resolveRoutePath(n, e.path));
|
|
2297
|
+
let i = f(e.children, resolveRoutePath(n, e.path));
|
|
2298
|
+
i.length > 0 && r.push(...i);
|
|
2299
|
+
}
|
|
2300
|
+
}), r;
|
|
2301
|
+
}
|
|
2302
|
+
function p(e) {
|
|
2303
|
+
if (isNumber(e)) i.value = e;
|
|
2304
|
+
else {
|
|
2305
|
+
let n = m(s.value, e);
|
|
2306
|
+
n >= 0 && (i.value = n);
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
function m(e, n) {
|
|
2310
|
+
function r(e) {
|
|
2311
|
+
return (0, import_dist.match)(e.path ?? "", { decode: decodeURIComponent })(n) ? !0 : e.children ? e.children.some((e) => r(e)) : !1;
|
|
2312
|
+
}
|
|
2313
|
+
for (let n = 0; n < e.length; n++) if (r(e[n])) return n;
|
|
2314
|
+
return 0;
|
|
2315
|
+
}
|
|
2316
|
+
return {
|
|
2317
|
+
menus: r,
|
|
2318
|
+
actived: i,
|
|
2319
|
+
allMenus: s,
|
|
2320
|
+
sidebarMenus: c,
|
|
2321
|
+
sidebarMenusFirstDeepestPath: l,
|
|
2322
|
+
defaultOpenedPaths: d,
|
|
2323
|
+
setActived: p
|
|
2324
|
+
};
|
|
2325
|
+
});
|
|
2326
|
+
function cleanup() {
|
|
2327
|
+
useUserStore().clean(), cleanupWithoutUser();
|
|
2328
|
+
}
|
|
2329
|
+
function cleanupWithoutUser() {
|
|
2330
|
+
useTabbarStore().clean(), useIframeStore().clean(), useRouteStore().removeRoutes(), useMenuStore().setActived(0);
|
|
2331
|
+
}
|
|
2332
|
+
var import_path_browserify = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((e, n) => {
|
|
2333
|
+
function r(e) {
|
|
2334
|
+
if (typeof e != "string") throw TypeError("Path must be a string. Received " + JSON.stringify(e));
|
|
2335
|
+
}
|
|
2336
|
+
function i(e, n) {
|
|
2337
|
+
for (var r = "", i = 0, a = -1, o = 0, s, c = 0; c <= e.length; ++c) {
|
|
2338
|
+
if (c < e.length) s = e.charCodeAt(c);
|
|
2339
|
+
else if (s === 47) break;
|
|
2340
|
+
else s = 47;
|
|
2341
|
+
if (s === 47) {
|
|
2342
|
+
if (!(a === c - 1 || o === 1)) if (a !== c - 1 && o === 2) {
|
|
2343
|
+
if (r.length < 2 || i !== 2 || r.charCodeAt(r.length - 1) !== 46 || r.charCodeAt(r.length - 2) !== 46) {
|
|
2344
|
+
if (r.length > 2) {
|
|
2345
|
+
var l = r.lastIndexOf("/");
|
|
2346
|
+
if (l !== r.length - 1) {
|
|
2347
|
+
l === -1 ? (r = "", i = 0) : (r = r.slice(0, l), i = r.length - 1 - r.lastIndexOf("/")), a = c, o = 0;
|
|
2348
|
+
continue;
|
|
2349
|
+
}
|
|
2350
|
+
} else if (r.length === 2 || r.length === 1) {
|
|
2351
|
+
r = "", i = 0, a = c, o = 0;
|
|
2352
|
+
continue;
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
n && (r.length > 0 ? r += "/.." : r = "..", i = 2);
|
|
2356
|
+
} else r.length > 0 ? r += "/" + e.slice(a + 1, c) : r = e.slice(a + 1, c), i = c - a - 1;
|
|
2357
|
+
a = c, o = 0;
|
|
2358
|
+
} else s === 46 && o !== -1 ? ++o : o = -1;
|
|
2359
|
+
}
|
|
2360
|
+
return r;
|
|
2361
|
+
}
|
|
2362
|
+
function a(e, n) {
|
|
2363
|
+
var r = n.dir || n.root, i = n.base || (n.name || "") + (n.ext || "");
|
|
2364
|
+
return r ? r === n.root ? r + i : r + e + i : i;
|
|
2365
|
+
}
|
|
2366
|
+
var o = {
|
|
2367
|
+
resolve: function() {
|
|
2368
|
+
for (var e = "", n = !1, a, o = arguments.length - 1; o >= -1 && !n; o--) {
|
|
2369
|
+
var s;
|
|
2370
|
+
o >= 0 ? s = arguments[o] : (a === void 0 && (a = process.cwd()), s = a), r(s), s.length !== 0 && (e = s + "/" + e, n = s.charCodeAt(0) === 47);
|
|
2371
|
+
}
|
|
2372
|
+
return e = i(e, !n), n ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : ".";
|
|
2373
|
+
},
|
|
2374
|
+
normalize: function(e) {
|
|
2375
|
+
if (r(e), e.length === 0) return ".";
|
|
2376
|
+
var n = e.charCodeAt(0) === 47, a = e.charCodeAt(e.length - 1) === 47;
|
|
2377
|
+
return e = i(e, !n), e.length === 0 && !n && (e = "."), e.length > 0 && a && (e += "/"), n ? "/" + e : e;
|
|
2378
|
+
},
|
|
2379
|
+
isAbsolute: function(e) {
|
|
2380
|
+
return r(e), e.length > 0 && e.charCodeAt(0) === 47;
|
|
2381
|
+
},
|
|
2382
|
+
join: function() {
|
|
2383
|
+
if (arguments.length === 0) return ".";
|
|
2384
|
+
for (var e, n = 0; n < arguments.length; ++n) {
|
|
2385
|
+
var i = arguments[n];
|
|
2386
|
+
r(i), i.length > 0 && (e === void 0 ? e = i : e += "/" + i);
|
|
2387
|
+
}
|
|
2388
|
+
return e === void 0 ? "." : o.normalize(e);
|
|
2389
|
+
},
|
|
2390
|
+
relative: function(e, n) {
|
|
2391
|
+
if (r(e), r(n), e === n || (e = o.resolve(e), n = o.resolve(n), e === n)) return "";
|
|
2392
|
+
for (var i = 1; i < e.length && e.charCodeAt(i) === 47; ++i);
|
|
2393
|
+
for (var a = e.length, s = a - i, c = 1; c < n.length && n.charCodeAt(c) === 47; ++c);
|
|
2394
|
+
for (var l = n.length - c, u = s < l ? s : l, d = -1, f = 0; f <= u; ++f) {
|
|
2395
|
+
if (f === u) {
|
|
2396
|
+
if (l > u) {
|
|
2397
|
+
if (n.charCodeAt(c + f) === 47) return n.slice(c + f + 1);
|
|
2398
|
+
if (f === 0) return n.slice(c + f);
|
|
2399
|
+
} else s > u && (e.charCodeAt(i + f) === 47 ? d = f : f === 0 && (d = 0));
|
|
2400
|
+
break;
|
|
2401
|
+
}
|
|
2402
|
+
var p = e.charCodeAt(i + f);
|
|
2403
|
+
if (p !== n.charCodeAt(c + f)) break;
|
|
2404
|
+
p === 47 && (d = f);
|
|
2405
|
+
}
|
|
2406
|
+
var m = "";
|
|
2407
|
+
for (f = i + d + 1; f <= a; ++f) (f === a || e.charCodeAt(f) === 47) && (m.length === 0 ? m += ".." : m += "/..");
|
|
2408
|
+
return m.length > 0 ? m + n.slice(c + d) : (c += d, n.charCodeAt(c) === 47 && ++c, n.slice(c));
|
|
2409
|
+
},
|
|
2410
|
+
_makeLong: function(e) {
|
|
2411
|
+
return e;
|
|
2412
|
+
},
|
|
2413
|
+
dirname: function(e) {
|
|
2414
|
+
if (r(e), e.length === 0) return ".";
|
|
2415
|
+
for (var n = e.charCodeAt(0), i = n === 47, a = -1, o = !0, s = e.length - 1; s >= 1; --s) if (n = e.charCodeAt(s), n === 47) {
|
|
2416
|
+
if (!o) {
|
|
2417
|
+
a = s;
|
|
2418
|
+
break;
|
|
2419
|
+
}
|
|
2420
|
+
} else o = !1;
|
|
2421
|
+
return a === -1 ? i ? "/" : "." : i && a === 1 ? "//" : e.slice(0, a);
|
|
2422
|
+
},
|
|
2423
|
+
basename: function(e, n) {
|
|
2424
|
+
if (n !== void 0 && typeof n != "string") throw TypeError("\"ext\" argument must be a string");
|
|
2425
|
+
r(e);
|
|
2426
|
+
var i = 0, a = -1, o = !0, s;
|
|
2427
|
+
if (n !== void 0 && n.length > 0 && n.length <= e.length) {
|
|
2428
|
+
if (n.length === e.length && n === e) return "";
|
|
2429
|
+
var c = n.length - 1, l = -1;
|
|
2430
|
+
for (s = e.length - 1; s >= 0; --s) {
|
|
2431
|
+
var u = e.charCodeAt(s);
|
|
2432
|
+
if (u === 47) {
|
|
2433
|
+
if (!o) {
|
|
2434
|
+
i = s + 1;
|
|
2435
|
+
break;
|
|
2436
|
+
}
|
|
2437
|
+
} else l === -1 && (o = !1, l = s + 1), c >= 0 && (u === n.charCodeAt(c) ? --c === -1 && (a = s) : (c = -1, a = l));
|
|
2438
|
+
}
|
|
2439
|
+
return i === a ? a = l : a === -1 && (a = e.length), e.slice(i, a);
|
|
2440
|
+
} else {
|
|
2441
|
+
for (s = e.length - 1; s >= 0; --s) if (e.charCodeAt(s) === 47) {
|
|
2442
|
+
if (!o) {
|
|
2443
|
+
i = s + 1;
|
|
2444
|
+
break;
|
|
2445
|
+
}
|
|
2446
|
+
} else a === -1 && (o = !1, a = s + 1);
|
|
2447
|
+
return a === -1 ? "" : e.slice(i, a);
|
|
2448
|
+
}
|
|
2449
|
+
},
|
|
2450
|
+
extname: function(e) {
|
|
2451
|
+
r(e);
|
|
2452
|
+
for (var n = -1, i = 0, a = -1, o = !0, s = 0, c = e.length - 1; c >= 0; --c) {
|
|
2453
|
+
var l = e.charCodeAt(c);
|
|
2454
|
+
if (l === 47) {
|
|
2455
|
+
if (!o) {
|
|
2456
|
+
i = c + 1;
|
|
2457
|
+
break;
|
|
2458
|
+
}
|
|
2459
|
+
continue;
|
|
2460
|
+
}
|
|
2461
|
+
a === -1 && (o = !1, a = c + 1), l === 46 ? n === -1 ? n = c : s !== 1 && (s = 1) : n !== -1 && (s = -1);
|
|
2462
|
+
}
|
|
2463
|
+
return n === -1 || a === -1 || s === 0 || s === 1 && n === a - 1 && n === i + 1 ? "" : e.slice(n, a);
|
|
2464
|
+
},
|
|
2465
|
+
format: function(e) {
|
|
2466
|
+
if (typeof e != "object" || !e) throw TypeError("The \"pathObject\" argument must be of type Object. Received type " + typeof e);
|
|
2467
|
+
return a("/", e);
|
|
2468
|
+
},
|
|
2469
|
+
parse: function(e) {
|
|
2470
|
+
r(e);
|
|
2471
|
+
var n = {
|
|
2472
|
+
root: "",
|
|
2473
|
+
dir: "",
|
|
2474
|
+
base: "",
|
|
2475
|
+
ext: "",
|
|
2476
|
+
name: ""
|
|
2477
|
+
};
|
|
2478
|
+
if (e.length === 0) return n;
|
|
2479
|
+
var i = e.charCodeAt(0), a = i === 47, o;
|
|
2480
|
+
a ? (n.root = "/", o = 1) : o = 0;
|
|
2481
|
+
for (var s = -1, c = 0, l = -1, u = !0, d = e.length - 1, f = 0; d >= o; --d) {
|
|
2482
|
+
if (i = e.charCodeAt(d), i === 47) {
|
|
2483
|
+
if (!u) {
|
|
2484
|
+
c = d + 1;
|
|
2485
|
+
break;
|
|
2486
|
+
}
|
|
2487
|
+
continue;
|
|
2488
|
+
}
|
|
2489
|
+
l === -1 && (u = !1, l = d + 1), i === 46 ? s === -1 ? s = d : f !== 1 && (f = 1) : s !== -1 && (f = -1);
|
|
2490
|
+
}
|
|
2491
|
+
return s === -1 || l === -1 || f === 0 || f === 1 && s === l - 1 && s === c + 1 ? l !== -1 && (c === 0 && a ? n.base = n.name = e.slice(1, l) : n.base = n.name = e.slice(c, l)) : (c === 0 && a ? (n.name = e.slice(1, s), n.base = e.slice(1, l)) : (n.name = e.slice(c, s), n.base = e.slice(c, l)), n.ext = e.slice(s, l)), c > 0 ? n.dir = e.slice(0, c - 1) : a && (n.dir = "/"), n;
|
|
2492
|
+
},
|
|
2493
|
+
sep: "/",
|
|
2494
|
+
delimiter: ":",
|
|
2495
|
+
win32: null,
|
|
2496
|
+
posix: null
|
|
2497
|
+
};
|
|
2498
|
+
o.posix = o, n.exports = o;
|
|
2499
|
+
})))(), 1);
|
|
2500
|
+
function resolveRoutePath(e, n) {
|
|
2501
|
+
return e ? import_path_browserify.default.resolve(e, n ?? "") : n ?? "";
|
|
2502
|
+
}
|
|
2503
|
+
function wrapProxy(e, n) {
|
|
2504
|
+
return new Proxy({}, { get(r, i) {
|
|
2505
|
+
let a;
|
|
2506
|
+
try {
|
|
2507
|
+
a = e();
|
|
2508
|
+
} catch (e) {
|
|
2509
|
+
let r = getPersistedState("state");
|
|
2510
|
+
if (r && r[n]) {
|
|
2511
|
+
let e = r[n], a = e[i];
|
|
2512
|
+
return typeof a == "function" ? a.bind(e) : a;
|
|
2513
|
+
}
|
|
2514
|
+
throw e;
|
|
2515
|
+
}
|
|
2516
|
+
let o = a[n];
|
|
2517
|
+
if (!o) throw Error(`Instance "${String(n)}" has not been set. Please call createContext() before using "${String(i)}".`);
|
|
2518
|
+
let s = o[i];
|
|
2519
|
+
return typeof s == "function" ? s.bind(o) : s;
|
|
2520
|
+
} });
|
|
2521
|
+
}
|
|
2522
|
+
var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
2523
|
+
function int2char(e) {
|
|
2524
|
+
return BI_RM.charAt(e);
|
|
2525
|
+
}
|
|
2526
|
+
function op_and(e, n) {
|
|
2527
|
+
return e & n;
|
|
2528
|
+
}
|
|
2529
|
+
function op_or(e, n) {
|
|
2530
|
+
return e | n;
|
|
2531
|
+
}
|
|
2532
|
+
function op_xor(e, n) {
|
|
2533
|
+
return e ^ n;
|
|
2534
|
+
}
|
|
2535
|
+
function op_andnot(e, n) {
|
|
2536
|
+
return e & ~n;
|
|
2537
|
+
}
|
|
2538
|
+
function lbit(e) {
|
|
2539
|
+
if (e == 0) return -1;
|
|
2540
|
+
var n = 0;
|
|
2541
|
+
return e & 65535 || (e >>= 16, n += 16), e & 255 || (e >>= 8, n += 8), e & 15 || (e >>= 4, n += 4), e & 3 || (e >>= 2, n += 2), e & 1 || ++n, n;
|
|
2542
|
+
}
|
|
2543
|
+
function cbit(e) {
|
|
2544
|
+
for (var n = 0; e != 0;) e &= e - 1, ++n;
|
|
2545
|
+
return n;
|
|
2546
|
+
}
|
|
2547
|
+
var b64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", b64pad = "=";
|
|
2548
|
+
function hex2b64(e) {
|
|
2549
|
+
var n, r, i = "";
|
|
2550
|
+
for (n = 0; n + 3 <= e.length; n += 3) r = parseInt(e.substring(n, n + 3), 16), i += b64map.charAt(r >> 6) + b64map.charAt(r & 63);
|
|
2551
|
+
for (n + 1 == e.length ? (r = parseInt(e.substring(n, n + 1), 16), i += b64map.charAt(r << 2)) : n + 2 == e.length && (r = parseInt(e.substring(n, n + 2), 16), i += b64map.charAt(r >> 2) + b64map.charAt((r & 3) << 4)); (i.length & 3) > 0;) i += b64pad;
|
|
2552
|
+
return i;
|
|
2553
|
+
}
|
|
2554
|
+
function b64tohex(e) {
|
|
2555
|
+
var n = "", r, i = 0, a = 0;
|
|
2556
|
+
for (r = 0; r < e.length && e.charAt(r) != b64pad; ++r) {
|
|
2557
|
+
var o = b64map.indexOf(e.charAt(r));
|
|
2558
|
+
o < 0 || (i == 0 ? (n += int2char(o >> 2), a = o & 3, i = 1) : i == 1 ? (n += int2char(a << 2 | o >> 4), a = o & 15, i = 2) : i == 2 ? (n += int2char(a), n += int2char(o >> 2), a = o & 3, i = 3) : (n += int2char(a << 2 | o >> 4), n += int2char(o & 15), i = 0));
|
|
2559
|
+
}
|
|
2560
|
+
return i == 1 && (n += int2char(a << 2)), n;
|
|
2561
|
+
}
|
|
2562
|
+
var decoder$1, Hex = { decode: function(e) {
|
|
2563
|
+
var n;
|
|
2564
|
+
if (decoder$1 === void 0) {
|
|
2565
|
+
var r = "0123456789ABCDEF", i = " \f\n\r \xA0\u2028\u2029";
|
|
2566
|
+
for (decoder$1 = {}, n = 0; n < 16; ++n) decoder$1[r.charAt(n)] = n;
|
|
2567
|
+
for (r = r.toLowerCase(), n = 10; n < 16; ++n) decoder$1[r.charAt(n)] = n;
|
|
2568
|
+
for (n = 0; n < i.length; ++n) decoder$1[i.charAt(n)] = -1;
|
|
2569
|
+
}
|
|
2570
|
+
var a = [], o = 0, s = 0;
|
|
2571
|
+
for (n = 0; n < e.length; ++n) {
|
|
2572
|
+
var c = e.charAt(n);
|
|
2573
|
+
if (c == "=") break;
|
|
2574
|
+
if (c = decoder$1[c], c != -1) {
|
|
2575
|
+
if (c === void 0) throw Error("Illegal character at offset " + n);
|
|
2576
|
+
o |= c, ++s >= 2 ? (a[a.length] = o, o = 0, s = 0) : o <<= 4;
|
|
2577
|
+
}
|
|
2578
|
+
}
|
|
2579
|
+
if (s) throw Error("Hex encoding incomplete: 4 bits missing");
|
|
2580
|
+
return a;
|
|
2581
|
+
} }, decoder, Base64 = {
|
|
2582
|
+
decode: function(e) {
|
|
2583
|
+
var n;
|
|
2584
|
+
if (decoder === void 0) {
|
|
2585
|
+
var r = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", i = "= \f\n\r \xA0\u2028\u2029";
|
|
2586
|
+
for (decoder = Object.create(null), n = 0; n < 64; ++n) decoder[r.charAt(n)] = n;
|
|
2587
|
+
for (decoder["-"] = 62, decoder._ = 63, n = 0; n < i.length; ++n) decoder[i.charAt(n)] = -1;
|
|
2588
|
+
}
|
|
2589
|
+
var a = [], o = 0, s = 0;
|
|
2590
|
+
for (n = 0; n < e.length; ++n) {
|
|
2591
|
+
var c = e.charAt(n);
|
|
2592
|
+
if (c == "=") break;
|
|
2593
|
+
if (c = decoder[c], c != -1) {
|
|
2594
|
+
if (c === void 0) throw Error("Illegal character at offset " + n);
|
|
2595
|
+
o |= c, ++s >= 4 ? (a[a.length] = o >> 16, a[a.length] = o >> 8 & 255, a[a.length] = o & 255, o = 0, s = 0) : o <<= 6;
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
switch (s) {
|
|
2599
|
+
case 1: throw Error("Base64 encoding incomplete: at least 2 bits missing");
|
|
2600
|
+
case 2:
|
|
2601
|
+
a[a.length] = o >> 10;
|
|
2602
|
+
break;
|
|
2603
|
+
case 3:
|
|
2604
|
+
a[a.length] = o >> 16, a[a.length] = o >> 8 & 255;
|
|
2605
|
+
break;
|
|
2606
|
+
}
|
|
2607
|
+
return a;
|
|
2608
|
+
},
|
|
2609
|
+
re: /-----BEGIN [^-]+-----([A-Za-z0-9+\/=\s]+)-----END [^-]+-----|begin-base64[^\n]+\n([A-Za-z0-9+\/=\s]+)====/,
|
|
2610
|
+
unarmor: function(e) {
|
|
2611
|
+
var n = Base64.re.exec(e);
|
|
2612
|
+
if (n) if (n[1]) e = n[1];
|
|
2613
|
+
else if (n[2]) e = n[2];
|
|
2614
|
+
else throw Error("RegExp out of sync");
|
|
2615
|
+
return Base64.decode(e);
|
|
2616
|
+
}
|
|
2617
|
+
}, max = 0x9184e72a000, Int10 = function() {
|
|
2618
|
+
function e(e) {
|
|
2619
|
+
this.buf = [+e || 0];
|
|
2620
|
+
}
|
|
2621
|
+
return e.prototype.mulAdd = function(e, n) {
|
|
2622
|
+
var r = this.buf, i = r.length, a, o;
|
|
2623
|
+
for (a = 0; a < i; ++a) o = r[a] * e + n, o < max ? n = 0 : (n = 0 | o / max, o -= n * max), r[a] = o;
|
|
2624
|
+
n > 0 && (r[a] = n);
|
|
2625
|
+
}, e.prototype.sub = function(e) {
|
|
2626
|
+
var n = this.buf, r = n.length, i, a;
|
|
2627
|
+
for (i = 0; i < r; ++i) a = n[i] - e, a < 0 ? (a += max, e = 1) : e = 0, n[i] = a;
|
|
2628
|
+
for (; n[n.length - 1] === 0;) n.pop();
|
|
2629
|
+
}, e.prototype.toString = function(e) {
|
|
2630
|
+
if ((e || 10) != 10) throw Error("only base 10 is supported");
|
|
2631
|
+
for (var n = this.buf, r = n[n.length - 1].toString(), i = n.length - 2; i >= 0; --i) r += (max + n[i]).toString().substring(1);
|
|
2632
|
+
return r;
|
|
2633
|
+
}, e.prototype.valueOf = function() {
|
|
2634
|
+
for (var e = this.buf, n = 0, r = e.length - 1; r >= 0; --r) n = n * max + e[r];
|
|
2635
|
+
return n;
|
|
2636
|
+
}, e.prototype.simplify = function() {
|
|
2637
|
+
var e = this.buf;
|
|
2638
|
+
return e.length == 1 ? e[0] : this;
|
|
2639
|
+
}, e;
|
|
2640
|
+
}(), ellipsis = "…", reTimeS = /^(\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)?)?$/, reTimeL = /^(\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)?)?$/;
|
|
2641
|
+
function stringCut(e, n) {
|
|
2642
|
+
return e.length > n && (e = e.substring(0, n) + ellipsis), e;
|
|
2643
|
+
}
|
|
2644
|
+
var Stream = function() {
|
|
2645
|
+
function e(n, r) {
|
|
2646
|
+
this.hexDigits = "0123456789ABCDEF", n instanceof e ? (this.enc = n.enc, this.pos = n.pos) : (this.enc = n, this.pos = r);
|
|
2647
|
+
}
|
|
2648
|
+
return e.prototype.get = function(e) {
|
|
2649
|
+
if (e === void 0 && (e = this.pos++), e >= this.enc.length) throw Error(`Requesting byte offset ${e} on a stream of length ${this.enc.length}`);
|
|
2650
|
+
return typeof this.enc == "string" ? this.enc.charCodeAt(e) : this.enc[e];
|
|
2651
|
+
}, e.prototype.hexByte = function(e) {
|
|
2652
|
+
return this.hexDigits.charAt(e >> 4 & 15) + this.hexDigits.charAt(e & 15);
|
|
2653
|
+
}, e.prototype.hexDump = function(e, n, r) {
|
|
2654
|
+
for (var i = "", a = e; a < n; ++a) if (i += this.hexByte(this.get(a)), r !== !0) switch (a & 15) {
|
|
2655
|
+
case 7:
|
|
2656
|
+
i += " ";
|
|
2657
|
+
break;
|
|
2658
|
+
case 15:
|
|
2659
|
+
i += "\n";
|
|
2660
|
+
break;
|
|
2661
|
+
default: i += " ";
|
|
2662
|
+
}
|
|
2663
|
+
return i;
|
|
2664
|
+
}, e.prototype.isASCII = function(e, n) {
|
|
2665
|
+
for (var r = e; r < n; ++r) {
|
|
2666
|
+
var i = this.get(r);
|
|
2667
|
+
if (i < 32 || i > 176) return !1;
|
|
2668
|
+
}
|
|
2669
|
+
return !0;
|
|
2670
|
+
}, e.prototype.parseStringISO = function(e, n) {
|
|
2671
|
+
for (var r = "", i = e; i < n; ++i) r += String.fromCharCode(this.get(i));
|
|
2672
|
+
return r;
|
|
2673
|
+
}, e.prototype.parseStringUTF = function(e, n) {
|
|
2674
|
+
for (var r = "", i = e; i < n;) {
|
|
2675
|
+
var a = this.get(i++);
|
|
2676
|
+
a < 128 ? r += String.fromCharCode(a) : a > 191 && a < 224 ? r += String.fromCharCode((a & 31) << 6 | this.get(i++) & 63) : r += String.fromCharCode((a & 15) << 12 | (this.get(i++) & 63) << 6 | this.get(i++) & 63);
|
|
2677
|
+
}
|
|
2678
|
+
return r;
|
|
2679
|
+
}, e.prototype.parseStringBMP = function(e, n) {
|
|
2680
|
+
for (var r = "", i, a, o = e; o < n;) i = this.get(o++), a = this.get(o++), r += String.fromCharCode(i << 8 | a);
|
|
2681
|
+
return r;
|
|
2682
|
+
}, e.prototype.parseTime = function(e, n, r) {
|
|
2683
|
+
var i = this.parseStringISO(e, n), a = (r ? reTimeS : reTimeL).exec(i);
|
|
2684
|
+
return a ? (r && (a[1] = +a[1], a[1] += +a[1] < 70 ? 2e3 : 1900), i = a[1] + "-" + a[2] + "-" + a[3] + " " + a[4], a[5] && (i += ":" + a[5], a[6] && (i += ":" + a[6], a[7] && (i += "." + a[7]))), a[8] && (i += " UTC", a[8] != "Z" && (i += a[8], a[9] && (i += ":" + a[9]))), i) : "Unrecognized time: " + i;
|
|
2685
|
+
}, e.prototype.parseInteger = function(e, n) {
|
|
2686
|
+
for (var r = this.get(e), i = r > 127, a = i ? 255 : 0, o, s = ""; r == a && ++e < n;) r = this.get(e);
|
|
2687
|
+
if (o = n - e, o === 0) return i ? -1 : 0;
|
|
2688
|
+
if (o > 4) {
|
|
2689
|
+
for (s = r, o <<= 3; !((+s ^ a) & 128);) s <<= 1, --o;
|
|
2690
|
+
s = "(" + o + " bit)\n";
|
|
2691
|
+
}
|
|
2692
|
+
i && (r -= 256);
|
|
2693
|
+
for (var c = new Int10(r), l = e + 1; l < n; ++l) c.mulAdd(256, this.get(l));
|
|
2694
|
+
return s + c.toString();
|
|
2695
|
+
}, e.prototype.parseBitString = function(e, n, r) {
|
|
2696
|
+
for (var i = this.get(e), a = "(" + ((n - e - 1 << 3) - i) + " bit)\n", o = "", s = e + 1; s < n; ++s) {
|
|
2697
|
+
for (var c = this.get(s), l = s == n - 1 ? i : 0, u = 7; u >= l; --u) o += c >> u & 1 ? "1" : "0";
|
|
2698
|
+
if (o.length > r) return a + stringCut(o, r);
|
|
2699
|
+
}
|
|
2700
|
+
return a + o;
|
|
2701
|
+
}, e.prototype.parseOctetString = function(e, n, r) {
|
|
2702
|
+
if (this.isASCII(e, n)) return stringCut(this.parseStringISO(e, n), r);
|
|
2703
|
+
var i = n - e, a = "(" + i + " byte)\n";
|
|
2704
|
+
r /= 2, i > r && (n = e + r);
|
|
2705
|
+
for (var o = e; o < n; ++o) a += this.hexByte(this.get(o));
|
|
2706
|
+
return i > r && (a += ellipsis), a;
|
|
2707
|
+
}, e.prototype.parseOID = function(e, n, r) {
|
|
2708
|
+
for (var i = "", a = new Int10(), o = 0, s = e; s < n; ++s) {
|
|
2709
|
+
var c = this.get(s);
|
|
2710
|
+
if (a.mulAdd(128, c & 127), o += 7, !(c & 128)) {
|
|
2711
|
+
if (i === "") if (a = a.simplify(), a instanceof Int10) a.sub(80), i = "2." + a.toString();
|
|
2712
|
+
else {
|
|
2713
|
+
var l = a < 80 ? a < 40 ? 0 : 1 : 2;
|
|
2714
|
+
i = l + "." + (a - l * 40);
|
|
2715
|
+
}
|
|
2716
|
+
else i += "." + a.toString();
|
|
2717
|
+
if (i.length > r) return stringCut(i, r);
|
|
2718
|
+
a = new Int10(), o = 0;
|
|
2719
|
+
}
|
|
2720
|
+
}
|
|
2721
|
+
return o > 0 && (i += ".incomplete"), i;
|
|
2722
|
+
}, e;
|
|
2723
|
+
}(), ASN1 = function() {
|
|
2724
|
+
function e(e, n, r, i, a) {
|
|
2725
|
+
if (!(i instanceof ASN1Tag)) throw Error("Invalid tag value.");
|
|
2726
|
+
this.stream = e, this.header = n, this.length = r, this.tag = i, this.sub = a;
|
|
2727
|
+
}
|
|
2728
|
+
return e.prototype.typeName = function() {
|
|
2729
|
+
switch (this.tag.tagClass) {
|
|
2730
|
+
case 0:
|
|
2731
|
+
switch (this.tag.tagNumber) {
|
|
2732
|
+
case 0: return "EOC";
|
|
2733
|
+
case 1: return "BOOLEAN";
|
|
2734
|
+
case 2: return "INTEGER";
|
|
2735
|
+
case 3: return "BIT_STRING";
|
|
2736
|
+
case 4: return "OCTET_STRING";
|
|
2737
|
+
case 5: return "NULL";
|
|
2738
|
+
case 6: return "OBJECT_IDENTIFIER";
|
|
2739
|
+
case 7: return "ObjectDescriptor";
|
|
2740
|
+
case 8: return "EXTERNAL";
|
|
2741
|
+
case 9: return "REAL";
|
|
2742
|
+
case 10: return "ENUMERATED";
|
|
2743
|
+
case 11: return "EMBEDDED_PDV";
|
|
2744
|
+
case 12: return "UTF8String";
|
|
2745
|
+
case 16: return "SEQUENCE";
|
|
2746
|
+
case 17: return "SET";
|
|
2747
|
+
case 18: return "NumericString";
|
|
2748
|
+
case 19: return "PrintableString";
|
|
2749
|
+
case 20: return "TeletexString";
|
|
2750
|
+
case 21: return "VideotexString";
|
|
2751
|
+
case 22: return "IA5String";
|
|
2752
|
+
case 23: return "UTCTime";
|
|
2753
|
+
case 24: return "GeneralizedTime";
|
|
2754
|
+
case 25: return "GraphicString";
|
|
2755
|
+
case 26: return "VisibleString";
|
|
2756
|
+
case 27: return "GeneralString";
|
|
2757
|
+
case 28: return "UniversalString";
|
|
2758
|
+
case 30: return "BMPString";
|
|
2759
|
+
}
|
|
2760
|
+
return "Universal_" + this.tag.tagNumber.toString();
|
|
2761
|
+
case 1: return "Application_" + this.tag.tagNumber.toString();
|
|
2762
|
+
case 2: return "[" + this.tag.tagNumber.toString() + "]";
|
|
2763
|
+
case 3: return "Private_" + this.tag.tagNumber.toString();
|
|
2764
|
+
}
|
|
2765
|
+
}, e.prototype.content = function(e) {
|
|
2766
|
+
if (this.tag === void 0) return null;
|
|
2767
|
+
e === void 0 && (e = Infinity);
|
|
2768
|
+
var n = this.posContent(), r = Math.abs(this.length);
|
|
2769
|
+
if (!this.tag.isUniversal()) return this.sub === null ? this.stream.parseOctetString(n, n + r, e) : "(" + this.sub.length + " elem)";
|
|
2770
|
+
switch (this.tag.tagNumber) {
|
|
2771
|
+
case 1: return this.stream.get(n) === 0 ? "false" : "true";
|
|
2772
|
+
case 2: return this.stream.parseInteger(n, n + r);
|
|
2773
|
+
case 3: return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseBitString(n, n + r, e);
|
|
2774
|
+
case 4: return this.sub ? "(" + this.sub.length + " elem)" : this.stream.parseOctetString(n, n + r, e);
|
|
2775
|
+
case 6: return this.stream.parseOID(n, n + r, e);
|
|
2776
|
+
case 16:
|
|
2777
|
+
case 17: return this.sub === null ? "(no elem)" : "(" + this.sub.length + " elem)";
|
|
2778
|
+
case 12: return stringCut(this.stream.parseStringUTF(n, n + r), e);
|
|
2779
|
+
case 18:
|
|
2780
|
+
case 19:
|
|
2781
|
+
case 20:
|
|
2782
|
+
case 21:
|
|
2783
|
+
case 22:
|
|
2784
|
+
case 26: return stringCut(this.stream.parseStringISO(n, n + r), e);
|
|
2785
|
+
case 30: return stringCut(this.stream.parseStringBMP(n, n + r), e);
|
|
2786
|
+
case 23:
|
|
2787
|
+
case 24: return this.stream.parseTime(n, n + r, this.tag.tagNumber == 23);
|
|
2788
|
+
}
|
|
2789
|
+
return null;
|
|
2790
|
+
}, e.prototype.toString = function() {
|
|
2791
|
+
return this.typeName() + "@" + this.stream.pos + "[header:" + this.header + ",length:" + this.length + ",sub:" + (this.sub === null ? "null" : this.sub.length) + "]";
|
|
2792
|
+
}, e.prototype.toPrettyString = function(e) {
|
|
2793
|
+
e === void 0 && (e = "");
|
|
2794
|
+
var n = e + this.typeName() + " @" + this.stream.pos;
|
|
2795
|
+
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 += "\n", this.sub !== null) {
|
|
2796
|
+
e += " ";
|
|
2797
|
+
for (var r = 0, i = this.sub.length; r < i; ++r) n += this.sub[r].toPrettyString(e);
|
|
2798
|
+
}
|
|
2799
|
+
return n;
|
|
2800
|
+
}, e.prototype.posStart = function() {
|
|
2801
|
+
return this.stream.pos;
|
|
2802
|
+
}, e.prototype.posContent = function() {
|
|
2803
|
+
return this.stream.pos + this.header;
|
|
2804
|
+
}, e.prototype.posEnd = function() {
|
|
2805
|
+
return this.stream.pos + this.header + Math.abs(this.length);
|
|
2806
|
+
}, e.prototype.toHexString = function() {
|
|
2807
|
+
return this.stream.hexDump(this.posStart(), this.posEnd(), !0);
|
|
2808
|
+
}, e.decodeLength = function(e) {
|
|
2809
|
+
var n = e.get(), r = n & 127;
|
|
2810
|
+
if (r == n) return r;
|
|
2811
|
+
if (r > 6) throw Error("Length over 48 bits not supported at position " + (e.pos - 1));
|
|
2812
|
+
if (r === 0) return null;
|
|
2813
|
+
n = 0;
|
|
2814
|
+
for (var i = 0; i < r; ++i) n = n * 256 + e.get();
|
|
2815
|
+
return n;
|
|
2816
|
+
}, e.prototype.getHexStringValue = function() {
|
|
2817
|
+
var e = this.toHexString(), n = this.header * 2, r = this.length * 2;
|
|
2818
|
+
return e.substring(n, n + r);
|
|
2819
|
+
}, e.decode = function(n) {
|
|
2820
|
+
var r = n instanceof Stream ? n : new Stream(n, 0), i = new Stream(r), a = new ASN1Tag(r), o = e.decodeLength(r), s = r.pos, c = s - i.pos, l = null, u = function() {
|
|
2821
|
+
var n = [];
|
|
2822
|
+
if (o !== null) {
|
|
2823
|
+
for (var i = s + o; r.pos < i;) n[n.length] = e.decode(r);
|
|
2824
|
+
if (r.pos != i) throw Error("Content size is not correct for container starting at offset " + s);
|
|
2825
|
+
} else try {
|
|
2826
|
+
for (;;) {
|
|
2827
|
+
var a = e.decode(r);
|
|
2828
|
+
if (a.tag.isEOC()) break;
|
|
2829
|
+
n[n.length] = a;
|
|
2830
|
+
}
|
|
2831
|
+
o = s - r.pos;
|
|
2832
|
+
} catch (e) {
|
|
2833
|
+
throw Error("Exception while decoding undefined length content: " + e);
|
|
2834
|
+
}
|
|
2835
|
+
return n;
|
|
2836
|
+
};
|
|
2837
|
+
if (a.tagConstructed) l = u();
|
|
2838
|
+
else if (a.isUniversal() && (a.tagNumber == 3 || a.tagNumber == 4)) try {
|
|
2839
|
+
if (a.tagNumber == 3 && r.get() != 0) throw Error("BIT STRINGs with unused bits cannot encapsulate.");
|
|
2840
|
+
l = u();
|
|
2841
|
+
for (var d = 0; d < l.length; ++d) if (l[d].tag.isEOC()) throw Error("EOC is not supposed to be actual content.");
|
|
2842
|
+
} catch {
|
|
2843
|
+
l = null;
|
|
2844
|
+
}
|
|
2845
|
+
if (l === null) {
|
|
2846
|
+
if (o === null) throw Error("We can't skip over an invalid tag with undefined length at offset " + s);
|
|
2847
|
+
r.pos = s + Math.abs(o);
|
|
2848
|
+
}
|
|
2849
|
+
return new e(i, c, o, a, l);
|
|
2850
|
+
}, e;
|
|
2851
|
+
}(), ASN1Tag = function() {
|
|
2852
|
+
function e(e) {
|
|
2853
|
+
var n = e.get();
|
|
2854
|
+
if (this.tagClass = n >> 6, this.tagConstructed = (n & 32) != 0, this.tagNumber = n & 31, this.tagNumber == 31) {
|
|
2855
|
+
var r = new Int10();
|
|
2856
|
+
do
|
|
2857
|
+
n = e.get(), r.mulAdd(128, n & 127);
|
|
2858
|
+
while (n & 128);
|
|
2859
|
+
this.tagNumber = r.simplify();
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
return e.prototype.isUniversal = function() {
|
|
2863
|
+
return this.tagClass === 0;
|
|
2864
|
+
}, e.prototype.isEOC = function() {
|
|
2865
|
+
return this.tagClass === 0 && this.tagNumber === 0;
|
|
2866
|
+
}, e;
|
|
2867
|
+
}(), dbits, j_lm = !0, lowprimes = [
|
|
2868
|
+
2,
|
|
2869
|
+
3,
|
|
2870
|
+
5,
|
|
2871
|
+
7,
|
|
2872
|
+
11,
|
|
2873
|
+
13,
|
|
2874
|
+
17,
|
|
2875
|
+
19,
|
|
2876
|
+
23,
|
|
2877
|
+
29,
|
|
2878
|
+
31,
|
|
2879
|
+
37,
|
|
2880
|
+
41,
|
|
2881
|
+
43,
|
|
2882
|
+
47,
|
|
2883
|
+
53,
|
|
2884
|
+
59,
|
|
2885
|
+
61,
|
|
2886
|
+
67,
|
|
2887
|
+
71,
|
|
2888
|
+
73,
|
|
2889
|
+
79,
|
|
2890
|
+
83,
|
|
2891
|
+
89,
|
|
2892
|
+
97,
|
|
2893
|
+
101,
|
|
2894
|
+
103,
|
|
2895
|
+
107,
|
|
2896
|
+
109,
|
|
2897
|
+
113,
|
|
2898
|
+
127,
|
|
2899
|
+
131,
|
|
2900
|
+
137,
|
|
2901
|
+
139,
|
|
2902
|
+
149,
|
|
2903
|
+
151,
|
|
2904
|
+
157,
|
|
2905
|
+
163,
|
|
2906
|
+
167,
|
|
2907
|
+
173,
|
|
2908
|
+
179,
|
|
2909
|
+
181,
|
|
2910
|
+
191,
|
|
2911
|
+
193,
|
|
2912
|
+
197,
|
|
2913
|
+
199,
|
|
2914
|
+
211,
|
|
2915
|
+
223,
|
|
2916
|
+
227,
|
|
2917
|
+
229,
|
|
2918
|
+
233,
|
|
2919
|
+
239,
|
|
2920
|
+
241,
|
|
2921
|
+
251,
|
|
2922
|
+
257,
|
|
2923
|
+
263,
|
|
2924
|
+
269,
|
|
2925
|
+
271,
|
|
2926
|
+
277,
|
|
2927
|
+
281,
|
|
2928
|
+
283,
|
|
2929
|
+
293,
|
|
2930
|
+
307,
|
|
2931
|
+
311,
|
|
2932
|
+
313,
|
|
2933
|
+
317,
|
|
2934
|
+
331,
|
|
2935
|
+
337,
|
|
2936
|
+
347,
|
|
2937
|
+
349,
|
|
2938
|
+
353,
|
|
2939
|
+
359,
|
|
2940
|
+
367,
|
|
2941
|
+
373,
|
|
2942
|
+
379,
|
|
2943
|
+
383,
|
|
2944
|
+
389,
|
|
2945
|
+
397,
|
|
2946
|
+
401,
|
|
2947
|
+
409,
|
|
2948
|
+
419,
|
|
2949
|
+
421,
|
|
2950
|
+
431,
|
|
2951
|
+
433,
|
|
2952
|
+
439,
|
|
2953
|
+
443,
|
|
2954
|
+
449,
|
|
2955
|
+
457,
|
|
2956
|
+
461,
|
|
2957
|
+
463,
|
|
2958
|
+
467,
|
|
2959
|
+
479,
|
|
2960
|
+
487,
|
|
2961
|
+
491,
|
|
2962
|
+
499,
|
|
2963
|
+
503,
|
|
2964
|
+
509,
|
|
2965
|
+
521,
|
|
2966
|
+
523,
|
|
2967
|
+
541,
|
|
2968
|
+
547,
|
|
2969
|
+
557,
|
|
2970
|
+
563,
|
|
2971
|
+
569,
|
|
2972
|
+
571,
|
|
2973
|
+
577,
|
|
2974
|
+
587,
|
|
2975
|
+
593,
|
|
2976
|
+
599,
|
|
2977
|
+
601,
|
|
2978
|
+
607,
|
|
2979
|
+
613,
|
|
2980
|
+
617,
|
|
2981
|
+
619,
|
|
2982
|
+
631,
|
|
2983
|
+
641,
|
|
2984
|
+
643,
|
|
2985
|
+
647,
|
|
2986
|
+
653,
|
|
2987
|
+
659,
|
|
2988
|
+
661,
|
|
2989
|
+
673,
|
|
2990
|
+
677,
|
|
2991
|
+
683,
|
|
2992
|
+
691,
|
|
2993
|
+
701,
|
|
2994
|
+
709,
|
|
2995
|
+
719,
|
|
2996
|
+
727,
|
|
2997
|
+
733,
|
|
2998
|
+
739,
|
|
2999
|
+
743,
|
|
3000
|
+
751,
|
|
3001
|
+
757,
|
|
3002
|
+
761,
|
|
3003
|
+
769,
|
|
3004
|
+
773,
|
|
3005
|
+
787,
|
|
3006
|
+
797,
|
|
3007
|
+
809,
|
|
3008
|
+
811,
|
|
3009
|
+
821,
|
|
3010
|
+
823,
|
|
3011
|
+
827,
|
|
3012
|
+
829,
|
|
3013
|
+
839,
|
|
3014
|
+
853,
|
|
3015
|
+
857,
|
|
3016
|
+
859,
|
|
3017
|
+
863,
|
|
3018
|
+
877,
|
|
3019
|
+
881,
|
|
3020
|
+
883,
|
|
3021
|
+
887,
|
|
3022
|
+
907,
|
|
3023
|
+
911,
|
|
3024
|
+
919,
|
|
3025
|
+
929,
|
|
3026
|
+
937,
|
|
3027
|
+
941,
|
|
3028
|
+
947,
|
|
3029
|
+
953,
|
|
3030
|
+
967,
|
|
3031
|
+
971,
|
|
3032
|
+
977,
|
|
3033
|
+
983,
|
|
3034
|
+
991,
|
|
3035
|
+
997
|
|
3036
|
+
], lplim = (1 << 26) / lowprimes[lowprimes.length - 1], BigInteger = function() {
|
|
3037
|
+
function e(e, n, r) {
|
|
3038
|
+
e != null && (typeof e == "number" ? this.fromNumber(e, n, r) : n == null && typeof e != "string" ? this.fromString(e, 256) : this.fromString(e, n));
|
|
3039
|
+
}
|
|
3040
|
+
return e.prototype.toString = function(e) {
|
|
3041
|
+
if (this.s < 0) return "-" + this.negate().toString(e);
|
|
3042
|
+
var n;
|
|
3043
|
+
if (e == 16) n = 4;
|
|
3044
|
+
else if (e == 8) n = 3;
|
|
3045
|
+
else if (e == 2) n = 1;
|
|
3046
|
+
else if (e == 32) n = 5;
|
|
3047
|
+
else if (e == 4) n = 2;
|
|
3048
|
+
else return this.toRadix(e);
|
|
3049
|
+
var r = (1 << n) - 1, i, a = !1, o = "", s = this.t, c = this.DB - s * this.DB % n;
|
|
3050
|
+
if (s-- > 0) for (c < this.DB && (i = this[s] >> c) > 0 && (a = !0, o = int2char(i)); s >= 0;) c < n ? (i = (this[s] & (1 << c) - 1) << n - c, i |= this[--s] >> (c += this.DB - n)) : (i = this[s] >> (c -= n) & r, c <= 0 && (c += this.DB, --s)), i > 0 && (a = !0), a && (o += int2char(i));
|
|
3051
|
+
return a ? o : "0";
|
|
3052
|
+
}, e.prototype.negate = function() {
|
|
3053
|
+
var n = nbi();
|
|
3054
|
+
return e.ZERO.subTo(this, n), n;
|
|
3055
|
+
}, e.prototype.abs = function() {
|
|
3056
|
+
return this.s < 0 ? this.negate() : this;
|
|
3057
|
+
}, e.prototype.compareTo = function(e) {
|
|
3058
|
+
var n = this.s - e.s;
|
|
3059
|
+
if (n != 0) return n;
|
|
3060
|
+
var r = this.t;
|
|
3061
|
+
if (n = r - e.t, n != 0) return this.s < 0 ? -n : n;
|
|
3062
|
+
for (; --r >= 0;) if ((n = this[r] - e[r]) != 0) return n;
|
|
3063
|
+
return 0;
|
|
3064
|
+
}, e.prototype.bitLength = function() {
|
|
3065
|
+
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ this.s & this.DM);
|
|
3066
|
+
}, e.prototype.mod = function(n) {
|
|
3067
|
+
var r = nbi();
|
|
3068
|
+
return this.abs().divRemTo(n, null, r), this.s < 0 && r.compareTo(e.ZERO) > 0 && n.subTo(r, r), r;
|
|
3069
|
+
}, e.prototype.modPowInt = function(e, n) {
|
|
3070
|
+
var r = e < 256 || n.isEven() ? new Classic(n) : new Montgomery(n);
|
|
3071
|
+
return this.exp(e, r);
|
|
3072
|
+
}, e.prototype.clone = function() {
|
|
3073
|
+
var e = nbi();
|
|
3074
|
+
return this.copyTo(e), e;
|
|
3075
|
+
}, e.prototype.intValue = function() {
|
|
3076
|
+
if (this.s < 0) {
|
|
3077
|
+
if (this.t == 1) return this[0] - this.DV;
|
|
3078
|
+
if (this.t == 0) return -1;
|
|
3079
|
+
} else if (this.t == 1) return this[0];
|
|
3080
|
+
else if (this.t == 0) return 0;
|
|
3081
|
+
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
|
|
3082
|
+
}, e.prototype.byteValue = function() {
|
|
3083
|
+
return this.t == 0 ? this.s : this[0] << 24 >> 24;
|
|
3084
|
+
}, e.prototype.shortValue = function() {
|
|
3085
|
+
return this.t == 0 ? this.s : this[0] << 16 >> 16;
|
|
3086
|
+
}, e.prototype.signum = function() {
|
|
3087
|
+
return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1;
|
|
3088
|
+
}, e.prototype.toByteArray = function() {
|
|
3089
|
+
var e = this.t, n = [];
|
|
3090
|
+
n[0] = this.s;
|
|
3091
|
+
var r = this.DB - e * this.DB % 8, i, a = 0;
|
|
3092
|
+
if (e-- > 0) for (r < this.DB && (i = this[e] >> r) != (this.s & this.DM) >> r && (n[a++] = i | this.s << this.DB - r); e >= 0;) r < 8 ? (i = (this[e] & (1 << r) - 1) << 8 - r, i |= this[--e] >> (r += this.DB - 8)) : (i = this[e] >> (r -= 8) & 255, r <= 0 && (r += this.DB, --e)), i & 128 && (i |= -256), a == 0 && (this.s & 128) != (i & 128) && ++a, (a > 0 || i != this.s) && (n[a++] = i);
|
|
3093
|
+
return n;
|
|
3094
|
+
}, e.prototype.equals = function(e) {
|
|
3095
|
+
return this.compareTo(e) == 0;
|
|
3096
|
+
}, e.prototype.min = function(e) {
|
|
3097
|
+
return this.compareTo(e) < 0 ? this : e;
|
|
3098
|
+
}, e.prototype.max = function(e) {
|
|
3099
|
+
return this.compareTo(e) > 0 ? this : e;
|
|
3100
|
+
}, e.prototype.and = function(e) {
|
|
3101
|
+
var n = nbi();
|
|
3102
|
+
return this.bitwiseTo(e, op_and, n), n;
|
|
3103
|
+
}, e.prototype.or = function(e) {
|
|
3104
|
+
var n = nbi();
|
|
3105
|
+
return this.bitwiseTo(e, op_or, n), n;
|
|
3106
|
+
}, e.prototype.xor = function(e) {
|
|
3107
|
+
var n = nbi();
|
|
3108
|
+
return this.bitwiseTo(e, op_xor, n), n;
|
|
3109
|
+
}, e.prototype.andNot = function(e) {
|
|
3110
|
+
var n = nbi();
|
|
3111
|
+
return this.bitwiseTo(e, op_andnot, n), n;
|
|
3112
|
+
}, e.prototype.not = function() {
|
|
3113
|
+
for (var e = nbi(), n = 0; n < this.t; ++n) e[n] = this.DM & ~this[n];
|
|
3114
|
+
return e.t = this.t, e.s = ~this.s, e;
|
|
3115
|
+
}, e.prototype.shiftLeft = function(e) {
|
|
3116
|
+
var n = nbi();
|
|
3117
|
+
return e < 0 ? this.rShiftTo(-e, n) : this.lShiftTo(e, n), n;
|
|
3118
|
+
}, e.prototype.shiftRight = function(e) {
|
|
3119
|
+
var n = nbi();
|
|
3120
|
+
return e < 0 ? this.lShiftTo(-e, n) : this.rShiftTo(e, n), n;
|
|
3121
|
+
}, e.prototype.getLowestSetBit = function() {
|
|
3122
|
+
for (var e = 0; e < this.t; ++e) if (this[e] != 0) return e * this.DB + lbit(this[e]);
|
|
3123
|
+
return this.s < 0 ? this.t * this.DB : -1;
|
|
3124
|
+
}, e.prototype.bitCount = function() {
|
|
3125
|
+
for (var e = 0, n = this.s & this.DM, r = 0; r < this.t; ++r) e += cbit(this[r] ^ n);
|
|
3126
|
+
return e;
|
|
3127
|
+
}, e.prototype.testBit = function(e) {
|
|
3128
|
+
var n = Math.floor(e / this.DB);
|
|
3129
|
+
return n >= this.t ? this.s != 0 : (this[n] & 1 << e % this.DB) != 0;
|
|
3130
|
+
}, e.prototype.setBit = function(e) {
|
|
3131
|
+
return this.changeBit(e, op_or);
|
|
3132
|
+
}, e.prototype.clearBit = function(e) {
|
|
3133
|
+
return this.changeBit(e, op_andnot);
|
|
3134
|
+
}, e.prototype.flipBit = function(e) {
|
|
3135
|
+
return this.changeBit(e, op_xor);
|
|
3136
|
+
}, e.prototype.add = function(e) {
|
|
3137
|
+
var n = nbi();
|
|
3138
|
+
return this.addTo(e, n), n;
|
|
3139
|
+
}, e.prototype.subtract = function(e) {
|
|
3140
|
+
var n = nbi();
|
|
3141
|
+
return this.subTo(e, n), n;
|
|
3142
|
+
}, e.prototype.multiply = function(e) {
|
|
3143
|
+
var n = nbi();
|
|
3144
|
+
return this.multiplyTo(e, n), n;
|
|
3145
|
+
}, e.prototype.divide = function(e) {
|
|
3146
|
+
var n = nbi();
|
|
3147
|
+
return this.divRemTo(e, n, null), n;
|
|
3148
|
+
}, e.prototype.remainder = function(e) {
|
|
3149
|
+
var n = nbi();
|
|
3150
|
+
return this.divRemTo(e, null, n), n;
|
|
3151
|
+
}, e.prototype.divideAndRemainder = function(e) {
|
|
3152
|
+
var n = nbi(), r = nbi();
|
|
3153
|
+
return this.divRemTo(e, n, r), [n, r];
|
|
3154
|
+
}, e.prototype.modPow = function(e, n) {
|
|
3155
|
+
var r = e.bitLength(), i, a = nbv(1), o;
|
|
3156
|
+
if (r <= 0) return a;
|
|
3157
|
+
i = r < 18 ? 1 : r < 48 ? 3 : r < 144 ? 4 : r < 768 ? 5 : 6, o = r < 8 ? new Classic(n) : n.isEven() ? new Barrett(n) : new Montgomery(n);
|
|
3158
|
+
var s = [], c = 3, l = i - 1, u = (1 << i) - 1;
|
|
3159
|
+
if (s[1] = o.convert(this), i > 1) {
|
|
3160
|
+
var d = nbi();
|
|
3161
|
+
for (o.sqrTo(s[1], d); c <= u;) s[c] = nbi(), o.mulTo(d, s[c - 2], s[c]), c += 2;
|
|
3162
|
+
}
|
|
3163
|
+
var f = e.t - 1, p, m = !0, h = nbi(), g;
|
|
3164
|
+
for (r = nbits(e[f]) - 1; f >= 0;) {
|
|
3165
|
+
for (r >= l ? p = e[f] >> r - l & u : (p = (e[f] & (1 << r + 1) - 1) << l - r, f > 0 && (p |= e[f - 1] >> this.DB + r - l)), c = i; !(p & 1);) p >>= 1, --c;
|
|
3166
|
+
if ((r -= c) < 0 && (r += this.DB, --f), m) s[p].copyTo(a), m = !1;
|
|
3167
|
+
else {
|
|
3168
|
+
for (; c > 1;) o.sqrTo(a, h), o.sqrTo(h, a), c -= 2;
|
|
3169
|
+
c > 0 ? o.sqrTo(a, h) : (g = a, a = h, h = g), o.mulTo(h, s[p], a);
|
|
3170
|
+
}
|
|
3171
|
+
for (; f >= 0 && !(e[f] & 1 << r);) o.sqrTo(a, h), g = a, a = h, h = g, --r < 0 && (r = this.DB - 1, --f);
|
|
3172
|
+
}
|
|
3173
|
+
return o.revert(a);
|
|
3174
|
+
}, e.prototype.modInverse = function(n) {
|
|
3175
|
+
var r = n.isEven();
|
|
3176
|
+
if (this.isEven() && r || n.signum() == 0) return e.ZERO;
|
|
3177
|
+
for (var i = n.clone(), a = this.clone(), o = nbv(1), s = nbv(0), c = nbv(0), l = nbv(1); i.signum() != 0;) {
|
|
3178
|
+
for (; i.isEven();) i.rShiftTo(1, i), r ? ((!o.isEven() || !s.isEven()) && (o.addTo(this, o), s.subTo(n, s)), o.rShiftTo(1, o)) : s.isEven() || s.subTo(n, s), s.rShiftTo(1, s);
|
|
3179
|
+
for (; a.isEven();) a.rShiftTo(1, a), r ? ((!c.isEven() || !l.isEven()) && (c.addTo(this, c), l.subTo(n, l)), c.rShiftTo(1, c)) : l.isEven() || l.subTo(n, l), l.rShiftTo(1, l);
|
|
3180
|
+
i.compareTo(a) >= 0 ? (i.subTo(a, i), r && o.subTo(c, o), s.subTo(l, s)) : (a.subTo(i, a), r && c.subTo(o, c), l.subTo(s, l));
|
|
3181
|
+
}
|
|
3182
|
+
if (a.compareTo(e.ONE) != 0) return e.ZERO;
|
|
3183
|
+
if (l.compareTo(n) >= 0) return l.subtract(n);
|
|
3184
|
+
if (l.signum() < 0) l.addTo(n, l);
|
|
3185
|
+
else return l;
|
|
3186
|
+
return l.signum() < 0 ? l.add(n) : l;
|
|
3187
|
+
}, e.prototype.pow = function(e) {
|
|
3188
|
+
return this.exp(e, new NullExp());
|
|
3189
|
+
}, e.prototype.gcd = function(e) {
|
|
3190
|
+
var n = this.s < 0 ? this.negate() : this.clone(), r = e.s < 0 ? e.negate() : e.clone();
|
|
3191
|
+
if (n.compareTo(r) < 0) {
|
|
3192
|
+
var i = n;
|
|
3193
|
+
n = r, r = i;
|
|
3194
|
+
}
|
|
3195
|
+
var a = n.getLowestSetBit(), o = r.getLowestSetBit();
|
|
3196
|
+
if (o < 0) return n;
|
|
3197
|
+
for (a < o && (o = a), o > 0 && (n.rShiftTo(o, n), r.rShiftTo(o, r)); n.signum() > 0;) (a = n.getLowestSetBit()) > 0 && n.rShiftTo(a, n), (a = r.getLowestSetBit()) > 0 && r.rShiftTo(a, r), n.compareTo(r) >= 0 ? (n.subTo(r, n), n.rShiftTo(1, n)) : (r.subTo(n, r), r.rShiftTo(1, r));
|
|
3198
|
+
return o > 0 && r.lShiftTo(o, r), r;
|
|
3199
|
+
}, e.prototype.isProbablePrime = function(e) {
|
|
3200
|
+
var n, r = this.abs();
|
|
3201
|
+
if (r.t == 1 && r[0] <= lowprimes[lowprimes.length - 1]) {
|
|
3202
|
+
for (n = 0; n < lowprimes.length; ++n) if (r[0] == lowprimes[n]) return !0;
|
|
3203
|
+
return !1;
|
|
3204
|
+
}
|
|
3205
|
+
if (r.isEven()) return !1;
|
|
3206
|
+
for (n = 1; n < lowprimes.length;) {
|
|
3207
|
+
for (var i = lowprimes[n], a = n + 1; a < lowprimes.length && i < lplim;) i *= lowprimes[a++];
|
|
3208
|
+
for (i = r.modInt(i); n < a;) if (i % lowprimes[n++] == 0) return !1;
|
|
3209
|
+
}
|
|
3210
|
+
return r.millerRabin(e);
|
|
3211
|
+
}, e.prototype.copyTo = function(e) {
|
|
3212
|
+
for (var n = this.t - 1; n >= 0; --n) e[n] = this[n];
|
|
3213
|
+
e.t = this.t, e.s = this.s;
|
|
3214
|
+
}, e.prototype.fromInt = function(e) {
|
|
3215
|
+
this.t = 1, this.s = e < 0 ? -1 : 0, e > 0 ? this[0] = e : e < -1 ? this[0] = e + this.DV : this.t = 0;
|
|
3216
|
+
}, e.prototype.fromString = function(n, r) {
|
|
3217
|
+
var i;
|
|
3218
|
+
if (r == 16) i = 4;
|
|
3219
|
+
else if (r == 8) i = 3;
|
|
3220
|
+
else if (r == 256) i = 8;
|
|
3221
|
+
else if (r == 2) i = 1;
|
|
3222
|
+
else if (r == 32) i = 5;
|
|
3223
|
+
else if (r == 4) i = 2;
|
|
3224
|
+
else {
|
|
3225
|
+
this.fromRadix(n, r);
|
|
3226
|
+
return;
|
|
3227
|
+
}
|
|
3228
|
+
this.t = 0, this.s = 0;
|
|
3229
|
+
for (var a = n.length, o = !1, s = 0; --a >= 0;) {
|
|
3230
|
+
var c = i == 8 ? n[a] & 255 : intAt(n, a);
|
|
3231
|
+
if (c < 0) {
|
|
3232
|
+
n.charAt(a) == "-" && (o = !0);
|
|
3233
|
+
continue;
|
|
3234
|
+
}
|
|
3235
|
+
o = !1, s == 0 ? this[this.t++] = c : s + i > this.DB ? (this[this.t - 1] |= (c & (1 << this.DB - s) - 1) << s, this[this.t++] = c >> this.DB - s) : this[this.t - 1] |= c << s, s += i, s >= this.DB && (s -= this.DB);
|
|
3236
|
+
}
|
|
3237
|
+
i == 8 && n[0] & 128 && (this.s = -1, s > 0 && (this[this.t - 1] |= (1 << this.DB - s) - 1 << s)), this.clamp(), o && e.ZERO.subTo(this, this);
|
|
3238
|
+
}, e.prototype.clamp = function() {
|
|
3239
|
+
for (var e = this.s & this.DM; this.t > 0 && this[this.t - 1] == e;) --this.t;
|
|
3240
|
+
}, e.prototype.dlShiftTo = function(e, n) {
|
|
3241
|
+
var r;
|
|
3242
|
+
for (r = this.t - 1; r >= 0; --r) n[r + e] = this[r];
|
|
3243
|
+
for (r = e - 1; r >= 0; --r) n[r] = 0;
|
|
3244
|
+
n.t = this.t + e, n.s = this.s;
|
|
3245
|
+
}, e.prototype.drShiftTo = function(e, n) {
|
|
3246
|
+
for (var r = e; r < this.t; ++r) n[r - e] = this[r];
|
|
3247
|
+
n.t = Math.max(this.t - e, 0), n.s = this.s;
|
|
3248
|
+
}, e.prototype.lShiftTo = function(e, n) {
|
|
3249
|
+
for (var r = e % this.DB, i = this.DB - r, a = (1 << i) - 1, o = Math.floor(e / this.DB), s = this.s << r & this.DM, c = this.t - 1; c >= 0; --c) n[c + o + 1] = this[c] >> i | s, s = (this[c] & a) << r;
|
|
3250
|
+
for (var c = o - 1; c >= 0; --c) n[c] = 0;
|
|
3251
|
+
n[o] = s, n.t = this.t + o + 1, n.s = this.s, n.clamp();
|
|
3252
|
+
}, e.prototype.rShiftTo = function(e, n) {
|
|
3253
|
+
n.s = this.s;
|
|
3254
|
+
var r = Math.floor(e / this.DB);
|
|
3255
|
+
if (r >= this.t) {
|
|
3256
|
+
n.t = 0;
|
|
3257
|
+
return;
|
|
3258
|
+
}
|
|
3259
|
+
var i = e % this.DB, a = this.DB - i, o = (1 << i) - 1;
|
|
3260
|
+
n[0] = this[r] >> i;
|
|
3261
|
+
for (var s = r + 1; s < this.t; ++s) n[s - r - 1] |= (this[s] & o) << a, n[s - r] = this[s] >> i;
|
|
3262
|
+
i > 0 && (n[this.t - r - 1] |= (this.s & o) << a), n.t = this.t - r, n.clamp();
|
|
3263
|
+
}, e.prototype.subTo = function(e, n) {
|
|
3264
|
+
for (var r = 0, i = 0, a = Math.min(e.t, this.t); r < a;) i += this[r] - e[r], n[r++] = i & this.DM, i >>= this.DB;
|
|
3265
|
+
if (e.t < this.t) {
|
|
3266
|
+
for (i -= e.s; r < this.t;) i += this[r], n[r++] = i & this.DM, i >>= this.DB;
|
|
3267
|
+
i += this.s;
|
|
3268
|
+
} else {
|
|
3269
|
+
for (i += this.s; r < e.t;) i -= e[r], n[r++] = i & this.DM, i >>= this.DB;
|
|
3270
|
+
i -= e.s;
|
|
3271
|
+
}
|
|
3272
|
+
n.s = i < 0 ? -1 : 0, i < -1 ? n[r++] = this.DV + i : i > 0 && (n[r++] = i), n.t = r, n.clamp();
|
|
3273
|
+
}, e.prototype.multiplyTo = function(n, r) {
|
|
3274
|
+
var i = this.abs(), a = n.abs(), o = i.t;
|
|
3275
|
+
for (r.t = o + a.t; --o >= 0;) r[o] = 0;
|
|
3276
|
+
for (o = 0; o < a.t; ++o) r[o + i.t] = i.am(0, a[o], r, o, 0, i.t);
|
|
3277
|
+
r.s = 0, r.clamp(), this.s != n.s && e.ZERO.subTo(r, r);
|
|
3278
|
+
}, e.prototype.squareTo = function(e) {
|
|
3279
|
+
for (var n = this.abs(), r = e.t = 2 * n.t; --r >= 0;) e[r] = 0;
|
|
3280
|
+
for (r = 0; r < n.t - 1; ++r) {
|
|
3281
|
+
var i = n.am(r, n[r], e, 2 * r, 0, 1);
|
|
3282
|
+
(e[r + n.t] += n.am(r + 1, 2 * n[r], e, 2 * r + 1, i, n.t - r - 1)) >= n.DV && (e[r + n.t] -= n.DV, e[r + n.t + 1] = 1);
|
|
3283
|
+
}
|
|
3284
|
+
e.t > 0 && (e[e.t - 1] += n.am(r, n[r], e, 2 * r, 0, 1)), e.s = 0, e.clamp();
|
|
3285
|
+
}, e.prototype.divRemTo = function(n, r, i) {
|
|
3286
|
+
var a = n.abs();
|
|
3287
|
+
if (!(a.t <= 0)) {
|
|
3288
|
+
var o = this.abs();
|
|
3289
|
+
if (o.t < a.t) {
|
|
3290
|
+
r?.fromInt(0), i != null && this.copyTo(i);
|
|
3291
|
+
return;
|
|
3292
|
+
}
|
|
3293
|
+
i ??= nbi();
|
|
3294
|
+
var s = nbi(), c = this.s, l = n.s, u = this.DB - nbits(a[a.t - 1]);
|
|
3295
|
+
u > 0 ? (a.lShiftTo(u, s), o.lShiftTo(u, i)) : (a.copyTo(s), o.copyTo(i));
|
|
3296
|
+
var d = s.t, f = s[d - 1];
|
|
3297
|
+
if (f != 0) {
|
|
3298
|
+
var p = f * (1 << this.F1) + (d > 1 ? s[d - 2] >> this.F2 : 0), m = this.FV / p, h = (1 << this.F1) / p, g = 1 << this.F2, _ = i.t, v = _ - d, y = r ?? nbi();
|
|
3299
|
+
for (s.dlShiftTo(v, y), i.compareTo(y) >= 0 && (i[i.t++] = 1, i.subTo(y, i)), e.ONE.dlShiftTo(d, y), y.subTo(s, s); s.t < d;) s[s.t++] = 0;
|
|
3300
|
+
for (; --v >= 0;) {
|
|
3301
|
+
var b = i[--_] == f ? this.DM : Math.floor(i[_] * m + (i[_ - 1] + g) * h);
|
|
3302
|
+
if ((i[_] += s.am(0, b, i, v, 0, d)) < b) for (s.dlShiftTo(v, y), i.subTo(y, i); i[_] < --b;) i.subTo(y, i);
|
|
3303
|
+
}
|
|
3304
|
+
r != null && (i.drShiftTo(d, r), c != l && e.ZERO.subTo(r, r)), i.t = d, i.clamp(), u > 0 && i.rShiftTo(u, i), c < 0 && e.ZERO.subTo(i, i);
|
|
3305
|
+
}
|
|
3306
|
+
}
|
|
3307
|
+
}, e.prototype.invDigit = function() {
|
|
3308
|
+
if (this.t < 1) return 0;
|
|
3309
|
+
var e = this[0];
|
|
3310
|
+
if (!(e & 1)) return 0;
|
|
3311
|
+
var n = e & 3;
|
|
3312
|
+
return n = n * (2 - (e & 15) * n) & 15, n = n * (2 - (e & 255) * n) & 255, n = n * (2 - ((e & 65535) * n & 65535)) & 65535, n = n * (2 - e * n % this.DV) % this.DV, n > 0 ? this.DV - n : -n;
|
|
3313
|
+
}, e.prototype.isEven = function() {
|
|
3314
|
+
return (this.t > 0 ? this[0] & 1 : this.s) == 0;
|
|
3315
|
+
}, e.prototype.exp = function(n, r) {
|
|
3316
|
+
if (n > 4294967295 || n < 1) return e.ONE;
|
|
3317
|
+
var i = nbi(), a = nbi(), o = r.convert(this), s = nbits(n) - 1;
|
|
3318
|
+
for (o.copyTo(i); --s >= 0;) if (r.sqrTo(i, a), (n & 1 << s) > 0) r.mulTo(a, o, i);
|
|
3319
|
+
else {
|
|
3320
|
+
var c = i;
|
|
3321
|
+
i = a, a = c;
|
|
3322
|
+
}
|
|
3323
|
+
return r.revert(i);
|
|
3324
|
+
}, e.prototype.chunkSize = function(e) {
|
|
3325
|
+
return Math.floor(Math.LN2 * this.DB / Math.log(e));
|
|
3326
|
+
}, e.prototype.toRadix = function(e) {
|
|
3327
|
+
if (e ??= 10, this.signum() == 0 || e < 2 || e > 36) return "0";
|
|
3328
|
+
var n = this.chunkSize(e), r = e ** +n, i = nbv(r), a = nbi(), o = nbi(), s = "";
|
|
3329
|
+
for (this.divRemTo(i, a, o); a.signum() > 0;) s = (r + o.intValue()).toString(e).substring(1) + s, a.divRemTo(i, a, o);
|
|
3330
|
+
return o.intValue().toString(e) + s;
|
|
3331
|
+
}, e.prototype.fromRadix = function(n, r) {
|
|
3332
|
+
this.fromInt(0), r ??= 10;
|
|
3333
|
+
for (var i = this.chunkSize(r), a = r ** +i, o = !1, s = 0, c = 0, l = 0; l < n.length; ++l) {
|
|
3334
|
+
var u = intAt(n, l);
|
|
3335
|
+
if (u < 0) {
|
|
3336
|
+
n.charAt(l) == "-" && this.signum() == 0 && (o = !0);
|
|
3337
|
+
continue;
|
|
3338
|
+
}
|
|
3339
|
+
c = r * c + u, ++s >= i && (this.dMultiply(a), this.dAddOffset(c, 0), s = 0, c = 0);
|
|
3340
|
+
}
|
|
3341
|
+
s > 0 && (this.dMultiply(r ** +s), this.dAddOffset(c, 0)), o && e.ZERO.subTo(this, this);
|
|
3342
|
+
}, e.prototype.fromNumber = function(n, r, i) {
|
|
3343
|
+
if (typeof r == "number") if (n < 2) this.fromInt(1);
|
|
3344
|
+
else for (this.fromNumber(n, i), this.testBit(n - 1) || this.bitwiseTo(e.ONE.shiftLeft(n - 1), op_or, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(r);) this.dAddOffset(2, 0), this.bitLength() > n && this.subTo(e.ONE.shiftLeft(n - 1), this);
|
|
3345
|
+
else {
|
|
3346
|
+
var a = [], o = n & 7;
|
|
3347
|
+
a.length = (n >> 3) + 1, r.nextBytes(a), o > 0 ? a[0] &= (1 << o) - 1 : a[0] = 0, this.fromString(a, 256);
|
|
3348
|
+
}
|
|
3349
|
+
}, e.prototype.bitwiseTo = function(e, n, r) {
|
|
3350
|
+
var i, a, o = Math.min(e.t, this.t);
|
|
3351
|
+
for (i = 0; i < o; ++i) r[i] = n(this[i], e[i]);
|
|
3352
|
+
if (e.t < this.t) {
|
|
3353
|
+
for (a = e.s & this.DM, i = o; i < this.t; ++i) r[i] = n(this[i], a);
|
|
3354
|
+
r.t = this.t;
|
|
3355
|
+
} else {
|
|
3356
|
+
for (a = this.s & this.DM, i = o; i < e.t; ++i) r[i] = n(a, e[i]);
|
|
3357
|
+
r.t = e.t;
|
|
3358
|
+
}
|
|
3359
|
+
r.s = n(this.s, e.s), r.clamp();
|
|
3360
|
+
}, e.prototype.changeBit = function(n, r) {
|
|
3361
|
+
var i = e.ONE.shiftLeft(n);
|
|
3362
|
+
return this.bitwiseTo(i, r, i), i;
|
|
3363
|
+
}, e.prototype.addTo = function(e, n) {
|
|
3364
|
+
for (var r = 0, i = 0, a = Math.min(e.t, this.t); r < a;) i += this[r] + e[r], n[r++] = i & this.DM, i >>= this.DB;
|
|
3365
|
+
if (e.t < this.t) {
|
|
3366
|
+
for (i += e.s; r < this.t;) i += this[r], n[r++] = i & this.DM, i >>= this.DB;
|
|
3367
|
+
i += this.s;
|
|
3368
|
+
} else {
|
|
3369
|
+
for (i += this.s; r < e.t;) i += e[r], n[r++] = i & this.DM, i >>= this.DB;
|
|
3370
|
+
i += e.s;
|
|
3371
|
+
}
|
|
3372
|
+
n.s = i < 0 ? -1 : 0, i > 0 ? n[r++] = i : i < -1 && (n[r++] = this.DV + i), n.t = r, n.clamp();
|
|
3373
|
+
}, e.prototype.dMultiply = function(e) {
|
|
3374
|
+
this[this.t] = this.am(0, e - 1, this, 0, 0, this.t), ++this.t, this.clamp();
|
|
3375
|
+
}, e.prototype.dAddOffset = function(e, n) {
|
|
3376
|
+
if (e != 0) {
|
|
3377
|
+
for (; this.t <= n;) this[this.t++] = 0;
|
|
3378
|
+
for (this[n] += e; this[n] >= this.DV;) this[n] -= this.DV, ++n >= this.t && (this[this.t++] = 0), ++this[n];
|
|
3379
|
+
}
|
|
3380
|
+
}, e.prototype.multiplyLowerTo = function(e, n, r) {
|
|
3381
|
+
var i = Math.min(this.t + e.t, n);
|
|
3382
|
+
for (r.s = 0, r.t = i; i > 0;) r[--i] = 0;
|
|
3383
|
+
for (var a = r.t - this.t; i < a; ++i) r[i + this.t] = this.am(0, e[i], r, i, 0, this.t);
|
|
3384
|
+
for (var a = Math.min(e.t, n); i < a; ++i) this.am(0, e[i], r, i, 0, n - i);
|
|
3385
|
+
r.clamp();
|
|
3386
|
+
}, e.prototype.multiplyUpperTo = function(e, n, r) {
|
|
3387
|
+
--n;
|
|
3388
|
+
var i = r.t = this.t + e.t - n;
|
|
3389
|
+
for (r.s = 0; --i >= 0;) r[i] = 0;
|
|
3390
|
+
for (i = Math.max(n - this.t, 0); i < e.t; ++i) r[this.t + i - n] = this.am(n - i, e[i], r, 0, 0, this.t + i - n);
|
|
3391
|
+
r.clamp(), r.drShiftTo(1, r);
|
|
3392
|
+
}, e.prototype.modInt = function(e) {
|
|
3393
|
+
if (e <= 0) return 0;
|
|
3394
|
+
var n = this.DV % e, r = this.s < 0 ? e - 1 : 0;
|
|
3395
|
+
if (this.t > 0) if (n == 0) r = this[0] % e;
|
|
3396
|
+
else for (var i = this.t - 1; i >= 0; --i) r = (n * r + this[i]) % e;
|
|
3397
|
+
return r;
|
|
3398
|
+
}, e.prototype.millerRabin = function(n) {
|
|
3399
|
+
var r = this.subtract(e.ONE), i = r.getLowestSetBit();
|
|
3400
|
+
if (i <= 0) return !1;
|
|
3401
|
+
var a = r.shiftRight(i);
|
|
3402
|
+
n = n + 1 >> 1, n > lowprimes.length && (n = lowprimes.length);
|
|
3403
|
+
for (var o = nbi(), s = 0; s < n; ++s) {
|
|
3404
|
+
o.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]);
|
|
3405
|
+
var c = o.modPow(a, this);
|
|
3406
|
+
if (c.compareTo(e.ONE) != 0 && c.compareTo(r) != 0) {
|
|
3407
|
+
for (var l = 1; l++ < i && c.compareTo(r) != 0;) if (c = c.modPowInt(2, this), c.compareTo(e.ONE) == 0) return !1;
|
|
3408
|
+
if (c.compareTo(r) != 0) return !1;
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
return !0;
|
|
3412
|
+
}, e.prototype.square = function() {
|
|
3413
|
+
var e = nbi();
|
|
3414
|
+
return this.squareTo(e), e;
|
|
3415
|
+
}, e.prototype.gcda = function(e, n) {
|
|
3416
|
+
var r = this.s < 0 ? this.negate() : this.clone(), i = e.s < 0 ? e.negate() : e.clone();
|
|
3417
|
+
if (r.compareTo(i) < 0) {
|
|
3418
|
+
var a = r;
|
|
3419
|
+
r = i, i = a;
|
|
3420
|
+
}
|
|
3421
|
+
var o = r.getLowestSetBit(), s = i.getLowestSetBit();
|
|
3422
|
+
if (s < 0) {
|
|
3423
|
+
n(r);
|
|
3424
|
+
return;
|
|
3425
|
+
}
|
|
3426
|
+
o < s && (s = o), s > 0 && (r.rShiftTo(s, r), i.rShiftTo(s, i));
|
|
3427
|
+
var c = function() {
|
|
3428
|
+
(o = r.getLowestSetBit()) > 0 && r.rShiftTo(o, r), (o = i.getLowestSetBit()) > 0 && i.rShiftTo(o, i), r.compareTo(i) >= 0 ? (r.subTo(i, r), r.rShiftTo(1, r)) : (i.subTo(r, i), i.rShiftTo(1, i)), r.signum() > 0 ? setTimeout(c, 0) : (s > 0 && i.lShiftTo(s, i), setTimeout(function() {
|
|
3429
|
+
n(i);
|
|
3430
|
+
}, 0));
|
|
3431
|
+
};
|
|
3432
|
+
setTimeout(c, 10);
|
|
3433
|
+
}, e.prototype.fromNumberAsync = function(n, r, i, a) {
|
|
3434
|
+
if (typeof r == "number") if (n < 2) this.fromInt(1);
|
|
3435
|
+
else {
|
|
3436
|
+
this.fromNumber(n, i), this.testBit(n - 1) || this.bitwiseTo(e.ONE.shiftLeft(n - 1), op_or, this), this.isEven() && this.dAddOffset(1, 0);
|
|
3437
|
+
var o = this, s = function() {
|
|
3438
|
+
o.dAddOffset(2, 0), o.bitLength() > n && o.subTo(e.ONE.shiftLeft(n - 1), o), o.isProbablePrime(r) ? setTimeout(function() {
|
|
3439
|
+
a();
|
|
3440
|
+
}, 0) : setTimeout(s, 0);
|
|
3441
|
+
};
|
|
3442
|
+
setTimeout(s, 0);
|
|
3443
|
+
}
|
|
3444
|
+
else {
|
|
3445
|
+
var c = [], l = n & 7;
|
|
3446
|
+
c.length = (n >> 3) + 1, r.nextBytes(c), l > 0 ? c[0] &= (1 << l) - 1 : c[0] = 0, this.fromString(c, 256);
|
|
3447
|
+
}
|
|
3448
|
+
}, e;
|
|
3449
|
+
}(), NullExp = function() {
|
|
3450
|
+
function e() {}
|
|
3451
|
+
return e.prototype.convert = function(e) {
|
|
3452
|
+
return e;
|
|
3453
|
+
}, e.prototype.revert = function(e) {
|
|
3454
|
+
return e;
|
|
3455
|
+
}, e.prototype.mulTo = function(e, n, r) {
|
|
3456
|
+
e.multiplyTo(n, r);
|
|
3457
|
+
}, e.prototype.sqrTo = function(e, n) {
|
|
3458
|
+
e.squareTo(n);
|
|
3459
|
+
}, e;
|
|
3460
|
+
}(), Classic = function() {
|
|
3461
|
+
function e(e) {
|
|
3462
|
+
this.m = e;
|
|
3463
|
+
}
|
|
3464
|
+
return e.prototype.convert = function(e) {
|
|
3465
|
+
return e.s < 0 || e.compareTo(this.m) >= 0 ? e.mod(this.m) : e;
|
|
3466
|
+
}, e.prototype.revert = function(e) {
|
|
3467
|
+
return e;
|
|
3468
|
+
}, e.prototype.reduce = function(e) {
|
|
3469
|
+
e.divRemTo(this.m, null, e);
|
|
3470
|
+
}, e.prototype.mulTo = function(e, n, r) {
|
|
3471
|
+
e.multiplyTo(n, r), this.reduce(r);
|
|
3472
|
+
}, e.prototype.sqrTo = function(e, n) {
|
|
3473
|
+
e.squareTo(n), this.reduce(n);
|
|
3474
|
+
}, e;
|
|
3475
|
+
}(), Montgomery = function() {
|
|
3476
|
+
function e(e) {
|
|
3477
|
+
this.m = e, this.mp = e.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << e.DB - 15) - 1, this.mt2 = 2 * e.t;
|
|
3478
|
+
}
|
|
3479
|
+
return e.prototype.convert = function(e) {
|
|
3480
|
+
var n = nbi();
|
|
3481
|
+
return e.abs().dlShiftTo(this.m.t, n), n.divRemTo(this.m, null, n), e.s < 0 && n.compareTo(BigInteger.ZERO) > 0 && this.m.subTo(n, n), n;
|
|
3482
|
+
}, e.prototype.revert = function(e) {
|
|
3483
|
+
var n = nbi();
|
|
3484
|
+
return e.copyTo(n), this.reduce(n), n;
|
|
3485
|
+
}, e.prototype.reduce = function(e) {
|
|
3486
|
+
for (; e.t <= this.mt2;) e[e.t++] = 0;
|
|
3487
|
+
for (var n = 0; n < this.m.t; ++n) {
|
|
3488
|
+
var r = e[n] & 32767, i = r * this.mpl + ((r * this.mph + (e[n] >> 15) * this.mpl & this.um) << 15) & e.DM;
|
|
3489
|
+
for (r = n + this.m.t, e[r] += this.m.am(0, i, e, n, 0, this.m.t); e[r] >= e.DV;) e[r] -= e.DV, e[++r]++;
|
|
3490
|
+
}
|
|
3491
|
+
e.clamp(), e.drShiftTo(this.m.t, e), e.compareTo(this.m) >= 0 && e.subTo(this.m, e);
|
|
3492
|
+
}, e.prototype.mulTo = function(e, n, r) {
|
|
3493
|
+
e.multiplyTo(n, r), this.reduce(r);
|
|
3494
|
+
}, e.prototype.sqrTo = function(e, n) {
|
|
3495
|
+
e.squareTo(n), this.reduce(n);
|
|
3496
|
+
}, e;
|
|
3497
|
+
}(), Barrett = function() {
|
|
3498
|
+
function e(e) {
|
|
3499
|
+
this.m = e, this.r2 = nbi(), this.q3 = nbi(), BigInteger.ONE.dlShiftTo(2 * e.t, this.r2), this.mu = this.r2.divide(e);
|
|
3500
|
+
}
|
|
3501
|
+
return e.prototype.convert = function(e) {
|
|
3502
|
+
if (e.s < 0 || e.t > 2 * this.m.t) return e.mod(this.m);
|
|
3503
|
+
if (e.compareTo(this.m) < 0) return e;
|
|
3504
|
+
var n = nbi();
|
|
3505
|
+
return e.copyTo(n), this.reduce(n), n;
|
|
3506
|
+
}, e.prototype.revert = function(e) {
|
|
3507
|
+
return e;
|
|
3508
|
+
}, e.prototype.reduce = function(e) {
|
|
3509
|
+
for (e.drShiftTo(this.m.t - 1, this.r2), e.t > this.m.t + 1 && (e.t = this.m.t + 1, e.clamp()), this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3), this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); e.compareTo(this.r2) < 0;) e.dAddOffset(1, this.m.t + 1);
|
|
3510
|
+
for (e.subTo(this.r2, e); e.compareTo(this.m) >= 0;) e.subTo(this.m, e);
|
|
3511
|
+
}, e.prototype.mulTo = function(e, n, r) {
|
|
3512
|
+
e.multiplyTo(n, r), this.reduce(r);
|
|
3513
|
+
}, e.prototype.sqrTo = function(e, n) {
|
|
3514
|
+
e.squareTo(n), this.reduce(n);
|
|
3515
|
+
}, e;
|
|
3516
|
+
}();
|
|
3517
|
+
function nbi() {
|
|
3518
|
+
return new BigInteger(null);
|
|
3519
|
+
}
|
|
3520
|
+
function parseBigInt(e, n) {
|
|
3521
|
+
return new BigInteger(e, n);
|
|
3522
|
+
}
|
|
3523
|
+
var inBrowser = typeof navigator < "u";
|
|
3524
|
+
inBrowser && j_lm && navigator.appName == "Microsoft Internet Explorer" ? (BigInteger.prototype.am = function(e, n, r, i, a, o) {
|
|
3525
|
+
for (var s = n & 32767, c = n >> 15; --o >= 0;) {
|
|
3526
|
+
var l = this[e] & 32767, u = this[e++] >> 15, d = c * l + u * s;
|
|
3527
|
+
l = s * l + ((d & 32767) << 15) + r[i] + (a & 1073741823), a = (l >>> 30) + (d >>> 15) + c * u + (a >>> 30), r[i++] = l & 1073741823;
|
|
3528
|
+
}
|
|
3529
|
+
return a;
|
|
3530
|
+
}, dbits = 30) : inBrowser && j_lm && navigator.appName != "Netscape" ? (BigInteger.prototype.am = function(e, n, r, i, a, o) {
|
|
3531
|
+
for (; --o >= 0;) {
|
|
3532
|
+
var s = n * this[e++] + r[i] + a;
|
|
3533
|
+
a = Math.floor(s / 67108864), r[i++] = s & 67108863;
|
|
3534
|
+
}
|
|
3535
|
+
return a;
|
|
3536
|
+
}, dbits = 26) : (BigInteger.prototype.am = function(e, n, r, i, a, o) {
|
|
3537
|
+
for (var s = n & 16383, c = n >> 14; --o >= 0;) {
|
|
3538
|
+
var l = this[e] & 16383, u = this[e++] >> 14, d = c * l + u * s;
|
|
3539
|
+
l = s * l + ((d & 16383) << 14) + r[i] + a, a = (l >> 28) + (d >> 14) + c * u, r[i++] = l & 268435455;
|
|
3540
|
+
}
|
|
3541
|
+
return a;
|
|
3542
|
+
}, dbits = 28), BigInteger.prototype.DB = dbits, BigInteger.prototype.DM = (1 << dbits) - 1, BigInteger.prototype.DV = 1 << dbits;
|
|
3543
|
+
var BI_FP = 52;
|
|
3544
|
+
BigInteger.prototype.FV = 2 ** BI_FP, BigInteger.prototype.F1 = BI_FP - dbits, BigInteger.prototype.F2 = 2 * dbits - BI_FP;
|
|
3545
|
+
var BI_RC = [], rr = 48, vv;
|
|
3546
|
+
for (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
|
|
3547
|
+
for (rr = 97, vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
|
|
3548
|
+
for (rr = 65, vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
|
|
3549
|
+
function intAt(e, n) {
|
|
3550
|
+
return BI_RC[e.charCodeAt(n)] ?? -1;
|
|
3551
|
+
}
|
|
3552
|
+
function nbv(e) {
|
|
3553
|
+
var n = nbi();
|
|
3554
|
+
return n.fromInt(e), n;
|
|
3555
|
+
}
|
|
3556
|
+
function nbits(e) {
|
|
3557
|
+
var n = 1, r;
|
|
3558
|
+
return (r = e >>> 16) != 0 && (e = r, n += 16), (r = e >> 8) != 0 && (e = r, n += 8), (r = e >> 4) != 0 && (e = r, n += 4), (r = e >> 2) != 0 && (e = r, n += 2), (r = e >> 1) != 0 && (e = r, n += 1), n;
|
|
3559
|
+
}
|
|
3560
|
+
BigInteger.ZERO = nbv(0), BigInteger.ONE = nbv(1);
|
|
3561
|
+
var Arcfour = function() {
|
|
3562
|
+
function e() {
|
|
3563
|
+
this.i = 0, this.j = 0, this.S = [];
|
|
3564
|
+
}
|
|
3565
|
+
return e.prototype.init = function(e) {
|
|
3566
|
+
var n, r, i;
|
|
3567
|
+
for (n = 0; n < 256; ++n) this.S[n] = n;
|
|
3568
|
+
for (r = 0, n = 0; n < 256; ++n) r = r + this.S[n] + e[n % e.length] & 255, i = this.S[n], this.S[n] = this.S[r], this.S[r] = i;
|
|
3569
|
+
this.i = 0, this.j = 0;
|
|
3570
|
+
}, e.prototype.next = function() {
|
|
3571
|
+
var e;
|
|
3572
|
+
return this.i = this.i + 1 & 255, this.j = this.j + this.S[this.i] & 255, e = this.S[this.i], this.S[this.i] = this.S[this.j], this.S[this.j] = e, this.S[e + this.S[this.i] & 255];
|
|
3573
|
+
}, e;
|
|
3574
|
+
}();
|
|
3575
|
+
function prng_newstate() {
|
|
3576
|
+
return new Arcfour();
|
|
3577
|
+
}
|
|
3578
|
+
var rng_state, rng_pool = null, rng_pptr;
|
|
3579
|
+
if (rng_pool == null) {
|
|
3580
|
+
rng_pool = [], rng_pptr = 0;
|
|
3581
|
+
var t = void 0;
|
|
3582
|
+
if (typeof window < "u" && self.crypto && self.crypto.getRandomValues) {
|
|
3583
|
+
var z = new Uint32Array(256);
|
|
3584
|
+
for (self.crypto.getRandomValues(z), t = 0; t < z.length; ++t) rng_pool[rng_pptr++] = z[t] & 255;
|
|
3585
|
+
}
|
|
3586
|
+
var count = 0, onMouseMoveListener_1 = function(e) {
|
|
3587
|
+
if (count ||= 0, count >= 256 || rng_pptr >= 256) {
|
|
3588
|
+
self.removeEventListener ? self.removeEventListener("mousemove", onMouseMoveListener_1, !1) : self.detachEvent && self.detachEvent("onmousemove", onMouseMoveListener_1);
|
|
3589
|
+
return;
|
|
3590
|
+
}
|
|
3591
|
+
try {
|
|
3592
|
+
var n = e.x + e.y;
|
|
3593
|
+
rng_pool[rng_pptr++] = n & 255, count += 1;
|
|
3594
|
+
} catch {}
|
|
3595
|
+
};
|
|
3596
|
+
typeof window < "u" && (self.addEventListener ? self.addEventListener("mousemove", onMouseMoveListener_1, !1) : self.attachEvent && self.attachEvent("onmousemove", onMouseMoveListener_1));
|
|
3597
|
+
}
|
|
3598
|
+
function rng_get_byte() {
|
|
3599
|
+
if (rng_state == null) {
|
|
3600
|
+
for (rng_state = prng_newstate(); rng_pptr < 256;) {
|
|
3601
|
+
var e = Math.floor(65536 * Math.random());
|
|
3602
|
+
rng_pool[rng_pptr++] = e & 255;
|
|
3603
|
+
}
|
|
3604
|
+
for (rng_state.init(rng_pool), rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) rng_pool[rng_pptr] = 0;
|
|
3605
|
+
rng_pptr = 0;
|
|
3606
|
+
}
|
|
3607
|
+
return rng_state.next();
|
|
3608
|
+
}
|
|
3609
|
+
var SecureRandom = function() {
|
|
3610
|
+
function e() {}
|
|
3611
|
+
return e.prototype.nextBytes = function(e) {
|
|
3612
|
+
for (var n = 0; n < e.length; ++n) e[n] = rng_get_byte();
|
|
3613
|
+
}, e;
|
|
3614
|
+
}();
|
|
3615
|
+
function rstr_sha256(e) {
|
|
3616
|
+
return binb2rstr(binb_sha256(rstr2binb(e), e.length * 8));
|
|
3617
|
+
}
|
|
3618
|
+
function rstr2hex(e) {
|
|
3619
|
+
for (var n = "0123456789abcdef", r = "", i = 0; i < e.length; i++) {
|
|
3620
|
+
var a = e.charCodeAt(i);
|
|
3621
|
+
r += n.charAt(a >>> 4 & 15) + n.charAt(a & 15);
|
|
3622
|
+
}
|
|
3623
|
+
return r;
|
|
3624
|
+
}
|
|
3625
|
+
function rstr2binb(e) {
|
|
3626
|
+
for (var n = Array(e.length >> 2), r = 0; r < n.length; r++) n[r] = 0;
|
|
3627
|
+
for (var r = 0; r < e.length * 8; r += 8) n[r >> 5] |= (e.charCodeAt(r / 8) & 255) << 24 - r % 32;
|
|
3628
|
+
return n;
|
|
3629
|
+
}
|
|
3630
|
+
function binb2rstr(e) {
|
|
3631
|
+
for (var n = "", r = 0; r < e.length * 32; r += 8) n += String.fromCharCode(e[r >> 5] >>> 24 - r % 32 & 255);
|
|
3632
|
+
return n;
|
|
3633
|
+
}
|
|
3634
|
+
function sha256_S(e, n) {
|
|
3635
|
+
return e >>> n | e << 32 - n;
|
|
3636
|
+
}
|
|
3637
|
+
function sha256_R(e, n) {
|
|
3638
|
+
return e >>> n;
|
|
3639
|
+
}
|
|
3640
|
+
function sha256_Ch(e, n, r) {
|
|
3641
|
+
return e & n ^ ~e & r;
|
|
3642
|
+
}
|
|
3643
|
+
function sha256_Maj(e, n, r) {
|
|
3644
|
+
return e & n ^ e & r ^ n & r;
|
|
3645
|
+
}
|
|
3646
|
+
function sha256_Sigma0256(e) {
|
|
3647
|
+
return sha256_S(e, 2) ^ sha256_S(e, 13) ^ sha256_S(e, 22);
|
|
3648
|
+
}
|
|
3649
|
+
function sha256_Sigma1256(e) {
|
|
3650
|
+
return sha256_S(e, 6) ^ sha256_S(e, 11) ^ sha256_S(e, 25);
|
|
3651
|
+
}
|
|
3652
|
+
function sha256_Gamma0256(e) {
|
|
3653
|
+
return sha256_S(e, 7) ^ sha256_S(e, 18) ^ sha256_R(e, 3);
|
|
3654
|
+
}
|
|
3655
|
+
function sha256_Gamma1256(e) {
|
|
3656
|
+
return sha256_S(e, 17) ^ sha256_S(e, 19) ^ sha256_R(e, 10);
|
|
3657
|
+
}
|
|
3658
|
+
var sha256_K = [
|
|
3659
|
+
1116352408,
|
|
3660
|
+
1899447441,
|
|
3661
|
+
-1245643825,
|
|
3662
|
+
-373957723,
|
|
3663
|
+
961987163,
|
|
3664
|
+
1508970993,
|
|
3665
|
+
-1841331548,
|
|
3666
|
+
-1424204075,
|
|
3667
|
+
-670586216,
|
|
3668
|
+
310598401,
|
|
3669
|
+
607225278,
|
|
3670
|
+
1426881987,
|
|
3671
|
+
1925078388,
|
|
3672
|
+
-2132889090,
|
|
3673
|
+
-1680079193,
|
|
3674
|
+
-1046744716,
|
|
3675
|
+
-459576895,
|
|
3676
|
+
-272742522,
|
|
3677
|
+
264347078,
|
|
3678
|
+
604807628,
|
|
3679
|
+
770255983,
|
|
3680
|
+
1249150122,
|
|
3681
|
+
1555081692,
|
|
3682
|
+
1996064986,
|
|
3683
|
+
-1740746414,
|
|
3684
|
+
-1473132947,
|
|
3685
|
+
-1341970488,
|
|
3686
|
+
-1084653625,
|
|
3687
|
+
-958395405,
|
|
3688
|
+
-710438585,
|
|
3689
|
+
113926993,
|
|
3690
|
+
338241895,
|
|
3691
|
+
666307205,
|
|
3692
|
+
773529912,
|
|
3693
|
+
1294757372,
|
|
3694
|
+
1396182291,
|
|
3695
|
+
1695183700,
|
|
3696
|
+
1986661051,
|
|
3697
|
+
-2117940946,
|
|
3698
|
+
-1838011259,
|
|
3699
|
+
-1564481375,
|
|
3700
|
+
-1474664885,
|
|
3701
|
+
-1035236496,
|
|
3702
|
+
-949202525,
|
|
3703
|
+
-778901479,
|
|
3704
|
+
-694614492,
|
|
3705
|
+
-200395387,
|
|
3706
|
+
275423344,
|
|
3707
|
+
430227734,
|
|
3708
|
+
506948616,
|
|
3709
|
+
659060556,
|
|
3710
|
+
883997877,
|
|
3711
|
+
958139571,
|
|
3712
|
+
1322822218,
|
|
3713
|
+
1537002063,
|
|
3714
|
+
1747873779,
|
|
3715
|
+
1955562222,
|
|
3716
|
+
2024104815,
|
|
3717
|
+
-2067236844,
|
|
3718
|
+
-1933114872,
|
|
3719
|
+
-1866530822,
|
|
3720
|
+
-1538233109,
|
|
3721
|
+
-1090935817,
|
|
3722
|
+
-965641998
|
|
3723
|
+
];
|
|
3724
|
+
function binb_sha256(e, n) {
|
|
3725
|
+
var r = [
|
|
3726
|
+
1779033703,
|
|
3727
|
+
-1150833019,
|
|
3728
|
+
1013904242,
|
|
3729
|
+
-1521486534,
|
|
3730
|
+
1359893119,
|
|
3731
|
+
-1694144372,
|
|
3732
|
+
528734635,
|
|
3733
|
+
1541459225
|
|
3734
|
+
], i = Array(64), a, o, s, c, l, u, d, f, p, m, h, g;
|
|
3735
|
+
for (e[n >> 5] |= 128 << 24 - n % 32, e[(n + 64 >> 9 << 4) + 15] = n, p = 0; p < e.length; p += 16) {
|
|
3736
|
+
for (a = r[0], o = r[1], s = r[2], c = r[3], l = r[4], u = r[5], d = r[6], f = r[7], m = 0; m < 64; m++) m < 16 ? i[m] = e[m + p] : i[m] = safe_add(safe_add(safe_add(sha256_Gamma1256(i[m - 2]), i[m - 7]), sha256_Gamma0256(i[m - 15])), i[m - 16]), h = safe_add(safe_add(safe_add(safe_add(f, sha256_Sigma1256(l)), sha256_Ch(l, u, d)), sha256_K[m]), i[m]), g = safe_add(sha256_Sigma0256(a), sha256_Maj(a, o, s)), f = d, d = u, u = l, l = safe_add(c, h), c = s, s = o, o = a, a = safe_add(h, g);
|
|
3737
|
+
r[0] = safe_add(a, r[0]), r[1] = safe_add(o, r[1]), r[2] = safe_add(s, r[2]), r[3] = safe_add(c, r[3]), r[4] = safe_add(l, r[4]), r[5] = safe_add(u, r[5]), r[6] = safe_add(d, r[6]), r[7] = safe_add(f, r[7]);
|
|
3738
|
+
}
|
|
3739
|
+
return r;
|
|
3740
|
+
}
|
|
3741
|
+
function safe_add(e, n) {
|
|
3742
|
+
var r = (e & 65535) + (n & 65535);
|
|
3743
|
+
return (e >> 16) + (n >> 16) + (r >> 16) << 16 | r & 65535;
|
|
3744
|
+
}
|
|
3745
|
+
function pkcs1pad1(e, n) {
|
|
3746
|
+
if (n < e.length + 22) return console.error("Message too long for RSA"), null;
|
|
3747
|
+
for (var r = n - e.length - 6, i = "", a = 0; a < r; a += 2) i += "ff";
|
|
3748
|
+
return parseBigInt("0001" + i + "00" + e, 16);
|
|
3749
|
+
}
|
|
3750
|
+
function pkcs1pad2(e, n) {
|
|
3751
|
+
if (n < e.length + 11) return console.error("Message too long for RSA"), null;
|
|
3752
|
+
for (var r = [], i = e.length - 1; i >= 0 && n > 0;) {
|
|
3753
|
+
var a = e.charCodeAt(i--);
|
|
3754
|
+
a < 128 ? r[--n] = a : a > 127 && a < 2048 ? (r[--n] = a & 63 | 128, r[--n] = a >> 6 | 192) : (r[--n] = a & 63 | 128, r[--n] = a >> 6 & 63 | 128, r[--n] = a >> 12 | 224);
|
|
3755
|
+
}
|
|
3756
|
+
r[--n] = 0;
|
|
3757
|
+
for (var o = new SecureRandom(), s = []; n > 2;) {
|
|
3758
|
+
for (s[0] = 0; s[0] == 0;) o.nextBytes(s);
|
|
3759
|
+
r[--n] = s[0];
|
|
3760
|
+
}
|
|
3761
|
+
return r[--n] = 2, r[--n] = 0, new BigInteger(r);
|
|
3762
|
+
}
|
|
3763
|
+
function oaep_mgf1_arr(e, n, r) {
|
|
3764
|
+
for (var i = "", a = 0; i.length < n;) i += r(String.fromCharCode.apply(String, e.concat([
|
|
3765
|
+
(a & 4278190080) >> 24,
|
|
3766
|
+
(a & 16711680) >> 16,
|
|
3767
|
+
(a & 65280) >> 8,
|
|
3768
|
+
a & 255
|
|
3769
|
+
]))), a += 1;
|
|
3770
|
+
return i;
|
|
3771
|
+
}
|
|
3772
|
+
var SHA256_SIZE = 32;
|
|
3773
|
+
function oaep_pad(e, n) {
|
|
3774
|
+
var r = SHA256_SIZE, i = rstr_sha256;
|
|
3775
|
+
if (e.length + 2 * r + 2 > n) throw "Message too long for RSA";
|
|
3776
|
+
var a = "", o;
|
|
3777
|
+
for (o = 0; o < n - e.length - 2 * r - 2; o += 1) a += "\0";
|
|
3778
|
+
var s = i("") + a + "" + e, c = Array(r);
|
|
3779
|
+
new SecureRandom().nextBytes(c);
|
|
3780
|
+
var l = oaep_mgf1_arr(c, s.length, i), u = [];
|
|
3781
|
+
for (o = 0; o < s.length; o += 1) u[o] = s.charCodeAt(o) ^ l.charCodeAt(o);
|
|
3782
|
+
var d = oaep_mgf1_arr(u, c.length, i), f = [0];
|
|
3783
|
+
for (o = 0; o < c.length; o += 1) f[o + 1] = c[o] ^ d.charCodeAt(o);
|
|
3784
|
+
return new BigInteger(f.concat(u));
|
|
3785
|
+
}
|
|
3786
|
+
var RSAKey = function() {
|
|
3787
|
+
function e() {
|
|
3788
|
+
this.n = null, this.e = 0, this.d = null, this.p = null, this.q = null, this.dmp1 = null, this.dmq1 = null, this.coeff = null;
|
|
3789
|
+
}
|
|
3790
|
+
return e.prototype.doPublic = function(e) {
|
|
3791
|
+
return e.modPowInt(this.e, this.n);
|
|
3792
|
+
}, e.prototype.doPrivate = function(e) {
|
|
3793
|
+
if (this.p == null || this.q == null) return e.modPow(this.d, this.n);
|
|
3794
|
+
for (var n = e.mod(this.p).modPow(this.dmp1, this.p), r = e.mod(this.q).modPow(this.dmq1, this.q); n.compareTo(r) < 0;) n = n.add(this.p);
|
|
3795
|
+
return n.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r);
|
|
3796
|
+
}, e.prototype.setPublic = function(e, n) {
|
|
3797
|
+
e != null && n != null && e.length > 0 && n.length > 0 ? (this.n = parseBigInt(e, 16), this.e = parseInt(n, 16)) : console.error("Invalid RSA public key");
|
|
3798
|
+
}, e.prototype.encrypt = function(e, n) {
|
|
3799
|
+
n === void 0 && (n = pkcs1pad2);
|
|
3800
|
+
var r = this.n.bitLength() + 7 >> 3, i = n(e, r);
|
|
3801
|
+
if (i == null) return null;
|
|
3802
|
+
var a = this.doPublic(i);
|
|
3803
|
+
if (a == null) return null;
|
|
3804
|
+
for (var o = a.toString(16), s = o.length, c = 0; c < r * 2 - s; c++) o = "0" + o;
|
|
3805
|
+
return o;
|
|
3806
|
+
}, e.prototype.setPrivate = function(e, n, r) {
|
|
3807
|
+
e != null && n != null && e.length > 0 && n.length > 0 ? (this.n = parseBigInt(e, 16), this.e = parseInt(n, 16), this.d = parseBigInt(r, 16)) : console.error("Invalid RSA private key");
|
|
3808
|
+
}, e.prototype.setPrivateEx = function(e, n, r, i, a, o, s, c) {
|
|
3809
|
+
e != null && n != null && e.length > 0 && n.length > 0 ? (this.n = parseBigInt(e, 16), this.e = parseInt(n, 16), this.d = parseBigInt(r, 16), this.p = parseBigInt(i, 16), this.q = parseBigInt(a, 16), this.dmp1 = parseBigInt(o, 16), this.dmq1 = parseBigInt(s, 16), this.coeff = parseBigInt(c, 16)) : console.error("Invalid RSA private key");
|
|
3810
|
+
}, e.prototype.generate = function(e, n) {
|
|
3811
|
+
var r = new SecureRandom(), i = e >> 1;
|
|
3812
|
+
this.e = parseInt(n, 16);
|
|
3813
|
+
for (var a = new BigInteger(n, 16);;) {
|
|
3814
|
+
for (; this.p = new BigInteger(e - i, 1, r), !(this.p.subtract(BigInteger.ONE).gcd(a).compareTo(BigInteger.ONE) == 0 && this.p.isProbablePrime(10)););
|
|
3815
|
+
for (; this.q = new BigInteger(i, 1, r), !(this.q.subtract(BigInteger.ONE).gcd(a).compareTo(BigInteger.ONE) == 0 && this.q.isProbablePrime(10)););
|
|
3816
|
+
if (this.p.compareTo(this.q) <= 0) {
|
|
3817
|
+
var o = this.p;
|
|
3818
|
+
this.p = this.q, this.q = o;
|
|
3819
|
+
}
|
|
3820
|
+
var s = this.p.subtract(BigInteger.ONE), c = this.q.subtract(BigInteger.ONE), l = s.multiply(c);
|
|
3821
|
+
if (l.gcd(a).compareTo(BigInteger.ONE) == 0) {
|
|
3822
|
+
this.n = this.p.multiply(this.q), this.d = a.modInverse(l), this.dmp1 = this.d.mod(s), this.dmq1 = this.d.mod(c), this.coeff = this.q.modInverse(this.p);
|
|
3823
|
+
break;
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
}, e.prototype.decrypt = function(e) {
|
|
3827
|
+
var n = parseBigInt(e, 16), r = this.doPrivate(n);
|
|
3828
|
+
return r == null ? null : pkcs1unpad2(r, this.n.bitLength() + 7 >> 3);
|
|
3829
|
+
}, e.prototype.generateAsync = function(e, n, r) {
|
|
3830
|
+
var i = new SecureRandom(), a = e >> 1;
|
|
3831
|
+
this.e = parseInt(n, 16);
|
|
3832
|
+
var o = new BigInteger(n, 16), s = this, c = function() {
|
|
3833
|
+
var n = function() {
|
|
3834
|
+
if (s.p.compareTo(s.q) <= 0) {
|
|
3835
|
+
var e = s.p;
|
|
3836
|
+
s.p = s.q, s.q = e;
|
|
3837
|
+
}
|
|
3838
|
+
var n = s.p.subtract(BigInteger.ONE), i = s.q.subtract(BigInteger.ONE), a = n.multiply(i);
|
|
3839
|
+
a.gcd(o).compareTo(BigInteger.ONE) == 0 ? (s.n = s.p.multiply(s.q), s.d = o.modInverse(a), s.dmp1 = s.d.mod(n), s.dmq1 = s.d.mod(i), s.coeff = s.q.modInverse(s.p), setTimeout(function() {
|
|
3840
|
+
r();
|
|
3841
|
+
}, 0)) : setTimeout(c, 0);
|
|
3842
|
+
}, l = function() {
|
|
3843
|
+
s.q = nbi(), s.q.fromNumberAsync(a, 1, i, function() {
|
|
3844
|
+
s.q.subtract(BigInteger.ONE).gcda(o, function(e) {
|
|
3845
|
+
e.compareTo(BigInteger.ONE) == 0 && s.q.isProbablePrime(10) ? setTimeout(n, 0) : setTimeout(l, 0);
|
|
3846
|
+
});
|
|
3847
|
+
});
|
|
3848
|
+
}, u = function() {
|
|
3849
|
+
s.p = nbi(), s.p.fromNumberAsync(e - a, 1, i, function() {
|
|
3850
|
+
s.p.subtract(BigInteger.ONE).gcda(o, function(e) {
|
|
3851
|
+
e.compareTo(BigInteger.ONE) == 0 && s.p.isProbablePrime(10) ? setTimeout(l, 0) : setTimeout(u, 0);
|
|
3852
|
+
});
|
|
3853
|
+
});
|
|
3854
|
+
};
|
|
3855
|
+
setTimeout(u, 0);
|
|
3856
|
+
};
|
|
3857
|
+
setTimeout(c, 0);
|
|
3858
|
+
}, e.prototype.sign = function(e, n, r) {
|
|
3859
|
+
var i = getDigestHeader(r) + n(e).toString(), a = this.n.bitLength() / 4, o = pkcs1pad1(i, a);
|
|
3860
|
+
if (o == null) return null;
|
|
3861
|
+
var s = this.doPrivate(o);
|
|
3862
|
+
if (s == null) return null;
|
|
3863
|
+
for (var c = s.toString(16), l = c.length, u = 0; u < a - l; u++) c = "0" + c;
|
|
3864
|
+
return c;
|
|
3865
|
+
}, e.prototype.verify = function(e, n, r) {
|
|
3866
|
+
var i = parseBigInt(n, 16), a = this.doPublic(i);
|
|
3867
|
+
return a == null ? null : removeDigestHeader(a.toString(16).replace(/^1f+00/, "")) == r(e).toString();
|
|
3868
|
+
}, e;
|
|
3869
|
+
}();
|
|
3870
|
+
function pkcs1unpad2(e, n) {
|
|
3871
|
+
for (var r = e.toByteArray(), i = 0; i < r.length && r[i] == 0;) ++i;
|
|
3872
|
+
if (r.length - i != n - 1 || r[i] != 2) return null;
|
|
3873
|
+
for (++i; r[i] != 0;) if (++i >= r.length) return null;
|
|
3874
|
+
for (var a = ""; ++i < r.length;) {
|
|
3875
|
+
var o = r[i] & 255;
|
|
3876
|
+
o < 128 ? a += String.fromCharCode(o) : o > 191 && o < 224 ? (a += String.fromCharCode((o & 31) << 6 | r[i + 1] & 63), ++i) : (a += String.fromCharCode((o & 15) << 12 | (r[i + 1] & 63) << 6 | r[i + 2] & 63), i += 2);
|
|
3877
|
+
}
|
|
3878
|
+
return a;
|
|
3879
|
+
}
|
|
3880
|
+
var DIGEST_HEADERS = {
|
|
3881
|
+
md2: "3020300c06082a864886f70d020205000410",
|
|
3882
|
+
md5: "3020300c06082a864886f70d020505000410",
|
|
3883
|
+
sha1: "3021300906052b0e03021a05000414",
|
|
3884
|
+
sha224: "302d300d06096086480165030402040500041c",
|
|
3885
|
+
sha256: "3031300d060960864801650304020105000420",
|
|
3886
|
+
sha384: "3041300d060960864801650304020205000430",
|
|
3887
|
+
sha512: "3051300d060960864801650304020305000440",
|
|
3888
|
+
ripemd160: "3021300906052b2403020105000414"
|
|
3889
|
+
};
|
|
3890
|
+
function getDigestHeader(e) {
|
|
3891
|
+
return DIGEST_HEADERS[e] || "";
|
|
3892
|
+
}
|
|
3893
|
+
function removeDigestHeader(e) {
|
|
3894
|
+
for (var n in DIGEST_HEADERS) if (DIGEST_HEADERS.hasOwnProperty(n)) {
|
|
3895
|
+
var r = DIGEST_HEADERS[n], i = r.length;
|
|
3896
|
+
if (e.substring(0, i) == r) return e.substring(i);
|
|
3897
|
+
}
|
|
3898
|
+
return e;
|
|
3899
|
+
}
|
|
3900
|
+
function extendClass(e, n, r) {
|
|
3901
|
+
if (!n || !e) throw Error("extend failed, please check that all dependencies are included.");
|
|
3902
|
+
var i = function() {};
|
|
3903
|
+
if (i.prototype = n.prototype, e.prototype = new i(), e.prototype.constructor = e, e.superclass = n.prototype, n.prototype.constructor == Object.prototype.constructor && (n.prototype.constructor = n), r) {
|
|
3904
|
+
for (var a in r) e.prototype[a] = r[a];
|
|
3905
|
+
var o = function() {}, s = ["toString", "valueOf"];
|
|
3906
|
+
try {
|
|
3907
|
+
/MSIE/.test(navigator.userAgent) && (o = function(e, n) {
|
|
3908
|
+
for (a = 0; a < s.length; a += 1) {
|
|
3909
|
+
var r = s[a], i = n[r];
|
|
3910
|
+
typeof i == "function" && i != Object.prototype[r] && (e[r] = i);
|
|
3911
|
+
}
|
|
3912
|
+
});
|
|
3913
|
+
} catch {}
|
|
3914
|
+
o(e.prototype, r);
|
|
3915
|
+
}
|
|
3916
|
+
}
|
|
3917
|
+
/**
|
|
3918
|
+
* @fileOverview
|
|
3919
|
+
* @name asn1-1.0.js
|
|
3920
|
+
* @author Kenji Urushima kenji.urushima@gmail.com
|
|
3921
|
+
* @version asn1 1.0.13 (2017-Jun-02)
|
|
3922
|
+
* @since jsrsasign 2.1
|
|
3923
|
+
* @license <a href="https://kjur.github.io/jsrsasign/license/">MIT License</a>
|
|
3924
|
+
*/
|
|
3925
|
+
var KJUR = {};
|
|
3926
|
+
(KJUR.asn1 === void 0 || !KJUR.asn1) && (KJUR.asn1 = {}), KJUR.asn1.ASN1Util = new function() {
|
|
3927
|
+
this.integerToByteHex = function(e) {
|
|
3928
|
+
var n = e.toString(16);
|
|
3929
|
+
return n.length % 2 == 1 && (n = "0" + n), n;
|
|
3930
|
+
}, this.bigIntToMinTwosComplementsHex = function(e) {
|
|
3931
|
+
var n = e.toString(16);
|
|
3932
|
+
if (n.substring(0, 1) != "-") n.length % 2 == 1 ? n = "0" + n : n.match(/^[0-7]/) || (n = "00" + n);
|
|
3933
|
+
else {
|
|
3934
|
+
var r = n.substring(1).length;
|
|
3935
|
+
r % 2 == 1 ? r += 1 : n.match(/^[0-7]/) || (r += 2);
|
|
3936
|
+
for (var i = "", a = 0; a < r; a++) i += "f";
|
|
3937
|
+
n = new BigInteger(i, 16).xor(e).add(BigInteger.ONE).toString(16).replace(/^-/, "");
|
|
3938
|
+
}
|
|
3939
|
+
return n;
|
|
3940
|
+
}, this.getPEMStringFromHex = function(e, n) {
|
|
3941
|
+
return hextopem(e, n);
|
|
3942
|
+
}, this.newObject = function(e) {
|
|
3943
|
+
var n = KJUR.asn1, r = n.DERBoolean, i = n.DERInteger, a = n.DERBitString, o = n.DEROctetString, s = n.DERNull, c = n.DERObjectIdentifier, l = n.DEREnumerated, u = n.DERUTF8String, d = n.DERNumericString, f = n.DERPrintableString, p = n.DERTeletexString, m = n.DERIA5String, h = n.DERUTCTime, g = n.DERGeneralizedTime, _ = n.DERSequence, v = n.DERSet, y = n.DERTaggedObject, b = n.ASN1Util.newObject, x = Object.keys(e);
|
|
3944
|
+
if (x.length != 1) throw "key of param shall be only one.";
|
|
3945
|
+
var S = x[0];
|
|
3946
|
+
if (":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":" + S + ":") == -1) throw "undefined key: " + S;
|
|
3947
|
+
if (S == "bool") return new r(e[S]);
|
|
3948
|
+
if (S == "int") return new i(e[S]);
|
|
3949
|
+
if (S == "bitstr") return new a(e[S]);
|
|
3950
|
+
if (S == "octstr") return new o(e[S]);
|
|
3951
|
+
if (S == "null") return new s(e[S]);
|
|
3952
|
+
if (S == "oid") return new c(e[S]);
|
|
3953
|
+
if (S == "enum") return new l(e[S]);
|
|
3954
|
+
if (S == "utf8str") return new u(e[S]);
|
|
3955
|
+
if (S == "numstr") return new d(e[S]);
|
|
3956
|
+
if (S == "prnstr") return new f(e[S]);
|
|
3957
|
+
if (S == "telstr") return new p(e[S]);
|
|
3958
|
+
if (S == "ia5str") return new m(e[S]);
|
|
3959
|
+
if (S == "utctime") return new h(e[S]);
|
|
3960
|
+
if (S == "gentime") return new g(e[S]);
|
|
3961
|
+
if (S == "seq") {
|
|
3962
|
+
for (var C = e[S], w = [], T = 0; T < C.length; T++) {
|
|
3963
|
+
var E = b(C[T]);
|
|
3964
|
+
w.push(E);
|
|
3965
|
+
}
|
|
3966
|
+
return new _({ array: w });
|
|
3967
|
+
}
|
|
3968
|
+
if (S == "set") {
|
|
3969
|
+
for (var C = e[S], w = [], T = 0; T < C.length; T++) {
|
|
3970
|
+
var E = b(C[T]);
|
|
3971
|
+
w.push(E);
|
|
3972
|
+
}
|
|
3973
|
+
return new v({ array: w });
|
|
3974
|
+
}
|
|
3975
|
+
if (S == "tag") {
|
|
3976
|
+
var D = e[S];
|
|
3977
|
+
if (Object.prototype.toString.call(D) === "[object Array]" && D.length == 3) {
|
|
3978
|
+
var O = b(D[2]);
|
|
3979
|
+
return new y({
|
|
3980
|
+
tag: D[0],
|
|
3981
|
+
explicit: D[1],
|
|
3982
|
+
obj: O
|
|
3983
|
+
});
|
|
3984
|
+
} else {
|
|
3985
|
+
var k = {};
|
|
3986
|
+
if (D.explicit !== void 0 && (k.explicit = D.explicit), D.tag !== void 0 && (k.tag = D.tag), D.obj === void 0) throw "obj shall be specified for 'tag'.";
|
|
3987
|
+
return k.obj = b(D.obj), new y(k);
|
|
3988
|
+
}
|
|
3989
|
+
}
|
|
3990
|
+
}, this.jsonToASN1HEX = function(e) {
|
|
3991
|
+
return this.newObject(e).getEncodedHex();
|
|
3992
|
+
};
|
|
3993
|
+
}(), KJUR.asn1.ASN1Util.oidHexToInt = function(e) {
|
|
3994
|
+
for (var n = "", r = parseInt(e.substring(0, 2), 16), i = Math.floor(r / 40), a = r % 40, n = i + "." + a, o = "", s = 2; s < e.length; s += 2) {
|
|
3995
|
+
var c = ("00000000" + parseInt(e.substring(s, s + 2), 16).toString(2)).slice(-8);
|
|
3996
|
+
if (o += c.substring(1, 8), c.substring(0, 1) == "0") {
|
|
3997
|
+
var l = new BigInteger(o, 2);
|
|
3998
|
+
n = n + "." + l.toString(10), o = "";
|
|
3999
|
+
}
|
|
4000
|
+
}
|
|
4001
|
+
return n;
|
|
4002
|
+
}, KJUR.asn1.ASN1Util.oidIntToHex = function(e) {
|
|
4003
|
+
var n = function(e) {
|
|
4004
|
+
var n = e.toString(16);
|
|
4005
|
+
return n.length == 1 && (n = "0" + n), n;
|
|
4006
|
+
}, r = function(e) {
|
|
4007
|
+
var r = "", i = new BigInteger(e, 10).toString(2), a = 7 - i.length % 7;
|
|
4008
|
+
a == 7 && (a = 0);
|
|
4009
|
+
for (var o = "", s = 0; s < a; s++) o += "0";
|
|
4010
|
+
i = o + i;
|
|
4011
|
+
for (var s = 0; s < i.length - 1; s += 7) {
|
|
4012
|
+
var c = i.substring(s, s + 7);
|
|
4013
|
+
s != i.length - 7 && (c = "1" + c), r += n(parseInt(c, 2));
|
|
4014
|
+
}
|
|
4015
|
+
return r;
|
|
4016
|
+
};
|
|
4017
|
+
if (!e.match(/^[0-9.]+$/)) throw "malformed oid string: " + e;
|
|
4018
|
+
var i = "", a = e.split("."), o = parseInt(a[0]) * 40 + parseInt(a[1]);
|
|
4019
|
+
i += n(o), a.splice(0, 2);
|
|
4020
|
+
for (var s = 0; s < a.length; s++) i += r(a[s]);
|
|
4021
|
+
return i;
|
|
4022
|
+
}, KJUR.asn1.ASN1Object = function() {
|
|
4023
|
+
var e = "";
|
|
4024
|
+
this.getLengthHexFromValue = function() {
|
|
4025
|
+
if (this.hV === void 0 || this.hV == null) throw "this.hV is null or undefined.";
|
|
4026
|
+
if (this.hV.length % 2 == 1) throw "value hex must be even length: n=" + e.length + ",v=" + this.hV;
|
|
4027
|
+
var n = this.hV.length / 2, r = n.toString(16);
|
|
4028
|
+
if (r.length % 2 == 1 && (r = "0" + r), n < 128) return r;
|
|
4029
|
+
var i = r.length / 2;
|
|
4030
|
+
if (i > 15) throw "ASN.1 length too long to represent by 8x: n = " + n.toString(16);
|
|
4031
|
+
return (128 + i).toString(16) + r;
|
|
4032
|
+
}, this.getEncodedHex = function() {
|
|
4033
|
+
return (this.hTLV == null || this.isModified) && (this.hV = this.getFreshValueHex(), this.hL = this.getLengthHexFromValue(), this.hTLV = this.hT + this.hL + this.hV, this.isModified = !1), this.hTLV;
|
|
4034
|
+
}, this.getValueHex = function() {
|
|
4035
|
+
return this.getEncodedHex(), this.hV;
|
|
4036
|
+
}, this.getFreshValueHex = function() {
|
|
4037
|
+
return "";
|
|
4038
|
+
};
|
|
4039
|
+
}, KJUR.asn1.DERAbstractString = function(e) {
|
|
4040
|
+
KJUR.asn1.DERAbstractString.superclass.constructor.call(this), this.getString = function() {
|
|
4041
|
+
return this.s;
|
|
4042
|
+
}, this.setString = function(e) {
|
|
4043
|
+
this.hTLV = null, this.isModified = !0, this.s = e, this.hV = stohex(this.s);
|
|
4044
|
+
}, this.setStringHex = function(e) {
|
|
4045
|
+
this.hTLV = null, this.isModified = !0, this.s = null, this.hV = e;
|
|
4046
|
+
}, this.getFreshValueHex = function() {
|
|
4047
|
+
return this.hV;
|
|
4048
|
+
}, e !== void 0 && (typeof e == "string" ? this.setString(e) : e.str === void 0 ? e.hex !== void 0 && this.setStringHex(e.hex) : this.setString(e.str));
|
|
4049
|
+
}, extendClass(KJUR.asn1.DERAbstractString, KJUR.asn1.ASN1Object), KJUR.asn1.DERAbstractTime = function(e) {
|
|
4050
|
+
KJUR.asn1.DERAbstractTime.superclass.constructor.call(this), this.localDateToUTC = function(e) {
|
|
4051
|
+
return utc = e.getTime() + e.getTimezoneOffset() * 6e4, new Date(utc);
|
|
4052
|
+
}, this.formatDate = function(e, n, r) {
|
|
4053
|
+
var i = this.zeroPadding, a = this.localDateToUTC(e), o = String(a.getFullYear());
|
|
4054
|
+
n == "utc" && (o = o.substring(2, 4));
|
|
4055
|
+
var s = i(String(a.getMonth() + 1), 2), c = i(String(a.getDate()), 2), l = i(String(a.getHours()), 2), u = i(String(a.getMinutes()), 2), d = i(String(a.getSeconds()), 2), f = o + s + c + l + u + d;
|
|
4056
|
+
if (r === !0) {
|
|
4057
|
+
var p = a.getMilliseconds();
|
|
4058
|
+
if (p != 0) {
|
|
4059
|
+
var m = i(String(p), 3);
|
|
4060
|
+
m = m.replace(/[0]+$/, ""), f = f + "." + m;
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
return f + "Z";
|
|
4064
|
+
}, this.zeroPadding = function(e, n) {
|
|
4065
|
+
return e.length >= n ? e : Array(n - e.length + 1).join("0") + e;
|
|
4066
|
+
}, this.getString = function() {
|
|
4067
|
+
return this.s;
|
|
4068
|
+
}, this.setString = function(e) {
|
|
4069
|
+
this.hTLV = null, this.isModified = !0, this.s = e, this.hV = stohex(e);
|
|
4070
|
+
}, this.setByDateValue = function(e, n, r, i, a, o) {
|
|
4071
|
+
var s = new Date(Date.UTC(e, n - 1, r, i, a, o, 0));
|
|
4072
|
+
this.setByDate(s);
|
|
4073
|
+
}, this.getFreshValueHex = function() {
|
|
4074
|
+
return this.hV;
|
|
4075
|
+
};
|
|
4076
|
+
}, extendClass(KJUR.asn1.DERAbstractTime, KJUR.asn1.ASN1Object), KJUR.asn1.DERAbstractStructured = function(e) {
|
|
4077
|
+
KJUR.asn1.DERAbstractString.superclass.constructor.call(this), this.setByASN1ObjectArray = function(e) {
|
|
4078
|
+
this.hTLV = null, this.isModified = !0, this.asn1Array = e;
|
|
4079
|
+
}, this.appendASN1Object = function(e) {
|
|
4080
|
+
this.hTLV = null, this.isModified = !0, this.asn1Array.push(e);
|
|
4081
|
+
}, this.asn1Array = [], e !== void 0 && e.array !== void 0 && (this.asn1Array = e.array);
|
|
4082
|
+
}, extendClass(KJUR.asn1.DERAbstractStructured, KJUR.asn1.ASN1Object), KJUR.asn1.DERBoolean = function() {
|
|
4083
|
+
KJUR.asn1.DERBoolean.superclass.constructor.call(this), this.hT = "01", this.hTLV = "0101ff";
|
|
4084
|
+
}, extendClass(KJUR.asn1.DERBoolean, KJUR.asn1.ASN1Object), KJUR.asn1.DERInteger = function(e) {
|
|
4085
|
+
KJUR.asn1.DERInteger.superclass.constructor.call(this), this.hT = "02", this.setByBigInteger = function(e) {
|
|
4086
|
+
this.hTLV = null, this.isModified = !0, this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e);
|
|
4087
|
+
}, this.setByInteger = function(e) {
|
|
4088
|
+
var n = new BigInteger(String(e), 10);
|
|
4089
|
+
this.setByBigInteger(n);
|
|
4090
|
+
}, this.setValueHex = function(e) {
|
|
4091
|
+
this.hV = e;
|
|
4092
|
+
}, this.getFreshValueHex = function() {
|
|
4093
|
+
return this.hV;
|
|
4094
|
+
}, e !== void 0 && (e.bigint === void 0 ? e.int === void 0 ? typeof e == "number" ? this.setByInteger(e) : e.hex !== void 0 && this.setValueHex(e.hex) : this.setByInteger(e.int) : this.setByBigInteger(e.bigint));
|
|
4095
|
+
}, extendClass(KJUR.asn1.DERInteger, KJUR.asn1.ASN1Object), KJUR.asn1.DERBitString = function(e) {
|
|
4096
|
+
e !== void 0 && e.obj !== void 0 && (e.hex = "00" + KJUR.asn1.ASN1Util.newObject(e.obj).getEncodedHex()), KJUR.asn1.DERBitString.superclass.constructor.call(this), this.hT = "03", this.setHexValueIncludingUnusedBits = function(e) {
|
|
4097
|
+
this.hTLV = null, this.isModified = !0, this.hV = e;
|
|
4098
|
+
}, this.setUnusedBitsAndHexValue = function(e, n) {
|
|
4099
|
+
if (e < 0 || 7 < e) throw "unused bits shall be from 0 to 7: u = " + e;
|
|
4100
|
+
var r = "0" + e;
|
|
4101
|
+
this.hTLV = null, this.isModified = !0, this.hV = r + n;
|
|
4102
|
+
}, this.setByBinaryString = function(e) {
|
|
4103
|
+
e = e.replace(/0+$/, "");
|
|
4104
|
+
var n = 8 - e.length % 8;
|
|
4105
|
+
n == 8 && (n = 0);
|
|
4106
|
+
for (var r = 0; r <= n; r++) e += "0";
|
|
4107
|
+
for (var i = "", r = 0; r < e.length - 1; r += 8) {
|
|
4108
|
+
var a = e.substring(r, r + 8), o = parseInt(a, 2).toString(16);
|
|
4109
|
+
o.length == 1 && (o = "0" + o), i += o;
|
|
4110
|
+
}
|
|
4111
|
+
this.hTLV = null, this.isModified = !0, this.hV = "0" + n + i;
|
|
4112
|
+
}, this.setByBooleanArray = function(e) {
|
|
4113
|
+
for (var n = "", r = 0; r < e.length; r++) e[r] == 1 ? n += "1" : n += "0";
|
|
4114
|
+
this.setByBinaryString(n);
|
|
4115
|
+
}, this.newFalseArray = function(e) {
|
|
4116
|
+
for (var n = Array(e), r = 0; r < e; r++) n[r] = !1;
|
|
4117
|
+
return n;
|
|
4118
|
+
}, this.getFreshValueHex = function() {
|
|
4119
|
+
return this.hV;
|
|
4120
|
+
}, e !== void 0 && (typeof e == "string" && e.toLowerCase().match(/^[0-9a-f]+$/) ? this.setHexValueIncludingUnusedBits(e) : e.hex === void 0 ? e.bin === void 0 ? e.array !== void 0 && this.setByBooleanArray(e.array) : this.setByBinaryString(e.bin) : this.setHexValueIncludingUnusedBits(e.hex));
|
|
4121
|
+
}, extendClass(KJUR.asn1.DERBitString, KJUR.asn1.ASN1Object), KJUR.asn1.DEROctetString = function(e) {
|
|
4122
|
+
e !== void 0 && e.obj !== void 0 && (e.hex = KJUR.asn1.ASN1Util.newObject(e.obj).getEncodedHex()), KJUR.asn1.DEROctetString.superclass.constructor.call(this, e), this.hT = "04";
|
|
4123
|
+
}, extendClass(KJUR.asn1.DEROctetString, KJUR.asn1.DERAbstractString), KJUR.asn1.DERNull = function() {
|
|
4124
|
+
KJUR.asn1.DERNull.superclass.constructor.call(this), this.hT = "05", this.hTLV = "0500";
|
|
4125
|
+
}, extendClass(KJUR.asn1.DERNull, KJUR.asn1.ASN1Object), KJUR.asn1.DERObjectIdentifier = function(e) {
|
|
4126
|
+
var n = function(e) {
|
|
4127
|
+
var n = e.toString(16);
|
|
4128
|
+
return n.length == 1 && (n = "0" + n), n;
|
|
4129
|
+
}, r = function(e) {
|
|
4130
|
+
var r = "", i = new BigInteger(e, 10).toString(2), a = 7 - i.length % 7;
|
|
4131
|
+
a == 7 && (a = 0);
|
|
4132
|
+
for (var o = "", s = 0; s < a; s++) o += "0";
|
|
4133
|
+
i = o + i;
|
|
4134
|
+
for (var s = 0; s < i.length - 1; s += 7) {
|
|
4135
|
+
var c = i.substring(s, s + 7);
|
|
4136
|
+
s != i.length - 7 && (c = "1" + c), r += n(parseInt(c, 2));
|
|
4137
|
+
}
|
|
4138
|
+
return r;
|
|
4139
|
+
};
|
|
4140
|
+
KJUR.asn1.DERObjectIdentifier.superclass.constructor.call(this), this.hT = "06", this.setValueHex = function(e) {
|
|
4141
|
+
this.hTLV = null, this.isModified = !0, this.s = null, this.hV = e;
|
|
4142
|
+
}, this.setValueOidString = function(e) {
|
|
4143
|
+
if (!e.match(/^[0-9.]+$/)) throw "malformed oid string: " + e;
|
|
4144
|
+
var i = "", a = e.split("."), o = parseInt(a[0]) * 40 + parseInt(a[1]);
|
|
4145
|
+
i += n(o), a.splice(0, 2);
|
|
4146
|
+
for (var s = 0; s < a.length; s++) i += r(a[s]);
|
|
4147
|
+
this.hTLV = null, this.isModified = !0, this.s = null, this.hV = i;
|
|
4148
|
+
}, this.setValueName = function(e) {
|
|
4149
|
+
var n = KJUR.asn1.x509.OID.name2oid(e);
|
|
4150
|
+
if (n !== "") this.setValueOidString(n);
|
|
4151
|
+
else throw "DERObjectIdentifier oidName undefined: " + e;
|
|
4152
|
+
}, this.getFreshValueHex = function() {
|
|
4153
|
+
return this.hV;
|
|
4154
|
+
}, e !== void 0 && (typeof e == "string" ? e.match(/^[0-2].[0-9.]+$/) ? this.setValueOidString(e) : this.setValueName(e) : e.oid === void 0 ? e.hex === void 0 ? e.name !== void 0 && this.setValueName(e.name) : this.setValueHex(e.hex) : this.setValueOidString(e.oid));
|
|
4155
|
+
}, extendClass(KJUR.asn1.DERObjectIdentifier, KJUR.asn1.ASN1Object), KJUR.asn1.DEREnumerated = function(e) {
|
|
4156
|
+
KJUR.asn1.DEREnumerated.superclass.constructor.call(this), this.hT = "0a", this.setByBigInteger = function(e) {
|
|
4157
|
+
this.hTLV = null, this.isModified = !0, this.hV = KJUR.asn1.ASN1Util.bigIntToMinTwosComplementsHex(e);
|
|
4158
|
+
}, this.setByInteger = function(e) {
|
|
4159
|
+
var n = new BigInteger(String(e), 10);
|
|
4160
|
+
this.setByBigInteger(n);
|
|
4161
|
+
}, this.setValueHex = function(e) {
|
|
4162
|
+
this.hV = e;
|
|
4163
|
+
}, this.getFreshValueHex = function() {
|
|
4164
|
+
return this.hV;
|
|
4165
|
+
}, e !== void 0 && (e.int === void 0 ? typeof e == "number" ? this.setByInteger(e) : e.hex !== void 0 && this.setValueHex(e.hex) : this.setByInteger(e.int));
|
|
4166
|
+
}, extendClass(KJUR.asn1.DEREnumerated, KJUR.asn1.ASN1Object), KJUR.asn1.DERUTF8String = function(e) {
|
|
4167
|
+
KJUR.asn1.DERUTF8String.superclass.constructor.call(this, e), this.hT = "0c";
|
|
4168
|
+
}, extendClass(KJUR.asn1.DERUTF8String, KJUR.asn1.DERAbstractString), KJUR.asn1.DERNumericString = function(e) {
|
|
4169
|
+
KJUR.asn1.DERNumericString.superclass.constructor.call(this, e), this.hT = "12";
|
|
4170
|
+
}, extendClass(KJUR.asn1.DERNumericString, KJUR.asn1.DERAbstractString), KJUR.asn1.DERPrintableString = function(e) {
|
|
4171
|
+
KJUR.asn1.DERPrintableString.superclass.constructor.call(this, e), this.hT = "13";
|
|
4172
|
+
}, extendClass(KJUR.asn1.DERPrintableString, KJUR.asn1.DERAbstractString), KJUR.asn1.DERTeletexString = function(e) {
|
|
4173
|
+
KJUR.asn1.DERTeletexString.superclass.constructor.call(this, e), this.hT = "14";
|
|
4174
|
+
}, extendClass(KJUR.asn1.DERTeletexString, KJUR.asn1.DERAbstractString), KJUR.asn1.DERIA5String = function(e) {
|
|
4175
|
+
KJUR.asn1.DERIA5String.superclass.constructor.call(this, e), this.hT = "16";
|
|
4176
|
+
}, extendClass(KJUR.asn1.DERIA5String, KJUR.asn1.DERAbstractString), KJUR.asn1.DERUTCTime = function(e) {
|
|
4177
|
+
KJUR.asn1.DERUTCTime.superclass.constructor.call(this, e), this.hT = "17", this.setByDate = function(e) {
|
|
4178
|
+
this.hTLV = null, this.isModified = !0, this.date = e, this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s);
|
|
4179
|
+
}, this.getFreshValueHex = function() {
|
|
4180
|
+
return this.date === void 0 && this.s === void 0 && (this.date = /* @__PURE__ */ new Date(), this.s = this.formatDate(this.date, "utc"), this.hV = stohex(this.s)), this.hV;
|
|
4181
|
+
}, e !== void 0 && (e.str === void 0 ? typeof e == "string" && e.match(/^[0-9]{12}Z$/) ? this.setString(e) : e.hex === void 0 ? e.date !== void 0 && this.setByDate(e.date) : this.setStringHex(e.hex) : this.setString(e.str));
|
|
4182
|
+
}, extendClass(KJUR.asn1.DERUTCTime, KJUR.asn1.DERAbstractTime), KJUR.asn1.DERGeneralizedTime = function(e) {
|
|
4183
|
+
KJUR.asn1.DERGeneralizedTime.superclass.constructor.call(this, e), this.hT = "18", this.withMillis = !1, this.setByDate = function(e) {
|
|
4184
|
+
this.hTLV = null, this.isModified = !0, this.date = e, this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s);
|
|
4185
|
+
}, this.getFreshValueHex = function() {
|
|
4186
|
+
return this.date === void 0 && this.s === void 0 && (this.date = /* @__PURE__ */ new Date(), this.s = this.formatDate(this.date, "gen", this.withMillis), this.hV = stohex(this.s)), this.hV;
|
|
4187
|
+
}, e !== void 0 && (e.str === void 0 ? typeof e == "string" && e.match(/^[0-9]{14}Z$/) ? this.setString(e) : e.hex === void 0 ? e.date !== void 0 && this.setByDate(e.date) : this.setStringHex(e.hex) : this.setString(e.str), e.millis === !0 && (this.withMillis = !0));
|
|
4188
|
+
}, extendClass(KJUR.asn1.DERGeneralizedTime, KJUR.asn1.DERAbstractTime), KJUR.asn1.DERSequence = function(e) {
|
|
4189
|
+
KJUR.asn1.DERSequence.superclass.constructor.call(this, e), this.hT = "30", this.getFreshValueHex = function() {
|
|
4190
|
+
for (var e = "", n = 0; n < this.asn1Array.length; n++) {
|
|
4191
|
+
var r = this.asn1Array[n];
|
|
4192
|
+
e += r.getEncodedHex();
|
|
4193
|
+
}
|
|
4194
|
+
return this.hV = e, this.hV;
|
|
4195
|
+
};
|
|
4196
|
+
}, extendClass(KJUR.asn1.DERSequence, KJUR.asn1.DERAbstractStructured), KJUR.asn1.DERSet = function(e) {
|
|
4197
|
+
KJUR.asn1.DERSet.superclass.constructor.call(this, e), this.hT = "31", this.sortFlag = !0, this.getFreshValueHex = function() {
|
|
4198
|
+
for (var e = [], n = 0; n < this.asn1Array.length; n++) {
|
|
4199
|
+
var r = this.asn1Array[n];
|
|
4200
|
+
e.push(r.getEncodedHex());
|
|
4201
|
+
}
|
|
4202
|
+
return this.sortFlag == 1 && e.sort(), this.hV = e.join(""), this.hV;
|
|
4203
|
+
}, e !== void 0 && e.sortflag !== void 0 && e.sortflag == 0 && (this.sortFlag = !1);
|
|
4204
|
+
}, extendClass(KJUR.asn1.DERSet, KJUR.asn1.DERAbstractStructured), KJUR.asn1.DERTaggedObject = function(e) {
|
|
4205
|
+
KJUR.asn1.DERTaggedObject.superclass.constructor.call(this), this.hT = "a0", this.hV = "", this.isExplicit = !0, this.asn1Object = null, this.setASN1Object = function(e, n, r) {
|
|
4206
|
+
this.hT = n, this.isExplicit = e, this.asn1Object = r, this.isExplicit ? (this.hV = this.asn1Object.getEncodedHex(), this.hTLV = null, this.isModified = !0) : (this.hV = null, this.hTLV = r.getEncodedHex(), this.hTLV = this.hTLV.replace(/^../, n), this.isModified = !1);
|
|
4207
|
+
}, this.getFreshValueHex = function() {
|
|
4208
|
+
return this.hV;
|
|
4209
|
+
}, e !== void 0 && (e.tag !== void 0 && (this.hT = e.tag), e.explicit !== void 0 && (this.isExplicit = e.explicit), e.obj !== void 0 && (this.asn1Object = e.obj, this.setASN1Object(this.isExplicit, this.hT, this.asn1Object)));
|
|
4210
|
+
}, extendClass(KJUR.asn1.DERTaggedObject, KJUR.asn1.ASN1Object);
|
|
4211
|
+
var __extends = (function() {
|
|
4212
|
+
var e = function(n, r) {
|
|
4213
|
+
return e = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, n) {
|
|
4214
|
+
e.__proto__ = n;
|
|
4215
|
+
} || function(e, n) {
|
|
4216
|
+
for (var r in n) Object.prototype.hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
4217
|
+
}, e(n, r);
|
|
4218
|
+
};
|
|
4219
|
+
return function(n, r) {
|
|
4220
|
+
if (typeof r != "function" && r !== null) throw TypeError("Class extends value " + String(r) + " is not a constructor or null");
|
|
4221
|
+
e(n, r);
|
|
4222
|
+
function i() {
|
|
4223
|
+
this.constructor = n;
|
|
4224
|
+
}
|
|
4225
|
+
n.prototype = r === null ? Object.create(r) : (i.prototype = r.prototype, new i());
|
|
4226
|
+
};
|
|
4227
|
+
})(), JSEncryptRSAKey = function(e) {
|
|
4228
|
+
__extends(n, e);
|
|
4229
|
+
function n(r) {
|
|
4230
|
+
var i = e.call(this) || this;
|
|
4231
|
+
return r && (typeof r == "string" ? i.parseKey(r) : (n.hasPrivateKeyProperty(r) || n.hasPublicKeyProperty(r)) && i.parsePropertiesFrom(r)), i;
|
|
4232
|
+
}
|
|
4233
|
+
return n.prototype.parseKey = function(e) {
|
|
4234
|
+
try {
|
|
4235
|
+
var n = 0, r = 0, i = /^\s*(?:[0-9A-Fa-f][0-9A-Fa-f]\s*)+$/.test(e) ? Hex.decode(e) : Base64.unarmor(e), a = ASN1.decode(i);
|
|
4236
|
+
if (a.sub.length === 3 && (a = a.sub[2].sub[0]), a.sub.length === 9) n = a.sub[1].getHexStringValue(), this.n = parseBigInt(n, 16), r = a.sub[2].getHexStringValue(), this.e = parseInt(r, 16), this.d = parseBigInt(a.sub[3].getHexStringValue(), 16), this.p = parseBigInt(a.sub[4].getHexStringValue(), 16), this.q = parseBigInt(a.sub[5].getHexStringValue(), 16), this.dmp1 = parseBigInt(a.sub[6].getHexStringValue(), 16), this.dmq1 = parseBigInt(a.sub[7].getHexStringValue(), 16), this.coeff = parseBigInt(a.sub[8].getHexStringValue(), 16);
|
|
4237
|
+
else if (a.sub.length === 2) if (a.sub[0].sub) {
|
|
4238
|
+
var o = a.sub[1].sub[0];
|
|
4239
|
+
n = o.sub[0].getHexStringValue(), this.n = parseBigInt(n, 16), r = o.sub[1].getHexStringValue(), this.e = parseInt(r, 16);
|
|
4240
|
+
} else n = a.sub[0].getHexStringValue(), this.n = parseBigInt(n, 16), r = a.sub[1].getHexStringValue(), this.e = parseInt(r, 16);
|
|
4241
|
+
else return !1;
|
|
4242
|
+
return !0;
|
|
4243
|
+
} catch {
|
|
4244
|
+
return !1;
|
|
4245
|
+
}
|
|
4246
|
+
}, n.prototype.getPrivateBaseKey = function() {
|
|
4247
|
+
var e = { array: [
|
|
4248
|
+
new KJUR.asn1.DERInteger({ int: 0 }),
|
|
4249
|
+
new KJUR.asn1.DERInteger({ bigint: this.n }),
|
|
4250
|
+
new KJUR.asn1.DERInteger({ int: this.e }),
|
|
4251
|
+
new KJUR.asn1.DERInteger({ bigint: this.d }),
|
|
4252
|
+
new KJUR.asn1.DERInteger({ bigint: this.p }),
|
|
4253
|
+
new KJUR.asn1.DERInteger({ bigint: this.q }),
|
|
4254
|
+
new KJUR.asn1.DERInteger({ bigint: this.dmp1 }),
|
|
4255
|
+
new KJUR.asn1.DERInteger({ bigint: this.dmq1 }),
|
|
4256
|
+
new KJUR.asn1.DERInteger({ bigint: this.coeff })
|
|
4257
|
+
] };
|
|
4258
|
+
return new KJUR.asn1.DERSequence(e).getEncodedHex();
|
|
4259
|
+
}, n.prototype.getPrivateBaseKeyB64 = function() {
|
|
4260
|
+
return hex2b64(this.getPrivateBaseKey());
|
|
4261
|
+
}, n.prototype.getPublicBaseKey = function() {
|
|
4262
|
+
var e = new KJUR.asn1.DERSequence({ array: [new KJUR.asn1.DERObjectIdentifier({ oid: "1.2.840.113549.1.1.1" }), new KJUR.asn1.DERNull()] }), n = new KJUR.asn1.DERSequence({ array: [new KJUR.asn1.DERInteger({ bigint: this.n }), new KJUR.asn1.DERInteger({ int: this.e })] }), r = new KJUR.asn1.DERBitString({ hex: "00" + n.getEncodedHex() });
|
|
4263
|
+
return new KJUR.asn1.DERSequence({ array: [e, r] }).getEncodedHex();
|
|
4264
|
+
}, n.prototype.getPublicBaseKeyB64 = function() {
|
|
4265
|
+
return hex2b64(this.getPublicBaseKey());
|
|
4266
|
+
}, n.wordwrap = function(e, n) {
|
|
4267
|
+
if (n ||= 64, !e) return e;
|
|
4268
|
+
var r = "(.{1," + n + "})( +|$\n?)|(.{1," + n + "})";
|
|
4269
|
+
return e.match(RegExp(r, "g")).join("\n");
|
|
4270
|
+
}, n.prototype.getPrivateKey = function() {
|
|
4271
|
+
var e = "-----BEGIN RSA PRIVATE KEY-----\n";
|
|
4272
|
+
return e += n.wordwrap(this.getPrivateBaseKeyB64()) + "\n", e += "-----END RSA PRIVATE KEY-----", e;
|
|
4273
|
+
}, n.prototype.getPublicKey = function() {
|
|
4274
|
+
var e = "-----BEGIN PUBLIC KEY-----\n";
|
|
4275
|
+
return e += n.wordwrap(this.getPublicBaseKeyB64()) + "\n", e += "-----END PUBLIC KEY-----", e;
|
|
4276
|
+
}, n.hasPublicKeyProperty = function(e) {
|
|
4277
|
+
return e ||= {}, e.hasOwnProperty("n") && e.hasOwnProperty("e");
|
|
4278
|
+
}, n.hasPrivateKeyProperty = function(e) {
|
|
4279
|
+
return e ||= {}, e.hasOwnProperty("n") && e.hasOwnProperty("e") && e.hasOwnProperty("d") && e.hasOwnProperty("p") && e.hasOwnProperty("q") && e.hasOwnProperty("dmp1") && e.hasOwnProperty("dmq1") && e.hasOwnProperty("coeff");
|
|
4280
|
+
}, n.prototype.parsePropertiesFrom = function(e) {
|
|
4281
|
+
this.n = e.n, this.e = e.e, e.hasOwnProperty("d") && (this.d = e.d, this.p = e.p, this.q = e.q, this.dmp1 = e.dmp1, this.dmq1 = e.dmq1, this.coeff = e.coeff);
|
|
4282
|
+
}, n;
|
|
4283
|
+
}(RSAKey), version = typeof process < "u" ? process.env?.npm_package_version : void 0, lib_default = function() {
|
|
4284
|
+
function e(e) {
|
|
4285
|
+
e === void 0 && (e = {}), this.default_key_size = e.default_key_size ? parseInt(e.default_key_size, 10) : 1024, this.default_public_exponent = e.default_public_exponent || "010001", this.log = e.log || !1, this.key = e.key || null;
|
|
4286
|
+
}
|
|
4287
|
+
return e.prototype.setKey = function(e) {
|
|
4288
|
+
e ? (this.log && this.key && console.warn("A key was already set, overriding existing."), this.key = new JSEncryptRSAKey(e)) : !this.key && this.log && console.error("A key was not set.");
|
|
4289
|
+
}, e.prototype.setPrivateKey = function(e) {
|
|
4290
|
+
this.setKey(e);
|
|
4291
|
+
}, e.prototype.setPublicKey = function(e) {
|
|
4292
|
+
this.setKey(e);
|
|
4293
|
+
}, e.prototype.decrypt = function(e) {
|
|
4294
|
+
try {
|
|
4295
|
+
return this.getKey().decrypt(b64tohex(e));
|
|
4296
|
+
} catch {
|
|
4297
|
+
return !1;
|
|
4298
|
+
}
|
|
4299
|
+
}, e.prototype.encrypt = function(e) {
|
|
4300
|
+
try {
|
|
4301
|
+
return hex2b64(this.getKey().encrypt(e));
|
|
4302
|
+
} catch {
|
|
4303
|
+
return !1;
|
|
4304
|
+
}
|
|
4305
|
+
}, e.prototype.encryptOAEP = function(e) {
|
|
4306
|
+
try {
|
|
4307
|
+
return hex2b64(this.getKey().encrypt(e, oaep_pad));
|
|
4308
|
+
} catch {
|
|
4309
|
+
return !1;
|
|
4310
|
+
}
|
|
4311
|
+
}, e.prototype.sign = function(e, n, r) {
|
|
4312
|
+
n === void 0 && (n = function(e) {
|
|
4313
|
+
return e;
|
|
4314
|
+
}), r === void 0 && (r = "");
|
|
4315
|
+
try {
|
|
4316
|
+
return hex2b64(this.getKey().sign(e, n, r));
|
|
4317
|
+
} catch {
|
|
4318
|
+
return !1;
|
|
4319
|
+
}
|
|
4320
|
+
}, e.prototype.signSha256 = function(e) {
|
|
4321
|
+
return this.sign(e, function(e) {
|
|
4322
|
+
return rstr2hex(rstr_sha256(e));
|
|
4323
|
+
}, "sha256");
|
|
4324
|
+
}, e.prototype.verify = function(e, n, r) {
|
|
4325
|
+
r === void 0 && (r = function(e) {
|
|
4326
|
+
return e;
|
|
4327
|
+
});
|
|
4328
|
+
try {
|
|
4329
|
+
return this.getKey().verify(e, b64tohex(n), r);
|
|
4330
|
+
} catch {
|
|
4331
|
+
return !1;
|
|
4332
|
+
}
|
|
4333
|
+
}, e.prototype.verifySha256 = function(e, n) {
|
|
4334
|
+
return this.verify(e, n, function(e) {
|
|
4335
|
+
return rstr2hex(rstr_sha256(e));
|
|
4336
|
+
});
|
|
4337
|
+
}, e.prototype.getKey = function(e) {
|
|
4338
|
+
if (!this.key) {
|
|
4339
|
+
if (this.key = new JSEncryptRSAKey(), e && {}.toString.call(e) === "[object Function]") {
|
|
4340
|
+
this.key.generateAsync(this.default_key_size, this.default_public_exponent, e);
|
|
4341
|
+
return;
|
|
4342
|
+
}
|
|
4343
|
+
this.key.generate(this.default_key_size, this.default_public_exponent);
|
|
4344
|
+
}
|
|
4345
|
+
return this.key;
|
|
4346
|
+
}, e.prototype.getPrivateKey = function() {
|
|
4347
|
+
return this.getKey().getPrivateKey();
|
|
4348
|
+
}, e.prototype.getPrivateKeyB64 = function() {
|
|
4349
|
+
return this.getKey().getPrivateBaseKeyB64();
|
|
4350
|
+
}, e.prototype.getPublicKey = function() {
|
|
4351
|
+
return this.getKey().getPublicKey();
|
|
4352
|
+
}, e.prototype.getPublicKeyB64 = function() {
|
|
4353
|
+
return this.getKey().getPublicBaseKeyB64();
|
|
4354
|
+
}, e.version = version, e;
|
|
4355
|
+
}();
|
|
4356
|
+
function compilePublicKey(e) {
|
|
4357
|
+
return template("-----BEGIN PUBLIC KEY-----\n<%= publickKey %>\n-----END PUBLIC KEY-----")({ publickKey: e });
|
|
4358
|
+
}
|
|
4359
|
+
async function getPublicKey() {
|
|
4360
|
+
return compilePublicKey((await getAuthLoginKey()).data ?? "");
|
|
4361
|
+
}
|
|
4362
|
+
async function publicKeyEncryption(e) {
|
|
4363
|
+
let n = await getPublicKey(), r = new lib_default();
|
|
4364
|
+
return r.setPublicKey(n), r.encrypt(e);
|
|
4365
|
+
}
|
|
4366
|
+
function getStoragePrefix() {
|
|
4367
|
+
return getSettings()?.app?.storagePrefix;
|
|
4368
|
+
}
|
|
4369
|
+
const storage = {
|
|
4370
|
+
local: {
|
|
4371
|
+
has: (e) => Object.prototype.hasOwnProperty.call(localStorage, `${getStoragePrefix()}${e}`),
|
|
4372
|
+
get: (e) => localStorage.getItem(`${getStoragePrefix()}${e}`),
|
|
4373
|
+
set: (e, n) => {
|
|
4374
|
+
localStorage.setItem(`${getStoragePrefix()}${e}`, n);
|
|
4375
|
+
},
|
|
4376
|
+
remove: (e) => {
|
|
4377
|
+
localStorage.removeItem(`${getStoragePrefix()}${e}`);
|
|
4378
|
+
},
|
|
4379
|
+
clear: () => {
|
|
4380
|
+
localStorage.clear();
|
|
4381
|
+
},
|
|
4382
|
+
getItem: (e) => localStorage.getItem(`${getStoragePrefix()}${e}`),
|
|
4383
|
+
setItem: (e, n) => {
|
|
4384
|
+
localStorage.setItem(`${getStoragePrefix()}${e}`, n);
|
|
4385
|
+
}
|
|
4386
|
+
},
|
|
4387
|
+
session: {
|
|
4388
|
+
has: (e) => Object.prototype.hasOwnProperty.call(sessionStorage, `${getStoragePrefix()}${e}`),
|
|
4389
|
+
get: (e) => sessionStorage.getItem(`${getStoragePrefix()}${e}`),
|
|
4390
|
+
set: (e, n) => {
|
|
4391
|
+
sessionStorage.setItem(`${getStoragePrefix()}${e}`, n);
|
|
4392
|
+
},
|
|
4393
|
+
remove: (e) => {
|
|
4394
|
+
sessionStorage.removeItem(`${getStoragePrefix()}${e}`);
|
|
4395
|
+
},
|
|
4396
|
+
clear: () => {
|
|
4397
|
+
sessionStorage.clear();
|
|
4398
|
+
},
|
|
4399
|
+
getItem: (e) => sessionStorage.getItem(`${getStoragePrefix()}${e}`),
|
|
4400
|
+
setItem: (e, n) => {
|
|
4401
|
+
sessionStorage.setItem(`${getStoragePrefix()}${e}`, n);
|
|
4402
|
+
}
|
|
4403
|
+
}
|
|
4404
|
+
}, basic = wrapProxy(usePubinfoContext, "requestBasic"), auth = wrapProxy(usePubinfoContext, "requestAuth");
|
|
4405
|
+
function postAuthChangeLoginOrg(e, n) {
|
|
4406
|
+
return auth.Post("/auth/changeLoginOrg", {}, {
|
|
4407
|
+
params: { ...e },
|
|
4408
|
+
...n || {}
|
|
4409
|
+
});
|
|
4410
|
+
}
|
|
4411
|
+
function postAuthLogin(e, n) {
|
|
4412
|
+
return auth.Post("/auth/login", e, {
|
|
4413
|
+
headers: { "Content-Type": "application/json" },
|
|
4414
|
+
...n || {}
|
|
4415
|
+
});
|
|
4416
|
+
}
|
|
4417
|
+
function getAuthLoginKey(e) {
|
|
4418
|
+
return auth.Get("/auth/login/key", { ...e || {} });
|
|
4419
|
+
}
|
|
4420
|
+
function postAuthLoginNew(e, n) {
|
|
4421
|
+
return auth.Post("/auth/loginNew", e, {
|
|
4422
|
+
headers: { "Content-Type": "application/json" },
|
|
4423
|
+
...n || {}
|
|
4424
|
+
});
|
|
4425
|
+
}
|
|
4426
|
+
function postAuthTokenRefresh(e, n) {
|
|
4427
|
+
return auth.Post("/auth/token/refresh", {}, {
|
|
4428
|
+
params: { ...e },
|
|
4429
|
+
...n || {}
|
|
4430
|
+
});
|
|
4431
|
+
}
|
|
4432
|
+
export { useSuccess as A, createPubinfoContext as B, useKeepAliveStore as C, useError as D, useBox as E, findIndex as F, baseRest as I, toNumber as L, useAuth as M, useIframeStore as N, useInfo as O, isUndefined as P, useFavoritesStore as R, require_dist as S, usePartyLogin as T, getSystemRoutes as _, wrapProxy as a, RESOURCE_TYPE as b, cleanupWithoutUser as c, useUserStore as d, useTabbarStore as f, defineSystemRoutes as g, getSettings as h, publicKeyEncryption as i, useWarn as j, useStart as k, useMenuStore as l, defineSettings as m, basic as n, resolveRoutePath as o, useSettingsStore as p, storage as r, cleanup as s, postAuthTokenRefresh as t, useRouteStore as u, defineAsyncRoutes as v, useTheme as w, getRbacUserUserEntireInfo as x, getAsyncRoutes as y, STORE_NAME as z };
|