zudoku 0.0.0-feat-openapi-docs-redesign.dab3fc6a → 0.0.0-feat-navigation-at-property.z8cd07fa5

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 (656) hide show
  1. package/dist/app/main.d.ts +6 -6
  2. package/dist/app/main.js +1 -1
  3. package/dist/app/main.js.map +1 -1
  4. package/dist/app/sentry.js +1 -1
  5. package/dist/cli/common/version-check.js +12 -3
  6. package/dist/cli/common/version-check.js.map +1 -1
  7. package/dist/config/create-plugin.d.ts +2 -0
  8. package/dist/config/create-plugin.js +55 -0
  9. package/dist/config/create-plugin.js.map +1 -0
  10. package/dist/config/loader.js +3 -1
  11. package/dist/config/loader.js.map +1 -1
  12. package/dist/config/validators/BuildSchema.js +18 -3
  13. package/dist/config/validators/BuildSchema.js.map +1 -1
  14. package/dist/config/validators/InputNavigationSchema.d.ts +133 -45
  15. package/dist/config/validators/InputNavigationSchema.js +30 -0
  16. package/dist/config/validators/InputNavigationSchema.js.map +1 -1
  17. package/dist/config/validators/NavigationSchema.d.ts +18 -4
  18. package/dist/config/validators/NavigationSchema.js +15 -5
  19. package/dist/config/validators/NavigationSchema.js.map +1 -1
  20. package/dist/config/validators/ProtectedRoutesSchema.d.ts +1 -1
  21. package/dist/config/validators/validate.d.ts +104 -14
  22. package/dist/config/validators/validate.js +15 -4
  23. package/dist/config/validators/validate.js.map +1 -1
  24. package/dist/config/validators/validate.test.js +43 -0
  25. package/dist/config/validators/validate.test.js.map +1 -1
  26. package/dist/flat-config.d.ts +68 -32
  27. package/dist/index.d.ts +4 -2
  28. package/dist/index.js +3 -1
  29. package/dist/index.js.map +1 -1
  30. package/dist/lib/auth/issuer.js +1 -1
  31. package/dist/lib/auth/issuer.js.map +1 -1
  32. package/dist/lib/authentication/authentication.d.ts +3 -2
  33. package/dist/lib/authentication/components/CallbackHandler.js +1 -1
  34. package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
  35. package/dist/lib/authentication/components/SignIn.js +4 -2
  36. package/dist/lib/authentication/components/SignIn.js.map +1 -1
  37. package/dist/lib/authentication/components/SignUp.js +4 -2
  38. package/dist/lib/authentication/components/SignUp.js.map +1 -1
  39. package/dist/lib/authentication/hook.d.ts +2 -0
  40. package/dist/lib/authentication/hook.js +10 -0
  41. package/dist/lib/authentication/hook.js.map +1 -1
  42. package/dist/lib/authentication/providers/auth0.js +17 -8
  43. package/dist/lib/authentication/providers/auth0.js.map +1 -1
  44. package/dist/lib/authentication/providers/clerk.js +0 -22
  45. package/dist/lib/authentication/providers/clerk.js.map +1 -1
  46. package/dist/lib/authentication/providers/firebase.js +67 -9
  47. package/dist/lib/authentication/providers/firebase.js.map +1 -1
  48. package/dist/lib/authentication/providers/supabase.js +6 -15
  49. package/dist/lib/authentication/providers/supabase.js.map +1 -1
  50. package/dist/lib/authentication/ui/EmailVerificationUi.d.ts +4 -0
  51. package/dist/lib/authentication/ui/EmailVerificationUi.js +34 -0
  52. package/dist/lib/authentication/ui/EmailVerificationUi.js.map +1 -0
  53. package/dist/lib/authentication/ui/ZudokuAuthUi.d.ts +7 -2
  54. package/dist/lib/authentication/ui/ZudokuAuthUi.js +48 -12
  55. package/dist/lib/authentication/ui/ZudokuAuthUi.js.map +1 -1
  56. package/dist/lib/authentication/utils/relativeRedirectUrl.d.ts +1 -0
  57. package/dist/lib/authentication/utils/relativeRedirectUrl.js +8 -0
  58. package/dist/lib/authentication/utils/relativeRedirectUrl.js.map +1 -0
  59. package/dist/lib/components/Bootstrap.js +1 -2
  60. package/dist/lib/components/Bootstrap.js.map +1 -1
  61. package/dist/lib/components/Heading.d.ts +1 -1
  62. package/dist/lib/components/Mermaid.d.ts +7 -0
  63. package/dist/lib/components/Mermaid.js +42 -0
  64. package/dist/lib/components/Mermaid.js.map +1 -0
  65. package/dist/lib/components/MobileTopNavigation.js +3 -2
  66. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  67. package/dist/lib/components/PagefindSearchMeta.d.ts +8 -0
  68. package/dist/lib/components/PagefindSearchMeta.js +7 -0
  69. package/dist/lib/components/PagefindSearchMeta.js.map +1 -0
  70. package/dist/lib/components/Pagination.js +2 -2
  71. package/dist/lib/components/Pagination.js.map +1 -1
  72. package/dist/lib/components/Slot.test.js +1 -1
  73. package/dist/lib/components/Slot.test.js.map +1 -1
  74. package/dist/lib/components/TopNavigation.d.ts +7 -1
  75. package/dist/lib/components/TopNavigation.js +8 -3
  76. package/dist/lib/components/TopNavigation.js.map +1 -1
  77. package/dist/lib/components/Zudoku.d.ts +4 -1
  78. package/dist/lib/components/Zudoku.js +5 -11
  79. package/dist/lib/components/Zudoku.js.map +1 -1
  80. package/dist/lib/components/context/ZudokuContext.d.ts +9 -4
  81. package/dist/lib/components/context/ZudokuContext.js +26 -8
  82. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  83. package/dist/lib/components/context/ZudokuProvider.js +1 -1
  84. package/dist/lib/components/context/ZudokuProvider.js.map +1 -1
  85. package/dist/lib/components/context/ZudokuReactContext.d.ts +11 -0
  86. package/dist/lib/components/context/ZudokuReactContext.js +4 -0
  87. package/dist/lib/components/context/ZudokuReactContext.js.map +1 -0
  88. package/dist/lib/components/index.d.ts +18 -69
  89. package/dist/lib/components/index.js +19 -32
  90. package/dist/lib/components/index.js.map +1 -1
  91. package/dist/lib/components/navigation/Navigation.js +4 -3
  92. package/dist/lib/components/navigation/Navigation.js.map +1 -1
  93. package/dist/lib/components/navigation/NavigationCategory.js +8 -0
  94. package/dist/lib/components/navigation/NavigationCategory.js.map +1 -1
  95. package/dist/lib/components/navigation/NavigationFilterContext.d.ts +8 -0
  96. package/dist/lib/components/navigation/NavigationFilterContext.js +12 -0
  97. package/dist/lib/components/navigation/NavigationFilterContext.js.map +1 -0
  98. package/dist/lib/components/navigation/NavigationFilterInput.d.ts +3 -0
  99. package/dist/lib/components/navigation/NavigationFilterInput.js +9 -0
  100. package/dist/lib/components/navigation/NavigationFilterInput.js.map +1 -0
  101. package/dist/lib/components/navigation/NavigationItem.js +13 -3
  102. package/dist/lib/components/navigation/NavigationItem.js.map +1 -1
  103. package/dist/lib/components/navigation/NavigationWrapper.js +1 -1
  104. package/dist/lib/components/navigation/NavigationWrapper.js.map +1 -1
  105. package/dist/lib/components/navigation/utils.d.ts +6 -1
  106. package/dist/lib/components/navigation/utils.js +26 -2
  107. package/dist/lib/components/navigation/utils.js.map +1 -1
  108. package/dist/lib/core/RouteGuard.js +12 -7
  109. package/dist/lib/core/RouteGuard.js.map +1 -1
  110. package/dist/lib/core/ZudokuContext.d.ts +2 -1
  111. package/dist/lib/core/ZudokuContext.js +3 -1
  112. package/dist/lib/core/ZudokuContext.js.map +1 -1
  113. package/dist/lib/core/__internal.d.ts +1 -0
  114. package/dist/lib/core/__internal.js +2 -0
  115. package/dist/lib/core/__internal.js.map +1 -1
  116. package/dist/lib/core/plugins.d.ts +18 -4
  117. package/dist/lib/core/plugins.js +1 -0
  118. package/dist/lib/core/plugins.js.map +1 -1
  119. package/dist/lib/core/react-query.d.ts +1 -0
  120. package/dist/lib/core/react-query.js +2 -0
  121. package/dist/lib/core/react-query.js.map +1 -0
  122. package/dist/lib/core/transform-config.d.ts +4 -0
  123. package/dist/lib/core/transform-config.js +42 -0
  124. package/dist/lib/core/transform-config.js.map +1 -0
  125. package/dist/lib/core/transform-config.test.d.ts +1 -0
  126. package/dist/lib/core/transform-config.test.js +83 -0
  127. package/dist/lib/core/transform-config.test.js.map +1 -0
  128. package/dist/lib/errors/ErrorAlert.js +1 -2
  129. package/dist/lib/errors/ErrorAlert.js.map +1 -1
  130. package/dist/lib/errors/ErrorMessage.d.ts +3 -0
  131. package/dist/lib/errors/ErrorMessage.js +16 -0
  132. package/dist/lib/errors/ErrorMessage.js.map +1 -0
  133. package/dist/lib/hooks/index.d.ts +7 -28
  134. package/dist/lib/hooks/index.js +7 -15
  135. package/dist/lib/hooks/index.js.map +1 -1
  136. package/dist/lib/hooks/useEvent.test.js +1 -1
  137. package/dist/lib/hooks/useEvent.test.js.map +1 -1
  138. package/dist/lib/navigation/pathMatcher.d.ts +8 -0
  139. package/dist/lib/navigation/pathMatcher.js +62 -0
  140. package/dist/lib/navigation/pathMatcher.js.map +1 -0
  141. package/dist/lib/navigation/pathMatcher.test.d.ts +1 -0
  142. package/dist/lib/navigation/pathMatcher.test.js +115 -0
  143. package/dist/lib/navigation/pathMatcher.test.js.map +1 -0
  144. package/dist/lib/navigation/positionItems.d.ts +10 -0
  145. package/dist/lib/navigation/positionItems.js +54 -0
  146. package/dist/lib/navigation/positionItems.js.map +1 -0
  147. package/dist/lib/navigation/positionItems.test.d.ts +1 -0
  148. package/dist/lib/navigation/positionItems.test.js +229 -0
  149. package/dist/lib/navigation/positionItems.test.js.map +1 -0
  150. package/dist/lib/oas/graphql/circular.d.ts +2 -0
  151. package/dist/lib/oas/graphql/circular.js +21 -16
  152. package/dist/lib/oas/graphql/circular.js.map +1 -1
  153. package/dist/lib/oas/graphql/circular.test.d.ts +1 -0
  154. package/dist/lib/oas/graphql/circular.test.js +183 -0
  155. package/dist/lib/oas/graphql/circular.test.js.map +1 -0
  156. package/dist/lib/oas/graphql/index.js +7 -3
  157. package/dist/lib/oas/graphql/index.js.map +1 -1
  158. package/dist/lib/oas/parser/index.d.ts +1 -0
  159. package/dist/lib/oas/parser/index.js +14 -5
  160. package/dist/lib/oas/parser/index.js.map +1 -1
  161. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +9 -172
  162. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  163. package/dist/lib/plugins/api-keys/index.d.ts +11 -4
  164. package/dist/lib/plugins/api-keys/index.js +36 -22
  165. package/dist/lib/plugins/api-keys/index.js.map +1 -1
  166. package/dist/lib/plugins/api-keys/settings/ApiKeyItem.d.ts +12 -0
  167. package/dist/lib/plugins/api-keys/settings/ApiKeyItem.js +133 -0
  168. package/dist/lib/plugins/api-keys/settings/ApiKeyItem.js.map +1 -0
  169. package/dist/lib/plugins/api-keys/settings/ApiKeyList.d.ts +4 -0
  170. package/dist/lib/plugins/api-keys/settings/ApiKeyList.js +33 -0
  171. package/dist/lib/plugins/api-keys/settings/ApiKeyList.js.map +1 -0
  172. package/dist/lib/plugins/api-keys/settings/RevealApiKey.d.ts +6 -0
  173. package/dist/lib/plugins/api-keys/settings/RevealApiKey.js +39 -0
  174. package/dist/lib/plugins/api-keys/settings/RevealApiKey.js.map +1 -0
  175. package/dist/lib/plugins/openapi/DownloadSchemaButton.d.ts +3 -0
  176. package/dist/lib/plugins/openapi/DownloadSchemaButton.js +47 -0
  177. package/dist/lib/plugins/openapi/DownloadSchemaButton.js.map +1 -0
  178. package/dist/lib/plugins/openapi/Endpoint.js +3 -6
  179. package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
  180. package/dist/lib/plugins/openapi/GeneratedExampleSidecarBox.js +1 -1
  181. package/dist/lib/plugins/openapi/OasProvider.js +26 -13
  182. package/dist/lib/plugins/openapi/OasProvider.js.map +1 -1
  183. package/dist/lib/plugins/openapi/OperationList.js +20 -10
  184. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  185. package/dist/lib/plugins/openapi/OperationListItem.js +2 -2
  186. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  187. package/dist/lib/plugins/openapi/ParamInfos.js +1 -0
  188. package/dist/lib/plugins/openapi/ParamInfos.js.map +1 -1
  189. package/dist/lib/plugins/openapi/ParameterList.js +1 -1
  190. package/dist/lib/plugins/openapi/ParameterList.js.map +1 -1
  191. package/dist/lib/plugins/openapi/ResponsesSidecarBox.d.ts +2 -1
  192. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +4 -3
  193. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  194. package/dist/lib/plugins/openapi/SchemaList.js +2 -1
  195. package/dist/lib/plugins/openapi/SchemaList.js.map +1 -1
  196. package/dist/lib/plugins/openapi/Sidecar.js +12 -3
  197. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  198. package/dist/lib/plugins/openapi/index.js +11 -5
  199. package/dist/lib/plugins/openapi/index.js.map +1 -1
  200. package/dist/lib/plugins/openapi/interfaces.d.ts +19 -13
  201. package/dist/lib/plugins/openapi/playground/Playground.js +8 -4
  202. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  203. package/dist/lib/plugins/openapi/playground/fileUtils.d.ts +1 -0
  204. package/dist/lib/plugins/openapi/playground/fileUtils.js +3 -0
  205. package/dist/lib/plugins/openapi/playground/fileUtils.js.map +1 -1
  206. package/dist/lib/plugins/openapi/playground/result-panel/AudioPlayer.d.ts +6 -0
  207. package/dist/lib/plugins/openapi/playground/result-panel/AudioPlayer.js +20 -0
  208. package/dist/lib/plugins/openapi/playground/result-panel/AudioPlayer.js.map +1 -0
  209. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +7 -2
  210. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js.map +1 -1
  211. package/dist/lib/plugins/openapi/schema/SchemaView.d.ts +1 -1
  212. package/dist/lib/plugins/openapi/schema/SchemaView.js +16 -7
  213. package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
  214. package/dist/lib/plugins/openapi/schema/utils.d.ts +2 -2
  215. package/dist/lib/plugins/openapi/schema/utils.js +11 -3
  216. package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
  217. package/dist/lib/plugins/openapi/util/createHttpSnippet.js +24 -1
  218. package/dist/lib/plugins/openapi/util/createHttpSnippet.js.map +1 -1
  219. package/dist/lib/plugins/openapi/util/getRoutes.d.ts +9 -1
  220. package/dist/lib/plugins/openapi/util/getRoutes.js +30 -2
  221. package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
  222. package/dist/lib/plugins/search-pagefind/IndexingDialog.d.ts +3 -0
  223. package/dist/lib/plugins/search-pagefind/IndexingDialog.js +64 -0
  224. package/dist/lib/plugins/search-pagefind/IndexingDialog.js.map +1 -0
  225. package/dist/lib/plugins/search-pagefind/PagefindSearch.js +22 -5
  226. package/dist/lib/plugins/search-pagefind/PagefindSearch.js.map +1 -1
  227. package/dist/lib/plugins/search-pagefind/ResultList.js +5 -4
  228. package/dist/lib/plugins/search-pagefind/ResultList.js.map +1 -1
  229. package/dist/lib/shiki.d.ts +1 -1
  230. package/dist/lib/shiki.js +18 -12
  231. package/dist/lib/shiki.js.map +1 -1
  232. package/dist/lib/ui/Alert.d.ts +3 -2
  233. package/dist/lib/ui/Alert.js +9 -5
  234. package/dist/lib/ui/Alert.js.map +1 -1
  235. package/dist/lib/ui/Button.d.ts +2 -2
  236. package/dist/lib/ui/Button.js +10 -9
  237. package/dist/lib/ui/Button.js.map +1 -1
  238. package/dist/lib/ui/ButtonGroup.d.ts +11 -0
  239. package/dist/lib/ui/ButtonGroup.js +28 -0
  240. package/dist/lib/ui/ButtonGroup.js.map +1 -0
  241. package/dist/lib/ui/Command.d.ts +3 -3
  242. package/dist/lib/ui/Command.js +2 -2
  243. package/dist/lib/ui/Command.js.map +1 -1
  244. package/dist/lib/ui/DropdownMenu.d.ts +21 -23
  245. package/dist/lib/ui/DropdownMenu.js +47 -32
  246. package/dist/lib/ui/DropdownMenu.js.map +1 -1
  247. package/dist/lib/ui/InputGroup.d.ts +16 -0
  248. package/dist/lib/ui/InputGroup.js +65 -0
  249. package/dist/lib/ui/InputGroup.js.map +1 -0
  250. package/dist/lib/ui/Kbd.d.ts +3 -0
  251. package/dist/lib/ui/Kbd.js +10 -0
  252. package/dist/lib/ui/Kbd.js.map +1 -0
  253. package/dist/lib/ui/Secret.js +2 -2
  254. package/dist/lib/ui/Secret.js.map +1 -1
  255. package/dist/lib/util/MdxComponents.d.ts +1 -0
  256. package/dist/lib/util/MdxComponents.js +2 -0
  257. package/dist/lib/util/MdxComponents.js.map +1 -1
  258. package/dist/lib/util/flattenAllOf.d.ts +0 -2
  259. package/dist/lib/util/flattenAllOf.js +0 -23
  260. package/dist/lib/util/flattenAllOf.js.map +1 -1
  261. package/dist/lib/util/flattenAllOf.test.js +69 -13
  262. package/dist/lib/util/flattenAllOf.test.js.map +1 -1
  263. package/dist/lib/util/flattenAllOfProcessor.d.ts +2 -0
  264. package/dist/lib/util/flattenAllOfProcessor.js +48 -0
  265. package/dist/lib/util/flattenAllOfProcessor.js.map +1 -0
  266. package/dist/lib/util/invariant.d.ts +1 -1
  267. package/dist/lib/util/invariant.js +2 -2
  268. package/dist/lib/util/invariant.js.map +1 -1
  269. package/dist/lib/util/readFrontmatter.d.ts +6 -0
  270. package/dist/lib/util/readFrontmatter.js +13 -0
  271. package/dist/lib/util/readFrontmatter.js.map +1 -0
  272. package/dist/vite/api/SchemaManager.d.ts +17 -1
  273. package/dist/vite/api/SchemaManager.js +52 -11
  274. package/dist/vite/api/SchemaManager.js.map +1 -1
  275. package/dist/vite/api/SchemaManager.test.js +111 -0
  276. package/dist/vite/api/SchemaManager.test.js.map +1 -1
  277. package/dist/vite/build.js +91 -73
  278. package/dist/vite/build.js.map +1 -1
  279. package/dist/vite/config.js +16 -1
  280. package/dist/vite/config.js.map +1 -1
  281. package/dist/vite/dev-server.js +25 -0
  282. package/dist/vite/dev-server.js.map +1 -1
  283. package/dist/vite/error-handler.js +1 -5
  284. package/dist/vite/error-handler.js.map +1 -1
  285. package/dist/vite/mdx/remark-inject-filepath.js +5 -1
  286. package/dist/vite/mdx/remark-inject-filepath.js.map +1 -1
  287. package/dist/vite/mdx/remark-last-modified.js +57 -3
  288. package/dist/vite/mdx/remark-last-modified.js.map +1 -1
  289. package/dist/vite/mdx/remark-link-rewrite.js +4 -3
  290. package/dist/vite/mdx/remark-link-rewrite.js.map +1 -1
  291. package/dist/vite/pagefind-dev-index.d.ts +16 -0
  292. package/dist/vite/pagefind-dev-index.js +68 -0
  293. package/dist/vite/pagefind-dev-index.js.map +1 -0
  294. package/dist/vite/plugin-api-keys.js +5 -1
  295. package/dist/vite/plugin-api-keys.js.map +1 -1
  296. package/dist/vite/plugin-api.js +44 -4
  297. package/dist/vite/plugin-api.js.map +1 -1
  298. package/dist/vite/plugin-config.js +16 -4
  299. package/dist/vite/plugin-config.js.map +1 -1
  300. package/dist/vite/plugin-docs.js +9 -7
  301. package/dist/vite/plugin-docs.js.map +1 -1
  302. package/dist/vite/plugin-frontmatter.js +3 -5
  303. package/dist/vite/plugin-frontmatter.js.map +1 -1
  304. package/dist/vite/plugin-markdown-export.js +8 -7
  305. package/dist/vite/plugin-markdown-export.js.map +1 -1
  306. package/dist/vite/plugin-theme.js +2 -1
  307. package/dist/vite/plugin-theme.js.map +1 -1
  308. package/dist/vite/prerender/prerender.js +4 -20
  309. package/dist/vite/prerender/prerender.js.map +1 -1
  310. package/dist/vite/prerender/utils.d.ts +2 -0
  311. package/dist/vite/prerender/utils.js +30 -0
  312. package/dist/vite/prerender/utils.js.map +1 -0
  313. package/dist/vite/prerender/worker.js +6 -1
  314. package/dist/vite/prerender/worker.js.map +1 -1
  315. package/dist/vite/zuplo.d.ts +13 -0
  316. package/dist/vite/zuplo.js +15 -0
  317. package/dist/vite/zuplo.js.map +1 -0
  318. package/lib/ActionButton-B0CXL1Lq.js +25 -0
  319. package/lib/ActionButton-B0CXL1Lq.js.map +1 -0
  320. package/lib/Button-GUVe7pmt.js +54 -0
  321. package/lib/Button-GUVe7pmt.js.map +1 -0
  322. package/lib/{Card-KFniaZn5.js → Card-DCdq37aA.js} +2 -2
  323. package/lib/{Card-KFniaZn5.js.map → Card-DCdq37aA.js.map} +1 -1
  324. package/lib/ClaudeLogo-DoZ7fHHk.js +73 -0
  325. package/lib/ClaudeLogo-DoZ7fHHk.js.map +1 -0
  326. package/lib/{Command-CUcrW3qs.js → Command-N6VujV30.js} +26 -26
  327. package/lib/Command-N6VujV30.js.map +1 -0
  328. package/lib/{Dialog-BQciPiHN.js → Dialog-hlvmmQ_c.js} +2 -2
  329. package/lib/{Dialog-BQciPiHN.js.map → Dialog-hlvmmQ_c.js.map} +1 -1
  330. package/lib/{Drawer-Ci7XwhqT.js → Drawer-Ch7927PF.js} +7 -7
  331. package/lib/{Drawer-Ci7XwhqT.js.map → Drawer-Ch7927PF.js.map} +1 -1
  332. package/lib/DropdownMenu-DN0jNrjj.js +104 -0
  333. package/lib/DropdownMenu-DN0jNrjj.js.map +1 -0
  334. package/lib/Frame-DKlOmSkU.js +205 -0
  335. package/lib/Frame-DKlOmSkU.js.map +1 -0
  336. package/lib/HydrationBoundary-CJu4vUlG.js +601 -0
  337. package/lib/HydrationBoundary-CJu4vUlG.js.map +1 -0
  338. package/lib/IndexingDialog-D0YdGfbn.js +100 -0
  339. package/lib/IndexingDialog-D0YdGfbn.js.map +1 -0
  340. package/lib/Input-Cx-GeKoF.js +22 -0
  341. package/lib/Input-Cx-GeKoF.js.map +1 -0
  342. package/lib/MdxPage-Bc_5OsQ5.js +210 -0
  343. package/lib/MdxPage-Bc_5OsQ5.js.map +1 -0
  344. package/lib/Mermaid-Chx5BPHn.js +104 -0
  345. package/lib/Mermaid-Chx5BPHn.js.map +1 -0
  346. package/lib/{OAuthErrorPage-DnKnq4xK.js → OAuthErrorPage-D-VcZ5cO.js} +26 -23
  347. package/lib/OAuthErrorPage-D-VcZ5cO.js.map +1 -0
  348. package/lib/OasProvider-CZqLHoRo.js +48 -0
  349. package/lib/OasProvider-CZqLHoRo.js.map +1 -0
  350. package/lib/{OperationList-D8EDc9v7.js → OperationList-BmV1XvEY.js} +2136 -2002
  351. package/lib/OperationList-BmV1XvEY.js.map +1 -0
  352. package/lib/RouteGuard-Dns7HD7C.js +77 -0
  353. package/lib/RouteGuard-Dns7HD7C.js.map +1 -0
  354. package/lib/{SchemaList-E6lF7dID.js → SchemaList-D23IyrX5.js} +28 -27
  355. package/lib/SchemaList-D23IyrX5.js.map +1 -0
  356. package/lib/SchemaView-DVbiGPo3.js +438 -0
  357. package/lib/SchemaView-DVbiGPo3.js.map +1 -0
  358. package/lib/Secret-CyhXSA8i.js +263 -0
  359. package/lib/Secret-CyhXSA8i.js.map +1 -0
  360. package/lib/SignUp-DfEe1w5X.js +55 -0
  361. package/lib/SignUp-DfEe1w5X.js.map +1 -0
  362. package/lib/{SyntaxHighlight-C19vH0V_.js → SyntaxHighlight-N2RffYNz.js} +1469 -1411
  363. package/lib/SyntaxHighlight-N2RffYNz.js.map +1 -0
  364. package/lib/{Toc-DbWS75JZ.js → Toc-Cpo_HSYx.js} +3 -3
  365. package/lib/{Toc-DbWS75JZ.js.map → Toc-Cpo_HSYx.js.map} +1 -1
  366. package/lib/{ErrorAlert-_1Zmhr68.js → Zudoku-GbutmWzP.js} +5663 -4482
  367. package/lib/Zudoku-GbutmWzP.js.map +1 -0
  368. package/lib/ZudokuContext-LPkD2SQs.js +250 -0
  369. package/lib/ZudokuContext-LPkD2SQs.js.map +1 -0
  370. package/lib/ZudokuReactContext-DGJAP1sN.js +222 -0
  371. package/lib/ZudokuReactContext-DGJAP1sN.js.map +1 -0
  372. package/lib/chunk-EPOLDU6W-C6C8jAwd.js +8558 -0
  373. package/lib/chunk-EPOLDU6W-C6C8jAwd.js.map +1 -0
  374. package/lib/{circular-BoYo7au5.js → circular-DfSpMuY7.js} +6429 -6019
  375. package/lib/circular-DfSpMuY7.js.map +1 -0
  376. package/lib/{cn-dYga0KKN.js → cn-5-Gd1Dss.js} +531 -498
  377. package/lib/cn-5-Gd1Dss.js.map +1 -0
  378. package/lib/{createServer-B_BZ7xX8.js → createServer-4kaAMuIM.js} +2790 -2737
  379. package/lib/createServer-4kaAMuIM.js.map +1 -0
  380. package/lib/createVariantComponent-Dc0vtOvr.js +18 -0
  381. package/lib/createVariantComponent-Dc0vtOvr.js.map +1 -0
  382. package/lib/{errors-CD873hrG.js → errors-CtZTDEB6.js} +3 -3
  383. package/lib/{errors-CD873hrG.js.map → errors-CtZTDEB6.js.map} +1 -1
  384. package/lib/firebase-D286uF4e.js +7615 -0
  385. package/lib/firebase-D286uF4e.js.map +1 -0
  386. package/lib/hook-DyEn6D2Q.js +53 -0
  387. package/lib/hook-DyEn6D2Q.js.map +1 -0
  388. package/lib/{index-HNVs5cgX.js → index-B7bvsQHg.js} +853 -802
  389. package/lib/index-B7bvsQHg.js.map +1 -0
  390. package/lib/{index-BK0jKRrX.js → index-CVumYRba.js} +2 -2
  391. package/lib/{index-BK0jKRrX.js.map → index-CVumYRba.js.map} +1 -1
  392. package/lib/index-CrcNWbel.js.map +1 -1
  393. package/lib/index-DAWHN3cH.js +86 -0
  394. package/lib/index-DAWHN3cH.js.map +1 -0
  395. package/lib/index.esm-BYObtETB.js.map +1 -1
  396. package/lib/index.esm-BkpWrvLZ.js +34 -0
  397. package/lib/index.esm-BkpWrvLZ.js.map +1 -0
  398. package/lib/{index.esm-BnYHxCYC.js → index.esm-Ca5zvoff.js} +2 -2
  399. package/lib/{index.esm-BnYHxCYC.js.map → index.esm-Ca5zvoff.js.map} +1 -1
  400. package/lib/{invariant-Bm-FVUQE.js → invariant-B_t_F2s_.js} +4 -4
  401. package/lib/invariant-B_t_F2s_.js.map +1 -0
  402. package/lib/jsx-runtime-BzflLqGi.js.map +1 -1
  403. package/lib/{mutation-BSU0xu4m.js → mutation-B7eFBLZY.js} +70 -44
  404. package/lib/mutation-B7eFBLZY.js.map +1 -0
  405. package/lib/ui/Accordion.js +1 -1
  406. package/lib/ui/ActionButton.js +2 -2
  407. package/lib/ui/Alert.js +32 -20
  408. package/lib/ui/Alert.js.map +1 -1
  409. package/lib/ui/AlertDialog.js +1 -1
  410. package/lib/ui/Badge.js +1 -1
  411. package/lib/ui/Breadcrumb.js +1 -1
  412. package/lib/ui/Button.js +27 -25
  413. package/lib/ui/Button.js.map +1 -1
  414. package/lib/ui/ButtonGroup.js +77 -0
  415. package/lib/ui/ButtonGroup.js.map +1 -0
  416. package/lib/ui/Callout.js +1 -1
  417. package/lib/ui/Card.js +1 -1
  418. package/lib/ui/Carousel.js +1 -1
  419. package/lib/ui/Carousel.js.map +1 -1
  420. package/lib/ui/Checkbox.js +1 -1
  421. package/lib/ui/CodeBlock.js +1 -1
  422. package/lib/ui/Command.js +5 -5
  423. package/lib/ui/Command.js.map +1 -1
  424. package/lib/ui/Dialog.js +1 -1
  425. package/lib/ui/Drawer.js +3 -3
  426. package/lib/ui/DropdownMenu.js +227 -140
  427. package/lib/ui/DropdownMenu.js.map +1 -1
  428. package/lib/ui/EmbeddedCodeBlock.js +1 -1
  429. package/lib/ui/Form.js +1 -1
  430. package/lib/ui/Frame.js +1 -1
  431. package/lib/ui/HoverCard.js +1 -1
  432. package/lib/ui/Input.js +1 -1
  433. package/lib/ui/InputGroup.js +155 -0
  434. package/lib/ui/InputGroup.js.map +1 -0
  435. package/lib/ui/Item.js +1 -1
  436. package/lib/ui/Kbd.js +32 -0
  437. package/lib/ui/Kbd.js.map +1 -0
  438. package/lib/ui/Label.js +1 -1
  439. package/lib/ui/NativeSelect.js +1 -1
  440. package/lib/ui/Pagination.js +1 -1
  441. package/lib/ui/Popover.js +1 -1
  442. package/lib/ui/Progress.js +1 -1
  443. package/lib/ui/RadioGroup.js +1 -1
  444. package/lib/ui/ScrollArea.js +1 -1
  445. package/lib/ui/Secret.js +3 -3
  446. package/lib/ui/Secret.js.map +1 -1
  447. package/lib/ui/Separator.js +1 -1
  448. package/lib/ui/Skeleton.js +1 -1
  449. package/lib/ui/Slider.js +1 -1
  450. package/lib/ui/Switch.js +1 -1
  451. package/lib/ui/SyntaxHighlight.js +3 -3
  452. package/lib/ui/Tabs.js +1 -1
  453. package/lib/ui/Textarea.js +1 -1
  454. package/lib/ui/Toggle.js +1 -1
  455. package/lib/ui/ToggleGroup.js +1 -1
  456. package/lib/ui/Value.js +1 -1
  457. package/lib/ui/util.js +1 -1
  458. package/lib/useExposedProps-CzTDfXfq.js +30 -0
  459. package/lib/useExposedProps-CzTDfXfq.js.map +1 -0
  460. package/lib/useMutation-CErliDZ9.js +119 -0
  461. package/lib/useMutation-CErliDZ9.js.map +1 -0
  462. package/lib/useQuery-ht7aWJ3S.js +1212 -0
  463. package/lib/useQuery-ht7aWJ3S.js.map +1 -0
  464. package/lib/useSuspenseQuery-DQH4Bmc2.js +18 -0
  465. package/lib/useSuspenseQuery-DQH4Bmc2.js.map +1 -0
  466. package/lib/zudoku.__internal.js +1540 -1553
  467. package/lib/zudoku.__internal.js.map +1 -1
  468. package/lib/zudoku.auth-auth0.js +19 -18
  469. package/lib/zudoku.auth-auth0.js.map +1 -1
  470. package/lib/zudoku.auth-azureb2c.js +14 -13
  471. package/lib/zudoku.auth-azureb2c.js.map +1 -1
  472. package/lib/zudoku.auth-clerk.js +52 -75
  473. package/lib/zudoku.auth-clerk.js.map +1 -1
  474. package/lib/zudoku.auth-firebase.js +10 -0
  475. package/lib/zudoku.auth-firebase.js.map +1 -0
  476. package/lib/zudoku.auth-openid.js +8 -7
  477. package/lib/zudoku.auth-openid.js.map +1 -1
  478. package/lib/zudoku.auth-supabase.js +31 -40
  479. package/lib/zudoku.auth-supabase.js.map +1 -1
  480. package/lib/zudoku.components.js +29 -25
  481. package/lib/zudoku.components.js.map +1 -1
  482. package/lib/zudoku.hooks.js +20 -20
  483. package/lib/zudoku.hooks.js.map +1 -1
  484. package/lib/zudoku.mermaid.js +11 -0
  485. package/lib/zudoku.mermaid.js.map +1 -0
  486. package/lib/zudoku.plugin-api-catalog.js +42 -37
  487. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  488. package/lib/zudoku.plugin-api-keys.js +617 -550
  489. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  490. package/lib/zudoku.plugin-custom-pages.js +1 -1
  491. package/lib/zudoku.plugin-markdown.js +1 -1
  492. package/lib/zudoku.plugin-openapi.js +3 -3
  493. package/lib/zudoku.plugin-redirect.js +1 -1
  494. package/lib/zudoku.plugin-search-pagefind.js +186 -226
  495. package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
  496. package/lib/zudoku.plugins.js +9 -8
  497. package/lib/zudoku.plugins.js.map +1 -1
  498. package/lib/zudoku.react-query.js +441 -0
  499. package/lib/zudoku.react-query.js.map +1 -0
  500. package/lib/zudoku.router.js +1130 -1404
  501. package/lib/zudoku.router.js.map +1 -1
  502. package/package.json +63 -37
  503. package/src/app/defaultTheme.css +4 -0
  504. package/src/app/main.css +2 -0
  505. package/src/app/main.tsx +1 -1
  506. package/src/app/sentry.ts +1 -1
  507. package/src/lib/auth/issuer.ts +1 -1
  508. package/src/lib/authentication/authentication.ts +8 -2
  509. package/src/lib/authentication/components/CallbackHandler.tsx +1 -1
  510. package/src/lib/authentication/components/SignIn.tsx +5 -2
  511. package/src/lib/authentication/components/SignUp.tsx +5 -2
  512. package/src/lib/authentication/hook.ts +16 -0
  513. package/src/lib/authentication/providers/auth0.tsx +21 -10
  514. package/src/lib/authentication/providers/clerk.tsx +0 -26
  515. package/src/lib/authentication/providers/firebase.tsx +98 -6
  516. package/src/lib/authentication/providers/supabase.tsx +6 -15
  517. package/src/lib/authentication/ui/EmailVerificationUi.tsx +129 -0
  518. package/src/lib/authentication/ui/ZudokuAuthUi.tsx +181 -39
  519. package/src/lib/authentication/utils/relativeRedirectUrl.ts +12 -0
  520. package/src/lib/components/Bootstrap.tsx +1 -4
  521. package/src/lib/components/Mermaid.tsx +68 -0
  522. package/src/lib/components/MobileTopNavigation.tsx +16 -9
  523. package/src/lib/components/PagefindSearchMeta.tsx +14 -0
  524. package/src/lib/components/Pagination.tsx +4 -5
  525. package/src/lib/components/Slot.test.tsx +1 -1
  526. package/src/lib/components/TopNavigation.tsx +26 -8
  527. package/src/lib/components/Zudoku.tsx +22 -21
  528. package/src/lib/components/context/ZudokuContext.ts +33 -12
  529. package/src/lib/components/context/ZudokuProvider.tsx +1 -1
  530. package/src/lib/components/context/ZudokuReactContext.tsx +17 -0
  531. package/src/lib/components/index.ts +19 -35
  532. package/src/lib/components/navigation/Navigation.tsx +4 -3
  533. package/src/lib/components/navigation/NavigationCategory.tsx +9 -0
  534. package/src/lib/components/navigation/NavigationFilterContext.tsx +28 -0
  535. package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -0
  536. package/src/lib/components/navigation/NavigationItem.tsx +26 -4
  537. package/src/lib/components/navigation/NavigationWrapper.tsx +1 -1
  538. package/src/lib/components/navigation/utils.ts +44 -2
  539. package/src/lib/core/RouteGuard.tsx +30 -24
  540. package/src/lib/core/ZudokuContext.ts +7 -1
  541. package/src/lib/core/__internal.tsx +2 -0
  542. package/src/lib/core/plugins.ts +27 -3
  543. package/src/lib/core/react-query.ts +1 -0
  544. package/src/lib/core/transform-config.test.tsx +99 -0
  545. package/src/lib/core/transform-config.ts +67 -0
  546. package/src/lib/errors/ErrorAlert.tsx +1 -6
  547. package/src/lib/errors/ErrorMessage.tsx +38 -0
  548. package/src/lib/hooks/index.ts +7 -16
  549. package/src/lib/hooks/useEvent.test.tsx +1 -1
  550. package/src/lib/navigation/pathMatcher.test.ts +136 -0
  551. package/src/lib/navigation/pathMatcher.ts +93 -0
  552. package/src/lib/navigation/positionItems.test.ts +265 -0
  553. package/src/lib/navigation/positionItems.ts +111 -0
  554. package/src/lib/oas/graphql/circular.test.ts +221 -0
  555. package/src/lib/oas/graphql/circular.ts +31 -18
  556. package/src/lib/oas/graphql/index.ts +7 -3
  557. package/src/lib/oas/parser/index.ts +19 -6
  558. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +36 -476
  559. package/src/lib/plugins/api-keys/index.tsx +76 -32
  560. package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -0
  561. package/src/lib/plugins/api-keys/settings/ApiKeyList.tsx +67 -0
  562. package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +124 -0
  563. package/src/lib/plugins/openapi/DownloadSchemaButton.tsx +115 -0
  564. package/src/lib/plugins/openapi/Endpoint.tsx +20 -27
  565. package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +1 -1
  566. package/src/lib/plugins/openapi/OasProvider.tsx +38 -17
  567. package/src/lib/plugins/openapi/OperationList.tsx +48 -28
  568. package/src/lib/plugins/openapi/OperationListItem.tsx +5 -5
  569. package/src/lib/plugins/openapi/ParamInfos.tsx +1 -0
  570. package/src/lib/plugins/openapi/ParameterList.tsx +2 -2
  571. package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +37 -15
  572. package/src/lib/plugins/openapi/SchemaList.tsx +4 -0
  573. package/src/lib/plugins/openapi/Sidecar.tsx +20 -3
  574. package/src/lib/plugins/openapi/index.tsx +16 -7
  575. package/src/lib/plugins/openapi/interfaces.ts +21 -7
  576. package/src/lib/plugins/openapi/playground/Playground.tsx +8 -4
  577. package/src/lib/plugins/openapi/playground/fileUtils.ts +4 -0
  578. package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -0
  579. package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +33 -17
  580. package/src/lib/plugins/openapi/schema/SchemaView.tsx +56 -43
  581. package/src/lib/plugins/openapi/schema/utils.ts +20 -6
  582. package/src/lib/plugins/openapi/util/createHttpSnippet.ts +29 -1
  583. package/src/lib/plugins/openapi/util/getRoutes.tsx +38 -3
  584. package/src/lib/plugins/search-pagefind/IndexingDialog.tsx +163 -0
  585. package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +61 -22
  586. package/src/lib/plugins/search-pagefind/ResultList.tsx +8 -3
  587. package/src/lib/shiki.ts +21 -12
  588. package/src/lib/ui/Alert.tsx +17 -5
  589. package/src/lib/ui/Button.tsx +11 -10
  590. package/src/lib/ui/ButtonGroup.tsx +82 -0
  591. package/src/lib/ui/Command.tsx +3 -3
  592. package/src/lib/ui/DropdownMenu.tsx +226 -170
  593. package/src/lib/ui/InputGroup.tsx +168 -0
  594. package/src/lib/ui/Kbd.tsx +28 -0
  595. package/src/lib/ui/Secret.tsx +2 -2
  596. package/src/lib/util/MdxComponents.tsx +2 -0
  597. package/src/lib/util/flattenAllOf.test.ts +73 -20
  598. package/src/lib/util/flattenAllOf.ts +0 -36
  599. package/src/lib/util/flattenAllOfProcessor.ts +58 -0
  600. package/src/lib/util/invariant.ts +2 -1
  601. package/src/lib/util/readFrontmatter.ts +14 -0
  602. package/src/shiki/langs/c3.js +1 -0
  603. package/src/shiki/langs/gn.js +1 -0
  604. package/src/shiki/langs/markdown-nix.js +1 -0
  605. package/src/shiki/langs/moonbit.js +1 -0
  606. package/src/shiki/langs/openscad.js +1 -0
  607. package/src/zuplo/enrich-with-zuplo-mcp.ts +168 -0
  608. package/src/zuplo/enrich-with-zuplo.ts +254 -0
  609. package/src/zuplo/policy-types.ts +46 -0
  610. package/src/zuplo/with-zuplo-processors.ts +35 -0
  611. package/src/zuplo/with-zuplo.ts +14 -0
  612. package/dist/vite/create-pagefind-index.d.ts +0 -4
  613. package/dist/vite/create-pagefind-index.js +0 -12
  614. package/dist/vite/create-pagefind-index.js.map +0 -1
  615. package/lib/Button-B3ucvvQw.js +0 -52
  616. package/lib/Button-B3ucvvQw.js.map +0 -1
  617. package/lib/Command-CUcrW3qs.js.map +0 -1
  618. package/lib/DropdownMenu-BZ2NKQ3K.js +0 -126
  619. package/lib/DropdownMenu-BZ2NKQ3K.js.map +0 -1
  620. package/lib/ErrorAlert-_1Zmhr68.js.map +0 -1
  621. package/lib/MdxPage-B2t1EShN.js +0 -240
  622. package/lib/MdxPage-B2t1EShN.js.map +0 -1
  623. package/lib/OAuthErrorPage-DnKnq4xK.js.map +0 -1
  624. package/lib/OasProvider-BhuIkD4Z.js +0 -36
  625. package/lib/OasProvider-BhuIkD4Z.js.map +0 -1
  626. package/lib/OperationList-D8EDc9v7.js.map +0 -1
  627. package/lib/Pagination-hk-llhpw.js +0 -37
  628. package/lib/Pagination-hk-llhpw.js.map +0 -1
  629. package/lib/RouteGuard-Brz95MSt.js +0 -77
  630. package/lib/RouteGuard-Brz95MSt.js.map +0 -1
  631. package/lib/RouterError-CMaIfdjb.js +0 -42
  632. package/lib/RouterError-CMaIfdjb.js.map +0 -1
  633. package/lib/SchemaList-E6lF7dID.js.map +0 -1
  634. package/lib/SchemaView-CIv-OXgv.js +0 -572
  635. package/lib/SchemaView-CIv-OXgv.js.map +0 -1
  636. package/lib/Select-DFRCS31-.js +0 -399
  637. package/lib/Select-DFRCS31-.js.map +0 -1
  638. package/lib/SignUp-sGYAsj2K.js +0 -50
  639. package/lib/SignUp-sGYAsj2K.js.map +0 -1
  640. package/lib/SyntaxHighlight-C19vH0V_.js.map +0 -1
  641. package/lib/ZudokuContext-BUZ5hkWB.js +0 -1508
  642. package/lib/ZudokuContext-BUZ5hkWB.js.map +0 -1
  643. package/lib/chunk-PVWAREVJ-BMhpCH5D.js +0 -7965
  644. package/lib/chunk-PVWAREVJ-BMhpCH5D.js.map +0 -1
  645. package/lib/circular-BoYo7au5.js.map +0 -1
  646. package/lib/cn-dYga0KKN.js.map +0 -1
  647. package/lib/createServer-B_BZ7xX8.js.map +0 -1
  648. package/lib/hook-CMeoxziF.js +0 -40
  649. package/lib/hook-CMeoxziF.js.map +0 -1
  650. package/lib/index-HNVs5cgX.js.map +0 -1
  651. package/lib/index-pMMX55GH.js +0 -1059
  652. package/lib/index-pMMX55GH.js.map +0 -1
  653. package/lib/invariant-Bm-FVUQE.js.map +0 -1
  654. package/lib/mutation-BSU0xu4m.js.map +0 -1
  655. package/lib/useExposedProps-U3pmsHaG.js +0 -113
  656. package/lib/useExposedProps-U3pmsHaG.js.map +0 -1
@@ -1,56 +1,182 @@
1
1
  import { j as e } from "./jsx-runtime-BzflLqGi.js";
2
- import { CircleSlashIcon as z, CheckIcon as ue, XIcon as he, PencilLineIcon as fe, RefreshCwIcon as pe, TrashIcon as me, KeyRoundIcon as xe } from "lucide-react";
3
- import { R as ye } from "./RouterError-CMaIfdjb.js";
4
- import { i as I } from "./invariant-Bm-FVUQE.js";
5
- import { O as ge, u as je } from "./chunk-PVWAREVJ-BMhpCH5D.js";
6
- import { u as Ce } from "./hook-CMeoxziF.js";
7
- import { D as ve, a as Y } from "./ErrorAlert-_1Zmhr68.js";
8
- import { Button as w } from "./ui/Button.js";
9
- import { a as se, g as ne, b as we } from "./ZudokuContext-BUZ5hkWB.js";
10
- import { u as O, A as M, a as q, b as ke, S as be, c as Ne, d as Ke, e as Ee, f as De, g as Z, h as Ae } from "./Select-DFRCS31-.js";
11
- import * as L from "react";
12
- import Pe, { createContext as Q, useRef as E, useLayoutEffect as Ie, useEffect as re, useId as _, useContext as B, useInsertionEffect as Re, useMemo as F, useCallback as Se, Children as Te, isValidElement as Oe, useState as K, forwardRef as Me } from "react";
13
- import { C as qe, a as $e } from "./Card-KFniaZn5.js";
14
- import { e as H, f as D, D as V, g as G, a as J, b as U, c as W, d as ie } from "./Dialog-BQciPiHN.js";
15
- import { Input as ae } from "./ui/Input.js";
16
- import { c as A } from "./cn-dYga0KKN.js";
17
- import { a as ze } from "./index.esm-BYObtETB.js";
18
- import { B as Fe } from "./Button-B3ucvvQw.js";
19
- import { S as Le } from "./Spinner-CI6bRyZw.js";
20
- import { useAuth as Qe } from "./zudoku.hooks.js";
21
- const _e = () => {
22
- const t = Ce();
23
- return t.isAuthEnabled && t.isPending ? null : t.isAuthEnabled ? t.isAuthenticated ? /* @__PURE__ */ e.jsx(ge, {}) : /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: [
24
- "Please login first to view this page",
25
- /* @__PURE__ */ e.jsx(w, { onClick: () => t.login(), children: "Login" })
26
- ] }) : /* @__PURE__ */ e.jsx("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: /* @__PURE__ */ e.jsxs(ve, { className: "max-w-[600px]", children: [
27
- "Authentication needs to be enabled for API keys to work. Enable it in your Zudoku configuration under ",
28
- /* @__PURE__ */ e.jsx("code", { children: "authentication" }),
29
- "."
30
- ] }) });
31
- }, Be = Q({});
32
- function oe(t) {
33
- const r = E(null);
34
- return r.current === null && (r.current = t()), r.current;
2
+ import { TrashIcon as me, CircleSlashIcon as z, CheckIcon as xe, XIcon as ye, PencilLineIcon as ge, RefreshCwIcon as je, KeyRoundIcon as ve } from "lucide-react";
3
+ import { Z as M, i as E } from "./invariant-B_t_F2s_.js";
4
+ import * as F from "react";
5
+ import { createContext as Q, useRef as A, useLayoutEffect as Ce, useEffect as re, useId as H, useContext as V, useInsertionEffect as we, useMemo as L, useCallback as ke, Children as Ee, isValidElement as Ie, useState as I } from "react";
6
+ import { D as be, a as te, E as Ke } from "./Zudoku-GbutmWzP.js";
7
+ import { Button as _ } from "./ui/Button.js";
8
+ import "./ZudokuReactContext-DGJAP1sN.js";
9
+ import "./index-DAWHN3cH.js";
10
+ import { u as ae } from "./hook-DyEn6D2Q.js";
11
+ import { F as De, g as Pe, j as Ae, h as Se, d as Re, I as Ne, a as Oe, b as Te, k as qe, c as Me } from "./Frame-DKlOmSkU.js";
12
+ import { A as D, a as P, b as oe } from "./Mermaid-Chx5BPHn.js";
13
+ import { S as Fe, a as $e, b as ze, c as Le, d as Qe, e as He, f as se, g as Ve } from "./Secret-CyhXSA8i.js";
14
+ import { e as B, f as S, D as Z, g as G, a as J, b as Y, c as U, d as le } from "./Dialog-hlvmmQ_c.js";
15
+ import { b as ce } from "./useQuery-ht7aWJ3S.js";
16
+ import { u as q } from "./useMutation-CErliDZ9.js";
17
+ import { a as _e } from "./index.esm-BYObtETB.js";
18
+ import { u as Be } from "./chunk-EPOLDU6W-C6C8jAwd.js";
19
+ import { A as Ze } from "./ActionButton-B0CXL1Lq.js";
20
+ import { a as W } from "./ZudokuContext-LPkD2SQs.js";
21
+ import { Input as Ge } from "./ui/Input.js";
22
+ import { u as Je } from "./useSuspenseQuery-DQH4Bmc2.js";
23
+ import { c as X } from "./cn-5-Gd1Dss.js";
24
+ import { B as k } from "./Button-GUVe7pmt.js";
25
+ import { I as Ye } from "./Input-Cx-GeKoF.js";
26
+ function Ue({ error: t }) {
27
+ const a = t instanceof Error ? t.message : "Something went wrong", s = process.env.NODE_ENV === "development", n = t instanceof M ? t.developerHint : void 0, r = t instanceof M ? t.title : "Something went wrong", i = t instanceof Error ? t.stack : void 0, o = t instanceof Error ? t.cause : void 0, d = o instanceof Error ? String(o.stack) : i;
28
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
29
+ /* @__PURE__ */ e.jsxs(D, { variant: "destructive", children: [
30
+ /* @__PURE__ */ e.jsx(P, { children: r }),
31
+ /* @__PURE__ */ e.jsx(oe, { children: a })
32
+ ] }),
33
+ s && n && /* @__PURE__ */ e.jsx(be, { className: "mb-4", children: n }),
34
+ s && d && /* @__PURE__ */ e.jsx(
35
+ Fe,
36
+ {
37
+ className: "max-h-[400px] [&>pre]:p-4",
38
+ language: "js",
39
+ code: d
40
+ }
41
+ )
42
+ ] });
43
+ }
44
+ const We = ({
45
+ service: t,
46
+ onOpenChange: a
47
+ }) => {
48
+ const s = W(), n = ce(), r = Be(), i = _e({
49
+ defaultValues: {
50
+ expiresOn: "30"
51
+ }
52
+ }), o = ae(), d = q({
53
+ mutationFn: ({ description: c, expiresOn: u }) => {
54
+ if (!t.createKey)
55
+ throw new Error("createKey not implemented");
56
+ const f = u !== "never" ? Xe(Number(u)) : void 0;
57
+ return t.createKey({
58
+ apiKey: {
59
+ description: c || "Secret Key",
60
+ expiresOn: f
61
+ },
62
+ context: s,
63
+ auth: o
64
+ });
65
+ },
66
+ onSuccess: async () => {
67
+ await n.invalidateQueries({ queryKey: ["api-keys"] }), await r("/settings/api-keys/");
68
+ }
69
+ });
70
+ return t.createKey ? /* @__PURE__ */ e.jsxs(
71
+ "form",
72
+ {
73
+ onSubmit: i.handleSubmit(
74
+ (c) => d.mutate(
75
+ { ...c },
76
+ {
77
+ onSuccess: () => a(!1)
78
+ }
79
+ )
80
+ ),
81
+ children: [
82
+ d.error && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
83
+ /* @__PURE__ */ e.jsx(P, { children: "Error" }),
84
+ /* @__PURE__ */ e.jsx(oe, { children: d.error.message })
85
+ ] }),
86
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 flex-col text-sm font-medium", children: [
87
+ "Name",
88
+ /* @__PURE__ */ e.jsx(Ge, { ...i.register("description") }),
89
+ "Expiration",
90
+ /* @__PURE__ */ e.jsxs(
91
+ $e,
92
+ {
93
+ onValueChange: (c) => i.setValue("expiresOn", c),
94
+ defaultValue: i.getValues("expiresOn"),
95
+ children: [
96
+ /* @__PURE__ */ e.jsx(ze, { children: /* @__PURE__ */ e.jsx(Le, {}) }),
97
+ /* @__PURE__ */ e.jsx(Qe, { children: /* @__PURE__ */ e.jsxs(He, { children: [
98
+ [7, 30, 60, 90].map((c) => /* @__PURE__ */ e.jsxs(se, { value: String(c), children: [
99
+ c,
100
+ " days"
101
+ ] }, c)),
102
+ /* @__PURE__ */ e.jsx(se, { value: "never", children: "Never" })
103
+ ] }) })
104
+ ]
105
+ }
106
+ ),
107
+ /* @__PURE__ */ e.jsxs(B, { children: [
108
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(_, { variant: "outline", children: "Cancel" }) }),
109
+ /* @__PURE__ */ e.jsx(Ze, { isPending: d.isPending, children: "Generate Key" })
110
+ ] })
111
+ ] })
112
+ ]
113
+ }
114
+ ) : null;
115
+ }, Xe = (t) => {
116
+ const a = /* @__PURE__ */ new Date();
117
+ return a.setDate(a.getDate() + t), a.toISOString();
118
+ }, de = ({
119
+ service: t,
120
+ isOpen: a,
121
+ onOpenChange: s,
122
+ trigger: n,
123
+ buttonVariant: r = "outline"
124
+ }) => {
125
+ const i = /* @__PURE__ */ e.jsx(_, { variant: r, children: "Create API Key" });
126
+ return /* @__PURE__ */ e.jsxs(Z, { open: a, onOpenChange: s, children: [
127
+ /* @__PURE__ */ e.jsx(G, { asChild: !0, children: n ?? i }),
128
+ /* @__PURE__ */ e.jsxs(J, { children: [
129
+ /* @__PURE__ */ e.jsx(Y, { children: /* @__PURE__ */ e.jsx(U, { children: "Create API Key" }) }),
130
+ /* @__PURE__ */ e.jsx(We, { service: t, onOpenChange: s })
131
+ ] })
132
+ ] });
133
+ }, et = Q({});
134
+ function ue(t) {
135
+ const a = A(null);
136
+ return a.current === null && (a.current = t()), a.current;
35
137
  }
36
- const He = typeof window < "u", Ve = He ? Ie : re, le = /* @__PURE__ */ Q(null);
37
- function Ge(t) {
138
+ const tt = typeof window < "u", st = tt ? Ce : re, pe = /* @__PURE__ */ Q(null);
139
+ function nt(t) {
38
140
  return typeof t == "object" && t !== null;
39
141
  }
40
- function Je(t) {
41
- return Ge(t) && "offsetHeight" in t;
142
+ function it(t) {
143
+ return nt(t) && "offsetHeight" in t;
42
144
  }
43
- const Ue = Q({
145
+ const rt = Q({
44
146
  transformPagePoint: (t) => t,
45
147
  isStatic: !1,
46
148
  reducedMotion: "never"
47
149
  });
48
- class We extends L.Component {
49
- getSnapshotBeforeUpdate(r) {
150
+ function ne(t, a) {
151
+ if (typeof t == "function")
152
+ return t(a);
153
+ t != null && (t.current = a);
154
+ }
155
+ function at(...t) {
156
+ return (a) => {
157
+ let s = !1;
158
+ const n = t.map((r) => {
159
+ const i = ne(r, a);
160
+ return !s && typeof i == "function" && (s = !0), i;
161
+ });
162
+ if (s)
163
+ return () => {
164
+ for (let r = 0; r < n.length; r++) {
165
+ const i = n[r];
166
+ typeof i == "function" ? i() : ne(t[r], null);
167
+ }
168
+ };
169
+ };
170
+ }
171
+ function ot(...t) {
172
+ return F.useCallback(at(...t), t);
173
+ }
174
+ class lt extends F.Component {
175
+ getSnapshotBeforeUpdate(a) {
50
176
  const s = this.props.childRef.current;
51
- if (s && r.isPresent && !this.props.isPresent) {
52
- const n = s.offsetParent, i = Je(n) && n.offsetWidth || 0, a = this.props.sizeRef.current;
53
- a.height = s.offsetHeight || 0, a.width = s.offsetWidth || 0, a.top = s.offsetTop, a.left = s.offsetLeft, a.right = i - a.width - a.left;
177
+ if (s && a.isPresent && !this.props.isPresent) {
178
+ const n = s.offsetParent, r = it(n) && n.offsetWidth || 0, i = this.props.sizeRef.current;
179
+ i.height = s.offsetHeight || 0, i.width = s.offsetWidth || 0, i.top = s.offsetTop, i.left = s.offsetLeft, i.right = r - i.width - i.left;
54
180
  }
55
181
  return null;
56
182
  }
@@ -63,574 +189,502 @@ class We extends L.Component {
63
189
  return this.props.children;
64
190
  }
65
191
  }
66
- function Xe({ children: t, isPresent: r, anchorX: s, root: n }) {
67
- const i = _(), a = E(null), l = E({
192
+ function ct({ children: t, isPresent: a, anchorX: s, root: n }) {
193
+ const r = H(), i = A(null), o = A({
68
194
  width: 0,
69
195
  height: 0,
70
196
  top: 0,
71
197
  left: 0,
72
198
  right: 0
73
- }), { nonce: u } = B(Ue);
74
- return Re(() => {
75
- const { width: h, height: d, top: g, left: f, right: m } = l.current;
76
- if (r || !a.current || !h || !d)
199
+ }), { nonce: d } = V(rt), c = ot(i, t?.ref);
200
+ return we(() => {
201
+ const { width: u, height: f, top: p, left: m, right: g } = o.current;
202
+ if (a || !i.current || !u || !f)
77
203
  return;
78
- const p = s === "left" ? `left: ${f}` : `right: ${m}`;
79
- a.current.dataset.motionPopId = i;
80
- const x = document.createElement("style");
81
- u && (x.nonce = u);
82
- const j = n ?? document.head;
83
- return j.appendChild(x), x.sheet && x.sheet.insertRule(`
84
- [data-motion-pop-id="${i}"] {
204
+ const j = s === "left" ? `left: ${m}` : `right: ${g}`;
205
+ i.current.dataset.motionPopId = r;
206
+ const l = document.createElement("style");
207
+ d && (l.nonce = d);
208
+ const x = n ?? document.head;
209
+ return x.appendChild(l), l.sheet && l.sheet.insertRule(`
210
+ [data-motion-pop-id="${r}"] {
85
211
  position: absolute !important;
86
- width: ${h}px !important;
87
- height: ${d}px !important;
88
- ${p}px !important;
89
- top: ${g}px !important;
212
+ width: ${u}px !important;
213
+ height: ${f}px !important;
214
+ ${j}px !important;
215
+ top: ${p}px !important;
90
216
  }
91
217
  `), () => {
92
- j.contains(x) && j.removeChild(x);
218
+ x.contains(l) && x.removeChild(l);
93
219
  };
94
- }, [r]), e.jsx(We, { isPresent: r, childRef: a, sizeRef: l, children: L.cloneElement(t, { ref: a }) });
220
+ }, [a]), e.jsx(lt, { isPresent: a, childRef: i, sizeRef: o, children: F.cloneElement(t, { ref: c }) });
95
221
  }
96
- const Ye = ({ children: t, initial: r, isPresent: s, onExitComplete: n, custom: i, presenceAffectsLayout: a, mode: l, anchorX: u, root: h }) => {
97
- const d = oe(Ze), g = _();
98
- let f = !0, m = F(() => (f = !1, {
99
- id: g,
100
- initial: r,
222
+ const dt = ({ children: t, initial: a, isPresent: s, onExitComplete: n, custom: r, presenceAffectsLayout: i, mode: o, anchorX: d, root: c }) => {
223
+ const u = ue(ut), f = H();
224
+ let p = !0, m = L(() => (p = !1, {
225
+ id: f,
226
+ initial: a,
101
227
  isPresent: s,
102
- custom: i,
103
- onExitComplete: (p) => {
104
- d.set(p, !0);
105
- for (const x of d.values())
106
- if (!x)
228
+ custom: r,
229
+ onExitComplete: (g) => {
230
+ u.set(g, !0);
231
+ for (const j of u.values())
232
+ if (!j)
107
233
  return;
108
234
  n && n();
109
235
  },
110
- register: (p) => (d.set(p, !1), () => d.delete(p))
111
- }), [s, d, n]);
112
- return a && f && (m = { ...m }), F(() => {
113
- d.forEach((p, x) => d.set(x, !1));
114
- }, [s]), L.useEffect(() => {
115
- !s && !d.size && n && n();
116
- }, [s]), l === "popLayout" && (t = e.jsx(Xe, { isPresent: s, anchorX: u, root: h, children: t })), e.jsx(le.Provider, { value: m, children: t });
236
+ register: (g) => (u.set(g, !1), () => u.delete(g))
237
+ }), [s, u, n]);
238
+ return i && p && (m = { ...m }), L(() => {
239
+ u.forEach((g, j) => u.set(j, !1));
240
+ }, [s]), F.useEffect(() => {
241
+ !s && !u.size && n && n();
242
+ }, [s]), o === "popLayout" && (t = e.jsx(ct, { isPresent: s, anchorX: d, root: c, children: t })), e.jsx(pe.Provider, { value: m, children: t });
117
243
  };
118
- function Ze() {
244
+ function ut() {
119
245
  return /* @__PURE__ */ new Map();
120
246
  }
121
- function et(t = !0) {
122
- const r = B(le);
123
- if (r === null)
247
+ function pt(t = !0) {
248
+ const a = V(pe);
249
+ if (a === null)
124
250
  return [!0, null];
125
- const { isPresent: s, onExitComplete: n, register: i } = r, a = _();
251
+ const { isPresent: s, onExitComplete: n, register: r } = a, i = H();
126
252
  re(() => {
127
253
  if (t)
128
- return i(a);
254
+ return r(i);
129
255
  }, [t]);
130
- const l = Se(() => t && n && n(a), [a, n, t]);
131
- return !s && n ? [!1, l] : [!0];
256
+ const o = ke(() => t && n && n(i), [i, n, t]);
257
+ return !s && n ? [!1, o] : [!0];
132
258
  }
133
259
  const R = (t) => t.key || "";
134
- function ee(t) {
135
- const r = [];
136
- return Te.forEach(t, (s) => {
137
- Oe(s) && r.push(s);
138
- }), r;
260
+ function ie(t) {
261
+ const a = [];
262
+ return Ee.forEach(t, (s) => {
263
+ Ie(s) && a.push(s);
264
+ }), a;
139
265
  }
140
- const tt = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presenceAffectsLayout: i = !0, mode: a = "sync", propagate: l = !1, anchorX: u = "left", root: h }) => {
141
- const [d, g] = et(l), f = F(() => ee(t), [t]), m = l && !d ? [] : f.map(R), p = E(!0), x = E(f), j = oe(() => /* @__PURE__ */ new Map()), [P, o] = K(f), [c, C] = K(f);
142
- Ve(() => {
143
- p.current = !1, x.current = f;
144
- for (let v = 0; v < c.length; v++) {
145
- const y = R(c[v]);
146
- m.includes(y) ? j.delete(y) : j.get(y) !== !0 && j.set(y, !1);
266
+ const ft = ({ children: t, custom: a, initial: s = !0, onExitComplete: n, presenceAffectsLayout: r = !0, mode: i = "sync", propagate: o = !1, anchorX: d = "left", root: c }) => {
267
+ const [u, f] = pt(o), p = L(() => ie(t), [t]), m = o && !u ? [] : p.map(R), g = A(!0), j = A(p), l = ue(() => /* @__PURE__ */ new Map()), [x, v] = I(p), [h, C] = I(p);
268
+ st(() => {
269
+ g.current = !1, j.current = p;
270
+ for (let w = 0; w < h.length; w++) {
271
+ const y = R(h[w]);
272
+ m.includes(y) ? l.delete(y) : l.get(y) !== !0 && l.set(y, !1);
147
273
  }
148
- }, [c, m.length, m.join("-")]);
149
- const k = [];
150
- if (f !== P) {
151
- let v = [...f];
152
- for (let y = 0; y < c.length; y++) {
153
- const N = c[y], $ = R(N);
154
- m.includes($) || (v.splice(y, 0, N), k.push(N));
274
+ }, [h, m.length, m.join("-")]);
275
+ const K = [];
276
+ if (p !== x) {
277
+ let w = [...p];
278
+ for (let y = 0; y < h.length; y++) {
279
+ const b = h[y], $ = R(b);
280
+ m.includes($) || (w.splice(y, 0, b), K.push(b));
155
281
  }
156
- return a === "wait" && k.length && (v = k), C(ee(v)), o(f), null;
282
+ return i === "wait" && K.length && (w = K), C(ie(w)), v(p), null;
157
283
  }
158
- process.env.NODE_ENV !== "production" && a === "wait" && c.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
159
- const { forceRender: b } = B(Be);
160
- return e.jsx(e.Fragment, { children: c.map((v) => {
161
- const y = R(v), N = l && !d ? !1 : f === c || m.includes(y), $ = () => {
162
- if (j.has(y))
163
- j.set(y, !0);
284
+ process.env.NODE_ENV !== "production" && i === "wait" && h.length > 1 && console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
285
+ const { forceRender: fe } = V(et);
286
+ return e.jsx(e.Fragment, { children: h.map((w) => {
287
+ const y = R(w), b = o && !u ? !1 : p === h || m.includes(y), $ = () => {
288
+ if (l.has(y))
289
+ l.set(y, !0);
164
290
  else
165
291
  return;
166
- let X = !0;
167
- j.forEach((de) => {
168
- de || (X = !1);
169
- }), X && (b?.(), C(x.current), l && g?.(), n && n());
292
+ let ee = !0;
293
+ l.forEach((he) => {
294
+ he || (ee = !1);
295
+ }), ee && (fe?.(), C(j.current), o && f?.(), n && n());
170
296
  };
171
- return e.jsx(Ye, { isPresent: N, initial: !p.current || s ? void 0 : !1, custom: r, presenceAffectsLayout: i, mode: a, root: h, onExitComplete: N ? void 0 : $, anchorX: u, children: v }, y);
297
+ return e.jsx(dt, { isPresent: b, initial: !g.current || s ? void 0 : !1, custom: a, presenceAffectsLayout: r, mode: i, root: c, onExitComplete: b ? void 0 : $, anchorX: d, children: w }, y);
172
298
  }) });
173
- }, ce = Me(
174
- ({ isPending: t, children: r, className: s, ...n }, i) => /* @__PURE__ */ e.jsxs(
175
- Fe,
176
- {
177
- ref: i,
178
- disabled: t,
179
- ...n,
180
- className: A("relative", s),
181
- children: [
182
- t && /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 grid place-items-center", children: /* @__PURE__ */ e.jsx(Le, {}) }),
183
- /* @__PURE__ */ e.jsx("span", { className: A("block", t && "invisible"), children: r })
184
- ]
185
- }
186
- )
187
- );
188
- ce.displayName = "ActionButton";
189
- const st = ({
190
- service: t,
191
- onOpenChange: r
299
+ }, ht = ({
300
+ apiKey: t,
301
+ onDeleteKey: a,
302
+ className: s
192
303
  }) => {
193
- const s = se(), n = ne(), i = je(), a = ze({
194
- defaultValues: {
195
- expiresOn: "30"
196
- }
197
- }), l = Qe(), u = O({
198
- mutationFn: ({ description: h, expiresOn: d }) => {
199
- if (!t.createKey)
200
- throw new Error("createKey not implemented");
201
- const g = d !== "never" ? nt(Number(d)) : void 0;
202
- return t.createKey({
203
- apiKey: {
204
- description: h || "Secret Key",
205
- expiresOn: g
206
- },
207
- context: s,
208
- auth: l
209
- });
210
- },
211
- onSuccess: async () => {
212
- await n.invalidateQueries({ queryKey: ["api-keys"] }), await i("/settings/api-keys/");
213
- }
214
- });
215
- return t.createKey ? /* @__PURE__ */ e.jsxs(
216
- "form",
217
- {
218
- onSubmit: a.handleSubmit(
219
- (h) => u.mutate(
220
- { ...h },
221
- {
222
- onSuccess: () => r(!1)
223
- }
224
- )
304
+ const [n, r] = I(!1), { key: i, createdOn: o, expiresOn: d } = t, c = d && new Date(d) < /* @__PURE__ */ new Date(), u = d ? Math.ceil(
305
+ (new Date(d).getTime() - Date.now()) / (1e3 * 60 * 60 * 24)
306
+ ) : 1 / 0, f = u <= 7 && !c;
307
+ return /* @__PURE__ */ e.jsxs("div", { className: X("grid col-span-full grid-cols-subgrid p-6", s), children: [
308
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
309
+ /* @__PURE__ */ e.jsx(
310
+ Ve,
311
+ {
312
+ className: "max-w-fit w-full",
313
+ secret: i,
314
+ status: c ? "expired" : f ? "expiring" : "active",
315
+ revealed: n,
316
+ onReveal: r
317
+ }
225
318
  ),
226
- children: [
227
- u.error && /* @__PURE__ */ e.jsxs(M, { variant: "destructive", className: "mb-4", children: [
228
- /* @__PURE__ */ e.jsx(q, { children: "Error" }),
229
- /* @__PURE__ */ e.jsx(ke, { children: u.error.message })
319
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
320
+ o && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
321
+ "Created ",
322
+ mt(o),
323
+ "."
230
324
  ] }),
231
- /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 flex-col text-sm font-medium", children: [
232
- "Name",
233
- /* @__PURE__ */ e.jsx(ae, { ...a.register("description") }),
234
- "Expiration",
235
- /* @__PURE__ */ e.jsxs(
236
- be,
325
+ " ",
326
+ d && f && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
327
+ "Expires in ",
328
+ u,
329
+ " ",
330
+ u === 1 ? "day" : "days",
331
+ "."
332
+ ] }),
333
+ d && c && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
334
+ "Expired",
335
+ " ",
336
+ u === 0 ? "today." : `${u * -1} days ago.`
337
+ ] })
338
+ ] })
339
+ ] }),
340
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: d && a && /* @__PURE__ */ e.jsxs(Z, { children: [
341
+ /* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(me, { size: 16 }) }) }),
342
+ /* @__PURE__ */ e.jsxs(J, { children: [
343
+ /* @__PURE__ */ e.jsxs(Y, { children: [
344
+ /* @__PURE__ */ e.jsx(U, { children: "Delete API Key" }),
345
+ /* @__PURE__ */ e.jsx(le, { children: "Are you sure you want to delete this API key?" })
346
+ ] }),
347
+ /* @__PURE__ */ e.jsxs(B, { children: [
348
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "outline", children: "Cancel" }) }),
349
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(
350
+ k,
237
351
  {
238
- onValueChange: (h) => a.setValue("expiresOn", h),
239
- defaultValue: a.getValues("expiresOn"),
240
- children: [
241
- /* @__PURE__ */ e.jsx(Ne, { children: /* @__PURE__ */ e.jsx(Ke, {}) }),
242
- /* @__PURE__ */ e.jsx(Ee, { children: /* @__PURE__ */ e.jsxs(De, { children: [
243
- [7, 30, 60, 90].map((h) => /* @__PURE__ */ e.jsxs(Z, { value: String(h), children: [
244
- h,
245
- " days"
246
- ] }, h)),
247
- /* @__PURE__ */ e.jsx(Z, { value: "never", children: "Never" })
248
- ] }) })
249
- ]
352
+ onClick: () => {
353
+ a();
354
+ },
355
+ children: "Delete"
250
356
  }
251
- ),
252
- /* @__PURE__ */ e.jsxs(H, { children: [
253
- /* @__PURE__ */ e.jsx(D, { asChild: !0, children: /* @__PURE__ */ e.jsx(w, { variant: "outline", children: "Cancel" }) }),
254
- /* @__PURE__ */ e.jsx(ce, { isPending: u.isPending, children: "Generate Key" })
255
- ] })
357
+ ) })
256
358
  ] })
257
- ]
258
- }
259
- ) : null;
260
- }, nt = (t) => {
261
- const r = /* @__PURE__ */ new Date();
262
- return r.setDate(r.getDate() + t), r.toISOString();
263
- }, te = ({
264
- service: t,
265
- isOpen: r,
266
- onOpenChange: s,
267
- trigger: n,
268
- buttonVariant: i = "outline"
269
- }) => {
270
- const a = /* @__PURE__ */ e.jsx(w, { variant: i, children: "Create API Key" });
271
- return /* @__PURE__ */ e.jsxs(V, { open: r, onOpenChange: s, children: [
272
- /* @__PURE__ */ e.jsx(G, { asChild: !0, children: n ?? a }),
273
- /* @__PURE__ */ e.jsxs(J, { children: [
274
- /* @__PURE__ */ e.jsx(U, { children: /* @__PURE__ */ e.jsx(W, { children: "Create API Key" }) }),
275
- /* @__PURE__ */ e.jsx(st, { service: t, onOpenChange: s })
276
- ] })
359
+ ] })
360
+ ] }) })
277
361
  ] });
278
- }, rt = ({ service: t }) => {
279
- const r = se(), s = ne(), [n, i] = K(
280
- null
281
- ), [a, l] = K(""), { data: u, isFetching: h } = we({
282
- queryFn: () => t.getConsumers(r),
283
- queryKey: ["api-keys"],
284
- retry: !1
285
- }), [d, g] = K(!1), f = O({
362
+ }, mt = (t) => {
363
+ const a = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((a.getTime() - s.getTime()) / 1e3), r = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
364
+ return n < 60 ? r.format(-n, "second") : n < 3600 ? r.format(-Math.floor(n / 60), "minute") : n < 86400 ? r.format(-Math.floor(n / 3600), "hour") : n < 2592e3 ? r.format(-Math.floor(n / 86400), "day") : n < 31536e3 ? r.format(-Math.floor(n / 2592e3), "month") : r.format(-Math.floor(n / 31536e3), "year");
365
+ }, xt = ({
366
+ consumer: t,
367
+ onUpdate: a,
368
+ onRollKey: s,
369
+ onDeleteKey: n
370
+ }) => {
371
+ const [r, i] = I(!1), [o, d] = I(t.label), c = ce(), u = W(), f = q({
372
+ mutationFn: async (l) => {
373
+ if (!s)
374
+ throw new Error("rollKey not implemented");
375
+ return await s?.(l, u);
376
+ },
377
+ onSuccess: () => void c.invalidateQueries({ queryKey: ["api-keys"] })
378
+ }), p = q({
286
379
  mutationFn: ({
287
- consumerId: o,
288
- keyId: c
380
+ consumerId: l,
381
+ keyId: x
289
382
  }) => {
290
- if (!t.deleteKey)
383
+ if (!n)
291
384
  throw new Error("deleteKey not implemented");
292
- return t.deleteKey(o, c, r);
385
+ return n(l, x, u);
293
386
  },
294
- onMutate: async ({ consumerId: o, keyId: c }) => {
295
- await s.cancelQueries({ queryKey: ["api-keys"] });
296
- const C = s.getQueryData([
387
+ onMutate: async ({ consumerId: l, keyId: x }) => {
388
+ await c.cancelQueries({ queryKey: ["api-keys"] });
389
+ const v = c.getQueryData([
297
390
  "api-keys"
298
391
  ]);
299
- return s.setQueryData(["api-keys"], (k) => k && k.map((b) => b.id === o ? {
300
- ...b,
301
- apiKeys: b.apiKeys.filter((v) => v.id !== c)
302
- } : b)), { previousData: C };
392
+ return c.setQueryData(["api-keys"], (h) => h && h.map((C) => C.id === l ? {
393
+ ...C,
394
+ apiKeys: C.apiKeys.filter((K) => K.id !== x)
395
+ } : C)), { previousData: v };
303
396
  },
304
- onError: (o, c, C) => {
305
- C?.previousData && s.setQueryData(["api-keys"], C.previousData);
397
+ onError: (l, x, v) => {
398
+ v?.previousData && c.setQueryData(["api-keys"], v.previousData);
306
399
  },
307
400
  onSuccess: () => {
308
- s.invalidateQueries({ queryKey: ["api-keys"] });
401
+ c.invalidateQueries({ queryKey: ["api-keys"] });
309
402
  }
310
- }), m = O({
403
+ }), m = q({
311
404
  mutationFn: ({
312
- consumerId: o,
313
- label: c
405
+ consumerId: l,
406
+ label: x
314
407
  }) => {
315
- if (!t.updateConsumer)
408
+ if (!a)
316
409
  throw new Error("updateConsumer not implemented");
317
- return t.updateConsumer({ id: o, label: c }, r);
410
+ return a({ id: l, label: x }, u);
318
411
  },
319
- onMutate: async ({ consumerId: o, label: c }) => {
320
- await s.cancelQueries({ queryKey: ["api-keys"] });
321
- const C = s.getQueryData(["api-keys"]);
322
- return s.setQueryData(["api-keys"], (k) => k && k.map((b) => b.id === o ? {
323
- ...b,
324
- label: c
325
- } : b)), { previousData: C };
412
+ onMutate: async ({ consumerId: l, label: x }) => {
413
+ await c.cancelQueries({ queryKey: ["api-keys"] });
414
+ const v = c.getQueryData(["api-keys"]);
415
+ return c.setQueryData(["api-keys"], (h) => h && h.map((C) => C.id === l ? {
416
+ ...C,
417
+ label: x
418
+ } : C)), { previousData: v };
326
419
  },
327
- onError: (o, c, C) => {
328
- C?.previousData && s.setQueryData(["api-keys"], C.previousData);
420
+ onError: (l, x, v) => {
421
+ v?.previousData && c.setQueryData(["api-keys"], v.previousData);
329
422
  },
330
423
  onSuccess: () => {
331
- s.invalidateQueries({ queryKey: ["api-keys"] });
424
+ c.invalidateQueries({ queryKey: ["api-keys"] });
332
425
  }
333
- }), p = O({
334
- mutationFn: (o) => {
335
- if (!t.rollKey)
336
- throw new Error("rollKey not implemented");
337
- return t.rollKey(o, r);
338
- },
339
- onSuccess: () => s.invalidateQueries({ queryKey: ["api-keys"] })
340
- }), x = (o, c) => {
341
- i(o), l(c);
342
- }, j = (o) => {
343
- a.trim() && m.mutate({
344
- consumerId: o,
345
- label: a.trim()
346
- }), i(null), l("");
347
- }, P = () => {
348
- i(null), l("");
426
+ }), g = () => {
427
+ i(!0), d(t.label);
428
+ }, j = () => {
429
+ o.trim() && m.mutate({
430
+ label: o.trim(),
431
+ consumerId: t.id
432
+ }), i(!1);
349
433
  };
350
- return /* @__PURE__ */ e.jsxs("div", { className: "max-w-screen-md h-full pt-(--padding-content-top) pb-(--padding-content-bottom)", children: [
351
- /* @__PURE__ */ e.jsx(Y.Target, { name: "api-keys-list-page" }),
352
- /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between pb-3", children: [
353
- /* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "API Keys" }),
354
- t.createKey && /* @__PURE__ */ e.jsx(
355
- te,
356
- {
357
- service: t,
358
- isOpen: d,
359
- onOpenChange: g
360
- }
361
- )
362
- ] }),
363
- /* @__PURE__ */ e.jsx("p", { children: "Create, manage, and monitor your API keys" }),
364
- /* @__PURE__ */ e.jsx(Y.Target, { name: "api-keys-list-page-before-keys" }),
365
- /* @__PURE__ */ e.jsx("div", { className: "h-8" }),
366
- p.isError && /* @__PURE__ */ e.jsxs(M, { variant: "destructive", className: "mb-4", children: [
434
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
435
+ f.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
367
436
  /* @__PURE__ */ e.jsx(z, { size: 16 }),
368
- /* @__PURE__ */ e.jsx(q, { children: p.error.message })
437
+ /* @__PURE__ */ e.jsx(P, { children: f.error.message })
369
438
  ] }),
370
- m.isError && /* @__PURE__ */ e.jsxs(M, { variant: "destructive", className: "mb-4", children: [
439
+ m.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
371
440
  /* @__PURE__ */ e.jsx(z, { size: 16 }),
372
- /* @__PURE__ */ e.jsx(q, { children: m.error.message })
441
+ /* @__PURE__ */ e.jsx(P, { children: m.error.message })
373
442
  ] }),
374
- f.isError && /* @__PURE__ */ e.jsxs(M, { variant: "destructive", className: "mb-4", children: [
443
+ p.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
375
444
  /* @__PURE__ */ e.jsx(z, { size: 16 }),
376
- /* @__PURE__ */ e.jsx(q, { children: f.error.message })
445
+ /* @__PURE__ */ e.jsx(P, { children: p.error.message })
377
446
  ] }),
378
- /* @__PURE__ */ e.jsx("div", { className: "", children: u.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "flex col-span-full flex-col justify-center gap-4 items-center p-8 border rounded-sm bg-muted/30 text-muted-foreground", children: [
379
- /* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
380
- "You have no API keys yet.",
381
- /* @__PURE__ */ e.jsx("br", {}),
382
- t.createKey && "Get started and create your first key."
383
- ] }),
384
- t.createKey && /* @__PURE__ */ e.jsx(
385
- te,
386
- {
387
- service: t,
388
- isOpen: d,
389
- onOpenChange: g
390
- }
391
- )
392
- ] }) : /* @__PURE__ */ e.jsx(
393
- "ul",
447
+ /* @__PURE__ */ e.jsxs(
448
+ De,
394
449
  {
395
- className: A(
396
- "grid grid-cols-[1fr_min-content] divide-y divide-border col-span-6"
397
- ),
398
- children: u.map((o) => /* @__PURE__ */ e.jsxs(
399
- qe,
400
- {
401
- className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
402
- children: [
403
- /* @__PURE__ */ e.jsxs($e, { className: "border-b col-span-full grid-cols-subgrid grid", children: [
404
- /* @__PURE__ */ e.jsxs("div", { className: "h-10 flex flex-col text-sm justify-center", children: [
405
- /* @__PURE__ */ e.jsxs("div", { className: "font-medium text-lg flex items-center gap-2", children: [
406
- n === o.id ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
450
+ className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
451
+ children: [
452
+ /* @__PURE__ */ e.jsxs(Pe, { className: "col-span-full flex-row items-start justify-between gap-4", children: [
453
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
454
+ r ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
455
+ /* @__PURE__ */ e.jsx(
456
+ Ye,
457
+ {
458
+ maxLength: 32,
459
+ value: o,
460
+ onChange: (l) => d(l.target.value),
461
+ onKeyDown: (l) => {
462
+ l.key === "Enter" ? j() : l.key === "Escape" && i(!1);
463
+ },
464
+ autoFocus: !0
465
+ }
466
+ ),
467
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
468
+ /* @__PURE__ */ e.jsx(
469
+ k,
470
+ {
471
+ size: "icon",
472
+ variant: "ghost",
473
+ onClick: j,
474
+ disabled: !o.trim(),
475
+ children: /* @__PURE__ */ e.jsx(xe, { size: 16 })
476
+ }
477
+ ),
478
+ /* @__PURE__ */ e.jsx(
479
+ k,
480
+ {
481
+ size: "icon",
482
+ variant: "ghost",
483
+ onClick: () => i(!1),
484
+ children: /* @__PURE__ */ e.jsx(ye, { size: 16 })
485
+ }
486
+ )
487
+ ] })
488
+ ] }) : /* @__PURE__ */ e.jsx(Ae, { children: t.label }),
489
+ /* @__PURE__ */ e.jsxs(Se, { children: [
490
+ t.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
491
+ "Created on ",
492
+ new Date(t.createdOn).toLocaleDateString()
493
+ ] }),
494
+ t.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
495
+ "Expires on ",
496
+ new Date(t.expiresOn).toLocaleDateString()
497
+ ] })
498
+ ] })
499
+ ] }),
500
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
501
+ a && /* @__PURE__ */ e.jsxs(
502
+ k,
503
+ {
504
+ variant: "ghost",
505
+ onClick: g,
506
+ className: X(
507
+ "flex gap-2",
508
+ r && "opacity-0! pointer-events-none"
509
+ ),
510
+ disabled: r,
511
+ children: [
512
+ /* @__PURE__ */ e.jsx(ge, { size: 16 }),
513
+ /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Edit label" })
514
+ ]
515
+ }
516
+ ),
517
+ s && /* @__PURE__ */ e.jsxs(Z, { children: [
518
+ /* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
519
+ k,
520
+ {
521
+ title: "Roll this key",
522
+ variant: "ghost",
523
+ disabled: f.isPending,
524
+ className: "flex items-center gap-2",
525
+ children: [
407
526
  /* @__PURE__ */ e.jsx(
408
- ae,
527
+ je,
409
528
  {
410
- maxLength: 32,
411
- value: a,
412
- onChange: (c) => l(c.target.value),
413
- onKeyDown: (c) => {
414
- c.key === "Enter" ? j(o.id) : c.key === "Escape" && P();
415
- },
416
- className: "text-lg font-medium",
417
- autoFocus: !0
529
+ size: 16,
530
+ className: f.isPending ? "animate-spin" : void 0
418
531
  }
419
532
  ),
420
- /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
421
- /* @__PURE__ */ e.jsx(
422
- w,
423
- {
424
- size: "icon",
425
- variant: "ghost",
426
- onClick: () => j(o.id),
427
- disabled: !a.trim(),
428
- children: /* @__PURE__ */ e.jsx(ue, { size: 16 })
429
- }
430
- ),
431
- /* @__PURE__ */ e.jsx(
432
- w,
433
- {
434
- size: "icon",
435
- variant: "ghost",
436
- onClick: P,
437
- children: /* @__PURE__ */ e.jsx(he, { size: 16 })
438
- }
439
- )
440
- ] })
441
- ] }) : o.label,
442
- /* @__PURE__ */ e.jsx("div", { className: "text-muted-foreground text-xs", children: o.createdOn })
533
+ /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Roll key" })
534
+ ]
535
+ }
536
+ ) }),
537
+ /* @__PURE__ */ e.jsxs(J, { children: [
538
+ /* @__PURE__ */ e.jsxs(Y, { children: [
539
+ /* @__PURE__ */ e.jsx(U, { children: "Roll API Key" }),
540
+ /* @__PURE__ */ e.jsx(le, { children: "Are you sure you want to roll this API key?" })
443
541
  ] }),
444
- /* @__PURE__ */ e.jsxs("div", { className: "text-muted-foreground text-xs", children: [
445
- o.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
446
- "Created on",
447
- " ",
448
- new Date(o.createdOn).toLocaleDateString()
449
- ] }),
450
- o.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
451
- "Expires on",
452
- " ",
453
- new Date(o.expiresOn).toLocaleDateString()
454
- ] })
455
- ] })
456
- ] }),
457
- /* @__PURE__ */ e.jsxs("div", { className: "flex justify-end", children: [
458
- t.updateConsumer && /* @__PURE__ */ e.jsxs(
459
- w,
460
- {
461
- variant: "ghost",
462
- onClick: () => x(o.id, o.label),
463
- className: A(
464
- "flex gap-2",
465
- n === o.id && "opacity-0! pointer-events-none"
466
- ),
467
- disabled: n === o.id,
468
- children: [
469
- /* @__PURE__ */ e.jsx(fe, { size: 16 }),
470
- /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Edit label" })
471
- ]
472
- }
473
- ),
474
- t.rollKey && /* @__PURE__ */ e.jsxs(V, { children: [
475
- /* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
476
- w,
542
+ /* @__PURE__ */ e.jsxs(B, { children: [
543
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "outline", children: "Cancel" }) }),
544
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(
545
+ k,
477
546
  {
478
- title: "Roll this key",
479
- variant: "ghost",
480
- disabled: p.isPending,
481
- className: "flex items-center gap-2",
482
- children: [
483
- /* @__PURE__ */ e.jsx(
484
- pe,
485
- {
486
- size: 16,
487
- className: p.isPending ? "animate-spin" : void 0
488
- }
489
- ),
490
- /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Roll key" })
491
- ]
547
+ onClick: () => {
548
+ f.mutate(t.id);
549
+ },
550
+ children: "Roll Key"
492
551
  }
493
- ) }),
494
- /* @__PURE__ */ e.jsxs(J, { children: [
495
- /* @__PURE__ */ e.jsxs(U, { children: [
496
- /* @__PURE__ */ e.jsx(W, { children: "Roll API Key" }),
497
- /* @__PURE__ */ e.jsx(ie, { children: "Are you sure you want to roll this API key?" })
498
- ] }),
499
- /* @__PURE__ */ e.jsxs(H, { children: [
500
- /* @__PURE__ */ e.jsx(D, { asChild: !0, children: /* @__PURE__ */ e.jsx(w, { variant: "outline", children: "Cancel" }) }),
501
- /* @__PURE__ */ e.jsx(D, { asChild: !0, children: /* @__PURE__ */ e.jsx(
502
- w,
503
- {
504
- onClick: () => {
505
- p.mutate(o.id);
506
- },
507
- children: "Roll Key"
508
- }
509
- ) })
510
- ] })
511
- ] })
552
+ ) })
512
553
  ] })
513
554
  ] })
514
- ] }),
515
- /* @__PURE__ */ e.jsx("div", { className: "col-span-full grid-cols-subgrid grid", children: /* @__PURE__ */ e.jsx(tt, { children: o.apiKeys.map((c) => /* @__PURE__ */ e.jsxs(Pe.Fragment, { children: [
516
- /* @__PURE__ */ e.jsx(
517
- at,
518
- {
519
- apiKey: c,
520
- onDeleteKey: () => {
521
- f.mutate({
522
- consumerId: o.id,
523
- keyId: c.id
524
- });
525
- },
526
- className: f.variables?.keyId === c.id && (f.isPending || h) ? "opacity-10!" : void 0
527
- }
528
- ),
529
- /* @__PURE__ */ e.jsx("div", { className: "col-span-full h-px bg-border" })
530
- ] }, c.id)) }) })
531
- ]
532
- },
533
- o.id
534
- ))
535
- }
536
- ) })
555
+ ] })
556
+ ] })
557
+ ] }),
558
+ /* @__PURE__ */ e.jsx(Re, { className: "p-0 grid grid-cols-subgrid col-span-full divide-y divide-border", children: /* @__PURE__ */ e.jsx(ft, { children: t.apiKeys.map((l) => /* @__PURE__ */ e.jsx(
559
+ ht,
560
+ {
561
+ apiKey: l,
562
+ onDeleteKey: () => {
563
+ p.mutate({
564
+ consumerId: t.id,
565
+ keyId: l.id
566
+ });
567
+ },
568
+ className: p.variables?.keyId === l.id && p.isPending ? "opacity-10!" : void 0
569
+ },
570
+ l.id
571
+ )) }) })
572
+ ]
573
+ },
574
+ t.id
575
+ )
537
576
  ] });
538
- }, it = (t) => {
539
- const r = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((r.getTime() - s.getTime()) / 1e3), i = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
540
- return n < 60 ? i.format(-n, "second") : n < 3600 ? i.format(-Math.floor(n / 60), "minute") : n < 86400 ? i.format(-Math.floor(n / 3600), "hour") : n < 2592e3 ? i.format(-Math.floor(n / 86400), "day") : n < 31536e3 ? i.format(-Math.floor(n / 2592e3), "month") : i.format(-Math.floor(n / 31536e3), "year");
541
- }, at = ({
542
- apiKey: t,
543
- onDeleteKey: r,
544
- className: s
545
- }) => {
546
- const [n, i] = K(!1), { key: a, createdOn: l, expiresOn: u } = t, h = u && new Date(u) < /* @__PURE__ */ new Date(), d = u ? Math.ceil(
547
- (new Date(u).getTime() - Date.now()) / (1e3 * 60 * 60 * 24)
548
- ) : 1 / 0, g = d <= 7 && !h;
549
- return /* @__PURE__ */ e.jsxs("div", { className: A("grid col-span-full grid-cols-subgrid p-6", s), children: [
550
- /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
551
- /* @__PURE__ */ e.jsx(
552
- Ae,
577
+ }, yt = ({ service: t }) => {
578
+ const a = W(), { data: s } = Je({
579
+ queryFn: async () => {
580
+ try {
581
+ return await t.getConsumers(a);
582
+ } catch (i) {
583
+ throw i instanceof M ? i : new M("Cannot get API keys", {
584
+ cause: i,
585
+ title: "Error getting API keys",
586
+ developerHint: "Check the response of the API request for more information."
587
+ });
588
+ }
589
+ },
590
+ queryKey: ["api-keys"],
591
+ retry: !1
592
+ }), [n, r] = I(!1);
593
+ return /* @__PURE__ */ e.jsx("div", { className: "mt-8", children: s.length === 0 ? /* @__PURE__ */ e.jsxs("div", { className: "flex col-span-full flex-col justify-center gap-4 items-center p-8 border rounded-sm bg-muted/30 text-muted-foreground", children: [
594
+ /* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
595
+ "You have no API keys yet.",
596
+ /* @__PURE__ */ e.jsx("br", {}),
597
+ t.createKey && "Get started and create your first key."
598
+ ] }),
599
+ t.createKey && /* @__PURE__ */ e.jsx(
600
+ de,
601
+ {
602
+ service: t,
603
+ isOpen: n,
604
+ onOpenChange: r
605
+ }
606
+ )
607
+ ] }) : /* @__PURE__ */ e.jsx("ul", { className: X("grid grid-cols-[1fr_min-content] col-span-6"), children: s.map((i) => /* @__PURE__ */ e.jsx(
608
+ xt,
609
+ {
610
+ consumer: i,
611
+ onUpdate: t.updateConsumer,
612
+ onRollKey: t.rollKey,
613
+ onDeleteKey: t.deleteKey
614
+ },
615
+ i.id
616
+ )) }) });
617
+ }, gt = ({ service: t }) => {
618
+ const [a, s] = I(!1), n = ae();
619
+ return /* @__PURE__ */ e.jsxs("div", { className: "max-w-3xl h-full pt-(--padding-content-top) pb-(--padding-content-bottom)", children: [
620
+ /* @__PURE__ */ e.jsx(te.Target, { name: "api-keys-list-page" }),
621
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between pb-3", children: [
622
+ /* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "API Keys" }),
623
+ t.createKey && /* @__PURE__ */ e.jsx(
624
+ de,
553
625
  {
554
- className: "max-w-fit w-full",
555
- secret: a,
556
- status: h ? "expired" : g ? "expiring" : "active",
557
- revealed: n,
558
- onReveal: i
626
+ service: t,
627
+ isOpen: a,
628
+ onOpenChange: s
559
629
  }
560
- ),
561
- /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
562
- l && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
563
- "Created ",
564
- it(l),
565
- "."
566
- ] }),
567
- " ",
568
- u && g && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
569
- "Expires in ",
570
- d,
571
- " ",
572
- d === 1 ? "day" : "days",
573
- "."
574
- ] }),
575
- u && h && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
576
- "Expired",
577
- " ",
578
- d === 0 ? "today." : `${d * -1} days ago.`
579
- ] })
580
- ] })
630
+ )
581
631
  ] }),
582
- /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: u && r && /* @__PURE__ */ e.jsxs(V, { children: [
583
- /* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsx(w, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(me, { size: 16 }) }) }),
584
- /* @__PURE__ */ e.jsxs(J, { children: [
585
- /* @__PURE__ */ e.jsxs(U, { children: [
586
- /* @__PURE__ */ e.jsx(W, { children: "Delete API Key" }),
587
- /* @__PURE__ */ e.jsx(ie, { children: "Are you sure you want to delete this API key?" })
588
- ] }),
589
- /* @__PURE__ */ e.jsxs(H, { children: [
590
- /* @__PURE__ */ e.jsx(D, { asChild: !0, children: /* @__PURE__ */ e.jsx(w, { variant: "outline", children: "Cancel" }) }),
591
- /* @__PURE__ */ e.jsx(D, { asChild: !0, children: /* @__PURE__ */ e.jsx(
592
- w,
593
- {
594
- onClick: () => {
595
- r();
596
- },
597
- children: "Delete"
598
- }
599
- ) })
600
- ] })
601
- ] })
602
- ] }) })
632
+ /* @__PURE__ */ e.jsx("p", { children: "Create, manage, and monitor your API keys" }),
633
+ /* @__PURE__ */ e.jsx(te.Target, { name: "api-keys-list-page-before-keys" }),
634
+ n.profile?.emailVerified === !1 ? /* @__PURE__ */ e.jsxs(Ne, { variant: "outline", children: [
635
+ /* @__PURE__ */ e.jsxs(Oe, { children: [
636
+ /* @__PURE__ */ e.jsx(Te, { children: "Verified email required" }),
637
+ /* @__PURE__ */ e.jsx(qe, { children: "You need to verify your email to access API keys." })
638
+ ] }),
639
+ /* @__PURE__ */ e.jsx(Me, { children: /* @__PURE__ */ e.jsx(_, { onClick: () => n.requestEmailVerification(), children: "Verify email" }) })
640
+ ] }) : /* @__PURE__ */ e.jsx(
641
+ Ke,
642
+ {
643
+ fallbackRender: ({ error: r }) => /* @__PURE__ */ e.jsx(Ue, { error: r }),
644
+ children: /* @__PURE__ */ e.jsx(yt, { service: t })
645
+ }
646
+ )
603
647
  ] });
604
- }, S = "https://api.zuploedge.com/v2/client", ot = async (t) => {
648
+ }, N = "https://api.zuploedge.com/v2/client", jt = async (t) => {
605
649
  try {
606
650
  return await t.json();
607
651
  } catch {
608
652
  return;
609
653
  }
610
- }, T = async (t) => {
611
- const r = t.headers.get("content-type");
612
- if (!t.ok && r?.includes("application/problem+json")) {
613
- const s = await ot(t);
654
+ }, O = async (t) => {
655
+ const a = t.headers.get("content-type");
656
+ if (!t.ok && a?.includes("application/problem+json")) {
657
+ const s = await jt(t);
614
658
  if (s.type && s.title)
615
659
  throw new Error(s.detail ?? s.title);
616
660
  }
617
- }, lt = (t, r) => ({
618
- deleteKey: async (s, n, i) => {
619
- const a = new Request(
620
- S + `/${t}/consumers/${s}/keys/${n}`,
661
+ }, T = {
662
+ developerHint: "This project is not linked to a Zuplo deployment. Run `zuplo link` to get started with API Keys.",
663
+ title: "Not linked to a Zuplo deployment"
664
+ }, vt = ({
665
+ deploymentName: t,
666
+ ...a
667
+ }) => ({
668
+ deleteKey: async (s, n, r) => {
669
+ E(t, "Cannot delete API key.", T);
670
+ const i = new Request(
671
+ N + `/${t}/consumers/${s}/keys/${n}`,
621
672
  {
622
673
  method: "DELETE"
623
674
  }
624
- );
625
- await i.signRequest(a);
626
- const l = await fetch(a);
627
- await T(l), I(l.ok, "Failed to delete API key");
675
+ ), o = await fetch(await r.signRequest(i));
676
+ await O(o), E(o.ok, "Failed to delete API key");
628
677
  },
629
678
  updateConsumer: async (s, n) => {
630
- const i = await fetch(
679
+ E(
680
+ t,
681
+ "Cannot update API key description.",
682
+ T
683
+ );
684
+ const r = await fetch(
631
685
  await n.signRequest(
632
686
  new Request(
633
- S + `/${t}/consumers/${s.id}`,
687
+ `${N}/${t}/consumers/${s.id}`,
634
688
  {
635
689
  method: "PATCH",
636
690
  headers: {
@@ -643,13 +697,14 @@ const st = ({
643
697
  )
644
698
  )
645
699
  );
646
- await T(i), I(i.ok, "Failed to update API key description");
700
+ await O(r), E(r.ok, "Failed to update API key description");
647
701
  },
648
702
  rollKey: async (s, n) => {
649
- const i = await fetch(
703
+ E(t, "Cannot roll API key.", T);
704
+ const r = await fetch(
650
705
  await n.signRequest(
651
706
  new Request(
652
- S + `/${t}/consumers/${s}/roll-key`,
707
+ `${N}/${t}/consumers/${s}/roll-key`,
653
708
  {
654
709
  method: "POST",
655
710
  headers: {
@@ -660,42 +715,59 @@ const st = ({
660
715
  )
661
716
  )
662
717
  );
663
- await T(i), I(i.ok, "Failed to delete API key");
718
+ await O(r), E(r.ok, "Failed to roll API key");
664
719
  },
665
720
  getConsumers: async (s) => {
721
+ E(t, "Cannot get API keys.", T);
666
722
  const n = new Request(
667
- `${S}/${t}/consumers`
723
+ `${N}/${t}/consumers`
668
724
  );
669
725
  await s.signRequest(n);
670
- const i = await fetch(n);
671
- return await T(i), I(i.ok, "Failed to fetch API keys"), (await i.json()).data.map((l) => ({
672
- id: l.id,
673
- label: l.label || l.subject || "API Key",
674
- apiKeys: l.apiKeys.data,
675
- key: l.apiKeys.data.at(0)
726
+ const r = await fetch(n);
727
+ return await O(r), E(r.ok, "Failed to fetch API keys"), (await r.json()).data.map((o) => ({
728
+ id: o.id,
729
+ createdOn: o.createdOn,
730
+ updatedOn: o.updatedOn,
731
+ expiresOn: o.expiresOn,
732
+ label: o.label || o.subject || "API Key",
733
+ apiKeys: o.apiKeys.data,
734
+ key: o.apiKeys.data.at(0)
676
735
  }));
677
736
  },
678
- ...r
679
- }), Dt = (t) => t, At = (t) => {
680
- const r = "deploymentName" in t ? lt(t.deploymentName, t) : t;
737
+ ...a
738
+ }), _t = (t) => t, Bt = ({
739
+ deploymentName: t,
740
+ isZuplo: a,
741
+ ...s
742
+ }) => {
743
+ a && !t && console.warn(
744
+ "This project is not linked to a Zuplo deployment. Run `zuplo link` to get started."
745
+ );
746
+ const n = a ? vt({ deploymentName: t, ...s }) : s;
747
+ if (!n.getConsumers)
748
+ throw new Error("getConsumers is required when using the apiKeyPlugin");
749
+ const r = {
750
+ ...n,
751
+ getConsumers: n.getConsumers
752
+ };
681
753
  return {
682
754
  getProfileMenuItems: () => [
683
755
  {
684
756
  label: "API Keys",
685
757
  path: "/settings/api-keys",
686
758
  category: "middle",
687
- icon: xe
759
+ icon: ve
688
760
  }
689
761
  ],
690
- getIdentities: async (s) => {
762
+ getIdentities: async (i) => {
691
763
  try {
692
- return (await r.getConsumers(s)).map((i) => ({
693
- authorizeRequest: (a) => (a.headers.set(
764
+ return (await r.getConsumers(i)).map((d) => ({
765
+ authorizeRequest: (c) => (c.headers.set(
694
766
  "Authorization",
695
- `Bearer ${i.apiKeys.at(0)?.key}`
696
- ), a),
697
- id: i.id,
698
- label: i.label
767
+ `Bearer ${d.apiKeys.at(0)?.key}`
768
+ ), c),
769
+ id: d.id,
770
+ label: d.label
699
771
  }));
700
772
  } catch {
701
773
  return [];
@@ -703,20 +775,15 @@ const st = ({
703
775
  },
704
776
  getRoutes: () => [
705
777
  {
706
- element: /* @__PURE__ */ e.jsx(_e, {}),
707
- errorElement: /* @__PURE__ */ e.jsx(ye, {}),
708
- children: [
709
- {
710
- path: "/settings/api-keys",
711
- element: /* @__PURE__ */ e.jsx(rt, { service: r })
712
- }
713
- ]
778
+ path: "/settings/api-keys",
779
+ element: /* @__PURE__ */ e.jsx(gt, { service: r })
714
780
  }
715
- ]
781
+ ],
782
+ getProtectedRoutes: () => ["/settings/api-keys"]
716
783
  };
717
784
  };
718
785
  export {
719
- At as apiKeyPlugin,
720
- Dt as createApiKeyService
786
+ Bt as apiKeyPlugin,
787
+ _t as createApiKeyService
721
788
  };
722
789
  //# sourceMappingURL=zudoku.plugin-api-keys.js.map