zudoku 0.26.1 → 0.28.0

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 (264) hide show
  1. package/dist/app/main.d.ts +1 -1
  2. package/dist/app/main.js +19 -7
  3. package/dist/app/main.js.map +1 -1
  4. package/dist/config/loader.js +1 -1
  5. package/dist/config/loader.js.map +1 -1
  6. package/dist/config/validators/InputSidebarSchema.d.ts +2 -2
  7. package/dist/config/validators/common.d.ts +67 -0
  8. package/dist/config/validators/common.js +5 -0
  9. package/dist/config/validators/common.js.map +1 -1
  10. package/dist/config/validators/validate.d.ts +29 -0
  11. package/dist/lib/components/AnchorLink.js +5 -2
  12. package/dist/lib/components/AnchorLink.js.map +1 -1
  13. package/dist/lib/components/Header.js +1 -1
  14. package/dist/lib/components/Header.js.map +1 -1
  15. package/dist/lib/components/Heading.d.ts +1 -1
  16. package/dist/lib/components/Markdown.d.ts +2 -2
  17. package/dist/lib/components/Markdown.js +3 -1
  18. package/dist/lib/components/Markdown.js.map +1 -1
  19. package/dist/lib/components/StatusPage.d.ts +7 -0
  20. package/dist/lib/components/StatusPage.js +71 -0
  21. package/dist/lib/components/StatusPage.js.map +1 -0
  22. package/dist/lib/components/SyntaxHighlight.d.ts +2 -1
  23. package/dist/lib/components/SyntaxHighlight.js +2 -2
  24. package/dist/lib/components/SyntaxHighlight.js.map +1 -1
  25. package/dist/lib/components/ThemeSwitch.js +4 -4
  26. package/dist/lib/components/ThemeSwitch.js.map +1 -1
  27. package/dist/lib/components/cache.d.ts +6 -0
  28. package/dist/lib/components/cache.js +13 -0
  29. package/dist/lib/components/cache.js.map +1 -0
  30. package/dist/lib/components/context/ViewportAnchorContext.js +16 -4
  31. package/dist/lib/components/context/ViewportAnchorContext.js.map +1 -1
  32. package/dist/lib/components/context/ZudokuContext.js +2 -1
  33. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  34. package/dist/lib/components/index.d.ts +9 -2
  35. package/dist/lib/components/index.js +3 -0
  36. package/dist/lib/components/index.js.map +1 -1
  37. package/dist/lib/components/navigation/SidebarCategory.js +3 -3
  38. package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
  39. package/dist/lib/core/RouteGuard.d.ts +1 -0
  40. package/dist/lib/core/RouteGuard.js +28 -0
  41. package/dist/lib/core/RouteGuard.js.map +1 -0
  42. package/dist/lib/core/ZudokuContext.d.ts +4 -2
  43. package/dist/lib/core/ZudokuContext.js +9 -7
  44. package/dist/lib/core/ZudokuContext.js.map +1 -1
  45. package/dist/lib/oas/graphql/circular.d.ts +3 -0
  46. package/dist/lib/oas/graphql/circular.js +27 -0
  47. package/dist/lib/oas/graphql/circular.js.map +1 -0
  48. package/dist/lib/oas/graphql/index.d.ts +1 -0
  49. package/dist/lib/oas/graphql/index.js +46 -29
  50. package/dist/lib/oas/graphql/index.js.map +1 -1
  51. package/dist/lib/oas/parser/dereference/index.d.ts +0 -1
  52. package/dist/lib/oas/parser/dereference/index.js +1 -1
  53. package/dist/lib/oas/parser/dereference/index.js.map +1 -1
  54. package/dist/lib/plugins/openapi/Endpoint.js +2 -2
  55. package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
  56. package/dist/lib/plugins/openapi/{Route.d.ts → OpenApiRoute.d.ts} +2 -1
  57. package/dist/lib/plugins/openapi/{Route.js → OpenApiRoute.js} +3 -4
  58. package/dist/lib/plugins/openapi/OpenApiRoute.js.map +1 -0
  59. package/dist/lib/plugins/openapi/OperationList.d.ts +4 -1
  60. package/dist/lib/plugins/openapi/OperationList.js +20 -14
  61. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  62. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  63. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  64. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  65. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  66. package/dist/lib/plugins/openapi/RequestBodySidecarBox.d.ts +1 -1
  67. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +2 -0
  68. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  69. package/dist/lib/plugins/openapi/Sidecar.js +3 -3
  70. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  71. package/dist/lib/plugins/openapi/SidecarExamples.js +17 -14
  72. package/dist/lib/plugins/openapi/SidecarExamples.js.map +1 -1
  73. package/dist/lib/plugins/openapi/graphql/gql.d.ts +6 -2
  74. package/dist/lib/plugins/openapi/graphql/gql.js +3 -2
  75. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  76. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +47 -26
  77. package/dist/lib/plugins/openapi/graphql/graphql.js +20 -16
  78. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  79. package/dist/lib/plugins/openapi/index.js +101 -65
  80. package/dist/lib/plugins/openapi/index.js.map +1 -1
  81. package/dist/lib/plugins/openapi/interfaces.d.ts +8 -2
  82. package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js +5 -5
  83. package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js.map +1 -1
  84. package/dist/lib/plugins/openapi/playground/Headers.js +17 -16
  85. package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
  86. package/dist/lib/plugins/openapi/playground/ParamsGrid.d.ts +5 -0
  87. package/dist/lib/plugins/openapi/playground/ParamsGrid.js +4 -0
  88. package/dist/lib/plugins/openapi/playground/ParamsGrid.js.map +1 -0
  89. package/dist/lib/plugins/openapi/playground/PathParams.js +4 -12
  90. package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
  91. package/dist/lib/plugins/openapi/playground/Playground.d.ts +13 -0
  92. package/dist/lib/plugins/openapi/playground/Playground.js +19 -31
  93. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  94. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +1 -1
  95. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
  96. package/dist/lib/plugins/openapi/playground/QueryParams.js +4 -3
  97. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
  98. package/dist/lib/plugins/openapi/playground/SubmitButton.d.ts +7 -0
  99. package/dist/lib/plugins/openapi/playground/SubmitButton.js +22 -0
  100. package/dist/lib/plugins/openapi/playground/SubmitButton.js.map +1 -0
  101. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.d.ts +7 -0
  102. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.js +11 -0
  103. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.js.map +1 -0
  104. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.d.ts +8 -0
  105. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +95 -0
  106. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js.map +1 -0
  107. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.d.ts +7 -0
  108. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js +16 -0
  109. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js.map +1 -0
  110. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.d.ts +10 -0
  111. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.js +32 -0
  112. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.js.map +1 -0
  113. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.d.ts +1 -0
  114. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.js +56 -0
  115. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.js.map +1 -0
  116. package/dist/lib/plugins/openapi/schema/SchemaComponents.js +1 -1
  117. package/dist/lib/plugins/openapi/schema/SchemaComponents.js.map +1 -1
  118. package/dist/lib/ui/Command.js +1 -1
  119. package/dist/lib/ui/Command.js.map +1 -1
  120. package/dist/lib/ui/Select.js +2 -2
  121. package/dist/lib/ui/Select.js.map +1 -1
  122. package/dist/lib/util/MdxComponents.js +2 -2
  123. package/dist/lib/util/MdxComponents.js.map +1 -1
  124. package/dist/lib/util/joinUrl.js +1 -1
  125. package/dist/lib/util/joinUrl.js.map +1 -1
  126. package/dist/lib/util/joinUrl.test.d.ts +1 -0
  127. package/dist/lib/util/joinUrl.test.js +43 -0
  128. package/dist/lib/util/joinUrl.test.js.map +1 -0
  129. package/dist/lib/util/useScrollToAnchor.d.ts +1 -0
  130. package/dist/lib/util/useScrollToAnchor.js +26 -15
  131. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  132. package/dist/vite/plugin-api.js +15 -3
  133. package/dist/vite/plugin-api.js.map +1 -1
  134. package/dist/vite/prerender.js +1 -0
  135. package/dist/vite/prerender.js.map +1 -1
  136. package/dist/zuplo/enrich-with-zuplo.js +1 -1
  137. package/dist/zuplo/enrich-with-zuplo.js.map +1 -1
  138. package/dist/zuplo/with-zuplo.d.ts +2 -1
  139. package/dist/zuplo/with-zuplo.js +3 -1
  140. package/dist/zuplo/with-zuplo.js.map +1 -1
  141. package/lib/{AuthenticationPlugin-C9SwOxkc.js → AuthenticationPlugin-Du8cLBSr.js} +3 -3
  142. package/lib/{AuthenticationPlugin-C9SwOxkc.js.map → AuthenticationPlugin-Du8cLBSr.js.map} +1 -1
  143. package/lib/{Markdown-DFN6p0J-.js → Markdown-Cyrx_JrO.js} +1195 -1185
  144. package/lib/{Markdown-DFN6p0J-.js.map → Markdown-Cyrx_JrO.js.map} +1 -1
  145. package/lib/{MdxPage-D9c4z09Q.js → MdxPage-DewragjB.js} +6 -6
  146. package/lib/{MdxPage-D9c4z09Q.js.map → MdxPage-DewragjB.js.map} +1 -1
  147. package/lib/OpenApiRoute-UrC_t0e5.js +36 -0
  148. package/lib/OpenApiRoute-UrC_t0e5.js.map +1 -0
  149. package/lib/{OperationList-DGJWDx1G.js → OperationList-D_ejrepA.js} +1970 -1957
  150. package/lib/OperationList-D_ejrepA.js.map +1 -0
  151. package/lib/{Select-D3O7wISy.js → Select-CnCZ4WhS.js} +61 -61
  152. package/lib/Select-CnCZ4WhS.js.map +1 -0
  153. package/lib/{SlotletProvider-_3zzX_g_.js → SlotletProvider-mQiPDQIH.js} +4 -4
  154. package/lib/{SlotletProvider-_3zzX_g_.js.map → SlotletProvider-mQiPDQIH.js.map} +1 -1
  155. package/lib/{SyntaxHighlight-CJCSPG1F.js → SyntaxHighlight-B0L4SC_N.js} +309 -298
  156. package/lib/SyntaxHighlight-B0L4SC_N.js.map +1 -0
  157. package/lib/{ZudokuContext-DeQZEp-x.js → ZudokuContext-BTUJPpQl.js} +257 -246
  158. package/lib/ZudokuContext-BTUJPpQl.js.map +1 -0
  159. package/lib/{chunk-SYFQ2XB5-BF5IDYrB.js → chunk-SYFQ2XB5-BPvC-soB.js} +5 -5
  160. package/lib/{chunk-SYFQ2XB5-BF5IDYrB.js.map → chunk-SYFQ2XB5-BPvC-soB.js.map} +1 -1
  161. package/lib/circular-Dgpd6AN-.js +15397 -0
  162. package/lib/circular-Dgpd6AN-.js.map +1 -0
  163. package/lib/{createServer-BcaswoFO.js → createServer-BydbkTsd.js} +3487 -5601
  164. package/lib/createServer-BydbkTsd.js.map +1 -0
  165. package/lib/{hook-BRQEDRbn.js → hook-FT3SJLe_.js} +2 -2
  166. package/lib/{hook-BRQEDRbn.js.map → hook-FT3SJLe_.js.map} +1 -1
  167. package/lib/{index-LNp6rxyU.js → index-CjJS0l4l.js} +2 -2
  168. package/lib/{index-LNp6rxyU.js.map → index-CjJS0l4l.js.map} +1 -1
  169. package/lib/index-DGugJOLc.js +1974 -0
  170. package/lib/index-DGugJOLc.js.map +1 -0
  171. package/lib/{joinUrl-BTy9bvoK.js → joinUrl-nLx9pD-Z.js} +2 -2
  172. package/lib/joinUrl-nLx9pD-Z.js.map +1 -0
  173. package/lib/ui/Command.js +27 -27
  174. package/lib/ui/Command.js.map +1 -1
  175. package/lib/ui/Select.js +2 -2
  176. package/lib/ui/Select.js.map +1 -1
  177. package/lib/{useExposedProps-CetwhZpP.js → useExposedProps-BLKFBylA.js} +2 -2
  178. package/lib/{useExposedProps-CetwhZpP.js.map → useExposedProps-BLKFBylA.js.map} +1 -1
  179. package/lib/useScrollToAnchor-eRM9tVvD.js +289 -0
  180. package/lib/useScrollToAnchor-eRM9tVvD.js.map +1 -0
  181. package/lib/zudoku.auth-clerk.js +1 -1
  182. package/lib/zudoku.auth-openid.js +4 -4
  183. package/lib/zudoku.components.js +740 -979
  184. package/lib/zudoku.components.js.map +1 -1
  185. package/lib/zudoku.plugin-api-catalog.js +4 -4
  186. package/lib/zudoku.plugin-api-keys.js +5 -5
  187. package/lib/zudoku.plugin-custom-pages.js +2 -2
  188. package/lib/zudoku.plugin-markdown.js +1 -1
  189. package/lib/zudoku.plugin-openapi.js +6 -5
  190. package/lib/zudoku.plugin-openapi.js.map +1 -1
  191. package/lib/zudoku.plugin-redirect.js +1 -1
  192. package/package.json +2 -2
  193. package/src/app/main.tsx +26 -7
  194. package/src/lib/components/AnchorLink.tsx +5 -2
  195. package/src/lib/components/Header.tsx +1 -1
  196. package/src/lib/components/Markdown.tsx +14 -15
  197. package/src/lib/components/StatusPage.tsx +91 -0
  198. package/src/lib/components/SyntaxHighlight.tsx +14 -0
  199. package/src/lib/components/ThemeSwitch.tsx +14 -15
  200. package/src/lib/components/cache.ts +15 -0
  201. package/src/lib/components/context/ViewportAnchorContext.tsx +20 -6
  202. package/src/lib/components/context/ZudokuContext.ts +3 -1
  203. package/src/lib/components/index.ts +7 -0
  204. package/src/lib/components/navigation/SidebarCategory.tsx +3 -2
  205. package/src/lib/core/RouteGuard.tsx +35 -0
  206. package/src/lib/core/ZudokuContext.ts +9 -8
  207. package/src/lib/oas/graphql/circular.ts +29 -0
  208. package/src/lib/oas/graphql/index.ts +72 -44
  209. package/src/lib/oas/parser/dereference/index.ts +1 -2
  210. package/src/lib/plugins/openapi/Endpoint.tsx +2 -2
  211. package/src/lib/plugins/openapi/{Route.tsx → OpenApiRoute.tsx} +3 -3
  212. package/src/lib/plugins/openapi/OperationList.tsx +34 -12
  213. package/src/lib/plugins/openapi/OperationListItem.tsx +0 -2
  214. package/src/lib/plugins/openapi/ParameterListItem.tsx +1 -0
  215. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +2 -0
  216. package/src/lib/plugins/openapi/Sidecar.tsx +4 -3
  217. package/src/lib/plugins/openapi/SidecarExamples.tsx +24 -24
  218. package/src/lib/plugins/openapi/graphql/gql.ts +12 -4
  219. package/src/lib/plugins/openapi/graphql/graphql.ts +66 -43
  220. package/src/lib/plugins/openapi/index.tsx +134 -82
  221. package/src/lib/plugins/openapi/interfaces.ts +11 -2
  222. package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +30 -27
  223. package/src/lib/plugins/openapi/playground/Headers.tsx +65 -65
  224. package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +8 -0
  225. package/src/lib/plugins/openapi/playground/PathParams.tsx +34 -74
  226. package/src/lib/plugins/openapi/playground/Playground.tsx +64 -116
  227. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +1 -1
  228. package/src/lib/plugins/openapi/playground/QueryParams.tsx +46 -45
  229. package/src/lib/plugins/openapi/playground/SubmitButton.tsx +75 -0
  230. package/src/lib/plugins/openapi/playground/result-panel/RequestTab.tsx +73 -0
  231. package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +210 -0
  232. package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +101 -0
  233. package/src/lib/plugins/openapi/playground/result-panel/convertToTypes.test.ts +64 -0
  234. package/src/lib/plugins/openapi/playground/result-panel/convertToTypes.ts +36 -0
  235. package/src/lib/plugins/openapi/schema/SchemaComponents.tsx +1 -1
  236. package/src/lib/ui/Command.tsx +1 -1
  237. package/src/lib/ui/Select.tsx +1 -1
  238. package/src/lib/util/MdxComponents.tsx +2 -1
  239. package/src/lib/util/joinUrl.test.ts +62 -0
  240. package/src/lib/util/joinUrl.ts +1 -1
  241. package/src/lib/util/useScrollToAnchor.ts +32 -15
  242. package/dist/lib/plugins/openapi/Route.js.map +0 -1
  243. package/dist/lib/plugins/openapi/playground/ResponseTab.d.ts +0 -4
  244. package/dist/lib/plugins/openapi/playground/ResponseTab.js +0 -42
  245. package/dist/lib/plugins/openapi/playground/ResponseTab.js.map +0 -1
  246. package/lib/AnchorLink-bObQitZv.js +0 -34
  247. package/lib/AnchorLink-bObQitZv.js.map +0 -1
  248. package/lib/OperationList-DGJWDx1G.js.map +0 -1
  249. package/lib/Route-VdmEyOD0.js +0 -35
  250. package/lib/Route-VdmEyOD0.js.map +0 -1
  251. package/lib/Select-D3O7wISy.js.map +0 -1
  252. package/lib/StaggeredRender-DgsamH_G.js +0 -17
  253. package/lib/StaggeredRender-DgsamH_G.js.map +0 -1
  254. package/lib/SyntaxHighlight-CJCSPG1F.js.map +0 -1
  255. package/lib/ZudokuContext-DeQZEp-x.js.map +0 -1
  256. package/lib/createServer-BcaswoFO.js.map +0 -1
  257. package/lib/index-Bn6Lc9tq.js +0 -9
  258. package/lib/index-Bn6Lc9tq.js.map +0 -1
  259. package/lib/index-CXRrqOIl.js +0 -1750
  260. package/lib/index-CXRrqOIl.js.map +0 -1
  261. package/lib/index-TaRXY2w1.js +0 -43
  262. package/lib/index-TaRXY2w1.js.map +0 -1
  263. package/lib/joinUrl-BTy9bvoK.js.map +0 -1
  264. package/src/lib/plugins/openapi/playground/ResponseTab.tsx +0 -76
@@ -1,1750 +0,0 @@
1
- var Ge = Object.defineProperty;
2
- var be = (t) => {
3
- throw TypeError(t);
4
- };
5
- var Je = (t, a, s) => a in t ? Ge(t, a, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[a] = s;
6
- var Z = (t, a, s) => Je(t, typeof a != "symbol" ? a + "" : a, s), Qe = (t, a, s) => a.has(t) || be("Cannot " + s);
7
- var X = (t, a, s) => (Qe(t, a, "read from private field"), s ? s.call(t) : a.get(t)), Y = (t, a, s) => a.has(t) ? be("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(t) : a.set(t, s);
8
- import { j as e } from "./jsx-runtime-Bdg6XQ1m.js";
9
- import { m as We } from "./chunk-SYFQ2XB5-BF5IDYrB.js";
10
- import { i as Ke, j as Ne, k as Ze } from "./ZudokuContext-DeQZEp-x.js";
11
- import { Circle as Xe, ChevronRightIcon as Ye, CheckIcon as et, DotIcon as tt, Check as at, Search as st, XIcon as nt, EraserIcon as rt, ChevronsUpDownIcon as ot, InfoIcon as we, LogInIcon as lt, CirclePlayIcon as it } from "lucide-react";
12
- import { u as dt } from "./hook-BRQEDRbn.js";
13
- import { Button as E } from "./ui/Button.js";
14
- import { Z as ct } from "./invariant-Caa8-XvF.js";
15
- import { VisuallyHidden as mt } from "@radix-ui/react-visually-hidden";
16
- import * as u from "react";
17
- import { useRef as V, useEffect as Re, useState as B, useTransition as ut, Fragment as ee } from "react";
18
- import { V as j, T as pt, D as ht, b as ft, a as xt, c as gt } from "./index-B7mqiOei.js";
19
- import { u as yt, S as vt, a as jt, b as bt, c as Nt, e as wt } from "./Select-D3O7wISy.js";
20
- import { b as me, u as $e, C as T, a as Ct, F as St } from "./index.esm-CrSoEshU.js";
21
- import { c as ue } from "./index-Djenk2Hj.js";
22
- import { c as d } from "./cn-qaFjX9_3.js";
23
- import * as ke from "@radix-ui/react-label";
24
- import * as L from "@radix-ui/react-radio-group";
25
- import { a as Tt } from "./state-mM7uaXTW.js";
26
- import { B as Pt, S as Rt } from "./Spinner-BlzrEEk1.js";
27
- import { Callout as $t } from "./ui/Callout.js";
28
- import { Card as U, CardHeader as kt, CardTitle as It, CardContent as Et } from "./ui/Card.js";
29
- import { Tabs as Ce, TabsList as Se, TabsTrigger as k, TabsContent as I } from "./ui/Tabs.js";
30
- import { z as Ot, S as qt } from "./SyntaxHighlight-CJCSPG1F.js";
31
- import * as x from "@radix-ui/react-dropdown-menu";
32
- import * as re from "@radix-ui/react-checkbox";
33
- import * as G from "@radix-ui/react-popover";
34
- import { PopoverAnchor as At } from "@radix-ui/react-popover";
35
- import { Input as pe } from "./ui/Input.js";
36
- import { Slot as Dt } from "@radix-ui/react-slot";
37
- class z extends String {
38
- constructor(s, r) {
39
- super(s);
40
- Z(this, "__apiType");
41
- this.value = s, this.__meta__ = r;
42
- }
43
- toString() {
44
- return this.value;
45
- }
46
- }
47
- const Vt = new z(
48
- `
49
- fragment OperationsFragment on OperationItem {
50
- slug
51
- summary
52
- method
53
- description
54
- operationId
55
- contentTypes
56
- path
57
- parameters {
58
- name
59
- in
60
- description
61
- required
62
- schema
63
- style
64
- examples {
65
- name
66
- description
67
- externalValue
68
- value
69
- summary
70
- }
71
- }
72
- requestBody {
73
- content {
74
- mediaType
75
- encoding {
76
- name
77
- }
78
- examples {
79
- name
80
- description
81
- externalValue
82
- value
83
- summary
84
- }
85
- schema
86
- }
87
- description
88
- required
89
- }
90
- responses {
91
- statusCode
92
- links
93
- description
94
- content {
95
- examples {
96
- name
97
- description
98
- externalValue
99
- value
100
- summary
101
- }
102
- mediaType
103
- encoding {
104
- name
105
- }
106
- schema
107
- }
108
- }
109
- }
110
- `,
111
- { fragmentName: "OperationsFragment" }
112
- ), Lt = new z(`
113
- query ServersQuery($input: JSON!, $type: SchemaType!) {
114
- schema(input: $input, type: $type) {
115
- url
116
- servers {
117
- url
118
- }
119
- }
120
- }
121
- `), zt = new z(`
122
- query AllOperations($input: JSON!, $type: SchemaType!) {
123
- schema(input: $input, type: $type) {
124
- description
125
- summary
126
- title
127
- url
128
- version
129
- tags {
130
- name
131
- description
132
- operations {
133
- slug
134
- ...OperationsFragment
135
- }
136
- }
137
- }
138
- }
139
- fragment OperationsFragment on OperationItem {
140
- slug
141
- summary
142
- method
143
- description
144
- operationId
145
- contentTypes
146
- path
147
- parameters {
148
- name
149
- in
150
- description
151
- required
152
- schema
153
- style
154
- examples {
155
- name
156
- description
157
- externalValue
158
- value
159
- summary
160
- }
161
- }
162
- requestBody {
163
- content {
164
- mediaType
165
- encoding {
166
- name
167
- }
168
- examples {
169
- name
170
- description
171
- externalValue
172
- value
173
- summary
174
- }
175
- schema
176
- }
177
- description
178
- required
179
- }
180
- responses {
181
- statusCode
182
- links
183
- description
184
- content {
185
- examples {
186
- name
187
- description
188
- externalValue
189
- value
190
- summary
191
- }
192
- mediaType
193
- encoding {
194
- name
195
- }
196
- schema
197
- }
198
- }
199
- }`), _t = new z(`
200
- query getServerQuery($input: JSON!, $type: SchemaType!) {
201
- schema(input: $input, type: $type) {
202
- url
203
- servers {
204
- url
205
- }
206
- }
207
- }
208
- `), Mt = new z(`
209
- query GetCategories($input: JSON!, $type: SchemaType!) {
210
- schema(input: $input, type: $type) {
211
- url
212
- tags {
213
- __typename
214
- name
215
- operations {
216
- __typename
217
- slug
218
- deprecated
219
- method
220
- summary
221
- operationId
222
- path
223
- }
224
- }
225
- }
226
- }
227
- `), Ft = {
228
- "\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": Lt,
229
- "\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": Vt,
230
- "\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": zt,
231
- "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": _t,
232
- "\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": Mt
233
- };
234
- function Ht(t) {
235
- return Ft[t] ?? {};
236
- }
237
- let te;
238
- const Ut = (t) => {
239
- var a;
240
- if ((a = t.errors) != null && a[0])
241
- throw new ct(t.errors[0].message, {
242
- developerHint: "Check your configuration value `apis.type` and `apis.input` in the Zudoku config."
243
- });
244
- };
245
- var J, Q;
246
- class Bt {
247
- constructor(a) {
248
- Y(this, J, async () => (te || (te = import("./createServer-BcaswoFO.js").then(
249
- (a) => a.createServer(this.config)
250
- )), te));
251
- Y(this, Q, async (a) => this.config.server ? fetch(this.config.server, a) : (await X(this, J).call(this)).fetch("http://localhost/graphql", a));
252
- Z(this, "fetch", async (a, ...[s]) => {
253
- var i;
254
- const r = (i = a.match(/query (\w+)/)) == null ? void 0 : i[1], o = await X(this, Q).call(this, {
255
- method: "POST",
256
- body: JSON.stringify({ query: a, variables: s, operationName: r }),
257
- headers: { "Content-Type": "application/json" }
258
- });
259
- if (!o.ok)
260
- throw new Error("Network response was not ok");
261
- const l = await o.json();
262
- return Ut(l), l.data;
263
- });
264
- this.config = a;
265
- }
266
- }
267
- J = new WeakMap(), Q = new WeakMap();
268
- const Gt = ue(
269
- "relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",
270
- {
271
- variants: {
272
- variant: {
273
- default: "bg-background text-foreground",
274
- destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
275
- }
276
- },
277
- defaultVariants: {
278
- variant: "default"
279
- }
280
- }
281
- ), oe = u.forwardRef(({ className: t, variant: a, ...s }, r) => /* @__PURE__ */ e.jsx(
282
- "div",
283
- {
284
- ref: r,
285
- role: "alert",
286
- className: d(Gt({ variant: a }), t),
287
- ...s
288
- }
289
- ));
290
- oe.displayName = "Alert";
291
- const le = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
292
- "h5",
293
- {
294
- ref: s,
295
- className: d("mb-1 font-medium leading-none tracking-tight", t),
296
- ...a
297
- }
298
- ));
299
- le.displayName = "AlertTitle";
300
- const ie = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
301
- "div",
302
- {
303
- ref: s,
304
- className: d("text-sm [&_p]:leading-relaxed", t),
305
- ...a
306
- }
307
- ));
308
- ie.displayName = "AlertDescription";
309
- const Jt = ue(
310
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
311
- ), D = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
312
- ke.Root,
313
- {
314
- ref: s,
315
- className: d(Jt(), t),
316
- ...a
317
- }
318
- ));
319
- D.displayName = ke.Root.displayName;
320
- const Ie = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
321
- L.Root,
322
- {
323
- className: d("grid gap-2", t),
324
- ...a,
325
- ref: s
326
- }
327
- ));
328
- Ie.displayName = L.Root.displayName;
329
- const de = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
330
- L.Item,
331
- {
332
- ref: s,
333
- className: d(
334
- "aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
335
- t
336
- ),
337
- ...a,
338
- children: /* @__PURE__ */ e.jsx(L.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ e.jsx(Xe, { className: "h-2.5 w-2.5 fill-current text-current" }) })
339
- }
340
- ));
341
- de.displayName = L.Item.displayName;
342
- const Ee = u.forwardRef(
343
- ({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
344
- "textarea",
345
- {
346
- className: d(
347
- "flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
348
- t
349
- ),
350
- ref: s,
351
- ...a
352
- }
353
- )
354
- );
355
- Ee.displayName = "Textarea";
356
- const ae = (t) => Math.abs(
357
- isNaN(parseInt(t)) ? t.toLowerCase().charCodeAt(0) - 96 : isNaN(parseInt(t)) ? 0 : parseInt(t)
358
- ), se = (t) => t.length > 1 ? parseInt(t.split("").reduce((a, s) => `${ae(a) + ae(s)}`)) : ae(t), Te = (t, a = {}) => {
359
- const s = (3 * se(t) + 2 * se(t) + se(t)) % 360, { saturation: r = 75, lightness: o = 60 } = a;
360
- return `${s}deg ${r}% ${o}%`;
361
- }, ne = "data-linked-param", Oe = (t) => {
362
- const { resolvedTheme: a } = Ot();
363
- return {
364
- text: Te(
365
- t,
366
- a === "light" ? { saturation: 95, lightness: 38 } : {}
367
- ),
368
- background: Te(
369
- t,
370
- a === "light" ? { saturation: 85, lightness: 40 } : {}
371
- )
372
- };
373
- }, Qt = (t) => {
374
- const a = t.replace(/[{}]/g, "");
375
- return Oe(a);
376
- }, qe = ({
377
- name: t,
378
- className: a,
379
- slug: s,
380
- title: r,
381
- children: o,
382
- onClick: l
383
- }) => {
384
- const i = V(null), p = s == null ? void 0 : s.replace(/[{}]/g, ""), c = t.replace(/[{}]/g, ""), { text: h, background: g } = Oe(c), b = `hsl(${h} / 100%)`, f = `hsl(${g} / 10%)`, m = `hsl(${g} / 50%)`;
385
- return Re(() => {
386
- if (!p || !i.current) return;
387
- const y = () => {
388
- document.querySelectorAll(`[${ne}="${p}"]`).forEach((P) => {
389
- P instanceof HTMLElement && (P.dataset.active = "true");
390
- });
391
- }, O = () => {
392
- document.querySelectorAll(`[${ne}="${p}"]`).forEach((P) => {
393
- P instanceof HTMLElement && (P.dataset.active = "false");
394
- });
395
- }, C = i.current;
396
- return C.addEventListener("mouseenter", y), C.addEventListener("mouseleave", O), () => {
397
- C.removeEventListener("mouseenter", y), C.removeEventListener("mouseleave", O);
398
- };
399
- }, [p]), /* @__PURE__ */ e.jsx(
400
- "span",
401
- {
402
- [ne]: p,
403
- className: d(
404
- "relative inline-block rounded transition-all duration-100",
405
- "rounded-lg",
406
- "border border-[--border-color] p-0.5 text-[--param-color] bg-[--background-color]",
407
- "data-[active=true]:border-[--param-color] data-[active=true]:shadow data-[active=true]:-translate-y-px",
408
- a
409
- ),
410
- title: r,
411
- suppressHydrationWarning: !0,
412
- ref: i,
413
- onClick: l,
414
- style: {
415
- "--param-color": b,
416
- "--border-color": m,
417
- "--background-color": f
418
- },
419
- children: o ?? t
420
- }
421
- );
422
- }, Wt = (t, a, s) => {
423
- const r = a.replace(/(:\w+|\{\w+})/g, (l) => {
424
- var c;
425
- const i = l.replace(/[:{}]/g, "");
426
- return ((c = s.pathParams.find((h) => h.name === i)) == null ? void 0 : c.value) ?? l;
427
- }), o = new URL(
428
- r.replace(/^\//, ""),
429
- t.endsWith("/") ? t : `${t}/`
430
- );
431
- return s.queryParams.filter((l) => l.active).forEach((l) => {
432
- o.searchParams.set(l.name, l.value);
433
- }), o;
434
- }, Kt = x.Root, Zt = x.Trigger, Xt = x.Group, Yt = u.forwardRef(({ className: t, inset: a, children: s, ...r }, o) => /* @__PURE__ */ e.jsxs(
435
- x.SubTrigger,
436
- {
437
- ref: o,
438
- className: d(
439
- "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",
440
- a && "pl-8",
441
- t
442
- ),
443
- ...r,
444
- children: [
445
- s,
446
- /* @__PURE__ */ e.jsx(Ye, { className: "ml-auto h-4 w-4" })
447
- ]
448
- }
449
- ));
450
- Yt.displayName = x.SubTrigger.displayName;
451
- const ea = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
452
- x.SubContent,
453
- {
454
- ref: s,
455
- className: d(
456
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
457
- t
458
- ),
459
- ...a
460
- }
461
- ));
462
- ea.displayName = x.SubContent.displayName;
463
- const Ae = u.forwardRef(({ className: t, sideOffset: a = 4, ...s }, r) => /* @__PURE__ */ e.jsx(x.Portal, { children: /* @__PURE__ */ e.jsx(
464
- x.Content,
465
- {
466
- ref: r,
467
- sideOffset: a,
468
- className: d(
469
- "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",
470
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
471
- t
472
- ),
473
- ...s
474
- }
475
- ) }));
476
- Ae.displayName = x.Content.displayName;
477
- const De = u.forwardRef(({ className: t, inset: a, ...s }, r) => /* @__PURE__ */ e.jsx(
478
- x.Item,
479
- {
480
- ref: r,
481
- className: d(
482
- "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
483
- a && "pl-8",
484
- t
485
- ),
486
- ...s
487
- }
488
- ));
489
- De.displayName = x.Item.displayName;
490
- const ta = u.forwardRef(({ className: t, children: a, checked: s, ...r }, o) => /* @__PURE__ */ e.jsxs(
491
- x.CheckboxItem,
492
- {
493
- ref: o,
494
- className: d(
495
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
496
- t
497
- ),
498
- checked: s,
499
- ...r,
500
- children: [
501
- /* @__PURE__ */ e.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e.jsx(x.ItemIndicator, { children: /* @__PURE__ */ e.jsx(et, { className: "h-4 w-4" }) }) }),
502
- a
503
- ]
504
- }
505
- ));
506
- ta.displayName = x.CheckboxItem.displayName;
507
- const aa = u.forwardRef(({ className: t, children: a, ...s }, r) => /* @__PURE__ */ e.jsxs(
508
- x.RadioItem,
509
- {
510
- ref: r,
511
- className: d(
512
- "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
513
- t
514
- ),
515
- ...s,
516
- children: [
517
- /* @__PURE__ */ e.jsx("span", { className: "absolute left-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ e.jsx(x.ItemIndicator, { children: /* @__PURE__ */ e.jsx(tt, { className: "h-4 w-4 fill-current" }) }) }),
518
- a
519
- ]
520
- }
521
- ));
522
- aa.displayName = x.RadioItem.displayName;
523
- const Ve = u.forwardRef(({ className: t, inset: a, ...s }, r) => /* @__PURE__ */ e.jsx(
524
- x.Label,
525
- {
526
- ref: r,
527
- className: d(
528
- "px-2 py-1.5 text-sm font-semibold",
529
- a && "pl-8",
530
- t
531
- ),
532
- ...s
533
- }
534
- ));
535
- Ve.displayName = x.Label.displayName;
536
- const Le = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
537
- x.Separator,
538
- {
539
- ref: s,
540
- className: d("-mx-1 my-1 h-px bg-muted", t),
541
- ...a
542
- }
543
- ));
544
- Le.displayName = x.Separator.displayName;
545
- const sa = ({
546
- examples: t,
547
- onSelect: a
548
- }) => /* @__PURE__ */ e.jsxs(Kt, { children: [
549
- /* @__PURE__ */ e.jsx(Zt, { asChild: !0, children: /* @__PURE__ */ e.jsx(Pt, { variant: "outline", children: "Use Example" }) }),
550
- /* @__PURE__ */ e.jsx(Ae, { className: "w-56", children: t.map((s) => {
551
- var r;
552
- return /* @__PURE__ */ e.jsxs("div", { children: [
553
- /* @__PURE__ */ e.jsx(Ve, { children: s.mediaType }),
554
- /* @__PURE__ */ e.jsx(Le, {}),
555
- /* @__PURE__ */ e.jsx(Xt, { children: (r = s.examples) == null ? void 0 : r.map((o) => /* @__PURE__ */ e.jsx(
556
- De,
557
- {
558
- onSelect: () => a(o),
559
- children: o.name
560
- },
561
- o.name
562
- )) })
563
- ] }, s.mediaType);
564
- }) })
565
- ] }), W = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
566
- "div",
567
- {
568
- ref: s,
569
- className: d(
570
- "rounded-xl border bg-card text-card-foreground shadow-sm",
571
- t
572
- ),
573
- ...a
574
- }
575
- ));
576
- W.displayName = "Card";
577
- const na = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
578
- "div",
579
- {
580
- ref: s,
581
- className: d("flex flex-col space-y-1.5 p-6", t),
582
- ...a
583
- }
584
- ));
585
- na.displayName = "CardHeader";
586
- const ra = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
587
- "h3",
588
- {
589
- ref: s,
590
- className: d("font-semibold leading-none tracking-tight", t),
591
- ...a
592
- }
593
- ));
594
- ra.displayName = "CardTitle";
595
- const oa = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
596
- "p",
597
- {
598
- ref: s,
599
- className: d("text-sm text-muted-foreground", t),
600
- ...a
601
- }
602
- ));
603
- oa.displayName = "CardDescription";
604
- const la = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx("div", { ref: s, className: d("p-6 pt-0", t), ...a }));
605
- la.displayName = "CardContent";
606
- const ia = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
607
- "div",
608
- {
609
- ref: s,
610
- className: d("flex items-center p-6 pt-0", t),
611
- ...a
612
- }
613
- ));
614
- ia.displayName = "CardFooter";
615
- const da = ue(
616
- "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",
617
- {
618
- variants: {
619
- variant: {
620
- default: "border border-primary data-[state=checked]:bg-primary",
621
- outline: "border border-input data-[state=checked]:bg-accent"
622
- }
623
- },
624
- defaultVariants: {
625
- variant: "default"
626
- }
627
- }
628
- ), he = u.forwardRef(({ className: t, variant: a, ...s }, r) => /* @__PURE__ */ e.jsx(
629
- re.Root,
630
- {
631
- ref: r,
632
- className: d(da({ variant: a, className: t })),
633
- ...s,
634
- children: /* @__PURE__ */ e.jsx(
635
- re.Indicator,
636
- {
637
- className: d("flex items-center justify-center text-current"),
638
- children: /* @__PURE__ */ e.jsx(at, { className: "h-4 w-4" })
639
- }
640
- )
641
- }
642
- ));
643
- he.displayName = re.Root.displayName;
644
- const ze = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
645
- j,
646
- {
647
- ref: s,
648
- className: d(
649
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
650
- t
651
- ),
652
- ...a
653
- }
654
- ));
655
- ze.displayName = j.displayName;
656
- const ca = u.forwardRef(({ className: t, ...a }, s) => (
657
- // eslint-disable-next-line react/no-unknown-property
658
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: [
659
- /* @__PURE__ */ e.jsx(st, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
660
- /* @__PURE__ */ e.jsx(
661
- j.Input,
662
- {
663
- ref: s,
664
- className: d(
665
- "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
666
- t
667
- ),
668
- ...a
669
- }
670
- )
671
- ] })
672
- ));
673
- ca.displayName = j.Input.displayName;
674
- const _e = u.forwardRef(({ className: t, ...a }, s) => (
675
- // eslint-disable-next-line react/no-unknown-property
676
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center", "cmdk-input-wrapper": "", children: /* @__PURE__ */ e.jsx(
677
- j.Input,
678
- {
679
- ref: s,
680
- className: d(
681
- "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
682
- "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
683
- t
684
- ),
685
- ...a
686
- }
687
- ) })
688
- ));
689
- _e.displayName = j.Input.displayName;
690
- const Me = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
691
- j.List,
692
- {
693
- ref: s,
694
- className: d("max-h-[300px] overflow-y-auto overflow-x-hidden", t),
695
- ...a
696
- }
697
- ));
698
- Me.displayName = j.List.displayName;
699
- const ma = u.forwardRef((t, a) => /* @__PURE__ */ e.jsx(
700
- j.Empty,
701
- {
702
- ref: a,
703
- className: "py-6 text-center text-sm",
704
- ...t
705
- }
706
- ));
707
- ma.displayName = j.Empty.displayName;
708
- const ua = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
709
- j.Group,
710
- {
711
- ref: s,
712
- className: d(
713
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
714
- t
715
- ),
716
- ...a
717
- }
718
- ));
719
- ua.displayName = j.Group.displayName;
720
- const pa = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
721
- j.Separator,
722
- {
723
- ref: s,
724
- className: d("-mx-1 h-px bg-border", t),
725
- ...a
726
- }
727
- ));
728
- pa.displayName = j.Separator.displayName;
729
- const Fe = u.forwardRef(({ className: t, ...a }, s) => /* @__PURE__ */ e.jsx(
730
- j.Item,
731
- {
732
- ref: s,
733
- className: d(
734
- "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
735
- t
736
- ),
737
- ...a
738
- }
739
- ));
740
- Fe.displayName = j.Item.displayName;
741
- const ha = G.Root, He = u.forwardRef(({ className: t, align: a = "center", sideOffset: s = 4, ...r }, o) => /* @__PURE__ */ e.jsx(G.Portal, { children: /* @__PURE__ */ e.jsx(
742
- G.Content,
743
- {
744
- ref: o,
745
- align: a,
746
- sideOffset: s,
747
- className: d(
748
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
749
- t
750
- ),
751
- ...r
752
- }
753
- ) }));
754
- He.displayName = G.Content.displayName;
755
- const fa = ({
756
- value: t,
757
- options: a,
758
- onChange: s,
759
- className: r,
760
- placeholder: o = "Enter value",
761
- onEnterPress: l,
762
- ref: i
763
- }) => {
764
- const [p, c] = B(!1), [h, g] = B(!1), b = pt((m) => m.filtered.count), f = V(null);
765
- return /* @__PURE__ */ e.jsxs(ha, { open: p, children: [
766
- /* @__PURE__ */ e.jsx(At, { children: /* @__PURE__ */ e.jsx(
767
- _e,
768
- {
769
- ref: (m) => {
770
- f.current = m, typeof i == "function" ? i(m) : i && (i.current = m);
771
- },
772
- value: t,
773
- placeholder: o,
774
- className: d("h-9 bg-transparent", r),
775
- onFocus: () => c(!0),
776
- onBlur: () => {
777
- h || c(!1);
778
- },
779
- onKeyDown: (m) => {
780
- var y;
781
- m.key === "Enter" && (c(!1), (y = f.current) == null || y.blur(), l == null || l(m));
782
- },
783
- onValueChange: (m) => s(m)
784
- }
785
- ) }),
786
- /* @__PURE__ */ e.jsx(
787
- He,
788
- {
789
- onMouseEnter: () => g(!0),
790
- onMouseLeave: () => g(!1),
791
- onOpenAutoFocus: (m) => m.preventDefault(),
792
- className: d("p-0 w-[--radix-popover-trigger-width]", {
793
- "border-0": b === 0
794
- }),
795
- align: "start",
796
- side: "bottom",
797
- onWheel: (m) => {
798
- m.stopPropagation();
799
- },
800
- onTouchMove: (m) => {
801
- m.stopPropagation();
802
- },
803
- children: /* @__PURE__ */ e.jsx(Me, { className: "max-h-[140px]", children: a.map((m) => /* @__PURE__ */ e.jsx(
804
- Fe,
805
- {
806
- value: m,
807
- onSelect: (y) => {
808
- s(y), c(!1);
809
- },
810
- className: "cursor-pointer",
811
- children: m
812
- },
813
- m
814
- )) })
815
- }
816
- )
817
- ] });
818
- }, ce = (t) => /* @__PURE__ */ e.jsx(ze, { className: "bg-transparent", children: /* @__PURE__ */ e.jsx(fa, { ...t }) }), xa = Object.freeze([
819
- "Accept",
820
- "Accept-Encoding",
821
- "Accept-Language",
822
- "Authorization",
823
- "Cache-Control",
824
- "Connection",
825
- "Content-Disposition",
826
- "Content-Encoding",
827
- "Content-Language",
828
- "Content-Length",
829
- "Content-Range",
830
- "Content-Security-Policy",
831
- "Content-Type",
832
- "Cookie",
833
- "Date",
834
- "ETag",
835
- "Expires",
836
- "Host",
837
- "If-Modified-Since",
838
- "Location",
839
- "Origin",
840
- "Pragma",
841
- "Referer",
842
- "Set-Cookie",
843
- "User-Agent",
844
- "X-Requested-With"
845
- ]), ga = ({
846
- control: t,
847
- register: a
848
- }) => {
849
- const { fields: s, append: r, remove: o } = me({
850
- control: t,
851
- name: "headers"
852
- }), { setValue: l } = $e(), i = V([]), p = V([]), c = () => {
853
- r({
854
- name: "",
855
- value: "",
856
- active: !1
857
- });
858
- }, h = (b) => {
859
- var f;
860
- (f = i.current[b]) == null || f.focus();
861
- }, g = (b) => {
862
- c(), requestAnimationFrame(() => {
863
- var f;
864
- return (f = p.current[b + 1]) == null ? void 0 : f.focus();
865
- });
866
- };
867
- return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
868
- /* @__PURE__ */ e.jsx(W, { className: "flex flex-col gap-2 overflow-hidden", children: /* @__PURE__ */ e.jsx("table", { className: "w-full", children: /* @__PURE__ */ e.jsx("tbody", { children: s.map((b, f) => /* @__PURE__ */ e.jsxs(
869
- "tr",
870
- {
871
- className: "group has-[:focus]:bg-muted/50 hover:bg-muted/50",
872
- children: [
873
- /* @__PURE__ */ e.jsxs("td", { className: "flex gap-2 items-center pl-3", children: [
874
- /* @__PURE__ */ e.jsx(
875
- T,
876
- {
877
- control: t,
878
- name: `headers.${f}.active`,
879
- render: ({ field: m }) => /* @__PURE__ */ e.jsx(
880
- he,
881
- {
882
- variant: "outline",
883
- id: `headers.${f}.active`,
884
- checked: m.value,
885
- onCheckedChange: (y) => {
886
- m.onChange(y);
887
- }
888
- }
889
- )
890
- }
891
- ),
892
- /* @__PURE__ */ e.jsx(
893
- T,
894
- {
895
- control: t,
896
- name: `headers.${f}.name`,
897
- render: ({ field: m }) => /* @__PURE__ */ e.jsx(
898
- ce,
899
- {
900
- ...m,
901
- placeholder: "Name",
902
- className: "border-0 shadow-none bg-transparent text-xs font-mono",
903
- options: xa,
904
- onEnterPress: () => h(f),
905
- onChange: (y) => {
906
- m.onChange(y), l(`headers.${f}.active`, !0);
907
- },
908
- ref: (y) => {
909
- p.current[f] = y;
910
- }
911
- }
912
- )
913
- }
914
- )
915
- ] }),
916
- /* @__PURE__ */ e.jsx("td", { children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
917
- /* @__PURE__ */ e.jsx(
918
- pe,
919
- {
920
- placeholder: "Value",
921
- className: "w-full border-0 shadow-none text-xs font-mono",
922
- ...a(`headers.${f}.value`),
923
- ref: (m) => {
924
- i.current[f] = m;
925
- },
926
- onKeyDown: (m) => {
927
- m.key === "Enter" && m.currentTarget.value.trim() && g(f);
928
- },
929
- autoComplete: "off"
930
- }
931
- ),
932
- /* @__PURE__ */ e.jsx(
933
- E,
934
- {
935
- size: "icon",
936
- variant: "ghost",
937
- className: "text-muted-foreground opacity-0 group-hover:opacity-100",
938
- onClick: () => {
939
- o(f);
940
- },
941
- type: "button",
942
- children: /* @__PURE__ */ e.jsx(nt, { size: 16 })
943
- }
944
- )
945
- ] }) })
946
- ]
947
- },
948
- b.id
949
- )) }) }) }),
950
- /* @__PURE__ */ e.jsx("div", { className: "text-end", children: /* @__PURE__ */ e.jsx(
951
- E,
952
- {
953
- className: "",
954
- onClick: c,
955
- type: "button",
956
- variant: "secondary",
957
- children: "Add header"
958
- }
959
- ) })
960
- ] });
961
- }, ya = ({ name: t }) => {
962
- const a = Qt(t);
963
- return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
964
- /* @__PURE__ */ e.jsx(
965
- "div",
966
- {
967
- className: "w-2 h-2 rounded-full",
968
- style: { backgroundColor: `hsl(${a})` }
969
- }
970
- ),
971
- /* @__PURE__ */ e.jsx(
972
- qe,
973
- {
974
- slug: t,
975
- name: t,
976
- className: "font-mono text-xs m-2 px-1"
977
- }
978
- )
979
- ] });
980
- }, va = ({
981
- control: t
982
- }) => {
983
- const { fields: a } = me({
984
- control: t,
985
- name: "pathParams"
986
- });
987
- return /* @__PURE__ */ e.jsx(W, { className: "rounded-lg", children: /* @__PURE__ */ e.jsx("table", { className: "w-full", children: /* @__PURE__ */ e.jsx("tbody", { children: a.map((s, r) => /* @__PURE__ */ e.jsxs("tr", { className: "hover:bg-accent/40", children: [
988
- /* @__PURE__ */ e.jsx("td", { className: "w-5/12", children: /* @__PURE__ */ e.jsx(
989
- T,
990
- {
991
- control: t,
992
- name: `pathParams.${r}.value`,
993
- render: () => /* @__PURE__ */ e.jsx(ya, { name: s.name })
994
- }
995
- ) }),
996
- /* @__PURE__ */ e.jsx("td", { className: "w-7/12", children: /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between items-center", children: [
997
- /* @__PURE__ */ e.jsx(
998
- T,
999
- {
1000
- control: t,
1001
- name: `pathParams.${r}.value`,
1002
- render: ({ field: o }) => /* @__PURE__ */ e.jsx(
1003
- pe,
1004
- {
1005
- ...o,
1006
- required: !0,
1007
- placeholder: "Enter value",
1008
- className: "w-full border-0 shadow-none text-xs font-mono hover:bg-accent"
1009
- }
1010
- )
1011
- }
1012
- ),
1013
- /* @__PURE__ */ e.jsx(
1014
- T,
1015
- {
1016
- control: t,
1017
- name: `pathParams.${r}.value`,
1018
- render: ({ field: o }) => /* @__PURE__ */ e.jsx(
1019
- E,
1020
- {
1021
- size: "icon",
1022
- type: "button",
1023
- variant: "ghost",
1024
- "aria-label": "Clear value",
1025
- className: d(
1026
- "ms-2 mr-1",
1027
- o.value.length === 0 ? "opacity-0 pointer-events-none" : "opacity-100"
1028
- ),
1029
- title: "Clear value",
1030
- onClick: () => o.onChange(""),
1031
- children: /* @__PURE__ */ e.jsx(rt, { size: 16 })
1032
- }
1033
- )
1034
- }
1035
- )
1036
- ] }) })
1037
- ] }, s.id)) }) }) });
1038
- }, ja = (t, a) => {
1039
- const s = u.forwardRef(({ className: r, asChild: o, ...l }, i) => {
1040
- const p = o ? Dt : t;
1041
- return u.createElement(p, {
1042
- ...l,
1043
- ref: i,
1044
- className: d(a, r)
1045
- });
1046
- });
1047
- return s.displayName = `VariantComponent(${t})`, s;
1048
- }, ba = ja(
1049
- "input",
1050
- "px-2 bg-transparent h-6 font-mono text-xs m-2"
1051
- ), Na = ({
1052
- control: t,
1053
- queryParams: a
1054
- }) => {
1055
- const { fields: s } = me({
1056
- control: t,
1057
- name: "queryParams"
1058
- }), r = $e(), o = a.map((l) => !!l.isRequired);
1059
- return /* @__PURE__ */ e.jsx(W, { className: "rounded-lg", children: /* @__PURE__ */ e.jsx("div", { className: "w-full ", children: s.map((l, i) => {
1060
- const p = a.find(
1061
- (c) => c.name === l.name
1062
- );
1063
- return /* @__PURE__ */ e.jsxs(
1064
- "div",
1065
- {
1066
- className: "hover:bg-accent/40 grid grid-cols-[min-content_1fr_1fr] gap-2 items-center px-3",
1067
- children: [
1068
- /* @__PURE__ */ e.jsx(
1069
- T,
1070
- {
1071
- control: t,
1072
- name: `queryParams.${i}.active`,
1073
- render: ({ field: c }) => /* @__PURE__ */ e.jsx(
1074
- he,
1075
- {
1076
- variant: "outline",
1077
- id: `queryParams.${i}.active`,
1078
- className: "mr-2",
1079
- checked: c.value,
1080
- onCheckedChange: c.onChange
1081
- }
1082
- )
1083
- }
1084
- ),
1085
- /* @__PURE__ */ e.jsx(
1086
- T,
1087
- {
1088
- control: t,
1089
- render: ({ field: c }) => o[i] ? /* @__PURE__ */ e.jsx(ba, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
1090
- "label",
1091
- {
1092
- className: "flex items-center cursor-pointer gap-1",
1093
- htmlFor: `queryParams.${i}.active`,
1094
- title: o[i] ? "Required field" : void 0,
1095
- children: [
1096
- c.value,
1097
- o[i] && /* @__PURE__ */ e.jsx("sup", { children: " *" })
1098
- ]
1099
- }
1100
- ) }) : /* @__PURE__ */ e.jsx(
1101
- ce,
1102
- {
1103
- value: c.value,
1104
- options: a.map((h) => h.name),
1105
- onChange: (h) => {
1106
- c.onChange(h);
1107
- },
1108
- className: "border-0 font-mono text-xs bg-transparent hover:bg-transparent"
1109
- }
1110
- ),
1111
- name: `queryParams.${i}.name`
1112
- }
1113
- ),
1114
- /* @__PURE__ */ e.jsx("div", { className: "flex justify-between items-center", children: /* @__PURE__ */ e.jsx(
1115
- T,
1116
- {
1117
- control: t,
1118
- render: ({ field: c }) => (p == null ? void 0 : p.enum) && p.enum.length > 0 ? /* @__PURE__ */ e.jsx(
1119
- ce,
1120
- {
1121
- value: c.value,
1122
- options: p.enum ?? [],
1123
- onChange: (g) => {
1124
- c.onChange(g), r.setValue(`queryParams.${i}.active`, !0);
1125
- },
1126
- className: "font-mono text-xs border-0 ring-1 ring-ring"
1127
- }
1128
- ) : /* @__PURE__ */ e.jsx(
1129
- pe,
1130
- {
1131
- ...c,
1132
- onChange: (g) => {
1133
- c.onChange(g.target.value), g.target.value.length > 0 && r.setValue(`queryParams.${i}.active`, !0);
1134
- },
1135
- placeholder: "Enter value",
1136
- className: "w-full border-0 shadow-none text-xs font-mono"
1137
- }
1138
- ),
1139
- name: `queryParams.${i}.value`
1140
- }
1141
- ) })
1142
- ]
1143
- },
1144
- l.id
1145
- );
1146
- }) }) });
1147
- }, wa = ({
1148
- value: t,
1149
- onChange: a,
1150
- className: s,
1151
- options: r,
1152
- showChevrons: o = !0
1153
- }) => /* @__PURE__ */ e.jsxs("div", { className: "grid", children: [
1154
- /* @__PURE__ */ e.jsx(
1155
- "select",
1156
- {
1157
- className: d(
1158
- "row-start-1 col-start-1 border border-input text-foreground px-2 py-1 pe-6",
1159
- "rounded-md appearance-none bg-zinc-50 hover:bg-white dark:bg-zinc-800 hover:dark:bg-zinc-800/75",
1160
- s
1161
- ),
1162
- value: t,
1163
- onChange: a,
1164
- children: r.map((l) => /* @__PURE__ */ e.jsx("option", { value: l.value, children: l.label }, l.value))
1165
- }
1166
- ),
1167
- /* @__PURE__ */ e.jsx(
1168
- "div",
1169
- {
1170
- className: d(
1171
- !o && "hidden",
1172
- "row-start-1 col-start-1 self-center justify-self-end relative end-2 pointer-events-none"
1173
- ),
1174
- children: /* @__PURE__ */ e.jsx(ot, { size: 14 })
1175
- }
1176
- )
1177
- ] }), Ca = (t) => {
1178
- var s;
1179
- return (s = Object.entries({
1180
- "application/json": "json",
1181
- "text/json": "json",
1182
- "text/html": "html",
1183
- "text/css": "css",
1184
- "text/javascript": "javascript",
1185
- "application/xml": "xml",
1186
- "application/xhtml+xml": "xhtml"
1187
- }).find(
1188
- ([r]) => t.includes(r)
1189
- )) == null ? void 0 : s[1];
1190
- }, Sa = (t) => {
1191
- const a = t.get("Content-Type") || "";
1192
- return Ca(a);
1193
- }, Ta = (t) => {
1194
- try {
1195
- return JSON.stringify(JSON.parse(t), null, 2);
1196
- } catch {
1197
- return null;
1198
- }
1199
- }, Pa = ({
1200
- body: t = "",
1201
- headers: a
1202
- }) => {
1203
- const s = Sa(a), r = Ta(t), o = r || t, [l, i] = B(
1204
- r ? "formatted" : "raw"
1205
- );
1206
- return /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
1207
- /* @__PURE__ */ e.jsx(U, { className: "shadow-none", children: /* @__PURE__ */ e.jsx(
1208
- qt,
1209
- {
1210
- language: l === "raw" ? r ? "plain" : s : "json",
1211
- noBackground: !0,
1212
- className: "overflow-x-auto p-4 text-xs max-h-[calc(83.333vh-180px)]",
1213
- code: l === "raw" ? t : o
1214
- }
1215
- ) }),
1216
- r && /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ e.jsx(
1217
- wa,
1218
- {
1219
- value: l,
1220
- onChange: (p) => i(p.target.value),
1221
- options: [
1222
- { value: "formatted", label: "Formatted" },
1223
- { value: "raw", label: "Raw" }
1224
- ]
1225
- }
1226
- ) })
1227
- ] });
1228
- }, H = "__none", Ra = {
1229
- 200: "OK",
1230
- 201: "Created",
1231
- 202: "Accepted",
1232
- 204: "No Content",
1233
- 400: "Bad Request",
1234
- 401: "Unauthorized",
1235
- 403: "Forbidden",
1236
- 404: "Not Found",
1237
- 405: "Method Not Allowed",
1238
- 500: "Internal Server Error"
1239
- }, $a = ({
1240
- server: t,
1241
- servers: a,
1242
- url: s,
1243
- method: r,
1244
- headers: o = [],
1245
- queryParams: l = [],
1246
- pathParams: i = [],
1247
- defaultBody: p = "",
1248
- examples: c
1249
- }) => {
1250
- var ge, ye, ve, je;
1251
- const { selectedServer: h, setSelectedServer: g } = Tt(), [, b] = ut(), { register: f, control: m, handleSubmit: y, watch: O, setValue: C, ...P } = Ct({
1252
- defaultValues: {
1253
- body: p,
1254
- queryParams: l.map((n) => ({
1255
- name: n.name,
1256
- value: n.defaultValue ?? "",
1257
- active: n.defaultActive ?? !1,
1258
- enum: n.enum ?? []
1259
- })).concat([
1260
- {
1261
- name: "",
1262
- value: "",
1263
- active: !1,
1264
- enum: []
1265
- }
1266
- ]),
1267
- pathParams: i.map((n) => ({
1268
- name: n.name,
1269
- value: n.defaultValue ?? ""
1270
- })),
1271
- headers: o.map((n) => ({
1272
- name: n.name,
1273
- value: n.defaultValue ?? "",
1274
- active: n.defaultActive ?? !1
1275
- })).concat([
1276
- {
1277
- name: "",
1278
- value: "",
1279
- active: !1
1280
- }
1281
- ]),
1282
- identity: H
1283
- }
1284
- }), S = O(), R = Ke(), fe = V(!1);
1285
- Re(() => {
1286
- var w;
1287
- if (fe.current) return;
1288
- const n = (w = R.data) == null ? void 0 : w.at(0);
1289
- n && (C("identity", n.id), fe.current = !0);
1290
- }, [C, R.data]);
1291
- const N = yt({
1292
- mutationFn: async (n) => {
1293
- var A, $;
1294
- const w = Wt(h ?? t, s, n), q = performance.now(), _ = new Request(w, {
1295
- method: r.toUpperCase(),
1296
- headers: Object.fromEntries(
1297
- n.headers.filter((v) => v.name && v.active).map((v) => [v.name, v.value])
1298
- ),
1299
- body: n.body ? n.body : void 0
1300
- });
1301
- n.identity !== H && (($ = (A = R.data) == null ? void 0 : A.find((v) => v.id === n.identity)) == null || $.authorizeRequest(_));
1302
- try {
1303
- const v = await fetch(_, {
1304
- signal: AbortSignal.timeout(5e3)
1305
- }), M = performance.now() - q, F = await v.text();
1306
- return {
1307
- status: v.status,
1308
- headers: v.headers,
1309
- size: F.length,
1310
- body: F,
1311
- time: M
1312
- };
1313
- } catch (v) {
1314
- throw v instanceof TypeError ? new Error(
1315
- "The request failed, possibly due to network issues or CORS policy."
1316
- ) : v;
1317
- }
1318
- }
1319
- }), Ue = s.split("/").map((n, w, q) => {
1320
- var M;
1321
- const _ = n.startsWith("{") && n.endsWith("}") || n.startsWith(":"), A = n.replace(/[:{}]/g, ""), $ = (M = S.pathParams.find((F) => F.name === A)) == null ? void 0 : M.value, v = /* @__PURE__ */ e.jsx(
1322
- qe,
1323
- {
1324
- backgroundOpacity: "25%",
1325
- name: n,
1326
- slug: n,
1327
- title: $ ? void 0 : `Missing value for path parameter \`${A}\``,
1328
- children: $ ? encodeURIComponent($) : n
1329
- }
1330
- );
1331
- return (
1332
- // eslint-disable-next-line react/no-array-index-key
1333
- /* @__PURE__ */ e.jsxs(ee, { children: [
1334
- _ ? v : n,
1335
- w < q.length - 1 && "/",
1336
- /* @__PURE__ */ e.jsx("wbr", {})
1337
- ] }, n + w)
1338
- );
1339
- }), K = Array.from(((ge = N.data) == null ? void 0 : ge.headers.entries()) ?? []), xe = S.queryParams.filter((n) => n.active).map((n, w, q) => /* @__PURE__ */ e.jsxs(ee, { children: [
1340
- n.name,
1341
- "=",
1342
- encodeURIComponent(n.value).replaceAll("%20", "+"),
1343
- w < q.length - 1 && "&",
1344
- /* @__PURE__ */ e.jsx("wbr", {})
1345
- ] }, n.name)), Be = /* @__PURE__ */ e.jsx("div", { className: "inline-block opacity-50 hover:opacity-100 transition", children: a && a.length > 1 ? /* @__PURE__ */ e.jsxs(
1346
- vt,
1347
- {
1348
- onValueChange: (n) => {
1349
- b(() => {
1350
- g(n);
1351
- });
1352
- },
1353
- value: h,
1354
- defaultValue: h,
1355
- children: [
1356
- /* @__PURE__ */ e.jsx(jt, { className: "p-0 border-none flex-row-reverse bg-transparent text-xs gap-0.5 h-auto", children: /* @__PURE__ */ e.jsx(bt, {}) }),
1357
- /* @__PURE__ */ e.jsx(Nt, { children: a.map((n) => /* @__PURE__ */ e.jsx(wt, { value: n, children: n.replace(/^https?:\/\//, "") }, n)) })
1358
- ]
1359
- }
1360
- ) : /* @__PURE__ */ e.jsx("span", { children: t.replace(/^https?:\/\//, "") }) });
1361
- return /* @__PURE__ */ e.jsx(
1362
- St,
1363
- {
1364
- register: f,
1365
- control: m,
1366
- handleSubmit: y,
1367
- watch: O,
1368
- setValue: C,
1369
- ...P,
1370
- children: /* @__PURE__ */ e.jsx("form", { onSubmit: y((n) => N.mutateAsync(n)), children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-[8fr_7fr] text-sm h-full", children: [
1371
- /* @__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: [
1372
- /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-stretch", children: [
1373
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-1 items-center w-full border rounded-md", children: [
1374
- /* @__PURE__ */ e.jsx("div", { className: "border-r p-2 bg-muted rounded-l-md self-stretch font-semibold font-mono flex items-center", children: r.toUpperCase() }),
1375
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center flex-wrap p-2 font-mono text-xs", children: [
1376
- Be,
1377
- Ue,
1378
- xe.length > 0 ? "?" : "",
1379
- xe
1380
- ] })
1381
- ] }),
1382
- /* @__PURE__ */ e.jsx(E, { type: "submit", className: "h-auto flex gap-1", children: "Send" })
1383
- ] }),
1384
- /* @__PURE__ */ e.jsxs(Ce, { defaultValue: "parameters", children: [
1385
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-wrap gap-1 justify-between", children: /* @__PURE__ */ e.jsxs(Se, { children: [
1386
- /* @__PURE__ */ e.jsxs(k, { value: "parameters", children: [
1387
- "Parameters",
1388
- (S.pathParams.some((n) => n.value !== "") || S.queryParams.some((n) => n.active)) && /* @__PURE__ */ e.jsx("div", { className: "w-2 h-2 rounded-full bg-blue-400 ml-2" })
1389
- ] }),
1390
- /* @__PURE__ */ e.jsxs(k, { value: "headers", children: [
1391
- "Headers",
1392
- S.headers.filter((n) => n.active).length > 0 && /* @__PURE__ */ e.jsx("div", { className: "w-2 h-2 rounded-full bg-blue-400 ml-2" })
1393
- ] }),
1394
- /* @__PURE__ */ e.jsxs(k, { value: "auth", children: [
1395
- "Auth",
1396
- S.identity !== H && /* @__PURE__ */ e.jsx("div", { className: "w-2 h-2 rounded-full bg-blue-400 ml-2" })
1397
- ] }),
1398
- /* @__PURE__ */ e.jsx(k, { value: "body", children: "Body" })
1399
- ] }) }),
1400
- /* @__PURE__ */ e.jsx(I, { value: "headers", children: /* @__PURE__ */ e.jsx(ga, { control: m, register: f }) }),
1401
- /* @__PURE__ */ e.jsxs(I, { value: "parameters", children: [
1402
- i.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 my-4", children: [
1403
- /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: "Path Parameters" }),
1404
- /* @__PURE__ */ e.jsx(va, { control: m })
1405
- ] }),
1406
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 my-4", children: [
1407
- /* @__PURE__ */ e.jsx("span", { className: "font-semibold", children: "Query Parameters" }),
1408
- /* @__PURE__ */ e.jsx(Na, { control: m, queryParams: l })
1409
- ] })
1410
- ] }),
1411
- /* @__PURE__ */ e.jsxs(I, { value: "body", children: [
1412
- !["POST", "PUT", "PATCH", "DELETE"].includes(
1413
- r.toUpperCase()
1414
- ) && /* @__PURE__ */ e.jsxs(oe, { className: "mb-2", children: [
1415
- /* @__PURE__ */ e.jsx(we, { className: "w-4 h-4" }),
1416
- /* @__PURE__ */ e.jsx(le, { children: "Body" }),
1417
- /* @__PURE__ */ e.jsx(ie, { children: "Body is only supported for POST, PUT, PATCH, and DELETE requests" })
1418
- ] }),
1419
- /* @__PURE__ */ e.jsx(
1420
- Ee,
1421
- {
1422
- ...f("body"),
1423
- className: d(
1424
- "border w-full rounded-lg p-2 bg-muted h-40 font-mono",
1425
- !["POST", "PUT", "PATCH", "DELETE"].includes(
1426
- r.toUpperCase()
1427
- ) && "h-20"
1428
- ),
1429
- placeholder: ["POST", "PUT", "PATCH", "DELETE"].includes(
1430
- r.toUpperCase()
1431
- ) ? void 0 : "This request does not support a body",
1432
- disabled: !["POST", "PUT", "PATCH", "DELETE"].includes(
1433
- r.toUpperCase()
1434
- )
1435
- }
1436
- ),
1437
- c && /* @__PURE__ */ e.jsx(
1438
- sa,
1439
- {
1440
- examples: c,
1441
- onSelect: (n) => C("body", JSON.stringify(n.value, null, 2))
1442
- }
1443
- )
1444
- ] }),
1445
- /* @__PURE__ */ e.jsx(I, { value: "auth", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-4 my-4", children: [
1446
- ((ye = R.data) == null ? void 0 : ye.length) === 0 && /* @__PURE__ */ e.jsxs(oe, { children: [
1447
- /* @__PURE__ */ e.jsx(we, { className: "w-4 h-4" }),
1448
- /* @__PURE__ */ e.jsx(le, { children: "Authentication" }),
1449
- /* @__PURE__ */ e.jsx(ie, { children: "No identities found. Please create an identity first." })
1450
- ] }),
1451
- /* @__PURE__ */ e.jsx("div", { className: "flex flex-col items-center gap-2", children: /* @__PURE__ */ e.jsx(U, { className: "w-full overflow-hidden", children: /* @__PURE__ */ e.jsxs(
1452
- Ie,
1453
- {
1454
- onValueChange: (n) => C("identity", n),
1455
- value: S.identity,
1456
- defaultValue: S.identity,
1457
- className: "gap-0",
1458
- disabled: ((ve = R.data) == null ? void 0 : ve.length) === 0,
1459
- children: [
1460
- /* @__PURE__ */ e.jsxs(
1461
- D,
1462
- {
1463
- className: "h-12 border-b items-center flex p-4 cursor-pointer hover:bg-accent",
1464
- htmlFor: "none",
1465
- children: [
1466
- /* @__PURE__ */ e.jsx(de, { value: H, id: "none", children: "None" }),
1467
- /* @__PURE__ */ e.jsx(D, { htmlFor: "none", className: "ml-2", children: "None" })
1468
- ]
1469
- }
1470
- ),
1471
- (je = R.data) == null ? void 0 : je.map((n) => /* @__PURE__ */ e.jsxs(
1472
- D,
1473
- {
1474
- className: "h-12 border-b items-center flex p-4 cursor-pointer hover:bg-accent",
1475
- children: [
1476
- /* @__PURE__ */ e.jsx(
1477
- de,
1478
- {
1479
- value: n.id,
1480
- id: n.id,
1481
- children: n.label
1482
- }
1483
- ),
1484
- /* @__PURE__ */ e.jsx(D, { htmlFor: n.id, className: "ml-2", children: n.label })
1485
- ]
1486
- },
1487
- n.id
1488
- ))
1489
- ]
1490
- }
1491
- ) }) })
1492
- ] }) })
1493
- ] })
1494
- ] }),
1495
- /* @__PURE__ */ e.jsx("div", { className: "min-w-0 p-8 bg-muted/70", children: N.error ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
1496
- S.pathParams.some((n) => n.value === "") && /* @__PURE__ */ e.jsx($t, { type: "caution", children: "Some path parameters are missing values. Please fill them in to ensure the request is sent correctly." }),
1497
- /* @__PURE__ */ e.jsxs(U, { children: [
1498
- /* @__PURE__ */ e.jsx(kt, { children: /* @__PURE__ */ e.jsx(It, { children: "Request failed" }) }),
1499
- /* @__PURE__ */ e.jsxs(Et, { children: [
1500
- "Error:",
1501
- " ",
1502
- N.error.message || String(N.error) || "Unexpected error"
1503
- ] })
1504
- ] })
1505
- ] }) : N.data ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-2", children: [
1506
- /* @__PURE__ */ e.jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ e.jsxs("div", { className: "flex text-xs gap-6", children: [
1507
- /* @__PURE__ */ e.jsxs("div", { children: [
1508
- "Status: ",
1509
- N.data.status,
1510
- " ",
1511
- Ra[N.data.status] ?? ""
1512
- ] }),
1513
- /* @__PURE__ */ e.jsxs("div", { children: [
1514
- "Time: ",
1515
- N.data.time.toFixed(0),
1516
- "ms"
1517
- ] }),
1518
- /* @__PURE__ */ e.jsxs("div", { children: [
1519
- "Size: ",
1520
- N.data.size,
1521
- " B"
1522
- ] })
1523
- ] }) }),
1524
- /* @__PURE__ */ e.jsxs(Ce, { defaultValue: "response", children: [
1525
- /* @__PURE__ */ e.jsxs(Se, { children: [
1526
- /* @__PURE__ */ e.jsx(k, { value: "response", children: "Response" }),
1527
- /* @__PURE__ */ e.jsx(k, { value: "headers", children: K.length ? `Headers (${K.length})` : "No headers" })
1528
- ] }),
1529
- /* @__PURE__ */ e.jsx(I, { value: "response", children: /* @__PURE__ */ e.jsx(
1530
- Pa,
1531
- {
1532
- headers: N.data.headers,
1533
- body: N.data.body
1534
- }
1535
- ) }),
1536
- /* @__PURE__ */ e.jsx(I, { value: "headers", children: /* @__PURE__ */ e.jsxs(
1537
- U,
1538
- {
1539
- 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",
1540
- children: [
1541
- /* @__PURE__ */ e.jsx("div", { className: "font-semibold", children: "Key" }),
1542
- /* @__PURE__ */ e.jsx("div", { className: "font-semibold", children: "Value" }),
1543
- K.map(([n, w]) => /* @__PURE__ */ e.jsxs(ee, { children: [
1544
- /* @__PURE__ */ e.jsx("div", { children: n }),
1545
- /* @__PURE__ */ e.jsx("div", { className: "break-words", children: w })
1546
- ] }, n))
1547
- ]
1548
- }
1549
- ) })
1550
- ] })
1551
- ] }) : /* @__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: N.isPending ? /* @__PURE__ */ e.jsx(Rt, {}) : "Send a request first to see the response here" }) }) })
1552
- ] }) })
1553
- }
1554
- );
1555
- }, ka = ({
1556
- className: t,
1557
- size: a = 16
1558
- }) => /* @__PURE__ */ e.jsx(
1559
- "svg",
1560
- {
1561
- xmlns: "http://www.w3.org/2000/svg",
1562
- viewBox: "0 0 24 24",
1563
- fill: "currentColor",
1564
- className: t,
1565
- width: a,
1566
- height: a,
1567
- children: /* @__PURE__ */ e.jsx(
1568
- "path",
1569
- {
1570
- fillRule: "evenodd",
1571
- 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",
1572
- clipRule: "evenodd"
1573
- }
1574
- )
1575
- }
1576
- ), Ia = (t) => {
1577
- const [a, s] = B(!1);
1578
- return /* @__PURE__ */ e.jsxs(ht, { onOpenChange: (r) => s(r), children: [
1579
- /* @__PURE__ */ e.jsx(ft, { 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: [
1580
- "Test",
1581
- /* @__PURE__ */ e.jsx(ka, { className: "", size: 14 })
1582
- ] }) }),
1583
- /* @__PURE__ */ e.jsxs(
1584
- xt,
1585
- {
1586
- className: "max-w-screen-xl w-full h-5/6 overflow-auto p-0",
1587
- "aria-describedby": void 0,
1588
- children: [
1589
- /* @__PURE__ */ e.jsx(mt, { children: /* @__PURE__ */ e.jsx(gt, { children: "Playground" }) }),
1590
- a && /* @__PURE__ */ e.jsx($a, { ...t })
1591
- ]
1592
- }
1593
- )
1594
- ] });
1595
- }, Pe = Ht(`
1596
- query GetCategories($input: JSON!, $type: SchemaType!) {
1597
- schema(input: $input, type: $type) {
1598
- url
1599
- tags {
1600
- __typename
1601
- name
1602
- operations {
1603
- __typename
1604
- slug
1605
- deprecated
1606
- method
1607
- summary
1608
- operationId
1609
- path
1610
- }
1611
- }
1612
- }
1613
- }
1614
- `), Ea = {
1615
- get: "green",
1616
- post: "blue",
1617
- put: "yellow",
1618
- delete: "red",
1619
- patch: "purple",
1620
- options: "gray",
1621
- head: "gray"
1622
- }, ss = (t) => {
1623
- const a = Ne(t.navigationId ?? "/reference"), s = t.type === "file" ? Object.keys(t.input) : [], r = new Bt(t);
1624
- return {
1625
- getHead: () => {
1626
- if (t.type === "url" && !t.skipPreload)
1627
- return /* @__PURE__ */ e.jsx(
1628
- "link",
1629
- {
1630
- rel: "preload",
1631
- href: t.input,
1632
- as: "fetch",
1633
- crossOrigin: "anonymous"
1634
- }
1635
- );
1636
- if (t.server)
1637
- return /* @__PURE__ */ e.jsx("link", { rel: "preconnect", href: t.server });
1638
- },
1639
- getMdxComponents: () => ({
1640
- OpenPlaygroundButton: ({
1641
- requireAuth: o,
1642
- server: l,
1643
- method: i,
1644
- url: p,
1645
- ...c
1646
- }) => {
1647
- var b;
1648
- const h = dt(), g = Ze({
1649
- queryFn: () => r.fetch(Pe, {
1650
- type: t.type,
1651
- input: t.input
1652
- }),
1653
- enabled: !l,
1654
- queryKey: ["playground-server"]
1655
- });
1656
- return o && !h.isAuthenticated ? /* @__PURE__ */ e.jsxs(
1657
- E,
1658
- {
1659
- className: "gap-2 items-center",
1660
- variant: "outline",
1661
- onClick: h.login,
1662
- children: [
1663
- "Login to open in Playground ",
1664
- /* @__PURE__ */ e.jsx(lt, { size: 16 })
1665
- ]
1666
- }
1667
- ) : /* @__PURE__ */ e.jsx(
1668
- Ia,
1669
- {
1670
- url: p ?? "/",
1671
- method: i ?? "get",
1672
- server: l ?? ((b = g.data) == null ? void 0 : b.schema.url) ?? "https://example.com",
1673
- ...c,
1674
- children: /* @__PURE__ */ e.jsxs(E, { className: "gap-2 items-center", variant: "outline", children: [
1675
- "Open in Playground ",
1676
- /* @__PURE__ */ e.jsx(it, { size: 16 })
1677
- ] })
1678
- }
1679
- );
1680
- }
1681
- }),
1682
- getSidebar: async (o) => {
1683
- if (!We({ path: a, end: !1 }, o))
1684
- return [];
1685
- try {
1686
- const l = s.find((c) => o === Ne(a, c)) ?? Object.keys(t.input).at(0), p = (await r.fetch(Pe, {
1687
- type: t.type,
1688
- input: t.type === "file" ? t.input[l] : t.input,
1689
- version: l
1690
- })).schema.tags.filter((c) => c.operations.length > 0).map((c) => ({
1691
- type: "category",
1692
- label: c.name || "Other endpoints",
1693
- collapsible: !0,
1694
- collapsed: !1,
1695
- items: c.operations.map((h) => ({
1696
- type: "link",
1697
- label: h.summary ?? h.path,
1698
- href: `#${h.slug}`,
1699
- badge: {
1700
- label: h.method,
1701
- color: Ea[h.method.toLowerCase()],
1702
- invert: !0
1703
- }
1704
- }))
1705
- }));
1706
- return p.unshift({
1707
- type: "link",
1708
- label: "Overview",
1709
- href: "#description"
1710
- }), p;
1711
- } catch {
1712
- return [];
1713
- }
1714
- },
1715
- getRoutes: () => [null, ...s].map((l) => ({
1716
- path: a + (l ? `/${l}` : ""),
1717
- async lazy() {
1718
- const { OpenApiRoute: i } = await import("./Route-VdmEyOD0.js");
1719
- return {
1720
- element: /* @__PURE__ */ e.jsx(
1721
- i,
1722
- {
1723
- basePath: a,
1724
- versions: s,
1725
- client: r,
1726
- config: t
1727
- }
1728
- )
1729
- };
1730
- },
1731
- children: [
1732
- {
1733
- index: !0,
1734
- async lazy() {
1735
- const { OperationList: i } = await import("./OperationList-DGJWDx1G.js");
1736
- return { element: /* @__PURE__ */ e.jsx(i, {}) };
1737
- }
1738
- }
1739
- ]
1740
- }))
1741
- };
1742
- };
1743
- export {
1744
- qe as C,
1745
- Ia as P,
1746
- wa as S,
1747
- Ht as g,
1748
- ss as o
1749
- };
1750
- //# sourceMappingURL=index-CXRrqOIl.js.map