zudoku 0.64.1 → 0.64.2
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.
- package/dist/config/config.d.ts +15 -46
- package/dist/config/validators/InputNavigationSchema.d.ts +53 -53
- package/dist/config/validators/ProtectedRoutesSchema.d.ts +1 -1
- package/dist/config/validators/validate.d.ts +105 -1
- package/dist/config/validators/validate.js +30 -0
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/flat-config.d.ts +16 -0
- package/dist/lib/auth/issuer.js +3 -0
- package/dist/lib/auth/issuer.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +1 -1
- package/dist/lib/authentication/providers/firebase.d.ts +4 -0
- package/dist/lib/authentication/providers/firebase.js +215 -0
- package/dist/lib/authentication/providers/firebase.js.map +1 -0
- package/dist/lib/authentication/providers/supabase.js +1 -6
- package/dist/lib/authentication/providers/supabase.js.map +1 -1
- package/dist/lib/authentication/ui/ZudokuAuthUi.d.ts +24 -0
- package/dist/lib/authentication/ui/ZudokuAuthUi.js +124 -0
- package/dist/lib/authentication/ui/ZudokuAuthUi.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Apple.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Apple.js +4 -0
- package/dist/lib/authentication/ui/icons/Apple.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Facebook.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Facebook.js +4 -0
- package/dist/lib/authentication/ui/icons/Facebook.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Github.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Github.js +4 -0
- package/dist/lib/authentication/ui/icons/Github.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Google.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Google.js +4 -0
- package/dist/lib/authentication/ui/icons/Google.js.map +1 -0
- package/dist/lib/authentication/ui/icons/Microsoft.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/Microsoft.js +4 -0
- package/dist/lib/authentication/ui/icons/Microsoft.js.map +1 -0
- package/dist/lib/authentication/ui/icons/X.d.ts +3 -0
- package/dist/lib/authentication/ui/icons/X.js +4 -0
- package/dist/lib/authentication/ui/icons/X.js.map +1 -0
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/core/RouteGuard.js +6 -6
- package/dist/lib/core/RouteGuard.js.map +1 -1
- package/dist/lib/oas/parser/index.js +7 -3
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/ProtectedRoute.js +4 -1
- package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -1
- package/dist/lib/plugins/openapi/CollapsibleCode.d.ts +1 -0
- package/dist/lib/plugins/openapi/CollapsibleCode.js +2 -1
- package/dist/lib/plugins/openapi/CollapsibleCode.js.map +1 -1
- package/dist/lib/plugins/openapi/GeneratedExampleSidecarBox.d.ts +5 -0
- package/dist/lib/plugins/openapi/GeneratedExampleSidecarBox.js +10 -0
- package/dist/lib/plugins/openapi/GeneratedExampleSidecarBox.js.map +1 -0
- package/dist/lib/plugins/openapi/OperationList.js +4 -1
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.d.ts +2 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +2 -2
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.d.ts +9 -2
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +2 -2
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.d.ts +3 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +14 -2
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.d.ts +2 -1
- package/dist/lib/plugins/openapi/Sidecar.js +33 -30
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/SidecarExamples.d.ts +9 -2
- package/dist/lib/plugins/openapi/SidecarExamples.js +15 -33
- package/dist/lib/plugins/openapi/SidecarExamples.js.map +1 -1
- package/dist/lib/plugins/openapi/components/NonHighlightedCode.d.ts +4 -0
- package/dist/lib/plugins/openapi/components/NonHighlightedCode.js +5 -0
- package/dist/lib/plugins/openapi/components/NonHighlightedCode.js.map +1 -0
- package/dist/lib/plugins/openapi/components/ResponseContent.js +1 -1
- package/dist/lib/plugins/openapi/components/ResponseContent.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/InlineInput.d.ts +1 -1
- package/dist/lib/plugins/openapi/playground/ParamsGrid.d.ts +2 -2
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +1 -2
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js +0 -4
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/union-helpers.js +0 -1
- package/dist/lib/plugins/openapi/schema/union-helpers.js.map +1 -1
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js +5 -14
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -1
- package/dist/lib/ui/CodeBlock.d.ts +0 -1
- package/dist/lib/ui/CodeBlock.js.map +1 -1
- package/dist/lib/ui/Command.d.ts +3 -3
- package/dist/lib/ui/EmbeddedCodeBlock.d.ts +0 -1
- package/dist/lib/ui/EmbeddedCodeBlock.js +1 -1
- package/dist/lib/ui/EmbeddedCodeBlock.js.map +1 -1
- package/dist/lib/ui/Separator.d.ts +4 -0
- package/dist/lib/ui/Separator.js +8 -0
- package/dist/lib/ui/Separator.js.map +1 -0
- package/dist/lib/ui/Tooltip.d.ts +7 -7
- package/dist/lib/ui/Tooltip.js +16 -10
- package/dist/lib/ui/Tooltip.js.map +1 -1
- package/dist/lib/util/createVariantComponent.d.ts +5 -2
- package/dist/lib/util/createVariantComponent.js +5 -2
- package/dist/lib/util/createVariantComponent.js.map +1 -1
- package/dist/lib/util/flattenAllOf.d.ts +4 -0
- package/dist/lib/util/flattenAllOf.js +65 -0
- package/dist/lib/util/flattenAllOf.js.map +1 -0
- package/dist/lib/util/flattenAllOf.test.d.ts +1 -0
- package/dist/lib/util/flattenAllOf.test.js +532 -0
- package/dist/lib/util/flattenAllOf.test.js.map +1 -0
- package/dist/vite/api/SchemaManager.js +6 -18
- package/dist/vite/api/SchemaManager.js.map +1 -1
- package/dist/vite/plugin-theme.js +10 -1
- package/dist/vite/plugin-theme.js.map +1 -1
- package/lib/{ErrorAlert-DE3Sf66a.js → ErrorAlert--3alJ_-b.js} +1340 -1311
- package/lib/{ErrorAlert-DE3Sf66a.js.map → ErrorAlert--3alJ_-b.js.map} +1 -1
- package/lib/{MdxPage-DZfeC0QY.js → MdxPage-Bpa9tL63.js} +5 -5
- package/lib/{MdxPage-DZfeC0QY.js.map → MdxPage-Bpa9tL63.js.map} +1 -1
- package/lib/{OAuthErrorPage-BycMozgn.js → OAuthErrorPage-B79J86Fo.js} +4 -4
- package/lib/{OAuthErrorPage-BycMozgn.js.map → OAuthErrorPage-B79J86Fo.js.map} +1 -1
- package/lib/{OasProvider-1XEOsIiW.js → OasProvider-jr0oDSFy.js} +2 -2
- package/lib/{OasProvider-1XEOsIiW.js.map → OasProvider-jr0oDSFy.js.map} +1 -1
- package/lib/OperationList-DLEAg4qw.js +5465 -0
- package/lib/OperationList-DLEAg4qw.js.map +1 -0
- package/lib/{Pagination-CJszmeSA.js → Pagination-H2HW9-Er.js} +2 -2
- package/lib/{Pagination-CJszmeSA.js.map → Pagination-H2HW9-Er.js.map} +1 -1
- package/lib/RouteGuard-CjzxosTf.js +77 -0
- package/lib/RouteGuard-CjzxosTf.js.map +1 -0
- package/lib/{RouterError-VDLnrFqF.js → RouterError-DZS2d6Sc.js} +2 -2
- package/lib/{RouterError-VDLnrFqF.js.map → RouterError-DZS2d6Sc.js.map} +1 -1
- package/lib/{SchemaList-qOHkDzSz.js → SchemaList-CSDSazqV.js} +6 -6
- package/lib/{SchemaList-qOHkDzSz.js.map → SchemaList-CSDSazqV.js.map} +1 -1
- package/lib/SchemaView-DJiBd0_5.js +397 -0
- package/lib/SchemaView-DJiBd0_5.js.map +1 -0
- package/lib/{SignUp-6SGx9Yyq.js → SignUp-Fycafbyg.js} +2 -2
- package/lib/{SignUp-6SGx9Yyq.js.map → SignUp-Fycafbyg.js.map} +1 -1
- package/lib/{SyntaxHighlight-zvlnSnHB.js → SyntaxHighlight-C19vH0V_.js} +525 -509
- package/lib/SyntaxHighlight-C19vH0V_.js.map +1 -0
- package/lib/{Toc-Da9yp7lo.js → Toc-ChkOg2UU.js} +2 -2
- package/lib/{Toc-Da9yp7lo.js.map → Toc-ChkOg2UU.js.map} +1 -1
- package/lib/{circular-CSSuz-LS.js → circular-DGfd8SGc.js} +2 -2
- package/lib/{circular-CSSuz-LS.js.map → circular-DGfd8SGc.js.map} +1 -1
- package/lib/{createServer-CLbcVLbK.js → createServer-DGD8hEzT.js} +4662 -4238
- package/lib/createServer-DGD8hEzT.js.map +1 -0
- package/lib/{errors-CuGgh3hf.js → errors-BTpjwHS6.js} +2 -2
- package/lib/{errors-CuGgh3hf.js.map → errors-BTpjwHS6.js.map} +1 -1
- package/lib/{index-rYHsvtTo.js → index-Bvas0H4x.js} +2 -2
- package/lib/{index-rYHsvtTo.js.map → index-Bvas0H4x.js.map} +1 -1
- package/lib/{index-RNAxx6IF.js → index-DP1xZgfJ.js} +9 -9
- package/lib/index-DP1xZgfJ.js.map +1 -0
- package/lib/{index-B1rmok4X.js → index-FNRZUtwo.js} +2 -2
- package/lib/{index-B1rmok4X.js.map → index-FNRZUtwo.js.map} +1 -1
- package/lib/ui/CodeBlock.js.map +1 -1
- package/lib/ui/EmbeddedCodeBlock.js +9 -9
- package/lib/ui/EmbeddedCodeBlock.js.map +1 -1
- package/lib/ui/Separator.js +27 -0
- package/lib/ui/Separator.js.map +1 -0
- package/lib/ui/SyntaxHighlight.js +1 -1
- package/lib/ui/Tooltip.js +55 -28
- package/lib/ui/Tooltip.js.map +1 -1
- package/lib/zudoku.__internal.js +4 -4
- package/lib/zudoku.auth-azureb2c.js +3 -3
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-openid.js +3 -3
- package/lib/zudoku.auth-supabase.js +30 -33
- package/lib/zudoku.auth-supabase.js.map +1 -1
- package/lib/zudoku.components.js +2 -2
- package/lib/zudoku.plugin-api-catalog.js +3 -3
- package/lib/zudoku.plugin-api-keys.js +3 -3
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +1 -1
- package/package.json +15 -10
- package/src/app/main.css +1 -1
- package/src/lib/auth/issuer.ts +3 -0
- package/src/lib/authentication/authentication.ts +1 -1
- package/src/lib/authentication/providers/firebase.tsx +284 -0
- package/src/lib/authentication/providers/supabase.tsx +2 -7
- package/src/lib/authentication/ui/ZudokuAuthUi.tsx +335 -0
- package/src/lib/authentication/ui/icons/Apple.tsx +10 -0
- package/src/lib/authentication/ui/icons/Facebook.tsx +15 -0
- package/src/lib/authentication/ui/icons/Github.tsx +16 -0
- package/src/lib/authentication/ui/icons/Google.tsx +16 -0
- package/src/lib/authentication/ui/icons/Microsoft.tsx +12 -0
- package/src/lib/authentication/ui/icons/X.tsx +10 -0
- package/src/lib/core/RouteGuard.tsx +8 -8
- package/src/lib/oas/parser/index.ts +8 -3
- package/src/lib/plugins/api-keys/ProtectedRoute.tsx +11 -7
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +5 -3
- package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +52 -0
- package/src/lib/plugins/openapi/OperationList.tsx +5 -0
- package/src/lib/plugins/openapi/OperationListItem.tsx +3 -0
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +20 -2
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +26 -1
- package/src/lib/plugins/openapi/Sidecar.tsx +84 -63
- package/src/lib/plugins/openapi/SidecarExamples.tsx +38 -48
- package/src/lib/plugins/openapi/components/NonHighlightedCode.tsx +22 -0
- package/src/lib/plugins/openapi/components/ResponseContent.tsx +1 -1
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +1 -4
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +0 -5
- package/src/lib/plugins/openapi/schema/union-helpers.ts +0 -1
- package/src/lib/plugins/openapi/util/generateSchemaExample.ts +5 -15
- package/src/lib/ui/CodeBlock.tsx +0 -1
- package/src/lib/ui/EmbeddedCodeBlock.tsx +1 -2
- package/src/lib/ui/Separator.tsx +25 -0
- package/src/lib/ui/Tooltip.tsx +54 -32
- package/src/lib/util/createVariantComponent.tsx +31 -5
- package/src/lib/util/flattenAllOf.test.ts +637 -0
- package/src/lib/util/flattenAllOf.ts +101 -0
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupConnector.d.ts +0 -5
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupConnector.js +0 -7
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupConnector.js.map +0 -1
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupItem.d.ts +0 -4
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupItem.js +0 -10
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupItem.js.map +0 -1
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupView.d.ts +0 -5
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupView.js +0 -16
- package/dist/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupView.js.map +0 -1
- package/lib/OperationList-DCJw6wXL.js +0 -5450
- package/lib/OperationList-DCJw6wXL.js.map +0 -1
- package/lib/RouteGuard-DhU3LRr1.js +0 -81
- package/lib/RouteGuard-DhU3LRr1.js.map +0 -1
- package/lib/SchemaView-D3hm65cc.js +0 -458
- package/lib/SchemaView-D3hm65cc.js.map +0 -1
- package/lib/SyntaxHighlight-zvlnSnHB.js.map +0 -1
- package/lib/createServer-CLbcVLbK.js.map +0 -1
- package/lib/index-RNAxx6IF.js.map +0 -1
- package/src/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupConnector.tsx +0 -36
- package/src/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupItem.tsx +0 -25
- package/src/lib/plugins/openapi/schema/AllOfGroup/AllOfGroupView.tsx +0 -42
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { j as t } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
-
import { H as m } from "./index.esm-BnYHxCYC.js";
|
|
3
|
-
import { createContext as p, use as f } from "react";
|
|
4
|
-
import { u as g, d as x, m as j, O as v } from "./chunk-PVWAREVJ-BMhpCH5D.js";
|
|
5
|
-
import { B as s } from "./Button-DmS4u8Lj.js";
|
|
6
|
-
import { D as C, a as R, b as D, c as w, d as T, e as b } from "./Dialog-BQciPiHN.js";
|
|
7
|
-
import { u as k } from "./hook-CMeoxziF.js";
|
|
8
|
-
import { a as E } from "./ZudokuContext-BUZ5hkWB.js";
|
|
9
|
-
import { Z as P } from "./invariant-Bm-FVUQE.js";
|
|
10
|
-
import { u as y } from "./useLatest-hmRS46UF.js";
|
|
11
|
-
const O = p(!1), A = "protected", G = () => {
|
|
12
|
-
const n = k(), e = E(), o = g(), a = x(), r = y(a.pathname), c = f(O), { protectedRoutes: d } = e.options, u = !c && d ? Object.entries(d).find(
|
|
13
|
-
([i]) => j({ path: i, end: !0 }, a.pathname)
|
|
14
|
-
)?.[1] : void 0, l = u !== void 0, h = l && !u({ auth: n, context: e });
|
|
15
|
-
if (h && n.isPending && typeof window < "u")
|
|
16
|
-
return null;
|
|
17
|
-
if (h)
|
|
18
|
-
return /* @__PURE__ */ t.jsx(
|
|
19
|
-
C,
|
|
20
|
-
{
|
|
21
|
-
open: !0,
|
|
22
|
-
onOpenChange: (i) => {
|
|
23
|
-
i || o(-1);
|
|
24
|
-
},
|
|
25
|
-
children: /* @__PURE__ */ t.jsxs(R, { children: [
|
|
26
|
-
/* @__PURE__ */ t.jsx(D, { children: /* @__PURE__ */ t.jsx(w, { children: "Login to continue" }) }),
|
|
27
|
-
/* @__PURE__ */ t.jsx(T, { children: "Please wait while we log you in." }),
|
|
28
|
-
/* @__PURE__ */ t.jsxs(b, { children: [
|
|
29
|
-
/* @__PURE__ */ t.jsx(s, { variant: "outline", onClick: () => void o(-1), children: "Cancel" }),
|
|
30
|
-
/* @__PURE__ */ t.jsx("div", { className: "w-full" }),
|
|
31
|
-
/* @__PURE__ */ t.jsx(
|
|
32
|
-
s,
|
|
33
|
-
{
|
|
34
|
-
variant: "secondary",
|
|
35
|
-
onClick: () => void e.authentication?.signUp(
|
|
36
|
-
{ navigate: o },
|
|
37
|
-
{ redirectTo: r.current }
|
|
38
|
-
),
|
|
39
|
-
children: "Register"
|
|
40
|
-
}
|
|
41
|
-
),
|
|
42
|
-
/* @__PURE__ */ t.jsxs(
|
|
43
|
-
s,
|
|
44
|
-
{
|
|
45
|
-
onClick: () => void e.authentication?.signIn(
|
|
46
|
-
{ navigate: o },
|
|
47
|
-
{ redirectTo: r.current }
|
|
48
|
-
),
|
|
49
|
-
children: [
|
|
50
|
-
"Login",
|
|
51
|
-
" "
|
|
52
|
-
]
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
] })
|
|
56
|
-
] })
|
|
57
|
-
}
|
|
58
|
-
);
|
|
59
|
-
if (l && !n.isAuthEnabled)
|
|
60
|
-
throw new P("Authentication is not enabled", {
|
|
61
|
-
title: "Authentication is not enabled",
|
|
62
|
-
developerHint: "To use protectedRoutes you need authentication to be enabled"
|
|
63
|
-
});
|
|
64
|
-
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
65
|
-
c && /* @__PURE__ */ t.jsx(m, { children: /* @__PURE__ */ t.jsx(
|
|
66
|
-
"meta",
|
|
67
|
-
{
|
|
68
|
-
name: "pagefind",
|
|
69
|
-
"data-pagefind-filter": `section:${A}`,
|
|
70
|
-
content: "true"
|
|
71
|
-
}
|
|
72
|
-
) }),
|
|
73
|
-
/* @__PURE__ */ t.jsx(v, {})
|
|
74
|
-
] });
|
|
75
|
-
};
|
|
76
|
-
export {
|
|
77
|
-
O as B,
|
|
78
|
-
G as R,
|
|
79
|
-
A as S
|
|
80
|
-
};
|
|
81
|
-
//# sourceMappingURL=RouteGuard-DhU3LRr1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RouteGuard-DhU3LRr1.js","sources":["../src/lib/components/context/BypassProtectedRoutesContext.ts","../src/lib/core/RouteGuard.tsx"],"sourcesContent":["import { createContext } from \"react\";\n\nexport const BypassProtectedRoutesContext = createContext(false);\n","import { Helmet } from \"@zudoku/react-helmet-async\";\nimport { use } from \"react\";\nimport { matchPath, Outlet, useLocation, useNavigate } from \"react-router\";\nimport { Button } from \"zudoku/ui/Button.js\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n} from \"zudoku/ui/Dialog.js\";\nimport { useAuth } from \"../authentication/hook.js\";\nimport { BypassProtectedRoutesContext } from \"../components/context/BypassProtectedRoutesContext.js\";\nimport { useZudoku } from \"../components/context/ZudokuContext.js\";\nimport { ZudokuError } from \"../util/invariant.js\";\nimport { useLatest } from \"../util/useLatest.js\";\n\nexport const SEARCH_PROTECTED_SECTION = \"protected\";\n\nexport const RouteGuard = () => {\n const auth = useAuth();\n const zudoku = useZudoku();\n const navigate = useNavigate();\n const location = useLocation();\n const latestPath = useLatest(location.pathname);\n const shouldBypass = use(BypassProtectedRoutesContext);\n const { protectedRoutes } = zudoku.options;\n\n const authCheckFn =\n !shouldBypass && protectedRoutes\n ? Object.entries(protectedRoutes).find(([path]) =>\n matchPath({ path, end: true }, location.pathname),\n )?.[1]\n : undefined;\n\n const isProtectedRoute = authCheckFn !== undefined;\n const needsToSignIn =\n isProtectedRoute && !authCheckFn({ auth, context: zudoku });\n\n if (needsToSignIn && auth.isPending && typeof window !== \"undefined\") {\n return null;\n }\n\n if (needsToSignIn) {\n return (\n <Dialog\n open={true}\n onOpenChange={(open) => {\n if (!open) {\n void navigate(-1);\n }\n }}\n >\n <DialogContent>\n <DialogHeader>\n <DialogTitle>Login to continue</DialogTitle>\n </DialogHeader>\n <DialogDescription>\n Please wait while we log you in.\n </DialogDescription>\n <DialogFooter>\n <Button variant=\"outline\" onClick={() => void navigate(-1)}>\n Cancel\n </Button>\n <div className=\"w-full\"></div>\n <Button\n variant=\"secondary\"\n onClick={() =>\n void zudoku.authentication?.signUp(\n { navigate },\n { redirectTo: latestPath.current },\n )\n }\n >\n Register\n </Button>\n <Button\n onClick={() =>\n void zudoku.authentication?.signIn(\n { navigate },\n { redirectTo: latestPath.current },\n )\n }\n >\n Login{\" \"}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n }\n\n if (isProtectedRoute && !auth.isAuthEnabled) {\n throw new ZudokuError(\"Authentication is not enabled\", {\n title: \"Authentication is not enabled\",\n developerHint:\n \"To use protectedRoutes you need authentication to be enabled\",\n });\n }\n\n return (\n <>\n {shouldBypass && (\n <Helmet>\n <meta\n name=\"pagefind\"\n data-pagefind-filter={`section:${SEARCH_PROTECTED_SECTION}`}\n content=\"true\"\n />\n </Helmet>\n )}\n <Outlet />\n </>\n );\n};\n"],"names":["BypassProtectedRoutesContext","createContext","SEARCH_PROTECTED_SECTION","RouteGuard","auth","useAuth","zudoku","useZudoku","navigate","useNavigate","location","useLocation","latestPath","useLatest","shouldBypass","use","protectedRoutes","authCheckFn","path","matchPath","isProtectedRoute","needsToSignIn","jsx","Dialog","open","DialogContent","DialogHeader","DialogTitle","DialogDescription","DialogFooter","Button","jsxs","ZudokuError","Fragment","Helmet","Outlet"],"mappings":";;;;;;;;;;AAEO,MAAMA,IAA+BC,EAAc,EAAK,GCgBlDC,IAA2B,aAE3BC,IAAa,MAAM;AAC9B,QAAMC,IAAOC,EAAA,GACPC,IAASC,EAAA,GACTC,IAAWC,EAAA,GACXC,IAAWC,EAAA,GACXC,IAAaC,EAAUH,EAAS,QAAQ,GACxCI,IAAeC,EAAIf,CAA4B,GAC/C,EAAE,iBAAAgB,MAAoBV,EAAO,SAE7BW,IACJ,CAACH,KAAgBE,IACb,OAAO,QAAQA,CAAe,EAAE;AAAA,IAAK,CAAC,CAACE,CAAI,MACzCC,EAAU,EAAE,MAAAD,GAAM,KAAK,MAAQR,EAAS,QAAQ;AAAA,EAAA,IAC9C,CAAC,IACL,QAEAU,IAAmBH,MAAgB,QACnCI,IACJD,KAAoB,CAACH,EAAY,EAAE,MAAAb,GAAM,SAASE,GAAQ;AAE5D,MAAIe,KAAiBjB,EAAK,aAAa,OAAO,SAAW;AACvD,WAAO;AAGT,MAAIiB;AACF,WACEC,gBAAAA,EAAAA;AAAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN,cAAc,CAACC,MAAS;AACtB,UAAKA,KACEhB,EAAS,EAAE;AAAA,QAEpB;AAAA,QAEA,iCAACiB,GAAA,EACC,UAAA;AAAA,UAAAH,gBAAAA,MAACI,GAAA,EACC,UAAAJ,gBAAAA,EAAAA,IAACK,GAAA,EAAY,UAAA,oBAAA,CAAiB,GAChC;AAAA,UACAL,gBAAAA,EAAAA,IAACM,KAAkB,UAAA,mCAAA,CAEnB;AAAA,iCACCC,GAAA,EACC,UAAA;AAAA,YAAAP,gBAAAA,EAAAA,IAACQ,GAAA,EAAO,SAAQ,WAAU,SAAS,MAAM,KAAKtB,EAAS,EAAE,GAAG,UAAA,SAAA,CAE5D;AAAA,YACAc,gBAAAA,EAAAA,IAAC,OAAA,EAAI,WAAU,SAAA,CAAS;AAAA,YACxBA,gBAAAA,EAAAA;AAAAA,cAACQ;AAAA,cAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,SAAS,MACP,KAAKxB,EAAO,gBAAgB;AAAA,kBAC1B,EAAE,UAAAE,EAAA;AAAA,kBACF,EAAE,YAAYI,EAAW,QAAA;AAAA,gBAAQ;AAAA,gBAGtC,UAAA;AAAA,cAAA;AAAA,YAAA;AAAA,YAGDmB,gBAAAA,EAAAA;AAAAA,cAACD;AAAA,cAAA;AAAA,gBACC,SAAS,MACP,KAAKxB,EAAO,gBAAgB;AAAA,kBAC1B,EAAE,UAAAE,EAAA;AAAA,kBACF,EAAE,YAAYI,EAAW,QAAA;AAAA,gBAAQ;AAAA,gBAGtC,UAAA;AAAA,kBAAA;AAAA,kBACO;AAAA,gBAAA;AAAA,cAAA;AAAA,YAAA;AAAA,UACR,EAAA,CACF;AAAA,QAAA,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAKN,MAAIQ,KAAoB,CAAChB,EAAK;AAC5B,UAAM,IAAI4B,EAAY,iCAAiC;AAAA,MACrD,OAAO;AAAA,MACP,eACE;AAAA,IAAA,CACH;AAGH,SACED,gBAAAA,EAAAA,KAAAE,YAAA,EACG,UAAA;AAAA,IAAAnB,2BACEoB,GAAA,EACC,UAAAZ,gBAAAA,EAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,wBAAsB,WAAWpB,CAAwB;AAAA,QACzD,SAAQ;AAAA,MAAA;AAAA,IAAA,GAEZ;AAAA,0BAEDiC,GAAA,CAAA,CAAO;AAAA,EAAA,GACV;AAEJ;"}
|
|
@@ -1,458 +0,0 @@
|
|
|
1
|
-
import { j as r } from "./jsx-runtime-BzflLqGi.js";
|
|
2
|
-
import { ChevronUpIcon as E, ChevronDownIcon as A, ChevronsLeftRightIcon as R, CircleFadingPlusIcon as B, SquareMinusIcon as M, SquarePlusIcon as L, MinusIcon as T, PlusIcon as D, RefreshCcwDotIcon as F, InfoIcon as G } from "lucide-react";
|
|
3
|
-
import { S as m, I as w, M as P } from "./ErrorAlert-DE3Sf66a.js";
|
|
4
|
-
import { Card as f } from "./ui/Card.js";
|
|
5
|
-
import { useState as u, isValidElement as J, useCallback as U } from "react";
|
|
6
|
-
import { B as _ } from "./Button-DmS4u8Lj.js";
|
|
7
|
-
import { c as j } from "./cn-dYga0KKN.js";
|
|
8
|
-
import * as d from "@radix-ui/react-collapsible";
|
|
9
|
-
import { Button as K } from "./ui/Button.js";
|
|
10
|
-
import { C as W } from "./circular-CSSuz-LS.js";
|
|
11
|
-
import { Badge as Q } from "./ui/Badge.js";
|
|
12
|
-
const X = (e, s) => e.reduce(
|
|
13
|
-
(t, i) => {
|
|
14
|
-
const o = s(i);
|
|
15
|
-
return t[o] || (t[o] = []), t[o].push(i), t;
|
|
16
|
-
},
|
|
17
|
-
{}
|
|
18
|
-
), S = ({
|
|
19
|
-
schema: e,
|
|
20
|
-
hideDescription: s = !1
|
|
21
|
-
}) => /* @__PURE__ */ r.jsx("div", { className: "flex flex-col gap-1 text-xs", children: /* @__PURE__ */ r.jsxs("div", { children: [
|
|
22
|
-
/* @__PURE__ */ r.jsx("span", { className: "text-muted-foreground", children: "Const value: " }),
|
|
23
|
-
/* @__PURE__ */ r.jsx(m, { className: "border rounded px-1 font-mono", children: e.const }),
|
|
24
|
-
!s && e.description && /* @__PURE__ */ r.jsx("div", { className: "text-muted-foreground", children: e.description })
|
|
25
|
-
] }) }), g = ({
|
|
26
|
-
values: e,
|
|
27
|
-
className: s,
|
|
28
|
-
maxVisibleValues: t = 8
|
|
29
|
-
}) => {
|
|
30
|
-
const [i, o] = u(!1);
|
|
31
|
-
if (!e.length) return null;
|
|
32
|
-
const n = e.length > t, l = n && !i ? e.slice(0, t) : e;
|
|
33
|
-
return /* @__PURE__ */ r.jsxs("div", { className: j("flex flex-wrap gap-1.5 text-xs", s), children: [
|
|
34
|
-
/* @__PURE__ */ r.jsx("span", { className: "text-muted-foreground", children: "Enum values: " }),
|
|
35
|
-
l.map((c) => /* @__PURE__ */ r.jsx("div", { children: /* @__PURE__ */ r.jsx(m, { className: "border rounded-sm px-1 font-mono", children: c }) }, c)),
|
|
36
|
-
n && /* @__PURE__ */ r.jsx(
|
|
37
|
-
_,
|
|
38
|
-
{
|
|
39
|
-
variant: "ghost",
|
|
40
|
-
size: "sm",
|
|
41
|
-
className: "h-fit px-0",
|
|
42
|
-
onClick: () => o(!i),
|
|
43
|
-
children: i ? /* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
44
|
-
/* @__PURE__ */ r.jsx(E, { size: 12 }),
|
|
45
|
-
/* @__PURE__ */ r.jsx("span", { className: "text-muted-foreground", children: "show less" })
|
|
46
|
-
] }) : /* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
47
|
-
/* @__PURE__ */ r.jsx(A, { size: 12 }),
|
|
48
|
-
/* @__PURE__ */ r.jsxs("span", { className: "text-muted-foreground", children: [
|
|
49
|
-
"show ",
|
|
50
|
-
e.length - t,
|
|
51
|
-
" more"
|
|
52
|
-
] })
|
|
53
|
-
] })
|
|
54
|
-
}
|
|
55
|
-
)
|
|
56
|
-
] });
|
|
57
|
-
}, Y = ({ pattern: e }) => {
|
|
58
|
-
const [s, t] = u(!1), i = e.length > 20, o = i ? `${e.slice(0, 20)}…` : e;
|
|
59
|
-
return /* @__PURE__ */ r.jsxs(
|
|
60
|
-
w,
|
|
61
|
-
{
|
|
62
|
-
className: j("text-xs", i && "cursor-pointer"),
|
|
63
|
-
onClick: () => t(!s),
|
|
64
|
-
selectOnClick: !1,
|
|
65
|
-
children: [
|
|
66
|
-
s ? e : o,
|
|
67
|
-
i && /* @__PURE__ */ r.jsx("button", { type: "button", className: "p-1 translate-y-[2px]", children: !s && /* @__PURE__ */ r.jsx(R, { size: 12 }) })
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
}, Z = (e) => e ? [
|
|
72
|
-
e.type === "array" && e.items.type ? Array.isArray(e.items.type) ? `(${e.items.type.join(" | ")})[]` : `${e.items.type}[]` : Array.isArray(e.type) ? e.type.join(" | ") : e.type,
|
|
73
|
-
e.enum && "enum",
|
|
74
|
-
e.const && "const",
|
|
75
|
-
e.format,
|
|
76
|
-
e.minimum !== void 0 && `min: ${e.minimum}`,
|
|
77
|
-
e.maximum !== void 0 && `max: ${e.maximum}`,
|
|
78
|
-
e.minLength !== void 0 && `minLength: ${e.minLength}`,
|
|
79
|
-
e.maxLength !== void 0 && `maxLength: ${e.maxLength}`,
|
|
80
|
-
e.minItems !== void 0 && `minItems: ${e.minItems}`,
|
|
81
|
-
e.maxItems !== void 0 && `maxItems: ${e.maxItems}`,
|
|
82
|
-
e.minProperties !== void 0 && `minProps: ${e.minProperties}`,
|
|
83
|
-
e.maxProperties !== void 0 && `maxProps: ${e.maxProperties}`,
|
|
84
|
-
e.uniqueItems && "unique",
|
|
85
|
-
e.readOnly && "readOnly",
|
|
86
|
-
e.writeOnly && "writeOnly",
|
|
87
|
-
e.deprecated && "deprecated",
|
|
88
|
-
e.pattern && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
89
|
-
"pattern: ",
|
|
90
|
-
/* @__PURE__ */ r.jsx(Y, { pattern: e.pattern })
|
|
91
|
-
] })
|
|
92
|
-
] : [], b = ({
|
|
93
|
-
schema: e,
|
|
94
|
-
extraItems: s = [],
|
|
95
|
-
className: t
|
|
96
|
-
}) => {
|
|
97
|
-
const i = [...Z(e), ...s].flatMap(
|
|
98
|
-
(o) => typeof o == "string" || J(o) ? o : []
|
|
99
|
-
);
|
|
100
|
-
return /* @__PURE__ */ r.jsx("span", { className: t, children: i.map((o, n) => (
|
|
101
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: index should be stable
|
|
102
|
-
/* @__PURE__ */ r.jsxs("span", { className: "text-muted-foreground", children: [
|
|
103
|
-
o,
|
|
104
|
-
n < i.length - 1 && /* @__PURE__ */ r.jsx("span", { className: "text-muted-foreground/50", children: " · " })
|
|
105
|
-
] }, n)
|
|
106
|
-
)) });
|
|
107
|
-
}, H = ({
|
|
108
|
-
isOpen: e,
|
|
109
|
-
className: s,
|
|
110
|
-
schemeName: t
|
|
111
|
-
}) => /* @__PURE__ */ r.jsx(
|
|
112
|
-
"div",
|
|
113
|
-
{
|
|
114
|
-
className: j(
|
|
115
|
-
"text-green-500 dark:text-green-300/60",
|
|
116
|
-
"relative text-sm flex py-2",
|
|
117
|
-
"before:border-l before:absolute before:-top-2 before:-bottom-2 before:border-border before:border-dashed before:content-['']",
|
|
118
|
-
s
|
|
119
|
-
),
|
|
120
|
-
children: /* @__PURE__ */ r.jsxs("div", { className: "-translate-x-[7px] flex gap-1 items-center", children: [
|
|
121
|
-
/* @__PURE__ */ r.jsx(B, { size: 16, className: "fill-card" }),
|
|
122
|
-
/* @__PURE__ */ r.jsx(
|
|
123
|
-
"div",
|
|
124
|
-
{
|
|
125
|
-
className: j(
|
|
126
|
-
"translate-y-px mx-px opacity-0 group-hover:opacity-100 transition",
|
|
127
|
-
!e && "-rotate-90"
|
|
128
|
-
),
|
|
129
|
-
children: /* @__PURE__ */ r.jsx(A, { size: 16 })
|
|
130
|
-
}
|
|
131
|
-
),
|
|
132
|
-
/* @__PURE__ */ r.jsx("span", { className: "text-sm text-foreground", children: t })
|
|
133
|
-
] })
|
|
134
|
-
}
|
|
135
|
-
), ee = (e) => {
|
|
136
|
-
const [s, t] = u(!0);
|
|
137
|
-
return /* @__PURE__ */ r.jsxs(
|
|
138
|
-
d.Root,
|
|
139
|
-
{
|
|
140
|
-
open: s,
|
|
141
|
-
onOpenChange: () => t((i) => !i),
|
|
142
|
-
className: "group",
|
|
143
|
-
children: [
|
|
144
|
-
/* @__PURE__ */ r.jsx(d.Trigger, { children: /* @__PURE__ */ r.jsx(H, { isOpen: s, schemeName: e.schema.title }) }),
|
|
145
|
-
!s && /* @__PURE__ */ r.jsx("div", { className: "wavy-line bg-border translate-y-1" }),
|
|
146
|
-
/* @__PURE__ */ r.jsx(d.Content, { children: /* @__PURE__ */ r.jsx(p, { schema: e.schema }) })
|
|
147
|
-
]
|
|
148
|
-
}
|
|
149
|
-
);
|
|
150
|
-
}, $ = ({
|
|
151
|
-
schema: e,
|
|
152
|
-
cardHeader: s
|
|
153
|
-
}) => {
|
|
154
|
-
const [t, i] = u(!0), o = U(() => i((n) => !n), []);
|
|
155
|
-
return e.allOf ? /* @__PURE__ */ r.jsx(d.Root, { open: t, onOpenChange: o, asChild: !0, children: /* @__PURE__ */ r.jsxs(f, { className: "overflow-hidden", children: [
|
|
156
|
-
s,
|
|
157
|
-
/* @__PURE__ */ r.jsxs(d.Trigger, { className: "flex gap-2 items-center py-2 px-6 w-full text-sm text-muted-foreground -translate-x-1.5", children: [
|
|
158
|
-
t ? /* @__PURE__ */ r.jsx(M, { size: 14 }) : /* @__PURE__ */ r.jsx(L, { size: 14 }),
|
|
159
|
-
/* @__PURE__ */ r.jsx("span", { children: "All of" })
|
|
160
|
-
] }),
|
|
161
|
-
/* @__PURE__ */ r.jsx(d.Content, { className: "pb-4 px-6", children: e.allOf.map((n, l) => (
|
|
162
|
-
// biome-ignore lint/suspicious/noArrayIndexKey: Index needed for key
|
|
163
|
-
/* @__PURE__ */ r.jsx(ee, { schema: n }, l)
|
|
164
|
-
)) })
|
|
165
|
-
] }) }) : null;
|
|
166
|
-
}, N = ({
|
|
167
|
-
schema: e
|
|
168
|
-
}) => {
|
|
169
|
-
const s = e.examples?.at(0), t = e.default;
|
|
170
|
-
return s === void 0 && t === void 0 ? null : /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-1 text-xs", children: [
|
|
171
|
-
s !== void 0 && /* @__PURE__ */ r.jsxs("div", { children: [
|
|
172
|
-
/* @__PURE__ */ r.jsx("span", { className: "text-muted-foreground", children: "Example: " }),
|
|
173
|
-
/* @__PURE__ */ r.jsx(m, { className: "border rounded-sm px-1 font-mono", children: typeof s == "object" || typeof s == "boolean" ? JSON.stringify(s) : s })
|
|
174
|
-
] }),
|
|
175
|
-
t !== void 0 && /* @__PURE__ */ r.jsxs("div", { children: [
|
|
176
|
-
/* @__PURE__ */ r.jsx("span", { className: "text-muted-foreground", children: "Default: " }),
|
|
177
|
-
/* @__PURE__ */ r.jsx(m, { className: "border rounded-sm px-1 font-mono", children: typeof t == "object" || typeof t == "boolean" ? JSON.stringify(t) : t })
|
|
178
|
-
] })
|
|
179
|
-
] });
|
|
180
|
-
}, k = (e) => typeof e == "string" && ["string", "number", "boolean", "integer", "null"].includes(e) || Array.isArray(e) && e.every(k), h = (e) => e.type === "array" || // schema.type might be an array of types, so we need to check if "array" is one of them
|
|
181
|
-
Array.isArray(e.type) && e.type.includes("array"), O = (e) => e && (e.type === "object" && Object.keys(e.properties ?? {}).length > 0 || e.type === "array" && typeof e.items == "object" && (!e.items.type || e.items.type === "object")), q = (e) => typeof e == "string" && e.startsWith(W), I = (e) => h(e) && "items" in e && q(e.items), re = (e) => typeof e == "string" ? e.split(":")[1] : void 0, C = ({ circularProp: e }) => /* @__PURE__ */ r.jsxs(
|
|
182
|
-
w,
|
|
183
|
-
{
|
|
184
|
-
className: "inline-flex items-center gap-1.5 italic text-xs translate-y-0.5",
|
|
185
|
-
selectOnClick: !1,
|
|
186
|
-
children: [
|
|
187
|
-
/* @__PURE__ */ r.jsx(F, { size: 13 }),
|
|
188
|
-
/* @__PURE__ */ r.jsx("span", { children: e ? `${e} (circular)` : "circular" })
|
|
189
|
-
]
|
|
190
|
-
}
|
|
191
|
-
), se = ({
|
|
192
|
-
name: e,
|
|
193
|
-
schema: s,
|
|
194
|
-
group: t,
|
|
195
|
-
defaultOpen: i = !1,
|
|
196
|
-
showCollapseButton: o = !0
|
|
197
|
-
}) => {
|
|
198
|
-
const [n, l] = u(i);
|
|
199
|
-
if (q(s))
|
|
200
|
-
return /* @__PURE__ */ r.jsx("li", { className: "p-4 bg-border/20 hover:bg-border/30", children: /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-2.5 justify-between text-sm", children: [
|
|
201
|
-
/* @__PURE__ */ r.jsxs("div", { className: "space-x-2 rtl:space-x-reverse", children: [
|
|
202
|
-
/* @__PURE__ */ r.jsx("code", { children: e }),
|
|
203
|
-
/* @__PURE__ */ r.jsx(
|
|
204
|
-
b,
|
|
205
|
-
{
|
|
206
|
-
schema: s,
|
|
207
|
-
extraItems: [/* @__PURE__ */ r.jsx(C, {}, "circular-ref")]
|
|
208
|
-
}
|
|
209
|
-
)
|
|
210
|
-
] }),
|
|
211
|
-
/* @__PURE__ */ r.jsx(N, { schema: s })
|
|
212
|
-
] }) });
|
|
213
|
-
const c = !!((s.allOf || s.anyOf || s.oneOf || O(s) || h(s) && "items" in s && O(s.items) || s.additionalProperties) && !I(s));
|
|
214
|
-
return /* @__PURE__ */ r.jsx("li", { className: "p-4 bg-border/20 hover:bg-border/30", children: /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-2.5 justify-between text-sm", children: [
|
|
215
|
-
/* @__PURE__ */ r.jsxs("div", { className: "space-x-2 rtl:space-x-reverse", children: [
|
|
216
|
-
/* @__PURE__ */ r.jsx(m, { asChild: !0, children: /* @__PURE__ */ r.jsx("code", { children: e }) }),
|
|
217
|
-
/* @__PURE__ */ r.jsx(
|
|
218
|
-
b,
|
|
219
|
-
{
|
|
220
|
-
schema: s,
|
|
221
|
-
extraItems: [
|
|
222
|
-
t !== "optional" && /* @__PURE__ */ r.jsx("span", { className: "text-primary", children: "required" }),
|
|
223
|
-
I(s) && /* @__PURE__ */ r.jsx(
|
|
224
|
-
C,
|
|
225
|
-
{
|
|
226
|
-
circularProp: re(s.items)
|
|
227
|
-
}
|
|
228
|
-
)
|
|
229
|
-
]
|
|
230
|
-
}
|
|
231
|
-
)
|
|
232
|
-
] }),
|
|
233
|
-
s.description && /* @__PURE__ */ r.jsx(
|
|
234
|
-
P,
|
|
235
|
-
{
|
|
236
|
-
className: "text-sm leading-normal",
|
|
237
|
-
content: s.description
|
|
238
|
-
}
|
|
239
|
-
),
|
|
240
|
-
s.type === "array" && "items" in s && s.items.enum && /* @__PURE__ */ r.jsx(g, { values: s.items.enum }),
|
|
241
|
-
s.const && /* @__PURE__ */ r.jsx(S, { schema: s, hideDescription: !0 }),
|
|
242
|
-
s.enum && /* @__PURE__ */ r.jsx(g, { values: s.enum }),
|
|
243
|
-
/* @__PURE__ */ r.jsx(N, { schema: s }),
|
|
244
|
-
c && /* @__PURE__ */ r.jsxs(
|
|
245
|
-
d.Root,
|
|
246
|
-
{
|
|
247
|
-
defaultOpen: i,
|
|
248
|
-
open: n,
|
|
249
|
-
onOpenChange: () => l(!n),
|
|
250
|
-
children: [
|
|
251
|
-
o && /* @__PURE__ */ r.jsx(d.Trigger, { asChild: !0, children: /* @__PURE__ */ r.jsxs(K, { variant: "expand", size: "sm", children: [
|
|
252
|
-
n ? /* @__PURE__ */ r.jsx(T, { size: 12 }) : /* @__PURE__ */ r.jsx(D, { size: 12 }),
|
|
253
|
-
n ? "Hide properties" : "Show properties"
|
|
254
|
-
] }) }),
|
|
255
|
-
/* @__PURE__ */ r.jsx(d.Content, { children: /* @__PURE__ */ r.jsx("div", { className: "mt-2", children: s.allOf ? /* @__PURE__ */ r.jsx($, { schema: s }) : s.anyOf || s.oneOf || s.type === "object" ? /* @__PURE__ */ r.jsx(p, { schema: s }) : h(s) && "items" in s ? /* @__PURE__ */ r.jsx(p, { schema: s.items }) : null }) })
|
|
256
|
-
]
|
|
257
|
-
}
|
|
258
|
-
)
|
|
259
|
-
] }) });
|
|
260
|
-
}, V = (e) => {
|
|
261
|
-
const s = e.oneOf ?? e.anyOf ?? [];
|
|
262
|
-
return e.properties && Object.keys(e.properties).length > 0 ? s.map((t) => !t.properties && !t.type && !t.allOf && !t.oneOf && !t.anyOf ? {
|
|
263
|
-
...t,
|
|
264
|
-
type: "object",
|
|
265
|
-
properties: e.properties,
|
|
266
|
-
required: t.required ?? e.required
|
|
267
|
-
} : t) : s;
|
|
268
|
-
}, te = (e) => {
|
|
269
|
-
if (Array.isArray(e.oneOf)) return "exactly-one";
|
|
270
|
-
const s = e.discriminator?.propertyName;
|
|
271
|
-
if (!s) return "at-least-one";
|
|
272
|
-
const t = V(e), i = /* @__PURE__ */ new Set();
|
|
273
|
-
for (const o of t) {
|
|
274
|
-
const n = o.properties?.[s], l = n?.const ?? (Array.isArray(n?.enum) && n.enum.length === 1 ? String(n.enum[0]) : void 0);
|
|
275
|
-
if (l == null || i.has(String(l))) return "at-least-one";
|
|
276
|
-
i.add(String(l));
|
|
277
|
-
}
|
|
278
|
-
return "exactly-one";
|
|
279
|
-
}, v = (e, s) => s.title?.trim() || `Variant ${e + 1}`, ne = (e, s) => {
|
|
280
|
-
const t = [];
|
|
281
|
-
e.type && t.push(
|
|
282
|
-
`type = ${Array.isArray(e.type) ? e.type.join("|") : e.type}`
|
|
283
|
-
);
|
|
284
|
-
const i = s?.discriminator?.propertyName;
|
|
285
|
-
if (i) {
|
|
286
|
-
const n = e.properties?.[i], l = n?.const ?? (Array.isArray(n?.enum) && n.enum.length === 1 ? n.enum[0] : void 0);
|
|
287
|
-
l !== void 0 && t.push(`${i}=${JSON.stringify(l)}`);
|
|
288
|
-
}
|
|
289
|
-
const o = (e.required ?? []).filter((n) => n !== i);
|
|
290
|
-
if (o.length) {
|
|
291
|
-
const n = o.slice(0, 3).join(", "), l = o.length > 3 ? ` +${o.length - 3} more` : "";
|
|
292
|
-
t.push(`requires: ${n}${l}`);
|
|
293
|
-
}
|
|
294
|
-
return t;
|
|
295
|
-
}, ie = ({
|
|
296
|
-
variants: e,
|
|
297
|
-
schema: s,
|
|
298
|
-
selectedVariant: t,
|
|
299
|
-
onSelectVariant: i
|
|
300
|
-
}) => {
|
|
301
|
-
const o = e.map((n, l) => ({
|
|
302
|
-
label: v(l, n),
|
|
303
|
-
guards: ne(n, s)
|
|
304
|
-
}));
|
|
305
|
-
return /* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-2 text-sm", children: [
|
|
306
|
-
/* @__PURE__ */ r.jsx("h4", { className: "font-medium", children: "Decision Table" }),
|
|
307
|
-
/* @__PURE__ */ r.jsx("div", { className: "border rounded-md overflow-hidden", children: /* @__PURE__ */ r.jsxs("table", { className: "w-full", children: [
|
|
308
|
-
/* @__PURE__ */ r.jsx("thead", { children: /* @__PURE__ */ r.jsxs("tr", { className: "border-b bg-muted/50", children: [
|
|
309
|
-
/* @__PURE__ */ r.jsx("th", { className: "text-left p-2 font-medium", children: "Variant" }),
|
|
310
|
-
/* @__PURE__ */ r.jsx("th", { className: "text-left p-2 font-medium", children: "Matching Criteria" })
|
|
311
|
-
] }) }),
|
|
312
|
-
/* @__PURE__ */ r.jsx("tbody", { className: "divide-y", children: o.map((n) => /* @__PURE__ */ r.jsxs("tr", { className: "hover:bg-muted/30", children: [
|
|
313
|
-
/* @__PURE__ */ r.jsx("td", { className: "p-2 font-medium", children: /* @__PURE__ */ r.jsx(
|
|
314
|
-
"button",
|
|
315
|
-
{
|
|
316
|
-
type: "button",
|
|
317
|
-
className: j(
|
|
318
|
-
"hover:underline",
|
|
319
|
-
t === n.label && "text-primary"
|
|
320
|
-
),
|
|
321
|
-
onClick: () => i(n.label),
|
|
322
|
-
children: n.label
|
|
323
|
-
}
|
|
324
|
-
) }),
|
|
325
|
-
/* @__PURE__ */ r.jsx("td", { className: "p-2 text-muted-foreground text-xs", children: n.guards.length > 0 ? n.guards.join(" · ") : "No specific criteria" })
|
|
326
|
-
] }, n.label)) })
|
|
327
|
-
] }) })
|
|
328
|
-
] });
|
|
329
|
-
}, oe = ({ variant: e }) => /* @__PURE__ */ r.jsxs("div", { className: "space-y-2", children: [
|
|
330
|
-
e.description && /* @__PURE__ */ r.jsx("p", { className: "text-sm text-muted-foreground", children: e.description }),
|
|
331
|
-
/* @__PURE__ */ r.jsx(p, { schema: e })
|
|
332
|
-
] }), le = ({
|
|
333
|
-
schema: e,
|
|
334
|
-
cardHeader: s
|
|
335
|
-
}) => {
|
|
336
|
-
const t = Array.isArray(e.oneOf) ? "oneOf" : Array.isArray(e.anyOf) ? "anyOf" : void 0, i = t ? V(e) : [], [o, n] = u(
|
|
337
|
-
() => i[0] ? v(0, i[0]) : ""
|
|
338
|
-
);
|
|
339
|
-
if (!t) return null;
|
|
340
|
-
const c = te(e) === "exactly-one" ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
341
|
-
"Exactly one variant ",
|
|
342
|
-
/* @__PURE__ */ r.jsx("b", { children: "must match" }),
|
|
343
|
-
"."
|
|
344
|
-
] }) : /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
|
|
345
|
-
"At least one variant ",
|
|
346
|
-
/* @__PURE__ */ r.jsx("b", { children: "must match" }),
|
|
347
|
-
". Multiple variants",
|
|
348
|
-
" ",
|
|
349
|
-
/* @__PURE__ */ r.jsx("i", { children: "may match" }),
|
|
350
|
-
" simultaneously."
|
|
351
|
-
] }), a = i.findIndex(
|
|
352
|
-
(y, z) => v(z, y) === o
|
|
353
|
-
), x = a >= 0 ? i[a] : null;
|
|
354
|
-
return /* @__PURE__ */ r.jsxs(f, { className: "overflow-hidden text-sm", children: [
|
|
355
|
-
s,
|
|
356
|
-
/* @__PURE__ */ r.jsxs("div", { className: "flex flex-col gap-4 p-4", children: [
|
|
357
|
-
/* @__PURE__ */ r.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
358
|
-
/* @__PURE__ */ r.jsx(Q, { variant: "outline", children: t }),
|
|
359
|
-
/* @__PURE__ */ r.jsx("div", { className: "flex-1 p-2", children: /* @__PURE__ */ r.jsx("span", { className: "text-sm", children: c }) })
|
|
360
|
-
] }),
|
|
361
|
-
/* @__PURE__ */ r.jsx(
|
|
362
|
-
ie,
|
|
363
|
-
{
|
|
364
|
-
variants: i,
|
|
365
|
-
schema: e,
|
|
366
|
-
selectedVariant: o,
|
|
367
|
-
onSelectVariant: n
|
|
368
|
-
}
|
|
369
|
-
),
|
|
370
|
-
/* @__PURE__ */ r.jsxs("strong", { children: [
|
|
371
|
-
"Properties for ",
|
|
372
|
-
o,
|
|
373
|
-
":"
|
|
374
|
-
] }),
|
|
375
|
-
x && /* @__PURE__ */ r.jsx(oe, { variant: x })
|
|
376
|
-
] })
|
|
377
|
-
] });
|
|
378
|
-
}, ae = (e) => e && /* @__PURE__ */ r.jsx(
|
|
379
|
-
P,
|
|
380
|
-
{
|
|
381
|
-
className: "text-sm leading-normal line-clamp-4",
|
|
382
|
-
content: e
|
|
383
|
-
}
|
|
384
|
-
), de = (e, s) => /* @__PURE__ */ r.jsxs(f, { className: "overflow-hidden", children: [
|
|
385
|
-
s,
|
|
386
|
-
/* @__PURE__ */ r.jsxs("div", { className: "p-4 space-y-2", children: [
|
|
387
|
-
/* @__PURE__ */ r.jsx("span", { className: "text-sm text-muted-foreground", children: /* @__PURE__ */ r.jsx(b, { schema: e }) }),
|
|
388
|
-
e.enum && /* @__PURE__ */ r.jsx(g, { values: e.enum }),
|
|
389
|
-
ae(e.description),
|
|
390
|
-
/* @__PURE__ */ r.jsx(N, { schema: e })
|
|
391
|
-
] })
|
|
392
|
-
] }), p = ({
|
|
393
|
-
schema: e,
|
|
394
|
-
defaultOpen: s = !1,
|
|
395
|
-
cardHeader: t,
|
|
396
|
-
embedded: i
|
|
397
|
-
}) => {
|
|
398
|
-
if (!e || Object.keys(e).length === 0)
|
|
399
|
-
return /* @__PURE__ */ r.jsxs(f, { className: "overflow-hidden", children: [
|
|
400
|
-
t,
|
|
401
|
-
/* @__PURE__ */ r.jsx("div", { className: "text-sm text-muted-foreground italic p-4", children: "No data returned" })
|
|
402
|
-
] });
|
|
403
|
-
if (e.const)
|
|
404
|
-
return /* @__PURE__ */ r.jsx(S, { schema: e });
|
|
405
|
-
if (Array.isArray(e.oneOf) || Array.isArray(e.anyOf))
|
|
406
|
-
return /* @__PURE__ */ r.jsx(le, { schema: e, cardHeader: t });
|
|
407
|
-
if (Array.isArray(e.allOf))
|
|
408
|
-
return /* @__PURE__ */ r.jsx($, { schema: e, cardHeader: t });
|
|
409
|
-
if (k(e.type))
|
|
410
|
-
return de(e, t);
|
|
411
|
-
if (e.type === "array" && typeof e.items == "object")
|
|
412
|
-
return /* @__PURE__ */ r.jsx(p, { schema: e.items, cardHeader: t });
|
|
413
|
-
if (e.type === "object") {
|
|
414
|
-
const o = X(
|
|
415
|
-
Object.entries(e.properties ?? {}),
|
|
416
|
-
([a, x]) => x.deprecated ? "deprecated" : e.required?.includes(a) ? "required" : "optional"
|
|
417
|
-
), n = ["required", "optional", "deprecated"], l = typeof e.additionalProperties == "object" ? /* @__PURE__ */ r.jsx(p, { schema: e.additionalProperties, embedded: !0 }) : e.additionalProperties === !0 ? /* @__PURE__ */ r.jsxs("div", { className: "text-sm p-4 bg-border/20 hover:bg-border/30 flex items-center gap-1", children: [
|
|
418
|
-
/* @__PURE__ */ r.jsx("span", { children: "Additional properties are allowed" }),
|
|
419
|
-
/* @__PURE__ */ r.jsx(
|
|
420
|
-
"a",
|
|
421
|
-
{
|
|
422
|
-
className: "p-0.5 -m-0.5",
|
|
423
|
-
href: "https://swagger.io/docs/specification/v3_0/data-models/dictionaries/",
|
|
424
|
-
rel: "noopener noreferrer",
|
|
425
|
-
target: "_blank",
|
|
426
|
-
children: /* @__PURE__ */ r.jsx(G, { size: 14 })
|
|
427
|
-
}
|
|
428
|
-
)
|
|
429
|
-
] }) : null, c = i ? "div" : f;
|
|
430
|
-
return /* @__PURE__ */ r.jsxs(c, { className: "divide-y overflow-hidden", children: [
|
|
431
|
-
t,
|
|
432
|
-
n.map(
|
|
433
|
-
(a) => o[a] && /* @__PURE__ */ r.jsx("ul", { className: "divide-y", children: o[a].map(([x, y]) => /* @__PURE__ */ r.jsx(
|
|
434
|
-
se,
|
|
435
|
-
{
|
|
436
|
-
name: x,
|
|
437
|
-
schema: y,
|
|
438
|
-
group: a,
|
|
439
|
-
defaultOpen: s
|
|
440
|
-
},
|
|
441
|
-
x
|
|
442
|
-
)) }, a)
|
|
443
|
-
),
|
|
444
|
-
l
|
|
445
|
-
] });
|
|
446
|
-
}
|
|
447
|
-
return null;
|
|
448
|
-
};
|
|
449
|
-
export {
|
|
450
|
-
g as E,
|
|
451
|
-
b as P,
|
|
452
|
-
p as S,
|
|
453
|
-
N as a,
|
|
454
|
-
q as b,
|
|
455
|
-
X as g,
|
|
456
|
-
h as i
|
|
457
|
-
};
|
|
458
|
-
//# sourceMappingURL=SchemaView-D3hm65cc.js.map
|