@nice2dev/ui-api 1.4.8 → 1.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,8 +1,10 @@
1
- import { jsxs as n, jsx as e, Fragment as Q } from "react/jsx-runtime";
2
- import { NiceAppShell as fe, NiceButton as U, NiceTextInput as L, NiceTextArea as oe, NiceSelect as se, NiceCheckbox as Ne, NiceIcon as ee } from "@nice2dev/ui";
3
- import { useNiceTranslation as $, NiceTutorialButton as ce, resolveTutorial as le, NiceIcon as B, clickOnActivationKey as ge, createId as re } from "@nice2dev/ui-core";
4
- import { useState as C, useCallback as I, useRef as de, useEffect as we, forwardRef as Se, useMemo as Ee } from "react";
5
- const Pe = [
1
+ import { jsxs as s, jsx as t, Fragment as Q } from "react/jsx-runtime";
2
+ import { NiceAppShell as Te, NiceButton as U, NiceTextInput as L, NiceTextArea as ce, NiceSelect as se, NiceCheckbox as ke, NiceIcon as ee } from "@nice2dev/ui";
3
+ import { useNiceTranslation as O, NiceTutorialButton as le, resolveTutorial as de, NiceIcon as B, clickOnActivationKey as _e, createId as ae } from "@nice2dev/ui-core";
4
+ import { useState as C, useCallback as I, useRef as pe, useEffect as Ce, forwardRef as xe, useMemo as Ie } from "react";
5
+ import { exportOpenApi as Re, newApiCollection as qe, newApiRequest as Oe, setRequestUrl as Be, importOpenApi as $e, rowsToRecord as oe, isEnabled as ye, buildRequestUrl as ze, flattenApiRequests as je, newApiFolder as Ke } from "./core.mjs";
6
+ import { GRAPHQL_INTROSPECTION_QUERY as zt, NICE_API_AUTH_TYPES as jt, NICE_API_CODE_LANGUAGES as Kt, NICE_API_MARKDOWN_LABELS as Ht, NICE_API_METHODS as Ut, NiceYamlError as Mt, POSTMAN_SCHEMA_V21 as Lt, bodyContentType as Vt, bodyFromText as Ft, bodyText as Jt, buildAuthorizationUrl as Gt, buildGraphqlOperation as Wt, buildSoapEnvelope as Yt, collectionToMarkdown as Xt, createPkcePair as Qt, detectApiDocument as Zt, digest as ei, digestAuthorization as ti, effectiveAuth as ii, exchangeAuthorizationCode as ni, exportHar as ri, exportOpenApiYaml as ai, exportPostman as si, exportPostmanEnvironment as oi, fetchOAuth2Token as ci, fetchTransport as li, findApiItem as di, findVariables as pi, fromBase64 as ui, generateCode as mi, graphqlExampleValue as hi, graphqlOperations as gi, graphqlTypeName as bi, headerValue as _i, hmac as yi, importApiDocument as vi, importGraphqlIntrospection as fi, importHar as Ni, importPostman as wi, importPostmanEnvironment as Ti, importWsdl as ki, inferSchema as Ci, interpolate as Si, isCurlCommand as Ei, isHar as Pi, isPostmanCollection as Ai, joinUrl as Di, jsonPointer as xi, md5Hex as Ii, mockFromSchema as Ri, mockResponse as qi, namedType as Oi, newApiId as Bi, paramsIn as $i, parseCurl as zi, parseDigestChallenge as ji, parseFormEncoded as Ki, parseGraphqlIntrospection as Hi, parseJsonOrYaml as Ui, parseWsdl as Mi, parseYaml as Li, pathParamNames as Vi, pollDeviceToken as Fi, refreshOAuth2Token as Ji, requestName as Gi, resolvePlainScalar as Wi, resolveRequest as Yi, schemaResolver as Xi, sendApiRequest as Qi, signAwsV4 as Zi, signHmac as en, splitUrl as tn, startDeviceAuthorization as nn, stringifyYaml as rn, swagger2ToOpenApi3 as an, syncPathParams as sn, toBase64 as on, toCurl as cn, tokenizeCommand as ln, unresolvedVariables as dn, updateApiItem as pn, variableScope as un } from "./core.mjs";
7
+ const He = [
6
8
  {
7
9
  target: ".nice-api-designer",
8
10
  titleKey: "tutorial.apiDesigner.intro.title",
@@ -11,7 +13,7 @@ const Pe = [
11
13
  content: "Define endpoints, parameters, request/response schemas and security for your OpenAPI document.",
12
14
  placement: "auto"
13
15
  }
14
- ], _e = {
16
+ ], ve = {
15
17
  openapi: "3.0.3",
16
18
  info: {
17
19
  title: "Pet Store API",
@@ -113,52 +115,52 @@ const Pe = [
113
115
  }
114
116
  },
115
117
  tags: [{ name: "pets", description: "Pet operations" }]
116
- }, Te = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"], De = [
118
+ }, Se = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"], Ue = [
117
119
  "object",
118
120
  "array",
119
121
  "string",
120
122
  "number",
121
123
  "integer",
122
124
  "boolean"
123
- ], Ae = ["query", "path", "header", "cookie"], xe = ["apiKey", "http", "oauth2", "openIdConnect"];
124
- function ue(t) {
125
- var o, i;
126
- const a = [];
127
- return t.openapi || a.push({ path: "openapi", message: "OpenAPI version is required", severity: "error" }), (o = t.info) != null && o.title || a.push({ path: "info.title", message: "API title is required", severity: "error" }), (i = t.info) != null && i.version || a.push({ path: "info.version", message: "API version is required", severity: "error" }), Object.entries(t.paths || {}).forEach(([r, c]) => {
128
- r.startsWith("/") || a.push({ path: `paths.${r}`, message: "Path must start with /", severity: "error" }), Te.forEach((l) => {
125
+ ], Me = ["query", "path", "header", "cookie"], Le = ["apiKey", "http", "oauth2", "openIdConnect"];
126
+ function me(e) {
127
+ var r, i;
128
+ const n = [];
129
+ return e.openapi || n.push({ path: "openapi", message: "OpenAPI version is required", severity: "error" }), (r = e.info) != null && r.title || n.push({ path: "info.title", message: "API title is required", severity: "error" }), (i = e.info) != null && i.version || n.push({ path: "info.version", message: "API version is required", severity: "error" }), Object.entries(e.paths || {}).forEach(([a, c]) => {
130
+ a.startsWith("/") || n.push({ path: `paths.${a}`, message: "Path must start with /", severity: "error" }), Se.forEach((l) => {
129
131
  const d = c[l.toLowerCase()];
130
- d && !d.responses && a.push({
131
- path: `paths.${r}.${l.toLowerCase()}.responses`,
132
+ d && !d.responses && n.push({
133
+ path: `paths.${a}.${l.toLowerCase()}.responses`,
132
134
  message: "Responses are required",
133
135
  severity: "error"
134
136
  });
135
137
  });
136
- }), a;
138
+ }), n;
137
139
  }
138
- const be = /* @__PURE__ */ De.map((t) => ({
139
- value: String(t),
140
- label: String(t)
140
+ const fe = /* @__PURE__ */ Ue.map((e) => ({
141
+ value: String(e),
142
+ label: String(e)
141
143
  }));
142
- function ct({
143
- schema: t,
144
- onChange: a,
145
- onSave: o,
144
+ function Et({
145
+ schema: e,
146
+ onChange: n,
147
+ onSave: r,
146
148
  readOnly: i = !1,
147
- className: r = "",
149
+ className: a = "",
148
150
  tutorial: c
149
151
  }) {
150
- var V, G;
151
- const { t: l } = $(), [d, p] = C(t || _e), [v, u] = C("/pets"), [N, b] = C("get"), [y, T] = C("paths"), [m, S] = C(
152
- () => ue(t || _e)
152
+ var V, W;
153
+ const { t: l } = O(), [d, p] = C(e || ve), [y, u] = C("/pets"), [N, _] = C("get"), [v, T] = C("paths"), [h, S] = C(
154
+ () => me(e || ve)
153
155
  ), w = I(
154
156
  (k) => {
155
157
  p((f) => {
156
158
  const x = k(f);
157
- return a == null || a(x), S(ue(x)), x;
159
+ return n == null || n(x), S(me(x)), x;
158
160
  });
159
161
  },
160
- [a]
161
- ), A = I(() => {
162
+ [n]
163
+ ), D = I(() => {
162
164
  const k = "/new-endpoint";
163
165
  w((f) => ({
164
166
  ...f,
@@ -169,21 +171,21 @@ function ct({
169
171
  get: { summary: "New endpoint", responses: { 200: { description: "Success" } } }
170
172
  }
171
173
  }
172
- })), u(k), b("get");
174
+ })), u(k), _("get");
173
175
  }, [w]), J = I(
174
176
  (k) => {
175
177
  w((f) => {
176
- const { [k]: x, ...K } = f.paths;
177
- return { ...f, paths: K };
178
- }), u(null), b(null);
178
+ const { [k]: x, ...j } = f.paths;
179
+ return { ...f, paths: j };
180
+ }), u(null), _(null);
179
181
  },
180
182
  [w]
181
183
  ), te = I(() => {
182
184
  let k = "NewSchema";
183
185
  w((f) => {
184
- var K, F, R;
186
+ var j, F, R;
185
187
  let x = 1;
186
- for (; (F = (K = f.components) == null ? void 0 : K.schemas) != null && F[k]; )
188
+ for (; (F = (j = f.components) == null ? void 0 : j.schemas) != null && F[k]; )
187
189
  k = `NewSchema${x++}`;
188
190
  return {
189
191
  ...f,
@@ -193,55 +195,55 @@ function ct({
193
195
  }
194
196
  };
195
197
  });
196
- }, [w]), z = I(() => {
197
- const k = ue(d);
198
- S(k), k.filter((f) => f.severity === "error").length === 0 && (o == null || o(d));
199
- }, [d, o]), M = Object.entries(d.paths).flatMap(
200
- ([k, f]) => Te.filter((x) => f[x.toLowerCase()]).map(
198
+ }, [w]), $ = I(() => {
199
+ const k = me(d);
200
+ S(k), k.filter((f) => f.severity === "error").length === 0 && (r == null || r(d));
201
+ }, [d, r]), M = Object.entries(d.paths).flatMap(
202
+ ([k, f]) => Se.filter((x) => f[x.toLowerCase()]).map(
201
203
  (x) => ({
202
204
  path: k,
203
205
  method: x,
204
206
  operation: f[x.toLowerCase()]
205
207
  })
206
208
  )
207
- ), O = ["info", "paths", "schemas", "security", "preview"];
208
- return /* @__PURE__ */ n("div", { style: { position: "relative", height: "100%" }, children: [
209
- c && /* @__PURE__ */ e("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ e(ce, { steps: le(c, Pe) }) }),
210
- /* @__PURE__ */ e(
211
- fe,
209
+ ), z = ["info", "paths", "schemas", "security", "preview"];
210
+ return /* @__PURE__ */ s("div", { style: { position: "relative", height: "100%" }, children: [
211
+ c && /* @__PURE__ */ t("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ t(le, { steps: de(c, He) }) }),
212
+ /* @__PURE__ */ t(
213
+ Te,
212
214
  {
213
215
  flush: !0,
214
- className: `nice-api-designer ${r}`,
216
+ className: `nice-api-designer ${a}`,
215
217
  height: "100%",
216
218
  style: { minHeight: 600 },
217
- toolbar: /* @__PURE__ */ n("div", { className: "nice-api-designer__toolbar", children: [
218
- /* @__PURE__ */ e("div", { className: "nice-api-designer__tabs", children: O.map((k) => /* @__PURE__ */ e(
219
+ toolbar: /* @__PURE__ */ s("div", { className: "nice-api-designer__toolbar", children: [
220
+ /* @__PURE__ */ t("div", { className: "nice-api-designer__tabs", children: z.map((k) => /* @__PURE__ */ t(
219
221
  U,
220
222
  {
221
223
  size: "sm",
222
- variant: y === k ? "primary" : "ghost",
224
+ variant: v === k ? "primary" : "ghost",
223
225
  onClick: () => T(k),
224
226
  children: k.charAt(0).toUpperCase() + k.slice(1)
225
227
  },
226
228
  k
227
229
  )) }),
228
- !i && /* @__PURE__ */ e(
230
+ !i && /* @__PURE__ */ t(
229
231
  U,
230
232
  {
231
233
  size: "sm",
232
234
  variant: "primary",
233
- leftIcon: /* @__PURE__ */ e(B, { name: "check", size: 14 }),
234
- onClick: z,
235
+ leftIcon: /* @__PURE__ */ t(B, { name: "check", size: 14 }),
236
+ onClick: $,
235
237
  children: l("apiDesigner.save", "Save")
236
238
  }
237
239
  )
238
240
  ] }),
239
- bottomPanel: m.length > 0 ? /* @__PURE__ */ e("div", { className: "nice-api-designer__errors", children: m.map((k, f) => /* @__PURE__ */ n(
241
+ bottomPanel: h.length > 0 ? /* @__PURE__ */ t("div", { className: "nice-api-designer__errors", children: h.map((k, f) => /* @__PURE__ */ s(
240
242
  "div",
241
243
  {
242
244
  className: `nice-api-designer__error nice-api-designer__error--${k.severity}`,
243
245
  children: [
244
- /* @__PURE__ */ n("strong", { children: [
246
+ /* @__PURE__ */ s("strong", { children: [
245
247
  k.path,
246
248
  ":"
247
249
  ] }),
@@ -251,26 +253,26 @@ function ct({
251
253
  },
252
254
  f
253
255
  )) }) : void 0,
254
- children: /* @__PURE__ */ n("div", { className: "nice-api-designer__content", children: [
255
- y === "info" && /* @__PURE__ */ e(Ie, { schema: d, onChange: w, readOnly: i }),
256
- y === "paths" && /* @__PURE__ */ e(
257
- Re,
256
+ children: /* @__PURE__ */ s("div", { className: "nice-api-designer__content", children: [
257
+ v === "info" && /* @__PURE__ */ t(Ve, { schema: d, onChange: w, readOnly: i }),
258
+ v === "paths" && /* @__PURE__ */ t(
259
+ Fe,
258
260
  {
259
261
  endpoints: M,
260
262
  schema: d,
261
- selectedPath: v,
263
+ selectedPath: y,
262
264
  selectedMethod: N,
263
265
  onSelectEndpoint: (k, f) => {
264
- u(k), b(f);
266
+ u(k), _(f);
265
267
  },
266
- onAdd: A,
268
+ onAdd: D,
267
269
  onDelete: J,
268
270
  onChange: w,
269
271
  readOnly: i
270
272
  }
271
273
  ),
272
- y === "schemas" && /* @__PURE__ */ e(
273
- qe,
274
+ v === "schemas" && /* @__PURE__ */ t(
275
+ Je,
274
276
  {
275
277
  schemas: ((V = d.components) == null ? void 0 : V.schemas) || {},
276
278
  onAdd: te,
@@ -281,10 +283,10 @@ function ct({
281
283
  readOnly: i
282
284
  }
283
285
  ),
284
- y === "security" && /* @__PURE__ */ e(
285
- $e,
286
+ v === "security" && /* @__PURE__ */ t(
287
+ Ge,
286
288
  {
287
- schemes: ((G = d.components) == null ? void 0 : G.securitySchemes) || {},
289
+ schemes: ((W = d.components) == null ? void 0 : W.securitySchemes) || {},
288
290
  onChange: (k) => w((f) => ({
289
291
  ...f,
290
292
  components: { ...f.components, securitySchemes: k }
@@ -292,167 +294,167 @@ function ct({
292
294
  readOnly: i
293
295
  }
294
296
  ),
295
- y === "preview" && /* @__PURE__ */ e(Be, { schema: d })
297
+ v === "preview" && /* @__PURE__ */ t(We, { schema: d })
296
298
  ] })
297
299
  }
298
300
  )
299
301
  ] });
300
302
  }
301
- function Ie({ schema: t, onChange: a, readOnly: o }) {
302
- const { t: i } = $();
303
- return /* @__PURE__ */ n("div", { className: "nice-api-designer__info-editor", children: [
304
- /* @__PURE__ */ e("h3", { children: i("apiDesigner.apiInformation", "API information") }),
305
- /* @__PURE__ */ e(
303
+ function Ve({ schema: e, onChange: n, readOnly: r }) {
304
+ const { t: i } = O();
305
+ return /* @__PURE__ */ s("div", { className: "nice-api-designer__info-editor", children: [
306
+ /* @__PURE__ */ t("h3", { children: i("apiDesigner.apiInformation", "API information") }),
307
+ /* @__PURE__ */ t(
306
308
  L,
307
309
  {
308
310
  label: i("apiDesigner.title", "Title"),
309
- value: t.info.title,
310
- onChange: (r) => a((c) => ({ ...c, info: { ...c.info, title: r } })),
311
- readOnly: o
311
+ value: e.info.title,
312
+ onChange: (a) => n((c) => ({ ...c, info: { ...c.info, title: a } })),
313
+ readOnly: r
312
314
  }
313
315
  ),
314
- /* @__PURE__ */ e(
316
+ /* @__PURE__ */ t(
315
317
  L,
316
318
  {
317
319
  label: i("apiDesigner.version", "Version"),
318
- value: t.info.version,
319
- onChange: (r) => a((c) => ({ ...c, info: { ...c.info, version: r } })),
320
- readOnly: o
320
+ value: e.info.version,
321
+ onChange: (a) => n((c) => ({ ...c, info: { ...c.info, version: a } })),
322
+ readOnly: r
321
323
  }
322
324
  ),
323
- /* @__PURE__ */ e(
324
- oe,
325
+ /* @__PURE__ */ t(
326
+ ce,
325
327
  {
326
328
  label: i("apiDesigner.description", "Description"),
327
- value: t.info.description || "",
328
- onChange: (r) => a((c) => ({ ...c, info: { ...c.info, description: r } })),
329
- readOnly: o,
329
+ value: e.info.description || "",
330
+ onChange: (a) => n((c) => ({ ...c, info: { ...c.info, description: a } })),
331
+ readOnly: r,
330
332
  rows: 4
331
333
  }
332
334
  ),
333
- /* @__PURE__ */ e("h4", { children: i("apiDesigner.servers", "Servers") }),
334
- (t.servers || []).map((r, c) => /* @__PURE__ */ n("div", { className: "nice-api-designer__server", children: [
335
- /* @__PURE__ */ e(
335
+ /* @__PURE__ */ t("h4", { children: i("apiDesigner.servers", "Servers") }),
336
+ (e.servers || []).map((a, c) => /* @__PURE__ */ s("div", { className: "nice-api-designer__server", children: [
337
+ /* @__PURE__ */ t(
336
338
  L,
337
339
  {
338
- value: r.url,
340
+ value: a.url,
339
341
  placeholder: i("apiDesigner.serverUrl", "Server URL"),
340
- onChange: (l) => a((d) => {
342
+ onChange: (l) => n((d) => {
341
343
  var p;
342
344
  return {
343
345
  ...d,
344
- servers: (p = d.servers) == null ? void 0 : p.map((v, u) => u === c ? { ...v, url: l } : v)
346
+ servers: (p = d.servers) == null ? void 0 : p.map((y, u) => u === c ? { ...y, url: l } : y)
345
347
  };
346
348
  }),
347
- readOnly: o
349
+ readOnly: r
348
350
  }
349
351
  ),
350
- /* @__PURE__ */ e(
352
+ /* @__PURE__ */ t(
351
353
  L,
352
354
  {
353
- value: r.description || "",
355
+ value: a.description || "",
354
356
  placeholder: i("apiDesigner.description", "Description"),
355
- onChange: (l) => a((d) => {
357
+ onChange: (l) => n((d) => {
356
358
  var p;
357
359
  return {
358
360
  ...d,
359
- servers: (p = d.servers) == null ? void 0 : p.map((v, u) => u === c ? { ...v, description: l } : v)
361
+ servers: (p = d.servers) == null ? void 0 : p.map((y, u) => u === c ? { ...y, description: l } : y)
360
362
  };
361
363
  }),
362
- readOnly: o
364
+ readOnly: r
363
365
  }
364
366
  ),
365
- !o && /* @__PURE__ */ e(
367
+ !r && /* @__PURE__ */ t(
366
368
  U,
367
369
  {
368
370
  size: "sm",
369
371
  variant: "ghost",
370
- onClick: () => a((l) => {
372
+ onClick: () => n((l) => {
371
373
  var d;
372
374
  return {
373
375
  ...l,
374
- servers: (d = l.servers) == null ? void 0 : d.filter((p, v) => v !== c)
376
+ servers: (d = l.servers) == null ? void 0 : d.filter((p, y) => y !== c)
375
377
  };
376
378
  }),
377
379
  "aria-label": i("apiDesigner.removeServer", "Remove server"),
378
- children: /* @__PURE__ */ e(B, { name: "close", size: 14 })
380
+ children: /* @__PURE__ */ t(B, { name: "close", size: 14 })
379
381
  }
380
382
  )
381
383
  ] }, c)),
382
- !o && /* @__PURE__ */ e(
384
+ !r && /* @__PURE__ */ t(
383
385
  U,
384
386
  {
385
387
  size: "sm",
386
388
  variant: "outline",
387
- leftIcon: /* @__PURE__ */ e(B, { name: "plus", size: 14 }),
388
- onClick: () => a((r) => ({
389
- ...r,
390
- servers: [...r.servers || [], { url: "https://api.example.com" }]
389
+ leftIcon: /* @__PURE__ */ t(B, { name: "plus", size: 14 }),
390
+ onClick: () => n((a) => ({
391
+ ...a,
392
+ servers: [...a.servers || [], { url: "https://api.example.com" }]
391
393
  })),
392
394
  children: i("apiDesigner.addServer", "Add server")
393
395
  }
394
396
  )
395
397
  ] });
396
398
  }
397
- function Re({
398
- endpoints: t,
399
- schema: a,
400
- selectedPath: o,
399
+ function Fe({
400
+ endpoints: e,
401
+ schema: n,
402
+ selectedPath: r,
401
403
  selectedMethod: i,
402
- onSelectEndpoint: r,
404
+ onSelectEndpoint: a,
403
405
  onAdd: c,
404
406
  onDelete: l,
405
407
  onChange: d,
406
408
  readOnly: p
407
409
  }) {
408
- var y;
409
- const { t: v } = $(), u = o && i ? (y = a.paths[o]) == null ? void 0 : y[i] : null, N = (T) => {
410
- !o || !i || !u || d((m) => ({
411
- ...m,
410
+ var v;
411
+ const { t: y } = O(), u = r && i ? (v = n.paths[r]) == null ? void 0 : v[i] : null, N = (T) => {
412
+ !r || !i || !u || d((h) => ({
413
+ ...h,
412
414
  paths: {
413
- ...m.paths,
414
- [o]: {
415
- ...m.paths[o],
415
+ ...h.paths,
416
+ [r]: {
417
+ ...h.paths[r],
416
418
  [i]: { ...u, ...T }
417
419
  }
418
420
  }
419
421
  }));
420
- }, b = (u == null ? void 0 : u.parameters) ?? [];
421
- return /* @__PURE__ */ n("div", { className: "nice-api-designer__paths-editor", children: [
422
- /* @__PURE__ */ n("div", { className: "nice-api-designer__endpoints-list", children: [
423
- /* @__PURE__ */ n("div", { className: "nice-api-designer__list-header", children: [
424
- /* @__PURE__ */ e("h3", { children: v("apiDesigner.endpoints", "Endpoints") }),
425
- !p && /* @__PURE__ */ n(U, { size: "sm", variant: "ghost", onClick: c, children: [
426
- /* @__PURE__ */ e(B, { name: "plus", size: 14 }),
422
+ }, _ = (u == null ? void 0 : u.parameters) ?? [];
423
+ return /* @__PURE__ */ s("div", { className: "nice-api-designer__paths-editor", children: [
424
+ /* @__PURE__ */ s("div", { className: "nice-api-designer__endpoints-list", children: [
425
+ /* @__PURE__ */ s("div", { className: "nice-api-designer__list-header", children: [
426
+ /* @__PURE__ */ t("h3", { children: y("apiDesigner.endpoints", "Endpoints") }),
427
+ !p && /* @__PURE__ */ s(U, { size: "sm", variant: "ghost", onClick: c, children: [
428
+ /* @__PURE__ */ t(B, { name: "plus", size: 14 }),
427
429
  " ",
428
- v("apiDesigner.add", "Add")
430
+ y("apiDesigner.add", "Add")
429
431
  ] })
430
432
  ] }),
431
- t.map(({ path: T, method: m }) => /* @__PURE__ */ n(
433
+ e.map(({ path: T, method: h }) => /* @__PURE__ */ s(
432
434
  "div",
433
435
  {
434
436
  role: "button",
435
437
  tabIndex: 0,
436
- onKeyDown: ge,
437
- className: `nice-api-designer__endpoint ${o === T && i === m.toLowerCase() ? "nice-api-designer__endpoint--selected" : ""}`,
438
- onClick: () => r(T, m.toLowerCase()),
438
+ onKeyDown: _e,
439
+ className: `nice-api-designer__endpoint ${r === T && i === h.toLowerCase() ? "nice-api-designer__endpoint--selected" : ""}`,
440
+ onClick: () => a(T, h.toLowerCase()),
439
441
  children: [
440
- /* @__PURE__ */ e(
442
+ /* @__PURE__ */ t(
441
443
  "span",
442
444
  {
443
- className: `nice-api-designer__method nice-api-designer__method--${m.toLowerCase()}`,
444
- children: m
445
+ className: `nice-api-designer__method nice-api-designer__method--${h.toLowerCase()}`,
446
+ children: h
445
447
  }
446
448
  ),
447
- /* @__PURE__ */ e("span", { className: "nice-api-designer__path", children: T })
449
+ /* @__PURE__ */ t("span", { className: "nice-api-designer__path", children: T })
448
450
  ]
449
451
  },
450
- `${m}-${T}`
452
+ `${h}-${T}`
451
453
  ))
452
454
  ] }),
453
- u && o && i && /* @__PURE__ */ n("div", { className: "nice-api-designer__operation-editor", children: [
454
- /* @__PURE__ */ n("h3", { children: [
455
- /* @__PURE__ */ e(
455
+ u && r && i && /* @__PURE__ */ s("div", { className: "nice-api-designer__operation-editor", children: [
456
+ /* @__PURE__ */ s("h3", { children: [
457
+ /* @__PURE__ */ t(
456
458
  "span",
457
459
  {
458
460
  className: `nice-api-designer__method nice-api-designer__method--${i}`,
@@ -460,269 +462,269 @@ function Re({
460
462
  }
461
463
  ),
462
464
  " ",
463
- o
465
+ r
464
466
  ] }),
465
- /* @__PURE__ */ e(
467
+ /* @__PURE__ */ t(
466
468
  L,
467
469
  {
468
- label: v("apiDesigner.summary", "Summary"),
470
+ label: y("apiDesigner.summary", "Summary"),
469
471
  value: u.summary || "",
470
472
  onChange: (T) => N({ summary: T }),
471
473
  readOnly: p
472
474
  }
473
475
  ),
474
- /* @__PURE__ */ e(
475
- oe,
476
+ /* @__PURE__ */ t(
477
+ ce,
476
478
  {
477
- label: v("apiDesigner.description", "Description"),
479
+ label: y("apiDesigner.description", "Description"),
478
480
  value: u.description || "",
479
481
  onChange: (T) => N({ description: T }),
480
482
  readOnly: p,
481
483
  rows: 3
482
484
  }
483
485
  ),
484
- /* @__PURE__ */ e(
486
+ /* @__PURE__ */ t(
485
487
  L,
486
488
  {
487
- label: v("apiDesigner.operationId", "Operation ID"),
489
+ label: y("apiDesigner.operationId", "Operation ID"),
488
490
  value: u.operationId || "",
489
491
  onChange: (T) => N({ operationId: T }),
490
492
  readOnly: p
491
493
  }
492
494
  ),
493
- /* @__PURE__ */ n("div", { className: "nice-api-designer__subhead", children: [
494
- /* @__PURE__ */ e("h4", { children: v("apiDesigner.parameters", "Parameters") }),
495
- !p && /* @__PURE__ */ n(
495
+ /* @__PURE__ */ s("div", { className: "nice-api-designer__subhead", children: [
496
+ /* @__PURE__ */ t("h4", { children: y("apiDesigner.parameters", "Parameters") }),
497
+ !p && /* @__PURE__ */ s(
496
498
  U,
497
499
  {
498
500
  size: "sm",
499
501
  variant: "ghost",
500
502
  onClick: () => N({
501
503
  parameters: [
502
- ...b,
504
+ ..._,
503
505
  { name: "param", in: "query", required: !1, schema: { type: "string" } }
504
506
  ]
505
507
  }),
506
508
  children: [
507
- /* @__PURE__ */ e(B, { name: "plus", size: 14 }),
509
+ /* @__PURE__ */ t(B, { name: "plus", size: 14 }),
508
510
  " ",
509
- v("apiDesigner.add", "Add")
511
+ y("apiDesigner.add", "Add")
510
512
  ]
511
513
  }
512
514
  )
513
515
  ] }),
514
- b.length === 0 && /* @__PURE__ */ e("p", { className: "nice-api-designer__muted", children: v("apiDesigner.noParameters", "No parameters.") }),
515
- b.map((T, m) => /* @__PURE__ */ n("div", { className: "nice-api-designer__param-row", children: [
516
- /* @__PURE__ */ e(
516
+ _.length === 0 && /* @__PURE__ */ t("p", { className: "nice-api-designer__muted", children: y("apiDesigner.noParameters", "No parameters.") }),
517
+ _.map((T, h) => /* @__PURE__ */ s("div", { className: "nice-api-designer__param-row", children: [
518
+ /* @__PURE__ */ t(
517
519
  L,
518
520
  {
519
521
  size: "sm",
520
522
  value: T.name,
521
523
  placeholder: "name",
522
- onChange: (S) => N({ parameters: b.map((w, A) => A === m ? { ...w, name: S } : w) }),
524
+ onChange: (S) => N({ parameters: _.map((w, D) => D === h ? { ...w, name: S } : w) }),
523
525
  readOnly: p
524
526
  }
525
527
  ),
526
- /* @__PURE__ */ e(
528
+ /* @__PURE__ */ t(
527
529
  se,
528
530
  {
529
531
  size: "sm",
530
532
  value: T.in,
531
- options: Ae.map((S) => ({ value: String(S), label: String(S) })),
533
+ options: Me.map((S) => ({ value: String(S), label: String(S) })),
532
534
  onChange: (S) => N({
533
- parameters: b.map(
534
- (w, A) => A === m ? { ...w, in: S } : w
535
+ parameters: _.map(
536
+ (w, D) => D === h ? { ...w, in: S } : w
535
537
  )
536
538
  })
537
539
  }
538
540
  ),
539
- /* @__PURE__ */ e(
540
- Ne,
541
+ /* @__PURE__ */ t(
542
+ ke,
541
543
  {
542
544
  checked: !!T.required,
543
545
  onChange: (S) => N({
544
- parameters: b.map((w, A) => A === m ? { ...w, required: S } : w)
546
+ parameters: _.map((w, D) => D === h ? { ...w, required: S } : w)
545
547
  }),
546
548
  label: "required"
547
549
  }
548
550
  ),
549
- !p && /* @__PURE__ */ e(
551
+ !p && /* @__PURE__ */ t(
550
552
  U,
551
553
  {
552
554
  size: "sm",
553
555
  variant: "ghost",
554
- onClick: () => N({ parameters: b.filter((S, w) => w !== m) }),
555
- "aria-label": v("apiDesigner.remove", "Remove {name}").replace(
556
+ onClick: () => N({ parameters: _.filter((S, w) => w !== h) }),
557
+ "aria-label": y("apiDesigner.remove", "Remove {name}").replace(
556
558
  "{name}",
557
559
  String(T.name)
558
560
  ),
559
- children: /* @__PURE__ */ e(B, { name: "close", size: 14 })
561
+ children: /* @__PURE__ */ t(B, { name: "close", size: 14 })
560
562
  }
561
563
  )
562
- ] }, m)),
563
- !p && /* @__PURE__ */ e(
564
+ ] }, h)),
565
+ !p && /* @__PURE__ */ t(
564
566
  U,
565
567
  {
566
568
  className: "nice-api-designer__delete-btn",
567
569
  size: "sm",
568
570
  variant: "danger",
569
- leftIcon: /* @__PURE__ */ e(B, { name: "trash", size: 14 }),
570
- onClick: () => l(o),
571
- children: v("apiDesigner.deleteEndpoint", "Delete endpoint")
571
+ leftIcon: /* @__PURE__ */ t(B, { name: "trash", size: 14 }),
572
+ onClick: () => l(r),
573
+ children: y("apiDesigner.deleteEndpoint", "Delete endpoint")
572
574
  }
573
575
  )
574
576
  ] })
575
577
  ] });
576
578
  }
577
- function qe({
578
- schemas: t,
579
- onAdd: a,
580
- onChange: o,
579
+ function Je({
580
+ schemas: e,
581
+ onAdd: n,
582
+ onChange: r,
581
583
  readOnly: i
582
584
  }) {
583
- const { t: r } = $(), c = Object.keys(t), [l, d] = C(c[0] ?? null), p = l ? t[l] : null, v = (p == null ? void 0 : p.properties) ?? {}, u = (b) => {
584
- !l || !p || o({ ...t, [l]: { ...p, ...b } });
585
- }, N = (b, y) => {
586
- u({ properties: { ...v, [b]: y } });
585
+ const { t: a } = O(), c = Object.keys(e), [l, d] = C(c[0] ?? null), p = l ? e[l] : null, y = (p == null ? void 0 : p.properties) ?? {}, u = (_) => {
586
+ !l || !p || r({ ...e, [l]: { ...p, ..._ } });
587
+ }, N = (_, v) => {
588
+ u({ properties: { ...y, [_]: v } });
587
589
  };
588
- return /* @__PURE__ */ n("div", { className: "nice-api-designer__schemas-editor", children: [
589
- /* @__PURE__ */ n("div", { className: "nice-api-designer__schemas-list", children: [
590
- /* @__PURE__ */ n("div", { className: "nice-api-designer__list-header", children: [
591
- /* @__PURE__ */ e("h3", { children: r("apiDesigner.schemas", "Schemas") }),
592
- !i && /* @__PURE__ */ n(U, { size: "sm", variant: "ghost", onClick: a, children: [
593
- /* @__PURE__ */ e(B, { name: "plus", size: 14 }),
590
+ return /* @__PURE__ */ s("div", { className: "nice-api-designer__schemas-editor", children: [
591
+ /* @__PURE__ */ s("div", { className: "nice-api-designer__schemas-list", children: [
592
+ /* @__PURE__ */ s("div", { className: "nice-api-designer__list-header", children: [
593
+ /* @__PURE__ */ t("h3", { children: a("apiDesigner.schemas", "Schemas") }),
594
+ !i && /* @__PURE__ */ s(U, { size: "sm", variant: "ghost", onClick: n, children: [
595
+ /* @__PURE__ */ t(B, { name: "plus", size: 14 }),
594
596
  " ",
595
- r("apiDesigner.add", "Add")
597
+ a("apiDesigner.add", "Add")
596
598
  ] })
597
599
  ] }),
598
- c.map((b) => /* @__PURE__ */ e(
600
+ c.map((_) => /* @__PURE__ */ t(
599
601
  "div",
600
602
  {
601
603
  role: "button",
602
604
  tabIndex: 0,
603
- onKeyDown: ge,
604
- className: `nice-api-designer__schema-item ${l === b ? "nice-api-designer__schema-item--selected" : ""}`,
605
- onClick: () => d(b),
606
- children: b
605
+ onKeyDown: _e,
606
+ className: `nice-api-designer__schema-item ${l === _ ? "nice-api-designer__schema-item--selected" : ""}`,
607
+ onClick: () => d(_),
608
+ children: _
607
609
  },
608
- b
610
+ _
609
611
  ))
610
612
  ] }),
611
- l && p && /* @__PURE__ */ n("div", { className: "nice-api-designer__schema-editor", children: [
612
- /* @__PURE__ */ e("h3", { children: l }),
613
- /* @__PURE__ */ e(
613
+ l && p && /* @__PURE__ */ s("div", { className: "nice-api-designer__schema-editor", children: [
614
+ /* @__PURE__ */ t("h3", { children: l }),
615
+ /* @__PURE__ */ t(
614
616
  se,
615
617
  {
616
- label: r("apiDesigner.type", "Type"),
618
+ label: a("apiDesigner.type", "Type"),
617
619
  value: p.type || "object",
618
- options: be,
619
- onChange: (b) => u({ type: b })
620
+ options: fe,
621
+ onChange: (_) => u({ type: _ })
620
622
  }
621
623
  ),
622
- /* @__PURE__ */ e(
623
- oe,
624
+ /* @__PURE__ */ t(
625
+ ce,
624
626
  {
625
- label: r("apiDesigner.description", "Description"),
627
+ label: a("apiDesigner.description", "Description"),
626
628
  value: p.description || "",
627
- onChange: (b) => u({ description: b }),
629
+ onChange: (_) => u({ description: _ }),
628
630
  readOnly: i,
629
631
  rows: 2
630
632
  }
631
633
  ),
632
- /* @__PURE__ */ n("div", { className: "nice-api-designer__subhead", children: [
633
- /* @__PURE__ */ e("h4", { children: r("apiDesigner.properties", "Properties") }),
634
- !i && /* @__PURE__ */ n(
634
+ /* @__PURE__ */ s("div", { className: "nice-api-designer__subhead", children: [
635
+ /* @__PURE__ */ t("h4", { children: a("apiDesigner.properties", "Properties") }),
636
+ !i && /* @__PURE__ */ s(
635
637
  U,
636
638
  {
637
639
  size: "sm",
638
640
  variant: "ghost",
639
641
  onClick: () => {
640
- let b = "field", y = 1;
641
- for (; v[b]; )
642
- b = `field${y++}`;
643
- N(b, { type: "string" });
642
+ let _ = "field", v = 1;
643
+ for (; y[_]; )
644
+ _ = `field${v++}`;
645
+ N(_, { type: "string" });
644
646
  },
645
647
  children: [
646
- /* @__PURE__ */ e(B, { name: "plus", size: 14 }),
648
+ /* @__PURE__ */ t(B, { name: "plus", size: 14 }),
647
649
  " ",
648
- r("apiDesigner.add", "Add")
650
+ a("apiDesigner.add", "Add")
649
651
  ]
650
652
  }
651
653
  )
652
654
  ] }),
653
- Object.keys(v).length === 0 && /* @__PURE__ */ e("p", { className: "nice-api-designer__muted", children: r("apiDesigner.noProperties", "No properties.") }),
654
- Object.entries(v).map(([b, y]) => {
655
- const T = (p.required || []).includes(b);
656
- return /* @__PURE__ */ n("div", { className: "nice-api-designer__param-row", children: [
657
- /* @__PURE__ */ e(
655
+ Object.keys(y).length === 0 && /* @__PURE__ */ t("p", { className: "nice-api-designer__muted", children: a("apiDesigner.noProperties", "No properties.") }),
656
+ Object.entries(y).map(([_, v]) => {
657
+ const T = (p.required || []).includes(_);
658
+ return /* @__PURE__ */ s("div", { className: "nice-api-designer__param-row", children: [
659
+ /* @__PURE__ */ t(
658
660
  L,
659
661
  {
660
662
  size: "sm",
661
- value: b,
662
- onChange: (m) => {
663
- if (!m || m === b || v[m])
663
+ value: _,
664
+ onChange: (h) => {
665
+ if (!h || h === _ || y[h])
664
666
  return;
665
667
  const S = {};
666
- Object.entries(v).forEach(([w, A]) => {
667
- S[w === b ? m : w] = A;
668
+ Object.entries(y).forEach(([w, D]) => {
669
+ S[w === _ ? h : w] = D;
668
670
  }), u({
669
671
  properties: S,
670
- required: (p.required || []).map((w) => w === b ? m : w)
672
+ required: (p.required || []).map((w) => w === _ ? h : w)
671
673
  });
672
674
  },
673
675
  readOnly: i
674
676
  }
675
677
  ),
676
- /* @__PURE__ */ e(
678
+ /* @__PURE__ */ t(
677
679
  se,
678
680
  {
679
681
  size: "sm",
680
- value: y.type || "string",
681
- options: be,
682
- onChange: (m) => N(b, { ...y, type: m })
682
+ value: v.type || "string",
683
+ options: fe,
684
+ onChange: (h) => N(_, { ...v, type: h })
683
685
  }
684
686
  ),
685
- /* @__PURE__ */ e(
686
- Ne,
687
+ /* @__PURE__ */ t(
688
+ ke,
687
689
  {
688
690
  checked: T,
689
- onChange: (m) => u({
690
- required: m ? [...p.required || [], b] : (p.required || []).filter((S) => S !== b)
691
+ onChange: (h) => u({
692
+ required: h ? [...p.required || [], _] : (p.required || []).filter((S) => S !== _)
691
693
  }),
692
694
  label: "required"
693
695
  }
694
696
  ),
695
- !i && /* @__PURE__ */ e(
697
+ !i && /* @__PURE__ */ t(
696
698
  U,
697
699
  {
698
700
  size: "sm",
699
701
  variant: "ghost",
700
702
  onClick: () => {
701
- const { [b]: m, ...S } = v;
703
+ const { [_]: h, ...S } = y;
702
704
  u({
703
705
  properties: S,
704
- required: (p.required || []).filter((w) => w !== b)
706
+ required: (p.required || []).filter((w) => w !== _)
705
707
  });
706
708
  },
707
- "aria-label": r("apiDesigner.remove2", "Remove {propName}").replace(
709
+ "aria-label": a("apiDesigner.remove2", "Remove {propName}").replace(
708
710
  "{propName}",
709
- String(b)
711
+ String(_)
710
712
  ),
711
- children: /* @__PURE__ */ e(B, { name: "close", size: 14 })
713
+ children: /* @__PURE__ */ t(B, { name: "close", size: 14 })
712
714
  }
713
715
  )
714
- ] }, b);
716
+ ] }, _);
715
717
  }),
716
- /* @__PURE__ */ n("details", { className: "nice-api-designer__raw", children: [
717
- /* @__PURE__ */ e("summary", { children: r("apiDesigner.rawJsonSchema", "Raw JSON schema") }),
718
- /* @__PURE__ */ e(
719
- oe,
718
+ /* @__PURE__ */ s("details", { className: "nice-api-designer__raw", children: [
719
+ /* @__PURE__ */ t("summary", { children: a("apiDesigner.rawJsonSchema", "Raw JSON schema") }),
720
+ /* @__PURE__ */ t(
721
+ ce,
720
722
  {
721
723
  value: JSON.stringify(p, null, 2),
722
- onChange: (b) => {
724
+ onChange: (_) => {
723
725
  try {
724
- const y = JSON.parse(b);
725
- o({ ...t, [l]: y });
726
+ const v = JSON.parse(_);
727
+ r({ ...e, [l]: v });
726
728
  } catch {
727
729
  }
728
730
  },
@@ -735,125 +737,125 @@ function qe({
735
737
  ] })
736
738
  ] });
737
739
  }
738
- function $e({ schemes: t, onChange: a, readOnly: o }) {
739
- const { t: i } = $(), r = (c, l) => a({ ...t, [c]: l });
740
- return /* @__PURE__ */ n("div", { className: "nice-api-designer__security-editor", children: [
741
- /* @__PURE__ */ n("div", { className: "nice-api-designer__list-header", children: [
742
- /* @__PURE__ */ e("h3", { children: i("apiDesigner.securitySchemes", "Security schemes") }),
743
- !o && /* @__PURE__ */ n(
740
+ function Ge({ schemes: e, onChange: n, readOnly: r }) {
741
+ const { t: i } = O(), a = (c, l) => n({ ...e, [c]: l });
742
+ return /* @__PURE__ */ s("div", { className: "nice-api-designer__security-editor", children: [
743
+ /* @__PURE__ */ s("div", { className: "nice-api-designer__list-header", children: [
744
+ /* @__PURE__ */ t("h3", { children: i("apiDesigner.securitySchemes", "Security schemes") }),
745
+ !r && /* @__PURE__ */ s(
744
746
  U,
745
747
  {
746
748
  size: "sm",
747
749
  variant: "ghost",
748
750
  onClick: () => {
749
751
  let c = "newScheme", l = 1;
750
- for (; t[c]; )
752
+ for (; e[c]; )
751
753
  c = `newScheme${l++}`;
752
- r(c, { type: "apiKey", name: "X-API-Key", in: "header" });
754
+ a(c, { type: "apiKey", name: "X-API-Key", in: "header" });
753
755
  },
754
756
  children: [
755
- /* @__PURE__ */ e(B, { name: "plus", size: 14 }),
757
+ /* @__PURE__ */ t(B, { name: "plus", size: 14 }),
756
758
  " ",
757
759
  i("apiDesigner.add", "Add")
758
760
  ]
759
761
  }
760
762
  )
761
763
  ] }),
762
- Object.entries(t).map(([c, l]) => /* @__PURE__ */ n("div", { className: "nice-api-designer__security-item", children: [
763
- /* @__PURE__ */ n("div", { className: "nice-api-designer__subhead", children: [
764
- /* @__PURE__ */ e("h4", { children: c }),
765
- !o && /* @__PURE__ */ e(
764
+ Object.entries(e).map(([c, l]) => /* @__PURE__ */ s("div", { className: "nice-api-designer__security-item", children: [
765
+ /* @__PURE__ */ s("div", { className: "nice-api-designer__subhead", children: [
766
+ /* @__PURE__ */ t("h4", { children: c }),
767
+ !r && /* @__PURE__ */ t(
766
768
  U,
767
769
  {
768
770
  size: "sm",
769
771
  variant: "ghost",
770
772
  onClick: () => {
771
- const { [c]: d, ...p } = t;
772
- a(p);
773
+ const { [c]: d, ...p } = e;
774
+ n(p);
773
775
  },
774
776
  "aria-label": i("apiDesigner.remove", "Remove {name}").replace(
775
777
  "{name}",
776
778
  String(c)
777
779
  ),
778
- children: /* @__PURE__ */ e(B, { name: "close", size: 14 })
780
+ children: /* @__PURE__ */ t(B, { name: "close", size: 14 })
779
781
  }
780
782
  )
781
783
  ] }),
782
- /* @__PURE__ */ n("div", { className: "nice-api-designer__param-row", children: [
783
- /* @__PURE__ */ e(
784
+ /* @__PURE__ */ s("div", { className: "nice-api-designer__param-row", children: [
785
+ /* @__PURE__ */ t(
784
786
  se,
785
787
  {
786
788
  size: "sm",
787
789
  value: l.type,
788
- options: xe.map((d) => ({ value: String(d), label: String(d) })),
789
- onChange: (d) => r(c, { ...l, type: d })
790
+ options: Le.map((d) => ({ value: String(d), label: String(d) })),
791
+ onChange: (d) => a(c, { ...l, type: d })
790
792
  }
791
793
  ),
792
- l.type === "apiKey" && /* @__PURE__ */ n(Q, { children: [
793
- /* @__PURE__ */ e(
794
+ l.type === "apiKey" && /* @__PURE__ */ s(Q, { children: [
795
+ /* @__PURE__ */ t(
794
796
  L,
795
797
  {
796
798
  size: "sm",
797
799
  value: l.name || "",
798
800
  placeholder: i("apiDesigner.headerParamName", "header/param name"),
799
- onChange: (d) => r(c, { ...l, name: d }),
800
- readOnly: o
801
+ onChange: (d) => a(c, { ...l, name: d }),
802
+ readOnly: r
801
803
  }
802
804
  ),
803
- /* @__PURE__ */ e(
805
+ /* @__PURE__ */ t(
804
806
  se,
805
807
  {
806
808
  size: "sm",
807
809
  value: l.in || "header",
808
810
  options: ["header", "query", "cookie"].map((d) => ({ value: d, label: d })),
809
- onChange: (d) => r(c, { ...l, in: d })
811
+ onChange: (d) => a(c, { ...l, in: d })
810
812
  }
811
813
  )
812
814
  ] }),
813
- l.type === "http" && /* @__PURE__ */ n(Q, { children: [
814
- /* @__PURE__ */ e(
815
+ l.type === "http" && /* @__PURE__ */ s(Q, { children: [
816
+ /* @__PURE__ */ t(
815
817
  L,
816
818
  {
817
819
  size: "sm",
818
820
  value: l.scheme || "",
819
821
  placeholder: i("apiDesigner.schemeBearerBasic", "scheme (bearer/basic)"),
820
- onChange: (d) => r(c, { ...l, scheme: d }),
821
- readOnly: o
822
+ onChange: (d) => a(c, { ...l, scheme: d }),
823
+ readOnly: r
822
824
  }
823
825
  ),
824
- /* @__PURE__ */ e(
826
+ /* @__PURE__ */ t(
825
827
  L,
826
828
  {
827
829
  size: "sm",
828
830
  value: l.bearerFormat || "",
829
831
  placeholder: i("apiDesigner.bearerformatJwt", "bearerFormat (JWT)"),
830
- onChange: (d) => r(c, { ...l, bearerFormat: d }),
831
- readOnly: o
832
+ onChange: (d) => a(c, { ...l, bearerFormat: d }),
833
+ readOnly: r
832
834
  }
833
835
  )
834
836
  ] })
835
837
  ] }),
836
- /* @__PURE__ */ e(
838
+ /* @__PURE__ */ t(
837
839
  L,
838
840
  {
839
841
  size: "sm",
840
842
  value: l.description || "",
841
843
  placeholder: i("apiDesigner.description", "Description"),
842
- onChange: (d) => r(c, { ...l, description: d }),
843
- readOnly: o
844
+ onChange: (d) => a(c, { ...l, description: d }),
845
+ readOnly: r
844
846
  }
845
847
  )
846
848
  ] }, c))
847
849
  ] });
848
850
  }
849
- function Be({ schema: t }) {
850
- const { t: a } = $();
851
- return /* @__PURE__ */ n("div", { className: "nice-api-designer__json-preview", children: [
852
- /* @__PURE__ */ e("h3", { children: a("apiDesigner.openapiSpecification", "OpenAPI specification") }),
853
- /* @__PURE__ */ e("pre", { className: "nice-api-designer__code", children: JSON.stringify(t, null, 2) })
851
+ function We({ schema: e }) {
852
+ const { t: n } = O();
853
+ return /* @__PURE__ */ s("div", { className: "nice-api-designer__json-preview", children: [
854
+ /* @__PURE__ */ t("h3", { children: n("apiDesigner.openapiSpecification", "OpenAPI specification") }),
855
+ /* @__PURE__ */ t("pre", { className: "nice-api-designer__code", children: JSON.stringify(e, null, 2) })
854
856
  ] });
855
857
  }
856
- const ze = [
858
+ const Ye = [
857
859
  {
858
860
  target: ".nice-api-tester",
859
861
  titleKey: "tutorial.apiTester.intro.title",
@@ -862,7 +864,7 @@ const ze = [
862
864
  content: "Build requests with collections and environment variables, send them and assert on the responses.",
863
865
  placement: "auto"
864
866
  }
865
- ], Oe = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"], Ke = {
867
+ ], Xe = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"], Qe = {
866
868
  id: "",
867
869
  name: "New Request",
868
870
  method: "GET",
@@ -870,85 +872,85 @@ const ze = [
870
872
  headers: {},
871
873
  queryParams: {}
872
874
  };
873
- function he(t, a) {
874
- return t.replace(/\{\{(\w+)\}\}/g, (o, i) => a[i] || `{{${i}}}`);
875
+ function he(e, n) {
876
+ return e.replace(/\{\{(\w+)\}\}/g, (r, i) => n[i] || `{{${i}}}`);
875
877
  }
876
- function je(t, a) {
877
- const o = Object.entries(a).filter(([, i]) => i).map(([i, r]) => `${encodeURIComponent(i)}=${encodeURIComponent(r)}`).join("&");
878
- return o ? `${t}?${o}` : t;
878
+ function Ze(e, n) {
879
+ const r = Object.entries(n).filter(([, i]) => i).map(([i, a]) => `${encodeURIComponent(i)}=${encodeURIComponent(a)}`).join("&");
880
+ return r ? `${e}?${r}` : e;
879
881
  }
880
- function lt({
881
- collections: t = [],
882
- environments: a = [],
883
- onRequest: o,
882
+ function Pt({
883
+ collections: e = [],
884
+ environments: n = [],
885
+ onRequest: r,
884
886
  onSaveCollection: i,
885
- className: r = "",
887
+ className: a = "",
886
888
  tutorial: c
887
889
  }) {
888
- const { t: l } = $(), [d, p] = C(t), [v, u] = C(a), [N, b] = C(
889
- a.find((s) => s.isActive) || null
890
- ), [y, T] = C({
891
- ...Ke,
892
- id: re()
893
- }), [m, S] = C(null), [w, A] = C(!1), [J, te] = C("none"), [z, M] = C(
890
+ const { t: l } = O(), [d, p] = C(e), [y, u] = C(n), [N, _] = C(
891
+ n.find((o) => o.isActive) || null
892
+ ), [v, T] = C({
893
+ ...Qe,
894
+ id: ae()
895
+ }), [h, S] = C(null), [w, D] = C(!1), [J, te] = C("none"), [$, M] = C(
894
896
  "params"
895
- ), [O, V] = C("body"), [G, k] = C(""), [f, x] = C(""), [K, F] = C([]), [R, ie] = C([]), j = de(null), Y = I(async () => {
897
+ ), [z, V] = C("body"), [W, k] = C(""), [f, x] = C(""), [j, F] = C([]), [R, ie] = C([]), K = pe(null), Y = I(async () => {
896
898
  var H;
897
- if (!y.url)
899
+ if (!v.url)
898
900
  return;
899
- A(!0), S(null), F([]);
900
- const s = Object.fromEntries(
901
- Object.entries((N == null ? void 0 : N.variables) || {}).map(([E, _]) => [E, _.value])
901
+ D(!0), S(null), F([]);
902
+ const o = Object.fromEntries(
903
+ Object.entries((N == null ? void 0 : N.variables) || {}).map(([E, b]) => [E, b.value])
902
904
  ), g = {
903
- ...y,
904
- url: he(y.url, s),
905
+ ...v,
906
+ url: he(v.url, o),
905
907
  headers: Object.fromEntries(
906
- Object.entries(y.headers).map(([E, _]) => [E, he(_, s)])
908
+ Object.entries(v.headers).map(([E, b]) => [E, he(b, o)])
907
909
  ),
908
910
  queryParams: Object.fromEntries(
909
- Object.entries(y.queryParams).map(([E, _]) => [
911
+ Object.entries(v.queryParams).map(([E, b]) => [
910
912
  E,
911
- he(_, s)
913
+ he(b, o)
912
914
  ])
913
915
  )
914
916
  }, P = performance.now();
915
917
  try {
916
918
  let E;
917
- if (o)
918
- E = await o(g);
919
+ if (r)
920
+ E = await r(g);
919
921
  else {
920
- j.current = new AbortController();
921
- const _ = { ...g.headers };
922
- y.auth && He(_, y.auth);
923
- const D = je(g.url, g.queryParams), q = {
922
+ K.current = new AbortController();
923
+ const b = { ...g.headers };
924
+ v.auth && et(b, v.auth);
925
+ const A = Ze(g.url, g.queryParams), q = {
924
926
  method: g.method,
925
- headers: _,
926
- signal: j.current.signal
927
+ headers: b,
928
+ signal: K.current.signal
927
929
  };
928
- ["POST", "PUT", "PATCH"].includes(g.method) && ((H = y.body) != null && H.content) && (q.body = typeof y.body.content == "string" ? y.body.content : JSON.stringify(y.body.content), y.body.type === "json" && (_["Content-Type"] = "application/json"));
929
- const W = await fetch(D, q), X = await W.text();
930
- let pe;
930
+ ["POST", "PUT", "PATCH"].includes(g.method) && ((H = v.body) != null && H.content) && (q.body = typeof v.body.content == "string" ? v.body.content : JSON.stringify(v.body.content), v.body.type === "json" && (b["Content-Type"] = "application/json"));
931
+ const G = await fetch(A, q), X = await G.text();
932
+ let ue;
931
933
  try {
932
- pe = JSON.parse(X);
934
+ ue = JSON.parse(X);
933
935
  } catch {
934
- pe = X;
936
+ ue = X;
935
937
  }
936
- const Ce = performance.now();
938
+ const De = performance.now();
937
939
  E = {
938
- status: W.status,
939
- statusText: W.statusText,
940
- headers: Object.fromEntries(W.headers.entries()),
941
- body: pe,
942
- time: Math.round(Ce - P),
940
+ status: G.status,
941
+ statusText: G.statusText,
942
+ headers: Object.fromEntries(G.headers.entries()),
943
+ body: ue,
944
+ time: Math.round(De - P),
943
945
  size: new Blob([X]).size,
944
946
  timestamp: /* @__PURE__ */ new Date()
945
947
  };
946
948
  }
947
949
  if (S(E), ie(
948
- (_) => [..._, { request: y, response: E }].slice(-50)
950
+ (b) => [...b, { request: v, response: E }].slice(-50)
949
951
  ), f) {
950
- const _ = Me(f, E);
951
- F(_);
952
+ const b = it(f, E);
953
+ F(b);
952
954
  }
953
955
  } catch (E) {
954
956
  E.name !== "AbortError" && S({
@@ -961,74 +963,74 @@ function lt({
961
963
  timestamp: /* @__PURE__ */ new Date()
962
964
  });
963
965
  } finally {
964
- A(!1), j.current = null;
966
+ D(!1), K.current = null;
965
967
  }
966
- }, [y, N, o, f]), ne = I(() => {
967
- var s;
968
- (s = j.current) == null || s.abort(), A(!1);
968
+ }, [v, N, r, f]), ne = I(() => {
969
+ var o;
970
+ (o = K.current) == null || o.abort(), D(!1);
969
971
  }, []), Z = I(() => {
970
- T((s) => ({
971
- ...s,
972
- headers: { ...s.headers, "": "" }
972
+ T((o) => ({
973
+ ...o,
974
+ headers: { ...o.headers, "": "" }
973
975
  }));
974
- }, []), ae = I(() => {
975
- T((s) => ({
976
- ...s,
977
- queryParams: { ...s.queryParams, "": "" }
976
+ }, []), re = I(() => {
977
+ T((o) => ({
978
+ ...o,
979
+ queryParams: { ...o.queryParams, "": "" }
978
980
  }));
979
- }, []), h = I(() => {
981
+ }, []), m = I(() => {
980
982
  if (d.length === 0) {
981
- const s = {
982
- id: re(),
983
+ const o = {
984
+ id: ae(),
983
985
  name: "My Collection",
984
- requests: [y]
986
+ requests: [v]
985
987
  };
986
- p([s]), i == null || i(s);
988
+ p([o]), i == null || i(o);
987
989
  } else {
988
- const s = {
990
+ const o = {
989
991
  ...d[0],
990
- requests: [...d[0].requests, y]
992
+ requests: [...d[0].requests, v]
991
993
  };
992
- p((g) => [s, ...g.slice(1)]), i == null || i(s);
994
+ p((g) => [o, ...g.slice(1)]), i == null || i(o);
993
995
  }
994
- }, [d, y, i]);
995
- return /* @__PURE__ */ n("div", { className: `nice-api-tester ${r}`, style: { position: "relative" }, children: [
996
- c && /* @__PURE__ */ e("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ e(ce, { steps: le(c, ze) }) }),
997
- /* @__PURE__ */ e("div", { className: "nice-api-tester__toolbar", children: /* @__PURE__ */ e("div", { className: "nice-api-tester__env-selector", children: /* @__PURE__ */ n(
996
+ }, [d, v, i]);
997
+ return /* @__PURE__ */ s("div", { className: `nice-api-tester ${a}`, style: { position: "relative" }, children: [
998
+ c && /* @__PURE__ */ t("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ t(le, { steps: de(c, Ye) }) }),
999
+ /* @__PURE__ */ t("div", { className: "nice-api-tester__toolbar", children: /* @__PURE__ */ t("div", { className: "nice-api-tester__env-selector", children: /* @__PURE__ */ s(
998
1000
  "select",
999
1001
  {
1000
1002
  value: (N == null ? void 0 : N.id) || "",
1001
- onChange: (s) => b(v.find((g) => g.id === s.target.value) || null),
1003
+ onChange: (o) => _(y.find((g) => g.id === o.target.value) || null),
1002
1004
  children: [
1003
- /* @__PURE__ */ e("option", { value: "", children: l("apiTester.noEnvironment", "No Environment") }),
1004
- v.map((s) => /* @__PURE__ */ e("option", { value: s.id, children: s.name }, s.id))
1005
+ /* @__PURE__ */ t("option", { value: "", children: l("apiTester.noEnvironment", "No Environment") }),
1006
+ y.map((o) => /* @__PURE__ */ t("option", { value: o.id, children: o.name }, o.id))
1005
1007
  ]
1006
1008
  }
1007
1009
  ) }) }),
1008
- /* @__PURE__ */ n("div", { className: "nice-api-tester__request-bar", children: [
1009
- /* @__PURE__ */ e(
1010
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__request-bar", children: [
1011
+ /* @__PURE__ */ t(
1010
1012
  "select",
1011
1013
  {
1012
- value: y.method,
1013
- onChange: (s) => T((g) => ({
1014
+ value: v.method,
1015
+ onChange: (o) => T((g) => ({
1014
1016
  ...g,
1015
- method: s.target.value
1017
+ method: o.target.value
1016
1018
  })),
1017
- className: `nice-api-tester__method nice-api-tester__method--${y.method.toLowerCase()}`,
1018
- children: Oe.map((s) => /* @__PURE__ */ e("option", { value: s, children: s }, s))
1019
+ className: `nice-api-tester__method nice-api-tester__method--${v.method.toLowerCase()}`,
1020
+ children: Xe.map((o) => /* @__PURE__ */ t("option", { value: o, children: o }, o))
1019
1021
  }
1020
1022
  ),
1021
- /* @__PURE__ */ e(
1023
+ /* @__PURE__ */ t(
1022
1024
  "input",
1023
1025
  {
1024
1026
  type: "text",
1025
- value: y.url,
1026
- onChange: (s) => T((g) => ({ ...g, url: s.target.value })),
1027
+ value: v.url,
1028
+ onChange: (o) => T((g) => ({ ...g, url: o.target.value })),
1027
1029
  placeholder: l("apiTester.enterRequestUrl", "Enter request URL"),
1028
1030
  className: "nice-api-tester__url-input"
1029
1031
  }
1030
1032
  ),
1031
- /* @__PURE__ */ e(
1033
+ /* @__PURE__ */ t(
1032
1034
  "button",
1033
1035
  {
1034
1036
  onClick: w ? ne : Y,
@@ -1036,56 +1038,56 @@ function lt({
1036
1038
  children: w ? l("apiTester.cancel", "Cancel") : l("apiTester.send", "Send")
1037
1039
  }
1038
1040
  ),
1039
- /* @__PURE__ */ e("button", { onClick: h, className: "nice-api-tester__save-btn", children: l("apiTester.save", "Save") })
1041
+ /* @__PURE__ */ t("button", { onClick: m, className: "nice-api-tester__save-btn", children: l("apiTester.save", "Save") })
1040
1042
  ] }),
1041
- /* @__PURE__ */ n("div", { className: "nice-api-tester__main", children: [
1042
- /* @__PURE__ */ n("div", { className: "nice-api-tester__request-panel", children: [
1043
- /* @__PURE__ */ e("div", { className: "nice-api-tester__tabs", children: ["params", "headers", "body", "auth", "tests"].map((s) => /* @__PURE__ */ e(
1043
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__main", children: [
1044
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__request-panel", children: [
1045
+ /* @__PURE__ */ t("div", { className: "nice-api-tester__tabs", children: ["params", "headers", "body", "auth", "tests"].map((o) => /* @__PURE__ */ t(
1044
1046
  "button",
1045
1047
  {
1046
- className: `nice-api-tester__tab ${z === s ? "nice-api-tester__tab--active" : ""}`,
1047
- onClick: () => M(s),
1048
- children: s.charAt(0).toUpperCase() + s.slice(1)
1048
+ className: `nice-api-tester__tab ${$ === o ? "nice-api-tester__tab--active" : ""}`,
1049
+ onClick: () => M(o),
1050
+ children: o.charAt(0).toUpperCase() + o.slice(1)
1049
1051
  },
1050
- s
1052
+ o
1051
1053
  )) }),
1052
- /* @__PURE__ */ n("div", { className: "nice-api-tester__tab-content", children: [
1053
- z === "params" && /* @__PURE__ */ e(
1054
- Le,
1054
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__tab-content", children: [
1055
+ $ === "params" && /* @__PURE__ */ t(
1056
+ nt,
1055
1057
  {
1056
- params: y.queryParams,
1057
- onChange: (s) => T((g) => ({ ...g, queryParams: s })),
1058
- onAdd: ae
1058
+ params: v.queryParams,
1059
+ onChange: (o) => T((g) => ({ ...g, queryParams: o })),
1060
+ onAdd: re
1059
1061
  }
1060
1062
  ),
1061
- z === "headers" && /* @__PURE__ */ e(
1062
- Ve,
1063
+ $ === "headers" && /* @__PURE__ */ t(
1064
+ rt,
1063
1065
  {
1064
- headers: y.headers,
1065
- onChange: (s) => T((g) => ({ ...g, headers: s })),
1066
+ headers: v.headers,
1067
+ onChange: (o) => T((g) => ({ ...g, headers: o })),
1066
1068
  onAdd: Z
1067
1069
  }
1068
1070
  ),
1069
- z === "body" && /* @__PURE__ */ e(
1070
- Fe,
1071
+ $ === "body" && /* @__PURE__ */ t(
1072
+ at,
1071
1073
  {
1072
- body: y.body,
1074
+ body: v.body,
1073
1075
  bodyTab: J,
1074
1076
  onBodyTabChange: te,
1075
- onChange: (s) => T((g) => ({ ...g, body: s }))
1077
+ onChange: (o) => T((g) => ({ ...g, body: o }))
1076
1078
  }
1077
1079
  ),
1078
- z === "auth" && /* @__PURE__ */ e(
1079
- Je,
1080
+ $ === "auth" && /* @__PURE__ */ t(
1081
+ st,
1080
1082
  {
1081
- auth: y.auth,
1082
- onChange: (s) => T((g) => ({ ...g, auth: s }))
1083
+ auth: v.auth,
1084
+ onChange: (o) => T((g) => ({ ...g, auth: o }))
1083
1085
  }
1084
1086
  ),
1085
- z === "tests" && /* @__PURE__ */ e(
1086
- We,
1087
+ $ === "tests" && /* @__PURE__ */ t(
1088
+ ot,
1087
1089
  {
1088
- preRequestScript: G,
1090
+ preRequestScript: W,
1089
1091
  testScript: f,
1090
1092
  onPreRequestChange: k,
1091
1093
  onTestChange: x
@@ -1093,82 +1095,82 @@ function lt({
1093
1095
  )
1094
1096
  ] })
1095
1097
  ] }),
1096
- /* @__PURE__ */ e("div", { className: "nice-api-tester__response-panel", children: m ? /* @__PURE__ */ n(Q, { children: [
1097
- /* @__PURE__ */ n("div", { className: "nice-api-tester__response-meta", children: [
1098
- /* @__PURE__ */ n(
1098
+ /* @__PURE__ */ t("div", { className: "nice-api-tester__response-panel", children: h ? /* @__PURE__ */ s(Q, { children: [
1099
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__response-meta", children: [
1100
+ /* @__PURE__ */ s(
1099
1101
  "span",
1100
1102
  {
1101
- className: `nice-api-tester__status nice-api-tester__status--${Math.floor(m.status / 100)}`,
1103
+ className: `nice-api-tester__status nice-api-tester__status--${Math.floor(h.status / 100)}`,
1102
1104
  children: [
1103
- m.status,
1105
+ h.status,
1104
1106
  " ",
1105
- m.statusText
1107
+ h.statusText
1106
1108
  ]
1107
1109
  }
1108
1110
  ),
1109
- /* @__PURE__ */ n("span", { className: "nice-api-tester__time", children: [
1110
- m.time,
1111
+ /* @__PURE__ */ s("span", { className: "nice-api-tester__time", children: [
1112
+ h.time,
1111
1113
  "ms"
1112
1114
  ] }),
1113
- /* @__PURE__ */ e("span", { className: "nice-api-tester__size", children: Ue(m.size) })
1115
+ /* @__PURE__ */ t("span", { className: "nice-api-tester__size", children: tt(h.size) })
1114
1116
  ] }),
1115
- /* @__PURE__ */ e("div", { className: "nice-api-tester__tabs", children: ["body", "headers", "tests"].map((s) => /* @__PURE__ */ n(
1117
+ /* @__PURE__ */ t("div", { className: "nice-api-tester__tabs", children: ["body", "headers", "tests"].map((o) => /* @__PURE__ */ s(
1116
1118
  "button",
1117
1119
  {
1118
- className: `nice-api-tester__tab ${O === s ? "nice-api-tester__tab--active" : ""}`,
1119
- onClick: () => V(s),
1120
+ className: `nice-api-tester__tab ${z === o ? "nice-api-tester__tab--active" : ""}`,
1121
+ onClick: () => V(o),
1120
1122
  children: [
1121
- s.charAt(0).toUpperCase() + s.slice(1),
1122
- s === "tests" && K.length > 0 && /* @__PURE__ */ n("span", { className: "nice-api-tester__test-badge", children: [
1123
- K.filter((g) => g.passed).length,
1123
+ o.charAt(0).toUpperCase() + o.slice(1),
1124
+ o === "tests" && j.length > 0 && /* @__PURE__ */ s("span", { className: "nice-api-tester__test-badge", children: [
1125
+ j.filter((g) => g.passed).length,
1124
1126
  "/",
1125
- K.length
1127
+ j.length
1126
1128
  ] })
1127
1129
  ]
1128
1130
  },
1129
- s
1131
+ o
1130
1132
  )) }),
1131
- /* @__PURE__ */ n("div", { className: "nice-api-tester__response-content", children: [
1132
- O === "body" && /* @__PURE__ */ e("pre", { className: "nice-api-tester__response-body", children: typeof m.body == "string" ? m.body : JSON.stringify(m.body, null, 2) }),
1133
- O === "headers" && /* @__PURE__ */ e("div", { className: "nice-api-tester__response-headers", children: Object.entries(m.headers).map(([s, g]) => /* @__PURE__ */ n("div", { className: "nice-api-tester__header-row", children: [
1134
- /* @__PURE__ */ e("span", { className: "nice-api-tester__header-key", children: s }),
1135
- /* @__PURE__ */ e("span", { className: "nice-api-tester__header-value", children: g })
1136
- ] }, s)) }),
1137
- O === "tests" && /* @__PURE__ */ e("div", { className: "nice-api-tester__test-results", children: K.map((s, g) => /* @__PURE__ */ n(
1133
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__response-content", children: [
1134
+ z === "body" && /* @__PURE__ */ t("pre", { className: "nice-api-tester__response-body", children: typeof h.body == "string" ? h.body : JSON.stringify(h.body, null, 2) }),
1135
+ z === "headers" && /* @__PURE__ */ t("div", { className: "nice-api-tester__response-headers", children: Object.entries(h.headers).map(([o, g]) => /* @__PURE__ */ s("div", { className: "nice-api-tester__header-row", children: [
1136
+ /* @__PURE__ */ t("span", { className: "nice-api-tester__header-key", children: o }),
1137
+ /* @__PURE__ */ t("span", { className: "nice-api-tester__header-value", children: g })
1138
+ ] }, o)) }),
1139
+ z === "tests" && /* @__PURE__ */ t("div", { className: "nice-api-tester__test-results", children: j.map((o, g) => /* @__PURE__ */ s(
1138
1140
  "div",
1139
1141
  {
1140
- className: `nice-api-tester__test-result nice-api-tester__test-result--${s.passed ? "pass" : "fail"}`,
1142
+ className: `nice-api-tester__test-result nice-api-tester__test-result--${o.passed ? "pass" : "fail"}`,
1141
1143
  children: [
1142
- /* @__PURE__ */ e("span", { className: "nice-api-tester__test-icon", children: /* @__PURE__ */ e(B, { name: s.passed ? "check" : "close", size: 14 }) }),
1143
- /* @__PURE__ */ e("span", { className: "nice-api-tester__test-name", children: s.name }),
1144
- s.message && /* @__PURE__ */ e("span", { className: "nice-api-tester__test-message", children: s.message })
1144
+ /* @__PURE__ */ t("span", { className: "nice-api-tester__test-icon", children: /* @__PURE__ */ t(B, { name: o.passed ? "check" : "close", size: 14 }) }),
1145
+ /* @__PURE__ */ t("span", { className: "nice-api-tester__test-name", children: o.name }),
1146
+ o.message && /* @__PURE__ */ t("span", { className: "nice-api-tester__test-message", children: o.message })
1145
1147
  ]
1146
1148
  },
1147
1149
  g
1148
1150
  )) })
1149
1151
  ] })
1150
- ] }) : /* @__PURE__ */ e("div", { className: "nice-api-tester__empty-response", children: w ? l("apiTester.loading", "Loading...") : l("apiTester.sendARequestToSee", "Send a request to see the response") }) })
1152
+ ] }) : /* @__PURE__ */ t("div", { className: "nice-api-tester__empty-response", children: w ? l("apiTester.loading", "Loading...") : l("apiTester.sendARequestToSee", "Send a request to see the response") }) })
1151
1153
  ] }),
1152
- R.length > 0 && /* @__PURE__ */ n("div", { className: "nice-api-tester__history", children: [
1153
- /* @__PURE__ */ e("h4", { children: l("apiTester.history", "History") }),
1154
- /* @__PURE__ */ e("div", { className: "nice-api-tester__history-list", children: R.slice().reverse().map(({ request: s, response: g }, P) => /* @__PURE__ */ n(
1154
+ R.length > 0 && /* @__PURE__ */ s("div", { className: "nice-api-tester__history", children: [
1155
+ /* @__PURE__ */ t("h4", { children: l("apiTester.history", "History") }),
1156
+ /* @__PURE__ */ t("div", { className: "nice-api-tester__history-list", children: R.slice().reverse().map(({ request: o, response: g }, P) => /* @__PURE__ */ s(
1155
1157
  "div",
1156
1158
  {
1157
1159
  role: "button",
1158
1160
  tabIndex: 0,
1159
- onKeyDown: ge,
1161
+ onKeyDown: _e,
1160
1162
  className: "nice-api-tester__history-item",
1161
- onClick: () => T(s),
1163
+ onClick: () => T(o),
1162
1164
  children: [
1163
- /* @__PURE__ */ e(
1165
+ /* @__PURE__ */ t(
1164
1166
  "span",
1165
1167
  {
1166
- className: `nice-api-tester__method nice-api-tester__method--${s.method.toLowerCase()}`,
1167
- children: s.method
1168
+ className: `nice-api-tester__method nice-api-tester__method--${o.method.toLowerCase()}`,
1169
+ children: o.method
1168
1170
  }
1169
1171
  ),
1170
- /* @__PURE__ */ e("span", { className: "nice-api-tester__history-url", children: s.url }),
1171
- /* @__PURE__ */ e(
1172
+ /* @__PURE__ */ t("span", { className: "nice-api-tester__history-url", children: o.url }),
1173
+ /* @__PURE__ */ t(
1172
1174
  "span",
1173
1175
  {
1174
1176
  className: `nice-api-tester__status nice-api-tester__status--${Math.floor(
@@ -1184,61 +1186,61 @@ function lt({
1184
1186
  ] })
1185
1187
  ] });
1186
1188
  }
1187
- function He(t, a) {
1188
- var o, i, r, c, l;
1189
- switch (a.type) {
1189
+ function et(e, n) {
1190
+ var r, i, a, c, l;
1191
+ switch (n.type) {
1190
1192
  case "bearer":
1191
- t.Authorization = `${((o = a.bearer) == null ? void 0 : o.prefix) || "Bearer"} ${(i = a.bearer) == null ? void 0 : i.token}`;
1193
+ e.Authorization = `${((r = n.bearer) == null ? void 0 : r.prefix) || "Bearer"} ${(i = n.bearer) == null ? void 0 : i.token}`;
1192
1194
  break;
1193
1195
  case "basic":
1194
- t.Authorization = `Basic ${btoa(`${(r = a.basic) == null ? void 0 : r.username}:${(c = a.basic) == null ? void 0 : c.password}`)}`;
1196
+ e.Authorization = `Basic ${btoa(`${(a = n.basic) == null ? void 0 : a.username}:${(c = n.basic) == null ? void 0 : c.password}`)}`;
1195
1197
  break;
1196
1198
  case "api-key":
1197
- ((l = a.apiKey) == null ? void 0 : l.in) === "header" && (t[a.apiKey.key] = a.apiKey.value);
1199
+ ((l = n.apiKey) == null ? void 0 : l.in) === "header" && (e[n.apiKey.key] = n.apiKey.value);
1198
1200
  break;
1199
1201
  }
1200
1202
  }
1201
- function Ue(t) {
1202
- return t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : `${(t / (1024 * 1024)).toFixed(1)} MB`;
1203
+ function tt(e) {
1204
+ return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
1203
1205
  }
1204
- function Me(t, a) {
1205
- const o = [], i = {
1206
+ function it(e, n) {
1207
+ const r = [], i = {
1206
1208
  response: {
1207
- code: a.status,
1208
- status: a.statusText,
1209
- headers: a.headers,
1210
- json: () => a.body,
1211
- text: () => typeof a.body == "string" ? a.body : JSON.stringify(a.body),
1212
- responseTime: a.time
1209
+ code: n.status,
1210
+ status: n.statusText,
1211
+ headers: n.headers,
1212
+ json: () => n.body,
1213
+ text: () => typeof n.body == "string" ? n.body : JSON.stringify(n.body),
1214
+ responseTime: n.time
1213
1215
  },
1214
- test: (r, c) => {
1216
+ test: (a, c) => {
1215
1217
  const l = performance.now();
1216
1218
  try {
1217
- c(), o.push({ name: r, passed: !0, duration: performance.now() - l });
1219
+ c(), r.push({ name: a, passed: !0, duration: performance.now() - l });
1218
1220
  } catch (d) {
1219
- o.push({
1220
- name: r,
1221
+ r.push({
1222
+ name: a,
1221
1223
  passed: !1,
1222
1224
  message: d.message,
1223
1225
  duration: performance.now() - l
1224
1226
  });
1225
1227
  }
1226
1228
  },
1227
- expect: (r) => ({
1229
+ expect: (a) => ({
1228
1230
  to: {
1229
1231
  equal: (c) => {
1230
- if (r !== c)
1231
- throw new Error(`Expected ${c} but got ${r}`);
1232
+ if (a !== c)
1233
+ throw new Error(`Expected ${c} but got ${a}`);
1232
1234
  },
1233
1235
  be: {
1234
1236
  oneOf: (c) => {
1235
- if (!c.includes(r))
1236
- throw new Error(`Expected ${r} to be one of ${c}`);
1237
+ if (!c.includes(a))
1238
+ throw new Error(`Expected ${a} to be one of ${c}`);
1237
1239
  }
1238
1240
  },
1239
1241
  have: {
1240
1242
  property: (c) => {
1241
- if (typeof r != "object" || r === null || !(c in r))
1243
+ if (typeof a != "object" || a === null || !(c in a))
1242
1244
  throw new Error(`Expected object to have property ${c}`);
1243
1245
  }
1244
1246
  }
@@ -1246,192 +1248,192 @@ function Me(t, a) {
1246
1248
  })
1247
1249
  };
1248
1250
  try {
1249
- new Function("pm", t)(i);
1250
- } catch (r) {
1251
- o.push({
1251
+ new Function("pm", e)(i);
1252
+ } catch (a) {
1253
+ r.push({
1252
1254
  name: "Script Error",
1253
1255
  passed: !1,
1254
- message: r.message,
1256
+ message: a.message,
1255
1257
  duration: 0
1256
1258
  });
1257
1259
  }
1258
- return o;
1260
+ return r;
1259
1261
  }
1260
- function ke({
1261
- items: t,
1262
- onChange: a,
1263
- onAdd: o,
1262
+ function Ee({
1263
+ items: e,
1264
+ onChange: n,
1265
+ onAdd: r,
1264
1266
  keyPlaceholder: i,
1265
- valuePlaceholder: r
1267
+ valuePlaceholder: a
1266
1268
  }) {
1267
- const { t: c } = $(), l = i ?? c("apiTester.key", "Key"), d = r ?? c("apiTester.value", "Value");
1268
- return /* @__PURE__ */ n("div", { className: "nice-api-tester__kv-editor", children: [
1269
- Object.entries(t).map(([p, v], u) => /* @__PURE__ */ n("div", { className: "nice-api-tester__kv-row", children: [
1270
- /* @__PURE__ */ e(
1269
+ const { t: c } = O(), l = i ?? c("apiTester.key", "Key"), d = a ?? c("apiTester.value", "Value");
1270
+ return /* @__PURE__ */ s("div", { className: "nice-api-tester__kv-editor", children: [
1271
+ Object.entries(e).map(([p, y], u) => /* @__PURE__ */ s("div", { className: "nice-api-tester__kv-row", children: [
1272
+ /* @__PURE__ */ t(
1271
1273
  "input",
1272
1274
  {
1273
1275
  type: "text",
1274
1276
  value: p,
1275
1277
  placeholder: l,
1276
1278
  onChange: (N) => {
1277
- const b = Object.entries(t);
1278
- b[u] = [N.target.value, v], a(Object.fromEntries(b));
1279
+ const _ = Object.entries(e);
1280
+ _[u] = [N.target.value, y], n(Object.fromEntries(_));
1279
1281
  }
1280
1282
  }
1281
1283
  ),
1282
- /* @__PURE__ */ e(
1284
+ /* @__PURE__ */ t(
1283
1285
  "input",
1284
1286
  {
1285
1287
  type: "text",
1286
- value: v,
1288
+ value: y,
1287
1289
  placeholder: d,
1288
- onChange: (N) => a({ ...t, [p]: N.target.value })
1290
+ onChange: (N) => n({ ...e, [p]: N.target.value })
1289
1291
  }
1290
1292
  ),
1291
- /* @__PURE__ */ e(
1293
+ /* @__PURE__ */ t(
1292
1294
  "button",
1293
1295
  {
1294
1296
  "aria-label": c("apiTester.close", "Close"),
1295
1297
  onClick: () => {
1296
- const { [p]: N, ...b } = t;
1297
- a(b);
1298
+ const { [p]: N, ..._ } = e;
1299
+ n(_);
1298
1300
  },
1299
- children: /* @__PURE__ */ e(B, { name: "close", size: 14 })
1301
+ children: /* @__PURE__ */ t(B, { name: "close", size: 14 })
1300
1302
  }
1301
1303
  )
1302
1304
  ] }, u)),
1303
- /* @__PURE__ */ e("button", { onClick: o, className: "nice-api-tester__add-btn", children: c("apiTester.add", "+ Add") })
1305
+ /* @__PURE__ */ t("button", { onClick: r, className: "nice-api-tester__add-btn", children: c("apiTester.add", "+ Add") })
1304
1306
  ] });
1305
1307
  }
1306
- function Le({
1307
- params: t,
1308
- onChange: a,
1309
- onAdd: o
1308
+ function nt({
1309
+ params: e,
1310
+ onChange: n,
1311
+ onAdd: r
1310
1312
  }) {
1311
- return /* @__PURE__ */ e(
1312
- ke,
1313
+ return /* @__PURE__ */ t(
1314
+ Ee,
1313
1315
  {
1314
- items: t,
1315
- onChange: a,
1316
- onAdd: o,
1316
+ items: e,
1317
+ onChange: n,
1318
+ onAdd: r,
1317
1319
  keyPlaceholder: "Parameter",
1318
1320
  valuePlaceholder: "Value"
1319
1321
  }
1320
1322
  );
1321
1323
  }
1322
- function Ve({
1323
- headers: t,
1324
- onChange: a,
1325
- onAdd: o
1324
+ function rt({
1325
+ headers: e,
1326
+ onChange: n,
1327
+ onAdd: r
1326
1328
  }) {
1327
- return /* @__PURE__ */ e(
1328
- ke,
1329
+ return /* @__PURE__ */ t(
1330
+ Ee,
1329
1331
  {
1330
- items: t,
1331
- onChange: a,
1332
- onAdd: o,
1332
+ items: e,
1333
+ onChange: n,
1334
+ onAdd: r,
1333
1335
  keyPlaceholder: "Header",
1334
1336
  valuePlaceholder: "Value"
1335
1337
  }
1336
1338
  );
1337
1339
  }
1338
- function Fe({
1339
- body: t,
1340
- bodyTab: a,
1341
- onBodyTabChange: o,
1340
+ function at({
1341
+ body: e,
1342
+ bodyTab: n,
1343
+ onBodyTabChange: r,
1342
1344
  onChange: i
1343
1345
  }) {
1344
- const { t: r } = $();
1345
- return /* @__PURE__ */ n("div", { className: "nice-api-tester__body-editor", children: [
1346
- /* @__PURE__ */ e("div", { className: "nice-api-tester__body-tabs", children: ["none", "json", "form-data", "raw"].map((c) => /* @__PURE__ */ n("label", { children: [
1347
- /* @__PURE__ */ e(
1346
+ const { t: a } = O();
1347
+ return /* @__PURE__ */ s("div", { className: "nice-api-tester__body-editor", children: [
1348
+ /* @__PURE__ */ t("div", { className: "nice-api-tester__body-tabs", children: ["none", "json", "form-data", "raw"].map((c) => /* @__PURE__ */ s("label", { children: [
1349
+ /* @__PURE__ */ t(
1348
1350
  "input",
1349
1351
  {
1350
1352
  type: "radio",
1351
- checked: a === c,
1353
+ checked: n === c,
1352
1354
  onChange: () => {
1353
- o(c), i({ type: c, content: "" });
1355
+ r(c), i({ type: c, content: "" });
1354
1356
  }
1355
1357
  }
1356
1358
  ),
1357
1359
  c
1358
1360
  ] }, c)) }),
1359
- a !== "none" && /* @__PURE__ */ e(
1361
+ n !== "none" && /* @__PURE__ */ t(
1360
1362
  "textarea",
1361
1363
  {
1362
- value: typeof (t == null ? void 0 : t.content) == "string" ? t.content : JSON.stringify(t == null ? void 0 : t.content, null, 2),
1363
- onChange: (c) => i({ type: a, content: c.target.value }),
1364
- placeholder: a === "json" ? '{ "key": "value" }' : r("apiTester.enterBodyContent", "Enter body content"),
1364
+ value: typeof (e == null ? void 0 : e.content) == "string" ? e.content : JSON.stringify(e == null ? void 0 : e.content, null, 2),
1365
+ onChange: (c) => i({ type: n, content: c.target.value }),
1366
+ placeholder: n === "json" ? '{ "key": "value" }' : a("apiTester.enterBodyContent", "Enter body content"),
1365
1367
  rows: 10,
1366
1368
  className: "nice-api-tester__body-textarea"
1367
1369
  }
1368
1370
  )
1369
1371
  ] });
1370
1372
  }
1371
- function Je({
1372
- auth: t,
1373
- onChange: a
1373
+ function st({
1374
+ auth: e,
1375
+ onChange: n
1374
1376
  }) {
1375
- var i, r, c, l, d, p;
1376
- const { t: o } = $();
1377
- return /* @__PURE__ */ n("div", { className: "nice-api-tester__auth-editor", children: [
1378
- /* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
1379
- /* @__PURE__ */ e("label", { children: o("apiTester.type", "Type") }),
1380
- /* @__PURE__ */ n(
1377
+ var i, a, c, l, d, p;
1378
+ const { t: r } = O();
1379
+ return /* @__PURE__ */ s("div", { className: "nice-api-tester__auth-editor", children: [
1380
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__field", children: [
1381
+ /* @__PURE__ */ t("label", { children: r("apiTester.type", "Type") }),
1382
+ /* @__PURE__ */ s(
1381
1383
  "select",
1382
1384
  {
1383
- value: (t == null ? void 0 : t.type) || "none",
1384
- onChange: (v) => a({ type: v.target.value }),
1385
+ value: (e == null ? void 0 : e.type) || "none",
1386
+ onChange: (y) => n({ type: y.target.value }),
1385
1387
  children: [
1386
- /* @__PURE__ */ e("option", { value: "none", children: o("apiTester.noAuth", "No Auth") }),
1387
- /* @__PURE__ */ e("option", { value: "api-key", children: o("apiTester.apiKey", "API Key") }),
1388
- /* @__PURE__ */ e("option", { value: "bearer", children: o("apiTester.bearerToken", "Bearer Token") }),
1389
- /* @__PURE__ */ e("option", { value: "basic", children: o("apiTester.basicAuth", "Basic Auth") }),
1390
- /* @__PURE__ */ e("option", { value: "oauth2", children: o("apiTester.oauth20", "OAuth 2.0") })
1388
+ /* @__PURE__ */ t("option", { value: "none", children: r("apiTester.noAuth", "No Auth") }),
1389
+ /* @__PURE__ */ t("option", { value: "api-key", children: r("apiTester.apiKey", "API Key") }),
1390
+ /* @__PURE__ */ t("option", { value: "bearer", children: r("apiTester.bearerToken", "Bearer Token") }),
1391
+ /* @__PURE__ */ t("option", { value: "basic", children: r("apiTester.basicAuth", "Basic Auth") }),
1392
+ /* @__PURE__ */ t("option", { value: "oauth2", children: r("apiTester.oauth20", "OAuth 2.0") })
1391
1393
  ]
1392
1394
  }
1393
1395
  )
1394
1396
  ] }),
1395
- (t == null ? void 0 : t.type) === "api-key" && /* @__PURE__ */ n(Q, { children: [
1396
- /* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
1397
- /* @__PURE__ */ e("label", { children: o("apiTester.key", "Key") }),
1398
- /* @__PURE__ */ e(
1397
+ (e == null ? void 0 : e.type) === "api-key" && /* @__PURE__ */ s(Q, { children: [
1398
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__field", children: [
1399
+ /* @__PURE__ */ t("label", { children: r("apiTester.key", "Key") }),
1400
+ /* @__PURE__ */ t(
1399
1401
  "input",
1400
1402
  {
1401
1403
  type: "text",
1402
- value: ((i = t.apiKey) == null ? void 0 : i.key) || "",
1403
- onChange: (v) => {
1404
+ value: ((i = e.apiKey) == null ? void 0 : i.key) || "",
1405
+ onChange: (y) => {
1404
1406
  var u, N;
1405
- return a({
1406
- ...t,
1407
+ return n({
1408
+ ...e,
1407
1409
  apiKey: {
1408
- ...t.apiKey,
1409
- key: v.target.value,
1410
- value: ((u = t.apiKey) == null ? void 0 : u.value) || "",
1411
- in: ((N = t.apiKey) == null ? void 0 : N.in) || "header"
1410
+ ...e.apiKey,
1411
+ key: y.target.value,
1412
+ value: ((u = e.apiKey) == null ? void 0 : u.value) || "",
1413
+ in: ((N = e.apiKey) == null ? void 0 : N.in) || "header"
1412
1414
  }
1413
1415
  });
1414
1416
  },
1415
- placeholder: o("apiTester.xApiKey", "X-API-Key")
1417
+ placeholder: r("apiTester.xApiKey", "X-API-Key")
1416
1418
  }
1417
1419
  )
1418
1420
  ] }),
1419
- /* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
1420
- /* @__PURE__ */ e("label", { children: o("apiTester.value", "Value") }),
1421
- /* @__PURE__ */ e(
1421
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__field", children: [
1422
+ /* @__PURE__ */ t("label", { children: r("apiTester.value", "Value") }),
1423
+ /* @__PURE__ */ t(
1422
1424
  "input",
1423
1425
  {
1424
1426
  type: "text",
1425
- value: ((r = t.apiKey) == null ? void 0 : r.value) || "",
1426
- onChange: (v) => {
1427
+ value: ((a = e.apiKey) == null ? void 0 : a.value) || "",
1428
+ onChange: (y) => {
1427
1429
  var u, N;
1428
- return a({
1429
- ...t,
1430
+ return n({
1431
+ ...e,
1430
1432
  apiKey: {
1431
- ...t.apiKey,
1432
- value: v.target.value,
1433
- key: ((u = t.apiKey) == null ? void 0 : u.key) || "",
1434
- in: ((N = t.apiKey) == null ? void 0 : N.in) || "header"
1433
+ ...e.apiKey,
1434
+ value: y.target.value,
1435
+ key: ((u = e.apiKey) == null ? void 0 : u.key) || "",
1436
+ in: ((N = e.apiKey) == null ? void 0 : N.in) || "header"
1435
1437
  }
1436
1438
  });
1437
1439
  },
@@ -1439,81 +1441,81 @@ function Je({
1439
1441
  }
1440
1442
  )
1441
1443
  ] }),
1442
- /* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
1443
- /* @__PURE__ */ e("label", { children: o("apiTester.addTo", "Add to") }),
1444
- /* @__PURE__ */ n(
1444
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__field", children: [
1445
+ /* @__PURE__ */ t("label", { children: r("apiTester.addTo", "Add to") }),
1446
+ /* @__PURE__ */ s(
1445
1447
  "select",
1446
1448
  {
1447
- value: ((c = t.apiKey) == null ? void 0 : c.in) || "header",
1448
- onChange: (v) => {
1449
+ value: ((c = e.apiKey) == null ? void 0 : c.in) || "header",
1450
+ onChange: (y) => {
1449
1451
  var u, N;
1450
- return a({
1451
- ...t,
1452
+ return n({
1453
+ ...e,
1452
1454
  apiKey: {
1453
- ...t.apiKey,
1454
- in: v.target.value,
1455
- key: ((u = t.apiKey) == null ? void 0 : u.key) || "",
1456
- value: ((N = t.apiKey) == null ? void 0 : N.value) || ""
1455
+ ...e.apiKey,
1456
+ in: y.target.value,
1457
+ key: ((u = e.apiKey) == null ? void 0 : u.key) || "",
1458
+ value: ((N = e.apiKey) == null ? void 0 : N.value) || ""
1457
1459
  }
1458
1460
  });
1459
1461
  },
1460
1462
  children: [
1461
- /* @__PURE__ */ e("option", { value: "header", children: o("apiTester.header", "Header") }),
1462
- /* @__PURE__ */ e("option", { value: "query", children: o("apiTester.queryParams", "Query Params") })
1463
+ /* @__PURE__ */ t("option", { value: "header", children: r("apiTester.header", "Header") }),
1464
+ /* @__PURE__ */ t("option", { value: "query", children: r("apiTester.queryParams", "Query Params") })
1463
1465
  ]
1464
1466
  }
1465
1467
  )
1466
1468
  ] })
1467
1469
  ] }),
1468
- (t == null ? void 0 : t.type) === "bearer" && /* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
1469
- /* @__PURE__ */ e("label", { children: o("apiTester.token", "Token") }),
1470
- /* @__PURE__ */ e(
1470
+ (e == null ? void 0 : e.type) === "bearer" && /* @__PURE__ */ s("div", { className: "nice-api-tester__field", children: [
1471
+ /* @__PURE__ */ t("label", { children: r("apiTester.token", "Token") }),
1472
+ /* @__PURE__ */ t(
1471
1473
  "input",
1472
1474
  {
1473
1475
  type: "text",
1474
- value: ((l = t.bearer) == null ? void 0 : l.token) || "",
1475
- onChange: (v) => a({ ...t, bearer: { token: v.target.value } }),
1476
+ value: ((l = e.bearer) == null ? void 0 : l.token) || "",
1477
+ onChange: (y) => n({ ...e, bearer: { token: y.target.value } }),
1476
1478
  placeholder: "your-bearer-token"
1477
1479
  }
1478
1480
  )
1479
1481
  ] }),
1480
- (t == null ? void 0 : t.type) === "basic" && /* @__PURE__ */ n(Q, { children: [
1481
- /* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
1482
- /* @__PURE__ */ e("label", { children: o("apiTester.username", "Username") }),
1483
- /* @__PURE__ */ e(
1482
+ (e == null ? void 0 : e.type) === "basic" && /* @__PURE__ */ s(Q, { children: [
1483
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__field", children: [
1484
+ /* @__PURE__ */ t("label", { children: r("apiTester.username", "Username") }),
1485
+ /* @__PURE__ */ t(
1484
1486
  "input",
1485
1487
  {
1486
1488
  type: "text",
1487
- value: ((d = t.basic) == null ? void 0 : d.username) || "",
1488
- onChange: (v) => {
1489
+ value: ((d = e.basic) == null ? void 0 : d.username) || "",
1490
+ onChange: (y) => {
1489
1491
  var u;
1490
- return a({
1491
- ...t,
1492
+ return n({
1493
+ ...e,
1492
1494
  basic: {
1493
- ...t.basic,
1494
- username: v.target.value,
1495
- password: ((u = t.basic) == null ? void 0 : u.password) || ""
1495
+ ...e.basic,
1496
+ username: y.target.value,
1497
+ password: ((u = e.basic) == null ? void 0 : u.password) || ""
1496
1498
  }
1497
1499
  });
1498
1500
  }
1499
1501
  }
1500
1502
  )
1501
1503
  ] }),
1502
- /* @__PURE__ */ n("div", { className: "nice-api-tester__field", children: [
1503
- /* @__PURE__ */ e("label", { children: o("apiTester.password", "Password") }),
1504
- /* @__PURE__ */ e(
1504
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__field", children: [
1505
+ /* @__PURE__ */ t("label", { children: r("apiTester.password", "Password") }),
1506
+ /* @__PURE__ */ t(
1505
1507
  "input",
1506
1508
  {
1507
1509
  type: "password",
1508
- value: ((p = t.basic) == null ? void 0 : p.password) || "",
1509
- onChange: (v) => {
1510
+ value: ((p = e.basic) == null ? void 0 : p.password) || "",
1511
+ onChange: (y) => {
1510
1512
  var u;
1511
- return a({
1512
- ...t,
1513
+ return n({
1514
+ ...e,
1513
1515
  basic: {
1514
- ...t.basic,
1515
- password: v.target.value,
1516
- username: ((u = t.basic) == null ? void 0 : u.username) || ""
1516
+ ...e.basic,
1517
+ password: y.target.value,
1518
+ username: ((u = e.basic) == null ? void 0 : u.username) || ""
1517
1519
  }
1518
1520
  });
1519
1521
  }
@@ -1523,32 +1525,32 @@ function Je({
1523
1525
  ] })
1524
1526
  ] });
1525
1527
  }
1526
- function We({
1527
- preRequestScript: t,
1528
- testScript: a,
1529
- onPreRequestChange: o,
1528
+ function ot({
1529
+ preRequestScript: e,
1530
+ testScript: n,
1531
+ onPreRequestChange: r,
1530
1532
  onTestChange: i
1531
1533
  }) {
1532
- const { t: r } = $();
1533
- return /* @__PURE__ */ n("div", { className: "nice-api-tester__tests-editor", children: [
1534
- /* @__PURE__ */ n("div", { className: "nice-api-tester__script-section", children: [
1535
- /* @__PURE__ */ e("h4", { children: r("apiTester.preRequestScript", "Pre-request Script") }),
1536
- /* @__PURE__ */ e(
1534
+ const { t: a } = O();
1535
+ return /* @__PURE__ */ s("div", { className: "nice-api-tester__tests-editor", children: [
1536
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__script-section", children: [
1537
+ /* @__PURE__ */ t("h4", { children: a("apiTester.preRequestScript", "Pre-request Script") }),
1538
+ /* @__PURE__ */ t(
1537
1539
  "textarea",
1538
1540
  {
1539
- value: t,
1540
- onChange: (c) => o(c.target.value),
1541
+ value: e,
1542
+ onChange: (c) => r(c.target.value),
1541
1543
  placeholder: "// Code to run before the request",
1542
1544
  rows: 5
1543
1545
  }
1544
1546
  )
1545
1547
  ] }),
1546
- /* @__PURE__ */ n("div", { className: "nice-api-tester__script-section", children: [
1547
- /* @__PURE__ */ e("h4", { children: r("apiTester.tests", "Tests") }),
1548
- /* @__PURE__ */ e(
1548
+ /* @__PURE__ */ s("div", { className: "nice-api-tester__script-section", children: [
1549
+ /* @__PURE__ */ t("h4", { children: a("apiTester.tests", "Tests") }),
1550
+ /* @__PURE__ */ t(
1549
1551
  "textarea",
1550
1552
  {
1551
- value: a,
1553
+ value: n,
1552
1554
  onChange: (c) => i(c.target.value),
1553
1555
  placeholder: `pm.test("Status code is 200", function () {
1554
1556
  pm.expect(pm.response.code).to.equal(200);
@@ -1559,7 +1561,7 @@ function We({
1559
1561
  ] })
1560
1562
  ] });
1561
1563
  }
1562
- const Ge = [
1564
+ const ct = [
1563
1565
  {
1564
1566
  target: ".nice-integration-builder",
1565
1567
  titleKey: "tutorial.integrationBuilder.intro.title",
@@ -1568,7 +1570,7 @@ const Ge = [
1568
1570
  content: "Wire a flow of nodes (triggers → actions → error handling) and connect them to build an integration.",
1569
1571
  placement: "auto"
1570
1572
  }
1571
- ], me = [
1573
+ ], ge = [
1572
1574
  { type: "trigger", label: "Trigger", icon: "zap", category: "Control" },
1573
1575
  { type: "http-request", label: "HTTP Request", icon: "globe", category: "Actions" },
1574
1576
  { type: "transform", label: "Transform", icon: "shuffle", category: "Data" },
@@ -1582,7 +1584,7 @@ const Ge = [
1582
1584
  { type: "webhook", label: "Webhook", icon: "link", category: "Actions" },
1583
1585
  { type: "function", label: "Function", icon: "code", category: "Actions" },
1584
1586
  { type: "error-handler", label: "Error Handler", icon: "warning", category: "Control" }
1585
- ], Ye = {
1587
+ ], lt = {
1586
1588
  id: "",
1587
1589
  name: "New Flow",
1588
1590
  nodes: [],
@@ -1591,35 +1593,35 @@ const Ge = [
1591
1593
  triggers: [],
1592
1594
  errorHandling: { strategy: "stop" }
1593
1595
  };
1594
- function dt({
1595
- flow: t,
1596
- connectors: a = [],
1597
- onChange: o,
1596
+ function At({
1597
+ flow: e,
1598
+ connectors: n = [],
1599
+ onChange: r,
1598
1600
  onSave: i,
1599
- onRun: r,
1601
+ onRun: a,
1600
1602
  className: c = "",
1601
1603
  tutorial: l
1602
1604
  }) {
1603
- const { t: d } = $(), [p, v] = C(
1604
- t || { ...Ye, id: re() }
1605
- ), [u, N] = C(null), [b, y] = C(!0), [T, m] = C("canvas"), [S, w] = C(!1), [A, J] = C(null), [te, z] = C(!1), [M, O] = C(null), [V, G] = C(!1), k = de(null), f = I(
1606
- (h) => {
1607
- v((s) => {
1608
- const g = h(s);
1609
- return o == null || o(g), g;
1605
+ const { t: d } = O(), [p, y] = C(
1606
+ e || { ...lt, id: ae() }
1607
+ ), [u, N] = C(null), [_, v] = C(!0), [T, h] = C("canvas"), [S, w] = C(!1), [D, J] = C(null), [te, $] = C(!1), [M, z] = C(null), [V, W] = C(!1), k = pe(null), f = I(
1608
+ (m) => {
1609
+ y((o) => {
1610
+ const g = m(o);
1611
+ return r == null || r(g), g;
1610
1612
  });
1611
1613
  },
1612
- [o]
1614
+ [r]
1613
1615
  ), x = I(
1614
- (h, s) => {
1616
+ (m, o) => {
1615
1617
  var P;
1616
1618
  const g = {
1617
- id: re(),
1618
- type: h,
1619
- name: ((P = me.find((H) => H.type === h)) == null ? void 0 : P.label) || h,
1620
- position: s,
1621
- config: Xe(h),
1622
- inputs: h !== "trigger" ? ["input"] : [],
1619
+ id: ae(),
1620
+ type: m,
1621
+ name: ((P = ge.find((H) => H.type === m)) == null ? void 0 : P.label) || m,
1622
+ position: o,
1623
+ config: dt(m),
1624
+ inputs: m !== "trigger" ? ["input"] : [],
1623
1625
  outputs: ["output"]
1624
1626
  };
1625
1627
  f((H) => ({
@@ -1628,37 +1630,37 @@ function dt({
1628
1630
  })), N(g);
1629
1631
  },
1630
1632
  [f]
1631
- ), K = I(
1632
- (h) => {
1633
- f((s) => ({
1634
- ...s,
1635
- nodes: s.nodes.filter((g) => g.id !== h),
1636
- connections: s.connections.filter(
1637
- (g) => g.sourceNodeId !== h && g.targetNodeId !== h
1633
+ ), j = I(
1634
+ (m) => {
1635
+ f((o) => ({
1636
+ ...o,
1637
+ nodes: o.nodes.filter((g) => g.id !== m),
1638
+ connections: o.connections.filter(
1639
+ (g) => g.sourceNodeId !== m && g.targetNodeId !== m
1638
1640
  )
1639
1641
  })), N(null);
1640
1642
  },
1641
1643
  [f]
1642
1644
  ), F = I(
1643
- (h, s) => {
1645
+ (m, o) => {
1644
1646
  f((g) => ({
1645
1647
  ...g,
1646
- nodes: g.nodes.map((P) => P.id === h ? { ...P, ...s } : P)
1647
- })), (u == null ? void 0 : u.id) === h && N((g) => g ? { ...g, ...s } : null);
1648
+ nodes: g.nodes.map((P) => P.id === m ? { ...P, ...o } : P)
1649
+ })), (u == null ? void 0 : u.id) === m && N((g) => g ? { ...g, ...o } : null);
1648
1650
  },
1649
1651
  [f, u]
1650
1652
  ), R = I(
1651
- (h, s, g, P) => {
1652
- h === g || p.connections.some(
1653
- (E) => E.sourceNodeId === h && E.targetNodeId === g && E.sourceOutput === s && E.targetInput === P
1653
+ (m, o, g, P) => {
1654
+ m === g || p.connections.some(
1655
+ (E) => E.sourceNodeId === m && E.targetNodeId === g && E.sourceOutput === o && E.targetInput === P
1654
1656
  ) || f((E) => ({
1655
1657
  ...E,
1656
1658
  connections: [
1657
1659
  ...E.connections,
1658
1660
  {
1659
- id: re(),
1660
- sourceNodeId: h,
1661
- sourceOutput: s,
1661
+ id: ae(),
1662
+ sourceNodeId: m,
1663
+ sourceOutput: o,
1662
1664
  targetNodeId: g,
1663
1665
  targetInput: P
1664
1666
  }
@@ -1667,183 +1669,183 @@ function dt({
1667
1669
  },
1668
1670
  [p.connections, f]
1669
1671
  ), ie = I(
1670
- (h) => {
1671
- f((s) => ({
1672
- ...s,
1673
- connections: s.connections.filter((g) => g.id !== h)
1672
+ (m) => {
1673
+ f((o) => ({
1674
+ ...o,
1675
+ connections: o.connections.filter((g) => g.id !== m)
1674
1676
  }));
1675
1677
  },
1676
1678
  [f]
1677
- ), j = I(
1678
- (h) => {
1679
- if (h.preventDefault(), !A || !k.current)
1679
+ ), K = I(
1680
+ (m) => {
1681
+ if (m.preventDefault(), !D || !k.current)
1680
1682
  return;
1681
- const s = k.current.getBoundingClientRect(), g = h.clientX - s.left, P = h.clientY - s.top;
1682
- x(A, { x: g, y: P }), w(!1), J(null);
1683
+ const o = k.current.getBoundingClientRect(), g = m.clientX - o.left, P = m.clientY - o.top;
1684
+ x(D, { x: g, y: P }), w(!1), J(null);
1683
1685
  },
1684
- [A, x]
1686
+ [D, x]
1685
1687
  ), Y = I(async () => {
1686
- if (r) {
1687
- G(!0);
1688
+ if (a) {
1689
+ W(!0);
1688
1690
  try {
1689
- await r(p);
1691
+ await a(p);
1690
1692
  } finally {
1691
- G(!1);
1693
+ W(!1);
1692
1694
  }
1693
1695
  }
1694
- }, [p, r]), ne = I(() => {
1696
+ }, [p, a]), ne = I(() => {
1695
1697
  i == null || i(p);
1696
- }, [p, i]), Z = b && T === "canvas" ? /* @__PURE__ */ n("div", { className: "nice-integration-builder__palette", children: [
1697
- /* @__PURE__ */ e("h4", { children: d("integrationBuilder.nodes", "Nodes") }),
1698
- ["Control", "Actions", "Data"].map((h) => /* @__PURE__ */ n("div", { className: "nice-integration-builder__category", children: [
1699
- /* @__PURE__ */ e("h5", { children: h }),
1700
- me.filter((s) => s.category === h).map((s) => /* @__PURE__ */ n(
1698
+ }, [p, i]), Z = _ && T === "canvas" ? /* @__PURE__ */ s("div", { className: "nice-integration-builder__palette", children: [
1699
+ /* @__PURE__ */ t("h4", { children: d("integrationBuilder.nodes", "Nodes") }),
1700
+ ["Control", "Actions", "Data"].map((m) => /* @__PURE__ */ s("div", { className: "nice-integration-builder__category", children: [
1701
+ /* @__PURE__ */ t("h5", { children: m }),
1702
+ ge.filter((o) => o.category === m).map((o) => /* @__PURE__ */ s(
1701
1703
  "div",
1702
1704
  {
1703
1705
  className: "nice-integration-builder__palette-item",
1704
1706
  draggable: !0,
1705
1707
  onDragStart: () => {
1706
- w(!0), J(s.type);
1708
+ w(!0), J(o.type);
1707
1709
  },
1708
1710
  onDragEnd: () => {
1709
1711
  w(!1), J(null);
1710
1712
  },
1711
1713
  children: [
1712
- /* @__PURE__ */ e("span", { className: "nice-integration-builder__palette-icon", children: /* @__PURE__ */ e(ee, { name: s.icon, size: 14 }) }),
1713
- /* @__PURE__ */ e("span", { children: s.label })
1714
+ /* @__PURE__ */ t("span", { className: "nice-integration-builder__palette-icon", children: /* @__PURE__ */ t(ee, { name: o.icon, size: 14 }) }),
1715
+ /* @__PURE__ */ t("span", { children: o.label })
1714
1716
  ]
1715
1717
  },
1716
- s.type
1718
+ o.type
1717
1719
  ))
1718
- ] }, h)),
1719
- a.length > 0 && /* @__PURE__ */ n("div", { className: "nice-integration-builder__category", children: [
1720
- /* @__PURE__ */ e("h5", { children: d("integrationBuilder.connectors", "Connectors") }),
1721
- a.map((h) => /* @__PURE__ */ n("div", { className: "nice-integration-builder__palette-item", children: [
1722
- /* @__PURE__ */ e("span", { className: "nice-integration-builder__palette-icon", children: /* @__PURE__ */ e(ee, { name: "plug", size: 14 }) }),
1723
- /* @__PURE__ */ e("span", { children: h.name })
1724
- ] }, h.id))
1720
+ ] }, m)),
1721
+ n.length > 0 && /* @__PURE__ */ s("div", { className: "nice-integration-builder__category", children: [
1722
+ /* @__PURE__ */ t("h5", { children: d("integrationBuilder.connectors", "Connectors") }),
1723
+ n.map((m) => /* @__PURE__ */ s("div", { className: "nice-integration-builder__palette-item", children: [
1724
+ /* @__PURE__ */ t("span", { className: "nice-integration-builder__palette-icon", children: /* @__PURE__ */ t(ee, { name: "plug", size: 14 }) }),
1725
+ /* @__PURE__ */ t("span", { children: m.name })
1726
+ ] }, m.id))
1725
1727
  ] })
1726
- ] }) : void 0, ae = u && T === "canvas" ? /* @__PURE__ */ e(
1727
- Ze,
1728
+ ] }) : void 0, re = u && T === "canvas" ? /* @__PURE__ */ t(
1729
+ ut,
1728
1730
  {
1729
1731
  node: u,
1730
- onChange: (h) => F(u.id, h),
1732
+ onChange: (m) => F(u.id, m),
1731
1733
  onClose: () => N(null)
1732
1734
  }
1733
1735
  ) : void 0;
1734
- return /* @__PURE__ */ n("div", { style: { position: "relative", height: "100%" }, children: [
1735
- l && /* @__PURE__ */ e("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ e(ce, { steps: le(l, Ge) }) }),
1736
- /* @__PURE__ */ n(
1737
- fe,
1736
+ return /* @__PURE__ */ s("div", { style: { position: "relative", height: "100%" }, children: [
1737
+ l && /* @__PURE__ */ t("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ t(le, { steps: de(l, ct) }) }),
1738
+ /* @__PURE__ */ s(
1739
+ Te,
1738
1740
  {
1739
1741
  flush: !0,
1740
1742
  className: `nice-integration-builder ${c}`,
1741
1743
  height: "100%",
1742
1744
  style: { minHeight: 600 },
1743
1745
  sidebar: Z,
1744
- rightSidebar: ae,
1745
- toolbar: /* @__PURE__ */ n("div", { className: "nice-integration-builder__toolbar", children: [
1746
- /* @__PURE__ */ e(
1746
+ rightSidebar: re,
1747
+ toolbar: /* @__PURE__ */ s("div", { className: "nice-integration-builder__toolbar", children: [
1748
+ /* @__PURE__ */ t(
1747
1749
  "input",
1748
1750
  {
1749
1751
  type: "text",
1750
1752
  value: p.name,
1751
- onChange: (h) => f((s) => ({ ...s, name: h.target.value })),
1753
+ onChange: (m) => f((o) => ({ ...o, name: m.target.value })),
1752
1754
  className: "nice-integration-builder__name-input"
1753
1755
  }
1754
1756
  ),
1755
- /* @__PURE__ */ e("div", { className: "nice-integration-builder__tabs", children: ["canvas", "code", "variables", "settings"].map((h) => /* @__PURE__ */ e(
1757
+ /* @__PURE__ */ t("div", { className: "nice-integration-builder__tabs", children: ["canvas", "code", "variables", "settings"].map((m) => /* @__PURE__ */ t(
1756
1758
  "button",
1757
1759
  {
1758
- className: `nice-integration-builder__tab ${T === h ? "nice-integration-builder__tab--active" : ""}`,
1759
- onClick: () => m(h),
1760
- children: h.charAt(0).toUpperCase() + h.slice(1)
1760
+ className: `nice-integration-builder__tab ${T === m ? "nice-integration-builder__tab--active" : ""}`,
1761
+ onClick: () => h(m),
1762
+ children: m.charAt(0).toUpperCase() + m.slice(1)
1761
1763
  },
1762
- h
1764
+ m
1763
1765
  )) }),
1764
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__actions", children: [
1765
- /* @__PURE__ */ n(
1766
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__actions", children: [
1767
+ /* @__PURE__ */ s(
1766
1768
  "button",
1767
1769
  {
1768
1770
  onClick: Y,
1769
1771
  disabled: V,
1770
1772
  className: "nice-integration-builder__run-btn",
1771
1773
  children: [
1772
- /* @__PURE__ */ e(ee, { name: V ? "clock" : "play", size: 14 }),
1774
+ /* @__PURE__ */ t(ee, { name: V ? "clock" : "play", size: 14 }),
1773
1775
  " ",
1774
1776
  V ? d("integrationBuilder.running", "Running...") : d("integrationBuilder.run", "Run")
1775
1777
  ]
1776
1778
  }
1777
1779
  ),
1778
- /* @__PURE__ */ n("button", { onClick: ne, className: "nice-integration-builder__save-btn", children: [
1779
- /* @__PURE__ */ e(ee, { name: "save", size: 14 }),
1780
+ /* @__PURE__ */ s("button", { onClick: ne, className: "nice-integration-builder__save-btn", children: [
1781
+ /* @__PURE__ */ t(ee, { name: "save", size: 14 }),
1780
1782
  " ",
1781
1783
  d("integrationBuilder.save", "Save")
1782
1784
  ] })
1783
1785
  ] })
1784
1786
  ] }),
1785
1787
  children: [
1786
- T === "canvas" && /* @__PURE__ */ n(
1788
+ T === "canvas" && /* @__PURE__ */ s(
1787
1789
  "div",
1788
1790
  {
1789
1791
  role: "presentation",
1790
1792
  ref: k,
1791
1793
  className: `nice-integration-builder__canvas ${S ? "nice-integration-builder__canvas--dragging" : ""}`,
1792
- onDragOver: (h) => h.preventDefault(),
1793
- onDrop: j,
1794
+ onDragOver: (m) => m.preventDefault(),
1795
+ onDrop: K,
1794
1796
  onClick: () => N(null),
1795
1797
  children: [
1796
- /* @__PURE__ */ e("svg", { className: "nice-integration-builder__connections", children: p.connections.map((h) => {
1797
- const s = p.nodes.find((q) => q.id === h.sourceNodeId), g = p.nodes.find((q) => q.id === h.targetNodeId);
1798
- if (!s || !g)
1798
+ /* @__PURE__ */ t("svg", { className: "nice-integration-builder__connections", children: p.connections.map((m) => {
1799
+ const o = p.nodes.find((q) => q.id === m.sourceNodeId), g = p.nodes.find((q) => q.id === m.targetNodeId);
1800
+ if (!o || !g)
1799
1801
  return null;
1800
- const P = s.position.x + 150, H = s.position.y + 30, E = g.position.x, _ = g.position.y + 30, D = (P + E) / 2;
1801
- return /* @__PURE__ */ e("g", { onClick: () => ie(h.id), children: /* @__PURE__ */ e(
1802
+ const P = o.position.x + 150, H = o.position.y + 30, E = g.position.x, b = g.position.y + 30, A = (P + E) / 2;
1803
+ return /* @__PURE__ */ t("g", { onClick: () => ie(m.id), children: /* @__PURE__ */ t(
1802
1804
  "path",
1803
1805
  {
1804
- d: `M ${P} ${H} C ${D} ${H}, ${D} ${_}, ${E} ${_}`,
1806
+ d: `M ${P} ${H} C ${A} ${H}, ${A} ${b}, ${E} ${b}`,
1805
1807
  className: "nice-integration-builder__connection"
1806
1808
  }
1807
- ) }, h.id);
1809
+ ) }, m.id);
1808
1810
  }) }),
1809
- p.nodes.map((h) => /* @__PURE__ */ e(
1810
- Qe,
1811
+ p.nodes.map((m) => /* @__PURE__ */ t(
1812
+ pt,
1811
1813
  {
1812
- node: h,
1813
- isSelected: (u == null ? void 0 : u.id) === h.id,
1814
- onSelect: () => N(h),
1815
- onDelete: () => K(h.id),
1816
- onPositionChange: (s) => F(h.id, { position: s }),
1817
- onStartConnection: (s) => {
1818
- z(!0), O({ nodeId: h.id, output: s });
1814
+ node: m,
1815
+ isSelected: (u == null ? void 0 : u.id) === m.id,
1816
+ onSelect: () => N(m),
1817
+ onDelete: () => j(m.id),
1818
+ onPositionChange: (o) => F(m.id, { position: o }),
1819
+ onStartConnection: (o) => {
1820
+ $(!0), z({ nodeId: m.id, output: o });
1819
1821
  },
1820
- onEndConnection: (s) => {
1821
- M && R(M.nodeId, M.output, h.id, s), z(!1), O(null);
1822
+ onEndConnection: (o) => {
1823
+ M && R(M.nodeId, M.output, m.id, o), $(!1), z(null);
1822
1824
  }
1823
1825
  },
1824
- h.id
1826
+ m.id
1825
1827
  )),
1826
- p.nodes.length === 0 && /* @__PURE__ */ e("div", { className: "nice-integration-builder__empty", children: d(
1828
+ p.nodes.length === 0 && /* @__PURE__ */ t("div", { className: "nice-integration-builder__empty", children: d(
1827
1829
  "integrationBuilder.dragNodesFromThePalette",
1828
1830
  "Drag nodes from the palette to build your flow"
1829
1831
  ) })
1830
1832
  ]
1831
1833
  }
1832
1834
  ),
1833
- T === "code" && /* @__PURE__ */ e("div", { className: "nice-integration-builder__code-view", children: /* @__PURE__ */ e("pre", { children: JSON.stringify(p, null, 2) }) }),
1834
- T === "variables" && /* @__PURE__ */ e(
1835
- et,
1835
+ T === "code" && /* @__PURE__ */ t("div", { className: "nice-integration-builder__code-view", children: /* @__PURE__ */ t("pre", { children: JSON.stringify(p, null, 2) }) }),
1836
+ T === "variables" && /* @__PURE__ */ t(
1837
+ mt,
1836
1838
  {
1837
1839
  variables: p.variables,
1838
- onChange: (h) => f((s) => ({ ...s, variables: h }))
1840
+ onChange: (m) => f((o) => ({ ...o, variables: m }))
1839
1841
  }
1840
1842
  ),
1841
- T === "settings" && /* @__PURE__ */ e(
1842
- tt,
1843
+ T === "settings" && /* @__PURE__ */ t(
1844
+ ht,
1843
1845
  {
1844
1846
  errorHandling: p.errorHandling,
1845
1847
  schedule: p.schedule,
1846
- onChange: (h, s) => f((g) => ({ ...g, errorHandling: h, schedule: s }))
1848
+ onChange: (m, o) => f((g) => ({ ...g, errorHandling: m, schedule: o }))
1847
1849
  }
1848
1850
  )
1849
1851
  ]
@@ -1851,8 +1853,8 @@ function dt({
1851
1853
  )
1852
1854
  ] });
1853
1855
  }
1854
- function Xe(t) {
1855
- switch (t) {
1856
+ function dt(e) {
1857
+ switch (e) {
1856
1858
  case "http-request":
1857
1859
  return { method: "GET", url: "", headers: {}, body: "" };
1858
1860
  case "transform":
@@ -1882,216 +1884,216 @@ return input;` };
1882
1884
  return {};
1883
1885
  }
1884
1886
  }
1885
- function Qe({
1886
- node: t,
1887
- isSelected: a,
1888
- onSelect: o,
1887
+ function pt({
1888
+ node: e,
1889
+ isSelected: n,
1890
+ onSelect: r,
1889
1891
  onDelete: i,
1890
- onPositionChange: r,
1892
+ onPositionChange: a,
1891
1893
  onStartConnection: c,
1892
1894
  onEndConnection: l
1893
1895
  }) {
1894
- const { t: d } = $(), [p, v] = C(!1), [u, N] = C({ x: 0, y: 0 }), b = de(null), y = me.find((m) => m.type === t.type), T = (m) => {
1895
- m.button === 0 && (m.stopPropagation(), v(!0), N({
1896
- x: m.clientX - t.position.x,
1897
- y: m.clientY - t.position.y
1898
- }), o());
1896
+ const { t: d } = O(), [p, y] = C(!1), [u, N] = C({ x: 0, y: 0 }), _ = pe(null), v = ge.find((h) => h.type === e.type), T = (h) => {
1897
+ h.button === 0 && (h.stopPropagation(), y(!0), N({
1898
+ x: h.clientX - e.position.x,
1899
+ y: h.clientY - e.position.y
1900
+ }), r());
1899
1901
  };
1900
- return we(() => {
1902
+ return Ce(() => {
1901
1903
  if (!p)
1902
1904
  return;
1903
- const m = (w) => {
1904
- r({
1905
+ const h = (w) => {
1906
+ a({
1905
1907
  x: w.clientX - u.x,
1906
1908
  y: w.clientY - u.y
1907
1909
  });
1908
1910
  }, S = () => {
1909
- v(!1);
1911
+ y(!1);
1910
1912
  };
1911
- return window.addEventListener("mousemove", m), window.addEventListener("mouseup", S), () => {
1912
- window.removeEventListener("mousemove", m), window.removeEventListener("mouseup", S);
1913
+ return window.addEventListener("mousemove", h), window.addEventListener("mouseup", S), () => {
1914
+ window.removeEventListener("mousemove", h), window.removeEventListener("mouseup", S);
1913
1915
  };
1914
- }, [p, u, r]), /* @__PURE__ */ n(
1916
+ }, [p, u, a]), /* @__PURE__ */ s(
1915
1917
  "div",
1916
1918
  {
1917
- ref: b,
1918
- className: `nice-integration-builder__node nice-integration-builder__node--${t.type} ${a ? "nice-integration-builder__node--selected" : ""}`,
1919
+ ref: _,
1920
+ className: `nice-integration-builder__node nice-integration-builder__node--${e.type} ${n ? "nice-integration-builder__node--selected" : ""}`,
1919
1921
  style: {
1920
- left: t.position.x,
1921
- top: t.position.y
1922
+ left: e.position.x,
1923
+ top: e.position.y
1922
1924
  },
1923
1925
  onMouseDown: T,
1924
1926
  children: [
1925
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__node-header", children: [
1926
- /* @__PURE__ */ e("span", { className: "nice-integration-builder__node-icon", children: /* @__PURE__ */ e(ee, { name: (y == null ? void 0 : y.icon) || "box", size: 14 }) }),
1927
- /* @__PURE__ */ e("span", { className: "nice-integration-builder__node-name", children: t.name }),
1928
- /* @__PURE__ */ e(
1927
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__node-header", children: [
1928
+ /* @__PURE__ */ t("span", { className: "nice-integration-builder__node-icon", children: /* @__PURE__ */ t(ee, { name: (v == null ? void 0 : v.icon) || "box", size: 14 }) }),
1929
+ /* @__PURE__ */ t("span", { className: "nice-integration-builder__node-name", children: e.name }),
1930
+ /* @__PURE__ */ t(
1929
1931
  "button",
1930
1932
  {
1931
1933
  "aria-label": d("integrationBuilder.close", "Close"),
1932
1934
  className: "nice-integration-builder__node-delete",
1933
- onClick: (m) => {
1934
- m.stopPropagation(), i();
1935
+ onClick: (h) => {
1936
+ h.stopPropagation(), i();
1935
1937
  },
1936
- children: /* @__PURE__ */ e(ee, { name: "close", size: 14 })
1938
+ children: /* @__PURE__ */ t(ee, { name: "close", size: 14 })
1937
1939
  }
1938
1940
  )
1939
1941
  ] }),
1940
- t.inputs.map((m) => /* @__PURE__ */ n(
1942
+ e.inputs.map((h) => /* @__PURE__ */ s(
1941
1943
  "div",
1942
1944
  {
1943
1945
  className: "nice-integration-builder__port nice-integration-builder__port--input",
1944
- onMouseUp: () => l(m),
1946
+ onMouseUp: () => l(h),
1945
1947
  children: [
1946
- /* @__PURE__ */ e("span", { className: "nice-integration-builder__port-dot" }),
1947
- /* @__PURE__ */ e("span", { className: "nice-integration-builder__port-label", children: m })
1948
+ /* @__PURE__ */ t("span", { className: "nice-integration-builder__port-dot" }),
1949
+ /* @__PURE__ */ t("span", { className: "nice-integration-builder__port-label", children: h })
1948
1950
  ]
1949
1951
  },
1950
- m
1952
+ h
1951
1953
  )),
1952
- t.outputs.map((m) => /* @__PURE__ */ n(
1954
+ e.outputs.map((h) => /* @__PURE__ */ s(
1953
1955
  "div",
1954
1956
  {
1955
1957
  className: "nice-integration-builder__port nice-integration-builder__port--output",
1956
1958
  onMouseDown: (S) => {
1957
- S.stopPropagation(), c(m);
1959
+ S.stopPropagation(), c(h);
1958
1960
  },
1959
1961
  children: [
1960
- /* @__PURE__ */ e("span", { className: "nice-integration-builder__port-label", children: m }),
1961
- /* @__PURE__ */ e("span", { className: "nice-integration-builder__port-dot" })
1962
+ /* @__PURE__ */ t("span", { className: "nice-integration-builder__port-label", children: h }),
1963
+ /* @__PURE__ */ t("span", { className: "nice-integration-builder__port-dot" })
1962
1964
  ]
1963
1965
  },
1964
- m
1966
+ h
1965
1967
  ))
1966
1968
  ]
1967
1969
  }
1968
1970
  );
1969
1971
  }
1970
- function Ze({
1971
- node: t,
1972
- onChange: a,
1973
- onClose: o
1972
+ function ut({
1973
+ node: e,
1974
+ onChange: n,
1975
+ onClose: r
1974
1976
  }) {
1975
- const { t: i } = $();
1976
- return /* @__PURE__ */ n("div", { className: "nice-integration-builder__properties", children: [
1977
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__properties-header", children: [
1978
- /* @__PURE__ */ e("h4", { children: t.name }),
1979
- /* @__PURE__ */ e("button", { "aria-label": i("integrationBuilder.close", "Close"), onClick: o, children: /* @__PURE__ */ e(ee, { name: "close", size: 14 }) })
1977
+ const { t: i } = O();
1978
+ return /* @__PURE__ */ s("div", { className: "nice-integration-builder__properties", children: [
1979
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__properties-header", children: [
1980
+ /* @__PURE__ */ t("h4", { children: e.name }),
1981
+ /* @__PURE__ */ t("button", { "aria-label": i("integrationBuilder.close", "Close"), onClick: r, children: /* @__PURE__ */ t(ee, { name: "close", size: 14 }) })
1980
1982
  ] }),
1981
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__properties-content", children: [
1982
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
1983
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.name", "Name") }),
1984
- /* @__PURE__ */ e(
1983
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__properties-content", children: [
1984
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
1985
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.name", "Name") }),
1986
+ /* @__PURE__ */ t(
1985
1987
  "input",
1986
1988
  {
1987
1989
  type: "text",
1988
- value: t.name,
1989
- onChange: (r) => a({ name: r.target.value })
1990
+ value: e.name,
1991
+ onChange: (a) => n({ name: a.target.value })
1990
1992
  }
1991
1993
  )
1992
1994
  ] }),
1993
- t.type === "http-request" && /* @__PURE__ */ n(Q, { children: [
1994
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
1995
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.method", "Method") }),
1996
- /* @__PURE__ */ e(
1995
+ e.type === "http-request" && /* @__PURE__ */ s(Q, { children: [
1996
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
1997
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.method", "Method") }),
1998
+ /* @__PURE__ */ t(
1997
1999
  "select",
1998
2000
  {
1999
- value: t.config.method || "GET",
2000
- onChange: (r) => a({ config: { ...t.config, method: r.target.value } }),
2001
- children: ["GET", "POST", "PUT", "PATCH", "DELETE"].map((r) => /* @__PURE__ */ e("option", { value: r, children: r }, r))
2001
+ value: e.config.method || "GET",
2002
+ onChange: (a) => n({ config: { ...e.config, method: a.target.value } }),
2003
+ children: ["GET", "POST", "PUT", "PATCH", "DELETE"].map((a) => /* @__PURE__ */ t("option", { value: a, children: a }, a))
2002
2004
  }
2003
2005
  )
2004
2006
  ] }),
2005
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
2006
- /* @__PURE__ */ e("label", { children: "URL" }),
2007
- /* @__PURE__ */ e(
2007
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
2008
+ /* @__PURE__ */ t("label", { children: "URL" }),
2009
+ /* @__PURE__ */ t(
2008
2010
  "input",
2009
2011
  {
2010
2012
  type: "text",
2011
- value: t.config.url || "",
2012
- onChange: (r) => a({ config: { ...t.config, url: r.target.value } }),
2013
+ value: e.config.url || "",
2014
+ onChange: (a) => n({ config: { ...e.config, url: a.target.value } }),
2013
2015
  placeholder: "https://api.example.com/endpoint"
2014
2016
  }
2015
2017
  )
2016
2018
  ] })
2017
2019
  ] }),
2018
- t.type === "delay" && /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
2019
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.durationMs", "Duration (ms)") }),
2020
- /* @__PURE__ */ e(
2020
+ e.type === "delay" && /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
2021
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.durationMs", "Duration (ms)") }),
2022
+ /* @__PURE__ */ t(
2021
2023
  "input",
2022
2024
  {
2023
2025
  type: "number",
2024
- value: t.config.duration || 1e3,
2025
- onChange: (r) => a({ config: { ...t.config, duration: parseInt(r.target.value, 10) } })
2026
+ value: e.config.duration || 1e3,
2027
+ onChange: (a) => n({ config: { ...e.config, duration: parseInt(a.target.value, 10) } })
2026
2028
  }
2027
2029
  )
2028
2030
  ] }),
2029
- t.type === "set-variable" && /* @__PURE__ */ n(Q, { children: [
2030
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
2031
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.variableName", "Variable Name") }),
2032
- /* @__PURE__ */ e(
2031
+ e.type === "set-variable" && /* @__PURE__ */ s(Q, { children: [
2032
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
2033
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.variableName", "Variable Name") }),
2034
+ /* @__PURE__ */ t(
2033
2035
  "input",
2034
2036
  {
2035
2037
  type: "text",
2036
- value: t.config.name || "",
2037
- onChange: (r) => a({ config: { ...t.config, name: r.target.value } })
2038
+ value: e.config.name || "",
2039
+ onChange: (a) => n({ config: { ...e.config, name: a.target.value } })
2038
2040
  }
2039
2041
  )
2040
2042
  ] }),
2041
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
2042
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.value", "Value") }),
2043
- /* @__PURE__ */ e(
2043
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
2044
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.value", "Value") }),
2045
+ /* @__PURE__ */ t(
2044
2046
  "input",
2045
2047
  {
2046
2048
  type: "text",
2047
- value: t.config.value || "",
2048
- onChange: (r) => a({ config: { ...t.config, value: r.target.value } })
2049
+ value: e.config.value || "",
2050
+ onChange: (a) => n({ config: { ...e.config, value: a.target.value } })
2049
2051
  }
2050
2052
  )
2051
2053
  ] })
2052
2054
  ] }),
2053
- t.type === "function" && /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
2054
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.code", "Code") }),
2055
- /* @__PURE__ */ e(
2055
+ e.type === "function" && /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
2056
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.code", "Code") }),
2057
+ /* @__PURE__ */ t(
2056
2058
  "textarea",
2057
2059
  {
2058
- value: t.config.code || "",
2059
- onChange: (r) => a({ config: { ...t.config, code: r.target.value } }),
2060
+ value: e.config.code || "",
2061
+ onChange: (a) => n({ config: { ...e.config, code: a.target.value } }),
2060
2062
  rows: 10,
2061
2063
  className: "nice-integration-builder__code-input"
2062
2064
  }
2063
2065
  )
2064
2066
  ] }),
2065
- t.type === "email" && /* @__PURE__ */ n(Q, { children: [
2066
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
2067
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.to", "To") }),
2068
- /* @__PURE__ */ e(
2067
+ e.type === "email" && /* @__PURE__ */ s(Q, { children: [
2068
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
2069
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.to", "To") }),
2070
+ /* @__PURE__ */ t(
2069
2071
  "input",
2070
2072
  {
2071
2073
  type: "text",
2072
- value: t.config.to || "",
2073
- onChange: (r) => a({ config: { ...t.config, to: r.target.value } })
2074
+ value: e.config.to || "",
2075
+ onChange: (a) => n({ config: { ...e.config, to: a.target.value } })
2074
2076
  }
2075
2077
  )
2076
2078
  ] }),
2077
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
2078
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.subject", "Subject") }),
2079
- /* @__PURE__ */ e(
2079
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
2080
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.subject", "Subject") }),
2081
+ /* @__PURE__ */ t(
2080
2082
  "input",
2081
2083
  {
2082
2084
  type: "text",
2083
- value: t.config.subject || "",
2084
- onChange: (r) => a({ config: { ...t.config, subject: r.target.value } })
2085
+ value: e.config.subject || "",
2086
+ onChange: (a) => n({ config: { ...e.config, subject: a.target.value } })
2085
2087
  }
2086
2088
  )
2087
2089
  ] }),
2088
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
2089
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.body", "Body") }),
2090
- /* @__PURE__ */ e(
2090
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
2091
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.body", "Body") }),
2092
+ /* @__PURE__ */ t(
2091
2093
  "textarea",
2092
2094
  {
2093
- value: t.config.body || "",
2094
- onChange: (r) => a({ config: { ...t.config, body: r.target.value } }),
2095
+ value: e.config.body || "",
2096
+ onChange: (a) => n({ config: { ...e.config, body: a.target.value } }),
2095
2097
  rows: 5
2096
2098
  }
2097
2099
  )
@@ -2100,126 +2102,126 @@ function Ze({
2100
2102
  ] })
2101
2103
  ] });
2102
2104
  }
2103
- function et({ variables: t, onChange: a }) {
2104
- const { t: o } = $(), i = () => {
2105
- a({ ...t, newVariable: "" });
2105
+ function mt({ variables: e, onChange: n }) {
2106
+ const { t: r } = O(), i = () => {
2107
+ n({ ...e, newVariable: "" });
2106
2108
  };
2107
- return /* @__PURE__ */ n("div", { className: "nice-integration-builder__variables", children: [
2108
- /* @__PURE__ */ e("h4", { children: o("integrationBuilder.flowVariables", "Flow Variables") }),
2109
- /* @__PURE__ */ e("div", { className: "nice-integration-builder__variables-list", children: Object.entries(t).map(([r, c]) => /* @__PURE__ */ n("div", { className: "nice-integration-builder__variable-row", children: [
2110
- /* @__PURE__ */ e(
2109
+ return /* @__PURE__ */ s("div", { className: "nice-integration-builder__variables", children: [
2110
+ /* @__PURE__ */ t("h4", { children: r("integrationBuilder.flowVariables", "Flow Variables") }),
2111
+ /* @__PURE__ */ t("div", { className: "nice-integration-builder__variables-list", children: Object.entries(e).map(([a, c]) => /* @__PURE__ */ s("div", { className: "nice-integration-builder__variable-row", children: [
2112
+ /* @__PURE__ */ t(
2111
2113
  "input",
2112
2114
  {
2113
2115
  type: "text",
2114
- value: r,
2116
+ value: a,
2115
2117
  onChange: (l) => {
2116
- const { [r]: d, ...p } = t;
2117
- a({ ...p, [l.target.value]: c });
2118
+ const { [a]: d, ...p } = e;
2119
+ n({ ...p, [l.target.value]: c });
2118
2120
  },
2119
- placeholder: o("integrationBuilder.name", "Name")
2121
+ placeholder: r("integrationBuilder.name", "Name")
2120
2122
  }
2121
2123
  ),
2122
- /* @__PURE__ */ e(
2124
+ /* @__PURE__ */ t(
2123
2125
  "input",
2124
2126
  {
2125
2127
  type: "text",
2126
2128
  value: String(c),
2127
- onChange: (l) => a({ ...t, [r]: l.target.value }),
2128
- placeholder: o("integrationBuilder.value", "Value")
2129
+ onChange: (l) => n({ ...e, [a]: l.target.value }),
2130
+ placeholder: r("integrationBuilder.value", "Value")
2129
2131
  }
2130
2132
  ),
2131
- /* @__PURE__ */ e(
2133
+ /* @__PURE__ */ t(
2132
2134
  "button",
2133
2135
  {
2134
- "aria-label": o("integrationBuilder.close", "Close"),
2136
+ "aria-label": r("integrationBuilder.close", "Close"),
2135
2137
  onClick: () => {
2136
- const { [r]: l, ...d } = t;
2137
- a(d);
2138
+ const { [a]: l, ...d } = e;
2139
+ n(d);
2138
2140
  },
2139
- children: /* @__PURE__ */ e(ee, { name: "close", size: 14 })
2141
+ children: /* @__PURE__ */ t(ee, { name: "close", size: 14 })
2140
2142
  }
2141
2143
  )
2142
- ] }, r)) }),
2143
- /* @__PURE__ */ e("button", { onClick: i, children: o("integrationBuilder.addVariable", "+ Add Variable") })
2144
+ ] }, a)) }),
2145
+ /* @__PURE__ */ t("button", { onClick: i, children: r("integrationBuilder.addVariable", "+ Add Variable") })
2144
2146
  ] });
2145
2147
  }
2146
- function tt({
2147
- errorHandling: t,
2148
- schedule: a,
2149
- onChange: o
2148
+ function ht({
2149
+ errorHandling: e,
2150
+ schedule: n,
2151
+ onChange: r
2150
2152
  }) {
2151
- const { t: i } = $();
2152
- return /* @__PURE__ */ n("div", { className: "nice-integration-builder__settings", children: [
2153
- /* @__PURE__ */ e("h4", { children: i("integrationBuilder.errorHandling", "Error Handling") }),
2154
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
2155
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.strategy", "Strategy") }),
2156
- /* @__PURE__ */ n(
2153
+ const { t: i } = O();
2154
+ return /* @__PURE__ */ s("div", { className: "nice-integration-builder__settings", children: [
2155
+ /* @__PURE__ */ t("h4", { children: i("integrationBuilder.errorHandling", "Error Handling") }),
2156
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
2157
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.strategy", "Strategy") }),
2158
+ /* @__PURE__ */ s(
2157
2159
  "select",
2158
2160
  {
2159
- value: t.strategy,
2160
- onChange: (r) => o(
2161
- { ...t, strategy: r.target.value },
2162
- a
2161
+ value: e.strategy,
2162
+ onChange: (a) => r(
2163
+ { ...e, strategy: a.target.value },
2164
+ n
2163
2165
  ),
2164
2166
  children: [
2165
- /* @__PURE__ */ e("option", { value: "stop", children: i("integrationBuilder.stopOnError", "Stop on error") }),
2166
- /* @__PURE__ */ e("option", { value: "continue", children: i("integrationBuilder.continueOnError", "Continue on error") }),
2167
- /* @__PURE__ */ e("option", { value: "retry", children: i("integrationBuilder.retryOnError", "Retry on error") })
2167
+ /* @__PURE__ */ t("option", { value: "stop", children: i("integrationBuilder.stopOnError", "Stop on error") }),
2168
+ /* @__PURE__ */ t("option", { value: "continue", children: i("integrationBuilder.continueOnError", "Continue on error") }),
2169
+ /* @__PURE__ */ t("option", { value: "retry", children: i("integrationBuilder.retryOnError", "Retry on error") })
2168
2170
  ]
2169
2171
  }
2170
2172
  )
2171
2173
  ] }),
2172
- t.strategy === "retry" && /* @__PURE__ */ n(Q, { children: [
2173
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
2174
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.maxRetries", "Max Retries") }),
2175
- /* @__PURE__ */ e(
2174
+ e.strategy === "retry" && /* @__PURE__ */ s(Q, { children: [
2175
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
2176
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.maxRetries", "Max Retries") }),
2177
+ /* @__PURE__ */ t(
2176
2178
  "input",
2177
2179
  {
2178
2180
  type: "number",
2179
- value: t.maxRetries || 3,
2180
- onChange: (r) => o({ ...t, maxRetries: parseInt(r.target.value, 10) }, a)
2181
+ value: e.maxRetries || 3,
2182
+ onChange: (a) => r({ ...e, maxRetries: parseInt(a.target.value, 10) }, n)
2181
2183
  }
2182
2184
  )
2183
2185
  ] }),
2184
- /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
2185
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.retryDelayMs", "Retry Delay (ms)") }),
2186
- /* @__PURE__ */ e(
2186
+ /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
2187
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.retryDelayMs", "Retry Delay (ms)") }),
2188
+ /* @__PURE__ */ t(
2187
2189
  "input",
2188
2190
  {
2189
2191
  type: "number",
2190
- value: t.retryDelay || 1e3,
2191
- onChange: (r) => o({ ...t, retryDelay: parseInt(r.target.value, 10) }, a)
2192
+ value: e.retryDelay || 1e3,
2193
+ onChange: (a) => r({ ...e, retryDelay: parseInt(a.target.value, 10) }, n)
2192
2194
  }
2193
2195
  )
2194
2196
  ] })
2195
2197
  ] }),
2196
- /* @__PURE__ */ e("h4", { children: i("integrationBuilder.schedule", "Schedule") }),
2197
- /* @__PURE__ */ e("div", { className: "nice-integration-builder__field", children: /* @__PURE__ */ n("label", { children: [
2198
- /* @__PURE__ */ e(
2198
+ /* @__PURE__ */ t("h4", { children: i("integrationBuilder.schedule", "Schedule") }),
2199
+ /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: /* @__PURE__ */ s("label", { children: [
2200
+ /* @__PURE__ */ t(
2199
2201
  "input",
2200
2202
  {
2201
2203
  type: "checkbox",
2202
- checked: (a == null ? void 0 : a.enabled) || !1,
2203
- onChange: (r) => o(t, { ...a, enabled: r.target.checked })
2204
+ checked: (n == null ? void 0 : n.enabled) || !1,
2205
+ onChange: (a) => r(e, { ...n, enabled: a.target.checked })
2204
2206
  }
2205
2207
  ),
2206
2208
  i("integrationBuilder.enableScheduledExecution", "Enable scheduled execution")
2207
2209
  ] }) }),
2208
- (a == null ? void 0 : a.enabled) && /* @__PURE__ */ n("div", { className: "nice-integration-builder__field", children: [
2209
- /* @__PURE__ */ e("label", { children: i("integrationBuilder.cronExpression", "Cron Expression") }),
2210
- /* @__PURE__ */ e(
2210
+ (n == null ? void 0 : n.enabled) && /* @__PURE__ */ s("div", { className: "nice-integration-builder__field", children: [
2211
+ /* @__PURE__ */ t("label", { children: i("integrationBuilder.cronExpression", "Cron Expression") }),
2212
+ /* @__PURE__ */ t(
2211
2213
  "input",
2212
2214
  {
2213
2215
  type: "text",
2214
- value: a.cron || "",
2215
- onChange: (r) => o(t, { ...a, cron: r.target.value }),
2216
+ value: n.cron || "",
2217
+ onChange: (a) => r(e, { ...n, cron: a.target.value }),
2216
2218
  placeholder: "0 0 * * *"
2217
2219
  }
2218
2220
  )
2219
2221
  ] })
2220
2222
  ] });
2221
2223
  }
2222
- const it = [
2224
+ const gt = [
2223
2225
  {
2224
2226
  target: ".nice-webhook-tester",
2225
2227
  titleKey: "tutorial.webhookTester.intro.title",
@@ -2229,112 +2231,112 @@ const it = [
2229
2231
  placement: "auto"
2230
2232
  }
2231
2233
  ];
2232
- function ve(t) {
2233
- return t ? Object.entries(t).map(([a, o]) => ({ key: a, value: o })) : [];
2234
+ function Ne(e) {
2235
+ return e ? Object.entries(e).map(([n, r]) => ({ key: n, value: r })) : [];
2234
2236
  }
2235
- function ye(t) {
2236
- const a = {};
2237
- for (const o of t)
2238
- o.key.trim() !== "" && (a[o.key] = o.value);
2239
- return a;
2237
+ function we(e) {
2238
+ const n = {};
2239
+ for (const r of e)
2240
+ r.key.trim() !== "" && (n[r.key] = r.value);
2241
+ return n;
2240
2242
  }
2241
- async function nt(t, a) {
2243
+ async function bt(e, n) {
2242
2244
  var l;
2243
- const o = (l = globalThis.crypto) == null ? void 0 : l.subtle;
2244
- if (!o)
2245
+ const r = (l = globalThis.crypto) == null ? void 0 : l.subtle;
2246
+ if (!r)
2245
2247
  throw new Error("Web Crypto (crypto.subtle) is unavailable in this environment");
2246
- const i = new TextEncoder(), r = await o.importKey(
2248
+ const i = new TextEncoder(), a = await r.importKey(
2247
2249
  "raw",
2248
- i.encode(t),
2250
+ i.encode(e),
2249
2251
  { name: "HMAC", hash: "SHA-256" },
2250
2252
  !1,
2251
2253
  ["sign"]
2252
- ), c = await o.sign("HMAC", r, i.encode(a));
2254
+ ), c = await r.sign("HMAC", a, i.encode(n));
2253
2255
  return [...new Uint8Array(c)].map((d) => d.toString(16).padStart(2, "0")).join("");
2254
2256
  }
2255
- const pt = /* @__PURE__ */ Se(
2256
- function(a, o) {
2257
- const { t: i } = $(), {
2258
- url: r = "",
2257
+ const Dt = /* @__PURE__ */ xe(
2258
+ function(n, r) {
2259
+ const { t: i } = O(), {
2260
+ url: a = "",
2259
2261
  method: c = "POST",
2260
2262
  headers: l,
2261
2263
  payload: d = "",
2262
2264
  samples: p = [],
2263
- onSend: v,
2265
+ onSend: y,
2264
2266
  signing: u,
2265
2267
  onSaveSample: N,
2266
- tutorial: b,
2267
- className: y,
2268
+ tutorial: _,
2269
+ className: v,
2268
2270
  style: T,
2269
- id: m,
2271
+ id: h,
2270
2272
  "data-testid": S
2271
- } = a, [w, A] = C(r), [J, te] = C(c), [z, M] = C(() => ve(l)), [O, V] = C(d), [G, k] = C(""), [f, x] = C(!1), [K, F] = C(null), [R, ie] = C(null), [j, Y] = C(null), ne = de(null), Z = j !== null;
2272
- we(() => {
2273
- var _;
2274
- Z && ((_ = ne.current) == null || _.focus());
2273
+ } = n, [w, D] = C(a), [J, te] = C(c), [$, M] = C(() => Ne(l)), [z, V] = C(d), [W, k] = C(""), [f, x] = C(!1), [j, F] = C(null), [R, ie] = C(null), [K, Y] = C(null), ne = pe(null), Z = K !== null;
2274
+ Ce(() => {
2275
+ var b;
2276
+ Z && ((b = ne.current) == null || b.focus());
2275
2277
  }, [Z]);
2276
- const ae = Ee(() => {
2277
- const _ = /* @__PURE__ */ new Map();
2278
- for (const D of p)
2279
- _.set(D.id, D);
2280
- return _;
2281
- }, [p]), h = (_) => {
2282
- k(_);
2283
- const D = ae.get(_);
2284
- D && (V(D.payload), D.headers && M(ve(D.headers)));
2285
- }, s = (_, D) => {
2286
- M((q) => q.map((W, X) => X === _ ? { ...W, ...D } : W));
2278
+ const re = Ie(() => {
2279
+ const b = /* @__PURE__ */ new Map();
2280
+ for (const A of p)
2281
+ b.set(A.id, A);
2282
+ return b;
2283
+ }, [p]), m = (b) => {
2284
+ k(b);
2285
+ const A = re.get(b);
2286
+ A && (V(A.payload), A.headers && M(Ne(A.headers)));
2287
+ }, o = (b, A) => {
2288
+ M((q) => q.map((G, X) => X === b ? { ...G, ...A } : G));
2287
2289
  }, g = async () => {
2288
2290
  x(!0), F(null), ie(null);
2289
2291
  try {
2290
- const _ = ye(z);
2292
+ const b = we($);
2291
2293
  if (u && u.secret) {
2292
- const X = await nt(u.secret, O);
2293
- _[u.header] = `${u.prefix ?? ""}${X}`;
2294
+ const X = await bt(u.secret, z);
2295
+ b[u.header] = `${u.prefix ?? ""}${X}`;
2294
2296
  }
2295
- const D = typeof performance < "u" ? performance.now() : Date.now(), q = await v({ url: w, method: J ?? "POST", headers: _, body: O }), W = Math.round(
2296
- (typeof performance < "u" ? performance.now() : Date.now()) - D
2297
+ const A = typeof performance < "u" ? performance.now() : Date.now(), q = await y({ url: w, method: J ?? "POST", headers: b, body: z }), G = Math.round(
2298
+ (typeof performance < "u" ? performance.now() : Date.now()) - A
2297
2299
  );
2298
- ie({ ...q, durationMs: q.durationMs ?? W });
2299
- } catch (_) {
2300
- F(_ instanceof Error ? _.message : String(_));
2300
+ ie({ ...q, durationMs: q.durationMs ?? G });
2301
+ } catch (b) {
2302
+ F(b instanceof Error ? b.message : String(b));
2301
2303
  } finally {
2302
2304
  x(!1);
2303
2305
  }
2304
2306
  }, P = () => {
2305
- const _ = j == null ? void 0 : j.trim();
2306
- !N || !_ || (N({
2307
+ const b = K == null ? void 0 : K.trim();
2308
+ !N || !b || (N({
2307
2309
  id: `sample_${Date.now().toString(36)}`,
2308
- name: _,
2309
- payload: O,
2310
- headers: ye(z)
2310
+ name: b,
2311
+ payload: z,
2312
+ headers: we($)
2311
2313
  }), Y(null));
2312
- }, H = R == null ? "" : R.status >= 200 && R.status < 300 ? " nice-webhook-tester__status--ok" : " nice-webhook-tester__status--error", E = "nice-webhook-tester" + (y ? ` ${y}` : "");
2313
- return /* @__PURE__ */ n("div", { ref: o, id: m, className: E, style: T, "data-testid": S, children: [
2314
- b && /* @__PURE__ */ e("div", { className: "nice-webhook-tester__tutorial", children: /* @__PURE__ */ e(ce, { steps: le(b, it) }) }),
2315
- /* @__PURE__ */ n("div", { className: "nice-webhook-tester__bar", children: [
2316
- /* @__PURE__ */ e(
2314
+ }, H = R == null ? "" : R.status >= 200 && R.status < 300 ? " nice-webhook-tester__status--ok" : " nice-webhook-tester__status--error", E = "nice-webhook-tester" + (v ? ` ${v}` : "");
2315
+ return /* @__PURE__ */ s("div", { ref: r, id: h, className: E, style: T, "data-testid": S, children: [
2316
+ _ && /* @__PURE__ */ t("div", { className: "nice-webhook-tester__tutorial", children: /* @__PURE__ */ t(le, { steps: de(_, gt) }) }),
2317
+ /* @__PURE__ */ s("div", { className: "nice-webhook-tester__bar", children: [
2318
+ /* @__PURE__ */ t(
2317
2319
  "select",
2318
2320
  {
2319
2321
  className: "nice-webhook-tester__method",
2320
2322
  value: J,
2321
- onChange: (_) => te(_.target.value),
2323
+ onChange: (b) => te(b.target.value),
2322
2324
  "aria-label": i("webhookTester.method", "Method"),
2323
- children: ["POST", "PUT", "GET", "PATCH", "DELETE"].map((_) => /* @__PURE__ */ e("option", { value: _, children: _ }, _))
2325
+ children: ["POST", "PUT", "GET", "PATCH", "DELETE"].map((b) => /* @__PURE__ */ t("option", { value: b, children: b }, b))
2324
2326
  }
2325
2327
  ),
2326
- /* @__PURE__ */ e(
2328
+ /* @__PURE__ */ t(
2327
2329
  "input",
2328
2330
  {
2329
2331
  type: "text",
2330
2332
  className: "nice-webhook-tester__url",
2331
2333
  value: w,
2332
2334
  placeholder: "https://example.com/api/payments/stripe/webhook",
2333
- onChange: (_) => A(_.target.value),
2335
+ onChange: (b) => D(b.target.value),
2334
2336
  "aria-label": i("webhookTester.url", "URL")
2335
2337
  }
2336
2338
  ),
2337
- /* @__PURE__ */ e(
2339
+ /* @__PURE__ */ t(
2338
2340
  "button",
2339
2341
  {
2340
2342
  type: "button",
@@ -2345,69 +2347,69 @@ const pt = /* @__PURE__ */ Se(
2345
2347
  }
2346
2348
  )
2347
2349
  ] }),
2348
- p.length > 0 && /* @__PURE__ */ e("div", { className: "nice-webhook-tester__samples", children: /* @__PURE__ */ n("label", { children: [
2350
+ p.length > 0 && /* @__PURE__ */ t("div", { className: "nice-webhook-tester__samples", children: /* @__PURE__ */ s("label", { children: [
2349
2351
  i("webhookTester.sample", "Sample:"),
2350
2352
  " ",
2351
- /* @__PURE__ */ n("select", { value: G, onChange: (_) => h(_.target.value), children: [
2352
- /* @__PURE__ */ e("option", { value: "", children: i("webhookTester.chooseASavedPayload", "— choose a saved payload —") }),
2353
- p.map((_) => /* @__PURE__ */ e("option", { value: _.id, children: _.name }, _.id))
2353
+ /* @__PURE__ */ s("select", { value: W, onChange: (b) => m(b.target.value), children: [
2354
+ /* @__PURE__ */ t("option", { value: "", children: i("webhookTester.chooseASavedPayload", "— choose a saved payload —") }),
2355
+ p.map((b) => /* @__PURE__ */ t("option", { value: b.id, children: b.name }, b.id))
2354
2356
  ] })
2355
2357
  ] }) }),
2356
- /* @__PURE__ */ n("div", { className: "nice-webhook-tester__headers", children: [
2357
- /* @__PURE__ */ n("div", { className: "nice-webhook-tester__section-label", children: [
2358
+ /* @__PURE__ */ s("div", { className: "nice-webhook-tester__headers", children: [
2359
+ /* @__PURE__ */ s("div", { className: "nice-webhook-tester__section-label", children: [
2358
2360
  i("webhookTester.headers", "Headers"),
2359
- u && /* @__PURE__ */ n("span", { className: "nice-webhook-tester__signed", children: [
2361
+ u && /* @__PURE__ */ s("span", { className: "nice-webhook-tester__signed", children: [
2360
2362
  " ",
2361
2363
  i("webhookTester.autoSigns", "· auto-signs"),
2362
2364
  " ",
2363
- /* @__PURE__ */ e("code", { children: u.header })
2365
+ /* @__PURE__ */ t("code", { children: u.header })
2364
2366
  ] })
2365
2367
  ] }),
2366
- z.map((_, D) => /* @__PURE__ */ n("div", { className: "nice-webhook-tester__header-row", children: [
2367
- /* @__PURE__ */ e(
2368
+ $.map((b, A) => /* @__PURE__ */ s("div", { className: "nice-webhook-tester__header-row", children: [
2369
+ /* @__PURE__ */ t(
2368
2370
  "input",
2369
2371
  {
2370
2372
  type: "text",
2371
- value: _.key,
2373
+ value: b.key,
2372
2374
  placeholder: i("webhookTester.header", "Header"),
2373
- onChange: (q) => s(D, { key: q.target.value }),
2375
+ onChange: (q) => o(A, { key: q.target.value }),
2374
2376
  "aria-label": i("webhookTester.headerName", "Header name")
2375
2377
  }
2376
2378
  ),
2377
- /* @__PURE__ */ e(
2379
+ /* @__PURE__ */ t(
2378
2380
  "input",
2379
2381
  {
2380
2382
  type: "text",
2381
- value: _.value,
2383
+ value: b.value,
2382
2384
  placeholder: i("webhookTester.value", "Value"),
2383
- onChange: (q) => s(D, { value: q.target.value }),
2385
+ onChange: (q) => o(A, { value: q.target.value }),
2384
2386
  "aria-label": i("webhookTester.headerValue", "Header value")
2385
2387
  }
2386
2388
  ),
2387
- /* @__PURE__ */ e(
2389
+ /* @__PURE__ */ t(
2388
2390
  "button",
2389
2391
  {
2390
2392
  type: "button",
2391
- onClick: () => M((q) => q.filter((W, X) => X !== D)),
2393
+ onClick: () => M((q) => q.filter((G, X) => X !== A)),
2392
2394
  "aria-label": i("webhookTester.removeHeader", "Remove header"),
2393
- children: /* @__PURE__ */ e(B, { name: "close", size: 12 })
2395
+ children: /* @__PURE__ */ t(B, { name: "close", size: 12 })
2394
2396
  }
2395
2397
  )
2396
- ] }, D)),
2397
- /* @__PURE__ */ e(
2398
+ ] }, A)),
2399
+ /* @__PURE__ */ t(
2398
2400
  "button",
2399
2401
  {
2400
2402
  type: "button",
2401
2403
  className: "nice-webhook-tester__add-header",
2402
- onClick: () => M((_) => [..._, { key: "", value: "" }]),
2404
+ onClick: () => M((b) => [...b, { key: "", value: "" }]),
2403
2405
  children: i("webhookTester.header2", "+ Header")
2404
2406
  }
2405
2407
  )
2406
2408
  ] }),
2407
- /* @__PURE__ */ n("div", { className: "nice-webhook-tester__payload", children: [
2408
- /* @__PURE__ */ n("div", { className: "nice-webhook-tester__section-label", children: [
2409
+ /* @__PURE__ */ s("div", { className: "nice-webhook-tester__payload", children: [
2410
+ /* @__PURE__ */ s("div", { className: "nice-webhook-tester__section-label", children: [
2409
2411
  i("webhookTester.payload", "Payload"),
2410
- N && /* @__PURE__ */ e(
2412
+ N && /* @__PURE__ */ t(
2411
2413
  "button",
2412
2414
  {
2413
2415
  type: "button",
@@ -2418,68 +2420,372 @@ const pt = /* @__PURE__ */ Se(
2418
2420
  }
2419
2421
  )
2420
2422
  ] }),
2421
- N && Z && /* @__PURE__ */ n("div", { className: "nice-webhook-tester__header-row", children: [
2422
- /* @__PURE__ */ e(
2423
+ N && Z && /* @__PURE__ */ s("div", { className: "nice-webhook-tester__header-row", children: [
2424
+ /* @__PURE__ */ t(
2423
2425
  "input",
2424
2426
  {
2425
2427
  ref: ne,
2426
2428
  type: "text",
2427
- value: j,
2429
+ value: K,
2428
2430
  placeholder: i("webhookTester.sampleNamePrompt", "Sample name"),
2429
2431
  "aria-label": i("webhookTester.sampleNamePrompt", "Sample name"),
2430
- onChange: (_) => Y(_.target.value),
2431
- onKeyDown: (_) => {
2432
- _.key === "Enter" ? (_.preventDefault(), P()) : _.key === "Escape" && Y(null);
2432
+ onChange: (b) => Y(b.target.value),
2433
+ onKeyDown: (b) => {
2434
+ b.key === "Enter" ? (b.preventDefault(), P()) : b.key === "Escape" && Y(null);
2433
2435
  }
2434
2436
  }
2435
2437
  ),
2436
- /* @__PURE__ */ e("button", { type: "button", onClick: P, disabled: !j.trim(), children: i("save", "Save") }),
2437
- /* @__PURE__ */ e(
2438
+ /* @__PURE__ */ t("button", { type: "button", onClick: P, disabled: !K.trim(), children: i("save", "Save") }),
2439
+ /* @__PURE__ */ t(
2438
2440
  "button",
2439
2441
  {
2440
2442
  type: "button",
2441
2443
  onClick: () => Y(null),
2442
2444
  "aria-label": i("cancel", "Cancel"),
2443
- children: /* @__PURE__ */ e(B, { name: "close", size: 12 })
2445
+ children: /* @__PURE__ */ t(B, { name: "close", size: 12 })
2444
2446
  }
2445
2447
  )
2446
2448
  ] }),
2447
- /* @__PURE__ */ e(
2449
+ /* @__PURE__ */ t(
2448
2450
  "textarea",
2449
2451
  {
2450
2452
  className: "nice-webhook-tester__textarea",
2451
- value: O,
2453
+ value: z,
2452
2454
  spellCheck: !1,
2453
2455
  rows: 8,
2454
2456
  placeholder: i(
2455
2457
  "webhookTester.typePaymentSucceededData",
2456
2458
  '{ "type": "payment.succeeded", "data": { ... } }'
2457
2459
  ),
2458
- onChange: (_) => V(_.target.value),
2460
+ onChange: (b) => V(b.target.value),
2459
2461
  "aria-label": i("webhookTester.payload", "Payload")
2460
2462
  }
2461
2463
  )
2462
2464
  ] }),
2463
- K && /* @__PURE__ */ e("div", { className: "nice-webhook-tester__error", children: K }),
2464
- R && /* @__PURE__ */ n("div", { className: "nice-webhook-tester__response", children: [
2465
- /* @__PURE__ */ n("div", { className: "nice-webhook-tester__section-label", children: [
2465
+ j && /* @__PURE__ */ t("div", { className: "nice-webhook-tester__error", children: j }),
2466
+ R && /* @__PURE__ */ s("div", { className: "nice-webhook-tester__response", children: [
2467
+ /* @__PURE__ */ s("div", { className: "nice-webhook-tester__section-label", children: [
2466
2468
  i("webhookTester.response", "Response"),
2467
2469
  " ",
2468
- /* @__PURE__ */ e("span", { className: "nice-webhook-tester__status" + H, children: R.status }),
2469
- R.durationMs != null && /* @__PURE__ */ n("span", { className: "nice-webhook-tester__time", children: [
2470
+ /* @__PURE__ */ t("span", { className: "nice-webhook-tester__status" + H, children: R.status }),
2471
+ R.durationMs != null && /* @__PURE__ */ s("span", { className: "nice-webhook-tester__time", children: [
2470
2472
  " · ",
2471
2473
  R.durationMs,
2472
2474
  " ms"
2473
2475
  ] })
2474
2476
  ] }),
2475
- R.body != null && /* @__PURE__ */ e("pre", { className: "nice-webhook-tester__response-body", children: R.body })
2477
+ R.body != null && /* @__PURE__ */ t("pre", { className: "nice-webhook-tester__response-body", children: R.body })
2476
2478
  ] })
2477
2479
  ] });
2478
2480
  }
2479
- );
2481
+ ), _t = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
2482
+ function yt(e) {
2483
+ var n, r, i, a, c, l, d;
2484
+ switch (e == null ? void 0 : e.type) {
2485
+ case void 0:
2486
+ return;
2487
+ case "none":
2488
+ return { type: "none" };
2489
+ case "api-key":
2490
+ return e.apiKey ? { type: "apiKey", key: e.apiKey.key, value: e.apiKey.value, in: e.apiKey.in } : void 0;
2491
+ case "bearer":
2492
+ return { type: "bearer", token: ((n = e.bearer) == null ? void 0 : n.token) ?? "", prefix: (r = e.bearer) == null ? void 0 : r.prefix };
2493
+ case "basic":
2494
+ return {
2495
+ type: "basic",
2496
+ username: ((i = e.basic) == null ? void 0 : i.username) ?? "",
2497
+ password: ((a = e.basic) == null ? void 0 : a.password) ?? ""
2498
+ };
2499
+ case "oauth2":
2500
+ return {
2501
+ type: "oauth2",
2502
+ grant: "clientCredentials",
2503
+ clientId: "",
2504
+ accessToken: (c = e.oauth2) == null ? void 0 : c.accessToken,
2505
+ tokenType: (l = e.oauth2) == null ? void 0 : l.tokenType,
2506
+ refreshToken: (d = e.oauth2) == null ? void 0 : d.refreshToken
2507
+ };
2508
+ default:
2509
+ return;
2510
+ }
2511
+ }
2512
+ function vt(e) {
2513
+ switch (e == null ? void 0 : e.type) {
2514
+ case "none":
2515
+ return { type: "none" };
2516
+ case "apiKey":
2517
+ return e.in === "cookie" ? void 0 : { type: "api-key", apiKey: { key: e.key, value: e.value, in: e.in } };
2518
+ case "bearer":
2519
+ return { type: "bearer", bearer: { token: e.token, prefix: e.prefix } };
2520
+ case "basic":
2521
+ return { type: "basic", basic: { username: e.username, password: e.password } };
2522
+ case "oauth2":
2523
+ return {
2524
+ type: "oauth2",
2525
+ oauth2: {
2526
+ accessToken: e.accessToken ?? "",
2527
+ tokenType: e.tokenType,
2528
+ refreshToken: e.refreshToken
2529
+ }
2530
+ };
2531
+ default:
2532
+ return;
2533
+ }
2534
+ }
2535
+ function ft(e) {
2536
+ if (!e)
2537
+ return { kind: "none" };
2538
+ const n = e.content, r = () => n && typeof n == "object" && !(typeof FormData < "u" && n instanceof FormData) ? n : {}, i = typeof n == "string" ? n : n === void 0 ? "" : JSON.stringify(n, null, 2);
2539
+ switch (e.type) {
2540
+ case "json":
2541
+ return { kind: "json", text: i };
2542
+ case "raw":
2543
+ return { kind: "text", text: i };
2544
+ case "x-www-form-urlencoded":
2545
+ return {
2546
+ kind: "form",
2547
+ fields: Object.entries(r()).map(([a, c]) => ({
2548
+ key: a,
2549
+ value: String(c ?? "")
2550
+ }))
2551
+ };
2552
+ case "form-data":
2553
+ return {
2554
+ kind: "multipart",
2555
+ parts: Object.entries(r()).map(([a, c]) => ({
2556
+ key: a,
2557
+ value: String(c ?? ""),
2558
+ type: "text"
2559
+ }))
2560
+ };
2561
+ case "binary":
2562
+ return { kind: "binary" };
2563
+ default:
2564
+ return { kind: "none" };
2565
+ }
2566
+ }
2567
+ function Nt(e) {
2568
+ switch (e.kind) {
2569
+ case "none":
2570
+ return;
2571
+ case "json":
2572
+ return { type: "json", content: e.text };
2573
+ case "form":
2574
+ return { type: "x-www-form-urlencoded", content: oe(e.fields) };
2575
+ case "multipart":
2576
+ return {
2577
+ type: "form-data",
2578
+ content: oe(e.parts.filter((n) => n.type !== "file"))
2579
+ };
2580
+ case "binary":
2581
+ return { type: "binary" };
2582
+ case "xml":
2583
+ case "text":
2584
+ return { type: "raw", content: e.text };
2585
+ case "graphql":
2586
+ return {
2587
+ type: "json",
2588
+ content: JSON.stringify({
2589
+ query: e.query,
2590
+ variables: e.variables ? JSON.parse(e.variables) : void 0
2591
+ })
2592
+ };
2593
+ case "soap":
2594
+ return { type: "raw", content: e.envelope };
2595
+ default:
2596
+ return;
2597
+ }
2598
+ }
2599
+ function Pe(e) {
2600
+ const n = Oe({
2601
+ id: e.id,
2602
+ name: e.name,
2603
+ method: e.method,
2604
+ params: [
2605
+ ...Object.entries(e.headers ?? {}).map(([i, a]) => ({
2606
+ key: i,
2607
+ value: a,
2608
+ in: "header"
2609
+ })),
2610
+ ...Object.entries(e.queryParams ?? {}).map(([i, a]) => ({
2611
+ key: i,
2612
+ value: a,
2613
+ in: "query"
2614
+ }))
2615
+ ],
2616
+ body: ft(e.body),
2617
+ auth: yt(e.auth)
2618
+ }), r = Be(
2619
+ { ...n, params: n.params.filter((i) => i.in !== "query") },
2620
+ e.url
2621
+ );
2622
+ return {
2623
+ ...r,
2624
+ params: [...r.params, ...n.params.filter((i) => i.in === "query")]
2625
+ };
2626
+ }
2627
+ function be(e) {
2628
+ const n = _t.includes(e.method.toUpperCase()) ? e.method.toUpperCase() : "GET";
2629
+ return {
2630
+ id: e.id,
2631
+ name: e.name,
2632
+ method: n,
2633
+ url: ze({ ...e, params: e.params.filter((r) => r.in === "path") }),
2634
+ headers: oe(e.params.filter((r) => r.in === "header" && ye(r))),
2635
+ queryParams: oe(e.params.filter((r) => r.in === "query" && ye(r))),
2636
+ body: Nt(e.body),
2637
+ auth: vt(e.auth)
2638
+ };
2639
+ }
2640
+ function Ae(e) {
2641
+ return Ke({
2642
+ id: e.id,
2643
+ name: e.name,
2644
+ items: [
2645
+ ...(e.folders ?? []).map(Ae),
2646
+ ...e.requests.map(Pe)
2647
+ ]
2648
+ });
2649
+ }
2650
+ function xt(e) {
2651
+ return qe({
2652
+ id: e.id,
2653
+ name: e.name,
2654
+ description: e.description,
2655
+ items: [
2656
+ ...(e.folders ?? []).map(Ae),
2657
+ ...e.requests.map(Pe)
2658
+ ],
2659
+ variables: Object.entries(e.variables ?? {}).map(([n, r]) => ({ key: n, value: r }))
2660
+ });
2661
+ }
2662
+ function It(e) {
2663
+ const n = (r) => r.filter((i) => i.kind === "folder").map((i) => ({
2664
+ id: i.id,
2665
+ name: i.name,
2666
+ requests: i.items.filter((a) => a.kind === "request").map(be),
2667
+ folders: n(i.items)
2668
+ }));
2669
+ return {
2670
+ id: e.id,
2671
+ name: e.name,
2672
+ description: e.description,
2673
+ requests: e.items.filter((r) => r.kind === "request").map(be),
2674
+ folders: n(e.items),
2675
+ variables: oe(e.variables)
2676
+ };
2677
+ }
2678
+ function Rt(e) {
2679
+ return je(e.items).map(({ request: n }) => be(n));
2680
+ }
2681
+ function qt(e) {
2682
+ return $e(e);
2683
+ }
2684
+ function Ot(e) {
2685
+ return Re(e);
2686
+ }
2480
2687
  export {
2481
- ct as NiceAPIDesigner,
2482
- lt as NiceAPITester,
2483
- dt as NiceIntegrationBuilder,
2484
- pt as NiceWebhookTester
2688
+ zt as GRAPHQL_INTROSPECTION_QUERY,
2689
+ jt as NICE_API_AUTH_TYPES,
2690
+ Kt as NICE_API_CODE_LANGUAGES,
2691
+ Ht as NICE_API_MARKDOWN_LABELS,
2692
+ Ut as NICE_API_METHODS,
2693
+ Et as NiceAPIDesigner,
2694
+ Pt as NiceAPITester,
2695
+ At as NiceIntegrationBuilder,
2696
+ Dt as NiceWebhookTester,
2697
+ Mt as NiceYamlError,
2698
+ Lt as POSTMAN_SCHEMA_V21,
2699
+ Vt as bodyContentType,
2700
+ Ft as bodyFromText,
2701
+ Jt as bodyText,
2702
+ Gt as buildAuthorizationUrl,
2703
+ Wt as buildGraphqlOperation,
2704
+ ze as buildRequestUrl,
2705
+ Yt as buildSoapEnvelope,
2706
+ Xt as collectionToMarkdown,
2707
+ Ot as collectionToOpenApiSchema,
2708
+ Qt as createPkcePair,
2709
+ Zt as detectApiDocument,
2710
+ ei as digest,
2711
+ ti as digestAuthorization,
2712
+ ii as effectiveAuth,
2713
+ ni as exchangeAuthorizationCode,
2714
+ ri as exportHar,
2715
+ Re as exportOpenApi,
2716
+ ai as exportOpenApiYaml,
2717
+ si as exportPostman,
2718
+ oi as exportPostmanEnvironment,
2719
+ ci as fetchOAuth2Token,
2720
+ li as fetchTransport,
2721
+ di as findApiItem,
2722
+ pi as findVariables,
2723
+ je as flattenApiRequests,
2724
+ xt as fromApiTesterCollection,
2725
+ Pe as fromApiTesterRequest,
2726
+ ui as fromBase64,
2727
+ mi as generateCode,
2728
+ hi as graphqlExampleValue,
2729
+ gi as graphqlOperations,
2730
+ bi as graphqlTypeName,
2731
+ _i as headerValue,
2732
+ yi as hmac,
2733
+ vi as importApiDocument,
2734
+ fi as importGraphqlIntrospection,
2735
+ Ni as importHar,
2736
+ $e as importOpenApi,
2737
+ wi as importPostman,
2738
+ Ti as importPostmanEnvironment,
2739
+ ki as importWsdl,
2740
+ Ci as inferSchema,
2741
+ Si as interpolate,
2742
+ Ei as isCurlCommand,
2743
+ ye as isEnabled,
2744
+ Pi as isHar,
2745
+ Ai as isPostmanCollection,
2746
+ Di as joinUrl,
2747
+ xi as jsonPointer,
2748
+ Ii as md5Hex,
2749
+ Ri as mockFromSchema,
2750
+ qi as mockResponse,
2751
+ Oi as namedType,
2752
+ qe as newApiCollection,
2753
+ Ke as newApiFolder,
2754
+ Bi as newApiId,
2755
+ Oe as newApiRequest,
2756
+ qt as openApiSchemaToCollection,
2757
+ $i as paramsIn,
2758
+ zi as parseCurl,
2759
+ ji as parseDigestChallenge,
2760
+ Ki as parseFormEncoded,
2761
+ Hi as parseGraphqlIntrospection,
2762
+ Ui as parseJsonOrYaml,
2763
+ Mi as parseWsdl,
2764
+ Li as parseYaml,
2765
+ Vi as pathParamNames,
2766
+ Fi as pollDeviceToken,
2767
+ Ji as refreshOAuth2Token,
2768
+ Gi as requestName,
2769
+ Wi as resolvePlainScalar,
2770
+ Yi as resolveRequest,
2771
+ oe as rowsToRecord,
2772
+ Xi as schemaResolver,
2773
+ Qi as sendApiRequest,
2774
+ Be as setRequestUrl,
2775
+ Zi as signAwsV4,
2776
+ en as signHmac,
2777
+ tn as splitUrl,
2778
+ nn as startDeviceAuthorization,
2779
+ rn as stringifyYaml,
2780
+ an as swagger2ToOpenApi3,
2781
+ sn as syncPathParams,
2782
+ It as toApiTesterCollection,
2783
+ be as toApiTesterRequest,
2784
+ Rt as toApiTesterRequests,
2785
+ on as toBase64,
2786
+ cn as toCurl,
2787
+ ln as tokenizeCommand,
2788
+ dn as unresolvedVariables,
2789
+ pn as updateApiItem,
2790
+ un as variableScope
2485
2791
  };