@firecms/collection_editor 3.0.0-alpha.30 → 3.0.0-alpha.32

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,19 +1,21 @@
1
1
  import { jsxs as n, Fragment as B, jsx as e } from "react/jsx-runtime";
2
- import * as we from "react";
3
- import R, { useState as H, useCallback as Z, useEffect as me, useMemo as Lt, useRef as Le, useDeferredValue as ba, useContext as Kt } from "react";
4
- import { iconKeys as Yt, debounce as ya, SearchBar as va, Tooltip as ie, IconButton as ue, Icon as ot, coolIconKeys as _t, Typography as P, getIconForView as nt, useAutoComplete as wa, Container as pt, Chip as st, TextField as je, cn as ke, DebouncedTextField as Q, Autocomplete as _a, AutocompleteItem as ka, ExpandablePanel as xt, SettingsIcon as Ye, Select as Fe, SelectItem as ve, BooleanSwitchWithLabel as Ht, Dialog as De, toSnakeCase as Gt, singular as xa, ListIcon as Ca, Button as E, CircularProgress as He, AutoAwesomeIcon as mt, Paper as Ne, FormikArrayContainer as Oa, DialogContent as Ge, DialogActions as Qe, SwitchControl as he, serializeRegExp as Pa, isValidRegExp as Na, RuleIcon as Sa, useSnackbarController as Ze, resolveEnumValues as qa, FileUploadIcon as Aa, MultiSelect as za, MultiSelectItem as At, Checkbox as zt, isPropertyBuilder as ce, useFireCMSContext as Ae, getFieldConfig as Je, ErrorBoundary as Oe, FieldConfigBadge as We, cardMixin as Qt, cardClickableMixin as Zt, cardSelectedMixin as Jt, RemoveCircleIcon as Wt, FunctionsIcon as Ta, defaultBorderMixin as Ct, RemoveIcon as Va, DragHandleIcon as ja, AddIcon as Se, useNavigationContext as Re, SelectGroup as Tt, mergeDeep as $, buildProperty as Y, getFieldId as Xt, DEFAULT_FIELD_CONFIGS as kt, InfoLabel as ea, DeleteIcon as lt, DeleteConfirmationDialog as ct, useLargeLayout as Fa, makePropertiesEditable as ta, resolveEntityView as Ia, Table as Vt, TableBody as jt, TableRow as bt, TableCell as $e, buildCollection as Ot, unslugify as Pt, Card as aa, useSelectionController as Ea, EntityCollectionTable as Ba, slugify as Ma, useAuthController as Ue, CircularProgressCenter as Ft, Tabs as Da, Tab as yt, removeUndefined as Ra, ErrorView as ia, ArrowBackIcon as at, LoadingButton as It, DoneIcon as Ua, SaveIcon as $a, Menu as La, MoreVertIcon as Ka, MenuItem as Ya, Collapse as Ha, sortProperties as Ga, getDefaultPropertiesOrder as Qa } from "@firecms/core";
5
- import dt from "react-fast-compare";
6
- import { useFormikContext as L, Field as fe, getIn as N, Formik as Nt, FastField as de, Form as Za } from "formik";
2
+ import * as _e from "react";
3
+ import D, { useState as L, useCallback as J, useEffect as de, useMemo as $t, useRef as Ye, useDeferredValue as fa, useContext as Lt } from "react";
4
+ import { iconKeys as Kt, debounce as ba, SearchBar as ya, Tooltip as ae, IconButton as re, Icon as st, coolIconKeys as _t, Typography as P, getIconForView as lt, useAutoComplete as va, Container as ut, Chip as ct, TextField as Ve, cn as xe, DebouncedTextField as G, Autocomplete as wa, AutocompleteItem as _a, ExpandablePanel as xt, SettingsIcon as Ge, Select as je, SelectItem as we, BooleanSwitchWithLabel as Yt, Dialog as Ie, toSnakeCase as Ht, singular as ka, ListIcon as xa, Button as E, CircularProgress as Je, AutoAwesomeIcon as ht, Paper as Se, FormikArrayContainer as Ca, DialogContent as De, DialogActions as Re, SwitchControl as ue, serializeRegExp as Oa, isValidRegExp as Pa, RuleIcon as Na, useSnackbarController as Qe, resolveEnumValues as Sa, FileUploadIcon as qa, MultiSelect as Aa, MultiSelectItem as qt, Checkbox as At, isPropertyBuilder as se, useFireCMSContext as Ae, getFieldConfig as We, ErrorBoundary as Pe, FieldConfigBadge as Ze, cardMixin as Gt, cardClickableMixin as Jt, cardSelectedMixin as Qt, RemoveCircleIcon as Wt, FunctionsIcon as za, defaultBorderMixin as Ct, RemoveIcon as Ta, DragHandleIcon as Va, AddIcon as qe, useNavigationContext as Ue, SelectGroup as zt, mergeDeep as $, getFieldId as Zt, DEFAULT_FIELD_CONFIGS as kt, InfoLabel as Xt, DeleteIcon as dt, DeleteConfirmationDialog as pt, useLargeLayout as ja, CodeIcon as Fa, makePropertiesEditable as ea, resolveEntityView as Ia, Table as Tt, TableBody as Vt, TableRow as bt, TableCell as Ke, unslugify as Ot, Card as ta, useSelectionController as Ea, EntityCollectionTable as Ba, slugify as Ma, useAuthController as $e, CircularProgressCenter as jt, Tabs as Da, Tab as yt, removeUndefined as Ra, ErrorView as aa, ArrowBackIcon as rt, LoadingButton as Ft, DoneIcon as Ua, SaveIcon as $a, Menu as La, MoreVertIcon as Ka, MenuItem as Ya, Collapse as Ha, sortProperties as Ga, getDefaultPropertiesOrder as Ja } from "@firecms/core";
5
+ import mt from "react-fast-compare";
6
+ import { useFormikContext as K, Field as be, getIn as N, Formik as Pt, FastField as le, Form as Qa } from "formik";
7
7
  import * as vt from "yup";
8
- import * as Ja from "js-search";
9
- import { extractEnumFromValues as Wa, buildPropertyFromData as Xa, buildEntityPropertiesFromData as ei } from "@firecms/schema_inference";
10
- import { DragDropContext as ti, Droppable as ai, Draggable as ii } from "@hello-pangea/dnd";
11
- import { ImportFileUpload as ri, DataNewPropertiesMapping as oi, ImportNewPropertyFieldPreview as ni, getInferenceType as ra, getPropertiesMapping as si, convertDataToEntity as li, useImportConfig as ci, ImportSaveInProgress as di } from "@firecms/data_import";
12
- import { useNavigate as pi } from "react-router";
13
- const mi = vt.object().shape({
8
+ import * as Wa from "js-search";
9
+ import Za from "json5";
10
+ import { Highlight as Xa, themes as ei } from "prism-react-renderer";
11
+ import { extractEnumFromValues as ti, buildPropertyFromData as ai, buildEntityPropertiesFromData as ii } from "@firecms/schema_inference";
12
+ import { DragDropContext as ri, Droppable as oi, Draggable as ni } from "@hello-pangea/dnd";
13
+ import { ImportFileUpload as si, DataNewPropertiesMapping as li, ImportNewPropertyFieldPreview as ci, getInferenceType as ia, getPropertiesMapping as di, convertDataToEntity as pi, useImportConfig as mi, ImportSaveInProgress as ui } from "@firecms/data_import";
14
+ import { useNavigate as hi } from "react-router";
15
+ const gi = vt.object().shape({
14
16
  name: vt.string().required("Required"),
15
17
  path: vt.string().required("Required")
16
- }), oa = {
18
+ }), ra = {
17
19
  abc: "alphabet character font letter symbol text type",
18
20
  access_alarm: "clock time",
19
21
  access_alarms: "clock time",
@@ -1962,34 +1964,34 @@ const mi = vt.object().shape({
1962
1964
  zoom_in_map: "arrows destination location maps move place stop",
1963
1965
  zoom_out: "find glass look magnifier magnifying minus negative scale search see size smaller",
1964
1966
  zoom_out_map: "arrows destination location maps move place stop"
1965
- }, St = new Ja.Search("key");
1966
- St.addIndex("synonyms");
1967
- St.addDocuments(Yt.map((t) => ({
1967
+ }, Nt = new Wa.Search("key");
1968
+ Nt.addIndex("synonyms");
1969
+ Nt.addDocuments(Kt.map((t) => ({
1968
1970
  key: t,
1969
1971
  // @ts-ignore
1970
- synonyms: oa[t] ?? []
1972
+ synonyms: ra[t] ?? []
1971
1973
  })));
1972
- const ui = 220;
1973
- process.env.NODE_ENV !== "production" && Object.keys(oa).forEach((t) => {
1974
- Yt.includes(t) || console.warn(`The icon ${t} no longer exists. Remove it from \`synonyms\``);
1974
+ const fi = 220;
1975
+ process.env.NODE_ENV !== "production" && Object.keys(ra).forEach((t) => {
1976
+ Kt.includes(t) || console.warn(`The icon ${t} no longer exists. Remove it from \`synonyms\``);
1975
1977
  });
1976
- function hi({ selectedIcon: t = "", onIconSelected: a }) {
1977
- const [r, i] = we.useState(null), [s, o] = we.useState(""), l = we.useMemo(
1978
- () => ya((m) => {
1978
+ function bi({ selectedIcon: t = "", onIconSelected: a }) {
1979
+ const [r, i] = _e.useState(null), [s, o] = _e.useState(""), l = _e.useMemo(
1980
+ () => ba((m) => {
1979
1981
  if (!m || m === "")
1980
1982
  i(null);
1981
1983
  else {
1982
- const u = St.search(m);
1984
+ const u = Nt.search(m);
1983
1985
  i(u.map((c) => c.key));
1984
1986
  }
1985
- }, ui),
1987
+ }, fi),
1986
1988
  []
1987
1989
  );
1988
- return we.useEffect(() => (l(s), () => {
1990
+ return _e.useEffect(() => (l(s), () => {
1989
1991
  l.clear();
1990
1992
  }), [s, l]), /* @__PURE__ */ n(B, { children: [
1991
1993
  /* @__PURE__ */ e(
1992
- va,
1994
+ ya,
1993
1995
  {
1994
1996
  autoFocus: !0,
1995
1997
  className: "w-full sticky top-0 z-10",
@@ -1997,14 +1999,14 @@ function hi({ selectedIcon: t = "", onIconSelected: a }) {
1997
1999
  placeholder: "Search for more icons…"
1998
2000
  }
1999
2001
  ),
2000
- /* @__PURE__ */ e("div", { className: "flex max-w-full flex-wrap mt-4", children: (r === null ? _t : r).map((m) => /* @__PURE__ */ e(ie, { title: m, children: /* @__PURE__ */ e(
2001
- ue,
2002
+ /* @__PURE__ */ e("div", { className: "flex max-w-full flex-wrap mt-4", children: (r === null ? _t : r).map((m) => /* @__PURE__ */ e(ae, { title: m, children: /* @__PURE__ */ e(
2003
+ re,
2002
2004
  {
2003
2005
  shape: "square",
2004
2006
  toggled: t === m,
2005
2007
  onClick: () => a(m),
2006
2008
  className: "box-content m-1",
2007
- children: /* @__PURE__ */ e(ot, { iconKey: m, size: 24 })
2009
+ children: /* @__PURE__ */ e(st, { iconKey: m, size: 24 })
2008
2010
  }
2009
2011
  ) }, m)) })
2010
2012
  ] });
@@ -2015,7 +2017,7 @@ function te({
2015
2017
  }) {
2016
2018
  return a ? /* @__PURE__ */ e(P, { variant: "caption", color: t ? "error" : "secondary", className: "ml-3.5 mt-0.5", children: a }) : null;
2017
2019
  }
2018
- function gi({
2020
+ function yi({
2019
2021
  isNewCollection: t,
2020
2022
  reservedGroups: a,
2021
2023
  existingPaths: r,
@@ -2023,7 +2025,7 @@ function gi({
2023
2025
  groups: s,
2024
2026
  parentCollection: o
2025
2027
  }) {
2026
- const l = R.useRef(null), {
2028
+ const l = D.useRef(null), {
2027
2029
  values: d,
2028
2030
  setFieldValue: m,
2029
2031
  handleChange: u,
@@ -2032,24 +2034,24 @@ function gi({
2032
2034
  setFieldTouched: g,
2033
2035
  isSubmitting: f,
2034
2036
  submitCount: y
2035
- } = L(), [k, _] = H(!1), O = (x) => {
2036
- m("name", x), !N(c, "path") && t && x && m("path", Gt(x)), !N(c, "singularName") && t && x && m("singularName", xa(x));
2037
- }, h = nt(d), w = Z((x) => {
2037
+ } = K(), [k, _] = L(!1), O = (x) => {
2038
+ m("name", x), !N(c, "path") && t && x && m("path", Ht(x)), !N(c, "singularName") && t && x && m("singularName", ka(x));
2039
+ }, h = lt(d), w = J((x) => {
2038
2040
  let C;
2039
2041
  return x || (C = "You must specify a path in the database for this collection"), t && i?.includes(x.trim().toLowerCase()) && (C = "There is already a collection which uses this path as an alias"), t && r?.includes(x.trim().toLowerCase()) && !d.alias && (C = "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"), C;
2040
- }, [t, i, r, d.alias]), b = Z((x) => {
2042
+ }, [t, i, r, d.alias]), b = J((x) => {
2041
2043
  if (!x)
2042
2044
  return;
2043
2045
  let C;
2044
2046
  return t && r?.includes(x.trim().toLowerCase()) && (C = "There is already a collection that uses this value as a path"), t && i?.includes(x.trim().toLowerCase()) && (C = "There is already a collection which uses this alias"), C;
2045
2047
  }, [t, r, i]), v = s?.filter((x) => !a?.includes(x)), {
2046
2048
  inputFocused: T,
2047
- autoCompleteOpen: I,
2049
+ autoCompleteOpen: F,
2048
2050
  setAutoCompleteOpen: A
2049
- } = wa({
2051
+ } = va({
2050
2052
  ref: l
2051
2053
  }), S = !!o;
2052
- return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ n(pt, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
2054
+ return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ n(ut, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
2053
2055
  /* @__PURE__ */ n("div", { children: [
2054
2056
  /* @__PURE__ */ n(
2055
2057
  "div",
@@ -2057,8 +2059,8 @@ function gi({
2057
2059
  className: "flex flex-row py-2 pt-3 items-center",
2058
2060
  children: [
2059
2061
  /* @__PURE__ */ e(P, { variant: t ? "h4" : "h5", className: "flex-grow", children: t ? "New collection" : `${d.name} collection` }),
2060
- /* @__PURE__ */ e(ie, { title: "Change icon", children: /* @__PURE__ */ e(
2061
- ue,
2062
+ /* @__PURE__ */ e(ae, { title: "Change icon", children: /* @__PURE__ */ e(
2063
+ re,
2062
2064
  {
2063
2065
  shape: "square",
2064
2066
  onClick: () => _(!0),
@@ -2068,7 +2070,7 @@ function gi({
2068
2070
  ]
2069
2071
  }
2070
2072
  ),
2071
- o && /* @__PURE__ */ e(st, { colorScheme: "tealDarker", children: /* @__PURE__ */ n(P, { variant: "caption", children: [
2073
+ o && /* @__PURE__ */ e(ct, { colorScheme: "tealDarker", children: /* @__PURE__ */ n(P, { variant: "caption", children: [
2072
2074
  "This is a subcollection of ",
2073
2075
  /* @__PURE__ */ e("b", { children: o.name })
2074
2076
  ] }) })
@@ -2076,7 +2078,7 @@ function gi({
2076
2078
  /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-4", children: [
2077
2079
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
2078
2080
  /* @__PURE__ */ e(
2079
- je,
2081
+ Ve,
2080
2082
  {
2081
2083
  value: d.name ?? "",
2082
2084
  onChange: (x) => O(x.target.value),
@@ -2087,12 +2089,12 @@ function gi({
2087
2089
  ),
2088
2090
  /* @__PURE__ */ e(te, { error: c.name && !!p.name, children: c.name && p.name ? p.name : "Name of in this collection, usually a plural name (e.g. Products)" })
2089
2091
  ] }),
2090
- /* @__PURE__ */ n("div", { className: ke("col-span-12 ", S ? "" : "sm:col-span-8"), children: [
2092
+ /* @__PURE__ */ n("div", { className: xe("col-span-12 ", S ? "" : "sm:col-span-8"), children: [
2091
2093
  /* @__PURE__ */ e(
2092
- fe,
2094
+ be,
2093
2095
  {
2094
2096
  name: "path",
2095
- as: Q,
2097
+ as: G,
2096
2098
  label: "Path",
2097
2099
  validate: w,
2098
2100
  disabled: !t,
@@ -2104,7 +2106,7 @@ function gi({
2104
2106
  ] }),
2105
2107
  !S && /* @__PURE__ */ n("div", { className: "col-span-12 sm:col-span-4 relative", children: [
2106
2108
  /* @__PURE__ */ e(
2107
- je,
2109
+ Ve,
2108
2110
  {
2109
2111
  error: c.group && !!p.group,
2110
2112
  disabled: f,
@@ -2117,12 +2119,12 @@ function gi({
2117
2119
  }
2118
2120
  ),
2119
2121
  /* @__PURE__ */ e(
2120
- _a,
2122
+ wa,
2121
2123
  {
2122
- open: I && (v ?? []).length > 0,
2124
+ open: F && (v ?? []).length > 0,
2123
2125
  setOpen: A,
2124
2126
  children: v?.map((x, C) => /* @__PURE__ */ e(
2125
- ka,
2127
+ _a,
2126
2128
  {
2127
2129
  onClick: () => {
2128
2130
  A(!1), m("group", x ?? null);
@@ -2139,7 +2141,7 @@ function gi({
2139
2141
  xt,
2140
2142
  {
2141
2143
  title: /* @__PURE__ */ n("div", { className: "flex flex-row text-gray-500", children: [
2142
- /* @__PURE__ */ e(Ye, {}),
2144
+ /* @__PURE__ */ e(Ge, {}),
2143
2145
  /* @__PURE__ */ e(
2144
2146
  P,
2145
2147
  {
@@ -2153,7 +2155,7 @@ function gi({
2153
2155
  children: /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-4 p-4", children: [
2154
2156
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
2155
2157
  /* @__PURE__ */ e(
2156
- je,
2158
+ Ve,
2157
2159
  {
2158
2160
  error: c.singularName && !!p.singularName,
2159
2161
  id: "singularName",
@@ -2167,7 +2169,7 @@ function gi({
2167
2169
  ] }),
2168
2170
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
2169
2171
  /* @__PURE__ */ e(
2170
- je,
2172
+ Ve,
2171
2173
  {
2172
2174
  error: c.description && !!p.description,
2173
2175
  id: "description",
@@ -2183,10 +2185,10 @@ function gi({
2183
2185
  ] }),
2184
2186
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
2185
2187
  /* @__PURE__ */ e(
2186
- fe,
2188
+ be,
2187
2189
  {
2188
2190
  name: "alias",
2189
- as: Q,
2191
+ as: G,
2190
2192
  disabled: !t,
2191
2193
  label: "Alias",
2192
2194
  validate: b,
@@ -2196,7 +2198,7 @@ function gi({
2196
2198
  /* @__PURE__ */ e(te, { error: c.alias && !!p.alias, children: c.alias && p.alias ? p.alias : "Use an alias as an ID when you have multiple collections located in the same path" })
2197
2199
  ] }),
2198
2200
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2199
- Fe,
2201
+ je,
2200
2202
  {
2201
2203
  name: "defaultSize",
2202
2204
  label: "Default row size",
@@ -2205,7 +2207,7 @@ function gi({
2205
2207
  value: d.defaultSize ?? "",
2206
2208
  renderValue: (x) => x.toUpperCase(),
2207
2209
  children: ["xs", "s", "m", "l", "xl"].map((x) => /* @__PURE__ */ e(
2208
- ve,
2210
+ we,
2209
2211
  {
2210
2212
  value: x,
2211
2213
  children: x.toUpperCase()
@@ -2216,7 +2218,7 @@ function gi({
2216
2218
  ) }),
2217
2219
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
2218
2220
  /* @__PURE__ */ e(
2219
- Ht,
2221
+ Yt,
2220
2222
  {
2221
2223
  position: "start",
2222
2224
  label: "Collection group",
@@ -2232,14 +2234,14 @@ function gi({
2232
2234
  ] }),
2233
2235
  /* @__PURE__ */ e("div", { style: { height: "52px" } }),
2234
2236
  /* @__PURE__ */ e(
2235
- De,
2237
+ Ie,
2236
2238
  {
2237
2239
  open: k,
2238
2240
  onOpenChange: _,
2239
2241
  maxWidth: "xl",
2240
2242
  fullWidth: !0,
2241
2243
  children: /* @__PURE__ */ e("div", { className: "p-4 overflow-auto min-h-[200px]", children: /* @__PURE__ */ e(
2242
- hi,
2244
+ bi,
2243
2245
  {
2244
2246
  selectedIcon: d.icon,
2245
2247
  onIconSelected: (x) => {
@@ -2251,19 +2253,19 @@ function gi({
2251
2253
  )
2252
2254
  ] }) });
2253
2255
  }
2254
- function _e(t) {
2256
+ function ke(t) {
2255
2257
  return "properties." + t.replaceAll(".", ".properties.");
2256
2258
  }
2257
- function fi(t) {
2259
+ function vi(t) {
2258
2260
  return t ? "properties." + t.replaceAll(".", ".properties.") + ".properties" : "properties";
2259
2261
  }
2260
- function Pe(t) {
2262
+ function Ne(t) {
2261
2263
  return t ? "properties." + t.replaceAll(".", ".properties.") + ".propertiesOrder" : "propertiesOrder";
2262
2264
  }
2263
- function le(t, a) {
2265
+ function ne(t, a) {
2264
2266
  return a ? `${a}.${t}` : t;
2265
2267
  }
2266
- const bi = R.memo(
2268
+ const wi = D.memo(
2267
2269
  function({
2268
2270
  enumValues: a,
2269
2271
  onValuesChanged: r,
@@ -2274,7 +2276,7 @@ const bi = R.memo(
2274
2276
  getData: d
2275
2277
  }) {
2276
2278
  return /* @__PURE__ */ e(
2277
- Nt,
2279
+ Pt,
2278
2280
  {
2279
2281
  initialValues: { enumValues: a },
2280
2282
  validateOnMount: !0,
@@ -2283,12 +2285,12 @@ const bi = R.memo(
2283
2285
  children: ({
2284
2286
  values: m,
2285
2287
  errors: u
2286
- }) => (me(() => {
2288
+ }) => (de(() => {
2287
2289
  r && r(m.enumValues);
2288
- }, [m.enumValues]), me(() => {
2290
+ }, [m.enumValues]), de(() => {
2289
2291
  i && i(!!(u?.enumValues ?? !1));
2290
2292
  }, [u]), /* @__PURE__ */ e(
2291
- yi,
2293
+ _i,
2292
2294
  {
2293
2295
  enumValuesPath: "enumValues",
2294
2296
  values: m,
@@ -2306,7 +2308,7 @@ const bi = R.memo(
2306
2308
  return a.enumValues.length === r.enumValues.length && a.onValuesChanged === r.onValuesChanged && a.getData === r.getData;
2307
2309
  }
2308
2310
  );
2309
- function yi({
2311
+ function _i({
2310
2312
  values: t,
2311
2313
  errors: a,
2312
2314
  disabled: r,
@@ -2317,10 +2319,10 @@ function yi({
2317
2319
  }) {
2318
2320
  const {
2319
2321
  setFieldValue: d
2320
- } = L(), [m, u] = R.useState(), [c, p] = R.useState(), [g, f] = R.useState(!1), k = R.useRef(/* @__PURE__ */ new Set()).current, _ = (h, w) => {
2322
+ } = K(), [m, u] = D.useState(), [c, p] = D.useState(), [g, f] = D.useState(!1), k = D.useRef(/* @__PURE__ */ new Set()).current, _ = (h, w) => {
2321
2323
  const b = m === w;
2322
2324
  return /* @__PURE__ */ e(
2323
- vi,
2325
+ ki,
2324
2326
  {
2325
2327
  index: h,
2326
2328
  disabled: r,
@@ -2335,7 +2337,7 @@ function yi({
2335
2337
  };
2336
2338
  return /* @__PURE__ */ n("div", { className: "col-span-12", children: [
2337
2339
  /* @__PURE__ */ n("div", { className: "ml-3.5 flex flex-row items-center", children: [
2338
- /* @__PURE__ */ e(Ca, {}),
2340
+ /* @__PURE__ */ e(xa, {}),
2339
2341
  /* @__PURE__ */ e(
2340
2342
  P,
2341
2343
  {
@@ -2355,24 +2357,24 @@ function yi({
2355
2357
  l && (f(!0), l?.().then((h) => {
2356
2358
  if (!h)
2357
2359
  return;
2358
- const w = h.flat(), b = Array.from(new Set(w)), v = t.enumValues, I = Wa(b).filter((A) => !v?.some((S) => S.id === A.id));
2359
- I.forEach((A) => {
2360
+ const w = h.flat(), b = Array.from(new Set(w)), v = t.enumValues, F = ti(b).filter((A) => !v?.some((S) => S.id === A.id));
2361
+ F.forEach((A) => {
2360
2362
  k.add(A.id);
2361
- }), d(i, [...I, ...v]);
2363
+ }), d(i, [...F, ...v]);
2362
2364
  }).catch((h) => {
2363
2365
  console.error(h);
2364
2366
  }).finally(() => f(!1)));
2365
2367
  },
2366
2368
  children: [
2367
- g ? /* @__PURE__ */ e(He, { size: "small" }) : /* @__PURE__ */ e(mt, {}),
2369
+ g ? /* @__PURE__ */ e(Je, { size: "small" }) : /* @__PURE__ */ e(ht, {}),
2368
2370
  "Infer values from data"
2369
2371
  ]
2370
2372
  }
2371
2373
  )
2372
2374
  ] }),
2373
- /* @__PURE__ */ n(Ne, { className: "p-4 m-1", children: [
2375
+ /* @__PURE__ */ n(Se, { className: "p-4 m-1", children: [
2374
2376
  /* @__PURE__ */ e(
2375
- Oa,
2377
+ Ca,
2376
2378
  {
2377
2379
  value: t.enumValues,
2378
2380
  addLabel: "Add enum value",
@@ -2386,7 +2388,7 @@ function yi({
2386
2388
  }
2387
2389
  ),
2388
2390
  /* @__PURE__ */ e(
2389
- wi,
2391
+ xi,
2390
2392
  {
2391
2393
  index: c,
2392
2394
  open: c !== void 0,
@@ -2397,7 +2399,7 @@ function yi({
2397
2399
  ] })
2398
2400
  ] });
2399
2401
  }
2400
- const vi = R.memo(
2402
+ const ki = D.memo(
2401
2403
  function({
2402
2404
  index: a,
2403
2405
  shouldUpdateId: r,
@@ -2413,34 +2415,34 @@ const vi = R.memo(
2413
2415
  errors: c,
2414
2416
  setFieldValue: p,
2415
2417
  touched: g
2416
- } = L(), f = R.useRef(!N(m, `${i}[${a}].id`)), y = r || f.current, k = N(m, `${i}[${a}].id`), _ = N(m, `${i}[${a}].label`), O = N(c, `${i}[${a}].label`), h = R.useRef(_);
2417
- return R.useEffect(() => {
2418
+ } = K(), f = D.useRef(!N(m, `${i}[${a}].id`)), y = r || f.current, k = N(m, `${i}[${a}].id`), _ = N(m, `${i}[${a}].label`), O = N(c, `${i}[${a}].label`), h = D.useRef(_);
2419
+ return D.useEffect(() => {
2418
2420
  (h.current === k || !k) && y && p(`${i}[${a}].id`, _), h.current = _;
2419
2421
  }, [_]), /* @__PURE__ */ n("div", { className: "flex w-full align-center justify-center", children: [
2420
2422
  /* @__PURE__ */ e(
2421
- de,
2423
+ le,
2422
2424
  {
2423
2425
  name: `${i}[${a}].label`,
2424
- as: Q,
2426
+ as: G,
2425
2427
  className: "flex-grow",
2426
2428
  required: !0,
2427
2429
  disabled: l,
2428
2430
  size: "small",
2429
- validate: _i,
2431
+ validate: Ci,
2430
2432
  autoFocus: s,
2431
2433
  autoComplete: "off",
2432
- endAdornment: d && /* @__PURE__ */ e(mt, { size: "small" }),
2434
+ endAdornment: d && /* @__PURE__ */ e(ht, { size: "small" }),
2433
2435
  error: !!O
2434
2436
  }
2435
2437
  ),
2436
2438
  !l && /* @__PURE__ */ e(
2437
- ue,
2439
+ re,
2438
2440
  {
2439
2441
  size: "small",
2440
2442
  "aria-label": "edit",
2441
2443
  className: "m-1",
2442
2444
  onClick: () => o(),
2443
- children: /* @__PURE__ */ e(Ye, { size: "small" })
2445
+ children: /* @__PURE__ */ e(Ge, { size: "small" })
2444
2446
  }
2445
2447
  )
2446
2448
  ] });
@@ -2449,7 +2451,7 @@ const vi = R.memo(
2449
2451
  return a.index === r.index && a.enumValuesPath === r.enumValuesPath && a.shouldUpdateId === r.shouldUpdateId && a.inferredEntry === r.inferredEntry && a.autoFocus === r.autoFocus;
2450
2452
  }
2451
2453
  );
2452
- function wi({
2454
+ function xi({
2453
2455
  index: t,
2454
2456
  open: a,
2455
2457
  onClose: r,
@@ -2461,23 +2463,23 @@ function wi({
2461
2463
  errors: l,
2462
2464
  setFieldValue: d,
2463
2465
  touched: m
2464
- } = L(), u = t !== void 0 ? N(l, `${i}[${t}].id`) : void 0;
2466
+ } = K(), u = t !== void 0 ? N(l, `${i}[${t}].id`) : void 0;
2465
2467
  return /* @__PURE__ */ n(
2466
- De,
2468
+ Ie,
2467
2469
  {
2468
2470
  maxWidth: "md",
2469
2471
  "aria-labelledby": "enum-edit-dialog",
2470
2472
  open: a,
2471
2473
  onOpenChange: (c) => c ? void 0 : r(),
2472
2474
  children: [
2473
- /* @__PURE__ */ e(Ge, { children: t !== void 0 && /* @__PURE__ */ n("div", { children: [
2475
+ /* @__PURE__ */ e(De, { children: t !== void 0 && /* @__PURE__ */ n("div", { children: [
2474
2476
  /* @__PURE__ */ e(
2475
- de,
2477
+ le,
2476
2478
  {
2477
2479
  name: `${i}[${t}]id`,
2478
- as: Q,
2480
+ as: G,
2479
2481
  required: !0,
2480
- validate: ki,
2482
+ validate: Oi,
2481
2483
  label: "ID",
2482
2484
  size: "small",
2483
2485
  autoComplete: "off",
@@ -2486,7 +2488,7 @@ function wi({
2486
2488
  ),
2487
2489
  /* @__PURE__ */ e(te, { error: !!u, children: u ?? "Value saved in the data source" })
2488
2490
  ] }) }),
2489
- /* @__PURE__ */ e(Qe, { children: /* @__PURE__ */ e(
2491
+ /* @__PURE__ */ e(Re, { children: /* @__PURE__ */ e(
2490
2492
  E,
2491
2493
  {
2492
2494
  autoFocus: !0,
@@ -2500,41 +2502,41 @@ function wi({
2500
2502
  }
2501
2503
  );
2502
2504
  }
2503
- function _i(t) {
2505
+ function Ci(t) {
2504
2506
  let a;
2505
2507
  return t || (a = "You must specify a label"), a;
2506
2508
  }
2507
- function ki(t) {
2509
+ function Oi(t) {
2508
2510
  let a;
2509
2511
  return t || (a = "You must specify an ID"), a;
2510
2512
  }
2511
2513
  function Ee({ disabled: t }) {
2512
- const { values: a, handleChange: r } = L(), i = "validation.required", s = "validation.requiredMessage";
2514
+ const { values: a, handleChange: r } = K(), i = "validation.required", s = "validation.requiredMessage";
2513
2515
  return /* @__PURE__ */ n(B, { children: [
2514
2516
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
2515
- de,
2517
+ le,
2516
2518
  {
2517
2519
  type: "checkbox",
2518
2520
  disabled: t,
2519
2521
  name: i,
2520
2522
  label: "Required",
2521
2523
  tooltip: "You won't be able to save this entity if this value is not set",
2522
- component: he
2524
+ component: ue
2523
2525
  }
2524
2526
  ) }),
2525
2527
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
2526
- de,
2528
+ le,
2527
2529
  {
2528
2530
  type: "checkbox",
2529
2531
  disabled: t,
2530
2532
  name: "validation.unique",
2531
2533
  label: "Unique",
2532
2534
  tooltip: "There cannot be multiple entities with the same value",
2533
- component: he
2535
+ component: ue
2534
2536
  }
2535
2537
  ) }),
2536
2538
  N(a, i) && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2537
- Q,
2539
+ G,
2538
2540
  {
2539
2541
  disabled: t,
2540
2542
  value: N(a, s),
@@ -2561,44 +2563,44 @@ function Me({
2561
2563
  values: u,
2562
2564
  handleChange: c,
2563
2565
  errors: p
2564
- } = L(), g = "validation.length", f = "validation.min", y = "validation.max", k = "validation.trim", _ = "validation.matches", O = "validation.lowercase", h = "validation.uppercase", w = N(p, _), b = N(u, _), v = typeof b == "string" ? b : Pa(b);
2566
+ } = K(), g = "validation.length", f = "validation.min", y = "validation.max", k = "validation.trim", _ = "validation.matches", O = "validation.lowercase", h = "validation.uppercase", w = N(p, _), b = N(u, _), v = typeof b == "string" ? b : Oa(b);
2565
2567
  return /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
2566
2568
  /* @__PURE__ */ e(Ee, { disabled: d }),
2567
2569
  /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
2568
2570
  a && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2569
- de,
2571
+ le,
2570
2572
  {
2571
2573
  type: "checkbox",
2572
2574
  name: O,
2573
2575
  label: "Lowercase",
2574
2576
  disabled: d,
2575
- component: he
2577
+ component: ue
2576
2578
  }
2577
2579
  ) }),
2578
2580
  l && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2579
- de,
2581
+ le,
2580
2582
  {
2581
2583
  type: "checkbox",
2582
2584
  name: h,
2583
2585
  label: "Uppercase",
2584
2586
  disabled: d,
2585
- component: he
2587
+ component: ue
2586
2588
  }
2587
2589
  ) }),
2588
2590
  o && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2589
- de,
2591
+ le,
2590
2592
  {
2591
2593
  type: "checkbox",
2592
2594
  name: k,
2593
2595
  label: "Trim",
2594
2596
  disabled: d,
2595
- component: he
2597
+ component: ue
2596
2598
  }
2597
2599
  ) })
2598
2600
  ] }),
2599
2601
  /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2 col-span-12", children: [
2600
2602
  t && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2601
- Q,
2603
+ G,
2602
2604
  {
2603
2605
  value: N(u, g),
2604
2606
  label: "Exact length",
@@ -2610,7 +2612,7 @@ function Me({
2610
2612
  }
2611
2613
  ) }),
2612
2614
  s && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2613
- Q,
2615
+ G,
2614
2616
  {
2615
2617
  value: N(u, f),
2616
2618
  label: "Min length",
@@ -2622,7 +2624,7 @@ function Me({
2622
2624
  }
2623
2625
  ) }),
2624
2626
  i && /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
2625
- Q,
2627
+ G,
2626
2628
  {
2627
2629
  value: N(u, y),
2628
2630
  label: "Max length",
@@ -2636,11 +2638,11 @@ function Me({
2636
2638
  ] }),
2637
2639
  r && /* @__PURE__ */ n("div", { className: "col-span-12", children: [
2638
2640
  /* @__PURE__ */ e(
2639
- de,
2641
+ le,
2640
2642
  {
2641
2643
  name: _,
2642
- as: Q,
2643
- validate: (T) => T && !Na(T),
2644
+ as: G,
2645
+ validate: (T) => T && !Pa(T),
2644
2646
  label: "Matches regex",
2645
2647
  size: "small",
2646
2648
  disabled: d,
@@ -2652,7 +2654,7 @@ function Me({
2652
2654
  ] })
2653
2655
  ] });
2654
2656
  }
2655
- function qt({
2657
+ function St({
2656
2658
  max: t = !0,
2657
2659
  min: a = !0,
2658
2660
  disabled: r
@@ -2660,11 +2662,11 @@ function qt({
2660
2662
  const {
2661
2663
  values: i,
2662
2664
  handleChange: s
2663
- } = L(), o = "validation.min", l = "validation.max";
2665
+ } = K(), o = "validation.min", l = "validation.max";
2664
2666
  return /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
2665
2667
  /* @__PURE__ */ e(Ee, { disabled: r }),
2666
2668
  a && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
2667
- Q,
2669
+ G,
2668
2670
  {
2669
2671
  value: N(i, o),
2670
2672
  disabled: r,
@@ -2676,7 +2678,7 @@ function qt({
2676
2678
  }
2677
2679
  ) }),
2678
2680
  t && /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
2679
- Q,
2681
+ G,
2680
2682
  {
2681
2683
  value: N(i, l),
2682
2684
  disabled: r,
@@ -2699,7 +2701,7 @@ function ze({
2699
2701
  asField: !0,
2700
2702
  className: "p-4",
2701
2703
  title: /* @__PURE__ */ n("div", { className: "flex flex-row text-gray-500", children: [
2702
- /* @__PURE__ */ e(Sa, {}),
2704
+ /* @__PURE__ */ e(Na, {}),
2703
2705
  /* @__PURE__ */ e(
2704
2706
  P,
2705
2707
  {
@@ -2713,7 +2715,7 @@ function ze({
2713
2715
  }
2714
2716
  );
2715
2717
  }
2716
- function Et({
2718
+ function It({
2717
2719
  multiselect: t,
2718
2720
  updateIds: a,
2719
2721
  disabled: r,
@@ -2728,10 +2730,10 @@ function Et({
2728
2730
  touched: u,
2729
2731
  setFieldError: c,
2730
2732
  setFieldValue: p
2731
- } = L(), g = Ze(), f = t ? "of.enumValues" : "enumValues", y = N(l, "defaultValue"), k = N(l, f), _ = Lt(() => !k || typeof k == "boolean" ? [] : qa(k) ?? [], [k]);
2733
+ } = K(), g = Qe(), f = t ? "of.enumValues" : "enumValues", y = N(l, "defaultValue"), k = N(l, f), _ = $t(() => !k || typeof k == "boolean" ? [] : Sa(k) ?? [], [k]);
2732
2734
  return /* @__PURE__ */ n(B, { children: [
2733
2735
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2734
- bi,
2736
+ wi,
2735
2737
  {
2736
2738
  enumValues: _,
2737
2739
  updateIds: a,
@@ -2760,10 +2762,10 @@ function Et({
2760
2762
  showErrors: i
2761
2763
  }
2762
2764
  ),
2763
- t && /* @__PURE__ */ e(qt, { disabled: r })
2765
+ t && /* @__PURE__ */ e(St, { disabled: r })
2764
2766
  ] }) }),
2765
2767
  !t && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2766
- Fe,
2768
+ je,
2767
2769
  {
2768
2770
  disabled: r,
2769
2771
  position: "item-aligned",
@@ -2773,7 +2775,7 @@ function Et({
2773
2775
  label: "Default value",
2774
2776
  value: y ?? "",
2775
2777
  children: _.filter((h) => !!h?.id).map((h) => /* @__PURE__ */ e(
2776
- ve,
2778
+ we,
2777
2779
  {
2778
2780
  value: h.id?.toString(),
2779
2781
  children: h.label
@@ -2784,14 +2786,14 @@ function Et({
2784
2786
  ) })
2785
2787
  ] });
2786
2788
  }
2787
- const it = {
2789
+ const ot = {
2788
2790
  "image/*": "Images",
2789
2791
  "video/*": "Videos",
2790
2792
  "audio/*": "Audio files",
2791
2793
  "application/*": "Files (pdf, zip, csv, excel...)",
2792
2794
  "text/*": "Text files"
2793
2795
  };
2794
- function Bt({
2796
+ function Et({
2795
2797
  multiple: t,
2796
2798
  existing: a,
2797
2799
  disabled: r
@@ -2799,15 +2801,15 @@ function Bt({
2799
2801
  const {
2800
2802
  values: i,
2801
2803
  setFieldValue: s
2802
- } = L(), o = t ? "of.storage" : "storage", l = `${o}.acceptedFiles`, d = `${o}.fileName`, m = `${o}.storagePath`, u = `${o}.storeUrl`, c = N(i, d) ?? "{rand}_{file}", p = N(i, m) ?? "/", g = N(i, l), f = Array.isArray(g) ? g : void 0, y = !f || f.length === 0, k = (h) => {
2803
- h ? h.includes("all") || h.length >= Object.keys(it).length ? s(l, void 0) : y ? s(l, Object.keys(it).filter((w) => !h.includes(w))) : s(l, h) : s(l, void 0);
2804
+ } = K(), o = t ? "of.storage" : "storage", l = `${o}.acceptedFiles`, d = `${o}.fileName`, m = `${o}.storagePath`, u = `${o}.storeUrl`, c = N(i, d) ?? "{rand}_{file}", p = N(i, m) ?? "/", g = N(i, l), f = Array.isArray(g) ? g : void 0, y = !f || f.length === 0, k = (h) => {
2805
+ h ? h.includes("all") || h.length >= Object.keys(ot).length ? s(l, void 0) : y ? s(l, Object.keys(ot).filter((w) => !h.includes(w))) : s(l, h) : s(l, void 0);
2804
2806
  }, _ = typeof c == "function", O = typeof p == "function";
2805
2807
  return /* @__PURE__ */ n(B, { children: [
2806
2808
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2807
2809
  xt,
2808
2810
  {
2809
2811
  title: /* @__PURE__ */ n("div", { className: "flex flex-row text-gray-500", children: [
2810
- /* @__PURE__ */ e(Aa, {}),
2812
+ /* @__PURE__ */ e(qa, {}),
2811
2813
  /* @__PURE__ */ e(
2812
2814
  P,
2813
2815
  {
@@ -2819,27 +2821,27 @@ function Bt({
2819
2821
  ] }),
2820
2822
  children: /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2 p-4", children: [
2821
2823
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ n(
2822
- za,
2824
+ Aa,
2823
2825
  {
2824
2826
  disabled: r,
2825
2827
  name: l,
2826
2828
  value: f ?? [],
2827
2829
  onMultiValueChange: k,
2828
2830
  label: y ? void 0 : "Allowed file types",
2829
- renderValues: (h) => !h || h.length === 0 ? "All file types allowed" : h.map((w) => it[w]).filter((w) => !!w).join(", "),
2831
+ renderValues: (h) => !h || h.length === 0 ? "All file types allowed" : h.map((w) => ot[w]).filter((w) => !!w).join(", "),
2830
2832
  children: [
2831
- /* @__PURE__ */ n(At, { value: "all", className: "flex items-center gap-2", children: [
2833
+ /* @__PURE__ */ n(qt, { value: "all", className: "flex items-center gap-2", children: [
2832
2834
  /* @__PURE__ */ e(
2833
- zt,
2835
+ At,
2834
2836
  {
2835
2837
  checked: !f
2836
2838
  }
2837
2839
  ),
2838
2840
  "All"
2839
2841
  ] }, "all"),
2840
- Object.entries(it).map(([h, w]) => /* @__PURE__ */ n(At, { value: h, className: "flex items-center gap-2", children: [
2842
+ Object.entries(ot).map(([h, w]) => /* @__PURE__ */ n(qt, { value: h, className: "flex items-center gap-2", children: [
2841
2843
  /* @__PURE__ */ e(
2842
- zt,
2844
+ At,
2843
2845
  {
2844
2846
  checked: y || f.indexOf(h) > -1
2845
2847
  }
@@ -2859,10 +2861,10 @@ function Bt({
2859
2861
  }
2860
2862
  ) }),
2861
2863
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
2862
- fe,
2864
+ be,
2863
2865
  {
2864
2866
  name: d,
2865
- as: Q,
2867
+ as: G,
2866
2868
  label: "File name",
2867
2869
  size: "small",
2868
2870
  disabled: _ || r,
@@ -2871,10 +2873,10 @@ function Bt({
2871
2873
  ) }),
2872
2874
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
2873
2875
  /* @__PURE__ */ e(
2874
- fe,
2876
+ be,
2875
2877
  {
2876
2878
  name: m,
2877
- as: Q,
2879
+ as: G,
2878
2880
  label: "Storage path",
2879
2881
  disabled: O || r,
2880
2882
  size: "small",
@@ -2894,13 +2896,13 @@ function Bt({
2894
2896
  ] })
2895
2897
  ] }),
2896
2898
  /* @__PURE__ */ e(
2897
- fe,
2899
+ be,
2898
2900
  {
2899
2901
  type: "checkbox",
2900
2902
  name: u,
2901
2903
  label: "Save URL instead of storage path",
2902
2904
  disabled: a || r,
2903
- component: he
2905
+ component: ue
2904
2906
  }
2905
2907
  ),
2906
2908
  /* @__PURE__ */ e("br", {}),
@@ -2911,31 +2913,31 @@ function Bt({
2911
2913
  ) }),
2912
2914
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ n(ze, { children: [
2913
2915
  !t && /* @__PURE__ */ e("div", { className: "grid grid-cols-12 gap-2", children: /* @__PURE__ */ e(Ee, { disabled: r }) }),
2914
- t && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(qt, { disabled: r }) })
2916
+ t && /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(St, { disabled: r }) })
2915
2917
  ] }) })
2916
2918
  ] });
2917
2919
  }
2918
- function Ke(t) {
2919
- if (ce(t) || ce(t))
2920
+ function He(t) {
2921
+ if (se(t) || se(t))
2920
2922
  return !1;
2921
2923
  {
2922
2924
  const a = t;
2923
2925
  return a.dataType === "array" && typeof a.of == "function" || a.dataType === "array" && Array.isArray(a.of) ? !1 : !!a.editable;
2924
2926
  }
2925
2927
  }
2926
- function xi(t) {
2927
- return Object.entries(t).filter(([a, r]) => Ke(r)).map(([a, r]) => {
2928
+ function Pi(t) {
2929
+ return Object.entries(t).filter(([a, r]) => He(r)).map(([a, r]) => {
2928
2930
  const i = r;
2929
- if (Ke(i))
2931
+ if (He(i))
2930
2932
  return i.dataType === "map" && i.properties ? {
2931
2933
  [a]: {
2932
2934
  ...i,
2933
- properties: xi(i.properties)
2935
+ properties: Pi(i.properties)
2934
2936
  }
2935
2937
  } : { [a]: i };
2936
2938
  }).filter((a) => !!a).reduce((a, r) => ({ ...a, ...r }), {});
2937
2939
  }
2938
- function na({
2940
+ function oa({
2939
2941
  property: t,
2940
2942
  onClick: a,
2941
2943
  hasError: r,
@@ -2943,28 +2945,28 @@ function na({
2943
2945
  includeEditButton: s,
2944
2946
  selected: o
2945
2947
  }) {
2946
- const { fields: l } = Ae(), d = Je(t, l), m = !Ke(t);
2947
- return /* @__PURE__ */ e(Oe, { children: /* @__PURE__ */ n(
2948
+ const { fields: l } = Ae(), d = We(t, l), m = !He(t);
2949
+ return /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ n(
2948
2950
  "div",
2949
2951
  {
2950
2952
  onClick: a,
2951
2953
  className: "flex flex-row w-full cursor-pointer",
2952
2954
  children: [
2953
- /* @__PURE__ */ e("div", { className: "m-4", children: /* @__PURE__ */ e(We, { propertyConfig: d }) }),
2955
+ /* @__PURE__ */ e("div", { className: "m-4", children: /* @__PURE__ */ e(Ze, { propertyConfig: d }) }),
2954
2956
  /* @__PURE__ */ n(
2955
- Ne,
2957
+ Se,
2956
2958
  {
2957
- className: ke(
2959
+ className: xe(
2958
2960
  "pl-2 w-full flex flex-row gap-4 items-center",
2959
- Qt,
2960
- a ? Zt : "",
2961
- o ? Jt : "",
2961
+ Gt,
2962
+ a ? Jt : "",
2963
+ o ? Qt : "",
2962
2964
  "flex-grow p-4 border transition-colors duration-200",
2963
2965
  r ? "border-red-500" : o ? "border-blue-500" : "border-transparent"
2964
2966
  ),
2965
2967
  children: [
2966
2968
  /* @__PURE__ */ n("div", { className: "w-full flex flex-col", children: [
2967
- i && /* @__PURE__ */ e(Oe, { children: /* @__PURE__ */ e(
2969
+ i && /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
2968
2970
  P,
2969
2971
  {
2970
2972
  variant: "body1",
@@ -2974,7 +2976,7 @@ function na({
2974
2976
  }
2975
2977
  ) }),
2976
2978
  /* @__PURE__ */ n("div", { className: "flex flex-row items-center", children: [
2977
- /* @__PURE__ */ e(Oe, { children: /* @__PURE__ */ e(
2979
+ /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
2978
2980
  P,
2979
2981
  {
2980
2982
  className: "flex-grow pr-2",
@@ -2984,7 +2986,7 @@ function na({
2984
2986
  children: d?.name
2985
2987
  }
2986
2988
  ) }),
2987
- /* @__PURE__ */ e(Oe, { children: /* @__PURE__ */ e(
2989
+ /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
2988
2990
  P,
2989
2991
  {
2990
2992
  variant: "body2",
@@ -3010,13 +3012,13 @@ function na({
3010
3012
  }
3011
3013
  ) });
3012
3014
  }
3013
- function Ci({
3015
+ function Ni({
3014
3016
  name: t,
3015
3017
  selected: a,
3016
3018
  onClick: r,
3017
3019
  property: i
3018
3020
  }) {
3019
- const { fields: s } = Ae(), o = !ce(i) && i ? Je(i, s) : void 0;
3021
+ const { fields: s } = Ae(), o = !se(i) && i ? We(i, s) : void 0;
3020
3022
  return /* @__PURE__ */ n(
3021
3023
  "div",
3022
3024
  {
@@ -3024,24 +3026,24 @@ function Ci({
3024
3026
  className: "flex flex-row w-full cursor-pointer",
3025
3027
  children: [
3026
3028
  /* @__PURE__ */ n("div", { className: "relative m-4", children: [
3027
- o && /* @__PURE__ */ e(We, { propertyConfig: o }),
3029
+ o && /* @__PURE__ */ e(Ze, { propertyConfig: o }),
3028
3030
  !o && /* @__PURE__ */ e(
3029
3031
  "div",
3030
3032
  {
3031
3033
  className: "h-8 w-8 p-1 rounded-full shadow text-white bg-gray-500",
3032
- children: /* @__PURE__ */ e(Ta, { color: "inherit", size: "medium" })
3034
+ children: /* @__PURE__ */ e(za, { color: "inherit", size: "medium" })
3033
3035
  }
3034
3036
  ),
3035
3037
  /* @__PURE__ */ e(Wt, { color: "disabled", size: "small", className: "absolute -right-2 -top-2" })
3036
3038
  ] }),
3037
3039
  /* @__PURE__ */ e(
3038
- Ne,
3040
+ Se,
3039
3041
  {
3040
- className: ke(
3042
+ className: xe(
3041
3043
  "pl-2 w-full flex flex-row gap-4 items-center",
3042
- Qt,
3043
- r ? Zt : "",
3044
- a ? Jt : "",
3044
+ Gt,
3045
+ r ? Jt : "",
3046
+ a ? Qt : "",
3045
3047
  "flex-grow p-4 border transition-colors duration-200",
3046
3048
  a ? "border-blue-500" : "border-transparent"
3047
3049
  ),
@@ -3066,7 +3068,7 @@ function Ci({
3066
3068
  children: o?.name
3067
3069
  }
3068
3070
  ),
3069
- i && !ce(i) && /* @__PURE__ */ e(Oe, { children: /* @__PURE__ */ e(
3071
+ i && !se(i) && /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
3070
3072
  P,
3071
3073
  {
3072
3074
  variant: "body2",
@@ -3075,7 +3077,7 @@ function Ci({
3075
3077
  children: i.dataType
3076
3078
  }
3077
3079
  ) }),
3078
- i && ce(i) && /* @__PURE__ */ e(Oe, { children: /* @__PURE__ */ e(
3080
+ i && se(i) && /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
3079
3081
  P,
3080
3082
  {
3081
3083
  variant: "body2",
@@ -3084,7 +3086,7 @@ function Ci({
3084
3086
  children: "This property is defined as a property builder in code"
3085
3087
  }
3086
3088
  ) }),
3087
- !i && /* @__PURE__ */ e(Oe, { children: /* @__PURE__ */ e(
3089
+ !i && /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
3088
3090
  P,
3089
3091
  {
3090
3092
  variant: "body2",
@@ -3101,7 +3103,7 @@ function Ci({
3101
3103
  }
3102
3104
  );
3103
3105
  }
3104
- function ut({
3106
+ function gt({
3105
3107
  namespace: t,
3106
3108
  selectedPropertyKey: a,
3107
3109
  onPropertyClick: r,
@@ -3115,13 +3117,13 @@ function ut({
3115
3117
  inferredPropertyKeys: c,
3116
3118
  collectionEditable: p
3117
3119
  }) {
3118
- const g = s ?? Object.keys(i), f = Z((y) => {
3120
+ const g = s ?? Object.keys(i), f = J((y) => {
3119
3121
  if (!y.destination)
3120
3122
  return;
3121
3123
  const k = y.source.index, _ = y.destination.index, O = Array.from(g), [h] = O.splice(k, 1);
3122
3124
  O.splice(_, 0, h), d && d(O, t);
3123
3125
  }, [t, d, g]);
3124
- return /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(ti, { onDragEnd: f, children: /* @__PURE__ */ e(ai, { droppableId: `droppable_${t}`, children: (y, k) => /* @__PURE__ */ n(
3126
+ return /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(ri, { onDragEnd: f, children: /* @__PURE__ */ e(oi, { droppableId: `droppable_${t}`, children: (y, k) => /* @__PURE__ */ n(
3125
3127
  "div",
3126
3128
  {
3127
3129
  ...y.droppableProps,
@@ -3131,12 +3133,12 @@ function ut({
3131
3133
  g && g.map((_, O) => {
3132
3134
  const h = i[_], w = o?.find((b) => b.id === _);
3133
3135
  return !h && !w ? (console.warn(`Property ${_} not found in properties or additionalFields`), null) : /* @__PURE__ */ e(
3134
- ii,
3136
+ ni,
3135
3137
  {
3136
3138
  draggableId: `array_field_${t}_${_}}`,
3137
3139
  index: O,
3138
- children: (b, v) => /* @__PURE__ */ e(Oe, { children: /* @__PURE__ */ e(
3139
- Oi,
3140
+ children: (b, v) => /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
3141
+ Si,
3140
3142
  {
3141
3143
  propertyKey: _,
3142
3144
  propertyOrBuilder: h,
@@ -3161,7 +3163,7 @@ function ut({
3161
3163
  }
3162
3164
  ) }) }) });
3163
3165
  }
3164
- function Oi({
3166
+ function Si({
3165
3167
  propertyKey: t,
3166
3168
  namespace: a,
3167
3169
  propertyOrBuilder: r,
@@ -3175,12 +3177,12 @@ function Oi({
3175
3177
  inferredPropertyKeys: c,
3176
3178
  collectionEditable: p
3177
3179
  }) {
3178
- const g = c?.includes(a ? `${a}.${t}` : t), f = le(t, a);
3180
+ const g = c?.includes(a ? `${a}.${t}` : t), f = ne(t, a);
3179
3181
  let y;
3180
3182
  if (typeof r == "object") {
3181
3183
  const h = r;
3182
3184
  h.dataType === "map" && h.properties && (y = /* @__PURE__ */ e(
3183
- ut,
3185
+ gt,
3184
3186
  {
3185
3187
  selectedPropertyKey: o,
3186
3188
  namespace: f,
@@ -3194,7 +3196,7 @@ function Oi({
3194
3196
  }
3195
3197
  ));
3196
3198
  }
3197
- const k = f ? N(l, _e(f)) : !1, _ = o === f, O = r && (p && !ce(r) || Ke(r));
3199
+ const k = f ? N(l, ke(f)) : !1, _ = o === f, O = r && (p && !se(r) || He(r));
3198
3200
  return /* @__PURE__ */ n(
3199
3201
  "div",
3200
3202
  {
@@ -3214,8 +3216,8 @@ function Oi({
3214
3216
  }
3215
3217
  }
3216
3218
  ),
3217
- !ce(r) && !i && O ? /* @__PURE__ */ e(
3218
- na,
3219
+ !se(r) && !i && O ? /* @__PURE__ */ e(
3220
+ oa,
3219
3221
  {
3220
3222
  property: r,
3221
3223
  onClick: d ? () => d(t, a) : void 0,
@@ -3224,7 +3226,7 @@ function Oi({
3224
3226
  hasError: k
3225
3227
  }
3226
3228
  ) : /* @__PURE__ */ e(
3227
- Ci,
3229
+ Ni,
3228
3230
  {
3229
3231
  name: t,
3230
3232
  property: r,
@@ -3233,22 +3235,22 @@ function Oi({
3233
3235
  }
3234
3236
  ),
3235
3237
  /* @__PURE__ */ n("div", { className: "absolute top-2 right-2 flex flex-row ", children: [
3236
- g && /* @__PURE__ */ e(ie, { title: "Inferred property", children: /* @__PURE__ */ e(mt, { size: "small", className: "p-2" }) }),
3237
- u && /* @__PURE__ */ e(ie, { title: "Remove", children: /* @__PURE__ */ e(
3238
- ue,
3238
+ g && /* @__PURE__ */ e(ae, { title: "Inferred property", children: /* @__PURE__ */ e(ht, { size: "small", className: "p-2" }) }),
3239
+ u && /* @__PURE__ */ e(ae, { title: "Remove", children: /* @__PURE__ */ e(
3240
+ re,
3239
3241
  {
3240
3242
  size: "small",
3241
3243
  color: "inherit",
3242
3244
  onClick: () => u(t, a),
3243
- children: /* @__PURE__ */ e(Va, { size: "small" })
3245
+ children: /* @__PURE__ */ e(Ta, { size: "small" })
3244
3246
  }
3245
3247
  ) }),
3246
- m && /* @__PURE__ */ e(ie, { title: "Move", children: /* @__PURE__ */ e(
3247
- ue,
3248
+ m && /* @__PURE__ */ e(ae, { title: "Move", children: /* @__PURE__ */ e(
3249
+ re,
3248
3250
  {
3249
3251
  component: "span",
3250
3252
  size: "small",
3251
- children: /* @__PURE__ */ e(ja, { size: "small" })
3253
+ children: /* @__PURE__ */ e(Va, { size: "small" })
3252
3254
  }
3253
3255
  ) })
3254
3256
  ] }),
@@ -3257,11 +3259,11 @@ function Oi({
3257
3259
  }
3258
3260
  );
3259
3261
  }
3260
- function Pi({ disabled: t, getData: a, allowDataInference: r, customFields: i, collectionEditable: s }) {
3262
+ function qi({ disabled: t, getData: a, allowDataInference: r, customFields: i, collectionEditable: s }) {
3261
3263
  const {
3262
3264
  values: o,
3263
3265
  setFieldValue: l
3264
- } = L(), [d, m] = H(!1), [u, c] = H(), [p, g] = H(), f = o.propertiesOrder ?? Object.keys(o.properties ?? {}), y = Z(({
3266
+ } = K(), [d, m] = L(!1), [u, c] = L(), [p, g] = L(), f = o.propertiesOrder ?? Object.keys(o.properties ?? {}), y = J(({
3265
3267
  id: v,
3266
3268
  property: T
3267
3269
  }) => {
@@ -3271,26 +3273,26 @@ function Pi({ disabled: t, getData: a, allowDataInference: r, customFields: i, c
3271
3273
  ...o.properties ?? {},
3272
3274
  [v]: T
3273
3275
  }, !1), l("propertiesOrder", [...f, v], !1), m(!1);
3274
- }, [o.properties, f]), k = Z((v, T) => {
3275
- const I = v ? le(v, T) : void 0;
3276
- if (!I)
3276
+ }, [o.properties, f]), k = J((v, T) => {
3277
+ const F = v ? ne(v, T) : void 0;
3278
+ if (!F)
3277
3279
  throw Error("collection editor miss config");
3278
- const A = _e(I), S = Pe(T), x = N(o, S) ?? Object.keys(N(o, fi(T)));
3280
+ const A = ke(F), S = Ne(T), x = N(o, S) ?? Object.keys(N(o, vi(T)));
3279
3281
  l(A, void 0, !1), l(S, x.filter((C) => C !== v), !1), m(!1), c(void 0), g(void 0);
3280
- }, [l, o]), _ = u ? le(u, p) : void 0, O = _ ? N(o.properties, _.replaceAll(".", ".properties.")) : void 0, h = /* @__PURE__ */ n(
3282
+ }, [l, o]), _ = u ? ne(u, p) : void 0, O = _ ? N(o.properties, _.replaceAll(".", ".properties.")) : void 0, h = /* @__PURE__ */ n(
3281
3283
  E,
3282
3284
  {
3283
3285
  color: "primary",
3284
3286
  variant: "outlined",
3285
3287
  onClick: () => m(!0),
3286
- startIcon: /* @__PURE__ */ e(Se, {}),
3288
+ startIcon: /* @__PURE__ */ e(qe, {}),
3287
3289
  children: [
3288
3290
  "Add property to ",
3289
3291
  o.name ?? "this group"
3290
3292
  ]
3291
3293
  }
3292
- ), w = !f || f.length < 1, b = Z((v, T) => {
3293
- l(Pe(T), v, !1);
3294
+ ), w = !f || f.length < 1, b = J((v, T) => {
3295
+ l(Ne(T), v, !1);
3294
3296
  }, []);
3295
3297
  return /* @__PURE__ */ n(B, { children: [
3296
3298
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
@@ -3298,9 +3300,9 @@ function Pi({ disabled: t, getData: a, allowDataInference: r, customFields: i, c
3298
3300
  /* @__PURE__ */ e(P, { variant: "subtitle2", children: "Properties in this group" }),
3299
3301
  h
3300
3302
  ] }),
3301
- /* @__PURE__ */ n(Ne, { className: "p-2 pl-8", children: [
3303
+ /* @__PURE__ */ n(Se, { className: "p-2 pl-8", children: [
3302
3304
  /* @__PURE__ */ e(
3303
- ut,
3305
+ gt,
3304
3306
  {
3305
3307
  properties: o.properties ?? {},
3306
3308
  propertiesOrder: f,
@@ -3324,7 +3326,7 @@ function Pi({ disabled: t, getData: a, allowDataInference: r, customFields: i, c
3324
3326
  ] }),
3325
3327
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
3326
3328
  /* @__PURE__ */ e(
3327
- Ht,
3329
+ Yt,
3328
3330
  {
3329
3331
  position: "start",
3330
3332
  size: "small",
@@ -3336,7 +3338,7 @@ function Pi({ disabled: t, getData: a, allowDataInference: r, customFields: i, c
3336
3338
  /* @__PURE__ */ e(te, { children: "Set this flag to true if you want to display the children of this group as individual columns." })
3337
3339
  ] }),
3338
3340
  /* @__PURE__ */ e(
3339
- Ie,
3341
+ Fe,
3340
3342
  {
3341
3343
  inArray: !1,
3342
3344
  forceShowErrors: !1,
@@ -3364,7 +3366,7 @@ function Pi({ disabled: t, getData: a, allowDataInference: r, customFields: i, c
3364
3366
  )
3365
3367
  ] });
3366
3368
  }
3367
- function Ni({
3369
+ function Ai({
3368
3370
  showErrors: t,
3369
3371
  existing: a,
3370
3372
  disabled: r,
@@ -3379,21 +3381,21 @@ function Ni({
3379
3381
  errors: c,
3380
3382
  setFieldValue: p,
3381
3383
  touched: g
3382
- } = L(), [f, y] = H(!1), k = N(m, "of"), _ = N(g, "of") && N(c, "of"), O = Z(({ id: w, property: b, namespace: v }) => {
3384
+ } = K(), [f, y] = L(!1), k = N(m, "of"), _ = N(g, "of") && N(c, "of"), O = J(({ id: w, property: b, namespace: v }) => {
3383
3385
  p("of", b);
3384
- }, []), h = k && Je(k, d);
3386
+ }, []), h = k && We(k, d);
3385
3387
  return /* @__PURE__ */ n(B, { children: [
3386
3388
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
3387
3389
  /* @__PURE__ */ e(P, { variant: "subtitle2", children: "Repeat component" }),
3388
3390
  /* @__PURE__ */ e(
3389
- fe,
3391
+ be,
3390
3392
  {
3391
3393
  name: "of",
3392
3394
  value: k,
3393
3395
  validate: (w) => w?.dataType ? void 0 : "You need to specify a repeat field",
3394
- children: () => /* @__PURE__ */ n(Ne, { className: "p-2 mt-4", children: [
3396
+ children: () => /* @__PURE__ */ n(Se, { className: "p-2 mt-4", children: [
3395
3397
  k && /* @__PURE__ */ e(
3396
- na,
3398
+ oa,
3397
3399
  {
3398
3400
  property: k,
3399
3401
  onClick: r ? void 0 : () => y(!0),
@@ -3417,7 +3419,7 @@ function Ni({
3417
3419
  }
3418
3420
  ),
3419
3421
  /* @__PURE__ */ e(
3420
- Ie,
3422
+ Fe,
3421
3423
  {
3422
3424
  inArray: !0,
3423
3425
  open: f,
@@ -3439,10 +3441,10 @@ function Ni({
3439
3441
  }
3440
3442
  )
3441
3443
  ] }),
3442
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(qt, { disabled: r }) }) })
3444
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(St, { disabled: r }) }) })
3443
3445
  ] });
3444
3446
  }
3445
- const Si = R.forwardRef(
3447
+ const zi = D.forwardRef(
3446
3448
  function({
3447
3449
  showErrors: a,
3448
3450
  disabledId: r,
@@ -3452,17 +3454,17 @@ const Si = R.forwardRef(
3452
3454
  }, l) {
3453
3455
  const {
3454
3456
  errors: d
3455
- } = L(), m = "name", u = a && N(d, m), c = "id", p = a && N(d, c), g = "description", f = a && N(d, g);
3457
+ } = K(), m = "name", u = a && N(d, m), c = "id", p = a && N(d, c), g = "description", f = a && N(d, g);
3456
3458
  return /* @__PURE__ */ n("div", { className: "flex flex-col gap-2 col-span-12", children: [
3457
3459
  /* @__PURE__ */ n("div", { children: [
3458
3460
  /* @__PURE__ */ e(
3459
- fe,
3461
+ be,
3460
3462
  {
3461
3463
  inputRef: l,
3462
3464
  name: m,
3463
- as: Q,
3465
+ as: G,
3464
3466
  style: { fontSize: 20 },
3465
- validate: zi,
3467
+ validate: ji,
3466
3468
  placeholder: "Field name",
3467
3469
  required: !0,
3468
3470
  disabled: s,
@@ -3473,12 +3475,12 @@ const Si = R.forwardRef(
3473
3475
  ] }),
3474
3476
  /* @__PURE__ */ n("div", { children: [
3475
3477
  /* @__PURE__ */ e(
3476
- fe,
3478
+ be,
3477
3479
  {
3478
3480
  name: c,
3479
- as: je,
3481
+ as: Ve,
3480
3482
  label: "ID",
3481
- validate: (y) => Ai(y, i),
3483
+ validate: (y) => Vi(y, i),
3482
3484
  disabled: r || s,
3483
3485
  required: !0,
3484
3486
  size: "small",
@@ -3489,10 +3491,10 @@ const Si = R.forwardRef(
3489
3491
  ] }),
3490
3492
  /* @__PURE__ */ n("div", { children: [
3491
3493
  /* @__PURE__ */ e(
3492
- fe,
3494
+ be,
3493
3495
  {
3494
3496
  name: g,
3495
- as: Q,
3497
+ as: G,
3496
3498
  label: "Description",
3497
3499
  disabled: s,
3498
3500
  error: !!f
@@ -3502,21 +3504,21 @@ const Si = R.forwardRef(
3502
3504
  ] })
3503
3505
  ] });
3504
3506
  }
3505
- ), qi = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
3506
- function Ai(t, a) {
3507
+ ), Ti = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
3508
+ function Vi(t, a) {
3507
3509
  let r;
3508
- return t || (r = "You must specify an id for the field"), t && !t.match(qi) && (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;
3510
+ return t || (r = "You must specify an id for the field"), t && !t.match(Ti) && (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;
3509
3511
  }
3510
- function zi(t) {
3512
+ function ji(t) {
3511
3513
  let a;
3512
3514
  return t || (a = "You must specify a title for the field"), a;
3513
3515
  }
3514
- function Ti({
3516
+ function Fi({
3515
3517
  widgetId: t,
3516
3518
  disabled: a,
3517
3519
  showErrors: r
3518
3520
  }) {
3519
- const { values: i, setFieldValue: s } = L();
3521
+ const { values: i, setFieldValue: s } = K();
3520
3522
  return /* @__PURE__ */ n(B, { children: [
3521
3523
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ n(ze, { children: [
3522
3524
  t === "text_field" && /* @__PURE__ */ e(
@@ -3581,7 +3583,7 @@ function Ti({
3581
3583
  )
3582
3584
  ] }) }),
3583
3585
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
3584
- je,
3586
+ Ve,
3585
3587
  {
3586
3588
  name: "defaultValue",
3587
3589
  disabled: a,
@@ -3594,28 +3596,28 @@ function Ti({
3594
3596
  ) })
3595
3597
  ] });
3596
3598
  }
3597
- function Vi({ disabled: t }) {
3598
- const { values: a } = L(), r = N(a, "defaultValue");
3599
+ function Ii({ disabled: t }) {
3600
+ const { values: a } = K(), r = N(a, "defaultValue");
3599
3601
  return /* @__PURE__ */ n(B, { children: [
3600
3602
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Ee, { disabled: t }) }) }),
3601
3603
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
3602
- de,
3604
+ le,
3603
3605
  {
3604
3606
  type: "checkbox",
3605
3607
  name: "defaultValue",
3606
3608
  label: r == null ? "Default value not set" : "Default value is " + r.toString(),
3607
3609
  disabled: t,
3608
3610
  allowIndeterminate: !0,
3609
- component: he
3611
+ component: ue
3610
3612
  }
3611
3613
  ) })
3612
3614
  ] });
3613
3615
  }
3614
- function ji({ disabled: t, getData: a, allowDataInference: r, customFields: i, collectionEditable: s }) {
3616
+ function Ei({ disabled: t, getData: a, allowDataInference: r, customFields: i, collectionEditable: s }) {
3615
3617
  const {
3616
3618
  values: o,
3617
3619
  setFieldValue: l
3618
- } = L(), [d, m] = H(!1), [u, c] = H(), [p, g] = H(), f = Z(({
3620
+ } = K(), [d, m] = L(!1), [u, c] = L(), [p, g] = L(), f = J(({
3619
3621
  id: w,
3620
3622
  property: b
3621
3623
  }) => {
@@ -3625,27 +3627,27 @@ function ji({ disabled: t, getData: a, allowDataInference: r, customFields: i, c
3625
3627
  ...o.oneOf?.properties ?? {},
3626
3628
  [w]: b
3627
3629
  }, !1), l("oneOf.propertiesOrder", [...o.oneOf?.propertiesOrder ?? Object.keys(o.oneOf?.properties ?? {}), w], !1), m(!1);
3628
- }, [o.oneOf?.properties, o.oneOf?.propertiesOrder]), y = u ? le(u, p) : void 0, k = y ? N(o.oneOf?.properties, y.replaceAll(".", ".properties.")) : void 0, _ = Z((w, b) => {
3629
- const v = w ? le(w, b) : void 0;
3630
+ }, [o.oneOf?.properties, o.oneOf?.propertiesOrder]), y = u ? ne(u, p) : void 0, k = y ? N(o.oneOf?.properties, y.replaceAll(".", ".properties.")) : void 0, _ = J((w, b) => {
3631
+ const v = w ? ne(w, b) : void 0;
3630
3632
  if (!v)
3631
3633
  throw Error("collection editor miss config");
3632
- l(`oneOf.${_e(v)}`, void 0, !1);
3633
- const T = `oneOf.${Pe(b)}`, I = N(o, T);
3634
- l(T, I.filter((A) => A !== w), !1), m(!1), c(void 0), g(void 0);
3634
+ l(`oneOf.${ke(v)}`, void 0, !1);
3635
+ const T = `oneOf.${Ne(b)}`, F = N(o, T);
3636
+ l(T, F.filter((A) => A !== w), !1), m(!1), c(void 0), g(void 0);
3635
3637
  }, [l, o]), O = /* @__PURE__ */ n(
3636
3638
  E,
3637
3639
  {
3638
3640
  autoFocus: !0,
3639
3641
  color: "primary",
3640
3642
  onClick: () => m(!0),
3641
- startIcon: /* @__PURE__ */ e(Se, {}),
3643
+ startIcon: /* @__PURE__ */ e(qe, {}),
3642
3644
  children: [
3643
3645
  "Add property to ",
3644
3646
  o.name ?? "this block"
3645
3647
  ]
3646
3648
  }
3647
- ), h = Z((w, b) => {
3648
- l(`oneOf.${Pe(b)}`, w, !1);
3649
+ ), h = J((w, b) => {
3650
+ l(`oneOf.${Ne(b)}`, w, !1);
3649
3651
  }, []);
3650
3652
  return /* @__PURE__ */ n(B, { children: [
3651
3653
  /* @__PURE__ */ n("div", { className: "col-span-12", children: [
@@ -3653,9 +3655,9 @@ function ji({ disabled: t, getData: a, allowDataInference: r, customFields: i, c
3653
3655
  /* @__PURE__ */ e(P, { variant: "subtitle2", children: "Properties in this block" }),
3654
3656
  O
3655
3657
  ] }),
3656
- /* @__PURE__ */ n(Ne, { className: "p-2 pl-8", children: [
3658
+ /* @__PURE__ */ n(Se, { className: "p-2 pl-8", children: [
3657
3659
  /* @__PURE__ */ e(
3658
- ut,
3660
+ gt,
3659
3661
  {
3660
3662
  properties: o.oneOf?.properties ?? {},
3661
3663
  propertiesOrder: o.oneOf?.propertiesOrder,
@@ -3671,7 +3673,7 @@ function ji({ disabled: t, getData: a, allowDataInference: r, customFields: i, c
3671
3673
  ] })
3672
3674
  ] }),
3673
3675
  !t && /* @__PURE__ */ e(
3674
- Ie,
3676
+ Fe,
3675
3677
  {
3676
3678
  inArray: !1,
3677
3679
  forceShowErrors: !1,
@@ -3699,15 +3701,15 @@ function ji({ disabled: t, getData: a, allowDataInference: r, customFields: i, c
3699
3701
  )
3700
3702
  ] });
3701
3703
  }
3702
- function Fi({ disabled: t }) {
3704
+ function Bi({ disabled: t }) {
3703
3705
  const {
3704
3706
  values: a,
3705
3707
  handleChange: r
3706
- } = L(), i = "validation.min", s = "validation.max", o = "validation.lessThan", l = "validation.moreThan", d = "validation.positive", m = "validation.negative", u = "validation.integer";
3708
+ } = K(), i = "validation.min", s = "validation.max", o = "validation.lessThan", l = "validation.moreThan", d = "validation.positive", m = "validation.negative", u = "validation.integer";
3707
3709
  return /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
3708
3710
  /* @__PURE__ */ e(Ee, { disabled: t }),
3709
3711
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
3710
- Q,
3712
+ G,
3711
3713
  {
3712
3714
  value: N(a, i),
3713
3715
  label: "Min value",
@@ -3719,7 +3721,7 @@ function Fi({ disabled: t }) {
3719
3721
  }
3720
3722
  ) }),
3721
3723
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
3722
- Q,
3724
+ G,
3723
3725
  {
3724
3726
  value: N(a, s),
3725
3727
  label: "Max value",
@@ -3731,7 +3733,7 @@ function Fi({ disabled: t }) {
3731
3733
  }
3732
3734
  ) }),
3733
3735
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
3734
- Q,
3736
+ G,
3735
3737
  {
3736
3738
  value: N(a, o),
3737
3739
  label: "Less than",
@@ -3743,7 +3745,7 @@ function Fi({ disabled: t }) {
3743
3745
  }
3744
3746
  ) }),
3745
3747
  /* @__PURE__ */ e("div", { className: "col-span-6", children: /* @__PURE__ */ e(
3746
- Q,
3748
+ G,
3747
3749
  {
3748
3750
  value: N(a, l),
3749
3751
  label: "More than",
@@ -3755,43 +3757,43 @@ function Fi({ disabled: t }) {
3755
3757
  }
3756
3758
  ) }),
3757
3759
  /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
3758
- de,
3760
+ le,
3759
3761
  {
3760
3762
  type: "checkbox",
3761
3763
  name: d,
3762
3764
  label: "Positive value",
3763
3765
  disabled: t,
3764
- component: he
3766
+ component: ue
3765
3767
  }
3766
3768
  ) }),
3767
3769
  /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
3768
- de,
3770
+ le,
3769
3771
  {
3770
3772
  type: "checkbox",
3771
3773
  name: m,
3772
3774
  label: "Negative value",
3773
3775
  disabled: t,
3774
- component: he
3776
+ component: ue
3775
3777
  }
3776
3778
  ) }),
3777
3779
  /* @__PURE__ */ e("div", { className: "col-span-4", children: /* @__PURE__ */ e(
3778
- de,
3780
+ le,
3779
3781
  {
3780
3782
  type: "checkbox",
3781
3783
  name: u,
3782
3784
  label: "Integer value",
3783
3785
  disabled: t,
3784
- component: he
3786
+ component: ue
3785
3787
  }
3786
3788
  ) })
3787
3789
  ] });
3788
3790
  }
3789
- function Ii({ disabled: t }) {
3790
- const { values: a, setFieldValue: r } = L();
3791
+ function Mi({ disabled: t }) {
3792
+ const { values: a, setFieldValue: r } = K();
3791
3793
  return /* @__PURE__ */ n(B, { children: [
3792
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Fi, { disabled: t }) }) }),
3794
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Bi, { disabled: t }) }) }),
3793
3795
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
3794
- je,
3796
+ Ve,
3795
3797
  {
3796
3798
  name: "defaultValue",
3797
3799
  disabled: t,
@@ -3805,7 +3807,7 @@ function Ii({ disabled: t }) {
3805
3807
  ) })
3806
3808
  ] });
3807
3809
  }
3808
- function Mt({
3810
+ function Bt({
3809
3811
  existing: t,
3810
3812
  multiple: a,
3811
3813
  disabled: r,
@@ -3818,31 +3820,31 @@ function Mt({
3818
3820
  touched: d,
3819
3821
  setFieldError: m,
3820
3822
  setFieldValue: u
3821
- } = L();
3822
- if (!Re())
3823
- return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(He, {}) });
3823
+ } = K();
3824
+ if (!Ue())
3825
+ return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Je, {}) });
3824
3826
  const p = a ? "of.path" : "path", g = N(s, p), f = i && N(l, p);
3825
3827
  return console.log("pathError", l, f), /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
3826
- fe,
3828
+ be,
3827
3829
  {
3828
3830
  required: !0,
3829
3831
  name: p,
3830
3832
  pathPath: p,
3831
3833
  type: "select",
3832
- validate: Ei,
3834
+ validate: Di,
3833
3835
  disabled: t || r,
3834
3836
  value: g,
3835
3837
  error: f,
3836
3838
  handleChange: o,
3837
- component: Bi
3839
+ component: Ri
3838
3840
  }
3839
3841
  ) }) });
3840
3842
  }
3841
- function Ei(t) {
3843
+ function Di(t) {
3842
3844
  let a;
3843
3845
  return t || (a = "You must specify a target collection for the field"), a;
3844
3846
  }
3845
- function Bi({
3847
+ function Ri({
3846
3848
  disabled: t,
3847
3849
  pathPath: a,
3848
3850
  value: r,
@@ -3851,15 +3853,15 @@ function Bi({
3851
3853
  ...o
3852
3854
  }) {
3853
3855
  console.log("error", s);
3854
- const l = Re();
3856
+ const l = Ue();
3855
3857
  if (!l)
3856
- return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(He, {}) });
3858
+ return /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Je, {}) });
3857
3859
  const d = l?.collections ?? [], m = Array.from(new Set(
3858
3860
  Object.values(d).map((c) => c.group).filter(Boolean)
3859
3861
  ).values()), u = d.filter((c) => !c.group);
3860
3862
  return /* @__PURE__ */ n(B, { children: [
3861
3863
  /* @__PURE__ */ n(
3862
- Fe,
3864
+ je,
3863
3865
  {
3864
3866
  error: !!s,
3865
3867
  disabled: t,
@@ -3872,7 +3874,7 @@ function Bi({
3872
3874
  const p = d.find((f) => f.alias === c || f.path === c);
3873
3875
  if (!p)
3874
3876
  return null;
3875
- const g = nt(p);
3877
+ const g = lt(p);
3876
3878
  return /* @__PURE__ */ n("div", { className: "flex flex-row", children: [
3877
3879
  g,
3878
3880
  /* @__PURE__ */ e(
@@ -3888,13 +3890,13 @@ function Bi({
3888
3890
  ...o,
3889
3891
  children: [
3890
3892
  m.flatMap((c) => /* @__PURE__ */ e(
3891
- Tt,
3893
+ zt,
3892
3894
  {
3893
3895
  label: c || "Views",
3894
3896
  children: d.filter((p) => p.group === c).map((p) => {
3895
- const g = nt(p);
3897
+ const g = lt(p);
3896
3898
  return /* @__PURE__ */ e(
3897
- ve,
3899
+ we,
3898
3900
  {
3899
3901
  value: p.alias ?? p.path,
3900
3902
  children: /* @__PURE__ */ n("div", { className: "flex flex-row", children: [
@@ -3915,10 +3917,10 @@ function Bi({
3915
3917
  },
3916
3918
  `group_${c}`
3917
3919
  )),
3918
- u && /* @__PURE__ */ e(Tt, { label: "Views", children: u.map((c) => {
3919
- const p = nt(c);
3920
+ u && /* @__PURE__ */ e(zt, { label: "Views", children: u.map((c) => {
3921
+ const p = lt(c);
3920
3922
  return /* @__PURE__ */ e(
3921
- ve,
3923
+ we,
3922
3924
  {
3923
3925
  value: c.alias ?? c.path,
3924
3926
  children: /* @__PURE__ */ n("div", { className: "flex flex-row", children: [
@@ -3942,17 +3944,17 @@ function Bi({
3942
3944
  /* @__PURE__ */ e(te, { children: "You can only edit the reference collection upon field creation." })
3943
3945
  ] });
3944
3946
  }
3945
- function Mi({ disabled: t }) {
3947
+ function Ui({ disabled: t }) {
3946
3948
  const {
3947
3949
  values: a,
3948
3950
  errors: r,
3949
3951
  touched: i,
3950
3952
  setFieldValue: s
3951
- } = L(), o = "mode", l = N(a, o), d = N(i, o) && N(r, o), m = "autoValue", u = N(a, m), c = N(i, m) && N(r, m);
3953
+ } = K(), o = "mode", l = N(a, o), d = N(i, o) && N(r, o), m = "autoValue", u = N(a, m), c = N(i, m) && N(r, m);
3952
3954
  return /* @__PURE__ */ n(B, { children: [
3953
3955
  /* @__PURE__ */ n("div", { className: "flex flex-col col-span-12", children: [
3954
3956
  /* @__PURE__ */ n(
3955
- Fe,
3957
+ je,
3956
3958
  {
3957
3959
  name: o,
3958
3960
  value: l ?? "date",
@@ -3971,14 +3973,14 @@ function Mi({ disabled: t }) {
3971
3973
  },
3972
3974
  disabled: t,
3973
3975
  children: [
3974
- /* @__PURE__ */ e(ve, { value: "date_time", children: " Date/Time " }),
3975
- /* @__PURE__ */ e(ve, { value: "date", children: " Date " })
3976
+ /* @__PURE__ */ e(we, { value: "date_time", children: " Date/Time " }),
3977
+ /* @__PURE__ */ e(we, { value: "date", children: " Date " })
3976
3978
  ]
3977
3979
  }
3978
3980
  ),
3979
3981
  /* @__PURE__ */ e(te, { error: !!d, children: d }),
3980
3982
  /* @__PURE__ */ n(
3981
- Fe,
3983
+ je,
3982
3984
  {
3983
3985
  name: m,
3984
3986
  disabled: t,
@@ -3997,9 +3999,9 @@ function Mi({ disabled: t }) {
3997
3999
  error: !!c,
3998
4000
  label: "Automatic value",
3999
4001
  children: [
4000
- /* @__PURE__ */ e(ve, { value: "", children: " None " }),
4001
- /* @__PURE__ */ e(ve, { value: "on_create", children: " On create " }),
4002
- /* @__PURE__ */ e(ve, { value: "on_update", children: " On any update " })
4002
+ /* @__PURE__ */ e(we, { value: "", children: " None " }),
4003
+ /* @__PURE__ */ e(we, { value: "on_create", children: " On create " }),
4004
+ /* @__PURE__ */ e(we, { value: "on_update", children: " On any update " })
4003
4005
  ]
4004
4006
  }
4005
4007
  ),
@@ -4008,40 +4010,40 @@ function Mi({ disabled: t }) {
4008
4010
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Ee, { disabled: t }) }) })
4009
4011
  ] });
4010
4012
  }
4011
- function Di({ disabled: t }) {
4012
- return L(), /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
4013
+ function $i({ disabled: t }) {
4014
+ return K(), /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2", children: [
4013
4015
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
4014
- de,
4016
+ le,
4015
4017
  {
4016
4018
  type: "checkbox",
4017
4019
  name: "hideFromCollection",
4018
4020
  label: "Hide from collection",
4019
4021
  disabled: t,
4020
4022
  tooltip: "Hide this field from the collection view. It will still be visible in the form view",
4021
- component: he
4023
+ component: ue
4022
4024
  }
4023
4025
  ) }),
4024
4026
  /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(
4025
- de,
4027
+ le,
4026
4028
  {
4027
4029
  type: "checkbox",
4028
4030
  name: "readOnly",
4029
4031
  label: "Read only",
4030
4032
  disabled: t,
4031
4033
  tooltip: "Is this a read only field. Display only as a preview",
4032
- component: he
4034
+ component: ue
4033
4035
  }
4034
4036
  ) })
4035
4037
  ] });
4036
4038
  }
4037
- function Ri({ disabled: t }) {
4039
+ function Li({ disabled: t }) {
4038
4040
  return /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(ze, { children: /* @__PURE__ */ e(Ee, { disabled: t }) }) }) });
4039
4041
  }
4040
- function sa(t, a, r) {
4042
+ function na(t, a, r) {
4041
4043
  let i;
4042
4044
  return a === "text_field" ? i = $(
4043
4045
  t,
4044
- Y({
4046
+ {
4045
4047
  dataType: "string",
4046
4048
  propertyConfig: "text_field",
4047
4049
  editable: t.editable !== void 0 ? t.editable : !0,
@@ -4051,10 +4053,10 @@ function sa(t, a, r) {
4051
4053
  email: void 0,
4052
4054
  url: void 0,
4053
4055
  enumValues: void 0
4054
- })
4056
+ }
4055
4057
  ) : a === "multiline" ? i = $(
4056
4058
  t,
4057
- Y({
4059
+ {
4058
4060
  dataType: "string",
4059
4061
  propertyConfig: "multiline",
4060
4062
  editable: t.editable !== void 0 ? t.editable : !0,
@@ -4064,10 +4066,10 @@ function sa(t, a, r) {
4064
4066
  email: void 0,
4065
4067
  url: void 0,
4066
4068
  enumValues: void 0
4067
- })
4069
+ }
4068
4070
  ) : a === "markdown" ? i = $(
4069
4071
  t,
4070
- Y({
4072
+ {
4071
4073
  dataType: "string",
4072
4074
  propertyConfig: "markdown",
4073
4075
  editable: t.editable !== void 0 ? t.editable : !0,
@@ -4076,10 +4078,10 @@ function sa(t, a, r) {
4076
4078
  markdown: !0,
4077
4079
  email: void 0,
4078
4080
  url: void 0
4079
- })
4081
+ }
4080
4082
  ) : a === "url" ? i = $(
4081
4083
  t,
4082
- Y({
4084
+ {
4083
4085
  dataType: "string",
4084
4086
  propertyConfig: "url",
4085
4087
  editable: t.editable !== void 0 ? t.editable : !0,
@@ -4089,10 +4091,10 @@ function sa(t, a, r) {
4089
4091
  email: void 0,
4090
4092
  url: !0,
4091
4093
  enumValues: void 0
4092
- })
4094
+ }
4093
4095
  ) : a === "email" ? i = $(
4094
4096
  t,
4095
- Y({
4097
+ {
4096
4098
  dataType: "string",
4097
4099
  propertyConfig: "email",
4098
4100
  editable: t.editable !== void 0 ? t.editable : !0,
@@ -4102,10 +4104,10 @@ function sa(t, a, r) {
4102
4104
  email: !0,
4103
4105
  url: void 0,
4104
4106
  enumValues: void 0
4105
- })
4107
+ }
4106
4108
  ) : a === "select" ? i = $(
4107
4109
  t,
4108
- Y({
4110
+ {
4109
4111
  dataType: "string",
4110
4112
  propertyConfig: "select",
4111
4113
  editable: t.editable !== void 0 ? t.editable : !0,
@@ -4115,10 +4117,10 @@ function sa(t, a, r) {
4115
4117
  email: void 0,
4116
4118
  url: void 0,
4117
4119
  enumValues: t.enumValues ?? []
4118
- })
4120
+ }
4119
4121
  ) : a === "multi_select" ? i = $(
4120
4122
  t,
4121
- Y({
4123
+ {
4122
4124
  dataType: "array",
4123
4125
  propertyConfig: "multi_select",
4124
4126
  editable: t.editable !== void 0 ? t.editable : !0,
@@ -4126,26 +4128,26 @@ function sa(t, a, r) {
4126
4128
  dataType: "string",
4127
4129
  enumValues: t.of?.enumValues ?? []
4128
4130
  }
4129
- })
4131
+ }
4130
4132
  ) : a === "number_input" ? i = $(
4131
4133
  t,
4132
- Y({
4134
+ {
4133
4135
  dataType: "number",
4134
4136
  propertyConfig: "number_input",
4135
4137
  editable: t.editable !== void 0 ? t.editable : !0,
4136
4138
  enumValues: void 0
4137
- })
4139
+ }
4138
4140
  ) : a === "number_select" ? i = $(
4139
4141
  t,
4140
- Y({
4142
+ {
4141
4143
  dataType: "number",
4142
4144
  propertyConfig: "number_select",
4143
4145
  editable: t.editable !== void 0 ? t.editable : !0,
4144
4146
  enumValues: t.enumValues ?? []
4145
- })
4147
+ }
4146
4148
  ) : a === "multi_number_select" ? i = $(
4147
4149
  t,
4148
- Y({
4150
+ {
4149
4151
  dataType: "array",
4150
4152
  propertyConfig: "multi_number_select",
4151
4153
  editable: t.editable !== void 0 ? t.editable : !0,
@@ -4153,20 +4155,20 @@ function sa(t, a, r) {
4153
4155
  dataType: "number",
4154
4156
  enumValues: t.of?.enumValues ?? []
4155
4157
  }
4156
- })
4158
+ }
4157
4159
  ) : a === "file_upload" ? i = $(
4158
4160
  t,
4159
- Y({
4161
+ {
4160
4162
  dataType: "string",
4161
4163
  propertyConfig: "file_upload",
4162
4164
  editable: t.editable !== void 0 ? t.editable : !0,
4163
4165
  storage: {
4164
4166
  storagePath: "/"
4165
4167
  }
4166
- })
4168
+ }
4167
4169
  ) : a === "multi_file_upload" ? i = $(
4168
4170
  t,
4169
- Y({
4171
+ {
4170
4172
  dataType: "array",
4171
4173
  propertyConfig: "multi_file_upload",
4172
4174
  editable: t.editable !== void 0 ? t.editable : !0,
@@ -4176,79 +4178,79 @@ function sa(t, a, r) {
4176
4178
  storagePath: "/"
4177
4179
  }
4178
4180
  }
4179
- })
4181
+ }
4180
4182
  ) : a === "group" ? i = $(
4181
4183
  t,
4182
- Y({
4184
+ {
4183
4185
  dataType: "map",
4184
4186
  propertyConfig: "group",
4185
4187
  editable: t.editable !== void 0 ? t.editable : !0,
4186
4188
  keyValue: !1,
4187
4189
  properties: t.properties ?? {}
4188
- })
4190
+ }
4189
4191
  ) : a === "key_value" ? i = $(
4190
4192
  t,
4191
- Y({
4193
+ {
4192
4194
  dataType: "map",
4193
4195
  propertyConfig: "key_value",
4194
4196
  editable: t.editable !== void 0 ? t.editable : !0,
4195
4197
  keyValue: !0,
4196
4198
  properties: void 0
4197
- })
4199
+ }
4198
4200
  ) : a === "reference" ? i = $(
4199
4201
  t,
4200
- Y({
4202
+ {
4201
4203
  dataType: "reference",
4202
4204
  propertyConfig: "reference",
4203
4205
  editable: t.editable !== void 0 ? t.editable : !0
4204
- })
4206
+ }
4205
4207
  ) : a === "multi_references" ? i = $(
4206
4208
  t,
4207
- Y({
4209
+ {
4208
4210
  dataType: "array",
4209
4211
  propertyConfig: "multi_references",
4210
4212
  editable: t.editable !== void 0 ? t.editable : !0,
4211
4213
  of: {
4212
4214
  dataType: "reference"
4213
4215
  }
4214
- })
4216
+ }
4215
4217
  ) : a === "switch" ? i = $(
4216
4218
  t,
4217
- Y({
4219
+ {
4218
4220
  dataType: "boolean",
4219
4221
  propertyConfig: "switch",
4220
4222
  editable: t.editable !== void 0 ? t.editable : !0
4221
- })
4223
+ }
4222
4224
  ) : a === "date_time" ? i = $(
4223
4225
  t,
4224
- Y({
4226
+ {
4225
4227
  dataType: "date",
4226
4228
  propertyConfig: "date_time",
4227
4229
  editable: t.editable !== void 0 ? t.editable : !0,
4228
4230
  mode: "date_time"
4229
- })
4231
+ }
4230
4232
  ) : a === "repeat" ? i = $(
4231
4233
  t,
4232
- Y({
4234
+ {
4233
4235
  dataType: "array",
4234
4236
  propertyConfig: "repeat",
4235
4237
  editable: t.editable !== void 0 ? t.editable : !0
4236
- })
4238
+ }
4237
4239
  ) : a === "block" ? i = $(
4238
4240
  t,
4239
- Y({
4241
+ {
4240
4242
  dataType: "array",
4241
4243
  propertyConfig: "block",
4242
4244
  editable: t.editable !== void 0 ? t.editable : !0,
4243
4245
  oneOf: {
4244
4246
  properties: {}
4245
4247
  }
4246
- })
4248
+ }
4247
4249
  ) : a && r[a] && (i = { ...r[a].property, propertyConfig: a }), i;
4248
4250
  }
4249
- function la({ value: t, optionDisabled: a, propertyConfig: r, existing: i }) {
4251
+ function sa({ value: t, optionDisabled: a, propertyConfig: r, existing: i }) {
4250
4252
  return /* @__PURE__ */ e(
4251
- ve,
4253
+ we,
4252
4254
  {
4253
4255
  value: t,
4254
4256
  disabled: a,
@@ -4256,12 +4258,12 @@ function la({ value: t, optionDisabled: a, propertyConfig: r, existing: i }) {
4256
4258
  children: /* @__PURE__ */ n(
4257
4259
  "div",
4258
4260
  {
4259
- className: ke(
4261
+ className: xe(
4260
4262
  "flex flex-row items-center text-base min-h-[52px]",
4261
4263
  a ? "w-full" : ""
4262
4264
  ),
4263
4265
  children: [
4264
- /* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(We, { propertyConfig: r }) }),
4266
+ /* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(Ze, { propertyConfig: r }) }),
4265
4267
  /* @__PURE__ */ n("div", { children: [
4266
4268
  /* @__PURE__ */ e("div", { children: r.name }),
4267
4269
  /* @__PURE__ */ e(
@@ -4280,7 +4282,7 @@ function la({ value: t, optionDisabled: a, propertyConfig: r, existing: i }) {
4280
4282
  }
4281
4283
  );
4282
4284
  }
4283
- const ca = R.memo(
4285
+ const la = D.memo(
4284
4286
  function({
4285
4287
  includeIdAndName: a = !0,
4286
4288
  autoOpenTypeSelect: r,
@@ -4306,9 +4308,9 @@ const ca = R.memo(
4306
4308
  const v = {
4307
4309
  id: "",
4308
4310
  name: ""
4309
- }, T = !!(m && !Ke(m)) && !b;
4311
+ }, T = !!(m && !He(m)) && !b;
4310
4312
  console.log("PropertyForm disabled", T);
4311
- const I = Le(m ? {
4313
+ const F = Ye(m ? {
4312
4314
  id: l,
4313
4315
  previousId: l,
4314
4316
  property: m
@@ -4318,14 +4320,14 @@ const ca = R.memo(
4318
4320
  }) => {
4319
4321
  const C = {
4320
4322
  id: S,
4321
- previousId: I.current?.id,
4323
+ previousId: F.current?.id,
4322
4324
  property: x,
4323
4325
  namespace: d
4324
4326
  };
4325
- I.current = C, u?.(C);
4327
+ F.current = C, u?.(C);
4326
4328
  };
4327
4329
  return /* @__PURE__ */ e(
4328
- Nt,
4330
+ Pt,
4329
4331
  {
4330
4332
  initialErrors: f,
4331
4333
  initialValues: m ? { id: l, ...m } : v,
@@ -4340,10 +4342,10 @@ const ca = R.memo(
4340
4342
  property: { ...j, editable: j.editable ?? !0 }
4341
4343
  }), i || x.resetForm({ values: v });
4342
4344
  },
4343
- children: (S) => (me(() => {
4345
+ children: (S) => (de(() => {
4344
4346
  O?.(S);
4345
4347
  }, [S]), /* @__PURE__ */ e(
4346
- Ui,
4348
+ Ki,
4347
4349
  {
4348
4350
  onPropertyChanged: c ? A : void 0,
4349
4351
  onDelete: p,
@@ -4370,7 +4372,7 @@ const ca = R.memo(
4370
4372
  },
4371
4373
  (t, a) => t.getData === a.getData && t.includeIdAndName === a.includeIdAndName && t.autoOpenTypeSelect === a.autoOpenTypeSelect && t.autoUpdateId === a.autoUpdateId && t.existingProperty === a.existingProperty
4372
4374
  );
4373
- function Ie({
4375
+ function Fe({
4374
4376
  open: t,
4375
4377
  onCancel: a,
4376
4378
  onOkClicked: r,
@@ -4379,16 +4381,16 @@ function Ie({
4379
4381
  collectionEditable: o,
4380
4382
  ...l
4381
4383
  }) {
4382
- const d = Le();
4384
+ const d = Ye();
4383
4385
  return /* @__PURE__ */ n(
4384
- De,
4386
+ Ie,
4385
4387
  {
4386
4388
  open: t ?? !1,
4387
4389
  maxWidth: "xl",
4388
4390
  fullWidth: !0,
4389
4391
  children: [
4390
- /* @__PURE__ */ e(Ge, { children: /* @__PURE__ */ e(
4391
- ca,
4392
+ /* @__PURE__ */ e(De, { children: /* @__PURE__ */ e(
4393
+ la,
4392
4394
  {
4393
4395
  ...l,
4394
4396
  onPropertyChanged: (u) => {
@@ -4402,7 +4404,7 @@ function Ie({
4402
4404
  getData: s
4403
4405
  }
4404
4406
  ) }),
4405
- /* @__PURE__ */ n(Qe, { children: [
4407
+ /* @__PURE__ */ n(Re, { children: [
4406
4408
  a && /* @__PURE__ */ e(
4407
4409
  E,
4408
4410
  {
@@ -4427,7 +4429,7 @@ function Ie({
4427
4429
  }
4428
4430
  );
4429
4431
  }
4430
- function Ui({
4432
+ function Ki({
4431
4433
  values: t,
4432
4434
  errors: a,
4433
4435
  touched: r,
@@ -4450,39 +4452,39 @@ function Ui({
4450
4452
  customFields: w,
4451
4453
  collectionEditable: b
4452
4454
  }) {
4453
- const [v, T] = H(d), [I, A] = H(!1), [S, x] = H(t?.dataType ? Xt(t) : void 0), C = Object.entries(kt).concat(Object.entries(w)), j = k ? C.filter(([J, ae]) => !ce(ae.property) && ae.property?.dataType !== "array") : C, W = ba(t), q = Le(null), U = Le(t), re = "id", xe = f && N(a, "selectedWidget");
4454
- me(() => {
4455
- !N(r, re) && l && t?.name && s(re, Gt(t.name));
4456
- }, [l, r, t?.name]), me(() => {
4457
- if (u && (!m || W.id)) {
4455
+ const [v, T] = L(d), [F, A] = L(!1), [S, x] = L(t?.dataType ? Zt(t) : void 0), C = Object.entries(kt).concat(Object.entries(w)), j = k ? C.filter(([Q, ee]) => !se(ee.property) && ee.property?.dataType !== "array") : C, Z = fa(t), q = Ye(null), M = Ye(t), he = "id", Ce = f && N(a, "selectedWidget");
4456
+ de(() => {
4457
+ !N(r, he) && l && t?.name && s(he, Ht(t.name));
4458
+ }, [l, r, t?.name]), de(() => {
4459
+ if (u && (!m || Z.id)) {
4458
4460
  const {
4459
- id: J,
4460
- ...ae
4461
- } = W;
4462
- dt(W, U.current) || (u({
4463
- id: J,
4464
- property: ae,
4461
+ id: Q,
4462
+ ...ee
4463
+ } = Z;
4464
+ mt(Z, M.current) || (u({
4465
+ id: Q,
4466
+ property: ee,
4465
4467
  namespace: p
4466
- }), U.current = W);
4468
+ }), M.current = Z);
4467
4469
  }
4468
- }, [W, m, u, p]), me(() => {
4470
+ }, [Z, m, u, p]), de(() => {
4469
4471
  t?.id && g && Object.keys(a).length > 0 && g(t?.id, p, a);
4470
4472
  }, [a, g, p, t?.id]);
4471
- const ge = (J) => {
4472
- x(J), i(sa(t, J, w)), setTimeout(() => {
4473
+ const ie = (Q) => {
4474
+ x(Q), i(na(t, Q, w)), setTimeout(() => {
4473
4475
  q.current?.focus();
4474
4476
  }, 0);
4475
4477
  };
4476
- let M;
4477
- return S === "text_field" || S === "multiline" || S === "markdown" || S === "url" || S === "email" ? M = /* @__PURE__ */ e(
4478
- Ti,
4478
+ let R;
4479
+ return S === "text_field" || S === "multiline" || S === "markdown" || S === "url" || S === "email" ? R = /* @__PURE__ */ e(
4480
+ Fi,
4479
4481
  {
4480
4482
  widgetId: S,
4481
4483
  disabled: y,
4482
4484
  showErrors: f
4483
4485
  }
4484
- ) : S === "select" || S === "number_select" ? M = /* @__PURE__ */ e(
4485
- Et,
4486
+ ) : S === "select" || S === "number_select" ? R = /* @__PURE__ */ e(
4487
+ It,
4486
4488
  {
4487
4489
  multiselect: !1,
4488
4490
  allowDataInference: h,
@@ -4491,8 +4493,8 @@ function Ui({
4491
4493
  getData: O,
4492
4494
  showErrors: f
4493
4495
  }
4494
- ) : S === "multi_select" || S === "multi_number_select" ? M = /* @__PURE__ */ e(
4495
- Et,
4496
+ ) : S === "multi_select" || S === "multi_number_select" ? R = /* @__PURE__ */ e(
4497
+ It,
4496
4498
  {
4497
4499
  multiselect: !0,
4498
4500
  updateIds: !o,
@@ -4501,22 +4503,22 @@ function Ui({
4501
4503
  getData: O,
4502
4504
  showErrors: f
4503
4505
  }
4504
- ) : S === "file_upload" ? M = /* @__PURE__ */ e(
4505
- Bt,
4506
+ ) : S === "file_upload" ? R = /* @__PURE__ */ e(
4507
+ Et,
4506
4508
  {
4507
4509
  existing: o,
4508
4510
  multiple: !1,
4509
4511
  disabled: y
4510
4512
  }
4511
- ) : S === "multi_file_upload" ? M = /* @__PURE__ */ e(
4512
- Bt,
4513
+ ) : S === "multi_file_upload" ? R = /* @__PURE__ */ e(
4514
+ Et,
4513
4515
  {
4514
4516
  existing: o,
4515
4517
  multiple: !0,
4516
4518
  disabled: y
4517
4519
  }
4518
- ) : S === "switch" ? M = /* @__PURE__ */ e(Vi, { disabled: y }) : S === "number_input" ? M = /* @__PURE__ */ e(Ii, { disabled: y }) : S === "group" ? M = /* @__PURE__ */ e(
4519
- Pi,
4520
+ ) : S === "switch" ? R = /* @__PURE__ */ e(Ii, { disabled: y }) : S === "number_input" ? R = /* @__PURE__ */ e(Mi, { disabled: y }) : S === "group" ? R = /* @__PURE__ */ e(
4521
+ qi,
4520
4522
  {
4521
4523
  disabled: y,
4522
4524
  getData: O,
@@ -4524,8 +4526,8 @@ function Ui({
4524
4526
  collectionEditable: b,
4525
4527
  customFields: w
4526
4528
  }
4527
- ) : S === "block" ? M = /* @__PURE__ */ e(
4528
- ji,
4529
+ ) : S === "block" ? R = /* @__PURE__ */ e(
4530
+ Ei,
4529
4531
  {
4530
4532
  disabled: y,
4531
4533
  getData: O,
@@ -4533,24 +4535,24 @@ function Ui({
4533
4535
  collectionEditable: b,
4534
4536
  customFields: w
4535
4537
  }
4536
- ) : S === "reference" ? M = /* @__PURE__ */ e(
4537
- Mt,
4538
+ ) : S === "reference" ? R = /* @__PURE__ */ e(
4539
+ Bt,
4538
4540
  {
4539
4541
  showErrors: f,
4540
4542
  existing: o,
4541
4543
  multiple: !1,
4542
4544
  disabled: y
4543
4545
  }
4544
- ) : S === "date_time" ? M = /* @__PURE__ */ e(Mi, { disabled: y }) : S === "multi_references" ? M = /* @__PURE__ */ e(
4545
- Mt,
4546
+ ) : S === "date_time" ? R = /* @__PURE__ */ e(Ui, { disabled: y }) : S === "multi_references" ? R = /* @__PURE__ */ e(
4547
+ Bt,
4546
4548
  {
4547
4549
  showErrors: f,
4548
4550
  existing: o,
4549
4551
  multiple: !0,
4550
4552
  disabled: y
4551
4553
  }
4552
- ) : S === "repeat" ? M = /* @__PURE__ */ e(
4553
- Ni,
4554
+ ) : S === "repeat" ? R = /* @__PURE__ */ e(
4555
+ Ai,
4554
4556
  {
4555
4557
  showErrors: f,
4556
4558
  existing: o,
@@ -4560,8 +4562,8 @@ function Ui({
4560
4562
  collectionEditable: b,
4561
4563
  customFields: w
4562
4564
  }
4563
- ) : S === "key_value" ? M = /* @__PURE__ */ e(Ri, { disabled: y }) : M = null, /* @__PURE__ */ n(B, { children: [
4564
- y && /* @__PURE__ */ n(ea, { mode: "warn", children: [
4565
+ ) : S === "key_value" ? R = /* @__PURE__ */ e(Li, { disabled: y }) : R = null, /* @__PURE__ */ n(B, { children: [
4566
+ y && /* @__PURE__ */ n(Xt, { mode: "warn", children: [
4565
4567
  /* @__PURE__ */ e(P, { children: "This property can't be edited" }),
4566
4568
  /* @__PURE__ */ n(P, { variant: "caption", children: [
4567
4569
  "You may not have permission to edit it or it is defined in code with no ",
@@ -4572,32 +4574,32 @@ function Ui({
4572
4574
  /* @__PURE__ */ n("div", { className: "flex mt-2 justify-between", children: [
4573
4575
  /* @__PURE__ */ n("div", { className: "w-full flex flex-col gap-2", children: [
4574
4576
  /* @__PURE__ */ e(
4575
- Fe,
4577
+ je,
4576
4578
  {
4577
4579
  className: "w-full",
4578
- error: !!xe,
4580
+ error: !!Ce,
4579
4581
  value: S ?? "",
4580
4582
  placeholder: "Select a property widget",
4581
4583
  open: v,
4582
4584
  onOpenChange: T,
4583
4585
  position: "item-aligned",
4584
4586
  disabled: y,
4585
- renderValue: (J) => {
4586
- if (!J)
4587
+ renderValue: (Q) => {
4588
+ if (!Q)
4587
4589
  return /* @__PURE__ */ e("em", { children: "Select a property widget" });
4588
- const ae = J, oe = kt[ae] ?? w[ae], pe = oe.property, qe = pe && !ce(pe) ? Je(pe, w) : void 0, Ce = ce(pe) || o && pe.dataType !== t?.dataType, X = qe ? $(qe, oe) : oe;
4590
+ const ee = Q, pe = kt[ee] ?? w[ee], me = pe.property, ge = me && !se(me) ? We(me, w) : void 0, fe = se(me) || o && me.dataType !== t?.dataType, X = ge ? $(ge, pe) : pe;
4589
4591
  return /* @__PURE__ */ n(
4590
4592
  "div",
4591
4593
  {
4592
- onClick: (be) => {
4593
- Ce && (be.stopPropagation(), be.preventDefault());
4594
+ onClick: (Oe) => {
4595
+ fe && (Oe.stopPropagation(), Oe.preventDefault());
4594
4596
  },
4595
- className: ke(
4597
+ className: xe(
4596
4598
  "flex items-center",
4597
- Ce ? "w-full pointer-events-none opacity-50" : ""
4599
+ fe ? "w-full pointer-events-none opacity-50" : ""
4598
4600
  ),
4599
4601
  children: [
4600
- /* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(We, { propertyConfig: X }) }),
4602
+ /* @__PURE__ */ e("div", { className: "mr-8", children: /* @__PURE__ */ e(Ze, { propertyConfig: X }) }),
4601
4603
  /* @__PURE__ */ n("div", { className: "flex flex-col items-start text-base text-left", children: [
4602
4604
  /* @__PURE__ */ e("div", { children: X.name }),
4603
4605
  /* @__PURE__ */ e(
@@ -4605,7 +4607,7 @@ function Ui({
4605
4607
  {
4606
4608
  variant: "caption",
4607
4609
  color: "disabled",
4608
- children: Ce ? "You can only switch to widgets that use the same data type" : X.description
4610
+ children: fe ? "You can only switch to widgets that use the same data type" : X.description
4609
4611
  }
4610
4612
  )
4611
4613
  ] })
@@ -4613,25 +4615,25 @@ function Ui({
4613
4615
  }
4614
4616
  );
4615
4617
  },
4616
- onValueChange: (J) => {
4617
- ge(J);
4618
+ onValueChange: (Q) => {
4619
+ ie(Q);
4618
4620
  },
4619
- children: j.map(([J, ae]) => {
4620
- const oe = ae.property, pe = o && !ce(oe) && oe.dataType !== t?.dataType;
4621
+ children: j.map(([Q, ee]) => {
4622
+ const pe = ee.property, me = o && !se(pe) && pe.dataType !== t?.dataType;
4621
4623
  return /* @__PURE__ */ e(
4622
- la,
4624
+ sa,
4623
4625
  {
4624
- value: J,
4625
- optionDisabled: pe,
4626
- propertyConfig: ae,
4626
+ value: Q,
4627
+ optionDisabled: me,
4628
+ propertyConfig: ee,
4627
4629
  existing: o
4628
4630
  },
4629
- J
4631
+ Q
4630
4632
  );
4631
4633
  })
4632
4634
  }
4633
4635
  ),
4634
- xe && /* @__PURE__ */ e(
4636
+ Ce && /* @__PURE__ */ e(
4635
4637
  P,
4636
4638
  {
4637
4639
  variant: "caption",
@@ -4642,19 +4644,19 @@ function Ui({
4642
4644
  )
4643
4645
  ] }),
4644
4646
  c && t?.id && /* @__PURE__ */ e(
4645
- ue,
4647
+ re,
4646
4648
  {
4647
4649
  variant: "ghost",
4648
4650
  className: "m-4",
4649
4651
  disabled: y,
4650
4652
  onClick: () => A(!0),
4651
- children: /* @__PURE__ */ e(lt, {})
4653
+ children: /* @__PURE__ */ e(dt, {})
4652
4654
  }
4653
4655
  )
4654
4656
  ] }),
4655
4657
  /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-y-12 mt-8 mb-8", children: [
4656
4658
  m && /* @__PURE__ */ e(
4657
- Si,
4659
+ zi,
4658
4660
  {
4659
4661
  showErrors: f,
4660
4662
  disabledId: o,
@@ -4664,13 +4666,13 @@ function Ui({
4664
4666
  ref: q
4665
4667
  }
4666
4668
  ),
4667
- M,
4668
- /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e(Di, { disabled: y }) })
4669
+ R,
4670
+ /* @__PURE__ */ e("div", { className: "col-span-12", children: /* @__PURE__ */ e($i, { disabled: y }) })
4669
4671
  ] }),
4670
4672
  c && /* @__PURE__ */ e(
4671
- ct,
4673
+ pt,
4672
4674
  {
4673
- open: I,
4675
+ open: F,
4674
4676
  onAccept: () => c(t?.id, p),
4675
4677
  onCancel: () => A(!1),
4676
4678
  title: /* @__PURE__ */ e("div", { children: "Delete this property?" }),
@@ -4683,7 +4685,51 @@ function Ui({
4683
4685
  )
4684
4686
  ] });
4685
4687
  }
4686
- function $i({
4688
+ function Yi(t) {
4689
+ return (t.slice(0, 1).toLowerCase() + t.slice(1)).replace(/([-_ ]){1,}/g, " ").split(/[-_ ]/).reduce((a, r) => a + r[0].toUpperCase() + r.substring(1));
4690
+ }
4691
+ function Hi({ collection: t, onOpenChange: a, open: r }) {
4692
+ const i = "const " + Yi(t.name) + "Collection = " + Za.stringify(t, null, " ");
4693
+ return /* @__PURE__ */ n(
4694
+ Ie,
4695
+ {
4696
+ open: r,
4697
+ onOpenChange: a,
4698
+ maxWidth: "4xl",
4699
+ children: [
4700
+ /* @__PURE__ */ n(De, { children: [
4701
+ /* @__PURE__ */ n(P, { variant: "h6", className: "my-4", children: [
4702
+ "Code for ",
4703
+ t.name
4704
+ ] }),
4705
+ /* @__PURE__ */ n(P, { variant: "body2", className: "my-4 mb-8", children: [
4706
+ "If you want to customise the collection in code, you can add this collection code to your CMS app configuration. More info in the ",
4707
+ /* @__PURE__ */ e(
4708
+ "a",
4709
+ {
4710
+ rel: "noopener noreferrer",
4711
+ href: "https://firecms.co/docs/customization_quickstart",
4712
+ children: "docs"
4713
+ }
4714
+ ),
4715
+ "."
4716
+ ] }),
4717
+ /* @__PURE__ */ e(
4718
+ Xa,
4719
+ {
4720
+ theme: ei.vsDark,
4721
+ code: i,
4722
+ language: "typescript",
4723
+ children: ({ className: s, style: o, tokens: l, getLineProps: d, getTokenProps: m }) => /* @__PURE__ */ e("pre", { style: o, className: "p-4 rounded", children: l.map((u, c) => /* @__PURE__ */ e("div", { ...d({ line: u }), children: u.map((p, g) => /* @__PURE__ */ e("span", { ...m({ token: p }) }, g)) }, c)) })
4724
+ }
4725
+ )
4726
+ ] }),
4727
+ /* @__PURE__ */ e(Re, { children: /* @__PURE__ */ e(E, { onClick: () => a(!1), children: "Close" }) })
4728
+ ]
4729
+ }
4730
+ );
4731
+ }
4732
+ function Gi({
4687
4733
  showErrors: t,
4688
4734
  isNewCollection: a,
4689
4735
  propertyErrorsRef: r,
@@ -4704,96 +4750,96 @@ function $i({
4704
4750
  setFieldTouched: k,
4705
4751
  errors: _,
4706
4752
  dirty: O
4707
- } = L(), h = Ze(), w = Fa("lg"), b = !w, [v, T] = H(), [I, A] = H(), [S, x] = H(), C = I ? le(I, S) : void 0, j = C ? N(g.properties, C.replaceAll(".", ".properties.")) : void 0, [W, q] = H(!1), [U, re] = H(!1), [xe, ge] = H([]), M = R.useRef(g.propertiesOrder ? { "": g.propertiesOrder } : {});
4708
- me(() => {
4753
+ } = K(), h = Qe(), w = ja("lg"), b = !w, [v, T] = L(), [F, A] = L(), [S, x] = L(), C = F ? ne(F, S) : void 0, j = C ? N(g.properties, C.replaceAll(".", ".properties.")) : void 0, [Z, q] = L(!1), [M, he] = L(!1), [Ce, ie] = L(!1), [R, Q] = L([]), ee = D.useRef(g.propertiesOrder ? { "": g.propertiesOrder } : {});
4754
+ de(() => {
4709
4755
  s && s(O);
4710
4756
  }, [O]);
4711
- const J = u ? () => {
4712
- u && (q(!0), u(g).then((V) => {
4713
- if (V && ta(V.properties), !V) {
4757
+ const pe = u ? () => {
4758
+ u && (he(!0), u(g).then((V) => {
4759
+ if (V && ea(V.properties), !V) {
4714
4760
  h.open({
4715
4761
  type: "error",
4716
4762
  message: "Could not infer properties from data"
4717
4763
  });
4718
4764
  return;
4719
4765
  }
4720
- const F = Object.keys(V.properties).filter((se) => !g.properties[se]);
4721
- if (F.length === 0) {
4766
+ const I = Object.keys(V.properties).filter((oe) => !g.properties[oe]);
4767
+ if (I.length === 0) {
4722
4768
  h.open({
4723
4769
  type: "info",
4724
4770
  message: "No new properties found"
4725
4771
  });
4726
4772
  return;
4727
4773
  }
4728
- const G = {
4729
- ...F.reduce((se, ye) => (se[ye] = V.properties[ye], se), {}),
4774
+ const H = {
4775
+ ...I.reduce((oe, ye) => (oe[ye] = V.properties[ye], oe), {}),
4730
4776
  ...g.properties
4731
- }, ne = [
4732
- ...F,
4777
+ }, ce = [
4778
+ ...I,
4733
4779
  ...g.propertiesOrder ?? []
4734
4780
  ];
4735
- f("properties", G, !1), oe(ne), ge(F);
4781
+ f("properties", H, !1), ge(ce), Q(I);
4736
4782
  }).finally(() => {
4737
- q(!1);
4783
+ he(!1);
4738
4784
  }));
4739
- } : void 0, ae = (V) => V ? M.current[V] ?? N(g, Pe(V)) : M.current[""], oe = (V, F) => {
4740
- const G = Pe(F);
4741
- f(G, V, !1), M.current[F ?? ""] = V;
4742
- }, pe = (V, F) => {
4743
- const G = V ? le(V, F) : void 0;
4744
- if (!G)
4785
+ } : void 0, me = (V) => V ? ee.current[V] ?? N(g, Ne(V)) : ee.current[""], ge = (V, I) => {
4786
+ const H = Ne(I);
4787
+ f(H, V, !1), ee.current[I ?? ""] = V;
4788
+ }, fe = (V, I) => {
4789
+ const H = V ? ne(V, I) : void 0;
4790
+ if (!H)
4745
4791
  throw Error("collection editor miss config");
4746
- f(_e(G), void 0, !1);
4747
- const se = ae(F).filter((ye) => ye !== V);
4748
- oe(se, F), re(!1), T(void 0), A(void 0), x(void 0);
4749
- }, qe = (V, F) => {
4750
- f(Pe(F), V, !1);
4751
- }, Ce = ({
4792
+ f(ke(H), void 0, !1);
4793
+ const oe = me(I).filter((ye) => ye !== V);
4794
+ ge(oe, I), ie(!1), T(void 0), A(void 0), x(void 0);
4795
+ }, X = (V, I) => {
4796
+ f(Ne(I), V, !1);
4797
+ }, Oe = ({
4752
4798
  id: V,
4753
- property: F
4799
+ property: I
4754
4800
  }) => {
4755
4801
  if (console.log("onPropertyCreated", {
4756
4802
  id: V,
4757
- property: F
4803
+ property: I
4758
4804
  }), !V)
4759
4805
  throw Error("Need to include an ID when creating a new property");
4760
4806
  f("properties", {
4761
4807
  ...g.properties ?? {},
4762
- [V]: F
4808
+ [V]: I
4763
4809
  }, !1);
4764
- const G = [...g.propertiesOrder ?? Object.keys(g.properties), V];
4810
+ const H = [...g.propertiesOrder ?? Object.keys(g.properties), V];
4765
4811
  console.log("onPropertyCreated", {
4766
4812
  id: V,
4767
- property: F,
4768
- newPropertiesOrder: G
4769
- }), oe(G), re(!1), w && (T(G.indexOf(V)), A(V)), x(void 0);
4770
- }, X = ({
4813
+ property: I,
4814
+ newPropertiesOrder: H
4815
+ }), ge(H), ie(!1), w && (T(H.indexOf(V)), A(V)), x(void 0);
4816
+ }, Xe = ({
4771
4817
  id: V,
4772
- property: F,
4773
- previousId: G,
4774
- namespace: ne
4818
+ property: I,
4819
+ previousId: H,
4820
+ namespace: ce
4775
4821
  }) => {
4776
- const se = V ? le(V, ne) : void 0, ye = se ? _e(se) : void 0;
4777
- if (G && G !== V) {
4778
- const gt = le(G, ne), tt = _e(gt), ee = ae(ne).map((Te) => Te === G ? V : Te).filter((Te) => Te !== void 0);
4779
- oe(ee, ne), V && (T(ee.indexOf(V)), A(V)), f(tt, void 0, !1), k(tt, !1, !1);
4822
+ const oe = V ? ne(V, ce) : void 0, ye = oe ? ke(oe) : void 0;
4823
+ if (H && H !== V) {
4824
+ const at = ne(H, ce), W = ke(at), ve = me(ce).map((it) => it === H ? V : it).filter((it) => it !== void 0);
4825
+ ge(ve, ce), V && (T(ve.indexOf(V)), A(V)), f(W, void 0, !1), k(W, !1, !1);
4780
4826
  }
4781
- ye && (f(ye, F, !1), k(ye, !0, !1));
4782
- }, be = (V, F, G) => {
4783
- const ne = V ? le(V, F) : void 0;
4827
+ ye && (f(ye, I, !1), k(ye, !0, !1));
4828
+ }, et = (V, I, H) => {
4829
+ const ce = V ? ne(V, I) : void 0;
4784
4830
  if (console.warn("onPropertyErrorInternal", {
4785
4831
  id: V,
4786
- namespace: F,
4787
- error: G,
4788
- propertyPath: ne
4789
- }), ne) {
4790
- const se = G && Object.keys(G).length > 0;
4791
- i(V, F, se ? G : void 0), y(_e(ne), se ? "Property error" : void 0);
4832
+ namespace: I,
4833
+ error: H,
4834
+ propertyPath: ce
4835
+ }), ce) {
4836
+ const oe = H && Object.keys(H).length > 0;
4837
+ i(V, I, oe ? H : void 0), y(ke(ce), oe ? "Property error" : void 0);
4792
4838
  }
4793
- }, ht = () => {
4839
+ }, z = () => {
4794
4840
  T(void 0), A(void 0);
4795
- }, Xe = I && r?.current?.properties ? r.current.properties[I] : void 0, z = g?.propertiesOrder === void 0 || g.propertiesOrder.length === 0, K = g.propertiesOrder ? g.propertiesOrder : Object.keys(g.properties), D = Lt(() => d(g.ownerId), [d, g.ownerId]), et = /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
4796
- /* @__PURE__ */ n("div", { className: ke(
4841
+ }, Y = F && r?.current?.properties ? r.current.properties[F] : void 0, U = g?.propertiesOrder === void 0 || g.propertiesOrder.length === 0, Le = g.propertiesOrder ? g.propertiesOrder : Object.keys(g.properties), tt = $t(() => d(g.ownerId), [d, g.ownerId]), Te = /* @__PURE__ */ n("div", { className: "grid grid-cols-12 gap-2 h-full bg-gray-50 dark:bg-gray-900", children: [
4842
+ /* @__PURE__ */ n("div", { className: xe(
4797
4843
  "p-4 md:p-8 pb-20 md:pb-20",
4798
4844
  "col-span-12 lg:col-span-5 h-full overflow-auto",
4799
4845
  !b && "border-r " + Ct
@@ -4801,10 +4847,10 @@ function $i({
4801
4847
  /* @__PURE__ */ n("div", { className: "flex my-2", children: [
4802
4848
  /* @__PURE__ */ n("div", { className: "flex-grow mb-4", children: [
4803
4849
  /* @__PURE__ */ e(
4804
- fe,
4850
+ be,
4805
4851
  {
4806
4852
  name: "name",
4807
- as: Q,
4853
+ as: G,
4808
4854
  invisible: !0,
4809
4855
  className: "-ml-1",
4810
4856
  inputClassName: "text-2xl font-headers",
@@ -4814,7 +4860,7 @@ function $i({
4814
4860
  error: !!_.name
4815
4861
  }
4816
4862
  ),
4817
- D && /* @__PURE__ */ n(
4863
+ tt && /* @__PURE__ */ n(
4818
4864
  P,
4819
4865
  {
4820
4866
  variant: "body2",
@@ -4822,46 +4868,55 @@ function $i({
4822
4868
  color: "secondary",
4823
4869
  children: [
4824
4870
  "Created by ",
4825
- D.displayName
4871
+ tt.displayName
4826
4872
  ]
4827
4873
  }
4828
4874
  )
4829
4875
  ] }),
4830
4876
  l && /* @__PURE__ */ e("div", { className: "ml-4", children: l }),
4831
4877
  /* @__PURE__ */ n("div", { className: "ml-1 mt-2 flex flex-row gap-2", children: [
4832
- J && /* @__PURE__ */ e(ie, { title: "Add new properties based on data", children: /* @__PURE__ */ e(
4833
- E,
4878
+ /* @__PURE__ */ e(ae, { title: "Get the code of this collection", children: /* @__PURE__ */ e(
4879
+ re,
4834
4880
  {
4835
- variant: "text",
4836
- disabled: W,
4837
- onClick: J,
4838
- children: W ? /* @__PURE__ */ e(He, { size: "small" }) : /* @__PURE__ */ e(mt, {})
4881
+ variant: "filled",
4882
+ disabled: M,
4883
+ onClick: () => q(!0),
4884
+ children: /* @__PURE__ */ e(Fa, {})
4839
4885
  }
4840
4886
  ) }),
4841
- /* @__PURE__ */ e(ie, { title: "Add new property", children: /* @__PURE__ */ e(
4887
+ pe && /* @__PURE__ */ e(ae, { title: "Add new properties based on data", children: /* @__PURE__ */ e(
4888
+ re,
4889
+ {
4890
+ variant: "filled",
4891
+ disabled: M,
4892
+ onClick: pe,
4893
+ children: M ? /* @__PURE__ */ e(Je, { size: "small" }) : /* @__PURE__ */ e(ht, {})
4894
+ }
4895
+ ) }),
4896
+ /* @__PURE__ */ e(ae, { title: "Add new property", children: /* @__PURE__ */ e(
4842
4897
  E,
4843
4898
  {
4844
4899
  variant: "outlined",
4845
- onClick: () => re(!0),
4846
- children: /* @__PURE__ */ e(Se, {})
4900
+ onClick: () => ie(!0),
4901
+ children: /* @__PURE__ */ e(qe, {})
4847
4902
  }
4848
4903
  ) })
4849
4904
  ] })
4850
4905
  ] }),
4851
- /* @__PURE__ */ e(Oe, { children: /* @__PURE__ */ e(
4852
- ut,
4906
+ /* @__PURE__ */ e(Pe, { children: /* @__PURE__ */ e(
4907
+ gt,
4853
4908
  {
4854
4909
  className: "pl-8",
4855
- onPropertyClick: (V, F) => {
4856
- T(K.indexOf(V)), A(V), x(F);
4910
+ onPropertyClick: (V, I) => {
4911
+ T(Le.indexOf(V)), A(V), x(I);
4857
4912
  },
4858
- inferredPropertyKeys: xe,
4859
- selectedPropertyKey: I ? le(I, S) : void 0,
4913
+ inferredPropertyKeys: R,
4914
+ selectedPropertyKey: F ? ne(F, S) : void 0,
4860
4915
  properties: g.properties,
4861
4916
  additionalFields: g.additionalFields,
4862
- propertiesOrder: K,
4863
- onPropertyMove: qe,
4864
- onPropertyRemove: a ? pe : void 0,
4917
+ propertiesOrder: Le,
4918
+ onPropertyMove: X,
4919
+ onPropertyRemove: a ? fe : void 0,
4865
4920
  collectionEditable: p,
4866
4921
  errors: t ? _ : {}
4867
4922
  }
@@ -4873,46 +4928,46 @@ function $i({
4873
4928
  color: "primary",
4874
4929
  variant: "outlined",
4875
4930
  size: "large",
4876
- onClick: () => re(!0),
4877
- startIcon: /* @__PURE__ */ e(Se, {}),
4931
+ onClick: () => ie(!0),
4932
+ startIcon: /* @__PURE__ */ e(qe, {}),
4878
4933
  children: "Add new property"
4879
4934
  }
4880
4935
  )
4881
4936
  ] }),
4882
4937
  !b && /* @__PURE__ */ e("div", { className: "col-span-12 lg:col-span-7 ml-2 p-4 md:p-8 h-full overflow-auto pb-20 md:pb-20", children: /* @__PURE__ */ n(
4883
- Ne,
4938
+ Se,
4884
4939
  {
4885
4940
  className: "sticky top-8 p-4 min-h-full border border-transparent w-full flex flex-col justify-center ",
4886
4941
  children: [
4887
- C && j && !ce(j) && /* @__PURE__ */ e(
4888
- ca,
4942
+ C && j && !se(j) && /* @__PURE__ */ e(
4943
+ la,
4889
4944
  {
4890
4945
  inArray: !1,
4891
4946
  existingProperty: !a,
4892
4947
  autoUpdateId: !1,
4893
4948
  allowDataInference: !a,
4894
4949
  autoOpenTypeSelect: !1,
4895
- propertyKey: I,
4950
+ propertyKey: F,
4896
4951
  propertyNamespace: S,
4897
4952
  property: j,
4898
- onPropertyChanged: X,
4899
- onDelete: pe,
4900
- onError: be,
4953
+ onPropertyChanged: Xe,
4954
+ onDelete: fe,
4955
+ onError: et,
4901
4956
  forceShowErrors: t,
4902
- initialErrors: Xe,
4957
+ initialErrors: Y,
4903
4958
  getData: m,
4904
4959
  customFields: c,
4905
4960
  collectionEditable: p
4906
4961
  },
4907
4962
  `edit_view_${v}`
4908
4963
  ),
4909
- !j && /* @__PURE__ */ e(P, { variant: "label", className: "flex items-center justify-center h-full", children: z ? "Now you can add your first property" : "Select a property to edit it" }),
4910
- j && ce(j) && /* @__PURE__ */ e(P, { variant: "label", className: "flex items-center justify-center", children: "This property is defined as a property builder in code" })
4964
+ !j && /* @__PURE__ */ e(P, { variant: "label", className: "flex items-center justify-center h-full", children: U ? "Now you can add your first property" : "Select a property to edit it" }),
4965
+ j && se(j) && /* @__PURE__ */ e(P, { variant: "label", className: "flex items-center justify-center", children: "This property is defined as a property builder in code" })
4911
4966
  ]
4912
4967
  }
4913
4968
  ) }),
4914
4969
  b && /* @__PURE__ */ e(
4915
- Ie,
4970
+ Fe,
4916
4971
  {
4917
4972
  inArray: !1,
4918
4973
  open: v !== void 0,
@@ -4920,45 +4975,53 @@ function $i({
4920
4975
  allowDataInference: !a,
4921
4976
  existingProperty: !0,
4922
4977
  autoOpenTypeSelect: !1,
4923
- propertyKey: I,
4978
+ propertyKey: F,
4924
4979
  propertyNamespace: S,
4925
4980
  property: j,
4926
- onPropertyChanged: X,
4927
- onDelete: pe,
4928
- onError: be,
4981
+ onPropertyChanged: Xe,
4982
+ onDelete: fe,
4983
+ onError: et,
4929
4984
  forceShowErrors: t,
4930
- initialErrors: Xe,
4985
+ initialErrors: Y,
4931
4986
  getData: m,
4932
4987
  customFields: c,
4933
4988
  collectionEditable: p,
4934
- onOkClicked: b ? ht : void 0
4989
+ onOkClicked: b ? z : void 0
4935
4990
  },
4936
4991
  `edit_view_${v}`
4937
4992
  )
4938
4993
  ] });
4939
4994
  return /* @__PURE__ */ n(B, { children: [
4940
- et,
4995
+ Te,
4941
4996
  /* @__PURE__ */ e(
4942
- Ie,
4997
+ Fe,
4943
4998
  {
4944
4999
  inArray: !1,
4945
5000
  existingProperty: !1,
4946
5001
  autoOpenTypeSelect: !0,
4947
5002
  autoUpdateId: !0,
4948
5003
  forceShowErrors: t,
4949
- open: U,
4950
- onCancel: () => re(!1),
4951
- onPropertyChanged: Ce,
5004
+ open: Ce,
5005
+ onCancel: () => ie(!1),
5006
+ onPropertyChanged: Oe,
4952
5007
  getData: m,
4953
5008
  allowDataInference: !a,
4954
5009
  customFields: c,
4955
5010
  collectionEditable: p,
4956
5011
  existingPropertyKeys: g.propertiesOrder
4957
5012
  }
5013
+ ),
5014
+ /* @__PURE__ */ e(
5015
+ Hi,
5016
+ {
5017
+ collection: g,
5018
+ open: Z,
5019
+ onOpenChange: q
5020
+ }
4958
5021
  )
4959
5022
  ] });
4960
5023
  }
4961
- function Li({
5024
+ function Ji({
4962
5025
  open: t,
4963
5026
  handleOk: a,
4964
5027
  handleCancel: r,
@@ -4966,19 +5029,19 @@ function Li({
4966
5029
  title: s
4967
5030
  }) {
4968
5031
  return /* @__PURE__ */ n(
4969
- De,
5032
+ Ie,
4970
5033
  {
4971
5034
  open: t,
4972
5035
  onOpenChange: (o) => o ? r() : a(),
4973
5036
  "aria-labelledby": "alert-dialog-title",
4974
5037
  "aria-describedby": "alert-dialog-description",
4975
5038
  children: [
4976
- /* @__PURE__ */ n(Ge, { children: [
5039
+ /* @__PURE__ */ n(De, { children: [
4977
5040
  /* @__PURE__ */ e(P, { variant: "h6", children: s ?? "Unsaved changes" }),
4978
5041
  i && /* @__PURE__ */ e(P, { children: i }),
4979
5042
  /* @__PURE__ */ e(P, { children: "Are you sure?" })
4980
5043
  ] }),
4981
- /* @__PURE__ */ n(Qe, { children: [
5044
+ /* @__PURE__ */ n(Re, { children: [
4982
5045
  /* @__PURE__ */ e(E, { variant: "text", onClick: r, autoFocus: !0, children: " Cancel " }),
4983
5046
  /* @__PURE__ */ e(E, { onClick: a, children: " Ok " })
4984
5047
  ] })
@@ -4986,15 +5049,15 @@ function Li({
4986
5049
  }
4987
5050
  );
4988
5051
  }
4989
- function Ki({ open: t, onClose: a }) {
5052
+ function Qi({ open: t, onClose: a }) {
4990
5053
  const { entityViews: r } = Ae();
4991
5054
  return /* @__PURE__ */ n(
4992
- De,
5055
+ Ie,
4993
5056
  {
4994
5057
  maxWidth: "md",
4995
5058
  open: t,
4996
5059
  children: [
4997
- /* @__PURE__ */ n(Ge, { children: [
5060
+ /* @__PURE__ */ n(De, { children: [
4998
5061
  /* @__PURE__ */ e(P, { variant: "h6", children: "Select view" }),
4999
5062
  r?.map((i) => /* @__PURE__ */ n(
5000
5063
  E,
@@ -5012,12 +5075,12 @@ function Ki({ open: t, onClose: a }) {
5012
5075
  i.key
5013
5076
  ))
5014
5077
  ] }),
5015
- /* @__PURE__ */ e(Qe, { children: /* @__PURE__ */ e(E, { onClick: () => a(), children: "Cancel" }) })
5078
+ /* @__PURE__ */ e(Re, { children: /* @__PURE__ */ e(E, { onClick: () => a(), children: "Cancel" }) })
5016
5079
  ]
5017
5080
  }
5018
5081
  );
5019
5082
  }
5020
- function Yi({
5083
+ function Wi({
5021
5084
  collection: t,
5022
5085
  parentCollection: a,
5023
5086
  configController: r,
@@ -5025,18 +5088,18 @@ function Yi({
5025
5088
  getUser: s,
5026
5089
  parentPathSegments: o
5027
5090
  }) {
5028
- const { entityViews: l } = Ae(), [d, m] = R.useState(), [u, c] = R.useState(!1), [p, g] = R.useState(), [f, y] = R.useState(), {
5091
+ const { entityViews: l } = Ae(), [d, m] = D.useState(), [u, c] = D.useState(!1), [p, g] = D.useState(), [f, y] = D.useState(), {
5029
5092
  values: k,
5030
5093
  setFieldValue: _
5031
- } = L(), O = t.subcollections ?? [], h = k.entityViews?.filter((v) => typeof v == "string").map((v) => Ia(v, l)).filter(Boolean) ?? [], w = t.entityViews?.filter((v) => typeof v != "string") ?? [], b = h.length + w.length;
5094
+ } = K(), O = t.subcollections ?? [], h = k.entityViews?.filter((v) => typeof v == "string").map((v) => Ia(v, l)).filter(Boolean) ?? [], w = t.entityViews?.filter((v) => typeof v != "string") ?? [], b = h.length + w.length;
5032
5095
  return /* @__PURE__ */ n("div", { className: "overflow-auto my-auto", children: [
5033
- /* @__PURE__ */ e(pt, { maxWidth: "2xl", className: "flex flex-col gap-4 p-8 m-auto", children: /* @__PURE__ */ n("div", { className: "flex flex-col gap-16", children: [
5096
+ /* @__PURE__ */ e(ut, { maxWidth: "2xl", className: "flex flex-col gap-4 p-8 m-auto", children: /* @__PURE__ */ n("div", { className: "flex flex-col gap-16", children: [
5034
5097
  /* @__PURE__ */ n("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
5035
5098
  /* @__PURE__ */ n(P, { variant: "h5", children: [
5036
5099
  "Subcollections of ",
5037
5100
  k.name
5038
5101
  ] }),
5039
- O && O.length > 0 && /* @__PURE__ */ e(Ne, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(Vt, { children: /* @__PURE__ */ e(jt, { children: O.map((v) => /* @__PURE__ */ n(
5102
+ O && O.length > 0 && /* @__PURE__ */ e(Se, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(Tt, { children: /* @__PURE__ */ e(Vt, { children: O.map((v) => /* @__PURE__ */ n(
5040
5103
  bt,
5041
5104
  {
5042
5105
  onClick: () => y({
@@ -5045,25 +5108,25 @@ function Yi({
5045
5108
  }),
5046
5109
  children: [
5047
5110
  /* @__PURE__ */ e(
5048
- $e,
5111
+ Ke,
5049
5112
  {
5050
5113
  align: "left",
5051
5114
  children: /* @__PURE__ */ e(P, { variant: "subtitle2", className: "flex-grow", children: v.name })
5052
5115
  }
5053
5116
  ),
5054
5117
  /* @__PURE__ */ e(
5055
- $e,
5118
+ Ke,
5056
5119
  {
5057
5120
  align: "right",
5058
- children: /* @__PURE__ */ e(ie, { title: "Remove", children: /* @__PURE__ */ e(
5059
- ue,
5121
+ children: /* @__PURE__ */ e(ae, { title: "Remove", children: /* @__PURE__ */ e(
5122
+ re,
5060
5123
  {
5061
5124
  size: "small",
5062
5125
  onClick: (T) => {
5063
5126
  T.preventDefault(), T.stopPropagation(), m(v.path);
5064
5127
  },
5065
5128
  color: "inherit",
5066
- children: /* @__PURE__ */ e(lt, { size: "small" })
5129
+ children: /* @__PURE__ */ e(dt, { size: "small" })
5067
5130
  }
5068
5131
  ) })
5069
5132
  }
@@ -5081,42 +5144,42 @@ function Yi({
5081
5144
  });
5082
5145
  },
5083
5146
  variant: "outlined",
5084
- startIcon: /* @__PURE__ */ e(Se, {}),
5147
+ startIcon: /* @__PURE__ */ e(qe, {}),
5085
5148
  children: "Add subcollection"
5086
5149
  }
5087
5150
  )
5088
5151
  ] }),
5089
5152
  /* @__PURE__ */ n("div", { className: "flex-grow flex flex-col gap-4 items-start", children: [
5090
5153
  /* @__PURE__ */ e(P, { variant: "h5", children: "Custom views" }),
5091
- b > 0 && /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(Ne, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(Vt, { children: /* @__PURE__ */ n(jt, { children: [
5154
+ b > 0 && /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(Se, { className: "flex flex-col gap-4 p-2 w-full", children: /* @__PURE__ */ e(Tt, { children: /* @__PURE__ */ n(Vt, { children: [
5092
5155
  h.map((v) => /* @__PURE__ */ n(bt, { children: [
5093
5156
  /* @__PURE__ */ e(
5094
- $e,
5157
+ Ke,
5095
5158
  {
5096
5159
  align: "left",
5097
5160
  children: /* @__PURE__ */ e(P, { variant: "subtitle2", className: "flex-grow", children: v.name })
5098
5161
  }
5099
5162
  ),
5100
5163
  /* @__PURE__ */ e(
5101
- $e,
5164
+ Ke,
5102
5165
  {
5103
5166
  align: "right",
5104
- children: /* @__PURE__ */ e(ie, { title: "Remove", children: /* @__PURE__ */ e(
5105
- ue,
5167
+ children: /* @__PURE__ */ e(ae, { title: "Remove", children: /* @__PURE__ */ e(
5168
+ re,
5106
5169
  {
5107
5170
  size: "small",
5108
5171
  onClick: (T) => {
5109
5172
  T.preventDefault(), T.stopPropagation(), g(v.key);
5110
5173
  },
5111
5174
  color: "inherit",
5112
- children: /* @__PURE__ */ e(lt, { size: "small" })
5175
+ children: /* @__PURE__ */ e(dt, { size: "small" })
5113
5176
  }
5114
5177
  ) })
5115
5178
  }
5116
5179
  )
5117
5180
  ] }, v.key)),
5118
5181
  w.map((v) => /* @__PURE__ */ e(bt, { children: /* @__PURE__ */ n(
5119
- $e,
5182
+ Ke,
5120
5183
  {
5121
5184
  align: "left",
5122
5185
  children: [
@@ -5129,7 +5192,7 @@ function Yi({
5129
5192
  }
5130
5193
  ) }, v.key))
5131
5194
  ] }) }) }) }),
5132
- b === 0 && /* @__PURE__ */ e(ea, { children: "COMING SOON: You can define your own custom views by uploading it with the CLI" }),
5195
+ b === 0 && /* @__PURE__ */ e(Xt, { children: "COMING SOON: You can define your own custom views by uploading it with the CLI" }),
5133
5196
  /* @__PURE__ */ e(
5134
5197
  E,
5135
5198
  {
@@ -5137,14 +5200,14 @@ function Yi({
5137
5200
  c(!0);
5138
5201
  },
5139
5202
  variant: "outlined",
5140
- startIcon: /* @__PURE__ */ e(Se, {}),
5203
+ startIcon: /* @__PURE__ */ e(qe, {}),
5141
5204
  children: "Add custom entity view"
5142
5205
  }
5143
5206
  )
5144
5207
  ] })
5145
5208
  ] }) }),
5146
5209
  d && /* @__PURE__ */ e(
5147
- ct,
5210
+ pt,
5148
5211
  {
5149
5212
  open: !!d,
5150
5213
  onAccept: () => {
@@ -5163,7 +5226,7 @@ function Yi({
5163
5226
  }
5164
5227
  ),
5165
5228
  p && /* @__PURE__ */ e(
5166
- ct,
5229
+ pt,
5167
5230
  {
5168
5231
  open: !!p,
5169
5232
  onAccept: () => {
@@ -5179,7 +5242,7 @@ function Yi({
5179
5242
  }
5180
5243
  ),
5181
5244
  /* @__PURE__ */ e(
5182
- pa,
5245
+ da,
5183
5246
  {
5184
5247
  open: !!f,
5185
5248
  configController: r,
@@ -5195,7 +5258,7 @@ function Yi({
5195
5258
  }
5196
5259
  ),
5197
5260
  /* @__PURE__ */ e(
5198
- Ki,
5261
+ Qi,
5199
5262
  {
5200
5263
  open: u,
5201
5264
  onClose: (v) => {
@@ -5205,7 +5268,7 @@ function Yi({
5205
5268
  )
5206
5269
  ] });
5207
5270
  }
5208
- const Dt = Ot({
5271
+ const Mt = {
5209
5272
  path: "products",
5210
5273
  name: "Products",
5211
5274
  singularName: "Product",
@@ -5290,7 +5353,7 @@ const Dt = Ot({
5290
5353
  autoValue: "on_create"
5291
5354
  }
5292
5355
  }
5293
- }), Rt = Ot({
5356
+ }, Dt = {
5294
5357
  path: "blog",
5295
5358
  name: "Blog",
5296
5359
  singularName: "Blog entry",
@@ -5299,12 +5362,12 @@ const Dt = Ot({
5299
5362
  description: "A collection of blog entries",
5300
5363
  defaultSize: "l",
5301
5364
  properties: {
5302
- name: Y({
5365
+ name: {
5303
5366
  name: "Name",
5304
5367
  validation: { required: !0 },
5305
5368
  dataType: "string"
5306
- }),
5307
- header_image: Y({
5369
+ },
5370
+ header_image: {
5308
5371
  name: "Header image",
5309
5372
  dataType: "string",
5310
5373
  storage: {
@@ -5314,8 +5377,8 @@ const Dt = Ot({
5314
5377
  cacheControl: "max-age=1000000"
5315
5378
  }
5316
5379
  }
5317
- }),
5318
- content: Y({
5380
+ },
5381
+ content: {
5319
5382
  name: "Content",
5320
5383
  description: "Content blocks for the blog entry",
5321
5384
  validation: { required: !0 },
@@ -5361,7 +5424,7 @@ const Dt = Ot({
5361
5424
  },
5362
5425
  propertiesOrder: ["text", "quote", "images", "products"]
5363
5426
  }
5364
- }),
5427
+ },
5365
5428
  created_on: {
5366
5429
  name: "Created on",
5367
5430
  dataType: "date",
@@ -5402,7 +5465,7 @@ const Dt = Ot({
5402
5465
  initialFilter: {
5403
5466
  status: ["==", "published"]
5404
5467
  }
5405
- }), Ut = Ot({
5468
+ }, Rt = {
5406
5469
  path: "users",
5407
5470
  name: "Users",
5408
5471
  singularName: "User",
@@ -5433,16 +5496,16 @@ const Dt = Ot({
5433
5496
  url: "image"
5434
5497
  }
5435
5498
  }
5436
- });
5437
- function Hi({
5499
+ };
5500
+ function Zi({
5438
5501
  path: t,
5439
5502
  pathSuggestions: a,
5440
5503
  parentCollection: r,
5441
5504
  onContinue: i,
5442
5505
  collections: s
5443
5506
  }) {
5444
- const [o, l] = H(!1), [d, m] = H();
5445
- me(() => {
5507
+ const [o, l] = L(!1), [d, m] = L();
5508
+ de(() => {
5446
5509
  a && s && (l(!0), a(t).then((h) => {
5447
5510
  const w = h.filter((b) => !s.find((v) => v.path.trim().toLowerCase() === b.trim().toLowerCase()));
5448
5511
  m(w);
@@ -5458,8 +5521,8 @@ function Hi({
5458
5521
  setFieldTouched: k,
5459
5522
  isSubmitting: _,
5460
5523
  submitCount: O
5461
- } = L();
5462
- return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ n(pt, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
5524
+ } = K();
5525
+ return /* @__PURE__ */ e("div", { className: "overflow-auto my-auto", children: /* @__PURE__ */ n(ut, { maxWidth: "4xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
5463
5526
  /* @__PURE__ */ e(
5464
5527
  "div",
5465
5528
  {
@@ -5467,7 +5530,7 @@ function Hi({
5467
5530
  children: /* @__PURE__ */ e(P, { variant: "h4", className: "flex-grow", children: "New collection" })
5468
5531
  }
5469
5532
  ),
5470
- r && /* @__PURE__ */ e(st, { colorScheme: "tealDarker", children: /* @__PURE__ */ n(P, { variant: "caption", children: [
5533
+ r && /* @__PURE__ */ e(ct, { colorScheme: "tealDarker", children: /* @__PURE__ */ n(P, { variant: "caption", children: [
5471
5534
  "This is a subcollection of ",
5472
5535
  /* @__PURE__ */ e("b", { children: r.name })
5473
5536
  ] }) }),
@@ -5481,13 +5544,13 @@ function Hi({
5481
5544
  }
5482
5545
  ),
5483
5546
  /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7", children: [
5484
- o && !d && /* @__PURE__ */ e(He, { size: "small" }),
5547
+ o && !d && /* @__PURE__ */ e(Je, { size: "small" }),
5485
5548
  d?.map((h, w) => /* @__PURE__ */ e(
5486
- st,
5549
+ ct,
5487
5550
  {
5488
5551
  colorScheme: "cyanLighter",
5489
5552
  onClick: () => {
5490
- c("name", Pt(h)), c("path", h), c("properties", void 0), i();
5553
+ c("name", Ot(h)), c("path", h), c("properties", void 0), i();
5491
5554
  },
5492
5555
  size: "small",
5493
5556
  children: h
@@ -5512,9 +5575,9 @@ function Hi({
5512
5575
  {
5513
5576
  title: "Products",
5514
5577
  subtitle: "A collection of products with images, prices and stock",
5515
- icon: /* @__PURE__ */ e(ot, { size: "small", iconKey: Dt.icon }),
5578
+ icon: /* @__PURE__ */ e(st, { size: "small", iconKey: Mt.icon }),
5516
5579
  onClick: () => {
5517
- p(Dt), i();
5580
+ p(Mt), i();
5518
5581
  }
5519
5582
  }
5520
5583
  ),
@@ -5523,9 +5586,9 @@ function Hi({
5523
5586
  {
5524
5587
  title: "Blog posts",
5525
5588
  subtitle: "A collection of blog posts with images, authors and complex content",
5526
- icon: /* @__PURE__ */ e(ot, { size: "small", iconKey: Rt.icon }),
5589
+ icon: /* @__PURE__ */ e(st, { size: "small", iconKey: Dt.icon }),
5527
5590
  onClick: () => {
5528
- p(Rt), i();
5591
+ p(Dt), i();
5529
5592
  }
5530
5593
  }
5531
5594
  ),
@@ -5534,9 +5597,9 @@ function Hi({
5534
5597
  {
5535
5598
  title: "Users",
5536
5599
  subtitle: "A collection of users with emails, names and roles",
5537
- icon: /* @__PURE__ */ e(ot, { size: "small", iconKey: Ut.icon }),
5600
+ icon: /* @__PURE__ */ e(st, { size: "small", iconKey: Rt.icon }),
5538
5601
  onClick: () => {
5539
- p(Ut), i();
5602
+ p(Rt), i();
5540
5603
  }
5541
5604
  }
5542
5605
  )
@@ -5552,7 +5615,7 @@ function Hi({
5552
5615
  children: "● Create a collection from a file (csv, json, xls, xslx...)"
5553
5616
  }
5554
5617
  ),
5555
- /* @__PURE__ */ e(ri, { onDataAdded: (h) => i(h) })
5618
+ /* @__PURE__ */ e(si, { onDataAdded: (h) => i(h) })
5556
5619
  ] }),
5557
5620
  /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(E, { variant: "text", onClick: () => i(), className: "my-2", children: "Continue from scratch" }) })
5558
5621
  ] }) });
@@ -5563,11 +5626,11 @@ function wt({
5563
5626
  icon: r,
5564
5627
  onClick: i
5565
5628
  }) {
5566
- return /* @__PURE__ */ e(ie, { title: a, children: /* @__PURE__ */ n(
5567
- aa,
5629
+ return /* @__PURE__ */ e(ae, { title: a, children: /* @__PURE__ */ n(
5630
+ ta,
5568
5631
  {
5569
5632
  onClick: i,
5570
- className: ke(
5633
+ className: xe(
5571
5634
  "my-2 rounded-md border mx-0 p-6 px-4 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center",
5572
5635
  "text-gray-700 dark:text-gray-300",
5573
5636
  "hover:border-blue-600 hover:text-blue-600 dark:hover:text-blue-400 focus:ring-blue-400 hover:ring-1 hover:ring-primary",
@@ -5588,7 +5651,7 @@ function wt({
5588
5651
  }
5589
5652
  ) });
5590
5653
  }
5591
- const Gi = [
5654
+ const Xi = [
5592
5655
  "text_field",
5593
5656
  "multiline",
5594
5657
  "markdown",
@@ -5609,10 +5672,10 @@ const Gi = [
5609
5672
  "date_time",
5610
5673
  "repeat",
5611
5674
  "block"
5612
- ], Qi = Object.entries(kt).filter(
5613
- ([t]) => Gi.includes(t)
5675
+ ], er = Object.entries(kt).filter(
5676
+ ([t]) => Xi.includes(t)
5614
5677
  );
5615
- function Zi({
5678
+ function tr({
5616
5679
  importConfig: t,
5617
5680
  customFields: a,
5618
5681
  collectionEditable: r
@@ -5621,18 +5684,18 @@ function Zi({
5621
5684
  setFieldValue: i,
5622
5685
  setFieldTouched: s,
5623
5686
  values: o
5624
- } = L(), [l, d] = H(void 0), m = R.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), u = l ? l.id : void 0, c = l || void 0, p = ({
5687
+ } = K(), [l, d] = L(void 0), m = D.useRef(o.propertiesOrder ? { "": o.propertiesOrder } : {}), u = l ? l.id : void 0, c = l || void 0, p = ({
5625
5688
  id: f,
5626
5689
  property: y,
5627
5690
  previousId: k,
5628
5691
  namespace: _
5629
5692
  }) => {
5630
- const O = f ? le(f, _) : void 0, h = O ? _e(O) : void 0, w = (v) => v ? m.current[v] ?? N(o, Pe(v)) : m.current[""], b = (v, T) => {
5631
- const I = Pe(T);
5632
- i(I, v, !1), m.current[T ?? ""] = v;
5693
+ const O = f ? ne(f, _) : void 0, h = O ? ke(O) : void 0, w = (v) => v ? m.current[v] ?? N(o, Ne(v)) : m.current[""], b = (v, T) => {
5694
+ const F = Ne(T);
5695
+ i(F, v, !1), m.current[T ?? ""] = v;
5633
5696
  };
5634
5697
  if (k && k !== f) {
5635
- const v = le(k, _), T = _e(v), A = w(_).map((x) => x === k ? f : x).filter((x) => x !== void 0);
5698
+ const v = ne(k, _), T = ke(v), A = w(_).map((x) => x === k ? f : x).filter((x) => x !== void 0);
5636
5699
  b(A, _);
5637
5700
  const S = { ...t.headersMapping };
5638
5701
  Object.keys(S).forEach((x) => {
@@ -5646,8 +5709,8 @@ function Zi({
5646
5709
  property: k,
5647
5710
  namespace: _
5648
5711
  }) => {
5649
- const O = f ? le(f, _) : void 0, h = O ? _e(O) : void 0, w = t.importData.map((v) => N(v, y)), b = {
5650
- ...Xa(w, k, ra),
5712
+ const O = f ? ne(f, _) : void 0, h = O ? ke(O) : void 0, w = t.importData.map((v) => N(v, y)), b = {
5713
+ ...ai(w, k, ia),
5651
5714
  editable: !0
5652
5715
  };
5653
5716
  h && (b ? (console.log("updating inferredNewProperty", {
@@ -5656,10 +5719,10 @@ function Zi({
5656
5719
  }), i(h, b, !1)) : i(h, k, !1), s(h, !0, !1));
5657
5720
  };
5658
5721
  return /* @__PURE__ */ n("div", { className: "overflow-auto my-auto bg-gray-50 dark:bg-gray-900", children: [
5659
- /* @__PURE__ */ n(pt, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
5722
+ /* @__PURE__ */ n(ut, { maxWidth: "6xl", className: "flex flex-col gap-4 p-8 m-auto", children: [
5660
5723
  /* @__PURE__ */ e(P, { variant: "h6", className: "mt-4", children: "Data property mapping" }),
5661
5724
  /* @__PURE__ */ e(
5662
- oi,
5725
+ li,
5663
5726
  {
5664
5727
  headersMapping: t.headersMapping,
5665
5728
  idColumn: t.idColumn,
@@ -5671,7 +5734,7 @@ function Zi({
5671
5734
  propertyKey: y,
5672
5735
  importKey: k
5673
5736
  }) => /* @__PURE__ */ e(
5674
- ni,
5737
+ ci,
5675
5738
  {
5676
5739
  property: f,
5677
5740
  propertyKey: y,
@@ -5684,7 +5747,7 @@ function Zi({
5684
5747
  });
5685
5748
  },
5686
5749
  propertyTypeView: /* @__PURE__ */ e(
5687
- Ji,
5750
+ ar,
5688
5751
  {
5689
5752
  property: f,
5690
5753
  disabled: !1,
@@ -5702,7 +5765,7 @@ function Zi({
5702
5765
  )
5703
5766
  ] }),
5704
5767
  /* @__PURE__ */ e(
5705
- Ie,
5768
+ Fe,
5706
5769
  {
5707
5770
  open: l !== void 0,
5708
5771
  propertyKey: u,
@@ -5726,21 +5789,21 @@ function Zi({
5726
5789
  /* @__PURE__ */ e("div", { style: { height: "52px" } })
5727
5790
  ] });
5728
5791
  }
5729
- function Ji({
5792
+ function ar({
5730
5793
  property: t,
5731
5794
  onPropertyChanged: a,
5732
5795
  propertyKey: r,
5733
5796
  customFields: i,
5734
5797
  disabled: s
5735
5798
  }) {
5736
- const { fields: o } = Ae(), l = t ? Xt(t) : null, d = t ? Je(t, o) : null, [m, u] = H(!1);
5799
+ const { fields: o } = Ae(), l = t ? Zt(t) : null, d = t ? We(t, o) : null, [m, u] = L(!1);
5737
5800
  return /* @__PURE__ */ e(
5738
- ie,
5801
+ ae,
5739
5802
  {
5740
5803
  title: t && d ? `${d?.name} - ${t.dataType}` : void 0,
5741
5804
  open: m ? !1 : void 0,
5742
5805
  children: /* @__PURE__ */ e(
5743
- Fe,
5806
+ je,
5744
5807
  {
5745
5808
  open: m,
5746
5809
  onOpenChange: u,
@@ -5751,9 +5814,9 @@ function Ji({
5751
5814
  value: l ?? "",
5752
5815
  placeholder: "Select a property widget",
5753
5816
  position: "item-aligned",
5754
- renderValue: (c) => d ? /* @__PURE__ */ e(We, { propertyConfig: d }) : null,
5817
+ renderValue: (c) => d ? /* @__PURE__ */ e(Ze, { propertyConfig: d }) : null,
5755
5818
  onValueChange: (c) => {
5756
- const p = sa(t, c, i);
5819
+ const p = na(t, c, i);
5757
5820
  r && (a({
5758
5821
  id: r,
5759
5822
  property: p,
@@ -5761,8 +5824,8 @@ function Ji({
5761
5824
  namespace: void 0
5762
5825
  }), console.log("newSelectedWidgetId", c));
5763
5826
  },
5764
- children: Qi.map(([c, p]) => /* @__PURE__ */ e(
5765
- la,
5827
+ children: er.map(([c, p]) => /* @__PURE__ */ e(
5828
+ sa,
5766
5829
  {
5767
5830
  value: c,
5768
5831
  optionDisabled: !1,
@@ -5776,9 +5839,9 @@ function Ji({
5776
5839
  }
5777
5840
  );
5778
5841
  }
5779
- function Wi({ importConfig: t, properties: a, propertiesOrder: r }) {
5780
- me(() => {
5781
- const s = si(t.originProperties, a), o = t.importData.map((l) => li(l, t.idColumn, t.headersMapping, a, s, "TEMP_PATH"));
5842
+ function ir({ importConfig: t, properties: a, propertiesOrder: r }) {
5843
+ de(() => {
5844
+ const s = di(t.originProperties, a), o = t.importData.map((l) => pi(l, t.idColumn, t.headersMapping, a, s, "TEMP_PATH"));
5782
5845
  t.setEntities(o), console.log("res", { propertiesMapping: s, mappedData: o });
5783
5846
  }, []);
5784
5847
  const i = Ea();
@@ -5803,11 +5866,11 @@ function Wi({ importConfig: t, properties: a, propertiesOrder: r }) {
5803
5866
  }
5804
5867
  );
5805
5868
  }
5806
- function da(t, a = "") {
5869
+ function ca(t, a = "") {
5807
5870
  const r = Object.keys(t).reduce((o, l) => {
5808
5871
  const d = t[l], m = Ma(l), u = a ? `${a}.${m}` : m;
5809
5872
  if (d.dataType === "map" && d.properties) {
5810
- const g = da(d.properties, u);
5873
+ const g = ca(d.properties, u);
5811
5874
  return {
5812
5875
  headersMapping: { ...o.headersMapping, [l]: u },
5813
5876
  properties: {
@@ -5835,14 +5898,14 @@ function da(t, a = "") {
5835
5898
  idColumn: s
5836
5899
  };
5837
5900
  }
5838
- function pa(t) {
5839
- const a = t.open, [r, i] = we.useState(!1), [s, o] = we.useState(!1), l = Z(() => {
5901
+ function da(t) {
5902
+ const a = t.open, [r, i] = _e.useState(!1), [s, o] = _e.useState(!1), l = J(() => {
5840
5903
  r ? o(!0) : t.handleClose(void 0);
5841
5904
  }, [r, t.handleClose]);
5842
- return me(() => {
5905
+ return de(() => {
5843
5906
  a || (i(!1), o(!1));
5844
5907
  }, [a]), /* @__PURE__ */ n(
5845
- De,
5908
+ Ie,
5846
5909
  {
5847
5910
  open: a,
5848
5911
  fullWidth: !0,
@@ -5852,7 +5915,7 @@ function pa(t) {
5852
5915
  onOpenChange: (d) => d ? void 0 : l(),
5853
5916
  children: [
5854
5917
  a && /* @__PURE__ */ e(
5855
- Xi,
5918
+ rr,
5856
5919
  {
5857
5920
  ...t,
5858
5921
  handleCancel: l,
@@ -5860,7 +5923,7 @@ function pa(t) {
5860
5923
  }
5861
5924
  ),
5862
5925
  /* @__PURE__ */ e(
5863
- Li,
5926
+ Ji,
5864
5927
  {
5865
5928
  open: s,
5866
5929
  handleOk: () => t.handleClose(void 0),
@@ -5872,7 +5935,7 @@ function pa(t) {
5872
5935
  }
5873
5936
  );
5874
5937
  }
5875
- function Xi({
5938
+ function rr({
5876
5939
  isNewCollection: t,
5877
5940
  initialValues: a,
5878
5941
  configController: r,
@@ -5890,34 +5953,34 @@ function Xi({
5890
5953
  parentCollection: y,
5891
5954
  getData: k
5892
5955
  }) {
5893
- const { fields: _ } = Ae(), O = Re(), {
5956
+ const { fields: _ } = Ae(), O = Ue(), {
5894
5957
  topLevelNavigation: h,
5895
5958
  collections: w
5896
- } = O, b = !a?.path && (s ?? []).length === 0, v = (y ? y.subcollections : w) ?? [], T = v.map((z) => z.path.trim().toLowerCase()), I = v.map((z) => z.alias?.trim().toLowerCase()).filter(Boolean), A = ci();
5959
+ } = O, b = !a?.path && (s ?? []).length === 0, v = (y ? y.subcollections : w) ?? [], T = v.map((z) => z.path.trim().toLowerCase()), F = v.map((z) => z.alias?.trim().toLowerCase()).filter(Boolean), A = mi();
5897
5960
  if (!h)
5898
5961
  throw Error("Internal: Navigation not ready in collection editor");
5899
5962
  const {
5900
5963
  groups: S
5901
- } = h, x = Ze(), C = Ue(), j = Le({}), W = t ? b ? "welcome" : "details" : "properties", [q, U] = H(W), [re, xe] = we.useState(), [ge, M] = we.useState(), [J, ae] = we.useState(!1), [oe, pe] = we.useState();
5902
- me(() => {
5964
+ } = h, x = Qe(), C = $e(), j = Ye({}), Z = t ? b ? "welcome" : "details" : "properties", [q, M] = L(Z), [he, Ce] = _e.useState(), [ie, R] = _e.useState(), [Q, ee] = _e.useState(!1), [pe, me] = _e.useState();
5965
+ de(() => {
5903
5966
  try {
5904
- O.initialised && (M(i ? O.getCollectionFromPaths([...s ?? [], i]) : void 0), ae(!0));
5967
+ O.initialised && (R(i ? O.getCollectionFromPaths([...s ?? [], i]) : void 0), ee(!0));
5905
5968
  } catch (z) {
5906
- console.error(z), pe(oe);
5969
+ console.error(z), me(pe);
5907
5970
  }
5908
- }, [O.getCollectionFromPaths, i, oe, O.initialised]);
5909
- const qe = (z) => {
5910
- const K = z.alias || z.path;
5971
+ }, [O.getCollectionFromPaths, i, pe, O.initialised]);
5972
+ const ge = (z) => {
5973
+ const Y = z.alias || z.path;
5911
5974
  return r.saveCollection({
5912
- path: K,
5975
+ path: Y,
5913
5976
  collectionData: z,
5914
5977
  previousPath: i,
5915
5978
  parentPathSegments: s
5916
- }).then(() => (xe(void 0), !0)).catch((D) => (xe(D), console.error(D), x.open({
5979
+ }).then(() => (Ce(void 0), !0)).catch((U) => (Ce(U), console.error(U), x.open({
5917
5980
  type: "error",
5918
- message: "Error persisting collection: " + (D.message ?? "Details in the console")
5981
+ message: "Error persisting collection: " + (U.message ?? "Details in the console")
5919
5982
  }), !1));
5920
- }, Ce = ge ?? {
5983
+ }, fe = ie ?? {
5921
5984
  path: a?.path ?? "",
5922
5985
  name: a?.name ?? "",
5923
5986
  group: a?.group ?? "",
@@ -5925,36 +5988,36 @@ function Xi({
5925
5988
  propertiesOrder: [],
5926
5989
  icon: _t[Math.floor(Math.random() * _t.length)],
5927
5990
  ownerId: C.user?.uid ?? ""
5928
- }, X = Z(() => {
5929
- q === "details" ? A.inUse ? U("import_data_saving") : U(u ? "extra_view" : "properties") : U(q === "welcome" ? "details" : q === "import_data_mapping" ? "import_data_preview" : q === "import_data_preview" ? "details" : q === "extra_view" ? "properties" : "details");
5930
- }, [q, A.inUse, u]), be = Z((z) => {
5991
+ }, X = J(() => {
5992
+ q === "details" ? A.inUse ? M("import_data_saving") : M(u ? "extra_view" : "properties") : M(q === "welcome" ? "details" : q === "import_data_mapping" ? "import_data_preview" : q === "import_data_preview" ? "details" : q === "extra_view" ? "properties" : "details");
5993
+ }, [q, A.inUse, u]), Oe = J((z) => {
5931
5994
  if (l)
5932
5995
  return l?.(z.path, z.collectionGroup ?? !1, s ?? []);
5933
- }, [l, s]), ht = Z(async (z) => {
5934
- if (!be)
5935
- return M(z), Promise.resolve(z);
5936
- U("loading");
5937
- const K = await be?.(z);
5938
- if (!K)
5939
- return M(z), Promise.resolve(z);
5940
- const D = {
5996
+ }, [l, s]), Xe = J(async (z) => {
5997
+ if (!Oe)
5998
+ return R(z), Promise.resolve(z);
5999
+ M("loading");
6000
+ const Y = await Oe?.(z);
6001
+ if (!Y)
6002
+ return R(z), Promise.resolve(z);
6003
+ const U = {
5941
6004
  ...z ?? {}
5942
6005
  };
5943
- return Object.keys(K.properties ?? {}).length > 0 && (D.properties = K.properties, D.propertiesOrder = K.propertiesOrder), D.propertiesOrder ? (M(D), console.log("Inferred collection", {
6006
+ return Object.keys(Y.properties ?? {}).length > 0 && (U.properties = Y.properties, U.propertiesOrder = Y.propertiesOrder), U.propertiesOrder ? (R(U), console.log("Inferred collection", {
5944
6007
  newCollection: z ?? {},
5945
- values: D
5946
- }), D) : (D.propertiesOrder = Object.keys(D.properties), D);
5947
- }, [s, be]), Xe = (z, K) => {
6008
+ values: U
6009
+ }), U) : (U.propertiesOrder = Object.keys(U.properties), U);
6010
+ }, [s, Oe]), et = (z, Y) => {
5948
6011
  try {
5949
6012
  if (console.log("Submitting collection", z), !t) {
5950
- qe(z).then(() => {
5951
- K.resetForm({ values: Ce }), d(z);
6013
+ ge(z).then(() => {
6014
+ Y.resetForm({ values: fe }), d(z);
5952
6015
  });
5953
6016
  return;
5954
6017
  }
5955
- q === "welcome" ? (X(), K.resetForm({ values: z })) : q === "details" ? u || A.inUse ? (K.resetForm({ values: z }), X()) : t ? ht(z).then((D) => {
5956
- K.resetForm({
5957
- values: D ?? z,
6018
+ q === "welcome" ? (X(), Y.resetForm({ values: z })) : q === "details" ? u || A.inUse ? (Y.resetForm({ values: z }), X()) : t ? Xe(z).then((U) => {
6019
+ Y.resetForm({
6020
+ values: U ?? z,
5958
6021
  touched: {
5959
6022
  path: !0,
5960
6023
  name: !0
@@ -5962,57 +6025,57 @@ function Xi({
5962
6025
  });
5963
6026
  }).finally(() => {
5964
6027
  X();
5965
- }) : (K.resetForm({ values: z }), X()) : q === "extra_view" ? (X(), K.resetForm({ values: z })) : q === "import_data_mapping" || q === "import_data_preview" ? X() : q === "properties" ? qe(z).then(() => {
5966
- K.resetForm({ values: Ce }), X(), d(z);
5967
- }) : (X(), K.resetForm({ values: z }));
5968
- } catch (D) {
6028
+ }) : (Y.resetForm({ values: z }), X()) : q === "extra_view" ? (X(), Y.resetForm({ values: z })) : q === "import_data_mapping" || q === "import_data_preview" ? X() : q === "properties" ? ge(z).then(() => {
6029
+ Y.resetForm({ values: fe }), X(), d(z);
6030
+ }) : (X(), Y.resetForm({ values: z }));
6031
+ } catch (U) {
5969
6032
  x.open({
5970
6033
  type: "error",
5971
- message: "Error persisting collection: " + (D.message ?? "Details in the console")
5972
- }), console.error(D), K.resetForm({ values: z });
6034
+ message: "Error persisting collection: " + (U.message ?? "Details in the console")
6035
+ }), console.error(U), Y.resetForm({ values: z });
5973
6036
  }
5974
6037
  };
5975
- return !t && (!O.initialised || !J) ? /* @__PURE__ */ e(Ft, {}) : /* @__PURE__ */ e(Ge, { fullHeight: !0, children: /* @__PURE__ */ e(
5976
- Nt,
6038
+ return !t && (!O.initialised || !Q) ? /* @__PURE__ */ e(jt, {}) : /* @__PURE__ */ e(De, { fullHeight: !0, children: /* @__PURE__ */ e(
6039
+ Pt,
5977
6040
  {
5978
- initialValues: Ce,
5979
- validationSchema: (q === "properties" || q === "subcollections" || q === "details") && mi,
6041
+ initialValues: fe,
6042
+ validationSchema: (q === "properties" || q === "subcollections" || q === "details") && gi,
5980
6043
  validate: () => {
5981
6044
  if (q === "properties")
5982
6045
  return j.current;
5983
6046
  },
5984
- onSubmit: Xe,
6047
+ onSubmit: et,
5985
6048
  children: ({
5986
6049
  values: z,
5987
- setFieldValue: K,
5988
- isSubmitting: D,
5989
- dirty: et,
5990
- submitCount: V
6050
+ setFieldValue: Y,
6051
+ isSubmitting: U,
6052
+ dirty: Le,
6053
+ submitCount: tt
5991
6054
  }) => {
5992
- const F = z.path ?? i, G = o?.includes("/") ? o?.split("/").slice(0, -1).join("/") + "/" + F : F, ne = O.resolveAliasesFrom(G), se = ne && k ? () => k(ne) : void 0;
5993
- me(() => {
5994
- p(et);
5995
- }, [et]);
5996
- function ye(ee) {
5997
- A.setInUse(!0), ei(ee, ra).then((Te) => {
5998
- const Ve = da(Te);
5999
- K("properties", Ve.properties), K("propertiesOrder", Object.keys(Ve.properties)), A.setIdColumn(Ve.idColumn), A.setImportData(ee), A.setHeadersMapping(Ve.headersMapping), A.setOriginProperties(Ve.properties);
6055
+ const Te = z.path ?? i, V = o?.includes("/") ? o?.split("/").slice(0, -1).join("/") + "/" + Te : Te, I = O.resolveAliasesFrom(V), H = I && k ? () => k(I) : void 0;
6056
+ de(() => {
6057
+ p(Le);
6058
+ }, [Le]);
6059
+ function ce(W) {
6060
+ A.setInUse(!0), ii(W, ia).then((ft) => {
6061
+ const ve = ca(ft);
6062
+ Y("properties", ve.properties), Y("propertiesOrder", Object.keys(ve.properties)), A.setIdColumn(ve.idColumn), A.setImportData(W), A.setHeadersMapping(ve.headersMapping), A.setOriginProperties(ve.properties);
6000
6063
  });
6001
6064
  }
6002
- const gt = !!z.name && !!z.path, tt = () => {
6003
- const ee = { ...z.properties };
6004
- A.idColumn && delete ee[A.idColumn], K("properties", ee), X(), console.log("onImportMappingComplete", {
6065
+ const oe = !!z.name && !!z.path, ye = () => {
6066
+ const W = { ...z.properties };
6067
+ A.idColumn && delete W[A.idColumn], Y("properties", W), X(), console.log("onImportMappingComplete", {
6005
6068
  importConfig: A,
6006
- properties: ee
6069
+ properties: W
6007
6070
  });
6008
- }, ft = ge?.editable || t;
6071
+ }, at = ie?.editable || t;
6009
6072
  return /* @__PURE__ */ n(B, { children: [
6010
6073
  !t && /* @__PURE__ */ n(
6011
6074
  Da,
6012
6075
  {
6013
6076
  value: q,
6014
- className: ke(Ct, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
6015
- onValueChange: (ee) => U(ee),
6077
+ className: xe(Ct, "justify-end bg-gray-50 dark:bg-gray-950 border-b"),
6078
+ onValueChange: (W) => M(W),
6016
6079
  children: [
6017
6080
  /* @__PURE__ */ e(yt, { value: "details", children: "Details" }),
6018
6081
  /* @__PURE__ */ e(yt, { value: "properties", children: "Properties" }),
@@ -6021,22 +6084,22 @@ function Xi({
6021
6084
  }
6022
6085
  ),
6023
6086
  /* @__PURE__ */ n(
6024
- Za,
6087
+ Qa,
6025
6088
  {
6026
6089
  noValidate: !0,
6027
- className: ke(
6090
+ className: xe(
6028
6091
  t ? "h-full" : "h-[calc(100%-48px)]",
6029
6092
  "flex-grow flex flex-col relative"
6030
6093
  ),
6031
6094
  children: [
6032
- q === "loading" && /* @__PURE__ */ e(Ft, {}),
6033
- q === "extra_view" && F && u?.View && /* @__PURE__ */ e(u.View, { path: F }),
6095
+ q === "loading" && /* @__PURE__ */ e(jt, {}),
6096
+ q === "extra_view" && Te && u?.View && /* @__PURE__ */ e(u.View, { path: Te }),
6034
6097
  q === "welcome" && /* @__PURE__ */ e(
6035
- Hi,
6098
+ Zi,
6036
6099
  {
6037
- path: F,
6038
- onContinue: (ee) => {
6039
- ee ? (ye(ee), U("import_data_mapping")) : U("details");
6100
+ path: Te,
6101
+ onContinue: (W) => {
6102
+ W ? (ce(W), M("import_data_mapping")) : M("details");
6040
6103
  },
6041
6104
  collections: w,
6042
6105
  parentCollection: y,
@@ -6044,15 +6107,15 @@ function Xi({
6044
6107
  }
6045
6108
  ),
6046
6109
  q === "import_data_mapping" && A && /* @__PURE__ */ e(
6047
- Zi,
6110
+ tr,
6048
6111
  {
6049
6112
  importConfig: A,
6050
- collectionEditable: ft,
6113
+ collectionEditable: at,
6051
6114
  customFields: _
6052
6115
  }
6053
6116
  ),
6054
6117
  q === "import_data_preview" && A && /* @__PURE__ */ e(
6055
- Wi,
6118
+ ir,
6056
6119
  {
6057
6120
  importConfig: A,
6058
6121
  properties: z.properties,
@@ -6060,12 +6123,12 @@ function Xi({
6060
6123
  }
6061
6124
  ),
6062
6125
  q === "import_data_saving" && A && /* @__PURE__ */ e(
6063
- di,
6126
+ ui,
6064
6127
  {
6065
6128
  importConfig: A,
6066
6129
  collection: z,
6067
- onImportSuccess: (ee) => {
6068
- d(ee), x.open({
6130
+ onImportSuccess: (W) => {
6131
+ d(W), x.open({
6069
6132
  type: "info",
6070
6133
  message: "Data imported successfully"
6071
6134
  });
@@ -6073,67 +6136,67 @@ function Xi({
6073
6136
  }
6074
6137
  ),
6075
6138
  q === "details" && /* @__PURE__ */ e(
6076
- gi,
6139
+ yi,
6077
6140
  {
6078
6141
  existingPaths: T,
6079
- existingAliases: I,
6142
+ existingAliases: F,
6080
6143
  groups: S,
6081
6144
  parentCollection: y,
6082
6145
  isNewCollection: t
6083
6146
  }
6084
6147
  ),
6085
- q === "subcollections" && ge && /* @__PURE__ */ e(
6086
- Yi,
6148
+ q === "subcollections" && ie && /* @__PURE__ */ e(
6149
+ Wi,
6087
6150
  {
6088
6151
  parentCollection: y,
6089
6152
  configController: r,
6090
6153
  getUser: f,
6091
6154
  collectionInference: l,
6092
6155
  parentPathSegments: s,
6093
- collection: ge
6156
+ collection: ie
6094
6157
  }
6095
6158
  ),
6096
6159
  q === "properties" && /* @__PURE__ */ e(
6097
- $i,
6160
+ Gi,
6098
6161
  {
6099
- showErrors: V > 0,
6162
+ showErrors: tt > 0,
6100
6163
  isNewCollection: t,
6101
6164
  reservedGroups: m,
6102
- onPropertyError: (ee, Te, Ve) => {
6165
+ onPropertyError: (W, ft, ve) => {
6103
6166
  j.current = Ra({
6104
6167
  ...j.current,
6105
- [ee]: Ve
6168
+ [W]: ve
6106
6169
  }, !0);
6107
6170
  },
6108
6171
  getUser: f,
6109
- getData: se,
6110
- doCollectionInference: be,
6172
+ getData: H,
6173
+ doCollectionInference: Oe,
6111
6174
  customFields: _,
6112
- collectionEditable: ft,
6175
+ collectionEditable: at,
6113
6176
  extraIcon: u?.icon && /* @__PURE__ */ e(
6114
- ue,
6177
+ re,
6115
6178
  {
6116
6179
  color: "primary",
6117
- onClick: () => U("extra_view"),
6180
+ onClick: () => M("extra_view"),
6118
6181
  children: u.icon
6119
6182
  }
6120
6183
  )
6121
6184
  }
6122
6185
  ),
6123
6186
  q !== "welcome" && /* @__PURE__ */ n(
6124
- Qe,
6187
+ Re,
6125
6188
  {
6126
6189
  position: "absolute",
6127
6190
  children: [
6128
- re && /* @__PURE__ */ e(ia, { error: re }),
6191
+ he && /* @__PURE__ */ e(aa, { error: he }),
6129
6192
  t && b && q === "import_data_mapping" && /* @__PURE__ */ n(
6130
6193
  E,
6131
6194
  {
6132
6195
  variant: "text",
6133
6196
  type: "button",
6134
- onClick: () => (A.setInUse(!1), U("welcome")),
6197
+ onClick: () => (A.setInUse(!1), M("welcome")),
6135
6198
  children: [
6136
- /* @__PURE__ */ e(at, {}),
6199
+ /* @__PURE__ */ e(rt, {}),
6137
6200
  "Back"
6138
6201
  ]
6139
6202
  }
@@ -6144,10 +6207,10 @@ function Xi({
6144
6207
  variant: "text",
6145
6208
  type: "button",
6146
6209
  onClick: () => {
6147
- qe(z), U("import_data_mapping");
6210
+ ge(z), M("import_data_mapping");
6148
6211
  },
6149
6212
  children: [
6150
- /* @__PURE__ */ e(at, {}),
6213
+ /* @__PURE__ */ e(rt, {}),
6151
6214
  "Back"
6152
6215
  ]
6153
6216
  }
@@ -6157,9 +6220,9 @@ function Xi({
6157
6220
  {
6158
6221
  variant: "text",
6159
6222
  type: "button",
6160
- onClick: () => U("welcome"),
6223
+ onClick: () => M("welcome"),
6161
6224
  children: [
6162
- /* @__PURE__ */ e(at, {}),
6225
+ /* @__PURE__ */ e(rt, {}),
6163
6226
  "Back"
6164
6227
  ]
6165
6228
  }
@@ -6169,9 +6232,9 @@ function Xi({
6169
6232
  {
6170
6233
  variant: "text",
6171
6234
  type: "button",
6172
- onClick: () => U("details"),
6235
+ onClick: () => M("details"),
6173
6236
  children: [
6174
- /* @__PURE__ */ e(at, {}),
6237
+ /* @__PURE__ */ e(rt, {}),
6175
6238
  "Back"
6176
6239
  ]
6177
6240
  }
@@ -6191,7 +6254,7 @@ function Xi({
6191
6254
  {
6192
6255
  variant: "filled",
6193
6256
  color: "primary",
6194
- onClick: tt,
6257
+ onClick: ye,
6195
6258
  children: "Next"
6196
6259
  }
6197
6260
  ),
@@ -6207,13 +6270,13 @@ function Xi({
6207
6270
  }
6208
6271
  ),
6209
6272
  t && (q === "details" || q === "properties") && /* @__PURE__ */ n(
6210
- It,
6273
+ Ft,
6211
6274
  {
6212
6275
  variant: "filled",
6213
6276
  color: "primary",
6214
6277
  type: "submit",
6215
- loading: D,
6216
- disabled: D || q === "details" && !gt,
6278
+ loading: U,
6279
+ disabled: U || q === "details" && !oe,
6217
6280
  startIcon: q === "properties" ? /* @__PURE__ */ e(Ua, {}) : void 0,
6218
6281
  children: [
6219
6282
  q === "details" && "Next",
@@ -6222,12 +6285,12 @@ function Xi({
6222
6285
  }
6223
6286
  ),
6224
6287
  !t && /* @__PURE__ */ e(
6225
- It,
6288
+ Ft,
6226
6289
  {
6227
6290
  variant: "filled",
6228
6291
  color: "primary",
6229
6292
  type: "submit",
6230
- loading: D,
6293
+ loading: U,
6231
6294
  children: "Update collection"
6232
6295
  }
6233
6296
  )
@@ -6242,7 +6305,7 @@ function Xi({
6242
6305
  }
6243
6306
  ) });
6244
6307
  }
6245
- const ma = R.createContext({}), ua = R.createContext({}), er = R.memo(
6308
+ const pa = D.createContext({}), ma = D.createContext({}), or = D.memo(
6246
6309
  function({
6247
6310
  children: a,
6248
6311
  collectionConfigController: r,
@@ -6254,69 +6317,69 @@ const ma = R.createContext({}), ua = R.createContext({}), er = R.memo(
6254
6317
  getUser: m,
6255
6318
  getData: u
6256
6319
  }) {
6257
- const c = Re(), p = pi(), g = Ze(), { fields: f } = Ae(), {
6320
+ const c = Ue(), p = hi(), g = Qe(), { fields: f } = Ae(), {
6258
6321
  collections: y
6259
- } = c, k = y.map((C) => C.path.trim().toLowerCase()), [_, O] = R.useState();
6260
- me(() => {
6322
+ } = c, k = y.map((C) => C.path.trim().toLowerCase()), [_, O] = D.useState();
6323
+ de(() => {
6261
6324
  d && d().then((C) => {
6262
6325
  O(C.filter((j) => !k.includes(j.trim().toLowerCase())));
6263
6326
  });
6264
6327
  }, [d]);
6265
- const [h, w] = R.useState(), [b, v] = R.useState(), T = Z(() => ({
6328
+ const [h, w] = D.useState(), [b, v] = D.useState(), T = J(() => ({
6266
6329
  createCollections: !0,
6267
6330
  editCollections: !0,
6268
6331
  deleteCollections: !0
6269
- }), []), I = Z(({
6332
+ }), []), F = J(({
6270
6333
  path: C,
6271
6334
  fullPath: j,
6272
- parentPathSegments: W,
6335
+ parentPathSegments: Z,
6273
6336
  parentCollection: q
6274
6337
  }) => {
6275
6338
  w({
6276
6339
  editedCollectionPath: C,
6277
6340
  fullPath: j,
6278
- parentPathSegments: W,
6341
+ parentPathSegments: Z,
6279
6342
  isNewCollection: !1,
6280
6343
  parentCollection: q,
6281
6344
  redirect: !1
6282
6345
  });
6283
- }, []), A = Z(({
6346
+ }, []), A = J(({
6284
6347
  propertyKey: C,
6285
6348
  property: j,
6286
- editedCollectionPath: W,
6349
+ editedCollectionPath: Z,
6287
6350
  currentPropertiesOrder: q,
6288
- parentPathSegments: U,
6289
- collection: re
6351
+ parentPathSegments: M,
6352
+ collection: he
6290
6353
  }) => {
6291
- const xe = C && C.includes(".") ? C.substring(0, C.lastIndexOf(".")) : void 0, ge = C && C.includes(".") ? C.substring(C.lastIndexOf(".") + 1) : C;
6292
- console.log("edit property", ge, re), v({
6293
- propertyKey: ge,
6354
+ const Ce = C && C.includes(".") ? C.substring(0, C.lastIndexOf(".")) : void 0, ie = C && C.includes(".") ? C.substring(C.lastIndexOf(".") + 1) : C;
6355
+ console.log("edit property", ie, he), v({
6356
+ propertyKey: ie,
6294
6357
  property: j,
6295
- namespace: xe,
6358
+ namespace: Ce,
6296
6359
  currentPropertiesOrder: q,
6297
- editedCollectionPath: W,
6298
- parentPathSegments: U,
6299
- collectionEditable: re?.editable ?? !1
6360
+ editedCollectionPath: Z,
6361
+ parentPathSegments: M,
6362
+ collectionEditable: he?.editable ?? !1
6300
6363
  });
6301
- }, []), S = R.useCallback(({
6364
+ }, []), S = D.useCallback(({
6302
6365
  parentPathSegments: C,
6303
6366
  parentCollection: j,
6304
- initialValues: W,
6367
+ initialValues: Z,
6305
6368
  redirect: q
6306
6369
  }) => {
6307
6370
  w({
6308
6371
  isNewCollection: !0,
6309
6372
  parentPathSegments: C,
6310
6373
  parentCollection: j,
6311
- initialValues: W,
6374
+ initialValues: Z,
6312
6375
  redirect: q
6313
6376
  });
6314
6377
  }, []), x = d ? (C) => !C && _ ? Promise.resolve(_) : d?.(C) : void 0;
6315
- return /* @__PURE__ */ e(ma.Provider, { value: r, children: /* @__PURE__ */ n(
6316
- ua.Provider,
6378
+ return /* @__PURE__ */ e(pa.Provider, { value: r, children: /* @__PURE__ */ n(
6379
+ ma.Provider,
6317
6380
  {
6318
6381
  value: {
6319
- editCollection: I,
6382
+ editCollection: F,
6320
6383
  createCollection: S,
6321
6384
  editProperty: A,
6322
6385
  configPermissions: i ?? T,
@@ -6325,7 +6388,7 @@ const ma = R.createContext({}), ua = R.createContext({}), er = R.memo(
6325
6388
  children: [
6326
6389
  a,
6327
6390
  /* @__PURE__ */ e(
6328
- pa,
6391
+ da,
6329
6392
  {
6330
6393
  open: !!h,
6331
6394
  configController: r,
@@ -6347,7 +6410,7 @@ const ma = R.createContext({}), ua = R.createContext({}), er = R.memo(
6347
6410
  }
6348
6411
  ),
6349
6412
  /* @__PURE__ */ e(
6350
- Ie,
6413
+ Fe,
6351
6414
  {
6352
6415
  open: !!b,
6353
6416
  includeIdAndName: !0,
@@ -6366,12 +6429,12 @@ const ma = R.createContext({}), ua = R.createContext({}), er = R.memo(
6366
6429
  }) => {
6367
6430
  if (!b || !C)
6368
6431
  return;
6369
- const W = !b.propertyKey;
6432
+ const Z = !b.propertyKey;
6370
6433
  return r.saveProperty({
6371
6434
  path: b?.editedCollectionPath,
6372
6435
  property: j,
6373
6436
  propertyKey: C,
6374
- newPropertiesOrder: W && b.currentPropertiesOrder ? [...b.currentPropertiesOrder, C] : void 0,
6437
+ newPropertiesOrder: Z && b.currentPropertiesOrder ? [...b.currentPropertiesOrder, C] : void 0,
6375
6438
  namespace: b.namespace,
6376
6439
  parentPathSegments: b.parentPathSegments
6377
6440
  }).catch((q) => (console.error(q), g.open({
@@ -6418,21 +6481,21 @@ const ma = R.createContext({}), ua = R.createContext({}), er = R.memo(
6418
6481
  }
6419
6482
  ) });
6420
6483
  },
6421
- dt
6422
- ), Be = () => Kt(ua), ha = () => Kt(ma);
6423
- function tr({
6484
+ mt
6485
+ ), Be = () => Lt(ma), ua = () => Lt(pa);
6486
+ function nr({
6424
6487
  path: t,
6425
6488
  parentPathSegments: a,
6426
6489
  collection: r,
6427
6490
  tableController: i
6428
6491
  }) {
6429
- const s = Ue(), o = Re(), l = Be(), d = ha(), m = Ze(), u = o.getCollectionFromPaths(a), c = l.configPermissions ? l.configPermissions({
6492
+ const s = $e(), o = Ue(), l = Be(), d = ua(), m = Qe(), u = o.getCollectionFromPaths(a), c = l.configPermissions ? l.configPermissions({
6430
6493
  user: s.user,
6431
6494
  collection: r
6432
6495
  }).editCollections : !0;
6433
6496
  let p = null;
6434
- return (!dt(rt(i.filterValues), rt(r.initialFilter)) || !dt(rt(i.sortBy), rt(r.initialSort))) && (p = /* @__PURE__ */ e(
6435
- ie,
6497
+ return (!mt(nt(i.filterValues), nt(r.initialFilter)) || !mt(nt(i.sortBy), nt(r.initialSort))) && (p = /* @__PURE__ */ e(
6498
+ ae,
6436
6499
  {
6437
6500
  title: i.sortBy || i.filterValues ? "Save default filter and sort" : "Clear default filter and sort",
6438
6501
  children: /* @__PURE__ */ e(
@@ -6464,35 +6527,35 @@ function tr({
6464
6527
  )), /* @__PURE__ */ n(B, { children: [
6465
6528
  c && p,
6466
6529
  /* @__PURE__ */ e(
6467
- ie,
6530
+ ae,
6468
6531
  {
6469
6532
  title: c ? "Edit collection" : "You don't have permissions to edit this collection",
6470
6533
  children: /* @__PURE__ */ e(
6471
- ue,
6534
+ re,
6472
6535
  {
6473
6536
  color: "primary",
6474
6537
  disabled: !c,
6475
6538
  onClick: c ? () => l?.editCollection({ path: r.path, fullPath: t, parentPathSegments: a, parentCollection: u }) : void 0,
6476
- children: /* @__PURE__ */ e(Ye, {})
6539
+ children: /* @__PURE__ */ e(Ge, {})
6477
6540
  }
6478
6541
  )
6479
6542
  }
6480
6543
  )
6481
6544
  ] });
6482
6545
  }
6483
- function rt(t) {
6546
+ function nt(t) {
6484
6547
  return t && Object.keys(t).length === 0 ? t : t ?? null;
6485
6548
  }
6486
- function ar({
6549
+ function sr({
6487
6550
  path: t,
6488
6551
  collection: a
6489
6552
  }) {
6490
- const r = Ue(), i = ha(), s = Be(), o = s.configPermissions({
6553
+ const r = $e(), i = ua(), s = Be(), o = s.configPermissions({
6491
6554
  user: r.user,
6492
6555
  collection: a
6493
- }), l = Z(() => {
6556
+ }), l = J(() => {
6494
6557
  s?.editCollection({ path: t, parentPathSegments: [] });
6495
- }, [s, t]), [d, m] = H(!1), u = Z(() => {
6558
+ }, [s, t]), [d, m] = L(!1), u = J(() => {
6496
6559
  i?.deleteCollection({ path: t });
6497
6560
  }, [t, i]);
6498
6561
  return /* @__PURE__ */ n(B, { children: [
@@ -6500,27 +6563,27 @@ function ar({
6500
6563
  o.deleteCollections && /* @__PURE__ */ e(
6501
6564
  La,
6502
6565
  {
6503
- trigger: /* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e(Ka, { size: "small" }) }),
6566
+ trigger: /* @__PURE__ */ e(re, { children: /* @__PURE__ */ e(Ka, { size: "small" }) }),
6504
6567
  children: /* @__PURE__ */ n(Ya, { onClick: (c) => {
6505
6568
  c.preventDefault(), c.stopPropagation(), m(!0);
6506
6569
  }, children: [
6507
- /* @__PURE__ */ e(lt, {}),
6570
+ /* @__PURE__ */ e(dt, {}),
6508
6571
  "Delete"
6509
6572
  ] })
6510
6573
  }
6511
6574
  ),
6512
6575
  o.editCollections && /* @__PURE__ */ e(
6513
- ue,
6576
+ re,
6514
6577
  {
6515
6578
  onClick: (c) => {
6516
6579
  l();
6517
6580
  },
6518
- children: /* @__PURE__ */ e(Ye, { size: "small" })
6581
+ children: /* @__PURE__ */ e(Ge, { size: "small" })
6519
6582
  }
6520
6583
  )
6521
6584
  ] }),
6522
6585
  /* @__PURE__ */ e(
6523
- ct,
6586
+ pt,
6524
6587
  {
6525
6588
  open: d,
6526
6589
  onAccept: u,
@@ -6535,19 +6598,19 @@ function ar({
6535
6598
  )
6536
6599
  ] });
6537
6600
  }
6538
- function ir({
6601
+ function lr({
6539
6602
  group: t,
6540
6603
  context: a
6541
6604
  }) {
6542
6605
  if (!a.navigation.topLevelNavigation)
6543
6606
  throw Error("Navigation not ready in FireCMSHomePage");
6544
- const r = Ue(), i = Be(), s = i.configPermissions ? i.configPermissions({
6607
+ const r = $e(), i = Be(), s = i.configPermissions ? i.configPermissions({
6545
6608
  user: r.user
6546
6609
  }).createCollections : !0;
6547
6610
  return /* @__PURE__ */ e(
6548
- aa,
6611
+ ta,
6549
6612
  {
6550
- className: ke("h-full p-4 min-h-[124px]"),
6613
+ className: xe("h-full p-4 min-h-[124px]"),
6551
6614
  onClick: i && s ? () => i.createCollection({
6552
6615
  initialValues: t ? { group: t } : void 0,
6553
6616
  parentPathSegments: [],
@@ -6558,7 +6621,7 @@ function ir({
6558
6621
  {
6559
6622
  className: "flex flex-col items-start h-full w-full items-center justify-center h-full w-full flex-grow flex-col",
6560
6623
  children: [
6561
- /* @__PURE__ */ e(Se, { color: "primary" }),
6624
+ /* @__PURE__ */ e(qe, { color: "primary" }),
6562
6625
  /* @__PURE__ */ e(
6563
6626
  P,
6564
6627
  {
@@ -6575,8 +6638,8 @@ function ir({
6575
6638
  }
6576
6639
  );
6577
6640
  }
6578
- function rr() {
6579
- const t = Ue(), a = Re(), r = Be(), i = r.configPermissions ? r.configPermissions({
6641
+ function cr() {
6642
+ const t = $e(), a = Ue(), r = Be(), i = r.configPermissions ? r.configPermissions({
6580
6643
  user: t.user
6581
6644
  }).createCollections : !0, s = r.rootPathSuggestions ?? [], o = s.length > 3 || a.collections.length === 0 && s.length > 0;
6582
6645
  return /* @__PURE__ */ e(
@@ -6594,12 +6657,12 @@ function rr() {
6594
6657
  {
6595
6658
  className: "flex flex-row gap-1 overflow-scroll no-scrollbar ",
6596
6659
  children: s.map((l) => /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
6597
- st,
6660
+ ct,
6598
6661
  {
6599
- icon: /* @__PURE__ */ e(Se, { size: "small" }),
6662
+ icon: /* @__PURE__ */ e(qe, { size: "small" }),
6600
6663
  colorScheme: "cyanLighter",
6601
6664
  onClick: r && i ? () => r.createCollection({
6602
- initialValues: { path: l, name: Pt(l) },
6665
+ initialValues: { path: l, name: Ot(l) },
6603
6666
  parentPathSegments: [],
6604
6667
  redirect: !0
6605
6668
  }) : void 0,
@@ -6615,20 +6678,20 @@ function rr() {
6615
6678
  }
6616
6679
  );
6617
6680
  }
6618
- function ga(t, a) {
6681
+ function ha(t, a) {
6619
6682
  const r = (a ?? []).map((s) => {
6620
6683
  const o = t?.find((l) => l.path === s.path || l.alias && s.alias && l.alias === s.alias);
6621
- return o ? or(o, s) : s;
6684
+ return o ? dr(o, s) : s;
6622
6685
  }), i = t.filter((s) => !r.map((o) => o.path).includes(s.path) || !r.map((o) => o.alias).includes(s.alias));
6623
6686
  return [...r, ...i];
6624
6687
  }
6625
- function or(t, a) {
6626
- const r = ga(t?.subcollections ?? [], a?.subcollections ?? []), i = { ...t.properties };
6688
+ function dr(t, a) {
6689
+ const r = ha(t?.subcollections ?? [], a?.subcollections ?? []), i = { ...t.properties };
6627
6690
  Object.keys(a.properties).forEach((u) => {
6628
6691
  const c = t.properties[u];
6629
- c ? i[u] = fa(c, a.properties[u]) : i[u] = a.properties[u];
6692
+ c ? i[u] = ga(c, a.properties[u]) : i[u] = a.properties[u];
6630
6693
  });
6631
- const s = $(t, a), o = $t(t), l = $t(a), d = [.../* @__PURE__ */ new Set([...o, ...l])], m = [.../* @__PURE__ */ new Set([...t.entityViews ?? [], ...a.entityViews ?? []])];
6694
+ const s = $(t, a), o = Ut(t), l = Ut(a), d = [.../* @__PURE__ */ new Set([...o, ...l])], m = [.../* @__PURE__ */ new Set([...t.entityViews ?? [], ...a.entityViews ?? []])];
6632
6695
  return {
6633
6696
  ...s,
6634
6697
  subcollections: r,
@@ -6637,8 +6700,8 @@ function or(t, a) {
6637
6700
  entityViews: m
6638
6701
  };
6639
6702
  }
6640
- function fa(t, a) {
6641
- if (ce(a))
6703
+ function ga(t, a) {
6704
+ if (se(a))
6642
6705
  return a;
6643
6706
  {
6644
6707
  const r = $(t, a), i = !!t.editable, s = !!a.editable;
@@ -6646,19 +6709,19 @@ function fa(t, a) {
6646
6709
  const o = "properties" in t ? t.properties : {}, l = "properties" in a ? a.properties : {}, d = "propertiesOrder" in t && t.propertiesOrder ? t.propertiesOrder : Object.keys(o), m = "propertiesOrder" in a && a.propertiesOrder ? a.propertiesOrder : "properties" in a ? Object.keys(a.properties) : [], u = [.../* @__PURE__ */ new Set([...d, ...m])], c = { ...o };
6647
6710
  return Object.keys(a.properties).forEach((p) => {
6648
6711
  const g = o[p];
6649
- g && (c[p] = fa(g, l[p]));
6712
+ g && (c[p] = ga(g, l[p]));
6650
6713
  }), { ...r, editable: i && s, properties: c, propertiesOrder: u };
6651
6714
  }
6652
6715
  return { ...r, editable: i && s };
6653
6716
  }
6654
6717
  }
6655
- function $t(t) {
6718
+ function Ut(t) {
6656
6719
  return t.propertiesOrder && t.propertiesOrder.length > 0 ? t.propertiesOrder : [
6657
6720
  ...Object.keys(t.properties),
6658
6721
  ...(t.additionalFields ?? [])?.map((a) => a.id)
6659
6722
  ];
6660
6723
  }
6661
- function nr({
6724
+ function pr({
6662
6725
  propertyKey: t,
6663
6726
  onHover: a,
6664
6727
  property: r,
@@ -6667,8 +6730,8 @@ function nr({
6667
6730
  collection: o
6668
6731
  }) {
6669
6732
  const l = Be();
6670
- return /* @__PURE__ */ e(ie, { title: "Edit", children: /* @__PURE__ */ e(
6671
- ue,
6733
+ return /* @__PURE__ */ e(ae, { title: "Edit", children: /* @__PURE__ */ e(
6734
+ re,
6672
6735
  {
6673
6736
  className: a ? "bg-white dark:bg-gray-950" : "hidden",
6674
6737
  onClick: () => {
@@ -6681,20 +6744,20 @@ function nr({
6681
6744
  });
6682
6745
  },
6683
6746
  size: "small",
6684
- children: /* @__PURE__ */ e(Ye, { size: "small" })
6747
+ children: /* @__PURE__ */ e(Ge, { size: "small" })
6685
6748
  }
6686
6749
  ) });
6687
6750
  }
6688
- function sr({
6751
+ function mr({
6689
6752
  fullPath: t,
6690
6753
  parentPathSegments: a,
6691
6754
  collection: r
6692
6755
  }) {
6693
- const i = Ue(), s = Be(), o = s.configPermissions ? s.configPermissions({
6756
+ const i = $e(), s = Be(), o = s.configPermissions ? s.configPermissions({
6694
6757
  user: i.user,
6695
6758
  collection: r
6696
6759
  }).editCollections : !0;
6697
- return /* @__PURE__ */ e(ie, { title: o ? "Add new property" : "You don't have permission to add new properties", children: /* @__PURE__ */ e(
6760
+ return /* @__PURE__ */ e(ae, { title: o ? "Add new property" : "You don't have permission to add new properties", children: /* @__PURE__ */ e(
6698
6761
  "div",
6699
6762
  {
6700
6763
  className: "p-0.5 w-20 h-full flex items-center justify-center cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-950",
@@ -6702,15 +6765,15 @@ function sr({
6702
6765
  s.editProperty({
6703
6766
  editedCollectionPath: t,
6704
6767
  parentPathSegments: a,
6705
- currentPropertiesOrder: Qa(r),
6768
+ currentPropertiesOrder: Ja(r),
6706
6769
  collection: r
6707
6770
  });
6708
6771
  },
6709
- children: /* @__PURE__ */ e(Se, { color: "inherit" })
6772
+ children: /* @__PURE__ */ e(qe, { color: "inherit" })
6710
6773
  }
6711
6774
  ) });
6712
6775
  }
6713
- function vr({
6776
+ function Pr({
6714
6777
  collectionConfigController: t,
6715
6778
  configPermissions: a,
6716
6779
  reservedGroups: r,
@@ -6720,12 +6783,12 @@ function vr({
6720
6783
  collectionInference: l,
6721
6784
  getData: d
6722
6785
  }) {
6723
- const m = Z(
6786
+ const m = J(
6724
6787
  (u) => {
6725
6788
  const c = (g) => {
6726
- ta(g.properties), g.subcollections?.forEach(c);
6789
+ ea(g.properties), g.subcollections?.forEach(c);
6727
6790
  }, p = t.collections ?? [];
6728
- return p.forEach(c), console.debug("Injecting collections", { editableCollections: p, collections: u }), ga(p, u);
6791
+ return p.forEach(c), console.debug("Injecting collections", { editableCollections: p, collections: u }), ha(p, u);
6729
6792
  },
6730
6793
  [t.collections]
6731
6794
  );
@@ -6734,10 +6797,10 @@ function vr({
6734
6797
  loading: t.loading,
6735
6798
  collections: {
6736
6799
  injectCollections: m,
6737
- CollectionActions: tr
6800
+ CollectionActions: nr
6738
6801
  },
6739
6802
  provider: {
6740
- Component: er,
6803
+ Component: or,
6741
6804
  props: {
6742
6805
  collectionConfigController: t,
6743
6806
  configPermissions: a,
@@ -6750,20 +6813,20 @@ function vr({
6750
6813
  }
6751
6814
  },
6752
6815
  homePage: {
6753
- additionalChildrenStart: /* @__PURE__ */ e(rr, {}),
6754
- CollectionActions: ar,
6755
- AdditionalCards: ir
6816
+ additionalChildrenStart: /* @__PURE__ */ e(cr, {}),
6817
+ CollectionActions: sr,
6818
+ AdditionalCards: lr
6756
6819
  },
6757
6820
  collectionView: {
6758
- HeaderAction: nr,
6759
- AddColumnComponent: sr
6821
+ HeaderAction: pr,
6822
+ AddColumnComponent: mr
6760
6823
  }
6761
6824
  };
6762
6825
  }
6763
- function wr({ path: t }) {
6764
- const a = cr(t), r = lr(t), i = Be();
6826
+ function Nr({ path: t }) {
6827
+ const a = hr(t), r = ur(t), i = Be();
6765
6828
  return /* @__PURE__ */ n("div", { className: "p-1 flex flex-col items-center", children: [
6766
- /* @__PURE__ */ e(ia, { error: "No collection for path: " + a }),
6829
+ /* @__PURE__ */ e(aa, { error: "No collection for path: " + a }),
6767
6830
  /* @__PURE__ */ e(
6768
6831
  E,
6769
6832
  {
@@ -6772,7 +6835,7 @@ function wr({ path: t }) {
6772
6835
  size: "small",
6773
6836
  onClick: () => {
6774
6837
  i.createCollection({
6775
- initialValues: { path: a, name: Pt(a) },
6838
+ initialValues: { path: a, name: Ot(a) },
6776
6839
  parentPathSegments: r,
6777
6840
  redirect: !1
6778
6841
  });
@@ -6782,24 +6845,24 @@ function wr({ path: t }) {
6782
6845
  )
6783
6846
  ] });
6784
6847
  }
6785
- function lr(t) {
6848
+ function ur(t) {
6786
6849
  const a = t.split("/");
6787
6850
  return a.filter((r, i) => i % 2 === 0 && i !== a.length - 1);
6788
6851
  }
6789
- function cr(t) {
6852
+ function hr(t) {
6790
6853
  const a = t.split("/");
6791
6854
  return a[a.length - 1];
6792
6855
  }
6793
6856
  export {
6794
- wr as MissingReferenceWidget,
6795
- Ke as editableProperty,
6796
- le as getFullId,
6797
- _e as idToPropertiesPath,
6798
- Pe as namespaceToPropertiesOrderPath,
6799
- fi as namespaceToPropertiesPath,
6800
- xi as removeNonEditableProperties,
6857
+ Nr as MissingReferenceWidget,
6858
+ He as editableProperty,
6859
+ ne as getFullId,
6860
+ ke as idToPropertiesPath,
6861
+ Ne as namespaceToPropertiesOrderPath,
6862
+ vi as namespaceToPropertiesPath,
6863
+ Pi as removeNonEditableProperties,
6801
6864
  Be as useCollectionEditorController,
6802
- vr as useCollectionEditorPlugin,
6803
- ha as useCollectionsConfigController
6865
+ Pr as useCollectionEditorPlugin,
6866
+ ua as useCollectionsConfigController
6804
6867
  };
6805
6868
  //# sourceMappingURL=index.es.js.map