@epam/ai-dial-toolset-editor 1.3.0-dev.98 → 1.3.0-rc.0

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,492 +1,493 @@
1
- import { DEFAULT_DEPLOYMENT_VERSION as e, DeploymentCreationFieldErrorCode as t, EntityEditor as n, MetadataField as r, MetadataForm as i, SEMVER_VERSION_PATTERN as a, useMetadataForm as o, validateDeploymentCreationFields as s } from "@epam/ai-dial-builder-form";
2
- import { ToolsetAuthTypes as c, ToolsetCredentialsLevel as l, WithLogin as u, dialFileToAttachment as d, getApiErrorDetails as f } from "@epam/ai-dial-chat-hooks";
3
- import { CopyButton as p, ENTITY_DESCRIPTION_MAX_LENGTH as m, ENTITY_NAME_MAX_LENGTH as h, TAG_INPUT_TAG_CLASS_NAME as g, TextRefinementField as _, mergeClasses as v, useCodeCopy as y, useTextRefinement as ee } from "@epam/ai-dial-chat-shared";
1
+ import { DEFAULT_DEPLOYMENT_VERSION as e, DeploymentCreationFieldErrorCode as t, EntityEditor as n, MetadataField as r, MetadataForm as i, useMetadataForm as a, validateDeploymentCreationFields as o } from "@epam/ai-dial-builder-form";
2
+ import { ToolsetAuthTypes as s, ToolsetCredentialsLevel as c, WithLogin as l, getApiErrorDetails as u } from "@epam/ai-dial-chat-hooks";
3
+ import { CopyButton as d, ENTITY_DESCRIPTION_MAX_LENGTH as f, ENTITY_NAME_MAX_LENGTH as p, TAG_INPUT_TAG_CLASS_NAME as m, TextRefinementField as h, buildCssVars as g, mergeClasses as _, useCodeCopy as v, useTextRefinement as y } from "@epam/ai-dial-chat-shared";
4
4
  import { memo as b, useCallback as x, useEffect as S, useMemo as C, useRef as w, useState as T } from "react";
5
- import { IconBrandOauth as te, IconKey as ne, IconLockOff as re, IconLogin as E, IconLogout as ie } from "@tabler/icons-react";
6
- import { jsx as D, jsxs as O } from "react/jsx-runtime";
7
- import { ConfirmationPopup as ae, ConfirmationPopupVariant as oe, DIAL_ICON_SIZE as k, DIAL_KIT_ICON_STROKE as A, Input as j, NeutralButton as M, PasswordInput as N, Radio as P, RadioGroup as F, SegmentedControl as I, Select as L, TagInput as se } from "@epam/ai-dial-ui-kit";
5
+ import { IconBrandOauth as E, IconKey as D, IconLockOff as O, IconLogin as ee, IconLogout as te } from "@tabler/icons-react";
6
+ import { CaptionText as k, ConfirmationPopup as ne, ConfirmationPopupVariant as re, DIAL_ICON_SIZE as ie, DIAL_KIT_ICON_STROKE as A, Input as j, LiveRegion as ae, LiveRegionElement as M, NeutralButton as oe, PasswordInput as N, Radio as P, RadioGroup as F, SegmentedControl as I, Select as L, TagInput as se } from "@epam/ai-dial-ui-kit";
7
+ import { jsx as R, jsxs as z } from "react/jsx-runtime";
8
8
  //#region src/constants/public-class-names.ts
9
- var ce = {
9
+ var B = {
10
10
  metadataSection: "dial-toolset-editor-metadata-section",
11
11
  setupSection: "dial-toolset-editor-setup-section"
12
- }, R = /* @__PURE__ */ function(e) {
12
+ }, V = /* @__PURE__ */ function(e) {
13
13
  return e.Http = "HTTP", e.Sse = "SSE", e;
14
- }({}), z = e, le = { validateVersionPattern: a }, B = {
15
- [c.OAuth]: te,
16
- [c.ApiKey]: ne,
17
- [c.None]: re
14
+ }({}), ce = e, le = {
15
+ name: {
16
+ label: "Name",
17
+ placeholder: "Enter name"
18
+ },
19
+ description: {
20
+ label: "Description",
21
+ placeholder: "Describe what this toolset does"
22
+ },
23
+ iconUrl: {
24
+ label: "Avatar",
25
+ addAvatarLabel: "Add avatar",
26
+ captionText: "PNG, JPG or SVG (max 1 MB)"
27
+ },
28
+ version: {
29
+ label: "Version",
30
+ placeholder: "e.g. 1.0.0"
31
+ },
32
+ topics: {
33
+ label: "Tags",
34
+ placeholder: "Add tags, comma separated"
35
+ },
36
+ otherLocales: {
37
+ summaryLabel: "Locales",
38
+ addLabel: "Add locales",
39
+ editLabel: "Edit locales",
40
+ popupTitle: "Add locale",
41
+ addLocaleLabel: "Add locale",
42
+ localeRowLabel: "Locale",
43
+ languageLabel: "Language",
44
+ nameLabel: "Name",
45
+ namePlaceholder: "Enter name",
46
+ descriptionLabel: "About",
47
+ descriptionPlaceholder: "Enter brief description",
48
+ deleteAriaLabel: "Delete locale",
49
+ cancelLabel: "Cancel",
50
+ saveLabel: "Save"
51
+ },
52
+ ariaLabel: "General"
53
+ }, H = {
54
+ [s.OAuth]: E,
55
+ [s.ApiKey]: D,
56
+ [s.None]: O
18
57
  }, ue = () => ({
19
- authenticationType: c.None,
20
- withLogin: u.WithoutLogin,
58
+ authenticationType: s.None,
59
+ withLogin: l.WithoutLogin,
21
60
  isLoggedIn: !1
22
- }), V = () => ({
61
+ }), U = () => ({
23
62
  name: "",
24
- version: z,
63
+ version: ce,
25
64
  iconUrl: "",
26
65
  description: "",
27
66
  topics: [],
28
67
  otherLocales: [],
29
68
  endpoint: "",
30
- protocol: R.Http,
69
+ protocol: V.Http,
31
70
  allowedTools: [],
32
71
  auth: ue()
33
- }), H = (e) => {
72
+ }), W = (e) => {
34
73
  if (!/^https?:\/\//.test(e) || e.endsWith(".") || e.endsWith("//")) return !1;
35
74
  try {
36
75
  return !!new URL(e);
37
76
  } catch {
38
77
  return !1;
39
78
  }
40
- }, U = (e) => H(e.trim()), de = (e) => e.replace(/^(https?):\/([^/])/, "$1://$2"), W = (e) => {
79
+ }, G = (e) => W(e.trim()), de = /^[A-Za-z][A-Za-z0-9+.-]*:[^\s#]+$/, fe = 2048, pe = (e) => {
80
+ let t = e?.trim() ?? "";
81
+ if (!t) return !0;
82
+ if (t.length > fe || !de.test(t)) return !1;
83
+ try {
84
+ return !!new URL(t);
85
+ } catch {
86
+ return !1;
87
+ }
88
+ }, K = (e) => e.replace(/^(https?):\/([^/])/, "$1://$2"), q = (e) => {
41
89
  let t = e?.trim() ?? "";
42
- if (!t || H(t)) return t;
90
+ if (!t || W(t)) return t;
43
91
  let n = [t];
44
92
  try {
45
93
  let e = decodeURIComponent(t);
46
94
  e !== t && n.push(e);
47
95
  } catch {}
48
96
  for (let e of n) {
49
- let t = de(e);
50
- if (H(t)) return t;
97
+ let t = K(e);
98
+ if (W(t)) return t;
51
99
  }
52
100
  return t;
53
- }, G = (e) => !e?.trim() || U(e), K = (e, t = !1) => e.isLoggedIn ? !0 : e.authenticationType === c.ApiKey ? e.keyHeader?.trim() ? e.withLogin === u.WithoutLogin ? !0 : !!(e.keyHeader?.trim() && e.apiKey?.trim()) : !1 : e.authenticationType === c.OAuth && e.withLogin === u.WithConfig ? !!e.clientId?.trim() && (t || !!e.clientSecret?.trim()) && G(e.authorizationEndpoint) && G(e.tokenEndpoint) : !0, fe = (e, t = !1) => Object.keys(s(e, le)).length === 0 && U(e.endpoint) && K(e.auth, t), pe = new Set([
101
+ }, J = (e, t = !1) => e.isLoggedIn ? !0 : e.authenticationType === s.ApiKey ? e.keyHeader?.trim() ? e.withLogin === l.WithoutLogin || !!(e.keyHeader?.trim() && e.apiKey?.trim()) : !1 : e.authenticationType === s.OAuth && e.withLogin === l.WithConfig ? !!e.clientId?.trim() && (t || !!e.clientSecret?.trim()) && G(e.authorizationEndpoint ?? "") && G(e.tokenEndpoint ?? "") && pe(e.resource) : !0, me = (e, t = !1) => Object.keys(o(e, { validateVersionPattern: !0 })).length === 0 && G(e.endpoint) && J(e.auth, t), Y = /* @__PURE__ */ new Set([
54
102
  "name",
55
103
  "description",
56
104
  "iconUrl",
57
105
  "version",
58
106
  "topics",
59
107
  "otherLocales"
60
- ]), me = (e) => ({
108
+ ]), he = (e) => ({
61
109
  name: e.name,
62
110
  description: e.description,
63
111
  iconUrl: e.iconUrl,
64
112
  version: e.version,
65
113
  topics: e.topics,
66
114
  otherLocales: e.otherLocales
67
- }), he = (e) => {
115
+ }), ge = (e) => {
68
116
  let t = {}, n = {};
69
- for (let [r, i] of Object.entries(e)) (pe.has(r) ? t : n)[r] = i;
117
+ for (let [r, i] of Object.entries(e)) (Y.has(r) ? t : n)[r] = i;
70
118
  return {
71
119
  metadata: t,
72
120
  setup: n
73
121
  };
74
- }, q = {
75
- name: {
76
- label: "Name",
77
- placeholder: "Enter name"
78
- },
79
- description: {
80
- label: "Description",
81
- placeholder: "Describe what this toolset does"
82
- },
83
- iconUrl: {
84
- label: "Avatar",
85
- addAvatarLabel: "Add avatar",
86
- captionText: "PNG, JPG or SVG (max 1 MB)"
87
- },
88
- version: {
89
- label: "Version",
90
- placeholder: "e.g. 1.0.0"
91
- },
92
- topics: {
93
- label: "Tags",
94
- placeholder: "Add tags, comma separated"
95
- },
96
- otherLocales: {
97
- summaryLabel: "Locales",
98
- addLabel: "Add locales",
99
- editLabel: "Edit locales",
100
- popupTitle: "Add locale",
101
- addLocaleLabel: "Add locale",
102
- localeRowLabel: "Locale",
103
- languageLabel: "Language",
104
- nameLabel: "Name",
105
- namePlaceholder: "Enter name",
106
- descriptionLabel: "About",
107
- descriptionPlaceholder: "Enter brief description",
108
- deleteAriaLabel: "Delete locale",
109
- cancelLabel: "Cancel",
110
- saveLabel: "Save"
111
- },
112
- ariaLabel: "General"
113
- }, ge = ({ form: e, errors: t, bucket: n, FileManagerModal: r, resolveIconUrl: a, allowedMimeTypes: o, maxFileSizeBytes: s, availableLocaleOptions: c, onChange: l, onNameBlur: u, onVersionBlur: f, renderDescription: p, labels: m }) => {
114
- let h = x((e) => {
115
- let [t] = e.files;
116
- return (t ? d(t, n, { resolvePreviewUrl: a }) : null)?.url;
117
- }, [n, a]);
118
- return /* @__PURE__ */ D(i, {
119
- values: e,
120
- errors: t,
121
- onChange: l,
122
- onNameBlur: u,
123
- onVersionBlur: f,
124
- avatarPicker: C(() => ({
125
- bucket: n,
126
- FileManagerModal: r,
127
- resolveIconUrl: a,
128
- resolveAttachedIconUrl: h,
129
- allowedMimeTypes: o,
130
- maxFileSizeBytes: s
131
- }), [
132
- n,
133
- r,
134
- a,
135
- h,
136
- o,
137
- s
138
- ]),
139
- availableLocaleOptions: c,
140
- renderDescription: p,
141
- labels: C(() => ({
142
- form: m?.form ?? q,
143
- avatarPicker: m?.avatarPicker
144
- }), [m?.form, m?.avatarPicker])
145
- });
146
- }, J = /* @__PURE__ */ function(e) {
122
+ }, X = /* @__PURE__ */ function(e) {
147
123
  return e.Success = "success", e.Cancelled = "cancelled", e.PopupBlocked = "popup-blocked", e.InvalidConfig = "invalid-config", e.Failed = "failed", e;
148
- }({}), _e = (e) => e === c.None ? u.WithoutLogin : u.WithLogin, Y = (e, t) => e === c.None ? t?.typeNone ?? "Open access" : e === c.OAuth ? t?.typeOAuth ?? "OAuth" : t?.typeApiKey ?? "API Key", ve = ({ auth: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, endpoint: a, authActions: o, onOAuthLogin: s, onNotifySuccess: d, onNotifyError: p, onAuthChange: m, onEnsureSaved: h, labels: _ }) => {
149
- let [v, y] = T(!1), [ee, b] = T(!1), x = e.isLoggedIn || n || v, S = U(a) && K(e, i) && !x, C = (t) => {
150
- x || t === e.authenticationType || m({
124
+ }({}), _e = { openAccessDescription: "_openAccessDescription_1ltst_1" }, Z = "toolset-client-secret-keep-caption", ve = (e) => `******${e}`, ye = (e) => e === s.None ? l.WithoutLogin : l.WithLogin, Q = (e, t) => e === s.None ? t?.typeNone ?? "Open access" : e === s.OAuth ? t?.typeOAuth ?? "OAuth" : t?.typeApiKey ?? "API Key", be = ({ auth: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, endpoint: a, authActions: o, onOAuthLogin: d, onNotifySuccess: f, onNotifyError: p, onAuthChange: h, onEnsureSaved: g, labels: v, titleClassName: y = "dial-h3-text", openAccessDescriptionClassName: b = "dial-small-text" }) => {
125
+ let [x, S] = T(!1), [C, w] = T(!1), E = e.isLoggedIn || n || x, D = i && e.clientSecretHint && !e.clientSecret ? e.clientSecretHint : void 0, O = G(a) && J(e, i) && !E, ae = (t) => {
126
+ E || t === e.authenticationType || h({
151
127
  authenticationType: t,
152
- withLogin: _e(t)
128
+ withLogin: ye(t)
153
129
  });
154
- }, w = (e) => {
155
- m({ withLogin: e });
156
- }, te = (e) => {
157
- switch (e.auth != null && m(e.auth), e.status) {
158
- case J.Success:
159
- m({ isLoggedIn: !0 }), d(_?.loginSuccessMessage ?? "Successfully logged in.");
130
+ }, M = (e) => {
131
+ h({ withLogin: e });
132
+ }, F = (e) => {
133
+ switch (e.auth != null && h(e.auth), e.status) {
134
+ case X.Success:
135
+ h({ isLoggedIn: !0 }), f(v?.loginSuccessMessage ?? "Successfully logged in.");
160
136
  return;
161
- case J.PopupBlocked:
162
- p(_?.errorPopupBlocked ?? "The login popup was blocked by your browser. Please allow popups for this site and try again.");
137
+ case X.PopupBlocked:
138
+ p(v?.errorPopupBlocked ?? "The login popup was blocked by your browser. Please allow popups for this site and try again.");
163
139
  return;
164
- case J.InvalidConfig:
165
- p(_?.errorOAuthConfigMissing ?? "The OAuth provider did not return a valid client configuration. Please check the endpoint or contact your administrator.");
140
+ case X.InvalidConfig:
141
+ p(v?.errorOAuthConfigMissing ?? "The OAuth provider did not return a valid client configuration. Please check the endpoint or contact your administrator.");
166
142
  return;
167
- case J.Failed:
168
- p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", e.traceId);
143
+ case X.Failed:
144
+ p(v?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", e.traceId);
169
145
  return;
170
- case J.Cancelled: return;
146
+ case X.Cancelled: return;
171
147
  }
172
- }, ne = async () => {
173
- if (!S) return;
174
- if (e.authenticationType === c.OAuth) {
175
- y(!0);
148
+ }, L = async () => {
149
+ if (!O) return;
150
+ if (e.authenticationType === s.OAuth) {
151
+ S(!0);
176
152
  try {
177
- te(await s({
153
+ F(await d({
178
154
  auth: e,
179
- ensureSaved: h
155
+ ensureSaved: g
180
156
  }));
181
157
  } finally {
182
- y(!1);
158
+ S(!1);
183
159
  }
184
160
  return;
185
161
  }
186
- let t = await h();
162
+ let t = await g();
187
163
  if (t) {
188
- y(!0);
164
+ S(!0);
189
165
  try {
190
166
  let n = {
191
167
  url: t,
192
- credentialsLevel: l.User,
168
+ credentialsLevel: c.User,
193
169
  authenticationType: e.authenticationType,
194
170
  apiKey: e.apiKey?.trim()
195
171
  };
196
- await o.login(t, n), m({ isLoggedIn: !0 }), d(_?.loginSuccessMessage ?? "Successfully logged in.");
172
+ await o.login(t, n), h({ isLoggedIn: !0 }), f(v?.loginSuccessMessage ?? "Successfully logged in.");
197
173
  } catch (e) {
198
- let { traceId: t } = await f(e);
199
- p(_?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
174
+ let { traceId: t } = await u(e);
175
+ p(v?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
200
176
  } finally {
201
- y(!1);
177
+ S(!1);
202
178
  }
203
179
  }
204
- }, re = async () => {
205
- y(!0);
180
+ }, B = async () => {
181
+ S(!0);
206
182
  try {
207
183
  let t = {
208
184
  url: r,
209
- credentialsLevel: l.User,
185
+ credentialsLevel: c.User,
210
186
  authenticationType: e.authenticationType
211
187
  };
212
- await o.logout(r, t), m({ isLoggedIn: !1 }), b(!1), d(_?.logoutSuccessMessage ?? "Successfully logged out.");
188
+ await o.logout(r, t), h({ isLoggedIn: !1 }), w(!1), f(v?.logoutSuccessMessage ?? "Successfully logged out.");
213
189
  } catch (e) {
214
- let { traceId: t } = await f(e);
215
- p(_?.errorLogoutFailed ?? "Failed to log out. Please try again.", t);
190
+ let { traceId: t } = await u(e);
191
+ p(v?.errorLogoutFailed ?? "Failed to log out. Please try again.", t);
216
192
  } finally {
217
- y(!1);
193
+ S(!1);
218
194
  }
219
- }, F = () => e.isLoggedIn ? /* @__PURE__ */ D("div", {
195
+ }, V = () => e.isLoggedIn ? /* @__PURE__ */ R("div", {
220
196
  className: "flex",
221
- children: /* @__PURE__ */ D(M, {
222
- label: _?.logOutLabel ?? "Log out",
223
- iconBefore: /* @__PURE__ */ D(ie, {
224
- size: k.MD,
197
+ children: /* @__PURE__ */ R(oe, {
198
+ label: v?.logOutLabel ?? "Log out",
199
+ iconBefore: /* @__PURE__ */ R(te, {
200
+ size: ie.MD,
225
201
  stroke: A
226
202
  }),
227
- onClick: () => b(!0),
228
- disabled: n || v
203
+ onClick: () => w(!0),
204
+ disabled: n || x
229
205
  })
230
- }) : /* @__PURE__ */ D("div", {
206
+ }) : /* @__PURE__ */ R("div", {
231
207
  className: "flex",
232
- children: /* @__PURE__ */ D(M, {
233
- label: _?.logInLabel ?? "Log in",
234
- iconBefore: /* @__PURE__ */ D(E, {
235
- size: k.MD,
208
+ children: /* @__PURE__ */ R(oe, {
209
+ label: v?.logInLabel ?? "Log in",
210
+ iconBefore: /* @__PURE__ */ R(ee, {
211
+ size: ie.MD,
236
212
  stroke: A
237
213
  }),
238
- onClick: ne,
239
- disabled: !S
214
+ onClick: L,
215
+ disabled: !O
240
216
  })
241
217
  });
242
- return /* @__PURE__ */ O("section", {
218
+ return /* @__PURE__ */ z("section", {
243
219
  className: "flex flex-col gap-2",
244
220
  children: [
245
- /* @__PURE__ */ D("h3", {
246
- className: "dial-h3-text",
247
- children: _?.sectionTitle ?? "Authentication"
221
+ /* @__PURE__ */ R("h3", {
222
+ className: y,
223
+ children: v?.sectionTitle ?? "Authentication"
248
224
  }),
249
- /* @__PURE__ */ D(I, {
250
- "aria-label": _?.sectionTitle ?? "Authentication",
225
+ /* @__PURE__ */ R(I, {
226
+ "aria-label": v?.sectionTitle ?? "Authentication",
251
227
  value: e.authenticationType,
252
- onChange: (e) => C(e),
228
+ onChange: (e) => ae(e),
253
229
  segmentClassName: "px-2",
254
230
  items: [
255
- c.None,
256
- c.OAuth,
257
- c.ApiKey
231
+ s.None,
232
+ s.OAuth,
233
+ s.ApiKey
258
234
  ].map((t) => {
259
- let n = B[t];
235
+ let n = H[t];
260
236
  return {
261
237
  value: t,
262
- label: /* @__PURE__ */ O("div", {
238
+ label: /* @__PURE__ */ z("div", {
263
239
  className: "flex items-center gap-2",
264
- children: [/* @__PURE__ */ D(n, {
240
+ children: [/* @__PURE__ */ R(n, {
265
241
  className: "shrink-0",
266
- size: k.SM,
242
+ size: ie.SM,
267
243
  stroke: A,
268
244
  "aria-hidden": !0
269
- }), /* @__PURE__ */ D("span", {
245
+ }), /* @__PURE__ */ R("span", {
270
246
  className: "sr-only desktop:not-sr-only",
271
- children: Y(t, _)
247
+ children: Q(t, v)
272
248
  })]
273
249
  }),
274
- disabled: x && e.authenticationType !== t
250
+ disabled: E && e.authenticationType !== t
275
251
  };
276
252
  })
277
253
  }),
278
- e.authenticationType === c.None && /* @__PURE__ */ D("p", {
279
- className: "dial-small-text pt-2 text-secondary",
280
- children: _?.openAccessDescription ?? "Open endpoint, no credentials"
254
+ e.authenticationType === s.None && /* @__PURE__ */ R("p", {
255
+ className: _("pt-2", b, _e.openAccessDescription),
256
+ children: v?.openAccessDescription ?? "Open endpoint, no credentials"
281
257
  }),
282
- e.authenticationType === c.OAuth && /* @__PURE__ */ O("div", {
258
+ e.authenticationType === s.OAuth && /* @__PURE__ */ z("div", {
283
259
  className: "flex flex-col gap-3 pt-2",
284
260
  children: [
285
- /* @__PURE__ */ O("div", {
261
+ /* @__PURE__ */ z("div", {
286
262
  className: "flex flex-col gap-2",
287
- children: [/* @__PURE__ */ D(P, {
263
+ children: [/* @__PURE__ */ R(P, {
288
264
  name: "oauth-login-mode",
289
265
  id: "oauth-with-login",
290
- value: u.WithLogin,
291
- labelProps: { label: _?.withLoginOAuthLabel ?? "Standard login" },
292
- isSelected: e.withLogin === u.WithLogin,
293
- disabled: x,
294
- onChange: w
295
- }), /* @__PURE__ */ D(P, {
266
+ value: l.WithLogin,
267
+ labelProps: { label: v?.withLoginOAuthLabel ?? "Standard login" },
268
+ isSelected: e.withLogin === l.WithLogin,
269
+ disabled: E,
270
+ onChange: M
271
+ }), /* @__PURE__ */ R(P, {
296
272
  name: "oauth-login-mode",
297
273
  id: "oauth-with-config",
298
- value: u.WithConfig,
299
- labelProps: { label: _?.withConfigOAuthLabel ?? "Custom login" },
300
- isSelected: e.withLogin === u.WithConfig,
301
- disabled: x,
302
- onChange: w
274
+ value: l.WithConfig,
275
+ labelProps: { label: v?.withConfigOAuthLabel ?? "Custom login" },
276
+ isSelected: e.withLogin === l.WithConfig,
277
+ disabled: E,
278
+ onChange: M
303
279
  })]
304
280
  }),
305
- e.withLogin === u.WithConfig && /* @__PURE__ */ O("div", {
281
+ e.withLogin === l.WithConfig && /* @__PURE__ */ z("div", {
306
282
  className: "flex flex-col gap-3",
307
283
  children: [
308
- /* @__PURE__ */ D(j, {
284
+ /* @__PURE__ */ R(j, {
309
285
  id: "toolset-client-id",
310
286
  value: e.clientId ?? "",
311
- onChange: (e) => m({ clientId: e ?? "" }),
287
+ onChange: (e) => h({ clientId: e ?? "" }),
312
288
  labelProps: {
313
- label: _?.clientIdLabel ?? "Client ID",
289
+ label: v?.clientIdLabel ?? "Client ID",
314
290
  required: !0
315
291
  },
316
- placeholder: _?.clientIdPlaceholder ?? "Enter client ID",
292
+ placeholder: v?.clientIdPlaceholder ?? "Enter client ID",
317
293
  error: t.clientId || void 0,
318
294
  invalid: !!t.clientId,
319
- disabled: x
295
+ disabled: E
320
296
  }),
321
- /* @__PURE__ */ D(N, {
322
- id: "toolset-client-secret",
323
- value: e.clientSecret ?? "",
324
- onChange: (e) => m({ clientSecret: e ?? "" }),
325
- labelProps: {
326
- label: _?.clientSecretLabel ?? "Client secret",
327
- required: !i
328
- },
329
- placeholder: _?.clientSecretPlaceholder ?? "Enter client secret",
330
- showPasswordLabel: _?.showClientSecretLabel ?? "Show client secret",
331
- hidePasswordLabel: _?.hideClientSecretLabel ?? "Hide client secret",
332
- error: t.clientSecret || void 0,
333
- invalid: !!t.clientSecret,
334
- disabled: x
297
+ /* @__PURE__ */ z("div", {
298
+ className: "flex flex-col gap-1",
299
+ children: [/* @__PURE__ */ R(N, {
300
+ id: "toolset-client-secret",
301
+ value: e.clientSecret ?? "",
302
+ onChange: (e) => h({ clientSecret: e ?? "" }),
303
+ labelProps: {
304
+ label: v?.clientSecretLabel ?? "Client secret",
305
+ required: !i
306
+ },
307
+ placeholder: D == null ? v?.clientSecretPlaceholder ?? "Enter client secret" : (v?.clientSecretHintPlaceholder ?? ve)(D),
308
+ "aria-describedby": D == null ? void 0 : Z,
309
+ showPasswordLabel: v?.showClientSecretLabel ?? "Show client secret",
310
+ hidePasswordLabel: v?.hideClientSecretLabel ?? "Hide client secret",
311
+ error: t.clientSecret || void 0,
312
+ invalid: !!t.clientSecret,
313
+ disabled: E
314
+ }), D != null && /* @__PURE__ */ R(k, {
315
+ id: Z,
316
+ text: v?.clientSecretKeepCaption ?? "Leave empty to keep the saved secret."
317
+ })]
335
318
  }),
336
- /* @__PURE__ */ D(j, {
319
+ /* @__PURE__ */ R(j, {
337
320
  id: "toolset-authorization-endpoint",
338
321
  value: e.authorizationEndpoint ?? "",
339
- onChange: (e) => m({ authorizationEndpoint: e ?? "" }),
340
- labelProps: { label: _?.authorizationEndpointLabel ?? "Authorization endpoint" },
341
- placeholder: _?.authorizationEndpointPlaceholder ?? "Enter authorization endpoint",
322
+ onChange: (e) => h({ authorizationEndpoint: e ?? "" }),
323
+ labelProps: {
324
+ label: v?.authorizationEndpointLabel ?? "Authorization endpoint",
325
+ required: !0
326
+ },
327
+ placeholder: v?.authorizationEndpointPlaceholder ?? "Enter authorization endpoint",
342
328
  error: t.authorizationEndpoint || void 0,
343
329
  invalid: !!t.authorizationEndpoint,
344
- disabled: x
330
+ disabled: E
345
331
  }),
346
- /* @__PURE__ */ D(j, {
332
+ /* @__PURE__ */ R(j, {
347
333
  id: "toolset-token-endpoint",
348
334
  value: e.tokenEndpoint ?? "",
349
- onChange: (e) => m({ tokenEndpoint: e ?? "" }),
350
- labelProps: { label: _?.tokenEndpointLabel ?? "Token endpoint" },
351
- placeholder: _?.tokenEndpointPlaceholder ?? "Enter token endpoint",
335
+ onChange: (e) => h({ tokenEndpoint: e ?? "" }),
336
+ labelProps: {
337
+ label: v?.tokenEndpointLabel ?? "Token endpoint",
338
+ required: !0
339
+ },
340
+ placeholder: v?.tokenEndpointPlaceholder ?? "Enter token endpoint",
352
341
  error: t.tokenEndpoint || void 0,
353
342
  invalid: !!t.tokenEndpoint,
354
- disabled: x
343
+ disabled: E
355
344
  }),
356
- /* @__PURE__ */ D(se, {
345
+ /* @__PURE__ */ R(se, {
357
346
  id: "toolset-scopes",
358
- labelProps: { label: _?.scopesLabel ?? "Scopes" },
359
- placeholder: _?.scopesPlaceholder ?? "Enter scopes",
347
+ labelProps: { label: v?.scopesLabel ?? "Scopes" },
348
+ placeholder: v?.scopesPlaceholder ?? "Enter scopes",
360
349
  value: e.scopes ?? [],
361
- onChange: (e) => m({ scopes: e }),
362
- disabled: x,
363
- tagClassName: g
350
+ onChange: (e) => h({ scopes: e }),
351
+ disabled: E,
352
+ tagClassName: m
353
+ }),
354
+ /* @__PURE__ */ R(j, {
355
+ id: "toolset-resource",
356
+ value: e.resource ?? "",
357
+ onChange: (e) => h({ resource: e ?? "" }),
358
+ labelProps: { label: v?.resourceLabel ?? "Resource" },
359
+ placeholder: v?.resourcePlaceholder ?? "Enter resource URI",
360
+ error: t.resource || void 0,
361
+ invalid: !!t.resource,
362
+ disabled: E
364
363
  })
365
364
  ]
366
365
  }),
367
- F()
366
+ V()
368
367
  ]
369
368
  }),
370
- e.authenticationType === c.ApiKey && /* @__PURE__ */ O("div", {
369
+ e.authenticationType === s.ApiKey && /* @__PURE__ */ z("div", {
371
370
  className: "flex flex-col gap-3 pt-2",
372
371
  children: [
373
- /* @__PURE__ */ O("div", {
372
+ /* @__PURE__ */ z("div", {
374
373
  className: "flex flex-col gap-2",
375
- children: [/* @__PURE__ */ D(P, {
374
+ children: [/* @__PURE__ */ R(P, {
376
375
  name: "apikey-login-mode",
377
376
  id: "apikey-with-login",
378
- value: u.WithLogin,
379
- labelProps: { label: _?.withLoginLabel ?? "With login" },
380
- isSelected: e.withLogin === u.WithLogin,
381
- disabled: x,
382
- onChange: w
383
- }), /* @__PURE__ */ D(P, {
377
+ value: l.WithLogin,
378
+ labelProps: { label: v?.withLoginLabel ?? "With login" },
379
+ isSelected: e.withLogin === l.WithLogin,
380
+ disabled: E,
381
+ onChange: M
382
+ }), /* @__PURE__ */ R(P, {
384
383
  name: "apikey-login-mode",
385
384
  id: "apikey-without-login",
386
- value: u.WithoutLogin,
387
- labelProps: { label: _?.withoutLoginLabel ?? "Without login" },
388
- isSelected: e.withLogin === u.WithoutLogin,
389
- disabled: x,
390
- onChange: w
385
+ value: l.WithoutLogin,
386
+ labelProps: { label: v?.withoutLoginLabel ?? "Without login" },
387
+ isSelected: e.withLogin === l.WithoutLogin,
388
+ disabled: E,
389
+ onChange: M
391
390
  })]
392
391
  }),
393
- /* @__PURE__ */ O("div", {
392
+ /* @__PURE__ */ z("div", {
394
393
  className: "flex flex-col gap-3",
395
- children: [/* @__PURE__ */ D(j, {
394
+ children: [/* @__PURE__ */ R(j, {
396
395
  id: "toolset-key-header",
397
396
  value: e.keyHeader ?? "",
398
- onChange: (e) => m({ keyHeader: e ?? "" }),
397
+ onChange: (e) => h({ keyHeader: e ?? "" }),
399
398
  labelProps: {
400
- label: _?.keyHeaderLabel ?? "API Key parameter name",
399
+ label: v?.keyHeaderLabel ?? "API Key parameter name",
401
400
  required: !0
402
401
  },
403
- placeholder: _?.keyHeaderPlaceholder ?? "Enter API key parameter name",
402
+ placeholder: v?.keyHeaderPlaceholder ?? "Enter API key parameter name",
404
403
  error: t.keyHeader || void 0,
405
404
  invalid: !!t.keyHeader,
406
- disabled: x
407
- }), e.withLogin === u.WithLogin && /* @__PURE__ */ D(N, {
405
+ disabled: E
406
+ }), e.withLogin === l.WithLogin && /* @__PURE__ */ R(N, {
408
407
  id: "toolset-api-key",
409
408
  value: e.apiKey ?? "",
410
- onChange: (e) => m({ apiKey: e ?? "" }),
409
+ onChange: (e) => h({ apiKey: e ?? "" }),
411
410
  labelProps: {
412
- label: _?.apiKeyLabel ?? "API key",
411
+ label: v?.apiKeyLabel ?? "API key",
413
412
  required: !0
414
413
  },
415
- placeholder: _?.apiKeyPlaceholder ?? "Enter API key",
416
- showPasswordLabel: _?.showApiKeyLabel ?? "Show API key",
417
- hidePasswordLabel: _?.hideApiKeyLabel ?? "Hide API key",
414
+ placeholder: v?.apiKeyPlaceholder ?? "Enter API key",
415
+ showPasswordLabel: v?.showApiKeyLabel ?? "Show API key",
416
+ hidePasswordLabel: v?.hideApiKeyLabel ?? "Hide API key",
418
417
  error: t.apiKey || void 0,
419
418
  invalid: !!t.apiKey,
420
- disabled: x
419
+ disabled: E
421
420
  })]
422
421
  }),
423
- e.withLogin !== u.WithoutLogin && F()
422
+ e.withLogin !== l.WithoutLogin && V()
424
423
  ]
425
424
  }),
426
- ee && /* @__PURE__ */ D(ae, {
427
- open: ee,
428
- header: _?.logoutConfirmTitle ?? "Log out?",
429
- description: _?.logoutConfirmDescription ?? "Are you sure you want to log out? You will need to re-enter your credentials to use this toolset again.",
430
- confirmLabel: _?.logOutLabel ?? "Log out",
431
- cancelLabel: _?.cancelLabel ?? "Cancel",
432
- variant: oe.Danger,
433
- isLoading: v,
434
- disableConfirmButton: v,
435
- onConfirm: re,
436
- onCancel: () => b(!1),
437
- onClose: () => b(!1)
425
+ C && /* @__PURE__ */ R(ne, {
426
+ open: C,
427
+ header: v?.logoutConfirmTitle ?? "Log out?",
428
+ description: v?.logoutConfirmDescription ?? "Are you sure you want to log out? You will need to re-enter your credentials to use this toolset again.",
429
+ confirmLabel: v?.logOutLabel ?? "Log out",
430
+ cancelLabel: v?.cancelLabel ?? "Cancel",
431
+ variant: re.Danger,
432
+ isLoading: x,
433
+ disableConfirmButton: x,
434
+ onConfirm: B,
435
+ onCancel: () => w(!1),
436
+ onClose: () => w(!1)
438
437
  })
439
438
  ]
440
439
  });
441
- }, X = b(({ url: e, className: t, labels: n }) => {
442
- let { isCopied: r, copy: i } = y(e), a = n?.copiedLabel ?? "Copied!";
443
- return /* @__PURE__ */ O("div", {
444
- className: v("flex flex-col gap-3", t),
440
+ }, xe = {
441
+ title: "_title_17wsg_1",
442
+ description: "_description_17wsg_5"
443
+ }, Se = b(({ url: e, className: t, labels: n, titleClassName: r = "dial-body-semi-text", descriptionClassName: i = "dial-small-text" }) => {
444
+ let { isCopied: a, copy: o } = v(e), s = n?.copiedLabel ?? "Copied!";
445
+ return /* @__PURE__ */ z("div", {
446
+ className: _("flex flex-col gap-3", t),
445
447
  children: [
446
- /* @__PURE__ */ O("div", {
448
+ /* @__PURE__ */ z("div", {
447
449
  className: "flex flex-col gap-1",
448
- children: [/* @__PURE__ */ D("p", {
449
- className: "dial-body-semi-text text-start text-primary",
450
+ children: [/* @__PURE__ */ R("p", {
451
+ className: _("text-start", r, xe.title),
450
452
  children: n?.title ?? "Connect toolset"
451
- }), /* @__PURE__ */ D("p", {
452
- className: "dial-small-text text-start text-secondary",
453
+ }), /* @__PURE__ */ R("p", {
454
+ className: _("text-start", i, xe.description),
453
455
  children: n?.description ?? "Copy endpoint URL to easily integrate toolset into your workflows"
454
456
  })]
455
457
  }),
456
- /* @__PURE__ */ D("div", { children: /* @__PURE__ */ D(p, {
457
- copiedLabel: a,
458
+ /* @__PURE__ */ R("div", { children: /* @__PURE__ */ R(d, {
459
+ copiedLabel: s,
458
460
  copyLabel: n?.copyLabel ?? "Copy URL",
459
- isCopied: r,
460
- onClick: i
461
+ isCopied: a,
462
+ onClick: o
461
463
  }) }),
462
- /* @__PURE__ */ D("span", {
463
- role: "status",
464
- "aria-live": "polite",
465
- className: "sr-only",
466
- children: r ? a : ""
464
+ /* @__PURE__ */ R(ae, {
465
+ visuallyHidden: !0,
466
+ as: M.Span,
467
+ children: a ? s : ""
467
468
  })
468
469
  ]
469
470
  });
470
- }), ye = ({ form: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, connectUrl: a, listToolNames: o, authActions: s, onOAuthLogin: c, onNotifySuccess: l, onNotifyError: u, onChange: d, onAuthChange: f, onEnsureSaved: p, labels: m }) => {
471
- let [h, _] = T(null), v = !!a && !!r, y = C(() => [{
472
- value: R.Http,
471
+ }), Ce = { connectDivider: "_connectDivider_obfkd_1" }, we = ({ form: e, errors: t, isSaving: n, toolsetId: r, isEditMode: i, connectUrl: a, listToolNames: o, authActions: s, onOAuthLogin: c, onNotifySuccess: l, onNotifyError: u, onChange: d, onAuthChange: f, onEnsureSaved: p, labels: h, colors: v, typography: y }) => {
472
+ let [b, x] = T(null), w = !!a && !!r, E = C(() => [{
473
+ value: V.Http,
473
474
  label: "HTTP"
474
475
  }, {
475
- value: R.Sse,
476
+ value: V.Sse,
476
477
  label: "SSE"
477
478
  }], []);
478
479
  return S(() => {
479
- if (!r || !o || !K(e.auth, i)) {
480
- _(null);
480
+ if (!r || !o || !J(e.auth, i)) {
481
+ x(null);
481
482
  return;
482
483
  }
483
484
  let t = !1;
484
485
  return (async () => {
485
486
  try {
486
487
  let e = await o(r);
487
- t || _(e.length > 0 ? e : null);
488
+ t || x(e.length > 0 ? e : null);
488
489
  } catch {
489
- t || _(null);
490
+ t || x(null);
490
491
  }
491
492
  })(), () => {
492
493
  t = !0;
@@ -497,56 +498,62 @@ var ce = {
497
498
  e.auth,
498
499
  e.endpoint,
499
500
  o
500
- ]), /* @__PURE__ */ O("div", {
501
+ ]), /* @__PURE__ */ z("div", {
501
502
  className: "flex max-w-[1060px] flex-col gap-4",
503
+ style: g({
504
+ "--te-connect-title": v?.connectTitle,
505
+ "--te-connect-description": v?.connectDescription,
506
+ "--te-connect-divider": v?.connectDivider,
507
+ "--te-open-access-description": v?.openAccessDescription
508
+ }),
502
509
  children: [
503
- /* @__PURE__ */ D(j, {
510
+ /* @__PURE__ */ R(j, {
504
511
  id: "toolset-endpoint",
505
512
  value: e.endpoint,
506
513
  onChange: (e) => d({ endpoint: e ?? "" }),
507
514
  labelProps: {
508
- label: m?.endpointLabel ?? "Endpoint",
515
+ label: h?.endpointLabel ?? "Endpoint",
509
516
  required: !0
510
517
  },
511
- placeholder: m?.endpointPlaceholder ?? "https://...",
512
- caption: m?.endpointCaption ?? "The HTTPS address where the server accepts MCP requests. Choose the transport under Protocol below.",
518
+ placeholder: h?.endpointPlaceholder ?? "https://...",
519
+ caption: h?.endpointCaption ?? "The HTTPS address where the server accepts MCP requests. Choose the transport under Protocol below.",
513
520
  error: t.endpoint || void 0,
514
521
  invalid: !!t.endpoint
515
522
  }),
516
- /* @__PURE__ */ D(F, {
523
+ /* @__PURE__ */ R(F, {
517
524
  labelProps: {
518
- label: m?.protocolLabel ?? "Protocol",
525
+ label: h?.protocolLabel ?? "Protocol",
519
526
  required: !0
520
527
  },
521
528
  id: "toolset-protocol",
522
- items: y,
529
+ items: E,
523
530
  value: e.protocol,
524
531
  onChange: (e) => {
525
532
  d({ protocol: e });
526
533
  }
527
534
  }),
528
- h ? /* @__PURE__ */ D(L, {
535
+ b ? /* @__PURE__ */ R(L, {
529
536
  id: "toolset-allowed-tools",
530
537
  multiple: !0,
531
538
  searchable: !0,
532
539
  selectAll: !0,
533
- labelProps: { label: m?.allowedToolsLabel ?? "Allowed tools" },
534
- placeholder: m?.allowedToolsSelectPlaceholder ?? "Select allowed tools",
535
- options: h.map((e) => ({
540
+ labelProps: { label: h?.allowedToolsLabel ?? "Allowed tools" },
541
+ placeholder: h?.allowedToolsSelectPlaceholder ?? "Select allowed tools",
542
+ options: b.map((e) => ({
536
543
  value: e,
537
544
  label: e
538
545
  })),
539
546
  value: e.allowedTools,
540
547
  onChange: (e) => d({ allowedTools: e })
541
- }) : /* @__PURE__ */ D(se, {
548
+ }) : /* @__PURE__ */ R(se, {
542
549
  id: "toolset-allowed-tools",
543
- labelProps: { label: m?.allowedToolsLabel ?? "Allowed tools" },
544
- placeholder: m?.allowedToolsPlaceholder ?? "Add tools, comma separated",
550
+ labelProps: { label: h?.allowedToolsLabel ?? "Allowed tools" },
551
+ placeholder: h?.allowedToolsPlaceholder ?? "Add tools, comma separated",
545
552
  value: e.allowedTools,
546
553
  onChange: (e) => d({ allowedTools: e }),
547
- tagClassName: g
554
+ tagClassName: m
548
555
  }),
549
- /* @__PURE__ */ D(ve, {
556
+ /* @__PURE__ */ R(be, {
550
557
  auth: e.auth,
551
558
  errors: t,
552
559
  isSaving: n,
@@ -559,209 +566,217 @@ var ce = {
559
566
  onNotifyError: u,
560
567
  onAuthChange: f,
561
568
  onEnsureSaved: p,
562
- labels: m?.auth
569
+ labels: h?.auth,
570
+ titleClassName: y?.authTitleClassName,
571
+ openAccessDescriptionClassName: y?.openAccessDescriptionClassName
563
572
  }),
564
- v && /* @__PURE__ */ D(X, {
573
+ w && /* @__PURE__ */ R(Se, {
565
574
  url: a ?? "",
566
- labels: m?.connect,
567
- className: "border-t border-tertiary pt-4"
575
+ labels: h?.connect,
576
+ titleClassName: y?.connectTitleClassName,
577
+ descriptionClassName: y?.connectDescriptionClassName,
578
+ className: _("border-t pt-4", Ce.connectDivider)
568
579
  })
569
580
  ]
570
581
  });
571
- }, be = [
582
+ }, Te = [
572
583
  "keyHeader",
573
584
  "apiKey",
574
585
  "clientId",
575
586
  "clientSecret",
576
587
  "authorizationEndpoint",
577
- "tokenEndpoint"
578
- ], xe = ["endpoint", ...be], Z = new Set(xe), Se = (e) => {
588
+ "tokenEndpoint",
589
+ "resource"
590
+ ], Ee = ["endpoint", ...Te], $ = new Set(Ee), De = { validateVersionPattern: !0 }, Oe = (e) => {
579
591
  let t = {};
580
- for (let n of Object.keys(e)) Z.has(n) && (t[n] = !0);
592
+ for (let n of Object.keys(e)) $.has(n) && (t[n] = !0);
581
593
  return t;
582
- }, Q = ({ initialForm: e, toolsetId: i, onPersist: a, onPostSaveLogin: s, onToolsetsChanged: l, onSaveSuccess: d, onSaveComplete: p, onBack: g, onDirtyChange: v, buildMcpUrl: y, listToolNames: b, authActions: te, onOAuthLogin: ne, onNotifySuccess: re, onNotifyError: E, bucket: ie, FileManagerModal: O, resolveIconUrl: ae, allowedMimeTypes: oe, maxFileSizeBytes: k, availableLocaleOptions: A, onRefineDescription: j, labels: M }) => {
583
- let N = !!i, [P, F] = T(""), I = i || P, [L, se] = T({
594
+ }, ke = ({ initialForm: e, toolsetId: o, onPersist: c, onPostSaveLogin: d, onToolsetsChanged: m, onSaveSuccess: g, onSaveComplete: _, onBack: v, onDirtyChange: b, buildMcpUrl: E, listToolNames: D, authActions: O, onOAuthLogin: ee, onNotifySuccess: te, onNotifyError: k, avatarPicker: ne, availableLocaleOptions: re, formatLocaleLabel: ie, onRefineDescription: A, labels: j, colors: ae, typography: M, isVersionReadOnly: oe = !1 }) => {
595
+ let N = !!o, [P, F] = T(""), I = o || P, [L, se] = T({
584
596
  initialForm: e,
585
597
  key: 0
586
- }), [R, z] = T(e);
598
+ }), [z, V] = T(e);
587
599
  L.initialForm !== e && (se({
588
600
  initialForm: e,
589
601
  key: L.key + 1
590
- }), z(e));
591
- let { values: B, setValues: ue, markTouched: V, visibleErrorCodes: H, attemptSubmit: de } = o({
592
- initialValues: C(() => me(e), [e]),
593
- validationOptions: le,
602
+ }), V(e));
603
+ let ce = C(() => he(e), [e]), { values: H, setValues: ue, markTouched: U, visibleErrorCodes: W, attemptSubmit: de } = a({
604
+ initialValues: ce,
605
+ validationOptions: De,
594
606
  reseedKey: L.key
595
- }), [W, G] = T(e), K = C(() => ({
596
- ...W,
597
- ...B
598
- }), [W, B]), pe = C(() => JSON.stringify(K) !== JSON.stringify(R), [K, R]);
607
+ }), [fe, K] = T(e), q = C(() => ({
608
+ ...fe,
609
+ ...H
610
+ }), [fe, H]), J = C(() => JSON.stringify(q) !== JSON.stringify(z), [q, z]);
599
611
  S(() => {
600
- v?.(pe);
601
- }, [pe, v]);
602
- let [q, J] = T(!1), [_e, Y] = T({}), [ve, X] = T({}), Z = w(null);
612
+ b?.(J);
613
+ }, [J, b]);
614
+ let [Y, X] = T(!1), [_e, Z] = T({}), [ve, ye] = T({}), Q = w(null);
603
615
  S(() => {
604
- G(e), Z.current = e, Y({}), X({}), F("");
616
+ K(e), Q.current = e, Z({}), ye({}), F("");
605
617
  }, [e]);
606
- let Q = x((e) => {
607
- let { metadata: t, setup: n } = he(e);
608
- Object.keys(t).length > 0 && (ue(t), "name" in t && V(r.Name), "version" in t && V(r.Version)), Object.keys(n).length !== 0 && (G((e) => ({
618
+ let be = x((e) => {
619
+ let { metadata: t, setup: n } = ge(e);
620
+ Object.keys(t).length > 0 && (ue(t), "name" in t && U(r.Name), "version" in t && U(r.Version)), Object.keys(n).length !== 0 && (K((e) => ({
609
621
  ...e,
610
622
  ...n
611
- })), X((e) => ({
623
+ })), ye((e) => ({
612
624
  ...e,
613
- ...Se(n)
614
- })), Y((e) => {
625
+ ...Oe(n)
626
+ })), Z((e) => {
615
627
  let t = { ...e };
616
628
  for (let e of Object.keys(n)) delete t[e];
617
629
  return t;
618
630
  }));
619
- }, [ue, V]), Ce = x((e) => {
620
- G((t) => ({
631
+ }, [ue, U]), xe = x((e) => {
632
+ K((t) => ({
621
633
  ...t,
622
634
  auth: {
623
635
  ...t.auth,
624
636
  ...e
625
637
  }
626
- })), X((t) => ({
638
+ })), ye((t) => ({
627
639
  ...t,
628
- ...Se(e)
629
- })), Y((t) => {
640
+ ...Oe(e)
641
+ })), Z((t) => {
630
642
  let n = { ...t };
631
- if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of be) delete n[e];
643
+ if ("authenticationType" in e || "withLogin" in e || "isLoggedIn" in e) for (let e of Te) delete n[e];
632
644
  else for (let t of Object.keys(e)) delete n[t];
633
645
  return n;
634
- }), "isLoggedIn" in e && l();
635
- }, [l]), we = x(async () => {
636
- if (I && Z.current != null && JSON.stringify(Z.current) === JSON.stringify(K)) return I;
637
- J(!0);
646
+ }), "isLoggedIn" in e && m();
647
+ }, [m]), Se = x(async () => {
648
+ if (I && Q.current != null && JSON.stringify(Q.current) === JSON.stringify(q)) return I;
649
+ X(!0);
638
650
  try {
639
- let e = await a(K, I);
640
- return e ? (I || F(e), Z.current = K, z(K), v?.(!1), await l(), e) : null;
651
+ let e = await c(q, I);
652
+ return e ? (I || F(e), Q.current = q, V(q), b?.(!1), await m(), e) : null;
641
653
  } catch {
642
654
  return null;
643
655
  } finally {
644
- J(!1);
656
+ X(!1);
645
657
  }
646
658
  }, [
647
- K,
659
+ q,
648
660
  I,
649
- a,
650
- l,
651
- v
652
- ]), Te = x(async () => await we() ?? !1, [we]), $ = x((e) => {
653
- let t = M?.validation, n = {};
654
- return e.endpoint.trim() ? U(e.endpoint) || (n.endpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.endpoint = t?.endpointRequired ?? "Endpoint is required", e.auth.isLoggedIn || (e.auth.authenticationType === c.ApiKey && (e.auth.keyHeader?.trim() || (n.keyHeader = t?.keyHeaderRequired ?? "Key name is required"), e.auth.withLogin === u.WithLogin && !e.auth.apiKey?.trim() && (n.apiKey = t?.apiKeyRequired ?? "API key is required")), e.auth.authenticationType === c.OAuth && e.auth.withLogin === u.WithConfig && (e.auth.clientId?.trim() || (n.clientId = t?.clientIdRequired ?? "Client ID is required"), !N && !e.auth.clientSecret?.trim() && (n.clientSecret = t?.clientSecretRequired ?? "Client secret is required"), e.auth.authorizationEndpoint?.trim() && !U(e.auth.authorizationEndpoint) && (n.authorizationEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"), e.auth.tokenEndpoint?.trim() && !U(e.auth.tokenEndpoint) && (n.tokenEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL"))), n;
655
- }, [M, N]), Ee = x(async () => {
656
- let e = de(), t = $(K);
657
- if (!e || Object.keys(t).length > 0) {
658
- Y(t);
659
- return;
660
- }
661
- Y({}), J(!0);
662
- try {
663
- let e = await a(K, I);
664
- if (!e) return;
665
- z(K), await l(), d(K);
661
+ c,
662
+ m,
663
+ b
664
+ ]), Ce = x(async () => await Se() ?? !1, [Se]), $ = x((e) => {
665
+ let t = j?.validation, n = {};
666
+ return e.endpoint.trim() ? G(e.endpoint) || (n.endpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.endpoint = t?.endpointRequired ?? "Endpoint is required", e.auth.isLoggedIn || (e.auth.authenticationType === s.ApiKey && (e.auth.keyHeader?.trim() || (n.keyHeader = t?.keyHeaderRequired ?? "Key name is required"), e.auth.withLogin === l.WithLogin && !e.auth.apiKey?.trim() && (n.apiKey = t?.apiKeyRequired ?? "API key is required")), e.auth.authenticationType === s.OAuth && e.auth.withLogin === l.WithConfig && (e.auth.clientId?.trim() || (n.clientId = t?.clientIdRequired ?? "Client ID is required"), !N && !e.auth.clientSecret?.trim() && (n.clientSecret = t?.clientSecretRequired ?? "Client secret is required"), e.auth.authorizationEndpoint?.trim() ? G(e.auth.authorizationEndpoint) || (n.authorizationEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.authorizationEndpoint = t?.authorizationEndpointRequired ?? "Authorization endpoint is required", e.auth.tokenEndpoint?.trim() ? G(e.auth.tokenEndpoint) || (n.tokenEndpoint = t?.endpointInvalid ?? "Enter a valid http(s) URL") : n.tokenEndpoint = t?.tokenEndpointRequired ?? "Token endpoint is required", pe(e.auth.resource) || (n.resource = t?.resourceInvalid ?? "Enter an absolute URI without a fragment"))), n;
667
+ }, [j, N]), ke = x(async () => {
668
+ let e = de(), t = $(q);
669
+ if (!e || Object.keys(t).length > 0) Z(t);
670
+ else {
671
+ Z({}), X(!0);
666
672
  try {
667
- await s(e, K.auth), p();
668
- } catch (e) {
669
- let { traceId: t } = await f(e);
670
- E(M?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
673
+ let e = await c(q, I);
674
+ if (!e) return;
675
+ V(q), await m(), g(q);
676
+ try {
677
+ await d(e, q.auth), _();
678
+ } catch (e) {
679
+ let { traceId: t } = await u(e);
680
+ k(j?.settings?.auth?.errorLoginFailed ?? "Failed to log in. Please check your credentials and try again.", t);
681
+ }
682
+ } catch {} finally {
683
+ X(!1);
671
684
  }
672
- } catch {} finally {
673
- J(!1);
674
685
  }
675
686
  }, [
676
687
  de,
677
- K,
688
+ q,
678
689
  $,
679
690
  I,
680
- a,
681
- l,
691
+ c,
692
+ m,
693
+ g,
694
+ _,
682
695
  d,
683
- p,
684
- s,
685
- E,
686
- M
687
- ]), De = ee({
688
- value: B.description,
689
- onChange: (e) => Q({ description: e }),
690
- onRefine: j,
691
- disabled: q,
696
+ k,
697
+ j
698
+ ]), Ae = y({
699
+ value: H.description,
700
+ onChange: (e) => be({ description: e }),
701
+ onRefine: A,
702
+ disabled: Y,
692
703
  resetKey: L.key
693
- }), Oe = j ? (e, t) => /* @__PURE__ */ D(_, {
704
+ }), je = A ? (e, t) => /* @__PURE__ */ R(h, {
694
705
  isEnabled: !0,
695
706
  fieldId: t,
696
- label: M?.general?.form?.description.label ?? "Description",
697
- labels: M?.refinement,
698
- refinement: De,
699
- disabled: De.isPending || q,
707
+ label: j?.general?.form?.description.label ?? "Description",
708
+ labels: j?.refinement,
709
+ refinement: Ae,
710
+ disabled: Ae.isPending || Y,
700
711
  children: e
701
- }) : void 0, ke = C(() => !fe(K, N), [K, N]), Ae = C(() => {
702
- let e = M?.validation, n = $(K), r = { ..._e };
703
- for (let e of xe) {
712
+ }) : void 0, Me = C(() => ({
713
+ form: j?.general?.form ?? le,
714
+ avatarPicker: j?.general?.avatarPicker
715
+ }), [j?.general?.form, j?.general?.avatarPicker]), Ne = C(() => !me(q, N), [q, N]), Pe = C(() => {
716
+ let e = j?.validation, n = $(q), r = { ..._e };
717
+ for (let e of Ee) {
704
718
  if (!ve[e]) continue;
705
719
  let t = n[e];
706
720
  t ? r[e] = t : delete r[e];
707
721
  }
708
- return H.name === t.Required ? r.name = e?.nameRequired ?? "Name is required" : H.name === t.TooLong ? r.name = e?.nameTooLong ?? `Use ${h} characters or fewer.` : H.name === t.ControlCharacters && (r.name = e?.nameControlCharacters ?? "Remove line breaks, tabs and other control characters."), H.description === t.TooLong && (r.description = e?.descriptionTooLong ?? `Use ${m} characters or fewer.`), H.version === t.InvalidFormat && (r.version = e?.versionInvalid ?? "Version must follow semantic versioning (e.g., 1.0.0)"), r;
722
+ return W.name === t.Required ? r.name = e?.nameRequired ?? "Name is required" : W.name === t.TooLong ? r.name = e?.nameTooLong ?? `Use ${p} characters or fewer.` : W.name === t.ControlCharacters && (r.name = e?.nameControlCharacters ?? "Remove line breaks, tabs and other control characters."), W.description === t.TooLong && (r.description = e?.descriptionTooLong ?? `Use ${f} characters or fewer.`), W.version === t.InvalidFormat && (r.version = e?.versionInvalid ?? "Version may only contain letters, digits, dots, underscores, and dashes"), r;
709
723
  }, [
710
724
  ve,
711
725
  _e,
712
- K,
713
- M,
714
- H,
726
+ q,
727
+ j,
728
+ W,
715
729
  $
716
- ]), je = y && I ? y(I) : void 0;
717
- return /* @__PURE__ */ D(n, {
718
- title: N ? M?.layout?.editTitle ?? "Edit toolset" : M?.layout?.createTitle ?? "Create toolset",
719
- onBack: g,
720
- onCancel: g,
721
- onSubmit: Ee,
722
- submitLabel: N ? M?.layout?.saveLabel ?? "Save" : M?.layout?.createLabel ?? "Create",
723
- isSubmitting: q,
724
- isSubmitDisabled: ke || De.isPending,
725
- metadataSectionClassName: ce.metadataSection,
726
- setupSectionClassName: ce.setupSection,
730
+ ]), Fe = E && I ? E(I) : void 0;
731
+ return /* @__PURE__ */ R(n, {
732
+ title: N ? j?.layout?.editTitle ?? "Edit toolset" : j?.layout?.createTitle ?? "Create toolset",
733
+ onBack: v,
734
+ onCancel: v,
735
+ onSubmit: ke,
736
+ submitLabel: N ? j?.layout?.saveLabel ?? "Save" : j?.layout?.createLabel ?? "Create",
737
+ isSubmitting: Y,
738
+ isSubmitDisabled: Ne || Ae.isPending,
739
+ metadataSectionClassName: B.metadataSection,
740
+ setupSectionClassName: B.setupSection,
727
741
  labels: {
728
- backAriaLabel: M?.layout?.backAriaLabel ?? "Back to catalog",
729
- savingStatusLabel: M?.layout?.savingStatusLabel ?? "Saving",
730
- metadataTitle: M?.layout?.metadataSectionTitle ?? "Metadata",
731
- setupTitle: M?.layout?.setupSectionTitle ?? "Setup",
732
- cancelLabel: M?.layout?.cancelLabel ?? "Cancel"
742
+ backAriaLabel: j?.layout?.backAriaLabel ?? "Back to catalog",
743
+ savingStatusLabel: j?.layout?.savingStatusLabel ?? "Saving",
744
+ metadataTitle: j?.layout?.metadataSectionTitle ?? "Metadata",
745
+ setupTitle: j?.layout?.setupSectionTitle ?? "Setup",
746
+ cancelLabel: j?.layout?.cancelLabel ?? "Cancel"
733
747
  },
734
- metadata: /* @__PURE__ */ D(ge, {
735
- form: K,
736
- errors: Ae,
737
- bucket: ie,
738
- FileManagerModal: O,
739
- resolveIconUrl: ae,
740
- allowedMimeTypes: oe,
741
- maxFileSizeBytes: k,
742
- availableLocaleOptions: A,
743
- onChange: Q,
744
- renderDescription: Oe,
745
- labels: M?.general
748
+ metadata: /* @__PURE__ */ R(i, {
749
+ values: q,
750
+ errors: Pe,
751
+ onChange: be,
752
+ avatarPicker: ne,
753
+ availableLocaleOptions: re,
754
+ formatLocaleLabel: ie,
755
+ renderDescription: je,
756
+ labels: Me,
757
+ isVersionReadOnly: oe,
758
+ versionReadOnlyTooltip: j?.versionReadOnlyTooltip
746
759
  }),
747
- setup: /* @__PURE__ */ D(ye, {
748
- form: K,
749
- errors: Ae,
750
- isSaving: q,
760
+ setup: /* @__PURE__ */ R(we, {
761
+ form: q,
762
+ errors: Pe,
763
+ isSaving: Y,
751
764
  toolsetId: I,
752
765
  isEditMode: N,
753
- connectUrl: je,
754
- listToolNames: b,
755
- authActions: te,
756
- onOAuthLogin: ne,
757
- onNotifySuccess: re,
758
- onNotifyError: E,
759
- onChange: Q,
760
- onAuthChange: Ce,
761
- onEnsureSaved: Te,
762
- labels: M?.settings
766
+ connectUrl: Fe,
767
+ listToolNames: D,
768
+ authActions: O,
769
+ onOAuthLogin: ee,
770
+ onNotifySuccess: te,
771
+ onNotifyError: k,
772
+ onChange: be,
773
+ onAuthChange: xe,
774
+ onEnsureSaved: Ce,
775
+ labels: j?.settings,
776
+ colors: ae?.settings,
777
+ typography: M?.settings
763
778
  })
764
779
  });
765
780
  };
766
781
  //#endregion
767
- export { B as AUTH_TYPE_ICONS, z as DEFAULT_TOOLSET_VERSION, ge as GeneralForm, ce as TOOLSET_EDITOR_CLASS, Q as ToolsetEditor, J as ToolsetOAuthLoginStatus, R as ToolsetTransportType, V as getDefaultToolsetForm, K as isToolsetAuthValid, fe as isToolsetFormValid, U as isValidEndpointUrl, W as normalizeReturnedEndpointUrl };
782
+ export { H as AUTH_TYPE_ICONS, ce as DEFAULT_TOOLSET_VERSION, B as TOOLSET_EDITOR_CLASS, ke as ToolsetEditor, X as ToolsetOAuthLoginStatus, V as ToolsetTransportType, U as getDefaultToolsetForm, J as isToolsetAuthValid, me as isToolsetFormValid, G as isValidEndpointUrl, q as normalizeReturnedEndpointUrl };