lone-format 0.12.2 → 0.14.0

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.
Files changed (32) hide show
  1. package/dist/_chunks/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
  2. package/dist/_chunks/index-5wbkWClK.js +1006 -0
  3. package/dist/_chunks/index-AlOFzpXl.js +795 -0
  4. package/dist/_chunks/index-BAEkF-Fh.js +1785 -0
  5. package/dist/components/JsonFormat/JsonNode.vue.d.ts +29 -0
  6. package/dist/components/JsonFormat/index.d.ts +2 -0
  7. package/dist/components/JsonFormat/index.js +4 -0
  8. package/dist/components/JsonFormat/index.vue.d.ts +51 -0
  9. package/dist/components/JsonFormat/themes.d.ts +29 -0
  10. package/dist/components/JsonFormat/types.d.ts +97 -0
  11. package/dist/components/SqlFormat/SqlClauseNode.vue.d.ts +13 -0
  12. package/dist/components/SqlFormat/index.d.ts +5 -0
  13. package/dist/components/SqlFormat/index.js +5 -0
  14. package/dist/components/SqlFormat/index.vue.d.ts +44 -0
  15. package/dist/components/SqlFormat/parser.d.ts +34 -0
  16. package/dist/components/SqlFormat/themes.d.ts +33 -0
  17. package/dist/components/SqlFormat/types.d.ts +100 -0
  18. package/dist/components/XmlFormat/XmlNode.vue.d.ts +37 -0
  19. package/dist/components/XmlFormat/index.d.ts +7 -0
  20. package/dist/components/XmlFormat/index.js +27 -0
  21. package/dist/components/XmlFormat/index.vue.d.ts +58 -0
  22. package/dist/components/XmlFormat/parser.d.ts +93 -0
  23. package/dist/components/XmlFormat/themes.d.ts +29 -0
  24. package/dist/components/XmlFormat/types.d.ts +114 -0
  25. package/dist/components/index.d.ts +6 -0
  26. package/dist/index.d.ts +6 -1
  27. package/dist/lone-format.css +1 -1
  28. package/dist/lone-format.js +13 -32008
  29. package/dist/lone-format.umd.cjs +50 -50
  30. package/dist/types/components.d.ts +1 -0
  31. package/dist/types/index.d.ts +6 -0
  32. package/package.json +8 -3
@@ -0,0 +1,1785 @@
1
+ import { defineComponent as Ce, useCssVars as $e, ref as I, computed as L, resolveComponent as De, createElementBlock as w, openBlock as $, normalizeStyle as c, createCommentVNode as pe, createElementVNode as n, toDisplayString as D, withKeys as A, withModifiers as j, Fragment as se, renderList as ie, createBlock as Be, nextTick as ae, watch as Ee, normalizeClass as Ve } from "vue";
2
+ import We from "xpath";
3
+ import { DOMParser as Ke, XMLSerializer as Xe } from "@xmldom/xmldom";
4
+ import { _ as we } from "./_plugin-vue_export-helper-CHgC5LLL.js";
5
+ import { XMLValidator as Oe, XMLParser as Pe, XMLBuilder as Ne } from "fast-xml-parser";
6
+ const Re = {
7
+ key: 0,
8
+ class: "xml-node__comment"
9
+ }, je = {
10
+ key: 1,
11
+ class: "xml-node__cdata"
12
+ }, qe = {
13
+ key: 2,
14
+ class: "xml-node__element"
15
+ }, Ie = {
16
+ key: 0,
17
+ class: "xml-node__line"
18
+ }, Le = ["contenteditable", "onKeydown"], Ue = ["contenteditable", "onDblclick", "onKeydown"], Fe = ["contenteditable", "onDblclick", "onKeydown"], Me = ["contenteditable", "onKeydown"], Se = {
19
+ key: 1,
20
+ class: "xml-node__line"
21
+ }, Qe = ["contenteditable", "onKeydown"], He = ["contenteditable", "onDblclick", "onKeydown"], ze = ["contenteditable", "onDblclick", "onKeydown"], Ze = ["contenteditable", "onKeydown"], Je = {
22
+ key: 2,
23
+ class: "xml-node__line"
24
+ }, Ge = ["contenteditable", "onKeydown"], Ye = ["contenteditable", "onDblclick", "onKeydown"], et = ["contenteditable", "onDblclick", "onKeydown"], tt = {
25
+ key: 3,
26
+ class: "xml-node__line"
27
+ }, lt = ["contenteditable", "onKeydown"], at = ["contenteditable", "onDblclick", "onKeydown"], nt = ["contenteditable", "onDblclick", "onKeydown"], ot = { key: 4 }, st = {
28
+ key: 0,
29
+ class: "xml-node__line"
30
+ }, rt = ["contenteditable", "onKeydown"], ct = ["contenteditable", "onDblclick", "onKeydown"], it = ["contenteditable", "onDblclick", "onKeydown"], ut = ["title"], dt = { class: "xml-node__line" }, mt = ["title"], ft = ["contenteditable", "onKeydown"], vt = { key: 1 }, pt = ["contenteditable", "onKeydown"], yt = ["contenteditable", "onDblclick", "onKeydown"], ht = ["contenteditable", "onDblclick", "onKeydown"], bt = ["title"], _t = {
31
+ key: 0,
32
+ class: "xml-node__children"
33
+ }, xt = {
34
+ key: 0,
35
+ class: "xml-node__text"
36
+ }, gt = ["contenteditable", "onKeydown"], kt = {
37
+ key: 1,
38
+ class: "xml-node__line"
39
+ }, At = /* @__PURE__ */ Ce({
40
+ __name: "XmlNode",
41
+ props: {
42
+ node: {},
43
+ index: {},
44
+ level: { default: 0 },
45
+ parentPath: { default: "" },
46
+ expanded: {},
47
+ theme: {},
48
+ selfClosingTags: { default: () => /* @__PURE__ */ new Set() }
49
+ },
50
+ emits: ["toggle-expand", "copy", "update:tagName", "update:attributeName", "update:attributeValue", "update:textContent", "update:cdataContent"],
51
+ setup(s, { emit: m }) {
52
+ $e((e) => ({
53
+ "451d9899": e.theme.colors.collapsedText,
54
+ "6296679a": e.theme.colors.collapsedBackground,
55
+ cd71bc7c: e.theme.colors.collapsedBackgroundHover,
56
+ "30a02a6b": e.theme.colors.indentLine
57
+ }));
58
+ const i = s, p = m, y = I(!1), o = I(null), h = I(null), E = I(!1), B = I(!1), x = I(""), b = I(""), X = I(""), O = I(""), S = I(""), P = I(null), z = I(null), Q = I(null), U = I(null), Y = I(null), K = L(() => Object.keys(i.node).find((r) => !r.startsWith(":") && !r.startsWith("#")) || ""), J = L(() => K.value ? i.parentPath ? `${i.parentPath}.${K.value}[${i.index}]` : `${K.value}[${i.index}]` : ""), ee = L(() => i.expanded.has(J.value)), T = L(() => i.node["#comment"] ? "comment" : i.node.__cdata ? "cdata" : K.value ? "element" : "unknown"), R = L(() => {
59
+ const e = i.node[":@"] || {}, r = {};
60
+ return Object.keys(e).forEach((M) => {
61
+ M.startsWith("@_") && (r[M.substring(2)] = e[M]);
62
+ }), r;
63
+ }), G = L(() => {
64
+ if (T.value !== "element" || !K.value) return [];
65
+ const e = i.node[K.value];
66
+ return Array.isArray(e) ? e : [];
67
+ }), ue = L(() => G.value.some((e) => e.__cdata)), de = L(() => {
68
+ if (!ue.value) return "";
69
+ const e = G.value.find((r) => r.__cdata);
70
+ if (e && Array.isArray(e.__cdata)) {
71
+ const r = e.__cdata;
72
+ if (r.length > 0 && r[0]["#text"])
73
+ return r[0]["#text"];
74
+ }
75
+ return "";
76
+ }), te = L(() => {
77
+ if (T.value !== "element" || !K.value || ue.value) return "";
78
+ const e = i.node[K.value];
79
+ if (!Array.isArray(e)) return "";
80
+ const r = e.find((M) => M["#text"]);
81
+ return r ? r["#text"] : "";
82
+ }), he = L(() => {
83
+ if (T.value !== "comment") return "";
84
+ const e = i.node["#comment"];
85
+ return Array.isArray(e) && e.length > 0 && e[0]["#text"] || "";
86
+ }), Z = L(() => G.value.some((e) => Object.keys(e).some((M) => !M.startsWith("#") && !M.startsWith(":")))), me = L(() => Z.value ? G.value.filter((e) => Object.keys(e).some((M) => !M.startsWith("#") && !M.startsWith(":"))).length : 0), be = L(() => T.value === "element" && !Z.value && te.value !== ""), fe = L(() => T.value === "element" && !Z.value && te.value === ""), ye = L(() => fe.value ? i.node[":selfClosing"] === !0 : !1), ne = () => {
87
+ Z.value && p("toggle-expand", J.value);
88
+ }, _e = (e, r) => `${J.value}-child-${r}`, xe = () => `${J.value}.${K.value}`, le = () => {
89
+ y.value = !0, x.value = K.value, ae(() => {
90
+ if (P.value) {
91
+ P.value.focus();
92
+ const e = document.createRange();
93
+ e.selectNodeContents(P.value);
94
+ const r = window.getSelection();
95
+ r?.removeAllRanges(), r?.addRange(e);
96
+ }
97
+ });
98
+ }, ce = (e) => {
99
+ o.value = e, b.value = e, ae(() => {
100
+ if (z.value) {
101
+ z.value.focus();
102
+ const r = document.createRange();
103
+ r.selectNodeContents(z.value);
104
+ const M = window.getSelection();
105
+ M?.removeAllRanges(), M?.addRange(r);
106
+ }
107
+ });
108
+ }, t = (e) => {
109
+ h.value = e, X.value = R.value[e] || "", ae(() => {
110
+ if (Q.value) {
111
+ Q.value.focus();
112
+ const r = document.createRange();
113
+ r.selectNodeContents(Q.value);
114
+ const M = window.getSelection();
115
+ M?.removeAllRanges(), M?.addRange(r);
116
+ }
117
+ });
118
+ }, d = () => {
119
+ E.value = !0, O.value = te.value, ae(() => {
120
+ if (U.value) {
121
+ U.value.focus();
122
+ const e = document.createRange();
123
+ e.selectNodeContents(U.value);
124
+ const r = window.getSelection();
125
+ r?.removeAllRanges(), r?.addRange(e);
126
+ }
127
+ });
128
+ }, f = () => {
129
+ if (!y.value) return;
130
+ const e = P.value?.innerText.trim() || "";
131
+ if (!e || e === K.value) {
132
+ y.value = !1;
133
+ return;
134
+ }
135
+ y.value = !1, p("update:tagName", J.value, K.value, e);
136
+ }, l = () => {
137
+ if (!o.value) return;
138
+ const e = o.value, r = z.value?.innerText.trim() || "";
139
+ if (!r || r === e) {
140
+ o.value = null;
141
+ return;
142
+ }
143
+ o.value = null, p("update:attributeName", J.value, e, r);
144
+ }, a = () => {
145
+ if (!h.value) return;
146
+ const e = h.value, r = Q.value?.innerText.trim() || "";
147
+ h.value = null, p("update:attributeValue", J.value, e, r);
148
+ }, g = () => {
149
+ if (!E.value) return;
150
+ const e = U.value?.innerText || "";
151
+ if (e === te.value) {
152
+ E.value = !1;
153
+ return;
154
+ }
155
+ E.value = !1, p("update:textContent", J.value, e);
156
+ }, v = () => {
157
+ y.value = !1, x.value = K.value;
158
+ }, C = () => {
159
+ o.value && (b.value = o.value, o.value = null);
160
+ }, k = () => {
161
+ h.value && (X.value = R.value[h.value] || "", h.value = null);
162
+ }, N = () => {
163
+ E.value = !1, O.value = te.value;
164
+ }, W = () => {
165
+ B.value = !0, S.value = de.value, ae(() => {
166
+ if (Y.value) {
167
+ Y.value.focus();
168
+ const e = document.createRange();
169
+ e.selectNodeContents(Y.value);
170
+ const r = window.getSelection();
171
+ r?.removeAllRanges(), r?.addRange(e);
172
+ }
173
+ });
174
+ }, q = () => {
175
+ if (!B.value) return;
176
+ const e = Y.value?.innerText || "";
177
+ if (e === de.value) {
178
+ B.value = !1;
179
+ return;
180
+ }
181
+ B.value = !1, p("update:cdataContent", J.value, e);
182
+ }, V = () => {
183
+ B.value = !1, S.value = de.value;
184
+ }, H = (e) => {
185
+ Z.value && (e.preventDefault(), le());
186
+ };
187
+ return (e, r) => {
188
+ const M = De("XmlNode", !0);
189
+ return $(), w("div", {
190
+ class: "xml-node",
191
+ style: c({ paddingLeft: e.level > 0 ? "16px" : "0" })
192
+ }, [
193
+ T.value === "comment" ? ($(), w("div", Re, [
194
+ n("span", {
195
+ style: c({ color: e.theme.colors.xmlComment })
196
+ }, " <!-- " + D(he.value) + " --> ", 5)
197
+ ])) : T.value === "cdata" ? ($(), w("div", je, [
198
+ n("span", {
199
+ style: c({ color: e.theme.colors.xmlCdata })
200
+ }, " <![CDATA[" + D(e.node.__cdata) + "]]> ", 5)
201
+ ])) : T.value === "element" ? ($(), w("div", qe, [
202
+ ue.value ? ($(), w("div", Ie, [
203
+ n("span", {
204
+ class: "xml-node__bracket",
205
+ style: c({ color: e.theme.colors.xmlBracket })
206
+ }, "<", 4),
207
+ n("span", {
208
+ class: "xml-node__tag xml-node__tag--editable",
209
+ style: c({ color: e.theme.colors.xmlTag }),
210
+ contenteditable: y.value,
211
+ onDblclick: le,
212
+ onContextmenu: H,
213
+ onKeydown: [
214
+ A(j(f, ["prevent"]), ["enter"]),
215
+ A(v, ["escape"])
216
+ ],
217
+ onBlur: f,
218
+ ref_key: "tagNameRef",
219
+ ref: P,
220
+ title: "Double-click to edit tag name"
221
+ }, D(y.value ? x.value : K.value), 45, Le),
222
+ ($(!0), w(se, null, ie(R.value, (F, u) => ($(), w("span", {
223
+ key: u,
224
+ class: "xml-node__attribute"
225
+ }, [
226
+ n("span", {
227
+ class: "xml-node__attr-name xml-node__attr-name--editable",
228
+ style: c({ color: e.theme.colors.xmlAttribute }),
229
+ contenteditable: o.value === u,
230
+ onDblclick: (_) => ce(u),
231
+ onKeydown: [
232
+ A(j(l, ["prevent"]), ["enter"]),
233
+ A(C, ["escape"])
234
+ ],
235
+ onBlur: l,
236
+ ref_for: !0,
237
+ ref: (_) => {
238
+ o.value === u && (z.value = _);
239
+ },
240
+ title: "Double-click to edit attribute name"
241
+ }, D(o.value === u ? b.value : u), 45, Ue),
242
+ n("span", {
243
+ class: "xml-node__equals",
244
+ style: c({ color: e.theme.colors.xmlEquals })
245
+ }, "=", 4),
246
+ n("span", {
247
+ class: "xml-node__quote",
248
+ style: c({ color: e.theme.colors.xmlQuote })
249
+ }, '"', 4),
250
+ n("span", {
251
+ class: "xml-node__attr-value xml-node__attr-value--editable",
252
+ style: c({ color: e.theme.colors.xmlAttributeValue }),
253
+ contenteditable: h.value === u,
254
+ onDblclick: (_) => t(u),
255
+ onKeydown: [
256
+ A(j(a, ["prevent"]), ["enter"]),
257
+ A(k, ["escape"])
258
+ ],
259
+ onBlur: a,
260
+ ref_for: !0,
261
+ ref: (_) => {
262
+ h.value === u && (Q.value = _);
263
+ },
264
+ title: "Double-click to edit attribute value"
265
+ }, D(h.value === u ? X.value : F), 45, Fe),
266
+ n("span", {
267
+ class: "xml-node__quote",
268
+ style: c({ color: e.theme.colors.xmlQuote })
269
+ }, '"', 4)
270
+ ]))), 128)),
271
+ n("span", {
272
+ class: "xml-node__bracket",
273
+ style: c({ color: e.theme.colors.xmlBracket })
274
+ }, ">", 4),
275
+ n("span", {
276
+ class: "xml-node__cdata",
277
+ style: c({ color: e.theme.colors.xmlCdata })
278
+ }, "<![CDATA[", 4),
279
+ n("span", {
280
+ class: "xml-node__cdata-content xml-node__cdata-content--editable",
281
+ style: c({ color: e.theme.colors.xmlCdata }),
282
+ contenteditable: B.value,
283
+ onDblclick: W,
284
+ onKeydown: [
285
+ A(j(q, ["prevent"]), ["enter"]),
286
+ A(V, ["escape"])
287
+ ],
288
+ onBlur: q,
289
+ ref_key: "cdataContentRef",
290
+ ref: Y,
291
+ title: "Double-click to edit CDATA content"
292
+ }, D(B.value ? S.value : de.value), 45, Me),
293
+ n("span", {
294
+ class: "xml-node__cdata",
295
+ style: c({ color: e.theme.colors.xmlCdata })
296
+ }, "]]>", 4),
297
+ n("span", {
298
+ class: "xml-node__bracket",
299
+ style: c({ color: e.theme.colors.xmlBracket })
300
+ }, "</", 4),
301
+ n("span", {
302
+ class: "xml-node__tag",
303
+ style: c({ color: e.theme.colors.xmlTag })
304
+ }, D(y.value ? x.value : K.value), 5),
305
+ n("span", {
306
+ class: "xml-node__bracket",
307
+ style: c({ color: e.theme.colors.xmlBracket })
308
+ }, ">", 4)
309
+ ])) : be.value ? ($(), w("div", Se, [
310
+ n("span", {
311
+ class: "xml-node__bracket",
312
+ style: c({ color: e.theme.colors.xmlBracket })
313
+ }, "<", 4),
314
+ n("span", {
315
+ class: "xml-node__tag xml-node__tag--editable",
316
+ style: c({ color: e.theme.colors.xmlTag }),
317
+ contenteditable: y.value,
318
+ onDblclick: le,
319
+ onContextmenu: H,
320
+ onKeydown: [
321
+ A(j(f, ["prevent"]), ["enter"]),
322
+ A(v, ["escape"])
323
+ ],
324
+ onBlur: f,
325
+ ref_key: "tagNameRef",
326
+ ref: P,
327
+ title: "Double-click to edit tag name"
328
+ }, D(y.value ? x.value : K.value), 45, Qe),
329
+ ($(!0), w(se, null, ie(R.value, (F, u) => ($(), w("span", {
330
+ key: u,
331
+ class: "xml-node__attribute"
332
+ }, [
333
+ n("span", {
334
+ class: "xml-node__attr-name xml-node__attr-name--editable",
335
+ style: c({ color: e.theme.colors.xmlAttribute }),
336
+ contenteditable: o.value === u,
337
+ onDblclick: (_) => ce(u),
338
+ onKeydown: [
339
+ A(j(l, ["prevent"]), ["enter"]),
340
+ A(C, ["escape"])
341
+ ],
342
+ onBlur: l,
343
+ ref_for: !0,
344
+ ref: (_) => {
345
+ o.value === u && (z.value = _);
346
+ },
347
+ title: "Double-click to edit attribute name"
348
+ }, D(o.value === u ? b.value : u), 45, He),
349
+ n("span", {
350
+ class: "xml-node__equals",
351
+ style: c({ color: e.theme.colors.xmlEquals })
352
+ }, "=", 4),
353
+ n("span", {
354
+ class: "xml-node__quote",
355
+ style: c({ color: e.theme.colors.xmlQuote })
356
+ }, '"', 4),
357
+ n("span", {
358
+ class: "xml-node__attr-value xml-node__attr-value--editable",
359
+ style: c({ color: e.theme.colors.xmlAttributeValue }),
360
+ contenteditable: h.value === u,
361
+ onDblclick: (_) => t(u),
362
+ onKeydown: [
363
+ A(j(a, ["prevent"]), ["enter"]),
364
+ A(k, ["escape"])
365
+ ],
366
+ onBlur: a,
367
+ ref_for: !0,
368
+ ref: (_) => {
369
+ h.value === u && (Q.value = _);
370
+ },
371
+ title: "Double-click to edit attribute value"
372
+ }, D(h.value === u ? X.value : F), 45, ze),
373
+ n("span", {
374
+ class: "xml-node__quote",
375
+ style: c({ color: e.theme.colors.xmlQuote })
376
+ }, '"', 4)
377
+ ]))), 128)),
378
+ n("span", {
379
+ class: "xml-node__bracket",
380
+ style: c({ color: e.theme.colors.xmlBracket })
381
+ }, ">", 4),
382
+ n("span", {
383
+ class: "xml-node__text-content xml-node__text-content--editable",
384
+ style: c({ color: e.theme.colors.xmlText }),
385
+ contenteditable: E.value,
386
+ onDblclick: d,
387
+ onKeydown: [
388
+ A(j(g, ["prevent"]), ["enter"]),
389
+ A(N, ["escape"])
390
+ ],
391
+ onBlur: g,
392
+ ref_key: "textContentRef",
393
+ ref: U,
394
+ title: "Double-click to edit text content"
395
+ }, D(E.value ? O.value : te.value), 45, Ze),
396
+ n("span", {
397
+ class: "xml-node__bracket",
398
+ style: c({ color: e.theme.colors.xmlBracket })
399
+ }, "</", 4),
400
+ n("span", {
401
+ class: "xml-node__tag",
402
+ style: c({ color: e.theme.colors.xmlTag })
403
+ }, D(y.value ? x.value : K.value), 5),
404
+ n("span", {
405
+ class: "xml-node__bracket",
406
+ style: c({ color: e.theme.colors.xmlBracket })
407
+ }, ">", 4)
408
+ ])) : fe.value && ye.value ? ($(), w("div", Je, [
409
+ n("span", {
410
+ class: "xml-node__bracket",
411
+ style: c({ color: e.theme.colors.xmlBracket })
412
+ }, "<", 4),
413
+ n("span", {
414
+ class: "xml-node__tag xml-node__tag--editable",
415
+ style: c({ color: e.theme.colors.xmlTag }),
416
+ contenteditable: y.value,
417
+ onDblclick: le,
418
+ onContextmenu: H,
419
+ onKeydown: [
420
+ A(j(f, ["prevent"]), ["enter"]),
421
+ A(v, ["escape"])
422
+ ],
423
+ onBlur: f,
424
+ ref_key: "tagNameRef",
425
+ ref: P,
426
+ title: "Double-click to edit tag name"
427
+ }, D(y.value ? x.value : K.value), 45, Ge),
428
+ ($(!0), w(se, null, ie(R.value, (F, u) => ($(), w("span", {
429
+ key: u,
430
+ class: "xml-node__attribute"
431
+ }, [
432
+ n("span", {
433
+ class: "xml-node__attr-name xml-node__attr-name--editable",
434
+ style: c({ color: e.theme.colors.xmlAttribute }),
435
+ contenteditable: o.value === u,
436
+ onDblclick: (_) => ce(u),
437
+ onKeydown: [
438
+ A(j(l, ["prevent"]), ["enter"]),
439
+ A(C, ["escape"])
440
+ ],
441
+ onBlur: l,
442
+ ref_for: !0,
443
+ ref: (_) => {
444
+ o.value === u && (z.value = _);
445
+ },
446
+ title: "Double-click to edit attribute name"
447
+ }, D(o.value === u ? b.value : u), 45, Ye),
448
+ n("span", {
449
+ class: "xml-node__equals",
450
+ style: c({ color: e.theme.colors.xmlEquals })
451
+ }, "=", 4),
452
+ n("span", {
453
+ class: "xml-node__quote",
454
+ style: c({ color: e.theme.colors.xmlQuote })
455
+ }, '"', 4),
456
+ n("span", {
457
+ class: "xml-node__attr-value xml-node__attr-value--editable",
458
+ style: c({ color: e.theme.colors.xmlAttributeValue }),
459
+ contenteditable: h.value === u,
460
+ onDblclick: (_) => t(u),
461
+ onKeydown: [
462
+ A(j(a, ["prevent"]), ["enter"]),
463
+ A(k, ["escape"])
464
+ ],
465
+ onBlur: a,
466
+ ref_for: !0,
467
+ ref: (_) => {
468
+ h.value === u && (Q.value = _);
469
+ },
470
+ title: "Double-click to edit attribute value"
471
+ }, D(h.value === u ? X.value : F), 45, et),
472
+ n("span", {
473
+ class: "xml-node__quote",
474
+ style: c({ color: e.theme.colors.xmlQuote })
475
+ }, '"', 4)
476
+ ]))), 128)),
477
+ n("span", {
478
+ class: "xml-node__bracket",
479
+ style: c({ color: e.theme.colors.xmlBracket })
480
+ }, " />", 4)
481
+ ])) : fe.value ? ($(), w("div", tt, [
482
+ n("span", {
483
+ class: "xml-node__bracket",
484
+ style: c({ color: e.theme.colors.xmlBracket })
485
+ }, "<", 4),
486
+ n("span", {
487
+ class: "xml-node__tag xml-node__tag--editable",
488
+ style: c({ color: e.theme.colors.xmlTag }),
489
+ contenteditable: y.value,
490
+ onDblclick: le,
491
+ onContextmenu: H,
492
+ onKeydown: [
493
+ A(j(f, ["prevent"]), ["enter"]),
494
+ A(v, ["escape"])
495
+ ],
496
+ onBlur: f,
497
+ ref_key: "tagNameRef",
498
+ ref: P,
499
+ title: "Double-click to edit tag name"
500
+ }, D(y.value ? x.value : K.value), 45, lt),
501
+ ($(!0), w(se, null, ie(R.value, (F, u) => ($(), w("span", {
502
+ key: u,
503
+ class: "xml-node__attribute"
504
+ }, [
505
+ n("span", {
506
+ class: "xml-node__attr-name xml-node__attr-name--editable",
507
+ style: c({ color: e.theme.colors.xmlAttribute }),
508
+ contenteditable: o.value === u,
509
+ onDblclick: (_) => ce(u),
510
+ onKeydown: [
511
+ A(j(l, ["prevent"]), ["enter"]),
512
+ A(C, ["escape"])
513
+ ],
514
+ onBlur: l,
515
+ ref_for: !0,
516
+ ref: (_) => {
517
+ o.value === u && (z.value = _);
518
+ },
519
+ title: "Double-click to edit attribute name"
520
+ }, D(o.value === u ? b.value : u), 45, at),
521
+ n("span", {
522
+ class: "xml-node__equals",
523
+ style: c({ color: e.theme.colors.xmlEquals })
524
+ }, "=", 4),
525
+ n("span", {
526
+ class: "xml-node__quote",
527
+ style: c({ color: e.theme.colors.xmlQuote })
528
+ }, '"', 4),
529
+ n("span", {
530
+ class: "xml-node__attr-value xml-node__attr-value--editable",
531
+ style: c({ color: e.theme.colors.xmlAttributeValue }),
532
+ contenteditable: h.value === u,
533
+ onDblclick: (_) => t(u),
534
+ onKeydown: [
535
+ A(j(a, ["prevent"]), ["enter"]),
536
+ A(k, ["escape"])
537
+ ],
538
+ onBlur: a,
539
+ ref_for: !0,
540
+ ref: (_) => {
541
+ h.value === u && (Q.value = _);
542
+ },
543
+ title: "Double-click to edit attribute value"
544
+ }, D(h.value === u ? X.value : F), 45, nt),
545
+ n("span", {
546
+ class: "xml-node__quote",
547
+ style: c({ color: e.theme.colors.xmlQuote })
548
+ }, '"', 4)
549
+ ]))), 128)),
550
+ n("span", {
551
+ class: "xml-node__bracket",
552
+ style: c({ color: e.theme.colors.xmlBracket })
553
+ }, "></", 4),
554
+ n("span", {
555
+ class: "xml-node__tag",
556
+ style: c({ color: e.theme.colors.xmlTag })
557
+ }, D(y.value ? x.value : K.value), 5),
558
+ n("span", {
559
+ class: "xml-node__bracket",
560
+ style: c({ color: e.theme.colors.xmlBracket })
561
+ }, ">", 4)
562
+ ])) : ($(), w("div", ot, [
563
+ !ee.value && Z.value ? ($(), w("div", st, [
564
+ n("span", {
565
+ class: "xml-node__clickable-part",
566
+ onClick: r[0] || (r[0] = (F) => ne()),
567
+ title: "Click to expand"
568
+ }, [
569
+ n("span", {
570
+ class: "xml-node__bracket",
571
+ style: c({ color: e.theme.colors.xmlBracket })
572
+ }, "<", 4),
573
+ n("span", {
574
+ class: "xml-node__tag xml-node__tag--editable",
575
+ style: c({ color: e.theme.colors.xmlTag }),
576
+ contenteditable: y.value,
577
+ onDblclick: j(le, ["stop"]),
578
+ onContextmenu: H,
579
+ onKeydown: [
580
+ A(j(f, ["prevent"]), ["enter"]),
581
+ A(v, ["escape"])
582
+ ],
583
+ onBlur: f,
584
+ ref_key: "tagNameRef",
585
+ ref: P,
586
+ title: "Double-click or right-click to edit tag name"
587
+ }, D(y.value ? x.value : K.value), 45, rt)
588
+ ]),
589
+ ($(!0), w(se, null, ie(R.value, (F, u) => ($(), w("span", {
590
+ key: u,
591
+ class: "xml-node__attribute"
592
+ }, [
593
+ n("span", {
594
+ class: "xml-node__attr-name xml-node__attr-name--editable",
595
+ style: c({ color: e.theme.colors.xmlAttribute }),
596
+ contenteditable: o.value === u,
597
+ onDblclick: (_) => ce(u),
598
+ onKeydown: [
599
+ A(j(l, ["prevent"]), ["enter"]),
600
+ A(C, ["escape"])
601
+ ],
602
+ onBlur: l,
603
+ ref_for: !0,
604
+ ref: (_) => {
605
+ o.value === u && (z.value = _);
606
+ },
607
+ title: "Double-click to edit attribute name"
608
+ }, D(o.value === u ? b.value : u), 45, ct),
609
+ n("span", {
610
+ class: "xml-node__equals",
611
+ style: c({ color: e.theme.colors.xmlEquals })
612
+ }, "=", 4),
613
+ n("span", {
614
+ class: "xml-node__quote",
615
+ style: c({ color: e.theme.colors.xmlQuote })
616
+ }, '"', 4),
617
+ n("span", {
618
+ class: "xml-node__attr-value xml-node__attr-value--editable",
619
+ style: c({ color: e.theme.colors.xmlAttributeValue }),
620
+ contenteditable: h.value === u,
621
+ onDblclick: (_) => t(u),
622
+ onKeydown: [
623
+ A(j(a, ["prevent"]), ["enter"]),
624
+ A(k, ["escape"])
625
+ ],
626
+ onBlur: a,
627
+ ref_for: !0,
628
+ ref: (_) => {
629
+ h.value === u && (Q.value = _);
630
+ },
631
+ title: "Double-click to edit attribute value"
632
+ }, D(h.value === u ? X.value : F), 45, it),
633
+ n("span", {
634
+ class: "xml-node__quote",
635
+ style: c({ color: e.theme.colors.xmlQuote })
636
+ }, '"', 4)
637
+ ]))), 128)),
638
+ n("span", {
639
+ class: "xml-node__clickable-part",
640
+ onClick: r[1] || (r[1] = (F) => ne()),
641
+ title: "Click to expand"
642
+ }, [
643
+ n("span", {
644
+ class: "xml-node__bracket",
645
+ style: c({ color: e.theme.colors.xmlBracket })
646
+ }, ">", 4)
647
+ ]),
648
+ n("span", {
649
+ class: "xml-node__collapsed-badge",
650
+ onClick: r[2] || (r[2] = (F) => ne()),
651
+ title: `Click to expand ${me.value} tag${me.value > 1 ? "s" : ""}`
652
+ }, D(me.value) + " tag" + D(me.value > 1 ? "s" : ""), 9, ut),
653
+ n("span", {
654
+ class: "xml-node__clickable-part",
655
+ onClick: r[3] || (r[3] = (F) => ne()),
656
+ title: "Click to expand"
657
+ }, [
658
+ n("span", {
659
+ class: "xml-node__bracket",
660
+ style: c({ color: e.theme.colors.xmlBracket })
661
+ }, "</", 4),
662
+ n("span", {
663
+ class: "xml-node__tag",
664
+ style: c({ color: e.theme.colors.xmlTag })
665
+ }, D(y.value ? x.value : K.value), 5),
666
+ n("span", {
667
+ class: "xml-node__bracket",
668
+ style: c({ color: e.theme.colors.xmlBracket })
669
+ }, ">", 4)
670
+ ])
671
+ ])) : ($(), w(se, { key: 1 }, [
672
+ n("div", dt, [
673
+ Z.value ? ($(), w("span", {
674
+ key: 0,
675
+ class: "xml-node__clickable-part",
676
+ onClick: r[4] || (r[4] = (F) => ne()),
677
+ title: ee.value ? "Click to collapse" : "Click to expand"
678
+ }, [
679
+ n("span", {
680
+ class: "xml-node__bracket",
681
+ style: c({ color: e.theme.colors.xmlBracket })
682
+ }, "<", 4),
683
+ n("span", {
684
+ class: "xml-node__tag xml-node__tag--editable",
685
+ style: c({ color: e.theme.colors.xmlTag }),
686
+ contenteditable: y.value,
687
+ onDblclick: j(le, ["stop"]),
688
+ onContextmenu: H,
689
+ onKeydown: [
690
+ A(j(f, ["prevent"]), ["enter"]),
691
+ A(v, ["escape"])
692
+ ],
693
+ onBlur: f,
694
+ ref_key: "tagNameRef",
695
+ ref: P,
696
+ title: "Double-click or right-click to edit tag name"
697
+ }, D(y.value ? x.value : K.value), 45, ft)
698
+ ], 8, mt)) : ($(), w("span", vt, [
699
+ n("span", {
700
+ class: "xml-node__bracket",
701
+ style: c({ color: e.theme.colors.xmlBracket })
702
+ }, "<", 4),
703
+ n("span", {
704
+ class: "xml-node__tag xml-node__tag--editable",
705
+ style: c({ color: e.theme.colors.xmlTag }),
706
+ contenteditable: y.value,
707
+ onDblclick: le,
708
+ onKeydown: [
709
+ A(j(f, ["prevent"]), ["enter"]),
710
+ A(v, ["escape"])
711
+ ],
712
+ onBlur: f,
713
+ ref_key: "tagNameRef",
714
+ ref: P,
715
+ title: "Double-click to edit tag name"
716
+ }, D(y.value ? x.value : K.value), 45, pt)
717
+ ])),
718
+ ($(!0), w(se, null, ie(R.value, (F, u) => ($(), w("span", {
719
+ key: u,
720
+ class: "xml-node__attribute"
721
+ }, [
722
+ n("span", {
723
+ class: "xml-node__attr-name xml-node__attr-name--editable",
724
+ style: c({ color: e.theme.colors.xmlAttribute }),
725
+ contenteditable: o.value === u,
726
+ onDblclick: (_) => ce(u),
727
+ onKeydown: [
728
+ A(j(l, ["prevent"]), ["enter"]),
729
+ A(C, ["escape"])
730
+ ],
731
+ onBlur: l,
732
+ ref_for: !0,
733
+ ref: (_) => {
734
+ o.value === u && (z.value = _);
735
+ },
736
+ title: "Double-click to edit attribute name"
737
+ }, D(o.value === u ? b.value : u), 45, yt),
738
+ n("span", {
739
+ class: "xml-node__equals",
740
+ style: c({ color: e.theme.colors.xmlEquals })
741
+ }, "=", 4),
742
+ n("span", {
743
+ class: "xml-node__quote",
744
+ style: c({ color: e.theme.colors.xmlQuote })
745
+ }, '"', 4),
746
+ n("span", {
747
+ class: "xml-node__attr-value xml-node__attr-value--editable",
748
+ style: c({ color: e.theme.colors.xmlAttributeValue }),
749
+ contenteditable: h.value === u,
750
+ onDblclick: (_) => t(u),
751
+ onKeydown: [
752
+ A(j(a, ["prevent"]), ["enter"]),
753
+ A(k, ["escape"])
754
+ ],
755
+ onBlur: a,
756
+ ref_for: !0,
757
+ ref: (_) => {
758
+ h.value === u && (Q.value = _);
759
+ },
760
+ title: "Double-click to edit attribute value"
761
+ }, D(h.value === u ? X.value : F), 45, ht),
762
+ n("span", {
763
+ class: "xml-node__quote",
764
+ style: c({ color: e.theme.colors.xmlQuote })
765
+ }, '"', 4)
766
+ ]))), 128)),
767
+ Z.value ? ($(), w("span", {
768
+ key: 2,
769
+ class: "xml-node__clickable-part",
770
+ onClick: r[5] || (r[5] = (F) => ne()),
771
+ title: ee.value ? "Click to collapse" : "Click to expand"
772
+ }, [
773
+ n("span", {
774
+ class: "xml-node__bracket",
775
+ style: c({ color: e.theme.colors.xmlBracket })
776
+ }, ">", 4)
777
+ ], 8, bt)) : ($(), w("span", {
778
+ key: 3,
779
+ class: "xml-node__bracket",
780
+ style: c({ color: e.theme.colors.xmlBracket })
781
+ }, D(Z.value ? ">" : "/>"), 5))
782
+ ]),
783
+ ee.value && Z.value ? ($(), w("div", _t, [
784
+ G.value.length === 0 && te.value.trim() ? ($(), w("div", xt, [
785
+ n("span", {
786
+ class: "xml-node__text-content xml-node__text-content--editable",
787
+ style: c({ color: e.theme.colors.xmlText }),
788
+ contenteditable: E.value,
789
+ onDblclick: d,
790
+ onKeydown: [
791
+ A(j(g, ["prevent"]), ["enter"]),
792
+ A(N, ["escape"])
793
+ ],
794
+ onBlur: g,
795
+ ref_key: "textContentRef",
796
+ ref: U,
797
+ title: "Double-click to edit text content"
798
+ }, D(E.value ? O.value : te.value), 45, gt)
799
+ ])) : pe("", !0),
800
+ ($(!0), w(se, null, ie(G.value, (F, u) => ($(), Be(M, {
801
+ key: _e(F, u),
802
+ node: F,
803
+ index: u,
804
+ level: e.level + 1,
805
+ "parent-path": xe(),
806
+ expanded: e.expanded,
807
+ theme: e.theme,
808
+ selfClosingTags: e.selfClosingTags,
809
+ onToggleExpand: r[6] || (r[6] = (_) => e.$emit("toggle-expand", _)),
810
+ onCopy: r[7] || (r[7] = (_) => e.$emit("copy", _)),
811
+ "onUpdate:tagName": r[8] || (r[8] = (_, oe, ve) => e.$emit("update:tagName", _, oe, ve)),
812
+ "onUpdate:attributeName": r[9] || (r[9] = (_, oe, ve) => e.$emit("update:attributeName", _, oe, ve)),
813
+ "onUpdate:attributeValue": r[10] || (r[10] = (_, oe, ve) => e.$emit("update:attributeValue", _, oe, ve)),
814
+ "onUpdate:textContent": r[11] || (r[11] = (_, oe) => e.$emit("update:textContent", _, oe)),
815
+ "onUpdate:cdataContent": r[12] || (r[12] = (_, oe) => e.$emit("update:cdataContent", _, oe))
816
+ }, null, 8, ["node", "index", "level", "parent-path", "expanded", "theme", "selfClosingTags"]))), 128))
817
+ ])) : pe("", !0),
818
+ ee.value && Z.value ? ($(), w("div", kt, [
819
+ n("span", {
820
+ class: "xml-node__clickable-part",
821
+ onClick: r[13] || (r[13] = (F) => ne()),
822
+ title: "Click to collapse"
823
+ }, [
824
+ n("span", {
825
+ class: "xml-node__bracket",
826
+ style: c({ color: e.theme.colors.xmlBracket })
827
+ }, "</", 4),
828
+ n("span", {
829
+ class: "xml-node__tag",
830
+ style: c({ color: e.theme.colors.xmlTag })
831
+ }, D(y.value ? x.value : K.value), 5),
832
+ n("span", {
833
+ class: "xml-node__bracket",
834
+ style: c({ color: e.theme.colors.xmlBracket })
835
+ }, ">", 4)
836
+ ])
837
+ ])) : pe("", !0)
838
+ ], 64))
839
+ ]))
840
+ ])) : pe("", !0)
841
+ ], 4);
842
+ };
843
+ }
844
+ }), Ct = /* @__PURE__ */ we(At, [["__scopeId", "data-v-2ea5f623"]]), $t = {
845
+ name: "github-light",
846
+ colors: {
847
+ // 背景色
848
+ background: "#ffffff",
849
+ surfaceBackground: "#f6f8fa",
850
+ // 边框色
851
+ border: "#d0d7de",
852
+ // 文本色
853
+ text: "#24292f",
854
+ textSecondary: "#57606a",
855
+ // 按钮样式
856
+ buttonBackground: "#f6f8fa",
857
+ buttonBackgroundHover: "#f3f4f6",
858
+ buttonBorder: "#d0d7de",
859
+ buttonText: "#24292f",
860
+ buttonPrimary: "#1f883d",
861
+ buttonPrimaryHover: "#1a7f37",
862
+ // 状态指示
863
+ success: "#1f883d",
864
+ successBackground: "#dafbe1",
865
+ error: "#cf222e",
866
+ errorBackground: "#ffebe9",
867
+ // XML 语法高亮
868
+ xmlTag: "#116329",
869
+ // 标签名 - 绿色
870
+ xmlAttribute: "#0550ae",
871
+ // 属性名 - 蓝色
872
+ xmlAttributeValue: "#0a3069",
873
+ // 属性值 - 深蓝
874
+ xmlText: "#24292f",
875
+ // 文本内容 - 黑色
876
+ xmlComment: "#6e7781",
877
+ // 注释 - 灰色
878
+ xmlCdata: "#8250df",
879
+ // CDATA - 紫色
880
+ xmlDeclaration: "#953800",
881
+ // 声明 - 橙色
882
+ xmlBracket: "#6e7781",
883
+ // 括号 - 灰色
884
+ xmlEquals: "#6e7781",
885
+ // 等号 - 灰色
886
+ xmlQuote: "#0550ae",
887
+ // 引号 - 蓝色
888
+ // 折叠效果
889
+ collapsedBackground: "#ddf4ff",
890
+ // 折叠信息背景色 - 浅蓝
891
+ collapsedBackgroundHover: "#b6e3ff",
892
+ // 折叠信息悬停背景色 - 稍深蓝
893
+ collapsedText: "#0969da",
894
+ // 折叠信息文本色 - 蓝色
895
+ // 缩进指示线
896
+ indentLine: "#d0d7de"
897
+ // 对齐线 - 灰色
898
+ }
899
+ }, Bt = {
900
+ name: "github-dark",
901
+ colors: {
902
+ // 背景色
903
+ background: "#0d1117",
904
+ surfaceBackground: "#161b22",
905
+ // 边框色
906
+ border: "#30363d",
907
+ // 文本色
908
+ text: "#c9d1d9",
909
+ textSecondary: "#8b949e",
910
+ // 按钮样式
911
+ buttonBackground: "#21262d",
912
+ buttonBackgroundHover: "#30363d",
913
+ buttonBorder: "#30363d",
914
+ buttonText: "#c9d1d9",
915
+ buttonPrimary: "#238636",
916
+ buttonPrimaryHover: "#2ea043",
917
+ // 状态指示
918
+ success: "#3fb950",
919
+ successBackground: "#0f2e1c",
920
+ error: "#f85149",
921
+ errorBackground: "#3d1319",
922
+ // XML 语法高亮
923
+ xmlTag: "#7ee787",
924
+ // 标签名 - 亮绿色
925
+ xmlAttribute: "#79c0ff",
926
+ // 属性名 - 亮蓝色
927
+ xmlAttributeValue: "#a5d6ff",
928
+ // 属性值 - 淡蓝色
929
+ xmlText: "#c9d1d9",
930
+ // 文本内容 - 白色
931
+ xmlComment: "#8b949e",
932
+ // 注释 - 灰色
933
+ xmlCdata: "#d2a8ff",
934
+ // CDATA - 紫色
935
+ xmlDeclaration: "#ffa657",
936
+ // 声明 - 橙色
937
+ xmlBracket: "#8b949e",
938
+ // 括号 - 灰色
939
+ xmlEquals: "#8b949e",
940
+ // 等号 - 灰色
941
+ xmlQuote: "#79c0ff",
942
+ // 引号 - 亮蓝色
943
+ // 折叠效果
944
+ collapsedBackground: "#1c2128",
945
+ // 折叠信息背景色 - 深蓝
946
+ collapsedBackgroundHover: "#2d333b",
947
+ // 折叠信息悬停背景色 - 稍深
948
+ collapsedText: "#79c0ff",
949
+ // 折叠信息文本色 - 亮蓝色
950
+ // 缩进指示线
951
+ indentLine: "#30363d"
952
+ // 对齐线 - 灰色
953
+ }
954
+ }, wt = {
955
+ name: "min-light",
956
+ colors: {
957
+ // 背景色
958
+ background: "#ffffff",
959
+ surfaceBackground: "#fafafa",
960
+ // 边框色
961
+ border: "#e5e5e5",
962
+ // 文本色
963
+ text: "#171717",
964
+ textSecondary: "#737373",
965
+ // 按钮样式
966
+ buttonBackground: "#fafafa",
967
+ buttonBackgroundHover: "#f5f5f5",
968
+ buttonBorder: "#e5e5e5",
969
+ buttonText: "#171717",
970
+ buttonPrimary: "#22c55e",
971
+ buttonPrimaryHover: "#16a34a",
972
+ // 状态指示
973
+ success: "#22c55e",
974
+ successBackground: "#dcfce7",
975
+ error: "#ef4444",
976
+ errorBackground: "#fee2e2",
977
+ // XML 语法高亮
978
+ xmlTag: "#16a34a",
979
+ // 标签名 - 绿色
980
+ xmlAttribute: "#2563eb",
981
+ // 属性名 - 蓝色
982
+ xmlAttributeValue: "#1e40af",
983
+ // 属性值 - 深蓝
984
+ xmlText: "#171717",
985
+ // 文本内容 - 黑色
986
+ xmlComment: "#737373",
987
+ // 注释 - 灰色
988
+ xmlCdata: "#9333ea",
989
+ // CDATA - 紫色
990
+ xmlDeclaration: "#ea580c",
991
+ // 声明 - 橙色
992
+ xmlBracket: "#737373",
993
+ // 括号 - 灰色
994
+ xmlEquals: "#737373",
995
+ // 等号 - 灰色
996
+ xmlQuote: "#2563eb",
997
+ // 引号 - 蓝色
998
+ // 折叠效果
999
+ collapsedBackground: "#e0f2fe",
1000
+ // 折叠信息背景色 - 浅蓝
1001
+ collapsedBackgroundHover: "#bae6fd",
1002
+ // 折叠信息悬停背景色 - 稍深蓝
1003
+ collapsedText: "#0284c7",
1004
+ // 折叠信息文本色 - 蓝色
1005
+ // 缩进指示线
1006
+ indentLine: "#e5e7eb"
1007
+ // 对齐线 - 灰色
1008
+ }
1009
+ }, Tt = {
1010
+ name: "slack-ochin",
1011
+ colors: {
1012
+ // 背景色
1013
+ background: "#fef5ed",
1014
+ surfaceBackground: "#fef9f3",
1015
+ // 边框色
1016
+ border: "#e9dcc9",
1017
+ // 文本色
1018
+ text: "#3d3c40",
1019
+ textSecondary: "#616061",
1020
+ // 按钮样式
1021
+ buttonBackground: "#fef9f3",
1022
+ buttonBackgroundHover: "#f9f0e5",
1023
+ buttonBorder: "#e9dcc9",
1024
+ buttonText: "#3d3c40",
1025
+ buttonPrimary: "#007a5a",
1026
+ buttonPrimaryHover: "#006644",
1027
+ // 状态指示
1028
+ success: "#007a5a",
1029
+ successBackground: "#d1f4e0",
1030
+ error: "#e01e5a",
1031
+ errorBackground: "#ffdbea",
1032
+ // XML 语法高亮
1033
+ xmlTag: "#007a5a",
1034
+ // 标签名 - 绿色
1035
+ xmlAttribute: "#1264a3",
1036
+ // 属性名 - 蓝色
1037
+ xmlAttributeValue: "#0b4c8c",
1038
+ // 属性值 - 深蓝
1039
+ xmlText: "#3d3c40",
1040
+ // 文本内容 - 黑色
1041
+ xmlComment: "#616061",
1042
+ // 注释 - 灰色
1043
+ xmlCdata: "#8b2eff",
1044
+ // CDATA - 紫色
1045
+ xmlDeclaration: "#e8912d",
1046
+ // 声明 - 橙色
1047
+ xmlBracket: "#616061",
1048
+ // 括号 - 灰色
1049
+ xmlEquals: "#616061",
1050
+ // 等号 - 灰色
1051
+ xmlQuote: "#1264a3",
1052
+ // 引号 - 蓝色
1053
+ // 折叠效果
1054
+ collapsedBackground: "#ffe8d6",
1055
+ // 折叠信息背景色 - 浅橙
1056
+ collapsedBackgroundHover: "#ffd4b0",
1057
+ // 折叠信息悬停背景色 - 稍深橙
1058
+ collapsedText: "#d73502",
1059
+ // 折叠信息文本色 - 橙红色
1060
+ // 缩进指示线
1061
+ indentLine: "#e8d5b7"
1062
+ // 对齐线 - 米色
1063
+ }
1064
+ }, Ae = {
1065
+ "github-light": $t,
1066
+ "github-dark": Bt,
1067
+ "min-light": wt,
1068
+ "slack-ochin": Tt
1069
+ }, Dt = (s) => Ae[s] || Ae["github-light"], Et = {
1070
+ ignoreAttributes: !1,
1071
+ // 保留属性
1072
+ attributeNamePrefix: "@_",
1073
+ // 属性前缀
1074
+ textNodeName: "#text",
1075
+ // 文本节点名
1076
+ ignoreDeclaration: !1,
1077
+ // 保留 XML 声明
1078
+ commentPropName: "#comment",
1079
+ // 注释属性名
1080
+ cdataPropName: "__cdata",
1081
+ // CDATA 属性名
1082
+ preserveOrder: !0,
1083
+ // 保留顺序(使用数组结构以保留注释位置)
1084
+ parseAttributeValue: !1,
1085
+ // 不解析属性值(保持字符串)
1086
+ trimValues: !1,
1087
+ // 不去除首尾空白(保留原始空白字符)
1088
+ parseTagValue: !1,
1089
+ // 不解析标签值(保持字符串)
1090
+ processEntities: !1,
1091
+ // 不处理实体(保留原始实体引用)
1092
+ htmlEntities: !1,
1093
+ // 不是 HTML 实体
1094
+ ignoreNameSpace: !1,
1095
+ // 保留命名空间
1096
+ allowBooleanAttributes: !0,
1097
+ // 允许布尔属性
1098
+ unpairedTags: [],
1099
+ // 未配对的标签
1100
+ stopNodes: [],
1101
+ // 停止解析的节点
1102
+ alwaysCreateTextNode: !1
1103
+ // 仅在有文本时创建文本节点
1104
+ }, Vt = {
1105
+ ignoreAttributes: !1,
1106
+ attributeNamePrefix: "@_",
1107
+ textNodeName: "#text",
1108
+ format: !0,
1109
+ // 格式化输出
1110
+ indentBy: " ",
1111
+ // 缩进 2 空格
1112
+ suppressEmptyNode: !1,
1113
+ // 不抑制空节点
1114
+ suppressBooleanAttributes: !1,
1115
+ suppressUnpairedNode: !1
1116
+ }, Wt = (s) => {
1117
+ const m = /<!\[CDATA\[([\s\S]*?)\]\]>/g, i = [];
1118
+ let p;
1119
+ for (; (p = m.exec(s)) !== null; )
1120
+ i.push({
1121
+ start: p.index,
1122
+ end: p.index + p[0].length
1123
+ });
1124
+ const y = (b) => i.some((X) => b >= X.start && b < X.end), o = /&([a-zA-Z0-9#]+);/g, h = ["lt", "gt", "amp", "quot", "apos"];
1125
+ let E, B = 1, x = 0;
1126
+ for (; (E = o.exec(s)) !== null; ) {
1127
+ const b = E[1], X = E.index;
1128
+ if (y(X))
1129
+ continue;
1130
+ const O = s.substring(x, X);
1131
+ if (B += (O.match(/\n/g) || []).length, x = X, b.startsWith("#")) {
1132
+ const S = b.substring(1);
1133
+ if (S.startsWith("x") || S.startsWith("X")) {
1134
+ const P = S.substring(1);
1135
+ if (!/^[0-9a-fA-F]+$/.test(P))
1136
+ return {
1137
+ valid: !1,
1138
+ error: `Line ${B}: Invalid hexadecimal character reference '&${b};'`
1139
+ };
1140
+ } else if (!/^[0-9]+$/.test(S))
1141
+ return {
1142
+ valid: !1,
1143
+ error: `Line ${B}: Invalid numeric character reference '&${b};'`
1144
+ };
1145
+ continue;
1146
+ }
1147
+ if (!h.includes(b))
1148
+ return {
1149
+ valid: !1,
1150
+ error: `Line ${B}: Invalid entity reference '&${b};'. Valid predefined entities are: &lt; &gt; &amp; &quot; &apos;`
1151
+ };
1152
+ }
1153
+ return { valid: !0 };
1154
+ }, Kt = (s) => {
1155
+ try {
1156
+ const m = Oe.validate(s, {
1157
+ allowBooleanAttributes: !0
1158
+ });
1159
+ if (m !== !0)
1160
+ return {
1161
+ valid: !1,
1162
+ error: `Line ${m.err.line}: ${m.err.msg}`
1163
+ };
1164
+ const i = Wt(s);
1165
+ return i.valid ? { valid: !0 } : i;
1166
+ } catch (m) {
1167
+ return {
1168
+ valid: !1,
1169
+ error: m instanceof Error ? m.message : "Unknown validation error"
1170
+ };
1171
+ }
1172
+ }, ge = (s, m) => {
1173
+ try {
1174
+ return new Pe({
1175
+ ...Et,
1176
+ ...m
1177
+ }).parse(s);
1178
+ } catch (i) {
1179
+ throw new Error(
1180
+ `XML 解析失败: ${i instanceof Error ? i.message : "Unknown error"}`
1181
+ );
1182
+ }
1183
+ }, ke = (s, m) => {
1184
+ try {
1185
+ let p = new Ne({
1186
+ ...Vt,
1187
+ format: m?.format ?? !0,
1188
+ indentBy: m?.indentBy ?? " "
1189
+ }).build(s);
1190
+ return m?.showDeclaration !== !1 && !p.startsWith("<?xml") && (p = `<?xml version="1.0" encoding="UTF-8"?>
1191
+ ` + p), p;
1192
+ } catch (i) {
1193
+ throw new Error(
1194
+ `XML 构建失败: ${i instanceof Error ? i.message : "Unknown error"}`
1195
+ );
1196
+ }
1197
+ }, Xt = (s, m) => Array.isArray(s) ? re(s, { format: !1, originalXml: m }) : ke(s, { format: !1, showDeclaration: !1 }), Ot = (s, m) => {
1198
+ const i = ge(s);
1199
+ return Array.isArray(i) ? re(i, {
1200
+ indent: m?.indentBy || " ",
1201
+ originalXml: s
1202
+ }) : ke(i, m);
1203
+ }, Ht = (s) => {
1204
+ const m = s.match(/<([a-zA-Z0-9_-]+)[\s>]/);
1205
+ return m ? m[1] : null;
1206
+ }, zt = (s) => {
1207
+ let m = 0;
1208
+ const i = (p) => {
1209
+ p === null || typeof p != "object" || (m++, Array.isArray(p) ? p.forEach(i) : Object.values(p).forEach(i));
1210
+ };
1211
+ return i(s), m;
1212
+ }, Zt = (s) => !s || typeof s != "object" ? !1 : Object.keys(s).some((m) => m.startsWith("@_")), Jt = (s) => {
1213
+ if (!s || typeof s != "object") return {};
1214
+ const m = {};
1215
+ return Object.keys(s).forEach((i) => {
1216
+ if (i.startsWith("@_")) {
1217
+ const p = i.substring(2);
1218
+ m[p] = s[i];
1219
+ }
1220
+ }), m;
1221
+ }, Gt = (s) => !s || typeof s != "object" ? typeof s == "string" ? s : null : s["#text"] || null, Yt = (s) => {
1222
+ if (s == null) return !0;
1223
+ if (typeof s != "object") return !1;
1224
+ const m = Object.keys(s);
1225
+ return m.length === 0 || m.length === 1 && m[0].startsWith("@_");
1226
+ }, Pt = (s, m) => {
1227
+ const i = Te(m), p = /* @__PURE__ */ new Map(), y = (o) => {
1228
+ for (const h of o) {
1229
+ const E = Object.keys(h).find(
1230
+ (b) => !b.startsWith(":") && !b.startsWith("#") && !b.startsWith("__") && !b.startsWith("?")
1231
+ );
1232
+ if (!E) continue;
1233
+ const B = p.get(E) ?? 0;
1234
+ p.set(E, B + 1), h[":selfClosing"] = i.get(E)?.[B] ?? !1;
1235
+ const x = h[E];
1236
+ Array.isArray(x) && x.length > 0 && y(x);
1237
+ }
1238
+ };
1239
+ y(s);
1240
+ }, Nt = (s) => {
1241
+ const m = /* @__PURE__ */ new Set(), i = /<([a-zA-Z0-9_-]+)(?:\s[^>]*)?\s*\/>/g;
1242
+ let p;
1243
+ for (; (p = i.exec(s)) !== null; )
1244
+ m.add(p[1]);
1245
+ return m;
1246
+ }, Te = (s) => {
1247
+ const m = /* @__PURE__ */ new Map();
1248
+ let i = 0;
1249
+ for (; i < s.length; ) {
1250
+ if (s.startsWith("<!--", i)) {
1251
+ const p = s.indexOf("-->", i);
1252
+ i = p !== -1 ? p + 3 : s.length;
1253
+ continue;
1254
+ }
1255
+ if (s.startsWith("<![CDATA[", i)) {
1256
+ const p = s.indexOf("]]>", i);
1257
+ i = p !== -1 ? p + 3 : s.length;
1258
+ continue;
1259
+ }
1260
+ if (s.startsWith("<?", i)) {
1261
+ const p = s.indexOf("?>", i);
1262
+ i = p !== -1 ? p + 2 : s.length;
1263
+ continue;
1264
+ }
1265
+ if (s.startsWith("</", i)) {
1266
+ const p = s.indexOf(">", i);
1267
+ i = p !== -1 ? p + 1 : s.length;
1268
+ continue;
1269
+ }
1270
+ if (s[i] === "<") {
1271
+ const p = s.slice(i + 1).match(/^([a-zA-Z_][a-zA-Z0-9_:.-]*)/);
1272
+ if (p) {
1273
+ const y = p[1];
1274
+ let o = i + 1 + y.length, h = !1, E = "";
1275
+ for (; o < s.length; ) {
1276
+ const B = s[o];
1277
+ if (h)
1278
+ B === E && (h = !1);
1279
+ else if (B === '"' || B === "'")
1280
+ h = !0, E = B;
1281
+ else if (B === ">") {
1282
+ let x = o - 1;
1283
+ for (; x > i && (s[x] === " " || s[x] === " " || s[x] === `
1284
+ ` || s[x] === "\r"); )
1285
+ x--;
1286
+ const b = s[x] === "/";
1287
+ m.has(y) || m.set(y, []), m.get(y).push(b), i = o + 1;
1288
+ break;
1289
+ }
1290
+ o++;
1291
+ }
1292
+ if (o >= s.length) break;
1293
+ continue;
1294
+ }
1295
+ }
1296
+ i++;
1297
+ }
1298
+ return m;
1299
+ }, re = (s, m = {}) => {
1300
+ const i = m.indent !== void 0 ? m.indent : " ", p = m.level || 0, y = m.format !== !1, o = y ? i.repeat(p) : "", h = y ? `
1301
+ ` : "";
1302
+ let E = m.selfClosingTags, B = m.selfClosingOccurrences, x = m.selfClosingCounters;
1303
+ p === 0 && m.originalXml && (B = Te(m.originalXml), x = /* @__PURE__ */ new Map());
1304
+ let b = "";
1305
+ for (const X of s) {
1306
+ if (X["?xml"]) {
1307
+ const T = X[":@"] || {}, R = Object.entries(T).map(([G, ue]) => `${G.startsWith("@_") ? G.substring(2) : G}="${ue}"`).join(" ");
1308
+ b += `<?xml ${R}?>${h}`;
1309
+ continue;
1310
+ }
1311
+ if (X["#comment"]) {
1312
+ const T = X["#comment"];
1313
+ if (Array.isArray(T) && T.length > 0) {
1314
+ const R = T[0]["#text"] || T[0];
1315
+ b += `${o}<!--${R}-->${h}`;
1316
+ }
1317
+ continue;
1318
+ }
1319
+ const O = Object.keys(X).find((T) => !T.startsWith(":") && !T.startsWith("#") && !T.startsWith("__"));
1320
+ if (!O) continue;
1321
+ let S = 0;
1322
+ B && x && (S = x.get(O) ?? 0, x.set(O, S + 1));
1323
+ const P = X[O], z = X[":@"] || {}, Q = Object.entries(z).map(([T, R]) => `${T.startsWith("@_") ? T.substring(2) : T}="${R}"`).join(" "), U = Q ? " " + Q : "";
1324
+ if (!Array.isArray(P) || P.length === 0) {
1325
+ let T;
1326
+ B ? T = B.get(O)?.[S] ?? !1 : T = !!(E && E.has(O)), T ? b += `${o}<${O}${U}/>${h}` : b += `${o}<${O}${U}></${O}>${h}`;
1327
+ continue;
1328
+ }
1329
+ const Y = P.length === 1 && P[0]["#text"] !== void 0, K = Y ? P[0]["#text"] : "", J = P.some((T) => T.__cdata), ee = Y && K === "";
1330
+ if (J) {
1331
+ const T = P.find((R) => R.__cdata);
1332
+ if (T) {
1333
+ const R = T.__cdata[0]["#text"] || "";
1334
+ b += `${o}<${O}${U}><![CDATA[${R}]]></${O}>${h}`;
1335
+ }
1336
+ } else ee ? b += `${o}<${O}${U}></${O}>${h}` : Y ? b += `${o}<${O}${U}>${K}</${O}>${h}` : (b += `${o}<${O}${U}>${h}`, b += re(P, { indent: i, level: p + 1, format: y, selfClosingTags: E, selfClosingOccurrences: B, selfClosingCounters: x }), b += `${o}</${O}>${h}`);
1337
+ }
1338
+ return b;
1339
+ }, Rt = { class: "xml-format__content" }, jt = {
1340
+ key: 0,
1341
+ class: "xml-format__error"
1342
+ }, qt = {
1343
+ key: 1,
1344
+ class: "xml-format__error"
1345
+ }, It = {
1346
+ key: 2,
1347
+ class: "xml-format__viewer"
1348
+ }, Lt = /* @__PURE__ */ Ce({
1349
+ __name: "index",
1350
+ props: {
1351
+ modelValue: { default: "" },
1352
+ readonly: { type: Boolean, default: !1 },
1353
+ maxDepth: { default: 10 },
1354
+ theme: { default: "github-light" },
1355
+ showComments: { type: Boolean, default: !0 },
1356
+ showCdata: { type: Boolean, default: !0 },
1357
+ preserveWhitespace: { type: Boolean, default: !1 }
1358
+ },
1359
+ emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress", "format"],
1360
+ setup(s, { expose: m, emit: i }) {
1361
+ $e((t) => ({
1362
+ "56635be8": U.value.colors.background,
1363
+ "106ac08b": U.value.colors.text,
1364
+ "07c07b2c": U.value.colors.error,
1365
+ "821d1190": U.value.colors.errorBackground
1366
+ }));
1367
+ const p = s, y = i, o = I(null), h = I(""), E = I(/* @__PURE__ */ new Set()), B = I(null), x = I(""), b = I(""), X = I(/* @__PURE__ */ new Set()), O = I(!1), S = L(() => h.value === ""), P = (t) => {
1368
+ if (!t || typeof t != "object")
1369
+ return t;
1370
+ if (Array.isArray(t)) {
1371
+ const l = t.map((k) => P(k)), a = [], g = [];
1372
+ l.forEach((k, N) => {
1373
+ if (!k || typeof k != "object") {
1374
+ g.push({ item: k, originalIndex: N });
1375
+ return;
1376
+ }
1377
+ const W = Object.keys(k), q = W.find((V) => !V.startsWith("?") && !V.startsWith(":") && !V.startsWith("#") && !V.startsWith("__")) || W[0] || "";
1378
+ q.startsWith("#") || q.startsWith("__") ? g.push({ item: k, originalIndex: N }) : q.startsWith("?") ? g.push({ item: k, originalIndex: N }) : a.push({ item: k, originalIndex: N });
1379
+ }), a.sort((k, N) => {
1380
+ const W = (H) => {
1381
+ const e = Object.keys(H);
1382
+ for (const r of e)
1383
+ if (!r.startsWith("?") && !r.startsWith(":") && !r.startsWith("#") && !r.startsWith("__"))
1384
+ return r;
1385
+ return e[0] || "";
1386
+ }, q = W(k.item), V = W(N.item);
1387
+ return q.localeCompare(V);
1388
+ });
1389
+ const v = [];
1390
+ let C = 0;
1391
+ for (let k = 0; k < l.length; k++) {
1392
+ const N = g.find((W) => W.originalIndex === k);
1393
+ N ? v.push(N.item) : C < a.length && (v.push(a[C].item), C++);
1394
+ }
1395
+ return v;
1396
+ }
1397
+ const d = {}, f = Object.keys(t).sort((l, a) => {
1398
+ const g = l.startsWith("?") || l.startsWith(":") || l.startsWith("#") || l.startsWith("__"), v = a.startsWith("?") || a.startsWith(":") || a.startsWith("#") || a.startsWith("__"), C = {
1399
+ "?xml": 0,
1400
+ ":@": 1,
1401
+ "#text": 2,
1402
+ __cdata: 3,
1403
+ "#cdata": 3,
1404
+ "#comment": 4
1405
+ };
1406
+ if (g && v) {
1407
+ const k = C[l] ?? 99, N = C[a] ?? 99;
1408
+ return k - N;
1409
+ } else return g ? -1 : v ? 1 : l.localeCompare(a);
1410
+ });
1411
+ for (const l of f) {
1412
+ const a = t[l];
1413
+ if (l === ":@" && a && typeof a == "object" && !Array.isArray(a)) {
1414
+ const g = {}, v = Object.keys(a).sort();
1415
+ for (const C of v)
1416
+ g[C] = a[C];
1417
+ d[l] = g;
1418
+ } else
1419
+ d[l] = P(a);
1420
+ }
1421
+ return d;
1422
+ }, z = L(() => {
1423
+ const t = B.value !== null ? B.value : o.value;
1424
+ return !t || !O.value ? t : P(t);
1425
+ }), Q = L(() => x.value ? null : z.value), U = L(() => Dt(p.theme)), Y = L(() => {
1426
+ const t = Q.value;
1427
+ return !t || !Array.isArray(t) ? [] : t.map((d, f) => ({ node: d, originalIndex: f })).filter((d) => !d.node["?xml"]);
1428
+ }), K = L(() => {
1429
+ const t = Q.value;
1430
+ if (!t || !Array.isArray(t)) return null;
1431
+ const d = t.find((a) => a["?xml"]);
1432
+ if (!d || !d[":@"]) return null;
1433
+ const f = d[":@"], l = [];
1434
+ return f["@_version"] && l.push(`version="${f["@_version"]}"`), f["@_encoding"] && l.push(`encoding="${f["@_encoding"]}"`), f["@_standalone"] && l.push(`standalone="${f["@_standalone"]}"`), l.length > 0 ? `<?xml ${l.join(" ")}?>` : null;
1435
+ }), J = L(() => Y.value), ee = (t) => {
1436
+ if (!t || !t.trim()) {
1437
+ h.value = "", o.value = null, b.value = "", B.value = null, x.value = "";
1438
+ return;
1439
+ }
1440
+ try {
1441
+ const d = Kt(t);
1442
+ if (!d.valid) {
1443
+ h.value = d.error || "Invalid XML", o.value = null, b.value = "", X.value = /* @__PURE__ */ new Set();
1444
+ return;
1445
+ }
1446
+ b.value = t, X.value = Nt(t), o.value = ge(t), Array.isArray(o.value) && Pt(o.value, t), h.value = "", B.value = null, x.value = "", ae(() => {
1447
+ R();
1448
+ });
1449
+ } catch (d) {
1450
+ h.value = d instanceof Error ? d.message : "Unknown parse error", o.value = null, b.value = "", B.value = null, x.value = "";
1451
+ }
1452
+ }, T = (t) => {
1453
+ E.value.has(t) ? E.value.delete(t) : E.value.add(t);
1454
+ }, R = () => {
1455
+ const t = /* @__PURE__ */ new Set(), d = (f, l = "") => {
1456
+ Array.isArray(f) && f.forEach((a, g) => {
1457
+ const v = Object.keys(a).find((N) => !N.startsWith(":") && !N.startsWith("#"));
1458
+ if (!v) return;
1459
+ const C = l ? `${l}.${v}[${g}]` : `${v}[${g}]`;
1460
+ t.add(C);
1461
+ const k = a[v];
1462
+ Array.isArray(k) && d(k, C + "." + v);
1463
+ });
1464
+ };
1465
+ Y.value.forEach(({ node: f, originalIndex: l }) => {
1466
+ const a = Object.keys(f).find((g) => !g.startsWith(":") && !g.startsWith("#"));
1467
+ if (a) {
1468
+ const g = `${a}[${l}]`;
1469
+ t.add(g);
1470
+ const v = f[a];
1471
+ Array.isArray(v) && d(v, g + "." + a);
1472
+ }
1473
+ }), E.value = t, y("expand-all");
1474
+ }, G = () => {
1475
+ E.value.clear(), y("collapse-all");
1476
+ }, ue = async () => {
1477
+ if (S.value)
1478
+ try {
1479
+ const t = Q.value || o.value;
1480
+ if (!t) return;
1481
+ const d = Array.isArray(t) ? re(t, { indent: " ", originalXml: b.value || void 0 }) : ke(t, { format: !0, indentBy: " " });
1482
+ await navigator.clipboard.writeText(d), y("copy-success", d);
1483
+ } catch (t) {
1484
+ const d = t instanceof Error ? t : new Error("Copy failed");
1485
+ y("copy-error", d), console.error("Failed to copy XML:", t);
1486
+ }
1487
+ }, de = () => {
1488
+ if (!(!S.value || !o.value))
1489
+ try {
1490
+ const t = Xt(o.value, p.modelValue);
1491
+ y("update:modelValue", t), y("compress", t);
1492
+ } catch (t) {
1493
+ console.error("Failed to compress XML:", t);
1494
+ }
1495
+ }, te = () => {
1496
+ if (S.value)
1497
+ try {
1498
+ const t = Ot(p.modelValue, {
1499
+ format: !0,
1500
+ indentBy: " "
1501
+ });
1502
+ y("update:modelValue", t), y("format", t);
1503
+ } catch (t) {
1504
+ console.error("Failed to format XML:", t);
1505
+ }
1506
+ }, he = (t) => {
1507
+ if (!t || !t.expression.trim()) {
1508
+ Z();
1509
+ return;
1510
+ }
1511
+ if (!o.value || !b.value) {
1512
+ x.value = "No valid XML data to filter";
1513
+ return;
1514
+ }
1515
+ try {
1516
+ const f = new Ke().parseFromString(b.value, "text/xml"), l = We.select(t.expression, f);
1517
+ if (!l || Array.isArray(l) && l.length === 0) {
1518
+ B.value = [], x.value = "";
1519
+ return;
1520
+ }
1521
+ const a = new Xe();
1522
+ let g = "";
1523
+ Array.isArray(l) ? (g = `<result>
1524
+ `, l.forEach((v) => {
1525
+ v.nodeType === 1 ? g += " " + a.serializeToString(v) + `
1526
+ ` : v.nodeType === 2 ? g += ` <attribute name="${v.name}" value="${v.value}"/>
1527
+ ` : v.nodeType === 3 && (g += ` <text>${v.nodeValue}</text>
1528
+ `);
1529
+ }), g += "</result>") : g = a.serializeToString(l), B.value = ge(g), x.value = "", ae(() => {
1530
+ R();
1531
+ });
1532
+ } catch (d) {
1533
+ x.value = d instanceof Error ? d.message : "Filter execution error", B.value = null;
1534
+ }
1535
+ }, Z = () => {
1536
+ B.value = null, x.value = "", ae(() => {
1537
+ R();
1538
+ });
1539
+ }, me = () => {
1540
+ O.value = !0, ae(() => {
1541
+ R();
1542
+ });
1543
+ }, be = () => {
1544
+ O.value = !1, ae(() => {
1545
+ R();
1546
+ });
1547
+ }, fe = (t) => typeof t == "string" ? t : JSON.stringify(t, null, 2) ?? "undefined", ye = async (t) => {
1548
+ try {
1549
+ const d = fe(t);
1550
+ await navigator.clipboard.writeText(d), y("copy-success", d);
1551
+ } catch (d) {
1552
+ const f = d instanceof Error ? d : new Error("Copy failed");
1553
+ y("copy-error", f), console.error("Failed to copy value:", d);
1554
+ }
1555
+ }, ne = (t, d, f) => {
1556
+ if (!(!o.value || !Array.isArray(o.value)))
1557
+ try {
1558
+ const l = t.split(/\./).filter(Boolean);
1559
+ let a = o.value;
1560
+ for (let v = 0; v < l.length; v++) {
1561
+ const C = l[v], k = C.match(/^(.+?)\[(\d+)\]$/);
1562
+ if (k) {
1563
+ const N = k[1], W = parseInt(k[2]);
1564
+ if (v === l.length - 1) {
1565
+ if (Array.isArray(a) && a[W]) {
1566
+ const q = a[W];
1567
+ if (q[d]) {
1568
+ const V = q[d];
1569
+ delete q[d], q[f] = V, X.value.has(d) && (X.value.delete(d), X.value.add(f));
1570
+ }
1571
+ }
1572
+ } else
1573
+ Array.isArray(a) && a[W] && (a = a[W]);
1574
+ } else
1575
+ a[C] && (a = a[C]);
1576
+ }
1577
+ const g = re(o.value, {
1578
+ indent: " ",
1579
+ originalXml: b.value || void 0
1580
+ });
1581
+ y("update:modelValue", g);
1582
+ } catch (l) {
1583
+ console.error("Failed to update tag name:", l);
1584
+ }
1585
+ }, _e = (t, d, f) => {
1586
+ if (!(!o.value || !Array.isArray(o.value)))
1587
+ try {
1588
+ const l = t.split(/\./).filter(Boolean);
1589
+ let a = o.value;
1590
+ for (let v = 0; v < l.length; v++) {
1591
+ const C = l[v], k = C.match(/^(.+?)\[(\d+)\]$/);
1592
+ if (k) {
1593
+ const N = k[1], W = parseInt(k[2]);
1594
+ if (v === l.length - 1) {
1595
+ if (Array.isArray(a) && a[W]) {
1596
+ const V = a[W][":@"];
1597
+ if (V && V[`@_${d}`] !== void 0) {
1598
+ const H = V[`@_${d}`];
1599
+ delete V[`@_${d}`], V[`@_${f}`] = H;
1600
+ }
1601
+ }
1602
+ } else
1603
+ Array.isArray(a) && a[W] && (a = a[W]);
1604
+ } else
1605
+ a[C] && (a = a[C]);
1606
+ }
1607
+ const g = re(o.value, { indent: " ", originalXml: b.value || void 0 });
1608
+ y("update:modelValue", g);
1609
+ } catch (l) {
1610
+ console.error("Failed to update attribute name:", l);
1611
+ }
1612
+ }, xe = (t, d, f) => {
1613
+ if (!(!o.value || !Array.isArray(o.value)))
1614
+ try {
1615
+ const l = t.split(/\./).filter(Boolean);
1616
+ let a = o.value;
1617
+ for (let v = 0; v < l.length; v++) {
1618
+ const C = l[v], k = C.match(/^(.+?)\[(\d+)\]$/);
1619
+ if (k) {
1620
+ const N = k[1], W = parseInt(k[2]);
1621
+ if (v === l.length - 1) {
1622
+ if (Array.isArray(a) && a[W]) {
1623
+ const V = a[W][":@"];
1624
+ V && V[`@_${d}`] !== void 0 && (V[`@_${d}`] = f);
1625
+ }
1626
+ } else
1627
+ Array.isArray(a) && a[W] && (a = a[W]);
1628
+ } else
1629
+ a[C] && (a = a[C]);
1630
+ }
1631
+ const g = re(o.value, { indent: " ", originalXml: b.value || void 0 });
1632
+ y("update:modelValue", g);
1633
+ } catch (l) {
1634
+ console.error("Failed to update attribute value:", l);
1635
+ }
1636
+ }, le = (t, d) => {
1637
+ if (!(!o.value || !Array.isArray(o.value)))
1638
+ try {
1639
+ const f = t.split(/\./).filter(Boolean);
1640
+ let l = o.value, a = "";
1641
+ for (let v = 0; v < f.length; v++) {
1642
+ const C = f[v], k = C.match(/^(.+?)\[(\d+)\]$/);
1643
+ if (k) {
1644
+ const N = k[1], W = parseInt(k[2]);
1645
+ if (v === f.length - 1) {
1646
+ if (Array.isArray(l) && l[W]) {
1647
+ const q = l[W];
1648
+ if (a = Object.keys(q).find((V) => !V.startsWith(":") && !V.startsWith("#")) || "", a && Array.isArray(q[a])) {
1649
+ const V = q[a], H = V.findIndex((e) => e["#text"] !== void 0);
1650
+ H !== -1 ? V[H]["#text"] = d : V.push({ "#text": d });
1651
+ }
1652
+ }
1653
+ } else
1654
+ Array.isArray(l) && l[W] && (l = l[W]);
1655
+ } else
1656
+ l[C] && (l = l[C]);
1657
+ }
1658
+ const g = re(o.value, { indent: " ", originalXml: b.value || void 0 });
1659
+ y("update:modelValue", g);
1660
+ } catch (f) {
1661
+ console.error("Failed to update text content:", f);
1662
+ }
1663
+ }, ce = (t, d) => {
1664
+ if (!(!o.value || !Array.isArray(o.value)))
1665
+ try {
1666
+ const f = t.split(/\./).filter(Boolean);
1667
+ let l = o.value;
1668
+ for (let g = 0; g < f.length; g++) {
1669
+ const v = f[g], C = v.match(/^(.+?)\[(\d+)\]$/);
1670
+ if (C) {
1671
+ const k = C[1], N = parseInt(C[2]);
1672
+ if (g === f.length - 1) {
1673
+ if (Array.isArray(l) && l[N]) {
1674
+ const W = l[N], q = Object.keys(W).find((V) => !V.startsWith(":") && !V.startsWith("#"));
1675
+ if (q && Array.isArray(W[q])) {
1676
+ const V = W[q], H = V.findIndex((e) => e.__cdata !== void 0);
1677
+ if (H !== -1) {
1678
+ const e = V[H];
1679
+ Array.isArray(e.__cdata) && e.__cdata[0] && (e.__cdata[0]["#text"] = d);
1680
+ } else
1681
+ V.push({
1682
+ __cdata: [{ "#text": d }]
1683
+ });
1684
+ }
1685
+ }
1686
+ } else
1687
+ Array.isArray(l) && l[N] && (l = l[N]);
1688
+ } else
1689
+ l[v] && (l = l[v]);
1690
+ }
1691
+ const a = re(o.value, { indent: " ", originalXml: b.value || void 0 });
1692
+ y("update:modelValue", a);
1693
+ } catch (f) {
1694
+ console.error("Failed to update CDATA content:", f);
1695
+ }
1696
+ };
1697
+ return Ee(() => p.modelValue, (t) => {
1698
+ ee(t);
1699
+ }, { immediate: !0 }), m({
1700
+ // 核心操作方法
1701
+ copyXml: ue,
1702
+ compressSource: de,
1703
+ formatSource: te,
1704
+ expandAll: R,
1705
+ collapseAll: G,
1706
+ toggleExpand: T,
1707
+ // 过滤相关方法
1708
+ filter: he,
1709
+ clearFilter: Z,
1710
+ // 排序相关方法
1711
+ sort: me,
1712
+ clearSort: be,
1713
+ isSorted: () => O.value,
1714
+ // 状态访问方法
1715
+ isValidXml: () => S.value,
1716
+ getParsedXml: () => o.value,
1717
+ getFilteredXml: () => B.value,
1718
+ getExpandedNodes: () => E.value,
1719
+ getParseError: () => h.value,
1720
+ getFilterError: () => x.value,
1721
+ // 工具方法
1722
+ parseXmlString: (t) => ee(t),
1723
+ copyValue: (t) => ye(t),
1724
+ getValue: (t) => fe(t)
1725
+ }), (t, d) => ($(), w("div", {
1726
+ class: Ve(["xml-format", `xml-format--${U.value.name}`])
1727
+ }, [
1728
+ n("div", Rt, [
1729
+ S.value ? x.value ? ($(), w("div", qt, [
1730
+ d[1] || (d[1] = n("h4", null, "Filter Error:", -1)),
1731
+ n("pre", null, D(x.value), 1)
1732
+ ])) : ($(), w("div", It, [
1733
+ K.value ? ($(), w("div", {
1734
+ key: 0,
1735
+ class: "xml-declaration",
1736
+ style: c({ color: U.value.colors.xmlDeclaration })
1737
+ }, D(K.value), 5)) : pe("", !0),
1738
+ ($(!0), w(se, null, ie(J.value, (f, l) => ($(), Be(Ct, {
1739
+ key: l,
1740
+ node: f.node,
1741
+ index: f.originalIndex,
1742
+ level: 0,
1743
+ expanded: E.value,
1744
+ theme: U.value,
1745
+ selfClosingTags: X.value,
1746
+ onToggleExpand: T,
1747
+ onCopy: ye,
1748
+ "onUpdate:tagName": ne,
1749
+ "onUpdate:attributeName": _e,
1750
+ "onUpdate:attributeValue": xe,
1751
+ "onUpdate:textContent": le,
1752
+ "onUpdate:cdataContent": ce
1753
+ }, null, 8, ["node", "index", "expanded", "theme", "selfClosingTags"]))), 128))
1754
+ ])) : ($(), w("div", jt, [
1755
+ d[0] || (d[0] = n("h4", null, "XML Parse Error:", -1)),
1756
+ n("pre", null, D(h.value), 1)
1757
+ ]))
1758
+ ])
1759
+ ], 2));
1760
+ }
1761
+ }), el = /* @__PURE__ */ we(Lt, [["__scopeId", "data-v-afd6c257"]]);
1762
+ export {
1763
+ el as X,
1764
+ Ct as a,
1765
+ $t as b,
1766
+ Bt as c,
1767
+ ke as d,
1768
+ Xt as e,
1769
+ Ot as f,
1770
+ Dt as g,
1771
+ Ht as h,
1772
+ zt as i,
1773
+ Zt as j,
1774
+ Jt as k,
1775
+ Gt as l,
1776
+ wt as m,
1777
+ Yt as n,
1778
+ Pt as o,
1779
+ ge as p,
1780
+ Nt as q,
1781
+ re as r,
1782
+ Tt as s,
1783
+ Ae as t,
1784
+ Kt as v
1785
+ };