@blocklet/pages-kit-inner-components 0.5.42 → 0.5.44

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/lib/es/setting.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { jsx as r, jsxs as O, Fragment as q } from "react/jsx-runtime";
2
- import { t as ge, g as We, b as te, E as ur, n as Ke, h as Pe } from "./chunks/state-COB6reM7.js";
3
- import ae from "@arcblock/ux/lib/Empty";
2
+ import { t as ge, g as We, b as ae, E as ur, n as Ke, h as Pe } from "./chunks/state-COB6reM7.js";
3
+ import pe from "@arcblock/ux/lib/Empty";
4
4
  import { useLocaleContext as V } from "@arcblock/ux/lib/Locale/context";
5
5
  import { CodeEditor as ke } from "@blocklet/code-editor";
6
6
  import ar from "@mui/icons-material/AddRounded";
7
7
  import pr from "@mui/icons-material/ArrowDownward";
8
8
  import mr from "@mui/icons-material/ArrowUpward";
9
9
  import fr from "@mui/icons-material/DeleteOutline";
10
- import { Typography as W, TextField as R, Stack as j, FormLabel as se, Box as N, TableContainer as hr, Paper as ie, Table as Fe, TableHead as Me, TableRow as ce, TableCell as de, TableBody as Je, Button as A, IconButton as le, InputAdornment as pe, alpha as fe, Tooltip as Y, buttonClasses as br, Dialog as we, DialogTitle as _e, DialogContent as $e, DialogActions as He, FormControlLabel as Ge, Checkbox as yr, Autocomplete as Le, Switch as vr, MenuItem as he, Collapse as xr, Divider as gr, Popper as Pr } from "@mui/material";
10
+ import { Typography as W, TextField as R, Stack as j, FormLabel as se, Box as N, TableContainer as hr, Paper as te, Table as Me, TableHead as Fe, TableRow as ce, TableCell as de, TableBody as Je, Button as A, IconButton as ie, InputAdornment as ne, alpha as fe, Tooltip as Y, buttonClasses as br, Dialog as we, DialogTitle as _e, DialogContent as $e, DialogActions as He, FormControlLabel as Ge, Checkbox as yr, Autocomplete as Le, Switch as vr, MenuItem as he, Collapse as xr, Divider as gr, Popper as Pr } from "@mui/material";
11
11
  import U from "lodash/sortBy";
12
12
  import { useCallback as D, useMemo as re, useRef as H, useId as kr, useEffect as _, useState as G } from "react";
13
13
  import { useUpdate as Ye } from "react-use";
@@ -23,8 +23,8 @@ import { CustomComponentRenderer as Xe, transpileAndLoadScript as zr, getPropert
23
23
  import { parsePropertyValue as Vr } from "@blocklet/pages-kit/utils/property";
24
24
  import { unstable_useNumberInput as Er, ClickAwayListener as Tr } from "@mui/base";
25
25
  import { VisibilityOffRounded as Ar, VisibilityRounded as Dr, DeleteOutlineRounded as Wr, DragIndicatorRounded as Ur, TranslateRounded as Ze, AddRounded as er, InfoRounded as rr, PsychologyAlt as Br, StarRounded as Kr, SettingsRounded as tr } from "@mui/icons-material";
26
- import { getYjsValue as ne } from "@syncedstore/core";
27
- import { useUpdate as Fr, useReactive as Mr } from "ahooks";
26
+ import { getYjsValue as le } from "@syncedstore/core";
27
+ import { useUpdate as Mr, useReactive as Fr } from "ahooks";
28
28
  import Jr from "lodash/assign";
29
29
  import _r from "lodash/get";
30
30
  import $r from "lodash/has";
@@ -38,51 +38,51 @@ import Qr from "lodash/reduce";
38
38
  import { usePopupState as Se, bindTrigger as Ie, bindDialog as ir, bindPopper as Xr } from "material-ui-popup-state/hooks";
39
39
  import { ErrorBoundary as Zr } from "react-error-boundary";
40
40
  import { cx as et } from "@emotion/css";
41
- import { useDrop as lr, useDrag as rt } from "react-dnd";
41
+ import { useDrop as nr, useDrag as rt } from "react-dnd";
42
42
  function tt({
43
43
  onClick: e,
44
44
  disabled: t,
45
45
  sx: i,
46
- ...l
46
+ ...n
47
47
  }) {
48
- return /* @__PURE__ */ r(le, { size: "small", color: "warning", variant: "outlined", disabled: t, onClick: e, ...l, children: /* @__PURE__ */ r(fr, { fontSize: "small" }) });
48
+ return /* @__PURE__ */ r(ie, { size: "small", color: "warning", variant: "outlined", disabled: t, onClick: e, ...n, children: /* @__PURE__ */ r(fr, { fontSize: "small" }) });
49
49
  }
50
50
  function it({
51
51
  onClick: e,
52
52
  disabled: t,
53
53
  sx: i,
54
- ...l
54
+ ...n
55
55
  }) {
56
- return /* @__PURE__ */ r(le, { size: "small", color: "primary", disabled: t, onClick: e, ...l, children: /* @__PURE__ */ r(mr, { fontSize: "small" }) });
56
+ return /* @__PURE__ */ r(ie, { size: "small", color: "primary", disabled: t, onClick: e, ...n, children: /* @__PURE__ */ r(mr, { fontSize: "small" }) });
57
57
  }
58
- function lt({
58
+ function nt({
59
59
  onClick: e,
60
60
  disabled: t,
61
61
  sx: i,
62
- ...l
62
+ ...n
63
63
  }) {
64
- return /* @__PURE__ */ r(le, { size: "small", color: "primary", disabled: t, onClick: e, ...l, children: /* @__PURE__ */ r(pr, { fontSize: "small" }) });
64
+ return /* @__PURE__ */ r(ie, { size: "small", color: "primary", disabled: t, onClick: e, ...n, children: /* @__PURE__ */ r(pr, { fontSize: "small" }) });
65
65
  }
66
- function nt({
66
+ function lt({
67
67
  label: e,
68
68
  value: t,
69
69
  onChange: i,
70
- disabled: l = !1,
70
+ disabled: n = !1,
71
71
  itemLabel: f = "",
72
- emptyHeight: v = 40,
72
+ emptyHeight: x = 40,
73
73
  property: p,
74
74
  renderItem: w,
75
75
  ...P
76
76
  }) {
77
- const { t: b, locale: g } = V(), x = Ye(), n = D(
77
+ const { t: b, locale: g } = V(), v = Ye(), l = D(
78
78
  (a) => {
79
79
  i(ge(a, p.type));
80
80
  },
81
81
  [i, p.type]
82
82
  ), c = re(() => Array.isArray(t) ? t : [], [t]), s = D(() => {
83
83
  const a = [...c, ""];
84
- n(a), x();
85
- }, [c, n, x]), u = D(() => {
84
+ l(a), v();
85
+ }, [c, l, v]), u = D(() => {
86
86
  if (!p || !p.subProperties)
87
87
  return s();
88
88
  const a = {};
@@ -93,43 +93,43 @@ function nt({
93
93
  a[z.key] = E;
94
94
  });
95
95
  const C = [...c, a];
96
- n(C), x();
97
- }, [c, n, x, p, g, s]), d = D(
96
+ l(C), v();
97
+ }, [c, l, v, p, g, s]), d = D(
98
98
  (a) => {
99
99
  try {
100
100
  const S = JSON.parse(a);
101
- Array.isArray(S) ? n(S) : console.error("JSON解析结果不是数组");
101
+ Array.isArray(S) ? l(S) : console.error("JSON解析结果不是数组");
102
102
  } catch (S) {
103
103
  console.error("JSON解析错误:", S);
104
104
  }
105
105
  },
106
- [n]
106
+ [l]
107
107
  ), k = D(
108
108
  (a) => {
109
109
  const S = c.filter((C, z) => z !== a);
110
- n(S), x();
110
+ l(S), v();
111
111
  },
112
- [c, n, x]
112
+ [c, l, v]
113
113
  ), o = D(
114
114
  (a) => {
115
115
  if (a <= 0) return;
116
116
  const S = [...c], C = S[a];
117
- S[a] = S[a - 1], S[a - 1] = C, n(S), x();
117
+ S[a] = S[a - 1], S[a - 1] = C, l(S), v();
118
118
  },
119
- [c, n, x]
119
+ [c, l, v]
120
120
  ), h = D(
121
121
  (a) => {
122
122
  if (a >= c.length - 1) return;
123
123
  const S = [...c], C = S[a];
124
- S[a] = S[a + 1], S[a + 1] = C, n(S), x();
124
+ S[a] = S[a + 1], S[a + 1] = C, l(S), v();
125
125
  },
126
- [c, n, x]
126
+ [c, l, v]
127
127
  ), m = D(
128
128
  (a, S) => {
129
129
  const C = [...c];
130
- C[a] = S, n(C);
130
+ C[a] = S, l(C);
131
131
  },
132
- [c, n]
132
+ [c, l]
133
133
  ), y = p && p.subProperties && Object.keys(p.subProperties).length > 0, I = re(() => [
134
134
  {
135
135
  field: "index",
@@ -167,7 +167,7 @@ function nt({
167
167
  {
168
168
  fullWidth: !0,
169
169
  size: "small",
170
- disabled: l,
170
+ disabled: n,
171
171
  value: a,
172
172
  placeholder: f || `${b("item")} ${S + 1}`,
173
173
  onChange: (C) => m(S, C.target.value),
@@ -182,15 +182,15 @@ function nt({
182
182
  // 增加宽度以容纳更多按钮
183
183
  align: "center",
184
184
  renderCell: ({ index: a }) => /* @__PURE__ */ O(j, { direction: "column", spacing: 0.25, children: [
185
- /* @__PURE__ */ r(it, { disabled: l || a === 0, onClick: () => o(a) }),
185
+ /* @__PURE__ */ r(it, { disabled: n || a === 0, onClick: () => o(a) }),
186
186
  /* @__PURE__ */ r(
187
- lt,
187
+ nt,
188
188
  {
189
- disabled: l || a === c.length - 1,
189
+ disabled: n || a === c.length - 1,
190
190
  onClick: () => h(a)
191
191
  }
192
192
  ),
193
- /* @__PURE__ */ r(tt, { disabled: l, onClick: () => k(a) })
193
+ /* @__PURE__ */ r(tt, { disabled: n, onClick: () => k(a) })
194
194
  ] })
195
195
  }
196
196
  ], [
@@ -200,7 +200,7 @@ function nt({
200
200
  m,
201
201
  f,
202
202
  b,
203
- l,
203
+ n,
204
204
  P,
205
205
  k,
206
206
  o,
@@ -209,8 +209,8 @@ function nt({
209
209
  ]);
210
210
  return y ? /* @__PURE__ */ O(j, { width: "100%", gap: 1, children: [
211
211
  e && /* @__PURE__ */ r(se, { children: e }),
212
- c.length > 0 ? /* @__PURE__ */ r(hr, { component: ie, variant: "outlined", sx: { borderRadius: 1, mb: 1 }, children: /* @__PURE__ */ O(
213
- Fe,
212
+ c.length > 0 ? /* @__PURE__ */ r(hr, { component: te, variant: "outlined", sx: { borderRadius: 1, mb: 1 }, children: /* @__PURE__ */ O(
213
+ Me,
214
214
  {
215
215
  size: "small",
216
216
  sx: {
@@ -227,7 +227,7 @@ function nt({
227
227
  borderCollapse: "collapse"
228
228
  },
229
229
  children: [
230
- /* @__PURE__ */ r(Me, { sx: { display: "none" }, children: /* @__PURE__ */ r(ce, { children: I.map((a) => /* @__PURE__ */ r(
230
+ /* @__PURE__ */ r(Fe, { sx: { display: "none" }, children: /* @__PURE__ */ r(ce, { children: I.map((a) => /* @__PURE__ */ r(
231
231
  de,
232
232
  {
233
233
  width: a.width,
@@ -268,14 +268,14 @@ function nt({
268
268
  )) })
269
269
  ]
270
270
  }
271
- ) }) : /* @__PURE__ */ r(ae, { style: { fontSize: 12, height: v }, children: b("maker.properties.arrayEmpty") }),
271
+ ) }) : /* @__PURE__ */ r(pe, { style: { fontSize: 12, height: x }, children: b("maker.properties.arrayEmpty") }),
272
272
  /* @__PURE__ */ r(
273
273
  A,
274
274
  {
275
275
  fullWidth: !0,
276
276
  size: "small",
277
277
  variant: "outlined",
278
- disabled: l,
278
+ disabled: n,
279
279
  startIcon: /* @__PURE__ */ r(ar, {}),
280
280
  onClick: u,
281
281
  children: b("maker.properties.addArrayItem")
@@ -305,7 +305,7 @@ function ot({
305
305
  onChange: t,
306
306
  ...i
307
307
  }) {
308
- const l = H(null);
308
+ const n = H(null);
309
309
  return /* @__PURE__ */ O(q, { children: [
310
310
  /* @__PURE__ */ r(
311
311
  Ir,
@@ -314,14 +314,14 @@ function ot({
314
314
  value: e,
315
315
  onChange: t,
316
316
  InputProps: {
317
- endAdornment: /* @__PURE__ */ r(pe, { position: "end", children: /* @__PURE__ */ r(
317
+ endAdornment: /* @__PURE__ */ r(ne, { position: "end", children: /* @__PURE__ */ r(
318
318
  wr,
319
319
  {
320
320
  color: e ?? "",
321
321
  style: { width: "1.5rem", height: "1.5rem", padding: 0 },
322
322
  onClick: () => {
323
323
  var f;
324
- (f = l.current) == null || f.open({ value: e ?? "" });
324
+ (f = n.current) == null || f.open({ value: e ?? "" });
325
325
  }
326
326
  }
327
327
  ) })
@@ -331,9 +331,9 @@ function ot({
331
331
  /* @__PURE__ */ r(
332
332
  Sr,
333
333
  {
334
- ref: l,
335
- onSave: ({ value: f }, v) => {
336
- t(f), v();
334
+ ref: n,
335
+ onSave: ({ value: f }, x) => {
336
+ t(f), x();
337
337
  }
338
338
  }
339
339
  )
@@ -343,39 +343,39 @@ function st({
343
343
  label: e,
344
344
  value: t,
345
345
  onChange: i,
346
- property: l,
346
+ property: n,
347
347
  component: f,
348
- defaultLocale: v,
348
+ defaultLocale: x,
349
349
  allComponents: p,
350
350
  PropertyValueField: w,
351
351
  onUpload: P
352
352
  }) {
353
353
  const { locale: b } = V(), g = H(null);
354
- if (!J(l.subProperties)) {
355
- const n = U(Object.values(l.subProperties || {}), "index").filter(
354
+ if (!J(n.subProperties)) {
355
+ const l = U(Object.values(n.subProperties || {}), "index").filter(
356
356
  (c) => c.data.visible !== !1 && c.data.key
357
357
  );
358
358
  return /* @__PURE__ */ O(j, { width: "100%", children: [
359
359
  /* @__PURE__ */ r(se, { sx: { px: 0.25, py: 0.5 }, children: e }),
360
- /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(N, { sx: { position: "relative" }, children: n.map((c, s) => {
361
- const { data: u } = c, d = u.key ?? u.id, k = s === n.length - 1;
360
+ /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(N, { sx: { position: "relative" }, children: l.map((c, s) => {
361
+ const { data: u } = c, d = u.key ?? u.id, k = s === l.length - 1;
362
362
  let o = null;
363
363
  try {
364
- t && typeof t == "object" ? o = t[d] : typeof t == "string" && (o = (l.type === "yaml" ? be.parse(t || "") : JSON.parse(t || "{}"))[d]);
364
+ t && typeof t == "object" ? o = t[d] : typeof t == "string" && (o = (n.type === "yaml" ? be.parse(t || "") : JSON.parse(t || "{}"))[d]);
365
365
  } catch {
366
366
  }
367
- o == null && (u.locales && b && u.locales[b] ? o = u.locales[b].defaultValue : u.locales && v && u.locales[v] && (o = u.locales[v].defaultValue));
367
+ o == null && (u.locales && b && u.locales[b] ? o = u.locales[b].defaultValue : u.locales && x && u.locales[x] && (o = u.locales[x].defaultValue));
368
368
  const h = (y) => {
369
369
  try {
370
370
  let I = {};
371
371
  if (typeof t == "string")
372
372
  try {
373
- I = l.type === "yaml" ? be.parse(t || "") : JSON.parse(t || "{}");
373
+ I = n.type === "yaml" ? be.parse(t || "") : JSON.parse(t || "{}");
374
374
  } catch {
375
375
  }
376
376
  else typeof t == "object" && t !== null && (I = { ...t });
377
377
  qe(I, d, y);
378
- const a = ge(I, l.type);
378
+ const a = ge(I, n.type);
379
379
  i == null || i(a);
380
380
  } catch (I) {
381
381
  console.error("Error updating property:", I);
@@ -458,7 +458,7 @@ function st({
458
458
  onChange: h,
459
459
  size: "small",
460
460
  fullWidth: !0,
461
- defaultLocale: v,
461
+ defaultLocale: x,
462
462
  allComponents: p
463
463
  }
464
464
  ) })
@@ -497,22 +497,22 @@ function st({
497
497
  /* @__PURE__ */ r(
498
498
  ke,
499
499
  {
500
- keyId: l.id,
500
+ keyId: n.id,
501
501
  locale: b,
502
- language: l.type === "yaml" ? "yaml" : "json",
502
+ language: n.type === "yaml" ? "yaml" : "json",
503
503
  value: typeof t == "string" ? t : "",
504
- onChange: (n) => {
505
- i == null || i(n);
504
+ onChange: (l) => {
505
+ i == null || i(l);
506
506
  },
507
- onUpload: (n) => {
508
- g.current = n, P && P(n);
507
+ onUpload: (l) => {
508
+ g.current = l, P && P(l);
509
509
  },
510
510
  fullScreenOptions: {
511
511
  enableEscExit: !0,
512
512
  targetContainer: () => document.getElementById("parameters-config-dialog") || null
513
513
  }
514
514
  },
515
- l.id
515
+ n.id
516
516
  ),
517
517
  /* @__PURE__ */ r(
518
518
  N,
@@ -542,13 +542,13 @@ const ct = ["string", "multiline", "json", "yaml", "url", "component", "custom",
542
542
  function Ue(e) {
543
543
  return e.type ? !ct.includes(e.type) : !1;
544
544
  }
545
- function nr({
545
+ function lr({
546
546
  disabled: e,
547
547
  list: t,
548
548
  renderItem: i,
549
- ...l
549
+ ...n
550
550
  }) {
551
- const f = H(null), v = kr(), p = Fr(), w = U(Object.entries(t), (c) => c[1].index).map((c) => c[0]), P = H(w), b = D(
551
+ const f = H(null), x = kr(), p = Mr(), w = U(Object.entries(t), (c) => c[1].index).map((c) => c[0]), P = H(w), b = D(
552
552
  (c) => {
553
553
  P.current = c, p();
554
554
  },
@@ -563,8 +563,8 @@ function nr({
563
563
  _(() => {
564
564
  b(w);
565
565
  }, [w.join("-")]);
566
- const [{ isOver: x }, n] = lr({
567
- accept: v,
566
+ const [{ isOver: v }, l] = nr({
567
+ accept: x,
568
568
  collect: (c) => ({
569
569
  isOver: c.isOver()
570
570
  }),
@@ -576,18 +576,18 @@ function nr({
576
576
  const o = t[d];
577
577
  o && (o.index = k);
578
578
  });
579
- }, s = (u = ne(t)) == null ? void 0 : u.doc;
579
+ }, s = (u = le(t)) == null ? void 0 : u.doc;
580
580
  s ? s.transact(() => {
581
581
  c();
582
582
  }) : c();
583
583
  }
584
584
  });
585
585
  return _(() => {
586
- x || b(w);
587
- }, [x]), n(f), /* @__PURE__ */ r(N, { ...l, ref: f, className: et(x && "isDragging"), children: P.current.map((c, s) => /* @__PURE__ */ r(
586
+ v || b(w);
587
+ }, [v]), l(f), /* @__PURE__ */ r(N, { ...n, ref: f, className: et(v && "isDragging"), children: P.current.map((c, s) => /* @__PURE__ */ r(
588
588
  dt,
589
589
  {
590
- type: v,
590
+ type: x,
591
591
  disabled: e,
592
592
  id: c,
593
593
  index: s,
@@ -605,51 +605,51 @@ function dt({
605
605
  disabled: e,
606
606
  id: t,
607
607
  index: i,
608
- type: l,
608
+ type: n,
609
609
  children: f,
610
- itemIndex: v,
610
+ itemIndex: x,
611
611
  move: p
612
612
  }) {
613
613
  const w = H(), [{ isDragging: P }, b, g] = rt({
614
- type: l,
614
+ type: n,
615
615
  item: () => ({ id: t }),
616
616
  canDrag: () => !e,
617
- collect: (n) => ({ isDragging: n.isDragging() })
618
- }), [, x] = lr({
619
- accept: l,
617
+ collect: (l) => ({ isDragging: l.isDragging() })
618
+ }), [, v] = nr({
619
+ accept: n,
620
620
  canDrop: () => !e,
621
- hover(n, c) {
621
+ hover(l, c) {
622
622
  var m;
623
623
  if (!w.current)
624
624
  return;
625
- const s = v(n.id), u = i;
625
+ const s = x(l.id), u = i;
626
626
  if (s === u)
627
627
  return;
628
628
  const d = (m = w.current) == null ? void 0 : m.getBoundingClientRect(), k = (d.bottom - d.top) / 2, h = c.getClientOffset().y - d.top;
629
- s < u && h < k || s > u && h > k || p({ id: n.id, index: s }, { id: t, index: i });
629
+ s < u && h < k || s > u && h > k || p({ id: l.id, index: s }, { id: t, index: i });
630
630
  }
631
631
  });
632
632
  return typeof f == "function" ? f({
633
633
  isDragging: P,
634
634
  drag: b,
635
- drop: (n) => (w.current = n, x(n)),
635
+ drop: (l) => (w.current = l, v(l)),
636
636
  preview: g
637
- }) : (b(x(g(w))), /* @__PURE__ */ r(N, { ref: w, children: f }));
637
+ }) : (b(v(g(w))), /* @__PURE__ */ r(N, { ref: w, children: f }));
638
638
  }
639
639
  function ut({
640
640
  drop: e,
641
641
  preview: t,
642
642
  drag: i,
643
- disabled: l,
643
+ disabled: n,
644
644
  isDragging: f,
645
- children: v,
645
+ children: x,
646
646
  onDelete: p,
647
647
  onVisibilityChange: w,
648
648
  visible: P = !0,
649
649
  actions: b,
650
650
  alwaysShowActions: g = !1
651
651
  }) {
652
- const { t: x } = V();
652
+ const { t: v } = V();
653
653
  return /* @__PURE__ */ r(
654
654
  N,
655
655
  {
@@ -670,10 +670,10 @@ function ut({
670
670
  opacity: 0.9999
671
671
  // NOTE: make preview effective
672
672
  },
673
- children: v
673
+ children: x
674
674
  }
675
675
  ),
676
- !l && /* @__PURE__ */ r(
676
+ !n && /* @__PURE__ */ r(
677
677
  N,
678
678
  {
679
679
  className: g ? "" : "hover-visible",
@@ -690,7 +690,7 @@ function ut({
690
690
  {
691
691
  direction: "row",
692
692
  sx: {
693
- bgcolor: (n) => fe(n.palette.grey[200], 0.9),
693
+ bgcolor: (l) => fe(l.palette.grey[200], 0.9),
694
694
  borderRadius: 1,
695
695
  p: 0.5,
696
696
  [`.${br.root}`]: {
@@ -702,9 +702,9 @@ function ut({
702
702
  },
703
703
  children: [
704
704
  b,
705
- w && /* @__PURE__ */ r(Y, { title: x(P ? "hideParameter" : "showParameter"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(A, { onClick: () => w(!P), children: P ? /* @__PURE__ */ r(Ar, { sx: { fontSize: "1.25rem", color: "grey.500" } }) : /* @__PURE__ */ r(Dr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
706
- p && /* @__PURE__ */ r(Y, { title: x("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(A, { onClick: p, children: /* @__PURE__ */ r(Wr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
707
- /* @__PURE__ */ r(Y, { title: x("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(A, { ref: i, children: /* @__PURE__ */ r(Ur, { sx: { color: "grey.500" } }) }) })
705
+ w && /* @__PURE__ */ r(Y, { title: v(P ? "hideParameter" : "showParameter"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(A, { onClick: () => w(!P), children: P ? /* @__PURE__ */ r(Ar, { sx: { fontSize: "1.25rem", color: "grey.500" } }) : /* @__PURE__ */ r(Dr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
706
+ p && /* @__PURE__ */ r(Y, { title: v("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(A, { onClick: p, children: /* @__PURE__ */ r(Wr, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
707
+ /* @__PURE__ */ r(Y, { title: v("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ r(A, { ref: i, children: /* @__PURE__ */ r(Ur, { sx: { color: "grey.500" } }) }) })
708
708
  ]
709
709
  }
710
710
  )
@@ -721,49 +721,49 @@ function at(e) {
721
721
  function pt(e, t, i) {
722
722
  return e.locales && e.locales[t] && e.locales[t].name ? e.locales[t].name : i && e.locales && e.locales[i] && e.locales[i].name ? e.locales[i].name : e.key ? e.key : e.id;
723
723
  }
724
- const or = (e, t, i, l) => {
724
+ const or = (e, t, i, n) => {
725
725
  const f = {};
726
726
  return U(Object.entries(e), ([, p]) => p.index).forEach(([p, w]) => {
727
727
  const P = w.data;
728
728
  if (!P) return;
729
- const b = P.key || P.id, g = i ? pt(P, i, l || "") : b, x = t == null ? void 0 : t[P.id], n = {
729
+ const b = P.key || P.id, g = i ? pt(P, i, n || "") : b, v = t == null ? void 0 : t[P.id], l = {
730
730
  key: b,
731
- isNeedGenerate: (x == null ? void 0 : x.isNeedGenerate) ?? at(P),
731
+ isNeedGenerate: (v == null ? void 0 : v.isNeedGenerate) ?? at(P),
732
732
  // 如果存在使用现有值,否则默认勾选
733
- describe: (x == null ? void 0 : x.describe) ?? "",
733
+ describe: (v == null ? void 0 : v.describe) ?? "",
734
734
  displayName: g
735
735
  };
736
- P.subProperties && !J(P.subProperties) && (n.subProperties = or(
736
+ P.subProperties && !J(P.subProperties) && (l.subProperties = or(
737
737
  P.subProperties,
738
- x == null ? void 0 : x.subProperties,
738
+ v == null ? void 0 : v.subProperties,
739
739
  i,
740
- l
741
- )), f[P.id] = n;
740
+ n
741
+ )), f[P.id] = l;
742
742
  }), f;
743
743
  };
744
744
  function mt({
745
745
  open: e,
746
746
  onClose: t,
747
747
  onConfirm: i,
748
- component: l,
748
+ component: n,
749
749
  initialConfig: f,
750
- locale: v,
750
+ locale: x,
751
751
  defaultLocale: p,
752
752
  title: w,
753
753
  loading: P = !1
754
754
  }) {
755
- const { t: b } = V(), [g, x] = G(null);
755
+ const { t: b } = V(), [g, v] = G(null);
756
756
  _(() => {
757
- if (e && l) {
757
+ if (e && n) {
758
758
  const d = { properties: {} };
759
- if (l.properties) {
759
+ if (n.properties) {
760
760
  const k = f == null ? void 0 : f.properties;
761
- d.properties = or(l.properties, k, v, p);
761
+ d.properties = or(n.properties, k, x, p);
762
762
  }
763
- x(d);
763
+ v(d);
764
764
  }
765
- }, [e, l, f, v, p]);
766
- const n = () => {
765
+ }, [e, n, f, x, p]);
766
+ const l = () => {
767
767
  t();
768
768
  }, c = () => {
769
769
  g && (i(g), t());
@@ -790,11 +790,11 @@ function mt({
790
790
  const C = (z, E) => {
791
791
  const T = {};
792
792
  return Object.entries(z).forEach(([B, K]) => {
793
- const F = { ...K };
794
- E !== null && (F.isNeedGenerate = E), K.subProperties && !J(K.subProperties) && (F.subProperties = C(
793
+ const M = { ...K };
794
+ E !== null && (M.isNeedGenerate = E), K.subProperties && !J(K.subProperties) && (M.subProperties = C(
795
795
  K.subProperties,
796
796
  E !== null ? E : null
797
- )), T[B] = F;
797
+ )), T[B] = M;
798
798
  }), T;
799
799
  };
800
800
  S.subProperties = C(
@@ -820,7 +820,7 @@ function mt({
820
820
  ...o
821
821
  });
822
822
  }
823
- x(h);
823
+ v(h);
824
824
  }
825
825
  }, u = (d, k = [], o = !0) => {
826
826
  if (!d || J(d))
@@ -945,14 +945,14 @@ function mt({
945
945
  ] }) }, m);
946
946
  }) });
947
947
  };
948
- return /* @__PURE__ */ O(we, { open: e, onClose: n, maxWidth: "lg", fullWidth: !0, children: [
948
+ return /* @__PURE__ */ O(we, { open: e, onClose: l, maxWidth: "lg", fullWidth: !0, children: [
949
949
  /* @__PURE__ */ r(_e, { children: w || b("maker.properties.llmConfigTitle") }),
950
- /* @__PURE__ */ r($e, { children: /* @__PURE__ */ r(N, { my: 3, children: P ? /* @__PURE__ */ r(W, { children: b("maker.properties.loading") }) : l ? g ? /* @__PURE__ */ O(j, { spacing: 3, children: [
950
+ /* @__PURE__ */ r($e, { children: /* @__PURE__ */ r(N, { my: 3, children: P ? /* @__PURE__ */ r(W, { children: b("maker.properties.loading") }) : n ? g ? /* @__PURE__ */ O(j, { spacing: 3, children: [
951
951
  /* @__PURE__ */ r(W, { variant: "subtitle2", children: b("maker.properties.llmConfigInstructions") }),
952
952
  u(g.properties)
953
953
  ] }) : /* @__PURE__ */ r(W, { children: b("maker.properties.loading") }) : /* @__PURE__ */ r(W, { color: "error", children: b("maker.properties.componentNotFound") }) }) }),
954
954
  /* @__PURE__ */ O(He, { children: [
955
- /* @__PURE__ */ r(A, { onClick: n, children: b("common.cancel") }),
955
+ /* @__PURE__ */ r(A, { onClick: l, children: b("common.cancel") }),
956
956
  /* @__PURE__ */ r(A, { variant: "contained", onClick: c, disabled: !g || P, children: b("common.confirm") })
957
957
  ] })
958
958
  ] });
@@ -962,7 +962,7 @@ function ft({
962
962
  value: t,
963
963
  onChange: i
964
964
  }) {
965
- const [l, f] = G(!1);
965
+ const [n, f] = G(!1);
966
966
  return /* @__PURE__ */ O(j, { gap: 1, children: [
967
967
  /* @__PURE__ */ r(
968
968
  R,
@@ -970,18 +970,21 @@ function ft({
970
970
  label: e,
971
971
  size: "small",
972
972
  value: t,
973
- onChange: (v) => i == null ? void 0 : i(v.target.value),
973
+ onChange: (x) => i == null ? void 0 : i(x.target.value),
974
974
  InputProps: {
975
- endAdornment: /* @__PURE__ */ r(
975
+ sx: {
976
+ pr: 0
977
+ },
978
+ endAdornment: /* @__PURE__ */ r(ne, { position: "end", children: /* @__PURE__ */ r(
976
979
  Qe,
977
980
  {
978
- onChange: ({ response: v }) => {
981
+ onChange: ({ response: x }) => {
979
982
  var w;
980
- const p = (w = v == null ? void 0 : v.data) == null ? void 0 : w.filename;
983
+ const p = (w = x == null ? void 0 : x.data) == null ? void 0 : w.filename;
981
984
  p && (i == null || i(p));
982
985
  }
983
986
  }
984
- )
987
+ ) })
985
988
  }
986
989
  }
987
990
  ),
@@ -998,13 +1001,13 @@ function ft({
998
1001
  onClick: () => f(!0)
999
1002
  }
1000
1003
  ),
1001
- /* @__PURE__ */ r(we, { open: l, onClose: () => f(!1), children: /* @__PURE__ */ r(N, { component: "img", sx: { objectFit: "contain" }, src: We(t), alt: e }) })
1004
+ /* @__PURE__ */ r(we, { open: n, onClose: () => f(!1), children: /* @__PURE__ */ r(N, { component: "img", sx: { objectFit: "contain" }, src: We(t), alt: e }) })
1002
1005
  ] });
1003
1006
  }
1004
1007
  function ve(e, t = "") {
1005
- return Qr(e, (i, l, f) => {
1006
- const v = t ? `${t}.${f}` : f;
1007
- return Gr(l) ? Jr(i, ve(l, v)) : i[v] = l, i;
1008
+ return Qr(e, (i, n, f) => {
1009
+ const x = t ? `${t}.${f}` : f;
1010
+ return Gr(n) ? Jr(i, ve(n, x)) : i[x] = n, i;
1008
1011
  }, {});
1009
1012
  }
1010
1013
  const ht = [
@@ -1022,19 +1025,19 @@ const ht = [
1022
1025
  { value: "custom", label: "Custom (Render by a Component)" }
1023
1026
  ];
1024
1027
  function oe(e, t, i) {
1025
- return !e || !i ? !1 : Object.values(e).some(({ data: l }) => l.id !== t && l.key === i);
1028
+ return !e || !i ? !1 : Object.values(e).some(({ data: n }) => n.id !== t && n.key === i);
1026
1029
  }
1027
1030
  function xe(e, t) {
1028
1031
  var i;
1029
1032
  return !e || !t ? !1 : ((i = e[t]) == null ? void 0 : i.data.visible) ?? !0;
1030
1033
  }
1031
1034
  function hi({ componentId: e }) {
1032
- const { state: { components: t } } = te(), i = t[e], l = i == null ? void 0 : i.data;
1033
- return l ? /* @__PURE__ */ r(j, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ r(N, { p: 2, children: /* @__PURE__ */ r(Zr, { FallbackComponent: ur, resetKeys: [e], children: /* @__PURE__ */ r(bt, { value: l, componentId: e }) }) }) }) : null;
1035
+ const { state: { components: t } } = ae(), i = t[e], n = i == null ? void 0 : i.data;
1036
+ return n ? /* @__PURE__ */ r(j, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ r(N, { p: 2, children: /* @__PURE__ */ r(Zr, { FallbackComponent: ur, resetKeys: [e], children: /* @__PURE__ */ r(bt, { value: n, componentId: e }) }) }) }) : null;
1034
1037
  }
1035
1038
  function bt({ value: e, componentId: t }) {
1036
- var x, n, c;
1037
- const { t: i } = V(), { localState: { currentLocale: l, customComponentPreviewerProperties: f }, state: { config: { defaultLocale: v } }, localActions: { setCustomComponentPreviewerProperties: p } } = te(), w = ne(e).doc, P = Pe(), b = re(() => (f == null ? void 0 : f[t]) ?? {}, [t, f]), g = Mr({
1039
+ var v, l, c;
1040
+ const { t: i } = V(), { localState: { currentLocale: n, customComponentPreviewerProperties: f }, state: { config: { defaultLocale: x } }, localActions: { setCustomComponentPreviewerProperties: p } } = ae(), w = le(e).doc, P = Pe(), b = re(() => (f == null ? void 0 : f[t]) ?? {}, [t, f]), g = Fr({
1038
1041
  componentId: t,
1039
1042
  propertiesValue: {
1040
1043
  ...b
@@ -1052,9 +1055,9 @@ function bt({ value: e, componentId: t }) {
1052
1055
  return [
1053
1056
  u.id,
1054
1057
  {
1055
- value: ((d = g.propertiesValue[u.id]) == null ? void 0 : d.value) ?? Vr(u, ((o = (k = u.locales) == null ? void 0 : k[l]) == null ? void 0 : o.defaultValue) ?? ((m = (h = u.locales) == null ? void 0 : h[v]) == null ? void 0 : m.defaultValue), {
1056
- locale: l,
1057
- defaultLocale: v
1058
+ value: ((d = g.propertiesValue[u.id]) == null ? void 0 : d.value) ?? Vr(u, ((o = (k = u.locales) == null ? void 0 : k[n]) == null ? void 0 : o.defaultValue) ?? ((m = (h = u.locales) == null ? void 0 : h[x]) == null ? void 0 : m.defaultValue), {
1059
+ locale: n,
1060
+ defaultLocale: x
1058
1061
  })
1059
1062
  }
1060
1063
  ];
@@ -1064,8 +1067,8 @@ function bt({ value: e, componentId: t }) {
1064
1067
  /* @__PURE__ */ r(yt, { config: e }),
1065
1068
  /* @__PURE__ */ r(xt, {
1066
1069
  config: e,
1067
- currentLocale: l,
1068
- defaultLocale: v,
1070
+ currentLocale: n,
1071
+ defaultLocale: x,
1069
1072
  allComponents: P,
1070
1073
  onUpdateConfig: (s) => {
1071
1074
  w.transact(() => {
@@ -1080,7 +1083,7 @@ function bt({ value: e, componentId: t }) {
1080
1083
  size: "small",
1081
1084
  select: !0,
1082
1085
  SelectProps: { autoWidth: !0 },
1083
- value: ((x = e.renderer) == null ? void 0 : x.type) || "react-component",
1086
+ value: ((v = e.renderer) == null ? void 0 : v.type) || "react-component",
1084
1087
  onChange: (s) => {
1085
1088
  w.transact(() => {
1086
1089
  const u = s.target.value;
@@ -1093,12 +1096,12 @@ function bt({ value: e, componentId: t }) {
1093
1096
  ]
1094
1097
  })
1095
1098
  ] }),
1096
- ((n = e.renderer) == null ? void 0 : n.type) === "component" && /* @__PURE__ */ r(Ct, { value: e }),
1099
+ ((l = e.renderer) == null ? void 0 : l.type) === "component" && /* @__PURE__ */ r(Ct, { value: e }),
1097
1100
  ((c = e.renderer) == null ? void 0 : c.type) === "react-component" && /* @__PURE__ */ r(Ot, { value: e }),
1098
1101
  /* @__PURE__ */ r(dr, {
1099
1102
  config: e,
1100
- currentLocale: l,
1101
- defaultLocale: v,
1103
+ currentLocale: n,
1104
+ defaultLocale: x,
1102
1105
  allComponents: P,
1103
1106
  propertiesValue: g.propertiesValue,
1104
1107
  onChange: ({ value: s, id: u, path: d }) => {
@@ -1136,7 +1139,7 @@ function yt({ config: e }) {
1136
1139
  value: e.description || "",
1137
1140
  onChange: (i) => e.description = i.target.value,
1138
1141
  InputProps: {
1139
- endAdornment: /* @__PURE__ */ r(pe, { position: "end", sx: { mt: -1.5 }, children: /* @__PURE__ */ r(Nt, { config: e }) })
1142
+ endAdornment: /* @__PURE__ */ r(ne, { position: "end", sx: { mt: -1.5 }, children: /* @__PURE__ */ r(Nt, { config: e }) })
1140
1143
  }
1141
1144
  }),
1142
1145
  /* @__PURE__ */ r(Le, {
@@ -1145,7 +1148,7 @@ function yt({ config: e }) {
1145
1148
  multiple: !0,
1146
1149
  freeSolo: !0,
1147
1150
  value: e.tags ?? [],
1148
- onChange: (i, l) => e.tags = l,
1151
+ onChange: (i, n) => e.tags = n,
1149
1152
  renderInput: (i) => /* @__PURE__ */ r(R, { label: t("tags"), ...i })
1150
1153
  }),
1151
1154
  /* @__PURE__ */ r(ft, {
@@ -1155,8 +1158,8 @@ function yt({ config: e }) {
1155
1158
  })
1156
1159
  ] }) });
1157
1160
  }
1158
- function sr({ data: e, params: t, visible: i, config: l, currentLocale: f, defaultLocale: v, allComponents: p, onUpdateConfig: w }) {
1159
- var g, x, n, c, s, u;
1161
+ function sr({ data: e, params: t, visible: i, config: n, currentLocale: f, defaultLocale: x, allComponents: p, onUpdateConfig: w }) {
1162
+ var g, v, l, c, s, u;
1160
1163
  const { t: P } = V(), b = re(() => e.type === "json" || e.type === "yaml" || e.type === "array" ? kt : L, [e.type]);
1161
1164
  return /* @__PURE__ */ r(ut, {
1162
1165
  preview: t.preview,
@@ -1190,13 +1193,13 @@ function sr({ data: e, params: t, visible: i, config: l, currentLocale: f, defau
1190
1193
  width: "calc(100% - 80px - 8px)",
1191
1194
  flex: 1,
1192
1195
  "& .MuiOutlinedInput-root": {
1193
- borderColor: e.key ? oe(l.properties, e.id, e.key) ? "warning.main" : void 0 : "error.main"
1196
+ borderColor: e.key ? oe(n.properties, e.id, e.key) ? "warning.main" : void 0 : "error.main"
1194
1197
  },
1195
1198
  "& .MuiFormLabel-root": {
1196
- color: e.key ? oe(l.properties, e.id, e.key) ? "warning.main" : "text.secondary" : "error.main"
1199
+ color: e.key ? oe(n.properties, e.id, e.key) ? "warning.main" : "text.secondary" : "error.main"
1197
1200
  },
1198
1201
  "& .MuiFormLabel-root.Mui-focused": {
1199
- color: e.key ? oe(l.properties, e.id, e.key) ? "warning.main" : "primary.main" : "error.main"
1202
+ color: e.key ? oe(n.properties, e.id, e.key) ? "warning.main" : "primary.main" : "error.main"
1200
1203
  }
1201
1204
  },
1202
1205
  value: e.key || "",
@@ -1207,7 +1210,7 @@ function sr({ data: e, params: t, visible: i, config: l, currentLocale: f, defau
1207
1210
  });
1208
1211
  },
1209
1212
  InputProps: {
1210
- endAdornment: !e.key || e.key && oe(l.properties, e.id, e.key) ? /* @__PURE__ */ r(pe, {
1213
+ endAdornment: !e.key || e.key && oe(n.properties, e.id, e.key) ? /* @__PURE__ */ r(ne, {
1211
1214
  position: "end",
1212
1215
  sx: {
1213
1216
  width: 16,
@@ -1227,7 +1230,7 @@ function sr({ data: e, params: t, visible: i, config: l, currentLocale: f, defau
1227
1230
  label: P("label"),
1228
1231
  size: "small",
1229
1232
  sx: { flex: 1 },
1230
- value: (((x = (g = e.locales) == null ? void 0 : g[f]) == null ? void 0 : x.name) ?? ((c = (n = e.locales) == null ? void 0 : n[v]) == null ? void 0 : c.name)) || "",
1233
+ value: (((v = (g = e.locales) == null ? void 0 : g[f]) == null ? void 0 : v.name) ?? ((c = (l = e.locales) == null ? void 0 : l[x]) == null ? void 0 : c.name)) || "",
1231
1234
  onChange: (d) => {
1232
1235
  w((k) => {
1233
1236
  var h;
@@ -1258,8 +1261,8 @@ function sr({ data: e, params: t, visible: i, config: l, currentLocale: f, defau
1258
1261
  /* @__PURE__ */ O(j, { direction: "row", gap: 1, children: [
1259
1262
  /* @__PURE__ */ r(b, {
1260
1263
  allComponents: p,
1261
- defaultLocale: v,
1262
- component: l,
1264
+ defaultLocale: x,
1265
+ component: n,
1263
1266
  property: e,
1264
1267
  label: P("defaultValue"),
1265
1268
  size: "small",
@@ -1285,96 +1288,96 @@ function sr({ data: e, params: t, visible: i, config: l, currentLocale: f, defau
1285
1288
  });
1286
1289
  }
1287
1290
  function vt(e, t) {
1288
- const [i, l] = G(0);
1291
+ const [i, n] = G(0);
1289
1292
  return _(() => {
1290
- const v = setTimeout(() => {
1293
+ const x = setTimeout(() => {
1291
1294
  if (e.current) {
1292
1295
  let p = e.current.parentElement, w = 0;
1293
1296
  for (; p; )
1294
1297
  p.classList.contains("property-container") && w++, p = p.parentElement;
1295
- l(w);
1298
+ n(w);
1296
1299
  }
1297
1300
  }, 100);
1298
- return () => clearTimeout(v);
1301
+ return () => clearTimeout(x);
1299
1302
  }, [e, t]), i;
1300
1303
  }
1301
- function xt({ config: e, currentLocale: t, defaultLocale: i, allComponents: l, onUpdateConfig: f, useI18nEditor: v = !0 }) {
1304
+ function xt({ config: e, currentLocale: t, defaultLocale: i, allComponents: n, onUpdateConfig: f, useI18nEditor: x = !0 }) {
1302
1305
  const { t: p } = V(), w = Se({ variant: "dialog" }), P = e.properties && U(Object.values(e.properties), "index");
1303
1306
  return /* @__PURE__ */ r(me, { children: /* @__PURE__ */ O(j, { gap: 2, children: [
1304
1307
  /* @__PURE__ */ O(j, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
1305
1308
  /* @__PURE__ */ r(W, { variant: "subtitle1", children: p("properties") }),
1306
1309
  /* @__PURE__ */ r(N, { flex: 1 }),
1307
- v && /* @__PURE__ */ r(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Ie(w), children: /* @__PURE__ */ r(Ze, { fontSize: "small" }) })
1310
+ x && /* @__PURE__ */ r(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...Ie(w), children: /* @__PURE__ */ r(Ze, { fontSize: "small" }) })
1308
1311
  ] }),
1309
- e.properties && Object.keys(e.properties).length > 0 ? /* @__PURE__ */ r(nr, {
1312
+ e.properties && Object.keys(e.properties).length > 0 ? /* @__PURE__ */ r(lr, {
1310
1313
  component: j,
1311
1314
  gap: 2,
1312
1315
  list: e.properties,
1313
- renderItem: (b, g, x) => {
1314
- const n = xe(e.properties, b.id);
1315
- return /* @__PURE__ */ r(ie, {
1316
+ renderItem: (b, g, v) => {
1317
+ const l = xe(e.properties, b.id);
1318
+ return /* @__PURE__ */ r(te, {
1316
1319
  elevation: 0,
1317
1320
  className: "property-container",
1318
1321
  sx: {
1319
1322
  p: 1.25,
1320
1323
  borderRadius: 1,
1321
- border: n ? "1px solid" : "1px dashed",
1324
+ border: l ? "1px solid" : "1px dashed",
1322
1325
  borderColor: "divider"
1323
1326
  },
1324
1327
  children: /* @__PURE__ */ r(j, { gap: 2, children: /* @__PURE__ */ r(sr, {
1325
1328
  data: b,
1326
- params: x,
1327
- visible: n,
1329
+ params: v,
1330
+ visible: l,
1328
1331
  config: e,
1329
1332
  currentLocale: t,
1330
1333
  defaultLocale: i,
1331
- allComponents: l,
1334
+ allComponents: n,
1332
1335
  onUpdateConfig: f
1333
1336
  }) })
1334
1337
  }, b.id);
1335
1338
  }
1336
- }) : /* @__PURE__ */ r(ae, { style: { fontSize: 12 }, children: p("maker.properties.noProperties") }),
1339
+ }) : /* @__PURE__ */ r(pe, { style: { fontSize: 12 }, children: p("maker.properties.noProperties") }),
1337
1340
  /* @__PURE__ */ r(A, {
1338
1341
  fullWidth: !0,
1339
1342
  variant: "outlined",
1340
1343
  className: "ignore-style-override",
1341
1344
  onClick: () => {
1342
1345
  f((b) => {
1343
- var x;
1346
+ var v;
1344
1347
  const g = Ke();
1345
- b.properties ?? (b.properties = {}), (x = b.properties)[g] ?? (x[g] = { index: (P == null ? void 0 : P.length) || 0, data: { id: g } });
1348
+ b.properties ?? (b.properties = {}), (v = b.properties)[g] ?? (v[g] = { index: (P == null ? void 0 : P.length) || 0, data: { id: g } });
1346
1349
  });
1347
1350
  },
1348
1351
  startIcon: /* @__PURE__ */ r(er, {}),
1349
1352
  children: p("addObject", { object: p("property") })
1350
1353
  }),
1351
- v && /* @__PURE__ */ r(cr, { ...ir(w), component: e })
1354
+ x && /* @__PURE__ */ r(cr, { ...ir(w), component: e })
1352
1355
  ] }) });
1353
1356
  }
1354
1357
  function gt({ property: e, allComponents: t }) {
1355
1358
  const i = Se({ variant: "popper" });
1356
1359
  return /* @__PURE__ */ O(q, { children: [
1357
1360
  /* @__PURE__ */ r(A, { sx: { minWidth: 0 }, ...Ie(i), children: /* @__PURE__ */ r(tr, { fontSize: "small" }) }),
1358
- /* @__PURE__ */ r(Pr, { ...Xr(i), children: /* @__PURE__ */ r(Tr, { onClickAway: i.close, children: /* @__PURE__ */ r(ie, { children: /* @__PURE__ */ r(N, { width: 500, p: 2, children: /* @__PURE__ */ r(Oe, {
1361
+ /* @__PURE__ */ r(Pr, { ...Xr(i), children: /* @__PURE__ */ r(Tr, { onClickAway: i.close, children: /* @__PURE__ */ r(te, { children: /* @__PURE__ */ r(N, { width: 500, p: 2, children: /* @__PURE__ */ r(Oe, {
1359
1362
  value: e.componentId,
1360
- onChange: (l, f) => e.componentId = f,
1363
+ onChange: (n, f) => e.componentId = f,
1361
1364
  allComponents: t
1362
1365
  }) }) }) }) })
1363
1366
  ] });
1364
1367
  }
1365
- function Pt({ value: e, valueImmutable: t, onChange: i, defaultLocale: l, allComponents: f }) {
1368
+ function Pt({ value: e, valueImmutable: t, onChange: i, defaultLocale: n, allComponents: f }) {
1366
1369
  var g;
1367
- const [v, p] = G(!1), { t: w, locale: P } = V(), b = typeof (e == null ? void 0 : e.componentId) == "string" ? (g = f[e.componentId]) == null ? void 0 : g.data : void 0;
1370
+ const [x, p] = G(!1), { t: w, locale: P } = V(), b = typeof (e == null ? void 0 : e.componentId) == "string" ? (g = f[e.componentId]) == null ? void 0 : g.data : void 0;
1368
1371
  return b ? /* @__PURE__ */ O(N, { sx: { width: "100%", position: "relative" }, children: [
1369
- /* @__PURE__ */ r(le, {
1372
+ /* @__PURE__ */ r(ie, {
1370
1373
  sx: { minWidth: 0 },
1371
1374
  disabled: !b,
1372
1375
  size: "small",
1373
- onClick: () => p(!v),
1374
- color: v ? "primary" : "default",
1376
+ onClick: () => p(!x),
1377
+ color: x ? "primary" : "default",
1375
1378
  children: /* @__PURE__ */ r(tr, { fontSize: "small" })
1376
1379
  }),
1377
- v && /* @__PURE__ */ r(xr, { in: v, timeout: "auto", unmountOnExit: !0, sx: { width: "100%", zIndex: 10 }, children: /* @__PURE__ */ O(ie, {
1380
+ x && /* @__PURE__ */ r(xr, { in: x, timeout: "auto", unmountOnExit: !0, sx: { width: "100%", zIndex: 10 }, children: /* @__PURE__ */ O(te, {
1378
1381
  elevation: 1,
1379
1382
  sx: {
1380
1383
  mt: 1,
@@ -1388,12 +1391,12 @@ function Pt({ value: e, valueImmutable: t, onChange: i, defaultLocale: l, allCom
1388
1391
  /* @__PURE__ */ r(N, { width: "100%", mb: 2, children: /* @__PURE__ */ r(dr, {
1389
1392
  config: b,
1390
1393
  currentLocale: P,
1391
- defaultLocale: l,
1394
+ defaultLocale: n,
1392
1395
  allComponents: f,
1393
1396
  propertiesValue: e == null ? void 0 : e.properties,
1394
- onChange: ({ id: x, value: n }) => {
1395
- const c = jr(n.value), s = JSON.parse(JSON.stringify(e));
1396
- s != null && s.componentId && (t ? i == null || i({ ...s, properties: { ...s.properties, [x]: { value: c } } }) : (s.properties = s.properties ?? {}, s.properties[x] = { value: c }, i == null || i(s)));
1397
+ onChange: ({ id: v, value: l }) => {
1398
+ const c = jr(l.value), s = JSON.parse(JSON.stringify(e));
1399
+ s != null && s.componentId && (t ? i == null || i({ ...s, properties: { ...s.properties, [v]: { value: c } } }) : (s.properties = s.properties ?? {}, s.properties[v] = { value: c }, i == null || i(s)));
1397
1400
  }
1398
1401
  }) }),
1399
1402
  /* @__PURE__ */ r(A, { size: "small", onClick: () => p(!1), sx: { mt: 1 }, children: w("close") })
@@ -1402,17 +1405,17 @@ function Pt({ value: e, valueImmutable: t, onChange: i, defaultLocale: l, allCom
1402
1405
  ] }) : null;
1403
1406
  }
1404
1407
  function cr({ type: e = "properties", component: t, ...i }) {
1405
- var x, n, c;
1406
- const { t: l } = V(), { state: { components: f, supportedLocales: v, config: { defaultLocale: p } } } = te(), w = Pe(), P = ne(t).doc, b = e === "properties" ? t.properties : e === "parameters" && ((x = t.renderer) == null ? void 0 : x.type) === "component" ? (n = f[t.renderer.componentId]) == null ? void 0 : n.data.properties : void 0, g = ((c = t.renderer) == null ? void 0 : c.type) === "component" ? t : void 0;
1408
+ var v, l, c;
1409
+ const { t: n } = V(), { state: { components: f, supportedLocales: x, config: { defaultLocale: p } } } = ae(), w = Pe(), P = le(t).doc, b = e === "properties" ? t.properties : e === "parameters" && ((v = t.renderer) == null ? void 0 : v.type) === "component" ? (l = f[t.renderer.componentId]) == null ? void 0 : l.data.properties : void 0, g = ((c = t.renderer) == null ? void 0 : c.type) === "component" ? t : void 0;
1407
1410
  return /* @__PURE__ */ O(we, { ...i, fullWidth: !0, maxWidth: "lg", children: [
1408
- /* @__PURE__ */ r(_e, { children: l("i18nEditorTitle") }),
1409
- /* @__PURE__ */ r($e, { children: b && /* @__PURE__ */ r(j, { children: /* @__PURE__ */ O(Fe, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
1410
- /* @__PURE__ */ r(Me, { children: /* @__PURE__ */ r(ce, { children: v.map(({ locale: s, name: u }) => /* @__PURE__ */ r(de, { children: /* @__PURE__ */ O(W, { color: "text.primary", children: [
1411
+ /* @__PURE__ */ r(_e, { children: n("i18nEditorTitle") }),
1412
+ /* @__PURE__ */ r($e, { children: b && /* @__PURE__ */ r(j, { children: /* @__PURE__ */ O(Me, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
1413
+ /* @__PURE__ */ r(Fe, { children: /* @__PURE__ */ r(ce, { children: x.map(({ locale: s, name: u }) => /* @__PURE__ */ r(de, { children: /* @__PURE__ */ O(W, { color: "text.primary", children: [
1411
1414
  u,
1412
1415
  p === s && /* @__PURE__ */ r(Kr, { sx: { fontSize: 12 } })
1413
1416
  ] }) }, s)) }) }),
1414
- /* @__PURE__ */ r(Je, { children: U(Object.values(b), "index").map(({ data: s }) => /* @__PURE__ */ r(ce, { children: v.map(({ locale: u }) => {
1415
- var d, k, o, h, m, y, I, a, S, C, z, E, T, B, K, F, Q, X, Z, ee, Ce, Ne, je, ze, Re, Ve;
1417
+ /* @__PURE__ */ r(Je, { children: U(Object.values(b), "index").map(({ data: s }) => /* @__PURE__ */ r(ce, { children: x.map(({ locale: u }) => {
1418
+ var d, k, o, h, m, y, I, a, S, C, z, E, T, B, K, M, Q, X, Z, ee, Ce, Ne, je, ze, Re, Ve;
1416
1419
  return /* @__PURE__ */ r(de, { children: /* @__PURE__ */ r(j, { gap: 1, children: e === "properties" ? /* @__PURE__ */ O(q, { children: [
1417
1420
  /* @__PURE__ */ r(R, {
1418
1421
  size: "small",
@@ -1426,12 +1429,12 @@ function cr({ type: e = "properties", component: t, ...i }) {
1426
1429
  }),
1427
1430
  /* @__PURE__ */ r(R, {
1428
1431
  size: "small",
1429
- label: l("label"),
1432
+ label: n("label"),
1430
1433
  value: (((k = (d = s.locales) == null ? void 0 : d[u]) == null ? void 0 : k.name) ?? ((h = (o = s.locales) == null ? void 0 : o[p]) == null ? void 0 : h.name)) || "",
1431
1434
  onChange: ($) => {
1432
1435
  P.transact(() => {
1433
- var M;
1434
- s.locales ?? (s.locales = {}), (M = s.locales)[u] ?? (M[u] = {}), s.locales[u].name = $.target.value;
1436
+ var F;
1437
+ s.locales ?? (s.locales = {}), (F = s.locales)[u] ?? (F[u] = {}), s.locales[u].name = $.target.value;
1435
1438
  });
1436
1439
  }
1437
1440
  }),
@@ -1447,8 +1450,8 @@ function cr({ type: e = "properties", component: t, ...i }) {
1447
1450
  value: ((a = (I = s.locales) == null ? void 0 : I[u]) == null ? void 0 : a.defaultValue) ?? ((C = (S = s.locales) == null ? void 0 : S[p]) == null ? void 0 : C.defaultValue),
1448
1451
  onChange: ($) => {
1449
1452
  P.transact(() => {
1450
- var M;
1451
- s.locales ?? (s.locales = {}), (M = s.locales)[u] ?? (M[u] = {}), s.locales[u].defaultValue = $;
1453
+ var F;
1454
+ s.locales ?? (s.locales = {}), (F = s.locales)[u] ?? (F[u] = {}), s.locales[u].defaultValue = $;
1452
1455
  });
1453
1456
  }
1454
1457
  }) })
@@ -1460,11 +1463,11 @@ function cr({ type: e = "properties", component: t, ...i }) {
1460
1463
  size: "small",
1461
1464
  fullWidth: !0,
1462
1465
  valueImmutable: ue((B = (T = (E = (z = g.renderer.properties) == null ? void 0 : z[s.id]) == null ? void 0 : E.locales) == null ? void 0 : T[u]) == null ? void 0 : B.value),
1463
- value: ((X = (Q = (F = (K = g.renderer.properties) == null ? void 0 : K[s.id]) == null ? void 0 : F.locales) == null ? void 0 : Q[u]) == null ? void 0 : X.value) ?? ((Ne = (Ce = (ee = (Z = g.renderer.properties) == null ? void 0 : Z[s.id]) == null ? void 0 : ee.locales) == null ? void 0 : Ce[p]) == null ? void 0 : Ne.value) ?? ((ze = (je = s.locales) == null ? void 0 : je[u]) == null ? void 0 : ze.defaultValue) ?? ((Ve = (Re = s.locales) == null ? void 0 : Re[p]) == null ? void 0 : Ve.defaultValue),
1466
+ value: ((X = (Q = (M = (K = g.renderer.properties) == null ? void 0 : K[s.id]) == null ? void 0 : M.locales) == null ? void 0 : Q[u]) == null ? void 0 : X.value) ?? ((Ne = (Ce = (ee = (Z = g.renderer.properties) == null ? void 0 : Z[s.id]) == null ? void 0 : ee.locales) == null ? void 0 : Ce[p]) == null ? void 0 : Ne.value) ?? ((ze = (je = s.locales) == null ? void 0 : je[u]) == null ? void 0 : ze.defaultValue) ?? ((Ve = (Re = s.locales) == null ? void 0 : Re[p]) == null ? void 0 : Ve.defaultValue),
1464
1467
  onChange: ($) => {
1465
1468
  P.transact(() => {
1466
- var M, Ee, Te, Ae, De;
1467
- (M = g.renderer).properties ?? (M.properties = {}), (Ee = g.renderer.properties)[Te = s.id] ?? (Ee[Te] = {}), (Ae = g.renderer.properties[s.id]).locales ?? (Ae.locales = {}), (De = g.renderer.properties[s.id].locales)[u] ?? (De[u] = {}), g.renderer.properties[s.id].locales[u].value = $;
1469
+ var F, Ee, Te, Ae, De;
1470
+ (F = g.renderer).properties ?? (F.properties = {}), (Ee = g.renderer.properties)[Te = s.id] ?? (Ee[Te] = {}), (Ae = g.renderer.properties[s.id]).locales ?? (Ae.locales = {}), (De = g.renderer.properties[s.id].locales)[u] ?? (De[u] = {}), g.renderer.properties[s.id].locales[u].value = $;
1468
1471
  });
1469
1472
  }
1470
1473
  }) }) : null }, s.id) }, u);
@@ -1473,17 +1476,17 @@ function cr({ type: e = "properties", component: t, ...i }) {
1473
1476
  /* @__PURE__ */ r(He, { children: /* @__PURE__ */ r(A, { onClick: (s) => {
1474
1477
  var u;
1475
1478
  return (u = i.onClose) == null ? void 0 : u.call(i, s, "escapeKeyDown");
1476
- }, children: l("close") }) })
1479
+ }, children: n("close") }) })
1477
1480
  ] });
1478
1481
  }
1479
1482
  const Be = (e, t) => (i) => {
1480
- const l = [
1483
+ const n = [
1481
1484
  i.palette.info.main,
1482
1485
  i.palette.primary.main,
1483
1486
  i.palette.secondary.main,
1484
1487
  i.palette.success.main,
1485
1488
  i.palette.warning.main
1486
- ], f = Math.min(l.length - 1, e), v = l[f], p = fe(v, 0.5), w = fe(v, 1);
1489
+ ], f = Math.min(n.length - 1, e), x = n[f], p = fe(x, 0.5), w = fe(x, 1);
1487
1490
  return {
1488
1491
  // 保留原有的边框样式
1489
1492
  borderColor: `${p} !important`,
@@ -1495,61 +1498,61 @@ const Be = (e, t) => (i) => {
1495
1498
  ...t
1496
1499
  };
1497
1500
  };
1498
- function kt({ property: e, onChange: t, defaultLocale: i, allComponents: l }) {
1499
- const { t: f, locale: v } = V(), p = H(null), w = vt(p, e), P = D(() => {
1501
+ function kt({ property: e, onChange: t, defaultLocale: i, allComponents: n }) {
1502
+ const { t: f, locale: x } = V(), p = H(null), w = vt(p, e), P = D(() => {
1500
1503
  if (!(e.type !== "json" && e.type !== "yaml" && e.type !== "array") && e.subProperties)
1501
1504
  try {
1502
1505
  let b = {};
1503
- U(Object.values(e.subProperties), "index").filter((n) => n.data.visible !== !1 && n.data.key).forEach(({ data: n }) => {
1506
+ U(Object.values(e.subProperties), "index").filter((l) => l.data.visible !== !1 && l.data.key).forEach(({ data: l }) => {
1504
1507
  var s, u, d, k;
1505
- if (!n.key)
1508
+ if (!l.key)
1506
1509
  return;
1507
- let c = ((u = (s = n.locales) == null ? void 0 : s[v]) == null ? void 0 : u.defaultValue) ?? ((k = (d = n.locales) == null ? void 0 : d[i]) == null ? void 0 : k.defaultValue);
1508
- if (n.type === "number")
1510
+ let c = ((u = (s = l.locales) == null ? void 0 : s[x]) == null ? void 0 : u.defaultValue) ?? ((k = (d = l.locales) == null ? void 0 : d[i]) == null ? void 0 : k.defaultValue);
1511
+ if (l.type === "number")
1509
1512
  c = Number(c);
1510
- else if (n.type === "boolean")
1513
+ else if (l.type === "boolean")
1511
1514
  c = c === !0 || c === "true";
1512
- else if ((n.type === "json" || n.type === "yaml") && typeof c == "string")
1515
+ else if ((l.type === "json" || l.type === "yaml") && typeof c == "string")
1513
1516
  try {
1514
- n.type === "json" ? c = JSON.parse(c) : c = be.parse(c);
1517
+ l.type === "json" ? c = JSON.parse(c) : c = be.parse(c);
1515
1518
  } catch (o) {
1516
1519
  console.error("Error parsing nested value", c, o), c = {};
1517
1520
  }
1518
- b[n.key] = c;
1521
+ b[l.key] = c;
1519
1522
  }), e.type === "array" && !Array.isArray(b) && (b = J(b) ? [] : [b]);
1520
- const x = ge(b, e.type);
1521
- t == null || t(x);
1523
+ const v = ge(b, e.type);
1524
+ t == null || t(v);
1522
1525
  } catch (b) {
1523
1526
  console.error("Error converting structure to text:", b);
1524
1527
  }
1525
- }, [e, v, i, t]);
1528
+ }, [e, x, i, t]);
1526
1529
  return e.type !== "json" && e.type !== "yaml" && e.type !== "array" ? null : /* @__PURE__ */ O(j, { direction: "column", gap: 1.5, sx: { width: "100%" }, ref: p, children: [
1527
1530
  /* @__PURE__ */ r(gr, { sx: { mt: -1 }, children: /* @__PURE__ */ r(W, { variant: "caption", color: "text.secondary", children: f("maker.properties.subProperties") }) }),
1528
- e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */ r(nr, {
1531
+ e.subProperties && Object.keys(e.subProperties).length > 0 ? /* @__PURE__ */ r(lr, {
1529
1532
  component: j,
1530
1533
  gap: 2,
1531
1534
  list: e.subProperties,
1532
- renderItem: (b, g, x) => {
1533
- const n = b.visible !== !1;
1534
- return /* @__PURE__ */ r(ie, {
1535
+ renderItem: (b, g, v) => {
1536
+ const l = b.visible !== !1;
1537
+ return /* @__PURE__ */ r(te, {
1535
1538
  elevation: 0,
1536
1539
  className: "property-container",
1537
1540
  sx: {
1538
1541
  p: 1.25,
1539
1542
  borderRadius: 1,
1540
- border: n ? "1px solid" : "1px dashed",
1543
+ border: l ? "1px solid" : "1px dashed",
1541
1544
  "&": Be(w)
1542
1545
  },
1543
1546
  children: /* @__PURE__ */ r(j, { gap: 2, children: /* @__PURE__ */ r(sr, {
1544
1547
  data: b,
1545
- params: x,
1546
- visible: n,
1548
+ params: v,
1549
+ visible: l,
1547
1550
  config: {
1548
1551
  properties: e.subProperties
1549
1552
  },
1550
- currentLocale: v,
1553
+ currentLocale: x,
1551
1554
  defaultLocale: i,
1552
- allComponents: l,
1555
+ allComponents: n,
1553
1556
  onUpdateConfig: (c) => {
1554
1557
  try {
1555
1558
  const s = { properties: e.subProperties || {} };
@@ -1566,7 +1569,7 @@ function kt({ property: e, onChange: t, defaultLocale: i, allComponents: l }) {
1566
1569
  }) })
1567
1570
  }, b.id);
1568
1571
  }
1569
- }) : /* @__PURE__ */ r(ae, { style: { fontSize: 12, height: 100 }, children: f("maker.properties.noSubProperties") }),
1572
+ }) : /* @__PURE__ */ r(pe, { style: { fontSize: 12, height: 100 }, children: f("maker.properties.noSubProperties") }),
1570
1573
  /* @__PURE__ */ r(A, {
1571
1574
  fullWidth: !0,
1572
1575
  variant: "outlined",
@@ -1575,7 +1578,7 @@ function kt({ property: e, onChange: t, defaultLocale: i, allComponents: l }) {
1575
1578
  startIcon: /* @__PURE__ */ r(er, {}),
1576
1579
  onClick: () => {
1577
1580
  try {
1578
- const b = e.subProperties || {}, g = Ke(), n = {
1581
+ const b = e.subProperties || {}, g = Ke(), l = {
1579
1582
  index: Object.values(b).length,
1580
1583
  data: {
1581
1584
  id: g,
@@ -1583,7 +1586,7 @@ function kt({ property: e, onChange: t, defaultLocale: i, allComponents: l }) {
1583
1586
  type: "string",
1584
1587
  visible: !0,
1585
1588
  locales: {
1586
- [v]: {
1589
+ [x]: {
1587
1590
  name: "",
1588
1591
  defaultValue: ""
1589
1592
  }
@@ -1595,7 +1598,7 @@ function kt({ property: e, onChange: t, defaultLocale: i, allComponents: l }) {
1595
1598
  ...e,
1596
1599
  subProperties: {
1597
1600
  ...b,
1598
- [g]: n
1601
+ [g]: l
1599
1602
  }
1600
1603
  };
1601
1604
  t == null || t(c, { forceUpdateProperty: !0 }), P();
@@ -1612,9 +1615,9 @@ function kt({ property: e, onChange: t, defaultLocale: i, allComponents: l }) {
1612
1615
  })
1613
1616
  ] });
1614
1617
  }
1615
- function L({ component: e, property: t, value: i, onChange: l, valueImmutable: f, defaultLocale: v, allComponents: p, ...w }) {
1618
+ function L({ component: e, property: t, value: i, onChange: n, valueImmutable: f, defaultLocale: x, allComponents: p, ...w }) {
1616
1619
  var c, s, u, d, k;
1617
- const { locale: P } = V(), b = Or(), g = H(null), x = () => {
1620
+ const { locale: P } = V(), b = Or(), g = H(null), v = () => {
1618
1621
  var h;
1619
1622
  const o = (h = b == null ? void 0 : b.current) == null ? void 0 : h.getUploader();
1620
1623
  o == null || o.open(), g.current && o.onceUploadSuccess(({ response: m }) => {
@@ -1622,92 +1625,92 @@ function L({ component: e, property: t, value: i, onChange: l, valueImmutable: f
1622
1625
  let y = ((I = m == null ? void 0 : m.data) == null ? void 0 : I.filename) || "";
1623
1626
  y && (y = `mediakit://${y}`, i && !i.includes("mediakit://") && (y += " # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")), (a = g.current) == null || a.call(g, y);
1624
1627
  });
1625
- }, n = w.label ?? (((s = (c = t.locales) == null ? void 0 : c[P]) == null ? void 0 : s.name) || ((d = (u = t.locales) == null ? void 0 : u[v]) == null ? void 0 : d.name) || t.key || t.id);
1628
+ }, l = w.label ?? (((s = (c = t.locales) == null ? void 0 : c[P]) == null ? void 0 : s.name) || ((d = (u = t.locales) == null ? void 0 : u[x]) == null ? void 0 : d.name) || t.key || t.id);
1626
1629
  if (t.type === "number")
1627
1630
  return /* @__PURE__ */ r(wt, {
1628
1631
  ...w,
1629
- label: n,
1632
+ label: l,
1630
1633
  NumberProps: {
1631
1634
  value: ["number", "string"].includes(typeof i) ? i : null,
1632
- onChange: (o, h) => l == null ? void 0 : l(h)
1635
+ onChange: (o, h) => n == null ? void 0 : n(h)
1633
1636
  }
1634
1637
  });
1635
1638
  if (t.type === "decimal")
1636
1639
  return /* @__PURE__ */ r(R, {
1637
1640
  ...w,
1638
- label: n,
1641
+ label: l,
1639
1642
  type: "text",
1640
1643
  value: i ?? "",
1641
1644
  onChange: (o) => {
1642
1645
  const h = o.target.value;
1643
1646
  if (h === "" || h === "-") {
1644
- l == null || l(h);
1647
+ n == null || n(h);
1645
1648
  return;
1646
1649
  }
1647
1650
  if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(h)) {
1648
1651
  let y = h;
1649
- /^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(y) && (y = Number(y)), l == null || l(y);
1652
+ /^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(y) && (y = Number(y)), n == null || n(y);
1650
1653
  }
1651
1654
  }
1652
1655
  });
1653
1656
  if (t.type === "boolean")
1654
1657
  return /* @__PURE__ */ r(Ge, {
1655
- label: n,
1658
+ label: l,
1656
1659
  labelPlacement: "start",
1657
- control: /* @__PURE__ */ r(vr, { checked: i === !0, onChange: (o, h) => l == null ? void 0 : l(h) })
1660
+ control: /* @__PURE__ */ r(vr, { checked: i === !0, onChange: (o, h) => n == null ? void 0 : n(h) })
1658
1661
  });
1659
1662
  if (t.type === "color")
1660
1663
  return /* @__PURE__ */ r(ot, {
1661
- label: n,
1664
+ label: l,
1662
1665
  value: i,
1663
1666
  onChange: (o) => {
1664
- l == null || l(o);
1667
+ n == null || n(o);
1665
1668
  }
1666
1669
  });
1667
1670
  if (t.type === "json" || t.type === "yaml")
1668
1671
  return /* @__PURE__ */ r(st, {
1669
- label: n,
1672
+ label: l,
1670
1673
  value: i,
1671
1674
  onChange: (o) => {
1672
- l == null || l(o);
1675
+ n == null || n(o);
1673
1676
  },
1674
1677
  property: t,
1675
1678
  component: e,
1676
- defaultLocale: v,
1679
+ defaultLocale: x,
1677
1680
  allComponents: p,
1678
1681
  PropertyValueField: L,
1679
1682
  onUpload: (o) => {
1680
- g.current = o, x();
1683
+ g.current = o, v();
1681
1684
  }
1682
1685
  });
1683
1686
  if (t.type === "custom") {
1684
1687
  const o = (k = p[t.componentId]) == null ? void 0 : k.data;
1685
1688
  return o ? /* @__PURE__ */ r(N, { width: "100%", children: /* @__PURE__ */ r(Xe, {
1686
1689
  componentId: o.id,
1687
- props: { label: n, value: i, onChange: l },
1690
+ props: { label: l, value: i, onChange: n },
1688
1691
  locale: P,
1689
1692
  dev: {
1690
1693
  mode: "draft",
1691
1694
  components: p,
1692
- defaultLocale: v
1695
+ defaultLocale: x
1693
1696
  }
1694
- }) }) : /* @__PURE__ */ r(R, { ...w, label: n, disabled: !0, placeholder: "Click right button select a component" });
1697
+ }) }) : /* @__PURE__ */ r(R, { ...w, label: l, disabled: !0, placeholder: "Click right button select a component" });
1695
1698
  }
1696
1699
  if (t.type === "component")
1697
1700
  return /* @__PURE__ */ O(j, { width: "100%", direction: "column", gap: 1, children: [
1698
1701
  /* @__PURE__ */ r(Oe, {
1699
1702
  allComponents: p,
1700
- label: n,
1703
+ label: l,
1701
1704
  value: i == null ? void 0 : i.componentId,
1702
1705
  onChange: (o, h) => {
1703
- f || !i ? l == null || l({ ...i && JSON.parse(JSON.stringify(i)), componentId: h }) : typeof i == "object" && (i.componentId = h, l == null || l({ ...i && JSON.parse(JSON.stringify(i)), componentId: h }));
1706
+ f || !i ? n == null || n({ ...i && JSON.parse(JSON.stringify(i)), componentId: h }) : typeof i == "object" && (i.componentId = h, n == null || n({ ...i && JSON.parse(JSON.stringify(i)), componentId: h }));
1704
1707
  }
1705
1708
  }),
1706
1709
  (i == null ? void 0 : i.componentId) && /* @__PURE__ */ r(Pt, {
1707
1710
  value: i,
1708
1711
  valueImmutable: f,
1709
- onChange: l,
1710
- defaultLocale: v,
1712
+ onChange: n,
1713
+ defaultLocale: x,
1711
1714
  allComponents: p
1712
1715
  })
1713
1716
  ] });
@@ -1717,42 +1720,50 @@ function L({ component: e, property: t, value: i, onChange: l, valueImmutable: f
1717
1720
  const h = t.type === "url" ? i == null ? void 0 : i.url : i;
1718
1721
  return /* @__PURE__ */ r(R, {
1719
1722
  ...w,
1720
- label: n,
1723
+ label: l,
1721
1724
  value: typeof h == "string" ? h : "",
1722
1725
  multiline: o,
1723
1726
  minRows: o ? 2 : void 0,
1724
1727
  maxRows: o ? 10 : void 0,
1725
- onChange: (m) => l == null ? void 0 : l(t.type === "url" ? { ...i, url: m.target.value, mediaKitUrl: m.target.value } : m.target.value),
1728
+ onChange: (m) => n == null ? void 0 : n(t.type === "url" ? { ...i, url: m.target.value, mediaKitUrl: m.target.value } : m.target.value),
1726
1729
  InputProps: t.type === "url" ? {
1727
1730
  sx: {
1728
1731
  pr: 0
1729
1732
  },
1730
- endAdornment: /* @__PURE__ */ O(pe, { position: "end", children: [
1731
- /* @__PURE__ */ r(Qe, {
1732
- onChange: async ({ response: m }) => {
1733
- var S, C, z;
1734
- const y = ((S = m == null ? void 0 : m.data) == null ? void 0 : S.url) || ((C = m == null ? void 0 : m.data) == null ? void 0 : C.fileUrl);
1735
- let I;
1736
- y && (I = await Cr(y).catch(() => Nr(y)).catch(() => {
1737
- }));
1738
- let a = ((z = m == null ? void 0 : m.data) == null ? void 0 : z.filename) || "";
1739
- a && (a = `mediakit://${a}`), l == null || l({
1740
- url: y,
1741
- mediaKitUrl: a,
1742
- width: I == null ? void 0 : I.naturalWidth,
1743
- height: I == null ? void 0 : I.naturalHeight
1744
- });
1745
- }
1746
- }),
1747
- /* @__PURE__ */ r(Y, { title: "If you are using the 'mediaKitUrl' property, please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address.", children: /* @__PURE__ */ r(rr, { sx: { cursor: "default", mr: 1 }, fontSize: "small" }) })
1748
- ] })
1733
+ endAdornment: /* @__PURE__ */ O(ne, {
1734
+ position: "end",
1735
+ sx: {
1736
+ display: "flex",
1737
+ alignItems: "center",
1738
+ justifyContent: "center"
1739
+ },
1740
+ children: [
1741
+ /* @__PURE__ */ r(Qe, {
1742
+ onChange: async ({ response: m }) => {
1743
+ var S, C, z;
1744
+ const y = ((S = m == null ? void 0 : m.data) == null ? void 0 : S.url) || ((C = m == null ? void 0 : m.data) == null ? void 0 : C.fileUrl);
1745
+ let I;
1746
+ y && (I = await Cr(y).catch(() => Nr(y)).catch(() => {
1747
+ }));
1748
+ let a = ((z = m == null ? void 0 : m.data) == null ? void 0 : z.filename) || "";
1749
+ a && (a = `mediakit://${a}`), n == null || n({
1750
+ url: y,
1751
+ mediaKitUrl: a,
1752
+ width: I == null ? void 0 : I.naturalWidth,
1753
+ height: I == null ? void 0 : I.naturalHeight
1754
+ });
1755
+ }
1756
+ }),
1757
+ /* @__PURE__ */ r(Y, { title: "If you are using the 'mediaKitUrl' property, please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address.", children: /* @__PURE__ */ r(rr, { sx: { cursor: "default", mr: 1 }, fontSize: "small" }) })
1758
+ ]
1759
+ })
1749
1760
  } : void 0
1750
1761
  });
1751
1762
  }
1752
- return t.type === "array" ? /* @__PURE__ */ r(nt, {
1753
- label: n,
1763
+ return t.type === "array" ? /* @__PURE__ */ r(lt, {
1764
+ label: l,
1754
1765
  value: Array.isArray(i) ? i : [],
1755
- onChange: (o) => l == null ? void 0 : l(o),
1766
+ onChange: (o) => n == null ? void 0 : n(o),
1756
1767
  property: t,
1757
1768
  renderItem: ({ item: o, index: h, onChange: m }) => t.subProperties && Object.keys(t.subProperties).length > 0 ? /* @__PURE__ */ r(j, { gap: 1, width: "100%", children: U(Object.values(t.subProperties), "index").filter((y) => y.data.visible !== !1).map(({ data: y }) => y.key ? /* @__PURE__ */ r(L, {
1758
1769
  component: e,
@@ -1764,14 +1775,14 @@ function L({ component: e, property: t, value: i, onChange: l, valueImmutable: f
1764
1775
  },
1765
1776
  size: "small",
1766
1777
  fullWidth: !0,
1767
- defaultLocale: v,
1778
+ defaultLocale: x,
1768
1779
  allComponents: p
1769
1780
  }, y.id) : null) }, h) : /* @__PURE__ */ r(R, { size: w.size, fullWidth: !0, value: o, onChange: (y) => m(y.target.value) })
1770
1781
  }) : (console.error("Unsupported property type", t.type), null);
1771
1782
  }
1772
1783
  function wt({ NumberProps: e, ...t }) {
1773
- const { getInputProps: i } = Er(e), l = i();
1774
- return /* @__PURE__ */ r(R, { ...t, inputProps: l });
1784
+ const { getInputProps: i } = Er(e), n = i();
1785
+ return /* @__PURE__ */ r(R, { ...t, inputProps: n });
1775
1786
  }
1776
1787
  const St = `import React from '@blocklet/pages-kit/builtin/react'
1777
1788
  import { Box } from '@blocklet/pages-kit/builtin/mui/material'
@@ -1785,10 +1796,10 @@ export default function () {
1785
1796
  }`, It = `console.log('hello')
1786
1797
  `;
1787
1798
  function Ot({ value: e }) {
1788
- const { locale: t } = V(), i = Ye(), l = ne(e).doc;
1799
+ const { locale: t } = V(), i = Ye(), n = le(e).doc;
1789
1800
  return _(() => {
1790
1801
  var f;
1791
- (f = e.renderer) != null && f.script || (l.transact(() => {
1802
+ (f = e.renderer) != null && f.script || (n.transact(() => {
1792
1803
  e.renderer.script = e.renderer.type === "react-component" ? St : It;
1793
1804
  }), i());
1794
1805
  }, [e]), /* @__PURE__ */ r(N, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ r(ke, {
@@ -1804,8 +1815,8 @@ function Ot({ value: e }) {
1804
1815
  }, e.id) });
1805
1816
  }
1806
1817
  function Ct({ value: e }) {
1807
- var g, x, n;
1808
- const { t } = V(), i = ne(e).doc, { state: { components: l, config: { defaultLocale: f }, resources: v }, localState: { currentLocale: p } } = te(), w = Pe(), P = ((g = l[e.renderer.componentId]) == null ? void 0 : g.data) ?? ((n = (x = v.components) == null ? void 0 : x[e.renderer.componentId]) == null ? void 0 : n.component), b = Se({ variant: "dialog" });
1818
+ var g, v, l;
1819
+ const { t } = V(), i = le(e).doc, { state: { components: n, config: { defaultLocale: f }, resources: x }, localState: { currentLocale: p } } = ae(), w = Pe(), P = ((g = n[e.renderer.componentId]) == null ? void 0 : g.data) ?? ((l = (v = x.components) == null ? void 0 : v[e.renderer.componentId]) == null ? void 0 : l.component), b = Se({ variant: "dialog" });
1809
1820
  return /* @__PURE__ */ r(me, { children: /* @__PURE__ */ O(j, { gap: 1, children: [
1810
1821
  /* @__PURE__ */ r(Oe, {
1811
1822
  allComponents: w,
@@ -1831,8 +1842,8 @@ function Ct({ value: e }) {
1831
1842
  value: ((y = (m = (h = (o = e.renderer.properties) == null ? void 0 : o[c.id]) == null ? void 0 : h.locales) == null ? void 0 : m[p]) == null ? void 0 : y.value) ?? ((C = (S = (a = (I = e.renderer.properties) == null ? void 0 : I[c.id]) == null ? void 0 : a.locales) == null ? void 0 : S[f]) == null ? void 0 : C.value) ?? ((E = (z = c.locales) == null ? void 0 : z[p]) == null ? void 0 : E.defaultValue) ?? ((B = (T = c.locales) == null ? void 0 : T[f]) == null ? void 0 : B.defaultValue),
1832
1843
  onChange: (K) => {
1833
1844
  i.transact(() => {
1834
- var F, Q, X, Z, ee;
1835
- (F = e.renderer).properties ?? (F.properties = {}), (Q = e.renderer.properties)[X = c.id] ?? (Q[X] = {}), (Z = e.renderer.properties[c.id]).locales ?? (Z.locales = {}), (ee = e.renderer.properties[c.id].locales)[p] ?? (ee[p] = {}), e.renderer.properties[c.id].locales[p].value = K;
1845
+ var M, Q, X, Z, ee;
1846
+ (M = e.renderer).properties ?? (M.properties = {}), (Q = e.renderer.properties)[X = c.id] ?? (Q[X] = {}), (Z = e.renderer.properties[c.id]).locales ?? (Z.locales = {}), (ee = e.renderer.properties[c.id].locales)[p] ?? (ee[p] = {}), e.renderer.properties[c.id].locales[p].value = K;
1836
1847
  });
1837
1848
  }
1838
1849
  }) }, c.id);
@@ -1841,32 +1852,32 @@ function Ct({ value: e }) {
1841
1852
  ] })
1842
1853
  ] }) });
1843
1854
  }
1844
- function Oe({ label: e, options: t, excludes: i, value: l, onChange: f, allComponents: v, ...p }) {
1855
+ function Oe({ label: e, options: t, excludes: i, value: n, onChange: f, allComponents: x, ...p }) {
1845
1856
  var g;
1846
- const { t: w } = V(), P = t ?? U(Object.values(Yr(v, ...i ?? [])), "index").map((x) => x.data), b = (typeof l == "string" ? (g = v[l]) == null ? void 0 : g.data : void 0) ?? null;
1857
+ const { t: w } = V(), P = t ?? U(Object.values(Yr(x, ...i ?? [])), "index").map((v) => v.data), b = (typeof n == "string" ? (g = x[n]) == null ? void 0 : g.data : void 0) ?? null;
1847
1858
  return /* @__PURE__ */ r(Le, {
1848
1859
  ...p,
1849
1860
  size: "small",
1850
1861
  options: P,
1851
1862
  autoHighlight: !0,
1852
- isOptionEqualToValue: (x, n) => x.id === n.id,
1853
- getOptionKey: (x) => x.id,
1854
- getOptionLabel: (x) => x.name || x.id,
1855
- renderInput: (x) => /* @__PURE__ */ r(R, { label: e || w("component"), ...x }),
1863
+ isOptionEqualToValue: (v, l) => v.id === l.id,
1864
+ getOptionKey: (v) => v.id,
1865
+ getOptionLabel: (v) => v.name || v.id,
1866
+ renderInput: (v) => /* @__PURE__ */ r(R, { label: e || w("component"), ...v }),
1856
1867
  value: b,
1857
- onChange: (x, n) => {
1868
+ onChange: (v, l) => {
1858
1869
  var s, u, d, k, o, h;
1859
1870
  let c = {};
1860
- n && (c = {
1861
- blockletId: (s = v[n == null ? void 0 : n.id]) == null ? void 0 : s.blockletId,
1862
- blockletTitle: (u = v[n == null ? void 0 : n.id]) == null ? void 0 : u.blockletTitle,
1863
- componentName: ((k = (d = v[n == null ? void 0 : n.id]) == null ? void 0 : d.data) == null ? void 0 : k.name) || ((h = (o = v[n == null ? void 0 : n.id]) == null ? void 0 : o.data) == null ? void 0 : h.id)
1864
- }), f == null || f(x, n == null ? void 0 : n.id, c);
1871
+ l && (c = {
1872
+ blockletId: (s = x[l == null ? void 0 : l.id]) == null ? void 0 : s.blockletId,
1873
+ blockletTitle: (u = x[l == null ? void 0 : l.id]) == null ? void 0 : u.blockletTitle,
1874
+ componentName: ((k = (d = x[l == null ? void 0 : l.id]) == null ? void 0 : d.data) == null ? void 0 : k.name) || ((h = (o = x[l == null ? void 0 : l.id]) == null ? void 0 : o.data) == null ? void 0 : h.id)
1875
+ }), f == null || f(v, l == null ? void 0 : l.id, c);
1865
1876
  }
1866
1877
  });
1867
1878
  }
1868
- function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l, currentLocale: f, onChange: v, props: p }) {
1869
- const { t: w } = V(), [P, b] = G(e == null ? void 0 : e.properties), [g, x] = G(null);
1879
+ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: n, currentLocale: f, onChange: x, props: p }) {
1880
+ const { t: w } = V(), [P, b] = G(e == null ? void 0 : e.properties), [g, v] = G(null);
1870
1881
  _(() => {
1871
1882
  (() => {
1872
1883
  var k, o;
@@ -1876,16 +1887,16 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l,
1876
1887
  }) : b(e == null ? void 0 : e.properties);
1877
1888
  })();
1878
1889
  }, [JSON.stringify(e)]);
1879
- const n = D(() => !e || !P ? {} : Object.values(P).reduce((d, { data: k }) => {
1890
+ const l = D(() => !e || !P ? {} : Object.values(P).reduce((d, { data: k }) => {
1880
1891
  var h, m, y, I, a;
1881
1892
  const o = k.key || k.id;
1882
1893
  return d[k.id] = {
1883
1894
  key: o,
1884
- value: (p == null ? void 0 : p[o]) ?? ((h = l == null ? void 0 : l[k.id]) == null ? void 0 : h.value) ?? ((y = (m = k.locales) == null ? void 0 : m[f]) == null ? void 0 : y.defaultValue) ?? ((a = (I = k.locales) == null ? void 0 : I[i]) == null ? void 0 : a.defaultValue),
1895
+ value: (p == null ? void 0 : p[o]) ?? ((h = n == null ? void 0 : n[k.id]) == null ? void 0 : h.value) ?? ((y = (m = k.locales) == null ? void 0 : m[f]) == null ? void 0 : y.defaultValue) ?? ((a = (I = k.locales) == null ? void 0 : I[i]) == null ? void 0 : a.defaultValue),
1885
1896
  id: k.id,
1886
1897
  type: k.type
1887
1898
  }, d;
1888
- }, {}), [JSON.stringify(P), e, l, f, i]), c = re(() => {
1899
+ }, {}), [JSON.stringify(P), e, n, f, i]), c = re(() => {
1889
1900
  if (!P)
1890
1901
  return {
1891
1902
  canUseProperties: [],
@@ -1898,10 +1909,10 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l,
1898
1909
  visibleProperties: k,
1899
1910
  canUsePropertiesKeys: h
1900
1911
  };
1901
- }, [JSON.stringify(P)]), s = n(), u = Lr(s, "key");
1912
+ }, [JSON.stringify(P)]), s = l(), u = Lr(s, "key");
1902
1913
  return /* @__PURE__ */ r(me, { children: /* @__PURE__ */ O(j, { gap: 2, children: [
1903
1914
  /* @__PURE__ */ r(W, { variant: "subtitle1", children: w("maker.properties.parameters") }),
1904
- !e || c.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ r(ae, { style: { fontSize: 12 }, children: w("maker.properties.noParameters") }) : /* @__PURE__ */ O(q, { children: [
1915
+ !e || c.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ r(pe, { style: { fontSize: 12 }, children: w("maker.properties.noParameters") }) : /* @__PURE__ */ O(q, { children: [
1905
1916
  /* @__PURE__ */ r(j, { gap: 2, children: c.visibleProperties.map(({ data: d }) => {
1906
1917
  var k, o;
1907
1918
  return /* @__PURE__ */ r(N, { children: /* @__PURE__ */ r(L, {
@@ -1911,10 +1922,10 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l,
1911
1922
  fullWidth: !0,
1912
1923
  component: e,
1913
1924
  property: d,
1914
- valueImmutable: ue((k = l == null ? void 0 : l[d.id]) == null ? void 0 : k.value),
1925
+ valueImmutable: ue((k = n == null ? void 0 : n[d.id]) == null ? void 0 : k.value),
1915
1926
  value: (p == null ? void 0 : p[d.key || d.id]) ?? ((o = s[d.id]) == null ? void 0 : o.value),
1916
1927
  onChange: (h) => {
1917
- v({
1928
+ x({
1918
1929
  path: ["properties", d.id],
1919
1930
  id: d.id,
1920
1931
  value: { value: h },
@@ -1944,7 +1955,7 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l,
1944
1955
  }).reduce((h, m) => h.then(() => {
1945
1956
  const y = u[m], I = k.includes(m);
1946
1957
  if (y != null && y.id && I)
1947
- return v({
1958
+ return x({
1948
1959
  path: ["properties", y.id],
1949
1960
  id: y.id,
1950
1961
  value: { value: d[m] },
@@ -1961,7 +1972,7 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l,
1961
1972
  }), {
1962
1973
  key: a
1963
1974
  });
1964
- return x(S), Promise.resolve();
1975
+ return v(S), Promise.resolve();
1965
1976
  }), Promise.resolve());
1966
1977
  }
1967
1978
  }
@@ -1970,19 +1981,19 @@ function dr({ config: e, allComponents: t, defaultLocale: i, propertiesValue: l,
1970
1981
  ] }) });
1971
1982
  }
1972
1983
  function Nt({ config: e }) {
1973
- const { t } = V(), { localState: { currentLocale: i }, state: { config: { defaultLocale: l } } } = te(), [f, v] = G(!1), p = (w) => {
1974
- e.llmConfig = w;
1984
+ const { t, locale: i } = V(), [n, f] = G(!1), x = (p) => {
1985
+ e.llmConfig = p;
1975
1986
  };
1976
1987
  return /* @__PURE__ */ O(q, { children: [
1977
- /* @__PURE__ */ r(Y, { title: t("maker.properties.configDetailedDescription"), children: /* @__PURE__ */ r(le, { size: "small", color: "primary", onClick: () => v(!0), children: /* @__PURE__ */ r(Br, { fontSize: "small" }) }) }),
1978
- f && /* @__PURE__ */ r(mt, {
1979
- open: f,
1980
- onClose: () => v(!1),
1981
- onConfirm: p,
1988
+ /* @__PURE__ */ r(Y, { title: t("maker.properties.configLLMDescription"), children: /* @__PURE__ */ r(ie, { color: "primary", onClick: () => f(!0), size: "small", children: /* @__PURE__ */ r(Br, {}) }) }),
1989
+ n && /* @__PURE__ */ r(mt, {
1990
+ open: n,
1991
+ onClose: () => f(!1),
1992
+ onConfirm: x,
1982
1993
  component: e,
1983
1994
  initialConfig: e.llmConfig,
1984
1995
  locale: i,
1985
- defaultLocale: l,
1996
+ defaultLocale: "en",
1986
1997
  title: t("maker.properties.llmConfigTitle")
1987
1998
  })
1988
1999
  ] });