zudoku 0.66.4 → 0.66.5

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 (173) hide show
  1. package/dist/lib/authentication/components/CallbackHandler.js +1 -1
  2. package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
  3. package/dist/lib/core/RouteGuard.js +12 -7
  4. package/dist/lib/core/RouteGuard.js.map +1 -1
  5. package/dist/lib/plugins/api-keys/index.d.ts +9 -5
  6. package/dist/lib/plugins/api-keys/index.js +18 -8
  7. package/dist/lib/plugins/api-keys/index.js.map +1 -1
  8. package/dist/lib/plugins/api-keys/settings/ApiKeyList.js +3 -0
  9. package/dist/lib/plugins/api-keys/settings/ApiKeyList.js.map +1 -1
  10. package/dist/lib/util/invariant.d.ts +1 -1
  11. package/dist/lib/util/invariant.js +2 -2
  12. package/dist/lib/util/invariant.js.map +1 -1
  13. package/dist/vite/mdx/remark-link-rewrite.js +1 -1
  14. package/dist/vite/plugin-api-keys.js +1 -0
  15. package/dist/vite/plugin-api-keys.js.map +1 -1
  16. package/lib/{ActionButton-BSM2oNHF.js → ActionButton-B0CXL1Lq.js} +3 -3
  17. package/lib/{ActionButton-BSM2oNHF.js.map → ActionButton-B0CXL1Lq.js.map} +1 -1
  18. package/lib/{Button-IOAeVaIH.js → Button-GUVe7pmt.js} +2 -2
  19. package/lib/{Button-IOAeVaIH.js.map → Button-GUVe7pmt.js.map} +1 -1
  20. package/lib/{Card-KFniaZn5.js → Card-DCdq37aA.js} +2 -2
  21. package/lib/{Card-KFniaZn5.js.map → Card-DCdq37aA.js.map} +1 -1
  22. package/lib/{ClaudeLogo-DgjivS8A.js → ClaudeLogo-ByzA8TYR.js} +3 -3
  23. package/lib/{ClaudeLogo-DgjivS8A.js.map → ClaudeLogo-ByzA8TYR.js.map} +1 -1
  24. package/lib/{Command-BpT1iBE6.js → Command-N6VujV30.js} +3 -3
  25. package/lib/{Command-BpT1iBE6.js.map → Command-N6VujV30.js.map} +1 -1
  26. package/lib/{Dialog-BQciPiHN.js → Dialog-hlvmmQ_c.js} +2 -2
  27. package/lib/{Dialog-BQciPiHN.js.map → Dialog-hlvmmQ_c.js.map} +1 -1
  28. package/lib/{Drawer-BRMcpfuF.js → Drawer-Ch7927PF.js} +2 -2
  29. package/lib/{Drawer-BRMcpfuF.js.map → Drawer-Ch7927PF.js.map} +1 -1
  30. package/lib/{DropdownMenu-C8SX_-S_.js → DropdownMenu-DN0jNrjj.js} +2 -2
  31. package/lib/{DropdownMenu-C8SX_-S_.js.map → DropdownMenu-DN0jNrjj.js.map} +1 -1
  32. package/lib/{Frame-DxlznfVd.js → Frame-DKlOmSkU.js} +2 -2
  33. package/lib/{Frame-DxlznfVd.js.map → Frame-DKlOmSkU.js.map} +1 -1
  34. package/lib/{IndexingDialog-DZWj_3cU.js → IndexingDialog-D0YdGfbn.js} +3 -3
  35. package/lib/{IndexingDialog-DZWj_3cU.js.map → IndexingDialog-D0YdGfbn.js.map} +1 -1
  36. package/lib/{Input-D-kqEQ5M.js → Input-nskrp_mj.js} +39 -18
  37. package/lib/Input-nskrp_mj.js.map +1 -0
  38. package/lib/{MdxPage-BL-HbZrv.js → MdxPage-Bh5YNRV9.js} +10 -10
  39. package/lib/{MdxPage-BL-HbZrv.js.map → MdxPage-Bh5YNRV9.js.map} +1 -1
  40. package/lib/{Mermaid-BjSczjLW.js → Mermaid-CGRoylZf.js} +4 -4
  41. package/lib/{Mermaid-BjSczjLW.js.map → Mermaid-CGRoylZf.js.map} +1 -1
  42. package/lib/{OAuthErrorPage-DQtg28Go.js → OAuthErrorPage-CsTKz5hX.js} +8 -8
  43. package/lib/OAuthErrorPage-CsTKz5hX.js.map +1 -0
  44. package/lib/{OasProvider--qcZwrKS.js → OasProvider-BBAbJiYa.js} +3 -3
  45. package/lib/{OasProvider--qcZwrKS.js.map → OasProvider-BBAbJiYa.js.map} +1 -1
  46. package/lib/{OperationList-CSJYzxQY.js → OperationList-DUxrNisd.js} +16 -16
  47. package/lib/{OperationList-CSJYzxQY.js.map → OperationList-DUxrNisd.js.map} +1 -1
  48. package/lib/RouteGuard-CIN9Ou-r.js +77 -0
  49. package/lib/RouteGuard-CIN9Ou-r.js.map +1 -0
  50. package/lib/{SchemaList-DtyuDrQA.js → SchemaList-BbnkfjIe.js} +9 -9
  51. package/lib/{SchemaList-DtyuDrQA.js.map → SchemaList-BbnkfjIe.js.map} +1 -1
  52. package/lib/{SchemaView-G-SVXxAG.js → SchemaView-BrUf6_nP.js} +6 -6
  53. package/lib/{SchemaView-G-SVXxAG.js.map → SchemaView-BrUf6_nP.js.map} +1 -1
  54. package/lib/{Secret-BxGpIhDP.js → Secret-BDBqq4p3.js} +2 -2
  55. package/lib/{Secret-BxGpIhDP.js.map → Secret-BDBqq4p3.js.map} +1 -1
  56. package/lib/{Separator-CTPSeW1S.js → Separator-BXt1LYnm.js} +2 -2
  57. package/lib/{Separator-CTPSeW1S.js.map → Separator-BXt1LYnm.js.map} +1 -1
  58. package/lib/{SignUp-CDl7bQj3.js → SignUp-AlaaduyY.js} +4 -4
  59. package/lib/{SignUp-CDl7bQj3.js.map → SignUp-AlaaduyY.js.map} +1 -1
  60. package/lib/{SyntaxHighlight-Dgd0AaaX.js → SyntaxHighlight-DveJcTOQ.js} +4 -4
  61. package/lib/{SyntaxHighlight-Dgd0AaaX.js.map → SyntaxHighlight-DveJcTOQ.js.map} +1 -1
  62. package/lib/{Toc-D_Rj4jVx.js → Toc-B4ShtN-I.js} +3 -3
  63. package/lib/{Toc-D_Rj4jVx.js.map → Toc-B4ShtN-I.js.map} +1 -1
  64. package/lib/{ZudokuContext-DNHMZfcP.js → ZudokuContext-CDJYKqMY.js} +542 -469
  65. package/lib/ZudokuContext-CDJYKqMY.js.map +1 -0
  66. package/lib/{___vite-browser-external_commonjs-proxy-Cga3HsWk.js → ___vite-browser-external_commonjs-proxy-BttVsNON.js} +2 -2
  67. package/lib/___vite-browser-external_commonjs-proxy-BttVsNON.js.map +1 -0
  68. package/lib/{circular-BxODTa7z.js → circular-CuSWVYOZ.js} +2 -2
  69. package/lib/{circular-BxODTa7z.js.map → circular-CuSWVYOZ.js.map} +1 -1
  70. package/lib/{cn-dYga0KKN.js → cn-5-Gd1Dss.js} +531 -498
  71. package/lib/cn-5-Gd1Dss.js.map +1 -0
  72. package/lib/{createServer-BpreIXp6.js → createServer-B1_RUTJP.js} +6 -6
  73. package/lib/{createServer-BpreIXp6.js.map → createServer-B1_RUTJP.js.map} +1 -1
  74. package/lib/{createVariantComponent-CQVt-H3r.js → createVariantComponent-Dc0vtOvr.js} +2 -2
  75. package/lib/{createVariantComponent-CQVt-H3r.js.map → createVariantComponent-Dc0vtOvr.js.map} +1 -1
  76. package/lib/{errors-DliW1dED.js → errors-iDfQAr_v.js} +3 -3
  77. package/lib/{errors-DliW1dED.js.map → errors-iDfQAr_v.js.map} +1 -1
  78. package/lib/{firebase-D4tbaCYB.js → firebase-I54w2ZsH.js} +20 -20
  79. package/lib/{firebase-D4tbaCYB.js.map → firebase-I54w2ZsH.js.map} +1 -1
  80. package/lib/{hook-CHw_R_xu.js → hook-BxWvqzB0.js} +2 -2
  81. package/lib/{hook-CHw_R_xu.js.map → hook-BxWvqzB0.js.map} +1 -1
  82. package/lib/{index-CboxZOVW.js → index-A5Cre871.js} +11 -11
  83. package/lib/{index-CboxZOVW.js.map → index-A5Cre871.js.map} +1 -1
  84. package/lib/{index-9MxNUgg4.js → index-B4puReRo.js} +20 -20
  85. package/lib/{index-9MxNUgg4.js.map → index-B4puReRo.js.map} +1 -1
  86. package/lib/{index-DXXZDuSJ.js → index-CjTisMeX.js} +3 -3
  87. package/lib/{index-DXXZDuSJ.js.map → index-CjTisMeX.js.map} +1 -1
  88. package/lib/{index-1TbL0HXQ.js → index-Dbrv6d94.js} +2 -2
  89. package/lib/{index-1TbL0HXQ.js.map → index-Dbrv6d94.js.map} +1 -1
  90. package/lib/{index.esm-DtzT_KoE.js → index.esm-B_0dvNjB.js} +2 -2
  91. package/lib/{index.esm-DtzT_KoE.js.map → index.esm-B_0dvNjB.js.map} +1 -1
  92. package/lib/{index.esm-ti5zvZS_.js → index.esm-BxIXRKtj.js} +2 -2
  93. package/lib/index.esm-BxIXRKtj.js.map +1 -0
  94. package/lib/{invariant-CGOLuIIz.js → invariant-BJAl77rw.js} +4 -4
  95. package/lib/invariant-BJAl77rw.js.map +1 -0
  96. package/lib/{mutation-DMHWqmFp.js → mutation-Cq0wKBqW.js} +70 -44
  97. package/lib/mutation-Cq0wKBqW.js.map +1 -0
  98. package/lib/ui/Accordion.js +1 -1
  99. package/lib/ui/ActionButton.js +2 -2
  100. package/lib/ui/Alert.js +1 -1
  101. package/lib/ui/AlertDialog.js +1 -1
  102. package/lib/ui/Badge.js +1 -1
  103. package/lib/ui/Breadcrumb.js +1 -1
  104. package/lib/ui/Button.js +1 -1
  105. package/lib/ui/ButtonGroup.js +1 -1
  106. package/lib/ui/Callout.js +1 -1
  107. package/lib/ui/Card.js +1 -1
  108. package/lib/ui/Carousel.js +1 -1
  109. package/lib/ui/Checkbox.js +1 -1
  110. package/lib/ui/CodeBlock.js +1 -1
  111. package/lib/ui/Command.js +2 -2
  112. package/lib/ui/Dialog.js +1 -1
  113. package/lib/ui/Drawer.js +2 -2
  114. package/lib/ui/DropdownMenu.js +1 -1
  115. package/lib/ui/EmbeddedCodeBlock.js +1 -1
  116. package/lib/ui/Form.js +1 -1
  117. package/lib/ui/Frame.js +1 -1
  118. package/lib/ui/HoverCard.js +1 -1
  119. package/lib/ui/Input.js +1 -1
  120. package/lib/ui/Item.js +1 -1
  121. package/lib/ui/Label.js +1 -1
  122. package/lib/ui/NativeSelect.js +1 -1
  123. package/lib/ui/Pagination.js +1 -1
  124. package/lib/ui/Popover.js +1 -1
  125. package/lib/ui/Progress.js +1 -1
  126. package/lib/ui/RadioGroup.js +1 -1
  127. package/lib/ui/ScrollArea.js +1 -1
  128. package/lib/ui/Secret.js +1 -1
  129. package/lib/ui/Separator.js +1 -1
  130. package/lib/ui/Skeleton.js +1 -1
  131. package/lib/ui/Slider.js +1 -1
  132. package/lib/ui/Switch.js +1 -1
  133. package/lib/ui/SyntaxHighlight.js +3 -3
  134. package/lib/ui/Tabs.js +1 -1
  135. package/lib/ui/Textarea.js +1 -1
  136. package/lib/ui/Toggle.js +1 -1
  137. package/lib/ui/ToggleGroup.js +1 -1
  138. package/lib/ui/Value.js +1 -1
  139. package/lib/ui/util.js +1 -1
  140. package/lib/zudoku.__internal.js +576 -574
  141. package/lib/zudoku.__internal.js.map +1 -1
  142. package/lib/zudoku.auth-auth0.js +1 -1
  143. package/lib/zudoku.auth-azureb2c.js +4 -4
  144. package/lib/zudoku.auth-clerk.js +2 -2
  145. package/lib/zudoku.auth-firebase.js +5 -5
  146. package/lib/zudoku.auth-openid.js +5 -5
  147. package/lib/zudoku.auth-supabase.js +4 -4
  148. package/lib/zudoku.components.js +5 -5
  149. package/lib/zudoku.hooks.js +3 -3
  150. package/lib/zudoku.mermaid.js +3 -3
  151. package/lib/zudoku.plugin-api-catalog.js +4 -4
  152. package/lib/zudoku.plugin-api-keys.js +258 -240
  153. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  154. package/lib/zudoku.plugin-custom-pages.js +1 -1
  155. package/lib/zudoku.plugin-markdown.js +1 -1
  156. package/lib/zudoku.plugin-openapi.js +2 -2
  157. package/lib/zudoku.plugin-search-pagefind.js +6 -6
  158. package/package.json +3 -3
  159. package/src/lib/authentication/components/CallbackHandler.tsx +1 -1
  160. package/src/lib/core/RouteGuard.tsx +30 -24
  161. package/src/lib/plugins/api-keys/index.tsx +46 -16
  162. package/src/lib/plugins/api-keys/settings/ApiKeyList.tsx +3 -0
  163. package/src/lib/util/invariant.ts +2 -1
  164. package/lib/Input-D-kqEQ5M.js.map +0 -1
  165. package/lib/OAuthErrorPage-DQtg28Go.js.map +0 -1
  166. package/lib/RouteGuard-D0f743SM.js +0 -77
  167. package/lib/RouteGuard-D0f743SM.js.map +0 -1
  168. package/lib/ZudokuContext-DNHMZfcP.js.map +0 -1
  169. package/lib/___vite-browser-external_commonjs-proxy-Cga3HsWk.js.map +0 -1
  170. package/lib/cn-dYga0KKN.js.map +0 -1
  171. package/lib/index.esm-ti5zvZS_.js.map +0 -1
  172. package/lib/invariant-CGOLuIIz.js.map +0 -1
  173. package/lib/mutation-DMHWqmFp.js.map +0 -1
@@ -1,33 +1,33 @@
1
1
  import { j as e } from "./jsx-runtime-BzflLqGi.js";
2
- import { TrashIcon as pe, CircleSlashIcon as F, CheckIcon as me, XIcon as xe, PencilLineIcon as ye, RefreshCwIcon as ge, KeyRoundIcon as je } from "lucide-react";
3
- import { Z as $, i as N } from "./invariant-CGOLuIIz.js";
4
- import * as q from "react";
5
- import { createContext as L, useRef as P, useLayoutEffect as ve, useEffect as ne, useId as Q, useContext as V, useInsertionEffect as Ce, useMemo as z, useCallback as we, Children as ke, isValidElement as Ee, useState as E } from "react";
6
- import { D as Ie, c as be, d as Z, B as De, E as Ke } from "./index-CboxZOVW.js";
7
- import { b as ie } from "./index-DXXZDuSJ.js";
8
- import { F as Pe, g as Ae, j as Ne, h as Se, d as Re, I as Oe, a as Te, b as qe, k as Me, c as Fe } from "./Frame-DxlznfVd.js";
9
- import { A as D, a as K, b as re } from "./Mermaid-BjSczjLW.js";
10
- import { e as H, f as A, D as _, g as B, a as G, b as J, c as Y, d as ae } from "./Dialog-BQciPiHN.js";
11
- import { Button as oe } from "./ui/Button.js";
12
- import { a as U, g as le, e as $e } from "./ZudokuContext-DNHMZfcP.js";
13
- import { u as T, I as ze } from "./Input-D-kqEQ5M.js";
14
- import { a as Le } from "./index.esm-BYObtETB.js";
15
- import { u as Qe } from "./chunk-PVWAREVJ-ClM0m2aJ.js";
16
- import { A as Ve } from "./ActionButton-BSM2oNHF.js";
17
- import { S as He, a as _e, b as Be, c as Ge, d as Je, e as ee, f as Ye } from "./Secret-BxGpIhDP.js";
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-BJAl77rw.js";
4
+ import * as F from "react";
5
+ import { createContext as Q, useRef as A, useLayoutEffect as Ce, useEffect as ie, 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, c as Ke, d as ee, B as De, E as Pe } from "./index-A5Cre871.js";
7
+ import { b as re } from "./index-CjTisMeX.js";
8
+ import { F as Ae, g as Se, j as Re, h as Ne, d as Oe, I as Te, a as qe, b as Me, k as Fe, c as $e } from "./Frame-DKlOmSkU.js";
9
+ import { A as D, a as P, b as ae } from "./Mermaid-CGRoylZf.js";
10
+ import { e as _, f as S, D as B, g as Z, a as G, b as J, c as Y, d as oe } from "./Dialog-hlvmmQ_c.js";
11
+ import { Button as le } from "./ui/Button.js";
12
+ import { a as U, g as ce, e as ze } from "./ZudokuContext-CDJYKqMY.js";
13
+ import { u as q, I as Le } from "./Input-nskrp_mj.js";
14
+ import { a as Qe } from "./index.esm-BYObtETB.js";
15
+ import { u as He } from "./chunk-PVWAREVJ-ClM0m2aJ.js";
16
+ import { A as Ve } from "./ActionButton-B0CXL1Lq.js";
17
+ import { S as _e, a as Be, b as Ze, c as Ge, d as Je, e as te, f as Ye } from "./Secret-BDBqq4p3.js";
18
18
  import { Input as Ue } from "./ui/Input.js";
19
- import { c as W } from "./cn-dYga0KKN.js";
20
- import { B as k } from "./Button-IOAeVaIH.js";
19
+ import { c as W } from "./cn-5-Gd1Dss.js";
20
+ import { B as k } from "./Button-GUVe7pmt.js";
21
21
  function We({ error: t }) {
22
- const i = t instanceof Error ? t.message : "Something went wrong", s = process.env.NODE_ENV === "development", n = t instanceof $ ? t.developerHint : void 0, r = t instanceof $ ? t.title : "Something went wrong", a = t instanceof Error ? t.stack : void 0, o = t instanceof Error ? t.cause : void 0, d = o instanceof Error ? String(o.stack) : a;
22
+ 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;
23
23
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
24
24
  /* @__PURE__ */ e.jsxs(D, { variant: "destructive", children: [
25
- /* @__PURE__ */ e.jsx(K, { children: r }),
26
- /* @__PURE__ */ e.jsx(re, { children: i })
25
+ /* @__PURE__ */ e.jsx(P, { children: r }),
26
+ /* @__PURE__ */ e.jsx(ae, { children: a })
27
27
  ] }),
28
- s && n && /* @__PURE__ */ e.jsx(Ie, { className: "mb-4", children: n }),
28
+ s && n && /* @__PURE__ */ e.jsx(be, { className: "mb-4", children: n }),
29
29
  s && d && /* @__PURE__ */ e.jsx(
30
- be,
30
+ Ke,
31
31
  {
32
32
  className: "max-h-[400px] [&>pre]:p-4",
33
33
  language: "js",
@@ -38,21 +38,21 @@ function We({ error: t }) {
38
38
  }
39
39
  const Xe = ({
40
40
  service: t,
41
- onOpenChange: i
41
+ onOpenChange: a
42
42
  }) => {
43
- const s = U(), n = le(), r = Qe(), a = Le({
43
+ const s = U(), n = ce(), r = He(), i = Qe({
44
44
  defaultValues: {
45
45
  expiresOn: "30"
46
46
  }
47
- }), o = ie(), d = T({
47
+ }), o = re(), d = q({
48
48
  mutationFn: ({ description: c, expiresOn: u }) => {
49
49
  if (!t.createKey)
50
50
  throw new Error("createKey not implemented");
51
- const h = u !== "never" ? Ze(Number(u)) : void 0;
51
+ const p = u !== "never" ? et(Number(u)) : void 0;
52
52
  return t.createKey({
53
53
  apiKey: {
54
54
  description: c || "Secret Key",
55
- expiresOn: h
55
+ expiresOn: p
56
56
  },
57
57
  context: s,
58
58
  auth: o
@@ -65,113 +65,113 @@ const Xe = ({
65
65
  return t.createKey ? /* @__PURE__ */ e.jsxs(
66
66
  "form",
67
67
  {
68
- onSubmit: a.handleSubmit(
68
+ onSubmit: i.handleSubmit(
69
69
  (c) => d.mutate(
70
70
  { ...c },
71
71
  {
72
- onSuccess: () => i(!1)
72
+ onSuccess: () => a(!1)
73
73
  }
74
74
  )
75
75
  ),
76
76
  children: [
77
77
  d.error && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
78
- /* @__PURE__ */ e.jsx(K, { children: "Error" }),
79
- /* @__PURE__ */ e.jsx(re, { children: d.error.message })
78
+ /* @__PURE__ */ e.jsx(P, { children: "Error" }),
79
+ /* @__PURE__ */ e.jsx(ae, { children: d.error.message })
80
80
  ] }),
81
81
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 flex-col text-sm font-medium", children: [
82
82
  "Name",
83
- /* @__PURE__ */ e.jsx(Ue, { ...a.register("description") }),
83
+ /* @__PURE__ */ e.jsx(Ue, { ...i.register("description") }),
84
84
  "Expiration",
85
85
  /* @__PURE__ */ e.jsxs(
86
- He,
86
+ _e,
87
87
  {
88
- onValueChange: (c) => a.setValue("expiresOn", c),
89
- defaultValue: a.getValues("expiresOn"),
88
+ onValueChange: (c) => i.setValue("expiresOn", c),
89
+ defaultValue: i.getValues("expiresOn"),
90
90
  children: [
91
- /* @__PURE__ */ e.jsx(_e, { children: /* @__PURE__ */ e.jsx(Be, {}) }),
91
+ /* @__PURE__ */ e.jsx(Be, { children: /* @__PURE__ */ e.jsx(Ze, {}) }),
92
92
  /* @__PURE__ */ e.jsx(Ge, { children: /* @__PURE__ */ e.jsxs(Je, { children: [
93
- [7, 30, 60, 90].map((c) => /* @__PURE__ */ e.jsxs(ee, { value: String(c), children: [
93
+ [7, 30, 60, 90].map((c) => /* @__PURE__ */ e.jsxs(te, { value: String(c), children: [
94
94
  c,
95
95
  " days"
96
96
  ] }, c)),
97
- /* @__PURE__ */ e.jsx(ee, { value: "never", children: "Never" })
97
+ /* @__PURE__ */ e.jsx(te, { value: "never", children: "Never" })
98
98
  ] }) })
99
99
  ]
100
100
  }
101
101
  ),
102
- /* @__PURE__ */ e.jsxs(H, { children: [
103
- /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(oe, { variant: "outline", children: "Cancel" }) }),
102
+ /* @__PURE__ */ e.jsxs(_, { children: [
103
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(le, { variant: "outline", children: "Cancel" }) }),
104
104
  /* @__PURE__ */ e.jsx(Ve, { isPending: d.isPending, children: "Generate Key" })
105
105
  ] })
106
106
  ] })
107
107
  ]
108
108
  }
109
109
  ) : null;
110
- }, Ze = (t) => {
111
- const i = /* @__PURE__ */ new Date();
112
- return i.setDate(i.getDate() + t), i.toISOString();
113
- }, ce = ({
110
+ }, et = (t) => {
111
+ const a = /* @__PURE__ */ new Date();
112
+ return a.setDate(a.getDate() + t), a.toISOString();
113
+ }, de = ({
114
114
  service: t,
115
- isOpen: i,
115
+ isOpen: a,
116
116
  onOpenChange: s,
117
117
  trigger: n,
118
118
  buttonVariant: r = "outline"
119
119
  }) => {
120
- const a = /* @__PURE__ */ e.jsx(oe, { variant: r, children: "Create API Key" });
121
- return /* @__PURE__ */ e.jsxs(_, { open: i, onOpenChange: s, children: [
122
- /* @__PURE__ */ e.jsx(B, { asChild: !0, children: n ?? a }),
120
+ const i = /* @__PURE__ */ e.jsx(le, { variant: r, children: "Create API Key" });
121
+ return /* @__PURE__ */ e.jsxs(B, { open: a, onOpenChange: s, children: [
122
+ /* @__PURE__ */ e.jsx(Z, { asChild: !0, children: n ?? i }),
123
123
  /* @__PURE__ */ e.jsxs(G, { children: [
124
124
  /* @__PURE__ */ e.jsx(J, { children: /* @__PURE__ */ e.jsx(Y, { children: "Create API Key" }) }),
125
125
  /* @__PURE__ */ e.jsx(Xe, { service: t, onOpenChange: s })
126
126
  ] })
127
127
  ] });
128
- }, et = L({});
129
- function de(t) {
130
- const i = P(null);
131
- return i.current === null && (i.current = t()), i.current;
128
+ }, tt = Q({});
129
+ function ue(t) {
130
+ const a = A(null);
131
+ return a.current === null && (a.current = t()), a.current;
132
132
  }
133
- const tt = typeof window < "u", st = tt ? ve : ne, ue = /* @__PURE__ */ L(null);
134
- function nt(t) {
133
+ const st = typeof window < "u", nt = st ? Ce : ie, fe = /* @__PURE__ */ Q(null);
134
+ function it(t) {
135
135
  return typeof t == "object" && t !== null;
136
136
  }
137
- function it(t) {
138
- return nt(t) && "offsetHeight" in t;
137
+ function rt(t) {
138
+ return it(t) && "offsetHeight" in t;
139
139
  }
140
- const rt = L({
140
+ const at = Q({
141
141
  transformPagePoint: (t) => t,
142
142
  isStatic: !1,
143
143
  reducedMotion: "never"
144
144
  });
145
- function te(t, i) {
145
+ function se(t, a) {
146
146
  if (typeof t == "function")
147
- return t(i);
148
- t != null && (t.current = i);
147
+ return t(a);
148
+ t != null && (t.current = a);
149
149
  }
150
- function at(...t) {
151
- return (i) => {
150
+ function ot(...t) {
151
+ return (a) => {
152
152
  let s = !1;
153
153
  const n = t.map((r) => {
154
- const a = te(r, i);
155
- return !s && typeof a == "function" && (s = !0), a;
154
+ const i = se(r, a);
155
+ return !s && typeof i == "function" && (s = !0), i;
156
156
  });
157
157
  if (s)
158
158
  return () => {
159
159
  for (let r = 0; r < n.length; r++) {
160
- const a = n[r];
161
- typeof a == "function" ? a() : te(t[r], null);
160
+ const i = n[r];
161
+ typeof i == "function" ? i() : se(t[r], null);
162
162
  }
163
163
  };
164
164
  };
165
165
  }
166
- function ot(...t) {
167
- return q.useCallback(at(...t), t);
166
+ function lt(...t) {
167
+ return F.useCallback(ot(...t), t);
168
168
  }
169
- class lt extends q.Component {
170
- getSnapshotBeforeUpdate(i) {
169
+ class ct extends F.Component {
170
+ getSnapshotBeforeUpdate(a) {
171
171
  const s = this.props.childRef.current;
172
- if (s && i.isPresent && !this.props.isPresent) {
173
- const n = s.offsetParent, r = it(n) && n.offsetWidth || 0, a = this.props.sizeRef.current;
174
- a.height = s.offsetHeight || 0, a.width = s.offsetWidth || 0, a.top = s.offsetTop, a.left = s.offsetLeft, a.right = r - a.width - a.left;
172
+ if (s && a.isPresent && !this.props.isPresent) {
173
+ const n = s.offsetParent, r = rt(n) && n.offsetWidth || 0, i = this.props.sizeRef.current;
174
+ 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;
175
175
  }
176
176
  return null;
177
177
  }
@@ -184,20 +184,20 @@ class lt extends q.Component {
184
184
  return this.props.children;
185
185
  }
186
186
  }
187
- function ct({ children: t, isPresent: i, anchorX: s, root: n }) {
188
- const r = Q(), a = P(null), o = P({
187
+ function dt({ children: t, isPresent: a, anchorX: s, root: n }) {
188
+ const r = H(), i = A(null), o = A({
189
189
  width: 0,
190
190
  height: 0,
191
191
  top: 0,
192
192
  left: 0,
193
193
  right: 0
194
- }), { nonce: d } = V(rt), c = ot(a, t?.ref);
195
- return Ce(() => {
196
- const { width: u, height: h, top: f, left: m, right: g } = o.current;
197
- if (i || !a.current || !u || !h)
194
+ }), { nonce: d } = V(at), c = lt(i, t?.ref);
195
+ return we(() => {
196
+ const { width: u, height: p, top: f, left: m, right: g } = o.current;
197
+ if (a || !i.current || !u || !p)
198
198
  return;
199
199
  const j = s === "left" ? `left: ${m}` : `right: ${g}`;
200
- a.current.dataset.motionPopId = r;
200
+ i.current.dataset.motionPopId = r;
201
201
  const l = document.createElement("style");
202
202
  d && (l.nonce = d);
203
203
  const x = n ?? document.head;
@@ -205,20 +205,20 @@ function ct({ children: t, isPresent: i, anchorX: s, root: n }) {
205
205
  [data-motion-pop-id="${r}"] {
206
206
  position: absolute !important;
207
207
  width: ${u}px !important;
208
- height: ${h}px !important;
208
+ height: ${p}px !important;
209
209
  ${j}px !important;
210
210
  top: ${f}px !important;
211
211
  }
212
212
  `), () => {
213
213
  x.contains(l) && x.removeChild(l);
214
214
  };
215
- }, [i]), e.jsx(lt, { isPresent: i, childRef: a, sizeRef: o, children: q.cloneElement(t, { ref: c }) });
215
+ }, [a]), e.jsx(ct, { isPresent: a, childRef: i, sizeRef: o, children: F.cloneElement(t, { ref: c }) });
216
216
  }
217
- const dt = ({ children: t, initial: i, isPresent: s, onExitComplete: n, custom: r, presenceAffectsLayout: a, mode: o, anchorX: d, root: c }) => {
218
- const u = de(ut), h = Q();
219
- let f = !0, m = z(() => (f = !1, {
220
- id: h,
221
- initial: i,
217
+ const ut = ({ children: t, initial: a, isPresent: s, onExitComplete: n, custom: r, presenceAffectsLayout: i, mode: o, anchorX: d, root: c }) => {
218
+ const u = ue(ft), p = H();
219
+ let f = !0, m = L(() => (f = !1, {
220
+ id: p,
221
+ initial: a,
222
222
  isPresent: s,
223
223
  custom: r,
224
224
  onExitComplete: (g) => {
@@ -230,56 +230,56 @@ const dt = ({ children: t, initial: i, isPresent: s, onExitComplete: n, custom:
230
230
  },
231
231
  register: (g) => (u.set(g, !1), () => u.delete(g))
232
232
  }), [s, u, n]);
233
- return a && f && (m = { ...m }), z(() => {
233
+ return i && f && (m = { ...m }), L(() => {
234
234
  u.forEach((g, j) => u.set(j, !1));
235
- }, [s]), q.useEffect(() => {
235
+ }, [s]), F.useEffect(() => {
236
236
  !s && !u.size && n && n();
237
- }, [s]), o === "popLayout" && (t = e.jsx(ct, { isPresent: s, anchorX: d, root: c, children: t })), e.jsx(ue.Provider, { value: m, children: t });
237
+ }, [s]), o === "popLayout" && (t = e.jsx(dt, { isPresent: s, anchorX: d, root: c, children: t })), e.jsx(fe.Provider, { value: m, children: t });
238
238
  };
239
- function ut() {
239
+ function ft() {
240
240
  return /* @__PURE__ */ new Map();
241
241
  }
242
- function ft(t = !0) {
243
- const i = V(ue);
244
- if (i === null)
242
+ function pt(t = !0) {
243
+ const a = V(fe);
244
+ if (a === null)
245
245
  return [!0, null];
246
- const { isPresent: s, onExitComplete: n, register: r } = i, a = Q();
247
- ne(() => {
246
+ const { isPresent: s, onExitComplete: n, register: r } = a, i = H();
247
+ ie(() => {
248
248
  if (t)
249
- return r(a);
249
+ return r(i);
250
250
  }, [t]);
251
- const o = we(() => t && n && n(a), [a, n, t]);
251
+ const o = ke(() => t && n && n(i), [i, n, t]);
252
252
  return !s && n ? [!1, o] : [!0];
253
253
  }
254
- const S = (t) => t.key || "";
255
- function se(t) {
256
- const i = [];
257
- return ke.forEach(t, (s) => {
258
- Ee(s) && i.push(s);
259
- }), i;
254
+ const R = (t) => t.key || "";
255
+ function ne(t) {
256
+ const a = [];
257
+ return Ee.forEach(t, (s) => {
258
+ Ie(s) && a.push(s);
259
+ }), a;
260
260
  }
261
- const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presenceAffectsLayout: r = !0, mode: a = "sync", propagate: o = !1, anchorX: d = "left", root: c }) => {
262
- const [u, h] = ft(o), f = z(() => se(t), [t]), m = o && !u ? [] : f.map(S), g = P(!0), j = P(f), l = de(() => /* @__PURE__ */ new Map()), [x, v] = E(f), [p, C] = E(f);
263
- st(() => {
261
+ const ht = ({ children: t, custom: a, initial: s = !0, onExitComplete: n, presenceAffectsLayout: r = !0, mode: i = "sync", propagate: o = !1, anchorX: d = "left", root: c }) => {
262
+ const [u, p] = pt(o), f = L(() => ne(t), [t]), m = o && !u ? [] : f.map(R), g = A(!0), j = A(f), l = ue(() => /* @__PURE__ */ new Map()), [x, v] = I(f), [h, C] = I(f);
263
+ nt(() => {
264
264
  g.current = !1, j.current = f;
265
- for (let w = 0; w < p.length; w++) {
266
- const y = S(p[w]);
265
+ for (let w = 0; w < h.length; w++) {
266
+ const y = R(h[w]);
267
267
  m.includes(y) ? l.delete(y) : l.get(y) !== !0 && l.set(y, !1);
268
268
  }
269
- }, [p, m.length, m.join("-")]);
270
- const b = [];
269
+ }, [h, m.length, m.join("-")]);
270
+ const K = [];
271
271
  if (f !== x) {
272
272
  let w = [...f];
273
- for (let y = 0; y < p.length; y++) {
274
- const I = p[y], M = S(I);
275
- m.includes(M) || (w.splice(y, 0, I), b.push(I));
273
+ for (let y = 0; y < h.length; y++) {
274
+ const b = h[y], $ = R(b);
275
+ m.includes($) || (w.splice(y, 0, b), K.push(b));
276
276
  }
277
- return a === "wait" && b.length && (w = b), C(se(w)), v(f), null;
277
+ return i === "wait" && K.length && (w = K), C(ne(w)), v(f), null;
278
278
  }
279
- process.env.NODE_ENV !== "production" && a === "wait" && p.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.`);
280
- const { forceRender: fe } = V(et);
281
- return e.jsx(e.Fragment, { children: p.map((w) => {
282
- const y = S(w), I = o && !u ? !1 : f === p || m.includes(y), M = () => {
279
+ 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.`);
280
+ const { forceRender: pe } = V(tt);
281
+ return e.jsx(e.Fragment, { children: h.map((w) => {
282
+ const y = R(w), b = o && !u ? !1 : f === h || m.includes(y), $ = () => {
283
283
  if (l.has(y))
284
284
  l.set(y, !0);
285
285
  else
@@ -287,26 +287,26 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
287
287
  let X = !0;
288
288
  l.forEach((he) => {
289
289
  he || (X = !1);
290
- }), X && (fe?.(), C(j.current), o && h?.(), n && n());
290
+ }), X && (pe?.(), C(j.current), o && p?.(), n && n());
291
291
  };
292
- return e.jsx(dt, { isPresent: I, initial: !g.current || s ? void 0 : !1, custom: i, presenceAffectsLayout: r, mode: a, root: c, onExitComplete: I ? void 0 : M, anchorX: d, children: w }, y);
292
+ return e.jsx(ut, { 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);
293
293
  }) });
294
- }, pt = ({
294
+ }, mt = ({
295
295
  apiKey: t,
296
- onDeleteKey: i,
296
+ onDeleteKey: a,
297
297
  className: s
298
298
  }) => {
299
- const [n, r] = E(!1), { key: a, createdOn: o, expiresOn: d } = t, c = d && new Date(d) < /* @__PURE__ */ new Date(), u = d ? Math.ceil(
299
+ const [n, r] = I(!1), { key: i, createdOn: o, expiresOn: d } = t, c = d && new Date(d) < /* @__PURE__ */ new Date(), u = d ? Math.ceil(
300
300
  (new Date(d).getTime() - Date.now()) / (1e3 * 60 * 60 * 24)
301
- ) : 1 / 0, h = u <= 7 && !c;
301
+ ) : 1 / 0, p = u <= 7 && !c;
302
302
  return /* @__PURE__ */ e.jsxs("div", { className: W("grid col-span-full grid-cols-subgrid p-6", s), children: [
303
303
  /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
304
304
  /* @__PURE__ */ e.jsx(
305
305
  Ye,
306
306
  {
307
307
  className: "max-w-fit w-full",
308
- secret: a,
309
- status: c ? "expired" : h ? "expiring" : "active",
308
+ secret: i,
309
+ status: c ? "expired" : p ? "expiring" : "active",
310
310
  revealed: n,
311
311
  onReveal: r
312
312
  }
@@ -314,11 +314,11 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
314
314
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
315
315
  o && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
316
316
  "Created ",
317
- mt(o),
317
+ xt(o),
318
318
  "."
319
319
  ] }),
320
320
  " ",
321
- d && h && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
321
+ d && p && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
322
322
  "Expires in ",
323
323
  u,
324
324
  " ",
@@ -332,20 +332,20 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
332
332
  ] })
333
333
  ] })
334
334
  ] }),
335
- /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: d && i && /* @__PURE__ */ e.jsxs(_, { children: [
336
- /* @__PURE__ */ e.jsx(B, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(pe, { size: 16 }) }) }),
335
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: d && a && /* @__PURE__ */ e.jsxs(B, { children: [
336
+ /* @__PURE__ */ e.jsx(Z, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(me, { size: 16 }) }) }),
337
337
  /* @__PURE__ */ e.jsxs(G, { children: [
338
338
  /* @__PURE__ */ e.jsxs(J, { children: [
339
339
  /* @__PURE__ */ e.jsx(Y, { children: "Delete API Key" }),
340
- /* @__PURE__ */ e.jsx(ae, { children: "Are you sure you want to delete this API key?" })
340
+ /* @__PURE__ */ e.jsx(oe, { children: "Are you sure you want to delete this API key?" })
341
341
  ] }),
342
- /* @__PURE__ */ e.jsxs(H, { children: [
343
- /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "outline", children: "Cancel" }) }),
344
- /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(
342
+ /* @__PURE__ */ e.jsxs(_, { children: [
343
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "outline", children: "Cancel" }) }),
344
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(
345
345
  k,
346
346
  {
347
347
  onClick: () => {
348
- i();
348
+ a();
349
349
  },
350
350
  children: "Delete"
351
351
  }
@@ -354,23 +354,23 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
354
354
  ] })
355
355
  ] }) })
356
356
  ] });
357
- }, mt = (t) => {
358
- const i = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((i.getTime() - s.getTime()) / 1e3), r = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
357
+ }, xt = (t) => {
358
+ const a = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((a.getTime() - s.getTime()) / 1e3), r = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
359
359
  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");
360
- }, xt = ({
360
+ }, yt = ({
361
361
  consumer: t,
362
- onUpdate: i,
362
+ onUpdate: a,
363
363
  onRollKey: s,
364
364
  onDeleteKey: n
365
365
  }) => {
366
- const [r, a] = E(!1), [o, d] = E(t.label), c = le(), u = U(), h = T({
366
+ const [r, i] = I(!1), [o, d] = I(t.label), c = ce(), u = U(), p = q({
367
367
  mutationFn: async (l) => {
368
368
  if (!s)
369
369
  throw new Error("rollKey not implemented");
370
370
  return await s?.(l, u);
371
371
  },
372
372
  onSuccess: () => void c.invalidateQueries({ queryKey: ["api-keys"] })
373
- }), f = T({
373
+ }), f = q({
374
374
  mutationFn: ({
375
375
  consumerId: l,
376
376
  keyId: x
@@ -384,9 +384,9 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
384
384
  const v = c.getQueryData([
385
385
  "api-keys"
386
386
  ]);
387
- return c.setQueryData(["api-keys"], (p) => p && p.map((C) => C.id === l ? {
387
+ return c.setQueryData(["api-keys"], (h) => h && h.map((C) => C.id === l ? {
388
388
  ...C,
389
- apiKeys: C.apiKeys.filter((b) => b.id !== x)
389
+ apiKeys: C.apiKeys.filter((K) => K.id !== x)
390
390
  } : C)), { previousData: v };
391
391
  },
392
392
  onError: (l, x, v) => {
@@ -395,19 +395,19 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
395
395
  onSuccess: () => {
396
396
  c.invalidateQueries({ queryKey: ["api-keys"] });
397
397
  }
398
- }), m = T({
398
+ }), m = q({
399
399
  mutationFn: ({
400
400
  consumerId: l,
401
401
  label: x
402
402
  }) => {
403
- if (!i)
403
+ if (!a)
404
404
  throw new Error("updateConsumer not implemented");
405
- return i({ id: l, label: x }, u);
405
+ return a({ id: l, label: x }, u);
406
406
  },
407
407
  onMutate: async ({ consumerId: l, label: x }) => {
408
408
  await c.cancelQueries({ queryKey: ["api-keys"] });
409
409
  const v = c.getQueryData(["api-keys"]);
410
- return c.setQueryData(["api-keys"], (p) => p && p.map((C) => C.id === l ? {
410
+ return c.setQueryData(["api-keys"], (h) => h && h.map((C) => C.id === l ? {
411
411
  ...C,
412
412
  label: x
413
413
  } : C)), { previousData: v };
@@ -419,42 +419,42 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
419
419
  c.invalidateQueries({ queryKey: ["api-keys"] });
420
420
  }
421
421
  }), g = () => {
422
- a(!0), d(t.label);
422
+ i(!0), d(t.label);
423
423
  }, j = () => {
424
424
  o.trim() && m.mutate({
425
425
  label: o.trim(),
426
426
  consumerId: t.id
427
- }), a(!1);
427
+ }), i(!1);
428
428
  };
429
429
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
430
- h.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
431
- /* @__PURE__ */ e.jsx(F, { size: 16 }),
432
- /* @__PURE__ */ e.jsx(K, { children: h.error.message })
430
+ p.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
431
+ /* @__PURE__ */ e.jsx(z, { size: 16 }),
432
+ /* @__PURE__ */ e.jsx(P, { children: p.error.message })
433
433
  ] }),
434
434
  m.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
435
- /* @__PURE__ */ e.jsx(F, { size: 16 }),
436
- /* @__PURE__ */ e.jsx(K, { children: m.error.message })
435
+ /* @__PURE__ */ e.jsx(z, { size: 16 }),
436
+ /* @__PURE__ */ e.jsx(P, { children: m.error.message })
437
437
  ] }),
438
438
  f.isError && /* @__PURE__ */ e.jsxs(D, { variant: "destructive", className: "mb-4", children: [
439
- /* @__PURE__ */ e.jsx(F, { size: 16 }),
440
- /* @__PURE__ */ e.jsx(K, { children: f.error.message })
439
+ /* @__PURE__ */ e.jsx(z, { size: 16 }),
440
+ /* @__PURE__ */ e.jsx(P, { children: f.error.message })
441
441
  ] }),
442
442
  /* @__PURE__ */ e.jsxs(
443
- Pe,
443
+ Ae,
444
444
  {
445
445
  className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
446
446
  children: [
447
- /* @__PURE__ */ e.jsxs(Ae, { className: "col-span-full flex-row items-start justify-between gap-4", children: [
447
+ /* @__PURE__ */ e.jsxs(Se, { className: "col-span-full flex-row items-start justify-between gap-4", children: [
448
448
  /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
449
449
  r ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
450
450
  /* @__PURE__ */ e.jsx(
451
- ze,
451
+ Le,
452
452
  {
453
453
  maxLength: 32,
454
454
  value: o,
455
455
  onChange: (l) => d(l.target.value),
456
456
  onKeyDown: (l) => {
457
- l.key === "Enter" ? j() : l.key === "Escape" && a(!1);
457
+ l.key === "Enter" ? j() : l.key === "Escape" && i(!1);
458
458
  },
459
459
  autoFocus: !0
460
460
  }
@@ -467,7 +467,7 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
467
467
  variant: "ghost",
468
468
  onClick: j,
469
469
  disabled: !o.trim(),
470
- children: /* @__PURE__ */ e.jsx(me, { size: 16 })
470
+ children: /* @__PURE__ */ e.jsx(xe, { size: 16 })
471
471
  }
472
472
  ),
473
473
  /* @__PURE__ */ e.jsx(
@@ -475,13 +475,13 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
475
475
  {
476
476
  size: "icon",
477
477
  variant: "ghost",
478
- onClick: () => a(!1),
479
- children: /* @__PURE__ */ e.jsx(xe, { size: 16 })
478
+ onClick: () => i(!1),
479
+ children: /* @__PURE__ */ e.jsx(ye, { size: 16 })
480
480
  }
481
481
  )
482
482
  ] })
483
- ] }) : /* @__PURE__ */ e.jsx(Ne, { children: t.label }),
484
- /* @__PURE__ */ e.jsxs(Se, { children: [
483
+ ] }) : /* @__PURE__ */ e.jsx(Re, { children: t.label }),
484
+ /* @__PURE__ */ e.jsxs(Ne, { children: [
485
485
  t.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
486
486
  "Created on ",
487
487
  new Date(t.createdOn).toLocaleDateString()
@@ -493,7 +493,7 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
493
493
  ] })
494
494
  ] }),
495
495
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1", children: [
496
- i && /* @__PURE__ */ e.jsxs(
496
+ a && /* @__PURE__ */ e.jsxs(
497
497
  k,
498
498
  {
499
499
  variant: "ghost",
@@ -504,25 +504,25 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
504
504
  ),
505
505
  disabled: r,
506
506
  children: [
507
- /* @__PURE__ */ e.jsx(ye, { size: 16 }),
507
+ /* @__PURE__ */ e.jsx(ge, { size: 16 }),
508
508
  /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Edit label" })
509
509
  ]
510
510
  }
511
511
  ),
512
- s && /* @__PURE__ */ e.jsxs(_, { children: [
513
- /* @__PURE__ */ e.jsx(B, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
512
+ s && /* @__PURE__ */ e.jsxs(B, { children: [
513
+ /* @__PURE__ */ e.jsx(Z, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
514
514
  k,
515
515
  {
516
516
  title: "Roll this key",
517
517
  variant: "ghost",
518
- disabled: h.isPending,
518
+ disabled: p.isPending,
519
519
  className: "flex items-center gap-2",
520
520
  children: [
521
521
  /* @__PURE__ */ e.jsx(
522
- ge,
522
+ je,
523
523
  {
524
524
  size: 16,
525
- className: h.isPending ? "animate-spin" : void 0
525
+ className: p.isPending ? "animate-spin" : void 0
526
526
  }
527
527
  ),
528
528
  /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Roll key" })
@@ -532,15 +532,15 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
532
532
  /* @__PURE__ */ e.jsxs(G, { children: [
533
533
  /* @__PURE__ */ e.jsxs(J, { children: [
534
534
  /* @__PURE__ */ e.jsx(Y, { children: "Roll API Key" }),
535
- /* @__PURE__ */ e.jsx(ae, { children: "Are you sure you want to roll this API key?" })
535
+ /* @__PURE__ */ e.jsx(oe, { children: "Are you sure you want to roll this API key?" })
536
536
  ] }),
537
- /* @__PURE__ */ e.jsxs(H, { children: [
538
- /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "outline", children: "Cancel" }) }),
539
- /* @__PURE__ */ e.jsx(A, { asChild: !0, children: /* @__PURE__ */ e.jsx(
537
+ /* @__PURE__ */ e.jsxs(_, { children: [
538
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(k, { variant: "outline", children: "Cancel" }) }),
539
+ /* @__PURE__ */ e.jsx(S, { asChild: !0, children: /* @__PURE__ */ e.jsx(
540
540
  k,
541
541
  {
542
542
  onClick: () => {
543
- h.mutate(t.id);
543
+ p.mutate(t.id);
544
544
  },
545
545
  children: "Roll Key"
546
546
  }
@@ -550,8 +550,8 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
550
550
  ] })
551
551
  ] })
552
552
  ] }),
553
- /* @__PURE__ */ e.jsx(Re, { className: "p-0 grid grid-cols-subgrid col-span-full divide-y divide-border", children: /* @__PURE__ */ e.jsx(ht, { children: t.apiKeys.map((l) => /* @__PURE__ */ e.jsx(
554
- pt,
553
+ /* @__PURE__ */ e.jsx(Oe, { className: "p-0 grid grid-cols-subgrid col-span-full divide-y divide-border", children: /* @__PURE__ */ e.jsx(ht, { children: t.apiKeys.map((l) => /* @__PURE__ */ e.jsx(
554
+ mt,
555
555
  {
556
556
  apiKey: l,
557
557
  onDeleteKey: () => {
@@ -569,14 +569,14 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
569
569
  t.id
570
570
  )
571
571
  ] });
572
- }, yt = ({ service: t }) => {
573
- const i = U(), { data: s } = $e({
572
+ }, gt = ({ service: t }) => {
573
+ const a = U(), { data: s } = ze({
574
574
  queryFn: async () => {
575
575
  try {
576
- return await t.getConsumers(i);
577
- } catch (a) {
578
- throw new $("Cannot get API keys", {
579
- cause: a,
576
+ return await t.getConsumers(a);
577
+ } catch (i) {
578
+ throw i instanceof M ? i : new M("Cannot get API keys", {
579
+ cause: i,
580
580
  title: "Error getting API keys",
581
581
  developerHint: "Check the response of the API request for more information."
582
582
  });
@@ -584,7 +584,7 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
584
584
  },
585
585
  queryKey: ["api-keys"],
586
586
  retry: !1
587
- }), [n, r] = E(!1);
587
+ }), [n, r] = I(!1);
588
588
  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: [
589
589
  /* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
590
590
  "You have no API keys yet.",
@@ -592,82 +592,94 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
592
592
  t.createKey && "Get started and create your first key."
593
593
  ] }),
594
594
  t.createKey && /* @__PURE__ */ e.jsx(
595
- ce,
595
+ de,
596
596
  {
597
597
  service: t,
598
598
  isOpen: n,
599
599
  onOpenChange: r
600
600
  }
601
601
  )
602
- ] }) : /* @__PURE__ */ e.jsx("ul", { className: W("grid grid-cols-[1fr_min-content] col-span-6"), children: s.map((a) => /* @__PURE__ */ e.jsx(
603
- xt,
602
+ ] }) : /* @__PURE__ */ e.jsx("ul", { className: W("grid grid-cols-[1fr_min-content] col-span-6"), children: s.map((i) => /* @__PURE__ */ e.jsx(
603
+ yt,
604
604
  {
605
- consumer: a,
605
+ consumer: i,
606
606
  onUpdate: t.updateConsumer,
607
607
  onRollKey: t.rollKey,
608
608
  onDeleteKey: t.deleteKey
609
609
  },
610
- a.id
610
+ i.id
611
611
  )) }) });
612
- }, gt = ({ service: t }) => {
613
- const [i, s] = E(!1), n = ie();
612
+ }, jt = ({ service: t }) => {
613
+ const [a, s] = I(!1), n = re();
614
614
  return /* @__PURE__ */ e.jsxs("div", { className: "max-w-3xl h-full pt-(--padding-content-top) pb-(--padding-content-bottom)", children: [
615
- /* @__PURE__ */ e.jsx(Z.Target, { name: "api-keys-list-page" }),
615
+ /* @__PURE__ */ e.jsx(ee.Target, { name: "api-keys-list-page" }),
616
616
  /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between pb-3", children: [
617
617
  /* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "API Keys" }),
618
618
  t.createKey && /* @__PURE__ */ e.jsx(
619
- ce,
619
+ de,
620
620
  {
621
621
  service: t,
622
- isOpen: i,
622
+ isOpen: a,
623
623
  onOpenChange: s
624
624
  }
625
625
  )
626
626
  ] }),
627
627
  /* @__PURE__ */ e.jsx("p", { children: "Create, manage, and monitor your API keys" }),
628
- /* @__PURE__ */ e.jsx(Z.Target, { name: "api-keys-list-page-before-keys" }),
629
- n.profile?.emailVerified === !1 ? /* @__PURE__ */ e.jsxs(Oe, { variant: "outline", children: [
630
- /* @__PURE__ */ e.jsxs(Te, { children: [
631
- /* @__PURE__ */ e.jsx(qe, { children: "Verified email required" }),
632
- /* @__PURE__ */ e.jsx(Me, { children: "You need to verify your email to access API keys." })
628
+ /* @__PURE__ */ e.jsx(ee.Target, { name: "api-keys-list-page-before-keys" }),
629
+ n.profile?.emailVerified === !1 ? /* @__PURE__ */ e.jsxs(Te, { variant: "outline", children: [
630
+ /* @__PURE__ */ e.jsxs(qe, { children: [
631
+ /* @__PURE__ */ e.jsx(Me, { children: "Verified email required" }),
632
+ /* @__PURE__ */ e.jsx(Fe, { children: "You need to verify your email to access API keys." })
633
633
  ] }),
634
- /* @__PURE__ */ e.jsx(Fe, { children: /* @__PURE__ */ e.jsx(De, { onClick: () => n.requestEmailVerification(), children: "Verify email" }) })
634
+ /* @__PURE__ */ e.jsx($e, { children: /* @__PURE__ */ e.jsx(De, { onClick: () => n.requestEmailVerification(), children: "Verify email" }) })
635
635
  ] }) : /* @__PURE__ */ e.jsx(
636
- Ke,
636
+ Pe,
637
637
  {
638
638
  fallbackRender: ({ error: r }) => /* @__PURE__ */ e.jsx(We, { error: r }),
639
- children: /* @__PURE__ */ e.jsx(yt, { service: t })
639
+ children: /* @__PURE__ */ e.jsx(gt, { service: t })
640
640
  }
641
641
  )
642
642
  ] });
643
- }, R = "https://api.zuploedge.com/v2/client", jt = async (t) => {
643
+ }, N = "https://api.zuploedge.com/v2/client", vt = async (t) => {
644
644
  try {
645
645
  return await t.json();
646
646
  } catch {
647
647
  return;
648
648
  }
649
649
  }, O = async (t) => {
650
- const i = t.headers.get("content-type");
651
- if (!t.ok && i?.includes("application/problem+json")) {
652
- const s = await jt(t);
650
+ const a = t.headers.get("content-type");
651
+ if (!t.ok && a?.includes("application/problem+json")) {
652
+ const s = await vt(t);
653
653
  if (s.type && s.title)
654
654
  throw new Error(s.detail ?? s.title);
655
655
  }
656
- }, vt = (t, i) => ({
656
+ }, T = {
657
+ developerHint: "This project is not linked to a Zuplo deployment. Run `zuplo link` to get started with API Keys.",
658
+ title: "Not linked to a Zuplo deployment"
659
+ }, Ct = ({
660
+ deploymentName: t,
661
+ ...a
662
+ }) => ({
657
663
  deleteKey: async (s, n, r) => {
658
- const a = new Request(
659
- R + `/${t}/consumers/${s}/keys/${n}`,
664
+ E(t, "Cannot delete API key.", T);
665
+ const i = new Request(
666
+ N + `/${t}/consumers/${s}/keys/${n}`,
660
667
  {
661
668
  method: "DELETE"
662
669
  }
663
- ), o = await fetch(await r.signRequest(a));
664
- await O(o), N(o.ok, "Failed to delete API key");
670
+ ), o = await fetch(await r.signRequest(i));
671
+ await O(o), E(o.ok, "Failed to delete API key");
665
672
  },
666
673
  updateConsumer: async (s, n) => {
674
+ E(
675
+ t,
676
+ "Cannot update API key description.",
677
+ T
678
+ );
667
679
  const r = await fetch(
668
680
  await n.signRequest(
669
681
  new Request(
670
- R + `/${t}/consumers/${s.id}`,
682
+ `${N}/${t}/consumers/${s.id}`,
671
683
  {
672
684
  method: "PATCH",
673
685
  headers: {
@@ -680,13 +692,14 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
680
692
  )
681
693
  )
682
694
  );
683
- await O(r), N(r.ok, "Failed to update API key description");
695
+ await O(r), E(r.ok, "Failed to update API key description");
684
696
  },
685
697
  rollKey: async (s, n) => {
698
+ E(t, "Cannot roll API key.", T);
686
699
  const r = await fetch(
687
700
  await n.signRequest(
688
701
  new Request(
689
- R + `/${t}/consumers/${s}/roll-key`,
702
+ `${N}/${t}/consumers/${s}/roll-key`,
690
703
  {
691
704
  method: "POST",
692
705
  headers: {
@@ -697,15 +710,16 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
697
710
  )
698
711
  )
699
712
  );
700
- await O(r), N(r.ok, "Failed to roll API key");
713
+ await O(r), E(r.ok, "Failed to roll API key");
701
714
  },
702
715
  getConsumers: async (s) => {
716
+ E(t, "Cannot get API keys.", T);
703
717
  const n = new Request(
704
- `${R}/${t}/consumers`
718
+ `${N}/${t}/consumers`
705
719
  );
706
720
  await s.signRequest(n);
707
721
  const r = await fetch(n);
708
- return await O(r), N(r.ok, "Failed to fetch API keys"), (await r.json()).data.map((o) => ({
722
+ return await O(r), E(r.ok, "Failed to fetch API keys"), (await r.json()).data.map((o) => ({
709
723
  id: o.id,
710
724
  createdOn: o.createdOn,
711
725
  updatedOn: o.updatedOn,
@@ -715,17 +729,21 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
715
729
  key: o.apiKeys.data.at(0)
716
730
  }));
717
731
  },
718
- ...i
719
- }), zt = (t) => t, Lt = ({
732
+ ...a
733
+ }), Lt = (t) => t, Qt = ({
720
734
  deploymentName: t,
721
- ...i
735
+ isZuplo: a,
736
+ ...s
722
737
  }) => {
723
- const s = t ? vt(t, { deploymentName: t, ...i }) : i;
724
- if (!s.getConsumers)
738
+ a && !t && console.warn(
739
+ "This project is not linked to a Zuplo deployment. Run `zuplo link` to get started."
740
+ );
741
+ const n = a ? Ct({ deploymentName: t, ...s }) : s;
742
+ if (!n.getConsumers)
725
743
  throw new Error("getConsumers is required when using the apiKeyPlugin");
726
- const n = {
727
- ...s,
728
- getConsumers: s.getConsumers
744
+ const r = {
745
+ ...n,
746
+ getConsumers: n.getConsumers
729
747
  };
730
748
  return {
731
749
  getProfileMenuItems: () => [
@@ -733,18 +751,18 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
733
751
  label: "API Keys",
734
752
  path: "/settings/api-keys",
735
753
  category: "middle",
736
- icon: je
754
+ icon: ve
737
755
  }
738
756
  ],
739
- getIdentities: async (r) => {
757
+ getIdentities: async (i) => {
740
758
  try {
741
- return (await n.getConsumers(r)).map((o) => ({
742
- authorizeRequest: (d) => (d.headers.set(
759
+ return (await r.getConsumers(i)).map((d) => ({
760
+ authorizeRequest: (c) => (c.headers.set(
743
761
  "Authorization",
744
- `Bearer ${o.apiKeys.at(0)?.key}`
745
- ), d),
746
- id: o.id,
747
- label: o.label
762
+ `Bearer ${d.apiKeys.at(0)?.key}`
763
+ ), c),
764
+ id: d.id,
765
+ label: d.label
748
766
  }));
749
767
  } catch {
750
768
  return [];
@@ -753,14 +771,14 @@ const ht = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presen
753
771
  getRoutes: () => [
754
772
  {
755
773
  path: "/settings/api-keys",
756
- element: /* @__PURE__ */ e.jsx(gt, { service: n })
774
+ element: /* @__PURE__ */ e.jsx(jt, { service: r })
757
775
  }
758
776
  ],
759
777
  getProtectedRoutes: () => ["/settings/api-keys"]
760
778
  };
761
779
  };
762
780
  export {
763
- Lt as apiKeyPlugin,
764
- zt as createApiKeyService
781
+ Qt as apiKeyPlugin,
782
+ Lt as createApiKeyService
765
783
  };
766
784
  //# sourceMappingURL=zudoku.plugin-api-keys.js.map