zudoku 0.25.2 → 0.25.3

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.
Files changed (137) hide show
  1. package/dist/app/demo.js +0 -1
  2. package/dist/app/demo.js.map +1 -1
  3. package/dist/app/standalone.js +0 -1
  4. package/dist/app/standalone.js.map +1 -1
  5. package/dist/config/validators/InputSidebarSchema.d.ts +2 -2
  6. package/dist/config/validators/validate.d.ts +4 -4
  7. package/dist/lib/oas/graphql/index.d.ts +3 -0
  8. package/dist/lib/oas/graphql/index.js +12 -13
  9. package/dist/lib/oas/graphql/index.js.map +1 -1
  10. package/dist/lib/plugins/openapi/ColorizedParam.d.ts +10 -2
  11. package/dist/lib/plugins/openapi/ColorizedParam.js +16 -7
  12. package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
  13. package/dist/lib/plugins/openapi/ParameterListItem.js +3 -2
  14. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  15. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js +2 -0
  16. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -1
  17. package/dist/lib/plugins/openapi/RequestBodySidecarBox.d.ts +1 -1
  18. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +2 -5
  19. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  20. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +2 -6
  21. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  22. package/dist/lib/plugins/openapi/{ExampleDisplay.d.ts → SidecarExamples.d.ts} +2 -6
  23. package/dist/lib/plugins/openapi/SidecarExamples.js +62 -0
  24. package/dist/lib/plugins/openapi/SidecarExamples.js.map +1 -0
  25. package/dist/lib/plugins/openapi/client/GraphQLClient.d.ts +1 -1
  26. package/dist/lib/plugins/openapi/client/GraphQLClient.js +22 -93
  27. package/dist/lib/plugins/openapi/client/GraphQLClient.js.map +1 -1
  28. package/dist/lib/plugins/openapi/client/createServer.d.ts +2 -1
  29. package/dist/lib/plugins/openapi/client/createServer.js +5 -2
  30. package/dist/lib/plugins/openapi/client/createServer.js.map +1 -1
  31. package/dist/lib/plugins/openapi/client/useCreateQuery.d.ts +1 -1
  32. package/dist/lib/plugins/openapi/client/useCreateQuery.js +2 -13
  33. package/dist/lib/plugins/openapi/client/useCreateQuery.js.map +1 -1
  34. package/dist/lib/plugins/openapi/index.d.ts +2 -1
  35. package/dist/lib/plugins/openapi/index.js.map +1 -1
  36. package/dist/lib/plugins/openapi/playground/EnumSelector.d.ts +8 -0
  37. package/dist/lib/plugins/openapi/playground/EnumSelector.js +21 -0
  38. package/dist/lib/plugins/openapi/playground/EnumSelector.js.map +1 -0
  39. package/dist/lib/plugins/openapi/playground/PathParams.js +9 -4
  40. package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
  41. package/dist/lib/plugins/openapi/playground/Playground.d.ts +3 -0
  42. package/dist/lib/plugins/openapi/playground/Playground.js +5 -2
  43. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  44. package/dist/lib/plugins/openapi/playground/QueryParams.js +23 -8
  45. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
  46. package/dist/lib/plugins/openapi/schema/SchemaComponents.js +2 -1
  47. package/dist/lib/plugins/openapi/schema/SchemaComponents.js.map +1 -1
  48. package/dist/lib/plugins/openapi/util/generateSchemaExample.js +19 -11
  49. package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -1
  50. package/dist/lib/ui/Badge.js +1 -1
  51. package/dist/lib/ui/Badge.js.map +1 -1
  52. package/dist/lib/ui/Button.d.ts +1 -1
  53. package/dist/lib/ui/Checkbox.d.ts +8 -2
  54. package/dist/lib/ui/Checkbox.js +13 -1
  55. package/dist/lib/ui/Checkbox.js.map +1 -1
  56. package/dist/lib/util/traverse.d.ts +8 -1
  57. package/dist/lib/util/traverse.js +7 -3
  58. package/dist/lib/util/traverse.js.map +1 -1
  59. package/dist/vite/api/schema-codegen.d.ts +12 -0
  60. package/dist/vite/api/schema-codegen.js +62 -0
  61. package/dist/vite/api/schema-codegen.js.map +1 -0
  62. package/dist/vite/api/schema-codegen.test.d.ts +1 -0
  63. package/dist/vite/api/schema-codegen.test.js +247 -0
  64. package/dist/vite/api/schema-codegen.test.js.map +1 -0
  65. package/dist/vite/config.js +0 -7
  66. package/dist/vite/config.js.map +1 -1
  67. package/dist/vite/plugin-api.js +110 -82
  68. package/dist/vite/plugin-api.js.map +1 -1
  69. package/dist/vite/plugin-component.js +0 -1
  70. package/dist/vite/plugin-component.js.map +1 -1
  71. package/lib/Command-9x_kZHr4.js +611 -0
  72. package/lib/Command-9x_kZHr4.js.map +1 -0
  73. package/lib/{OperationList-BLdHAQ39.js → OperationList-B8bHMKme.js} +1440 -1434
  74. package/lib/OperationList-B8bHMKme.js.map +1 -0
  75. package/lib/{createServer-Bf5_6o6G.js → createServer-BznDkeSA.js} +4227 -5154
  76. package/lib/createServer-BznDkeSA.js.map +1 -0
  77. package/lib/index-TaRXY2w1.js +43 -0
  78. package/lib/index-TaRXY2w1.js.map +1 -0
  79. package/lib/index-sD8L1_Dl.js +1292 -0
  80. package/lib/index-sD8L1_Dl.js.map +1 -0
  81. package/lib/post-processors/traverse.js +11 -8
  82. package/lib/post-processors/traverse.js.map +1 -1
  83. package/lib/ui/Badge.js +1 -1
  84. package/lib/ui/Badge.js.map +1 -1
  85. package/lib/ui/Checkbox.js +25 -14
  86. package/lib/ui/Checkbox.js.map +1 -1
  87. package/lib/ui/Command.js +14 -550
  88. package/lib/ui/Command.js.map +1 -1
  89. package/lib/zudoku.plugin-openapi.js +1 -1
  90. package/package.json +1 -6
  91. package/src/app/demo.tsx +0 -1
  92. package/src/app/standalone.tsx +0 -1
  93. package/src/lib/oas/graphql/index.ts +19 -15
  94. package/src/lib/plugins/openapi/ColorizedParam.tsx +29 -12
  95. package/src/lib/plugins/openapi/ParameterListItem.tsx +9 -7
  96. package/src/lib/plugins/openapi/PlaygroundDialogWrapper.tsx +2 -0
  97. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +2 -7
  98. package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +5 -8
  99. package/src/lib/plugins/openapi/SidecarExamples.tsx +155 -0
  100. package/src/lib/plugins/openapi/client/GraphQLClient.tsx +28 -120
  101. package/src/lib/plugins/openapi/client/createServer.ts +6 -2
  102. package/src/lib/plugins/openapi/client/useCreateQuery.ts +2 -17
  103. package/src/lib/plugins/openapi/index.tsx +2 -1
  104. package/src/lib/plugins/openapi/playground/EnumSelector.tsx +86 -0
  105. package/src/lib/plugins/openapi/playground/PathParams.tsx +72 -64
  106. package/src/lib/plugins/openapi/playground/Playground.tsx +26 -13
  107. package/src/lib/plugins/openapi/playground/QueryParams.tsx +102 -73
  108. package/src/lib/plugins/openapi/schema/SchemaComponents.tsx +4 -7
  109. package/src/lib/plugins/openapi/util/generateSchemaExample.ts +26 -11
  110. package/src/lib/ui/Badge.tsx +1 -1
  111. package/src/lib/ui/Checkbox.tsx +24 -7
  112. package/src/lib/util/traverse.ts +15 -5
  113. package/dist/lib/plugins/openapi/ExampleDisplay.js +0 -78
  114. package/dist/lib/plugins/openapi/ExampleDisplay.js.map +0 -1
  115. package/dist/lib/plugins/openapi/client/worker.d.ts +0 -4
  116. package/dist/lib/plugins/openapi/client/worker.js +0 -29
  117. package/dist/lib/plugins/openapi/client/worker.js.map +0 -1
  118. package/dist/lib/plugins/openapi-worker.d.ts +0 -1
  119. package/dist/lib/plugins/openapi-worker.js +0 -8
  120. package/dist/lib/plugins/openapi-worker.js.map +0 -1
  121. package/lib/Dialog-Bxv1yEIg.js +0 -67
  122. package/lib/Dialog-Bxv1yEIg.js.map +0 -1
  123. package/lib/OperationList-BLdHAQ39.js.map +0 -1
  124. package/lib/assets/index-C7jnHK4b.js +0 -4841
  125. package/lib/assets/index-C7jnHK4b.js.map +0 -1
  126. package/lib/assets/worker-Cbp2r2BQ.js +0 -18592
  127. package/lib/assets/worker-Cbp2r2BQ.js.map +0 -1
  128. package/lib/createServer-Bf5_6o6G.js.map +0 -1
  129. package/lib/index-BNx95gkf.js +0 -1284
  130. package/lib/index-BNx95gkf.js.map +0 -1
  131. package/lib/index-DyBL--Kz.js +0 -826
  132. package/lib/index-DyBL--Kz.js.map +0 -1
  133. package/lib/zudoku.openapi-worker.js +0 -15
  134. package/lib/zudoku.openapi-worker.js.map +0 -1
  135. package/src/lib/plugins/openapi/ExampleDisplay.tsx +0 -163
  136. package/src/lib/plugins/openapi/client/worker.ts +0 -44
  137. package/src/lib/plugins/openapi-worker.ts +0 -11
@@ -0,0 +1,1292 @@
1
+ var Se = Object.defineProperty;
2
+ var oe = (t) => {
3
+ throw TypeError(t);
4
+ };
5
+ var $e = (t, a, n) => a in t ? Se(t, a, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[a] = n;
6
+ var H = (t, a, n) => $e(t, typeof a != "symbol" ? a + "" : a, n), Te = (t, a, n) => a.has(t) || oe("Cannot " + n);
7
+ var J = (t, a, n) => (Te(t, a, "read from private field"), n ? n.call(t) : a.get(t)), Q = (t, a, n) => a.has(t) ? oe("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(t) : a.set(t, n);
8
+ import { j as e } from "./jsx-runtime-Dx-03ztt.js";
9
+ import { m as Pe } from "./chunk-D52XG6IA-Dl7HLe6j.js";
10
+ import { i as ke, j as le, k as Oe } from "./ZudokuContext-hmLMUdf2.js";
11
+ import { XIcon as qe, EraserIcon as ye, Check as Ie, ChevronsUpDownIcon as Ee, LogInIcon as Ve, CirclePlayIcon as Re } from "lucide-react";
12
+ import { u as ze } from "./hook-CHq7pFyz.js";
13
+ import { Button as C } from "./ui/Button.js";
14
+ import { Z as Ae } from "./invariant-Caa8-XvF.js";
15
+ import { VisuallyHidden as _e } from "@radix-ui/react-visually-hidden";
16
+ import * as v from "react";
17
+ import { useRef as ge, useEffect as ve, useState as _, useTransition as Fe, Fragment as U } from "react";
18
+ import { C as Le, a as De, b as Me, c as He, d as Je, D as Qe, e as Ue, f as Be, g as Ge } from "./Command-9x_kZHr4.js";
19
+ import { u as We, S as ie, a as ce, b as de, c as me, e as B } from "./Select-B_IxRUUC.js";
20
+ import { b as ee, C as w, u as Ze, a as Ke, F as Xe } from "./index.esm-BnnBRKJX.js";
21
+ import { a as Ye } from "./state-CFQsUZUP.js";
22
+ import { S as ue } from "./Spinner-DuxJLLNE.js";
23
+ import { Callout as et } from "./ui/Callout.js";
24
+ import { Card as X, CardHeader as tt, CardTitle as at, CardContent as nt } from "./ui/Card.js";
25
+ import { Tabs as pe, TabsList as he, TabsTrigger as q, TabsContent as I } from "./ui/Tabs.js";
26
+ import { z as st, S as rt } from "./SyntaxHighlight-Bz-lOJtH.js";
27
+ import { c as h } from "./cn-qaFjX9_3.js";
28
+ import { Input as F } from "./ui/Input.js";
29
+ import * as Y from "@radix-ui/react-checkbox";
30
+ import { c as ot } from "./index-CPNSgwSb.js";
31
+ import { Popover as lt, PopoverTrigger as it, PopoverContent as ct } from "./ui/Popover.js";
32
+ import { Slot as dt } from "@radix-ui/react-slot";
33
+ class E extends String {
34
+ constructor(n, r) {
35
+ super(n);
36
+ H(this, "__apiType");
37
+ this.value = n, this.__meta__ = r;
38
+ }
39
+ toString() {
40
+ return this.value;
41
+ }
42
+ }
43
+ const mt = new E(
44
+ `
45
+ fragment OperationsFragment on OperationItem {
46
+ slug
47
+ summary
48
+ method
49
+ description
50
+ operationId
51
+ contentTypes
52
+ path
53
+ parameters {
54
+ name
55
+ in
56
+ description
57
+ required
58
+ schema
59
+ style
60
+ examples {
61
+ name
62
+ description
63
+ externalValue
64
+ value
65
+ summary
66
+ }
67
+ }
68
+ requestBody {
69
+ content {
70
+ mediaType
71
+ encoding {
72
+ name
73
+ }
74
+ examples {
75
+ name
76
+ description
77
+ externalValue
78
+ value
79
+ summary
80
+ }
81
+ schema
82
+ }
83
+ description
84
+ required
85
+ }
86
+ responses {
87
+ statusCode
88
+ links
89
+ description
90
+ content {
91
+ examples {
92
+ name
93
+ description
94
+ externalValue
95
+ value
96
+ summary
97
+ }
98
+ mediaType
99
+ encoding {
100
+ name
101
+ }
102
+ schema
103
+ }
104
+ }
105
+ }
106
+ `,
107
+ { fragmentName: "OperationsFragment" }
108
+ ), ut = new E(`
109
+ query ServersQuery($input: JSON!, $type: SchemaType!) {
110
+ schema(input: $input, type: $type) {
111
+ url
112
+ servers {
113
+ url
114
+ }
115
+ }
116
+ }
117
+ `), pt = new E(`
118
+ query AllOperations($input: JSON!, $type: SchemaType!) {
119
+ schema(input: $input, type: $type) {
120
+ description
121
+ summary
122
+ title
123
+ url
124
+ version
125
+ tags {
126
+ name
127
+ description
128
+ operations {
129
+ slug
130
+ ...OperationsFragment
131
+ }
132
+ }
133
+ }
134
+ }
135
+ fragment OperationsFragment on OperationItem {
136
+ slug
137
+ summary
138
+ method
139
+ description
140
+ operationId
141
+ contentTypes
142
+ path
143
+ parameters {
144
+ name
145
+ in
146
+ description
147
+ required
148
+ schema
149
+ style
150
+ examples {
151
+ name
152
+ description
153
+ externalValue
154
+ value
155
+ summary
156
+ }
157
+ }
158
+ requestBody {
159
+ content {
160
+ mediaType
161
+ encoding {
162
+ name
163
+ }
164
+ examples {
165
+ name
166
+ description
167
+ externalValue
168
+ value
169
+ summary
170
+ }
171
+ schema
172
+ }
173
+ description
174
+ required
175
+ }
176
+ responses {
177
+ statusCode
178
+ links
179
+ description
180
+ content {
181
+ examples {
182
+ name
183
+ description
184
+ externalValue
185
+ value
186
+ summary
187
+ }
188
+ mediaType
189
+ encoding {
190
+ name
191
+ }
192
+ schema
193
+ }
194
+ }
195
+ }`), ht = new E(`
196
+ query getServerQuery($input: JSON!, $type: SchemaType!) {
197
+ schema(input: $input, type: $type) {
198
+ url
199
+ servers {
200
+ url
201
+ }
202
+ }
203
+ }
204
+ `), xt = new E(`
205
+ query GetCategories($input: JSON!, $type: SchemaType!) {
206
+ schema(input: $input, type: $type) {
207
+ url
208
+ tags {
209
+ __typename
210
+ name
211
+ operations {
212
+ __typename
213
+ slug
214
+ deprecated
215
+ method
216
+ summary
217
+ operationId
218
+ path
219
+ }
220
+ }
221
+ }
222
+ }
223
+ `), ft = {
224
+ "\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": ut,
225
+ "\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n parameters {\n name\n in\n description\n required\n schema\n style\n examples {\n name\n description\n externalValue\n value\n summary\n }\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n examples {\n name\n description\n externalValue\n value\n summary\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n examples {\n name\n description\n externalValue\n value\n summary\n }\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n": mt,
226
+ "\n query AllOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n description\n summary\n title\n url\n version\n tags {\n name\n description\n operations {\n slug\n ...OperationsFragment\n }\n }\n }\n }\n": pt,
227
+ "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": ht,
228
+ "\n query GetCategories($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n tags {\n __typename\n name\n operations {\n __typename\n slug\n deprecated\n method\n summary\n operationId\n path\n }\n }\n }\n }\n": xt
229
+ };
230
+ function yt(t) {
231
+ return ft[t] ?? {};
232
+ }
233
+ let G;
234
+ const gt = (t) => {
235
+ var a;
236
+ if ((a = t.errors) != null && a[0])
237
+ throw new Ae(t.errors[0].message, {
238
+ developerHint: "Check your configuration value `apis.type` and `apis.input` in the Zudoku config."
239
+ });
240
+ };
241
+ var L, D;
242
+ class vt {
243
+ constructor(a) {
244
+ Q(this, L, async () => (G || (G = import("./createServer-BznDkeSA.js").then(
245
+ (a) => a.createServer(this.config)
246
+ )), G));
247
+ Q(this, D, async (a) => this.config.server ? fetch(this.config.server, a) : (await J(this, L).call(this)).fetch("http://localhost/graphql", a));
248
+ H(this, "fetch", async (a, ...[n]) => {
249
+ var c;
250
+ const r = (c = a.match(/query (\w+)/)) == null ? void 0 : c[1], l = await J(this, D).call(this, {
251
+ method: "POST",
252
+ body: JSON.stringify({ query: a, variables: n, operationName: r }),
253
+ headers: { "Content-Type": "application/json" }
254
+ });
255
+ if (!l.ok)
256
+ throw new Error("Network response was not ok");
257
+ const o = await l.json();
258
+ return gt(o), o.data;
259
+ });
260
+ this.config = a;
261
+ }
262
+ }
263
+ L = new WeakMap(), D = new WeakMap();
264
+ const W = (t) => Math.abs(
265
+ isNaN(parseInt(t)) ? t.toLowerCase().charCodeAt(0) - 96 : isNaN(parseInt(t)) ? 0 : parseInt(t)
266
+ ), Z = (t) => t.length > 1 ? parseInt(t.split("").reduce((a, n) => `${W(a) + W(n)}`)) : W(t), xe = (t, a = {}) => {
267
+ const n = (3 * Z(t) + 2 * Z(t) + Z(t)) % 360, { saturation: r = 75, lightness: l = 60 } = a;
268
+ return `${n}deg ${r}% ${l}%`;
269
+ }, K = "data-linked-param", je = (t) => {
270
+ const { resolvedTheme: a } = st();
271
+ return {
272
+ text: xe(
273
+ t,
274
+ a === "light" ? { saturation: 95, lightness: 38 } : {}
275
+ ),
276
+ background: xe(
277
+ t,
278
+ a === "light" ? { saturation: 85, lightness: 40 } : {}
279
+ )
280
+ };
281
+ }, jt = (t) => {
282
+ const a = t.replace(/[{}]/g, "");
283
+ return je(a);
284
+ }, be = ({
285
+ name: t,
286
+ className: a,
287
+ slug: n,
288
+ title: r,
289
+ children: l,
290
+ onClick: o
291
+ }) => {
292
+ const c = ge(null), d = n == null ? void 0 : n.replace(/[{}]/g, ""), i = t.replace(/[{}]/g, ""), { text: m, background: u } = je(i), g = `hsl(${m} / 100%)`, j = `hsl(${u} / 10%)`, b = `hsl(${u} / 50%)`;
293
+ return ve(() => {
294
+ if (!d || !c.current) return;
295
+ const T = () => {
296
+ document.querySelectorAll(`[${K}="${d}"]`).forEach((x) => {
297
+ x instanceof HTMLElement && (x.dataset.active = "true");
298
+ });
299
+ }, N = () => {
300
+ document.querySelectorAll(`[${K}="${d}"]`).forEach((x) => {
301
+ x instanceof HTMLElement && (x.dataset.active = "false");
302
+ });
303
+ }, S = c.current;
304
+ return S.addEventListener("mouseenter", T), S.addEventListener("mouseleave", N), () => {
305
+ S.removeEventListener("mouseenter", T), S.removeEventListener("mouseleave", N);
306
+ };
307
+ }, [d]), /* @__PURE__ */ e.jsx(
308
+ "span",
309
+ {
310
+ [K]: d,
311
+ className: h(
312
+ "relative inline-block rounded transition-all duration-100",
313
+ "rounded-lg",
314
+ "border border-[--border-color] p-0.5 text-[--param-color] bg-[--background-color]",
315
+ "data-[active=true]:border-[--param-color] data-[active=true]:shadow data-[active=true]:-translate-y-px",
316
+ a
317
+ ),
318
+ title: r,
319
+ suppressHydrationWarning: !0,
320
+ ref: c,
321
+ onClick: o,
322
+ style: {
323
+ "--param-color": g,
324
+ "--border-color": b,
325
+ "--background-color": j
326
+ },
327
+ children: l ?? t
328
+ }
329
+ );
330
+ }, bt = (t, a, n) => {
331
+ const r = a.replace(/(:\w+|\{\w+})/g, (o) => {
332
+ var i;
333
+ const c = o.replace(/[:{}]/g, "");
334
+ return ((i = n.pathParams.find((m) => m.name === c)) == null ? void 0 : i.value) ?? o;
335
+ }), l = new URL(
336
+ r.replace(/^\//, ""),
337
+ t.endsWith("/") ? t : `${t}/`
338
+ );
339
+ return n.queryParams.filter((o) => o.active).forEach((o) => {
340
+ l.searchParams.set(o.name, o.value);
341
+ }), l;
342
+ }, Nt = ({
343
+ control: t,
344
+ register: a
345
+ }) => {
346
+ const { fields: n, append: r, remove: l } = ee({
347
+ control: t,
348
+ name: "headers"
349
+ });
350
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
351
+ /* @__PURE__ */ e.jsx("table", { className: "w-full [&_td]:border [&_td]:p-1.5 [&_td]:px-2", children: /* @__PURE__ */ e.jsx("tbody", { children: n.map((o, c) => /* @__PURE__ */ e.jsxs(
352
+ "tr",
353
+ {
354
+ className: "group has-[:focus]:bg-muted/50 hover:bg-muted/50",
355
+ children: [
356
+ /* @__PURE__ */ e.jsx("td", { className: "flex gap-2 items-center", children: /* @__PURE__ */ e.jsx(
357
+ F,
358
+ {
359
+ ...a(`headers.${c}.name`),
360
+ placeholder: "Name",
361
+ className: "border-0 shadow-none text-xs font-mono",
362
+ autoComplete: "off"
363
+ }
364
+ ) }),
365
+ /* @__PURE__ */ e.jsx("td", { children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
366
+ /* @__PURE__ */ e.jsx(
367
+ F,
368
+ {
369
+ placeholder: "Value",
370
+ className: "border-0 shadow-none text-xs font-mono",
371
+ ...a(`headers.${c}.value`),
372
+ autoComplete: "off"
373
+ }
374
+ ),
375
+ /* @__PURE__ */ e.jsx(
376
+ C,
377
+ {
378
+ size: "icon",
379
+ variant: "ghost",
380
+ className: "text-muted-foreground opacity-0 group-hover:opacity-100",
381
+ onClick: () => {
382
+ l(c);
383
+ },
384
+ type: "button",
385
+ children: /* @__PURE__ */ e.jsx(qe, { size: 16 })
386
+ }
387
+ )
388
+ ] }) })
389
+ ]
390
+ },
391
+ o.id
392
+ )) }) }),
393
+ /* @__PURE__ */ e.jsx("div", { className: "text-end", children: /* @__PURE__ */ e.jsx(
394
+ C,
395
+ {
396
+ className: "",
397
+ onClick: () => r({ name: "", value: "" }),
398
+ type: "button",
399
+ variant: "secondary",
400
+ children: "Add header"
401
+ }
402
+ ) })
403
+ ] });
404
+ }, te = v.forwardRef(({ className: t, ...a }, n) => /* @__PURE__ */ e.jsx(
405
+ "div",
406
+ {
407
+ ref: n,
408
+ className: h(
409
+ "rounded-xl border bg-card text-card-foreground shadow-sm",
410
+ t
411
+ ),
412
+ ...a
413
+ }
414
+ ));
415
+ te.displayName = "Card";
416
+ const wt = v.forwardRef(({ className: t, ...a }, n) => /* @__PURE__ */ e.jsx(
417
+ "div",
418
+ {
419
+ ref: n,
420
+ className: h("flex flex-col space-y-1.5 p-6", t),
421
+ ...a
422
+ }
423
+ ));
424
+ wt.displayName = "CardHeader";
425
+ const Ct = v.forwardRef(({ className: t, ...a }, n) => /* @__PURE__ */ e.jsx(
426
+ "h3",
427
+ {
428
+ ref: n,
429
+ className: h("font-semibold leading-none tracking-tight", t),
430
+ ...a
431
+ }
432
+ ));
433
+ Ct.displayName = "CardTitle";
434
+ const St = v.forwardRef(({ className: t, ...a }, n) => /* @__PURE__ */ e.jsx(
435
+ "p",
436
+ {
437
+ ref: n,
438
+ className: h("text-sm text-muted-foreground", t),
439
+ ...a
440
+ }
441
+ ));
442
+ St.displayName = "CardDescription";
443
+ const $t = v.forwardRef(({ className: t, ...a }, n) => /* @__PURE__ */ e.jsx("div", { ref: n, className: h("p-6 pt-0", t), ...a }));
444
+ $t.displayName = "CardContent";
445
+ const Tt = v.forwardRef(({ className: t, ...a }, n) => /* @__PURE__ */ e.jsx(
446
+ "div",
447
+ {
448
+ ref: n,
449
+ className: h("flex items-center p-6 pt-0", t),
450
+ ...a
451
+ }
452
+ ));
453
+ Tt.displayName = "CardFooter";
454
+ const Pt = ({ name: t }) => {
455
+ const a = jt(t);
456
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
457
+ /* @__PURE__ */ e.jsx(
458
+ "div",
459
+ {
460
+ className: "w-2 h-2 rounded-full",
461
+ style: { backgroundColor: `hsl(${a})` }
462
+ }
463
+ ),
464
+ /* @__PURE__ */ e.jsx(
465
+ be,
466
+ {
467
+ slug: t,
468
+ name: t,
469
+ className: "font-mono text-xs m-2 px-1"
470
+ }
471
+ )
472
+ ] });
473
+ }, kt = ({
474
+ control: t
475
+ }) => {
476
+ const { fields: a } = ee({
477
+ control: t,
478
+ name: "pathParams"
479
+ });
480
+ return /* @__PURE__ */ e.jsx(te, { className: "rounded-lg", children: /* @__PURE__ */ e.jsx("table", { className: "w-full", children: /* @__PURE__ */ e.jsx("tbody", { children: a.map((n, r) => /* @__PURE__ */ e.jsxs("tr", { className: "hover:bg-accent/40", children: [
481
+ /* @__PURE__ */ e.jsx("td", { className: "w-5/12", children: /* @__PURE__ */ e.jsx(
482
+ w,
483
+ {
484
+ control: t,
485
+ name: `pathParams.${r}.value`,
486
+ render: () => /* @__PURE__ */ e.jsx(Pt, { name: n.name })
487
+ }
488
+ ) }),
489
+ /* @__PURE__ */ e.jsx("td", { className: "w-7/12", children: /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-center", children: [
490
+ /* @__PURE__ */ e.jsx(
491
+ w,
492
+ {
493
+ control: t,
494
+ name: `pathParams.${r}.value`,
495
+ render: ({ field: l }) => /* @__PURE__ */ e.jsx(
496
+ F,
497
+ {
498
+ ...l,
499
+ required: !0,
500
+ placeholder: "Enter value",
501
+ className: "w-full border-0 shadow-none text-xs font-mono hover:bg-accent"
502
+ }
503
+ )
504
+ }
505
+ ),
506
+ /* @__PURE__ */ e.jsx(
507
+ w,
508
+ {
509
+ control: t,
510
+ name: `pathParams.${r}.value`,
511
+ render: ({ field: l }) => /* @__PURE__ */ e.jsx(
512
+ C,
513
+ {
514
+ size: "icon",
515
+ type: "button",
516
+ variant: "ghost",
517
+ "aria-label": "Clear value",
518
+ className: h(
519
+ "ms-2 mr-1",
520
+ l.value.length === 0 ? "opacity-0 pointer-events-none" : "opacity-100"
521
+ ),
522
+ title: "Clear value",
523
+ onClick: () => l.onChange(""),
524
+ children: /* @__PURE__ */ e.jsx(ye, { size: 16 })
525
+ }
526
+ )
527
+ }
528
+ )
529
+ ] }) })
530
+ ] }, n.id)) }) }) });
531
+ }, Ot = ot(
532
+ "peer h-4 w-4 shrink-0 rounded-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:text-primary",
533
+ {
534
+ variants: {
535
+ variant: {
536
+ default: "border border-primary data-[state=checked]:bg-primary",
537
+ outline: "border border-input data-[state=checked]:bg-accent"
538
+ }
539
+ },
540
+ defaultVariants: {
541
+ variant: "default"
542
+ }
543
+ }
544
+ ), Ne = v.forwardRef(({ className: t, variant: a, ...n }, r) => /* @__PURE__ */ e.jsx(
545
+ Y.Root,
546
+ {
547
+ ref: r,
548
+ className: h(Ot({ variant: a, className: t })),
549
+ ...n,
550
+ children: /* @__PURE__ */ e.jsx(
551
+ Y.Indicator,
552
+ {
553
+ className: h("flex items-center justify-center text-current"),
554
+ children: /* @__PURE__ */ e.jsx(Ie, { className: "h-4 w-4" })
555
+ }
556
+ )
557
+ }
558
+ ));
559
+ Ne.displayName = Y.Root.displayName;
560
+ const qt = ({
561
+ value: t,
562
+ enumValues: a,
563
+ onChange: n,
564
+ onValueSelected: r
565
+ }) => {
566
+ const [l, o] = _(""), [c, d] = _(!1);
567
+ return /* @__PURE__ */ e.jsxs(lt, { open: c, onOpenChange: d, children: [
568
+ /* @__PURE__ */ e.jsx(it, { asChild: !0, children: /* @__PURE__ */ e.jsx(
569
+ "button",
570
+ {
571
+ type: "button",
572
+ role: "combobox",
573
+ className: h(
574
+ "px-3 py-2 w-full border-0 shadow-none text-xs font-mono text-start hover:bg-accent/40 rounded border-transparent hover:bg-accent",
575
+ !t && "text-muted-foreground"
576
+ ),
577
+ children: t || "Select value"
578
+ }
579
+ ) }),
580
+ /* @__PURE__ */ e.jsx(
581
+ ct,
582
+ {
583
+ className: "p-0 w-[--radix-popover-trigger-width] ",
584
+ align: "start",
585
+ sideOffset: 3,
586
+ alignOffset: -3,
587
+ side: "bottom",
588
+ children: /* @__PURE__ */ e.jsxs(Le, { className: "max-h-[180px]", children: [
589
+ /* @__PURE__ */ e.jsx(
590
+ De,
591
+ {
592
+ placeholder: "Enter value",
593
+ className: "h-9 bg-transparent ",
594
+ onValueChange: o,
595
+ onKeyDown: (i) => {
596
+ i.key === "Enter" && (n(l), r(), d(!1));
597
+ }
598
+ }
599
+ ),
600
+ /* @__PURE__ */ e.jsxs(Me, { children: [
601
+ /* @__PURE__ */ e.jsxs(He, { children: [
602
+ 'Use "',
603
+ l,
604
+ '"'
605
+ ] }),
606
+ a.map((i) => /* @__PURE__ */ e.jsx(
607
+ Je,
608
+ {
609
+ value: i,
610
+ onSelect: (m) => {
611
+ n(m), r(), d(!1);
612
+ },
613
+ children: i
614
+ },
615
+ i
616
+ ))
617
+ ] })
618
+ ] })
619
+ }
620
+ )
621
+ ] });
622
+ }, It = (t, a) => {
623
+ const n = v.forwardRef(({ className: r, asChild: l, ...o }, c) => {
624
+ const d = l ? dt : t;
625
+ return v.createElement(d, {
626
+ ...o,
627
+ ref: c,
628
+ className: h(a, r)
629
+ });
630
+ });
631
+ return n.displayName = `VariantComponent(${t})`, n;
632
+ }, Et = It(
633
+ "input",
634
+ "px-2 bg-transparent h-6 font-mono text-xs m-2"
635
+ ), Vt = ({
636
+ control: t,
637
+ queryParams: a
638
+ }) => {
639
+ const { fields: n } = ee({
640
+ control: t,
641
+ name: "queryParams"
642
+ }), r = Ze(), l = a.map((d) => !!d.isRequired), c = r.watch("identity") !== A;
643
+ return /* @__PURE__ */ e.jsx(te, { className: "rounded-lg", children: /* @__PURE__ */ e.jsx("table", { className: "w-full", children: /* @__PURE__ */ e.jsx("tbody", { children: n.filter(
644
+ // TODO remove this hack for Accu or make it more generic
645
+ (d) => !(c && d.name === "apikey")
646
+ ).map((d, i) => {
647
+ const m = a.find(
648
+ (u) => u.name === d.name
649
+ );
650
+ return /* @__PURE__ */ e.jsxs("tr", { className: "hover:bg-accent/40", children: [
651
+ /* @__PURE__ */ e.jsxs("td", { className: "w-5/12 flex items-center ps-3", children: [
652
+ /* @__PURE__ */ e.jsx(
653
+ w,
654
+ {
655
+ control: t,
656
+ name: `queryParams.${i}.active`,
657
+ render: ({ field: u }) => /* @__PURE__ */ e.jsx(
658
+ Ne,
659
+ {
660
+ variant: "outline",
661
+ id: `queryParams.${i}.active`,
662
+ checked: u.value,
663
+ onCheckedChange: u.onChange
664
+ }
665
+ )
666
+ }
667
+ ),
668
+ /* @__PURE__ */ e.jsx(
669
+ w,
670
+ {
671
+ control: t,
672
+ render: ({ field: u }) => /* @__PURE__ */ e.jsx(Et, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
673
+ "label",
674
+ {
675
+ className: "flex items-center cursor-pointer gap-1",
676
+ htmlFor: `queryParams.${i}.active`,
677
+ title: l[i] ? "Required field" : void 0,
678
+ children: [
679
+ u.value,
680
+ l[i] && /* @__PURE__ */ e.jsx("sup", { children: " *" })
681
+ ]
682
+ }
683
+ ) }),
684
+ name: `queryParams.${i}.name`
685
+ }
686
+ )
687
+ ] }),
688
+ /* @__PURE__ */ e.jsx("td", { className: "w-7/12", children: /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-center", children: [
689
+ /* @__PURE__ */ e.jsx(
690
+ w,
691
+ {
692
+ control: t,
693
+ render: ({ field: u }) => {
694
+ if (!((m == null ? void 0 : m.enum) && m.enum.length > 0))
695
+ return /* @__PURE__ */ e.jsx(
696
+ F,
697
+ {
698
+ ...u,
699
+ onChange: (b) => {
700
+ u.onChange(b.target.value), b.target.value.length > 0 && r.setValue(
701
+ `queryParams.${i}.active`,
702
+ !0
703
+ );
704
+ },
705
+ placeholder: "Enter value",
706
+ className: "w-full border-0 shadow-none text-xs font-mono hover:bg-accent"
707
+ }
708
+ );
709
+ const j = m.enum ?? [];
710
+ return /* @__PURE__ */ e.jsx(
711
+ qt,
712
+ {
713
+ value: u.value,
714
+ enumValues: j,
715
+ onChange: u.onChange,
716
+ onValueSelected: () => {
717
+ r.setValue(`queryParams.${i}.active`, !0);
718
+ }
719
+ }
720
+ );
721
+ },
722
+ name: `queryParams.${i}.value`
723
+ }
724
+ ),
725
+ /* @__PURE__ */ e.jsx(
726
+ w,
727
+ {
728
+ control: t,
729
+ render: ({ field: u }) => /* @__PURE__ */ e.jsx(
730
+ C,
731
+ {
732
+ size: "icon",
733
+ type: "button",
734
+ variant: "ghost",
735
+ "aria-label": "Clear value",
736
+ className: h(
737
+ "ms-2 mr-1",
738
+ u.value.length === 0 ? "opacity-0 pointer-events-none" : "opacity-100"
739
+ ),
740
+ title: "Clear value",
741
+ onClick: () => u.onChange(""),
742
+ children: /* @__PURE__ */ e.jsx(ye, { size: 16 })
743
+ }
744
+ ),
745
+ name: `queryParams.${i}.value`
746
+ }
747
+ )
748
+ ] }) })
749
+ ] }, d.id);
750
+ }) }) }) });
751
+ }, Rt = ({
752
+ value: t,
753
+ onChange: a,
754
+ className: n,
755
+ options: r,
756
+ showChevrons: l = !0
757
+ }) => /* @__PURE__ */ e.jsxs("div", { className: "grid", children: [
758
+ /* @__PURE__ */ e.jsx(
759
+ "select",
760
+ {
761
+ className: h(
762
+ "row-start-1 col-start-1 border border-input text-foreground px-2 py-1 pe-6",
763
+ "rounded-md appearance-none bg-zinc-50 hover:bg-white dark:bg-zinc-800 hover:dark:bg-zinc-800/75",
764
+ n
765
+ ),
766
+ value: t,
767
+ onChange: a,
768
+ children: r.map((o) => /* @__PURE__ */ e.jsx("option", { value: o.value, children: o.label }, o.value))
769
+ }
770
+ ),
771
+ /* @__PURE__ */ e.jsx(
772
+ "div",
773
+ {
774
+ className: h(
775
+ !l && "hidden",
776
+ "row-start-1 col-start-1 self-center justify-self-end relative end-2 pointer-events-none"
777
+ ),
778
+ children: /* @__PURE__ */ e.jsx(Ee, { size: 14 })
779
+ }
780
+ )
781
+ ] }), zt = (t) => {
782
+ var n;
783
+ return (n = Object.entries({
784
+ "application/json": "json",
785
+ "text/json": "json",
786
+ "text/html": "html",
787
+ "text/css": "css",
788
+ "text/javascript": "javascript",
789
+ "application/xml": "xml",
790
+ "application/xhtml+xml": "xhtml"
791
+ }).find(
792
+ ([r]) => t.includes(r)
793
+ )) == null ? void 0 : n[1];
794
+ }, At = (t) => {
795
+ const a = t.get("Content-Type") || "";
796
+ return zt(a);
797
+ }, _t = (t) => {
798
+ try {
799
+ return JSON.stringify(JSON.parse(t), null, 2);
800
+ } catch {
801
+ return null;
802
+ }
803
+ }, Ft = ({
804
+ body: t = "",
805
+ headers: a
806
+ }) => {
807
+ const n = At(a), r = _t(t), l = r || t, [o, c] = _(
808
+ r ? "formatted" : "raw"
809
+ );
810
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
811
+ /* @__PURE__ */ e.jsx(X, { className: "shadow-none", children: /* @__PURE__ */ e.jsx(
812
+ rt,
813
+ {
814
+ language: o === "raw" ? r ? "plain" : n : "json",
815
+ noBackground: !0,
816
+ className: "overflow-x-auto p-4 text-xs max-h-[calc(83.333vh-180px)]",
817
+ code: o === "raw" ? t : l
818
+ }
819
+ ) }),
820
+ r && /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ e.jsx(
821
+ Rt,
822
+ {
823
+ value: o,
824
+ onChange: (d) => c(d.target.value),
825
+ options: [
826
+ { value: "formatted", label: "Formatted" },
827
+ { value: "raw", label: "Raw" }
828
+ ]
829
+ }
830
+ ) })
831
+ ] });
832
+ }, A = "__none", Lt = {
833
+ 200: "OK",
834
+ 201: "Created",
835
+ 202: "Accepted",
836
+ 204: "No Content",
837
+ 400: "Bad Request",
838
+ 401: "Unauthorized",
839
+ 403: "Forbidden",
840
+ 404: "Not Found",
841
+ 405: "Method Not Allowed",
842
+ 500: "Internal Server Error"
843
+ }, Dt = ({
844
+ server: t,
845
+ servers: a,
846
+ url: n,
847
+ method: r,
848
+ headers: l = [],
849
+ queryParams: o = [],
850
+ pathParams: c = [],
851
+ defaultBody: d = ""
852
+ }) => {
853
+ var se, re;
854
+ const { selectedServer: i, setSelectedServer: m } = Ye(), [, u] = Fe(), { register: g, control: j, handleSubmit: b, watch: T, setValue: N, ...S } = Ke({
855
+ defaultValues: {
856
+ body: d,
857
+ queryParams: o.map((s) => ({
858
+ name: s.name,
859
+ value: s.defaultValue ?? "",
860
+ active: s.defaultActive ?? !1,
861
+ enum: s.enum ?? []
862
+ })),
863
+ pathParams: c.map((s) => ({
864
+ name: s.name,
865
+ value: s.defaultValue ?? ""
866
+ })),
867
+ headers: l.map((s) => ({
868
+ name: s.name,
869
+ value: s.defaultValue ?? ""
870
+ })),
871
+ identity: A
872
+ }
873
+ }), x = T(), P = ke(), ae = ge(!1);
874
+ ve(() => {
875
+ var y;
876
+ if (ae.current) return;
877
+ const s = (y = P.data) == null ? void 0 : y.at(0);
878
+ s && (N("identity", s.id), ae.current = !0);
879
+ }, [N, P.data]);
880
+ const f = We({
881
+ mutationFn: async (s) => {
882
+ var O, $;
883
+ const y = bt(i ?? t, n, s), k = performance.now(), V = new Request(y, {
884
+ method: r.toUpperCase(),
885
+ headers: Object.fromEntries(
886
+ s.headers.filter((p) => p.name).map((p) => [p.name, p.value])
887
+ ),
888
+ body: s.body ? s.body : void 0
889
+ });
890
+ s.identity !== A && (($ = (O = P.data) == null ? void 0 : O.find((p) => p.id === s.identity)) == null || $.authorizeRequest(V));
891
+ try {
892
+ const p = await fetch(V, {
893
+ signal: AbortSignal.timeout(5e3)
894
+ }), R = performance.now() - k, z = await p.text();
895
+ return {
896
+ status: p.status,
897
+ headers: p.headers,
898
+ size: z.length,
899
+ body: z,
900
+ time: R
901
+ };
902
+ } catch (p) {
903
+ throw p instanceof TypeError ? new Error(
904
+ "The request failed, possibly due to network issues or CORS policy."
905
+ ) : p;
906
+ }
907
+ }
908
+ }), we = n.split("/").map((s, y, k) => {
909
+ var R;
910
+ const V = s.startsWith("{") && s.endsWith("}") || s.startsWith(":"), O = s.replace(/[:{}]/g, ""), $ = (R = x.pathParams.find((z) => z.name === O)) == null ? void 0 : R.value, p = /* @__PURE__ */ e.jsx(
911
+ be,
912
+ {
913
+ backgroundOpacity: "25%",
914
+ name: s,
915
+ slug: s,
916
+ title: $ ? void 0 : `Missing value for path parameter \`${O}\``,
917
+ children: $ ? encodeURIComponent($) : s
918
+ }
919
+ );
920
+ return (
921
+ // eslint-disable-next-line react/no-array-index-key
922
+ /* @__PURE__ */ e.jsxs(U, { children: [
923
+ V ? p : s,
924
+ y < k.length - 1 && "/",
925
+ /* @__PURE__ */ e.jsx("wbr", {})
926
+ ] }, s + y)
927
+ );
928
+ }), M = Array.from(((se = f.data) == null ? void 0 : se.headers.entries()) ?? []), ne = x.queryParams.filter((s) => s.active).map((s, y, k) => /* @__PURE__ */ e.jsxs(U, { children: [
929
+ s.name,
930
+ "=",
931
+ encodeURIComponent(s.value).replaceAll("%20", "+"),
932
+ y < k.length - 1 && "&",
933
+ /* @__PURE__ */ e.jsx("wbr", {})
934
+ ] }, s.name)), Ce = /* @__PURE__ */ e.jsx("div", { className: "inline-block opacity-50 hover:opacity-100 transition", children: a && a.length > 1 ? /* @__PURE__ */ e.jsxs(
935
+ ie,
936
+ {
937
+ onValueChange: (s) => {
938
+ u(() => {
939
+ m(s);
940
+ });
941
+ },
942
+ value: i,
943
+ children: [
944
+ /* @__PURE__ */ e.jsx(ce, { className: "p-0 border-none flex-row-reverse bg-transparent text-xs gap-0.5 h-auto", children: /* @__PURE__ */ e.jsx(de, {}) }),
945
+ /* @__PURE__ */ e.jsx(me, { children: a.map((s) => /* @__PURE__ */ e.jsx(B, { value: s, children: s.replace(/^https?:\/\//, "") }, s)) })
946
+ ]
947
+ }
948
+ ) : /* @__PURE__ */ e.jsx("span", { children: t.replace(/^https?:\/\//, "") }) });
949
+ return /* @__PURE__ */ e.jsx(
950
+ Xe,
951
+ {
952
+ register: g,
953
+ control: j,
954
+ handleSubmit: b,
955
+ watch: T,
956
+ setValue: N,
957
+ ...S,
958
+ children: /* @__PURE__ */ e.jsx("form", { onSubmit: b((s) => f.mutateAsync(s)), children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-[8fr_7fr] text-sm h-full", children: [
959
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 p-4 after:bg-muted-foreground/20 relative after:absolute after:w-px after:inset-0 after:left-auto", children: [
960
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-stretch", children: [
961
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-1 items-center w-full border rounded-md", children: [
962
+ /* @__PURE__ */ e.jsx("div", { className: "border-r p-2 bg-muted rounded-l-md self-stretch font-semibold font-mono", children: r.toUpperCase() }),
963
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center flex-wrap p-2 font-mono text-xs", children: [
964
+ Ce,
965
+ we,
966
+ ne.length > 0 ? "?" : "",
967
+ ne
968
+ ] })
969
+ ] }),
970
+ /* @__PURE__ */ e.jsx(C, { type: "submit", className: "h-auto flex gap-1", children: "Send" })
971
+ ] }),
972
+ /* @__PURE__ */ e.jsxs(
973
+ pe,
974
+ {
975
+ defaultValue: o.length + c.length > 0 ? "parameters" : "headers",
976
+ children: [
977
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-wrap gap-1 justify-between", children: [
978
+ /* @__PURE__ */ e.jsxs(he, { children: [
979
+ o.length + c.length > 0 && /* @__PURE__ */ e.jsx(q, { value: "parameters", children: "Parameters" }),
980
+ /* @__PURE__ */ e.jsxs(q, { value: "headers", children: [
981
+ "Headers",
982
+ " ",
983
+ x.headers.length > 0 && `(${x.headers.length})`
984
+ ] }),
985
+ /* @__PURE__ */ e.jsx(
986
+ q,
987
+ {
988
+ value: "body",
989
+ disabled: !["POST", "PUT", "PATCH", "DELETE"].includes(
990
+ r.toUpperCase()
991
+ ),
992
+ children: "Body"
993
+ }
994
+ )
995
+ ] }),
996
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-center", children: [
997
+ "Auth:",
998
+ /* @__PURE__ */ e.jsxs(
999
+ ie,
1000
+ {
1001
+ onValueChange: (s) => N("identity", s),
1002
+ value: x.identity,
1003
+ defaultValue: x.identity,
1004
+ children: [
1005
+ /* @__PURE__ */ e.jsx(ce, { className: "w-[180px] flex", children: P.isPending ? /* @__PURE__ */ e.jsx(ue, {}) : /* @__PURE__ */ e.jsx(de, {}) }),
1006
+ /* @__PURE__ */ e.jsxs(me, { align: "center", children: [
1007
+ /* @__PURE__ */ e.jsx(B, { value: A, children: "None" }),
1008
+ (re = P.data) == null ? void 0 : re.map((s) => /* @__PURE__ */ e.jsx(B, { value: s.id, children: s.label }, s.id))
1009
+ ] })
1010
+ ]
1011
+ }
1012
+ )
1013
+ ] })
1014
+ ] }),
1015
+ /* @__PURE__ */ e.jsx(I, { value: "headers", children: /* @__PURE__ */ e.jsx(Nt, { control: j, register: g }) }),
1016
+ /* @__PURE__ */ e.jsxs(I, { value: "parameters", children: [
1017
+ c.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 my-4", children: [
1018
+ /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: "Path Parameters" }),
1019
+ /* @__PURE__ */ e.jsx(kt, { control: j })
1020
+ ] }),
1021
+ o.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 my-4", children: [
1022
+ /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: "Query Parameters" }),
1023
+ /* @__PURE__ */ e.jsx(Vt, { control: j, queryParams: o })
1024
+ ] })
1025
+ ] }),
1026
+ /* @__PURE__ */ e.jsx(I, { value: "body", children: /* @__PURE__ */ e.jsx(
1027
+ "textarea",
1028
+ {
1029
+ ...g("body"),
1030
+ className: "border w-full rounded p-2 bg-muted h-40"
1031
+ }
1032
+ ) })
1033
+ ]
1034
+ }
1035
+ )
1036
+ ] }),
1037
+ /* @__PURE__ */ e.jsx("div", { className: "min-w-0 p-8 bg-muted/70", children: f.error ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
1038
+ x.pathParams.some((s) => s.value === "") && /* @__PURE__ */ e.jsx(et, { type: "caution", children: "Some path parameters are missing values. Please fill them in to ensure the request is sent correctly." }),
1039
+ /* @__PURE__ */ e.jsxs(X, { children: [
1040
+ /* @__PURE__ */ e.jsx(tt, { children: /* @__PURE__ */ e.jsx(at, { children: "Request failed" }) }),
1041
+ /* @__PURE__ */ e.jsxs(nt, { children: [
1042
+ "Error:",
1043
+ " ",
1044
+ f.error.message || String(f.error) || "Unexpected error"
1045
+ ] })
1046
+ ] })
1047
+ ] }) : f.data ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
1048
+ /* @__PURE__ */ e.jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ e.jsxs("div", { className: "flex text-xs gap-6", children: [
1049
+ /* @__PURE__ */ e.jsxs("div", { children: [
1050
+ "Status: ",
1051
+ f.data.status,
1052
+ " ",
1053
+ Lt[f.data.status] ?? ""
1054
+ ] }),
1055
+ /* @__PURE__ */ e.jsxs("div", { children: [
1056
+ "Time: ",
1057
+ f.data.time.toFixed(0),
1058
+ "ms"
1059
+ ] }),
1060
+ /* @__PURE__ */ e.jsxs("div", { children: [
1061
+ "Size: ",
1062
+ f.data.size,
1063
+ " B"
1064
+ ] })
1065
+ ] }) }),
1066
+ /* @__PURE__ */ e.jsxs(pe, { defaultValue: "response", children: [
1067
+ /* @__PURE__ */ e.jsxs(he, { children: [
1068
+ /* @__PURE__ */ e.jsx(q, { value: "response", children: "Response" }),
1069
+ /* @__PURE__ */ e.jsx(q, { value: "headers", children: M.length ? `Headers (${M.length})` : "No headers" })
1070
+ ] }),
1071
+ /* @__PURE__ */ e.jsx(I, { value: "response", children: /* @__PURE__ */ e.jsx(
1072
+ Ft,
1073
+ {
1074
+ headers: f.data.headers,
1075
+ body: f.data.body
1076
+ }
1077
+ ) }),
1078
+ /* @__PURE__ */ e.jsx(I, { value: "headers", children: /* @__PURE__ */ e.jsxs(
1079
+ X,
1080
+ {
1081
+ className: "max-h-[calc(83.333vh-140px)] overflow-y-auto grid grid-cols-2 w-full gap-2.5 font-mono text-xs shadow-none p-4",
1082
+ children: [
1083
+ /* @__PURE__ */ e.jsx("div", { className: "font-semibold", children: "Key" }),
1084
+ /* @__PURE__ */ e.jsx("div", { className: "font-semibold", children: "Value" }),
1085
+ M.map(([s, y]) => /* @__PURE__ */ e.jsxs(U, { children: [
1086
+ /* @__PURE__ */ e.jsx("div", { children: s }),
1087
+ /* @__PURE__ */ e.jsx("div", { className: "break-words", children: y })
1088
+ ] }, s))
1089
+ ]
1090
+ }
1091
+ ) })
1092
+ ] })
1093
+ ] }) : /* @__PURE__ */ e.jsx("div", { className: "grid place-items-center h-full", children: /* @__PURE__ */ e.jsx("span", { className: "text-[16px] font-semibold text-muted-foreground", children: f.isPending ? /* @__PURE__ */ e.jsx(ue, {}) : "Send a request first to see the response here" }) }) })
1094
+ ] }) })
1095
+ }
1096
+ );
1097
+ }, Mt = ({
1098
+ className: t,
1099
+ size: a = 16
1100
+ }) => /* @__PURE__ */ e.jsx(
1101
+ "svg",
1102
+ {
1103
+ xmlns: "http://www.w3.org/2000/svg",
1104
+ viewBox: "0 0 24 24",
1105
+ fill: "currentColor",
1106
+ className: t,
1107
+ width: a,
1108
+ height: a,
1109
+ children: /* @__PURE__ */ e.jsx(
1110
+ "path",
1111
+ {
1112
+ fillRule: "evenodd",
1113
+ d: "M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12Zm14.024-.983a1.125 1.125 0 0 1 0 1.966l-5.603 3.113A1.125 1.125 0 0 1 9 15.113V8.887c0-.857.921-1.4 1.671-.983l5.603 3.113Z",
1114
+ clipRule: "evenodd"
1115
+ }
1116
+ )
1117
+ }
1118
+ ), Ht = (t) => {
1119
+ const [a, n] = _(!1);
1120
+ return /* @__PURE__ */ e.jsxs(Qe, { onOpenChange: (r) => n(r), children: [
1121
+ /* @__PURE__ */ e.jsx(Ue, { asChild: !0, children: t.children ?? /* @__PURE__ */ e.jsxs("button", { className: "flex gap-1 items-center px-2 py-1 rounded-md transition text-xs bg-primary text-primary-foreground shadow-sm hover:bg-primary/80", children: [
1122
+ "Test",
1123
+ /* @__PURE__ */ e.jsx(Mt, { className: "", size: 14 })
1124
+ ] }) }),
1125
+ /* @__PURE__ */ e.jsxs(
1126
+ Be,
1127
+ {
1128
+ className: "max-w-screen-xl w-full h-5/6 overflow-auto p-0",
1129
+ "aria-describedby": void 0,
1130
+ children: [
1131
+ /* @__PURE__ */ e.jsx(_e, { children: /* @__PURE__ */ e.jsx(Ge, { children: "Playground" }) }),
1132
+ a && /* @__PURE__ */ e.jsx(Dt, { ...t })
1133
+ ]
1134
+ }
1135
+ )
1136
+ ] });
1137
+ }, fe = yt(`
1138
+ query GetCategories($input: JSON!, $type: SchemaType!) {
1139
+ schema(input: $input, type: $type) {
1140
+ url
1141
+ tags {
1142
+ __typename
1143
+ name
1144
+ operations {
1145
+ __typename
1146
+ slug
1147
+ deprecated
1148
+ method
1149
+ summary
1150
+ operationId
1151
+ path
1152
+ }
1153
+ }
1154
+ }
1155
+ }
1156
+ `), Jt = {
1157
+ get: "green",
1158
+ post: "blue",
1159
+ put: "yellow",
1160
+ delete: "red",
1161
+ patch: "purple",
1162
+ options: "gray",
1163
+ head: "gray"
1164
+ }, xa = (t) => {
1165
+ const a = le(t.navigationId ?? "/reference"), n = t.type === "file" ? Object.keys(t.input) : [], r = new vt(t);
1166
+ return {
1167
+ getHead: () => {
1168
+ if (t.type === "url" && !t.skipPreload)
1169
+ return /* @__PURE__ */ e.jsx(
1170
+ "link",
1171
+ {
1172
+ rel: "preload",
1173
+ href: t.input,
1174
+ as: "fetch",
1175
+ crossOrigin: "anonymous"
1176
+ }
1177
+ );
1178
+ if (t.server)
1179
+ return /* @__PURE__ */ e.jsx("link", { rel: "preconnect", href: t.server });
1180
+ },
1181
+ getMdxComponents: () => ({
1182
+ OpenPlaygroundButton: ({
1183
+ requireAuth: l,
1184
+ server: o,
1185
+ method: c,
1186
+ url: d,
1187
+ ...i
1188
+ }) => {
1189
+ var g;
1190
+ const m = ze(), u = Oe({
1191
+ queryFn: () => r.fetch(fe, {
1192
+ type: t.type,
1193
+ input: t.input
1194
+ }),
1195
+ enabled: !o,
1196
+ queryKey: ["playground-server"]
1197
+ });
1198
+ return l && !m.isAuthenticated ? /* @__PURE__ */ e.jsxs(
1199
+ C,
1200
+ {
1201
+ className: "gap-2 items-center",
1202
+ variant: "outline",
1203
+ onClick: m.login,
1204
+ children: [
1205
+ "Login to open in Playground ",
1206
+ /* @__PURE__ */ e.jsx(Ve, { size: 16 })
1207
+ ]
1208
+ }
1209
+ ) : /* @__PURE__ */ e.jsx(
1210
+ Ht,
1211
+ {
1212
+ url: d ?? "/",
1213
+ method: c ?? "get",
1214
+ server: o ?? ((g = u.data) == null ? void 0 : g.schema.url) ?? "https://example.com",
1215
+ ...i,
1216
+ children: /* @__PURE__ */ e.jsxs(C, { className: "gap-2 items-center", variant: "outline", children: [
1217
+ "Open in Playground ",
1218
+ /* @__PURE__ */ e.jsx(Re, { size: 16 })
1219
+ ] })
1220
+ }
1221
+ );
1222
+ }
1223
+ }),
1224
+ getSidebar: async (l) => {
1225
+ if (!Pe({ path: a, end: !1 }, l))
1226
+ return [];
1227
+ try {
1228
+ const o = n.find((i) => l === le(a, i)) ?? Object.keys(t.input).at(0), d = (await r.fetch(fe, {
1229
+ type: t.type,
1230
+ input: t.type === "file" ? t.input[o] : t.input,
1231
+ version: o
1232
+ })).schema.tags.filter((i) => i.operations.length > 0).map((i) => ({
1233
+ type: "category",
1234
+ label: i.name || "Other endpoints",
1235
+ collapsible: !0,
1236
+ collapsed: !1,
1237
+ items: i.operations.map((m) => ({
1238
+ type: "link",
1239
+ label: m.summary ?? m.path,
1240
+ href: `#${m.slug}`,
1241
+ badge: {
1242
+ label: m.method,
1243
+ color: Jt[m.method.toLowerCase()],
1244
+ invert: !0
1245
+ }
1246
+ }))
1247
+ }));
1248
+ return d.unshift({
1249
+ type: "link",
1250
+ label: "Overview",
1251
+ href: "#description"
1252
+ }), d;
1253
+ } catch {
1254
+ return [];
1255
+ }
1256
+ },
1257
+ getRoutes: () => [null, ...n].map((o) => ({
1258
+ path: a + (o ? `/${o}` : ""),
1259
+ async lazy() {
1260
+ const { OpenApiRoute: c } = await import("./Route-DYwKZ_c_.js");
1261
+ return {
1262
+ element: /* @__PURE__ */ e.jsx(
1263
+ c,
1264
+ {
1265
+ basePath: a,
1266
+ versions: n,
1267
+ client: r,
1268
+ config: t
1269
+ }
1270
+ )
1271
+ };
1272
+ },
1273
+ children: [
1274
+ {
1275
+ index: !0,
1276
+ async lazy() {
1277
+ const { OperationList: c } = await import("./OperationList-B8bHMKme.js");
1278
+ return { element: /* @__PURE__ */ e.jsx(c, {}) };
1279
+ }
1280
+ }
1281
+ ]
1282
+ }))
1283
+ };
1284
+ };
1285
+ export {
1286
+ be as C,
1287
+ Ht as P,
1288
+ Rt as S,
1289
+ yt as g,
1290
+ xa as o
1291
+ };
1292
+ //# sourceMappingURL=index-sD8L1_Dl.js.map