UNPKG

@sanity/tsdoc

Version:

Generate API reference docs from TypeScript projects and store in a Sanity-friendly JSON format. Render a static frontend, or as React components.

1,052 lines (1,046 loc) 147 kB
import { jsx, jsxs, Fragment } from "react/jsx-runtime"; import { c } from "react/compiler-runtime"; import { useTheme, Box, Heading, Text, TreeItem, Flex, MenuItem, MenuButton, Button, Menu, Tree, Card, Autocomplete, Stack, Popover, Layer, Spinner, Code, Tooltip, Label, Container, usePrefersDark, ThemeProvider, studioTheme } from "@sanity/ui"; import { createContext, useContext, useMemo, useState, useEffect, memo, useRef, forwardRef, StrictMode } from "react"; import { cyan, yellow, green, blue } from "@sanity/color"; import { styled, css } from "styled-components"; import { SelectIcon, SearchIcon, WarningOutlineIcon, InfoOutlineIcon } from "@sanity/icons"; import { PortableText as PortableText$1 } from "@portabletext/react"; import { registerLanguage } from "react-refractor"; import bash from "refractor/bash"; import javascript from "refractor/javascript"; import json from "refractor/json"; import jsx2 from "refractor/jsx"; import typescript from "refractor/typescript"; import { createTSDocMemoryStore } from "@sanity/tsdoc/store"; import { createBrowserHistory } from "history"; import { createRoot } from "react-dom/client"; function parsePath(path, options = {}) { const { basePath = "", version = "0.0.0" } = options, baseSegments = basePath.split("/").filter(Boolean), segments = path.split("/").filter(Boolean).slice(baseSegments.length); let packageScope = null, packageName = null, releaseVersion = null, exportPath = null, memberSlug = null; return packageName = segments.shift() || null, packageName?.startsWith("@") && (packageScope = packageName, packageName = segments.shift() || null), packageName && (releaseVersion = version), releaseVersion && (segments.length > 1 ? (memberSlug = segments.pop() || null, exportPath = `./${segments.join("/")}`) : segments.length === 1 && (memberSlug = segments.pop() || null, exportPath = ".")), { exportPath, packageName, packageScope, releaseVersion, memberSlug }; } const SyntaxText = styled.code(({ $deprecated, $syntax, theme }) => { const { color } = theme.sanity; return css` && { background-color: transparent; color: ${$syntax ? overrideSyntaxColors(color, $syntax) : void 0}; text-decoration: ${$deprecated ? "line-through" : void 0}; } `; }), overrideSyntaxColors = (color, $syntax) => { const isDarkMode = color.dark; switch ($syntax) { case "function": return isDarkMode ? color.syntax[$syntax] : green[700].hex; case "string": return isDarkMode ? color.syntax[$syntax] : yellow[700].hex; case "className": return isDarkMode ? color.syntax[$syntax] : cyan[700].hex; default: return color.syntax[$syntax]; } }; function isArray(val) { return Array.isArray(val); } const LevelContext = createContext(null); function useLevel() { return useContext(LevelContext) || 1; } function addResponsiveProp(a, b) { const _a = isArray(a) ? a : [a], _b = isArray(b) ? b : [b], len = Math.max(_a.length, _b.length), ret = []; for (let i = 0; i < len; i += 1) { const aSize = _a[i] ?? _a[_a.length - 1] ?? 0, bSize = _b[i] ?? _b[_b.length - 1] ?? 0; ret.push(aSize + bSize); } return ret; } const SizeContext = createContext(2); function useSize(props) { const { min = 0, max = 1 / 0, size = 0 } = props || {}, delta = useContext(SizeContext) ?? 0, __cache_key__ = JSON.stringify([size, delta]); return useMemo( () => addResponsiveProp(size, delta).map((s) => Math.min(Math.max(s, min), max)), // Improve performance: Keep object identify for a given hash of the value // eslint-disable-next-line react-hooks/exhaustive-deps [__cache_key__] ); } function useHeadingSize(size) { const $ = c(10), { fonts } = useTheme().sanity, level = useLevel(); let t0, t1; $[0] !== size ? (t1 = isArray(size) ? size : [size], $[0] = size, $[1] = t1) : t1 = $[1]; const s = t1; let t2; if ($[2] !== level || $[3] !== s) { let t32; $[5] !== level ? (t32 = (v) => v - level + 2, $[5] = level, $[6] = t32) : t32 = $[6], t2 = s.map(t32), $[2] = level, $[3] = s, $[4] = t2; } else t2 = $[4]; t0 = t2; const levelSize = t0, t3 = fonts.heading.sizes.length - 1; let t4; return $[7] !== levelSize || $[8] !== t3 ? (t4 = { size: levelSize, min: 0, max: t3 }, $[7] = levelSize, $[8] = t3, $[9] = t4) : t4 = $[9], useSize(t4); } function useSpace(size) { const $ = c(3), { space } = useTheme().sanity, t0 = space.length - 1; let t1; return $[0] !== size || $[1] !== t0 ? (t1 = { size, min: 0, max: t0 }, $[0] = size, $[1] = t0, $[2] = t1) : t1 = $[2], useSize(t1); } function H(props) { const $ = c(14); let restProps, t0; $[0] !== props ? ({ size: t0, ...restProps } = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]); const sizeProp = t0 === void 0 ? 0 : t0, level = useLevel(); let t1; $[3] !== level ? (t1 = level === 1 ? [1, 1, 2, 3] : [2, 2, 3, 4], $[3] = level, $[4] = t1) : t1 = $[4]; const t2 = useSpace(t1); let t3; $[5] === Symbol.for("react.memo_cache_sentinel") ? (t3 = [2, 2, 2, 3], $[5] = t3) : t3 = $[5]; const t4 = useSpace(t3), t5 = `h${level}`, t6 = useHeadingSize(sizeProp); let t7; $[6] !== restProps || $[7] !== t5 || $[8] !== t6 ? (t7 = /* @__PURE__ */ jsx(Heading, { as: t5, ...restProps, size: t6 }), $[6] = restProps, $[7] = t5, $[8] = t6, $[9] = t7) : t7 = $[9]; let t8; return $[10] !== t2 || $[11] !== t4 || $[12] !== t7 ? (t8 = /* @__PURE__ */ jsx(Box, { marginTop: t2, marginBottom: t4, children: t7 }), $[10] = t2, $[11] = t4, $[12] = t7, $[13] = t8) : t8 = $[13], t8; } function Level(props) { const $ = c(3), { children } = props, t0 = useLevel() + 1; let t1; return $[0] !== children || $[1] !== t0 ? (t1 = /* @__PURE__ */ jsx(LevelContext.Provider, { value: t0, children }), $[0] = children, $[1] = t0, $[2] = t1) : t1 = $[2], t1; } function useTextSize(size) { const $ = c(3), { fonts } = useTheme().sanity, t0 = fonts.text.sizes.length - 1; let t1; return $[0] !== size || $[1] !== t0 ? (t1 = { size, min: 0, max: t0 }, $[0] = size, $[1] = t0, $[2] = t1) : t1 = $[2], useSize(t1); } function P(props) { const $ = c(10); let restProps, t0; $[0] !== props ? ({ size: t0, ...restProps } = props, $[0] = props, $[1] = restProps, $[2] = t0) : (restProps = $[1], t0 = $[2]); const sizeProp = t0 === void 0 ? 0 : t0; let t1; $[3] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [-1, -1, -1], $[3] = t1) : t1 = $[3]; const t2 = useSpace(t1), t3 = useTextSize(sizeProp); let t4; $[4] !== restProps || $[5] !== t3 ? (t4 = /* @__PURE__ */ jsx(Text, { as: "p", ...restProps, size: t3 }), $[4] = restProps, $[5] = t3, $[6] = t4) : t4 = $[6]; let t5; return $[7] !== t2 || $[8] !== t4 ? (t5 = /* @__PURE__ */ jsx(Box, { "data-ui": "P", marginTop: t2, children: t4 }), $[7] = t2, $[8] = t4, $[9] = t5) : t5 = $[9], t5; } function Size(props) { const $ = c(3), { delta, children } = props, size = useContext(SizeContext) + delta; let t0; return $[0] !== children || $[1] !== size ? (t0 = /* @__PURE__ */ jsx(SizeContext.Provider, { value: size, children }), $[0] = children, $[1] = size, $[2] = t0) : t0 = $[2], t0; } const TSDocContext = createContext(null); function useTSDoc() { const tsdoc = useContext(TSDocContext); if (!tsdoc) throw new Error("TSDoc: missing context value"); return tsdoc; } function useExports() { const { params, store } = useTSDoc(), [data, setData] = useState(null), [error, setError] = useState(null), [loading, setLoading] = useState(!1); return useEffect(() => { if (!params.packageName || !params.releaseVersion) { setData(null); return; } const queryParams = { packageScope: params.packageScope, packageName: params.packageName, releaseVersion: params.releaseVersion }; let cancelled = !1; async function run() { try { setLoading(!0), setData(null); const data_0 = await store.exports.get(queryParams); cancelled || setData(data_0); } catch (err) { err instanceof Error && !cancelled && setError(err); } finally { cancelled || setLoading(!1); } } return run(), () => { cancelled = !0; }; }, [params.packageScope, params.packageName, params.releaseVersion, store]), { data, error, loading }; } function usePackages() { const { store } = useTSDoc(), [data, setData] = useState(null), [error, setError] = useState(null), [loading, setLoading] = useState(!0); return useEffect(() => { let cancelled = !1; async function run() { try { setData(null); const data_0 = await store.packages.get(); cancelled || setData(data_0); } catch (err) { err instanceof Error && !cancelled && setError(err); } finally { cancelled || setLoading(!1); } } return run(), () => { cancelled = !0; }; }, [store]), { data, error, loading }; } const BoxSticky = memo(styled(Box)` position: sticky; top: 0; `); function getGroupedMembers(members) { const components2 = members.filter((mem) => (mem._type === "api.class" || mem._type === "api.function" || mem._type === "api.variable") && mem.isReactComponentType), hooks = members.filter((mem) => mem._type === "api.function" && mem.isReactHook), classes = members.filter((mem) => !components2.includes(mem) && mem._type === "api.class"), enums = members.filter((mem) => mem._type === "api.enum"), functions = members.filter((mem) => !components2.includes(mem) && !hooks.includes(mem) && mem._type === "api.function"), interfaces = members.filter((mem) => mem._type === "api.interface"), namespaces = members.filter((mem) => mem._type === "api.namespace"), typeAliases = members.filter((mem) => mem._type === "api.typeAlias"), variables = members.filter((mem) => !components2.includes(mem) && mem._type === "api.variable"); return { classes, enums, functions, interfaces, namespaces, reactComponents: components2, reactHooks: hooks, typeAliases, variables }; } const UnformattedCode = styled.code(({ $deprecated }) => css` && { background-color: transparent; color: inherit; text-decoration: ${$deprecated ? "line-through" : void 0}; } `); function TSDocMemberTitle(props) { const $ = c(36), { data } = props, isDeprecated = !!data.comment?.deprecated; if ("isReactComponentType" in data && data.isReactComponentType) { let t02; $[0] === Symbol.for("react.memo_cache_sentinel") ? (t02 = /* @__PURE__ */ jsx(UnformattedCode, { children: "<" }), $[0] = t02) : t02 = $[0]; let t1; $[1] !== data.name || $[2] !== isDeprecated ? (t1 = /* @__PURE__ */ jsx(SyntaxText, { $deprecated: isDeprecated, $syntax: "className", children: data.name }), $[1] = data.name, $[2] = isDeprecated, $[3] = t1) : t1 = $[3]; let t2; $[4] !== isDeprecated ? (t2 = /* @__PURE__ */ jsx(UnformattedCode, { $deprecated: isDeprecated, children: " />" }), $[4] = isDeprecated, $[5] = t2) : t2 = $[5]; let t3; return $[6] !== t1 || $[7] !== t2 ? (t3 = /* @__PURE__ */ jsxs(Fragment, { children: [ t02, t1, t2 ] }), $[6] = t1, $[7] = t2, $[8] = t3) : t3 = $[8], t3; } if (data._type === "api.class") { let t02; return $[9] !== data.name || $[10] !== isDeprecated ? (t02 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(SyntaxText, { $deprecated: isDeprecated, $syntax: "className", children: data.name }) }), $[9] = data.name, $[10] = isDeprecated, $[11] = t02) : t02 = $[11], t02; } if (data._type === "api.enum") { let t02; return $[12] !== data.name || $[13] !== isDeprecated ? (t02 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(SyntaxText, { $deprecated: isDeprecated, $syntax: "className", children: data.name }) }), $[12] = data.name, $[13] = isDeprecated, $[14] = t02) : t02 = $[14], t02; } if (data._type === "api.function") { let t02; $[15] !== data.name || $[16] !== isDeprecated ? (t02 = /* @__PURE__ */ jsx(SyntaxText, { $deprecated: isDeprecated, $syntax: "function", children: data.name }), $[15] = data.name, $[16] = isDeprecated, $[17] = t02) : t02 = $[17]; let t1; $[18] !== isDeprecated ? (t1 = /* @__PURE__ */ jsx(UnformattedCode, { $deprecated: isDeprecated, children: "()" }), $[18] = isDeprecated, $[19] = t1) : t1 = $[19]; let t2; return $[20] !== t02 || $[21] !== t1 ? (t2 = /* @__PURE__ */ jsxs(Fragment, { children: [ t02, t1 ] }), $[20] = t02, $[21] = t1, $[22] = t2) : t2 = $[22], t2; } if (data._type === "api.interface") { let t02; return $[23] !== data.name || $[24] !== isDeprecated ? (t02 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(SyntaxText, { $deprecated: isDeprecated, $syntax: "className", children: data.name }) }), $[23] = data.name, $[24] = isDeprecated, $[25] = t02) : t02 = $[25], t02; } if (data._type === "api.namespace") { let t02; return $[26] !== data.name || $[27] !== isDeprecated ? (t02 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(SyntaxText, { $deprecated: isDeprecated, $syntax: "className", children: data.name }) }), $[26] = data.name, $[27] = isDeprecated, $[28] = t02) : t02 = $[28], t02; } if (data._type === "api.typeAlias") { let t02; return $[29] !== data.name || $[30] !== isDeprecated ? (t02 = /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(SyntaxText, { $deprecated: isDeprecated, $syntax: "className", children: data.name }) }), $[29] = data.name, $[30] = isDeprecated, $[31] = t02) : t02 = $[31], t02; } if (data._type === "api.variable") { let t02; return $[32] !== data.name || $[33] !== isDeprecated ? (t02 = /* @__PURE__ */ jsx(UnformattedCode, { $deprecated: isDeprecated, children: data.name }), $[32] = data.name, $[33] = isDeprecated, $[34] = t02) : t02 = $[34], t02; } let t0; return $[35] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx(Fragment, { children: "Uknown" }), $[35] = t0) : t0 = $[35], t0; } function compilePath(params) { const segments = []; return params.packageName && (params.packageScope && segments.push(params.packageScope), segments.push(params.packageName), params.releaseVersion && params.exportPath && (params.exportPath !== "." && segments.push(params.exportPath.slice(2)), params.memberSlug && segments.push(params.memberSlug))), `/${segments.join("/")}`; } function useMemberLink(props) { const $ = c(8), { params } = props, { basePath, onPathChange } = useTSDoc(); let t0; $[0] !== params ? (t0 = params && compilePath(params), $[0] = params, $[1] = t0) : t0 = $[1]; const path = t0; let t1; t1 = `${basePath}${path || ""}`; const href = t1; let t2; $[2] !== onPathChange || $[3] !== path ? (t2 = (event) => { path && (event.preventDefault(), onPathChange(path)); }, $[2] = onPathChange, $[3] = path, $[4] = t2) : t2 = $[4]; const onClick = t2; let t3; return $[5] !== href || $[6] !== onClick ? (t3 = { href, onClick }, $[5] = href, $[6] = onClick, $[7] = t3) : t3 = $[7], t3; } const SyntaxTreeItem = memo(styled(TreeItem)(({ theme }) => { const isThemeDark = theme.sanity.color.dark, activeBackground = blue[50].hex, focusBackground = theme.sanity.color.selectable.default.enabled.bg2, color = theme.sanity.color.selectable.default.hovered.fg, selectedLight = isThemeDark ? "" : `&[data-selected] > [role='treeitem'] { background-color: ${activeBackground} !important }`; return ` // solely on changing the "()" color &:focus code, & > a:focus code { color: ${color} !important; } ${selectedLight} // change focus for api items trees & > a:focus { background-color: ${focusBackground} !important; } `; })); function MemberLink(props) { const { data, namespace } = props, { basePath, path } = useTSDoc(), fontSize = useSize(), params = useMemo(() => ({ exportPath: data.export?.path || namespace?.export.path || ".", memberName: data.name, packageName: data.package.name, packageScope: data.package.scope || null, releaseVersion: data.release.version, memberSlug: data.slug.current }), [data, namespace]), linkProps = useMemberLink({ params }), tone = useMemo(() => { if (data.releaseTag === "beta") return "caution"; if (data.releaseTag === "alpha") return "critical"; }, [data.releaseTag]), tag = useMemo(() => data.releaseTag === "beta" ? /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(SyntaxText, { $syntax: "string", children: "@beta" }) }) : data.releaseTag === "alpha" ? /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(SyntaxText, { $syntax: "builtin", children: "@alpha" }) }) : null, [data.releaseTag]), isSelected = `${basePath}${path}` === linkProps.href; return /* @__PURE__ */ jsx( SyntaxTreeItem, { ...linkProps, fontSize, padding: 2, selected: isSelected, text: /* @__PURE__ */ jsxs(Flex, { gap: 1, children: [ /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(TSDocMemberTitle, { data }) }), tag ] }), tone } ); } const TreeItemFocus = memo(styled(TreeItem)(({ theme }) => ` &:focus > [data-ui='TreeItem__box'], &:focus > [data-ui="TreeItem"] { background-color: transparent !important; & svg, & code, & [data-ui="Text"] { color: ${theme.sanity.color.selectable.default.enabled.fg} !important; } } `)); function GroupedMembersTree(props) { const $ = c(55), { exp, expandSubPackages } = props, { params } = useTSDoc(), fontSize = useSize(); let t0; $[0] !== exp.reactComponents || $[1] !== expandSubPackages || $[2] !== fontSize || $[3] !== params ? (t0 = exp.reactComponents.length > 0 && /* @__PURE__ */ jsx(TreeItemFocus, { expanded: expandSubPackages || exp.reactComponents.some((m) => m.name === params.memberName), fontSize, padding: 2, text: "Components", weight: "semibold", children: exp.reactComponents.map(_temp$a) }), $[0] = exp.reactComponents, $[1] = expandSubPackages, $[2] = fontSize, $[3] = params, $[4] = t0) : t0 = $[4]; let t1; $[5] !== exp.reactHooks || $[6] !== expandSubPackages || $[7] !== fontSize || $[8] !== params ? (t1 = exp.reactHooks.length > 0 && /* @__PURE__ */ jsx(TreeItemFocus, { expanded: expandSubPackages || exp.reactHooks.some((m_0) => m_0.name === params.memberName), fontSize, padding: 2, text: "Hooks", weight: "semibold", children: exp.reactHooks.map(_temp2$5) }), $[5] = exp.reactHooks, $[6] = expandSubPackages, $[7] = fontSize, $[8] = params, $[9] = t1) : t1 = $[9]; let t2; $[10] !== exp.classes || $[11] !== expandSubPackages || $[12] !== fontSize || $[13] !== params ? (t2 = exp.classes.length > 0 && /* @__PURE__ */ jsx(TreeItemFocus, { expanded: expandSubPackages || exp.classes.some((m_1) => m_1.name === params.memberName), fontSize, padding: 2, text: "Classes", weight: "semibold", children: exp.classes.map(_temp3$2) }), $[10] = exp.classes, $[11] = expandSubPackages, $[12] = fontSize, $[13] = params, $[14] = t2) : t2 = $[14]; let t3; $[15] !== exp.functions || $[16] !== expandSubPackages || $[17] !== fontSize || $[18] !== params ? (t3 = exp.functions.length > 0 && /* @__PURE__ */ jsx(TreeItemFocus, { expanded: expandSubPackages || exp.functions.some((m_2) => m_2.name === params.memberName), fontSize, padding: 2, text: "Functions", weight: "semibold", children: exp.functions.map(_temp4$2) }), $[15] = exp.functions, $[16] = expandSubPackages, $[17] = fontSize, $[18] = params, $[19] = t3) : t3 = $[19]; let t4; $[20] !== exp.variables || $[21] !== expandSubPackages || $[22] !== fontSize || $[23] !== params ? (t4 = exp.variables.length > 0 && /* @__PURE__ */ jsx(TreeItemFocus, { expanded: expandSubPackages || exp.variables.some((m_3) => m_3.name === params.memberName), fontSize, padding: 2, text: "Variables", weight: "semibold", children: exp.variables.map(_temp5$1) }), $[20] = exp.variables, $[21] = expandSubPackages, $[22] = fontSize, $[23] = params, $[24] = t4) : t4 = $[24]; let t5; $[25] !== exp.enums || $[26] !== expandSubPackages || $[27] !== fontSize || $[28] !== params ? (t5 = exp.enums.length > 0 && /* @__PURE__ */ jsx(TreeItemFocus, { expanded: expandSubPackages || exp.enums.some((m_4) => m_4.name === params.memberName), fontSize, padding: 2, text: "Enumerations", weight: "semibold", children: exp.enums.map(_temp6) }), $[25] = exp.enums, $[26] = expandSubPackages, $[27] = fontSize, $[28] = params, $[29] = t5) : t5 = $[29]; let t6; $[30] !== exp.interfaces || $[31] !== expandSubPackages || $[32] !== fontSize || $[33] !== params ? (t6 = exp.interfaces.length > 0 && /* @__PURE__ */ jsx(TreeItemFocus, { expanded: expandSubPackages || exp.interfaces.some((m_5) => m_5.name === params.memberName), fontSize, padding: 2, text: "Interfaces", weight: "semibold", children: exp.interfaces.map(_temp7) }), $[30] = exp.interfaces, $[31] = expandSubPackages, $[32] = fontSize, $[33] = params, $[34] = t6) : t6 = $[34]; let t7; $[35] !== exp.namespaces || $[36] !== expandSubPackages || $[37] !== fontSize || $[38] !== params ? (t7 = exp.namespaces.length > 0 && /* @__PURE__ */ jsx(TreeItemFocus, { expanded: expandSubPackages || exp.namespaces.some((m_6) => m_6.name === params.memberName), fontSize, padding: 2, text: "Namespaces", weight: "semibold", children: exp.namespaces.map(_temp8) }), $[35] = exp.namespaces, $[36] = expandSubPackages, $[37] = fontSize, $[38] = params, $[39] = t7) : t7 = $[39]; let t8; $[40] !== exp.typeAliases || $[41] !== expandSubPackages || $[42] !== fontSize || $[43] !== params ? (t8 = exp.typeAliases.length > 0 && /* @__PURE__ */ jsx(TreeItemFocus, { expanded: expandSubPackages || exp.typeAliases.some((m_7) => m_7.name === params.memberName), fontSize, padding: 2, text: "Type aliases", weight: "semibold", children: exp.typeAliases.map(_temp9) }), $[40] = exp.typeAliases, $[41] = expandSubPackages, $[42] = fontSize, $[43] = params, $[44] = t8) : t8 = $[44]; let t9; return $[45] !== t0 || $[46] !== t1 || $[47] !== t2 || $[48] !== t3 || $[49] !== t4 || $[50] !== t5 || $[51] !== t6 || $[52] !== t7 || $[53] !== t8 ? (t9 = /* @__PURE__ */ jsxs(Fragment, { children: [ t0, t1, t2, t3, t4, t5, t6, t7, t8 ] }), $[45] = t0, $[46] = t1, $[47] = t2, $[48] = t3, $[49] = t4, $[50] = t5, $[51] = t6, $[52] = t7, $[53] = t8, $[54] = t9) : t9 = $[54], t9; } function _temp9(member_7) { return /* @__PURE__ */ jsx(MemberLink, { data: member_7 }, member_7.name); } function _temp8(member_6) { return /* @__PURE__ */ jsx(MemberLink, { data: member_6 }, member_6.name); } function _temp7(member_5) { return /* @__PURE__ */ jsx(MemberLink, { data: member_5 }, member_5.name); } function _temp6(member_4) { return /* @__PURE__ */ jsx(MemberLink, { data: member_4 }, member_4.name); } function _temp5$1(member_3) { return /* @__PURE__ */ jsx(MemberLink, { data: member_3 }, member_3.name); } function _temp4$2(member_2) { return /* @__PURE__ */ jsx(MemberLink, { data: member_2 }, member_2.name); } function _temp3$2(member_1) { return /* @__PURE__ */ jsx(MemberLink, { data: member_1 }, member_1.name); } function _temp2$5(member_0) { return /* @__PURE__ */ jsx(MemberLink, { data: member_0 }, member_0.name); } function _temp$a(member) { return /* @__PURE__ */ jsx(MemberLink, { data: member }, member.name); } const SyntaxMenuItem = memo(styled(MenuItem)` &:focus code, & > a:focus code { color: inherit !important; } & > a:focus { background: transparent !important; } `); function PackageMenuButton(props) { const $ = c(21), { currentPkg, packages } = props, { updateParams } = useTSDoc(), fontSize = useSize(); let t0; $[0] !== currentPkg.name || $[1] !== currentPkg.scope ? (t0 = [currentPkg.scope, currentPkg.name].filter(Boolean), $[0] = currentPkg.name, $[1] = currentPkg.scope, $[2] = t0) : t0 = $[2]; const t1 = t0.join("/"); let t2; $[3] !== t1 ? (t2 = /* @__PURE__ */ jsx(SyntaxText, { children: t1 }), $[3] = t1, $[4] = t2) : t2 = $[4]; let t3; $[5] !== fontSize || $[6] !== t2 ? (t3 = /* @__PURE__ */ jsx(Button, { fontSize, iconRight: SelectIcon, mode: "bleed", padding: 2, text: t2 }), $[5] = fontSize, $[6] = t2, $[7] = t3) : t3 = $[7]; let t4; if ($[8] !== fontSize || $[9] !== packages || $[10] !== updateParams) { let t52; $[12] !== fontSize || $[13] !== updateParams ? (t52 = (p) => /* @__PURE__ */ jsx(SyntaxMenuItem, { fontSize, onClick: () => { updateParams((prev) => ({ ...prev, exportPath: null, packageScope: p.scope || null, packageName: p.name, releaseVersion: p.latestRelease.version, memberName: null })); }, padding: 2, text: /* @__PURE__ */ jsx(SyntaxText, { children: [p.scope, p.name].filter(Boolean).join("/") }) }, p.name), $[12] = fontSize, $[13] = updateParams, $[14] = t52) : t52 = $[14], t4 = packages.map(t52), $[8] = fontSize, $[9] = packages, $[10] = updateParams, $[11] = t4; } else t4 = $[11]; let t5; $[15] !== t4 ? (t5 = /* @__PURE__ */ jsx(Menu, { children: t4 }), $[15] = t4, $[16] = t5) : t5 = $[16]; let t6; $[17] === Symbol.for("react.memo_cache_sentinel") ? (t6 = { constrainSize: !0, matchReferenceWidth: !0, portal: !0 }, $[17] = t6) : t6 = $[17]; let t7; return $[18] !== t3 || $[19] !== t5 ? (t7 = /* @__PURE__ */ jsx(MenuButton, { button: t3, id: "package-menu", menu: t5, popover: t6 }), $[18] = t3, $[19] = t5, $[20] = t7) : t7 = $[20], t7; } function PackageTreeItem(props) { const $ = c(23); let pkg, restProps; $[0] !== props ? ({ pkg, ...restProps } = props, $[0] = props, $[1] = pkg, $[2] = restProps) : (pkg = $[1], restProps = $[2]); const { params, updateParams } = useTSDoc(), t0 = pkg.scope || null; let t1; $[3] !== params || $[4] !== pkg.latestRelease.version || $[5] !== pkg.name || $[6] !== t0 ? (t1 = compilePath({ ...params, packageScope: t0, packageName: pkg.name, releaseVersion: pkg.latestRelease.version }), $[3] = params, $[4] = pkg.latestRelease.version, $[5] = pkg.name, $[6] = t0, $[7] = t1) : t1 = $[7]; const href = t1; let t2; $[8] !== pkg.latestRelease.version || $[9] !== pkg.name || $[10] !== pkg.scope || $[11] !== updateParams ? (t2 = (event) => { event.preventDefault(), updateParams((prev) => ({ ...prev, packageScope: pkg.scope || null, packageName: pkg.name, releaseVersion: pkg.latestRelease.version })); }, $[8] = pkg.latestRelease.version, $[9] = pkg.name, $[10] = pkg.scope, $[11] = updateParams, $[12] = t2) : t2 = $[12]; const handleClick = t2; let t3; $[13] !== pkg.name || $[14] !== pkg.scope ? (t3 = [pkg.scope, pkg.name].filter(Boolean), $[13] = pkg.name, $[14] = pkg.scope, $[15] = t3) : t3 = $[15]; const t4 = t3.join("/"); let t5; $[16] !== t4 ? (t5 = /* @__PURE__ */ jsx(SyntaxText, { children: t4 }), $[16] = t4, $[17] = t5) : t5 = $[17]; let t6; return $[18] !== handleClick || $[19] !== href || $[20] !== restProps || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsx(SyntaxTreeItem, { ...restProps, href, onClick: handleClick, text: t5 }), $[18] = handleClick, $[19] = href, $[20] = restProps, $[21] = t5, $[22] = t6) : t6 = $[22], t6; } function ReleaseMenuButton(props) { const $ = c(20), { currentPkg, currentRelease } = props, { updateParams } = useTSDoc(), fontSize = useSize(); let t0; $[0] !== currentRelease.version ? (t0 = /* @__PURE__ */ jsx(SyntaxText, { $syntax: "className", children: currentRelease.version }), $[0] = currentRelease.version, $[1] = t0) : t0 = $[1]; let t1; $[2] !== fontSize || $[3] !== t0 ? (t1 = /* @__PURE__ */ jsx(Button, { fontSize, iconRight: SelectIcon, mode: "bleed", padding: 2, text: t0 }), $[2] = fontSize, $[3] = t0, $[4] = t1) : t1 = $[4]; let t2; if ($[5] !== currentPkg.releases || $[6] !== currentRelease.version || $[7] !== fontSize || $[8] !== updateParams) { let t32; $[10] !== currentRelease.version || $[11] !== fontSize || $[12] !== updateParams ? (t32 = (r) => /* @__PURE__ */ jsx(SyntaxMenuItem, { fontSize, onClick: () => updateParams((prev) => ({ ...prev, releaseVersion: r.version })), padding: 2, selected: currentRelease.version === r.version, text: /* @__PURE__ */ jsx(SyntaxText, { $syntax: "className", children: r.version }) }, r.version), $[10] = currentRelease.version, $[11] = fontSize, $[12] = updateParams, $[13] = t32) : t32 = $[13], t2 = currentPkg.releases.map(t32), $[5] = currentPkg.releases, $[6] = currentRelease.version, $[7] = fontSize, $[8] = updateParams, $[9] = t2; } else t2 = $[9]; let t3; $[14] !== t2 ? (t3 = /* @__PURE__ */ jsx(Menu, { children: t2 }), $[14] = t2, $[15] = t3) : t3 = $[15]; let t4; $[16] === Symbol.for("react.memo_cache_sentinel") ? (t4 = { constrainSize: !0, matchReferenceWidth: !0, portal: !0 }, $[16] = t4) : t4 = $[16]; let t5; return $[17] !== t1 || $[18] !== t3 ? (t5 = /* @__PURE__ */ jsx(MenuButton, { button: t1, id: "version-menu", menu: t3, popover: t4 }), $[17] = t1, $[18] = t3, $[19] = t5) : t5 = $[19], t5; } const SearchWrapper = memo(styled(Box)` background-color: var(--card-bg-color); `), TreeNav = memo(styled(Tree)` overflow: auto; height: 100vh; `), DEBOUNCE_MS = 150; function useSymbolSearch(props) { const { query } = props, { params, store } = useTSDoc(), [data, setData] = useState([]), [error, setError] = useState(null), [loading, setLoading] = useState(!1), [debouncedQuery, setDebouncedQuery] = useState(query), timeoutRef = useRef(null); return useEffect(() => { let cancelled = !1; async function run() { if (!debouncedQuery || !params.packageName) { setData([]); return; } try { setLoading(!0); const data_0 = await store.symbol.search({ query: debouncedQuery, packageName: params.packageName, packageScope: params.packageScope }); cancelled || (setLoading(!1), setData(data_0)); } catch (err) { err instanceof Error && !cancelled && setError(err); } finally { cancelled || setLoading(!1); } setLoading(!1); } return run(), () => { cancelled = !0; }; }, [debouncedQuery, params.packageName, params.packageScope, store]), useEffect(() => { timeoutRef.current && clearTimeout(timeoutRef.current), timeoutRef.current = setTimeout(() => { setDebouncedQuery(query), timeoutRef.current = null; }, DEBOUNCE_MS); }, [query]), { data, error, loading }; } function TSDocSearch() { const $ = c(13), [query, setQuery] = useState(null); let t0; $[0] !== query ? (t0 = { query }, $[0] = query, $[1] = t0) : t0 = $[1]; const { data, loading } = useSymbolSearch(t0), [value, setValue] = useState(), autocompletePopoverReferenceElementRef = useRef(null); let t1, t2; $[2] !== data ? (t2 = data.map(_temp$9), $[2] = data, $[3] = t2) : t2 = $[3], t1 = t2; const options = t1, filterOption = _temp2$4; let t3; $[4] === Symbol.for("react.memo_cache_sentinel") ? (t3 = (value_0) => { setValue(value_0), setTimeout(() => setValue(""), 0); }, $[4] = t3) : t3 = $[4]; const handleSelect = t3, renderOption = _temp3$1, renderValue = _temp4$1; let t4; $[5] !== loading || $[6] !== query ? (t4 = (t52) => { const { content, hidden } = t52; return query ? /* @__PURE__ */ jsx(Popover, { arrow: !1, open: !loading && !hidden, overflow: "auto", placement: "bottom-start", matchReferenceWidth: !0, radius: 0, content: content || /* @__PURE__ */ jsx(Box, { padding: 4, children: /* @__PURE__ */ jsx(Flex, { align: "center", height: "fill", justify: "center", children: /* @__PURE__ */ jsxs(Text, { align: "center", muted: !0, children: [ "No results for ", /* @__PURE__ */ jsxs("strong", { children: [ "\u201C", query, "\u201D" ] }) ] }) }) }), referenceElement: autocompletePopoverReferenceElementRef.current }) : null; }, $[5] = loading, $[6] = query, $[7] = t4) : t4 = $[7]; const renderPopover = t4; let t5; return $[8] !== loading || $[9] !== options || $[10] !== renderPopover || $[11] !== value ? (t5 = /* @__PURE__ */ jsx("div", { ref: autocompletePopoverReferenceElementRef, children: /* @__PURE__ */ jsx(Autocomplete, { filterOption, icon: SearchIcon, id: "tsdoc-search", loading, onQueryChange: setQuery, onSelect: handleSelect, options, padding: 3, placeholder: "Search for API members", radius: 2, renderOption, renderValue, renderPopover, value }) }), $[8] = loading, $[9] = options, $[10] = renderPopover, $[11] = value, $[12] = t5) : t5 = $[12], t5; } function _temp4$1() { return ""; } function _temp3$1(option) { return /* @__PURE__ */ jsx(SearchOption, { symbol: option.symbol }); } function _temp2$4() { return !0; } function _temp$9(result) { return { value: result._id, symbol: result }; } const SearchOption = forwardRef(function(props, ref) { const $ = c(29); let restProps, symbol; $[0] !== props ? ({ symbol, ...restProps } = props, $[0] = props, $[1] = restProps, $[2] = symbol) : (restProps = $[1], symbol = $[2]); const latestMember = symbol.members[0]; let t0; const t1 = latestMember ? latestMember.exportPath : ".", t2 = symbol.package.scope || null, t3 = latestMember ? latestMember.releaseVersion : "0.0.0", t4 = latestMember ? latestMember.slug.current : ""; let t5; $[3] !== symbol.name || $[4] !== symbol.package.name || $[5] !== t1 || $[6] !== t2 || $[7] !== t3 || $[8] !== t4 ? (t5 = { exportPath: t1, packageName: symbol.package.name, packageScope: t2, memberName: symbol.name, releaseVersion: t3, memberSlug: t4 }, $[3] = symbol.name, $[4] = symbol.package.name, $[5] = t1, $[6] = t2, $[7] = t3, $[8] = t4, $[9] = t5) : t5 = $[9], t0 = t5; const params = t0; let t6; $[10] !== params ? (t6 = { params }, $[10] = params, $[11] = t6) : t6 = $[11]; const link = useMemberLink(t6); let t7; $[12] !== symbol.name ? (t7 = /* @__PURE__ */ jsx(Text, { size: 1, weight: "medium", children: /* @__PURE__ */ jsx(UnformattedCode, { children: symbol.name }) }), $[12] = symbol.name, $[13] = t7) : t7 = $[13]; let t8; $[14] !== latestMember?.exportPath ? (t8 = latestMember?.exportPath === "." ? void 0 : latestMember?.exportPath.replace("./", "/"), $[14] = latestMember?.exportPath, $[15] = t8) : t8 = $[15]; let t9; $[16] !== symbol.package.name || $[17] !== symbol.package.scope || $[18] !== t8 ? (t9 = /* @__PURE__ */ jsx(Text, { muted: !0, size: 1, children: /* @__PURE__ */ jsx(UnformattedCode, { children: [[symbol.package.scope, symbol.package.name, t8].filter(Boolean)] }) }), $[16] = symbol.package.name, $[17] = symbol.package.scope, $[18] = t8, $[19] = t9) : t9 = $[19]; let t10; $[20] !== t7 || $[21] !== t9 ? (t10 = /* @__PURE__ */ jsxs(Stack, { space: 3, children: [ t7, t9 ] }), $[20] = t7, $[21] = t9, $[22] = t10) : t10 = $[22]; let t11; return $[23] !== link.href || $[24] !== link.onClick || $[25] !== ref || $[26] !== restProps || $[27] !== t10 ? (t11 = /* @__PURE__ */ jsx(Card, { ...restProps, as: "a", href: link.href, onClick: link.onClick, padding: 3, radius: 2, ref, children: t10 }), $[23] = link.href, $[24] = link.onClick, $[25] = ref, $[26] = restProps, $[27] = t10, $[28] = t11) : t11 = $[28], t11; }); function TSDocNav(props) { const $ = c(2); let t0; return $[0] !== props ? (t0 = /* @__PURE__ */ jsx(Size, { delta: -1, children: /* @__PURE__ */ jsx(TSDocNavView, { ...props }) }), $[0] = props, $[1] = t0) : t0 = $[1], t0; } function TSDocNavView(props) { const $ = c(29), { params } = useTSDoc(), _exports = useExports(), packages = usePackages(), fontSize = useSize(), { showVersionMenu, expandPackages, expandSubPackages } = props; let currentPkg, t0; $[0] !== packages.data || $[1] !== params ? (currentPkg = packages.data?.find((p) => p.scope === params.packageScope && p.name === params.packageName), t0 = currentPkg?.releases.length ? currentPkg?.releases.find((r) => params.releaseVersion ? r.version === params.releaseVersion : r.version == currentPkg.latestRelease.version) : currentPkg?.latestRelease, $[0] = packages.data, $[1] = params, $[2] = currentPkg, $[3] = t0) : (currentPkg = $[2], t0 = $[3]); const currentRelease = t0, currentVersion = currentRelease?.version; let t1; $[4] !== currentPkg || $[5] !== params ? (t1 = currentPkg && params.exportPath && [currentPkg.scope, currentPkg.name, params.exportPath].filter(Boolean).join("/"), $[4] = currentPkg, $[5] = params, $[6] = t1) : t1 = $[6]; const currentExportName = t1; let t2; bb0: { if (!_exports.data) { let t33; $[7] === Symbol.for("react.memo_cache_sentinel") ? (t33 = [], $[7] = t33) : t33 = $[7], t2 = t33; break bb0; } let t32; if ($[8] !== _exports.data) { const items = []; for (const exp of _exports.data) { if (exp.members.length === 0) continue; const { members, name, package: pkg, ...restExp } = exp, item = items.find((e) => e.packageScope === pkg.scope && e.packageName === pkg.name && e.name === exp.name), data = { name, package: pkg, ...restExp, ...getGroupedMembers(members) }; item ? item.versions.push(data) : items.push({ packageScope: pkg.scope, packageName: pkg.name, name, versions: [data] }); } t32 = items || [], $[8] = _exports.data, $[9] = t32; } else t32 = $[9]; t2 = t32; } const exports = t2; let t3; $[10] !== currentPkg || $[11] !== fontSize || $[12] !== packages ? (t3 = !currentPkg && !packages.loading && /* @__PURE__ */ jsx(Card, { overflow: "auto", padding: 3, children: /* @__PURE__ */ jsxs(Stack, { space: 1, children: [ /* @__PURE__ */ jsx(Box, { padding: 2, children: /* @__PURE__ */ jsx(Text, { size: fontSize, weight: "bold", children: "Choose package" }) }), /* @__PURE__ */ jsx(Tree, { children: packages.data?.map((pkg_0) => /* @__PURE__ */ jsx(PackageTreeItem, { pkg: pkg_0, fontSize, padding: 2 }, pkg_0.name)) }) ] }) }), $[10] = currentPkg, $[11] = fontSize, $[12] = packages, $[13] = t3) : t3 = $[13]; let t4; $[14] !== _exports || $[15] !== currentExportName || $[16] !== currentPkg || $[17] !== currentRelease || $[18] !== currentVersion || $[19] !== expandPackages || $[20] !== expandSubPackages || $[21] !== exports || $[22] !== fontSize || $[23] !== packages || $[24] !== showVersionMenu ? (t4 = currentPkg && /* @__PURE__ */ jsxs(Fragment, { children: [ showVersionMenu && /* @__PURE__ */ jsx(Layer, { style: { flex: "none", position: "sticky", top: 0 }, children: /* @__PURE__ */ jsx(Card, { padding: [2, 2, 3], shadow: 1, children: /* @__PURE__ */ jsxs(Flex, { gap: 1, children: [ packages.data && /* @__PURE__ */ jsx(Stack, { flex: 1, children: /* @__PURE__ */ jsx(PackageMenuButton, { currentPkg, packages: packages.data }) }), currentRelease && /* @__PURE__ */ jsx(Stack, { flex: "none", children: /* @__PURE__ */ jsx(ReleaseMenuButton, { currentPkg, currentRelease }) }) ] }) }) }), _exports.loading && /* @__PURE__ */ jsx(Flex, { align: "center", height: "fill", justify: "center", children: /* @__PURE__ */ jsx(Spinner, { muted: !0 }) }), !_exports.loading && /* @__PURE__ */ jsxs(Stack, { flex: 1, overflow: "auto", children: [ currentPkg && /* @__PURE__ */ jsx(SearchWrapper, { padding: 1, children: /* @__PURE__ */ jsx(TSDocSearch, {}) }), exports.length === 1 ? /* @__PURE__ */ jsx(SingleExportTree, { currentVersion, exp: exports[0] }) : /* @__PURE__ */ jsx(MultiExportTree, { currentExportName, currentVersion, exports, fontSize, expandPackages, expandSubPackages }) ] }) ] }), $[14] = _exports, $[15] = currentExportName, $[16] = currentPkg, $[17] = currentRelease, $[18] = currentVersion, $[19] = expandPackages, $[20] = expandSubPackages, $[21] = exports, $[22] = fontSize, $[23] = packages, $[24] = showVersionMenu, $[25] = t4) : t4 = $[25]; let t5; return $[26] !== t3 || $[27] !== t4 ? (t5 = /* @__PURE__ */ jsx(BoxSticky, { paddingTop: 3, children: /* @__PURE__ */ jsxs(Flex, { direction: "column", height: "fill", overflow: "hidden", children: [ t3, t4 ] }) }), $[26] = t3, $[27] = t4, $[28] = t5) : t5 = $[28], t5; } function SingleExportTree(props) { const { currentVersion, exp } = props, versionedExports = useMemo(() => exp.versions.filter((d) => d.release.version === currentVersion), [currentVersion, exp]); return /* @__PURE__ */ jsx(TreeNav, { children: versionedExports.map((exp_0) => /* @__PURE__ */ jsx(GroupedMembersTree, { exp: exp_0 }, exp_0.release.version)) }); } function MultiExportTree(props) { const { currentExportName, currentVersion, fontSize, exports, expandPackages, expandSubPackages } = props, versionedExports = useMemo(() => exports.filter((data) => data.versions.some((v) => v.release.version === currentVersion)), [currentVersion, exports]); return /* @__PURE__ */ jsx(TreeNav, { children: versionedExports.map((data_0) => /* @__PURE__ */ jsx(TreeItemFocus, { expanded: expandPackages || data_0.name === currentExportName, tabIndex: 0, fontSize, padding: 2, text: /* @__PURE__ */ jsx(SyntaxText, { children: data_0.name }), weight: "semibold", children: data_0.versions.filter((d) => d.release.version === currentVersion).map((exp) => /* @__PURE__ */ jsx(GroupedMembersTree, { exp, expandSubPackages }, exp.release.version)) }, data_0.name)) }); } const CommentBox = styled(Box)` /* border-top: 1px solid var(--card-border-color); */ & > *:first-child { margin-top: 0 !important; } & > *:last-child { margin-bottom: 0 !important; } `, CODE_LANGUAGES = { sh: "bash", tsx: "typescript", ts: "typescript" }; function PortableText(props) { const $ = c(2), { blocks } = props; let t0; return $[0] !== blocks ? (t0 = /* @__PURE__ */ jsx(PortableText$1, { components, value: blocks }), $[0] = blocks, $[1] = t0) : t0 = $[1], t0; } const components = { block: { blockquote: BlockquoteBlock, h1: H1Block, h2: H2Block, h3: H3Block, h4: H4Block, h5: H5Block, h6: H6Block, normal: NormalBlock }, types: { code: CodeBlock }, marks: { link: Link } }; function CodeBlock(props) { const $ = c(9), { code, language: t0 } = props.value, language = t0 === void 0 ? "typescript" : t0; let t1; $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [1, 1, 2, 3], $[0] = t1) : t1 = $[0]; const t2 = useSpace(t1), t3 = CODE_LANGUAGES[language] || language || "typescript"; let t4; $[1] === Symbol.for("react.memo_cache_sentinel") ? (t4 = [-1, -1, 0], $[1] = t4) : t4 = $[1]; const t5 = useTextSize(t4); let t6; $[2] !== code || $[3] !== t3 || $[4] !== t5 ? (t6 = /* @__PURE__ */ jsx(Code, { language: t3, size: t5, children: code }), $[2] = code, $[3] = t3, $[4] = t5, $[5] = t6) : t6 = $[5]; let t7; return $[6] !== t2 || $[7] !== t6 ? (t7 = /* @__PURE__ */ jsx(Card, { border: !0, marginY: t2, overflow: "auto", padding: 4, radius: 3, tone: "inherit", children: t6 }), $[6] = t2, $[7] = t6, $[8] = t7) : t7 = $[8], t7; } function H1Block(t0) { const $ = c(3), { children } = t0; let t1; $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [-1, 0, 1, 2], $[0] = t1) : t1 = $[0]; let t2; return $[1] !== children ? (t2 = /* @__PURE__ */ jsx(H, { size: t1, children }), $[1] = children, $[2] = t2) : t2 = $[2], t2; } function H2Block(t0) { const $ = c(3), { children } = t0; let t1; $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [-1, 0, 1, 2], $[0] = t1) : t1 = $[0]; let t2; return $[1] !== children ? (t2 = /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(H, { size: t1, children }) }), $[1] = children, $[2] = t2) : t2 = $[2], t2; } function H3Block(t0) { const $ = c(3), { children } = t0; let t1; $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [-1, 0, 1, 2], $[0] = t1) : t1 = $[0]; let t2; return $[1] !== children ? (t2 = /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(H, { size: t1, children }) }) }), $[1] = children, $[2] = t2) : t2 = $[2], t2; } function H4Block(t0) { const $ = c(3), { children } = t0; let t1; $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [-1, 0, 1, 2], $[0] = t1) : t1 = $[0]; let t2; return $[1] !== children ? (t2 = /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(H, { size: t1, children }) }) }) }), $[1] = children, $[2] = t2) : t2 = $[2], t2; } function H5Block(t0) { const $ = c(3), { children } = t0; let t1; $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [-1, 0, 1, 2], $[0] = t1) : t1 = $[0]; let t2; return $[1] !== children ? (t2 = /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(H, { size: t1, children }) }) }) }) }), $[1] = children, $[2] = t2) : t2 = $[2], t2; } function H6Block(t0) { const $ = c(3), { children } = t0; let t1; $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [-1, 0, 1, 2], $[0] = t1) : t1 = $[0]; let t2; return $[1] !== children ? (t2 = /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(Level, { children: /* @__PURE__ */ jsx(H, { size: t1, children }) }) }) }) }) }), $[1] = children, $[2] = t2) : t2 = $[2], t2; } function BlockquoteBlock(t0) { const $ = c(3), { children } = t0; let t1; $[0] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [-1, 0, 1], $[0] = t1) : t1 = $[0]; let t2; return $[1] !== children ? (t2 = /* @__PURE__ */ jsx(Box, { as: "blockquote", children: /* @__PURE__ */ jsx(P, { muted: !0, size: t1, children }) }), $[1] = children, $[2] = t2) : t2 = $[2], t2; } function NormalBlock(t0) { const $ = c(2), { children } = t0; let t1; return $[0] !== children ? (t1 = /* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsx(P, { muted: !0, children }) }), $[0] = children, $[1] = t1) : t1 = $[1], t1; } function isValidUrl(url) { try { return !!new URL(url); } catch { return !1; } } function getInternalHref({ url, packageName, exportPath }) { const urlSegments = url.split("/"); return urlSegments.length === 1 ? `/${packageName}${exportPath?.replace(".", "")}/${url}` : `/${packageName}/${urlSegments.join("/")}`; } function Link(props) { const $ = c(15), { basePath, onPathChange, params } = useTSDoc(), { value, text } = props, { packageName, exportPath } = params, url = value?.href; let t0; $[0] !== url ? (t0 = isValidUrl(url), $[0] = url, $[1] = t0) : t0 = $[1]; const isExternalUrl = t0; let t1; $[2] !== exportPath || $[3] !== isExternalUrl || $[4] !== packageName || $[5] !== url ? (t1 = !isExternalUrl && getInternalHref({ url, packageName, exportPath }), $[2] = exportPath, $[3] = isExternalUrl, $[4] = packageName, $[5] = url, $[6] = t1) : t1 = $[6]; const path = t1, href = isExternalUrl ? url : `${basePath}${path}`; let t2; $[7] !== isExternalUrl || $[8] !== onPathChange || $[9] !== path ? (t2 = (e) => { isExternalUrl || !path || (e.preventDefault(), onPathChange(path)); }, $[7] = isExternalUrl, $[8] = onPathChange, $[9] = path, $[10] = t2) : t2 = $[10]; const handleClick = t2; let t3; return $[11] !== handleClick || $[12] !== href || $[13] !== text ? (t3 = /* @__PURE__ */ jsx("a", { href, onClick: handleClick, children: text }), $[11] = handleClick, $[12] = href, $[13] = text, $[14] = t3) : t3 = $[14], t3; } function CommentDeprecatedCallout(props) { const $ = c(15), { data } = props, { deprecated } = data; let t0; $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = [0, 0, 1], $[0] = t0) : t0 = $[0]; const textSize = useTextSize(t0); if (!deprecated?.content) { let t12; return $[1] === Symbol.for("react.memo_cache_sentinel") ? (t12 = /* @__PURE__ */ jsx(Fragment, {}), $[1] = t12) : t12 = $[1], t12; } let t1; $[2] === Symbol.for("react.memo_cache_sentinel") ? (t1 = /* @__PURE__ */ jsx(WarningOutlineIcon, {}), $[2] = t1) : t1 = $[2]; let t2; $[3] !== textSize ? (t2 = /* @__PURE__ */ jsx(Box, { flex: "none", marginRight: 3, children: /* @__PURE__ */ jsx(Text, { size: textSize, children: t1 }) }), $[3] = textSize, $[4] = t2) : t2 = $[4]; let t3; $[5] !== textSize ? (t3 = /* @__PURE__ */ jsx(Text, { size: textSize, weight: "semibold", children: "Deprecated" }), $[5] = textSize, $[6] = t3) : t3 = $[6]; let t4; $[7] !== deprecated.content ? (t4 = /* @__PURE__ */ jsx(Size, { delta: -1, children: /* @__PURE__ */ jsx(PortableText, { blocks: deprecated.content }) }), $[7] = deprecated.content, $[8] = t4) : t4 = $[8]; let t5; $[9] !== t3 || $[10] !== t4 ? (t5 = /* @__PURE__ */ jsx(Stack, { flex: 1, space: 2, children: /* @__PURE__ */ jsxs(CommentBox, { children: [ t3, t4 ] }) }), $[9] = t3, $[10] = t4, $[11] = t5) : t5 = $[11]; let t6; return $[12] !== t2 || $[13] !== t5 ? (t6 = /* @__PURE__ */ jsx(Card, { padding: 4, radius: 3, shadow: 1, tone: "critical", children: /* @_