@blocklet/pages-kit-inner-components 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/setting.js CHANGED
@@ -1,147 +1,148 @@
1
- import { jsx as e, jsxs as k, Fragment as N } from "react/jsx-runtime";
2
- import { g as ee, i as Re, b as Oe, h as re, E as Qe, n as Xe, j as ce } from "../state-BfVA6vd8.mjs";
3
- import { TextField as D, Stack as S, FormControlLabel as ze, Switch as je, Box as w, InputAdornment as de, Dialog as ae, DialogTitle as Ae, DialogContent as Te, DialogActions as Be, Button as j, alpha as Ze, Tooltip as ne, buttonClasses as Le, Typography as E, Autocomplete as Ne, MenuItem as R, FormLabel as et, Popper as We, Paper as Ee, Table as tt, TableHead as rt, TableRow as Se, TableCell as Ce, TableBody as it } from "@mui/material";
4
- import { forwardRef as Ve, useState as ue, useEffect as Q, useImperativeHandle as _e, lazy as lt, useCallback as te, Suspense as nt, useRef as X, useId as ot } from "react";
5
- import st from "@arcblock/ux/lib/Empty";
6
- import { useLocaleContext as z } from "@arcblock/ux/lib/Locale/context";
7
- import { styled as ct } from "@arcblock/ux/lib/Theme";
8
- import { cx as dt } from "@emotion/css";
9
- import { useReactive as at, useBoolean as ut, useUpdate as pt } from "ahooks";
10
- import Pe from "gradient-parser";
1
+ import { jsx as e, jsxs as w, Fragment as U } from "react/jsx-runtime";
2
+ import { g as re, i as Te, b as Ke, h as le, E as tt, n as rt, j as ae } from "../state-C0vjPuun.mjs";
3
+ import { TextField as O, Stack as D, FormControlLabel as Ne, Switch as Be, Box as P, InputAdornment as oe, Dialog as pe, DialogTitle as Ue, DialogContent as We, DialogActions as Ve, Button as A, alpha as it, Tooltip as Q, buttonClasses as nt, Typography as V, Autocomplete as Fe, Paper as me, MenuItem as R, FormLabel as lt, Popper as _e, Table as ot, TableHead as st, TableRow as Oe, TableCell as ze, TableBody as ct } from "@mui/material";
4
+ import { forwardRef as Ee, useState as ie, useEffect as X, useImperativeHandle as He, lazy as dt, useCallback as ne, Suspense as ut, useRef as Z, useId as at, useMemo as pt } from "react";
5
+ import he from "@arcblock/ux/lib/Empty";
6
+ import { useLocaleContext as j } from "@arcblock/ux/lib/Locale/context";
7
+ import { styled as mt } from "@arcblock/ux/lib/Theme";
8
+ import { cx as ht } from "@emotion/css";
9
+ import { useReactive as ft, useBoolean as bt, useUpdate as yt } from "ahooks";
10
+ import Re from "gradient-parser";
11
11
  import "lodash/without";
12
- import mt from "tinycolor2";
13
- import { red as ht, pink as ft, purple as bt, indigo as vt, blue as yt, cyan as gt, teal as xt, green as It, lime as kt, yellow as wt, amber as St, orange as Ct, brown as Pt, grey as Dt, blueGrey as Rt } from "@mui/material/colors";
14
- import { getImageSize as oe, getVideoSize as se, UploaderButton as pe, UploaderProvider as Ke } from "./uploader.js";
15
- import { Icon as Ot } from "@iconify-icon/react";
16
- import { useDebounce as zt, useUpdate as jt } from "react-use";
17
- import { sortBy as V, omit as At, isNil as Z, isEmpty as Tt } from "lodash";
18
- import Bt from "@arcblock/ux/lib/Toast";
19
- import { CodeEditor as Fe } from "@blocklet/code-editor";
20
- import { CustomComponentRenderer as He, transpileAndLoadScript as Nt, getPropertiesFromCode as Wt } from "@blocklet/pages-kit/components";
21
- import { ClickAwayListener as Ue, unstable_useNumberInput as Et } from "@mui/base";
22
- import { DeleteOutlineRounded as Vt, DragIndicatorRounded as _t, AddRounded as Kt, TranslateRounded as Je, InfoRounded as Ft, SettingsRounded as Ye, StarRounded as Ht } from "@mui/icons-material";
12
+ import vt from "tinycolor2";
13
+ import { red as xt, pink as gt, purple as kt, indigo as It, blue as wt, cyan as St, teal as Pt, green as Ct, lime as Dt, yellow as Ot, amber as zt, orange as Rt, brown as jt, grey as At, blueGrey as Tt } from "@mui/material/colors";
14
+ import { getImageSize as de, getVideoSize as ue, UploaderButton as fe, UploaderProvider as be, useUploader as Kt } from "./uploader.js";
15
+ import { Icon as Nt } from "@iconify-icon/react";
16
+ import { useDebounce as Bt, useUpdate as Ut } from "react-use";
17
+ import { sortBy as F, omit as Wt, isNil as L, isEmpty as Vt } from "lodash";
18
+ import je from "@arcblock/ux/lib/Toast";
19
+ import { CodeEditor as Je } from "@blocklet/code-editor";
20
+ import { CustomComponentRenderer as Me, transpileAndLoadScript as Ft, getPropertiesFromCode as _t } from "@blocklet/pages-kit/components";
21
+ import { ClickAwayListener as $e, unstable_useNumberInput as Et } from "@mui/base";
22
+ import { VisibilityOffRounded as Ht, VisibilityRounded as Jt, DeleteOutlineRounded as Mt, DragIndicatorRounded as $t, AddRounded as Yt, TranslateRounded as Ye, InfoRounded as Ge, SettingsRounded as qe, StarRounded as Gt } from "@mui/icons-material";
23
23
  import { getYjsValue as _ } from "@syncedstore/core";
24
- import Ut from "lodash/has";
25
- import Jt from "lodash/keyBy";
26
- import { usePopupState as ie, bindTrigger as le, bindDialog as $e, bindPopper as Ge } from "material-ui-popup-state/hooks";
27
- import { ErrorBoundary as Yt } from "react-error-boundary";
28
- import $t from "lodash/sortBy";
29
- import { useDrop as qe, useDrag as Gt } from "react-dnd";
30
- ht[300], ft[300], bt[300], // deepPurple['300'],
31
- vt[300], yt[300], // lightBlue['300'],
32
- gt[300], xt[300], It[300], // lightGreen['300'],
33
- kt[300], wt[300], St[300], Ct[300], // deepOrange['300'],
34
- Pt[300], Dt[300], Rt[300];
35
- const qt = Ve(function({ showMarkdown: i, markdown: n, onMarkdownChange: r, showUploader: a, value: b, meta: p, onChange: u, ...v }, c) {
36
- const [h, m] = ue("");
37
- Q(() => {
38
- m(b || "");
39
- }, [b, m]);
40
- const f = async () => {
41
- if (h !== b) {
42
- const l = ee(h);
43
- if (!l) {
44
- u(h, void 0);
24
+ import qt from "lodash/has";
25
+ import Qt from "lodash/keyBy";
26
+ import Xt from "lodash/pick";
27
+ import { usePopupState as se, bindTrigger as ce, bindDialog as Qe, bindPopper as Xe } from "material-ui-popup-state/hooks";
28
+ import { ErrorBoundary as Zt } from "react-error-boundary";
29
+ import Lt from "lodash/sortBy";
30
+ import { useDrop as Ze, useDrag as er } from "react-dnd";
31
+ xt[300], gt[300], kt[300], // deepPurple['300'],
32
+ It[300], wt[300], // lightBlue['300'],
33
+ St[300], Pt[300], Ct[300], // lightGreen['300'],
34
+ Dt[300], Ot[300], zt[300], Rt[300], // deepOrange['300'],
35
+ jt[300], At[300], Tt[300];
36
+ const tr = Ee(function({ showMarkdown: r, markdown: i, onMarkdownChange: n, showUploader: u, value: v, meta: c, onChange: a, ...k }, l) {
37
+ const [y, f] = ie("");
38
+ X(() => {
39
+ f(v || "");
40
+ }, [v, f]);
41
+ const p = async () => {
42
+ if (y !== v) {
43
+ const o = re(y);
44
+ if (!o) {
45
+ a(y, void 0);
45
46
  return;
46
47
  }
47
- const o = await oe(l).catch(() => se(l)).catch(() => {
48
+ const s = await de(o).catch(() => ue(o)).catch(() => {
48
49
  });
49
- u(h, { ...o, filename: h });
50
+ a(y, { ...s, filename: y });
50
51
  }
51
52
  };
52
- zt(
53
+ Bt(
53
54
  () => {
54
- h !== b && u(h);
55
+ y !== v && a(y);
55
56
  },
56
57
  300,
57
- [h]
58
- ), _e(c, () => ({
59
- submit: f
58
+ [y]
59
+ ), He(l, () => ({
60
+ submit: p
60
61
  }));
61
- const s = {};
62
- return a && (s.InputProps = {
62
+ const x = {};
63
+ return u && (x.InputProps = {
63
64
  sx: { pr: 0 },
64
- endAdornment: /* @__PURE__ */ e(de, { position: "end", sx: { mx: 0.5 }, children: /* @__PURE__ */ e(
65
- pe,
65
+ endAdornment: /* @__PURE__ */ e(oe, { position: "end", sx: { mx: 0.5 }, children: /* @__PURE__ */ e(
66
+ fe,
66
67
  {
67
- onChange: async ({ response: l }) => {
68
- var y;
69
- const o = (y = l == null ? void 0 : l.data) == null ? void 0 : y.filename, d = ee(o) || "";
70
- let x = {};
71
- d && (x = await oe(d).catch(() => se(d)).catch(() => {
72
- })), u(o, {
73
- ...x,
74
- filename: o
68
+ onChange: async ({ response: o }) => {
69
+ var b;
70
+ const s = (b = o == null ? void 0 : o.data) == null ? void 0 : b.filename, g = re(s) || "";
71
+ let I = {};
72
+ g && (I = await de(g).catch(() => ue(g)).catch(() => {
73
+ })), a(s, {
74
+ ...I,
75
+ filename: s
75
76
  });
76
77
  }
77
78
  }
78
79
  ) })
79
80
  }), /* @__PURE__ */ e(
80
- D,
81
+ O,
81
82
  {
82
83
  size: "small",
83
84
  fullWidth: !0,
84
- ...v,
85
- label: /* @__PURE__ */ k(S, { direction: "row", spacing: 1, alignItems: "center", children: [
86
- v.label,
87
- i && /* @__PURE__ */ k(N, { children: [
85
+ ...k,
86
+ label: /* @__PURE__ */ w(D, { direction: "row", spacing: 1, alignItems: "center", children: [
87
+ k.label,
88
+ r && /* @__PURE__ */ w(U, { children: [
88
89
  " (",
89
90
  /* @__PURE__ */ e(
90
- ze,
91
+ Ne,
91
92
  {
92
- checked: n,
93
- label: /* @__PURE__ */ e(w, { component: Ot, icon: "tabler:markdown", sx: { verticalAlign: "middle" } }),
93
+ checked: i,
94
+ label: /* @__PURE__ */ e(P, { component: Nt, icon: "tabler:markdown", sx: { verticalAlign: "middle" } }),
94
95
  labelPlacement: "start",
95
- control: /* @__PURE__ */ e(je, { size: "small" }),
96
+ control: /* @__PURE__ */ e(Be, { size: "small" }),
96
97
  sx: { ml: 0.25, pr: 1 },
97
- onChange: (l, o) => r == null ? void 0 : r(o)
98
+ onChange: (o, s) => n == null ? void 0 : n(s)
98
99
  }
99
100
  ),
100
101
  ")"
101
102
  ] })
102
103
  ] }),
103
- InputLabelProps: { shrink: !0, ...v.InputLabelProps },
104
- value: h,
105
- onChange: (l) => m(l.target.value),
106
- ...s,
107
- onKeyDown: (l) => {
108
- l.keyCode !== 229 && l.key === "Enter" && f();
104
+ InputLabelProps: { shrink: !0, ...k.InputLabelProps },
105
+ value: y,
106
+ onChange: (o) => f(o.target.value),
107
+ ...x,
108
+ onKeyDown: (o) => {
109
+ o.keyCode !== 229 && o.key === "Enter" && p();
109
110
  }
110
111
  }
111
112
  );
112
- }), Mt = lt(() => import("react-best-gradient-color-picker"));
113
- function Qt(t) {
113
+ }), rr = dt(() => import("react-best-gradient-color-picker"));
114
+ function ir(t) {
114
115
  try {
115
- const n = Pe.parse(t).map((a) => {
116
- const b = a.colorStops.map((p) => {
117
- if (p.type !== "rgba") {
118
- const u = mt(p.value).toRgb();
116
+ const i = Re.parse(t).map((u) => {
117
+ const v = u.colorStops.map((c) => {
118
+ if (c.type !== "rgba") {
119
+ const a = vt(c.value).toRgb();
119
120
  return {
120
- ...p,
121
- value: [u.r, u.g, u.b, u.a],
121
+ ...c,
122
+ value: [a.r, a.g, a.b, a.a],
122
123
  type: "rgba"
123
124
  };
124
125
  }
125
- return p;
126
+ return c;
126
127
  });
127
128
  return {
128
- ...a,
129
- colorStops: b
129
+ ...u,
130
+ colorStops: v
130
131
  };
131
132
  });
132
- return Pe.stringify(n);
133
+ return Re.stringify(i);
133
134
  } catch {
134
- return Oe(t) ? t : "";
135
+ return Ke(t) ? t : "";
135
136
  }
136
137
  }
137
- function Xt({ color: t, sx: i = {}, ...n }) {
138
- Oe(t);
139
- const r = {};
140
- return Re(t) ? r.backgroundImage = t : r.backgroundColor = t, /* @__PURE__ */ e(
141
- w,
138
+ function nr({ color: t, sx: r = {}, ...i }) {
139
+ Ke(t);
140
+ const n = {};
141
+ return Te(t) ? n.backgroundImage = t : n.backgroundColor = t, /* @__PURE__ */ e(
142
+ P,
142
143
  {
143
144
  sx: {
144
- ...i,
145
+ ...r,
145
146
  width: "100%",
146
147
  paddingBottom: "100%",
147
148
  cursor: "pointer",
@@ -151,41 +152,41 @@ function Xt({ color: t, sx: i = {}, ...n }) {
151
152
  "&:hover": {
152
153
  opacity: 0.75
153
154
  },
154
- ...r
155
+ ...n
155
156
  },
156
- ...n
157
+ ...i
157
158
  }
158
159
  );
159
160
  }
160
- const Zt = Ve(function({ onSave: i }, n) {
161
- const r = at({
161
+ const lr = Ee(function({ onSave: r }, i) {
162
+ const n = ft({
162
163
  value: ""
163
- }), { t: a } = z(), b = {};
164
- r.value ? Re(r.value) ? b.backgroundImage = r.value : b.backgroundColor = r.value : b.border = "1px solid #ccc";
165
- const [p, { setFalse: u, setTrue: v }] = ut(!1), c = te(() => {
166
- u();
167
- }, [u]), h = () => {
168
- i({ value: r.value }, c);
164
+ }), { t: u } = j(), v = {};
165
+ n.value ? Te(n.value) ? v.backgroundImage = n.value : v.backgroundColor = n.value : v.border = "1px solid #ccc";
166
+ const [c, { setFalse: a, setTrue: k }] = bt(!1), l = ne(() => {
167
+ a();
168
+ }, [a]), y = () => {
169
+ r({ value: n.value }, l);
169
170
  };
170
- return _e(n, () => ({
171
- open({ value: m } = { value: "" }) {
172
- r.value = m, v();
171
+ return He(i, () => ({
172
+ open({ value: f } = { value: "" }) {
173
+ n.value = f, k();
173
174
  },
174
175
  close() {
175
- c();
176
+ l();
176
177
  }
177
- })), /* @__PURE__ */ k(ae, { open: p, onClose: c, hideBackdrop: !0, children: [
178
- /* @__PURE__ */ e(Ae, { children: a("maker.configBackground") }),
179
- /* @__PURE__ */ e(Te, { sx: { width: 600 }, children: /* @__PURE__ */ k(w, { width: "100%", display: "flex", children: [
180
- /* @__PURE__ */ e(w, { flex: 1, mr: 1, sx: b, children: !r.value && /* @__PURE__ */ e(st, { children: a("error.notConfig") }) }),
181
- /* @__PURE__ */ e(nt, { children: /* @__PURE__ */ e(
182
- Mt,
178
+ })), /* @__PURE__ */ w(pe, { open: c, onClose: l, hideBackdrop: !0, children: [
179
+ /* @__PURE__ */ e(Ue, { children: u("maker.configBackground") }),
180
+ /* @__PURE__ */ e(We, { sx: { width: 600 }, children: /* @__PURE__ */ w(P, { width: "100%", display: "flex", children: [
181
+ /* @__PURE__ */ e(P, { flex: 1, mr: 1, sx: v, children: !n.value && /* @__PURE__ */ e(he, { children: u("error.notConfig") }) }),
182
+ /* @__PURE__ */ e(ut, { children: /* @__PURE__ */ e(
183
+ rr,
183
184
  {
184
185
  width: 200,
185
186
  height: 200,
186
- value: Qt(r.value),
187
- onChange: (m) => {
188
- r.value = m;
187
+ value: ir(n.value),
188
+ onChange: (f) => {
189
+ n.value = f;
189
190
  },
190
191
  hidePresets: !0,
191
192
  hideAdvancedSliders: !0,
@@ -194,13 +195,13 @@ const Zt = Ve(function({ onSave: i }, n) {
194
195
  }
195
196
  ) })
196
197
  ] }) }),
197
- /* @__PURE__ */ k(Be, { children: [
198
- /* @__PURE__ */ e(j, { variant: "outlined", size: "small", onClick: c, children: a("common.cancel") }),
199
- /* @__PURE__ */ e(j, { variant: "contained", size: "small", onClick: h, children: a("maker.save") })
198
+ /* @__PURE__ */ w(Ve, { children: [
199
+ /* @__PURE__ */ e(A, { variant: "outlined", size: "small", onClick: l, children: u("common.cancel") }),
200
+ /* @__PURE__ */ e(A, { variant: "contained", size: "small", onClick: y, children: u("maker.save") })
200
201
  ] })
201
202
  ] });
202
203
  });
203
- ct(w)`
204
+ mt(P)`
204
205
  .color-item {
205
206
  position: relative;
206
207
  }
@@ -221,28 +222,28 @@ ct(w)`
221
222
  right: 0;
222
223
  }
223
224
  `;
224
- function Lt({
225
+ function or({
225
226
  value: t,
226
- onChange: i,
227
- ...n
227
+ onChange: r,
228
+ ...i
228
229
  }) {
229
- const r = X(null);
230
- return /* @__PURE__ */ k(N, { children: [
230
+ const n = Z(null);
231
+ return /* @__PURE__ */ w(U, { children: [
231
232
  /* @__PURE__ */ e(
232
- qt,
233
+ tr,
233
234
  {
234
- ...n,
235
+ ...i,
235
236
  value: t,
236
- onChange: i,
237
+ onChange: r,
237
238
  InputProps: {
238
- endAdornment: /* @__PURE__ */ e(de, { position: "end", children: /* @__PURE__ */ e(
239
- Xt,
239
+ endAdornment: /* @__PURE__ */ e(oe, { position: "end", children: /* @__PURE__ */ e(
240
+ nr,
240
241
  {
241
242
  color: t ?? "",
242
243
  style: { width: "1.5rem", height: "1.5rem", padding: 0 },
243
244
  onClick: () => {
244
- var a;
245
- (a = r.current) == null || a.open({ value: t ?? "" });
245
+ var u;
246
+ (u = n.current) == null || u.open({ value: t ?? "" });
246
247
  }
247
248
  }
248
249
  ) })
@@ -250,258 +251,285 @@ function Lt({
250
251
  }
251
252
  ),
252
253
  /* @__PURE__ */ e(
253
- Zt,
254
+ lr,
254
255
  {
255
- ref: r,
256
- onSave: ({ value: a }, b) => {
257
- i(a), b();
256
+ ref: n,
257
+ onSave: ({ value: u }, v) => {
258
+ r(u), v();
258
259
  }
259
260
  }
260
261
  )
261
262
  ] });
262
263
  }
263
- const De = ["string", "multiline", "json", "yaml", "component", "custom", "url"];
264
- function er({
264
+ const Ae = ["string", "multiline", "json", "yaml", "component", "custom", "url"];
265
+ function sr({
265
266
  disabled: t,
266
- list: i,
267
- renderItem: n,
268
- ...r
267
+ list: r,
268
+ renderItem: i,
269
+ ...n
269
270
  }) {
270
- const a = X(null), b = ot(), p = pt(), u = $t(Object.entries(i), (s) => s[1].index).map((s) => s[0]), v = X(u), c = te(
271
- (s) => {
272
- v.current = s, p();
273
- },
274
- [p]
275
- ), h = te(
276
- ({ index: s }, { index: l }) => {
277
- const o = [...v.current];
278
- o.splice(l, 0, ...o.splice(s, 1)), c(o);
271
+ const u = Z(null), v = at(), c = yt(), a = Lt(Object.entries(r), (x) => x[1].index).map((x) => x[0]), k = Z(a), l = ne(
272
+ (x) => {
273
+ k.current = x, c();
279
274
  },
280
275
  [c]
276
+ ), y = ne(
277
+ ({ index: x }, { index: o }) => {
278
+ const s = [...k.current];
279
+ s.splice(o, 0, ...s.splice(x, 1)), l(s);
280
+ },
281
+ [l]
281
282
  );
282
- Q(() => {
283
- c(u);
284
- }, [u.join("-")]);
285
- const [{ isOver: m }, f] = qe({
286
- accept: b,
287
- collect: (s) => ({
288
- isOver: s.isOver()
283
+ X(() => {
284
+ l(a);
285
+ }, [a.join("-")]);
286
+ const [{ isOver: f }, p] = Ze({
287
+ accept: v,
288
+ collect: (x) => ({
289
+ isOver: x.isOver()
289
290
  }),
290
291
  canDrop: () => !t,
291
292
  drop: () => {
292
- var o;
293
- const s = () => {
294
- v.current.forEach((d, x) => {
295
- const y = i[d];
296
- y && (y.index = x);
293
+ var s;
294
+ const x = () => {
295
+ k.current.forEach((g, I) => {
296
+ const b = r[g];
297
+ b && (b.index = I);
297
298
  });
298
- }, l = (o = _(i)) == null ? void 0 : o.doc;
299
- l ? l.transact(() => {
300
- s();
301
- }) : s();
299
+ }, o = (s = _(r)) == null ? void 0 : s.doc;
300
+ o ? o.transact(() => {
301
+ x();
302
+ }) : x();
302
303
  }
303
304
  });
304
- return Q(() => {
305
- m || c(u);
306
- }, [m]), f(a), /* @__PURE__ */ e(w, { ...r, ref: a, className: dt(m && "isDragging"), children: v.current.map((s, l) => /* @__PURE__ */ e(
307
- tr,
305
+ return X(() => {
306
+ f || l(a);
307
+ }, [f]), p(u), /* @__PURE__ */ e(P, { ...n, ref: u, className: ht(f && "isDragging"), children: k.current.map((x, o) => /* @__PURE__ */ e(
308
+ cr,
308
309
  {
309
- type: b,
310
+ type: v,
310
311
  disabled: t,
311
- id: s,
312
- index: l,
313
- itemIndex: (o) => v.current.indexOf(o),
314
- move: h,
315
- children: (o) => {
316
- const d = i[s];
317
- return d ? n(d.data, l, o) : null;
312
+ id: x,
313
+ index: o,
314
+ itemIndex: (s) => k.current.indexOf(s),
315
+ move: y,
316
+ children: (s) => {
317
+ const g = r[x];
318
+ return g ? i(g.data, o, s) : null;
318
319
  }
319
320
  },
320
- s
321
+ x
321
322
  )) });
322
323
  }
323
- function tr({
324
+ function cr({
324
325
  disabled: t,
325
- id: i,
326
- index: n,
327
- type: r,
328
- children: a,
329
- itemIndex: b,
330
- move: p
326
+ id: r,
327
+ index: i,
328
+ type: n,
329
+ children: u,
330
+ itemIndex: v,
331
+ move: c
331
332
  }) {
332
- const u = X(), [{ isDragging: v }, c, h] = Gt({
333
- type: r,
334
- item: () => ({ id: i }),
333
+ const a = Z(), [{ isDragging: k }, l, y] = er({
334
+ type: n,
335
+ item: () => ({ id: r }),
335
336
  canDrag: () => !t,
336
- collect: (f) => ({ isDragging: f.isDragging() })
337
- }), [, m] = qe({
338
- accept: r,
337
+ collect: (p) => ({ isDragging: p.isDragging() })
338
+ }), [, f] = Ze({
339
+ accept: n,
339
340
  canDrop: () => !t,
340
- hover(f, s) {
341
- var g;
342
- if (!u.current)
341
+ hover(p, x) {
342
+ var h;
343
+ if (!a.current)
343
344
  return;
344
- const l = b(f.id), o = n;
345
- if (l === o)
345
+ const o = v(p.id), s = i;
346
+ if (o === s)
346
347
  return;
347
- const d = (g = u.current) == null ? void 0 : g.getBoundingClientRect(), x = (d.bottom - d.top) / 2, I = s.getClientOffset().y - d.top;
348
- l < o && I < x || l > o && I > x || p({ id: f.id, index: l }, { id: i, index: n });
348
+ const g = (h = a.current) == null ? void 0 : h.getBoundingClientRect(), I = (g.bottom - g.top) / 2, d = x.getClientOffset().y - g.top;
349
+ o < s && d < I || o > s && d > I || c({ id: p.id, index: o }, { id: r, index: i });
349
350
  }
350
351
  });
351
- return typeof a == "function" ? a({
352
- isDragging: v,
353
- drag: c,
354
- drop: (f) => (u.current = f, m(f)),
355
- preview: h
356
- }) : (c(m(h(u))), /* @__PURE__ */ e(w, { ref: u, children: a }));
352
+ return typeof u == "function" ? u({
353
+ isDragging: k,
354
+ drag: l,
355
+ drop: (p) => (a.current = p, f(p)),
356
+ preview: y
357
+ }) : (l(f(y(a))), /* @__PURE__ */ e(P, { ref: a, children: u }));
357
358
  }
358
- function rr({
359
+ function dr({
359
360
  drop: t,
360
- preview: i,
361
- drag: n,
362
- disabled: r,
363
- isDragging: a,
364
- children: b,
365
- onDelete: p,
366
- actions: u
361
+ preview: r,
362
+ drag: i,
363
+ disabled: n,
364
+ isDragging: u,
365
+ children: v,
366
+ onDelete: c,
367
+ onVisibilityChange: a,
368
+ visible: k = !0,
369
+ actions: l,
370
+ alwaysShowActions: y = !1
367
371
  }) {
368
- const { t: v } = z();
369
- return /* @__PURE__ */ e(w, { ref: t, sx: { ":hover .hover-visible": { maxHeight: "100%" } }, children: /* @__PURE__ */ k(w, { sx: { position: "relative" }, children: [
370
- /* @__PURE__ */ e(
371
- w,
372
- {
373
- ref: i,
374
- sx: {
375
- flex: 1,
376
- borderRadius: 1,
377
- bgcolor: a ? "action.hover" : "background.paper",
378
- opacity: 0.9999
379
- // NOTE: make preview effective
380
- },
381
- children: b
382
- }
383
- ),
384
- !r && /* @__PURE__ */ e(
385
- w,
386
- {
387
- className: "hover-visible",
388
- sx: { maxHeight: 0, overflow: "hidden", position: "absolute", right: 2, top: 2 },
389
- children: /* @__PURE__ */ k(
390
- S,
372
+ const { t: f } = j();
373
+ return /* @__PURE__ */ e(
374
+ P,
375
+ {
376
+ ref: t,
377
+ sx: {
378
+ ":hover .hover-visible": { maxWidth: "100%" },
379
+ opacity: k ? 1 : 0.5
380
+ },
381
+ children: /* @__PURE__ */ w(P, { sx: { position: "relative" }, children: [
382
+ /* @__PURE__ */ e(
383
+ P,
391
384
  {
392
- direction: "row",
385
+ ref: r,
393
386
  sx: {
394
- bgcolor: (c) => Ze(c.palette.grey[300], 0.9),
395
- borderRadius: 1,
396
- p: 0.5,
397
- [`.${Le.root}`]: {
398
- minWidth: 24,
399
- width: 24,
400
- height: 24,
401
- p: 0
402
- }
387
+ flex: 1,
388
+ borderRadius: 0.5,
389
+ bgcolor: u ? "action.hover" : "background.paper",
390
+ opacity: 0.9999
391
+ // NOTE: make preview effective
403
392
  },
404
- children: [
405
- u,
406
- p && /* @__PURE__ */ e(ne, { title: v("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(j, { onClick: p, children: /* @__PURE__ */ e(Vt, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
407
- /* @__PURE__ */ e(ne, { title: v("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(j, { ref: n, children: /* @__PURE__ */ e(_t, { sx: { color: "grey.500" } }) }) })
408
- ]
393
+ children: v
394
+ }
395
+ ),
396
+ !n && /* @__PURE__ */ e(
397
+ P,
398
+ {
399
+ className: y ? "" : "hover-visible",
400
+ sx: {
401
+ maxWidth: y ? "100%" : 0,
402
+ overflow: "hidden",
403
+ position: "absolute",
404
+ right: 2,
405
+ top: 2,
406
+ transition: "max-width 0.3s ease-in-out"
407
+ },
408
+ children: /* @__PURE__ */ w(
409
+ D,
410
+ {
411
+ direction: "row",
412
+ sx: {
413
+ bgcolor: (p) => it(p.palette.grey[200], 0.9),
414
+ borderRadius: 1,
415
+ p: 0.5,
416
+ [`.${nt.root}`]: {
417
+ minWidth: 24,
418
+ width: 24,
419
+ height: 24,
420
+ p: 0
421
+ }
422
+ },
423
+ children: [
424
+ l,
425
+ a && /* @__PURE__ */ e(Q, { title: f(k ? "hideParameter" : "showParameter"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(A, { onClick: () => a(!k), children: k ? /* @__PURE__ */ e(Ht, { sx: { fontSize: "1.25rem", color: "grey.500" } }) : /* @__PURE__ */ e(Jt, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
426
+ c && /* @__PURE__ */ e(Q, { title: f("delete"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(A, { onClick: c, children: /* @__PURE__ */ e(Mt, { sx: { fontSize: "1.25rem", color: "grey.500" } }) }) }),
427
+ /* @__PURE__ */ e(Q, { title: f("dragSort"), disableInteractive: !0, placement: "top", children: /* @__PURE__ */ e(A, { ref: i, children: /* @__PURE__ */ e($t, { sx: { color: "grey.500" } }) }) })
428
+ ]
429
+ }
430
+ )
409
431
  }
410
432
  )
411
- }
412
- )
413
- ] }) });
433
+ ] })
434
+ }
435
+ );
414
436
  }
415
- function ir({
437
+ function ur({
416
438
  label: t,
417
- value: i,
418
- onChange: n
439
+ value: r,
440
+ onChange: i
419
441
  }) {
420
- const [r, a] = ue(!1);
421
- return /* @__PURE__ */ k(S, { gap: 1, children: [
442
+ const [n, u] = ie(!1);
443
+ return /* @__PURE__ */ w(D, { gap: 1, children: [
422
444
  /* @__PURE__ */ e(
423
- D,
445
+ O,
424
446
  {
425
447
  label: t,
426
448
  size: "small",
427
- value: i,
428
- onChange: (b) => n == null ? void 0 : n(b.target.value),
449
+ value: r,
450
+ onChange: (v) => i == null ? void 0 : i(v.target.value),
429
451
  InputProps: {
430
452
  endAdornment: /* @__PURE__ */ e(
431
- pe,
453
+ fe,
432
454
  {
433
- onChange: ({ response: b }) => {
434
- var u;
435
- const p = (u = b == null ? void 0 : b.data) == null ? void 0 : u.filename;
436
- p && (n == null || n(p));
455
+ onChange: ({ response: v }) => {
456
+ var a;
457
+ const c = (a = v == null ? void 0 : v.data) == null ? void 0 : a.filename;
458
+ c && (i == null || i(c));
437
459
  }
438
460
  }
439
461
  )
440
462
  }
441
463
  }
442
464
  ),
443
- i && /* @__PURE__ */ e(
444
- w,
465
+ r && /* @__PURE__ */ e(
466
+ P,
445
467
  {
446
468
  component: "img",
447
469
  sx: { objectFit: "contain", borderRadius: 1, cursor: "pointer" },
448
- src: ee(i),
470
+ src: re(r),
449
471
  alt: t,
450
472
  maxWidth: 100,
451
473
  maxHeight: 100,
452
474
  width: "100%",
453
- onClick: () => a(!0)
475
+ onClick: () => u(!0)
454
476
  }
455
477
  ),
456
- /* @__PURE__ */ e(ae, { open: r, onClose: () => a(!1), children: /* @__PURE__ */ e(w, { component: "img", sx: { objectFit: "contain" }, src: ee(i), alt: t }) })
478
+ /* @__PURE__ */ e(pe, { open: n, onClose: () => u(!1), children: /* @__PURE__ */ e(P, { component: "img", sx: { objectFit: "contain" }, src: re(r), alt: t }) })
457
479
  ] });
458
480
  }
459
- function Jr({ componentId: t }) {
481
+ function te(t, r, i) {
482
+ return !t || !i ? !1 : Object.values(t).some(({ data: n }) => n.id !== r && n.key === i);
483
+ }
484
+ function Le(t, r) {
485
+ var i;
486
+ return !t || !r ? !1 : ((i = t[r]) == null ? void 0 : i.data.visible) ?? !0;
487
+ }
488
+ function Zr({ componentId: t }) {
460
489
  const {
461
- state: { components: i }
462
- } = re(), n = i[t], r = n == null ? void 0 : n.data;
463
- return r ? /* @__PURE__ */ e(S, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ e(w, { p: 2, children: /* @__PURE__ */ e(Yt, { FallbackComponent: Qe, resetKeys: [t], children: /* @__PURE__ */ e(lr, { value: r }) }) }) }) : null;
490
+ state: { components: r }
491
+ } = le(), i = r[t], n = i == null ? void 0 : i.data;
492
+ return n ? /* @__PURE__ */ e(D, { maxHeight: "100%", overflow: "auto", children: /* @__PURE__ */ e(P, { p: 2, children: /* @__PURE__ */ e(Zt, { FallbackComponent: tt, resetKeys: [t], children: /* @__PURE__ */ e(ar, { value: n }) }) }) }) : null;
464
493
  }
465
- function lr({ value: t }) {
466
- var v, c, h;
467
- const { t: i } = z(), {
468
- localState: { currentLocale: n },
494
+ function ar({ value: t }) {
495
+ var k, l, y;
496
+ const { t: r } = j(), {
497
+ localState: { currentLocale: i, componentDebugProps: n },
469
498
  state: {
470
- config: { defaultLocale: r }
499
+ config: { defaultLocale: u }
471
500
  },
472
- currentPage: a,
473
- currentSection: b
474
- } = re(), p = _(t).doc, u = ce();
475
- return /* @__PURE__ */ e(S, { height: "100%", children: /* @__PURE__ */ k(S, { gap: 2, children: [
476
- /* @__PURE__ */ e(nr, { config: t }),
501
+ localActions: { setComponentDebugProps: v }
502
+ } = le(), c = _(t).doc, a = ae();
503
+ return /* @__PURE__ */ e(D, { height: "100%", children: /* @__PURE__ */ w(D, { gap: 2, children: [
504
+ /* @__PURE__ */ e(pr, { config: t }),
477
505
  /* @__PURE__ */ e(
478
- or,
506
+ mr,
479
507
  {
480
508
  config: t,
481
- currentLocale: n,
482
- defaultLocale: r,
483
- allComponents: u,
484
- onUpdateConfig: (m) => {
485
- p.transact(() => {
486
- m(t);
509
+ currentLocale: i,
510
+ defaultLocale: u,
511
+ allComponents: a,
512
+ onUpdateConfig: (f) => {
513
+ c.transact(() => {
514
+ f(t);
487
515
  });
488
516
  }
489
517
  }
490
518
  ),
491
- /* @__PURE__ */ k(S, { gap: 2, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
492
- /* @__PURE__ */ e(E, { variant: "subtitle1", children: i("renderer") }),
493
- /* @__PURE__ */ k(
494
- D,
519
+ /* @__PURE__ */ w(D, { gap: 2, direction: "row", justifyContent: "space-between", alignItems: "center", children: [
520
+ /* @__PURE__ */ e(V, { variant: "subtitle1", children: r("renderer") }),
521
+ /* @__PURE__ */ w(
522
+ O,
495
523
  {
496
524
  hiddenLabel: !0,
497
525
  size: "small",
498
526
  select: !0,
499
527
  SelectProps: { autoWidth: !0 },
500
- value: ((v = t.renderer) == null ? void 0 : v.type) || "react-component",
501
- onChange: (m) => {
502
- p.transact(() => {
503
- const f = m.target.value;
504
- t.renderer ?? (t.renderer = { type: f }), t.renderer.type = f;
528
+ value: ((k = t.renderer) == null ? void 0 : k.type) || "react-component",
529
+ onChange: (f) => {
530
+ c.transact(() => {
531
+ const p = f.target.value;
532
+ t.renderer ?? (t.renderer = { type: p }), t.renderer.type = p;
505
533
  });
506
534
  },
507
535
  children: [
@@ -511,459 +539,526 @@ function lr({ value: t }) {
511
539
  }
512
540
  )
513
541
  ] }),
514
- ((c = t.renderer) == null ? void 0 : c.type) === "component" ? /* @__PURE__ */ e(mr, { value: t }) : ((h = t.renderer) == null ? void 0 : h.type) === "react-component" ? /* @__PURE__ */ e(pr, { value: t }) : null,
542
+ ((l = t.renderer) == null ? void 0 : l.type) === "component" ? /* @__PURE__ */ e(gr, { value: t }) : ((y = t.renderer) == null ? void 0 : y.type) === "react-component" ? /* @__PURE__ */ e(xr, { value: t }) : null,
515
543
  /* @__PURE__ */ e(
516
- hr,
544
+ kr,
517
545
  {
518
546
  config: t,
519
- currentLocale: n,
520
- defaultLocale: r,
521
- allComponents: u,
522
- onChange: (m) => {
523
- console.warn(m, JSON.parse(JSON.stringify({ currentPage: a, currentSection: b })));
547
+ currentLocale: i,
548
+ defaultLocale: u,
549
+ allComponents: a,
550
+ onChange: ({ key: f, value: p }) => {
551
+ v({
552
+ [f]: p.value
553
+ });
524
554
  },
525
- props: {}
555
+ props: {
556
+ ...n
557
+ }
526
558
  }
527
559
  )
528
560
  ] }) });
529
561
  }
530
- function nr({ config: t }) {
531
- const { t: i } = z();
532
- return /* @__PURE__ */ e(Ke, { children: /* @__PURE__ */ k(S, { gap: 2, children: [
533
- /* @__PURE__ */ e(E, { variant: "subtitle1", children: i("basicInfo") }),
562
+ function pr({ config: t }) {
563
+ const { t: r } = j();
564
+ return /* @__PURE__ */ e(be, { children: /* @__PURE__ */ w(D, { gap: 2, children: [
565
+ /* @__PURE__ */ e(V, { variant: "subtitle1", children: r("basicInfo") }),
534
566
  /* @__PURE__ */ e(
535
- D,
567
+ O,
536
568
  {
537
- label: i("name"),
569
+ label: r("name"),
538
570
  size: "small",
539
571
  value: t.name || "",
540
- onChange: (n) => t.name = n.target.value
572
+ onChange: (i) => t.name = i.target.value
541
573
  }
542
574
  ),
543
575
  /* @__PURE__ */ e(
544
- D,
576
+ O,
545
577
  {
546
- label: i("description"),
578
+ label: r("description"),
547
579
  size: "small",
548
580
  multiline: !0,
549
581
  minRows: 2,
550
582
  maxRows: 10,
551
583
  inputProps: { maxLength: 200 },
552
584
  value: t.description || "",
553
- onChange: (n) => t.description = n.target.value
585
+ onChange: (i) => t.description = i.target.value
554
586
  }
555
587
  ),
556
588
  /* @__PURE__ */ e(
557
- Ne,
589
+ Fe,
558
590
  {
559
591
  size: "small",
560
592
  options: [],
561
593
  multiple: !0,
562
594
  freeSolo: !0,
563
595
  value: t.tags ?? [],
564
- onChange: (n, r) => t.tags = r,
565
- renderInput: (n) => /* @__PURE__ */ e(D, { label: i("tags"), ...n })
596
+ onChange: (i, n) => t.tags = n,
597
+ renderInput: (i) => /* @__PURE__ */ e(O, { label: r("tags"), ...i })
566
598
  }
567
599
  ),
568
600
  /* @__PURE__ */ e(
569
- ir,
601
+ ur,
570
602
  {
571
- label: i("previewImage"),
603
+ label: r("previewImage"),
572
604
  value: t.previewImage || "",
573
- onChange: (n) => t.previewImage = n
605
+ onChange: (i) => t.previewImage = i
574
606
  }
575
607
  )
576
608
  ] }) });
577
609
  }
578
- function or({
610
+ function mr({
579
611
  config: t,
580
- currentLocale: i,
581
- defaultLocale: n,
582
- allComponents: r,
583
- onUpdateConfig: a,
584
- useI18nEditor: b = !0
612
+ currentLocale: r,
613
+ defaultLocale: i,
614
+ allComponents: n,
615
+ onUpdateConfig: u,
616
+ useI18nEditor: v = !0
585
617
  }) {
586
- const { t: p } = z(), u = ie({ variant: "dialog" }), v = t.properties && V(Object.values(t.properties), "index");
587
- return /* @__PURE__ */ e(Ke, { children: /* @__PURE__ */ k(S, { gap: 2, children: [
588
- /* @__PURE__ */ k(S, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
589
- /* @__PURE__ */ e(E, { variant: "subtitle1", children: p("properties") }),
590
- /* @__PURE__ */ e(w, { flex: 1 }),
618
+ const { t: c } = j(), a = se({ variant: "dialog" }), k = t.properties && F(Object.values(t.properties), "index");
619
+ return /* @__PURE__ */ e(be, { children: /* @__PURE__ */ w(D, { gap: 2, children: [
620
+ /* @__PURE__ */ w(D, { direction: "row", gap: 1, alignItems: "center", justifyContent: "space-between", children: [
621
+ /* @__PURE__ */ e(V, { variant: "subtitle1", children: c("properties") }),
622
+ /* @__PURE__ */ e(P, { flex: 1 }),
591
623
  /* @__PURE__ */ e(
592
- j,
624
+ A,
593
625
  {
594
626
  onClick: () => {
595
- a((c) => {
596
- var m;
597
- const h = Xe();
598
- c.properties ?? (c.properties = {}), (m = c.properties)[h] ?? (m[h] = { index: (v == null ? void 0 : v.length) || 0, data: { id: h } });
627
+ u((l) => {
628
+ var f;
629
+ const y = rt();
630
+ l.properties ?? (l.properties = {}), (f = l.properties)[y] ?? (f[y] = { index: (k == null ? void 0 : k.length) || 0, data: { id: y } });
599
631
  });
600
632
  },
601
- startIcon: /* @__PURE__ */ e(Kt, {}),
602
- children: p("addObject", { object: p("property") })
633
+ startIcon: /* @__PURE__ */ e(Yt, {}),
634
+ children: c("addObject", { object: c("property") })
603
635
  }
604
636
  ),
605
- b && /* @__PURE__ */ e(j, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...le(u), children: /* @__PURE__ */ e(Je, { fontSize: "small" }) })
637
+ v && /* @__PURE__ */ e(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...ce(a), children: /* @__PURE__ */ e(Ye, { fontSize: "small" }) })
606
638
  ] }),
607
- t.properties && /* @__PURE__ */ e(
608
- er,
639
+ t.properties && Object.keys(t.properties).length > 0 ? /* @__PURE__ */ e(
640
+ sr,
609
641
  {
610
- component: S,
642
+ component: D,
611
643
  gap: 2,
612
644
  list: t.properties,
613
- renderItem: (c, h, m) => {
614
- var f, s, l, o, d, x;
615
- return c.type === "custom-settings" ? null : /* @__PURE__ */ k(S, { gap: 1, bgcolor: "background.paper", children: [
616
- /* @__PURE__ */ e(
617
- rr,
618
- {
619
- preview: m.preview,
620
- drop: m.drop,
621
- drag: m.drag,
622
- isDragging: m.isDragging,
623
- onDelete: () => {
624
- a((y) => {
625
- if (y.properties) {
626
- const g = Object.entries(y.properties).sort(([, P], [, O]) => P.index - O.index);
627
- delete y.properties[c.id], g.filter(([P]) => P !== c.id).forEach(([, P], O) => {
628
- P.index = O;
629
- });
630
- }
631
- });
632
- },
633
- children: /* @__PURE__ */ k(S, { direction: "row", gap: 1, children: [
634
- /* @__PURE__ */ e(
635
- D,
636
- {
637
- label: p("key"),
638
- size: "small",
639
- sx: { flex: 1 },
640
- value: c.key || "",
641
- onChange: (y) => {
642
- a((I) => {
643
- const g = I.properties[c.id].data;
644
- g.key = y.target.value.trim();
645
- });
646
- }
647
- }
648
- ),
649
- /* @__PURE__ */ e(
650
- D,
651
- {
652
- label: p("label"),
653
- size: "small",
654
- sx: { flex: 1 },
655
- value: (((s = (f = c.locales) == null ? void 0 : f[i]) == null ? void 0 : s.name) ?? ((o = (l = c.locales) == null ? void 0 : l[n]) == null ? void 0 : o.name)) || "",
656
- onChange: (y) => {
657
- a((I) => {
658
- var C;
659
- const g = I.properties[c.id].data;
660
- g.locales ?? (g.locales = {}), (C = g.locales)[i] ?? (C[i] = {}), g.locales[i].name = y.target.value;
645
+ renderItem: (l, y, f) => {
646
+ var x, o, s, g, I, b;
647
+ const p = Le(t.properties, l.id);
648
+ return /* @__PURE__ */ e(
649
+ me,
650
+ {
651
+ elevation: 0,
652
+ sx: {
653
+ p: 1.25,
654
+ bgcolor: "background.paper",
655
+ borderRadius: 1,
656
+ border: p ? "1px solid" : "1px dashed",
657
+ borderColor: "divider"
658
+ },
659
+ children: /* @__PURE__ */ e(D, { gap: 2, children: /* @__PURE__ */ e(
660
+ dr,
661
+ {
662
+ preview: f.preview,
663
+ drop: f.drop,
664
+ drag: f.drag,
665
+ isDragging: f.isDragging,
666
+ onDelete: () => {
667
+ u((d) => {
668
+ if (d.properties) {
669
+ const m = Object.entries(d.properties).sort(([, C], [, z]) => C.index - z.index);
670
+ delete d.properties[l.id], m.filter(([C]) => C !== l.id).forEach(([, C], z) => {
671
+ C.index = z;
661
672
  });
662
673
  }
663
- }
664
- ),
665
- /* @__PURE__ */ k(
666
- D,
667
- {
668
- label: p("type"),
669
- size: "small",
670
- select: !0,
671
- sx: { flex: 1 },
672
- value: c.type === "string" && c.multiline ? "multiline" : c.type || "string",
673
- onChange: (y) => {
674
- a((I) => {
675
- const g = I.properties[c.id].data;
676
- if (g.locales)
677
- for (const P of Object.keys(g.locales))
678
- g.locales[P].defaultValue = void 0;
679
- const C = y.target.value;
680
- C === "multiline" ? (g.type = "string", g.multiline = !0) : (typeof g.multiline < "u" && delete g.multiline, g.type = C);
681
- });
682
- },
683
- children: [
684
- /* @__PURE__ */ e(R, { value: "string", children: "Text" }),
685
- /* @__PURE__ */ e(R, { value: "multiline", children: "Text (Multiline)" }),
686
- /* @__PURE__ */ e(R, { value: "number", children: "Number" }),
687
- /* @__PURE__ */ e(R, { value: "decimal", children: "Decimal" }),
688
- /* @__PURE__ */ e(R, { value: "boolean", children: "Boolean" }),
689
- /* @__PURE__ */ e(R, { value: "color", children: "Color" }),
690
- /* @__PURE__ */ e(R, { value: "url", children: "URL (Upload)" }),
691
- /* @__PURE__ */ e(R, { value: "json", children: "JSON" }),
692
- /* @__PURE__ */ e(R, { value: "yaml", children: "YAML" }),
693
- /* @__PURE__ */ e(R, { value: "component", children: "Component" }),
694
- /* @__PURE__ */ e(R, { value: "custom", children: "Custom (Render by a Component)" })
695
- ]
696
- }
697
- )
698
- ] })
699
- }
700
- ),
701
- /* @__PURE__ */ k(S, { direction: "row", gap: 1, children: [
702
- /* @__PURE__ */ e(
703
- W,
704
- {
705
- allComponents: r,
706
- defaultLocale: n,
707
- component: t,
708
- property: c,
709
- label: p("defaultValue"),
710
- size: "small",
711
- fullWidth: !0,
712
- value: (x = (d = c.locales) == null ? void 0 : d[i]) == null ? void 0 : x.defaultValue,
713
- onChange: (y) => {
714
- a((I) => {
715
- var C;
716
- const g = I.properties[c.id].data;
717
- g.locales ?? (g.locales = {}), (C = g.locales)[i] ?? (C[i] = {}), g.locales[i].defaultValue = y;
718
674
  });
719
- }
675
+ },
676
+ visible: p,
677
+ onVisibilityChange: (d) => {
678
+ u((h) => {
679
+ const m = h.properties[l.id].data;
680
+ m.visible = d;
681
+ });
682
+ },
683
+ alwaysShowActions: !0,
684
+ children: /* @__PURE__ */ w(D, { direction: "column", gap: 2, children: [
685
+ /* @__PURE__ */ e(
686
+ O,
687
+ {
688
+ label: c("key"),
689
+ size: "small",
690
+ required: !0,
691
+ sx: {
692
+ width: "calc(100% - 80px - 8px)",
693
+ flex: 1,
694
+ "& .MuiOutlinedInput-root": {
695
+ borderColor: l.key ? te(t.properties, l.id, l.key) ? "warning.main" : void 0 : "error.main"
696
+ },
697
+ "& .MuiFormLabel-root": {
698
+ color: l.key ? te(t.properties, l.id, l.key) ? "warning.main" : "text.secondary" : "error.main"
699
+ },
700
+ "& .MuiFormLabel-root.Mui-focused": {
701
+ color: l.key ? te(t.properties, l.id, l.key) ? "warning.main" : "primary.main" : "error.main"
702
+ }
703
+ },
704
+ value: l.key || "",
705
+ onChange: (d) => {
706
+ u((h) => {
707
+ const m = h.properties[l.id].data;
708
+ m.key = d.target.value.trim();
709
+ });
710
+ },
711
+ InputProps: {
712
+ endAdornment: !l.key || l.key && te(t.properties, l.id, l.key) ? /* @__PURE__ */ e(
713
+ oe,
714
+ {
715
+ position: "end",
716
+ sx: {
717
+ width: 16,
718
+ ml: 0
719
+ },
720
+ children: /* @__PURE__ */ e(Q, { title: l.key ? c("duplicateKey") : c("requiredKey"), children: /* @__PURE__ */ e(
721
+ Ge,
722
+ {
723
+ sx: {
724
+ color: l.key ? "warning.main" : "error.main",
725
+ fontSize: 16
726
+ }
727
+ }
728
+ ) })
729
+ }
730
+ ) : null
731
+ }
732
+ }
733
+ ),
734
+ /* @__PURE__ */ w(D, { direction: "row", gap: 1, children: [
735
+ /* @__PURE__ */ e(
736
+ O,
737
+ {
738
+ label: c("label"),
739
+ size: "small",
740
+ sx: { flex: 1 },
741
+ value: (((o = (x = l.locales) == null ? void 0 : x[r]) == null ? void 0 : o.name) ?? ((g = (s = l.locales) == null ? void 0 : s[i]) == null ? void 0 : g.name)) || "",
742
+ onChange: (d) => {
743
+ u((h) => {
744
+ var S;
745
+ const m = h.properties[l.id].data;
746
+ m.locales ?? (m.locales = {}), (S = m.locales)[r] ?? (S[r] = {}), m.locales[r].name = d.target.value;
747
+ });
748
+ }
749
+ }
750
+ ),
751
+ /* @__PURE__ */ w(
752
+ O,
753
+ {
754
+ label: c("type"),
755
+ size: "small",
756
+ select: !0,
757
+ sx: { flex: 1 },
758
+ value: l.type === "string" && l.multiline ? "multiline" : l.type || "string",
759
+ onChange: (d) => {
760
+ u((h) => {
761
+ const m = h.properties[l.id].data;
762
+ if (m.locales)
763
+ for (const C of Object.keys(m.locales))
764
+ m.locales[C].defaultValue = void 0;
765
+ const S = d.target.value;
766
+ S === "multiline" ? (m.type = "string", m.multiline = !0) : (typeof m.multiline < "u" && delete m.multiline, m.type = S);
767
+ });
768
+ },
769
+ children: [
770
+ /* @__PURE__ */ e(R, { value: "string", children: "Text" }),
771
+ /* @__PURE__ */ e(R, { value: "multiline", children: "Text (Multiline)" }),
772
+ /* @__PURE__ */ e(R, { value: "number", children: "Number" }),
773
+ /* @__PURE__ */ e(R, { value: "decimal", children: "Decimal" }),
774
+ /* @__PURE__ */ e(R, { value: "boolean", children: "Boolean" }),
775
+ /* @__PURE__ */ e(R, { value: "color", children: "Color" }),
776
+ /* @__PURE__ */ e(R, { value: "url", children: "URL (Upload)" }),
777
+ /* @__PURE__ */ e(R, { value: "json", children: "JSON" }),
778
+ /* @__PURE__ */ e(R, { value: "yaml", children: "YAML" }),
779
+ /* @__PURE__ */ e(R, { value: "component", children: "Component" }),
780
+ /* @__PURE__ */ e(R, { value: "custom", children: "Custom (Render by a Component)" })
781
+ ]
782
+ }
783
+ )
784
+ ] }),
785
+ /* @__PURE__ */ w(D, { direction: "row", gap: 1, children: [
786
+ /* @__PURE__ */ e(
787
+ W,
788
+ {
789
+ allComponents: n,
790
+ defaultLocale: i,
791
+ component: t,
792
+ property: l,
793
+ label: c("defaultValue"),
794
+ size: "small",
795
+ fullWidth: !0,
796
+ value: (b = (I = l.locales) == null ? void 0 : I[r]) == null ? void 0 : b.defaultValue,
797
+ onChange: (d) => {
798
+ u((h) => {
799
+ var S;
800
+ const m = h.properties[l.id].data;
801
+ m.locales ?? (m.locales = {}), (S = m.locales)[r] ?? (S[r] = {}), m.locales[r].defaultValue = d;
802
+ });
803
+ }
804
+ }
805
+ ),
806
+ l.type === "custom" ? /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(hr, { property: l, allComponents: n }) }) : null
807
+ ] })
808
+ ] })
720
809
  }
721
- ),
722
- c.type === "custom" ? /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(sr, { property: c, allComponents: r }) }) : null
723
- ] })
724
- ] }, c.id);
810
+ ) })
811
+ },
812
+ l.id
813
+ );
725
814
  }
726
815
  }
727
- ),
728
- b && /* @__PURE__ */ e(Me, { ...$e(u), component: t })
816
+ ) : /* @__PURE__ */ e(he, { style: { fontSize: 12 }, children: c("maker.properties.noProperties") }),
817
+ v && /* @__PURE__ */ e(et, { ...Qe(a), component: t })
729
818
  ] }) });
730
819
  }
731
- function sr({
820
+ function hr({
732
821
  property: t,
733
- allComponents: i
822
+ allComponents: r
734
823
  }) {
735
- const n = ie({ variant: "popper" });
736
- return /* @__PURE__ */ k(N, { children: [
737
- /* @__PURE__ */ e(j, { sx: { minWidth: 0 }, ...le(n), children: /* @__PURE__ */ e(Ye, { fontSize: "small" }) }),
738
- /* @__PURE__ */ e(We, { ...Ge(n), children: /* @__PURE__ */ e(Ue, { onClickAway: n.close, children: /* @__PURE__ */ e(Ee, { children: /* @__PURE__ */ e(w, { width: 500, p: 2, children: /* @__PURE__ */ e(
739
- me,
824
+ const i = se({ variant: "popper" });
825
+ return /* @__PURE__ */ w(U, { children: [
826
+ /* @__PURE__ */ e(A, { sx: { minWidth: 0 }, ...ce(i), children: /* @__PURE__ */ e(qe, { fontSize: "small" }) }),
827
+ /* @__PURE__ */ e(_e, { ...Xe(i), children: /* @__PURE__ */ e($e, { onClickAway: i.close, children: /* @__PURE__ */ e(me, { children: /* @__PURE__ */ e(P, { width: 500, p: 2, children: /* @__PURE__ */ e(
828
+ ye,
740
829
  {
741
830
  value: t.componentId,
742
- onChange: (r, a) => t.componentId = a,
743
- allComponents: i
831
+ onChange: (n, u) => t.componentId = u,
832
+ allComponents: r
744
833
  }
745
834
  ) }) }) }) })
746
835
  ] });
747
836
  }
748
- function cr({
837
+ function fr({
749
838
  value: t,
750
- valueImmutable: i,
751
- onChange: n,
752
- defaultLocale: r,
753
- allComponents: a
839
+ valueImmutable: r,
840
+ onChange: i,
841
+ defaultLocale: n,
842
+ allComponents: u
754
843
  }) {
755
- var v;
756
- const b = ie({ variant: "popper" }), { locale: p } = z(), u = typeof (t == null ? void 0 : t.componentId) == "string" ? (v = a[t.componentId]) == null ? void 0 : v.data : void 0;
757
- return u ? /* @__PURE__ */ k(N, { children: [
758
- /* @__PURE__ */ e(j, { sx: { minWidth: 0 }, disabled: !u, ...le(b), children: /* @__PURE__ */ e(Ye, { fontSize: "small" }) }),
844
+ var k;
845
+ const v = se({ variant: "popper" }), { locale: c } = j(), a = typeof (t == null ? void 0 : t.componentId) == "string" ? (k = u[t.componentId]) == null ? void 0 : k.data : void 0;
846
+ return a ? /* @__PURE__ */ w(U, { children: [
847
+ /* @__PURE__ */ e(A, { sx: { minWidth: 0 }, disabled: !a, ...ce(v), children: /* @__PURE__ */ e(qe, { fontSize: "small" }) }),
759
848
  /* @__PURE__ */ e(
760
- We,
849
+ _e,
761
850
  {
762
- ...Ge(b),
851
+ ...Xe(v),
763
852
  sx: {
764
853
  zIndex: 1e3
765
854
  },
766
- children: /* @__PURE__ */ e(Ue, { onClickAway: b.close, children: /* @__PURE__ */ e(Ee, { children: /* @__PURE__ */ k(w, { width: 500, p: 2, children: [
767
- /* @__PURE__ */ e(E, { variant: "subtitle1", children: "Parameters" }),
768
- /* @__PURE__ */ e(S, { gap: 1, children: (u == null ? void 0 : u.properties) && V(Object.values(u.properties), "index").map(({ data: c }) => {
769
- var h, m, f, s, l, o, d, x;
770
- return /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
855
+ children: /* @__PURE__ */ e($e, { onClickAway: v.close, children: /* @__PURE__ */ e(me, { children: /* @__PURE__ */ w(P, { width: 500, p: 2, children: [
856
+ /* @__PURE__ */ e(V, { variant: "subtitle1", children: "Parameters" }),
857
+ /* @__PURE__ */ e(D, { gap: 1, children: (a == null ? void 0 : a.properties) && F(Object.values(a.properties), "index").map(({ data: l }) => {
858
+ var y, f, p, x, o, s, g, I;
859
+ return /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
771
860
  W,
772
861
  {
773
- allComponents: a,
774
- defaultLocale: r,
862
+ allComponents: u,
863
+ defaultLocale: n,
775
864
  size: "small",
776
865
  fullWidth: !0,
777
- component: u,
778
- property: c,
779
- valueImmutable: Z((m = (h = t.properties) == null ? void 0 : h[c.id]) == null ? void 0 : m.value),
780
- value: ((s = (f = t.properties) == null ? void 0 : f[c.id]) == null ? void 0 : s.value) ?? ((o = (l = c.locales) == null ? void 0 : l[p]) == null ? void 0 : o.defaultValue) ?? ((x = (d = c.locales) == null ? void 0 : d[r]) == null ? void 0 : x.defaultValue),
781
- onChange: (y) => {
782
- if (i) {
783
- const I = JSON.parse(JSON.stringify(t));
784
- n == null || n({ ...I, properties: { ...I.properties, [c.id]: { value: y } } });
866
+ component: a,
867
+ property: l,
868
+ valueImmutable: L((f = (y = t.properties) == null ? void 0 : y[l.id]) == null ? void 0 : f.value),
869
+ value: ((x = (p = t.properties) == null ? void 0 : p[l.id]) == null ? void 0 : x.value) ?? ((s = (o = l.locales) == null ? void 0 : o[c]) == null ? void 0 : s.defaultValue) ?? ((I = (g = l.locales) == null ? void 0 : g[n]) == null ? void 0 : I.defaultValue),
870
+ onChange: (b) => {
871
+ if (r) {
872
+ const d = JSON.parse(JSON.stringify(t));
873
+ i == null || i({ ...d, properties: { ...d.properties, [l.id]: { value: b } } });
785
874
  } else
786
- _(u).doc.transact(() => {
787
- t.properties ?? (t.properties = {}), t.properties[c.id] = { value: y };
875
+ _(a).doc.transact(() => {
876
+ t.properties ?? (t.properties = {}), t.properties[l.id] = { value: b };
788
877
  });
789
878
  }
790
879
  }
791
- ) }, c.id);
880
+ ) }, l.id);
792
881
  }) })
793
882
  ] }) }) })
794
883
  }
795
884
  )
796
885
  ] }) : null;
797
886
  }
798
- function Me({
887
+ function et({
799
888
  type: t = "properties",
800
- component: i,
801
- ...n
889
+ component: r,
890
+ ...i
802
891
  }) {
803
- var m, f, s;
804
- const { t: r } = z(), {
892
+ var f, p, x;
893
+ const { t: n } = j(), {
805
894
  state: {
806
- components: a,
807
- supportedLocales: b,
808
- config: { defaultLocale: p }
895
+ components: u,
896
+ supportedLocales: v,
897
+ config: { defaultLocale: c }
809
898
  }
810
- } = re(), u = ce(), v = _(i).doc, c = t === "properties" ? i.properties : t === "parameters" && ((m = i.renderer) == null ? void 0 : m.type) === "component" ? (f = a[i.renderer.componentId]) == null ? void 0 : f.data.properties : void 0, h = ((s = i.renderer) == null ? void 0 : s.type) === "component" ? i : void 0;
811
- return /* @__PURE__ */ k(ae, { ...n, fullWidth: !0, maxWidth: "lg", children: [
812
- /* @__PURE__ */ e(Ae, { children: r("i18nEditorTitle") }),
813
- /* @__PURE__ */ e(Te, { children: c && /* @__PURE__ */ e(S, { children: /* @__PURE__ */ k(tt, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
814
- /* @__PURE__ */ e(rt, { children: /* @__PURE__ */ e(Se, { children: b.map(({ locale: l, name: o }) => /* @__PURE__ */ k(Ce, { children: [
815
- o,
816
- p === l && /* @__PURE__ */ e(Ht, { sx: { fontSize: 12, color: "text.secondary" } })
817
- ] }, l)) }) }),
818
- /* @__PURE__ */ e(it, { children: V(Object.values(c), "index").map(({ data: l }) => /* @__PURE__ */ e(Se, { children: b.map(({ locale: o }) => {
819
- var d, x, y, I, g, C, P, O, A, K, F, H, U, J, L, Y, $, G, q, M, he, fe, be, ve, ye, ge;
820
- return /* @__PURE__ */ e(Ce, { children: /* @__PURE__ */ e(S, { gap: 1, children: t === "properties" ? /* @__PURE__ */ k(N, { children: [
899
+ } = le(), a = ae(), k = _(r).doc, l = t === "properties" ? r.properties : t === "parameters" && ((f = r.renderer) == null ? void 0 : f.type) === "component" ? (p = u[r.renderer.componentId]) == null ? void 0 : p.data.properties : void 0, y = ((x = r.renderer) == null ? void 0 : x.type) === "component" ? r : void 0;
900
+ return /* @__PURE__ */ w(pe, { ...i, fullWidth: !0, maxWidth: "lg", children: [
901
+ /* @__PURE__ */ e(Ue, { children: n("i18nEditorTitle") }),
902
+ /* @__PURE__ */ e(We, { children: l && /* @__PURE__ */ e(D, { children: /* @__PURE__ */ w(ot, { stickyHeader: !0, sx: { td: { verticalAlign: "top" } }, children: [
903
+ /* @__PURE__ */ e(st, { children: /* @__PURE__ */ e(Oe, { children: v.map(({ locale: o, name: s }) => /* @__PURE__ */ w(ze, { children: [
904
+ s,
905
+ c === o && /* @__PURE__ */ e(Gt, { sx: { fontSize: 12, color: "text.secondary" } })
906
+ ] }, o)) }) }),
907
+ /* @__PURE__ */ e(ct, { children: F(Object.values(l), "index").map(({ data: o }) => /* @__PURE__ */ e(Oe, { children: v.map(({ locale: s }) => {
908
+ var g, I, b, d, h, m, S, C, z, T, K, E, H, J, ee, M, $, Y, G, q, ve, xe, ge, ke, Ie, we;
909
+ return /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(D, { gap: 1, children: t === "properties" ? /* @__PURE__ */ w(U, { children: [
821
910
  /* @__PURE__ */ e(
822
- D,
911
+ O,
823
912
  {
824
913
  size: "small",
825
914
  label: "Key",
826
- value: l.key || "",
915
+ value: o.key || "",
827
916
  onChange: (B) => {
828
- v.transact(() => {
829
- l.key = B.target.value.trim();
917
+ k.transact(() => {
918
+ o.key = B.target.value.trim();
830
919
  });
831
920
  }
832
921
  }
833
922
  ),
834
923
  /* @__PURE__ */ e(
835
- D,
924
+ O,
836
925
  {
837
926
  size: "small",
838
- label: r("label"),
839
- value: (((x = (d = l.locales) == null ? void 0 : d[o]) == null ? void 0 : x.name) ?? ((I = (y = l.locales) == null ? void 0 : y[p]) == null ? void 0 : I.name)) || "",
927
+ label: n("label"),
928
+ value: (((I = (g = o.locales) == null ? void 0 : g[s]) == null ? void 0 : I.name) ?? ((d = (b = o.locales) == null ? void 0 : b[c]) == null ? void 0 : d.name)) || "",
840
929
  onChange: (B) => {
841
- v.transact(() => {
842
- var T;
843
- l.locales ?? (l.locales = {}), (T = l.locales)[o] ?? (T[o] = {}), l.locales[o].name = B.target.value;
930
+ k.transact(() => {
931
+ var N;
932
+ o.locales ?? (o.locales = {}), (N = o.locales)[s] ?? (N[s] = {}), o.locales[s].name = B.target.value;
844
933
  });
845
934
  }
846
935
  }
847
936
  ),
848
- /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
937
+ /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
849
938
  W,
850
939
  {
851
- allComponents: u,
852
- defaultLocale: p,
853
- component: i,
854
- property: l,
940
+ allComponents: a,
941
+ defaultLocale: c,
942
+ component: r,
943
+ property: o,
855
944
  size: "small",
856
945
  fullWidth: !0,
857
946
  label: "Default Value",
858
- valueImmutable: Z((C = (g = l.locales) == null ? void 0 : g[o]) == null ? void 0 : C.defaultValue),
859
- value: ((O = (P = l.locales) == null ? void 0 : P[o]) == null ? void 0 : O.defaultValue) ?? ((K = (A = l.locales) == null ? void 0 : A[p]) == null ? void 0 : K.defaultValue),
947
+ valueImmutable: L((m = (h = o.locales) == null ? void 0 : h[s]) == null ? void 0 : m.defaultValue),
948
+ value: ((C = (S = o.locales) == null ? void 0 : S[s]) == null ? void 0 : C.defaultValue) ?? ((T = (z = o.locales) == null ? void 0 : z[c]) == null ? void 0 : T.defaultValue),
860
949
  onChange: (B) => {
861
- v.transact(() => {
862
- var T;
863
- l.locales ?? (l.locales = {}), (T = l.locales)[o] ?? (T[o] = {}), l.locales[o].defaultValue = B;
950
+ k.transact(() => {
951
+ var N;
952
+ o.locales ?? (o.locales = {}), (N = o.locales)[s] ?? (N[s] = {}), o.locales[s].defaultValue = B;
864
953
  });
865
954
  }
866
955
  }
867
956
  ) })
868
- ] }) : t === "parameters" && h ? /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
957
+ ] }) : t === "parameters" && y ? /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
869
958
  W,
870
959
  {
871
- allComponents: u,
872
- defaultLocale: p,
873
- component: i,
874
- property: l,
960
+ allComponents: a,
961
+ defaultLocale: c,
962
+ component: r,
963
+ property: o,
875
964
  size: "small",
876
965
  fullWidth: !0,
877
- valueImmutable: Z(
878
- (J = (U = (H = (F = h.renderer.properties) == null ? void 0 : F[l.id]) == null ? void 0 : H.locales) == null ? void 0 : U[o]) == null ? void 0 : J.value
966
+ valueImmutable: L(
967
+ (J = (H = (E = (K = y.renderer.properties) == null ? void 0 : K[o.id]) == null ? void 0 : E.locales) == null ? void 0 : H[s]) == null ? void 0 : J.value
879
968
  ),
880
- value: ((G = ($ = (Y = (L = h.renderer.properties) == null ? void 0 : L[l.id]) == null ? void 0 : Y.locales) == null ? void 0 : $[o]) == null ? void 0 : G.value) ?? ((fe = (he = (M = (q = h.renderer.properties) == null ? void 0 : q[l.id]) == null ? void 0 : M.locales) == null ? void 0 : he[p]) == null ? void 0 : fe.value) ?? ((ve = (be = l.locales) == null ? void 0 : be[o]) == null ? void 0 : ve.defaultValue) ?? ((ge = (ye = l.locales) == null ? void 0 : ye[p]) == null ? void 0 : ge.defaultValue),
969
+ value: ((Y = ($ = (M = (ee = y.renderer.properties) == null ? void 0 : ee[o.id]) == null ? void 0 : M.locales) == null ? void 0 : $[s]) == null ? void 0 : Y.value) ?? ((xe = (ve = (q = (G = y.renderer.properties) == null ? void 0 : G[o.id]) == null ? void 0 : q.locales) == null ? void 0 : ve[c]) == null ? void 0 : xe.value) ?? ((ke = (ge = o.locales) == null ? void 0 : ge[s]) == null ? void 0 : ke.defaultValue) ?? ((we = (Ie = o.locales) == null ? void 0 : Ie[c]) == null ? void 0 : we.defaultValue),
881
970
  onChange: (B) => {
882
- v.transact(() => {
883
- var T, xe, Ie, ke, we;
884
- (T = h.renderer).properties ?? (T.properties = {}), (xe = h.renderer.properties)[Ie = l.id] ?? (xe[Ie] = {}), (ke = h.renderer.properties[l.id]).locales ?? (ke.locales = {}), (we = h.renderer.properties[l.id].locales)[o] ?? (we[o] = {}), h.renderer.properties[l.id].locales[o].value = B;
971
+ k.transact(() => {
972
+ var N, Se, Pe, Ce, De;
973
+ (N = y.renderer).properties ?? (N.properties = {}), (Se = y.renderer.properties)[Pe = o.id] ?? (Se[Pe] = {}), (Ce = y.renderer.properties[o.id]).locales ?? (Ce.locales = {}), (De = y.renderer.properties[o.id].locales)[s] ?? (De[s] = {}), y.renderer.properties[o.id].locales[s].value = B;
885
974
  });
886
975
  }
887
976
  }
888
- ) }) : null }, l.id) }, o);
889
- }) }, l.id)) })
977
+ ) }) : null }, o.id) }, s);
978
+ }) }, o.id)) })
890
979
  ] }) }) }),
891
- /* @__PURE__ */ e(Be, { children: /* @__PURE__ */ e(j, { onClick: (l) => {
892
- var o;
893
- return (o = n.onClose) == null ? void 0 : o.call(n, l, "escapeKeyDown");
894
- }, children: r("close") }) })
980
+ /* @__PURE__ */ e(Ve, { children: /* @__PURE__ */ e(A, { onClick: (o) => {
981
+ var s;
982
+ return (s = i.onClose) == null ? void 0 : s.call(i, o, "escapeKeyDown");
983
+ }, children: n("close") }) })
895
984
  ] });
896
985
  }
897
986
  function W({
898
987
  component: t,
899
- property: i,
900
- value: n,
901
- onChange: r,
902
- valueImmutable: a,
903
- defaultLocale: b,
904
- allComponents: p,
905
- ...u
988
+ property: r,
989
+ value: i,
990
+ onChange: n,
991
+ valueImmutable: u,
992
+ defaultLocale: v,
993
+ allComponents: c,
994
+ ...a
906
995
  }) {
907
- var m, f, s, l, o;
908
- const { locale: v } = z(), c = X(null), h = u.label || ((f = (m = i.locales) == null ? void 0 : m[v]) == null ? void 0 : f.name) || ((l = (s = i.locales) == null ? void 0 : s[b]) == null ? void 0 : l.name) || i.key || i.id;
909
- if (i.type === "number")
996
+ var x, o, s, g, I;
997
+ const { locale: k } = j(), l = Kt(), y = Z(null), f = () => {
998
+ var d;
999
+ const b = (d = l == null ? void 0 : l.current) == null ? void 0 : d.getUploader();
1000
+ b == null || b.open(), y.current && b.onceUploadSuccess(({ response: h }) => {
1001
+ var S, C;
1002
+ let m = ((S = h == null ? void 0 : h.data) == null ? void 0 : S.filename) || "";
1003
+ m && (m = `mediakit://${m}`, i && !i.includes("mediakit://") && (m += " # please use < import { getMediaKitAbsoluteUrl } from '@blocklet/pages-kit/builtin/utils' > to get the full address")), (C = y.current) == null || C.call(y, m);
1004
+ });
1005
+ }, p = a.label || ((o = (x = r.locales) == null ? void 0 : x[k]) == null ? void 0 : o.name) || ((g = (s = r.locales) == null ? void 0 : s[v]) == null ? void 0 : g.name) || r.key || r.id;
1006
+ if (r.type === "number")
910
1007
  return /* @__PURE__ */ e(
911
- dr,
1008
+ br,
912
1009
  {
913
- ...u,
914
- label: h,
1010
+ ...a,
1011
+ label: p,
915
1012
  NumberProps: {
916
- value: ["number", "string"].includes(typeof n) ? n : null,
917
- onChange: (d, x) => r == null ? void 0 : r(x)
1013
+ value: ["number", "string"].includes(typeof i) ? i : null,
1014
+ onChange: (b, d) => n == null ? void 0 : n(d)
918
1015
  }
919
1016
  }
920
1017
  );
921
- if (i.type === "custom-settings")
922
- return null;
923
- if (i.type === "decimal")
1018
+ if (r.type === "decimal")
924
1019
  return /* @__PURE__ */ e(
925
- D,
1020
+ O,
926
1021
  {
927
- ...u,
928
- label: h,
1022
+ ...a,
1023
+ label: p,
929
1024
  type: "text",
930
- value: n ?? "",
931
- onChange: (d) => {
932
- const x = d.target.value;
933
- if (x === "" || x === "-") {
934
- r == null || r(x);
1025
+ value: i ?? "",
1026
+ onChange: (b) => {
1027
+ const d = b.target.value;
1028
+ if (d === "" || d === "-") {
1029
+ n == null || n(d);
935
1030
  return;
936
1031
  }
937
- if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(x)) {
938
- let I = x;
939
- /^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(I) && (I = Number(I)), r == null || r(I);
1032
+ if (/^-?(?!.*\..*\.)[0-9]*(\.[0-9]{0,9})?$/.test(d)) {
1033
+ let m = d;
1034
+ /^-?[1-9]+[0-9]*(\.[0-9]{1,9})?$/.test(m) && (m = Number(m)), n == null || n(m);
940
1035
  }
941
1036
  }
942
1037
  }
943
1038
  );
944
- if (i.type === "boolean")
1039
+ if (r.type === "boolean")
945
1040
  return /* @__PURE__ */ e(
946
- ze,
1041
+ Ne,
947
1042
  {
948
- label: h,
1043
+ label: p,
949
1044
  labelPlacement: "start",
950
- control: /* @__PURE__ */ e(je, { checked: n === !0, onChange: (d, x) => r == null ? void 0 : r(x) })
1045
+ control: /* @__PURE__ */ e(Be, { checked: i === !0, onChange: (b, d) => n == null ? void 0 : n(d) })
951
1046
  }
952
1047
  );
953
- if (i.type === "color")
1048
+ if (r.type === "color")
954
1049
  return /* @__PURE__ */ e(
955
- Lt,
1050
+ or,
956
1051
  {
957
- label: h,
958
- value: n,
959
- onChange: (d) => {
960
- r == null || r(d);
1052
+ label: p,
1053
+ value: i,
1054
+ onChange: (b) => {
1055
+ n == null || n(b);
961
1056
  }
962
1057
  }
963
1058
  );
964
- if (i.type === "json" || i.type === "yaml")
965
- return /* @__PURE__ */ k(
966
- S,
1059
+ if (r.type === "json" || r.type === "yaml")
1060
+ return /* @__PURE__ */ w(
1061
+ D,
967
1062
  {
968
1063
  sx: {
969
1064
  width: "100%",
@@ -976,7 +1071,7 @@ function W({
976
1071
  },
977
1072
  children: [
978
1073
  /* @__PURE__ */ e(
979
- et,
1074
+ lt,
980
1075
  {
981
1076
  sx: {
982
1077
  position: "absolute",
@@ -984,25 +1079,25 @@ function W({
984
1079
  top: 0,
985
1080
  transform: "translate(0px, -7px) scale(0.75)"
986
1081
  },
987
- children: h
1082
+ children: p
988
1083
  }
989
1084
  ),
990
1085
  /* @__PURE__ */ e(
991
- Fe,
1086
+ Je,
992
1087
  {
993
- keyId: i.id,
994
- locale: v,
995
- language: i.type === "yaml" ? "yaml" : "json",
996
- value: typeof n == "string" ? n : "",
997
- onChange: (d) => r == null ? void 0 : r(d),
998
- onUpload: (d) => {
999
- c.current = d;
1088
+ keyId: r.id,
1089
+ locale: k,
1090
+ language: r.type === "yaml" ? "yaml" : "json",
1091
+ value: typeof i == "string" ? i : "",
1092
+ onChange: (b) => n == null ? void 0 : n(b),
1093
+ onUpload: (b) => {
1094
+ y.current = b, f();
1000
1095
  }
1001
1096
  },
1002
- i.id
1097
+ r.id
1003
1098
  ),
1004
1099
  /* @__PURE__ */ e(
1005
- w,
1100
+ P,
1006
1101
  {
1007
1102
  component: "fieldset",
1008
1103
  sx: {
@@ -1018,104 +1113,104 @@ function W({
1018
1113
  px: 1,
1019
1114
  py: 0
1020
1115
  },
1021
- children: /* @__PURE__ */ e(w, { component: "legend", sx: { fontSize: "0.75em" }, children: /* @__PURE__ */ e(w, { component: "span", sx: { opacity: 0 }, children: u.label }) })
1116
+ children: /* @__PURE__ */ e(P, { component: "legend", sx: { fontSize: "0.75em" }, children: /* @__PURE__ */ e(P, { component: "span", sx: { opacity: 0 }, children: a.label }) })
1022
1117
  }
1023
1118
  )
1024
1119
  ]
1025
1120
  }
1026
1121
  );
1027
- if (i.type === "custom") {
1028
- const d = (o = p[i.componentId]) == null ? void 0 : o.data;
1029
- return d ? /* @__PURE__ */ e(w, { width: "100%", children: /* @__PURE__ */ e(
1030
- He,
1122
+ if (r.type === "custom") {
1123
+ const b = (I = c[r.componentId]) == null ? void 0 : I.data;
1124
+ return b ? /* @__PURE__ */ e(P, { width: "100%", children: /* @__PURE__ */ e(
1125
+ Me,
1031
1126
  {
1032
- componentId: d.id,
1033
- props: { label: h, value: n, onChange: r },
1034
- locale: v,
1127
+ componentId: b.id,
1128
+ props: { label: p, value: i, onChange: n },
1129
+ locale: k,
1035
1130
  dev: {
1036
1131
  mode: "draft",
1037
- components: p,
1038
- defaultLocale: b
1132
+ components: c,
1133
+ defaultLocale: v
1039
1134
  }
1040
1135
  }
1041
- ) }) : /* @__PURE__ */ e(D, { ...u, label: h, disabled: !0, placeholder: "Click right button select a component" });
1136
+ ) }) : /* @__PURE__ */ e(O, { ...a, label: p, disabled: !0, placeholder: "Click right button select a component" });
1042
1137
  }
1043
- if (i.type === "component")
1044
- return /* @__PURE__ */ k(S, { width: "100%", direction: "row", gap: 1, children: [
1045
- /* @__PURE__ */ e(w, { flex: 1, children: /* @__PURE__ */ e(
1046
- me,
1138
+ if (r.type === "component")
1139
+ return /* @__PURE__ */ w(D, { width: "100%", direction: "row", gap: 1, children: [
1140
+ /* @__PURE__ */ e(P, { flex: 1, children: /* @__PURE__ */ e(
1141
+ ye,
1047
1142
  {
1048
- allComponents: p,
1049
- label: h,
1050
- value: n == null ? void 0 : n.componentId,
1051
- onChange: (d, x) => {
1052
- a || !n ? r == null || r({ ...n && JSON.parse(JSON.stringify(n)), componentId: x }) : typeof n == "object" && (n.componentId = x);
1143
+ allComponents: c,
1144
+ label: p,
1145
+ value: i == null ? void 0 : i.componentId,
1146
+ onChange: (b, d) => {
1147
+ u || !i ? n == null || n({ ...i && JSON.parse(JSON.stringify(i)), componentId: d }) : typeof i == "object" && (i.componentId = d);
1053
1148
  }
1054
1149
  }
1055
1150
  ) }),
1056
- /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
1057
- cr,
1151
+ /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
1152
+ fr,
1058
1153
  {
1059
- value: n,
1060
- valueImmutable: a,
1061
- onChange: r,
1062
- defaultLocale: b,
1063
- allComponents: p
1154
+ value: i,
1155
+ valueImmutable: u,
1156
+ onChange: n,
1157
+ defaultLocale: v,
1158
+ allComponents: c
1064
1159
  }
1065
1160
  ) })
1066
1161
  ] });
1067
- if (!i.type || ["string", "url"].includes(i.type)) {
1068
- const d = i.type === "string" ? i.multiline : void 0, x = i.type === "url" ? n == null ? void 0 : n.url : n;
1162
+ if (!r.type || ["string", "url"].includes(r.type)) {
1163
+ const b = r.type === "string" ? r.multiline : void 0, d = r.type === "url" ? i == null ? void 0 : i.url : i;
1069
1164
  return /* @__PURE__ */ e(
1070
- D,
1165
+ O,
1071
1166
  {
1072
- ...u,
1073
- label: h,
1074
- value: typeof x == "string" ? x : "",
1075
- multiline: d,
1076
- minRows: d ? 2 : void 0,
1077
- maxRows: d ? 10 : void 0,
1078
- onChange: (y) => r == null ? void 0 : r(
1079
- i.type === "url" ? { ...n, url: y.target.value, mediaKitUrl: y.target.value } : y.target.value
1167
+ ...a,
1168
+ label: p,
1169
+ value: typeof d == "string" ? d : "",
1170
+ multiline: b,
1171
+ minRows: b ? 2 : void 0,
1172
+ maxRows: b ? 10 : void 0,
1173
+ onChange: (h) => n == null ? void 0 : n(
1174
+ r.type === "url" ? { ...i, url: h.target.value, mediaKitUrl: h.target.value } : h.target.value
1080
1175
  ),
1081
- InputProps: i.type === "url" ? {
1176
+ InputProps: r.type === "url" ? {
1082
1177
  sx: { pr: 0 },
1083
- endAdornment: /* @__PURE__ */ k(de, { position: "end", children: [
1178
+ endAdornment: /* @__PURE__ */ w(oe, { position: "end", children: [
1084
1179
  /* @__PURE__ */ e(
1085
- pe,
1180
+ fe,
1086
1181
  {
1087
- onChange: async ({ response: y }) => {
1088
- var P, O, A;
1089
- const I = ((P = y == null ? void 0 : y.data) == null ? void 0 : P.url) || ((O = y == null ? void 0 : y.data) == null ? void 0 : O.fileUrl);
1090
- let g;
1091
- I && (g = await oe(I).catch(() => se(I)).catch(() => {
1182
+ onChange: async ({ response: h }) => {
1183
+ var z, T, K;
1184
+ const m = ((z = h == null ? void 0 : h.data) == null ? void 0 : z.url) || ((T = h == null ? void 0 : h.data) == null ? void 0 : T.fileUrl);
1185
+ let S;
1186
+ m && (S = await de(m).catch(() => ue(m)).catch(() => {
1092
1187
  }));
1093
- let C = ((A = y == null ? void 0 : y.data) == null ? void 0 : A.filename) || "";
1094
- C && (C = `mediakit://${C}`), r == null || r({
1095
- url: I,
1188
+ let C = ((K = h == null ? void 0 : h.data) == null ? void 0 : K.filename) || "";
1189
+ C && (C = `mediakit://${C}`), n == null || n({
1190
+ url: m,
1096
1191
  mediaKitUrl: C,
1097
- width: g == null ? void 0 : g.naturalWidth,
1098
- height: g == null ? void 0 : g.naturalHeight
1192
+ width: S == null ? void 0 : S.naturalWidth,
1193
+ height: S == null ? void 0 : S.naturalHeight
1099
1194
  });
1100
1195
  }
1101
1196
  }
1102
1197
  ),
1103
- /* @__PURE__ */ e(ne, { 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__ */ e(Ft, { sx: { cursor: "default" }, fontSize: "small" }) })
1198
+ /* @__PURE__ */ e(Q, { 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__ */ e(Ge, { sx: { cursor: "default" }, fontSize: "small" }) })
1104
1199
  ] })
1105
1200
  } : void 0
1106
1201
  }
1107
1202
  );
1108
1203
  }
1109
- return console.error("Unsupported property type", i.type), null;
1204
+ return console.error("Unsupported property type", r.type), null;
1110
1205
  }
1111
- function dr({
1206
+ function br({
1112
1207
  NumberProps: t,
1113
- ...i
1208
+ ...r
1114
1209
  }) {
1115
- const { getInputProps: n } = Et(t), r = n();
1116
- return /* @__PURE__ */ e(D, { ...i, inputProps: r });
1210
+ const { getInputProps: i } = Et(t), n = i();
1211
+ return /* @__PURE__ */ e(O, { ...r, inputProps: n });
1117
1212
  }
1118
- const ar = `import React from '@blocklet/pages-kit/builtin/react'
1213
+ const yr = `import React from '@blocklet/pages-kit/builtin/react'
1119
1214
  import { Box } from '@blocklet/pages-kit/builtin/mui/material'
1120
1215
 
1121
1216
  export default function () {
@@ -1124,212 +1219,242 @@ export default function () {
1124
1219
  Hello World
1125
1220
  </Box>
1126
1221
  )
1127
- }`, ur = `console.log('hello')
1222
+ }`, vr = `console.log('hello')
1128
1223
  `;
1129
- function pr({
1224
+ function xr({
1130
1225
  value: t
1131
1226
  }) {
1132
- const { locale: i } = z(), n = jt(), r = _(t).doc;
1133
- return Q(() => {
1134
- var a;
1135
- (a = t.renderer) != null && a.script || (r.transact(() => {
1136
- t.renderer.script = t.renderer.type === "react-component" ? ar : ur;
1137
- }), n());
1138
- }, [t]), /* @__PURE__ */ e(w, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ e(
1139
- Fe,
1227
+ const { locale: r } = j(), i = Ut(), n = _(t).doc;
1228
+ return X(() => {
1229
+ var u;
1230
+ (u = t.renderer) != null && u.script || (n.transact(() => {
1231
+ t.renderer.script = t.renderer.type === "react-component" ? yr : vr;
1232
+ }), i());
1233
+ }, [t]), /* @__PURE__ */ e(P, { sx: { border: 1, borderColor: "divider", borderRadius: 1, overflow: "hidden" }, children: /* @__PURE__ */ e(
1234
+ Je,
1140
1235
  {
1141
1236
  keyId: t.id,
1142
- locale: i,
1237
+ locale: r,
1143
1238
  language: "typescript",
1144
1239
  value: t.renderer.script || "",
1145
- onChange: (a) => t.renderer.script = a,
1240
+ onChange: (u) => t.renderer.script = u,
1146
1241
  typeScriptNoValidation: !1
1147
1242
  },
1148
1243
  t.id
1149
1244
  ) });
1150
1245
  }
1151
- function mr({ value: t }) {
1152
- var h, m, f;
1153
- const { t: i } = z(), n = _(t).doc, {
1246
+ function gr({ value: t }) {
1247
+ var y, f, p;
1248
+ const { t: r } = j(), i = _(t).doc, {
1154
1249
  state: {
1155
- components: r,
1156
- config: { defaultLocale: a },
1157
- resources: b
1250
+ components: n,
1251
+ config: { defaultLocale: u },
1252
+ resources: v
1158
1253
  },
1159
- localState: { currentLocale: p }
1160
- } = re(), u = ce(), v = ((h = r[t.renderer.componentId]) == null ? void 0 : h.data) ?? ((f = (m = b.components) == null ? void 0 : m[t.renderer.componentId]) == null ? void 0 : f.component), c = ie({ variant: "dialog" });
1161
- return /* @__PURE__ */ k(S, { gap: 1, children: [
1254
+ localState: { currentLocale: c }
1255
+ } = le(), a = ae(), k = ((y = n[t.renderer.componentId]) == null ? void 0 : y.data) ?? ((p = (f = v.components) == null ? void 0 : f[t.renderer.componentId]) == null ? void 0 : p.component), l = se({ variant: "dialog" });
1256
+ return /* @__PURE__ */ w(D, { gap: 1, children: [
1162
1257
  /* @__PURE__ */ e(
1163
- me,
1258
+ ye,
1164
1259
  {
1165
- allComponents: u,
1260
+ allComponents: a,
1166
1261
  excludes: [t.id],
1167
1262
  value: t.renderer.componentId,
1168
- onChange: (s, l) => t.renderer.componentId = l
1263
+ onChange: (x, o) => t.renderer.componentId = o
1169
1264
  }
1170
1265
  ),
1171
- v && /* @__PURE__ */ k(N, { children: [
1172
- /* @__PURE__ */ k(S, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
1173
- /* @__PURE__ */ e(E, { variant: "subtitle2", children: i("parameters") }),
1174
- /* @__PURE__ */ e(j, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...le(c), children: /* @__PURE__ */ e(Je, { fontSize: "small" }) })
1266
+ k && /* @__PURE__ */ w(U, { children: [
1267
+ /* @__PURE__ */ w(D, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
1268
+ /* @__PURE__ */ e(V, { variant: "subtitle2", children: r("parameters") }),
1269
+ /* @__PURE__ */ e(A, { sx: { minWidth: 32, minHeight: 32, p: 0 }, ...ce(l), children: /* @__PURE__ */ e(Ye, { fontSize: "small" }) })
1175
1270
  ] }),
1176
- v.properties && V(Object.values(v.properties), "index").map(({ data: s }) => {
1177
- var l, o, d, x, y, I, g, C, P, O, A, K, F, H, U, J;
1178
- return /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
1271
+ k.properties && F(Object.values(k.properties), "index").map(({ data: x }) => {
1272
+ var o, s, g, I, b, d, h, m, S, C, z, T, K, E, H, J;
1273
+ return /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
1179
1274
  W,
1180
1275
  {
1181
- allComponents: u,
1182
- defaultLocale: a,
1183
- component: v,
1184
- property: s,
1276
+ allComponents: a,
1277
+ defaultLocale: u,
1278
+ component: k,
1279
+ property: x,
1185
1280
  fullWidth: !0,
1186
1281
  size: "small",
1187
- valueImmutable: Z((x = (d = (o = (l = t.renderer.properties) == null ? void 0 : l[s.id]) == null ? void 0 : o.locales) == null ? void 0 : d[p]) == null ? void 0 : x.value),
1188
- value: ((C = (g = (I = (y = t.renderer.properties) == null ? void 0 : y[s.id]) == null ? void 0 : I.locales) == null ? void 0 : g[p]) == null ? void 0 : C.value) ?? ((K = (A = (O = (P = t.renderer.properties) == null ? void 0 : P[s.id]) == null ? void 0 : O.locales) == null ? void 0 : A[a]) == null ? void 0 : K.value) ?? ((H = (F = s.locales) == null ? void 0 : F[p]) == null ? void 0 : H.defaultValue) ?? ((J = (U = s.locales) == null ? void 0 : U[a]) == null ? void 0 : J.defaultValue),
1189
- onChange: (L) => {
1190
- n.transact(() => {
1191
- var Y, $, G, q, M;
1192
- (Y = t.renderer).properties ?? (Y.properties = {}), ($ = t.renderer.properties)[G = s.id] ?? ($[G] = {}), (q = t.renderer.properties[s.id]).locales ?? (q.locales = {}), (M = t.renderer.properties[s.id].locales)[p] ?? (M[p] = {}), t.renderer.properties[s.id].locales[p].value = L;
1282
+ valueImmutable: L((I = (g = (s = (o = t.renderer.properties) == null ? void 0 : o[x.id]) == null ? void 0 : s.locales) == null ? void 0 : g[c]) == null ? void 0 : I.value),
1283
+ value: ((m = (h = (d = (b = t.renderer.properties) == null ? void 0 : b[x.id]) == null ? void 0 : d.locales) == null ? void 0 : h[c]) == null ? void 0 : m.value) ?? ((T = (z = (C = (S = t.renderer.properties) == null ? void 0 : S[x.id]) == null ? void 0 : C.locales) == null ? void 0 : z[u]) == null ? void 0 : T.value) ?? ((E = (K = x.locales) == null ? void 0 : K[c]) == null ? void 0 : E.defaultValue) ?? ((J = (H = x.locales) == null ? void 0 : H[u]) == null ? void 0 : J.defaultValue),
1284
+ onChange: (ee) => {
1285
+ i.transact(() => {
1286
+ var M, $, Y, G, q;
1287
+ (M = t.renderer).properties ?? (M.properties = {}), ($ = t.renderer.properties)[Y = x.id] ?? ($[Y] = {}), (G = t.renderer.properties[x.id]).locales ?? (G.locales = {}), (q = t.renderer.properties[x.id].locales)[c] ?? (q[c] = {}), t.renderer.properties[x.id].locales[c].value = ee;
1193
1288
  });
1194
1289
  }
1195
1290
  }
1196
- ) }, s.id);
1291
+ ) }, x.id);
1197
1292
  }),
1198
- /* @__PURE__ */ e(Me, { ...$e(c), component: t, type: "parameters" })
1293
+ /* @__PURE__ */ e(et, { ...Qe(l), component: t, type: "parameters" })
1199
1294
  ] })
1200
1295
  ] });
1201
1296
  }
1202
- function me({
1297
+ function ye({
1203
1298
  label: t,
1204
- options: i,
1205
- excludes: n,
1206
- value: r,
1207
- onChange: a,
1208
- allComponents: b,
1209
- ...p
1299
+ options: r,
1300
+ excludes: i,
1301
+ value: n,
1302
+ onChange: u,
1303
+ allComponents: v,
1304
+ ...c
1210
1305
  }) {
1211
- var h;
1212
- const { t: u } = z(), v = i ?? V(Object.values(At(b, ...n ?? [])), "index").map((m) => m.data), c = (typeof r == "string" ? (h = b[r]) == null ? void 0 : h.data : void 0) ?? null;
1306
+ var y;
1307
+ const { t: a } = j(), k = r ?? F(Object.values(Wt(v, ...i ?? [])), "index").map((f) => f.data), l = (typeof n == "string" ? (y = v[n]) == null ? void 0 : y.data : void 0) ?? null;
1213
1308
  return /* @__PURE__ */ e(
1214
- Ne,
1309
+ Fe,
1215
1310
  {
1216
- ...p,
1311
+ ...c,
1217
1312
  size: "small",
1218
- options: v,
1313
+ options: k,
1219
1314
  autoHighlight: !0,
1220
- isOptionEqualToValue: (m, f) => m.id === f.id,
1221
- getOptionKey: (m) => m.id,
1222
- getOptionLabel: (m) => m.name || m.id,
1223
- renderInput: (m) => /* @__PURE__ */ e(D, { label: t || u("component"), ...m }),
1224
- value: c,
1225
- onChange: (m, f) => {
1226
- var l, o, d, x, y, I;
1227
- let s = {};
1228
- f && (s = {
1229
- blockletId: (l = b[f == null ? void 0 : f.id]) == null ? void 0 : l.blockletId,
1230
- blockletTitle: (o = b[f == null ? void 0 : f.id]) == null ? void 0 : o.blockletTitle,
1231
- componentName: ((x = (d = b[f == null ? void 0 : f.id]) == null ? void 0 : d.data) == null ? void 0 : x.name) || ((I = (y = b[f == null ? void 0 : f.id]) == null ? void 0 : y.data) == null ? void 0 : I.id)
1232
- }), a == null || a(m, f == null ? void 0 : f.id, s);
1315
+ isOptionEqualToValue: (f, p) => f.id === p.id,
1316
+ getOptionKey: (f) => f.id,
1317
+ getOptionLabel: (f) => f.name || f.id,
1318
+ renderInput: (f) => /* @__PURE__ */ e(O, { label: t || a("component"), ...f }),
1319
+ value: l,
1320
+ onChange: (f, p) => {
1321
+ var o, s, g, I, b, d;
1322
+ let x = {};
1323
+ p && (x = {
1324
+ blockletId: (o = v[p == null ? void 0 : p.id]) == null ? void 0 : o.blockletId,
1325
+ blockletTitle: (s = v[p == null ? void 0 : p.id]) == null ? void 0 : s.blockletTitle,
1326
+ componentName: ((I = (g = v[p == null ? void 0 : p.id]) == null ? void 0 : g.data) == null ? void 0 : I.name) || ((d = (b = v[p == null ? void 0 : p.id]) == null ? void 0 : b.data) == null ? void 0 : d.id)
1327
+ }), u == null || u(f, p == null ? void 0 : p.id, x);
1233
1328
  }
1234
1329
  }
1235
1330
  );
1236
1331
  }
1237
- function hr({
1332
+ function kr({
1238
1333
  config: t,
1239
- allComponents: i,
1240
- defaultLocale: n,
1241
- propertiesValue: r,
1242
- currentLocale: a,
1243
- onChange: b,
1244
- props: p
1334
+ allComponents: r,
1335
+ defaultLocale: i,
1336
+ propertiesValue: n,
1337
+ currentLocale: u,
1338
+ onChange: v,
1339
+ props: c
1245
1340
  }) {
1246
- const { t: u } = z(), [v, c] = ue(t == null ? void 0 : t.properties);
1247
- Q(() => {
1341
+ const { t: a } = j(), [k, l] = ie(t == null ? void 0 : t.properties), [y, f] = ie(null);
1342
+ X(() => {
1248
1343
  (() => {
1249
- var l, o;
1250
- ((l = t == null ? void 0 : t.renderer) == null ? void 0 : l.type) === "react-component" && Tt(t == null ? void 0 : t.properties) ? Nt((o = t == null ? void 0 : t.renderer) == null ? void 0 : o.script).then((d) => {
1251
- const x = Wt(d);
1252
- c(x);
1253
- }) : c(t == null ? void 0 : t.properties);
1344
+ var I, b;
1345
+ ((I = t == null ? void 0 : t.renderer) == null ? void 0 : I.type) === "react-component" && Vt(t == null ? void 0 : t.properties) ? Ft((b = t == null ? void 0 : t.renderer) == null ? void 0 : b.script).then((d) => {
1346
+ const h = _t(d);
1347
+ l(h);
1348
+ }) : l(t == null ? void 0 : t.properties);
1254
1349
  })();
1255
- }, [t]);
1256
- const m = te(() => !t || !v ? {} : Object.values(v).reduce(
1257
- (s, { data: l }) => {
1258
- var d, x, y, I, g;
1259
- const o = l.key || l.id;
1260
- return s[l.id] = {
1261
- value: (p == null ? void 0 : p[o]) ?? ((d = r == null ? void 0 : r[l.id]) == null ? void 0 : d.value) ?? ((y = (x = l.locales) == null ? void 0 : x[a]) == null ? void 0 : y.defaultValue) ?? ((g = (I = l.locales) == null ? void 0 : I[n]) == null ? void 0 : g.defaultValue),
1262
- key: o,
1263
- id: l.id,
1264
- type: l.type
1265
- }, s;
1350
+ }, [JSON.stringify(t)]);
1351
+ const p = ne(() => !t || !k ? {} : Object.values(k).reduce(
1352
+ (g, { data: I }) => {
1353
+ var d, h, m, S, C;
1354
+ const b = I.key || I.id;
1355
+ return g[I.id] = {
1356
+ key: b,
1357
+ value: (c == null ? void 0 : c[b]) ?? ((d = n == null ? void 0 : n[I.id]) == null ? void 0 : d.value) ?? ((m = (h = I.locales) == null ? void 0 : h[u]) == null ? void 0 : m.defaultValue) ?? ((C = (S = I.locales) == null ? void 0 : S[i]) == null ? void 0 : C.defaultValue),
1358
+ id: I.id,
1359
+ type: I.type
1360
+ }, g;
1266
1361
  },
1267
1362
  {}
1268
- ), [v, t, r, a, n])(), f = Jt(m, "key");
1269
- return /* @__PURE__ */ k(N, { children: [
1270
- /* @__PURE__ */ e(E, { variant: "subtitle1", children: u("maker.properties.parameters") }),
1271
- /* @__PURE__ */ e(S, { gap: 1, children: t && v && V(Object.values(v), "index").map(({ data: s }) => {
1272
- var l, o;
1273
- return /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(
1274
- W,
1275
- {
1276
- allComponents: i,
1277
- defaultLocale: n,
1278
- size: "small",
1279
- fullWidth: !0,
1280
- component: t,
1281
- property: s,
1282
- valueImmutable: Z((l = r == null ? void 0 : r[s.id]) == null ? void 0 : l.value),
1283
- value: (o = m[s.id]) == null ? void 0 : o.value,
1284
- onChange: (d) => {
1285
- b({
1286
- path: ["properties", s.id],
1287
- value: { value: d },
1288
- shouldSync: !(!s.type || De.includes(s.type)),
1289
- excludeKeys: [],
1290
- key: s.key || s.id
1291
- });
1292
- }
1293
- }
1294
- ) }, s.id);
1295
- }) }),
1296
- /* @__PURE__ */ e(w, { sx: { width: "100%" }, children: /* @__PURE__ */ e(
1297
- He,
1298
- {
1299
- componentId: (t == null ? void 0 : t.id) || "",
1300
- renderType: "setting",
1301
- locale: a,
1302
- properties: m,
1303
- dev: { mode: "draft", components: i, defaultLocale: n },
1304
- props: {
1305
- ...p,
1306
- onChange: (s) => {
1307
- Object.keys(s).filter((o) => {
1308
- var d;
1309
- return s[o] !== ((d = f == null ? void 0 : f[o]) == null ? void 0 : d.value);
1310
- }).filter((o) => !(o === "locale" && !Ut(f[o], "locale"))).forEach((o) => {
1311
- const d = f[o];
1312
- d != null && d.id ? b({
1313
- path: ["properties", d.id],
1314
- value: { value: s[o] },
1315
- shouldSync: !(!d.type || De.includes(d.type)),
1363
+ ), [JSON.stringify(k), t, n, u, i]), x = pt(() => {
1364
+ if (!k)
1365
+ return {
1366
+ canUseProperties: [],
1367
+ visibleProperties: [],
1368
+ canUsePropertiesKeys: []
1369
+ };
1370
+ const g = F(Object.values(k), "index"), I = g.filter(({ data: h }) => h.key && Le(k, h.id)), b = g.filter(({ data: h }) => h.key), d = b.map(({ data: h }) => h.key);
1371
+ return {
1372
+ canUseProperties: b,
1373
+ visibleProperties: I,
1374
+ canUsePropertiesKeys: d
1375
+ };
1376
+ }, [JSON.stringify(k)]), o = p(), s = Qt(o, "key");
1377
+ return /* @__PURE__ */ e(be, { children: /* @__PURE__ */ w(D, { gap: 2, children: [
1378
+ /* @__PURE__ */ e(V, { variant: "subtitle1", children: a("maker.properties.parameters") }),
1379
+ !t || x.canUsePropertiesKeys.length === 0 ? /* @__PURE__ */ e(he, { style: { fontSize: 12 }, children: a("maker.properties.noParameters") }) : /* @__PURE__ */ w(U, { children: [
1380
+ /* @__PURE__ */ e(D, { gap: 2, children: x.visibleProperties.map(({ data: g }) => {
1381
+ var I, b;
1382
+ return /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
1383
+ W,
1384
+ {
1385
+ allComponents: r,
1386
+ defaultLocale: i,
1387
+ size: "small",
1388
+ fullWidth: !0,
1389
+ component: t,
1390
+ property: g,
1391
+ valueImmutable: L((I = n == null ? void 0 : n[g.id]) == null ? void 0 : I.value),
1392
+ value: (c == null ? void 0 : c[g.key || g.id]) ?? ((b = o[g.id]) == null ? void 0 : b.value),
1393
+ onChange: (d) => {
1394
+ v({
1395
+ path: ["properties", g.id],
1396
+ value: { value: d },
1397
+ shouldSync: !(!g.type || Ae.includes(g.type)),
1316
1398
  excludeKeys: [],
1317
- key: d.key || d.id
1318
- }) : (console.warn("property not found: ", o), Bt.warning(u("maker.properties.propertyNotFound", { key: o })));
1319
- });
1399
+ key: g.key || g.id
1400
+ });
1401
+ }
1402
+ }
1403
+ ) }, g.id);
1404
+ }) }),
1405
+ /* @__PURE__ */ e(D, { gap: 2, sx: { width: "100%" }, children: /* @__PURE__ */ e(
1406
+ Me,
1407
+ {
1408
+ componentId: (t == null ? void 0 : t.id) || "",
1409
+ renderType: "setting",
1410
+ locale: u,
1411
+ properties: o,
1412
+ dev: { mode: "draft", components: r, defaultLocale: i },
1413
+ props: {
1414
+ ...Xt(c ?? {}, x.canUsePropertiesKeys),
1415
+ onChange: (g) => {
1416
+ const { canUsePropertiesKeys: I } = x;
1417
+ Object.keys(g).filter((d) => {
1418
+ var h;
1419
+ return g[d] !== ((h = s == null ? void 0 : s[d]) == null ? void 0 : h.value);
1420
+ }).filter((d) => !(d === "locale" && !qt(s[d], "locale"))).reduce((d, h) => d.then(() => {
1421
+ const m = s[h], S = I.includes(h);
1422
+ if (m != null && m.id && S)
1423
+ return v({
1424
+ path: ["properties", m.id],
1425
+ value: { value: g[h] },
1426
+ shouldSync: !(!m.type || Ae.includes(m.type)),
1427
+ excludeKeys: [],
1428
+ key: m.key || m.id
1429
+ }), Promise.resolve();
1430
+ const C = `propertyNotFound${h}`;
1431
+ if (y === C)
1432
+ return Promise.resolve();
1433
+ je.close(y);
1434
+ const z = je.warning(
1435
+ a("maker.properties.propertyNotFound", {
1436
+ key: h
1437
+ }),
1438
+ {
1439
+ key: C
1440
+ }
1441
+ );
1442
+ return f(z), Promise.resolve();
1443
+ }), Promise.resolve());
1444
+ }
1320
1445
  }
1321
1446
  }
1322
- }
1323
- ) })
1324
- ] });
1447
+ ) })
1448
+ ] })
1449
+ ] }) });
1325
1450
  }
1326
1451
  export {
1327
- nr as BasicInfo,
1328
- me as CustomComponentAutocomplete,
1329
- Jr as CustomComponentSettings,
1330
- ar as DefaultReactComponentScriptTemplate,
1331
- ur as DefaultWebComponentScriptTemplate,
1332
- hr as ParametersConfig,
1333
- or as PropertiesConfig,
1452
+ pr as BasicInfo,
1453
+ ye as CustomComponentAutocomplete,
1454
+ Zr as CustomComponentSettings,
1455
+ yr as DefaultReactComponentScriptTemplate,
1456
+ vr as DefaultWebComponentScriptTemplate,
1457
+ kr as ParametersConfig,
1458
+ mr as PropertiesConfig,
1334
1459
  W as PropertyValueField
1335
1460
  };