lone-format 0.1.2 → 0.1.4

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,1333 @@
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;
1
+ import { defineComponent as ae, useCssVars as ue, ref as B, computed as j, resolveComponent as he, createElementBlock as w, openBlock as k, createElementVNode as P, createCommentVNode as N, withDirectives as te, toDisplayString as U, withKeys as X, vModelText as re, createTextVNode as ie, Fragment as de, renderList as fe, createVNode as le, normalizeClass as pe, nextTick as ee, watch as ye } from "vue";
2
+ class ge {
3
+ /**
4
+ * @callback HookCallback
5
+ * @this {*|Jsep} this
6
+ * @param {Jsep} env
7
+ * @returns: void
8
+ */
9
+ /**
10
+ * Adds the given callback to the list of callbacks for the given hook.
11
+ *
12
+ * The callback will be invoked when the hook it is registered for is run.
13
+ *
14
+ * One callback function can be registered to multiple hooks and the same hook multiple times.
15
+ *
16
+ * @param {string|object} name The name of the hook, or an object of callbacks keyed by name
17
+ * @param {HookCallback|boolean} callback The callback function which is given environment variables.
18
+ * @param {?boolean} [first=false] Will add the hook to the top of the list (defaults to the bottom)
19
+ * @public
20
+ */
21
+ add(e, t, s) {
22
+ if (typeof arguments[0] != "string")
23
+ for (let n in arguments[0])
24
+ this.add(n, arguments[0][n], arguments[1]);
25
+ else
26
+ (Array.isArray(e) ? e : [e]).forEach(function(n) {
27
+ this[n] = this[n] || [], t && this[n][s ? "unshift" : "push"](t);
28
+ }, this);
29
+ }
30
+ /**
31
+ * Runs a hook invoking all registered callbacks with the given environment variables.
32
+ *
33
+ * Callbacks will be invoked synchronously and in the order in which they were registered.
34
+ *
35
+ * @param {string} name The name of the hook.
36
+ * @param {Object<string, any>} env The environment variables of the hook passed to all callbacks registered.
37
+ * @public
38
+ */
39
+ run(e, t) {
40
+ this[e] = this[e] || [], this[e].forEach(function(s) {
41
+ s.call(t && t.context ? t.context : t, t);
42
+ });
43
+ }
4
44
  }
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;
45
+ class Ee {
46
+ constructor(e) {
47
+ this.jsep = e, this.registered = {};
48
+ }
49
+ /**
50
+ * @callback PluginSetup
51
+ * @this {Jsep} jsep
52
+ * @returns: void
53
+ */
54
+ /**
55
+ * Adds the given plugin(s) to the registry
56
+ *
57
+ * @param {object} plugins
58
+ * @param {string} plugins.name The name of the plugin
59
+ * @param {PluginSetup} plugins.init The init function
60
+ * @public
61
+ */
62
+ register() {
63
+ for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
64
+ t[s] = arguments[s];
65
+ t.forEach((n) => {
66
+ if (typeof n != "object" || !n.name || !n.init)
67
+ throw new Error("Invalid JSEP plugin format");
68
+ this.registered[n.name] || (n.init(this.jsep), this.registered[n.name] = n);
69
+ });
70
+ }
71
+ }
72
+ class i {
73
+ /**
74
+ * @returns {string}
75
+ */
76
+ static get version() {
77
+ return "1.4.0";
78
+ }
79
+ /**
80
+ * @returns {string}
81
+ */
82
+ static toString() {
83
+ return "JavaScript Expression Parser (JSEP) v" + i.version;
84
+ }
85
+ // ==================== CONFIG ================================
86
+ /**
87
+ * @method addUnaryOp
88
+ * @param {string} op_name The name of the unary op to add
89
+ * @returns {Jsep}
90
+ */
91
+ static addUnaryOp(e) {
92
+ return i.max_unop_len = Math.max(e.length, i.max_unop_len), i.unary_ops[e] = 1, i;
93
+ }
94
+ /**
95
+ * @method jsep.addBinaryOp
96
+ * @param {string} op_name The name of the binary op to add
97
+ * @param {number} precedence The precedence of the binary op (can be a float). Higher number = higher precedence
98
+ * @param {boolean} [isRightAssociative=false] whether operator is right-associative
99
+ * @returns {Jsep}
100
+ */
101
+ static addBinaryOp(e, t, s) {
102
+ return i.max_binop_len = Math.max(e.length, i.max_binop_len), i.binary_ops[e] = t, s ? i.right_associative.add(e) : i.right_associative.delete(e), i;
103
+ }
104
+ /**
105
+ * @method addIdentifierChar
106
+ * @param {string} char The additional character to treat as a valid part of an identifier
107
+ * @returns {Jsep}
108
+ */
109
+ static addIdentifierChar(e) {
110
+ return i.additional_identifier_chars.add(e), i;
111
+ }
112
+ /**
113
+ * @method addLiteral
114
+ * @param {string} literal_name The name of the literal to add
115
+ * @param {*} literal_value The value of the literal
116
+ * @returns {Jsep}
117
+ */
118
+ static addLiteral(e, t) {
119
+ return i.literals[e] = t, i;
120
+ }
121
+ /**
122
+ * @method removeUnaryOp
123
+ * @param {string} op_name The name of the unary op to remove
124
+ * @returns {Jsep}
125
+ */
126
+ static removeUnaryOp(e) {
127
+ return delete i.unary_ops[e], e.length === i.max_unop_len && (i.max_unop_len = i.getMaxKeyLen(i.unary_ops)), i;
128
+ }
129
+ /**
130
+ * @method removeAllUnaryOps
131
+ * @returns {Jsep}
132
+ */
133
+ static removeAllUnaryOps() {
134
+ return i.unary_ops = {}, i.max_unop_len = 0, i;
135
+ }
136
+ /**
137
+ * @method removeIdentifierChar
138
+ * @param {string} char The additional character to stop treating as a valid part of an identifier
139
+ * @returns {Jsep}
140
+ */
141
+ static removeIdentifierChar(e) {
142
+ return i.additional_identifier_chars.delete(e), i;
143
+ }
144
+ /**
145
+ * @method removeBinaryOp
146
+ * @param {string} op_name The name of the binary op to remove
147
+ * @returns {Jsep}
148
+ */
149
+ static removeBinaryOp(e) {
150
+ return delete i.binary_ops[e], e.length === i.max_binop_len && (i.max_binop_len = i.getMaxKeyLen(i.binary_ops)), i.right_associative.delete(e), i;
151
+ }
152
+ /**
153
+ * @method removeAllBinaryOps
154
+ * @returns {Jsep}
155
+ */
156
+ static removeAllBinaryOps() {
157
+ return i.binary_ops = {}, i.max_binop_len = 0, i;
158
+ }
159
+ /**
160
+ * @method removeLiteral
161
+ * @param {string} literal_name The name of the literal to remove
162
+ * @returns {Jsep}
163
+ */
164
+ static removeLiteral(e) {
165
+ return delete i.literals[e], i;
166
+ }
167
+ /**
168
+ * @method removeAllLiterals
169
+ * @returns {Jsep}
170
+ */
171
+ static removeAllLiterals() {
172
+ return i.literals = {}, i;
173
+ }
174
+ // ==================== END CONFIG ============================
175
+ /**
176
+ * @returns {string}
177
+ */
178
+ get char() {
179
+ return this.expr.charAt(this.index);
180
+ }
181
+ /**
182
+ * @returns {number}
183
+ */
184
+ get code() {
185
+ return this.expr.charCodeAt(this.index);
186
+ }
187
+ /**
188
+ * @param {string} expr a string with the passed in express
189
+ * @returns Jsep
190
+ */
191
+ constructor(e) {
192
+ this.expr = e, this.index = 0;
193
+ }
194
+ /**
195
+ * static top-level parser
196
+ * @returns {jsep.Expression}
197
+ */
198
+ static parse(e) {
199
+ return new i(e).parse();
200
+ }
201
+ /**
202
+ * Get the longest key length of any object
203
+ * @param {object} obj
204
+ * @returns {number}
205
+ */
206
+ static getMaxKeyLen(e) {
207
+ return Math.max(0, ...Object.keys(e).map((t) => t.length));
208
+ }
209
+ /**
210
+ * `ch` is a character code in the next three functions
211
+ * @param {number} ch
212
+ * @returns {boolean}
213
+ */
214
+ static isDecimalDigit(e) {
215
+ return e >= 48 && e <= 57;
216
+ }
217
+ /**
218
+ * Returns the precedence of a binary operator or `0` if it isn't a binary operator. Can be float.
219
+ * @param {string} op_val
220
+ * @returns {number}
221
+ */
222
+ static binaryPrecedence(e) {
223
+ return i.binary_ops[e] || 0;
224
+ }
225
+ /**
226
+ * Looks for start of identifier
227
+ * @param {number} ch
228
+ * @returns {boolean}
229
+ */
230
+ static isIdentifierStart(e) {
231
+ return e >= 65 && e <= 90 || // A...Z
232
+ e >= 97 && e <= 122 || // a...z
233
+ e >= 128 && !i.binary_ops[String.fromCharCode(e)] || // any non-ASCII that is not an operator
234
+ i.additional_identifier_chars.has(String.fromCharCode(e));
235
+ }
236
+ /**
237
+ * @param {number} ch
238
+ * @returns {boolean}
239
+ */
240
+ static isIdentifierPart(e) {
241
+ return i.isIdentifierStart(e) || i.isDecimalDigit(e);
242
+ }
243
+ /**
244
+ * throw error at index of the expression
245
+ * @param {string} message
246
+ * @throws
247
+ */
248
+ throwError(e) {
249
+ const t = new Error(e + " at character " + this.index);
250
+ throw t.index = this.index, t.description = e, t;
251
+ }
252
+ /**
253
+ * Run a given hook
254
+ * @param {string} name
255
+ * @param {jsep.Expression|false} [node]
256
+ * @returns {?jsep.Expression}
257
+ */
258
+ runHook(e, t) {
259
+ if (i.hooks[e]) {
260
+ const s = {
261
+ context: this,
262
+ node: t
263
+ };
264
+ return i.hooks.run(e, s), s.node;
265
+ }
266
+ return t;
267
+ }
268
+ /**
269
+ * Runs a given hook until one returns a node
270
+ * @param {string} name
271
+ * @returns {?jsep.Expression}
272
+ */
273
+ searchHook(e) {
274
+ if (i.hooks[e]) {
275
+ const t = {
276
+ context: this
277
+ };
278
+ return i.hooks[e].find(function(s) {
279
+ return s.call(t.context, t), t.node;
280
+ }), t.node;
281
+ }
282
+ }
283
+ /**
284
+ * Push `index` up to the next non-space character
285
+ */
286
+ gobbleSpaces() {
287
+ let e = this.code;
288
+ for (; e === i.SPACE_CODE || e === i.TAB_CODE || e === i.LF_CODE || e === i.CR_CODE; )
289
+ e = this.expr.charCodeAt(++this.index);
290
+ this.runHook("gobble-spaces");
291
+ }
292
+ /**
293
+ * Top-level method to parse all expressions and returns compound or single node
294
+ * @returns {jsep.Expression}
295
+ */
296
+ parse() {
297
+ this.runHook("before-all");
298
+ const e = this.gobbleExpressions(), t = e.length === 1 ? e[0] : {
299
+ type: i.COMPOUND,
300
+ body: e
301
+ };
302
+ return this.runHook("after-all", t);
303
+ }
304
+ /**
305
+ * top-level parser (but can be reused within as well)
306
+ * @param {number} [untilICode]
307
+ * @returns {jsep.Expression[]}
308
+ */
309
+ gobbleExpressions(e) {
310
+ let t = [], s, n;
311
+ for (; this.index < this.expr.length; )
312
+ if (s = this.code, s === i.SEMCOL_CODE || s === i.COMMA_CODE)
313
+ this.index++;
314
+ else if (n = this.gobbleExpression())
315
+ t.push(n);
316
+ else if (this.index < this.expr.length) {
317
+ if (s === e)
318
+ break;
319
+ this.throwError('Unexpected "' + this.char + '"');
581
320
  }
582
- function X(S) {
583
- var k = S | 0;
584
- return S > 0 || S === k ? k : k - 1;
321
+ return t;
322
+ }
323
+ /**
324
+ * The main parsing function.
325
+ * @returns {?jsep.Expression}
326
+ */
327
+ gobbleExpression() {
328
+ const e = this.searchHook("gobble-expression") || this.gobbleBinaryExpression();
329
+ return this.gobbleSpaces(), this.runHook("after-expression", e);
330
+ }
331
+ /**
332
+ * Search for the operation portion of the string (e.g. `+`, `===`)
333
+ * Start by taking the longest possible binary operations (3 characters: `===`, `!==`, `>>>`)
334
+ * and move down from 3 to 2 to 1 character until a matching binary operation is found
335
+ * then, return that binary operation
336
+ * @returns {string|boolean}
337
+ */
338
+ gobbleBinaryOp() {
339
+ this.gobbleSpaces();
340
+ let e = this.expr.substr(this.index, i.max_binop_len), t = e.length;
341
+ for (; t > 0; ) {
342
+ if (i.binary_ops.hasOwnProperty(e) && (!i.isIdentifierStart(this.code) || this.index + e.length < this.expr.length && !i.isIdentifierPart(this.expr.charCodeAt(this.index + e.length))))
343
+ return this.index += t, e;
344
+ e = e.substr(0, --t);
345
+ }
346
+ return !1;
347
+ }
348
+ /**
349
+ * This function is responsible for gobbling an individual expression,
350
+ * e.g. `1`, `1+2`, `a+(b*2)-Math.sqrt(2)`
351
+ * @returns {?jsep.BinaryExpression}
352
+ */
353
+ gobbleBinaryExpression() {
354
+ let e, t, s, n, a, c, d, u, h;
355
+ if (c = this.gobbleToken(), !c || (t = this.gobbleBinaryOp(), !t))
356
+ return c;
357
+ for (a = {
358
+ value: t,
359
+ prec: i.binaryPrecedence(t),
360
+ right_a: i.right_associative.has(t)
361
+ }, d = this.gobbleToken(), d || this.throwError("Expected expression after " + t), n = [c, a, d]; t = this.gobbleBinaryOp(); ) {
362
+ if (s = i.binaryPrecedence(t), s === 0) {
363
+ this.index -= t.length;
364
+ break;
585
365
  }
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;
366
+ a = {
367
+ value: t,
368
+ prec: s,
369
+ right_a: i.right_associative.has(t)
370
+ }, h = t;
371
+ const b = (m) => a.right_a && m.right_a ? s > m.prec : s <= m.prec;
372
+ for (; n.length > 2 && b(n[n.length - 2]); )
373
+ d = n.pop(), t = n.pop().value, c = n.pop(), e = {
374
+ type: i.BINARY_EXP,
375
+ operator: t,
376
+ left: c,
377
+ right: d
378
+ }, n.push(e);
379
+ e = this.gobbleToken(), e || this.throwError("Expected expression after " + h), n.push(a, e);
380
+ }
381
+ for (u = n.length - 1, e = n[u]; u > 1; )
382
+ e = {
383
+ type: i.BINARY_EXP,
384
+ operator: n[u - 1].value,
385
+ left: n[u - 2],
386
+ right: e
387
+ }, u -= 2;
388
+ return e;
389
+ }
390
+ /**
391
+ * An individual part of a binary expression:
392
+ * e.g. `foo.bar(baz)`, `1`, `"abc"`, `(a % 2)` (because it's in parenthesis)
393
+ * @returns {boolean|jsep.Expression}
394
+ */
395
+ gobbleToken() {
396
+ let e, t, s, n;
397
+ if (this.gobbleSpaces(), n = this.searchHook("gobble-token"), n)
398
+ return this.runHook("after-token", n);
399
+ if (e = this.code, i.isDecimalDigit(e) || e === i.PERIOD_CODE)
400
+ return this.gobbleNumericLiteral();
401
+ if (e === i.SQUOTE_CODE || e === i.DQUOTE_CODE)
402
+ n = this.gobbleStringLiteral();
403
+ else if (e === i.OBRACK_CODE)
404
+ n = this.gobbleArray();
405
+ else {
406
+ for (t = this.expr.substr(this.index, i.max_unop_len), s = t.length; s > 0; ) {
407
+ if (i.unary_ops.hasOwnProperty(t) && (!i.isIdentifierStart(this.code) || this.index + t.length < this.expr.length && !i.isIdentifierPart(this.expr.charCodeAt(this.index + t.length)))) {
408
+ this.index += s;
409
+ const a = this.gobbleToken();
410
+ return a || this.throwError("missing unaryOp argument"), this.runHook("after-token", {
411
+ type: i.UNARY_EXP,
412
+ operator: t,
413
+ argument: a,
414
+ prefix: !0
415
+ });
590
416
  }
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;
417
+ t = t.substr(0, --s);
611
418
  }
612
- function b(S, k) {
613
- return (S.length > 1 ? S.charAt(0) + "." + S.slice(1) : S) + (k < 0 ? "e" : "e+") + k;
419
+ i.isIdentifierStart(e) ? (n = this.gobbleIdentifier(), i.literals.hasOwnProperty(n.name) ? n = {
420
+ type: i.LITERAL,
421
+ value: i.literals[n.name],
422
+ raw: n.name
423
+ } : n.name === i.this_str && (n = {
424
+ type: i.THIS_EXP
425
+ })) : e === i.OPAREN_CODE && (n = this.gobbleGroup());
426
+ }
427
+ return n ? (n = this.gobbleTokenProperty(n), this.runHook("after-token", n)) : this.runHook("after-token", !1);
428
+ }
429
+ /**
430
+ * Gobble properties of of identifiers/strings/arrays/groups.
431
+ * e.g. `foo`, `bar.baz`, `foo['bar'].baz`
432
+ * It also gobbles function calls:
433
+ * e.g. `Math.acos(obj.angle)`
434
+ * @param {jsep.Expression} node
435
+ * @returns {jsep.Expression}
436
+ */
437
+ gobbleTokenProperty(e) {
438
+ this.gobbleSpaces();
439
+ let t = this.code;
440
+ for (; t === i.PERIOD_CODE || t === i.OBRACK_CODE || t === i.OPAREN_CODE || t === i.QUMARK_CODE; ) {
441
+ let s;
442
+ if (t === i.QUMARK_CODE) {
443
+ if (this.expr.charCodeAt(this.index + 1) !== i.PERIOD_CODE)
444
+ break;
445
+ s = !0, this.index += 2, this.gobbleSpaces(), t = this.code;
614
446
  }
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;
447
+ this.index++, t === i.OBRACK_CODE ? (e = {
448
+ type: i.MEMBER_EXP,
449
+ computed: !0,
450
+ object: e,
451
+ property: this.gobbleExpression()
452
+ }, e.property || this.throwError('Unexpected "' + this.char + '"'), this.gobbleSpaces(), t = this.code, t !== i.CBRACK_CODE && this.throwError("Unclosed ["), this.index++) : t === i.OPAREN_CODE ? e = {
453
+ type: i.CALL_EXP,
454
+ arguments: this.gobbleArguments(i.CPAREN_CODE),
455
+ callee: e
456
+ } : (t === i.PERIOD_CODE || s) && (s && this.index--, this.gobbleSpaces(), e = {
457
+ type: i.MEMBER_EXP,
458
+ computed: !1,
459
+ object: e,
460
+ property: this.gobbleIdentifier()
461
+ }), s && (e.optional = !0), this.gobbleSpaces(), t = this.code;
462
+ }
463
+ return e;
464
+ }
465
+ /**
466
+ * Parse simple numeric literals: `12`, `3.4`, `.5`. Do this by using a string to
467
+ * keep track of everything in the numeric literal and then calling `parseFloat` on that string
468
+ * @returns {jsep.Literal}
469
+ */
470
+ gobbleNumericLiteral() {
471
+ let e = "", t, s;
472
+ for (; i.isDecimalDigit(this.code); )
473
+ e += this.expr.charAt(this.index++);
474
+ if (this.code === i.PERIOD_CODE)
475
+ for (e += this.expr.charAt(this.index++); i.isDecimalDigit(this.code); )
476
+ e += this.expr.charAt(this.index++);
477
+ if (t = this.char, t === "e" || t === "E") {
478
+ for (e += this.expr.charAt(this.index++), t = this.char, (t === "+" || t === "-") && (e += this.expr.charAt(this.index++)); i.isDecimalDigit(this.code); )
479
+ e += this.expr.charAt(this.index++);
480
+ i.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) || this.throwError("Expected exponent (" + e + this.char + ")");
481
+ }
482
+ return s = this.code, i.isIdentifierStart(s) ? this.throwError("Variable names cannot start with a number (" + e + this.char + ")") : (s === i.PERIOD_CODE || e.length === 1 && e.charCodeAt(0) === i.PERIOD_CODE) && this.throwError("Unexpected period"), {
483
+ type: i.LITERAL,
484
+ value: parseFloat(e),
485
+ raw: e
486
+ };
487
+ }
488
+ /**
489
+ * Parses a string literal, staring with single or double quotes with basic support for escape codes
490
+ * e.g. `"hello world"`, `'this is\nJSEP'`
491
+ * @returns {jsep.Literal}
492
+ */
493
+ gobbleStringLiteral() {
494
+ let e = "";
495
+ const t = this.index, s = this.expr.charAt(this.index++);
496
+ let n = !1;
497
+ for (; this.index < this.expr.length; ) {
498
+ let a = this.expr.charAt(this.index++);
499
+ if (a === s) {
500
+ n = !0;
501
+ break;
502
+ } else if (a === "\\")
503
+ switch (a = this.expr.charAt(this.index++), a) {
504
+ case "n":
505
+ e += `
506
+ `;
507
+ break;
508
+ case "r":
509
+ e += "\r";
510
+ break;
511
+ case "t":
512
+ e += " ";
513
+ break;
514
+ case "b":
515
+ e += "\b";
516
+ break;
517
+ case "f":
518
+ e += "\f";
519
+ break;
520
+ case "v":
521
+ e += "\v";
522
+ break;
523
+ default:
524
+ e += a;
525
+ }
526
+ else
527
+ e += a;
528
+ }
529
+ return n || this.throwError('Unclosed quote after "' + e + '"'), {
530
+ type: i.LITERAL,
531
+ value: e,
532
+ raw: this.expr.substring(t, this.index)
533
+ };
534
+ }
535
+ /**
536
+ * Gobbles only identifiers
537
+ * e.g.: `foo`, `_value`, `$x1`
538
+ * Also, this function checks if that identifier is a literal:
539
+ * (e.g. `true`, `false`, `null`) or `this`
540
+ * @returns {jsep.Identifier}
541
+ */
542
+ gobbleIdentifier() {
543
+ let e = this.code, t = this.index;
544
+ for (i.isIdentifierStart(e) ? this.index++ : this.throwError("Unexpected " + this.char); this.index < this.expr.length && (e = this.code, i.isIdentifierPart(e)); )
545
+ this.index++;
546
+ return {
547
+ type: i.IDENTIFIER,
548
+ name: this.expr.slice(t, this.index)
549
+ };
550
+ }
551
+ /**
552
+ * Gobbles a list of arguments within the context of a function call
553
+ * or array literal. This function also assumes that the opening character
554
+ * `(` or `[` has already been gobbled, and gobbles expressions and commas
555
+ * until the terminator character `)` or `]` is encountered.
556
+ * e.g. `foo(bar, baz)`, `my_func()`, or `[bar, baz]`
557
+ * @param {number} termination
558
+ * @returns {jsep.Expression[]}
559
+ */
560
+ gobbleArguments(e) {
561
+ const t = [];
562
+ let s = !1, n = 0;
563
+ for (; this.index < this.expr.length; ) {
564
+ this.gobbleSpaces();
565
+ let a = this.code;
566
+ if (a === e) {
567
+ s = !0, this.index++, e === i.CPAREN_CODE && n && n >= t.length && this.throwError("Unexpected token " + String.fromCharCode(e));
568
+ break;
569
+ } else if (a === i.COMMA_CODE) {
570
+ if (this.index++, n++, n !== t.length) {
571
+ if (e === i.CPAREN_CODE)
572
+ this.throwError("Unexpected token ,");
573
+ else if (e === i.CBRACK_CODE)
574
+ for (let c = t.length; c < n; c++)
575
+ t.push(null);
576
+ }
577
+ } else if (t.length !== n && n !== 0)
578
+ this.throwError("Expected comma");
579
+ else {
580
+ const c = this.gobbleExpression();
581
+ (!c || c.type === i.COMPOUND) && this.throwError("Expected comma"), t.push(c);
625
582
  }
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;
583
+ }
584
+ return s || this.throwError("Expected " + String.fromCharCode(e)), t;
585
+ }
586
+ /**
587
+ * Responsible for parsing a group of things within parentheses `()`
588
+ * that have no identifier in front (so not a function call)
589
+ * This function assumes that it needs to gobble the opening parenthesis
590
+ * and then tries to gobble everything within that parenthesis, assuming
591
+ * that the next thing it should see is the close parenthesis. If not,
592
+ * then the expression probably doesn't have a `)`
593
+ * @returns {boolean|jsep.Expression}
594
+ */
595
+ gobbleGroup() {
596
+ this.index++;
597
+ let e = this.gobbleExpressions(i.CPAREN_CODE);
598
+ if (this.code === i.CPAREN_CODE)
599
+ return this.index++, e.length === 1 ? e[0] : e.length ? {
600
+ type: i.SEQUENCE_EXP,
601
+ expressions: e
602
+ } : !1;
603
+ this.throwError("Unclosed (");
604
+ }
605
+ /**
606
+ * Responsible for parsing Array literals `[1, 2, 3]`
607
+ * This function assumes that it needs to gobble the opening bracket
608
+ * and then tries to gobble the expressions as arguments.
609
+ * @returns {jsep.ArrayExpression}
610
+ */
611
+ gobbleArray() {
612
+ return this.index++, {
613
+ type: i.ARRAY_EXP,
614
+ elements: this.gobbleArguments(i.CBRACK_CODE)
615
+ };
616
+ }
629
617
  }
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 + '"';
618
+ const be = new ge();
619
+ Object.assign(i, {
620
+ hooks: be,
621
+ plugins: new Ee(i),
622
+ // Node Types
623
+ // ----------
624
+ // This is the full set of types that any JSEP node can be.
625
+ // Store them here to save space when minified
626
+ COMPOUND: "Compound",
627
+ SEQUENCE_EXP: "SequenceExpression",
628
+ IDENTIFIER: "Identifier",
629
+ MEMBER_EXP: "MemberExpression",
630
+ LITERAL: "Literal",
631
+ THIS_EXP: "ThisExpression",
632
+ CALL_EXP: "CallExpression",
633
+ UNARY_EXP: "UnaryExpression",
634
+ BINARY_EXP: "BinaryExpression",
635
+ ARRAY_EXP: "ArrayExpression",
636
+ TAB_CODE: 9,
637
+ LF_CODE: 10,
638
+ CR_CODE: 13,
639
+ SPACE_CODE: 32,
640
+ PERIOD_CODE: 46,
641
+ // '.'
642
+ COMMA_CODE: 44,
643
+ // ','
644
+ SQUOTE_CODE: 39,
645
+ // single quote
646
+ DQUOTE_CODE: 34,
647
+ // double quotes
648
+ OPAREN_CODE: 40,
649
+ // (
650
+ CPAREN_CODE: 41,
651
+ // )
652
+ OBRACK_CODE: 91,
653
+ // [
654
+ CBRACK_CODE: 93,
655
+ // ]
656
+ QUMARK_CODE: 63,
657
+ // ?
658
+ SEMCOL_CODE: 59,
659
+ // ;
660
+ COLON_CODE: 58,
661
+ // :
662
+ // Operations
663
+ // ----------
664
+ // Use a quickly-accessible map to store all of the unary operators
665
+ // Values are set to `1` (it really doesn't matter)
666
+ unary_ops: {
667
+ "-": 1,
668
+ "!": 1,
669
+ "~": 1,
670
+ "+": 1
671
+ },
672
+ // Also use a map for the binary operations but set their values to their
673
+ // binary precedence for quick reference (higher number = higher precedence)
674
+ // see [Order of operations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence)
675
+ binary_ops: {
676
+ "||": 1,
677
+ "??": 1,
678
+ "&&": 2,
679
+ "|": 3,
680
+ "^": 4,
681
+ "&": 5,
682
+ "==": 6,
683
+ "!=": 6,
684
+ "===": 6,
685
+ "!==": 6,
686
+ "<": 7,
687
+ ">": 7,
688
+ "<=": 7,
689
+ ">=": 7,
690
+ "<<": 8,
691
+ ">>": 8,
692
+ ">>>": 8,
693
+ "+": 9,
694
+ "-": 9,
695
+ "*": 10,
696
+ "/": 10,
697
+ "%": 10,
698
+ "**": 11
699
+ },
700
+ // sets specific binary_ops as right-associative
701
+ right_associative: /* @__PURE__ */ new Set(["**"]),
702
+ // Additional valid identifier chars, apart from a-z, A-Z and 0-9 (except on the starting char)
703
+ additional_identifier_chars: /* @__PURE__ */ new Set(["$", "_"]),
704
+ // Literals
705
+ // ----------
706
+ // Store the values to return for the various literals we may encounter
707
+ literals: {
708
+ true: !0,
709
+ false: !1,
710
+ null: null
711
+ },
712
+ // Except for `this`, which is special. This could be changed to something like `'self'` as well
713
+ this_str: "this"
714
+ });
715
+ i.max_unop_len = i.getMaxKeyLen(i.unary_ops);
716
+ i.max_binop_len = i.getMaxKeyLen(i.binary_ops);
717
+ const L = (r) => new i(r).parse(), ve = Object.getOwnPropertyNames(class {
718
+ });
719
+ Object.getOwnPropertyNames(i).filter((r) => !ve.includes(r) && L[r] === void 0).forEach((r) => {
720
+ L[r] = i[r];
721
+ });
722
+ L.Jsep = i;
723
+ const _e = "ConditionalExpression";
724
+ var me = {
725
+ name: "ternary",
726
+ init(r) {
727
+ r.hooks.add("after-expression", function(t) {
728
+ if (t.node && this.code === r.QUMARK_CODE) {
729
+ this.index++;
730
+ const s = t.node, n = this.gobbleExpression();
731
+ if (n || this.throwError("Expected expression"), this.gobbleSpaces(), this.code === r.COLON_CODE) {
732
+ this.index++;
733
+ const a = this.gobbleExpression();
734
+ if (a || this.throwError("Expected expression"), t.node = {
735
+ type: _e,
736
+ test: s,
737
+ consequent: n,
738
+ alternate: a
739
+ }, s.operator && r.binary_ops[s.operator] <= 0.9) {
740
+ let c = s;
741
+ for (; c.right.operator && r.binary_ops[c.right.operator] <= 0.9; )
742
+ c = c.right;
743
+ t.node.test = c.right, c.right = t.node, t.node = s;
744
+ }
745
+ } else
746
+ this.throwError("Expected :");
650
747
  }
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;
748
+ });
749
+ }
750
+ };
751
+ L.plugins.register(me);
752
+ const oe = 47, xe = 92;
753
+ var Oe = {
754
+ name: "regex",
755
+ init(r) {
756
+ r.hooks.add("gobble-token", function(t) {
757
+ if (this.code === oe) {
758
+ const s = ++this.index;
759
+ let n = !1;
760
+ for (; this.index < this.expr.length; ) {
761
+ if (this.code === oe && !n) {
762
+ const a = this.expr.slice(s, this.index);
763
+ let c = "";
764
+ for (; ++this.index < this.expr.length; ) {
765
+ const u = this.code;
766
+ if (u >= 97 && u <= 122 || u >= 65 && u <= 90 || u >= 48 && u <= 57)
767
+ c += this.char;
768
+ else
769
+ break;
674
770
  }
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;
771
+ let d;
772
+ try {
773
+ d = new RegExp(a, c);
774
+ } catch (u) {
775
+ this.throwError(u.message);
776
+ }
777
+ return t.node = {
778
+ type: r.LITERAL,
779
+ value: d,
780
+ raw: this.expr.slice(s - 1, this.index)
781
+ }, t.node = this.gobbleTokenProperty(t.node), t.node;
782
+ }
783
+ this.code === r.OBRACK_CODE ? n = !0 : n && this.code === r.CBRACK_CODE && (n = !1), this.index += this.code === xe ? 2 : 1;
687
784
  }
785
+ this.throwError("Unclosed Regex");
786
+ }
787
+ });
788
+ }
789
+ };
790
+ const ne = 43, Ce = 45, H = {
791
+ name: "assignment",
792
+ assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
793
+ updateOperators: [ne, Ce],
794
+ assignmentPrecedence: 0.9,
795
+ init(r) {
796
+ const e = [r.IDENTIFIER, r.MEMBER_EXP];
797
+ H.assignmentOperators.forEach((s) => r.addBinaryOp(s, H.assignmentPrecedence, !0)), r.hooks.add("gobble-token", function(n) {
798
+ const a = this.code;
799
+ H.updateOperators.some((c) => c === a && c === this.expr.charCodeAt(this.index + 1)) && (this.index += 2, n.node = {
800
+ type: "UpdateExpression",
801
+ operator: a === ne ? "++" : "--",
802
+ argument: this.gobbleTokenProperty(this.gobbleIdentifier()),
803
+ prefix: !0
804
+ }, (!n.node.argument || !e.includes(n.node.argument.type)) && this.throwError(`Unexpected ${n.node.operator}`));
805
+ }), r.hooks.add("after-token", function(n) {
806
+ if (n.node) {
807
+ const a = this.code;
808
+ H.updateOperators.some((c) => c === a && c === this.expr.charCodeAt(this.index + 1)) && (e.includes(n.node.type) || this.throwError(`Unexpected ${n.node.operator}`), this.index += 2, n.node = {
809
+ type: "UpdateExpression",
810
+ operator: a === ne ? "++" : "--",
811
+ argument: n.node,
812
+ prefix: !1
813
+ });
688
814
  }
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 });
815
+ }), r.hooks.add("after-expression", function(n) {
816
+ n.node && t(n.node);
817
+ });
818
+ function t(s) {
819
+ H.assignmentOperators.has(s.operator) ? (s.type = "AssignmentExpression", t(s.left), t(s.right)) : s.operator || Object.values(s).forEach((n) => {
820
+ n && typeof n == "object" && t(n);
698
821
  });
699
- })();
700
- }(Ie)), Ie.exports;
822
+ }
823
+ }
824
+ };
825
+ L.plugins.register(Oe, H);
826
+ L.addUnaryOp("typeof");
827
+ L.addLiteral("null", null);
828
+ L.addLiteral("undefined", void 0);
829
+ const Ae = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]), O = {
830
+ /**
831
+ * @param {jsep.Expression} ast
832
+ * @param {Record<string, any>} subs
833
+ */
834
+ evalAst(r, e) {
835
+ switch (r.type) {
836
+ case "BinaryExpression":
837
+ case "LogicalExpression":
838
+ return O.evalBinaryExpression(r, e);
839
+ case "Compound":
840
+ return O.evalCompound(r, e);
841
+ case "ConditionalExpression":
842
+ return O.evalConditionalExpression(r, e);
843
+ case "Identifier":
844
+ return O.evalIdentifier(r, e);
845
+ case "Literal":
846
+ return O.evalLiteral(r, e);
847
+ case "MemberExpression":
848
+ return O.evalMemberExpression(r, e);
849
+ case "UnaryExpression":
850
+ return O.evalUnaryExpression(r, e);
851
+ case "ArrayExpression":
852
+ return O.evalArrayExpression(r, e);
853
+ case "CallExpression":
854
+ return O.evalCallExpression(r, e);
855
+ case "AssignmentExpression":
856
+ return O.evalAssignmentExpression(r, e);
857
+ default:
858
+ throw SyntaxError("Unexpected expression", r);
859
+ }
860
+ },
861
+ evalBinaryExpression(r, e) {
862
+ return {
863
+ "||": (s, n) => s || n(),
864
+ "&&": (s, n) => s && n(),
865
+ "|": (s, n) => s | n(),
866
+ "^": (s, n) => s ^ n(),
867
+ "&": (s, n) => s & n(),
868
+ // eslint-disable-next-line eqeqeq -- API
869
+ "==": (s, n) => s == n(),
870
+ // eslint-disable-next-line eqeqeq -- API
871
+ "!=": (s, n) => s != n(),
872
+ "===": (s, n) => s === n(),
873
+ "!==": (s, n) => s !== n(),
874
+ "<": (s, n) => s < n(),
875
+ ">": (s, n) => s > n(),
876
+ "<=": (s, n) => s <= n(),
877
+ ">=": (s, n) => s >= n(),
878
+ "<<": (s, n) => s << n(),
879
+ ">>": (s, n) => s >> n(),
880
+ ">>>": (s, n) => s >>> n(),
881
+ "+": (s, n) => s + n(),
882
+ "-": (s, n) => s - n(),
883
+ "*": (s, n) => s * n(),
884
+ "/": (s, n) => s / n(),
885
+ "%": (s, n) => s % n()
886
+ }[r.operator](O.evalAst(r.left, e), () => O.evalAst(r.right, e));
887
+ },
888
+ evalCompound(r, e) {
889
+ let t;
890
+ for (let s = 0; s < r.body.length; s++) {
891
+ r.body[s].type === "Identifier" && ["var", "let", "const"].includes(r.body[s].name) && r.body[s + 1] && r.body[s + 1].type === "AssignmentExpression" && (s += 1);
892
+ const n = r.body[s];
893
+ t = O.evalAst(n, e);
894
+ }
895
+ return t;
896
+ },
897
+ evalConditionalExpression(r, e) {
898
+ return O.evalAst(r.test, e) ? O.evalAst(r.consequent, e) : O.evalAst(r.alternate, e);
899
+ },
900
+ evalIdentifier(r, e) {
901
+ if (Object.hasOwn(e, r.name))
902
+ return e[r.name];
903
+ throw ReferenceError(`${r.name} is not defined`);
904
+ },
905
+ evalLiteral(r) {
906
+ return r.value;
907
+ },
908
+ evalMemberExpression(r, e) {
909
+ const t = String(
910
+ // NOTE: `String(value)` throws error when
911
+ // value has overwritten the toString method to return non-string
912
+ // i.e. `value = {toString: () => []}`
913
+ r.computed ? O.evalAst(r.property) : r.property.name
914
+ // `object.property` property is Identifier
915
+ ), s = O.evalAst(r.object, e);
916
+ if (s == null)
917
+ throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);
918
+ if (!Object.hasOwn(s, t) && Ae.has(t))
919
+ throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);
920
+ const n = s[t];
921
+ return typeof n == "function" ? n.bind(s) : n;
922
+ },
923
+ evalUnaryExpression(r, e) {
924
+ return {
925
+ "-": (s) => -O.evalAst(s, e),
926
+ "!": (s) => !O.evalAst(s, e),
927
+ "~": (s) => ~O.evalAst(s, e),
928
+ // eslint-disable-next-line no-implicit-coercion -- API
929
+ "+": (s) => +O.evalAst(s, e),
930
+ typeof: (s) => typeof O.evalAst(s, e)
931
+ }[r.operator](r.argument);
932
+ },
933
+ evalArrayExpression(r, e) {
934
+ return r.elements.map((t) => O.evalAst(t, e));
935
+ },
936
+ evalCallExpression(r, e) {
937
+ const t = r.arguments.map((n) => O.evalAst(n, e));
938
+ return O.evalAst(r.callee, e)(...t);
939
+ },
940
+ evalAssignmentExpression(r, e) {
941
+ if (r.left.type !== "Identifier")
942
+ throw SyntaxError("Invalid left-hand side in assignment");
943
+ const t = r.left.name, s = O.evalAst(r.right, e);
944
+ return e[t] = s, e[t];
945
+ }
946
+ };
947
+ class we {
948
+ /**
949
+ * @param {string} expr Expression to evaluate
950
+ */
951
+ constructor(e) {
952
+ this.code = e, this.ast = L(this.code);
953
+ }
954
+ /**
955
+ * @param {object} context Object whose items will be added
956
+ * to evaluation
957
+ * @returns {EvaluatedResult} Result of evaluated code
958
+ */
959
+ runInNewContext(e) {
960
+ const t = Object.assign(/* @__PURE__ */ Object.create(null), e);
961
+ return O.evalAst(this.ast, t);
962
+ }
963
+ }
964
+ function F(r, e) {
965
+ return r = r.slice(), r.push(e), r;
701
966
  }
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"
967
+ function se(r, e) {
968
+ return e = e.slice(), e.unshift(r), e;
969
+ }
970
+ class ke extends Error {
971
+ /**
972
+ * @param {AnyResult} value The evaluated scalar value
973
+ */
974
+ constructor(e) {
975
+ super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'), this.avoidNew = !0, this.value = e, this.name = "NewError";
976
+ }
977
+ }
978
+ function x(r, e, t, s, n) {
979
+ if (!(this instanceof x))
980
+ try {
981
+ return new x(r, e, t, s, n);
982
+ } catch (c) {
983
+ if (!c.avoidNew)
984
+ throw c;
985
+ return c.value;
986
+ }
987
+ typeof r == "string" && (n = s, s = t, t = e, e = r, r = null);
988
+ const a = r && typeof r == "object";
989
+ if (r = r || {}, this.json = r.json || t, this.path = r.path || e, this.resultType = r.resultType || "value", this.flatten = r.flatten || !1, this.wrap = Object.hasOwn(r, "wrap") ? r.wrap : !0, this.sandbox = r.sandbox || {}, this.eval = r.eval === void 0 ? "safe" : r.eval, this.ignoreEvalErrors = typeof r.ignoreEvalErrors > "u" ? !1 : r.ignoreEvalErrors, this.parent = r.parent || null, this.parentProperty = r.parentProperty || null, this.callback = r.callback || s || null, this.otherTypeCallback = r.otherTypeCallback || n || function() {
990
+ throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.");
991
+ }, r.autostart !== !1) {
992
+ const c = {
993
+ path: a ? r.path : e
720
994
  };
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
- );
995
+ a ? "json" in r && (c.json = r.json) : c.json = t;
996
+ const d = this.evaluate(c);
997
+ if (!d || typeof d != "object")
998
+ throw new ke(d);
999
+ return d;
1000
+ }
1001
+ }
1002
+ x.prototype.evaluate = function(r, e, t, s) {
1003
+ let n = this.parent, a = this.parentProperty, {
1004
+ flatten: c,
1005
+ wrap: d
1006
+ } = this;
1007
+ if (this.currResultType = this.resultType, this.currEval = this.eval, this.currSandbox = this.sandbox, t = t || this.callback, this.currOtherTypeCallback = s || this.otherTypeCallback, e = e || this.json, r = r || this.path, r && typeof r == "object" && !Array.isArray(r)) {
1008
+ if (!r.path && r.path !== "")
1009
+ throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');
1010
+ if (!Object.hasOwn(r, "json"))
1011
+ throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');
1012
+ ({
1013
+ json: e
1014
+ } = r), c = Object.hasOwn(r, "flatten") ? r.flatten : c, this.currResultType = Object.hasOwn(r, "resultType") ? r.resultType : this.currResultType, this.currSandbox = Object.hasOwn(r, "sandbox") ? r.sandbox : this.currSandbox, d = Object.hasOwn(r, "wrap") ? r.wrap : d, this.currEval = Object.hasOwn(r, "eval") ? r.eval : this.currEval, t = Object.hasOwn(r, "callback") ? r.callback : t, this.currOtherTypeCallback = Object.hasOwn(r, "otherTypeCallback") ? r.otherTypeCallback : this.currOtherTypeCallback, n = Object.hasOwn(r, "parent") ? r.parent : n, a = Object.hasOwn(r, "parentProperty") ? r.parentProperty : a, r = r.path;
1015
+ }
1016
+ if (n = n || null, a = a || null, Array.isArray(r) && (r = x.toPathString(r)), !r && r !== "" || !e)
1017
+ return;
1018
+ const u = x.toPathArray(r);
1019
+ u[0] === "$" && u.length > 1 && u.shift(), this._hasParentSelector = null;
1020
+ const h = this._trace(u, e, ["$"], n, a, t).filter(function(b) {
1021
+ return b && !b.isParentSelector;
1022
+ });
1023
+ return h.length ? !d && h.length === 1 && !h[0].hasArrExpr ? this._getPreferredOutput(h[0]) : h.reduce((b, m) => {
1024
+ const C = this._getPreferredOutput(m);
1025
+ return c && Array.isArray(C) ? b = b.concat(C) : b.push(C), b;
1026
+ }, []) : d ? [] : void 0;
1027
+ };
1028
+ x.prototype._getPreferredOutput = function(r) {
1029
+ const e = this.currResultType;
1030
+ switch (e) {
1031
+ case "all": {
1032
+ const t = Array.isArray(r.path) ? r.path : x.toPathArray(r.path);
1033
+ return r.pointer = x.toPointer(t), r.path = typeof r.path == "string" ? r.path : x.toPathString(r.path), r;
736
1034
  }
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
1035
+ case "value":
1036
+ case "parent":
1037
+ case "parentProperty":
1038
+ return r[e];
1039
+ case "path":
1040
+ return x.toPathString(r[e]);
1041
+ case "pointer":
1042
+ return x.toPointer(r.path);
1043
+ default:
1044
+ throw new TypeError("Unknown result type");
1045
+ }
1046
+ };
1047
+ x.prototype._handleCallback = function(r, e, t) {
1048
+ if (e) {
1049
+ const s = this._getPreferredOutput(r);
1050
+ r.path = typeof r.path == "string" ? r.path : x.toPathString(r.path), e(s, t, r);
1051
+ }
1052
+ };
1053
+ x.prototype._trace = function(r, e, t, s, n, a, c, d) {
1054
+ let u;
1055
+ if (!r.length)
1056
+ return u = {
1057
+ path: t,
1058
+ value: e,
1059
+ parent: s,
1060
+ parentProperty: n,
1061
+ hasArrExpr: c
1062
+ }, this._handleCallback(u, a, "value"), u;
1063
+ const h = r[0], b = r.slice(1), m = [];
1064
+ function C(E) {
1065
+ Array.isArray(E) ? E.forEach((S) => {
1066
+ m.push(S);
1067
+ }) : m.push(E);
1068
+ }
1069
+ if ((typeof h != "string" || d) && e && Object.hasOwn(e, h))
1070
+ C(this._trace(b, e[h], F(t, h), e, h, a, c));
1071
+ else if (h === "*")
1072
+ this._walk(e, (E) => {
1073
+ C(this._trace(b, e[E], F(t, E), e, E, a, !0, !0));
1074
+ });
1075
+ else if (h === "..")
1076
+ C(this._trace(b, e, t, s, n, a, c)), this._walk(e, (E) => {
1077
+ typeof e[E] == "object" && C(this._trace(r.slice(), e[E], F(t, E), e, E, a, !0));
1078
+ });
1079
+ else {
1080
+ if (h === "^")
1081
+ return this._hasParentSelector = !0, {
1082
+ path: t.slice(0, -1),
1083
+ expr: b,
1084
+ isParentSelector: !0
753
1085
  };
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();
1086
+ if (h === "~")
1087
+ return u = {
1088
+ path: F(t, h),
1089
+ value: n,
1090
+ parent: s,
1091
+ parentProperty: null
1092
+ }, this._handleCallback(u, a, "property"), u;
1093
+ if (h === "$")
1094
+ C(this._trace(b, e, t, null, null, a, c));
1095
+ else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(h))
1096
+ C(this._slice(h, b, e, t, s, n, a));
1097
+ else if (h.indexOf("?(") === 0) {
1098
+ if (this.currEval === !1)
1099
+ throw new Error("Eval [?(expr)] prevented in JSONPath expression.");
1100
+ const E = h.replace(/^\?\((.*?)\)$/u, "$1"), S = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(E);
1101
+ S ? this._walk(e, (A) => {
1102
+ const T = [S[2]], $ = S[1] ? e[A][S[1]] : e[A];
1103
+ this._trace(T, $, t, s, n, a, !0).length > 0 && C(this._trace(b, e[A], F(t, A), e, A, a, !0));
1104
+ }) : this._walk(e, (A) => {
1105
+ this._eval(E, e[A], A, t, s, n) && C(this._trace(b, e[A], F(t, A), e, A, a, !0));
1106
+ });
1107
+ } else if (h[0] === "(") {
1108
+ if (this.currEval === !1)
1109
+ throw new Error("Eval [(expr)] prevented in JSONPath expression.");
1110
+ C(this._trace(se(this._eval(h, e, t.at(-1), t.slice(0, -1), s, n), b), e, t, s, n, a, c));
1111
+ } else if (h[0] === "@") {
1112
+ let E = !1;
1113
+ const S = h.slice(1, -2);
1114
+ switch (S) {
1115
+ case "scalar":
1116
+ (!e || !["object", "function"].includes(typeof e)) && (E = !0);
1117
+ break;
1118
+ case "boolean":
1119
+ case "string":
1120
+ case "undefined":
1121
+ case "function":
1122
+ typeof e === S && (E = !0);
1123
+ break;
1124
+ case "integer":
1125
+ Number.isFinite(e) && !(e % 1) && (E = !0);
1126
+ break;
1127
+ case "number":
1128
+ Number.isFinite(e) && (E = !0);
1129
+ break;
1130
+ case "nonFinite":
1131
+ typeof e == "number" && !Number.isFinite(e) && (E = !0);
1132
+ break;
1133
+ case "object":
1134
+ e && typeof e === S && (E = !0);
1135
+ break;
1136
+ case "array":
1137
+ Array.isArray(e) && (E = !0);
1138
+ break;
1139
+ case "other":
1140
+ E = this.currOtherTypeCallback(e, t, s, n);
1141
+ break;
1142
+ case "null":
1143
+ e === null && (E = !0);
1144
+ break;
1145
+ /* c8 ignore next 2 */
837
1146
  default:
838
- return y >= "0" && y <= "9" ? P() : X();
1147
+ throw new TypeError("Unknown value type " + S);
839
1148
  }
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;
1149
+ if (E)
1150
+ return u = {
1151
+ path: t,
1152
+ value: e,
1153
+ parent: s,
1154
+ parentProperty: n
1155
+ }, this._handleCallback(u, a, "value"), u;
1156
+ } else if (h[0] === "`" && e && Object.hasOwn(e, h.slice(1))) {
1157
+ const E = h.slice(1);
1158
+ C(this._trace(b, e[E], F(t, E), e, E, a, c, !0));
1159
+ } else if (h.includes(",")) {
1160
+ const E = h.split(",");
1161
+ for (const S of E)
1162
+ C(this._trace(se(S, b), e, t, s, n, a, !0));
1163
+ } else !d && e && Object.hasOwn(e, h) && C(this._trace(b, e[h], F(t, h), e, h, a, c, !0));
1164
+ }
1165
+ if (this._hasParentSelector)
1166
+ for (let E = 0; E < m.length; E++) {
1167
+ const S = m[E];
1168
+ if (S && S.isParentSelector) {
1169
+ const A = this._trace(S.expr, e, S.path, s, n, a, c);
1170
+ if (Array.isArray(A)) {
1171
+ m[E] = A[0];
1172
+ const T = A.length;
1173
+ for (let $ = 1; $ < T; $++)
1174
+ E++, m.splice(E, 0, A[$]);
1175
+ } else
1176
+ m[E] = A;
1177
+ }
1178
+ }
1179
+ return m;
1180
+ };
1181
+ x.prototype._walk = function(r, e) {
1182
+ if (Array.isArray(r)) {
1183
+ const t = r.length;
1184
+ for (let s = 0; s < t; s++)
1185
+ e(s);
1186
+ } else r && typeof r == "object" && Object.keys(r).forEach((t) => {
1187
+ e(t);
1188
+ });
1189
+ };
1190
+ x.prototype._slice = function(r, e, t, s, n, a, c) {
1191
+ if (!Array.isArray(t))
1192
+ return;
1193
+ const d = t.length, u = r.split(":"), h = u[2] && Number.parseInt(u[2]) || 1;
1194
+ let b = u[0] && Number.parseInt(u[0]) || 0, m = u[1] && Number.parseInt(u[1]) || d;
1195
+ b = b < 0 ? Math.max(0, b + d) : Math.min(d, b), m = m < 0 ? Math.max(0, m + d) : Math.min(d, m);
1196
+ const C = [];
1197
+ for (let E = b; E < m; E += h)
1198
+ this._trace(se(E, e), t, s, n, a, c, !0).forEach((A) => {
1199
+ C.push(A);
1200
+ });
1201
+ return C;
1202
+ };
1203
+ x.prototype._eval = function(r, e, t, s, n, a) {
1204
+ this.currSandbox._$_parentProperty = a, this.currSandbox._$_parent = n, this.currSandbox._$_property = t, this.currSandbox._$_root = this.json, this.currSandbox._$_v = e;
1205
+ const c = r.includes("@path");
1206
+ c && (this.currSandbox._$_path = x.toPathString(s.concat([t])));
1207
+ const d = this.currEval + "Script:" + r;
1208
+ if (!x.cache[d]) {
1209
+ let u = r.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
1210
+ if (c && (u = u.replaceAll("@path", "_$_path")), this.currEval === "safe" || this.currEval === !0 || this.currEval === void 0)
1211
+ x.cache[d] = new this.safeVm.Script(u);
1212
+ else if (this.currEval === "native")
1213
+ x.cache[d] = new this.vm.Script(u);
1214
+ else if (typeof this.currEval == "function" && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, "runInNewContext")) {
1215
+ const h = this.currEval;
1216
+ x.cache[d] = new h(u);
1217
+ } else if (typeof this.currEval == "function")
1218
+ x.cache[d] = {
1219
+ runInNewContext: (h) => this.currEval(u, h)
1220
+ };
1221
+ else
1222
+ throw new TypeError(`Unknown "eval" property "${this.currEval}"`);
1223
+ }
1224
+ try {
1225
+ return x.cache[d].runInNewContext(this.currSandbox);
1226
+ } catch (u) {
1227
+ if (this.ignoreEvalErrors)
1228
+ return !1;
1229
+ throw new Error("jsonPath: " + u.message + ": " + r);
1230
+ }
1231
+ };
1232
+ x.cache = {};
1233
+ x.toPathString = function(r) {
1234
+ const e = r, t = e.length;
1235
+ let s = "$";
1236
+ for (let n = 1; n < t; n++)
1237
+ /^(~|\^|@.*?\(\))$/u.test(e[n]) || (s += /^[0-9*]+$/u.test(e[n]) ? "[" + e[n] + "]" : "['" + e[n] + "']");
1238
+ return s;
1239
+ };
1240
+ x.toPointer = function(r) {
1241
+ const e = r, t = e.length;
1242
+ let s = "";
1243
+ for (let n = 1; n < t; n++)
1244
+ /^(~|\^|@.*?\(\))$/u.test(e[n]) || (s += "/" + e[n].toString().replaceAll("~", "~0").replaceAll("/", "~1"));
1245
+ return s;
1246
+ };
1247
+ x.toPathArray = function(r) {
1248
+ const {
1249
+ cache: e
1250
+ } = x;
1251
+ if (e[r])
1252
+ return e[r].concat();
1253
+ const t = [], n = r.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function(a, c) {
1254
+ return "[#" + (t.push(c) - 1) + "]";
1255
+ }).replaceAll(/\[['"]([^'\]]*)['"]\]/gu, function(a, c) {
1256
+ return "['" + c.replaceAll(".", "%@%").replaceAll("~", "%%@@%%") + "']";
1257
+ }).replaceAll("~", ";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu, ";").replaceAll("%@%", ".").replaceAll("%%@@%%", "~").replaceAll(/(?:;)?(\^+)(?:;)?/gu, function(a, c) {
1258
+ return ";" + c.split("").join(";") + ";";
1259
+ }).replaceAll(/;;;|;;/gu, ";..;").replaceAll(/;$|'?\]|'$/gu, "").split(";").map(function(a) {
1260
+ const c = a.match(/#(\d+)/u);
1261
+ return !c || !c[1] ? a : t[c[1]];
1262
+ });
1263
+ return e[r] = n, e[r].concat();
1264
+ };
1265
+ x.prototype.safeVm = {
1266
+ Script: we
1267
+ };
1268
+ const Se = function(r, e, t) {
1269
+ const s = r.length;
1270
+ for (let n = 0; n < s; n++) {
1271
+ const a = r[n];
1272
+ t(a) && e.push(r.splice(n--, 1)[0]);
1273
+ }
1274
+ };
1275
+ class Pe {
1276
+ /**
1277
+ * @param {string} expr Expression to evaluate
1278
+ */
1279
+ constructor(e) {
1280
+ this.code = e;
1281
+ }
1282
+ /**
1283
+ * @param {object} context Object whose items will be added
1284
+ * to evaluation
1285
+ * @returns {EvaluatedResult} Result of evaluated code
1286
+ */
1287
+ runInNewContext(e) {
1288
+ let t = this.code;
1289
+ const s = Object.keys(e), n = [];
1290
+ Se(s, n, (h) => typeof e[h] == "function");
1291
+ const a = s.map((h) => e[h]);
1292
+ t = n.reduce((h, b) => {
1293
+ let m = e[b].toString();
1294
+ return /function/u.test(m) || (m = "function " + m), "var " + b + "=" + m + ";" + h;
1295
+ }, "") + t, !/(['"])use strict\1/u.test(t) && !s.includes("arguments") && (t = "var arguments = undefined;" + t), t = t.replace(/;\s*$/u, "");
1296
+ const d = t.lastIndexOf(";"), u = d !== -1 ? t.slice(0, d + 1) + " return " + t.slice(d + 1) : " return " + t;
1297
+ return new Function(...s, u)(...a);
1298
+ }
863
1299
  }
864
- var tt = et();
865
- const nt = /* @__PURE__ */ Ye(tt), rt = { class: "json-node" }, it = {
1300
+ x.prototype.vm = {
1301
+ Script: Pe
1302
+ };
1303
+ const Ne = { class: "json-node" }, De = {
866
1304
  key: 0,
867
1305
  class: "json-node__container"
868
- }, ot = { class: "json-node__line" }, st = {
1306
+ }, je = { class: "json-node__line" }, Ie = {
869
1307
  key: 2,
870
1308
  class: "json-node__colon"
871
- }, lt = ["title"], ut = {
1309
+ }, $e = ["title"], Te = {
872
1310
  key: 3,
873
1311
  class: "json-node__collapsed"
874
- }, at = {
1312
+ }, Re = {
875
1313
  key: 4,
876
1314
  class: "json-node__comma"
877
- }, ft = {
1315
+ }, Ue = {
878
1316
  key: 0,
879
1317
  class: "json-node__children"
880
- }, ct = { class: "json-node__line" }, pt = { class: "json-node__bracket" }, dt = {
1318
+ }, Be = { class: "json-node__children-content" }, Le = { class: "json-node__line json-node__closing-bracket" }, Me = { class: "json-node__bracket" }, Fe = {
881
1319
  key: 0,
882
1320
  class: "json-node__comma"
883
- }, gt = {
1321
+ }, Ve = {
884
1322
  key: 1,
885
1323
  class: "json-node__primitive"
886
- }, ht = {
1324
+ }, Ke = {
887
1325
  key: 2,
888
1326
  class: "json-node__colon"
889
- }, vt = ["title"], yt = {
890
- key: 5,
1327
+ }, Xe = ["title"], He = {
1328
+ key: 0,
891
1329
  class: "json-node__comma"
892
- }, mt = /* @__PURE__ */ De({
1330
+ }, Qe = /* @__PURE__ */ ae({
893
1331
  name: "JsonNode",
894
1332
  __name: "JsonNode",
895
1333
  props: {
@@ -901,196 +1339,203 @@ const nt = /* @__PURE__ */ Ye(tt), rt = { class: "json-node" }, it = {
901
1339
  isLast: { type: Boolean, default: !1 }
902
1340
  },
903
1341
  emits: ["update:value", "toggle-expand", "copy", "update:key"],
904
- setup(G, { emit: ee }) {
905
- Me((p) => ({
906
- "623b775d": p.level
1342
+ setup(r, { emit: e }) {
1343
+ ue((f) => ({
1344
+ "1f6d5aa6": f.level
907
1345
  }));
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());
1346
+ const t = r, s = e, n = B(!1), a = B(!1), c = B(""), d = B(""), u = (f) => {
1347
+ if (!/^-?\d+(\.\d+)?$/.test(f)) return !1;
1348
+ const v = Number(f);
1349
+ return !Number.isSafeInteger(v) || f.length > 15;
1350
+ }, h = j(() => t.value !== null && typeof t.value == "object"), b = j(() => Array.isArray(t.value)), m = j(() => t.path ? t.path : t.keyName ? t.keyName : "root"), C = j(() => t.expanded.has(m.value)), E = j(() => t.keyName), S = j(() => b.value ? "[" : "{"), A = j(() => b.value ? "]" : "}"), T = j(() => {
1351
+ if (!t.value) return "";
1352
+ const v = Object.keys(t.value).length;
1353
+ return b.value ? v > 0 ? ` ${v} items ` : " " : v > 0 ? ` ${v} keys ` : " ";
1354
+ }), $ = j(() => {
1355
+ const f = typeof t.value;
1356
+ return t.value === null ? "json-node__value--null" : f === "boolean" ? "json-node__value--boolean" : f === "number" ? "json-node__value--number" : f === "string" ? u(t.value) ? "json-node__value--number" : "json-node__value--string" : "";
1357
+ }), q = j(() => a.value ? d.value : t.value === null ? "null" : typeof t.value == "boolean" || typeof t.value == "number" ? String(t.value) : typeof t.value == "string" ? u(t.value) ? t.value : `"${t.value}"` : String(t.value)), G = j(() => "Click to edit, double-click to copy"), K = (f) => t.level === 0 ? f : m.value ? `${m.value}.${f}` : f, z = (f) => {
1358
+ const v = Object.keys(t.value);
1359
+ return v.indexOf(f) === v.length - 1;
1360
+ }, Q = () => {
1361
+ s("toggle-expand", m.value);
1362
+ }, Y = () => {
1363
+ t.level !== 0 && (n.value = !0, c.value = t.keyName, ee(() => {
1364
+ const f = document.querySelectorAll(".json-node__key-input"), v = f[f.length - 1];
1365
+ v && (v.focus(), v.select());
928
1366
  }));
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());
1367
+ }, W = () => {
1368
+ h.value || (a.value = !0, typeof t.value == "string" && u(t.value) || typeof t.value == "string" ? d.value = t.value : d.value = String(t.value), ee(() => {
1369
+ const f = document.querySelectorAll(".json-node__value-input"), v = f[f.length - 1];
1370
+ v && (v.focus(), v.select());
933
1371
  }));
934
- }, g = () => {
935
- if (N.level === 0 || !O.value) return;
936
- const p = C.value.trim();
937
- if (!p) {
938
- _();
1372
+ }, V = () => {
1373
+ if (t.level === 0 || !n.value) return;
1374
+ const f = c.value.trim();
1375
+ if (!f) {
1376
+ M();
939
1377
  return;
940
1378
  }
941
- if (p === N.keyName) {
942
- O.value = !1;
1379
+ if (f === t.keyName) {
1380
+ n.value = !1;
943
1381
  return;
944
1382
  }
945
- O.value = !1, ne("update:key", A.value, p);
946
- }, c = () => {
1383
+ n.value = !1, s("update:key", m.value, f);
1384
+ }, Z = () => {
947
1385
  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;
1386
+ let f;
1387
+ const v = d.value.trim();
1388
+ if (v === "null")
1389
+ f = null;
1390
+ else if (v === "true" || v === "false")
1391
+ f = v === "true";
1392
+ else if (!isNaN(Number(v)) && v !== "") {
1393
+ const o = Number(v);
1394
+ !Number.isSafeInteger(o) || v.length > 15 ? f = v : f = o;
957
1395
  } 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;
1396
+ f = d.value;
1397
+ s("update:value", m.value, f), a.value = !1;
1398
+ } catch (f) {
1399
+ console.error("Failed to parse value:", f), a.value = !1;
962
1400
  }
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);
1401
+ }, M = () => {
1402
+ n.value = !1, c.value = t.keyName;
1403
+ }, J = () => {
1404
+ a.value = !1, typeof t.value == "string" && u(t.value) || typeof t.value == "string" ? d.value = t.value : d.value = String(t.value);
967
1405
  };
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", {
1406
+ return (f, v) => {
1407
+ const o = he("JsonNode", !0);
1408
+ return k(), w("div", Ne, [
1409
+ h.value ? (k(), w("div", De, [
1410
+ P("div", je, [
1411
+ f.keyName && !n.value ? (k(), w("span", {
974
1412
  key: 0,
975
1413
  class: "json-node__key",
976
- onClick: k,
1414
+ onClick: Y,
977
1415
  title: "Click to edit key"
978
- }, ' "' + he($.value) + '" ', 1)) : se("", !0),
979
- p.keyName && O.value ? je((K(), Y("input", {
1416
+ }, ' "' + U(E.value) + '" ', 1)) : N("", !0),
1417
+ f.keyName && n.value ? te((k(), w("input", {
980
1418
  key: 1,
981
- "onUpdate:modelValue": h[0] || (h[0] = (M) => C.value = M),
1419
+ "onUpdate:modelValue": v[0] || (v[0] = (l) => c.value = l),
982
1420
  onKeyup: [
983
- me(g, ["enter"]),
984
- me(_, ["escape"])
1421
+ X(V, ["enter"]),
1422
+ X(M, ["escape"])
985
1423
  ],
986
- onBlur: g,
1424
+ onBlur: V,
987
1425
  class: "json-node__key-input"
988
1426
  }, null, 544)), [
989
- [Ce, C.value]
990
- ]) : se("", !0),
991
- p.keyName ? (K(), Y("span", st, ": ")) : se("", !0),
992
- le("span", {
1427
+ [re, c.value]
1428
+ ]) : N("", !0),
1429
+ f.keyName ? (k(), w("span", Ie, ": ")) : N("", !0),
1430
+ P("span", {
993
1431
  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", {
1432
+ onClick: Q,
1433
+ title: C.value ? "Click to collapse" : "Click to expand"
1434
+ }, U(S.value), 9, $e),
1435
+ C.value ? N("", !0) : (k(), w("span", Te, [
1436
+ ie(U(T.value) + " ", 1),
1437
+ P("span", {
1000
1438
  class: "json-node__bracket json-node__bracket--clickable",
1001
- onClick: S
1002
- }, he(X.value), 1)
1439
+ onClick: Q
1440
+ }, U(A.value), 1)
1003
1441
  ])),
1004
- !P.value && !p.isLast ? (K(), Y("span", at, ",")) : se("", !0)
1442
+ !C.value && !f.isLast ? (k(), w("span", Re, ",")) : N("", !0)
1005
1443
  ]),
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, ","))
1444
+ C.value ? (k(), w("div", Ue, [
1445
+ P("div", Be, [
1446
+ (k(!0), w(de, null, fe(f.value, (l, g) => (k(), w("div", {
1447
+ key: g,
1448
+ class: "json-node__child"
1449
+ }, [
1450
+ le(o, {
1451
+ value: l,
1452
+ "key-name": b.value ? "" : String(g),
1453
+ level: f.level + 1,
1454
+ path: K(String(g)),
1455
+ expanded: f.expanded,
1456
+ "onUpdate:value": v[1] || (v[1] = (p, y) => f.$emit("update:value", p, y)),
1457
+ onToggleExpand: v[2] || (v[2] = (p) => f.$emit("toggle-expand", p)),
1458
+ onCopy: v[3] || (v[3] = (p) => f.$emit("copy", p)),
1459
+ "onUpdate:key": v[4] || (v[4] = (p, y) => f.$emit("update:key", p, y)),
1460
+ "is-last": z(String(g))
1461
+ }, null, 8, ["value", "key-name", "level", "path", "expanded", "is-last"])
1462
+ ]))), 128))
1463
+ ]),
1464
+ P("div", Le, [
1465
+ P("span", Me, U(A.value), 1),
1466
+ f.isLast ? N("", !0) : (k(), w("span", Fe, ","))
1027
1467
  ])
1028
- ])) : se("", !0)
1029
- ])) : (K(), Y("div", gt, [
1030
- p.keyName && !O.value ? (K(), Y("span", {
1468
+ ])) : N("", !0)
1469
+ ])) : (k(), w("div", Ve, [
1470
+ f.keyName && !n.value ? (k(), w("span", {
1031
1471
  key: 0,
1032
1472
  class: "json-node__key",
1033
- onClick: k,
1473
+ onClick: Y,
1034
1474
  title: "Click to edit key"
1035
- }, ' "' + he($.value) + '" ', 1)) : se("", !0),
1036
- p.keyName && O.value ? je((K(), Y("input", {
1475
+ }, ' "' + U(E.value) + '" ', 1)) : N("", !0),
1476
+ f.keyName && n.value ? te((k(), w("input", {
1037
1477
  key: 1,
1038
- "onUpdate:modelValue": h[5] || (h[5] = (M) => C.value = M),
1478
+ "onUpdate:modelValue": v[5] || (v[5] = (l) => c.value = l),
1039
1479
  onKeyup: [
1040
- me(g, ["enter"]),
1041
- me(_, ["escape"])
1480
+ X(V, ["enter"]),
1481
+ X(M, ["escape"])
1042
1482
  ],
1043
- onBlur: g,
1483
+ onBlur: V,
1044
1484
  class: "json-node__key-input"
1045
1485
  }, 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", {
1486
+ [re, c.value]
1487
+ ]) : N("", !0),
1488
+ f.keyName ? (k(), w("span", Ke, ": ")) : N("", !0),
1489
+ a.value ? N("", !0) : (k(), w("span", {
1050
1490
  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", {
1491
+ class: pe(["json-node__value", $.value]),
1492
+ onClick: W,
1493
+ onDblclick: v[6] || (v[6] = (l) => f.$emit("copy", f.value)),
1494
+ title: G.value
1495
+ }, [
1496
+ ie(U(q.value), 1),
1497
+ f.isLast ? N("", !0) : (k(), w("span", He, ","))
1498
+ ], 42, Xe)),
1499
+ a.value ? te((k(), w("input", {
1057
1500
  key: 4,
1058
- "onUpdate:modelValue": h[7] || (h[7] = (M) => y.value = M),
1501
+ "onUpdate:modelValue": v[7] || (v[7] = (l) => d.value = l),
1059
1502
  onKeyup: [
1060
- me(c, ["enter"]),
1061
- me(m, ["escape"])
1503
+ X(Z, ["enter"]),
1504
+ X(J, ["escape"])
1062
1505
  ],
1063
- onBlur: c,
1506
+ onBlur: Z,
1064
1507
  class: "json-node__value-input"
1065
1508
  }, null, 544)), [
1066
- [Ce, y.value]
1067
- ]) : se("", !0),
1068
- p.isLast ? se("", !0) : (K(), Y("span", yt, ","))
1509
+ [re, d.value]
1510
+ ]) : N("", !0)
1069
1511
  ]))
1070
1512
  ]);
1071
1513
  };
1072
1514
  }
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 = {
1515
+ }), ce = (r, e) => {
1516
+ const t = r.__vccOpts || r;
1517
+ for (const [s, n] of e)
1518
+ t[s] = n;
1519
+ return t;
1520
+ }, Ye = /* @__PURE__ */ ce(Qe, [["__scopeId", "data-v-fdfd4b42"]]), qe = { class: "json-format" }, Ge = {
1079
1521
  key: 0,
1080
1522
  class: "json-format__toolbar"
1081
- }, At = { class: "json-format__actions" }, kt = ["disabled"], Et = ["disabled"], Ot = ["disabled"], xt = { class: "json-format__info" }, St = {
1523
+ }, ze = { class: "json-format__actions" }, We = ["disabled"], Ze = ["disabled"], Je = ["disabled"], et = ["disabled"], tt = { class: "json-format__info" }, rt = {
1082
1524
  key: 0,
1083
1525
  class: "json-format__status json-format__status--success"
1084
- }, Bt = {
1526
+ }, nt = {
1085
1527
  key: 1,
1086
1528
  class: "json-format__status json-format__status--error"
1087
- }, jt = { class: "json-format__content" }, Ct = {
1529
+ }, st = { class: "json-format__content" }, it = {
1088
1530
  key: 0,
1089
1531
  class: "json-format__error"
1090
- }, It = {
1532
+ }, ot = {
1091
1533
  key: 1,
1534
+ class: "json-format__error"
1535
+ }, at = {
1536
+ key: 2,
1092
1537
  class: "json-format__viewer"
1093
- }, bt = /* @__PURE__ */ De({
1538
+ }, lt = /* @__PURE__ */ ae({
1094
1539
  name: "JsonFormat",
1095
1540
  __name: "index",
1096
1541
  props: {
@@ -1099,217 +1544,281 @@ const nt = /* @__PURE__ */ Ye(tt), rt = { class: "json-node" }, it = {
1099
1544
  maxDepth: { default: 10 },
1100
1545
  showToolbar: { type: Boolean, default: !0 }
1101
1546
  },
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 = "";
1547
+ emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress"],
1548
+ setup(r, { expose: e, emit: t }) {
1549
+ const s = r, n = t, a = B(null), c = B(""), d = B(/* @__PURE__ */ new Set()), u = B(null), h = B(""), b = j(() => c.value === ""), m = j(() => h.value ? null : u.value !== null ? u.value : a.value), C = (o) => {
1550
+ if (!o.trim()) {
1551
+ a.value = null, c.value = "", u.value = null, h.value = "";
1111
1552
  return;
1112
1553
  }
1113
1554
  try {
1114
- C.value = ne.parse(g), y.value = "", Pe(() => {
1115
- C.value !== null && z();
1555
+ let l = o;
1556
+ l = l.replace(/:\s*(\d{16,})\s*([,}])/g, ': "$1"$2'), l = l.replace(/:\s*(\d+\.\d*?0+)\s*([,}])/g, ': "$1"$2'), a.value = JSON.parse(l), c.value = "", u.value = null, h.value = "", ee(() => {
1557
+ m.value !== null && K();
1116
1558
  });
1117
- } catch (c) {
1118
- y.value = c instanceof Error ? c.message : "Unknown parsing error", C.value = null;
1559
+ } catch (l) {
1560
+ c.value = l instanceof Error ? l.message : "Unknown parsing error", a.value = null, u.value = null, h.value = "";
1561
+ }
1562
+ }, E = (o) => {
1563
+ if (!o || !o.expression.trim()) {
1564
+ S();
1565
+ return;
1119
1566
  }
1567
+ if (!a.value) {
1568
+ h.value = "No valid JSON data to filter";
1569
+ return;
1570
+ }
1571
+ try {
1572
+ let l;
1573
+ if (o.type === "jsonpath")
1574
+ l = x({ path: o.expression, json: a.value }), l.length === 1 && o.expression.includes("$[") === !1 && !o.expression.endsWith("[*]") ? u.value = l[0] : u.value = l;
1575
+ else if (o.type === "js")
1576
+ l = new Function("data", `
1577
+ try {
1578
+ return ${o.expression};
1579
+ } catch (error) {
1580
+ throw new Error('JavaScript expression error: ' + error.message);
1581
+ }
1582
+ `)(a.value), u.value = l;
1583
+ else
1584
+ throw new Error(`Unsupported filter type: ${o.type}`);
1585
+ h.value = "", ee(() => {
1586
+ K();
1587
+ });
1588
+ } catch (l) {
1589
+ h.value = l instanceof Error ? l.message : "Filter execution error", u.value = null;
1590
+ }
1591
+ }, S = () => {
1592
+ u.value = null, h.value = "";
1120
1593
  };
1121
- We(() => O.modelValue, (g) => {
1122
- J(g);
1594
+ ye(() => s.modelValue, (o) => {
1595
+ C(o);
1123
1596
  }, { immediate: !0 });
1124
- const A = (g, c) => {
1125
- if (!O.readonly)
1597
+ const A = (o) => {
1598
+ if (!/^-?\d+(\.\d+)?$/.test(o)) return !1;
1599
+ const l = Number(o);
1600
+ return !Number.isSafeInteger(l) || o.length > 15;
1601
+ }, T = (o, l, g) => JSON.stringify(o, (p, y) => {
1602
+ if (typeof y == "string" && A(y))
1603
+ return `__BIG_NUMBER__${y}__BIG_NUMBER__`;
1604
+ if (typeof y == "string" && /^-?\d+(\.\d+)?$/.test(y)) {
1605
+ const _ = Number(y);
1606
+ if (Number.isSafeInteger(_) && _.toString() === y)
1607
+ return _;
1608
+ if (!Number.isNaN(_) && isFinite(_) && y.includes("."))
1609
+ return _.toString() === y ? _ : y;
1610
+ if (!Number.isNaN(_) && isFinite(_))
1611
+ return _;
1612
+ }
1613
+ return l && typeof l == "function" ? l(p, y) : y;
1614
+ }, g).replace(/"__BIG_NUMBER__(.+?)__BIG_NUMBER__"/g, "$1"), $ = (o, l) => {
1615
+ if (!s.readonly)
1126
1616
  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:", _);
1617
+ const g = q(a.value, o, l), p = T(g, null, 2);
1618
+ n("update:modelValue", p);
1619
+ } catch (g) {
1620
+ console.error("Failed to update JSON:", g);
1131
1621
  }
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]);
1622
+ }, q = (o, l, g) => {
1623
+ if (!l || l === "root") return g;
1624
+ const p = l.split("."), y = M(o, p.slice(0, -1));
1625
+ let _ = y;
1626
+ for (let I = 0; I < p.length - 1; I++) {
1627
+ const R = p[I];
1628
+ R !== "root" && (Array.isArray(_) ? _ = _[parseInt(R)] : _ = _[R]);
1139
1629
  }
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);
1630
+ const D = p[p.length - 1];
1631
+ return D === "root" ? g : (Array.isArray(_) ? _[parseInt(D)] = g : _[D] = g, y);
1632
+ }, G = (o) => {
1633
+ d.value.has(o) ? d.value.delete(o) : d.value.add(o);
1634
+ }, K = () => {
1635
+ const o = /* @__PURE__ */ new Set(), l = (g, p = "") => {
1636
+ g !== null && typeof g == "object" && (o.add(p || "root"), Array.isArray(g) ? g.forEach((y, _) => {
1637
+ const D = p ? `${p}.${_}` : `${_}`;
1638
+ l(y, D);
1639
+ }) : Object.keys(g).forEach((y) => {
1640
+ const _ = p ? `${p}.${y}` : y;
1641
+ l(g[y], _);
1152
1642
  }));
1153
1643
  };
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)
1644
+ l(m.value), d.value = o, n("expand-all");
1645
+ }, z = () => {
1646
+ d.value = /* @__PURE__ */ new Set(["root"]), n("collapse-all");
1647
+ }, Q = async () => {
1648
+ if (b.value)
1159
1649
  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"));
1650
+ const o = m.value, g = JSON.stringify(o, null, 2).replace(/"(\d{16,})"/g, "$1");
1651
+ await navigator.clipboard.writeText(g), n("copy-success", g);
1652
+ } catch (o) {
1653
+ console.error("Failed to copy JSON:", o), n("copy-error", o instanceof Error ? o : new Error("Failed to copy JSON"));
1164
1654
  }
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) => {
1655
+ }, Y = () => {
1656
+ if (b.value)
1657
+ try {
1658
+ const o = m.value, l = T(o);
1659
+ n("update:modelValue", l), n("compress", l);
1660
+ } catch (o) {
1661
+ console.error("Failed to compress JSON:", o);
1662
+ }
1663
+ }, W = async (o) => {
1170
1664
  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);
1665
+ let l;
1666
+ typeof o == "string" && A(o) ? l = o : typeof o == "string" ? l = `"${o}"` : l = JSON.stringify(o), await navigator.clipboard.writeText(l);
1667
+ } catch (l) {
1668
+ console.error("Failed to copy value:", l);
1175
1669
  }
1176
- }, I = (g, c) => {
1177
- if (!O.readonly)
1670
+ }, V = (o, l) => {
1671
+ if (!s.readonly)
1178
1672
  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:", _);
1673
+ const g = Z(a.value, o, l), p = T(g, null, 2);
1674
+ n("update:modelValue", p), v(o, l);
1675
+ } catch (g) {
1676
+ console.error("Failed to rename key:", g);
1183
1677
  }
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;
1678
+ }, Z = (o, l, g) => {
1679
+ if (!l || l === "root") return o;
1680
+ const p = l.split("."), y = M(o, p.slice(0, -1));
1681
+ if (p.length === 1) {
1682
+ const I = p[0];
1683
+ return y && typeof y == "object" && !Array.isArray(y) ? J(y, I, g) : y;
1190
1684
  }
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];
1685
+ let _ = y;
1686
+ for (let I = 0; I < p.length - 1; I++) {
1687
+ const R = p[I];
1688
+ Array.isArray(_) ? _ = _[parseInt(R)] : _ = _[R];
1195
1689
  }
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);
1690
+ const D = p[p.length - 1];
1691
+ if (!Array.isArray(_) && _ && typeof _ == "object") {
1692
+ const I = J(_, D, g), R = p.slice(0, -1);
1693
+ R.length > 0 && f(y, R, I);
1200
1694
  }
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))), _;
1695
+ return y;
1696
+ }, M = (o, l) => {
1697
+ if (l.length === 0) return o;
1698
+ if (Array.isArray(o)) {
1699
+ const g = [...o], p = l[0], y = parseInt(p);
1700
+ return l.length === 1 || (g[y] = M(o[y], l.slice(1))), g;
1701
+ } else if (o && typeof o == "object") {
1702
+ const g = { ...o }, p = l[0];
1703
+ return l.length === 1 || (g[p] = M(o[p], l.slice(1))), g;
1210
1704
  }
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];
1705
+ return o;
1706
+ }, J = (o, l, g) => {
1707
+ if (!o || typeof o != "object" || Array.isArray(o))
1708
+ return o;
1709
+ const p = Object.keys(o), y = {};
1710
+ for (const _ of p)
1711
+ _ === l ? y[g] = o[_] : y[_] = o[_];
1712
+ return y;
1713
+ }, f = (o, l, g) => {
1714
+ let p = o;
1715
+ for (let _ = 0; _ < l.length - 1; _++) {
1716
+ const D = l[_];
1717
+ Array.isArray(p) ? p = p[parseInt(D)] : p = p[D];
1224
1718
  }
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);
1719
+ const y = l[l.length - 1];
1720
+ Array.isArray(p) ? p[parseInt(y)] = g : p[y] = g;
1721
+ }, v = (o, l) => {
1722
+ const g = /* @__PURE__ */ new Set();
1723
+ d.value.forEach((p) => {
1724
+ if (p === o) {
1725
+ const y = o.split(".");
1726
+ y[y.length - 1] = l, g.add(y.join("."));
1727
+ } else if (p.startsWith(o + ".")) {
1728
+ const y = o.split(".");
1729
+ y[y.length - 1] = l;
1730
+ const _ = y.join("."), D = p.substring(o.length);
1731
+ g.add(_ + D);
1238
1732
  } else
1239
- _.add(m);
1240
- }), T.value = _;
1733
+ g.add(p);
1734
+ }), d.value = g;
1241
1735
  };
1242
- return ee({
1736
+ return e({
1243
1737
  // 核心操作方法
1244
- copyJson: D,
1245
- expandAll: z,
1246
- collapseAll: X,
1247
- toggleExpand: $,
1248
- updateValue: A,
1249
- updateKey: I,
1738
+ copyJson: Q,
1739
+ compressSource: Y,
1740
+ expandAll: K,
1741
+ collapseAll: z,
1742
+ toggleExpand: G,
1743
+ updateValue: $,
1744
+ updateKey: V,
1745
+ // Filter 相关方法
1746
+ filter: E,
1747
+ clearFilter: S,
1250
1748
  // 状态访问方法
1251
- isValidJson: () => w.value,
1252
- getParsedJson: () => C.value,
1253
- getExpandedNodes: () => T.value,
1254
- getParseError: () => y.value,
1749
+ isValidJson: () => b.value,
1750
+ getParsedJson: () => a.value,
1751
+ getFilteredJson: () => u.value,
1752
+ getExpandedNodes: () => d.value,
1753
+ getParseError: () => c.value,
1754
+ getFilterError: () => h.value,
1255
1755
  // 工具方法
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", {
1756
+ parseJson: (o) => C(o),
1757
+ copyValue: (o) => W(o)
1758
+ }), (o, l) => (k(), w("div", qe, [
1759
+ o.showToolbar ? (k(), w("div", Ge, [
1760
+ P("div", ze, [
1761
+ P("button", {
1262
1762
  class: "json-format__btn json-format__btn--primary",
1263
- onClick: D,
1264
- disabled: !w.value,
1763
+ onClick: Q,
1764
+ disabled: !b.value,
1265
1765
  title: "Copy JSON"
1266
- }, " 📋 Copy ", 8, kt),
1267
- le("button", {
1766
+ }, " 📋 Copy ", 8, We),
1767
+ P("button", {
1268
1768
  class: "json-format__btn json-format__btn--secondary",
1269
- onClick: z,
1270
- disabled: !w.value,
1769
+ onClick: K,
1770
+ disabled: !b.value,
1271
1771
  title: "Expand All"
1272
- }, " ⬇️ Expand All ", 8, Et),
1273
- le("button", {
1772
+ }, " ⬇️ Expand All ", 8, Ze),
1773
+ P("button", {
1274
1774
  class: "json-format__btn json-format__btn--secondary",
1275
- onClick: X,
1276
- disabled: !w.value,
1775
+ onClick: z,
1776
+ disabled: !b.value,
1277
1777
  title: "Collapse All"
1278
- }, " ➡️ Collapse All ", 8, Ot)
1778
+ }, " ➡️ Collapse All ", 8, Je),
1779
+ P("button", {
1780
+ class: "json-format__btn json-format__btn--secondary",
1781
+ onClick: Y,
1782
+ disabled: !b.value,
1783
+ title: "Compress JSON"
1784
+ }, " 📦 Compress ", 8, et)
1279
1785
  ]),
1280
- le("div", xt, [
1281
- w.value ? (K(), Y("span", St, " ✅ Valid JSON ")) : (K(), Y("span", Bt, " ❌ Invalid JSON "))
1786
+ P("div", tt, [
1787
+ b.value ? (k(), w("span", rt, " ✅ Valid JSON ")) : (k(), w("span", nt, " ❌ Invalid JSON "))
1282
1788
  ])
1283
- ])) : se("", !0),
1284
- le("div", jt, [
1285
- w.value ? (K(), Y("div", It, [
1286
- Ue(_t, {
1287
- value: C.value,
1789
+ ])) : N("", !0),
1790
+ P("div", st, [
1791
+ b.value ? h.value ? (k(), w("div", ot, [
1792
+ l[1] || (l[1] = P("h4", null, "Filter Error:", -1)),
1793
+ P("pre", null, U(h.value), 1)
1794
+ ])) : (k(), w("div", at, [
1795
+ le(Ye, {
1796
+ value: m.value,
1288
1797
  "key-name": "",
1289
1798
  level: 0,
1290
- expanded: T.value,
1799
+ expanded: d.value,
1291
1800
  "is-last": !0,
1292
- "onUpdate:value": A,
1293
- onToggleExpand: $,
1294
- onCopy: x,
1295
- "onUpdate:key": I
1801
+ "onUpdate:value": $,
1802
+ onToggleExpand: G,
1803
+ onCopy: W,
1804
+ "onUpdate:key": V
1296
1805
  }, 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)
1806
+ ])) : (k(), w("div", it, [
1807
+ l[0] || (l[0] = P("h4", null, "JSON Parse Error:", -1)),
1808
+ P("pre", null, U(c.value), 1)
1300
1809
  ]))
1301
1810
  ])
1302
1811
  ]));
1303
1812
  }
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);
1813
+ }), ct = /* @__PURE__ */ ce(lt, [["__scopeId", "data-v-c212b38f"]]), ut = [ct], ht = (r) => {
1814
+ ut.forEach((e) => {
1815
+ const t = e.name || e.__name || "UnknownComponent";
1816
+ r.component(t, e);
1308
1817
  });
1309
- }, Jt = {
1310
- install: Tt
1818
+ }, pt = {
1819
+ install: ht
1311
1820
  };
1312
1821
  export {
1313
- Pt as JsonFormat,
1314
- Jt as default
1822
+ ct as JsonFormat,
1823
+ pt as default
1315
1824
  };