lone-format 0.4.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lone-format.css +1 -1
- package/dist/lone-format.js +1281 -1181
- package/dist/lone-format.umd.cjs +11 -11
- package/package.json +1 -1
package/dist/lone-format.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as ye, useCssVars as Oe, ref as
|
|
1
|
+
import { defineComponent as ye, useCssVars as Oe, ref as Y, computed as V, resolveComponent as Me, createElementBlock as x, openBlock as _, createElementVNode as y, createCommentVNode as U, withDirectives as Ee, toDisplayString as B, withKeys as de, vModelText as xe, Fragment as ne, renderList as ie, createVNode as Ue, normalizeClass as Te, createTextVNode as De, nextTick as he, watch as Fe, normalizeStyle as N, createBlock as Xe } from "vue";
|
|
2
2
|
class Je {
|
|
3
3
|
/**
|
|
4
4
|
* @callback HookCallback
|
|
@@ -69,7 +69,7 @@ class et {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
class
|
|
72
|
+
class d {
|
|
73
73
|
/**
|
|
74
74
|
* @returns {string}
|
|
75
75
|
*/
|
|
@@ -80,7 +80,7 @@ class c {
|
|
|
80
80
|
* @returns {string}
|
|
81
81
|
*/
|
|
82
82
|
static toString() {
|
|
83
|
-
return "JavaScript Expression Parser (JSEP) v" +
|
|
83
|
+
return "JavaScript Expression Parser (JSEP) v" + d.version;
|
|
84
84
|
}
|
|
85
85
|
// ==================== CONFIG ================================
|
|
86
86
|
/**
|
|
@@ -89,7 +89,7 @@ class c {
|
|
|
89
89
|
* @returns {Jsep}
|
|
90
90
|
*/
|
|
91
91
|
static addUnaryOp(e) {
|
|
92
|
-
return
|
|
92
|
+
return d.max_unop_len = Math.max(e.length, d.max_unop_len), d.unary_ops[e] = 1, d;
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* @method jsep.addBinaryOp
|
|
@@ -99,7 +99,7 @@ class c {
|
|
|
99
99
|
* @returns {Jsep}
|
|
100
100
|
*/
|
|
101
101
|
static addBinaryOp(e, t, s) {
|
|
102
|
-
return
|
|
102
|
+
return d.max_binop_len = Math.max(e.length, d.max_binop_len), d.binary_ops[e] = t, s ? d.right_associative.add(e) : d.right_associative.delete(e), d;
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* @method addIdentifierChar
|
|
@@ -107,7 +107,7 @@ class c {
|
|
|
107
107
|
* @returns {Jsep}
|
|
108
108
|
*/
|
|
109
109
|
static addIdentifierChar(e) {
|
|
110
|
-
return
|
|
110
|
+
return d.additional_identifier_chars.add(e), d;
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
113
|
* @method addLiteral
|
|
@@ -116,7 +116,7 @@ class c {
|
|
|
116
116
|
* @returns {Jsep}
|
|
117
117
|
*/
|
|
118
118
|
static addLiteral(e, t) {
|
|
119
|
-
return
|
|
119
|
+
return d.literals[e] = t, d;
|
|
120
120
|
}
|
|
121
121
|
/**
|
|
122
122
|
* @method removeUnaryOp
|
|
@@ -124,14 +124,14 @@ class c {
|
|
|
124
124
|
* @returns {Jsep}
|
|
125
125
|
*/
|
|
126
126
|
static removeUnaryOp(e) {
|
|
127
|
-
return delete
|
|
127
|
+
return delete d.unary_ops[e], e.length === d.max_unop_len && (d.max_unop_len = d.getMaxKeyLen(d.unary_ops)), d;
|
|
128
128
|
}
|
|
129
129
|
/**
|
|
130
130
|
* @method removeAllUnaryOps
|
|
131
131
|
* @returns {Jsep}
|
|
132
132
|
*/
|
|
133
133
|
static removeAllUnaryOps() {
|
|
134
|
-
return
|
|
134
|
+
return d.unary_ops = {}, d.max_unop_len = 0, d;
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
137
|
* @method removeIdentifierChar
|
|
@@ -139,7 +139,7 @@ class c {
|
|
|
139
139
|
* @returns {Jsep}
|
|
140
140
|
*/
|
|
141
141
|
static removeIdentifierChar(e) {
|
|
142
|
-
return
|
|
142
|
+
return d.additional_identifier_chars.delete(e), d;
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* @method removeBinaryOp
|
|
@@ -147,14 +147,14 @@ class c {
|
|
|
147
147
|
* @returns {Jsep}
|
|
148
148
|
*/
|
|
149
149
|
static removeBinaryOp(e) {
|
|
150
|
-
return delete
|
|
150
|
+
return delete d.binary_ops[e], e.length === d.max_binop_len && (d.max_binop_len = d.getMaxKeyLen(d.binary_ops)), d.right_associative.delete(e), d;
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
153
|
* @method removeAllBinaryOps
|
|
154
154
|
* @returns {Jsep}
|
|
155
155
|
*/
|
|
156
156
|
static removeAllBinaryOps() {
|
|
157
|
-
return
|
|
157
|
+
return d.binary_ops = {}, d.max_binop_len = 0, d;
|
|
158
158
|
}
|
|
159
159
|
/**
|
|
160
160
|
* @method removeLiteral
|
|
@@ -162,14 +162,14 @@ class c {
|
|
|
162
162
|
* @returns {Jsep}
|
|
163
163
|
*/
|
|
164
164
|
static removeLiteral(e) {
|
|
165
|
-
return delete
|
|
165
|
+
return delete d.literals[e], d;
|
|
166
166
|
}
|
|
167
167
|
/**
|
|
168
168
|
* @method removeAllLiterals
|
|
169
169
|
* @returns {Jsep}
|
|
170
170
|
*/
|
|
171
171
|
static removeAllLiterals() {
|
|
172
|
-
return
|
|
172
|
+
return d.literals = {}, d;
|
|
173
173
|
}
|
|
174
174
|
// ==================== END CONFIG ============================
|
|
175
175
|
/**
|
|
@@ -196,7 +196,7 @@ class c {
|
|
|
196
196
|
* @returns {jsep.Expression}
|
|
197
197
|
*/
|
|
198
198
|
static parse(e) {
|
|
199
|
-
return new
|
|
199
|
+
return new d(e).parse();
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
202
|
* Get the longest key length of any object
|
|
@@ -220,7 +220,7 @@ class c {
|
|
|
220
220
|
* @returns {number}
|
|
221
221
|
*/
|
|
222
222
|
static binaryPrecedence(e) {
|
|
223
|
-
return
|
|
223
|
+
return d.binary_ops[e] || 0;
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
226
226
|
* Looks for start of identifier
|
|
@@ -230,15 +230,15 @@ class c {
|
|
|
230
230
|
static isIdentifierStart(e) {
|
|
231
231
|
return e >= 65 && e <= 90 || // A...Z
|
|
232
232
|
e >= 97 && e <= 122 || // a...z
|
|
233
|
-
e >= 128 && !
|
|
234
|
-
|
|
233
|
+
e >= 128 && !d.binary_ops[String.fromCharCode(e)] || // any non-ASCII that is not an operator
|
|
234
|
+
d.additional_identifier_chars.has(String.fromCharCode(e));
|
|
235
235
|
}
|
|
236
236
|
/**
|
|
237
237
|
* @param {number} ch
|
|
238
238
|
* @returns {boolean}
|
|
239
239
|
*/
|
|
240
240
|
static isIdentifierPart(e) {
|
|
241
|
-
return
|
|
241
|
+
return d.isIdentifierStart(e) || d.isDecimalDigit(e);
|
|
242
242
|
}
|
|
243
243
|
/**
|
|
244
244
|
* throw error at index of the expression
|
|
@@ -256,12 +256,12 @@ class c {
|
|
|
256
256
|
* @returns {?jsep.Expression}
|
|
257
257
|
*/
|
|
258
258
|
runHook(e, t) {
|
|
259
|
-
if (
|
|
259
|
+
if (d.hooks[e]) {
|
|
260
260
|
const s = {
|
|
261
261
|
context: this,
|
|
262
262
|
node: t
|
|
263
263
|
};
|
|
264
|
-
return
|
|
264
|
+
return d.hooks.run(e, s), s.node;
|
|
265
265
|
}
|
|
266
266
|
return t;
|
|
267
267
|
}
|
|
@@ -271,11 +271,11 @@ class c {
|
|
|
271
271
|
* @returns {?jsep.Expression}
|
|
272
272
|
*/
|
|
273
273
|
searchHook(e) {
|
|
274
|
-
if (
|
|
274
|
+
if (d.hooks[e]) {
|
|
275
275
|
const t = {
|
|
276
276
|
context: this
|
|
277
277
|
};
|
|
278
|
-
return
|
|
278
|
+
return d.hooks[e].find(function(s) {
|
|
279
279
|
return s.call(t.context, t), t.node;
|
|
280
280
|
}), t.node;
|
|
281
281
|
}
|
|
@@ -285,7 +285,7 @@ class c {
|
|
|
285
285
|
*/
|
|
286
286
|
gobbleSpaces() {
|
|
287
287
|
let e = this.code;
|
|
288
|
-
for (; e ===
|
|
288
|
+
for (; e === d.SPACE_CODE || e === d.TAB_CODE || e === d.LF_CODE || e === d.CR_CODE; )
|
|
289
289
|
e = this.expr.charCodeAt(++this.index);
|
|
290
290
|
this.runHook("gobble-spaces");
|
|
291
291
|
}
|
|
@@ -296,7 +296,7 @@ class c {
|
|
|
296
296
|
parse() {
|
|
297
297
|
this.runHook("before-all");
|
|
298
298
|
const e = this.gobbleExpressions(), t = e.length === 1 ? e[0] : {
|
|
299
|
-
type:
|
|
299
|
+
type: d.COMPOUND,
|
|
300
300
|
body: e
|
|
301
301
|
};
|
|
302
302
|
return this.runHook("after-all", t);
|
|
@@ -309,7 +309,7 @@ class c {
|
|
|
309
309
|
gobbleExpressions(e) {
|
|
310
310
|
let t = [], s, n;
|
|
311
311
|
for (; this.index < this.expr.length; )
|
|
312
|
-
if (s = this.code, s ===
|
|
312
|
+
if (s = this.code, s === d.SEMCOL_CODE || s === d.COMMA_CODE)
|
|
313
313
|
this.index++;
|
|
314
314
|
else if (n = this.gobbleExpression())
|
|
315
315
|
t.push(n);
|
|
@@ -337,9 +337,9 @@ class c {
|
|
|
337
337
|
*/
|
|
338
338
|
gobbleBinaryOp() {
|
|
339
339
|
this.gobbleSpaces();
|
|
340
|
-
let e = this.expr.substr(this.index,
|
|
340
|
+
let e = this.expr.substr(this.index, d.max_binop_len), t = e.length;
|
|
341
341
|
for (; t > 0; ) {
|
|
342
|
-
if (
|
|
342
|
+
if (d.binary_ops.hasOwnProperty(e) && (!d.isIdentifierStart(this.code) || this.index + e.length < this.expr.length && !d.isIdentifierPart(this.expr.charCodeAt(this.index + e.length))))
|
|
343
343
|
return this.index += t, e;
|
|
344
344
|
e = e.substr(0, --t);
|
|
345
345
|
}
|
|
@@ -356,22 +356,22 @@ class c {
|
|
|
356
356
|
return i;
|
|
357
357
|
for (o = {
|
|
358
358
|
value: t,
|
|
359
|
-
prec:
|
|
360
|
-
right_a:
|
|
359
|
+
prec: d.binaryPrecedence(t),
|
|
360
|
+
right_a: d.right_associative.has(t)
|
|
361
361
|
}, u = this.gobbleToken(), u || this.throwError("Expected expression after " + t), n = [i, o, u]; t = this.gobbleBinaryOp(); ) {
|
|
362
|
-
if (s =
|
|
362
|
+
if (s = d.binaryPrecedence(t), s === 0) {
|
|
363
363
|
this.index -= t.length;
|
|
364
364
|
break;
|
|
365
365
|
}
|
|
366
366
|
o = {
|
|
367
367
|
value: t,
|
|
368
368
|
prec: s,
|
|
369
|
-
right_a:
|
|
369
|
+
right_a: d.right_associative.has(t)
|
|
370
370
|
}, l = t;
|
|
371
|
-
const
|
|
372
|
-
for (; n.length > 2 &&
|
|
371
|
+
const p = (h) => o.right_a && h.right_a ? s > h.prec : s <= h.prec;
|
|
372
|
+
for (; n.length > 2 && p(n[n.length - 2]); )
|
|
373
373
|
u = n.pop(), t = n.pop().value, i = n.pop(), e = {
|
|
374
|
-
type:
|
|
374
|
+
type: d.BINARY_EXP,
|
|
375
375
|
operator: t,
|
|
376
376
|
left: i,
|
|
377
377
|
right: u
|
|
@@ -380,7 +380,7 @@ class c {
|
|
|
380
380
|
}
|
|
381
381
|
for (a = n.length - 1, e = n[a]; a > 1; )
|
|
382
382
|
e = {
|
|
383
|
-
type:
|
|
383
|
+
type: d.BINARY_EXP,
|
|
384
384
|
operator: n[a - 1].value,
|
|
385
385
|
left: n[a - 2],
|
|
386
386
|
right: e
|
|
@@ -396,19 +396,19 @@ class c {
|
|
|
396
396
|
let e, t, s, n;
|
|
397
397
|
if (this.gobbleSpaces(), n = this.searchHook("gobble-token"), n)
|
|
398
398
|
return this.runHook("after-token", n);
|
|
399
|
-
if (e = this.code,
|
|
399
|
+
if (e = this.code, d.isDecimalDigit(e) || e === d.PERIOD_CODE)
|
|
400
400
|
return this.gobbleNumericLiteral();
|
|
401
|
-
if (e ===
|
|
401
|
+
if (e === d.SQUOTE_CODE || e === d.DQUOTE_CODE)
|
|
402
402
|
n = this.gobbleStringLiteral();
|
|
403
|
-
else if (e ===
|
|
403
|
+
else if (e === d.OBRACK_CODE)
|
|
404
404
|
n = this.gobbleArray();
|
|
405
405
|
else {
|
|
406
|
-
for (t = this.expr.substr(this.index,
|
|
407
|
-
if (
|
|
406
|
+
for (t = this.expr.substr(this.index, d.max_unop_len), s = t.length; s > 0; ) {
|
|
407
|
+
if (d.unary_ops.hasOwnProperty(t) && (!d.isIdentifierStart(this.code) || this.index + t.length < this.expr.length && !d.isIdentifierPart(this.expr.charCodeAt(this.index + t.length)))) {
|
|
408
408
|
this.index += s;
|
|
409
409
|
const o = this.gobbleToken();
|
|
410
410
|
return o || this.throwError("missing unaryOp argument"), this.runHook("after-token", {
|
|
411
|
-
type:
|
|
411
|
+
type: d.UNARY_EXP,
|
|
412
412
|
operator: t,
|
|
413
413
|
argument: o,
|
|
414
414
|
prefix: !0
|
|
@@ -416,13 +416,13 @@ class c {
|
|
|
416
416
|
}
|
|
417
417
|
t = t.substr(0, --s);
|
|
418
418
|
}
|
|
419
|
-
|
|
420
|
-
type:
|
|
421
|
-
value:
|
|
419
|
+
d.isIdentifierStart(e) ? (n = this.gobbleIdentifier(), d.literals.hasOwnProperty(n.name) ? n = {
|
|
420
|
+
type: d.LITERAL,
|
|
421
|
+
value: d.literals[n.name],
|
|
422
422
|
raw: n.name
|
|
423
|
-
} : n.name ===
|
|
424
|
-
type:
|
|
425
|
-
})) : e ===
|
|
423
|
+
} : n.name === d.this_str && (n = {
|
|
424
|
+
type: d.THIS_EXP
|
|
425
|
+
})) : e === d.OPAREN_CODE && (n = this.gobbleGroup());
|
|
426
426
|
}
|
|
427
427
|
return n ? (n = this.gobbleTokenProperty(n), this.runHook("after-token", n)) : this.runHook("after-token", !1);
|
|
428
428
|
}
|
|
@@ -437,24 +437,24 @@ class c {
|
|
|
437
437
|
gobbleTokenProperty(e) {
|
|
438
438
|
this.gobbleSpaces();
|
|
439
439
|
let t = this.code;
|
|
440
|
-
for (; t ===
|
|
440
|
+
for (; t === d.PERIOD_CODE || t === d.OBRACK_CODE || t === d.OPAREN_CODE || t === d.QUMARK_CODE; ) {
|
|
441
441
|
let s;
|
|
442
|
-
if (t ===
|
|
443
|
-
if (this.expr.charCodeAt(this.index + 1) !==
|
|
442
|
+
if (t === d.QUMARK_CODE) {
|
|
443
|
+
if (this.expr.charCodeAt(this.index + 1) !== d.PERIOD_CODE)
|
|
444
444
|
break;
|
|
445
445
|
s = !0, this.index += 2, this.gobbleSpaces(), t = this.code;
|
|
446
446
|
}
|
|
447
|
-
this.index++, t ===
|
|
448
|
-
type:
|
|
447
|
+
this.index++, t === d.OBRACK_CODE ? (e = {
|
|
448
|
+
type: d.MEMBER_EXP,
|
|
449
449
|
computed: !0,
|
|
450
450
|
object: e,
|
|
451
451
|
property: this.gobbleExpression()
|
|
452
|
-
}, e.property || this.throwError('Unexpected "' + this.char + '"'), this.gobbleSpaces(), t = this.code, t !==
|
|
453
|
-
type:
|
|
454
|
-
arguments: this.gobbleArguments(
|
|
452
|
+
}, e.property || this.throwError('Unexpected "' + this.char + '"'), this.gobbleSpaces(), t = this.code, t !== d.CBRACK_CODE && this.throwError("Unclosed ["), this.index++) : t === d.OPAREN_CODE ? e = {
|
|
453
|
+
type: d.CALL_EXP,
|
|
454
|
+
arguments: this.gobbleArguments(d.CPAREN_CODE),
|
|
455
455
|
callee: e
|
|
456
|
-
} : (t ===
|
|
457
|
-
type:
|
|
456
|
+
} : (t === d.PERIOD_CODE || s) && (s && this.index--, this.gobbleSpaces(), e = {
|
|
457
|
+
type: d.MEMBER_EXP,
|
|
458
458
|
computed: !1,
|
|
459
459
|
object: e,
|
|
460
460
|
property: this.gobbleIdentifier()
|
|
@@ -469,18 +469,18 @@ class c {
|
|
|
469
469
|
*/
|
|
470
470
|
gobbleNumericLiteral() {
|
|
471
471
|
let e = "", t, s;
|
|
472
|
-
for (;
|
|
472
|
+
for (; d.isDecimalDigit(this.code); )
|
|
473
473
|
e += this.expr.charAt(this.index++);
|
|
474
|
-
if (this.code ===
|
|
475
|
-
for (e += this.expr.charAt(this.index++);
|
|
474
|
+
if (this.code === d.PERIOD_CODE)
|
|
475
|
+
for (e += this.expr.charAt(this.index++); d.isDecimalDigit(this.code); )
|
|
476
476
|
e += this.expr.charAt(this.index++);
|
|
477
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++));
|
|
478
|
+
for (e += this.expr.charAt(this.index++), t = this.char, (t === "+" || t === "-") && (e += this.expr.charAt(this.index++)); d.isDecimalDigit(this.code); )
|
|
479
479
|
e += this.expr.charAt(this.index++);
|
|
480
|
-
|
|
480
|
+
d.isDecimalDigit(this.expr.charCodeAt(this.index - 1)) || this.throwError("Expected exponent (" + e + this.char + ")");
|
|
481
481
|
}
|
|
482
|
-
return s = this.code,
|
|
483
|
-
type:
|
|
482
|
+
return s = this.code, d.isIdentifierStart(s) ? this.throwError("Variable names cannot start with a number (" + e + this.char + ")") : (s === d.PERIOD_CODE || e.length === 1 && e.charCodeAt(0) === d.PERIOD_CODE) && this.throwError("Unexpected period"), {
|
|
483
|
+
type: d.LITERAL,
|
|
484
484
|
value: parseFloat(e),
|
|
485
485
|
raw: e
|
|
486
486
|
};
|
|
@@ -527,7 +527,7 @@ class c {
|
|
|
527
527
|
e += o;
|
|
528
528
|
}
|
|
529
529
|
return n || this.throwError('Unclosed quote after "' + e + '"'), {
|
|
530
|
-
type:
|
|
530
|
+
type: d.LITERAL,
|
|
531
531
|
value: e,
|
|
532
532
|
raw: this.expr.substring(t, this.index)
|
|
533
533
|
};
|
|
@@ -541,10 +541,10 @@ class c {
|
|
|
541
541
|
*/
|
|
542
542
|
gobbleIdentifier() {
|
|
543
543
|
let e = this.code, t = this.index;
|
|
544
|
-
for (
|
|
544
|
+
for (d.isIdentifierStart(e) ? this.index++ : this.throwError("Unexpected " + this.char); this.index < this.expr.length && (e = this.code, d.isIdentifierPart(e)); )
|
|
545
545
|
this.index++;
|
|
546
546
|
return {
|
|
547
|
-
type:
|
|
547
|
+
type: d.IDENTIFIER,
|
|
548
548
|
name: this.expr.slice(t, this.index)
|
|
549
549
|
};
|
|
550
550
|
}
|
|
@@ -564,13 +564,13 @@ class c {
|
|
|
564
564
|
this.gobbleSpaces();
|
|
565
565
|
let o = this.code;
|
|
566
566
|
if (o === e) {
|
|
567
|
-
s = !0, this.index++, e ===
|
|
567
|
+
s = !0, this.index++, e === d.CPAREN_CODE && n && n >= t.length && this.throwError("Unexpected token " + String.fromCharCode(e));
|
|
568
568
|
break;
|
|
569
|
-
} else if (o ===
|
|
569
|
+
} else if (o === d.COMMA_CODE) {
|
|
570
570
|
if (this.index++, n++, n !== t.length) {
|
|
571
|
-
if (e ===
|
|
571
|
+
if (e === d.CPAREN_CODE)
|
|
572
572
|
this.throwError("Unexpected token ,");
|
|
573
|
-
else if (e ===
|
|
573
|
+
else if (e === d.CBRACK_CODE)
|
|
574
574
|
for (let i = t.length; i < n; i++)
|
|
575
575
|
t.push(null);
|
|
576
576
|
}
|
|
@@ -578,7 +578,7 @@ class c {
|
|
|
578
578
|
this.throwError("Expected comma");
|
|
579
579
|
else {
|
|
580
580
|
const i = this.gobbleExpression();
|
|
581
|
-
(!i || i.type ===
|
|
581
|
+
(!i || i.type === d.COMPOUND) && this.throwError("Expected comma"), t.push(i);
|
|
582
582
|
}
|
|
583
583
|
}
|
|
584
584
|
return s || this.throwError("Expected " + String.fromCharCode(e)), t;
|
|
@@ -594,10 +594,10 @@ class c {
|
|
|
594
594
|
*/
|
|
595
595
|
gobbleGroup() {
|
|
596
596
|
this.index++;
|
|
597
|
-
let e = this.gobbleExpressions(
|
|
598
|
-
if (this.code ===
|
|
597
|
+
let e = this.gobbleExpressions(d.CPAREN_CODE);
|
|
598
|
+
if (this.code === d.CPAREN_CODE)
|
|
599
599
|
return this.index++, e.length === 1 ? e[0] : e.length ? {
|
|
600
|
-
type:
|
|
600
|
+
type: d.SEQUENCE_EXP,
|
|
601
601
|
expressions: e
|
|
602
602
|
} : !1;
|
|
603
603
|
this.throwError("Unclosed (");
|
|
@@ -610,15 +610,15 @@ class c {
|
|
|
610
610
|
*/
|
|
611
611
|
gobbleArray() {
|
|
612
612
|
return this.index++, {
|
|
613
|
-
type:
|
|
614
|
-
elements: this.gobbleArguments(
|
|
613
|
+
type: d.ARRAY_EXP,
|
|
614
|
+
elements: this.gobbleArguments(d.CBRACK_CODE)
|
|
615
615
|
};
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
const tt = new Je();
|
|
619
|
-
Object.assign(
|
|
619
|
+
Object.assign(d, {
|
|
620
620
|
hooks: tt,
|
|
621
|
-
plugins: new et(
|
|
621
|
+
plugins: new et(d),
|
|
622
622
|
// Node Types
|
|
623
623
|
// ----------
|
|
624
624
|
// This is the full set of types that any JSEP node can be.
|
|
@@ -712,14 +712,14 @@ Object.assign(c, {
|
|
|
712
712
|
// Except for `this`, which is special. This could be changed to something like `'self'` as well
|
|
713
713
|
this_str: "this"
|
|
714
714
|
});
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
const
|
|
715
|
+
d.max_unop_len = d.getMaxKeyLen(d.unary_ops);
|
|
716
|
+
d.max_binop_len = d.getMaxKeyLen(d.binary_ops);
|
|
717
|
+
const J = (r) => new d(r).parse(), rt = Object.getOwnPropertyNames(class {
|
|
718
718
|
});
|
|
719
|
-
Object.getOwnPropertyNames(
|
|
720
|
-
|
|
719
|
+
Object.getOwnPropertyNames(d).filter((r) => !rt.includes(r) && J[r] === void 0).forEach((r) => {
|
|
720
|
+
J[r] = d[r];
|
|
721
721
|
});
|
|
722
|
-
|
|
722
|
+
J.Jsep = d;
|
|
723
723
|
const nt = "ConditionalExpression";
|
|
724
724
|
var st = {
|
|
725
725
|
name: "ternary",
|
|
@@ -748,17 +748,17 @@ var st = {
|
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
};
|
|
751
|
-
|
|
752
|
-
const
|
|
751
|
+
J.plugins.register(st);
|
|
752
|
+
const Se = 47, ot = 92;
|
|
753
753
|
var it = {
|
|
754
754
|
name: "regex",
|
|
755
755
|
init(r) {
|
|
756
756
|
r.hooks.add("gobble-token", function(t) {
|
|
757
|
-
if (this.code ===
|
|
757
|
+
if (this.code === Se) {
|
|
758
758
|
const s = ++this.index;
|
|
759
759
|
let n = !1;
|
|
760
760
|
for (; this.index < this.expr.length; ) {
|
|
761
|
-
if (this.code ===
|
|
761
|
+
if (this.code === Se && !n) {
|
|
762
762
|
const o = this.expr.slice(s, this.index);
|
|
763
763
|
let i = "";
|
|
764
764
|
for (; ++this.index < this.expr.length; ) {
|
|
@@ -787,27 +787,27 @@ var it = {
|
|
|
787
787
|
});
|
|
788
788
|
}
|
|
789
789
|
};
|
|
790
|
-
const
|
|
790
|
+
const ke = 43, at = 45, fe = {
|
|
791
791
|
name: "assignment",
|
|
792
792
|
assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
|
|
793
|
-
updateOperators: [
|
|
793
|
+
updateOperators: [ke, at],
|
|
794
794
|
assignmentPrecedence: 0.9,
|
|
795
795
|
init(r) {
|
|
796
796
|
const e = [r.IDENTIFIER, r.MEMBER_EXP];
|
|
797
|
-
|
|
797
|
+
fe.assignmentOperators.forEach((s) => r.addBinaryOp(s, fe.assignmentPrecedence, !0)), r.hooks.add("gobble-token", function(n) {
|
|
798
798
|
const o = this.code;
|
|
799
|
-
|
|
799
|
+
fe.updateOperators.some((i) => i === o && i === this.expr.charCodeAt(this.index + 1)) && (this.index += 2, n.node = {
|
|
800
800
|
type: "UpdateExpression",
|
|
801
|
-
operator: o ===
|
|
801
|
+
operator: o === ke ? "++" : "--",
|
|
802
802
|
argument: this.gobbleTokenProperty(this.gobbleIdentifier()),
|
|
803
803
|
prefix: !0
|
|
804
804
|
}, (!n.node.argument || !e.includes(n.node.argument.type)) && this.throwError(`Unexpected ${n.node.operator}`));
|
|
805
805
|
}), r.hooks.add("after-token", function(n) {
|
|
806
806
|
if (n.node) {
|
|
807
807
|
const o = this.code;
|
|
808
|
-
|
|
808
|
+
fe.updateOperators.some((i) => i === o && i === this.expr.charCodeAt(this.index + 1)) && (e.includes(n.node.type) || this.throwError(`Unexpected ${n.node.operator}`), this.index += 2, n.node = {
|
|
809
809
|
type: "UpdateExpression",
|
|
810
|
-
operator: o ===
|
|
810
|
+
operator: o === ke ? "++" : "--",
|
|
811
811
|
argument: n.node,
|
|
812
812
|
prefix: !1
|
|
813
813
|
});
|
|
@@ -816,17 +816,17 @@ const Ne = 43, at = 45, ce = {
|
|
|
816
816
|
n.node && t(n.node);
|
|
817
817
|
});
|
|
818
818
|
function t(s) {
|
|
819
|
-
|
|
819
|
+
fe.assignmentOperators.has(s.operator) ? (s.type = "AssignmentExpression", t(s.left), t(s.right)) : s.operator || Object.values(s).forEach((n) => {
|
|
820
820
|
n && typeof n == "object" && t(n);
|
|
821
821
|
});
|
|
822
822
|
}
|
|
823
823
|
}
|
|
824
824
|
};
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
const lt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]),
|
|
825
|
+
J.plugins.register(it, fe);
|
|
826
|
+
J.addUnaryOp("typeof");
|
|
827
|
+
J.addLiteral("null", null);
|
|
828
|
+
J.addLiteral("undefined", void 0);
|
|
829
|
+
const lt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]), R = {
|
|
830
830
|
/**
|
|
831
831
|
* @param {jsep.Expression} ast
|
|
832
832
|
* @param {Record<string, any>} subs
|
|
@@ -835,25 +835,25 @@ const lt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
|
|
|
835
835
|
switch (r.type) {
|
|
836
836
|
case "BinaryExpression":
|
|
837
837
|
case "LogicalExpression":
|
|
838
|
-
return
|
|
838
|
+
return R.evalBinaryExpression(r, e);
|
|
839
839
|
case "Compound":
|
|
840
|
-
return
|
|
840
|
+
return R.evalCompound(r, e);
|
|
841
841
|
case "ConditionalExpression":
|
|
842
|
-
return
|
|
842
|
+
return R.evalConditionalExpression(r, e);
|
|
843
843
|
case "Identifier":
|
|
844
|
-
return
|
|
844
|
+
return R.evalIdentifier(r, e);
|
|
845
845
|
case "Literal":
|
|
846
|
-
return
|
|
846
|
+
return R.evalLiteral(r, e);
|
|
847
847
|
case "MemberExpression":
|
|
848
|
-
return
|
|
848
|
+
return R.evalMemberExpression(r, e);
|
|
849
849
|
case "UnaryExpression":
|
|
850
|
-
return
|
|
850
|
+
return R.evalUnaryExpression(r, e);
|
|
851
851
|
case "ArrayExpression":
|
|
852
|
-
return
|
|
852
|
+
return R.evalArrayExpression(r, e);
|
|
853
853
|
case "CallExpression":
|
|
854
|
-
return
|
|
854
|
+
return R.evalCallExpression(r, e);
|
|
855
855
|
case "AssignmentExpression":
|
|
856
|
-
return
|
|
856
|
+
return R.evalAssignmentExpression(r, e);
|
|
857
857
|
default:
|
|
858
858
|
throw SyntaxError("Unexpected expression", r);
|
|
859
859
|
}
|
|
@@ -883,19 +883,19 @@ const lt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
|
|
|
883
883
|
"*": (s, n) => s * n(),
|
|
884
884
|
"/": (s, n) => s / n(),
|
|
885
885
|
"%": (s, n) => s % n()
|
|
886
|
-
}[r.operator](
|
|
886
|
+
}[r.operator](R.evalAst(r.left, e), () => R.evalAst(r.right, e));
|
|
887
887
|
},
|
|
888
888
|
evalCompound(r, e) {
|
|
889
889
|
let t;
|
|
890
890
|
for (let s = 0; s < r.body.length; s++) {
|
|
891
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
892
|
const n = r.body[s];
|
|
893
|
-
t =
|
|
893
|
+
t = R.evalAst(n, e);
|
|
894
894
|
}
|
|
895
895
|
return t;
|
|
896
896
|
},
|
|
897
897
|
evalConditionalExpression(r, e) {
|
|
898
|
-
return
|
|
898
|
+
return R.evalAst(r.test, e) ? R.evalAst(r.consequent, e) : R.evalAst(r.alternate, e);
|
|
899
899
|
},
|
|
900
900
|
evalIdentifier(r, e) {
|
|
901
901
|
if (Object.hasOwn(e, r.name))
|
|
@@ -910,9 +910,9 @@ const lt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
|
|
|
910
910
|
// NOTE: `String(value)` throws error when
|
|
911
911
|
// value has overwritten the toString method to return non-string
|
|
912
912
|
// i.e. `value = {toString: () => []}`
|
|
913
|
-
r.computed ?
|
|
913
|
+
r.computed ? R.evalAst(r.property) : r.property.name
|
|
914
914
|
// `object.property` property is Identifier
|
|
915
|
-
), s =
|
|
915
|
+
), s = R.evalAst(r.object, e);
|
|
916
916
|
if (s == null)
|
|
917
917
|
throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);
|
|
918
918
|
if (!Object.hasOwn(s, t) && lt.has(t))
|
|
@@ -922,25 +922,25 @@ const lt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
|
|
|
922
922
|
},
|
|
923
923
|
evalUnaryExpression(r, e) {
|
|
924
924
|
return {
|
|
925
|
-
"-": (s) => -
|
|
926
|
-
"!": (s) => !
|
|
927
|
-
"~": (s) => ~
|
|
925
|
+
"-": (s) => -R.evalAst(s, e),
|
|
926
|
+
"!": (s) => !R.evalAst(s, e),
|
|
927
|
+
"~": (s) => ~R.evalAst(s, e),
|
|
928
928
|
// eslint-disable-next-line no-implicit-coercion -- API
|
|
929
|
-
"+": (s) => +
|
|
930
|
-
typeof: (s) => typeof
|
|
929
|
+
"+": (s) => +R.evalAst(s, e),
|
|
930
|
+
typeof: (s) => typeof R.evalAst(s, e)
|
|
931
931
|
}[r.operator](r.argument);
|
|
932
932
|
},
|
|
933
933
|
evalArrayExpression(r, e) {
|
|
934
|
-
return r.elements.map((t) =>
|
|
934
|
+
return r.elements.map((t) => R.evalAst(t, e));
|
|
935
935
|
},
|
|
936
936
|
evalCallExpression(r, e) {
|
|
937
|
-
const t = r.arguments.map((n) =>
|
|
938
|
-
return
|
|
937
|
+
const t = r.arguments.map((n) => R.evalAst(n, e));
|
|
938
|
+
return R.evalAst(r.callee, e)(...t);
|
|
939
939
|
},
|
|
940
940
|
evalAssignmentExpression(r, e) {
|
|
941
941
|
if (r.left.type !== "Identifier")
|
|
942
942
|
throw SyntaxError("Invalid left-hand side in assignment");
|
|
943
|
-
const t = r.left.name, s =
|
|
943
|
+
const t = r.left.name, s = R.evalAst(r.right, e);
|
|
944
944
|
return e[t] = s, e[t];
|
|
945
945
|
}
|
|
946
946
|
};
|
|
@@ -949,7 +949,7 @@ class ut {
|
|
|
949
949
|
* @param {string} expr Expression to evaluate
|
|
950
950
|
*/
|
|
951
951
|
constructor(e) {
|
|
952
|
-
this.code = e, this.ast =
|
|
952
|
+
this.code = e, this.ast = J(this.code);
|
|
953
953
|
}
|
|
954
954
|
/**
|
|
955
955
|
* @param {object} context Object whose items will be added
|
|
@@ -958,7 +958,7 @@ class ut {
|
|
|
958
958
|
*/
|
|
959
959
|
runInNewContext(e) {
|
|
960
960
|
const t = Object.assign(/* @__PURE__ */ Object.create(null), e);
|
|
961
|
-
return
|
|
961
|
+
return R.evalAst(this.ast, t);
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
964
|
function re(r, e) {
|
|
@@ -975,10 +975,10 @@ class ct extends Error {
|
|
|
975
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
976
|
}
|
|
977
977
|
}
|
|
978
|
-
function
|
|
979
|
-
if (!(this instanceof
|
|
978
|
+
function L(r, e, t, s, n) {
|
|
979
|
+
if (!(this instanceof L))
|
|
980
980
|
try {
|
|
981
|
-
return new
|
|
981
|
+
return new L(r, e, t, s, n);
|
|
982
982
|
} catch (i) {
|
|
983
983
|
if (!i.avoidNew)
|
|
984
984
|
throw i;
|
|
@@ -999,7 +999,7 @@ function B(r, e, t, s, n) {
|
|
|
999
999
|
return u;
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
|
|
1002
|
+
L.prototype.evaluate = function(r, e, t, s) {
|
|
1003
1003
|
let n = this.parent, o = this.parentProperty, {
|
|
1004
1004
|
flatten: i,
|
|
1005
1005
|
wrap: u
|
|
@@ -1013,44 +1013,44 @@ B.prototype.evaluate = function(r, e, t, s) {
|
|
|
1013
1013
|
json: e
|
|
1014
1014
|
} = r), i = Object.hasOwn(r, "flatten") ? r.flatten : i, this.currResultType = Object.hasOwn(r, "resultType") ? r.resultType : this.currResultType, this.currSandbox = Object.hasOwn(r, "sandbox") ? r.sandbox : this.currSandbox, u = Object.hasOwn(r, "wrap") ? r.wrap : u, 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, o = Object.hasOwn(r, "parentProperty") ? r.parentProperty : o, r = r.path;
|
|
1015
1015
|
}
|
|
1016
|
-
if (n = n || null, o = o || null, Array.isArray(r) && (r =
|
|
1016
|
+
if (n = n || null, o = o || null, Array.isArray(r) && (r = L.toPathString(r)), !r && r !== "" || !e)
|
|
1017
1017
|
return;
|
|
1018
|
-
const a =
|
|
1018
|
+
const a = L.toPathArray(r);
|
|
1019
1019
|
a[0] === "$" && a.length > 1 && a.shift(), this._hasParentSelector = null;
|
|
1020
|
-
const l = this._trace(a, e, ["$"], n, o, t).filter(function(
|
|
1021
|
-
return
|
|
1020
|
+
const l = this._trace(a, e, ["$"], n, o, t).filter(function(p) {
|
|
1021
|
+
return p && !p.isParentSelector;
|
|
1022
1022
|
});
|
|
1023
|
-
return l.length ? !u && l.length === 1 && !l[0].hasArrExpr ? this._getPreferredOutput(l[0]) : l.reduce((
|
|
1024
|
-
const
|
|
1025
|
-
return i && Array.isArray(
|
|
1023
|
+
return l.length ? !u && l.length === 1 && !l[0].hasArrExpr ? this._getPreferredOutput(l[0]) : l.reduce((p, h) => {
|
|
1024
|
+
const v = this._getPreferredOutput(h);
|
|
1025
|
+
return i && Array.isArray(v) ? p = p.concat(v) : p.push(v), p;
|
|
1026
1026
|
}, []) : u ? [] : void 0;
|
|
1027
1027
|
};
|
|
1028
|
-
|
|
1028
|
+
L.prototype._getPreferredOutput = function(r) {
|
|
1029
1029
|
const e = this.currResultType;
|
|
1030
1030
|
switch (e) {
|
|
1031
1031
|
case "all": {
|
|
1032
|
-
const t = Array.isArray(r.path) ? r.path :
|
|
1033
|
-
return r.pointer =
|
|
1032
|
+
const t = Array.isArray(r.path) ? r.path : L.toPathArray(r.path);
|
|
1033
|
+
return r.pointer = L.toPointer(t), r.path = typeof r.path == "string" ? r.path : L.toPathString(r.path), r;
|
|
1034
1034
|
}
|
|
1035
1035
|
case "value":
|
|
1036
1036
|
case "parent":
|
|
1037
1037
|
case "parentProperty":
|
|
1038
1038
|
return r[e];
|
|
1039
1039
|
case "path":
|
|
1040
|
-
return
|
|
1040
|
+
return L.toPathString(r[e]);
|
|
1041
1041
|
case "pointer":
|
|
1042
|
-
return
|
|
1042
|
+
return L.toPointer(r.path);
|
|
1043
1043
|
default:
|
|
1044
1044
|
throw new TypeError("Unknown result type");
|
|
1045
1045
|
}
|
|
1046
1046
|
};
|
|
1047
|
-
|
|
1047
|
+
L.prototype._handleCallback = function(r, e, t) {
|
|
1048
1048
|
if (e) {
|
|
1049
1049
|
const s = this._getPreferredOutput(r);
|
|
1050
|
-
r.path = typeof r.path == "string" ? r.path :
|
|
1050
|
+
r.path = typeof r.path == "string" ? r.path : L.toPathString(r.path), e(s, t, r);
|
|
1051
1051
|
}
|
|
1052
1052
|
};
|
|
1053
|
-
|
|
1053
|
+
L.prototype._trace = function(r, e, t, s, n, o, i, u) {
|
|
1054
1054
|
let a;
|
|
1055
1055
|
if (!r.length)
|
|
1056
1056
|
return a = {
|
|
@@ -1060,27 +1060,27 @@ B.prototype._trace = function(r, e, t, s, n, o, i, u) {
|
|
|
1060
1060
|
parentProperty: n,
|
|
1061
1061
|
hasArrExpr: i
|
|
1062
1062
|
}, this._handleCallback(a, o, "value"), a;
|
|
1063
|
-
const l = r[0],
|
|
1064
|
-
function b
|
|
1065
|
-
Array.isArray(
|
|
1066
|
-
|
|
1067
|
-
}) :
|
|
1063
|
+
const l = r[0], p = r.slice(1), h = [];
|
|
1064
|
+
function v(b) {
|
|
1065
|
+
Array.isArray(b) ? b.forEach((A) => {
|
|
1066
|
+
h.push(A);
|
|
1067
|
+
}) : h.push(b);
|
|
1068
1068
|
}
|
|
1069
1069
|
if ((typeof l != "string" || u) && e && Object.hasOwn(e, l))
|
|
1070
|
-
|
|
1070
|
+
v(this._trace(p, e[l], re(t, l), e, l, o, i));
|
|
1071
1071
|
else if (l === "*")
|
|
1072
|
-
this._walk(e, (
|
|
1073
|
-
|
|
1072
|
+
this._walk(e, (b) => {
|
|
1073
|
+
v(this._trace(p, e[b], re(t, b), e, b, o, !0, !0));
|
|
1074
1074
|
});
|
|
1075
1075
|
else if (l === "..")
|
|
1076
|
-
|
|
1077
|
-
typeof e[
|
|
1076
|
+
v(this._trace(p, e, t, s, n, o, i)), this._walk(e, (b) => {
|
|
1077
|
+
typeof e[b] == "object" && v(this._trace(r.slice(), e[b], re(t, b), e, b, o, !0));
|
|
1078
1078
|
});
|
|
1079
1079
|
else {
|
|
1080
1080
|
if (l === "^")
|
|
1081
1081
|
return this._hasParentSelector = !0, {
|
|
1082
1082
|
path: t.slice(0, -1),
|
|
1083
|
-
expr:
|
|
1083
|
+
expr: p,
|
|
1084
1084
|
isParentSelector: !0
|
|
1085
1085
|
};
|
|
1086
1086
|
if (l === "~")
|
|
@@ -1091,62 +1091,62 @@ B.prototype._trace = function(r, e, t, s, n, o, i, u) {
|
|
|
1091
1091
|
parentProperty: null
|
|
1092
1092
|
}, this._handleCallback(a, o, "property"), a;
|
|
1093
1093
|
if (l === "$")
|
|
1094
|
-
|
|
1094
|
+
v(this._trace(p, e, t, null, null, o, i));
|
|
1095
1095
|
else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))
|
|
1096
|
-
|
|
1096
|
+
v(this._slice(l, p, e, t, s, n, o));
|
|
1097
1097
|
else if (l.indexOf("?(") === 0) {
|
|
1098
1098
|
if (this.currEval === !1)
|
|
1099
1099
|
throw new Error("Eval [?(expr)] prevented in JSONPath expression.");
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
const
|
|
1103
|
-
this._trace(
|
|
1104
|
-
}) : this._walk(e, (
|
|
1105
|
-
this._eval(
|
|
1100
|
+
const b = l.replace(/^\?\((.*?)\)$/u, "$1"), A = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(b);
|
|
1101
|
+
A ? this._walk(e, (P) => {
|
|
1102
|
+
const k = [A[2]], S = A[1] ? e[P][A[1]] : e[P];
|
|
1103
|
+
this._trace(k, S, t, s, n, o, !0).length > 0 && v(this._trace(p, e[P], re(t, P), e, P, o, !0));
|
|
1104
|
+
}) : this._walk(e, (P) => {
|
|
1105
|
+
this._eval(b, e[P], P, t, s, n) && v(this._trace(p, e[P], re(t, P), e, P, o, !0));
|
|
1106
1106
|
});
|
|
1107
1107
|
} else if (l[0] === "(") {
|
|
1108
1108
|
if (this.currEval === !1)
|
|
1109
1109
|
throw new Error("Eval [(expr)] prevented in JSONPath expression.");
|
|
1110
|
-
|
|
1110
|
+
v(this._trace(Ae(this._eval(l, e, t.at(-1), t.slice(0, -1), s, n), p), e, t, s, n, o, i));
|
|
1111
1111
|
} else if (l[0] === "@") {
|
|
1112
|
-
let
|
|
1113
|
-
const
|
|
1114
|
-
switch (
|
|
1112
|
+
let b = !1;
|
|
1113
|
+
const A = l.slice(1, -2);
|
|
1114
|
+
switch (A) {
|
|
1115
1115
|
case "scalar":
|
|
1116
|
-
(!e || !["object", "function"].includes(typeof e)) && (
|
|
1116
|
+
(!e || !["object", "function"].includes(typeof e)) && (b = !0);
|
|
1117
1117
|
break;
|
|
1118
1118
|
case "boolean":
|
|
1119
1119
|
case "string":
|
|
1120
1120
|
case "undefined":
|
|
1121
1121
|
case "function":
|
|
1122
|
-
typeof e ===
|
|
1122
|
+
typeof e === A && (b = !0);
|
|
1123
1123
|
break;
|
|
1124
1124
|
case "integer":
|
|
1125
|
-
Number.isFinite(e) && !(e % 1) && (
|
|
1125
|
+
Number.isFinite(e) && !(e % 1) && (b = !0);
|
|
1126
1126
|
break;
|
|
1127
1127
|
case "number":
|
|
1128
|
-
Number.isFinite(e) && (
|
|
1128
|
+
Number.isFinite(e) && (b = !0);
|
|
1129
1129
|
break;
|
|
1130
1130
|
case "nonFinite":
|
|
1131
|
-
typeof e == "number" && !Number.isFinite(e) && (
|
|
1131
|
+
typeof e == "number" && !Number.isFinite(e) && (b = !0);
|
|
1132
1132
|
break;
|
|
1133
1133
|
case "object":
|
|
1134
|
-
e && typeof e ===
|
|
1134
|
+
e && typeof e === A && (b = !0);
|
|
1135
1135
|
break;
|
|
1136
1136
|
case "array":
|
|
1137
|
-
Array.isArray(e) && (
|
|
1137
|
+
Array.isArray(e) && (b = !0);
|
|
1138
1138
|
break;
|
|
1139
1139
|
case "other":
|
|
1140
|
-
|
|
1140
|
+
b = this.currOtherTypeCallback(e, t, s, n);
|
|
1141
1141
|
break;
|
|
1142
1142
|
case "null":
|
|
1143
|
-
e === null && (
|
|
1143
|
+
e === null && (b = !0);
|
|
1144
1144
|
break;
|
|
1145
1145
|
/* c8 ignore next 2 */
|
|
1146
1146
|
default:
|
|
1147
|
-
throw new TypeError("Unknown value type " +
|
|
1147
|
+
throw new TypeError("Unknown value type " + A);
|
|
1148
1148
|
}
|
|
1149
|
-
if (
|
|
1149
|
+
if (b)
|
|
1150
1150
|
return a = {
|
|
1151
1151
|
path: t,
|
|
1152
1152
|
value: e,
|
|
@@ -1154,31 +1154,31 @@ B.prototype._trace = function(r, e, t, s, n, o, i, u) {
|
|
|
1154
1154
|
parentProperty: n
|
|
1155
1155
|
}, this._handleCallback(a, o, "value"), a;
|
|
1156
1156
|
} else if (l[0] === "`" && e && Object.hasOwn(e, l.slice(1))) {
|
|
1157
|
-
const
|
|
1158
|
-
|
|
1157
|
+
const b = l.slice(1);
|
|
1158
|
+
v(this._trace(p, e[b], re(t, b), e, b, o, i, !0));
|
|
1159
1159
|
} else if (l.includes(",")) {
|
|
1160
|
-
const
|
|
1161
|
-
for (const
|
|
1162
|
-
|
|
1163
|
-
} else !u && e && Object.hasOwn(e, l) &&
|
|
1160
|
+
const b = l.split(",");
|
|
1161
|
+
for (const A of b)
|
|
1162
|
+
v(this._trace(Ae(A, p), e, t, s, n, o, !0));
|
|
1163
|
+
} else !u && e && Object.hasOwn(e, l) && v(this._trace(p, e[l], re(t, l), e, l, o, i, !0));
|
|
1164
1164
|
}
|
|
1165
1165
|
if (this._hasParentSelector)
|
|
1166
|
-
for (let
|
|
1167
|
-
const
|
|
1168
|
-
if (
|
|
1169
|
-
const
|
|
1170
|
-
if (Array.isArray(
|
|
1171
|
-
|
|
1172
|
-
const
|
|
1173
|
-
for (let
|
|
1174
|
-
|
|
1166
|
+
for (let b = 0; b < h.length; b++) {
|
|
1167
|
+
const A = h[b];
|
|
1168
|
+
if (A && A.isParentSelector) {
|
|
1169
|
+
const P = this._trace(A.expr, e, A.path, s, n, o, i);
|
|
1170
|
+
if (Array.isArray(P)) {
|
|
1171
|
+
h[b] = P[0];
|
|
1172
|
+
const k = P.length;
|
|
1173
|
+
for (let S = 1; S < k; S++)
|
|
1174
|
+
b++, h.splice(b, 0, P[S]);
|
|
1175
1175
|
} else
|
|
1176
|
-
|
|
1176
|
+
h[b] = P;
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
|
-
return
|
|
1179
|
+
return h;
|
|
1180
1180
|
};
|
|
1181
|
-
|
|
1181
|
+
L.prototype._walk = function(r, e) {
|
|
1182
1182
|
if (Array.isArray(r)) {
|
|
1183
1183
|
const t = r.length;
|
|
1184
1184
|
for (let s = 0; s < t; s++)
|
|
@@ -1187,67 +1187,67 @@ B.prototype._walk = function(r, e) {
|
|
|
1187
1187
|
e(t);
|
|
1188
1188
|
});
|
|
1189
1189
|
};
|
|
1190
|
-
|
|
1190
|
+
L.prototype._slice = function(r, e, t, s, n, o, i) {
|
|
1191
1191
|
if (!Array.isArray(t))
|
|
1192
1192
|
return;
|
|
1193
1193
|
const u = t.length, a = r.split(":"), l = a[2] && Number.parseInt(a[2]) || 1;
|
|
1194
|
-
let
|
|
1195
|
-
|
|
1196
|
-
const
|
|
1197
|
-
for (let
|
|
1198
|
-
this._trace(Ae(
|
|
1199
|
-
|
|
1194
|
+
let p = a[0] && Number.parseInt(a[0]) || 0, h = a[1] && Number.parseInt(a[1]) || u;
|
|
1195
|
+
p = p < 0 ? Math.max(0, p + u) : Math.min(u, p), h = h < 0 ? Math.max(0, h + u) : Math.min(u, h);
|
|
1196
|
+
const v = [];
|
|
1197
|
+
for (let b = p; b < h; b += l)
|
|
1198
|
+
this._trace(Ae(b, e), t, s, n, o, i, !0).forEach((P) => {
|
|
1199
|
+
v.push(P);
|
|
1200
1200
|
});
|
|
1201
|
-
return
|
|
1201
|
+
return v;
|
|
1202
1202
|
};
|
|
1203
|
-
|
|
1203
|
+
L.prototype._eval = function(r, e, t, s, n, o) {
|
|
1204
1204
|
this.currSandbox._$_parentProperty = o, this.currSandbox._$_parent = n, this.currSandbox._$_property = t, this.currSandbox._$_root = this.json, this.currSandbox._$_v = e;
|
|
1205
1205
|
const i = r.includes("@path");
|
|
1206
|
-
i && (this.currSandbox._$_path =
|
|
1206
|
+
i && (this.currSandbox._$_path = L.toPathString(s.concat([t])));
|
|
1207
1207
|
const u = this.currEval + "Script:" + r;
|
|
1208
|
-
if (!
|
|
1208
|
+
if (!L.cache[u]) {
|
|
1209
1209
|
let a = r.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
|
|
1210
1210
|
if (i && (a = a.replaceAll("@path", "_$_path")), this.currEval === "safe" || this.currEval === !0 || this.currEval === void 0)
|
|
1211
|
-
|
|
1211
|
+
L.cache[u] = new this.safeVm.Script(a);
|
|
1212
1212
|
else if (this.currEval === "native")
|
|
1213
|
-
|
|
1213
|
+
L.cache[u] = new this.vm.Script(a);
|
|
1214
1214
|
else if (typeof this.currEval == "function" && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, "runInNewContext")) {
|
|
1215
1215
|
const l = this.currEval;
|
|
1216
|
-
|
|
1216
|
+
L.cache[u] = new l(a);
|
|
1217
1217
|
} else if (typeof this.currEval == "function")
|
|
1218
|
-
|
|
1218
|
+
L.cache[u] = {
|
|
1219
1219
|
runInNewContext: (l) => this.currEval(a, l)
|
|
1220
1220
|
};
|
|
1221
1221
|
else
|
|
1222
1222
|
throw new TypeError(`Unknown "eval" property "${this.currEval}"`);
|
|
1223
1223
|
}
|
|
1224
1224
|
try {
|
|
1225
|
-
return
|
|
1225
|
+
return L.cache[u].runInNewContext(this.currSandbox);
|
|
1226
1226
|
} catch (a) {
|
|
1227
1227
|
if (this.ignoreEvalErrors)
|
|
1228
1228
|
return !1;
|
|
1229
1229
|
throw new Error("jsonPath: " + a.message + ": " + r);
|
|
1230
1230
|
}
|
|
1231
1231
|
};
|
|
1232
|
-
|
|
1233
|
-
|
|
1232
|
+
L.cache = {};
|
|
1233
|
+
L.toPathString = function(r) {
|
|
1234
1234
|
const e = r, t = e.length;
|
|
1235
1235
|
let s = "$";
|
|
1236
1236
|
for (let n = 1; n < t; n++)
|
|
1237
1237
|
/^(~|\^|@.*?\(\))$/u.test(e[n]) || (s += /^[0-9*]+$/u.test(e[n]) ? "[" + e[n] + "]" : "['" + e[n] + "']");
|
|
1238
1238
|
return s;
|
|
1239
1239
|
};
|
|
1240
|
-
|
|
1240
|
+
L.toPointer = function(r) {
|
|
1241
1241
|
const e = r, t = e.length;
|
|
1242
1242
|
let s = "";
|
|
1243
1243
|
for (let n = 1; n < t; n++)
|
|
1244
1244
|
/^(~|\^|@.*?\(\))$/u.test(e[n]) || (s += "/" + e[n].toString().replaceAll("~", "~0").replaceAll("/", "~1"));
|
|
1245
1245
|
return s;
|
|
1246
1246
|
};
|
|
1247
|
-
|
|
1247
|
+
L.toPathArray = function(r) {
|
|
1248
1248
|
const {
|
|
1249
1249
|
cache: e
|
|
1250
|
-
} =
|
|
1250
|
+
} = L;
|
|
1251
1251
|
if (e[r])
|
|
1252
1252
|
return e[r].concat();
|
|
1253
1253
|
const t = [], n = r.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function(o, i) {
|
|
@@ -1262,7 +1262,7 @@ B.toPathArray = function(r) {
|
|
|
1262
1262
|
});
|
|
1263
1263
|
return e[r] = n, e[r].concat();
|
|
1264
1264
|
};
|
|
1265
|
-
|
|
1265
|
+
L.prototype.safeVm = {
|
|
1266
1266
|
Script: ut
|
|
1267
1267
|
};
|
|
1268
1268
|
const dt = function(r, e, t) {
|
|
@@ -1289,15 +1289,15 @@ class ft {
|
|
|
1289
1289
|
const s = Object.keys(e), n = [];
|
|
1290
1290
|
dt(s, n, (l) => typeof e[l] == "function");
|
|
1291
1291
|
const o = s.map((l) => e[l]);
|
|
1292
|
-
t = n.reduce((l,
|
|
1293
|
-
let
|
|
1294
|
-
return /function/u.test(
|
|
1292
|
+
t = n.reduce((l, p) => {
|
|
1293
|
+
let h = e[p].toString();
|
|
1294
|
+
return /function/u.test(h) || (h = "function " + h), "var " + p + "=" + h + ";" + l;
|
|
1295
1295
|
}, "") + t, !/(['"])use strict\1/u.test(t) && !s.includes("arguments") && (t = "var arguments = undefined;" + t), t = t.replace(/;\s*$/u, "");
|
|
1296
1296
|
const u = t.lastIndexOf(";"), a = u !== -1 ? t.slice(0, u + 1) + " return " + t.slice(u + 1) : " return " + t;
|
|
1297
1297
|
return new Function(...s, a)(...o);
|
|
1298
1298
|
}
|
|
1299
1299
|
}
|
|
1300
|
-
|
|
1300
|
+
L.prototype.vm = {
|
|
1301
1301
|
Script: ft
|
|
1302
1302
|
};
|
|
1303
1303
|
const ht = { class: "json-node" }, pt = {
|
|
@@ -1306,16 +1306,13 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1306
1306
|
}, gt = { class: "json-node__line" }, mt = {
|
|
1307
1307
|
key: 2,
|
|
1308
1308
|
class: "json-node__colon"
|
|
1309
|
-
}, yt = ["title"], bt = {
|
|
1310
|
-
key:
|
|
1311
|
-
class: "json-node__collapsed"
|
|
1312
|
-
}, vt = {
|
|
1313
|
-
key: 4,
|
|
1309
|
+
}, yt = ["title"], bt = ["title"], vt = {
|
|
1310
|
+
key: 5,
|
|
1314
1311
|
class: "json-node__comma"
|
|
1315
|
-
},
|
|
1312
|
+
}, _t = {
|
|
1316
1313
|
key: 0,
|
|
1317
1314
|
class: "json-node__children"
|
|
1318
|
-
},
|
|
1315
|
+
}, Et = { class: "json-node__children-content" }, xt = { class: "json-node__line json-node__closing-bracket" }, kt = { class: "json-node__bracket" }, Nt = {
|
|
1319
1316
|
key: 0,
|
|
1320
1317
|
class: "json-node__comma"
|
|
1321
1318
|
}, At = {
|
|
@@ -1341,181 +1338,192 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1341
1338
|
},
|
|
1342
1339
|
emits: ["update:value", "toggle-expand", "copy", "update:key"],
|
|
1343
1340
|
setup(r, { emit: e }) {
|
|
1344
|
-
Oe((
|
|
1345
|
-
"
|
|
1346
|
-
"
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
"
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
"
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1341
|
+
Oe((c) => ({
|
|
1342
|
+
"35be1c39": c.level,
|
|
1343
|
+
"5e416c24": c.theme.colors.syntaxKey,
|
|
1344
|
+
a0c0ff08: c.theme.colors.hoverBackground,
|
|
1345
|
+
d7c00e92: c.theme.colors.syntaxBracket,
|
|
1346
|
+
"5de67d96": c.theme.colors.collapsedText,
|
|
1347
|
+
"19acdad7": c.theme.colors.collapsedBackground,
|
|
1348
|
+
f54fa6b6: c.theme.colors.collapsedBackgroundHover,
|
|
1349
|
+
"825653bc": c.theme.colors.syntaxString,
|
|
1350
|
+
"934f5d4c": c.theme.colors.syntaxNumber,
|
|
1351
|
+
e06a8f92: c.theme.colors.syntaxBoolean,
|
|
1352
|
+
"4b0b8bd8": c.theme.colors.syntaxNull,
|
|
1353
|
+
"3a19b608": c.theme.colors.background,
|
|
1354
|
+
"4ee8ae8e": c.theme.colors.indentLine
|
|
1356
1355
|
}));
|
|
1357
|
-
const t = r, s = e, n =
|
|
1356
|
+
const t = r, s = e, n = Y(!1), o = Y(!1), i = Y(""), u = Y(""), a = Y("string"), l = (c) => c !== null && typeof c == "object" && !Array.isArray(c) && "__protected_number__" in c && Object.keys(c).length === 1, p = (c) => l(c) ? c.__protected_number__ : "", h = V(() => l(t.value) ? !1 : t.value !== null && typeof t.value == "object"), v = V(() => Array.isArray(t.value)), b = V(() => t.path ? t.path : t.keyName ? t.keyName : "root"), A = V(() => t.expanded.has(b.value)), P = V(() => t.keyName), k = V(() => v.value ? "[" : "{"), S = V(() => v.value ? "]" : "}"), F = V(() => {
|
|
1358
1357
|
if (!t.value) return "";
|
|
1359
|
-
const
|
|
1360
|
-
return
|
|
1361
|
-
}),
|
|
1362
|
-
const
|
|
1363
|
-
return t.value === null ? "json-node__value--null" :
|
|
1364
|
-
}),
|
|
1365
|
-
const
|
|
1366
|
-
return
|
|
1367
|
-
},
|
|
1358
|
+
const f = Object.keys(t.value).length;
|
|
1359
|
+
return v.value ? f > 0 ? ` ${f} items ` : " " : f > 0 ? ` ${f} keys ` : " ";
|
|
1360
|
+
}), Z = V(() => {
|
|
1361
|
+
const c = typeof t.value;
|
|
1362
|
+
return t.value === null ? "json-node__value--null" : c === "boolean" ? "json-node__value--boolean" : c === "number" || l(t.value) ? "json-node__value--number" : c === "string" ? "json-node__value--string" : "";
|
|
1363
|
+
}), g = V(() => o.value ? u.value : t.value === null ? "null" : typeof t.value == "boolean" || typeof t.value == "number" ? String(t.value) : l(t.value) ? p(t.value) : typeof t.value == "string" ? `"${t.value}"` : String(t.value)), m = V(() => "Click to edit, double-click to copy"), O = (c) => t.level === 0 ? c : b.value ? `${b.value}.${c}` : c, $ = (c) => {
|
|
1364
|
+
const f = Object.keys(t.value);
|
|
1365
|
+
return f.indexOf(c) === f.length - 1;
|
|
1366
|
+
}, j = () => {
|
|
1368
1367
|
s("toggle-expand", b.value);
|
|
1369
|
-
},
|
|
1368
|
+
}, H = () => {
|
|
1370
1369
|
t.level !== 0 && (n.value = !0, i.value = t.keyName, he(() => {
|
|
1371
|
-
const
|
|
1372
|
-
|
|
1370
|
+
const c = document.querySelectorAll(".json-node__key-input"), f = c[c.length - 1];
|
|
1371
|
+
f && (f.focus(), f.select());
|
|
1373
1372
|
}));
|
|
1374
|
-
},
|
|
1375
|
-
h.value || (o.value = !0, a(t.value) ?
|
|
1376
|
-
const
|
|
1377
|
-
|
|
1373
|
+
}, G = () => {
|
|
1374
|
+
h.value || (o.value = !0, t.value === null ? a.value = "null" : l(t.value) ? a.value = "protected-number" : typeof t.value == "string" ? a.value = "string" : typeof t.value == "number" ? a.value = "number" : typeof t.value == "boolean" && (a.value = "boolean"), l(t.value) ? u.value = p(t.value) : typeof t.value == "string" ? u.value = t.value : u.value = String(t.value), he(() => {
|
|
1375
|
+
const c = document.querySelectorAll(".json-node__value-input"), f = c[c.length - 1];
|
|
1376
|
+
f && (f.focus(), f.select());
|
|
1378
1377
|
}));
|
|
1379
|
-
},
|
|
1378
|
+
}, K = () => {
|
|
1380
1379
|
if (t.level === 0 || !n.value) return;
|
|
1381
|
-
const
|
|
1382
|
-
if (!
|
|
1383
|
-
|
|
1380
|
+
const c = i.value.trim();
|
|
1381
|
+
if (!c) {
|
|
1382
|
+
te();
|
|
1384
1383
|
return;
|
|
1385
1384
|
}
|
|
1386
|
-
if (
|
|
1385
|
+
if (c === t.keyName) {
|
|
1387
1386
|
n.value = !1;
|
|
1388
1387
|
return;
|
|
1389
1388
|
}
|
|
1390
|
-
n.value = !1, s("update:key", b.value,
|
|
1391
|
-
},
|
|
1389
|
+
n.value = !1, s("update:key", b.value, c);
|
|
1390
|
+
}, ee = () => {
|
|
1392
1391
|
try {
|
|
1393
|
-
let
|
|
1394
|
-
const
|
|
1395
|
-
if (
|
|
1396
|
-
|
|
1397
|
-
else if (
|
|
1398
|
-
|
|
1399
|
-
else if (
|
|
1400
|
-
|
|
1401
|
-
|
|
1392
|
+
let c;
|
|
1393
|
+
const f = u.value.trim();
|
|
1394
|
+
if (a.value === "string")
|
|
1395
|
+
f === "null" ? c = null : f === "true" || f === "false" ? c = f === "true" : c = u.value;
|
|
1396
|
+
else if (a.value === "protected-number")
|
|
1397
|
+
c = { __protected_number__: f };
|
|
1398
|
+
else if (f === "null")
|
|
1399
|
+
c = null;
|
|
1400
|
+
else if (f === "true" || f === "false")
|
|
1401
|
+
c = f === "true";
|
|
1402
|
+
else if (!isNaN(Number(f)) && f !== "") {
|
|
1403
|
+
const w = Number(f);
|
|
1404
|
+
!Number.isSafeInteger(w) || f.length > 15 ? c = { __protected_number__: f } : c = w;
|
|
1402
1405
|
} else
|
|
1403
|
-
|
|
1404
|
-
s("update:value", b.value,
|
|
1405
|
-
} catch (
|
|
1406
|
-
console.error("Failed to parse value:",
|
|
1406
|
+
c = u.value;
|
|
1407
|
+
s("update:value", b.value, c), o.value = !1;
|
|
1408
|
+
} catch (c) {
|
|
1409
|
+
console.error("Failed to parse value:", c), o.value = !1;
|
|
1407
1410
|
}
|
|
1408
|
-
},
|
|
1411
|
+
}, te = () => {
|
|
1409
1412
|
n.value = !1, i.value = t.keyName;
|
|
1410
|
-
},
|
|
1411
|
-
o.value = !1,
|
|
1413
|
+
}, ue = () => {
|
|
1414
|
+
o.value = !1, l(t.value) ? u.value = p(t.value) : typeof t.value == "string" ? u.value = t.value : u.value = String(t.value);
|
|
1412
1415
|
};
|
|
1413
|
-
return (
|
|
1414
|
-
const
|
|
1415
|
-
return
|
|
1416
|
-
h.value ? (
|
|
1417
|
-
|
|
1418
|
-
|
|
1416
|
+
return (c, f) => {
|
|
1417
|
+
const w = Me("JsonNode", !0);
|
|
1418
|
+
return _(), x("div", ht, [
|
|
1419
|
+
h.value ? (_(), x("div", pt, [
|
|
1420
|
+
y("div", gt, [
|
|
1421
|
+
c.keyName && !n.value ? (_(), x("span", {
|
|
1419
1422
|
key: 0,
|
|
1420
1423
|
class: "json-node__key",
|
|
1421
|
-
onClick:
|
|
1424
|
+
onClick: H,
|
|
1422
1425
|
title: "Click to edit key"
|
|
1423
|
-
}, ' "' +
|
|
1424
|
-
|
|
1426
|
+
}, ' "' + B(P.value) + '" ', 1)) : U("", !0),
|
|
1427
|
+
c.keyName && n.value ? Ee((_(), x("input", {
|
|
1425
1428
|
key: 1,
|
|
1426
|
-
"onUpdate:modelValue":
|
|
1429
|
+
"onUpdate:modelValue": f[0] || (f[0] = (E) => i.value = E),
|
|
1427
1430
|
onKeyup: [
|
|
1428
|
-
|
|
1429
|
-
|
|
1431
|
+
de(K, ["enter"]),
|
|
1432
|
+
de(te, ["escape"])
|
|
1430
1433
|
],
|
|
1431
|
-
onBlur:
|
|
1434
|
+
onBlur: K,
|
|
1432
1435
|
class: "json-node__key-input"
|
|
1433
1436
|
}, null, 544)), [
|
|
1434
1437
|
[xe, i.value]
|
|
1435
|
-
]) :
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
+
]) : U("", !0),
|
|
1439
|
+
c.keyName ? (_(), x("span", mt, ": ")) : U("", !0),
|
|
1440
|
+
y("span", {
|
|
1438
1441
|
class: "json-node__bracket json-node__bracket--clickable",
|
|
1439
|
-
onClick:
|
|
1440
|
-
title:
|
|
1441
|
-
},
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1442
|
+
onClick: j,
|
|
1443
|
+
title: A.value ? "Click to collapse" : "Click to expand"
|
|
1444
|
+
}, B(k.value), 9, yt),
|
|
1445
|
+
A.value ? U("", !0) : (_(), x("span", {
|
|
1446
|
+
key: 3,
|
|
1447
|
+
class: "json-node__collapsed-info",
|
|
1448
|
+
onClick: j,
|
|
1449
|
+
title: `Click to expand ${F.value.trim()}`
|
|
1450
|
+
}, B(F.value), 9, bt)),
|
|
1451
|
+
A.value ? U("", !0) : (_(), x("span", {
|
|
1452
|
+
key: 4,
|
|
1453
|
+
class: "json-node__bracket json-node__bracket--clickable",
|
|
1454
|
+
onClick: j,
|
|
1455
|
+
title: "Click to expand"
|
|
1456
|
+
}, B(S.value), 1)),
|
|
1457
|
+
!A.value && !c.isLast ? (_(), x("span", vt, ",")) : U("", !0)
|
|
1450
1458
|
]),
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
(
|
|
1454
|
-
key:
|
|
1459
|
+
A.value ? (_(), x("div", _t, [
|
|
1460
|
+
y("div", Et, [
|
|
1461
|
+
(_(!0), x(ne, null, ie(c.value, (E, T) => (_(), x("div", {
|
|
1462
|
+
key: T,
|
|
1455
1463
|
class: "json-node__child"
|
|
1456
1464
|
}, [
|
|
1457
|
-
|
|
1458
|
-
value:
|
|
1459
|
-
"key-name":
|
|
1460
|
-
level:
|
|
1461
|
-
path:
|
|
1462
|
-
expanded:
|
|
1463
|
-
theme:
|
|
1464
|
-
"onUpdate:value":
|
|
1465
|
-
onToggleExpand:
|
|
1466
|
-
onCopy:
|
|
1467
|
-
"onUpdate:key":
|
|
1468
|
-
"is-last":
|
|
1465
|
+
Ue(w, {
|
|
1466
|
+
value: E,
|
|
1467
|
+
"key-name": v.value ? "" : String(T),
|
|
1468
|
+
level: c.level + 1,
|
|
1469
|
+
path: O(String(T)),
|
|
1470
|
+
expanded: c.expanded,
|
|
1471
|
+
theme: c.theme,
|
|
1472
|
+
"onUpdate:value": f[1] || (f[1] = (C, I) => c.$emit("update:value", C, I)),
|
|
1473
|
+
onToggleExpand: f[2] || (f[2] = (C) => c.$emit("toggle-expand", C)),
|
|
1474
|
+
onCopy: f[3] || (f[3] = (C) => c.$emit("copy", C)),
|
|
1475
|
+
"onUpdate:key": f[4] || (f[4] = (C, I) => c.$emit("update:key", C, I)),
|
|
1476
|
+
"is-last": $(String(T))
|
|
1469
1477
|
}, null, 8, ["value", "key-name", "level", "path", "expanded", "theme", "is-last"])
|
|
1470
1478
|
]))), 128))
|
|
1471
1479
|
]),
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1480
|
+
y("div", xt, [
|
|
1481
|
+
y("span", kt, B(S.value), 1),
|
|
1482
|
+
c.isLast ? U("", !0) : (_(), x("span", Nt, ","))
|
|
1475
1483
|
])
|
|
1476
|
-
])) :
|
|
1477
|
-
])) : (
|
|
1478
|
-
|
|
1484
|
+
])) : U("", !0)
|
|
1485
|
+
])) : (_(), x("div", At, [
|
|
1486
|
+
c.keyName && !n.value ? (_(), x("span", {
|
|
1479
1487
|
key: 0,
|
|
1480
1488
|
class: "json-node__key",
|
|
1481
|
-
onClick:
|
|
1489
|
+
onClick: H,
|
|
1482
1490
|
title: "Click to edit key"
|
|
1483
|
-
}, ' "' +
|
|
1484
|
-
|
|
1491
|
+
}, ' "' + B(P.value) + '" ', 1)) : U("", !0),
|
|
1492
|
+
c.keyName && n.value ? Ee((_(), x("input", {
|
|
1485
1493
|
key: 1,
|
|
1486
|
-
"onUpdate:modelValue":
|
|
1494
|
+
"onUpdate:modelValue": f[5] || (f[5] = (E) => i.value = E),
|
|
1487
1495
|
onKeyup: [
|
|
1488
|
-
|
|
1489
|
-
|
|
1496
|
+
de(K, ["enter"]),
|
|
1497
|
+
de(te, ["escape"])
|
|
1490
1498
|
],
|
|
1491
|
-
onBlur:
|
|
1499
|
+
onBlur: K,
|
|
1492
1500
|
class: "json-node__key-input"
|
|
1493
1501
|
}, null, 544)), [
|
|
1494
1502
|
[xe, i.value]
|
|
1495
|
-
]) :
|
|
1496
|
-
|
|
1497
|
-
o.value ?
|
|
1503
|
+
]) : U("", !0),
|
|
1504
|
+
c.keyName ? (_(), x("span", wt, ": ")) : U("", !0),
|
|
1505
|
+
o.value ? U("", !0) : (_(), x("span", {
|
|
1498
1506
|
key: 3,
|
|
1499
|
-
class: Te(["json-node__value",
|
|
1500
|
-
onClick:
|
|
1501
|
-
onDblclick:
|
|
1502
|
-
title:
|
|
1507
|
+
class: Te(["json-node__value", Z.value]),
|
|
1508
|
+
onClick: G,
|
|
1509
|
+
onDblclick: f[6] || (f[6] = (E) => c.$emit("copy", c.value)),
|
|
1510
|
+
title: m.value
|
|
1503
1511
|
}, [
|
|
1504
|
-
|
|
1505
|
-
|
|
1512
|
+
De(B(g.value), 1),
|
|
1513
|
+
c.isLast ? U("", !0) : (_(), x("span", Ot, ","))
|
|
1506
1514
|
], 42, Ct)),
|
|
1507
|
-
o.value ?
|
|
1515
|
+
o.value ? Ee((_(), x("input", {
|
|
1508
1516
|
key: 4,
|
|
1509
|
-
"onUpdate:modelValue":
|
|
1517
|
+
"onUpdate:modelValue": f[7] || (f[7] = (E) => u.value = E),
|
|
1510
1518
|
onKeyup: [
|
|
1511
|
-
|
|
1512
|
-
ue
|
|
1519
|
+
de(ee, ["enter"]),
|
|
1520
|
+
de(ue, ["escape"])
|
|
1513
1521
|
],
|
|
1514
|
-
onBlur:
|
|
1522
|
+
onBlur: ee,
|
|
1515
1523
|
class: "json-node__value-input"
|
|
1516
1524
|
}, null, 544)), [
|
|
1517
1525
|
[xe, u.value]
|
|
1518
|
-
]) :
|
|
1526
|
+
]) : U("", !0)
|
|
1519
1527
|
]))
|
|
1520
1528
|
]);
|
|
1521
1529
|
};
|
|
@@ -1525,7 +1533,7 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1525
1533
|
for (const [s, n] of e)
|
|
1526
1534
|
t[s] = n;
|
|
1527
1535
|
return t;
|
|
1528
|
-
}, Pt = /* @__PURE__ */ be(Tt, [["__scopeId", "data-v-
|
|
1536
|
+
}, Pt = /* @__PURE__ */ be(Tt, [["__scopeId", "data-v-58992c45"]]), He = {
|
|
1529
1537
|
name: "github-light",
|
|
1530
1538
|
colors: {
|
|
1531
1539
|
// 背景色
|
|
@@ -1555,12 +1563,12 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1555
1563
|
syntaxNull: "#656d76",
|
|
1556
1564
|
syntaxKey: "#0969da",
|
|
1557
1565
|
syntaxBracket: "#24292f",
|
|
1558
|
-
// 滚动条
|
|
1559
|
-
scrollbarTrack: "#f6f8fa",
|
|
1560
|
-
scrollbarThumb: "#d0d7de",
|
|
1561
|
-
scrollbarThumbHover: "#afb8c1",
|
|
1562
1566
|
// 悬停效果
|
|
1563
1567
|
hoverBackground: "#f6f8fa",
|
|
1568
|
+
// 折叠信息样式
|
|
1569
|
+
collapsedBackground: "#ddf4ff",
|
|
1570
|
+
collapsedBackgroundHover: "#b6e3ff",
|
|
1571
|
+
collapsedText: "#0969da",
|
|
1564
1572
|
// 缩进线
|
|
1565
1573
|
indentLine: "#d0d7de"
|
|
1566
1574
|
}
|
|
@@ -1594,12 +1602,12 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1594
1602
|
syntaxNull: "#7d8590",
|
|
1595
1603
|
syntaxKey: "#79c0ff",
|
|
1596
1604
|
syntaxBracket: "#e6edf3",
|
|
1597
|
-
// 滚动条
|
|
1598
|
-
scrollbarTrack: "#161b22",
|
|
1599
|
-
scrollbarThumb: "#30363d",
|
|
1600
|
-
scrollbarThumbHover: "#6e7681",
|
|
1601
1605
|
// 悬停效果
|
|
1602
1606
|
hoverBackground: "#161b22",
|
|
1607
|
+
// 折叠信息样式
|
|
1608
|
+
collapsedBackground: "#1c2128",
|
|
1609
|
+
collapsedBackgroundHover: "#2d333b",
|
|
1610
|
+
collapsedText: "#79c0ff",
|
|
1603
1611
|
// 缩进线
|
|
1604
1612
|
indentLine: "#30363d"
|
|
1605
1613
|
}
|
|
@@ -1633,16 +1641,16 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1633
1641
|
syntaxNull: "#6b7280",
|
|
1634
1642
|
syntaxKey: "#1f2937",
|
|
1635
1643
|
syntaxBracket: "#374151",
|
|
1636
|
-
// 滚动条 - 极简
|
|
1637
|
-
scrollbarTrack: "#f5f5f5",
|
|
1638
|
-
scrollbarThumb: "#d1d5db",
|
|
1639
|
-
scrollbarThumbHover: "#9ca3af",
|
|
1640
1644
|
// 悬停效果
|
|
1641
1645
|
hoverBackground: "#f9f9f9",
|
|
1646
|
+
// 折叠信息样式
|
|
1647
|
+
collapsedBackground: "#e0f2fe",
|
|
1648
|
+
collapsedBackgroundHover: "#bae6fd",
|
|
1649
|
+
collapsedText: "#0284c7",
|
|
1642
1650
|
// 缩进线
|
|
1643
1651
|
indentLine: "#e5e7eb"
|
|
1644
1652
|
}
|
|
1645
|
-
},
|
|
1653
|
+
}, Bt = {
|
|
1646
1654
|
name: "slack-ochin",
|
|
1647
1655
|
colors: {
|
|
1648
1656
|
// 背景色 - 温暖的米色调
|
|
@@ -1672,40 +1680,40 @@ const ht = { class: "json-node" }, pt = {
|
|
|
1672
1680
|
syntaxNull: "#8b7355",
|
|
1673
1681
|
syntaxKey: "#4a3b2a",
|
|
1674
1682
|
syntaxBracket: "#6b5444",
|
|
1675
|
-
// 滚动条 - 暖色调
|
|
1676
|
-
scrollbarTrack: "#f4ede4",
|
|
1677
|
-
scrollbarThumb: "#e8d5b7",
|
|
1678
|
-
scrollbarThumbHover: "#d4c4a8",
|
|
1679
1683
|
// 悬停效果
|
|
1680
1684
|
hoverBackground: "#f8f2eb",
|
|
1685
|
+
// 折叠信息样式
|
|
1686
|
+
collapsedBackground: "#ffe8d6",
|
|
1687
|
+
collapsedBackgroundHover: "#ffd4b0",
|
|
1688
|
+
collapsedText: "#d73502",
|
|
1681
1689
|
// 缩进线
|
|
1682
1690
|
indentLine: "#e8d5b7"
|
|
1683
1691
|
}
|
|
1684
|
-
},
|
|
1685
|
-
"github-light":
|
|
1692
|
+
}, It = {
|
|
1693
|
+
"github-light": He,
|
|
1686
1694
|
"github-dark": $t,
|
|
1687
1695
|
"min-light": St,
|
|
1688
|
-
"slack-ochin":
|
|
1696
|
+
"slack-ochin": Bt
|
|
1689
1697
|
};
|
|
1690
1698
|
function Vt(r = "github-light") {
|
|
1691
|
-
return
|
|
1699
|
+
return It[r] || He;
|
|
1692
1700
|
}
|
|
1693
1701
|
const Lt = {
|
|
1694
1702
|
key: 0,
|
|
1695
1703
|
class: "json-format__toolbar"
|
|
1696
|
-
},
|
|
1704
|
+
}, jt = { class: "json-format__actions" }, Rt = ["disabled"], Mt = ["disabled"], Ut = ["disabled"], Ft = ["disabled"], Xt = { class: "json-format__info" }, Ht = {
|
|
1697
1705
|
key: 0,
|
|
1698
1706
|
class: "json-format__status json-format__status--success"
|
|
1699
1707
|
}, Kt = {
|
|
1700
1708
|
key: 1,
|
|
1701
1709
|
class: "json-format__status json-format__status--error"
|
|
1702
|
-
}, qt = { class: "json-format__content" },
|
|
1710
|
+
}, qt = { class: "json-format__content" }, Qt = {
|
|
1703
1711
|
key: 0,
|
|
1704
1712
|
class: "json-format__error"
|
|
1705
|
-
},
|
|
1713
|
+
}, Wt = {
|
|
1706
1714
|
key: 1,
|
|
1707
1715
|
class: "json-format__error"
|
|
1708
|
-
},
|
|
1716
|
+
}, Yt = {
|
|
1709
1717
|
key: 2,
|
|
1710
1718
|
class: "json-format__viewer"
|
|
1711
1719
|
}, Gt = /* @__PURE__ */ ye({
|
|
@@ -1720,73 +1728,70 @@ const Lt = {
|
|
|
1720
1728
|
},
|
|
1721
1729
|
emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress"],
|
|
1722
1730
|
setup(r, { expose: e, emit: t }) {
|
|
1723
|
-
Oe((
|
|
1724
|
-
"
|
|
1725
|
-
"
|
|
1726
|
-
"
|
|
1727
|
-
"
|
|
1728
|
-
"
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
"
|
|
1734
|
-
"
|
|
1735
|
-
|
|
1736
|
-
"
|
|
1737
|
-
"
|
|
1738
|
-
"2c13c5fa": f.value.colors.scrollbarTrack,
|
|
1739
|
-
"2c1c44e4": f.value.colors.scrollbarThumb,
|
|
1740
|
-
"8ba97764": f.value.colors.scrollbarThumbHover
|
|
1731
|
+
Oe((c) => ({
|
|
1732
|
+
"325d5f6b": h.value.colors.border,
|
|
1733
|
+
"407388ed": h.value.colors.background,
|
|
1734
|
+
"1276f42c": h.value.colors.text,
|
|
1735
|
+
"34805dc8": h.value.colors.surfaceBackground,
|
|
1736
|
+
"212f19fd": h.value.colors.buttonBorder,
|
|
1737
|
+
b83cab02: h.value.colors.buttonBackground,
|
|
1738
|
+
b58ba984: h.value.colors.buttonText,
|
|
1739
|
+
d50a3406: h.value.colors.buttonBackgroundHover,
|
|
1740
|
+
"2421bb5e": h.value.colors.buttonPrimary,
|
|
1741
|
+
"0299816b": h.value.colors.buttonPrimaryHover,
|
|
1742
|
+
"55f370f2": h.value.colors.successBackground,
|
|
1743
|
+
b3fc86b8: h.value.colors.success,
|
|
1744
|
+
"781064f7": h.value.colors.errorBackground,
|
|
1745
|
+
"3b9a02e9": h.value.colors.error
|
|
1741
1746
|
}));
|
|
1742
|
-
const s = r, n = t, o =
|
|
1743
|
-
if (!
|
|
1747
|
+
const s = r, n = t, o = Y(null), i = Y(""), u = Y(/* @__PURE__ */ new Set()), a = Y(null), l = Y(""), p = V(() => i.value === ""), h = V(() => Vt(s.theme)), v = V(() => l.value ? null : a.value !== null ? a.value : o.value), b = (c) => {
|
|
1748
|
+
if (!c.trim()) {
|
|
1744
1749
|
o.value = null, i.value = "", a.value = null, l.value = "";
|
|
1745
1750
|
return;
|
|
1746
1751
|
}
|
|
1747
1752
|
try {
|
|
1748
|
-
let
|
|
1749
|
-
const
|
|
1750
|
-
if (!
|
|
1753
|
+
let f = c;
|
|
1754
|
+
const w = /(:\s*|,\s*|\[\s*)-?\d{16,}/.test(f), E = /(:\s*|,\s*|\[\s*)-?\d+\.\d*0+\s*[,}\]\s]*/.test(f);
|
|
1755
|
+
if (!w && !E)
|
|
1751
1756
|
try {
|
|
1752
|
-
o.value = JSON.parse(
|
|
1753
|
-
|
|
1757
|
+
o.value = JSON.parse(f), i.value = "", a.value = null, l.value = "", he(() => {
|
|
1758
|
+
v.value !== null && g();
|
|
1754
1759
|
});
|
|
1755
1760
|
return;
|
|
1756
1761
|
} catch {
|
|
1757
1762
|
}
|
|
1758
|
-
|
|
1759
|
-
let
|
|
1760
|
-
for (;
|
|
1761
|
-
const
|
|
1762
|
-
if (
|
|
1763
|
-
q ? q = !1 :
|
|
1764
|
-
else if (
|
|
1765
|
-
|
|
1763
|
+
f = ((C) => {
|
|
1764
|
+
let I = "", X = !1, q = !1, D = 0;
|
|
1765
|
+
for (; D < C.length; ) {
|
|
1766
|
+
const ce = C[D];
|
|
1767
|
+
if (X)
|
|
1768
|
+
q ? q = !1 : ce === "\\" ? q = !0 : ce === '"' && (X = !1), I += ce, D++;
|
|
1769
|
+
else if (ce === '"')
|
|
1770
|
+
X = !0, I += ce, D++;
|
|
1766
1771
|
else {
|
|
1767
|
-
const $e =
|
|
1768
|
-
let
|
|
1769
|
-
if (
|
|
1770
|
-
|
|
1772
|
+
const $e = C.slice(D);
|
|
1773
|
+
let z = $e.match(/^([:,\[\s]*)(-?\d{16,})(\s*[,\}\]\s]|$)/);
|
|
1774
|
+
if (z) {
|
|
1775
|
+
I += z[1] + '{"__protected_number__":"' + z[2] + '"}' + z[3], D += z[0].length;
|
|
1771
1776
|
continue;
|
|
1772
1777
|
}
|
|
1773
|
-
if (
|
|
1774
|
-
|
|
1778
|
+
if (z = $e.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/), z) {
|
|
1779
|
+
I += z[1] + '{"__protected_number__":"' + z[2] + '"}' + z[3], D += z[0].length;
|
|
1775
1780
|
continue;
|
|
1776
1781
|
}
|
|
1777
|
-
|
|
1782
|
+
I += ce, D++;
|
|
1778
1783
|
}
|
|
1779
1784
|
}
|
|
1780
|
-
return
|
|
1781
|
-
})(
|
|
1782
|
-
|
|
1785
|
+
return I;
|
|
1786
|
+
})(f), o.value = JSON.parse(f), i.value = "", a.value = null, l.value = "", he(() => {
|
|
1787
|
+
v.value !== null && g();
|
|
1783
1788
|
});
|
|
1784
|
-
} catch (
|
|
1785
|
-
i.value =
|
|
1789
|
+
} catch (f) {
|
|
1790
|
+
i.value = f instanceof Error ? f.message : "Unknown parsing error", o.value = null, a.value = null, l.value = "";
|
|
1786
1791
|
}
|
|
1787
|
-
},
|
|
1788
|
-
if (!
|
|
1789
|
-
|
|
1792
|
+
}, A = (c) => {
|
|
1793
|
+
if (!c || !c.expression.trim()) {
|
|
1794
|
+
P();
|
|
1790
1795
|
return;
|
|
1791
1796
|
}
|
|
1792
1797
|
if (!o.value) {
|
|
@@ -1794,248 +1799,248 @@ const Lt = {
|
|
|
1794
1799
|
return;
|
|
1795
1800
|
}
|
|
1796
1801
|
try {
|
|
1797
|
-
let
|
|
1798
|
-
if (
|
|
1799
|
-
|
|
1800
|
-
else if (
|
|
1801
|
-
|
|
1802
|
+
let f;
|
|
1803
|
+
if (c.type === "jsonpath")
|
|
1804
|
+
f = L({ path: c.expression, json: o.value }), f.length === 1 && c.expression.includes("$[") === !1 && !c.expression.endsWith("[*]") ? a.value = f[0] : a.value = f;
|
|
1805
|
+
else if (c.type === "js")
|
|
1806
|
+
f = new Function("data", `
|
|
1802
1807
|
try {
|
|
1803
|
-
return ${
|
|
1808
|
+
return ${c.expression};
|
|
1804
1809
|
} catch (error) {
|
|
1805
1810
|
throw new Error('JavaScript expression error: ' + error.message);
|
|
1806
1811
|
}
|
|
1807
|
-
`)(o.value), a.value =
|
|
1812
|
+
`)(o.value), a.value = f;
|
|
1808
1813
|
else
|
|
1809
|
-
throw new Error(`Unsupported filter type: ${
|
|
1814
|
+
throw new Error(`Unsupported filter type: ${c.type}`);
|
|
1810
1815
|
l.value = "", he(() => {
|
|
1811
|
-
|
|
1816
|
+
g();
|
|
1812
1817
|
});
|
|
1813
|
-
} catch (
|
|
1814
|
-
l.value =
|
|
1818
|
+
} catch (f) {
|
|
1819
|
+
l.value = f instanceof Error ? f.message : "Filter execution error", a.value = null;
|
|
1815
1820
|
}
|
|
1816
|
-
},
|
|
1821
|
+
}, P = () => {
|
|
1817
1822
|
a.value = null, l.value = "";
|
|
1818
1823
|
};
|
|
1819
|
-
|
|
1820
|
-
|
|
1824
|
+
Fe(() => s.modelValue, (c) => {
|
|
1825
|
+
b(c);
|
|
1821
1826
|
}, { immediate: !0 });
|
|
1822
|
-
const
|
|
1823
|
-
const
|
|
1824
|
-
if (
|
|
1825
|
-
return
|
|
1826
|
-
if (!Array.isArray(
|
|
1827
|
-
return `__PROTECTED_NUMBER_${
|
|
1828
|
-
if (Array.isArray(
|
|
1829
|
-
return
|
|
1830
|
-
const
|
|
1831
|
-
for (const [q,
|
|
1832
|
-
|
|
1833
|
-
return
|
|
1834
|
-
},
|
|
1835
|
-
return JSON.stringify(
|
|
1836
|
-
},
|
|
1827
|
+
const k = (c, f, w) => {
|
|
1828
|
+
const E = (I) => {
|
|
1829
|
+
if (I === null || typeof I != "object")
|
|
1830
|
+
return I;
|
|
1831
|
+
if (!Array.isArray(I) && "__protected_number__" in I && Object.keys(I).length === 1)
|
|
1832
|
+
return `__PROTECTED_NUMBER_${I.__protected_number__}_PROTECTED_NUMBER__`;
|
|
1833
|
+
if (Array.isArray(I))
|
|
1834
|
+
return I.map((q) => E(q));
|
|
1835
|
+
const X = {};
|
|
1836
|
+
for (const [q, D] of Object.entries(I))
|
|
1837
|
+
X[q] = E(D);
|
|
1838
|
+
return X;
|
|
1839
|
+
}, T = E(c);
|
|
1840
|
+
return JSON.stringify(T, f, w).replace(/"__PROTECTED_NUMBER_(.+?)_PROTECTED_NUMBER__"/g, "$1");
|
|
1841
|
+
}, S = (c, f) => {
|
|
1837
1842
|
if (!s.readonly)
|
|
1838
1843
|
try {
|
|
1839
|
-
const
|
|
1840
|
-
n("update:modelValue",
|
|
1841
|
-
} catch (
|
|
1842
|
-
console.error("Failed to update JSON:",
|
|
1844
|
+
const w = F(o.value, c, f), E = k(w, null, 2);
|
|
1845
|
+
n("update:modelValue", E);
|
|
1846
|
+
} catch (w) {
|
|
1847
|
+
console.error("Failed to update JSON:", w);
|
|
1843
1848
|
}
|
|
1844
|
-
},
|
|
1845
|
-
if (!
|
|
1846
|
-
const
|
|
1847
|
-
let
|
|
1848
|
-
for (let
|
|
1849
|
-
const q =
|
|
1850
|
-
q !== "root" && (Array.isArray(
|
|
1849
|
+
}, F = (c, f, w) => {
|
|
1850
|
+
if (!f || f === "root") return w;
|
|
1851
|
+
const E = f.split("."), T = K(c, E.slice(0, -1));
|
|
1852
|
+
let C = T;
|
|
1853
|
+
for (let X = 0; X < E.length - 1; X++) {
|
|
1854
|
+
const q = E[X];
|
|
1855
|
+
q !== "root" && (Array.isArray(C) ? C = C[parseInt(q)] : C = C[q]);
|
|
1851
1856
|
}
|
|
1852
|
-
const
|
|
1853
|
-
return
|
|
1854
|
-
},
|
|
1855
|
-
u.value.has(
|
|
1856
|
-
},
|
|
1857
|
-
const
|
|
1858
|
-
|
|
1859
|
-
const
|
|
1860
|
-
|
|
1861
|
-
}) : Object.keys(
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1857
|
+
const I = E[E.length - 1];
|
|
1858
|
+
return I === "root" ? w : (Array.isArray(C) ? C[parseInt(I)] = w : C[I] = w, T);
|
|
1859
|
+
}, Z = (c) => {
|
|
1860
|
+
u.value.has(c) ? u.value.delete(c) : u.value.add(c);
|
|
1861
|
+
}, g = () => {
|
|
1862
|
+
const c = /* @__PURE__ */ new Set(), f = (w, E = "") => {
|
|
1863
|
+
w !== null && typeof w == "object" && (c.add(E || "root"), Array.isArray(w) ? w.forEach((T, C) => {
|
|
1864
|
+
const I = E ? `${E}.${C}` : `${C}`;
|
|
1865
|
+
f(T, I);
|
|
1866
|
+
}) : Object.keys(w).forEach((T) => {
|
|
1867
|
+
const C = E ? `${E}.${T}` : T;
|
|
1868
|
+
f(w[T], C);
|
|
1864
1869
|
}));
|
|
1865
1870
|
};
|
|
1866
|
-
|
|
1867
|
-
},
|
|
1871
|
+
f(v.value), u.value = c, n("expand-all");
|
|
1872
|
+
}, m = () => {
|
|
1868
1873
|
u.value = /* @__PURE__ */ new Set(["root"]), n("collapse-all");
|
|
1869
1874
|
}, O = async () => {
|
|
1870
|
-
if (
|
|
1875
|
+
if (p.value)
|
|
1871
1876
|
try {
|
|
1872
|
-
const
|
|
1873
|
-
await navigator.clipboard.writeText(
|
|
1874
|
-
} catch (
|
|
1875
|
-
console.error("Failed to copy JSON:",
|
|
1877
|
+
const c = v.value, f = k(c, null, 2);
|
|
1878
|
+
await navigator.clipboard.writeText(f), n("copy-success", f);
|
|
1879
|
+
} catch (c) {
|
|
1880
|
+
console.error("Failed to copy JSON:", c), n("copy-error", c instanceof Error ? c : new Error("Failed to copy JSON"));
|
|
1876
1881
|
}
|
|
1877
|
-
},
|
|
1878
|
-
if (
|
|
1882
|
+
}, $ = () => {
|
|
1883
|
+
if (p.value)
|
|
1879
1884
|
try {
|
|
1880
|
-
const
|
|
1881
|
-
n("update:modelValue",
|
|
1882
|
-
} catch (
|
|
1883
|
-
console.error("Failed to compress JSON:",
|
|
1885
|
+
const c = v.value, f = k(c);
|
|
1886
|
+
n("update:modelValue", f), n("compress", f);
|
|
1887
|
+
} catch (c) {
|
|
1888
|
+
console.error("Failed to compress JSON:", c);
|
|
1884
1889
|
}
|
|
1885
|
-
},
|
|
1890
|
+
}, j = async (c) => {
|
|
1886
1891
|
try {
|
|
1887
|
-
let
|
|
1888
|
-
typeof
|
|
1889
|
-
} catch (
|
|
1890
|
-
console.error("Failed to copy value:",
|
|
1892
|
+
let f;
|
|
1893
|
+
typeof c == "object" && c !== null && !Array.isArray(c) && "__protected_number__" in c && Object.keys(c).length === 1 ? f = c.__protected_number__ : typeof c == "string" ? f = `"${c}"` : f = JSON.stringify(c), await navigator.clipboard.writeText(f);
|
|
1894
|
+
} catch (f) {
|
|
1895
|
+
console.error("Failed to copy value:", f);
|
|
1891
1896
|
}
|
|
1892
|
-
},
|
|
1897
|
+
}, H = (c, f) => {
|
|
1893
1898
|
if (!s.readonly)
|
|
1894
1899
|
try {
|
|
1895
|
-
const
|
|
1896
|
-
n("update:modelValue",
|
|
1897
|
-
} catch (
|
|
1898
|
-
console.error("Failed to rename key:",
|
|
1900
|
+
const w = G(o.value, c, f), E = k(w, null, 2);
|
|
1901
|
+
n("update:modelValue", E), ue(c, f);
|
|
1902
|
+
} catch (w) {
|
|
1903
|
+
console.error("Failed to rename key:", w);
|
|
1899
1904
|
}
|
|
1900
|
-
},
|
|
1901
|
-
if (!
|
|
1902
|
-
const
|
|
1903
|
-
if (
|
|
1904
|
-
const
|
|
1905
|
-
return
|
|
1905
|
+
}, G = (c, f, w) => {
|
|
1906
|
+
if (!f || f === "root") return c;
|
|
1907
|
+
const E = f.split("."), T = K(c, E.slice(0, -1));
|
|
1908
|
+
if (E.length === 1) {
|
|
1909
|
+
const X = E[0];
|
|
1910
|
+
return T && typeof T == "object" && !Array.isArray(T) ? ee(T, X, w) : T;
|
|
1906
1911
|
}
|
|
1907
|
-
let
|
|
1908
|
-
for (let
|
|
1909
|
-
const q =
|
|
1910
|
-
Array.isArray(
|
|
1912
|
+
let C = T;
|
|
1913
|
+
for (let X = 0; X < E.length - 1; X++) {
|
|
1914
|
+
const q = E[X];
|
|
1915
|
+
Array.isArray(C) ? C = C[parseInt(q)] : C = C[q];
|
|
1911
1916
|
}
|
|
1912
|
-
const
|
|
1913
|
-
if (!Array.isArray(
|
|
1914
|
-
const
|
|
1915
|
-
q.length > 0 &&
|
|
1917
|
+
const I = E[E.length - 1];
|
|
1918
|
+
if (!Array.isArray(C) && C && typeof C == "object") {
|
|
1919
|
+
const X = ee(C, I, w), q = E.slice(0, -1);
|
|
1920
|
+
q.length > 0 && te(T, q, X);
|
|
1916
1921
|
}
|
|
1917
|
-
return
|
|
1918
|
-
},
|
|
1919
|
-
if (
|
|
1920
|
-
if (Array.isArray(
|
|
1921
|
-
const
|
|
1922
|
-
return
|
|
1923
|
-
} else if (
|
|
1924
|
-
const
|
|
1925
|
-
return
|
|
1922
|
+
return T;
|
|
1923
|
+
}, K = (c, f) => {
|
|
1924
|
+
if (f.length === 0) return c;
|
|
1925
|
+
if (Array.isArray(c)) {
|
|
1926
|
+
const w = [...c], E = f[0], T = parseInt(E);
|
|
1927
|
+
return f.length === 1 || (w[T] = K(c[T], f.slice(1))), w;
|
|
1928
|
+
} else if (c && typeof c == "object") {
|
|
1929
|
+
const w = { ...c }, E = f[0];
|
|
1930
|
+
return f.length === 1 || (w[E] = K(c[E], f.slice(1))), w;
|
|
1926
1931
|
}
|
|
1927
|
-
return
|
|
1928
|
-
}, ee = (
|
|
1929
|
-
if (!
|
|
1930
|
-
return
|
|
1931
|
-
const
|
|
1932
|
-
for (const
|
|
1933
|
-
|
|
1934
|
-
return
|
|
1935
|
-
},
|
|
1936
|
-
let
|
|
1937
|
-
for (let
|
|
1938
|
-
const
|
|
1939
|
-
Array.isArray(
|
|
1932
|
+
return c;
|
|
1933
|
+
}, ee = (c, f, w) => {
|
|
1934
|
+
if (!c || typeof c != "object" || Array.isArray(c))
|
|
1935
|
+
return c;
|
|
1936
|
+
const E = Object.keys(c), T = {};
|
|
1937
|
+
for (const C of E)
|
|
1938
|
+
C === f ? T[w] = c[C] : T[C] = c[C];
|
|
1939
|
+
return T;
|
|
1940
|
+
}, te = (c, f, w) => {
|
|
1941
|
+
let E = c;
|
|
1942
|
+
for (let C = 0; C < f.length - 1; C++) {
|
|
1943
|
+
const I = f[C];
|
|
1944
|
+
Array.isArray(E) ? E = E[parseInt(I)] : E = E[I];
|
|
1940
1945
|
}
|
|
1941
|
-
const
|
|
1942
|
-
Array.isArray(
|
|
1943
|
-
},
|
|
1944
|
-
const
|
|
1945
|
-
u.value.forEach((
|
|
1946
|
-
if (
|
|
1947
|
-
const
|
|
1948
|
-
|
|
1949
|
-
} else if (
|
|
1950
|
-
const
|
|
1951
|
-
|
|
1952
|
-
const
|
|
1953
|
-
|
|
1946
|
+
const T = f[f.length - 1];
|
|
1947
|
+
Array.isArray(E) ? E[parseInt(T)] = w : E[T] = w;
|
|
1948
|
+
}, ue = (c, f) => {
|
|
1949
|
+
const w = /* @__PURE__ */ new Set();
|
|
1950
|
+
u.value.forEach((E) => {
|
|
1951
|
+
if (E === c) {
|
|
1952
|
+
const T = c.split(".");
|
|
1953
|
+
T[T.length - 1] = f, w.add(T.join("."));
|
|
1954
|
+
} else if (E.startsWith(c + ".")) {
|
|
1955
|
+
const T = c.split(".");
|
|
1956
|
+
T[T.length - 1] = f;
|
|
1957
|
+
const C = T.join("."), I = E.substring(c.length);
|
|
1958
|
+
w.add(C + I);
|
|
1954
1959
|
} else
|
|
1955
|
-
|
|
1956
|
-
}), u.value =
|
|
1960
|
+
w.add(E);
|
|
1961
|
+
}), u.value = w;
|
|
1957
1962
|
};
|
|
1958
1963
|
return e({
|
|
1959
1964
|
// 核心操作方法
|
|
1960
1965
|
copyJson: O,
|
|
1961
|
-
compressSource:
|
|
1962
|
-
expandAll:
|
|
1963
|
-
collapseAll:
|
|
1964
|
-
toggleExpand:
|
|
1965
|
-
updateValue:
|
|
1966
|
-
updateKey:
|
|
1966
|
+
compressSource: $,
|
|
1967
|
+
expandAll: g,
|
|
1968
|
+
collapseAll: m,
|
|
1969
|
+
toggleExpand: Z,
|
|
1970
|
+
updateValue: S,
|
|
1971
|
+
updateKey: H,
|
|
1967
1972
|
// Filter 相关方法
|
|
1968
|
-
filter:
|
|
1969
|
-
clearFilter:
|
|
1973
|
+
filter: A,
|
|
1974
|
+
clearFilter: P,
|
|
1970
1975
|
// 状态访问方法
|
|
1971
|
-
isValidJson: () =>
|
|
1976
|
+
isValidJson: () => p.value,
|
|
1972
1977
|
getParsedJson: () => o.value,
|
|
1973
1978
|
getFilteredJson: () => a.value,
|
|
1974
1979
|
getExpandedNodes: () => u.value,
|
|
1975
1980
|
getParseError: () => i.value,
|
|
1976
1981
|
getFilterError: () => l.value,
|
|
1977
1982
|
// 工具方法
|
|
1978
|
-
parseJson: (
|
|
1979
|
-
copyValue: (
|
|
1980
|
-
}), (
|
|
1981
|
-
class: Te(["json-format", `json-format--${
|
|
1983
|
+
parseJson: (c) => b(c),
|
|
1984
|
+
copyValue: (c) => j(c)
|
|
1985
|
+
}), (c, f) => (_(), x("div", {
|
|
1986
|
+
class: Te(["json-format", `json-format--${h.value.name}`])
|
|
1982
1987
|
}, [
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1988
|
+
c.showToolbar ? (_(), x("div", Lt, [
|
|
1989
|
+
y("div", jt, [
|
|
1990
|
+
y("button", {
|
|
1986
1991
|
class: "json-format__btn json-format__btn--primary",
|
|
1987
1992
|
onClick: O,
|
|
1988
|
-
disabled: !
|
|
1993
|
+
disabled: !p.value,
|
|
1989
1994
|
title: "Copy JSON"
|
|
1990
|
-
}, " 📋 Copy ", 8,
|
|
1991
|
-
|
|
1995
|
+
}, " 📋 Copy ", 8, Rt),
|
|
1996
|
+
y("button", {
|
|
1992
1997
|
class: "json-format__btn json-format__btn--secondary",
|
|
1993
|
-
onClick:
|
|
1994
|
-
disabled: !
|
|
1998
|
+
onClick: g,
|
|
1999
|
+
disabled: !p.value,
|
|
1995
2000
|
title: "Expand All"
|
|
1996
2001
|
}, " ⬇️ Expand All ", 8, Mt),
|
|
1997
|
-
|
|
2002
|
+
y("button", {
|
|
1998
2003
|
class: "json-format__btn json-format__btn--secondary",
|
|
1999
|
-
onClick:
|
|
2000
|
-
disabled: !
|
|
2004
|
+
onClick: m,
|
|
2005
|
+
disabled: !p.value,
|
|
2001
2006
|
title: "Collapse All"
|
|
2002
2007
|
}, " ➡️ Collapse All ", 8, Ut),
|
|
2003
|
-
|
|
2008
|
+
y("button", {
|
|
2004
2009
|
class: "json-format__btn json-format__btn--secondary",
|
|
2005
|
-
onClick:
|
|
2006
|
-
disabled: !
|
|
2010
|
+
onClick: $,
|
|
2011
|
+
disabled: !p.value,
|
|
2007
2012
|
title: "Compress JSON"
|
|
2008
2013
|
}, " 📦 Compress ", 8, Ft)
|
|
2009
2014
|
]),
|
|
2010
|
-
|
|
2011
|
-
|
|
2015
|
+
y("div", Xt, [
|
|
2016
|
+
p.value ? (_(), x("span", Ht, " ✅ Valid JSON ")) : (_(), x("span", Kt, " ❌ Invalid JSON "))
|
|
2012
2017
|
])
|
|
2013
|
-
])) :
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
])) : (
|
|
2019
|
-
|
|
2020
|
-
value:
|
|
2018
|
+
])) : U("", !0),
|
|
2019
|
+
y("div", qt, [
|
|
2020
|
+
p.value ? l.value ? (_(), x("div", Wt, [
|
|
2021
|
+
f[1] || (f[1] = y("h4", null, "Filter Error:", -1)),
|
|
2022
|
+
y("pre", null, B(l.value), 1)
|
|
2023
|
+
])) : (_(), x("div", Yt, [
|
|
2024
|
+
Ue(Pt, {
|
|
2025
|
+
value: v.value,
|
|
2021
2026
|
"key-name": "",
|
|
2022
2027
|
level: 0,
|
|
2023
2028
|
expanded: u.value,
|
|
2024
2029
|
"is-last": !0,
|
|
2025
|
-
theme:
|
|
2026
|
-
"onUpdate:value":
|
|
2027
|
-
onToggleExpand:
|
|
2028
|
-
onCopy:
|
|
2029
|
-
"onUpdate:key":
|
|
2030
|
+
theme: h.value,
|
|
2031
|
+
"onUpdate:value": S,
|
|
2032
|
+
onToggleExpand: Z,
|
|
2033
|
+
onCopy: j,
|
|
2034
|
+
"onUpdate:key": H
|
|
2030
2035
|
}, null, 8, ["value", "expanded", "theme"])
|
|
2031
|
-
])) : (
|
|
2032
|
-
|
|
2033
|
-
|
|
2036
|
+
])) : (_(), x("div", Qt, [
|
|
2037
|
+
f[0] || (f[0] = y("h4", null, "JSON Parse Error:", -1)),
|
|
2038
|
+
y("pre", null, B(i.value), 1)
|
|
2034
2039
|
]))
|
|
2035
2040
|
])
|
|
2036
2041
|
], 2));
|
|
2037
2042
|
}
|
|
2038
|
-
}), Zt = /* @__PURE__ */ be(Gt, [["__scopeId", "data-v-
|
|
2043
|
+
}), Zt = /* @__PURE__ */ be(Gt, [["__scopeId", "data-v-b956002c"]]), zt = {
|
|
2039
2044
|
key: 0,
|
|
2040
2045
|
class: "xml-node__comment"
|
|
2041
2046
|
}, Dt = {
|
|
@@ -2050,16 +2055,19 @@ const Lt = {
|
|
|
2050
2055
|
}, tr = {
|
|
2051
2056
|
key: 1,
|
|
2052
2057
|
class: "xml-node__line"
|
|
2053
|
-
}, rr = { key: 2 }, nr = {
|
|
2058
|
+
}, rr = { key: 2 }, nr = {
|
|
2059
|
+
key: 0,
|
|
2060
|
+
class: "xml-node__line"
|
|
2061
|
+
}, sr = ["title"], or = { class: "xml-node__line" }, ir = ["title"], ar = { key: 1 }, lr = ["title"], ur = {
|
|
2054
2062
|
key: 0,
|
|
2055
2063
|
class: "xml-node__children"
|
|
2056
|
-
},
|
|
2064
|
+
}, cr = {
|
|
2057
2065
|
key: 0,
|
|
2058
2066
|
class: "xml-node__text"
|
|
2059
|
-
},
|
|
2067
|
+
}, dr = {
|
|
2060
2068
|
key: 1,
|
|
2061
2069
|
class: "xml-node__line"
|
|
2062
|
-
},
|
|
2070
|
+
}, fr = /* @__PURE__ */ ye({
|
|
2063
2071
|
__name: "XmlNode",
|
|
2064
2072
|
props: {
|
|
2065
2073
|
node: {},
|
|
@@ -2071,279 +2079,351 @@ const Lt = {
|
|
|
2071
2079
|
},
|
|
2072
2080
|
emits: ["toggle-expand", "copy"],
|
|
2073
2081
|
setup(r, { emit: e }) {
|
|
2074
|
-
const t = r, s = e, n = V(() => Object.keys(t.node).find((
|
|
2075
|
-
const
|
|
2076
|
-
return Object.keys(
|
|
2077
|
-
|
|
2078
|
-
}),
|
|
2082
|
+
const t = r, s = e, n = V(() => Object.keys(t.node).find((m) => !m.startsWith(":") && !m.startsWith("#")) || ""), o = V(() => n.value ? t.parentPath ? `${t.parentPath}[${t.index}]` : `${n.value}[${t.index}]` : ""), i = V(() => t.expanded.has(o.value)), u = V(() => t.node["#comment"] ? "comment" : t.node.__cdata ? "cdata" : n.value ? "element" : "unknown"), a = V(() => {
|
|
2083
|
+
const g = t.node[":@"] || {}, m = {};
|
|
2084
|
+
return Object.keys(g).forEach((O) => {
|
|
2085
|
+
O.startsWith("@_") && (m[O.substring(2)] = g[O]);
|
|
2086
|
+
}), m;
|
|
2079
2087
|
}), l = V(() => {
|
|
2080
2088
|
if (u.value !== "element" || !n.value) return [];
|
|
2081
|
-
const
|
|
2082
|
-
return Array.isArray(
|
|
2083
|
-
}),
|
|
2084
|
-
if (!
|
|
2085
|
-
const
|
|
2086
|
-
if (
|
|
2087
|
-
const
|
|
2088
|
-
if (
|
|
2089
|
-
return
|
|
2089
|
+
const g = t.node[n.value];
|
|
2090
|
+
return Array.isArray(g) ? g : [];
|
|
2091
|
+
}), p = V(() => l.value.some((g) => g.__cdata)), h = V(() => {
|
|
2092
|
+
if (!p.value) return "";
|
|
2093
|
+
const g = l.value.find((m) => m.__cdata);
|
|
2094
|
+
if (g && Array.isArray(g.__cdata)) {
|
|
2095
|
+
const m = g.__cdata;
|
|
2096
|
+
if (m.length > 0 && m[0]["#text"])
|
|
2097
|
+
return m[0]["#text"];
|
|
2090
2098
|
}
|
|
2091
2099
|
return "";
|
|
2100
|
+
}), v = V(() => {
|
|
2101
|
+
if (u.value !== "element" || !n.value || p.value) return "";
|
|
2102
|
+
const g = t.node[n.value];
|
|
2103
|
+
if (!Array.isArray(g)) return "";
|
|
2104
|
+
const m = g.find((O) => O["#text"]);
|
|
2105
|
+
return m ? m["#text"] : "";
|
|
2092
2106
|
}), b = V(() => {
|
|
2093
|
-
if (u.value !== "element" || !n.value || h.value) return "";
|
|
2094
|
-
const p = t.node[n.value];
|
|
2095
|
-
if (!Array.isArray(p)) return "";
|
|
2096
|
-
const $ = p.find((E) => E["#text"]);
|
|
2097
|
-
return $ ? $["#text"] : "";
|
|
2098
|
-
}), m = V(() => {
|
|
2099
2107
|
if (u.value !== "comment") return "";
|
|
2100
|
-
const
|
|
2101
|
-
return Array.isArray(
|
|
2102
|
-
}),
|
|
2103
|
-
|
|
2104
|
-
},
|
|
2105
|
-
return (
|
|
2106
|
-
const
|
|
2107
|
-
return
|
|
2108
|
+
const g = t.node["#comment"];
|
|
2109
|
+
return Array.isArray(g) && g.length > 0 && g[0]["#text"] || "";
|
|
2110
|
+
}), A = V(() => l.value.some((g) => Object.keys(g).some((O) => !O.startsWith("#") && !O.startsWith(":")))), P = V(() => A.value ? l.value.filter((g) => Object.keys(g).some((O) => !O.startsWith("#") && !O.startsWith(":"))).length : 0), k = V(() => u.value === "element" && !A.value && v.value.trim() !== ""), S = () => {
|
|
2111
|
+
A.value && s("toggle-expand", o.value);
|
|
2112
|
+
}, F = (g, m) => `${o.value}-child-${m}`, Z = () => `${o.value}.${n.value}`;
|
|
2113
|
+
return (g, m) => {
|
|
2114
|
+
const O = Me("XmlNode", !0);
|
|
2115
|
+
return _(), x("div", {
|
|
2108
2116
|
class: "xml-node",
|
|
2109
|
-
style:
|
|
2117
|
+
style: N({ paddingLeft: g.level > 0 ? "16px" : "0" })
|
|
2110
2118
|
}, [
|
|
2111
|
-
u.value === "comment" ? (
|
|
2112
|
-
|
|
2113
|
-
style:
|
|
2114
|
-
}, " <!-- " +
|
|
2115
|
-
])) : u.value === "cdata" ? (
|
|
2116
|
-
|
|
2117
|
-
style:
|
|
2118
|
-
}, " <![CDATA[" +
|
|
2119
|
-
])) : u.value === "element" ? (
|
|
2120
|
-
|
|
2121
|
-
|
|
2119
|
+
u.value === "comment" ? (_(), x("div", zt, [
|
|
2120
|
+
y("span", {
|
|
2121
|
+
style: N({ color: g.theme.colors.xmlComment })
|
|
2122
|
+
}, " <!-- " + B(b.value) + " --> ", 5)
|
|
2123
|
+
])) : u.value === "cdata" ? (_(), x("div", Dt, [
|
|
2124
|
+
y("span", {
|
|
2125
|
+
style: N({ color: g.theme.colors.xmlCdata })
|
|
2126
|
+
}, " <![CDATA[" + B(g.node.__cdata) + "]]> ", 5)
|
|
2127
|
+
])) : u.value === "element" ? (_(), x("div", Jt, [
|
|
2128
|
+
p.value ? (_(), x("div", er, [
|
|
2129
|
+
y("span", {
|
|
2122
2130
|
class: "xml-node__bracket",
|
|
2123
|
-
style:
|
|
2131
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2124
2132
|
}, "<", 4),
|
|
2125
|
-
|
|
2133
|
+
y("span", {
|
|
2126
2134
|
class: "xml-node__tag",
|
|
2127
|
-
style:
|
|
2128
|
-
},
|
|
2129
|
-
(
|
|
2130
|
-
key:
|
|
2135
|
+
style: N({ color: g.theme.colors.xmlTag })
|
|
2136
|
+
}, B(n.value), 5),
|
|
2137
|
+
(_(!0), x(ne, null, ie(a.value, ($, j) => (_(), x("span", {
|
|
2138
|
+
key: j,
|
|
2131
2139
|
class: "xml-node__attribute"
|
|
2132
2140
|
}, [
|
|
2133
|
-
|
|
2141
|
+
y("span", {
|
|
2134
2142
|
class: "xml-node__attr-name",
|
|
2135
|
-
style:
|
|
2136
|
-
},
|
|
2137
|
-
|
|
2143
|
+
style: N({ color: g.theme.colors.xmlAttribute })
|
|
2144
|
+
}, B(j), 5),
|
|
2145
|
+
y("span", {
|
|
2138
2146
|
class: "xml-node__equals",
|
|
2139
|
-
style:
|
|
2147
|
+
style: N({ color: g.theme.colors.xmlEquals })
|
|
2140
2148
|
}, "=", 4),
|
|
2141
|
-
|
|
2149
|
+
y("span", {
|
|
2142
2150
|
class: "xml-node__quote",
|
|
2143
|
-
style:
|
|
2151
|
+
style: N({ color: g.theme.colors.xmlQuote })
|
|
2144
2152
|
}, '"', 4),
|
|
2145
|
-
|
|
2153
|
+
y("span", {
|
|
2146
2154
|
class: "xml-node__attr-value",
|
|
2147
|
-
style:
|
|
2148
|
-
},
|
|
2149
|
-
|
|
2155
|
+
style: N({ color: g.theme.colors.xmlAttributeValue })
|
|
2156
|
+
}, B($), 5),
|
|
2157
|
+
y("span", {
|
|
2150
2158
|
class: "xml-node__quote",
|
|
2151
|
-
style:
|
|
2159
|
+
style: N({ color: g.theme.colors.xmlQuote })
|
|
2152
2160
|
}, '"', 4)
|
|
2153
2161
|
]))), 128)),
|
|
2154
|
-
|
|
2162
|
+
y("span", {
|
|
2155
2163
|
class: "xml-node__bracket",
|
|
2156
|
-
style:
|
|
2164
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2157
2165
|
}, ">", 4),
|
|
2158
|
-
|
|
2166
|
+
y("span", {
|
|
2159
2167
|
class: "xml-node__cdata",
|
|
2160
|
-
style:
|
|
2161
|
-
}, "<![CDATA[" +
|
|
2162
|
-
|
|
2168
|
+
style: N({ color: g.theme.colors.xmlCdata })
|
|
2169
|
+
}, "<![CDATA[" + B(h.value) + "]]>", 5),
|
|
2170
|
+
y("span", {
|
|
2163
2171
|
class: "xml-node__bracket",
|
|
2164
|
-
style:
|
|
2172
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2165
2173
|
}, "</", 4),
|
|
2166
|
-
|
|
2174
|
+
y("span", {
|
|
2167
2175
|
class: "xml-node__tag",
|
|
2168
|
-
style:
|
|
2169
|
-
},
|
|
2170
|
-
|
|
2176
|
+
style: N({ color: g.theme.colors.xmlTag })
|
|
2177
|
+
}, B(n.value), 5),
|
|
2178
|
+
y("span", {
|
|
2171
2179
|
class: "xml-node__bracket",
|
|
2172
|
-
style:
|
|
2180
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2173
2181
|
}, ">", 4)
|
|
2174
|
-
])) :
|
|
2175
|
-
|
|
2182
|
+
])) : k.value ? (_(), x("div", tr, [
|
|
2183
|
+
y("span", {
|
|
2176
2184
|
class: "xml-node__bracket",
|
|
2177
|
-
style:
|
|
2185
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2178
2186
|
}, "<", 4),
|
|
2179
|
-
|
|
2187
|
+
y("span", {
|
|
2180
2188
|
class: "xml-node__tag",
|
|
2181
|
-
style:
|
|
2182
|
-
},
|
|
2183
|
-
(
|
|
2184
|
-
key:
|
|
2189
|
+
style: N({ color: g.theme.colors.xmlTag })
|
|
2190
|
+
}, B(n.value), 5),
|
|
2191
|
+
(_(!0), x(ne, null, ie(a.value, ($, j) => (_(), x("span", {
|
|
2192
|
+
key: j,
|
|
2185
2193
|
class: "xml-node__attribute"
|
|
2186
2194
|
}, [
|
|
2187
|
-
|
|
2195
|
+
y("span", {
|
|
2188
2196
|
class: "xml-node__attr-name",
|
|
2189
|
-
style:
|
|
2190
|
-
},
|
|
2191
|
-
|
|
2197
|
+
style: N({ color: g.theme.colors.xmlAttribute })
|
|
2198
|
+
}, B(j), 5),
|
|
2199
|
+
y("span", {
|
|
2192
2200
|
class: "xml-node__equals",
|
|
2193
|
-
style:
|
|
2201
|
+
style: N({ color: g.theme.colors.xmlEquals })
|
|
2194
2202
|
}, "=", 4),
|
|
2195
|
-
|
|
2203
|
+
y("span", {
|
|
2196
2204
|
class: "xml-node__quote",
|
|
2197
|
-
style:
|
|
2205
|
+
style: N({ color: g.theme.colors.xmlQuote })
|
|
2198
2206
|
}, '"', 4),
|
|
2199
|
-
|
|
2207
|
+
y("span", {
|
|
2200
2208
|
class: "xml-node__attr-value",
|
|
2201
|
-
style:
|
|
2202
|
-
},
|
|
2203
|
-
|
|
2209
|
+
style: N({ color: g.theme.colors.xmlAttributeValue })
|
|
2210
|
+
}, B($), 5),
|
|
2211
|
+
y("span", {
|
|
2204
2212
|
class: "xml-node__quote",
|
|
2205
|
-
style:
|
|
2213
|
+
style: N({ color: g.theme.colors.xmlQuote })
|
|
2206
2214
|
}, '"', 4)
|
|
2207
2215
|
]))), 128)),
|
|
2208
|
-
|
|
2216
|
+
y("span", {
|
|
2209
2217
|
class: "xml-node__bracket",
|
|
2210
|
-
style:
|
|
2218
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2211
2219
|
}, ">", 4),
|
|
2212
|
-
|
|
2220
|
+
y("span", {
|
|
2213
2221
|
class: "xml-node__text-content",
|
|
2214
|
-
style:
|
|
2215
|
-
},
|
|
2216
|
-
|
|
2222
|
+
style: N({ color: g.theme.colors.xmlText })
|
|
2223
|
+
}, B(v.value), 5),
|
|
2224
|
+
y("span", {
|
|
2217
2225
|
class: "xml-node__bracket",
|
|
2218
|
-
style:
|
|
2226
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2219
2227
|
}, "</", 4),
|
|
2220
|
-
|
|
2228
|
+
y("span", {
|
|
2221
2229
|
class: "xml-node__tag",
|
|
2222
|
-
style:
|
|
2223
|
-
},
|
|
2224
|
-
|
|
2230
|
+
style: N({ color: g.theme.colors.xmlTag })
|
|
2231
|
+
}, B(n.value), 5),
|
|
2232
|
+
y("span", {
|
|
2225
2233
|
class: "xml-node__bracket",
|
|
2226
|
-
style:
|
|
2234
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2227
2235
|
}, ">", 4)
|
|
2228
|
-
])) : (
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
key: 0,
|
|
2236
|
+
])) : (_(), x("div", rr, [
|
|
2237
|
+
!i.value && A.value ? (_(), x("div", nr, [
|
|
2238
|
+
y("span", {
|
|
2232
2239
|
class: "xml-node__clickable-part",
|
|
2233
|
-
onClick:
|
|
2234
|
-
title:
|
|
2240
|
+
onClick: m[0] || (m[0] = ($) => S()),
|
|
2241
|
+
title: "Click to expand"
|
|
2235
2242
|
}, [
|
|
2236
|
-
|
|
2243
|
+
y("span", {
|
|
2237
2244
|
class: "xml-node__bracket",
|
|
2238
|
-
style:
|
|
2245
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2239
2246
|
}, "<", 4),
|
|
2240
|
-
|
|
2247
|
+
y("span", {
|
|
2241
2248
|
class: "xml-node__tag",
|
|
2242
|
-
style:
|
|
2243
|
-
},
|
|
2244
|
-
]
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
style: P({ color: p.theme.colors.xmlBracket })
|
|
2248
|
-
}, "<", 4),
|
|
2249
|
-
v("span", {
|
|
2250
|
-
class: "xml-node__tag",
|
|
2251
|
-
style: P({ color: p.theme.colors.xmlTag })
|
|
2252
|
-
}, R(n.value), 5)
|
|
2253
|
-
])),
|
|
2254
|
-
(x(!0), k(de, null, fe(a.value, (O, I) => (x(), k("span", {
|
|
2255
|
-
key: I,
|
|
2249
|
+
style: N({ color: g.theme.colors.xmlTag })
|
|
2250
|
+
}, B(n.value), 5)
|
|
2251
|
+
]),
|
|
2252
|
+
(_(!0), x(ne, null, ie(a.value, ($, j) => (_(), x("span", {
|
|
2253
|
+
key: j,
|
|
2256
2254
|
class: "xml-node__attribute"
|
|
2257
2255
|
}, [
|
|
2258
|
-
|
|
2256
|
+
y("span", {
|
|
2259
2257
|
class: "xml-node__attr-name",
|
|
2260
|
-
style:
|
|
2261
|
-
},
|
|
2262
|
-
|
|
2258
|
+
style: N({ color: g.theme.colors.xmlAttribute })
|
|
2259
|
+
}, B(j), 5),
|
|
2260
|
+
y("span", {
|
|
2263
2261
|
class: "xml-node__equals",
|
|
2264
|
-
style:
|
|
2262
|
+
style: N({ color: g.theme.colors.xmlEquals })
|
|
2265
2263
|
}, "=", 4),
|
|
2266
|
-
|
|
2264
|
+
y("span", {
|
|
2267
2265
|
class: "xml-node__quote",
|
|
2268
|
-
style:
|
|
2266
|
+
style: N({ color: g.theme.colors.xmlQuote })
|
|
2269
2267
|
}, '"', 4),
|
|
2270
|
-
|
|
2268
|
+
y("span", {
|
|
2271
2269
|
class: "xml-node__attr-value",
|
|
2272
|
-
style:
|
|
2273
|
-
},
|
|
2274
|
-
|
|
2270
|
+
style: N({ color: g.theme.colors.xmlAttributeValue })
|
|
2271
|
+
}, B($), 5),
|
|
2272
|
+
y("span", {
|
|
2275
2273
|
class: "xml-node__quote",
|
|
2276
|
-
style:
|
|
2274
|
+
style: N({ color: g.theme.colors.xmlQuote })
|
|
2277
2275
|
}, '"', 4)
|
|
2278
2276
|
]))), 128)),
|
|
2279
|
-
|
|
2280
|
-
key: 2,
|
|
2277
|
+
y("span", {
|
|
2281
2278
|
class: "xml-node__clickable-part",
|
|
2282
|
-
onClick:
|
|
2283
|
-
title:
|
|
2279
|
+
onClick: m[1] || (m[1] = ($) => S()),
|
|
2280
|
+
title: "Click to expand"
|
|
2284
2281
|
}, [
|
|
2285
|
-
|
|
2282
|
+
y("span", {
|
|
2286
2283
|
class: "xml-node__bracket",
|
|
2287
|
-
style:
|
|
2284
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2288
2285
|
}, ">", 4)
|
|
2289
|
-
]
|
|
2290
|
-
|
|
2291
|
-
class: "xml-
|
|
2292
|
-
style:
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
}, "...", 4)) : F("", !0)
|
|
2301
|
-
]),
|
|
2302
|
-
i.value && w.value ? (x(), k("div", ar, [
|
|
2303
|
-
l.value.length === 0 && b.value.trim() ? (x(), k("div", lr, [
|
|
2304
|
-
v("span", {
|
|
2305
|
-
class: "xml-node__text-content",
|
|
2306
|
-
style: P({ color: p.theme.colors.xmlText })
|
|
2307
|
-
}, R(b.value), 5)
|
|
2308
|
-
])) : F("", !0),
|
|
2309
|
-
(x(!0), k(de, null, fe(l.value, (O, I) => (x(), He(E, {
|
|
2310
|
-
key: j(O, I),
|
|
2311
|
-
node: O,
|
|
2312
|
-
index: I,
|
|
2313
|
-
level: p.level + 1,
|
|
2314
|
-
"parent-path": H(),
|
|
2315
|
-
expanded: p.expanded,
|
|
2316
|
-
theme: p.theme,
|
|
2317
|
-
onToggleExpand: $[3] || ($[3] = (X) => p.$emit("toggle-expand", X)),
|
|
2318
|
-
onCopy: $[4] || ($[4] = (X) => p.$emit("copy", X))
|
|
2319
|
-
}, null, 8, ["node", "index", "level", "parent-path", "expanded", "theme"]))), 128))
|
|
2320
|
-
])) : F("", !0),
|
|
2321
|
-
i.value && w.value ? (x(), k("div", ur, [
|
|
2322
|
-
v("span", {
|
|
2286
|
+
]),
|
|
2287
|
+
y("span", {
|
|
2288
|
+
class: "xml-node__collapsed-badge",
|
|
2289
|
+
style: N({
|
|
2290
|
+
backgroundColor: g.theme.colors.collapsedBackground,
|
|
2291
|
+
color: g.theme.colors.collapsedText
|
|
2292
|
+
}),
|
|
2293
|
+
onClick: m[2] || (m[2] = ($) => S()),
|
|
2294
|
+
title: `Click to expand ${P.value} child element${P.value > 1 ? "s" : ""}`
|
|
2295
|
+
}, B(P.value) + " child" + B(P.value > 1 ? "ren" : ""), 13, sr),
|
|
2296
|
+
y("span", {
|
|
2323
2297
|
class: "xml-node__clickable-part",
|
|
2324
|
-
onClick:
|
|
2325
|
-
title: "Click to
|
|
2298
|
+
onClick: m[3] || (m[3] = ($) => S()),
|
|
2299
|
+
title: "Click to expand"
|
|
2326
2300
|
}, [
|
|
2327
|
-
|
|
2301
|
+
y("span", {
|
|
2328
2302
|
class: "xml-node__bracket",
|
|
2329
|
-
style:
|
|
2303
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2330
2304
|
}, "</", 4),
|
|
2331
|
-
|
|
2305
|
+
y("span", {
|
|
2332
2306
|
class: "xml-node__tag",
|
|
2333
|
-
style:
|
|
2334
|
-
},
|
|
2335
|
-
|
|
2307
|
+
style: N({ color: g.theme.colors.xmlTag })
|
|
2308
|
+
}, B(n.value), 5),
|
|
2309
|
+
y("span", {
|
|
2336
2310
|
class: "xml-node__bracket",
|
|
2337
|
-
style:
|
|
2311
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2338
2312
|
}, ">", 4)
|
|
2339
2313
|
])
|
|
2340
|
-
])) :
|
|
2314
|
+
])) : (_(), x(ne, { key: 1 }, [
|
|
2315
|
+
y("div", or, [
|
|
2316
|
+
A.value ? (_(), x("span", {
|
|
2317
|
+
key: 0,
|
|
2318
|
+
class: "xml-node__clickable-part",
|
|
2319
|
+
onClick: m[4] || (m[4] = ($) => S()),
|
|
2320
|
+
title: i.value ? "Click to collapse" : "Click to expand"
|
|
2321
|
+
}, [
|
|
2322
|
+
y("span", {
|
|
2323
|
+
class: "xml-node__bracket",
|
|
2324
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2325
|
+
}, "<", 4),
|
|
2326
|
+
y("span", {
|
|
2327
|
+
class: "xml-node__tag",
|
|
2328
|
+
style: N({ color: g.theme.colors.xmlTag })
|
|
2329
|
+
}, B(n.value), 5)
|
|
2330
|
+
], 8, ir)) : (_(), x("span", ar, [
|
|
2331
|
+
y("span", {
|
|
2332
|
+
class: "xml-node__bracket",
|
|
2333
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2334
|
+
}, "<", 4),
|
|
2335
|
+
y("span", {
|
|
2336
|
+
class: "xml-node__tag",
|
|
2337
|
+
style: N({ color: g.theme.colors.xmlTag })
|
|
2338
|
+
}, B(n.value), 5)
|
|
2339
|
+
])),
|
|
2340
|
+
(_(!0), x(ne, null, ie(a.value, ($, j) => (_(), x("span", {
|
|
2341
|
+
key: j,
|
|
2342
|
+
class: "xml-node__attribute"
|
|
2343
|
+
}, [
|
|
2344
|
+
y("span", {
|
|
2345
|
+
class: "xml-node__attr-name",
|
|
2346
|
+
style: N({ color: g.theme.colors.xmlAttribute })
|
|
2347
|
+
}, B(j), 5),
|
|
2348
|
+
y("span", {
|
|
2349
|
+
class: "xml-node__equals",
|
|
2350
|
+
style: N({ color: g.theme.colors.xmlEquals })
|
|
2351
|
+
}, "=", 4),
|
|
2352
|
+
y("span", {
|
|
2353
|
+
class: "xml-node__quote",
|
|
2354
|
+
style: N({ color: g.theme.colors.xmlQuote })
|
|
2355
|
+
}, '"', 4),
|
|
2356
|
+
y("span", {
|
|
2357
|
+
class: "xml-node__attr-value",
|
|
2358
|
+
style: N({ color: g.theme.colors.xmlAttributeValue })
|
|
2359
|
+
}, B($), 5),
|
|
2360
|
+
y("span", {
|
|
2361
|
+
class: "xml-node__quote",
|
|
2362
|
+
style: N({ color: g.theme.colors.xmlQuote })
|
|
2363
|
+
}, '"', 4)
|
|
2364
|
+
]))), 128)),
|
|
2365
|
+
A.value ? (_(), x("span", {
|
|
2366
|
+
key: 2,
|
|
2367
|
+
class: "xml-node__clickable-part",
|
|
2368
|
+
onClick: m[5] || (m[5] = ($) => S()),
|
|
2369
|
+
title: i.value ? "Click to collapse" : "Click to expand"
|
|
2370
|
+
}, [
|
|
2371
|
+
y("span", {
|
|
2372
|
+
class: "xml-node__bracket",
|
|
2373
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2374
|
+
}, ">", 4)
|
|
2375
|
+
], 8, lr)) : (_(), x("span", {
|
|
2376
|
+
key: 3,
|
|
2377
|
+
class: "xml-node__bracket",
|
|
2378
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2379
|
+
}, B(A.value ? ">" : "/>"), 5))
|
|
2380
|
+
]),
|
|
2381
|
+
i.value && A.value ? (_(), x("div", ur, [
|
|
2382
|
+
l.value.length === 0 && v.value.trim() ? (_(), x("div", cr, [
|
|
2383
|
+
y("span", {
|
|
2384
|
+
class: "xml-node__text-content",
|
|
2385
|
+
style: N({ color: g.theme.colors.xmlText })
|
|
2386
|
+
}, B(v.value), 5)
|
|
2387
|
+
])) : U("", !0),
|
|
2388
|
+
(_(!0), x(ne, null, ie(l.value, ($, j) => (_(), Xe(O, {
|
|
2389
|
+
key: F($, j),
|
|
2390
|
+
node: $,
|
|
2391
|
+
index: j,
|
|
2392
|
+
level: g.level + 1,
|
|
2393
|
+
"parent-path": Z(),
|
|
2394
|
+
expanded: g.expanded,
|
|
2395
|
+
theme: g.theme,
|
|
2396
|
+
onToggleExpand: m[6] || (m[6] = (H) => g.$emit("toggle-expand", H)),
|
|
2397
|
+
onCopy: m[7] || (m[7] = (H) => g.$emit("copy", H))
|
|
2398
|
+
}, null, 8, ["node", "index", "level", "parent-path", "expanded", "theme"]))), 128))
|
|
2399
|
+
])) : U("", !0),
|
|
2400
|
+
i.value && A.value ? (_(), x("div", dr, [
|
|
2401
|
+
y("span", {
|
|
2402
|
+
class: "xml-node__clickable-part",
|
|
2403
|
+
onClick: m[8] || (m[8] = ($) => S()),
|
|
2404
|
+
title: "Click to collapse"
|
|
2405
|
+
}, [
|
|
2406
|
+
y("span", {
|
|
2407
|
+
class: "xml-node__bracket",
|
|
2408
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2409
|
+
}, "</", 4),
|
|
2410
|
+
y("span", {
|
|
2411
|
+
class: "xml-node__tag",
|
|
2412
|
+
style: N({ color: g.theme.colors.xmlTag })
|
|
2413
|
+
}, B(n.value), 5),
|
|
2414
|
+
y("span", {
|
|
2415
|
+
class: "xml-node__bracket",
|
|
2416
|
+
style: N({ color: g.theme.colors.xmlBracket })
|
|
2417
|
+
}, ">", 4)
|
|
2418
|
+
])
|
|
2419
|
+
])) : U("", !0)
|
|
2420
|
+
], 64))
|
|
2341
2421
|
]))
|
|
2342
|
-
])) :
|
|
2422
|
+
])) : U("", !0)
|
|
2343
2423
|
], 4);
|
|
2344
2424
|
};
|
|
2345
2425
|
}
|
|
2346
|
-
}),
|
|
2426
|
+
}), hr = /* @__PURE__ */ be(fr, [["__scopeId", "data-v-afb7b2ab"]]), pr = {
|
|
2347
2427
|
name: "github-light",
|
|
2348
2428
|
colors: {
|
|
2349
2429
|
// 背景色
|
|
@@ -2385,10 +2465,15 @@ const Lt = {
|
|
|
2385
2465
|
// 括号 - 灰色
|
|
2386
2466
|
xmlEquals: "#6e7781",
|
|
2387
2467
|
// 等号 - 灰色
|
|
2388
|
-
xmlQuote: "#0550ae"
|
|
2468
|
+
xmlQuote: "#0550ae",
|
|
2389
2469
|
// 引号 - 蓝色
|
|
2470
|
+
// 折叠效果
|
|
2471
|
+
collapsedBackground: "#ddf4ff",
|
|
2472
|
+
// 折叠信息背景色 - 浅蓝
|
|
2473
|
+
collapsedText: "#0969da"
|
|
2474
|
+
// 折叠信息文本色 - 蓝色
|
|
2390
2475
|
}
|
|
2391
|
-
},
|
|
2476
|
+
}, gr = {
|
|
2392
2477
|
name: "github-dark",
|
|
2393
2478
|
colors: {
|
|
2394
2479
|
// 背景色
|
|
@@ -2430,10 +2515,15 @@ const Lt = {
|
|
|
2430
2515
|
// 括号 - 灰色
|
|
2431
2516
|
xmlEquals: "#8b949e",
|
|
2432
2517
|
// 等号 - 灰色
|
|
2433
|
-
xmlQuote: "#79c0ff"
|
|
2518
|
+
xmlQuote: "#79c0ff",
|
|
2434
2519
|
// 引号 - 亮蓝色
|
|
2520
|
+
// 折叠效果
|
|
2521
|
+
collapsedBackground: "#1c2d41",
|
|
2522
|
+
// 折叠信息背景色 - 深蓝
|
|
2523
|
+
collapsedText: "#58a6ff"
|
|
2524
|
+
// 折叠信息文本色 - 亮蓝
|
|
2435
2525
|
}
|
|
2436
|
-
},
|
|
2526
|
+
}, mr = {
|
|
2437
2527
|
name: "min-light",
|
|
2438
2528
|
colors: {
|
|
2439
2529
|
// 背景色
|
|
@@ -2475,10 +2565,15 @@ const Lt = {
|
|
|
2475
2565
|
// 括号 - 灰色
|
|
2476
2566
|
xmlEquals: "#737373",
|
|
2477
2567
|
// 等号 - 灰色
|
|
2478
|
-
xmlQuote: "#2563eb"
|
|
2568
|
+
xmlQuote: "#2563eb",
|
|
2479
2569
|
// 引号 - 蓝色
|
|
2570
|
+
// 折叠效果
|
|
2571
|
+
collapsedBackground: "#dbeafe",
|
|
2572
|
+
// 折叠信息背景色 - 浅蓝
|
|
2573
|
+
collapsedText: "#1d4ed8"
|
|
2574
|
+
// 折叠信息文本色 - 蓝色
|
|
2480
2575
|
}
|
|
2481
|
-
},
|
|
2576
|
+
}, yr = {
|
|
2482
2577
|
name: "slack-ochin",
|
|
2483
2578
|
colors: {
|
|
2484
2579
|
// 背景色
|
|
@@ -2520,16 +2615,21 @@ const Lt = {
|
|
|
2520
2615
|
// 括号 - 灰色
|
|
2521
2616
|
xmlEquals: "#616061",
|
|
2522
2617
|
// 等号 - 灰色
|
|
2523
|
-
xmlQuote: "#1264a3"
|
|
2618
|
+
xmlQuote: "#1264a3",
|
|
2524
2619
|
// 引号 - 蓝色
|
|
2620
|
+
// 折叠效果
|
|
2621
|
+
collapsedBackground: "#d8eaf5",
|
|
2622
|
+
// 折叠信息背景色 - 浅蓝
|
|
2623
|
+
collapsedText: "#0b4c8c"
|
|
2624
|
+
// 折叠信息文本色 - 深蓝
|
|
2525
2625
|
}
|
|
2526
2626
|
}, Be = {
|
|
2527
|
-
"github-light":
|
|
2528
|
-
"github-dark":
|
|
2529
|
-
"min-light":
|
|
2530
|
-
"slack-ochin":
|
|
2531
|
-
},
|
|
2532
|
-
function
|
|
2627
|
+
"github-light": pr,
|
|
2628
|
+
"github-dark": gr,
|
|
2629
|
+
"min-light": mr,
|
|
2630
|
+
"slack-ochin": yr
|
|
2631
|
+
}, br = (r) => Be[r] || Be["github-light"], Ke = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD", vr = Ke + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", _r = "[" + Ke + "][" + vr + "]*", Er = new RegExp("^" + _r + "$");
|
|
2632
|
+
function qe(r, e) {
|
|
2533
2633
|
const t = [];
|
|
2534
2634
|
let s = e.exec(r);
|
|
2535
2635
|
for (; s; ) {
|
|
@@ -2543,29 +2643,29 @@ function Ye(r, e) {
|
|
|
2543
2643
|
return t;
|
|
2544
2644
|
}
|
|
2545
2645
|
const ve = function(r) {
|
|
2546
|
-
const e =
|
|
2646
|
+
const e = Er.exec(r);
|
|
2547
2647
|
return !(e === null || typeof e > "u");
|
|
2548
2648
|
};
|
|
2549
|
-
function
|
|
2649
|
+
function xr(r) {
|
|
2550
2650
|
return typeof r < "u";
|
|
2551
2651
|
}
|
|
2552
|
-
const
|
|
2652
|
+
const kr = {
|
|
2553
2653
|
allowBooleanAttributes: !1,
|
|
2554
2654
|
//A tag can have attributes without any value
|
|
2555
2655
|
unpairedTags: []
|
|
2556
2656
|
};
|
|
2557
2657
|
function Qe(r, e) {
|
|
2558
|
-
e = Object.assign({},
|
|
2658
|
+
e = Object.assign({}, kr, e);
|
|
2559
2659
|
const t = [];
|
|
2560
2660
|
let s = !1, n = !1;
|
|
2561
2661
|
r[0] === "\uFEFF" && (r = r.substr(1));
|
|
2562
2662
|
for (let o = 0; o < r.length; o++)
|
|
2563
2663
|
if (r[o] === "<" && r[o + 1] === "?") {
|
|
2564
|
-
if (o += 2, o =
|
|
2664
|
+
if (o += 2, o = Ve(r, o), o.err) return o;
|
|
2565
2665
|
} else if (r[o] === "<") {
|
|
2566
2666
|
let i = o;
|
|
2567
2667
|
if (o++, r[o] === "!") {
|
|
2568
|
-
o =
|
|
2668
|
+
o = Le(r, o);
|
|
2569
2669
|
continue;
|
|
2570
2670
|
} else {
|
|
2571
2671
|
let u = !1;
|
|
@@ -2574,91 +2674,91 @@ function Qe(r, e) {
|
|
|
2574
2674
|
for (; o < r.length && r[o] !== ">" && r[o] !== " " && r[o] !== " " && r[o] !== `
|
|
2575
2675
|
` && r[o] !== "\r"; o++)
|
|
2576
2676
|
a += r[o];
|
|
2577
|
-
if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1), o--),
|
|
2578
|
-
let
|
|
2579
|
-
return a.trim().length === 0 ?
|
|
2677
|
+
if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1), o--), !$r(a)) {
|
|
2678
|
+
let h;
|
|
2679
|
+
return a.trim().length === 0 ? h = "Invalid space after '<'." : h = "Tag '" + a + "' is an invalid name.", M("InvalidTag", h, Q(r, o));
|
|
2580
2680
|
}
|
|
2581
|
-
const l =
|
|
2681
|
+
const l = wr(r, o);
|
|
2582
2682
|
if (l === !1)
|
|
2583
|
-
return
|
|
2584
|
-
let
|
|
2585
|
-
if (o = l.index,
|
|
2586
|
-
const
|
|
2587
|
-
|
|
2588
|
-
const
|
|
2589
|
-
if (
|
|
2683
|
+
return M("InvalidAttr", "Attributes for '" + a + "' have open quote.", Q(r, o));
|
|
2684
|
+
let p = l.value;
|
|
2685
|
+
if (o = l.index, p[p.length - 1] === "/") {
|
|
2686
|
+
const h = o - p.length;
|
|
2687
|
+
p = p.substring(0, p.length - 1);
|
|
2688
|
+
const v = je(p, e);
|
|
2689
|
+
if (v === !0)
|
|
2590
2690
|
s = !0;
|
|
2591
2691
|
else
|
|
2592
|
-
return
|
|
2692
|
+
return M(v.err.code, v.err.msg, Q(r, h + v.err.line));
|
|
2593
2693
|
} else if (u)
|
|
2594
2694
|
if (l.tagClosed) {
|
|
2595
|
-
if (
|
|
2596
|
-
return
|
|
2695
|
+
if (p.trim().length > 0)
|
|
2696
|
+
return M("InvalidTag", "Closing tag '" + a + "' can't have attributes or invalid starting.", Q(r, i));
|
|
2597
2697
|
if (t.length === 0)
|
|
2598
|
-
return
|
|
2698
|
+
return M("InvalidTag", "Closing tag '" + a + "' has not been opened.", Q(r, i));
|
|
2599
2699
|
{
|
|
2600
|
-
const
|
|
2601
|
-
if (a !==
|
|
2602
|
-
let
|
|
2603
|
-
return
|
|
2700
|
+
const h = t.pop();
|
|
2701
|
+
if (a !== h.tagName) {
|
|
2702
|
+
let v = Q(r, h.tagStartPos);
|
|
2703
|
+
return M(
|
|
2604
2704
|
"InvalidTag",
|
|
2605
|
-
"Expected closing tag '" +
|
|
2606
|
-
|
|
2705
|
+
"Expected closing tag '" + h.tagName + "' (opened in line " + v.line + ", col " + v.col + ") instead of closing tag '" + a + "'.",
|
|
2706
|
+
Q(r, i)
|
|
2607
2707
|
);
|
|
2608
2708
|
}
|
|
2609
2709
|
t.length == 0 && (n = !0);
|
|
2610
2710
|
}
|
|
2611
|
-
} else return
|
|
2711
|
+
} else return M("InvalidTag", "Closing tag '" + a + "' doesn't have proper closing.", Q(r, o));
|
|
2612
2712
|
else {
|
|
2613
|
-
const
|
|
2614
|
-
if (
|
|
2615
|
-
return
|
|
2713
|
+
const h = je(p, e);
|
|
2714
|
+
if (h !== !0)
|
|
2715
|
+
return M(h.err.code, h.err.msg, Q(r, o - p.length + h.err.line));
|
|
2616
2716
|
if (n === !0)
|
|
2617
|
-
return
|
|
2717
|
+
return M("InvalidXml", "Multiple possible root nodes found.", Q(r, o));
|
|
2618
2718
|
e.unpairedTags.indexOf(a) !== -1 || t.push({ tagName: a, tagStartPos: i }), s = !0;
|
|
2619
2719
|
}
|
|
2620
2720
|
for (o++; o < r.length; o++)
|
|
2621
2721
|
if (r[o] === "<")
|
|
2622
2722
|
if (r[o + 1] === "!") {
|
|
2623
|
-
o++, o =
|
|
2723
|
+
o++, o = Le(r, o);
|
|
2624
2724
|
continue;
|
|
2625
2725
|
} else if (r[o + 1] === "?") {
|
|
2626
|
-
if (o =
|
|
2726
|
+
if (o = Ve(r, ++o), o.err) return o;
|
|
2627
2727
|
} else
|
|
2628
2728
|
break;
|
|
2629
2729
|
else if (r[o] === "&") {
|
|
2630
|
-
const
|
|
2631
|
-
if (
|
|
2632
|
-
return
|
|
2633
|
-
o =
|
|
2634
|
-
} else if (n === !0 && !
|
|
2635
|
-
return
|
|
2730
|
+
const h = Tr(r, o);
|
|
2731
|
+
if (h == -1)
|
|
2732
|
+
return M("InvalidChar", "char '&' is not expected.", Q(r, o));
|
|
2733
|
+
o = h;
|
|
2734
|
+
} else if (n === !0 && !Ie(r[o]))
|
|
2735
|
+
return M("InvalidXml", "Extra text at the end", Q(r, o));
|
|
2636
2736
|
r[o] === "<" && o--;
|
|
2637
2737
|
}
|
|
2638
2738
|
} else {
|
|
2639
|
-
if (
|
|
2739
|
+
if (Ie(r[o]))
|
|
2640
2740
|
continue;
|
|
2641
|
-
return
|
|
2741
|
+
return M("InvalidChar", "char '" + r[o] + "' is not expected.", Q(r, o));
|
|
2642
2742
|
}
|
|
2643
2743
|
if (s) {
|
|
2644
2744
|
if (t.length == 1)
|
|
2645
|
-
return
|
|
2745
|
+
return M("InvalidTag", "Unclosed tag '" + t[0].tagName + "'.", Q(r, t[0].tagStartPos));
|
|
2646
2746
|
if (t.length > 0)
|
|
2647
|
-
return
|
|
2648
|
-
} else return
|
|
2747
|
+
return M("InvalidXml", "Invalid '" + JSON.stringify(t.map((o) => o.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
|
|
2748
|
+
} else return M("InvalidXml", "Start tag expected.", 1);
|
|
2649
2749
|
return !0;
|
|
2650
2750
|
}
|
|
2651
|
-
function
|
|
2751
|
+
function Ie(r) {
|
|
2652
2752
|
return r === " " || r === " " || r === `
|
|
2653
2753
|
` || r === "\r";
|
|
2654
2754
|
}
|
|
2655
|
-
function
|
|
2755
|
+
function Ve(r, e) {
|
|
2656
2756
|
const t = e;
|
|
2657
2757
|
for (; e < r.length; e++)
|
|
2658
2758
|
if (r[e] == "?" || r[e] == " ") {
|
|
2659
2759
|
const s = r.substr(t, e - t);
|
|
2660
2760
|
if (e > 5 && s === "xml")
|
|
2661
|
-
return
|
|
2761
|
+
return M("InvalidXml", "XML declaration allowed only at the start of the document.", Q(r, e));
|
|
2662
2762
|
if (r[e] == "?" && r[e + 1] == ">") {
|
|
2663
2763
|
e++;
|
|
2664
2764
|
break;
|
|
@@ -2667,7 +2767,7 @@ function Le(r, e) {
|
|
|
2667
2767
|
}
|
|
2668
2768
|
return e;
|
|
2669
2769
|
}
|
|
2670
|
-
function
|
|
2770
|
+
function Le(r, e) {
|
|
2671
2771
|
if (r.length > e + 5 && r[e + 1] === "-" && r[e + 2] === "-") {
|
|
2672
2772
|
for (e += 3; e < r.length; e++)
|
|
2673
2773
|
if (r[e] === "-" && r[e + 1] === "-" && r[e + 2] === ">") {
|
|
@@ -2690,11 +2790,11 @@ function Re(r, e) {
|
|
|
2690
2790
|
}
|
|
2691
2791
|
return e;
|
|
2692
2792
|
}
|
|
2693
|
-
const
|
|
2694
|
-
function
|
|
2793
|
+
const Nr = '"', Ar = "'";
|
|
2794
|
+
function wr(r, e) {
|
|
2695
2795
|
let t = "", s = "", n = !1;
|
|
2696
2796
|
for (; e < r.length; e++) {
|
|
2697
|
-
if (r[e] ===
|
|
2797
|
+
if (r[e] === Nr || r[e] === Ar)
|
|
2698
2798
|
s === "" ? s = r[e] : s !== r[e] || (s = "");
|
|
2699
2799
|
else if (r[e] === ">" && s === "") {
|
|
2700
2800
|
n = !0;
|
|
@@ -2708,27 +2808,27 @@ function kr(r, e) {
|
|
|
2708
2808
|
tagClosed: n
|
|
2709
2809
|
};
|
|
2710
2810
|
}
|
|
2711
|
-
const
|
|
2811
|
+
const Cr = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
|
|
2712
2812
|
function je(r, e) {
|
|
2713
|
-
const t =
|
|
2813
|
+
const t = qe(r, Cr), s = {};
|
|
2714
2814
|
for (let n = 0; n < t.length; n++) {
|
|
2715
2815
|
if (t[n][1].length === 0)
|
|
2716
|
-
return
|
|
2816
|
+
return M("InvalidAttr", "Attribute '" + t[n][2] + "' has no space in starting.", pe(t[n]));
|
|
2717
2817
|
if (t[n][3] !== void 0 && t[n][4] === void 0)
|
|
2718
|
-
return
|
|
2818
|
+
return M("InvalidAttr", "Attribute '" + t[n][2] + "' is without value.", pe(t[n]));
|
|
2719
2819
|
if (t[n][3] === void 0 && !e.allowBooleanAttributes)
|
|
2720
|
-
return
|
|
2820
|
+
return M("InvalidAttr", "boolean attribute '" + t[n][2] + "' is not allowed.", pe(t[n]));
|
|
2721
2821
|
const o = t[n][2];
|
|
2722
|
-
if (!
|
|
2723
|
-
return
|
|
2822
|
+
if (!Pr(o))
|
|
2823
|
+
return M("InvalidAttr", "Attribute '" + o + "' is an invalid name.", pe(t[n]));
|
|
2724
2824
|
if (!s.hasOwnProperty(o))
|
|
2725
2825
|
s[o] = 1;
|
|
2726
2826
|
else
|
|
2727
|
-
return
|
|
2827
|
+
return M("InvalidAttr", "Attribute '" + o + "' is repeated.", pe(t[n]));
|
|
2728
2828
|
}
|
|
2729
2829
|
return !0;
|
|
2730
2830
|
}
|
|
2731
|
-
function
|
|
2831
|
+
function Or(r, e) {
|
|
2732
2832
|
let t = /\d/;
|
|
2733
2833
|
for (r[e] === "x" && (e++, t = /[\da-fA-F]/); e < r.length; e++) {
|
|
2734
2834
|
if (r[e] === ";")
|
|
@@ -2738,11 +2838,11 @@ function wr(r, e) {
|
|
|
2738
2838
|
}
|
|
2739
2839
|
return -1;
|
|
2740
2840
|
}
|
|
2741
|
-
function
|
|
2841
|
+
function Tr(r, e) {
|
|
2742
2842
|
if (e++, r[e] === ";")
|
|
2743
2843
|
return -1;
|
|
2744
2844
|
if (r[e] === "#")
|
|
2745
|
-
return e++,
|
|
2845
|
+
return e++, Or(r, e);
|
|
2746
2846
|
let t = 0;
|
|
2747
2847
|
for (; e < r.length; e++, t++)
|
|
2748
2848
|
if (!(r[e].match(/\w/) && t < 20)) {
|
|
@@ -2752,7 +2852,7 @@ function Cr(r, e) {
|
|
|
2752
2852
|
}
|
|
2753
2853
|
return e;
|
|
2754
2854
|
}
|
|
2755
|
-
function
|
|
2855
|
+
function M(r, e, t) {
|
|
2756
2856
|
return {
|
|
2757
2857
|
err: {
|
|
2758
2858
|
code: r,
|
|
@@ -2762,13 +2862,13 @@ function U(r, e, t) {
|
|
|
2762
2862
|
}
|
|
2763
2863
|
};
|
|
2764
2864
|
}
|
|
2765
|
-
function
|
|
2865
|
+
function Pr(r) {
|
|
2766
2866
|
return ve(r);
|
|
2767
2867
|
}
|
|
2768
|
-
function
|
|
2868
|
+
function $r(r) {
|
|
2769
2869
|
return ve(r);
|
|
2770
2870
|
}
|
|
2771
|
-
function
|
|
2871
|
+
function Q(r, e) {
|
|
2772
2872
|
const t = r.substring(0, e).split(/\r?\n/);
|
|
2773
2873
|
return {
|
|
2774
2874
|
line: t.length,
|
|
@@ -2779,7 +2879,7 @@ function W(r, e) {
|
|
|
2779
2879
|
function pe(r) {
|
|
2780
2880
|
return r.startIndex + r[1].length;
|
|
2781
2881
|
}
|
|
2782
|
-
const
|
|
2882
|
+
const Sr = {
|
|
2783
2883
|
preserveOrder: !1,
|
|
2784
2884
|
attributeNamePrefix: "@_",
|
|
2785
2885
|
attributesGroupName: !1,
|
|
@@ -2823,12 +2923,12 @@ const Pr = {
|
|
|
2823
2923
|
},
|
|
2824
2924
|
// skipEmptyListItem: false
|
|
2825
2925
|
captureMetaData: !1
|
|
2826
|
-
},
|
|
2827
|
-
return Object.assign({},
|
|
2926
|
+
}, Br = function(r) {
|
|
2927
|
+
return Object.assign({}, Sr, r);
|
|
2828
2928
|
};
|
|
2829
2929
|
let me;
|
|
2830
2930
|
typeof Symbol != "function" ? me = "@@xmlMetadata" : me = Symbol("XML Node Metadata");
|
|
2831
|
-
class
|
|
2931
|
+
class ae {
|
|
2832
2932
|
constructor(e) {
|
|
2833
2933
|
this.tagname = e, this.child = [], this[":@"] = {};
|
|
2834
2934
|
}
|
|
@@ -2843,7 +2943,7 @@ class oe {
|
|
|
2843
2943
|
return me;
|
|
2844
2944
|
}
|
|
2845
2945
|
}
|
|
2846
|
-
class
|
|
2946
|
+
class Ir {
|
|
2847
2947
|
constructor(e) {
|
|
2848
2948
|
this.suppressValidationErr = !e;
|
|
2849
2949
|
}
|
|
@@ -2854,24 +2954,24 @@ class Sr {
|
|
|
2854
2954
|
let n = 1, o = !1, i = !1, u = "";
|
|
2855
2955
|
for (; t < e.length; t++)
|
|
2856
2956
|
if (e[t] === "<" && !i) {
|
|
2857
|
-
if (o &&
|
|
2957
|
+
if (o && oe(e, "!ENTITY", t)) {
|
|
2858
2958
|
t += 7;
|
|
2859
2959
|
let a, l;
|
|
2860
2960
|
[a, l, t] = this.readEntityExp(e, t + 1, this.suppressValidationErr), l.indexOf("&") === -1 && (s[a] = {
|
|
2861
2961
|
regx: RegExp(`&${a};`, "g"),
|
|
2862
2962
|
val: l
|
|
2863
2963
|
});
|
|
2864
|
-
} else if (o &&
|
|
2964
|
+
} else if (o && oe(e, "!ELEMENT", t)) {
|
|
2865
2965
|
t += 8;
|
|
2866
2966
|
const { index: a } = this.readElementExp(e, t + 1);
|
|
2867
2967
|
t = a;
|
|
2868
|
-
} else if (o &&
|
|
2968
|
+
} else if (o && oe(e, "!ATTLIST", t))
|
|
2869
2969
|
t += 8;
|
|
2870
|
-
else if (o &&
|
|
2970
|
+
else if (o && oe(e, "!NOTATION", t)) {
|
|
2871
2971
|
t += 9;
|
|
2872
2972
|
const { index: a } = this.readNotationExp(e, t + 1, this.suppressValidationErr);
|
|
2873
2973
|
t = a;
|
|
2874
|
-
} else if (
|
|
2974
|
+
} else if (oe(e, "!--", t)) i = !0;
|
|
2875
2975
|
else throw new Error("Invalid DOCTYPE");
|
|
2876
2976
|
n++, u = "";
|
|
2877
2977
|
} else if (e[t] === ">") {
|
|
@@ -2885,11 +2985,11 @@ class Sr {
|
|
|
2885
2985
|
return { entities: s, i: t };
|
|
2886
2986
|
}
|
|
2887
2987
|
readEntityExp(e, t) {
|
|
2888
|
-
t =
|
|
2988
|
+
t = W(e, t);
|
|
2889
2989
|
let s = "";
|
|
2890
2990
|
for (; t < e.length && !/\s/.test(e[t]) && e[t] !== '"' && e[t] !== "'"; )
|
|
2891
2991
|
s += e[t], t++;
|
|
2892
|
-
if (ge(s), t =
|
|
2992
|
+
if (ge(s), t = W(e, t), !this.suppressValidationErr) {
|
|
2893
2993
|
if (e.substring(t, t + 6).toUpperCase() === "SYSTEM")
|
|
2894
2994
|
throw new Error("External entities are not supported");
|
|
2895
2995
|
if (e[t] === "%")
|
|
@@ -2899,18 +2999,18 @@ class Sr {
|
|
|
2899
2999
|
return [t, n] = this.readIdentifierVal(e, t, "entity"), t--, [s, n, t];
|
|
2900
3000
|
}
|
|
2901
3001
|
readNotationExp(e, t) {
|
|
2902
|
-
t =
|
|
3002
|
+
t = W(e, t);
|
|
2903
3003
|
let s = "";
|
|
2904
3004
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
2905
3005
|
s += e[t], t++;
|
|
2906
|
-
!this.suppressValidationErr && ge(s), t =
|
|
3006
|
+
!this.suppressValidationErr && ge(s), t = W(e, t);
|
|
2907
3007
|
const n = e.substring(t, t + 6).toUpperCase();
|
|
2908
3008
|
if (!this.suppressValidationErr && n !== "SYSTEM" && n !== "PUBLIC")
|
|
2909
3009
|
throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);
|
|
2910
|
-
t += n.length, t =
|
|
3010
|
+
t += n.length, t = W(e, t);
|
|
2911
3011
|
let o = null, i = null;
|
|
2912
3012
|
if (n === "PUBLIC")
|
|
2913
|
-
[t, o] = this.readIdentifierVal(e, t, "publicIdentifier"), t =
|
|
3013
|
+
[t, o] = this.readIdentifierVal(e, t, "publicIdentifier"), t = W(e, t), (e[t] === '"' || e[t] === "'") && ([t, i] = this.readIdentifierVal(e, t, "systemIdentifier"));
|
|
2914
3014
|
else if (n === "SYSTEM" && ([t, i] = this.readIdentifierVal(e, t, "systemIdentifier"), !this.suppressValidationErr && !i))
|
|
2915
3015
|
throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
2916
3016
|
return { notationName: s, publicIdentifier: o, systemIdentifier: i, index: --t };
|
|
@@ -2927,16 +3027,16 @@ class Sr {
|
|
|
2927
3027
|
return t++, [t, n];
|
|
2928
3028
|
}
|
|
2929
3029
|
readElementExp(e, t) {
|
|
2930
|
-
t =
|
|
3030
|
+
t = W(e, t);
|
|
2931
3031
|
let s = "";
|
|
2932
3032
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
2933
3033
|
s += e[t], t++;
|
|
2934
3034
|
if (!this.suppressValidationErr && !ve(s))
|
|
2935
3035
|
throw new Error(`Invalid element name: "${s}"`);
|
|
2936
|
-
t =
|
|
3036
|
+
t = W(e, t);
|
|
2937
3037
|
let n = "";
|
|
2938
|
-
if (e[t] === "E" &&
|
|
2939
|
-
else if (e[t] === "A" &&
|
|
3038
|
+
if (e[t] === "E" && oe(e, "MPTY", t)) t += 4;
|
|
3039
|
+
else if (e[t] === "A" && oe(e, "NY", t)) t += 2;
|
|
2940
3040
|
else if (e[t] === "(") {
|
|
2941
3041
|
for (t++; t < e.length && e[t] !== ")"; )
|
|
2942
3042
|
n += e[t], t++;
|
|
@@ -2951,20 +3051,20 @@ class Sr {
|
|
|
2951
3051
|
};
|
|
2952
3052
|
}
|
|
2953
3053
|
readAttlistExp(e, t) {
|
|
2954
|
-
t =
|
|
3054
|
+
t = W(e, t);
|
|
2955
3055
|
let s = "";
|
|
2956
3056
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
2957
3057
|
s += e[t], t++;
|
|
2958
|
-
ge(s), t =
|
|
3058
|
+
ge(s), t = W(e, t);
|
|
2959
3059
|
let n = "";
|
|
2960
3060
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
2961
3061
|
n += e[t], t++;
|
|
2962
3062
|
if (!ge(n))
|
|
2963
3063
|
throw new Error(`Invalid attribute name: "${n}"`);
|
|
2964
|
-
t =
|
|
3064
|
+
t = W(e, t);
|
|
2965
3065
|
let o = "";
|
|
2966
3066
|
if (e.substring(t, t + 8).toUpperCase() === "NOTATION") {
|
|
2967
|
-
if (o = "NOTATION", t += 8, t =
|
|
3067
|
+
if (o = "NOTATION", t += 8, t = W(e, t), e[t] !== "(")
|
|
2968
3068
|
throw new Error(`Expected '(', found "${e[t]}"`);
|
|
2969
3069
|
t++;
|
|
2970
3070
|
let u = [];
|
|
@@ -2974,7 +3074,7 @@ class Sr {
|
|
|
2974
3074
|
a += e[t], t++;
|
|
2975
3075
|
if (a = a.trim(), !ge(a))
|
|
2976
3076
|
throw new Error(`Invalid notation name: "${a}"`);
|
|
2977
|
-
u.push(a), e[t] === "|" && (t++, t =
|
|
3077
|
+
u.push(a), e[t] === "|" && (t++, t = W(e, t));
|
|
2978
3078
|
}
|
|
2979
3079
|
if (e[t] !== ")")
|
|
2980
3080
|
throw new Error("Unterminated list of notations");
|
|
@@ -2986,7 +3086,7 @@ class Sr {
|
|
|
2986
3086
|
if (!this.suppressValidationErr && !u.includes(o.toUpperCase()))
|
|
2987
3087
|
throw new Error(`Invalid attribute type: "${o}"`);
|
|
2988
3088
|
}
|
|
2989
|
-
t =
|
|
3089
|
+
t = W(e, t);
|
|
2990
3090
|
let i = "";
|
|
2991
3091
|
return e.substring(t, t + 8).toUpperCase() === "#REQUIRED" ? (i = "#REQUIRED", t += 8) : e.substring(t, t + 7).toUpperCase() === "#IMPLIED" ? (i = "#IMPLIED", t += 7) : [t, i] = this.readIdentifierVal(e, t, "ATTLIST"), {
|
|
2992
3092
|
elementName: s,
|
|
@@ -2997,12 +3097,12 @@ class Sr {
|
|
|
2997
3097
|
};
|
|
2998
3098
|
}
|
|
2999
3099
|
}
|
|
3000
|
-
const
|
|
3100
|
+
const W = (r, e) => {
|
|
3001
3101
|
for (; e < r.length && /\s/.test(r[e]); )
|
|
3002
3102
|
e++;
|
|
3003
3103
|
return e;
|
|
3004
3104
|
};
|
|
3005
|
-
function
|
|
3105
|
+
function oe(r, e, t) {
|
|
3006
3106
|
for (let s = 0; s < e.length; s++)
|
|
3007
3107
|
if (e[s] !== r[t + s + 1]) return !1;
|
|
3008
3108
|
return !0;
|
|
@@ -3012,7 +3112,7 @@ function ge(r) {
|
|
|
3012
3112
|
return r;
|
|
3013
3113
|
throw new Error(`Invalid entity name ${r}`);
|
|
3014
3114
|
}
|
|
3015
|
-
const
|
|
3115
|
+
const Vr = /^[-+]?0x[a-fA-F0-9]+$/, Lr = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, jr = {
|
|
3016
3116
|
hex: !0,
|
|
3017
3117
|
// oct: false,
|
|
3018
3118
|
leadingZeros: !0,
|
|
@@ -3020,20 +3120,20 @@ const Ir = /^[-+]?0x[a-fA-F0-9]+$/, Br = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, V
|
|
|
3020
3120
|
eNotation: !0
|
|
3021
3121
|
//skipLike: /regex/
|
|
3022
3122
|
};
|
|
3023
|
-
function
|
|
3024
|
-
if (e = Object.assign({},
|
|
3123
|
+
function Rr(r, e = {}) {
|
|
3124
|
+
if (e = Object.assign({}, jr, e), !r || typeof r != "string") return r;
|
|
3025
3125
|
let t = r.trim();
|
|
3026
3126
|
if (e.skipLike !== void 0 && e.skipLike.test(t)) return r;
|
|
3027
3127
|
if (r === "0") return 0;
|
|
3028
|
-
if (e.hex &&
|
|
3029
|
-
return
|
|
3128
|
+
if (e.hex && Vr.test(t))
|
|
3129
|
+
return Xr(t, 16);
|
|
3030
3130
|
if (t.search(/.+[eE].+/) !== -1)
|
|
3031
|
-
return
|
|
3131
|
+
return Ur(r, t, e);
|
|
3032
3132
|
{
|
|
3033
|
-
const s =
|
|
3133
|
+
const s = Lr.exec(t);
|
|
3034
3134
|
if (s) {
|
|
3035
3135
|
const n = s[1] || "", o = s[2];
|
|
3036
|
-
let i =
|
|
3136
|
+
let i = Fr(s[3]);
|
|
3037
3137
|
const u = n ? (
|
|
3038
3138
|
// 0., -00., 000.
|
|
3039
3139
|
r[o.length + 1] === "."
|
|
@@ -3047,17 +3147,17 @@ function Lr(r, e = {}) {
|
|
|
3047
3147
|
return e.eNotation ? a : r;
|
|
3048
3148
|
if (t.indexOf(".") !== -1)
|
|
3049
3149
|
return l === "0" || l === i || l === `${n}${i}` ? a : r;
|
|
3050
|
-
let
|
|
3051
|
-
return o ?
|
|
3150
|
+
let p = o ? i : t;
|
|
3151
|
+
return o ? p === l || n + p === l ? a : r : p === l || p === n + l ? a : r;
|
|
3052
3152
|
}
|
|
3053
3153
|
} else
|
|
3054
3154
|
return r;
|
|
3055
3155
|
}
|
|
3056
3156
|
}
|
|
3057
|
-
const
|
|
3058
|
-
function
|
|
3157
|
+
const Mr = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
|
|
3158
|
+
function Ur(r, e, t) {
|
|
3059
3159
|
if (!t.eNotation) return r;
|
|
3060
|
-
const s = e.match(
|
|
3160
|
+
const s = e.match(Mr);
|
|
3061
3161
|
if (s) {
|
|
3062
3162
|
let n = s[1] || "";
|
|
3063
3163
|
const o = s[3].indexOf("e") === -1 ? "E" : "e", i = s[2], u = n ? (
|
|
@@ -3068,10 +3168,10 @@ function jr(r, e, t) {
|
|
|
3068
3168
|
} else
|
|
3069
3169
|
return r;
|
|
3070
3170
|
}
|
|
3071
|
-
function
|
|
3171
|
+
function Fr(r) {
|
|
3072
3172
|
return r && r.indexOf(".") !== -1 && (r = r.replace(/0+$/, ""), r === "." ? r = "0" : r[0] === "." ? r = "0" + r : r[r.length - 1] === "." && (r = r.substring(0, r.length - 1))), r;
|
|
3073
3173
|
}
|
|
3074
|
-
function
|
|
3174
|
+
function Xr(r, e) {
|
|
3075
3175
|
if (parseInt) return parseInt(r, e);
|
|
3076
3176
|
if (Number.parseInt) return Number.parseInt(r, e);
|
|
3077
3177
|
if (window && window.parseInt) return window.parseInt(r, e);
|
|
@@ -3084,7 +3184,7 @@ function We(r) {
|
|
|
3084
3184
|
return !0;
|
|
3085
3185
|
} : () => !1;
|
|
3086
3186
|
}
|
|
3087
|
-
class
|
|
3187
|
+
class Hr {
|
|
3088
3188
|
constructor(e) {
|
|
3089
3189
|
this.options = e, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
|
|
3090
3190
|
apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
@@ -3107,10 +3207,10 @@ class Fr {
|
|
|
3107
3207
|
inr: { regex: /&(inr|#8377);/g, val: "₹" },
|
|
3108
3208
|
num_dec: { regex: /&#([0-9]{1,7});/g, val: (t, s) => String.fromCodePoint(Number.parseInt(s, 10)) },
|
|
3109
3209
|
num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t, s) => String.fromCodePoint(Number.parseInt(s, 16)) }
|
|
3110
|
-
}, this.addExternalEntities =
|
|
3210
|
+
}, this.addExternalEntities = Kr, this.parseXml = Gr, this.parseTextData = qr, this.resolveNameSpace = Qr, this.buildAttributesMap = Yr, this.isItStopNode = Jr, this.replaceEntitiesValue = zr, this.readStopNodeData = tn, this.saveTextToParentTag = Dr, this.addChild = Zr, this.ignoreAttributesFn = We(this.options.ignoreAttributes);
|
|
3111
3211
|
}
|
|
3112
3212
|
}
|
|
3113
|
-
function
|
|
3213
|
+
function Kr(r) {
|
|
3114
3214
|
const e = Object.keys(r);
|
|
3115
3215
|
for (let t = 0; t < e.length; t++) {
|
|
3116
3216
|
const s = e[t];
|
|
@@ -3120,14 +3220,14 @@ function Xr(r) {
|
|
|
3120
3220
|
};
|
|
3121
3221
|
}
|
|
3122
3222
|
}
|
|
3123
|
-
function
|
|
3223
|
+
function qr(r, e, t, s, n, o, i) {
|
|
3124
3224
|
if (r !== void 0 && (this.options.trimValues && !s && (r = r.trim()), r.length > 0)) {
|
|
3125
3225
|
i || (r = this.replaceEntitiesValue(r));
|
|
3126
3226
|
const u = this.options.tagValueProcessor(e, r, t, n, o);
|
|
3127
3227
|
return u == null ? r : typeof u != typeof r || u !== r ? u : this.options.trimValues ? Ce(r, this.options.parseTagValue, this.options.numberParseOptions) : r.trim() === r ? Ce(r, this.options.parseTagValue, this.options.numberParseOptions) : r;
|
|
3128
3228
|
}
|
|
3129
3229
|
}
|
|
3130
|
-
function
|
|
3230
|
+
function Qr(r) {
|
|
3131
3231
|
if (this.options.removeNSPrefix) {
|
|
3132
3232
|
const e = r.split(":"), t = r.charAt(0) === "/" ? "/" : "";
|
|
3133
3233
|
if (e[0] === "xmlns")
|
|
@@ -3136,10 +3236,10 @@ function Kr(r) {
|
|
|
3136
3236
|
}
|
|
3137
3237
|
return r;
|
|
3138
3238
|
}
|
|
3139
|
-
const
|
|
3239
|
+
const Wr = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
3140
3240
|
function Yr(r, e, t) {
|
|
3141
3241
|
if (this.options.ignoreAttributes !== !0 && typeof r == "string") {
|
|
3142
|
-
const s =
|
|
3242
|
+
const s = qe(r, Wr), n = s.length, o = {};
|
|
3143
3243
|
for (let i = 0; i < n; i++) {
|
|
3144
3244
|
const u = this.resolveNameSpace(s[i][1]);
|
|
3145
3245
|
if (this.ignoreAttributesFn(u, e))
|
|
@@ -3148,8 +3248,8 @@ function Yr(r, e, t) {
|
|
|
3148
3248
|
if (u.length)
|
|
3149
3249
|
if (this.options.transformAttributeName && (l = this.options.transformAttributeName(l)), l === "__proto__" && (l = "#__proto__"), a !== void 0) {
|
|
3150
3250
|
this.options.trimValues && (a = a.trim()), a = this.replaceEntitiesValue(a);
|
|
3151
|
-
const
|
|
3152
|
-
|
|
3251
|
+
const p = this.options.attributeValueProcessor(u, a, e);
|
|
3252
|
+
p == null ? o[l] = a : typeof p != typeof a || p !== a ? o[l] = p : o[l] = Ce(
|
|
3153
3253
|
a,
|
|
3154
3254
|
this.options.parseAttributeValue,
|
|
3155
3255
|
this.options.numberParseOptions
|
|
@@ -3165,37 +3265,37 @@ function Yr(r, e, t) {
|
|
|
3165
3265
|
return o;
|
|
3166
3266
|
}
|
|
3167
3267
|
}
|
|
3168
|
-
const
|
|
3268
|
+
const Gr = function(r) {
|
|
3169
3269
|
r = r.replace(/\r\n?/g, `
|
|
3170
3270
|
`);
|
|
3171
|
-
const e = new
|
|
3271
|
+
const e = new ae("!xml");
|
|
3172
3272
|
let t = e, s = "", n = "";
|
|
3173
|
-
const o = new
|
|
3273
|
+
const o = new Ir(this.options.processEntities);
|
|
3174
3274
|
for (let i = 0; i < r.length; i++)
|
|
3175
3275
|
if (r[i] === "<")
|
|
3176
3276
|
if (r[i + 1] === "/") {
|
|
3177
|
-
const a =
|
|
3277
|
+
const a = le(r, ">", i, "Closing Tag is not closed.");
|
|
3178
3278
|
let l = r.substring(i + 2, a).trim();
|
|
3179
3279
|
if (this.options.removeNSPrefix) {
|
|
3180
|
-
const
|
|
3181
|
-
|
|
3280
|
+
const v = l.indexOf(":");
|
|
3281
|
+
v !== -1 && (l = l.substr(v + 1));
|
|
3182
3282
|
}
|
|
3183
3283
|
this.options.transformTagName && (l = this.options.transformTagName(l)), t && (s = this.saveTextToParentTag(s, t, n));
|
|
3184
|
-
const
|
|
3284
|
+
const p = n.substring(n.lastIndexOf(".") + 1);
|
|
3185
3285
|
if (l && this.options.unpairedTags.indexOf(l) !== -1)
|
|
3186
3286
|
throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);
|
|
3187
|
-
let
|
|
3188
|
-
|
|
3287
|
+
let h = 0;
|
|
3288
|
+
p && this.options.unpairedTags.indexOf(p) !== -1 ? (h = n.lastIndexOf(".", n.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : h = n.lastIndexOf("."), n = n.substring(0, h), t = this.tagsNodeStack.pop(), s = "", i = a;
|
|
3189
3289
|
} else if (r[i + 1] === "?") {
|
|
3190
3290
|
let a = we(r, i, !1, "?>");
|
|
3191
3291
|
if (!a) throw new Error("Pi Tag is not closed.");
|
|
3192
3292
|
if (s = this.saveTextToParentTag(s, t, n), !(this.options.ignoreDeclaration && a.tagName === "?xml" || this.options.ignorePiTags)) {
|
|
3193
|
-
const l = new
|
|
3293
|
+
const l = new ae(a.tagName);
|
|
3194
3294
|
l.add(this.options.textNodeName, ""), a.tagName !== a.tagExp && a.attrExpPresent && (l[":@"] = this.buildAttributesMap(a.tagExp, n, a.tagName)), this.addChild(t, l, n, i);
|
|
3195
3295
|
}
|
|
3196
3296
|
i = a.closeIndex + 1;
|
|
3197
3297
|
} else if (r.substr(i + 1, 3) === "!--") {
|
|
3198
|
-
const a =
|
|
3298
|
+
const a = le(r, "-->", i + 4, "Comment is not closed.");
|
|
3199
3299
|
if (this.options.commentPropName) {
|
|
3200
3300
|
const l = r.substring(i + 4, a - 2);
|
|
3201
3301
|
s = this.saveTextToParentTag(s, t, n), t.add(this.options.commentPropName, [{ [this.options.textNodeName]: l }]);
|
|
@@ -3205,53 +3305,53 @@ const Qr = function(r) {
|
|
|
3205
3305
|
const a = o.readDocType(r, i);
|
|
3206
3306
|
this.docTypeEntities = a.entities, i = a.i;
|
|
3207
3307
|
} else if (r.substr(i + 1, 2) === "![") {
|
|
3208
|
-
const a =
|
|
3308
|
+
const a = le(r, "]]>", i, "CDATA is not closed.") - 2, l = r.substring(i + 9, a);
|
|
3209
3309
|
s = this.saveTextToParentTag(s, t, n);
|
|
3210
|
-
let
|
|
3211
|
-
|
|
3310
|
+
let p = this.parseTextData(l, t.tagname, n, !0, !1, !0, !0);
|
|
3311
|
+
p == null && (p = ""), this.options.cdataPropName ? t.add(this.options.cdataPropName, [{ [this.options.textNodeName]: l }]) : t.add(this.options.textNodeName, p), i = a + 2;
|
|
3212
3312
|
} else {
|
|
3213
3313
|
let a = we(r, i, this.options.removeNSPrefix), l = a.tagName;
|
|
3214
|
-
const
|
|
3215
|
-
let
|
|
3314
|
+
const p = a.rawTagName;
|
|
3315
|
+
let h = a.tagExp, v = a.attrExpPresent, b = a.closeIndex;
|
|
3216
3316
|
this.options.transformTagName && (l = this.options.transformTagName(l)), t && s && t.tagname !== "!xml" && (s = this.saveTextToParentTag(s, t, n, !1));
|
|
3217
|
-
const
|
|
3218
|
-
|
|
3219
|
-
const
|
|
3317
|
+
const A = t;
|
|
3318
|
+
A && this.options.unpairedTags.indexOf(A.tagname) !== -1 && (t = this.tagsNodeStack.pop(), n = n.substring(0, n.lastIndexOf("."))), l !== e.tagname && (n += n ? "." + l : l);
|
|
3319
|
+
const P = i;
|
|
3220
3320
|
if (this.isItStopNode(this.options.stopNodes, n, l)) {
|
|
3221
|
-
let
|
|
3222
|
-
if (
|
|
3223
|
-
l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), n = n.substr(0, n.length - 1),
|
|
3321
|
+
let k = "";
|
|
3322
|
+
if (h.length > 0 && h.lastIndexOf("/") === h.length - 1)
|
|
3323
|
+
l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), n = n.substr(0, n.length - 1), h = l) : h = h.substr(0, h.length - 1), i = a.closeIndex;
|
|
3224
3324
|
else if (this.options.unpairedTags.indexOf(l) !== -1)
|
|
3225
3325
|
i = a.closeIndex;
|
|
3226
3326
|
else {
|
|
3227
|
-
const
|
|
3228
|
-
if (!
|
|
3229
|
-
i =
|
|
3327
|
+
const F = this.readStopNodeData(r, p, b + 1);
|
|
3328
|
+
if (!F) throw new Error(`Unexpected end of ${p}`);
|
|
3329
|
+
i = F.i, k = F.tagContent;
|
|
3230
3330
|
}
|
|
3231
|
-
const
|
|
3232
|
-
l !==
|
|
3331
|
+
const S = new ae(l);
|
|
3332
|
+
l !== h && v && (S[":@"] = this.buildAttributesMap(h, n, l)), k && (k = this.parseTextData(k, l, n, !0, v, !0, !0)), n = n.substr(0, n.lastIndexOf(".")), S.add(this.options.textNodeName, k), this.addChild(t, S, n, P);
|
|
3233
3333
|
} else {
|
|
3234
|
-
if (
|
|
3235
|
-
l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), n = n.substr(0, n.length - 1),
|
|
3236
|
-
const
|
|
3237
|
-
l !==
|
|
3334
|
+
if (h.length > 0 && h.lastIndexOf("/") === h.length - 1) {
|
|
3335
|
+
l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), n = n.substr(0, n.length - 1), h = l) : h = h.substr(0, h.length - 1), this.options.transformTagName && (l = this.options.transformTagName(l));
|
|
3336
|
+
const k = new ae(l);
|
|
3337
|
+
l !== h && v && (k[":@"] = this.buildAttributesMap(h, n, l)), this.addChild(t, k, n, P), n = n.substr(0, n.lastIndexOf("."));
|
|
3238
3338
|
} else {
|
|
3239
|
-
const
|
|
3240
|
-
this.tagsNodeStack.push(t), l !==
|
|
3339
|
+
const k = new ae(l);
|
|
3340
|
+
this.tagsNodeStack.push(t), l !== h && v && (k[":@"] = this.buildAttributesMap(h, n, l)), this.addChild(t, k, n, P), t = k;
|
|
3241
3341
|
}
|
|
3242
|
-
s = "", i =
|
|
3342
|
+
s = "", i = b;
|
|
3243
3343
|
}
|
|
3244
3344
|
}
|
|
3245
3345
|
else
|
|
3246
3346
|
s += r[i];
|
|
3247
3347
|
return e.child;
|
|
3248
3348
|
};
|
|
3249
|
-
function
|
|
3349
|
+
function Zr(r, e, t, s) {
|
|
3250
3350
|
this.options.captureMetaData || (s = void 0);
|
|
3251
3351
|
const n = this.options.updateTag(e.tagname, t, e[":@"]);
|
|
3252
3352
|
n === !1 || (typeof n == "string" && (e.tagname = n), r.addChild(e, s));
|
|
3253
3353
|
}
|
|
3254
|
-
const
|
|
3354
|
+
const zr = function(r) {
|
|
3255
3355
|
if (this.options.processEntities) {
|
|
3256
3356
|
for (let e in this.docTypeEntities) {
|
|
3257
3357
|
const t = this.docTypeEntities[e];
|
|
@@ -3270,7 +3370,7 @@ const Gr = function(r) {
|
|
|
3270
3370
|
}
|
|
3271
3371
|
return r;
|
|
3272
3372
|
};
|
|
3273
|
-
function
|
|
3373
|
+
function Dr(r, e, t, s) {
|
|
3274
3374
|
return r && (s === void 0 && (s = e.child.length === 0), r = this.parseTextData(
|
|
3275
3375
|
r,
|
|
3276
3376
|
e.tagname,
|
|
@@ -3280,7 +3380,7 @@ function Zr(r, e, t, s) {
|
|
|
3280
3380
|
s
|
|
3281
3381
|
), r !== void 0 && r !== "" && e.add(this.options.textNodeName, r), r = ""), r;
|
|
3282
3382
|
}
|
|
3283
|
-
function
|
|
3383
|
+
function Jr(r, e, t) {
|
|
3284
3384
|
const s = "*." + t;
|
|
3285
3385
|
for (const n in r) {
|
|
3286
3386
|
const o = r[n];
|
|
@@ -3288,7 +3388,7 @@ function zr(r, e, t) {
|
|
|
3288
3388
|
}
|
|
3289
3389
|
return !1;
|
|
3290
3390
|
}
|
|
3291
|
-
function
|
|
3391
|
+
function en(r, e, t = ">") {
|
|
3292
3392
|
let s, n = "";
|
|
3293
3393
|
for (let o = e; o < r.length; o++) {
|
|
3294
3394
|
let i = r[o];
|
|
@@ -3312,39 +3412,39 @@ function Dr(r, e, t = ">") {
|
|
|
3312
3412
|
n += i;
|
|
3313
3413
|
}
|
|
3314
3414
|
}
|
|
3315
|
-
function
|
|
3415
|
+
function le(r, e, t, s) {
|
|
3316
3416
|
const n = r.indexOf(e, t);
|
|
3317
3417
|
if (n === -1)
|
|
3318
3418
|
throw new Error(s);
|
|
3319
3419
|
return n + e.length - 1;
|
|
3320
3420
|
}
|
|
3321
3421
|
function we(r, e, t, s = ">") {
|
|
3322
|
-
const n =
|
|
3422
|
+
const n = en(r, e + 1, s);
|
|
3323
3423
|
if (!n) return;
|
|
3324
3424
|
let o = n.data;
|
|
3325
3425
|
const i = n.index, u = o.search(/\s/);
|
|
3326
3426
|
let a = o, l = !0;
|
|
3327
3427
|
u !== -1 && (a = o.substring(0, u), o = o.substring(u + 1).trimStart());
|
|
3328
|
-
const
|
|
3428
|
+
const p = a;
|
|
3329
3429
|
if (t) {
|
|
3330
|
-
const
|
|
3331
|
-
|
|
3430
|
+
const h = a.indexOf(":");
|
|
3431
|
+
h !== -1 && (a = a.substr(h + 1), l = a !== n.data.substr(h + 1));
|
|
3332
3432
|
}
|
|
3333
3433
|
return {
|
|
3334
3434
|
tagName: a,
|
|
3335
3435
|
tagExp: o,
|
|
3336
3436
|
closeIndex: i,
|
|
3337
3437
|
attrExpPresent: l,
|
|
3338
|
-
rawTagName:
|
|
3438
|
+
rawTagName: p
|
|
3339
3439
|
};
|
|
3340
3440
|
}
|
|
3341
|
-
function
|
|
3441
|
+
function tn(r, e, t) {
|
|
3342
3442
|
const s = t;
|
|
3343
3443
|
let n = 1;
|
|
3344
3444
|
for (; t < r.length; t++)
|
|
3345
3445
|
if (r[t] === "<")
|
|
3346
3446
|
if (r[t + 1] === "/") {
|
|
3347
|
-
const o =
|
|
3447
|
+
const o = le(r, ">", t, `${e} is not closed`);
|
|
3348
3448
|
if (r.substring(t + 2, o).trim() === e && (n--, n === 0))
|
|
3349
3449
|
return {
|
|
3350
3450
|
tagContent: r.substring(s, t),
|
|
@@ -3352,11 +3452,11 @@ function Jr(r, e, t) {
|
|
|
3352
3452
|
};
|
|
3353
3453
|
t = o;
|
|
3354
3454
|
} else if (r[t + 1] === "?")
|
|
3355
|
-
t =
|
|
3455
|
+
t = le(r, "?>", t + 1, "StopNode is not closed.");
|
|
3356
3456
|
else if (r.substr(t + 1, 3) === "!--")
|
|
3357
|
-
t =
|
|
3457
|
+
t = le(r, "-->", t + 3, "StopNode is not closed.");
|
|
3358
3458
|
else if (r.substr(t + 1, 2) === "![")
|
|
3359
|
-
t =
|
|
3459
|
+
t = le(r, "]]>", t, "StopNode is not closed.") - 2;
|
|
3360
3460
|
else {
|
|
3361
3461
|
const o = we(r, t, ">");
|
|
3362
3462
|
o && ((o && o.tagName) === e && o.tagExp[o.tagExp.length - 1] !== "/" && n++, t = o.closeIndex);
|
|
@@ -3365,19 +3465,19 @@ function Jr(r, e, t) {
|
|
|
3365
3465
|
function Ce(r, e, t) {
|
|
3366
3466
|
if (e && typeof r == "string") {
|
|
3367
3467
|
const s = r.trim();
|
|
3368
|
-
return s === "true" ? !0 : s === "false" ? !1 :
|
|
3468
|
+
return s === "true" ? !0 : s === "false" ? !1 : Rr(r, t);
|
|
3369
3469
|
} else
|
|
3370
|
-
return
|
|
3470
|
+
return xr(r) ? r : "";
|
|
3371
3471
|
}
|
|
3372
|
-
const
|
|
3373
|
-
function
|
|
3374
|
-
return
|
|
3472
|
+
const Ne = ae.getMetaDataSymbol();
|
|
3473
|
+
function rn(r, e) {
|
|
3474
|
+
return Ye(r, e);
|
|
3375
3475
|
}
|
|
3376
|
-
function
|
|
3476
|
+
function Ye(r, e, t) {
|
|
3377
3477
|
let s;
|
|
3378
3478
|
const n = {};
|
|
3379
3479
|
for (let o = 0; o < r.length; o++) {
|
|
3380
|
-
const i = r[o], u =
|
|
3480
|
+
const i = r[o], u = nn(i);
|
|
3381
3481
|
let a = "";
|
|
3382
3482
|
if (t === void 0 ? a = u : a = t + "." + u, u === e.textNodeName)
|
|
3383
3483
|
s === void 0 ? s = i[u] : s += "" + i[u];
|
|
@@ -3385,22 +3485,22 @@ function Ge(r, e, t) {
|
|
|
3385
3485
|
if (u === void 0)
|
|
3386
3486
|
continue;
|
|
3387
3487
|
if (i[u]) {
|
|
3388
|
-
let l =
|
|
3389
|
-
const
|
|
3390
|
-
i[
|
|
3488
|
+
let l = Ye(i[u], e, a);
|
|
3489
|
+
const p = on(l, e);
|
|
3490
|
+
i[Ne] !== void 0 && (l[Ne] = i[Ne]), i[":@"] ? sn(l, i[":@"], a, e) : Object.keys(l).length === 1 && l[e.textNodeName] !== void 0 && !e.alwaysCreateTextNode ? l = l[e.textNodeName] : Object.keys(l).length === 0 && (e.alwaysCreateTextNode ? l[e.textNodeName] = "" : l = ""), n[u] !== void 0 && n.hasOwnProperty(u) ? (Array.isArray(n[u]) || (n[u] = [n[u]]), n[u].push(l)) : e.isArray(u, a, p) ? n[u] = [l] : n[u] = l;
|
|
3391
3491
|
}
|
|
3392
3492
|
}
|
|
3393
3493
|
}
|
|
3394
3494
|
return typeof s == "string" ? s.length > 0 && (n[e.textNodeName] = s) : s !== void 0 && (n[e.textNodeName] = s), n;
|
|
3395
3495
|
}
|
|
3396
|
-
function
|
|
3496
|
+
function nn(r) {
|
|
3397
3497
|
const e = Object.keys(r);
|
|
3398
3498
|
for (let t = 0; t < e.length; t++) {
|
|
3399
3499
|
const s = e[t];
|
|
3400
3500
|
if (s !== ":@") return s;
|
|
3401
3501
|
}
|
|
3402
3502
|
}
|
|
3403
|
-
function
|
|
3503
|
+
function sn(r, e, t, s) {
|
|
3404
3504
|
if (e) {
|
|
3405
3505
|
const n = Object.keys(e), o = n.length;
|
|
3406
3506
|
for (let i = 0; i < o; i++) {
|
|
@@ -3409,13 +3509,13 @@ function rn(r, e, t, s) {
|
|
|
3409
3509
|
}
|
|
3410
3510
|
}
|
|
3411
3511
|
}
|
|
3412
|
-
function
|
|
3512
|
+
function on(r, e) {
|
|
3413
3513
|
const { textNodeName: t } = e, s = Object.keys(r).length;
|
|
3414
3514
|
return !!(s === 0 || s === 1 && (r[t] || typeof r[t] == "boolean" || r[t] === 0));
|
|
3415
3515
|
}
|
|
3416
|
-
class
|
|
3516
|
+
class an {
|
|
3417
3517
|
constructor(e) {
|
|
3418
|
-
this.externalEntities = {}, this.options =
|
|
3518
|
+
this.externalEntities = {}, this.options = Br(e);
|
|
3419
3519
|
}
|
|
3420
3520
|
/**
|
|
3421
3521
|
* Parse XML dats to JS object
|
|
@@ -3433,10 +3533,10 @@ class sn {
|
|
|
3433
3533
|
if (o !== !0)
|
|
3434
3534
|
throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`);
|
|
3435
3535
|
}
|
|
3436
|
-
const s = new
|
|
3536
|
+
const s = new Hr(this.options);
|
|
3437
3537
|
s.addExternalEntities(this.externalEntities);
|
|
3438
3538
|
const n = s.parseXml(e);
|
|
3439
|
-
return this.options.preserveOrder || n === void 0 ? n :
|
|
3539
|
+
return this.options.preserveOrder || n === void 0 ? n : rn(n, this.options);
|
|
3440
3540
|
}
|
|
3441
3541
|
/**
|
|
3442
3542
|
* Add Entity which is not by default supported by this library
|
|
@@ -3463,24 +3563,24 @@ class sn {
|
|
|
3463
3563
|
* is true in the options.
|
|
3464
3564
|
*/
|
|
3465
3565
|
static getMetaDataSymbol() {
|
|
3466
|
-
return
|
|
3566
|
+
return ae.getMetaDataSymbol();
|
|
3467
3567
|
}
|
|
3468
3568
|
}
|
|
3469
|
-
const
|
|
3569
|
+
const ln = `
|
|
3470
3570
|
`;
|
|
3471
|
-
function
|
|
3571
|
+
function un(r, e) {
|
|
3472
3572
|
let t = "";
|
|
3473
|
-
return e.format && e.indentBy.length > 0 && (t =
|
|
3573
|
+
return e.format && e.indentBy.length > 0 && (t = ln), Ge(r, e, "", t);
|
|
3474
3574
|
}
|
|
3475
|
-
function
|
|
3575
|
+
function Ge(r, e, t, s) {
|
|
3476
3576
|
let n = "", o = !1;
|
|
3477
3577
|
for (let i = 0; i < r.length; i++) {
|
|
3478
|
-
const u = r[i], a =
|
|
3578
|
+
const u = r[i], a = cn(u);
|
|
3479
3579
|
if (a === void 0) continue;
|
|
3480
3580
|
let l = "";
|
|
3481
3581
|
if (t.length === 0 ? l = a : l = `${t}.${a}`, a === e.textNodeName) {
|
|
3482
|
-
let
|
|
3483
|
-
|
|
3582
|
+
let A = u[a];
|
|
3583
|
+
dn(l, e) || (A = e.tagValueProcessor(a, A), A = Ze(A, e)), o && (n += s), n += A, o = !1;
|
|
3484
3584
|
continue;
|
|
3485
3585
|
} else if (a === e.cdataPropName) {
|
|
3486
3586
|
o && (n += s), n += `<![CDATA[${u[a][0][e.textNodeName]}]]>`, o = !1;
|
|
@@ -3489,19 +3589,19 @@ function Ze(r, e, t, s) {
|
|
|
3489
3589
|
n += s + `<!--${u[a][0][e.textNodeName]}-->`, o = !0;
|
|
3490
3590
|
continue;
|
|
3491
3591
|
} else if (a[0] === "?") {
|
|
3492
|
-
const
|
|
3493
|
-
let
|
|
3494
|
-
|
|
3592
|
+
const A = Re(u[":@"], e), P = a === "?xml" ? "" : s;
|
|
3593
|
+
let k = u[a][0][e.textNodeName];
|
|
3594
|
+
k = k.length !== 0 ? " " + k : "", n += P + `<${a}${k}${A}?>`, o = !0;
|
|
3495
3595
|
continue;
|
|
3496
3596
|
}
|
|
3497
|
-
let
|
|
3498
|
-
|
|
3499
|
-
const
|
|
3500
|
-
e.unpairedTags.indexOf(a) !== -1 ? e.suppressUnpairedNode ? n +=
|
|
3597
|
+
let p = s;
|
|
3598
|
+
p !== "" && (p += e.indentBy);
|
|
3599
|
+
const h = Re(u[":@"], e), v = s + `<${a}${h}`, b = Ge(u[a], e, l, p);
|
|
3600
|
+
e.unpairedTags.indexOf(a) !== -1 ? e.suppressUnpairedNode ? n += v + ">" : n += v + "/>" : (!b || b.length === 0) && e.suppressEmptyNode ? n += v + "/>" : b && b.endsWith(">") ? n += v + `>${b}${s}</${a}>` : (n += v + ">", b && s !== "" && (b.includes("/>") || b.includes("</")) ? n += s + e.indentBy + b + s : n += b, n += `</${a}>`), o = !0;
|
|
3501
3601
|
}
|
|
3502
3602
|
return n;
|
|
3503
3603
|
}
|
|
3504
|
-
function
|
|
3604
|
+
function cn(r) {
|
|
3505
3605
|
const e = Object.keys(r);
|
|
3506
3606
|
for (let t = 0; t < e.length; t++) {
|
|
3507
3607
|
const s = e[t];
|
|
@@ -3509,24 +3609,24 @@ function ln(r) {
|
|
|
3509
3609
|
return s;
|
|
3510
3610
|
}
|
|
3511
3611
|
}
|
|
3512
|
-
function
|
|
3612
|
+
function Re(r, e) {
|
|
3513
3613
|
let t = "";
|
|
3514
3614
|
if (r && !e.ignoreAttributes)
|
|
3515
3615
|
for (let s in r) {
|
|
3516
3616
|
if (!r.hasOwnProperty(s)) continue;
|
|
3517
3617
|
let n = e.attributeValueProcessor(s, r[s]);
|
|
3518
|
-
n =
|
|
3618
|
+
n = Ze(n, e), n === !0 && e.suppressBooleanAttributes ? t += ` ${s.substr(e.attributeNamePrefix.length)}` : t += ` ${s.substr(e.attributeNamePrefix.length)}="${n}"`;
|
|
3519
3619
|
}
|
|
3520
3620
|
return t;
|
|
3521
3621
|
}
|
|
3522
|
-
function
|
|
3622
|
+
function dn(r, e) {
|
|
3523
3623
|
r = r.substr(0, r.length - e.textNodeName.length - 1);
|
|
3524
3624
|
let t = r.substr(r.lastIndexOf(".") + 1);
|
|
3525
3625
|
for (let s in e.stopNodes)
|
|
3526
3626
|
if (e.stopNodes[s] === r || e.stopNodes[s] === "*." + t) return !0;
|
|
3527
3627
|
return !1;
|
|
3528
3628
|
}
|
|
3529
|
-
function
|
|
3629
|
+
function Ze(r, e) {
|
|
3530
3630
|
if (r && r.length > 0 && e.processEntities)
|
|
3531
3631
|
for (let t = 0; t < e.entities.length; t++) {
|
|
3532
3632
|
const s = e.entities[t];
|
|
@@ -3534,7 +3634,7 @@ function ze(r, e) {
|
|
|
3534
3634
|
}
|
|
3535
3635
|
return r;
|
|
3536
3636
|
}
|
|
3537
|
-
const
|
|
3637
|
+
const fn = {
|
|
3538
3638
|
attributeNamePrefix: "@_",
|
|
3539
3639
|
attributesGroupName: !1,
|
|
3540
3640
|
textNodeName: "#text",
|
|
@@ -3568,21 +3668,21 @@ const cn = {
|
|
|
3568
3668
|
// transformAttributeName: false,
|
|
3569
3669
|
oneListGroup: !1
|
|
3570
3670
|
};
|
|
3571
|
-
function
|
|
3572
|
-
this.options = Object.assign({},
|
|
3671
|
+
function se(r) {
|
|
3672
|
+
this.options = Object.assign({}, fn, r), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
|
|
3573
3673
|
return !1;
|
|
3574
|
-
} : (this.ignoreAttributesFn = We(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute =
|
|
3674
|
+
} : (this.ignoreAttributesFn = We(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = gn), this.processTextOrObjNode = hn, this.options.format ? (this.indentate = pn, this.tagEndChar = `>
|
|
3575
3675
|
`, this.newLine = `
|
|
3576
3676
|
`) : (this.indentate = function() {
|
|
3577
3677
|
return "";
|
|
3578
3678
|
}, this.tagEndChar = ">", this.newLine = "");
|
|
3579
3679
|
}
|
|
3580
|
-
|
|
3581
|
-
return this.options.preserveOrder ?
|
|
3680
|
+
se.prototype.build = function(r) {
|
|
3681
|
+
return this.options.preserveOrder ? un(r, this.options) : (Array.isArray(r) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (r = {
|
|
3582
3682
|
[this.options.arrayNodeName]: r
|
|
3583
3683
|
}), this.j2x(r, 0, []).val);
|
|
3584
3684
|
};
|
|
3585
|
-
|
|
3685
|
+
se.prototype.j2x = function(r, e, t) {
|
|
3586
3686
|
let s = "", n = "";
|
|
3587
3687
|
const o = t.join(".");
|
|
3588
3688
|
for (let i in r)
|
|
@@ -3606,21 +3706,21 @@ ne.prototype.j2x = function(r, e, t) {
|
|
|
3606
3706
|
} else if (Array.isArray(r[i])) {
|
|
3607
3707
|
const u = r[i].length;
|
|
3608
3708
|
let a = "", l = "";
|
|
3609
|
-
for (let
|
|
3610
|
-
const
|
|
3611
|
-
if (!(typeof
|
|
3709
|
+
for (let p = 0; p < u; p++) {
|
|
3710
|
+
const h = r[i][p];
|
|
3711
|
+
if (!(typeof h > "u")) if (h === null)
|
|
3612
3712
|
i[0] === "?" ? n += this.indentate(e) + "<" + i + "?" + this.tagEndChar : n += this.indentate(e) + "<" + i + "/" + this.tagEndChar;
|
|
3613
|
-
else if (typeof
|
|
3713
|
+
else if (typeof h == "object")
|
|
3614
3714
|
if (this.options.oneListGroup) {
|
|
3615
|
-
const
|
|
3616
|
-
a +=
|
|
3715
|
+
const v = this.j2x(h, e + 1, t.concat(i));
|
|
3716
|
+
a += v.val, this.options.attributesGroupName && h.hasOwnProperty(this.options.attributesGroupName) && (l += v.attrStr);
|
|
3617
3717
|
} else
|
|
3618
|
-
a += this.processTextOrObjNode(
|
|
3718
|
+
a += this.processTextOrObjNode(h, i, e, t);
|
|
3619
3719
|
else if (this.options.oneListGroup) {
|
|
3620
|
-
let
|
|
3621
|
-
|
|
3720
|
+
let v = this.options.tagValueProcessor(i, h);
|
|
3721
|
+
v = this.replaceEntitiesValue(v), a += v;
|
|
3622
3722
|
} else
|
|
3623
|
-
a += this.buildTextValNode(
|
|
3723
|
+
a += this.buildTextValNode(h, i, "", e);
|
|
3624
3724
|
}
|
|
3625
3725
|
this.options.oneListGroup && (a = this.buildObjectNode(a, i, l, e)), n += a;
|
|
3626
3726
|
} else if (this.options.attributesGroupName && i === this.options.attributesGroupName) {
|
|
@@ -3631,14 +3731,14 @@ ne.prototype.j2x = function(r, e, t) {
|
|
|
3631
3731
|
n += this.processTextOrObjNode(r[i], i, e, t);
|
|
3632
3732
|
return { attrStr: s, val: n };
|
|
3633
3733
|
};
|
|
3634
|
-
|
|
3734
|
+
se.prototype.buildAttrPairStr = function(r, e) {
|
|
3635
3735
|
return e = this.options.attributeValueProcessor(r, "" + e), e = this.replaceEntitiesValue(e), this.options.suppressBooleanAttributes && e === "true" ? " " + r : " " + r + '="' + e + '"';
|
|
3636
3736
|
};
|
|
3637
|
-
function
|
|
3737
|
+
function hn(r, e, t, s) {
|
|
3638
3738
|
const n = this.j2x(r, t + 1, s.concat(e));
|
|
3639
3739
|
return r[this.options.textNodeName] !== void 0 && Object.keys(r).length === 1 ? this.buildTextValNode(r[this.options.textNodeName], e, n.attrStr, t) : this.buildObjectNode(n.val, e, n.attrStr, t);
|
|
3640
3740
|
}
|
|
3641
|
-
|
|
3741
|
+
se.prototype.buildObjectNode = function(r, e, t, s) {
|
|
3642
3742
|
if (r === "")
|
|
3643
3743
|
return e[0] === "?" ? this.indentate(s) + "<" + e + t + "?" + this.tagEndChar : this.indentate(s) + "<" + e + t + this.closeTag(e) + this.tagEndChar;
|
|
3644
3744
|
{
|
|
@@ -3646,11 +3746,11 @@ ne.prototype.buildObjectNode = function(r, e, t, s) {
|
|
|
3646
3746
|
return e[0] === "?" && (o = "?", n = ""), (t || t === "") && r.indexOf("<") === -1 ? this.indentate(s) + "<" + e + t + o + ">" + r + n : this.options.commentPropName !== !1 && e === this.options.commentPropName && o.length === 0 ? this.indentate(s) + `<!--${r}-->` + this.newLine : this.indentate(s) + "<" + e + t + o + this.tagEndChar + r + this.indentate(s) + n;
|
|
3647
3747
|
}
|
|
3648
3748
|
};
|
|
3649
|
-
|
|
3749
|
+
se.prototype.closeTag = function(r) {
|
|
3650
3750
|
let e = "";
|
|
3651
3751
|
return this.options.unpairedTags.indexOf(r) !== -1 ? this.options.suppressUnpairedNode || (e = "/") : this.options.suppressEmptyNode ? e = "/" : e = `></${r}`, e;
|
|
3652
3752
|
};
|
|
3653
|
-
|
|
3753
|
+
se.prototype.buildTextValNode = function(r, e, t, s) {
|
|
3654
3754
|
if (this.options.cdataPropName !== !1 && e === this.options.cdataPropName)
|
|
3655
3755
|
return this.indentate(s) + `<![CDATA[${r}]]>` + this.newLine;
|
|
3656
3756
|
if (this.options.commentPropName !== !1 && e === this.options.commentPropName)
|
|
@@ -3662,7 +3762,7 @@ ne.prototype.buildTextValNode = function(r, e, t, s) {
|
|
|
3662
3762
|
return n = this.replaceEntitiesValue(n), n === "" ? this.indentate(s) + "<" + e + t + this.closeTag(e) + this.tagEndChar : this.indentate(s) + "<" + e + t + ">" + n + "</" + e + this.tagEndChar;
|
|
3663
3763
|
}
|
|
3664
3764
|
};
|
|
3665
|
-
|
|
3765
|
+
se.prototype.replaceEntitiesValue = function(r) {
|
|
3666
3766
|
if (r && r.length > 0 && this.options.processEntities)
|
|
3667
3767
|
for (let e = 0; e < this.options.entities.length; e++) {
|
|
3668
3768
|
const t = this.options.entities[e];
|
|
@@ -3670,15 +3770,15 @@ ne.prototype.replaceEntitiesValue = function(r) {
|
|
|
3670
3770
|
}
|
|
3671
3771
|
return r;
|
|
3672
3772
|
};
|
|
3673
|
-
function
|
|
3773
|
+
function pn(r) {
|
|
3674
3774
|
return this.options.indentBy.repeat(r);
|
|
3675
3775
|
}
|
|
3676
|
-
function
|
|
3776
|
+
function gn(r) {
|
|
3677
3777
|
return r.startsWith(this.options.attributeNamePrefix) && r !== this.options.textNodeName ? r.substr(this.attrPrefixLen) : !1;
|
|
3678
3778
|
}
|
|
3679
|
-
const
|
|
3779
|
+
const mn = {
|
|
3680
3780
|
validate: Qe
|
|
3681
|
-
},
|
|
3781
|
+
}, yn = {
|
|
3682
3782
|
ignoreAttributes: !1,
|
|
3683
3783
|
// 保留属性
|
|
3684
3784
|
attributeNamePrefix: "@_",
|
|
@@ -3713,7 +3813,7 @@ const pn = {
|
|
|
3713
3813
|
// 停止解析的节点
|
|
3714
3814
|
alwaysCreateTextNode: !1
|
|
3715
3815
|
// 仅在有文本时创建文本节点
|
|
3716
|
-
},
|
|
3816
|
+
}, bn = {
|
|
3717
3817
|
ignoreAttributes: !1,
|
|
3718
3818
|
attributeNamePrefix: "@_",
|
|
3719
3819
|
textNodeName: "#text",
|
|
@@ -3725,9 +3825,9 @@ const pn = {
|
|
|
3725
3825
|
// 不抑制空节点
|
|
3726
3826
|
suppressBooleanAttributes: !1,
|
|
3727
3827
|
suppressUnpairedNode: !1
|
|
3728
|
-
},
|
|
3828
|
+
}, vn = (r) => {
|
|
3729
3829
|
try {
|
|
3730
|
-
const e =
|
|
3830
|
+
const e = mn.validate(r, {
|
|
3731
3831
|
allowBooleanAttributes: !0
|
|
3732
3832
|
});
|
|
3733
3833
|
return e === !0 ? { valid: !0 } : {
|
|
@@ -3740,10 +3840,10 @@ const pn = {
|
|
|
3740
3840
|
error: e instanceof Error ? e.message : "Unknown validation error"
|
|
3741
3841
|
};
|
|
3742
3842
|
}
|
|
3743
|
-
},
|
|
3843
|
+
}, ze = (r, e) => {
|
|
3744
3844
|
try {
|
|
3745
|
-
return new
|
|
3746
|
-
...
|
|
3845
|
+
return new an({
|
|
3846
|
+
...yn,
|
|
3747
3847
|
...e
|
|
3748
3848
|
}).parse(r);
|
|
3749
3849
|
} catch (t) {
|
|
@@ -3753,8 +3853,8 @@ const pn = {
|
|
|
3753
3853
|
}
|
|
3754
3854
|
}, Pe = (r, e) => {
|
|
3755
3855
|
try {
|
|
3756
|
-
let s = new
|
|
3757
|
-
...
|
|
3856
|
+
let s = new se({
|
|
3857
|
+
...bn,
|
|
3758
3858
|
format: e?.format ?? !0,
|
|
3759
3859
|
indentBy: e?.indentBy ?? " "
|
|
3760
3860
|
}).build(r);
|
|
@@ -3765,66 +3865,66 @@ const pn = {
|
|
|
3765
3865
|
`XML 构建失败: ${t instanceof Error ? t.message : "Unknown error"}`
|
|
3766
3866
|
);
|
|
3767
3867
|
}
|
|
3768
|
-
},
|
|
3769
|
-
const t =
|
|
3770
|
-
return Array.isArray(t) ?
|
|
3868
|
+
}, _n = (r) => Array.isArray(r) ? _e(r, { format: !1 }) : Pe(r, { format: !1, showDeclaration: !1 }), En = (r, e) => {
|
|
3869
|
+
const t = ze(r);
|
|
3870
|
+
return Array.isArray(t) ? _e(t, {
|
|
3771
3871
|
indent: e?.indentBy
|
|
3772
3872
|
}) : Pe(t, e);
|
|
3773
|
-
},
|
|
3873
|
+
}, _e = (r, e = {}) => {
|
|
3774
3874
|
const t = e.indent !== void 0 ? e.indent : " ", s = e.level || 0, n = e.format !== !1, o = n ? t.repeat(s) : "", i = n ? `
|
|
3775
3875
|
` : "";
|
|
3776
3876
|
let u = "";
|
|
3777
3877
|
for (const a of r) {
|
|
3778
3878
|
if (a["?xml"]) {
|
|
3779
|
-
const
|
|
3780
|
-
u += `<?xml ${
|
|
3879
|
+
const k = a[":@"] || {}, S = Object.entries(k).map(([F, Z]) => `${F.startsWith("@_") ? F.substring(2) : F}="${Z}"`).join(" ");
|
|
3880
|
+
u += `<?xml ${S}?>${i}`;
|
|
3781
3881
|
continue;
|
|
3782
3882
|
}
|
|
3783
3883
|
if (a["#comment"]) {
|
|
3784
|
-
const
|
|
3785
|
-
if (Array.isArray(
|
|
3786
|
-
const
|
|
3787
|
-
u += `${o}<!--${
|
|
3884
|
+
const k = a["#comment"];
|
|
3885
|
+
if (Array.isArray(k) && k.length > 0) {
|
|
3886
|
+
const S = k[0]["#text"] || k[0];
|
|
3887
|
+
u += `${o}<!--${S}-->${i}`;
|
|
3788
3888
|
}
|
|
3789
3889
|
continue;
|
|
3790
3890
|
}
|
|
3791
|
-
const l = Object.keys(a).find((
|
|
3891
|
+
const l = Object.keys(a).find((k) => !k.startsWith(":") && !k.startsWith("#") && !k.startsWith("__"));
|
|
3792
3892
|
if (!l) continue;
|
|
3793
|
-
const
|
|
3794
|
-
if (!Array.isArray(
|
|
3795
|
-
u += `${o}<${l}${
|
|
3893
|
+
const p = a[l], h = a[":@"] || {}, v = Object.entries(h).map(([k, S]) => `${k.startsWith("@_") ? k.substring(2) : k}="${S}"`).join(" "), b = v ? " " + v : "";
|
|
3894
|
+
if (!Array.isArray(p) || p.length === 0) {
|
|
3895
|
+
u += `${o}<${l}${b}/>${i}`;
|
|
3796
3896
|
continue;
|
|
3797
3897
|
}
|
|
3798
|
-
const
|
|
3799
|
-
if (
|
|
3800
|
-
const
|
|
3801
|
-
if (
|
|
3802
|
-
const
|
|
3803
|
-
u += `${o}<${l}${
|
|
3898
|
+
const A = p.length === 1 && p[0]["#text"] !== void 0;
|
|
3899
|
+
if (p.some((k) => k.__cdata)) {
|
|
3900
|
+
const k = p.find((S) => S.__cdata);
|
|
3901
|
+
if (k) {
|
|
3902
|
+
const S = k.__cdata[0]["#text"] || "";
|
|
3903
|
+
u += `${o}<${l}${b}><![CDATA[${S}]]></${l}>${i}`;
|
|
3804
3904
|
}
|
|
3805
|
-
} else if (
|
|
3806
|
-
const
|
|
3807
|
-
u += `${o}<${l}${
|
|
3905
|
+
} else if (A) {
|
|
3906
|
+
const k = p[0]["#text"];
|
|
3907
|
+
u += `${o}<${l}${b}>${k}</${l}>${i}`;
|
|
3808
3908
|
} else
|
|
3809
|
-
u += `${o}<${l}${
|
|
3909
|
+
u += `${o}<${l}${b}>${i}`, u += _e(p, { indent: t, level: s + 1, format: n }), u += `${o}</${l}>${i}`;
|
|
3810
3910
|
}
|
|
3811
3911
|
return u;
|
|
3812
|
-
},
|
|
3912
|
+
}, xn = {
|
|
3813
3913
|
key: 0,
|
|
3814
3914
|
class: "xml-format__toolbar"
|
|
3815
|
-
},
|
|
3915
|
+
}, kn = { class: "xml-format__actions" }, Nn = ["disabled"], An = ["disabled"], wn = ["disabled"], Cn = ["disabled"], On = ["disabled"], Tn = { class: "xml-format__info" }, Pn = {
|
|
3816
3916
|
key: 0,
|
|
3817
3917
|
class: "xml-format__status xml-format__status--success"
|
|
3818
|
-
},
|
|
3918
|
+
}, $n = {
|
|
3819
3919
|
key: 1,
|
|
3820
3920
|
class: "xml-format__status xml-format__status--error"
|
|
3821
|
-
},
|
|
3921
|
+
}, Sn = { class: "xml-format__content" }, Bn = {
|
|
3822
3922
|
key: 0,
|
|
3823
3923
|
class: "xml-format__error"
|
|
3824
|
-
},
|
|
3924
|
+
}, In = {
|
|
3825
3925
|
key: 1,
|
|
3826
3926
|
class: "xml-format__viewer"
|
|
3827
|
-
},
|
|
3927
|
+
}, Vn = /* @__PURE__ */ ye({
|
|
3828
3928
|
__name: "index",
|
|
3829
3929
|
props: {
|
|
3830
3930
|
modelValue: { default: "" },
|
|
@@ -3838,7 +3938,7 @@ const pn = {
|
|
|
3838
3938
|
},
|
|
3839
3939
|
emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress", "format"],
|
|
3840
3940
|
setup(r, { expose: e, emit: t }) {
|
|
3841
|
-
Oe((
|
|
3941
|
+
Oe((m) => ({
|
|
3842
3942
|
"0db40539": l.value.colors.border,
|
|
3843
3943
|
bd72d08a: l.value.colors.background,
|
|
3844
3944
|
"1738b57a": l.value.colors.text,
|
|
@@ -3854,182 +3954,182 @@ const pn = {
|
|
|
3854
3954
|
"61df294a": l.value.colors.error,
|
|
3855
3955
|
"3307322e": l.value.colors.errorBackground
|
|
3856
3956
|
}));
|
|
3857
|
-
const s = r, n = t, o =
|
|
3957
|
+
const s = r, n = t, o = Y(null), i = Y(""), u = Y(/* @__PURE__ */ new Set()), a = V(() => i.value === ""), l = V(() => br(s.theme)), p = V(() => !o.value || !Array.isArray(o.value) ? [] : o.value.filter((m) => !m["?xml"])), h = V(() => {
|
|
3858
3958
|
if (!o.value || !Array.isArray(o.value)) return null;
|
|
3859
|
-
const
|
|
3860
|
-
if (!
|
|
3861
|
-
const O =
|
|
3862
|
-
return O["@_version"] &&
|
|
3863
|
-
}),
|
|
3864
|
-
if (!
|
|
3959
|
+
const m = o.value.find((j) => j["?xml"]);
|
|
3960
|
+
if (!m || !m[":@"]) return null;
|
|
3961
|
+
const O = m[":@"], $ = [];
|
|
3962
|
+
return O["@_version"] && $.push(`version="${O["@_version"]}"`), O["@_encoding"] && $.push(`encoding="${O["@_encoding"]}"`), O["@_standalone"] && $.push(`standalone="${O["@_standalone"]}"`), $.length > 0 ? `<?xml ${$.join(" ")}?>` : null;
|
|
3963
|
+
}), v = V(() => p.value), b = (m) => {
|
|
3964
|
+
if (!m || !m.trim()) {
|
|
3865
3965
|
i.value = "", o.value = null;
|
|
3866
3966
|
return;
|
|
3867
3967
|
}
|
|
3868
3968
|
try {
|
|
3869
|
-
const O =
|
|
3969
|
+
const O = vn(m);
|
|
3870
3970
|
if (!O.valid) {
|
|
3871
3971
|
i.value = O.error || "Invalid XML", o.value = null;
|
|
3872
3972
|
return;
|
|
3873
3973
|
}
|
|
3874
|
-
o.value =
|
|
3875
|
-
|
|
3974
|
+
o.value = ze(m), i.value = "", he(() => {
|
|
3975
|
+
P();
|
|
3876
3976
|
});
|
|
3877
3977
|
} catch (O) {
|
|
3878
3978
|
i.value = O instanceof Error ? O.message : "Unknown parse error", o.value = null;
|
|
3879
3979
|
}
|
|
3880
|
-
},
|
|
3881
|
-
u.value.has(
|
|
3882
|
-
},
|
|
3883
|
-
const
|
|
3884
|
-
Array.isArray(
|
|
3885
|
-
const
|
|
3886
|
-
if (!
|
|
3887
|
-
const ee =
|
|
3888
|
-
|
|
3889
|
-
const
|
|
3890
|
-
Array.isArray(
|
|
3980
|
+
}, A = (m) => {
|
|
3981
|
+
u.value.has(m) ? u.value.delete(m) : u.value.add(m);
|
|
3982
|
+
}, P = () => {
|
|
3983
|
+
const m = /* @__PURE__ */ new Set(), O = ($, j = "") => {
|
|
3984
|
+
Array.isArray($) && $.forEach((H, G) => {
|
|
3985
|
+
const K = Object.keys(H).find((ue) => !ue.startsWith(":") && !ue.startsWith("#"));
|
|
3986
|
+
if (!K) return;
|
|
3987
|
+
const ee = j ? `${j}[${G}]` : `${K}[${G}]`;
|
|
3988
|
+
m.add(ee);
|
|
3989
|
+
const te = H[K];
|
|
3990
|
+
Array.isArray(te) && O(te, ee + "." + K);
|
|
3891
3991
|
});
|
|
3892
3992
|
};
|
|
3893
|
-
|
|
3894
|
-
const
|
|
3895
|
-
if (
|
|
3896
|
-
const
|
|
3897
|
-
|
|
3898
|
-
const
|
|
3899
|
-
Array.isArray(
|
|
3993
|
+
p.value.forEach(($, j) => {
|
|
3994
|
+
const H = Object.keys($).find((G) => !G.startsWith(":") && !G.startsWith("#"));
|
|
3995
|
+
if (H) {
|
|
3996
|
+
const G = `${H}[${j}]`;
|
|
3997
|
+
m.add(G);
|
|
3998
|
+
const K = $[H];
|
|
3999
|
+
Array.isArray(K) && O(K, G + "." + H);
|
|
3900
4000
|
}
|
|
3901
|
-
}), u.value =
|
|
3902
|
-
},
|
|
4001
|
+
}), u.value = m, n("expand-all");
|
|
4002
|
+
}, k = () => {
|
|
3903
4003
|
u.value.clear(), n("collapse-all");
|
|
3904
|
-
},
|
|
4004
|
+
}, S = async () => {
|
|
3905
4005
|
if (!(!a.value || !o.value))
|
|
3906
4006
|
try {
|
|
3907
|
-
const
|
|
3908
|
-
await navigator.clipboard.writeText(
|
|
3909
|
-
} catch (
|
|
3910
|
-
const O =
|
|
3911
|
-
n("copy-error", O), console.error("Failed to copy XML:",
|
|
4007
|
+
const m = Array.isArray(o.value) ? _e(o.value, { indent: " " }) : Pe(o.value, { format: !0, indentBy: " " });
|
|
4008
|
+
await navigator.clipboard.writeText(m), n("copy-success", m);
|
|
4009
|
+
} catch (m) {
|
|
4010
|
+
const O = m instanceof Error ? m : new Error("Copy failed");
|
|
4011
|
+
n("copy-error", O), console.error("Failed to copy XML:", m);
|
|
3912
4012
|
}
|
|
3913
|
-
},
|
|
4013
|
+
}, F = () => {
|
|
3914
4014
|
if (!(!a.value || !o.value))
|
|
3915
4015
|
try {
|
|
3916
|
-
const
|
|
3917
|
-
n("update:modelValue",
|
|
3918
|
-
} catch (
|
|
3919
|
-
console.error("Failed to compress XML:",
|
|
4016
|
+
const m = _n(o.value);
|
|
4017
|
+
n("update:modelValue", m), n("compress", m);
|
|
4018
|
+
} catch (m) {
|
|
4019
|
+
console.error("Failed to compress XML:", m);
|
|
3920
4020
|
}
|
|
3921
|
-
},
|
|
4021
|
+
}, Z = () => {
|
|
3922
4022
|
if (a.value)
|
|
3923
4023
|
try {
|
|
3924
|
-
const
|
|
4024
|
+
const m = En(s.modelValue, {
|
|
3925
4025
|
format: !0,
|
|
3926
4026
|
indentBy: " "
|
|
3927
4027
|
});
|
|
3928
|
-
n("update:modelValue",
|
|
3929
|
-
} catch (
|
|
3930
|
-
console.error("Failed to format XML:",
|
|
4028
|
+
n("update:modelValue", m), n("format", m);
|
|
4029
|
+
} catch (m) {
|
|
4030
|
+
console.error("Failed to format XML:", m);
|
|
3931
4031
|
}
|
|
3932
|
-
},
|
|
4032
|
+
}, g = async (m) => {
|
|
3933
4033
|
try {
|
|
3934
|
-
const O = typeof
|
|
4034
|
+
const O = typeof m == "string" ? m : JSON.stringify(m, null, 2);
|
|
3935
4035
|
await navigator.clipboard.writeText(O), n("copy-success", O);
|
|
3936
4036
|
} catch (O) {
|
|
3937
|
-
const
|
|
3938
|
-
n("copy-error",
|
|
4037
|
+
const $ = O instanceof Error ? O : new Error("Copy failed");
|
|
4038
|
+
n("copy-error", $), console.error("Failed to copy value:", O);
|
|
3939
4039
|
}
|
|
3940
4040
|
};
|
|
3941
|
-
return
|
|
3942
|
-
m
|
|
4041
|
+
return Fe(() => s.modelValue, (m) => {
|
|
4042
|
+
b(m);
|
|
3943
4043
|
}, { immediate: !0 }), e({
|
|
3944
4044
|
// 核心操作方法
|
|
3945
|
-
copyXml:
|
|
3946
|
-
compressSource:
|
|
3947
|
-
formatSource:
|
|
3948
|
-
expandAll:
|
|
3949
|
-
collapseAll:
|
|
3950
|
-
toggleExpand:
|
|
4045
|
+
copyXml: S,
|
|
4046
|
+
compressSource: F,
|
|
4047
|
+
formatSource: Z,
|
|
4048
|
+
expandAll: P,
|
|
4049
|
+
collapseAll: k,
|
|
4050
|
+
toggleExpand: A,
|
|
3951
4051
|
// 状态访问方法
|
|
3952
4052
|
isValidXml: () => a.value,
|
|
3953
4053
|
getParsedXml: () => o.value,
|
|
3954
4054
|
getExpandedNodes: () => u.value,
|
|
3955
4055
|
getParseError: () => i.value,
|
|
3956
4056
|
// 工具方法
|
|
3957
|
-
parseXmlString: (
|
|
3958
|
-
copyValue: (
|
|
3959
|
-
}), (
|
|
4057
|
+
parseXmlString: (m) => b(m),
|
|
4058
|
+
copyValue: (m) => g(m)
|
|
4059
|
+
}), (m, O) => (_(), x("div", {
|
|
3960
4060
|
class: Te(["xml-format", `xml-format--${l.value.name}`])
|
|
3961
4061
|
}, [
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
4062
|
+
m.showToolbar ? (_(), x("div", xn, [
|
|
4063
|
+
y("div", kn, [
|
|
4064
|
+
y("button", {
|
|
3965
4065
|
class: "xml-format__btn xml-format__btn--primary",
|
|
3966
|
-
onClick:
|
|
4066
|
+
onClick: S,
|
|
3967
4067
|
disabled: !a.value,
|
|
3968
4068
|
title: "Copy XML"
|
|
3969
|
-
}, " 📋 Copy ", 8,
|
|
3970
|
-
|
|
4069
|
+
}, " 📋 Copy ", 8, Nn),
|
|
4070
|
+
y("button", {
|
|
3971
4071
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
3972
|
-
onClick:
|
|
4072
|
+
onClick: P,
|
|
3973
4073
|
disabled: !a.value,
|
|
3974
4074
|
title: "Expand All"
|
|
3975
|
-
}, " ⬇️ Expand All ", 8,
|
|
3976
|
-
|
|
4075
|
+
}, " ⬇️ Expand All ", 8, An),
|
|
4076
|
+
y("button", {
|
|
3977
4077
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
3978
|
-
onClick:
|
|
4078
|
+
onClick: k,
|
|
3979
4079
|
disabled: !a.value,
|
|
3980
4080
|
title: "Collapse All"
|
|
3981
|
-
}, " ➡️ Collapse All ", 8,
|
|
3982
|
-
|
|
4081
|
+
}, " ➡️ Collapse All ", 8, wn),
|
|
4082
|
+
y("button", {
|
|
3983
4083
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
3984
|
-
onClick:
|
|
4084
|
+
onClick: F,
|
|
3985
4085
|
disabled: !a.value,
|
|
3986
4086
|
title: "Compress XML"
|
|
3987
|
-
}, " 📦 Compress ", 8,
|
|
3988
|
-
|
|
4087
|
+
}, " 📦 Compress ", 8, Cn),
|
|
4088
|
+
y("button", {
|
|
3989
4089
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
3990
|
-
onClick:
|
|
4090
|
+
onClick: Z,
|
|
3991
4091
|
disabled: !a.value,
|
|
3992
4092
|
title: "Format XML"
|
|
3993
|
-
}, " ✨ Format ", 8,
|
|
4093
|
+
}, " ✨ Format ", 8, On)
|
|
3994
4094
|
]),
|
|
3995
|
-
|
|
3996
|
-
a.value ? (
|
|
4095
|
+
y("div", Tn, [
|
|
4096
|
+
a.value ? (_(), x("span", Pn, " ✅ Valid XML ")) : (_(), x("span", $n, " ❌ Invalid XML "))
|
|
3997
4097
|
])
|
|
3998
|
-
])) :
|
|
3999
|
-
|
|
4000
|
-
a.value ? (
|
|
4001
|
-
|
|
4098
|
+
])) : U("", !0),
|
|
4099
|
+
y("div", Sn, [
|
|
4100
|
+
a.value ? (_(), x("div", In, [
|
|
4101
|
+
h.value ? (_(), x("div", {
|
|
4002
4102
|
key: 0,
|
|
4003
4103
|
class: "xml-declaration",
|
|
4004
|
-
style:
|
|
4005
|
-
},
|
|
4006
|
-
(
|
|
4007
|
-
key:
|
|
4008
|
-
node:
|
|
4009
|
-
index:
|
|
4104
|
+
style: N({ color: l.value.colors.xmlDeclaration })
|
|
4105
|
+
}, B(h.value), 5)) : U("", !0),
|
|
4106
|
+
(_(!0), x(ne, null, ie(v.value, ($, j) => (_(), Xe(hr, {
|
|
4107
|
+
key: j,
|
|
4108
|
+
node: $,
|
|
4109
|
+
index: j,
|
|
4010
4110
|
level: 0,
|
|
4011
4111
|
expanded: u.value,
|
|
4012
4112
|
theme: l.value,
|
|
4013
|
-
onToggleExpand:
|
|
4014
|
-
onCopy:
|
|
4113
|
+
onToggleExpand: A,
|
|
4114
|
+
onCopy: g
|
|
4015
4115
|
}, null, 8, ["node", "index", "expanded", "theme"]))), 128))
|
|
4016
|
-
])) : (
|
|
4017
|
-
O[0] || (O[0] =
|
|
4018
|
-
|
|
4116
|
+
])) : (_(), x("div", Bn, [
|
|
4117
|
+
O[0] || (O[0] = y("h4", null, "XML Parse Error:", -1)),
|
|
4118
|
+
y("pre", null, B(i.value), 1)
|
|
4019
4119
|
]))
|
|
4020
4120
|
])
|
|
4021
4121
|
], 2));
|
|
4022
4122
|
}
|
|
4023
|
-
}),
|
|
4024
|
-
|
|
4123
|
+
}), Un = /* @__PURE__ */ be(Vn, [["__scopeId", "data-v-f9125514"]]), Ln = [Zt], jn = (r) => {
|
|
4124
|
+
Ln.forEach((e) => {
|
|
4025
4125
|
const t = e.name || e.__name || "UnknownComponent";
|
|
4026
4126
|
r.component(t, e);
|
|
4027
4127
|
});
|
|
4028
|
-
},
|
|
4029
|
-
install:
|
|
4128
|
+
}, Fn = {
|
|
4129
|
+
install: jn
|
|
4030
4130
|
};
|
|
4031
4131
|
export {
|
|
4032
4132
|
Zt as JsonFormat,
|
|
4033
|
-
|
|
4034
|
-
|
|
4133
|
+
Un as XmlFormat,
|
|
4134
|
+
Fn as default
|
|
4035
4135
|
};
|