zudoku 0.53.6 → 0.54.1

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 (197) hide show
  1. package/dist/config/config.d.ts +1 -0
  2. package/dist/config/validators/InputNavigationSchema.d.ts +190 -158
  3. package/dist/config/validators/InputNavigationSchema.js +4 -1
  4. package/dist/config/validators/InputNavigationSchema.js.map +1 -1
  5. package/dist/config/validators/ProtectedRoutesSchema.d.ts +12 -0
  6. package/dist/config/validators/ProtectedRoutesSchema.js +19 -0
  7. package/dist/config/validators/ProtectedRoutesSchema.js.map +1 -0
  8. package/dist/config/validators/validate.d.ts +32 -19
  9. package/dist/config/validators/validate.js +6 -2
  10. package/dist/config/validators/validate.js.map +1 -1
  11. package/dist/flat-config.d.ts +6 -2
  12. package/dist/lib/authentication/components/CallbackHandler.js +11 -9
  13. package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
  14. package/dist/lib/authentication/components/OAuthErrorPage.d.ts +3 -0
  15. package/dist/lib/authentication/components/OAuthErrorPage.js +99 -0
  16. package/dist/lib/authentication/components/OAuthErrorPage.js.map +1 -0
  17. package/dist/lib/authentication/errors.d.ts +6 -12
  18. package/dist/lib/authentication/errors.js +2 -1
  19. package/dist/lib/authentication/errors.js.map +1 -1
  20. package/dist/lib/authentication/hook.d.ts +1 -0
  21. package/dist/lib/authentication/hook.js.map +1 -1
  22. package/dist/lib/authentication/providers/azureb2c.js +4 -2
  23. package/dist/lib/authentication/providers/azureb2c.js.map +1 -1
  24. package/dist/lib/authentication/providers/clerk.js +4 -2
  25. package/dist/lib/authentication/providers/clerk.js.map +1 -1
  26. package/dist/lib/authentication/providers/openid.js +3 -1
  27. package/dist/lib/authentication/providers/openid.js.map +1 -1
  28. package/dist/lib/components/Heading.js +1 -1
  29. package/dist/lib/components/Heading.js.map +1 -1
  30. package/dist/lib/components/MobileTopNavigation.js +5 -3
  31. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  32. package/dist/lib/components/TopNavigation.js +4 -3
  33. package/dist/lib/components/TopNavigation.js.map +1 -1
  34. package/dist/lib/components/context/ZudokuContext.js +21 -13
  35. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  36. package/dist/lib/components/navigation/NavigationItem.d.ts +1 -1
  37. package/dist/lib/components/navigation/NavigationItem.js +8 -1
  38. package/dist/lib/components/navigation/NavigationItem.js.map +1 -1
  39. package/dist/lib/components/navigation/utils.d.ts +3 -1
  40. package/dist/lib/components/navigation/utils.js +6 -3
  41. package/dist/lib/components/navigation/utils.js.map +1 -1
  42. package/dist/lib/core/RouteGuard.js +9 -9
  43. package/dist/lib/core/RouteGuard.js.map +1 -1
  44. package/dist/lib/core/ZudokuContext.d.ts +2 -1
  45. package/dist/lib/core/ZudokuContext.js +13 -1
  46. package/dist/lib/core/ZudokuContext.js.map +1 -1
  47. package/dist/lib/core/plugins.d.ts +2 -1
  48. package/dist/lib/core/plugins.js.map +1 -1
  49. package/dist/lib/plugins/api-keys/CreateApiKey.js +7 -3
  50. package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -1
  51. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +3 -1
  52. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  53. package/dist/lib/plugins/api-keys/index.d.ts +1 -0
  54. package/dist/lib/plugins/api-keys/index.js +3 -7
  55. package/dist/lib/plugins/api-keys/index.js.map +1 -1
  56. package/dist/lib/plugins/openapi/graphql/gql.d.ts +1 -1
  57. package/dist/lib/plugins/openapi/graphql/gql.js +1 -1
  58. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  59. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +1 -0
  60. package/dist/lib/plugins/openapi/graphql/graphql.js +1 -0
  61. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  62. package/dist/lib/plugins/openapi/index.js +42 -10
  63. package/dist/lib/plugins/openapi/index.js.map +1 -1
  64. package/dist/lib/ui/ActionButton.js +1 -1
  65. package/dist/lib/ui/ActionButton.js.map +1 -1
  66. package/dist/lib/ui/Badge.d.ts +1 -1
  67. package/dist/lib/ui/Button.d.ts +2 -2
  68. package/dist/lib/ui/Command.d.ts +1 -1
  69. package/dist/lib/util/invariant.d.ts +6 -5
  70. package/dist/lib/util/invariant.js +1 -1
  71. package/dist/lib/util/invariant.js.map +1 -1
  72. package/dist/vite/dev-server.js +1 -1
  73. package/dist/vite/dev-server.js.map +1 -1
  74. package/dist/vite/prerender/worker.js +5 -1
  75. package/dist/vite/prerender/worker.js.map +1 -1
  76. package/dist/vite/shadcn-registry.d.ts +8 -8
  77. package/lib/{Command-C9AC5cf-.js → Command-BYukybsa.js} +2 -2
  78. package/lib/{Command-C9AC5cf-.js.map → Command-BYukybsa.js.map} +1 -1
  79. package/lib/{Dialog-DMWw1doX.js → Dialog-u9Uz9sTt.js} +4 -4
  80. package/lib/{Dialog-DMWw1doX.js.map → Dialog-u9Uz9sTt.js.map} +1 -1
  81. package/lib/{MdxPage-DVI4iYgW.js → MdxPage-Bsko6_kb.js} +11 -11
  82. package/lib/{MdxPage-DVI4iYgW.js.map → MdxPage-Bsko6_kb.js.map} +1 -1
  83. package/lib/OAuthErrorPage-DJzGiIBt.js +150 -0
  84. package/lib/OAuthErrorPage-DJzGiIBt.js.map +1 -0
  85. package/lib/{OasProvider-CbwsKPNc.js → OasProvider-DQQRt3oS.js} +3 -3
  86. package/lib/{OasProvider-CbwsKPNc.js.map → OasProvider-DQQRt3oS.js.map} +1 -1
  87. package/lib/{OperationList-Bn9ggxw8.js → OperationList-DpmkHf26.js} +45 -43
  88. package/lib/{OperationList-Bn9ggxw8.js.map → OperationList-DpmkHf26.js.map} +1 -1
  89. package/lib/{Pagination-bavPec-z.js → Pagination-kqFNgtnI.js} +3 -3
  90. package/lib/{Pagination-bavPec-z.js.map → Pagination-kqFNgtnI.js.map} +1 -1
  91. package/lib/{RouteGuard-Vnlz_t51.js → RouteGuard-0wPUKdxJ.js} +166 -165
  92. package/lib/{RouteGuard-Vnlz_t51.js.map → RouteGuard-0wPUKdxJ.js.map} +1 -1
  93. package/lib/{SchemaList-DETyCVqu.js → SchemaList-DS-pMd6B.js} +8 -8
  94. package/lib/{SchemaList-DETyCVqu.js.map → SchemaList-DS-pMd6B.js.map} +1 -1
  95. package/lib/{SchemaView-Dvxo2RNe.js → SchemaView-BnN6WHjw.js} +4 -4
  96. package/lib/{SchemaView-Dvxo2RNe.js.map → SchemaView-BnN6WHjw.js.map} +1 -1
  97. package/lib/Select-BmTTKNPp.js +273 -0
  98. package/lib/Select-BmTTKNPp.js.map +1 -0
  99. package/lib/{SignUp-ClYhZq9H.js → SignUp-BwOSCD-6.js} +9 -9
  100. package/lib/{SignUp-ClYhZq9H.js.map → SignUp-BwOSCD-6.js.map} +1 -1
  101. package/lib/{Slot-B31yZlfB.js → Slot-DAyXieeZ.js} +1352 -1349
  102. package/lib/{Slot-B31yZlfB.js.map → Slot-DAyXieeZ.js.map} +1 -1
  103. package/lib/{SyntaxHighlight-bm761HDo.js → SyntaxHighlight-BMKR4pl6.js} +3 -3
  104. package/lib/{SyntaxHighlight-bm761HDo.js.map → SyntaxHighlight-BMKR4pl6.js.map} +1 -1
  105. package/lib/{Toc-D4oBWE8D.js → Toc-BKDRCQzU.js} +2 -2
  106. package/lib/{Toc-D4oBWE8D.js.map → Toc-BKDRCQzU.js.map} +1 -1
  107. package/lib/ZudokuContext-CLl5w57E.js +1278 -0
  108. package/lib/ZudokuContext-CLl5w57E.js.map +1 -0
  109. package/lib/{chunk-DQRVZFIR-DHK7_Ilc.js → chunk-QMGIS6GS-CEOk3lro.js} +3 -3
  110. package/lib/chunk-QMGIS6GS-CEOk3lro.js.map +1 -0
  111. package/lib/{circular-CRbFI6Zl.js → circular-8GWQDvCW.js} +2 -2
  112. package/lib/{circular-CRbFI6Zl.js.map → circular-8GWQDvCW.js.map} +1 -1
  113. package/lib/{createServer-DNyGJJNX.js → createServer-BsezSzvV.js} +5 -5
  114. package/lib/{createServer-DNyGJJNX.js.map → createServer-BsezSzvV.js.map} +1 -1
  115. package/lib/{errors-C1GlNcV3.js → errors-Cs7hKmdL.js} +11 -10
  116. package/lib/errors-Cs7hKmdL.js.map +1 -0
  117. package/lib/hook-DbUCLQNg.js +247 -0
  118. package/lib/hook-DbUCLQNg.js.map +1 -0
  119. package/lib/{index-D09PbNex.js → index-A5Qdwj1B.js} +1521 -1420
  120. package/lib/index-A5Qdwj1B.js.map +1 -0
  121. package/lib/{index-C_PXQ8Bx.js → index-Bg7Js3jB.js} +832 -912
  122. package/lib/index-Bg7Js3jB.js.map +1 -0
  123. package/lib/{index-CZTEgYDd.js → index-BkW9tJ6j.js} +2 -2
  124. package/lib/{index-CZTEgYDd.js.map → index-BkW9tJ6j.js.map} +1 -1
  125. package/lib/index.esm-CdzlRw50.js +1254 -0
  126. package/lib/index.esm-CdzlRw50.js.map +1 -0
  127. package/lib/{invariant-DAFpPywt.js → invariant-Bm-FVUQE.js} +2 -6
  128. package/lib/invariant-Bm-FVUQE.js.map +1 -0
  129. package/lib/ui/ActionButton.js +9 -9
  130. package/lib/ui/ActionButton.js.map +1 -1
  131. package/lib/ui/Command.js +1 -1
  132. package/lib/ui/Form.js +1 -1
  133. package/lib/ui/SyntaxHighlight.js +3 -3
  134. package/lib/{useExposedProps-BIYjecPD.js → useExposedProps-KcgXHKeE.js} +2 -2
  135. package/lib/{useExposedProps-BIYjecPD.js.map → useExposedProps-KcgXHKeE.js.map} +1 -1
  136. package/lib/zudoku.auth-auth0.js +1 -1
  137. package/lib/zudoku.auth-azureb2c.js +25 -17
  138. package/lib/zudoku.auth-azureb2c.js.map +1 -1
  139. package/lib/zudoku.auth-clerk.js +24 -21
  140. package/lib/zudoku.auth-clerk.js.map +1 -1
  141. package/lib/zudoku.auth-openid.js +213 -205
  142. package/lib/zudoku.auth-openid.js.map +1 -1
  143. package/lib/zudoku.auth-supabase.js +2 -2
  144. package/lib/zudoku.components.js +29 -28
  145. package/lib/zudoku.components.js.map +1 -1
  146. package/lib/zudoku.hooks.js +16 -15
  147. package/lib/zudoku.hooks.js.map +1 -1
  148. package/lib/zudoku.plugin-api-catalog.js +26 -25
  149. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  150. package/lib/zudoku.plugin-api-keys.js +409 -297
  151. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  152. package/lib/zudoku.plugin-custom-pages.js +1 -1
  153. package/lib/zudoku.plugin-markdown.js +1 -1
  154. package/lib/zudoku.plugin-openapi.js +7 -6
  155. package/lib/zudoku.plugin-openapi.js.map +1 -1
  156. package/lib/zudoku.plugin-redirect.js +1 -1
  157. package/lib/zudoku.plugin-search-pagefind.js +28 -27
  158. package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
  159. package/lib/zudoku.plugins.js.map +1 -1
  160. package/package.json +4 -4
  161. package/src/lib/authentication/components/CallbackHandler.tsx +22 -15
  162. package/src/lib/authentication/components/OAuthErrorPage.tsx +171 -0
  163. package/src/lib/authentication/errors.ts +27 -13
  164. package/src/lib/authentication/hook.ts +2 -0
  165. package/src/lib/authentication/providers/azureb2c.tsx +8 -3
  166. package/src/lib/authentication/providers/clerk.tsx +4 -1
  167. package/src/lib/authentication/providers/openid.tsx +7 -1
  168. package/src/lib/components/Heading.tsx +1 -1
  169. package/src/lib/components/MobileTopNavigation.tsx +6 -3
  170. package/src/lib/components/TopNavigation.tsx +4 -4
  171. package/src/lib/components/context/ZudokuContext.ts +25 -18
  172. package/src/lib/components/navigation/NavigationItem.tsx +9 -1
  173. package/src/lib/components/navigation/utils.ts +9 -3
  174. package/src/lib/core/RouteGuard.tsx +13 -13
  175. package/src/lib/core/ZudokuContext.ts +18 -5
  176. package/src/lib/core/plugins.ts +2 -1
  177. package/src/lib/plugins/api-keys/CreateApiKey.tsx +12 -1
  178. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +24 -4
  179. package/src/lib/plugins/api-keys/index.tsx +7 -8
  180. package/src/lib/plugins/openapi/graphql/gql.ts +3 -3
  181. package/src/lib/plugins/openapi/graphql/graphql.ts +2 -0
  182. package/src/lib/plugins/openapi/index.tsx +66 -16
  183. package/src/lib/ui/ActionButton.tsx +3 -1
  184. package/src/lib/util/invariant.ts +7 -5
  185. package/lib/Alert-CWApD0CL.js +0 -161
  186. package/lib/Alert-CWApD0CL.js.map +0 -1
  187. package/lib/CallbackHandler-Dr5Lva9x.js +0 -38
  188. package/lib/CallbackHandler-Dr5Lva9x.js.map +0 -1
  189. package/lib/chunk-DQRVZFIR-DHK7_Ilc.js.map +0 -1
  190. package/lib/errors-C1GlNcV3.js.map +0 -1
  191. package/lib/hook-CZjW2buS.js +0 -1510
  192. package/lib/hook-CZjW2buS.js.map +0 -1
  193. package/lib/index-C_PXQ8Bx.js.map +0 -1
  194. package/lib/index-D09PbNex.js.map +0 -1
  195. package/lib/index.esm-Cp4wkyud.js +0 -1236
  196. package/lib/index.esm-Cp4wkyud.js.map +0 -1
  197. package/lib/invariant-DAFpPywt.js.map +0 -1
@@ -1,51 +1,55 @@
1
1
  import { j as e } from "./jsx-runtime-C5mzlN2N.js";
2
- import { CircleSlashIcon as M, CheckIcon as W, XIcon as oe, PencilLineIcon as le, RefreshCwIcon as ce, EyeOffIcon as de, EyeIcon as ue, CopyIcon as he, TrashIcon as fe, KeyRoundIcon as pe } from "lucide-react";
3
- import { D as me, a as B, R as xe } from "./Slot-B31yZlfB.js";
4
- import { i as I } from "./invariant-DAFpPywt.js";
5
- import { O as ye, L as J } from "./chunk-DQRVZFIR-DHK7_Ilc.js";
6
- import { e as ge, d as je, g as Ce, c as we } from "./hook-CZjW2buS.js";
7
- import { Button as g } from "./ui/Button.js";
8
- import { u as S, A as q, a as L } from "./Alert-CWApD0CL.js";
9
- import * as F from "react";
10
- import ve, { createContext as O, useRef as P, useLayoutEffect as ke, useEffect as X, useId as Q, useContext as H, useInsertionEffect as be, useMemo as $, useCallback as Ee, Children as Ne, isValidElement as Pe, useState as D } from "react";
11
- import { C as De, a as Ie } from "./Card-CMDQUPM4.js";
12
- import { D as Y, e as G, a as V, c as Z, b as ee, d as te, f as se, g as T } from "./Dialog-DMWw1doX.js";
13
- import { Input as Ke } from "./ui/Input.js";
2
+ import { CircleSlashIcon as F, CheckIcon as te, XIcon as ue, PencilLineIcon as he, RefreshCwIcon as fe, EyeOffIcon as pe, EyeIcon as me, CopyIcon as xe, TrashIcon as ye, KeyRoundIcon as ge } from "lucide-react";
3
+ import { D as je, a as Y, R as Ce } from "./Slot-DAyXieeZ.js";
4
+ import { i as A } from "./invariant-Bm-FVUQE.js";
5
+ import { O as ve, a as we, L as be } from "./chunk-QMGIS6GS-CEOk3lro.js";
6
+ import { a as ke } from "./hook-DbUCLQNg.js";
7
+ import { Button as x } from "./ui/Button.js";
8
+ import { c as se, e as ne, b as Ne } from "./ZudokuContext-CLl5w57E.js";
9
+ import { u as z, A as O, a as M, b as Ee, S as Ke, c as De, d as Ie, e as Pe, f as Ae, g as Z } from "./Select-BmTTKNPp.js";
10
+ import * as _ from "react";
11
+ import Re, { createContext as G, useRef as D, useLayoutEffect as Se, useEffect as ie, useId as J, useContext as U, useInsertionEffect as Te, useMemo as L, useCallback as ze, Children as Oe, isValidElement as Me, useState as K, forwardRef as qe } from "react";
12
+ import { C as Fe, a as Le } from "./Card-CMDQUPM4.js";
13
+ import { e as W, f as I, D as $, g as Q, a as B, c as H, b as V, d as re } from "./Dialog-u9Uz9sTt.js";
14
+ import { Input as ae } from "./ui/Input.js";
14
15
  import { c as N } from "./cn-dYga0KKN.js";
15
- import { u as Ae } from "./CodeBlock-B-G0eKtw.js";
16
- const Re = () => {
17
- const t = ge();
18
- return t.isAuthEnabled && t.isPending ? null : t.isAuthenticated ? /* @__PURE__ */ e.jsx(ye, {}) : t.isAuthEnabled ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: [
16
+ import { u as $e } from "./CodeBlock-B-G0eKtw.js";
17
+ import { a as Qe } from "./index.esm-CdzlRw50.js";
18
+ import { B as Be } from "./Button-B3o-2Xdf.js";
19
+ import { S as He } from "./Spinner-mNLZ6awP.js";
20
+ const Ve = () => {
21
+ const t = ke();
22
+ return t.isAuthEnabled && t.isPending ? null : t.isAuthenticated ? /* @__PURE__ */ e.jsx(ve, {}) : t.isAuthEnabled ? /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: [
19
23
  "Please login first to view this page",
20
- /* @__PURE__ */ e.jsx(g, { onClick: () => t.login(), children: "Login" })
21
- ] }) : /* @__PURE__ */ e.jsx("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: /* @__PURE__ */ e.jsxs(me, { className: "max-w-[600px]", children: [
24
+ /* @__PURE__ */ e.jsx(x, { onClick: () => t.login(), children: "Login" })
25
+ ] }) : /* @__PURE__ */ e.jsx("div", { className: "flex flex-col justify-center gap-2 items-center h-1/2", children: /* @__PURE__ */ e.jsxs(je, { className: "max-w-[600px]", children: [
22
26
  "Authentication needs to be enabled for API keys to work. Enable it in your Zudoku configuration under ",
23
27
  /* @__PURE__ */ e.jsx("code", { children: "authentication" }),
24
28
  "."
25
29
  ] }) });
26
- }, Te = O({});
27
- function ne(t) {
28
- const r = P(null);
29
- return r.current === null && (r.current = t()), r.current;
30
+ }, _e = G({});
31
+ function oe(t) {
32
+ const i = D(null);
33
+ return i.current === null && (i.current = t()), i.current;
30
34
  }
31
- const ze = typeof window < "u", Me = ze ? ke : X, ie = /* @__PURE__ */ O(null);
32
- function Se(t) {
35
+ const Ge = typeof window < "u", Je = Ge ? Se : ie, le = /* @__PURE__ */ G(null);
36
+ function Ue(t) {
33
37
  return typeof t == "object" && t !== null;
34
38
  }
35
- function qe(t) {
36
- return Se(t) && "offsetHeight" in t;
39
+ function We(t) {
40
+ return Ue(t) && "offsetHeight" in t;
37
41
  }
38
- const Le = O({
42
+ const Xe = G({
39
43
  transformPagePoint: (t) => t,
40
44
  isStatic: !1,
41
45
  reducedMotion: "never"
42
46
  });
43
- class $e extends F.Component {
44
- getSnapshotBeforeUpdate(r) {
47
+ class Ye extends _.Component {
48
+ getSnapshotBeforeUpdate(i) {
45
49
  const s = this.props.childRef.current;
46
- if (s && r.isPresent && !this.props.isPresent) {
47
- const n = s.offsetParent, o = qe(n) && n.offsetWidth || 0, a = this.props.sizeRef.current;
48
- a.height = s.offsetHeight || 0, a.width = s.offsetWidth || 0, a.top = s.offsetTop, a.left = s.offsetLeft, a.right = o - a.width - a.left;
50
+ if (s && i.isPresent && !this.props.isPresent) {
51
+ const n = s.offsetParent, r = We(n) && n.offsetWidth || 0, a = this.props.sizeRef.current;
52
+ 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;
49
53
  }
50
54
  return null;
51
55
  }
@@ -58,236 +62,347 @@ class $e extends F.Component {
58
62
  return this.props.children;
59
63
  }
60
64
  }
61
- function Fe({ children: t, isPresent: r, anchorX: s, root: n }) {
62
- const o = Q(), a = P(null), u = P({
65
+ function Ze({ children: t, isPresent: i, anchorX: s, root: n }) {
66
+ const r = J(), a = D(null), l = D({
63
67
  width: 0,
64
68
  height: 0,
65
69
  top: 0,
66
70
  left: 0,
67
71
  right: 0
68
- }), { nonce: m } = H(Le);
69
- return be(() => {
70
- const { width: C, height: l, top: j, left: c, right: f } = u.current;
71
- if (r || !a.current || !C || !l)
72
+ }), { nonce: h } = U(Xe);
73
+ return Te(() => {
74
+ const { width: y, height: d, top: C, left: u, right: f } = l.current;
75
+ if (i || !a.current || !y || !d)
72
76
  return;
73
- const x = s === "left" ? `left: ${c}` : `right: ${f}`;
74
- a.current.dataset.motionPopId = o;
75
- const h = document.createElement("style");
76
- m && (h.nonce = m);
77
- const i = n ?? document.head;
78
- return i.appendChild(h), h.sheet && h.sheet.insertRule(`
79
- [data-motion-pop-id="${o}"] {
77
+ const p = s === "left" ? `left: ${u}` : `right: ${f}`;
78
+ a.current.dataset.motionPopId = r;
79
+ const m = document.createElement("style");
80
+ h && (m.nonce = h);
81
+ const g = n ?? document.head;
82
+ return g.appendChild(m), m.sheet && m.sheet.insertRule(`
83
+ [data-motion-pop-id="${r}"] {
80
84
  position: absolute !important;
81
- width: ${C}px !important;
82
- height: ${l}px !important;
83
- ${x}px !important;
84
- top: ${j}px !important;
85
+ width: ${y}px !important;
86
+ height: ${d}px !important;
87
+ ${p}px !important;
88
+ top: ${C}px !important;
85
89
  }
86
90
  `), () => {
87
- i.removeChild(h), i.contains(h) && i.removeChild(h);
91
+ g.removeChild(m), g.contains(m) && g.removeChild(m);
88
92
  };
89
- }, [r]), e.jsx($e, { isPresent: r, childRef: a, sizeRef: u, children: F.cloneElement(t, { ref: a }) });
93
+ }, [i]), e.jsx(Ye, { isPresent: i, childRef: a, sizeRef: l, children: _.cloneElement(t, { ref: a }) });
90
94
  }
91
- const Oe = ({ children: t, initial: r, isPresent: s, onExitComplete: n, custom: o, presenceAffectsLayout: a, mode: u, anchorX: m, root: C }) => {
92
- const l = ne(Qe), j = Q();
93
- let c = !0, f = $(() => (c = !1, {
94
- id: j,
95
- initial: r,
95
+ const et = ({ children: t, initial: i, isPresent: s, onExitComplete: n, custom: r, presenceAffectsLayout: a, mode: l, anchorX: h, root: y }) => {
96
+ const d = oe(tt), C = J();
97
+ let u = !0, f = L(() => (u = !1, {
98
+ id: C,
99
+ initial: i,
96
100
  isPresent: s,
97
- custom: o,
98
- onExitComplete: (x) => {
99
- l.set(x, !0);
100
- for (const h of l.values())
101
- if (!h)
101
+ custom: r,
102
+ onExitComplete: (p) => {
103
+ d.set(p, !0);
104
+ for (const m of d.values())
105
+ if (!m)
102
106
  return;
103
107
  n && n();
104
108
  },
105
- register: (x) => (l.set(x, !1), () => l.delete(x))
106
- }), [s, l, n]);
107
- return a && c && (f = { ...f }), $(() => {
108
- l.forEach((x, h) => l.set(h, !1));
109
- }, [s]), F.useEffect(() => {
110
- !s && !l.size && n && n();
111
- }, [s]), u === "popLayout" && (t = e.jsx(Fe, { isPresent: s, anchorX: m, root: C, children: t })), e.jsx(ie.Provider, { value: f, children: t });
109
+ register: (p) => (d.set(p, !1), () => d.delete(p))
110
+ }), [s, d, n]);
111
+ return a && u && (f = { ...f }), L(() => {
112
+ d.forEach((p, m) => d.set(m, !1));
113
+ }, [s]), _.useEffect(() => {
114
+ !s && !d.size && n && n();
115
+ }, [s]), l === "popLayout" && (t = e.jsx(Ze, { isPresent: s, anchorX: h, root: y, children: t })), e.jsx(le.Provider, { value: f, children: t });
112
116
  };
113
- function Qe() {
117
+ function tt() {
114
118
  return /* @__PURE__ */ new Map();
115
119
  }
116
- function He(t = !0) {
117
- const r = H(ie);
118
- if (r === null)
120
+ function st(t = !0) {
121
+ const i = U(le);
122
+ if (i === null)
119
123
  return [!0, null];
120
- const { isPresent: s, onExitComplete: n, register: o } = r, a = Q();
121
- X(() => {
124
+ const { isPresent: s, onExitComplete: n, register: r } = i, a = J();
125
+ ie(() => {
122
126
  if (t)
123
- return o(a);
127
+ return r(a);
124
128
  }, [t]);
125
- const u = Ee(() => t && n && n(a), [a, n, t]);
126
- return !s && n ? [!1, u] : [!0];
129
+ const l = ze(() => t && n && n(a), [a, n, t]);
130
+ return !s && n ? [!1, l] : [!0];
127
131
  }
128
- const K = (t) => t.key || "";
129
- function U(t) {
130
- const r = [];
131
- return Ne.forEach(t, (s) => {
132
- Pe(s) && r.push(s);
133
- }), r;
132
+ const R = (t) => t.key || "";
133
+ function ee(t) {
134
+ const i = [];
135
+ return Oe.forEach(t, (s) => {
136
+ Me(s) && i.push(s);
137
+ }), i;
134
138
  }
135
- const _e = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presenceAffectsLayout: o = !0, mode: a = "sync", propagate: u = !1, anchorX: m = "left", root: C }) => {
136
- const [l, j] = He(u), c = $(() => U(t), [t]), f = u && !l ? [] : c.map(K), x = P(!0), h = P(c), i = ne(() => /* @__PURE__ */ new Map()), [d, w] = D(c), [p, v] = D(c);
137
- Me(() => {
138
- x.current = !1, h.current = c;
139
- for (let k = 0; k < p.length; k++) {
140
- const y = K(p[k]);
141
- f.includes(y) ? i.delete(y) : i.get(y) !== !0 && i.set(y, !1);
139
+ const nt = ({ children: t, custom: i, initial: s = !0, onExitComplete: n, presenceAffectsLayout: r = !0, mode: a = "sync", propagate: l = !1, anchorX: h = "left", root: y }) => {
140
+ const [d, C] = st(l), u = L(() => ee(t), [t]), f = l && !d ? [] : u.map(R), p = D(!0), m = D(u), g = oe(() => /* @__PURE__ */ new Map()), [P, o] = K(u), [c, v] = K(u);
141
+ Je(() => {
142
+ p.current = !1, m.current = u;
143
+ for (let w = 0; w < c.length; w++) {
144
+ const j = R(c[w]);
145
+ f.includes(j) ? g.delete(j) : g.get(j) !== !0 && g.set(j, !1);
142
146
  }
143
- }, [p, f.length, f.join("-")]);
144
- const E = [];
145
- if (c !== d) {
146
- let k = [...c];
147
- for (let y = 0; y < p.length; y++) {
148
- const b = p[y], z = K(b);
149
- f.includes(z) || (k.splice(y, 0, b), E.push(b));
147
+ }, [c, f.length, f.join("-")]);
148
+ const b = [];
149
+ if (u !== P) {
150
+ let w = [...u];
151
+ for (let j = 0; j < c.length; j++) {
152
+ const E = c[j], q = R(E);
153
+ f.includes(q) || (w.splice(j, 0, E), b.push(E));
150
154
  }
151
- return a === "wait" && E.length && (k = E), v(U(k)), w(c), null;
155
+ return a === "wait" && b.length && (w = b), v(ee(w)), o(u), null;
152
156
  }
153
- 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.`);
154
- const { forceRender: re } = H(Te);
155
- return e.jsx(e.Fragment, { children: p.map((k) => {
156
- const y = K(k), b = u && !l ? !1 : c === p || f.includes(y), z = () => {
157
- if (i.has(y))
158
- i.set(y, !0);
157
+ 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.`);
158
+ const { forceRender: k } = U(_e);
159
+ return e.jsx(e.Fragment, { children: c.map((w) => {
160
+ const j = R(w), E = l && !d ? !1 : u === c || f.includes(j), q = () => {
161
+ if (g.has(j))
162
+ g.set(j, !0);
159
163
  else
160
164
  return;
161
- let _ = !0;
162
- i.forEach((ae) => {
163
- ae || (_ = !1);
164
- }), _ && (re?.(), v(h.current), u && j?.(), n && n());
165
+ let X = !0;
166
+ g.forEach((de) => {
167
+ de || (X = !1);
168
+ }), X && (k?.(), v(m.current), l && C?.(), n && n());
165
169
  };
166
- return e.jsx(Oe, { isPresent: b, initial: !x.current || s ? void 0 : !1, custom: r, presenceAffectsLayout: o, mode: a, root: C, onExitComplete: b ? void 0 : z, anchorX: m, children: k }, y);
170
+ return e.jsx(et, { isPresent: E, initial: !p.current || s ? void 0 : !1, custom: i, presenceAffectsLayout: r, mode: a, root: y, onExitComplete: E ? void 0 : q, anchorX: h, children: w }, j);
167
171
  }) });
168
- }, Be = ({ service: t }) => {
169
- const r = je(), s = Ce(), [n, o] = D(
172
+ }, ce = qe(
173
+ ({ isPending: t, children: i, className: s, ...n }, r) => /* @__PURE__ */ e.jsxs(
174
+ Be,
175
+ {
176
+ ref: r,
177
+ disabled: t,
178
+ ...n,
179
+ className: N("relative", s),
180
+ children: [
181
+ t && /* @__PURE__ */ e.jsx("div", { className: "absolute inset-0 grid place-items-center", children: /* @__PURE__ */ e.jsx(He, {}) }),
182
+ /* @__PURE__ */ e.jsx("span", { className: N("block", t && "invisible"), children: i })
183
+ ]
184
+ }
185
+ )
186
+ );
187
+ ce.displayName = "ActionButton";
188
+ const it = ({
189
+ service: t,
190
+ onOpenChange: i
191
+ }) => {
192
+ const s = se(), n = ne(), r = we(), a = Qe({
193
+ defaultValues: {
194
+ expiresOn: "30"
195
+ }
196
+ }), l = z({
197
+ mutationFn: ({ description: h, expiresOn: y }) => {
198
+ if (!t.createKey)
199
+ throw new Error("createKey not implemented");
200
+ const d = y !== "never" ? rt(Number(y)) : void 0;
201
+ return t.createKey(
202
+ {
203
+ description: h || "Secret Key",
204
+ expiresOn: d
205
+ },
206
+ s
207
+ );
208
+ },
209
+ onSuccess: async () => {
210
+ await n.invalidateQueries({ queryKey: ["api-keys"] }), await r("/settings/api-keys/");
211
+ }
212
+ });
213
+ return t.createKey ? /* @__PURE__ */ e.jsxs(
214
+ "form",
215
+ {
216
+ onSubmit: a.handleSubmit(
217
+ (h) => l.mutate(
218
+ { ...h },
219
+ {
220
+ onSuccess: () => i(!1)
221
+ }
222
+ )
223
+ ),
224
+ children: [
225
+ l.error && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
226
+ /* @__PURE__ */ e.jsx(M, { children: "Error" }),
227
+ /* @__PURE__ */ e.jsx(Ee, { children: l.error.message })
228
+ ] }),
229
+ /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 flex-col text-sm font-medium", children: [
230
+ "Name",
231
+ /* @__PURE__ */ e.jsx(ae, { ...a.register("description") }),
232
+ "Expiration",
233
+ /* @__PURE__ */ e.jsxs(
234
+ Ke,
235
+ {
236
+ onValueChange: (h) => a.setValue("expiresOn", h),
237
+ defaultValue: a.getValues("expiresOn"),
238
+ children: [
239
+ /* @__PURE__ */ e.jsx(De, { children: /* @__PURE__ */ e.jsx(Ie, {}) }),
240
+ /* @__PURE__ */ e.jsx(Pe, { children: /* @__PURE__ */ e.jsxs(Ae, { children: [
241
+ [7, 30, 60, 90].map((h) => /* @__PURE__ */ e.jsxs(Z, { value: String(h), children: [
242
+ h,
243
+ " days"
244
+ ] }, h)),
245
+ /* @__PURE__ */ e.jsx(Z, { value: "never", children: "Never" })
246
+ ] }) })
247
+ ]
248
+ }
249
+ ),
250
+ /* @__PURE__ */ e.jsxs(W, { children: [
251
+ /* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(x, { variant: "outline", children: "Cancel" }) }),
252
+ /* @__PURE__ */ e.jsx(ce, { isPending: l.isPending, children: "Generate Key" })
253
+ ] })
254
+ ] })
255
+ ]
256
+ }
257
+ ) : null;
258
+ }, rt = (t) => {
259
+ const i = /* @__PURE__ */ new Date();
260
+ return i.setDate(i.getDate() + t), i.toISOString();
261
+ }, at = ({ service: t }) => {
262
+ const i = se(), s = ne(), [n, r] = K(
170
263
  null
171
- ), [a, u] = D(""), { data: m, isFetching: C } = we({
172
- queryFn: () => t.getConsumers(r),
264
+ ), [a, l] = K(""), { data: h, isFetching: y } = Ne({
265
+ queryFn: () => t.getConsumers(i),
173
266
  queryKey: ["api-keys"],
174
267
  retry: !1
175
- }), l = S({
268
+ }), [d, C] = K(!1), u = z({
176
269
  mutationFn: ({
177
- consumerId: i,
178
- keyId: d
270
+ consumerId: o,
271
+ keyId: c
179
272
  }) => {
180
273
  if (!t.deleteKey)
181
274
  throw new Error("deleteKey not implemented");
182
- return t.deleteKey(i, d, r);
275
+ return t.deleteKey(o, c, i);
183
276
  },
184
- onMutate: async ({ consumerId: i, keyId: d }) => {
277
+ onMutate: async ({ consumerId: o, keyId: c }) => {
185
278
  await s.cancelQueries({ queryKey: ["api-keys"] });
186
- const w = s.getQueryData([
279
+ const v = s.getQueryData([
187
280
  "api-keys"
188
281
  ]);
189
- return s.setQueryData(["api-keys"], (p) => p && p.map((v) => v.id === i ? {
190
- ...v,
191
- apiKeys: v.apiKeys.filter((E) => E.id !== d)
192
- } : v)), { previousData: w };
282
+ return s.setQueryData(["api-keys"], (b) => b && b.map((k) => k.id === o ? {
283
+ ...k,
284
+ apiKeys: k.apiKeys.filter((w) => w.id !== c)
285
+ } : k)), { previousData: v };
193
286
  },
194
- onError: (i, d, w) => {
195
- w?.previousData && s.setQueryData(["api-keys"], w.previousData);
287
+ onError: (o, c, v) => {
288
+ v?.previousData && s.setQueryData(["api-keys"], v.previousData);
196
289
  },
197
290
  onSuccess: () => {
198
291
  s.invalidateQueries({ queryKey: ["api-keys"] });
199
292
  }
200
- }), j = S({
293
+ }), f = z({
201
294
  mutationFn: ({
202
- consumerId: i,
203
- label: d
295
+ consumerId: o,
296
+ label: c
204
297
  }) => {
205
298
  if (!t.updateConsumer)
206
299
  throw new Error("updateConsumer not implemented");
207
- return t.updateConsumer({ id: i, label: d }, r);
300
+ return t.updateConsumer({ id: o, label: c }, i);
208
301
  },
209
- onMutate: async ({ consumerId: i, label: d }) => {
302
+ onMutate: async ({ consumerId: o, label: c }) => {
210
303
  await s.cancelQueries({ queryKey: ["api-keys"] });
211
- const w = s.getQueryData(["api-keys"]);
212
- return s.setQueryData(["api-keys"], (p) => p && p.map((v) => v.id === i ? {
213
- ...v,
214
- label: d
215
- } : v)), { previousData: w };
304
+ const v = s.getQueryData(["api-keys"]);
305
+ return s.setQueryData(["api-keys"], (b) => b && b.map((k) => k.id === o ? {
306
+ ...k,
307
+ label: c
308
+ } : k)), { previousData: v };
216
309
  },
217
- onError: (i, d, w) => {
218
- w?.previousData && s.setQueryData(["api-keys"], w.previousData);
310
+ onError: (o, c, v) => {
311
+ v?.previousData && s.setQueryData(["api-keys"], v.previousData);
219
312
  },
220
313
  onSuccess: () => {
221
314
  s.invalidateQueries({ queryKey: ["api-keys"] });
222
315
  }
223
- }), c = S({
224
- mutationFn: (i) => {
316
+ }), p = z({
317
+ mutationFn: (o) => {
225
318
  if (!t.rollKey)
226
319
  throw new Error("rollKey not implemented");
227
- return t.rollKey(i, r);
320
+ return t.rollKey(o, i);
228
321
  },
229
322
  onSuccess: () => s.invalidateQueries({ queryKey: ["api-keys"] })
230
- }), f = (i, d) => {
231
- o(i), u(d);
232
- }, x = (i) => {
233
- a.trim() && j.mutate({
234
- consumerId: i,
323
+ }), m = (o, c) => {
324
+ r(o), l(c);
325
+ }, g = (o) => {
326
+ a.trim() && f.mutate({
327
+ consumerId: o,
235
328
  label: a.trim()
236
- }), o(null), u("");
237
- }, h = () => {
238
- o(null), u("");
329
+ }), r(null), l("");
330
+ }, P = () => {
331
+ r(null), l("");
239
332
  };
240
333
  return /* @__PURE__ */ e.jsxs("div", { className: "max-w-screen-md h-full pt-(--padding-content-top) pb-(--padding-content-bottom)", children: [
241
- /* @__PURE__ */ e.jsx(B.Target, { name: "api-keys-list-page" }),
334
+ /* @__PURE__ */ e.jsx(Y.Target, { name: "api-keys-list-page" }),
242
335
  /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between pb-3", children: [
243
- /* @__PURE__ */ e.jsx("h1", { className: "font-medium text-2xl", children: "API Keys" }),
244
- t.createKey && /* @__PURE__ */ e.jsx(g, { asChild: !0, children: /* @__PURE__ */ e.jsx(J, { to: "/settings/api-keys/new", children: "Create API Key" }) })
336
+ /* @__PURE__ */ e.jsxs("h1", { className: "font-medium text-2xl", children: [
337
+ "API Keys ",
338
+ typeof t.createKey
339
+ ] }),
340
+ t.createKey && /* @__PURE__ */ e.jsxs(
341
+ $,
342
+ {
343
+ open: d,
344
+ onOpenChange: C,
345
+ children: [
346
+ /* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsx(x, { variant: "outline", children: "Create API Key" }) }),
347
+ /* @__PURE__ */ e.jsxs(B, { children: [
348
+ /* @__PURE__ */ e.jsx(H, { children: /* @__PURE__ */ e.jsx(V, { children: "Create API Key" }) }),
349
+ /* @__PURE__ */ e.jsx(
350
+ it,
351
+ {
352
+ service: t,
353
+ onOpenChange: C
354
+ }
355
+ )
356
+ ] })
357
+ ]
358
+ }
359
+ )
245
360
  ] }),
246
361
  /* @__PURE__ */ e.jsx("p", { children: "Create, manage, and monitor your API keys" }),
247
- /* @__PURE__ */ e.jsx(B.Target, { name: "api-keys-list-page-before-keys" }),
362
+ /* @__PURE__ */ e.jsx(Y.Target, { name: "api-keys-list-page-before-keys" }),
248
363
  /* @__PURE__ */ e.jsx("div", { className: "h-8" }),
249
- c.isError && /* @__PURE__ */ e.jsxs(q, { variant: "destructive", className: "mb-4", children: [
250
- /* @__PURE__ */ e.jsx(M, { size: 16 }),
251
- /* @__PURE__ */ e.jsx(L, { children: c.error.message })
364
+ p.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
365
+ /* @__PURE__ */ e.jsx(F, { size: 16 }),
366
+ /* @__PURE__ */ e.jsx(M, { children: p.error.message })
252
367
  ] }),
253
- j.isError && /* @__PURE__ */ e.jsxs(q, { variant: "destructive", className: "mb-4", children: [
254
- /* @__PURE__ */ e.jsx(M, { size: 16 }),
255
- /* @__PURE__ */ e.jsx(L, { children: j.error.message })
368
+ f.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
369
+ /* @__PURE__ */ e.jsx(F, { size: 16 }),
370
+ /* @__PURE__ */ e.jsx(M, { children: f.error.message })
256
371
  ] }),
257
- l.isError && /* @__PURE__ */ e.jsxs(q, { variant: "destructive", className: "mb-4", children: [
258
- /* @__PURE__ */ e.jsx(M, { size: 16 }),
259
- /* @__PURE__ */ e.jsx(L, { children: l.error.message })
372
+ u.isError && /* @__PURE__ */ e.jsxs(O, { variant: "destructive", className: "mb-4", children: [
373
+ /* @__PURE__ */ e.jsx(F, { size: 16 }),
374
+ /* @__PURE__ */ e.jsx(M, { children: u.error.message })
260
375
  ] }),
261
- /* @__PURE__ */ e.jsx("div", { className: "", children: m.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: [
376
+ /* @__PURE__ */ e.jsx("div", { className: "", children: h.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: [
262
377
  /* @__PURE__ */ e.jsxs("p", { className: "text-center", children: [
263
378
  "You have no API keys yet.",
264
379
  /* @__PURE__ */ e.jsx("br", {}),
265
380
  t.createKey && "Get started and create your first key."
266
381
  ] }),
267
- t.createKey && /* @__PURE__ */ e.jsx(g, { asChild: !0, variant: "outline", children: /* @__PURE__ */ e.jsx(J, { to: "/settings/api-keys/new", children: "Create API Key" }) })
382
+ t.createKey && /* @__PURE__ */ e.jsx(x, { asChild: !0, variant: "outline", children: /* @__PURE__ */ e.jsx(be, { to: "/settings/api-keys/new", children: "Create API Key" }) })
268
383
  ] }) : /* @__PURE__ */ e.jsx(
269
384
  "ul",
270
385
  {
271
386
  className: N(
272
387
  "grid grid-cols-[1fr_min-content] divide-y divide-border col-span-6"
273
388
  ),
274
- children: m.map((i) => /* @__PURE__ */ e.jsxs(
275
- De,
389
+ children: h.map((o) => /* @__PURE__ */ e.jsxs(
390
+ Fe,
276
391
  {
277
392
  className: "grid grid-cols-subgrid col-span-full items-center mb-4 group",
278
393
  children: [
279
- /* @__PURE__ */ e.jsxs(Ie, { className: "border-b col-span-full grid-cols-subgrid grid", children: [
394
+ /* @__PURE__ */ e.jsxs(Le, { className: "border-b col-span-full grid-cols-subgrid grid", children: [
280
395
  /* @__PURE__ */ e.jsxs("div", { className: "h-10 flex flex-col text-sm justify-center", children: [
281
396
  /* @__PURE__ */ e.jsxs("div", { className: "font-medium text-lg flex items-center gap-2", children: [
282
- n === i.id ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
397
+ n === o.id ? /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 w-full", children: [
283
398
  /* @__PURE__ */ e.jsx(
284
- Ke,
399
+ ae,
285
400
  {
286
401
  maxLength: 32,
287
402
  value: a,
288
- onChange: (d) => u(d.target.value),
289
- onKeyDown: (d) => {
290
- d.key === "Enter" ? x(i.id) : d.key === "Escape" && h();
403
+ onChange: (c) => l(c.target.value),
404
+ onKeyDown: (c) => {
405
+ c.key === "Enter" ? g(o.id) : c.key === "Escape" && P();
291
406
  },
292
407
  className: "text-lg font-medium",
293
408
  autoFocus: !0
@@ -295,90 +410,90 @@ const _e = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
295
410
  ),
296
411
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
297
412
  /* @__PURE__ */ e.jsx(
298
- g,
413
+ x,
299
414
  {
300
415
  size: "icon",
301
416
  variant: "ghost",
302
- onClick: () => x(i.id),
417
+ onClick: () => g(o.id),
303
418
  disabled: !a.trim(),
304
- children: /* @__PURE__ */ e.jsx(W, { size: 16 })
419
+ children: /* @__PURE__ */ e.jsx(te, { size: 16 })
305
420
  }
306
421
  ),
307
422
  /* @__PURE__ */ e.jsx(
308
- g,
423
+ x,
309
424
  {
310
425
  size: "icon",
311
426
  variant: "ghost",
312
- onClick: h,
313
- children: /* @__PURE__ */ e.jsx(oe, { size: 16 })
427
+ onClick: P,
428
+ children: /* @__PURE__ */ e.jsx(ue, { size: 16 })
314
429
  }
315
430
  )
316
431
  ] })
317
- ] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: i.label }),
318
- /* @__PURE__ */ e.jsx("div", { className: "text-muted-foreground text-xs", children: i.createdOn })
432
+ ] }) : /* @__PURE__ */ e.jsx(e.Fragment, { children: o.label }),
433
+ /* @__PURE__ */ e.jsx("div", { className: "text-muted-foreground text-xs", children: o.createdOn })
319
434
  ] }),
320
435
  /* @__PURE__ */ e.jsxs("div", { className: "text-muted-foreground text-xs", children: [
321
- i.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
436
+ o.createdOn && /* @__PURE__ */ e.jsxs("div", { children: [
322
437
  "Created on",
323
438
  " ",
324
- new Date(i.createdOn).toLocaleDateString()
439
+ new Date(o.createdOn).toLocaleDateString()
325
440
  ] }),
326
- i.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
441
+ o.expiresOn && /* @__PURE__ */ e.jsxs("div", { children: [
327
442
  "Expires on",
328
443
  " ",
329
- new Date(i.expiresOn).toLocaleDateString()
444
+ new Date(o.expiresOn).toLocaleDateString()
330
445
  ] })
331
446
  ] })
332
447
  ] }),
333
448
  /* @__PURE__ */ e.jsxs("div", { className: "flex justify-end", children: [
334
449
  t.updateConsumer && /* @__PURE__ */ e.jsxs(
335
- g,
450
+ x,
336
451
  {
337
452
  variant: "ghost",
338
- onClick: () => f(i.id, i.label),
453
+ onClick: () => m(o.id, o.label),
339
454
  className: N(
340
455
  "flex gap-2",
341
- n === i.id && "opacity-0! pointer-events-none"
456
+ n === o.id && "opacity-0! pointer-events-none"
342
457
  ),
343
- disabled: n === i.id,
458
+ disabled: n === o.id,
344
459
  children: [
345
- /* @__PURE__ */ e.jsx(le, { size: 16 }),
460
+ /* @__PURE__ */ e.jsx(he, { size: 16 }),
346
461
  /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Edit label" })
347
462
  ]
348
463
  }
349
464
  ),
350
- t.rollKey && /* @__PURE__ */ e.jsxs(Y, { children: [
351
- /* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
352
- g,
465
+ t.rollKey && /* @__PURE__ */ e.jsxs($, { children: [
466
+ /* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
467
+ x,
353
468
  {
354
469
  title: "Roll this key",
355
470
  variant: "ghost",
356
- disabled: c.isPending,
471
+ disabled: p.isPending,
357
472
  className: "flex items-center gap-2",
358
473
  children: [
359
474
  /* @__PURE__ */ e.jsx(
360
- ce,
475
+ fe,
361
476
  {
362
477
  size: 16,
363
- className: c.isPending ? "animate-spin" : void 0
478
+ className: p.isPending ? "animate-spin" : void 0
364
479
  }
365
480
  ),
366
481
  /* @__PURE__ */ e.jsx("span", { className: "hidden md:block", children: "Roll key" })
367
482
  ]
368
483
  }
369
484
  ) }),
370
- /* @__PURE__ */ e.jsxs(V, { children: [
371
- /* @__PURE__ */ e.jsxs(Z, { children: [
372
- /* @__PURE__ */ e.jsx(ee, { children: "Roll API Key" }),
373
- /* @__PURE__ */ e.jsx(te, { children: "Are you sure you want to roll this API key?" })
485
+ /* @__PURE__ */ e.jsxs(B, { children: [
486
+ /* @__PURE__ */ e.jsxs(H, { children: [
487
+ /* @__PURE__ */ e.jsx(V, { children: "Roll API Key" }),
488
+ /* @__PURE__ */ e.jsx(re, { children: "Are you sure you want to roll this API key?" })
374
489
  ] }),
375
- /* @__PURE__ */ e.jsxs(se, { children: [
376
- /* @__PURE__ */ e.jsx(T, { asChild: !0, children: /* @__PURE__ */ e.jsx(g, { variant: "outline", children: "Cancel" }) }),
377
- /* @__PURE__ */ e.jsx(T, { asChild: !0, children: /* @__PURE__ */ e.jsx(
378
- g,
490
+ /* @__PURE__ */ e.jsxs(W, { children: [
491
+ /* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(x, { variant: "outline", children: "Cancel" }) }),
492
+ /* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(
493
+ x,
379
494
  {
380
495
  onClick: () => {
381
- c.mutate(i.id);
496
+ p.mutate(o.id);
382
497
  },
383
498
  children: "Roll Key"
384
499
  }
@@ -388,40 +503,40 @@ const _e = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
388
503
  ] })
389
504
  ] })
390
505
  ] }),
391
- /* @__PURE__ */ e.jsx("div", { className: "col-span-full grid-cols-subgrid grid", children: /* @__PURE__ */ e.jsx(_e, { children: i.apiKeys.map((d) => /* @__PURE__ */ e.jsxs(ve.Fragment, { children: [
506
+ /* @__PURE__ */ e.jsx("div", { className: "col-span-full grid-cols-subgrid grid", children: /* @__PURE__ */ e.jsx(nt, { children: o.apiKeys.map((c) => /* @__PURE__ */ e.jsxs(Re.Fragment, { children: [
392
507
  /* @__PURE__ */ e.jsx(
393
- Ue,
508
+ lt,
394
509
  {
395
- apiKey: d,
510
+ apiKey: c,
396
511
  onDeleteKey: () => {
397
- l.mutate({
398
- consumerId: i.id,
399
- keyId: d.id
512
+ u.mutate({
513
+ consumerId: o.id,
514
+ keyId: c.id
400
515
  });
401
516
  },
402
- className: l.variables?.keyId === d.id && (l.isPending || C) ? "opacity-10!" : void 0
517
+ className: u.variables?.keyId === c.id && (u.isPending || y) ? "opacity-10!" : void 0
403
518
  }
404
519
  ),
405
520
  /* @__PURE__ */ e.jsx("div", { className: "col-span-full h-px bg-border" })
406
- ] }, d.id)) }) })
521
+ ] }, c.id)) }) })
407
522
  ]
408
523
  },
409
- i.id
524
+ o.id
410
525
  ))
411
526
  }
412
527
  ) })
413
528
  ] });
414
- }, Je = (t) => {
415
- const r = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((r.getTime() - s.getTime()) / 1e3), o = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
416
- return n < 60 ? o.format(-n, "second") : n < 3600 ? o.format(-Math.floor(n / 60), "minute") : n < 86400 ? o.format(-Math.floor(n / 3600), "hour") : n < 2592e3 ? o.format(-Math.floor(n / 86400), "day") : n < 31536e3 ? o.format(-Math.floor(n / 2592e3), "month") : o.format(-Math.floor(n / 31536e3), "year");
417
- }, Ue = ({
529
+ }, ot = (t) => {
530
+ const i = /* @__PURE__ */ new Date(), s = new Date(t), n = Math.floor((i.getTime() - s.getTime()) / 1e3), r = new Intl.RelativeTimeFormat("en", { numeric: "auto" });
531
+ 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");
532
+ }, lt = ({
418
533
  apiKey: t,
419
- onDeleteKey: r,
534
+ onDeleteKey: i,
420
535
  className: s
421
536
  }) => {
422
- const [n, o] = D(!1), [a, u] = Ae(), { key: m, createdOn: C, expiresOn: l } = t, j = l && new Date(l) < /* @__PURE__ */ new Date(), c = l ? Math.ceil(
423
- (new Date(l).getTime() - (/* @__PURE__ */ new Date()).getTime()) / (1e3 * 60 * 60 * 24)
424
- ) : 1 / 0, f = c <= 7 && !j;
537
+ const [n, r] = K(!1), [a, l] = $e(), { key: h, createdOn: y, expiresOn: d } = t, C = d && new Date(d) < /* @__PURE__ */ new Date(), u = d ? Math.ceil(
538
+ (new Date(d).getTime() - (/* @__PURE__ */ new Date()).getTime()) / (1e3 * 60 * 60 * 24)
539
+ ) : 1 / 0, f = u <= 7 && !C;
425
540
  return /* @__PURE__ */ e.jsxs("div", { className: N("grid col-span-full grid-cols-subgrid p-6", s), children: [
426
541
  /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col gap-1", children: [
427
542
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2 items-center text-sm border rounded-md w-full max-w-fit px-1", children: [
@@ -431,7 +546,7 @@ const _e = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
431
546
  {
432
547
  className: N(
433
548
  "rounded-full w-2 h-2 bg-emerald-400 mr-2",
434
- (f || j) && "bg-neutral-200"
549
+ (f || C) && "bg-neutral-200"
435
550
  )
436
551
  }
437
552
  ),
@@ -443,66 +558,66 @@ const _e = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
443
558
  "w-40 inline-block md:w-full truncate",
444
559
  n ? "" : "opacity-20"
445
560
  ),
446
- children: n ? m.slice(0, -5) : "**** ".repeat(m.slice(0, -5).length / 5) + "*".repeat(m.slice(0, -5).length % 5)
561
+ children: n ? h.slice(0, -5) : "**** ".repeat(h.slice(0, -5).length / 5) + "*".repeat(h.slice(0, -5).length % 5)
447
562
  }
448
563
  ),
449
- /* @__PURE__ */ e.jsx("span", { children: m.slice(-5) })
564
+ /* @__PURE__ */ e.jsx("span", { children: h.slice(-5) })
450
565
  ] })
451
566
  ] }),
452
567
  /* @__PURE__ */ e.jsx(
453
- g,
568
+ x,
454
569
  {
455
570
  variant: "ghost",
456
- onClick: () => o((x) => !x),
571
+ onClick: () => r((p) => !p),
457
572
  size: "icon",
458
- children: n ? /* @__PURE__ */ e.jsx(de, { size: 16 }) : /* @__PURE__ */ e.jsx(ue, { size: 16 })
573
+ children: n ? /* @__PURE__ */ e.jsx(pe, { size: 16 }) : /* @__PURE__ */ e.jsx(me, { size: 16 })
459
574
  }
460
575
  ),
461
576
  /* @__PURE__ */ e.jsx(
462
- g,
577
+ x,
463
578
  {
464
579
  variant: "ghost",
465
- onClick: () => u(m),
580
+ onClick: () => l(h),
466
581
  size: "icon",
467
- children: a ? /* @__PURE__ */ e.jsx(W, { size: 16 }) : /* @__PURE__ */ e.jsx(he, { size: 16 })
582
+ children: a ? /* @__PURE__ */ e.jsx(te, { size: 16 }) : /* @__PURE__ */ e.jsx(xe, { size: 16 })
468
583
  }
469
584
  )
470
585
  ] }),
471
586
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-1 mt-0.5 text-nowrap", children: [
472
- C && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
587
+ y && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-muted-foreground", children: [
473
588
  "Created ",
474
- Je(C),
589
+ ot(y),
475
590
  "."
476
591
  ] }),
477
592
  " ",
478
- l && f && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
593
+ d && f && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
479
594
  "Expires in ",
480
- c,
595
+ u,
481
596
  " ",
482
- c === 1 ? "day" : "days",
597
+ u === 1 ? "day" : "days",
483
598
  "."
484
599
  ] }),
485
- l && j && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
600
+ d && C && /* @__PURE__ */ e.jsxs("span", { className: "text-xs text-primary", children: [
486
601
  "Expired",
487
602
  " ",
488
- c === 0 ? "today." : `${c * -1} days ago.`
603
+ u === 0 ? "today." : `${u * -1} days ago.`
489
604
  ] })
490
605
  ] })
491
606
  ] }),
492
- /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: l && r && /* @__PURE__ */ e.jsxs(Y, { children: [
493
- /* @__PURE__ */ e.jsx(G, { asChild: !0, children: /* @__PURE__ */ e.jsx(g, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(fe, { size: 16 }) }) }),
494
- /* @__PURE__ */ e.jsxs(V, { children: [
495
- /* @__PURE__ */ e.jsxs(Z, { children: [
496
- /* @__PURE__ */ e.jsx(ee, { children: "Delete API Key" }),
497
- /* @__PURE__ */ e.jsx(te, { children: "Are you sure you want to delete this API key?" })
607
+ /* @__PURE__ */ e.jsx("div", { className: "flex justify-end", children: d && i && /* @__PURE__ */ e.jsxs($, { children: [
608
+ /* @__PURE__ */ e.jsx(Q, { asChild: !0, children: /* @__PURE__ */ e.jsx(x, { variant: "ghost", size: "icon", children: /* @__PURE__ */ e.jsx(ye, { size: 16 }) }) }),
609
+ /* @__PURE__ */ e.jsxs(B, { children: [
610
+ /* @__PURE__ */ e.jsxs(H, { children: [
611
+ /* @__PURE__ */ e.jsx(V, { children: "Delete API Key" }),
612
+ /* @__PURE__ */ e.jsx(re, { children: "Are you sure you want to delete this API key?" })
498
613
  ] }),
499
- /* @__PURE__ */ e.jsxs(se, { children: [
500
- /* @__PURE__ */ e.jsx(T, { asChild: !0, children: /* @__PURE__ */ e.jsx(g, { variant: "outline", children: "Cancel" }) }),
501
- /* @__PURE__ */ e.jsx(T, { asChild: !0, children: /* @__PURE__ */ e.jsx(
502
- g,
614
+ /* @__PURE__ */ e.jsxs(W, { children: [
615
+ /* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(x, { variant: "outline", children: "Cancel" }) }),
616
+ /* @__PURE__ */ e.jsx(I, { asChild: !0, children: /* @__PURE__ */ e.jsx(
617
+ x,
503
618
  {
504
619
  onClick: () => {
505
- r();
620
+ i();
506
621
  },
507
622
  children: "Delete"
508
623
  }
@@ -511,55 +626,55 @@ const _e = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
511
626
  ] })
512
627
  ] }) })
513
628
  ] });
514
- }, A = "https://api.zuploedge.com/v2/client", We = async (t) => {
629
+ }, S = "https://api.zuploedge.com/v2/client", ct = async (t) => {
515
630
  try {
516
631
  return await t.json();
517
632
  } catch {
518
633
  return;
519
634
  }
520
- }, R = async (t) => {
521
- const r = t.headers.get("content-type");
522
- if (!t.ok && r?.includes("application/problem+json")) {
523
- const s = await We(t);
635
+ }, T = async (t) => {
636
+ const i = t.headers.get("content-type");
637
+ if (!t.ok && i?.includes("application/problem+json")) {
638
+ const s = await ct(t);
524
639
  if (s.type && s.title)
525
640
  throw new Error(s.detail ?? s.title);
526
641
  }
527
- }, Xe = (t) => ({
528
- deleteKey: async (r, s, n) => {
529
- const o = new Request(
530
- A + `/${t}/consumers/${r}/keys/${s}`,
642
+ }, dt = (t, i) => ({
643
+ deleteKey: async (s, n, r) => {
644
+ const a = new Request(
645
+ S + `/${t}/consumers/${s}/keys/${n}`,
531
646
  {
532
647
  method: "DELETE"
533
648
  }
534
649
  );
535
- await n.signRequest(o);
536
- const a = await fetch(o);
537
- await R(a), I(a.ok, "Failed to delete API key");
650
+ await r.signRequest(a);
651
+ const l = await fetch(a);
652
+ await T(l), A(l.ok, "Failed to delete API key");
538
653
  },
539
- updateConsumer: async (r, s) => {
540
- const n = await fetch(
541
- await s.signRequest(
654
+ updateConsumer: async (s, n) => {
655
+ const r = await fetch(
656
+ await n.signRequest(
542
657
  new Request(
543
- A + `/${t}/consumers/${r.id}`,
658
+ S + `/${t}/consumers/${s.id}`,
544
659
  {
545
660
  method: "PATCH",
546
661
  headers: {
547
662
  "Content-Type": "application/json"
548
663
  },
549
664
  body: JSON.stringify({
550
- label: r.label
665
+ label: s.label
551
666
  })
552
667
  }
553
668
  )
554
669
  )
555
670
  );
556
- await R(n), I(n.ok, "Failed to update API key description");
671
+ await T(r), A(r.ok, "Failed to update API key description");
557
672
  },
558
- rollKey: async (r, s) => {
559
- const n = await fetch(
560
- await s.signRequest(
673
+ rollKey: async (s, n) => {
674
+ const r = await fetch(
675
+ await n.signRequest(
561
676
  new Request(
562
- A + `/${t}/consumers/${r}/roll-key`,
677
+ S + `/${t}/consumers/${s}/roll-key`,
563
678
  {
564
679
  method: "POST",
565
680
  headers: {
@@ -570,41 +685,42 @@ const _e = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
570
685
  )
571
686
  )
572
687
  );
573
- await R(n), I(n.ok, "Failed to delete API key");
688
+ await T(r), A(r.ok, "Failed to delete API key");
574
689
  },
575
- getConsumers: async (r) => {
576
- const s = new Request(
577
- A + `/${t}/consumers`
690
+ getConsumers: async (s) => {
691
+ const n = new Request(
692
+ S + `/${t}/consumers`
578
693
  );
579
- await r.signRequest(s);
580
- const n = await fetch(s);
581
- return await R(n), I(n.ok, "Failed to fetch API keys"), (await n.json()).data.map((a) => ({
582
- id: a.id,
583
- label: a.label || a.subject || "API Key",
584
- apiKeys: a.apiKeys.data,
585
- key: a.apiKeys.data.at(0)
694
+ await s.signRequest(n);
695
+ const r = await fetch(n);
696
+ return await T(r), A(r.ok, "Failed to fetch API keys"), (await r.json()).data.map((l) => ({
697
+ id: l.id,
698
+ label: l.label || l.subject || "API Key",
699
+ apiKeys: l.apiKeys.data,
700
+ key: l.apiKeys.data.at(0)
586
701
  }));
587
- }
588
- }), dt = (t) => t, ut = (t) => {
589
- const r = "deploymentName" in t ? Xe(t.deploymentName) : t;
702
+ },
703
+ ...i
704
+ }), It = (t) => t, Pt = (t) => {
705
+ const i = "deploymentName" in t ? dt(t.deploymentName, t) : t;
590
706
  return {
591
707
  getProfileMenuItems: () => [
592
708
  {
593
709
  label: "API Keys",
594
710
  path: "/settings/api-keys",
595
711
  category: "middle",
596
- icon: pe
712
+ icon: ge
597
713
  }
598
714
  ],
599
715
  getIdentities: async (s) => {
600
716
  try {
601
- return (await r.getConsumers(s)).map((o) => ({
717
+ return (await i.getConsumers(s)).map((r) => ({
602
718
  authorizeRequest: (a) => (a.headers.set(
603
719
  "Authorization",
604
- `Bearer ${o.apiKeys.at(0)?.key}`
720
+ `Bearer ${r.apiKeys.at(0)?.key}`
605
721
  ), a),
606
- id: o.id,
607
- label: o.label
722
+ id: r.id,
723
+ label: r.label
608
724
  }));
609
725
  } catch {
610
726
  return [];
@@ -612,24 +728,20 @@ const _e = ({ children: t, custom: r, initial: s = !0, onExitComplete: n, presen
612
728
  },
613
729
  getRoutes: () => [
614
730
  {
615
- element: /* @__PURE__ */ e.jsx(Re, {}),
616
- errorElement: /* @__PURE__ */ e.jsx(xe, {}),
731
+ element: /* @__PURE__ */ e.jsx(Ve, {}),
732
+ errorElement: /* @__PURE__ */ e.jsx(Ce, {}),
617
733
  children: [
618
734
  {
619
735
  path: "/settings/api-keys",
620
- element: /* @__PURE__ */ e.jsx(Be, { service: r })
736
+ element: /* @__PURE__ */ e.jsx(at, { service: i })
621
737
  }
622
- // {
623
- // path: "/settings/api-keys/new",
624
- // element: <CreateApiKey service={service} />,
625
- // },
626
738
  ]
627
739
  }
628
740
  ]
629
741
  };
630
742
  };
631
743
  export {
632
- ut as apiKeyPlugin,
633
- dt as createApiKeyService
744
+ Pt as apiKeyPlugin,
745
+ It as createApiKeyService
634
746
  };
635
747
  //# sourceMappingURL=zudoku.plugin-api-keys.js.map