@epam/ai-dial-toolset-editor 1.3.0-dev.296 → 1.3.0-dev.304

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