@nice2dev/ui-api 1.2.0 → 1.2.1

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