@visual-json/vue 0.3.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.
package/dist/index.mjs ADDED
@@ -0,0 +1,2313 @@
1
+ import { defineComponent as Y, shallowRef as M, computed as T, watch as J, onMounted as G, onUnmounted as _, provide as ke, renderSlot as Be, inject as Se, openBlock as g, createElementBlock as x, Fragment as U, createElementVNode as D, withModifiers as H, normalizeStyle as R, unref as b, toDisplayString as F, createCommentVNode as A, renderList as te, createBlock as X, nextTick as ce, Teleport as Ve, createVNode as q, useModel as Fe, createTextVNode as Oe, mergeModels as he, withCtx as Ae } from "vue";
2
+ import { getPropertySchema as Ke, resolveRef as Le, isDescendant as je, reorderChildrenMulti as Pe, removeNode as fe, insertNode as He, fromJson as ge, History as ye, searchNodes as xe, toJson as le, getAncestorIds as We, duplicateNode as Je, changeType as Ue, setValue as Ye, setKey as qe, addProperty as Qe, computeDiff as Xe } from "@visual-json/core";
3
+ function pe(t, r) {
4
+ const e = [];
5
+ function n(a) {
6
+ if (e.push(a), r(a.id) && (a.type === "object" || a.type === "array"))
7
+ for (const s of a.children)
8
+ n(s);
9
+ }
10
+ return n(t), e;
11
+ }
12
+ var Ge = ["name", "type", "title", "id", "label", "key"];
13
+ function se(t, r) {
14
+ if (t.parentId === null) return "/";
15
+ const e = r.nodesById.get(t.parentId);
16
+ if ((e == null ? void 0 : e.type) !== "array" || t.type !== "object") return t.key;
17
+ for (const n of Ge) {
18
+ const a = t.children.find((s) => s.key === n);
19
+ if ((a == null ? void 0 : a.value) != null && a.value !== "")
20
+ return String(a.value);
21
+ }
22
+ return t.key;
23
+ }
24
+ function Ie(t) {
25
+ const r = [t.id];
26
+ for (const e of t.children)
27
+ r.push(...Ie(e));
28
+ return r;
29
+ }
30
+ var re = {
31
+ "--vj-bg": "#1e1e1e",
32
+ "--vj-bg-panel": "#252526",
33
+ "--vj-bg-hover": "#2a2d2e",
34
+ "--vj-bg-selected": "#2a5a1e",
35
+ "--vj-bg-selected-muted": "#2a2d2e",
36
+ "--vj-bg-match": "#3a3520",
37
+ "--vj-bg-match-active": "#51502b",
38
+ "--vj-border": "#333333",
39
+ "--vj-border-subtle": "#2a2a2a",
40
+ "--vj-text": "#cccccc",
41
+ "--vj-text-muted": "#888888",
42
+ "--vj-text-dim": "#666666",
43
+ "--vj-text-dimmer": "#555555",
44
+ "--vj-string": "#ce9178",
45
+ "--vj-number": "#b5cea8",
46
+ "--vj-boolean": "#569cd6",
47
+ "--vj-accent": "#007acc",
48
+ "--vj-accent-muted": "#094771",
49
+ "--vj-input-bg": "#3c3c3c",
50
+ "--vj-input-border": "#555555",
51
+ "--vj-error": "#f48771",
52
+ "--vj-font": "monospace",
53
+ "--vj-input-font-size": "13px"
54
+ }, _e = Object.freeze(/* @__PURE__ */ new Set()), ue = () => ({
55
+ draggedNodeIds: _e,
56
+ dropTargetNodeId: null,
57
+ dropPosition: null
58
+ });
59
+ function Ze(t, r) {
60
+ const e = [];
61
+ function n(a) {
62
+ r.has(a.id) && e.push(a.id);
63
+ for (const s of a.children) n(s);
64
+ }
65
+ return n(t), e;
66
+ }
67
+ function et(t, r) {
68
+ const { draggedNodeIds: e, dropTargetNodeId: n, dropPosition: a } = r;
69
+ if (e.size === 0 || !n || !a)
70
+ return null;
71
+ const s = t.nodesById.get(n);
72
+ if (!s || !s.parentId) return null;
73
+ for (const l of e)
74
+ if (je(t, n, l)) return null;
75
+ const i = s.parentId, o = t.nodesById.get(i);
76
+ if (!o) return null;
77
+ const p = o.children.filter((l) => e.has(l.id)).map((l) => l.id);
78
+ if (p.length === e.size && [...e].every((l) => {
79
+ const v = t.nodesById.get(l);
80
+ return (v == null ? void 0 : v.parentId) === i;
81
+ }))
82
+ return Pe(
83
+ t,
84
+ i,
85
+ p,
86
+ n,
87
+ a
88
+ );
89
+ const y = Ze(t.root, e), C = y.map((l) => t.nodesById.get(l)).filter((l) => !!l && l.parentId !== null).map((l) => structuredClone(l));
90
+ let E = t;
91
+ for (const l of [...y].reverse())
92
+ E.nodesById.has(l) && (E = fe(E, l));
93
+ const O = E.nodesById.get(n);
94
+ if (!O || !O.parentId) return null;
95
+ const c = E.nodesById.get(O.parentId);
96
+ if (!c) return null;
97
+ let N = c.children.findIndex(
98
+ (l) => l.id === n
99
+ );
100
+ a === "after" && N++;
101
+ for (let l = 0; l < C.length; l++)
102
+ E = He(
103
+ E,
104
+ c.id,
105
+ C[l],
106
+ N + l
107
+ );
108
+ return E;
109
+ }
110
+ function De(t, r, e) {
111
+ const n = document.createElement("div");
112
+ n.textContent = `${r} selected`;
113
+ const a = document.querySelector("[data-form-container], [role='tree']"), s = a ? getComputedStyle(a) : null, i = (s == null ? void 0 : s.getPropertyValue("--vj-bg-selected").trim()) || re["--vj-bg-selected"], o = (s == null ? void 0 : s.getPropertyValue("--vj-text-selected").trim()) || (s == null ? void 0 : s.getPropertyValue("--vj-text").trim()) || re["--vj-text"], d = (s == null ? void 0 : s.getPropertyValue("--vj-font").trim()) || re["--vj-font"];
114
+ n.style.cssText = [
115
+ "position:fixed",
116
+ "top:-1000px",
117
+ "left:-1000px",
118
+ "padding:4px 12px",
119
+ `background:${i}`,
120
+ `color:${o}`,
121
+ `font-family:${d}`,
122
+ "font-size:13px",
123
+ "border-radius:4px",
124
+ "white-space:nowrap",
125
+ "pointer-events:none"
126
+ ].join(";"), document.body.appendChild(n), t.setDragImage(n, 0, 14), requestAnimationFrame(() => n.remove());
127
+ }
128
+ var tt = {
129
+ added: { bg: "#1e3a1e", marker: "+", label: "#4ec94e" },
130
+ removed: { bg: "#3a1e1e", marker: "-", label: "#f48771" },
131
+ changed: { bg: "#3a3a1e", marker: "~", label: "#dcdcaa" }
132
+ };
133
+ function ae(t) {
134
+ if (t === void 0) return "";
135
+ if (t === null) return "null";
136
+ if (typeof t == "string") return JSON.stringify(t);
137
+ if (typeof t == "object") {
138
+ const r = JSON.stringify(t, null, 2);
139
+ return r.length > 80 ? JSON.stringify(t).slice(0, 77) + "..." : r;
140
+ }
141
+ return String(t);
142
+ }
143
+ function Ce(t, r, e) {
144
+ if (!t) return;
145
+ const n = Ke(t, e, r);
146
+ if (n)
147
+ return Le(n, r ?? t);
148
+ }
149
+ function nt(t) {
150
+ return t.type === "boolean" || t.type === "null" ? "var(--vj-boolean, #569cd6)" : t.type === "number" ? "var(--vj-number, #b5cea8)" : "var(--vj-string, #ce9178)";
151
+ }
152
+ function ot(t) {
153
+ return t.type === "null" ? "null" : t.type === "boolean" ? String(t.value) : t.value === null || t.value === void 0 ? "" : String(t.value);
154
+ }
155
+ function at(t, r, e) {
156
+ var s;
157
+ if (!r || !t.parentId) return !1;
158
+ const n = t.path.split("/").slice(0, -1).join("/") || "/", a = Ce(r, e, n);
159
+ return ((s = a == null ? void 0 : a.required) == null ? void 0 : s.includes(t.key)) ?? !1;
160
+ }
161
+ function lt(t, r, e) {
162
+ const n = Array.isArray(r) ? r[0] : r;
163
+ if (n === "boolean" || t === "true" || t === "false")
164
+ return t === "true";
165
+ if (t === "null")
166
+ return null;
167
+ if (n === "number" || n === "integer" || e === "number") {
168
+ const a = Number(t);
169
+ return isNaN(a) ? t : a;
170
+ }
171
+ return t;
172
+ }
173
+ const Ne = Symbol("StudioContext");
174
+ function Me(t, r, e) {
175
+ if (!r) return null;
176
+ let n = t.nodesById.get(r);
177
+ if (!n) return null;
178
+ for (; n; ) {
179
+ const a = n.parentId ? t.nodesById.get(n.parentId) : void 0, s = a ? a.children : [t.root], i = new Set(s.map((d) => d.id));
180
+ if (!s.every((d) => e.has(d.id)) || !a || !a.parentId) return i;
181
+ n = a;
182
+ }
183
+ return null;
184
+ }
185
+ function rt(t, r, e) {
186
+ const n = t.findIndex((d) => d.id === r), a = t.findIndex((d) => d.id === e);
187
+ if (n === -1 || a === -1) return null;
188
+ const s = Math.min(n, a), i = Math.max(n, a), o = /* @__PURE__ */ new Set();
189
+ for (let d = s; d <= i; d++)
190
+ o.add(t[d].id);
191
+ return o;
192
+ }
193
+ function ve(t, r, e) {
194
+ const n = [...r].filter((o) => {
195
+ const d = t.nodesById.get(o);
196
+ if (!d || d.parentId === null) return !1;
197
+ let p = t.nodesById.get(d.parentId);
198
+ for (; p; ) {
199
+ if (r.has(p.id)) return !1;
200
+ p = p.parentId ? t.nodesById.get(p.parentId) : void 0;
201
+ }
202
+ return !0;
203
+ });
204
+ if (n.length === 0) return { newTree: t, nextFocusId: null };
205
+ const a = e.findIndex((o) => r.has(o.id));
206
+ let s = t;
207
+ for (const o of n)
208
+ s.nodesById.has(o) && (s = fe(s, o));
209
+ let i = null;
210
+ for (let o = a; o < e.length; o++) {
211
+ const d = e[o].id;
212
+ if (!r.has(d) && s.nodesById.has(d)) {
213
+ i = d;
214
+ break;
215
+ }
216
+ }
217
+ if (!i)
218
+ for (let o = a - 1; o >= 0; o--) {
219
+ const d = e[o].id;
220
+ if (!r.has(d) && s.nodesById.has(d)) {
221
+ i = d;
222
+ break;
223
+ }
224
+ }
225
+ return { newTree: s, nextFocusId: i };
226
+ }
227
+ const st = /* @__PURE__ */ Y({
228
+ __name: "VisualJson",
229
+ props: {
230
+ value: { type: [String, Number, Boolean, null, Array, Object] },
231
+ schema: { default: null }
232
+ },
233
+ emits: ["change"],
234
+ setup(t, { emit: r }) {
235
+ const e = t, n = r, a = M(ge(e.value)), s = M(null), i = M(/* @__PURE__ */ new Set()), o = M(null), d = M(null), p = M(/* @__PURE__ */ new Set([a.value.root.id])), f = T(
236
+ () => pe(a.value.root, (u) => p.value.has(u))
237
+ );
238
+ let y = null, C = new ye();
239
+ const E = M(0), O = T(() => (E.value, C.canUndo)), c = T(() => (E.value, C.canRedo)), N = M(""), l = M([]), v = M(0), k = T(
240
+ () => new Set(l.value.map((u) => u.nodeId))
241
+ );
242
+ let m = !1;
243
+ C.push(a.value);
244
+ function h(u) {
245
+ s.value = u, i.value = u ? /* @__PURE__ */ new Set([u]) : /* @__PURE__ */ new Set(), o.value = u, d.value = u;
246
+ }
247
+ J(
248
+ () => e.value,
249
+ (u) => {
250
+ if (m) {
251
+ m = !1;
252
+ return;
253
+ }
254
+ const j = ge(u);
255
+ a.value = j, p.value = /* @__PURE__ */ new Set([j.root.id]), h(null), C = new ye(), C.push(j), E.value++, N.value = "", l.value = [], v.value = 0;
256
+ },
257
+ { flush: "sync" }
258
+ ), J(
259
+ a,
260
+ (u) => {
261
+ if (!N.value.trim()) return;
262
+ const j = xe(u, N.value);
263
+ l.value = j, v.value = Math.min(
264
+ v.value,
265
+ Math.max(j.length - 1, 0)
266
+ );
267
+ },
268
+ { flush: "sync" }
269
+ );
270
+ function $(u) {
271
+ a.value = u, C.push(u), E.value++, m = !0, n("change", le(u.root));
272
+ }
273
+ function V() {
274
+ const u = C.undo();
275
+ u && (a.value = u, E.value++, m = !0, n("change", le(u.root)));
276
+ }
277
+ function W() {
278
+ const u = C.redo();
279
+ u && (a.value = u, E.value++, m = !0, n("change", le(u.root)));
280
+ }
281
+ function Q(u) {
282
+ const j = u.metaKey || u.ctrlKey;
283
+ j && u.key === "z" && !u.shiftKey ? (u.preventDefault(), V()) : (j && u.key === "z" && u.shiftKey || j && u.key === "y") && (u.preventDefault(), W());
284
+ }
285
+ G(() => document.addEventListener("keydown", Q)), _(() => document.removeEventListener("keydown", Q));
286
+ const S = {
287
+ tree: a,
288
+ focusedNodeId: s,
289
+ selectedNodeIds: i,
290
+ anchorNodeId: o,
291
+ drillDownNodeId: d,
292
+ expandedNodeIds: p,
293
+ schema: T(() => e.schema ?? null),
294
+ searchQuery: N,
295
+ searchMatches: l,
296
+ searchMatchIndex: v,
297
+ searchMatchNodeIds: k,
298
+ canUndo: O,
299
+ canRedo: c
300
+ };
301
+ return ke(Ne, { state: S, actions: {
302
+ setTree: $,
303
+ selectNode(u) {
304
+ s.value = u, i.value = u ? /* @__PURE__ */ new Set([u]) : /* @__PURE__ */ new Set(), o.value = u;
305
+ },
306
+ selectAndDrillDown: h,
307
+ toggleNodeSelection(u) {
308
+ const j = new Set(i.value);
309
+ j.has(u) ? j.delete(u) : j.add(u), i.value = j, j.size === 0 ? (s.value = null, o.value = null) : (s.value = u, o.value = u);
310
+ },
311
+ selectNodeRange(u) {
312
+ const j = y ?? f.value, I = o.value;
313
+ if (!I) {
314
+ s.value = u, i.value = /* @__PURE__ */ new Set([u]), o.value = u;
315
+ return;
316
+ }
317
+ const K = rt(j, I, u);
318
+ if (!K) {
319
+ s.value = u, i.value = /* @__PURE__ */ new Set([u]), o.value = u;
320
+ return;
321
+ }
322
+ i.value = K, s.value = u;
323
+ },
324
+ setSelection(u, j, I) {
325
+ s.value = u, i.value = j, o.value = I;
326
+ },
327
+ setVisibleNodesOverride(u) {
328
+ y = u;
329
+ },
330
+ drillDown(u) {
331
+ d.value = u;
332
+ },
333
+ toggleExpand(u) {
334
+ const j = new Set(p.value);
335
+ j.has(u) ? j.delete(u) : j.add(u), p.value = j;
336
+ },
337
+ expandNode(u) {
338
+ const j = new Set(p.value);
339
+ j.add(u), p.value = j;
340
+ },
341
+ collapseNode(u) {
342
+ const j = new Set(p.value);
343
+ j.delete(u), p.value = j;
344
+ },
345
+ expandAll() {
346
+ p.value = new Set(Ie(a.value.root));
347
+ },
348
+ collapseAll() {
349
+ p.value = /* @__PURE__ */ new Set([a.value.root.id]);
350
+ },
351
+ undo: V,
352
+ redo: W,
353
+ setSearchQuery(u) {
354
+ if (N.value = u, !u.trim()) {
355
+ l.value = [], v.value = 0;
356
+ return;
357
+ }
358
+ const j = xe(a.value, u);
359
+ if (l.value = j, v.value = 0, j.length > 0) {
360
+ const I = We(
361
+ a.value,
362
+ j.map((L) => L.nodeId)
363
+ ), K = new Set(p.value);
364
+ for (const L of I) K.add(L);
365
+ p.value = K, h(j[0].nodeId);
366
+ }
367
+ },
368
+ nextSearchMatch() {
369
+ if (l.value.length === 0) return;
370
+ const u = (v.value + 1) % l.value.length;
371
+ v.value = u, h(l.value[u].nodeId);
372
+ },
373
+ prevSearchMatch() {
374
+ if (l.value.length === 0) return;
375
+ const u = (v.value - 1 + l.value.length) % l.value.length;
376
+ v.value = u, h(l.value[u].nodeId);
377
+ }
378
+ } }), (u, j) => Be(u.$slots, "default");
379
+ }
380
+ });
381
+ function Z() {
382
+ const t = Se(Ne);
383
+ if (!t)
384
+ throw new Error("useStudio must be used within a <VisualJson> provider");
385
+ return t;
386
+ }
387
+ function Ee(t, r) {
388
+ const { state: e, actions: n } = Z(), a = M(ue());
389
+ function s(f) {
390
+ let y;
391
+ r.value.size > 0 && r.value.has(f) ? y = r.value : y = /* @__PURE__ */ new Set([f]), a.value = {
392
+ draggedNodeIds: y,
393
+ dropTargetNodeId: null,
394
+ dropPosition: null
395
+ };
396
+ }
397
+ function i(f, y) {
398
+ const C = a.value.draggedNodeIds;
399
+ for (const E of C)
400
+ if (f === E || je(e.tree.value, f, E))
401
+ return;
402
+ a.value = {
403
+ ...a.value,
404
+ dropTargetNodeId: f,
405
+ dropPosition: y
406
+ };
407
+ }
408
+ function o(f, y) {
409
+ if (y === "before") {
410
+ const C = t.value.findIndex((E) => E.id === f);
411
+ if (C > 0) {
412
+ i(t.value[C - 1].id, "after");
413
+ return;
414
+ }
415
+ }
416
+ i(f, y);
417
+ }
418
+ function d() {
419
+ a.value = ue();
420
+ }
421
+ function p() {
422
+ const f = et(e.tree.value, a.value);
423
+ f && n.setTree(f), a.value = ue();
424
+ }
425
+ return {
426
+ dragState: a,
427
+ handleDragStart: s,
428
+ handleDragOver: o,
429
+ handleDragEnd: d,
430
+ handleDrop: p
431
+ };
432
+ }
433
+ const it = ["aria-selected", "aria-expanded", "draggable", "data-node-id"], ut = ["aria-label"], dt = {
434
+ key: 1,
435
+ style: { width: "16px", flexShrink: 0 }
436
+ }, Te = /* @__PURE__ */ Y({
437
+ __name: "TreeNodeRow",
438
+ props: {
439
+ node: {},
440
+ depth: {},
441
+ dragState: {},
442
+ showValues: { type: Boolean },
443
+ showCounts: { type: Boolean },
444
+ isFocused: { type: Boolean }
445
+ },
446
+ emits: ["dragStart", "dragOver", "dragEnd", "drop", "contextMenu", "selectRange"],
447
+ setup(t, { emit: r }) {
448
+ const e = t, n = r, { state: a, actions: s } = Z(), i = M(!1);
449
+ function o() {
450
+ return a.selectedNodeIds.value.has(e.node.id);
451
+ }
452
+ function d() {
453
+ return a.expandedNodeIds.value.has(e.node.id);
454
+ }
455
+ const p = e.node.type === "object" || e.node.type === "array", f = e.node.parentId === null;
456
+ function y() {
457
+ return a.searchMatchNodeIds.value.has(e.node.id);
458
+ }
459
+ function C() {
460
+ var m;
461
+ return a.searchMatches.value.length > 0 && ((m = a.searchMatches.value[a.searchMatchIndex.value]) == null ? void 0 : m.nodeId) === e.node.id;
462
+ }
463
+ function E() {
464
+ return p ? e.node.type === "array" ? `[${e.node.children.length}]` : `{${e.node.children.length}}` : e.node.value === null ? "null" : typeof e.node.value == "string" ? e.node.value : String(e.node.value);
465
+ }
466
+ function O(m) {
467
+ m.preventDefault();
468
+ const h = m.currentTarget.getBoundingClientRect(), $ = h.top + h.height / 2, V = m.clientY < $ ? "before" : "after";
469
+ n("dragOver", e.node.id, V);
470
+ }
471
+ function c() {
472
+ return e.dragState.dropTargetNodeId === e.node.id && e.dragState.dropPosition === "before" ? "var(--vj-accent, #007acc)" : "transparent";
473
+ }
474
+ function N() {
475
+ return e.dragState.dropTargetNodeId === e.node.id && e.dragState.dropPosition === "after" ? "var(--vj-accent, #007acc)" : "transparent";
476
+ }
477
+ function l() {
478
+ const m = o(), h = C(), $ = y(), V = i.value;
479
+ return m ? e.isFocused ? "var(--vj-bg-selected, #2a5a1e)" : "var(--vj-bg-selected-muted, var(--vj-bg-hover, #2a2d2e))" : h ? "var(--vj-bg-match-active, #51502b)" : $ ? "var(--vj-bg-match, #3a3520)" : V ? "var(--vj-bg-hover, #2a2d2e)" : "transparent";
480
+ }
481
+ function v(m) {
482
+ m.shiftKey ? n("selectRange", e.node.id) : m.metaKey || m.ctrlKey ? s.toggleNodeSelection(e.node.id) : s.selectAndDrillDown(e.node.id);
483
+ }
484
+ function k(m) {
485
+ m.dataTransfer.effectAllowed = "move", a.selectedNodeIds.value.size > 1 && a.selectedNodeIds.value.has(e.node.id) && De(m.dataTransfer, a.selectedNodeIds.value.size), n("dragStart", e.node.id);
486
+ }
487
+ return (m, h) => (g(), x(U, null, [
488
+ D("div", {
489
+ role: "treeitem",
490
+ "aria-selected": o(),
491
+ "aria-expanded": b(p) ? d() : void 0,
492
+ draggable: !f,
493
+ "data-node-id": t.node.id,
494
+ style: R({
495
+ display: "flex",
496
+ alignItems: "center",
497
+ gap: "6px",
498
+ padding: "1px 8px",
499
+ paddingLeft: 8 + t.depth * 16 + "px",
500
+ cursor: "pointer",
501
+ backgroundColor: l(),
502
+ minHeight: "28px",
503
+ userSelect: "none",
504
+ opacity: t.dragState.draggedNodeIds.has(t.node.id) ? 0.4 : 1,
505
+ borderTop: `2px solid ${c()}`,
506
+ borderBottom: `2px solid ${N()}`,
507
+ boxSizing: "border-box",
508
+ color: o() && t.isFocused ? "var(--vj-text-selected, var(--vj-text, #cccccc))" : "var(--vj-text, #cccccc)"
509
+ }),
510
+ onClick: v,
511
+ onMouseenter: h[1] || (h[1] = () => i.value = !0),
512
+ onMouseleave: h[2] || (h[2] = () => i.value = !1),
513
+ onContextmenu: h[3] || (h[3] = ($) => n("contextMenu", $, t.node)),
514
+ onDragstart: k,
515
+ onDragover: O,
516
+ onDragend: h[4] || (h[4] = () => n("dragEnd")),
517
+ onDrop: h[5] || (h[5] = H(() => n("drop"), ["prevent"]))
518
+ }, [
519
+ b(p) ? (g(), x("button", {
520
+ key: 0,
521
+ "aria-label": d() ? "Collapse" : "Expand",
522
+ style: R({
523
+ background: "none",
524
+ border: "none",
525
+ color: "inherit",
526
+ cursor: "pointer",
527
+ padding: 0,
528
+ width: "16px",
529
+ fontSize: "9px",
530
+ flexShrink: 0,
531
+ display: "inline-flex",
532
+ alignItems: "center",
533
+ justifyContent: "center",
534
+ transition: "transform 0.15s",
535
+ transform: d() ? "rotate(90deg)" : "rotate(0deg)"
536
+ }),
537
+ onClick: h[0] || (h[0] = H(() => b(s).toggleExpand(t.node.id), ["stop"]))
538
+ }, " ▶ ", 12, ut)) : (g(), x("span", dt)),
539
+ D("span", {
540
+ style: R({
541
+ color: "inherit",
542
+ fontSize: "13px",
543
+ fontFamily: "var(--vj-font, monospace)",
544
+ flexShrink: 0,
545
+ fontWeight: f ? 600 : 400
546
+ })
547
+ }, F(f ? "/" : b(se)(t.node, b(a).tree.value)), 5),
548
+ !f && b(p) && t.showCounts ? (g(), x("span", {
549
+ key: 2,
550
+ style: R({
551
+ color: o() ? "inherit" : "var(--vj-text-muted, #888888)",
552
+ fontSize: "13px",
553
+ fontFamily: "var(--vj-font, monospace)",
554
+ whiteSpace: "nowrap",
555
+ marginLeft: "auto"
556
+ })
557
+ }, F(E()), 5)) : A("", !0),
558
+ !f && !b(p) && t.showValues ? (g(), x("span", {
559
+ key: 3,
560
+ style: R({
561
+ color: t.node.type === "string" ? "var(--vj-string, #ce9178)" : "var(--vj-number, #b5cea8)",
562
+ fontSize: "13px",
563
+ fontFamily: "var(--vj-font, monospace)",
564
+ overflow: "hidden",
565
+ textOverflow: "ellipsis",
566
+ whiteSpace: "nowrap",
567
+ marginLeft: "auto"
568
+ })
569
+ }, F(E()), 5)) : A("", !0)
570
+ ], 44, it),
571
+ d() ? (g(!0), x(U, { key: 0 }, te(t.node.children, ($) => (g(), X(Te, {
572
+ key: $.id,
573
+ node: $,
574
+ depth: t.depth + 1,
575
+ "drag-state": t.dragState,
576
+ "show-values": t.showValues,
577
+ "show-counts": t.showCounts,
578
+ "is-focused": t.isFocused,
579
+ onDragStart: h[6] || (h[6] = (V) => n("dragStart", V)),
580
+ onDragOver: h[7] || (h[7] = (V, W) => n("dragOver", V, W)),
581
+ onDragEnd: h[8] || (h[8] = () => n("dragEnd")),
582
+ onDrop: h[9] || (h[9] = () => n("drop")),
583
+ onContextMenu: h[10] || (h[10] = (V, W) => n("contextMenu", V, W)),
584
+ onSelectRange: h[11] || (h[11] = (V) => n("selectRange", V))
585
+ }, null, 8, ["node", "depth", "drag-state", "show-values", "show-counts", "is-focused"]))), 128)) : A("", !0)
586
+ ], 64));
587
+ }
588
+ }), ct = {
589
+ key: 0,
590
+ style: {
591
+ height: "1px",
592
+ backgroundColor: "var(--vj-border, #454545)",
593
+ margin: "4px 0"
594
+ }
595
+ }, vt = ["disabled", "onClick", "onMouseenter"], ft = /* @__PURE__ */ Y({
596
+ __name: "ContextMenu",
597
+ props: {
598
+ x: {},
599
+ y: {},
600
+ items: {}
601
+ },
602
+ emits: ["close"],
603
+ setup(t, { emit: r }) {
604
+ const e = t, n = r, a = M(null), s = M({ left: e.x, top: e.y });
605
+ J(
606
+ () => [e.x, e.y],
607
+ async () => {
608
+ if (await ce(), !a.value) return;
609
+ const d = a.value.getBoundingClientRect(), p = window.innerWidth, f = window.innerHeight;
610
+ s.value = {
611
+ left: d.right > p ? Math.max(0, e.x - d.width) : e.x,
612
+ top: d.bottom > f ? Math.max(0, e.y - d.height) : e.y
613
+ };
614
+ },
615
+ { immediate: !0 }
616
+ );
617
+ function i(d) {
618
+ a.value && !a.value.contains(d.target) && n("close");
619
+ }
620
+ function o(d) {
621
+ d.key === "Escape" && n("close");
622
+ }
623
+ return G(async () => {
624
+ if (await ce(), a.value) {
625
+ const d = a.value.getBoundingClientRect(), p = window.innerWidth, f = window.innerHeight;
626
+ s.value = {
627
+ left: d.right > p ? Math.max(0, e.x - d.width) : e.x,
628
+ top: d.bottom > f ? Math.max(0, e.y - d.height) : e.y
629
+ };
630
+ }
631
+ document.addEventListener("mousedown", i), document.addEventListener("keydown", o);
632
+ }), _(() => {
633
+ document.removeEventListener("mousedown", i), document.removeEventListener("keydown", o);
634
+ }), (d, p) => (g(), X(Ve, { to: "body" }, [
635
+ D("div", {
636
+ ref_key: "menuRef",
637
+ ref: a,
638
+ style: R({
639
+ position: "fixed",
640
+ left: s.value.left + "px",
641
+ top: s.value.top + "px",
642
+ zIndex: 1e4,
643
+ backgroundColor: "var(--vj-bg-panel, #252526)",
644
+ border: "1px solid var(--vj-border, #454545)",
645
+ borderRadius: "4px",
646
+ boxShadow: "0 4px 12px rgba(0,0,0,0.5)",
647
+ padding: "4px 0",
648
+ minWidth: "160px"
649
+ })
650
+ }, [
651
+ (g(!0), x(U, null, te(t.items, (f, y) => (g(), x(U, { key: y }, [
652
+ "separator" in f && f.separator ? (g(), x("div", ct)) : "label" in f ? (g(), x("button", {
653
+ key: 1,
654
+ disabled: f.disabled,
655
+ style: R({
656
+ display: "block",
657
+ width: "100%",
658
+ textAlign: "left",
659
+ background: "none",
660
+ border: "none",
661
+ color: f.disabled ? "var(--vj-text-dimmer, #555555)" : "var(--vj-text, #cccccc)",
662
+ cursor: f.disabled ? "default" : "pointer",
663
+ padding: "4px 16px",
664
+ fontSize: "12px",
665
+ fontFamily: "var(--vj-font, monospace)"
666
+ }),
667
+ onClick: () => {
668
+ f.disabled || (f.action(), n("close"));
669
+ },
670
+ onMouseenter: (C) => {
671
+ f.disabled || (C.target.style.backgroundColor = "var(--vj-accent-muted, #094771)");
672
+ },
673
+ onMouseleave: p[0] || (p[0] = (C) => {
674
+ C.target.style.backgroundColor = "transparent";
675
+ })
676
+ }, F(f.label), 45, vt)) : A("", !0)
677
+ ], 64))), 128))
678
+ ], 4)
679
+ ]));
680
+ }
681
+ }), me = /* @__PURE__ */ Y({
682
+ __name: "TreeView",
683
+ props: {
684
+ class: {},
685
+ showValues: { type: Boolean, default: !0 },
686
+ showCounts: { type: Boolean, default: !1 }
687
+ },
688
+ setup(t) {
689
+ const r = t, { state: e, actions: n } = Z(), a = M(null), s = T(
690
+ () => pe(
691
+ e.tree.value.root,
692
+ (l) => e.expandedNodeIds.value.has(l)
693
+ )
694
+ ), { dragState: i, handleDragStart: o, handleDragOver: d, handleDragEnd: p, handleDrop: f } = Ee(s, e.selectedNodeIds), y = M(null), C = M(!1);
695
+ function E(l) {
696
+ n.setVisibleNodesOverride(s.value), n.selectNodeRange(l);
697
+ }
698
+ J(
699
+ () => e.focusedNodeId.value,
700
+ (l) => {
701
+ if (l && a.value) {
702
+ const v = a.value.querySelector(`[data-node-id="${l}"]`);
703
+ v && v.scrollIntoView({ block: "nearest" });
704
+ }
705
+ }
706
+ );
707
+ function O(l, v) {
708
+ l.preventDefault(), e.selectedNodeIds.value.has(v.id) || n.selectAndDrillDown(v.id), y.value = { x: l.clientX, y: l.clientY, node: v };
709
+ }
710
+ function c(l) {
711
+ const v = [];
712
+ if ((l.type === "object" || l.type === "array") && (v.push({
713
+ label: "Expand all children",
714
+ action: () => {
715
+ function m(h) {
716
+ const $ = [h.id];
717
+ for (const V of h.children) $.push(...m(V));
718
+ return $;
719
+ }
720
+ for (const h of m(l)) n.expandNode(h);
721
+ }
722
+ }), v.push({
723
+ label: "Collapse all children",
724
+ action: () => {
725
+ function m(h) {
726
+ const $ = [];
727
+ for (const V of h.children)
728
+ $.push(V.id), $.push(...m(V));
729
+ return $;
730
+ }
731
+ for (const h of m(l)) n.collapseNode(h);
732
+ }
733
+ }), v.push({ separator: !0 })), v.push({
734
+ label: "Copy path",
735
+ action: () => navigator.clipboard.writeText(l.path).catch(() => {
736
+ })
737
+ }), v.push({
738
+ label: "Copy value as JSON",
739
+ action: () => {
740
+ const m = le(l), h = typeof m == "string" ? m : JSON.stringify(m, null, 2);
741
+ navigator.clipboard.writeText(h).catch(() => {
742
+ });
743
+ }
744
+ }), l.parentId) {
745
+ v.push({ separator: !0 }), v.push({
746
+ label: "Duplicate",
747
+ action: () => {
748
+ const h = Je(e.tree.value, l.id);
749
+ n.setTree(h);
750
+ }
751
+ });
752
+ const m = ["string", "number", "boolean", "null", "object", "array"].filter((h) => h !== l.type).map((h) => ({
753
+ label: `Change to ${h}`,
754
+ action: () => {
755
+ const $ = Ue(e.tree.value, l.id, h);
756
+ n.setTree($);
757
+ }
758
+ }));
759
+ v.push({ separator: !0 }), v.push(...m), v.push({ separator: !0 }), v.push({
760
+ label: "Delete",
761
+ action: () => {
762
+ const { newTree: h, nextFocusId: $ } = ve(
763
+ e.tree.value,
764
+ e.selectedNodeIds.value,
765
+ s.value
766
+ );
767
+ h !== e.tree.value && (n.setTree(h), $ ? n.selectNode($) : n.setSelection(null, /* @__PURE__ */ new Set(), null));
768
+ }
769
+ });
770
+ }
771
+ return v;
772
+ }
773
+ function N(l) {
774
+ const v = s.value.findIndex(
775
+ (k) => k.id === e.focusedNodeId.value
776
+ );
777
+ switch (l.key) {
778
+ case "ArrowDown": {
779
+ l.preventDefault();
780
+ const k = s.value[v + 1];
781
+ k && (l.shiftKey ? E(k.id) : n.selectNode(k.id));
782
+ break;
783
+ }
784
+ case "ArrowUp": {
785
+ l.preventDefault();
786
+ const k = s.value[v - 1];
787
+ k && (l.shiftKey ? E(k.id) : n.selectNode(k.id));
788
+ break;
789
+ }
790
+ case "ArrowRight": {
791
+ l.preventDefault();
792
+ const k = v >= 0 ? s.value[v] : null;
793
+ k && (k.type === "object" || k.type === "array") && (e.expandedNodeIds.value.has(k.id) ? k.children.length > 0 && n.selectNode(k.children[0].id) : n.expandNode(k.id));
794
+ break;
795
+ }
796
+ case "ArrowLeft": {
797
+ l.preventDefault();
798
+ const k = v >= 0 ? s.value[v] : null;
799
+ if (!k) break;
800
+ (k.type === "object" || k.type === "array") && e.expandedNodeIds.value.has(k.id) ? n.collapseNode(k.id) : k.parentId && n.selectNode(k.parentId);
801
+ break;
802
+ }
803
+ case "a": {
804
+ if (l.metaKey || l.ctrlKey) {
805
+ l.preventDefault();
806
+ const k = Me(
807
+ e.tree.value,
808
+ e.focusedNodeId.value,
809
+ e.selectedNodeIds.value
810
+ );
811
+ k && n.setSelection(
812
+ e.focusedNodeId.value,
813
+ k,
814
+ e.focusedNodeId.value
815
+ );
816
+ }
817
+ break;
818
+ }
819
+ case "Escape": {
820
+ l.preventDefault(), e.selectedNodeIds.value.size > 1 && e.focusedNodeId.value ? n.selectNode(e.focusedNodeId.value) : n.setSelection(null, /* @__PURE__ */ new Set(), null);
821
+ break;
822
+ }
823
+ case "Delete":
824
+ case "Backspace": {
825
+ l.preventDefault();
826
+ const { newTree: k, nextFocusId: m } = ve(
827
+ e.tree.value,
828
+ e.selectedNodeIds.value,
829
+ s.value
830
+ );
831
+ if (k === e.tree.value) break;
832
+ n.setTree(k), m ? n.selectNode(m) : n.setSelection(null, /* @__PURE__ */ new Set(), null);
833
+ break;
834
+ }
835
+ }
836
+ }
837
+ return (l, v) => (g(), x(U, null, [
838
+ D("div", {
839
+ ref_key: "containerRef",
840
+ ref: a,
841
+ role: "tree",
842
+ tabindex: "0",
843
+ style: {
844
+ overflow: "auto",
845
+ backgroundColor: "var(--vj-bg, #1e1e1e)",
846
+ color: "var(--vj-text, #cccccc)",
847
+ fontFamily: "var(--vj-font, monospace)",
848
+ fontSize: "13px",
849
+ outline: "none",
850
+ flex: 1
851
+ },
852
+ onKeydown: N,
853
+ onFocus: v[0] || (v[0] = () => C.value = !0),
854
+ onBlur: v[1] || (v[1] = () => C.value = !1)
855
+ }, [
856
+ q(Te, {
857
+ node: b(e).tree.value.root,
858
+ depth: 0,
859
+ "drag-state": b(i),
860
+ "show-values": r.showValues ?? !0,
861
+ "show-counts": r.showCounts ?? !1,
862
+ "is-focused": C.value,
863
+ onDragStart: b(o),
864
+ onDragOver: b(d),
865
+ onDragEnd: b(p),
866
+ onDrop: b(f),
867
+ onContextMenu: O,
868
+ onSelectRange: E
869
+ }, null, 8, ["node", "drag-state", "show-values", "show-counts", "is-focused", "onDragStart", "onDragOver", "onDragEnd", "onDrop"])
870
+ ], 544),
871
+ y.value ? (g(), X(ft, {
872
+ key: 0,
873
+ x: y.value.x,
874
+ y: y.value.y,
875
+ items: c(y.value.node),
876
+ onClose: v[2] || (v[2] = () => y.value = null)
877
+ }, null, 8, ["x", "y", "items"])) : A("", !0)
878
+ ], 64));
879
+ }
880
+ }), $e = Symbol("FormViewContext"), pt = ["value"], ht = ["onMousedown", "onMouseenter"], gt = 20, yt = 200, xt = /* @__PURE__ */ Y({
881
+ __name: "Breadcrumbs",
882
+ props: {
883
+ class: {}
884
+ },
885
+ setup(t) {
886
+ const { state: r, actions: e } = Z(), n = T(
887
+ () => r.drillDownNodeId.value ? r.tree.value.nodesById.get(r.drillDownNodeId.value) : null
888
+ ), a = T(() => {
889
+ var c;
890
+ return ((c = n.value) == null ? void 0 : c.path) ?? "/";
891
+ }), s = M(a.value), i = M(!1), o = M(0), d = M(null), p = M(null), f = M(null);
892
+ J(a, (c) => {
893
+ s.value = c;
894
+ });
895
+ const y = T(() => {
896
+ if (!i.value) return [];
897
+ const c = s.value.toLowerCase(), N = [];
898
+ for (const [l, v] of r.tree.value.nodesById)
899
+ if (v.path.toLowerCase().startsWith(c) && N.push({ id: l, path: v.path }), N.length >= gt) break;
900
+ return N.sort((l, v) => l.path.localeCompare(v.path)), N;
901
+ });
902
+ J(y, () => {
903
+ o.value = 0;
904
+ }), J(
905
+ () => [o.value, i.value],
906
+ ([c, N]) => {
907
+ const l = p.value;
908
+ if (!l || !N) return;
909
+ const v = l.children[c];
910
+ v == null || v.scrollIntoView({ block: "nearest" });
911
+ }
912
+ );
913
+ function C(c) {
914
+ var N;
915
+ for (const [l, v] of r.tree.value.nodesById)
916
+ if (v.path === c) {
917
+ e.selectAndDrillDown(l);
918
+ break;
919
+ }
920
+ i.value = !1, (N = d.value) == null || N.blur();
921
+ }
922
+ function E(c) {
923
+ var N;
924
+ if (!i.value) {
925
+ (c.key === "ArrowDown" || c.key === "Enter") && (i.value = !0, c.preventDefault());
926
+ return;
927
+ }
928
+ switch (c.key) {
929
+ case "ArrowDown":
930
+ c.preventDefault(), o.value = Math.min(
931
+ o.value + 1,
932
+ y.value.length - 1
933
+ );
934
+ break;
935
+ case "ArrowUp":
936
+ c.preventDefault(), o.value = Math.max(o.value - 1, 0);
937
+ break;
938
+ case "Enter":
939
+ c.preventDefault(), y.value.length > 0 && o.value < y.value.length ? C(y.value[o.value].path) : C(s.value.trim() || "/");
940
+ break;
941
+ case "Escape":
942
+ c.preventDefault(), s.value = a.value, i.value = !1, (N = d.value) == null || N.blur();
943
+ break;
944
+ }
945
+ }
946
+ function O(c) {
947
+ f.value && !f.value.contains(c.target) && (s.value = a.value, i.value = !1);
948
+ }
949
+ return G(() => document.addEventListener("mousedown", O)), _(
950
+ () => document.removeEventListener("mousedown", O)
951
+ ), (c, N) => (g(), x("div", {
952
+ ref_key: "wrapperRef",
953
+ ref: f,
954
+ style: { position: "relative", flex: 1, minWidth: 0 }
955
+ }, [
956
+ D("input", {
957
+ ref_key: "inputRef",
958
+ ref: d,
959
+ value: s.value,
960
+ spellcheck: "false",
961
+ autocomplete: "off",
962
+ style: {
963
+ width: "100%",
964
+ boxSizing: "border-box",
965
+ padding: "3px 0",
966
+ fontSize: "var(--vj-input-font-size, 13px)",
967
+ fontFamily: "var(--vj-font, monospace)",
968
+ color: "var(--vj-text-muted, #999999)",
969
+ background: "transparent",
970
+ border: "none",
971
+ outline: "none"
972
+ },
973
+ onInput: N[0] || (N[0] = (l) => {
974
+ s.value = l.target.value, i.value || (i.value = !0);
975
+ }),
976
+ onFocus: N[1] || (N[1] = (l) => {
977
+ l.target.select(), i.value = !0;
978
+ }),
979
+ onKeydown: E
980
+ }, null, 40, pt),
981
+ i.value && y.value.length > 0 ? (g(), x("div", {
982
+ key: 0,
983
+ ref_key: "listRef",
984
+ ref: p,
985
+ style: R({
986
+ position: "absolute",
987
+ top: "100%",
988
+ left: "-12px",
989
+ right: "-12px",
990
+ zIndex: 50,
991
+ maxHeight: yt + "px",
992
+ overflowY: "auto",
993
+ backgroundColor: "var(--vj-bg-panel, #252526)",
994
+ border: "1px solid var(--vj-border, #333333)",
995
+ boxShadow: "0 4px 12px rgba(0,0,0,0.3)"
996
+ })
997
+ }, [
998
+ (g(!0), x(U, null, te(y.value, (l, v) => (g(), x("div", {
999
+ key: l.id,
1000
+ style: R({
1001
+ padding: "4px 12px",
1002
+ fontSize: "13px",
1003
+ fontFamily: "var(--vj-font, monospace)",
1004
+ color: v === o.value ? "var(--vj-text, #cccccc)" : "var(--vj-text-muted, #888888)",
1005
+ backgroundColor: v === o.value ? "var(--vj-bg-hover, #2a2d2e)" : "transparent",
1006
+ cursor: "pointer",
1007
+ whiteSpace: "nowrap",
1008
+ overflow: "hidden",
1009
+ textOverflow: "ellipsis"
1010
+ }),
1011
+ onMousedown: H(() => C(l.path), ["prevent"]),
1012
+ onMouseenter: () => o.value = v
1013
+ }, F(l.path), 45, ht))), 128))
1014
+ ], 4)) : A("", !0)
1015
+ ], 512));
1016
+ }
1017
+ }), mt = ["value"], bt = ["onMousedown", "onMouseenter"], wt = { style: { width: "14px", flexShrink: 0, fontSize: "12px" } }, kt = 200, be = /* @__PURE__ */ Y({
1018
+ __name: "EnumInput",
1019
+ props: /* @__PURE__ */ he({
1020
+ enumValues: {},
1021
+ value: {},
1022
+ inputStyle: {}
1023
+ }, {
1024
+ inputRef: {},
1025
+ inputRefModifiers: {}
1026
+ }),
1027
+ emits: /* @__PURE__ */ he(["valueChange"], ["update:inputRef"]),
1028
+ setup(t, { expose: r, emit: e }) {
1029
+ const n = t, a = e;
1030
+ Fe(t, "inputRef");
1031
+ const s = M(n.value), i = M(!1), o = M(0), d = M(null), p = M(null), f = M(null);
1032
+ J(
1033
+ () => n.value,
1034
+ (c) => {
1035
+ s.value = c;
1036
+ }
1037
+ );
1038
+ const y = T(() => n.enumValues.map((c) => String(c)));
1039
+ J(y, () => {
1040
+ o.value = 0;
1041
+ }), J(
1042
+ () => [o.value, i.value],
1043
+ ([c, N]) => {
1044
+ const l = d.value;
1045
+ if (!l || !N) return;
1046
+ const v = l.children[c];
1047
+ v == null || v.scrollIntoView({ block: "nearest" });
1048
+ }
1049
+ );
1050
+ function C(c) {
1051
+ a("valueChange", c), s.value = c, i.value = !1;
1052
+ }
1053
+ function E(c) {
1054
+ if (!i.value) {
1055
+ (c.key === "ArrowDown" || c.key === "ArrowUp") && (c.preventDefault(), c.stopPropagation(), i.value = !0);
1056
+ return;
1057
+ }
1058
+ switch (c.key) {
1059
+ case "ArrowDown":
1060
+ c.preventDefault(), c.stopPropagation(), o.value = Math.min(
1061
+ o.value + 1,
1062
+ y.value.length - 1
1063
+ );
1064
+ break;
1065
+ case "ArrowUp":
1066
+ c.preventDefault(), c.stopPropagation(), o.value = Math.max(o.value - 1, 0);
1067
+ break;
1068
+ case "Enter":
1069
+ c.preventDefault(), c.stopPropagation(), y.value.length > 0 && o.value < y.value.length && C(y.value[o.value]);
1070
+ break;
1071
+ case "Escape":
1072
+ c.preventDefault(), c.stopPropagation(), s.value = n.value, i.value = !1;
1073
+ break;
1074
+ case "Tab":
1075
+ s.value = n.value, i.value = !1;
1076
+ break;
1077
+ }
1078
+ }
1079
+ function O(c) {
1080
+ p.value && !p.value.contains(c.target) && (s.value = n.value, i.value = !1);
1081
+ }
1082
+ return G(() => document.addEventListener("mousedown", O)), _(
1083
+ () => document.removeEventListener("mousedown", O)
1084
+ ), r({ focus: () => {
1085
+ var c;
1086
+ return (c = f.value) == null ? void 0 : c.focus();
1087
+ } }), (c, N) => (g(), x("div", {
1088
+ ref_key: "wrapperRef",
1089
+ ref: p,
1090
+ style: { position: "relative", flex: 1, minWidth: 0 }
1091
+ }, [
1092
+ D("input", {
1093
+ ref_key: "localInputRef",
1094
+ ref: f,
1095
+ value: s.value,
1096
+ spellcheck: "false",
1097
+ autocomplete: "off",
1098
+ style: R(t.inputStyle),
1099
+ onInput: N[0] || (N[0] = (l) => {
1100
+ s.value = l.target.value, i.value || (i.value = !0);
1101
+ }),
1102
+ onFocus: N[1] || (N[1] = () => i.value = !0),
1103
+ onKeydown: E,
1104
+ onClick: N[2] || (N[2] = H(() => {
1105
+ }, ["stop"]))
1106
+ }, null, 44, mt),
1107
+ i.value && y.value.length > 0 ? (g(), x("div", {
1108
+ key: 0,
1109
+ ref_key: "listRef",
1110
+ ref: d,
1111
+ style: R({
1112
+ position: "absolute",
1113
+ top: "calc(100% + 4px)",
1114
+ left: "-32px",
1115
+ right: 0,
1116
+ zIndex: 50,
1117
+ maxHeight: kt + "px",
1118
+ overflowY: "auto",
1119
+ backgroundColor: "var(--vj-bg-panel, #252526)",
1120
+ border: "1px solid var(--vj-border, #333333)",
1121
+ boxShadow: "0 4px 12px rgba(0,0,0,0.3)"
1122
+ })
1123
+ }, [
1124
+ (g(!0), x(U, null, te(y.value, (l, v) => (g(), x("div", {
1125
+ key: l,
1126
+ style: R({
1127
+ padding: "4px 12px",
1128
+ fontSize: "13px",
1129
+ fontFamily: "var(--vj-font, monospace)",
1130
+ display: "flex",
1131
+ alignItems: "center",
1132
+ gap: "6px",
1133
+ color: v === o.value ? "var(--vj-text, #cccccc)" : "var(--vj-text-muted, #888888)",
1134
+ backgroundColor: v === o.value ? "var(--vj-bg-hover, #2a2d2e)" : "transparent",
1135
+ cursor: "pointer",
1136
+ whiteSpace: "nowrap",
1137
+ overflow: "hidden",
1138
+ textOverflow: "ellipsis"
1139
+ }),
1140
+ onMousedown: H(() => C(l), ["prevent"]),
1141
+ onMouseenter: () => o.value = v
1142
+ }, [
1143
+ D("span", wt, F(l === t.value ? "✓" : ""), 1),
1144
+ Oe(" " + F(l), 1)
1145
+ ], 44, bt))), 128))
1146
+ ], 4)) : A("", !0)
1147
+ ], 512));
1148
+ }
1149
+ }), St = { key: 0 }, jt = ["data-form-node-id", "draggable"], It = ["value"], Dt = {
1150
+ key: 2,
1151
+ style: {
1152
+ color: "var(--vj-text-muted, #888888)",
1153
+ fontSize: "11px",
1154
+ fontFamily: "var(--vj-font, monospace)"
1155
+ }
1156
+ }, Ct = { key: 1 }, Nt = ["data-form-node-id", "draggable"], Mt = ["value"], Et = {
1157
+ key: 2,
1158
+ style: {
1159
+ color: "var(--vj-error, #f48771)",
1160
+ fontSize: "10px",
1161
+ fontFamily: "var(--vj-font, monospace)"
1162
+ }
1163
+ }, Tt = {
1164
+ key: 3,
1165
+ style: {
1166
+ flex: 1,
1167
+ display: "flex",
1168
+ alignItems: "center",
1169
+ gap: "6px",
1170
+ minWidth: 0
1171
+ }
1172
+ }, $t = {
1173
+ key: 2,
1174
+ style: {
1175
+ color: "var(--vj-boolean, #569cd6)",
1176
+ fontFamily: "var(--vj-font, monospace)",
1177
+ fontSize: "var(--vj-input-font-size, 13px)",
1178
+ fontStyle: "italic",
1179
+ flex: 1
1180
+ }
1181
+ }, zt = ["value", "placeholder"], ze = /* @__PURE__ */ Y({
1182
+ __name: "FormField",
1183
+ props: {
1184
+ node: {},
1185
+ depth: {}
1186
+ },
1187
+ setup(t) {
1188
+ const r = t, e = Se($e), { state: n, actions: a } = Z(), s = M(!1), i = M(null), o = M(null);
1189
+ function d() {
1190
+ i.value && typeof i.value.focus == "function" && i.value.focus();
1191
+ }
1192
+ const p = T(
1193
+ () => r.node.type === "object" || r.node.type === "array"
1194
+ ), f = T(() => r.node.parentId === null), y = T(
1195
+ () => n.selectedNodeIds.value.has(r.node.id)
1196
+ ), C = T(() => e.editingNodeId.value === r.node.id), E = T(() => e.collapsedIds.value.has(r.node.id)), O = T(() => {
1197
+ var B;
1198
+ return r.node.parentId ? ((B = n.tree.value.nodesById.get(r.node.parentId)) == null ? void 0 : B.type) === "object" : !1;
1199
+ }), c = T(
1200
+ () => Ce(
1201
+ e.schema.value,
1202
+ e.rootSchema.value,
1203
+ r.node.path
1204
+ )
1205
+ ), N = T(
1206
+ () => at(r.node, e.schema.value, e.rootSchema.value)
1207
+ ), l = T(() => {
1208
+ var B;
1209
+ return (B = c.value) == null ? void 0 : B.description;
1210
+ }), v = T(() => {
1211
+ var B;
1212
+ return (B = c.value) == null ? void 0 : B.deprecated;
1213
+ }), k = T(() => {
1214
+ var B;
1215
+ return (B = c.value) == null ? void 0 : B.title;
1216
+ }), m = T(
1217
+ () => e.dragState.value.dropTargetNodeId === r.node.id
1218
+ ), h = T(
1219
+ () => e.dragState.value.draggedNodeIds.has(r.node.id)
1220
+ );
1221
+ function $() {
1222
+ return m.value && e.dragState.value.dropPosition === "before" ? "var(--vj-accent, #007acc)" : "transparent";
1223
+ }
1224
+ function V() {
1225
+ return m.value && e.dragState.value.dropPosition === "after" ? "var(--vj-accent, #007acc)" : "transparent";
1226
+ }
1227
+ function W() {
1228
+ return y.value ? e.isFocused.value ? "var(--vj-bg-selected, #2a5a1e)" : "var(--vj-bg-selected-muted, var(--vj-bg-hover, #2a2d2e))" : s.value ? "var(--vj-bg-hover, #2a2d2e)" : "transparent";
1229
+ }
1230
+ function Q() {
1231
+ return y.value && e.isFocused.value ? "var(--vj-text-selected, var(--vj-text, #cccccc))" : "var(--vj-text, #cccccc)";
1232
+ }
1233
+ function S() {
1234
+ return nt(r.node);
1235
+ }
1236
+ function z() {
1237
+ return ot(r.node);
1238
+ }
1239
+ function u(B) {
1240
+ B.preventDefault();
1241
+ const w = B.currentTarget.getBoundingClientRect(), ee = w.top + w.height / 2;
1242
+ e.onDragOver(r.node.id, B.clientY < ee ? "before" : "after");
1243
+ }
1244
+ function j(B) {
1245
+ B.dataTransfer.effectAllowed = "move", n.selectedNodeIds.value.size > 1 && n.selectedNodeIds.value.has(r.node.id) && De(B.dataTransfer, n.selectedNodeIds.value.size), e.onDragStart(r.node.id);
1246
+ }
1247
+ function I(B) {
1248
+ var ne;
1249
+ const w = lt(B, (ne = c.value) == null ? void 0 : ne.type, r.node.type), ee = Ye(n.tree.value, r.node.id, w);
1250
+ a.setTree(ee);
1251
+ }
1252
+ function K(B) {
1253
+ const w = qe(n.tree.value, r.node.id, B);
1254
+ a.setTree(w);
1255
+ }
1256
+ function L() {
1257
+ const B = fe(n.tree.value, r.node.id);
1258
+ a.setTree(B);
1259
+ }
1260
+ function ie() {
1261
+ const B = r.node.type === "array" ? String(r.node.children.length) : `newKey${r.node.children.length}`, w = Qe(n.tree.value, r.node.id, B, "");
1262
+ a.setTree(w);
1263
+ }
1264
+ const Re = T(
1265
+ () => {
1266
+ var B;
1267
+ return ((B = c.value) == null ? void 0 : B.enum) && c.value.enum.length > 0;
1268
+ }
1269
+ ), oe = T(
1270
+ () => `calc(${(e.maxDepth.value - r.depth) * 16}px + ${e.maxKeyLength.value}ch)`
1271
+ );
1272
+ return J(C, async (B) => {
1273
+ B && (await ce(), p.value ? o.value && o.value.focus() : r.node.value !== null && r.node.value !== void 0 && r.node.value !== "" && i.value ? d() : o.value && o.value.focus());
1274
+ }), (B, w) => {
1275
+ var ee, ne;
1276
+ return p.value ? (g(), x("div", St, [
1277
+ D("div", {
1278
+ "data-form-node-id": t.node.id,
1279
+ draggable: !f.value,
1280
+ style: R({
1281
+ display: "flex",
1282
+ alignItems: "center",
1283
+ gap: "6px",
1284
+ padding: "1px 8px",
1285
+ paddingLeft: 8 + t.depth * 16 + "px",
1286
+ cursor: "pointer",
1287
+ backgroundColor: W(),
1288
+ color: Q(),
1289
+ height: "28px",
1290
+ boxSizing: "border-box",
1291
+ userSelect: "none",
1292
+ opacity: v.value ? 0.5 : h.value ? 0.4 : 1,
1293
+ borderTop: `2px solid ${$()}`,
1294
+ borderBottom: `2px solid ${V()}`
1295
+ }),
1296
+ onClick: w[3] || (w[3] = H((P) => b(e).onSelect(t.node.id, P), ["stop"])),
1297
+ onDblclick: w[4] || (w[4] = () => b(e).onToggleCollapse(t.node.id)),
1298
+ onMouseenter: w[5] || (w[5] = () => s.value = !0),
1299
+ onMouseleave: w[6] || (w[6] = () => s.value = !1),
1300
+ onDragstart: j,
1301
+ onDragover: u,
1302
+ onDragend: w[7] || (w[7] = () => b(e).onDragEnd()),
1303
+ onDrop: w[8] || (w[8] = H(() => b(e).onDrop(), ["prevent"]))
1304
+ }, [
1305
+ D("button", {
1306
+ style: R({
1307
+ background: "none",
1308
+ border: "none",
1309
+ color: "inherit",
1310
+ cursor: "pointer",
1311
+ padding: 0,
1312
+ width: "16px",
1313
+ fontSize: "9px",
1314
+ flexShrink: 0,
1315
+ display: "inline-flex",
1316
+ alignItems: "center",
1317
+ justifyContent: "center",
1318
+ transition: "transform 0.15s",
1319
+ transform: E.value ? "rotate(0deg)" : "rotate(90deg)"
1320
+ }),
1321
+ onClick: w[0] || (w[0] = H(() => b(e).onToggleCollapse(t.node.id), ["stop"]))
1322
+ }, " ▶ ", 4),
1323
+ C.value && !f.value ? (g(), x("input", {
1324
+ key: 0,
1325
+ ref_key: "keyInputRef",
1326
+ ref: o,
1327
+ value: t.node.key,
1328
+ style: R({
1329
+ background: "none",
1330
+ border: "none",
1331
+ color: "inherit",
1332
+ fontFamily: "var(--vj-font, monospace)",
1333
+ fontSize: "var(--vj-input-font-size, 13px)",
1334
+ fontWeight: 500,
1335
+ padding: 0,
1336
+ outline: "none",
1337
+ flexShrink: 0,
1338
+ width: oe.value
1339
+ }),
1340
+ onInput: w[1] || (w[1] = (P) => K(P.target.value)),
1341
+ onClick: w[2] || (w[2] = H(() => {
1342
+ }, ["stop"]))
1343
+ }, null, 44, It)) : (g(), x("span", {
1344
+ key: 1,
1345
+ style: R({
1346
+ color: !f.value && !O.value && !y.value ? "var(--vj-text-muted, #888888)" : "inherit",
1347
+ fontSize: "var(--vj-input-font-size, 13px)",
1348
+ fontFamily: "var(--vj-font, monospace)",
1349
+ fontWeight: 500,
1350
+ flexShrink: 0,
1351
+ display: "inline-block",
1352
+ width: oe.value
1353
+ })
1354
+ }, F(f.value ? "/" : b(se)(t.node, b(n).tree.value)), 5)),
1355
+ b(e).showDescriptions && k.value && !y.value ? (g(), x("span", Dt, F(k.value), 1)) : A("", !0),
1356
+ s.value ? (g(), x("button", {
1357
+ key: 3,
1358
+ style: R({
1359
+ background: "none",
1360
+ border: "none",
1361
+ color: y.value ? "inherit" : "var(--vj-text-muted, #888888)",
1362
+ cursor: "pointer",
1363
+ padding: 0,
1364
+ fontSize: "12px",
1365
+ fontFamily: "var(--vj-font, monospace)"
1366
+ }),
1367
+ onClick: H(ie, ["stop"])
1368
+ }, " + Add " + F(t.node.type === "array" ? "item" : "property"), 5)) : A("", !0),
1369
+ b(e).showCounts ? (g(), x("span", {
1370
+ key: 4,
1371
+ style: R({
1372
+ color: y.value ? "inherit" : "var(--vj-text-dim, #666666)",
1373
+ fontSize: "12px",
1374
+ fontFamily: "var(--vj-font, monospace)",
1375
+ marginLeft: "auto"
1376
+ })
1377
+ }, F(t.node.type === "array" ? `${t.node.children.length} items` : `${t.node.children.length} properties`), 5)) : A("", !0),
1378
+ !f.value && C.value ? (g(), x("button", {
1379
+ key: 5,
1380
+ style: R({
1381
+ background: "none",
1382
+ border: "none",
1383
+ color: y.value ? "inherit" : "var(--vj-text-muted, #888888)",
1384
+ cursor: "pointer",
1385
+ padding: "2px 4px",
1386
+ fontSize: "14px",
1387
+ fontFamily: "var(--vj-font, monospace)",
1388
+ ...b(e).showCounts ? {} : { marginLeft: "auto" }
1389
+ }),
1390
+ title: "Remove",
1391
+ onClick: H(L, ["stop"])
1392
+ }, " × ", 4)) : A("", !0)
1393
+ ], 44, jt),
1394
+ b(e).showDescriptions && l.value ? (g(), x("div", {
1395
+ key: 0,
1396
+ style: R({
1397
+ padding: "2px 12px 4px",
1398
+ paddingLeft: 8 + t.depth * 16 + 22 + "px",
1399
+ fontSize: "11px",
1400
+ color: "var(--vj-text-dim, #666666)",
1401
+ fontFamily: "var(--vj-font, monospace)"
1402
+ })
1403
+ }, F(l.value), 5)) : A("", !0),
1404
+ E.value ? A("", !0) : (g(), x("div", Ct, [
1405
+ (g(!0), x(U, null, te(t.node.children, (P) => (g(), X(ze, {
1406
+ key: P.id,
1407
+ node: P,
1408
+ depth: t.depth + 1
1409
+ }, null, 8, ["node", "depth"]))), 128))
1410
+ ]))
1411
+ ])) : (g(), x("div", {
1412
+ key: 1,
1413
+ "data-form-node-id": t.node.id,
1414
+ draggable: !f.value,
1415
+ style: R({
1416
+ display: "flex",
1417
+ alignItems: "center",
1418
+ gap: "6px",
1419
+ padding: "1px 8px",
1420
+ paddingLeft: 8 + t.depth * 16 + "px",
1421
+ cursor: "pointer",
1422
+ backgroundColor: W(),
1423
+ color: Q(),
1424
+ height: "28px",
1425
+ boxSizing: "border-box",
1426
+ userSelect: "none",
1427
+ opacity: v.value ? 0.5 : h.value ? 0.4 : 1,
1428
+ borderTop: `2px solid ${$()}`,
1429
+ borderBottom: `2px solid ${V()}`
1430
+ }),
1431
+ onClick: w[14] || (w[14] = H((P) => b(e).onSelect(t.node.id, P), ["stop"])),
1432
+ onDblclick: w[15] || (w[15] = () => b(e).onStartEditing(t.node.id)),
1433
+ onMouseenter: w[16] || (w[16] = () => s.value = !0),
1434
+ onMouseleave: w[17] || (w[17] = () => s.value = !1),
1435
+ onDragstart: j,
1436
+ onDragover: u,
1437
+ onDragend: w[18] || (w[18] = () => b(e).onDragEnd()),
1438
+ onDrop: w[19] || (w[19] = H(() => b(e).onDrop(), ["prevent"]))
1439
+ }, [
1440
+ w[20] || (w[20] = D("span", { style: { width: "16px", flexShrink: 0 } }, null, -1)),
1441
+ C.value && O.value ? (g(), x("input", {
1442
+ key: 0,
1443
+ ref_key: "keyInputRef",
1444
+ ref: o,
1445
+ value: t.node.key,
1446
+ style: R({
1447
+ background: "none",
1448
+ border: "none",
1449
+ color: "inherit",
1450
+ fontFamily: "var(--vj-font, monospace)",
1451
+ fontSize: "var(--vj-input-font-size, 13px)",
1452
+ padding: 0,
1453
+ flexShrink: 0,
1454
+ outline: "none",
1455
+ width: oe.value
1456
+ }),
1457
+ onInput: w[9] || (w[9] = (P) => K(P.target.value)),
1458
+ onClick: w[10] || (w[10] = H(() => {
1459
+ }, ["stop"])),
1460
+ onKeydown: w[11] || (w[11] = (P) => {
1461
+ P.key === "Tab" && !P.shiftKey && i.value && (P.preventDefault(), d());
1462
+ })
1463
+ }, null, 44, Mt)) : (g(), x("span", {
1464
+ key: 1,
1465
+ style: R({
1466
+ color: !O.value && !y.value ? "var(--vj-text-muted, #888888)" : "inherit",
1467
+ fontSize: "var(--vj-input-font-size, 13px)",
1468
+ fontFamily: "var(--vj-font, monospace)",
1469
+ flexShrink: 0,
1470
+ display: "inline-block",
1471
+ width: oe.value
1472
+ })
1473
+ }, F(b(se)(t.node, b(n).tree.value)), 5)),
1474
+ N.value && !y.value ? (g(), x("span", Et, " * ")) : A("", !0),
1475
+ C.value ? (g(), x("div", Tt, [
1476
+ t.node.type === "boolean" ? (g(), X(be, {
1477
+ key: 0,
1478
+ ref_key: "valueInputRef",
1479
+ ref: i,
1480
+ "enum-values": ["true", "false"],
1481
+ value: String(t.node.value),
1482
+ "input-style": {
1483
+ background: "none",
1484
+ border: "none",
1485
+ fontFamily: "var(--vj-font, monospace)",
1486
+ fontSize: "var(--vj-input-font-size, 13px)",
1487
+ padding: "0",
1488
+ flex: "1",
1489
+ outline: "none",
1490
+ color: S()
1491
+ },
1492
+ onValueChange: I
1493
+ }, null, 8, ["value", "input-style"])) : Re.value && ((ee = c.value) != null && ee.enum) ? (g(), X(be, {
1494
+ key: 1,
1495
+ ref_key: "valueInputRef",
1496
+ ref: i,
1497
+ "enum-values": c.value.enum,
1498
+ value: z(),
1499
+ "input-style": {
1500
+ background: "none",
1501
+ border: "none",
1502
+ fontFamily: "var(--vj-font, monospace)",
1503
+ fontSize: "var(--vj-input-font-size, 13px)",
1504
+ padding: "0",
1505
+ flex: "1",
1506
+ outline: "none",
1507
+ color: S()
1508
+ },
1509
+ onValueChange: I
1510
+ }, null, 8, ["enum-values", "value", "input-style"])) : t.node.type === "null" ? (g(), x("span", $t, " null ")) : (g(), x("input", {
1511
+ key: 3,
1512
+ ref_key: "valueInputRef",
1513
+ ref: i,
1514
+ value: z(),
1515
+ placeholder: ((ne = c.value) == null ? void 0 : ne.default) !== void 0 ? String(c.value.default) : "<value>",
1516
+ style: R({
1517
+ background: "none",
1518
+ border: "none",
1519
+ fontFamily: "var(--vj-font, monospace)",
1520
+ fontSize: "var(--vj-input-font-size, 13px)",
1521
+ padding: 0,
1522
+ flex: 1,
1523
+ outline: "none",
1524
+ color: S()
1525
+ }),
1526
+ onInput: w[12] || (w[12] = (P) => I(P.target.value)),
1527
+ onClick: w[13] || (w[13] = H(() => {
1528
+ }, ["stop"]))
1529
+ }, null, 44, zt))
1530
+ ])) : (g(), x("span", {
1531
+ key: 4,
1532
+ style: R({
1533
+ color: S(),
1534
+ fontSize: "var(--vj-input-font-size, 13px)",
1535
+ fontFamily: "var(--vj-font, monospace)",
1536
+ overflow: "hidden",
1537
+ textOverflow: "ellipsis",
1538
+ whiteSpace: "nowrap",
1539
+ fontStyle: t.node.type === "null" ? "italic" : void 0
1540
+ })
1541
+ }, F(z()), 5)),
1542
+ C.value ? (g(), x("button", {
1543
+ key: 5,
1544
+ style: R({
1545
+ background: "none",
1546
+ border: "none",
1547
+ color: y.value ? "inherit" : "var(--vj-text-muted, #888888)",
1548
+ cursor: "pointer",
1549
+ padding: "2px 4px",
1550
+ fontSize: "14px",
1551
+ fontFamily: "var(--vj-font, monospace)",
1552
+ flexShrink: 0
1553
+ }),
1554
+ title: "Remove",
1555
+ onClick: H(L, ["stop"])
1556
+ }, " × ", 4)) : A("", !0)
1557
+ ], 44, Nt));
1558
+ };
1559
+ }
1560
+ }), Rt = { style: {
1561
+ backgroundColor: "var(--vj-bg, #1e1e1e)",
1562
+ color: "var(--vj-text, #cccccc)",
1563
+ height: "100%",
1564
+ fontFamily: "var(--vj-font, monospace)",
1565
+ display: "flex",
1566
+ flexDirection: "column"
1567
+ } }, Bt = { style: {
1568
+ display: "flex",
1569
+ alignItems: "center",
1570
+ padding: "4px 8px",
1571
+ borderBottom: "1px solid var(--vj-border, #333333)",
1572
+ backgroundColor: "var(--vj-bg, #1e1e1e)",
1573
+ flexShrink: 0
1574
+ } }, de = /* @__PURE__ */ Y({
1575
+ __name: "FormView",
1576
+ props: {
1577
+ class: {},
1578
+ showDescriptions: { type: Boolean, default: !1 },
1579
+ showCounts: { type: Boolean, default: !1 }
1580
+ },
1581
+ setup(t) {
1582
+ const r = t, { state: e, actions: n } = Z(), a = M(null), s = M(!1), i = M(null), o = M(/* @__PURE__ */ new Set());
1583
+ let d = e.tree.value;
1584
+ const p = T(() => (e.drillDownNodeId.value ? e.tree.value.nodesById.get(e.drillDownNodeId.value) : null) ?? e.tree.value.root);
1585
+ J(
1586
+ () => p.value.id,
1587
+ () => {
1588
+ i.value = null, o.value = /* @__PURE__ */ new Set();
1589
+ }
1590
+ );
1591
+ const f = T(
1592
+ () => pe(p.value, (S) => !o.value.has(S))
1593
+ ), { dragState: y, handleDragStart: C, handleDragOver: E, handleDragEnd: O, handleDrop: c } = Ee(f, e.selectedNodeIds);
1594
+ G(() => {
1595
+ n.setVisibleNodesOverride(f.value);
1596
+ }), _(() => {
1597
+ n.setVisibleNodesOverride(null);
1598
+ }), J(f, (S) => {
1599
+ n.setVisibleNodesOverride(S);
1600
+ });
1601
+ const N = T(() => {
1602
+ let S = 1, z = 0;
1603
+ const u = p.value.path === "/" ? 0 : p.value.path.split("/").filter(Boolean).length;
1604
+ for (const j of f.value) {
1605
+ const I = j.parentId === null ? "/" : se(j, e.tree.value);
1606
+ I.length > S && (S = I.length);
1607
+ const L = (j.path === "/" ? 0 : j.path.split("/").filter(Boolean).length) - u;
1608
+ L > z && (z = L);
1609
+ }
1610
+ return { maxKeyLength: S, maxDepth: z };
1611
+ }), l = T(() => N.value.maxKeyLength), v = T(() => N.value.maxDepth), k = T(() => e.schema.value), m = T(
1612
+ () => e.schema.value ?? void 0
1613
+ );
1614
+ function h(S, z) {
1615
+ i.value = null, z.shiftKey ? (n.setVisibleNodesOverride(f.value), n.selectNodeRange(S)) : z.metaKey || z.ctrlKey ? n.toggleNodeSelection(S) : n.selectNode(S);
1616
+ }
1617
+ function $(S) {
1618
+ const z = new Set(o.value);
1619
+ z.has(S) ? z.delete(S) : z.add(S), o.value = z;
1620
+ }
1621
+ function V(S) {
1622
+ d = e.tree.value, i.value = S;
1623
+ }
1624
+ function W(S) {
1625
+ requestAnimationFrame(() => {
1626
+ var u;
1627
+ const z = (u = a.value) == null ? void 0 : u.querySelector(
1628
+ `[data-form-node-id="${S}"]`
1629
+ );
1630
+ z == null || z.scrollIntoView({ block: "nearest" });
1631
+ });
1632
+ }
1633
+ function Q(S) {
1634
+ var u, j;
1635
+ if (i.value) {
1636
+ S.key === "Escape" ? (S.preventDefault(), S.stopPropagation(), n.setTree(d), i.value = null, (u = a.value) == null || u.focus()) : S.key === "Enter" && (S.preventDefault(), S.stopPropagation(), i.value = null, (j = a.value) == null || j.focus());
1637
+ return;
1638
+ }
1639
+ let z = f.value.findIndex(
1640
+ (I) => I.id === e.focusedNodeId.value
1641
+ );
1642
+ switch (z === -1 && f.value.length > 0 && (z = 0), S.key) {
1643
+ case "ArrowDown": {
1644
+ S.preventDefault();
1645
+ const I = f.value[z + 1];
1646
+ I && (S.shiftKey ? (n.setVisibleNodesOverride(f.value), n.selectNodeRange(I.id)) : n.selectNode(I.id), W(I.id));
1647
+ break;
1648
+ }
1649
+ case "ArrowUp": {
1650
+ S.preventDefault();
1651
+ const I = f.value[z - 1];
1652
+ I && (S.shiftKey ? (n.setVisibleNodesOverride(f.value), n.selectNodeRange(I.id)) : n.selectNode(I.id), W(I.id));
1653
+ break;
1654
+ }
1655
+ case "ArrowRight": {
1656
+ S.preventDefault();
1657
+ const I = z >= 0 ? f.value[z] : null;
1658
+ if (I && (I.type === "object" || I.type === "array"))
1659
+ if (o.value.has(I.id)) {
1660
+ const K = new Set(o.value);
1661
+ K.delete(I.id), o.value = K;
1662
+ } else I.children.length > 0 && (n.selectNode(I.children[0].id), W(I.children[0].id));
1663
+ break;
1664
+ }
1665
+ case "ArrowLeft": {
1666
+ S.preventDefault();
1667
+ const I = z >= 0 ? f.value[z] : null;
1668
+ if (!I) break;
1669
+ if ((I.type === "object" || I.type === "array") && !o.value.has(I.id)) {
1670
+ const L = new Set(o.value);
1671
+ L.add(I.id), o.value = L;
1672
+ } else if (I.parentId) {
1673
+ const L = f.value.find(
1674
+ (ie) => ie.id === I.parentId
1675
+ );
1676
+ L && (n.selectNode(L.id), W(L.id));
1677
+ }
1678
+ break;
1679
+ }
1680
+ case "Enter": {
1681
+ S.preventDefault(), e.focusedNodeId.value && (d = e.tree.value, n.selectNode(e.focusedNodeId.value), i.value = e.focusedNodeId.value);
1682
+ break;
1683
+ }
1684
+ case "a": {
1685
+ if (S.metaKey || S.ctrlKey) {
1686
+ S.preventDefault();
1687
+ const I = Me(
1688
+ e.tree.value,
1689
+ e.focusedNodeId.value,
1690
+ e.selectedNodeIds.value
1691
+ );
1692
+ I && n.setSelection(
1693
+ e.focusedNodeId.value,
1694
+ I,
1695
+ e.focusedNodeId.value
1696
+ );
1697
+ }
1698
+ break;
1699
+ }
1700
+ case "Escape": {
1701
+ S.preventDefault(), e.selectedNodeIds.value.size > 1 && e.focusedNodeId.value ? n.selectNode(e.focusedNodeId.value) : n.setSelection(null, /* @__PURE__ */ new Set(), null);
1702
+ break;
1703
+ }
1704
+ case "Delete":
1705
+ case "Backspace": {
1706
+ S.preventDefault();
1707
+ const { newTree: I, nextFocusId: K } = ve(
1708
+ e.tree.value,
1709
+ e.selectedNodeIds.value,
1710
+ f.value
1711
+ );
1712
+ if (I === e.tree.value) break;
1713
+ n.setTree(I), K ? n.selectNode(K) : n.setSelection(null, /* @__PURE__ */ new Set(), null);
1714
+ break;
1715
+ }
1716
+ }
1717
+ }
1718
+ return ke($e, {
1719
+ schema: k,
1720
+ rootSchema: m,
1721
+ showDescriptions: r.showDescriptions,
1722
+ showCounts: r.showCounts,
1723
+ editingNodeId: i,
1724
+ collapsedIds: o,
1725
+ maxKeyLength: l,
1726
+ maxDepth: v,
1727
+ isFocused: s,
1728
+ dragState: y,
1729
+ onSelect: h,
1730
+ onToggleCollapse: $,
1731
+ onStartEditing: V,
1732
+ onDragStart: C,
1733
+ onDragOver: E,
1734
+ onDragEnd: O,
1735
+ onDrop: c
1736
+ }), (S, z) => (g(), x("div", Rt, [
1737
+ D("div", Bt, [
1738
+ q(xt)
1739
+ ]),
1740
+ D("div", {
1741
+ ref_key: "containerRef",
1742
+ ref: a,
1743
+ "data-form-container": "",
1744
+ tabindex: "0",
1745
+ style: {
1746
+ flex: 1,
1747
+ overflow: "auto",
1748
+ outline: "none"
1749
+ },
1750
+ onKeydown: Q,
1751
+ onFocus: z[0] || (z[0] = () => s.value = !0),
1752
+ onBlur: z[1] || (z[1] = (u) => {
1753
+ u.currentTarget.contains(u.relatedTarget) || (s.value = !1);
1754
+ })
1755
+ }, [
1756
+ q(ze, {
1757
+ node: p.value,
1758
+ depth: 0
1759
+ }, null, 8, ["node"])
1760
+ ], 544)
1761
+ ]));
1762
+ }
1763
+ }), Vt = { style: {
1764
+ display: "flex",
1765
+ alignItems: "center",
1766
+ gap: "6px",
1767
+ padding: "4px 8px",
1768
+ backgroundColor: "var(--vj-bg, #1e1e1e)",
1769
+ borderBottom: "1px solid var(--vj-border, #333333)"
1770
+ } }, Ft = ["value"], Ot = { style: {
1771
+ display: "flex",
1772
+ alignItems: "center",
1773
+ gap: "2px",
1774
+ flexShrink: 0,
1775
+ height: "18px"
1776
+ } }, At = ["disabled"], Kt = ["disabled"], we = /* @__PURE__ */ Y({
1777
+ __name: "SearchBar",
1778
+ props: {
1779
+ class: {}
1780
+ },
1781
+ setup(t) {
1782
+ const { state: r, actions: e } = Z(), n = M(null);
1783
+ function a(i) {
1784
+ var o;
1785
+ i.key === "Enter" && (i.preventDefault(), i.shiftKey ? e.prevSearchMatch() : e.nextSearchMatch()), i.key === "Escape" && (i.preventDefault(), e.setSearchQuery(""), (o = n.value) == null || o.blur());
1786
+ }
1787
+ function s(i) {
1788
+ var d, p;
1789
+ (i.metaKey || i.ctrlKey) && i.key === "f" && (i.preventDefault(), (d = n.value) == null || d.focus(), (p = n.value) == null || p.select());
1790
+ }
1791
+ return G(() => document.addEventListener("keydown", s)), _(() => document.removeEventListener("keydown", s)), (i, o) => (g(), x("div", Vt, [
1792
+ D("input", {
1793
+ ref_key: "inputRef",
1794
+ ref: n,
1795
+ type: "text",
1796
+ value: b(r).searchQuery.value,
1797
+ placeholder: "Search...",
1798
+ spellcheck: "false",
1799
+ autocomplete: "off",
1800
+ style: {
1801
+ flex: 1,
1802
+ background: "none",
1803
+ border: "none",
1804
+ borderRadius: "3px",
1805
+ color: "var(--vj-text, #cccccc)",
1806
+ fontFamily: "var(--vj-font, monospace)",
1807
+ fontSize: "var(--vj-input-font-size, 13px)",
1808
+ padding: "3px 8px",
1809
+ outline: "none",
1810
+ minWidth: 0
1811
+ },
1812
+ onInput: o[0] || (o[0] = (d) => b(e).setSearchQuery(d.target.value)),
1813
+ onKeydown: a
1814
+ }, null, 40, Ft),
1815
+ D("div", Ot, [
1816
+ b(r).searchQuery.value ? (g(), x(U, { key: 0 }, [
1817
+ D("span", {
1818
+ style: R({
1819
+ fontSize: "11px",
1820
+ lineHeight: 1,
1821
+ color: b(r).searchMatches.value.length > 0 ? "var(--vj-text-muted, #999999)" : "var(--vj-error, #f48771)",
1822
+ fontFamily: "var(--vj-font, monospace)",
1823
+ whiteSpace: "nowrap"
1824
+ })
1825
+ }, F(b(r).searchMatches.value.length > 0 ? `${b(r).searchMatchIndex.value + 1}/${b(r).searchMatches.value.length}` : "0/0"), 5),
1826
+ D("button", {
1827
+ disabled: b(r).searchMatches.value.length === 0,
1828
+ "aria-label": "Previous match (Shift+Enter)",
1829
+ title: "Previous match (Shift+Enter)",
1830
+ style: R({
1831
+ background: "none",
1832
+ border: "none",
1833
+ color: b(r).searchMatches.value.length > 0 ? "var(--vj-text, #cccccc)" : "var(--vj-text-dimmer, #555555)",
1834
+ cursor: b(r).searchMatches.value.length > 0 ? "pointer" : "default",
1835
+ padding: 0,
1836
+ fontSize: "10px",
1837
+ lineHeight: 1,
1838
+ display: "inline-flex",
1839
+ alignItems: "center",
1840
+ justifyContent: "center",
1841
+ width: "18px",
1842
+ height: "18px"
1843
+ }),
1844
+ onClick: o[1] || (o[1] = //@ts-ignore
1845
+ (...d) => b(e).prevSearchMatch && b(e).prevSearchMatch(...d))
1846
+ }, " ▲ ", 12, At),
1847
+ D("button", {
1848
+ disabled: b(r).searchMatches.value.length === 0,
1849
+ "aria-label": "Next match (Enter)",
1850
+ title: "Next match (Enter)",
1851
+ style: R({
1852
+ background: "none",
1853
+ border: "none",
1854
+ color: b(r).searchMatches.value.length > 0 ? "var(--vj-text, #cccccc)" : "var(--vj-text-dimmer, #555555)",
1855
+ cursor: b(r).searchMatches.value.length > 0 ? "pointer" : "default",
1856
+ padding: 0,
1857
+ fontSize: "10px",
1858
+ lineHeight: 1,
1859
+ display: "inline-flex",
1860
+ alignItems: "center",
1861
+ justifyContent: "center",
1862
+ width: "18px",
1863
+ height: "18px"
1864
+ }),
1865
+ onClick: o[2] || (o[2] = //@ts-ignore
1866
+ (...d) => b(e).nextSearchMatch && b(e).nextSearchMatch(...d))
1867
+ }, " ▼ ", 12, Kt),
1868
+ D("button", {
1869
+ "aria-label": "Clear search (Esc)",
1870
+ title: "Clear search (Esc)",
1871
+ style: {
1872
+ background: "none",
1873
+ border: "none",
1874
+ color: "var(--vj-text, #cccccc)",
1875
+ cursor: "pointer",
1876
+ padding: 0,
1877
+ fontSize: "14px",
1878
+ lineHeight: 1,
1879
+ display: "inline-flex",
1880
+ alignItems: "center",
1881
+ justifyContent: "center",
1882
+ width: "18px",
1883
+ height: "18px"
1884
+ },
1885
+ onClick: o[3] || (o[3] = () => b(e).setSearchQuery(""))
1886
+ }, " × ")
1887
+ ], 64)) : (g(), x(U, { key: 1 }, [
1888
+ D("button", {
1889
+ "aria-label": "Expand all",
1890
+ title: "Expand all",
1891
+ style: {
1892
+ background: "none",
1893
+ border: "none",
1894
+ color: "var(--vj-text-muted, #888888)",
1895
+ cursor: "pointer",
1896
+ padding: "2px",
1897
+ fontSize: "12px",
1898
+ lineHeight: 1,
1899
+ display: "inline-flex",
1900
+ alignItems: "center"
1901
+ },
1902
+ onClick: o[4] || (o[4] = //@ts-ignore
1903
+ (...d) => b(e).expandAll && b(e).expandAll(...d))
1904
+ }, [...o[6] || (o[6] = [
1905
+ D("svg", {
1906
+ width: "14",
1907
+ height: "14",
1908
+ viewBox: "0 0 16 16",
1909
+ fill: "none",
1910
+ stroke: "currentColor",
1911
+ "stroke-width": "1.5",
1912
+ "stroke-linecap": "round",
1913
+ "stroke-linejoin": "round"
1914
+ }, [
1915
+ D("path", { d: "M8 2v4M5 4l3-2 3 2" }),
1916
+ D("path", { d: "M8 14v-4M5 12l3 2 3-2" }),
1917
+ D("path", { d: "M2 8h12" })
1918
+ ], -1)
1919
+ ])]),
1920
+ D("button", {
1921
+ "aria-label": "Collapse all",
1922
+ title: "Collapse all",
1923
+ style: {
1924
+ background: "none",
1925
+ border: "none",
1926
+ color: "var(--vj-text-muted, #888888)",
1927
+ cursor: "pointer",
1928
+ padding: "2px",
1929
+ fontSize: "12px",
1930
+ lineHeight: 1,
1931
+ display: "inline-flex",
1932
+ alignItems: "center"
1933
+ },
1934
+ onClick: o[5] || (o[5] = //@ts-ignore
1935
+ (...d) => b(e).collapseAll && b(e).collapseAll(...d))
1936
+ }, [...o[7] || (o[7] = [
1937
+ D("svg", {
1938
+ width: "14",
1939
+ height: "14",
1940
+ viewBox: "0 0 16 16",
1941
+ fill: "none",
1942
+ stroke: "currentColor",
1943
+ "stroke-width": "1.5",
1944
+ "stroke-linecap": "round",
1945
+ "stroke-linejoin": "round"
1946
+ }, [
1947
+ D("path", { d: "M8 5V1M5 3l3 2 3-2" }),
1948
+ D("path", { d: "M8 11v4M5 13l3-2 3 2" }),
1949
+ D("path", { d: "M2 8h12" })
1950
+ ], -1)
1951
+ ])])
1952
+ ], 64))
1953
+ ])
1954
+ ]));
1955
+ }
1956
+ }), Lt = {
1957
+ key: 0,
1958
+ style: { flex: 1, minHeight: 0 }
1959
+ }, Pt = { style: {
1960
+ display: "flex",
1961
+ flexShrink: 0,
1962
+ borderBottom: "1px solid var(--vj-border, #333333)",
1963
+ backgroundColor: "var(--vj-bg-panel, #252526)"
1964
+ } }, Ht = { style: { flex: 1, minHeight: 0, overflow: "hidden" } }, Wt = {
1965
+ key: 0,
1966
+ style: {
1967
+ display: "flex",
1968
+ flexDirection: "column",
1969
+ height: "100%"
1970
+ }
1971
+ }, Jt = { style: { flex: 1, minHeight: 0, overflow: "auto" } }, Ut = {
1972
+ key: 1,
1973
+ style: {
1974
+ display: "flex",
1975
+ flexDirection: "column",
1976
+ height: "100%"
1977
+ }
1978
+ }, Yt = { style: { flex: 1, minHeight: 0 } }, qt = { style: { flex: 1, minHeight: 0, overflow: "auto" } }, Qt = {
1979
+ key: 0,
1980
+ style: {
1981
+ width: "1px",
1982
+ flexShrink: 0,
1983
+ backgroundColor: "var(--vj-border, #333333)",
1984
+ position: "relative",
1985
+ transition: "background-color 0.15s"
1986
+ }
1987
+ }, Xt = { style: {
1988
+ display: "flex",
1989
+ flexDirection: "column",
1990
+ flex: 1,
1991
+ minWidth: 0,
1992
+ overflow: "hidden"
1993
+ } }, Gt = { style: { flex: 1, minHeight: 0 } }, hn = /* @__PURE__ */ Y({
1994
+ __name: "JsonEditor",
1995
+ props: {
1996
+ value: { type: [String, Number, Boolean, null, Array, Object] },
1997
+ defaultValue: { type: [String, Number, Boolean, null, Array, Object] },
1998
+ onChange: {},
1999
+ schema: { default: null },
2000
+ height: { default: "100%" },
2001
+ width: { default: "100%" },
2002
+ class: {},
2003
+ style: {},
2004
+ readOnly: { type: Boolean, default: !1 },
2005
+ treeShowValues: { type: Boolean, default: !0 },
2006
+ treeShowCounts: { type: Boolean, default: !1 },
2007
+ editorShowDescriptions: { type: Boolean, default: !1 },
2008
+ editorShowCounts: { type: Boolean, default: !1 },
2009
+ sidebarOpen: { type: Boolean, default: !0 }
2010
+ },
2011
+ emits: ["change"],
2012
+ setup(t, { emit: r }) {
2013
+ const e = t, n = r, a = e.value !== void 0, s = M(
2014
+ a ? e.value : e.defaultValue ?? {}
2015
+ ), i = M(0);
2016
+ J(
2017
+ () => e.value,
2018
+ (k) => {
2019
+ a && k !== s.value && (s.value = k, i.value++);
2020
+ }
2021
+ );
2022
+ function o(k) {
2023
+ var m;
2024
+ s.value = k, e.readOnly || (n("change", k), (m = e.onChange) == null || m.call(e, k));
2025
+ }
2026
+ const d = M(280), p = M(!1), f = M("tree"), y = M(null);
2027
+ let C = !1, E = 0, O = 0, c = null;
2028
+ function N() {
2029
+ y.value && (p.value = y.value.offsetWidth < 500);
2030
+ }
2031
+ G(() => {
2032
+ N(), y.value && (c = new ResizeObserver(N), c.observe(y.value));
2033
+ }), _(() => {
2034
+ c == null || c.disconnect();
2035
+ });
2036
+ function l(k) {
2037
+ C = !0, E = k.clientX, O = d.value, document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
2038
+ function m($) {
2039
+ if (!C) return;
2040
+ const V = $.clientX - E;
2041
+ d.value = Math.max(180, Math.min(600, O + V));
2042
+ }
2043
+ function h() {
2044
+ C = !1, document.body.style.cursor = "", document.body.style.userSelect = "", document.removeEventListener("mousemove", m), document.removeEventListener("mouseup", h);
2045
+ }
2046
+ document.addEventListener("mousemove", m), document.addEventListener("mouseup", h);
2047
+ }
2048
+ const v = T(() => ({
2049
+ height: typeof e.height == "number" ? `${e.height}px` : e.height,
2050
+ width: typeof e.width == "number" ? `${e.width}px` : e.width,
2051
+ display: "flex",
2052
+ flexDirection: "column",
2053
+ overflow: "hidden",
2054
+ ...re,
2055
+ ...e.style ?? {}
2056
+ }));
2057
+ return (k, m) => (g(), x("div", {
2058
+ "data-vj-root": "",
2059
+ style: R(v.value)
2060
+ }, [
2061
+ (g(), X(st, {
2062
+ key: i.value,
2063
+ value: s.value,
2064
+ schema: e.schema,
2065
+ onChange: o
2066
+ }, {
2067
+ default: Ae(() => [
2068
+ p.value ? (g(), x("div", {
2069
+ key: 0,
2070
+ ref_key: "containerRef",
2071
+ ref: y,
2072
+ style: {
2073
+ display: "flex",
2074
+ flexDirection: "column",
2075
+ flex: 1,
2076
+ minHeight: 0
2077
+ }
2078
+ }, [
2079
+ e.sidebarOpen ? (g(), x(U, { key: 1 }, [
2080
+ D("div", Pt, [
2081
+ D("button", {
2082
+ style: R({
2083
+ flex: 1,
2084
+ fontSize: "11px",
2085
+ padding: "4px 0",
2086
+ cursor: "pointer",
2087
+ fontFamily: "var(--vj-font, monospace)",
2088
+ border: "none",
2089
+ background: f.value === "tree" ? "var(--vj-accent-muted, #094771)" : "transparent",
2090
+ color: f.value === "tree" ? "var(--vj-text, #cccccc)" : "var(--vj-text-muted, #999999)"
2091
+ }),
2092
+ onClick: m[0] || (m[0] = () => f.value = "tree")
2093
+ }, " Tree ", 4),
2094
+ D("button", {
2095
+ style: R({
2096
+ flex: 1,
2097
+ fontSize: "11px",
2098
+ padding: "4px 0",
2099
+ cursor: "pointer",
2100
+ fontFamily: "var(--vj-font, monospace)",
2101
+ border: "none",
2102
+ background: f.value === "form" ? "var(--vj-accent-muted, #094771)" : "transparent",
2103
+ color: f.value === "form" ? "var(--vj-text, #cccccc)" : "var(--vj-text-muted, #999999)"
2104
+ }),
2105
+ onClick: m[1] || (m[1] = () => f.value = "form")
2106
+ }, " Form ", 4)
2107
+ ]),
2108
+ D("div", Ht, [
2109
+ f.value === "tree" ? (g(), x("div", Wt, [
2110
+ q(we),
2111
+ D("div", Jt, [
2112
+ q(me, {
2113
+ "show-values": e.treeShowValues,
2114
+ "show-counts": e.treeShowCounts
2115
+ }, null, 8, ["show-values", "show-counts"])
2116
+ ])
2117
+ ])) : (g(), x("div", Ut, [
2118
+ D("div", Yt, [
2119
+ q(de, {
2120
+ "show-descriptions": e.editorShowDescriptions,
2121
+ "show-counts": e.editorShowCounts
2122
+ }, null, 8, ["show-descriptions", "show-counts"])
2123
+ ])
2124
+ ]))
2125
+ ])
2126
+ ], 64)) : (g(), x("div", Lt, [
2127
+ q(de, {
2128
+ "show-descriptions": e.editorShowDescriptions,
2129
+ "show-counts": e.editorShowCounts
2130
+ }, null, 8, ["show-descriptions", "show-counts"])
2131
+ ]))
2132
+ ], 512)) : (g(), x("div", {
2133
+ key: 1,
2134
+ ref_key: "containerRef",
2135
+ ref: y,
2136
+ style: { display: "flex", flex: 1, minHeight: 0 }
2137
+ }, [
2138
+ D("div", {
2139
+ style: R({
2140
+ flexShrink: 0,
2141
+ overflow: "hidden",
2142
+ display: "flex",
2143
+ flexDirection: "column",
2144
+ width: e.sidebarOpen ? d.value + "px" : "0",
2145
+ transition: "width 0.2s ease"
2146
+ })
2147
+ }, [
2148
+ q(we),
2149
+ D("div", qt, [
2150
+ q(me, {
2151
+ "show-values": e.treeShowValues,
2152
+ "show-counts": e.treeShowCounts
2153
+ }, null, 8, ["show-values", "show-counts"])
2154
+ ])
2155
+ ], 4),
2156
+ e.sidebarOpen ? (g(), x("div", Qt, [
2157
+ D("div", {
2158
+ style: {
2159
+ position: "absolute",
2160
+ top: 0,
2161
+ bottom: 0,
2162
+ left: "-3px",
2163
+ width: "7px",
2164
+ cursor: "col-resize",
2165
+ zIndex: 10
2166
+ },
2167
+ onMousedown: l,
2168
+ onMouseenter: m[2] || (m[2] = (h) => {
2169
+ const $ = h.currentTarget.parentElement;
2170
+ $ && ($.style.backgroundColor = "var(--vj-accent, #007acc)");
2171
+ }),
2172
+ onMouseleave: m[3] || (m[3] = (h) => {
2173
+ if (!b(C)) {
2174
+ const $ = h.currentTarget.parentElement;
2175
+ $ && ($.style.backgroundColor = "var(--vj-border, #333333)");
2176
+ }
2177
+ })
2178
+ }, null, 32)
2179
+ ])) : A("", !0),
2180
+ D("div", Xt, [
2181
+ D("div", Gt, [
2182
+ q(de, {
2183
+ "show-descriptions": e.editorShowDescriptions,
2184
+ "show-counts": e.editorShowCounts
2185
+ }, null, 8, ["show-descriptions", "show-counts"])
2186
+ ])
2187
+ ])
2188
+ ], 512))
2189
+ ]),
2190
+ _: 1
2191
+ }, 8, ["value", "schema"]))
2192
+ ], 4));
2193
+ }
2194
+ }), _t = { style: {
2195
+ backgroundColor: "var(--vj-bg, #1e1e1e)",
2196
+ color: "var(--vj-text, #cccccc)",
2197
+ overflow: "auto",
2198
+ height: "100%",
2199
+ display: "flex",
2200
+ flexDirection: "column"
2201
+ } }, Zt = { style: {
2202
+ display: "flex",
2203
+ alignItems: "center",
2204
+ gap: "12px",
2205
+ padding: "6px 12px",
2206
+ borderBottom: "1px solid var(--vj-border, #333333)",
2207
+ backgroundColor: "var(--vj-bg-panel, #252526)",
2208
+ fontFamily: "var(--vj-font, monospace)",
2209
+ fontSize: "12px",
2210
+ flexShrink: 0
2211
+ } }, en = { style: { color: "var(--vj-text-muted, #999999)" } }, tn = {
2212
+ key: 0,
2213
+ style: { color: "#4ec94e" }
2214
+ }, nn = {
2215
+ key: 1,
2216
+ style: { color: "#f48771" }
2217
+ }, on = {
2218
+ key: 2,
2219
+ style: { color: "#dcdcaa" }
2220
+ }, an = { style: { flex: 1, overflow: "auto" } }, ln = {
2221
+ key: 0,
2222
+ style: {
2223
+ display: "flex",
2224
+ alignItems: "center",
2225
+ justifyContent: "center",
2226
+ height: "100%",
2227
+ color: "var(--vj-text-dimmer, #555555)",
2228
+ fontFamily: "var(--vj-font, monospace)",
2229
+ fontSize: "13px"
2230
+ }
2231
+ }, rn = { style: {
2232
+ color: "var(--vj-text, #cccccc)",
2233
+ flexShrink: 0,
2234
+ minWidth: "100px"
2235
+ } }, sn = { style: { flex: 1, display: "flex", gap: "8px", overflow: "hidden" } }, un = { style: { color: "#f48771", textDecoration: "line-through" } }, dn = { style: { color: "#4ec94e" } }, cn = {
2236
+ key: 1,
2237
+ style: { color: "#4ec94e" }
2238
+ }, vn = {
2239
+ key: 2,
2240
+ style: { color: "#f48771", textDecoration: "line-through" }
2241
+ }, gn = /* @__PURE__ */ Y({
2242
+ __name: "DiffView",
2243
+ props: {
2244
+ originalJson: {},
2245
+ currentJson: {},
2246
+ class: {}
2247
+ },
2248
+ setup(t) {
2249
+ const r = t, e = T(
2250
+ () => Xe(r.originalJson, r.currentJson)
2251
+ ), n = T(() => e.value.filter((o) => o.type === "added").length), a = T(() => e.value.filter((o) => o.type === "removed").length), s = T(() => e.value.filter((o) => o.type === "changed").length);
2252
+ function i(o) {
2253
+ return tt[o.type];
2254
+ }
2255
+ return (o, d) => (g(), x("div", _t, [
2256
+ D("div", Zt, [
2257
+ D("span", en, F(e.value.length === 0 ? "No changes" : `${e.value.length} changes`), 1),
2258
+ n.value > 0 ? (g(), x("span", tn, "+" + F(n.value) + " added", 1)) : A("", !0),
2259
+ a.value > 0 ? (g(), x("span", nn, "-" + F(a.value) + " removed", 1)) : A("", !0),
2260
+ s.value > 0 ? (g(), x("span", on, "~" + F(s.value) + " modified", 1)) : A("", !0)
2261
+ ]),
2262
+ D("div", an, [
2263
+ e.value.length === 0 ? (g(), x("div", ln, " No differences detected ")) : A("", !0),
2264
+ (g(!0), x(U, null, te(e.value, (p, f) => (g(), x("div", {
2265
+ key: f,
2266
+ style: R({
2267
+ display: "flex",
2268
+ alignItems: "flex-start",
2269
+ padding: "3px 12px",
2270
+ borderBottom: "1px solid var(--vj-border-subtle, #2a2a2a)",
2271
+ backgroundColor: i(p).bg,
2272
+ fontFamily: "var(--vj-font, monospace)",
2273
+ fontSize: "12px",
2274
+ gap: "8px"
2275
+ })
2276
+ }, [
2277
+ D("span", {
2278
+ style: R({
2279
+ color: i(p).label,
2280
+ fontWeight: 600,
2281
+ width: "14px",
2282
+ flexShrink: 0,
2283
+ textAlign: "center"
2284
+ })
2285
+ }, F(i(p).marker), 5),
2286
+ D("span", rn, F(p.path), 1),
2287
+ D("span", sn, [
2288
+ p.type === "changed" ? (g(), x(U, { key: 0 }, [
2289
+ D("span", un, F(b(ae)(p.oldValue)), 1),
2290
+ d[0] || (d[0] = D("span", { style: { color: "var(--vj-text-dim, #666666)" } }, "→", -1)),
2291
+ D("span", dn, F(b(ae)(p.newValue)), 1)
2292
+ ], 64)) : p.type === "added" ? (g(), x("span", cn, F(b(ae)(p.newValue)), 1)) : p.type === "removed" ? (g(), x("span", vn, F(b(ae)(p.oldValue)), 1)) : A("", !0)
2293
+ ])
2294
+ ], 4))), 128))
2295
+ ])
2296
+ ]));
2297
+ }
2298
+ });
2299
+ export {
2300
+ xt as Breadcrumbs,
2301
+ ft as ContextMenu,
2302
+ gn as DiffView,
2303
+ be as EnumInput,
2304
+ de as FormView,
2305
+ hn as JsonEditor,
2306
+ we as SearchBar,
2307
+ me as TreeView,
2308
+ st as VisualJson,
2309
+ se as getDisplayKey,
2310
+ pe as getVisibleNodes,
2311
+ Ee as useDragDrop,
2312
+ Z as useStudio
2313
+ };