lone-format 0.6.0 → 0.6.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 +1568 -1207
- package/dist/lone-format.umd.cjs +11 -11
- package/package.json +1 -1
package/dist/lone-format.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
class
|
|
1
|
+
import { defineComponent as Oe, useCssVars as Le, ref as W, computed as K, resolveComponent as Qe, createElementBlock as P, openBlock as O, createElementVNode as y, createCommentVNode as te, withKeys as U, withModifiers as Z, toDisplayString as M, Fragment as pe, renderList as _e, createVNode as Ye, normalizeClass as je, nextTick as ue, watch as Ge, normalizeStyle as $, createBlock as Ze } from "vue";
|
|
2
|
+
class it {
|
|
3
3
|
/**
|
|
4
4
|
* @callback HookCallback
|
|
5
5
|
* @this {*|Jsep} this
|
|
@@ -42,7 +42,7 @@ class ze {
|
|
|
42
42
|
});
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
class
|
|
45
|
+
class at {
|
|
46
46
|
constructor(e) {
|
|
47
47
|
this.jsep = e, this.registered = {};
|
|
48
48
|
}
|
|
@@ -69,7 +69,7 @@ class De {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
class
|
|
72
|
+
class d {
|
|
73
73
|
/**
|
|
74
74
|
* @returns {string}
|
|
75
75
|
*/
|
|
@@ -80,7 +80,7 @@ class u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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
|
}, c = this.gobbleToken(), c || this.throwError("Expected expression after " + t), n = [i, o, c]; 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 g = (h) => o.right_a && h.right_a ? s > h.prec : s <= h.prec;
|
|
372
|
+
for (; n.length > 2 && g(n[n.length - 2]); )
|
|
373
373
|
c = 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: c
|
|
@@ -380,7 +380,7 @@ class u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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 u {
|
|
|
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
|
-
const
|
|
619
|
-
Object.assign(
|
|
620
|
-
hooks:
|
|
621
|
-
plugins: new
|
|
618
|
+
const lt = new it();
|
|
619
|
+
Object.assign(d, {
|
|
620
|
+
hooks: lt,
|
|
621
|
+
plugins: new at(d),
|
|
622
622
|
// Node Types
|
|
623
623
|
// ----------
|
|
624
624
|
// This is the full set of types that any JSEP node can be.
|
|
@@ -712,16 +712,16 @@ Object.assign(u, {
|
|
|
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 de = (r) => new d(r).parse(), ct = Object.getOwnPropertyNames(class {
|
|
718
718
|
});
|
|
719
|
-
Object.getOwnPropertyNames(
|
|
720
|
-
|
|
719
|
+
Object.getOwnPropertyNames(d).filter((r) => !ct.includes(r) && de[r] === void 0).forEach((r) => {
|
|
720
|
+
de[r] = d[r];
|
|
721
721
|
});
|
|
722
|
-
|
|
723
|
-
const
|
|
724
|
-
var
|
|
722
|
+
de.Jsep = d;
|
|
723
|
+
const ut = "ConditionalExpression";
|
|
724
|
+
var dt = {
|
|
725
725
|
name: "ternary",
|
|
726
726
|
init(r) {
|
|
727
727
|
r.hooks.add("after-expression", function(t) {
|
|
@@ -732,7 +732,7 @@ var rt = {
|
|
|
732
732
|
this.index++;
|
|
733
733
|
const o = this.gobbleExpression();
|
|
734
734
|
if (o || this.throwError("Expected expression"), t.node = {
|
|
735
|
-
type:
|
|
735
|
+
type: ut,
|
|
736
736
|
test: s,
|
|
737
737
|
consequent: n,
|
|
738
738
|
alternate: o
|
|
@@ -748,17 +748,17 @@ var rt = {
|
|
|
748
748
|
});
|
|
749
749
|
}
|
|
750
750
|
};
|
|
751
|
-
|
|
752
|
-
const
|
|
753
|
-
var
|
|
751
|
+
de.plugins.register(dt);
|
|
752
|
+
const Me = 47, ft = 92;
|
|
753
|
+
var ht = {
|
|
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 === Me) {
|
|
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 === Me && !n) {
|
|
762
762
|
const o = this.expr.slice(s, this.index);
|
|
763
763
|
let i = "";
|
|
764
764
|
for (; ++this.index < this.expr.length; ) {
|
|
@@ -780,34 +780,34 @@ var st = {
|
|
|
780
780
|
raw: this.expr.slice(s - 1, this.index)
|
|
781
781
|
}, t.node = this.gobbleTokenProperty(t.node), t.node;
|
|
782
782
|
}
|
|
783
|
-
this.code === r.OBRACK_CODE ? n = !0 : n && this.code === r.CBRACK_CODE && (n = !1), this.index += this.code ===
|
|
783
|
+
this.code === r.OBRACK_CODE ? n = !0 : n && this.code === r.CBRACK_CODE && (n = !1), this.index += this.code === ft ? 2 : 1;
|
|
784
784
|
}
|
|
785
785
|
this.throwError("Unclosed Regex");
|
|
786
786
|
}
|
|
787
787
|
});
|
|
788
788
|
}
|
|
789
789
|
};
|
|
790
|
-
const
|
|
790
|
+
const Be = 43, pt = 45, ke = {
|
|
791
791
|
name: "assignment",
|
|
792
792
|
assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
|
|
793
|
-
updateOperators: [
|
|
793
|
+
updateOperators: [Be, pt],
|
|
794
794
|
assignmentPrecedence: 0.9,
|
|
795
795
|
init(r) {
|
|
796
796
|
const e = [r.IDENTIFIER, r.MEMBER_EXP];
|
|
797
|
-
|
|
797
|
+
ke.assignmentOperators.forEach((s) => r.addBinaryOp(s, ke.assignmentPrecedence, !0)), r.hooks.add("gobble-token", function(n) {
|
|
798
798
|
const o = this.code;
|
|
799
|
-
|
|
799
|
+
ke.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 === Be ? "++" : "--",
|
|
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
|
+
ke.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 === Be ? "++" : "--",
|
|
811
811
|
argument: n.node,
|
|
812
812
|
prefix: !1
|
|
813
813
|
});
|
|
@@ -816,17 +816,17 @@ const xe = 43, ot = 45, fe = {
|
|
|
816
816
|
n.node && t(n.node);
|
|
817
817
|
});
|
|
818
818
|
function t(s) {
|
|
819
|
-
|
|
819
|
+
ke.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
|
|
825
|
+
de.plugins.register(ht, ke);
|
|
826
|
+
de.addUnaryOp("typeof");
|
|
827
|
+
de.addLiteral("null", null);
|
|
828
|
+
de.addLiteral("undefined", void 0);
|
|
829
|
+
const gt = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]), q = {
|
|
830
830
|
/**
|
|
831
831
|
* @param {jsep.Expression} ast
|
|
832
832
|
* @param {Record<string, any>} subs
|
|
@@ -835,25 +835,25 @@ const it = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
|
|
|
835
835
|
switch (r.type) {
|
|
836
836
|
case "BinaryExpression":
|
|
837
837
|
case "LogicalExpression":
|
|
838
|
-
return
|
|
838
|
+
return q.evalBinaryExpression(r, e);
|
|
839
839
|
case "Compound":
|
|
840
|
-
return
|
|
840
|
+
return q.evalCompound(r, e);
|
|
841
841
|
case "ConditionalExpression":
|
|
842
|
-
return
|
|
842
|
+
return q.evalConditionalExpression(r, e);
|
|
843
843
|
case "Identifier":
|
|
844
|
-
return
|
|
844
|
+
return q.evalIdentifier(r, e);
|
|
845
845
|
case "Literal":
|
|
846
|
-
return
|
|
846
|
+
return q.evalLiteral(r, e);
|
|
847
847
|
case "MemberExpression":
|
|
848
|
-
return
|
|
848
|
+
return q.evalMemberExpression(r, e);
|
|
849
849
|
case "UnaryExpression":
|
|
850
|
-
return
|
|
850
|
+
return q.evalUnaryExpression(r, e);
|
|
851
851
|
case "ArrayExpression":
|
|
852
|
-
return
|
|
852
|
+
return q.evalArrayExpression(r, e);
|
|
853
853
|
case "CallExpression":
|
|
854
|
-
return
|
|
854
|
+
return q.evalCallExpression(r, e);
|
|
855
855
|
case "AssignmentExpression":
|
|
856
|
-
return
|
|
856
|
+
return q.evalAssignmentExpression(r, e);
|
|
857
857
|
default:
|
|
858
858
|
throw SyntaxError("Unexpected expression", r);
|
|
859
859
|
}
|
|
@@ -883,19 +883,19 @@ const it = /* @__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](q.evalAst(r.left, e), () => q.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 = q.evalAst(n, e);
|
|
894
894
|
}
|
|
895
895
|
return t;
|
|
896
896
|
},
|
|
897
897
|
evalConditionalExpression(r, e) {
|
|
898
|
-
return
|
|
898
|
+
return q.evalAst(r.test, e) ? q.evalAst(r.consequent, e) : q.evalAst(r.alternate, e);
|
|
899
899
|
},
|
|
900
900
|
evalIdentifier(r, e) {
|
|
901
901
|
if (Object.hasOwn(e, r.name))
|
|
@@ -910,46 +910,46 @@ const it = /* @__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 ? q.evalAst(r.property) : r.property.name
|
|
914
914
|
// `object.property` property is Identifier
|
|
915
|
-
), s =
|
|
915
|
+
), s = q.evalAst(r.object, e);
|
|
916
916
|
if (s == null)
|
|
917
917
|
throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);
|
|
918
|
-
if (!Object.hasOwn(s, t) &&
|
|
918
|
+
if (!Object.hasOwn(s, t) && gt.has(t))
|
|
919
919
|
throw TypeError(`Cannot read properties of ${s} (reading '${t}')`);
|
|
920
920
|
const n = s[t];
|
|
921
921
|
return typeof n == "function" ? n.bind(s) : n;
|
|
922
922
|
},
|
|
923
923
|
evalUnaryExpression(r, e) {
|
|
924
924
|
return {
|
|
925
|
-
"-": (s) => -
|
|
926
|
-
"!": (s) => !
|
|
927
|
-
"~": (s) => ~
|
|
925
|
+
"-": (s) => -q.evalAst(s, e),
|
|
926
|
+
"!": (s) => !q.evalAst(s, e),
|
|
927
|
+
"~": (s) => ~q.evalAst(s, e),
|
|
928
928
|
// eslint-disable-next-line no-implicit-coercion -- API
|
|
929
|
-
"+": (s) => +
|
|
930
|
-
typeof: (s) => typeof
|
|
929
|
+
"+": (s) => +q.evalAst(s, e),
|
|
930
|
+
typeof: (s) => typeof q.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) => q.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) => q.evalAst(n, e));
|
|
938
|
+
return q.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 = q.evalAst(r.right, e);
|
|
944
944
|
return e[t] = s, e[t];
|
|
945
945
|
}
|
|
946
946
|
};
|
|
947
|
-
class
|
|
947
|
+
class mt {
|
|
948
948
|
/**
|
|
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 = de(this.code);
|
|
953
953
|
}
|
|
954
954
|
/**
|
|
955
955
|
* @param {object} context Object whose items will be added
|
|
@@ -958,16 +958,16 @@ class at {
|
|
|
958
958
|
*/
|
|
959
959
|
runInNewContext(e) {
|
|
960
960
|
const t = Object.assign(/* @__PURE__ */ Object.create(null), e);
|
|
961
|
-
return
|
|
961
|
+
return q.evalAst(this.ast, t);
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
|
-
function
|
|
964
|
+
function he(r, e) {
|
|
965
965
|
return r = r.slice(), r.push(e), r;
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function Ie(r, e) {
|
|
968
968
|
return e = e.slice(), e.unshift(r), e;
|
|
969
969
|
}
|
|
970
|
-
class
|
|
970
|
+
class bt extends Error {
|
|
971
971
|
/**
|
|
972
972
|
* @param {AnyResult} value The evaluated scalar value
|
|
973
973
|
*/
|
|
@@ -975,10 +975,10 @@ class lt 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 X(r, e, t, s, n) {
|
|
979
|
+
if (!(this instanceof X))
|
|
980
980
|
try {
|
|
981
|
-
return new
|
|
981
|
+
return new X(r, e, t, s, n);
|
|
982
982
|
} catch (i) {
|
|
983
983
|
if (!i.avoidNew)
|
|
984
984
|
throw i;
|
|
@@ -995,11 +995,11 @@ function L(r, e, t, s, n) {
|
|
|
995
995
|
o ? "json" in r && (i.json = r.json) : i.json = t;
|
|
996
996
|
const c = this.evaluate(i);
|
|
997
997
|
if (!c || typeof c != "object")
|
|
998
|
-
throw new
|
|
998
|
+
throw new bt(c);
|
|
999
999
|
return c;
|
|
1000
1000
|
}
|
|
1001
1001
|
}
|
|
1002
|
-
|
|
1002
|
+
X.prototype.evaluate = function(r, e, t, s) {
|
|
1003
1003
|
let n = this.parent, o = this.parentProperty, {
|
|
1004
1004
|
flatten: i,
|
|
1005
1005
|
wrap: c
|
|
@@ -1013,44 +1013,44 @@ L.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, c = Object.hasOwn(r, "wrap") ? r.wrap : c, 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 = X.toPathString(r)), !r && r !== "" || !e)
|
|
1017
1017
|
return;
|
|
1018
|
-
const a =
|
|
1018
|
+
const a = X.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(g) {
|
|
1021
|
+
return g && !g.isParentSelector;
|
|
1022
1022
|
});
|
|
1023
|
-
return l.length ? !c && l.length === 1 && !l[0].hasArrExpr ? this._getPreferredOutput(l[0]) : l.reduce((
|
|
1024
|
-
const
|
|
1025
|
-
return i && Array.isArray(
|
|
1023
|
+
return l.length ? !c && l.length === 1 && !l[0].hasArrExpr ? this._getPreferredOutput(l[0]) : l.reduce((g, h) => {
|
|
1024
|
+
const x = this._getPreferredOutput(h);
|
|
1025
|
+
return i && Array.isArray(x) ? g = g.concat(x) : g.push(x), g;
|
|
1026
1026
|
}, []) : c ? [] : void 0;
|
|
1027
1027
|
};
|
|
1028
|
-
|
|
1028
|
+
X.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 : X.toPathArray(r.path);
|
|
1033
|
+
return r.pointer = X.toPointer(t), r.path = typeof r.path == "string" ? r.path : X.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 X.toPathString(r[e]);
|
|
1041
1041
|
case "pointer":
|
|
1042
|
-
return
|
|
1042
|
+
return X.toPointer(r.path);
|
|
1043
1043
|
default:
|
|
1044
1044
|
throw new TypeError("Unknown result type");
|
|
1045
1045
|
}
|
|
1046
1046
|
};
|
|
1047
|
-
|
|
1047
|
+
X.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 : X.toPathString(r.path), e(s, t, r);
|
|
1051
1051
|
}
|
|
1052
1052
|
};
|
|
1053
|
-
|
|
1053
|
+
X.prototype._trace = function(r, e, t, s, n, o, i, c) {
|
|
1054
1054
|
let a;
|
|
1055
1055
|
if (!r.length)
|
|
1056
1056
|
return a = {
|
|
@@ -1060,93 +1060,93 @@ L.prototype._trace = function(r, e, t, s, n, o, i, c) {
|
|
|
1060
1060
|
parentProperty: n,
|
|
1061
1061
|
hasArrExpr: i
|
|
1062
1062
|
}, this._handleCallback(a, o, "value"), a;
|
|
1063
|
-
const l = r[0],
|
|
1064
|
-
function
|
|
1065
|
-
Array.isArray(
|
|
1066
|
-
|
|
1067
|
-
}) :
|
|
1063
|
+
const l = r[0], g = r.slice(1), h = [];
|
|
1064
|
+
function x(v) {
|
|
1065
|
+
Array.isArray(v) ? v.forEach((B) => {
|
|
1066
|
+
h.push(B);
|
|
1067
|
+
}) : h.push(v);
|
|
1068
1068
|
}
|
|
1069
1069
|
if ((typeof l != "string" || c) && e && Object.hasOwn(e, l))
|
|
1070
|
-
|
|
1070
|
+
x(this._trace(g, e[l], he(t, l), e, l, o, i));
|
|
1071
1071
|
else if (l === "*")
|
|
1072
|
-
this._walk(e, (
|
|
1073
|
-
|
|
1072
|
+
this._walk(e, (v) => {
|
|
1073
|
+
x(this._trace(g, e[v], he(t, v), e, v, o, !0, !0));
|
|
1074
1074
|
});
|
|
1075
1075
|
else if (l === "..")
|
|
1076
|
-
|
|
1077
|
-
typeof e[
|
|
1076
|
+
x(this._trace(g, e, t, s, n, o, i)), this._walk(e, (v) => {
|
|
1077
|
+
typeof e[v] == "object" && x(this._trace(r.slice(), e[v], he(t, v), e, v, 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: g,
|
|
1084
1084
|
isParentSelector: !0
|
|
1085
1085
|
};
|
|
1086
1086
|
if (l === "~")
|
|
1087
1087
|
return a = {
|
|
1088
|
-
path:
|
|
1088
|
+
path: he(t, l),
|
|
1089
1089
|
value: n,
|
|
1090
1090
|
parent: s,
|
|
1091
1091
|
parentProperty: null
|
|
1092
1092
|
}, this._handleCallback(a, o, "property"), a;
|
|
1093
1093
|
if (l === "$")
|
|
1094
|
-
|
|
1094
|
+
x(this._trace(g, e, t, null, null, o, i));
|
|
1095
1095
|
else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))
|
|
1096
|
-
|
|
1096
|
+
x(this._slice(l, g, 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 v = l.replace(/^\?\((.*?)\)$/u, "$1"), B = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(v);
|
|
1101
|
+
B ? this._walk(e, (S) => {
|
|
1102
|
+
const _ = [B[2]], j = B[1] ? e[S][B[1]] : e[S];
|
|
1103
|
+
this._trace(_, j, t, s, n, o, !0).length > 0 && x(this._trace(g, e[S], he(t, S), e, S, o, !0));
|
|
1104
|
+
}) : this._walk(e, (S) => {
|
|
1105
|
+
this._eval(v, e[S], S, t, s, n) && x(this._trace(g, e[S], he(t, S), e, S, 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
|
+
x(this._trace(Ie(this._eval(l, e, t.at(-1), t.slice(0, -1), s, n), g), e, t, s, n, o, i));
|
|
1111
1111
|
} else if (l[0] === "@") {
|
|
1112
|
-
let
|
|
1113
|
-
const
|
|
1114
|
-
switch (
|
|
1112
|
+
let v = !1;
|
|
1113
|
+
const B = l.slice(1, -2);
|
|
1114
|
+
switch (B) {
|
|
1115
1115
|
case "scalar":
|
|
1116
|
-
(!e || !["object", "function"].includes(typeof e)) && (
|
|
1116
|
+
(!e || !["object", "function"].includes(typeof e)) && (v = !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 === B && (v = !0);
|
|
1123
1123
|
break;
|
|
1124
1124
|
case "integer":
|
|
1125
|
-
Number.isFinite(e) && !(e % 1) && (
|
|
1125
|
+
Number.isFinite(e) && !(e % 1) && (v = !0);
|
|
1126
1126
|
break;
|
|
1127
1127
|
case "number":
|
|
1128
|
-
Number.isFinite(e) && (
|
|
1128
|
+
Number.isFinite(e) && (v = !0);
|
|
1129
1129
|
break;
|
|
1130
1130
|
case "nonFinite":
|
|
1131
|
-
typeof e == "number" && !Number.isFinite(e) && (
|
|
1131
|
+
typeof e == "number" && !Number.isFinite(e) && (v = !0);
|
|
1132
1132
|
break;
|
|
1133
1133
|
case "object":
|
|
1134
|
-
e && typeof e ===
|
|
1134
|
+
e && typeof e === B && (v = !0);
|
|
1135
1135
|
break;
|
|
1136
1136
|
case "array":
|
|
1137
|
-
Array.isArray(e) && (
|
|
1137
|
+
Array.isArray(e) && (v = !0);
|
|
1138
1138
|
break;
|
|
1139
1139
|
case "other":
|
|
1140
|
-
|
|
1140
|
+
v = this.currOtherTypeCallback(e, t, s, n);
|
|
1141
1141
|
break;
|
|
1142
1142
|
case "null":
|
|
1143
|
-
e === null && (
|
|
1143
|
+
e === null && (v = !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 " + B);
|
|
1148
1148
|
}
|
|
1149
|
-
if (
|
|
1149
|
+
if (v)
|
|
1150
1150
|
return a = {
|
|
1151
1151
|
path: t,
|
|
1152
1152
|
value: e,
|
|
@@ -1154,31 +1154,31 @@ L.prototype._trace = function(r, e, t, s, n, o, i, c) {
|
|
|
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 v = l.slice(1);
|
|
1158
|
+
x(this._trace(g, e[v], he(t, v), e, v, o, i, !0));
|
|
1159
1159
|
} else if (l.includes(",")) {
|
|
1160
|
-
const
|
|
1161
|
-
for (const
|
|
1162
|
-
|
|
1163
|
-
} else !c && e && Object.hasOwn(e, l) &&
|
|
1160
|
+
const v = l.split(",");
|
|
1161
|
+
for (const B of v)
|
|
1162
|
+
x(this._trace(Ie(B, g), e, t, s, n, o, !0));
|
|
1163
|
+
} else !c && e && Object.hasOwn(e, l) && x(this._trace(g, e[l], he(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 v = 0; v < h.length; v++) {
|
|
1167
|
+
const B = h[v];
|
|
1168
|
+
if (B && B.isParentSelector) {
|
|
1169
|
+
const S = this._trace(B.expr, e, B.path, s, n, o, i);
|
|
1170
|
+
if (Array.isArray(S)) {
|
|
1171
|
+
h[v] = S[0];
|
|
1172
|
+
const _ = S.length;
|
|
1173
|
+
for (let j = 1; j < _; j++)
|
|
1174
|
+
v++, h.splice(v, 0, S[j]);
|
|
1175
1175
|
} else
|
|
1176
|
-
|
|
1176
|
+
h[v] = S;
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
|
-
return
|
|
1179
|
+
return h;
|
|
1180
1180
|
};
|
|
1181
|
-
|
|
1181
|
+
X.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 @@ L.prototype._walk = function(r, e) {
|
|
|
1187
1187
|
e(t);
|
|
1188
1188
|
});
|
|
1189
1189
|
};
|
|
1190
|
-
|
|
1190
|
+
X.prototype._slice = function(r, e, t, s, n, o, i) {
|
|
1191
1191
|
if (!Array.isArray(t))
|
|
1192
1192
|
return;
|
|
1193
1193
|
const c = t.length, a = r.split(":"), l = a[2] && Number.parseInt(a[2]) || 1;
|
|
1194
|
-
let
|
|
1195
|
-
|
|
1196
|
-
const
|
|
1197
|
-
for (let
|
|
1198
|
-
this._trace(
|
|
1199
|
-
|
|
1194
|
+
let g = a[0] && Number.parseInt(a[0]) || 0, h = a[1] && Number.parseInt(a[1]) || c;
|
|
1195
|
+
g = g < 0 ? Math.max(0, g + c) : Math.min(c, g), h = h < 0 ? Math.max(0, h + c) : Math.min(c, h);
|
|
1196
|
+
const x = [];
|
|
1197
|
+
for (let v = g; v < h; v += l)
|
|
1198
|
+
this._trace(Ie(v, e), t, s, n, o, i, !0).forEach((S) => {
|
|
1199
|
+
x.push(S);
|
|
1200
1200
|
});
|
|
1201
|
-
return
|
|
1201
|
+
return x;
|
|
1202
1202
|
};
|
|
1203
|
-
|
|
1203
|
+
X.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 = X.toPathString(s.concat([t])));
|
|
1207
1207
|
const c = this.currEval + "Script:" + r;
|
|
1208
|
-
if (!
|
|
1208
|
+
if (!X.cache[c]) {
|
|
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
|
+
X.cache[c] = new this.safeVm.Script(a);
|
|
1212
1212
|
else if (this.currEval === "native")
|
|
1213
|
-
|
|
1213
|
+
X.cache[c] = 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
|
+
X.cache[c] = new l(a);
|
|
1217
1217
|
} else if (typeof this.currEval == "function")
|
|
1218
|
-
|
|
1218
|
+
X.cache[c] = {
|
|
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 X.cache[c].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
|
+
X.cache = {};
|
|
1233
|
+
X.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
|
+
X.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
|
+
X.toPathArray = function(r) {
|
|
1248
1248
|
const {
|
|
1249
1249
|
cache: e
|
|
1250
|
-
} =
|
|
1250
|
+
} = X;
|
|
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,17 +1262,17 @@ L.toPathArray = function(r) {
|
|
|
1262
1262
|
});
|
|
1263
1263
|
return e[r] = n, e[r].concat();
|
|
1264
1264
|
};
|
|
1265
|
-
|
|
1266
|
-
Script:
|
|
1265
|
+
X.prototype.safeVm = {
|
|
1266
|
+
Script: mt
|
|
1267
1267
|
};
|
|
1268
|
-
const
|
|
1268
|
+
const yt = function(r, e, t) {
|
|
1269
1269
|
const s = r.length;
|
|
1270
1270
|
for (let n = 0; n < s; n++) {
|
|
1271
1271
|
const o = r[n];
|
|
1272
1272
|
t(o) && e.push(r.splice(n--, 1)[0]);
|
|
1273
1273
|
}
|
|
1274
1274
|
};
|
|
1275
|
-
class
|
|
1275
|
+
class vt {
|
|
1276
1276
|
/**
|
|
1277
1277
|
* @param {string} expr Expression to evaluate
|
|
1278
1278
|
*/
|
|
@@ -1287,44 +1287,44 @@ class ut {
|
|
|
1287
1287
|
runInNewContext(e) {
|
|
1288
1288
|
let t = this.code;
|
|
1289
1289
|
const s = Object.keys(e), n = [];
|
|
1290
|
-
|
|
1290
|
+
yt(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, g) => {
|
|
1293
|
+
let h = e[g].toString();
|
|
1294
|
+
return /function/u.test(h) || (h = "function " + h), "var " + g + "=" + 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 c = t.lastIndexOf(";"), a = c !== -1 ? t.slice(0, c + 1) + " return " + t.slice(c + 1) : " return " + t;
|
|
1297
1297
|
return new Function(...s, a)(...o);
|
|
1298
1298
|
}
|
|
1299
1299
|
}
|
|
1300
|
-
|
|
1301
|
-
Script:
|
|
1300
|
+
X.prototype.vm = {
|
|
1301
|
+
Script: vt
|
|
1302
1302
|
};
|
|
1303
|
-
const
|
|
1303
|
+
const _t = { class: "json-node" }, xt = {
|
|
1304
1304
|
key: 0,
|
|
1305
1305
|
class: "json-node__container"
|
|
1306
|
-
},
|
|
1306
|
+
}, Et = { class: "json-node__line" }, kt = ["contenteditable", "onKeydown"], At = {
|
|
1307
1307
|
key: 1,
|
|
1308
1308
|
class: "json-node__colon"
|
|
1309
|
-
},
|
|
1309
|
+
}, wt = ["title"], Nt = ["title"], Ct = {
|
|
1310
1310
|
key: 4,
|
|
1311
1311
|
class: "json-node__comma"
|
|
1312
|
-
},
|
|
1312
|
+
}, Tt = {
|
|
1313
1313
|
key: 0,
|
|
1314
1314
|
class: "json-node__children"
|
|
1315
|
-
},
|
|
1315
|
+
}, Ot = { class: "json-node__children-content" }, $t = { class: "json-node__line json-node__closing-bracket" }, Pt = { class: "json-node__bracket" }, Bt = {
|
|
1316
1316
|
key: 0,
|
|
1317
1317
|
class: "json-node__comma"
|
|
1318
|
-
},
|
|
1318
|
+
}, St = {
|
|
1319
1319
|
key: 1,
|
|
1320
1320
|
class: "json-node__primitive"
|
|
1321
|
-
},
|
|
1321
|
+
}, It = ["contenteditable", "onKeydown"], Vt = {
|
|
1322
1322
|
key: 1,
|
|
1323
1323
|
class: "json-node__colon"
|
|
1324
|
-
},
|
|
1324
|
+
}, Rt = ["title"], Lt = ["contenteditable", "onKeydown"], jt = {
|
|
1325
1325
|
key: 0,
|
|
1326
1326
|
class: "json-node__comma"
|
|
1327
|
-
},
|
|
1327
|
+
}, Ut = /* @__PURE__ */ Oe({
|
|
1328
1328
|
name: "JsonNode",
|
|
1329
1329
|
__name: "JsonNode",
|
|
1330
1330
|
props: {
|
|
@@ -1338,202 +1338,202 @@ const dt = { class: "json-node" }, ft = {
|
|
|
1338
1338
|
},
|
|
1339
1339
|
emits: ["update:value", "toggle-expand", "copy", "update:key"],
|
|
1340
1340
|
setup(r, { emit: e }) {
|
|
1341
|
-
|
|
1342
|
-
"2a18b018":
|
|
1343
|
-
"58a14b93":
|
|
1344
|
-
"46fe1b3e":
|
|
1345
|
-
fbe2c048:
|
|
1346
|
-
"4bd524bb":
|
|
1347
|
-
"3308d23c":
|
|
1348
|
-
"36380c60":
|
|
1349
|
-
"0892365d":
|
|
1350
|
-
"0015b195":
|
|
1351
|
-
"7db95f5c":
|
|
1352
|
-
"88ec825a":
|
|
1353
|
-
"537157f7":
|
|
1354
|
-
"3cee3331":
|
|
1355
|
-
"81323cee":
|
|
1341
|
+
Le((u) => ({
|
|
1342
|
+
"2a18b018": u.level,
|
|
1343
|
+
"58a14b93": u.theme.colors.syntaxKey,
|
|
1344
|
+
"46fe1b3e": u.theme.colors.hoverBackground,
|
|
1345
|
+
fbe2c048: u.theme.colors.syntaxBracket,
|
|
1346
|
+
"4bd524bb": u.theme.colors.collapsedText,
|
|
1347
|
+
"3308d23c": u.theme.colors.collapsedBackground,
|
|
1348
|
+
"36380c60": u.theme.colors.collapsedBackgroundHover,
|
|
1349
|
+
"0892365d": u.theme.colors.syntaxString,
|
|
1350
|
+
"0015b195": u.theme.colors.syntaxNumber,
|
|
1351
|
+
"7db95f5c": u.theme.colors.syntaxBoolean,
|
|
1352
|
+
"88ec825a": u.theme.colors.syntaxNull,
|
|
1353
|
+
"537157f7": u.theme.colors.background,
|
|
1354
|
+
"3cee3331": u.theme.colors.selectionBackground,
|
|
1355
|
+
"81323cee": u.theme.colors.indentLine
|
|
1356
1356
|
}));
|
|
1357
|
-
const t = r, s = e, n = W(!1), o = W(!1), i = W(""), c = W(""), a = W("string"), l = W(null),
|
|
1357
|
+
const t = r, s = e, n = W(!1), o = W(!1), i = W(""), c = W(""), a = W("string"), l = W(null), g = W(null), h = (u) => u !== null && typeof u == "object" && !Array.isArray(u) && "__protected_number__" in u && Object.keys(u).length === 1, x = (u) => h(u) ? u.__protected_number__ : "", v = K(() => h(t.value) ? !1 : t.value !== null && typeof t.value == "object"), B = K(() => Array.isArray(t.value)), S = K(() => t.path ? t.path : t.keyName ? t.keyName : "root"), _ = K(() => t.expanded.has(S.value)), j = K(() => t.keyName), Y = K(() => B.value ? "[" : "{"), J = K(() => B.value ? "]" : "}"), z = K(() => {
|
|
1358
1358
|
if (!t.value) return "";
|
|
1359
1359
|
const m = Object.keys(t.value).length;
|
|
1360
|
-
return
|
|
1361
|
-
}),
|
|
1362
|
-
const
|
|
1363
|
-
return t.value === null ? "json-node__value--null" :
|
|
1364
|
-
}),
|
|
1360
|
+
return B.value ? m > 0 ? ` ${m} items ` : " " : m > 0 ? ` ${m} keys ` : " ";
|
|
1361
|
+
}), ae = K(() => {
|
|
1362
|
+
const u = typeof t.value;
|
|
1363
|
+
return t.value === null ? "json-node__value--null" : u === "boolean" ? "json-node__value--boolean" : u === "number" || h(t.value) ? "json-node__value--number" : u === "string" ? "json-node__value--string" : "";
|
|
1364
|
+
}), ce = K(() => t.value === null ? "null" : typeof t.value == "boolean" || typeof t.value == "number" ? String(t.value) : h(t.value) ? x(t.value) : typeof t.value == "string" ? `"${t.value}"` : String(t.value)), fe = K(() => "Double-click to edit"), se = (u) => t.level === 0 ? u : S.value ? `${S.value}.${u}` : u, k = (u) => {
|
|
1365
1365
|
const m = Object.keys(t.value);
|
|
1366
|
-
return m.indexOf(
|
|
1367
|
-
},
|
|
1368
|
-
s("toggle-expand",
|
|
1369
|
-
},
|
|
1370
|
-
t.level !== 0 && (n.value = !0, i.value = t.keyName,
|
|
1366
|
+
return m.indexOf(u) === m.length - 1;
|
|
1367
|
+
}, C = () => {
|
|
1368
|
+
s("toggle-expand", S.value);
|
|
1369
|
+
}, R = () => {
|
|
1370
|
+
t.level !== 0 && (n.value = !0, i.value = t.keyName, ue(() => {
|
|
1371
1371
|
if (l.value) {
|
|
1372
1372
|
l.value.focus();
|
|
1373
|
-
const
|
|
1374
|
-
|
|
1373
|
+
const u = document.createRange();
|
|
1374
|
+
u.selectNodeContents(l.value);
|
|
1375
1375
|
const m = window.getSelection();
|
|
1376
|
-
m?.removeAllRanges(), m?.addRange(
|
|
1376
|
+
m?.removeAllRanges(), m?.addRange(u);
|
|
1377
1377
|
}
|
|
1378
1378
|
}));
|
|
1379
|
-
},
|
|
1380
|
-
|
|
1381
|
-
if (
|
|
1382
|
-
|
|
1383
|
-
const
|
|
1384
|
-
|
|
1379
|
+
}, V = () => {
|
|
1380
|
+
v.value || (o.value = !0, t.value === null ? a.value = "null" : h(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"), h(t.value) ? c.value = x(t.value) : typeof t.value == "string" ? c.value = t.value : c.value = String(t.value), ue(() => {
|
|
1381
|
+
if (g.value) {
|
|
1382
|
+
g.value.focus();
|
|
1383
|
+
const u = document.createRange();
|
|
1384
|
+
u.selectNodeContents(g.value);
|
|
1385
1385
|
const m = window.getSelection();
|
|
1386
|
-
m?.removeAllRanges(), m?.addRange(
|
|
1386
|
+
m?.removeAllRanges(), m?.addRange(u);
|
|
1387
1387
|
}
|
|
1388
1388
|
}));
|
|
1389
|
-
},
|
|
1389
|
+
}, T = () => {
|
|
1390
1390
|
if (t.level === 0 || !n.value) return;
|
|
1391
|
-
const
|
|
1392
|
-
if (!
|
|
1393
|
-
|
|
1391
|
+
const u = l.value?.innerText.trim() || "";
|
|
1392
|
+
if (!u) {
|
|
1393
|
+
f();
|
|
1394
1394
|
return;
|
|
1395
1395
|
}
|
|
1396
|
-
if (
|
|
1396
|
+
if (u === t.keyName) {
|
|
1397
1397
|
n.value = !1;
|
|
1398
1398
|
return;
|
|
1399
1399
|
}
|
|
1400
|
-
n.value = !1, s("update:key",
|
|
1401
|
-
},
|
|
1400
|
+
n.value = !1, s("update:key", S.value, u);
|
|
1401
|
+
}, Q = () => {
|
|
1402
1402
|
if (o.value)
|
|
1403
1403
|
try {
|
|
1404
|
-
let
|
|
1405
|
-
const m =
|
|
1404
|
+
let u;
|
|
1405
|
+
const m = g.value?.innerText.trim() || "";
|
|
1406
1406
|
if (a.value === "string")
|
|
1407
|
-
m === "null" ?
|
|
1407
|
+
m === "null" ? u = null : m === "true" || m === "false" ? u = m === "true" : u = m;
|
|
1408
1408
|
else if (a.value === "protected-number")
|
|
1409
|
-
|
|
1409
|
+
u = { __protected_number__: m };
|
|
1410
1410
|
else if (m === "null")
|
|
1411
|
-
|
|
1411
|
+
u = null;
|
|
1412
1412
|
else if (m === "true" || m === "false")
|
|
1413
|
-
|
|
1413
|
+
u = m === "true";
|
|
1414
1414
|
else if (!isNaN(Number(m)) && m !== "") {
|
|
1415
|
-
const
|
|
1416
|
-
!Number.isSafeInteger(
|
|
1415
|
+
const E = Number(m);
|
|
1416
|
+
!Number.isSafeInteger(E) || m.length > 15 ? u = { __protected_number__: m } : u = E;
|
|
1417
1417
|
} else
|
|
1418
|
-
|
|
1419
|
-
s("update:value",
|
|
1420
|
-
} catch (
|
|
1421
|
-
console.error("Failed to parse value:",
|
|
1418
|
+
u = m;
|
|
1419
|
+
s("update:value", S.value, u), o.value = !1;
|
|
1420
|
+
} catch (u) {
|
|
1421
|
+
console.error("Failed to parse value:", u), o.value = !1;
|
|
1422
1422
|
}
|
|
1423
|
-
},
|
|
1423
|
+
}, f = () => {
|
|
1424
1424
|
n.value = !1, i.value = t.keyName;
|
|
1425
|
-
},
|
|
1426
|
-
o.value = !1,
|
|
1425
|
+
}, b = () => {
|
|
1426
|
+
o.value = !1, h(t.value) ? c.value = x(t.value) : typeof t.value == "string" ? c.value = t.value : c.value = String(t.value);
|
|
1427
1427
|
};
|
|
1428
|
-
return (
|
|
1429
|
-
const
|
|
1430
|
-
return
|
|
1431
|
-
|
|
1432
|
-
y("div",
|
|
1433
|
-
|
|
1428
|
+
return (u, m) => {
|
|
1429
|
+
const E = Qe("JsonNode", !0);
|
|
1430
|
+
return O(), P("div", _t, [
|
|
1431
|
+
v.value ? (O(), P("div", xt, [
|
|
1432
|
+
y("div", Et, [
|
|
1433
|
+
u.keyName ? (O(), P("span", {
|
|
1434
1434
|
key: 0,
|
|
1435
1435
|
class: "json-node__key",
|
|
1436
1436
|
contenteditable: n.value,
|
|
1437
|
-
onDblclick:
|
|
1437
|
+
onDblclick: R,
|
|
1438
1438
|
onKeydown: [
|
|
1439
|
-
|
|
1440
|
-
|
|
1439
|
+
U(Z(T, ["prevent"]), ["enter"]),
|
|
1440
|
+
U(f, ["escape"])
|
|
1441
1441
|
],
|
|
1442
|
-
onBlur:
|
|
1442
|
+
onBlur: T,
|
|
1443
1443
|
ref_key: "keyRef",
|
|
1444
1444
|
ref: l,
|
|
1445
1445
|
title: "Double-click to edit key"
|
|
1446
|
-
},
|
|
1447
|
-
|
|
1446
|
+
}, M(n.value ? i.value : `"${j.value}"`), 41, kt)) : te("", !0),
|
|
1447
|
+
u.keyName ? (O(), P("span", At, ": ")) : te("", !0),
|
|
1448
1448
|
y("span", {
|
|
1449
1449
|
class: "json-node__bracket json-node__bracket--clickable",
|
|
1450
|
-
onClick:
|
|
1451
|
-
title:
|
|
1452
|
-
},
|
|
1453
|
-
|
|
1450
|
+
onClick: C,
|
|
1451
|
+
title: _.value ? "Click to collapse" : "Click to expand"
|
|
1452
|
+
}, M(Y.value), 9, wt),
|
|
1453
|
+
_.value ? te("", !0) : (O(), P("span", {
|
|
1454
1454
|
key: 2,
|
|
1455
1455
|
class: "json-node__collapsed-info",
|
|
1456
|
-
onClick:
|
|
1457
|
-
title: `Click to expand ${
|
|
1458
|
-
},
|
|
1459
|
-
|
|
1456
|
+
onClick: C,
|
|
1457
|
+
title: `Click to expand ${z.value.trim()}`
|
|
1458
|
+
}, M(z.value), 9, Nt)),
|
|
1459
|
+
_.value ? te("", !0) : (O(), P("span", {
|
|
1460
1460
|
key: 3,
|
|
1461
1461
|
class: "json-node__bracket json-node__bracket--clickable",
|
|
1462
|
-
onClick:
|
|
1462
|
+
onClick: C,
|
|
1463
1463
|
title: "Click to expand"
|
|
1464
|
-
},
|
|
1465
|
-
!
|
|
1464
|
+
}, M(J.value), 1)),
|
|
1465
|
+
!_.value && !u.isLast ? (O(), P("span", Ct, ",")) : te("", !0)
|
|
1466
1466
|
]),
|
|
1467
|
-
|
|
1468
|
-
y("div",
|
|
1469
|
-
(
|
|
1470
|
-
key:
|
|
1467
|
+
_.value ? (O(), P("div", Tt, [
|
|
1468
|
+
y("div", Ot, [
|
|
1469
|
+
(O(!0), P(pe, null, _e(u.value, (A, w) => (O(), P("div", {
|
|
1470
|
+
key: w,
|
|
1471
1471
|
class: "json-node__child"
|
|
1472
1472
|
}, [
|
|
1473
|
-
|
|
1474
|
-
value:
|
|
1475
|
-
"key-name":
|
|
1476
|
-
level:
|
|
1477
|
-
path:
|
|
1478
|
-
expanded:
|
|
1479
|
-
theme:
|
|
1480
|
-
"onUpdate:value": m[0] || (m[0] = (
|
|
1481
|
-
onToggleExpand: m[1] || (m[1] = (
|
|
1482
|
-
onCopy: m[2] || (m[2] = (
|
|
1483
|
-
"onUpdate:key": m[3] || (m[3] = (
|
|
1484
|
-
"is-last":
|
|
1473
|
+
Ye(E, {
|
|
1474
|
+
value: A,
|
|
1475
|
+
"key-name": B.value ? "" : String(w),
|
|
1476
|
+
level: u.level + 1,
|
|
1477
|
+
path: se(String(w)),
|
|
1478
|
+
expanded: u.expanded,
|
|
1479
|
+
theme: u.theme,
|
|
1480
|
+
"onUpdate:value": m[0] || (m[0] = (L, H) => u.$emit("update:value", L, H)),
|
|
1481
|
+
onToggleExpand: m[1] || (m[1] = (L) => u.$emit("toggle-expand", L)),
|
|
1482
|
+
onCopy: m[2] || (m[2] = (L) => u.$emit("copy", L)),
|
|
1483
|
+
"onUpdate:key": m[3] || (m[3] = (L, H) => u.$emit("update:key", L, H)),
|
|
1484
|
+
"is-last": k(String(w))
|
|
1485
1485
|
}, null, 8, ["value", "key-name", "level", "path", "expanded", "theme", "is-last"])
|
|
1486
1486
|
]))), 128))
|
|
1487
1487
|
]),
|
|
1488
|
-
y("div",
|
|
1489
|
-
y("span",
|
|
1490
|
-
|
|
1488
|
+
y("div", $t, [
|
|
1489
|
+
y("span", Pt, M(J.value), 1),
|
|
1490
|
+
u.isLast ? te("", !0) : (O(), P("span", Bt, ","))
|
|
1491
1491
|
])
|
|
1492
|
-
])) :
|
|
1493
|
-
])) : (
|
|
1494
|
-
|
|
1492
|
+
])) : te("", !0)
|
|
1493
|
+
])) : (O(), P("div", St, [
|
|
1494
|
+
u.keyName ? (O(), P("span", {
|
|
1495
1495
|
key: 0,
|
|
1496
1496
|
class: "json-node__key",
|
|
1497
1497
|
contenteditable: n.value,
|
|
1498
|
-
onDblclick:
|
|
1498
|
+
onDblclick: R,
|
|
1499
1499
|
onKeydown: [
|
|
1500
|
-
|
|
1501
|
-
|
|
1500
|
+
U(Z(T, ["prevent"]), ["enter"]),
|
|
1501
|
+
U(f, ["escape"])
|
|
1502
1502
|
],
|
|
1503
|
-
onBlur:
|
|
1503
|
+
onBlur: T,
|
|
1504
1504
|
ref_key: "keyRef",
|
|
1505
1505
|
ref: l,
|
|
1506
1506
|
title: "Double-click to edit key"
|
|
1507
|
-
},
|
|
1508
|
-
|
|
1507
|
+
}, M(n.value ? i.value : `"${j.value}"`), 41, It)) : te("", !0),
|
|
1508
|
+
u.keyName ? (O(), P("span", Vt, ": ")) : te("", !0),
|
|
1509
1509
|
y("span", {
|
|
1510
|
-
class:
|
|
1511
|
-
onDblclick:
|
|
1512
|
-
title:
|
|
1510
|
+
class: je(["json-node__value-wrapper", ae.value]),
|
|
1511
|
+
onDblclick: V,
|
|
1512
|
+
title: fe.value
|
|
1513
1513
|
}, [
|
|
1514
1514
|
y("span", {
|
|
1515
1515
|
class: "json-node__value",
|
|
1516
1516
|
contenteditable: o.value,
|
|
1517
1517
|
onKeydown: [
|
|
1518
|
-
|
|
1519
|
-
|
|
1518
|
+
U(Z(Q, ["prevent"]), ["enter"]),
|
|
1519
|
+
U(b, ["escape"])
|
|
1520
1520
|
],
|
|
1521
|
-
onBlur:
|
|
1521
|
+
onBlur: Q,
|
|
1522
1522
|
ref_key: "valueRef",
|
|
1523
|
-
ref:
|
|
1524
|
-
},
|
|
1525
|
-
|
|
1526
|
-
], 42,
|
|
1523
|
+
ref: g
|
|
1524
|
+
}, M(o.value ? c.value : ce.value), 41, Lt),
|
|
1525
|
+
u.isLast ? te("", !0) : (O(), P("span", jt, ","))
|
|
1526
|
+
], 42, Rt)
|
|
1527
1527
|
]))
|
|
1528
1528
|
]);
|
|
1529
1529
|
};
|
|
1530
1530
|
}
|
|
1531
|
-
}),
|
|
1531
|
+
}), $e = (r, e) => {
|
|
1532
1532
|
const t = r.__vccOpts || r;
|
|
1533
1533
|
for (const [s, n] of e)
|
|
1534
1534
|
t[s] = n;
|
|
1535
1535
|
return t;
|
|
1536
|
-
},
|
|
1536
|
+
}, Mt = /* @__PURE__ */ $e(Ut, [["__scopeId", "data-v-1472a8af"]]), ze = {
|
|
1537
1537
|
name: "github-light",
|
|
1538
1538
|
colors: {
|
|
1539
1539
|
// 背景色
|
|
@@ -1574,7 +1574,7 @@ const dt = { class: "json-node" }, ft = {
|
|
|
1574
1574
|
// 缩进线
|
|
1575
1575
|
indentLine: "#d0d7de"
|
|
1576
1576
|
}
|
|
1577
|
-
},
|
|
1577
|
+
}, Ft = {
|
|
1578
1578
|
name: "github-dark",
|
|
1579
1579
|
colors: {
|
|
1580
1580
|
// 背景色
|
|
@@ -1615,7 +1615,7 @@ const dt = { class: "json-node" }, ft = {
|
|
|
1615
1615
|
// 缩进线
|
|
1616
1616
|
indentLine: "#30363d"
|
|
1617
1617
|
}
|
|
1618
|
-
},
|
|
1618
|
+
}, Kt = {
|
|
1619
1619
|
name: "min-light",
|
|
1620
1620
|
colors: {
|
|
1621
1621
|
// 背景色 - 纯白简洁
|
|
@@ -1656,7 +1656,7 @@ const dt = { class: "json-node" }, ft = {
|
|
|
1656
1656
|
// 缩进线
|
|
1657
1657
|
indentLine: "#e5e7eb"
|
|
1658
1658
|
}
|
|
1659
|
-
},
|
|
1659
|
+
}, Xt = {
|
|
1660
1660
|
name: "slack-ochin",
|
|
1661
1661
|
colors: {
|
|
1662
1662
|
// 背景色 - 温暖的米色调
|
|
@@ -1697,34 +1697,34 @@ const dt = { class: "json-node" }, ft = {
|
|
|
1697
1697
|
// 缩进线
|
|
1698
1698
|
indentLine: "#e8d5b7"
|
|
1699
1699
|
}
|
|
1700
|
-
},
|
|
1701
|
-
"github-light":
|
|
1702
|
-
"github-dark":
|
|
1703
|
-
"min-light":
|
|
1704
|
-
"slack-ochin":
|
|
1700
|
+
}, Ht = {
|
|
1701
|
+
"github-light": ze,
|
|
1702
|
+
"github-dark": Ft,
|
|
1703
|
+
"min-light": Kt,
|
|
1704
|
+
"slack-ochin": Xt
|
|
1705
1705
|
};
|
|
1706
|
-
function
|
|
1707
|
-
return
|
|
1706
|
+
function qt(r = "github-light") {
|
|
1707
|
+
return Ht[r] || ze;
|
|
1708
1708
|
}
|
|
1709
|
-
const
|
|
1709
|
+
const Wt = {
|
|
1710
1710
|
key: 0,
|
|
1711
1711
|
class: "json-format__toolbar"
|
|
1712
|
-
},
|
|
1712
|
+
}, Qt = { class: "json-format__actions" }, Yt = ["disabled"], Gt = ["disabled"], Zt = ["disabled"], zt = ["disabled"], Dt = { class: "json-format__info" }, Jt = {
|
|
1713
1713
|
key: 0,
|
|
1714
1714
|
class: "json-format__status json-format__status--success"
|
|
1715
|
-
},
|
|
1715
|
+
}, er = {
|
|
1716
1716
|
key: 1,
|
|
1717
1717
|
class: "json-format__status json-format__status--error"
|
|
1718
|
-
},
|
|
1718
|
+
}, tr = { class: "json-format__content" }, rr = {
|
|
1719
1719
|
key: 0,
|
|
1720
1720
|
class: "json-format__error"
|
|
1721
|
-
},
|
|
1721
|
+
}, nr = {
|
|
1722
1722
|
key: 1,
|
|
1723
1723
|
class: "json-format__error"
|
|
1724
|
-
},
|
|
1724
|
+
}, sr = {
|
|
1725
1725
|
key: 2,
|
|
1726
1726
|
class: "json-format__viewer"
|
|
1727
|
-
},
|
|
1727
|
+
}, or = /* @__PURE__ */ Oe({
|
|
1728
1728
|
name: "JsonFormat",
|
|
1729
1729
|
__name: "index",
|
|
1730
1730
|
props: {
|
|
@@ -1736,70 +1736,70 @@ const Rt = {
|
|
|
1736
1736
|
},
|
|
1737
1737
|
emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress"],
|
|
1738
1738
|
setup(r, { expose: e, emit: t }) {
|
|
1739
|
-
|
|
1740
|
-
"325d5f6b":
|
|
1741
|
-
"407388ed":
|
|
1742
|
-
"1276f42c":
|
|
1743
|
-
"34805dc8":
|
|
1744
|
-
"212f19fd":
|
|
1745
|
-
b83cab02:
|
|
1746
|
-
b58ba984:
|
|
1747
|
-
d50a3406:
|
|
1748
|
-
"2421bb5e":
|
|
1749
|
-
"0299816b":
|
|
1750
|
-
"55f370f2":
|
|
1751
|
-
b3fc86b8:
|
|
1752
|
-
"781064f7":
|
|
1753
|
-
"3b9a02e9":
|
|
1739
|
+
Le((f) => ({
|
|
1740
|
+
"325d5f6b": h.value.colors.border,
|
|
1741
|
+
"407388ed": h.value.colors.background,
|
|
1742
|
+
"1276f42c": h.value.colors.text,
|
|
1743
|
+
"34805dc8": h.value.colors.surfaceBackground,
|
|
1744
|
+
"212f19fd": h.value.colors.buttonBorder,
|
|
1745
|
+
b83cab02: h.value.colors.buttonBackground,
|
|
1746
|
+
b58ba984: h.value.colors.buttonText,
|
|
1747
|
+
d50a3406: h.value.colors.buttonBackgroundHover,
|
|
1748
|
+
"2421bb5e": h.value.colors.buttonPrimary,
|
|
1749
|
+
"0299816b": h.value.colors.buttonPrimaryHover,
|
|
1750
|
+
"55f370f2": h.value.colors.successBackground,
|
|
1751
|
+
b3fc86b8: h.value.colors.success,
|
|
1752
|
+
"781064f7": h.value.colors.errorBackground,
|
|
1753
|
+
"3b9a02e9": h.value.colors.error
|
|
1754
1754
|
}));
|
|
1755
|
-
const s = r, n = t, o = W(null), i = W(""), c = W(/* @__PURE__ */ new Set()), a = W(null), l = W(""),
|
|
1756
|
-
if (!
|
|
1755
|
+
const s = r, n = t, o = W(null), i = W(""), c = W(/* @__PURE__ */ new Set()), a = W(null), l = W(""), g = K(() => i.value === ""), h = K(() => qt(s.theme)), x = K(() => l.value ? null : a.value !== null ? a.value : o.value), v = (f) => {
|
|
1756
|
+
if (!f.trim()) {
|
|
1757
1757
|
o.value = null, i.value = "", a.value = null, l.value = "";
|
|
1758
1758
|
return;
|
|
1759
1759
|
}
|
|
1760
1760
|
try {
|
|
1761
|
-
let
|
|
1762
|
-
const
|
|
1763
|
-
if (!
|
|
1761
|
+
let b = f;
|
|
1762
|
+
const u = /(:\s*|,\s*|\[\s*)-?\d{16,}/.test(b), m = /(:\s*|,\s*|\[\s*)-?\d+\.\d*0+\s*[,}\]\s]*/.test(b);
|
|
1763
|
+
if (!u && !m)
|
|
1764
1764
|
try {
|
|
1765
|
-
o.value = JSON.parse(
|
|
1766
|
-
|
|
1765
|
+
o.value = JSON.parse(b), i.value = "", a.value = null, l.value = "", ue(() => {
|
|
1766
|
+
x.value !== null && z();
|
|
1767
1767
|
});
|
|
1768
1768
|
return;
|
|
1769
1769
|
} catch {
|
|
1770
1770
|
}
|
|
1771
|
-
|
|
1772
|
-
let
|
|
1773
|
-
for (;
|
|
1774
|
-
const
|
|
1775
|
-
if (
|
|
1776
|
-
|
|
1777
|
-
else if (
|
|
1778
|
-
|
|
1771
|
+
b = ((A) => {
|
|
1772
|
+
let w = "", L = !1, H = !1, re = 0;
|
|
1773
|
+
for (; re < A.length; ) {
|
|
1774
|
+
const le = A[re];
|
|
1775
|
+
if (L)
|
|
1776
|
+
H ? H = !1 : le === "\\" ? H = !0 : le === '"' && (L = !1), w += le, re++;
|
|
1777
|
+
else if (le === '"')
|
|
1778
|
+
L = !0, w += le, re++;
|
|
1779
1779
|
else {
|
|
1780
|
-
const
|
|
1781
|
-
let
|
|
1782
|
-
if (
|
|
1783
|
-
|
|
1780
|
+
const be = A.slice(re);
|
|
1781
|
+
let oe = be.match(/^([:,\[\s]*)(-?\d{16,})(\s*[,\}\]\s]|$)/);
|
|
1782
|
+
if (oe) {
|
|
1783
|
+
w += oe[1] + '{"__protected_number__":"' + oe[2] + '"}' + oe[3], re += oe[0].length;
|
|
1784
1784
|
continue;
|
|
1785
1785
|
}
|
|
1786
|
-
if (
|
|
1787
|
-
|
|
1786
|
+
if (oe = be.match(/^([:,\[\s]*)(-?\d+\.\d*0+)(\s*[,\}\]\s]|$)/), oe) {
|
|
1787
|
+
w += oe[1] + '{"__protected_number__":"' + oe[2] + '"}' + oe[3], re += oe[0].length;
|
|
1788
1788
|
continue;
|
|
1789
1789
|
}
|
|
1790
|
-
|
|
1790
|
+
w += le, re++;
|
|
1791
1791
|
}
|
|
1792
1792
|
}
|
|
1793
|
-
return
|
|
1794
|
-
})(
|
|
1795
|
-
|
|
1793
|
+
return w;
|
|
1794
|
+
})(b), o.value = JSON.parse(b), i.value = "", a.value = null, l.value = "", ue(() => {
|
|
1795
|
+
x.value !== null && z();
|
|
1796
1796
|
});
|
|
1797
|
-
} catch (
|
|
1798
|
-
i.value =
|
|
1797
|
+
} catch (b) {
|
|
1798
|
+
i.value = b instanceof Error ? b.message : "Unknown parsing error", o.value = null, a.value = null, l.value = "";
|
|
1799
1799
|
}
|
|
1800
|
-
},
|
|
1801
|
-
if (!
|
|
1802
|
-
|
|
1800
|
+
}, B = (f) => {
|
|
1801
|
+
if (!f || !f.expression.trim()) {
|
|
1802
|
+
S();
|
|
1803
1803
|
return;
|
|
1804
1804
|
}
|
|
1805
1805
|
if (!o.value) {
|
|
@@ -1807,275 +1807,275 @@ const Rt = {
|
|
|
1807
1807
|
return;
|
|
1808
1808
|
}
|
|
1809
1809
|
try {
|
|
1810
|
-
let
|
|
1811
|
-
if (
|
|
1812
|
-
|
|
1813
|
-
else if (
|
|
1814
|
-
|
|
1810
|
+
let b;
|
|
1811
|
+
if (f.type === "jsonpath")
|
|
1812
|
+
b = X({ path: f.expression, json: o.value }), b.length === 1 && f.expression.includes("$[") === !1 && !f.expression.endsWith("[*]") ? a.value = b[0] : a.value = b;
|
|
1813
|
+
else if (f.type === "js")
|
|
1814
|
+
b = new Function("data", `
|
|
1815
1815
|
try {
|
|
1816
|
-
return ${
|
|
1816
|
+
return ${f.expression};
|
|
1817
1817
|
} catch (error) {
|
|
1818
1818
|
throw new Error('JavaScript expression error: ' + error.message);
|
|
1819
1819
|
}
|
|
1820
|
-
`)(o.value), a.value =
|
|
1820
|
+
`)(o.value), a.value = b;
|
|
1821
1821
|
else
|
|
1822
|
-
throw new Error(`Unsupported filter type: ${
|
|
1823
|
-
l.value = "",
|
|
1824
|
-
|
|
1822
|
+
throw new Error(`Unsupported filter type: ${f.type}`);
|
|
1823
|
+
l.value = "", ue(() => {
|
|
1824
|
+
z();
|
|
1825
1825
|
});
|
|
1826
|
-
} catch (
|
|
1827
|
-
l.value =
|
|
1826
|
+
} catch (b) {
|
|
1827
|
+
l.value = b instanceof Error ? b.message : "Filter execution error", a.value = null;
|
|
1828
1828
|
}
|
|
1829
|
-
},
|
|
1829
|
+
}, S = () => {
|
|
1830
1830
|
a.value = null, l.value = "";
|
|
1831
1831
|
};
|
|
1832
|
-
|
|
1833
|
-
|
|
1832
|
+
Ge(() => s.modelValue, (f) => {
|
|
1833
|
+
v(f);
|
|
1834
1834
|
}, { immediate: !0 });
|
|
1835
|
-
const
|
|
1836
|
-
const m = (
|
|
1837
|
-
if (
|
|
1838
|
-
return
|
|
1839
|
-
if (!Array.isArray(
|
|
1840
|
-
return `__PROTECTED_NUMBER_${
|
|
1841
|
-
if (Array.isArray(
|
|
1842
|
-
return
|
|
1843
|
-
const
|
|
1844
|
-
for (const [
|
|
1845
|
-
|
|
1846
|
-
return
|
|
1847
|
-
},
|
|
1848
|
-
return JSON.stringify(
|
|
1849
|
-
},
|
|
1835
|
+
const _ = (f, b, u) => {
|
|
1836
|
+
const m = (w) => {
|
|
1837
|
+
if (w === null || typeof w != "object")
|
|
1838
|
+
return w;
|
|
1839
|
+
if (!Array.isArray(w) && "__protected_number__" in w && Object.keys(w).length === 1)
|
|
1840
|
+
return `__PROTECTED_NUMBER_${w.__protected_number__}_PROTECTED_NUMBER__`;
|
|
1841
|
+
if (Array.isArray(w))
|
|
1842
|
+
return w.map((H) => m(H));
|
|
1843
|
+
const L = {};
|
|
1844
|
+
for (const [H, re] of Object.entries(w))
|
|
1845
|
+
L[H] = m(re);
|
|
1846
|
+
return L;
|
|
1847
|
+
}, E = m(f);
|
|
1848
|
+
return JSON.stringify(E, b, u).replace(/"__PROTECTED_NUMBER_(.+?)_PROTECTED_NUMBER__"/g, "$1");
|
|
1849
|
+
}, j = (f, b) => {
|
|
1850
1850
|
if (!s.readonly)
|
|
1851
1851
|
try {
|
|
1852
|
-
const
|
|
1852
|
+
const u = Y(o.value, f, b), m = _(u, null, 2);
|
|
1853
1853
|
n("update:modelValue", m);
|
|
1854
|
-
} catch (
|
|
1855
|
-
console.error("Failed to update JSON:",
|
|
1854
|
+
} catch (u) {
|
|
1855
|
+
console.error("Failed to update JSON:", u);
|
|
1856
1856
|
}
|
|
1857
|
-
},
|
|
1858
|
-
if (!
|
|
1859
|
-
const m =
|
|
1860
|
-
let
|
|
1861
|
-
for (let
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1857
|
+
}, Y = (f, b, u) => {
|
|
1858
|
+
if (!b || b === "root") return u;
|
|
1859
|
+
const m = b.split("."), E = R(f, m.slice(0, -1));
|
|
1860
|
+
let A = E;
|
|
1861
|
+
for (let L = 0; L < m.length - 1; L++) {
|
|
1862
|
+
const H = m[L];
|
|
1863
|
+
H !== "root" && (Array.isArray(A) ? A = A[parseInt(H)] : A = A[H]);
|
|
1864
1864
|
}
|
|
1865
|
-
const
|
|
1866
|
-
return
|
|
1867
|
-
},
|
|
1868
|
-
c.value.has(
|
|
1869
|
-
},
|
|
1870
|
-
const
|
|
1871
|
-
|
|
1872
|
-
const
|
|
1873
|
-
|
|
1874
|
-
}) : Object.keys(
|
|
1875
|
-
const
|
|
1876
|
-
|
|
1865
|
+
const w = m[m.length - 1];
|
|
1866
|
+
return w === "root" ? u : (Array.isArray(A) ? A[parseInt(w)] = u : A[w] = u, E);
|
|
1867
|
+
}, J = (f) => {
|
|
1868
|
+
c.value.has(f) ? c.value.delete(f) : c.value.add(f);
|
|
1869
|
+
}, z = () => {
|
|
1870
|
+
const f = /* @__PURE__ */ new Set(), b = (u, m = "") => {
|
|
1871
|
+
u !== null && typeof u == "object" && (f.add(m || "root"), Array.isArray(u) ? u.forEach((E, A) => {
|
|
1872
|
+
const w = m ? `${m}.${A}` : `${A}`;
|
|
1873
|
+
b(E, w);
|
|
1874
|
+
}) : Object.keys(u).forEach((E) => {
|
|
1875
|
+
const A = m ? `${m}.${E}` : E;
|
|
1876
|
+
b(u[E], A);
|
|
1877
1877
|
}));
|
|
1878
1878
|
};
|
|
1879
|
-
|
|
1880
|
-
},
|
|
1879
|
+
b(x.value), c.value = f, n("expand-all");
|
|
1880
|
+
}, ae = () => {
|
|
1881
1881
|
c.value = /* @__PURE__ */ new Set(["root"]), n("collapse-all");
|
|
1882
|
-
},
|
|
1883
|
-
if (
|
|
1882
|
+
}, ce = async () => {
|
|
1883
|
+
if (g.value)
|
|
1884
1884
|
try {
|
|
1885
|
-
const
|
|
1886
|
-
await navigator.clipboard.writeText(
|
|
1887
|
-
} catch (
|
|
1888
|
-
console.error("Failed to copy JSON:",
|
|
1885
|
+
const f = x.value, b = _(f, null, 2);
|
|
1886
|
+
await navigator.clipboard.writeText(b), n("copy-success", b);
|
|
1887
|
+
} catch (f) {
|
|
1888
|
+
console.error("Failed to copy JSON:", f), n("copy-error", f instanceof Error ? f : new Error("Failed to copy JSON"));
|
|
1889
1889
|
}
|
|
1890
|
-
},
|
|
1891
|
-
if (
|
|
1890
|
+
}, fe = () => {
|
|
1891
|
+
if (g.value)
|
|
1892
1892
|
try {
|
|
1893
|
-
const
|
|
1894
|
-
n("update:modelValue",
|
|
1895
|
-
} catch (
|
|
1896
|
-
console.error("Failed to compress JSON:",
|
|
1893
|
+
const f = x.value, b = _(f);
|
|
1894
|
+
n("update:modelValue", b), n("compress", b);
|
|
1895
|
+
} catch (f) {
|
|
1896
|
+
console.error("Failed to compress JSON:", f);
|
|
1897
1897
|
}
|
|
1898
|
-
},
|
|
1898
|
+
}, se = async (f) => {
|
|
1899
1899
|
try {
|
|
1900
|
-
let
|
|
1901
|
-
typeof
|
|
1902
|
-
} catch (
|
|
1903
|
-
console.error("Failed to copy value:",
|
|
1900
|
+
let b;
|
|
1901
|
+
typeof f == "object" && f !== null && !Array.isArray(f) && "__protected_number__" in f && Object.keys(f).length === 1 ? b = f.__protected_number__ : typeof f == "string" ? b = `"${f}"` : b = JSON.stringify(f), await navigator.clipboard.writeText(b);
|
|
1902
|
+
} catch (b) {
|
|
1903
|
+
console.error("Failed to copy value:", b);
|
|
1904
1904
|
}
|
|
1905
|
-
},
|
|
1905
|
+
}, k = (f, b) => {
|
|
1906
1906
|
if (!s.readonly)
|
|
1907
1907
|
try {
|
|
1908
|
-
const
|
|
1909
|
-
n("update:modelValue", m),
|
|
1910
|
-
} catch (
|
|
1911
|
-
console.error("Failed to rename key:",
|
|
1908
|
+
const u = C(o.value, f, b), m = _(u, null, 2);
|
|
1909
|
+
n("update:modelValue", m), Q(f, b);
|
|
1910
|
+
} catch (u) {
|
|
1911
|
+
console.error("Failed to rename key:", u);
|
|
1912
1912
|
}
|
|
1913
|
-
},
|
|
1914
|
-
if (!
|
|
1915
|
-
const m =
|
|
1913
|
+
}, C = (f, b, u) => {
|
|
1914
|
+
if (!b || b === "root") return f;
|
|
1915
|
+
const m = b.split("."), E = R(f, m.slice(0, -1));
|
|
1916
1916
|
if (m.length === 1) {
|
|
1917
|
-
const
|
|
1918
|
-
return
|
|
1917
|
+
const L = m[0];
|
|
1918
|
+
return E && typeof E == "object" && !Array.isArray(E) ? V(E, L, u) : E;
|
|
1919
1919
|
}
|
|
1920
|
-
let
|
|
1921
|
-
for (let
|
|
1922
|
-
const
|
|
1923
|
-
Array.isArray(
|
|
1920
|
+
let A = E;
|
|
1921
|
+
for (let L = 0; L < m.length - 1; L++) {
|
|
1922
|
+
const H = m[L];
|
|
1923
|
+
Array.isArray(A) ? A = A[parseInt(H)] : A = A[H];
|
|
1924
1924
|
}
|
|
1925
|
-
const
|
|
1926
|
-
if (!Array.isArray(
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1925
|
+
const w = m[m.length - 1];
|
|
1926
|
+
if (!Array.isArray(A) && A && typeof A == "object") {
|
|
1927
|
+
const L = V(A, w, u), H = m.slice(0, -1);
|
|
1928
|
+
H.length > 0 && T(E, H, L);
|
|
1929
1929
|
}
|
|
1930
|
-
return
|
|
1931
|
-
},
|
|
1932
|
-
if (
|
|
1933
|
-
if (Array.isArray(
|
|
1934
|
-
const
|
|
1935
|
-
return
|
|
1936
|
-
} else if (
|
|
1937
|
-
const
|
|
1938
|
-
return
|
|
1930
|
+
return E;
|
|
1931
|
+
}, R = (f, b) => {
|
|
1932
|
+
if (b.length === 0) return f;
|
|
1933
|
+
if (Array.isArray(f)) {
|
|
1934
|
+
const u = [...f], m = b[0], E = parseInt(m);
|
|
1935
|
+
return b.length === 1 || (u[E] = R(f[E], b.slice(1))), u;
|
|
1936
|
+
} else if (f && typeof f == "object") {
|
|
1937
|
+
const u = { ...f }, m = b[0];
|
|
1938
|
+
return b.length === 1 || (u[m] = R(f[m], b.slice(1))), u;
|
|
1939
1939
|
}
|
|
1940
|
-
return
|
|
1941
|
-
},
|
|
1942
|
-
if (!
|
|
1943
|
-
return
|
|
1944
|
-
const m = Object.keys(
|
|
1945
|
-
for (const
|
|
1946
|
-
|
|
1947
|
-
return
|
|
1948
|
-
},
|
|
1949
|
-
let m =
|
|
1950
|
-
for (let
|
|
1951
|
-
const
|
|
1952
|
-
Array.isArray(m) ? m = m[parseInt(
|
|
1940
|
+
return f;
|
|
1941
|
+
}, V = (f, b, u) => {
|
|
1942
|
+
if (!f || typeof f != "object" || Array.isArray(f))
|
|
1943
|
+
return f;
|
|
1944
|
+
const m = Object.keys(f), E = {};
|
|
1945
|
+
for (const A of m)
|
|
1946
|
+
A === b ? E[u] = f[A] : E[A] = f[A];
|
|
1947
|
+
return E;
|
|
1948
|
+
}, T = (f, b, u) => {
|
|
1949
|
+
let m = f;
|
|
1950
|
+
for (let A = 0; A < b.length - 1; A++) {
|
|
1951
|
+
const w = b[A];
|
|
1952
|
+
Array.isArray(m) ? m = m[parseInt(w)] : m = m[w];
|
|
1953
1953
|
}
|
|
1954
|
-
const
|
|
1955
|
-
Array.isArray(m) ? m[parseInt(
|
|
1956
|
-
},
|
|
1957
|
-
const
|
|
1954
|
+
const E = b[b.length - 1];
|
|
1955
|
+
Array.isArray(m) ? m[parseInt(E)] = u : m[E] = u;
|
|
1956
|
+
}, Q = (f, b) => {
|
|
1957
|
+
const u = /* @__PURE__ */ new Set();
|
|
1958
1958
|
c.value.forEach((m) => {
|
|
1959
|
-
if (m ===
|
|
1960
|
-
const
|
|
1961
|
-
|
|
1962
|
-
} else if (m.startsWith(
|
|
1963
|
-
const
|
|
1964
|
-
|
|
1965
|
-
const
|
|
1966
|
-
|
|
1959
|
+
if (m === f) {
|
|
1960
|
+
const E = f.split(".");
|
|
1961
|
+
E[E.length - 1] = b, u.add(E.join("."));
|
|
1962
|
+
} else if (m.startsWith(f + ".")) {
|
|
1963
|
+
const E = f.split(".");
|
|
1964
|
+
E[E.length - 1] = b;
|
|
1965
|
+
const A = E.join("."), w = m.substring(f.length);
|
|
1966
|
+
u.add(A + w);
|
|
1967
1967
|
} else
|
|
1968
|
-
|
|
1969
|
-
}), c.value =
|
|
1968
|
+
u.add(m);
|
|
1969
|
+
}), c.value = u;
|
|
1970
1970
|
};
|
|
1971
1971
|
return e({
|
|
1972
1972
|
// 核心操作方法
|
|
1973
|
-
copyJson:
|
|
1974
|
-
compressSource:
|
|
1975
|
-
expandAll:
|
|
1976
|
-
collapseAll:
|
|
1977
|
-
toggleExpand:
|
|
1978
|
-
updateValue:
|
|
1979
|
-
updateKey:
|
|
1973
|
+
copyJson: ce,
|
|
1974
|
+
compressSource: fe,
|
|
1975
|
+
expandAll: z,
|
|
1976
|
+
collapseAll: ae,
|
|
1977
|
+
toggleExpand: J,
|
|
1978
|
+
updateValue: j,
|
|
1979
|
+
updateKey: k,
|
|
1980
1980
|
// Filter 相关方法
|
|
1981
|
-
filter:
|
|
1982
|
-
clearFilter:
|
|
1981
|
+
filter: B,
|
|
1982
|
+
clearFilter: S,
|
|
1983
1983
|
// 状态访问方法
|
|
1984
|
-
isValidJson: () =>
|
|
1984
|
+
isValidJson: () => g.value,
|
|
1985
1985
|
getParsedJson: () => o.value,
|
|
1986
1986
|
getFilteredJson: () => a.value,
|
|
1987
1987
|
getExpandedNodes: () => c.value,
|
|
1988
1988
|
getParseError: () => i.value,
|
|
1989
1989
|
getFilterError: () => l.value,
|
|
1990
1990
|
// 工具方法
|
|
1991
|
-
parseJson: (
|
|
1992
|
-
copyValue: (
|
|
1993
|
-
}), (
|
|
1994
|
-
class:
|
|
1991
|
+
parseJson: (f) => v(f),
|
|
1992
|
+
copyValue: (f) => se(f)
|
|
1993
|
+
}), (f, b) => (O(), P("div", {
|
|
1994
|
+
class: je(["json-format", `json-format--${h.value.name}`])
|
|
1995
1995
|
}, [
|
|
1996
|
-
|
|
1997
|
-
y("div",
|
|
1996
|
+
f.showToolbar ? (O(), P("div", Wt, [
|
|
1997
|
+
y("div", Qt, [
|
|
1998
1998
|
y("button", {
|
|
1999
1999
|
class: "json-format__btn json-format__btn--primary",
|
|
2000
|
-
onClick:
|
|
2001
|
-
disabled: !
|
|
2000
|
+
onClick: ce,
|
|
2001
|
+
disabled: !g.value,
|
|
2002
2002
|
title: "Copy JSON"
|
|
2003
|
-
}, " 📋 Copy ", 8,
|
|
2003
|
+
}, " 📋 Copy ", 8, Yt),
|
|
2004
2004
|
y("button", {
|
|
2005
2005
|
class: "json-format__btn json-format__btn--secondary",
|
|
2006
|
-
onClick:
|
|
2007
|
-
disabled: !
|
|
2006
|
+
onClick: z,
|
|
2007
|
+
disabled: !g.value,
|
|
2008
2008
|
title: "Expand All"
|
|
2009
|
-
}, " ⬇️ Expand All ", 8,
|
|
2009
|
+
}, " ⬇️ Expand All ", 8, Gt),
|
|
2010
2010
|
y("button", {
|
|
2011
2011
|
class: "json-format__btn json-format__btn--secondary",
|
|
2012
|
-
onClick:
|
|
2013
|
-
disabled: !
|
|
2012
|
+
onClick: ae,
|
|
2013
|
+
disabled: !g.value,
|
|
2014
2014
|
title: "Collapse All"
|
|
2015
|
-
}, " ➡️ Collapse All ", 8,
|
|
2015
|
+
}, " ➡️ Collapse All ", 8, Zt),
|
|
2016
2016
|
y("button", {
|
|
2017
2017
|
class: "json-format__btn json-format__btn--secondary",
|
|
2018
|
-
onClick:
|
|
2019
|
-
disabled: !
|
|
2018
|
+
onClick: fe,
|
|
2019
|
+
disabled: !g.value,
|
|
2020
2020
|
title: "Compress JSON"
|
|
2021
|
-
}, " 📦 Compress ", 8,
|
|
2021
|
+
}, " 📦 Compress ", 8, zt)
|
|
2022
2022
|
]),
|
|
2023
|
-
y("div",
|
|
2024
|
-
|
|
2023
|
+
y("div", Dt, [
|
|
2024
|
+
g.value ? (O(), P("span", Jt, " ✅ Valid JSON ")) : (O(), P("span", er, " ❌ Invalid JSON "))
|
|
2025
2025
|
])
|
|
2026
|
-
])) :
|
|
2027
|
-
y("div",
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
y("pre", null,
|
|
2031
|
-
])) : (
|
|
2032
|
-
|
|
2033
|
-
value:
|
|
2026
|
+
])) : te("", !0),
|
|
2027
|
+
y("div", tr, [
|
|
2028
|
+
g.value ? l.value ? (O(), P("div", nr, [
|
|
2029
|
+
b[1] || (b[1] = y("h4", null, "Filter Error:", -1)),
|
|
2030
|
+
y("pre", null, M(l.value), 1)
|
|
2031
|
+
])) : (O(), P("div", sr, [
|
|
2032
|
+
Ye(Mt, {
|
|
2033
|
+
value: x.value,
|
|
2034
2034
|
"key-name": "",
|
|
2035
2035
|
level: 0,
|
|
2036
2036
|
expanded: c.value,
|
|
2037
2037
|
"is-last": !0,
|
|
2038
|
-
theme:
|
|
2039
|
-
"onUpdate:value":
|
|
2040
|
-
onToggleExpand:
|
|
2041
|
-
onCopy:
|
|
2042
|
-
"onUpdate:key":
|
|
2038
|
+
theme: h.value,
|
|
2039
|
+
"onUpdate:value": j,
|
|
2040
|
+
onToggleExpand: J,
|
|
2041
|
+
onCopy: se,
|
|
2042
|
+
"onUpdate:key": k
|
|
2043
2043
|
}, null, 8, ["value", "expanded", "theme"])
|
|
2044
|
-
])) : (
|
|
2045
|
-
|
|
2046
|
-
y("pre", null,
|
|
2044
|
+
])) : (O(), P("div", rr, [
|
|
2045
|
+
b[0] || (b[0] = y("h4", null, "JSON Parse Error:", -1)),
|
|
2046
|
+
y("pre", null, M(i.value), 1)
|
|
2047
2047
|
]))
|
|
2048
2048
|
])
|
|
2049
2049
|
], 2));
|
|
2050
2050
|
}
|
|
2051
|
-
}),
|
|
2051
|
+
}), ir = /* @__PURE__ */ $e(or, [["__scopeId", "data-v-b956002c"]]), ar = {
|
|
2052
2052
|
key: 0,
|
|
2053
2053
|
class: "xml-node__comment"
|
|
2054
|
-
},
|
|
2054
|
+
}, lr = {
|
|
2055
2055
|
key: 1,
|
|
2056
2056
|
class: "xml-node__cdata"
|
|
2057
|
-
},
|
|
2057
|
+
}, cr = {
|
|
2058
2058
|
key: 2,
|
|
2059
2059
|
class: "xml-node__element"
|
|
2060
|
-
},
|
|
2060
|
+
}, ur = {
|
|
2061
2061
|
key: 0,
|
|
2062
2062
|
class: "xml-node__line"
|
|
2063
|
-
},
|
|
2063
|
+
}, dr = ["contenteditable", "onKeydown"], fr = ["contenteditable", "onDblclick", "onKeydown"], hr = ["contenteditable", "onDblclick", "onKeydown"], pr = {
|
|
2064
2064
|
key: 1,
|
|
2065
2065
|
class: "xml-node__line"
|
|
2066
|
-
},
|
|
2066
|
+
}, gr = ["contenteditable", "onKeydown"], mr = ["contenteditable", "onDblclick", "onKeydown"], br = ["contenteditable", "onDblclick", "onKeydown"], yr = ["contenteditable", "onKeydown"], vr = { key: 2 }, _r = {
|
|
2067
2067
|
key: 0,
|
|
2068
2068
|
class: "xml-node__line"
|
|
2069
|
-
},
|
|
2069
|
+
}, xr = ["contenteditable", "onKeydown"], Er = ["contenteditable", "onDblclick", "onKeydown"], kr = ["contenteditable", "onDblclick", "onKeydown"], Ar = ["title"], wr = { class: "xml-node__line" }, Nr = ["title"], Cr = ["contenteditable", "onKeydown"], Tr = { key: 1 }, Or = ["contenteditable", "onKeydown"], $r = ["contenteditable", "onDblclick", "onKeydown"], Pr = ["contenteditable", "onDblclick", "onKeydown"], Br = ["title"], Sr = {
|
|
2070
2070
|
key: 0,
|
|
2071
2071
|
class: "xml-node__children"
|
|
2072
|
-
},
|
|
2072
|
+
}, Ir = {
|
|
2073
2073
|
key: 0,
|
|
2074
2074
|
class: "xml-node__text"
|
|
2075
|
-
},
|
|
2075
|
+
}, Vr = ["contenteditable", "onKeydown"], Rr = {
|
|
2076
2076
|
key: 1,
|
|
2077
2077
|
class: "xml-node__line"
|
|
2078
|
-
},
|
|
2078
|
+
}, Lr = /* @__PURE__ */ Oe({
|
|
2079
2079
|
__name: "XmlNode",
|
|
2080
2080
|
props: {
|
|
2081
2081
|
node: {},
|
|
@@ -2085,353 +2085,605 @@ const Rt = {
|
|
|
2085
2085
|
expanded: {},
|
|
2086
2086
|
theme: {}
|
|
2087
2087
|
},
|
|
2088
|
-
emits: ["toggle-expand", "copy"],
|
|
2088
|
+
emits: ["toggle-expand", "copy", "update:tagName", "update:attributeName", "update:attributeValue", "update:textContent"],
|
|
2089
2089
|
setup(r, { emit: e }) {
|
|
2090
|
-
const t = r, s = e, n =
|
|
2091
|
-
const p = t.node[":@"] || {},
|
|
2092
|
-
return Object.keys(p).forEach((
|
|
2093
|
-
|
|
2094
|
-
}),
|
|
2095
|
-
}),
|
|
2096
|
-
if (
|
|
2097
|
-
const p = t.node[
|
|
2090
|
+
const t = r, s = e, n = W(!1), o = W(null), i = W(null), c = W(!1), a = W(""), l = W(""), g = W(""), h = W(""), x = W(null), v = W(null), B = W(null), S = W(null), _ = K(() => Object.keys(t.node).find((N) => !N.startsWith(":") && !N.startsWith("#")) || ""), j = K(() => _.value ? t.parentPath ? `${t.parentPath}.${_.value}[${t.index}]` : `${_.value}[${t.index}]` : ""), Y = K(() => t.expanded.has(j.value)), J = K(() => t.node["#comment"] ? "comment" : t.node.__cdata ? "cdata" : _.value ? "element" : "unknown"), z = K(() => {
|
|
2091
|
+
const p = t.node[":@"] || {}, N = {};
|
|
2092
|
+
return Object.keys(p).forEach((D) => {
|
|
2093
|
+
D.startsWith("@_") && (N[D.substring(2)] = p[D]);
|
|
2094
|
+
}), N;
|
|
2095
|
+
}), ae = K(() => {
|
|
2096
|
+
if (J.value !== "element" || !_.value) return [];
|
|
2097
|
+
const p = t.node[_.value];
|
|
2098
2098
|
return Array.isArray(p) ? p : [];
|
|
2099
|
-
}),
|
|
2100
|
-
if (!
|
|
2101
|
-
const p =
|
|
2099
|
+
}), ce = K(() => ae.value.some((p) => p.__cdata)), fe = K(() => {
|
|
2100
|
+
if (!ce.value) return "";
|
|
2101
|
+
const p = ae.value.find((N) => N.__cdata);
|
|
2102
2102
|
if (p && Array.isArray(p.__cdata)) {
|
|
2103
|
-
const
|
|
2104
|
-
if (
|
|
2105
|
-
return
|
|
2103
|
+
const N = p.__cdata;
|
|
2104
|
+
if (N.length > 0 && N[0]["#text"])
|
|
2105
|
+
return N[0]["#text"];
|
|
2106
2106
|
}
|
|
2107
2107
|
return "";
|
|
2108
|
-
}),
|
|
2109
|
-
if (
|
|
2110
|
-
const p = t.node[
|
|
2108
|
+
}), se = K(() => {
|
|
2109
|
+
if (J.value !== "element" || !_.value || ce.value) return "";
|
|
2110
|
+
const p = t.node[_.value];
|
|
2111
2111
|
if (!Array.isArray(p)) return "";
|
|
2112
|
-
const
|
|
2113
|
-
return
|
|
2114
|
-
}),
|
|
2115
|
-
if (
|
|
2112
|
+
const N = p.find((D) => D["#text"]);
|
|
2113
|
+
return N ? N["#text"] : "";
|
|
2114
|
+
}), k = K(() => {
|
|
2115
|
+
if (J.value !== "comment") return "";
|
|
2116
2116
|
const p = t.node["#comment"];
|
|
2117
2117
|
return Array.isArray(p) && p.length > 0 && p[0]["#text"] || "";
|
|
2118
|
-
}),
|
|
2119
|
-
|
|
2120
|
-
},
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2118
|
+
}), C = K(() => ae.value.some((p) => Object.keys(p).some((D) => !D.startsWith("#") && !D.startsWith(":")))), R = K(() => C.value ? ae.value.filter((p) => Object.keys(p).some((D) => !D.startsWith("#") && !D.startsWith(":"))).length : 0), V = K(() => J.value === "element" && !C.value && se.value.trim() !== ""), T = () => {
|
|
2119
|
+
C.value && s("toggle-expand", j.value);
|
|
2120
|
+
}, Q = (p, N) => `${j.value}-child-${N}`, f = () => `${j.value}.${_.value}`, b = () => {
|
|
2121
|
+
n.value = !0, a.value = _.value, ue(() => {
|
|
2122
|
+
if (x.value) {
|
|
2123
|
+
x.value.focus();
|
|
2124
|
+
const p = document.createRange();
|
|
2125
|
+
p.selectNodeContents(x.value);
|
|
2126
|
+
const N = window.getSelection();
|
|
2127
|
+
N?.removeAllRanges(), N?.addRange(p);
|
|
2128
|
+
}
|
|
2129
|
+
});
|
|
2130
|
+
}, u = (p) => {
|
|
2131
|
+
o.value = p, l.value = p, ue(() => {
|
|
2132
|
+
if (v.value) {
|
|
2133
|
+
v.value.focus();
|
|
2134
|
+
const N = document.createRange();
|
|
2135
|
+
N.selectNodeContents(v.value);
|
|
2136
|
+
const D = window.getSelection();
|
|
2137
|
+
D?.removeAllRanges(), D?.addRange(N);
|
|
2138
|
+
}
|
|
2139
|
+
});
|
|
2140
|
+
}, m = (p) => {
|
|
2141
|
+
i.value = p, g.value = z.value[p] || "", ue(() => {
|
|
2142
|
+
if (B.value) {
|
|
2143
|
+
B.value.focus();
|
|
2144
|
+
const N = document.createRange();
|
|
2145
|
+
N.selectNodeContents(B.value);
|
|
2146
|
+
const D = window.getSelection();
|
|
2147
|
+
D?.removeAllRanges(), D?.addRange(N);
|
|
2148
|
+
}
|
|
2149
|
+
});
|
|
2150
|
+
}, E = () => {
|
|
2151
|
+
c.value = !0, h.value = se.value, ue(() => {
|
|
2152
|
+
if (S.value) {
|
|
2153
|
+
S.value.focus();
|
|
2154
|
+
const p = document.createRange();
|
|
2155
|
+
p.selectNodeContents(S.value);
|
|
2156
|
+
const N = window.getSelection();
|
|
2157
|
+
N?.removeAllRanges(), N?.addRange(p);
|
|
2158
|
+
}
|
|
2159
|
+
});
|
|
2160
|
+
}, A = () => {
|
|
2161
|
+
if (!n.value) return;
|
|
2162
|
+
const p = x.value?.innerText.trim() || "";
|
|
2163
|
+
if (!p || p === _.value) {
|
|
2164
|
+
n.value = !1;
|
|
2165
|
+
return;
|
|
2166
|
+
}
|
|
2167
|
+
n.value = !1, s("update:tagName", j.value, _.value, p);
|
|
2168
|
+
}, w = () => {
|
|
2169
|
+
if (!o.value) return;
|
|
2170
|
+
const p = o.value, N = v.value?.innerText.trim() || "";
|
|
2171
|
+
if (!N || N === p) {
|
|
2172
|
+
o.value = null;
|
|
2173
|
+
return;
|
|
2174
|
+
}
|
|
2175
|
+
o.value = null, s("update:attributeName", j.value, p, N);
|
|
2176
|
+
}, L = () => {
|
|
2177
|
+
if (!i.value) return;
|
|
2178
|
+
const p = i.value, N = B.value?.innerText.trim() || "";
|
|
2179
|
+
i.value = null, s("update:attributeValue", j.value, p, N);
|
|
2180
|
+
}, H = () => {
|
|
2181
|
+
if (!c.value) return;
|
|
2182
|
+
const p = S.value?.innerText || "";
|
|
2183
|
+
if (p === se.value) {
|
|
2184
|
+
c.value = !1;
|
|
2185
|
+
return;
|
|
2186
|
+
}
|
|
2187
|
+
c.value = !1, s("update:textContent", j.value, p);
|
|
2188
|
+
}, re = () => {
|
|
2189
|
+
n.value = !1, a.value = _.value;
|
|
2190
|
+
}, le = () => {
|
|
2191
|
+
o.value && (l.value = o.value, o.value = null);
|
|
2192
|
+
}, be = () => {
|
|
2193
|
+
i.value && (g.value = z.value[i.value] || "", i.value = null);
|
|
2194
|
+
}, oe = () => {
|
|
2195
|
+
c.value = !1, h.value = se.value;
|
|
2196
|
+
}, Ce = (p) => {
|
|
2197
|
+
C.value && (p.preventDefault(), b());
|
|
2198
|
+
};
|
|
2199
|
+
return (p, N) => {
|
|
2200
|
+
const D = Qe("XmlNode", !0);
|
|
2201
|
+
return O(), P("div", {
|
|
2124
2202
|
class: "xml-node",
|
|
2125
|
-
style:
|
|
2203
|
+
style: $({ paddingLeft: p.level > 0 ? "16px" : "0" })
|
|
2126
2204
|
}, [
|
|
2127
|
-
|
|
2205
|
+
J.value === "comment" ? (O(), P("div", ar, [
|
|
2128
2206
|
y("span", {
|
|
2129
|
-
style:
|
|
2130
|
-
}, " <!-- " +
|
|
2131
|
-
])) :
|
|
2207
|
+
style: $({ color: p.theme.colors.xmlComment })
|
|
2208
|
+
}, " <!-- " + M(k.value) + " --> ", 5)
|
|
2209
|
+
])) : J.value === "cdata" ? (O(), P("div", lr, [
|
|
2132
2210
|
y("span", {
|
|
2133
|
-
style:
|
|
2134
|
-
}, " <![CDATA[" +
|
|
2135
|
-
])) :
|
|
2136
|
-
|
|
2211
|
+
style: $({ color: p.theme.colors.xmlCdata })
|
|
2212
|
+
}, " <![CDATA[" + M(p.node.__cdata) + "]]> ", 5)
|
|
2213
|
+
])) : J.value === "element" ? (O(), P("div", cr, [
|
|
2214
|
+
ce.value ? (O(), P("div", ur, [
|
|
2137
2215
|
y("span", {
|
|
2138
2216
|
class: "xml-node__bracket",
|
|
2139
|
-
style:
|
|
2217
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2140
2218
|
}, "<", 4),
|
|
2141
2219
|
y("span", {
|
|
2142
|
-
class: "xml-node__tag",
|
|
2143
|
-
style:
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2220
|
+
class: "xml-node__tag xml-node__tag--editable",
|
|
2221
|
+
style: $({ color: p.theme.colors.xmlTag }),
|
|
2222
|
+
contenteditable: n.value,
|
|
2223
|
+
onDblclick: b,
|
|
2224
|
+
onContextmenu: Ce,
|
|
2225
|
+
onKeydown: [
|
|
2226
|
+
U(Z(A, ["prevent"]), ["enter"]),
|
|
2227
|
+
U(re, ["escape"])
|
|
2228
|
+
],
|
|
2229
|
+
onBlur: A,
|
|
2230
|
+
ref_key: "tagNameRef",
|
|
2231
|
+
ref: x,
|
|
2232
|
+
title: "Double-click to edit tag name"
|
|
2233
|
+
}, M(n.value ? a.value : _.value), 45, dr),
|
|
2234
|
+
(O(!0), P(pe, null, _e(z.value, (ee, I) => (O(), P("span", {
|
|
2235
|
+
key: I,
|
|
2147
2236
|
class: "xml-node__attribute"
|
|
2148
2237
|
}, [
|
|
2149
2238
|
y("span", {
|
|
2150
|
-
class: "xml-node__attr-name",
|
|
2151
|
-
style:
|
|
2152
|
-
|
|
2239
|
+
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
2240
|
+
style: $({ color: p.theme.colors.xmlAttribute }),
|
|
2241
|
+
contenteditable: o.value === I,
|
|
2242
|
+
onDblclick: (F) => u(I),
|
|
2243
|
+
onKeydown: [
|
|
2244
|
+
U(Z(w, ["prevent"]), ["enter"]),
|
|
2245
|
+
U(le, ["escape"])
|
|
2246
|
+
],
|
|
2247
|
+
onBlur: w,
|
|
2248
|
+
ref_for: !0,
|
|
2249
|
+
ref: (F) => {
|
|
2250
|
+
o.value === I && (v.value = F);
|
|
2251
|
+
},
|
|
2252
|
+
title: "Double-click to edit attribute name"
|
|
2253
|
+
}, M(o.value === I ? l.value : I), 45, fr),
|
|
2153
2254
|
y("span", {
|
|
2154
2255
|
class: "xml-node__equals",
|
|
2155
|
-
style:
|
|
2256
|
+
style: $({ color: p.theme.colors.xmlEquals })
|
|
2156
2257
|
}, "=", 4),
|
|
2157
2258
|
y("span", {
|
|
2158
2259
|
class: "xml-node__quote",
|
|
2159
|
-
style:
|
|
2260
|
+
style: $({ color: p.theme.colors.xmlQuote })
|
|
2160
2261
|
}, '"', 4),
|
|
2161
2262
|
y("span", {
|
|
2162
|
-
class: "xml-node__attr-value",
|
|
2163
|
-
style:
|
|
2164
|
-
|
|
2263
|
+
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
2264
|
+
style: $({ color: p.theme.colors.xmlAttributeValue }),
|
|
2265
|
+
contenteditable: i.value === I,
|
|
2266
|
+
onDblclick: (F) => m(I),
|
|
2267
|
+
onKeydown: [
|
|
2268
|
+
U(Z(L, ["prevent"]), ["enter"]),
|
|
2269
|
+
U(be, ["escape"])
|
|
2270
|
+
],
|
|
2271
|
+
onBlur: L,
|
|
2272
|
+
ref_for: !0,
|
|
2273
|
+
ref: (F) => {
|
|
2274
|
+
i.value === I && (B.value = F);
|
|
2275
|
+
},
|
|
2276
|
+
title: "Double-click to edit attribute value"
|
|
2277
|
+
}, M(i.value === I ? g.value : ee), 45, hr),
|
|
2165
2278
|
y("span", {
|
|
2166
2279
|
class: "xml-node__quote",
|
|
2167
|
-
style:
|
|
2280
|
+
style: $({ color: p.theme.colors.xmlQuote })
|
|
2168
2281
|
}, '"', 4)
|
|
2169
2282
|
]))), 128)),
|
|
2170
2283
|
y("span", {
|
|
2171
2284
|
class: "xml-node__bracket",
|
|
2172
|
-
style:
|
|
2285
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2173
2286
|
}, ">", 4),
|
|
2174
2287
|
y("span", {
|
|
2175
2288
|
class: "xml-node__cdata",
|
|
2176
|
-
style:
|
|
2177
|
-
}, "<![CDATA[" +
|
|
2289
|
+
style: $({ color: p.theme.colors.xmlCdata })
|
|
2290
|
+
}, "<![CDATA[" + M(fe.value) + "]]>", 5),
|
|
2178
2291
|
y("span", {
|
|
2179
2292
|
class: "xml-node__bracket",
|
|
2180
|
-
style:
|
|
2293
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2181
2294
|
}, "</", 4),
|
|
2182
2295
|
y("span", {
|
|
2183
2296
|
class: "xml-node__tag",
|
|
2184
|
-
style:
|
|
2185
|
-
},
|
|
2297
|
+
style: $({ color: p.theme.colors.xmlTag })
|
|
2298
|
+
}, M(n.value ? a.value : _.value), 5),
|
|
2186
2299
|
y("span", {
|
|
2187
2300
|
class: "xml-node__bracket",
|
|
2188
|
-
style:
|
|
2301
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2189
2302
|
}, ">", 4)
|
|
2190
|
-
])) :
|
|
2303
|
+
])) : V.value ? (O(), P("div", pr, [
|
|
2191
2304
|
y("span", {
|
|
2192
2305
|
class: "xml-node__bracket",
|
|
2193
|
-
style:
|
|
2306
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2194
2307
|
}, "<", 4),
|
|
2195
2308
|
y("span", {
|
|
2196
|
-
class: "xml-node__tag",
|
|
2197
|
-
style:
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2309
|
+
class: "xml-node__tag xml-node__tag--editable",
|
|
2310
|
+
style: $({ color: p.theme.colors.xmlTag }),
|
|
2311
|
+
contenteditable: n.value,
|
|
2312
|
+
onDblclick: b,
|
|
2313
|
+
onContextmenu: Ce,
|
|
2314
|
+
onKeydown: [
|
|
2315
|
+
U(Z(A, ["prevent"]), ["enter"]),
|
|
2316
|
+
U(re, ["escape"])
|
|
2317
|
+
],
|
|
2318
|
+
onBlur: A,
|
|
2319
|
+
ref_key: "tagNameRef",
|
|
2320
|
+
ref: x,
|
|
2321
|
+
title: "Double-click to edit tag name"
|
|
2322
|
+
}, M(n.value ? a.value : _.value), 45, gr),
|
|
2323
|
+
(O(!0), P(pe, null, _e(z.value, (ee, I) => (O(), P("span", {
|
|
2324
|
+
key: I,
|
|
2201
2325
|
class: "xml-node__attribute"
|
|
2202
2326
|
}, [
|
|
2203
2327
|
y("span", {
|
|
2204
|
-
class: "xml-node__attr-name",
|
|
2205
|
-
style:
|
|
2206
|
-
|
|
2328
|
+
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
2329
|
+
style: $({ color: p.theme.colors.xmlAttribute }),
|
|
2330
|
+
contenteditable: o.value === I,
|
|
2331
|
+
onDblclick: (F) => u(I),
|
|
2332
|
+
onKeydown: [
|
|
2333
|
+
U(Z(w, ["prevent"]), ["enter"]),
|
|
2334
|
+
U(le, ["escape"])
|
|
2335
|
+
],
|
|
2336
|
+
onBlur: w,
|
|
2337
|
+
ref_for: !0,
|
|
2338
|
+
ref: (F) => {
|
|
2339
|
+
o.value === I && (v.value = F);
|
|
2340
|
+
},
|
|
2341
|
+
title: "Double-click to edit attribute name"
|
|
2342
|
+
}, M(o.value === I ? l.value : I), 45, mr),
|
|
2207
2343
|
y("span", {
|
|
2208
2344
|
class: "xml-node__equals",
|
|
2209
|
-
style:
|
|
2345
|
+
style: $({ color: p.theme.colors.xmlEquals })
|
|
2210
2346
|
}, "=", 4),
|
|
2211
2347
|
y("span", {
|
|
2212
2348
|
class: "xml-node__quote",
|
|
2213
|
-
style:
|
|
2349
|
+
style: $({ color: p.theme.colors.xmlQuote })
|
|
2214
2350
|
}, '"', 4),
|
|
2215
2351
|
y("span", {
|
|
2216
|
-
class: "xml-node__attr-value",
|
|
2217
|
-
style:
|
|
2218
|
-
|
|
2352
|
+
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
2353
|
+
style: $({ color: p.theme.colors.xmlAttributeValue }),
|
|
2354
|
+
contenteditable: i.value === I,
|
|
2355
|
+
onDblclick: (F) => m(I),
|
|
2356
|
+
onKeydown: [
|
|
2357
|
+
U(Z(L, ["prevent"]), ["enter"]),
|
|
2358
|
+
U(be, ["escape"])
|
|
2359
|
+
],
|
|
2360
|
+
onBlur: L,
|
|
2361
|
+
ref_for: !0,
|
|
2362
|
+
ref: (F) => {
|
|
2363
|
+
i.value === I && (B.value = F);
|
|
2364
|
+
},
|
|
2365
|
+
title: "Double-click to edit attribute value"
|
|
2366
|
+
}, M(i.value === I ? g.value : ee), 45, br),
|
|
2219
2367
|
y("span", {
|
|
2220
2368
|
class: "xml-node__quote",
|
|
2221
|
-
style:
|
|
2369
|
+
style: $({ color: p.theme.colors.xmlQuote })
|
|
2222
2370
|
}, '"', 4)
|
|
2223
2371
|
]))), 128)),
|
|
2224
2372
|
y("span", {
|
|
2225
2373
|
class: "xml-node__bracket",
|
|
2226
|
-
style:
|
|
2374
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2227
2375
|
}, ">", 4),
|
|
2228
2376
|
y("span", {
|
|
2229
|
-
class: "xml-node__text-content",
|
|
2230
|
-
style:
|
|
2231
|
-
|
|
2377
|
+
class: "xml-node__text-content xml-node__text-content--editable",
|
|
2378
|
+
style: $({ color: p.theme.colors.xmlText }),
|
|
2379
|
+
contenteditable: c.value,
|
|
2380
|
+
onDblclick: E,
|
|
2381
|
+
onKeydown: [
|
|
2382
|
+
U(Z(H, ["prevent"]), ["enter"]),
|
|
2383
|
+
U(oe, ["escape"])
|
|
2384
|
+
],
|
|
2385
|
+
onBlur: H,
|
|
2386
|
+
ref_key: "textContentRef",
|
|
2387
|
+
ref: S,
|
|
2388
|
+
title: "Double-click to edit text content"
|
|
2389
|
+
}, M(c.value ? h.value : se.value), 45, yr),
|
|
2232
2390
|
y("span", {
|
|
2233
2391
|
class: "xml-node__bracket",
|
|
2234
|
-
style:
|
|
2392
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2235
2393
|
}, "</", 4),
|
|
2236
2394
|
y("span", {
|
|
2237
2395
|
class: "xml-node__tag",
|
|
2238
|
-
style:
|
|
2239
|
-
},
|
|
2396
|
+
style: $({ color: p.theme.colors.xmlTag })
|
|
2397
|
+
}, M(n.value ? a.value : _.value), 5),
|
|
2240
2398
|
y("span", {
|
|
2241
2399
|
class: "xml-node__bracket",
|
|
2242
|
-
style:
|
|
2400
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2243
2401
|
}, ">", 4)
|
|
2244
|
-
])) : (
|
|
2245
|
-
!
|
|
2402
|
+
])) : (O(), P("div", vr, [
|
|
2403
|
+
!Y.value && C.value ? (O(), P("div", _r, [
|
|
2246
2404
|
y("span", {
|
|
2247
2405
|
class: "xml-node__clickable-part",
|
|
2248
|
-
onClick:
|
|
2406
|
+
onClick: N[0] || (N[0] = (ee) => T()),
|
|
2249
2407
|
title: "Click to expand"
|
|
2250
2408
|
}, [
|
|
2251
2409
|
y("span", {
|
|
2252
2410
|
class: "xml-node__bracket",
|
|
2253
|
-
style:
|
|
2411
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2254
2412
|
}, "<", 4),
|
|
2255
2413
|
y("span", {
|
|
2256
|
-
class: "xml-node__tag",
|
|
2257
|
-
style:
|
|
2258
|
-
|
|
2414
|
+
class: "xml-node__tag xml-node__tag--editable",
|
|
2415
|
+
style: $({ color: p.theme.colors.xmlTag }),
|
|
2416
|
+
contenteditable: n.value,
|
|
2417
|
+
onDblclick: Z(b, ["stop"]),
|
|
2418
|
+
onContextmenu: Ce,
|
|
2419
|
+
onKeydown: [
|
|
2420
|
+
U(Z(A, ["prevent"]), ["enter"]),
|
|
2421
|
+
U(re, ["escape"])
|
|
2422
|
+
],
|
|
2423
|
+
onBlur: A,
|
|
2424
|
+
ref_key: "tagNameRef",
|
|
2425
|
+
ref: x,
|
|
2426
|
+
title: "Double-click or right-click to edit tag name"
|
|
2427
|
+
}, M(n.value ? a.value : _.value), 45, xr)
|
|
2259
2428
|
]),
|
|
2260
|
-
(
|
|
2261
|
-
key:
|
|
2429
|
+
(O(!0), P(pe, null, _e(z.value, (ee, I) => (O(), P("span", {
|
|
2430
|
+
key: I,
|
|
2262
2431
|
class: "xml-node__attribute"
|
|
2263
2432
|
}, [
|
|
2264
2433
|
y("span", {
|
|
2265
|
-
class: "xml-node__attr-name",
|
|
2266
|
-
style:
|
|
2267
|
-
|
|
2434
|
+
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
2435
|
+
style: $({ color: p.theme.colors.xmlAttribute }),
|
|
2436
|
+
contenteditable: o.value === I,
|
|
2437
|
+
onDblclick: (F) => u(I),
|
|
2438
|
+
onKeydown: [
|
|
2439
|
+
U(Z(w, ["prevent"]), ["enter"]),
|
|
2440
|
+
U(le, ["escape"])
|
|
2441
|
+
],
|
|
2442
|
+
onBlur: w,
|
|
2443
|
+
ref_for: !0,
|
|
2444
|
+
ref: (F) => {
|
|
2445
|
+
o.value === I && (v.value = F);
|
|
2446
|
+
},
|
|
2447
|
+
title: "Double-click to edit attribute name"
|
|
2448
|
+
}, M(o.value === I ? l.value : I), 45, Er),
|
|
2268
2449
|
y("span", {
|
|
2269
2450
|
class: "xml-node__equals",
|
|
2270
|
-
style:
|
|
2451
|
+
style: $({ color: p.theme.colors.xmlEquals })
|
|
2271
2452
|
}, "=", 4),
|
|
2272
2453
|
y("span", {
|
|
2273
2454
|
class: "xml-node__quote",
|
|
2274
|
-
style:
|
|
2455
|
+
style: $({ color: p.theme.colors.xmlQuote })
|
|
2275
2456
|
}, '"', 4),
|
|
2276
2457
|
y("span", {
|
|
2277
|
-
class: "xml-node__attr-value",
|
|
2278
|
-
style:
|
|
2279
|
-
|
|
2458
|
+
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
2459
|
+
style: $({ color: p.theme.colors.xmlAttributeValue }),
|
|
2460
|
+
contenteditable: i.value === I,
|
|
2461
|
+
onDblclick: (F) => m(I),
|
|
2462
|
+
onKeydown: [
|
|
2463
|
+
U(Z(L, ["prevent"]), ["enter"]),
|
|
2464
|
+
U(be, ["escape"])
|
|
2465
|
+
],
|
|
2466
|
+
onBlur: L,
|
|
2467
|
+
ref_for: !0,
|
|
2468
|
+
ref: (F) => {
|
|
2469
|
+
i.value === I && (B.value = F);
|
|
2470
|
+
},
|
|
2471
|
+
title: "Double-click to edit attribute value"
|
|
2472
|
+
}, M(i.value === I ? g.value : ee), 45, kr),
|
|
2280
2473
|
y("span", {
|
|
2281
2474
|
class: "xml-node__quote",
|
|
2282
|
-
style:
|
|
2475
|
+
style: $({ color: p.theme.colors.xmlQuote })
|
|
2283
2476
|
}, '"', 4)
|
|
2284
2477
|
]))), 128)),
|
|
2285
2478
|
y("span", {
|
|
2286
2479
|
class: "xml-node__clickable-part",
|
|
2287
|
-
onClick:
|
|
2480
|
+
onClick: N[1] || (N[1] = (ee) => T()),
|
|
2288
2481
|
title: "Click to expand"
|
|
2289
2482
|
}, [
|
|
2290
2483
|
y("span", {
|
|
2291
2484
|
class: "xml-node__bracket",
|
|
2292
|
-
style:
|
|
2485
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2293
2486
|
}, ">", 4)
|
|
2294
2487
|
]),
|
|
2295
2488
|
y("span", {
|
|
2296
2489
|
class: "xml-node__collapsed-badge",
|
|
2297
|
-
style:
|
|
2490
|
+
style: $({
|
|
2298
2491
|
backgroundColor: p.theme.colors.collapsedBackground,
|
|
2299
2492
|
color: p.theme.colors.collapsedText
|
|
2300
2493
|
}),
|
|
2301
|
-
onClick:
|
|
2302
|
-
title: `Click to expand ${
|
|
2303
|
-
},
|
|
2494
|
+
onClick: N[2] || (N[2] = (ee) => T()),
|
|
2495
|
+
title: `Click to expand ${R.value} child element${R.value > 1 ? "s" : ""}`
|
|
2496
|
+
}, M(R.value) + " child" + M(R.value > 1 ? "ren" : ""), 13, Ar),
|
|
2304
2497
|
y("span", {
|
|
2305
2498
|
class: "xml-node__clickable-part",
|
|
2306
|
-
onClick:
|
|
2499
|
+
onClick: N[3] || (N[3] = (ee) => T()),
|
|
2307
2500
|
title: "Click to expand"
|
|
2308
2501
|
}, [
|
|
2309
2502
|
y("span", {
|
|
2310
2503
|
class: "xml-node__bracket",
|
|
2311
|
-
style:
|
|
2504
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2312
2505
|
}, "</", 4),
|
|
2313
2506
|
y("span", {
|
|
2314
2507
|
class: "xml-node__tag",
|
|
2315
|
-
style:
|
|
2316
|
-
},
|
|
2508
|
+
style: $({ color: p.theme.colors.xmlTag })
|
|
2509
|
+
}, M(n.value ? a.value : _.value), 5),
|
|
2317
2510
|
y("span", {
|
|
2318
2511
|
class: "xml-node__bracket",
|
|
2319
|
-
style:
|
|
2512
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2320
2513
|
}, ">", 4)
|
|
2321
2514
|
])
|
|
2322
|
-
])) : (
|
|
2323
|
-
y("div",
|
|
2324
|
-
|
|
2515
|
+
])) : (O(), P(pe, { key: 1 }, [
|
|
2516
|
+
y("div", wr, [
|
|
2517
|
+
C.value ? (O(), P("span", {
|
|
2325
2518
|
key: 0,
|
|
2326
2519
|
class: "xml-node__clickable-part",
|
|
2327
|
-
onClick:
|
|
2328
|
-
title:
|
|
2520
|
+
onClick: N[4] || (N[4] = (ee) => T()),
|
|
2521
|
+
title: Y.value ? "Click to collapse" : "Click to expand"
|
|
2329
2522
|
}, [
|
|
2330
2523
|
y("span", {
|
|
2331
2524
|
class: "xml-node__bracket",
|
|
2332
|
-
style:
|
|
2525
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2333
2526
|
}, "<", 4),
|
|
2334
2527
|
y("span", {
|
|
2335
|
-
class: "xml-node__tag",
|
|
2336
|
-
style:
|
|
2337
|
-
|
|
2338
|
-
|
|
2528
|
+
class: "xml-node__tag xml-node__tag--editable",
|
|
2529
|
+
style: $({ color: p.theme.colors.xmlTag }),
|
|
2530
|
+
contenteditable: n.value,
|
|
2531
|
+
onDblclick: Z(b, ["stop"]),
|
|
2532
|
+
onContextmenu: Ce,
|
|
2533
|
+
onKeydown: [
|
|
2534
|
+
U(Z(A, ["prevent"]), ["enter"]),
|
|
2535
|
+
U(re, ["escape"])
|
|
2536
|
+
],
|
|
2537
|
+
onBlur: A,
|
|
2538
|
+
ref_key: "tagNameRef",
|
|
2539
|
+
ref: x,
|
|
2540
|
+
title: "Double-click or right-click to edit tag name"
|
|
2541
|
+
}, M(n.value ? a.value : _.value), 45, Cr)
|
|
2542
|
+
], 8, Nr)) : (O(), P("span", Tr, [
|
|
2339
2543
|
y("span", {
|
|
2340
2544
|
class: "xml-node__bracket",
|
|
2341
|
-
style:
|
|
2545
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2342
2546
|
}, "<", 4),
|
|
2343
2547
|
y("span", {
|
|
2344
|
-
class: "xml-node__tag",
|
|
2345
|
-
style:
|
|
2346
|
-
|
|
2548
|
+
class: "xml-node__tag xml-node__tag--editable",
|
|
2549
|
+
style: $({ color: p.theme.colors.xmlTag }),
|
|
2550
|
+
contenteditable: n.value,
|
|
2551
|
+
onDblclick: b,
|
|
2552
|
+
onKeydown: [
|
|
2553
|
+
U(Z(A, ["prevent"]), ["enter"]),
|
|
2554
|
+
U(re, ["escape"])
|
|
2555
|
+
],
|
|
2556
|
+
onBlur: A,
|
|
2557
|
+
ref_key: "tagNameRef",
|
|
2558
|
+
ref: x,
|
|
2559
|
+
title: "Double-click to edit tag name"
|
|
2560
|
+
}, M(n.value ? a.value : _.value), 45, Or)
|
|
2347
2561
|
])),
|
|
2348
|
-
(
|
|
2349
|
-
key:
|
|
2562
|
+
(O(!0), P(pe, null, _e(z.value, (ee, I) => (O(), P("span", {
|
|
2563
|
+
key: I,
|
|
2350
2564
|
class: "xml-node__attribute"
|
|
2351
2565
|
}, [
|
|
2352
2566
|
y("span", {
|
|
2353
|
-
class: "xml-node__attr-name",
|
|
2354
|
-
style:
|
|
2355
|
-
|
|
2567
|
+
class: "xml-node__attr-name xml-node__attr-name--editable",
|
|
2568
|
+
style: $({ color: p.theme.colors.xmlAttribute }),
|
|
2569
|
+
contenteditable: o.value === I,
|
|
2570
|
+
onDblclick: (F) => u(I),
|
|
2571
|
+
onKeydown: [
|
|
2572
|
+
U(Z(w, ["prevent"]), ["enter"]),
|
|
2573
|
+
U(le, ["escape"])
|
|
2574
|
+
],
|
|
2575
|
+
onBlur: w,
|
|
2576
|
+
ref_for: !0,
|
|
2577
|
+
ref: (F) => {
|
|
2578
|
+
o.value === I && (v.value = F);
|
|
2579
|
+
},
|
|
2580
|
+
title: "Double-click to edit attribute name"
|
|
2581
|
+
}, M(o.value === I ? l.value : I), 45, $r),
|
|
2356
2582
|
y("span", {
|
|
2357
2583
|
class: "xml-node__equals",
|
|
2358
|
-
style:
|
|
2584
|
+
style: $({ color: p.theme.colors.xmlEquals })
|
|
2359
2585
|
}, "=", 4),
|
|
2360
2586
|
y("span", {
|
|
2361
2587
|
class: "xml-node__quote",
|
|
2362
|
-
style:
|
|
2588
|
+
style: $({ color: p.theme.colors.xmlQuote })
|
|
2363
2589
|
}, '"', 4),
|
|
2364
2590
|
y("span", {
|
|
2365
|
-
class: "xml-node__attr-value",
|
|
2366
|
-
style:
|
|
2367
|
-
|
|
2591
|
+
class: "xml-node__attr-value xml-node__attr-value--editable",
|
|
2592
|
+
style: $({ color: p.theme.colors.xmlAttributeValue }),
|
|
2593
|
+
contenteditable: i.value === I,
|
|
2594
|
+
onDblclick: (F) => m(I),
|
|
2595
|
+
onKeydown: [
|
|
2596
|
+
U(Z(L, ["prevent"]), ["enter"]),
|
|
2597
|
+
U(be, ["escape"])
|
|
2598
|
+
],
|
|
2599
|
+
onBlur: L,
|
|
2600
|
+
ref_for: !0,
|
|
2601
|
+
ref: (F) => {
|
|
2602
|
+
i.value === I && (B.value = F);
|
|
2603
|
+
},
|
|
2604
|
+
title: "Double-click to edit attribute value"
|
|
2605
|
+
}, M(i.value === I ? g.value : ee), 45, Pr),
|
|
2368
2606
|
y("span", {
|
|
2369
2607
|
class: "xml-node__quote",
|
|
2370
|
-
style:
|
|
2608
|
+
style: $({ color: p.theme.colors.xmlQuote })
|
|
2371
2609
|
}, '"', 4)
|
|
2372
2610
|
]))), 128)),
|
|
2373
|
-
|
|
2611
|
+
C.value ? (O(), P("span", {
|
|
2374
2612
|
key: 2,
|
|
2375
2613
|
class: "xml-node__clickable-part",
|
|
2376
|
-
onClick:
|
|
2377
|
-
title:
|
|
2614
|
+
onClick: N[5] || (N[5] = (ee) => T()),
|
|
2615
|
+
title: Y.value ? "Click to collapse" : "Click to expand"
|
|
2378
2616
|
}, [
|
|
2379
2617
|
y("span", {
|
|
2380
2618
|
class: "xml-node__bracket",
|
|
2381
|
-
style:
|
|
2619
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2382
2620
|
}, ">", 4)
|
|
2383
|
-
], 8,
|
|
2621
|
+
], 8, Br)) : (O(), P("span", {
|
|
2384
2622
|
key: 3,
|
|
2385
2623
|
class: "xml-node__bracket",
|
|
2386
|
-
style:
|
|
2387
|
-
},
|
|
2624
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2625
|
+
}, M(C.value ? ">" : "/>"), 5))
|
|
2388
2626
|
]),
|
|
2389
|
-
|
|
2390
|
-
|
|
2627
|
+
Y.value && C.value ? (O(), P("div", Sr, [
|
|
2628
|
+
ae.value.length === 0 && se.value.trim() ? (O(), P("div", Ir, [
|
|
2391
2629
|
y("span", {
|
|
2392
|
-
class: "xml-node__text-content",
|
|
2393
|
-
style:
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2630
|
+
class: "xml-node__text-content xml-node__text-content--editable",
|
|
2631
|
+
style: $({ color: p.theme.colors.xmlText }),
|
|
2632
|
+
contenteditable: c.value,
|
|
2633
|
+
onDblclick: E,
|
|
2634
|
+
onKeydown: [
|
|
2635
|
+
U(Z(H, ["prevent"]), ["enter"]),
|
|
2636
|
+
U(oe, ["escape"])
|
|
2637
|
+
],
|
|
2638
|
+
onBlur: H,
|
|
2639
|
+
ref_key: "textContentRef",
|
|
2640
|
+
ref: S,
|
|
2641
|
+
title: "Double-click to edit text content"
|
|
2642
|
+
}, M(c.value ? h.value : se.value), 45, Vr)
|
|
2643
|
+
])) : te("", !0),
|
|
2644
|
+
(O(!0), P(pe, null, _e(ae.value, (ee, I) => (O(), Ze(D, {
|
|
2645
|
+
key: Q(ee, I),
|
|
2646
|
+
node: ee,
|
|
2647
|
+
index: I,
|
|
2400
2648
|
level: p.level + 1,
|
|
2401
|
-
"parent-path":
|
|
2649
|
+
"parent-path": f(),
|
|
2402
2650
|
expanded: p.expanded,
|
|
2403
2651
|
theme: p.theme,
|
|
2404
|
-
onToggleExpand:
|
|
2405
|
-
onCopy:
|
|
2652
|
+
onToggleExpand: N[6] || (N[6] = (F) => p.$emit("toggle-expand", F)),
|
|
2653
|
+
onCopy: N[7] || (N[7] = (F) => p.$emit("copy", F)),
|
|
2654
|
+
"onUpdate:tagName": N[8] || (N[8] = (F, ye, Ae) => p.$emit("update:tagName", F, ye, Ae)),
|
|
2655
|
+
"onUpdate:attributeName": N[9] || (N[9] = (F, ye, Ae) => p.$emit("update:attributeName", F, ye, Ae)),
|
|
2656
|
+
"onUpdate:attributeValue": N[10] || (N[10] = (F, ye, Ae) => p.$emit("update:attributeValue", F, ye, Ae)),
|
|
2657
|
+
"onUpdate:textContent": N[11] || (N[11] = (F, ye) => p.$emit("update:textContent", F, ye))
|
|
2406
2658
|
}, null, 8, ["node", "index", "level", "parent-path", "expanded", "theme"]))), 128))
|
|
2407
|
-
])) :
|
|
2408
|
-
|
|
2659
|
+
])) : te("", !0),
|
|
2660
|
+
Y.value && C.value ? (O(), P("div", Rr, [
|
|
2409
2661
|
y("span", {
|
|
2410
2662
|
class: "xml-node__clickable-part",
|
|
2411
|
-
onClick:
|
|
2663
|
+
onClick: N[12] || (N[12] = (ee) => T()),
|
|
2412
2664
|
title: "Click to collapse"
|
|
2413
2665
|
}, [
|
|
2414
2666
|
y("span", {
|
|
2415
2667
|
class: "xml-node__bracket",
|
|
2416
|
-
style:
|
|
2668
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2417
2669
|
}, "</", 4),
|
|
2418
2670
|
y("span", {
|
|
2419
2671
|
class: "xml-node__tag",
|
|
2420
|
-
style:
|
|
2421
|
-
},
|
|
2672
|
+
style: $({ color: p.theme.colors.xmlTag })
|
|
2673
|
+
}, M(n.value ? a.value : _.value), 5),
|
|
2422
2674
|
y("span", {
|
|
2423
2675
|
class: "xml-node__bracket",
|
|
2424
|
-
style:
|
|
2676
|
+
style: $({ color: p.theme.colors.xmlBracket })
|
|
2425
2677
|
}, ">", 4)
|
|
2426
2678
|
])
|
|
2427
|
-
])) :
|
|
2679
|
+
])) : te("", !0)
|
|
2428
2680
|
], 64))
|
|
2429
2681
|
]))
|
|
2430
|
-
])) :
|
|
2682
|
+
])) : te("", !0)
|
|
2431
2683
|
], 4);
|
|
2432
2684
|
};
|
|
2433
2685
|
}
|
|
2434
|
-
}),
|
|
2686
|
+
}), jr = /* @__PURE__ */ $e(Lr, [["__scopeId", "data-v-9bd6cb1a"]]), Ur = {
|
|
2435
2687
|
name: "github-light",
|
|
2436
2688
|
colors: {
|
|
2437
2689
|
// 背景色
|
|
@@ -2481,7 +2733,7 @@ const Rt = {
|
|
|
2481
2733
|
collapsedText: "#0969da"
|
|
2482
2734
|
// 折叠信息文本色 - 蓝色
|
|
2483
2735
|
}
|
|
2484
|
-
},
|
|
2736
|
+
}, Mr = {
|
|
2485
2737
|
name: "github-dark",
|
|
2486
2738
|
colors: {
|
|
2487
2739
|
// 背景色
|
|
@@ -2531,7 +2783,7 @@ const Rt = {
|
|
|
2531
2783
|
collapsedText: "#58a6ff"
|
|
2532
2784
|
// 折叠信息文本色 - 亮蓝
|
|
2533
2785
|
}
|
|
2534
|
-
},
|
|
2786
|
+
}, Fr = {
|
|
2535
2787
|
name: "min-light",
|
|
2536
2788
|
colors: {
|
|
2537
2789
|
// 背景色
|
|
@@ -2581,7 +2833,7 @@ const Rt = {
|
|
|
2581
2833
|
collapsedText: "#1d4ed8"
|
|
2582
2834
|
// 折叠信息文本色 - 蓝色
|
|
2583
2835
|
}
|
|
2584
|
-
},
|
|
2836
|
+
}, Kr = {
|
|
2585
2837
|
name: "slack-ochin",
|
|
2586
2838
|
colors: {
|
|
2587
2839
|
// 背景色
|
|
@@ -2631,13 +2883,13 @@ const Rt = {
|
|
|
2631
2883
|
collapsedText: "#0b4c8c"
|
|
2632
2884
|
// 折叠信息文本色 - 深蓝
|
|
2633
2885
|
}
|
|
2634
|
-
},
|
|
2635
|
-
"github-light":
|
|
2636
|
-
"github-dark":
|
|
2637
|
-
"min-light":
|
|
2638
|
-
"slack-ochin":
|
|
2639
|
-
},
|
|
2640
|
-
function
|
|
2886
|
+
}, Fe = {
|
|
2887
|
+
"github-light": Ur,
|
|
2888
|
+
"github-dark": Mr,
|
|
2889
|
+
"min-light": Fr,
|
|
2890
|
+
"slack-ochin": Kr
|
|
2891
|
+
}, Xr = (r) => Fe[r] || Fe["github-light"], De = ":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", Hr = De + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", qr = "[" + De + "][" + Hr + "]*", Wr = new RegExp("^" + qr + "$");
|
|
2892
|
+
function Je(r, e) {
|
|
2641
2893
|
const t = [];
|
|
2642
2894
|
let s = e.exec(r);
|
|
2643
2895
|
for (; s; ) {
|
|
@@ -2650,30 +2902,30 @@ function Ke(r, e) {
|
|
|
2650
2902
|
}
|
|
2651
2903
|
return t;
|
|
2652
2904
|
}
|
|
2653
|
-
const
|
|
2654
|
-
const e =
|
|
2905
|
+
const Pe = function(r) {
|
|
2906
|
+
const e = Wr.exec(r);
|
|
2655
2907
|
return !(e === null || typeof e > "u");
|
|
2656
2908
|
};
|
|
2657
|
-
function
|
|
2909
|
+
function Qr(r) {
|
|
2658
2910
|
return typeof r < "u";
|
|
2659
2911
|
}
|
|
2660
|
-
const
|
|
2912
|
+
const Yr = {
|
|
2661
2913
|
allowBooleanAttributes: !1,
|
|
2662
2914
|
//A tag can have attributes without any value
|
|
2663
2915
|
unpairedTags: []
|
|
2664
2916
|
};
|
|
2665
|
-
function
|
|
2666
|
-
e = Object.assign({},
|
|
2917
|
+
function et(r, e) {
|
|
2918
|
+
e = Object.assign({}, Yr, e);
|
|
2667
2919
|
const t = [];
|
|
2668
2920
|
let s = !1, n = !1;
|
|
2669
2921
|
r[0] === "\uFEFF" && (r = r.substr(1));
|
|
2670
2922
|
for (let o = 0; o < r.length; o++)
|
|
2671
2923
|
if (r[o] === "<" && r[o + 1] === "?") {
|
|
2672
|
-
if (o += 2, o =
|
|
2924
|
+
if (o += 2, o = Xe(r, o), o.err) return o;
|
|
2673
2925
|
} else if (r[o] === "<") {
|
|
2674
2926
|
let i = o;
|
|
2675
2927
|
if (o++, r[o] === "!") {
|
|
2676
|
-
o =
|
|
2928
|
+
o = He(r, o);
|
|
2677
2929
|
continue;
|
|
2678
2930
|
} else {
|
|
2679
2931
|
let c = !1;
|
|
@@ -2682,91 +2934,91 @@ function qe(r, e) {
|
|
|
2682
2934
|
for (; o < r.length && r[o] !== ">" && r[o] !== " " && r[o] !== " " && r[o] !== `
|
|
2683
2935
|
` && r[o] !== "\r"; o++)
|
|
2684
2936
|
a += r[o];
|
|
2685
|
-
if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1), o--), !
|
|
2686
|
-
let
|
|
2687
|
-
return a.trim().length === 0 ?
|
|
2937
|
+
if (a = a.trim(), a[a.length - 1] === "/" && (a = a.substring(0, a.length - 1), o--), !rn(a)) {
|
|
2938
|
+
let h;
|
|
2939
|
+
return a.trim().length === 0 ? h = "Invalid space after '<'." : h = "Tag '" + a + "' is an invalid name.", G("InvalidTag", h, ne(r, o));
|
|
2688
2940
|
}
|
|
2689
|
-
const l =
|
|
2941
|
+
const l = zr(r, o);
|
|
2690
2942
|
if (l === !1)
|
|
2691
|
-
return
|
|
2692
|
-
let
|
|
2693
|
-
if (o = l.index,
|
|
2694
|
-
const
|
|
2695
|
-
|
|
2696
|
-
const
|
|
2697
|
-
if (
|
|
2943
|
+
return G("InvalidAttr", "Attributes for '" + a + "' have open quote.", ne(r, o));
|
|
2944
|
+
let g = l.value;
|
|
2945
|
+
if (o = l.index, g[g.length - 1] === "/") {
|
|
2946
|
+
const h = o - g.length;
|
|
2947
|
+
g = g.substring(0, g.length - 1);
|
|
2948
|
+
const x = qe(g, e);
|
|
2949
|
+
if (x === !0)
|
|
2698
2950
|
s = !0;
|
|
2699
2951
|
else
|
|
2700
|
-
return
|
|
2952
|
+
return G(x.err.code, x.err.msg, ne(r, h + x.err.line));
|
|
2701
2953
|
} else if (c)
|
|
2702
2954
|
if (l.tagClosed) {
|
|
2703
|
-
if (
|
|
2704
|
-
return
|
|
2955
|
+
if (g.trim().length > 0)
|
|
2956
|
+
return G("InvalidTag", "Closing tag '" + a + "' can't have attributes or invalid starting.", ne(r, i));
|
|
2705
2957
|
if (t.length === 0)
|
|
2706
|
-
return
|
|
2958
|
+
return G("InvalidTag", "Closing tag '" + a + "' has not been opened.", ne(r, i));
|
|
2707
2959
|
{
|
|
2708
|
-
const
|
|
2709
|
-
if (a !==
|
|
2710
|
-
let
|
|
2711
|
-
return
|
|
2960
|
+
const h = t.pop();
|
|
2961
|
+
if (a !== h.tagName) {
|
|
2962
|
+
let x = ne(r, h.tagStartPos);
|
|
2963
|
+
return G(
|
|
2712
2964
|
"InvalidTag",
|
|
2713
|
-
"Expected closing tag '" +
|
|
2714
|
-
|
|
2965
|
+
"Expected closing tag '" + h.tagName + "' (opened in line " + x.line + ", col " + x.col + ") instead of closing tag '" + a + "'.",
|
|
2966
|
+
ne(r, i)
|
|
2715
2967
|
);
|
|
2716
2968
|
}
|
|
2717
2969
|
t.length == 0 && (n = !0);
|
|
2718
2970
|
}
|
|
2719
|
-
} else return
|
|
2971
|
+
} else return G("InvalidTag", "Closing tag '" + a + "' doesn't have proper closing.", ne(r, o));
|
|
2720
2972
|
else {
|
|
2721
|
-
const
|
|
2722
|
-
if (
|
|
2723
|
-
return
|
|
2973
|
+
const h = qe(g, e);
|
|
2974
|
+
if (h !== !0)
|
|
2975
|
+
return G(h.err.code, h.err.msg, ne(r, o - g.length + h.err.line));
|
|
2724
2976
|
if (n === !0)
|
|
2725
|
-
return
|
|
2977
|
+
return G("InvalidXml", "Multiple possible root nodes found.", ne(r, o));
|
|
2726
2978
|
e.unpairedTags.indexOf(a) !== -1 || t.push({ tagName: a, tagStartPos: i }), s = !0;
|
|
2727
2979
|
}
|
|
2728
2980
|
for (o++; o < r.length; o++)
|
|
2729
2981
|
if (r[o] === "<")
|
|
2730
2982
|
if (r[o + 1] === "!") {
|
|
2731
|
-
o++, o =
|
|
2983
|
+
o++, o = He(r, o);
|
|
2732
2984
|
continue;
|
|
2733
2985
|
} else if (r[o + 1] === "?") {
|
|
2734
|
-
if (o =
|
|
2986
|
+
if (o = Xe(r, ++o), o.err) return o;
|
|
2735
2987
|
} else
|
|
2736
2988
|
break;
|
|
2737
2989
|
else if (r[o] === "&") {
|
|
2738
|
-
const
|
|
2739
|
-
if (
|
|
2740
|
-
return
|
|
2741
|
-
o =
|
|
2742
|
-
} else if (n === !0 && !
|
|
2743
|
-
return
|
|
2990
|
+
const h = en(r, o);
|
|
2991
|
+
if (h == -1)
|
|
2992
|
+
return G("InvalidChar", "char '&' is not expected.", ne(r, o));
|
|
2993
|
+
o = h;
|
|
2994
|
+
} else if (n === !0 && !Ke(r[o]))
|
|
2995
|
+
return G("InvalidXml", "Extra text at the end", ne(r, o));
|
|
2744
2996
|
r[o] === "<" && o--;
|
|
2745
2997
|
}
|
|
2746
2998
|
} else {
|
|
2747
|
-
if (
|
|
2999
|
+
if (Ke(r[o]))
|
|
2748
3000
|
continue;
|
|
2749
|
-
return
|
|
3001
|
+
return G("InvalidChar", "char '" + r[o] + "' is not expected.", ne(r, o));
|
|
2750
3002
|
}
|
|
2751
3003
|
if (s) {
|
|
2752
3004
|
if (t.length == 1)
|
|
2753
|
-
return
|
|
3005
|
+
return G("InvalidTag", "Unclosed tag '" + t[0].tagName + "'.", ne(r, t[0].tagStartPos));
|
|
2754
3006
|
if (t.length > 0)
|
|
2755
|
-
return
|
|
2756
|
-
} else return
|
|
3007
|
+
return G("InvalidXml", "Invalid '" + JSON.stringify(t.map((o) => o.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
|
|
3008
|
+
} else return G("InvalidXml", "Start tag expected.", 1);
|
|
2757
3009
|
return !0;
|
|
2758
3010
|
}
|
|
2759
|
-
function
|
|
3011
|
+
function Ke(r) {
|
|
2760
3012
|
return r === " " || r === " " || r === `
|
|
2761
3013
|
` || r === "\r";
|
|
2762
3014
|
}
|
|
2763
|
-
function
|
|
3015
|
+
function Xe(r, e) {
|
|
2764
3016
|
const t = e;
|
|
2765
3017
|
for (; e < r.length; e++)
|
|
2766
3018
|
if (r[e] == "?" || r[e] == " ") {
|
|
2767
3019
|
const s = r.substr(t, e - t);
|
|
2768
3020
|
if (e > 5 && s === "xml")
|
|
2769
|
-
return
|
|
3021
|
+
return G("InvalidXml", "XML declaration allowed only at the start of the document.", ne(r, e));
|
|
2770
3022
|
if (r[e] == "?" && r[e + 1] == ">") {
|
|
2771
3023
|
e++;
|
|
2772
3024
|
break;
|
|
@@ -2775,7 +3027,7 @@ function Ie(r, e) {
|
|
|
2775
3027
|
}
|
|
2776
3028
|
return e;
|
|
2777
3029
|
}
|
|
2778
|
-
function
|
|
3030
|
+
function He(r, e) {
|
|
2779
3031
|
if (r.length > e + 5 && r[e + 1] === "-" && r[e + 2] === "-") {
|
|
2780
3032
|
for (e += 3; e < r.length; e++)
|
|
2781
3033
|
if (r[e] === "-" && r[e + 1] === "-" && r[e + 2] === ">") {
|
|
@@ -2798,11 +3050,11 @@ function Ve(r, e) {
|
|
|
2798
3050
|
}
|
|
2799
3051
|
return e;
|
|
2800
3052
|
}
|
|
2801
|
-
const
|
|
2802
|
-
function
|
|
3053
|
+
const Gr = '"', Zr = "'";
|
|
3054
|
+
function zr(r, e) {
|
|
2803
3055
|
let t = "", s = "", n = !1;
|
|
2804
3056
|
for (; e < r.length; e++) {
|
|
2805
|
-
if (r[e] ===
|
|
3057
|
+
if (r[e] === Gr || r[e] === Zr)
|
|
2806
3058
|
s === "" ? s = r[e] : s !== r[e] || (s = "");
|
|
2807
3059
|
else if (r[e] === ">" && s === "") {
|
|
2808
3060
|
n = !0;
|
|
@@ -2816,27 +3068,27 @@ function Cr(r, e) {
|
|
|
2816
3068
|
tagClosed: n
|
|
2817
3069
|
};
|
|
2818
3070
|
}
|
|
2819
|
-
const
|
|
2820
|
-
function
|
|
2821
|
-
const t =
|
|
3071
|
+
const Dr = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
|
|
3072
|
+
function qe(r, e) {
|
|
3073
|
+
const t = Je(r, Dr), s = {};
|
|
2822
3074
|
for (let n = 0; n < t.length; n++) {
|
|
2823
3075
|
if (t[n][1].length === 0)
|
|
2824
|
-
return
|
|
3076
|
+
return G("InvalidAttr", "Attribute '" + t[n][2] + "' has no space in starting.", we(t[n]));
|
|
2825
3077
|
if (t[n][3] !== void 0 && t[n][4] === void 0)
|
|
2826
|
-
return
|
|
3078
|
+
return G("InvalidAttr", "Attribute '" + t[n][2] + "' is without value.", we(t[n]));
|
|
2827
3079
|
if (t[n][3] === void 0 && !e.allowBooleanAttributes)
|
|
2828
|
-
return
|
|
3080
|
+
return G("InvalidAttr", "boolean attribute '" + t[n][2] + "' is not allowed.", we(t[n]));
|
|
2829
3081
|
const o = t[n][2];
|
|
2830
|
-
if (
|
|
2831
|
-
return
|
|
3082
|
+
if (!tn(o))
|
|
3083
|
+
return G("InvalidAttr", "Attribute '" + o + "' is an invalid name.", we(t[n]));
|
|
2832
3084
|
if (!s.hasOwnProperty(o))
|
|
2833
3085
|
s[o] = 1;
|
|
2834
3086
|
else
|
|
2835
|
-
return
|
|
3087
|
+
return G("InvalidAttr", "Attribute '" + o + "' is repeated.", we(t[n]));
|
|
2836
3088
|
}
|
|
2837
3089
|
return !0;
|
|
2838
3090
|
}
|
|
2839
|
-
function
|
|
3091
|
+
function Jr(r, e) {
|
|
2840
3092
|
let t = /\d/;
|
|
2841
3093
|
for (r[e] === "x" && (e++, t = /[\da-fA-F]/); e < r.length; e++) {
|
|
2842
3094
|
if (r[e] === ";")
|
|
@@ -2846,11 +3098,11 @@ function Tr(r, e) {
|
|
|
2846
3098
|
}
|
|
2847
3099
|
return -1;
|
|
2848
3100
|
}
|
|
2849
|
-
function
|
|
3101
|
+
function en(r, e) {
|
|
2850
3102
|
if (e++, r[e] === ";")
|
|
2851
3103
|
return -1;
|
|
2852
3104
|
if (r[e] === "#")
|
|
2853
|
-
return e++,
|
|
3105
|
+
return e++, Jr(r, e);
|
|
2854
3106
|
let t = 0;
|
|
2855
3107
|
for (; e < r.length; e++, t++)
|
|
2856
3108
|
if (!(r[e].match(/\w/) && t < 20)) {
|
|
@@ -2860,7 +3112,7 @@ function Pr(r, e) {
|
|
|
2860
3112
|
}
|
|
2861
3113
|
return e;
|
|
2862
3114
|
}
|
|
2863
|
-
function
|
|
3115
|
+
function G(r, e, t) {
|
|
2864
3116
|
return {
|
|
2865
3117
|
err: {
|
|
2866
3118
|
code: r,
|
|
@@ -2870,13 +3122,13 @@ function F(r, e, t) {
|
|
|
2870
3122
|
}
|
|
2871
3123
|
};
|
|
2872
3124
|
}
|
|
2873
|
-
function
|
|
2874
|
-
return
|
|
3125
|
+
function tn(r) {
|
|
3126
|
+
return Pe(r);
|
|
2875
3127
|
}
|
|
2876
|
-
function
|
|
2877
|
-
return
|
|
3128
|
+
function rn(r) {
|
|
3129
|
+
return Pe(r);
|
|
2878
3130
|
}
|
|
2879
|
-
function
|
|
3131
|
+
function ne(r, e) {
|
|
2880
3132
|
const t = r.substring(0, e).split(/\r?\n/);
|
|
2881
3133
|
return {
|
|
2882
3134
|
line: t.length,
|
|
@@ -2884,10 +3136,10 @@ function Q(r, e) {
|
|
|
2884
3136
|
col: t[t.length - 1].length + 1
|
|
2885
3137
|
};
|
|
2886
3138
|
}
|
|
2887
|
-
function
|
|
3139
|
+
function we(r) {
|
|
2888
3140
|
return r.startIndex + r[1].length;
|
|
2889
3141
|
}
|
|
2890
|
-
const
|
|
3142
|
+
const nn = {
|
|
2891
3143
|
preserveOrder: !1,
|
|
2892
3144
|
attributeNamePrefix: "@_",
|
|
2893
3145
|
attributesGroupName: !1,
|
|
@@ -2931,12 +3183,12 @@ const Br = {
|
|
|
2931
3183
|
},
|
|
2932
3184
|
// skipEmptyListItem: false
|
|
2933
3185
|
captureMetaData: !1
|
|
2934
|
-
},
|
|
2935
|
-
return Object.assign({},
|
|
3186
|
+
}, sn = function(r) {
|
|
3187
|
+
return Object.assign({}, nn, r);
|
|
2936
3188
|
};
|
|
2937
|
-
let
|
|
2938
|
-
typeof Symbol != "function" ?
|
|
2939
|
-
class
|
|
3189
|
+
let Te;
|
|
3190
|
+
typeof Symbol != "function" ? Te = "@@xmlMetadata" : Te = Symbol("XML Node Metadata");
|
|
3191
|
+
class xe {
|
|
2940
3192
|
constructor(e) {
|
|
2941
3193
|
this.tagname = e, this.child = [], this[":@"] = {};
|
|
2942
3194
|
}
|
|
@@ -2944,14 +3196,14 @@ class le {
|
|
|
2944
3196
|
e === "__proto__" && (e = "#__proto__"), this.child.push({ [e]: t });
|
|
2945
3197
|
}
|
|
2946
3198
|
addChild(e, t) {
|
|
2947
|
-
e.tagname === "__proto__" && (e.tagname = "#__proto__"), e[":@"] && Object.keys(e[":@"]).length > 0 ? this.child.push({ [e.tagname]: e.child, ":@": e[":@"] }) : this.child.push({ [e.tagname]: e.child }), t !== void 0 && (this.child[this.child.length - 1][
|
|
3199
|
+
e.tagname === "__proto__" && (e.tagname = "#__proto__"), e[":@"] && Object.keys(e[":@"]).length > 0 ? this.child.push({ [e.tagname]: e.child, ":@": e[":@"] }) : this.child.push({ [e.tagname]: e.child }), t !== void 0 && (this.child[this.child.length - 1][Te] = { startIndex: t });
|
|
2948
3200
|
}
|
|
2949
3201
|
/** symbol used for metadata */
|
|
2950
3202
|
static getMetaDataSymbol() {
|
|
2951
|
-
return
|
|
3203
|
+
return Te;
|
|
2952
3204
|
}
|
|
2953
3205
|
}
|
|
2954
|
-
class
|
|
3206
|
+
class on {
|
|
2955
3207
|
constructor(e) {
|
|
2956
3208
|
this.suppressValidationErr = !e;
|
|
2957
3209
|
}
|
|
@@ -2962,24 +3214,24 @@ class Vr {
|
|
|
2962
3214
|
let n = 1, o = !1, i = !1, c = "";
|
|
2963
3215
|
for (; t < e.length; t++)
|
|
2964
3216
|
if (e[t] === "<" && !i) {
|
|
2965
|
-
if (o &&
|
|
3217
|
+
if (o && ve(e, "!ENTITY", t)) {
|
|
2966
3218
|
t += 7;
|
|
2967
3219
|
let a, l;
|
|
2968
3220
|
[a, l, t] = this.readEntityExp(e, t + 1, this.suppressValidationErr), l.indexOf("&") === -1 && (s[a] = {
|
|
2969
3221
|
regx: RegExp(`&${a};`, "g"),
|
|
2970
3222
|
val: l
|
|
2971
3223
|
});
|
|
2972
|
-
} else if (o &&
|
|
3224
|
+
} else if (o && ve(e, "!ELEMENT", t)) {
|
|
2973
3225
|
t += 8;
|
|
2974
3226
|
const { index: a } = this.readElementExp(e, t + 1);
|
|
2975
3227
|
t = a;
|
|
2976
|
-
} else if (o &&
|
|
3228
|
+
} else if (o && ve(e, "!ATTLIST", t))
|
|
2977
3229
|
t += 8;
|
|
2978
|
-
else if (o &&
|
|
3230
|
+
else if (o && ve(e, "!NOTATION", t)) {
|
|
2979
3231
|
t += 9;
|
|
2980
3232
|
const { index: a } = this.readNotationExp(e, t + 1, this.suppressValidationErr);
|
|
2981
3233
|
t = a;
|
|
2982
|
-
} else if (
|
|
3234
|
+
} else if (ve(e, "!--", t)) i = !0;
|
|
2983
3235
|
else throw new Error("Invalid DOCTYPE");
|
|
2984
3236
|
n++, c = "";
|
|
2985
3237
|
} else if (e[t] === ">") {
|
|
@@ -2993,11 +3245,11 @@ class Vr {
|
|
|
2993
3245
|
return { entities: s, i: t };
|
|
2994
3246
|
}
|
|
2995
3247
|
readEntityExp(e, t) {
|
|
2996
|
-
t =
|
|
3248
|
+
t = ie(e, t);
|
|
2997
3249
|
let s = "";
|
|
2998
3250
|
for (; t < e.length && !/\s/.test(e[t]) && e[t] !== '"' && e[t] !== "'"; )
|
|
2999
3251
|
s += e[t], t++;
|
|
3000
|
-
if (
|
|
3252
|
+
if (Ne(s), t = ie(e, t), !this.suppressValidationErr) {
|
|
3001
3253
|
if (e.substring(t, t + 6).toUpperCase() === "SYSTEM")
|
|
3002
3254
|
throw new Error("External entities are not supported");
|
|
3003
3255
|
if (e[t] === "%")
|
|
@@ -3007,18 +3259,18 @@ class Vr {
|
|
|
3007
3259
|
return [t, n] = this.readIdentifierVal(e, t, "entity"), t--, [s, n, t];
|
|
3008
3260
|
}
|
|
3009
3261
|
readNotationExp(e, t) {
|
|
3010
|
-
t =
|
|
3262
|
+
t = ie(e, t);
|
|
3011
3263
|
let s = "";
|
|
3012
3264
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
3013
3265
|
s += e[t], t++;
|
|
3014
|
-
!this.suppressValidationErr &&
|
|
3266
|
+
!this.suppressValidationErr && Ne(s), t = ie(e, t);
|
|
3015
3267
|
const n = e.substring(t, t + 6).toUpperCase();
|
|
3016
3268
|
if (!this.suppressValidationErr && n !== "SYSTEM" && n !== "PUBLIC")
|
|
3017
3269
|
throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);
|
|
3018
|
-
t += n.length, t =
|
|
3270
|
+
t += n.length, t = ie(e, t);
|
|
3019
3271
|
let o = null, i = null;
|
|
3020
3272
|
if (n === "PUBLIC")
|
|
3021
|
-
[t, o] = this.readIdentifierVal(e, t, "publicIdentifier"), t =
|
|
3273
|
+
[t, o] = this.readIdentifierVal(e, t, "publicIdentifier"), t = ie(e, t), (e[t] === '"' || e[t] === "'") && ([t, i] = this.readIdentifierVal(e, t, "systemIdentifier"));
|
|
3022
3274
|
else if (n === "SYSTEM" && ([t, i] = this.readIdentifierVal(e, t, "systemIdentifier"), !this.suppressValidationErr && !i))
|
|
3023
3275
|
throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
3024
3276
|
return { notationName: s, publicIdentifier: o, systemIdentifier: i, index: --t };
|
|
@@ -3035,16 +3287,16 @@ class Vr {
|
|
|
3035
3287
|
return t++, [t, n];
|
|
3036
3288
|
}
|
|
3037
3289
|
readElementExp(e, t) {
|
|
3038
|
-
t =
|
|
3290
|
+
t = ie(e, t);
|
|
3039
3291
|
let s = "";
|
|
3040
3292
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
3041
3293
|
s += e[t], t++;
|
|
3042
|
-
if (!this.suppressValidationErr && !
|
|
3294
|
+
if (!this.suppressValidationErr && !Pe(s))
|
|
3043
3295
|
throw new Error(`Invalid element name: "${s}"`);
|
|
3044
|
-
t =
|
|
3296
|
+
t = ie(e, t);
|
|
3045
3297
|
let n = "";
|
|
3046
|
-
if (e[t] === "E" &&
|
|
3047
|
-
else if (e[t] === "A" &&
|
|
3298
|
+
if (e[t] === "E" && ve(e, "MPTY", t)) t += 4;
|
|
3299
|
+
else if (e[t] === "A" && ve(e, "NY", t)) t += 2;
|
|
3048
3300
|
else if (e[t] === "(") {
|
|
3049
3301
|
for (t++; t < e.length && e[t] !== ")"; )
|
|
3050
3302
|
n += e[t], t++;
|
|
@@ -3059,20 +3311,20 @@ class Vr {
|
|
|
3059
3311
|
};
|
|
3060
3312
|
}
|
|
3061
3313
|
readAttlistExp(e, t) {
|
|
3062
|
-
t =
|
|
3314
|
+
t = ie(e, t);
|
|
3063
3315
|
let s = "";
|
|
3064
3316
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
3065
3317
|
s += e[t], t++;
|
|
3066
|
-
|
|
3318
|
+
Ne(s), t = ie(e, t);
|
|
3067
3319
|
let n = "";
|
|
3068
3320
|
for (; t < e.length && !/\s/.test(e[t]); )
|
|
3069
3321
|
n += e[t], t++;
|
|
3070
|
-
if (!
|
|
3322
|
+
if (!Ne(n))
|
|
3071
3323
|
throw new Error(`Invalid attribute name: "${n}"`);
|
|
3072
|
-
t =
|
|
3324
|
+
t = ie(e, t);
|
|
3073
3325
|
let o = "";
|
|
3074
3326
|
if (e.substring(t, t + 8).toUpperCase() === "NOTATION") {
|
|
3075
|
-
if (o = "NOTATION", t += 8, t =
|
|
3327
|
+
if (o = "NOTATION", t += 8, t = ie(e, t), e[t] !== "(")
|
|
3076
3328
|
throw new Error(`Expected '(', found "${e[t]}"`);
|
|
3077
3329
|
t++;
|
|
3078
3330
|
let c = [];
|
|
@@ -3080,9 +3332,9 @@ class Vr {
|
|
|
3080
3332
|
let a = "";
|
|
3081
3333
|
for (; t < e.length && e[t] !== "|" && e[t] !== ")"; )
|
|
3082
3334
|
a += e[t], t++;
|
|
3083
|
-
if (a = a.trim(), !
|
|
3335
|
+
if (a = a.trim(), !Ne(a))
|
|
3084
3336
|
throw new Error(`Invalid notation name: "${a}"`);
|
|
3085
|
-
c.push(a), e[t] === "|" && (t++, t =
|
|
3337
|
+
c.push(a), e[t] === "|" && (t++, t = ie(e, t));
|
|
3086
3338
|
}
|
|
3087
3339
|
if (e[t] !== ")")
|
|
3088
3340
|
throw new Error("Unterminated list of notations");
|
|
@@ -3094,7 +3346,7 @@ class Vr {
|
|
|
3094
3346
|
if (!this.suppressValidationErr && !c.includes(o.toUpperCase()))
|
|
3095
3347
|
throw new Error(`Invalid attribute type: "${o}"`);
|
|
3096
3348
|
}
|
|
3097
|
-
t =
|
|
3349
|
+
t = ie(e, t);
|
|
3098
3350
|
let i = "";
|
|
3099
3351
|
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"), {
|
|
3100
3352
|
elementName: s,
|
|
@@ -3105,22 +3357,22 @@ class Vr {
|
|
|
3105
3357
|
};
|
|
3106
3358
|
}
|
|
3107
3359
|
}
|
|
3108
|
-
const
|
|
3360
|
+
const ie = (r, e) => {
|
|
3109
3361
|
for (; e < r.length && /\s/.test(r[e]); )
|
|
3110
3362
|
e++;
|
|
3111
3363
|
return e;
|
|
3112
3364
|
};
|
|
3113
|
-
function
|
|
3365
|
+
function ve(r, e, t) {
|
|
3114
3366
|
for (let s = 0; s < e.length; s++)
|
|
3115
3367
|
if (e[s] !== r[t + s + 1]) return !1;
|
|
3116
3368
|
return !0;
|
|
3117
3369
|
}
|
|
3118
|
-
function
|
|
3119
|
-
if (
|
|
3370
|
+
function Ne(r) {
|
|
3371
|
+
if (Pe(r))
|
|
3120
3372
|
return r;
|
|
3121
3373
|
throw new Error(`Invalid entity name ${r}`);
|
|
3122
3374
|
}
|
|
3123
|
-
const
|
|
3375
|
+
const an = /^[-+]?0x[a-fA-F0-9]+$/, ln = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, cn = {
|
|
3124
3376
|
hex: !0,
|
|
3125
3377
|
// oct: false,
|
|
3126
3378
|
leadingZeros: !0,
|
|
@@ -3128,20 +3380,20 @@ const Lr = /^[-+]?0x[a-fA-F0-9]+$/, Rr = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, j
|
|
|
3128
3380
|
eNotation: !0
|
|
3129
3381
|
//skipLike: /regex/
|
|
3130
3382
|
};
|
|
3131
|
-
function
|
|
3132
|
-
if (e = Object.assign({},
|
|
3383
|
+
function un(r, e = {}) {
|
|
3384
|
+
if (e = Object.assign({}, cn, e), !r || typeof r != "string") return r;
|
|
3133
3385
|
let t = r.trim();
|
|
3134
3386
|
if (e.skipLike !== void 0 && e.skipLike.test(t)) return r;
|
|
3135
3387
|
if (r === "0") return 0;
|
|
3136
|
-
if (e.hex &&
|
|
3137
|
-
return
|
|
3388
|
+
if (e.hex && an.test(t))
|
|
3389
|
+
return pn(t, 16);
|
|
3138
3390
|
if (t.search(/.+[eE].+/) !== -1)
|
|
3139
|
-
return
|
|
3391
|
+
return fn(r, t, e);
|
|
3140
3392
|
{
|
|
3141
|
-
const s =
|
|
3393
|
+
const s = ln.exec(t);
|
|
3142
3394
|
if (s) {
|
|
3143
3395
|
const n = s[1] || "", o = s[2];
|
|
3144
|
-
let i =
|
|
3396
|
+
let i = hn(s[3]);
|
|
3145
3397
|
const c = n ? (
|
|
3146
3398
|
// 0., -00., 000.
|
|
3147
3399
|
r[o.length + 1] === "."
|
|
@@ -3155,17 +3407,17 @@ function Mr(r, e = {}) {
|
|
|
3155
3407
|
return e.eNotation ? a : r;
|
|
3156
3408
|
if (t.indexOf(".") !== -1)
|
|
3157
3409
|
return l === "0" || l === i || l === `${n}${i}` ? a : r;
|
|
3158
|
-
let
|
|
3159
|
-
return o ?
|
|
3410
|
+
let g = o ? i : t;
|
|
3411
|
+
return o ? g === l || n + g === l ? a : r : g === l || g === n + l ? a : r;
|
|
3160
3412
|
}
|
|
3161
3413
|
} else
|
|
3162
3414
|
return r;
|
|
3163
3415
|
}
|
|
3164
3416
|
}
|
|
3165
|
-
const
|
|
3166
|
-
function
|
|
3417
|
+
const dn = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
|
|
3418
|
+
function fn(r, e, t) {
|
|
3167
3419
|
if (!t.eNotation) return r;
|
|
3168
|
-
const s = e.match(
|
|
3420
|
+
const s = e.match(dn);
|
|
3169
3421
|
if (s) {
|
|
3170
3422
|
let n = s[1] || "";
|
|
3171
3423
|
const o = s[3].indexOf("e") === -1 ? "E" : "e", i = s[2], c = n ? (
|
|
@@ -3176,23 +3428,23 @@ function Fr(r, e, t) {
|
|
|
3176
3428
|
} else
|
|
3177
3429
|
return r;
|
|
3178
3430
|
}
|
|
3179
|
-
function
|
|
3431
|
+
function hn(r) {
|
|
3180
3432
|
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;
|
|
3181
3433
|
}
|
|
3182
|
-
function
|
|
3434
|
+
function pn(r, e) {
|
|
3183
3435
|
if (parseInt) return parseInt(r, e);
|
|
3184
3436
|
if (Number.parseInt) return Number.parseInt(r, e);
|
|
3185
3437
|
if (window && window.parseInt) return window.parseInt(r, e);
|
|
3186
3438
|
throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
3187
3439
|
}
|
|
3188
|
-
function
|
|
3440
|
+
function tt(r) {
|
|
3189
3441
|
return typeof r == "function" ? r : Array.isArray(r) ? (e) => {
|
|
3190
3442
|
for (const t of r)
|
|
3191
3443
|
if (typeof t == "string" && e === t || t instanceof RegExp && t.test(e))
|
|
3192
3444
|
return !0;
|
|
3193
3445
|
} : () => !1;
|
|
3194
3446
|
}
|
|
3195
|
-
class
|
|
3447
|
+
class gn {
|
|
3196
3448
|
constructor(e) {
|
|
3197
3449
|
this.options = e, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
|
|
3198
3450
|
apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
@@ -3215,10 +3467,10 @@ class Kr {
|
|
|
3215
3467
|
inr: { regex: /&(inr|#8377);/g, val: "₹" },
|
|
3216
3468
|
num_dec: { regex: /&#([0-9]{1,7});/g, val: (t, s) => String.fromCodePoint(Number.parseInt(s, 10)) },
|
|
3217
3469
|
num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (t, s) => String.fromCodePoint(Number.parseInt(s, 16)) }
|
|
3218
|
-
}, this.addExternalEntities =
|
|
3470
|
+
}, this.addExternalEntities = mn, this.parseXml = xn, this.parseTextData = bn, this.resolveNameSpace = yn, this.buildAttributesMap = _n, this.isItStopNode = wn, this.replaceEntitiesValue = kn, this.readStopNodeData = Cn, this.saveTextToParentTag = An, this.addChild = En, this.ignoreAttributesFn = tt(this.options.ignoreAttributes);
|
|
3219
3471
|
}
|
|
3220
3472
|
}
|
|
3221
|
-
function
|
|
3473
|
+
function mn(r) {
|
|
3222
3474
|
const e = Object.keys(r);
|
|
3223
3475
|
for (let t = 0; t < e.length; t++) {
|
|
3224
3476
|
const s = e[t];
|
|
@@ -3228,14 +3480,14 @@ function qr(r) {
|
|
|
3228
3480
|
};
|
|
3229
3481
|
}
|
|
3230
3482
|
}
|
|
3231
|
-
function
|
|
3483
|
+
function bn(r, e, t, s, n, o, i) {
|
|
3232
3484
|
if (r !== void 0 && (this.options.trimValues && !s && (r = r.trim()), r.length > 0)) {
|
|
3233
3485
|
i || (r = this.replaceEntitiesValue(r));
|
|
3234
3486
|
const c = this.options.tagValueProcessor(e, r, t, n, o);
|
|
3235
|
-
return c == null ? r : typeof c != typeof r || c !== r ? c : this.options.trimValues ?
|
|
3487
|
+
return c == null ? r : typeof c != typeof r || c !== r ? c : this.options.trimValues ? Re(r, this.options.parseTagValue, this.options.numberParseOptions) : r.trim() === r ? Re(r, this.options.parseTagValue, this.options.numberParseOptions) : r;
|
|
3236
3488
|
}
|
|
3237
3489
|
}
|
|
3238
|
-
function
|
|
3490
|
+
function yn(r) {
|
|
3239
3491
|
if (this.options.removeNSPrefix) {
|
|
3240
3492
|
const e = r.split(":"), t = r.charAt(0) === "/" ? "/" : "";
|
|
3241
3493
|
if (e[0] === "xmlns")
|
|
@@ -3244,10 +3496,10 @@ function Wr(r) {
|
|
|
3244
3496
|
}
|
|
3245
3497
|
return r;
|
|
3246
3498
|
}
|
|
3247
|
-
const
|
|
3248
|
-
function
|
|
3499
|
+
const vn = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
3500
|
+
function _n(r, e, t) {
|
|
3249
3501
|
if (this.options.ignoreAttributes !== !0 && typeof r == "string") {
|
|
3250
|
-
const s =
|
|
3502
|
+
const s = Je(r, vn), n = s.length, o = {};
|
|
3251
3503
|
for (let i = 0; i < n; i++) {
|
|
3252
3504
|
const c = this.resolveNameSpace(s[i][1]);
|
|
3253
3505
|
if (this.ignoreAttributesFn(c, e))
|
|
@@ -3256,8 +3508,8 @@ function Gr(r, e, t) {
|
|
|
3256
3508
|
if (c.length)
|
|
3257
3509
|
if (this.options.transformAttributeName && (l = this.options.transformAttributeName(l)), l === "__proto__" && (l = "#__proto__"), a !== void 0) {
|
|
3258
3510
|
this.options.trimValues && (a = a.trim()), a = this.replaceEntitiesValue(a);
|
|
3259
|
-
const
|
|
3260
|
-
|
|
3511
|
+
const g = this.options.attributeValueProcessor(c, a, e);
|
|
3512
|
+
g == null ? o[l] = a : typeof g != typeof a || g !== a ? o[l] = g : o[l] = Re(
|
|
3261
3513
|
a,
|
|
3262
3514
|
this.options.parseAttributeValue,
|
|
3263
3515
|
this.options.numberParseOptions
|
|
@@ -3273,37 +3525,37 @@ function Gr(r, e, t) {
|
|
|
3273
3525
|
return o;
|
|
3274
3526
|
}
|
|
3275
3527
|
}
|
|
3276
|
-
const
|
|
3528
|
+
const xn = function(r) {
|
|
3277
3529
|
r = r.replace(/\r\n?/g, `
|
|
3278
3530
|
`);
|
|
3279
|
-
const e = new
|
|
3531
|
+
const e = new xe("!xml");
|
|
3280
3532
|
let t = e, s = "", n = "";
|
|
3281
|
-
const o = new
|
|
3533
|
+
const o = new on(this.options.processEntities);
|
|
3282
3534
|
for (let i = 0; i < r.length; i++)
|
|
3283
3535
|
if (r[i] === "<")
|
|
3284
3536
|
if (r[i + 1] === "/") {
|
|
3285
|
-
const a =
|
|
3537
|
+
const a = Ee(r, ">", i, "Closing Tag is not closed.");
|
|
3286
3538
|
let l = r.substring(i + 2, a).trim();
|
|
3287
3539
|
if (this.options.removeNSPrefix) {
|
|
3288
|
-
const
|
|
3289
|
-
|
|
3540
|
+
const x = l.indexOf(":");
|
|
3541
|
+
x !== -1 && (l = l.substr(x + 1));
|
|
3290
3542
|
}
|
|
3291
3543
|
this.options.transformTagName && (l = this.options.transformTagName(l)), t && (s = this.saveTextToParentTag(s, t, n));
|
|
3292
|
-
const
|
|
3544
|
+
const g = n.substring(n.lastIndexOf(".") + 1);
|
|
3293
3545
|
if (l && this.options.unpairedTags.indexOf(l) !== -1)
|
|
3294
3546
|
throw new Error(`Unpaired tag can not be used as closing tag: </${l}>`);
|
|
3295
|
-
let
|
|
3296
|
-
|
|
3547
|
+
let h = 0;
|
|
3548
|
+
g && this.options.unpairedTags.indexOf(g) !== -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;
|
|
3297
3549
|
} else if (r[i + 1] === "?") {
|
|
3298
|
-
let a =
|
|
3550
|
+
let a = Ve(r, i, !1, "?>");
|
|
3299
3551
|
if (!a) throw new Error("Pi Tag is not closed.");
|
|
3300
3552
|
if (s = this.saveTextToParentTag(s, t, n), !(this.options.ignoreDeclaration && a.tagName === "?xml" || this.options.ignorePiTags)) {
|
|
3301
|
-
const l = new
|
|
3553
|
+
const l = new xe(a.tagName);
|
|
3302
3554
|
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);
|
|
3303
3555
|
}
|
|
3304
3556
|
i = a.closeIndex + 1;
|
|
3305
3557
|
} else if (r.substr(i + 1, 3) === "!--") {
|
|
3306
|
-
const a =
|
|
3558
|
+
const a = Ee(r, "-->", i + 4, "Comment is not closed.");
|
|
3307
3559
|
if (this.options.commentPropName) {
|
|
3308
3560
|
const l = r.substring(i + 4, a - 2);
|
|
3309
3561
|
s = this.saveTextToParentTag(s, t, n), t.add(this.options.commentPropName, [{ [this.options.textNodeName]: l }]);
|
|
@@ -3313,53 +3565,53 @@ const Zr = function(r) {
|
|
|
3313
3565
|
const a = o.readDocType(r, i);
|
|
3314
3566
|
this.docTypeEntities = a.entities, i = a.i;
|
|
3315
3567
|
} else if (r.substr(i + 1, 2) === "![") {
|
|
3316
|
-
const a =
|
|
3568
|
+
const a = Ee(r, "]]>", i, "CDATA is not closed.") - 2, l = r.substring(i + 9, a);
|
|
3317
3569
|
s = this.saveTextToParentTag(s, t, n);
|
|
3318
|
-
let
|
|
3319
|
-
|
|
3570
|
+
let g = this.parseTextData(l, t.tagname, n, !0, !1, !0, !0);
|
|
3571
|
+
g == null && (g = ""), this.options.cdataPropName ? t.add(this.options.cdataPropName, [{ [this.options.textNodeName]: l }]) : t.add(this.options.textNodeName, g), i = a + 2;
|
|
3320
3572
|
} else {
|
|
3321
|
-
let a =
|
|
3322
|
-
const
|
|
3323
|
-
let
|
|
3573
|
+
let a = Ve(r, i, this.options.removeNSPrefix), l = a.tagName;
|
|
3574
|
+
const g = a.rawTagName;
|
|
3575
|
+
let h = a.tagExp, x = a.attrExpPresent, v = a.closeIndex;
|
|
3324
3576
|
this.options.transformTagName && (l = this.options.transformTagName(l)), t && s && t.tagname !== "!xml" && (s = this.saveTextToParentTag(s, t, n, !1));
|
|
3325
|
-
const
|
|
3326
|
-
|
|
3327
|
-
const
|
|
3577
|
+
const B = t;
|
|
3578
|
+
B && this.options.unpairedTags.indexOf(B.tagname) !== -1 && (t = this.tagsNodeStack.pop(), n = n.substring(0, n.lastIndexOf("."))), l !== e.tagname && (n += n ? "." + l : l);
|
|
3579
|
+
const S = i;
|
|
3328
3580
|
if (this.isItStopNode(this.options.stopNodes, n, l)) {
|
|
3329
|
-
let
|
|
3330
|
-
if (
|
|
3331
|
-
l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), n = n.substr(0, n.length - 1),
|
|
3581
|
+
let _ = "";
|
|
3582
|
+
if (h.length > 0 && h.lastIndexOf("/") === h.length - 1)
|
|
3583
|
+
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;
|
|
3332
3584
|
else if (this.options.unpairedTags.indexOf(l) !== -1)
|
|
3333
3585
|
i = a.closeIndex;
|
|
3334
3586
|
else {
|
|
3335
|
-
const
|
|
3336
|
-
if (!
|
|
3337
|
-
i =
|
|
3587
|
+
const Y = this.readStopNodeData(r, g, v + 1);
|
|
3588
|
+
if (!Y) throw new Error(`Unexpected end of ${g}`);
|
|
3589
|
+
i = Y.i, _ = Y.tagContent;
|
|
3338
3590
|
}
|
|
3339
|
-
const
|
|
3340
|
-
l !==
|
|
3591
|
+
const j = new xe(l);
|
|
3592
|
+
l !== h && x && (j[":@"] = this.buildAttributesMap(h, n, l)), _ && (_ = this.parseTextData(_, l, n, !0, x, !0, !0)), n = n.substr(0, n.lastIndexOf(".")), j.add(this.options.textNodeName, _), this.addChild(t, j, n, S);
|
|
3341
3593
|
} else {
|
|
3342
|
-
if (
|
|
3343
|
-
l[l.length - 1] === "/" ? (l = l.substr(0, l.length - 1), n = n.substr(0, n.length - 1),
|
|
3344
|
-
const
|
|
3345
|
-
l !==
|
|
3594
|
+
if (h.length > 0 && h.lastIndexOf("/") === h.length - 1) {
|
|
3595
|
+
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));
|
|
3596
|
+
const _ = new xe(l);
|
|
3597
|
+
l !== h && x && (_[":@"] = this.buildAttributesMap(h, n, l)), this.addChild(t, _, n, S), n = n.substr(0, n.lastIndexOf("."));
|
|
3346
3598
|
} else {
|
|
3347
|
-
const
|
|
3348
|
-
this.tagsNodeStack.push(t), l !==
|
|
3599
|
+
const _ = new xe(l);
|
|
3600
|
+
this.tagsNodeStack.push(t), l !== h && x && (_[":@"] = this.buildAttributesMap(h, n, l)), this.addChild(t, _, n, S), t = _;
|
|
3349
3601
|
}
|
|
3350
|
-
s = "", i =
|
|
3602
|
+
s = "", i = v;
|
|
3351
3603
|
}
|
|
3352
3604
|
}
|
|
3353
3605
|
else
|
|
3354
3606
|
s += r[i];
|
|
3355
3607
|
return e.child;
|
|
3356
3608
|
};
|
|
3357
|
-
function
|
|
3609
|
+
function En(r, e, t, s) {
|
|
3358
3610
|
this.options.captureMetaData || (s = void 0);
|
|
3359
3611
|
const n = this.options.updateTag(e.tagname, t, e[":@"]);
|
|
3360
3612
|
n === !1 || (typeof n == "string" && (e.tagname = n), r.addChild(e, s));
|
|
3361
3613
|
}
|
|
3362
|
-
const
|
|
3614
|
+
const kn = function(r) {
|
|
3363
3615
|
if (this.options.processEntities) {
|
|
3364
3616
|
for (let e in this.docTypeEntities) {
|
|
3365
3617
|
const t = this.docTypeEntities[e];
|
|
@@ -3378,7 +3630,7 @@ const Dr = function(r) {
|
|
|
3378
3630
|
}
|
|
3379
3631
|
return r;
|
|
3380
3632
|
};
|
|
3381
|
-
function
|
|
3633
|
+
function An(r, e, t, s) {
|
|
3382
3634
|
return r && (s === void 0 && (s = e.child.length === 0), r = this.parseTextData(
|
|
3383
3635
|
r,
|
|
3384
3636
|
e.tagname,
|
|
@@ -3388,7 +3640,7 @@ function Jr(r, e, t, s) {
|
|
|
3388
3640
|
s
|
|
3389
3641
|
), r !== void 0 && r !== "" && e.add(this.options.textNodeName, r), r = ""), r;
|
|
3390
3642
|
}
|
|
3391
|
-
function
|
|
3643
|
+
function wn(r, e, t) {
|
|
3392
3644
|
const s = "*." + t;
|
|
3393
3645
|
for (const n in r) {
|
|
3394
3646
|
const o = r[n];
|
|
@@ -3396,7 +3648,7 @@ function en(r, e, t) {
|
|
|
3396
3648
|
}
|
|
3397
3649
|
return !1;
|
|
3398
3650
|
}
|
|
3399
|
-
function
|
|
3651
|
+
function Nn(r, e, t = ">") {
|
|
3400
3652
|
let s, n = "";
|
|
3401
3653
|
for (let o = e; o < r.length; o++) {
|
|
3402
3654
|
let i = r[o];
|
|
@@ -3420,39 +3672,39 @@ function tn(r, e, t = ">") {
|
|
|
3420
3672
|
n += i;
|
|
3421
3673
|
}
|
|
3422
3674
|
}
|
|
3423
|
-
function
|
|
3675
|
+
function Ee(r, e, t, s) {
|
|
3424
3676
|
const n = r.indexOf(e, t);
|
|
3425
3677
|
if (n === -1)
|
|
3426
3678
|
throw new Error(s);
|
|
3427
3679
|
return n + e.length - 1;
|
|
3428
3680
|
}
|
|
3429
|
-
function
|
|
3430
|
-
const n =
|
|
3681
|
+
function Ve(r, e, t, s = ">") {
|
|
3682
|
+
const n = Nn(r, e + 1, s);
|
|
3431
3683
|
if (!n) return;
|
|
3432
3684
|
let o = n.data;
|
|
3433
3685
|
const i = n.index, c = o.search(/\s/);
|
|
3434
3686
|
let a = o, l = !0;
|
|
3435
3687
|
c !== -1 && (a = o.substring(0, c), o = o.substring(c + 1).trimStart());
|
|
3436
|
-
const
|
|
3688
|
+
const g = a;
|
|
3437
3689
|
if (t) {
|
|
3438
|
-
const
|
|
3439
|
-
|
|
3690
|
+
const h = a.indexOf(":");
|
|
3691
|
+
h !== -1 && (a = a.substr(h + 1), l = a !== n.data.substr(h + 1));
|
|
3440
3692
|
}
|
|
3441
3693
|
return {
|
|
3442
3694
|
tagName: a,
|
|
3443
3695
|
tagExp: o,
|
|
3444
3696
|
closeIndex: i,
|
|
3445
3697
|
attrExpPresent: l,
|
|
3446
|
-
rawTagName:
|
|
3698
|
+
rawTagName: g
|
|
3447
3699
|
};
|
|
3448
3700
|
}
|
|
3449
|
-
function
|
|
3701
|
+
function Cn(r, e, t) {
|
|
3450
3702
|
const s = t;
|
|
3451
3703
|
let n = 1;
|
|
3452
3704
|
for (; t < r.length; t++)
|
|
3453
3705
|
if (r[t] === "<")
|
|
3454
3706
|
if (r[t + 1] === "/") {
|
|
3455
|
-
const o =
|
|
3707
|
+
const o = Ee(r, ">", t, `${e} is not closed`);
|
|
3456
3708
|
if (r.substring(t + 2, o).trim() === e && (n--, n === 0))
|
|
3457
3709
|
return {
|
|
3458
3710
|
tagContent: r.substring(s, t),
|
|
@@ -3460,32 +3712,32 @@ function rn(r, e, t) {
|
|
|
3460
3712
|
};
|
|
3461
3713
|
t = o;
|
|
3462
3714
|
} else if (r[t + 1] === "?")
|
|
3463
|
-
t =
|
|
3715
|
+
t = Ee(r, "?>", t + 1, "StopNode is not closed.");
|
|
3464
3716
|
else if (r.substr(t + 1, 3) === "!--")
|
|
3465
|
-
t =
|
|
3717
|
+
t = Ee(r, "-->", t + 3, "StopNode is not closed.");
|
|
3466
3718
|
else if (r.substr(t + 1, 2) === "![")
|
|
3467
|
-
t =
|
|
3719
|
+
t = Ee(r, "]]>", t, "StopNode is not closed.") - 2;
|
|
3468
3720
|
else {
|
|
3469
|
-
const o =
|
|
3721
|
+
const o = Ve(r, t, ">");
|
|
3470
3722
|
o && ((o && o.tagName) === e && o.tagExp[o.tagExp.length - 1] !== "/" && n++, t = o.closeIndex);
|
|
3471
3723
|
}
|
|
3472
3724
|
}
|
|
3473
|
-
function
|
|
3725
|
+
function Re(r, e, t) {
|
|
3474
3726
|
if (e && typeof r == "string") {
|
|
3475
3727
|
const s = r.trim();
|
|
3476
|
-
return s === "true" ? !0 : s === "false" ? !1 :
|
|
3728
|
+
return s === "true" ? !0 : s === "false" ? !1 : un(r, t);
|
|
3477
3729
|
} else
|
|
3478
|
-
return
|
|
3730
|
+
return Qr(r) ? r : "";
|
|
3479
3731
|
}
|
|
3480
|
-
const
|
|
3481
|
-
function
|
|
3482
|
-
return
|
|
3732
|
+
const Se = xe.getMetaDataSymbol();
|
|
3733
|
+
function Tn(r, e) {
|
|
3734
|
+
return rt(r, e);
|
|
3483
3735
|
}
|
|
3484
|
-
function
|
|
3736
|
+
function rt(r, e, t) {
|
|
3485
3737
|
let s;
|
|
3486
3738
|
const n = {};
|
|
3487
3739
|
for (let o = 0; o < r.length; o++) {
|
|
3488
|
-
const i = r[o], c =
|
|
3740
|
+
const i = r[o], c = On(i);
|
|
3489
3741
|
let a = "";
|
|
3490
3742
|
if (t === void 0 ? a = c : a = t + "." + c, c === e.textNodeName)
|
|
3491
3743
|
s === void 0 ? s = i[c] : s += "" + i[c];
|
|
@@ -3493,22 +3745,22 @@ function We(r, e, t) {
|
|
|
3493
3745
|
if (c === void 0)
|
|
3494
3746
|
continue;
|
|
3495
3747
|
if (i[c]) {
|
|
3496
|
-
let l =
|
|
3497
|
-
const
|
|
3498
|
-
i[
|
|
3748
|
+
let l = rt(i[c], e, a);
|
|
3749
|
+
const g = Pn(l, e);
|
|
3750
|
+
i[Se] !== void 0 && (l[Se] = i[Se]), i[":@"] ? $n(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[c] !== void 0 && n.hasOwnProperty(c) ? (Array.isArray(n[c]) || (n[c] = [n[c]]), n[c].push(l)) : e.isArray(c, a, g) ? n[c] = [l] : n[c] = l;
|
|
3499
3751
|
}
|
|
3500
3752
|
}
|
|
3501
3753
|
}
|
|
3502
3754
|
return typeof s == "string" ? s.length > 0 && (n[e.textNodeName] = s) : s !== void 0 && (n[e.textNodeName] = s), n;
|
|
3503
3755
|
}
|
|
3504
|
-
function
|
|
3756
|
+
function On(r) {
|
|
3505
3757
|
const e = Object.keys(r);
|
|
3506
3758
|
for (let t = 0; t < e.length; t++) {
|
|
3507
3759
|
const s = e[t];
|
|
3508
3760
|
if (s !== ":@") return s;
|
|
3509
3761
|
}
|
|
3510
3762
|
}
|
|
3511
|
-
function
|
|
3763
|
+
function $n(r, e, t, s) {
|
|
3512
3764
|
if (e) {
|
|
3513
3765
|
const n = Object.keys(e), o = n.length;
|
|
3514
3766
|
for (let i = 0; i < o; i++) {
|
|
@@ -3517,13 +3769,13 @@ function on(r, e, t, s) {
|
|
|
3517
3769
|
}
|
|
3518
3770
|
}
|
|
3519
3771
|
}
|
|
3520
|
-
function
|
|
3772
|
+
function Pn(r, e) {
|
|
3521
3773
|
const { textNodeName: t } = e, s = Object.keys(r).length;
|
|
3522
3774
|
return !!(s === 0 || s === 1 && (r[t] || typeof r[t] == "boolean" || r[t] === 0));
|
|
3523
3775
|
}
|
|
3524
|
-
class
|
|
3776
|
+
class Bn {
|
|
3525
3777
|
constructor(e) {
|
|
3526
|
-
this.externalEntities = {}, this.options =
|
|
3778
|
+
this.externalEntities = {}, this.options = sn(e);
|
|
3527
3779
|
}
|
|
3528
3780
|
/**
|
|
3529
3781
|
* Parse XML dats to JS object
|
|
@@ -3537,14 +3789,14 @@ class ln {
|
|
|
3537
3789
|
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
3538
3790
|
if (t) {
|
|
3539
3791
|
t === !0 && (t = {});
|
|
3540
|
-
const o =
|
|
3792
|
+
const o = et(e, t);
|
|
3541
3793
|
if (o !== !0)
|
|
3542
3794
|
throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`);
|
|
3543
3795
|
}
|
|
3544
|
-
const s = new
|
|
3796
|
+
const s = new gn(this.options);
|
|
3545
3797
|
s.addExternalEntities(this.externalEntities);
|
|
3546
3798
|
const n = s.parseXml(e);
|
|
3547
|
-
return this.options.preserveOrder || n === void 0 ? n :
|
|
3799
|
+
return this.options.preserveOrder || n === void 0 ? n : Tn(n, this.options);
|
|
3548
3800
|
}
|
|
3549
3801
|
/**
|
|
3550
3802
|
* Add Entity which is not by default supported by this library
|
|
@@ -3571,24 +3823,24 @@ class ln {
|
|
|
3571
3823
|
* is true in the options.
|
|
3572
3824
|
*/
|
|
3573
3825
|
static getMetaDataSymbol() {
|
|
3574
|
-
return
|
|
3826
|
+
return xe.getMetaDataSymbol();
|
|
3575
3827
|
}
|
|
3576
3828
|
}
|
|
3577
|
-
const
|
|
3829
|
+
const Sn = `
|
|
3578
3830
|
`;
|
|
3579
|
-
function
|
|
3831
|
+
function In(r, e) {
|
|
3580
3832
|
let t = "";
|
|
3581
|
-
return e.format && e.indentBy.length > 0 && (t =
|
|
3833
|
+
return e.format && e.indentBy.length > 0 && (t = Sn), nt(r, e, "", t);
|
|
3582
3834
|
}
|
|
3583
|
-
function
|
|
3835
|
+
function nt(r, e, t, s) {
|
|
3584
3836
|
let n = "", o = !1;
|
|
3585
3837
|
for (let i = 0; i < r.length; i++) {
|
|
3586
|
-
const c = r[i], a =
|
|
3838
|
+
const c = r[i], a = Vn(c);
|
|
3587
3839
|
if (a === void 0) continue;
|
|
3588
3840
|
let l = "";
|
|
3589
3841
|
if (t.length === 0 ? l = a : l = `${t}.${a}`, a === e.textNodeName) {
|
|
3590
|
-
let
|
|
3591
|
-
|
|
3842
|
+
let B = c[a];
|
|
3843
|
+
Rn(l, e) || (B = e.tagValueProcessor(a, B), B = st(B, e)), o && (n += s), n += B, o = !1;
|
|
3592
3844
|
continue;
|
|
3593
3845
|
} else if (a === e.cdataPropName) {
|
|
3594
3846
|
o && (n += s), n += `<![CDATA[${c[a][0][e.textNodeName]}]]>`, o = !1;
|
|
@@ -3597,19 +3849,19 @@ function Ye(r, e, t, s) {
|
|
|
3597
3849
|
n += s + `<!--${c[a][0][e.textNodeName]}-->`, o = !0;
|
|
3598
3850
|
continue;
|
|
3599
3851
|
} else if (a[0] === "?") {
|
|
3600
|
-
const
|
|
3601
|
-
let
|
|
3602
|
-
|
|
3852
|
+
const B = We(c[":@"], e), S = a === "?xml" ? "" : s;
|
|
3853
|
+
let _ = c[a][0][e.textNodeName];
|
|
3854
|
+
_ = _.length !== 0 ? " " + _ : "", n += S + `<${a}${_}${B}?>`, o = !0;
|
|
3603
3855
|
continue;
|
|
3604
3856
|
}
|
|
3605
|
-
let
|
|
3606
|
-
|
|
3607
|
-
const
|
|
3608
|
-
e.unpairedTags.indexOf(a) !== -1 ? e.suppressUnpairedNode ? n +=
|
|
3857
|
+
let g = s;
|
|
3858
|
+
g !== "" && (g += e.indentBy);
|
|
3859
|
+
const h = We(c[":@"], e), x = s + `<${a}${h}`, v = nt(c[a], e, l, g);
|
|
3860
|
+
e.unpairedTags.indexOf(a) !== -1 ? e.suppressUnpairedNode ? n += x + ">" : n += x + "/>" : (!v || v.length === 0) && e.suppressEmptyNode ? n += x + "/>" : v && v.endsWith(">") ? n += x + `>${v}${s}</${a}>` : (n += x + ">", v && s !== "" && (v.includes("/>") || v.includes("</")) ? n += s + e.indentBy + v + s : n += v, n += `</${a}>`), o = !0;
|
|
3609
3861
|
}
|
|
3610
3862
|
return n;
|
|
3611
3863
|
}
|
|
3612
|
-
function
|
|
3864
|
+
function Vn(r) {
|
|
3613
3865
|
const e = Object.keys(r);
|
|
3614
3866
|
for (let t = 0; t < e.length; t++) {
|
|
3615
3867
|
const s = e[t];
|
|
@@ -3617,24 +3869,24 @@ function dn(r) {
|
|
|
3617
3869
|
return s;
|
|
3618
3870
|
}
|
|
3619
3871
|
}
|
|
3620
|
-
function
|
|
3872
|
+
function We(r, e) {
|
|
3621
3873
|
let t = "";
|
|
3622
3874
|
if (r && !e.ignoreAttributes)
|
|
3623
3875
|
for (let s in r) {
|
|
3624
3876
|
if (!r.hasOwnProperty(s)) continue;
|
|
3625
3877
|
let n = e.attributeValueProcessor(s, r[s]);
|
|
3626
|
-
n =
|
|
3878
|
+
n = st(n, e), n === !0 && e.suppressBooleanAttributes ? t += ` ${s.substr(e.attributeNamePrefix.length)}` : t += ` ${s.substr(e.attributeNamePrefix.length)}="${n}"`;
|
|
3627
3879
|
}
|
|
3628
3880
|
return t;
|
|
3629
3881
|
}
|
|
3630
|
-
function
|
|
3882
|
+
function Rn(r, e) {
|
|
3631
3883
|
r = r.substr(0, r.length - e.textNodeName.length - 1);
|
|
3632
3884
|
let t = r.substr(r.lastIndexOf(".") + 1);
|
|
3633
3885
|
for (let s in e.stopNodes)
|
|
3634
3886
|
if (e.stopNodes[s] === r || e.stopNodes[s] === "*." + t) return !0;
|
|
3635
3887
|
return !1;
|
|
3636
3888
|
}
|
|
3637
|
-
function
|
|
3889
|
+
function st(r, e) {
|
|
3638
3890
|
if (r && r.length > 0 && e.processEntities)
|
|
3639
3891
|
for (let t = 0; t < e.entities.length; t++) {
|
|
3640
3892
|
const s = e.entities[t];
|
|
@@ -3642,7 +3894,7 @@ function Ge(r, e) {
|
|
|
3642
3894
|
}
|
|
3643
3895
|
return r;
|
|
3644
3896
|
}
|
|
3645
|
-
const
|
|
3897
|
+
const Ln = {
|
|
3646
3898
|
attributeNamePrefix: "@_",
|
|
3647
3899
|
attributesGroupName: !1,
|
|
3648
3900
|
textNodeName: "#text",
|
|
@@ -3676,21 +3928,21 @@ const hn = {
|
|
|
3676
3928
|
// transformAttributeName: false,
|
|
3677
3929
|
oneListGroup: !1
|
|
3678
3930
|
};
|
|
3679
|
-
function
|
|
3680
|
-
this.options = Object.assign({},
|
|
3931
|
+
function me(r) {
|
|
3932
|
+
this.options = Object.assign({}, Ln, r), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
|
|
3681
3933
|
return !1;
|
|
3682
|
-
} : (this.ignoreAttributesFn =
|
|
3934
|
+
} : (this.ignoreAttributesFn = tt(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = Mn), this.processTextOrObjNode = jn, this.options.format ? (this.indentate = Un, this.tagEndChar = `>
|
|
3683
3935
|
`, this.newLine = `
|
|
3684
3936
|
`) : (this.indentate = function() {
|
|
3685
3937
|
return "";
|
|
3686
3938
|
}, this.tagEndChar = ">", this.newLine = "");
|
|
3687
3939
|
}
|
|
3688
|
-
|
|
3689
|
-
return this.options.preserveOrder ?
|
|
3940
|
+
me.prototype.build = function(r) {
|
|
3941
|
+
return this.options.preserveOrder ? In(r, this.options) : (Array.isArray(r) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (r = {
|
|
3690
3942
|
[this.options.arrayNodeName]: r
|
|
3691
3943
|
}), this.j2x(r, 0, []).val);
|
|
3692
3944
|
};
|
|
3693
|
-
|
|
3945
|
+
me.prototype.j2x = function(r, e, t) {
|
|
3694
3946
|
let s = "", n = "";
|
|
3695
3947
|
const o = t.join(".");
|
|
3696
3948
|
for (let i in r)
|
|
@@ -3714,21 +3966,21 @@ ne.prototype.j2x = function(r, e, t) {
|
|
|
3714
3966
|
} else if (Array.isArray(r[i])) {
|
|
3715
3967
|
const c = r[i].length;
|
|
3716
3968
|
let a = "", l = "";
|
|
3717
|
-
for (let
|
|
3718
|
-
const
|
|
3719
|
-
if (!(typeof
|
|
3969
|
+
for (let g = 0; g < c; g++) {
|
|
3970
|
+
const h = r[i][g];
|
|
3971
|
+
if (!(typeof h > "u")) if (h === null)
|
|
3720
3972
|
i[0] === "?" ? n += this.indentate(e) + "<" + i + "?" + this.tagEndChar : n += this.indentate(e) + "<" + i + "/" + this.tagEndChar;
|
|
3721
|
-
else if (typeof
|
|
3973
|
+
else if (typeof h == "object")
|
|
3722
3974
|
if (this.options.oneListGroup) {
|
|
3723
|
-
const
|
|
3724
|
-
a +=
|
|
3975
|
+
const x = this.j2x(h, e + 1, t.concat(i));
|
|
3976
|
+
a += x.val, this.options.attributesGroupName && h.hasOwnProperty(this.options.attributesGroupName) && (l += x.attrStr);
|
|
3725
3977
|
} else
|
|
3726
|
-
a += this.processTextOrObjNode(
|
|
3978
|
+
a += this.processTextOrObjNode(h, i, e, t);
|
|
3727
3979
|
else if (this.options.oneListGroup) {
|
|
3728
|
-
let
|
|
3729
|
-
|
|
3980
|
+
let x = this.options.tagValueProcessor(i, h);
|
|
3981
|
+
x = this.replaceEntitiesValue(x), a += x;
|
|
3730
3982
|
} else
|
|
3731
|
-
a += this.buildTextValNode(
|
|
3983
|
+
a += this.buildTextValNode(h, i, "", e);
|
|
3732
3984
|
}
|
|
3733
3985
|
this.options.oneListGroup && (a = this.buildObjectNode(a, i, l, e)), n += a;
|
|
3734
3986
|
} else if (this.options.attributesGroupName && i === this.options.attributesGroupName) {
|
|
@@ -3739,14 +3991,14 @@ ne.prototype.j2x = function(r, e, t) {
|
|
|
3739
3991
|
n += this.processTextOrObjNode(r[i], i, e, t);
|
|
3740
3992
|
return { attrStr: s, val: n };
|
|
3741
3993
|
};
|
|
3742
|
-
|
|
3994
|
+
me.prototype.buildAttrPairStr = function(r, e) {
|
|
3743
3995
|
return e = this.options.attributeValueProcessor(r, "" + e), e = this.replaceEntitiesValue(e), this.options.suppressBooleanAttributes && e === "true" ? " " + r : " " + r + '="' + e + '"';
|
|
3744
3996
|
};
|
|
3745
|
-
function
|
|
3997
|
+
function jn(r, e, t, s) {
|
|
3746
3998
|
const n = this.j2x(r, t + 1, s.concat(e));
|
|
3747
3999
|
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);
|
|
3748
4000
|
}
|
|
3749
|
-
|
|
4001
|
+
me.prototype.buildObjectNode = function(r, e, t, s) {
|
|
3750
4002
|
if (r === "")
|
|
3751
4003
|
return e[0] === "?" ? this.indentate(s) + "<" + e + t + "?" + this.tagEndChar : this.indentate(s) + "<" + e + t + this.closeTag(e) + this.tagEndChar;
|
|
3752
4004
|
{
|
|
@@ -3754,11 +4006,11 @@ ne.prototype.buildObjectNode = function(r, e, t, s) {
|
|
|
3754
4006
|
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;
|
|
3755
4007
|
}
|
|
3756
4008
|
};
|
|
3757
|
-
|
|
4009
|
+
me.prototype.closeTag = function(r) {
|
|
3758
4010
|
let e = "";
|
|
3759
4011
|
return this.options.unpairedTags.indexOf(r) !== -1 ? this.options.suppressUnpairedNode || (e = "/") : this.options.suppressEmptyNode ? e = "/" : e = `></${r}`, e;
|
|
3760
4012
|
};
|
|
3761
|
-
|
|
4013
|
+
me.prototype.buildTextValNode = function(r, e, t, s) {
|
|
3762
4014
|
if (this.options.cdataPropName !== !1 && e === this.options.cdataPropName)
|
|
3763
4015
|
return this.indentate(s) + `<![CDATA[${r}]]>` + this.newLine;
|
|
3764
4016
|
if (this.options.commentPropName !== !1 && e === this.options.commentPropName)
|
|
@@ -3770,7 +4022,7 @@ ne.prototype.buildTextValNode = function(r, e, t, s) {
|
|
|
3770
4022
|
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;
|
|
3771
4023
|
}
|
|
3772
4024
|
};
|
|
3773
|
-
|
|
4025
|
+
me.prototype.replaceEntitiesValue = function(r) {
|
|
3774
4026
|
if (r && r.length > 0 && this.options.processEntities)
|
|
3775
4027
|
for (let e = 0; e < this.options.entities.length; e++) {
|
|
3776
4028
|
const t = this.options.entities[e];
|
|
@@ -3778,15 +4030,15 @@ ne.prototype.replaceEntitiesValue = function(r) {
|
|
|
3778
4030
|
}
|
|
3779
4031
|
return r;
|
|
3780
4032
|
};
|
|
3781
|
-
function
|
|
4033
|
+
function Un(r) {
|
|
3782
4034
|
return this.options.indentBy.repeat(r);
|
|
3783
4035
|
}
|
|
3784
|
-
function
|
|
4036
|
+
function Mn(r) {
|
|
3785
4037
|
return r.startsWith(this.options.attributeNamePrefix) && r !== this.options.textNodeName ? r.substr(this.attrPrefixLen) : !1;
|
|
3786
4038
|
}
|
|
3787
|
-
const
|
|
3788
|
-
validate:
|
|
3789
|
-
},
|
|
4039
|
+
const Fn = {
|
|
4040
|
+
validate: et
|
|
4041
|
+
}, Kn = {
|
|
3790
4042
|
ignoreAttributes: !1,
|
|
3791
4043
|
// 保留属性
|
|
3792
4044
|
attributeNamePrefix: "@_",
|
|
@@ -3821,7 +4073,7 @@ const bn = {
|
|
|
3821
4073
|
// 停止解析的节点
|
|
3822
4074
|
alwaysCreateTextNode: !1
|
|
3823
4075
|
// 仅在有文本时创建文本节点
|
|
3824
|
-
},
|
|
4076
|
+
}, Xn = {
|
|
3825
4077
|
ignoreAttributes: !1,
|
|
3826
4078
|
attributeNamePrefix: "@_",
|
|
3827
4079
|
textNodeName: "#text",
|
|
@@ -3833,9 +4085,9 @@ const bn = {
|
|
|
3833
4085
|
// 不抑制空节点
|
|
3834
4086
|
suppressBooleanAttributes: !1,
|
|
3835
4087
|
suppressUnpairedNode: !1
|
|
3836
|
-
},
|
|
4088
|
+
}, Hn = (r) => {
|
|
3837
4089
|
try {
|
|
3838
|
-
const e =
|
|
4090
|
+
const e = Fn.validate(r, {
|
|
3839
4091
|
allowBooleanAttributes: !0
|
|
3840
4092
|
});
|
|
3841
4093
|
return e === !0 ? { valid: !0 } : {
|
|
@@ -3848,10 +4100,10 @@ const bn = {
|
|
|
3848
4100
|
error: e instanceof Error ? e.message : "Unknown validation error"
|
|
3849
4101
|
};
|
|
3850
4102
|
}
|
|
3851
|
-
},
|
|
4103
|
+
}, ot = (r, e) => {
|
|
3852
4104
|
try {
|
|
3853
|
-
return new
|
|
3854
|
-
...
|
|
4105
|
+
return new Bn({
|
|
4106
|
+
...Kn,
|
|
3855
4107
|
...e
|
|
3856
4108
|
}).parse(r);
|
|
3857
4109
|
} catch (t) {
|
|
@@ -3859,10 +4111,10 @@ const bn = {
|
|
|
3859
4111
|
`XML 解析失败: ${t instanceof Error ? t.message : "Unknown error"}`
|
|
3860
4112
|
);
|
|
3861
4113
|
}
|
|
3862
|
-
},
|
|
4114
|
+
}, Ue = (r, e) => {
|
|
3863
4115
|
try {
|
|
3864
|
-
let s = new
|
|
3865
|
-
...
|
|
4116
|
+
let s = new me({
|
|
4117
|
+
...Xn,
|
|
3866
4118
|
format: e?.format ?? !0,
|
|
3867
4119
|
indentBy: e?.indentBy ?? " "
|
|
3868
4120
|
}).build(r);
|
|
@@ -3873,66 +4125,66 @@ const bn = {
|
|
|
3873
4125
|
`XML 构建失败: ${t instanceof Error ? t.message : "Unknown error"}`
|
|
3874
4126
|
);
|
|
3875
4127
|
}
|
|
3876
|
-
},
|
|
3877
|
-
const t =
|
|
3878
|
-
return Array.isArray(t) ?
|
|
4128
|
+
}, qn = (r) => Array.isArray(r) ? ge(r, { format: !1 }) : Ue(r, { format: !1, showDeclaration: !1 }), Wn = (r, e) => {
|
|
4129
|
+
const t = ot(r);
|
|
4130
|
+
return Array.isArray(t) ? ge(t, {
|
|
3879
4131
|
indent: e?.indentBy
|
|
3880
|
-
}) :
|
|
3881
|
-
},
|
|
4132
|
+
}) : Ue(t, e);
|
|
4133
|
+
}, ge = (r, e = {}) => {
|
|
3882
4134
|
const t = e.indent !== void 0 ? e.indent : " ", s = e.level || 0, n = e.format !== !1, o = n ? t.repeat(s) : "", i = n ? `
|
|
3883
4135
|
` : "";
|
|
3884
4136
|
let c = "";
|
|
3885
4137
|
for (const a of r) {
|
|
3886
4138
|
if (a["?xml"]) {
|
|
3887
|
-
const
|
|
3888
|
-
c += `<?xml ${
|
|
4139
|
+
const _ = a[":@"] || {}, j = Object.entries(_).map(([Y, J]) => `${Y.startsWith("@_") ? Y.substring(2) : Y}="${J}"`).join(" ");
|
|
4140
|
+
c += `<?xml ${j}?>${i}`;
|
|
3889
4141
|
continue;
|
|
3890
4142
|
}
|
|
3891
4143
|
if (a["#comment"]) {
|
|
3892
|
-
const
|
|
3893
|
-
if (Array.isArray(
|
|
3894
|
-
const
|
|
3895
|
-
c += `${o}<!--${
|
|
4144
|
+
const _ = a["#comment"];
|
|
4145
|
+
if (Array.isArray(_) && _.length > 0) {
|
|
4146
|
+
const j = _[0]["#text"] || _[0];
|
|
4147
|
+
c += `${o}<!--${j}-->${i}`;
|
|
3896
4148
|
}
|
|
3897
4149
|
continue;
|
|
3898
4150
|
}
|
|
3899
|
-
const l = Object.keys(a).find((
|
|
4151
|
+
const l = Object.keys(a).find((_) => !_.startsWith(":") && !_.startsWith("#") && !_.startsWith("__"));
|
|
3900
4152
|
if (!l) continue;
|
|
3901
|
-
const
|
|
3902
|
-
if (!Array.isArray(
|
|
3903
|
-
c += `${o}<${l}${
|
|
4153
|
+
const g = a[l], h = a[":@"] || {}, x = Object.entries(h).map(([_, j]) => `${_.startsWith("@_") ? _.substring(2) : _}="${j}"`).join(" "), v = x ? " " + x : "";
|
|
4154
|
+
if (!Array.isArray(g) || g.length === 0) {
|
|
4155
|
+
c += `${o}<${l}${v}/>${i}`;
|
|
3904
4156
|
continue;
|
|
3905
4157
|
}
|
|
3906
|
-
const
|
|
3907
|
-
if (
|
|
3908
|
-
const
|
|
3909
|
-
if (
|
|
3910
|
-
const
|
|
3911
|
-
c += `${o}<${l}${
|
|
4158
|
+
const B = g.length === 1 && g[0]["#text"] !== void 0;
|
|
4159
|
+
if (g.some((_) => _.__cdata)) {
|
|
4160
|
+
const _ = g.find((j) => j.__cdata);
|
|
4161
|
+
if (_) {
|
|
4162
|
+
const j = _.__cdata[0]["#text"] || "";
|
|
4163
|
+
c += `${o}<${l}${v}><![CDATA[${j}]]></${l}>${i}`;
|
|
3912
4164
|
}
|
|
3913
|
-
} else if (
|
|
3914
|
-
const
|
|
3915
|
-
c += `${o}<${l}${
|
|
4165
|
+
} else if (B) {
|
|
4166
|
+
const _ = g[0]["#text"];
|
|
4167
|
+
c += `${o}<${l}${v}>${_}</${l}>${i}`;
|
|
3916
4168
|
} else
|
|
3917
|
-
c += `${o}<${l}${
|
|
4169
|
+
c += `${o}<${l}${v}>${i}`, c += ge(g, { indent: t, level: s + 1, format: n }), c += `${o}</${l}>${i}`;
|
|
3918
4170
|
}
|
|
3919
4171
|
return c;
|
|
3920
|
-
},
|
|
4172
|
+
}, Qn = {
|
|
3921
4173
|
key: 0,
|
|
3922
4174
|
class: "xml-format__toolbar"
|
|
3923
|
-
},
|
|
4175
|
+
}, Yn = { class: "xml-format__actions" }, Gn = ["disabled"], Zn = ["disabled"], zn = ["disabled"], Dn = ["disabled"], Jn = ["disabled"], es = { class: "xml-format__info" }, ts = {
|
|
3924
4176
|
key: 0,
|
|
3925
4177
|
class: "xml-format__status xml-format__status--success"
|
|
3926
|
-
},
|
|
4178
|
+
}, rs = {
|
|
3927
4179
|
key: 1,
|
|
3928
4180
|
class: "xml-format__status xml-format__status--error"
|
|
3929
|
-
},
|
|
4181
|
+
}, ns = { class: "xml-format__content" }, ss = {
|
|
3930
4182
|
key: 0,
|
|
3931
4183
|
class: "xml-format__error"
|
|
3932
|
-
},
|
|
4184
|
+
}, os = {
|
|
3933
4185
|
key: 1,
|
|
3934
4186
|
class: "xml-format__viewer"
|
|
3935
|
-
},
|
|
4187
|
+
}, is = /* @__PURE__ */ Oe({
|
|
3936
4188
|
__name: "index",
|
|
3937
4189
|
props: {
|
|
3938
4190
|
modelValue: { default: "" },
|
|
@@ -3946,198 +4198,307 @@ const bn = {
|
|
|
3946
4198
|
},
|
|
3947
4199
|
emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress", "format"],
|
|
3948
4200
|
setup(r, { expose: e, emit: t }) {
|
|
3949
|
-
|
|
3950
|
-
"
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
"
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
"
|
|
3958
|
-
"
|
|
3959
|
-
"
|
|
3960
|
-
|
|
3961
|
-
"
|
|
3962
|
-
"
|
|
3963
|
-
|
|
4201
|
+
Le((k) => ({
|
|
4202
|
+
"1078f5f2": l.value.colors.border,
|
|
4203
|
+
"3b7af818": l.value.colors.background,
|
|
4204
|
+
e476ff1a: l.value.colors.text,
|
|
4205
|
+
"434e9f96": l.value.colors.surfaceBackground,
|
|
4206
|
+
e9a92178: l.value.colors.buttonBorder,
|
|
4207
|
+
61940446: l.value.colors.buttonBackground,
|
|
4208
|
+
47092645: l.value.colors.buttonText,
|
|
4209
|
+
"6c26ded4": l.value.colors.buttonBackgroundHover,
|
|
4210
|
+
"7905142c": l.value.colors.buttonPrimary,
|
|
4211
|
+
"1d1c8572": l.value.colors.buttonPrimaryHover,
|
|
4212
|
+
e94e1206: l.value.colors.success,
|
|
4213
|
+
"4e8c500b": l.value.colors.successBackground,
|
|
4214
|
+
"29fdff82": l.value.colors.error,
|
|
4215
|
+
23583650: l.value.colors.errorBackground
|
|
3964
4216
|
}));
|
|
3965
|
-
const s = r, n = t, o = W(null), i = W(""), c = W(/* @__PURE__ */ new Set()), a =
|
|
4217
|
+
const s = r, n = t, o = W(null), i = W(""), c = W(/* @__PURE__ */ new Set()), a = K(() => i.value === ""), l = K(() => Xr(s.theme)), g = K(() => !o.value || !Array.isArray(o.value) ? [] : o.value.map((k, C) => ({ node: k, originalIndex: C })).filter((k) => !k.node["?xml"])), h = K(() => {
|
|
3966
4218
|
if (!o.value || !Array.isArray(o.value)) return null;
|
|
3967
|
-
const
|
|
3968
|
-
if (!
|
|
3969
|
-
const C =
|
|
3970
|
-
return C["@_version"] &&
|
|
3971
|
-
}),
|
|
3972
|
-
if (!
|
|
4219
|
+
const k = o.value.find((V) => V["?xml"]);
|
|
4220
|
+
if (!k || !k[":@"]) return null;
|
|
4221
|
+
const C = k[":@"], R = [];
|
|
4222
|
+
return C["@_version"] && R.push(`version="${C["@_version"]}"`), C["@_encoding"] && R.push(`encoding="${C["@_encoding"]}"`), C["@_standalone"] && R.push(`standalone="${C["@_standalone"]}"`), R.length > 0 ? `<?xml ${R.join(" ")}?>` : null;
|
|
4223
|
+
}), x = K(() => g.value), v = (k) => {
|
|
4224
|
+
if (!k || !k.trim()) {
|
|
3973
4225
|
i.value = "", o.value = null;
|
|
3974
4226
|
return;
|
|
3975
4227
|
}
|
|
3976
4228
|
try {
|
|
3977
|
-
const C =
|
|
4229
|
+
const C = Hn(k);
|
|
3978
4230
|
if (!C.valid) {
|
|
3979
4231
|
i.value = C.error || "Invalid XML", o.value = null;
|
|
3980
4232
|
return;
|
|
3981
4233
|
}
|
|
3982
|
-
o.value =
|
|
3983
|
-
|
|
4234
|
+
o.value = ot(k), i.value = "", ue(() => {
|
|
4235
|
+
S();
|
|
3984
4236
|
});
|
|
3985
4237
|
} catch (C) {
|
|
3986
4238
|
i.value = C instanceof Error ? C.message : "Unknown parse error", o.value = null;
|
|
3987
4239
|
}
|
|
3988
|
-
},
|
|
3989
|
-
c.value.has(
|
|
3990
|
-
},
|
|
3991
|
-
const
|
|
3992
|
-
Array.isArray(
|
|
3993
|
-
const
|
|
3994
|
-
if (!
|
|
3995
|
-
const
|
|
3996
|
-
|
|
3997
|
-
const
|
|
3998
|
-
Array.isArray(
|
|
4240
|
+
}, B = (k) => {
|
|
4241
|
+
c.value.has(k) ? c.value.delete(k) : c.value.add(k);
|
|
4242
|
+
}, S = () => {
|
|
4243
|
+
const k = /* @__PURE__ */ new Set(), C = (R, V = "") => {
|
|
4244
|
+
Array.isArray(R) && R.forEach((T, Q) => {
|
|
4245
|
+
const f = Object.keys(T).find((m) => !m.startsWith(":") && !m.startsWith("#"));
|
|
4246
|
+
if (!f) return;
|
|
4247
|
+
const b = V ? `${V}.${f}[${Q}]` : `${f}[${Q}]`;
|
|
4248
|
+
k.add(b);
|
|
4249
|
+
const u = T[f];
|
|
4250
|
+
Array.isArray(u) && C(u, b + "." + f);
|
|
3999
4251
|
});
|
|
4000
4252
|
};
|
|
4001
|
-
|
|
4002
|
-
const
|
|
4003
|
-
if (
|
|
4004
|
-
const
|
|
4005
|
-
|
|
4006
|
-
const
|
|
4007
|
-
Array.isArray(
|
|
4253
|
+
g.value.forEach(({ node: R, originalIndex: V }) => {
|
|
4254
|
+
const T = Object.keys(R).find((Q) => !Q.startsWith(":") && !Q.startsWith("#"));
|
|
4255
|
+
if (T) {
|
|
4256
|
+
const Q = `${T}[${V}]`;
|
|
4257
|
+
k.add(Q);
|
|
4258
|
+
const f = R[T];
|
|
4259
|
+
Array.isArray(f) && C(f, Q + "." + T);
|
|
4008
4260
|
}
|
|
4009
|
-
}), c.value =
|
|
4010
|
-
},
|
|
4261
|
+
}), c.value = k, n("expand-all");
|
|
4262
|
+
}, _ = () => {
|
|
4011
4263
|
c.value.clear(), n("collapse-all");
|
|
4012
|
-
},
|
|
4264
|
+
}, j = async () => {
|
|
4013
4265
|
if (!(!a.value || !o.value))
|
|
4014
4266
|
try {
|
|
4015
|
-
const
|
|
4016
|
-
await navigator.clipboard.writeText(
|
|
4017
|
-
} catch (
|
|
4018
|
-
const C =
|
|
4019
|
-
n("copy-error", C), console.error("Failed to copy XML:",
|
|
4267
|
+
const k = Array.isArray(o.value) ? ge(o.value, { indent: " " }) : Ue(o.value, { format: !0, indentBy: " " });
|
|
4268
|
+
await navigator.clipboard.writeText(k), n("copy-success", k);
|
|
4269
|
+
} catch (k) {
|
|
4270
|
+
const C = k instanceof Error ? k : new Error("Copy failed");
|
|
4271
|
+
n("copy-error", C), console.error("Failed to copy XML:", k);
|
|
4020
4272
|
}
|
|
4021
|
-
},
|
|
4273
|
+
}, Y = () => {
|
|
4022
4274
|
if (!(!a.value || !o.value))
|
|
4023
4275
|
try {
|
|
4024
|
-
const
|
|
4025
|
-
n("update:modelValue",
|
|
4026
|
-
} catch (
|
|
4027
|
-
console.error("Failed to compress XML:",
|
|
4276
|
+
const k = qn(o.value);
|
|
4277
|
+
n("update:modelValue", k), n("compress", k);
|
|
4278
|
+
} catch (k) {
|
|
4279
|
+
console.error("Failed to compress XML:", k);
|
|
4028
4280
|
}
|
|
4029
|
-
},
|
|
4281
|
+
}, J = () => {
|
|
4030
4282
|
if (a.value)
|
|
4031
4283
|
try {
|
|
4032
|
-
const
|
|
4284
|
+
const k = Wn(s.modelValue, {
|
|
4033
4285
|
format: !0,
|
|
4034
4286
|
indentBy: " "
|
|
4035
4287
|
});
|
|
4036
|
-
n("update:modelValue",
|
|
4037
|
-
} catch (
|
|
4038
|
-
console.error("Failed to format XML:",
|
|
4288
|
+
n("update:modelValue", k), n("format", k);
|
|
4289
|
+
} catch (k) {
|
|
4290
|
+
console.error("Failed to format XML:", k);
|
|
4039
4291
|
}
|
|
4040
|
-
},
|
|
4292
|
+
}, z = async (k) => {
|
|
4041
4293
|
try {
|
|
4042
|
-
const C = typeof
|
|
4294
|
+
const C = typeof k == "string" ? k : JSON.stringify(k, null, 2);
|
|
4043
4295
|
await navigator.clipboard.writeText(C), n("copy-success", C);
|
|
4044
4296
|
} catch (C) {
|
|
4045
|
-
const
|
|
4046
|
-
n("copy-error",
|
|
4297
|
+
const R = C instanceof Error ? C : new Error("Copy failed");
|
|
4298
|
+
n("copy-error", R), console.error("Failed to copy value:", C);
|
|
4047
4299
|
}
|
|
4300
|
+
}, ae = (k, C, R) => {
|
|
4301
|
+
if (!(!o.value || !Array.isArray(o.value)))
|
|
4302
|
+
try {
|
|
4303
|
+
const V = k.split(/\./).filter(Boolean);
|
|
4304
|
+
let T = o.value;
|
|
4305
|
+
for (let f = 0; f < V.length; f++) {
|
|
4306
|
+
const b = V[f], u = b.match(/^(.+?)\[(\d+)\]$/);
|
|
4307
|
+
if (u) {
|
|
4308
|
+
const m = u[1], E = parseInt(u[2]);
|
|
4309
|
+
if (f === V.length - 1) {
|
|
4310
|
+
if (Array.isArray(T) && T[E]) {
|
|
4311
|
+
const A = T[E];
|
|
4312
|
+
if (A[C]) {
|
|
4313
|
+
const w = A[C];
|
|
4314
|
+
delete A[C], A[R] = w;
|
|
4315
|
+
}
|
|
4316
|
+
}
|
|
4317
|
+
} else
|
|
4318
|
+
Array.isArray(T) && T[E] && (T = T[E]);
|
|
4319
|
+
} else
|
|
4320
|
+
T[b] && (T = T[b]);
|
|
4321
|
+
}
|
|
4322
|
+
const Q = ge(o.value, { indent: " " });
|
|
4323
|
+
n("update:modelValue", Q);
|
|
4324
|
+
} catch (V) {
|
|
4325
|
+
console.error("Failed to update tag name:", V);
|
|
4326
|
+
}
|
|
4327
|
+
}, ce = (k, C, R) => {
|
|
4328
|
+
if (!(!o.value || !Array.isArray(o.value)))
|
|
4329
|
+
try {
|
|
4330
|
+
const V = k.split(/\./).filter(Boolean);
|
|
4331
|
+
let T = o.value;
|
|
4332
|
+
for (let f = 0; f < V.length; f++) {
|
|
4333
|
+
const b = V[f], u = b.match(/^(.+?)\[(\d+)\]$/);
|
|
4334
|
+
if (u) {
|
|
4335
|
+
const m = u[1], E = parseInt(u[2]);
|
|
4336
|
+
if (f === V.length - 1) {
|
|
4337
|
+
if (Array.isArray(T) && T[E]) {
|
|
4338
|
+
const w = T[E][":@"];
|
|
4339
|
+
if (w && w[`@_${C}`] !== void 0) {
|
|
4340
|
+
const L = w[`@_${C}`];
|
|
4341
|
+
delete w[`@_${C}`], w[`@_${R}`] = L;
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
} else
|
|
4345
|
+
Array.isArray(T) && T[E] && (T = T[E]);
|
|
4346
|
+
} else
|
|
4347
|
+
T[b] && (T = T[b]);
|
|
4348
|
+
}
|
|
4349
|
+
const Q = ge(o.value, { indent: " " });
|
|
4350
|
+
n("update:modelValue", Q);
|
|
4351
|
+
} catch (V) {
|
|
4352
|
+
console.error("Failed to update attribute name:", V);
|
|
4353
|
+
}
|
|
4354
|
+
}, fe = (k, C, R) => {
|
|
4355
|
+
if (!(!o.value || !Array.isArray(o.value)))
|
|
4356
|
+
try {
|
|
4357
|
+
const V = k.split(/\./).filter(Boolean);
|
|
4358
|
+
let T = o.value;
|
|
4359
|
+
for (let f = 0; f < V.length; f++) {
|
|
4360
|
+
const b = V[f], u = b.match(/^(.+?)\[(\d+)\]$/);
|
|
4361
|
+
if (u) {
|
|
4362
|
+
const m = u[1], E = parseInt(u[2]);
|
|
4363
|
+
if (f === V.length - 1) {
|
|
4364
|
+
if (Array.isArray(T) && T[E]) {
|
|
4365
|
+
const w = T[E][":@"];
|
|
4366
|
+
w && w[`@_${C}`] !== void 0 && (w[`@_${C}`] = R);
|
|
4367
|
+
}
|
|
4368
|
+
} else
|
|
4369
|
+
Array.isArray(T) && T[E] && (T = T[E]);
|
|
4370
|
+
} else
|
|
4371
|
+
T[b] && (T = T[b]);
|
|
4372
|
+
}
|
|
4373
|
+
const Q = ge(o.value, { indent: " " });
|
|
4374
|
+
n("update:modelValue", Q);
|
|
4375
|
+
} catch (V) {
|
|
4376
|
+
console.error("Failed to update attribute value:", V);
|
|
4377
|
+
}
|
|
4378
|
+
}, se = (k, C) => {
|
|
4379
|
+
if (!(!o.value || !Array.isArray(o.value)))
|
|
4380
|
+
try {
|
|
4381
|
+
const R = k.split(/\./).filter(Boolean);
|
|
4382
|
+
let V = o.value, T = "";
|
|
4383
|
+
for (let f = 0; f < R.length; f++) {
|
|
4384
|
+
const b = R[f], u = b.match(/^(.+?)\[(\d+)\]$/);
|
|
4385
|
+
if (u) {
|
|
4386
|
+
const m = u[1], E = parseInt(u[2]);
|
|
4387
|
+
if (f === R.length - 1) {
|
|
4388
|
+
if (Array.isArray(V) && V[E]) {
|
|
4389
|
+
const A = V[E];
|
|
4390
|
+
if (T = Object.keys(A).find((w) => !w.startsWith(":") && !w.startsWith("#")) || "", T && Array.isArray(A[T])) {
|
|
4391
|
+
const w = A[T], L = w.findIndex((H) => H["#text"] !== void 0);
|
|
4392
|
+
L !== -1 ? w[L]["#text"] = C : w.push({ "#text": C });
|
|
4393
|
+
}
|
|
4394
|
+
}
|
|
4395
|
+
} else
|
|
4396
|
+
Array.isArray(V) && V[E] && (V = V[E]);
|
|
4397
|
+
} else
|
|
4398
|
+
V[b] && (V = V[b]);
|
|
4399
|
+
}
|
|
4400
|
+
const Q = ge(o.value, { indent: " " });
|
|
4401
|
+
n("update:modelValue", Q);
|
|
4402
|
+
} catch (R) {
|
|
4403
|
+
console.error("Failed to update text content:", R);
|
|
4404
|
+
}
|
|
4048
4405
|
};
|
|
4049
|
-
return
|
|
4050
|
-
|
|
4406
|
+
return Ge(() => s.modelValue, (k) => {
|
|
4407
|
+
v(k);
|
|
4051
4408
|
}, { immediate: !0 }), e({
|
|
4052
4409
|
// 核心操作方法
|
|
4053
|
-
copyXml:
|
|
4054
|
-
compressSource:
|
|
4055
|
-
formatSource:
|
|
4056
|
-
expandAll:
|
|
4057
|
-
collapseAll:
|
|
4058
|
-
toggleExpand:
|
|
4410
|
+
copyXml: j,
|
|
4411
|
+
compressSource: Y,
|
|
4412
|
+
formatSource: J,
|
|
4413
|
+
expandAll: S,
|
|
4414
|
+
collapseAll: _,
|
|
4415
|
+
toggleExpand: B,
|
|
4059
4416
|
// 状态访问方法
|
|
4060
4417
|
isValidXml: () => a.value,
|
|
4061
4418
|
getParsedXml: () => o.value,
|
|
4062
4419
|
getExpandedNodes: () => c.value,
|
|
4063
4420
|
getParseError: () => i.value,
|
|
4064
4421
|
// 工具方法
|
|
4065
|
-
parseXmlString: (
|
|
4066
|
-
copyValue: (
|
|
4067
|
-
}), (
|
|
4068
|
-
class:
|
|
4422
|
+
parseXmlString: (k) => v(k),
|
|
4423
|
+
copyValue: (k) => z(k)
|
|
4424
|
+
}), (k, C) => (O(), P("div", {
|
|
4425
|
+
class: je(["xml-format", `xml-format--${l.value.name}`])
|
|
4069
4426
|
}, [
|
|
4070
|
-
|
|
4071
|
-
y("div",
|
|
4427
|
+
k.showToolbar ? (O(), P("div", Qn, [
|
|
4428
|
+
y("div", Yn, [
|
|
4072
4429
|
y("button", {
|
|
4073
4430
|
class: "xml-format__btn xml-format__btn--primary",
|
|
4074
|
-
onClick:
|
|
4431
|
+
onClick: j,
|
|
4075
4432
|
disabled: !a.value,
|
|
4076
4433
|
title: "Copy XML"
|
|
4077
|
-
}, " 📋 Copy ", 8,
|
|
4434
|
+
}, " 📋 Copy ", 8, Gn),
|
|
4078
4435
|
y("button", {
|
|
4079
4436
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
4080
|
-
onClick:
|
|
4437
|
+
onClick: S,
|
|
4081
4438
|
disabled: !a.value,
|
|
4082
4439
|
title: "Expand All"
|
|
4083
|
-
}, " ⬇️ Expand All ", 8,
|
|
4440
|
+
}, " ⬇️ Expand All ", 8, Zn),
|
|
4084
4441
|
y("button", {
|
|
4085
4442
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
4086
|
-
onClick:
|
|
4443
|
+
onClick: _,
|
|
4087
4444
|
disabled: !a.value,
|
|
4088
4445
|
title: "Collapse All"
|
|
4089
|
-
}, " ➡️ Collapse All ", 8,
|
|
4446
|
+
}, " ➡️ Collapse All ", 8, zn),
|
|
4090
4447
|
y("button", {
|
|
4091
4448
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
4092
|
-
onClick:
|
|
4449
|
+
onClick: Y,
|
|
4093
4450
|
disabled: !a.value,
|
|
4094
4451
|
title: "Compress XML"
|
|
4095
|
-
}, " 📦 Compress ", 8,
|
|
4452
|
+
}, " 📦 Compress ", 8, Dn),
|
|
4096
4453
|
y("button", {
|
|
4097
4454
|
class: "xml-format__btn xml-format__btn--secondary",
|
|
4098
|
-
onClick:
|
|
4455
|
+
onClick: J,
|
|
4099
4456
|
disabled: !a.value,
|
|
4100
4457
|
title: "Format XML"
|
|
4101
|
-
}, " ✨ Format ", 8,
|
|
4458
|
+
}, " ✨ Format ", 8, Jn)
|
|
4102
4459
|
]),
|
|
4103
|
-
y("div",
|
|
4104
|
-
a.value ? (
|
|
4460
|
+
y("div", es, [
|
|
4461
|
+
a.value ? (O(), P("span", ts, " ✅ Valid XML ")) : (O(), P("span", rs, " ❌ Invalid XML "))
|
|
4105
4462
|
])
|
|
4106
|
-
])) :
|
|
4107
|
-
y("div",
|
|
4108
|
-
a.value ? (
|
|
4109
|
-
|
|
4463
|
+
])) : te("", !0),
|
|
4464
|
+
y("div", ns, [
|
|
4465
|
+
a.value ? (O(), P("div", os, [
|
|
4466
|
+
h.value ? (O(), P("div", {
|
|
4110
4467
|
key: 0,
|
|
4111
4468
|
class: "xml-declaration",
|
|
4112
|
-
style:
|
|
4113
|
-
},
|
|
4114
|
-
(
|
|
4115
|
-
key:
|
|
4116
|
-
node:
|
|
4117
|
-
index: R,
|
|
4469
|
+
style: $({ color: l.value.colors.xmlDeclaration })
|
|
4470
|
+
}, M(h.value), 5)) : te("", !0),
|
|
4471
|
+
(O(!0), P(pe, null, _e(x.value, (R, V) => (O(), Ze(jr, {
|
|
4472
|
+
key: V,
|
|
4473
|
+
node: R.node,
|
|
4474
|
+
index: R.originalIndex,
|
|
4118
4475
|
level: 0,
|
|
4119
4476
|
expanded: c.value,
|
|
4120
4477
|
theme: l.value,
|
|
4121
|
-
onToggleExpand:
|
|
4122
|
-
onCopy:
|
|
4478
|
+
onToggleExpand: B,
|
|
4479
|
+
onCopy: z,
|
|
4480
|
+
"onUpdate:tagName": ae,
|
|
4481
|
+
"onUpdate:attributeName": ce,
|
|
4482
|
+
"onUpdate:attributeValue": fe,
|
|
4483
|
+
"onUpdate:textContent": se
|
|
4123
4484
|
}, null, 8, ["node", "index", "expanded", "theme"]))), 128))
|
|
4124
|
-
])) : (
|
|
4485
|
+
])) : (O(), P("div", ss, [
|
|
4125
4486
|
C[0] || (C[0] = y("h4", null, "XML Parse Error:", -1)),
|
|
4126
|
-
y("pre", null,
|
|
4487
|
+
y("pre", null, M(i.value), 1)
|
|
4127
4488
|
]))
|
|
4128
4489
|
])
|
|
4129
4490
|
], 2));
|
|
4130
4491
|
}
|
|
4131
|
-
}),
|
|
4132
|
-
|
|
4492
|
+
}), ds = /* @__PURE__ */ $e(is, [["__scopeId", "data-v-28f02178"]]), as = [ir], ls = (r) => {
|
|
4493
|
+
as.forEach((e) => {
|
|
4133
4494
|
const t = e.name || e.__name || "UnknownComponent";
|
|
4134
4495
|
r.component(t, e);
|
|
4135
4496
|
});
|
|
4136
|
-
},
|
|
4137
|
-
install:
|
|
4497
|
+
}, fs = {
|
|
4498
|
+
install: ls
|
|
4138
4499
|
};
|
|
4139
4500
|
export {
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4501
|
+
ir as JsonFormat,
|
|
4502
|
+
ds as XmlFormat,
|
|
4503
|
+
fs as default
|
|
4143
4504
|
};
|