json-schema-builder-react 0.0.9 → 1.0.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-lib/index.js CHANGED
@@ -1,20 +1,20 @@
1
- import { jsx as e, jsxs as s, Fragment as me } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as s, Fragment as X } from "react/jsx-runtime";
2
2
  import * as x from "react";
3
- import { useContext as Ee, createContext as Re, useState as q, useEffect as ae, useMemo as Le, useCallback as P } from "react";
4
- import { Slot as je } from "@radix-ui/react-slot";
5
- import { cva as ue } from "class-variance-authority";
6
- import { clsx as qe } from "clsx";
3
+ import { useContext as Re, createContext as Ee, useState as P, useEffect as ne, useMemo as Le, useCallback as F } from "react";
4
+ import { Slot as qe } from "@radix-ui/react-slot";
5
+ import { cva as he } from "class-variance-authority";
6
+ import { clsx as je } from "clsx";
7
7
  import { twMerge as Oe } from "tailwind-merge";
8
- import { ChevronDown as ie, Check as he, ChevronUp as Pe, X as Fe, Asterisk as oe, Type as ze, Hash as de, CheckSquare as Be, Braces as Ae, List as Me, FileText as $e, Plus as B, Pencil as Ke, Trash2 as fe, CheckCircle2 as Je, Copy as Ve, Download as He, ChevronRight as _e, Moon as Ue, Sun as Xe, Upload as Ge } from "lucide-react";
9
- import * as F from "@radix-ui/react-tooltip";
10
- import * as w from "@radix-ui/react-select";
11
- import * as L from "@radix-ui/react-dialog";
12
- import * as pe from "@radix-ui/react-label";
13
- import * as U from "@radix-ui/react-checkbox";
14
- function h(...t) {
15
- return Oe(qe(t));
8
+ import { ChevronDown as se, Check as fe, ChevronUp as Pe, X as Fe, Asterisk as ce, Type as ze, Hash as me, CheckSquare as Be, Braces as Ae, List as Me, FileText as $e, Plus as $, Pencil as Ke, Trash2 as pe, CheckCircle2 as Je, Copy as Ve, Download as He, ChevronRight as _e, Moon as Ue, Sun as Xe, Upload as Ge } from "lucide-react";
9
+ import * as z from "@radix-ui/react-tooltip";
10
+ import * as N from "@radix-ui/react-select";
11
+ import * as q from "@radix-ui/react-dialog";
12
+ import * as ge from "@radix-ui/react-label";
13
+ import * as G from "@radix-ui/react-checkbox";
14
+ function p(...t) {
15
+ return Oe(je(t));
16
16
  }
17
- const Qe = ue(
17
+ const Qe = he(
18
18
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
19
19
  {
20
20
  variants: {
@@ -38,23 +38,23 @@ const Qe = ue(
38
38
  size: "default"
39
39
  }
40
40
  }
41
- ), S = x.forwardRef(
42
- ({ className: t, variant: i, size: a, asChild: l = !1, ...n }, o) => /* @__PURE__ */ e(
43
- l ? je : "button",
41
+ ), T = x.forwardRef(
42
+ ({ className: t, variant: i, size: a, asChild: l = !1, ...n }, r) => /* @__PURE__ */ e(
43
+ l ? qe : "button",
44
44
  {
45
- className: h(Qe({ variant: i, size: a, className: t })),
46
- ref: o,
45
+ className: p(Qe({ variant: i, size: a, className: t })),
46
+ ref: r,
47
47
  ...n
48
48
  }
49
49
  )
50
50
  );
51
- S.displayName = "Button";
52
- const T = x.forwardRef(
51
+ T.displayName = "Button";
52
+ const R = x.forwardRef(
53
53
  ({ className: t, type: i, ...a }, l) => /* @__PURE__ */ e(
54
54
  "input",
55
55
  {
56
56
  type: i,
57
- className: h(
57
+ className: p(
58
58
  "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
59
59
  t
60
60
  ),
@@ -63,41 +63,41 @@ const T = x.forwardRef(
63
63
  }
64
64
  )
65
65
  );
66
- T.displayName = "Input";
67
- const We = F.Provider, Ye = F.Root, Ze = F.Trigger, ge = x.forwardRef(({ className: t, sideOffset: i = 4, ...a }, l) => /* @__PURE__ */ e(F.Portal, { children: /* @__PURE__ */ e(
68
- F.Content,
66
+ R.displayName = "Input";
67
+ const We = z.Provider, Ye = z.Root, Ze = z.Trigger, ye = x.forwardRef(({ className: t, sideOffset: i = 4, ...a }, l) => /* @__PURE__ */ e(z.Portal, { children: /* @__PURE__ */ e(
68
+ z.Content,
69
69
  {
70
70
  ref: l,
71
71
  sideOffset: i,
72
- className: h(
72
+ className: p(
73
73
  "z-50 overflow-hidden rounded-md bg-popover px-3 py-1.5 text-xs text-popover-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",
74
74
  t
75
75
  ),
76
76
  ...a
77
77
  }
78
78
  ) }));
79
- ge.displayName = F.Content.displayName;
80
- const X = w.Root, G = w.Value, J = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(
81
- w.Trigger,
79
+ ye.displayName = z.Content.displayName;
80
+ const Q = N.Root, W = N.Value, H = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(
81
+ N.Trigger,
82
82
  {
83
83
  ref: l,
84
- className: h(
84
+ className: p(
85
85
  "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
86
86
  t
87
87
  ),
88
88
  ...a,
89
89
  children: [
90
90
  i,
91
- /* @__PURE__ */ e(w.Icon, { asChild: !0, children: /* @__PURE__ */ e(ie, { className: "h-4 w-4 opacity-50" }) })
91
+ /* @__PURE__ */ e(N.Icon, { asChild: !0, children: /* @__PURE__ */ e(se, { className: "h-4 w-4 opacity-50" }) })
92
92
  ]
93
93
  }
94
94
  ));
95
- J.displayName = w.Trigger.displayName;
96
- const ye = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
97
- w.ScrollUpButton,
95
+ H.displayName = N.Trigger.displayName;
96
+ const ve = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
97
+ N.ScrollUpButton,
98
98
  {
99
99
  ref: a,
100
- className: h(
100
+ className: p(
101
101
  "flex cursor-default items-center justify-center py-1",
102
102
  t
103
103
  ),
@@ -105,25 +105,25 @@ const ye = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
105
105
  children: /* @__PURE__ */ e(Pe, { className: "h-4 w-4" })
106
106
  }
107
107
  ));
108
- ye.displayName = w.ScrollUpButton.displayName;
109
- const ve = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
110
- w.ScrollDownButton,
108
+ ve.displayName = N.ScrollUpButton.displayName;
109
+ const xe = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
110
+ N.ScrollDownButton,
111
111
  {
112
112
  ref: a,
113
- className: h(
113
+ className: p(
114
114
  "flex cursor-default items-center justify-center py-1",
115
115
  t
116
116
  ),
117
117
  ...i,
118
- children: /* @__PURE__ */ e(ie, { className: "h-4 w-4" })
118
+ children: /* @__PURE__ */ e(se, { className: "h-4 w-4" })
119
119
  }
120
120
  ));
121
- ve.displayName = w.ScrollDownButton.displayName;
122
- const V = x.forwardRef(({ className: t, children: i, position: a = "popper", ...l }, n) => /* @__PURE__ */ e(w.Portal, { children: /* @__PURE__ */ s(
123
- w.Content,
121
+ xe.displayName = N.ScrollDownButton.displayName;
122
+ const _ = x.forwardRef(({ className: t, children: i, position: a = "popper", ...l }, n) => /* @__PURE__ */ e(N.Portal, { children: /* @__PURE__ */ s(
123
+ N.Content,
124
124
  {
125
125
  ref: n,
126
- className: h(
126
+ className: p(
127
127
  "relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",
128
128
  a === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
129
129
  t
@@ -131,82 +131,82 @@ const V = x.forwardRef(({ className: t, children: i, position: a = "popper", ...
131
131
  position: a,
132
132
  ...l,
133
133
  children: [
134
- /* @__PURE__ */ e(ye, {}),
134
+ /* @__PURE__ */ e(ve, {}),
135
135
  /* @__PURE__ */ e(
136
- w.Viewport,
136
+ N.Viewport,
137
137
  {
138
- className: h(
138
+ className: p(
139
139
  "p-1",
140
140
  a === "popper" && "h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
141
141
  ),
142
142
  children: i
143
143
  }
144
144
  ),
145
- /* @__PURE__ */ e(ve, {})
145
+ /* @__PURE__ */ e(xe, {})
146
146
  ]
147
147
  }
148
148
  ) }));
149
- V.displayName = w.Content.displayName;
149
+ _.displayName = N.Content.displayName;
150
150
  const et = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
151
- w.Label,
151
+ N.Label,
152
152
  {
153
153
  ref: a,
154
- className: h("px-2 py-1.5 text-sm font-semibold", t),
154
+ className: p("px-2 py-1.5 text-sm font-semibold", t),
155
155
  ...i
156
156
  }
157
157
  ));
158
- et.displayName = w.Label.displayName;
159
- const I = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(
160
- w.Item,
158
+ et.displayName = N.Label.displayName;
159
+ const S = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(
160
+ N.Item,
161
161
  {
162
162
  ref: l,
163
- className: h(
163
+ className: p(
164
164
  "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
165
165
  t
166
166
  ),
167
167
  ...a,
168
168
  children: [
169
- /* @__PURE__ */ e("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e(w.ItemIndicator, { children: /* @__PURE__ */ e(he, { className: "h-4 w-4" }) }) }),
170
- /* @__PURE__ */ e(w.ItemText, { children: i })
169
+ /* @__PURE__ */ e("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e(N.ItemIndicator, { children: /* @__PURE__ */ e(fe, { className: "h-4 w-4" }) }) }),
170
+ /* @__PURE__ */ e(N.ItemText, { children: i })
171
171
  ]
172
172
  }
173
173
  ));
174
- I.displayName = w.Item.displayName;
174
+ S.displayName = N.Item.displayName;
175
175
  const tt = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
176
- w.Separator,
176
+ N.Separator,
177
177
  {
178
178
  ref: a,
179
- className: h("-mx-1 my-1 h-px bg-muted", t),
179
+ className: p("-mx-1 my-1 h-px bg-muted", t),
180
180
  ...i
181
181
  }
182
182
  ));
183
- tt.displayName = w.Separator.displayName;
184
- const at = L.Root, it = L.Portal, xe = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
185
- L.Overlay,
183
+ tt.displayName = N.Separator.displayName;
184
+ const at = q.Root, it = q.Portal, be = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
185
+ q.Overlay,
186
186
  {
187
187
  ref: a,
188
- className: h(
188
+ className: p(
189
189
  "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
190
190
  t
191
191
  ),
192
192
  ...i
193
193
  }
194
194
  ));
195
- xe.displayName = L.Overlay.displayName;
196
- const be = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(it, { children: [
197
- /* @__PURE__ */ e(xe, {}),
195
+ be.displayName = q.Overlay.displayName;
196
+ const Ne = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__ */ s(it, { children: [
197
+ /* @__PURE__ */ e(be, {}),
198
198
  /* @__PURE__ */ s(
199
- L.Content,
199
+ q.Content,
200
200
  {
201
201
  ref: l,
202
- className: h(
202
+ className: p(
203
203
  "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
204
204
  t
205
205
  ),
206
206
  ...a,
207
207
  children: [
208
208
  i,
209
- /* @__PURE__ */ s(L.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
209
+ /* @__PURE__ */ s(q.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
210
210
  /* @__PURE__ */ e(Fe, { className: "h-4 w-4" }),
211
211
  /* @__PURE__ */ e("span", { className: "sr-only", children: "Close" })
212
212
  ] })
@@ -214,90 +214,90 @@ const be = x.forwardRef(({ className: t, children: i, ...a }, l) => /* @__PURE__
214
214
  }
215
215
  )
216
216
  ] }));
217
- be.displayName = L.Content.displayName;
218
- const Ne = ({
217
+ Ne.displayName = q.Content.displayName;
218
+ const we = ({
219
219
  className: t,
220
220
  ...i
221
221
  }) => /* @__PURE__ */ e(
222
222
  "div",
223
223
  {
224
- className: h(
224
+ className: p(
225
225
  "flex flex-col space-y-1.5 text-center sm:text-left",
226
226
  t
227
227
  ),
228
228
  ...i
229
229
  }
230
230
  );
231
- Ne.displayName = "DialogHeader";
232
- const we = ({
231
+ we.displayName = "DialogHeader";
232
+ const Ce = ({
233
233
  className: t,
234
234
  ...i
235
235
  }) => /* @__PURE__ */ e(
236
236
  "div",
237
237
  {
238
- className: h(
238
+ className: p(
239
239
  "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
240
240
  t
241
241
  ),
242
242
  ...i
243
243
  }
244
244
  );
245
- we.displayName = "DialogFooter";
246
- const Ce = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
247
- L.Title,
245
+ Ce.displayName = "DialogFooter";
246
+ const ke = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
247
+ q.Title,
248
248
  {
249
249
  ref: a,
250
- className: h(
250
+ className: p(
251
251
  "text-lg font-semibold leading-none tracking-tight",
252
252
  t
253
253
  ),
254
254
  ...i
255
255
  }
256
256
  ));
257
- Ce.displayName = L.Title.displayName;
257
+ ke.displayName = q.Title.displayName;
258
258
  const nt = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
259
- L.Description,
259
+ q.Description,
260
260
  {
261
261
  ref: a,
262
- className: h("text-sm text-muted-foreground", t),
262
+ className: p("text-sm text-muted-foreground", t),
263
263
  ...i
264
264
  }
265
265
  ));
266
- nt.displayName = L.Description.displayName;
267
- const st = ue(
266
+ nt.displayName = q.Description.displayName;
267
+ const st = he(
268
268
  "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
269
- ), N = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
270
- pe.Root,
269
+ ), b = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
270
+ ge.Root,
271
271
  {
272
272
  ref: a,
273
- className: h(st(), t),
273
+ className: p(st(), t),
274
274
  ...i
275
275
  }
276
276
  ));
277
- N.displayName = pe.Root.displayName;
278
- const Q = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
279
- U.Root,
277
+ b.displayName = ge.Root.displayName;
278
+ const Y = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
279
+ G.Root,
280
280
  {
281
281
  ref: a,
282
- className: h(
282
+ className: p(
283
283
  "grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
284
284
  t
285
285
  ),
286
286
  ...i,
287
287
  children: /* @__PURE__ */ e(
288
- U.Indicator,
288
+ G.Indicator,
289
289
  {
290
- className: h("grid place-content-center text-current"),
291
- children: /* @__PURE__ */ e(he, { className: "h-4 w-4" })
290
+ className: p("grid place-content-center text-current"),
291
+ children: /* @__PURE__ */ e(fe, { className: "h-4 w-4" })
292
292
  }
293
293
  )
294
294
  }
295
295
  ));
296
- Q.displayName = U.Root.displayName;
297
- const ne = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
296
+ Y.displayName = G.Root.displayName;
297
+ const re = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
298
298
  "textarea",
299
299
  {
300
- className: h(
300
+ className: p(
301
301
  "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
302
302
  t
303
303
  ),
@@ -305,33 +305,33 @@ const ne = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
305
305
  ...i
306
306
  }
307
307
  ));
308
- ne.displayName = "Textarea";
308
+ re.displayName = "Textarea";
309
309
  const rt = (t) => t.trim().toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g, "_"), lt = (t, i, a = !1, l = !1) => {
310
- const n = (p, g) => {
311
- i({ ...t, [p]: g });
310
+ const n = (h, y) => {
311
+ i({ ...t, [h]: y });
312
312
  };
313
313
  return {
314
- handleTitleChange: (p) => {
315
- n("title", p);
314
+ handleTitleChange: (h) => {
315
+ n("title", h);
316
316
  },
317
317
  handleTitleBlur: () => {
318
318
  if (a && t.title) {
319
- const p = rt(t.title);
320
- n("key", p);
319
+ const h = rt(t.title);
320
+ n("key", h);
321
321
  }
322
322
  },
323
- handleKeyChange: (p) => {
324
- (a || l) && n("key", p);
323
+ handleKeyChange: (h) => {
324
+ (a || l) && n("key", h);
325
325
  },
326
326
  handleFieldChange: n,
327
- handleConstraintChange: (p, g) => {
327
+ handleConstraintChange: (h, y) => {
328
328
  i({
329
329
  ...t,
330
- [p]: g
330
+ [h]: y
331
331
  });
332
332
  }
333
333
  };
334
- }, W = {
334
+ }, Z = {
335
335
  string: "String",
336
336
  number: "Number",
337
337
  integer: "Integer",
@@ -340,189 +340,190 @@ const rt = (t) => t.trim().toLowerCase().replace(/[^\w\s]/g, "").replace(/\s+/g,
340
340
  array: "Array",
341
341
  null: "Null",
342
342
  file: "File"
343
- }, K = {
344
- getTypeLabel: (t) => W[t],
345
- typeLabels: W,
343
+ }, M = {
344
+ getTypeLabel: (t) => Z[t],
345
+ typeLabels: Z,
346
346
  propertyLabel: { singular: "property", plural: "properties" },
347
347
  showRegex: !1,
348
- keyEditable: !1
349
- }, ke = Re(K);
350
- function ot({
348
+ keyEditable: !1,
349
+ readonly: !1
350
+ }, Ie = Ee(M);
351
+ function dt({
351
352
  children: t,
352
353
  config: i = {}
353
354
  }) {
354
- const a = { ...W, ...i.typeLabels }, l = i.propertyLabel || K.propertyLabel, n = i.showRegex ?? K.showRegex, o = i.keyEditable ?? K.keyEditable, r = (m) => a[m] || m;
355
+ const a = { ...Z, ...i.typeLabels }, l = i.propertyLabel || M.propertyLabel, n = i.showRegex ?? M.showRegex, r = i.keyEditable ?? M.keyEditable, d = i.readonly ?? M.readonly, c = (C) => a[C] || C;
355
356
  return /* @__PURE__ */ e(
356
- ke.Provider,
357
+ Ie.Provider,
357
358
  {
358
- value: { getTypeLabel: r, typeLabels: a, propertyLabel: l, showRegex: n, keyEditable: o },
359
+ value: { getTypeLabel: c, typeLabels: a, propertyLabel: l, showRegex: n, keyEditable: r, readonly: d },
359
360
  children: t
360
361
  }
361
362
  );
362
363
  }
363
- function Ie() {
364
- return Ee(ke);
364
+ function Se() {
365
+ return Re(Ie);
365
366
  }
366
- function Y({
367
+ function ee({
367
368
  property: t,
368
369
  open: i,
369
370
  onOpenChange: a,
370
371
  onSave: l,
371
372
  isArrayItem: n = !1,
372
- isNewProperty: o = !1,
373
- propertyLabel: r,
374
- showRegex: m,
375
- keyEditable: D,
376
- typeLabels: p
373
+ isNewProperty: r = !1,
374
+ propertyLabel: d,
375
+ showRegex: c,
376
+ keyEditable: C,
377
+ typeLabels: h
377
378
  }) {
378
- const g = Ie(), u = p || g.typeLabels, b = r || g.propertyLabel, v = m ?? g.showRegex, y = D ?? g.keyEditable, [d, k] = q(t);
379
- ae(() => {
379
+ const y = Se(), f = h || y.typeLabels, v = d || y.propertyLabel, w = c ?? y.showRegex, m = C ?? y.keyEditable, [o, k] = P(t);
380
+ ne(() => {
380
381
  i && k(t);
381
382
  }, [t, i]);
382
383
  const {
383
- handleTitleChange: E,
384
- handleTitleBlur: R,
385
- handleKeyChange: f,
386
- handleFieldChange: O,
387
- handleConstraintChange: C
384
+ handleTitleChange: L,
385
+ handleTitleBlur: O,
386
+ handleKeyChange: D,
387
+ handleFieldChange: g,
388
+ handleConstraintChange: E
388
389
  } = lt(
389
- d,
390
- k,
391
390
  o,
392
- y
393
- ), H = () => {
394
- d.title?.trim() && (l(d), a(!1));
395
- }, _ = () => {
391
+ k,
392
+ r,
393
+ m
394
+ ), j = () => {
395
+ o.title?.trim() && (l(o), a(!1));
396
+ }, U = () => {
396
397
  k(t), a(!1);
397
398
  };
398
399
  return /* @__PURE__ */ e(at, { open: i, onOpenChange: a, children: /* @__PURE__ */ s(
399
- be,
400
+ Ne,
400
401
  {
401
402
  className: "max-w-2xl max-h-[80vh] flex flex-col gap-0 p-0",
402
403
  "data-testid": "dialog-edit-property",
403
404
  children: [
404
- /* @__PURE__ */ e(Ne, { className: "px-6 pt-6 pb-4 shrink-0", children: /* @__PURE__ */ e(Ce, { children: o ? `Add ${b.singular}` : `Edit ${b.singular}` }) }),
405
+ /* @__PURE__ */ e(we, { className: "px-6 pt-6 pb-4 shrink-0", children: /* @__PURE__ */ e(ke, { children: r ? `Add ${v.singular}` : `Edit ${v.singular}` }) }),
405
406
  /* @__PURE__ */ s("div", { className: "space-y-6 px-6 pb-4 overflow-y-auto flex-1 min-h-0", children: [
406
407
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
407
- /* @__PURE__ */ s(N, { className: "flex items-center gap-1.5", children: [
408
+ /* @__PURE__ */ s(b, { className: "flex items-center gap-1.5", children: [
408
409
  /* @__PURE__ */ e("span", { className: "w-1.5 h-1.5 rounded-full bg-red-500" }),
409
410
  "Type"
410
411
  ] }),
411
412
  /* @__PURE__ */ s(
412
- X,
413
+ Q,
413
414
  {
414
- value: d.type,
415
- onValueChange: (c) => O("type", c),
415
+ value: o.type,
416
+ onValueChange: (u) => g("type", u),
416
417
  "data-testid": "select-type-dialog",
417
418
  children: [
418
- /* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(G, {}) }),
419
- /* @__PURE__ */ s(V, { children: [
420
- /* @__PURE__ */ e(I, { value: "string", children: u.string }),
421
- /* @__PURE__ */ e(I, { value: "number", children: u.number }),
422
- /* @__PURE__ */ e(I, { value: "integer", children: u.integer }),
423
- /* @__PURE__ */ e(I, { value: "boolean", children: u.boolean }),
424
- /* @__PURE__ */ e(I, { value: "object", children: u.object }),
425
- /* @__PURE__ */ e(I, { value: "array", children: u.array }),
426
- /* @__PURE__ */ e(I, { value: "file", children: u.file }),
427
- /* @__PURE__ */ e(I, { value: "null", children: u.null })
419
+ /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(W, {}) }),
420
+ /* @__PURE__ */ s(_, { children: [
421
+ /* @__PURE__ */ e(S, { value: "string", children: f.string }),
422
+ /* @__PURE__ */ e(S, { value: "number", children: f.number }),
423
+ /* @__PURE__ */ e(S, { value: "integer", children: f.integer }),
424
+ /* @__PURE__ */ e(S, { value: "boolean", children: f.boolean }),
425
+ /* @__PURE__ */ e(S, { value: "object", children: f.object }),
426
+ /* @__PURE__ */ e(S, { value: "array", children: f.array }),
427
+ /* @__PURE__ */ e(S, { value: "file", children: f.file }),
428
+ /* @__PURE__ */ e(S, { value: "null", children: f.null })
428
429
  ] })
429
430
  ]
430
431
  }
431
432
  )
432
433
  ] }),
433
434
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
434
- /* @__PURE__ */ s(N, { className: "flex items-center gap-1.5", children: [
435
+ /* @__PURE__ */ s(b, { className: "flex items-center gap-1.5", children: [
435
436
  /* @__PURE__ */ e("span", { className: "w-1.5 h-1.5 rounded-full bg-red-500" }),
436
437
  "Title"
437
438
  ] }),
438
439
  /* @__PURE__ */ e(
439
- T,
440
+ R,
440
441
  {
441
- value: d.title || "",
442
- onChange: (c) => E(c.target.value),
443
- onBlur: R,
442
+ value: o.title || "",
443
+ onChange: (u) => L(u.target.value),
444
+ onBlur: O,
444
445
  placeholder: "Property Title",
445
446
  "data-testid": "input-title-dialog",
446
447
  required: !0
447
448
  }
448
449
  ),
449
- !o && d.key && /* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground font-mono", children: [
450
+ !r && o.key && /* @__PURE__ */ s("p", { className: "text-xs text-muted-foreground font-mono", children: [
450
451
  "Key: ",
451
- d.key
452
+ o.key
452
453
  ] })
453
454
  ] }),
454
- (o || y) && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
455
- /* @__PURE__ */ e(N, { children: "Key" }),
455
+ (r || m) && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
456
+ /* @__PURE__ */ e(b, { children: "Key" }),
456
457
  /* @__PURE__ */ e(
457
- T,
458
+ R,
458
459
  {
459
- value: d.key,
460
- onChange: (c) => f(c.target.value),
460
+ value: o.key,
461
+ onChange: (u) => D(u.target.value),
461
462
  placeholder: "property_key",
462
463
  "data-testid": "input-key-dialog"
463
464
  }
464
465
  ),
465
- !o && /* @__PURE__ */ e("p", { className: "text-xs text-yellow-600 dark:text-yellow-500", children: "⚠️ Changing the key may break existing references to this property" })
466
+ !r && /* @__PURE__ */ e("p", { className: "text-xs text-yellow-600 dark:text-yellow-500", children: "⚠️ Changing the key may break existing references to this property" })
466
467
  ] }),
467
468
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
468
- /* @__PURE__ */ e(N, { children: "Description" }),
469
+ /* @__PURE__ */ e(b, { children: "Description" }),
469
470
  /* @__PURE__ */ e(
470
- ne,
471
+ re,
471
472
  {
472
473
  placeholder: "Optional description",
473
- value: d.description || "",
474
- onChange: (c) => O("description", c.target.value),
474
+ value: o.description || "",
475
+ onChange: (u) => g("description", u.target.value),
475
476
  rows: 2,
476
477
  "data-testid": "input-edit-description"
477
478
  }
478
479
  )
479
480
  ] }),
480
- d.type === "array" && /* @__PURE__ */ s("div", { className: "space-y-2 border-l-2 border-border pl-4 mt-2", children: [
481
- /* @__PURE__ */ s(N, { className: "font-semibold text-xs text-muted-foreground", children: [
482
- u.array,
481
+ o.type === "array" && /* @__PURE__ */ s("div", { className: "space-y-2 border-l-2 border-border pl-4 mt-2", children: [
482
+ /* @__PURE__ */ s(b, { className: "font-semibold text-xs text-muted-foreground", children: [
483
+ f.array,
483
484
  " Items"
484
485
  ] }),
485
- d.items ? /* @__PURE__ */ s("div", { className: "bg-muted/40 p-2 rounded", children: [
486
+ o.items ? /* @__PURE__ */ s("div", { className: "bg-muted/40 p-2 rounded", children: [
486
487
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
487
- /* @__PURE__ */ e(N, { children: "Item Type" }),
488
+ /* @__PURE__ */ e(b, { children: "Item Type" }),
488
489
  /* @__PURE__ */ s(
489
- X,
490
+ Q,
490
491
  {
491
- value: d.items.type,
492
- onValueChange: (c) => k({
493
- ...d,
492
+ value: o.items.type,
493
+ onValueChange: (u) => k({
494
+ ...o,
494
495
  items: {
495
- ...d.items,
496
- type: c
496
+ ...o.items,
497
+ type: u
497
498
  }
498
499
  }),
499
500
  children: [
500
- /* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(G, {}) }),
501
- /* @__PURE__ */ s(V, { children: [
502
- /* @__PURE__ */ e(I, { value: "string", children: u.string }),
503
- /* @__PURE__ */ e(I, { value: "number", children: u.number }),
504
- /* @__PURE__ */ e(I, { value: "integer", children: u.integer }),
505
- /* @__PURE__ */ e(I, { value: "boolean", children: u.boolean }),
506
- /* @__PURE__ */ e(I, { value: "object", children: u.object }),
507
- /* @__PURE__ */ e(I, { value: "array", children: u.array }),
508
- /* @__PURE__ */ e(I, { value: "file", children: u.file }),
509
- /* @__PURE__ */ e(I, { value: "null", children: u.null })
501
+ /* @__PURE__ */ e(H, { children: /* @__PURE__ */ e(W, {}) }),
502
+ /* @__PURE__ */ s(_, { children: [
503
+ /* @__PURE__ */ e(S, { value: "string", children: f.string }),
504
+ /* @__PURE__ */ e(S, { value: "number", children: f.number }),
505
+ /* @__PURE__ */ e(S, { value: "integer", children: f.integer }),
506
+ /* @__PURE__ */ e(S, { value: "boolean", children: f.boolean }),
507
+ /* @__PURE__ */ e(S, { value: "object", children: f.object }),
508
+ /* @__PURE__ */ e(S, { value: "array", children: f.array }),
509
+ /* @__PURE__ */ e(S, { value: "file", children: f.file }),
510
+ /* @__PURE__ */ e(S, { value: "null", children: f.null })
510
511
  ] })
511
512
  ]
512
513
  }
513
514
  )
514
515
  ] }),
515
516
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
516
- /* @__PURE__ */ e(N, { children: "Item Title" }),
517
+ /* @__PURE__ */ e(b, { children: "Item Title" }),
517
518
  /* @__PURE__ */ e(
518
- T,
519
+ R,
519
520
  {
520
- value: d.items.title || "",
521
- onChange: (c) => k({
522
- ...d,
521
+ value: o.items.title || "",
522
+ onChange: (u) => k({
523
+ ...o,
523
524
  items: {
524
- ...d.items,
525
- title: c.target.value
525
+ ...o.items,
526
+ title: u.target.value
526
527
  }
527
528
  }),
528
529
  placeholder: "Item Title"
@@ -530,27 +531,27 @@ function Y({
530
531
  )
531
532
  ] }),
532
533
  /* @__PURE__ */ s(
533
- S,
534
+ T,
534
535
  {
535
536
  variant: "ghost",
536
537
  size: "sm",
537
538
  className: "mt-2",
538
- onClick: () => k({ ...d, items: void 0 }),
539
+ onClick: () => k({ ...o, items: void 0 }),
539
540
  children: [
540
541
  "Remove ",
541
- u.array,
542
+ f.array,
542
543
  " Item Schema"
543
544
  ]
544
545
  }
545
546
  )
546
547
  ] }) : /* @__PURE__ */ s(
547
- S,
548
+ T,
548
549
  {
549
550
  variant: "outline",
550
551
  size: "sm",
551
552
  onClick: () => {
552
553
  k({
553
- ...d,
554
+ ...o,
554
555
  items: {
555
556
  id: Date.now().toString() + Math.random(),
556
557
  key: "item",
@@ -561,7 +562,7 @@ function Y({
561
562
  },
562
563
  children: [
563
564
  "Add ",
564
- u.array,
565
+ f.array,
565
566
  " Item Schema"
566
567
  ]
567
568
  }
@@ -569,139 +570,139 @@ function Y({
569
570
  ] }),
570
571
  !n && /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
571
572
  /* @__PURE__ */ e(
572
- Q,
573
+ Y,
573
574
  {
574
575
  id: "prop-required",
575
- checked: d.required,
576
- onCheckedChange: (c) => O("required", c),
576
+ checked: o.required,
577
+ onCheckedChange: (u) => g("required", u),
577
578
  "data-testid": "checkbox-edit-required"
578
579
  }
579
580
  ),
580
- /* @__PURE__ */ e(N, { htmlFor: "prop-required", className: "cursor-pointer", children: "Required field" })
581
+ /* @__PURE__ */ e(b, { htmlFor: "prop-required", className: "cursor-pointer", children: "Required field" })
581
582
  ] }),
582
- d.type === "string" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
583
+ o.type === "string" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
583
584
  /* @__PURE__ */ e("summary", { className: "p-4 cursor-pointer hover:bg-accent/50 transition-colors", children: /* @__PURE__ */ s("h4", { className: "text-sm font-medium inline", children: [
584
- u.string,
585
+ f.string,
585
586
  " Constraints"
586
587
  ] }) }),
587
588
  /* @__PURE__ */ s("div", { className: "space-y-4 p-4 pt-0", children: [
588
589
  /* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-4", children: [
589
590
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
590
- /* @__PURE__ */ e(N, { htmlFor: "min-length", children: "Minimum Length" }),
591
+ /* @__PURE__ */ e(b, { htmlFor: "min-length", children: "Minimum Length" }),
591
592
  /* @__PURE__ */ e(
592
- T,
593
+ R,
593
594
  {
594
595
  id: "min-length",
595
596
  type: "number",
596
597
  placeholder: "0",
597
- value: d.minLength || "",
598
- onChange: (c) => C(
598
+ value: o.minLength || "",
599
+ onChange: (u) => E(
599
600
  "minLength",
600
- c.target.value ? parseInt(c.target.value) : void 0
601
+ u.target.value ? parseInt(u.target.value) : void 0
601
602
  ),
602
603
  "data-testid": "input-edit-minlength"
603
604
  }
604
605
  )
605
606
  ] }),
606
607
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
607
- /* @__PURE__ */ e(N, { htmlFor: "max-length", children: "Maximum Length" }),
608
+ /* @__PURE__ */ e(b, { htmlFor: "max-length", children: "Maximum Length" }),
608
609
  /* @__PURE__ */ e(
609
- T,
610
+ R,
610
611
  {
611
612
  id: "max-length",
612
613
  type: "number",
613
614
  placeholder: "∞",
614
- value: d.maxLength || "",
615
- onChange: (c) => C(
615
+ value: o.maxLength || "",
616
+ onChange: (u) => E(
616
617
  "maxLength",
617
- c.target.value ? parseInt(c.target.value) : void 0
618
+ u.target.value ? parseInt(u.target.value) : void 0
618
619
  ),
619
620
  "data-testid": "input-edit-maxlength"
620
621
  }
621
622
  )
622
623
  ] })
623
624
  ] }),
624
- v && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
625
- /* @__PURE__ */ e(N, { htmlFor: "pattern", children: "Pattern (regex)" }),
625
+ w && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
626
+ /* @__PURE__ */ e(b, { htmlFor: "pattern", children: "Pattern (regex)" }),
626
627
  /* @__PURE__ */ e(
627
- T,
628
+ R,
628
629
  {
629
630
  id: "pattern",
630
631
  placeholder: "^[a-z]+$",
631
- value: d.pattern || "",
632
- onChange: (c) => C("pattern", c.target.value),
632
+ value: o.pattern || "",
633
+ onChange: (u) => E("pattern", u.target.value),
633
634
  className: "font-mono text-sm",
634
635
  "data-testid": "input-edit-pattern"
635
636
  }
636
637
  )
637
638
  ] }),
638
639
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
639
- /* @__PURE__ */ e(N, { children: "Enum Values" }),
640
- /* @__PURE__ */ e("div", { className: "space-y-2", children: [...d.enum || [], ""].map((c, j) => /* @__PURE__ */ e(
641
- T,
640
+ /* @__PURE__ */ e(b, { children: "Enum Values" }),
641
+ /* @__PURE__ */ e("div", { className: "space-y-2", children: [...o.enum || [], ""].map((u, I) => /* @__PURE__ */ e(
642
+ R,
642
643
  {
643
- placeholder: j === (d.enum?.length || 0) ? "Add new value..." : "Enum value",
644
- value: c,
645
- onChange: (Te) => {
646
- const A = Te.target.value, M = d.enum || [];
647
- if (j === M.length)
648
- A.trim() && C("enum", [
649
- ...M,
650
- A.trim()
644
+ placeholder: I === (o.enum?.length || 0) ? "Add new value..." : "Enum value",
645
+ value: u,
646
+ onChange: (B) => {
647
+ const K = B.target.value, J = o.enum || [];
648
+ if (I === J.length)
649
+ K.trim() && E("enum", [
650
+ ...J,
651
+ K.trim()
651
652
  ]);
652
- else if (A.trim()) {
653
- const z = [...M];
654
- z[j] = A.trim(), C("enum", z);
653
+ else if (K.trim()) {
654
+ const A = [...J];
655
+ A[I] = K.trim(), E("enum", A);
655
656
  } else {
656
- const z = M.filter(
657
- (wt, De) => De !== j
657
+ const A = J.filter(
658
+ (wt, De) => De !== I
658
659
  );
659
- C(
660
+ E(
660
661
  "enum",
661
- z.length > 0 ? z : void 0
662
+ A.length > 0 ? A : void 0
662
663
  );
663
664
  }
664
665
  },
665
- "data-testid": `input-edit-enum-${j}`
666
+ "data-testid": `input-edit-enum-${I}`
666
667
  },
667
- j
668
+ I
668
669
  )) }),
669
670
  /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "Enter allowed values (empty fields will be removed)" })
670
671
  ] })
671
672
  ] })
672
673
  ] }),
673
- (d.type === "number" || d.type === "integer") && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
674
+ (o.type === "number" || o.type === "integer") && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
674
675
  /* @__PURE__ */ e("summary", { className: "p-4 cursor-pointer hover:bg-accent/50 transition-colors", children: /* @__PURE__ */ e("h4", { className: "text-sm font-medium inline", children: "Numeric Constraints" }) }),
675
676
  /* @__PURE__ */ e("div", { className: "space-y-4 p-4 pt-0", children: /* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-4", children: [
676
677
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
677
- /* @__PURE__ */ e(N, { htmlFor: "minimum", children: "Minimum Value" }),
678
+ /* @__PURE__ */ e(b, { htmlFor: "minimum", children: "Minimum Value" }),
678
679
  /* @__PURE__ */ e(
679
- T,
680
+ R,
680
681
  {
681
682
  id: "minimum",
682
683
  type: "number",
683
684
  placeholder: "-∞",
684
- value: d.minimum ?? "",
685
- onChange: (c) => C(
685
+ value: o.minimum ?? "",
686
+ onChange: (u) => E(
686
687
  "minimum",
687
- c.target.value ? parseFloat(c.target.value) : void 0
688
+ u.target.value ? parseFloat(u.target.value) : void 0
688
689
  ),
689
690
  "data-testid": "input-edit-minimum"
690
691
  }
691
692
  )
692
693
  ] }),
693
694
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
694
- /* @__PURE__ */ e(N, { htmlFor: "maximum", children: "Maximum Value" }),
695
+ /* @__PURE__ */ e(b, { htmlFor: "maximum", children: "Maximum Value" }),
695
696
  /* @__PURE__ */ e(
696
- T,
697
+ R,
697
698
  {
698
699
  id: "maximum",
699
700
  type: "number",
700
701
  placeholder: "∞",
701
- value: d.maximum ?? "",
702
- onChange: (c) => C(
702
+ value: o.maximum ?? "",
703
+ onChange: (u) => E(
703
704
  "maximum",
704
- c.target.value ? parseFloat(c.target.value) : void 0
705
+ u.target.value ? parseFloat(u.target.value) : void 0
705
706
  ),
706
707
  "data-testid": "input-edit-maximum"
707
708
  }
@@ -709,42 +710,42 @@ function Y({
709
710
  ] })
710
711
  ] }) })
711
712
  ] }),
712
- d.type === "array" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
713
+ o.type === "array" && /* @__PURE__ */ s("details", { className: "border rounded-md", children: [
713
714
  /* @__PURE__ */ e("summary", { className: "p-4 cursor-pointer hover:bg-accent/50 transition-colors", children: /* @__PURE__ */ s("h4", { className: "text-sm font-medium inline", children: [
714
- u.array,
715
+ f.array,
715
716
  " Constraints"
716
717
  ] }) }),
717
718
  /* @__PURE__ */ s("div", { className: "space-y-4 p-4 pt-0", children: [
718
719
  /* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-4", children: [
719
720
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
720
- /* @__PURE__ */ e(N, { htmlFor: "min-items", children: "Minimum Items" }),
721
+ /* @__PURE__ */ e(b, { htmlFor: "min-items", children: "Minimum Items" }),
721
722
  /* @__PURE__ */ e(
722
- T,
723
+ R,
723
724
  {
724
725
  id: "min-items",
725
726
  type: "number",
726
727
  placeholder: "0",
727
- value: d.minItems || "",
728
- onChange: (c) => C(
728
+ value: o.minItems || "",
729
+ onChange: (u) => E(
729
730
  "minItems",
730
- c.target.value ? parseInt(c.target.value) : void 0
731
+ u.target.value ? parseInt(u.target.value) : void 0
731
732
  ),
732
733
  "data-testid": "input-edit-minitems"
733
734
  }
734
735
  )
735
736
  ] }),
736
737
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
737
- /* @__PURE__ */ e(N, { htmlFor: "max-items", children: "Maximum Items" }),
738
+ /* @__PURE__ */ e(b, { htmlFor: "max-items", children: "Maximum Items" }),
738
739
  /* @__PURE__ */ e(
739
- T,
740
+ R,
740
741
  {
741
742
  id: "max-items",
742
743
  type: "number",
743
744
  placeholder: "∞",
744
- value: d.maxItems || "",
745
- onChange: (c) => C(
745
+ value: o.maxItems || "",
746
+ onChange: (u) => E(
746
747
  "maxItems",
747
- c.target.value ? parseInt(c.target.value) : void 0
748
+ u.target.value ? parseInt(u.target.value) : void 0
748
749
  ),
749
750
  "data-testid": "input-edit-maxitems"
750
751
  }
@@ -753,35 +754,35 @@ function Y({
753
754
  ] }),
754
755
  /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
755
756
  /* @__PURE__ */ e(
756
- Q,
757
+ Y,
757
758
  {
758
759
  id: "unique-items",
759
- checked: d.uniqueItems || !1,
760
- onCheckedChange: (c) => C("uniqueItems", c),
760
+ checked: o.uniqueItems || !1,
761
+ onCheckedChange: (u) => E("uniqueItems", u),
761
762
  "data-testid": "checkbox-edit-unique"
762
763
  }
763
764
  ),
764
- /* @__PURE__ */ e(N, { htmlFor: "unique-items", className: "cursor-pointer", children: "All items must be unique" })
765
+ /* @__PURE__ */ e(b, { htmlFor: "unique-items", className: "cursor-pointer", children: "All items must be unique" })
765
766
  ] })
766
767
  ] })
767
768
  ] })
768
769
  ] }),
769
- /* @__PURE__ */ s(we, { className: "px-6 py-4 border-t bg-background shrink-0", children: [
770
+ /* @__PURE__ */ s(Ce, { className: "px-6 py-4 border-t bg-background shrink-0", children: [
770
771
  /* @__PURE__ */ e(
771
- S,
772
+ T,
772
773
  {
773
774
  variant: "outline",
774
- onClick: _,
775
+ onClick: U,
775
776
  "data-testid": "button-cancel",
776
777
  children: "Cancel"
777
778
  }
778
779
  ),
779
780
  /* @__PURE__ */ e(
780
- S,
781
+ T,
781
782
  {
782
- onClick: H,
783
+ onClick: j,
783
784
  "data-testid": "button-save",
784
- disabled: !d.title?.trim(),
785
+ disabled: !o.title?.trim(),
785
786
  children: "Save Changes"
786
787
  }
787
788
  )
@@ -790,42 +791,42 @@ function Y({
790
791
  }
791
792
  ) });
792
793
  }
793
- function ce(t, i, a = {}) {
794
- const { allowEmpty: l = !1, onEditStart: n, onEditCancel: o } = a, [r, m] = q(!1), [D, p] = q(t);
795
- ae(() => {
796
- r || p(t);
797
- }, [t, r]);
798
- const g = () => {
799
- p(t), m(!0), n?.();
800
- }, u = (y) => {
801
- p(y);
802
- }, b = () => {
803
- const y = D.trim();
804
- if (!l && !y) {
805
- p(t), m(!1);
794
+ function ue(t, i, a = {}) {
795
+ const { allowEmpty: l = !1, onEditStart: n, onEditCancel: r } = a, [d, c] = P(!1), [C, h] = P(t);
796
+ ne(() => {
797
+ d || h(t);
798
+ }, [t, d]);
799
+ const y = () => {
800
+ h(t), c(!0), n?.();
801
+ }, f = (m) => {
802
+ h(m);
803
+ }, v = () => {
804
+ const m = C.trim();
805
+ if (!l && !m) {
806
+ h(t), c(!1);
806
807
  return;
807
808
  }
808
- y !== t && i(y), m(!1);
809
+ m !== t && i(m), c(!1);
809
810
  };
810
811
  return {
811
- isEditing: r,
812
- value: D,
813
- startEdit: g,
814
- handleChange: u,
815
- handleBlur: b,
816
- handleKeyDown: (y) => {
817
- y.key === "Enter" ? b() : y.key === "Escape" && (p(t), m(!1), o?.());
812
+ isEditing: d,
813
+ value: C,
814
+ startEdit: y,
815
+ handleChange: f,
816
+ handleBlur: v,
817
+ handleKeyDown: (m) => {
818
+ m.key === "Enter" ? v() : m.key === "Escape" && (h(t), c(!1), r?.());
818
819
  }
819
820
  };
820
821
  }
821
- function dt(t, i) {
822
- const [a, l] = q(!1);
822
+ function ot(t, i) {
823
+ const [a, l] = P(!1);
823
824
  return {
824
825
  isChangingType: a,
825
826
  setIsChangingType: l,
826
- handleTypeChange: (r) => {
827
- const m = { ...t, type: r };
828
- r !== "string" && (delete m.minLength, delete m.maxLength, delete m.pattern, delete m.enum), r !== "number" && r !== "integer" && (delete m.minimum, delete m.maximum), r !== "array" && (delete m.minItems, delete m.maxItems, delete m.uniqueItems, delete m.items), r !== "object" && delete m.children, i(m), l(!1);
827
+ handleTypeChange: (d) => {
828
+ const c = { ...t, type: d };
829
+ d !== "string" && (delete c.minLength, delete c.maxLength, delete c.pattern, delete c.enum), d !== "number" && d !== "integer" && (delete c.minimum, delete c.maximum), d !== "array" && (delete c.minItems, delete c.maxItems, delete c.uniqueItems, delete c.items), d !== "object" && delete c.children, i(c), l(!1);
829
830
  },
830
831
  availableTypes: [
831
832
  "string",
@@ -838,53 +839,53 @@ function dt(t, i) {
838
839
  ]
839
840
  };
840
841
  }
841
- const se = () => `${Date.now()}-${Math.random()}`;
842
- function re(t = {}) {
843
- const { onConfirm: i, onCancel: a, createInitialData: l } = t, [n, o] = q(!1), [r, m] = q(null), D = (b) => {
844
- const v = b ?? (l ? l() : null);
845
- m(v), o(!0);
846
- }, p = () => {
847
- o(!1), m(null), a?.();
842
+ const le = () => `${Date.now()}-${Math.random()}`;
843
+ function de(t = {}) {
844
+ const { onConfirm: i, onCancel: a, createInitialData: l } = t, [n, r] = P(!1), [d, c] = P(null), C = (v) => {
845
+ const w = v ?? (l ? l() : null);
846
+ c(w), r(!0);
847
+ }, h = () => {
848
+ r(!1), c(null), a?.();
848
849
  };
849
850
  return {
850
851
  isOpen: n,
851
- data: r,
852
- open: D,
853
- close: p,
854
- confirm: (b) => {
855
- i?.(b), o(!1), m(null);
852
+ data: d,
853
+ open: C,
854
+ close: h,
855
+ confirm: (v) => {
856
+ i?.(v), r(!1), c(null);
856
857
  },
857
- setIsOpen: (b) => {
858
- b ? o(!0) : p();
858
+ setIsOpen: (v) => {
859
+ v ? r(!0) : h();
859
860
  }
860
861
  };
861
862
  }
862
863
  function ct(t, i) {
863
- const a = re({
864
+ const a = de({
864
865
  createInitialData: () => ({
865
- id: se(),
866
+ id: le(),
866
867
  key: "",
867
868
  type: "string",
868
869
  required: !1
869
870
  }),
870
- onConfirm: (o) => {
871
+ onConfirm: (r) => {
871
872
  i({
872
873
  ...t,
873
- children: [...t.children || [], o]
874
+ children: [...t.children || [], r]
874
875
  });
875
876
  }
876
877
  });
877
878
  return {
878
879
  addChild: () => a.open(),
879
- updateChild: (o, r) => {
880
- const m = t.children.map(
881
- (D) => D.id === o ? r : D
880
+ updateChild: (r, d) => {
881
+ const c = t.children.map(
882
+ (C) => C.id === r ? d : C
882
883
  );
883
- i({ ...t, children: m });
884
+ i({ ...t, children: c });
884
885
  },
885
- deleteChild: (o) => {
886
- const r = t.children.filter((m) => m.id !== o);
887
- i({ ...t, children: r });
886
+ deleteChild: (r) => {
887
+ const d = t.children.filter((c) => c.id !== r);
888
+ i({ ...t, children: d });
888
889
  },
889
890
  addChildDialog: {
890
891
  isOpen: a.isOpen,
@@ -894,29 +895,29 @@ function ct(t, i) {
894
895
  }
895
896
  };
896
897
  }
897
- function Z({
898
+ function te({
898
899
  property: t,
899
900
  onUpdate: i,
900
901
  onDelete: a,
901
902
  level: l = 1,
902
903
  isArrayItem: n = !1
903
904
  }) {
904
- const { getTypeLabel: o, typeLabels: r, showRegex: m, keyEditable: D } = Ie(), p = re(), g = ce(
905
+ const { getTypeLabel: r, typeLabels: d, showRegex: c, keyEditable: C, readonly: h } = Se(), y = de(), f = ue(
905
906
  t.title || t.key || "",
906
- (f) => i({ ...t, title: f }),
907
+ (g) => i({ ...t, title: g }),
907
908
  { allowEmpty: !1 }
908
- ), u = ce(
909
+ ), v = ue(
909
910
  t.description || "",
910
- (f) => i({ ...t, description: f || void 0 }),
911
+ (g) => i({ ...t, description: g || void 0 }),
911
912
  { allowEmpty: !0 }
912
- ), b = dt(t, i), v = ct(t, i), y = `h${Math.min(l, 6)}`, d = t.type === "object", k = d && t.children && t.children.length > 0, E = {
913
+ ), w = ot(t, i), m = ct(t, i), o = `h${Math.min(l, 6)}`, k = t.type === "object", L = k && t.children && t.children.length > 0, O = {
913
914
  1: "text-lg font-semibold",
914
915
  2: "text-base",
915
916
  3: "text-base",
916
917
  4: "text-base",
917
918
  5: "text-sm",
918
919
  6: "text-sm"
919
- }[l] || "text-sm", R = {
920
+ }[l] || "text-sm", D = {
920
921
  1: "h-5 w-5",
921
922
  2: "h-4 w-4",
922
923
  3: "h-4 w-4",
@@ -930,81 +931,81 @@ function Z({
930
931
  !n && /* @__PURE__ */ e(
931
932
  "button",
932
933
  {
933
- onClick: () => i({ ...t, required: !t.required }),
934
- className: "shrink-0 transition-all hover:scale-110 -mt-[3px]",
935
- title: t.required ? "Required field - click to make optional" : "Optional field - click to make required",
934
+ onClick: () => !h && i({ ...t, required: !t.required }),
935
+ className: h ? "shrink-0 -mt-[3px] cursor-default" : "shrink-0 transition-all hover:scale-110 -mt-[3px]",
936
+ title: h ? t.required ? "Required field" : "Optional field" : t.required ? "Required field - click to make optional" : "Optional field - click to make required",
936
937
  children: t.required ? (
937
938
  // <span className="block w-4 h-4 rounded-full bg-primary"></span>
938
- /* @__PURE__ */ e(oe, { className: "w-6 h-6 text-primary" })
939
+ /* @__PURE__ */ e(ce, { className: "w-6 h-6 text-primary" })
939
940
  ) : (
940
941
  // <span className="block w-4 h-4 rounded-full border border-dashed border-gray-400"></span>
941
- /* @__PURE__ */ e(oe, { className: "w-6 h-6 text-border" })
942
+ /* @__PURE__ */ e(ce, { className: "w-6 h-6 text-border" })
942
943
  )
943
944
  }
944
945
  ),
945
- g.isEditing ? /* @__PURE__ */ e(
946
- T,
946
+ f.isEditing ? /* @__PURE__ */ e(
947
+ R,
947
948
  {
948
- value: g.value,
949
- onChange: (f) => g.handleChange(f.target.value),
950
- onBlur: g.handleBlur,
951
- onKeyDown: g.handleKeyDown,
949
+ value: f.value,
950
+ onChange: (g) => f.handleChange(g.target.value),
951
+ onBlur: f.handleBlur,
952
+ onKeyDown: f.handleKeyDown,
952
953
  autoFocus: !0,
953
- className: E,
954
+ className: O,
954
955
  placeholder: "Enter title"
955
956
  }
956
957
  ) : /* @__PURE__ */ s("div", { className: "flex gap-2 flex-wrap flex-1", children: [
957
958
  /* @__PURE__ */ s("div", { className: "flex items-start gap-2", children: [
958
959
  /* @__PURE__ */ e(
959
- y,
960
+ o,
960
961
  {
961
- className: `${E} cursor-pointer hover:text-primary transition-colors leading-none`,
962
- onClick: g.startEdit,
962
+ className: h ? `${O} leading-none` : `${O} cursor-pointer hover:text-primary transition-colors leading-none`,
963
+ onClick: h ? void 0 : f.startEdit,
963
964
  children: t.title || t.key || /* @__PURE__ */ e("span", { className: "text-muted-foreground italic", children: "unnamed" })
964
965
  }
965
966
  ),
966
- b.isChangingType ? /* @__PURE__ */ s(
967
- X,
967
+ w.isChangingType ? /* @__PURE__ */ s(
968
+ Q,
968
969
  {
969
970
  value: t.type,
970
- onValueChange: (f) => b.handleTypeChange(f),
971
- open: b.isChangingType,
972
- onOpenChange: b.setIsChangingType,
971
+ onValueChange: (g) => w.handleTypeChange(g),
972
+ open: w.isChangingType,
973
+ onOpenChange: w.setIsChangingType,
973
974
  children: [
974
- /* @__PURE__ */ e(J, { className: "w-[140px] h-7", children: /* @__PURE__ */ e(G, {}) }),
975
- /* @__PURE__ */ e(V, { children: b.availableTypes.map((f) => /* @__PURE__ */ e(I, { value: f, children: r[f] }, f)) })
975
+ /* @__PURE__ */ e(H, { className: "w-[140px] h-7", children: /* @__PURE__ */ e(W, {}) }),
976
+ /* @__PURE__ */ e(_, { children: w.availableTypes.map((g) => /* @__PURE__ */ e(S, { value: g, children: d[g] }, g)) })
976
977
  ]
977
978
  }
978
979
  ) : /* @__PURE__ */ e(We, { children: /* @__PURE__ */ s(Ye, { children: [
979
980
  /* @__PURE__ */ e(Ze, { asChild: !0, children: /* @__PURE__ */ s(
980
981
  "button",
981
982
  {
982
- onClick: () => b.setIsChangingType(!0),
983
- className: "cursor-pointer hover:bg-accent rounded p-0.5 -mt-0.5 transition-colors",
983
+ onClick: () => !h && w.setIsChangingType(!0),
984
+ className: h ? "rounded p-0.5 -mt-0.5 cursor-default" : "cursor-pointer hover:bg-accent rounded p-0.5 -mt-0.5 transition-colors",
984
985
  children: [
985
986
  t.type === "string" && /* @__PURE__ */ e(
986
987
  ze,
987
988
  {
988
- className: h(
989
- R,
989
+ className: p(
990
+ D,
990
991
  "text-muted-foreground"
991
992
  )
992
993
  }
993
994
  ),
994
995
  t.type === "number" && /* @__PURE__ */ e(
995
- de,
996
+ me,
996
997
  {
997
- className: h(
998
- R,
998
+ className: p(
999
+ D,
999
1000
  "text-muted-foreground"
1000
1001
  )
1001
1002
  }
1002
1003
  ),
1003
1004
  t.type === "integer" && /* @__PURE__ */ e(
1004
- de,
1005
+ me,
1005
1006
  {
1006
- className: h(
1007
- R,
1007
+ className: p(
1008
+ D,
1008
1009
  "text-muted-foreground"
1009
1010
  )
1010
1011
  }
@@ -1012,8 +1013,8 @@ function Z({
1012
1013
  t.type === "boolean" && /* @__PURE__ */ e(
1013
1014
  Be,
1014
1015
  {
1015
- className: h(
1016
- R,
1016
+ className: p(
1017
+ D,
1017
1018
  "text-muted-foreground"
1018
1019
  )
1019
1020
  }
@@ -1021,8 +1022,8 @@ function Z({
1021
1022
  t.type === "object" && /* @__PURE__ */ e(
1022
1023
  Ae,
1023
1024
  {
1024
- className: h(
1025
- R,
1025
+ className: p(
1026
+ D,
1026
1027
  "text-muted-foreground"
1027
1028
  )
1028
1029
  }
@@ -1030,8 +1031,8 @@ function Z({
1030
1031
  t.type === "array" && /* @__PURE__ */ e(
1031
1032
  Me,
1032
1033
  {
1033
- className: h(
1034
- R,
1034
+ className: p(
1035
+ D,
1035
1036
  "text-muted-foreground"
1036
1037
  )
1037
1038
  }
@@ -1039,8 +1040,8 @@ function Z({
1039
1040
  t.type === "file" && /* @__PURE__ */ e(
1040
1041
  $e,
1041
1042
  {
1042
- className: h(
1043
- R,
1043
+ className: p(
1044
+ D,
1044
1045
  "text-muted-foreground"
1045
1046
  )
1046
1047
  }
@@ -1048,102 +1049,102 @@ function Z({
1048
1049
  ]
1049
1050
  }
1050
1051
  ) }),
1051
- /* @__PURE__ */ s(ge, { children: [
1052
- o(t.type),
1053
- t.type === "array" && t.items ? ` of ${o(t.items.type)}` : "",
1054
- /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground mt-1", children: "Click to change type" })
1052
+ /* @__PURE__ */ s(ye, { children: [
1053
+ r(t.type),
1054
+ t.type === "array" && t.items ? ` of ${r(t.items.type)}` : "",
1055
+ !h && /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground mt-1", children: "Click to change type" })
1055
1056
  ] })
1056
1057
  ] }) }),
1057
- t.type === "object" && /* @__PURE__ */ e(
1058
- S,
1058
+ t.type === "object" && !h && /* @__PURE__ */ e(
1059
+ T,
1059
1060
  {
1060
1061
  variant: "ghost",
1061
1062
  size: "icon",
1062
1063
  className: "h-4 w-4",
1063
- onClick: v.addChild,
1064
+ onClick: m.addChild,
1064
1065
  "data-testid": `button-add-child-${t.id}`,
1065
- children: /* @__PURE__ */ e(B, {})
1066
+ children: /* @__PURE__ */ e($, {})
1066
1067
  }
1067
1068
  )
1068
1069
  ] }),
1069
- /* @__PURE__ */ e("div", { className: "flex-1", children: u.isEditing ? /* @__PURE__ */ e(
1070
- T,
1070
+ /* @__PURE__ */ e("div", { className: "flex-1", children: v.isEditing ? /* @__PURE__ */ e(
1071
+ R,
1071
1072
  {
1072
- value: u.value,
1073
- onChange: (f) => u.handleChange(f.target.value),
1074
- onBlur: u.handleBlur,
1075
- onKeyDown: u.handleKeyDown,
1073
+ value: v.value,
1074
+ onChange: (g) => v.handleChange(g.target.value),
1075
+ onBlur: v.handleBlur,
1076
+ onKeyDown: v.handleKeyDown,
1076
1077
  autoFocus: !0,
1077
1078
  className: "text-sm flex-1",
1078
1079
  placeholder: "Enter description"
1079
1080
  }
1080
- ) : /* @__PURE__ */ e(me, { children: t.description ? /* @__PURE__ */ e(
1081
+ ) : /* @__PURE__ */ e(X, { children: t.description ? /* @__PURE__ */ e(
1081
1082
  "p",
1082
1083
  {
1083
- className: "text-sm text-muted-foreground flex-1 min-w-[200px] cursor-pointer hover:text-foreground transition-colors",
1084
+ className: h ? "text-sm text-muted-foreground flex-1 min-w-[200px]" : "text-sm text-muted-foreground flex-1 min-w-[200px] cursor-pointer hover:text-foreground transition-colors",
1084
1085
  "data-testid": `text-description-${t.id}`,
1085
- onClick: u.startEdit,
1086
+ onClick: h ? void 0 : v.startEdit,
1086
1087
  children: t.description
1087
1088
  }
1088
- ) : /* @__PURE__ */ e(
1089
+ ) : !h && /* @__PURE__ */ e(
1089
1090
  "p",
1090
1091
  {
1091
1092
  className: "text-sm text-muted-foreground/50 flex-1 min-w-[200px] cursor-pointer hover:text-muted-foreground italic transition-colors",
1092
- onClick: u.startEdit,
1093
+ onClick: v.startEdit,
1093
1094
  children: "Add description..."
1094
1095
  }
1095
1096
  ) }) })
1096
1097
  ] })
1097
1098
  ] }) }),
1098
- /* @__PURE__ */ s("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
1099
+ !h && /* @__PURE__ */ s("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
1099
1100
  /* @__PURE__ */ e(
1100
- S,
1101
+ T,
1101
1102
  {
1102
1103
  variant: "ghost",
1103
1104
  size: "icon",
1104
1105
  className: "h-7 w-7",
1105
- onClick: () => p.open(t),
1106
+ onClick: () => y.open(t),
1106
1107
  "data-testid": `button-edit-${t.id}`,
1107
1108
  children: /* @__PURE__ */ e(Ke, { className: "w-3 h-3" })
1108
1109
  }
1109
1110
  ),
1110
- d && t.type !== "object" && /* @__PURE__ */ e(
1111
- S,
1111
+ k && t.type !== "object" && /* @__PURE__ */ e(
1112
+ T,
1112
1113
  {
1113
1114
  variant: "ghost",
1114
1115
  size: "icon",
1115
1116
  className: "h-7 w-7",
1116
- onClick: v.addChild,
1117
+ onClick: m.addChild,
1117
1118
  "data-testid": `button-add-child-${t.id}`,
1118
- children: /* @__PURE__ */ e(B, { className: "w-3 h-3" })
1119
+ children: /* @__PURE__ */ e($, { className: "w-3 h-3" })
1119
1120
  }
1120
1121
  ),
1121
1122
  /* @__PURE__ */ e(
1122
- S,
1123
+ T,
1123
1124
  {
1124
1125
  variant: "ghost",
1125
1126
  size: "icon",
1126
1127
  className: "h-7 w-7 text-muted-foreground hover:text-destructive",
1127
1128
  onClick: a,
1128
1129
  "data-testid": `button-delete-${t.id}`,
1129
- children: /* @__PURE__ */ e(fe, { className: "w-3 h-3" })
1130
+ children: /* @__PURE__ */ e(pe, { className: "w-3 h-3" })
1130
1131
  }
1131
1132
  )
1132
1133
  ] })
1133
1134
  ] }),
1134
- k && /* @__PURE__ */ e(
1135
+ L && /* @__PURE__ */ e(
1135
1136
  "div",
1136
1137
  {
1137
1138
  className: l === 1 ? "ml-6 mt-1 border-l-2 border-border pl-6" : "ml-4 mt-1 border-l border-border pl-4",
1138
- children: t.children.map((f) => /* @__PURE__ */ e(
1139
- Z,
1139
+ children: t.children.map((g) => /* @__PURE__ */ e(
1140
+ te,
1140
1141
  {
1141
- property: f,
1142
- onUpdate: (O) => v.updateChild(f.id, O),
1143
- onDelete: () => v.deleteChild(f.id),
1142
+ property: g,
1143
+ onUpdate: (E) => m.updateChild(g.id, E),
1144
+ onDelete: () => m.deleteChild(g.id),
1144
1145
  level: l + 1
1145
1146
  },
1146
- f.id
1147
+ g.id
1147
1148
  ))
1148
1149
  }
1149
1150
  ),
@@ -1153,14 +1154,14 @@ function Z({
1153
1154
  className: l === 1 ? "ml-6 mt-1 border-l-2 border-border pl-6" : "ml-4 mt-1 border-l border-border pl-4",
1154
1155
  children: [
1155
1156
  /* @__PURE__ */ s("div", { className: "mb-2 text-xs text-muted-foreground font-semibold uppercase", children: [
1156
- o("array"),
1157
+ r("array"),
1157
1158
  " Items"
1158
1159
  ] }),
1159
1160
  /* @__PURE__ */ e(
1160
- Z,
1161
+ te,
1161
1162
  {
1162
1163
  property: t.items,
1163
- onUpdate: (f) => i({ ...t, items: f }),
1164
+ onUpdate: (g) => i({ ...t, items: g }),
1164
1165
  onDelete: () => i({ ...t, items: void 0 }),
1165
1166
  level: l + 1,
1166
1167
  isArrayItem: !0
@@ -1170,44 +1171,44 @@ function Z({
1170
1171
  }
1171
1172
  ),
1172
1173
  /* @__PURE__ */ e(
1173
- Y,
1174
+ ee,
1174
1175
  {
1175
- property: p.data || t,
1176
- open: p.isOpen,
1177
- onOpenChange: p.setIsOpen,
1178
- onSave: (f) => {
1179
- i(f), p.close();
1176
+ property: y.data || t,
1177
+ open: y.isOpen,
1178
+ onOpenChange: y.setIsOpen,
1179
+ onSave: (g) => {
1180
+ i(g), y.close();
1180
1181
  },
1181
1182
  isArrayItem: n,
1182
1183
  isNewProperty: !1
1183
1184
  }
1184
1185
  ),
1185
- v.addChildDialog.isOpen && v.addChildDialog.data && /* @__PURE__ */ e(
1186
- Y,
1186
+ m.addChildDialog.isOpen && m.addChildDialog.data && /* @__PURE__ */ e(
1187
+ ee,
1187
1188
  {
1188
- property: v.addChildDialog.data,
1189
- open: v.addChildDialog.isOpen,
1189
+ property: m.addChildDialog.data,
1190
+ open: m.addChildDialog.isOpen,
1190
1191
  isNewProperty: !0,
1191
- onOpenChange: v.addChildDialog.setIsOpen,
1192
- onSave: v.addChildDialog.confirm
1192
+ onOpenChange: m.addChildDialog.setIsOpen,
1193
+ onSave: m.addChildDialog.confirm
1193
1194
  }
1194
1195
  )
1195
1196
  ] });
1196
1197
  }
1197
- const le = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1198
+ const oe = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1198
1199
  "div",
1199
1200
  {
1200
1201
  ref: a,
1201
- className: h("rounded-xl border bg-card text-card-foreground", t),
1202
+ className: p("rounded-xl border bg-card text-card-foreground", t),
1202
1203
  ...i
1203
1204
  }
1204
1205
  ));
1205
- le.displayName = "Card";
1206
+ oe.displayName = "Card";
1206
1207
  const mt = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1207
1208
  "div",
1208
1209
  {
1209
1210
  ref: a,
1210
- className: h("flex flex-col space-y-1.5 p-6", t),
1211
+ className: p("flex flex-col space-y-1.5 p-6", t),
1211
1212
  ...i
1212
1213
  }
1213
1214
  ));
@@ -1216,7 +1217,7 @@ const ut = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1216
1217
  "div",
1217
1218
  {
1218
1219
  ref: a,
1219
- className: h("font-semibold leading-none tracking-tight", t),
1220
+ className: p("font-semibold leading-none tracking-tight", t),
1220
1221
  ...i
1221
1222
  }
1222
1223
  ));
@@ -1225,18 +1226,18 @@ const ht = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1225
1226
  "div",
1226
1227
  {
1227
1228
  ref: a,
1228
- className: h("text-sm text-muted-foreground", t),
1229
+ className: p("text-sm text-muted-foreground", t),
1229
1230
  ...i
1230
1231
  }
1231
1232
  ));
1232
1233
  ht.displayName = "CardDescription";
1233
- const ft = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e("div", { ref: a, className: h("p-6 pt-0", t), ...i }));
1234
+ const ft = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e("div", { ref: a, className: p("p-6 pt-0", t), ...i }));
1234
1235
  ft.displayName = "CardContent";
1235
1236
  const pt = x.forwardRef(({ className: t, ...i }, a) => /* @__PURE__ */ e(
1236
1237
  "div",
1237
1238
  {
1238
1239
  ref: a,
1239
- className: h("flex items-center p-6 pt-0", t),
1240
+ className: p("flex items-center p-6 pt-0", t),
1240
1241
  ...i
1241
1242
  }
1242
1243
  ));
@@ -1249,28 +1250,28 @@ const gt = () => new Promise((t, i) => {
1249
1250
  i(new Error("No file selected"));
1250
1251
  return;
1251
1252
  }
1252
- const o = new FileReader();
1253
- o.onload = (r) => {
1253
+ const r = new FileReader();
1254
+ r.onload = (d) => {
1254
1255
  try {
1255
- const m = JSON.parse(r.target?.result);
1256
- t(m);
1256
+ const c = JSON.parse(d.target?.result);
1257
+ t(c);
1257
1258
  } catch {
1258
1259
  i(new Error("Invalid JSON file"));
1259
1260
  }
1260
- }, o.onerror = () => i(new Error("Failed to read file")), o.readAsText(n);
1261
+ }, r.onerror = () => i(new Error("Failed to read file")), r.readAsText(n);
1261
1262
  }, a.click();
1262
- }), Se = (t, i = "schema.json") => {
1263
- const a = JSON.stringify(t, null, 2), l = new Blob([a], { type: "application/json" }), n = URL.createObjectURL(l), o = document.createElement("a");
1264
- o.href = n, o.download = i, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(n);
1263
+ }), Te = (t, i = "schema.json") => {
1264
+ const a = JSON.stringify(t, null, 2), l = new Blob([a], { type: "application/json" }), n = URL.createObjectURL(l), r = document.createElement("a");
1265
+ r.href = n, r.download = i, document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
1265
1266
  };
1266
1267
  function yt({ schema: t }) {
1267
- const [i, a] = q(!1), l = JSON.stringify(t, null, 2);
1268
+ const [i, a] = P(!1), l = JSON.stringify(t, null, 2);
1268
1269
  return /* @__PURE__ */ s("div", { className: "h-full flex flex-col", children: [
1269
1270
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between p-4 border-b", children: [
1270
1271
  /* @__PURE__ */ e("h2", { className: "text-sm font-medium", children: "JSON Schema Output" }),
1271
1272
  /* @__PURE__ */ s("div", { className: "flex gap-2", children: [
1272
1273
  /* @__PURE__ */ e(
1273
- S,
1274
+ T,
1274
1275
  {
1275
1276
  variant: "outline",
1276
1277
  size: "sm",
@@ -1282,12 +1283,12 @@ function yt({ schema: t }) {
1282
1283
  }
1283
1284
  ),
1284
1285
  /* @__PURE__ */ e(
1285
- S,
1286
+ T,
1286
1287
  {
1287
1288
  variant: "outline",
1288
1289
  size: "sm",
1289
1290
  onClick: () => {
1290
- Se(t, "schema.json");
1291
+ Te(t, "schema.json");
1291
1292
  },
1292
1293
  "data-testid": "button-download",
1293
1294
  children: /* @__PURE__ */ e(He, { className: "w-4 h-4" })
@@ -1295,7 +1296,7 @@ function yt({ schema: t }) {
1295
1296
  )
1296
1297
  ] })
1297
1298
  ] }),
1298
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(le, { className: "m-4 bg-muted/30", children: /* @__PURE__ */ e(
1299
+ /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ e(oe, { className: "m-4 bg-muted/30", children: /* @__PURE__ */ e(
1299
1300
  "pre",
1300
1301
  {
1301
1302
  className: "p-6 text-xs font-mono overflow-auto",
@@ -1309,27 +1310,28 @@ function vt({
1309
1310
  title: t,
1310
1311
  description: i,
1311
1312
  version: a,
1312
- onUpdate: l
1313
+ onUpdate: l,
1314
+ readonly: n = !1
1313
1315
  }) {
1314
- const [n, o] = q(!1);
1315
- return /* @__PURE__ */ s(le, { className: "p-4", children: [
1316
+ const [r, d] = P(!1);
1317
+ return /* @__PURE__ */ s(oe, { className: "p-4", children: [
1316
1318
  /* @__PURE__ */ s(
1317
- S,
1319
+ T,
1318
1320
  {
1319
1321
  variant: "ghost",
1320
- onClick: () => o(!n),
1322
+ onClick: () => d(!r),
1321
1323
  className: "w-full justify-between px-2 h-auto hover:bg-transparent",
1322
1324
  "data-testid": "button-toggle-metadata",
1323
1325
  children: [
1324
1326
  /* @__PURE__ */ e("h3", { className: "text-sm font-medium", children: "Schema Metadata" }),
1325
- n ? /* @__PURE__ */ e(ie, { className: "w-4 h-4" }) : /* @__PURE__ */ e(_e, { className: "w-4 h-4" })
1327
+ r ? /* @__PURE__ */ e(se, { className: "w-4 h-4" }) : /* @__PURE__ */ e(_e, { className: "w-4 h-4" })
1326
1328
  ]
1327
1329
  }
1328
1330
  ),
1329
- n && /* @__PURE__ */ s("div", { className: "mt-4 space-y-4", children: [
1331
+ r && /* @__PURE__ */ s("div", { className: "mt-4 space-y-4", children: [
1330
1332
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
1331
1333
  /* @__PURE__ */ e(
1332
- N,
1334
+ b,
1333
1335
  {
1334
1336
  htmlFor: "schema-title",
1335
1337
  className: "text-xs text-muted-foreground",
@@ -1337,19 +1339,20 @@ function vt({
1337
1339
  }
1338
1340
  ),
1339
1341
  /* @__PURE__ */ e(
1340
- T,
1342
+ R,
1341
1343
  {
1342
1344
  id: "schema-title",
1343
1345
  placeholder: "My Schema",
1344
1346
  value: t,
1345
- onChange: (r) => l("title", r.target.value),
1346
- "data-testid": "input-title"
1347
+ onChange: (c) => l("title", c.target.value),
1348
+ "data-testid": "input-title",
1349
+ disabled: n
1347
1350
  }
1348
1351
  )
1349
1352
  ] }),
1350
1353
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
1351
1354
  /* @__PURE__ */ e(
1352
- N,
1355
+ b,
1353
1356
  {
1354
1357
  htmlFor: "schema-description",
1355
1358
  className: "text-xs text-muted-foreground",
@@ -1357,21 +1360,22 @@ function vt({
1357
1360
  }
1358
1361
  ),
1359
1362
  /* @__PURE__ */ e(
1360
- ne,
1363
+ re,
1361
1364
  {
1362
1365
  id: "schema-description",
1363
1366
  placeholder: "Describe your schema...",
1364
1367
  value: i,
1365
- onChange: (r) => l("description", r.target.value),
1368
+ onChange: (c) => l("description", c.target.value),
1366
1369
  className: "resize-none",
1367
1370
  rows: 3,
1368
- "data-testid": "input-schema-description"
1371
+ "data-testid": "input-schema-description",
1372
+ disabled: n
1369
1373
  }
1370
1374
  )
1371
1375
  ] }),
1372
1376
  /* @__PURE__ */ s("div", { className: "space-y-2", children: [
1373
1377
  /* @__PURE__ */ e(
1374
- N,
1378
+ b,
1375
1379
  {
1376
1380
  htmlFor: "schema-version",
1377
1381
  className: "text-xs text-muted-foreground",
@@ -1379,39 +1383,40 @@ function vt({
1379
1383
  }
1380
1384
  ),
1381
1385
  /* @__PURE__ */ e(
1382
- T,
1386
+ R,
1383
1387
  {
1384
1388
  id: "schema-version",
1385
1389
  placeholder: "1.0.0",
1386
1390
  value: a,
1387
- onChange: (r) => l("version", r.target.value),
1388
- "data-testid": "input-version"
1391
+ onChange: (c) => l("version", c.target.value),
1392
+ "data-testid": "input-version",
1393
+ disabled: n
1389
1394
  }
1390
1395
  )
1391
1396
  ] })
1392
1397
  ] })
1393
1398
  ] });
1394
1399
  }
1395
- const $ = (t, i, a = !0) => {
1400
+ const V = (t, i, a = !0) => {
1396
1401
  const l = {
1397
1402
  type: "object"
1398
1403
  };
1399
1404
  a && i && (i.title && (l.title = i.title), i.description && (l.description = i.description));
1400
- const n = ee(t);
1405
+ const n = ae(t);
1401
1406
  Object.keys(n).length > 0 && (l.properties = n);
1402
- const o = t.filter((r) => r.required && r.key).map((r) => r.key);
1403
- return o.length > 0 && (l.required = o), l;
1404
- }, ee = (t) => {
1407
+ const r = t.filter((d) => d.required && d.key).map((d) => d.key);
1408
+ return r.length > 0 && (l.required = r), l;
1409
+ }, ae = (t) => {
1405
1410
  const i = {};
1406
1411
  return t.forEach((a) => {
1407
1412
  if (!a.key) return;
1408
1413
  const n = { type: a.type === "file" ? "string" : a.type };
1409
- if (a.title && (n.title = a.title), a.description && (n.description = a.description), a.type === "file" && (n.format = "filename"), a.type === "string" && (a.minLength !== void 0 && (n.minLength = a.minLength), a.maxLength !== void 0 && (n.maxLength = a.maxLength), a.pattern && (n.pattern = a.pattern), a.enum && a.enum.length > 0 && (n.enum = a.enum)), (a.type === "number" || a.type === "integer") && (a.minimum !== void 0 && (n.minimum = a.minimum), a.maximum !== void 0 && (n.maximum = a.maximum)), a.type === "array" && (a.minItems !== void 0 && (n.minItems = a.minItems), a.maxItems !== void 0 && (n.maxItems = a.maxItems), a.uniqueItems && (n.uniqueItems = a.uniqueItems), a.items && (n.items = ee([a.items])[a.items.key] || {
1414
+ if (a.title && (n.title = a.title), a.description && (n.description = a.description), a.type === "file" && (n.format = "filename"), a.type === "string" && (a.minLength !== void 0 && (n.minLength = a.minLength), a.maxLength !== void 0 && (n.maxLength = a.maxLength), a.pattern && (n.pattern = a.pattern), a.enum && a.enum.length > 0 && (n.enum = a.enum)), (a.type === "number" || a.type === "integer") && (a.minimum !== void 0 && (n.minimum = a.minimum), a.maximum !== void 0 && (n.maximum = a.maximum)), a.type === "array" && (a.minItems !== void 0 && (n.minItems = a.minItems), a.maxItems !== void 0 && (n.maxItems = a.maxItems), a.uniqueItems && (n.uniqueItems = a.uniqueItems), a.items && (n.items = ae([a.items])[a.items.key] || {
1410
1415
  type: a.items.type
1411
1416
  })), a.type === "object" && a.children && a.children.length > 0) {
1412
- n.properties = ee(a.children);
1413
- const o = a.children.filter((r) => r.required && r.key).map((r) => r.key);
1414
- o.length > 0 && (n.required = o);
1417
+ n.properties = ae(a.children);
1418
+ const r = a.children.filter((d) => d.required && d.key).map((d) => d.key);
1419
+ r.length > 0 && (n.required = r);
1415
1420
  }
1416
1421
  i[a.key] = n;
1417
1422
  }), i;
@@ -1424,29 +1429,29 @@ const $ = (t, i, a = !0) => {
1424
1429
  description: typeof t.description == "string" ? t.description : "",
1425
1430
  version: "1.0.0"
1426
1431
  // Default version
1427
- }), t.properties && typeof t.properties == "object" && (i.properties = te(
1432
+ }), t.properties && typeof t.properties == "object" && (i.properties = ie(
1428
1433
  t.properties,
1429
1434
  Array.isArray(t.required) ? t.required : []
1430
1435
  )), i;
1431
- }, te = (t, i = []) => t ? Object.entries(t).filter(([, a]) => typeof a == "object").map(([a, l]) => {
1436
+ }, ie = (t, i = []) => t ? Object.entries(t).filter(([, a]) => typeof a == "object").map(([a, l]) => {
1432
1437
  const n = l;
1433
- let o = typeof n.type == "string" ? n.type : "string";
1434
- o === "string" && n.format === "filename" && (o = "file");
1435
- const r = {
1436
- id: se(),
1438
+ let r = typeof n.type == "string" ? n.type : "string";
1439
+ r === "string" && n.format === "filename" && (r = "file");
1440
+ const d = {
1441
+ id: le(),
1437
1442
  key: a,
1438
1443
  title: typeof n.title == "string" ? n.title : void 0,
1439
- type: o,
1444
+ type: r,
1440
1445
  description: typeof n.description == "string" ? n.description : void 0,
1441
1446
  required: i.includes(a)
1442
1447
  };
1443
- return n.minLength !== void 0 && (r.minLength = n.minLength), n.maxLength !== void 0 && (r.maxLength = n.maxLength), n.pattern && (r.pattern = n.pattern), n.enum && Array.isArray(n.enum) && (r.enum = n.enum), n.minimum !== void 0 && (r.minimum = n.minimum), n.maximum !== void 0 && (r.maximum = n.maximum), n.minItems !== void 0 && (r.minItems = n.minItems), n.maxItems !== void 0 && (r.maxItems = n.maxItems), n.uniqueItems && (r.uniqueItems = n.uniqueItems), r.type === "array" && n.items && typeof n.items == "object" && !Array.isArray(n.items) && (r.items = te(
1448
+ return n.minLength !== void 0 && (d.minLength = n.minLength), n.maxLength !== void 0 && (d.maxLength = n.maxLength), n.pattern && (d.pattern = n.pattern), n.enum && Array.isArray(n.enum) && (d.enum = n.enum), n.minimum !== void 0 && (d.minimum = n.minimum), n.maximum !== void 0 && (d.maximum = n.maximum), n.minItems !== void 0 && (d.minItems = n.minItems), n.maxItems !== void 0 && (d.maxItems = n.maxItems), n.uniqueItems && (d.uniqueItems = n.uniqueItems), d.type === "array" && n.items && typeof n.items == "object" && !Array.isArray(n.items) && (d.items = ie(
1444
1449
  { item: n.items },
1445
1450
  []
1446
- ).find((m) => m.key === "item")), n.properties && typeof n.properties == "object" && (r.children = te(
1451
+ ).find((c) => c.key === "item")), n.properties && typeof n.properties == "object" && (d.children = ie(
1447
1452
  n.properties,
1448
1453
  Array.isArray(n.required) ? n.required : []
1449
- )), r;
1454
+ )), d;
1450
1455
  }) : [], bt = ({
1451
1456
  schema: t,
1452
1457
  onChange: i,
@@ -1455,76 +1460,76 @@ const $ = (t, i, a = !0) => {
1455
1460
  const { properties: l, metadata: n } = Le(
1456
1461
  () => xt(t),
1457
1462
  [t]
1458
- ), o = l, r = n || {
1463
+ ), r = l, d = n || {
1459
1464
  title: "",
1460
1465
  description: "",
1461
1466
  version: ""
1462
- }, m = P(() => ({
1463
- id: se(),
1467
+ }, c = F(() => ({
1468
+ id: le(),
1464
1469
  key: "",
1465
1470
  type: "string",
1466
1471
  required: !1
1467
- }), []), D = P(
1468
- (y, d) => {
1469
- const k = o.some((f) => f.id === y);
1470
- let E;
1471
- k ? E = o.map((f) => f.id === y ? d : f) : E = [...o, d];
1472
- const R = $(
1473
- E,
1474
- r,
1472
+ }), []), C = F(
1473
+ (m, o) => {
1474
+ const k = r.some((D) => D.id === m);
1475
+ let L;
1476
+ k ? L = r.map((D) => D.id === m ? o : D) : L = [...r, o];
1477
+ const O = V(
1478
+ L,
1479
+ d,
1475
1480
  a
1476
1481
  );
1477
- i(R);
1482
+ i(O);
1478
1483
  },
1479
- [o, r, a, i]
1480
- ), p = P(
1481
- (y) => {
1482
- const d = o.filter((E) => E.id !== y), k = $(
1484
+ [r, d, a, i]
1485
+ ), h = F(
1486
+ (m) => {
1487
+ const o = r.filter((L) => L.id !== m), k = V(
1488
+ o,
1483
1489
  d,
1484
- r,
1485
1490
  a
1486
1491
  );
1487
1492
  i(k);
1488
1493
  },
1489
- [o, r, a, i]
1490
- ), g = P(() => {
1491
- const d = $([], { title: "", description: "" }, a);
1492
- i(d);
1493
- }, [a, i]), u = P(
1494
- (y, d) => {
1495
- const k = { ...r, [y]: d }, E = $(
1496
- o,
1494
+ [r, d, a, i]
1495
+ ), y = F(() => {
1496
+ const o = V([], { title: "", description: "" }, a);
1497
+ i(o);
1498
+ }, [a, i]), f = F(
1499
+ (m, o) => {
1500
+ const k = { ...d, [m]: o }, L = V(
1501
+ r,
1497
1502
  k,
1498
1503
  a
1499
1504
  );
1500
- i(E);
1505
+ i(L);
1501
1506
  },
1502
- [o, r, a, i]
1503
- ), b = P(async () => {
1504
- const y = await gt();
1505
- i(y);
1506
- }, [i]), v = P(() => {
1507
- Se(t, "schema.json");
1507
+ [r, d, a, i]
1508
+ ), v = F(async () => {
1509
+ const m = await gt();
1510
+ i(m);
1511
+ }, [i]), w = F(() => {
1512
+ Te(t, "schema.json");
1508
1513
  }, [t]);
1509
1514
  return {
1510
- properties: o,
1511
- metadata: r,
1512
- addProperty: m,
1513
- updateProperty: D,
1514
- deleteProperty: p,
1515
- clearAll: g,
1516
- updateMetadata: u,
1517
- importSchema: b,
1518
- downloadSchema: v
1515
+ properties: r,
1516
+ metadata: d,
1517
+ addProperty: c,
1518
+ updateProperty: C,
1519
+ deleteProperty: h,
1520
+ clearAll: y,
1521
+ updateMetadata: f,
1522
+ importSchema: v,
1523
+ downloadSchema: w
1519
1524
  };
1520
1525
  };
1521
1526
  function Nt() {
1522
- const [t, i] = q("light");
1523
- return ae(() => {
1527
+ const [t, i] = P("light");
1528
+ return ne(() => {
1524
1529
  const n = localStorage.getItem("theme") || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
1525
1530
  i(n), document.documentElement.classList.toggle("dark", n === "dark");
1526
1531
  }, []), /* @__PURE__ */ e(
1527
- S,
1532
+ T,
1528
1533
  {
1529
1534
  variant: "ghost",
1530
1535
  size: "icon",
@@ -1537,162 +1542,167 @@ function Nt() {
1537
1542
  }
1538
1543
  );
1539
1544
  }
1540
- function Rt({
1545
+ function Et({
1541
1546
  schema: t,
1542
1547
  onChange: i,
1543
1548
  showMetadata: a = !1,
1544
1549
  showImport: l = !0,
1545
1550
  showClear: n = !0,
1546
- showOutput: o = !0,
1547
- showHeader: r = !0,
1548
- className: m = "",
1549
- showSummary: D = !1,
1550
- typeLabels: p,
1551
- propertyLabel: g = { singular: "property", plural: "properties" },
1552
- showRegex: u = !1,
1553
- keyEditable: b = !1
1551
+ showOutput: r = !0,
1552
+ showHeader: d = !0,
1553
+ className: c = "",
1554
+ showSummary: C = !1,
1555
+ typeLabels: h,
1556
+ propertyLabel: y = { singular: "property", plural: "properties" },
1557
+ showRegex: f = !1,
1558
+ keyEditable: v = !1,
1559
+ readonly: w = !1
1554
1560
  }) {
1555
1561
  const {
1556
- properties: v,
1557
- metadata: y,
1558
- addProperty: d,
1559
- updateProperty: k,
1560
- deleteProperty: E,
1561
- clearAll: R,
1562
- updateMetadata: f,
1563
- importSchema: O
1562
+ properties: m,
1563
+ metadata: o,
1564
+ addProperty: k,
1565
+ updateProperty: L,
1566
+ deleteProperty: O,
1567
+ clearAll: D,
1568
+ updateMetadata: g,
1569
+ importSchema: E
1564
1570
  } = bt({
1565
1571
  schema: t,
1566
1572
  onChange: i,
1567
1573
  includeMetadata: a
1568
- }), C = re({
1569
- createInitialData: () => d(),
1570
- onConfirm: (c) => {
1571
- k(c.id, c);
1574
+ }), j = de({
1575
+ createInitialData: () => k(),
1576
+ onConfirm: (I) => {
1577
+ L(I.id, I);
1572
1578
  }
1573
- }), H = () => {
1574
- R();
1575
- }, _ = async () => {
1576
- await O();
1579
+ }), U = () => {
1580
+ D();
1581
+ }, u = async () => {
1582
+ await E();
1577
1583
  };
1578
1584
  return /* @__PURE__ */ e(
1579
- ot,
1585
+ dt,
1580
1586
  {
1581
1587
  config: {
1582
- typeLabels: p,
1583
- propertyLabel: g,
1584
- showRegex: u,
1585
- keyEditable: b
1588
+ typeLabels: h,
1589
+ propertyLabel: y,
1590
+ showRegex: f,
1591
+ keyEditable: v,
1592
+ readonly: w
1586
1593
  },
1587
- children: /* @__PURE__ */ s("div", { className: `${m} flex flex-col json-schema-builder-react`, children: [
1588
- r && /* @__PURE__ */ e("header", { className: "h-16 border-b flex items-center justify-between px-6", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
1589
- l && /* @__PURE__ */ e(
1590
- S,
1594
+ children: /* @__PURE__ */ s("div", { className: `${c} flex flex-col json-schema-builder-react`, children: [
1595
+ d && /* @__PURE__ */ e("header", { className: "h-16 border-b flex items-center justify-between px-6", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-3", children: [
1596
+ !w && l && /* @__PURE__ */ e(
1597
+ T,
1591
1598
  {
1592
1599
  variant: "outline",
1593
1600
  size: "sm",
1594
- onClick: _,
1601
+ onClick: u,
1595
1602
  "data-testid": "button-import",
1596
1603
  children: /* @__PURE__ */ e(Ge, { className: "w-4 h-4" })
1597
1604
  }
1598
1605
  ),
1599
- n && /* @__PURE__ */ e(
1600
- S,
1606
+ !w && n && /* @__PURE__ */ e(
1607
+ T,
1601
1608
  {
1602
1609
  variant: "outline",
1603
1610
  size: "sm",
1604
- onClick: H,
1605
- disabled: v.length === 0,
1611
+ onClick: U,
1612
+ disabled: m.length === 0,
1606
1613
  "data-testid": "button-clear",
1607
- children: /* @__PURE__ */ e(fe, { className: "w-4 h-4" })
1614
+ children: /* @__PURE__ */ e(pe, { className: "w-4 h-4" })
1608
1615
  }
1609
1616
  ),
1610
1617
  /* @__PURE__ */ e(Nt, {})
1611
1618
  ] }) }),
1612
1619
  /* @__PURE__ */ s("div", { className: "flex-1 flex overflow-hidden", children: [
1613
- /* @__PURE__ */ e("div", { className: o ? "w-3/5 border-r" : "w-full", children: /* @__PURE__ */ s("div", { className: "h-full flex flex-col", children: [
1620
+ /* @__PURE__ */ e("div", { className: r ? "w-3/5 border-r" : "w-full", children: /* @__PURE__ */ s("div", { className: "h-full flex flex-col", children: [
1614
1621
  /* @__PURE__ */ s("div", { className: "flex-1 overflow-auto p-2 space-y-4", children: [
1615
1622
  a && /* @__PURE__ */ e(
1616
1623
  vt,
1617
1624
  {
1618
- title: y.title,
1619
- description: y.description,
1620
- version: y.version,
1621
- onUpdate: (c, j) => f(c, j)
1625
+ title: o.title,
1626
+ description: o.description,
1627
+ version: o.version,
1628
+ onUpdate: (I, B) => g(I, B),
1629
+ readonly: w
1622
1630
  }
1623
1631
  ),
1624
- v.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
1625
- /* @__PURE__ */ e("div", { className: "w-16 h-16 rounded-full bg-muted flex items-center justify-center mb-4", children: /* @__PURE__ */ e(B, { className: "w-8 h-8 text-muted-foreground" }) }),
1632
+ m.length === 0 ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center py-16 text-center", children: [
1633
+ /* @__PURE__ */ e("div", { className: "w-16 h-16 rounded-full bg-muted flex items-center justify-center mb-4", children: /* @__PURE__ */ e($, { className: "w-8 h-8 text-muted-foreground" }) }),
1626
1634
  /* @__PURE__ */ s("h2", { className: "text-lg font-medium mb-2", children: [
1627
1635
  "No ",
1628
- g.plural,
1636
+ y.plural,
1629
1637
  " yet"
1630
1638
  ] }),
1631
- /* @__PURE__ */ s("p", { className: "text-sm text-muted-foreground mb-6 max-w-sm", children: [
1632
- "Start building your JSON schema by adding your first",
1633
- " ",
1634
- g.singular
1635
- ] }),
1636
- /* @__PURE__ */ s(
1637
- S,
1638
- {
1639
- onClick: () => C.open(),
1640
- "data-testid": "button-add-first",
1641
- children: [
1642
- /* @__PURE__ */ e(B, { className: "w-4 h-4 mr-2" }),
1643
- "Add ",
1644
- g.singular
1645
- ]
1646
- }
1647
- )
1648
- ] }) : /* @__PURE__ */ s(me, { children: [
1649
- /* @__PURE__ */ e("div", { className: "space-y-1", children: v.map((c) => /* @__PURE__ */ e(
1650
- Z,
1639
+ !w && /* @__PURE__ */ s(X, { children: [
1640
+ /* @__PURE__ */ s("p", { className: "text-sm text-muted-foreground mb-6 max-w-sm", children: [
1641
+ "Start building your JSON schema by adding your first",
1642
+ " ",
1643
+ y.singular
1644
+ ] }),
1645
+ /* @__PURE__ */ s(
1646
+ T,
1647
+ {
1648
+ onClick: () => j.open(),
1649
+ "data-testid": "button-add-first",
1650
+ children: [
1651
+ /* @__PURE__ */ e($, { className: "w-4 h-4 mr-2" }),
1652
+ "Add ",
1653
+ y.singular
1654
+ ]
1655
+ }
1656
+ )
1657
+ ] })
1658
+ ] }) : /* @__PURE__ */ s(X, { children: [
1659
+ /* @__PURE__ */ e("div", { className: "space-y-1", children: m.map((I) => /* @__PURE__ */ e(
1660
+ te,
1651
1661
  {
1652
- property: c,
1653
- onUpdate: (j) => k(c.id, j),
1654
- onDelete: () => E(c.id)
1662
+ property: I,
1663
+ onUpdate: (B) => L(I.id, B),
1664
+ onDelete: () => O(I.id)
1655
1665
  },
1656
- c.id
1666
+ I.id
1657
1667
  )) }),
1658
- D && /* @__PURE__ */ s("div", { className: "pt-4 border-t flex items-center justify-between text-sm text-muted-foreground", children: [
1668
+ C && /* @__PURE__ */ s("div", { className: "pt-4 border-t flex items-center justify-between text-sm text-muted-foreground", children: [
1659
1669
  /* @__PURE__ */ s("span", { children: [
1660
- v.length,
1670
+ m.length,
1661
1671
  " ",
1662
- v.length === 1 ? g.singular : g.plural
1672
+ m.length === 1 ? y.singular : y.plural
1663
1673
  ] }),
1664
1674
  /* @__PURE__ */ s("span", { children: [
1665
- v.filter((c) => c.required).length,
1675
+ m.filter((I) => I.required).length,
1666
1676
  " required"
1667
1677
  ] })
1668
1678
  ] })
1669
1679
  ] })
1670
1680
  ] }),
1671
- v.length > 0 && /* @__PURE__ */ e("div", { className: "border-t p-2 pt-4 bg-background", children: /* @__PURE__ */ s(
1672
- S,
1681
+ m.length > 0 && !w && /* @__PURE__ */ e("div", { className: "border-t p-2 pt-4 bg-background", children: /* @__PURE__ */ s(
1682
+ T,
1673
1683
  {
1674
- onClick: () => C.open(),
1684
+ onClick: () => j.open(),
1675
1685
  className: "w-full",
1676
1686
  variant: "outline",
1677
1687
  "data-testid": "button-add-property",
1678
1688
  children: [
1679
- /* @__PURE__ */ e(B, { className: "w-4 h-4" }),
1689
+ /* @__PURE__ */ e($, { className: "w-4 h-4" }),
1680
1690
  "Add ",
1681
- g.singular
1691
+ y.singular
1682
1692
  ]
1683
1693
  }
1684
1694
  ) })
1685
1695
  ] }) }),
1686
- o && /* @__PURE__ */ e("div", { className: "w-2/5", children: /* @__PURE__ */ e(yt, { schema: t }) })
1696
+ r && /* @__PURE__ */ e("div", { className: "w-2/5", children: /* @__PURE__ */ e(yt, { schema: t }) })
1687
1697
  ] }),
1688
- C.isOpen && C.data && /* @__PURE__ */ e(
1689
- Y,
1698
+ j.isOpen && j.data && /* @__PURE__ */ e(
1699
+ ee,
1690
1700
  {
1691
- property: C.data,
1692
- open: C.isOpen,
1701
+ property: j.data,
1702
+ open: j.isOpen,
1693
1703
  isNewProperty: !0,
1694
- onOpenChange: C.setIsOpen,
1695
- onSave: C.confirm
1704
+ onOpenChange: j.setIsOpen,
1705
+ onSave: j.confirm
1696
1706
  }
1697
1707
  )
1698
1708
  ] })
@@ -1700,6 +1710,6 @@ function Rt({
1700
1710
  );
1701
1711
  }
1702
1712
  export {
1703
- Rt as JsonSchemaBuilder,
1704
- Y as PropertyEditDialog
1713
+ Et as JsonSchemaBuilder,
1714
+ ee as PropertyEditDialog
1705
1715
  };