@epam/ai-dial-builder-form 1.2.0-dev.176 → 1.2.0-dev.181

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/index.js CHANGED
@@ -1,29 +1,29 @@
1
1
  import { ENTITY_DESCRIPTION_MAX_LENGTH as e, ENTITY_NAME_MAX_LENGTH as t, RESIZABLE_TEXTAREA_CLASS_NAME as n, TAG_INPUT_TAG_CLASS_NAME as r, buildCssVars as i, exceedsMaxLength as a, hasControlCharacters as o, mergeClasses as s } from "@epam/ai-dial-chat-shared";
2
- import { ButtonAppearance as c, ButtonVariant as l, DIAL_ICON_SIZE as u, DIAL_KIT_ICON_STROKE as d, DangerIconButton as f, ElementSize as p, GhostIconButton as m, Input as h, Label as g, LinkButton as _, NeutralButton as v, Popup as ee, PrimaryButton as y, Select as te, Spinner as b, TagInput as x, Textarea as ne, TextareaResize as S } from "@epam/ai-dial-ui-kit";
3
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
4
- import { IconArrowLeft as E, IconArrowNarrowLeft as D, IconPhoto as O, IconPlus as k, IconTrashX as re } from "@tabler/icons-react";
5
- import { Suspense as A, useCallback as j, useEffect as M, useId as N, useRef as P, useState as F } from "react";
2
+ import { ButtonAppearance as c, ButtonVariant as l, DIAL_ICON_SIZE as u, DIAL_KIT_ICON_STROKE as d, DangerIconButton as f, ElementSize as p, GhostIconButton as m, Input as h, Label as g, LinkButton as _, NeutralButton as v, Popup as y, PrimaryButton as b, Select as x, Spinner as S, TagInput as C, Textarea as w, TextareaResize as ee } from "@epam/ai-dial-ui-kit";
3
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
4
+ import { IconArrowLeft as O, IconArrowNarrowLeft as k, IconPhoto as A, IconPlus as j, IconTrashX as M } from "@tabler/icons-react";
5
+ import { Suspense as N, memo as P, useCallback as F, useEffect as te, useId as ne, useLayoutEffect as re, useMemo as I, useRef as L, useState as R } from "react";
6
6
  //#region src/components/BuilderFormActions/BuilderFormActions.tsx
7
- var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubmitDisabled: i = !1, isSubmitting: a = !1, buttonClassName: o }) => /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w(v, {
7
+ var z = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubmitDisabled: i = !1, isSubmitting: a = !1, buttonClassName: o }) => /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(v, {
8
8
  label: e.cancelButtonLabel,
9
9
  onClick: t,
10
10
  disabled: r,
11
11
  className: o
12
- }), /* @__PURE__ */ w(y, {
12
+ }), /* @__PURE__ */ E(b, {
13
13
  label: e.submitButtonLabel,
14
14
  onClick: n,
15
15
  disabled: i,
16
16
  "aria-busy": a,
17
17
  className: o,
18
- iconBefore: a ? /* @__PURE__ */ w("span", {
18
+ iconBefore: a ? /* @__PURE__ */ E("span", {
19
19
  "aria-hidden": !0,
20
- children: /* @__PURE__ */ w(b, { size: u.SM })
20
+ children: /* @__PURE__ */ E(S, { size: u.SM })
21
21
  }) : void 0
22
- })] }), L = {
22
+ })] }), B = {
23
23
  body: "_body_m2y60_2",
24
24
  sideColumn: "_sideColumn_m2y60_6",
25
25
  reservedColumn: "_reservedColumn_m2y60_10"
26
- }, R = s("flex flex-col", L.sideColumn), z = ({ left: e, children: t, metadata: n, layout: r }) => {
26
+ }, V = s("flex flex-col", B.sideColumn), H = ({ left: e, children: t, metadata: n, layout: r }) => {
27
27
  let i = e != null && n == null && r?.reserveEndColumn !== !1, a = r ? {
28
28
  flex: `0 1 ${r.sideColumnWidth ?? "400px"}`,
29
29
  width: "100%",
@@ -35,16 +35,16 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
35
35
  columnGap: r.columnGap ?? "0px",
36
36
  alignItems: "stretch"
37
37
  } : void 0;
38
- return /* @__PURE__ */ T("div", {
39
- className: s("flex min-w-0 flex-1", L.body),
38
+ return /* @__PURE__ */ D("div", {
39
+ className: s("flex min-w-0 flex-1", B.body),
40
40
  style: o,
41
41
  children: [
42
- e != null && /* @__PURE__ */ w("div", {
43
- className: R,
42
+ e != null && /* @__PURE__ */ E("div", {
43
+ className: V,
44
44
  style: a,
45
45
  children: e
46
46
  }),
47
- /* @__PURE__ */ w("div", {
47
+ /* @__PURE__ */ E("div", {
48
48
  className: "flex w-full min-w-0 flex-1 flex-col",
49
49
  style: r ? {
50
50
  flex: "1 1 320px",
@@ -52,35 +52,35 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
52
52
  } : void 0,
53
53
  children: t
54
54
  }),
55
- n != null && /* @__PURE__ */ w("div", {
56
- className: R,
55
+ n != null && /* @__PURE__ */ E("div", {
56
+ className: V,
57
57
  style: a,
58
58
  children: n
59
59
  }),
60
- i && /* @__PURE__ */ w("div", {
60
+ i && /* @__PURE__ */ E("div", {
61
61
  "aria-hidden": !0,
62
62
  style: a,
63
- className: s(L.reservedColumn, L.sideColumn)
63
+ className: s(B.reservedColumn, B.sideColumn)
64
64
  })
65
65
  ]
66
66
  });
67
- }, B = {
67
+ }, U = {
68
68
  header: "_header_oo757_4",
69
69
  actions: "_actions_oo757_20",
70
70
  title: "_title_oo757_29"
71
- }, V = ({ labels: e, onBack: t, onCancel: n, onSubmit: r, isCancelDisabled: a = !1, isSubmitDisabled: o = !1, isSubmitting: c = !1, backIcon: l, styles: f }) => {
71
+ }, W = ({ labels: e, onBack: t, onCancel: n, onSubmit: r, isCancelDisabled: a = !1, isSubmitDisabled: o = !1, isSubmitting: c = !1, backIcon: l, styles: f }) => {
72
72
  let { colors: p, typography: h } = f ?? {}, g = h?.fontClassName ?? "dial-h1-text", _ = !!h?.fontClassName;
73
- return /* @__PURE__ */ T("div", {
73
+ return /* @__PURE__ */ D("div", {
74
74
  style: i({
75
75
  "--bfh-border": p?.borderColor,
76
76
  "--bfh-font-family": _ ? void 0 : h?.fontFamily
77
77
  }),
78
- className: s("flex h-16 items-center justify-between gap-6", B.header),
78
+ className: s("flex h-16 items-center justify-between gap-6", U.header),
79
79
  children: [
80
- /* @__PURE__ */ T("div", {
80
+ /* @__PURE__ */ D("div", {
81
81
  className: "flex min-w-0 flex-1 items-center gap-2",
82
- children: [/* @__PURE__ */ w(m, {
83
- icon: l === void 0 ? /* @__PURE__ */ w(E, {
82
+ children: [/* @__PURE__ */ E(m, {
83
+ icon: l === void 0 ? /* @__PURE__ */ E(O, {
84
84
  size: u.LG,
85
85
  className: "rtl:scale-x-[-1]",
86
86
  "aria-hidden": !0,
@@ -88,14 +88,14 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
88
88
  }) : l,
89
89
  "aria-label": e.backButtonLabel,
90
90
  onClick: t
91
- }), /* @__PURE__ */ w("h1", {
92
- className: s("truncate", B.title, g),
91
+ }), /* @__PURE__ */ E("h1", {
92
+ className: s("truncate", U.title, g),
93
93
  children: e.title
94
94
  })]
95
95
  }),
96
- /* @__PURE__ */ w("div", {
97
- className: s("items-center gap-2", B.actions),
98
- children: /* @__PURE__ */ w(I, {
96
+ /* @__PURE__ */ E("div", {
97
+ className: s("items-center gap-2", U.actions),
98
+ children: /* @__PURE__ */ E(z, {
99
99
  labels: e,
100
100
  onCancel: n,
101
101
  onSubmit: r,
@@ -104,7 +104,7 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
104
104
  isSubmitting: c
105
105
  })
106
106
  }),
107
- /* @__PURE__ */ w("span", {
107
+ /* @__PURE__ */ E("span", {
108
108
  role: "status",
109
109
  "aria-live": "polite",
110
110
  className: "sr-only",
@@ -112,19 +112,19 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
112
112
  })
113
113
  ]
114
114
  });
115
- }, H = {
115
+ }, G = {
116
116
  container: "_container_k1awi_1",
117
117
  footer: "_footer_k1awi_10"
118
- }, U = ({ labels: e, onBack: t, onCancel: n, onSubmit: r, isCancelDisabled: a = !1, isSubmitDisabled: o = !1, isSubmitting: c = !1, backIcon: l, className: u, left: d, children: f, metadata: p, layout: m, styles: h }) => {
118
+ }, ie = ({ labels: e, onBack: t, onCancel: n, onSubmit: r, isCancelDisabled: a = !1, isSubmitDisabled: o = !1, isSubmitting: c = !1, backIcon: l, className: u, left: d, children: f, metadata: p, layout: m, styles: h }) => {
119
119
  let { colors: g, header: _, cssVars: v } = h ?? {};
120
- return /* @__PURE__ */ T("div", {
120
+ return /* @__PURE__ */ D("div", {
121
121
  style: {
122
122
  ...i({ "--bfc-bg": g?.background }),
123
123
  ...v
124
124
  },
125
- className: s("flex h-full w-full flex-col overflow-y-auto", u, H.container),
125
+ className: s("flex h-full w-full flex-col overflow-y-auto", u, G.container),
126
126
  children: [
127
- /* @__PURE__ */ w(V, {
127
+ /* @__PURE__ */ E(W, {
128
128
  labels: e,
129
129
  onBack: t,
130
130
  onCancel: n,
@@ -135,15 +135,15 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
135
135
  backIcon: l,
136
136
  styles: _
137
137
  }),
138
- /* @__PURE__ */ w(z, {
138
+ /* @__PURE__ */ E(H, {
139
139
  left: d,
140
140
  metadata: p,
141
141
  layout: m,
142
142
  children: f
143
143
  }),
144
- /* @__PURE__ */ w("div", {
145
- className: s("sticky bottom-0 z-10 items-center gap-2 p-3", H.footer),
146
- children: /* @__PURE__ */ w(I, {
144
+ /* @__PURE__ */ E("div", {
145
+ className: s("sticky bottom-0 z-10 items-center gap-2 p-3", G.footer),
146
+ children: /* @__PURE__ */ E(z, {
147
147
  labels: e,
148
148
  onCancel: n,
149
149
  onSubmit: r,
@@ -155,52 +155,54 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
155
155
  })
156
156
  ]
157
157
  });
158
- }, W = {
158
+ }, K = {
159
159
  layout: "dial-builder-form-layout",
160
- section: "dial-builder-form-section"
161
- }, G = {
160
+ section: "dial-builder-form-section",
161
+ metadataSection: "dial-builder-form-metadata-section",
162
+ setupSection: "dial-builder-form-setup-section"
163
+ }, q = {
162
164
  section: "_section_l1mnx_1",
163
165
  title: "_title_l1mnx_5"
164
- }, K = ({ title: e, children: t, styles: n, className: r }) => {
166
+ }, J = ({ title: e, children: t, styles: n, className: r }) => {
165
167
  let a = i({
166
168
  "--es-border-color": n?.colors?.borderColor,
167
169
  "--es-title-color": n?.colors?.titleColor
168
170
  });
169
- return /* @__PURE__ */ T("section", {
170
- className: s("flex flex-col gap-4 rounded border p-6", G.section, r, W.section),
171
+ return /* @__PURE__ */ D("section", {
172
+ className: s("flex h-full flex-col gap-4 rounded border p-6", q.section, r, K.section),
171
173
  style: a,
172
- children: [e != null && /* @__PURE__ */ w("h2", {
173
- className: s("dial-h3-text", G.title),
174
+ children: [e != null && /* @__PURE__ */ E("h2", {
175
+ className: s("dial-h3-text", q.title),
174
176
  children: e
175
177
  }), t]
176
178
  });
177
- }, q = {
179
+ }, Y = {
178
180
  headerBorder: "_headerBorder_1kidu_1",
179
181
  footerBorder: "_footerBorder_1kidu_5",
180
182
  sidebarBorder: "_sidebarBorder_1kidu_9"
181
- }, J = ({ title: e, onBack: t, backAriaLabel: n = "Back", actions: r, leftContent: a, rightContent: o, isSaving: c = !1, labels: l, styles: f, dir: p }) => {
182
- let h = N(), g = c ? l?.savingStatusLabel ?? "Saving" : "", _ = i({
183
+ }, ae = ({ title: e, onBack: t, backAriaLabel: n = "Back", actions: r, leftContent: a, rightContent: o, isSaving: c = !1, labels: l, styles: f, dir: p }) => {
184
+ let h = ne(), g = c ? l?.savingStatusLabel ?? "Saving" : "", _ = i({
183
185
  "--el-header-border-color": f?.colors?.headerBorderColor,
184
186
  "--el-sidebar-border-color": f?.colors?.sidebarBorderColor
185
187
  });
186
- return /* @__PURE__ */ T("div", {
188
+ return /* @__PURE__ */ D("div", {
187
189
  dir: p,
188
- className: s("flex min-h-0 flex-1 flex-col", W.layout),
190
+ className: s("flex min-h-0 flex-1 flex-col", K.layout),
189
191
  style: _,
190
192
  children: [
191
- /* @__PURE__ */ w("span", {
193
+ /* @__PURE__ */ E("span", {
192
194
  role: "status",
193
195
  "aria-live": "polite",
194
196
  className: "sr-only",
195
197
  id: h,
196
198
  children: g
197
199
  }),
198
- /* @__PURE__ */ T("div", {
199
- className: s("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3", q.headerBorder),
200
- children: [/* @__PURE__ */ T("div", {
200
+ /* @__PURE__ */ D("div", {
201
+ className: s("flex items-center justify-between gap-2 border-b px-4 py-2 desktop:px-8 desktop:pb-3 desktop:pt-3", Y.headerBorder),
202
+ children: [/* @__PURE__ */ D("div", {
201
203
  className: "flex min-w-0 flex-1 items-center gap-2",
202
- children: [/* @__PURE__ */ w(m, {
203
- icon: /* @__PURE__ */ w(D, {
204
+ children: [/* @__PURE__ */ E(m, {
205
+ icon: /* @__PURE__ */ E(k, {
204
206
  size: u.LG,
205
207
  stroke: d,
206
208
  "aria-hidden": !0,
@@ -208,64 +210,64 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
208
210
  }),
209
211
  "aria-label": n,
210
212
  onClick: t
211
- }), /* @__PURE__ */ w("h1", {
213
+ }), /* @__PURE__ */ E("h1", {
212
214
  className: "dial-h2-text min-w-0 truncate",
213
215
  children: e
214
216
  })]
215
- }), r != null && /* @__PURE__ */ w("div", {
217
+ }), r != null && /* @__PURE__ */ E("div", {
216
218
  className: "hidden shrink-0 items-center gap-2 desktop:flex",
217
219
  children: r
218
220
  })]
219
221
  }),
220
- /* @__PURE__ */ T("div", {
222
+ /* @__PURE__ */ D("div", {
221
223
  className: "flex flex-1 flex-col overflow-y-auto desktop:flex-row desktop:overflow-hidden",
222
- children: [/* @__PURE__ */ w("div", {
223
- className: s(o == null ? "desktop:flex-1" : "desktop:w-[400px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-e", "desktop:overflow-y-auto", o == null ? void 0 : q.sidebarBorder),
224
+ children: [/* @__PURE__ */ E("div", {
225
+ className: s(o == null ? "desktop:flex-1" : "desktop:w-[400px] desktop:shrink-0 desktop:overflow-y-auto desktop:border-e", "desktop:overflow-y-auto", o == null ? void 0 : Y.sidebarBorder),
224
226
  children: a
225
- }), o != null && /* @__PURE__ */ w("div", {
226
- className: "desktop:flex-1 desktop:overflow-y-auto",
227
+ }), o != null && /* @__PURE__ */ E("div", {
228
+ className: "desktop:flex desktop:flex-1 desktop:flex-col desktop:overflow-y-auto",
227
229
  children: o
228
230
  })]
229
231
  }),
230
- r != null && /* @__PURE__ */ w("div", {
231
- className: s("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1", q.footerBorder),
232
+ r != null && /* @__PURE__ */ E("div", {
233
+ className: s("flex shrink-0 flex-row-reverse items-center gap-2 border-t px-4 py-2 desktop:hidden [&>*]:flex-1", Y.footerBorder),
232
234
  children: r
233
235
  })
234
236
  ]
235
237
  });
236
- }, Y = {
238
+ }, X = {
237
239
  box: "_box_c9as8_1",
238
240
  icon: "_icon_c9as8_6",
239
241
  caption: "_caption_c9as8_10"
240
- }, X = ({ label: e, avatarUrl: t, avatarAlt: n = "", addAvatarLabel: r = "Add avatar", captionText: a = "PNG, JPG or SVG (max 1 MB)", onAddAvatarClick: o, styles: c, className: l }) => {
242
+ }, oe = ({ label: e, avatarUrl: t, avatarAlt: n = "", addAvatarLabel: r = "Add avatar", captionText: a = "PNG, JPG or SVG (max 1 MB)", onAddAvatarClick: o, styles: c, className: l }) => {
241
243
  let f = i({
242
244
  "--aa-box-bg": c?.colors?.boxBackgroundColor,
243
245
  "--aa-box-border": c?.colors?.boxBorderColor,
244
246
  "--aa-icon": c?.colors?.placeholderIconColor,
245
247
  "--aa-caption": c?.colors?.captionColor
246
248
  });
247
- return /* @__PURE__ */ T("div", {
249
+ return /* @__PURE__ */ D("div", {
248
250
  className: s("flex flex-col gap-2", l),
249
251
  style: f,
250
- children: [/* @__PURE__ */ w(g, { label: e }), /* @__PURE__ */ T("div", {
252
+ children: [/* @__PURE__ */ E(g, { label: e }), /* @__PURE__ */ D("div", {
251
253
  className: "flex items-start gap-3",
252
- children: [/* @__PURE__ */ w("div", {
253
- className: s("flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border", Y.box),
254
- children: t ? /* @__PURE__ */ w("img", {
254
+ children: [/* @__PURE__ */ E("div", {
255
+ className: s("flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border", X.box),
256
+ children: t ? /* @__PURE__ */ E("img", {
255
257
  src: t,
256
258
  alt: n,
257
259
  className: "h-16 w-16 object-cover"
258
- }) : /* @__PURE__ */ w(O, {
260
+ }) : /* @__PURE__ */ E(A, {
259
261
  size: u.LG,
260
262
  stroke: d,
261
263
  "aria-hidden": !0,
262
- className: Y.icon
264
+ className: X.icon
263
265
  })
264
- }), /* @__PURE__ */ T("div", {
266
+ }), /* @__PURE__ */ D("div", {
265
267
  className: "flex flex-col gap-3",
266
- children: [/* @__PURE__ */ w(_, {
268
+ children: [/* @__PURE__ */ E(_, {
267
269
  size: p.Small,
268
- iconBefore: /* @__PURE__ */ w(k, {
270
+ iconBefore: /* @__PURE__ */ E(j, {
269
271
  size: u.SM,
270
272
  stroke: d,
271
273
  "aria-hidden": !0
@@ -273,22 +275,22 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
273
275
  className: "w-fit",
274
276
  label: r,
275
277
  onClick: o
276
- }), /* @__PURE__ */ w("span", {
277
- className: s("dial-tiny-text", Y.caption),
278
+ }), /* @__PURE__ */ E("span", {
279
+ className: s("dial-tiny-text", X.caption),
278
280
  children: a
279
281
  })]
280
282
  })]
281
283
  })]
282
284
  });
283
- }, ie = ({ isOpen: e, onClose: t, onAttach: n, bucket: r, FileManagerModal: i, allowedMimeTypes: a, maxFileSizeBytes: o, labels: s }) => {
284
- let c = j((e) => e.length === 1 ? s.deleteConfirmTitleSingle : s.deleteConfirmTitleMultiple, [s.deleteConfirmTitleSingle, s.deleteConfirmTitleMultiple]), l = j((e) => /* @__PURE__ */ w("div", {
285
+ }, se = ({ isOpen: e, onClose: t, onAttach: n, bucket: r, FileManagerModal: i, allowedMimeTypes: a, maxFileSizeBytes: o, labels: s }) => {
286
+ let c = F((e) => e.length === 1 ? s.deleteConfirmTitleSingle : s.deleteConfirmTitleMultiple, [s.deleteConfirmTitleSingle, s.deleteConfirmTitleMultiple]), l = F((e) => /* @__PURE__ */ E("div", {
285
287
  className: "dial-small-text px-6 py-3",
286
- children: /* @__PURE__ */ w("p", {
288
+ children: /* @__PURE__ */ E("p", {
287
289
  className: "mb-3 text-secondary",
288
- children: e.length === 1 ? /* @__PURE__ */ T(C, { children: [
290
+ children: e.length === 1 ? /* @__PURE__ */ D(T, { children: [
289
291
  s.deleteConfirmSingleText,
290
292
  " ",
291
- /* @__PURE__ */ T("span", {
293
+ /* @__PURE__ */ D("span", {
292
294
  className: "break-words text-primary",
293
295
  children: [
294
296
  "\"",
@@ -296,10 +298,10 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
296
298
  "\"?"
297
299
  ]
298
300
  })
299
- ] }) : /* @__PURE__ */ T(C, { children: [
301
+ ] }) : /* @__PURE__ */ D(T, { children: [
300
302
  s.deleteConfirmMultipleText,
301
303
  " ",
302
- /* @__PURE__ */ T("span", {
304
+ /* @__PURE__ */ D("span", {
303
305
  className: "text-primary",
304
306
  children: [
305
307
  e.length,
@@ -314,9 +316,9 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
314
316
  s.deleteConfirmMultipleText,
315
317
  s.deleteConfirmItemsLabel
316
318
  ]);
317
- return /* @__PURE__ */ w(A, {
319
+ return /* @__PURE__ */ E(N, {
318
320
  fallback: null,
319
- children: e && /* @__PURE__ */ w(i, {
321
+ children: e && /* @__PURE__ */ E(i, {
320
322
  isOpen: e,
321
323
  onClose: t,
322
324
  onAttach: n,
@@ -347,43 +349,52 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
347
349
  deleteCancelLabel: s.deleteCancelLabel
348
350
  })
349
351
  });
350
- }, Z = (e, t, n) => ({
352
+ }, Z = /* @__PURE__ */ function(e) {
353
+ return e.Avatar = "avatar", e.Name = "name", e.Version = "version", e.Description = "description", e.Locales = "locales", e.Tags = "tags", e;
354
+ }({}), ce = [
355
+ "avatar",
356
+ "name",
357
+ "version",
358
+ "description",
359
+ "locales",
360
+ "tags"
361
+ ], le = (e, t, n) => ({
351
362
  id: e,
352
363
  language: n.find((e) => !t.has(e.code))?.code ?? "",
353
364
  name: "",
354
365
  description: ""
355
- }), Q = ({ value: e, onChange: t, availableLocaleOptions: r = [], labels: i, className: a, summaryClassName: o = "dial-body-text text-secondary", rowLabelClassName: m = "dial-tiny-lead-text text-secondary" }) => {
356
- let { summaryLabel: g, addLabel: v, editLabel: y, popupTitle: b, addLocaleLabel: x, localeRowLabel: C = "Locale", languageLabel: E, nameLabel: D, namePlaceholder: O, descriptionLabel: A, descriptionPlaceholder: j, deleteAriaLabel: N, cancelLabel: I = "Cancel", saveLabel: L = "Save" } = i, [R, z] = F(!1), [B, V] = F([]), H = P(0);
357
- M(() => {
358
- R && V(e.length > 0 ? e : [Z(`locale-row-${++H.current}`, /* @__PURE__ */ new Set(), r)]);
366
+ }), ue = ({ value: e, onChange: t, availableLocaleOptions: r = [], labels: i, className: a, summaryClassName: o = "dial-body-text text-secondary", rowLabelClassName: m = "dial-tiny-lead-text text-secondary" }) => {
367
+ let { summaryLabel: g, addLabel: v, editLabel: b, popupTitle: S, addLocaleLabel: C, localeRowLabel: T = "Locale", languageLabel: O, nameLabel: k, namePlaceholder: A, descriptionLabel: N, descriptionPlaceholder: P, deleteAriaLabel: F, cancelLabel: ne = "Cancel", saveLabel: re = "Save" } = i, [I, z] = R(!1), [B, V] = R([]), H = L(0);
368
+ te(() => {
369
+ I && V(e.length > 0 ? e : [le(`locale-row-${++H.current}`, /* @__PURE__ */ new Set(), r)]);
359
370
  }, [
360
- R,
371
+ I,
361
372
  e,
362
373
  r
363
374
  ]);
364
375
  let U = () => z(!0), W = () => z(!1), G = () => {
365
376
  t(B.filter((e) => e.language && e.name)), z(!1);
366
- }, K = () => {
377
+ }, ie = () => {
367
378
  let e = new Set(B.map((e) => e.language).filter(Boolean));
368
- V((t) => [...t, Z(`locale-row-${++H.current}`, e, r)]);
369
- }, q = (e, t) => {
379
+ V((t) => [...t, le(`locale-row-${++H.current}`, e, r)]);
380
+ }, K = (e, t) => {
370
381
  V((n) => n.map((n) => n.id === e ? {
371
382
  ...n,
372
383
  ...t
373
384
  } : n));
374
- }, J = (e) => {
385
+ }, q = (e) => {
375
386
  V((t) => t.filter((t) => t.id !== e));
376
- }, Y = (e) => r.find((t) => t.code === e)?.label ?? e.toUpperCase(), X = B.some((e) => !e.language || !e.name);
377
- return r.length === 0 ? null : /* @__PURE__ */ T("div", {
387
+ }, J = (e) => r.find((t) => t.code === e)?.label ?? e.toUpperCase(), Y = B.some((e) => !e.language || !e.name);
388
+ return r.length === 0 ? null : /* @__PURE__ */ D("div", {
378
389
  className: s("flex items-center gap-2", a),
379
390
  children: [
380
- e.length > 0 && /* @__PURE__ */ w("span", {
391
+ e.length > 0 && /* @__PURE__ */ E("span", {
381
392
  className: o,
382
- children: `${g}: ${e.map((e) => `[${Y(e.language)}]`).join(", ")}`
393
+ children: `${g}: ${e.map((e) => `[${J(e.language)}]`).join(", ")}`
383
394
  }),
384
- /* @__PURE__ */ w(_, {
385
- label: e.length > 0 ? y : v,
386
- iconBefore: /* @__PURE__ */ w(k, {
395
+ /* @__PURE__ */ E(_, {
396
+ label: e.length > 0 ? b : v,
397
+ iconBefore: /* @__PURE__ */ E(j, {
387
398
  size: u.SM,
388
399
  "aria-hidden": !0,
389
400
  stroke: d
@@ -391,55 +402,55 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
391
402
  className: "!px-0",
392
403
  onClick: U
393
404
  }),
394
- /* @__PURE__ */ w(ee, {
395
- open: R,
396
- header: b,
405
+ /* @__PURE__ */ E(y, {
406
+ open: I,
407
+ header: S,
397
408
  onClose: W,
398
409
  mainButtons: [{
399
- label: I,
410
+ label: ne,
400
411
  onClick: W
401
412
  }, {
402
- label: L,
413
+ label: re,
403
414
  variant: l.Primary,
404
- disabled: X,
415
+ disabled: Y,
405
416
  onClick: G
406
417
  }],
407
- children: /* @__PURE__ */ T("div", {
418
+ children: /* @__PURE__ */ D("div", {
408
419
  className: "flex flex-col gap-8 px-6 py-3",
409
420
  children: [B.map((e, t) => {
410
421
  let i = new Set(B.filter((t) => t.id !== e.id).map((e) => e.language).filter(Boolean));
411
- return /* @__PURE__ */ T("div", {
422
+ return /* @__PURE__ */ D("div", {
412
423
  className: "flex flex-col gap-2",
413
- children: [/* @__PURE__ */ T("div", {
424
+ children: [/* @__PURE__ */ D("div", {
414
425
  className: "flex items-center justify-between",
415
- children: [/* @__PURE__ */ T("span", {
426
+ children: [/* @__PURE__ */ D("span", {
416
427
  className: m,
417
428
  children: [
418
- C,
429
+ T,
419
430
  " ",
420
431
  t + 1
421
432
  ]
422
- }), /* @__PURE__ */ w(f, {
433
+ }), /* @__PURE__ */ E(f, {
423
434
  appearance: c.Ghost,
424
435
  size: p.Small,
425
- icon: /* @__PURE__ */ w(re, {
436
+ icon: /* @__PURE__ */ E(M, {
426
437
  size: u.SM,
427
438
  "aria-hidden": !0,
428
439
  stroke: d
429
440
  }),
430
- "aria-label": `${N} ${t + 1}`,
431
- onClick: () => J(e.id)
441
+ "aria-label": `${F} ${t + 1}`,
442
+ onClick: () => q(e.id)
432
443
  })]
433
- }), /* @__PURE__ */ T("div", {
444
+ }), /* @__PURE__ */ D("div", {
434
445
  role: "group",
435
- "aria-label": `${C} ${t + 1}`,
446
+ "aria-label": `${T} ${t + 1}`,
436
447
  className: "flex flex-col gap-5",
437
- children: [/* @__PURE__ */ T("div", {
448
+ children: [/* @__PURE__ */ D("div", {
438
449
  className: "flex flex-col gap-5 desktop:flex-row desktop:items-start",
439
- children: [/* @__PURE__ */ w(te, {
450
+ children: [/* @__PURE__ */ E(x, {
440
451
  id: `${e.id}-language`,
441
452
  labelProps: {
442
- label: E,
453
+ label: O,
443
454
  required: !0
444
455
  },
445
456
  className: "desktop:shrink-0 desktop:basis-40",
@@ -449,59 +460,86 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
449
460
  disabled: i.has(e.code)
450
461
  })),
451
462
  value: e.language,
452
- onChange: (t) => q(e.id, { language: t })
453
- }), /* @__PURE__ */ w(h, {
463
+ onChange: (t) => K(e.id, { language: t })
464
+ }), /* @__PURE__ */ E(h, {
454
465
  id: `${e.id}-name`,
455
466
  containerClassName: "min-w-0 flex-1",
456
467
  required: !0,
457
468
  value: e.name,
458
- onChange: (t) => q(e.id, { name: t ?? "" }),
469
+ onChange: (t) => K(e.id, { name: t ?? "" }),
459
470
  labelProps: {
460
- label: D,
471
+ label: k,
461
472
  required: !0
462
473
  },
463
- placeholder: O
474
+ placeholder: A
464
475
  })]
465
- }), /* @__PURE__ */ w(ne, {
476
+ }), /* @__PURE__ */ E(w, {
466
477
  id: `${e.id}-description`,
467
478
  className: n,
468
- resize: S.Vertical,
479
+ resize: ee.Vertical,
469
480
  value: e.description,
470
- onChange: (t) => q(e.id, { description: t }),
471
- labelProps: { label: A },
472
- placeholder: j
481
+ onChange: (t) => K(e.id, { description: t }),
482
+ labelProps: { label: N },
483
+ placeholder: P
473
484
  })]
474
485
  })]
475
486
  }, e.id);
476
- }), /* @__PURE__ */ w(_, {
477
- label: x,
478
- iconBefore: /* @__PURE__ */ w(k, {
487
+ }), /* @__PURE__ */ E(_, {
488
+ label: C,
489
+ iconBefore: /* @__PURE__ */ E(j, {
479
490
  size: u.SM,
480
491
  "aria-hidden": !0,
481
492
  stroke: d
482
493
  }),
483
494
  className: "self-start",
484
- onClick: K,
495
+ onClick: ie,
485
496
  disabled: B.length >= r.length
486
497
  })]
487
498
  })
488
499
  })
489
500
  ]
490
501
  });
491
- }, ae = ({ values: e, errors: t, onChange: i, onNameBlur: a, onVersionBlur: o, iconPreviewUrl: c, onAddAvatarClick: l, labels: u, styles: d, availableLocaleOptions: f = [] }) => {
492
- let p = P(null), m = P(null), g = P(!1), _ = !!(t.name || t.version);
493
- return M(() => {
494
- _ && !g.current && (t.name ? p : m).current?.focus(), g.current = _;
502
+ }, de = "Add tags, comma separated", fe = "deployment-creation-form-description", pe = ({ values: e, errors: t, onChange: i, onNameBlur: a, onVersionBlur: o, iconPreviewUrl: c, onAddAvatarClick: l, labels: u, styles: d, availableLocaleOptions: f = [], fields: p = ce, isNameReadOnly: m = !1, nameCaption: g, isDescriptionRequired: _ = !1, renderDescription: v, focusRequestKey: y }) => {
503
+ let b = L(null), x = L(null), S = L(null), T = L(!1), O = (e) => p.includes(e), k = O(Z.Name), A = O(Z.Version), j = !!(t.name || t.version || t.description), M = L(y);
504
+ te(() => {
505
+ let e = () => {
506
+ t.name ? b.current?.focus() : t.version ? x.current?.focus() : t.description && S.current?.focus();
507
+ };
508
+ if (y !== void 0) {
509
+ y !== M.current && (M.current = y, e());
510
+ return;
511
+ }
512
+ j && !T.current && e(), T.current = j;
495
513
  }, [
496
- _,
514
+ y,
515
+ j,
497
516
  t.name,
498
- t.version
499
- ]), /* @__PURE__ */ T("div", {
517
+ t.version,
518
+ t.description
519
+ ]);
520
+ let N = /* @__PURE__ */ E(w, {
521
+ id: fe,
522
+ ref: S,
523
+ value: e.description,
524
+ onChange: (e) => i({ description: e }),
525
+ "aria-required": _ || void 0,
526
+ labelProps: v ? void 0 : {
527
+ label: u.description.label,
528
+ required: _
529
+ },
530
+ placeholder: u.description.placeholder,
531
+ error: t.description || void 0,
532
+ invalid: !!t.description,
533
+ containerClassName: v ? void 0 : d?.field,
534
+ className: n,
535
+ resize: ee.Vertical
536
+ });
537
+ return /* @__PURE__ */ D("div", {
500
538
  role: u.ariaLabel ? "group" : void 0,
501
539
  "aria-label": u.ariaLabel,
502
540
  className: s("flex flex-col gap-4", d?.root),
503
541
  children: [
504
- /* @__PURE__ */ w(X, {
542
+ O(Z.Avatar) && /* @__PURE__ */ E(oe, {
505
543
  label: u.iconUrl.label,
506
544
  avatarUrl: c,
507
545
  addAvatarLabel: u.iconUrl.addAvatarLabel,
@@ -509,25 +547,27 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
509
547
  onAddAvatarClick: l,
510
548
  className: d?.field
511
549
  }),
512
- /* @__PURE__ */ T("div", {
550
+ (k || A) && /* @__PURE__ */ D("div", {
513
551
  className: s("flex items-start gap-4", d?.field),
514
- children: [/* @__PURE__ */ w(h, {
552
+ children: [k && /* @__PURE__ */ E(h, {
515
553
  id: "deployment-creation-form-name",
516
- inputRef: p,
554
+ inputRef: b,
517
555
  value: e.name,
518
556
  onChange: (e) => i({ name: e ?? "" }),
519
557
  onBlur: a,
558
+ readOnly: m,
520
559
  labelProps: {
521
560
  label: u.name.label,
522
561
  required: !0
523
562
  },
524
563
  placeholder: u.name.placeholder,
564
+ caption: g,
525
565
  error: t.name || void 0,
526
566
  invalid: !!t.name,
527
- containerClassName: "min-w-0 basis-0 grow-[2]"
528
- }), /* @__PURE__ */ w(h, {
567
+ containerClassName: A ? "min-w-0 basis-0 grow-[2]" : "min-w-0 flex-1"
568
+ }), A && /* @__PURE__ */ E(h, {
529
569
  id: "deployment-creation-form-version",
530
- inputRef: m,
570
+ inputRef: x,
531
571
  value: e.version,
532
572
  onChange: (e) => i({ version: e ?? "" }),
533
573
  onBlur: o,
@@ -535,34 +575,26 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
535
575
  placeholder: u.version.placeholder,
536
576
  error: t.version || void 0,
537
577
  invalid: !!t.version,
538
- containerClassName: "min-w-0 basis-0 grow-[1]"
578
+ containerClassName: k ? "min-w-0 basis-0 grow-[1]" : "min-w-0 flex-1"
539
579
  })]
540
580
  }),
541
- /* @__PURE__ */ w(ne, {
542
- id: "deployment-creation-form-description",
543
- value: e.description,
544
- onChange: (e) => i({ description: e }),
545
- labelProps: { label: u.description.label },
546
- placeholder: u.description.placeholder,
547
- error: t.description || void 0,
548
- invalid: !!t.description,
549
- containerClassName: d?.field,
550
- className: n,
551
- resize: S.Vertical
552
- }),
553
- /* @__PURE__ */ w(Q, {
581
+ O(Z.Description) && (v ? /* @__PURE__ */ E("div", {
582
+ className: d?.field,
583
+ children: v(N, fe)
584
+ }) : N),
585
+ O(Z.Locales) && /* @__PURE__ */ E(ue, {
554
586
  value: e.otherLocales,
555
587
  onChange: (e) => i({ otherLocales: e }),
556
588
  availableLocaleOptions: f,
557
589
  labels: u.otherLocales,
558
590
  className: d?.field
559
591
  }),
560
- /* @__PURE__ */ w("div", {
592
+ O(Z.Tags) && /* @__PURE__ */ E("div", {
561
593
  className: d?.field,
562
- children: /* @__PURE__ */ w(x, {
594
+ children: /* @__PURE__ */ E(C, {
563
595
  id: "deployment-creation-form-topics",
564
596
  labelProps: { label: u.topics.label },
565
- placeholder: u.topics.placeholder,
597
+ placeholder: u.topics.placeholder ?? de,
566
598
  value: e.topics,
567
599
  onChange: (e) => i({ topics: e }),
568
600
  tagClassName: r
@@ -570,13 +602,220 @@ var I = ({ labels: e, onCancel: t, onSubmit: n, isCancelDisabled: r = !1, isSubm
570
602
  })
571
603
  ]
572
604
  });
573
- }, $ = /* @__PURE__ */ function(e) {
605
+ }, me = "border-0 p-4 desktop:p-6", he = "desktop:flex-1", ge = "px-4 pt-4 desktop:px-6 desktop:pt-6", _e = P(({ title: e, onBack: t, onCancel: n, onSubmit: r, submitLabel: i, isSubmitting: a = !1, isSubmitDisabled: o = !1, extraActions: c, hideStandardActions: l = !1, metadata: u, metadataTitle: d, metadataFooter: f, setup: p, setupTitle: m, alert: h, metadataSectionClassName: g, setupSectionClassName: _, labels: y, styles: x, dir: S }) => {
606
+ let C = h == null ? null : /* @__PURE__ */ E("div", {
607
+ role: "alert",
608
+ className: ge,
609
+ children: h
610
+ }), w = p != null;
611
+ return /* @__PURE__ */ E(ae, {
612
+ title: e,
613
+ onBack: t,
614
+ backAriaLabel: y?.backAriaLabel ?? "Back",
615
+ isSaving: a,
616
+ labels: { savingStatusLabel: y?.savingStatusLabel ?? "Saving" },
617
+ styles: x?.layout,
618
+ dir: S,
619
+ actions: /* @__PURE__ */ D(T, { children: [c, !l && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(v, {
620
+ label: y?.cancelLabel ?? "Cancel",
621
+ disabled: a,
622
+ onClick: n
623
+ }), /* @__PURE__ */ E(b, {
624
+ label: i,
625
+ disabled: a || o,
626
+ onClick: r
627
+ })] })] }),
628
+ leftContent: /* @__PURE__ */ D(T, { children: [
629
+ !w && C,
630
+ /* @__PURE__ */ E(J, {
631
+ title: d === null ? void 0 : d ?? y?.metadataTitle ?? "Metadata",
632
+ styles: x?.section,
633
+ className: s(me, g, K.metadataSection),
634
+ children: u
635
+ }),
636
+ f
637
+ ] }),
638
+ rightContent: w ? /* @__PURE__ */ D(T, { children: [C, /* @__PURE__ */ E(J, {
639
+ title: m ?? y?.setupTitle ?? "Setup",
640
+ styles: x?.section,
641
+ className: s(me, he, _, K.setupSection),
642
+ children: p
643
+ })] }) : void 0
644
+ });
645
+ }), ve = {
646
+ name: {
647
+ label: "Name",
648
+ placeholder: "Enter name"
649
+ },
650
+ description: {
651
+ label: "Description",
652
+ placeholder: "Enter description"
653
+ },
654
+ iconUrl: {
655
+ label: "Avatar",
656
+ addAvatarLabel: "Add avatar",
657
+ captionText: "PNG, JPG or SVG (max 1 MB)"
658
+ },
659
+ version: {
660
+ label: "Version",
661
+ placeholder: "e.g. 1.0.0"
662
+ },
663
+ topics: {
664
+ label: "Tags",
665
+ placeholder: "Add tags, comma separated"
666
+ },
667
+ otherLocales: {
668
+ summaryLabel: "Locales",
669
+ addLabel: "Add locales",
670
+ editLabel: "Edit locales",
671
+ popupTitle: "Add locale",
672
+ addLocaleLabel: "Add locale",
673
+ localeRowLabel: "Locale",
674
+ languageLabel: "Language",
675
+ nameLabel: "Name",
676
+ namePlaceholder: "Enter name",
677
+ descriptionLabel: "About",
678
+ descriptionPlaceholder: "Enter brief description",
679
+ deleteAriaLabel: "Delete locale",
680
+ cancelLabel: "Cancel",
681
+ saveLabel: "Save"
682
+ },
683
+ ariaLabel: "Metadata"
684
+ }, ye = {
685
+ title: "Add avatar",
686
+ attachLabel: "Attach",
687
+ emptyTitle: "This folder is empty",
688
+ emptyDescription: "",
689
+ errorMessage: "Failed to load files",
690
+ retryLabel: "Retry",
691
+ hiddenFilesLabel: "Hidden files",
692
+ showHiddenFilesLabel: "Show hidden files",
693
+ hideHiddenFilesLabel: "Hide hidden files",
694
+ getSelectionLabel: (e) => e === 1 ? "item selected" : "items selected",
695
+ uploadFilesLabel: "Files",
696
+ newFolderLabel: "Folder",
697
+ downloadLabel: "Download",
698
+ downloadingLabel: "Preparing download…",
699
+ deleteLabel: "Delete",
700
+ deletingLabel: "Deleting…",
701
+ deleteConfirmTitleSingle: "Confirm deleting",
702
+ deleteConfirmTitleMultiple: "Confirm deleting items",
703
+ deleteConfirmSingleText: "Are you sure you want to delete",
704
+ deleteConfirmMultipleText: "Do you want to delete following",
705
+ deleteConfirmItemsLabel: "items?",
706
+ deleteConfirmLabel: "Delete",
707
+ deleteCancelLabel: "Cancel"
708
+ }, be = P(({ values: e, errors: t, onChange: n, onNameBlur: r, onVersionBlur: i, avatarPicker: a, availableLocaleOptions: o, fields: s = ce, isNameReadOnly: c, nameCaption: l, isDescriptionRequired: u, renderDescription: d, focusRequestKey: f, labels: p }) => {
709
+ let [m, h] = R(!1), g = I(() => a ? s : s.filter((e) => e !== Z.Avatar), [a, s]), _ = e.iconUrl, v = a?.resolveIconUrl, y = I(() => v ? v(_) : void 0, [_, v]), b = F(() => h(!0), []), x = F(() => h(!1), []), S = a?.resolveAttachedIconUrl, C = F((e) => {
710
+ let t = S?.(e);
711
+ t && n({ iconUrl: t }), h(!1);
712
+ }, [n, S]);
713
+ return /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(pe, {
714
+ values: e,
715
+ errors: t,
716
+ onChange: n,
717
+ onNameBlur: r,
718
+ onVersionBlur: i,
719
+ iconPreviewUrl: y,
720
+ onAddAvatarClick: b,
721
+ labels: p?.form ?? ve,
722
+ availableLocaleOptions: o,
723
+ fields: g,
724
+ isNameReadOnly: c,
725
+ nameCaption: l,
726
+ isDescriptionRequired: u,
727
+ renderDescription: d,
728
+ focusRequestKey: f
729
+ }), a && /* @__PURE__ */ E(se, {
730
+ isOpen: m,
731
+ onClose: x,
732
+ onAttach: C,
733
+ bucket: a.bucket,
734
+ FileManagerModal: a.FileManagerModal,
735
+ allowedMimeTypes: a.allowedMimeTypes,
736
+ maxFileSizeBytes: a.maxFileSizeBytes,
737
+ labels: p?.avatarPicker ?? ye
738
+ })] });
739
+ }), Q = /* @__PURE__ */ function(e) {
574
740
  return e.Required = "required", e.InvalidFormat = "invalid-format", e.TooLong = "too-long", e.ControlCharacters = "control-characters", e;
575
- }({}), oe = /^[a-zA-Z0-9 _.-]+$/, se = /^[a-zA-Z0-9._-]+$/, ce = /^\d+(\.\d+)*$/, le = (n, r = {}) => {
741
+ }({}), xe = (e, t) => e.length === t.length && e.every((e, n) => e.id === t[n].id && e.language === t[n].language && e.name === t[n].name && e.description === t[n].description), Se = (e, t) => e.name === t.name && e.description === t.description && e.iconUrl === t.iconUrl && e.version === t.version && e.topics.length === t.topics.length && e.topics.every((e, n) => e === t.topics[n]) && xe(e.otherLocales, t.otherLocales), Ce = (e) => Object.values(e).every((e) => e == null), we = /^[a-zA-Z0-9 _.-]+$/, Te = /^[a-zA-Z0-9._-]+$/, Ee = /^\d+(\.\d+)*$/, De = (n, r = {}) => {
576
742
  let i = {}, s = n.name.trim();
577
- s ? a(s, t) ? i.name = $.TooLong : r.validateNamePattern && !oe.test(s) ? i.name = $.InvalidFormat : o(s) && (i.name = $.ControlCharacters) : i.name = $.Required, a(n.description, e) && (i.description = $.TooLong);
743
+ s ? a(s, t) ? i.name = Q.TooLong : r.validateNamePattern && !we.test(s) ? i.name = Q.InvalidFormat : o(s) && (i.name = Q.ControlCharacters) : i.name = Q.Required, a(n.description, e) && (i.description = Q.TooLong);
578
744
  let c = n.version.trim();
579
- return r.validateVersionPattern && c && ((r.validateVersionPattern instanceof RegExp ? r.validateVersionPattern : se).test(c) || (i.version = $.InvalidFormat)), i;
745
+ return r.validateVersionPattern && c && ((r.validateVersionPattern instanceof RegExp ? r.validateVersionPattern : Te).test(c) || (i.version = Q.InvalidFormat)), i;
746
+ }, Oe = new Set([Q.TooLong, Q.ControlCharacters]), $ = (e, t) => ({
747
+ reseedKey: t,
748
+ values: e,
749
+ baseline: e,
750
+ touched: {},
751
+ hasAttemptedSubmit: !1,
752
+ submitAttemptCount: 0
753
+ }), ke = ({ initialValues: e, validationOptions: t, reseedKey: n }) => {
754
+ let [r, i] = R(() => $(e, n));
755
+ r.reseedKey !== n && i($(e, n));
756
+ let a = t?.validateNamePattern, o = t?.validateVersionPattern, s = I(() => De(r.values, {
757
+ validateNamePattern: a,
758
+ validateVersionPattern: o
759
+ }), [
760
+ r.values,
761
+ a,
762
+ o
763
+ ]), c = I(() => {
764
+ if (r.hasAttemptedSubmit) return s;
765
+ let e = (e, t) => e && (t || Oe.has(e)) ? e : void 0;
766
+ return {
767
+ name: e(s.name, r.touched[Z.Name]),
768
+ version: e(s.version, r.touched[Z.Version]),
769
+ description: e(s.description, r.touched[Z.Description])
770
+ };
771
+ }, [
772
+ s,
773
+ r.hasAttemptedSubmit,
774
+ r.touched
775
+ ]), l = L(s), u = L(e);
776
+ re(() => {
777
+ l.current = s, u.current = e;
778
+ });
779
+ let d = F((e) => i((t) => ({
780
+ ...t,
781
+ values: {
782
+ ...t.values,
783
+ ...e
784
+ }
785
+ })), []), f = F((e) => i((t) => t.touched[e] ? t : {
786
+ ...t,
787
+ touched: {
788
+ ...t.touched,
789
+ [e]: !0
790
+ }
791
+ }), []), p = F(() => (i((e) => ({
792
+ ...e,
793
+ hasAttemptedSubmit: !0,
794
+ submitAttemptCount: e.submitAttemptCount + 1
795
+ })), Ce(l.current)), []), m = F((e) => i((t) => $(e ?? u.current, t.reseedKey)), []), h = I(() => !Se(r.values, r.baseline), [r.values, r.baseline]);
796
+ return I(() => ({
797
+ values: r.values,
798
+ setValues: d,
799
+ touched: r.touched,
800
+ markTouched: f,
801
+ errorCodes: s,
802
+ visibleErrorCodes: c,
803
+ attemptSubmit: p,
804
+ submitAttemptCount: r.submitAttemptCount,
805
+ isDirty: h,
806
+ reset: m
807
+ }), [
808
+ r.submitAttemptCount,
809
+ r.values,
810
+ d,
811
+ r.touched,
812
+ f,
813
+ s,
814
+ c,
815
+ p,
816
+ h,
817
+ m
818
+ ]);
580
819
  };
581
820
  //#endregion
582
- export { X as AddAvatar, ie as AvatarPickerModal, W as BUILDER_FORM_CLASS, U as BuilderFormContainer, $ as DeploymentCreationFieldErrorCode, ae as DeploymentCreationForm, Q as DeploymentLocalesField, J as EditorLayout, K as EditorSection, oe as NAME_PATTERN, ce as SEMVER_VERSION_PATTERN, se as VERSION_PATTERN, le as validateDeploymentCreationFields };
821
+ export { oe as AddAvatar, se as AvatarPickerModal, K as BUILDER_FORM_CLASS, ie as BuilderFormContainer, ve as DEFAULT_METADATA_FORM_LABELS, Q as DeploymentCreationFieldErrorCode, pe as DeploymentCreationForm, ue as DeploymentLocalesField, ae as EditorLayout, J as EditorSection, _e as EntityEditor, Z as MetadataField, be as MetadataForm, we as NAME_PATTERN, Ee as SEMVER_VERSION_PATTERN, Te as VERSION_PATTERN, ke as useMetadataForm, De as validateDeploymentCreationFields };