@nice2dev/ui-api 1.0.28 → 1.1.5

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,3829 +1,7 @@
1
- import { jsx as r, jsxs as t, Fragment as J } from "react/jsx-runtime";
2
- import { useContext as me, createContext as M, memo as He, useState as g, useEffect as ye, useCallback as P, useRef as se, forwardRef as ke, useMemo as Te } from "react";
3
- const Ee = (e, a) => a, Re = M(Ee);
4
- function Ae() {
5
- return { t: me(Re) };
6
- }
7
- M({
8
- dir: "ltr",
9
- isRTL: !1,
10
- flip: (e) => e,
11
- value: (e) => e.ltr
12
- });
13
- M(null);
14
- M(null);
15
- const Pe = {
16
- radius: "md",
17
- shadow: "md",
18
- fill: "solid",
19
- buttonStyle: "flat",
20
- inputStyle: "bordered",
21
- cardStyle: "elevated",
22
- badgeStyle: "solid",
23
- tabStyle: "underline",
24
- toggleStyle: "default",
25
- tooltipStyle: "dark",
26
- modalStyle: "default",
27
- tableStyle: "default",
28
- menuStyle: "default",
29
- animation: "normal",
30
- density: "normal"
31
- };
32
- M({
33
- displayStyle: "default",
34
- variantConfig: Pe,
35
- setDisplayStyle: () => {
36
- }
37
- });
38
- M({});
39
- M({
40
- direction: "ltr",
41
- isRTL: !1,
42
- flip: (e) => e,
43
- flipStyle: (e, a) => ({ [e]: a })
44
- });
45
- M({
46
- permissions: {},
47
- getAccessMode: () => "full"
48
- });
49
- M(null);
50
- const De = process.env.NODE_ENV === "development";
51
- let ue = {
52
- enabled: De,
53
- slowRenderThreshold: 16
54
- };
55
- const be = [], ce = /* @__PURE__ */ new Map(), he = /* @__PURE__ */ new Map();
56
- function Ie() {
57
- be.length = 0, ce.clear(), he.clear();
58
- }
59
- function $e(e) {
60
- const a = ue.slowRenderThreshold;
61
- return be.filter((i) => i.actualDuration > a);
62
- }
63
- function W(e) {
64
- return e < 1 ? `${(e * 1e3).toFixed(0)}μs` : e < 1e3 ? `${e.toFixed(2)}ms` : `${(e / 1e3).toFixed(2)}s`;
65
- }
66
- function Oe() {
67
- const e = Array.from(ce.values()), a = $e(), i = e.reduce((u, f) => u + f.renderCount, 0), n = e.length > 0 ? e.reduce((u, f) => u + f.avgRenderTime, 0) / e.length : 0, s = Array.from(he.values());
68
- return { stats: e, slowRenders: a, totalRenders: i, avgRenderTime: n, marks: s };
69
- }
70
- function Me() {
71
- const e = Oe();
72
- console.group(
73
- "%c[Nice2Dev Performance Report]",
74
- "color: var(--nice-info, #6366f1); font-weight: bold; font-size: 14px"
75
- ), console.log(`Total renders: ${e.totalRenders}`), console.log(`Average render time: ${W(e.avgRenderTime)}`), console.log(`Slow renders: ${e.slowRenders.length}`), console.group("Component Stats"), console.table(
76
- e.stats.sort((a, i) => i.totalRenderTime - a.totalRenderTime).map((a) => ({
77
- Name: a.componentName,
78
- Renders: a.renderCount,
79
- "Avg Time": W(a.avgRenderTime),
80
- "Max Time": W(a.maxRenderTime),
81
- "Total Time": W(a.totalRenderTime),
82
- "Slow Renders": a.slowRenderCount
83
- }))
84
- ), console.groupEnd(), e.slowRenders.length > 0 && (console.group("Slow Renders (last 10)"), console.table(
85
- e.slowRenders.slice(-10).map((a) => ({
86
- Component: a.componentName,
87
- Phase: a.phase,
88
- Duration: W(a.actualDuration),
89
- Time: new Date(a.timestamp).toLocaleTimeString()
90
- }))
91
- ), console.groupEnd()), e.marks.length > 0 && (console.group("Custom Marks"), console.table(
92
- e.marks.filter((a) => a.duration).map((a) => ({
93
- Name: a.name,
94
- Duration: W(a.duration)
95
- }))
96
- ), console.groupEnd()), console.groupEnd();
97
- }
98
- const Le = He(
99
- ({ position: e = "bottom-right", defaultCollapsed: a = !0 }) => {
100
- const [i, n] = g(a), [s, u] = g([]), [f, y] = g({ used: 0, total: 0 });
101
- if (ye(() => {
102
- const d = () => {
103
- const k = Array.from(ce.values());
104
- u(k.sort((T, _) => _.totalRenderTime - T.totalRenderTime).slice(0, 10));
105
- const m = window.performance;
106
- m.memory && y({
107
- used: m.memory.usedJSHeapSize / 1024 / 1024,
108
- total: m.memory.totalJSHeapSize / 1024 / 1024
109
- });
110
- };
111
- d();
112
- const v = setInterval(d, 2e3);
113
- return () => clearInterval(v);
114
- }, []), !ue.enabled)
115
- return null;
116
- const b = {
117
- position: "fixed",
118
- zIndex: 99999,
119
- ...e.includes("top") ? { top: 8 } : { bottom: 8 },
120
- ...e.includes("left") ? { left: 8 } : { right: 8 }
121
- };
122
- return /* @__PURE__ */ t(
123
- "div",
124
- {
125
- style: {
126
- ...b,
127
- background: "var(--nice-overlay-85, rgba(0, 0, 0, 0.85))",
128
- color: "var(--bg-primary, #fff)",
129
- borderRadius: 8,
130
- fontSize: 11,
131
- fontFamily: "Monaco, Consolas, monospace",
132
- padding: i ? "4px 8px" : 8,
133
- maxWidth: i ? "auto" : 300,
134
- maxHeight: i ? "auto" : 400,
135
- overflow: "auto"
136
- },
137
- children: [
138
- /* @__PURE__ */ t(
139
- "div",
140
- {
141
- style: { cursor: "pointer", display: "flex", alignItems: "center", gap: 8 },
142
- onClick: () => n((d) => !d),
143
- children: [
144
- /* @__PURE__ */ r("span", { style: { color: "var(--color-success, #22c55e)" }, children: "●" }),
145
- /* @__PURE__ */ r("span", { children: "Profiler" }),
146
- f.used > 0 && /* @__PURE__ */ t(
147
- "span",
148
- {
149
- style: {
150
- color: f.used > 100 ? "var(--color-warning, #f59e0b)" : "var(--text-muted, #64748b)"
151
- },
152
- children: [
153
- f.used.toFixed(0),
154
- "MB"
155
- ]
156
- }
157
- ),
158
- /* @__PURE__ */ r("span", { style: { marginLeft: "auto", opacity: 0.5 }, children: i ? "▼" : "▲" })
159
- ]
160
- }
161
- ),
162
- !i && /* @__PURE__ */ t("div", { style: { marginTop: 8 }, children: [
163
- /* @__PURE__ */ r(
164
- "div",
165
- {
166
- style: {
167
- borderBottom: "1px solid var(--border-color, #333)",
168
- paddingBottom: 4,
169
- marginBottom: 8
170
- },
171
- children: /* @__PURE__ */ r("strong", { children: "Top Components" })
172
- }
173
- ),
174
- s.map((d) => /* @__PURE__ */ t("div", { style: { marginBottom: 4, display: "flex", gap: 8 }, children: [
175
- /* @__PURE__ */ r("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis" }, children: d.componentName }),
176
- /* @__PURE__ */ r(
177
- "span",
178
- {
179
- style: {
180
- color: d.avgRenderTime > 16 ? "var(--color-warning, #f59e0b)" : "var(--color-success, #22c55e)"
181
- },
182
- children: W(d.avgRenderTime)
183
- }
184
- ),
185
- /* @__PURE__ */ t(
186
- "span",
187
- {
188
- style: { color: "var(--text-muted, #64748b)", minWidth: 30, textAlign: "right" },
189
- children: [
190
- "x",
191
- d.renderCount
192
- ]
193
- }
194
- )
195
- ] }, d.componentName)),
196
- /* @__PURE__ */ t("div", { style: { marginTop: 8, display: "flex", gap: 8 }, children: [
197
- /* @__PURE__ */ r(
198
- "button",
199
- {
200
- onClick: Me,
201
- style: {
202
- flex: 1,
203
- padding: "4px 8px",
204
- background: "var(--bg-tertiary, #333)",
205
- border: "none",
206
- borderRadius: 4,
207
- color: "var(--bg-primary, #fff)",
208
- cursor: "pointer",
209
- fontSize: 10
210
- },
211
- children: "Print Report"
212
- }
213
- ),
214
- /* @__PURE__ */ r(
215
- "button",
216
- {
217
- onClick: Ie,
218
- style: {
219
- flex: 1,
220
- padding: "4px 8px",
221
- background: "var(--bg-tertiary, #333)",
222
- border: "none",
223
- borderRadius: 4,
224
- color: "var(--bg-primary, #fff)",
225
- cursor: "pointer",
226
- fontSize: 10
227
- },
228
- children: "Clear"
229
- }
230
- )
231
- ] })
232
- ] })
233
- ]
234
- }
235
- );
236
- }
237
- );
238
- Le.displayName = "ProfilerOverlay";
239
- process.env.NODE_ENV;
240
- M(null);
241
- const Ue = M({
242
- enabled: !0,
243
- active: !1,
244
- run: () => {
245
- }
246
- });
247
- function Ke() {
248
- return me(Ue);
249
- }
250
- function ee(e, a) {
251
- if (!e)
252
- return null;
253
- if (e === !0)
254
- return a && a.length > 0 ? a : null;
255
- if (Array.isArray(e))
256
- return e.length > 0 ? e : null;
257
- const i = e.steps ?? a;
258
- return i && i.length > 0 ? i : null;
259
- }
260
- function je(e, a) {
261
- return e.map((i) => ({
262
- target: i.target,
263
- title: i.titleKey ? a(i.titleKey, i.title ?? "") : i.title ?? "",
264
- content: i.contentKey ? a(i.contentKey, i.content ?? "") : i.content ?? "",
265
- placement: i.placement,
266
- highlightPadding: i.highlightPadding,
267
- showArrow: i.showArrow,
268
- scrollIntoView: i.scrollIntoView,
269
- disableInteraction: i.disableInteraction
270
- }));
271
- }
272
- const re = ({
273
- steps: e,
274
- autoStart: a,
275
- label: i,
276
- size: n = "md",
277
- className: s,
278
- style: u,
279
- "data-testid": f
280
- }) => {
281
- const { enabled: y, run: b } = Ke(), { t: d } = Ae();
282
- if (!y || !e || e.length === 0)
283
- return null;
284
- const v = i ?? d("tutorial.startAria", "Start tutorial");
285
- return /* @__PURE__ */ r(
286
- "button",
287
- {
288
- type: "button",
289
- className: `nice-tutorial-button nice-tutorial-button--${n}` + (s ? ` ${s}` : ""),
290
- style: u,
291
- "data-testid": f,
292
- "aria-label": v,
293
- title: v,
294
- onClick: () => b(je(e, d), { autoStart: a }),
295
- children: "?"
296
- }
297
- );
298
- }, de = "nice-tutorial-button-styles";
299
- if (typeof document < "u" && !document.getElementById(de)) {
300
- const e = document.createElement("style");
301
- e.id = de, e.textContent = `
302
- .nice-tutorial-button {
303
- display: inline-flex;
304
- align-items: center;
305
- justify-content: center;
306
- border: 1px solid var(--nice-border, #cbd5e1);
307
- background: var(--nice-bg, #fff);
308
- color: var(--nice-text-secondary, #475569);
309
- border-radius: var(--nice-radius-full, 9999px);
310
- cursor: help;
311
- font-weight: 700;
312
- line-height: 1;
313
- padding: 0;
314
- transition: background var(--nice-transition, 200ms ease), color var(--nice-transition, 200ms ease), border-color var(--nice-transition, 200ms ease);
315
- }
316
- .nice-tutorial-button:hover {
317
- background: var(--nice-primary, #2563eb);
318
- border-color: var(--nice-primary, #2563eb);
319
- color: var(--nice-text-inverse, #fff);
320
- }
321
- .nice-tutorial-button:focus-visible {
322
- outline: none;
323
- box-shadow: 0 0 0 2px var(--nice-bg, #fff), 0 0 0 4px var(--nice-primary, #2563eb);
324
- }
325
- .nice-tutorial-button--sm { width: 16px; height: 16px; font-size: 11px; }
326
- .nice-tutorial-button--md { width: 20px; height: 20px; font-size: 12px; }
327
- `, document.head.appendChild(e);
328
- }
329
- M(null);
330
- M(null);
331
- M(null);
332
- const ge = {
333
- space1: "4px",
334
- space2: "8px",
335
- space3: "12px",
336
- space4: "16px",
337
- space5: "20px",
338
- space6: "24px",
339
- space8: "32px"
340
- }, ve = {
341
- fontFamily: "'Inter', system-ui, -apple-system, sans-serif",
342
- fontSizeXs: "0.75rem",
343
- fontSizeSm: "0.8125rem",
344
- fontSizeMd: "0.875rem",
345
- fontSizeLg: "1rem",
346
- fontSizeXl: "1.125rem",
347
- fontWeightNormal: 400,
348
- fontWeightMedium: 500,
349
- fontWeightSemibold: 600,
350
- fontWeightBold: 700,
351
- lineHeight: 1.5
352
- }, _e = { fast: "120ms ease", normal: "200ms ease", slow: "300ms ease" }, we = (e) => ({
353
- color: e,
354
- radiusSm: "4px",
355
- radiusMd: "6px",
356
- radiusLg: "8px",
357
- radiusXl: "12px",
358
- radiusFull: "9999px"
359
- }), qe = {
360
- sm: "0 1px 2px rgba(0,0,0,0.05)",
361
- md: "0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",
362
- lg: "0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)",
363
- xl: "0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1)"
364
- }, Be = {
365
- sm: "0 1px 2px rgba(0,0,0,0.3)",
366
- md: "0 4px 6px -1px rgba(0,0,0,0.4)",
367
- lg: "0 10px 15px -3px rgba(0,0,0,0.4)",
368
- xl: "0 20px 25px -5px rgba(0,0,0,0.4)"
369
- };
370
- function l(e, a, i, n, s) {
371
- return {
372
- name: e,
373
- darkMode: "light",
374
- colors: {
375
- ...a,
376
- surface: a.surface ?? i.primary,
377
- surfaceHover: a.surfaceHover ?? i.secondary
378
- },
379
- backgrounds: {
380
- ...i,
381
- elevated: i.elevated ?? i.primary,
382
- inset: i.inset ?? i.tertiary,
383
- canvas: i.canvas ?? i.primary
384
- },
385
- text: { ...n, inverse: n.inverse ?? "#ffffff" },
386
- borders: we(s),
387
- shadows: qe,
388
- spacing: ge,
389
- typography: ve,
390
- transitions: _e
391
- };
392
- }
393
- function A(e, a, i, n, s) {
394
- return {
395
- name: e,
396
- darkMode: "dark",
397
- colors: {
398
- ...a,
399
- surface: a.surface ?? i.secondary,
400
- surfaceHover: a.surfaceHover ?? i.tertiary
401
- },
402
- backgrounds: {
403
- ...i,
404
- elevated: i.elevated ?? i.secondary,
405
- inset: i.inset ?? i.primary,
406
- canvas: i.canvas ?? i.primary
407
- },
408
- text: { ...n, inverse: n.inverse ?? "#0f172a" },
409
- borders: we(s),
410
- shadows: Be,
411
- spacing: ge,
412
- typography: ve,
413
- transitions: _e
414
- };
415
- }
416
- l(
417
- "Slate",
418
- {
419
- primary: "#64748b",
420
- primaryHover: "#475569",
421
- success: "#10b981",
422
- warning: "#f59e0b",
423
- error: "#ef4444",
424
- info: "#06b6d4"
425
- },
426
- { primary: "#f8fafc", secondary: "#f1f5f9", tertiary: "#e2e8f0", hover: "#e2e8f0" },
427
- { primary: "#1e293b", secondary: "#475569", muted: "#94a3b8" },
428
- "#cbd5e1"
429
- );
430
- l(
431
- "Zinc",
432
- {
433
- primary: "#71717a",
434
- primaryHover: "#52525b",
435
- success: "#22c55e",
436
- warning: "#eab308",
437
- error: "#ef4444",
438
- info: "#06b6d4"
439
- },
440
- { primary: "#fafafa", secondary: "#f4f4f5", tertiary: "#e4e4e7", hover: "#e4e4e7" },
441
- { primary: "#18181b", secondary: "#3f3f46", muted: "#a1a1aa" },
442
- "#d4d4d8"
443
- );
444
- l(
445
- "Stone",
446
- {
447
- primary: "#78716c",
448
- primaryHover: "#57534e",
449
- success: "#16a34a",
450
- warning: "#ca8a04",
451
- error: "#dc2626",
452
- info: "#0891b2"
453
- },
454
- { primary: "#fafaf9", secondary: "#f5f5f4", tertiary: "#e7e5e4", hover: "#e7e5e4" },
455
- { primary: "#1c1917", secondary: "#44403c", muted: "#a8a29e" },
456
- "#d6d3d1"
457
- );
458
- l(
459
- "Cool Gray",
460
- {
461
- primary: "#6b7280",
462
- primaryHover: "#4b5563",
463
- success: "#10b981",
464
- warning: "#f59e0b",
465
- error: "#ef4444",
466
- info: "#3b82f6"
467
- },
468
- { primary: "#f9fafb", secondary: "#f3f4f6", tertiary: "#e5e7eb", hover: "#e5e7eb" },
469
- { primary: "#111827", secondary: "#374151", muted: "#9ca3af" },
470
- "#d1d5db"
471
- );
472
- l(
473
- "Warm Gray",
474
- {
475
- primary: "#7c7568",
476
- primaryHover: "#5c564c",
477
- success: "#4d7c0f",
478
- warning: "#a16207",
479
- error: "#b91c1c",
480
- info: "#0e7490"
481
- },
482
- { primary: "#faf9f7", secondary: "#f5f4f0", tertiary: "#e8e6e1", hover: "#e8e6e1" },
483
- { primary: "#1f1d19", secondary: "#4a463d", muted: "#a09888" },
484
- "#d4d0c8"
485
- );
486
- l(
487
- "Silver",
488
- {
489
- primary: "#94a3b8",
490
- primaryHover: "#64748b",
491
- success: "#10b981",
492
- warning: "#f59e0b",
493
- error: "#ef4444",
494
- info: "#38bdf8"
495
- },
496
- { primary: "#f8fafc", secondary: "#f1f5f9", tertiary: "#e2e8f0", hover: "#e2e8f0" },
497
- { primary: "#334155", secondary: "#64748b", muted: "#94a3b8" },
498
- "#cbd5e1"
499
- );
500
- l(
501
- "Charcoal",
502
- {
503
- primary: "#374151",
504
- primaryHover: "#1f2937",
505
- success: "#059669",
506
- warning: "#d97706",
507
- error: "#dc2626",
508
- info: "#0284c7"
509
- },
510
- { primary: "#f9fafb", secondary: "#f3f4f6", tertiary: "#e5e7eb", hover: "#e5e7eb" },
511
- { primary: "#111827", secondary: "#374151", muted: "#6b7280" },
512
- "#d1d5db"
513
- );
514
- l(
515
- "Ivory",
516
- {
517
- primary: "#92876d",
518
- primaryHover: "#7a6f55",
519
- success: "#4d7c0f",
520
- warning: "#a16207",
521
- error: "#b91c1c",
522
- info: "#0e7490"
523
- },
524
- { primary: "#fffef7", secondary: "#faf6eb", tertiary: "#f0ead6", hover: "#f0ead6" },
525
- { primary: "#2b2517", secondary: "#5c5340", muted: "#9c9280" },
526
- "#ddd8c4"
527
- );
528
- l(
529
- "Rose",
530
- {
531
- primary: "#e11d48",
532
- primaryHover: "#be123c",
533
- success: "#16a34a",
534
- warning: "#ea580c",
535
- error: "#dc2626",
536
- info: "#0891b2"
537
- },
538
- { primary: "#fff1f2", secondary: "#ffe4e6", tertiary: "#fecdd3", hover: "#ffe4e6" },
539
- { primary: "#4c0519", secondary: "#881337", muted: "#f43f5e" },
540
- "#fda4af"
541
- );
542
- l(
543
- "Emerald",
544
- {
545
- primary: "#059669",
546
- primaryHover: "#047857",
547
- success: "#16a34a",
548
- warning: "#d97706",
549
- error: "#dc2626",
550
- info: "#0891b2"
551
- },
552
- { primary: "#ecfdf5", secondary: "#d1fae5", tertiary: "#a7f3d0", hover: "#d1fae5" },
553
- { primary: "#064e3b", secondary: "#065f46", muted: "#34d399" },
554
- "#6ee7b7"
555
- );
556
- l(
557
- "Amber",
558
- {
559
- primary: "#d97706",
560
- primaryHover: "#b45309",
561
- success: "#16a34a",
562
- warning: "#ca8a04",
563
- error: "#dc2626",
564
- info: "#0284c7"
565
- },
566
- { primary: "#fffbeb", secondary: "#fef3c7", tertiary: "#fde68a", hover: "#fef3c7" },
567
- { primary: "#451a03", secondary: "#78350f", muted: "#f59e0b" },
568
- "#fcd34d"
569
- );
570
- l(
571
- "Violet",
572
- {
573
- primary: "#7c3aed",
574
- primaryHover: "#6d28d9",
575
- success: "#10b981",
576
- warning: "#f59e0b",
577
- error: "#ef4444",
578
- info: "#06b6d4"
579
- },
580
- { primary: "#f5f3ff", secondary: "#ede9fe", tertiary: "#ddd6fe", hover: "#ede9fe" },
581
- { primary: "#2e1065", secondary: "#4c1d95", muted: "#a78bfa" },
582
- "#c4b5fd"
583
- );
584
- l(
585
- "Teal",
586
- {
587
- primary: "#0d9488",
588
- primaryHover: "#0f766e",
589
- success: "#16a34a",
590
- warning: "#d97706",
591
- error: "#dc2626",
592
- info: "#0284c7"
593
- },
594
- { primary: "#f0fdfa", secondary: "#ccfbf1", tertiary: "#99f6e4", hover: "#ccfbf1" },
595
- { primary: "#134e4a", secondary: "#115e59", muted: "#2dd4bf" },
596
- "#5eead4"
597
- );
598
- l(
599
- "Indigo",
600
- {
601
- primary: "#4f46e5",
602
- primaryHover: "#4338ca",
603
- success: "#10b981",
604
- warning: "#f59e0b",
605
- error: "#ef4444",
606
- info: "#06b6d4"
607
- },
608
- { primary: "#eef2ff", secondary: "#e0e7ff", tertiary: "#c7d2fe", hover: "#e0e7ff" },
609
- { primary: "#1e1b4b", secondary: "#312e81", muted: "#818cf8" },
610
- "#a5b4fc"
611
- );
612
- l(
613
- "Cyan",
614
- {
615
- primary: "#0891b2",
616
- primaryHover: "#0e7490",
617
- success: "#10b981",
618
- warning: "#f59e0b",
619
- error: "#ef4444",
620
- info: "#0284c7"
621
- },
622
- { primary: "#ecfeff", secondary: "#cffafe", tertiary: "#a5f3fc", hover: "#cffafe" },
623
- { primary: "#164e63", secondary: "#155e75", muted: "#22d3ee" },
624
- "#67e8f9"
625
- );
626
- l(
627
- "Lime",
628
- {
629
- primary: "#65a30d",
630
- primaryHover: "#4d7c0f",
631
- success: "#16a34a",
632
- warning: "#ca8a04",
633
- error: "#dc2626",
634
- info: "#0891b2"
635
- },
636
- { primary: "#f7fee7", secondary: "#ecfccb", tertiary: "#d9f99d", hover: "#ecfccb" },
637
- { primary: "#1a2e05", secondary: "#365314", muted: "#84cc16" },
638
- "#bef264"
639
- );
640
- l(
641
- "Pink",
642
- {
643
- primary: "#db2777",
644
- primaryHover: "#be185d",
645
- success: "#10b981",
646
- warning: "#f59e0b",
647
- error: "#dc2626",
648
- info: "#06b6d4"
649
- },
650
- { primary: "#fdf2f8", secondary: "#fce7f3", tertiary: "#fbcfe8", hover: "#fce7f3" },
651
- { primary: "#500724", secondary: "#831843", muted: "#f472b6" },
652
- "#f9a8d4"
653
- );
654
- l(
655
- "Orange",
656
- {
657
- primary: "#ea580c",
658
- primaryHover: "#c2410c",
659
- success: "#16a34a",
660
- warning: "#ca8a04",
661
- error: "#dc2626",
662
- info: "#0891b2"
663
- },
664
- { primary: "#fff7ed", secondary: "#ffedd5", tertiary: "#fed7aa", hover: "#ffedd5" },
665
- { primary: "#431407", secondary: "#7c2d12", muted: "#fb923c" },
666
- "#fdba74"
667
- );
668
- l(
669
- "Fuchsia",
670
- {
671
- primary: "#c026d3",
672
- primaryHover: "#a21caf",
673
- success: "#10b981",
674
- warning: "#eab308",
675
- error: "#ef4444",
676
- info: "#06b6d4"
677
- },
678
- { primary: "#fdf4ff", secondary: "#fae8ff", tertiary: "#f5d0fe", hover: "#fae8ff" },
679
- { primary: "#4a044e", secondary: "#701a75", muted: "#d946ef" },
680
- "#e879f9"
681
- );
682
- l(
683
- "Sky",
684
- {
685
- primary: "#0284c7",
686
- primaryHover: "#0369a1",
687
- success: "#10b981",
688
- warning: "#f59e0b",
689
- error: "#ef4444",
690
- info: "#06b6d4"
691
- },
692
- { primary: "#f0f9ff", secondary: "#e0f2fe", tertiary: "#bae6fd", hover: "#e0f2fe" },
693
- { primary: "#0c4a6e", secondary: "#075985", muted: "#38bdf8" },
694
- "#7dd3fc"
695
- );
696
- l(
697
- "Ruby",
698
- {
699
- primary: "#be123c",
700
- primaryHover: "#9f1239",
701
- success: "#059669",
702
- warning: "#d97706",
703
- error: "#dc2626",
704
- info: "#0284c7"
705
- },
706
- { primary: "#fff1f2", secondary: "#ffe4e6", tertiary: "#fecdd3", hover: "#ffe4e6" },
707
- { primary: "#4c0519", secondary: "#881337", muted: "#fb7185" },
708
- "#fda4af"
709
- );
710
- l(
711
- "Coral",
712
- {
713
- primary: "#f97316",
714
- primaryHover: "#ea580c",
715
- success: "#10b981",
716
- warning: "#eab308",
717
- error: "#ef4444",
718
- info: "#06b6d4"
719
- },
720
- { primary: "#fff7ed", secondary: "#ffedd5", tertiary: "#fed7aa", hover: "#ffedd5" },
721
- { primary: "#431407", secondary: "#9a3412", muted: "#fb923c" },
722
- "#fdba74"
723
- );
724
- A(
725
- "Midnight",
726
- {
727
- primary: "#818cf8",
728
- primaryHover: "#6366f1",
729
- success: "#34d399",
730
- warning: "#fbbf24",
731
- error: "#f87171",
732
- info: "#22d3ee"
733
- },
734
- { primary: "#020617", secondary: "#0f172a", tertiary: "#1e293b", hover: "#1e293b" },
735
- { primary: "#f1f5f9", secondary: "#94a3b8", muted: "#475569" },
736
- "#1e293b"
737
- );
738
- A(
739
- "Obsidian",
740
- {
741
- primary: "#a78bfa",
742
- primaryHover: "#8b5cf6",
743
- success: "#4ade80",
744
- warning: "#facc15",
745
- error: "#fb7185",
746
- info: "#38bdf8"
747
- },
748
- { primary: "#09090b", secondary: "#18181b", tertiary: "#27272a", hover: "#27272a" },
749
- { primary: "#fafafa", secondary: "#a1a1aa", muted: "#52525b" },
750
- "#3f3f46"
751
- );
752
- A(
753
- "Eclipse",
754
- {
755
- primary: "#c084fc",
756
- primaryHover: "#a855f7",
757
- success: "#34d399",
758
- warning: "#fbbf24",
759
- error: "#f87171",
760
- info: "#67e8f9"
761
- },
762
- { primary: "#0c0a1d", secondary: "#1a1533", tertiary: "#2a2248", hover: "#2a2248" },
763
- { primary: "#f5f3ff", secondary: "#a78bfa", muted: "#6d5eac" },
764
- "#3b3266"
765
- );
766
- A(
767
- "Onyx",
768
- {
769
- primary: "#60a5fa",
770
- primaryHover: "#3b82f6",
771
- success: "#4ade80",
772
- warning: "#fbbf24",
773
- error: "#f87171",
774
- info: "#22d3ee"
775
- },
776
- { primary: "#000000", secondary: "#0a0a0a", tertiary: "#171717", hover: "#171717" },
777
- { primary: "#ffffff", secondary: "#a3a3a3", muted: "#525252" },
778
- "#262626"
779
- );
780
- A(
781
- "Carbon",
782
- {
783
- primary: "#38bdf8",
784
- primaryHover: "#0ea5e9",
785
- success: "#4ade80",
786
- warning: "#facc15",
787
- error: "#f87171",
788
- info: "#67e8f9"
789
- },
790
- { primary: "#161616", secondary: "#262626", tertiary: "#393939", hover: "#393939" },
791
- { primary: "#f4f4f4", secondary: "#c6c6c6", muted: "#6f6f6f" },
792
- "#525252"
793
- );
794
- A(
795
- "Cosmos",
796
- {
797
- primary: "#6366f1",
798
- primaryHover: "#4f46e5",
799
- success: "#34d399",
800
- warning: "#fbbf24",
801
- error: "#f87171",
802
- info: "#22d3ee"
803
- },
804
- { primary: "#030712", secondary: "#111827", tertiary: "#1f2937", hover: "#1f2937" },
805
- { primary: "#e5e7eb", secondary: "#9ca3af", muted: "#4b5563" },
806
- "#374151"
807
- );
808
- A(
809
- "Nebula",
810
- {
811
- primary: "#e879f9",
812
- primaryHover: "#d946ef",
813
- success: "#4ade80",
814
- warning: "#fbbf24",
815
- error: "#fb7185",
816
- info: "#67e8f9"
817
- },
818
- { primary: "#0d0117", secondary: "#1a0533", tertiary: "#2d0a52", hover: "#2d0a52" },
819
- { primary: "#fae8ff", secondary: "#d8b4fe", muted: "#7c3aed" },
820
- "#581c87"
821
- );
822
- A(
823
- "Abyss",
824
- {
825
- primary: "#22d3ee",
826
- primaryHover: "#06b6d4",
827
- success: "#34d399",
828
- warning: "#fbbf24",
829
- error: "#f87171",
830
- info: "#38bdf8"
831
- },
832
- { primary: "#001219", secondary: "#002a3a", tertiary: "#003e54", hover: "#003e54" },
833
- { primary: "#e0f2fe", secondary: "#7dd3fc", muted: "#0369a1" },
834
- "#075985"
835
- );
836
- A(
837
- "Shadow",
838
- {
839
- primary: "#a3a3a3",
840
- primaryHover: "#737373",
841
- success: "#4ade80",
842
- warning: "#facc15",
843
- error: "#f87171",
844
- info: "#38bdf8"
845
- },
846
- { primary: "#171717", secondary: "#1f1f1f", tertiary: "#2a2a2a", hover: "#2a2a2a" },
847
- { primary: "#e5e5e5", secondary: "#a3a3a3", muted: "#525252" },
848
- "#404040"
849
- );
850
- A(
851
- "Emerald Dark",
852
- {
853
- primary: "#34d399",
854
- primaryHover: "#10b981",
855
- success: "#4ade80",
856
- warning: "#fbbf24",
857
- error: "#f87171",
858
- info: "#22d3ee"
859
- },
860
- { primary: "#022c22", secondary: "#064e3b", tertiary: "#065f46", hover: "#065f46" },
861
- { primary: "#ecfdf5", secondary: "#6ee7b7", muted: "#047857" },
862
- "#047857"
863
- );
864
- l(
865
- "Forest",
866
- {
867
- primary: "#166534",
868
- primaryHover: "#14532d",
869
- success: "#22c55e",
870
- warning: "#ca8a04",
871
- error: "#dc2626",
872
- info: "#0891b2"
873
- },
874
- { primary: "#f0fdf4", secondary: "#dcfce7", tertiary: "#bbf7d0", hover: "#dcfce7" },
875
- { primary: "#052e16", secondary: "#166534", muted: "#4ade80" },
876
- "#86efac"
877
- );
878
- l(
879
- "Ocean",
880
- {
881
- primary: "#0369a1",
882
- primaryHover: "#075985",
883
- success: "#059669",
884
- warning: "#d97706",
885
- error: "#dc2626",
886
- info: "#0284c7"
887
- },
888
- { primary: "#f0f9ff", secondary: "#e0f2fe", tertiary: "#bae6fd", hover: "#e0f2fe" },
889
- { primary: "#0c4a6e", secondary: "#0369a1", muted: "#38bdf8" },
890
- "#7dd3fc"
891
- );
892
- l(
893
- "Desert",
894
- {
895
- primary: "#b45309",
896
- primaryHover: "#92400e",
897
- success: "#4d7c0f",
898
- warning: "#a16207",
899
- error: "#b91c1c",
900
- info: "#0e7490"
901
- },
902
- { primary: "#fefce8", secondary: "#fef9c3", tertiary: "#fef08a", hover: "#fef9c3" },
903
- { primary: "#422006", secondary: "#713f12", muted: "#ca8a04" },
904
- "#fde047"
905
- );
906
- l(
907
- "Sunset",
908
- {
909
- primary: "#ea580c",
910
- primaryHover: "#c2410c",
911
- success: "#16a34a",
912
- warning: "#d97706",
913
- error: "#dc2626",
914
- info: "#0891b2"
915
- },
916
- { primary: "#fff7ed", secondary: "#ffedd5", tertiary: "#fed7aa", hover: "#ffedd5" },
917
- { primary: "#431407", secondary: "#9a3412", muted: "#f97316" },
918
- "#fdba74"
919
- );
920
- l(
921
- "Aurora",
922
- {
923
- primary: "#0d9488",
924
- primaryHover: "#0f766e",
925
- success: "#22c55e",
926
- warning: "#eab308",
927
- error: "#ef4444",
928
- info: "#06b6d4"
929
- },
930
- { primary: "#f0fdfa", secondary: "#ccfbf1", tertiary: "#99f6e4", hover: "#ccfbf1" },
931
- { primary: "#134e4a", secondary: "#115e59", muted: "#2dd4bf" },
932
- "#5eead4"
933
- );
934
- l(
935
- "Lavender",
936
- {
937
- primary: "#7e22ce",
938
- primaryHover: "#6b21a8",
939
- success: "#16a34a",
940
- warning: "#d97706",
941
- error: "#dc2626",
942
- info: "#0891b2"
943
- },
944
- { primary: "#faf5ff", secondary: "#f3e8ff", tertiary: "#e9d5ff", hover: "#f3e8ff" },
945
- { primary: "#3b0764", secondary: "#581c87", muted: "#a855f7" },
946
- "#d8b4fe"
947
- );
948
- l(
949
- "Autumn",
950
- {
951
- primary: "#c2410c",
952
- primaryHover: "#9a3412",
953
- success: "#4d7c0f",
954
- warning: "#a16207",
955
- error: "#b91c1c",
956
- info: "#0e7490"
957
- },
958
- { primary: "#fef2f2", secondary: "#fee2e2", tertiary: "#fecaca", hover: "#fee2e2" },
959
- { primary: "#450a0a", secondary: "#7f1d1d", muted: "#f87171" },
960
- "#fca5a5"
961
- );
962
- l(
963
- "Spring",
964
- {
965
- primary: "#16a34a",
966
- primaryHover: "#15803d",
967
- success: "#22c55e",
968
- warning: "#eab308",
969
- error: "#ef4444",
970
- info: "#06b6d4"
971
- },
972
- { primary: "#f0fdf4", secondary: "#dcfce7", tertiary: "#bbf7d0", hover: "#dcfce7" },
973
- { primary: "#14532d", secondary: "#166534", muted: "#4ade80" },
974
- "#86efac"
975
- );
976
- l(
977
- "Arctic",
978
- {
979
- primary: "#0ea5e9",
980
- primaryHover: "#0284c7",
981
- success: "#10b981",
982
- warning: "#f59e0b",
983
- error: "#ef4444",
984
- info: "#06b6d4"
985
- },
986
- { primary: "#f0f9ff", secondary: "#e0f2fe", tertiary: "#bae6fd", hover: "#e0f2fe" },
987
- { primary: "#0c4a6e", secondary: "#0369a1", muted: "#7dd3fc" },
988
- "#bae6fd"
989
- );
990
- l(
991
- "Tropical",
992
- {
993
- primary: "#0d9488",
994
- primaryHover: "#0f766e",
995
- success: "#16a34a",
996
- warning: "#f59e0b",
997
- error: "#ef4444",
998
- info: "#06b6d4"
999
- },
1000
- { primary: "#ecfdf5", secondary: "#d1fae5", tertiary: "#a7f3d0", hover: "#d1fae5" },
1001
- { primary: "#064e3b", secondary: "#065f46", muted: "#6ee7b7" },
1002
- "#a7f3d0"
1003
- );
1004
- l(
1005
- "Pastel Rose",
1006
- {
1007
- primary: "#f472b6",
1008
- primaryHover: "#ec4899",
1009
- success: "#4ade80",
1010
- warning: "#fcd34d",
1011
- error: "#fb7185",
1012
- info: "#67e8f9"
1013
- },
1014
- { primary: "#fdf2f8", secondary: "#fce7f3", tertiary: "#fbcfe8", hover: "#fce7f3" },
1015
- { primary: "#831843", secondary: "#9d174d", muted: "#f9a8d4" },
1016
- "#f9a8d4"
1017
- );
1018
- l(
1019
- "Pastel Sky",
1020
- {
1021
- primary: "#38bdf8",
1022
- primaryHover: "#0ea5e9",
1023
- success: "#4ade80",
1024
- warning: "#fcd34d",
1025
- error: "#fb7185",
1026
- info: "#67e8f9"
1027
- },
1028
- { primary: "#f0f9ff", secondary: "#e0f2fe", tertiary: "#bae6fd", hover: "#e0f2fe" },
1029
- { primary: "#075985", secondary: "#0369a1", muted: "#7dd3fc" },
1030
- "#bae6fd"
1031
- );
1032
- l(
1033
- "Pastel Mint",
1034
- {
1035
- primary: "#34d399",
1036
- primaryHover: "#10b981",
1037
- success: "#4ade80",
1038
- warning: "#fcd34d",
1039
- error: "#fb7185",
1040
- info: "#67e8f9"
1041
- },
1042
- { primary: "#ecfdf5", secondary: "#d1fae5", tertiary: "#a7f3d0", hover: "#d1fae5" },
1043
- { primary: "#065f46", secondary: "#047857", muted: "#6ee7b7" },
1044
- "#a7f3d0"
1045
- );
1046
- l(
1047
- "Pastel Peach",
1048
- {
1049
- primary: "#fb923c",
1050
- primaryHover: "#f97316",
1051
- success: "#4ade80",
1052
- warning: "#fcd34d",
1053
- error: "#fb7185",
1054
- info: "#67e8f9"
1055
- },
1056
- { primary: "#fff7ed", secondary: "#ffedd5", tertiary: "#fed7aa", hover: "#ffedd5" },
1057
- { primary: "#7c2d12", secondary: "#9a3412", muted: "#fdba74" },
1058
- "#fed7aa"
1059
- );
1060
- l(
1061
- "Pastel Lavender",
1062
- {
1063
- primary: "#a78bfa",
1064
- primaryHover: "#8b5cf6",
1065
- success: "#4ade80",
1066
- warning: "#fcd34d",
1067
- error: "#fb7185",
1068
- info: "#67e8f9"
1069
- },
1070
- { primary: "#f5f3ff", secondary: "#ede9fe", tertiary: "#ddd6fe", hover: "#ede9fe" },
1071
- { primary: "#4c1d95", secondary: "#5b21b6", muted: "#c4b5fd" },
1072
- "#ddd6fe"
1073
- );
1074
- l(
1075
- "Pastel Lemon",
1076
- {
1077
- primary: "#facc15",
1078
- primaryHover: "#eab308",
1079
- success: "#4ade80",
1080
- warning: "#fcd34d",
1081
- error: "#fb7185",
1082
- info: "#67e8f9"
1083
- },
1084
- { primary: "#fefce8", secondary: "#fef9c3", tertiary: "#fef08a", hover: "#fef9c3" },
1085
- { primary: "#713f12", secondary: "#854d0e", muted: "#fde047" },
1086
- "#fef08a"
1087
- );
1088
- l(
1089
- "Pastel Sage",
1090
- {
1091
- primary: "#86efac",
1092
- primaryHover: "#4ade80",
1093
- success: "#22c55e",
1094
- warning: "#fcd34d",
1095
- error: "#fb7185",
1096
- info: "#67e8f9"
1097
- },
1098
- { primary: "#f0fdf4", secondary: "#dcfce7", tertiary: "#bbf7d0", hover: "#dcfce7" },
1099
- { primary: "#166534", secondary: "#15803d", muted: "#86efac" },
1100
- "#bbf7d0"
1101
- );
1102
- l(
1103
- "Pastel Coral",
1104
- {
1105
- primary: "#fb7185",
1106
- primaryHover: "#f43f5e",
1107
- success: "#4ade80",
1108
- warning: "#fcd34d",
1109
- error: "#ef4444",
1110
- info: "#67e8f9"
1111
- },
1112
- { primary: "#fff1f2", secondary: "#ffe4e6", tertiary: "#fecdd3", hover: "#ffe4e6" },
1113
- { primary: "#881337", secondary: "#9f1239", muted: "#fda4af" },
1114
- "#fecdd3"
1115
- );
1116
- l(
1117
- "Banking",
1118
- {
1119
- primary: "#1e3a5f",
1120
- primaryHover: "#152c4a",
1121
- success: "#059669",
1122
- warning: "#d97706",
1123
- error: "#dc2626",
1124
- info: "#0891b2"
1125
- },
1126
- { primary: "#f8fafc", secondary: "#f1f5f9", tertiary: "#e2e8f0", hover: "#e2e8f0" },
1127
- { primary: "#0f172a", secondary: "#334155", muted: "#94a3b8" },
1128
- "#cbd5e1"
1129
- );
1130
- l(
1131
- "Healthcare",
1132
- {
1133
- primary: "#0891b2",
1134
- primaryHover: "#0e7490",
1135
- success: "#059669",
1136
- warning: "#d97706",
1137
- error: "#dc2626",
1138
- info: "#0284c7"
1139
- },
1140
- { primary: "#f0fdfa", secondary: "#e0f7fa", tertiary: "#b2ebf2", hover: "#e0f7fa" },
1141
- { primary: "#134e4a", secondary: "#1a6b6a", muted: "#80cbc4" },
1142
- "#b2dfdb"
1143
- );
1144
- l(
1145
- "Legal",
1146
- {
1147
- primary: "#1e293b",
1148
- primaryHover: "#0f172a",
1149
- success: "#059669",
1150
- warning: "#d97706",
1151
- error: "#dc2626",
1152
- info: "#0284c7"
1153
- },
1154
- { primary: "#fafaf9", secondary: "#f5f5f4", tertiary: "#e7e5e4", hover: "#e7e5e4" },
1155
- { primary: "#0f172a", secondary: "#44403c", muted: "#a8a29e" },
1156
- "#d6d3d1"
1157
- );
1158
- l(
1159
- "Tech Startup",
1160
- {
1161
- primary: "#7c3aed",
1162
- primaryHover: "#6d28d9",
1163
- success: "#10b981",
1164
- warning: "#f59e0b",
1165
- error: "#ef4444",
1166
- info: "#06b6d4"
1167
- },
1168
- { primary: "#faf5ff", secondary: "#f3e8ff", tertiary: "#e9d5ff", hover: "#f3e8ff" },
1169
- { primary: "#1e1b4b", secondary: "#4c1d95", muted: "#a78bfa" },
1170
- "#c4b5fd"
1171
- );
1172
- l(
1173
- "Enterprise",
1174
- {
1175
- primary: "#1e40af",
1176
- primaryHover: "#1e3a8a",
1177
- success: "#059669",
1178
- warning: "#d97706",
1179
- error: "#dc2626",
1180
- info: "#0891b2"
1181
- },
1182
- { primary: "#eff6ff", secondary: "#dbeafe", tertiary: "#bfdbfe", hover: "#dbeafe" },
1183
- { primary: "#1e3a5f", secondary: "#1e40af", muted: "#60a5fa" },
1184
- "#93c5fd"
1185
- );
1186
- l(
1187
- "Government",
1188
- {
1189
- primary: "#1d4ed8",
1190
- primaryHover: "#1e40af",
1191
- success: "#059669",
1192
- warning: "#d97706",
1193
- error: "#dc2626",
1194
- info: "#0891b2"
1195
- },
1196
- { primary: "#f8fafc", secondary: "#f1f5f9", tertiary: "#e2e8f0", hover: "#e2e8f0" },
1197
- { primary: "#0f172a", secondary: "#1e293b", muted: "#64748b" },
1198
- "#cbd5e1"
1199
- );
1200
- l(
1201
- "Education",
1202
- {
1203
- primary: "#059669",
1204
- primaryHover: "#047857",
1205
- success: "#16a34a",
1206
- warning: "#f59e0b",
1207
- error: "#ef4444",
1208
- info: "#0891b2"
1209
- },
1210
- { primary: "#f0fdf9", secondary: "#d1fae5", tertiary: "#a7f3d0", hover: "#d1fae5" },
1211
- { primary: "#064e3b", secondary: "#065f46", muted: "#6ee7b7" },
1212
- "#a7f3d0"
1213
- );
1214
- l(
1215
- "Real Estate",
1216
- {
1217
- primary: "#92400e",
1218
- primaryHover: "#78350f",
1219
- success: "#059669",
1220
- warning: "#b45309",
1221
- error: "#dc2626",
1222
- info: "#0891b2"
1223
- },
1224
- { primary: "#fffbeb", secondary: "#fef3c7", tertiary: "#fde68a", hover: "#fef3c7" },
1225
- { primary: "#422006", secondary: "#713f12", muted: "#d97706" },
1226
- "#fcd34d"
1227
- );
1228
- l(
1229
- "Nord",
1230
- {
1231
- primary: "#5e81ac",
1232
- primaryHover: "#4c6b90",
1233
- success: "#a3be8c",
1234
- warning: "#ebcb8b",
1235
- error: "#bf616a",
1236
- info: "#88c0d0"
1237
- },
1238
- { primary: "#eceff4", secondary: "#e5e9f0", tertiary: "#d8dee9", hover: "#d8dee9" },
1239
- { primary: "#2e3440", secondary: "#3b4252", muted: "#4c566a" },
1240
- "#d8dee9"
1241
- );
1242
- A(
1243
- "Dracula",
1244
- {
1245
- primary: "#bd93f9",
1246
- primaryHover: "#9d79d9",
1247
- success: "#50fa7b",
1248
- warning: "#f1fa8c",
1249
- error: "#ff5555",
1250
- info: "#8be9fd"
1251
- },
1252
- { primary: "#282a36", secondary: "#343746", tertiary: "#44475a", hover: "#44475a" },
1253
- { primary: "#f8f8f2", secondary: "#c0c0c0", muted: "#6272a4" },
1254
- "#44475a"
1255
- );
1256
- l(
1257
- "Solarized Light",
1258
- {
1259
- primary: "#268bd2",
1260
- primaryHover: "#1a6da0",
1261
- success: "#859900",
1262
- warning: "#b58900",
1263
- error: "#dc322f",
1264
- info: "#2aa198"
1265
- },
1266
- { primary: "#fdf6e3", secondary: "#eee8d5", tertiary: "#e0dbc7", hover: "#eee8d5" },
1267
- { primary: "#073642", secondary: "#586e75", muted: "#93a1a1" },
1268
- "#eee8d5"
1269
- );
1270
- A(
1271
- "Solarized Dark",
1272
- {
1273
- primary: "#268bd2",
1274
- primaryHover: "#3d98db",
1275
- success: "#859900",
1276
- warning: "#b58900",
1277
- error: "#dc322f",
1278
- info: "#2aa198"
1279
- },
1280
- { primary: "#002b36", secondary: "#073642", tertiary: "#0a4858", hover: "#073642" },
1281
- { primary: "#eee8d5", secondary: "#93a1a1", muted: "#586e75" },
1282
- "#073642"
1283
- );
1284
- A(
1285
- "Monokai",
1286
- {
1287
- primary: "#66d9ef",
1288
- primaryHover: "#45c0d6",
1289
- success: "#a6e22e",
1290
- warning: "#e6db74",
1291
- error: "#f92672",
1292
- info: "#66d9ef"
1293
- },
1294
- { primary: "#272822", secondary: "#34352e", tertiary: "#3e3d32", hover: "#3e3d32" },
1295
- { primary: "#f8f8f2", secondary: "#cfcfc2", muted: "#75715e" },
1296
- "#3e3d32"
1297
- );
1298
- A(
1299
- "One Dark",
1300
- {
1301
- primary: "#61afef",
1302
- primaryHover: "#4b9ee0",
1303
- success: "#98c379",
1304
- warning: "#e5c07b",
1305
- error: "#e06c75",
1306
- info: "#56b6c2"
1307
- },
1308
- { primary: "#282c34", secondary: "#2c313a", tertiary: "#353b45", hover: "#353b45" },
1309
- { primary: "#abb2bf", secondary: "#828997", muted: "#545862" },
1310
- "#3e4452"
1311
- );
1312
- A(
1313
- "Synthwave",
1314
- {
1315
- primary: "#ff7edb",
1316
- primaryHover: "#e660c2",
1317
- success: "#72f1b8",
1318
- warning: "#fede5d",
1319
- error: "#fe4450",
1320
- info: "#36f9f6"
1321
- },
1322
- { primary: "#241b2f", secondary: "#2d2140", tertiary: "#362a50", hover: "#362a50" },
1323
- { primary: "#f0e4fc", secondary: "#b4a0cc", muted: "#6c5c84" },
1324
- "#4a3866"
1325
- );
1326
- l(
1327
- "Vaporwave",
1328
- {
1329
- primary: "#ff71ce",
1330
- primaryHover: "#e655b5",
1331
- success: "#78dcca",
1332
- warning: "#ffb86c",
1333
- error: "#ff5555",
1334
- info: "#76e8fc"
1335
- },
1336
- { primary: "#fce4f7", secondary: "#e8d0f4", tertiary: "#d4bcf0", hover: "#e8d0f4" },
1337
- { primary: "#4a1a4e", secondary: "#7b3f7d", muted: "#c080c0" },
1338
- "#d8a8e8"
1339
- );
1340
- A(
1341
- "Terminal Green",
1342
- {
1343
- primary: "#00ff41",
1344
- primaryHover: "#00cc34",
1345
- success: "#00ff41",
1346
- warning: "#ffff00",
1347
- error: "#ff0000",
1348
- info: "#00ffff"
1349
- },
1350
- { primary: "#0a0a0a", secondary: "#0d1a0d", tertiary: "#1a2e1a", hover: "#1a2e1a" },
1351
- { primary: "#00ff41", secondary: "#00cc33", muted: "#008822" },
1352
- "#003300"
1353
- );
1354
- l(
1355
- "Sepia",
1356
- {
1357
- primary: "#8b6914",
1358
- primaryHover: "#704f10",
1359
- success: "#6b8e23",
1360
- warning: "#cd853f",
1361
- error: "#b22222",
1362
- info: "#5f9ea0"
1363
- },
1364
- { primary: "#faf0e6", secondary: "#f5e6d3", tertiary: "#eddcc7", hover: "#f5e6d3" },
1365
- { primary: "#3e2723", secondary: "#5d4037", muted: "#a1887f" },
1366
- "#d7ccc8"
1367
- );
1368
- l(
1369
- "Vintage",
1370
- {
1371
- primary: "#8d6e63",
1372
- primaryHover: "#6d4c41",
1373
- success: "#66bb6a",
1374
- warning: "#ffb300",
1375
- error: "#e53935",
1376
- info: "#29b6f6"
1377
- },
1378
- { primary: "#efebe9", secondary: "#d7ccc8", tertiary: "#bcaaa4", hover: "#d7ccc8" },
1379
- { primary: "#3e2723", secondary: "#5d4037", muted: "#a1887f" },
1380
- "#bcaaa4"
1381
- );
1382
- A(
1383
- "Cyberpunk",
1384
- {
1385
- primary: "#00f0ff",
1386
- primaryHover: "#00c8d4",
1387
- success: "#39ff14",
1388
- warning: "#ffff00",
1389
- error: "#ff003c",
1390
- info: "#bf00ff"
1391
- },
1392
- { primary: "#0a0e17", secondary: "#131824", tertiary: "#1c2333", hover: "#1c2333" },
1393
- { primary: "#e0fbfc", secondary: "#80d4dd", muted: "#3a6b72" },
1394
- "#1c3a44"
1395
- );
1396
- A(
1397
- "Neon",
1398
- {
1399
- primary: "#ff00ff",
1400
- primaryHover: "#cc00cc",
1401
- success: "#00ff00",
1402
- warning: "#ffff00",
1403
- error: "#ff0000",
1404
- info: "#00ffff"
1405
- },
1406
- { primary: "#0d0d0d", secondary: "#1a1a1a", tertiary: "#262626", hover: "#262626" },
1407
- { primary: "#ffffff", secondary: "#cccccc", muted: "#666666" },
1408
- "#333333"
1409
- );
1410
- A(
1411
- "Retrowave",
1412
- {
1413
- primary: "#f77fbe",
1414
- primaryHover: "#e462a3",
1415
- success: "#72f1b8",
1416
- warning: "#ffe261",
1417
- error: "#ff4444",
1418
- info: "#79e8fb"
1419
- },
1420
- { primary: "#1b0a2e", secondary: "#261440", tertiary: "#321e52", hover: "#321e52" },
1421
- { primary: "#ffe6f7", secondary: "#c9a0c9", muted: "#6b4c7a" },
1422
- "#4a2d66"
1423
- );
1424
- l(
1425
- "Christmas",
1426
- {
1427
- primary: "#c41e3a",
1428
- primaryHover: "#a01830",
1429
- success: "#228b22",
1430
- warning: "#ffd700",
1431
- error: "#dc2626",
1432
- info: "#0891b2"
1433
- },
1434
- { primary: "#fef2f2", secondary: "#fde8e8", tertiary: "#f8d0d0", hover: "#fde8e8" },
1435
- { primary: "#3b0a0a", secondary: "#7f1d1d", muted: "#dc6868" },
1436
- "#e8a0a0"
1437
- );
1438
- A(
1439
- "Halloween",
1440
- {
1441
- primary: "#ff6600",
1442
- primaryHover: "#e05500",
1443
- success: "#4ade80",
1444
- warning: "#fbbf24",
1445
- error: "#ff0000",
1446
- info: "#9333ea"
1447
- },
1448
- { primary: "#1a0a00", secondary: "#2d1500", tertiary: "#402000", hover: "#402000" },
1449
- { primary: "#ffedd5", secondary: "#fdba74", muted: "#9a5c28" },
1450
- "#5c3400"
1451
- );
1452
- l(
1453
- "Valentine",
1454
- {
1455
- primary: "#e11d48",
1456
- primaryHover: "#be123c",
1457
- success: "#10b981",
1458
- warning: "#f59e0b",
1459
- error: "#dc2626",
1460
- info: "#ec4899"
1461
- },
1462
- { primary: "#fff1f2", secondary: "#ffe4e6", tertiary: "#fecdd3", hover: "#ffe4e6" },
1463
- { primary: "#4c0519", secondary: "#881337", muted: "#f9a8d4" },
1464
- "#fda4af"
1465
- );
1466
- l(
1467
- "Easter",
1468
- {
1469
- primary: "#a78bfa",
1470
- primaryHover: "#8b5cf6",
1471
- success: "#4ade80",
1472
- warning: "#fcd34d",
1473
- error: "#fb7185",
1474
- info: "#67e8f9"
1475
- },
1476
- { primary: "#fef9ff", secondary: "#f3e8ff", tertiary: "#e8d5ff", hover: "#f3e8ff" },
1477
- { primary: "#581c87", secondary: "#6d28d9", muted: "#c4b5fd" },
1478
- "#ddd6fe"
1479
- );
1480
- l(
1481
- "Summer Beach",
1482
- {
1483
- primary: "#0ea5e9",
1484
- primaryHover: "#0284c7",
1485
- success: "#10b981",
1486
- warning: "#f59e0b",
1487
- error: "#ef4444",
1488
- info: "#06b6d4"
1489
- },
1490
- { primary: "#fffbeb", secondary: "#fef3c7", tertiary: "#fde68a", hover: "#fef3c7" },
1491
- { primary: "#0c4a6e", secondary: "#0369a1", muted: "#7dd3fc" },
1492
- "#fcd34d"
1493
- );
1494
- l(
1495
- "Winter Frost",
1496
- {
1497
- primary: "#3b82f6",
1498
- primaryHover: "#2563eb",
1499
- success: "#10b981",
1500
- warning: "#f59e0b",
1501
- error: "#ef4444",
1502
- info: "#06b6d4"
1503
- },
1504
- { primary: "#f0f9ff", secondary: "#e0f2fe", tertiary: "#bae6fd", hover: "#e0f2fe" },
1505
- { primary: "#1e3a5f", secondary: "#1e40af", muted: "#93c5fd" },
1506
- "#bfdbfe"
1507
- );
1508
- l(
1509
- "Cherry Blossom",
1510
- {
1511
- primary: "#ec4899",
1512
- primaryHover: "#db2777",
1513
- success: "#10b981",
1514
- warning: "#f59e0b",
1515
- error: "#ef4444",
1516
- info: "#06b6d4"
1517
- },
1518
- { primary: "#fdf2f8", secondary: "#fce7f3", tertiary: "#fbcfe8", hover: "#fce7f3" },
1519
- { primary: "#831843", secondary: "#9d174d", muted: "#f9a8d4" },
1520
- "#fbcfe8"
1521
- );
1522
- l(
1523
- "Harvest",
1524
- {
1525
- primary: "#b45309",
1526
- primaryHover: "#92400e",
1527
- success: "#4d7c0f",
1528
- warning: "#a16207",
1529
- error: "#b91c1c",
1530
- info: "#0e7490"
1531
- },
1532
- { primary: "#fffbeb", secondary: "#fef3c7", tertiary: "#fde68a", hover: "#fef3c7" },
1533
- { primary: "#451a03", secondary: "#78350f", muted: "#d97706" },
1534
- "#fcd34d"
1535
- );
1536
- l(
1537
- "Japanese Zen",
1538
- {
1539
- primary: "#6b7280",
1540
- primaryHover: "#4b5563",
1541
- success: "#6b8e23",
1542
- warning: "#d4a017",
1543
- error: "#c0392b",
1544
- info: "#5f9ea0"
1545
- },
1546
- { primary: "#faf9f6", secondary: "#f0ece3", tertiary: "#e6e0d4", hover: "#f0ece3" },
1547
- { primary: "#2c2c2c", secondary: "#5c5c5c", muted: "#a0998a" },
1548
- "#d5cec0"
1549
- );
1550
- l(
1551
- "Moroccan",
1552
- {
1553
- primary: "#c2410c",
1554
- primaryHover: "#9a3412",
1555
- success: "#15803d",
1556
- warning: "#ca8a04",
1557
- error: "#b91c1c",
1558
- info: "#0e7490"
1559
- },
1560
- { primary: "#fffbf0", secondary: "#fef3e0", tertiary: "#fde6c4", hover: "#fef3e0" },
1561
- { primary: "#3a1a00", secondary: "#7c2d12", muted: "#d97706" },
1562
- "#f5d0a0"
1563
- );
1564
- l(
1565
- "Scandinavian",
1566
- {
1567
- primary: "#4b5563",
1568
- primaryHover: "#374151",
1569
- success: "#059669",
1570
- warning: "#d97706",
1571
- error: "#dc2626",
1572
- info: "#0891b2"
1573
- },
1574
- { primary: "#ffffff", secondary: "#f9fafb", tertiary: "#f3f4f6", hover: "#f3f4f6" },
1575
- { primary: "#111827", secondary: "#374151", muted: "#9ca3af" },
1576
- "#e5e7eb"
1577
- );
1578
- l(
1579
- "Mediterranean",
1580
- {
1581
- primary: "#1e40af",
1582
- primaryHover: "#1e3a8a",
1583
- success: "#059669",
1584
- warning: "#d97706",
1585
- error: "#dc2626",
1586
- info: "#0891b2"
1587
- },
1588
- { primary: "#eff6ff", secondary: "#dbeafe", tertiary: "#bfdbfe", hover: "#dbeafe" },
1589
- { primary: "#1e3a5f", secondary: "#2563eb", muted: "#93c5fd" },
1590
- "#bfdbfe"
1591
- );
1592
- l(
1593
- "Chinese New Year",
1594
- {
1595
- primary: "#dc2626",
1596
- primaryHover: "#b91c1c",
1597
- success: "#16a34a",
1598
- warning: "#d4a017",
1599
- error: "#ef4444",
1600
- info: "#0891b2"
1601
- },
1602
- { primary: "#fef2f2", secondary: "#fee2e2", tertiary: "#fecaca", hover: "#fee2e2" },
1603
- { primary: "#450a0a", secondary: "#991b1b", muted: "#f87171" },
1604
- "#fca5a5"
1605
- );
1606
- l(
1607
- "Indian Festive",
1608
- {
1609
- primary: "#d97706",
1610
- primaryHover: "#b45309",
1611
- success: "#16a34a",
1612
- warning: "#ca8a04",
1613
- error: "#dc2626",
1614
- info: "#7c3aed"
1615
- },
1616
- { primary: "#fffbeb", secondary: "#fef3c7", tertiary: "#fde68a", hover: "#fef3c7" },
1617
- { primary: "#451a03", secondary: "#92400e", muted: "#f59e0b" },
1618
- "#fcd34d"
1619
- );
1620
- l(
1621
- "Brazilian Carnival",
1622
- {
1623
- primary: "#16a34a",
1624
- primaryHover: "#15803d",
1625
- success: "#22c55e",
1626
- warning: "#facc15",
1627
- error: "#ef4444",
1628
- info: "#0ea5e9"
1629
- },
1630
- { primary: "#f0fdf4", secondary: "#dcfce7", tertiary: "#bbf7d0", hover: "#dcfce7" },
1631
- { primary: "#052e16", secondary: "#166534", muted: "#4ade80" },
1632
- "#86efac"
1633
- );
1634
- l(
1635
- "African Earth",
1636
- {
1637
- primary: "#92400e",
1638
- primaryHover: "#78350f",
1639
- success: "#4d7c0f",
1640
- warning: "#a16207",
1641
- error: "#b91c1c",
1642
- info: "#0e7490"
1643
- },
1644
- { primary: "#faf5f0", secondary: "#f0e6d6", tertiary: "#e6d5bb", hover: "#f0e6d6" },
1645
- { primary: "#2b1a0e", secondary: "#5c3d1e", muted: "#a08060" },
1646
- "#d4b896"
1647
- );
1648
- A(
1649
- "High Contrast Dark",
1650
- {
1651
- primary: "#ffff00",
1652
- primaryHover: "#cccc00",
1653
- success: "#00ff00",
1654
- warning: "#ff8c00",
1655
- error: "#ff0000",
1656
- info: "#00ffff"
1657
- },
1658
- { primary: "#000000", secondary: "#1a1a1a", tertiary: "#333333", hover: "#333333" },
1659
- { primary: "#ffffff", secondary: "#ffffff", muted: "#cccccc" },
1660
- "#ffffff"
1661
- );
1662
- l(
1663
- "Monochrome",
1664
- {
1665
- primary: "#404040",
1666
- primaryHover: "#262626",
1667
- success: "#4d7c0f",
1668
- warning: "#a16207",
1669
- error: "#b91c1c",
1670
- info: "#0e7490"
1671
- },
1672
- { primary: "#fafafa", secondary: "#f0f0f0", tertiary: "#e0e0e0", hover: "#e0e0e0" },
1673
- { primary: "#1a1a1a", secondary: "#404040", muted: "#808080" },
1674
- "#c0c0c0"
1675
- );
1676
- l(
1677
- "Enhanced Contrast",
1678
- {
1679
- primary: "#0050b3",
1680
- primaryHover: "#003d8c",
1681
- success: "#006400",
1682
- warning: "#cc7000",
1683
- error: "#cc0000",
1684
- info: "#006680"
1685
- },
1686
- { primary: "#ffffff", secondary: "#f5f5f5", tertiary: "#ebebeb", hover: "#ebebeb" },
1687
- { primary: "#000000", secondary: "#1a1a1a", muted: "#595959" },
1688
- "#8c8c8c"
1689
- );
1690
- l(
1691
- "Minimalist",
1692
- {
1693
- primary: "#18181b",
1694
- primaryHover: "#27272a",
1695
- success: "#22c55e",
1696
- warning: "#eab308",
1697
- error: "#ef4444",
1698
- info: "#3b82f6"
1699
- },
1700
- { primary: "#ffffff", secondary: "#fafafa", tertiary: "#f5f5f5", hover: "#f5f5f5" },
1701
- { primary: "#0a0a0a", secondary: "#404040", muted: "#a3a3a3" },
1702
- "#e5e5e5"
1703
- );
1704
- A(
1705
- "Warm Dark",
1706
- {
1707
- primary: "#f59e0b",
1708
- primaryHover: "#d97706",
1709
- success: "#10b981",
1710
- warning: "#fbbf24",
1711
- error: "#f87171",
1712
- info: "#38bdf8"
1713
- },
1714
- { primary: "#1c1917", secondary: "#292524", tertiary: "#44403c", hover: "#44403c" },
1715
- { primary: "#fafaf9", secondary: "#d6d3d1", muted: "#78716c" },
1716
- "#57534e"
1717
- );
1718
- A(
1719
- "Soft Dark",
1720
- {
1721
- primary: "#a78bfa",
1722
- primaryHover: "#8b5cf6",
1723
- success: "#34d399",
1724
- warning: "#fcd34d",
1725
- error: "#fb7185",
1726
- info: "#67e8f9"
1727
- },
1728
- { primary: "#1e1e2e", secondary: "#262637", tertiary: "#313147", hover: "#313147" },
1729
- { primary: "#e8e8f0", secondary: "#a0a0b8", muted: "#5c5c74" },
1730
- "#3e3e58"
1731
- );
1732
- l(
1733
- "Coffee",
1734
- {
1735
- primary: "#6f4e37",
1736
- primaryHover: "#5c3d28",
1737
- success: "#4d7c0f",
1738
- warning: "#a16207",
1739
- error: "#b91c1c",
1740
- info: "#0e7490"
1741
- },
1742
- { primary: "#faf6f1", secondary: "#f0e8dc", tertiary: "#e6d8c6", hover: "#f0e8dc" },
1743
- { primary: "#2c1a0e", secondary: "#5c3d28", muted: "#a08868" },
1744
- "#d4c4a8"
1745
- );
1746
- l(
1747
- "Wine",
1748
- {
1749
- primary: "#7f1d1d",
1750
- primaryHover: "#641717",
1751
- success: "#059669",
1752
- warning: "#d97706",
1753
- error: "#dc2626",
1754
- info: "#0891b2"
1755
- },
1756
- { primary: "#fef2f2", secondary: "#fde8e8", tertiary: "#f8d0d0", hover: "#fde8e8" },
1757
- { primary: "#3b0a0a", secondary: "#7f1d1d", muted: "#dc6868" },
1758
- "#e8a0a0"
1759
- );
1760
- M(null);
1761
- const Ve = [
1762
- {
1763
- target: ".nice-api-designer",
1764
- titleKey: "tutorial.apiDesigner.intro.title",
1765
- title: "API designer",
1766
- contentKey: "tutorial.apiDesigner.intro.content",
1767
- content: "Define endpoints, parameters, request/response schemas and security for your OpenAPI document.",
1768
- placement: "auto"
1769
- }
1770
- ], ze = {
1771
- openapi: "3.0.3",
1772
- info: {
1773
- title: "New API",
1774
- version: "1.0.0",
1775
- description: "API description"
1776
- },
1777
- paths: {},
1778
- components: {
1779
- schemas: {},
1780
- securitySchemes: {}
1781
- },
1782
- tags: []
1783
- }, Ne = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"];
1784
- function le(e) {
1785
- var i, n;
1786
- const a = [];
1787
- return e.openapi || a.push({ path: "openapi", message: "OpenAPI version is required", severity: "error" }), (i = e.info) != null && i.title || a.push({ path: "info.title", message: "API title is required", severity: "error" }), (n = e.info) != null && n.version || a.push({ path: "info.version", message: "API version is required", severity: "error" }), Object.entries(e.paths || {}).forEach(([s, u]) => {
1788
- s.startsWith("/") || a.push({ path: `paths.${s}`, message: "Path must start with /", severity: "error" }), Ne.forEach((f) => {
1789
- const y = u[f.toLowerCase()];
1790
- y && !y.responses && a.push({
1791
- path: `paths.${s}.${f.toLowerCase()}.responses`,
1792
- message: "Responses are required",
1793
- severity: "error"
1794
- });
1795
- });
1796
- }), a;
1797
- }
1798
- function _r({
1799
- schema: e,
1800
- onChange: a,
1801
- onSave: i,
1802
- readOnly: n = !1,
1803
- className: s = "",
1804
- tutorial: u
1805
- }) {
1806
- var O, q;
1807
- const [f, y] = g(e || ze), [b, d] = g(null), [v, k] = g(null), [m, T] = g("info"), [_, I] = g([]), H = P(
1808
- (w) => {
1809
- y((x) => {
1810
- const S = w(x);
1811
- return a == null || a(S), I(le(S)), S;
1812
- });
1813
- },
1814
- [a]
1815
- ), K = P(() => {
1816
- const w = "/new-endpoint";
1817
- H((x) => ({
1818
- ...x,
1819
- paths: {
1820
- ...x.paths,
1821
- [w]: {
1822
- get: {
1823
- summary: "New endpoint",
1824
- responses: { 200: { description: "Success" } }
1825
- }
1826
- }
1827
- }
1828
- })), d(w), k("get");
1829
- }, [H]), j = P(
1830
- (w) => {
1831
- H((x) => {
1832
- const { [w]: S, ...B } = x.paths;
1833
- return { ...x, paths: B };
1834
- }), d(null), k(null);
1835
- },
1836
- [H]
1837
- ), G = P(() => {
1838
- const w = "NewSchema";
1839
- H((x) => {
1840
- var S;
1841
- return {
1842
- ...x,
1843
- components: {
1844
- ...x.components,
1845
- schemas: {
1846
- ...(S = x.components) == null ? void 0 : S.schemas,
1847
- [w]: { type: "object", properties: {} }
1848
- }
1849
- }
1850
- };
1851
- });
1852
- }, [H]), $ = P(() => {
1853
- const w = le(f);
1854
- I(w), w.filter((x) => x.severity === "error").length === 0 && (i == null || i(f));
1855
- }, [f, i]), U = Object.entries(f.paths).flatMap(
1856
- ([w, x]) => Ne.filter((S) => x[S.toLowerCase()]).map(
1857
- (S) => ({
1858
- path: w,
1859
- method: S,
1860
- operation: x[S.toLowerCase()]
1861
- })
1862
- )
1863
- );
1864
- return /* @__PURE__ */ t("div", { className: `nice-api-designer ${s}`, style: { position: "relative" }, children: [
1865
- u && /* @__PURE__ */ r("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ r(re, { steps: ee(u, Ve) }) }),
1866
- /* @__PURE__ */ t("div", { className: "nice-api-designer__toolbar", children: [
1867
- /* @__PURE__ */ r("div", { className: "nice-api-designer__tabs", children: ["info", "paths", "schemas", "security", "preview"].map((w) => /* @__PURE__ */ r(
1868
- "button",
1869
- {
1870
- className: `nice-api-designer__tab ${m === w ? "nice-api-designer__tab--active" : ""}`,
1871
- onClick: () => T(w),
1872
- children: w.charAt(0).toUpperCase() + w.slice(1)
1873
- },
1874
- w
1875
- )) }),
1876
- !n && /* @__PURE__ */ r("button", { className: "nice-api-designer__save-btn", onClick: $, children: "Save" })
1877
- ] }),
1878
- _.length > 0 && /* @__PURE__ */ r("div", { className: "nice-api-designer__errors", children: _.map((w, x) => /* @__PURE__ */ t(
1879
- "div",
1880
- {
1881
- className: `nice-api-designer__error nice-api-designer__error--${w.severity}`,
1882
- children: [
1883
- /* @__PURE__ */ t("strong", { children: [
1884
- w.path,
1885
- ":"
1886
- ] }),
1887
- " ",
1888
- w.message
1889
- ]
1890
- },
1891
- x
1892
- )) }),
1893
- /* @__PURE__ */ t("div", { className: "nice-api-designer__content", children: [
1894
- m === "info" && /* @__PURE__ */ r(Fe, { schema: f, onChange: H, readOnly: n }),
1895
- m === "paths" && /* @__PURE__ */ r(
1896
- We,
1897
- {
1898
- endpoints: U,
1899
- schema: f,
1900
- selectedPath: b,
1901
- selectedMethod: v,
1902
- onSelectEndpoint: (w, x) => {
1903
- d(w), k(x);
1904
- },
1905
- onAdd: K,
1906
- onDelete: j,
1907
- onChange: H,
1908
- readOnly: n
1909
- }
1910
- ),
1911
- m === "schemas" && /* @__PURE__ */ r(
1912
- Je,
1913
- {
1914
- schemas: ((O = f.components) == null ? void 0 : O.schemas) || {},
1915
- onAdd: G,
1916
- onChange: (w) => H((x) => ({
1917
- ...x,
1918
- components: { ...x.components, schemas: w }
1919
- })),
1920
- readOnly: n
1921
- }
1922
- ),
1923
- m === "security" && /* @__PURE__ */ r(
1924
- Ge,
1925
- {
1926
- schemes: ((q = f.components) == null ? void 0 : q.securitySchemes) || {},
1927
- onChange: (w) => H((x) => ({
1928
- ...x,
1929
- components: { ...x.components, securitySchemes: w }
1930
- })),
1931
- readOnly: n
1932
- }
1933
- ),
1934
- m === "preview" && /* @__PURE__ */ r(Xe, { schema: f })
1935
- ] })
1936
- ] });
1937
- }
1938
- function Fe({ schema: e, onChange: a, readOnly: i }) {
1939
- return /* @__PURE__ */ t("div", { className: "nice-api-designer__info-editor", children: [
1940
- /* @__PURE__ */ r("h3", { children: "API Information" }),
1941
- /* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
1942
- /* @__PURE__ */ r("label", { children: "Title" }),
1943
- /* @__PURE__ */ r(
1944
- "input",
1945
- {
1946
- type: "text",
1947
- value: e.info.title,
1948
- onChange: (n) => a((s) => ({
1949
- ...s,
1950
- info: { ...s.info, title: n.target.value }
1951
- })),
1952
- disabled: i
1953
- }
1954
- )
1955
- ] }),
1956
- /* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
1957
- /* @__PURE__ */ r("label", { children: "Version" }),
1958
- /* @__PURE__ */ r(
1959
- "input",
1960
- {
1961
- type: "text",
1962
- value: e.info.version,
1963
- onChange: (n) => a((s) => ({
1964
- ...s,
1965
- info: { ...s.info, version: n.target.value }
1966
- })),
1967
- disabled: i
1968
- }
1969
- )
1970
- ] }),
1971
- /* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
1972
- /* @__PURE__ */ r("label", { children: "Description" }),
1973
- /* @__PURE__ */ r(
1974
- "textarea",
1975
- {
1976
- value: e.info.description || "",
1977
- onChange: (n) => a((s) => ({
1978
- ...s,
1979
- info: { ...s.info, description: n.target.value }
1980
- })),
1981
- disabled: i,
1982
- rows: 5
1983
- }
1984
- )
1985
- ] }),
1986
- /* @__PURE__ */ r("h4", { children: "Servers" }),
1987
- (e.servers || []).map((n, s) => /* @__PURE__ */ t("div", { className: "nice-api-designer__server", children: [
1988
- /* @__PURE__ */ r(
1989
- "input",
1990
- {
1991
- type: "text",
1992
- value: n.url,
1993
- placeholder: "Server URL",
1994
- onChange: (u) => a((f) => {
1995
- var y;
1996
- return {
1997
- ...f,
1998
- servers: (y = f.servers) == null ? void 0 : y.map(
1999
- (b, d) => d === s ? { ...b, url: u.target.value } : b
2000
- )
2001
- };
2002
- }),
2003
- disabled: i
2004
- }
2005
- ),
2006
- /* @__PURE__ */ r(
2007
- "input",
2008
- {
2009
- type: "text",
2010
- value: n.description || "",
2011
- placeholder: "Description",
2012
- onChange: (u) => a((f) => {
2013
- var y;
2014
- return {
2015
- ...f,
2016
- servers: (y = f.servers) == null ? void 0 : y.map(
2017
- (b, d) => d === s ? { ...b, description: u.target.value } : b
2018
- )
2019
- };
2020
- }),
2021
- disabled: i
2022
- }
2023
- )
2024
- ] }, s)),
2025
- !i && /* @__PURE__ */ r(
2026
- "button",
2027
- {
2028
- onClick: () => a((n) => ({
2029
- ...n,
2030
- servers: [...n.servers || [], { url: "https://api.example.com" }]
2031
- })),
2032
- children: "Add Server"
2033
- }
2034
- )
2035
- ] });
2036
- }
2037
- function We({
2038
- endpoints: e,
2039
- schema: a,
2040
- selectedPath: i,
2041
- selectedMethod: n,
2042
- onSelectEndpoint: s,
2043
- onAdd: u,
2044
- onDelete: f,
2045
- onChange: y,
2046
- readOnly: b
2047
- }) {
2048
- var v;
2049
- const d = i && n ? (v = a.paths[i]) == null ? void 0 : v[n] : null;
2050
- return /* @__PURE__ */ t("div", { className: "nice-api-designer__paths-editor", children: [
2051
- /* @__PURE__ */ t("div", { className: "nice-api-designer__endpoints-list", children: [
2052
- /* @__PURE__ */ t("div", { className: "nice-api-designer__list-header", children: [
2053
- /* @__PURE__ */ r("h3", { children: "Endpoints" }),
2054
- !b && /* @__PURE__ */ r("button", { onClick: u, children: "+ Add" })
2055
- ] }),
2056
- e.map(({ path: k, method: m }) => /* @__PURE__ */ t(
2057
- "div",
2058
- {
2059
- className: `nice-api-designer__endpoint ${i === k && n === m.toLowerCase() ? "nice-api-designer__endpoint--selected" : ""}`,
2060
- onClick: () => s(k, m.toLowerCase()),
2061
- children: [
2062
- /* @__PURE__ */ r(
2063
- "span",
2064
- {
2065
- className: `nice-api-designer__method nice-api-designer__method--${m.toLowerCase()}`,
2066
- children: m
2067
- }
2068
- ),
2069
- /* @__PURE__ */ r("span", { className: "nice-api-designer__path", children: k })
2070
- ]
2071
- },
2072
- `${m}-${k}`
2073
- ))
2074
- ] }),
2075
- d && i && n && /* @__PURE__ */ t("div", { className: "nice-api-designer__operation-editor", children: [
2076
- /* @__PURE__ */ t("h3", { children: [
2077
- n.toUpperCase(),
2078
- " ",
2079
- i
2080
- ] }),
2081
- /* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
2082
- /* @__PURE__ */ r("label", { children: "Summary" }),
2083
- /* @__PURE__ */ r(
2084
- "input",
2085
- {
2086
- type: "text",
2087
- value: d.summary || "",
2088
- onChange: (k) => y((m) => ({
2089
- ...m,
2090
- paths: {
2091
- ...m.paths,
2092
- [i]: {
2093
- ...m.paths[i],
2094
- [n]: {
2095
- ...d,
2096
- summary: k.target.value
2097
- }
2098
- }
2099
- }
2100
- })),
2101
- disabled: b
2102
- }
2103
- )
2104
- ] }),
2105
- /* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
2106
- /* @__PURE__ */ r("label", { children: "Description" }),
2107
- /* @__PURE__ */ r(
2108
- "textarea",
2109
- {
2110
- value: d.description || "",
2111
- onChange: (k) => y((m) => ({
2112
- ...m,
2113
- paths: {
2114
- ...m.paths,
2115
- [i]: {
2116
- ...m.paths[i],
2117
- [n]: {
2118
- ...d,
2119
- description: k.target.value
2120
- }
2121
- }
2122
- }
2123
- })),
2124
- disabled: b,
2125
- rows: 3
2126
- }
2127
- )
2128
- ] }),
2129
- /* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
2130
- /* @__PURE__ */ r("label", { children: "Operation ID" }),
2131
- /* @__PURE__ */ r(
2132
- "input",
2133
- {
2134
- type: "text",
2135
- value: d.operationId || "",
2136
- onChange: (k) => y((m) => ({
2137
- ...m,
2138
- paths: {
2139
- ...m.paths,
2140
- [i]: {
2141
- ...m.paths[i],
2142
- [n]: {
2143
- ...d,
2144
- operationId: k.target.value
2145
- }
2146
- }
2147
- }
2148
- })),
2149
- disabled: b
2150
- }
2151
- )
2152
- ] }),
2153
- !b && /* @__PURE__ */ r(
2154
- "button",
2155
- {
2156
- className: "nice-api-designer__delete-btn",
2157
- onClick: () => f(i),
2158
- children: "Delete Endpoint"
2159
- }
2160
- )
2161
- ] })
2162
- ] });
2163
- }
2164
- function Je({
2165
- schemas: e,
2166
- onAdd: a,
2167
- onChange: i,
2168
- readOnly: n
2169
- }) {
2170
- const [s, u] = g(null);
2171
- return /* @__PURE__ */ t("div", { className: "nice-api-designer__schemas-editor", children: [
2172
- /* @__PURE__ */ t("div", { className: "nice-api-designer__schemas-list", children: [
2173
- /* @__PURE__ */ t("div", { className: "nice-api-designer__list-header", children: [
2174
- /* @__PURE__ */ r("h3", { children: "Schemas" }),
2175
- !n && /* @__PURE__ */ r("button", { onClick: a, children: "+ Add" })
2176
- ] }),
2177
- Object.keys(e).map((f) => /* @__PURE__ */ r(
2178
- "div",
2179
- {
2180
- className: `nice-api-designer__schema-item ${s === f ? "nice-api-designer__schema-item--selected" : ""}`,
2181
- onClick: () => u(f),
2182
- children: f
2183
- },
2184
- f
2185
- ))
2186
- ] }),
2187
- s && e[s] && /* @__PURE__ */ t("div", { className: "nice-api-designer__schema-editor", children: [
2188
- /* @__PURE__ */ r("h3", { children: s }),
2189
- /* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
2190
- /* @__PURE__ */ r("label", { children: "Type" }),
2191
- /* @__PURE__ */ t(
2192
- "select",
2193
- {
2194
- value: e[s].type || "object",
2195
- onChange: (f) => i({
2196
- ...e,
2197
- [s]: {
2198
- ...e[s],
2199
- type: f.target.value
2200
- }
2201
- }),
2202
- disabled: n,
2203
- children: [
2204
- /* @__PURE__ */ r("option", { value: "object", children: "object" }),
2205
- /* @__PURE__ */ r("option", { value: "array", children: "array" }),
2206
- /* @__PURE__ */ r("option", { value: "string", children: "string" }),
2207
- /* @__PURE__ */ r("option", { value: "number", children: "number" }),
2208
- /* @__PURE__ */ r("option", { value: "integer", children: "integer" }),
2209
- /* @__PURE__ */ r("option", { value: "boolean", children: "boolean" })
2210
- ]
2211
- }
2212
- )
2213
- ] }),
2214
- /* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
2215
- /* @__PURE__ */ r("label", { children: "Description" }),
2216
- /* @__PURE__ */ r(
2217
- "textarea",
2218
- {
2219
- value: e[s].description || "",
2220
- onChange: (f) => i({
2221
- ...e,
2222
- [s]: { ...e[s], description: f.target.value }
2223
- }),
2224
- disabled: n,
2225
- rows: 3
2226
- }
2227
- )
2228
- ] }),
2229
- /* @__PURE__ */ t("div", { className: "nice-api-designer__field", children: [
2230
- /* @__PURE__ */ r("label", { children: "JSON Schema" }),
2231
- /* @__PURE__ */ r(
2232
- "textarea",
2233
- {
2234
- value: JSON.stringify(e[s], null, 2),
2235
- onChange: (f) => {
2236
- try {
2237
- const y = JSON.parse(f.target.value);
2238
- i({ ...e, [s]: y });
2239
- } catch {
2240
- }
2241
- },
2242
- disabled: n,
2243
- rows: 10,
2244
- className: "nice-api-designer__code"
2245
- }
2246
- )
2247
- ] })
2248
- ] })
2249
- ] });
2250
- }
2251
- function Ge({ schemes: e, onChange: a, readOnly: i }) {
2252
- return /* @__PURE__ */ t("div", { className: "nice-api-designer__security-editor", children: [
2253
- /* @__PURE__ */ t("div", { className: "nice-api-designer__list-header", children: [
2254
- /* @__PURE__ */ r("h3", { children: "Security Schemes" }),
2255
- !i && /* @__PURE__ */ r("button", { onClick: () => {
2256
- a({
2257
- ...e,
2258
- newScheme: { type: "apiKey", name: "X-API-Key", in: "header" }
2259
- });
2260
- }, children: "+ Add" })
2261
- ] }),
2262
- Object.entries(e).map(([s, u]) => /* @__PURE__ */ t("div", { className: "nice-api-designer__security-item", children: [
2263
- /* @__PURE__ */ r("h4", { children: s }),
2264
- /* @__PURE__ */ r("pre", { children: JSON.stringify(u, null, 2) })
2265
- ] }, s))
2266
- ] });
2267
- }
2268
- function Xe({ schema: e }) {
2269
- return /* @__PURE__ */ t("div", { className: "nice-api-designer__json-preview", children: [
2270
- /* @__PURE__ */ r("h3", { children: "OpenAPI Specification" }),
2271
- /* @__PURE__ */ r("pre", { className: "nice-api-designer__code", children: JSON.stringify(e, null, 2) })
2272
- ] });
2273
- }
2274
- const Ye = [
2275
- {
2276
- target: ".nice-api-tester",
2277
- titleKey: "tutorial.apiTester.intro.title",
2278
- title: "API tester",
2279
- contentKey: "tutorial.apiTester.intro.content",
2280
- content: "Build requests with collections and environment variables, send them and assert on the responses.",
2281
- placement: "auto"
2282
- }
2283
- ], Qe = ["GET", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "HEAD"], Ze = {
2284
- id: "",
2285
- name: "New Request",
2286
- method: "GET",
2287
- url: "",
2288
- headers: {},
2289
- queryParams: {}
2290
- };
2291
- function ne(e, a) {
2292
- return e.replace(/\{\{(\w+)\}\}/g, (i, n) => a[n] || `{{${n}}}`);
2293
- }
2294
- function er(e, a) {
2295
- const i = Object.entries(a).filter(([, n]) => n).map(([n, s]) => `${encodeURIComponent(n)}=${encodeURIComponent(s)}`).join("&");
2296
- return i ? `${e}?${i}` : e;
2297
- }
2298
- function wr({
2299
- collections: e = [],
2300
- environments: a = [],
2301
- onRequest: i,
2302
- onSaveCollection: n,
2303
- className: s = "",
2304
- tutorial: u
2305
- }) {
2306
- const [f, y] = g(e), [b, d] = g(a), [v, k] = g(
2307
- a.find((c) => c.isActive) || null
2308
- ), [m, T] = g({
2309
- ...Ze,
2310
- id: crypto.randomUUID()
2311
- }), [_, I] = g(null), [H, K] = g(!1), [j, G] = g("none"), [$, U] = g(
2312
- "params"
2313
- ), [O, q] = g("body"), [w, x] = g(""), [S, B] = g(""), [V, z] = g([]), [L, X] = g([]), F = se(null), Q = P(async () => {
2314
- var D;
2315
- if (!m.url)
2316
- return;
2317
- K(!0), I(null), z([]);
2318
- const c = Object.fromEntries(
2319
- Object.entries((v == null ? void 0 : v.variables) || {}).map(([E, R]) => [E, R.value])
2320
- ), o = {
2321
- ...m,
2322
- url: ne(m.url, c),
2323
- headers: Object.fromEntries(
2324
- Object.entries(m.headers).map(([E, R]) => [E, ne(R, c)])
2325
- ),
2326
- queryParams: Object.fromEntries(
2327
- Object.entries(m.queryParams).map(([E, R]) => [
2328
- E,
2329
- ne(R, c)
2330
- ])
2331
- )
2332
- }, N = performance.now();
2333
- try {
2334
- let E;
2335
- if (i)
2336
- E = await i(o);
2337
- else {
2338
- F.current = new AbortController();
2339
- const R = { ...o.headers };
2340
- m.auth && rr(R, m.auth);
2341
- const Se = er(o.url, o.queryParams), oe = {
2342
- method: o.method,
2343
- headers: R,
2344
- signal: F.current.signal
2345
- };
2346
- ["POST", "PUT", "PATCH"].includes(o.method) && ((D = m.body) != null && D.content) && (oe.body = typeof m.body.content == "string" ? m.body.content : JSON.stringify(m.body.content), m.body.type === "json" && (R["Content-Type"] = "application/json"));
2347
- const Z = await fetch(Se, oe), ae = await Z.text();
2348
- let ie;
2349
- try {
2350
- ie = JSON.parse(ae);
2351
- } catch {
2352
- ie = ae;
2353
- }
2354
- const Ce = performance.now();
2355
- E = {
2356
- status: Z.status,
2357
- statusText: Z.statusText,
2358
- headers: Object.fromEntries(Z.headers.entries()),
2359
- body: ie,
2360
- time: Math.round(Ce - N),
2361
- size: new Blob([ae]).size,
2362
- timestamp: /* @__PURE__ */ new Date()
2363
- };
2364
- }
2365
- if (I(E), X(
2366
- (R) => [...R, { request: m, response: E }].slice(-50)
2367
- ), S) {
2368
- const R = ir(S, E);
2369
- z(R);
2370
- }
2371
- } catch (E) {
2372
- E.name !== "AbortError" && I({
2373
- status: 0,
2374
- statusText: "Error",
2375
- headers: {},
2376
- body: { error: E.message },
2377
- time: Math.round(performance.now() - N),
2378
- size: 0,
2379
- timestamp: /* @__PURE__ */ new Date()
2380
- });
2381
- } finally {
2382
- K(!1), F.current = null;
2383
- }
2384
- }, [m, v, i, S]), Y = P(() => {
2385
- var c;
2386
- (c = F.current) == null || c.abort(), K(!1);
2387
- }, []), p = P(() => {
2388
- T((c) => ({
2389
- ...c,
2390
- headers: { ...c.headers, "": "" }
2391
- }));
2392
- }, []), h = P(() => {
2393
- T((c) => ({
2394
- ...c,
2395
- queryParams: { ...c.queryParams, "": "" }
2396
- }));
2397
- }, []), C = P(() => {
2398
- if (f.length === 0) {
2399
- const c = {
2400
- id: crypto.randomUUID(),
2401
- name: "My Collection",
2402
- requests: [m]
2403
- };
2404
- y([c]), n == null || n(c);
2405
- } else {
2406
- const c = {
2407
- ...f[0],
2408
- requests: [...f[0].requests, m]
2409
- };
2410
- y((o) => [c, ...o.slice(1)]), n == null || n(c);
2411
- }
2412
- }, [f, m, n]);
2413
- return /* @__PURE__ */ t("div", { className: `nice-api-tester ${s}`, style: { position: "relative" }, children: [
2414
- u && /* @__PURE__ */ r("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ r(re, { steps: ee(u, Ye) }) }),
2415
- /* @__PURE__ */ r("div", { className: "nice-api-tester__toolbar", children: /* @__PURE__ */ r("div", { className: "nice-api-tester__env-selector", children: /* @__PURE__ */ t(
2416
- "select",
2417
- {
2418
- value: (v == null ? void 0 : v.id) || "",
2419
- onChange: (c) => k(b.find((o) => o.id === c.target.value) || null),
2420
- children: [
2421
- /* @__PURE__ */ r("option", { value: "", children: "No Environment" }),
2422
- b.map((c) => /* @__PURE__ */ r("option", { value: c.id, children: c.name }, c.id))
2423
- ]
2424
- }
2425
- ) }) }),
2426
- /* @__PURE__ */ t("div", { className: "nice-api-tester__request-bar", children: [
2427
- /* @__PURE__ */ r(
2428
- "select",
2429
- {
2430
- value: m.method,
2431
- onChange: (c) => T((o) => ({
2432
- ...o,
2433
- method: c.target.value
2434
- })),
2435
- className: `nice-api-tester__method nice-api-tester__method--${m.method.toLowerCase()}`,
2436
- children: Qe.map((c) => /* @__PURE__ */ r("option", { value: c, children: c }, c))
2437
- }
2438
- ),
2439
- /* @__PURE__ */ r(
2440
- "input",
2441
- {
2442
- type: "text",
2443
- value: m.url,
2444
- onChange: (c) => T((o) => ({ ...o, url: c.target.value })),
2445
- placeholder: "Enter request URL",
2446
- className: "nice-api-tester__url-input"
2447
- }
2448
- ),
2449
- /* @__PURE__ */ r(
2450
- "button",
2451
- {
2452
- onClick: H ? Y : Q,
2453
- className: `nice-api-tester__send-btn ${H ? "nice-api-tester__send-btn--loading" : ""}`,
2454
- children: H ? "Cancel" : "Send"
2455
- }
2456
- ),
2457
- /* @__PURE__ */ r("button", { onClick: C, className: "nice-api-tester__save-btn", children: "Save" })
2458
- ] }),
2459
- /* @__PURE__ */ t("div", { className: "nice-api-tester__main", children: [
2460
- /* @__PURE__ */ t("div", { className: "nice-api-tester__request-panel", children: [
2461
- /* @__PURE__ */ r("div", { className: "nice-api-tester__tabs", children: ["params", "headers", "body", "auth", "tests"].map((c) => /* @__PURE__ */ r(
2462
- "button",
2463
- {
2464
- className: `nice-api-tester__tab ${$ === c ? "nice-api-tester__tab--active" : ""}`,
2465
- onClick: () => U(c),
2466
- children: c.charAt(0).toUpperCase() + c.slice(1)
2467
- },
2468
- c
2469
- )) }),
2470
- /* @__PURE__ */ t("div", { className: "nice-api-tester__tab-content", children: [
2471
- $ === "params" && /* @__PURE__ */ r(
2472
- nr,
2473
- {
2474
- params: m.queryParams,
2475
- onChange: (c) => T((o) => ({ ...o, queryParams: c })),
2476
- onAdd: h
2477
- }
2478
- ),
2479
- $ === "headers" && /* @__PURE__ */ r(
2480
- tr,
2481
- {
2482
- headers: m.headers,
2483
- onChange: (c) => T((o) => ({ ...o, headers: c })),
2484
- onAdd: p
2485
- }
2486
- ),
2487
- $ === "body" && /* @__PURE__ */ r(
2488
- sr,
2489
- {
2490
- body: m.body,
2491
- bodyTab: j,
2492
- onBodyTabChange: G,
2493
- onChange: (c) => T((o) => ({ ...o, body: c }))
2494
- }
2495
- ),
2496
- $ === "auth" && /* @__PURE__ */ r(
2497
- cr,
2498
- {
2499
- auth: m.auth,
2500
- onChange: (c) => T((o) => ({ ...o, auth: c }))
2501
- }
2502
- ),
2503
- $ === "tests" && /* @__PURE__ */ r(
2504
- or,
2505
- {
2506
- preRequestScript: w,
2507
- testScript: S,
2508
- onPreRequestChange: x,
2509
- onTestChange: B
2510
- }
2511
- )
2512
- ] })
2513
- ] }),
2514
- /* @__PURE__ */ r("div", { className: "nice-api-tester__response-panel", children: _ ? /* @__PURE__ */ t(J, { children: [
2515
- /* @__PURE__ */ t("div", { className: "nice-api-tester__response-meta", children: [
2516
- /* @__PURE__ */ t(
2517
- "span",
2518
- {
2519
- className: `nice-api-tester__status nice-api-tester__status--${Math.floor(_.status / 100)}`,
2520
- children: [
2521
- _.status,
2522
- " ",
2523
- _.statusText
2524
- ]
2525
- }
2526
- ),
2527
- /* @__PURE__ */ t("span", { className: "nice-api-tester__time", children: [
2528
- _.time,
2529
- "ms"
2530
- ] }),
2531
- /* @__PURE__ */ r("span", { className: "nice-api-tester__size", children: ar(_.size) })
2532
- ] }),
2533
- /* @__PURE__ */ r("div", { className: "nice-api-tester__tabs", children: ["body", "headers", "tests"].map((c) => /* @__PURE__ */ t(
2534
- "button",
2535
- {
2536
- className: `nice-api-tester__tab ${O === c ? "nice-api-tester__tab--active" : ""}`,
2537
- onClick: () => q(c),
2538
- children: [
2539
- c.charAt(0).toUpperCase() + c.slice(1),
2540
- c === "tests" && V.length > 0 && /* @__PURE__ */ t("span", { className: "nice-api-tester__test-badge", children: [
2541
- V.filter((o) => o.passed).length,
2542
- "/",
2543
- V.length
2544
- ] })
2545
- ]
2546
- },
2547
- c
2548
- )) }),
2549
- /* @__PURE__ */ t("div", { className: "nice-api-tester__response-content", children: [
2550
- O === "body" && /* @__PURE__ */ r("pre", { className: "nice-api-tester__response-body", children: typeof _.body == "string" ? _.body : JSON.stringify(_.body, null, 2) }),
2551
- O === "headers" && /* @__PURE__ */ r("div", { className: "nice-api-tester__response-headers", children: Object.entries(_.headers).map(([c, o]) => /* @__PURE__ */ t("div", { className: "nice-api-tester__header-row", children: [
2552
- /* @__PURE__ */ r("span", { className: "nice-api-tester__header-key", children: c }),
2553
- /* @__PURE__ */ r("span", { className: "nice-api-tester__header-value", children: o })
2554
- ] }, c)) }),
2555
- O === "tests" && /* @__PURE__ */ r("div", { className: "nice-api-tester__test-results", children: V.map((c, o) => /* @__PURE__ */ t(
2556
- "div",
2557
- {
2558
- className: `nice-api-tester__test-result nice-api-tester__test-result--${c.passed ? "pass" : "fail"}`,
2559
- children: [
2560
- /* @__PURE__ */ r("span", { className: "nice-api-tester__test-icon", children: c.passed ? "✓" : "✗" }),
2561
- /* @__PURE__ */ r("span", { className: "nice-api-tester__test-name", children: c.name }),
2562
- c.message && /* @__PURE__ */ r("span", { className: "nice-api-tester__test-message", children: c.message })
2563
- ]
2564
- },
2565
- o
2566
- )) })
2567
- ] })
2568
- ] }) : /* @__PURE__ */ r("div", { className: "nice-api-tester__empty-response", children: H ? "Loading..." : "Send a request to see the response" }) })
2569
- ] }),
2570
- L.length > 0 && /* @__PURE__ */ t("div", { className: "nice-api-tester__history", children: [
2571
- /* @__PURE__ */ r("h4", { children: "History" }),
2572
- /* @__PURE__ */ r("div", { className: "nice-api-tester__history-list", children: L.slice().reverse().map(({ request: c, response: o }, N) => /* @__PURE__ */ t(
2573
- "div",
2574
- {
2575
- className: "nice-api-tester__history-item",
2576
- onClick: () => T(c),
2577
- children: [
2578
- /* @__PURE__ */ r(
2579
- "span",
2580
- {
2581
- className: `nice-api-tester__method nice-api-tester__method--${c.method.toLowerCase()}`,
2582
- children: c.method
2583
- }
2584
- ),
2585
- /* @__PURE__ */ r("span", { className: "nice-api-tester__history-url", children: c.url }),
2586
- /* @__PURE__ */ r(
2587
- "span",
2588
- {
2589
- className: `nice-api-tester__status nice-api-tester__status--${Math.floor(
2590
- o.status / 100
2591
- )}`,
2592
- children: o.status
2593
- }
2594
- )
2595
- ]
2596
- },
2597
- N
2598
- )) })
2599
- ] })
2600
- ] });
2601
- }
2602
- function rr(e, a) {
2603
- var i, n, s, u, f;
2604
- switch (a.type) {
2605
- case "bearer":
2606
- e.Authorization = `${((i = a.bearer) == null ? void 0 : i.prefix) || "Bearer"} ${(n = a.bearer) == null ? void 0 : n.token}`;
2607
- break;
2608
- case "basic":
2609
- e.Authorization = `Basic ${btoa(`${(s = a.basic) == null ? void 0 : s.username}:${(u = a.basic) == null ? void 0 : u.password}`)}`;
2610
- break;
2611
- case "api-key":
2612
- ((f = a.apiKey) == null ? void 0 : f.in) === "header" && (e[a.apiKey.key] = a.apiKey.value);
2613
- break;
2614
- }
2615
- }
2616
- function ar(e) {
2617
- return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(1)} MB`;
2618
- }
2619
- function ir(e, a) {
2620
- const i = [], n = {
2621
- response: {
2622
- code: a.status,
2623
- status: a.statusText,
2624
- headers: a.headers,
2625
- json: () => a.body,
2626
- text: () => typeof a.body == "string" ? a.body : JSON.stringify(a.body),
2627
- responseTime: a.time
2628
- },
2629
- test: (s, u) => {
2630
- const f = performance.now();
2631
- try {
2632
- u(), i.push({ name: s, passed: !0, duration: performance.now() - f });
2633
- } catch (y) {
2634
- i.push({
2635
- name: s,
2636
- passed: !1,
2637
- message: y.message,
2638
- duration: performance.now() - f
2639
- });
2640
- }
2641
- },
2642
- expect: (s) => ({
2643
- to: {
2644
- equal: (u) => {
2645
- if (s !== u)
2646
- throw new Error(`Expected ${u} but got ${s}`);
2647
- },
2648
- be: {
2649
- oneOf: (u) => {
2650
- if (!u.includes(s))
2651
- throw new Error(`Expected ${s} to be one of ${u}`);
2652
- }
2653
- },
2654
- have: {
2655
- property: (u) => {
2656
- if (typeof s != "object" || s === null || !(u in s))
2657
- throw new Error(`Expected object to have property ${u}`);
2658
- }
2659
- }
2660
- }
2661
- })
2662
- };
2663
- try {
2664
- new Function("pm", e)(n);
2665
- } catch (s) {
2666
- i.push({
2667
- name: "Script Error",
2668
- passed: !1,
2669
- message: s.message,
2670
- duration: 0
2671
- });
2672
- }
2673
- return i;
2674
- }
2675
- function xe({
2676
- items: e,
2677
- onChange: a,
2678
- onAdd: i,
2679
- keyPlaceholder: n = "Key",
2680
- valuePlaceholder: s = "Value"
2681
- }) {
2682
- return /* @__PURE__ */ t("div", { className: "nice-api-tester__kv-editor", children: [
2683
- Object.entries(e).map(([u, f], y) => /* @__PURE__ */ t("div", { className: "nice-api-tester__kv-row", children: [
2684
- /* @__PURE__ */ r(
2685
- "input",
2686
- {
2687
- type: "text",
2688
- value: u,
2689
- placeholder: n,
2690
- onChange: (b) => {
2691
- const d = Object.entries(e);
2692
- d[y] = [b.target.value, f], a(Object.fromEntries(d));
2693
- }
2694
- }
2695
- ),
2696
- /* @__PURE__ */ r(
2697
- "input",
2698
- {
2699
- type: "text",
2700
- value: f,
2701
- placeholder: s,
2702
- onChange: (b) => a({ ...e, [u]: b.target.value })
2703
- }
2704
- ),
2705
- /* @__PURE__ */ r(
2706
- "button",
2707
- {
2708
- onClick: () => {
2709
- const { [u]: b, ...d } = e;
2710
- a(d);
2711
- },
2712
- children: "×"
2713
- }
2714
- )
2715
- ] }, y)),
2716
- /* @__PURE__ */ r("button", { onClick: i, className: "nice-api-tester__add-btn", children: "+ Add" })
2717
- ] });
2718
- }
2719
- function nr({
2720
- params: e,
2721
- onChange: a,
2722
- onAdd: i
2723
- }) {
2724
- return /* @__PURE__ */ r(
2725
- xe,
2726
- {
2727
- items: e,
2728
- onChange: a,
2729
- onAdd: i,
2730
- keyPlaceholder: "Parameter",
2731
- valuePlaceholder: "Value"
2732
- }
2733
- );
2734
- }
2735
- function tr({
2736
- headers: e,
2737
- onChange: a,
2738
- onAdd: i
2739
- }) {
2740
- return /* @__PURE__ */ r(
2741
- xe,
2742
- {
2743
- items: e,
2744
- onChange: a,
2745
- onAdd: i,
2746
- keyPlaceholder: "Header",
2747
- valuePlaceholder: "Value"
2748
- }
2749
- );
2750
- }
2751
- function sr({
2752
- body: e,
2753
- bodyTab: a,
2754
- onBodyTabChange: i,
2755
- onChange: n
2756
- }) {
2757
- return /* @__PURE__ */ t("div", { className: "nice-api-tester__body-editor", children: [
2758
- /* @__PURE__ */ r("div", { className: "nice-api-tester__body-tabs", children: ["none", "json", "form-data", "raw"].map((s) => /* @__PURE__ */ t("label", { children: [
2759
- /* @__PURE__ */ r(
2760
- "input",
2761
- {
2762
- type: "radio",
2763
- checked: a === s,
2764
- onChange: () => {
2765
- i(s), n({ type: s, content: "" });
2766
- }
2767
- }
2768
- ),
2769
- s
2770
- ] }, s)) }),
2771
- a !== "none" && /* @__PURE__ */ r(
2772
- "textarea",
2773
- {
2774
- value: typeof (e == null ? void 0 : e.content) == "string" ? e.content : JSON.stringify(e == null ? void 0 : e.content, null, 2),
2775
- onChange: (s) => n({ type: a, content: s.target.value }),
2776
- placeholder: a === "json" ? '{ "key": "value" }' : "Enter body content",
2777
- rows: 10,
2778
- className: "nice-api-tester__body-textarea"
2779
- }
2780
- )
2781
- ] });
2782
- }
2783
- function cr({
2784
- auth: e,
2785
- onChange: a
2786
- }) {
2787
- var i, n, s, u, f, y;
2788
- return /* @__PURE__ */ t("div", { className: "nice-api-tester__auth-editor", children: [
2789
- /* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
2790
- /* @__PURE__ */ r("label", { children: "Type" }),
2791
- /* @__PURE__ */ t(
2792
- "select",
2793
- {
2794
- value: (e == null ? void 0 : e.type) || "none",
2795
- onChange: (b) => a({ type: b.target.value }),
2796
- children: [
2797
- /* @__PURE__ */ r("option", { value: "none", children: "No Auth" }),
2798
- /* @__PURE__ */ r("option", { value: "api-key", children: "API Key" }),
2799
- /* @__PURE__ */ r("option", { value: "bearer", children: "Bearer Token" }),
2800
- /* @__PURE__ */ r("option", { value: "basic", children: "Basic Auth" }),
2801
- /* @__PURE__ */ r("option", { value: "oauth2", children: "OAuth 2.0" })
2802
- ]
2803
- }
2804
- )
2805
- ] }),
2806
- (e == null ? void 0 : e.type) === "api-key" && /* @__PURE__ */ t(J, { children: [
2807
- /* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
2808
- /* @__PURE__ */ r("label", { children: "Key" }),
2809
- /* @__PURE__ */ r(
2810
- "input",
2811
- {
2812
- type: "text",
2813
- value: ((i = e.apiKey) == null ? void 0 : i.key) || "",
2814
- onChange: (b) => {
2815
- var d, v;
2816
- return a({
2817
- ...e,
2818
- apiKey: {
2819
- ...e.apiKey,
2820
- key: b.target.value,
2821
- value: ((d = e.apiKey) == null ? void 0 : d.value) || "",
2822
- in: ((v = e.apiKey) == null ? void 0 : v.in) || "header"
2823
- }
2824
- });
2825
- },
2826
- placeholder: "X-API-Key"
2827
- }
2828
- )
2829
- ] }),
2830
- /* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
2831
- /* @__PURE__ */ r("label", { children: "Value" }),
2832
- /* @__PURE__ */ r(
2833
- "input",
2834
- {
2835
- type: "text",
2836
- value: ((n = e.apiKey) == null ? void 0 : n.value) || "",
2837
- onChange: (b) => {
2838
- var d, v;
2839
- return a({
2840
- ...e,
2841
- apiKey: {
2842
- ...e.apiKey,
2843
- value: b.target.value,
2844
- key: ((d = e.apiKey) == null ? void 0 : d.key) || "",
2845
- in: ((v = e.apiKey) == null ? void 0 : v.in) || "header"
2846
- }
2847
- });
2848
- },
2849
- placeholder: "your-api-key"
2850
- }
2851
- )
2852
- ] }),
2853
- /* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
2854
- /* @__PURE__ */ r("label", { children: "Add to" }),
2855
- /* @__PURE__ */ t(
2856
- "select",
2857
- {
2858
- value: ((s = e.apiKey) == null ? void 0 : s.in) || "header",
2859
- onChange: (b) => {
2860
- var d, v;
2861
- return a({
2862
- ...e,
2863
- apiKey: {
2864
- ...e.apiKey,
2865
- in: b.target.value,
2866
- key: ((d = e.apiKey) == null ? void 0 : d.key) || "",
2867
- value: ((v = e.apiKey) == null ? void 0 : v.value) || ""
2868
- }
2869
- });
2870
- },
2871
- children: [
2872
- /* @__PURE__ */ r("option", { value: "header", children: "Header" }),
2873
- /* @__PURE__ */ r("option", { value: "query", children: "Query Params" })
2874
- ]
2875
- }
2876
- )
2877
- ] })
2878
- ] }),
2879
- (e == null ? void 0 : e.type) === "bearer" && /* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
2880
- /* @__PURE__ */ r("label", { children: "Token" }),
2881
- /* @__PURE__ */ r(
2882
- "input",
2883
- {
2884
- type: "text",
2885
- value: ((u = e.bearer) == null ? void 0 : u.token) || "",
2886
- onChange: (b) => a({ ...e, bearer: { token: b.target.value } }),
2887
- placeholder: "your-bearer-token"
2888
- }
2889
- )
2890
- ] }),
2891
- (e == null ? void 0 : e.type) === "basic" && /* @__PURE__ */ t(J, { children: [
2892
- /* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
2893
- /* @__PURE__ */ r("label", { children: "Username" }),
2894
- /* @__PURE__ */ r(
2895
- "input",
2896
- {
2897
- type: "text",
2898
- value: ((f = e.basic) == null ? void 0 : f.username) || "",
2899
- onChange: (b) => {
2900
- var d;
2901
- return a({
2902
- ...e,
2903
- basic: {
2904
- ...e.basic,
2905
- username: b.target.value,
2906
- password: ((d = e.basic) == null ? void 0 : d.password) || ""
2907
- }
2908
- });
2909
- }
2910
- }
2911
- )
2912
- ] }),
2913
- /* @__PURE__ */ t("div", { className: "nice-api-tester__field", children: [
2914
- /* @__PURE__ */ r("label", { children: "Password" }),
2915
- /* @__PURE__ */ r(
2916
- "input",
2917
- {
2918
- type: "password",
2919
- value: ((y = e.basic) == null ? void 0 : y.password) || "",
2920
- onChange: (b) => {
2921
- var d;
2922
- return a({
2923
- ...e,
2924
- basic: {
2925
- ...e.basic,
2926
- password: b.target.value,
2927
- username: ((d = e.basic) == null ? void 0 : d.username) || ""
2928
- }
2929
- });
2930
- }
2931
- }
2932
- )
2933
- ] })
2934
- ] })
2935
- ] });
2936
- }
2937
- function or({
2938
- preRequestScript: e,
2939
- testScript: a,
2940
- onPreRequestChange: i,
2941
- onTestChange: n
2942
- }) {
2943
- return /* @__PURE__ */ t("div", { className: "nice-api-tester__tests-editor", children: [
2944
- /* @__PURE__ */ t("div", { className: "nice-api-tester__script-section", children: [
2945
- /* @__PURE__ */ r("h4", { children: "Pre-request Script" }),
2946
- /* @__PURE__ */ r(
2947
- "textarea",
2948
- {
2949
- value: e,
2950
- onChange: (s) => i(s.target.value),
2951
- placeholder: "// Code to run before the request",
2952
- rows: 5
2953
- }
2954
- )
2955
- ] }),
2956
- /* @__PURE__ */ t("div", { className: "nice-api-tester__script-section", children: [
2957
- /* @__PURE__ */ r("h4", { children: "Tests" }),
2958
- /* @__PURE__ */ r(
2959
- "textarea",
2960
- {
2961
- value: a,
2962
- onChange: (s) => n(s.target.value),
2963
- placeholder: `pm.test("Status code is 200", function () {
2964
- pm.expect(pm.response.code).to.equal(200);
2965
- });`,
2966
- rows: 8
2967
- }
2968
- )
2969
- ] })
2970
- ] });
2971
- }
2972
- const dr = [
2973
- {
2974
- target: ".nice-integration-builder",
2975
- titleKey: "tutorial.integrationBuilder.intro.title",
2976
- title: "Integration builder",
2977
- contentKey: "tutorial.integrationBuilder.intro.content",
2978
- content: "Wire a flow of nodes (triggers → actions → error handling) and connect them to build an integration.",
2979
- placement: "auto"
2980
- }
2981
- ], te = [
2982
- { type: "trigger", label: "Trigger", icon: "⚡", category: "Control" },
2983
- { type: "http-request", label: "HTTP Request", icon: "🌐", category: "Actions" },
2984
- { type: "transform", label: "Transform", icon: "🔄", category: "Data" },
2985
- { type: "filter", label: "Filter", icon: "🔍", category: "Data" },
2986
- { type: "switch", label: "Switch", icon: "⑂", category: "Control" },
2987
- { type: "loop", label: "Loop", icon: "🔁", category: "Control" },
2988
- { type: "delay", label: "Delay", icon: "⏱️", category: "Control" },
2989
- { type: "set-variable", label: "Set Variable", icon: "📝", category: "Data" },
2990
- { type: "database", label: "Database", icon: "🗄️", category: "Actions" },
2991
- { type: "email", label: "Email", icon: "✉️", category: "Actions" },
2992
- { type: "webhook", label: "Webhook", icon: "🔗", category: "Actions" },
2993
- { type: "function", label: "Function", icon: "ƒ", category: "Actions" },
2994
- { type: "error-handler", label: "Error Handler", icon: "⚠️", category: "Control" }
2995
- ], lr = {
2996
- id: "",
2997
- name: "New Flow",
2998
- nodes: [],
2999
- connections: [],
3000
- variables: {},
3001
- triggers: [],
3002
- errorHandling: { strategy: "stop" }
3003
- };
3004
- function Nr({
3005
- flow: e,
3006
- connectors: a = [],
3007
- onChange: i,
3008
- onSave: n,
3009
- onRun: s,
3010
- className: u = "",
3011
- tutorial: f
3012
- }) {
3013
- const [y, b] = g(
3014
- e || { ...lr, id: crypto.randomUUID() }
3015
- ), [d, v] = g(null), [k, m] = g(!0), [T, _] = g("canvas"), [I, H] = g(!1), [K, j] = g(null), [G, $] = g(!1), [U, O] = g(null), [q, w] = g(!1), x = se(null), S = P(
3016
- (p) => {
3017
- b((h) => {
3018
- const C = p(h);
3019
- return i == null || i(C), C;
3020
- });
3021
- },
3022
- [i]
3023
- ), B = P(
3024
- (p, h) => {
3025
- var c;
3026
- const C = {
3027
- id: crypto.randomUUID(),
3028
- type: p,
3029
- name: ((c = te.find((o) => o.type === p)) == null ? void 0 : c.label) || p,
3030
- position: h,
3031
- config: fr(p),
3032
- inputs: p !== "trigger" ? ["input"] : [],
3033
- outputs: ["output"]
3034
- };
3035
- S((o) => ({
3036
- ...o,
3037
- nodes: [...o.nodes, C]
3038
- })), v(C);
3039
- },
3040
- [S]
3041
- ), V = P(
3042
- (p) => {
3043
- S((h) => ({
3044
- ...h,
3045
- nodes: h.nodes.filter((C) => C.id !== p),
3046
- connections: h.connections.filter(
3047
- (C) => C.sourceNodeId !== p && C.targetNodeId !== p
3048
- )
3049
- })), v(null);
3050
- },
3051
- [S]
3052
- ), z = P(
3053
- (p, h) => {
3054
- S((C) => ({
3055
- ...C,
3056
- nodes: C.nodes.map((c) => c.id === p ? { ...c, ...h } : c)
3057
- })), (d == null ? void 0 : d.id) === p && v((C) => C ? { ...C, ...h } : null);
3058
- },
3059
- [S, d]
3060
- ), L = P(
3061
- (p, h, C, c) => {
3062
- p === C || y.connections.some(
3063
- (N) => N.sourceNodeId === p && N.targetNodeId === C && N.sourceOutput === h && N.targetInput === c
3064
- ) || S((N) => ({
3065
- ...N,
3066
- connections: [
3067
- ...N.connections,
3068
- {
3069
- id: crypto.randomUUID(),
3070
- sourceNodeId: p,
3071
- sourceOutput: h,
3072
- targetNodeId: C,
3073
- targetInput: c
3074
- }
3075
- ]
3076
- }));
3077
- },
3078
- [y.connections, S]
3079
- ), X = P(
3080
- (p) => {
3081
- S((h) => ({
3082
- ...h,
3083
- connections: h.connections.filter((C) => C.id !== p)
3084
- }));
3085
- },
3086
- [S]
3087
- ), F = P(
3088
- (p) => {
3089
- if (p.preventDefault(), !K || !x.current)
3090
- return;
3091
- const h = x.current.getBoundingClientRect(), C = p.clientX - h.left, c = p.clientY - h.top;
3092
- B(K, { x: C, y: c }), H(!1), j(null);
3093
- },
3094
- [K, B]
3095
- ), Q = P(async () => {
3096
- if (s) {
3097
- w(!0);
3098
- try {
3099
- await s(y);
3100
- } finally {
3101
- w(!1);
3102
- }
3103
- }
3104
- }, [y, s]), Y = P(() => {
3105
- n == null || n(y);
3106
- }, [y, n]);
3107
- return /* @__PURE__ */ t("div", { className: `nice-integration-builder ${u}`, style: { position: "relative" }, children: [
3108
- f && /* @__PURE__ */ r("div", { style: { position: "absolute", top: 8, right: 8, zIndex: 5 }, children: /* @__PURE__ */ r(re, { steps: ee(f, dr) }) }),
3109
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__toolbar", children: [
3110
- /* @__PURE__ */ r(
3111
- "input",
3112
- {
3113
- type: "text",
3114
- value: y.name,
3115
- onChange: (p) => S((h) => ({ ...h, name: p.target.value })),
3116
- className: "nice-integration-builder__name-input"
3117
- }
3118
- ),
3119
- /* @__PURE__ */ r("div", { className: "nice-integration-builder__tabs", children: ["canvas", "code", "variables", "settings"].map((p) => /* @__PURE__ */ r(
3120
- "button",
3121
- {
3122
- className: `nice-integration-builder__tab ${T === p ? "nice-integration-builder__tab--active" : ""}`,
3123
- onClick: () => _(p),
3124
- children: p.charAt(0).toUpperCase() + p.slice(1)
3125
- },
3126
- p
3127
- )) }),
3128
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__actions", children: [
3129
- /* @__PURE__ */ r(
3130
- "button",
3131
- {
3132
- onClick: Q,
3133
- disabled: q,
3134
- className: "nice-integration-builder__run-btn",
3135
- children: q ? "⏳ Running..." : "▶ Run"
3136
- }
3137
- ),
3138
- /* @__PURE__ */ r("button", { onClick: Y, className: "nice-integration-builder__save-btn", children: "💾 Save" })
3139
- ] })
3140
- ] }),
3141
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__main", children: [
3142
- k && T === "canvas" && /* @__PURE__ */ t("div", { className: "nice-integration-builder__palette", children: [
3143
- /* @__PURE__ */ r("h4", { children: "Nodes" }),
3144
- ["Control", "Actions", "Data"].map((p) => /* @__PURE__ */ t("div", { className: "nice-integration-builder__category", children: [
3145
- /* @__PURE__ */ r("h5", { children: p }),
3146
- te.filter((h) => h.category === p).map((h) => /* @__PURE__ */ t(
3147
- "div",
3148
- {
3149
- className: "nice-integration-builder__palette-item",
3150
- draggable: !0,
3151
- onDragStart: () => {
3152
- H(!0), j(h.type);
3153
- },
3154
- onDragEnd: () => {
3155
- H(!1), j(null);
3156
- },
3157
- children: [
3158
- /* @__PURE__ */ r("span", { className: "nice-integration-builder__palette-icon", children: h.icon }),
3159
- /* @__PURE__ */ r("span", { children: h.label })
3160
- ]
3161
- },
3162
- h.type
3163
- ))
3164
- ] }, p)),
3165
- a.length > 0 && /* @__PURE__ */ t("div", { className: "nice-integration-builder__category", children: [
3166
- /* @__PURE__ */ r("h5", { children: "Connectors" }),
3167
- a.map((p) => /* @__PURE__ */ t("div", { className: "nice-integration-builder__palette-item", children: [
3168
- /* @__PURE__ */ r("span", { className: "nice-integration-builder__palette-icon", children: "🔌" }),
3169
- /* @__PURE__ */ r("span", { children: p.name })
3170
- ] }, p.id))
3171
- ] })
3172
- ] }),
3173
- T === "canvas" && /* @__PURE__ */ t(
3174
- "div",
3175
- {
3176
- ref: x,
3177
- className: `nice-integration-builder__canvas ${I ? "nice-integration-builder__canvas--dragging" : ""}`,
3178
- onDragOver: (p) => p.preventDefault(),
3179
- onDrop: F,
3180
- onClick: () => v(null),
3181
- children: [
3182
- /* @__PURE__ */ r("svg", { className: "nice-integration-builder__connections", children: y.connections.map((p) => {
3183
- const h = y.nodes.find((R) => R.id === p.sourceNodeId), C = y.nodes.find((R) => R.id === p.targetNodeId);
3184
- if (!h || !C)
3185
- return null;
3186
- const c = h.position.x + 150, o = h.position.y + 30, N = C.position.x, D = C.position.y + 30, E = (c + N) / 2;
3187
- return /* @__PURE__ */ r("g", { onClick: () => X(p.id), children: /* @__PURE__ */ r(
3188
- "path",
3189
- {
3190
- d: `M ${c} ${o} C ${E} ${o}, ${E} ${D}, ${N} ${D}`,
3191
- className: "nice-integration-builder__connection"
3192
- }
3193
- ) }, p.id);
3194
- }) }),
3195
- y.nodes.map((p) => /* @__PURE__ */ r(
3196
- pr,
3197
- {
3198
- node: p,
3199
- isSelected: (d == null ? void 0 : d.id) === p.id,
3200
- onSelect: () => v(p),
3201
- onDelete: () => V(p.id),
3202
- onPositionChange: (h) => z(p.id, { position: h }),
3203
- onStartConnection: (h) => {
3204
- $(!0), O({ nodeId: p.id, output: h });
3205
- },
3206
- onEndConnection: (h) => {
3207
- U && L(U.nodeId, U.output, p.id, h), $(!1), O(null);
3208
- }
3209
- },
3210
- p.id
3211
- )),
3212
- y.nodes.length === 0 && /* @__PURE__ */ r("div", { className: "nice-integration-builder__empty", children: "Drag nodes from the palette to build your flow" })
3213
- ]
3214
- }
3215
- ),
3216
- T === "code" && /* @__PURE__ */ r("div", { className: "nice-integration-builder__code-view", children: /* @__PURE__ */ r("pre", { children: JSON.stringify(y, null, 2) }) }),
3217
- T === "variables" && /* @__PURE__ */ r(
3218
- yr,
3219
- {
3220
- variables: y.variables,
3221
- onChange: (p) => S((h) => ({ ...h, variables: p }))
3222
- }
3223
- ),
3224
- T === "settings" && /* @__PURE__ */ r(
3225
- ur,
3226
- {
3227
- errorHandling: y.errorHandling,
3228
- schedule: y.schedule,
3229
- onChange: (p, h) => S((C) => ({ ...C, errorHandling: p, schedule: h }))
3230
- }
3231
- ),
3232
- d && T === "canvas" && /* @__PURE__ */ r(
3233
- mr,
3234
- {
3235
- node: d,
3236
- onChange: (p) => z(d.id, p),
3237
- onClose: () => v(null)
3238
- }
3239
- )
3240
- ] })
3241
- ] });
3242
- }
3243
- function fr(e) {
3244
- switch (e) {
3245
- case "http-request":
3246
- return { method: "GET", url: "", headers: {}, body: "" };
3247
- case "transform":
3248
- return { mapping: [] };
3249
- case "filter":
3250
- return { condition: "" };
3251
- case "switch":
3252
- return { cases: [] };
3253
- case "loop":
3254
- return { collection: "", itemVariable: "item" };
3255
- case "delay":
3256
- return { duration: 1e3 };
3257
- case "set-variable":
3258
- return { name: "", value: "" };
3259
- case "database":
3260
- return { operation: "query", query: "" };
3261
- case "email":
3262
- return { to: "", subject: "", body: "" };
3263
- case "webhook":
3264
- return { method: "POST", url: "" };
3265
- case "function":
3266
- return { code: `// Your code here
3267
- return input;` };
3268
- case "error-handler":
3269
- return { strategy: "retry", maxRetries: 3 };
3270
- default:
3271
- return {};
3272
- }
3273
- }
3274
- function pr({
3275
- node: e,
3276
- isSelected: a,
3277
- onSelect: i,
3278
- onDelete: n,
3279
- onPositionChange: s,
3280
- onStartConnection: u,
3281
- onEndConnection: f
3282
- }) {
3283
- const [y, b] = g(!1), [d, v] = g({ x: 0, y: 0 }), k = se(null), m = te.find((_) => _.type === e.type), T = (_) => {
3284
- _.button === 0 && (_.stopPropagation(), b(!0), v({
3285
- x: _.clientX - e.position.x,
3286
- y: _.clientY - e.position.y
3287
- }), i());
3288
- };
3289
- return ye(() => {
3290
- if (!y)
3291
- return;
3292
- const _ = (H) => {
3293
- s({
3294
- x: H.clientX - d.x,
3295
- y: H.clientY - d.y
3296
- });
3297
- }, I = () => {
3298
- b(!1);
3299
- };
3300
- return window.addEventListener("mousemove", _), window.addEventListener("mouseup", I), () => {
3301
- window.removeEventListener("mousemove", _), window.removeEventListener("mouseup", I);
3302
- };
3303
- }, [y, d, s]), /* @__PURE__ */ t(
3304
- "div",
3305
- {
3306
- ref: k,
3307
- className: `nice-integration-builder__node nice-integration-builder__node--${e.type} ${a ? "nice-integration-builder__node--selected" : ""}`,
3308
- style: {
3309
- left: e.position.x,
3310
- top: e.position.y
3311
- },
3312
- onMouseDown: T,
3313
- children: [
3314
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__node-header", children: [
3315
- /* @__PURE__ */ r("span", { className: "nice-integration-builder__node-icon", children: (m == null ? void 0 : m.icon) || "📦" }),
3316
- /* @__PURE__ */ r("span", { className: "nice-integration-builder__node-name", children: e.name }),
3317
- /* @__PURE__ */ r(
3318
- "button",
3319
- {
3320
- className: "nice-integration-builder__node-delete",
3321
- onClick: (_) => {
3322
- _.stopPropagation(), n();
3323
- },
3324
- children: "×"
3325
- }
3326
- )
3327
- ] }),
3328
- e.inputs.map((_) => /* @__PURE__ */ t(
3329
- "div",
3330
- {
3331
- className: "nice-integration-builder__port nice-integration-builder__port--input",
3332
- onMouseUp: () => f(_),
3333
- children: [
3334
- /* @__PURE__ */ r("span", { className: "nice-integration-builder__port-dot" }),
3335
- /* @__PURE__ */ r("span", { className: "nice-integration-builder__port-label", children: _ })
3336
- ]
3337
- },
3338
- _
3339
- )),
3340
- e.outputs.map((_) => /* @__PURE__ */ t(
3341
- "div",
3342
- {
3343
- className: "nice-integration-builder__port nice-integration-builder__port--output",
3344
- onMouseDown: (I) => {
3345
- I.stopPropagation(), u(_);
3346
- },
3347
- children: [
3348
- /* @__PURE__ */ r("span", { className: "nice-integration-builder__port-label", children: _ }),
3349
- /* @__PURE__ */ r("span", { className: "nice-integration-builder__port-dot" })
3350
- ]
3351
- },
3352
- _
3353
- ))
3354
- ]
3355
- }
3356
- );
3357
- }
3358
- function mr({
3359
- node: e,
3360
- onChange: a,
3361
- onClose: i
3362
- }) {
3363
- return /* @__PURE__ */ t("div", { className: "nice-integration-builder__properties", children: [
3364
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__properties-header", children: [
3365
- /* @__PURE__ */ r("h4", { children: e.name }),
3366
- /* @__PURE__ */ r("button", { onClick: i, children: "×" })
3367
- ] }),
3368
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__properties-content", children: [
3369
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3370
- /* @__PURE__ */ r("label", { children: "Name" }),
3371
- /* @__PURE__ */ r(
3372
- "input",
3373
- {
3374
- type: "text",
3375
- value: e.name,
3376
- onChange: (n) => a({ name: n.target.value })
3377
- }
3378
- )
3379
- ] }),
3380
- e.type === "http-request" && /* @__PURE__ */ t(J, { children: [
3381
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3382
- /* @__PURE__ */ r("label", { children: "Method" }),
3383
- /* @__PURE__ */ r(
3384
- "select",
3385
- {
3386
- value: e.config.method || "GET",
3387
- onChange: (n) => a({ config: { ...e.config, method: n.target.value } }),
3388
- children: ["GET", "POST", "PUT", "PATCH", "DELETE"].map((n) => /* @__PURE__ */ r("option", { value: n, children: n }, n))
3389
- }
3390
- )
3391
- ] }),
3392
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3393
- /* @__PURE__ */ r("label", { children: "URL" }),
3394
- /* @__PURE__ */ r(
3395
- "input",
3396
- {
3397
- type: "text",
3398
- value: e.config.url || "",
3399
- onChange: (n) => a({ config: { ...e.config, url: n.target.value } }),
3400
- placeholder: "https://api.example.com/endpoint"
3401
- }
3402
- )
3403
- ] })
3404
- ] }),
3405
- e.type === "delay" && /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3406
- /* @__PURE__ */ r("label", { children: "Duration (ms)" }),
3407
- /* @__PURE__ */ r(
3408
- "input",
3409
- {
3410
- type: "number",
3411
- value: e.config.duration || 1e3,
3412
- onChange: (n) => a({ config: { ...e.config, duration: parseInt(n.target.value, 10) } })
3413
- }
3414
- )
3415
- ] }),
3416
- e.type === "set-variable" && /* @__PURE__ */ t(J, { children: [
3417
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3418
- /* @__PURE__ */ r("label", { children: "Variable Name" }),
3419
- /* @__PURE__ */ r(
3420
- "input",
3421
- {
3422
- type: "text",
3423
- value: e.config.name || "",
3424
- onChange: (n) => a({ config: { ...e.config, name: n.target.value } })
3425
- }
3426
- )
3427
- ] }),
3428
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3429
- /* @__PURE__ */ r("label", { children: "Value" }),
3430
- /* @__PURE__ */ r(
3431
- "input",
3432
- {
3433
- type: "text",
3434
- value: e.config.value || "",
3435
- onChange: (n) => a({ config: { ...e.config, value: n.target.value } })
3436
- }
3437
- )
3438
- ] })
3439
- ] }),
3440
- e.type === "function" && /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3441
- /* @__PURE__ */ r("label", { children: "Code" }),
3442
- /* @__PURE__ */ r(
3443
- "textarea",
3444
- {
3445
- value: e.config.code || "",
3446
- onChange: (n) => a({ config: { ...e.config, code: n.target.value } }),
3447
- rows: 10,
3448
- className: "nice-integration-builder__code-input"
3449
- }
3450
- )
3451
- ] }),
3452
- e.type === "email" && /* @__PURE__ */ t(J, { children: [
3453
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3454
- /* @__PURE__ */ r("label", { children: "To" }),
3455
- /* @__PURE__ */ r(
3456
- "input",
3457
- {
3458
- type: "text",
3459
- value: e.config.to || "",
3460
- onChange: (n) => a({ config: { ...e.config, to: n.target.value } })
3461
- }
3462
- )
3463
- ] }),
3464
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3465
- /* @__PURE__ */ r("label", { children: "Subject" }),
3466
- /* @__PURE__ */ r(
3467
- "input",
3468
- {
3469
- type: "text",
3470
- value: e.config.subject || "",
3471
- onChange: (n) => a({ config: { ...e.config, subject: n.target.value } })
3472
- }
3473
- )
3474
- ] }),
3475
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3476
- /* @__PURE__ */ r("label", { children: "Body" }),
3477
- /* @__PURE__ */ r(
3478
- "textarea",
3479
- {
3480
- value: e.config.body || "",
3481
- onChange: (n) => a({ config: { ...e.config, body: n.target.value } }),
3482
- rows: 5
3483
- }
3484
- )
3485
- ] })
3486
- ] })
3487
- ] })
3488
- ] });
3489
- }
3490
- function yr({ variables: e, onChange: a }) {
3491
- const i = () => {
3492
- a({ ...e, newVariable: "" });
3493
- };
3494
- return /* @__PURE__ */ t("div", { className: "nice-integration-builder__variables", children: [
3495
- /* @__PURE__ */ r("h4", { children: "Flow Variables" }),
3496
- /* @__PURE__ */ r("div", { className: "nice-integration-builder__variables-list", children: Object.entries(e).map(([n, s]) => /* @__PURE__ */ t("div", { className: "nice-integration-builder__variable-row", children: [
3497
- /* @__PURE__ */ r(
3498
- "input",
3499
- {
3500
- type: "text",
3501
- value: n,
3502
- onChange: (u) => {
3503
- const { [n]: f, ...y } = e;
3504
- a({ ...y, [u.target.value]: s });
3505
- },
3506
- placeholder: "Name"
3507
- }
3508
- ),
3509
- /* @__PURE__ */ r(
3510
- "input",
3511
- {
3512
- type: "text",
3513
- value: String(s),
3514
- onChange: (u) => a({ ...e, [n]: u.target.value }),
3515
- placeholder: "Value"
3516
- }
3517
- ),
3518
- /* @__PURE__ */ r(
3519
- "button",
3520
- {
3521
- onClick: () => {
3522
- const { [n]: u, ...f } = e;
3523
- a(f);
3524
- },
3525
- children: "×"
3526
- }
3527
- )
3528
- ] }, n)) }),
3529
- /* @__PURE__ */ r("button", { onClick: i, children: "+ Add Variable" })
3530
- ] });
3531
- }
3532
- function ur({
3533
- errorHandling: e,
3534
- schedule: a,
3535
- onChange: i
3536
- }) {
3537
- return /* @__PURE__ */ t("div", { className: "nice-integration-builder__settings", children: [
3538
- /* @__PURE__ */ r("h4", { children: "Error Handling" }),
3539
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3540
- /* @__PURE__ */ r("label", { children: "Strategy" }),
3541
- /* @__PURE__ */ t(
3542
- "select",
3543
- {
3544
- value: e.strategy,
3545
- onChange: (n) => i(
3546
- { ...e, strategy: n.target.value },
3547
- a
3548
- ),
3549
- children: [
3550
- /* @__PURE__ */ r("option", { value: "stop", children: "Stop on error" }),
3551
- /* @__PURE__ */ r("option", { value: "continue", children: "Continue on error" }),
3552
- /* @__PURE__ */ r("option", { value: "retry", children: "Retry on error" })
3553
- ]
3554
- }
3555
- )
3556
- ] }),
3557
- e.strategy === "retry" && /* @__PURE__ */ t(J, { children: [
3558
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3559
- /* @__PURE__ */ r("label", { children: "Max Retries" }),
3560
- /* @__PURE__ */ r(
3561
- "input",
3562
- {
3563
- type: "number",
3564
- value: e.maxRetries || 3,
3565
- onChange: (n) => i({ ...e, maxRetries: parseInt(n.target.value, 10) }, a)
3566
- }
3567
- )
3568
- ] }),
3569
- /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3570
- /* @__PURE__ */ r("label", { children: "Retry Delay (ms)" }),
3571
- /* @__PURE__ */ r(
3572
- "input",
3573
- {
3574
- type: "number",
3575
- value: e.retryDelay || 1e3,
3576
- onChange: (n) => i({ ...e, retryDelay: parseInt(n.target.value, 10) }, a)
3577
- }
3578
- )
3579
- ] })
3580
- ] }),
3581
- /* @__PURE__ */ r("h4", { children: "Schedule" }),
3582
- /* @__PURE__ */ r("div", { className: "nice-integration-builder__field", children: /* @__PURE__ */ t("label", { children: [
3583
- /* @__PURE__ */ r(
3584
- "input",
3585
- {
3586
- type: "checkbox",
3587
- checked: (a == null ? void 0 : a.enabled) || !1,
3588
- onChange: (n) => i(e, { ...a, enabled: n.target.checked })
3589
- }
3590
- ),
3591
- "Enable scheduled execution"
3592
- ] }) }),
3593
- (a == null ? void 0 : a.enabled) && /* @__PURE__ */ t("div", { className: "nice-integration-builder__field", children: [
3594
- /* @__PURE__ */ r("label", { children: "Cron Expression" }),
3595
- /* @__PURE__ */ r(
3596
- "input",
3597
- {
3598
- type: "text",
3599
- value: a.cron || "",
3600
- onChange: (n) => i(e, { ...a, cron: n.target.value }),
3601
- placeholder: "0 0 * * *"
3602
- }
3603
- )
3604
- ] })
3605
- ] });
3606
- }
3607
- const br = [
3608
- {
3609
- target: ".nice-webhook-tester",
3610
- titleKey: "tutorial.webhookTester.intro.title",
3611
- title: "Webhook tester",
3612
- contentKey: "tutorial.webhookTester.intro.content",
3613
- content: "Pick a saved payload (or write one), optionally sign it, send it to the endpoint and inspect the response.",
3614
- placement: "auto"
3615
- }
3616
- ];
3617
- function fe(e) {
3618
- return e ? Object.entries(e).map(([a, i]) => ({ key: a, value: i })) : [];
3619
- }
3620
- function pe(e) {
3621
- const a = {};
3622
- for (const i of e)
3623
- i.key.trim() !== "" && (a[i.key] = i.value);
3624
- return a;
3625
- }
3626
- async function hr(e, a) {
3627
- var f;
3628
- const i = (f = globalThis.crypto) == null ? void 0 : f.subtle;
3629
- if (!i)
3630
- throw new Error("Web Crypto (crypto.subtle) is unavailable in this environment");
3631
- const n = new TextEncoder(), s = await i.importKey(
3632
- "raw",
3633
- n.encode(e),
3634
- { name: "HMAC", hash: "SHA-256" },
3635
- !1,
3636
- ["sign"]
3637
- ), u = await i.sign("HMAC", s, n.encode(a));
3638
- return [...new Uint8Array(u)].map((y) => y.toString(16).padStart(2, "0")).join("");
3639
- }
3640
- const xr = ke(
3641
- function(a, i) {
3642
- const {
3643
- url: n = "",
3644
- method: s = "POST",
3645
- headers: u,
3646
- payload: f = "",
3647
- samples: y = [],
3648
- onSend: b,
3649
- signing: d,
3650
- onSaveSample: v,
3651
- tutorial: k,
3652
- className: m,
3653
- style: T,
3654
- id: _,
3655
- "data-testid": I
3656
- } = a, [H, K] = g(n), [j, G] = g(s), [$, U] = g(() => fe(u)), [O, q] = g(f), [w, x] = g(""), [S, B] = g(!1), [V, z] = g(null), [L, X] = g(null), F = Te(() => {
3657
- const o = /* @__PURE__ */ new Map();
3658
- for (const N of y)
3659
- o.set(N.id, N);
3660
- return o;
3661
- }, [y]), Q = (o) => {
3662
- x(o);
3663
- const N = F.get(o);
3664
- N && (q(N.payload), N.headers && U(fe(N.headers)));
3665
- }, Y = (o, N) => {
3666
- U((D) => D.map((E, R) => R === o ? { ...E, ...N } : E));
3667
- }, p = async () => {
3668
- B(!0), z(null), X(null);
3669
- try {
3670
- const o = pe($);
3671
- if (d && d.secret) {
3672
- const R = await hr(d.secret, O);
3673
- o[d.header] = `${d.prefix ?? ""}${R}`;
3674
- }
3675
- const N = typeof performance < "u" ? performance.now() : Date.now(), D = await b({ url: H, method: j ?? "POST", headers: o, body: O }), E = Math.round(
3676
- (typeof performance < "u" ? performance.now() : Date.now()) - N
3677
- );
3678
- X({ ...D, durationMs: D.durationMs ?? E });
3679
- } catch (o) {
3680
- z(o instanceof Error ? o.message : String(o));
3681
- } finally {
3682
- B(!1);
3683
- }
3684
- }, h = () => {
3685
- var N;
3686
- if (!v)
3687
- return;
3688
- const o = typeof window < "u" && ((N = window.prompt) == null ? void 0 : N.call(window, "Sample name")) || "";
3689
- o && v({
3690
- id: `sample_${Date.now().toString(36)}`,
3691
- name: o,
3692
- payload: O,
3693
- headers: pe($)
3694
- });
3695
- }, C = L == null ? "" : L.status >= 200 && L.status < 300 ? " nice-webhook-tester__status--ok" : " nice-webhook-tester__status--error", c = "nice-webhook-tester" + (m ? ` ${m}` : "");
3696
- return /* @__PURE__ */ t("div", { ref: i, id: _, className: c, style: T, "data-testid": I, children: [
3697
- k && /* @__PURE__ */ r("div", { className: "nice-webhook-tester__tutorial", children: /* @__PURE__ */ r(re, { steps: ee(k, br) }) }),
3698
- /* @__PURE__ */ t("div", { className: "nice-webhook-tester__bar", children: [
3699
- /* @__PURE__ */ r(
3700
- "select",
3701
- {
3702
- className: "nice-webhook-tester__method",
3703
- value: j,
3704
- onChange: (o) => G(o.target.value),
3705
- "aria-label": "Method",
3706
- children: ["POST", "PUT", "GET", "PATCH", "DELETE"].map((o) => /* @__PURE__ */ r("option", { value: o, children: o }, o))
3707
- }
3708
- ),
3709
- /* @__PURE__ */ r(
3710
- "input",
3711
- {
3712
- type: "text",
3713
- className: "nice-webhook-tester__url",
3714
- value: H,
3715
- placeholder: "https://example.com/api/payments/stripe/webhook",
3716
- onChange: (o) => K(o.target.value),
3717
- "aria-label": "URL"
3718
- }
3719
- ),
3720
- /* @__PURE__ */ r(
3721
- "button",
3722
- {
3723
- type: "button",
3724
- className: "nice-webhook-tester__send",
3725
- onClick: () => void p(),
3726
- disabled: S || H.trim() === "",
3727
- children: S ? "Sending…" : "Send"
3728
- }
3729
- )
3730
- ] }),
3731
- y.length > 0 && /* @__PURE__ */ r("div", { className: "nice-webhook-tester__samples", children: /* @__PURE__ */ t("label", { children: [
3732
- "Sample:",
3733
- " ",
3734
- /* @__PURE__ */ t("select", { value: w, onChange: (o) => Q(o.target.value), children: [
3735
- /* @__PURE__ */ r("option", { value: "", children: "— choose a saved payload —" }),
3736
- y.map((o) => /* @__PURE__ */ r("option", { value: o.id, children: o.name }, o.id))
3737
- ] })
3738
- ] }) }),
3739
- /* @__PURE__ */ t("div", { className: "nice-webhook-tester__headers", children: [
3740
- /* @__PURE__ */ t("div", { className: "nice-webhook-tester__section-label", children: [
3741
- "Headers",
3742
- d && /* @__PURE__ */ t("span", { className: "nice-webhook-tester__signed", children: [
3743
- " ",
3744
- "· auto-signs ",
3745
- /* @__PURE__ */ r("code", { children: d.header })
3746
- ] })
3747
- ] }),
3748
- $.map((o, N) => /* @__PURE__ */ t("div", { className: "nice-webhook-tester__header-row", children: [
3749
- /* @__PURE__ */ r(
3750
- "input",
3751
- {
3752
- type: "text",
3753
- value: o.key,
3754
- placeholder: "Header",
3755
- onChange: (D) => Y(N, { key: D.target.value }),
3756
- "aria-label": "Header name"
3757
- }
3758
- ),
3759
- /* @__PURE__ */ r(
3760
- "input",
3761
- {
3762
- type: "text",
3763
- value: o.value,
3764
- placeholder: "Value",
3765
- onChange: (D) => Y(N, { value: D.target.value }),
3766
- "aria-label": "Header value"
3767
- }
3768
- ),
3769
- /* @__PURE__ */ r(
3770
- "button",
3771
- {
3772
- type: "button",
3773
- onClick: () => U((D) => D.filter((E, R) => R !== N)),
3774
- "aria-label": "Remove header",
3775
- children: "✕"
3776
- }
3777
- )
3778
- ] }, N)),
3779
- /* @__PURE__ */ r(
3780
- "button",
3781
- {
3782
- type: "button",
3783
- className: "nice-webhook-tester__add-header",
3784
- onClick: () => U((o) => [...o, { key: "", value: "" }]),
3785
- children: "+ Header"
3786
- }
3787
- )
3788
- ] }),
3789
- /* @__PURE__ */ t("div", { className: "nice-webhook-tester__payload", children: [
3790
- /* @__PURE__ */ t("div", { className: "nice-webhook-tester__section-label", children: [
3791
- "Payload",
3792
- v && /* @__PURE__ */ r("button", { type: "button", className: "nice-webhook-tester__save", onClick: h, children: "Save as sample" })
3793
- ] }),
3794
- /* @__PURE__ */ r(
3795
- "textarea",
3796
- {
3797
- className: "nice-webhook-tester__textarea",
3798
- value: O,
3799
- spellCheck: !1,
3800
- rows: 8,
3801
- placeholder: '{ "type": "payment.succeeded", "data": { ... } }',
3802
- onChange: (o) => q(o.target.value),
3803
- "aria-label": "Payload"
3804
- }
3805
- )
3806
- ] }),
3807
- V && /* @__PURE__ */ r("div", { className: "nice-webhook-tester__error", children: V }),
3808
- L && /* @__PURE__ */ t("div", { className: "nice-webhook-tester__response", children: [
3809
- /* @__PURE__ */ t("div", { className: "nice-webhook-tester__section-label", children: [
3810
- "Response",
3811
- " ",
3812
- /* @__PURE__ */ r("span", { className: "nice-webhook-tester__status" + C, children: L.status }),
3813
- L.durationMs != null && /* @__PURE__ */ t("span", { className: "nice-webhook-tester__time", children: [
3814
- " · ",
3815
- L.durationMs,
3816
- " ms"
3817
- ] })
3818
- ] }),
3819
- L.body != null && /* @__PURE__ */ r("pre", { className: "nice-webhook-tester__response-body", children: L.body })
3820
- ] })
3821
- ] });
3822
- }
3823
- );
1
+ import { N as r, a as s, b as a, c } from "./index-DVh0InIq.js";
3824
2
  export {
3825
- _r as NiceAPIDesigner,
3826
- wr as NiceAPITester,
3827
- Nr as NiceIntegrationBuilder,
3828
- xr as NiceWebhookTester
3
+ r as NiceAPIDesigner,
4
+ s as NiceAPITester,
5
+ a as NiceIntegrationBuilder,
6
+ c as NiceWebhookTester
3829
7
  };