lone-format 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { defineComponent as le, useCssVars as ce, ref as R, computed as T, resolveComponent as pe, createElementBlock as A, openBlock as w, createElementVNode as P, createCommentVNode as N, withDirectives as re, toDisplayString as $, withKeys as X, vModelText as ne, createTextVNode as ie, Fragment as ye, renderList as be, createVNode as ue, normalizeClass as de, nextTick as Z, watch as ge } from "vue";
2
- class Ee {
1
+ import { defineComponent as fe, useCssVars as pe, ref as R, computed as D, resolveComponent as ve, createElementBlock as A, openBlock as w, createElementVNode as P, createCommentVNode as B, withDirectives as ae, toDisplayString as $, withKeys as Q, vModelText as le, createTextVNode as de, Fragment as _e, renderList as xe, createVNode as ye, normalizeClass as ge, nextTick as ee, watch as ke } from "vue";
2
+ class Oe {
3
3
  /**
4
4
  * @callback HookCallback
5
5
  * @this {*|Jsep} this
@@ -42,7 +42,7 @@ class Ee {
42
42
  });
43
43
  }
44
44
  }
45
- class me {
45
+ class Ce {
46
46
  constructor(e) {
47
47
  this.jsep = e, this.registered = {};
48
48
  }
@@ -615,10 +615,10 @@ class o {
615
615
  };
616
616
  }
617
617
  }
618
- const ve = new Ee();
618
+ const Ae = new Oe();
619
619
  Object.assign(o, {
620
- hooks: ve,
621
- plugins: new me(o),
620
+ hooks: Ae,
621
+ plugins: new Ce(o),
622
622
  // Node Types
623
623
  // ----------
624
624
  // This is the full set of types that any JSEP node can be.
@@ -714,14 +714,14 @@ Object.assign(o, {
714
714
  });
715
715
  o.max_unop_len = o.getMaxKeyLen(o.unary_ops);
716
716
  o.max_binop_len = o.getMaxKeyLen(o.binary_ops);
717
- const L = (r) => new o(r).parse(), _e = Object.getOwnPropertyNames(class {
717
+ const L = (r) => new o(r).parse(), we = Object.getOwnPropertyNames(class {
718
718
  });
719
- Object.getOwnPropertyNames(o).filter((r) => !_e.includes(r) && L[r] === void 0).forEach((r) => {
719
+ Object.getOwnPropertyNames(o).filter((r) => !we.includes(r) && L[r] === void 0).forEach((r) => {
720
720
  L[r] = o[r];
721
721
  });
722
722
  L.Jsep = o;
723
- const xe = "ConditionalExpression";
724
- var ke = {
723
+ const Se = "ConditionalExpression";
724
+ var Pe = {
725
725
  name: "ternary",
726
726
  init(r) {
727
727
  r.hooks.add("after-expression", function(t) {
@@ -732,7 +732,7 @@ var ke = {
732
732
  this.index++;
733
733
  const a = this.gobbleExpression();
734
734
  if (a || this.throwError("Expected expression"), t.node = {
735
- type: xe,
735
+ type: Se,
736
736
  test: s,
737
737
  consequent: n,
738
738
  alternate: a
@@ -748,17 +748,17 @@ var ke = {
748
748
  });
749
749
  }
750
750
  };
751
- L.plugins.register(ke);
752
- const ae = 47, Oe = 92;
753
- var Ce = {
751
+ L.plugins.register(Pe);
752
+ const he = 47, Ne = 92;
753
+ var Te = {
754
754
  name: "regex",
755
755
  init(r) {
756
756
  r.hooks.add("gobble-token", function(t) {
757
- if (this.code === ae) {
757
+ if (this.code === he) {
758
758
  const s = ++this.index;
759
759
  let n = !1;
760
760
  for (; this.index < this.expr.length; ) {
761
- if (this.code === ae && !n) {
761
+ if (this.code === he && !n) {
762
762
  const a = this.expr.slice(s, this.index);
763
763
  let c = "";
764
764
  for (; ++this.index < this.expr.length; ) {
@@ -780,34 +780,34 @@ var Ce = {
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 === Oe ? 2 : 1;
783
+ this.code === r.OBRACK_CODE ? n = !0 : n && this.code === r.CBRACK_CODE && (n = !1), this.index += this.code === Ne ? 2 : 1;
784
784
  }
785
785
  this.throwError("Unclosed Regex");
786
786
  }
787
787
  });
788
788
  }
789
789
  };
790
- const se = 43, Ae = 45, G = {
790
+ const ce = 43, Be = 45, Y = {
791
791
  name: "assignment",
792
792
  assignmentOperators: /* @__PURE__ */ new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
793
- updateOperators: [se, Ae],
793
+ updateOperators: [ce, Be],
794
794
  assignmentPrecedence: 0.9,
795
795
  init(r) {
796
796
  const e = [r.IDENTIFIER, r.MEMBER_EXP];
797
- G.assignmentOperators.forEach((s) => r.addBinaryOp(s, G.assignmentPrecedence, !0)), r.hooks.add("gobble-token", function(n) {
797
+ Y.assignmentOperators.forEach((s) => r.addBinaryOp(s, Y.assignmentPrecedence, !0)), r.hooks.add("gobble-token", function(n) {
798
798
  const a = this.code;
799
- G.updateOperators.some((c) => c === a && c === this.expr.charCodeAt(this.index + 1)) && (this.index += 2, n.node = {
799
+ Y.updateOperators.some((c) => c === a && c === this.expr.charCodeAt(this.index + 1)) && (this.index += 2, n.node = {
800
800
  type: "UpdateExpression",
801
- operator: a === se ? "++" : "--",
801
+ operator: a === ce ? "++" : "--",
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 a = this.code;
808
- G.updateOperators.some((c) => c === a && c === this.expr.charCodeAt(this.index + 1)) && (e.includes(n.node.type) || this.throwError(`Unexpected ${n.node.operator}`), this.index += 2, n.node = {
808
+ Y.updateOperators.some((c) => c === a && c === this.expr.charCodeAt(this.index + 1)) && (e.includes(n.node.type) || this.throwError(`Unexpected ${n.node.operator}`), this.index += 2, n.node = {
809
809
  type: "UpdateExpression",
810
- operator: a === se ? "++" : "--",
810
+ operator: a === ce ? "++" : "--",
811
811
  argument: n.node,
812
812
  prefix: !1
813
813
  });
@@ -816,17 +816,17 @@ const se = 43, Ae = 45, G = {
816
816
  n.node && t(n.node);
817
817
  });
818
818
  function t(s) {
819
- G.assignmentOperators.has(s.operator) ? (s.type = "AssignmentExpression", t(s.left), t(s.right)) : s.operator || Object.values(s).forEach((n) => {
819
+ Y.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
- L.plugins.register(Ce, G);
825
+ L.plugins.register(Te, Y);
826
826
  L.addUnaryOp("typeof");
827
827
  L.addLiteral("null", null);
828
828
  L.addLiteral("undefined", void 0);
829
- const we = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]), O = {
829
+ const De = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__"]), O = {
830
830
  /**
831
831
  * @param {jsep.Expression} ast
832
832
  * @param {Record<string, any>} subs
@@ -915,7 +915,7 @@ const we = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
915
915
  ), s = O.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) && we.has(t))
918
+ if (!Object.hasOwn(s, t) && De.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;
@@ -944,7 +944,7 @@ const we = /* @__PURE__ */ new Set(["constructor", "__proto__", "__defineGetter_
944
944
  return e[t] = s, e[t];
945
945
  }
946
946
  };
947
- class Se {
947
+ class je {
948
948
  /**
949
949
  * @param {string} expr Expression to evaluate
950
950
  */
@@ -964,10 +964,10 @@ class Se {
964
964
  function M(r, e) {
965
965
  return r = r.slice(), r.push(e), r;
966
966
  }
967
- function oe(r, e) {
967
+ function ue(r, e) {
968
968
  return e = e.slice(), e.unshift(r), e;
969
969
  }
970
- class Pe extends Error {
970
+ class Ie extends Error {
971
971
  /**
972
972
  * @param {AnyResult} value The evaluated scalar value
973
973
  */
@@ -995,7 +995,7 @@ function x(r, e, t, s, n) {
995
995
  a ? "json" in r && (c.json = r.json) : c.json = t;
996
996
  const f = this.evaluate(c);
997
997
  if (!f || typeof f != "object")
998
- throw new Pe(f);
998
+ throw new Ie(f);
999
999
  return f;
1000
1000
  }
1001
1001
  }
@@ -1061,20 +1061,20 @@ x.prototype._trace = function(r, e, t, s, n, a, c, f) {
1061
1061
  hasArrExpr: c
1062
1062
  }, this._handleCallback(d, a, "value"), d;
1063
1063
  const h = r[0], v = r.slice(1), g = [];
1064
- function k(m) {
1065
- Array.isArray(m) ? m.forEach((S) => {
1064
+ function k(E) {
1065
+ Array.isArray(E) ? E.forEach((S) => {
1066
1066
  g.push(S);
1067
- }) : g.push(m);
1067
+ }) : g.push(E);
1068
1068
  }
1069
1069
  if ((typeof h != "string" || f) && e && Object.hasOwn(e, h))
1070
1070
  k(this._trace(v, e[h], M(t, h), e, h, a, c));
1071
1071
  else if (h === "*")
1072
- this._walk(e, (m) => {
1073
- k(this._trace(v, e[m], M(t, m), e, m, a, !0, !0));
1072
+ this._walk(e, (E) => {
1073
+ k(this._trace(v, e[E], M(t, E), e, E, a, !0, !0));
1074
1074
  });
1075
1075
  else if (h === "..")
1076
- k(this._trace(v, e, t, s, n, a, c)), this._walk(e, (m) => {
1077
- typeof e[m] == "object" && k(this._trace(r.slice(), e[m], M(t, m), e, m, a, !0));
1076
+ k(this._trace(v, e, t, s, n, a, c)), this._walk(e, (E) => {
1077
+ typeof e[E] == "object" && k(this._trace(r.slice(), e[E], M(t, E), e, E, a, !0));
1078
1078
  });
1079
1079
  else {
1080
1080
  if (h === "^")
@@ -1097,56 +1097,56 @@ x.prototype._trace = function(r, e, t, s, n, a, c, f) {
1097
1097
  else if (h.indexOf("?(") === 0) {
1098
1098
  if (this.currEval === !1)
1099
1099
  throw new Error("Eval [?(expr)] prevented in JSONPath expression.");
1100
- const m = h.replace(/^\?\((.*?)\)$/u, "$1"), S = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(m);
1100
+ const E = h.replace(/^\?\((.*?)\)$/u, "$1"), S = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(E);
1101
1101
  S ? this._walk(e, (C) => {
1102
- const U = [S[2]], D = S[1] ? e[C][S[1]] : e[C];
1103
- this._trace(U, D, t, s, n, a, !0).length > 0 && k(this._trace(v, e[C], M(t, C), e, C, a, !0));
1102
+ const U = [S[2]], I = S[1] ? e[C][S[1]] : e[C];
1103
+ this._trace(U, I, t, s, n, a, !0).length > 0 && k(this._trace(v, e[C], M(t, C), e, C, a, !0));
1104
1104
  }) : this._walk(e, (C) => {
1105
- this._eval(m, e[C], C, t, s, n) && k(this._trace(v, e[C], M(t, C), e, C, a, !0));
1105
+ this._eval(E, e[C], C, t, s, n) && k(this._trace(v, e[C], M(t, C), e, C, a, !0));
1106
1106
  });
1107
1107
  } else if (h[0] === "(") {
1108
1108
  if (this.currEval === !1)
1109
1109
  throw new Error("Eval [(expr)] prevented in JSONPath expression.");
1110
- k(this._trace(oe(this._eval(h, e, t.at(-1), t.slice(0, -1), s, n), v), e, t, s, n, a, c));
1110
+ k(this._trace(ue(this._eval(h, e, t.at(-1), t.slice(0, -1), s, n), v), e, t, s, n, a, c));
1111
1111
  } else if (h[0] === "@") {
1112
- let m = !1;
1112
+ let E = !1;
1113
1113
  const S = h.slice(1, -2);
1114
1114
  switch (S) {
1115
1115
  case "scalar":
1116
- (!e || !["object", "function"].includes(typeof e)) && (m = !0);
1116
+ (!e || !["object", "function"].includes(typeof e)) && (E = !0);
1117
1117
  break;
1118
1118
  case "boolean":
1119
1119
  case "string":
1120
1120
  case "undefined":
1121
1121
  case "function":
1122
- typeof e === S && (m = !0);
1122
+ typeof e === S && (E = !0);
1123
1123
  break;
1124
1124
  case "integer":
1125
- Number.isFinite(e) && !(e % 1) && (m = !0);
1125
+ Number.isFinite(e) && !(e % 1) && (E = !0);
1126
1126
  break;
1127
1127
  case "number":
1128
- Number.isFinite(e) && (m = !0);
1128
+ Number.isFinite(e) && (E = !0);
1129
1129
  break;
1130
1130
  case "nonFinite":
1131
- typeof e == "number" && !Number.isFinite(e) && (m = !0);
1131
+ typeof e == "number" && !Number.isFinite(e) && (E = !0);
1132
1132
  break;
1133
1133
  case "object":
1134
- e && typeof e === S && (m = !0);
1134
+ e && typeof e === S && (E = !0);
1135
1135
  break;
1136
1136
  case "array":
1137
- Array.isArray(e) && (m = !0);
1137
+ Array.isArray(e) && (E = !0);
1138
1138
  break;
1139
1139
  case "other":
1140
- m = this.currOtherTypeCallback(e, t, s, n);
1140
+ E = this.currOtherTypeCallback(e, t, s, n);
1141
1141
  break;
1142
1142
  case "null":
1143
- e === null && (m = !0);
1143
+ e === null && (E = !0);
1144
1144
  break;
1145
1145
  /* c8 ignore next 2 */
1146
1146
  default:
1147
1147
  throw new TypeError("Unknown value type " + S);
1148
1148
  }
1149
- if (m)
1149
+ if (E)
1150
1150
  return d = {
1151
1151
  path: t,
1152
1152
  value: e,
@@ -1154,26 +1154,26 @@ x.prototype._trace = function(r, e, t, s, n, a, c, f) {
1154
1154
  parentProperty: n
1155
1155
  }, this._handleCallback(d, a, "value"), d;
1156
1156
  } else if (h[0] === "`" && e && Object.hasOwn(e, h.slice(1))) {
1157
- const m = h.slice(1);
1158
- k(this._trace(v, e[m], M(t, m), e, m, a, c, !0));
1157
+ const E = h.slice(1);
1158
+ k(this._trace(v, e[E], M(t, E), e, E, a, c, !0));
1159
1159
  } else if (h.includes(",")) {
1160
- const m = h.split(",");
1161
- for (const S of m)
1162
- k(this._trace(oe(S, v), e, t, s, n, a, !0));
1160
+ const E = h.split(",");
1161
+ for (const S of E)
1162
+ k(this._trace(ue(S, v), e, t, s, n, a, !0));
1163
1163
  } else !f && e && Object.hasOwn(e, h) && k(this._trace(v, e[h], M(t, h), e, h, a, c, !0));
1164
1164
  }
1165
1165
  if (this._hasParentSelector)
1166
- for (let m = 0; m < g.length; m++) {
1167
- const S = g[m];
1166
+ for (let E = 0; E < g.length; E++) {
1167
+ const S = g[E];
1168
1168
  if (S && S.isParentSelector) {
1169
1169
  const C = this._trace(S.expr, e, S.path, s, n, a, c);
1170
1170
  if (Array.isArray(C)) {
1171
- g[m] = C[0];
1171
+ g[E] = C[0];
1172
1172
  const U = C.length;
1173
- for (let D = 1; D < U; D++)
1174
- m++, g.splice(m, 0, C[D]);
1173
+ for (let I = 1; I < U; I++)
1174
+ E++, g.splice(E, 0, C[I]);
1175
1175
  } else
1176
- g[m] = C;
1176
+ g[E] = C;
1177
1177
  }
1178
1178
  }
1179
1179
  return g;
@@ -1194,8 +1194,8 @@ x.prototype._slice = function(r, e, t, s, n, a, c) {
1194
1194
  let v = d[0] && Number.parseInt(d[0]) || 0, g = d[1] && Number.parseInt(d[1]) || f;
1195
1195
  v = v < 0 ? Math.max(0, v + f) : Math.min(f, v), g = g < 0 ? Math.max(0, g + f) : Math.min(f, g);
1196
1196
  const k = [];
1197
- for (let m = v; m < g; m += h)
1198
- this._trace(oe(m, e), t, s, n, a, c, !0).forEach((C) => {
1197
+ for (let E = v; E < g; E += h)
1198
+ this._trace(ue(E, e), t, s, n, a, c, !0).forEach((C) => {
1199
1199
  k.push(C);
1200
1200
  });
1201
1201
  return k;
@@ -1263,16 +1263,16 @@ x.toPathArray = function(r) {
1263
1263
  return e[r] = n, e[r].concat();
1264
1264
  };
1265
1265
  x.prototype.safeVm = {
1266
- Script: Se
1266
+ Script: je
1267
1267
  };
1268
- const Ne = function(r, e, t) {
1268
+ const $e = function(r, e, t) {
1269
1269
  const s = r.length;
1270
1270
  for (let n = 0; n < s; n++) {
1271
1271
  const a = r[n];
1272
1272
  t(a) && e.push(r.splice(n--, 1)[0]);
1273
1273
  }
1274
1274
  };
1275
- class Te {
1275
+ class Re {
1276
1276
  /**
1277
1277
  * @param {string} expr Expression to evaluate
1278
1278
  */
@@ -1287,7 +1287,7 @@ class Te {
1287
1287
  runInNewContext(e) {
1288
1288
  let t = this.code;
1289
1289
  const s = Object.keys(e), n = [];
1290
- Ne(s, n, (h) => typeof e[h] == "function");
1290
+ $e(s, n, (h) => typeof e[h] == "function");
1291
1291
  const a = s.map((h) => e[h]);
1292
1292
  t = n.reduce((h, v) => {
1293
1293
  let g = e[v].toString();
@@ -1298,36 +1298,36 @@ class Te {
1298
1298
  }
1299
1299
  }
1300
1300
  x.prototype.vm = {
1301
- Script: Te
1301
+ Script: Re
1302
1302
  };
1303
- const Be = { class: "json-node" }, De = {
1303
+ const Le = { class: "json-node" }, Ue = {
1304
1304
  key: 0,
1305
1305
  class: "json-node__container"
1306
- }, je = { class: "json-node__line" }, Ie = {
1306
+ }, Me = { class: "json-node__line" }, Ve = {
1307
1307
  key: 2,
1308
1308
  class: "json-node__colon"
1309
- }, $e = ["title"], Re = {
1309
+ }, Fe = ["title"], He = {
1310
1310
  key: 3,
1311
1311
  class: "json-node__collapsed"
1312
- }, Le = {
1312
+ }, Ke = {
1313
1313
  key: 4,
1314
1314
  class: "json-node__comma"
1315
- }, Ue = {
1315
+ }, Xe = {
1316
1316
  key: 0,
1317
1317
  class: "json-node__children"
1318
- }, Me = { class: "json-node__children-content" }, Ve = { class: "json-node__line json-node__closing-bracket" }, Fe = { class: "json-node__bracket" }, He = {
1318
+ }, Ge = { class: "json-node__children-content" }, Qe = { class: "json-node__line json-node__closing-bracket" }, Ye = { class: "json-node__bracket" }, qe = {
1319
1319
  key: 0,
1320
1320
  class: "json-node__comma"
1321
- }, Ke = {
1321
+ }, ze = {
1322
1322
  key: 1,
1323
1323
  class: "json-node__primitive"
1324
- }, Xe = {
1324
+ }, We = {
1325
1325
  key: 2,
1326
1326
  class: "json-node__colon"
1327
- }, Ge = ["title"], Qe = {
1327
+ }, Ze = ["title"], Je = {
1328
1328
  key: 0,
1329
1329
  class: "json-node__comma"
1330
- }, Ye = /* @__PURE__ */ le({
1330
+ }, et = /* @__PURE__ */ fe({
1331
1331
  name: "JsonNode",
1332
1332
  __name: "JsonNode",
1333
1333
  props: {
@@ -1341,7 +1341,7 @@ const Be = { class: "json-node" }, De = {
1341
1341
  },
1342
1342
  emits: ["update:value", "toggle-expand", "copy", "update:key"],
1343
1343
  setup(r, { emit: e }) {
1344
- ce((u) => ({
1344
+ pe((u) => ({
1345
1345
  "41b58a02": u.level,
1346
1346
  "63accfe8": u.theme.colors.syntaxKey,
1347
1347
  "7a4b22f6": u.theme.colors.hoverBackground,
@@ -1358,25 +1358,25 @@ const Be = { class: "json-node" }, De = {
1358
1358
  if (!/^-?\d+(\.\d+)?$/.test(u)) return !1;
1359
1359
  const _ = Number(u);
1360
1360
  return !Number.isSafeInteger(_) || u.length > 15;
1361
- }, h = T(() => t.value !== null && typeof t.value == "object"), v = T(() => Array.isArray(t.value)), g = T(() => t.path ? t.path : t.keyName ? t.keyName : "root"), k = T(() => t.expanded.has(g.value)), m = T(() => t.keyName), S = T(() => v.value ? "[" : "{"), C = T(() => v.value ? "]" : "}"), U = T(() => {
1361
+ }, h = D(() => t.value !== null && typeof t.value == "object"), v = D(() => Array.isArray(t.value)), g = D(() => t.path ? t.path : t.keyName ? t.keyName : "root"), k = D(() => t.expanded.has(g.value)), E = D(() => t.keyName), S = D(() => v.value ? "[" : "{"), C = D(() => v.value ? "]" : "}"), U = D(() => {
1362
1362
  if (!t.value) return "";
1363
1363
  const _ = Object.keys(t.value).length;
1364
1364
  return v.value ? _ > 0 ? ` ${_} items ` : " " : _ > 0 ? ` ${_} keys ` : " ";
1365
- }), D = T(() => {
1365
+ }), I = D(() => {
1366
1366
  const u = typeof t.value;
1367
1367
  return t.value === null ? "json-node__value--null" : u === "boolean" ? "json-node__value--boolean" : u === "number" ? "json-node__value--number" : u === "string" ? d(t.value) ? "json-node__value--number" : "json-node__value--string" : "";
1368
- }), Q = T(() => a.value ? f.value : t.value === null ? "null" : typeof t.value == "boolean" || typeof t.value == "number" ? String(t.value) : typeof t.value == "string" ? d(t.value) ? t.value : `"${t.value}"` : String(t.value)), te = T(() => "Click to edit, double-click to copy"), J = (u) => t.level === 0 ? u : g.value ? `${g.value}.${u}` : u, V = (u) => {
1368
+ }), q = D(() => a.value ? f.value : t.value === null ? "null" : typeof t.value == "boolean" || typeof t.value == "number" ? String(t.value) : typeof t.value == "string" ? d(t.value) ? t.value : `"${t.value}"` : String(t.value)), se = D(() => "Click to edit, double-click to copy"), te = (u) => t.level === 0 ? u : g.value ? `${g.value}.${u}` : u, V = (u) => {
1369
1369
  const _ = Object.keys(t.value);
1370
1370
  return _.indexOf(u) === _.length - 1;
1371
- }, Y = () => {
1371
+ }, z = () => {
1372
1372
  s("toggle-expand", g.value);
1373
- }, q = () => {
1374
- t.level !== 0 && (n.value = !0, c.value = t.keyName, Z(() => {
1373
+ }, W = () => {
1374
+ t.level !== 0 && (n.value = !0, c.value = t.keyName, ee(() => {
1375
1375
  const u = document.querySelectorAll(".json-node__key-input"), _ = u[u.length - 1];
1376
1376
  _ && (_.focus(), _.select());
1377
1377
  }));
1378
- }, ee = () => {
1379
- h.value || (a.value = !0, typeof t.value == "string" && d(t.value) || typeof t.value == "string" ? f.value = t.value : f.value = String(t.value), Z(() => {
1378
+ }, re = () => {
1379
+ h.value || (a.value = !0, typeof t.value == "string" && d(t.value) || typeof t.value == "string" ? f.value = t.value : f.value = String(t.value), ee(() => {
1380
1380
  const u = document.querySelectorAll(".json-node__value-input"), _ = u[u.length - 1];
1381
1381
  _ && (_.focus(), _.select());
1382
1382
  }));
@@ -1384,7 +1384,7 @@ const Be = { class: "json-node" }, De = {
1384
1384
  if (t.level === 0 || !n.value) return;
1385
1385
  const u = c.value.trim();
1386
1386
  if (!u) {
1387
- W();
1387
+ J();
1388
1388
  return;
1389
1389
  }
1390
1390
  if (u === t.keyName) {
@@ -1392,7 +1392,7 @@ const Be = { class: "json-node" }, De = {
1392
1392
  return;
1393
1393
  }
1394
1394
  n.value = !1, s("update:key", g.value, u);
1395
- }, z = () => {
1395
+ }, Z = () => {
1396
1396
  try {
1397
1397
  let u;
1398
1398
  const _ = f.value.trim();
@@ -1401,135 +1401,135 @@ const Be = { class: "json-node" }, De = {
1401
1401
  else if (_ === "true" || _ === "false")
1402
1402
  u = _ === "true";
1403
1403
  else if (!isNaN(Number(_)) && _ !== "") {
1404
- const K = Number(_);
1405
- !Number.isSafeInteger(K) || _.length > 15 ? u = _ : u = K;
1404
+ const X = Number(_);
1405
+ !Number.isSafeInteger(X) || _.length > 15 ? u = _ : u = X;
1406
1406
  } else
1407
1407
  u = f.value;
1408
1408
  s("update:value", g.value, u), a.value = !1;
1409
1409
  } catch (u) {
1410
1410
  console.error("Failed to parse value:", u), a.value = !1;
1411
1411
  }
1412
- }, W = () => {
1412
+ }, J = () => {
1413
1413
  n.value = !1, c.value = t.keyName;
1414
- }, H = () => {
1414
+ }, K = () => {
1415
1415
  a.value = !1, typeof t.value == "string" && d(t.value) || typeof t.value == "string" ? f.value = t.value : f.value = String(t.value);
1416
1416
  };
1417
1417
  return (u, _) => {
1418
- const K = pe("JsonNode", !0);
1419
- return w(), A("div", Be, [
1420
- h.value ? (w(), A("div", De, [
1421
- P("div", je, [
1418
+ const X = ve("JsonNode", !0);
1419
+ return w(), A("div", Le, [
1420
+ h.value ? (w(), A("div", Ue, [
1421
+ P("div", Me, [
1422
1422
  u.keyName && !n.value ? (w(), A("span", {
1423
1423
  key: 0,
1424
1424
  class: "json-node__key",
1425
- onClick: q,
1425
+ onClick: W,
1426
1426
  title: "Click to edit key"
1427
- }, ' "' + $(m.value) + '" ', 1)) : N("", !0),
1428
- u.keyName && n.value ? re((w(), A("input", {
1427
+ }, ' "' + $(E.value) + '" ', 1)) : B("", !0),
1428
+ u.keyName && n.value ? ae((w(), A("input", {
1429
1429
  key: 1,
1430
1430
  "onUpdate:modelValue": _[0] || (_[0] = (i) => c.value = i),
1431
1431
  onKeyup: [
1432
- X(F, ["enter"]),
1433
- X(W, ["escape"])
1432
+ Q(F, ["enter"]),
1433
+ Q(J, ["escape"])
1434
1434
  ],
1435
1435
  onBlur: F,
1436
1436
  class: "json-node__key-input"
1437
1437
  }, null, 544)), [
1438
- [ne, c.value]
1439
- ]) : N("", !0),
1440
- u.keyName ? (w(), A("span", Ie, ": ")) : N("", !0),
1438
+ [le, c.value]
1439
+ ]) : B("", !0),
1440
+ u.keyName ? (w(), A("span", Ve, ": ")) : B("", !0),
1441
1441
  P("span", {
1442
1442
  class: "json-node__bracket json-node__bracket--clickable",
1443
- onClick: Y,
1443
+ onClick: z,
1444
1444
  title: k.value ? "Click to collapse" : "Click to expand"
1445
- }, $(S.value), 9, $e),
1446
- k.value ? N("", !0) : (w(), A("span", Re, [
1447
- ie($(U.value) + " ", 1),
1445
+ }, $(S.value), 9, Fe),
1446
+ k.value ? B("", !0) : (w(), A("span", He, [
1447
+ de($(U.value) + " ", 1),
1448
1448
  P("span", {
1449
1449
  class: "json-node__bracket json-node__bracket--clickable",
1450
- onClick: Y
1450
+ onClick: z
1451
1451
  }, $(C.value), 1)
1452
1452
  ])),
1453
- !k.value && !u.isLast ? (w(), A("span", Le, ",")) : N("", !0)
1453
+ !k.value && !u.isLast ? (w(), A("span", Ke, ",")) : B("", !0)
1454
1454
  ]),
1455
- k.value ? (w(), A("div", Ue, [
1456
- P("div", Me, [
1457
- (w(!0), A(ye, null, be(u.value, (i, l) => (w(), A("div", {
1455
+ k.value ? (w(), A("div", Xe, [
1456
+ P("div", Ge, [
1457
+ (w(!0), A(_e, null, xe(u.value, (i, l) => (w(), A("div", {
1458
1458
  key: l,
1459
1459
  class: "json-node__child"
1460
1460
  }, [
1461
- ue(K, {
1461
+ ye(X, {
1462
1462
  value: i,
1463
1463
  "key-name": v.value ? "" : String(l),
1464
1464
  level: u.level + 1,
1465
- path: J(String(l)),
1465
+ path: te(String(l)),
1466
1466
  expanded: u.expanded,
1467
1467
  theme: u.theme,
1468
- "onUpdate:value": _[1] || (_[1] = (y, p) => u.$emit("update:value", y, p)),
1469
- onToggleExpand: _[2] || (_[2] = (y) => u.$emit("toggle-expand", y)),
1470
- onCopy: _[3] || (_[3] = (y) => u.$emit("copy", y)),
1471
- "onUpdate:key": _[4] || (_[4] = (y, p) => u.$emit("update:key", y, p)),
1468
+ "onUpdate:value": _[1] || (_[1] = (p, y) => u.$emit("update:value", p, y)),
1469
+ onToggleExpand: _[2] || (_[2] = (p) => u.$emit("toggle-expand", p)),
1470
+ onCopy: _[3] || (_[3] = (p) => u.$emit("copy", p)),
1471
+ "onUpdate:key": _[4] || (_[4] = (p, y) => u.$emit("update:key", p, y)),
1472
1472
  "is-last": V(String(l))
1473
1473
  }, null, 8, ["value", "key-name", "level", "path", "expanded", "theme", "is-last"])
1474
1474
  ]))), 128))
1475
1475
  ]),
1476
- P("div", Ve, [
1477
- P("span", Fe, $(C.value), 1),
1478
- u.isLast ? N("", !0) : (w(), A("span", He, ","))
1476
+ P("div", Qe, [
1477
+ P("span", Ye, $(C.value), 1),
1478
+ u.isLast ? B("", !0) : (w(), A("span", qe, ","))
1479
1479
  ])
1480
- ])) : N("", !0)
1481
- ])) : (w(), A("div", Ke, [
1480
+ ])) : B("", !0)
1481
+ ])) : (w(), A("div", ze, [
1482
1482
  u.keyName && !n.value ? (w(), A("span", {
1483
1483
  key: 0,
1484
1484
  class: "json-node__key",
1485
- onClick: q,
1485
+ onClick: W,
1486
1486
  title: "Click to edit key"
1487
- }, ' "' + $(m.value) + '" ', 1)) : N("", !0),
1488
- u.keyName && n.value ? re((w(), A("input", {
1487
+ }, ' "' + $(E.value) + '" ', 1)) : B("", !0),
1488
+ u.keyName && n.value ? ae((w(), A("input", {
1489
1489
  key: 1,
1490
1490
  "onUpdate:modelValue": _[5] || (_[5] = (i) => c.value = i),
1491
1491
  onKeyup: [
1492
- X(F, ["enter"]),
1493
- X(W, ["escape"])
1492
+ Q(F, ["enter"]),
1493
+ Q(J, ["escape"])
1494
1494
  ],
1495
1495
  onBlur: F,
1496
1496
  class: "json-node__key-input"
1497
1497
  }, null, 544)), [
1498
- [ne, c.value]
1499
- ]) : N("", !0),
1500
- u.keyName ? (w(), A("span", Xe, ": ")) : N("", !0),
1501
- a.value ? N("", !0) : (w(), A("span", {
1498
+ [le, c.value]
1499
+ ]) : B("", !0),
1500
+ u.keyName ? (w(), A("span", We, ": ")) : B("", !0),
1501
+ a.value ? B("", !0) : (w(), A("span", {
1502
1502
  key: 3,
1503
- class: de(["json-node__value", D.value]),
1504
- onClick: ee,
1503
+ class: ge(["json-node__value", I.value]),
1504
+ onClick: re,
1505
1505
  onDblclick: _[6] || (_[6] = (i) => u.$emit("copy", u.value)),
1506
- title: te.value
1506
+ title: se.value
1507
1507
  }, [
1508
- ie($(Q.value), 1),
1509
- u.isLast ? N("", !0) : (w(), A("span", Qe, ","))
1510
- ], 42, Ge)),
1511
- a.value ? re((w(), A("input", {
1508
+ de($(q.value), 1),
1509
+ u.isLast ? B("", !0) : (w(), A("span", Je, ","))
1510
+ ], 42, Ze)),
1511
+ a.value ? ae((w(), A("input", {
1512
1512
  key: 4,
1513
1513
  "onUpdate:modelValue": _[7] || (_[7] = (i) => f.value = i),
1514
1514
  onKeyup: [
1515
- X(z, ["enter"]),
1516
- X(H, ["escape"])
1515
+ Q(Z, ["enter"]),
1516
+ Q(K, ["escape"])
1517
1517
  ],
1518
- onBlur: z,
1518
+ onBlur: Z,
1519
1519
  class: "json-node__value-input"
1520
1520
  }, null, 544)), [
1521
- [ne, f.value]
1522
- ]) : N("", !0)
1521
+ [le, f.value]
1522
+ ]) : B("", !0)
1523
1523
  ]))
1524
1524
  ]);
1525
1525
  };
1526
1526
  }
1527
- }), he = (r, e) => {
1527
+ }), be = (r, e) => {
1528
1528
  const t = r.__vccOpts || r;
1529
1529
  for (const [s, n] of e)
1530
1530
  t[s] = n;
1531
1531
  return t;
1532
- }, qe = /* @__PURE__ */ he(Ye, [["__scopeId", "data-v-f3f3cbc9"]]), fe = {
1532
+ }, tt = /* @__PURE__ */ be(et, [["__scopeId", "data-v-f3f3cbc9"]]), Ee = {
1533
1533
  name: "github-light",
1534
1534
  colors: {
1535
1535
  // 背景色
@@ -1568,7 +1568,7 @@ const Be = { class: "json-node" }, De = {
1568
1568
  // 缩进线
1569
1569
  indentLine: "#d0d7de"
1570
1570
  }
1571
- }, ze = {
1571
+ }, rt = {
1572
1572
  name: "github-dark",
1573
1573
  colors: {
1574
1574
  // 背景色
@@ -1607,7 +1607,7 @@ const Be = { class: "json-node" }, De = {
1607
1607
  // 缩进线
1608
1608
  indentLine: "#30363d"
1609
1609
  }
1610
- }, We = {
1610
+ }, nt = {
1611
1611
  name: "min-light",
1612
1612
  colors: {
1613
1613
  // 背景色 - 纯白简洁
@@ -1646,7 +1646,7 @@ const Be = { class: "json-node" }, De = {
1646
1646
  // 缩进线
1647
1647
  indentLine: "#e5e7eb"
1648
1648
  }
1649
- }, Ze = {
1649
+ }, st = {
1650
1650
  name: "slack-ochin",
1651
1651
  colors: {
1652
1652
  // 背景色 - 温暖的米色调
@@ -1685,34 +1685,34 @@ const Be = { class: "json-node" }, De = {
1685
1685
  // 缩进线
1686
1686
  indentLine: "#e8d5b7"
1687
1687
  }
1688
- }, Je = {
1689
- "github-light": fe,
1690
- "github-dark": ze,
1691
- "min-light": We,
1692
- "slack-ochin": Ze
1688
+ }, ot = {
1689
+ "github-light": Ee,
1690
+ "github-dark": rt,
1691
+ "min-light": nt,
1692
+ "slack-ochin": st
1693
1693
  };
1694
- function et(r = "github-light") {
1695
- return Je[r] || fe;
1694
+ function it(r = "github-light") {
1695
+ return ot[r] || Ee;
1696
1696
  }
1697
- const tt = {
1697
+ const at = {
1698
1698
  key: 0,
1699
1699
  class: "json-format__toolbar"
1700
- }, rt = { class: "json-format__actions" }, nt = ["disabled"], st = ["disabled"], ot = ["disabled"], it = ["disabled"], at = { class: "json-format__info" }, lt = {
1700
+ }, lt = { class: "json-format__actions" }, ct = ["disabled"], ut = ["disabled"], dt = ["disabled"], ht = ["disabled"], ft = { class: "json-format__info" }, pt = {
1701
1701
  key: 0,
1702
1702
  class: "json-format__status json-format__status--success"
1703
- }, ct = {
1703
+ }, yt = {
1704
1704
  key: 1,
1705
1705
  class: "json-format__status json-format__status--error"
1706
- }, ut = { class: "json-format__content" }, dt = {
1706
+ }, gt = { class: "json-format__content" }, bt = {
1707
1707
  key: 0,
1708
1708
  class: "json-format__error"
1709
- }, ht = {
1709
+ }, Et = {
1710
1710
  key: 1,
1711
1711
  class: "json-format__error"
1712
- }, ft = {
1712
+ }, mt = {
1713
1713
  key: 2,
1714
1714
  class: "json-format__viewer"
1715
- }, pt = /* @__PURE__ */ le({
1715
+ }, vt = /* @__PURE__ */ fe({
1716
1716
  name: "JsonFormat",
1717
1717
  __name: "index",
1718
1718
  props: {
@@ -1724,44 +1724,69 @@ const tt = {
1724
1724
  },
1725
1725
  emits: ["update:modelValue", "copy-success", "copy-error", "expand-all", "collapse-all", "compress"],
1726
1726
  setup(r, { expose: e, emit: t }) {
1727
- ce((i) => ({
1728
- dd679ea0: g.value.colors.border,
1729
- "0543a09c": g.value.colors.background,
1730
- "630352b1": g.value.colors.text,
1731
- be141a92: g.value.colors.surfaceBackground,
1732
- "4e0b2382": g.value.colors.buttonBorder,
1733
- ee392cf8: g.value.colors.buttonBackground,
1734
- "6224d203": g.value.colors.buttonText,
1735
- c17e7bd0: g.value.colors.buttonBackgroundHover,
1736
- "5c94496c": g.value.colors.buttonPrimary,
1737
- a3b0d9a0: g.value.colors.buttonPrimaryHover,
1738
- "1129928d": g.value.colors.successBackground,
1739
- "24ed13ff": g.value.colors.success,
1740
- "5bef9d5c": g.value.colors.errorBackground,
1741
- "06cd15f8": g.value.colors.error,
1742
- "4bc6db49": g.value.colors.scrollbarTrack,
1743
- "4bc29bd4": g.value.colors.scrollbarThumb,
1744
- aad6fc70: g.value.colors.scrollbarThumbHover
1727
+ pe((i) => ({
1728
+ ef037492: g.value.colors.border,
1729
+ "33e06939": g.value.colors.background,
1730
+ 60160510: g.value.colors.text,
1731
+ "5ef04350": g.value.colors.surfaceBackground,
1732
+ "2635d16e": g.value.colors.buttonBorder,
1733
+ "7e8021cb": g.value.colors.buttonBackground,
1734
+ ceb1e8ec: g.value.colors.buttonText,
1735
+ "3fff1e31": g.value.colors.buttonBackgroundHover,
1736
+ ce0e62f6: g.value.colors.buttonPrimary,
1737
+ a1115492: g.value.colors.buttonPrimaryHover,
1738
+ "61b839b4": g.value.colors.successBackground,
1739
+ "13fd9fd8": g.value.colors.success,
1740
+ f14057aa: g.value.colors.errorBackground,
1741
+ "2ddd231d": g.value.colors.error,
1742
+ c81a0d60: g.value.colors.scrollbarTrack,
1743
+ c8228c4a: g.value.colors.scrollbarThumb,
1744
+ "5985dfbe": g.value.colors.scrollbarThumbHover
1745
1745
  }));
1746
- const s = r, n = t, a = R(null), c = R(""), f = R(/* @__PURE__ */ new Set()), d = R(null), h = R(""), v = T(() => c.value === ""), g = T(() => et(s.theme)), k = T(() => h.value ? null : d.value !== null ? d.value : a.value), m = (i) => {
1746
+ const s = r, n = t, a = R(null), c = R(""), f = R(/* @__PURE__ */ new Set()), d = R(null), h = R(""), v = D(() => c.value === ""), g = D(() => it(s.theme)), k = D(() => h.value ? null : d.value !== null ? d.value : a.value), E = (i) => {
1747
1747
  if (!i.trim()) {
1748
1748
  a.value = null, c.value = "", d.value = null, h.value = "";
1749
1749
  return;
1750
1750
  }
1751
1751
  try {
1752
1752
  let l = i;
1753
- try {
1754
- a.value = JSON.parse(l), c.value = "", d.value = null, h.value = "", Z(() => {
1755
- k.value !== null && V();
1756
- });
1757
- return;
1758
- } catch {
1759
- }
1760
- const y = l.split("");
1761
- let p = !1, b = !1;
1762
- for (let E = 0; E < y.length; E++)
1763
- y[E] === "\\" && p ? b = !b : y[E] === '"' && !b ? p = !p : b = !1;
1764
- p || (l = l.replace(/:\s*(\d{16,})\s*([,}\]])/g, ': "$1"$2'), l = l.replace(/:\s*(\d+\.\d*?0+)\s*([,}\]])/g, ': "$1"$2')), a.value = JSON.parse(l), c.value = "", d.value = null, h.value = "", Z(() => {
1753
+ const p = /:\s*\d{16,}/.test(l), y = /:\s*\d+\.\d*0+\s*[,}\]]/.test(l);
1754
+ if (!p && !y)
1755
+ try {
1756
+ a.value = JSON.parse(l), c.value = "", d.value = null, h.value = "", ee(() => {
1757
+ k.value !== null && V();
1758
+ });
1759
+ return;
1760
+ } catch {
1761
+ }
1762
+ const b = (m, N, j) => {
1763
+ let T = "", oe = !1, ie = !1, H = 0;
1764
+ for (; H < m.length; ) {
1765
+ const G = m[H];
1766
+ if (oe)
1767
+ ie ? ie = !1 : G === "\\" ? ie = !0 : G === '"' && (oe = !1), T += G, H++;
1768
+ else if (G === '"')
1769
+ oe = !0, T += G, H++;
1770
+ else {
1771
+ const ne = m.slice(H).match(N);
1772
+ if (ne && ne.index === 0) {
1773
+ const me = ne[0].replace(N, j);
1774
+ T += me, H += ne[0].length;
1775
+ } else
1776
+ T += G, H++;
1777
+ }
1778
+ }
1779
+ return T;
1780
+ };
1781
+ l = b(
1782
+ l,
1783
+ /:\s*(\d{16,})(\s*[,}\]\n\r])/,
1784
+ ': "$1"$2'
1785
+ ), l = b(
1786
+ l,
1787
+ /:\s*(\d+\.\d*?0+)(\s*[,}\]\n\r])/,
1788
+ ': "$1"$2'
1789
+ ), a.value = JSON.parse(l), c.value = "", d.value = null, h.value = "", ee(() => {
1765
1790
  k.value !== null && V();
1766
1791
  });
1767
1792
  } catch (l) {
@@ -1790,7 +1815,7 @@ const tt = {
1790
1815
  `)(a.value), d.value = l;
1791
1816
  else
1792
1817
  throw new Error(`Unsupported filter type: ${i.type}`);
1793
- h.value = "", Z(() => {
1818
+ h.value = "", ee(() => {
1794
1819
  V();
1795
1820
  });
1796
1821
  } catch (l) {
@@ -1799,71 +1824,71 @@ const tt = {
1799
1824
  }, C = () => {
1800
1825
  d.value = null, h.value = "";
1801
1826
  };
1802
- ge(() => s.modelValue, (i) => {
1803
- m(i);
1827
+ ke(() => s.modelValue, (i) => {
1828
+ E(i);
1804
1829
  }, { immediate: !0 });
1805
1830
  const U = (i) => {
1806
1831
  if (!/^-?\d+(\.\d+)?$/.test(i)) return !1;
1807
1832
  const l = Number(i);
1808
1833
  return !Number.isSafeInteger(l) || i.length > 15;
1809
- }, D = (i, l, y) => JSON.stringify(i, (p, b) => {
1834
+ }, I = (i, l, p) => JSON.stringify(i, (y, b) => {
1810
1835
  if (typeof b == "string" && U(b))
1811
1836
  return `__BIG_NUMBER__${b}__BIG_NUMBER__`;
1812
1837
  if (typeof b == "string" && /^-?\d+(\.\d+)?$/.test(b)) {
1813
- const E = Number(b);
1814
- if (Number.isSafeInteger(E) && E.toString() === b)
1815
- return E;
1816
- if (!Number.isNaN(E) && isFinite(E) && b.includes("."))
1817
- return E.toString() === b ? E : `__PRESERVE_STRING__${b}__PRESERVE_STRING__`;
1818
- if (!Number.isNaN(E) && isFinite(E))
1819
- return E;
1838
+ const m = Number(b);
1839
+ if (Number.isSafeInteger(m) && m.toString() === b)
1840
+ return m;
1841
+ if (!Number.isNaN(m) && isFinite(m) && b.includes("."))
1842
+ return m.toString() === b ? m : `__PRESERVE_STRING__${b}__PRESERVE_STRING__`;
1843
+ if (!Number.isNaN(m) && isFinite(m))
1844
+ return m;
1820
1845
  }
1821
- return l && typeof l == "function" ? l(p, b) : b;
1822
- }, y).replace(/"__BIG_NUMBER__(.+?)__BIG_NUMBER__"/g, "$1").replace(/"__PRESERVE_STRING__(.+?)__PRESERVE_STRING__"/g, "$1"), Q = (i, l) => {
1846
+ return l && typeof l == "function" ? l(y, b) : b;
1847
+ }, p).replace(/"__BIG_NUMBER__(.+?)__BIG_NUMBER__"/g, "$1").replace(/"__PRESERVE_STRING__(.+?)__PRESERVE_STRING__"/g, "$1"), q = (i, l) => {
1823
1848
  if (!s.readonly)
1824
1849
  try {
1825
- const y = te(a.value, i, l), p = D(y, null, 2);
1826
- n("update:modelValue", p);
1827
- } catch (y) {
1828
- console.error("Failed to update JSON:", y);
1850
+ const p = se(a.value, i, l), y = I(p, null, 2);
1851
+ n("update:modelValue", y);
1852
+ } catch (p) {
1853
+ console.error("Failed to update JSON:", p);
1829
1854
  }
1830
- }, te = (i, l, y) => {
1831
- if (!l || l === "root") return y;
1832
- const p = l.split("."), b = H(i, p.slice(0, -1));
1833
- let E = b;
1834
- for (let j = 0; j < p.length - 1; j++) {
1835
- const I = p[j];
1836
- I !== "root" && (Array.isArray(E) ? E = E[parseInt(I)] : E = E[I]);
1855
+ }, se = (i, l, p) => {
1856
+ if (!l || l === "root") return p;
1857
+ const y = l.split("."), b = K(i, y.slice(0, -1));
1858
+ let m = b;
1859
+ for (let j = 0; j < y.length - 1; j++) {
1860
+ const T = y[j];
1861
+ T !== "root" && (Array.isArray(m) ? m = m[parseInt(T)] : m = m[T]);
1837
1862
  }
1838
- const B = p[p.length - 1];
1839
- return B === "root" ? y : (Array.isArray(E) ? E[parseInt(B)] = y : E[B] = y, b);
1840
- }, J = (i) => {
1863
+ const N = y[y.length - 1];
1864
+ return N === "root" ? p : (Array.isArray(m) ? m[parseInt(N)] = p : m[N] = p, b);
1865
+ }, te = (i) => {
1841
1866
  f.value.has(i) ? f.value.delete(i) : f.value.add(i);
1842
1867
  }, V = () => {
1843
- const i = /* @__PURE__ */ new Set(), l = (y, p = "") => {
1844
- y !== null && typeof y == "object" && (i.add(p || "root"), Array.isArray(y) ? y.forEach((b, E) => {
1845
- const B = p ? `${p}.${E}` : `${E}`;
1846
- l(b, B);
1847
- }) : Object.keys(y).forEach((b) => {
1848
- const E = p ? `${p}.${b}` : b;
1849
- l(y[b], E);
1868
+ const i = /* @__PURE__ */ new Set(), l = (p, y = "") => {
1869
+ p !== null && typeof p == "object" && (i.add(y || "root"), Array.isArray(p) ? p.forEach((b, m) => {
1870
+ const N = y ? `${y}.${m}` : `${m}`;
1871
+ l(b, N);
1872
+ }) : Object.keys(p).forEach((b) => {
1873
+ const m = y ? `${y}.${b}` : b;
1874
+ l(p[b], m);
1850
1875
  }));
1851
1876
  };
1852
1877
  l(k.value), f.value = i, n("expand-all");
1853
- }, Y = () => {
1878
+ }, z = () => {
1854
1879
  f.value = /* @__PURE__ */ new Set(["root"]), n("collapse-all");
1855
- }, q = async () => {
1880
+ }, W = async () => {
1856
1881
  if (v.value)
1857
1882
  try {
1858
- const i = k.value, l = D(i, null, 2);
1883
+ const i = k.value, l = I(i, null, 2);
1859
1884
  await navigator.clipboard.writeText(l), n("copy-success", l);
1860
1885
  } catch (i) {
1861
1886
  console.error("Failed to copy JSON:", i), n("copy-error", i instanceof Error ? i : new Error("Failed to copy JSON"));
1862
1887
  }
1863
- }, ee = () => {
1888
+ }, re = () => {
1864
1889
  if (v.value)
1865
1890
  try {
1866
- const i = k.value, l = D(i);
1891
+ const i = k.value, l = I(i);
1867
1892
  n("update:modelValue", l), n("compress", l);
1868
1893
  } catch (i) {
1869
1894
  console.error("Failed to compress JSON:", i);
@@ -1875,81 +1900,81 @@ const tt = {
1875
1900
  } catch (l) {
1876
1901
  console.error("Failed to copy value:", l);
1877
1902
  }
1878
- }, z = (i, l) => {
1903
+ }, Z = (i, l) => {
1879
1904
  if (!s.readonly)
1880
1905
  try {
1881
- const y = W(a.value, i, l), p = D(y, null, 2);
1882
- n("update:modelValue", p), K(i, l);
1883
- } catch (y) {
1884
- console.error("Failed to rename key:", y);
1906
+ const p = J(a.value, i, l), y = I(p, null, 2);
1907
+ n("update:modelValue", y), X(i, l);
1908
+ } catch (p) {
1909
+ console.error("Failed to rename key:", p);
1885
1910
  }
1886
- }, W = (i, l, y) => {
1911
+ }, J = (i, l, p) => {
1887
1912
  if (!l || l === "root") return i;
1888
- const p = l.split("."), b = H(i, p.slice(0, -1));
1889
- if (p.length === 1) {
1890
- const j = p[0];
1891
- return b && typeof b == "object" && !Array.isArray(b) ? u(b, j, y) : b;
1913
+ const y = l.split("."), b = K(i, y.slice(0, -1));
1914
+ if (y.length === 1) {
1915
+ const j = y[0];
1916
+ return b && typeof b == "object" && !Array.isArray(b) ? u(b, j, p) : b;
1892
1917
  }
1893
- let E = b;
1894
- for (let j = 0; j < p.length - 1; j++) {
1895
- const I = p[j];
1896
- Array.isArray(E) ? E = E[parseInt(I)] : E = E[I];
1918
+ let m = b;
1919
+ for (let j = 0; j < y.length - 1; j++) {
1920
+ const T = y[j];
1921
+ Array.isArray(m) ? m = m[parseInt(T)] : m = m[T];
1897
1922
  }
1898
- const B = p[p.length - 1];
1899
- if (!Array.isArray(E) && E && typeof E == "object") {
1900
- const j = u(E, B, y), I = p.slice(0, -1);
1901
- I.length > 0 && _(b, I, j);
1923
+ const N = y[y.length - 1];
1924
+ if (!Array.isArray(m) && m && typeof m == "object") {
1925
+ const j = u(m, N, p), T = y.slice(0, -1);
1926
+ T.length > 0 && _(b, T, j);
1902
1927
  }
1903
1928
  return b;
1904
- }, H = (i, l) => {
1929
+ }, K = (i, l) => {
1905
1930
  if (l.length === 0) return i;
1906
1931
  if (Array.isArray(i)) {
1907
- const y = [...i], p = l[0], b = parseInt(p);
1908
- return l.length === 1 || (y[b] = H(i[b], l.slice(1))), y;
1932
+ const p = [...i], y = l[0], b = parseInt(y);
1933
+ return l.length === 1 || (p[b] = K(i[b], l.slice(1))), p;
1909
1934
  } else if (i && typeof i == "object") {
1910
- const y = { ...i }, p = l[0];
1911
- return l.length === 1 || (y[p] = H(i[p], l.slice(1))), y;
1935
+ const p = { ...i }, y = l[0];
1936
+ return l.length === 1 || (p[y] = K(i[y], l.slice(1))), p;
1912
1937
  }
1913
1938
  return i;
1914
- }, u = (i, l, y) => {
1939
+ }, u = (i, l, p) => {
1915
1940
  if (!i || typeof i != "object" || Array.isArray(i))
1916
1941
  return i;
1917
- const p = Object.keys(i), b = {};
1918
- for (const E of p)
1919
- E === l ? b[y] = i[E] : b[E] = i[E];
1942
+ const y = Object.keys(i), b = {};
1943
+ for (const m of y)
1944
+ m === l ? b[p] = i[m] : b[m] = i[m];
1920
1945
  return b;
1921
- }, _ = (i, l, y) => {
1922
- let p = i;
1923
- for (let E = 0; E < l.length - 1; E++) {
1924
- const B = l[E];
1925
- Array.isArray(p) ? p = p[parseInt(B)] : p = p[B];
1946
+ }, _ = (i, l, p) => {
1947
+ let y = i;
1948
+ for (let m = 0; m < l.length - 1; m++) {
1949
+ const N = l[m];
1950
+ Array.isArray(y) ? y = y[parseInt(N)] : y = y[N];
1926
1951
  }
1927
1952
  const b = l[l.length - 1];
1928
- Array.isArray(p) ? p[parseInt(b)] = y : p[b] = y;
1929
- }, K = (i, l) => {
1930
- const y = /* @__PURE__ */ new Set();
1931
- f.value.forEach((p) => {
1932
- if (p === i) {
1953
+ Array.isArray(y) ? y[parseInt(b)] = p : y[b] = p;
1954
+ }, X = (i, l) => {
1955
+ const p = /* @__PURE__ */ new Set();
1956
+ f.value.forEach((y) => {
1957
+ if (y === i) {
1933
1958
  const b = i.split(".");
1934
- b[b.length - 1] = l, y.add(b.join("."));
1935
- } else if (p.startsWith(i + ".")) {
1959
+ b[b.length - 1] = l, p.add(b.join("."));
1960
+ } else if (y.startsWith(i + ".")) {
1936
1961
  const b = i.split(".");
1937
1962
  b[b.length - 1] = l;
1938
- const E = b.join("."), B = p.substring(i.length);
1939
- y.add(E + B);
1963
+ const m = b.join("."), N = y.substring(i.length);
1964
+ p.add(m + N);
1940
1965
  } else
1941
- y.add(p);
1942
- }), f.value = y;
1966
+ p.add(y);
1967
+ }), f.value = p;
1943
1968
  };
1944
1969
  return e({
1945
1970
  // 核心操作方法
1946
- copyJson: q,
1947
- compressSource: ee,
1971
+ copyJson: W,
1972
+ compressSource: re,
1948
1973
  expandAll: V,
1949
- collapseAll: Y,
1950
- toggleExpand: J,
1951
- updateValue: Q,
1952
- updateKey: z,
1974
+ collapseAll: z,
1975
+ toggleExpand: te,
1976
+ updateValue: q,
1977
+ updateKey: Z,
1953
1978
  // Filter 相关方法
1954
1979
  filter: S,
1955
1980
  clearFilter: C,
@@ -1961,75 +1986,75 @@ const tt = {
1961
1986
  getParseError: () => c.value,
1962
1987
  getFilterError: () => h.value,
1963
1988
  // 工具方法
1964
- parseJson: (i) => m(i),
1989
+ parseJson: (i) => E(i),
1965
1990
  copyValue: (i) => F(i)
1966
1991
  }), (i, l) => (w(), A("div", {
1967
- class: de(["json-format", `json-format--${g.value.name}`])
1992
+ class: ge(["json-format", `json-format--${g.value.name}`])
1968
1993
  }, [
1969
- i.showToolbar ? (w(), A("div", tt, [
1970
- P("div", rt, [
1994
+ i.showToolbar ? (w(), A("div", at, [
1995
+ P("div", lt, [
1971
1996
  P("button", {
1972
1997
  class: "json-format__btn json-format__btn--primary",
1973
- onClick: q,
1998
+ onClick: W,
1974
1999
  disabled: !v.value,
1975
2000
  title: "Copy JSON"
1976
- }, " 📋 Copy ", 8, nt),
2001
+ }, " 📋 Copy ", 8, ct),
1977
2002
  P("button", {
1978
2003
  class: "json-format__btn json-format__btn--secondary",
1979
2004
  onClick: V,
1980
2005
  disabled: !v.value,
1981
2006
  title: "Expand All"
1982
- }, " ⬇️ Expand All ", 8, st),
2007
+ }, " ⬇️ Expand All ", 8, ut),
1983
2008
  P("button", {
1984
2009
  class: "json-format__btn json-format__btn--secondary",
1985
- onClick: Y,
2010
+ onClick: z,
1986
2011
  disabled: !v.value,
1987
2012
  title: "Collapse All"
1988
- }, " ➡️ Collapse All ", 8, ot),
2013
+ }, " ➡️ Collapse All ", 8, dt),
1989
2014
  P("button", {
1990
2015
  class: "json-format__btn json-format__btn--secondary",
1991
- onClick: ee,
2016
+ onClick: re,
1992
2017
  disabled: !v.value,
1993
2018
  title: "Compress JSON"
1994
- }, " 📦 Compress ", 8, it)
2019
+ }, " 📦 Compress ", 8, ht)
1995
2020
  ]),
1996
- P("div", at, [
1997
- v.value ? (w(), A("span", lt, " ✅ Valid JSON ")) : (w(), A("span", ct, " ❌ Invalid JSON "))
2021
+ P("div", ft, [
2022
+ v.value ? (w(), A("span", pt, " ✅ Valid JSON ")) : (w(), A("span", yt, " ❌ Invalid JSON "))
1998
2023
  ])
1999
- ])) : N("", !0),
2000
- P("div", ut, [
2001
- v.value ? h.value ? (w(), A("div", ht, [
2024
+ ])) : B("", !0),
2025
+ P("div", gt, [
2026
+ v.value ? h.value ? (w(), A("div", Et, [
2002
2027
  l[1] || (l[1] = P("h4", null, "Filter Error:", -1)),
2003
2028
  P("pre", null, $(h.value), 1)
2004
- ])) : (w(), A("div", ft, [
2005
- ue(qe, {
2029
+ ])) : (w(), A("div", mt, [
2030
+ ye(tt, {
2006
2031
  value: k.value,
2007
2032
  "key-name": "",
2008
2033
  level: 0,
2009
2034
  expanded: f.value,
2010
2035
  "is-last": !0,
2011
2036
  theme: g.value,
2012
- "onUpdate:value": Q,
2013
- onToggleExpand: J,
2037
+ "onUpdate:value": q,
2038
+ onToggleExpand: te,
2014
2039
  onCopy: F,
2015
- "onUpdate:key": z
2040
+ "onUpdate:key": Z
2016
2041
  }, null, 8, ["value", "expanded", "theme"])
2017
- ])) : (w(), A("div", dt, [
2042
+ ])) : (w(), A("div", bt, [
2018
2043
  l[0] || (l[0] = P("h4", null, "JSON Parse Error:", -1)),
2019
2044
  P("pre", null, $(c.value), 1)
2020
2045
  ]))
2021
2046
  ])
2022
2047
  ], 2));
2023
2048
  }
2024
- }), yt = /* @__PURE__ */ he(pt, [["__scopeId", "data-v-c6bbb1e1"]]), bt = [yt], gt = (r) => {
2025
- bt.forEach((e) => {
2049
+ }), _t = /* @__PURE__ */ be(vt, [["__scopeId", "data-v-ad4d00ac"]]), xt = [_t], kt = (r) => {
2050
+ xt.forEach((e) => {
2026
2051
  const t = e.name || e.__name || "UnknownComponent";
2027
2052
  r.component(t, e);
2028
2053
  });
2029
- }, vt = {
2030
- install: gt
2054
+ }, wt = {
2055
+ install: kt
2031
2056
  };
2032
2057
  export {
2033
- yt as JsonFormat,
2034
- vt as default
2058
+ _t as JsonFormat,
2059
+ wt as default
2035
2060
  };