dynamic-mui 2.4.1 → 2.5.1

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.
Files changed (103) hide show
  1. package/README.md +61 -0
  2. package/dist/{AIForm-DtRl0WdY.mjs → AIForm-BVJ7qhP5.mjs} +2984 -2778
  3. package/dist/AIForm-D8_6RVmA.js +44 -0
  4. package/dist/{accordion-BaiGxDcw.js → accordion-B3fSXKqC.js} +1 -1
  5. package/dist/{accordion-xg_TxxYS.mjs → accordion-BxTjyh5y.mjs} +1 -1
  6. package/dist/{addressfield-BvQEHdEk.mjs → addressfield-C9VaV9xw.mjs} +52 -40
  7. package/dist/addressfield-Cv8zK_sb.js +1 -0
  8. package/dist/ai/index.cjs +1 -1
  9. package/dist/ai/index.mjs +1 -1
  10. package/dist/asyncautocomplete-BveFRqpV.mjs +92 -0
  11. package/dist/asyncautocomplete-CoOb7mtv.js +1 -0
  12. package/dist/{bar-DNc7TMKj.mjs → bar-BfMaIpfo.mjs} +1 -1
  13. package/dist/{bar-BiIzbOC3.js → bar-CE_D8esp.js} +1 -1
  14. package/dist/cascadeselect-C53hT-C-.mjs +66 -0
  15. package/dist/cascadeselect-CWECmehh.js +1 -0
  16. package/dist/collection-Cf87KWZM.js +1 -0
  17. package/dist/collection-HUYkt74J.mjs +1140 -0
  18. package/dist/colorpicker-BRQPl_IL.mjs +111 -0
  19. package/dist/{colorpicker-DpLvK1WR.js → colorpicker-zE3r16Gc.js} +1 -1
  20. package/dist/components/controls/Collection/CollectionList.d.ts +22 -0
  21. package/dist/components/controls/Collection/ItemDialog.d.ts +20 -0
  22. package/dist/components/controls/Collection/collection.d.ts +9 -0
  23. package/dist/components/controls/Collection/parts.d.ts +39 -0
  24. package/dist/components/controls/Collection/tree.d.ts +18 -0
  25. package/dist/components/controls/Collection/ui.d.ts +49 -0
  26. package/dist/components/controls/index.d.ts +1 -0
  27. package/dist/{consentfield-B21l9tGo.js → consentfield-CEddOmCa.js} +1 -1
  28. package/dist/{consentfield-CGT98YbR.mjs → consentfield-Cylid9il.mjs} +13 -11
  29. package/dist/{datatable-Bv0Q37Zy.js → datatable-3MUZQhnx.js} +1 -1
  30. package/dist/{datatable-B_6wXh2g.mjs → datatable-BWimO7zD.mjs} +1 -1
  31. package/dist/dynamic-mui.cjs +1 -1
  32. package/dist/dynamic-mui.mjs +2 -2
  33. package/dist/editabletable--ow4E3bB.js +1 -0
  34. package/dist/{editabletable-YaFqdLvf.mjs → editabletable-CVJ14zrm.mjs} +19 -17
  35. package/dist/{fileupload--KzSGb5a.js → fileupload-B7f6VOb0.js} +1 -1
  36. package/dist/{fileupload-ZBi72f1R.mjs → fileupload-DHiYLdJ5.mjs} +16 -3
  37. package/dist/{formrepeater-Cwgtvz1c.mjs → formrepeater-BGZGTcVb.mjs} +25 -21
  38. package/dist/{formrepeater-BhUEa4BI.js → formrepeater-CvWeLug8.js} +1 -1
  39. package/dist/{formwizard-CYcgf5jL.mjs → formwizard-BeJK5mqc.mjs} +1 -1
  40. package/dist/{formwizard-BlozHDc_.js → formwizard-DrHKFPfN.js} +1 -1
  41. package/dist/{geofield-xqZy_DAY.mjs → geofield-Bchfb6__.mjs} +28 -24
  42. package/dist/geofield-thoXisie.js +1 -0
  43. package/dist/{group-Dtju1rHQ.js → group-B3QBe0YI.js} +1 -1
  44. package/dist/{group-DmLN-b09.mjs → group-DUnv46e_.mjs} +1 -1
  45. package/dist/{intlphone-CXUQP9Gp.mjs → intlphone-BY59PVDg.mjs} +12 -8
  46. package/dist/{intlphone-BeHXAcFi.js → intlphone-CMXEolsT.js} +1 -1
  47. package/dist/{keyvaluefield-BJoEbe4I.mjs → keyvaluefield-BAYbTkCY.mjs} +4 -2
  48. package/dist/{keyvaluefield-BZQDG0l5.js → keyvaluefield-FBaHQ8Ak.js} +1 -1
  49. package/dist/{line-tIm99vYW.js → line-Bk15u06y.js} +1 -1
  50. package/dist/{line-B3CAbZOo.mjs → line-Bzbkzk7f.mjs} +1 -1
  51. package/dist/lineitemlist-8NL2THwe.js +1 -0
  52. package/dist/{lineitemlist-CBSqoC9g.mjs → lineitemlist-PsoQ4LU4.mjs} +23 -19
  53. package/dist/{list-C8QMpJOJ.mjs → list-BGzVPlgh.mjs} +1 -1
  54. package/dist/{list-D_cawpPI.js → list-BmGiSIoi.js} +1 -1
  55. package/dist/locationfield-BG76gNbD.js +1 -0
  56. package/dist/locationfield-CupDmXsM.mjs +118 -0
  57. package/dist/{markdowneditor-DFOgRmdL.mjs → markdowneditor-4StkbrKV.mjs} +15 -11
  58. package/dist/markdowneditor-vDHguMtU.js +2 -0
  59. package/dist/{matrixfield-0lnuaEks.mjs → matrixfield-CeROIIAj.mjs} +34 -30
  60. package/dist/{matrixfield-nWt6Cug5.js → matrixfield-Vptf0zNH.js} +1 -1
  61. package/dist/{mixChart-ISf3Kbr-.mjs → mixChart-Doq4lt7Z.mjs} +2 -2
  62. package/dist/mixChart-rgyMCdnp.js +1 -0
  63. package/dist/{multitextbox-DmAWV163.mjs → multitextbox-DeVv6uzi.mjs} +1 -1
  64. package/dist/{multitextbox-oEgl2F8-.js → multitextbox-DtSydHcv.js} +1 -1
  65. package/dist/{npsscale-CdTEwERY.mjs → npsscale-Cd7PoCJS.mjs} +7 -3
  66. package/dist/{npsscale-DW4sxcLz.js → npsscale-Dwp2T0DQ.js} +1 -1
  67. package/dist/{numberstepper-BwQ5coLc.mjs → numberstepper-BFNTu3Ii.mjs} +6 -2
  68. package/dist/{numberstepper-cDosevJb.js → numberstepper-DBKq7hUm.js} +1 -1
  69. package/dist/{pie-gAfuDR1F.js → pie-CE4QV82D.js} +1 -1
  70. package/dist/{pie-CBRckgd4.mjs → pie-DKRRH37e.mjs} +1 -1
  71. package/dist/richtexteditor-B6lK2iIt.js +1 -0
  72. package/dist/{richtexteditor-xrbv8PXZ.mjs → richtexteditor-DdIfi0-T.mjs} +4 -2
  73. package/dist/schema.d.ts +10 -2
  74. package/dist/{signature-FM6L60nk.js → signature-B_drsWTj.js} +2 -2
  75. package/dist/{signature-CP_lA_Yh.mjs → signature-D9B8bFqg.mjs} +4 -2
  76. package/dist/{stepper-CjGNFyBz.js → stepper-CO6XiIaw.js} +1 -1
  77. package/dist/{stepper-BprezTzX.mjs → stepper-D6e9yWIr.mjs} +1 -1
  78. package/dist/{summaryfield-5mJRwVZ4.mjs → summaryfield-BIA2gc1w.mjs} +1 -1
  79. package/dist/{summaryfield-C3xmqZQp.js → summaryfield-CR3aNMZU.js} +1 -1
  80. package/dist/{tabs-B4P59kHX.js → tabs-B4ZbZQvt.js} +1 -1
  81. package/dist/{tabs-By-Mm8vm.mjs → tabs-PgOpdVX1.mjs} +1 -1
  82. package/dist/tagsinput-DtNb1IuV.js +1 -0
  83. package/dist/tagsinput-G_M0DbpI.mjs +58 -0
  84. package/dist/types.d.ts +188 -0
  85. package/dist/util/collection.d.ts +82 -0
  86. package/package.json +11 -11
  87. package/dist/AIForm-Dv8ahXyE.js +0 -43
  88. package/dist/addressfield-vVizrbZP.js +0 -1
  89. package/dist/asyncautocomplete-AmSRs7PY.mjs +0 -89
  90. package/dist/asyncautocomplete-Dtmxh4l1.js +0 -1
  91. package/dist/cascadeselect-BlznIKS6.mjs +0 -64
  92. package/dist/cascadeselect-DqLtG-W9.js +0 -1
  93. package/dist/colorpicker-hP3b7teC.mjs +0 -98
  94. package/dist/editabletable-D3c3DJxX.js +0 -1
  95. package/dist/geofield-BynrTSVm.js +0 -1
  96. package/dist/lineitemlist-RqStjYB-.js +0 -1
  97. package/dist/locationfield-BiLy-c09.js +0 -1
  98. package/dist/locationfield-KBbu-98L.mjs +0 -119
  99. package/dist/markdowneditor-Dy7Q01FM.js +0 -2
  100. package/dist/mixChart-C3o184UT.js +0 -1
  101. package/dist/richtexteditor-DI-h5Efn.js +0 -1
  102. package/dist/tagsinput-BwM3NYK_.js +0 -1
  103. package/dist/tagsinput-Ce4EWy4i.mjs +0 -58
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),r=require("@mui/material"),a=require("./AIForm-Dv8ahXyE.js"),l=require("./v4-CqdK_b8Y.js");function m({attributes:o={},patch:c,onChange:n}){const{MuiAttributes:i={},label:t="Accordion",subFields:s=[]}=o,d=u.useMemo(()=>l.v4(),[]);return e.jsxs(r.Accordion,{...i,children:[e.jsx(r.AccordionSummary,{expandIcon:e.jsx(r.Icon,{children:"expand_more"}),children:e.jsx(r.Typography,{children:t})}),e.jsx(r.AccordionDetails,{children:e.jsx(a.FormGenerator,{guid:d,data:s,patch:c,onChange:n})})]})}exports.default=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),r=require("@mui/material"),a=require("./AIForm-D8_6RVmA.js"),l=require("./v4-CqdK_b8Y.js");function m({attributes:o={},patch:c,onChange:n}){const{MuiAttributes:i={},label:t="Accordion",subFields:s=[]}=o,d=u.useMemo(()=>l.v4(),[]);return e.jsxs(r.Accordion,{...i,children:[e.jsx(r.AccordionSummary,{expandIcon:e.jsx(r.Icon,{children:"expand_more"}),children:e.jsx(r.Typography,{children:t})}),e.jsx(r.AccordionDetails,{children:e.jsx(a.FormGenerator,{guid:d,data:s,patch:c,onChange:n})})]})}exports.default=m;
@@ -1,7 +1,7 @@
1
1
  import { jsxs as a, jsx as o } from "react/jsx-runtime";
2
2
  import m from "react";
3
3
  import { Accordion as s, AccordionSummary as l, Typography as p, Icon as u, AccordionDetails as f } from "@mui/material";
4
- import { F as A } from "./AIForm-DtRl0WdY.mjs";
4
+ import { F as A } from "./AIForm-BVJ7qhP5.mjs";
5
5
  import { v as h } from "./v4-BysszJq8.mjs";
6
6
  function j({ attributes: r = {}, patch: c, onChange: i }) {
7
7
  const { MuiAttributes: n = {}, label: e = "Accordion", subFields: t = [] } = r, d = m.useMemo(() => h(), []);
@@ -1,9 +1,9 @@
1
1
  import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
2
  import S, { useCallback as A } from "react";
3
- import r from "@mui/material/Grid";
4
- import i from "@mui/material/TextField";
5
- import g from "@mui/material/MenuItem";
6
- import { j as E, m as P, k as I } from "./AIForm-DtRl0WdY.mjs";
3
+ import s from "@mui/material/Grid";
4
+ import o from "@mui/material/TextField";
5
+ import I from "@mui/material/MenuItem";
6
+ import { j as g, m as E, k as P } from "./AIForm-BVJ7qhP5.mjs";
7
7
  const N = [
8
8
  { value: "US", label: "United States" },
9
9
  { value: "CA", label: "Canada" },
@@ -42,9 +42,9 @@ function D({ attributes: n = {}, rules: h = {}, onChange: c }) {
42
42
  const {
43
43
  id: b = "",
44
44
  MuiAttributes: v = {},
45
- countries: o,
45
+ countries: i,
46
46
  labels: y = {}
47
- } = n, x = Array.isArray(o) && o.length ? o : N, l = { ...U, ...y }, d = h?.validation?.some(
47
+ } = n, x = Array.isArray(i) && i.length ? i : N, l = { ...U, ...y }, d = h?.validation?.some(
48
48
  (t) => t.rule === "mandatory" || t.rule === "mandatoryselect"
49
49
  ) || !1, [a, p] = S.useState(() => ({
50
50
  street1: "",
@@ -55,7 +55,7 @@ function D({ attributes: n = {}, rules: h = {}, onChange: c }) {
55
55
  country: "",
56
56
  ...n?.value || {}
57
57
  }));
58
- E(() => {
58
+ g(() => {
59
59
  p({
60
60
  street1: "",
61
61
  street2: "",
@@ -66,83 +66,95 @@ function D({ attributes: n = {}, rules: h = {}, onChange: c }) {
66
66
  ...n?.value || {}
67
67
  });
68
68
  }, [n?.value]);
69
- const s = A(
69
+ const r = A(
70
70
  (t) => (C) => {
71
71
  const m = { ...a, [t]: C.target.value };
72
72
  p(m), c?.({ id: b, value: m });
73
73
  },
74
74
  [a, b, c]
75
- ), u = P(I, v?.sx);
76
- return /* @__PURE__ */ f(r, { container: !0, spacing: 2, ...v, children: [
77
- /* @__PURE__ */ e(r, { size: { xs: 12 }, children: /* @__PURE__ */ e(
78
- i,
75
+ ), u = E(P, v?.sx);
76
+ return /* @__PURE__ */ f(s, { container: !0, spacing: 2, ...v, children: [
77
+ /* @__PURE__ */ e(s, { size: { xs: 12 }, children: /* @__PURE__ */ e(
78
+ o,
79
79
  {
80
80
  fullWidth: !0,
81
81
  label: l.street1,
82
82
  required: d,
83
83
  value: a.street1 || "",
84
- onChange: s("street1"),
85
- inputProps: { "aria-label": l.street1 },
86
- sx: u
84
+ onChange: r("street1"),
85
+ sx: u,
86
+ slotProps: {
87
+ htmlInput: { "aria-label": l.street1 }
88
+ }
87
89
  }
88
90
  ) }),
89
- /* @__PURE__ */ e(r, { size: { xs: 12 }, children: /* @__PURE__ */ e(
90
- i,
91
+ /* @__PURE__ */ e(s, { size: { xs: 12 }, children: /* @__PURE__ */ e(
92
+ o,
91
93
  {
92
94
  fullWidth: !0,
93
95
  label: l.street2,
94
96
  value: a.street2 || "",
95
- onChange: s("street2"),
96
- inputProps: { "aria-label": l.street2 },
97
- sx: u
97
+ onChange: r("street2"),
98
+ sx: u,
99
+ slotProps: {
100
+ htmlInput: { "aria-label": l.street2 }
101
+ }
98
102
  }
99
103
  ) }),
100
- /* @__PURE__ */ e(r, { size: { xs: 12, sm: 6, md: 5 }, children: /* @__PURE__ */ e(
101
- i,
104
+ /* @__PURE__ */ e(s, { size: { xs: 12, sm: 6, md: 5 }, children: /* @__PURE__ */ e(
105
+ o,
102
106
  {
103
107
  fullWidth: !0,
104
108
  label: l.city,
105
109
  required: d,
106
110
  value: a.city || "",
107
- onChange: s("city"),
108
- inputProps: { "aria-label": l.city },
109
- sx: u
111
+ onChange: r("city"),
112
+ sx: u,
113
+ slotProps: {
114
+ htmlInput: { "aria-label": l.city }
115
+ }
110
116
  }
111
117
  ) }),
112
- /* @__PURE__ */ e(r, { size: { xs: 12, sm: 6, md: 4 }, children: /* @__PURE__ */ e(
113
- i,
118
+ /* @__PURE__ */ e(s, { size: { xs: 12, sm: 6, md: 4 }, children: /* @__PURE__ */ e(
119
+ o,
114
120
  {
115
121
  fullWidth: !0,
116
122
  label: l.state,
117
123
  value: a.state || "",
118
- onChange: s("state"),
119
- inputProps: { "aria-label": l.state },
120
- sx: u
124
+ onChange: r("state"),
125
+ sx: u,
126
+ slotProps: {
127
+ htmlInput: { "aria-label": l.state }
128
+ }
121
129
  }
122
130
  ) }),
123
- /* @__PURE__ */ e(r, { size: { xs: 12, sm: 6, md: 3 }, children: /* @__PURE__ */ e(
124
- i,
131
+ /* @__PURE__ */ e(s, { size: { xs: 12, sm: 6, md: 3 }, children: /* @__PURE__ */ e(
132
+ o,
125
133
  {
126
134
  fullWidth: !0,
127
135
  label: l.postalCode,
128
136
  value: a.postalCode || "",
129
- onChange: s("postalCode"),
130
- inputProps: { "aria-label": l.postalCode },
131
- sx: u
137
+ onChange: r("postalCode"),
138
+ sx: u,
139
+ slotProps: {
140
+ htmlInput: { "aria-label": l.postalCode }
141
+ }
132
142
  }
133
143
  ) }),
134
- /* @__PURE__ */ e(r, { size: { xs: 12, sm: 6 }, children: /* @__PURE__ */ e(
135
- i,
144
+ /* @__PURE__ */ e(s, { size: { xs: 12, sm: 6 }, children: /* @__PURE__ */ e(
145
+ o,
136
146
  {
137
147
  select: !0,
138
148
  fullWidth: !0,
139
149
  label: l.country,
140
150
  required: d,
141
151
  value: a.country || "",
142
- onChange: s("country"),
143
- SelectProps: { inputProps: { "aria-label": l.country } },
152
+ onChange: r("country"),
144
153
  sx: u,
145
- children: x.map((t) => /* @__PURE__ */ e(g, { value: t.value, children: t.label }, t.value))
154
+ slotProps: {
155
+ select: { inputProps: { "aria-label": l.country } }
156
+ },
157
+ children: x.map((t) => /* @__PURE__ */ e(I, { value: t.value, children: t.label }, t.value))
146
158
  }
147
159
  ) })
148
160
  ] });
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("react"),s=require("@mui/material/Grid"),n=require("@mui/material/TextField"),j=require("@mui/material/MenuItem"),c=require("./AIForm-D8_6RVmA.js"),g=[{value:"US",label:"United States"},{value:"CA",label:"Canada"},{value:"MX",label:"Mexico"},{value:"GB",label:"United Kingdom"},{value:"IE",label:"Ireland"},{value:"FR",label:"France"},{value:"DE",label:"Germany"},{value:"ES",label:"Spain"},{value:"IT",label:"Italy"},{value:"NL",label:"Netherlands"},{value:"BE",label:"Belgium"},{value:"CH",label:"Switzerland"},{value:"SE",label:"Sweden"},{value:"NO",label:"Norway"},{value:"DK",label:"Denmark"},{value:"PT",label:"Portugal"},{value:"AU",label:"Australia"},{value:"NZ",label:"New Zealand"},{value:"IN",label:"India"},{value:"CN",label:"China"},{value:"JP",label:"Japan"},{value:"SG",label:"Singapore"},{value:"AE",label:"United Arab Emirates"},{value:"BR",label:"Brazil"},{value:"ZA",label:"South Africa"}],I={street1:"Street address",street2:"Apt, suite, etc. (optional)",city:"City",state:"State / Province",postalCode:"Postal code",country:"Country"};function f({attributes:i={},rules:y={},onChange:b}){const{id:v="",MuiAttributes:x={},countries:o,labels:C={}}=i,S=Array.isArray(o)&&o.length?o:g,l={...I,...C},d=y?.validation?.some(t=>t.rule==="mandatory"||t.rule==="mandatoryselect")||!1,[a,p]=m.useState(()=>({street1:"",street2:"",city:"",state:"",postalCode:"",country:"",...i?.value||{}}));c.useUpdateEffect(()=>{p({street1:"",street2:"",city:"",state:"",postalCode:"",country:"",...i?.value||{}})},[i?.value]);const r=m.useCallback(t=>A=>{const h={...a,[t]:A.target.value};p(h),b?.({id:v,value:h})},[a,v,b]),u=c.mergeSx(c.premiumInputSx,x?.sx);return e.jsxs(s,{container:!0,spacing:2,...x,children:[e.jsx(s,{size:{xs:12},children:e.jsx(n,{fullWidth:!0,label:l.street1,required:d,value:a.street1||"",onChange:r("street1"),sx:u,slotProps:{htmlInput:{"aria-label":l.street1}}})}),e.jsx(s,{size:{xs:12},children:e.jsx(n,{fullWidth:!0,label:l.street2,value:a.street2||"",onChange:r("street2"),sx:u,slotProps:{htmlInput:{"aria-label":l.street2}}})}),e.jsx(s,{size:{xs:12,sm:6,md:5},children:e.jsx(n,{fullWidth:!0,label:l.city,required:d,value:a.city||"",onChange:r("city"),sx:u,slotProps:{htmlInput:{"aria-label":l.city}}})}),e.jsx(s,{size:{xs:12,sm:6,md:4},children:e.jsx(n,{fullWidth:!0,label:l.state,value:a.state||"",onChange:r("state"),sx:u,slotProps:{htmlInput:{"aria-label":l.state}}})}),e.jsx(s,{size:{xs:12,sm:6,md:3},children:e.jsx(n,{fullWidth:!0,label:l.postalCode,value:a.postalCode||"",onChange:r("postalCode"),sx:u,slotProps:{htmlInput:{"aria-label":l.postalCode}}})}),e.jsx(s,{size:{xs:12,sm:6},children:e.jsx(n,{select:!0,fullWidth:!0,label:l.country,required:d,value:a.country||"",onChange:r("country"),sx:u,slotProps:{select:{inputProps:{"aria-label":l.country}}},children:S.map(t=>e.jsx(j,{value:t.value,children:t.label},t.value))})})]})}exports.default=f;
package/dist/ai/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../AIForm-Dv8ahXyE.js");exports.AIFill=e.AIFill;exports.AIForm=e.AIForm;exports.AIFormGenerator=e.AIFormGenerator;exports.AISchemaReview=e.AISchemaReview;exports.AITextAssist=e.AITextAssist;exports.AIVisionImport=e.AIVisionImport;exports.createAIClient=e.createAIClient;exports.formFieldsToSimple=e.formFieldsToSimple;exports.simpleFieldsToFormFields=e.simpleFieldsToFormFields;exports.slug=e.slug;exports.useAIAssist=e.useAIAssist;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../AIForm-D8_6RVmA.js");exports.AIFill=e.AIFill;exports.AIForm=e.AIForm;exports.AIFormGenerator=e.AIFormGenerator;exports.AISchemaReview=e.AISchemaReview;exports.AITextAssist=e.AITextAssist;exports.AIVisionImport=e.AIVisionImport;exports.createAIClient=e.createAIClient;exports.formFieldsToSimple=e.formFieldsToSimple;exports.simpleFieldsToFormFields=e.simpleFieldsToFormFields;exports.slug=e.slug;exports.useAIAssist=e.useAIAssist;
package/dist/ai/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { A as a, a as i, b as o, c as A, d as r, e as l, f as m, g as I, s as t, h as F, u as d } from "../AIForm-DtRl0WdY.mjs";
1
+ import { A as a, a as i, b as o, c as A, d as r, e as l, f as m, g as I, s as t, h as F, u as d } from "../AIForm-BVJ7qhP5.mjs";
2
2
  export {
3
3
  a as AIFill,
4
4
  i as AIForm,
@@ -0,0 +1,92 @@
1
+ import { jsx as c, jsxs as k, Fragment as F } from "react/jsx-runtime";
2
+ import { useState as f, useRef as y, useEffect as K, createElement as L } from "react";
3
+ import M from "@mui/material/Autocomplete";
4
+ import _ from "@mui/material/TextField";
5
+ import z from "@mui/material/CircularProgress";
6
+ import { j as V, k as w } from "./AIForm-BVJ7qhP5.mjs";
7
+ function Q({ attributes: r = {}, rules: v = {}, onChange: A }) {
8
+ const {
9
+ MuiAttributes: C = {},
10
+ id: x = "",
11
+ label: O = "Search",
12
+ placeholder: P = "",
13
+ minChars: S = 1,
14
+ debounceMs: j = 300,
15
+ labelKey: q = "label",
16
+ valueKey: p = "value",
17
+ loadOptions: m,
18
+ optionsUrl: u
19
+ } = r, [T, d] = f(r.value ?? null), [b, l] = f([]), [h, o] = f(!1), s = y(0), t = y(null);
20
+ V(() => {
21
+ d(r.value ?? null);
22
+ }, [r.value]), K(() => () => {
23
+ t.current && clearTimeout(t.current);
24
+ }, []);
25
+ const E = async (e) => {
26
+ if (typeof m == "function")
27
+ return m(e);
28
+ if (u) {
29
+ const n = `${u}${u.includes("?") ? "&" : "?"}q=${encodeURIComponent(e)}`, g = await (await fetch(n)).json();
30
+ return Array.isArray(g) ? g : [];
31
+ }
32
+ return [];
33
+ }, I = (e) => {
34
+ const n = ++s.current;
35
+ o(!0), E(e).then((a) => {
36
+ n === s.current && (l(Array.isArray(a) ? a : []), o(!1));
37
+ }).catch(() => {
38
+ n === s.current && (l([]), o(!1));
39
+ });
40
+ }, R = (e, n) => {
41
+ if (t.current && clearTimeout(t.current), !n || n.length < S) {
42
+ s.current++, o(!1), l([]);
43
+ return;
44
+ }
45
+ t.current = setTimeout(() => {
46
+ I(n);
47
+ }, j);
48
+ }, U = (e, n) => {
49
+ d(n), A?.({
50
+ id: x,
51
+ value: n != null ? n?.[p] ?? n : n,
52
+ option: n
53
+ });
54
+ }, i = (e) => typeof e == "string" ? e : e?.[q] ?? "", $ = !!v?.validation?.some((e) => e.rule === "mandatory");
55
+ return /* @__PURE__ */ c(
56
+ M,
57
+ {
58
+ value: T,
59
+ onChange: U,
60
+ onInputChange: R,
61
+ options: b,
62
+ loading: h,
63
+ filterOptions: (e) => e,
64
+ getOptionLabel: i,
65
+ renderOption: (e, n) => /* @__PURE__ */ L("li", { ...e, key: (n && n[p]) ?? i(n) }, i(n)),
66
+ ...C,
67
+ renderInput: (e) => /* @__PURE__ */ c(
68
+ _,
69
+ {
70
+ ...e,
71
+ label: O,
72
+ placeholder: P,
73
+ required: $,
74
+ sx: w,
75
+ slotProps: {
76
+ ...e.slotProps,
77
+ input: {
78
+ ...e.slotProps.input,
79
+ endAdornment: /* @__PURE__ */ k(F, { children: [
80
+ h ? /* @__PURE__ */ c(z, { color: "inherit", size: 20 }) : null,
81
+ e.slotProps.input.endAdornment
82
+ ] })
83
+ }
84
+ }
85
+ }
86
+ )
87
+ }
88
+ );
89
+ }
90
+ export {
91
+ Q as default
92
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),n=require("react"),U=require("@mui/material/Autocomplete"),$=require("@mui/material/TextField"),K=require("@mui/material/CircularProgress"),y=require("./AIForm-D8_6RVmA.js");function L({attributes:u={},rules:v={},onChange:A}){const{MuiAttributes:q={},id:S="",label:x="Search",placeholder:j="",minChars:C=1,debounceMs:O=300,labelKey:P="label",valueKey:d="value",loadOptions:p,optionsUrl:c}=u,[R,h]=n.useState(u.value??null),[b,i]=n.useState([]),[m,s]=n.useState(!1),l=n.useRef(0),r=n.useRef(null);y.useUpdateEffect(()=>{h(u.value??null)},[u.value]),n.useEffect(()=>()=>{r.current&&clearTimeout(r.current)},[]);const T=async e=>{if(typeof p=="function")return p(e);if(c){const t=`${c}${c.includes("?")?"&":"?"}q=${encodeURIComponent(e)}`,g=await(await fetch(t)).json();return Array.isArray(g)?g:[]}return[]},I=e=>{const t=++l.current;s(!0),T(e).then(f=>{t===l.current&&(i(Array.isArray(f)?f:[]),s(!1))}).catch(()=>{t===l.current&&(i([]),s(!1))})},E=(e,t)=>{if(r.current&&clearTimeout(r.current),!t||t.length<C){l.current++,s(!1),i([]);return}r.current=setTimeout(()=>{I(t)},O)},F=(e,t)=>{h(t),A?.({id:S,value:t!=null?t?.[d]??t:t,option:t})},a=e=>typeof e=="string"?e:e?.[P]??"",M=!!v?.validation?.some(e=>e.rule==="mandatory");return o.jsx(U,{value:R,onChange:F,onInputChange:E,options:b,loading:m,filterOptions:e=>e,getOptionLabel:a,renderOption:(e,t)=>n.createElement("li",{...e,key:(t&&t[d])??a(t)},a(t)),...q,renderInput:e=>o.jsx($,{...e,label:x,placeholder:j,required:M,sx:y.premiumInputSx,slotProps:{...e.slotProps,input:{...e.slotProps.input,endAdornment:o.jsxs(o.Fragment,{children:[m?o.jsx(K,{color:"inherit",size:20}):null,e.slotProps.input.endAdornment]})}}})})}exports.default=L;
@@ -2,7 +2,7 @@ import { jsx as r } from "react/jsx-runtime";
2
2
  import i, { Suspense as s } from "react";
3
3
  import n from "@mui/material/Box";
4
4
  import f from "@mui/material/CircularProgress";
5
- import { i as m } from "./AIForm-DtRl0WdY.mjs";
5
+ import { i as m } from "./AIForm-BVJ7qhP5.mjs";
6
6
  const c = i.lazy(
7
7
  () => import("@mui/x-charts/BarChart").then((t) => ({ default: t.BarChart }))
8
8
  );
@@ -1 +1 @@
1
- "use strict";var o=Object.create;var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var x=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of l(e))!d.call(t,s)&&s!==r&&a(t,s,{get:()=>e[s],enumerable:!(i=c(e,s))||i.enumerable});return t};var f=(t,e,r)=>(r=t!=null?o(h(t)):{},x(e||!t||!t.__esModule?a(r,"default",{value:t,enumerable:!0}):r,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=require("react"),j=require("@mui/material/Box"),C=require("@mui/material/CircularProgress"),y=require("./AIForm-Dv8ahXyE.js"),g=u.lazy(()=>import("@mui/x-charts/BarChart").then(t=>({default:t.BarChart})));function p({attributes:t={}}){const{MuiChartAttributes:e={},id:r=""}=t,i=y.getMuiX("BarChart")||g;return n.jsx(u.Suspense,{fallback:n.jsx(j,{sx:{display:"flex",justifyContent:"center",p:2},children:n.jsx(C,{})}),children:n.jsx(i,{height:300,...e},r)})}exports.default=p;
1
+ "use strict";var o=Object.create;var a=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var x=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of l(e))!d.call(t,s)&&s!==r&&a(t,s,{get:()=>e[s],enumerable:!(i=c(e,s))||i.enumerable});return t};var f=(t,e,r)=>(r=t!=null?o(h(t)):{},x(e||!t||!t.__esModule?a(r,"default",{value:t,enumerable:!0}):r,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),u=require("react"),j=require("@mui/material/Box"),C=require("@mui/material/CircularProgress"),y=require("./AIForm-D8_6RVmA.js"),g=u.lazy(()=>import("@mui/x-charts/BarChart").then(t=>({default:t.BarChart})));function p({attributes:t={}}){const{MuiChartAttributes:e={},id:r=""}=t,i=y.getMuiX("BarChart")||g;return n.jsx(u.Suspense,{fallback:n.jsx(j,{sx:{display:"flex",justifyContent:"center",p:2},children:n.jsx(C,{})}),children:n.jsx(i,{height:300,...e},r)})}exports.default=p;
@@ -0,0 +1,66 @@
1
+ import { jsxs as k, jsx as p } from "react/jsx-runtime";
2
+ import x, { useCallback as C } from "react";
3
+ import E from "@mui/material/TextField";
4
+ import y from "@mui/material/MenuItem";
5
+ import { j as S, m as I, k as O } from "./AIForm-BVJ7qhP5.mjs";
6
+ const P = (t) => Array.isArray(t) ? t.map(
7
+ (e) => e != null && typeof e == "object" ? { value: e.value, label: e.label ?? e.title ?? String(e.value) } : { value: e, label: String(e) }
8
+ ) : [], h = (t, e, a) => {
9
+ const r = t && e != null && e !== "" ? t[e] : void 0;
10
+ return P(r ?? a ?? []);
11
+ };
12
+ function U({ attributes: t = {}, rules: e = {}, onChange: a }) {
13
+ const {
14
+ id: r = "",
15
+ parentValue: u,
16
+ optionsMap: o,
17
+ options: i,
18
+ label: v = "",
19
+ placeholder: c = "",
20
+ MuiAttributes: f = {}
21
+ } = t, b = e?.validation?.some(
22
+ (l) => l.rule === "mandatory" || l.rule === "mandatoryselect"
23
+ ) || !1, [m, g] = x.useState(
24
+ () => h(o, u, i)
25
+ ), [s, d] = x.useState(() => t?.value ?? "");
26
+ S(() => {
27
+ d(t?.value ?? "");
28
+ }, [t?.value]), S(() => {
29
+ const l = h(o, u, i);
30
+ g(l), s !== "" && s != null && !l.some((n) => n.value === s) && (d(""), a?.({ id: r, value: "", option: null }));
31
+ }, [u, o, i]);
32
+ const j = C(
33
+ (l) => {
34
+ const n = l.target.value, M = m.find((A) => A.value === n) ?? null;
35
+ d(n), a?.({ id: r, value: n, option: M });
36
+ },
37
+ [m, r, a]
38
+ );
39
+ return /* @__PURE__ */ k(
40
+ E,
41
+ {
42
+ select: !0,
43
+ fullWidth: !0,
44
+ label: v,
45
+ placeholder: c,
46
+ required: b,
47
+ value: s ?? "",
48
+ onChange: j,
49
+ ...f,
50
+ sx: I(O, f?.sx),
51
+ slotProps: {
52
+ select: {
53
+ displayEmpty: !0,
54
+ inputProps: { "aria-label": v || "cascade-select" }
55
+ }
56
+ },
57
+ children: [
58
+ c ? /* @__PURE__ */ p(y, { value: "", children: /* @__PURE__ */ p("em", { children: c }) }) : null,
59
+ m.map((l) => /* @__PURE__ */ p(y, { value: l.value, children: l.label }, String(l.value)))
60
+ ]
61
+ }
62
+ );
63
+ }
64
+ export {
65
+ U as default
66
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),f=require("react"),A=require("@mui/material/TextField"),S=require("@mui/material/MenuItem"),i=require("./AIForm-D8_6RVmA.js"),E=t=>Array.isArray(t)?t.map(e=>e!=null&&typeof e=="object"?{value:e.value,label:e.label??e.title??String(e.value)}:{value:e,label:String(e)}):[],b=(t,e,a)=>{const u=t&&e!=null&&e!==""?t[e]:void 0;return E(u??a??[])};function I({attributes:t={},rules:e={},onChange:a}){const{id:u="",parentValue:o,optionsMap:c,options:d,label:x="",placeholder:v="",MuiAttributes:y={}}=t,g=e?.validation?.some(l=>l.rule==="mandatory"||l.rule==="mandatoryselect")||!1,[p,h]=f.useState(()=>b(c,o,d)),[r,m]=f.useState(()=>t?.value??"");i.useUpdateEffect(()=>{m(t?.value??"")},[t?.value]),i.useUpdateEffect(()=>{const l=b(c,o,d);h(l),r!==""&&r!=null&&!l.some(n=>n.value===r)&&(m(""),a?.({id:u,value:"",option:null}))},[o,c,d]);const j=f.useCallback(l=>{const n=l.target.value,q=p.find(M=>M.value===n)??null;m(n),a?.({id:u,value:n,option:q})},[p,u,a]);return s.jsxs(A,{select:!0,fullWidth:!0,label:x,placeholder:v,required:g,value:r??"",onChange:j,...y,sx:i.mergeSx(i.premiumInputSx,y?.sx),slotProps:{select:{displayEmpty:!0,inputProps:{"aria-label":x||"cascade-select"}}},children:[v?s.jsx(S,{value:"",children:s.jsx("em",{children:v})}):null,p.map(l=>s.jsx(S,{value:l.value,children:l.label},String(l.value)))]})}exports.default=I;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),L=require("react"),x=require("./AIForm-D8_6RVmA.js"),n=require("@mui/material"),c=require("@mui/material/styles");let Ne=0;const Q=()=>`dmui-col-${++Ne}`,qe=e=>(e.collections||[]).map(o=>o.id),Ue=e=>Object.fromEntries(qe(e).map(o=>[o,[]])),pe=(e,o)=>x.toItems(e).map(r=>{const a=new Set(qe(o)),i=Object.fromEntries(Object.entries(r).filter(([p])=>!a.has(p))),s=Object.fromEntries((o.collections||[]).map(p=>[p.id,pe(r[p.id],p)]));return{key:Q(),data:i,children:s}}),he=(e,o)=>e.map(r=>{const a={...r.data};return(o.collections||[]).forEach(i=>{a[i.id]=he(r.children[i.id]||[],i)}),a}),_e=e=>({key:Q(),data:x.cloneDeep(e.data),children:Object.fromEntries(Object.entries(e.children).map(([o,r])=>[o,r.map(_e)]))});var ne,ve;function Oe(){if(ve)return ne;ve=1;var e=x.require_baseAssignValue(),o=x.requireEq();function r(a,i,s){(s!==void 0&&!o(a[i],s)||s===void 0&&!(i in a))&&e(a,i,s)}return ne=r,ne}var oe,Te;function Ke(){if(Te)return oe;Te=1;var e=x.requireIsArrayLike(),o=x.requireIsObjectLike();function r(a){return o(a)&&e(a)}return oe=r,oe}var re,Ie;function Xe(){if(Ie)return re;Ie=1;var e=x.require_baseGetTag(),o=x.require_getPrototype(),r=x.requireIsObjectLike(),a="[object Object]",i=Function.prototype,s=Object.prototype,p=i.toString,m=s.hasOwnProperty,g=p.call(Object);function h(b){if(!r(b)||e(b)!=a)return!1;var u=o(b);if(u===null)return!0;var l=m.call(u,"constructor")&&u.constructor;return typeof l=="function"&&l instanceof l&&p.call(l)==g}return re=h,re}var ae,Se;function $e(){if(Se)return ae;Se=1;function e(o,r){if(!(r==="constructor"&&typeof o[r]=="function")&&r!="__proto__")return o[r]}return ae=e,ae}var le,Ce;function Je(){if(Ce)return le;Ce=1;var e=x.require_copyObject(),o=x.requireKeysIn();function r(a){return e(a,o(a))}return le=r,le}var ie,Be;function Qe(){if(Be)return ie;Be=1;var e=Oe(),o=x.require_cloneBuffer(),r=x.require_cloneTypedArray(),a=x.require_copyArray(),i=x.require_initCloneObject(),s=x.requireIsArguments(),p=x.requireIsArray(),m=Ke(),g=x.requireIsBuffer(),h=x.requireIsFunction(),b=x.requireIsObject(),u=Xe(),l=x.requireIsTypedArray(),y=$e(),j=Je();function w(C,I,A,_,W,M,q){var S=y(C,A),v=y(I,A),F=q.get(v);if(F){e(C,A,F);return}var z=M?M(S,v,A+"",C,I,q):void 0,O=z===void 0;if(O){var $=p(v),R=!$&&g(v),G=!$&&!R&&l(v);z=v,$||R||G?p(S)?z=S:m(S)?z=a(S):R?(O=!1,z=o(v,!0)):G?(O=!1,z=r(v,!0)):z=[]:u(v)||s(v)?(z=S,s(S)?z=j(S):(!b(S)||h(S))&&(z=i(v))):O=!1}O&&(q.set(v,z),W(z,v,_,M,q),q.delete(v)),e(C,A,z)}return ie=w,ie}var se,we;function Ye(){if(we)return se;we=1;var e=x.require_Stack(),o=Oe(),r=x.require_baseFor(),a=Qe(),i=x.requireIsObject(),s=x.requireKeysIn(),p=$e();function m(g,h,b,u,l){g!==h&&r(h,function(y,j){if(l||(l=new e),i(y))a(g,h,j,b,m,u,l);else{var w=u?u(p(g,j),y,j+"",g,h,l):void 0;w===void 0&&(w=y),o(g,j,w)}},s)}return se=m,se}var ce,ke;function Ze(){if(ke)return ce;ke=1;var e=x.require_baseRest(),o=x.require_isIterateeCall();function r(a){return e(function(i,s){var p=-1,m=s.length,g=m>1?s[m-1]:void 0,h=m>2?s[2]:void 0;for(g=a.length>3&&typeof g=="function"?(m--,g):void 0,h&&o(s[0],s[1],h)&&(g=m<3?void 0:g,m=1),i=Object(i);++p<m;){var b=s[p];b&&a(i,b,p,g)}return i})}return ce=r,ce}var de,Ae;function et(){if(Ae)return de;Ae=1;var e=Ye(),o=Ze(),r=o(function(a,i,s){e(a,i,s)});return de=r,de}var tt=et();const nt=x.getDefaultExportFromCjs(tt),Re=(e,o)=>{const r=e.palette[o||"primary"];if(r&&typeof r=="object"&&r.main)return r;try{return e.palette.augmentColor({color:{main:String(o)}})}catch{return e.palette.primary}},De=(e,o)=>e.palette.mode==="dark"?o.light:o.dark,ot={add:"Add {label}",addMore:"Add another {labelLower}",emptyTitle:"No {pluralLower} yet",emptyText:void 0,edit:"Edit",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",delete:"Delete",more:"More actions",collapse:"Collapse",expand:"Expand",editAria:"Edit {title}",deleteAria:"Delete {title}",viewAria:"View {title}",moreAria:"More actions for {title}",collapseAria:"Collapse {title}",expandAria:"Expand {title}",maxReached:"Maximum of {max} reached",dialogAddTitle:"Add {label}",dialogEditTitle:"Edit {label}",dialogViewTitle:"{label}",dialogContext:"For {parent}",save:"Add {label}",saveChanges:"Save changes",saveAndAddAnother:"Save & add another",cancel:"Cancel",close:"Close",closeAria:"Close dialog",shortcut:"⌘/Ctrl + Enter",deleteTitle:"Delete {labelLower}?",deleteMessage:"{title} will be removed{detail}. This can’t be undone.",deleteDetail:", along with {detail}",deleteConfirm:"Delete"},rt=(e,o)=>e.replace(/\{(\w+)\}/g,(r,a)=>o[a]!=null?String(o[a]):r),at=(e,o)=>{if(e==null)return`repeat(auto-fill, minmax(min(${o}px, 100%), 1fr))`;const r=a=>`repeat(${Math.max(1,a)}, minmax(0, 1fr))`;return typeof e=="number"?r(e):Object.fromEntries(Object.entries(e).map(([a,i])=>[a,r(Number(i))]))},ze=e=>e==null?[]:Array.isArray(e)?e:[e],lt=(e,o,r,a={})=>{const i=r>0,s=Re(e,o.color),p=x.itemLabelOf(o),m=x.titleOf(o),g={...ot,...a,...o.texts||{}},h=o.styles||{},b={label:p,labelLower:p.toLowerCase(),plural:m,pluralLower:m.toLowerCase(),max:o.max};return{config:o,depth:r,nested:i,accent:s,ink:De(e,s),icon:o.icon||(i?"label":"folder_open"),itemLabel:p,plural:m,texts:g,layout:o.layout||(i?"table":"cards"),variant:o.variant||"outlined",addButton:{position:"header",variant:i?"outlined":"contained",icon:"add",...o.addButton||{}},actions:{edit:!0,delete:!0,duplicate:!1,move:!1,collapse:!1,...o.actions||{}},t:(u,l={})=>rt(String(g[u]??""),{...b,...l}),sx:(u,l)=>[...ze(l),...ze(h[u])],merged:(u,l={})=>nt({},l,h[u]||{})}},U="cubic-bezier(0.4, 0, 0.2, 1)";function it({ui:e,n:o}){const r=c.useTheme();return t.jsx(n.Box,{component:"span",sx:e.sx("headerCount",{minWidth:22,height:20,px:.75,borderRadius:"999px",display:"inline-grid",placeItems:"center",fontSize:11.5,fontWeight:700,bgcolor:o>0?c.alpha(e.accent.main,.12):c.alpha(r.palette.text.primary,.07),color:o>0?e.ink:"text.secondary",border:`1px solid ${o>0?c.alpha(e.accent.main,.2):"transparent"}`}),children:o})}const st=e=>e.split(/\s+/).map(o=>o.match(/[A-Za-z0-9]/)?.[0]||"").filter(Boolean).slice(0,2).join("").toUpperCase()||"#";function ct({ui:e,mode:o,title:r,index:a}){return o==="none"?null:t.jsx(n.Box,{sx:e.sx("avatar",{width:40,height:40,flexShrink:0,borderRadius:"10px",display:"grid",placeItems:"center",fontWeight:600,fontSize:14,bgcolor:c.alpha(e.accent.main,.1),color:e.ink,"& .MuiIcon-root":{fontSize:20}}),children:o==="initials"?st(r):o==="index"?a+1:t.jsx(n.Icon,{children:e.icon})})}function dt({ui:e,text:o,color:r}){const a=c.useTheme(),i=r==="default"?null:Re(a,r);return t.jsx(n.Box,{component:"span",sx:e.sx("badge",{display:"inline-flex",alignItems:"center",gap:.5,px:1.25,py:.3,borderRadius:"999px",fontSize:11.5,fontWeight:700,lineHeight:1.6,whiteSpace:"nowrap",letterSpacing:"0.02em",bgcolor:i?c.alpha(i.main,.1):c.alpha(a.palette.text.primary,.06),color:i?De(a,i):"text.secondary",border:`1px solid ${i?c.alpha(i.main,.25):c.alpha(a.palette.text.primary,.12)}`,"&::before":{content:'""',width:6,height:6,borderRadius:"50%",bgcolor:i?i.main:"text.disabled",flexShrink:0}}),children:o})}function Me({ui:e,placement:o,empty:r,disabled:a,onClick:i}){const{variant:s,icon:p,size:m,fullWidth:g}=e.addButton,h=o==="footer"&&!r?e.t("addMore"):e.t("add"),b=e.config.max!=null&&a,u=!!g||s==="dashed"&&g!==!1,l=j=>t.jsx(n.Tooltip,{title:b?e.t("maxReached"):"",children:t.jsx(n.Box,{component:"span",sx:{display:u?"block":"inline-flex",flexShrink:0},children:j})});if(s==="dashed")return l(t.jsxs(n.ButtonBase,{onClick:i,disabled:a,sx:e.sx("addButton",{width:u?"100%":"auto",display:"flex",alignItems:"center",justifyContent:"center",gap:.75,py:1.1,px:2,borderRadius:"8px",border:`1px dashed ${c.alpha(e.accent.main,.5)}`,color:e.ink,fontFamily:"inherit",fontSize:14,fontWeight:600,transition:`background-color .15s ${U}`,"&:hover":{bgcolor:c.alpha(e.accent.main,.06)},"&.Mui-focusVisible":{outline:`2px solid ${c.alpha(e.accent.main,.5)}`,outlineOffset:2},"&.Mui-disabled":{opacity:.5},"& .MuiIcon-root":{fontSize:19}}),children:[t.jsx(n.Icon,{children:p}),h]}));const y={contained:{bgcolor:e.accent.main,color:e.accent.contrastText,"&:hover":{bgcolor:e.accent.dark}},outlined:{color:e.ink,borderColor:c.alpha(e.accent.main,.5),"&:hover":{borderColor:e.accent.main,bgcolor:c.alpha(e.accent.main,.05)}},text:{color:e.ink,"&:hover":{bgcolor:c.alpha(e.accent.main,.07)}},soft:{color:e.ink,bgcolor:c.alpha(e.accent.main,.1),"&:hover":{bgcolor:c.alpha(e.accent.main,.16)}}}[s]||{};return l(t.jsx(n.Button,{onClick:i,disabled:a,variant:s==="soft"?"text":s,color:"inherit",size:m||(e.nested?"small":"medium"),fullWidth:g,disableElevation:!0,startIcon:t.jsx(n.Icon,{children:p}),sx:e.sx("addButton",{textTransform:"none",fontWeight:600,borderRadius:"8px",px:e.nested?1.5:2,whiteSpace:"nowrap",...y}),children:h}))}const xt=e=>/^[aeiou]/i.test(e)?"an":"a",pt=e=>e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`,ht=e=>{if(e.nested)return"";const o=e.itemLabel.toLowerCase(),r=(e.config.collections||[]).map(a=>x.pluralize(x.itemLabelOf(a)).toLowerCase());return r.length?`Add ${xt(o)} ${o}, then add its ${pt(r)}.`:`Add your first ${o} to get started.`};function mt({ui:e,readOnly:o,error:r}){const a=c.useTheme(),i=e.texts.emptyText!=null?e.t("emptyText"):ht(e);return e.nested?t.jsx(n.Typography,{sx:e.sx("empty",{fontSize:13,color:"text.disabled",fontStyle:"italic",py:.75,px:0,display:"block"}),children:e.t("emptyTitle")}):t.jsxs(n.Box,{sx:e.sx("empty",{py:5,px:3,textAlign:"center",borderRadius:"10px",border:`1.5px dashed ${r?a.palette.error.main:c.alpha(a.palette.text.primary,.15)}`,bgcolor:r?c.alpha(a.palette.error.main,.03):c.alpha(a.palette.text.primary,.02)}),children:[t.jsx(n.Box,{sx:{width:48,height:48,borderRadius:"50%",bgcolor:c.alpha(e.accent.main,.1),display:"flex",alignItems:"center",justifyContent:"center",mx:"auto",mb:1.5},children:t.jsx(n.Icon,{sx:{color:e.ink,fontSize:"22px !important"},children:e.icon||"inbox"})}),t.jsx(n.Typography,{sx:e.sx("emptyTitle",{fontSize:15,fontWeight:600,color:"text.primary"}),children:e.t("emptyTitle")}),i&&!o&&t.jsx(n.Typography,{sx:e.sx("emptyText",{fontSize:13.5,color:"text.secondary",mt:.5,maxWidth:380,mx:"auto"}),children:i})]})}function ft({ui:e,open:o,mode:r,guid:a,session:i,initial:s,context:p,onClose:m,onSave:g}){const h=c.useTheme(),b=e.config.dialog||{},u=n.useMediaQuery(h.breakpoints.down("sm")),l=b.fullScreen===!0||b.fullScreen!==!1&&u,y=L.useRef(null),[j,w]=L.useState(0),{accent:C}=e,I=e.t(r==="add"?"dialogAddTitle":r==="edit"?"dialogEditTitle":"dialogViewTitle"),A=`${a}-dialog-${i}-${j}`,_=e.t("dialogContext"),[W,M]=_.includes("{parent}")?_.split("{parent}"):[_,null],q=S=>{const v=y.current;!v||!v.validate()||(g({...v.getValues()},S),S&&w(F=>F+1))};return t.jsxs(n.Dialog,{open:o,onClose:(S,v)=>{v!=="backdropClick"&&m()},fullScreen:l,fullWidth:!0,maxWidth:b.maxWidth||"sm","aria-labelledby":`${a}-dialog-title`,onKeyDown:S=>{r!=="view"&&S.key==="Enter"&&(S.metaKey||S.ctrlKey)&&(S.preventDefault(),q(!1))},sx:{"& .MuiDialog-paper":e.merged("dialog",{borderRadius:l?0:"12px",backgroundImage:"none"})},children:[t.jsxs(n.Box,{sx:e.sx("dialogHeader",{display:"flex",alignItems:"flex-start",gap:1,px:{xs:2,sm:3},pt:2.5,pb:2,borderBottom:`1px solid ${h.palette.divider}`}),children:[t.jsxs(n.Box,{sx:{flex:1,minWidth:0},children:[t.jsx(n.Typography,{id:`${a}-dialog-title`,sx:e.sx("dialogTitle",{fontWeight:600,fontSize:18,lineHeight:1.3}),children:I}),p&&t.jsxs(n.Typography,{sx:e.sx("dialogContext",{fontSize:13.5,color:"text.secondary",mt:.25}),children:[W,M!==null&&t.jsx(n.Box,{component:"strong",sx:{color:"text.primary",fontWeight:600},children:p}),M]}),b.description&&t.jsx(n.Typography,{sx:e.sx("dialogDescription",{fontSize:13.5,color:"text.secondary",mt:.25}),children:b.description})]}),t.jsx(n.IconButton,{"aria-label":e.t("closeAria"),onClick:m,size:"small",sx:{mt:-.5,mr:-1,color:"text.secondary"},children:t.jsx(n.Icon,{children:"close"})})]}),t.jsx(n.DialogContent,{sx:e.sx("dialogContent",{px:{xs:2,sm:3},pt:"20px !important",pb:3}),children:t.jsx(x.FormGenerator,{guid:A,data:e.config.fields||[],patch:r==="add"?{}:s||{},apiRef:y,readOnly:r==="view",MuiGridAttributes:{spacing:b.spacing??2}},A)}),t.jsx(n.DialogActions,{sx:e.sx("dialogActions",{px:{xs:2,sm:3},py:1.5,gap:1,flexWrap:"wrap",borderTop:`1px solid ${h.palette.divider}`,"& .MuiButton-root":{textTransform:"none",fontWeight:600,borderRadius:"8px",px:2,whiteSpace:"nowrap",ml:"0 !important"}}),children:r==="view"?t.jsx(n.Button,{variant:"contained",disableElevation:!0,onClick:m,sx:e.sx("dialogSave",{bgcolor:C.main,color:C.contrastText,"&:hover":{bgcolor:C.dark}}),children:e.t("close")}):t.jsxs(t.Fragment,{children:[t.jsx(n.Button,{onClick:m,color:"inherit",sx:e.sx("dialogCancel",{color:"text.secondary"}),children:e.t("cancel")}),r==="add"&&b.addAnother!==!1&&t.jsx(n.Button,{variant:"outlined",color:"inherit",onClick:()=>q(!0),sx:e.sx("dialogSaveAnother",{color:e.ink,borderColor:c.alpha(C.main,.5),"&:hover":{borderColor:C.main,bgcolor:c.alpha(C.main,.06)}}),children:e.t("saveAndAddAnother")}),t.jsx(n.Tooltip,{title:e.t("shortcut"),placement:"top",describeChild:!0,children:t.jsx(n.Button,{variant:"contained",color:"inherit",disableElevation:!0,startIcon:t.jsx(n.Icon,{children:r==="add"?"add":"check"}),onClick:()=>q(!1),sx:e.sx("dialogSave",{bgcolor:C.main,color:C.contrastText,"&:hover":{bgcolor:C.dark}}),children:r==="add"?e.t("save"):e.t("saveChanges")})})]})})]})}function gt({ui:e,count:o,required:r,action:a,alone:i=!1}){const{nested:s}=e;return t.jsxs(n.Box,{sx:e.sx("header",{display:"flex",alignItems:"center",gap:1.5,mb:i?0:s?1.25:2.5,flexWrap:"wrap"}),children:[t.jsxs(n.Box,{sx:{flex:1,minWidth:s?140:{xs:"100%",sm:220}},children:[t.jsxs(n.Box,{sx:{display:"flex",alignItems:"center",gap:s?.75:1},children:[e.config.icon&&t.jsx(n.Box,{sx:{width:s?26:32,height:s?26:32,borderRadius:s?"6px":"8px",bgcolor:c.alpha(e.accent.main,.12),display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:t.jsx(n.Icon,{sx:e.sx("headerIcon",{color:e.ink,fontSize:`${s?14:18}px !important`}),children:e.icon})}),t.jsxs(n.Typography,{sx:e.sx("headerTitle",{fontWeight:700,fontSize:s?14:19,lineHeight:1.3,color:"text.primary"}),children:[e.plural,r&&t.jsx(n.Box,{component:"span",sx:{color:"error.main",ml:.25},children:"*"})]}),t.jsx(it,{ui:e,n:o})]}),e.config.description&&t.jsx(n.Typography,{sx:e.sx("headerDescription",{fontSize:13.5,color:"text.secondary",mt:.5,ml:s?0:e.config.icon?"44px":0}),children:e.config.description})]}),a]})}function me({ui:e,title:o,canEdit:r,onOpen:a,size:i}){return t.jsx(n.ButtonBase,{onClick:a,"aria-label":r?void 0:e.t("viewAria",{title:o}),"aria-haspopup":"dialog",sx:e.sx("itemTitle",{borderRadius:"4px",textAlign:"left",justifyContent:"flex-start",fontFamily:"inherit",fontWeight:600,fontSize:i,lineHeight:1.4,color:"text.primary",wordBreak:"break-word","&:hover":{color:e.ink,textDecoration:"underline"},"&.Mui-focusVisible":{outline:`2px solid ${c.alpha(e.accent.main,.5)}`,outlineOffset:2}}),children:o})}function fe({ui:e,data:o}){const r=e.config.display||{},a=typeof r.badge=="string"?{field:r.badge}:r.badge;if(!a)return null;const i=o[a.field],s=x.formatValue(x.findField(e.config.fields||[],a.field),i);if(!s)return null;const p=a.colors?.[String(i)]??a.colors?.[s]??"default";return t.jsx(dt,{ui:e,text:s,color:p})}function ut({ui:e,title:o,readOnly:r,open:a,canToggle:i,onEdit:s,onDelete:p,onMenu:m,onToggle:g}){const h=c.useTheme(),b=!r&&e.actions.edit,u=!r&&e.actions.delete,l=!r&&(e.actions.duplicate||e.actions.move),y=(j,w)=>({width:30,height:30,borderRadius:"8px",color:j,transition:`background-color .15s ${U}, color .15s ${U}`,"&:hover":{bgcolor:w}});return t.jsxs(n.Box,{sx:e.sx("actions",{display:"flex",alignItems:"center",gap:.25,flexShrink:0}),children:[b&&t.jsx(n.Tooltip,{title:e.t("edit"),children:t.jsx(n.IconButton,{size:"small","aria-label":e.t("editAria",{title:o}),onClick:s,sx:e.sx("actionButton",y(e.ink,c.alpha(e.accent.main,.1))),children:t.jsx(n.Icon,{sx:{fontSize:"17px !important"},children:"edit"})})}),u&&t.jsx(n.Tooltip,{title:e.t("delete"),children:t.jsx(n.IconButton,{size:"small","aria-label":e.t("deleteAria",{title:o}),onClick:p,sx:e.sx("actionButton",y(h.palette.error.main,c.alpha(h.palette.error.main,.08))),children:t.jsx(n.Icon,{sx:{fontSize:"17px !important"},children:"delete_outline"})})}),l&&t.jsx(n.Tooltip,{title:e.t("more"),children:t.jsx(n.IconButton,{size:"small","aria-label":e.t("moreAria",{title:o}),onClick:j=>m(j.currentTarget),sx:e.sx("actionButton",y(h.palette.text.secondary,c.alpha(h.palette.text.primary,.07))),children:t.jsx(n.Icon,{sx:{fontSize:"17px !important"},children:"more_vert"})})}),i&&t.jsx(n.Tooltip,{title:a?e.t("collapse"):e.t("expand"),children:t.jsx(n.IconButton,{size:"small","aria-label":e.t(a?"collapseAria":"expandAria",{title:o}),"aria-expanded":a,onClick:g,sx:e.sx("actionButton",y(h.palette.text.secondary,c.alpha(h.palette.text.primary,.07))),children:t.jsx(n.Icon,{sx:{fontSize:"19px !important",transition:`transform .2s ${U}`,transform:a?"rotate(180deg)":"none"},children:"expand_more"})})})]})}function Ee({ui:e,node:o,guid:r,readOnly:a,issues:i,showErrors:s,texts:p,parentTitle:m,onChildChange:g}){const h=c.useTheme(),b=e.config.collections||[];return t.jsx(n.Box,{sx:e.sx("sections",{display:"grid",gridTemplateColumns:at(e.config.sectionColumns??1,320)}),children:b.map((u,l)=>t.jsx(n.Box,{sx:e.sx("section",{borderTop:`1px solid ${h.palette.divider}`,bgcolor:h.palette.mode==="dark"?c.alpha(h.palette.common.white,.02):c.alpha(h.palette.grey[500],.03),minWidth:0,...l>0?{borderLeft:`1px solid ${h.palette.divider}`}:{}}),children:t.jsx(n.Box,{sx:{px:{xs:2,sm:2.5},pt:{xs:1.5,sm:1.75},pb:{xs:1.25,sm:1.5}},children:t.jsx(We,{config:u,nodes:o.children[u.id]||[],onChange:y=>g(u.id,y),guid:`${r}-${o.key}`,depth:e.depth+1,readOnly:a,issues:i.filter(y=>y.path[0]===u.id).map(y=>({...y,path:y.path.slice(1)})),showErrors:s,parentTitle:m,texts:p})})},u.id))})}function bt({ui:e,node:o,index:r,guid:a,readOnly:i,collapsed:s,issues:p,showErrors:m,texts:g,onOpen:h,onDelete:b,onMenu:u,onToggle:l,onChildChange:y}){const j=c.useTheme(),{config:w}=e,C=w.display||{},{title:I,subtitle:A,details:_}=x.describeItem(o.data,w,r),W=w.collections||[],M=W.length>0,q=m&&p.length>0,S=C.avatar||"none",v=!i&&e.actions.edit,F=!i&&e.actions.delete,z=!i&&(e.actions.duplicate||e.actions.move),O=_.length>0||M,$=!s,R=q?c.alpha(j.palette.error.main,.05):c.alpha(e.accent.main,.05),G=q?c.alpha(j.palette.error.main,.2):c.alpha(e.accent.main,.15),P=(f,T)=>({width:30,height:30,borderRadius:"8px",color:f,transition:`background-color .15s ${U}`,"&:hover":{bgcolor:T}});return t.jsxs(n.Box,{sx:e.sx("item",{border:`1px solid ${q?j.palette.error.main:j.palette.divider}`,borderRadius:"14px",overflow:"hidden",bgcolor:"background.paper",boxShadow:`0 1px 3px ${c.alpha(j.palette.common.black,.06)}, 0 4px 12px ${c.alpha(j.palette.common.black,.04)}`}),children:[t.jsxs(n.Box,{sx:e.sx("itemHeader",{px:{xs:2,sm:2.5},pt:{xs:1.75,sm:2},pb:{xs:1.5,sm:1.75},bgcolor:R,borderBottom:$&&O?`1px solid ${G}`:"1px solid transparent",transition:`border-color .2s ${U}`,display:"flex",alignItems:"flex-start",gap:1.5}),children:[S!=="none"&&t.jsx(ct,{ui:e,mode:S,title:I,index:r}),t.jsxs(n.Box,{sx:{flex:1,minWidth:0},children:[t.jsxs(n.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.75,mb:A?.25:0},children:[t.jsx(me,{ui:e,title:I,canEdit:v,onOpen:h,size:15.5}),t.jsx(fe,{ui:e,data:o.data})]}),A&&t.jsxs(n.Typography,{sx:e.sx("subtitle",{display:"flex",alignItems:"center",gap:.4,fontSize:13,color:"text.secondary",wordBreak:"break-word","& .MuiIcon-root":{fontSize:14,color:"text.disabled"}}),children:[C.subtitleIcon&&t.jsx(n.Icon,{children:C.subtitleIcon}),A]}),!$&&M&&t.jsx(n.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.75,mt:.6},children:W.map(f=>{const T=(o.children[f.id]||[]).length;return t.jsxs(n.Box,{component:"span",sx:{fontSize:12,fontWeight:600,px:1,py:.2,borderRadius:"999px",bgcolor:c.alpha(e.accent.main,.08),color:e.ink,border:`1px solid ${c.alpha(e.accent.main,.18)}`},children:[T," ",x.pluralize(x.itemLabelOf(f),T).toLowerCase()]},f.id)})})]}),t.jsxs(n.Box,{sx:{display:"flex",alignItems:"center",flexShrink:0,gap:.25,mt:-.25},children:[v&&t.jsx(n.Tooltip,{title:e.t("edit"),children:t.jsx(n.IconButton,{size:"small","aria-label":e.t("editAria",{title:I}),onClick:h,sx:P(e.ink,c.alpha(e.accent.main,.1)),children:t.jsx(n.Icon,{sx:{fontSize:"17px !important"},children:"edit"})})}),F&&t.jsx(n.Tooltip,{title:e.t("delete"),children:t.jsx(n.IconButton,{size:"small","aria-label":e.t("deleteAria",{title:I}),onClick:b,sx:P(j.palette.error.main,c.alpha(j.palette.error.main,.08)),children:t.jsx(n.Icon,{sx:{fontSize:"17px !important"},children:"delete_outline"})})}),z&&t.jsx(n.Tooltip,{title:e.t("more"),children:t.jsx(n.IconButton,{size:"small","aria-label":e.t("moreAria",{title:I}),onClick:f=>u(f.currentTarget),sx:P(j.palette.text.secondary,c.alpha(j.palette.text.primary,.07)),children:t.jsx(n.Icon,{sx:{fontSize:"17px !important"},children:"more_vert"})})}),O&&t.jsx(n.Tooltip,{title:$?e.t("collapse"):e.t("expand"),children:t.jsx(n.IconButton,{size:"small","aria-label":e.t($?"collapseAria":"expandAria",{title:I}),onClick:l,sx:P(j.palette.text.secondary,c.alpha(j.palette.text.primary,.07)),children:t.jsx(n.Icon,{sx:{fontSize:"19px !important",transition:`transform .25s ${U}`,transform:$?"rotate(180deg)":"none"},children:"expand_more"})})})]})]}),O&&t.jsxs(n.Collapse,{in:$,timeout:220,children:[_.length>0&&t.jsx(n.Box,{sx:e.sx("details",{display:"flex",overflowX:"auto",borderBottom:M?`1px solid ${j.palette.divider}`:"none","&::-webkit-scrollbar":{height:0}}),children:_.map((f,T)=>t.jsxs(n.Box,{sx:e.sx("detail",{flex:"1 1 0",minWidth:90,maxWidth:220,px:{xs:2,sm:2.5},py:1.5,borderLeft:T>0?`1px solid ${j.palette.divider}`:"none"}),children:[t.jsxs(n.Typography,{sx:e.sx("detailLabel",{fontSize:10.5,fontWeight:700,letterSpacing:"0.07em",textTransform:"uppercase",color:"text.disabled",mb:.25,display:"flex",alignItems:"center",gap:.4,whiteSpace:"nowrap"}),children:[f.icon&&t.jsx(n.Icon,{sx:{fontSize:"11px !important"},children:f.icon}),f.label]}),t.jsx(n.Typography,{sx:e.sx("detailValue",{fontSize:13.5,fontWeight:600,color:f.value?"text.primary":"text.disabled",wordBreak:"break-word",lineHeight:1.4}),children:f.value||"—"})]},f.id))}),M&&t.jsx(Ee,{ui:e,node:o,guid:a,readOnly:i,issues:p,showErrors:m,texts:g,parentTitle:I,onChildChange:y})]})]})}function yt({ui:e,nodes:o,guid:r,readOnly:a,issues:i,showErrors:s,texts:p,isCollapsed:m,onToggle:g,onOpen:h,onDelete:b,onMenu:u,onChildChange:l}){const y=c.useTheme(),j=n.useMediaQuery(y.breakpoints.down("sm")),{config:w}=e,C=w.fields||[],I=w.display||{},A=x.detailSpecs(w),_=typeof I.badge=="string"?I.badge:I.badge?.field,W=typeof I.badge=="object"&&I.badge?.label||(_?x.fieldLabel(x.findField(C,_))||_:""),M=(w.collections||[]).length>0,q=!a&&e.actions.edit,S=!a&&(e.actions.edit||e.actions.delete||e.actions.duplicate||e.actions.move),v=f=>i.filter(T=>T.path[0]===f).map(T=>({...T,path:T.path.slice(1)})),F=t.jsx(n.Box,{component:"span",sx:{color:"text.disabled"},children:"—"}),z=(f,T,E)=>M&&t.jsx(n.Collapse,{in:!m(f.key),timeout:200,unmountOnExit:!0,children:t.jsx(Ee,{ui:e,node:f,guid:r,readOnly:a,issues:v(T),showErrors:s,texts:p,parentTitle:E,onChildChange:(V,N)=>l(T,V,N)})}),O=(f,T,E)=>t.jsx(ut,{ui:e,title:E,readOnly:a,open:!m(f.key),canToggle:M,onEdit:()=>h(T),onDelete:()=>b(T),onMenu:V=>u(V,T),onToggle:()=>g(f.key)}),$=c.alpha(y.palette.error.main,.06);if(j)return t.jsx(n.Box,{sx:e.sx("table",{border:`1px solid ${y.palette.divider}`,borderRadius:"8px",overflow:"hidden",bgcolor:"background.paper"}),children:o.map((f,T)=>{const{title:E,details:V}=x.describeItem(f.data,w,T),N=s&&v(T).length>0;return t.jsxs(n.Box,{sx:e.sx("mobileRow",{borderTop:T?`1px solid ${y.palette.divider}`:"none",...N?{bgcolor:$}:{}}),children:[t.jsxs(n.Box,{sx:{display:"flex",alignItems:"flex-start",gap:1,p:1.5},children:[t.jsxs(n.Box,{sx:{flex:1,minWidth:0},children:[t.jsxs(n.Box,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:1},children:[t.jsx(me,{ui:e,title:E,canEdit:q,onOpen:()=>h(T),size:14.5}),t.jsx(fe,{ui:e,data:f.data})]}),V.length>0&&t.jsx(n.Box,{sx:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:1.5,rowGap:.25,mt:.75},children:V.map(H=>t.jsxs(L.Fragment,{children:[t.jsx(n.Typography,{sx:e.sx("detailLabel",{fontSize:13,color:"text.secondary"}),children:H.label}),t.jsx(n.Typography,{sx:e.sx("detailValue",{fontSize:13,fontWeight:500,wordBreak:"break-word"}),children:H.value})]},H.id))})]}),(S||M)&&O(f,T,E)]}),z(f,T,E)]},f.key)})});const R=e.sx("tableHeadCell",{fontSize:12.5,fontWeight:600,color:"text.secondary",whiteSpace:"nowrap",py:1,px:1.75}),G=e.sx("tableCell",{fontSize:14,color:"text.primary",whiteSpace:"nowrap",py:1.1,px:1.75}),P=1+A.length+(_?1:0)+(S||M?1:0);return t.jsx(n.Box,{sx:e.sx("table",{border:`1px solid ${y.palette.divider}`,borderRadius:"8px",overflowX:"auto",bgcolor:"background.paper"}),children:t.jsxs(n.Table,{size:"small",children:[t.jsx(n.TableHead,{children:t.jsxs(n.TableRow,{sx:e.sx("tableHead",{bgcolor:c.alpha(y.palette.text.primary,y.palette.mode==="dark"?.05:.03)}),children:[t.jsx(n.TableCell,{sx:R,children:I.titleLabel||e.itemLabel}),A.map(f=>t.jsx(n.TableCell,{sx:R,children:f.label},f.id)),_&&t.jsx(n.TableCell,{sx:R,children:W}),(S||M)&&t.jsx(n.TableCell,{sx:R})]})}),t.jsx(n.TableBody,{children:o.map((f,T)=>{const{title:E}=x.describeItem(f.data,w,T),V=s&&v(T).length>0,N=T===o.length-1,H=N&&!(M&&!m(f.key))?{"& > td":{borderBottom:0}}:{};return t.jsxs(L.Fragment,{children:[t.jsxs(n.TableRow,{hover:!0,sx:e.sx("tableRow",{...H,...V?{bgcolor:$}:{}}),children:[t.jsx(n.TableCell,{sx:G,children:t.jsx(me,{ui:e,title:E,canEdit:q,onOpen:()=>h(T),size:14})}),A.map(K=>t.jsx(n.TableCell,{sx:G,children:x.formatValue(x.findField(C,K.id),f.data[K.id])||F},K.id)),_&&t.jsx(n.TableCell,{sx:G,children:t.jsx(fe,{ui:e,data:f.data})}),(S||M)&&t.jsx(n.TableCell,{align:"right",sx:e.sx("rowActions",{width:"1%",whiteSpace:"nowrap",py:.25}),children:t.jsx(n.Box,{sx:{display:"inline-flex"},children:O(f,T,E)})})]}),M&&!m(f.key)&&t.jsx(n.TableRow,{children:t.jsx(n.TableCell,{colSpan:P,sx:{p:0,...N?{borderBottom:0}:{}},children:z(f,T,E)})})]},f.key)})})]})})}function We({config:e,nodes:o,onChange:r,guid:a,depth:i=0,readOnly:s=!1,issues:p=[],showErrors:m=!1,required:g=!1,parentTitle:h,texts:b}){const u=c.useTheme(),l=lt(u,e,i,b),{emptyTitle:y,emptyText:j,...w}={...b||{},...e.texts||{}},C=e.max!=null?Number(e.max):void 0,I=!s&&(C===void 0||o.length<C),A=s?"none":l.addButton.position,_=A==="header"||A==="both",W=A==="footer"||A==="both",M=e.showEmpty??!l.nested,q=o.length===0&&M&&!(W&&l.addButton.variant==="dashed"),S=o.length===0&&!q&&!W,[v,F]=L.useState({open:!1,mode:"add",index:-1,session:0}),[z,O]=L.useState({open:!1,index:-1,title:"",detail:""}),[$,R]=L.useState(null),[G,P]=L.useState({}),f=(d,B=-1)=>F(k=>({open:!0,mode:d,index:B,session:k.session+1})),T=()=>F(d=>({...d,open:!1})),E=()=>f("add"),V=d=>f(!s&&l.actions.edit?"edit":"view",d),N=e.defaultCollapsed??l.layout==="table",H=d=>G[d]??N,K=d=>P(B=>({...B,[d]:!H(d)})),Le=(d,B)=>{if(v.mode==="add"){const k={key:Q(),data:d,children:Ue(e)};l.layout==="cards"&&P(te=>({...te,[k.key]:!1})),r([...o,k]);const D=C!==void 0&&o.length+1>=C;(!B||D)&&T();return}v.mode==="edit"&&r(o.map((k,D)=>D===v.index?{...k,data:d}:k)),T()},ge=d=>r(o.filter((B,k)=>k!==d)),ue=d=>{if(e.confirmDelete===!1){ge(d);return}const B=o[d];O({open:!0,index:d,title:x.describeItem(B.data,e,d).title,detail:x.describeDescendants({...B.data,...B.children},e)})},Fe=d=>{const B=[...o];B.splice(d+1,0,_e(o[d])),r(B)},be=(d,B)=>{const k=d+B;if(k<0||k>=o.length)return;const D=[...o];[D[d],D[k]]=[D[k],D[d]],r(D)},ye=(d,B,k)=>r(o.map((D,te)=>te===d?{...D,children:{...D.children,[B]:k}}:D)),J=m?p.find(d=>d.path.length===0)?.message:void 0,Pe=v.index>=0?o[v.index]:void 0,X=$?.index??-1,Y=d=>{R(null),d()},Ve=()=>P(Object.fromEntries(o.map(d=>[d.key,!0]))),Ge=()=>P(Object.fromEntries(o.map(d=>[d.key,!1]))),Z=o.length>0&&o.every(d=>H(d.key)),ee=l.t("deleteMessage",{detail:z.detail?l.t("deleteDetail",{detail:z.detail}):""}),[He,je]=ee.includes("{title}")?ee.split("{title}"):[ee,null];return t.jsxs(n.Box,{"data-collection":e.id,sx:l.sx("root",{width:"100%",minWidth:0}),children:[t.jsx(gt,{ui:l,count:o.length,required:g||(Number(e.min)||0)>0,alone:S&&!J,action:t.jsxs(n.Box,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:[l.layout==="cards"&&o.length>=2&&t.jsx(n.Button,{size:"small",variant:"text",onClick:Z?Ge:Ve,sx:{fontSize:12.5,fontWeight:600,color:"text.secondary",px:1,minWidth:0,textTransform:"none","&:hover":{color:"text.primary",bgcolor:c.alpha(u.palette.text.primary,.05)}},startIcon:t.jsx(n.Icon,{sx:{fontSize:"15px !important"},children:Z?"unfold_more":"unfold_less"}),children:Z?"Expand all":"Collapse all"}),_&&t.jsx(Me,{ui:l,placement:"header",empty:o.length===0,disabled:!I,onClick:E})]})}),J&&t.jsxs(n.Typography,{role:"alert",sx:l.sx("error",{display:"flex",alignItems:"center",gap:.5,color:"error.main",fontSize:13,fontWeight:500,mt:-.5,mb:1.25}),children:[t.jsx(n.Icon,{sx:{fontSize:"17px !important"},children:"error_outline"}),J]}),q&&t.jsx(mt,{ui:l,readOnly:s,error:!!J}),o.length>0&&l.layout==="table"&&t.jsx(yt,{ui:l,nodes:o,guid:a,readOnly:s,issues:p,showErrors:m,texts:w,isCollapsed:H,onToggle:K,onOpen:V,onDelete:ue,onMenu:(d,B)=>R({anchor:d,index:B}),onChildChange:ye}),o.length>0&&l.layout==="cards"&&t.jsx(n.Box,{sx:l.sx("list",{display:"flex",flexDirection:"column",gap:2}),children:o.map((d,B)=>t.jsx(bt,{ui:l,node:d,index:B,guid:a,readOnly:s,collapsed:H(d.key),issues:p.filter(k=>k.path[0]===B).map(k=>({...k,path:k.path.slice(1)})),showErrors:m,texts:w,onOpen:()=>V(B),onDelete:()=>ue(B),onMenu:k=>R({anchor:k,index:B}),onToggle:()=>K(d.key),onChildChange:(k,D)=>ye(B,k,D)},d.key))}),W&&t.jsx(n.Box,{sx:{mt:o.length||l.addButton.variant!=="dashed"?1.25:0},children:t.jsx(Me,{ui:l,placement:"footer",empty:o.length===0,disabled:!I,onClick:E})}),t.jsx(ft,{ui:l,open:v.open,mode:v.mode,session:v.session,guid:`${a}-${e.id}`,initial:Pe?.data,context:h,onClose:T,onSave:Le}),t.jsxs(n.Menu,{anchorEl:$?.anchor,open:!!$,onClose:()=>R(null),anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},sx:{"& .MuiPaper-root":l.merged("menu",{borderRadius:"10px",minWidth:170})},children:[l.actions.duplicate&&t.jsxs(n.MenuItem,{sx:l.sx("menuItem"),disabled:!I,onClick:()=>Y(()=>Fe(X)),children:[t.jsx(n.ListItemIcon,{children:t.jsx(n.Icon,{fontSize:"small",children:"content_copy"})}),t.jsx(n.ListItemText,{children:l.t("duplicate")})]}),l.actions.move&&t.jsxs(n.MenuItem,{sx:l.sx("menuItem"),disabled:X<=0,onClick:()=>Y(()=>be(X,-1)),children:[t.jsx(n.ListItemIcon,{children:t.jsx(n.Icon,{fontSize:"small",children:"arrow_upward"})}),t.jsx(n.ListItemText,{children:l.t("moveUp")})]}),l.actions.move&&t.jsxs(n.MenuItem,{sx:l.sx("menuItem"),disabled:X>=o.length-1,onClick:()=>Y(()=>be(X,1)),children:[t.jsx(n.ListItemIcon,{children:t.jsx(n.Icon,{fontSize:"small",children:"arrow_downward"})}),t.jsx(n.ListItemText,{children:l.t("moveDown")})]})]}),t.jsxs(n.Dialog,{open:z.open,onClose:()=>O(d=>({...d,open:!1})),maxWidth:"xs",fullWidth:!0,sx:{"& .MuiDialog-paper":l.merged("confirm",{borderRadius:"12px",backgroundImage:"none"})},children:[t.jsxs(n.DialogContent,{sx:{pt:3,pb:1},children:[t.jsx(n.Typography,{sx:l.sx("confirmTitle",{fontWeight:600,fontSize:17}),children:l.t("deleteTitle")}),t.jsxs(n.Typography,{sx:l.sx("confirmText",{fontSize:14,color:"text.secondary",mt:1}),children:[He,je!==null&&t.jsx(n.Box,{component:"strong",sx:{color:"text.primary",fontWeight:600},children:z.title}),je]})]}),t.jsxs(n.DialogActions,{sx:{px:3,pb:2.5,pt:2,gap:1,"& .MuiButton-root":{textTransform:"none",fontWeight:600,borderRadius:"8px"}},children:[t.jsx(n.Button,{color:"inherit",onClick:()=>O(d=>({...d,open:!1})),sx:l.sx("confirmCancel",{color:"text.secondary"}),children:l.t("cancel")}),t.jsx(n.Button,{variant:"contained",color:"error",disableElevation:!0,onClick:()=>{ge(z.index),O(d=>({...d,open:!1}))},sx:l.sx("confirmDelete"),children:l.t("deleteConfirm")})]})]})]})}const jt=["mandatory","mandatoryselect"],xe=e=>{try{return JSON.stringify(e)}catch{return""}};function vt({attributes:e={},rules:o={},onChange:r,submitTick:a}){const{id:i="",value:s}=e,p={...e,id:i,fields:e.fields||[]},m=!!(e.readOnly||e.disabled||e.MuiAttributes?.disabled),g=o?.validation?.find(I=>jt.includes(I.rule)),[h]=L.useState(Q),[b,u]=L.useState(()=>pe(s,p)),[l,y]=L.useState(!1),j=L.useRef(xe(x.toItems(s)));x.useUpdateEffect(()=>{const I=xe(x.toItems(s));I!==j.current&&(j.current=I,u(pe(s,p)))},[s]),x.useUpdateEffect(()=>{a&&y(!0)},[a]);const w=I=>{u(I);const A=he(I,p);j.current=xe(A),r?.({id:i,value:A})},C=x.collectionIssues(he(b,p),p,{required:!!g,requiredMessage:g?.message});return t.jsx(We,{config:p,nodes:b,onChange:w,guid:`${h}-${i}`,readOnly:m,issues:C,showErrors:l,required:!!g})}exports.default=vt;