lone-format 0.1.2 → 0.1.3

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.
@@ -1,895 +1,32 @@
1
- import { defineComponent as De, useCssVars as Me, ref as ye, computed as fe, resolveComponent as qe, createElementBlock as Y, openBlock as K, createElementVNode as le, createCommentVNode as se, withDirectives as je, toDisplayString as he, withKeys as me, vModelText as Ce, createTextVNode as Ge, Fragment as ze, renderList as He, createVNode as Ue, normalizeClass as Xe, nextTick as Pe, watch as We } from "vue";
2
- function Ye(G) {
3
- return G && G.__esModule && Object.prototype.hasOwnProperty.call(G, "default") ? G.default : G;
4
- }
5
- var we = { exports: {} }, Ie = { exports: {} }, Ae = { exports: {} }, Ke = Ae.exports, Te;
6
- function Le() {
7
- return Te || (Te = 1, function(G) {
8
- (function(ee) {
9
- var N, ne = /^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i, O = Math.ceil, j = Math.floor, C = "[BigNumber Error] ", y = C + "Number primitive has more than 15 significant digits: ", T = 1e14, w = 14, J = 9007199254740991, A = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13], P = 1e7, $ = 1e9;
10
- function z(S) {
11
- var k, L, g, c = v.prototype = { constructor: v, toString: null, valueOf: null }, _ = new v(1), m = 20, p = 4, h = -7, U = 21, M = -1e7, H = 1e7, ie = !1, pe = 1, ge = 0, ke = {
12
- prefix: "",
13
- groupSize: 3,
14
- secondaryGroupSize: 0,
15
- groupSeparator: ",",
16
- decimalSeparator: ".",
17
- fractionGroupSize: 0,
18
- fractionGroupSeparator: " ",
19
- // non-breaking space
20
- suffix: ""
21
- }, ve = "0123456789abcdefghijklmnopqrstuvwxyz", Ee = !0;
22
- function v(e, t) {
23
- var n, u, i, s, f, r, o, a, l = this;
24
- if (!(l instanceof v)) return new v(e, t);
25
- if (t == null) {
26
- if (e && e._isBigNumber === !0) {
27
- l.s = e.s, !e.c || e.e > H ? l.c = l.e = null : e.e < M ? l.c = [l.e = 0] : (l.e = e.e, l.c = e.c.slice());
28
- return;
29
- }
30
- if ((r = typeof e == "number") && e * 0 == 0) {
31
- if (l.s = 1 / e < 0 ? (e = -e, -1) : 1, e === ~~e) {
32
- for (s = 0, f = e; f >= 10; f /= 10, s++) ;
33
- s > H ? l.c = l.e = null : (l.e = s, l.c = [e]);
34
- return;
35
- }
36
- a = String(e);
37
- } else {
38
- if (!ne.test(a = String(e))) return g(l, a, r);
39
- l.s = a.charCodeAt(0) == 45 ? (a = a.slice(1), -1) : 1;
40
- }
41
- (s = a.indexOf(".")) > -1 && (a = a.replace(".", "")), (f = a.search(/e/i)) > 0 ? (s < 0 && (s = f), s += +a.slice(f + 1), a = a.substring(0, f)) : s < 0 && (s = a.length);
42
- } else {
43
- if (x(t, 2, ve.length, "Base"), t == 10 && Ee)
44
- return l = new v(e), ue(l, m + l.e + 1, p);
45
- if (a = String(e), r = typeof e == "number") {
46
- if (e * 0 != 0) return g(l, a, r, t);
47
- if (l.s = 1 / e < 0 ? (a = a.slice(1), -1) : 1, v.DEBUG && a.replace(/^0\.0*|\./, "").length > 15)
48
- throw Error(y + e);
49
- } else
50
- l.s = a.charCodeAt(0) === 45 ? (a = a.slice(1), -1) : 1;
51
- for (n = ve.slice(0, t), s = f = 0, o = a.length; f < o; f++)
52
- if (n.indexOf(u = a.charAt(f)) < 0) {
53
- if (u == ".") {
54
- if (f > s) {
55
- s = o;
56
- continue;
57
- }
58
- } else if (!i && (a == a.toUpperCase() && (a = a.toLowerCase()) || a == a.toLowerCase() && (a = a.toUpperCase()))) {
59
- i = !0, f = -1, s = 0;
60
- continue;
61
- }
62
- return g(l, String(e), r, t);
63
- }
64
- r = !1, a = L(a, t, 10, l.s), (s = a.indexOf(".")) > -1 ? a = a.replace(".", "") : s = a.length;
65
- }
66
- for (f = 0; a.charCodeAt(f) === 48; f++) ;
67
- for (o = a.length; a.charCodeAt(--o) === 48; ) ;
68
- if (a = a.slice(f, ++o)) {
69
- if (o -= f, r && v.DEBUG && o > 15 && (e > J || e !== j(e)))
70
- throw Error(y + l.s * e);
71
- if ((s = s - f - 1) > H)
72
- l.c = l.e = null;
73
- else if (s < M)
74
- l.c = [l.e = 0];
75
- else {
76
- if (l.e = s, l.c = [], f = (s + 1) % w, s < 0 && (f += w), f < o) {
77
- for (f && l.c.push(+a.slice(0, f)), o -= w; f < o; )
78
- l.c.push(+a.slice(f, f += w));
79
- f = w - (a = a.slice(f)).length;
80
- } else
81
- f -= o;
82
- for (; f--; a += "0") ;
83
- l.c.push(+a);
84
- }
85
- } else
86
- l.c = [l.e = 0];
87
- }
88
- v.clone = z, v.ROUND_UP = 0, v.ROUND_DOWN = 1, v.ROUND_CEIL = 2, v.ROUND_FLOOR = 3, v.ROUND_HALF_UP = 4, v.ROUND_HALF_DOWN = 5, v.ROUND_HALF_EVEN = 6, v.ROUND_HALF_CEIL = 7, v.ROUND_HALF_FLOOR = 8, v.EUCLID = 9, v.config = v.set = function(e) {
89
- var t, n;
90
- if (e != null)
91
- if (typeof e == "object") {
92
- if (e.hasOwnProperty(t = "DECIMAL_PLACES") && (n = e[t], x(n, 0, $, t), m = n), e.hasOwnProperty(t = "ROUNDING_MODE") && (n = e[t], x(n, 0, 8, t), p = n), e.hasOwnProperty(t = "EXPONENTIAL_AT") && (n = e[t], n && n.pop ? (x(n[0], -$, 0, t), x(n[1], 0, $, t), h = n[0], U = n[1]) : (x(n, -$, $, t), h = -(U = n < 0 ? -n : n))), e.hasOwnProperty(t = "RANGE"))
93
- if (n = e[t], n && n.pop)
94
- x(n[0], -$, -1, t), x(n[1], 1, $, t), M = n[0], H = n[1];
95
- else if (x(n, -$, $, t), n)
96
- M = -(H = n < 0 ? -n : n);
97
- else
98
- throw Error(C + t + " cannot be zero: " + n);
99
- if (e.hasOwnProperty(t = "CRYPTO"))
100
- if (n = e[t], n === !!n)
101
- if (n)
102
- if (typeof crypto < "u" && crypto && (crypto.getRandomValues || crypto.randomBytes))
103
- ie = n;
104
- else
105
- throw ie = !n, Error(C + "crypto unavailable");
106
- else
107
- ie = n;
108
- else
109
- throw Error(C + t + " not true or false: " + n);
110
- if (e.hasOwnProperty(t = "MODULO_MODE") && (n = e[t], x(n, 0, 9, t), pe = n), e.hasOwnProperty(t = "POW_PRECISION") && (n = e[t], x(n, 0, $, t), ge = n), e.hasOwnProperty(t = "FORMAT"))
111
- if (n = e[t], typeof n == "object") ke = n;
112
- else throw Error(C + t + " not an object: " + n);
113
- if (e.hasOwnProperty(t = "ALPHABET"))
114
- if (n = e[t], typeof n == "string" && !/^.?$|[+\-.\s]|(.).*\1/.test(n))
115
- Ee = n.slice(0, 10) == "0123456789", ve = n;
116
- else
117
- throw Error(C + t + " invalid: " + n);
118
- } else
119
- throw Error(C + "Object expected: " + e);
120
- return {
121
- DECIMAL_PLACES: m,
122
- ROUNDING_MODE: p,
123
- EXPONENTIAL_AT: [h, U],
124
- RANGE: [M, H],
125
- CRYPTO: ie,
126
- MODULO_MODE: pe,
127
- POW_PRECISION: ge,
128
- FORMAT: ke,
129
- ALPHABET: ve
130
- };
131
- }, v.isBigNumber = function(e) {
132
- if (!e || e._isBigNumber !== !0) return !1;
133
- if (!v.DEBUG) return !0;
134
- var t, n, u = e.c, i = e.e, s = e.s;
135
- e: if ({}.toString.call(u) == "[object Array]") {
136
- if ((s === 1 || s === -1) && i >= -$ && i <= $ && i === j(i)) {
137
- if (u[0] === 0) {
138
- if (i === 0 && u.length === 1) return !0;
139
- break e;
140
- }
141
- if (t = (i + 1) % w, t < 1 && (t += w), String(u[0]).length == t) {
142
- for (t = 0; t < u.length; t++)
143
- if (n = u[t], n < 0 || n >= T || n !== j(n)) break e;
144
- if (n !== 0) return !0;
145
- }
146
- }
147
- } else if (u === null && i === null && (s === null || s === 1 || s === -1))
148
- return !0;
149
- throw Error(C + "Invalid BigNumber: " + e);
150
- }, v.maximum = v.max = function() {
151
- return $e(arguments, -1);
152
- }, v.minimum = v.min = function() {
153
- return $e(arguments, 1);
154
- }, v.random = function() {
155
- var e = 9007199254740992, t = Math.random() * e & 2097151 ? function() {
156
- return j(Math.random() * e);
157
- } : function() {
158
- return (Math.random() * 1073741824 | 0) * 8388608 + (Math.random() * 8388608 | 0);
159
- };
160
- return function(n) {
161
- var u, i, s, f, r, o = 0, a = [], l = new v(_);
162
- if (n == null ? n = m : x(n, 0, $), f = O(n / w), ie)
163
- if (crypto.getRandomValues) {
164
- for (u = crypto.getRandomValues(new Uint32Array(f *= 2)); o < f; )
165
- r = u[o] * 131072 + (u[o + 1] >>> 11), r >= 9e15 ? (i = crypto.getRandomValues(new Uint32Array(2)), u[o] = i[0], u[o + 1] = i[1]) : (a.push(r % 1e14), o += 2);
166
- o = f / 2;
167
- } else if (crypto.randomBytes) {
168
- for (u = crypto.randomBytes(f *= 7); o < f; )
169
- r = (u[o] & 31) * 281474976710656 + u[o + 1] * 1099511627776 + u[o + 2] * 4294967296 + u[o + 3] * 16777216 + (u[o + 4] << 16) + (u[o + 5] << 8) + u[o + 6], r >= 9e15 ? crypto.randomBytes(7).copy(u, o) : (a.push(r % 1e14), o += 7);
170
- o = f / 7;
171
- } else
172
- throw ie = !1, Error(C + "crypto unavailable");
173
- if (!ie)
174
- for (; o < f; )
175
- r = t(), r < 9e15 && (a[o++] = r % 1e14);
176
- for (f = a[--o], n %= w, f && n && (r = A[w - n], a[o] = j(f / r) * r); a[o] === 0; a.pop(), o--) ;
177
- if (o < 0)
178
- a = [s = 0];
179
- else {
180
- for (s = -1; a[0] === 0; a.splice(0, 1), s -= w) ;
181
- for (o = 1, r = a[0]; r >= 10; r /= 10, o++) ;
182
- o < w && (s -= w - o);
183
- }
184
- return l.e = s, l.c = a, l;
185
- };
186
- }(), v.sum = function() {
187
- for (var e = 1, t = arguments, n = new v(t[0]); e < t.length; ) n = n.plus(t[e++]);
188
- return n;
189
- }, L = /* @__PURE__ */ function() {
190
- var e = "0123456789";
191
- function t(n, u, i, s) {
192
- for (var f, r = [0], o, a = 0, l = n.length; a < l; ) {
193
- for (o = r.length; o--; r[o] *= u) ;
194
- for (r[0] += s.indexOf(n.charAt(a++)), f = 0; f < r.length; f++)
195
- r[f] > i - 1 && (r[f + 1] == null && (r[f + 1] = 0), r[f + 1] += r[f] / i | 0, r[f] %= i);
196
- }
197
- return r.reverse();
198
- }
199
- return function(n, u, i, s, f) {
200
- var r, o, a, l, d, E, B, R, Q = n.indexOf("."), te = m, F = p;
201
- for (Q >= 0 && (l = ge, ge = 0, n = n.replace(".", ""), R = new v(u), E = R.pow(n.length - Q), ge = l, R.c = t(
202
- V(D(E.c), E.e, "0"),
203
- 10,
204
- i,
205
- e
206
- ), R.e = R.c.length), B = t(n, u, i, f ? (r = ve, e) : (r = e, ve)), a = l = B.length; B[--l] == 0; B.pop()) ;
207
- if (!B[0]) return r.charAt(0);
208
- if (Q < 0 ? --a : (E.c = B, E.e = a, E.s = s, E = k(E, R, te, F, i), B = E.c, d = E.r, a = E.e), o = a + te + 1, Q = B[o], l = i / 2, d = d || o < 0 || B[o + 1] != null, d = F < 4 ? (Q != null || d) && (F == 0 || F == (E.s < 0 ? 3 : 2)) : Q > l || Q == l && (F == 4 || d || F == 6 && B[o - 1] & 1 || F == (E.s < 0 ? 8 : 7)), o < 1 || !B[0])
209
- n = d ? V(r.charAt(1), -te, r.charAt(0)) : r.charAt(0);
210
- else {
211
- if (B.length = o, d)
212
- for (--i; ++B[--o] > i; )
213
- B[o] = 0, o || (++a, B = [1].concat(B));
214
- for (l = B.length; !B[--l]; ) ;
215
- for (Q = 0, n = ""; Q <= l; n += r.charAt(B[Q++])) ;
216
- n = V(n, a, r.charAt(0));
217
- }
218
- return n;
219
- };
220
- }(), k = /* @__PURE__ */ function() {
221
- function e(u, i, s) {
222
- var f, r, o, a, l = 0, d = u.length, E = i % P, B = i / P | 0;
223
- for (u = u.slice(); d--; )
224
- o = u[d] % P, a = u[d] / P | 0, f = B * o + a * E, r = E * o + f % P * P + l, l = (r / s | 0) + (f / P | 0) + B * a, u[d] = r % s;
225
- return l && (u = [l].concat(u)), u;
226
- }
227
- function t(u, i, s, f) {
228
- var r, o;
229
- if (s != f)
230
- o = s > f ? 1 : -1;
231
- else
232
- for (r = o = 0; r < s; r++)
233
- if (u[r] != i[r]) {
234
- o = u[r] > i[r] ? 1 : -1;
235
- break;
236
- }
237
- return o;
238
- }
239
- function n(u, i, s, f) {
240
- for (var r = 0; s--; )
241
- u[s] -= r, r = u[s] < i[s] ? 1 : 0, u[s] = r * f + u[s] - i[s];
242
- for (; !u[0] && u.length > 1; u.splice(0, 1)) ;
243
- }
244
- return function(u, i, s, f, r) {
245
- var o, a, l, d, E, B, R, Q, te, F, q, re, Ne, Se, Be, ce, _e, ae = u.s == i.s ? 1 : -1, oe = u.c, Z = i.c;
246
- if (!oe || !oe[0] || !Z || !Z[0])
247
- return new v(
248
- // Return NaN if either NaN, or both Infinity or 0.
249
- !u.s || !i.s || (oe ? Z && oe[0] == Z[0] : !Z) ? NaN : (
250
- // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.
251
- oe && oe[0] == 0 || !Z ? ae * 0 : ae / 0
252
- )
253
- );
254
- for (Q = new v(ae), te = Q.c = [], a = u.e - i.e, ae = s + a + 1, r || (r = T, a = X(u.e / w) - X(i.e / w), ae = ae / w | 0), l = 0; Z[l] == (oe[l] || 0); l++) ;
255
- if (Z[l] > (oe[l] || 0) && a--, ae < 0)
256
- te.push(1), d = !0;
257
- else {
258
- for (Se = oe.length, ce = Z.length, l = 0, ae += 2, E = j(r / (Z[0] + 1)), E > 1 && (Z = e(Z, E, r), oe = e(oe, E, r), ce = Z.length, Se = oe.length), Ne = ce, F = oe.slice(0, ce), q = F.length; q < ce; F[q++] = 0) ;
259
- _e = Z.slice(), _e = [0].concat(_e), Be = Z[0], Z[1] >= r / 2 && Be++;
260
- do {
261
- if (E = 0, o = t(Z, F, ce, q), o < 0) {
262
- if (re = F[0], ce != q && (re = re * r + (F[1] || 0)), E = j(re / Be), E > 1)
263
- for (E >= r && (E = r - 1), B = e(Z, E, r), R = B.length, q = F.length; t(B, F, R, q) == 1; )
264
- E--, n(B, ce < R ? _e : Z, R, r), R = B.length, o = 1;
265
- else
266
- E == 0 && (o = E = 1), B = Z.slice(), R = B.length;
267
- if (R < q && (B = [0].concat(B)), n(F, B, q, r), q = F.length, o == -1)
268
- for (; t(Z, F, ce, q) < 1; )
269
- E++, n(F, ce < q ? _e : Z, q, r), q = F.length;
270
- } else o === 0 && (E++, F = [0]);
271
- te[l++] = E, F[0] ? F[q++] = oe[Ne] || 0 : (F = [oe[Ne]], q = 1);
272
- } while ((Ne++ < Se || F[0] != null) && ae--);
273
- d = F[0] != null, te[0] || te.splice(0, 1);
274
- }
275
- if (r == T) {
276
- for (l = 1, ae = te[0]; ae >= 10; ae /= 10, l++) ;
277
- ue(Q, s + (Q.e = l + a * w - 1) + 1, f, d);
278
- } else
279
- Q.e = a, Q.r = +d;
280
- return Q;
281
- };
282
- }();
283
- function Oe(e, t, n, u) {
284
- var i, s, f, r, o;
285
- if (n == null ? n = p : x(n, 0, 8), !e.c) return e.toString();
286
- if (i = e.c[0], f = e.e, t == null)
287
- o = D(e.c), o = u == 1 || u == 2 && (f <= h || f >= U) ? b(o, f) : V(o, f, "0");
288
- else if (e = ue(new v(e), t, n), s = e.e, o = D(e.c), r = o.length, u == 1 || u == 2 && (t <= s || s <= h)) {
289
- for (; r < t; o += "0", r++) ;
290
- o = b(o, s);
291
- } else if (t -= f + (u === 2 && s > f), o = V(o, s, "0"), s + 1 > r) {
292
- if (--t > 0) for (o += "."; t--; o += "0") ;
293
- } else if (t += s - r, t > 0)
294
- for (s + 1 == r && (o += "."); t--; o += "0") ;
295
- return e.s < 0 && i ? "-" + o : o;
296
- }
297
- function $e(e, t) {
298
- for (var n, u, i = 1, s = new v(e[0]); i < e.length; i++)
299
- u = new v(e[i]), (!u.s || (n = W(s, u)) === t || n === 0 && s.s === t) && (s = u);
300
- return s;
301
- }
302
- function xe(e, t, n) {
303
- for (var u = 1, i = t.length; !t[--i]; t.pop()) ;
304
- for (i = t[0]; i >= 10; i /= 10, u++) ;
305
- return (n = u + n * w - 1) > H ? e.c = e.e = null : n < M ? e.c = [e.e = 0] : (e.e = n, e.c = t), e;
306
- }
307
- g = /* @__PURE__ */ function() {
308
- var e = /^(-?)0([xbo])(?=\w[\w.]*$)/i, t = /^([^.]+)\.$/, n = /^\.([^.]+)$/, u = /^-?(Infinity|NaN)$/, i = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
309
- return function(s, f, r, o) {
310
- var a, l = r ? f : f.replace(i, "");
311
- if (u.test(l))
312
- s.s = isNaN(l) ? null : l < 0 ? -1 : 1;
313
- else {
314
- if (!r && (l = l.replace(e, function(d, E, B) {
315
- return a = (B = B.toLowerCase()) == "x" ? 16 : B == "b" ? 2 : 8, !o || o == a ? E : d;
316
- }), o && (a = o, l = l.replace(t, "$1").replace(n, "0.$1")), f != l))
317
- return new v(l, a);
318
- if (v.DEBUG)
319
- throw Error(C + "Not a" + (o ? " base " + o : "") + " number: " + f);
320
- s.s = null;
321
- }
322
- s.c = s.e = null;
323
- };
324
- }();
325
- function ue(e, t, n, u) {
326
- var i, s, f, r, o, a, l, d = e.c, E = A;
327
- if (d) {
328
- e: {
329
- for (i = 1, r = d[0]; r >= 10; r /= 10, i++) ;
330
- if (s = t - i, s < 0)
331
- s += w, f = t, o = d[a = 0], l = j(o / E[i - f - 1] % 10);
332
- else if (a = O((s + 1) / w), a >= d.length)
333
- if (u) {
334
- for (; d.length <= a; d.push(0)) ;
335
- o = l = 0, i = 1, s %= w, f = s - w + 1;
336
- } else
337
- break e;
338
- else {
339
- for (o = r = d[a], i = 1; r >= 10; r /= 10, i++) ;
340
- s %= w, f = s - w + i, l = f < 0 ? 0 : j(o / E[i - f - 1] % 10);
341
- }
342
- if (u = u || t < 0 || // Are there any non-zero digits after the rounding digit?
343
- // The expression n % pows10[d - j - 1] returns all digits of n to the right
344
- // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.
345
- d[a + 1] != null || (f < 0 ? o : o % E[i - f - 1]), u = n < 4 ? (l || u) && (n == 0 || n == (e.s < 0 ? 3 : 2)) : l > 5 || l == 5 && (n == 4 || u || n == 6 && // Check whether the digit to the left of the rounding digit is odd.
346
- (s > 0 ? f > 0 ? o / E[i - f] : 0 : d[a - 1]) % 10 & 1 || n == (e.s < 0 ? 8 : 7)), t < 1 || !d[0])
347
- return d.length = 0, u ? (t -= e.e + 1, d[0] = E[(w - t % w) % w], e.e = -t || 0) : d[0] = e.e = 0, e;
348
- if (s == 0 ? (d.length = a, r = 1, a--) : (d.length = a + 1, r = E[w - s], d[a] = f > 0 ? j(o / E[i - f] % E[f]) * r : 0), u)
349
- for (; ; )
350
- if (a == 0) {
351
- for (s = 1, f = d[0]; f >= 10; f /= 10, s++) ;
352
- for (f = d[0] += r, r = 1; f >= 10; f /= 10, r++) ;
353
- s != r && (e.e++, d[0] == T && (d[0] = 1));
354
- break;
355
- } else {
356
- if (d[a] += r, d[a] != T) break;
357
- d[a--] = 0, r = 1;
358
- }
359
- for (s = d.length; d[--s] === 0; d.pop()) ;
360
- }
361
- e.e > H ? e.c = e.e = null : e.e < M && (e.c = [e.e = 0]);
362
- }
363
- return e;
364
- }
365
- function de(e) {
366
- var t, n = e.e;
367
- return n === null ? e.toString() : (t = D(e.c), t = n <= h || n >= U ? b(t, n) : V(t, n, "0"), e.s < 0 ? "-" + t : t);
368
- }
369
- return c.absoluteValue = c.abs = function() {
370
- var e = new v(this);
371
- return e.s < 0 && (e.s = 1), e;
372
- }, c.comparedTo = function(e, t) {
373
- return W(this, new v(e, t));
374
- }, c.decimalPlaces = c.dp = function(e, t) {
375
- var n, u, i, s = this;
376
- if (e != null)
377
- return x(e, 0, $), t == null ? t = p : x(t, 0, 8), ue(new v(s), e + s.e + 1, t);
378
- if (!(n = s.c)) return null;
379
- if (u = ((i = n.length - 1) - X(this.e / w)) * w, i = n[i]) for (; i % 10 == 0; i /= 10, u--) ;
380
- return u < 0 && (u = 0), u;
381
- }, c.dividedBy = c.div = function(e, t) {
382
- return k(this, new v(e, t), m, p);
383
- }, c.dividedToIntegerBy = c.idiv = function(e, t) {
384
- return k(this, new v(e, t), 0, 1);
385
- }, c.exponentiatedBy = c.pow = function(e, t) {
386
- var n, u, i, s, f, r, o, a, l, d = this;
387
- if (e = new v(e), e.c && !e.isInteger())
388
- throw Error(C + "Exponent not an integer: " + de(e));
389
- if (t != null && (t = new v(t)), r = e.e > 14, !d.c || !d.c[0] || d.c[0] == 1 && !d.e && d.c.length == 1 || !e.c || !e.c[0])
390
- return l = new v(Math.pow(+de(d), r ? e.s * (2 - I(e)) : +de(e))), t ? l.mod(t) : l;
391
- if (o = e.s < 0, t) {
392
- if (t.c ? !t.c[0] : !t.s) return new v(NaN);
393
- u = !o && d.isInteger() && t.isInteger(), u && (d = d.mod(t));
394
- } else {
395
- if (e.e > 9 && (d.e > 0 || d.e < -1 || (d.e == 0 ? d.c[0] > 1 || r && d.c[1] >= 24e7 : d.c[0] < 8e13 || r && d.c[0] <= 9999975e7)))
396
- return s = d.s < 0 && I(e) ? -0 : 0, d.e > -1 && (s = 1 / s), new v(o ? 1 / s : s);
397
- ge && (s = O(ge / w + 2));
398
- }
399
- for (r ? (n = new v(0.5), o && (e.s = 1), a = I(e)) : (i = Math.abs(+de(e)), a = i % 2), l = new v(_); ; ) {
400
- if (a) {
401
- if (l = l.times(d), !l.c) break;
402
- s ? l.c.length > s && (l.c.length = s) : u && (l = l.mod(t));
403
- }
404
- if (i) {
405
- if (i = j(i / 2), i === 0) break;
406
- a = i % 2;
407
- } else if (e = e.times(n), ue(e, e.e + 1, 1), e.e > 14)
408
- a = I(e);
409
- else {
410
- if (i = +de(e), i === 0) break;
411
- a = i % 2;
412
- }
413
- d = d.times(d), s ? d.c && d.c.length > s && (d.c.length = s) : u && (d = d.mod(t));
414
- }
415
- return u ? l : (o && (l = _.div(l)), t ? l.mod(t) : s ? ue(l, ge, p, f) : l);
416
- }, c.integerValue = function(e) {
417
- var t = new v(this);
418
- return e == null ? e = p : x(e, 0, 8), ue(t, t.e + 1, e);
419
- }, c.isEqualTo = c.eq = function(e, t) {
420
- return W(this, new v(e, t)) === 0;
421
- }, c.isFinite = function() {
422
- return !!this.c;
423
- }, c.isGreaterThan = c.gt = function(e, t) {
424
- return W(this, new v(e, t)) > 0;
425
- }, c.isGreaterThanOrEqualTo = c.gte = function(e, t) {
426
- return (t = W(this, new v(e, t))) === 1 || t === 0;
427
- }, c.isInteger = function() {
428
- return !!this.c && X(this.e / w) > this.c.length - 2;
429
- }, c.isLessThan = c.lt = function(e, t) {
430
- return W(this, new v(e, t)) < 0;
431
- }, c.isLessThanOrEqualTo = c.lte = function(e, t) {
432
- return (t = W(this, new v(e, t))) === -1 || t === 0;
433
- }, c.isNaN = function() {
434
- return !this.s;
435
- }, c.isNegative = function() {
436
- return this.s < 0;
437
- }, c.isPositive = function() {
438
- return this.s > 0;
439
- }, c.isZero = function() {
440
- return !!this.c && this.c[0] == 0;
441
- }, c.minus = function(e, t) {
442
- var n, u, i, s, f = this, r = f.s;
443
- if (e = new v(e, t), t = e.s, !r || !t) return new v(NaN);
444
- if (r != t)
445
- return e.s = -t, f.plus(e);
446
- var o = f.e / w, a = e.e / w, l = f.c, d = e.c;
447
- if (!o || !a) {
448
- if (!l || !d) return l ? (e.s = -t, e) : new v(d ? f : NaN);
449
- if (!l[0] || !d[0])
450
- return d[0] ? (e.s = -t, e) : new v(l[0] ? f : (
451
- // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity
452
- p == 3 ? -0 : 0
453
- ));
454
- }
455
- if (o = X(o), a = X(a), l = l.slice(), r = o - a) {
456
- for ((s = r < 0) ? (r = -r, i = l) : (a = o, i = d), i.reverse(), t = r; t--; i.push(0)) ;
457
- i.reverse();
458
- } else
459
- for (u = (s = (r = l.length) < (t = d.length)) ? r : t, r = t = 0; t < u; t++)
460
- if (l[t] != d[t]) {
461
- s = l[t] < d[t];
462
- break;
463
- }
464
- if (s && (i = l, l = d, d = i, e.s = -e.s), t = (u = d.length) - (n = l.length), t > 0) for (; t--; l[n++] = 0) ;
465
- for (t = T - 1; u > r; ) {
466
- if (l[--u] < d[u]) {
467
- for (n = u; n && !l[--n]; l[n] = t) ;
468
- --l[n], l[u] += T;
469
- }
470
- l[u] -= d[u];
471
- }
472
- for (; l[0] == 0; l.splice(0, 1), --a) ;
473
- return l[0] ? xe(e, l, a) : (e.s = p == 3 ? -1 : 1, e.c = [e.e = 0], e);
474
- }, c.modulo = c.mod = function(e, t) {
475
- var n, u, i = this;
476
- return e = new v(e, t), !i.c || !e.s || e.c && !e.c[0] ? new v(NaN) : !e.c || i.c && !i.c[0] ? new v(i) : (pe == 9 ? (u = e.s, e.s = 1, n = k(i, e, 0, 3), e.s = u, n.s *= u) : n = k(i, e, 0, pe), e = i.minus(n.times(e)), !e.c[0] && pe == 1 && (e.s = i.s), e);
477
- }, c.multipliedBy = c.times = function(e, t) {
478
- var n, u, i, s, f, r, o, a, l, d, E, B, R, Q, te, F = this, q = F.c, re = (e = new v(e, t)).c;
479
- if (!q || !re || !q[0] || !re[0])
480
- return !F.s || !e.s || q && !q[0] && !re || re && !re[0] && !q ? e.c = e.e = e.s = null : (e.s *= F.s, !q || !re ? e.c = e.e = null : (e.c = [0], e.e = 0)), e;
481
- for (u = X(F.e / w) + X(e.e / w), e.s *= F.s, o = q.length, d = re.length, o < d && (R = q, q = re, re = R, i = o, o = d, d = i), i = o + d, R = []; i--; R.push(0)) ;
482
- for (Q = T, te = P, i = d; --i >= 0; ) {
483
- for (n = 0, E = re[i] % te, B = re[i] / te | 0, f = o, s = i + f; s > i; )
484
- a = q[--f] % te, l = q[f] / te | 0, r = B * a + l * E, a = E * a + r % te * te + R[s] + n, n = (a / Q | 0) + (r / te | 0) + B * l, R[s--] = a % Q;
485
- R[s] = n;
486
- }
487
- return n ? ++u : R.splice(0, 1), xe(e, R, u);
488
- }, c.negated = function() {
489
- var e = new v(this);
490
- return e.s = -e.s || null, e;
491
- }, c.plus = function(e, t) {
492
- var n, u = this, i = u.s;
493
- if (e = new v(e, t), t = e.s, !i || !t) return new v(NaN);
494
- if (i != t)
495
- return e.s = -t, u.minus(e);
496
- var s = u.e / w, f = e.e / w, r = u.c, o = e.c;
497
- if (!s || !f) {
498
- if (!r || !o) return new v(i / 0);
499
- if (!r[0] || !o[0]) return o[0] ? e : new v(r[0] ? u : i * 0);
500
- }
501
- if (s = X(s), f = X(f), r = r.slice(), i = s - f) {
502
- for (i > 0 ? (f = s, n = o) : (i = -i, n = r), n.reverse(); i--; n.push(0)) ;
503
- n.reverse();
504
- }
505
- for (i = r.length, t = o.length, i - t < 0 && (n = o, o = r, r = n, t = i), i = 0; t; )
506
- i = (r[--t] = r[t] + o[t] + i) / T | 0, r[t] = T === r[t] ? 0 : r[t] % T;
507
- return i && (r = [i].concat(r), ++f), xe(e, r, f);
508
- }, c.precision = c.sd = function(e, t) {
509
- var n, u, i, s = this;
510
- if (e != null && e !== !!e)
511
- return x(e, 1, $), t == null ? t = p : x(t, 0, 8), ue(new v(s), e, t);
512
- if (!(n = s.c)) return null;
513
- if (i = n.length - 1, u = i * w + 1, i = n[i]) {
514
- for (; i % 10 == 0; i /= 10, u--) ;
515
- for (i = n[0]; i >= 10; i /= 10, u++) ;
516
- }
517
- return e && s.e + 1 > u && (u = s.e + 1), u;
518
- }, c.shiftedBy = function(e) {
519
- return x(e, -J, J), this.times("1e" + e);
520
- }, c.squareRoot = c.sqrt = function() {
521
- var e, t, n, u, i, s = this, f = s.c, r = s.s, o = s.e, a = m + 4, l = new v("0.5");
522
- if (r !== 1 || !f || !f[0])
523
- return new v(!r || r < 0 && (!f || f[0]) ? NaN : f ? s : 1 / 0);
524
- if (r = Math.sqrt(+de(s)), r == 0 || r == 1 / 0 ? (t = D(f), (t.length + o) % 2 == 0 && (t += "0"), r = Math.sqrt(+t), o = X((o + 1) / 2) - (o < 0 || o % 2), r == 1 / 0 ? t = "5e" + o : (t = r.toExponential(), t = t.slice(0, t.indexOf("e") + 1) + o), n = new v(t)) : n = new v(r + ""), n.c[0]) {
525
- for (o = n.e, r = o + a, r < 3 && (r = 0); ; )
526
- if (i = n, n = l.times(i.plus(k(s, i, a, 1))), D(i.c).slice(0, r) === (t = D(n.c)).slice(0, r))
527
- if (n.e < o && --r, t = t.slice(r - 3, r + 1), t == "9999" || !u && t == "4999") {
528
- if (!u && (ue(i, i.e + m + 2, 0), i.times(i).eq(s))) {
529
- n = i;
530
- break;
531
- }
532
- a += 4, r += 4, u = 1;
533
- } else {
534
- (!+t || !+t.slice(1) && t.charAt(0) == "5") && (ue(n, n.e + m + 2, 1), e = !n.times(n).eq(s));
535
- break;
536
- }
537
- }
538
- return ue(n, n.e + m + 1, p, e);
539
- }, c.toExponential = function(e, t) {
540
- return e != null && (x(e, 0, $), e++), Oe(this, e, t, 1);
541
- }, c.toFixed = function(e, t) {
542
- return e != null && (x(e, 0, $), e = e + this.e + 1), Oe(this, e, t);
543
- }, c.toFormat = function(e, t, n) {
544
- var u, i = this;
545
- if (n == null)
546
- e != null && t && typeof t == "object" ? (n = t, t = null) : e && typeof e == "object" ? (n = e, e = t = null) : n = ke;
547
- else if (typeof n != "object")
548
- throw Error(C + "Argument not an object: " + n);
549
- if (u = i.toFixed(e, t), i.c) {
550
- var s, f = u.split("."), r = +n.groupSize, o = +n.secondaryGroupSize, a = n.groupSeparator || "", l = f[0], d = f[1], E = i.s < 0, B = E ? l.slice(1) : l, R = B.length;
551
- if (o && (s = r, r = o, o = s, R -= s), r > 0 && R > 0) {
552
- for (s = R % r || r, l = B.substr(0, s); s < R; s += r) l += a + B.substr(s, r);
553
- o > 0 && (l += a + B.slice(s)), E && (l = "-" + l);
554
- }
555
- u = d ? l + (n.decimalSeparator || "") + ((o = +n.fractionGroupSize) ? d.replace(
556
- new RegExp("\\d{" + o + "}\\B", "g"),
557
- "$&" + (n.fractionGroupSeparator || "")
558
- ) : d) : l;
559
- }
560
- return (n.prefix || "") + u + (n.suffix || "");
561
- }, c.toFraction = function(e) {
562
- var t, n, u, i, s, f, r, o, a, l, d, E, B = this, R = B.c;
563
- if (e != null && (r = new v(e), !r.isInteger() && (r.c || r.s !== 1) || r.lt(_)))
564
- throw Error(C + "Argument " + (r.isInteger() ? "out of range: " : "not an integer: ") + de(r));
565
- if (!R) return new v(B);
566
- for (t = new v(_), a = n = new v(_), u = o = new v(_), E = D(R), s = t.e = E.length - B.e - 1, t.c[0] = A[(f = s % w) < 0 ? w + f : f], e = !e || r.comparedTo(t) > 0 ? s > 0 ? t : a : r, f = H, H = 1 / 0, r = new v(E), o.c[0] = 0; l = k(r, t, 0, 1), i = n.plus(l.times(u)), i.comparedTo(e) != 1; )
567
- n = u, u = i, a = o.plus(l.times(i = a)), o = i, t = r.minus(l.times(i = t)), r = i;
568
- return i = k(e.minus(n), u, 0, 1), o = o.plus(i.times(a)), n = n.plus(i.times(u)), o.s = a.s = B.s, s = s * 2, d = k(a, u, s, p).minus(B).abs().comparedTo(
569
- k(o, n, s, p).minus(B).abs()
570
- ) < 1 ? [a, u] : [o, n], H = f, d;
571
- }, c.toNumber = function() {
572
- return +de(this);
573
- }, c.toPrecision = function(e, t) {
574
- return e != null && x(e, 1, $), Oe(this, e, t, 2);
575
- }, c.toString = function(e) {
576
- var t, n = this, u = n.s, i = n.e;
577
- return i === null ? u ? (t = "Infinity", u < 0 && (t = "-" + t)) : t = "NaN" : (e == null ? t = i <= h || i >= U ? b(D(n.c), i) : V(D(n.c), i, "0") : e === 10 && Ee ? (n = ue(new v(n), m + i + 1, p), t = V(D(n.c), n.e, "0")) : (x(e, 2, ve.length, "Base"), t = L(V(D(n.c), i, "0"), 10, e, u, !0)), u < 0 && n.c[0] && (t = "-" + t)), t;
578
- }, c.valueOf = c.toJSON = function() {
579
- return de(this);
580
- }, c._isBigNumber = !0, S != null && v.set(S), v;
581
- }
582
- function X(S) {
583
- var k = S | 0;
584
- return S > 0 || S === k ? k : k - 1;
585
- }
586
- function D(S) {
587
- for (var k, L, g = 1, c = S.length, _ = S[0] + ""; g < c; ) {
588
- for (k = S[g++] + "", L = w - k.length; L--; k = "0" + k) ;
589
- _ += k;
590
- }
591
- for (c = _.length; _.charCodeAt(--c) === 48; ) ;
592
- return _.slice(0, c + 1 || 1);
593
- }
594
- function W(S, k) {
595
- var L, g, c = S.c, _ = k.c, m = S.s, p = k.s, h = S.e, U = k.e;
596
- if (!m || !p) return null;
597
- if (L = c && !c[0], g = _ && !_[0], L || g) return L ? g ? 0 : -p : m;
598
- if (m != p) return m;
599
- if (L = m < 0, g = h == U, !c || !_) return g ? 0 : !c ^ L ? 1 : -1;
600
- if (!g) return h > U ^ L ? 1 : -1;
601
- for (p = (h = c.length) < (U = _.length) ? h : U, m = 0; m < p; m++) if (c[m] != _[m]) return c[m] > _[m] ^ L ? 1 : -1;
602
- return h == U ? 0 : h > U ^ L ? 1 : -1;
603
- }
604
- function x(S, k, L, g) {
605
- if (S < k || S > L || S !== j(S))
606
- throw Error(C + (g || "Argument") + (typeof S == "number" ? S < k || S > L ? " out of range: " : " not an integer: " : " not a primitive number: ") + String(S));
607
- }
608
- function I(S) {
609
- var k = S.c.length - 1;
610
- return X(S.e / w) == k && S.c[k] % 2 != 0;
611
- }
612
- function b(S, k) {
613
- return (S.length > 1 ? S.charAt(0) + "." + S.slice(1) : S) + (k < 0 ? "e" : "e+") + k;
614
- }
615
- function V(S, k, L) {
616
- var g, c;
617
- if (k < 0) {
618
- for (c = L + "."; ++k; c += L) ;
619
- S = c + S;
620
- } else if (g = S.length, ++k > g) {
621
- for (c = L, k -= g; --k; c += L) ;
622
- S += c;
623
- } else k < g && (S = S.slice(0, k) + "." + S.slice(k));
624
- return S;
625
- }
626
- N = z(), N.default = N.BigNumber = N, G.exports ? G.exports = N : (ee || (ee = typeof self < "u" && self ? self : window), ee.BigNumber = N);
627
- })(Ke);
628
- }(Ae)), Ae.exports;
629
- }
630
- var Fe;
631
- function Qe() {
632
- return Fe || (Fe = 1, function(G) {
633
- var ee = Le(), N = G.exports;
634
- (function() {
635
- var ne = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, O, j, C = {
636
- // table of character substitutions
637
- "\b": "\\b",
638
- " ": "\\t",
639
- "\n": "\\n",
640
- "\f": "\\f",
641
- "\r": "\\r",
642
- '"': '\\"',
643
- "\\": "\\\\"
644
- }, y;
645
- function T(J) {
646
- return ne.lastIndex = 0, ne.test(J) ? '"' + J.replace(ne, function(A) {
647
- var P = C[A];
648
- return typeof P == "string" ? P : "\\u" + ("0000" + A.charCodeAt(0).toString(16)).slice(-4);
649
- }) + '"' : '"' + J + '"';
650
- }
651
- function w(J, A) {
652
- var P, $, z, X, D = O, W, x = A[J], I = x != null && (x instanceof ee || ee.isBigNumber(x));
653
- switch (x && typeof x == "object" && typeof x.toJSON == "function" && (x = x.toJSON(J)), typeof y == "function" && (x = y.call(A, J, x)), typeof x) {
654
- case "string":
655
- return I ? x : T(x);
656
- case "number":
657
- return isFinite(x) ? String(x) : "null";
658
- case "boolean":
659
- case "null":
660
- case "bigint":
661
- return String(x);
662
- // If the type is 'object', we might be dealing with an object or an array or
663
- // null.
664
- case "object":
665
- if (!x)
666
- return "null";
667
- if (O += j, W = [], Object.prototype.toString.apply(x) === "[object Array]") {
668
- for (X = x.length, P = 0; P < X; P += 1)
669
- W[P] = w(P, x) || "null";
670
- return z = W.length === 0 ? "[]" : O ? `[
671
- ` + O + W.join(`,
672
- ` + O) + `
673
- ` + D + "]" : "[" + W.join(",") + "]", O = D, z;
674
- }
675
- if (y && typeof y == "object")
676
- for (X = y.length, P = 0; P < X; P += 1)
677
- typeof y[P] == "string" && ($ = y[P], z = w($, x), z && W.push(T($) + (O ? ": " : ":") + z));
678
- else
679
- Object.keys(x).forEach(function(b) {
680
- var V = w(b, x);
681
- V && W.push(T(b) + (O ? ": " : ":") + V);
682
- });
683
- return z = W.length === 0 ? "{}" : O ? `{
684
- ` + O + W.join(`,
685
- ` + O) + `
686
- ` + D + "}" : "{" + W.join(",") + "}", O = D, z;
687
- }
688
- }
689
- typeof N.stringify != "function" && (N.stringify = function(J, A, P) {
690
- var $;
691
- if (O = "", j = "", typeof P == "number")
692
- for ($ = 0; $ < P; $ += 1)
693
- j += " ";
694
- else typeof P == "string" && (j = P);
695
- if (y = A, A && typeof A != "function" && (typeof A != "object" || typeof A.length != "number"))
696
- throw new Error("JSON.stringify");
697
- return w("", { "": J });
698
- });
699
- })();
700
- }(Ie)), Ie.exports;
701
- }
702
- var be, Je;
703
- function Ze() {
704
- if (Je) return be;
705
- Je = 1;
706
- var G = null;
707
- const ee = /(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/, N = /(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;
708
- var ne = function(O) {
709
- var j = {
710
- strict: !1,
711
- // not being strict means do not generate syntax errors for "duplicate key"
712
- storeAsString: !1,
713
- // toggles whether the values should be stored as BigNumber (default) or a string
714
- alwaysParseAsBig: !1,
715
- // toggles whether all numbers should be Big
716
- useNativeBigInt: !1,
717
- // toggles whether to use native BigInt instead of bignumber.js
718
- protoAction: "error",
719
- constructorAction: "error"
720
- };
721
- if (O != null) {
722
- if (O.strict === !0 && (j.strict = !0), O.storeAsString === !0 && (j.storeAsString = !0), j.alwaysParseAsBig = O.alwaysParseAsBig === !0 ? O.alwaysParseAsBig : !1, j.useNativeBigInt = O.useNativeBigInt === !0 ? O.useNativeBigInt : !1, typeof O.constructorAction < "u")
723
- if (O.constructorAction === "error" || O.constructorAction === "ignore" || O.constructorAction === "preserve")
724
- j.constructorAction = O.constructorAction;
725
- else
726
- throw new Error(
727
- `Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${O.constructorAction}`
728
- );
729
- if (typeof O.protoAction < "u")
730
- if (O.protoAction === "error" || O.protoAction === "ignore" || O.protoAction === "preserve")
731
- j.protoAction = O.protoAction;
732
- else
733
- throw new Error(
734
- `Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${O.protoAction}`
735
- );
736
- }
737
- var C, y, T = {
738
- '"': '"',
739
- "\\": "\\",
740
- "/": "/",
741
- b: "\b",
742
- f: "\f",
743
- n: `
744
- `,
745
- r: "\r",
746
- t: " "
747
- }, w, J = function(I) {
748
- throw {
749
- name: "SyntaxError",
750
- message: I,
751
- at: C,
752
- text: w
753
- };
754
- }, A = function(I) {
755
- return I && I !== y && J("Expected '" + I + "' instead of '" + y + "'"), y = w.charAt(C), C += 1, y;
756
- }, P = function() {
757
- var I, b = "";
758
- for (y === "-" && (b = "-", A("-")); y >= "0" && y <= "9"; )
759
- b += y, A();
760
- if (y === ".")
761
- for (b += "."; A() && y >= "0" && y <= "9"; )
762
- b += y;
763
- if (y === "e" || y === "E")
764
- for (b += y, A(), (y === "-" || y === "+") && (b += y, A()); y >= "0" && y <= "9"; )
765
- b += y, A();
766
- if (I = +b, !isFinite(I))
767
- J("Bad number");
768
- else
769
- return G == null && (G = Le()), b.length > 15 ? j.storeAsString ? b : j.useNativeBigInt ? BigInt(b) : new G(b) : j.alwaysParseAsBig ? j.useNativeBigInt ? BigInt(I) : new G(I) : I;
770
- }, $ = function() {
771
- var I, b, V = "", S;
772
- if (y === '"')
773
- for (var k = C; A(); ) {
774
- if (y === '"')
775
- return C - 1 > k && (V += w.substring(k, C - 1)), A(), V;
776
- if (y === "\\") {
777
- if (C - 1 > k && (V += w.substring(k, C - 1)), A(), y === "u") {
778
- for (S = 0, b = 0; b < 4 && (I = parseInt(A(), 16), !!isFinite(I)); b += 1)
779
- S = S * 16 + I;
780
- V += String.fromCharCode(S);
781
- } else if (typeof T[y] == "string")
782
- V += T[y];
783
- else
784
- break;
785
- k = C;
786
- }
787
- }
788
- J("Bad string");
789
- }, z = function() {
790
- for (; y && y <= " "; )
791
- A();
792
- }, X = function() {
793
- switch (y) {
794
- case "t":
795
- return A("t"), A("r"), A("u"), A("e"), !0;
796
- case "f":
797
- return A("f"), A("a"), A("l"), A("s"), A("e"), !1;
798
- case "n":
799
- return A("n"), A("u"), A("l"), A("l"), null;
800
- }
801
- J("Unexpected '" + y + "'");
802
- }, D, W = function() {
803
- var I = [];
804
- if (y === "[") {
805
- if (A("["), z(), y === "]")
806
- return A("]"), I;
807
- for (; y; ) {
808
- if (I.push(D()), z(), y === "]")
809
- return A("]"), I;
810
- A(","), z();
811
- }
812
- }
813
- J("Bad array");
814
- }, x = function() {
815
- var I, b = /* @__PURE__ */ Object.create(null);
816
- if (y === "{") {
817
- if (A("{"), z(), y === "}")
818
- return A("}"), b;
819
- for (; y; ) {
820
- if (I = $(), z(), A(":"), j.strict === !0 && Object.hasOwnProperty.call(b, I) && J('Duplicate key "' + I + '"'), ee.test(I) === !0 ? j.protoAction === "error" ? J("Object contains forbidden prototype property") : j.protoAction === "ignore" ? D() : b[I] = D() : N.test(I) === !0 ? j.constructorAction === "error" ? J("Object contains forbidden constructor property") : j.constructorAction === "ignore" ? D() : b[I] = D() : b[I] = D(), z(), y === "}")
821
- return A("}"), b;
822
- A(","), z();
823
- }
824
- }
825
- J("Bad object");
826
- };
827
- return D = function() {
828
- switch (z(), y) {
829
- case "{":
830
- return x();
831
- case "[":
832
- return W();
833
- case '"':
834
- return $();
835
- case "-":
836
- return P();
837
- default:
838
- return y >= "0" && y <= "9" ? P() : X();
839
- }
840
- }, function(I, b) {
841
- var V;
842
- return w = I + "", C = 0, y = " ", V = D(), z(), y && J("Syntax error"), typeof b == "function" ? function S(k, L) {
843
- var g, c = k[L];
844
- return c && typeof c == "object" && Object.keys(c).forEach(function(_) {
845
- g = S(c, _), g !== void 0 ? c[_] = g : delete c[_];
846
- }), b.call(k, L, c);
847
- }({ "": V }, "") : V;
848
- };
849
- };
850
- return be = ne, be;
851
- }
852
- var Re;
853
- function et() {
854
- if (Re) return we.exports;
855
- Re = 1;
856
- var G = Qe().stringify, ee = Ze();
857
- return we.exports = function(N) {
858
- return {
859
- parse: ee(N),
860
- stringify: G
861
- };
862
- }, we.exports.parse = ee(), we.exports.stringify = G, we.exports;
863
- }
864
- var tt = et();
865
- const nt = /* @__PURE__ */ Ye(tt), rt = { class: "json-node" }, it = {
1
+ import { defineComponent as z, useCssVars as Q, ref as C, computed as g, resolveComponent as X, createElementBlock as a, openBlock as u, createElementVNode as _, createCommentVNode as k, withDirectives as R, toDisplayString as $, withKeys as O, vModelText as q, createTextVNode as Y, Fragment as Z, renderList as ee, createVNode as W, normalizeClass as te, nextTick as K, watch as ne } from "vue";
2
+ const se = { class: "json-node" }, oe = {
866
3
  key: 0,
867
4
  class: "json-node__container"
868
- }, ot = { class: "json-node__line" }, st = {
5
+ }, le = { class: "json-node__line" }, re = {
869
6
  key: 2,
870
7
  class: "json-node__colon"
871
- }, lt = ["title"], ut = {
8
+ }, ae = ["title"], ue = {
872
9
  key: 3,
873
10
  class: "json-node__collapsed"
874
- }, at = {
11
+ }, ie = {
875
12
  key: 4,
876
13
  class: "json-node__comma"
877
- }, ft = {
14
+ }, ce = {
878
15
  key: 0,
879
16
  class: "json-node__children"
880
- }, ct = { class: "json-node__line" }, pt = { class: "json-node__bracket" }, dt = {
17
+ }, de = { class: "json-node__children-content" }, pe = { class: "json-node__line json-node__closing-bracket" }, fe = { class: "json-node__bracket" }, ve = {
881
18
  key: 0,
882
19
  class: "json-node__comma"
883
- }, gt = {
20
+ }, _e = {
884
21
  key: 1,
885
22
  class: "json-node__primitive"
886
- }, ht = {
23
+ }, ye = {
887
24
  key: 2,
888
25
  class: "json-node__colon"
889
- }, vt = ["title"], yt = {
26
+ }, me = ["title"], ke = {
890
27
  key: 5,
891
28
  class: "json-node__comma"
892
- }, mt = /* @__PURE__ */ De({
29
+ }, ge = /* @__PURE__ */ z({
893
30
  name: "JsonNode",
894
31
  __name: "JsonNode",
895
32
  props: {
@@ -901,196 +38,198 @@ const nt = /* @__PURE__ */ Ye(tt), rt = { class: "json-node" }, it = {
901
38
  isLast: { type: Boolean, default: !1 }
902
39
  },
903
40
  emits: ["update:value", "toggle-expand", "copy", "update:key"],
904
- setup(G, { emit: ee }) {
905
- Me((p) => ({
906
- "623b775d": p.level
41
+ setup(h, { emit: b }) {
42
+ Q((e) => ({
43
+ 56869946: e.level
907
44
  }));
908
- const N = G, ne = ee, O = ye(!1), j = ye(!1), C = ye(""), y = ye(""), T = (p) => {
909
- if (!/^-?\d+(\.\d+)?$/.test(p)) return !1;
910
- const h = Number(p);
911
- return !Number.isSafeInteger(h) || p.length > 15;
912
- }, w = fe(() => N.value !== null && typeof N.value == "object"), J = fe(() => Array.isArray(N.value)), A = fe(() => N.path ? N.path : N.keyName ? N.keyName : "root"), P = fe(() => N.expanded.has(A.value)), $ = fe(() => N.keyName), z = fe(() => J.value ? "[" : "{"), X = fe(() => J.value ? "]" : "}"), D = fe(() => {
913
- if (!N.value) return "";
914
- const h = Object.keys(N.value).length;
915
- return J.value ? h > 0 ? ` ${h} items ` : " " : h > 0 ? ` ${h} keys ` : " ";
916
- }), W = fe(() => {
917
- const p = typeof N.value;
918
- return N.value === null ? "json-node__value--null" : p === "boolean" ? "json-node__value--boolean" : p === "number" ? "json-node__value--number" : p === "string" ? T(N.value) ? "json-node__value--number" : "json-node__value--string" : "";
919
- }), x = fe(() => j.value ? y.value : N.value === null ? "null" : typeof N.value == "boolean" || typeof N.value == "number" ? String(N.value) : typeof N.value == "string" ? T(N.value) ? N.value : `"${N.value}"` : String(N.value)), I = fe(() => "Click to edit, double-click to copy"), b = (p) => N.level === 0 ? p : A.value ? `${A.value}.${p}` : p, V = (p) => {
920
- const h = Object.keys(N.value);
921
- return h.indexOf(p) === h.length - 1;
922
- }, S = () => {
923
- ne("toggle-expand", A.value);
924
- }, k = () => {
925
- N.level !== 0 && (O.value = !0, C.value = N.keyName, Pe(() => {
926
- const p = document.querySelectorAll(".json-node__key-input"), h = p[p.length - 1];
927
- h && (h.focus(), h.select());
45
+ const o = h, j = b, d = C(!1), p = C(!1), y = C(""), c = C(""), m = (e) => {
46
+ if (!/^-?\d+(\.\d+)?$/.test(e)) return !1;
47
+ const t = Number(e);
48
+ return !Number.isSafeInteger(t) || e.length > 15;
49
+ }, w = g(() => o.value !== null && typeof o.value == "object"), S = g(() => Array.isArray(o.value)), N = g(() => o.path ? o.path : o.keyName ? o.keyName : "root"), J = g(() => o.expanded.has(N.value)), x = g(() => o.keyName), I = g(() => S.value ? "[" : "{"), E = g(() => S.value ? "]" : "}"), F = g(() => {
50
+ if (!o.value) return "";
51
+ const t = Object.keys(o.value).length;
52
+ return S.value ? t > 0 ? ` ${t} items ` : " " : t > 0 ? ` ${t} keys ` : " ";
53
+ }), U = g(() => {
54
+ const e = typeof o.value;
55
+ return o.value === null ? "json-node__value--null" : e === "boolean" ? "json-node__value--boolean" : e === "number" ? "json-node__value--number" : e === "string" ? m(o.value) ? "json-node__value--number" : "json-node__value--string" : "";
56
+ }), T = g(() => p.value ? c.value : o.value === null ? "null" : typeof o.value == "boolean" || typeof o.value == "number" ? String(o.value) : typeof o.value == "string" ? m(o.value) ? o.value : `"${o.value}"` : String(o.value)), P = g(() => "Click to edit, double-click to copy"), L = (e) => o.level === 0 ? e : N.value ? `${N.value}.${e}` : e, M = (e) => {
57
+ const t = Object.keys(o.value);
58
+ return t.indexOf(e) === t.length - 1;
59
+ }, A = () => {
60
+ j("toggle-expand", N.value);
61
+ }, B = () => {
62
+ o.level !== 0 && (d.value = !0, y.value = o.keyName, K(() => {
63
+ const e = document.querySelectorAll(".json-node__key-input"), t = e[e.length - 1];
64
+ t && (t.focus(), t.select());
928
65
  }));
929
- }, L = () => {
930
- w.value || (j.value = !0, typeof N.value == "string" && T(N.value) || typeof N.value == "string" ? y.value = N.value : y.value = String(N.value), Pe(() => {
931
- const p = document.querySelectorAll(".json-node__value-input"), h = p[p.length - 1];
932
- h && (h.focus(), h.select());
66
+ }, D = () => {
67
+ w.value || (p.value = !0, typeof o.value == "string" && m(o.value) || typeof o.value == "string" ? c.value = o.value : c.value = String(o.value), K(() => {
68
+ const e = document.querySelectorAll(".json-node__value-input"), t = e[e.length - 1];
69
+ t && (t.focus(), t.select());
933
70
  }));
934
- }, g = () => {
935
- if (N.level === 0 || !O.value) return;
936
- const p = C.value.trim();
937
- if (!p) {
938
- _();
71
+ }, V = () => {
72
+ if (o.level === 0 || !d.value) return;
73
+ const e = y.value.trim();
74
+ if (!e) {
75
+ s();
939
76
  return;
940
77
  }
941
- if (p === N.keyName) {
942
- O.value = !1;
78
+ if (e === o.keyName) {
79
+ d.value = !1;
943
80
  return;
944
81
  }
945
- O.value = !1, ne("update:key", A.value, p);
946
- }, c = () => {
82
+ d.value = !1, j("update:key", N.value, e);
83
+ }, n = () => {
947
84
  try {
948
- let p;
949
- const h = y.value.trim();
950
- if (h === "null")
951
- p = null;
952
- else if (h === "true" || h === "false")
953
- p = h === "true";
954
- else if (!isNaN(Number(h)) && h !== "") {
955
- const U = Number(h);
956
- !Number.isSafeInteger(U) || h.length > 15 ? p = h : p = U;
85
+ let e;
86
+ const t = c.value.trim();
87
+ if (t === "null")
88
+ e = null;
89
+ else if (t === "true" || t === "false")
90
+ e = t === "true";
91
+ else if (!isNaN(Number(t)) && t !== "") {
92
+ const l = Number(t);
93
+ !Number.isSafeInteger(l) || t.length > 15 ? e = t : e = l;
957
94
  } else
958
- p = y.value;
959
- ne("update:value", A.value, p), j.value = !1;
960
- } catch (p) {
961
- console.error("Failed to parse value:", p), j.value = !1;
95
+ e = c.value;
96
+ j("update:value", N.value, e), p.value = !1;
97
+ } catch (e) {
98
+ console.error("Failed to parse value:", e), p.value = !1;
962
99
  }
963
- }, _ = () => {
964
- O.value = !1, C.value = N.keyName;
965
- }, m = () => {
966
- j.value = !1, typeof N.value == "string" && T(N.value) || typeof N.value == "string" ? y.value = N.value : y.value = String(N.value);
100
+ }, s = () => {
101
+ d.value = !1, y.value = o.keyName;
102
+ }, r = () => {
103
+ p.value = !1, typeof o.value == "string" && m(o.value) || typeof o.value == "string" ? c.value = o.value : c.value = String(o.value);
967
104
  };
968
- return (p, h) => {
969
- const U = qe("JsonNode", !0);
970
- return K(), Y("div", rt, [
971
- w.value ? (K(), Y("div", it, [
972
- le("div", ot, [
973
- p.keyName && !O.value ? (K(), Y("span", {
105
+ return (e, t) => {
106
+ const l = X("JsonNode", !0);
107
+ return u(), a("div", se, [
108
+ w.value ? (u(), a("div", oe, [
109
+ _("div", le, [
110
+ e.keyName && !d.value ? (u(), a("span", {
974
111
  key: 0,
975
112
  class: "json-node__key",
976
- onClick: k,
113
+ onClick: B,
977
114
  title: "Click to edit key"
978
- }, ' "' + he($.value) + '" ', 1)) : se("", !0),
979
- p.keyName && O.value ? je((K(), Y("input", {
115
+ }, ' "' + $(x.value) + '" ', 1)) : k("", !0),
116
+ e.keyName && d.value ? R((u(), a("input", {
980
117
  key: 1,
981
- "onUpdate:modelValue": h[0] || (h[0] = (M) => C.value = M),
118
+ "onUpdate:modelValue": t[0] || (t[0] = (i) => y.value = i),
982
119
  onKeyup: [
983
- me(g, ["enter"]),
984
- me(_, ["escape"])
120
+ O(V, ["enter"]),
121
+ O(s, ["escape"])
985
122
  ],
986
- onBlur: g,
123
+ onBlur: V,
987
124
  class: "json-node__key-input"
988
125
  }, null, 544)), [
989
- [Ce, C.value]
990
- ]) : se("", !0),
991
- p.keyName ? (K(), Y("span", st, ": ")) : se("", !0),
992
- le("span", {
126
+ [q, y.value]
127
+ ]) : k("", !0),
128
+ e.keyName ? (u(), a("span", re, ": ")) : k("", !0),
129
+ _("span", {
993
130
  class: "json-node__bracket json-node__bracket--clickable",
994
- onClick: S,
995
- title: P.value ? "Click to collapse" : "Click to expand"
996
- }, he(z.value), 9, lt),
997
- P.value ? se("", !0) : (K(), Y("span", ut, [
998
- Ge(he(D.value) + " ", 1),
999
- le("span", {
131
+ onClick: A,
132
+ title: J.value ? "Click to collapse" : "Click to expand"
133
+ }, $(I.value), 9, ae),
134
+ J.value ? k("", !0) : (u(), a("span", ue, [
135
+ Y($(F.value) + " ", 1),
136
+ _("span", {
1000
137
  class: "json-node__bracket json-node__bracket--clickable",
1001
- onClick: S
1002
- }, he(X.value), 1)
138
+ onClick: A
139
+ }, $(E.value), 1)
1003
140
  ])),
1004
- !P.value && !p.isLast ? (K(), Y("span", at, ",")) : se("", !0)
141
+ !J.value && !e.isLast ? (u(), a("span", ie, ",")) : k("", !0)
1005
142
  ]),
1006
- P.value ? (K(), Y("div", ft, [
1007
- (K(!0), Y(ze, null, He(p.value, (M, H) => (K(), Y("div", {
1008
- key: H,
1009
- class: "json-node__child"
1010
- }, [
1011
- Ue(U, {
1012
- value: M,
1013
- "key-name": J.value ? "" : String(H),
1014
- level: p.level + 1,
1015
- path: b(String(H)),
1016
- expanded: p.expanded,
1017
- "onUpdate:value": h[1] || (h[1] = (ie, pe) => p.$emit("update:value", ie, pe)),
1018
- onToggleExpand: h[2] || (h[2] = (ie) => p.$emit("toggle-expand", ie)),
1019
- onCopy: h[3] || (h[3] = (ie) => p.$emit("copy", ie)),
1020
- "onUpdate:key": h[4] || (h[4] = (ie, pe) => p.$emit("update:key", ie, pe)),
1021
- "is-last": V(String(H))
1022
- }, null, 8, ["value", "key-name", "level", "path", "expanded", "is-last"])
1023
- ]))), 128)),
1024
- le("div", ct, [
1025
- le("span", pt, he(X.value), 1),
1026
- p.isLast ? se("", !0) : (K(), Y("span", dt, ","))
143
+ J.value ? (u(), a("div", ce, [
144
+ _("div", de, [
145
+ (u(!0), a(Z, null, ee(e.value, (i, v) => (u(), a("div", {
146
+ key: v,
147
+ class: "json-node__child"
148
+ }, [
149
+ W(l, {
150
+ value: i,
151
+ "key-name": S.value ? "" : String(v),
152
+ level: e.level + 1,
153
+ path: L(String(v)),
154
+ expanded: e.expanded,
155
+ "onUpdate:value": t[1] || (t[1] = (f, G) => e.$emit("update:value", f, G)),
156
+ onToggleExpand: t[2] || (t[2] = (f) => e.$emit("toggle-expand", f)),
157
+ onCopy: t[3] || (t[3] = (f) => e.$emit("copy", f)),
158
+ "onUpdate:key": t[4] || (t[4] = (f, G) => e.$emit("update:key", f, G)),
159
+ "is-last": M(String(v))
160
+ }, null, 8, ["value", "key-name", "level", "path", "expanded", "is-last"])
161
+ ]))), 128))
162
+ ]),
163
+ _("div", pe, [
164
+ _("span", fe, $(E.value), 1),
165
+ e.isLast ? k("", !0) : (u(), a("span", ve, ","))
1027
166
  ])
1028
- ])) : se("", !0)
1029
- ])) : (K(), Y("div", gt, [
1030
- p.keyName && !O.value ? (K(), Y("span", {
167
+ ])) : k("", !0)
168
+ ])) : (u(), a("div", _e, [
169
+ e.keyName && !d.value ? (u(), a("span", {
1031
170
  key: 0,
1032
171
  class: "json-node__key",
1033
- onClick: k,
172
+ onClick: B,
1034
173
  title: "Click to edit key"
1035
- }, ' "' + he($.value) + '" ', 1)) : se("", !0),
1036
- p.keyName && O.value ? je((K(), Y("input", {
174
+ }, ' "' + $(x.value) + '" ', 1)) : k("", !0),
175
+ e.keyName && d.value ? R((u(), a("input", {
1037
176
  key: 1,
1038
- "onUpdate:modelValue": h[5] || (h[5] = (M) => C.value = M),
177
+ "onUpdate:modelValue": t[5] || (t[5] = (i) => y.value = i),
1039
178
  onKeyup: [
1040
- me(g, ["enter"]),
1041
- me(_, ["escape"])
179
+ O(V, ["enter"]),
180
+ O(s, ["escape"])
1042
181
  ],
1043
- onBlur: g,
182
+ onBlur: V,
1044
183
  class: "json-node__key-input"
1045
184
  }, null, 544)), [
1046
- [Ce, C.value]
1047
- ]) : se("", !0),
1048
- p.keyName ? (K(), Y("span", ht, ": ")) : se("", !0),
1049
- j.value ? se("", !0) : (K(), Y("span", {
185
+ [q, y.value]
186
+ ]) : k("", !0),
187
+ e.keyName ? (u(), a("span", ye, ": ")) : k("", !0),
188
+ p.value ? k("", !0) : (u(), a("span", {
1050
189
  key: 3,
1051
- class: Xe(["json-node__value", W.value]),
1052
- onClick: L,
1053
- onDblclick: h[6] || (h[6] = (M) => p.$emit("copy", p.value)),
1054
- title: I.value
1055
- }, he(x.value), 43, vt)),
1056
- j.value ? je((K(), Y("input", {
190
+ class: te(["json-node__value", U.value]),
191
+ onClick: D,
192
+ onDblclick: t[6] || (t[6] = (i) => e.$emit("copy", e.value)),
193
+ title: P.value
194
+ }, $(T.value), 43, me)),
195
+ p.value ? R((u(), a("input", {
1057
196
  key: 4,
1058
- "onUpdate:modelValue": h[7] || (h[7] = (M) => y.value = M),
197
+ "onUpdate:modelValue": t[7] || (t[7] = (i) => c.value = i),
1059
198
  onKeyup: [
1060
- me(c, ["enter"]),
1061
- me(m, ["escape"])
199
+ O(n, ["enter"]),
200
+ O(r, ["escape"])
1062
201
  ],
1063
- onBlur: c,
202
+ onBlur: n,
1064
203
  class: "json-node__value-input"
1065
204
  }, null, 544)), [
1066
- [Ce, y.value]
1067
- ]) : se("", !0),
1068
- p.isLast ? se("", !0) : (K(), Y("span", yt, ","))
205
+ [q, c.value]
206
+ ]) : k("", !0),
207
+ e.isLast ? k("", !0) : (u(), a("span", ke, ","))
1069
208
  ]))
1070
209
  ]);
1071
210
  };
1072
211
  }
1073
- }), Ve = (G, ee) => {
1074
- const N = G.__vccOpts || G;
1075
- for (const [ne, O] of ee)
1076
- N[ne] = O;
1077
- return N;
1078
- }, _t = /* @__PURE__ */ Ve(mt, [["__scopeId", "data-v-ac834fbd"]]), wt = { class: "json-format" }, Nt = {
212
+ }), H = (h, b) => {
213
+ const o = h.__vccOpts || h;
214
+ for (const [j, d] of b)
215
+ o[j] = d;
216
+ return o;
217
+ }, Ne = /* @__PURE__ */ H(ge, [["__scopeId", "data-v-5a60a3b2"]]), be = { class: "json-format" }, je = {
1079
218
  key: 0,
1080
219
  class: "json-format__toolbar"
1081
- }, At = { class: "json-format__actions" }, kt = ["disabled"], Et = ["disabled"], Ot = ["disabled"], xt = { class: "json-format__info" }, St = {
220
+ }, he = { class: "json-format__actions" }, $e = ["disabled"], Se = ["disabled"], Je = ["disabled"], Ae = ["disabled"], Ce = { class: "json-format__info" }, Ee = {
1082
221
  key: 0,
1083
222
  class: "json-format__status json-format__status--success"
1084
- }, Bt = {
223
+ }, Ve = {
1085
224
  key: 1,
1086
225
  class: "json-format__status json-format__status--error"
1087
- }, jt = { class: "json-format__content" }, Ct = {
226
+ }, Oe = { class: "json-format__content" }, we = {
1088
227
  key: 0,
1089
228
  class: "json-format__error"
1090
- }, It = {
229
+ }, Be = {
1091
230
  key: 1,
1092
231
  class: "json-format__viewer"
1093
- }, bt = /* @__PURE__ */ De({
232
+ }, xe = /* @__PURE__ */ z({
1094
233
  name: "JsonFormat",
1095
234
  __name: "index",
1096
235
  props: {
@@ -1099,217 +238,242 @@ const nt = /* @__PURE__ */ Ye(tt), rt = { class: "json-node" }, it = {
1099
238
  maxDepth: { default: 10 },
1100
239
  showToolbar: { type: Boolean, default: !0 }
1101
240
  },
1102
- emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all"],
1103
- setup(G, { expose: ee, emit: N }) {
1104
- const ne = nt({
1105
- storeAsString: !0,
1106
- // 将大数存储为字符串
1107
- useNativeBigInt: !1
1108
- }), O = G, j = N, C = ye(null), y = ye(""), T = ye(/* @__PURE__ */ new Set()), w = fe(() => y.value === ""), J = (g) => {
1109
- if (!g.trim()) {
1110
- C.value = null, y.value = "";
241
+ emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress"],
242
+ setup(h, { expose: b, emit: o }) {
243
+ const j = h, d = o, p = C(null), y = C(""), c = C(/* @__PURE__ */ new Set()), m = g(() => y.value === ""), w = (n) => {
244
+ if (!n.trim()) {
245
+ p.value = null, y.value = "";
1111
246
  return;
1112
247
  }
1113
248
  try {
1114
- C.value = ne.parse(g), y.value = "", Pe(() => {
1115
- C.value !== null && z();
249
+ let s = n;
250
+ s = s.replace(/:\s*(\d{16,})\s*([,}])/g, ': "$1"$2'), s = s.replace(/:\s*(\d+\.\d*?0+)\s*([,}])/g, ': "$1"$2'), p.value = JSON.parse(s), y.value = "", K(() => {
251
+ p.value !== null && E();
1116
252
  });
1117
- } catch (c) {
1118
- y.value = c instanceof Error ? c.message : "Unknown parsing error", C.value = null;
253
+ } catch (s) {
254
+ y.value = s instanceof Error ? s.message : "Unknown parsing error", p.value = null;
1119
255
  }
1120
256
  };
1121
- We(() => O.modelValue, (g) => {
1122
- J(g);
257
+ ne(() => j.modelValue, (n) => {
258
+ w(n);
1123
259
  }, { immediate: !0 });
1124
- const A = (g, c) => {
1125
- if (!O.readonly)
260
+ const S = (n) => {
261
+ if (!/^-?\d+(\.\d+)?$/.test(n)) return !1;
262
+ const s = Number(n);
263
+ return !Number.isSafeInteger(s) || n.length > 15;
264
+ }, N = (n, s, r) => JSON.stringify(n, (e, t) => {
265
+ if (typeof t == "string" && S(t))
266
+ return `__BIG_NUMBER__${t}__BIG_NUMBER__`;
267
+ if (typeof t == "string" && /^-?\d+(\.\d+)?$/.test(t)) {
268
+ const l = Number(t);
269
+ if (Number.isSafeInteger(l) && l.toString() === t)
270
+ return l;
271
+ if (!Number.isNaN(l) && isFinite(l) && t.includes("."))
272
+ return l.toString() === t ? l : t;
273
+ if (!Number.isNaN(l) && isFinite(l))
274
+ return l;
275
+ }
276
+ return s && typeof s == "function" ? s(e, t) : t;
277
+ }, r).replace(/"__BIG_NUMBER__(.+?)__BIG_NUMBER__"/g, "$1"), J = (n, s) => {
278
+ if (!j.readonly)
1126
279
  try {
1127
- const _ = P(C.value, g, c), m = ne.stringify(_, null, 2);
1128
- j("update:modelValue", m);
1129
- } catch (_) {
1130
- console.error("Failed to update JSON:", _);
280
+ const r = x(p.value, n, s), e = N(r, null, 2);
281
+ d("update:modelValue", e);
282
+ } catch (r) {
283
+ console.error("Failed to update JSON:", r);
1131
284
  }
1132
- }, P = (g, c, _) => {
1133
- if (!c || c === "root") return _;
1134
- const m = c.split("."), p = V(g, m.slice(0, -1));
1135
- let h = p;
1136
- for (let M = 0; M < m.length - 1; M++) {
1137
- const H = m[M];
1138
- H !== "root" && (Array.isArray(h) ? h = h[parseInt(H)] : h = h[H]);
285
+ }, x = (n, s, r) => {
286
+ if (!s || s === "root") return r;
287
+ const e = s.split("."), t = A(n, e.slice(0, -1));
288
+ let l = t;
289
+ for (let v = 0; v < e.length - 1; v++) {
290
+ const f = e[v];
291
+ f !== "root" && (Array.isArray(l) ? l = l[parseInt(f)] : l = l[f]);
1139
292
  }
1140
- const U = m[m.length - 1];
1141
- return U === "root" ? _ : (Array.isArray(h) ? h[parseInt(U)] = _ : h[U] = _, p);
1142
- }, $ = (g) => {
1143
- T.value.has(g) ? T.value.delete(g) : T.value.add(g);
1144
- }, z = () => {
1145
- const g = /* @__PURE__ */ new Set(), c = (_, m = "") => {
1146
- _ !== null && typeof _ == "object" && (g.add(m || "root"), Array.isArray(_) ? _.forEach((p, h) => {
1147
- const U = m ? `${m}.${h}` : `${h}`;
1148
- c(p, U);
1149
- }) : Object.keys(_).forEach((p) => {
1150
- const h = m ? `${m}.${p}` : p;
1151
- c(_[p], h);
293
+ const i = e[e.length - 1];
294
+ return i === "root" ? r : (Array.isArray(l) ? l[parseInt(i)] = r : l[i] = r, t);
295
+ }, I = (n) => {
296
+ c.value.has(n) ? c.value.delete(n) : c.value.add(n);
297
+ }, E = () => {
298
+ const n = /* @__PURE__ */ new Set(), s = (r, e = "") => {
299
+ r !== null && typeof r == "object" && (n.add(e || "root"), Array.isArray(r) ? r.forEach((t, l) => {
300
+ const i = e ? `${e}.${l}` : `${l}`;
301
+ s(t, i);
302
+ }) : Object.keys(r).forEach((t) => {
303
+ const l = e ? `${e}.${t}` : t;
304
+ s(r[t], l);
1152
305
  }));
1153
306
  };
1154
- c(C.value), T.value = g, j("expand-all");
1155
- }, X = () => {
1156
- T.value = /* @__PURE__ */ new Set(["root"]), j("collapse-all");
1157
- }, D = async () => {
1158
- if (w.value)
307
+ s(p.value), c.value = n, d("expand-all");
308
+ }, F = () => {
309
+ c.value = /* @__PURE__ */ new Set(["root"]), d("collapse-all");
310
+ }, U = async () => {
311
+ if (m.value)
1159
312
  try {
1160
- const c = JSON.stringify(C.value, null, 2).replace(/"(\d{16,})"/g, "$1");
1161
- await navigator.clipboard.writeText(c), j("copy-success", c);
1162
- } catch (g) {
1163
- console.error("Failed to copy JSON:", g), j("copy-error", g instanceof Error ? g : new Error("Failed to copy JSON"));
313
+ const s = JSON.stringify(p.value, null, 2).replace(/"(\d{16,})"/g, "$1");
314
+ await navigator.clipboard.writeText(s), d("copy-success", s);
315
+ } catch (n) {
316
+ console.error("Failed to copy JSON:", n), d("copy-error", n instanceof Error ? n : new Error("Failed to copy JSON"));
1164
317
  }
1165
- }, W = (g) => {
1166
- if (!/^-?\d+(\.\d+)?$/.test(g)) return !1;
1167
- const c = Number(g);
1168
- return !Number.isSafeInteger(c) || g.length > 15;
1169
- }, x = async (g) => {
318
+ }, T = () => {
319
+ if (m.value)
320
+ try {
321
+ const n = N(p.value);
322
+ d("update:modelValue", n), d("compress", n);
323
+ } catch (n) {
324
+ console.error("Failed to compress JSON:", n);
325
+ }
326
+ }, P = async (n) => {
1170
327
  try {
1171
- let c;
1172
- typeof g == "string" && W(g) ? c = g : typeof g == "string" ? c = `"${g}"` : c = JSON.stringify(g), await navigator.clipboard.writeText(c);
1173
- } catch (c) {
1174
- console.error("Failed to copy value:", c);
328
+ let s;
329
+ typeof n == "string" && S(n) ? s = n : typeof n == "string" ? s = `"${n}"` : s = JSON.stringify(n), await navigator.clipboard.writeText(s);
330
+ } catch (s) {
331
+ console.error("Failed to copy value:", s);
1175
332
  }
1176
- }, I = (g, c) => {
1177
- if (!O.readonly)
333
+ }, L = (n, s) => {
334
+ if (!j.readonly)
1178
335
  try {
1179
- const _ = b(C.value, g, c), m = ne.stringify(_, null, 2);
1180
- j("update:modelValue", m), L(g, c);
1181
- } catch (_) {
1182
- console.error("Failed to rename key:", _);
336
+ const r = M(p.value, n, s), e = N(r, null, 2);
337
+ d("update:modelValue", e), V(n, s);
338
+ } catch (r) {
339
+ console.error("Failed to rename key:", r);
1183
340
  }
1184
- }, b = (g, c, _) => {
1185
- if (!c || c === "root") return g;
1186
- const m = c.split("."), p = V(g, m.slice(0, -1));
1187
- if (m.length === 1) {
1188
- const M = m[0];
1189
- return p && typeof p == "object" && !Array.isArray(p) ? S(p, M, _) : p;
341
+ }, M = (n, s, r) => {
342
+ if (!s || s === "root") return n;
343
+ const e = s.split("."), t = A(n, e.slice(0, -1));
344
+ if (e.length === 1) {
345
+ const v = e[0];
346
+ return t && typeof t == "object" && !Array.isArray(t) ? B(t, v, r) : t;
1190
347
  }
1191
- let h = p;
1192
- for (let M = 0; M < m.length - 1; M++) {
1193
- const H = m[M];
1194
- Array.isArray(h) ? h = h[parseInt(H)] : h = h[H];
348
+ let l = t;
349
+ for (let v = 0; v < e.length - 1; v++) {
350
+ const f = e[v];
351
+ Array.isArray(l) ? l = l[parseInt(f)] : l = l[f];
1195
352
  }
1196
- const U = m[m.length - 1];
1197
- if (!Array.isArray(h) && h && typeof h == "object") {
1198
- const M = S(h, U, _), H = m.slice(0, -1);
1199
- H.length > 0 && k(p, H, M);
353
+ const i = e[e.length - 1];
354
+ if (!Array.isArray(l) && l && typeof l == "object") {
355
+ const v = B(l, i, r), f = e.slice(0, -1);
356
+ f.length > 0 && D(t, f, v);
1200
357
  }
1201
- return p;
1202
- }, V = (g, c) => {
1203
- if (c.length === 0) return g;
1204
- if (Array.isArray(g)) {
1205
- const _ = [...g], m = c[0], p = parseInt(m);
1206
- return c.length === 1 || (_[p] = V(g[p], c.slice(1))), _;
1207
- } else if (g && typeof g == "object") {
1208
- const _ = { ...g }, m = c[0];
1209
- return c.length === 1 || (_[m] = V(g[m], c.slice(1))), _;
358
+ return t;
359
+ }, A = (n, s) => {
360
+ if (s.length === 0) return n;
361
+ if (Array.isArray(n)) {
362
+ const r = [...n], e = s[0], t = parseInt(e);
363
+ return s.length === 1 || (r[t] = A(n[t], s.slice(1))), r;
364
+ } else if (n && typeof n == "object") {
365
+ const r = { ...n }, e = s[0];
366
+ return s.length === 1 || (r[e] = A(n[e], s.slice(1))), r;
1210
367
  }
1211
- return g;
1212
- }, S = (g, c, _) => {
1213
- if (!g || typeof g != "object" || Array.isArray(g))
1214
- return g;
1215
- const m = Object.keys(g), p = {};
1216
- for (const h of m)
1217
- h === c ? p[_] = g[h] : p[h] = g[h];
1218
- return p;
1219
- }, k = (g, c, _) => {
1220
- let m = g;
1221
- for (let h = 0; h < c.length - 1; h++) {
1222
- const U = c[h];
1223
- Array.isArray(m) ? m = m[parseInt(U)] : m = m[U];
368
+ return n;
369
+ }, B = (n, s, r) => {
370
+ if (!n || typeof n != "object" || Array.isArray(n))
371
+ return n;
372
+ const e = Object.keys(n), t = {};
373
+ for (const l of e)
374
+ l === s ? t[r] = n[l] : t[l] = n[l];
375
+ return t;
376
+ }, D = (n, s, r) => {
377
+ let e = n;
378
+ for (let l = 0; l < s.length - 1; l++) {
379
+ const i = s[l];
380
+ Array.isArray(e) ? e = e[parseInt(i)] : e = e[i];
1224
381
  }
1225
- const p = c[c.length - 1];
1226
- Array.isArray(m) ? m[parseInt(p)] = _ : m[p] = _;
1227
- }, L = (g, c) => {
1228
- const _ = /* @__PURE__ */ new Set();
1229
- T.value.forEach((m) => {
1230
- if (m === g) {
1231
- const p = g.split(".");
1232
- p[p.length - 1] = c, _.add(p.join("."));
1233
- } else if (m.startsWith(g + ".")) {
1234
- const p = g.split(".");
1235
- p[p.length - 1] = c;
1236
- const h = p.join("."), U = m.substring(g.length);
1237
- _.add(h + U);
382
+ const t = s[s.length - 1];
383
+ Array.isArray(e) ? e[parseInt(t)] = r : e[t] = r;
384
+ }, V = (n, s) => {
385
+ const r = /* @__PURE__ */ new Set();
386
+ c.value.forEach((e) => {
387
+ if (e === n) {
388
+ const t = n.split(".");
389
+ t[t.length - 1] = s, r.add(t.join("."));
390
+ } else if (e.startsWith(n + ".")) {
391
+ const t = n.split(".");
392
+ t[t.length - 1] = s;
393
+ const l = t.join("."), i = e.substring(n.length);
394
+ r.add(l + i);
1238
395
  } else
1239
- _.add(m);
1240
- }), T.value = _;
396
+ r.add(e);
397
+ }), c.value = r;
1241
398
  };
1242
- return ee({
399
+ return b({
1243
400
  // 核心操作方法
1244
- copyJson: D,
1245
- expandAll: z,
1246
- collapseAll: X,
1247
- toggleExpand: $,
1248
- updateValue: A,
1249
- updateKey: I,
401
+ copyJson: U,
402
+ compressSource: T,
403
+ expandAll: E,
404
+ collapseAll: F,
405
+ toggleExpand: I,
406
+ updateValue: J,
407
+ updateKey: L,
1250
408
  // 状态访问方法
1251
- isValidJson: () => w.value,
1252
- getParsedJson: () => C.value,
1253
- getExpandedNodes: () => T.value,
409
+ isValidJson: () => m.value,
410
+ getParsedJson: () => p.value,
411
+ getExpandedNodes: () => c.value,
1254
412
  getParseError: () => y.value,
1255
413
  // 工具方法
1256
- parseJson: (g) => J(g),
1257
- copyValue: (g) => x(g)
1258
- }), (g, c) => (K(), Y("div", wt, [
1259
- g.showToolbar ? (K(), Y("div", Nt, [
1260
- le("div", At, [
1261
- le("button", {
414
+ parseJson: (n) => w(n),
415
+ copyValue: (n) => P(n)
416
+ }), (n, s) => (u(), a("div", be, [
417
+ n.showToolbar ? (u(), a("div", je, [
418
+ _("div", he, [
419
+ _("button", {
1262
420
  class: "json-format__btn json-format__btn--primary",
1263
- onClick: D,
1264
- disabled: !w.value,
421
+ onClick: U,
422
+ disabled: !m.value,
1265
423
  title: "Copy JSON"
1266
- }, " 📋 Copy ", 8, kt),
1267
- le("button", {
424
+ }, " 📋 Copy ", 8, $e),
425
+ _("button", {
1268
426
  class: "json-format__btn json-format__btn--secondary",
1269
- onClick: z,
1270
- disabled: !w.value,
427
+ onClick: E,
428
+ disabled: !m.value,
1271
429
  title: "Expand All"
1272
- }, " ⬇️ Expand All ", 8, Et),
1273
- le("button", {
430
+ }, " ⬇️ Expand All ", 8, Se),
431
+ _("button", {
1274
432
  class: "json-format__btn json-format__btn--secondary",
1275
- onClick: X,
1276
- disabled: !w.value,
433
+ onClick: F,
434
+ disabled: !m.value,
1277
435
  title: "Collapse All"
1278
- }, " ➡️ Collapse All ", 8, Ot)
436
+ }, " ➡️ Collapse All ", 8, Je),
437
+ _("button", {
438
+ class: "json-format__btn json-format__btn--secondary",
439
+ onClick: T,
440
+ disabled: !m.value,
441
+ title: "Compress JSON"
442
+ }, " 📦 Compress ", 8, Ae)
1279
443
  ]),
1280
- le("div", xt, [
1281
- w.value ? (K(), Y("span", St, " ✅ Valid JSON ")) : (K(), Y("span", Bt, " ❌ Invalid JSON "))
444
+ _("div", Ce, [
445
+ m.value ? (u(), a("span", Ee, " ✅ Valid JSON ")) : (u(), a("span", Ve, " ❌ Invalid JSON "))
1282
446
  ])
1283
- ])) : se("", !0),
1284
- le("div", jt, [
1285
- w.value ? (K(), Y("div", It, [
1286
- Ue(_t, {
1287
- value: C.value,
447
+ ])) : k("", !0),
448
+ _("div", Oe, [
449
+ m.value ? (u(), a("div", Be, [
450
+ W(Ne, {
451
+ value: p.value,
1288
452
  "key-name": "",
1289
453
  level: 0,
1290
- expanded: T.value,
454
+ expanded: c.value,
1291
455
  "is-last": !0,
1292
- "onUpdate:value": A,
1293
- onToggleExpand: $,
1294
- onCopy: x,
1295
- "onUpdate:key": I
456
+ "onUpdate:value": J,
457
+ onToggleExpand: I,
458
+ onCopy: P,
459
+ "onUpdate:key": L
1296
460
  }, null, 8, ["value", "expanded"])
1297
- ])) : (K(), Y("div", Ct, [
1298
- c[0] || (c[0] = le("h4", null, "JSON Parse Error:", -1)),
1299
- le("pre", null, he(y.value), 1)
461
+ ])) : (u(), a("div", we, [
462
+ s[0] || (s[0] = _("h4", null, "JSON Parse Error:", -1)),
463
+ _("pre", null, $(y.value), 1)
1300
464
  ]))
1301
465
  ])
1302
466
  ]));
1303
467
  }
1304
- }), Pt = /* @__PURE__ */ Ve(bt, [["__scopeId", "data-v-ad2f6a66"]]), $t = [Pt], Tt = (G) => {
1305
- $t.forEach((ee) => {
1306
- const N = ee.name || ee.__name || "UnknownComponent";
1307
- G.component(N, ee);
468
+ }), Ie = /* @__PURE__ */ H(xe, [["__scopeId", "data-v-e91f0005"]]), Fe = [Ie], Ue = (h) => {
469
+ Fe.forEach((b) => {
470
+ const o = b.name || b.__name || "UnknownComponent";
471
+ h.component(o, b);
1308
472
  });
1309
- }, Jt = {
1310
- install: Tt
473
+ }, Pe = {
474
+ install: Ue
1311
475
  };
1312
476
  export {
1313
- Pt as JsonFormat,
1314
- Jt as default
477
+ Ie as JsonFormat,
478
+ Pe as default
1315
479
  };