zudoku 0.26.0 → 0.27.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 (300) 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/config.d.ts +1 -0
  5. package/dist/config/validators/InputSidebarSchema.d.ts +2 -2
  6. package/dist/config/validators/common.d.ts +78 -0
  7. package/dist/config/validators/common.js +6 -0
  8. package/dist/config/validators/common.js.map +1 -1
  9. package/dist/config/validators/validate.d.ts +34 -0
  10. package/dist/lib/authentication/providers/auth0.js +1 -1
  11. package/dist/lib/authentication/providers/auth0.js.map +1 -1
  12. package/dist/lib/authentication/providers/openid.d.ts +1 -1
  13. package/dist/lib/authentication/providers/openid.js +10 -6
  14. package/dist/lib/authentication/providers/openid.js.map +1 -1
  15. package/dist/lib/components/AnchorLink.js +5 -2
  16. package/dist/lib/components/AnchorLink.js.map +1 -1
  17. package/dist/lib/components/Autocomplete.d.ts +12 -0
  18. package/dist/lib/components/Autocomplete.js +47 -0
  19. package/dist/lib/components/Autocomplete.js.map +1 -0
  20. package/dist/lib/components/Header.js +4 -4
  21. package/dist/lib/components/Header.js.map +1 -1
  22. package/dist/lib/components/Heading.d.ts +1 -1
  23. package/dist/lib/components/Markdown.d.ts +2 -2
  24. package/dist/lib/components/Markdown.js +3 -1
  25. package/dist/lib/components/Markdown.js.map +1 -1
  26. package/dist/lib/components/StatusPage.d.ts +7 -0
  27. package/dist/lib/components/StatusPage.js +71 -0
  28. package/dist/lib/components/StatusPage.js.map +1 -0
  29. package/dist/lib/components/SyntaxHighlight.d.ts +2 -1
  30. package/dist/lib/components/SyntaxHighlight.js +2 -2
  31. package/dist/lib/components/SyntaxHighlight.js.map +1 -1
  32. package/dist/lib/components/ThemeSwitch.js +4 -4
  33. package/dist/lib/components/ThemeSwitch.js.map +1 -1
  34. package/dist/lib/components/cache.d.ts +6 -0
  35. package/dist/lib/components/cache.js +13 -0
  36. package/dist/lib/components/cache.js.map +1 -0
  37. package/dist/lib/components/context/ViewportAnchorContext.js +16 -4
  38. package/dist/lib/components/context/ViewportAnchorContext.js.map +1 -1
  39. package/dist/lib/components/context/ZudokuContext.js +2 -1
  40. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  41. package/dist/lib/components/index.d.ts +9 -2
  42. package/dist/lib/components/index.js +5 -2
  43. package/dist/lib/components/index.js.map +1 -1
  44. package/dist/lib/core/RouteGuard.d.ts +1 -0
  45. package/dist/lib/core/RouteGuard.js +28 -0
  46. package/dist/lib/core/RouteGuard.js.map +1 -0
  47. package/dist/lib/core/ZudokuContext.d.ts +4 -2
  48. package/dist/lib/core/ZudokuContext.js +9 -7
  49. package/dist/lib/core/ZudokuContext.js.map +1 -1
  50. package/dist/lib/oas/graphql/circular.d.ts +3 -0
  51. package/dist/lib/oas/graphql/circular.js +27 -0
  52. package/dist/lib/oas/graphql/circular.js.map +1 -0
  53. package/dist/lib/oas/graphql/index.js +5 -6
  54. package/dist/lib/oas/graphql/index.js.map +1 -1
  55. package/dist/lib/oas/parser/dereference/index.d.ts +0 -1
  56. package/dist/lib/oas/parser/dereference/index.js +1 -1
  57. package/dist/lib/oas/parser/dereference/index.js.map +1 -1
  58. package/dist/lib/plugins/markdown/MdxPage.js +8 -2
  59. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  60. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  61. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  62. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  63. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  64. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.d.ts +3 -1
  65. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js +3 -2
  66. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -1
  67. package/dist/lib/plugins/openapi/Sidecar.js +3 -3
  68. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  69. package/dist/lib/plugins/openapi/index.js +4 -11
  70. package/dist/lib/plugins/openapi/index.js.map +1 -1
  71. package/dist/lib/plugins/openapi/interfaces.d.ts +7 -2
  72. package/dist/lib/plugins/openapi/playground/ExamplesDropdown.d.ts +6 -0
  73. package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js +12 -0
  74. package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js.map +1 -0
  75. package/dist/lib/plugins/openapi/playground/Headers.js +67 -4
  76. package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
  77. package/dist/lib/plugins/openapi/playground/ParamsGrid.d.ts +5 -0
  78. package/dist/lib/plugins/openapi/playground/ParamsGrid.js +4 -0
  79. package/dist/lib/plugins/openapi/playground/ParamsGrid.js.map +1 -0
  80. package/dist/lib/plugins/openapi/playground/PathParams.js +4 -12
  81. package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
  82. package/dist/lib/plugins/openapi/playground/Playground.d.ts +18 -1
  83. package/dist/lib/plugins/openapi/playground/Playground.js +53 -40
  84. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  85. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +1 -1
  86. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
  87. package/dist/lib/plugins/openapi/playground/QueryParams.js +21 -30
  88. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
  89. package/dist/lib/plugins/openapi/playground/SubmitButton.d.ts +7 -0
  90. package/dist/lib/plugins/openapi/playground/SubmitButton.js +22 -0
  91. package/dist/lib/plugins/openapi/playground/SubmitButton.js.map +1 -0
  92. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.d.ts +7 -0
  93. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.js +11 -0
  94. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.js.map +1 -0
  95. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.d.ts +8 -0
  96. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +95 -0
  97. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js.map +1 -0
  98. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.d.ts +7 -0
  99. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js +16 -0
  100. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js.map +1 -0
  101. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.d.ts +10 -0
  102. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.js +32 -0
  103. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.js.map +1 -0
  104. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.d.ts +1 -0
  105. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.js +56 -0
  106. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.js.map +1 -0
  107. package/dist/lib/plugins/openapi/post-processors/removeExtensions.d.ts +2 -1
  108. package/dist/lib/plugins/openapi/post-processors/removeExtensions.js +5 -3
  109. package/dist/lib/plugins/openapi/post-processors/removeExtensions.js.map +1 -1
  110. package/dist/lib/plugins/openapi/post-processors/removeExtensions.test.js +49 -0
  111. package/dist/lib/plugins/openapi/post-processors/removeExtensions.test.js.map +1 -1
  112. package/dist/lib/plugins/openapi/post-processors/removeParameters.d.ts +10 -0
  113. package/dist/lib/plugins/openapi/post-processors/removeParameters.js +66 -0
  114. package/dist/lib/plugins/openapi/post-processors/removeParameters.js.map +1 -0
  115. package/dist/lib/plugins/openapi/post-processors/removeParameters.test.d.ts +1 -0
  116. package/dist/lib/plugins/openapi/post-processors/removeParameters.test.js +131 -0
  117. package/dist/lib/plugins/openapi/post-processors/removeParameters.test.js.map +1 -0
  118. package/dist/lib/plugins/openapi/schema/SchemaComponents.js +1 -1
  119. package/dist/lib/plugins/openapi/schema/SchemaComponents.js.map +1 -1
  120. package/dist/lib/ui/Command.d.ts +9 -1
  121. package/dist/lib/ui/Command.js +5 -1
  122. package/dist/lib/ui/Command.js.map +1 -1
  123. package/dist/lib/ui/Select.js +2 -2
  124. package/dist/lib/ui/Select.js.map +1 -1
  125. package/dist/lib/util/MdxComponents.js +2 -2
  126. package/dist/lib/util/MdxComponents.js.map +1 -1
  127. package/dist/lib/util/joinUrl.d.ts +1 -0
  128. package/dist/lib/util/joinUrl.js +40 -0
  129. package/dist/lib/util/joinUrl.js.map +1 -0
  130. package/dist/lib/util/useScrollToAnchor.d.ts +1 -0
  131. package/dist/lib/util/useScrollToAnchor.js +26 -15
  132. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  133. package/dist/vite/build.js +10 -10
  134. package/dist/vite/build.js.map +1 -1
  135. package/dist/vite/config.js +4 -1
  136. package/dist/vite/config.js.map +1 -1
  137. package/dist/vite/dev-server.js +4 -1
  138. package/dist/vite/dev-server.js.map +1 -1
  139. package/dist/vite/plugin-api.d.ts +1 -1
  140. package/dist/vite/plugin-api.js +31 -7
  141. package/dist/vite/plugin-api.js.map +1 -1
  142. package/dist/vite/plugin-auth.js +4 -1
  143. package/dist/vite/plugin-auth.js.map +1 -1
  144. package/dist/vite/plugin-mdx.js +9 -4
  145. package/dist/vite/plugin-mdx.js.map +1 -1
  146. package/dist/vite/prerender.d.ts +2 -2
  147. package/dist/vite/prerender.js +5 -4
  148. package/dist/vite/prerender.js.map +1 -1
  149. package/dist/zuplo/enrich-with-zuplo.d.ts +5 -0
  150. package/dist/zuplo/enrich-with-zuplo.js +184 -0
  151. package/dist/zuplo/enrich-with-zuplo.js.map +1 -0
  152. package/dist/zuplo/env.d.ts +1 -0
  153. package/dist/zuplo/env.js +3 -0
  154. package/dist/zuplo/env.js.map +1 -1
  155. package/dist/zuplo/policy-types.d.ts +33 -0
  156. package/dist/zuplo/policy-types.js +8 -0
  157. package/dist/zuplo/policy-types.js.map +1 -0
  158. package/dist/zuplo/with-zuplo-processors.d.ts +3 -0
  159. package/dist/zuplo/with-zuplo-processors.js +26 -0
  160. package/dist/zuplo/with-zuplo-processors.js.map +1 -0
  161. package/dist/zuplo/with-zuplo.d.ts +1 -1
  162. package/dist/zuplo/with-zuplo.js +7 -26
  163. package/dist/zuplo/with-zuplo.js.map +1 -1
  164. package/lib/{AuthenticationPlugin-DNXBcsVN.js → AuthenticationPlugin-CO_YCd2x.js} +3 -3
  165. package/lib/{AuthenticationPlugin-DNXBcsVN.js.map → AuthenticationPlugin-CO_YCd2x.js.map} +1 -1
  166. package/lib/{Markdown-BrfrjEk_.js → Markdown-B8o9Qz4q.js} +1197 -1186
  167. package/lib/{Markdown-BrfrjEk_.js.map → Markdown-B8o9Qz4q.js.map} +1 -1
  168. package/lib/{MdxPage-LNZLj_A5.js → MdxPage-BxRt3Ly7.js} +63 -58
  169. package/lib/MdxPage-BxRt3Ly7.js.map +1 -0
  170. package/lib/OperationList-DH-zIgtq.js +5160 -0
  171. package/lib/OperationList-DH-zIgtq.js.map +1 -0
  172. package/lib/{Route-Pzk6qwIk.js → Route-DJ0ZlVq1.js} +3 -3
  173. package/lib/{Route-Pzk6qwIk.js.map → Route-DJ0ZlVq1.js.map} +1 -1
  174. package/lib/{Select-DkOpAG0c.js → Select-B7UXR0SB.js} +61 -61
  175. package/lib/Select-B7UXR0SB.js.map +1 -0
  176. package/lib/{SlotletProvider-DPbx9KdU.js → SlotletProvider-CtIp8rP3.js} +4 -4
  177. package/lib/{SlotletProvider-DPbx9KdU.js.map → SlotletProvider-CtIp8rP3.js.map} +1 -1
  178. package/lib/{Button-oroWHXAy.js → Spinner-BlzrEEk1.js} +15 -12
  179. package/lib/Spinner-BlzrEEk1.js.map +1 -0
  180. package/lib/{SyntaxHighlight-CJCSPG1F.js → SyntaxHighlight-C1w1QPdY.js} +300 -295
  181. package/lib/{SyntaxHighlight-CJCSPG1F.js.map → SyntaxHighlight-C1w1QPdY.js.map} +1 -1
  182. package/lib/{ZudokuContext-D3ayHjP-.js → ZudokuContext-8jts0fF3.js} +259 -248
  183. package/lib/ZudokuContext-8jts0fF3.js.map +1 -0
  184. package/lib/{chunk-SYFQ2XB5-KWlHsT7t.js → chunk-SYFQ2XB5-BPvC-soB.js} +6 -5
  185. package/lib/{chunk-SYFQ2XB5-KWlHsT7t.js.map → chunk-SYFQ2XB5-BPvC-soB.js.map} +1 -1
  186. package/lib/circular-Dgpd6AN-.js +15397 -0
  187. package/lib/circular-Dgpd6AN-.js.map +1 -0
  188. package/lib/{createServer-BcaswoFO.js → createServer-BV0tHzLK.js} +3450 -5577
  189. package/lib/createServer-BV0tHzLK.js.map +1 -0
  190. package/lib/{hook-DUyACbIK.js → hook-BG02esyv.js} +2 -2
  191. package/lib/{hook-DUyACbIK.js.map → hook-BG02esyv.js.map} +1 -1
  192. package/lib/index-B7mqiOei.js +509 -0
  193. package/lib/index-B7mqiOei.js.map +1 -0
  194. package/lib/index-DmqsUPcm.js +1915 -0
  195. package/lib/index-DmqsUPcm.js.map +1 -0
  196. package/lib/joinUrl-BTy9bvoK.js +20 -0
  197. package/lib/joinUrl-BTy9bvoK.js.map +1 -0
  198. package/lib/post-processors/removeExtensions.js +7 -7
  199. package/lib/post-processors/removeExtensions.js.map +1 -1
  200. package/lib/post-processors/removeParameters.js +48 -0
  201. package/lib/post-processors/removeParameters.js.map +1 -0
  202. package/lib/ui/ActionButton.js +10 -11
  203. package/lib/ui/ActionButton.js.map +1 -1
  204. package/lib/ui/Command.js +125 -13
  205. package/lib/ui/Command.js.map +1 -1
  206. package/lib/ui/Select.js +2 -2
  207. package/lib/ui/Select.js.map +1 -1
  208. package/lib/{useExposedProps-BBHR7aLM.js → useExposedProps-BLKFBylA.js} +2 -2
  209. package/lib/{useExposedProps-BBHR7aLM.js.map → useExposedProps-BLKFBylA.js.map} +1 -1
  210. package/lib/useScrollToAnchor-Bl6mz9_x.js +288 -0
  211. package/lib/useScrollToAnchor-Bl6mz9_x.js.map +1 -0
  212. package/lib/zudoku.auth-auth0.js +7 -9
  213. package/lib/zudoku.auth-auth0.js.map +1 -1
  214. package/lib/zudoku.auth-clerk.js +1 -1
  215. package/lib/zudoku.auth-openid.js +223 -219
  216. package/lib/zudoku.auth-openid.js.map +1 -1
  217. package/lib/zudoku.components.js +754 -992
  218. package/lib/zudoku.components.js.map +1 -1
  219. package/lib/zudoku.plugin-api-catalog.js +3 -3
  220. package/lib/zudoku.plugin-api-keys.js +5 -5
  221. package/lib/zudoku.plugin-custom-pages.js +2 -2
  222. package/lib/zudoku.plugin-markdown.js +1 -1
  223. package/lib/zudoku.plugin-openapi.js +4 -4
  224. package/lib/zudoku.plugin-redirect.js +1 -1
  225. package/package.json +2 -2
  226. package/src/app/main.css +50 -50
  227. package/src/app/main.tsx +26 -7
  228. package/src/lib/authentication/providers/auth0.tsx +1 -4
  229. package/src/lib/authentication/providers/openid.tsx +12 -5
  230. package/src/lib/components/AnchorLink.tsx +5 -2
  231. package/src/lib/components/Autocomplete.tsx +111 -0
  232. package/src/lib/components/Header.tsx +4 -4
  233. package/src/lib/components/Markdown.tsx +14 -15
  234. package/src/lib/components/StatusPage.tsx +91 -0
  235. package/src/lib/components/SyntaxHighlight.tsx +14 -0
  236. package/src/lib/components/ThemeSwitch.tsx +14 -15
  237. package/src/lib/components/cache.ts +15 -0
  238. package/src/lib/components/context/ViewportAnchorContext.tsx +20 -6
  239. package/src/lib/components/context/ZudokuContext.ts +3 -1
  240. package/src/lib/components/index.ts +9 -2
  241. package/src/lib/core/RouteGuard.tsx +35 -0
  242. package/src/lib/core/ZudokuContext.ts +9 -8
  243. package/src/lib/oas/graphql/circular.ts +29 -0
  244. package/src/lib/oas/graphql/index.ts +9 -9
  245. package/src/lib/oas/parser/dereference/index.ts +1 -2
  246. package/src/lib/plugins/markdown/MdxPage.tsx +9 -1
  247. package/src/lib/plugins/openapi/OperationListItem.tsx +0 -2
  248. package/src/lib/plugins/openapi/ParameterListItem.tsx +1 -0
  249. package/src/lib/plugins/openapi/PlaygroundDialogWrapper.tsx +5 -0
  250. package/src/lib/plugins/openapi/Sidecar.tsx +4 -2
  251. package/src/lib/plugins/openapi/index.tsx +9 -15
  252. package/src/lib/plugins/openapi/interfaces.ts +10 -2
  253. package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +54 -0
  254. package/src/lib/plugins/openapi/playground/Headers.tsx +136 -39
  255. package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +8 -0
  256. package/src/lib/plugins/openapi/playground/PathParams.tsx +34 -74
  257. package/src/lib/plugins/openapi/playground/Playground.tsx +219 -177
  258. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +1 -1
  259. package/src/lib/plugins/openapi/playground/QueryParams.tsx +90 -122
  260. package/src/lib/plugins/openapi/playground/SubmitButton.tsx +75 -0
  261. package/src/lib/plugins/openapi/playground/result-panel/RequestTab.tsx +73 -0
  262. package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +210 -0
  263. package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +101 -0
  264. package/src/lib/plugins/openapi/playground/result-panel/convertToTypes.test.ts +64 -0
  265. package/src/lib/plugins/openapi/playground/result-panel/convertToTypes.ts +36 -0
  266. package/src/lib/plugins/openapi/post-processors/removeExtensions.test.ts +58 -0
  267. package/src/lib/plugins/openapi/post-processors/removeExtensions.ts +7 -4
  268. package/src/lib/plugins/openapi/post-processors/removeParameters.test.ts +148 -0
  269. package/src/lib/plugins/openapi/post-processors/removeParameters.ts +101 -0
  270. package/src/lib/plugins/openapi/schema/SchemaComponents.tsx +1 -1
  271. package/src/lib/ui/Command.tsx +20 -0
  272. package/src/lib/ui/Select.tsx +1 -1
  273. package/src/lib/util/MdxComponents.tsx +2 -1
  274. package/src/lib/util/joinUrl.ts +57 -0
  275. package/src/lib/util/useScrollToAnchor.ts +32 -15
  276. package/dist/lib/plugins/openapi/playground/EnumSelector.d.ts +0 -8
  277. package/dist/lib/plugins/openapi/playground/EnumSelector.js +0 -21
  278. package/dist/lib/plugins/openapi/playground/EnumSelector.js.map +0 -1
  279. package/dist/lib/plugins/openapi/playground/ResponseTab.d.ts +0 -4
  280. package/dist/lib/plugins/openapi/playground/ResponseTab.js +0 -42
  281. package/dist/lib/plugins/openapi/playground/ResponseTab.js.map +0 -1
  282. package/lib/AnchorLink-_Vu02ceN.js +0 -34
  283. package/lib/AnchorLink-_Vu02ceN.js.map +0 -1
  284. package/lib/Button-oroWHXAy.js.map +0 -1
  285. package/lib/Command-D5DE0DD7.js +0 -611
  286. package/lib/Command-D5DE0DD7.js.map +0 -1
  287. package/lib/MdxPage-LNZLj_A5.js.map +0 -1
  288. package/lib/OperationList-PCwzTp1r.js +0 -5144
  289. package/lib/OperationList-PCwzTp1r.js.map +0 -1
  290. package/lib/Select-DkOpAG0c.js.map +0 -1
  291. package/lib/Spinner-C5gHXrVz.js +0 -7
  292. package/lib/Spinner-C5gHXrVz.js.map +0 -1
  293. package/lib/ZudokuContext-D3ayHjP-.js.map +0 -1
  294. package/lib/createServer-BcaswoFO.js.map +0 -1
  295. package/lib/index-CaILD1AV.js +0 -1292
  296. package/lib/index-CaILD1AV.js.map +0 -1
  297. package/lib/index-TaRXY2w1.js +0 -43
  298. package/lib/index-TaRXY2w1.js.map +0 -1
  299. package/src/lib/plugins/openapi/playground/EnumSelector.tsx +0 -86
  300. package/src/lib/plugins/openapi/playground/ResponseTab.tsx +0 -76
@@ -0,0 +1,57 @@
1
+ // Mostly adapted from https://github.com/moxystudio/js-proper-url-join
2
+ const defaultUrlRegExp = /^(\w+:\/\/[^/?]+)?(.*?)(\?.+)?$/;
3
+
4
+ const normalizeParts = (
5
+ parts: (string | number | null | undefined | false)[],
6
+ ): string[] =>
7
+ parts
8
+ .filter(
9
+ (part): part is string | number =>
10
+ part !== null &&
11
+ part !== undefined &&
12
+ part !== false &&
13
+ (typeof part === "string" || typeof part === "number"),
14
+ )
15
+ .map((part) => `${part}`)
16
+ .filter((part) => part);
17
+
18
+ interface ParsedParts {
19
+ prefix: string;
20
+ pathname: string[];
21
+ }
22
+
23
+ const parseParts = (parts: string[]): ParsedParts => {
24
+ const partsStr = parts.join("/");
25
+ const [, prefix = "", pathname = ""] = partsStr.match(defaultUrlRegExp) ?? [];
26
+
27
+ return {
28
+ prefix,
29
+ pathname: pathname.split("/").filter((part) => part !== ""),
30
+ };
31
+ };
32
+
33
+ const buildUrl = (parsedParts: ParsedParts): string => {
34
+ const { prefix, pathname } = parsedParts;
35
+ let url = prefix;
36
+
37
+ if (pathname.length > 0) {
38
+ if (url) {
39
+ url += "/";
40
+ } else {
41
+ url = "/";
42
+ }
43
+ url += pathname.join("/");
44
+ } else if (!url) {
45
+ url = "/";
46
+ }
47
+
48
+ return url;
49
+ };
50
+
51
+ export const joinUrl = (
52
+ ...parts: Array<string | number | null | undefined | false>
53
+ ): string => {
54
+ const normalizedParts = normalizeParts(parts);
55
+ const parsedParts = parseParts(normalizedParts);
56
+ return buildUrl(parsedParts);
57
+ };
@@ -1,4 +1,4 @@
1
- import { useEffect } from "react";
1
+ import { useCallback, useEffect } from "react";
2
2
  import { useLocation } from "react-router";
3
3
  import { useViewportAnchor } from "../components/context/ViewportAnchorContext.js";
4
4
  import { DATA_ANCHOR_ATTR } from "../components/navigation/SidebarItem.js";
@@ -22,32 +22,49 @@ const scrollIntoViewIfNeeded = (
22
22
  element.scrollIntoView(options);
23
23
  };
24
24
 
25
- export const useScrollToAnchor = () => {
26
- const location = useLocation();
25
+ export const useScrollToHash = () => {
27
26
  const { setActiveAnchor } = useViewportAnchor();
28
27
 
29
- useEffect(() => {
30
- if (!location.hash) return;
31
-
32
- const hash = decodeURIComponent(location.hash.split("/")[0]!.slice(1));
33
-
34
- const scrollToElement = () => {
35
- const element = document.getElementById(hash);
36
- const link = document.querySelector(`[${DATA_ANCHOR_ATTR}="${hash}"]`);
28
+ const scrollToHash = useCallback(
29
+ (hash: string) => {
30
+ const cleanHash = hash
31
+ .replace(/^#/, "")
32
+ // Operation list items might have subdivisions that the sidebar doesn't show.
33
+ // The subdivisions are separated by a slash so we need to remove everything before the slash to get the sidebar correct item.
34
+ .split("/")
35
+ .at(0)!;
36
+ const element = document.getElementById(decodeURIComponent(cleanHash));
37
+ const link = document.querySelector(
38
+ `[${DATA_ANCHOR_ATTR}="${cleanHash}"]`,
39
+ );
37
40
 
38
41
  if (element) {
39
42
  element.scrollIntoView();
40
43
  scrollIntoViewIfNeeded(link);
41
- requestIdleCallback(() => setActiveAnchor(hash));
44
+ requestIdleCallback(() => setActiveAnchor(cleanHash));
42
45
  return true;
43
46
  }
44
47
 
48
+ // Scroll didn't happen
45
49
  return false;
46
- };
50
+ },
51
+ [setActiveAnchor],
52
+ );
53
+
54
+ return scrollToHash;
55
+ };
56
+
57
+ export const useScrollToAnchor = () => {
58
+ const location = useLocation();
59
+ const { setActiveAnchor } = useViewportAnchor();
60
+ const scrollToHash = useScrollToHash();
61
+
62
+ useEffect(() => {
63
+ if (!location.hash) return;
47
64
 
48
- if (!scrollToElement()) {
65
+ if (!scrollToHash(location.hash)) {
49
66
  const observer = new MutationObserver((_, obs) => {
50
- if (!scrollToElement()) return;
67
+ if (!scrollToHash(location.hash)) return;
51
68
  obs.disconnect();
52
69
  });
53
70
 
@@ -1,8 +0,0 @@
1
- interface EnumSelectorProps {
2
- value: string;
3
- enumValues: string[];
4
- onChange: (value: string) => void;
5
- onValueSelected: () => void;
6
- }
7
- export declare const EnumSelector: ({ value, enumValues, onChange, onValueSelected, }: EnumSelectorProps) => import("react/jsx-runtime").JSX.Element;
8
- export {};
@@ -1,21 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { Command, CommandEmpty, CommandInput, CommandItem, CommandList, } from "../../../ui/Command.js";
4
- import { Popover, PopoverContent, PopoverTrigger, } from "../../../ui/Popover.js";
5
- import { cn } from "../../../util/cn.js";
6
- export const EnumSelector = ({ value, enumValues, onChange, onValueSelected, }) => {
7
- const [searchValue, setSearchValue] = useState("");
8
- const [open, setOpen] = useState(false);
9
- return (_jsxs(Popover, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { type: "button", role: "combobox", className: cn("px-3 py-2 w-full border-0 shadow-none text-xs font-mono text-start hover:bg-accent/40 rounded border-transparent hover:bg-accent", !value && "text-muted-foreground"), children: value || "Select value" }) }), _jsx(PopoverContent, { className: "p-0 w-[--radix-popover-trigger-width] ", align: "start", sideOffset: 3, alignOffset: -3, side: "bottom", children: _jsxs(Command, { className: "max-h-[180px]", children: [_jsx(CommandInput, { placeholder: "Enter value", className: "h-9 bg-transparent ", onValueChange: setSearchValue, onKeyDown: (e) => {
10
- if (e.key === "Enter") {
11
- onChange(searchValue);
12
- onValueSelected();
13
- setOpen(false);
14
- }
15
- } }), _jsxs(CommandList, { children: [_jsxs(CommandEmpty, { children: ["Use \"", searchValue, "\""] }), enumValues.map((enumValue) => (_jsx(CommandItem, { value: enumValue, onSelect: (selected) => {
16
- onChange(selected);
17
- onValueSelected();
18
- setOpen(false);
19
- }, children: enumValue }, enumValue)))] })] }) })] }));
20
- };
21
- //# sourceMappingURL=EnumSelector.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EnumSelector.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/playground/EnumSelector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EACL,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AASzC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,KAAK,EACL,UAAU,EACV,QAAQ,EACR,eAAe,GACG,EAAE,EAAE;IACtB,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAExC,OAAO,CACL,MAAC,OAAO,IAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,aACxC,KAAC,cAAc,IAAC,OAAO,kBACrB,iBACE,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,UAAU,EACf,SAAS,EAAE,EAAE,CACX,kIAAkI,EAClI,CAAC,KAAK,IAAI,uBAAuB,CAClC,YAEA,KAAK,IAAI,cAAc,GACjB,GACM,EACjB,KAAC,cAAc,IACb,SAAS,EAAC,wCAAwC,EAClD,KAAK,EAAC,OAAO,EACb,UAAU,EAAE,CAAC,EACb,WAAW,EAAE,CAAC,CAAC,EACf,IAAI,EAAC,QAAQ,YAEb,MAAC,OAAO,IAAC,SAAS,EAAC,eAAe,aAChC,KAAC,YAAY,IACX,WAAW,EAAC,aAAa,EACzB,SAAS,EAAC,qBAAqB,EAC/B,aAAa,EAAE,cAAc,EAC7B,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;gCACf,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;oCACtB,QAAQ,CAAC,WAAW,CAAC,CAAC;oCACtB,eAAe,EAAE,CAAC;oCAClB,OAAO,CAAC,KAAK,CAAC,CAAC;gCACjB,CAAC;4BACH,CAAC,GACD,EACF,MAAC,WAAW,eACV,MAAC,YAAY,yBAAO,WAAW,UAAiB,EAC/C,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAC7B,KAAC,WAAW,IAEV,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,CAAC,QAAQ,EAAE,EAAE;wCACrB,QAAQ,CAAC,QAAQ,CAAC,CAAC;wCACnB,eAAe,EAAE,CAAC;wCAClB,OAAO,CAAC,KAAK,CAAC,CAAC;oCACjB,CAAC,YAEA,SAAS,IARL,SAAS,CASF,CACf,CAAC,IACU,IACN,GACK,IACT,CACX,CAAC;AACJ,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- export declare const ResponseTab: ({ body, headers, }: {
2
- body?: string;
3
- headers: Headers;
4
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,42 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { SyntaxHighlight } from "../../../components/SyntaxHighlight.js";
4
- import { Card } from "../../../ui/Card.js";
5
- import { SimpleSelect } from "../SimpleSelect.js";
6
- const mimeTypeToLanguage = (mimeType) => {
7
- const mimeTypeMapping = {
8
- "application/json": "json",
9
- "text/json": "json",
10
- "text/html": "html",
11
- "text/css": "css",
12
- "text/javascript": "javascript",
13
- "application/xml": "xml",
14
- "application/xhtml+xml": "xhtml",
15
- };
16
- return Object.entries(mimeTypeMapping).find(([mime]) => mimeType.includes(mime))?.[1];
17
- };
18
- const detectLanguage = (headers) => {
19
- const contentType = headers.get("Content-Type") || "";
20
- return mimeTypeToLanguage(contentType);
21
- };
22
- const tryParseJson = (body) => {
23
- try {
24
- return JSON.stringify(JSON.parse(body), null, 2);
25
- }
26
- catch {
27
- return null;
28
- }
29
- };
30
- export const ResponseTab = ({ body = "", headers, }) => {
31
- const detectedLanguage = detectLanguage(headers);
32
- const jsonContent = tryParseJson(body);
33
- const beautifiedBody = jsonContent || body;
34
- const [view, setView] = useState(jsonContent ? "formatted" : "raw");
35
- return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Card, { className: "shadow-none", children: _jsx(SyntaxHighlight, { language: view === "raw" ? (jsonContent ? "plain" : detectedLanguage) : "json", noBackground: true,
36
- // playground dialog has h-5/6 ≈ 83.333vh
37
- className: "overflow-x-auto p-4 text-xs max-h-[calc(83.333vh-180px)]", code: view === "raw" ? body : beautifiedBody }) }), jsonContent && (_jsx("div", { className: "flex justify-end", children: _jsx(SimpleSelect, { value: view, onChange: (e) => setView(e.target.value), options: [
38
- { value: "formatted", label: "Formatted" },
39
- { value: "raw", label: "Raw" },
40
- ] }) }))] }));
41
- };
42
- //# sourceMappingURL=ResponseTab.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResponseTab.js","sourceRoot":"","sources":["../../../../../src/lib/plugins/openapi/playground/ResponseTab.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAE,EAAE;IAC9C,MAAM,eAAe,GAAG;QACtB,kBAAkB,EAAE,MAAM;QAC1B,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,MAAM;QACnB,UAAU,EAAE,KAAK;QACjB,iBAAiB,EAAE,YAAY;QAC/B,iBAAiB,EAAE,KAAK;QACxB,uBAAuB,EAAE,OAAO;KACjC,CAAC;IAEF,OAAO,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CACrD,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,CACxB,EAAE,CAAC,CAAC,CAAC,CAAC;AACT,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CAAC,OAAgB,EAAE,EAAE;IAC1C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;IACtD,OAAO,kBAAkB,CAAC,WAAW,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE;IACpC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,IAAI,GAAG,EAAE,EACT,OAAO,GAIR,EAAE,EAAE;IACH,MAAM,gBAAgB,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IACjD,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACvC,MAAM,cAAc,GAAG,WAAW,IAAI,IAAI,CAAC;IAC3C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAC9B,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAClC,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAC,qBAAqB,aAClC,KAAC,IAAI,IAAC,SAAS,EAAC,aAAa,YAC3B,KAAC,eAAe,IACd,QAAQ,EACN,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,EAEtE,YAAY;oBACZ,yCAAyC;oBACzC,SAAS,EAAC,0DAA0D,EACpE,IAAI,EAAE,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,GAC5C,GACG,EACN,WAAW,IAAI,CACd,cAAK,SAAS,EAAC,kBAAkB,YAC/B,KAAC,YAAY,IACX,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAA4B,CAAC,EAC/D,OAAO,EAAE;wBACP,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;wBAC1C,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;qBAC/B,GACD,GACE,CACP,IACG,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -1,34 +0,0 @@
1
- import e from "react";
2
- import { j as r } from "./jsx-runtime-Bdg6XQ1m.js";
3
- import { u as l, L as m } from "./chunk-SYFQ2XB5-KWlHsT7t.js";
4
- const c = {}, u = e.createContext(c);
5
- function f(t) {
6
- const n = e.useContext(u);
7
- return e.useMemo(
8
- function() {
9
- return typeof t == "function" ? t(n) : { ...n, ...t };
10
- },
11
- [n, t]
12
- );
13
- }
14
- function h(t) {
15
- let n;
16
- return t.disableParentContext ? n = typeof t.components == "function" ? t.components(c) : t.components || c : n = f(t.components), e.createElement(
17
- u.Provider,
18
- { value: n },
19
- t.children
20
- );
21
- }
22
- const y = (t) => {
23
- const n = l(), o = typeof t.to == "string" ? t.to : t.to.hash, i = (a) => {
24
- var s;
25
- !(o != null && o.startsWith("#")) || o !== n.hash || (a.preventDefault(), (s = document.getElementById(o.slice(1))) == null || s.scrollIntoView());
26
- };
27
- return /* @__PURE__ */ r.jsx(m, { onClick: i, ...t });
28
- };
29
- export {
30
- y as A,
31
- h as M,
32
- f as u
33
- };
34
- //# sourceMappingURL=AnchorLink-_Vu02ceN.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnchorLink-_Vu02ceN.js","sources":["../../../node_modules/.pnpm/@mdx-js+react@3.1.0_@types+react@19.0.7_react@19.0.0/node_modules/@mdx-js/react/lib/index.js","../src/lib/components/AnchorLink.tsx"],"sourcesContent":["/**\n * @import {MDXComponents} from 'mdx/types.js'\n * @import {Component, ReactElement, ReactNode} from 'react'\n */\n\n/**\n * @callback MergeComponents\n * Custom merge function.\n * @param {Readonly<MDXComponents>} currentComponents\n * Current components from the context.\n * @returns {MDXComponents}\n * Additional components.\n *\n * @typedef Props\n * Configuration for `MDXProvider`.\n * @property {ReactNode | null | undefined} [children]\n * Children (optional).\n * @property {Readonly<MDXComponents> | MergeComponents | null | undefined} [components]\n * Additional components to use or a function that creates them (optional).\n * @property {boolean | null | undefined} [disableParentContext=false]\n * Turn off outer component context (default: `false`).\n */\n\nimport React from 'react'\n\n/** @type {Readonly<MDXComponents>} */\nconst emptyComponents = {}\n\nconst MDXContext = React.createContext(emptyComponents)\n\n/**\n * Get current components from the MDX Context.\n *\n * @param {Readonly<MDXComponents> | MergeComponents | null | undefined} [components]\n * Additional components to use or a function that creates them (optional).\n * @returns {MDXComponents}\n * Current components.\n */\nexport function useMDXComponents(components) {\n const contextComponents = React.useContext(MDXContext)\n\n // Memoize to avoid unnecessary top-level context changes\n return React.useMemo(\n function () {\n // Custom merge via a function prop\n if (typeof components === 'function') {\n return components(contextComponents)\n }\n\n return {...contextComponents, ...components}\n },\n [contextComponents, components]\n )\n}\n\n/**\n * Provider for MDX context.\n *\n * @param {Readonly<Props>} properties\n * Properties.\n * @returns {ReactElement}\n * Element.\n * @satisfies {Component}\n */\nexport function MDXProvider(properties) {\n /** @type {Readonly<MDXComponents>} */\n let allComponents\n\n if (properties.disableParentContext) {\n allComponents =\n typeof properties.components === 'function'\n ? properties.components(emptyComponents)\n : properties.components || emptyComponents\n } else {\n allComponents = useMDXComponents(properties.components)\n }\n\n return React.createElement(\n MDXContext.Provider,\n {value: allComponents},\n properties.children\n )\n}\n","import React from \"react\";\nimport { Link, type LinkProps, useLocation } from \"react-router\";\n\n/**\n * Link that scrolls to anchor even if the hash is already set in the URL.\n */\nexport const AnchorLink = (props: LinkProps) => {\n const location = useLocation();\n const hash = typeof props.to === \"string\" ? props.to : props.to.hash;\n\n const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {\n if (!hash?.startsWith(\"#\") || hash !== location.hash) return;\n\n event.preventDefault();\n document.getElementById(hash.slice(1))?.scrollIntoView();\n };\n\n return <Link onClick={handleClick} {...props} />;\n};\n"],"names":["emptyComponents","MDXContext","React","useMDXComponents","components","contextComponents","MDXProvider","properties","allComponents","AnchorLink","props","location","useLocation","hash","handleClick","event","_a","jsx","Link"],"mappings":";;;AA0BA,MAAMA,IAAkB,CAAA,GAElBC,IAAaC,EAAM,cAAcF,CAAe;AAU/C,SAASG,EAAiBC,GAAY;AAC3C,QAAMC,IAAoBH,EAAM,WAAWD,CAAU;AAGrD,SAAOC,EAAM;AAAA,IACX,WAAY;AAEV,aAAI,OAAOE,KAAe,aACjBA,EAAWC,CAAiB,IAG9B,EAAC,GAAGA,GAAmB,GAAGD,EAAU;AAAA,IAC5C;AAAA,IACD,CAACC,GAAmBD,CAAU;AAAA,EAClC;AACA;AAWO,SAASE,EAAYC,GAAY;AAEtC,MAAIC;AAEJ,SAAID,EAAW,uBACbC,IACE,OAAOD,EAAW,cAAe,aAC7BA,EAAW,WAAWP,CAAe,IACrCO,EAAW,cAAcP,IAE/BQ,IAAgBL,EAAiBI,EAAW,UAAU,GAGjDL,EAAM;AAAA,IACXD,EAAW;AAAA,IACX,EAAC,OAAOO,EAAa;AAAA,IACrBD,EAAW;AAAA,EACf;AACA;AC5Ea,MAAAE,IAAa,CAACC,MAAqB;AAC9C,QAAMC,IAAWC,EAAY,GACvBC,IAAO,OAAOH,EAAM,MAAO,WAAWA,EAAM,KAAKA,EAAM,GAAG,MAE1DI,IAAc,CAACC,MAA+C;;AAClE,IAAI,EAACF,KAAA,QAAAA,EAAM,WAAW,SAAQA,MAASF,EAAS,SAEhDI,EAAM,eAAe,IACrBC,IAAA,SAAS,eAAeH,EAAK,MAAM,CAAC,CAAC,MAArC,QAAAG,EAAwC;AAAA,EAC1C;AAEA,SAAQC,gBAAAA,EAAAA,IAAAC,GAAA,EAAK,SAASJ,GAAc,GAAGJ,GAAO;AAChD;","x_google_ignoreList":[0]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button-oroWHXAy.js","sources":["../src/lib/ui/Button.tsx"],"sourcesContent":["import { Slot } from \"@radix-ui/react-slot\";\nimport { cva, VariantProps } from \"class-variance-authority\";\nimport * as React from \"react\";\nimport { cn } from \"../util/cn.js\";\n\nexport const buttonVariants = cva(\n \"not-prose inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground shadow hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 px-4 py-2\",\n sm: \"h-8 rounded-md px-3 text-xs\",\n lg: \"h-10 rounded-md px-8\",\n xl: \"h-14 rounded-lg px-10 text-lg\",\n icon: \"h-9 w-9\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n },\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nexport const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n },\n);\nButton.displayName = \"Button\";\n"],"names":["buttonVariants","cva","Button","React","className","variant","size","asChild","props","ref","Comp","Slot","jsx","cn"],"mappings":";;;;;AAKO,MAAMA,IAAiBC;AAAA,EAC5B;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,WACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MAAA;AAAA,IAEV;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IAAA;AAAA,EACR;AAEJ,GAQaC,IAASC,EAAM;AAAA,EAC1B,CAAC,EAAE,WAAAC,GAAW,SAAAC,GAAS,MAAAC,GAAM,SAAAC,IAAU,IAAO,GAAGC,EAAM,GAAGC,MAAQ;AAC1D,UAAAC,IAAOH,IAAUI,IAAO;AAE5B,WAAAC,gBAAAA,EAAA;AAAA,MAACF;AAAA,MAAA;AAAA,QACC,WAAWG,EAAGb,EAAe,EAAE,SAAAK,GAAS,MAAAC,GAAM,WAAAF,EAAA,CAAW,CAAC;AAAA,QAC1D,KAAAK;AAAA,QACC,GAAGD;AAAA,MAAA;AAAA,IACN;AAAA,EAAA;AAGN;AACAN,EAAO,cAAc;"}