@firecms/collection_editor 3.0.0-alpha.19 → 3.0.0-alpha.20

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,16 +1,16 @@
1
1
  import { jsxs as o, Fragment as I, jsx as e } from "react/jsx-runtime";
2
2
  import * as be from "react";
3
- import R, { useState as Y, useCallback as Z, useEffect as se, useMemo as Rt, useRef as Re, useDeferredValue as ha, useContext as Ut } from "react";
3
+ import R, { useState as Y, useCallback as Z, useEffect as se, useMemo as Rt, useRef as Re, useDeferredValue as ga, useContext as Ut } from "react";
4
4
  import tt from "react-fast-compare";
5
- import { iconKeys as $t, debounce as ga, SearchBar as fa, Tooltip as le, IconButton as pe, Icon as We, coolIconKeys as vt, Typography as N, getIconForView as et, useAutoComplete as ba, Container as ot, Chip as at, TextField as qe, cn as ve, DebouncedTextField as G, Autocomplete as ya, AutocompleteItem as va, ExpandablePanel as kt, SettingsIcon as nt, Select as Se, SelectItem as fe, BooleanSwitchWithLabel as Lt, Dialog as Ee, toSnakeCase as Kt, singular as wa, ListIcon as _a, LoadingButton as wt, CircularProgress as $e, AutoAwesomeIcon as st, Paper as Ce, FormikArrayContainer as ka, DialogContent as Le, DialogActions as Ke, Button as M, SwitchControl as de, serializeRegExp as xa, isValidRegExp as Ca, RuleIcon as Oa, useSnackbarController as lt, resolveEnumValues as Na, FileUploadIcon as Pa, MultiSelect as qa, MultiSelectItem as qt, Checkbox as St, isPropertyBuilder as ne, useFireCMSContext as Ae, getFieldConfig as ct, ErrorBoundary as ke, FieldConfigBadge as Ye, cardMixin as Yt, cardClickableMixin as Ht, cardSelectedMixin as Gt, RemoveCircleIcon as Qt, FunctionsIcon as Sa, defaultBorderMixin as xt, RemoveIcon as Aa, DragHandleIcon as za, AddIcon as Oe, useNavigationContext as Ie, SelectGroup as At, mergeDeep as L, buildProperty as K, getFieldId as Zt, DEFAULT_FIELD_CONFIGS as _t, InfoLabel as Ta, DeleteIcon as it, DeleteConfirmationDialog as rt, useLargeLayout as Va, resolveEntityView as ja, Table as zt, TableBody as Tt, TableRow as gt, TableCell as De, buildCollection as Ct, unslugify as Jt, Card as Xt, useSelectionController as Fa, EntityCollectionTable as Ea, slugify as Ia, useAuthController as He, CircularProgressCenter as Vt, Tabs as Ba, Tab as ft, removeUndefined as Ma, ErrorView as Da, ArrowBackIcon as Ze, DoneIcon as Ra, SaveIcon as Ua, Menu as $a, MoreVertIcon as La, MenuItem as Ka, Collapse as Ya, sortProperties as Ha } from "@firecms/core";
5
+ import { iconKeys as $t, debounce as fa, SearchBar as ba, Tooltip as le, IconButton as pe, Icon as We, coolIconKeys as vt, Typography as N, getIconForView as et, useAutoComplete as ya, Container as ot, Chip as at, TextField as qe, cn as ve, DebouncedTextField as G, Autocomplete as va, AutocompleteItem as wa, ExpandablePanel as kt, SettingsIcon as nt, Select as Se, SelectItem as fe, BooleanSwitchWithLabel as Lt, Dialog as Ee, toSnakeCase as Kt, singular as _a, ListIcon as ka, LoadingButton as wt, CircularProgress as $e, AutoAwesomeIcon as st, Paper as Ce, FormikArrayContainer as xa, DialogContent as Le, DialogActions as Ke, Button as M, SwitchControl as de, serializeRegExp as Ca, isValidRegExp as Oa, RuleIcon as Na, useSnackbarController as lt, resolveEnumValues as Pa, FileUploadIcon as qa, MultiSelect as Sa, MultiSelectItem as qt, Checkbox as St, isPropertyBuilder as ne, useFireCMSContext as Ae, getFieldConfig as ct, ErrorBoundary as ke, FieldConfigBadge as Ye, cardMixin as Yt, cardClickableMixin as Ht, cardSelectedMixin as Gt, RemoveCircleIcon as Qt, FunctionsIcon as Aa, defaultBorderMixin as xt, RemoveIcon as za, DragHandleIcon as Ta, AddIcon as Oe, useNavigationContext as Ie, SelectGroup as At, mergeDeep as L, buildProperty as K, getFieldId as Zt, DEFAULT_FIELD_CONFIGS as _t, InfoLabel as Va, DeleteIcon as it, DeleteConfirmationDialog as rt, useLargeLayout as ja, resolveEntityView as Fa, Table as zt, TableBody as Tt, TableRow as gt, TableCell as De, buildCollection as Ct, unslugify as Jt, Card as Xt, useSelectionController as Ea, EntityCollectionTable as Ia, slugify as Ba, useAuthController as He, CircularProgressCenter as Vt, Tabs as Ma, Tab as ft, removeUndefined as Da, ErrorView as Ra, ArrowBackIcon as Ze, DoneIcon as Ua, SaveIcon as $a, Menu as La, MoreVertIcon as Ka, MenuItem as Ya, Collapse as Ha, sortProperties as Ga } from "@firecms/core";
6
6
  import { useFormikContext as U, Field as me, getIn as q, Formik as Ot, FastField as oe, Form as Wt } from "formik";
7
7
  import * as bt from "yup";
8
- import * as Ga from "js-search";
9
- import { extractEnumFromValues as Qa, buildPropertyFromData as Za, buildEntityPropertiesFromData as Ja } from "@firecms/schema_inference";
10
- import { DragDropContext as Xa, Droppable as Wa, Draggable as ei } from "@hello-pangea/dnd";
11
- import { ImportFileUpload as ti, DataNewPropertiesMapping as ai, ImportNewPropertyFieldPreview as ii, getInferenceType as ea, getPropertiesMapping as ri, convertDataToEntity as oi, useImportConfig as ni, ImportSaveInProgress as si } from "@firecms/data_import";
12
- import { useNavigate as li } from "react-router";
13
- const ci = bt.object().shape({
8
+ import * as Qa from "js-search";
9
+ import { extractEnumFromValues as Za, buildPropertyFromData as Ja, buildEntityPropertiesFromData as Xa } from "@firecms/schema_inference";
10
+ import { DragDropContext as Wa, Droppable as ei, Draggable as ti } from "@hello-pangea/dnd";
11
+ import { ImportFileUpload as ai, DataNewPropertiesMapping as ii, ImportNewPropertyFieldPreview as ri, getInferenceType as ea, getPropertiesMapping as oi, convertDataToEntity as ni, useImportConfig as si, ImportSaveInProgress as li } from "@firecms/data_import";
12
+ import { useNavigate as ci } from "react-router";
13
+ const di = bt.object().shape({
14
14
  name: bt.string().required("Required"),
15
15
  path: bt.string().required("Required")
16
16
  }), ta = {
@@ -1962,38 +1962,38 @@ const ci = bt.object().shape({
1962
1962
  zoom_in_map: "arrows destination location maps move place stop",
1963
1963
  zoom_out: "find glass look magnifier magnifying minus negative scale search see size smaller",
1964
1964
  zoom_out_map: "arrows destination location maps move place stop"
1965
- }, Nt = new Ga.Search("key");
1965
+ }, Nt = new Qa.Search("key");
1966
1966
  Nt.addIndex("synonyms");
1967
1967
  Nt.addDocuments($t.map((t) => ({
1968
1968
  key: t,
1969
1969
  // @ts-ignore
1970
1970
  synonyms: ta[t] ?? []
1971
1971
  })));
1972
- const di = 220;
1972
+ const pi = 220;
1973
1973
  process.env.NODE_ENV !== "production" && Object.keys(ta).forEach((t) => {
1974
1974
  $t.includes(t) || console.warn(`The icon ${t} no longer exists. Remove it from \`synonyms\``);
1975
1975
  });
1976
- function pi({ selectedIcon: t = "", onIconSelected: a }) {
1977
- const [r, i] = be.useState(null), [n, s] = be.useState(""), d = be.useMemo(
1978
- () => ga((m) => {
1976
+ function mi({ selectedIcon: t = "", onIconSelected: a }) {
1977
+ const [r, i] = be.useState(null), [s, n] = be.useState(""), d = be.useMemo(
1978
+ () => fa((m) => {
1979
1979
  if (!m || m === "")
1980
1980
  i(null);
1981
1981
  else {
1982
1982
  const u = Nt.search(m);
1983
1983
  i(u.map((p) => p.key));
1984
1984
  }
1985
- }, di),
1985
+ }, pi),
1986
1986
  []
1987
1987
  );
1988
- return be.useEffect(() => (d(n), () => {
1988
+ return be.useEffect(() => (d(s), () => {
1989
1989
  d.clear();
1990
- }), [n, d]), /* @__PURE__ */ o(I, { children: [
1990
+ }), [s, d]), /* @__PURE__ */ o(I, { children: [
1991
1991
  /* @__PURE__ */ e(
1992
- fa,
1992
+ ba,
1993
1993
  {
1994
1994
  autoFocus: !0,
1995
1995
  className: "w-full sticky top-0 z-10",
1996
- onTextSearch: (m) => s(m ?? ""),
1996
+ onTextSearch: (m) => n(m ?? ""),
1997
1997
  placeholder: "Search for more icons…"
1998
1998
  }
1999
1999
  ),
@@ -2015,13 +2015,13 @@ function ee({
2015
2015
  }) {
2016
2016
  return a ? /* @__PURE__ */ e(N, { variant: "caption", color: t ? "error" : "secondary", className: "ml-3.5 mt-0.5", children: a }) : null;
2017
2017
  }
2018
- function mi({
2018
+ function ui({
2019
2019
  isNewCollection: t,
2020
2020
  reservedGroups: a,
2021
2021
  existingPaths: r,
2022
2022
  existingAliases: i,
2023
- groups: n,
2024
- parentCollection: s
2023
+ groups: s,
2024
+ parentCollection: n
2025
2025
  }) {
2026
2026
  const d = R.useRef(null), {
2027
2027
  values: c,
@@ -2033,7 +2033,7 @@ function mi({
2033
2033
  isSubmitting: b,
2034
2034
  submitCount: f
2035
2035
  } = U(), [k, C] = Y(!1), x = (O) => {
2036
- m("name", O), !q(p, "path") && t && O && m("path", Kt(O)), !q(p, "singularName") && t && O && m("singularName", wa(O));
2036
+ m("name", O), !q(p, "path") && t && O && m("path", Kt(O)), !q(p, "singularName") && t && O && m("singularName", _a(O));
2037
2037
  }, h = et(c), y = Z((O) => {
2038
2038
  let F;
2039
2039
  return O || (F = "You must specify a path in the database for this collection"), t && i?.includes(O.trim().toLowerCase()) && (F = "There is already a collection which uses this path as an alias"), t && r?.includes(O.trim().toLowerCase()) && !c.alias && (F = "There is already a collection with the specified path. If you want to have multiple collections referring to the same database path, you need to define an alias in at least one of the collections"), F;
@@ -2042,13 +2042,13 @@ function mi({
2042
2042
  return;
2043
2043
  let F;
2044
2044
  return t && r?.includes(O.trim().toLowerCase()) && (F = "There is already a collection that uses this value as a path"), t && i?.includes(O.trim().toLowerCase()) && (F = "There is already a collection which uses this alias"), F;
2045
- }, [t, r, i]), w = n?.filter((O) => !a?.includes(O)), {
2045
+ }, [t, r, i]), w = s?.filter((O) => !a?.includes(O)), {
2046
2046
  inputFocused: v,
2047
2047
  autoCompleteOpen: T,
2048
2048
  setAutoCompleteOpen: P
2049
- } = ba({
2049
+ } = ya({
2050
2050
  ref: d
2051
- }), V = !!s;
2051
+ }), V = !!n;
2052
2052
  return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ o(ot, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
2053
2053
  /* @__PURE__ */ o("div", { children: [
2054
2054
  /* @__PURE__ */ o(
@@ -2068,9 +2068,9 @@ function mi({
2068
2068
  ]
2069
2069
  }
2070
2070
  ),
2071
- s && /* @__PURE__ */ e(at, { colorScheme: "tealDarker", children: /* @__PURE__ */ o(N, { variant: "caption", children: [
2071
+ n && /* @__PURE__ */ e(at, { colorScheme: "tealDarker", children: /* @__PURE__ */ o(N, { variant: "caption", children: [
2072
2072
  "This is a subcollection of ",
2073
- /* @__PURE__ */ e("b", { children: s.name })
2073
+ /* @__PURE__ */ e("b", { children: n.name })
2074
2074
  ] }) })
2075
2075
  ] }),
2076
2076
  /* @__PURE__ */ o("div", { className: "grid grid-cols-12 gap-4", children: [
@@ -2117,12 +2117,12 @@ function mi({
2117
2117
  }
2118
2118
  ),
2119
2119
  /* @__PURE__ */ e(
2120
- ya,
2120
+ va,
2121
2121
  {
2122
2122
  open: T && (w ?? []).length > 0,
2123
2123
  setOpen: P,
2124
2124
  children: w?.map((O, F) => /* @__PURE__ */ e(
2125
- va,
2125
+ wa,
2126
2126
  {
2127
2127
  onClick: () => {
2128
2128
  P(!1), m("group", O ?? null);
@@ -2238,7 +2238,7 @@ function mi({
2238
2238
  maxWidth: "xl",
2239
2239
  fullWidth: !0,
2240
2240
  children: /* @__PURE__ */ e("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ e(
2241
- pi,
2241
+ mi,
2242
2242
  {
2243
2243
  selectedIcon: c.icon,
2244
2244
  onIconSelected: (O) => {
@@ -2253,7 +2253,7 @@ function mi({
2253
2253
  function ye(t) {
2254
2254
  return "properties." + t.replaceAll(".", ".properties.");
2255
2255
  }
2256
- function ui(t) {
2256
+ function hi(t) {
2257
2257
  return t ? "properties." + t.replaceAll(".", ".properties.") + ".properties" : "properties";
2258
2258
  }
2259
2259
  function xe(t) {
@@ -2262,13 +2262,13 @@ function xe(t) {
2262
2262
  function re(t, a) {
2263
2263
  return a ? `${a}.${t}` : t;
2264
2264
  }
2265
- const hi = R.memo(
2265
+ const gi = R.memo(
2266
2266
  function({
2267
2267
  enumValues: a,
2268
2268
  onValuesChanged: r,
2269
2269
  onError: i,
2270
- updateIds: n,
2271
- disabled: s,
2270
+ updateIds: s,
2271
+ disabled: n,
2272
2272
  allowDataInference: d,
2273
2273
  getData: c
2274
2274
  }) {
@@ -2287,13 +2287,13 @@ const hi = R.memo(
2287
2287
  }, [m.enumValues]), se(() => {
2288
2288
  i && i(!!(u?.enumValues ?? !1));
2289
2289
  }, [u]), /* @__PURE__ */ e(
2290
- gi,
2290
+ fi,
2291
2291
  {
2292
2292
  enumValuesPath: "enumValues",
2293
2293
  values: m,
2294
2294
  errors: u,
2295
- shouldUpdateId: n,
2296
- disabled: s,
2295
+ shouldUpdateId: s,
2296
+ disabled: n,
2297
2297
  allowDataInference: d,
2298
2298
  getData: c
2299
2299
  }
@@ -2305,13 +2305,13 @@ const hi = R.memo(
2305
2305
  return a.enumValues.length === r.enumValues.length && a.onValuesChanged === r.onValuesChanged && a.getData === r.getData;
2306
2306
  }
2307
2307
  );
2308
- function gi({
2308
+ function fi({
2309
2309
  values: t,
2310
2310
  errors: a,
2311
2311
  disabled: r,
2312
2312
  enumValuesPath: i,
2313
- shouldUpdateId: n,
2314
- allowDataInference: s,
2313
+ shouldUpdateId: s,
2314
+ allowDataInference: n,
2315
2315
  getData: d
2316
2316
  }) {
2317
2317
  const {
@@ -2319,13 +2319,13 @@ function gi({
2319
2319
  } = U(), [m, u] = R.useState(), [p, l] = R.useState(), [g, b] = R.useState(!1), k = R.useRef(/* @__PURE__ */ new Set()).current, C = (h, y) => {
2320
2320
  const _ = m === y;
2321
2321
  return /* @__PURE__ */ e(
2322
- fi,
2322
+ bi,
2323
2323
  {
2324
2324
  index: h,
2325
2325
  disabled: r,
2326
2326
  enumValuesPath: i,
2327
2327
  autoFocus: _,
2328
- shouldUpdateId: n || _,
2328
+ shouldUpdateId: s || _,
2329
2329
  onDialogOpen: () => l(h),
2330
2330
  inferredEntry: k.has(t.enumValues[h]?.id)
2331
2331
  },
@@ -2334,7 +2334,7 @@ function gi({
2334
2334
  };
2335
2335
  return /* @__PURE__ */ o("div", { className: "col-span-12", children: [
2336
2336
  /* @__PURE__ */ o("div", { className: "ml-3.5 flex flex-row items-center", children: [
2337
- /* @__PURE__ */ e(_a, {}),
2337
+ /* @__PURE__ */ e(ka, {}),
2338
2338
  /* @__PURE__ */ e(
2339
2339
  N,
2340
2340
  {
@@ -2343,7 +2343,7 @@ function gi({
2343
2343
  children: "Values"
2344
2344
  }
2345
2345
  ),
2346
- s && /* @__PURE__ */ o(
2346
+ n && /* @__PURE__ */ o(
2347
2347
  wt,
2348
2348
  {
2349
2349
  loading: g,
@@ -2354,7 +2354,7 @@ function gi({
2354
2354
  b(!0), d?.().then((h) => {
2355
2355
  if (!h)
2356
2356
  return;
2357
- const y = h.flat(), _ = Array.from(new Set(y)), w = t.enumValues, T = Qa(_).filter((P) => !w?.some((V) => V.id === P.id));
2357
+ const y = h.flat(), _ = Array.from(new Set(y)), w = t.enumValues, T = Za(_).filter((P) => !w?.some((V) => V.id === P.id));
2358
2358
  T.forEach((P) => {
2359
2359
  k.add(P.id);
2360
2360
  }), c(i, [...T, ...w]);
@@ -2371,7 +2371,7 @@ function gi({
2371
2371
  ] }),
2372
2372
  /* @__PURE__ */ o(Ce, { className: "p-4 m-1", children: [
2373
2373
  /* @__PURE__ */ e(
2374
- ka,
2374
+ xa,
2375
2375
  {
2376
2376
  value: t.enumValues,
2377
2377
  addLabel: "Add enum value",
@@ -2385,7 +2385,7 @@ function gi({
2385
2385
  }
2386
2386
  ),
2387
2387
  /* @__PURE__ */ e(
2388
- bi,
2388
+ yi,
2389
2389
  {
2390
2390
  index: p,
2391
2391
  open: p !== void 0,
@@ -2396,13 +2396,13 @@ function gi({
2396
2396
  ] })
2397
2397
  ] });
2398
2398
  }
2399
- const fi = R.memo(
2399
+ const bi = R.memo(
2400
2400
  function({
2401
2401
  index: a,
2402
2402
  shouldUpdateId: r,
2403
2403
  enumValuesPath: i,
2404
- autoFocus: n,
2405
- onDialogOpen: s,
2404
+ autoFocus: s,
2405
+ onDialogOpen: n,
2406
2406
  disabled: d,
2407
2407
  inferredEntry: c
2408
2408
  }) {
@@ -2425,8 +2425,8 @@ const fi = R.memo(
2425
2425
  required: !0,
2426
2426
  disabled: d,
2427
2427
  size: "small",
2428
- validate: yi,
2429
- autoFocus: n,
2428
+ validate: vi,
2429
+ autoFocus: s,
2430
2430
  autoComplete: "off",
2431
2431
  endAdornment: c && /* @__PURE__ */ e(st, { size: "small" }),
2432
2432
  error: !!x
@@ -2438,7 +2438,7 @@ const fi = R.memo(
2438
2438
  size: "small",
2439
2439
  "aria-label": "edit",
2440
2440
  className: "m-1",
2441
- onClick: () => s(),
2441
+ onClick: () => n(),
2442
2442
  children: /* @__PURE__ */ e(nt, { size: "small" })
2443
2443
  }
2444
2444
  )
@@ -2448,15 +2448,15 @@ const fi = R.memo(
2448
2448
  return a.index === r.index && a.enumValuesPath === r.enumValuesPath && a.shouldUpdateId === r.shouldUpdateId && a.inferredEntry === r.inferredEntry && a.autoFocus === r.autoFocus;
2449
2449
  }
2450
2450
  );
2451
- function bi({
2451
+ function yi({
2452
2452
  index: t,
2453
2453
  open: a,
2454
2454
  onClose: r,
2455
2455
  enumValuesPath: i
2456
2456
  }) {
2457
2457
  const {
2458
- values: n,
2459
- handleChange: s,
2458
+ values: s,
2459
+ handleChange: n,
2460
2460
  errors: d,
2461
2461
  setFieldValue: c,
2462
2462
  touched: m
@@ -2476,7 +2476,7 @@ function bi({
2476
2476
  name: `${i}[${t}]id`,
2477
2477
  as: G,
2478
2478
  required: !0,
2479
- validate: vi,
2479
+ validate: wi,
2480
2480
  label: "ID",
2481
2481
  size: "small",
2482
2482
  autoComplete: "off",
@@ -2499,16 +2499,16 @@ function bi({
2499
2499
  }
2500
2500
  );
2501
2501
  }
2502
- function yi(t) {
2502
+ function vi(t) {
2503
2503
  let a;
2504
2504
  return t || (a = "You must specify a label"), a;
2505
2505
  }
2506
- function vi(t) {
2506
+ function wi(t) {
2507
2507
  let a;
2508
2508
  return t || (a = "You must specify an ID"), a;
2509
2509
  }
2510
2510
  function ze({ disabled: t }) {
2511
- const { values: a, handleChange: r } = U(), i = "validation.required", n = "validation.requiredMessage";
2511
+ const { values: a, handleChange: r } = U(), i = "validation.required", s = "validation.requiredMessage";
2512
2512
  return /* @__PURE__ */ o(I, { children: [
2513
2513
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
2514
2514
  oe,
@@ -2536,9 +2536,9 @@ function ze({ disabled: t }) {
2536
2536
  G,
2537
2537
  {
2538
2538
  disabled: t,
2539
- value: q(a, n),
2539
+ value: q(a, s),
2540
2540
  label: "Required message",
2541
- name: n,
2541
+ name: s,
2542
2542
  size: "small",
2543
2543
  onChange: r
2544
2544
  }
@@ -2550,8 +2550,8 @@ function je({
2550
2550
  lowercase: a,
2551
2551
  matches: r,
2552
2552
  max: i,
2553
- min: n,
2554
- trim: s,
2553
+ min: s,
2554
+ trim: n,
2555
2555
  uppercase: d,
2556
2556
  disabled: c,
2557
2557
  showErrors: m
@@ -2560,7 +2560,7 @@ function je({
2560
2560
  values: u,
2561
2561
  handleChange: p,
2562
2562
  errors: l
2563
- } = U(), g = "validation.length", b = "validation.min", f = "validation.max", k = "validation.trim", C = "validation.matches", x = "validation.lowercase", h = "validation.uppercase", y = q(l, C), _ = q(u, C), w = typeof _ == "string" ? _ : xa(_);
2563
+ } = U(), g = "validation.length", b = "validation.min", f = "validation.max", k = "validation.trim", C = "validation.matches", x = "validation.lowercase", h = "validation.uppercase", y = q(l, C), _ = q(u, C), w = typeof _ == "string" ? _ : Ca(_);
2564
2564
  return /* @__PURE__ */ o("div", { className: "grid grid-cols-12 gap-2", children: [
2565
2565
  /* @__PURE__ */ e(ze, { disabled: c }),
2566
2566
  /* @__PURE__ */ o("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
@@ -2584,7 +2584,7 @@ function je({
2584
2584
  component: de
2585
2585
  }
2586
2586
  ) }),
2587
- s && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2587
+ n && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2588
2588
  oe,
2589
2589
  {
2590
2590
  type: "checkbox",
@@ -2608,7 +2608,7 @@ function je({
2608
2608
  onChange: p
2609
2609
  }
2610
2610
  ) }),
2611
- n && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2611
+ s && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2612
2612
  G,
2613
2613
  {
2614
2614
  value: q(u, b),
@@ -2639,7 +2639,7 @@ function je({
2639
2639
  {
2640
2640
  name: C,
2641
2641
  as: G,
2642
- validate: (v) => v && !Ca(v),
2642
+ validate: (v) => v && !Oa(v),
2643
2643
  label: "Matches regex",
2644
2644
  size: "small",
2645
2645
  disabled: c,
@@ -2658,20 +2658,20 @@ function Pt({
2658
2658
  }) {
2659
2659
  const {
2660
2660
  values: i,
2661
- handleChange: n
2662
- } = U(), s = "validation.min", d = "validation.max";
2661
+ handleChange: s
2662
+ } = U(), n = "validation.min", d = "validation.max";
2663
2663
  return /* @__PURE__ */ o("div", { className: "grid grid-cols-12 gap-2", children: [
2664
2664
  /* @__PURE__ */ e(ze, { disabled: r }),
2665
2665
  a && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
2666
2666
  G,
2667
2667
  {
2668
- value: q(i, s),
2668
+ value: q(i, n),
2669
2669
  disabled: r,
2670
2670
  label: "Min length",
2671
- name: s,
2671
+ name: n,
2672
2672
  type: "number",
2673
2673
  size: "small",
2674
- onChange: n
2674
+ onChange: s
2675
2675
  }
2676
2676
  ) }),
2677
2677
  t && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
@@ -2683,7 +2683,7 @@ function Pt({
2683
2683
  name: d,
2684
2684
  type: "number",
2685
2685
  size: "small",
2686
- onChange: n
2686
+ onChange: s
2687
2687
  }
2688
2688
  ) })
2689
2689
  ] });
@@ -2698,7 +2698,7 @@ function Ne({
2698
2698
  asField: !0,
2699
2699
  className: "p-4",
2700
2700
  title: /* @__PURE__ */ o("div", { className: "flex flex-row text-gray-500", children: [
2701
- /* @__PURE__ */ e(Oa, {}),
2701
+ /* @__PURE__ */ e(Na, {}),
2702
2702
  /* @__PURE__ */ e(
2703
2703
  N,
2704
2704
  {
@@ -2717,8 +2717,8 @@ function jt({
2717
2717
  updateIds: a,
2718
2718
  disabled: r,
2719
2719
  showErrors: i,
2720
- allowDataInference: n,
2721
- getData: s
2720
+ allowDataInference: s,
2721
+ getData: n
2722
2722
  }) {
2723
2723
  const {
2724
2724
  values: d,
@@ -2727,19 +2727,19 @@ function jt({
2727
2727
  touched: u,
2728
2728
  setFieldError: p,
2729
2729
  setFieldValue: l
2730
- } = U(), g = lt(), b = t ? "of.enumValues" : "enumValues", f = q(d, "defaultValue"), k = q(d, b), C = Rt(() => !k || typeof k == "boolean" ? [] : Na(k) ?? [], [k]);
2730
+ } = U(), g = lt(), b = t ? "of.enumValues" : "enumValues", f = q(d, "defaultValue"), k = q(d, b), C = Rt(() => !k || typeof k == "boolean" ? [] : Pa(k) ?? [], [k]);
2731
2731
  return /* @__PURE__ */ o(I, { children: [
2732
2732
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2733
- hi,
2733
+ gi,
2734
2734
  {
2735
2735
  enumValues: C,
2736
2736
  updateIds: a,
2737
2737
  disabled: r,
2738
- allowDataInference: n,
2738
+ allowDataInference: s,
2739
2739
  onError: (h) => {
2740
2740
  p(b, h ? "" : void 0);
2741
2741
  },
2742
- getData: s ? () => s().then((h) => h.map((y) => d.id && q(y, d.id)).filter(Boolean)) : void 0,
2742
+ getData: n ? () => n().then((h) => h.map((y) => d.id && q(y, d.id)).filter(Boolean)) : void 0,
2743
2743
  onValuesChanged: (h) => {
2744
2744
  if (d && (l(b, h), !t)) {
2745
2745
  const y = h.filter((_) => !!_?.id).map((_) => _.id);
@@ -2797,16 +2797,16 @@ function Ft({
2797
2797
  }) {
2798
2798
  const {
2799
2799
  values: i,
2800
- setFieldValue: n
2801
- } = U(), s = t ? "of.storage" : "storage", d = `${s}.acceptedFiles`, c = `${s}.fileName`, m = `${s}.storagePath`, u = `${s}.storeUrl`, p = q(i, c) ?? "{rand}_{file}", l = q(i, m) ?? "/", g = q(i, d), b = Array.isArray(g) ? g : void 0, f = !b || b.length === 0, k = (h) => {
2802
- h ? h.includes("all") || h.length >= Object.keys(Je).length ? n(d, void 0) : f ? n(d, Object.keys(Je).filter((y) => !h.includes(y))) : n(d, h) : n(d, void 0);
2800
+ setFieldValue: s
2801
+ } = U(), n = t ? "of.storage" : "storage", d = `${n}.acceptedFiles`, c = `${n}.fileName`, m = `${n}.storagePath`, u = `${n}.storeUrl`, p = q(i, c) ?? "{rand}_{file}", l = q(i, m) ?? "/", g = q(i, d), b = Array.isArray(g) ? g : void 0, f = !b || b.length === 0, k = (h) => {
2802
+ h ? h.includes("all") || h.length >= Object.keys(Je).length ? s(d, void 0) : f ? s(d, Object.keys(Je).filter((y) => !h.includes(y))) : s(d, h) : s(d, void 0);
2803
2803
  }, C = typeof p == "function", x = typeof l == "function";
2804
2804
  return /* @__PURE__ */ o(I, { children: [
2805
2805
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2806
2806
  kt,
2807
2807
  {
2808
2808
  title: /* @__PURE__ */ o("div", { className: "flex flex-row text-gray-500", children: [
2809
- /* @__PURE__ */ e(Pa, {}),
2809
+ /* @__PURE__ */ e(qa, {}),
2810
2810
  /* @__PURE__ */ e(
2811
2811
  N,
2812
2812
  {
@@ -2818,7 +2818,7 @@ function Ft({
2818
2818
  ] }),
2819
2819
  children: /* @__PURE__ */ o("div", { className: "grid grid-cols-12 gap-2 p-4", children: [
2820
2820
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ o(
2821
- qa,
2821
+ Sa,
2822
2822
  {
2823
2823
  disabled: r,
2824
2824
  name: d,
@@ -2849,7 +2849,7 @@ function Ft({
2849
2849
  {
2850
2850
  size: "small",
2851
2851
  variant: "outlined",
2852
- onClick: (_) => (_.preventDefault(), _.stopPropagation(), n(d, [h])),
2852
+ onClick: (_) => (_.preventDefault(), _.stopPropagation(), s(d, [h])),
2853
2853
  children: "Only"
2854
2854
  }
2855
2855
  )
@@ -2922,14 +2922,14 @@ function Ue(t) {
2922
2922
  return a.dataType === "array" && typeof a.of == "function" || a.dataType === "array" && Array.isArray(a.of) ? !1 : !!a.editable;
2923
2923
  }
2924
2924
  }
2925
- function wi(t) {
2925
+ function _i(t) {
2926
2926
  return Object.entries(t).filter(([a, r]) => Ue(r)).map(([a, r]) => {
2927
2927
  const i = r;
2928
2928
  if (Ue(i))
2929
2929
  return i.dataType === "map" && i.properties ? {
2930
2930
  [a]: {
2931
2931
  ...i,
2932
- properties: wi(i.properties)
2932
+ properties: _i(i.properties)
2933
2933
  }
2934
2934
  } : { [a]: i };
2935
2935
  }).filter((a) => !!a).reduce((a, r) => ({ ...a, ...r }), {});
@@ -2939,8 +2939,8 @@ function aa({
2939
2939
  onClick: a,
2940
2940
  hasError: r,
2941
2941
  includeName: i,
2942
- includeEditButton: n,
2943
- selected: s
2942
+ includeEditButton: s,
2943
+ selected: n
2944
2944
  }) {
2945
2945
  const { fields: d } = Ae(), c = ct(t, d), m = !Ue(t);
2946
2946
  return /* @__PURE__ */ e(ke, { children: /* @__PURE__ */ o(
@@ -2957,9 +2957,9 @@ function aa({
2957
2957
  "pl-2 w-full flex flex-row gap-4 items-center",
2958
2958
  Yt,
2959
2959
  a ? Ht : "",
2960
- s ? Gt : "",
2960
+ n ? Gt : "",
2961
2961
  "flex-grow p-4 border transition-colors duration-200",
2962
- r ? "border-red-500" : s ? "border-blue-500" : "border-transparent"
2962
+ r ? "border-red-500" : n ? "border-blue-500" : "border-transparent"
2963
2963
  ),
2964
2964
  children: [
2965
2965
  /* @__PURE__ */ o("div", { className: "w-full flex flex-col", children: [
@@ -3001,7 +3001,7 @@ function aa({
3001
3001
  )
3002
3002
  ] })
3003
3003
  ] }),
3004
- n && /* @__PURE__ */ e(N, { variant: "button", children: "EDIT" })
3004
+ s && /* @__PURE__ */ e(N, { variant: "button", children: "EDIT" })
3005
3005
  ]
3006
3006
  }
3007
3007
  )
@@ -3009,13 +3009,13 @@ function aa({
3009
3009
  }
3010
3010
  ) });
3011
3011
  }
3012
- function _i({
3012
+ function ki({
3013
3013
  name: t,
3014
3014
  selected: a,
3015
3015
  onClick: r,
3016
3016
  property: i
3017
3017
  }) {
3018
- const { fields: n } = Ae(), s = !ne(i) && i ? ct(i, n) : void 0;
3018
+ const { fields: s } = Ae(), n = !ne(i) && i ? ct(i, s) : void 0;
3019
3019
  return /* @__PURE__ */ o(
3020
3020
  "div",
3021
3021
  {
@@ -3023,12 +3023,12 @@ function _i({
3023
3023
  className: "flex flex-row w-full cursor-pointer",
3024
3024
  children: [
3025
3025
  /* @__PURE__ */ o("div", { className: "relative m-4", children: [
3026
- s && /* @__PURE__ */ e(Ye, { fieldConfig: s }),
3027
- !s && /* @__PURE__ */ e(
3026
+ n && /* @__PURE__ */ e(Ye, { fieldConfig: n }),
3027
+ !n && /* @__PURE__ */ e(
3028
3028
  "div",
3029
3029
  {
3030
3030
  className: "h-8 w-8 p-1 rounded-full shadow text-white bg-gray-500",
3031
- children: /* @__PURE__ */ e(Sa, { color: "inherit", size: "medium" })
3031
+ children: /* @__PURE__ */ e(Aa, { color: "inherit", size: "medium" })
3032
3032
  }
3033
3033
  ),
3034
3034
  /* @__PURE__ */ e(Qt, { color: "disabled", size: "small", className: "absolute -right-2 -top-2" })
@@ -3055,14 +3055,14 @@ function _i({
3055
3055
  }
3056
3056
  ),
3057
3057
  /* @__PURE__ */ o("div", { className: "flex flex-row items-center", children: [
3058
- s && /* @__PURE__ */ e(
3058
+ n && /* @__PURE__ */ e(
3059
3059
  N,
3060
3060
  {
3061
3061
  className: "flex-grow pr-2",
3062
3062
  variant: "body2",
3063
3063
  component: "span",
3064
3064
  color: "secondary",
3065
- children: s?.name
3065
+ children: n?.name
3066
3066
  }
3067
3067
  ),
3068
3068
  i && !ne(i) && /* @__PURE__ */ e(ke, { children: /* @__PURE__ */ e(
@@ -3105,21 +3105,21 @@ function dt({
3105
3105
  selectedPropertyKey: a,
3106
3106
  onPropertyClick: r,
3107
3107
  properties: i,
3108
- propertiesOrder: n,
3109
- additionalFields: s,
3108
+ propertiesOrder: s,
3109
+ additionalFields: n,
3110
3110
  errors: d,
3111
3111
  onPropertyMove: c,
3112
3112
  onPropertyRemove: m,
3113
3113
  className: u,
3114
3114
  inferredPropertyKeys: p
3115
3115
  }) {
3116
- const l = n ?? Object.keys(i), g = Z((b) => {
3116
+ const l = s ?? Object.keys(i), g = Z((b) => {
3117
3117
  if (!b.destination)
3118
3118
  return;
3119
3119
  const f = b.source.index, k = b.destination.index, C = Array.from(l), [x] = C.splice(f, 1);
3120
3120
  C.splice(k, 0, x), c && c(C, t);
3121
3121
  }, [t, c, l]);
3122
- return /* @__PURE__ */ e(I, { children: /* @__PURE__ */ e(Xa, { onDragEnd: g, children: /* @__PURE__ */ e(Wa, { droppableId: `droppable_${t}`, children: (b, f) => /* @__PURE__ */ o(
3122
+ return /* @__PURE__ */ e(I, { children: /* @__PURE__ */ e(Wa, { onDragEnd: g, children: /* @__PURE__ */ e(ei, { droppableId: `droppable_${t}`, children: (b, f) => /* @__PURE__ */ o(
3123
3123
  "div",
3124
3124
  {
3125
3125
  ...b.droppableProps,
@@ -3127,14 +3127,14 @@ function dt({
3127
3127
  className: u,
3128
3128
  children: [
3129
3129
  l && l.map((k, C) => {
3130
- const x = i[k], h = s?.find((y) => y.id === k);
3130
+ const x = i[k], h = n?.find((y) => y.id === k);
3131
3131
  return !x && !h ? (console.warn(`Property ${k} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
3132
- ei,
3132
+ ti,
3133
3133
  {
3134
3134
  draggableId: `array_field_${t}_${k}}`,
3135
3135
  index: C,
3136
3136
  children: (y, _) => /* @__PURE__ */ e(ke, { children: /* @__PURE__ */ e(
3137
- ki,
3137
+ xi,
3138
3138
  {
3139
3139
  propertyKey: k,
3140
3140
  propertyOrBuilder: x,
@@ -3158,13 +3158,13 @@ function dt({
3158
3158
  }
3159
3159
  ) }) }) });
3160
3160
  }
3161
- function ki({
3161
+ function xi({
3162
3162
  propertyKey: t,
3163
3163
  namespace: a,
3164
3164
  propertyOrBuilder: r,
3165
3165
  additionalField: i,
3166
- provided: n,
3167
- selectedPropertyKey: s,
3166
+ provided: s,
3167
+ selectedPropertyKey: n,
3168
3168
  errors: d,
3169
3169
  onPropertyClick: c,
3170
3170
  onPropertyMove: m,
@@ -3178,7 +3178,7 @@ function ki({
3178
3178
  x.dataType === "map" && x.properties && (b = /* @__PURE__ */ e(
3179
3179
  dt,
3180
3180
  {
3181
- selectedPropertyKey: s,
3181
+ selectedPropertyKey: n,
3182
3182
  namespace: g,
3183
3183
  properties: x.properties,
3184
3184
  propertiesOrder: x.propertiesOrder,
@@ -3189,13 +3189,13 @@ function ki({
3189
3189
  }
3190
3190
  ));
3191
3191
  }
3192
- const f = g ? q(d, ye(g)) : !1, k = s === g, C = r && Ue(r);
3192
+ const f = g ? q(d, ye(g)) : !1, k = n === g, C = r && Ue(r);
3193
3193
  return /* @__PURE__ */ o(
3194
3194
  "div",
3195
3195
  {
3196
- ref: n.innerRef,
3197
- ...n.draggableProps,
3198
- ...n.dragHandleProps,
3196
+ ref: s.innerRef,
3197
+ ...s.draggableProps,
3198
+ ...s.dragHandleProps,
3199
3199
  className: "relative -ml-8",
3200
3200
  children: [
3201
3201
  b && /* @__PURE__ */ e(
@@ -3219,7 +3219,7 @@ function ki({
3219
3219
  hasError: f
3220
3220
  }
3221
3221
  ) : /* @__PURE__ */ e(
3222
- _i,
3222
+ ki,
3223
3223
  {
3224
3224
  name: t,
3225
3225
  property: r,
@@ -3235,7 +3235,7 @@ function ki({
3235
3235
  size: "small",
3236
3236
  color: "inherit",
3237
3237
  onClick: () => u(t, a),
3238
- children: /* @__PURE__ */ e(Aa, { size: "small" })
3238
+ children: /* @__PURE__ */ e(za, { size: "small" })
3239
3239
  }
3240
3240
  ) }),
3241
3241
  m && /* @__PURE__ */ e(le, { title: "Move", children: /* @__PURE__ */ e(
@@ -3243,7 +3243,7 @@ function ki({
3243
3243
  {
3244
3244
  component: "span",
3245
3245
  size: "small",
3246
- children: /* @__PURE__ */ e(za, { size: "small" })
3246
+ children: /* @__PURE__ */ e(Ta, { size: "small" })
3247
3247
  }
3248
3248
  ) })
3249
3249
  ] }),
@@ -3252,27 +3252,27 @@ function ki({
3252
3252
  }
3253
3253
  );
3254
3254
  }
3255
- function xi({ disabled: t, getData: a, allowDataInference: r, customFields: i }) {
3255
+ function Ci({ disabled: t, getData: a, allowDataInference: r, customFields: i }) {
3256
3256
  const {
3257
- values: n,
3258
- setFieldValue: s
3259
- } = U(), [d, c] = Y(!1), [m, u] = Y(), [p, l] = Y(), g = n.propertiesOrder ?? Object.keys(n.properties ?? {}), b = Z(({
3257
+ values: s,
3258
+ setFieldValue: n
3259
+ } = U(), [d, c] = Y(!1), [m, u] = Y(), [p, l] = Y(), g = s.propertiesOrder ?? Object.keys(s.properties ?? {}), b = Z(({
3260
3260
  id: _,
3261
3261
  property: w
3262
3262
  }) => {
3263
3263
  if (!_)
3264
3264
  throw Error();
3265
- s("properties", {
3266
- ...n.properties ?? {},
3265
+ n("properties", {
3266
+ ...s.properties ?? {},
3267
3267
  [_]: w
3268
- }, !1), s("propertiesOrder", [...g, _], !1), c(!1);
3269
- }, [n.properties, g]), f = Z((_, w) => {
3268
+ }, !1), n("propertiesOrder", [...g, _], !1), c(!1);
3269
+ }, [s.properties, g]), f = Z((_, w) => {
3270
3270
  const v = _ ? re(_, w) : void 0;
3271
3271
  if (!v)
3272
3272
  throw Error("collection editor miss config");
3273
- const T = ye(v), P = xe(w), V = q(n, P) ?? Object.keys(q(n, ui(w)));
3274
- s(T, void 0, !1), s(P, V.filter((O) => O !== _), !1), c(!1), u(void 0), l(void 0);
3275
- }, [s, n]), k = m ? re(m, p) : void 0, C = k ? q(n.properties, k.replaceAll(".", ".properties.")) : void 0, x = /* @__PURE__ */ o(
3273
+ const T = ye(v), P = xe(w), V = q(s, P) ?? Object.keys(q(s, hi(w)));
3274
+ n(T, void 0, !1), n(P, V.filter((O) => O !== _), !1), c(!1), u(void 0), l(void 0);
3275
+ }, [n, s]), k = m ? re(m, p) : void 0, C = k ? q(s.properties, k.replaceAll(".", ".properties.")) : void 0, x = /* @__PURE__ */ o(
3276
3276
  M,
3277
3277
  {
3278
3278
  color: "primary",
@@ -3281,11 +3281,11 @@ function xi({ disabled: t, getData: a, allowDataInference: r, customFields: i })
3281
3281
  startIcon: /* @__PURE__ */ e(Oe, {}),
3282
3282
  children: [
3283
3283
  "Add property to ",
3284
- n.name ?? "this group"
3284
+ s.name ?? "this group"
3285
3285
  ]
3286
3286
  }
3287
3287
  ), h = !g || g.length < 1, y = Z((_, w) => {
3288
- s(xe(w), _, !1);
3288
+ n(xe(w), _, !1);
3289
3289
  }, []);
3290
3290
  return /* @__PURE__ */ o(I, { children: [
3291
3291
  /* @__PURE__ */ o("div", { className: "col-span-12", children: [
@@ -3297,7 +3297,7 @@ function xi({ disabled: t, getData: a, allowDataInference: r, customFields: i })
3297
3297
  /* @__PURE__ */ e(
3298
3298
  dt,
3299
3299
  {
3300
- properties: n.properties ?? {},
3300
+ properties: s.properties ?? {},
3301
3301
  propertiesOrder: g,
3302
3302
  errors: {},
3303
3303
  onPropertyClick: (_, w) => {
@@ -3323,8 +3323,8 @@ function xi({ disabled: t, getData: a, allowDataInference: r, customFields: i })
3323
3323
  position: "start",
3324
3324
  size: "small",
3325
3325
  label: "Spread children as columns",
3326
- onValueChange: (_) => s("spreadChildren", _),
3327
- value: n.spreadChildren ?? !1
3326
+ onValueChange: (_) => n("spreadChildren", _),
3327
+ value: s.spreadChildren ?? !1
3328
3328
  }
3329
3329
  ),
3330
3330
  /* @__PURE__ */ e(ee, { children: "Set this flag to true if you want to display the children of this group as individual columns." })
@@ -3357,13 +3357,13 @@ function xi({ disabled: t, getData: a, allowDataInference: r, customFields: i })
3357
3357
  )
3358
3358
  ] });
3359
3359
  }
3360
- function Ci({
3360
+ function Oi({
3361
3361
  showErrors: t,
3362
3362
  existing: a,
3363
3363
  disabled: r,
3364
3364
  getData: i,
3365
- allowDataInference: n,
3366
- customFields: s
3365
+ allowDataInference: s,
3366
+ customFields: n
3367
3367
  }) {
3368
3368
  const { fields: d } = Ae(), {
3369
3369
  values: c,
@@ -3418,12 +3418,12 @@ function Ci({
3418
3418
  autoUpdateId: !a,
3419
3419
  autoOpenTypeSelect: !a,
3420
3420
  onOkClicked: () => b(!1),
3421
- allowDataInference: n,
3421
+ allowDataInference: s,
3422
3422
  property: f,
3423
3423
  includeIdAndName: !1,
3424
3424
  onPropertyChanged: C,
3425
3425
  forceShowErrors: t,
3426
- customFields: s
3426
+ customFields: n
3427
3427
  }
3428
3428
  )
3429
3429
  ] })
@@ -3433,13 +3433,13 @@ function Ci({
3433
3433
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Pt, { disabled: r }) }) })
3434
3434
  ] });
3435
3435
  }
3436
- const Oi = R.forwardRef(
3436
+ const Ni = R.forwardRef(
3437
3437
  function({
3438
3438
  showErrors: a,
3439
3439
  disabledId: r,
3440
3440
  existingPropertyKeys: i,
3441
- disabled: n,
3442
- isNewProperty: s
3441
+ disabled: s,
3442
+ isNewProperty: n
3443
3443
  }, d) {
3444
3444
  const {
3445
3445
  errors: c
@@ -3452,12 +3452,12 @@ const Oi = R.forwardRef(
3452
3452
  inputRef: d,
3453
3453
  name: m,
3454
3454
  as: G,
3455
- invisible: !s,
3455
+ invisible: !n,
3456
3456
  style: { fontSize: 20 },
3457
- validate: qi,
3457
+ validate: Si,
3458
3458
  placeholder: "Field name",
3459
3459
  required: !0,
3460
- disabled: n,
3460
+ disabled: s,
3461
3461
  error: !!u
3462
3462
  }
3463
3463
  ),
@@ -3470,8 +3470,8 @@ const Oi = R.forwardRef(
3470
3470
  name: p,
3471
3471
  as: qe,
3472
3472
  label: "ID",
3473
- validate: (f) => Pi(f, i),
3474
- disabled: r || n,
3473
+ validate: (f) => qi(f, i),
3474
+ disabled: r || s,
3475
3475
  required: !0,
3476
3476
  size: "small",
3477
3477
  error: !!l
@@ -3486,7 +3486,7 @@ const Oi = R.forwardRef(
3486
3486
  name: g,
3487
3487
  as: G,
3488
3488
  label: "Description",
3489
- disabled: n,
3489
+ disabled: s,
3490
3490
  error: !!b
3491
3491
  }
3492
3492
  ),
@@ -3494,21 +3494,21 @@ const Oi = R.forwardRef(
3494
3494
  ] })
3495
3495
  ] });
3496
3496
  }
3497
- ), Ni = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
3498
- function Pi(t, a) {
3497
+ ), Pi = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
3498
+ function qi(t, a) {
3499
3499
  let r;
3500
- return t || (r = "You must specify an id for the field"), t && !t.match(Ni) && (r = "The id can only contain letters, numbers and underscores (_), and not start with a number"), t && a && a.includes(t) && (r = "There is another field with this ID already"), r;
3500
+ return t || (r = "You must specify an id for the field"), t && !t.match(Pi) && (r = "The id can only contain letters, numbers and underscores (_), and not start with a number"), t && a && a.includes(t) && (r = "There is another field with this ID already"), r;
3501
3501
  }
3502
- function qi(t) {
3502
+ function Si(t) {
3503
3503
  let a;
3504
3504
  return t || (a = "You must specify a title for the field"), a;
3505
3505
  }
3506
- function Si({
3506
+ function Ai({
3507
3507
  widgetId: t,
3508
3508
  disabled: a,
3509
3509
  showErrors: r
3510
3510
  }) {
3511
- const { values: i, setFieldValue: n } = U();
3511
+ const { values: i, setFieldValue: s } = U();
3512
3512
  return /* @__PURE__ */ o(I, { children: [
3513
3513
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ o(Ne, { children: [
3514
3514
  t === "text_field" && /* @__PURE__ */ e(
@@ -3577,8 +3577,8 @@ function Si({
3577
3577
  {
3578
3578
  name: "defaultValue",
3579
3579
  disabled: a,
3580
- onChange: (s) => {
3581
- n("defaultValue", s.target.value === "" ? void 0 : s.target.value);
3580
+ onChange: (n) => {
3581
+ s("defaultValue", n.target.value === "" ? void 0 : n.target.value);
3582
3582
  },
3583
3583
  label: "Default value",
3584
3584
  value: q(i, "defaultValue") ?? ""
@@ -3586,7 +3586,7 @@ function Si({
3586
3586
  ) })
3587
3587
  ] });
3588
3588
  }
3589
- function Ai({ disabled: t }) {
3589
+ function zi({ disabled: t }) {
3590
3590
  const { values: a } = U(), r = q(a, "defaultValue");
3591
3591
  return /* @__PURE__ */ o(I, { children: [
3592
3592
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(ze, { disabled: t }) }) }),
@@ -3603,28 +3603,28 @@ function Ai({ disabled: t }) {
3603
3603
  ) })
3604
3604
  ] });
3605
3605
  }
3606
- function zi({ disabled: t, getData: a, allowDataInference: r, customFields: i }) {
3606
+ function Ti({ disabled: t, getData: a, allowDataInference: r, customFields: i }) {
3607
3607
  const {
3608
- values: n,
3609
- setFieldValue: s
3608
+ values: s,
3609
+ setFieldValue: n
3610
3610
  } = U(), [d, c] = Y(!1), [m, u] = Y(), [p, l] = Y(), g = Z(({
3611
3611
  id: h,
3612
3612
  property: y
3613
3613
  }) => {
3614
3614
  if (!h)
3615
3615
  throw Error();
3616
- s("oneOf.properties", {
3617
- ...n.oneOf?.properties ?? {},
3616
+ n("oneOf.properties", {
3617
+ ...s.oneOf?.properties ?? {},
3618
3618
  [h]: y
3619
- }, !1), s("oneOf.propertiesOrder", [...n.oneOf?.propertiesOrder ?? Object.keys(n.oneOf?.properties ?? {}), h], !1), c(!1);
3620
- }, [n.oneOf?.properties, n.oneOf?.propertiesOrder]), b = m ? re(m, p) : void 0, f = b ? q(n.oneOf?.properties, b.replaceAll(".", ".properties.")) : void 0, k = Z((h, y) => {
3619
+ }, !1), n("oneOf.propertiesOrder", [...s.oneOf?.propertiesOrder ?? Object.keys(s.oneOf?.properties ?? {}), h], !1), c(!1);
3620
+ }, [s.oneOf?.properties, s.oneOf?.propertiesOrder]), b = m ? re(m, p) : void 0, f = b ? q(s.oneOf?.properties, b.replaceAll(".", ".properties.")) : void 0, k = Z((h, y) => {
3621
3621
  const _ = h ? re(h, y) : void 0;
3622
3622
  if (!_)
3623
3623
  throw Error("collection editor miss config");
3624
- s(`oneOf.${ye(_)}`, void 0, !1);
3625
- const w = `oneOf.${xe(y)}`, v = q(n, w);
3626
- s(w, v.filter((T) => T !== h), !1), c(!1), u(void 0), l(void 0);
3627
- }, [s, n]), C = /* @__PURE__ */ o(
3624
+ n(`oneOf.${ye(_)}`, void 0, !1);
3625
+ const w = `oneOf.${xe(y)}`, v = q(s, w);
3626
+ n(w, v.filter((T) => T !== h), !1), c(!1), u(void 0), l(void 0);
3627
+ }, [n, s]), C = /* @__PURE__ */ o(
3628
3628
  M,
3629
3629
  {
3630
3630
  autoFocus: !0,
@@ -3633,11 +3633,11 @@ function zi({ disabled: t, getData: a, allowDataInference: r, customFields: i })
3633
3633
  startIcon: /* @__PURE__ */ e(Oe, {}),
3634
3634
  children: [
3635
3635
  "Add property to ",
3636
- n.name ?? "this block"
3636
+ s.name ?? "this block"
3637
3637
  ]
3638
3638
  }
3639
3639
  ), x = Z((h, y) => {
3640
- s(`oneOf.${xe(y)}`, h, !1);
3640
+ n(`oneOf.${xe(y)}`, h, !1);
3641
3641
  }, []);
3642
3642
  return /* @__PURE__ */ o(I, { children: [
3643
3643
  /* @__PURE__ */ o("div", { className: "col-span-12", children: [
@@ -3649,8 +3649,8 @@ function zi({ disabled: t, getData: a, allowDataInference: r, customFields: i })
3649
3649
  /* @__PURE__ */ e(
3650
3650
  dt,
3651
3651
  {
3652
- properties: n.oneOf?.properties ?? {},
3653
- propertiesOrder: n.oneOf?.propertiesOrder,
3652
+ properties: s.oneOf?.properties ?? {},
3653
+ propertiesOrder: s.oneOf?.propertiesOrder,
3654
3654
  errors: {},
3655
3655
  onPropertyClick: t ? void 0 : (h, y) => {
3656
3656
  u(h), l(y), c(!0);
@@ -3658,7 +3658,7 @@ function zi({ disabled: t, getData: a, allowDataInference: r, customFields: i })
3658
3658
  onPropertyMove: t ? void 0 : x
3659
3659
  }
3660
3660
  ),
3661
- !t && !n.oneOf?.propertiesOrder?.length && /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center p-4", children: "Add the first property to this block" })
3661
+ !t && !s.oneOf?.propertiesOrder?.length && /* @__PURE__ */ e("div", { className: "h-full flex items-center justify-center p-4", children: "Add the first property to this block" })
3662
3662
  ] })
3663
3663
  ] }),
3664
3664
  !t && /* @__PURE__ */ e(
@@ -3683,17 +3683,17 @@ function zi({ disabled: t, getData: a, allowDataInference: r, customFields: i })
3683
3683
  autoUpdateId: !m,
3684
3684
  autoOpenTypeSelect: !m,
3685
3685
  onPropertyChanged: g,
3686
- existingPropertyKeys: m ? void 0 : n.oneOf?.propertiesOrder,
3686
+ existingPropertyKeys: m ? void 0 : s.oneOf?.propertiesOrder,
3687
3687
  customFields: i
3688
3688
  }
3689
3689
  )
3690
3690
  ] });
3691
3691
  }
3692
- function Ti({ disabled: t }) {
3692
+ function Vi({ disabled: t }) {
3693
3693
  const {
3694
3694
  values: a,
3695
3695
  handleChange: r
3696
- } = U(), i = "validation.min", n = "validation.max", s = "validation.lessThan", d = "validation.moreThan", c = "validation.positive", m = "validation.negative", u = "validation.integer";
3696
+ } = U(), i = "validation.min", s = "validation.max", n = "validation.lessThan", d = "validation.moreThan", c = "validation.positive", m = "validation.negative", u = "validation.integer";
3697
3697
  return /* @__PURE__ */ o("div", { className: "grid grid-cols-12 gap-2", children: [
3698
3698
  /* @__PURE__ */ e(ze, { disabled: t }),
3699
3699
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
@@ -3711,9 +3711,9 @@ function Ti({ disabled: t }) {
3711
3711
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
3712
3712
  G,
3713
3713
  {
3714
- value: q(a, n),
3714
+ value: q(a, s),
3715
3715
  label: "Max value",
3716
- name: n,
3716
+ name: s,
3717
3717
  type: "number",
3718
3718
  size: "small",
3719
3719
  disabled: t,
@@ -3723,9 +3723,9 @@ function Ti({ disabled: t }) {
3723
3723
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
3724
3724
  G,
3725
3725
  {
3726
- value: q(a, s),
3726
+ value: q(a, n),
3727
3727
  label: "Less than",
3728
- name: s,
3728
+ name: n,
3729
3729
  type: "number",
3730
3730
  size: "small",
3731
3731
  disabled: t,
@@ -3776,10 +3776,10 @@ function Ti({ disabled: t }) {
3776
3776
  ) })
3777
3777
  ] });
3778
3778
  }
3779
- function Vi({ disabled: t }) {
3779
+ function ji({ disabled: t }) {
3780
3780
  const { values: a, setFieldValue: r } = U();
3781
3781
  return /* @__PURE__ */ o(I, { children: [
3782
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Ti, { disabled: t }) }) }),
3782
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(Vi, { disabled: t }) }) }),
3783
3783
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
3784
3784
  qe,
3785
3785
  {
@@ -3802,8 +3802,8 @@ function Et({
3802
3802
  showErrors: i
3803
3803
  }) {
3804
3804
  const {
3805
- values: n,
3806
- handleChange: s,
3805
+ values: s,
3806
+ handleChange: n,
3807
3807
  errors: d,
3808
3808
  touched: c,
3809
3809
  setFieldError: m,
@@ -3811,7 +3811,7 @@ function Et({
3811
3811
  } = U();
3812
3812
  if (!Ie())
3813
3813
  return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e($e, {}) });
3814
- const l = a ? "of.path" : "path", g = q(n, l), b = i && q(d, l);
3814
+ const l = a ? "of.path" : "path", g = q(s, l), b = i && q(d, l);
3815
3815
  return console.log("pathError", d, b), /* @__PURE__ */ e(I, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
3816
3816
  me,
3817
3817
  {
@@ -3819,28 +3819,28 @@ function Et({
3819
3819
  name: l,
3820
3820
  pathPath: l,
3821
3821
  type: "select",
3822
- validate: ji,
3822
+ validate: Fi,
3823
3823
  disabled: t || r,
3824
3824
  value: g,
3825
3825
  error: b,
3826
- handleChange: s,
3827
- component: Fi
3826
+ handleChange: n,
3827
+ component: Ei
3828
3828
  }
3829
3829
  ) }) });
3830
3830
  }
3831
- function ji(t) {
3831
+ function Fi(t) {
3832
3832
  let a;
3833
3833
  return t || (a = "You must specify a target collection for the field"), a;
3834
3834
  }
3835
- function Fi({
3835
+ function Ei({
3836
3836
  disabled: t,
3837
3837
  pathPath: a,
3838
3838
  value: r,
3839
3839
  handleChange: i,
3840
- error: n,
3841
- ...s
3840
+ error: s,
3841
+ ...n
3842
3842
  }) {
3843
- console.log("error", n);
3843
+ console.log("error", s);
3844
3844
  const d = Ie();
3845
3845
  if (!d)
3846
3846
  return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e($e, {}) });
@@ -3851,7 +3851,7 @@ function Fi({
3851
3851
  /* @__PURE__ */ o(
3852
3852
  Se,
3853
3853
  {
3854
- error: !!n,
3854
+ error: !!s,
3855
3855
  disabled: t,
3856
3856
  value: r ?? "",
3857
3857
  position: "item-aligned",
@@ -3875,7 +3875,7 @@ function Fi({
3875
3875
  )
3876
3876
  ] });
3877
3877
  },
3878
- ...s,
3878
+ ...n,
3879
3879
  children: [
3880
3880
  m.flatMap((p) => /* @__PURE__ */ e(
3881
3881
  At,
@@ -3932,22 +3932,22 @@ function Fi({
3932
3932
  /* @__PURE__ */ e(ee, { children: "You can only edit the reference collection upon field creation." })
3933
3933
  ] });
3934
3934
  }
3935
- function Ei({ disabled: t }) {
3935
+ function Ii({ disabled: t }) {
3936
3936
  const {
3937
3937
  values: a,
3938
3938
  errors: r,
3939
3939
  touched: i,
3940
- setFieldValue: n
3941
- } = U(), s = "mode", d = q(a, s), c = q(i, s) && q(r, s), m = "autoValue", u = q(a, m), p = q(i, m) && q(r, m);
3940
+ setFieldValue: s
3941
+ } = U(), n = "mode", d = q(a, n), c = q(i, n) && q(r, n), m = "autoValue", u = q(a, m), p = q(i, m) && q(r, m);
3942
3942
  return /* @__PURE__ */ o(I, { children: [
3943
3943
  /* @__PURE__ */ o("div", { className: "flex flex-col col-span-12", children: [
3944
3944
  /* @__PURE__ */ o(
3945
3945
  Se,
3946
3946
  {
3947
- name: s,
3947
+ name: n,
3948
3948
  value: d ?? "date",
3949
3949
  error: !!c,
3950
- onValueChange: (l) => n(s, l),
3950
+ onValueChange: (l) => s(n, l),
3951
3951
  label: "Mode",
3952
3952
  renderValue: (l) => {
3953
3953
  switch (l) {
@@ -3973,7 +3973,7 @@ function Ei({ disabled: t }) {
3973
3973
  name: m,
3974
3974
  disabled: t,
3975
3975
  value: u ?? "",
3976
- onValueChange: (l) => n(m, l),
3976
+ onValueChange: (l) => s(m, l),
3977
3977
  renderValue: (l) => {
3978
3978
  switch (l) {
3979
3979
  case "on_create":
@@ -3998,7 +3998,7 @@ function Ei({ disabled: t }) {
3998
3998
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(ze, { disabled: t }) }) })
3999
3999
  ] });
4000
4000
  }
4001
- function Ii({ disabled: t }) {
4001
+ function Bi({ disabled: t }) {
4002
4002
  return U(), /* @__PURE__ */ o("div", { className: "grid grid-cols-12 gap-2", children: [
4003
4003
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
4004
4004
  oe,
@@ -4024,7 +4024,7 @@ function Ii({ disabled: t }) {
4024
4024
  ) })
4025
4025
  ] });
4026
4026
  }
4027
- function Bi({ disabled: t }) {
4027
+ function Mi({ disabled: t }) {
4028
4028
  return /* @__PURE__ */ e(I, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ne, { children: /* @__PURE__ */ e(ze, { disabled: t }) }) }) });
4029
4029
  }
4030
4030
  function ia(t, a, r) {
@@ -4275,8 +4275,8 @@ const oa = R.memo(
4275
4275
  includeIdAndName: a = !0,
4276
4276
  autoOpenTypeSelect: r,
4277
4277
  existing: i,
4278
- autoUpdateId: n,
4279
- inArray: s,
4278
+ autoUpdateId: s,
4279
+ inArray: n,
4280
4280
  propertyKey: d,
4281
4281
  propertyNamespace: c,
4282
4282
  property: m,
@@ -4330,7 +4330,7 @@ const oa = R.memo(
4330
4330
  children: (P) => (se(() => {
4331
4331
  x?.(P);
4332
4332
  }, [P]), /* @__PURE__ */ e(
4333
- Mi,
4333
+ Di,
4334
4334
  {
4335
4335
  onPropertyChanged: p ? T : void 0,
4336
4336
  onDelete: l,
@@ -4339,8 +4339,8 @@ const oa = R.memo(
4339
4339
  onError: g,
4340
4340
  showErrors: f || P.submitCount > 0,
4341
4341
  existing: i,
4342
- autoUpdateId: n,
4343
- inArray: s,
4342
+ autoUpdateId: s,
4343
+ inArray: n,
4344
4344
  autoOpenTypeSelect: r,
4345
4345
  existingPropertyKeys: k,
4346
4346
  disabled: w,
@@ -4361,8 +4361,8 @@ function Fe({
4361
4361
  onCancel: a,
4362
4362
  onOkClicked: r,
4363
4363
  onPropertyChanged: i,
4364
- getData: n,
4365
- ...s
4364
+ getData: s,
4365
+ ...n
4366
4366
  }) {
4367
4367
  const d = Re();
4368
4368
  return /* @__PURE__ */ e(
@@ -4375,7 +4375,7 @@ function Fe({
4375
4375
  /* @__PURE__ */ e(Le, { children: /* @__PURE__ */ e(
4376
4376
  oa,
4377
4377
  {
4378
- ...s,
4378
+ ...n,
4379
4379
  onPropertyChanged: (m) => {
4380
4380
  i?.(m), r?.();
4381
4381
  },
@@ -4383,7 +4383,7 @@ function Fe({
4383
4383
  getHelpers: (m) => {
4384
4384
  d.current = m;
4385
4385
  },
4386
- getData: n
4386
+ getData: s
4387
4387
  }
4388
4388
  ) }),
4389
4389
  /* @__PURE__ */ o(Ke, { children: [
@@ -4411,13 +4411,13 @@ function Fe({
4411
4411
  }
4412
4412
  );
4413
4413
  }
4414
- function Mi({
4414
+ function Di({
4415
4415
  values: t,
4416
4416
  errors: a,
4417
4417
  touched: r,
4418
4418
  setValues: i,
4419
- setFieldValue: n,
4420
- existing: s,
4419
+ setFieldValue: s,
4420
+ existing: n,
4421
4421
  autoUpdateId: d = !1,
4422
4422
  autoOpenTypeSelect: c,
4423
4423
  includeIdAndTitle: m,
@@ -4433,9 +4433,9 @@ function Mi({
4433
4433
  allowDataInference: h,
4434
4434
  customFields: y
4435
4435
  }) {
4436
- const [_, w] = Y(!1), [v, T] = Y(t?.dataType ? Zt(t) : void 0), P = Object.entries(y).concat(Object.entries(_t)), V = k ? P.filter(([Q, J]) => !ne(J.property) && J.property?.dataType !== "array") : P, O = ha(t), F = Re(null), ue = Re(t), Pe = "id", A = b && q(a, "selectedWidget");
4436
+ const [_, w] = Y(!1), [v, T] = Y(t?.dataType ? Zt(t) : void 0), P = Object.entries(y).concat(Object.entries(_t)), V = k ? P.filter(([Q, J]) => !ne(J.property) && J.property?.dataType !== "array") : P, O = ga(t), F = Re(null), ue = Re(t), Pe = "id", z = b && q(a, "selectedWidget");
4437
4437
  se(() => {
4438
- !q(r, Pe) && d && t?.name && n(Pe, Kt(t.name));
4438
+ !q(r, Pe) && d && t?.name && s(Pe, Kt(t.name));
4439
4439
  }, [d, r, t?.name]), se(() => {
4440
4440
  if (u && (!m || O.id)) {
4441
4441
  const {
@@ -4458,7 +4458,7 @@ function Mi({
4458
4458
  };
4459
4459
  let H;
4460
4460
  return v === "text_field" || v === "multiline" || v === "markdown" || v === "url" || v === "email" ? H = /* @__PURE__ */ e(
4461
- Si,
4461
+ Ai,
4462
4462
  {
4463
4463
  widgetId: v,
4464
4464
  disabled: f,
@@ -4469,7 +4469,7 @@ function Mi({
4469
4469
  {
4470
4470
  multiselect: !1,
4471
4471
  allowDataInference: h,
4472
- updateIds: !s,
4472
+ updateIds: !n,
4473
4473
  disabled: f,
4474
4474
  getData: x,
4475
4475
  showErrors: b
@@ -4478,7 +4478,7 @@ function Mi({
4478
4478
  jt,
4479
4479
  {
4480
4480
  multiselect: !0,
4481
- updateIds: !s,
4481
+ updateIds: !n,
4482
4482
  disabled: f,
4483
4483
  allowDataInference: h,
4484
4484
  getData: x,
@@ -4487,45 +4487,45 @@ function Mi({
4487
4487
  ) : v === "file_upload" ? H = /* @__PURE__ */ e(
4488
4488
  Ft,
4489
4489
  {
4490
- existing: s,
4490
+ existing: n,
4491
4491
  multiple: !1,
4492
4492
  disabled: f
4493
4493
  }
4494
4494
  ) : v === "multi_file_upload" ? H = /* @__PURE__ */ e(
4495
4495
  Ft,
4496
4496
  {
4497
- existing: s,
4497
+ existing: n,
4498
4498
  multiple: !0,
4499
4499
  disabled: f
4500
4500
  }
4501
- ) : v === "switch" ? H = /* @__PURE__ */ e(Ai, { disabled: f }) : v === "number_input" ? H = /* @__PURE__ */ e(Vi, { disabled: f }) : v === "group" ? H = /* @__PURE__ */ e(xi, { disabled: f, getData: x, allowDataInference: h, customFields: y }) : v === "block" ? H = /* @__PURE__ */ e(zi, { disabled: f, getData: x, allowDataInference: h, customFields: y }) : v === "reference" ? H = /* @__PURE__ */ e(
4501
+ ) : v === "switch" ? H = /* @__PURE__ */ e(zi, { disabled: f }) : v === "number_input" ? H = /* @__PURE__ */ e(ji, { disabled: f }) : v === "group" ? H = /* @__PURE__ */ e(Ci, { disabled: f, getData: x, allowDataInference: h, customFields: y }) : v === "block" ? H = /* @__PURE__ */ e(Ti, { disabled: f, getData: x, allowDataInference: h, customFields: y }) : v === "reference" ? H = /* @__PURE__ */ e(
4502
4502
  Et,
4503
4503
  {
4504
4504
  showErrors: b,
4505
- existing: s,
4505
+ existing: n,
4506
4506
  multiple: !1,
4507
4507
  disabled: f
4508
4508
  }
4509
- ) : v === "date_time" ? H = /* @__PURE__ */ e(Ei, { disabled: f }) : v === "multi_references" ? H = /* @__PURE__ */ e(
4509
+ ) : v === "date_time" ? H = /* @__PURE__ */ e(Ii, { disabled: f }) : v === "multi_references" ? H = /* @__PURE__ */ e(
4510
4510
  Et,
4511
4511
  {
4512
4512
  showErrors: b,
4513
- existing: s,
4513
+ existing: n,
4514
4514
  multiple: !0,
4515
4515
  disabled: f
4516
4516
  }
4517
4517
  ) : v === "repeat" ? H = /* @__PURE__ */ e(
4518
- Ci,
4518
+ Oi,
4519
4519
  {
4520
4520
  showErrors: b,
4521
- existing: s,
4521
+ existing: n,
4522
4522
  getData: x,
4523
4523
  allowDataInference: h,
4524
4524
  disabled: f,
4525
4525
  customFields: y
4526
4526
  }
4527
- ) : v === "key_value" ? H = /* @__PURE__ */ e(Bi, { disabled: f }) : H = null, /* @__PURE__ */ o(I, { children: [
4528
- f && /* @__PURE__ */ o(Ta, { mode: "warn", children: [
4527
+ ) : v === "key_value" ? H = /* @__PURE__ */ e(Mi, { disabled: f }) : H = null, /* @__PURE__ */ o(I, { children: [
4528
+ f && /* @__PURE__ */ o(Va, { mode: "warn", children: [
4529
4529
  /* @__PURE__ */ e(N, { children: "This property can't be edited" }),
4530
4530
  /* @__PURE__ */ o(N, { variant: "caption", children: [
4531
4531
  "You may not have permission to edit it or it is defined in code with no ",
@@ -4538,7 +4538,7 @@ function Mi({
4538
4538
  Se,
4539
4539
  {
4540
4540
  className: "w-full",
4541
- error: !!A,
4541
+ error: !!z,
4542
4542
  value: v ?? "",
4543
4543
  placeholder: "Select a property widget",
4544
4544
  open: c,
@@ -4547,7 +4547,7 @@ function Mi({
4547
4547
  renderValue: (Q) => {
4548
4548
  if (!Q)
4549
4549
  return /* @__PURE__ */ e("em", { children: "Select a property widget" });
4550
- const J = Q, X = _t[J] ?? y[J], we = X.property, he = ne(we) || s && we.dataType !== t?.dataType;
4550
+ const J = Q, X = _t[J] ?? y[J], we = X.property, he = ne(we) || n && we.dataType !== t?.dataType;
4551
4551
  return /* @__PURE__ */ o(
4552
4552
  "div",
4553
4553
  {
@@ -4579,21 +4579,21 @@ function Mi({
4579
4579
  B(Q);
4580
4580
  },
4581
4581
  children: V.map(([Q, J]) => {
4582
- const X = J.property, we = s && !ne(X) && X.dataType !== t?.dataType;
4582
+ const X = J.property, we = n && !ne(X) && X.dataType !== t?.dataType;
4583
4583
  return /* @__PURE__ */ e(
4584
4584
  ra,
4585
4585
  {
4586
4586
  value: Q,
4587
4587
  optionDisabled: we,
4588
4588
  fieldConfig: J,
4589
- existing: s
4589
+ existing: n
4590
4590
  },
4591
4591
  Q
4592
4592
  );
4593
4593
  })
4594
4594
  }
4595
4595
  ),
4596
- A && /* @__PURE__ */ e(N, { variant: "caption", color: "error", children: "Required" }),
4596
+ z && /* @__PURE__ */ e(N, { variant: "caption", color: "error", children: "Required" }),
4597
4597
  p && t?.id && /* @__PURE__ */ e(
4598
4598
  pe,
4599
4599
  {
@@ -4607,18 +4607,18 @@ function Mi({
4607
4607
  ] }),
4608
4608
  /* @__PURE__ */ o("div", { className: "grid grid-cols-12 gap-y-12 mt-8 mb-8", children: [
4609
4609
  m && /* @__PURE__ */ e(
4610
- Oi,
4610
+ Ni,
4611
4611
  {
4612
4612
  showErrors: b,
4613
- disabledId: s,
4614
- isNewProperty: !s,
4613
+ disabledId: n,
4614
+ isNewProperty: !n,
4615
4615
  existingPropertyKeys: C,
4616
4616
  disabled: f,
4617
4617
  ref: F
4618
4618
  }
4619
4619
  ),
4620
4620
  H,
4621
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Ii, { disabled: f }) })
4621
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Bi, { disabled: f }) })
4622
4622
  ] }),
4623
4623
  p && /* @__PURE__ */ e(
4624
4624
  rt,
@@ -4636,13 +4636,13 @@ function Mi({
4636
4636
  )
4637
4637
  ] });
4638
4638
  }
4639
- function Di({
4639
+ function Ri({
4640
4640
  showErrors: t,
4641
4641
  isNewCollection: a,
4642
4642
  propertyErrorsRef: r,
4643
4643
  onPropertyError: i,
4644
- setDirty: n,
4645
- reservedGroups: s,
4644
+ setDirty: s,
4645
+ reservedGroups: n,
4646
4646
  extraIcon: d,
4647
4647
  getUser: c,
4648
4648
  getData: m,
@@ -4656,20 +4656,20 @@ function Di({
4656
4656
  setFieldTouched: f,
4657
4657
  errors: k,
4658
4658
  dirty: C
4659
- } = U(), x = lt(), h = Va("lg"), y = !h, [_, w] = Y(), [v, T] = Y(), [P, V] = Y(), O = v ? re(v, P) : void 0, F = O ? q(l.properties, O.replaceAll(".", ".properties.")) : void 0, [ue, Pe] = Y(!1), [A, B] = Y(!1), [H, Q] = Y([]), J = R.useRef(l.propertiesOrder ? { "": l.propertiesOrder } : {});
4659
+ } = U(), x = lt(), h = ja("lg"), y = !h, [_, w] = Y(), [v, T] = Y(), [P, V] = Y(), O = v ? re(v, P) : void 0, F = O ? q(l.properties, O.replaceAll(".", ".properties.")) : void 0, [ue, Pe] = Y(!1), [z, B] = Y(!1), [H, Q] = Y([]), J = R.useRef(l.propertiesOrder ? { "": l.propertiesOrder } : {});
4660
4660
  se(() => {
4661
- n && n(C);
4661
+ s && s(C);
4662
4662
  }, [C]);
4663
4663
  const X = u ? () => {
4664
- u && (Pe(!0), u(l).then((z) => {
4665
- if (!z) {
4664
+ u && (Pe(!0), u(l).then((A) => {
4665
+ if (A && na(A.properties), console.log("newCollection", A), !A) {
4666
4666
  x.open({
4667
4667
  type: "error",
4668
4668
  message: "Could not infer properties from data"
4669
4669
  });
4670
4670
  return;
4671
4671
  }
4672
- const j = Object.keys(z.properties).filter((ie) => !l.properties[ie]);
4672
+ const j = Object.keys(A.properties).filter((ie) => !l.properties[ie]);
4673
4673
  if (j.length === 0) {
4674
4674
  x.open({
4675
4675
  type: "info",
@@ -4678,7 +4678,7 @@ function Di({
4678
4678
  return;
4679
4679
  }
4680
4680
  const E = {
4681
- ...j.reduce((ie, ge) => (ie[ge] = z.properties[ge], ie), {}),
4681
+ ...j.reduce((ie, ge) => (ie[ge] = A.properties[ge], ie), {}),
4682
4682
  ...l.properties
4683
4683
  }, ae = [
4684
4684
  ...j,
@@ -4688,59 +4688,59 @@ function Di({
4688
4688
  }).finally(() => {
4689
4689
  Pe(!1);
4690
4690
  }));
4691
- } : void 0, we = (z) => z ? J.current[z] ?? q(l, xe(z)) : J.current[""], he = (z, j) => {
4691
+ } : void 0, we = (A) => A ? J.current[A] ?? q(l, xe(A)) : J.current[""], he = (A, j) => {
4692
4692
  const E = xe(j);
4693
- g(E, z, !1), J.current[j ?? ""] = z;
4694
- }, _e = (z, j) => {
4695
- const E = z ? re(z, j) : void 0;
4693
+ g(E, A, !1), J.current[j ?? ""] = A;
4694
+ }, _e = (A, j) => {
4695
+ const E = A ? re(A, j) : void 0;
4696
4696
  if (!E)
4697
4697
  throw Error("collection editor miss config");
4698
4698
  g(ye(E), void 0, !1);
4699
- const ie = we(j).filter((ge) => ge !== z);
4699
+ const ie = we(j).filter((ge) => ge !== A);
4700
4700
  he(ie, j), B(!1), w(void 0), T(void 0), V(void 0);
4701
- }, mt = (z, j) => {
4702
- g(xe(j), z, !1);
4701
+ }, mt = (A, j) => {
4702
+ g(xe(j), A, !1);
4703
4703
  }, Be = ({
4704
- id: z,
4704
+ id: A,
4705
4705
  property: j
4706
4706
  }) => {
4707
4707
  if (console.log("onPropertyCreated", {
4708
- id: z,
4708
+ id: A,
4709
4709
  property: j
4710
- }), !z)
4710
+ }), !A)
4711
4711
  throw Error("Need to include an ID when creating a new property");
4712
4712
  g("properties", {
4713
4713
  ...l.properties ?? {},
4714
- [z]: j
4714
+ [A]: j
4715
4715
  }, !1);
4716
- const E = [...l.propertiesOrder ?? Object.keys(l.properties), z];
4716
+ const E = [...l.propertiesOrder ?? Object.keys(l.properties), A];
4717
4717
  console.log("onPropertyCreated", {
4718
- id: z,
4718
+ id: A,
4719
4719
  property: j,
4720
4720
  newPropertiesOrder: E
4721
- }), he(E), B(!1), h && (w(E.indexOf(z)), T(z)), V(void 0);
4721
+ }), he(E), B(!1), h && (w(E.indexOf(A)), T(A)), V(void 0);
4722
4722
  }, Te = ({
4723
- id: z,
4723
+ id: A,
4724
4724
  property: j,
4725
4725
  previousId: E,
4726
4726
  namespace: ae
4727
4727
  }) => {
4728
- const ie = z ? re(z, ae) : void 0, ge = ie ? ye(ie) : void 0;
4729
- if (E && E !== z) {
4730
- const ht = re(E, ae), Qe = ye(ht), Me = we(ae).map((ce) => ce === E ? z : ce).filter((ce) => ce !== void 0);
4731
- he(Me, ae), z && (w(Me.indexOf(z)), T(z)), g(Qe, void 0, !1), f(Qe, !1, !1);
4728
+ const ie = A ? re(A, ae) : void 0, ge = ie ? ye(ie) : void 0;
4729
+ if (E && E !== A) {
4730
+ const ht = re(E, ae), Qe = ye(ht), Me = we(ae).map((ce) => ce === E ? A : ce).filter((ce) => ce !== void 0);
4731
+ he(Me, ae), A && (w(Me.indexOf(A)), T(A)), g(Qe, void 0, !1), f(Qe, !1, !1);
4732
4732
  }
4733
4733
  ge && (g(ge, j, !1), f(ge, !0, !1));
4734
- }, te = (z, j, E) => {
4735
- const ae = z ? re(z, j) : void 0;
4734
+ }, te = (A, j, E) => {
4735
+ const ae = A ? re(A, j) : void 0;
4736
4736
  if (console.warn("onPropertyErrorInternal", {
4737
- id: z,
4737
+ id: A,
4738
4738
  namespace: j,
4739
4739
  error: E,
4740
4740
  propertyPath: ae
4741
4741
  }), ae) {
4742
4742
  const ie = E && Object.keys(E).length > 0;
4743
- i(z, j, ie ? E : void 0), b(ye(ae), ie ? "Property error" : void 0);
4743
+ i(A, j, ie ? E : void 0), b(ye(ae), ie ? "Property error" : void 0);
4744
4744
  }
4745
4745
  }, Ve = () => {
4746
4746
  w(void 0), T(void 0);
@@ -4804,8 +4804,8 @@ function Di({
4804
4804
  dt,
4805
4805
  {
4806
4806
  className: "pl-8",
4807
- onPropertyClick: (z, j) => {
4808
- w(S.indexOf(z)), T(z), V(j);
4807
+ onPropertyClick: (A, j) => {
4808
+ w(S.indexOf(A)), T(A), V(j);
4809
4809
  },
4810
4810
  inferredPropertyKeys: H,
4811
4811
  selectedPropertyKey: v ? re(v, P) : void 0,
@@ -4895,7 +4895,7 @@ function Di({
4895
4895
  autoOpenTypeSelect: !0,
4896
4896
  autoUpdateId: !0,
4897
4897
  forceShowErrors: t,
4898
- open: A,
4898
+ open: z,
4899
4899
  onCancel: () => B(!1),
4900
4900
  onPropertyChanged: Be,
4901
4901
  getData: m,
@@ -4906,23 +4906,29 @@ function Di({
4906
4906
  )
4907
4907
  ] });
4908
4908
  }
4909
- function Ri({
4909
+ function na(t) {
4910
+ Object.keys(t).forEach((a) => {
4911
+ const r = t[a];
4912
+ r.editable = !0, r.dataType === "map" && r.properties && na(r.properties);
4913
+ });
4914
+ }
4915
+ function Ui({
4910
4916
  open: t,
4911
4917
  handleOk: a,
4912
4918
  handleCancel: r,
4913
4919
  body: i,
4914
- title: n
4920
+ title: s
4915
4921
  }) {
4916
4922
  return /* @__PURE__ */ o(
4917
4923
  Ee,
4918
4924
  {
4919
4925
  open: t,
4920
- onOpenChange: (s) => s ? r() : a(),
4926
+ onOpenChange: (n) => n ? r() : a(),
4921
4927
  "aria-labelledby": "alert-dialog-title",
4922
4928
  "aria-describedby": "alert-dialog-description",
4923
4929
  children: [
4924
4930
  /* @__PURE__ */ o(Le, { children: [
4925
- /* @__PURE__ */ e(N, { variant: "h6", children: n ?? "Unsaved changes" }),
4931
+ /* @__PURE__ */ e(N, { variant: "h6", children: s ?? "Unsaved changes" }),
4926
4932
  i && /* @__PURE__ */ e(N, { children: i }),
4927
4933
  /* @__PURE__ */ e(N, { children: "Are you sure?" })
4928
4934
  ] }),
@@ -4934,7 +4940,7 @@ function Ri({
4934
4940
  }
4935
4941
  );
4936
4942
  }
4937
- function Ui({ open: t, onClose: a }) {
4943
+ function $i({ open: t, onClose: a }) {
4938
4944
  const { entityViews: r } = Ae();
4939
4945
  return /* @__PURE__ */ o(
4940
4946
  Ee,
@@ -4965,18 +4971,18 @@ function Ui({ open: t, onClose: a }) {
4965
4971
  }
4966
4972
  );
4967
4973
  }
4968
- function $i({
4974
+ function Li({
4969
4975
  collection: t,
4970
4976
  parentCollection: a,
4971
4977
  configController: r,
4972
4978
  collectionInference: i,
4973
- getUser: n,
4974
- parentPathSegments: s
4979
+ getUser: s,
4980
+ parentPathSegments: n
4975
4981
  }) {
4976
4982
  const { entityViews: d } = Ae(), [c, m] = R.useState(), [u, p] = R.useState(!1), [l, g] = R.useState(), [b, f] = R.useState(), {
4977
4983
  values: k,
4978
4984
  setFieldValue: C
4979
- } = U(), x = t.subcollections ?? [], h = k.entityViews?.filter((w) => typeof w == "string").map((w) => ja(w, d)).filter(Boolean) ?? [], y = t.entityViews?.filter((w) => typeof w != "string") ?? [], _ = h.length + y.length;
4985
+ } = U(), x = t.subcollections ?? [], h = k.entityViews?.filter((w) => typeof w == "string").map((w) => Fa(w, d)).filter(Boolean) ?? [], y = t.entityViews?.filter((w) => typeof w != "string") ?? [], _ = h.length + y.length;
4980
4986
  return /* @__PURE__ */ o("div", { className: "overflow-auto my-auto", children: [
4981
4987
  /* @__PURE__ */ e(ot, { maxWidth: "2xl", className: "flex flex-col gap-4 p-8 m-auto", children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-16", children: [
4982
4988
  /* @__PURE__ */ o("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
@@ -5097,7 +5103,7 @@ function $i({
5097
5103
  onAccept: () => {
5098
5104
  r.deleteCollection({
5099
5105
  path: c,
5100
- parentPathSegments: [...s ?? [], t.path]
5106
+ parentPathSegments: [...n ?? [], t.path]
5101
5107
  }), m(void 0);
5102
5108
  },
5103
5109
  onCancel: () => m(void 0),
@@ -5126,23 +5132,23 @@ function $i({
5126
5132
  }
5127
5133
  ),
5128
5134
  /* @__PURE__ */ e(
5129
- sa,
5135
+ la,
5130
5136
  {
5131
5137
  open: !!b,
5132
5138
  configController: r,
5133
5139
  parentCollection: t,
5134
5140
  collectionInference: i,
5135
- parentPathSegments: [...s ?? [], k.path],
5141
+ parentPathSegments: [...n ?? [], k.path],
5136
5142
  isNewCollection: !1,
5137
5143
  ...b,
5138
- getUser: n,
5144
+ getUser: s,
5139
5145
  handleClose: () => {
5140
5146
  f(void 0);
5141
5147
  }
5142
5148
  }
5143
5149
  ),
5144
5150
  /* @__PURE__ */ e(
5145
- Ui,
5151
+ $i,
5146
5152
  {
5147
5153
  open: u,
5148
5154
  onClose: (w) => {
@@ -5381,20 +5387,20 @@ const It = Ct({
5381
5387
  }
5382
5388
  }
5383
5389
  });
5384
- function Li({
5390
+ function Ki({
5385
5391
  path: t,
5386
5392
  pathSuggestions: a,
5387
5393
  parentCollection: r,
5388
5394
  onContinue: i,
5389
- collections: n
5395
+ collections: s
5390
5396
  }) {
5391
- const [s, d] = Y(!1), [c, m] = Y();
5397
+ const [n, d] = Y(!1), [c, m] = Y();
5392
5398
  se(() => {
5393
- a && n && (d(!0), a(t).then((h) => {
5394
- const y = h.filter((_) => !n.find((w) => w.path.trim().toLowerCase() === _.trim().toLowerCase()));
5399
+ a && s && (d(!0), a(t).then((h) => {
5400
+ const y = h.filter((_) => !s.find((w) => w.path.trim().toLowerCase() === _.trim().toLowerCase()));
5395
5401
  m(y);
5396
5402
  }).finally(() => d(!1)));
5397
- }, [n, t, a]);
5403
+ }, [s, t, a]);
5398
5404
  const {
5399
5405
  values: u,
5400
5406
  setFieldValue: p,
@@ -5428,7 +5434,7 @@ function Li({
5428
5434
  }
5429
5435
  ),
5430
5436
  /* @__PURE__ */ o("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
5431
- s && !c && /* @__PURE__ */ e($e, { size: "small" }),
5437
+ n && !c && /* @__PURE__ */ e($e, { size: "small" }),
5432
5438
  c?.map((h, y) => /* @__PURE__ */ e(
5433
5439
  at,
5434
5440
  {
@@ -5441,7 +5447,7 @@ function Li({
5441
5447
  },
5442
5448
  h
5443
5449
  )),
5444
- !s && c?.length === 0 && /* @__PURE__ */ e(N, { variant: "caption", children: "No suggestions" })
5450
+ !n && c?.length === 0 && /* @__PURE__ */ e(N, { variant: "caption", children: "No suggestions" })
5445
5451
  ] })
5446
5452
  ] }),
5447
5453
  /* @__PURE__ */ o("div", { className: "my-2", children: [
@@ -5499,7 +5505,7 @@ function Li({
5499
5505
  children: "● Create a collection from a file (csv, json, xls, xslx...)"
5500
5506
  }
5501
5507
  ),
5502
- /* @__PURE__ */ e(ti, { onDataAdded: (h) => i(h) })
5508
+ /* @__PURE__ */ e(ai, { onDataAdded: (h) => i(h) })
5503
5509
  ] }),
5504
5510
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(M, { variant: "text", onClick: () => i(), className: "my-2", children: "Continue from scratch" }) })
5505
5511
  ] }) });
@@ -5535,7 +5541,7 @@ function yt({
5535
5541
  }
5536
5542
  ) });
5537
5543
  }
5538
- const Ki = [
5544
+ const Yi = [
5539
5545
  "text_field",
5540
5546
  "multiline",
5541
5547
  "markdown",
@@ -5556,17 +5562,24 @@ const Ki = [
5556
5562
  "date_time",
5557
5563
  "repeat",
5558
5564
  "block"
5559
- ], Yi = Object.entries(_t).filter(
5560
- ([t]) => Ki.includes(t)
5565
+ ], Hi = Object.entries(_t).filter(
5566
+ ([t]) => Yi.includes(t)
5561
5567
  );
5562
- function Hi({ importConfig: t, customFields: a }) {
5563
- const { setFieldValue: r, setFieldTouched: i, values: n } = U(), [s, d] = Y(void 0), c = R.useRef(n.propertiesOrder ? { "": n.propertiesOrder } : {}), m = s ? s.id : void 0, u = s || void 0, p = ({
5568
+ function Gi({
5569
+ importConfig: t,
5570
+ customFields: a
5571
+ }) {
5572
+ const {
5573
+ setFieldValue: r,
5574
+ setFieldTouched: i,
5575
+ values: s
5576
+ } = U(), [n, d] = Y(void 0), c = R.useRef(s.propertiesOrder ? { "": s.propertiesOrder } : {}), m = n ? n.id : void 0, u = n || void 0, p = ({
5564
5577
  id: g,
5565
5578
  property: b,
5566
5579
  previousId: f,
5567
5580
  namespace: k
5568
5581
  }) => {
5569
- const C = g ? re(g, k) : void 0, x = C ? ye(C) : void 0, h = (_) => _ ? c.current[_] ?? q(n, xe(_)) : c.current[""], y = (_, w) => {
5582
+ const C = g ? re(g, k) : void 0, x = C ? ye(C) : void 0, h = (_) => _ ? c.current[_] ?? q(s, xe(_)) : c.current[""], y = (_, w) => {
5570
5583
  const v = xe(w);
5571
5584
  r(v, _, !1), c.current[w ?? ""] = _;
5572
5585
  };
@@ -5585,35 +5598,52 @@ function Hi({ importConfig: t, customFields: a }) {
5585
5598
  property: f,
5586
5599
  namespace: k
5587
5600
  }) => {
5588
- const C = g ? re(g, k) : void 0, x = C ? ye(C) : void 0, h = t.importData.map((_) => q(_, b)), y = Za(h, f, ea);
5589
- x && (y ? (console.log("updating inferredNewProperty", { property: f, inferredNewProperty: y }), r(x, y, !1)) : r(x, f, !1), i(x, !0, !1));
5601
+ const C = g ? re(g, k) : void 0, x = C ? ye(C) : void 0, h = t.importData.map((_) => q(_, b)), y = {
5602
+ ...Ja(h, f, ea),
5603
+ editable: !0
5604
+ };
5605
+ x && (y ? (console.log("updating inferredNewProperty", {
5606
+ property: f,
5607
+ inferredNewProperty: y
5608
+ }), r(x, y, !1)) : r(x, f, !1), i(x, !0, !1));
5590
5609
  };
5591
5610
  return /* @__PURE__ */ o("div", { className: "overflow-auto my-auto bg-gray-50 dark:bg-gray-900", children: [
5592
5611
  /* @__PURE__ */ o(ot, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
5593
5612
  /* @__PURE__ */ e(N, { variant: "h6", className: "mt-4", children: "Data property mapping" }),
5594
5613
  /* @__PURE__ */ e(
5595
- ai,
5614
+ ii,
5596
5615
  {
5597
5616
  headersMapping: t.headersMapping,
5598
5617
  idColumn: t.idColumn,
5599
5618
  originProperties: t.originProperties,
5600
- destinationProperties: n.properties,
5619
+ destinationProperties: s.properties,
5601
5620
  onIdPropertyChanged: (g) => t.setIdColumn(g),
5602
- buildPropertyView: ({ property: g, propertyKey: b, importKey: f }) => /* @__PURE__ */ e(
5603
- ii,
5621
+ buildPropertyView: ({
5622
+ property: g,
5623
+ propertyKey: b,
5624
+ importKey: f
5625
+ }) => /* @__PURE__ */ e(
5626
+ ri,
5604
5627
  {
5605
5628
  property: g,
5606
5629
  propertyKey: b,
5607
5630
  onPropertyNameChanged: (k, C) => r(`properties.${k}.name`, C, !1),
5608
5631
  onEditClick: () => {
5609
- !b || !g || d({ ...g, id: b, editable: !0 });
5632
+ !b || !g || d({
5633
+ ...g,
5634
+ id: b,
5635
+ editable: !0
5636
+ });
5610
5637
  },
5611
5638
  propertyTypeView: /* @__PURE__ */ e(
5612
- Gi,
5639
+ Qi,
5613
5640
  {
5614
5641
  property: g,
5615
5642
  disabled: !1,
5616
- onPropertyChanged: (k) => l({ ...k, importKey: f }),
5643
+ onPropertyChanged: (k) => l({
5644
+ ...k,
5645
+ importKey: f
5646
+ }),
5617
5647
  propertyKey: b,
5618
5648
  customFields: a
5619
5649
  }
@@ -5626,7 +5656,7 @@ function Hi({ importConfig: t, customFields: a }) {
5626
5656
  /* @__PURE__ */ e(
5627
5657
  Fe,
5628
5658
  {
5629
- open: s !== void 0,
5659
+ open: n !== void 0,
5630
5660
  propertyKey: m,
5631
5661
  property: u,
5632
5662
  inArray: !1,
@@ -5647,8 +5677,14 @@ function Hi({ importConfig: t, customFields: a }) {
5647
5677
  /* @__PURE__ */ e("div", { style: { height: "52px" } })
5648
5678
  ] });
5649
5679
  }
5650
- function Gi({ property: t, onPropertyChanged: a, propertyKey: r, customFields: i, disabled: n }) {
5651
- const { fields: s } = Ae(), d = t ? Zt(t) : null, c = t ? ct(t, s) : null, [m, u] = Y(!1);
5680
+ function Qi({
5681
+ property: t,
5682
+ onPropertyChanged: a,
5683
+ propertyKey: r,
5684
+ customFields: i,
5685
+ disabled: s
5686
+ }) {
5687
+ const { fields: n } = Ae(), d = t ? Zt(t) : null, c = t ? ct(t, n) : null, [m, u] = Y(!1);
5652
5688
  return /* @__PURE__ */ e(
5653
5689
  le,
5654
5690
  {
@@ -5661,7 +5697,7 @@ function Gi({ property: t, onPropertyChanged: a, propertyKey: r, customFields: i
5661
5697
  onOpenChange: u,
5662
5698
  invisible: !0,
5663
5699
  className: "w-full",
5664
- disabled: n,
5700
+ disabled: s,
5665
5701
  error: !c,
5666
5702
  value: d ?? "",
5667
5703
  placeholder: "Select a property widget",
@@ -5676,7 +5712,7 @@ function Gi({ property: t, onPropertyChanged: a, propertyKey: r, customFields: i
5676
5712
  namespace: void 0
5677
5713
  }), console.log("newSelectedWidgetId", p));
5678
5714
  },
5679
- children: Yi.map(([p, l]) => /* @__PURE__ */ e(
5715
+ children: Hi.map(([p, l]) => /* @__PURE__ */ e(
5680
5716
  ra,
5681
5717
  {
5682
5718
  value: p,
@@ -5691,14 +5727,14 @@ function Gi({ property: t, onPropertyChanged: a, propertyKey: r, customFields: i
5691
5727
  }
5692
5728
  );
5693
5729
  }
5694
- function Qi({ importConfig: t, properties: a, propertiesOrder: r }) {
5730
+ function Zi({ importConfig: t, properties: a, propertiesOrder: r }) {
5695
5731
  se(() => {
5696
- const n = ri(t.originProperties, a), s = t.importData.map((d) => oi(d, t.idColumn, t.headersMapping, a, n, "TEMP_PATH"));
5697
- t.setEntities(s), console.log("res", { propertiesMapping: n, mappedData: s });
5732
+ const s = oi(t.originProperties, a), n = t.importData.map((d) => ni(d, t.idColumn, t.headersMapping, a, s, "TEMP_PATH"));
5733
+ t.setEntities(n), console.log("res", { propertiesMapping: s, mappedData: n });
5698
5734
  }, []);
5699
- const i = Fa();
5735
+ const i = Ea();
5700
5736
  return /* @__PURE__ */ e(
5701
- Ea,
5737
+ Ia,
5702
5738
  {
5703
5739
  title: /* @__PURE__ */ o("div", { children: [
5704
5740
  /* @__PURE__ */ e(N, { variant: "subtitle2", children: "Imported data preview" }),
@@ -5713,20 +5749,20 @@ function Qi({ importConfig: t, properties: a, propertiesOrder: r }) {
5713
5749
  filterable: !1,
5714
5750
  sortable: !1,
5715
5751
  selectionController: i,
5716
- displayedColumnIds: r.map((n) => ({ key: n, disabled: !1 })),
5752
+ displayedColumnIds: r.map((s) => ({ key: s, disabled: !1 })),
5717
5753
  properties: a
5718
5754
  }
5719
5755
  );
5720
5756
  }
5721
- function na(t, a = "") {
5722
- const r = Object.keys(t).reduce((s, d) => {
5723
- const c = t[d], m = Ia(d), u = a ? `${a}.${m}` : m;
5757
+ function sa(t, a = "") {
5758
+ const r = Object.keys(t).reduce((n, d) => {
5759
+ const c = t[d], m = Ba(d), u = a ? `${a}.${m}` : m;
5724
5760
  if (c.dataType === "map" && c.properties) {
5725
- const g = na(c.properties, u);
5761
+ const g = sa(c.properties, u);
5726
5762
  return {
5727
- headersMapping: { ...s.headersMapping, [d]: u },
5763
+ headersMapping: { ...n.headersMapping, [d]: u },
5728
5764
  properties: {
5729
- ...s.properties,
5765
+ ...n.properties,
5730
5766
  [m]: {
5731
5767
  ...c,
5732
5768
  properties: g.properties,
@@ -5736,26 +5772,26 @@ function na(t, a = "") {
5736
5772
  };
5737
5773
  }
5738
5774
  const p = {
5739
- ...s.properties,
5775
+ ...n.properties,
5740
5776
  [m]: c
5741
5777
  };
5742
5778
  return {
5743
- headersMapping: { ...s.headersMapping, [d]: u },
5779
+ headersMapping: { ...n.headersMapping, [d]: u },
5744
5780
  properties: p
5745
5781
  };
5746
5782
  }, { headersMapping: {}, properties: {} }), i = Object.keys(r.headersMapping)?.[0];
5747
- let n;
5748
- return (i?.includes("id") || i?.includes("key")) && (n = i), {
5783
+ let s;
5784
+ return (i?.includes("id") || i?.includes("key")) && (s = i), {
5749
5785
  ...r,
5750
- idColumn: n
5786
+ idColumn: s
5751
5787
  };
5752
5788
  }
5753
- function sa(t) {
5754
- const a = t.open, [r, i] = be.useState(!1), [n, s] = be.useState(!1), d = Z(() => {
5755
- r ? s(!0) : t.handleClose(void 0);
5789
+ function la(t) {
5790
+ const a = t.open, [r, i] = be.useState(!1), [s, n] = be.useState(!1), d = Z(() => {
5791
+ r ? n(!0) : t.handleClose(void 0);
5756
5792
  }, [r, t.handleClose]);
5757
5793
  return se(() => {
5758
- a || (i(!1), s(!1));
5794
+ a || (i(!1), n(!1));
5759
5795
  }, [a]), /* @__PURE__ */ o(
5760
5796
  Ee,
5761
5797
  {
@@ -5767,7 +5803,7 @@ function sa(t) {
5767
5803
  onOpenChange: (c) => c ? void 0 : d(),
5768
5804
  children: [
5769
5805
  a && /* @__PURE__ */ e(
5770
- Zi,
5806
+ Ji,
5771
5807
  {
5772
5808
  ...t,
5773
5809
  handleCancel: d,
@@ -5775,11 +5811,11 @@ function sa(t) {
5775
5811
  }
5776
5812
  ),
5777
5813
  /* @__PURE__ */ e(
5778
- Ri,
5814
+ Ui,
5779
5815
  {
5780
- open: n,
5816
+ open: s,
5781
5817
  handleOk: () => t.handleClose(void 0),
5782
- handleCancel: () => s(!1),
5818
+ handleCancel: () => n(!1),
5783
5819
  body: "There are unsaved changes in this collection"
5784
5820
  }
5785
5821
  )
@@ -5787,13 +5823,13 @@ function sa(t) {
5787
5823
  }
5788
5824
  );
5789
5825
  }
5790
- function Zi({
5826
+ function Ji({
5791
5827
  isNewCollection: t,
5792
5828
  initialValues: a,
5793
5829
  configController: r,
5794
5830
  editedCollectionPath: i,
5795
- parentPathSegments: n,
5796
- fullPath: s,
5831
+ parentPathSegments: s,
5832
+ fullPath: n,
5797
5833
  collectionInference: d,
5798
5834
  handleClose: c,
5799
5835
  reservedGroups: m,
@@ -5808,15 +5844,15 @@ function Zi({
5808
5844
  const { fields: C } = Ae(), x = Ie(), {
5809
5845
  topLevelNavigation: h,
5810
5846
  collections: y
5811
- } = x, _ = !a?.path && (n ?? []).length === 0, w = (f ? f.subcollections : y) ?? [], v = w.map((S) => S.path.trim().toLowerCase()), T = w.map((S) => S.alias?.trim().toLowerCase()).filter(Boolean), P = ni();
5847
+ } = x, _ = !a?.path && (s ?? []).length === 0, w = (f ? f.subcollections : y) ?? [], v = w.map((S) => S.path.trim().toLowerCase()), T = w.map((S) => S.alias?.trim().toLowerCase()).filter(Boolean), P = si();
5812
5848
  if (!h)
5813
5849
  throw Error("Internal: Navigation not ready in collection editor");
5814
5850
  const {
5815
5851
  groups: V
5816
- } = h, O = lt(), F = He(), ue = Re({}), Pe = t ? _ ? "welcome" : "details" : "properties", [A, B] = Y(Pe), [H, Q] = be.useState(), [J, X] = be.useState(), [we, he] = be.useState(!1), [_e, mt] = be.useState();
5852
+ } = h, O = lt(), F = He(), ue = Re({}), Pe = t ? _ ? "welcome" : "details" : "properties", [z, B] = Y(Pe), [H, Q] = be.useState(), [J, X] = be.useState(), [we, he] = be.useState(!1), [_e, mt] = be.useState();
5817
5853
  se(() => {
5818
5854
  try {
5819
- x.initialised && (X(i ? x.getCollectionFromPaths([...n ?? [], i]) : void 0), he(!0));
5855
+ x.initialised && (X(i ? x.getCollectionFromPaths([...s ?? [], i]) : void 0), he(!0));
5820
5856
  } catch (S) {
5821
5857
  console.error(S), mt(_e);
5822
5858
  }
@@ -5827,7 +5863,7 @@ function Zi({
5827
5863
  path: $,
5828
5864
  collectionData: S,
5829
5865
  previousPath: i,
5830
- parentPathSegments: n
5866
+ parentPathSegments: s
5831
5867
  }).then(() => (Q(void 0), !0)).catch((D) => (Q(D), console.error(D), O.open({
5832
5868
  type: "error",
5833
5869
  message: "Error persisting collection: " + (D.message ?? "Details in the console")
@@ -5841,11 +5877,11 @@ function Zi({
5841
5877
  icon: vt[Math.floor(Math.random() * vt.length)],
5842
5878
  ownerId: F.user?.uid ?? ""
5843
5879
  }, te = Z(() => {
5844
- A === "details" ? P.inUse ? B("import_data_saving") : B(u ? "extra_view" : "properties") : B(A === "welcome" ? "details" : A === "import_data_mapping" ? "import_data_preview" : A === "import_data_preview" ? "details" : A === "extra_view" ? "properties" : "details");
5845
- }, [A, P.inUse, u]), Ve = Z((S) => {
5880
+ z === "details" ? P.inUse ? B("import_data_saving") : B(u ? "extra_view" : "properties") : B(z === "welcome" ? "details" : z === "import_data_mapping" ? "import_data_preview" : z === "import_data_preview" ? "details" : z === "extra_view" ? "properties" : "details");
5881
+ }, [z, P.inUse, u]), Ve = Z((S) => {
5846
5882
  if (d)
5847
- return d?.(S.path, S.collectionGroup ?? !1, n ?? []);
5848
- }, [d, n]), Ge = Z(async (S) => {
5883
+ return d?.(S.path, S.collectionGroup ?? !1, s ?? []);
5884
+ }, [d, s]), Ge = Z(async (S) => {
5849
5885
  if (!Ve)
5850
5886
  return X(S), Promise.resolve(S);
5851
5887
  B("loading");
@@ -5859,7 +5895,7 @@ function Zi({
5859
5895
  newCollection: S ?? {},
5860
5896
  values: D
5861
5897
  }), D) : (D.propertiesOrder = Object.keys(D.properties), D);
5862
- }, [n, Ve]), ut = (S, $) => {
5898
+ }, [s, Ve]), ut = (S, $) => {
5863
5899
  try {
5864
5900
  if (console.log("Submitting collection", S), !t) {
5865
5901
  Be(S).then(() => {
@@ -5867,7 +5903,7 @@ function Zi({
5867
5903
  });
5868
5904
  return;
5869
5905
  }
5870
- A === "welcome" ? (te(), $.resetForm({ values: S })) : A === "details" ? u || P.inUse ? ($.resetForm({ values: S }), te()) : t ? Ge(S).then((D) => {
5906
+ z === "welcome" ? (te(), $.resetForm({ values: S })) : z === "details" ? u || P.inUse ? ($.resetForm({ values: S }), te()) : t ? Ge(S).then((D) => {
5871
5907
  $.resetForm({
5872
5908
  values: D ?? S,
5873
5909
  touched: {
@@ -5877,7 +5913,7 @@ function Zi({
5877
5913
  });
5878
5914
  }).finally(() => {
5879
5915
  te();
5880
- }) : ($.resetForm({ values: S }), te()) : A === "extra_view" ? (te(), $.resetForm({ values: S })) : A === "import_data_mapping" || A === "import_data_preview" ? te() : A === "properties" ? Be(S).then(() => {
5916
+ }) : ($.resetForm({ values: S }), te()) : z === "extra_view" ? (te(), $.resetForm({ values: S })) : z === "import_data_mapping" || z === "import_data_preview" ? te() : z === "properties" ? Be(S).then(() => {
5881
5917
  $.resetForm({ values: Te }), te(), c(S);
5882
5918
  }) : (te(), $.resetForm({ values: S }));
5883
5919
  } catch (D) {
@@ -5891,9 +5927,9 @@ function Zi({
5891
5927
  Ot,
5892
5928
  {
5893
5929
  initialValues: Te,
5894
- validationSchema: (A === "properties" || A === "subcollections" || A === "details") && ci,
5930
+ validationSchema: (z === "properties" || z === "subcollections" || z === "details") && di,
5895
5931
  validate: () => {
5896
- if (A === "properties")
5932
+ if (z === "properties")
5897
5933
  return ue.current;
5898
5934
  },
5899
5935
  onSubmit: ut,
@@ -5901,16 +5937,16 @@ function Zi({
5901
5937
  values: S,
5902
5938
  setFieldValue: $,
5903
5939
  isSubmitting: D,
5904
- dirty: z,
5940
+ dirty: A,
5905
5941
  submitCount: j
5906
5942
  }) => {
5907
- const E = S.path ?? i, ae = s?.includes("/") ? s?.split("/").slice(0, -1).join("/") + "/" + E : E, ie = ae && k ? () => k(ae) : void 0;
5943
+ const E = S.path ?? i, ae = n?.includes("/") ? n?.split("/").slice(0, -1).join("/") + "/" + E : E, ie = ae && k ? () => k(ae) : void 0;
5908
5944
  se(() => {
5909
- l(z);
5910
- }, [z]);
5945
+ l(A);
5946
+ }, [A]);
5911
5947
  function ge(W) {
5912
- P.setInUse(!0), Ja(W, ea).then((Me) => {
5913
- const ce = na(Me);
5948
+ P.setInUse(!0), Xa(W, ea).then((Me) => {
5949
+ const ce = sa(Me);
5914
5950
  $("properties", ce.properties), $("propertiesOrder", Object.keys(ce.properties)), P.setIdColumn(ce.idColumn), P.setImportData(W), P.setHeadersMapping(ce.headersMapping), P.setOriginProperties(ce.properties);
5915
5951
  });
5916
5952
  }
@@ -5923,9 +5959,9 @@ function Zi({
5923
5959
  };
5924
5960
  return /* @__PURE__ */ o(I, { children: [
5925
5961
  !t && /* @__PURE__ */ o(
5926
- Ba,
5962
+ Ma,
5927
5963
  {
5928
- value: A,
5964
+ value: z,
5929
5965
  className: ve(xt, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
5930
5966
  onValueChange: (W) => B(W),
5931
5967
  children: [
@@ -5944,10 +5980,10 @@ function Zi({
5944
5980
  "flex-grow flex flex-col relative"
5945
5981
  ),
5946
5982
  children: [
5947
- A === "loading" && /* @__PURE__ */ e(Vt, {}),
5948
- A === "extra_view" && E && u?.View && /* @__PURE__ */ e(u.View, { path: E }),
5949
- A === "welcome" && /* @__PURE__ */ e(
5950
- Li,
5983
+ z === "loading" && /* @__PURE__ */ e(Vt, {}),
5984
+ z === "extra_view" && E && u?.View && /* @__PURE__ */ e(u.View, { path: E }),
5985
+ z === "welcome" && /* @__PURE__ */ e(
5986
+ Ki,
5951
5987
  {
5952
5988
  path: E,
5953
5989
  onContinue: (W) => {
@@ -5958,23 +5994,23 @@ function Zi({
5958
5994
  pathSuggestions: g
5959
5995
  }
5960
5996
  ),
5961
- A === "import_data_mapping" && P && /* @__PURE__ */ e(
5962
- Hi,
5997
+ z === "import_data_mapping" && P && /* @__PURE__ */ e(
5998
+ Gi,
5963
5999
  {
5964
6000
  importConfig: P,
5965
6001
  customFields: C
5966
6002
  }
5967
6003
  ),
5968
- A === "import_data_preview" && P && /* @__PURE__ */ e(
5969
- Qi,
6004
+ z === "import_data_preview" && P && /* @__PURE__ */ e(
6005
+ Zi,
5970
6006
  {
5971
6007
  importConfig: P,
5972
6008
  properties: S.properties,
5973
6009
  propertiesOrder: S.propertiesOrder
5974
6010
  }
5975
6011
  ),
5976
- A === "import_data_saving" && P && /* @__PURE__ */ e(
5977
- si,
6012
+ z === "import_data_saving" && P && /* @__PURE__ */ e(
6013
+ li,
5978
6014
  {
5979
6015
  importConfig: P,
5980
6016
  collection: S,
@@ -5986,8 +6022,8 @@ function Zi({
5986
6022
  }
5987
6023
  }
5988
6024
  ),
5989
- A === "details" && /* @__PURE__ */ e(
5990
- mi,
6025
+ z === "details" && /* @__PURE__ */ e(
6026
+ ui,
5991
6027
  {
5992
6028
  existingPaths: v,
5993
6029
  existingAliases: T,
@@ -5996,25 +6032,25 @@ function Zi({
5996
6032
  isNewCollection: t
5997
6033
  }
5998
6034
  ),
5999
- A === "subcollections" && J && /* @__PURE__ */ e(
6000
- $i,
6035
+ z === "subcollections" && J && /* @__PURE__ */ e(
6036
+ Li,
6001
6037
  {
6002
6038
  parentCollection: f,
6003
6039
  configController: r,
6004
6040
  getUser: b,
6005
6041
  collectionInference: d,
6006
- parentPathSegments: n,
6042
+ parentPathSegments: s,
6007
6043
  collection: J
6008
6044
  }
6009
6045
  ),
6010
- A === "properties" && /* @__PURE__ */ e(
6011
- Di,
6046
+ z === "properties" && /* @__PURE__ */ e(
6047
+ Ri,
6012
6048
  {
6013
6049
  showErrors: j > 0,
6014
6050
  isNewCollection: t,
6015
6051
  reservedGroups: m,
6016
6052
  onPropertyError: (W, Me, ce) => {
6017
- ue.current = Ma({
6053
+ ue.current = Da({
6018
6054
  ...ue.current,
6019
6055
  [W]: ce
6020
6056
  }, !0);
@@ -6033,13 +6069,13 @@ function Zi({
6033
6069
  )
6034
6070
  }
6035
6071
  ),
6036
- A !== "welcome" && /* @__PURE__ */ o(
6072
+ z !== "welcome" && /* @__PURE__ */ o(
6037
6073
  Ke,
6038
6074
  {
6039
6075
  position: "absolute",
6040
6076
  children: [
6041
- H && /* @__PURE__ */ e(Da, { error: H }),
6042
- t && _ && A === "import_data_mapping" && /* @__PURE__ */ o(
6077
+ H && /* @__PURE__ */ e(Ra, { error: H }),
6078
+ t && _ && z === "import_data_mapping" && /* @__PURE__ */ o(
6043
6079
  M,
6044
6080
  {
6045
6081
  variant: "text",
@@ -6051,7 +6087,7 @@ function Zi({
6051
6087
  ]
6052
6088
  }
6053
6089
  ),
6054
- t && _ && A === "import_data_preview" && /* @__PURE__ */ o(
6090
+ t && _ && z === "import_data_preview" && /* @__PURE__ */ o(
6055
6091
  M,
6056
6092
  {
6057
6093
  variant: "text",
@@ -6065,7 +6101,7 @@ function Zi({
6065
6101
  ]
6066
6102
  }
6067
6103
  ),
6068
- t && _ && A === "details" && /* @__PURE__ */ o(
6104
+ t && _ && z === "details" && /* @__PURE__ */ o(
6069
6105
  M,
6070
6106
  {
6071
6107
  variant: "text",
@@ -6077,7 +6113,7 @@ function Zi({
6077
6113
  ]
6078
6114
  }
6079
6115
  ),
6080
- t && A === "properties" && /* @__PURE__ */ o(
6116
+ t && z === "properties" && /* @__PURE__ */ o(
6081
6117
  M,
6082
6118
  {
6083
6119
  variant: "text",
@@ -6099,7 +6135,7 @@ function Zi({
6099
6135
  children: "Cancel"
6100
6136
  }
6101
6137
  ),
6102
- t && A === "import_data_mapping" && /* @__PURE__ */ e(
6138
+ t && z === "import_data_mapping" && /* @__PURE__ */ e(
6103
6139
  M,
6104
6140
  {
6105
6141
  variant: "filled",
@@ -6108,7 +6144,7 @@ function Zi({
6108
6144
  children: "Next"
6109
6145
  }
6110
6146
  ),
6111
- t && A === "import_data_preview" && /* @__PURE__ */ e(
6147
+ t && z === "import_data_preview" && /* @__PURE__ */ e(
6112
6148
  M,
6113
6149
  {
6114
6150
  variant: "filled",
@@ -6119,18 +6155,18 @@ function Zi({
6119
6155
  children: "Next"
6120
6156
  }
6121
6157
  ),
6122
- t && (A === "details" || A === "properties") && /* @__PURE__ */ o(
6158
+ t && (z === "details" || z === "properties") && /* @__PURE__ */ o(
6123
6159
  wt,
6124
6160
  {
6125
6161
  variant: "filled",
6126
6162
  color: "primary",
6127
6163
  type: "submit",
6128
6164
  loading: D,
6129
- disabled: D || A === "details" && !ht,
6130
- startIcon: A === "properties" ? /* @__PURE__ */ e(Ra, {}) : void 0,
6165
+ disabled: D || z === "details" && !ht,
6166
+ startIcon: z === "properties" ? /* @__PURE__ */ e(Ua, {}) : void 0,
6131
6167
  children: [
6132
- A === "details" && "Next",
6133
- A === "properties" && "Create collection"
6168
+ z === "details" && "Next",
6169
+ z === "properties" && "Create collection"
6134
6170
  ]
6135
6171
  }
6136
6172
  ),
@@ -6155,19 +6191,19 @@ function Zi({
6155
6191
  }
6156
6192
  ) });
6157
6193
  }
6158
- const la = R.createContext({}), ca = R.createContext({}), Ji = R.memo(
6194
+ const ca = R.createContext({}), da = R.createContext({}), Xi = R.memo(
6159
6195
  function({
6160
6196
  children: a,
6161
6197
  collectionConfigController: r,
6162
6198
  configPermissions: i,
6163
- reservedGroups: n,
6164
- collectionInference: s,
6199
+ reservedGroups: s,
6200
+ collectionInference: n,
6165
6201
  extraView: d,
6166
6202
  pathSuggestions: c,
6167
6203
  getUser: m,
6168
6204
  getData: u
6169
6205
  }) {
6170
- const p = Ie(), l = li(), {
6206
+ const p = Ie(), l = ci(), {
6171
6207
  collections: g
6172
6208
  } = p, b = g.map((v) => v.path.trim().toLowerCase()), [f, k] = R.useState();
6173
6209
  se(() => {
@@ -6195,8 +6231,8 @@ const la = R.createContext({}), ca = R.createContext({}), Ji = R.memo(
6195
6231
  initialValues: P
6196
6232
  });
6197
6233
  }, []), w = c ? (v) => !v && f ? Promise.resolve(f) : c?.(v) : void 0;
6198
- return /* @__PURE__ */ e(la.Provider, { value: r, children: /* @__PURE__ */ o(
6199
- ca.Provider,
6234
+ return /* @__PURE__ */ e(ca.Provider, { value: r, children: /* @__PURE__ */ o(
6235
+ da.Provider,
6200
6236
  {
6201
6237
  value: {
6202
6238
  editCollection: y,
@@ -6207,15 +6243,15 @@ const la = R.createContext({}), ca = R.createContext({}), Ji = R.memo(
6207
6243
  children: [
6208
6244
  a,
6209
6245
  /* @__PURE__ */ e(
6210
- sa,
6246
+ la,
6211
6247
  {
6212
6248
  open: !!C,
6213
6249
  configController: r,
6214
6250
  isNewCollection: !1,
6215
- collectionInference: s,
6251
+ collectionInference: n,
6216
6252
  ...C,
6217
6253
  getData: u,
6218
- reservedGroups: n,
6254
+ reservedGroups: s,
6219
6255
  extraView: d,
6220
6256
  pathSuggestions: w,
6221
6257
  getUser: m,
@@ -6233,15 +6269,15 @@ const la = R.createContext({}), ca = R.createContext({}), Ji = R.memo(
6233
6269
  ) });
6234
6270
  },
6235
6271
  tt
6236
- ), pt = () => Ut(ca), da = () => Ut(la);
6237
- function Xi({
6272
+ ), pt = () => Ut(da), pa = () => Ut(ca);
6273
+ function Wi({
6238
6274
  path: t,
6239
6275
  parentPathSegments: a,
6240
6276
  collection: r,
6241
6277
  tableController: i
6242
6278
  }) {
6243
- const n = He(), s = Ie(), d = pt(), c = da(), m = lt(), u = s.getCollectionFromPaths(a), p = d.configPermissions ? d.configPermissions({
6244
- user: n.user,
6279
+ const s = He(), n = Ie(), d = pt(), c = pa(), m = lt(), u = n.getCollectionFromPaths(a), p = d.configPermissions ? d.configPermissions({
6280
+ user: s.user,
6245
6281
  collection: r
6246
6282
  }).editCollections : !0;
6247
6283
  let l = null;
@@ -6271,7 +6307,7 @@ function Xi({
6271
6307
  message: "Default config saved"
6272
6308
  });
6273
6309
  }),
6274
- children: /* @__PURE__ */ e(Ua, {})
6310
+ children: /* @__PURE__ */ e($a, {})
6275
6311
  }
6276
6312
  )
6277
6313
  }
@@ -6297,25 +6333,25 @@ function Xi({
6297
6333
  function Xe(t) {
6298
6334
  return t && Object.keys(t).length === 0 ? t : t ?? null;
6299
6335
  }
6300
- function Wi({
6336
+ function er({
6301
6337
  path: t,
6302
6338
  collection: a
6303
6339
  }) {
6304
- const r = He(), i = da(), n = pt(), s = n.configPermissions({
6340
+ const r = He(), i = pa(), s = pt(), n = s.configPermissions({
6305
6341
  user: r.user,
6306
6342
  collection: a
6307
6343
  }), d = Z(() => {
6308
- n?.editCollection({ path: t, parentPathSegments: [] });
6309
- }, [n, t]), [c, m] = Y(!1), u = Z(() => {
6344
+ s?.editCollection({ path: t, parentPathSegments: [] });
6345
+ }, [s, t]), [c, m] = Y(!1), u = Z(() => {
6310
6346
  i?.deleteCollection({ path: t });
6311
6347
  }, [t, i]);
6312
6348
  return /* @__PURE__ */ o(I, { children: [
6313
6349
  /* @__PURE__ */ o("div", { children: [
6314
- s.deleteCollections && /* @__PURE__ */ e(
6315
- $a,
6350
+ n.deleteCollections && /* @__PURE__ */ e(
6351
+ La,
6316
6352
  {
6317
- trigger: /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(La, { size: "small" }) }),
6318
- children: /* @__PURE__ */ o(Ka, { onClick: (p) => {
6353
+ trigger: /* @__PURE__ */ e(pe, { children: /* @__PURE__ */ e(Ka, { size: "small" }) }),
6354
+ children: /* @__PURE__ */ o(Ya, { onClick: (p) => {
6319
6355
  p.preventDefault(), p.stopPropagation(), m(!0);
6320
6356
  }, children: [
6321
6357
  /* @__PURE__ */ e(it, {}),
@@ -6323,7 +6359,7 @@ function Wi({
6323
6359
  ] })
6324
6360
  }
6325
6361
  ),
6326
- s.editCollections && /* @__PURE__ */ e(
6362
+ n.editCollections && /* @__PURE__ */ e(
6327
6363
  pe,
6328
6364
  {
6329
6365
  onClick: (p) => {
@@ -6349,20 +6385,20 @@ function Wi({
6349
6385
  )
6350
6386
  ] });
6351
6387
  }
6352
- function er({
6388
+ function tr({
6353
6389
  group: t,
6354
6390
  context: a
6355
6391
  }) {
6356
6392
  if (!a.navigation.topLevelNavigation)
6357
6393
  throw Error("Navigation not ready in FireCMSHomePage");
6358
- const r = He(), i = pt(), n = i.configPermissions ? i.configPermissions({
6394
+ const r = He(), i = pt(), s = i.configPermissions ? i.configPermissions({
6359
6395
  user: r.user
6360
6396
  }).createCollections : !0;
6361
6397
  return /* @__PURE__ */ e(
6362
6398
  Xt,
6363
6399
  {
6364
6400
  className: ve("h-full p-4 min-h-[124px]"),
6365
- onClick: i && n ? () => i.createCollection({
6401
+ onClick: i && s ? () => i.createCollection({
6366
6402
  initialValues: t ? { group: t } : void 0,
6367
6403
  parentPathSegments: []
6368
6404
  }) : void 0,
@@ -6381,21 +6417,21 @@ function er({
6381
6417
  children: "Add new collection".toUpperCase()
6382
6418
  }
6383
6419
  ),
6384
- !n && /* @__PURE__ */ e(N, { variant: "caption", children: "You don't have permissions to create collections" })
6420
+ !s && /* @__PURE__ */ e(N, { variant: "caption", children: "You don't have permissions to create collections" })
6385
6421
  ]
6386
6422
  }
6387
6423
  )
6388
6424
  }
6389
6425
  );
6390
6426
  }
6391
- function tr() {
6427
+ function ar() {
6392
6428
  const t = He(), a = Ie(), r = pt(), i = r.configPermissions ? r.configPermissions({
6393
6429
  user: t.user
6394
- }).createCollections : !0, n = r.rootPathSuggestions ?? [], s = n.length > 3 || a.collections.length === 0 && n.length > 0;
6430
+ }).createCollections : !0, s = r.rootPathSuggestions ?? [], n = s.length > 3 || a.collections.length === 0 && s.length > 0;
6395
6431
  return /* @__PURE__ */ e(
6396
- Ya,
6432
+ Ha,
6397
6433
  {
6398
- in: s,
6434
+ in: n,
6399
6435
  children: /* @__PURE__ */ o(
6400
6436
  "div",
6401
6437
  {
@@ -6406,7 +6442,7 @@ function tr() {
6406
6442
  "div",
6407
6443
  {
6408
6444
  className: "flex flex-row gap-1 overflow-scroll no-scrollbar ",
6409
- children: n.map((d) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
6445
+ children: s.map((d) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
6410
6446
  at,
6411
6447
  {
6412
6448
  icon: /* @__PURE__ */ e(Oe, { size: "small" }),
@@ -6427,63 +6463,63 @@ function tr() {
6427
6463
  }
6428
6464
  );
6429
6465
  }
6430
- function ar(t, a) {
6431
- const r = t.map((s) => ({
6432
- ...s,
6466
+ function ir(t, a) {
6467
+ const r = t.map((n) => ({
6468
+ ...n,
6433
6469
  editable: !0,
6434
6470
  deletable: !0
6435
- })), i = (a ?? []).map((s) => {
6436
- const d = r?.find((c) => c.path === s.path || c.alias && s.alias && c.alias === s.alias);
6471
+ })), i = (a ?? []).map((n) => {
6472
+ const d = r?.find((c) => c.path === n.path || c.alias && n.alias && c.alias === n.alias);
6437
6473
  return d ? (Object.values(d.properties).forEach((m) => {
6438
6474
  m.editable = !0;
6439
- }), { ...ma(d, s), deletable: !1 }) : {
6440
- ...s,
6441
- properties: pa(s.properties),
6475
+ }), { ...ua(d, n), deletable: !1 }) : {
6476
+ ...n,
6477
+ properties: ma(n.properties),
6442
6478
  deletable: !1
6443
6479
  };
6444
- }), n = r.filter((s) => !i.map((d) => d.path).includes(s.path) || !i.map((d) => d.alias).includes(s.alias));
6445
- return console.log("Updated collections", { updatedCollections: i, resultStoredCollections: n }), [...i, ...n];
6480
+ }), s = r.filter((n) => !i.map((d) => d.path).includes(n.path) || !i.map((d) => d.alias).includes(n.alias));
6481
+ return [...i, ...s];
6446
6482
  }
6447
- function pa(t) {
6483
+ function ma(t) {
6448
6484
  return Object.entries(t).reduce((a, [r, i]) => {
6449
6485
  if (!ne(i) && i.dataType === "map" && i.properties) {
6450
- const n = { ...i, properties: pa(i.properties) };
6451
- a[r] = n;
6486
+ const s = { ...i, properties: ma(i.properties) };
6487
+ a[r] = s;
6452
6488
  }
6453
6489
  return ne(i) ? a[r] = i : a[r] = { ...i, editable: !1 }, a;
6454
6490
  }, {});
6455
6491
  }
6456
- function ma(t, a) {
6492
+ function ua(t, a) {
6457
6493
  const r = t.subcollections?.map((u) => {
6458
6494
  const p = a.subcollections?.find((l) => l.path === u.path) ?? a.subcollections?.find((l) => l.alias === u.alias);
6459
- return p ? ma(u, p) : u;
6495
+ return p ? ua(u, p) : u;
6460
6496
  }), i = { ...t.properties };
6461
6497
  Object.keys(a.properties).forEach((u) => {
6462
6498
  const p = t.properties[u];
6463
- p ? i[u] = ua(p, a.properties[u]) : i[u] = a.properties[u];
6499
+ p ? i[u] = ha(p, a.properties[u]) : i[u] = a.properties[u];
6464
6500
  });
6465
- const n = L(t, a), s = Dt(t), d = Dt(a), c = [.../* @__PURE__ */ new Set([...s, ...d])], m = [.../* @__PURE__ */ new Set([...t.entityViews ?? [], ...a.entityViews ?? []])];
6501
+ const s = L(t, a), n = Dt(t), d = Dt(a), c = [.../* @__PURE__ */ new Set([...n, ...d])], m = [.../* @__PURE__ */ new Set([...t.entityViews ?? [], ...a.entityViews ?? []])];
6466
6502
  return {
6467
- ...n,
6503
+ ...s,
6468
6504
  subcollections: r,
6469
- properties: Ha(i, c),
6505
+ properties: Ga(i, c),
6470
6506
  propertiesOrder: c,
6471
6507
  entityViews: m
6472
6508
  };
6473
6509
  }
6474
- function ua(t, a) {
6510
+ function ha(t, a) {
6475
6511
  if (ne(a))
6476
6512
  return a;
6477
6513
  {
6478
- const r = L(t, a), i = !!t.editable, n = !!a.editable;
6514
+ const r = L(t, a), i = !!t.editable, s = !!a.editable;
6479
6515
  if (a.dataType === "map" && a.properties) {
6480
- const s = "properties" in t ? t.properties : {}, d = "properties" in a ? a.properties : {}, c = "propertiesOrder" in t && t.propertiesOrder ? t.propertiesOrder : Object.keys(s), m = "propertiesOrder" in a && a.propertiesOrder ? a.propertiesOrder : "properties" in a ? Object.keys(a.properties) : [], u = [.../* @__PURE__ */ new Set([...c, ...m])], p = { ...s };
6516
+ const n = "properties" in t ? t.properties : {}, d = "properties" in a ? a.properties : {}, c = "propertiesOrder" in t && t.propertiesOrder ? t.propertiesOrder : Object.keys(n), m = "propertiesOrder" in a && a.propertiesOrder ? a.propertiesOrder : "properties" in a ? Object.keys(a.properties) : [], u = [.../* @__PURE__ */ new Set([...c, ...m])], p = { ...n };
6481
6517
  return Object.keys(a.properties).forEach((l) => {
6482
- const g = s[l];
6483
- g && (p[l] = ua(g, d[l]));
6484
- }), { ...r, editable: i && n, properties: p, propertiesOrder: u };
6518
+ const g = n[l];
6519
+ g && (p[l] = ha(g, d[l]));
6520
+ }), { ...r, editable: i && s, properties: p, propertiesOrder: u };
6485
6521
  }
6486
- return { ...r, editable: i && n };
6522
+ return { ...r, editable: i && s };
6487
6523
  }
6488
6524
  }
6489
6525
  function Dt(t) {
@@ -6492,18 +6528,18 @@ function Dt(t) {
6492
6528
  ...(t.additionalFields ?? [])?.map((a) => a.id)
6493
6529
  ];
6494
6530
  }
6495
- function mr({
6531
+ function ur({
6496
6532
  collectionConfigController: t,
6497
6533
  configPermissions: a,
6498
6534
  reservedGroups: r,
6499
6535
  extraView: i,
6500
- pathSuggestions: n,
6501
- getUser: s,
6536
+ pathSuggestions: s,
6537
+ getUser: n,
6502
6538
  collectionInference: d,
6503
6539
  getData: c
6504
6540
  }) {
6505
6541
  const m = Z(
6506
- (u) => ar(t.collections ?? [], u),
6542
+ (u) => ir(t.collections ?? [], u),
6507
6543
  [t.collections]
6508
6544
  );
6509
6545
  return {
@@ -6511,33 +6547,33 @@ function mr({
6511
6547
  loading: t.loading,
6512
6548
  collections: {
6513
6549
  injectCollections: m,
6514
- CollectionActions: Xi
6550
+ CollectionActions: Wi
6515
6551
  },
6516
6552
  provider: {
6517
- Component: Ji,
6553
+ Component: Xi,
6518
6554
  props: {
6519
6555
  collectionConfigController: t,
6520
6556
  configPermissions: a,
6521
6557
  collectionInference: d,
6522
6558
  reservedGroups: r,
6523
6559
  extraView: i,
6524
- pathSuggestions: n,
6525
- getUser: s,
6560
+ pathSuggestions: s,
6561
+ getUser: n,
6526
6562
  getData: c
6527
6563
  }
6528
6564
  },
6529
6565
  homePage: {
6530
- additionalChildrenStart: /* @__PURE__ */ e(tr, {}),
6531
- CollectionActions: Wi,
6532
- AdditionalCards: er
6566
+ additionalChildrenStart: /* @__PURE__ */ e(ar, {}),
6567
+ CollectionActions: er,
6568
+ AdditionalCards: tr
6533
6569
  }
6534
6570
  };
6535
6571
  }
6536
6572
  export {
6537
6573
  Ue as editableProperty,
6538
- wi as removeNonEditableProperties,
6574
+ _i as removeNonEditableProperties,
6539
6575
  pt as useCollectionEditorController,
6540
- mr as useCollectionEditorPlugin,
6541
- da as useCollectionsConfigController
6576
+ ur as useCollectionEditorPlugin,
6577
+ pa as useCollectionsConfigController
6542
6578
  };
6543
6579
  //# sourceMappingURL=index.es.js.map