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