@firecms/collection_editor 3.0.0-alpha.51 → 3.0.0-alpha.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,9 +1,9 @@
1
- import { jsxs as n, Fragment as M, jsx as e } from "react/jsx-runtime";
2
- import * as we from "react";
3
- import L, { useState as $, useEffect as pe, useMemo as Kt, useCallback as X, useRef as He, useDeferredValue as ba, useContext as Yt } from "react";
4
- import { iconKeys as Gt, debounce as ya, SearchBar as va, Tooltip as re, IconButton as ne, Icon as lt, coolIconKeys as xt, Typography as C, getIconForView as ct, useAutoComplete as wa, Container as ht, Chip as dt, TextField as Te, cn as ke, DebouncedTextField as H, Autocomplete as _a, AutocompleteItem as ka, ExpandablePanel as Ot, SettingsIcon as Qe, Select as Se, SelectItem as ee, BooleanSwitchWithLabel as Ht, Dialog as Ee, toSnakeCase as Ct, singular as xa, ListIcon as Ca, Button as B, CircularProgress as We, AutoAwesomeIcon as gt, Paper as qe, FormikArrayContainer as Oa, DialogContent as $e, DialogActions as Le, SwitchControl as he, serializeRegExp as Pa, isValidRegExp as Na, RuleIcon as Sa, useSnackbarController as De, resolveEnumValues as qa, FileUploadIcon as Aa, MultiSelect as za, MultiSelectItem as zt, Checkbox as Tt, isPropertyBuilder as oe, useFireCMSContext as Ke, getFieldConfig as Ze, ErrorBoundary as Pe, FieldConfigBadge as Xe, cardMixin as Jt, cardClickableMixin as Qt, cardSelectedMixin as Wt, FunctionsIcon as Ta, RemoveCircleIcon as Va, defaultBorderMixin as Pt, RemoveIcon as Ia, DragHandleIcon as Fa, AddIcon as Ae, useNavigationController as Be, SelectGroup as Vt, mergeDeep as Y, DEFAULT_FIELD_CONFIGS as Zt, getFieldId as Xt, InfoLabel as ea, DeleteIcon as pt, DeleteConfirmationDialog as mt, ContentCopyIcon as ja, useLargeLayout as Ea, CodeIcon as Da, makePropertiesEditable as et, resolveEntityView as Ba, Table as It, TableBody as Ft, TableRow as wt, TableCell as Ge, unslugify as Nt, Card as ta, useSelectionController as Ma, EntityCollectionTable as Ra, slugify as Ua, useAuthController as Ye, randomString as jt, CircularProgressCenter as Et, Tabs as $a, Tab as _t, removeUndefined as La, ErrorView as aa, ArrowBackIcon as rt, LoadingButton as Dt, DoneIcon as Ka, SaveIcon as Ya, Menu as Ga, MoreVertIcon as Ha, MenuItem as Ja, Collapse as Qa, getDefaultPropertiesOrder as Wa, joinCollectionLists as Za } from "@firecms/core";
1
+ import { jsxs as n, Fragment as U, jsx as e } from "react/jsx-runtime";
2
+ import * as _e from "react";
3
+ import K, { useState as L, useEffect as pe, useMemo as Kt, useCallback as Q, useRef as He, useDeferredValue as ba, useContext as Yt } from "react";
4
+ import { iconKeys as Gt, debounce as ya, SearchBar as va, Tooltip as re, IconButton as ne, Icon as lt, coolIconKeys as xt, Typography as C, getIconForView as ct, useAutoComplete as wa, Container as ht, Chip as dt, TextField as Te, cn as xe, DebouncedTextField as W, Autocomplete as _a, AutocompleteItem as ka, ExpandablePanel as Ot, SettingsIcon as Je, Select as Se, SelectItem as ee, BooleanSwitchWithLabel as Ht, Dialog as Ee, toSnakeCase as Ct, singular as xa, ListIcon as Ca, Button as R, CircularProgress as Qe, AutoAwesomeIcon as gt, Paper as qe, FormikArrayContainer as Oa, DialogContent as $e, DialogActions as Le, SwitchControl as he, serializeRegExp as Na, isValidRegExp as Pa, RuleIcon as Sa, useSnackbarController as De, resolveEnumValues as qa, FileUploadIcon as Aa, MultiSelect as za, MultiSelectItem as zt, Checkbox as Tt, isPropertyBuilder as oe, useFireCMSContext as Ke, getFieldConfig as Ze, ErrorBoundary as Ne, FieldConfigBadge as Xe, cardMixin as Wt, cardClickableMixin as Jt, cardSelectedMixin as Qt, FunctionsIcon as Ta, RemoveCircleIcon as Va, defaultBorderMixin as Nt, RemoveIcon as Ia, DragHandleIcon as Fa, AddIcon as Ae, useNavigationController as Be, SelectGroup as Vt, mergeDeep as G, DEFAULT_FIELD_CONFIGS as Zt, getFieldId as Xt, InfoLabel as ea, DeleteIcon as pt, DeleteConfirmationDialog as mt, ContentCopyIcon as ja, useLargeLayout as Ea, CodeIcon as Da, makePropertiesEditable as et, resolveEntityView as Ba, Table as It, TableBody as Ft, TableRow as wt, TableCell as Ge, unslugify as Pt, Card as ta, useSelectionController as Ma, EntityCollectionTable as Ra, slugify as Ua, useAuthController as Ye, randomString as jt, CircularProgressCenter as Et, Tabs as $a, Tab as _t, removeUndefined as La, ErrorView as aa, ArrowBackIcon as rt, LoadingButton as Dt, DoneIcon as Ka, SaveIcon as Ya, Menu as Ga, MoreVertIcon as Ha, MenuItem as Wa, Collapse as Ja, getDefaultPropertiesOrder as Qa, joinCollectionLists as Za } from "@firecms/core";
5
5
  import ut from "react-fast-compare";
6
- import { useFormikContext as K, Field as be, getIn as P, Formik as St, FastField as de, Form as Xa } from "formik";
6
+ import { useFormikContext as Y, Field as be, getIn as N, Formik as St, FastField as de, Form as Xa } from "formik";
7
7
  import * as ot from "yup";
8
8
  import * as ei from "js-search";
9
9
  import { extractEnumFromValues as ti, buildPropertyFromData as ai, buildEntityPropertiesFromData as ii } from "@firecms/schema_inference";
@@ -1977,20 +1977,20 @@ process.env.NODE_ENV !== "production" && Object.keys(ra).forEach((t) => {
1977
1977
  Gt.includes(t) || console.warn(`The icon ${t} no longer exists. Remove it from \`synonyms\``);
1978
1978
  });
1979
1979
  function wi({ selectedIcon: t = "", onIconSelected: a }) {
1980
- const [i, r] = we.useState(null), [s, o] = we.useState(""), l = we.useMemo(
1980
+ const [i, r] = _e.useState(null), [s, o] = _e.useState(""), l = _e.useMemo(
1981
1981
  () => ya((m) => {
1982
1982
  if (!m || m === "")
1983
1983
  r(null);
1984
1984
  else {
1985
1985
  const u = qt.search(m);
1986
- r(u.map((c) => c.key));
1986
+ r(u.map((d) => d.key));
1987
1987
  }
1988
1988
  }, vi),
1989
1989
  []
1990
1990
  );
1991
- return we.useEffect(() => (l(s), () => {
1991
+ return _e.useEffect(() => (l(s), () => {
1992
1992
  l.clear();
1993
- }), [s, l]), /* @__PURE__ */ n(M, { children: [
1993
+ }), [s, l]), /* @__PURE__ */ n(U, { children: [
1994
1994
  /* @__PURE__ */ e(
1995
1995
  va,
1996
1996
  {
@@ -2026,29 +2026,29 @@ function _i({
2026
2026
  groups: s,
2027
2027
  parentCollection: o
2028
2028
  }) {
2029
- const l = L.useRef(null), {
2029
+ const l = K.useRef(null), {
2030
2030
  values: p,
2031
2031
  setFieldValue: m,
2032
2032
  handleChange: u,
2033
- touched: c,
2034
- errors: d,
2035
- setFieldTouched: f,
2036
- isSubmitting: g,
2033
+ touched: d,
2034
+ errors: c,
2035
+ setFieldTouched: y,
2036
+ isSubmitting: f,
2037
2037
  submitCount: b
2038
- } = K(), [O, k] = $(!1), [x, h] = $(!1), _ = (v) => {
2039
- m("name", v), !P(c, "path") && t && v && m("path", Ct(v)), !P(c, "id") && t && v && m("id", Ct(v)), !P(c, "singularName") && t && v && m("singularName", xa(v));
2038
+ } = Y(), [P, w] = L(!1), [k, g] = L(!1), v = (S) => {
2039
+ m("name", S), !N(d, "path") && t && S && m("path", Ct(S)), !N(d, "id") && t && S && m("id", Ct(S)), !N(d, "singularName") && t && S && m("singularName", xa(S));
2040
2040
  };
2041
2041
  pe(() => {
2042
- d.id && h(!0);
2043
- }, [d.id]);
2044
- const y = ct(p), w = s?.filter((v) => !a?.includes(v)), {
2045
- inputFocused: q,
2046
- autoCompleteOpen: F,
2047
- setAutoCompleteOpen: A
2042
+ c.id && g(!0);
2043
+ }, [c.id]);
2044
+ const _ = ct(p), h = s?.filter((S) => !a?.includes(S)), {
2045
+ inputFocused: A,
2046
+ autoCompleteOpen: E,
2047
+ setAutoCompleteOpen: z
2048
2048
  } = wa({
2049
2049
  ref: l
2050
- }), S = !!o;
2051
- let E;
2050
+ }), q = !!o;
2051
+ let B;
2052
2052
  return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ n(ht, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
2053
2053
  /* @__PURE__ */ n("div", { children: [
2054
2054
  /* @__PURE__ */ n(
@@ -2061,8 +2061,8 @@ function _i({
2061
2061
  ne,
2062
2062
  {
2063
2063
  shape: "square",
2064
- onClick: () => k(!0),
2065
- children: y
2064
+ onClick: () => w(!0),
2065
+ children: _
2066
2066
  }
2067
2067
  ) })
2068
2068
  ]
@@ -2079,37 +2079,37 @@ function _i({
2079
2079
  Te,
2080
2080
  {
2081
2081
  value: p.name ?? "",
2082
- onChange: (v) => _(v.target.value),
2082
+ onChange: (S) => v(S.target.value),
2083
2083
  label: "Name",
2084
2084
  required: !0,
2085
- error: c.name && !!d.name
2085
+ error: d.name && !!c.name
2086
2086
  }
2087
2087
  ),
2088
- /* @__PURE__ */ e(ie, { error: c.name && !!d.name, children: c.name && d.name ? d.name : "Name of in this collection, usually a plural name (e.g. Products)" })
2088
+ /* @__PURE__ */ e(ie, { error: d.name && !!c.name, children: d.name && c.name ? c.name : "Name of in this collection, usually a plural name (e.g. Products)" })
2089
2089
  ] }),
2090
- /* @__PURE__ */ n("div", { className: ke("col-span-12 ", S ? "" : "sm:col-span-8"), children: [
2090
+ /* @__PURE__ */ n("div", { className: xe("col-span-12 ", q ? "" : "sm:col-span-8"), children: [
2091
2091
  /* @__PURE__ */ e(
2092
2092
  be,
2093
2093
  {
2094
2094
  name: "path",
2095
- as: H,
2095
+ as: W,
2096
2096
  label: "Path",
2097
2097
  disabled: !t,
2098
2098
  required: !0,
2099
- error: c.path && !!d.path
2099
+ error: d.path && !!c.path
2100
2100
  }
2101
2101
  ),
2102
- /* @__PURE__ */ e(ie, { error: c.path && !!d.path, children: c.path && d.path ? d.path : "Path that this collection is stored in, in the database" })
2102
+ /* @__PURE__ */ e(ie, { error: d.path && !!c.path, children: d.path && c.path ? c.path : "Path that this collection is stored in, in the database" })
2103
2103
  ] }),
2104
- !S && /* @__PURE__ */ n("div", { className: "col-span-12 sm:col-span-4 relative", children: [
2104
+ !q && /* @__PURE__ */ n("div", { className: "col-span-12 sm:col-span-4 relative", children: [
2105
2105
  /* @__PURE__ */ e(
2106
2106
  Te,
2107
2107
  {
2108
- error: c.group && !!d.group,
2109
- disabled: g,
2108
+ error: d.group && !!c.group,
2109
+ disabled: f,
2110
2110
  value: p.group ?? "",
2111
2111
  autoComplete: "off",
2112
- onChange: (v) => m("group", v.target.value),
2112
+ onChange: (S) => m("group", S.target.value),
2113
2113
  name: "group",
2114
2114
  inputRef: l,
2115
2115
  label: "Group"
@@ -2118,29 +2118,29 @@ function _i({
2118
2118
  /* @__PURE__ */ e(
2119
2119
  _a,
2120
2120
  {
2121
- open: F && (w ?? []).length > 0,
2122
- setOpen: A,
2123
- children: w?.map((v, V) => /* @__PURE__ */ e(
2121
+ open: E && (h ?? []).length > 0,
2122
+ setOpen: z,
2123
+ children: h?.map((S, O) => /* @__PURE__ */ e(
2124
2124
  ka,
2125
2125
  {
2126
2126
  onClick: () => {
2127
- A(!1), m("group", v ?? null);
2127
+ z(!1), m("group", S ?? null);
2128
2128
  },
2129
- children: /* @__PURE__ */ e("div", { className: "flex-grow", children: v })
2129
+ children: /* @__PURE__ */ e("div", { className: "flex-grow", children: S })
2130
2130
  },
2131
- V + "_" + v
2131
+ O + "_" + S
2132
2132
  ))
2133
2133
  }
2134
2134
  ),
2135
- /* @__PURE__ */ e(ie, { children: c.group && d.group ? d.group : "Group of the collection" })
2135
+ /* @__PURE__ */ e(ie, { children: d.group && c.group ? c.group : "Group of the collection" })
2136
2136
  ] }),
2137
2137
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2138
2138
  Ot,
2139
2139
  {
2140
- expanded: x,
2141
- onExpandedChange: h,
2140
+ expanded: k,
2141
+ onExpandedChange: g,
2142
2142
  title: /* @__PURE__ */ n("div", { className: "flex flex-row text-gray-500", children: [
2143
- /* @__PURE__ */ e(Qe, {}),
2143
+ /* @__PURE__ */ e(Je, {}),
2144
2144
  /* @__PURE__ */ e(
2145
2145
  C,
2146
2146
  {
@@ -2156,21 +2156,21 @@ function _i({
2156
2156
  /* @__PURE__ */ e(
2157
2157
  Te,
2158
2158
  {
2159
- error: c.singularName && !!d.singularName,
2159
+ error: d.singularName && !!c.singularName,
2160
2160
  id: "singularName",
2161
2161
  "aria-describedby": "singularName-helper",
2162
- onChange: (v) => (f("singularName", !0), u(v)),
2162
+ onChange: (S) => (y("singularName", !0), u(S)),
2163
2163
  value: p.singularName ?? "",
2164
2164
  label: "Singular name"
2165
2165
  }
2166
2166
  ),
2167
- /* @__PURE__ */ e(ie, { error: c.singularName && !!d.singularName, children: c.singularName && d.singularName ? d.singularName : "Optionally define a singular name for your entities" })
2167
+ /* @__PURE__ */ e(ie, { error: d.singularName && !!c.singularName, children: d.singularName && c.singularName ? c.singularName : "Optionally define a singular name for your entities" })
2168
2168
  ] }),
2169
2169
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
2170
2170
  /* @__PURE__ */ e(
2171
2171
  Te,
2172
2172
  {
2173
- error: c.description && !!d.description,
2173
+ error: d.description && !!c.description,
2174
2174
  id: "description",
2175
2175
  value: p.description ?? "",
2176
2176
  onChange: u,
@@ -2180,20 +2180,20 @@ function _i({
2180
2180
  label: "Description"
2181
2181
  }
2182
2182
  ),
2183
- /* @__PURE__ */ e(ie, { error: c.description && !!d.description, children: c.description && d.description ? d.description : "Description of the collection, you can use markdown" })
2183
+ /* @__PURE__ */ e(ie, { error: d.description && !!c.description, children: d.description && c.description ? c.description : "Description of the collection, you can use markdown" })
2184
2184
  ] }),
2185
2185
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
2186
2186
  /* @__PURE__ */ e(
2187
2187
  be,
2188
2188
  {
2189
2189
  name: "id",
2190
- as: H,
2190
+ as: W,
2191
2191
  disabled: !t,
2192
2192
  label: "Collection id",
2193
- error: c.id && !!d.id
2193
+ error: d.id && !!c.id
2194
2194
  }
2195
2195
  ),
2196
- /* @__PURE__ */ e(ie, { error: c.id && !!d.id, children: c.id && d.id ? d.id : "This id identifies this collection" })
2196
+ /* @__PURE__ */ e(ie, { error: d.id && !!c.id, children: d.id && c.id ? c.id : "This id identifies this collection" })
2197
2197
  ] }),
2198
2198
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2199
2199
  Se,
@@ -2203,14 +2203,14 @@ function _i({
2203
2203
  position: "item-aligned",
2204
2204
  onChange: u,
2205
2205
  value: p.defaultSize ?? "",
2206
- renderValue: (v) => v.toUpperCase(),
2207
- children: ["xs", "s", "m", "l", "xl"].map((v) => /* @__PURE__ */ e(
2206
+ renderValue: (S) => S.toUpperCase(),
2207
+ children: ["xs", "s", "m", "l", "xl"].map((S) => /* @__PURE__ */ e(
2208
2208
  ee,
2209
2209
  {
2210
- value: v,
2211
- children: v.toUpperCase()
2210
+ value: S,
2211
+ children: S.toUpperCase()
2212
2212
  },
2213
- `size-select-${v}`
2213
+ `size-select-${S}`
2214
2214
  ))
2215
2215
  }
2216
2216
  ) }),
@@ -2220,14 +2220,14 @@ function _i({
2220
2220
  name: "customId",
2221
2221
  label: "Data IDs generation",
2222
2222
  position: "item-aligned",
2223
- disabled: E === "code_defined",
2224
- onValueChange: (v) => {
2225
- if (v === "code_defined")
2223
+ disabled: B === "code_defined",
2224
+ onValueChange: (S) => {
2225
+ if (S === "code_defined")
2226
2226
  throw new Error("This should not happen");
2227
- v === "true" ? m("customId", !0) : v === "false" ? m("customId", !1) : v === "optional" && m("customId", "optional");
2227
+ S === "true" ? m("customId", !0) : S === "false" ? m("customId", !1) : S === "optional" && m("customId", "optional");
2228
2228
  },
2229
2229
  value: "",
2230
- renderValue: (v) => v === "code_defined" ? "Code defined" : v === "true" ? "Users must define an ID" : v === "optional" ? "Users can define an ID, but it is not required" : "Document ID is generated automatically",
2230
+ renderValue: (S) => S === "code_defined" ? "Code defined" : S === "true" ? "Users must define an ID" : S === "optional" ? "Users can define an ID, but it is not required" : "Document ID is generated automatically",
2231
2231
  children: [
2232
2232
  /* @__PURE__ */ e(ee, { value: "false", children: "Document ID is generated automatically" }),
2233
2233
  /* @__PURE__ */ e(ee, { value: "true", children: "Users must define an ID" }),
@@ -2241,7 +2241,7 @@ function _i({
2241
2241
  {
2242
2242
  position: "start",
2243
2243
  label: "Collection group",
2244
- onValueChange: (v) => m("collectionGroup", v),
2244
+ onValueChange: (S) => m("collectionGroup", S),
2245
2245
  value: p.collectionGroup ?? !1
2246
2246
  }
2247
2247
  ),
@@ -2255,16 +2255,16 @@ function _i({
2255
2255
  /* @__PURE__ */ e(
2256
2256
  Ee,
2257
2257
  {
2258
- open: O,
2259
- onOpenChange: k,
2258
+ open: P,
2259
+ onOpenChange: w,
2260
2260
  maxWidth: "xl",
2261
2261
  fullWidth: !0,
2262
2262
  children: /* @__PURE__ */ e("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ e(
2263
2263
  wi,
2264
2264
  {
2265
2265
  selectedIcon: p.icon,
2266
- onIconSelected: (v) => {
2267
- k(!1), m("icon", v);
2266
+ onIconSelected: (S) => {
2267
+ w(!1), m("icon", S);
2268
2268
  }
2269
2269
  }
2270
2270
  ) })
@@ -2272,19 +2272,19 @@ function _i({
2272
2272
  )
2273
2273
  ] }) });
2274
2274
  }
2275
- function _e(t) {
2275
+ function ke(t) {
2276
2276
  return "properties." + t.replaceAll(".", ".properties.");
2277
2277
  }
2278
2278
  function ki(t) {
2279
2279
  return t ? "properties." + t.replaceAll(".", ".properties.") + ".properties" : "properties";
2280
2280
  }
2281
- function Ne(t) {
2281
+ function Pe(t) {
2282
2282
  return t ? "properties." + t.replaceAll(".", ".properties.") + ".propertiesOrder" : "propertiesOrder";
2283
2283
  }
2284
2284
  function ce(t, a) {
2285
2285
  return a ? `${a}.${t}` : t;
2286
2286
  }
2287
- const xi = L.memo(
2287
+ const xi = K.memo(
2288
2288
  function({
2289
2289
  enumValues: a,
2290
2290
  onValuesChanged: i,
@@ -2338,20 +2338,20 @@ function Ci({
2338
2338
  }) {
2339
2339
  const {
2340
2340
  setFieldValue: p
2341
- } = K(), [m, u] = L.useState(), [c, d] = L.useState(), [f, g] = L.useState(!1), O = L.useRef(/* @__PURE__ */ new Set()).current, k = (h, _) => {
2342
- const y = m === _;
2341
+ } = Y(), [m, u] = K.useState(), [d, c] = K.useState(), [y, f] = K.useState(!1), P = K.useRef(/* @__PURE__ */ new Set()).current, w = (g, v) => {
2342
+ const _ = m === v;
2343
2343
  return /* @__PURE__ */ e(
2344
2344
  Oi,
2345
2345
  {
2346
- index: h,
2346
+ index: g,
2347
2347
  disabled: i,
2348
2348
  enumValuesPath: r,
2349
- autoFocus: y,
2350
- shouldUpdateId: s || y,
2351
- onDialogOpen: () => d(h),
2352
- inferredEntry: O.has(t.enumValues[h]?.id)
2349
+ autoFocus: _,
2350
+ shouldUpdateId: s || _,
2351
+ onDialogOpen: () => c(g),
2352
+ inferredEntry: P.has(t.enumValues[g]?.id)
2353
2353
  },
2354
- `${_}`
2354
+ `${v}`
2355
2355
  );
2356
2356
  };
2357
2357
  return /* @__PURE__ */ n("div", { className: "col-span-12", children: [
@@ -2366,26 +2366,26 @@ function Ci({
2366
2366
  }
2367
2367
  ),
2368
2368
  o && /* @__PURE__ */ n(
2369
- B,
2369
+ R,
2370
2370
  {
2371
- loading: f,
2372
- disabled: i || f,
2371
+ loading: y,
2372
+ disabled: i || y,
2373
2373
  variant: "text",
2374
2374
  size: "small",
2375
2375
  onClick: async () => {
2376
- l && (g(!0), l?.().then((h) => {
2377
- if (!h)
2376
+ l && (f(!0), l?.().then((g) => {
2377
+ if (!g)
2378
2378
  return;
2379
- const _ = h.flat(), y = Array.from(new Set(_)), w = t.enumValues, F = ti(y).filter((A) => !w?.some((S) => S.id === A.id));
2380
- F.forEach((A) => {
2381
- O.add(A.id);
2382
- }), p(r, [...F, ...w]);
2383
- }).catch((h) => {
2384
- console.error(h);
2385
- }).finally(() => g(!1)));
2379
+ const v = g.flat(), _ = Array.from(new Set(v)), h = t.enumValues, E = ti(_).filter((z) => !h?.some((q) => q.id === z.id));
2380
+ E.forEach((z) => {
2381
+ P.add(z.id);
2382
+ }), p(r, [...E, ...h]);
2383
+ }).catch((g) => {
2384
+ console.error(g);
2385
+ }).finally(() => f(!1)));
2386
2386
  },
2387
2387
  children: [
2388
- f ? /* @__PURE__ */ e(We, { size: "small" }) : /* @__PURE__ */ e(gt, {}),
2388
+ y ? /* @__PURE__ */ e(Qe, { size: "small" }) : /* @__PURE__ */ e(gt, {}),
2389
2389
  "Infer values from data"
2390
2390
  ]
2391
2391
  }
@@ -2398,7 +2398,7 @@ function Ci({
2398
2398
  value: t.enumValues,
2399
2399
  addLabel: "Add enum value",
2400
2400
  name: r,
2401
- buildEntry: k,
2401
+ buildEntry: w,
2402
2402
  disabled: i,
2403
2403
  onInternalIdAdded: u,
2404
2404
  small: !0,
@@ -2407,18 +2407,18 @@ function Ci({
2407
2407
  }
2408
2408
  ),
2409
2409
  /* @__PURE__ */ e(
2410
- Pi,
2410
+ Ni,
2411
2411
  {
2412
- index: c,
2413
- open: c !== void 0,
2412
+ index: d,
2413
+ open: d !== void 0,
2414
2414
  enumValuesPath: r,
2415
- onClose: () => d(void 0)
2415
+ onClose: () => c(void 0)
2416
2416
  }
2417
2417
  )
2418
2418
  ] })
2419
2419
  ] });
2420
2420
  }
2421
- const Oi = L.memo(
2421
+ const Oi = K.memo(
2422
2422
  function({
2423
2423
  index: a,
2424
2424
  shouldUpdateId: i,
@@ -2431,27 +2431,27 @@ const Oi = L.memo(
2431
2431
  const {
2432
2432
  values: m,
2433
2433
  handleChange: u,
2434
- errors: c,
2435
- setFieldValue: d,
2436
- touched: f
2437
- } = K(), g = L.useRef(!P(m, `${r}[${a}].id`)), b = i || g.current, O = P(m, `${r}[${a}].id`), k = P(m, `${r}[${a}].label`), x = P(c, `${r}[${a}].label`), h = L.useRef(k);
2438
- return L.useEffect(() => {
2439
- (h.current === O || !O) && b && d(`${r}[${a}].id`, k), h.current = k;
2440
- }, [k]), /* @__PURE__ */ n("div", { className: "flex w-full align-center justify-center", children: [
2434
+ errors: d,
2435
+ setFieldValue: c,
2436
+ touched: y
2437
+ } = Y(), f = K.useRef(!N(m, `${r}[${a}].id`)), b = i || f.current, P = N(m, `${r}[${a}].id`), w = N(m, `${r}[${a}].label`), k = N(d, `${r}[${a}].label`), g = K.useRef(w);
2438
+ return K.useEffect(() => {
2439
+ (g.current === P || !P) && b && c(`${r}[${a}].id`, w), g.current = w;
2440
+ }, [w]), /* @__PURE__ */ n("div", { className: "flex w-full align-center justify-center", children: [
2441
2441
  /* @__PURE__ */ e(
2442
2442
  de,
2443
2443
  {
2444
2444
  name: `${r}[${a}].label`,
2445
- as: H,
2445
+ as: W,
2446
2446
  className: "flex-grow",
2447
2447
  required: !0,
2448
2448
  disabled: l,
2449
2449
  size: "small",
2450
- validate: Ni,
2450
+ validate: Pi,
2451
2451
  autoFocus: s,
2452
2452
  autoComplete: "off",
2453
2453
  endAdornment: p && /* @__PURE__ */ e(gt, { size: "small" }),
2454
- error: !!x
2454
+ error: !!k
2455
2455
  }
2456
2456
  ),
2457
2457
  !l && /* @__PURE__ */ e(
@@ -2461,7 +2461,7 @@ const Oi = L.memo(
2461
2461
  "aria-label": "edit",
2462
2462
  className: "m-1",
2463
2463
  onClick: () => o(),
2464
- children: /* @__PURE__ */ e(Qe, { size: "small" })
2464
+ children: /* @__PURE__ */ e(Je, { size: "small" })
2465
2465
  }
2466
2466
  )
2467
2467
  ] });
@@ -2470,7 +2470,7 @@ const Oi = L.memo(
2470
2470
  return a.index === i.index && a.enumValuesPath === i.enumValuesPath && a.shouldUpdateId === i.shouldUpdateId && a.inferredEntry === i.inferredEntry && a.autoFocus === i.autoFocus;
2471
2471
  }
2472
2472
  );
2473
- function Pi({
2473
+ function Ni({
2474
2474
  index: t,
2475
2475
  open: a,
2476
2476
  onClose: i,
@@ -2482,21 +2482,21 @@ function Pi({
2482
2482
  errors: l,
2483
2483
  setFieldValue: p,
2484
2484
  touched: m
2485
- } = K(), u = t !== void 0 ? P(l, `${r}[${t}].id`) : void 0;
2485
+ } = Y(), u = t !== void 0 ? N(l, `${r}[${t}].id`) : void 0;
2486
2486
  return /* @__PURE__ */ n(
2487
2487
  Ee,
2488
2488
  {
2489
2489
  maxWidth: "md",
2490
2490
  "aria-labelledby": "enum-edit-dialog",
2491
2491
  open: a,
2492
- onOpenChange: (c) => c ? void 0 : i(),
2492
+ onOpenChange: (d) => d ? void 0 : i(),
2493
2493
  children: [
2494
2494
  /* @__PURE__ */ e($e, { children: t !== void 0 && /* @__PURE__ */ n("div", { children: [
2495
2495
  /* @__PURE__ */ e(
2496
2496
  de,
2497
2497
  {
2498
2498
  name: `${r}[${t}]id`,
2499
- as: H,
2499
+ as: W,
2500
2500
  required: !0,
2501
2501
  validate: Si,
2502
2502
  label: "ID",
@@ -2508,7 +2508,7 @@ function Pi({
2508
2508
  /* @__PURE__ */ e(ie, { error: !!u, children: u ?? "Value saved in the data source" })
2509
2509
  ] }) }),
2510
2510
  /* @__PURE__ */ e(Le, { children: /* @__PURE__ */ e(
2511
- B,
2511
+ R,
2512
2512
  {
2513
2513
  autoFocus: !0,
2514
2514
  variant: "outlined",
@@ -2521,7 +2521,7 @@ function Pi({
2521
2521
  }
2522
2522
  );
2523
2523
  }
2524
- function Ni(t) {
2524
+ function Pi(t) {
2525
2525
  let a;
2526
2526
  return t || (a = "You must specify a label"), a;
2527
2527
  }
@@ -2530,8 +2530,8 @@ function Si(t) {
2530
2530
  return t || (a = "You must specify an ID"), a;
2531
2531
  }
2532
2532
  function Me({ disabled: t }) {
2533
- const { values: a, handleChange: i } = K(), r = "validation.required", s = "validation.requiredMessage";
2534
- return /* @__PURE__ */ n(M, { children: [
2533
+ const { values: a, handleChange: i } = Y(), r = "validation.required", s = "validation.requiredMessage";
2534
+ return /* @__PURE__ */ n(U, { children: [
2535
2535
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
2536
2536
  de,
2537
2537
  {
@@ -2554,11 +2554,11 @@ function Me({ disabled: t }) {
2554
2554
  component: he
2555
2555
  }
2556
2556
  ) }),
2557
- P(a, r) && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2558
- H,
2557
+ N(a, r) && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2558
+ W,
2559
2559
  {
2560
2560
  disabled: t,
2561
- value: P(a, s),
2561
+ value: N(a, s),
2562
2562
  label: "Required message",
2563
2563
  name: s,
2564
2564
  size: "small",
@@ -2580,9 +2580,9 @@ function Ue({
2580
2580
  }) {
2581
2581
  const {
2582
2582
  values: u,
2583
- handleChange: c,
2584
- errors: d
2585
- } = K(), f = "validation.length", g = "validation.min", b = "validation.max", O = "validation.trim", k = "validation.matches", x = "validation.lowercase", h = "validation.uppercase", _ = P(d, k), y = P(u, k), w = typeof y == "string" ? y : Pa(y);
2583
+ handleChange: d,
2584
+ errors: c
2585
+ } = Y(), y = "validation.length", f = "validation.min", b = "validation.max", P = "validation.trim", w = "validation.matches", k = "validation.lowercase", g = "validation.uppercase", v = N(c, w), _ = N(u, w), h = typeof _ == "string" ? _ : Na(_);
2586
2586
  return /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
2587
2587
  /* @__PURE__ */ e(Me, { disabled: p }),
2588
2588
  /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
@@ -2590,7 +2590,7 @@ function Ue({
2590
2590
  de,
2591
2591
  {
2592
2592
  type: "checkbox",
2593
- name: x,
2593
+ name: k,
2594
2594
  label: "Lowercase",
2595
2595
  disabled: p,
2596
2596
  component: he
@@ -2600,7 +2600,7 @@ function Ue({
2600
2600
  de,
2601
2601
  {
2602
2602
  type: "checkbox",
2603
- name: h,
2603
+ name: g,
2604
2604
  label: "Uppercase",
2605
2605
  disabled: p,
2606
2606
  component: he
@@ -2610,7 +2610,7 @@ function Ue({
2610
2610
  de,
2611
2611
  {
2612
2612
  type: "checkbox",
2613
- name: O,
2613
+ name: P,
2614
2614
  label: "Trim",
2615
2615
  disabled: p,
2616
2616
  component: he
@@ -2619,39 +2619,39 @@ function Ue({
2619
2619
  ] }),
2620
2620
  /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
2621
2621
  t && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2622
- H,
2622
+ W,
2623
2623
  {
2624
- value: P(u, f),
2624
+ value: N(u, y),
2625
2625
  label: "Exact length",
2626
- name: f,
2626
+ name: y,
2627
2627
  type: "number",
2628
2628
  size: "small",
2629
2629
  disabled: p,
2630
- onChange: c
2630
+ onChange: d
2631
2631
  }
2632
2632
  ) }),
2633
2633
  s && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2634
- H,
2634
+ W,
2635
2635
  {
2636
- value: P(u, g),
2636
+ value: N(u, f),
2637
2637
  label: "Min length",
2638
- name: g,
2638
+ name: f,
2639
2639
  type: "number",
2640
2640
  size: "small",
2641
2641
  disabled: p,
2642
- onChange: c
2642
+ onChange: d
2643
2643
  }
2644
2644
  ) }),
2645
2645
  r && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2646
- H,
2646
+ W,
2647
2647
  {
2648
- value: P(u, b),
2648
+ value: N(u, b),
2649
2649
  label: "Max length",
2650
2650
  name: b,
2651
2651
  type: "number",
2652
2652
  size: "small",
2653
2653
  disabled: p,
2654
- onChange: c
2654
+ onChange: d
2655
2655
  }
2656
2656
  ) })
2657
2657
  ] }),
@@ -2659,17 +2659,17 @@ function Ue({
2659
2659
  /* @__PURE__ */ e(
2660
2660
  de,
2661
2661
  {
2662
- name: k,
2663
- as: H,
2664
- validate: (q) => q && !Na(q),
2662
+ name: w,
2663
+ as: W,
2664
+ validate: (A) => A && !Pa(A),
2665
2665
  label: "Matches regex",
2666
2666
  size: "small",
2667
2667
  disabled: p,
2668
- value: w,
2669
- error: !!_
2668
+ value: h,
2669
+ error: !!v
2670
2670
  }
2671
2671
  ),
2672
- /* @__PURE__ */ e(ie, { error: !!_, children: _ ? "Not a valid regexp" : "e.g. /^\\d+$/ for digits only" })
2672
+ /* @__PURE__ */ e(ie, { error: !!v, children: v ? "Not a valid regexp" : "e.g. /^\\d+$/ for digits only" })
2673
2673
  ] })
2674
2674
  ] });
2675
2675
  }
@@ -2681,13 +2681,13 @@ function At({
2681
2681
  const {
2682
2682
  values: r,
2683
2683
  handleChange: s
2684
- } = K(), o = "validation.min", l = "validation.max";
2684
+ } = Y(), o = "validation.min", l = "validation.max";
2685
2685
  return /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
2686
2686
  /* @__PURE__ */ e(Me, { disabled: i }),
2687
2687
  a && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
2688
- H,
2688
+ W,
2689
2689
  {
2690
- value: P(r, o),
2690
+ value: N(r, o),
2691
2691
  disabled: i,
2692
2692
  label: "Min length",
2693
2693
  name: o,
@@ -2697,9 +2697,9 @@ function At({
2697
2697
  }
2698
2698
  ) }),
2699
2699
  t && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
2700
- H,
2700
+ W,
2701
2701
  {
2702
- value: P(r, l),
2702
+ value: N(r, l),
2703
2703
  disabled: i,
2704
2704
  label: "Max length",
2705
2705
  name: l,
@@ -2747,25 +2747,25 @@ function Bt({
2747
2747
  handleChange: p,
2748
2748
  errors: m,
2749
2749
  touched: u,
2750
- setFieldError: c,
2751
- setFieldValue: d
2752
- } = K(), f = De(), g = t ? "of.enumValues" : "enumValues", b = P(l, "defaultValue"), O = P(l, g), k = Kt(() => !O || typeof O == "boolean" ? [] : qa(O) ?? [], [O]);
2753
- return /* @__PURE__ */ n(M, { children: [
2750
+ setFieldError: d,
2751
+ setFieldValue: c
2752
+ } = Y(), y = De(), f = t ? "of.enumValues" : "enumValues", b = N(l, "defaultValue"), P = N(l, f), w = Kt(() => !P || typeof P == "boolean" ? [] : qa(P) ?? [], [P]);
2753
+ return /* @__PURE__ */ n(U, { children: [
2754
2754
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2755
2755
  xi,
2756
2756
  {
2757
- enumValues: k,
2757
+ enumValues: w,
2758
2758
  updateIds: a,
2759
2759
  disabled: i,
2760
2760
  allowDataInference: s,
2761
- onError: (h) => {
2762
- c(g, h ? "" : void 0);
2761
+ onError: (g) => {
2762
+ d(f, g ? "" : void 0);
2763
2763
  },
2764
- getData: o ? () => o().then((h) => h.map((_) => l.id && P(_, l.id)).filter(Boolean)) : void 0,
2765
- onValuesChanged: (h) => {
2766
- if (l && (d(g, h), !t)) {
2767
- const _ = h.filter((y) => !!y?.id).map((y) => y.id);
2768
- b && !_.includes(b) && (d("defaultValue", void 0), f.open({
2764
+ getData: o ? () => o().then((g) => g.map((v) => l.id && N(v, l.id)).filter(Boolean)) : void 0,
2765
+ onValuesChanged: (g) => {
2766
+ if (l && (c(f, g), !t)) {
2767
+ const v = g.filter((_) => !!_?.id).map((_) => _.id);
2768
+ b && !v.includes(b) && (c("defaultValue", void 0), y.open({
2769
2769
  type: "warning",
2770
2770
  message: "Default value was cleared"
2771
2771
  }));
@@ -2788,18 +2788,18 @@ function Bt({
2788
2788
  {
2789
2789
  disabled: i,
2790
2790
  position: "item-aligned",
2791
- onValueChange: (h) => {
2792
- d("defaultValue", h);
2791
+ onValueChange: (g) => {
2792
+ c("defaultValue", g);
2793
2793
  },
2794
2794
  label: "Default value",
2795
2795
  value: b ?? "",
2796
- children: k.filter((h) => !!h?.id).map((h) => /* @__PURE__ */ e(
2796
+ children: w.filter((g) => !!g?.id).map((g) => /* @__PURE__ */ e(
2797
2797
  ee,
2798
2798
  {
2799
- value: h.id?.toString(),
2800
- children: h.label
2799
+ value: g.id?.toString(),
2800
+ children: g.label
2801
2801
  },
2802
- h.id
2802
+ g.id
2803
2803
  ))
2804
2804
  }
2805
2805
  ) })
@@ -2820,10 +2820,10 @@ function Mt({
2820
2820
  const {
2821
2821
  values: r,
2822
2822
  setFieldValue: s
2823
- } = K(), o = t ? "of.storage" : "storage", l = `${o}.acceptedFiles`, p = `${o}.fileName`, m = `${o}.storagePath`, u = `${o}.storeUrl`, c = P(r, p) ?? "{rand}_{file}", d = P(r, m) ?? "/", f = P(r, l), g = Array.isArray(f) ? f : void 0, b = !g || g.length === 0, O = (h) => {
2824
- h ? h.includes("all") || h.length >= Object.keys(nt).length ? s(l, void 0) : b ? s(l, Object.keys(nt).filter((_) => !h.includes(_))) : s(l, h) : s(l, void 0);
2825
- }, k = typeof c == "function", x = typeof d == "function";
2826
- return /* @__PURE__ */ n(M, { children: [
2823
+ } = Y(), o = t ? "of.storage" : "storage", l = `${o}.acceptedFiles`, p = `${o}.fileName`, m = `${o}.storagePath`, u = `${o}.storeUrl`, d = N(r, p) ?? "{rand}_{file}", c = N(r, m) ?? "/", y = N(r, l), f = Array.isArray(y) ? y : void 0, b = !f || f.length === 0, P = (g) => {
2824
+ g ? g.includes("all") || g.length >= Object.keys(nt).length ? s(l, void 0) : b ? s(l, Object.keys(nt).filter((v) => !g.includes(v))) : s(l, g) : s(l, void 0);
2825
+ }, w = typeof d == "function", k = typeof c == "function";
2826
+ return /* @__PURE__ */ n(U, { children: [
2827
2827
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2828
2828
  Ot,
2829
2829
  {
@@ -2844,38 +2844,38 @@ function Mt({
2844
2844
  {
2845
2845
  disabled: i,
2846
2846
  name: l,
2847
- value: g ?? [],
2848
- onMultiValueChange: O,
2847
+ value: f ?? [],
2848
+ onMultiValueChange: P,
2849
2849
  label: b ? void 0 : "Allowed file types",
2850
- renderValues: (h) => !h || h.length === 0 ? "All file types allowed" : h.map((_) => nt[_]).filter((_) => !!_).join(", "),
2850
+ renderValues: (g) => !g || g.length === 0 ? "All file types allowed" : g.map((v) => nt[v]).filter((v) => !!v).join(", "),
2851
2851
  children: [
2852
2852
  /* @__PURE__ */ n(zt, { value: "all", className: "flex items-center gap-2", children: [
2853
2853
  /* @__PURE__ */ e(
2854
2854
  Tt,
2855
2855
  {
2856
- checked: !g
2856
+ checked: !f
2857
2857
  }
2858
2858
  ),
2859
2859
  "All"
2860
2860
  ] }, "all"),
2861
- Object.entries(nt).map(([h, _]) => /* @__PURE__ */ n(zt, { value: h, className: "flex items-center gap-2", children: [
2861
+ Object.entries(nt).map(([g, v]) => /* @__PURE__ */ n(zt, { value: g, className: "flex items-center gap-2", children: [
2862
2862
  /* @__PURE__ */ e(
2863
2863
  Tt,
2864
2864
  {
2865
- checked: b || g.indexOf(h) > -1
2865
+ checked: b || f.indexOf(g) > -1
2866
2866
  }
2867
2867
  ),
2868
- /* @__PURE__ */ e("div", { className: "flex-grow", children: _ }),
2868
+ /* @__PURE__ */ e("div", { className: "flex-grow", children: v }),
2869
2869
  /* @__PURE__ */ e(
2870
- B,
2870
+ R,
2871
2871
  {
2872
2872
  size: "small",
2873
2873
  variant: "outlined",
2874
- onClick: (y) => (y.preventDefault(), y.stopPropagation(), s(l, [h])),
2874
+ onClick: (_) => (_.preventDefault(), _.stopPropagation(), s(l, [g])),
2875
2875
  children: "Only"
2876
2876
  }
2877
2877
  )
2878
- ] }, h))
2878
+ ] }, g))
2879
2879
  ]
2880
2880
  }
2881
2881
  ) }),
@@ -2883,11 +2883,11 @@ function Mt({
2883
2883
  be,
2884
2884
  {
2885
2885
  name: p,
2886
- as: H,
2886
+ as: W,
2887
2887
  label: "File name",
2888
2888
  size: "small",
2889
- disabled: k || i,
2890
- value: k ? "-" : c
2889
+ disabled: w || i,
2890
+ value: w ? "-" : d
2891
2891
  }
2892
2892
  ) }),
2893
2893
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
@@ -2895,11 +2895,11 @@ function Mt({
2895
2895
  be,
2896
2896
  {
2897
2897
  name: m,
2898
- as: H,
2898
+ as: W,
2899
2899
  label: "Storage path",
2900
- disabled: x || i,
2900
+ disabled: k || i,
2901
2901
  size: "small",
2902
- value: x ? "-" : d
2902
+ value: k ? "-" : c
2903
2903
  }
2904
2904
  ),
2905
2905
  /* @__PURE__ */ n(C, { variant: "caption", className: "ml-3.5 mt-1 mb-2", children: [
@@ -2936,7 +2936,7 @@ function Mt({
2936
2936
  ] }) })
2937
2937
  ] });
2938
2938
  }
2939
- function Je(t) {
2939
+ function We(t) {
2940
2940
  if (oe(t) || oe(t))
2941
2941
  return !1;
2942
2942
  {
@@ -2945,9 +2945,9 @@ function Je(t) {
2945
2945
  }
2946
2946
  }
2947
2947
  function qi(t) {
2948
- return Object.entries(t).filter(([a, i]) => Je(i)).map(([a, i]) => {
2948
+ return Object.entries(t).filter(([a, i]) => We(i)).map(([a, i]) => {
2949
2949
  const r = i;
2950
- if (Je(r))
2950
+ if (We(r))
2951
2951
  return r.dataType === "map" && r.properties ? {
2952
2952
  [a]: {
2953
2953
  ...r,
@@ -2965,7 +2965,7 @@ function oa({
2965
2965
  selected: o
2966
2966
  }) {
2967
2967
  const { propertyConfigs: l } = Ke(), p = Ze(t, l);
2968
- return Je(t), /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ n(
2968
+ return We(t), /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ n(
2969
2969
  "div",
2970
2970
  {
2971
2971
  onClick: a,
@@ -2975,17 +2975,17 @@ function oa({
2975
2975
  /* @__PURE__ */ n(
2976
2976
  qe,
2977
2977
  {
2978
- className: ke(
2978
+ className: xe(
2979
2979
  "pl-2 w-full flex flex-row gap-4 items-center",
2980
- Jt,
2981
- a ? Qt : "",
2982
- o ? Wt : "",
2980
+ Wt,
2981
+ a ? Jt : "",
2982
+ o ? Qt : "",
2983
2983
  "flex-grow p-4 border transition-colors duration-200",
2984
2984
  i ? "border-red-500" : o ? "border-blue-500" : "border-transparent"
2985
2985
  ),
2986
2986
  children: [
2987
2987
  /* @__PURE__ */ n("div", { className: "w-full flex flex-col", children: [
2988
- r && /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
2988
+ r && /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(
2989
2989
  C,
2990
2990
  {
2991
2991
  variant: "body1",
@@ -2995,7 +2995,7 @@ function oa({
2995
2995
  }
2996
2996
  ) }),
2997
2997
  /* @__PURE__ */ n("div", { className: "flex flex-row items-center", children: [
2998
- /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
2998
+ /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(
2999
2999
  C,
3000
3000
  {
3001
3001
  className: "flex-grow pr-2",
@@ -3005,7 +3005,7 @@ function oa({
3005
3005
  children: p?.name
3006
3006
  }
3007
3007
  ) }),
3008
- /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
3008
+ /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(
3009
3009
  C,
3010
3010
  {
3011
3011
  variant: "body2",
@@ -3051,11 +3051,11 @@ function Ai({
3051
3051
  /* @__PURE__ */ e(
3052
3052
  qe,
3053
3053
  {
3054
- className: ke(
3054
+ className: xe(
3055
3055
  "pl-2 w-full flex flex-row gap-4 items-center",
3056
- Jt,
3057
- i ? Qt : "",
3058
- a ? Wt : "",
3056
+ Wt,
3057
+ i ? Jt : "",
3058
+ a ? Qt : "",
3059
3059
  "flex-grow p-4 border transition-colors duration-200",
3060
3060
  a ? "border-blue-500" : "border-transparent"
3061
3061
  ),
@@ -3080,7 +3080,7 @@ function Ai({
3080
3080
  children: o?.name
3081
3081
  }
3082
3082
  ),
3083
- r && !oe(r) && /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
3083
+ r && !oe(r) && /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(
3084
3084
  C,
3085
3085
  {
3086
3086
  variant: "body2",
@@ -3089,7 +3089,7 @@ function Ai({
3089
3089
  children: r.dataType
3090
3090
  }
3091
3091
  ) }),
3092
- r && oe(r) && /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
3092
+ r && oe(r) && /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(
3093
3093
  C,
3094
3094
  {
3095
3095
  variant: "body2",
@@ -3098,7 +3098,7 @@ function Ai({
3098
3098
  children: "This property is defined as a property builder in code"
3099
3099
  }
3100
3100
  ) }),
3101
- !r && /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
3101
+ !r && /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(
3102
3102
  C,
3103
3103
  {
3104
3104
  variant: "body2",
@@ -3126,48 +3126,48 @@ function ft({
3126
3126
  onPropertyMove: p,
3127
3127
  onPropertyRemove: m,
3128
3128
  className: u,
3129
- inferredPropertyKeys: c,
3130
- collectionEditable: d
3129
+ inferredPropertyKeys: d,
3130
+ collectionEditable: c
3131
3131
  }) {
3132
- const f = s ?? Object.keys(r), g = X((b) => {
3132
+ const y = s ?? Object.keys(r), f = Q((b) => {
3133
3133
  if (!b.destination)
3134
3134
  return;
3135
- const O = b.source.index, k = b.destination.index, x = Array.from(f), [h] = x.splice(O, 1);
3136
- x.splice(k, 0, h), p && p(x, t);
3137
- }, [t, p, f]);
3138
- return /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(ri, { onDragEnd: g, children: /* @__PURE__ */ e(oi, { droppableId: `droppable_${t}`, children: (b, O) => /* @__PURE__ */ n(
3135
+ const P = b.source.index, w = b.destination.index, k = Array.from(y), [g] = k.splice(P, 1);
3136
+ k.splice(w, 0, g), p && p(k, t);
3137
+ }, [t, p, y]);
3138
+ return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(ri, { onDragEnd: f, children: /* @__PURE__ */ e(oi, { droppableId: `droppable_${t}`, children: (b, P) => /* @__PURE__ */ n(
3139
3139
  "div",
3140
3140
  {
3141
3141
  ...b.droppableProps,
3142
3142
  ref: b.innerRef,
3143
3143
  className: u,
3144
3144
  children: [
3145
- f && f.map((k, x) => {
3146
- const h = r[k], _ = o?.find((y) => y.key === k);
3147
- return !h && !_ ? (console.warn(`Property ${k} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
3145
+ y && y.map((w, k) => {
3146
+ const g = r[w], v = o?.find((_) => _.key === w);
3147
+ return !g && !v ? (console.warn(`Property ${w} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
3148
3148
  ni,
3149
3149
  {
3150
- draggableId: `array_field_${t}_${k}}`,
3151
- index: x,
3152
- children: (y, w) => /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
3150
+ draggableId: `array_field_${t}_${w}}`,
3151
+ index: k,
3152
+ children: (_, h) => /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(
3153
3153
  zi,
3154
3154
  {
3155
- propertyKey: k,
3156
- propertyOrBuilder: h,
3157
- additionalField: _,
3158
- provided: y,
3155
+ propertyKey: w,
3156
+ propertyOrBuilder: g,
3157
+ additionalField: v,
3158
+ provided: _,
3159
3159
  errors: l,
3160
3160
  namespace: t,
3161
- inferredPropertyKeys: c,
3161
+ inferredPropertyKeys: d,
3162
3162
  onPropertyMove: p,
3163
3163
  onPropertyRemove: m,
3164
- onPropertyClick: w.isDragging ? void 0 : i,
3164
+ onPropertyClick: h.isDragging ? void 0 : i,
3165
3165
  selectedPropertyKey: a,
3166
- collectionEditable: d
3166
+ collectionEditable: c
3167
3167
  }
3168
3168
  ) })
3169
3169
  },
3170
- `array_field_${t}_${k}}`
3170
+ `array_field_${t}_${w}}`
3171
3171
  );
3172
3172
  }).filter(Boolean),
3173
3173
  b.placeholder
@@ -3186,29 +3186,29 @@ function zi({
3186
3186
  onPropertyClick: p,
3187
3187
  onPropertyMove: m,
3188
3188
  onPropertyRemove: u,
3189
- inferredPropertyKeys: c,
3190
- collectionEditable: d
3189
+ inferredPropertyKeys: d,
3190
+ collectionEditable: c
3191
3191
  }) {
3192
- const f = c?.includes(a ? `${a}.${t}` : t), g = ce(t, a);
3192
+ const y = d?.includes(a ? `${a}.${t}` : t), f = ce(t, a);
3193
3193
  let b;
3194
3194
  if (typeof i == "object") {
3195
- const h = i;
3196
- h.dataType === "map" && h.properties && (b = /* @__PURE__ */ e(
3195
+ const g = i;
3196
+ g.dataType === "map" && g.properties && (b = /* @__PURE__ */ e(
3197
3197
  ft,
3198
3198
  {
3199
3199
  selectedPropertyKey: o,
3200
- namespace: g,
3201
- properties: h.properties,
3202
- propertiesOrder: h.propertiesOrder,
3200
+ namespace: f,
3201
+ properties: g.properties,
3202
+ propertiesOrder: g.propertiesOrder,
3203
3203
  errors: l,
3204
3204
  onPropertyClick: p,
3205
3205
  onPropertyMove: m,
3206
3206
  onPropertyRemove: u,
3207
- collectionEditable: d
3207
+ collectionEditable: c
3208
3208
  }
3209
3209
  ));
3210
3210
  }
3211
- const O = g ? P(l, _e(g)) : !1, k = o === g, x = i && (d && !oe(i) || Je(i));
3211
+ const P = f ? N(l, ke(f)) : !1, w = o === f, k = i && (c && !oe(i) || We(i));
3212
3212
  return /* @__PURE__ */ n(
3213
3213
  "div",
3214
3214
  {
@@ -3220,7 +3220,7 @@ function zi({
3220
3220
  b && /* @__PURE__ */ e(
3221
3221
  "div",
3222
3222
  {
3223
- className: "absolute border-l " + Pt,
3223
+ className: "absolute border-l " + Nt,
3224
3224
  style: {
3225
3225
  left: "32px",
3226
3226
  top: "64px",
@@ -3228,14 +3228,14 @@ function zi({
3228
3228
  }
3229
3229
  }
3230
3230
  ),
3231
- !oe(i) && !r && x ? /* @__PURE__ */ e(
3231
+ !oe(i) && !r && k ? /* @__PURE__ */ e(
3232
3232
  oa,
3233
3233
  {
3234
3234
  property: i,
3235
3235
  onClick: p ? () => p(t, a) : void 0,
3236
3236
  includeName: !0,
3237
- selected: k,
3238
- hasError: O
3237
+ selected: w,
3238
+ hasError: P
3239
3239
  }
3240
3240
  ) : /* @__PURE__ */ e(
3241
3241
  Ai,
@@ -3243,11 +3243,11 @@ function zi({
3243
3243
  name: t,
3244
3244
  property: i,
3245
3245
  onClick: p ? () => p(t, a) : void 0,
3246
- selected: k
3246
+ selected: w
3247
3247
  }
3248
3248
  ),
3249
3249
  /* @__PURE__ */ n("div", { className: "absolute top-2 right-2 flex flex-row ", children: [
3250
- f && /* @__PURE__ */ e(re, { title: "Inferred property", children: /* @__PURE__ */ e(gt, { size: "small", className: "p-2" }) }),
3250
+ y && /* @__PURE__ */ e(re, { title: "Inferred property", children: /* @__PURE__ */ e(gt, { size: "small", className: "p-2" }) }),
3251
3251
  u && /* @__PURE__ */ e(re, { title: "Remove", children: /* @__PURE__ */ e(
3252
3252
  ne,
3253
3253
  {
@@ -3275,24 +3275,24 @@ function Ti({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
3275
3275
  const {
3276
3276
  values: o,
3277
3277
  setFieldValue: l
3278
- } = K(), [p, m] = $(!1), [u, c] = $(), [d, f] = $(), g = o.propertiesOrder ?? Object.keys(o.properties ?? {}), b = X(({
3279
- id: w,
3280
- property: q
3278
+ } = Y(), [p, m] = L(!1), [u, d] = L(), [c, y] = L(), f = o.propertiesOrder ?? Object.keys(o.properties ?? {}), b = Q(({
3279
+ id: h,
3280
+ property: A
3281
3281
  }) => {
3282
- if (!w)
3282
+ if (!h)
3283
3283
  throw Error();
3284
3284
  l("properties", {
3285
3285
  ...o.properties ?? {},
3286
- [w]: q
3287
- }, !1), l("propertiesOrder", [...g, w], !1), m(!1);
3288
- }, [o.properties, g]), O = X((w, q) => {
3289
- const F = w ? ce(w, q) : void 0;
3290
- if (!F)
3286
+ [h]: A
3287
+ }, !1), l("propertiesOrder", [...f, h], !1), m(!1);
3288
+ }, [o.properties, f]), P = Q((h, A) => {
3289
+ const E = h ? ce(h, A) : void 0;
3290
+ if (!E)
3291
3291
  throw Error("collection editor miss config");
3292
- const A = _e(F), S = Ne(q), E = P(o, S) ?? Object.keys(P(o, ki(q)));
3293
- l(A, void 0, !1), l(S, E.filter((v) => v !== w), !1), m(!1), c(void 0), f(void 0);
3294
- }, [l, o]), k = u ? ce(u, d) : void 0, x = k ? P(o.properties, k.replaceAll(".", ".properties.")) : void 0, h = /* @__PURE__ */ n(
3295
- B,
3292
+ const z = ke(E), q = Pe(A), B = N(o, q) ?? Object.keys(N(o, ki(A)));
3293
+ l(z, void 0, !1), l(q, B.filter((S) => S !== h), !1), m(!1), d(void 0), y(void 0);
3294
+ }, [l, o]), w = u ? ce(u, c) : void 0, k = w ? N(o.properties, w.replaceAll(".", ".properties.")) : void 0, g = /* @__PURE__ */ n(
3295
+ R,
3296
3296
  {
3297
3297
  color: "primary",
3298
3298
  variant: "outlined",
@@ -3303,30 +3303,30 @@ function Ti({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
3303
3303
  o.name ?? "this group"
3304
3304
  ]
3305
3305
  }
3306
- ), _ = !g || g.length < 1, y = X((w, q) => {
3307
- l(Ne(q), w, !1);
3306
+ ), v = !f || f.length < 1, _ = Q((h, A) => {
3307
+ l(Pe(A), h, !1);
3308
3308
  }, []);
3309
- return /* @__PURE__ */ n(M, { children: [
3309
+ return /* @__PURE__ */ n(U, { children: [
3310
3310
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
3311
3311
  /* @__PURE__ */ n("div", { className: "flex justify-between items-end my-4", children: [
3312
3312
  /* @__PURE__ */ e(C, { variant: "subtitle2", children: "Properties in this group" }),
3313
- h
3313
+ g
3314
3314
  ] }),
3315
3315
  /* @__PURE__ */ n(qe, { className: "p-2 pl-8", children: [
3316
3316
  /* @__PURE__ */ e(
3317
3317
  ft,
3318
3318
  {
3319
3319
  properties: o.properties ?? {},
3320
- propertiesOrder: g,
3320
+ propertiesOrder: f,
3321
3321
  errors: {},
3322
3322
  collectionEditable: s,
3323
- onPropertyClick: (w, q) => {
3324
- c(w), f(q), m(!0);
3323
+ onPropertyClick: (h, A) => {
3324
+ d(h), y(A), m(!0);
3325
3325
  },
3326
- onPropertyMove: y
3326
+ onPropertyMove: _
3327
3327
  }
3328
3328
  ),
3329
- _ && /* @__PURE__ */ e(
3329
+ v && /* @__PURE__ */ e(
3330
3330
  C,
3331
3331
  {
3332
3332
  variant: "label",
@@ -3343,7 +3343,7 @@ function Ti({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
3343
3343
  position: "start",
3344
3344
  size: "small",
3345
3345
  label: "Spread children as columns",
3346
- onValueChange: (w) => l("spreadChildren", w),
3346
+ onValueChange: (h) => l("spreadChildren", h),
3347
3347
  value: o.spreadChildren ?? !1
3348
3348
  }
3349
3349
  ),
@@ -3358,21 +3358,21 @@ function Ti({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
3358
3358
  allowDataInference: i,
3359
3359
  collectionEditable: s,
3360
3360
  onCancel: () => {
3361
- m(!1), c(void 0), f(void 0);
3361
+ m(!1), d(void 0), y(void 0);
3362
3362
  },
3363
3363
  onOkClicked: () => {
3364
- m(!1), c(void 0), f(void 0);
3364
+ m(!1), d(void 0), y(void 0);
3365
3365
  },
3366
3366
  getData: a,
3367
- onDelete: O,
3367
+ onDelete: P,
3368
3368
  propertyKey: u,
3369
- propertyNamespace: d,
3370
- property: x,
3369
+ propertyNamespace: c,
3370
+ property: k,
3371
3371
  existingProperty: !!u,
3372
3372
  autoUpdateId: !u,
3373
3373
  autoOpenTypeSelect: !u,
3374
3374
  onPropertyChanged: b,
3375
- existingPropertyKeys: u ? void 0 : g,
3375
+ existingPropertyKeys: u ? void 0 : f,
3376
3376
  propertyConfigs: r
3377
3377
  }
3378
3378
  )
@@ -3391,12 +3391,12 @@ function Vi({
3391
3391
  values: p,
3392
3392
  handleChange: m,
3393
3393
  errors: u,
3394
- setFieldValue: c,
3395
- touched: d
3396
- } = K(), [f, g] = $(!1), b = P(p, "of"), O = P(d, "of") && P(u, "of"), k = X(({ id: h, property: _, namespace: y }) => {
3397
- c("of", _);
3398
- }, []), x = b && Ze(b, o);
3399
- return /* @__PURE__ */ n(M, { children: [
3394
+ setFieldValue: d,
3395
+ touched: c
3396
+ } = Y(), [y, f] = L(!1), b = N(p, "of"), P = N(c, "of") && N(u, "of"), w = Q(({ id: g, property: v, namespace: _ }) => {
3397
+ d("of", v);
3398
+ }, []), k = b && Ze(b, o);
3399
+ return /* @__PURE__ */ n(U, { children: [
3400
3400
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
3401
3401
  /* @__PURE__ */ e(C, { variant: "subtitle2", children: "Repeat component" }),
3402
3402
  /* @__PURE__ */ e(
@@ -3404,13 +3404,13 @@ function Vi({
3404
3404
  {
3405
3405
  name: "of",
3406
3406
  value: b,
3407
- validate: (h) => h?.dataType ? void 0 : "You need to specify a repeat field",
3407
+ validate: (g) => g?.dataType ? void 0 : "You need to specify a repeat field",
3408
3408
  children: () => /* @__PURE__ */ n(qe, { className: "p-2 mt-4", children: [
3409
3409
  b && /* @__PURE__ */ e(
3410
3410
  oa,
3411
3411
  {
3412
3412
  property: b,
3413
- onClick: i ? void 0 : () => g(!0),
3413
+ onClick: i ? void 0 : () => f(!0),
3414
3414
  includeName: !1,
3415
3415
  includeEditButton: !0,
3416
3416
  selected: !1,
@@ -3418,15 +3418,15 @@ function Vi({
3418
3418
  }
3419
3419
  ),
3420
3420
  !i && !b && /* @__PURE__ */ n(
3421
- B,
3421
+ R,
3422
3422
  {
3423
3423
  variant: "text",
3424
3424
  size: "large",
3425
- color: O ? "error" : "primary",
3426
- onClick: () => g(!0),
3425
+ color: P ? "error" : "primary",
3426
+ onClick: () => f(!0),
3427
3427
  children: [
3428
3428
  "Edit ",
3429
- `${x ? x.name : "repeat component"}`
3429
+ `${k ? k.name : "repeat component"}`
3430
3430
  ]
3431
3431
  }
3432
3432
  ),
@@ -3434,16 +3434,16 @@ function Vi({
3434
3434
  je,
3435
3435
  {
3436
3436
  inArray: !0,
3437
- open: f,
3437
+ open: y,
3438
3438
  existingProperty: a,
3439
3439
  getData: r,
3440
3440
  autoUpdateId: !a,
3441
3441
  autoOpenTypeSelect: !a,
3442
- onOkClicked: () => g(!1),
3442
+ onOkClicked: () => f(!1),
3443
3443
  allowDataInference: s,
3444
3444
  property: b,
3445
3445
  includeIdAndName: !1,
3446
- onPropertyChanged: k,
3446
+ onPropertyChanged: w,
3447
3447
  forceShowErrors: t,
3448
3448
  propertyConfigs: o,
3449
3449
  collectionEditable: l
@@ -3456,7 +3456,7 @@ function Vi({
3456
3456
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(At, { disabled: i }) }) })
3457
3457
  ] });
3458
3458
  }
3459
- const Ii = L.forwardRef(
3459
+ const Ii = K.forwardRef(
3460
3460
  function({
3461
3461
  showErrors: a,
3462
3462
  disabledId: i,
@@ -3466,7 +3466,7 @@ const Ii = L.forwardRef(
3466
3466
  }, l) {
3467
3467
  const {
3468
3468
  errors: p
3469
- } = K(), m = "name", u = a && P(p, m), c = "id", d = a && P(p, c), f = "description", g = a && P(p, f);
3469
+ } = Y(), m = "name", u = a && N(p, m), d = "id", c = a && N(p, d), y = "description", f = a && N(p, y);
3470
3470
  return /* @__PURE__ */ n("div", { className: "flex flex-col gap-2 col-span-12", children: [
3471
3471
  /* @__PURE__ */ n("div", { children: [
3472
3472
  /* @__PURE__ */ e(
@@ -3474,7 +3474,7 @@ const Ii = L.forwardRef(
3474
3474
  {
3475
3475
  inputRef: l,
3476
3476
  name: m,
3477
- as: H,
3477
+ as: W,
3478
3478
  style: { fontSize: 20 },
3479
3479
  validate: Ei,
3480
3480
  placeholder: "Field name",
@@ -3489,30 +3489,30 @@ const Ii = L.forwardRef(
3489
3489
  /* @__PURE__ */ e(
3490
3490
  be,
3491
3491
  {
3492
- name: c,
3492
+ name: d,
3493
3493
  as: Te,
3494
3494
  label: "ID",
3495
3495
  validate: (b) => ji(b, r),
3496
3496
  disabled: i || s,
3497
3497
  required: !0,
3498
3498
  size: "small",
3499
- error: !!d
3499
+ error: !!c
3500
3500
  }
3501
3501
  ),
3502
- /* @__PURE__ */ e(ie, { error: !!d, children: d })
3502
+ /* @__PURE__ */ e(ie, { error: !!c, children: c })
3503
3503
  ] }),
3504
3504
  /* @__PURE__ */ n("div", { children: [
3505
3505
  /* @__PURE__ */ e(
3506
3506
  be,
3507
3507
  {
3508
- name: f,
3509
- as: H,
3508
+ name: y,
3509
+ as: W,
3510
3510
  label: "Description",
3511
3511
  disabled: s,
3512
- error: !!g
3512
+ error: !!f
3513
3513
  }
3514
3514
  ),
3515
- /* @__PURE__ */ e(ie, { error: !!g, children: g })
3515
+ /* @__PURE__ */ e(ie, { error: !!f, children: f })
3516
3516
  ] })
3517
3517
  ] });
3518
3518
  }
@@ -3530,8 +3530,8 @@ function Di({
3530
3530
  disabled: a,
3531
3531
  showErrors: i
3532
3532
  }) {
3533
- const { values: r, setFieldValue: s } = K();
3534
- return /* @__PURE__ */ n(M, { children: [
3533
+ const { values: r, setFieldValue: s } = Y();
3534
+ return /* @__PURE__ */ n(U, { children: [
3535
3535
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ n(ze, { children: [
3536
3536
  t === "text_field" && /* @__PURE__ */ e(
3537
3537
  Ue,
@@ -3593,14 +3593,14 @@ function Di({
3593
3593
  s("defaultValue", o.target.value === "" ? void 0 : o.target.value);
3594
3594
  },
3595
3595
  label: "Default value",
3596
- value: P(r, "defaultValue") ?? ""
3596
+ value: N(r, "defaultValue") ?? ""
3597
3597
  }
3598
3598
  ) })
3599
3599
  ] });
3600
3600
  }
3601
3601
  function Bi({ disabled: t }) {
3602
- const { values: a } = K(), i = P(a, "defaultValue");
3603
- return /* @__PURE__ */ n(M, { children: [
3602
+ const { values: a } = Y(), i = N(a, "defaultValue");
3603
+ return /* @__PURE__ */ n(U, { children: [
3604
3604
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Me, { disabled: t }) }) }),
3605
3605
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
3606
3606
  de,
@@ -3619,25 +3619,25 @@ function Mi({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
3619
3619
  const {
3620
3620
  values: o,
3621
3621
  setFieldValue: l
3622
- } = K(), [p, m] = $(!1), [u, c] = $(), [d, f] = $(), g = X(({
3623
- id: _,
3624
- property: y
3622
+ } = Y(), [p, m] = L(!1), [u, d] = L(), [c, y] = L(), f = Q(({
3623
+ id: v,
3624
+ property: _
3625
3625
  }) => {
3626
- if (!_)
3626
+ if (!v)
3627
3627
  throw Error();
3628
3628
  l("oneOf.properties", {
3629
3629
  ...o.oneOf?.properties ?? {},
3630
- [_]: y
3631
- }, !1), l("oneOf.propertiesOrder", [...o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), _], !1), m(!1);
3632
- }, [o.oneOf?.properties, o.oneOf?.propertiesOrder]), b = u ? ce(u, d) : void 0, O = b ? P(o.oneOf?.properties, b.replaceAll(".", ".properties.")) : void 0, k = X((_, y) => {
3633
- const w = _ ? ce(_, y) : void 0;
3634
- if (!w)
3630
+ [v]: _
3631
+ }, !1), l("oneOf.propertiesOrder", [...o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), v], !1), m(!1);
3632
+ }, [o.oneOf?.properties, o.oneOf?.propertiesOrder]), b = u ? ce(u, c) : void 0, P = b ? N(o.oneOf?.properties, b.replaceAll(".", ".properties.")) : void 0, w = Q((v, _) => {
3633
+ const h = v ? ce(v, _) : void 0;
3634
+ if (!h)
3635
3635
  throw Error("collection editor miss config");
3636
- l(`oneOf.${_e(w)}`, void 0, !1);
3637
- const q = `oneOf.${Ne(y)}`, F = P(o, q);
3638
- l(q, F.filter((A) => A !== _), !1), m(!1), c(void 0), f(void 0);
3639
- }, [l, o]), x = /* @__PURE__ */ n(
3640
- B,
3636
+ l(`oneOf.${ke(h)}`, void 0, !1);
3637
+ const A = `oneOf.${Pe(_)}`, E = N(o, A);
3638
+ l(A, E.filter((z) => z !== v), !1), m(!1), d(void 0), y(void 0);
3639
+ }, [l, o]), k = /* @__PURE__ */ n(
3640
+ R,
3641
3641
  {
3642
3642
  autoFocus: !0,
3643
3643
  color: "primary",
@@ -3648,14 +3648,14 @@ function Mi({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
3648
3648
  o.name ?? "this block"
3649
3649
  ]
3650
3650
  }
3651
- ), h = X((_, y) => {
3652
- l(`oneOf.${Ne(y)}`, _, !1);
3651
+ ), g = Q((v, _) => {
3652
+ l(`oneOf.${Pe(_)}`, v, !1);
3653
3653
  }, []);
3654
- return /* @__PURE__ */ n(M, { children: [
3654
+ return /* @__PURE__ */ n(U, { children: [
3655
3655
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
3656
3656
  /* @__PURE__ */ n("div", { className: "flex justify-between items-end mt-8 mb-4", children: [
3657
3657
  /* @__PURE__ */ e(C, { variant: "subtitle2", children: "Properties in this block" }),
3658
- x
3658
+ k
3659
3659
  ] }),
3660
3660
  /* @__PURE__ */ n(qe, { className: "p-2 pl-8", children: [
3661
3661
  /* @__PURE__ */ e(
@@ -3665,10 +3665,10 @@ function Mi({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
3665
3665
  propertiesOrder: o.oneOf?.propertiesOrder,
3666
3666
  errors: {},
3667
3667
  collectionEditable: s,
3668
- onPropertyClick: t ? void 0 : (_, y) => {
3669
- c(_), f(y), m(!0);
3668
+ onPropertyClick: t ? void 0 : (v, _) => {
3669
+ d(v), y(_), m(!0);
3670
3670
  },
3671
- onPropertyMove: t ? void 0 : h
3671
+ onPropertyMove: t ? void 0 : g
3672
3672
  }
3673
3673
  ),
3674
3674
  !t && !o.oneOf?.propertiesOrder?.length && /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center p-4", children: "Add the first property to this block" })
@@ -3683,20 +3683,20 @@ function Mi({ disabled: t, getData: a, allowDataInference: i, propertyConfigs: r
3683
3683
  getData: a,
3684
3684
  allowDataInference: i,
3685
3685
  onCancel: () => {
3686
- m(!1), c(void 0), f(void 0);
3686
+ m(!1), d(void 0), y(void 0);
3687
3687
  },
3688
3688
  onOkClicked: () => {
3689
- m(!1), c(void 0), f(void 0);
3689
+ m(!1), d(void 0), y(void 0);
3690
3690
  },
3691
3691
  collectionEditable: s,
3692
- onDelete: k,
3692
+ onDelete: w,
3693
3693
  propertyKey: u,
3694
- propertyNamespace: d,
3695
- property: O,
3694
+ propertyNamespace: c,
3695
+ property: P,
3696
3696
  existingProperty: !!u,
3697
3697
  autoUpdateId: !u,
3698
3698
  autoOpenTypeSelect: !u,
3699
- onPropertyChanged: g,
3699
+ onPropertyChanged: f,
3700
3700
  existingPropertyKeys: u ? void 0 : o.oneOf?.propertiesOrder,
3701
3701
  propertyConfigs: r
3702
3702
  }
@@ -3707,13 +3707,13 @@ function Ri({ disabled: t }) {
3707
3707
  const {
3708
3708
  values: a,
3709
3709
  handleChange: i
3710
- } = K(), r = "validation.min", s = "validation.max", o = "validation.lessThan", l = "validation.moreThan", p = "validation.positive", m = "validation.negative", u = "validation.integer";
3710
+ } = Y(), r = "validation.min", s = "validation.max", o = "validation.lessThan", l = "validation.moreThan", p = "validation.positive", m = "validation.negative", u = "validation.integer";
3711
3711
  return /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
3712
3712
  /* @__PURE__ */ e(Me, { disabled: t }),
3713
3713
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
3714
- H,
3714
+ W,
3715
3715
  {
3716
- value: P(a, r),
3716
+ value: N(a, r),
3717
3717
  label: "Min value",
3718
3718
  name: r,
3719
3719
  type: "number",
@@ -3723,9 +3723,9 @@ function Ri({ disabled: t }) {
3723
3723
  }
3724
3724
  ) }),
3725
3725
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
3726
- H,
3726
+ W,
3727
3727
  {
3728
- value: P(a, s),
3728
+ value: N(a, s),
3729
3729
  label: "Max value",
3730
3730
  name: s,
3731
3731
  type: "number",
@@ -3735,9 +3735,9 @@ function Ri({ disabled: t }) {
3735
3735
  }
3736
3736
  ) }),
3737
3737
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
3738
- H,
3738
+ W,
3739
3739
  {
3740
- value: P(a, o),
3740
+ value: N(a, o),
3741
3741
  label: "Less than",
3742
3742
  name: o,
3743
3743
  type: "number",
@@ -3747,9 +3747,9 @@ function Ri({ disabled: t }) {
3747
3747
  }
3748
3748
  ) }),
3749
3749
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
3750
- H,
3750
+ W,
3751
3751
  {
3752
- value: P(a, l),
3752
+ value: N(a, l),
3753
3753
  label: "More than",
3754
3754
  name: l,
3755
3755
  type: "number",
@@ -3791,8 +3791,8 @@ function Ri({ disabled: t }) {
3791
3791
  ] });
3792
3792
  }
3793
3793
  function Ui({ disabled: t }) {
3794
- const { values: a, setFieldValue: i } = K();
3795
- return /* @__PURE__ */ n(M, { children: [
3794
+ const { values: a, setFieldValue: i } = Y();
3795
+ return /* @__PURE__ */ n(U, { children: [
3796
3796
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Ri, { disabled: t }) }) }),
3797
3797
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
3798
3798
  Te,
@@ -3804,7 +3804,7 @@ function Ui({ disabled: t }) {
3804
3804
  i("defaultValue", r.target.value === "" ? void 0 : parseFloat(r.target.value));
3805
3805
  },
3806
3806
  label: "Default value",
3807
- value: P(a, "defaultValue") ?? ""
3807
+ value: N(a, "defaultValue") ?? ""
3808
3808
  }
3809
3809
  ) })
3810
3810
  ] });
@@ -3822,21 +3822,21 @@ function Rt({
3822
3822
  touched: p,
3823
3823
  setFieldError: m,
3824
3824
  setFieldValue: u
3825
- } = K();
3825
+ } = Y();
3826
3826
  if (!Be())
3827
- return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(We, {}) });
3828
- const d = a ? "of.path" : "path", f = P(s, d), g = r && P(l, d);
3829
- return console.log("pathError", l, g), /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
3827
+ return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Qe, {}) });
3828
+ const c = a ? "of.path" : "path", y = N(s, c), f = r && N(l, c);
3829
+ return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
3830
3830
  be,
3831
3831
  {
3832
3832
  required: !0,
3833
- name: d,
3834
- pathPath: d,
3833
+ name: c,
3834
+ pathPath: c,
3835
3835
  type: "select",
3836
3836
  validate: $i,
3837
3837
  disabled: t || i,
3838
- value: f,
3839
- error: g,
3838
+ value: y,
3839
+ error: f,
3840
3840
  handleChange: o,
3841
3841
  component: Li
3842
3842
  }
@@ -3857,11 +3857,11 @@ function Li({
3857
3857
  console.log("error", s);
3858
3858
  const l = Be();
3859
3859
  if (!l)
3860
- return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(We, {}) });
3860
+ return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Qe, {}) });
3861
3861
  const p = l?.collections ?? [], m = Array.from(new Set(
3862
- Object.values(p).map((c) => c.group).filter(Boolean)
3863
- ).values()), u = p.filter((c) => !c.group);
3864
- return /* @__PURE__ */ n(M, { children: [
3862
+ Object.values(p).map((d) => d.group).filter(Boolean)
3863
+ ).values()), u = p.filter((d) => !d.group);
3864
+ return /* @__PURE__ */ n(U, { children: [
3865
3865
  /* @__PURE__ */ n(
3866
3866
  Se,
3867
3867
  {
@@ -3872,72 +3872,72 @@ function Li({
3872
3872
  name: a,
3873
3873
  onChange: r,
3874
3874
  label: "Target collection",
3875
- renderValue: (c) => {
3876
- const d = p.find((g) => g.id === c || g.path === c);
3877
- if (!d)
3875
+ renderValue: (d) => {
3876
+ const c = p.find((f) => f.id === d || f.path === d);
3877
+ if (!c)
3878
3878
  return null;
3879
- const f = ct(d);
3879
+ const y = ct(c);
3880
3880
  return /* @__PURE__ */ n("div", { className: "flex flex-row", children: [
3881
- f,
3881
+ y,
3882
3882
  /* @__PURE__ */ e(
3883
3883
  C,
3884
3884
  {
3885
3885
  variant: "subtitle2",
3886
3886
  className: "font-medium ml-4",
3887
- children: d?.name.toUpperCase()
3887
+ children: c?.name.toUpperCase()
3888
3888
  }
3889
3889
  )
3890
3890
  ] });
3891
3891
  },
3892
3892
  ...o,
3893
3893
  children: [
3894
- m.flatMap((c) => /* @__PURE__ */ e(
3894
+ m.flatMap((d) => /* @__PURE__ */ e(
3895
3895
  Vt,
3896
3896
  {
3897
- label: c || "Views",
3898
- children: p.filter((d) => d.group === c).map((d) => {
3899
- const f = ct(d);
3897
+ label: d || "Views",
3898
+ children: p.filter((c) => c.group === d).map((c) => {
3899
+ const y = ct(c);
3900
3900
  return /* @__PURE__ */ e(
3901
3901
  ee,
3902
3902
  {
3903
- value: d.id ?? d.path,
3903
+ value: c.id ?? c.path,
3904
3904
  children: /* @__PURE__ */ n("div", { className: "flex flex-row", children: [
3905
- f,
3905
+ y,
3906
3906
  /* @__PURE__ */ e(
3907
3907
  C,
3908
3908
  {
3909
3909
  variant: "subtitle2",
3910
3910
  className: "font-medium ml-4",
3911
- children: d?.name.toUpperCase()
3911
+ children: c?.name.toUpperCase()
3912
3912
  }
3913
3913
  )
3914
3914
  ] })
3915
3915
  },
3916
- `${d.id ?? d.path}-${c}`
3916
+ `${c.id ?? c.path}-${d}`
3917
3917
  );
3918
3918
  })
3919
3919
  },
3920
- `group_${c}`
3920
+ `group_${d}`
3921
3921
  )),
3922
- u && /* @__PURE__ */ e(Vt, { label: "Views", children: u.map((c) => {
3923
- const d = ct(c);
3922
+ u && /* @__PURE__ */ e(Vt, { label: "Views", children: u.map((d) => {
3923
+ const c = ct(d);
3924
3924
  return /* @__PURE__ */ e(
3925
3925
  ee,
3926
3926
  {
3927
- value: c.id ?? c.path,
3927
+ value: d.id ?? d.path,
3928
3928
  children: /* @__PURE__ */ n("div", { className: "flex flex-row", children: [
3929
- d,
3929
+ c,
3930
3930
  /* @__PURE__ */ e(
3931
3931
  C,
3932
3932
  {
3933
3933
  variant: "subtitle2",
3934
3934
  className: "font-medium ml-4",
3935
- children: c?.name.toUpperCase()
3935
+ children: d?.name.toUpperCase()
3936
3936
  }
3937
3937
  )
3938
3938
  ] })
3939
3939
  },
3940
- c.id ?? c.path
3940
+ d.id ?? d.path
3941
3941
  );
3942
3942
  }) })
3943
3943
  ]
@@ -3952,8 +3952,8 @@ function Ki({ disabled: t }) {
3952
3952
  errors: i,
3953
3953
  touched: r,
3954
3954
  setFieldValue: s
3955
- } = K(), o = "mode", l = P(a, o), p = P(r, o) && P(i, o), m = "autoValue", u = P(a, m), c = P(r, m) && P(i, m);
3956
- return /* @__PURE__ */ n(M, { children: [
3955
+ } = Y(), o = "mode", l = N(a, o), p = N(r, o) && N(i, o), m = "autoValue", u = N(a, m), d = N(r, m) && N(i, m);
3956
+ return /* @__PURE__ */ n(U, { children: [
3957
3957
  /* @__PURE__ */ n("div", { className: "flex flex-col col-span-12", children: [
3958
3958
  /* @__PURE__ */ n(
3959
3959
  Se,
@@ -3961,10 +3961,10 @@ function Ki({ disabled: t }) {
3961
3961
  name: o,
3962
3962
  value: l ?? "date",
3963
3963
  error: !!p,
3964
- onValueChange: (d) => s(o, d),
3964
+ onValueChange: (c) => s(o, c),
3965
3965
  label: "Mode",
3966
- renderValue: (d) => {
3967
- switch (d) {
3966
+ renderValue: (c) => {
3967
+ switch (c) {
3968
3968
  case "date_time":
3969
3969
  return "Date/Time";
3970
3970
  case "date":
@@ -3987,9 +3987,9 @@ function Ki({ disabled: t }) {
3987
3987
  name: m,
3988
3988
  disabled: t,
3989
3989
  value: u ?? "",
3990
- onValueChange: (d) => s(m, d),
3991
- renderValue: (d) => {
3992
- switch (d) {
3990
+ onValueChange: (c) => s(m, c),
3991
+ renderValue: (c) => {
3992
+ switch (c) {
3993
3993
  case "on_create":
3994
3994
  return "On create";
3995
3995
  case "on_update":
@@ -3998,7 +3998,7 @@ function Ki({ disabled: t }) {
3998
3998
  return "None";
3999
3999
  }
4000
4000
  },
4001
- error: !!c,
4001
+ error: !!d,
4002
4002
  label: "Automatic value",
4003
4003
  children: [
4004
4004
  /* @__PURE__ */ e(ee, { value: "", children: " None " }),
@@ -4007,13 +4007,13 @@ function Ki({ disabled: t }) {
4007
4007
  ]
4008
4008
  }
4009
4009
  ),
4010
- /* @__PURE__ */ e(ie, { error: !!c, children: c ?? "Update this field automatically when creating or updating the entity" })
4010
+ /* @__PURE__ */ e(ie, { error: !!d, children: d ?? "Update this field automatically when creating or updating the entity" })
4011
4011
  ] }),
4012
4012
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Me, { disabled: t }) }) })
4013
4013
  ] });
4014
4014
  }
4015
4015
  function Yi({ disabled: t }) {
4016
- return K(), /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
4016
+ return Y(), /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
4017
4017
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
4018
4018
  de,
4019
4019
  {
@@ -4039,11 +4039,11 @@ function Yi({ disabled: t }) {
4039
4039
  ] });
4040
4040
  }
4041
4041
  function Gi({ disabled: t }) {
4042
- return /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Me, { disabled: t }) }) }) });
4042
+ return /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Me, { disabled: t }) }) }) });
4043
4043
  }
4044
4044
  function na(t, a, i) {
4045
4045
  let r;
4046
- return a === "text_field" ? r = Y(
4046
+ return a === "text_field" ? r = G(
4047
4047
  t,
4048
4048
  {
4049
4049
  dataType: "string",
@@ -4056,7 +4056,7 @@ function na(t, a, i) {
4056
4056
  url: void 0,
4057
4057
  enumValues: void 0
4058
4058
  }
4059
- ) : a === "multiline" ? r = Y(
4059
+ ) : a === "multiline" ? r = G(
4060
4060
  t,
4061
4061
  {
4062
4062
  dataType: "string",
@@ -4069,7 +4069,7 @@ function na(t, a, i) {
4069
4069
  url: void 0,
4070
4070
  enumValues: void 0
4071
4071
  }
4072
- ) : a === "markdown" ? r = Y(
4072
+ ) : a === "markdown" ? r = G(
4073
4073
  t,
4074
4074
  {
4075
4075
  dataType: "string",
@@ -4081,7 +4081,7 @@ function na(t, a, i) {
4081
4081
  email: void 0,
4082
4082
  url: void 0
4083
4083
  }
4084
- ) : a === "url" ? r = Y(
4084
+ ) : a === "url" ? r = G(
4085
4085
  t,
4086
4086
  {
4087
4087
  dataType: "string",
@@ -4094,7 +4094,7 @@ function na(t, a, i) {
4094
4094
  url: !0,
4095
4095
  enumValues: void 0
4096
4096
  }
4097
- ) : a === "email" ? r = Y(
4097
+ ) : a === "email" ? r = G(
4098
4098
  t,
4099
4099
  {
4100
4100
  dataType: "string",
@@ -4107,7 +4107,7 @@ function na(t, a, i) {
4107
4107
  url: void 0,
4108
4108
  enumValues: void 0
4109
4109
  }
4110
- ) : a === "select" ? r = Y(
4110
+ ) : a === "select" ? r = G(
4111
4111
  t,
4112
4112
  {
4113
4113
  dataType: "string",
@@ -4120,7 +4120,7 @@ function na(t, a, i) {
4120
4120
  url: void 0,
4121
4121
  enumValues: t.enumValues ?? []
4122
4122
  }
4123
- ) : a === "multi_select" ? r = Y(
4123
+ ) : a === "multi_select" ? r = G(
4124
4124
  t,
4125
4125
  {
4126
4126
  dataType: "array",
@@ -4131,7 +4131,7 @@ function na(t, a, i) {
4131
4131
  enumValues: t.of?.enumValues ?? []
4132
4132
  }
4133
4133
  }
4134
- ) : a === "number_input" ? r = Y(
4134
+ ) : a === "number_input" ? r = G(
4135
4135
  t,
4136
4136
  {
4137
4137
  dataType: "number",
@@ -4139,7 +4139,7 @@ function na(t, a, i) {
4139
4139
  editable: t.editable !== void 0 ? t.editable : !0,
4140
4140
  enumValues: void 0
4141
4141
  }
4142
- ) : a === "number_select" ? r = Y(
4142
+ ) : a === "number_select" ? r = G(
4143
4143
  t,
4144
4144
  {
4145
4145
  dataType: "number",
@@ -4147,7 +4147,7 @@ function na(t, a, i) {
4147
4147
  editable: t.editable !== void 0 ? t.editable : !0,
4148
4148
  enumValues: t.enumValues ?? []
4149
4149
  }
4150
- ) : a === "multi_number_select" ? r = Y(
4150
+ ) : a === "multi_number_select" ? r = G(
4151
4151
  t,
4152
4152
  {
4153
4153
  dataType: "array",
@@ -4158,7 +4158,7 @@ function na(t, a, i) {
4158
4158
  enumValues: t.of?.enumValues ?? []
4159
4159
  }
4160
4160
  }
4161
- ) : a === "file_upload" ? r = Y(
4161
+ ) : a === "file_upload" ? r = G(
4162
4162
  t,
4163
4163
  {
4164
4164
  dataType: "string",
@@ -4168,7 +4168,7 @@ function na(t, a, i) {
4168
4168
  storagePath: "/"
4169
4169
  }
4170
4170
  }
4171
- ) : a === "multi_file_upload" ? r = Y(
4171
+ ) : a === "multi_file_upload" ? r = G(
4172
4172
  t,
4173
4173
  {
4174
4174
  dataType: "array",
@@ -4181,7 +4181,7 @@ function na(t, a, i) {
4181
4181
  }
4182
4182
  }
4183
4183
  }
4184
- ) : a === "group" ? r = Y(
4184
+ ) : a === "group" ? r = G(
4185
4185
  t,
4186
4186
  {
4187
4187
  dataType: "map",
@@ -4190,7 +4190,7 @@ function na(t, a, i) {
4190
4190
  keyValue: !1,
4191
4191
  properties: t.properties ?? {}
4192
4192
  }
4193
- ) : a === "key_value" ? r = Y(
4193
+ ) : a === "key_value" ? r = G(
4194
4194
  t,
4195
4195
  {
4196
4196
  dataType: "map",
@@ -4199,14 +4199,14 @@ function na(t, a, i) {
4199
4199
  keyValue: !0,
4200
4200
  properties: void 0
4201
4201
  }
4202
- ) : a === "reference" ? r = Y(
4202
+ ) : a === "reference" ? r = G(
4203
4203
  t,
4204
4204
  {
4205
4205
  dataType: "reference",
4206
4206
  propertyConfig: "reference",
4207
4207
  editable: t.editable !== void 0 ? t.editable : !0
4208
4208
  }
4209
- ) : a === "multi_references" ? r = Y(
4209
+ ) : a === "multi_references" ? r = G(
4210
4210
  t,
4211
4211
  {
4212
4212
  dataType: "array",
@@ -4216,14 +4216,14 @@ function na(t, a, i) {
4216
4216
  dataType: "reference"
4217
4217
  }
4218
4218
  }
4219
- ) : a === "switch" ? r = Y(
4219
+ ) : a === "switch" ? r = G(
4220
4220
  t,
4221
4221
  {
4222
4222
  dataType: "boolean",
4223
4223
  propertyConfig: "switch",
4224
4224
  editable: t.editable !== void 0 ? t.editable : !0
4225
4225
  }
4226
- ) : a === "date_time" ? r = Y(
4226
+ ) : a === "date_time" ? r = G(
4227
4227
  t,
4228
4228
  {
4229
4229
  dataType: "date",
@@ -4231,14 +4231,14 @@ function na(t, a, i) {
4231
4231
  editable: t.editable !== void 0 ? t.editable : !0,
4232
4232
  mode: "date_time"
4233
4233
  }
4234
- ) : a === "repeat" ? r = Y(
4234
+ ) : a === "repeat" ? r = G(
4235
4235
  t,
4236
4236
  {
4237
4237
  dataType: "array",
4238
4238
  propertyConfig: "repeat",
4239
4239
  editable: t.editable !== void 0 ? t.editable : !0
4240
4240
  }
4241
- ) : a === "block" ? r = Y(
4241
+ ) : a === "block" ? r = G(
4242
4242
  t,
4243
4243
  {
4244
4244
  dataType: "array",
@@ -4263,7 +4263,7 @@ function sa({ value: t, optionDisabled: a, propertyConfig: i, existing: r }) {
4263
4263
  children: /* @__PURE__ */ n(
4264
4264
  "div",
4265
4265
  {
4266
- className: ke(
4266
+ className: xe(
4267
4267
  "flex flex-row items-center text-base min-h-[52px]",
4268
4268
  a ? "w-full" : ""
4269
4269
  ),
@@ -4291,8 +4291,8 @@ function Hi({
4291
4291
  disabled: t,
4292
4292
  showErrors: a
4293
4293
  }) {
4294
- const { values: i, setFieldValue: r } = K(), s = P(i, "url");
4295
- return /* @__PURE__ */ n(M, { children: [
4294
+ const { values: i, setFieldValue: r } = Y(), s = N(i, "url");
4295
+ return /* @__PURE__ */ n(U, { children: [
4296
4296
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ n(
4297
4297
  Se,
4298
4298
  {
@@ -4342,12 +4342,12 @@ function Hi({
4342
4342
  r("defaultValue", o.target.value === "" ? void 0 : o.target.value);
4343
4343
  },
4344
4344
  label: "Default value",
4345
- value: P(i, "defaultValue") ?? ""
4345
+ value: N(i, "defaultValue") ?? ""
4346
4346
  }
4347
4347
  ) })
4348
4348
  ] });
4349
4349
  }
4350
- const Ji = [
4350
+ const Wi = [
4351
4351
  "text_field",
4352
4352
  "multiline",
4353
4353
  "markdown",
@@ -4368,7 +4368,7 @@ const Ji = [
4368
4368
  "key_value",
4369
4369
  "repeat",
4370
4370
  "block"
4371
- ], la = Object.entries(Zt).filter(([t]) => Ji.includes(t)).map(([t, a]) => ({ [t]: a })).reduce((t, a) => ({ ...t, ...a }), {}), ca = L.memo(
4371
+ ], la = Object.entries(Zt).filter(([t]) => Wi.includes(t)).map(([t, a]) => ({ [t]: a })).reduce((t, a) => ({ ...t, ...a }), {}), ca = K.memo(
4372
4372
  function({
4373
4373
  includeIdAndName: a = !0,
4374
4374
  autoOpenTypeSelect: i,
@@ -4379,75 +4379,74 @@ const Ji = [
4379
4379
  propertyNamespace: p,
4380
4380
  property: m,
4381
4381
  onPropertyChanged: u,
4382
- onPropertyChangedImmediate: c = !0,
4383
- onDelete: d,
4384
- onError: f,
4385
- initialErrors: g,
4382
+ onPropertyChangedImmediate: d = !0,
4383
+ onDelete: c,
4384
+ onError: y,
4385
+ initialErrors: f,
4386
4386
  forceShowErrors: b,
4387
- existingPropertyKeys: O,
4388
- allowDataInference: k,
4389
- getHelpers: x,
4390
- getData: h,
4391
- propertyConfigs: _,
4392
- collectionEditable: y
4387
+ existingPropertyKeys: P,
4388
+ allowDataInference: w,
4389
+ getHelpers: k,
4390
+ getData: g,
4391
+ propertyConfigs: v,
4392
+ collectionEditable: _
4393
4393
  }) {
4394
- const w = {
4394
+ const h = {
4395
4395
  id: "",
4396
4396
  name: ""
4397
- }, q = !!(m && !Je(m)) && !y, F = He(m ? {
4397
+ }, A = !!(m && !We(m)) && !_, E = He(m ? {
4398
4398
  id: l,
4399
4399
  previousId: l,
4400
4400
  property: m
4401
- } : void 0), A = ({
4402
- id: S,
4403
- property: E
4401
+ } : void 0), z = ({
4402
+ id: q,
4403
+ property: B
4404
4404
  }) => {
4405
- const v = {
4406
- id: S,
4407
- previousId: F.current?.id,
4408
- property: E,
4405
+ const S = {
4406
+ id: q,
4407
+ previousId: E.current?.id,
4408
+ property: B,
4409
4409
  namespace: p
4410
4410
  };
4411
- F.current = v, u?.(v);
4411
+ E.current = S, u?.(S);
4412
4412
  };
4413
4413
  return /* @__PURE__ */ e(
4414
4414
  St,
4415
4415
  {
4416
- initialErrors: g,
4417
- initialValues: m ? { id: l, ...m } : w,
4418
- onSubmit: (S, E) => {
4419
- console.log("Submitting property", S);
4416
+ initialErrors: f,
4417
+ initialValues: m ? { id: l, ...m } : h,
4418
+ onSubmit: (q, B) => {
4420
4419
  const {
4421
- id: v,
4422
- ...V
4423
- } = S;
4424
- A({
4425
- id: v,
4426
- property: { ...V, editable: V.editable ?? !0 }
4427
- }), r || E.resetForm({ values: w });
4420
+ id: S,
4421
+ ...O
4422
+ } = q;
4423
+ z({
4424
+ id: S,
4425
+ property: { ...O, editable: O.editable ?? !0 }
4426
+ }), r || B.resetForm({ values: h });
4428
4427
  },
4429
- children: (S) => (pe(() => {
4430
- x?.(S);
4431
- }, [S]), /* @__PURE__ */ e(
4432
- Qi,
4428
+ children: (q) => (pe(() => {
4429
+ k?.(q);
4430
+ }, [q]), /* @__PURE__ */ e(
4431
+ Ji,
4433
4432
  {
4434
- onPropertyChanged: c ? A : void 0,
4435
- onDelete: d,
4433
+ onPropertyChanged: d ? z : void 0,
4434
+ onDelete: c,
4436
4435
  includeIdAndTitle: a,
4437
4436
  propertyNamespace: p,
4438
- onError: f,
4439
- showErrors: b || S.submitCount > 0,
4437
+ onError: y,
4438
+ showErrors: b || q.submitCount > 0,
4440
4439
  existing: r,
4441
4440
  autoUpdateId: s,
4442
4441
  inArray: o,
4443
4442
  autoOpenTypeSelect: i,
4444
- existingPropertyKeys: O,
4445
- disabled: q,
4446
- getData: h,
4447
- allowDataInference: k,
4448
- propertyConfigs: _,
4449
- collectionEditable: y,
4450
- ...S
4443
+ existingPropertyKeys: P,
4444
+ disabled: A,
4445
+ getData: g,
4446
+ allowDataInference: w,
4447
+ propertyConfigs: v,
4448
+ collectionEditable: _,
4449
+ ...q
4451
4450
  }
4452
4451
  ))
4453
4452
  },
@@ -4490,7 +4489,7 @@ function je({
4490
4489
  ) }),
4491
4490
  /* @__PURE__ */ n(Le, { children: [
4492
4491
  a && /* @__PURE__ */ e(
4493
- B,
4492
+ R,
4494
4493
  {
4495
4494
  variant: "text",
4496
4495
  onClick: () => {
@@ -4500,7 +4499,7 @@ function je({
4500
4499
  }
4501
4500
  ),
4502
4501
  /* @__PURE__ */ e(
4503
- B,
4502
+ R,
4504
4503
  {
4505
4504
  variant: "outlined",
4506
4505
  color: "primary",
@@ -4513,7 +4512,7 @@ function je({
4513
4512
  }
4514
4513
  );
4515
4514
  }
4516
- function Qi({
4515
+ function Ji({
4517
4516
  values: t,
4518
4517
  errors: a,
4519
4518
  touched: i,
@@ -4524,135 +4523,135 @@ function Qi({
4524
4523
  autoOpenTypeSelect: p,
4525
4524
  includeIdAndTitle: m,
4526
4525
  onPropertyChanged: u,
4527
- onDelete: c,
4528
- propertyNamespace: d,
4529
- onError: f,
4530
- showErrors: g,
4526
+ onDelete: d,
4527
+ propertyNamespace: c,
4528
+ onError: y,
4529
+ showErrors: f,
4531
4530
  disabled: b,
4532
- inArray: O,
4533
- existingPropertyKeys: k,
4534
- getData: x,
4535
- allowDataInference: h,
4536
- propertyConfigs: _,
4537
- collectionEditable: y
4531
+ inArray: P,
4532
+ existingPropertyKeys: w,
4533
+ getData: k,
4534
+ allowDataInference: g,
4535
+ propertyConfigs: v,
4536
+ collectionEditable: _
4538
4537
  }) {
4539
- const [w, q] = $(p), [F, A] = $(!1), [S, E] = $(t?.dataType ? Xt(t) : void 0), v = Object.entries(la).concat(Object.entries(_)), V = O ? v.filter(([W, te]) => !oe(te.property) && te.property?.dataType !== "array") : v, J = ba(t), N = He(null), R = He(t), ge = "id", xe = g && P(a, "selectedWidget");
4538
+ const [h, A] = L(p), [E, z] = L(!1), [q, B] = L(t?.dataType ? Xt(t) : void 0), S = Object.entries(la).concat(Object.entries(v)), O = P ? S.filter(([J, te]) => !oe(te.property) && te.property?.dataType !== "array") : S, j = ba(t), x = He(null), I = He(t), ge = "id", ye = f && N(a, "selectedWidget");
4540
4539
  pe(() => {
4541
- !P(i, ge) && l && t?.name && s(ge, Ct(t.name));
4540
+ !N(i, ge) && l && t?.name && s(ge, Ct(t.name));
4542
4541
  }, [l, i, t?.name]), pe(() => {
4543
- if (u && (!m || J.id)) {
4542
+ if (u && (!m || j.id)) {
4544
4543
  const {
4545
- id: W,
4544
+ id: J,
4546
4545
  ...te
4547
- } = J;
4548
- ut(J, R.current) || (u({
4549
- id: W,
4546
+ } = j;
4547
+ ut(j, I.current) || (u({
4548
+ id: J,
4550
4549
  property: te,
4551
- namespace: d
4552
- }), R.current = J);
4550
+ namespace: c
4551
+ }), I.current = j);
4553
4552
  }
4554
- }, [J, m, u, d]), pe(() => {
4555
- t?.id && f && Object.keys(a).length > 0 && f(t?.id, d, a);
4556
- }, [a, f, d, t?.id]);
4557
- const Q = (W) => {
4558
- E(W), r(na(t, W, _)), setTimeout(() => {
4559
- N.current?.focus();
4553
+ }, [j, m, u, c]), pe(() => {
4554
+ t?.id && y && Object.keys(a).length > 0 && y(t?.id, c, a);
4555
+ }, [a, y, c, t?.id]);
4556
+ const Z = (J) => {
4557
+ B(J), r(na(t, J, v)), setTimeout(() => {
4558
+ x.current?.focus();
4560
4559
  }, 0);
4561
4560
  };
4562
- let U;
4563
- return S === "text_field" || S === "multiline" || S === "markdown" || S === "email" ? U = /* @__PURE__ */ e(
4561
+ let $;
4562
+ return q === "text_field" || q === "multiline" || q === "markdown" || q === "email" ? $ = /* @__PURE__ */ e(
4564
4563
  Di,
4565
4564
  {
4566
- widgetId: S,
4565
+ widgetId: q,
4567
4566
  disabled: b,
4568
- showErrors: g
4567
+ showErrors: f
4569
4568
  }
4570
- ) : S === "url" ? U = /* @__PURE__ */ e(
4569
+ ) : q === "url" ? $ = /* @__PURE__ */ e(
4571
4570
  Hi,
4572
4571
  {
4573
4572
  disabled: b,
4574
- showErrors: g
4573
+ showErrors: f
4575
4574
  }
4576
- ) : S === "select" || S === "number_select" ? U = /* @__PURE__ */ e(
4575
+ ) : q === "select" || q === "number_select" ? $ = /* @__PURE__ */ e(
4577
4576
  Bt,
4578
4577
  {
4579
4578
  multiselect: !1,
4580
- allowDataInference: h,
4579
+ allowDataInference: g,
4581
4580
  updateIds: !o,
4582
4581
  disabled: b,
4583
- getData: x,
4584
- showErrors: g
4582
+ getData: k,
4583
+ showErrors: f
4585
4584
  }
4586
- ) : S === "multi_select" || S === "multi_number_select" ? U = /* @__PURE__ */ e(
4585
+ ) : q === "multi_select" || q === "multi_number_select" ? $ = /* @__PURE__ */ e(
4587
4586
  Bt,
4588
4587
  {
4589
4588
  multiselect: !0,
4590
4589
  updateIds: !o,
4591
4590
  disabled: b,
4592
- allowDataInference: h,
4593
- getData: x,
4594
- showErrors: g
4591
+ allowDataInference: g,
4592
+ getData: k,
4593
+ showErrors: f
4595
4594
  }
4596
- ) : S === "file_upload" ? U = /* @__PURE__ */ e(
4595
+ ) : q === "file_upload" ? $ = /* @__PURE__ */ e(
4597
4596
  Mt,
4598
4597
  {
4599
4598
  existing: o,
4600
4599
  multiple: !1,
4601
4600
  disabled: b
4602
4601
  }
4603
- ) : S === "multi_file_upload" ? U = /* @__PURE__ */ e(
4602
+ ) : q === "multi_file_upload" ? $ = /* @__PURE__ */ e(
4604
4603
  Mt,
4605
4604
  {
4606
4605
  existing: o,
4607
4606
  multiple: !0,
4608
4607
  disabled: b
4609
4608
  }
4610
- ) : S === "switch" ? U = /* @__PURE__ */ e(Bi, { disabled: b }) : S === "number_input" ? U = /* @__PURE__ */ e(Ui, { disabled: b }) : S === "group" ? U = /* @__PURE__ */ e(
4609
+ ) : q === "switch" ? $ = /* @__PURE__ */ e(Bi, { disabled: b }) : q === "number_input" ? $ = /* @__PURE__ */ e(Ui, { disabled: b }) : q === "group" ? $ = /* @__PURE__ */ e(
4611
4610
  Ti,
4612
4611
  {
4613
4612
  disabled: b,
4614
- getData: x,
4615
- allowDataInference: h,
4616
- collectionEditable: y,
4617
- propertyConfigs: _
4613
+ getData: k,
4614
+ allowDataInference: g,
4615
+ collectionEditable: _,
4616
+ propertyConfigs: v
4618
4617
  }
4619
- ) : S === "block" ? U = /* @__PURE__ */ e(
4618
+ ) : q === "block" ? $ = /* @__PURE__ */ e(
4620
4619
  Mi,
4621
4620
  {
4622
4621
  disabled: b,
4623
- getData: x,
4624
- allowDataInference: h,
4625
- collectionEditable: y,
4626
- propertyConfigs: _
4622
+ getData: k,
4623
+ allowDataInference: g,
4624
+ collectionEditable: _,
4625
+ propertyConfigs: v
4627
4626
  }
4628
- ) : S === "reference" ? U = /* @__PURE__ */ e(
4627
+ ) : q === "reference" ? $ = /* @__PURE__ */ e(
4629
4628
  Rt,
4630
4629
  {
4631
- showErrors: g,
4630
+ showErrors: f,
4632
4631
  existing: o,
4633
4632
  multiple: !1,
4634
4633
  disabled: b
4635
4634
  }
4636
- ) : S === "date_time" ? U = /* @__PURE__ */ e(Ki, { disabled: b }) : S === "multi_references" ? U = /* @__PURE__ */ e(
4635
+ ) : q === "date_time" ? $ = /* @__PURE__ */ e(Ki, { disabled: b }) : q === "multi_references" ? $ = /* @__PURE__ */ e(
4637
4636
  Rt,
4638
4637
  {
4639
- showErrors: g,
4638
+ showErrors: f,
4640
4639
  existing: o,
4641
4640
  multiple: !0,
4642
4641
  disabled: b
4643
4642
  }
4644
- ) : S === "repeat" ? U = /* @__PURE__ */ e(
4643
+ ) : q === "repeat" ? $ = /* @__PURE__ */ e(
4645
4644
  Vi,
4646
4645
  {
4647
- showErrors: g,
4646
+ showErrors: f,
4648
4647
  existing: o,
4649
- getData: x,
4650
- allowDataInference: h,
4648
+ getData: k,
4649
+ allowDataInference: g,
4651
4650
  disabled: b,
4652
- collectionEditable: y,
4653
- propertyConfigs: _
4651
+ collectionEditable: _,
4652
+ propertyConfigs: v
4654
4653
  }
4655
- ) : S === "key_value" ? U = /* @__PURE__ */ e(Gi, { disabled: b }) : U = null, /* @__PURE__ */ n(M, { children: [
4654
+ ) : q === "key_value" ? $ = /* @__PURE__ */ e(Gi, { disabled: b }) : $ = null, /* @__PURE__ */ n(U, { children: [
4656
4655
  b && /* @__PURE__ */ n(ea, { mode: "warn", children: [
4657
4656
  /* @__PURE__ */ e(C, { children: "This property can't be edited" }),
4658
4657
  /* @__PURE__ */ n(C, { variant: "caption", children: [
@@ -4666,26 +4665,26 @@ function Qi({
4666
4665
  /* @__PURE__ */ e(
4667
4666
  Se,
4668
4667
  {
4669
- error: !!xe,
4670
- value: S ?? "",
4668
+ error: !!ye,
4669
+ value: q ?? "",
4671
4670
  placeholder: "Select a property widget",
4672
- open: w,
4673
- onOpenChange: q,
4671
+ open: h,
4672
+ onOpenChange: A,
4674
4673
  position: "item-aligned",
4675
4674
  disabled: b,
4676
- renderValue: (W) => {
4677
- if (!W)
4675
+ renderValue: (J) => {
4676
+ if (!J)
4678
4677
  return /* @__PURE__ */ e("em", { children: "Select a property widget" });
4679
- const te = W, me = Zt[te] ?? _[te], ue = me.property, fe = ue && !oe(ue) ? Ze(ue, _) : void 0, ye = oe(ue) || o && ue.dataType !== t?.dataType, Ce = fe ? Y(fe, me) : me;
4678
+ const te = J, me = Zt[te] ?? v[te], ue = me.property, fe = ue && !oe(ue) ? Ze(ue, v) : void 0, ve = oe(ue) || o && ue.dataType !== t?.dataType, Ce = fe ? G(fe, me) : me;
4680
4679
  return /* @__PURE__ */ n(
4681
4680
  "div",
4682
4681
  {
4683
4682
  onClick: (ae) => {
4684
- ye && (ae.stopPropagation(), ae.preventDefault());
4683
+ ve && (ae.stopPropagation(), ae.preventDefault());
4685
4684
  },
4686
- className: ke(
4685
+ className: xe(
4687
4686
  "flex items-center",
4688
- ye ? "w-full pointer-events-none opacity-50" : ""
4687
+ ve ? "w-full pointer-events-none opacity-50" : ""
4689
4688
  ),
4690
4689
  children: [
4691
4690
  /* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(Xe, { propertyConfig: Ce }) }),
@@ -4696,7 +4695,7 @@ function Qi({
4696
4695
  {
4697
4696
  variant: "caption",
4698
4697
  color: "disabled",
4699
- children: ye ? "You can only switch to widgets that use the same data type" : Ce.description
4698
+ children: ve ? "You can only switch to widgets that use the same data type" : Ce.description
4700
4699
  }
4701
4700
  )
4702
4701
  ] })
@@ -4704,25 +4703,25 @@ function Qi({
4704
4703
  }
4705
4704
  );
4706
4705
  },
4707
- onValueChange: (W) => {
4708
- Q(W);
4706
+ onValueChange: (J) => {
4707
+ Z(J);
4709
4708
  },
4710
- children: V.map(([W, te]) => {
4709
+ children: O.map(([J, te]) => {
4711
4710
  const me = te.property, ue = o && !oe(me) && me.dataType !== t?.dataType;
4712
4711
  return /* @__PURE__ */ e(
4713
4712
  sa,
4714
4713
  {
4715
- value: W,
4714
+ value: J,
4716
4715
  optionDisabled: ue,
4717
4716
  propertyConfig: te,
4718
4717
  existing: o
4719
4718
  },
4720
- W
4719
+ J
4721
4720
  );
4722
4721
  })
4723
4722
  }
4724
4723
  ),
4725
- xe && /* @__PURE__ */ e(
4724
+ ye && /* @__PURE__ */ e(
4726
4725
  C,
4727
4726
  {
4728
4727
  variant: "caption",
@@ -4732,13 +4731,13 @@ function Qi({
4732
4731
  }
4733
4732
  )
4734
4733
  ] }),
4735
- c && t?.id && /* @__PURE__ */ e(
4734
+ d && t?.id && /* @__PURE__ */ e(
4736
4735
  ne,
4737
4736
  {
4738
4737
  variant: "ghost",
4739
4738
  className: "m-4",
4740
4739
  disabled: b,
4741
- onClick: () => A(!0),
4740
+ onClick: () => z(!0),
4742
4741
  children: /* @__PURE__ */ e(pt, {})
4743
4742
  }
4744
4743
  )
@@ -4747,23 +4746,23 @@ function Qi({
4747
4746
  m && /* @__PURE__ */ e(
4748
4747
  Ii,
4749
4748
  {
4750
- showErrors: g,
4749
+ showErrors: f,
4751
4750
  disabledId: o,
4752
4751
  isNewProperty: !o,
4753
- existingPropertyKeys: k,
4752
+ existingPropertyKeys: w,
4754
4753
  disabled: b,
4755
- ref: N
4754
+ ref: x
4756
4755
  }
4757
4756
  ),
4758
- U,
4757
+ $,
4759
4758
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Yi, { disabled: b }) })
4760
4759
  ] }),
4761
- c && /* @__PURE__ */ e(
4760
+ d && /* @__PURE__ */ e(
4762
4761
  mt,
4763
4762
  {
4764
- open: F,
4765
- onAccept: () => c(t?.id, d),
4766
- onCancel: () => A(!1),
4763
+ open: E,
4764
+ onAccept: () => d(t?.id, c),
4765
+ onCancel: () => z(!1),
4767
4766
  title: /* @__PURE__ */ e("div", { children: "Delete this property?" }),
4768
4767
  body: /* @__PURE__ */ n("div", { children: [
4769
4768
  " This will ",
@@ -4774,13 +4773,13 @@ function Qi({
4774
4773
  )
4775
4774
  ] });
4776
4775
  }
4777
- function Wi(t) {
4776
+ function Qi(t) {
4778
4777
  return (t.slice(0, 1).toLowerCase() + t.slice(1)).replace(/([-_ ]){1,}/g, " ").split(/[-_ ]/).reduce((a, i) => a + i[0].toUpperCase() + i.substring(1));
4779
4778
  }
4780
4779
  function Zi({ collection: t, onOpenChange: a, open: i }) {
4781
4780
  const r = De(), s = `import { EntityCollection } from "firecms";
4782
4781
 
4783
- const ` + Wi(t.name) + "Collection:EntityCollection = " + si.stringify(da(t), null, " ");
4782
+ const ` + Qi(t.name) + "Collection:EntityCollection = " + si.stringify(da(t), null, " ");
4784
4783
  return /* @__PURE__ */ n(
4785
4784
  Ee,
4786
4785
  {
@@ -4811,13 +4810,13 @@ const ` + Wi(t.name) + "Collection:EntityCollection = " + si.stringify(da(t), nu
4811
4810
  theme: ci.vsDark,
4812
4811
  code: s,
4813
4812
  language: "typescript",
4814
- children: ({ className: o, style: l, tokens: p, getLineProps: m, getTokenProps: u }) => /* @__PURE__ */ e("pre", { style: l, className: "p-4 rounded text-sm", children: p.map((c, d) => /* @__PURE__ */ e("div", { ...m({ line: c }), children: c.map((f, g) => /* @__PURE__ */ e("span", { ...u({ token: f }) }, g)) }, d)) })
4813
+ children: ({ className: o, style: l, tokens: p, getLineProps: m, getTokenProps: u }) => /* @__PURE__ */ e("pre", { style: l, className: "p-4 rounded text-sm", children: p.map((d, c) => /* @__PURE__ */ e("div", { ...m({ line: d }), children: d.map((y, f) => /* @__PURE__ */ e("span", { ...u({ token: y }) }, f)) }, c)) })
4815
4814
  }
4816
4815
  )
4817
4816
  ] }),
4818
4817
  /* @__PURE__ */ n(Le, { children: [
4819
4818
  /* @__PURE__ */ n(
4820
- B,
4819
+ R,
4821
4820
  {
4822
4821
  variant: "text",
4823
4822
  size: "small",
@@ -4831,7 +4830,7 @@ const ` + Wi(t.name) + "Collection:EntityCollection = " + si.stringify(da(t), nu
4831
4830
  ]
4832
4831
  }
4833
4832
  ),
4834
- /* @__PURE__ */ e(B, { onClick: () => a(!1), children: "Close" })
4833
+ /* @__PURE__ */ e(R, { onClick: () => a(!1), children: "Close" })
4835
4834
  ] })
4836
4835
  ]
4837
4836
  }
@@ -4877,109 +4876,102 @@ function Xi({
4877
4876
  getUser: p,
4878
4877
  getData: m,
4879
4878
  doCollectionInference: u,
4880
- propertyConfigs: c,
4881
- collectionEditable: d
4879
+ propertyConfigs: d,
4880
+ collectionEditable: c
4882
4881
  }) {
4883
4882
  const {
4884
- values: f,
4885
- setFieldValue: g,
4883
+ values: y,
4884
+ setFieldValue: f,
4886
4885
  setFieldError: b,
4887
- setFieldTouched: O,
4888
- errors: k,
4889
- dirty: x
4890
- } = K(), h = De(), _ = Ea("lg"), y = !_, [w, q] = $(), [F, A] = $(), [S, E] = $(), v = F ? ce(F, S) : void 0, V = v ? P(f.properties, v.replaceAll(".", ".properties.")) : void 0, [J, N] = $(!1), [R, ge] = $(!1), [xe, Q] = $(!1), [U, W] = $([]), te = L.useRef(f.propertiesOrder ? { "": f.propertiesOrder } : {});
4886
+ setFieldTouched: P,
4887
+ errors: w,
4888
+ dirty: k
4889
+ } = Y(), g = De(), v = Ea("lg"), _ = !v, [h, A] = L(), [E, z] = L(), [q, B] = L(), S = E ? ce(E, q) : void 0, O = S ? N(y.properties, S.replaceAll(".", ".properties.")) : void 0, [j, x] = L(!1), [I, ge] = L(!1), [ye, Z] = L(!1), [$, J] = L([]), te = K.useRef(y.propertiesOrder ? { "": y.propertiesOrder } : {});
4891
4890
  pe(() => {
4892
- s && s(x);
4893
- }, [x]);
4891
+ s && s(k);
4892
+ }, [k]);
4894
4893
  const me = u ? () => {
4895
- u && (ge(!0), u(f).then((z) => {
4896
- if (z && et(z.properties), !z) {
4897
- h.open({
4894
+ u && (ge(!0), u(y).then((V) => {
4895
+ if (V && et(V.properties), !V) {
4896
+ g.open({
4898
4897
  type: "error",
4899
4898
  message: "Could not infer properties from data"
4900
4899
  });
4901
4900
  return;
4902
4901
  }
4903
- const j = (z.properties ? Object.keys(z.properties) : []).filter((le) => !f.properties[le]);
4904
- if (j.length === 0) {
4905
- h.open({
4902
+ const D = (V.properties ? Object.keys(V.properties) : []).filter((le) => !y.properties[le]);
4903
+ if (D.length === 0) {
4904
+ g.open({
4906
4905
  type: "info",
4907
4906
  message: "No new properties found in existing data"
4908
4907
  });
4909
4908
  return;
4910
4909
  }
4911
- const G = {
4912
- ...j.reduce((le, ve) => (le[ve] = (z.properties ?? {})[ve], le), {}),
4913
- ...f.properties
4910
+ const H = {
4911
+ ...D.reduce((le, we) => (le[we] = (V.properties ?? {})[we], le), {}),
4912
+ ...y.properties
4914
4913
  }, se = [
4915
- ...j,
4916
- ...f.propertiesOrder ?? []
4914
+ ...D,
4915
+ ...y.propertiesOrder ?? []
4917
4916
  ];
4918
- g("properties", G, !1), fe(se), W(j);
4917
+ f("properties", H, !1), fe(se), J(D);
4919
4918
  }).finally(() => {
4920
4919
  ge(!1);
4921
4920
  }));
4922
- } : void 0, ue = (z) => z ? te.current[z] ?? P(f, Ne(z)) : te.current[""], fe = (z, j) => {
4923
- const G = Ne(j);
4924
- g(G, z, !1), te.current[j ?? ""] = z;
4925
- }, ye = (z, j) => {
4926
- const G = z ? ce(z, j) : void 0;
4927
- if (!G)
4921
+ } : void 0, ue = (V) => V ? te.current[V] ?? N(y, Pe(V)) : te.current[""], fe = (V, D) => {
4922
+ const H = Pe(D);
4923
+ f(H, V, !1), te.current[D ?? ""] = V;
4924
+ }, ve = (V, D) => {
4925
+ const H = V ? ce(V, D) : void 0;
4926
+ if (!H)
4928
4927
  throw Error("collection editor miss config");
4929
- g(_e(G), void 0, !1);
4930
- const le = ue(j).filter((ve) => ve !== z);
4931
- fe(le, j), Q(!1), q(void 0), A(void 0), E(void 0);
4932
- }, Ce = (z, j) => {
4933
- g(Ne(j), z, !1);
4928
+ f(ke(H), void 0, !1);
4929
+ const le = ue(D).filter((we) => we !== V);
4930
+ fe(le, D), Z(!1), A(void 0), z(void 0), B(void 0);
4931
+ }, Ce = (V, D) => {
4932
+ f(Pe(D), V, !1);
4934
4933
  }, ae = ({
4935
- id: z,
4936
- property: j
4934
+ id: V,
4935
+ property: D
4937
4936
  }) => {
4938
- if (console.log("onPropertyCreated", {
4939
- id: z,
4940
- property: j
4941
- }), !z)
4937
+ if (!V)
4942
4938
  throw Error("Need to include an ID when creating a new property");
4943
- g("properties", {
4944
- ...f.properties ?? {},
4945
- [z]: j
4939
+ f("properties", {
4940
+ ...y.properties ?? {},
4941
+ [V]: D
4946
4942
  }, !1);
4947
- const G = [...f.propertiesOrder ?? Object.keys(f.properties), z];
4948
- console.log("onPropertyCreated", {
4949
- id: z,
4950
- property: j,
4951
- newPropertiesOrder: G
4952
- }), fe(G), Q(!1), _ && (q(G.indexOf(z)), A(z)), E(void 0);
4943
+ const H = [...y.propertiesOrder ?? Object.keys(y.properties), V];
4944
+ fe(H), Z(!1), v && (A(H.indexOf(V)), z(V)), B(void 0);
4953
4945
  }, Ve = ({
4954
- id: z,
4955
- property: j,
4956
- previousId: G,
4946
+ id: V,
4947
+ property: D,
4948
+ previousId: H,
4957
4949
  namespace: se
4958
4950
  }) => {
4959
- const le = z ? ce(z, se) : void 0, ve = le ? _e(le) : void 0;
4960
- if (G && G !== z) {
4961
- const yt = ce(G, se), it = _e(yt), Z = ue(se).map((Ie) => Ie === G ? z : Ie).filter((Ie) => Ie !== void 0);
4962
- fe(Z, se), z && (q(Z.indexOf(z)), A(z)), g(it, void 0, !1), O(it, !1, !1);
4951
+ const le = V ? ce(V, se) : void 0, we = le ? ke(le) : void 0;
4952
+ if (H && H !== V) {
4953
+ const yt = ce(H, se), it = ke(yt), X = ue(se).map((Ie) => Ie === H ? V : Ie).filter((Ie) => Ie !== void 0);
4954
+ fe(X, se), V && (A(X.indexOf(V)), z(V)), f(it, void 0, !1), P(it, !1, !1);
4963
4955
  }
4964
- ve && (g(ve, j, !1), O(ve, !0, !1));
4965
- }, tt = (z, j, G) => {
4966
- const se = z ? ce(z, j) : void 0;
4956
+ we && (f(we, D, !1), P(we, !0, !1));
4957
+ }, tt = (V, D, H) => {
4958
+ const se = V ? ce(V, D) : void 0;
4967
4959
  if (console.warn("onPropertyErrorInternal", {
4968
- id: z,
4969
- namespace: j,
4970
- error: G,
4960
+ id: V,
4961
+ namespace: D,
4962
+ error: H,
4971
4963
  propertyPath: se
4972
4964
  }), se) {
4973
- const le = G && Object.keys(G).length > 0;
4974
- r(z, j, le ? G : void 0), b(_e(se), le ? "Property error" : void 0);
4965
+ const le = H && Object.keys(H).length > 0;
4966
+ r(V, D, le ? H : void 0), b(ke(se), le ? "Property error" : void 0);
4975
4967
  }
4976
4968
  }, bt = () => {
4977
- q(void 0), A(void 0);
4978
- }, T = F && i?.current?.properties ? i.current.properties[F] : void 0, I = f?.propertiesOrder === void 0 || f.propertiesOrder.length === 0, D = f.propertiesOrder ? f.propertiesOrder : Object.keys(f.properties), Oe = Kt(() => p(f.ownerId), [p, f.ownerId]), at = /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
4979
- /* @__PURE__ */ n("div", { className: ke(
4969
+ A(void 0), z(void 0);
4970
+ }, T = E && i?.current?.properties ? i.current.properties[E] : void 0, F = y?.propertiesOrder === void 0 || y.propertiesOrder.length === 0, M = y.propertiesOrder ? y.propertiesOrder : Object.keys(y.properties), Oe = Kt(() => p(y.ownerId), [p, y.ownerId]), at = /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
4971
+ /* @__PURE__ */ n("div", { className: xe(
4980
4972
  "p-4 md:p-8 pb-20 md:pb-20",
4981
4973
  "col-span-12 lg:col-span-5 h-full overflow-auto",
4982
- !y && "border-r " + Pt
4974
+ !_ && "border-r " + Nt
4983
4975
  ), children: [
4984
4976
  /* @__PURE__ */ n("div", { className: "flex my-2", children: [
4985
4977
  /* @__PURE__ */ n("div", { className: "flex-grow mb-4", children: [
@@ -4987,14 +4979,14 @@ function Xi({
4987
4979
  be,
4988
4980
  {
4989
4981
  name: "name",
4990
- as: H,
4982
+ as: W,
4991
4983
  invisible: !0,
4992
4984
  className: "-ml-1",
4993
4985
  inputClassName: "text-2xl font-headers",
4994
4986
  placeholder: "Collection name",
4995
4987
  size: "small",
4996
4988
  required: !0,
4997
- error: !!k?.name
4989
+ error: !!w?.name
4998
4990
  }
4999
4991
  ),
5000
4992
  Oe && /* @__PURE__ */ n(
@@ -5016,8 +5008,8 @@ function Xi({
5016
5008
  ne,
5017
5009
  {
5018
5010
  variant: "filled",
5019
- disabled: R,
5020
- onClick: () => N(!0),
5011
+ disabled: I,
5012
+ onClick: () => x(!0),
5021
5013
  children: /* @__PURE__ */ e(Da, {})
5022
5014
  }
5023
5015
  ) }),
@@ -5025,58 +5017,58 @@ function Xi({
5025
5017
  ne,
5026
5018
  {
5027
5019
  variant: "filled",
5028
- disabled: R,
5020
+ disabled: I,
5029
5021
  onClick: me,
5030
- children: R ? /* @__PURE__ */ e(We, { size: "small" }) : /* @__PURE__ */ e(gt, {})
5022
+ children: I ? /* @__PURE__ */ e(Qe, { size: "small" }) : /* @__PURE__ */ e(gt, {})
5031
5023
  }
5032
5024
  ) }),
5033
5025
  /* @__PURE__ */ e(re, { title: "Add new property", children: /* @__PURE__ */ e(
5034
- B,
5026
+ R,
5035
5027
  {
5036
5028
  variant: "outlined",
5037
- onClick: () => Q(!0),
5029
+ onClick: () => Z(!0),
5038
5030
  children: /* @__PURE__ */ e(Ae, {})
5039
5031
  }
5040
5032
  ) })
5041
5033
  ] })
5042
5034
  ] }),
5043
- /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
5035
+ /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(
5044
5036
  ft,
5045
5037
  {
5046
5038
  className: "pl-8",
5047
- onPropertyClick: (z, j) => {
5048
- q(D.indexOf(z)), A(z), E(j);
5039
+ onPropertyClick: (V, D) => {
5040
+ A(M.indexOf(V)), z(V), B(D);
5049
5041
  },
5050
- inferredPropertyKeys: U,
5051
- selectedPropertyKey: F ? ce(F, S) : void 0,
5052
- properties: f.properties,
5053
- additionalFields: f.additionalFields,
5054
- propertiesOrder: D,
5042
+ inferredPropertyKeys: $,
5043
+ selectedPropertyKey: E ? ce(E, q) : void 0,
5044
+ properties: y.properties,
5045
+ additionalFields: y.additionalFields,
5046
+ propertiesOrder: M,
5055
5047
  onPropertyMove: Ce,
5056
- onPropertyRemove: a ? ye : void 0,
5057
- collectionEditable: d,
5058
- errors: t ? k : {}
5048
+ onPropertyRemove: a ? ve : void 0,
5049
+ collectionEditable: c,
5050
+ errors: t ? w : {}
5059
5051
  }
5060
5052
  ) }),
5061
5053
  /* @__PURE__ */ e(
5062
- B,
5054
+ R,
5063
5055
  {
5064
5056
  className: "mt-8 w-full",
5065
5057
  color: "primary",
5066
5058
  variant: "outlined",
5067
5059
  size: "large",
5068
- onClick: () => Q(!0),
5060
+ onClick: () => Z(!0),
5069
5061
  startIcon: /* @__PURE__ */ e(Ae, {}),
5070
5062
  children: "Add new property"
5071
5063
  }
5072
5064
  )
5073
5065
  ] }),
5074
- !y && /* @__PURE__ */ e("div", { className: "col-span-12 lg:col-span-7 ml-2 p-4 md:p-8 h-full overflow-auto pb-20 md:pb-20", children: /* @__PURE__ */ n(
5066
+ !_ && /* @__PURE__ */ e("div", { className: "col-span-12 lg:col-span-7 ml-2 p-4 md:p-8 h-full overflow-auto pb-20 md:pb-20", children: /* @__PURE__ */ n(
5075
5067
  qe,
5076
5068
  {
5077
5069
  className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ",
5078
5070
  children: [
5079
- v && V && !oe(V) && /* @__PURE__ */ e(
5071
+ S && O && !oe(O) && /* @__PURE__ */ e(
5080
5072
  ca,
5081
5073
  {
5082
5074
  inArray: !1,
@@ -5084,51 +5076,51 @@ function Xi({
5084
5076
  autoUpdateId: !1,
5085
5077
  allowDataInference: !a,
5086
5078
  autoOpenTypeSelect: !1,
5087
- propertyKey: F,
5088
- propertyNamespace: S,
5089
- property: V,
5079
+ propertyKey: E,
5080
+ propertyNamespace: q,
5081
+ property: O,
5090
5082
  onPropertyChanged: Ve,
5091
- onDelete: ye,
5083
+ onDelete: ve,
5092
5084
  onError: tt,
5093
5085
  forceShowErrors: t,
5094
5086
  initialErrors: T,
5095
5087
  getData: m,
5096
- propertyConfigs: c,
5097
- collectionEditable: d
5088
+ propertyConfigs: d,
5089
+ collectionEditable: c
5098
5090
  },
5099
- `edit_view_${w}`
5091
+ `edit_view_${h}`
5100
5092
  ),
5101
- !V && /* @__PURE__ */ e(C, { variant: "label", className: "flex items-center justify-center h-full", children: I ? "Now you can add your first property" : "Select a property to edit it" }),
5102
- V && oe(V) && /* @__PURE__ */ e(C, { variant: "label", className: "flex items-center justify-center", children: "This property is defined as a property builder in code" })
5093
+ !O && /* @__PURE__ */ e(C, { variant: "label", className: "flex items-center justify-center h-full", children: F ? "Now you can add your first property" : "Select a property to edit it" }),
5094
+ O && oe(O) && /* @__PURE__ */ e(C, { variant: "label", className: "flex items-center justify-center", children: "This property is defined as a property builder in code" })
5103
5095
  ]
5104
5096
  }
5105
5097
  ) }),
5106
- y && /* @__PURE__ */ e(
5098
+ _ && /* @__PURE__ */ e(
5107
5099
  je,
5108
5100
  {
5109
5101
  inArray: !1,
5110
- open: w !== void 0,
5102
+ open: h !== void 0,
5111
5103
  autoUpdateId: a,
5112
5104
  allowDataInference: !a,
5113
5105
  existingProperty: !0,
5114
5106
  autoOpenTypeSelect: !1,
5115
- propertyKey: F,
5116
- propertyNamespace: S,
5117
- property: V,
5107
+ propertyKey: E,
5108
+ propertyNamespace: q,
5109
+ property: O,
5118
5110
  onPropertyChanged: Ve,
5119
- onDelete: ye,
5111
+ onDelete: ve,
5120
5112
  onError: tt,
5121
5113
  forceShowErrors: t,
5122
5114
  initialErrors: T,
5123
5115
  getData: m,
5124
- propertyConfigs: c,
5125
- collectionEditable: d,
5126
- onOkClicked: y ? bt : void 0
5116
+ propertyConfigs: d,
5117
+ collectionEditable: c,
5118
+ onOkClicked: _ ? bt : void 0
5127
5119
  },
5128
- `edit_view_${w}`
5120
+ `edit_view_${h}`
5129
5121
  )
5130
5122
  ] });
5131
- return /* @__PURE__ */ n(M, { children: [
5123
+ return /* @__PURE__ */ n(U, { children: [
5132
5124
  at,
5133
5125
  /* @__PURE__ */ e(
5134
5126
  je,
@@ -5138,22 +5130,22 @@ function Xi({
5138
5130
  autoOpenTypeSelect: !0,
5139
5131
  autoUpdateId: !0,
5140
5132
  forceShowErrors: t,
5141
- open: xe,
5142
- onCancel: () => Q(!1),
5133
+ open: ye,
5134
+ onCancel: () => Z(!1),
5143
5135
  onPropertyChanged: ae,
5144
5136
  getData: m,
5145
5137
  allowDataInference: !a,
5146
- propertyConfigs: c,
5147
- collectionEditable: d,
5148
- existingPropertyKeys: f.propertiesOrder
5138
+ propertyConfigs: d,
5139
+ collectionEditable: c,
5140
+ existingPropertyKeys: y.propertiesOrder
5149
5141
  }
5150
5142
  ),
5151
5143
  /* @__PURE__ */ e(
5152
5144
  Zi,
5153
5145
  {
5154
- collection: f,
5155
- open: J,
5156
- onOpenChange: N
5146
+ collection: y,
5147
+ open: j,
5148
+ onOpenChange: x
5157
5149
  }
5158
5150
  )
5159
5151
  ] });
@@ -5179,8 +5171,8 @@ function er({
5179
5171
  /* @__PURE__ */ e(C, { children: "Are you sure?" })
5180
5172
  ] }),
5181
5173
  /* @__PURE__ */ n(Le, { children: [
5182
- /* @__PURE__ */ e(B, { variant: "text", onClick: i, autoFocus: !0, children: " Cancel " }),
5183
- /* @__PURE__ */ e(B, { onClick: a, children: " Ok " })
5174
+ /* @__PURE__ */ e(R, { variant: "text", onClick: i, autoFocus: !0, children: " Cancel " }),
5175
+ /* @__PURE__ */ e(R, { onClick: a, children: " Ok " })
5184
5176
  ] })
5185
5177
  ]
5186
5178
  }
@@ -5199,7 +5191,7 @@ function tr({ open: t, onClose: a }) {
5199
5191
  /* @__PURE__ */ n($e, { children: [
5200
5192
  /* @__PURE__ */ e(C, { variant: "h6", children: "Select view" }),
5201
5193
  i?.map((r) => /* @__PURE__ */ n(
5202
- B,
5194
+ R,
5203
5195
  {
5204
5196
  onClick: () => a(r.key),
5205
5197
  fullWidth: !0,
@@ -5215,7 +5207,7 @@ function tr({ open: t, onClose: a }) {
5215
5207
  )),
5216
5208
  (i ?? []).length === 0 && /* @__PURE__ */ e(C, { variant: "body2", children: "No custom views defined" })
5217
5209
  ] }),
5218
- /* @__PURE__ */ e(Le, { children: /* @__PURE__ */ e(B, { onClick: () => a(), children: "Cancel" }) })
5210
+ /* @__PURE__ */ e(Le, { children: /* @__PURE__ */ e(R, { onClick: () => a(), children: "Cancel" }) })
5219
5211
  ]
5220
5212
  }
5221
5213
  );
@@ -5228,30 +5220,30 @@ function ar({
5228
5220
  getUser: s,
5229
5221
  parentCollectionIds: o
5230
5222
  }) {
5231
- const { entityViews: l } = Ke(), [p, m] = L.useState(), [u, c] = L.useState(!1), [d, f] = L.useState(), [g, b] = L.useState(), {
5232
- values: O,
5233
- setFieldValue: k
5234
- } = K(), x = t.subcollections ?? [], h = O.entityViews?.filter((w) => typeof w == "string").map((w) => Ba(w, l)).filter(Boolean) ?? [], _ = t.entityViews?.filter((w) => typeof w != "string") ?? [], y = h.length + _.length;
5223
+ const { entityViews: l } = Ke(), [p, m] = K.useState(), [u, d] = K.useState(!1), [c, y] = K.useState(), [f, b] = K.useState(), {
5224
+ values: P,
5225
+ setFieldValue: w
5226
+ } = Y(), k = t.subcollections ?? [], g = P.entityViews?.filter((h) => typeof h == "string").map((h) => Ba(h, l)).filter(Boolean) ?? [], v = t.entityViews?.filter((h) => typeof h != "string") ?? [], _ = g.length + v.length;
5235
5227
  return /* @__PURE__ */ n("div", { className: "overflow-auto my-auto", children: [
5236
5228
  /* @__PURE__ */ e(ht, { maxWidth: "2xl", className: "flex flex-col gap-4 p-8 m-auto", children: /* @__PURE__ */ n("div", { className: "flex flex-col gap-16", children: [
5237
5229
  /* @__PURE__ */ n("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
5238
5230
  /* @__PURE__ */ n(C, { variant: "h5", children: [
5239
5231
  "Subcollections of ",
5240
- O.name
5232
+ P.name
5241
5233
  ] }),
5242
- x && x.length > 0 && /* @__PURE__ */ e(qe, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(It, { children: /* @__PURE__ */ e(Ft, { children: x.map((w) => /* @__PURE__ */ n(
5234
+ k && k.length > 0 && /* @__PURE__ */ e(qe, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(It, { children: /* @__PURE__ */ e(Ft, { children: k.map((h) => /* @__PURE__ */ n(
5243
5235
  wt,
5244
5236
  {
5245
5237
  onClick: () => b({
5246
5238
  isNewCollection: !1,
5247
- editedCollectionPath: w.path
5239
+ editedCollectionPath: h.path
5248
5240
  }),
5249
5241
  children: [
5250
5242
  /* @__PURE__ */ e(
5251
5243
  Ge,
5252
5244
  {
5253
5245
  align: "left",
5254
- children: /* @__PURE__ */ e(C, { variant: "subtitle2", className: "flex-grow", children: w.name })
5246
+ children: /* @__PURE__ */ e(C, { variant: "subtitle2", className: "flex-grow", children: h.name })
5255
5247
  }
5256
5248
  ),
5257
5249
  /* @__PURE__ */ e(
@@ -5262,8 +5254,8 @@ function ar({
5262
5254
  ne,
5263
5255
  {
5264
5256
  size: "small",
5265
- onClick: (q) => {
5266
- q.preventDefault(), q.stopPropagation(), m(w.path);
5257
+ onClick: (A) => {
5258
+ A.preventDefault(), A.stopPropagation(), m(h.path);
5267
5259
  },
5268
5260
  color: "inherit",
5269
5261
  children: /* @__PURE__ */ e(pt, { size: "small" })
@@ -5273,10 +5265,10 @@ function ar({
5273
5265
  )
5274
5266
  ]
5275
5267
  },
5276
- w.path
5268
+ h.path
5277
5269
  )) }) }) }),
5278
5270
  /* @__PURE__ */ e(
5279
- B,
5271
+ R,
5280
5272
  {
5281
5273
  onClick: () => {
5282
5274
  b({
@@ -5291,13 +5283,13 @@ function ar({
5291
5283
  ] }),
5292
5284
  /* @__PURE__ */ n("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
5293
5285
  /* @__PURE__ */ e(C, { variant: "h5", children: "Custom views" }),
5294
- y > 0 && /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(qe, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(It, { children: /* @__PURE__ */ n(Ft, { children: [
5295
- h.map((w) => /* @__PURE__ */ n(wt, { children: [
5286
+ _ > 0 && /* @__PURE__ */ e(U, { children: /* @__PURE__ */ e(qe, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(It, { children: /* @__PURE__ */ n(Ft, { children: [
5287
+ g.map((h) => /* @__PURE__ */ n(wt, { children: [
5296
5288
  /* @__PURE__ */ e(
5297
5289
  Ge,
5298
5290
  {
5299
5291
  align: "left",
5300
- children: /* @__PURE__ */ e(C, { variant: "subtitle2", className: "flex-grow", children: w.name })
5292
+ children: /* @__PURE__ */ e(C, { variant: "subtitle2", className: "flex-grow", children: h.name })
5301
5293
  }
5302
5294
  ),
5303
5295
  /* @__PURE__ */ e(
@@ -5308,8 +5300,8 @@ function ar({
5308
5300
  ne,
5309
5301
  {
5310
5302
  size: "small",
5311
- onClick: (q) => {
5312
- q.preventDefault(), q.stopPropagation(), f(w.key);
5303
+ onClick: (A) => {
5304
+ A.preventDefault(), A.stopPropagation(), y(h.key);
5313
5305
  },
5314
5306
  color: "inherit",
5315
5307
  children: /* @__PURE__ */ e(pt, { size: "small" })
@@ -5317,30 +5309,30 @@ function ar({
5317
5309
  ) })
5318
5310
  }
5319
5311
  )
5320
- ] }, w.key)),
5321
- _.map((w) => /* @__PURE__ */ e(wt, { children: /* @__PURE__ */ n(
5312
+ ] }, h.key)),
5313
+ v.map((h) => /* @__PURE__ */ e(wt, { children: /* @__PURE__ */ n(
5322
5314
  Ge,
5323
5315
  {
5324
5316
  align: "left",
5325
5317
  children: [
5326
- /* @__PURE__ */ e(C, { variant: "subtitle2", className: "flex-grow", children: w.name }),
5318
+ /* @__PURE__ */ e(C, { variant: "subtitle2", className: "flex-grow", children: h.name }),
5327
5319
  /* @__PURE__ */ n(C, { variant: "caption", className: "flex-grow", children: [
5328
5320
  "This view is defined in code with key ",
5329
- /* @__PURE__ */ e("code", { children: w.key })
5321
+ /* @__PURE__ */ e("code", { children: h.key })
5330
5322
  ] })
5331
5323
  ]
5332
5324
  }
5333
- ) }, w.key))
5325
+ ) }, h.key))
5334
5326
  ] }) }) }) }),
5335
- y === 0 && /* @__PURE__ */ n(ea, { children: [
5327
+ _ === 0 && /* @__PURE__ */ n(ea, { children: [
5336
5328
  /* @__PURE__ */ e("b", { children: "COMING SOON" }),
5337
5329
  " Define your own custom views by uploading it with the CLI"
5338
5330
  ] }),
5339
5331
  /* @__PURE__ */ e(
5340
- B,
5332
+ R,
5341
5333
  {
5342
5334
  onClick: () => {
5343
- c(!0);
5335
+ d(!0);
5344
5336
  },
5345
5337
  variant: "outlined",
5346
5338
  startIcon: /* @__PURE__ */ e(Ae, {}),
@@ -5361,24 +5353,24 @@ function ar({
5361
5353
  }), m(void 0);
5362
5354
  },
5363
5355
  onCancel: () => m(void 0),
5364
- title: /* @__PURE__ */ e(M, { children: "Delete this subcollection?" }),
5365
- body: /* @__PURE__ */ n(M, { children: [
5356
+ title: /* @__PURE__ */ e(U, { children: "Delete this subcollection?" }),
5357
+ body: /* @__PURE__ */ n(U, { children: [
5366
5358
  " This will ",
5367
5359
  /* @__PURE__ */ e("b", { children: "not delete any data" }),
5368
5360
  ", only the collection in the CMS"
5369
5361
  ] })
5370
5362
  }
5371
5363
  ),
5372
- d && /* @__PURE__ */ e(
5364
+ c && /* @__PURE__ */ e(
5373
5365
  mt,
5374
5366
  {
5375
- open: !!d,
5367
+ open: !!c,
5376
5368
  onAccept: () => {
5377
- k("entityViews", O.entityViews?.filter((w) => w !== d)), f(void 0);
5369
+ w("entityViews", P.entityViews?.filter((h) => h !== c)), y(void 0);
5378
5370
  },
5379
- onCancel: () => f(void 0),
5380
- title: /* @__PURE__ */ e(M, { children: "Remove this view?" }),
5381
- body: /* @__PURE__ */ n(M, { children: [
5371
+ onCancel: () => y(void 0),
5372
+ title: /* @__PURE__ */ e(U, { children: "Remove this view?" }),
5373
+ body: /* @__PURE__ */ n(U, { children: [
5382
5374
  "This will ",
5383
5375
  /* @__PURE__ */ e("b", { children: "not delete any data" }),
5384
5376
  ", only the view in the CMS"
@@ -5388,13 +5380,13 @@ function ar({
5388
5380
  /* @__PURE__ */ e(
5389
5381
  ma,
5390
5382
  {
5391
- open: !!g,
5383
+ open: !!f,
5392
5384
  configController: i,
5393
5385
  parentCollection: t,
5394
5386
  collectionInference: r,
5395
- parentCollectionIds: [...o ?? [], O.id],
5387
+ parentCollectionIds: [...o ?? [], P.id],
5396
5388
  isNewCollection: !1,
5397
- ...g,
5389
+ ...f,
5398
5390
  getUser: s,
5399
5391
  handleClose: () => {
5400
5392
  b(void 0);
@@ -5405,8 +5397,8 @@ function ar({
5405
5397
  tr,
5406
5398
  {
5407
5399
  open: u,
5408
- onClose: (w) => {
5409
- w && (console.log("selectedViewKey", w), k("entityViews", [...O.entityViews ?? [], w])), c(!1);
5400
+ onClose: (h) => {
5401
+ h && w("entityViews", [...P.entityViews ?? [], h]), d(!1);
5410
5402
  }
5411
5403
  }
5412
5404
  )
@@ -5648,24 +5640,24 @@ function ir({
5648
5640
  onContinue: r,
5649
5641
  collections: s
5650
5642
  }) {
5651
- const [o, l] = $(!1), [p, m] = $();
5643
+ const [o, l] = L(!1), [p, m] = L();
5652
5644
  pe(() => {
5653
- a && s && (l(!0), a(t).then((h) => {
5654
- const _ = h.filter((y) => !s.find((w) => w.path.trim().toLowerCase() === y.trim().toLowerCase()));
5655
- m(_);
5645
+ a && s && (l(!0), a(t).then((g) => {
5646
+ const v = g.filter((_) => !s.find((h) => h.path.trim().toLowerCase() === _.trim().toLowerCase()));
5647
+ m(v);
5656
5648
  }).finally(() => l(!1)));
5657
5649
  }, [s, t, a]);
5658
5650
  const {
5659
5651
  values: u,
5660
- setFieldValue: c,
5661
- setValues: d,
5662
- handleChange: f,
5663
- touched: g,
5652
+ setFieldValue: d,
5653
+ setValues: c,
5654
+ handleChange: y,
5655
+ touched: f,
5664
5656
  errors: b,
5665
- setFieldTouched: O,
5666
- isSubmitting: k,
5667
- submitCount: x
5668
- } = K();
5657
+ setFieldTouched: P,
5658
+ isSubmitting: w,
5659
+ submitCount: k
5660
+ } = Y();
5669
5661
  return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ n(ht, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
5670
5662
  /* @__PURE__ */ e(
5671
5663
  "div",
@@ -5688,18 +5680,18 @@ function ir({
5688
5680
  }
5689
5681
  ),
5690
5682
  /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
5691
- o && !p && /* @__PURE__ */ e(We, { size: "small" }),
5692
- p?.map((h, _) => /* @__PURE__ */ e(
5683
+ o && !p && /* @__PURE__ */ e(Qe, { size: "small" }),
5684
+ p?.map((g, v) => /* @__PURE__ */ e(
5693
5685
  dt,
5694
5686
  {
5695
5687
  colorScheme: "cyanLighter",
5696
5688
  onClick: () => {
5697
- c("name", Nt(h)), c("path", h), c("properties", void 0), r();
5689
+ d("name", Pt(g)), d("path", g), d("properties", void 0), r();
5698
5690
  },
5699
5691
  size: "small",
5700
- children: h
5692
+ children: g
5701
5693
  },
5702
- h
5694
+ g
5703
5695
  )),
5704
5696
  !o && p?.length === 0 && /* @__PURE__ */ e(C, { variant: "caption", children: "No suggestions" })
5705
5697
  ] })
@@ -5721,7 +5713,7 @@ function ir({
5721
5713
  subtitle: "A collection of products with images, prices and stock",
5722
5714
  icon: /* @__PURE__ */ e(lt, { size: "small", iconKey: Ut.icon }),
5723
5715
  onClick: () => {
5724
- d(Ut), r();
5716
+ c(Ut), r();
5725
5717
  }
5726
5718
  }
5727
5719
  ),
@@ -5732,7 +5724,7 @@ function ir({
5732
5724
  subtitle: "A collection of blog posts with images, authors and complex content",
5733
5725
  icon: /* @__PURE__ */ e(lt, { size: "small", iconKey: $t.icon }),
5734
5726
  onClick: () => {
5735
- d($t), r();
5727
+ c($t), r();
5736
5728
  }
5737
5729
  }
5738
5730
  ),
@@ -5743,7 +5735,7 @@ function ir({
5743
5735
  subtitle: "A collection of users with emails, names and roles",
5744
5736
  icon: /* @__PURE__ */ e(lt, { size: "small", iconKey: Lt.icon }),
5745
5737
  onClick: () => {
5746
- d(Lt), r();
5738
+ c(Lt), r();
5747
5739
  }
5748
5740
  }
5749
5741
  )
@@ -5759,9 +5751,9 @@ function ir({
5759
5751
  children: "● Create a collection from a file (csv, json, xls, xslx...)"
5760
5752
  }
5761
5753
  ),
5762
- /* @__PURE__ */ e(di, { onDataAdded: (h) => r(h) })
5754
+ /* @__PURE__ */ e(di, { onDataAdded: (g) => r(g) })
5763
5755
  ] }),
5764
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(B, { variant: "text", onClick: () => r(), className: "my-2", children: "Continue from scratch" }) })
5756
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(R, { variant: "text", onClick: () => r(), className: "my-2", children: "Continue from scratch" }) })
5765
5757
  ] }) });
5766
5758
  }
5767
5759
  function kt({
@@ -5774,7 +5766,7 @@ function kt({
5774
5766
  ta,
5775
5767
  {
5776
5768
  onClick: r,
5777
- className: ke(
5769
+ className: xe(
5778
5770
  "my-2 rounded-md border mx-0 p-6 px-4 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center",
5779
5771
  "text-gray-700 dark:text-gray-300",
5780
5772
  "hover:border-blue-600 hover:text-blue-600 dark:hover:text-blue-400 focus:ring-blue-400 hover:ring-1 hover:ring-primary",
@@ -5804,39 +5796,36 @@ function rr({
5804
5796
  setFieldValue: r,
5805
5797
  setFieldTouched: s,
5806
5798
  values: o
5807
- } = K(), [l, p] = $(void 0), m = L.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), u = l ? l.id : void 0, c = l || void 0, d = ({
5808
- id: g,
5799
+ } = Y(), [l, p] = L(void 0), m = K.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), u = l ? l.id : void 0, d = l || void 0, c = ({
5800
+ id: f,
5809
5801
  property: b,
5810
- previousId: O,
5811
- namespace: k
5802
+ previousId: P,
5803
+ namespace: w
5812
5804
  }) => {
5813
- const x = g ? ce(g, k) : void 0, h = x ? _e(x) : void 0, _ = (w) => w ? m.current[w] ?? P(o, Ne(w)) : m.current[""], y = (w, q) => {
5814
- const F = Ne(q);
5815
- r(F, w, !1), m.current[q ?? ""] = w;
5805
+ const k = f ? ce(f, w) : void 0, g = k ? ke(k) : void 0, v = (h) => h ? m.current[h] ?? N(o, Pe(h)) : m.current[""], _ = (h, A) => {
5806
+ const E = Pe(A);
5807
+ r(E, h, !1), m.current[A ?? ""] = h;
5816
5808
  };
5817
- if (O && O !== g) {
5818
- const w = ce(O, k), q = _e(w), A = _(k).map((E) => E === O ? g : E).filter((E) => E !== void 0);
5819
- y(A, k);
5820
- const S = { ...t.headersMapping };
5821
- Object.keys(S).forEach((E) => {
5822
- S[E] === O && (S[E] = g ?? "");
5823
- }), t.setHeadersMapping(S), r(q, void 0, !1), s(q, !1, !1);
5809
+ if (P && P !== f) {
5810
+ const h = ce(P, w), A = ke(h), z = v(w).map((B) => B === P ? f : B).filter((B) => B !== void 0);
5811
+ _(z, w);
5812
+ const q = { ...t.headersMapping };
5813
+ Object.keys(q).forEach((B) => {
5814
+ q[B] === P && (q[B] = f ?? "");
5815
+ }), t.setHeadersMapping(q), r(A, void 0, !1), s(A, !1, !1);
5824
5816
  }
5825
- h && (r(h, b, !1), s(h, !0, !1));
5826
- }, f = async ({
5827
- id: g,
5817
+ g && (r(g, b, !1), s(g, !0, !1));
5818
+ }, y = async ({
5819
+ id: f,
5828
5820
  importKey: b,
5829
- property: O,
5830
- namespace: k
5821
+ property: P,
5822
+ namespace: w
5831
5823
  }) => {
5832
- const x = g ? ce(g, k) : void 0, h = x ? _e(x) : void 0, _ = t.importData.map((w) => P(w, b)), y = {
5833
- ...ai(_, O, ia),
5824
+ const k = f ? ce(f, w) : void 0, g = k ? ke(k) : void 0, v = t.importData.map((h) => N(h, b)), _ = {
5825
+ ...ai(v, P, ia),
5834
5826
  editable: !0
5835
5827
  };
5836
- h && (y ? (console.log("updating inferredNewProperty", {
5837
- property: O,
5838
- inferredNewProperty: y
5839
- }), r(h, y, !1)) : r(h, O, !1), s(h, !0, !1));
5828
+ g && (_ ? r(g, _, !1) : r(g, P, !1), s(g, !0, !1));
5840
5829
  };
5841
5830
  return /* @__PURE__ */ n("div", { className: "overflow-auto my-auto bg-gray-50 dark:bg-gray-900", children: [
5842
5831
  /* @__PURE__ */ n(ht, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
@@ -5848,20 +5837,20 @@ function rr({
5848
5837
  idColumn: t.idColumn,
5849
5838
  originProperties: t.originProperties,
5850
5839
  destinationProperties: o.properties,
5851
- onIdPropertyChanged: (g) => t.setIdColumn(g),
5840
+ onIdPropertyChanged: (f) => t.setIdColumn(f),
5852
5841
  buildPropertyView: ({
5853
- property: g,
5842
+ property: f,
5854
5843
  propertyKey: b,
5855
- importKey: O
5844
+ importKey: P
5856
5845
  }) => /* @__PURE__ */ e(
5857
5846
  mi,
5858
5847
  {
5859
- property: g,
5848
+ property: f,
5860
5849
  propertyKey: b,
5861
- onPropertyNameChanged: (k, x) => r(`properties.${k}.name`, x, !1),
5850
+ onPropertyNameChanged: (w, k) => r(`properties.${w}.name`, k, !1),
5862
5851
  onEditClick: () => {
5863
- !b || !g || p({
5864
- ...g,
5852
+ !b || !f || p({
5853
+ ...f,
5865
5854
  id: b,
5866
5855
  editable: !0
5867
5856
  });
@@ -5869,11 +5858,11 @@ function rr({
5869
5858
  propertyTypeView: /* @__PURE__ */ e(
5870
5859
  or,
5871
5860
  {
5872
- property: g,
5861
+ property: f,
5873
5862
  disabled: !1,
5874
- onPropertyChanged: (k) => f({
5875
- ...k,
5876
- importKey: O
5863
+ onPropertyChanged: (w) => y({
5864
+ ...w,
5865
+ importKey: P
5877
5866
  }),
5878
5867
  propertyKey: b,
5879
5868
  propertyConfigs: a
@@ -5889,10 +5878,10 @@ function rr({
5889
5878
  {
5890
5879
  open: l !== void 0,
5891
5880
  propertyKey: u,
5892
- property: c,
5881
+ property: d,
5893
5882
  inArray: !1,
5894
5883
  autoUpdateId: !1,
5895
- onPropertyChanged: d,
5884
+ onPropertyChanged: c,
5896
5885
  allowDataInference: !1,
5897
5886
  collectionEditable: i,
5898
5887
  onOkClicked: () => {
@@ -5916,7 +5905,7 @@ function or({
5916
5905
  propertyConfigs: r,
5917
5906
  disabled: s
5918
5907
  }) {
5919
- const o = t ? Xt(t) : null, l = t ? Ze(t, r) : null, [p, m] = $(!1);
5908
+ const o = t ? Xt(t) : null, l = t ? Ze(t, r) : null, [p, m] = L(!1);
5920
5909
  return /* @__PURE__ */ e(
5921
5910
  re,
5922
5911
  {
@@ -5936,20 +5925,20 @@ function or({
5936
5925
  position: "item-aligned",
5937
5926
  renderValue: (u) => l ? /* @__PURE__ */ e(Xe, { propertyConfig: l }) : null,
5938
5927
  onValueChange: (u) => {
5939
- const c = na(t, u, r);
5940
- i && (a({
5928
+ const d = na(t, u, r);
5929
+ i && a({
5941
5930
  id: i,
5942
- property: c,
5931
+ property: d,
5943
5932
  previousId: i,
5944
5933
  namespace: void 0
5945
- }), console.log("newSelectedWidgetId", u));
5934
+ });
5946
5935
  },
5947
- children: Object.entries(la).map(([u, c]) => /* @__PURE__ */ e(
5936
+ children: Object.entries(la).map(([u, d]) => /* @__PURE__ */ e(
5948
5937
  sa,
5949
5938
  {
5950
5939
  value: u,
5951
5940
  optionDisabled: !1,
5952
- propertyConfig: c,
5941
+ propertyConfig: d,
5953
5942
  existing: !1
5954
5943
  },
5955
5944
  u
@@ -5962,7 +5951,7 @@ function or({
5962
5951
  function nr({ importConfig: t, properties: a, propertiesOrder: i }) {
5963
5952
  pe(() => {
5964
5953
  const s = ui(t.originProperties, a), o = t.importData.map((l) => hi(l, t.idColumn, t.headersMapping, a, s, "TEMP_PATH"));
5965
- t.setEntities(o), console.log("res", { propertiesMapping: s, mappedData: o });
5954
+ t.setEntities(o);
5966
5955
  }, []);
5967
5956
  const r = Ma();
5968
5957
  return /* @__PURE__ */ e(
@@ -5990,26 +5979,26 @@ function pa(t, a = "") {
5990
5979
  const i = Object.keys(t).reduce((o, l) => {
5991
5980
  const p = t[l], m = Ua(l), u = a ? `${a}.${m}` : m;
5992
5981
  if (p.dataType === "map" && p.properties) {
5993
- const f = pa(p.properties, u);
5982
+ const y = pa(p.properties, u);
5994
5983
  return {
5995
5984
  headersMapping: { ...o.headersMapping, [l]: u },
5996
5985
  properties: {
5997
5986
  ...o.properties,
5998
5987
  [m]: {
5999
5988
  ...p,
6000
- properties: f.properties,
6001
- propertiesOrder: Object.keys(f.properties)
5989
+ properties: y.properties,
5990
+ propertiesOrder: Object.keys(y.properties)
6002
5991
  }
6003
5992
  }
6004
5993
  };
6005
5994
  }
6006
- const c = {
5995
+ const d = {
6007
5996
  ...o.properties,
6008
5997
  [m]: p
6009
5998
  };
6010
5999
  return {
6011
6000
  headersMapping: { ...o.headersMapping, [l]: u },
6012
- properties: c
6001
+ properties: d
6013
6002
  };
6014
6003
  }, { headersMapping: {}, properties: {} }), r = Object.keys(i.headersMapping)?.[0];
6015
6004
  let s;
@@ -6019,7 +6008,7 @@ function pa(t, a = "") {
6019
6008
  };
6020
6009
  }
6021
6010
  function ma(t) {
6022
- const a = t.open, [i, r] = we.useState(!1), [s, o] = we.useState(!1), l = X(() => {
6011
+ const a = t.open, [i, r] = _e.useState(!1), [s, o] = _e.useState(!1), l = Q(() => {
6023
6012
  i ? o(!0) : t.handleClose(void 0);
6024
6013
  }, [i, t.handleClose]);
6025
6014
  return pe(() => {
@@ -6066,44 +6055,44 @@ function sr({
6066
6055
  handleClose: p,
6067
6056
  reservedGroups: m,
6068
6057
  extraView: u,
6069
- handleCancel: c,
6070
- setFormDirty: d,
6071
- pathSuggestions: f,
6072
- getUser: g,
6058
+ handleCancel: d,
6059
+ setFormDirty: c,
6060
+ pathSuggestions: y,
6061
+ getUser: f,
6073
6062
  parentCollection: b,
6074
- getData: O
6063
+ getData: P
6075
6064
  }) {
6076
- const { propertyConfigs: k } = Ke(), x = Be(), {
6077
- topLevelNavigation: h,
6078
- collections: _
6079
- } = x, y = !a?.path && (s ?? []).length === 0, w = (b ? b.subcollections : _) ?? [], q = w.map((T) => T.path.trim().toLowerCase()), F = w.map((T) => T.id?.trim().toLowerCase()).filter(Boolean), A = gi();
6080
- if (!h)
6065
+ const { propertyConfigs: w } = Ke(), k = Be(), {
6066
+ topLevelNavigation: g,
6067
+ collections: v
6068
+ } = k, _ = !a?.path && (s ?? []).length === 0, h = (b ? b.subcollections : v) ?? [], A = h.map((T) => T.path.trim().toLowerCase()), E = h.map((T) => T.id?.trim().toLowerCase()).filter(Boolean), z = gi();
6069
+ if (!g)
6081
6070
  throw Error("Internal: Navigation not ready in collection editor");
6082
6071
  const {
6083
- groups: S
6084
- } = h, E = De(), v = Ye(), V = He({}), J = t ? y ? "welcome" : "details" : "properties", [N, R] = $(J), [ge, xe] = we.useState(), [Q, U] = we.useState(), [W, te] = we.useState(!1), [me, ue] = we.useState();
6072
+ groups: q
6073
+ } = g, B = De(), S = Ye(), O = He({}), j = t ? _ ? "welcome" : "details" : "properties", [x, I] = L(j), [ge, ye] = _e.useState(), [Z, $] = _e.useState(), [J, te] = _e.useState(!1), [me, ue] = _e.useState();
6085
6074
  pe(() => {
6086
6075
  try {
6087
- x.initialised && (U(r ? x.getCollectionFromPaths([...s ?? [], r]) : void 0), te(!0));
6076
+ k.initialised && ($(r ? k.getCollectionFromPaths([...s ?? [], r]) : void 0), te(!0));
6088
6077
  } catch (T) {
6089
6078
  console.error(T), ue(me);
6090
6079
  }
6091
- }, [x.getCollectionFromPaths, r, me, x.initialised]);
6080
+ }, [k.getCollectionFromPaths, r, me, k.initialised]);
6092
6081
  const fe = (T) => {
6093
- const I = T.id || T.path;
6082
+ const F = T.id || T.path;
6094
6083
  return i.saveCollection({
6095
- id: I,
6084
+ id: F,
6096
6085
  collectionData: T,
6097
6086
  previousPath: r,
6098
6087
  parentCollectionIds: s
6099
- }).then(() => (xe(void 0), !0)).catch((D) => (xe(D), console.error(D), E.open({
6088
+ }).then(() => (ye(void 0), !0)).catch((M) => (ye(M), console.error(M), B.open({
6100
6089
  type: "error",
6101
- message: "Error persisting collection: " + (D.message ?? "Details in the console")
6090
+ message: "Error persisting collection: " + (M.message ?? "Details in the console")
6102
6091
  }), !1));
6103
- }, ye = Q ? {
6104
- ...Q,
6105
- id: Q.id ?? Q.path ?? jt(16)
6106
- } : void 0, Ce = ye ? lr(ye, k) : {
6092
+ }, ve = Z ? {
6093
+ ...Z,
6094
+ id: Z.id ?? Z.path ?? jt(16)
6095
+ } : void 0, Ce = ve ? lr(ve, w) : {
6107
6096
  id: a?.path ?? jt(16),
6108
6097
  path: a?.path ?? "",
6109
6098
  name: a?.name ?? "",
@@ -6111,44 +6100,44 @@ function sr({
6111
6100
  properties: {},
6112
6101
  propertiesOrder: [],
6113
6102
  icon: xt[Math.floor(Math.random() * xt.length)],
6114
- ownerId: v.user?.uid ?? ""
6115
- }, ae = X(() => {
6116
- N === "details" ? A.inUse ? R("import_data_saving") : R(u ? "extra_view" : "properties") : R(N === "welcome" ? "details" : N === "import_data_mapping" ? "import_data_preview" : N === "import_data_preview" ? "details" : N === "extra_view" ? "properties" : "details");
6117
- }, [N, A.inUse, u]), Ve = X((T) => {
6103
+ ownerId: S.user?.uid ?? ""
6104
+ }, ae = Q(() => {
6105
+ x === "details" ? z.inUse ? I("import_data_saving") : I(u ? "extra_view" : "properties") : I(x === "welcome" ? "details" : x === "import_data_mapping" ? "import_data_preview" : x === "import_data_preview" ? "details" : x === "extra_view" ? "properties" : "details");
6106
+ }, [x, z.inUse, u]), Ve = Q((T) => {
6118
6107
  if (l)
6119
6108
  return l?.(T.path, T.collectionGroup ?? !1, s ?? []);
6120
- }, [l, s]), tt = X(async (T) => {
6109
+ }, [l, s]), tt = Q(async (T) => {
6121
6110
  try {
6122
6111
  if (!Ve)
6123
- return U(T), Promise.resolve(T);
6124
- R("loading");
6125
- const I = await Ve?.(T);
6126
- if (!I)
6127
- return U(T), Promise.resolve(T);
6128
- const D = {
6112
+ return $(T), Promise.resolve(T);
6113
+ I("loading");
6114
+ const F = await Ve?.(T);
6115
+ if (!F)
6116
+ return $(T), Promise.resolve(T);
6117
+ const M = {
6129
6118
  ...T ?? {}
6130
6119
  };
6131
- return Object.keys(I.properties ?? {}).length > 0 && (D.properties = I.properties, D.propertiesOrder = I.propertiesOrder), D.propertiesOrder ? (U(D), console.log("Inferred collection", {
6120
+ return Object.keys(F.properties ?? {}).length > 0 && (M.properties = F.properties, M.propertiesOrder = F.propertiesOrder), M.propertiesOrder ? ($(M), console.log("Inferred collection", {
6132
6121
  newCollection: T ?? {},
6133
- values: D
6134
- }), D) : (D.propertiesOrder = Object.keys(D.properties), D);
6135
- } catch (I) {
6136
- return console.error(I), E.open({
6122
+ values: M
6123
+ }), M) : (M.propertiesOrder = Object.keys(M.properties), M);
6124
+ } catch (F) {
6125
+ return console.error(F), B.open({
6137
6126
  type: "error",
6138
- message: "Error inferring collection: " + (I.message ?? "Details in the console")
6127
+ message: "Error inferring collection: " + (F.message ?? "Details in the console")
6139
6128
  }), T;
6140
6129
  }
6141
- }, [s, Ve]), bt = (T, I) => {
6130
+ }, [s, Ve]), bt = (T, F) => {
6142
6131
  try {
6143
6132
  if (console.log("Submitting collection", T), !t) {
6144
6133
  fe(T).then(() => {
6145
- I.resetForm({ values: Ce }), p(T);
6134
+ F.resetForm({ values: Ce }), p(T);
6146
6135
  });
6147
6136
  return;
6148
6137
  }
6149
- N === "welcome" ? (ae(), I.resetForm({ values: T })) : N === "details" ? u || A.inUse ? (I.resetForm({ values: T }), ae()) : t ? tt(T).then((D) => {
6150
- I.resetForm({
6151
- values: D ?? T,
6138
+ x === "welcome" ? (ae(), F.resetForm({ values: T })) : x === "details" ? u || z.inUse ? (F.resetForm({ values: T }), ae()) : t ? tt(T).then((M) => {
6139
+ F.resetForm({
6140
+ values: M ?? T,
6152
6141
  touched: {
6153
6142
  path: !0,
6154
6143
  name: !0
@@ -6156,65 +6145,62 @@ function sr({
6156
6145
  });
6157
6146
  }).finally(() => {
6158
6147
  ae();
6159
- }) : (I.resetForm({ values: T }), ae()) : N === "extra_view" ? (ae(), I.resetForm({ values: T })) : N === "import_data_mapping" || N === "import_data_preview" ? ae() : N === "properties" ? fe(T).then(() => {
6160
- I.resetForm({ values: Ce }), ae(), p(T);
6161
- }) : (ae(), I.resetForm({ values: T }));
6162
- } catch (D) {
6163
- E.open({
6148
+ }) : (F.resetForm({ values: T }), ae()) : x === "extra_view" ? (ae(), F.resetForm({ values: T })) : x === "import_data_mapping" || x === "import_data_preview" ? ae() : x === "properties" ? fe(T).then(() => {
6149
+ F.resetForm({ values: Ce }), ae(), p(T);
6150
+ }) : (ae(), F.resetForm({ values: T }));
6151
+ } catch (M) {
6152
+ B.open({
6164
6153
  type: "error",
6165
- message: "Error persisting collection: " + (D.message ?? "Details in the console")
6166
- }), console.error(D), I.resetForm({ values: T });
6154
+ message: "Error persisting collection: " + (M.message ?? "Details in the console")
6155
+ }), console.error(M), F.resetForm({ values: T });
6167
6156
  }
6168
6157
  };
6169
- return !t && (!x.initialised || !W) ? /* @__PURE__ */ e(Et, {}) : /* @__PURE__ */ e($e, { fullHeight: !0, children: /* @__PURE__ */ e(
6158
+ return !t && (!k.initialised || !J) ? /* @__PURE__ */ e(Et, {}) : /* @__PURE__ */ e($e, { fullHeight: !0, children: /* @__PURE__ */ e(
6170
6159
  St,
6171
6160
  {
6172
6161
  initialValues: Ce,
6173
- validationSchema: (N === "properties" || N === "subcollections" || N === "details") && yi,
6162
+ validationSchema: (x === "properties" || x === "subcollections" || x === "details") && yi,
6174
6163
  validate: (T) => {
6175
- if (N === "properties")
6176
- return V.current;
6177
- const I = {};
6178
- if (N === "details") {
6179
- const D = cr(T.path, t, q, T.id);
6180
- D && (I.path = D);
6181
- const Oe = dr(T.id, t, q, F);
6182
- Oe && (I.id = Oe);
6164
+ if (x === "properties")
6165
+ return O.current;
6166
+ const F = {};
6167
+ if (x === "details") {
6168
+ const M = cr(T.path, t, A, T.id);
6169
+ M && (F.path = M);
6170
+ const Oe = dr(T.id, t, A, E);
6171
+ Oe && (F.id = Oe);
6183
6172
  }
6184
- return I;
6173
+ return F;
6185
6174
  },
6186
6175
  onSubmit: bt,
6187
6176
  children: (T) => {
6188
6177
  const {
6189
- values: I,
6190
- setFieldValue: D,
6178
+ values: F,
6179
+ setFieldValue: M,
6191
6180
  isSubmitting: Oe,
6192
6181
  dirty: at,
6193
- submitCount: z
6194
- } = T, j = I.path ?? r, G = o?.includes("/") ? o?.split("/").slice(0, -1).join("/") + "/" + j : j, se = x.resolveAliasesFrom(G), le = se && O ? () => O(se) : void 0;
6182
+ submitCount: V
6183
+ } = T, D = F.path ?? r, H = o?.includes("/") ? o?.split("/").slice(0, -1).join("/") + "/" + D : D, se = k.resolveAliasesFrom(H), le = se && P ? () => P(se) : void 0;
6195
6184
  pe(() => {
6196
- d(at);
6185
+ c(at);
6197
6186
  }, [at]);
6198
- function ve(Z) {
6199
- A.setInUse(!0), ii(Z, ia).then((Ie) => {
6187
+ function we(X) {
6188
+ z.setInUse(!0), ii(X, ia).then((Ie) => {
6200
6189
  const Fe = pa(Ie);
6201
- D("properties", Fe.properties), D("propertiesOrder", Object.keys(Fe.properties)), A.setIdColumn(Fe.idColumn), A.setImportData(Z), A.setHeadersMapping(Fe.headersMapping), A.setOriginProperties(Fe.properties);
6190
+ M("properties", Fe.properties), M("propertiesOrder", Object.keys(Fe.properties)), z.setIdColumn(Fe.idColumn), z.setImportData(X), z.setHeadersMapping(Fe.headersMapping), z.setOriginProperties(Fe.properties);
6202
6191
  });
6203
6192
  }
6204
- const yt = !!I.name && !!I.id, it = () => {
6205
- const Z = { ...I.properties };
6206
- A.idColumn && delete Z[A.idColumn], D("properties", Z), ae(), console.log("onImportMappingComplete", {
6207
- importConfig: A,
6208
- properties: Z
6209
- });
6210
- }, vt = Q?.editable || t;
6211
- return /* @__PURE__ */ n(M, { children: [
6193
+ const yt = !!F.name && !!F.id, it = () => {
6194
+ const X = { ...F.properties };
6195
+ z.idColumn && delete X[z.idColumn], M("properties", X), ae();
6196
+ }, vt = Z?.editable || t;
6197
+ return /* @__PURE__ */ n(U, { children: [
6212
6198
  !t && /* @__PURE__ */ n(
6213
6199
  $a,
6214
6200
  {
6215
- value: N,
6216
- className: ke(Pt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
6217
- onValueChange: (Z) => R(Z),
6201
+ value: x,
6202
+ className: xe(Nt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
6203
+ onValueChange: (X) => I(X),
6218
6204
  children: [
6219
6205
  /* @__PURE__ */ e(_t, { value: "details", children: "Details" }),
6220
6206
  /* @__PURE__ */ e(_t, { value: "properties", children: "Properties" }),
@@ -6226,127 +6212,127 @@ function sr({
6226
6212
  Xa,
6227
6213
  {
6228
6214
  noValidate: !0,
6229
- className: ke(
6215
+ className: xe(
6230
6216
  t ? "h-full" : "h-[calc(100%-48px)]",
6231
6217
  "flex-grow flex flex-col relative"
6232
6218
  ),
6233
6219
  children: [
6234
- N === "loading" && /* @__PURE__ */ e(Et, {}),
6235
- N === "extra_view" && j && u?.View && /* @__PURE__ */ e(u.View, { path: j }),
6236
- N === "welcome" && /* @__PURE__ */ e(
6220
+ x === "loading" && /* @__PURE__ */ e(Et, {}),
6221
+ x === "extra_view" && D && u?.View && /* @__PURE__ */ e(u.View, { path: D }),
6222
+ x === "welcome" && /* @__PURE__ */ e(
6237
6223
  ir,
6238
6224
  {
6239
- path: j,
6240
- onContinue: (Z) => {
6241
- Z ? (ve(Z), R("import_data_mapping")) : R("details");
6225
+ path: D,
6226
+ onContinue: (X) => {
6227
+ X ? (we(X), I("import_data_mapping")) : I("details");
6242
6228
  },
6243
- collections: _,
6229
+ collections: v,
6244
6230
  parentCollection: b,
6245
- pathSuggestions: f
6231
+ pathSuggestions: y
6246
6232
  }
6247
6233
  ),
6248
- N === "import_data_mapping" && A && /* @__PURE__ */ e(
6234
+ x === "import_data_mapping" && z && /* @__PURE__ */ e(
6249
6235
  rr,
6250
6236
  {
6251
- importConfig: A,
6237
+ importConfig: z,
6252
6238
  collectionEditable: vt,
6253
- propertyConfigs: k
6239
+ propertyConfigs: w
6254
6240
  }
6255
6241
  ),
6256
- N === "import_data_preview" && A && /* @__PURE__ */ e(
6242
+ x === "import_data_preview" && z && /* @__PURE__ */ e(
6257
6243
  nr,
6258
6244
  {
6259
- importConfig: A,
6260
- properties: I.properties,
6261
- propertiesOrder: I.propertiesOrder
6245
+ importConfig: z,
6246
+ properties: F.properties,
6247
+ propertiesOrder: F.propertiesOrder
6262
6248
  }
6263
6249
  ),
6264
- N === "import_data_saving" && A && /* @__PURE__ */ e(
6250
+ x === "import_data_saving" && z && /* @__PURE__ */ e(
6265
6251
  fi,
6266
6252
  {
6267
- importConfig: A,
6268
- collection: I,
6269
- onImportSuccess: (Z) => {
6270
- p(Z), E.open({
6253
+ importConfig: z,
6254
+ collection: F,
6255
+ onImportSuccess: (X) => {
6256
+ p(X), B.open({
6271
6257
  type: "info",
6272
6258
  message: "Data imported successfully"
6273
6259
  });
6274
6260
  }
6275
6261
  }
6276
6262
  ),
6277
- N === "details" && /* @__PURE__ */ e(
6263
+ x === "details" && /* @__PURE__ */ e(
6278
6264
  _i,
6279
6265
  {
6280
- existingPaths: q,
6281
- existingIds: F,
6282
- groups: S,
6266
+ existingPaths: A,
6267
+ existingIds: E,
6268
+ groups: q,
6283
6269
  parentCollection: b,
6284
6270
  isNewCollection: t
6285
6271
  }
6286
6272
  ),
6287
- N === "subcollections" && Q && /* @__PURE__ */ e(
6273
+ x === "subcollections" && Z && /* @__PURE__ */ e(
6288
6274
  ar,
6289
6275
  {
6290
6276
  parentCollection: b,
6291
6277
  configController: i,
6292
- getUser: g,
6278
+ getUser: f,
6293
6279
  collectionInference: l,
6294
6280
  parentCollectionIds: s,
6295
- collection: Q
6281
+ collection: Z
6296
6282
  }
6297
6283
  ),
6298
- N === "properties" && /* @__PURE__ */ e(
6284
+ x === "properties" && /* @__PURE__ */ e(
6299
6285
  Xi,
6300
6286
  {
6301
- showErrors: z > 0,
6287
+ showErrors: V > 0,
6302
6288
  isNewCollection: t,
6303
6289
  reservedGroups: m,
6304
- onPropertyError: (Z, Ie, Fe) => {
6305
- V.current = La({
6306
- ...V.current,
6307
- [Z]: Fe
6290
+ onPropertyError: (X, Ie, Fe) => {
6291
+ O.current = La({
6292
+ ...O.current,
6293
+ [X]: Fe
6308
6294
  }, !0);
6309
6295
  },
6310
- getUser: g,
6296
+ getUser: f,
6311
6297
  getData: le,
6312
6298
  doCollectionInference: Ve,
6313
- propertyConfigs: k,
6299
+ propertyConfigs: w,
6314
6300
  collectionEditable: vt,
6315
6301
  extraIcon: u?.icon && /* @__PURE__ */ e(
6316
6302
  ne,
6317
6303
  {
6318
6304
  color: "primary",
6319
- onClick: () => R("extra_view"),
6305
+ onClick: () => I("extra_view"),
6320
6306
  children: u.icon
6321
6307
  }
6322
6308
  )
6323
6309
  }
6324
6310
  ),
6325
- N !== "welcome" && /* @__PURE__ */ n(
6311
+ x !== "welcome" && /* @__PURE__ */ n(
6326
6312
  Le,
6327
6313
  {
6328
6314
  position: "absolute",
6329
6315
  children: [
6330
6316
  ge && /* @__PURE__ */ e(aa, { error: ge }),
6331
- t && y && N === "import_data_mapping" && /* @__PURE__ */ n(
6332
- B,
6317
+ t && _ && x === "import_data_mapping" && /* @__PURE__ */ n(
6318
+ R,
6333
6319
  {
6334
6320
  variant: "text",
6335
6321
  type: "button",
6336
- onClick: () => (A.setInUse(!1), R("welcome")),
6322
+ onClick: () => (z.setInUse(!1), I("welcome")),
6337
6323
  children: [
6338
6324
  /* @__PURE__ */ e(rt, {}),
6339
6325
  "Back"
6340
6326
  ]
6341
6327
  }
6342
6328
  ),
6343
- t && y && N === "import_data_preview" && /* @__PURE__ */ n(
6344
- B,
6329
+ t && _ && x === "import_data_preview" && /* @__PURE__ */ n(
6330
+ R,
6345
6331
  {
6346
6332
  variant: "text",
6347
6333
  type: "button",
6348
6334
  onClick: () => {
6349
- fe(I), R("import_data_mapping");
6335
+ fe(F), I("import_data_mapping");
6350
6336
  },
6351
6337
  children: [
6352
6338
  /* @__PURE__ */ e(rt, {}),
@@ -6354,24 +6340,24 @@ function sr({
6354
6340
  ]
6355
6341
  }
6356
6342
  ),
6357
- t && y && N === "details" && /* @__PURE__ */ n(
6358
- B,
6343
+ t && _ && x === "details" && /* @__PURE__ */ n(
6344
+ R,
6359
6345
  {
6360
6346
  variant: "text",
6361
6347
  type: "button",
6362
- onClick: () => R("welcome"),
6348
+ onClick: () => I("welcome"),
6363
6349
  children: [
6364
6350
  /* @__PURE__ */ e(rt, {}),
6365
6351
  "Back"
6366
6352
  ]
6367
6353
  }
6368
6354
  ),
6369
- t && N === "properties" && /* @__PURE__ */ n(
6370
- B,
6355
+ t && x === "properties" && /* @__PURE__ */ n(
6356
+ R,
6371
6357
  {
6372
6358
  variant: "text",
6373
6359
  type: "button",
6374
- onClick: () => R("details"),
6360
+ onClick: () => I("details"),
6375
6361
  children: [
6376
6362
  /* @__PURE__ */ e(rt, {}),
6377
6363
  "Back"
@@ -6379,17 +6365,17 @@ function sr({
6379
6365
  }
6380
6366
  ),
6381
6367
  /* @__PURE__ */ e(
6382
- B,
6368
+ R,
6383
6369
  {
6384
6370
  variant: "text",
6385
6371
  onClick: () => {
6386
- c();
6372
+ d();
6387
6373
  },
6388
6374
  children: "Cancel"
6389
6375
  }
6390
6376
  ),
6391
- t && N === "import_data_mapping" && /* @__PURE__ */ e(
6392
- B,
6377
+ t && x === "import_data_mapping" && /* @__PURE__ */ e(
6378
+ R,
6393
6379
  {
6394
6380
  variant: "filled",
6395
6381
  color: "primary",
@@ -6397,8 +6383,8 @@ function sr({
6397
6383
  children: "Next"
6398
6384
  }
6399
6385
  ),
6400
- t && N === "import_data_preview" && /* @__PURE__ */ e(
6401
- B,
6386
+ t && x === "import_data_preview" && /* @__PURE__ */ e(
6387
+ R,
6402
6388
  {
6403
6389
  variant: "filled",
6404
6390
  color: "primary",
@@ -6408,18 +6394,18 @@ function sr({
6408
6394
  children: "Next"
6409
6395
  }
6410
6396
  ),
6411
- t && (N === "details" || N === "properties") && /* @__PURE__ */ n(
6397
+ t && (x === "details" || x === "properties") && /* @__PURE__ */ n(
6412
6398
  Dt,
6413
6399
  {
6414
6400
  variant: "filled",
6415
6401
  color: "primary",
6416
6402
  type: "submit",
6417
6403
  loading: Oe,
6418
- disabled: Oe || N === "details" && !yt,
6419
- startIcon: N === "properties" ? /* @__PURE__ */ e(Ka, {}) : void 0,
6404
+ disabled: Oe || x === "details" && !yt,
6405
+ startIcon: x === "properties" ? /* @__PURE__ */ e(Ka, {}) : void 0,
6420
6406
  children: [
6421
- N === "details" && "Next",
6422
- N === "properties" && "Create collection"
6407
+ x === "details" && "Next",
6408
+ x === "properties" && "Create collection"
6423
6409
  ]
6424
6410
  }
6425
6411
  ),
@@ -6456,7 +6442,7 @@ function ua(t, a) {
6456
6442
  const r = a[i.propertyConfig];
6457
6443
  if (r && oe(r.property))
6458
6444
  i = r.property;
6459
- else if (r && (i = Y(r.property, i)), !oe(i) && i.dataType === "map" && i.properties) {
6445
+ else if (r && (i = G(r.property, i)), !oe(i) && i.dataType === "map" && i.properties) {
6460
6446
  const s = {};
6461
6447
  Object.keys(i.properties).forEach((o) => {
6462
6448
  s[o] = ua(i.properties[o], a);
@@ -6473,7 +6459,7 @@ const cr = (t, a, i, r) => {
6473
6459
  return;
6474
6460
  let s;
6475
6461
  return a && i?.includes(t.trim().toLowerCase()) && (s = "There is already a collection that uses this value as a path"), a && r?.includes(t.trim().toLowerCase()) && (s = "There is already a collection which uses this id"), s;
6476
- }, ha = L.createContext({}), ga = L.createContext({}), pr = L.memo(
6462
+ }, ha = K.createContext({}), ga = K.createContext({}), pr = K.memo(
6477
6463
  function({
6478
6464
  children: a,
6479
6465
  collectionConfigController: i,
@@ -6483,74 +6469,76 @@ const cr = (t, a, i, r) => {
6483
6469
  extraView: l,
6484
6470
  pathSuggestions: p,
6485
6471
  getUser: m,
6486
- getData: u
6472
+ getData: u,
6473
+ onAnalyticsEvent: d
6487
6474
  }) {
6488
- const c = Be(), d = bi(), f = De(), { propertyConfigs: g } = Ke(), {
6489
- collections: b
6490
- } = c, O = b.map((v) => v.path.trim().toLowerCase()), [k, x] = L.useState();
6475
+ const c = Be(), y = bi(), f = De(), { propertyConfigs: b } = Ke(), {
6476
+ collections: P
6477
+ } = c, w = P.map((O) => O.path.trim().toLowerCase()), [k, g] = K.useState();
6491
6478
  pe(() => {
6492
- p && p().then((v) => {
6493
- x(v.filter((V) => !O.includes(V.trim().toLowerCase())));
6479
+ p && p().then((O) => {
6480
+ g(O.filter((j) => !w.includes(j.trim().toLowerCase())));
6494
6481
  });
6495
6482
  }, [p]);
6496
- const [h, _] = L.useState(), [y, w] = L.useState(), q = X(() => ({
6483
+ const [v, _] = K.useState(), [h, A] = K.useState(), E = Q(() => ({
6497
6484
  createCollections: !0,
6498
6485
  editCollections: !0,
6499
6486
  deleteCollections: !0
6500
- }), []), F = X(({
6501
- path: v,
6502
- fullPath: V,
6503
- parentCollectionIds: J,
6504
- parentCollection: N
6487
+ }), []), z = Q(({
6488
+ path: O,
6489
+ fullPath: j,
6490
+ parentCollectionIds: x,
6491
+ parentCollection: I
6505
6492
  }) => {
6506
- _({
6507
- editedCollectionPath: v,
6508
- fullPath: V,
6509
- parentCollectionIds: J,
6493
+ console.debug("edit collection", O, j, x, I), d?.("edit_collection", { path: O, fullPath: j }), _({
6494
+ editedCollectionPath: O,
6495
+ fullPath: j,
6496
+ parentCollectionIds: x,
6510
6497
  isNewCollection: !1,
6511
- parentCollection: N,
6498
+ parentCollection: I,
6512
6499
  redirect: !1
6513
6500
  });
6514
- }, []), A = X(({
6515
- propertyKey: v,
6516
- property: V,
6517
- editedCollectionPath: J,
6518
- currentPropertiesOrder: N,
6519
- parentCollectionIds: R,
6520
- collection: ge
6501
+ }, []), q = Q(({
6502
+ propertyKey: O,
6503
+ property: j,
6504
+ editedCollectionPath: x,
6505
+ currentPropertiesOrder: I,
6506
+ parentCollectionIds: ge,
6507
+ collection: ye
6521
6508
  }) => {
6522
- const xe = v && v.includes(".") ? v.substring(0, v.lastIndexOf(".")) : void 0, Q = v && v.includes(".") ? v.substring(v.lastIndexOf(".") + 1) : v;
6523
- console.log("edit property", Q, ge), w({
6524
- propertyKey: Q,
6525
- property: V,
6526
- namespace: xe,
6527
- currentPropertiesOrder: N,
6528
- editedCollectionPath: J,
6529
- parentCollectionIds: R,
6530
- collectionEditable: ge?.editable ?? !1
6509
+ console.debug("edit property", O, j, x, I, ge, ye), d?.("edit_property", { propertyKey: O, editedCollectionPath: x });
6510
+ const Z = O && O.includes(".") ? O.substring(0, O.lastIndexOf(".")) : void 0, $ = O && O.includes(".") ? O.substring(O.lastIndexOf(".") + 1) : O;
6511
+ A({
6512
+ propertyKey: $,
6513
+ property: j,
6514
+ namespace: Z,
6515
+ currentPropertiesOrder: I,
6516
+ editedCollectionPath: x,
6517
+ parentCollectionIds: ge,
6518
+ collectionEditable: ye?.editable ?? !1
6531
6519
  });
6532
- }, []), S = L.useCallback(({
6533
- parentCollectionIds: v,
6534
- parentCollection: V,
6535
- initialValues: J,
6536
- redirect: N
6520
+ }, []), B = K.useCallback(({
6521
+ parentCollectionIds: O,
6522
+ parentCollection: j,
6523
+ initialValues: x,
6524
+ redirect: I
6537
6525
  }) => {
6538
- _({
6526
+ console.debug("create collection", O, j, x, I), d?.("create_collection", { parentCollectionIds: O, parentCollection: j, initialValues: x, redirect: I }), _({
6539
6527
  isNewCollection: !0,
6540
- parentCollectionIds: v,
6541
- parentCollection: V,
6542
- initialValues: J,
6543
- redirect: N
6528
+ parentCollectionIds: O,
6529
+ parentCollection: j,
6530
+ initialValues: x,
6531
+ redirect: I
6544
6532
  });
6545
- }, []), E = p ? (v) => !v && k ? Promise.resolve(k) : p?.(v) : void 0;
6533
+ }, []), S = p ? (O) => !O && k ? Promise.resolve(k) : p?.(O) : void 0;
6546
6534
  return /* @__PURE__ */ e(ha.Provider, { value: i, children: /* @__PURE__ */ n(
6547
6535
  ga.Provider,
6548
6536
  {
6549
6537
  value: {
6550
- editCollection: F,
6551
- createCollection: S,
6552
- editProperty: A,
6553
- configPermissions: r ?? q,
6538
+ editCollection: z,
6539
+ createCollection: B,
6540
+ editProperty: q,
6541
+ configPermissions: r ?? E,
6554
6542
  rootPathSuggestions: k
6555
6543
  },
6556
6544
  children: [
@@ -6558,20 +6546,20 @@ const cr = (t, a, i, r) => {
6558
6546
  /* @__PURE__ */ e(
6559
6547
  ma,
6560
6548
  {
6561
- open: !!h,
6549
+ open: !!v,
6562
6550
  configController: i,
6563
6551
  isNewCollection: !1,
6564
6552
  collectionInference: o,
6565
- ...h,
6553
+ ...v,
6566
6554
  getData: u,
6567
6555
  reservedGroups: s,
6568
6556
  extraView: l,
6569
- pathSuggestions: E,
6557
+ pathSuggestions: S,
6570
6558
  getUser: m,
6571
- handleClose: (v) => {
6572
- if (h?.redirect && v && h?.isNewCollection && !h.parentCollectionIds.length) {
6573
- const V = c.buildUrlCollectionPath(v.id ?? v.path);
6574
- d(V);
6559
+ handleClose: (O) => {
6560
+ if (v?.redirect && O && v?.isNewCollection && !v.parentCollectionIds.length) {
6561
+ const j = c.buildUrlCollectionPath(O.id ?? O.path);
6562
+ y(j);
6575
6563
  }
6576
6564
  _(void 0);
6577
6565
  }
@@ -6580,69 +6568,69 @@ const cr = (t, a, i, r) => {
6580
6568
  /* @__PURE__ */ e(
6581
6569
  je,
6582
6570
  {
6583
- open: !!y,
6571
+ open: !!h,
6584
6572
  includeIdAndName: !0,
6585
- existingProperty: !!y?.propertyKey,
6586
- autoUpdateId: y ? !y?.propertyKey : !1,
6587
- autoOpenTypeSelect: y ? !y?.propertyKey : !1,
6573
+ existingProperty: !!h?.propertyKey,
6574
+ autoUpdateId: h ? !h?.propertyKey : !1,
6575
+ autoOpenTypeSelect: h ? !h?.propertyKey : !1,
6588
6576
  inArray: !1,
6589
- collectionEditable: y?.collectionEditable ?? !1,
6590
- getData: u && y?.editedCollectionPath ? () => {
6591
- const v = c.resolveAliasesFrom(y.editedCollectionPath);
6592
- return u(v);
6577
+ collectionEditable: h?.collectionEditable ?? !1,
6578
+ getData: u && h?.editedCollectionPath ? () => {
6579
+ const O = c.resolveAliasesFrom(h.editedCollectionPath);
6580
+ return u(O);
6593
6581
  } : void 0,
6594
6582
  onPropertyChanged: ({
6595
- id: v,
6596
- property: V
6583
+ id: O,
6584
+ property: j
6597
6585
  }) => {
6598
- if (!y || !v)
6586
+ if (!h || !O)
6599
6587
  return;
6600
- const J = !y.propertyKey;
6588
+ const x = !h.propertyKey;
6601
6589
  return i.saveProperty({
6602
- path: y?.editedCollectionPath,
6603
- property: V,
6604
- propertyKey: v,
6605
- newPropertiesOrder: J && y.currentPropertiesOrder ? [...y.currentPropertiesOrder, v] : void 0,
6606
- namespace: y.namespace,
6607
- parentCollectionIds: y.parentCollectionIds
6608
- }).catch((N) => (console.error(N), f.open({
6590
+ path: h?.editedCollectionPath,
6591
+ property: j,
6592
+ propertyKey: O,
6593
+ newPropertiesOrder: x && h.currentPropertiesOrder ? [...h.currentPropertiesOrder, O] : void 0,
6594
+ namespace: h.namespace,
6595
+ parentCollectionIds: h.parentCollectionIds
6596
+ }).catch((I) => (console.error(I), f.open({
6609
6597
  type: "error",
6610
- message: "Error persisting property: " + (N.message ?? "Details in the console")
6598
+ message: "Error persisting property: " + (I.message ?? "Details in the console")
6611
6599
  }), !1));
6612
6600
  },
6613
6601
  onPropertyChangedImmediate: !1,
6614
6602
  onDelete: () => {
6615
- if (!y?.propertyKey)
6603
+ if (!h?.propertyKey)
6616
6604
  return;
6617
- const v = y?.currentPropertiesOrder?.filter((V) => V !== y?.propertyKey);
6605
+ const O = h?.currentPropertiesOrder?.filter((j) => j !== h?.propertyKey);
6618
6606
  return i.deleteProperty({
6619
- path: y?.editedCollectionPath,
6620
- propertyKey: y?.propertyKey,
6621
- namespace: y?.namespace,
6622
- newPropertiesOrder: v,
6623
- parentCollectionIds: y?.parentCollectionIds
6607
+ path: h?.editedCollectionPath,
6608
+ propertyKey: h?.propertyKey,
6609
+ namespace: h?.namespace,
6610
+ newPropertiesOrder: O,
6611
+ parentCollectionIds: h?.parentCollectionIds
6624
6612
  }).then(() => {
6625
- w(void 0);
6626
- }).catch((V) => (console.error(V), f.open({
6613
+ A(void 0);
6614
+ }).catch((j) => (console.error(j), f.open({
6627
6615
  type: "error",
6628
- message: "Error deleting property: " + (V.message ?? "Details in the console")
6616
+ message: "Error deleting property: " + (j.message ?? "Details in the console")
6629
6617
  }), !1));
6630
6618
  },
6631
6619
  onError: () => {
6632
6620
  },
6633
6621
  onOkClicked: () => {
6634
- w(void 0);
6622
+ A(void 0);
6635
6623
  },
6636
6624
  onCancel: () => {
6637
- w(void 0);
6625
+ A(void 0);
6638
6626
  },
6639
6627
  initialErrors: {},
6640
6628
  forceShowErrors: !1,
6641
6629
  existingPropertyKeys: [],
6642
6630
  allowDataInference: !0,
6643
- propertyConfigs: g,
6644
- property: y?.property,
6645
- propertyKey: y?.propertyKey
6631
+ propertyConfigs: b,
6632
+ property: h?.property,
6633
+ propertyKey: h?.propertyKey
6646
6634
  }
6647
6635
  )
6648
6636
  ]
@@ -6657,17 +6645,17 @@ function mr({
6657
6645
  collection: i,
6658
6646
  tableController: r
6659
6647
  }) {
6660
- const s = Ye(), o = Be(), l = Re(), p = fa(), m = De(), u = o.getCollectionFromIds(a), c = l.configPermissions ? l.configPermissions({
6648
+ const s = Ye(), o = Be(), l = Re(), p = fa(), m = De(), u = o.getCollectionFromIds(a), d = l.configPermissions ? l.configPermissions({
6661
6649
  user: s.user,
6662
6650
  collection: i
6663
6651
  }).editCollections : !0;
6664
- let d = null;
6665
- return (!ut(st(r.filterValues), st(i.initialFilter)) || !ut(st(r.sortBy), st(i.initialSort))) && (d = /* @__PURE__ */ e(
6652
+ let c = null;
6653
+ return (!ut(st(r.filterValues), st(i.initialFilter)) || !ut(st(r.sortBy), st(i.initialSort))) && (c = /* @__PURE__ */ e(
6666
6654
  re,
6667
6655
  {
6668
6656
  title: r.sortBy || r.filterValues ? "Save default filter and sort" : "Clear default filter and sort",
6669
6657
  children: /* @__PURE__ */ e(
6670
- B,
6658
+ R,
6671
6659
  {
6672
6660
  color: "primary",
6673
6661
  size: "small",
@@ -6675,7 +6663,7 @@ function mr({
6675
6663
  onClick: () => p?.saveCollection({
6676
6664
  id: i.path,
6677
6665
  parentCollectionIds: a,
6678
- collectionData: Y(
6666
+ collectionData: G(
6679
6667
  i,
6680
6668
  {
6681
6669
  initialFilter: r.filterValues ?? null,
@@ -6692,19 +6680,19 @@ function mr({
6692
6680
  }
6693
6681
  )
6694
6682
  }
6695
- )), /* @__PURE__ */ n(M, { children: [
6696
- c && d,
6683
+ )), /* @__PURE__ */ n(U, { children: [
6684
+ d && c,
6697
6685
  /* @__PURE__ */ e(
6698
6686
  re,
6699
6687
  {
6700
- title: c ? "Edit collection" : "You don't have permissions to edit this collection",
6688
+ title: d ? "Edit collection" : "You don't have permissions to edit this collection",
6701
6689
  children: /* @__PURE__ */ e(
6702
6690
  ne,
6703
6691
  {
6704
6692
  color: "primary",
6705
- disabled: !c,
6706
- onClick: c ? () => l?.editCollection({ path: i.path, fullPath: t, parentCollectionIds: a, parentCollection: u }) : void 0,
6707
- children: /* @__PURE__ */ e(Qe, {})
6693
+ disabled: !d,
6694
+ onClick: d ? () => l?.editCollection({ path: i.path, fullPath: t, parentCollectionIds: a, parentCollection: u }) : void 0,
6695
+ children: /* @__PURE__ */ e(Je, {})
6708
6696
  }
6709
6697
  )
6710
6698
  }
@@ -6721,9 +6709,9 @@ function ur({
6721
6709
  const i = De(), r = Ye(), s = fa(), o = Re(), l = o.configPermissions({
6722
6710
  user: r.user,
6723
6711
  collection: a
6724
- }), p = X(() => {
6712
+ }), p = Q(() => {
6725
6713
  o?.editCollection({ path: t, parentCollectionIds: [] });
6726
- }, [o, t]), [m, u] = $(!1), c = X(() => {
6714
+ }, [o, t]), [m, u] = L(!1), d = Q(() => {
6727
6715
  s?.deleteCollection({ path: t }).then(() => {
6728
6716
  u(!1), i.open({
6729
6717
  message: "Collection deleted",
@@ -6731,14 +6719,14 @@ function ur({
6731
6719
  });
6732
6720
  });
6733
6721
  }, [t, s]);
6734
- return /* @__PURE__ */ n(M, { children: [
6722
+ return /* @__PURE__ */ n(U, { children: [
6735
6723
  /* @__PURE__ */ n("div", { children: [
6736
6724
  l.deleteCollections && /* @__PURE__ */ e(
6737
6725
  Ga,
6738
6726
  {
6739
6727
  trigger: /* @__PURE__ */ e(ne, { children: /* @__PURE__ */ e(Ha, { size: "small" }) }),
6740
- children: /* @__PURE__ */ n(Ja, { onClick: (d) => {
6741
- d.preventDefault(), d.stopPropagation(), u(!0);
6728
+ children: /* @__PURE__ */ n(Wa, { onClick: (c) => {
6729
+ c.preventDefault(), c.stopPropagation(), u(!0);
6742
6730
  }, children: [
6743
6731
  /* @__PURE__ */ e(pt, {}),
6744
6732
  "Delete"
@@ -6748,10 +6736,10 @@ function ur({
6748
6736
  l.editCollections && /* @__PURE__ */ e(
6749
6737
  ne,
6750
6738
  {
6751
- onClick: (d) => {
6739
+ onClick: (c) => {
6752
6740
  p();
6753
6741
  },
6754
- children: /* @__PURE__ */ e(Qe, { size: "small" })
6742
+ children: /* @__PURE__ */ e(Je, { size: "small" })
6755
6743
  }
6756
6744
  )
6757
6745
  ] }),
@@ -6759,10 +6747,10 @@ function ur({
6759
6747
  mt,
6760
6748
  {
6761
6749
  open: m,
6762
- onAccept: c,
6750
+ onAccept: d,
6763
6751
  onCancel: () => u(!1),
6764
- title: /* @__PURE__ */ e(M, { children: "Delete this collection?" }),
6765
- body: /* @__PURE__ */ n(M, { children: [
6752
+ title: /* @__PURE__ */ e(U, { children: "Delete this collection?" }),
6753
+ body: /* @__PURE__ */ n(U, { children: [
6766
6754
  " This will ",
6767
6755
  /* @__PURE__ */ e("b", { children: "not delete any data" }),
6768
6756
  ", only the collection in the CMS"
@@ -6783,7 +6771,7 @@ function hr({
6783
6771
  return /* @__PURE__ */ e(
6784
6772
  ta,
6785
6773
  {
6786
- className: ke("h-full p-4 min-h-[124px]"),
6774
+ className: xe("h-full p-4 min-h-[124px]"),
6787
6775
  onClick: r && s ? () => r.createCollection({
6788
6776
  initialValues: t ? { group: t } : void 0,
6789
6777
  parentCollectionIds: [],
@@ -6816,7 +6804,7 @@ function gr() {
6816
6804
  user: t.user
6817
6805
  }).createCollections : !0, s = i.rootPathSuggestions ?? [], o = s.length > 3 || a.collections.length === 0 && s.length > 0;
6818
6806
  return /* @__PURE__ */ e(
6819
- Qa,
6807
+ Ja,
6820
6808
  {
6821
6809
  in: o,
6822
6810
  children: /* @__PURE__ */ n(
@@ -6835,7 +6823,7 @@ function gr() {
6835
6823
  icon: /* @__PURE__ */ e(Ae, { size: "small" }),
6836
6824
  colorScheme: "cyanLighter",
6837
6825
  onClick: i && r ? () => i.createCollection({
6838
- initialValues: { path: l, name: Nt(l) },
6826
+ initialValues: { path: l, name: Pt(l) },
6839
6827
  parentCollectionIds: [],
6840
6828
  redirect: !0
6841
6829
  }) : void 0,
@@ -6874,7 +6862,7 @@ function fr({
6874
6862
  });
6875
6863
  },
6876
6864
  size: "small",
6877
- children: /* @__PURE__ */ e(Qe, { size: "small" })
6865
+ children: /* @__PURE__ */ e(Je, { size: "small" })
6878
6866
  }
6879
6867
  ) });
6880
6868
  }
@@ -6895,7 +6883,7 @@ function br({
6895
6883
  s.editProperty({
6896
6884
  editedCollectionPath: t,
6897
6885
  parentCollectionIds: a,
6898
- currentPropertiesOrder: Wa(i),
6886
+ currentPropertiesOrder: Qa(i),
6899
6887
  collection: i
6900
6888
  });
6901
6889
  },
@@ -6912,14 +6900,15 @@ function Ar({
6912
6900
  pathSuggestions: o,
6913
6901
  getUser: l,
6914
6902
  collectionInference: p,
6915
- getData: m
6903
+ getData: m,
6904
+ onAnalyticsEvent: u
6916
6905
  }) {
6917
- const u = X(
6906
+ const d = Q(
6918
6907
  (c) => {
6919
- const d = (g) => {
6920
- et(g.properties), g.subcollections?.forEach(d);
6908
+ const y = (b) => {
6909
+ et(b.properties), b.subcollections?.forEach(y);
6921
6910
  }, f = t.collections ?? [];
6922
- return f.forEach(d), Za(c, f, [], a);
6911
+ return f.forEach(y), Za(c, f, [], a);
6923
6912
  },
6924
6913
  [t.collections, a]
6925
6914
  );
@@ -6927,7 +6916,7 @@ function Ar({
6927
6916
  name: "Collection Editor",
6928
6917
  loading: t.loading,
6929
6918
  collections: {
6930
- injectCollections: u,
6919
+ injectCollections: d,
6931
6920
  CollectionActions: mr
6932
6921
  },
6933
6922
  provider: {
@@ -6940,7 +6929,8 @@ function Ar({
6940
6929
  extraView: s,
6941
6930
  pathSuggestions: o,
6942
6931
  getUser: l,
6943
- getData: m
6932
+ getData: m,
6933
+ onAnalyticsEvent: u
6944
6934
  }
6945
6935
  },
6946
6936
  homePage: {
@@ -6959,14 +6949,14 @@ function zr({ path: t }) {
6959
6949
  return /* @__PURE__ */ n("div", { className: "p-1 flex flex-col items-center", children: [
6960
6950
  /* @__PURE__ */ e(aa, { error: "No collection for path: " + i }),
6961
6951
  /* @__PURE__ */ e(
6962
- B,
6952
+ R,
6963
6953
  {
6964
6954
  className: "mx-2",
6965
6955
  variant: "outlined",
6966
6956
  size: "small",
6967
6957
  onClick: () => {
6968
6958
  s.createCollection({
6969
- initialValues: { path: i, name: Nt(i) },
6959
+ initialValues: { path: i, name: Pt(i) },
6970
6960
  parentCollectionIds: r,
6971
6961
  redirect: !1
6972
6962
  });
@@ -6982,10 +6972,10 @@ function yr(t) {
6982
6972
  }
6983
6973
  export {
6984
6974
  zr as MissingReferenceWidget,
6985
- Je as editableProperty,
6975
+ We as editableProperty,
6986
6976
  ce as getFullId,
6987
- _e as idToPropertiesPath,
6988
- Ne as namespaceToPropertiesOrderPath,
6977
+ ke as idToPropertiesPath,
6978
+ Pe as namespaceToPropertiesOrderPath,
6989
6979
  ki as namespaceToPropertiesPath,
6990
6980
  qi as removeNonEditableProperties,
6991
6981
  Re as useCollectionEditorController,