boltdocs 2.7.10 → 2.7.11
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/client/index.cjs +1929 -1
- package/dist/client/index.js +1880 -1
- package/dist/client/mdx.cjs +7 -1
- package/dist/client/mdx.js +7 -1
- package/dist/client/primitives.cjs +60 -1
- package/dist/client/primitives.js +20 -1
- package/dist/docs-layout-BXHV0xw_.cjs +1431 -0
- package/dist/docs-layout-DwFndmj5.js +1231 -0
- package/dist/icons-dev-3cZMyt8r.cjs +1204 -0
- package/dist/icons-dev-Df8OQ481.js +839 -0
- package/dist/image-DtrI2cw3.cjs +268 -0
- package/dist/image-jxPb-2iV.js +214 -0
- package/dist/mdx-BdWkJTeB.cjs +523 -0
- package/dist/mdx-UTTLFWJq.js +494 -0
- package/dist/node/cli-entry.cjs +1 -1
- package/dist/node/cli-entry.mjs +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/{node-DtEDyN1u.cjs → node-BSM4qcDK.cjs} +1 -1
- package/dist/{node-_1jhMGYx.mjs → node-BspZN3R2.mjs} +1 -1
- package/dist/{package-DrwtlXfk.cjs → package-DIIrjuWI.cjs} +1 -1
- package/dist/{package--0Yf0t1N.mjs → package-K0zsjGIz.mjs} +1 -1
- package/dist/{search-dialog-ByvGScjt.js → search-dialog-BHuIiUC6.js} +3 -1
- package/dist/search-dialog-BNF10tDl.js +375 -0
- package/dist/search-dialog-BwkDuI9R.cjs +220 -0
- package/dist/search-dialog-C7xuvyNk.cjs +386 -0
- package/dist/search-dialog-CIQg6k8c.cjs +8 -0
- package/dist/search-dialog-D-DDN7zJ.js +208 -0
- package/package.json +3 -4
- package/dist/docs-layout-KoWNZc8_.js +0 -6
- package/dist/docs-layout-x2yKt2cL.cjs +0 -6
- package/dist/icons-dev-B_RZIyxu.js +0 -6
- package/dist/icons-dev-BlV3wWFT.cjs +0 -6
- package/dist/image-BHhTvQzr.cjs +0 -6
- package/dist/image-CqKzYD8f.js +0 -6
- package/dist/mdx-DudBEac0.js +0 -7
- package/dist/mdx-r4cDQxWu.cjs +0 -7
- package/dist/search-dialog-B584t9ZF.js +0 -6
- package/dist/search-dialog-BvBopRsZ.cjs +0 -6
- package/dist/search-dialog-Cyko6TJm.cjs +0 -6
- package/dist/search-dialog-D6BNohIJ.js +0 -6
- package/dist/search-dialog-DuYTIefy.cjs +0 -6
- package/src/client/app/config-context.tsx +0 -51
- package/src/client/app/doc-page.tsx +0 -38
- package/src/client/app/docs-layout.tsx +0 -28
- package/src/client/app/head.tsx +0 -122
- package/src/client/app/helmet-compat.tsx +0 -36
- package/src/client/app/mdx-component.tsx +0 -8
- package/src/client/app/mdx-components-context.tsx +0 -72
- package/src/client/app/routes-context.tsx +0 -34
- package/src/client/app/scroll-handler.tsx +0 -74
- package/src/client/app/theme-context.tsx +0 -103
- package/src/client/app/ui-context.tsx +0 -42
- package/src/client/components/docs-layout-default.tsx +0 -85
- package/src/client/components/icons-dev.tsx +0 -282
- package/src/client/components/mdx/callout.tsx +0 -97
- package/src/client/components/mdx/card.tsx +0 -99
- package/src/client/components/mdx/cards.tsx +0 -27
- package/src/client/components/mdx/code-block.tsx +0 -184
- package/src/client/components/mdx/field.tsx +0 -33
- package/src/client/components/mdx/image.tsx +0 -44
- package/src/client/components/mdx/index.ts +0 -19
- package/src/client/components/mdx/table.tsx +0 -54
- package/src/client/components/mdx/typographics.tsx +0 -120
- package/src/client/components/mdx/use-code-block.ts +0 -34
- package/src/client/components/primitives/breadcrumbs.tsx +0 -54
- package/src/client/components/primitives/button-group.tsx +0 -54
- package/src/client/components/primitives/button.tsx +0 -6
- package/src/client/components/primitives/code-block.tsx +0 -120
- package/src/client/components/primitives/docs-layout.tsx +0 -125
- package/src/client/components/primitives/error-boundary.tsx +0 -107
- package/src/client/components/primitives/heading.tsx +0 -128
- package/src/client/components/primitives/helpers/observer.ts +0 -141
- package/src/client/components/primitives/image.tsx +0 -26
- package/src/client/components/primitives/link.tsx +0 -102
- package/src/client/components/primitives/menu.tsx +0 -137
- package/src/client/components/primitives/navbar.tsx +0 -466
- package/src/client/components/primitives/on-this-page.tsx +0 -430
- package/src/client/components/primitives/page-nav.tsx +0 -51
- package/src/client/components/primitives/popover.tsx +0 -28
- package/src/client/components/primitives/search-dialog.tsx +0 -193
- package/src/client/components/primitives/sidebar.tsx +0 -423
- package/src/client/components/primitives/skeleton.tsx +0 -26
- package/src/client/components/primitives/tabs.tsx +0 -70
- package/src/client/components/primitives/tooltip.tsx +0 -81
- package/src/client/components/primitives/types.ts +0 -11
- package/src/client/components/ui-base/banner.tsx +0 -66
- package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
- package/src/client/components/ui-base/copy-markdown.tsx +0 -107
- package/src/client/components/ui-base/error-boundary.tsx +0 -15
- package/src/client/components/ui-base/github-stars.tsx +0 -29
- package/src/client/components/ui-base/icons.tsx +0 -240
- package/src/client/components/ui-base/index.ts +0 -16
- package/src/client/components/ui-base/last-updated.tsx +0 -27
- package/src/client/components/ui-base/navbar.tsx +0 -266
- package/src/client/components/ui-base/not-found.tsx +0 -26
- package/src/client/components/ui-base/on-this-page.tsx +0 -57
- package/src/client/components/ui-base/page-nav.tsx +0 -50
- package/src/client/components/ui-base/search-dialog.tsx +0 -163
- package/src/client/components/ui-base/search-highlight.tsx +0 -10
- package/src/client/components/ui-base/sidebar.tsx +0 -92
- package/src/client/components/ui-base/tabs.tsx +0 -83
- package/src/client/components/ui-base/theme-toggle.tsx +0 -130
- package/src/client/components/ui-base/version-i18n.tsx +0 -80
- package/src/client/hooks/index.ts +0 -13
- package/src/client/hooks/use-analytics.ts +0 -272
- package/src/client/hooks/use-breadcrumbs.ts +0 -22
- package/src/client/hooks/use-i18n.ts +0 -182
- package/src/client/hooks/use-localized-to.ts +0 -113
- package/src/client/hooks/use-location.ts +0 -5
- package/src/client/hooks/use-navbar.ts +0 -130
- package/src/client/hooks/use-page-nav.ts +0 -46
- package/src/client/hooks/use-routes.ts +0 -108
- package/src/client/hooks/use-search-highlight.ts +0 -185
- package/src/client/hooks/use-search.ts +0 -118
- package/src/client/hooks/use-sidebar.ts +0 -205
- package/src/client/hooks/use-tabs.ts +0 -46
- package/src/client/hooks/use-version.ts +0 -111
- package/src/client/index.ts +0 -31
- package/src/client/mdx.ts +0 -2
- package/src/client/primitives.ts +0 -19
- package/src/client/ssg/boltdocs-shell.tsx +0 -148
- package/src/client/ssg/create-routes.tsx +0 -473
- package/src/client/ssg/index.ts +0 -4
- package/src/client/ssg/mdx-page.tsx +0 -38
- package/src/client/store/boltdocs-context.tsx +0 -137
- package/src/client/theme/neutral.css +0 -141
- package/src/client/theme/reset.css +0 -189
- package/src/client/types.ts +0 -116
- package/src/client/utils/cn.ts +0 -6
- package/src/client/utils/copy-clipboard.ts +0 -22
- package/src/client/utils/get-base-file-path.ts +0 -21
- package/src/client/utils/github.ts +0 -121
- package/src/client/utils/i18n.ts +0 -23
- package/src/client/utils/path.ts +0 -9
- package/src/client/utils/react-to-text.ts +0 -34
- package/src/client/virtual.d.ts +0 -24
package/dist/client/index.cjs
CHANGED
|
@@ -3,4 +3,1932 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../icons-dev-BlV3wWFT.cjs`),t=require(`../docs-layout-x2yKt2cL.cjs`),n=require(`../image-BHhTvQzr.cjs`),r=require(`../search-dialog-BvBopRsZ.cjs`),i=require(`../search-dialog-DuYTIefy.cjs`),a=require(`../mdx-r4cDQxWu.cjs`);let o=require(`react-router-dom`),s=require(`react`),c=require(`react/jsx-runtime`),l=require(`react-aria-components`),u=require(`virtual:boltdocs-icons`);u=e.rt(u);let d=require(`react-helmet-async`);d=e.rt(d);let f=require(`virtual:boltdocs-mdx-components`);f=e.rt(f);let p=require(`virtual:boltdocs-layout`);p=e.rt(p);let m=require(`@bdocs/ssg`);const h=Symbol.for(`__BDOCS_MDX_COMPONENTS_CONTEXT__`),g=Symbol.for(`__BDOCS_MDX_COMPONENTS_INSTANCE__`),_=globalThis[h]||(globalThis[h]=(0,s.createContext)({}));function v(){let e=(0,s.use)(_);return(!e||Object.keys(e).length===0)&&globalThis[g]?globalThis[g]:e}function y({components:e,children:t}){let n=(0,s.useMemo)(()=>{let t={},n={};return Object.entries(e).forEach(([e,r])=>{if(e.startsWith(`Frontmatter_`)){let t=e.slice(12);n[t]=r}else t[e]=r}),t.Frontmatter=n,t},[e]);return typeof globalThis<`u`&&(globalThis[g]=n),(0,c.jsx)(_.Provider,{value:n,children:t})}function b(){let{currentRoute:t}=e.X(),n=[];return t&&(t.groupTitle&&n.push({label:t.groupTitle}),n.push({label:t.title,href:t.path})),{crumbs:n,activeRoute:t}}function x(){let{crumbs:n,activeRoute:r}=b();return n.length===0?null:(0,c.jsxs)(t.N.Root,{className:`gap-2 text-xs sm:text-sm font-medium`,children:[(0,c.jsx)(t.N.Item,{children:(0,c.jsx)(t.N.Link,{href:`/`,className:`text-muted hover:text-body transition-colors flex items-center`,children:(0,c.jsx)(e.F,{size:14})})}),n.map((n,i)=>{let a=n.href===r?.path;return(0,c.jsxs)(t.N.Item,{className:`gap-2`,children:[(0,c.jsx)(t.N.Separator,{className:`text-muted/40`}),(0,c.jsx)(t.N.Link,{href:n.href,className:e.y(`transition-colors`,a?`text-body font-semibold cursor-default pointer-events-none`:`text-muted hover:text-body`),children:n.label})]},`crumb-${n.href}-${n.label}-${i}`)})]})}const S=e=>{let[t,n]=(0,s.useState)(!1);return{copied:t,handleCopy:()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)},handleOpenRaw:()=>{let t=new Blob([e],{type:`text/plain;charset=utf-8`}),n=URL.createObjectURL(t);window.open(n,`_blank`)}}};function C({content:n,mdxRaw:r}){let i=r||n||``,{copied:a,handleCopy:o,handleOpenRaw:s}=S(i);return i?(0,c.jsx)(`div`,{className:`relative inline-flex z-100 shrink-0 w-max`,children:(0,c.jsxs)(t.j,{className:`rounded-xl border border-subtle bg-surface transition-all duration-300 hover:border-primary-500/50 group overflow-hidden`,children:[(0,c.jsx)(t.M,{onPress:o,className:e.y(`md:hidden flex items-center justify-center w-8 h-8 bg-transparent outline-none select-none cursor-pointer border-none`,`text-muted transition-all duration-300 hover:bg-primary-500/5 hover:text-body`,a&&`text-emerald-500 hover:bg-emerald-500/5`),"aria-label":a?`Copied!`:`Copy Markdown`,children:a?(0,c.jsx)(e.w,{size:14}):(0,c.jsx)(e.k,{size:14})}),(0,c.jsxs)(t.M,{onPress:o,className:e.y(`hidden md:flex items-center gap-2 px-5 py-2 bg-transparent text-[0.8125rem] font-semibold h-9 shrink-0 outline-none select-none cursor-pointer border-none`,`text-body transition-all duration-300 hover:bg-primary-500/5`,a&&`text-emerald-500 hover:bg-emerald-500/5`),children:[a?(0,c.jsx)(e.w,{size:16}):(0,c.jsx)(e.k,{size:16}),a?`Copied!`:`Copy Markdown`]}),(0,c.jsxs)(t.k.Trigger,{placement:`bottom end`,children:[(0,c.jsx)(t.M,{className:e.y(`flex items-center justify-center px-2.5 md:px-3.5 h-8 md:h-9 border-none border-l border-subtle/50 text-muted rounded-none bg-transparent shrink-0 outline-none select-none cursor-pointer`,`transition-all duration-300 hover:bg-primary-500/5 hover:text-primary-500`),children:(0,c.jsx)(e.T,{size:14})}),(0,c.jsxs)(t.k.Root,{className:`w-52 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:[(0,c.jsxs)(t.k.Item,{onAction:o,className:`flex items-center px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group`,children:[(0,c.jsx)(e.k,{size:16,className:`size-4 text-muted dark:group-hover:text-primary-500 group-hover:text-primary-400`}),(0,c.jsx)(`span`,{className:`ml-2`,children:`Copy Markdown`})]}),(0,c.jsxs)(t.k.Item,{onAction:s,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group`,children:[(0,c.jsx)(e.j,{size:16,className:`size-4 text-muted dark:group-hover:text-primary-500 group-hover:text-primary-400`}),(0,c.jsx)(`span`,{className:`ml-2`,children:`View as Markdown`})]})]})]})]})}):null}function w({children:e,fallback:n}){return(0,c.jsx)(t.D,{fallback:n,children:e})}async function T(e,t,n=`https://api.github.com`){let r=new Headers;t&&r.append(`authorization`,t);let i=await(await fetch(`${n}/repos/${e}`,{headers:r})).json();return i.stargazers_count===void 0?`0`:ee(i.stargazers_count)}const ee=e=>Intl.NumberFormat(`en`,{notation:`compact`,compactDisplay:`short`}).format(e);function te({repo:t}){let[n,r]=(0,s.useState)(null);return(0,s.useEffect)(()=>{t&&T(t).then(e=>r(e)).catch(()=>r(`0`))},[t]),(0,c.jsxs)(`a`,{href:`https://github.com/${t}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-2 rounded-xl border border-subtle bg-surface px-3 py-1.5 text-xs font-semibold text-muted dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 hover:border-primary-500/50 hover:text-body select-none outline-none`,children:[(0,c.jsx)(e.s,{className:`h-4 w-4 text-body`}),n!==null&&(0,c.jsxs)(`span`,{className:`tabular-nums font-medium`,children:[n,` stars`]})]})}function E(e,t){return e?typeof e==`string`?e:t&&e[t]?e[t]:Object.values(e)[0]||``:``}function D(){let t=e.nt(),{theme:r,resolvedTheme:i}=n.l(),a=(0,o.useLocation)(),{currentLocale:c}=e.X(),l=t.theme||{},u=E(l.title,c)||`Boltdocs`,d=l.navbar||[],f=l.socialLinks||[],p=l.githubRepo,m=(0,s.useMemo)(()=>d.map(e=>{let n=e.href||e.to||e.link||``,r=e=>{let n=a.pathname;if(n===e)return!0;if(!e||e===`/`)return n===`/`;let r=e=>{let n=e.split(`/`).filter(Boolean),r=0;return t.i18n?.locales&&n[r]&&t.i18n.locales[n[r]]&&r++,t.versions?.versions&&n[r]&&t.versions.versions.some(e=>e.path===n[r])&&r++,n.slice(r)},i=r(e),o=r(n);return i.length===0?o.length===0:o.length<i.length?!1:i.every((e,t)=>o[t]===e)},i=(e=>{if(!(!e||e.length===0))return e.map(e=>{let t=e.href||e.to||e.link||``;return{label:E(e.label||e.text,c),href:t,active:r(t),to:t.startsWith(`http`)||t.startsWith(`//`)?`external`:void 0}})})(e.items);return{label:E(e.label||e.text,c),href:n,active:r(n),to:n.startsWith(`http`)||n.startsWith(`//`)?`external`:void 0,items:i}}),[d,a.pathname,c,t]),h=l.logo;return{links:m,title:u,logo:h?typeof h==`string`?h:i===`dark`?h.dark:h.light:null,logoProps:{alt:(h&&typeof h==`object`?h.alt:void 0)||u,width:h&&typeof h==`object`?h.width:void 0,height:h&&typeof h==`object`?h.height:void 0},github:p?`https://github.com/${p}`:null,social:f,config:t,theme:r}}function O(){let{theme:r,setTheme:i}=n.l(),[a,o]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{o(!0)},[]),!a)return(0,c.jsx)(`div`,{className:`h-9 w-9`});let u=r===`system`?e.V:r===`dark`?e.H:e.K;return(0,c.jsxs)(t.k.Trigger,{placement:`bottom right`,children:[(0,c.jsx)(l.Button,{className:`flex h-9 w-9 items-center justify-center rounded-xl text-muted transition-colors hover:bg-surface hover:text-body outline-none border-none bg-transparent cursor-pointer`,"aria-label":`Selection theme`,children:(0,c.jsx)(u,{size:20,className:`animate-in fade-in zoom-in duration-300`})}),(0,c.jsxs)(t.k.Root,{selectionMode:`single`,selectedKeys:[r],onSelectionChange:e=>{let t=Array.from(e)[0];i(t)},className:`w-36 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:[(0,c.jsxs)(t.k.Item,{id:`light`,className:`group flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:[(0,c.jsx)(e.K,{className:`group-hover:text-primary-500 dark:group-hover:text-primary-200`,size:16}),(0,c.jsx)(`span`,{className:`ml-2`,children:`Light`})]}),(0,c.jsxs)(t.k.Item,{id:`dark`,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:[(0,c.jsx)(e.H,{className:`group-hover:text-primary-500 dark:group-hover:text-primary-200`,size:16}),(0,c.jsx)(`span`,{className:`ml-2`,children:`Dark`})]}),(0,c.jsxs)(t.k.Item,{id:`system`,className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:[(0,c.jsx)(e.V,{className:`group-hover:text-primary-500 dark:group-hover:text-primary-200`,size:16}),(0,c.jsx)(`span`,{className:`ml-2`,children:`System`})]})]})]})}function ne({className:t}){let{theme:r,setTheme:i}=n.l(),[a,o]=(0,s.useState)(!1);if((0,s.useEffect)(()=>{o(!0)},[]),!a)return(0,c.jsx)(`div`,{className:e.y(`h-10 w-full bg-surface rounded-xl animate-pulse`,t)});let l=r===`dark`;return(0,c.jsxs)(`div`,{className:e.y(`flex p-1 bg-surface border border-subtle rounded-xl relative w-full h-11`,t),children:[(0,c.jsx)(`div`,{className:e.y(`absolute inset-y-1 w-[calc(50%-4px)] bg-main border border-subtle rounded-lg transition-all duration-300 ease-out shadow-xs`,l?`translate-x-full`:`translate-x-0`)}),(0,c.jsx)(`button`,{onClick:()=>i(`light`),className:e.y(`flex-1 flex items-center justify-center rounded-lg z-10 transition-colors outline-none cursor-pointer border-none bg-transparent`,l?`text-muted hover:text-body`:`text-body font-semibold`),"aria-label":`Light mode`,children:(0,c.jsx)(e.K,{size:18})}),(0,c.jsx)(`button`,{onClick:()=>i(`dark`),className:e.y(`flex-1 flex items-center justify-center rounded-lg z-10 transition-colors outline-none cursor-pointer border-none bg-transparent`,l?`text-body font-semibold`:`text-muted hover:text-body`),"aria-label":`Dark mode`,children:(0,c.jsx)(e.H,{size:18})})]})}function k(t=[],n=[]){let r=(0,o.useLocation)(),i=(0,s.useRef)([]),[a,c]=(0,s.useState)({opacity:0,transform:`translateX(0) scaleX(0)`,width:0}),l=e.Z(r.pathname),u=n.find(t=>e.Z(t.path)===l)?.tab?.toLowerCase(),d=t.findIndex(e=>e.id.toLowerCase()===u),f=d===-1?0:d;return(0,s.useEffect)(()=>{let e=i.current[f];e&&c({opacity:1,width:e.offsetWidth,transform:`translateX(${e.offsetLeft}px)`})},[f,t.length,r.pathname]),{tabs:t,activeIndex:f,indicatorStyle:a,tabRefs:i,activeTabId:u}}function re({tabs:n,routes:r}){let{currentLocale:i}=e.X(),{indicatorStyle:a,tabRefs:o,activeIndex:l}=k(n,r);(0,s.useEffect)(()=>{let e=o.current[l];e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})},[l]);let d=t=>{if(!t)return null;if(t.trim().startsWith(`<svg`))return(0,c.jsx)(`span`,{className:`h-4 w-4`,dangerouslySetInnerHTML:{__html:t}});let n={...e.Y,...u.default},r=n[t]||n[t+`Icon`];return r?(0,c.jsx)(r,{size:16}):(0,c.jsx)(`img`,{src:t,alt:``,className:`h-4 w-4 object-contain`})};return(0,c.jsx)(`div`,{className:`mx-auto max-w-(--breakpoint-3xl) px-4 md:px-6 select-none`,children:(0,c.jsxs)(t.E.List,{className:`border-none py-0 scrollbar-hide relative flex flex-row items-center`,children:[n.map((t,n)=>{let a=n===l,s=r.find(e=>e.tab&&e.tab.toLowerCase()===t.id.toLowerCase());return(0,c.jsxs)(e._,{href:s?s.path:`#`,ref:e=>{o.current[n]=e},className:`relative flex items-center gap-2 px-4 py-3.5 text-sm font-semibold transition-colors duration-300 outline-none whitespace-nowrap ${a?`text-primary-500`:`text-muted hover:text-body`}`,children:[d(t.icon),(0,c.jsx)(`span`,{children:E(t.text,i)})]},t.id)}),(0,c.jsx)(t.E.Indicator,{style:a,className:`h-0.5 bg-primary-500 rounded-full transition-all duration-300`})]})})}function A(e,t,n){let r=e;return t&&(r===t||r.startsWith(t+`/`))&&(r=r===t?`index.md`:r.slice(t.length+1)),n&&(r===n||r.startsWith(n+`/`))&&(r=r===n?`index.md`:r.slice(n.length+1)),r}function j(){let t=(0,o.useNavigate)(),n=e.nt(),{allRoutes:r,currentRoute:i,currentVersion:a,currentLocale:c}=e.X(),l=n.versions,{setVersion:u}=e.$();return{currentVersion:a,currentVersionLabel:l?.versions?.find?.(e=>e.path===a)?.label||a,availableVersions:(0,s.useMemo)(()=>l?l.versions.map(e=>({key:e.path,label:e.label,value:e.path,isCurrent:e.path===a})):[],[l,a]),handleVersionChange:e=>{if(!l||e===a)return;u(e);let o=`${(n.base||`/docs`).replace(/\/$/,``)}/${e}${c?`/${c}`:``}`;if(i){let t=A(i.filePath,i.version,i.locale),a=r.find(r=>A(r.filePath,r.version,r.locale)===t&&(r.version||l.defaultVersion)===e&&(!n.i18n||(r.locale||n.i18n.defaultLocale)===c));if(a)o=a.path;else{let t=r.find(t=>A(t.filePath,t.version,t.locale)===`index.md`&&(t.version||l.defaultVersion)===e&&(!n.i18n||(t.locale||n.i18n.defaultLocale)===c));t&&(o=t.path)}}else{let t=r.find(t=>(t.version||l.defaultVersion)===e&&(!n.i18n||(t.locale||n.i18n.defaultLocale)===c));t&&(o=t.path)}t(o)}}}function M(){let t=(0,o.useNavigate)(),n=e.nt(),{allRoutes:r,currentRoute:i,currentLocale:a,currentVersion:c}=e.X(),l=n.i18n,{setLocale:u}=e.$(),d=e=>{if(!l||e===a)return;u(e);let o=n.base||`/`,s=o===`/`?``:o.replace(/\/$/,``),d=!!i?.filePath,f=``;if(i)if(d){let t=A(i.filePath,i.version,i.locale),n=r.find(n=>A(n.filePath,n.version,n.locale)===t&&(n.locale||l.defaultLocale)===e&&n.version===i.version);if(n)f=n.path;else{let t=r.find(t=>A(t.filePath,t.version,t.locale)===`index.md`&&(t.locale||l.defaultLocale)===e&&t.version===i.version);f=t?t.path:`${s}${i.version?`/${i.version}`:``}${e===l.defaultLocale?``:`/${e}`}`||`/`}}else{let t=i.path,n=t.split(`/`).filter(Boolean);if(n.length>0&&(Array.isArray(l.locales)?l.locales.includes(n[0]):l.locales[n[0]])&&(n.shift(),t=`/`+n.join(`/`)),e===l.defaultLocale)f=t===``?`/`:t;else{let n=t.startsWith(`/`)?t:`/${t}`;f=`/${e}${n===`/`?``:n}`}}else{let t=r.find(t=>(t.locale||l.defaultLocale)===e&&(t.version||n.versions?.defaultVersion)===(c||n.versions?.defaultVersion));if(t)f=t.path;else{let t=c&&c!==n.versions?.defaultVersion?`/${c}`:``;f=e===l.defaultLocale?`${s}${t}`:`${s}${t}/${e}`}}(!f||f===``)&&(f=`/`),f=f.replace(/\/+/g,`/`),t(f)},f=l?.locales,p=f?Array.isArray(f)?a:f[a]:void 0;return{currentLocale:a,currentLocaleLabel:l?.localeConfigs?.[a]?.label||p||a,availableLocales:(0,s.useMemo)(()=>l?Array.isArray(l.locales)?l.locales.map(e=>({key:e,label:l?.localeConfigs?.[e]?.label||e,value:e,isCurrent:e===a})):Object.entries(l.locales).map(([e,t])=>({key:e,label:l?.localeConfigs?.[e]?.label||t,value:e,isCurrent:e===a})):[],[l,a]),handleLocaleChange:d}}function N({className:n}){let{currentVersionLabel:r,availableVersions:i,handleVersionChange:a}=j();return i.length===0?null:(0,c.jsxs)(t.k.Trigger,{children:[(0,c.jsxs)(t.M,{className:e.y(`flex h-9 items-center justify-between gap-2 border border-subtle bg-surface px-4 py-1.5 rounded-xl text-xs font-semibold text-body hover:bg-primary-50/20 hover:border-primary-500/50 transition-all duration-300 outline-none select-none cursor-pointer`,n),children:[(0,c.jsx)(`span`,{className:`font-semibold text-[0.8125rem]`,children:r}),(0,c.jsx)(e.T,{className:`w-3.5 h-3.5 text-muted/60`})]}),(0,c.jsx)(t.k.Root,{className:`w-40 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:(0,c.jsx)(t.k.Section,{items:i,children:e=>(0,c.jsx)(t.k.Item,{onPress:()=>a(e.value),className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body hover:bg-primary-50/50 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:e.label},`${e.value??``}`)})})]})}function P({className:n}){let{currentLocale:r,availableLocales:i,handleLocaleChange:a}=M();return i.length===0?null:(0,c.jsxs)(t.k.Trigger,{children:[(0,c.jsxs)(t.M,{className:e.y(`flex h-9 items-center justify-between gap-2 border border-subtle bg-surface px-4 py-1.5 rounded-xl text-xs font-semibold text-body hover:bg-primary-50/20 hover:border-primary-500/50 transition-all duration-300 outline-none select-none cursor-pointer`,n),children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,c.jsx)(e.L,{className:`w-3.5 h-3.5 text-primary-500`}),(0,c.jsx)(`span`,{className:`font-bold text-[0.75rem] uppercase opacity-90`,children:r||`en`})]}),(0,c.jsx)(e.T,{className:`w-3.5 h-3.5 text-muted/60`})]}),(0,c.jsx)(t.k.Root,{className:`w-40 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100`,children:(0,c.jsx)(t.k.Section,{items:i,children:e=>(0,c.jsx)(t.k.Item,{onPress:()=>a(e.value),className:`flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5`,children:(0,c.jsx)(`span`,{children:e.label})},`${e.value??``}`)})})]})}const F=(0,s.lazy)(()=>Promise.resolve().then(()=>require(`../search-dialog-Cyko6TJm.cjs`)).then(e=>({default:e.SearchDialog})));function I(){let{links:n,title:i,logo:a,logoProps:l,github:u,social:d,config:f}=D(),{routes:p,allRoutes:m,currentRoute:h,currentVersion:g,currentLocale:_}=e.X(),{pathname:v}=(0,o.useLocation)(),{isSidebarOpen:y,toggleSidebar:b}=t.T(),[x,S]=(0,s.useState)(!1),C=f.theme||{},w=!!h?.filePath,T=C?.tabs&&C.tabs.length>0;return(0,c.jsxs)(r.n.Root,{className:e.y(`border-b border-subtle bg-main/80 backdrop-blur-md`,T&&`border-b-0`),children:[(0,c.jsxs)(r.n.Content,{children:[(0,c.jsxs)(r.n.Left,{children:[w&&(0,c.jsx)(t.M,{onPress:b,className:`mr-2 lg:hidden p-1.5 h-8 w-8 flex items-center justify-center bg-transparent border-none outline-none select-none cursor-pointer rounded-xl hover:bg-primary-50/50 transition-colors`,"aria-label":y?`Close sidebar`:`Open sidebar`,children:y?(0,c.jsx)(e.J,{className:`w-5 h-5 text-body`}):(0,c.jsx)(e.B,{className:`w-5 h-5 text-body`})}),a&&(0,c.jsx)(r.n.Logo,{src:a,alt:l?.alt||i,width:l?.width??24,height:l?.height??24,href:`site:/`}),(0,c.jsx)(r.n.Title,{href:`site:/`,children:i}),(0,c.jsx)(`div`,{className:`hidden sm:block`,children:f.versions&&g&&(0,c.jsx)(N,{})})]}),(0,c.jsx)(r.n.Center,{children:(0,c.jsx)(s.Suspense,{fallback:(0,c.jsx)(`div`,{className:`h-9 w-32 animate-pulse rounded-md bg-surface`}),children:(0,c.jsx)(F,{routes:p||[]})})}),(0,c.jsxs)(r.n.Right,{children:[(0,c.jsx)(s.Suspense,{fallback:null,children:(0,c.jsx)(`div`,{className:`lg:hidden`,children:(0,c.jsx)(F,{routes:p||[]})})}),(0,c.jsx)(r.n.Links,{children:n.map(e=>(0,c.jsx)(ie,{link:e},e.href))}),(0,c.jsxs)(`div`,{className:`hidden sm:flex items-center gap-2`,children:[f.i18n&&_&&(0,c.jsx)(P,{}),(0,c.jsx)(r.n.Split,{className:`bg-subtle`})]}),(0,c.jsx)(`div`,{className:`hidden md:block`,children:(0,c.jsx)(O,{})}),u&&(0,c.jsx)(`div`,{className:`hidden md:block`,children:(0,c.jsx)(te,{repo:C?.githubRepo??``})}),d.length>0&&(0,c.jsx)(`div`,{className:`hidden md:block`,children:(0,c.jsx)(r.n.Split,{className:`bg-subtle`})}),(0,c.jsx)(`div`,{className:`hidden md:flex items-center gap-1`,children:d.map(({icon:e,link:t})=>(0,c.jsx)(r.n.Socials,{icon:e,link:t,className:`p-1.5 text-muted hover:text-body hover:bg-surface rounded-md transition-all focus-visible:ring-2 focus-visible:ring-primary-500/30`},t))}),(0,c.jsx)(r.n.More,{onPress:()=>S(!0),className:`text-muted hover:text-body active:scale-90 transition-all focus-visible:ring-2 focus-visible:ring-primary-500/30`})]})]}),(0,c.jsxs)(r.n.MobileMenu,{isOpen:x,onClose:()=>S(!1),className:`bg-main/98 backdrop-blur-2xl`,children:[(0,c.jsx)(`div`,{className:`flex flex-col gap-1`,children:n.map(e=>(0,c.jsx)(L,{link:e,onClose:()=>S(!1)},e.href))}),d.length>0&&(0,c.jsxs)(`div`,{className:`mt-6`,children:[(0,c.jsx)(`div`,{className:`px-4 mb-4 text-xs font-bold uppercase tracking-widest text-muted/50`,children:`Connect`}),(0,c.jsx)(`div`,{className:`flex flex-wrap gap-2 px-2`,children:d.map(({icon:e,link:t})=>(0,c.jsx)(r.n.Socials,{icon:e,link:t,className:`p-3 bg-surface border border-subtle rounded-xl flex-1 justify-center`},t))})]})]}),w&&T&&C?.tabs&&(0,c.jsx)(`div`,{className:`w-full border-b border-subtle bg-main`,children:(0,c.jsx)(re,{tabs:C.tabs,routes:m||p||[]})})]})}function ie({link:t}){let n=e.b(t.href||``),{pathname:i}=(0,o.useLocation)(),a=i===n||i.startsWith(n+`/`);return t.items&&t.items.length>0?(0,c.jsx)(r.n.Dropdown,{label:(0,c.jsx)(`span`,{className:e.y(`transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm px-2 py-1`,a?`text-primary-500`:`text-muted hover:text-body`),children:t.label}),children:t.items?.map(t=>(0,c.jsx)(r.n.DropdownItem,{href:e.b(t.href||``),label:t.label},t.href))}):(0,c.jsx)(r.n.Link,{...t,href:n,active:a,className:e.y(`transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm`,a?`text-primary-500`:`text-muted hover:text-body`)})}function L({link:t,onClose:n}){let i=e.b(t.href||``),{pathname:a}=(0,o.useLocation)(),s=a===i;return t.items&&t.items.length>0?(0,c.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,c.jsx)(`div`,{className:e.y(`px-3 py-2 text-sm transition-all`,s?`text-body`:`text-muted/80 hover:text-body`),children:t.label}),(0,c.jsx)(`div`,{className:`flex flex-col gap-1 pl-4`,children:t.items?.map(e=>(0,c.jsx)(L,{link:e,onClose:n},e.href))})]}):(0,c.jsx)(r.n.MobileLink,{...t,href:i,active:s,onPress:n,className:e.y(`transition-all`,s?`text-body`:`text-muted/80 hover:text-body`)})}function R(){return(0,c.jsx)(`div`,{className:`flex items-center justify-center min-h-[65vh] text-center px-4`,children:(0,c.jsxs)(`div`,{className:`space-y-6 max-w-md mx-auto p-8 border border-subtle bg-surface rounded-2xl shadow-xs`,children:[(0,c.jsx)(`span`,{className:`block text-7xl font-extrabold tracking-tight text-primary-500`,children:`404`}),(0,c.jsxs)(`div`,{className:`space-y-2`,children:[(0,c.jsx)(`h1`,{className:`text-xl font-bold text-body`,children:`Page Not Found`}),(0,c.jsx)(`p`,{className:`text-sm text-muted leading-relaxed`,children:`The page you're looking for doesn't exist or has been moved.`})]}),(0,c.jsxs)(e._,{href:`/`,className:`inline-flex items-center gap-2 rounded-xl border border-subtle bg-main px-6 py-2.5 text-xs font-semibold text-body hover:bg-primary-50/50 hover:border-primary-500/50 transition-all duration-300 outline-none select-none`,children:[(0,c.jsx)(e.C,{size:14}),` Go to Home`]})]})})}function z({headings:n=[],editLink:r,communityHelp:i,filePath:a}){return n.length===0?null:(0,c.jsxs)(t._.Root,{children:[(0,c.jsxs)(t._.Header,{className:`flex flex-row gap-x-2`,children:[(0,c.jsx)(e.q,{size:16}),`On this page`]}),(0,c.jsx)(t._.Tree,{headings:n}),(r||i)&&(0,c.jsxs)(`div`,{className:`mt-8 pt-8 border-t border-subtle space-y-4`,children:[(0,c.jsx)(`p`,{className:`text-xs font-bold text-body`,children:`Need help?`}),(0,c.jsxs)(`ul`,{className:`space-y-3`,children:[r&&a&&(0,c.jsx)(`li`,{children:(0,c.jsxs)(`a`,{href:r.replace(`:path`,a),target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-sm text-muted hover:text-body transition-colors`,children:[(0,c.jsx)(e.W,{size:16}),`Edit this page`]})}),i&&(0,c.jsx)(`li`,{children:(0,c.jsxs)(`a`,{href:i,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-sm text-muted hover:text-body transition-colors`,children:[(0,c.jsx)(e.O,{size:16}),`Community help`]})})]})]})]})}function B(){let{routes:t,currentRoute:n}=e.X(),r=(0,o.useLocation)();return(0,s.useMemo)(()=>{if(!n)return{prevPage:null,nextPage:null,currentRoute:null};let e=n.tab?.toLowerCase(),i=e?t.filter(t=>t.tab?.toLowerCase()===e):t.filter(e=>!e.tab),a=i.findIndex(e=>e.path===r.pathname);return{prevPage:a>0?i[a-1]:null,nextPage:a!==-1&&a<i.length-1?i[a+1]:null,currentRoute:n}},[t,n,r.pathname])}function V(){let{prevPage:e,nextPage:n}=B();return!e&&!n?null:(0,c.jsxs)(t.h.Root,{className:`pt-8 border-t border-subtle grid sm:grid-cols-2 gap-4 animate-in fade-in slide-in-from-bottom-4 duration-700 select-none`,children:[e?(0,c.jsxs)(t.h.Link,{to:e.path,direction:`prev`,className:`group border border-subtle bg-surface p-5 rounded-2xl transition-all duration-300 hover:border-primary-500/50 hover:bg-primary-50/20`,children:[(0,c.jsx)(t.h.Title,{className:`text-xs font-bold uppercase tracking-wider text-muted/60 mb-1`,children:`Previous`}),(0,c.jsx)(t.h.Description,{className:`text-sm sm:text-base font-bold text-body group-hover:text-primary-500 transition-colors`,children:e.title})]}):(0,c.jsx)(`div`,{}),n?(0,c.jsxs)(t.h.Link,{to:n.path,direction:`next`,className:`group border border-subtle bg-surface p-5 rounded-2xl transition-all duration-300 hover:border-primary-500/50 hover:bg-primary-50/20`,children:[(0,c.jsx)(t.h.Title,{className:`text-xs font-bold uppercase tracking-wider text-muted/60 mb-1`,children:`Next`}),(0,c.jsx)(t.h.Description,{className:`text-sm sm:text-base font-bold text-body group-hover:text-primary-500 transition-colors`,children:n.title})]}):(0,c.jsx)(`div`,{})]})}function H({routes:n,config:r}){let{logo:i,title:a,logoProps:o}=D(),{closeSidebar:s}=t.T(),l=i?(0,c.jsx)(`img`,{src:i,alt:o?.alt||a,width:24,height:24,className:`rounded-xl`}):null,u=r.versions||r.i18n;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(t.i.Root,{children:(0,c.jsx)(t.i.Content,{children:(0,c.jsx)(t.i.Items,{routes:n})})}),(0,c.jsxs)(t.i.Mobile,{children:[(0,c.jsxs)(t.i.Header,{children:[(0,c.jsxs)(`div`,{className:`flex items-center gap-3`,children:[l,(0,c.jsx)(`span`,{className:`font-bold text-lg tracking-tight text-body truncate max-w-[120px]`,children:a})]}),(0,c.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,c.jsx)(ne,{className:`w-24 h-9 rounded-xl`}),(0,c.jsx)(t.M,{onPress:s,className:`h-9 w-9 flex items-center justify-center bg-transparent border-none outline-none select-none cursor-pointer rounded-xl hover:bg-primary-50/50 text-muted hover:text-body transition-colors`,"aria-label":`Close sidebar`,children:(0,c.jsx)(e.J,{size:20})})]})]}),(0,c.jsxs)(t.i.Content,{children:[u&&(0,c.jsxs)(`div`,{className:`flex flex-col gap-4 mb-10`,children:[(0,c.jsxs)(`div`,{className:`flex gap-3`,children:[r.versions&&(0,c.jsx)(N,{className:`flex-1 justify-between h-10 bg-surface border-subtle rounded-xl`}),r.i18n&&(0,c.jsx)(P,{className:`flex-1 justify-between h-10 bg-surface border-subtle rounded-xl`})]}),(0,c.jsx)(`div`,{className:`mt-2 border-b border-subtle`})]}),(0,c.jsx)(t.i.Items,{routes:n})]})]})]})}const U=Object.assign(H,{Root:t.i.Root,Mobile:t.i.Mobile,Header:t.i.Header,Content:t.i.Content,Group:t.i.Group,Link:t.i.Link,SubGroup:t.i.SubGroup,Item:t.i.Item,Items:t.i.Items});function W({date:e}){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let n=t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`});return(0,c.jsxs)(`div`,{className:`mt-16 pt-6 border-t border-subtle flex items-center justify-between text-xs text-muted select-none`,children:[(0,c.jsx)(`span`,{}),(0,c.jsxs)(`span`,{className:`italic`,children:[`Last updated on `,n]})]})}function G({route:e,content:t,mdxComponents:n}){let r=v(),i=(0,s.useMemo)(()=>({LastUpdated:W,...r,...n}),[r,n]),a=i.LastUpdated||W;return t?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(t,{components:i}),e?.lastUpdated&&(0,c.jsx)(a,{date:e.lastUpdated})]}):null}function K({MDXComponent:e,mdxComponents:t}){let n=(0,o.useLoaderData)(),r=e||n?.MDXComponent,i=t||n?.mdxComponents;return r?(0,c.jsx)(G,{route:{path:n.path,filePath:n.filePath,title:n.frontmatter.title,description:n.frontmatter.description,headings:n.headings,locale:n.locale,version:n.version,group:n.group,groupTitle:n.groupTitle,lastUpdated:n.lastUpdated,frontmatter:n.frontmatter},content:r,mdxComponents:i}):null}const q=d,J=q.Helmet||q.default?.Helmet||(({children:e})=>(0,c.jsx)(c.Fragment,{children:e})),Y=q.HelmetProvider||q.default?.HelmetProvider||(({children:e})=>(0,c.jsx)(c.Fragment,{children:e}));function ae(){let{pathname:e,hash:t}=(0,o.useLocation)(),n=(e=`auto`)=>{let n=document.querySelector(`.boltdocs-content`)||window,r=()=>n===window?window.scrollY:n.scrollTop,i=(e,t)=>{n===window?window.scrollTo({top:e,behavior:t}):n.scrollTo({top:e,behavior:t})};if(t){let a=t.replace(`#`,``),o=document.getElementById(a);if(o){let t=n===window?0:n.getBoundingClientRect().top;return i(o.getBoundingClientRect().top-t-80+r(),e),!0}}return i(0,e),!1};return(0,s.useLayoutEffect)(()=>{n(`auto`)},[e,t]),(0,s.useEffect)(()=>{n(`auto`);let e=requestAnimationFrame(()=>{n(`auto`),window.dispatchEvent(new Event(`resize`))});return()=>cancelAnimationFrame(e)},[e,t]),null}const oe={...a.t,NotFound:R,404:R};function X(e){return e.endsWith(`/`)&&e.length>1?e.slice(0,-1):e}function se({config:t}){let{currentLocale:n}=e.$();return(0,s.useEffect)(()=>{if(!t.i18n||typeof document>`u`)return;let e=n||t.i18n.defaultLocale,r=t.i18n.localeConfigs?.[e];document.documentElement.lang=r?.htmlLang||e||`en`,document.documentElement.dir=r?.direction||`ltr`},[n,t.i18n]),null}function ce({config:t,routeMap:n}){let r=(0,o.useLocation)(),{setLocale:i,setVersion:a}=e.$();return(0,s.useEffect)(()=>{let e=X(r.pathname),o=n.get(e);o&&(t.i18n&&i(o.locale||t.i18n.defaultLocale),t.versions&&a(o.version||t.versions.defaultVersion))},[r.pathname,t,n,i,a]),null}function Z({config:r,routes:i,components:a={}}){let l=(0,s.useMemo)(()=>({...oe,...f.default,...a}),[a]),{pathname:u}=(0,o.useLocation)(),d=(0,s.useMemo)(()=>X(u||`/`),[u]),p=(0,s.useMemo)(()=>{let e=new Map;for(let t of i){let n=X(t.path===``?`/`:t.path);e.set(n,t)}return e},[i]),m=(0,s.useMemo)(()=>{let e=p.get(d),t,n;return e&&(r.i18n&&(t=e.locale||r.i18n.defaultLocale),r.versions&&(n=e.version||r.versions.defaultVersion)),{initLocale:t,initVersion:n}},[d,r,p]);return(0,c.jsx)(Y,{children:(0,c.jsx)(e.et,{routes:i,children:(0,c.jsx)(n.c,{children:(0,c.jsx)(t.w,{children:(0,c.jsx)(y,{components:l,children:(0,c.jsxs)(e.tt.Provider,{value:r,children:[(0,c.jsx)(ae,{}),(0,c.jsxs)(e.Q,{initialLocale:m.initLocale,initialVersion:m.initVersion,children:[(0,c.jsx)(ce,{config:r,routeMap:p}),(0,c.jsx)(se,{config:r}),(0,c.jsx)(o.Outlet,{})]})]})})})})})})}function le({siteTitle:t,siteDescription:n,routes:r}){let i=(0,o.useLocation)(),a=e.nt(),{currentLocale:l}=e.X(),u=(0,s.useMemo)(()=>r?.find?.(e=>e.path===i.pathname),[r,i.pathname]),d=u?.title,f=E(n,l),p=u?.description||f||``,m=E(t,l),h=d?`${d} | ${m}`:m,g=u?.seo||{},_=a?.seo?.metatags||{},v=a?.seo?.thumbnails?.background,y=g[`og:image`]||v;return(0,c.jsxs)(J,{children:[(0,c.jsx)(`title`,{children:h}),(0,c.jsx)(`meta`,{name:`description`,content:p}),(0,c.jsx)(`meta`,{property:`og:title`,content:h}),(0,c.jsx)(`meta`,{property:`og:description`,content:p}),(0,c.jsx)(`meta`,{property:`og:type`,content:`article`}),typeof window<`u`&&(0,c.jsx)(`meta`,{property:`og:url`,content:window.location.href}),typeof window<`u`&&(0,c.jsx)(`link`,{rel:`canonical`,href:window.location.origin+i.pathname}),(0,c.jsx)(`meta`,{name:`twitter:card`,content:`summary`}),(0,c.jsx)(`meta`,{name:`twitter:title`,content:h}),(0,c.jsx)(`meta`,{name:`twitter:description`,content:p}),y&&(0,c.jsx)(`meta`,{name:`twitter:image`,content:y}),y&&(0,c.jsx)(`meta`,{property:`og:image`,content:y}),(0,c.jsx)(`meta`,{name:`generator`,content:`Boltdocs`}),Object.entries(_).map(([e,t])=>e.startsWith(`og:`)||e.startsWith(`music:`)||e.startsWith(`video:`)||e.startsWith(`article:`)||e.startsWith(`book:`)||e.startsWith(`profile:`)?(0,c.jsx)(`meta`,{property:e,content:t},e):(0,c.jsx)(`meta`,{name:e,content:t},e)),Object.entries(g).map(([e,t])=>e===`noindex`&&t===!0?(0,c.jsx)(`meta`,{name:`robots`,content:`noindex`},`noindex`):e===`robots`?(0,c.jsx)(`meta`,{name:`robots`,content:t},`robots`):e===`canonical`?(0,c.jsx)(`link`,{rel:`canonical`,href:t},`canonical`):e.startsWith(`og:`)||e.startsWith(`music:`)||e.startsWith(`video:`)||e.startsWith(`article:`)||e.startsWith(`book:`)||e.startsWith(`profile:`)?(0,c.jsx)(`meta`,{property:e,content:t},e):(0,c.jsx)(`meta`,{name:e,content:t},e))]})}function ue(){let t=e.nt(),{currentRoute:n,allRoutes:r}=e.X();return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(le,{siteTitle:t.theme?.title,siteDescription:t.theme?.description,routes:r||[]}),(0,c.jsx)(p.default,{route:n,children:(0,c.jsx)(o.Outlet,{})})]})}const de=()=>(0,c.jsx)(`div`,{className:`text-muted text-sm py-4`,children:`Loading...`}),fe=({moduleLoader:e,moduleKey:t,route:n,components:r})=>{let i=e?.default??e??null;return(0,s.useEffect)(()=>{if(!{}.hot||!t)return;let e=e=>{e.relPath.replace(/\\/g,`/`).replace(/^\//,``)===n.filePath.replace(/\\/g,`/`).replace(/^\//,``)&&import(t+`?t=`+Date.now()).then(e=>{})};return{}.hot.on(`boltdocs:mdx-update`,e),()=>({}).hot?.off(`boltdocs:mdx-update`,e)},[t,n.filePath]),i?(0,c.jsx)(K,{MDXComponent:i,mdxComponents:r}):(0,c.jsx)(de,{})},pe=()=>{let e=v();return(0,c.jsx)(e.NotFound||e[404]||R,{})};function me(e){let{routesData:t,config:n,mdxModules:r,externalPages:i,externalLayout:a,components:o}=e,s=a||(({children:e})=>(0,c.jsx)(c.Fragment,{children:e})),l=e=>{let t=n.base||`/`;return e.startsWith(t)?e:`${t===`/`?``:t.replace(/\/$/,``)}${e.startsWith(`/`)?e:`/${e}`}`||`/`},u=[],d=n.versions?.defaultVersion,f=(n.base||`/docs`).replace(/\/$/,``),p=(n.base||`/docs`).replace(/\/$/,``);p||=`/`,d&&t.forEach(e=>{if(e.version)return;let t=e.path||``,n=t.startsWith(f)?t.substring(f.length).replace(/^\//,``):t.replace(/^\//,``);if(!(n===d||n.startsWith(`${d}/`))){let t=`${f}/${d}/${n}`.replace(/\/+/g,`/`).replace(/\/$/,``)||`/`;u.push({...e,path:t,version:d})}});let m=[...t,...u],h=new Map,g=Object.keys(r);if(g.length>0){let e=g[0].replace(/\\/g,`/`).split(`/`).filter(Boolean)[0]||`docs`,t=`/${e}/`,n=`./${e}/`;for(let e of g){let r=e.replace(/\\/g,`/`),i=``;r.indexOf(t)===-1?r.startsWith(n)&&(i=r.substring(n.length)):i=r.substring(r.indexOf(t)+t.length),i?h.set(i,e):h.set(r,e)}}let _=m.map(e=>{let t=e.filePath.replace(/\\/g,`/`),n=h.get(t),i=n?r[n]:null,a=l(e.path===``?`/`:e.path),s=a===p?`.`:a.startsWith(p+`/`)?a.slice(p.length+1):a;return{path:s,element:(0,c.jsx)(fe,{moduleKey:n,moduleLoader:i,route:e,components:o},n||s),loader:async()=>({path:s,frontmatter:{title:e.title,description:e.description||``,...e.frontmatter||{}},headings:e.headings||[],filePath:e.filePath,locale:e.locale,version:e.version,group:e.group,groupTitle:e.groupTitle,date:e.date,lastUpdated:e.lastUpdated}),getStaticPaths:()=>[s]}}),v=n.i18n?.locales?Array.isArray(n.i18n.locales)?n.i18n.locales:Object.keys(n.i18n.locales):[],y=n.versions?.versions?.map(e=>e.path)||[],b=[];b.push({path:p,filter:()=>!0});let x=[];y.length>0&&y.forEach(e=>x.push(`/${e}`)),v.length>0&&v.forEach(e=>x.push(`/${e}`)),y.length>0&&v.length>0&&y.forEach(e=>{v.forEach(t=>{x.push(`/${e}/${t}`)})}),x.forEach(e=>{let t=p===`/`?e:`${p}${e}`;b.push({path:t,filter:e=>e.startsWith(t.replace(/\/$/,``)+`/`)})});let S=new Set(_.map(e=>(e.path||``).replace(/\/$/,``))),C=new Set;i&&Object.keys(i).forEach(e=>{let t=e.startsWith(`/`)?e:`/${e}`;C.add(t.replace(/\/$/,``)),n.i18n&&Object.keys(n.i18n.locales).forEach(e=>{C.add(`/${e}${t===`/`?``:t}`.replace(/\/$/,``))})}),b.forEach(({path:e,filter:t})=>{if(e===`/`)return;let r=e.replace(/\/$/,``);if(!(S.has(r)||C.has(r))){let i=n.theme?.tabs?.[0]?.id,a=i?`${r}/${i}`.replace(/\/+/g,`/`):null,o=a&&S.has(a.replace(/\/$/,``))?_.find(e=>e.path.replace(/\/$/,``)===a.replace(/\/$/,``)):_.find(e=>t(e.path)&&e.path!==r);if(!o&&_.length>0&&(o=_[0]),o){let t=e===p?`.`:e.startsWith(p+`/`)?e.slice(p.length+1):e,r=t===`.`;_.push({...r?{index:!0}:{path:t},element:o.element,loader:o.loader,getStaticPaths:()=>[]});let i=m.find(e=>{let t=l(e.path===``?`/`:e.path);return(t===p?`.`:t.startsWith(p+`/`)?t.slice(p.length+1):t)===o.path});if(i){let t=l(i.path),r=n.siteUrl?`${n.siteUrl.replace(/\/$/,``)}${t}`:t;m.push({...i,path:e,filePath:``,slugParts:[],seo:{...i.seo,canonical:r}})}}}});let w=[{path:p,element:(0,c.jsx)(ue,{}),children:_}],T=[];return i&&Object.entries(i).forEach(([e,t])=>{let r=e.startsWith(`/`)?e:`/${e}`;w.find(e=>e.path===r)||(T.push({path:r,locale:n.i18n?.defaultLocale,title:e===`/`?`Home`:e.replace(/^\//,``).split(`/`).pop()||`Page`,filePath:``,headings:[]}),w.push({path:r,element:(0,c.jsx)(s,{children:(0,c.jsx)(t,{})}),loader:async()=>({path:r,locale:n.i18n?.defaultLocale}),getStaticPaths:()=>[r]}),n.i18n&&Object.keys(n.i18n.locales).forEach(n=>{let r=`/${n}${e===`/`?``:e}`;w.find(e=>e.path===r)||(T.push({path:r,locale:n,title:e,filePath:``,headings:[]}),w.push({path:r,element:(0,c.jsx)(s,{children:(0,c.jsx)(t,{})}),loader:async()=>({path:r,locale:n}),getStaticPaths:()=>[r]}))}))}),w.push({path:`*`,element:(0,c.jsx)(s,{children:(0,c.jsx)(pe,{})})}),[{element:(0,c.jsx)(Z,{config:n,routes:[...m,...T],components:o}),children:w}]}function Q(e){return typeof window>`u`?$():typeof window.gtag==`function`?he(e):window.dataLayer?ge(e):$()}function he(e){return{trackPageView:(t,n)=>{window.gtag?.(`event`,`page_view`,{page_path:t,page_title:n||document.title,send_to:e?.ga4?.measurementId})},trackEvent:({action:t,category:n,label:r,value:i,params:a})=>{window.gtag?.(`event`,t,{event_category:n,event_label:r,value:i,send_to:e?.ga4?.measurementId,...a})},trackSearch:(t,n)=>{window.gtag?.(`event`,`search`,{search_term:t,results_count:n,send_to:e?.ga4?.measurementId})},trackDownload:(t,n)=>{window.gtag?.(`event`,`file_download`,{file_name:t,file_type:n||t.split(`.`).pop(),send_to:e?.ga4?.measurementId})},trackExternalLink:t=>{window.gtag?.(`event`,`external_link`,{link_url:t,send_to:e?.ga4?.measurementId})},isEnabled:!0}}function ge(e){return{trackPageView:(t,n)=>{window.dataLayer?.push({event:`page_view`,page_path:t,page_title:n||document.title,send_to:e?.gtm?.tagId})},trackEvent:({action:t,category:n,label:r,value:i,params:a})=>{window.dataLayer?.push({event:t,event_category:n,event_label:r,value:i,send_to:e?.gtm?.tagId,...a})},trackSearch:(t,n)=>{window.dataLayer?.push({event:`search`,search_term:t,results_count:n,send_to:e?.gtm?.tagId})},trackDownload:(t,n)=>{window.dataLayer?.push({event:`file_download`,file_name:t,file_type:n||t.split(`.`).pop(),send_to:e?.gtm?.tagId})},trackExternalLink:t=>{window.dataLayer?.push({event:`external_link`,link_url:t,send_to:e?.gtm?.tagId})},isEnabled:!0}}function $(){return{trackPageView:()=>{},trackEvent:()=>{},trackSearch:()=>{},trackDownload:()=>{},trackExternalLink:()=>{},isEnabled:!1}}const _e=Symbol.for(`__BDOCS_CONFIG_INSTANCE__`);function ve(e={}){let{config:n,autoTrackPageViews:r=!0,autoTrackDownloads:i=!0,autoTrackExternalLinks:a=!0,excludePatterns:o=[]}=e,c=typeof globalThis<`u`?globalThis[_e]:void 0,l=n??c?.integrations,u=(0,s.useMemo)(()=>Q(l),[l]),d=(0,s.useRef)(``),f=t.r();return(0,s.useEffect)(()=>{if(!r||!u.isEnabled)return;let e=f.pathname+f.search;e!==d.current&&(d.current=e,u.trackPageView(e,document.title))},[f.pathname,r,u]),(0,s.useEffect)(()=>{if(!i||!u.isEnabled)return;let e=e=>{let t=e.target?.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);if(n&&!o.some(e=>e.test(n))&&(t.hasAttribute(`download`)||/\.(pdf|doc|docx|xls|xlsx|ppt|pptx|zip|rar|7z|tar|gz|mp3|mp4|avi|mov|png|jpg|jpeg|gif|svg|webp)$/i.test(n))){let e=n.split(`/`).pop()||n;u.trackDownload(e,e.split(`.`).pop())}};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[i,a,u,o]),(0,s.useEffect)(()=>{if(!a||!u.isEnabled)return;let e=e=>{let t=e.target?.closest(`a`);if(!t)return;let n=t.getAttribute(`href`);n&&(o.some(e=>e.test(n))||(n.startsWith(`http://`)||n.startsWith(`https://`)||n.startsWith(`//`))&&!n.includes(window.location.hostname)&&u.trackExternalLink(n))};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[a,u,o]),u}function ye(){let e=(0,s.useMemo)(()=>Q(),[]);return(0,s.useCallback)((t,n)=>{e.trackPageView(t,n)},[e])}function be(){let e=(0,s.useMemo)(()=>Q(),[]);return(0,s.useCallback)(t=>{e.trackEvent(t)},[e])}function xe({children:n}){let{routes:r,currentRoute:i}=e.X(),a=e.nt();return(0,c.jsxs)(t.t,{className:`selection:bg-primary-500/10 selection:text-primary-500`,children:[(0,c.jsx)(I,{}),(0,c.jsxs)(t.t.Body,{className:`bg-main`,children:[(0,c.jsx)(U,{routes:r||[],config:a}),(0,c.jsx)(t.t.Content,{className:`animate-in fade-in duration-500 scroll-smooth`,children:(0,c.jsxs)(t.t.ContentMdx,{className:`max-w-3xl sm:max-w-4xl lg:max-w-4xl px-2 pt-8 pb-24`,children:[(0,c.jsxs)(t.t.Header,{children:[(0,c.jsxs)(`div`,{className:`mb-4 border-b border-subtle pb-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,c.jsx)(x,{}),(0,c.jsx)(C,{mdxRaw:i?._rawContent,route:i})]}),i?.title&&(0,c.jsx)(`h1`,{className:`text-4xl font-bold tracking-tight text-default mb-3`,children:i.title}),i?.description&&(0,c.jsx)(`p`,{className:`text-lg text-muted-foreground mb-6 leading-relaxed`,children:i.description})]}),(0,c.jsx)(w,{children:(0,c.jsx)(`div`,{className:`prose prose-neutral dark:prose-invert max-w-none`,children:n})}),(0,c.jsx)(t.t.Footer,{children:(0,c.jsx)(V,{})})]})}),(0,c.jsx)(z,{headings:i?.headings,editLink:a.theme?.editLink,communityHelp:a.theme?.communityHelp,filePath:i?.filePath})]})]})}const Se=Object.assign(xe,{Body:t.t.Body,Content:t.t.Content,ContentMdx:t.t.ContentMdx,Header:t.t.Header,Footer:t.t.Footer});exports.BoltdocsShell=Z,exports.Breadcrumbs=x,exports.Card=a.r,exports.Cards=a.n,exports.CopyMarkdown=C,exports.DocsLayout=Se,exports.ErrorBoundary=w,exports.MdxPage=K,exports.Navbar=I,exports.NotFound=R,exports.OnThisPage=z,exports.PageNav=V,exports.SearchDialog=i.t,exports.Sidebar=U,Object.defineProperty(exports,`ViteReactSSG`,{enumerable:!0,get:function(){return m.ViteReactSSG}}),exports.cn=e.y,exports.copyToClipboard=a.i,exports.createRoutes=me,exports.getStarsRepo=T,exports.getTranslated=E,exports.reactToText=a.a,exports.useAnalytics=ve,exports.useBreadcrumbs=b,exports.useConfig=e.nt,exports.useI18n=M,exports.useLocalizedTo=e.b,exports.useLocation=t.r,exports.useMdxComponents=v,exports.useNavbar=D,exports.usePageNav=B,exports.useRoutes=e.X,exports.useSearch=i.n,exports.useSearchHighlight=t.n,exports.useSidebar=t.m,exports.useTabs=k,exports.useTheme=n.l,exports.useTrackEvent=be,exports.useTrackPageView=ye,exports.useUI=t.T,exports.useVersion=j;
|
|
6
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
7
|
+
const require_icons_dev = require('../icons-dev-3cZMyt8r.cjs');
|
|
8
|
+
const require_docs_layout = require('../docs-layout-BXHV0xw_.cjs');
|
|
9
|
+
const require_image = require('../image-DtrI2cw3.cjs');
|
|
10
|
+
const require_search_dialog = require('../search-dialog-C7xuvyNk.cjs');
|
|
11
|
+
const require_search_dialog$1 = require('../search-dialog-BwkDuI9R.cjs');
|
|
12
|
+
const require_mdx = require('../mdx-BdWkJTeB.cjs');
|
|
13
|
+
let react_router_dom = require("react-router-dom");
|
|
14
|
+
let react = require("react");
|
|
15
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
16
|
+
let react_aria_components = require("react-aria-components");
|
|
17
|
+
let virtual_boltdocs_icons = require("virtual:boltdocs-icons");
|
|
18
|
+
virtual_boltdocs_icons = require_icons_dev.__toESM(virtual_boltdocs_icons);
|
|
19
|
+
let react_helmet_async = require("react-helmet-async");
|
|
20
|
+
react_helmet_async = require_icons_dev.__toESM(react_helmet_async);
|
|
21
|
+
let virtual_boltdocs_mdx_components = require("virtual:boltdocs-mdx-components");
|
|
22
|
+
virtual_boltdocs_mdx_components = require_icons_dev.__toESM(virtual_boltdocs_mdx_components);
|
|
23
|
+
let virtual_boltdocs_layout = require("virtual:boltdocs-layout");
|
|
24
|
+
virtual_boltdocs_layout = require_icons_dev.__toESM(virtual_boltdocs_layout);
|
|
25
|
+
let _bdocs_ssg = require("@bdocs/ssg");
|
|
26
|
+
|
|
27
|
+
//#region src/client/app/mdx-components-context.tsx
|
|
28
|
+
const MDX_COMPONENTS_CONTEXT_SYMBOL = Symbol.for("__BDOCS_MDX_COMPONENTS_CONTEXT__");
|
|
29
|
+
const MDX_COMPONENTS_INSTANCE_SYMBOL = Symbol.for("__BDOCS_MDX_COMPONENTS_INSTANCE__");
|
|
30
|
+
const MdxComponentsContext = globalThis[MDX_COMPONENTS_CONTEXT_SYMBOL] || (globalThis[MDX_COMPONENTS_CONTEXT_SYMBOL] = (0, react.createContext)({}));
|
|
31
|
+
function useMdxComponents() {
|
|
32
|
+
const context = (0, react.use)(MdxComponentsContext);
|
|
33
|
+
if ((!context || Object.keys(context).length === 0) && globalThis[MDX_COMPONENTS_INSTANCE_SYMBOL]) return globalThis[MDX_COMPONENTS_INSTANCE_SYMBOL];
|
|
34
|
+
return context;
|
|
35
|
+
}
|
|
36
|
+
function MdxComponentsProvider({ components, children }) {
|
|
37
|
+
const processedComponents = (0, react.useMemo)(() => {
|
|
38
|
+
const processed = {};
|
|
39
|
+
const frontmatter = {};
|
|
40
|
+
Object.entries(components).forEach(([key, value]) => {
|
|
41
|
+
if (key.startsWith("Frontmatter_")) {
|
|
42
|
+
const cleanKey = key.slice(12);
|
|
43
|
+
frontmatter[cleanKey] = value;
|
|
44
|
+
} else processed[key] = value;
|
|
45
|
+
});
|
|
46
|
+
processed.Frontmatter = frontmatter;
|
|
47
|
+
return processed;
|
|
48
|
+
}, [components]);
|
|
49
|
+
if (typeof globalThis !== "undefined") globalThis[MDX_COMPONENTS_INSTANCE_SYMBOL] = processedComponents;
|
|
50
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MdxComponentsContext.Provider, {
|
|
51
|
+
value: processedComponents,
|
|
52
|
+
children
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
//#region src/client/hooks/use-breadcrumbs.ts
|
|
58
|
+
/**
|
|
59
|
+
* Hook to generate breadcrumbs based on the current active route.
|
|
60
|
+
*/
|
|
61
|
+
function useBreadcrumbs() {
|
|
62
|
+
const { currentRoute: activeRoute } = require_icons_dev.useRoutes();
|
|
63
|
+
const crumbs = [];
|
|
64
|
+
if (activeRoute) {
|
|
65
|
+
if (activeRoute.groupTitle) crumbs.push({ label: activeRoute.groupTitle });
|
|
66
|
+
crumbs.push({
|
|
67
|
+
label: activeRoute.title,
|
|
68
|
+
href: activeRoute.path
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
crumbs,
|
|
73
|
+
activeRoute
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/client/components/ui-base/breadcrumbs.tsx
|
|
79
|
+
function Breadcrumbs() {
|
|
80
|
+
const { crumbs, activeRoute } = useBreadcrumbs();
|
|
81
|
+
if (crumbs.length === 0) return null;
|
|
82
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Breadcrumbs.Root, {
|
|
83
|
+
className: "gap-2 text-xs sm:text-sm font-medium",
|
|
84
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Breadcrumbs.Item, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Breadcrumbs.Link, {
|
|
85
|
+
href: "/",
|
|
86
|
+
className: "text-muted hover:text-body transition-colors flex items-center",
|
|
87
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Home, { size: 14 })
|
|
88
|
+
}) }), crumbs.map((crumb, i) => {
|
|
89
|
+
const isActive = crumb.href === activeRoute?.path;
|
|
90
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Breadcrumbs.Item, {
|
|
91
|
+
className: "gap-2",
|
|
92
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Breadcrumbs.Separator, { className: "text-muted/40" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Breadcrumbs.Link, {
|
|
93
|
+
href: crumb.href,
|
|
94
|
+
className: require_icons_dev.cn("transition-colors", isActive ? "text-body font-semibold cursor-default pointer-events-none" : "text-muted hover:text-body"),
|
|
95
|
+
children: crumb.label
|
|
96
|
+
})]
|
|
97
|
+
}, `crumb-${crumb.href}-${crumb.label}-${i}`);
|
|
98
|
+
})]
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/client/components/ui-base/copy-markdown.tsx
|
|
104
|
+
const useCopyMarkdown = (content) => {
|
|
105
|
+
const [copied, setCopied] = (0, react.useState)(false);
|
|
106
|
+
const handleCopy = () => {
|
|
107
|
+
navigator.clipboard.writeText(content);
|
|
108
|
+
setCopied(true);
|
|
109
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
110
|
+
};
|
|
111
|
+
const handleOpenRaw = () => {
|
|
112
|
+
const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
|
|
113
|
+
const url = URL.createObjectURL(blob);
|
|
114
|
+
window.open(url, "_blank");
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
copied,
|
|
118
|
+
handleCopy,
|
|
119
|
+
handleOpenRaw
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
function CopyMarkdown({ content, mdxRaw }) {
|
|
123
|
+
const displayContent = mdxRaw || content || "";
|
|
124
|
+
const { copied, handleCopy, handleOpenRaw } = useCopyMarkdown(displayContent);
|
|
125
|
+
if (!displayContent) return null;
|
|
126
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
127
|
+
className: "relative inline-flex z-100 shrink-0 w-max",
|
|
128
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.ButtonGroup, {
|
|
129
|
+
className: "rounded-xl border border-subtle bg-surface transition-all duration-300 hover:border-primary-500/50 group overflow-hidden",
|
|
130
|
+
children: [
|
|
131
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Button, {
|
|
132
|
+
onPress: handleCopy,
|
|
133
|
+
className: require_icons_dev.cn("md:hidden flex items-center justify-center w-8 h-8 bg-transparent outline-none select-none cursor-pointer border-none", "text-muted transition-all duration-300 hover:bg-primary-500/5 hover:text-body", copied && "text-emerald-500 hover:bg-emerald-500/5"),
|
|
134
|
+
"aria-label": copied ? "Copied!" : "Copy Markdown",
|
|
135
|
+
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Check, { size: 14 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Copy, { size: 14 })
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Button, {
|
|
138
|
+
onPress: handleCopy,
|
|
139
|
+
className: require_icons_dev.cn("hidden md:flex items-center gap-2 px-5 py-2 bg-transparent text-[0.8125rem] font-semibold h-9 shrink-0 outline-none select-none cursor-pointer border-none", "text-body transition-all duration-300 hover:bg-primary-500/5", copied && "text-emerald-500 hover:bg-emerald-500/5"),
|
|
140
|
+
children: [copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Check, { size: 16 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Copy, { size: 16 }), copied ? "Copied!" : "Copy Markdown"]
|
|
141
|
+
}),
|
|
142
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Menu.Trigger, {
|
|
143
|
+
placement: "bottom end",
|
|
144
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Button, {
|
|
145
|
+
className: require_icons_dev.cn("flex items-center justify-center px-2.5 md:px-3.5 h-8 md:h-9 border-none border-l border-subtle/50 text-muted rounded-none bg-transparent shrink-0 outline-none select-none cursor-pointer", "transition-all duration-300 hover:bg-primary-500/5 hover:text-primary-500"),
|
|
146
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.ChevronDown, { size: 14 })
|
|
147
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Menu.Root, {
|
|
148
|
+
className: "w-52 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100",
|
|
149
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Menu.Item, {
|
|
150
|
+
onAction: handleCopy,
|
|
151
|
+
className: "flex items-center px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group",
|
|
152
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Copy, {
|
|
153
|
+
size: 16,
|
|
154
|
+
className: "size-4 text-muted dark:group-hover:text-primary-500 group-hover:text-primary-400"
|
|
155
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
156
|
+
className: "ml-2",
|
|
157
|
+
children: "Copy Markdown"
|
|
158
|
+
})]
|
|
159
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Menu.Item, {
|
|
160
|
+
onAction: handleOpenRaw,
|
|
161
|
+
className: "flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group",
|
|
162
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.ExternalLink, {
|
|
163
|
+
size: 16,
|
|
164
|
+
className: "size-4 text-muted dark:group-hover:text-primary-500 group-hover:text-primary-400"
|
|
165
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
166
|
+
className: "ml-2",
|
|
167
|
+
children: "View as Markdown"
|
|
168
|
+
})]
|
|
169
|
+
})]
|
|
170
|
+
})]
|
|
171
|
+
})
|
|
172
|
+
]
|
|
173
|
+
})
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
//#endregion
|
|
178
|
+
//#region src/client/components/ui-base/error-boundary.tsx
|
|
179
|
+
function ErrorBoundary({ children, fallback }) {
|
|
180
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.ErrorBoundary, {
|
|
181
|
+
fallback,
|
|
182
|
+
children
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region src/client/utils/github.ts
|
|
188
|
+
const BASE_URL = "https://api.github.com";
|
|
189
|
+
/**
|
|
190
|
+
* Get the number of stars for a GitHub repository.
|
|
191
|
+
* @param repo - owner/repo
|
|
192
|
+
* @param token - The GitHub token.
|
|
193
|
+
* @param baseUrl - The GitHub API base URL.
|
|
194
|
+
* @returns The number of stars for the repository.
|
|
195
|
+
* @example
|
|
196
|
+
* getStarsRepo('owner/repo') // 100k
|
|
197
|
+
*/
|
|
198
|
+
async function getStarsRepo(repo, token, baseUrl = BASE_URL) {
|
|
199
|
+
const headers = new Headers();
|
|
200
|
+
if (token) headers.append("authorization", token);
|
|
201
|
+
const data = await (await fetch(`${baseUrl}/repos/${repo}`, { headers })).json();
|
|
202
|
+
if (data.stargazers_count !== void 0) return formatStars(data.stargazers_count);
|
|
203
|
+
else return "0";
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Format a number of stars in a compact form.
|
|
207
|
+
* @param count - The number of stars to format.
|
|
208
|
+
* @returns The formatted number of stars.
|
|
209
|
+
*/
|
|
210
|
+
const formatStars = (count) => {
|
|
211
|
+
return Intl.NumberFormat("en", {
|
|
212
|
+
notation: "compact",
|
|
213
|
+
compactDisplay: "short"
|
|
214
|
+
}).format(count);
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
//#endregion
|
|
218
|
+
//#region src/client/components/ui-base/github-stars.tsx
|
|
219
|
+
function GithubStars({ repo }) {
|
|
220
|
+
const [stars, setStars] = (0, react.useState)(null);
|
|
221
|
+
(0, react.useEffect)(() => {
|
|
222
|
+
if (repo) getStarsRepo(repo).then((stars) => setStars(stars)).catch(() => setStars("0"));
|
|
223
|
+
}, [repo]);
|
|
224
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
225
|
+
href: `https://github.com/${repo}`,
|
|
226
|
+
target: "_blank",
|
|
227
|
+
rel: "noopener noreferrer",
|
|
228
|
+
className: "inline-flex items-center gap-2 rounded-xl border border-subtle bg-surface px-3 py-1.5 text-xs font-semibold text-muted dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 hover:border-primary-500/50 hover:text-body select-none outline-none",
|
|
229
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Github, { className: "h-4 w-4 text-body" }), stars !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
230
|
+
className: "tabular-nums font-medium",
|
|
231
|
+
children: [stars, " stars"]
|
|
232
|
+
})]
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
//#endregion
|
|
237
|
+
//#region src/client/utils/i18n.ts
|
|
238
|
+
/**
|
|
239
|
+
* Retrieves the correct translation from a value that can be either
|
|
240
|
+
* a simple string or a map of locale-specific strings.
|
|
241
|
+
*
|
|
242
|
+
* @param value - The text to translate
|
|
243
|
+
* @param locale - The current active locale (e.g., 'en', 'es')
|
|
244
|
+
* @returns The translated string
|
|
245
|
+
*/
|
|
246
|
+
function getTranslated(value, locale) {
|
|
247
|
+
if (!value) return "";
|
|
248
|
+
if (typeof value === "string") return value;
|
|
249
|
+
if (locale && value[locale]) return value[locale];
|
|
250
|
+
return Object.values(value)[0] || "";
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/client/hooks/use-navbar.ts
|
|
255
|
+
function useNavbar() {
|
|
256
|
+
const config = require_icons_dev.useConfig();
|
|
257
|
+
const { theme, resolvedTheme } = require_image.useTheme();
|
|
258
|
+
const location = (0, react_router_dom.useLocation)();
|
|
259
|
+
const { currentLocale } = require_icons_dev.useRoutes();
|
|
260
|
+
const themeConfig = config.theme || {};
|
|
261
|
+
const title = getTranslated(themeConfig.title, currentLocale) || "Boltdocs";
|
|
262
|
+
const rawLinks = themeConfig.navbar || [];
|
|
263
|
+
const socialLinks = themeConfig.socialLinks || [];
|
|
264
|
+
const githubRepo = themeConfig.githubRepo;
|
|
265
|
+
const links = (0, react.useMemo)(() => {
|
|
266
|
+
return rawLinks.map((item) => {
|
|
267
|
+
const href = item.href || item.to || item.link || "";
|
|
268
|
+
const getIsActive = (h) => {
|
|
269
|
+
const activePath = location.pathname;
|
|
270
|
+
if (activePath === h) return true;
|
|
271
|
+
if (!h || h === "/") return activePath === "/";
|
|
272
|
+
const cleanPathParts = (p) => {
|
|
273
|
+
const parts = p.split("/").filter(Boolean);
|
|
274
|
+
let i = 0;
|
|
275
|
+
if (config.i18n?.locales && parts[i] && config.i18n.locales[parts[i]]) i++;
|
|
276
|
+
if (config.versions?.versions && parts[i]) {
|
|
277
|
+
if (config.versions.versions.some((v) => v.path === parts[i])) i++;
|
|
278
|
+
}
|
|
279
|
+
return parts.slice(i);
|
|
280
|
+
};
|
|
281
|
+
const hParts = cleanPathParts(h);
|
|
282
|
+
const pParts = cleanPathParts(activePath);
|
|
283
|
+
if (hParts.length === 0) return pParts.length === 0;
|
|
284
|
+
if (pParts.length < hParts.length) return false;
|
|
285
|
+
return hParts.every((part, i) => pParts[i] === part);
|
|
286
|
+
};
|
|
287
|
+
const processItems = (items) => {
|
|
288
|
+
if (!items || items.length === 0) return void 0;
|
|
289
|
+
return items.map((subItem) => {
|
|
290
|
+
const subHref = subItem.href || subItem.to || subItem.link || "";
|
|
291
|
+
return {
|
|
292
|
+
label: getTranslated(subItem.label || subItem.text, currentLocale),
|
|
293
|
+
href: subHref,
|
|
294
|
+
active: getIsActive(subHref),
|
|
295
|
+
to: subHref.startsWith("http") || subHref.startsWith("//") ? "external" : void 0
|
|
296
|
+
};
|
|
297
|
+
});
|
|
298
|
+
};
|
|
299
|
+
const linkItems = processItems(item.items);
|
|
300
|
+
return {
|
|
301
|
+
label: getTranslated(item.label || item.text, currentLocale),
|
|
302
|
+
href,
|
|
303
|
+
active: getIsActive(href),
|
|
304
|
+
to: href.startsWith("http") || href.startsWith("//") ? "external" : void 0,
|
|
305
|
+
items: linkItems
|
|
306
|
+
};
|
|
307
|
+
});
|
|
308
|
+
}, [
|
|
309
|
+
rawLinks,
|
|
310
|
+
location.pathname,
|
|
311
|
+
currentLocale,
|
|
312
|
+
config
|
|
313
|
+
]);
|
|
314
|
+
const logo = themeConfig.logo;
|
|
315
|
+
return {
|
|
316
|
+
links,
|
|
317
|
+
title,
|
|
318
|
+
logo: !logo ? null : typeof logo === "string" ? logo : resolvedTheme === "dark" ? logo.dark : logo.light,
|
|
319
|
+
logoProps: {
|
|
320
|
+
alt: (logo && typeof logo === "object" ? logo.alt : void 0) || title,
|
|
321
|
+
width: logo && typeof logo === "object" ? logo.width : void 0,
|
|
322
|
+
height: logo && typeof logo === "object" ? logo.height : void 0
|
|
323
|
+
},
|
|
324
|
+
github: githubRepo ? `https://github.com/${githubRepo}` : null,
|
|
325
|
+
social: socialLinks,
|
|
326
|
+
config,
|
|
327
|
+
theme
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
//#endregion
|
|
332
|
+
//#region src/client/components/ui-base/theme-toggle.tsx
|
|
333
|
+
function ThemeToggle() {
|
|
334
|
+
const { theme, setTheme } = require_image.useTheme();
|
|
335
|
+
const [mounted, setMounted] = (0, react.useState)(false);
|
|
336
|
+
(0, react.useEffect)(() => {
|
|
337
|
+
setMounted(true);
|
|
338
|
+
}, []);
|
|
339
|
+
if (!mounted) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "h-9 w-9" });
|
|
340
|
+
const Icon = theme === "system" ? require_icons_dev.Monitor : theme === "dark" ? require_icons_dev.Moon : require_icons_dev.Sun;
|
|
341
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Menu.Trigger, {
|
|
342
|
+
placement: "bottom right",
|
|
343
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_aria_components.Button, {
|
|
344
|
+
className: "flex h-9 w-9 items-center justify-center rounded-xl text-muted transition-colors hover:bg-surface hover:text-body outline-none border-none bg-transparent cursor-pointer",
|
|
345
|
+
"aria-label": "Selection theme",
|
|
346
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
347
|
+
size: 20,
|
|
348
|
+
className: "animate-in fade-in zoom-in duration-300"
|
|
349
|
+
})
|
|
350
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Menu.Root, {
|
|
351
|
+
selectionMode: "single",
|
|
352
|
+
selectedKeys: [theme],
|
|
353
|
+
onSelectionChange: (keys) => {
|
|
354
|
+
const newTheme = Array.from(keys)[0];
|
|
355
|
+
setTheme(newTheme);
|
|
356
|
+
},
|
|
357
|
+
className: "w-36 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100",
|
|
358
|
+
children: [
|
|
359
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Menu.Item, {
|
|
360
|
+
id: "light",
|
|
361
|
+
className: "group flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5",
|
|
362
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Sun, {
|
|
363
|
+
className: "group-hover:text-primary-500 dark:group-hover:text-primary-200",
|
|
364
|
+
size: 16
|
|
365
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
366
|
+
className: "ml-2",
|
|
367
|
+
children: "Light"
|
|
368
|
+
})]
|
|
369
|
+
}),
|
|
370
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Menu.Item, {
|
|
371
|
+
id: "dark",
|
|
372
|
+
className: "flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5",
|
|
373
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Moon, {
|
|
374
|
+
className: "group-hover:text-primary-500 dark:group-hover:text-primary-200",
|
|
375
|
+
size: 16
|
|
376
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
377
|
+
className: "ml-2",
|
|
378
|
+
children: "Dark"
|
|
379
|
+
})]
|
|
380
|
+
}),
|
|
381
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Menu.Item, {
|
|
382
|
+
id: "system",
|
|
383
|
+
className: "flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5",
|
|
384
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Monitor, {
|
|
385
|
+
className: "group-hover:text-primary-500 dark:group-hover:text-primary-200",
|
|
386
|
+
size: 16
|
|
387
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
388
|
+
className: "ml-2",
|
|
389
|
+
children: "System"
|
|
390
|
+
})]
|
|
391
|
+
})
|
|
392
|
+
]
|
|
393
|
+
})]
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
function ThemeSwitcher({ className }) {
|
|
397
|
+
const { theme, setTheme } = require_image.useTheme();
|
|
398
|
+
const [mounted, setMounted] = (0, react.useState)(false);
|
|
399
|
+
(0, react.useEffect)(() => {
|
|
400
|
+
setMounted(true);
|
|
401
|
+
}, []);
|
|
402
|
+
if (!mounted) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_icons_dev.cn("h-10 w-full bg-surface rounded-xl animate-pulse", className) });
|
|
403
|
+
const isDark = theme === "dark";
|
|
404
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
405
|
+
className: require_icons_dev.cn("flex p-1 bg-surface border border-subtle rounded-xl relative w-full h-11", className),
|
|
406
|
+
children: [
|
|
407
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_icons_dev.cn("absolute inset-y-1 w-[calc(50%-4px)] bg-main border border-subtle rounded-lg transition-all duration-300 ease-out shadow-xs", isDark ? "translate-x-full" : "translate-x-0") }),
|
|
408
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
409
|
+
onClick: () => setTheme("light"),
|
|
410
|
+
className: require_icons_dev.cn("flex-1 flex items-center justify-center rounded-lg z-10 transition-colors outline-none cursor-pointer border-none bg-transparent", !isDark ? "text-body font-semibold" : "text-muted hover:text-body"),
|
|
411
|
+
"aria-label": "Light mode",
|
|
412
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Sun, { size: 18 })
|
|
413
|
+
}),
|
|
414
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
415
|
+
onClick: () => setTheme("dark"),
|
|
416
|
+
className: require_icons_dev.cn("flex-1 flex items-center justify-center rounded-lg z-10 transition-colors outline-none cursor-pointer border-none bg-transparent", isDark ? "text-body font-semibold" : "text-muted hover:text-body"),
|
|
417
|
+
"aria-label": "Dark mode",
|
|
418
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Moon, { size: 18 })
|
|
419
|
+
})
|
|
420
|
+
]
|
|
421
|
+
});
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
//#endregion
|
|
425
|
+
//#region src/client/hooks/use-tabs.ts
|
|
426
|
+
function useTabs(tabs = [], routes = []) {
|
|
427
|
+
const location = (0, react_router_dom.useLocation)();
|
|
428
|
+
const tabRefs = (0, react.useRef)([]);
|
|
429
|
+
const [indicatorStyle, setIndicatorStyle] = (0, react.useState)({
|
|
430
|
+
opacity: 0,
|
|
431
|
+
transform: "translateX(0) scaleX(0)",
|
|
432
|
+
width: 0
|
|
433
|
+
});
|
|
434
|
+
const currentPath = require_icons_dev.normalizePath(location.pathname);
|
|
435
|
+
const activeTabId = routes.find((r) => require_icons_dev.normalizePath(r.path) === currentPath)?.tab?.toLowerCase();
|
|
436
|
+
const activeIndex = tabs.findIndex((tab) => tab.id.toLowerCase() === activeTabId);
|
|
437
|
+
const finalActiveIndex = activeIndex === -1 ? 0 : activeIndex;
|
|
438
|
+
(0, react.useEffect)(() => {
|
|
439
|
+
const activeTab = tabRefs.current[finalActiveIndex];
|
|
440
|
+
if (activeTab) setIndicatorStyle({
|
|
441
|
+
opacity: 1,
|
|
442
|
+
width: activeTab.offsetWidth,
|
|
443
|
+
transform: `translateX(${activeTab.offsetLeft}px)`
|
|
444
|
+
});
|
|
445
|
+
}, [
|
|
446
|
+
finalActiveIndex,
|
|
447
|
+
tabs.length,
|
|
448
|
+
location.pathname
|
|
449
|
+
]);
|
|
450
|
+
return {
|
|
451
|
+
tabs,
|
|
452
|
+
activeIndex: finalActiveIndex,
|
|
453
|
+
indicatorStyle,
|
|
454
|
+
tabRefs,
|
|
455
|
+
activeTabId
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
//#endregion
|
|
460
|
+
//#region src/client/components/ui-base/tabs.tsx
|
|
461
|
+
function Tabs({ tabs, routes }) {
|
|
462
|
+
const { currentLocale } = require_icons_dev.useRoutes();
|
|
463
|
+
const { indicatorStyle, tabRefs, activeIndex } = useTabs(tabs, routes);
|
|
464
|
+
(0, react.useEffect)(() => {
|
|
465
|
+
const activeTab = tabRefs.current[activeIndex];
|
|
466
|
+
if (activeTab) activeTab.scrollIntoView({
|
|
467
|
+
behavior: "smooth",
|
|
468
|
+
block: "nearest",
|
|
469
|
+
inline: "center"
|
|
470
|
+
});
|
|
471
|
+
}, [activeIndex]);
|
|
472
|
+
const renderTabIcon = (iconName) => {
|
|
473
|
+
if (!iconName) return null;
|
|
474
|
+
if (iconName.trim().startsWith("<svg")) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
475
|
+
className: "h-4 w-4",
|
|
476
|
+
dangerouslySetInnerHTML: { __html: iconName }
|
|
477
|
+
});
|
|
478
|
+
const icons = {
|
|
479
|
+
...require_icons_dev.icons_exports,
|
|
480
|
+
...virtual_boltdocs_icons.default
|
|
481
|
+
};
|
|
482
|
+
const TabIcon = icons[iconName] || icons[iconName + "Icon"];
|
|
483
|
+
if (TabIcon) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TabIcon, { size: 16 });
|
|
484
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
485
|
+
src: iconName,
|
|
486
|
+
alt: "",
|
|
487
|
+
className: "h-4 w-4 object-contain"
|
|
488
|
+
});
|
|
489
|
+
};
|
|
490
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
491
|
+
className: "mx-auto max-w-(--breakpoint-3xl) px-4 md:px-6 select-none",
|
|
492
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Tabs.List, {
|
|
493
|
+
className: "border-none py-0 scrollbar-hide relative flex flex-row items-center",
|
|
494
|
+
children: [tabs.map((tab, index) => {
|
|
495
|
+
const isActive = index === activeIndex;
|
|
496
|
+
const firstRoute = routes.find((r) => r.tab && r.tab.toLowerCase() === tab.id.toLowerCase());
|
|
497
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_icons_dev.Link, {
|
|
498
|
+
href: firstRoute ? firstRoute.path : "#",
|
|
499
|
+
ref: (el) => {
|
|
500
|
+
tabRefs.current[index] = el;
|
|
501
|
+
},
|
|
502
|
+
className: `relative flex items-center gap-2 px-4 py-3.5 text-sm font-semibold transition-colors duration-300 outline-none whitespace-nowrap ${isActive ? "text-primary-500" : "text-muted hover:text-body"}`,
|
|
503
|
+
children: [renderTabIcon(tab.icon), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: getTranslated(tab.text, currentLocale) })]
|
|
504
|
+
}, tab.id);
|
|
505
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Tabs.Indicator, {
|
|
506
|
+
style: indicatorStyle,
|
|
507
|
+
className: "h-0.5 bg-primary-500 rounded-full transition-all duration-300"
|
|
508
|
+
})]
|
|
509
|
+
})
|
|
510
|
+
});
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
//#endregion
|
|
514
|
+
//#region src/client/utils/get-base-file-path.ts
|
|
515
|
+
/**
|
|
516
|
+
* Get the base file path by removing version and locale prefixes.
|
|
517
|
+
* @param filePath - The full file path.
|
|
518
|
+
* @param version - The version to remove from the path.
|
|
519
|
+
* @param locale - The locale to remove from the path.
|
|
520
|
+
* @returns The base file path.
|
|
521
|
+
*/
|
|
522
|
+
function getBaseFilePath(filePath, version, locale) {
|
|
523
|
+
let path = filePath;
|
|
524
|
+
if (version && (path === version || path.startsWith(version + "/"))) path = path === version ? "index.md" : path.slice(version.length + 1);
|
|
525
|
+
if (locale && (path === locale || path.startsWith(locale + "/"))) path = path === locale ? "index.md" : path.slice(locale.length + 1);
|
|
526
|
+
return path;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
//#endregion
|
|
530
|
+
//#region src/client/hooks/use-version.ts
|
|
531
|
+
/**
|
|
532
|
+
* Hook to manage and switch between different versions of the documentation.
|
|
533
|
+
*/
|
|
534
|
+
function useVersion() {
|
|
535
|
+
const navigate = (0, react_router_dom.useNavigate)();
|
|
536
|
+
const config = require_icons_dev.useConfig();
|
|
537
|
+
const { allRoutes, currentRoute, currentVersion, currentLocale } = require_icons_dev.useRoutes();
|
|
538
|
+
const versions = config.versions;
|
|
539
|
+
const { setVersion } = require_icons_dev.useBoltdocsContext();
|
|
540
|
+
const handleVersionChange = (version) => {
|
|
541
|
+
if (!versions || version === currentVersion) return;
|
|
542
|
+
setVersion(version);
|
|
543
|
+
let targetPath = `${(config.base || "/docs").replace(/\/$/, "")}/${version}${currentLocale ? `/${currentLocale}` : ""}`;
|
|
544
|
+
if (currentRoute) {
|
|
545
|
+
const baseFile = getBaseFilePath(currentRoute.filePath, currentRoute.version, currentRoute.locale);
|
|
546
|
+
const targetRoute = allRoutes.find((r) => getBaseFilePath(r.filePath, r.version, r.locale) === baseFile && (r.version || versions.defaultVersion) === version && (!config.i18n || (r.locale || config.i18n.defaultLocale) === currentLocale));
|
|
547
|
+
if (targetRoute) targetPath = targetRoute.path;
|
|
548
|
+
else {
|
|
549
|
+
const versionIndexRoute = allRoutes.find((r) => getBaseFilePath(r.filePath, r.version, r.locale) === "index.md" && (r.version || versions.defaultVersion) === version && (!config.i18n || (r.locale || config.i18n.defaultLocale) === currentLocale));
|
|
550
|
+
if (versionIndexRoute) targetPath = versionIndexRoute.path;
|
|
551
|
+
}
|
|
552
|
+
} else {
|
|
553
|
+
const fallbackRoute = allRoutes.find((r) => (r.version || versions.defaultVersion) === version && (!config.i18n || (r.locale || config.i18n.defaultLocale) === currentLocale));
|
|
554
|
+
if (fallbackRoute) targetPath = fallbackRoute.path;
|
|
555
|
+
}
|
|
556
|
+
navigate(targetPath);
|
|
557
|
+
};
|
|
558
|
+
return {
|
|
559
|
+
currentVersion,
|
|
560
|
+
currentVersionLabel: (versions?.versions?.find?.((v) => v.path === currentVersion))?.label || currentVersion,
|
|
561
|
+
availableVersions: (0, react.useMemo)(() => {
|
|
562
|
+
return versions ? versions.versions.map((v) => ({
|
|
563
|
+
key: v.path,
|
|
564
|
+
label: v.label,
|
|
565
|
+
value: v.path,
|
|
566
|
+
isCurrent: v.path === currentVersion
|
|
567
|
+
})) : [];
|
|
568
|
+
}, [versions, currentVersion]),
|
|
569
|
+
handleVersionChange
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
//#endregion
|
|
574
|
+
//#region src/client/hooks/use-i18n.ts
|
|
575
|
+
/**
|
|
576
|
+
* Hook to manage and switch between different locales (languages) of the documentation.
|
|
577
|
+
*/
|
|
578
|
+
function useI18n() {
|
|
579
|
+
const navigate = (0, react_router_dom.useNavigate)();
|
|
580
|
+
const config = require_icons_dev.useConfig();
|
|
581
|
+
const { allRoutes, currentRoute, currentLocale, currentVersion } = require_icons_dev.useRoutes();
|
|
582
|
+
const i18n = config.i18n;
|
|
583
|
+
const { setLocale } = require_icons_dev.useBoltdocsContext();
|
|
584
|
+
const handleLocaleChange = (locale) => {
|
|
585
|
+
if (!i18n || locale === currentLocale) return;
|
|
586
|
+
setLocale(locale);
|
|
587
|
+
const base = config.base || "/";
|
|
588
|
+
const safeBase = base === "/" ? "" : base.replace(/\/$/, "");
|
|
589
|
+
const isDocRoute = !!currentRoute?.filePath;
|
|
590
|
+
let targetPath = "";
|
|
591
|
+
if (currentRoute) if (isDocRoute) {
|
|
592
|
+
const baseFile = getBaseFilePath(currentRoute.filePath, currentRoute.version, currentRoute.locale);
|
|
593
|
+
const targetRoute = allRoutes.find((r) => getBaseFilePath(r.filePath, r.version, r.locale) === baseFile && (r.locale || i18n.defaultLocale) === locale && r.version === currentRoute.version);
|
|
594
|
+
if (targetRoute) targetPath = targetRoute.path;
|
|
595
|
+
else {
|
|
596
|
+
const defaultIndexRoute = allRoutes.find((r) => getBaseFilePath(r.filePath, r.version, r.locale) === "index.md" && (r.locale || i18n.defaultLocale) === locale && r.version === currentRoute.version);
|
|
597
|
+
if (defaultIndexRoute) targetPath = defaultIndexRoute.path;
|
|
598
|
+
else targetPath = `${safeBase}${currentRoute.version ? `/${currentRoute.version}` : ""}${locale === i18n.defaultLocale ? "" : `/${locale}`}` || "/";
|
|
599
|
+
}
|
|
600
|
+
} else {
|
|
601
|
+
let rawExternal = currentRoute.path;
|
|
602
|
+
const parts = rawExternal.split("/").filter(Boolean);
|
|
603
|
+
if (parts.length > 0 && (Array.isArray(i18n.locales) ? i18n.locales.includes(parts[0]) : !!i18n.locales[parts[0]])) {
|
|
604
|
+
parts.shift();
|
|
605
|
+
rawExternal = "/" + parts.join("/");
|
|
606
|
+
}
|
|
607
|
+
if (locale === i18n.defaultLocale) targetPath = rawExternal === "" ? "/" : rawExternal;
|
|
608
|
+
else {
|
|
609
|
+
const cleanExt = rawExternal.startsWith("/") ? rawExternal : `/${rawExternal}`;
|
|
610
|
+
targetPath = `/${locale}${cleanExt === "/" ? "" : cleanExt}`;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
else {
|
|
614
|
+
const targetRoute = allRoutes.find((r) => (r.locale || i18n.defaultLocale) === locale && (r.version || config.versions?.defaultVersion) === (currentVersion || config.versions?.defaultVersion));
|
|
615
|
+
if (targetRoute) targetPath = targetRoute.path;
|
|
616
|
+
else {
|
|
617
|
+
const vPath = currentVersion && currentVersion !== config.versions?.defaultVersion ? `/${currentVersion}` : "";
|
|
618
|
+
targetPath = locale === i18n.defaultLocale ? `${safeBase}${vPath}` : `${safeBase}${vPath}/${locale}`;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
if (!targetPath || targetPath === "") targetPath = "/";
|
|
622
|
+
targetPath = targetPath.replace(/\/+/g, "/");
|
|
623
|
+
navigate(targetPath);
|
|
624
|
+
};
|
|
625
|
+
const locales = i18n?.locales;
|
|
626
|
+
const defaultLabel = locales ? Array.isArray(locales) ? currentLocale : locales[currentLocale] : void 0;
|
|
627
|
+
return {
|
|
628
|
+
currentLocale,
|
|
629
|
+
currentLocaleLabel: (i18n?.localeConfigs?.[currentLocale])?.label || defaultLabel || currentLocale,
|
|
630
|
+
availableLocales: (0, react.useMemo)(() => {
|
|
631
|
+
return i18n ? Array.isArray(i18n.locales) ? i18n.locales.map((key) => {
|
|
632
|
+
return {
|
|
633
|
+
key,
|
|
634
|
+
label: (i18n?.localeConfigs?.[key])?.label || key,
|
|
635
|
+
value: key,
|
|
636
|
+
isCurrent: key === currentLocale
|
|
637
|
+
};
|
|
638
|
+
}) : Object.entries(i18n.locales).map(([key, label]) => {
|
|
639
|
+
return {
|
|
640
|
+
key,
|
|
641
|
+
label: (i18n?.localeConfigs?.[key])?.label || label,
|
|
642
|
+
value: key,
|
|
643
|
+
isCurrent: key === currentLocale
|
|
644
|
+
};
|
|
645
|
+
}) : [];
|
|
646
|
+
}, [i18n, currentLocale]),
|
|
647
|
+
handleLocaleChange
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
//#endregion
|
|
652
|
+
//#region src/client/components/ui-base/version-i18n.tsx
|
|
653
|
+
function VersionSelector({ className }) {
|
|
654
|
+
const { currentVersionLabel, availableVersions, handleVersionChange } = useVersion();
|
|
655
|
+
if (availableVersions.length === 0) return null;
|
|
656
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Menu.Trigger, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Button, {
|
|
657
|
+
className: require_icons_dev.cn("flex h-9 items-center justify-between gap-2 border border-subtle bg-surface px-4 py-1.5 rounded-xl text-xs font-semibold text-body hover:bg-primary-50/20 hover:border-primary-500/50 transition-all duration-300 outline-none select-none cursor-pointer", className),
|
|
658
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
659
|
+
className: "font-semibold text-[0.8125rem]",
|
|
660
|
+
children: currentVersionLabel
|
|
661
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.ChevronDown, { className: "w-3.5 h-3.5 text-muted/60" })]
|
|
662
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Menu.Root, {
|
|
663
|
+
className: "w-40 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100",
|
|
664
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Menu.Section, {
|
|
665
|
+
items: availableVersions,
|
|
666
|
+
children: (version) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Menu.Item, {
|
|
667
|
+
onPress: () => handleVersionChange(version.value),
|
|
668
|
+
className: "flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body hover:bg-primary-50/50 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5",
|
|
669
|
+
children: version.label
|
|
670
|
+
}, `${version.value ?? ""}`)
|
|
671
|
+
})
|
|
672
|
+
})] });
|
|
673
|
+
}
|
|
674
|
+
function I18nSelector({ className }) {
|
|
675
|
+
const { currentLocale, availableLocales, handleLocaleChange } = useI18n();
|
|
676
|
+
if (availableLocales.length === 0) return null;
|
|
677
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Menu.Trigger, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Button, {
|
|
678
|
+
className: require_icons_dev.cn("flex h-9 items-center justify-between gap-2 border border-subtle bg-surface px-4 py-1.5 rounded-xl text-xs font-semibold text-body hover:bg-primary-50/20 hover:border-primary-500/50 transition-all duration-300 outline-none select-none cursor-pointer", className),
|
|
679
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
680
|
+
className: "flex items-center gap-1.5",
|
|
681
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Languages, { className: "w-3.5 h-3.5 text-primary-500" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
682
|
+
className: "font-bold text-[0.75rem] uppercase opacity-90",
|
|
683
|
+
children: currentLocale || "en"
|
|
684
|
+
})]
|
|
685
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.ChevronDown, { className: "w-3.5 h-3.5 text-muted/60" })]
|
|
686
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Menu.Root, {
|
|
687
|
+
className: "w-40 bg-main border border-subtle rounded-xl p-1.5 shadow-md outline-none flex flex-col gap-0.5 animate-fade-in z-100",
|
|
688
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Menu.Section, {
|
|
689
|
+
items: availableLocales,
|
|
690
|
+
children: (locale) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Menu.Item, {
|
|
691
|
+
onPress: () => handleLocaleChange(locale.value),
|
|
692
|
+
className: "flex items-center gap-2 px-3 py-2 rounded-lg text-xs font-medium text-body dark:hover:bg-primary-300/50 hover:bg-primary-200/50 transition-colors duration-100 cursor-pointer select-none outline-none group data-selected:text-primary-500 data-selected:bg-primary-500/5",
|
|
693
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: locale.label })
|
|
694
|
+
}, `${locale.value ?? ""}`)
|
|
695
|
+
})
|
|
696
|
+
})] });
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
//#endregion
|
|
700
|
+
//#region src/client/components/ui-base/navbar.tsx
|
|
701
|
+
const SearchDialog$1 = (0, react.lazy)(() => Promise.resolve().then(() => require("../search-dialog-CIQg6k8c.cjs")).then((m) => ({ default: m.SearchDialog })));
|
|
702
|
+
function Navbar() {
|
|
703
|
+
const { links, title, logo, logoProps, github, social, config } = useNavbar();
|
|
704
|
+
const { routes, allRoutes, currentRoute, currentVersion, currentLocale } = require_icons_dev.useRoutes();
|
|
705
|
+
const { pathname } = (0, react_router_dom.useLocation)();
|
|
706
|
+
const { isSidebarOpen, toggleSidebar } = require_docs_layout.useUI();
|
|
707
|
+
const [isMobileMenuOpen, setIsMobileMenuOpen] = (0, react.useState)(false);
|
|
708
|
+
const themeConfig = config.theme || {};
|
|
709
|
+
const isDocs = !!currentRoute?.filePath;
|
|
710
|
+
const hasTabs = themeConfig?.tabs && themeConfig.tabs.length > 0;
|
|
711
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_search_dialog.Navbar.Root, {
|
|
712
|
+
className: require_icons_dev.cn("border-b border-subtle bg-main/80 backdrop-blur-md", hasTabs && "border-b-0"),
|
|
713
|
+
children: [
|
|
714
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_search_dialog.Navbar.Content, { children: [
|
|
715
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_search_dialog.Navbar.Left, { children: [
|
|
716
|
+
isDocs && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Button, {
|
|
717
|
+
onPress: toggleSidebar,
|
|
718
|
+
className: "mr-2 lg:hidden p-1.5 h-8 w-8 flex items-center justify-center bg-transparent border-none outline-none select-none cursor-pointer rounded-xl hover:bg-primary-50/50 transition-colors",
|
|
719
|
+
"aria-label": isSidebarOpen ? "Close sidebar" : "Open sidebar",
|
|
720
|
+
children: isSidebarOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.X, { className: "w-5 h-5 text-body" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Menu, { className: "w-5 h-5 text-body" })
|
|
721
|
+
}),
|
|
722
|
+
logo && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.Logo, {
|
|
723
|
+
src: logo,
|
|
724
|
+
alt: logoProps?.alt || title,
|
|
725
|
+
width: logoProps?.width ?? 24,
|
|
726
|
+
height: logoProps?.height ?? 24,
|
|
727
|
+
href: "site:/"
|
|
728
|
+
}),
|
|
729
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.Title, {
|
|
730
|
+
href: "site:/",
|
|
731
|
+
children: title
|
|
732
|
+
}),
|
|
733
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
734
|
+
className: "hidden sm:block",
|
|
735
|
+
children: config.versions && currentVersion && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VersionSelector, {})
|
|
736
|
+
})
|
|
737
|
+
] }),
|
|
738
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.Center, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
|
|
739
|
+
fallback: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "h-9 w-32 animate-pulse rounded-md bg-surface" }),
|
|
740
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchDialog$1, { routes: routes || [] })
|
|
741
|
+
}) }),
|
|
742
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_search_dialog.Navbar.Right, { children: [
|
|
743
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react.Suspense, {
|
|
744
|
+
fallback: null,
|
|
745
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
746
|
+
className: "lg:hidden",
|
|
747
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SearchDialog$1, { routes: routes || [] })
|
|
748
|
+
})
|
|
749
|
+
}),
|
|
750
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.Links, { children: links.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavbarLinkItem, { link }, link.href)) }),
|
|
751
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
752
|
+
className: "hidden sm:flex items-center gap-2",
|
|
753
|
+
children: [config.i18n && currentLocale && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(I18nSelector, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.Split, { className: "bg-subtle" })]
|
|
754
|
+
}),
|
|
755
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
756
|
+
className: "hidden md:block",
|
|
757
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeToggle, {})
|
|
758
|
+
}),
|
|
759
|
+
github && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
760
|
+
className: "hidden md:block",
|
|
761
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(GithubStars, { repo: themeConfig?.githubRepo ?? "" })
|
|
762
|
+
}),
|
|
763
|
+
social.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
764
|
+
className: "hidden md:block",
|
|
765
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.Split, { className: "bg-subtle" })
|
|
766
|
+
}),
|
|
767
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
768
|
+
className: "hidden md:flex items-center gap-1",
|
|
769
|
+
children: social.map(({ icon, link }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.Socials, {
|
|
770
|
+
icon,
|
|
771
|
+
link,
|
|
772
|
+
className: "p-1.5 text-muted hover:text-body hover:bg-surface rounded-md transition-all focus-visible:ring-2 focus-visible:ring-primary-500/30"
|
|
773
|
+
}, link))
|
|
774
|
+
}),
|
|
775
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.More, {
|
|
776
|
+
onPress: () => setIsMobileMenuOpen(true),
|
|
777
|
+
className: "text-muted hover:text-body active:scale-90 transition-all focus-visible:ring-2 focus-visible:ring-primary-500/30"
|
|
778
|
+
})
|
|
779
|
+
] })
|
|
780
|
+
] }),
|
|
781
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_search_dialog.Navbar.MobileMenu, {
|
|
782
|
+
isOpen: isMobileMenuOpen,
|
|
783
|
+
onClose: () => setIsMobileMenuOpen(false),
|
|
784
|
+
className: "bg-main/98 backdrop-blur-2xl",
|
|
785
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
786
|
+
className: "flex flex-col gap-1",
|
|
787
|
+
children: links.map((link) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavbarMobileLinkItem, {
|
|
788
|
+
link,
|
|
789
|
+
onClose: () => setIsMobileMenuOpen(false)
|
|
790
|
+
}, link.href))
|
|
791
|
+
}), social.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
792
|
+
className: "mt-6",
|
|
793
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
794
|
+
className: "px-4 mb-4 text-xs font-bold uppercase tracking-widest text-muted/50",
|
|
795
|
+
children: "Connect"
|
|
796
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
797
|
+
className: "flex flex-wrap gap-2 px-2",
|
|
798
|
+
children: social.map(({ icon, link }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.Socials, {
|
|
799
|
+
icon,
|
|
800
|
+
link,
|
|
801
|
+
className: "p-3 bg-surface border border-subtle rounded-xl flex-1 justify-center"
|
|
802
|
+
}, link))
|
|
803
|
+
})]
|
|
804
|
+
})]
|
|
805
|
+
}),
|
|
806
|
+
isDocs && hasTabs && themeConfig?.tabs && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
807
|
+
className: "w-full border-b border-subtle bg-main",
|
|
808
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tabs, {
|
|
809
|
+
tabs: themeConfig.tabs,
|
|
810
|
+
routes: allRoutes || routes || []
|
|
811
|
+
})
|
|
812
|
+
})
|
|
813
|
+
]
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
function NavbarLinkItem({ link }) {
|
|
817
|
+
const localizedHref = require_icons_dev.useLocalizedTo(link.href || "");
|
|
818
|
+
const { pathname } = (0, react_router_dom.useLocation)();
|
|
819
|
+
const active = pathname === localizedHref || pathname.startsWith(localizedHref + "/");
|
|
820
|
+
if (link.items && link.items.length > 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.Dropdown, {
|
|
821
|
+
label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
822
|
+
className: require_icons_dev.cn("transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm px-2 py-1", active ? "text-primary-500" : "text-muted hover:text-body"),
|
|
823
|
+
children: link.label
|
|
824
|
+
}),
|
|
825
|
+
children: link.items?.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.DropdownItem, {
|
|
826
|
+
href: require_icons_dev.useLocalizedTo(item.href || ""),
|
|
827
|
+
label: item.label
|
|
828
|
+
}, item.href))
|
|
829
|
+
});
|
|
830
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.Link, {
|
|
831
|
+
...link,
|
|
832
|
+
href: localizedHref,
|
|
833
|
+
active,
|
|
834
|
+
className: require_icons_dev.cn("transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm", active ? "text-primary-500" : "text-muted hover:text-body")
|
|
835
|
+
});
|
|
836
|
+
}
|
|
837
|
+
function NavbarMobileLinkItem({ link, onClose }) {
|
|
838
|
+
const localizedHref = require_icons_dev.useLocalizedTo(link.href || "");
|
|
839
|
+
const { pathname } = (0, react_router_dom.useLocation)();
|
|
840
|
+
const active = pathname === localizedHref;
|
|
841
|
+
if (link.items && link.items.length > 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
842
|
+
className: "flex flex-col gap-1",
|
|
843
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
844
|
+
className: require_icons_dev.cn("px-3 py-2 text-sm transition-all", active ? "text-body" : "text-muted/80 hover:text-body"),
|
|
845
|
+
children: link.label
|
|
846
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
847
|
+
className: "flex flex-col gap-1 pl-4",
|
|
848
|
+
children: link.items?.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NavbarMobileLinkItem, {
|
|
849
|
+
link: item,
|
|
850
|
+
onClose
|
|
851
|
+
}, item.href))
|
|
852
|
+
})]
|
|
853
|
+
});
|
|
854
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_search_dialog.Navbar.MobileLink, {
|
|
855
|
+
...link,
|
|
856
|
+
href: localizedHref,
|
|
857
|
+
active,
|
|
858
|
+
onPress: onClose,
|
|
859
|
+
className: require_icons_dev.cn("transition-all", active ? "text-body" : "text-muted/80 hover:text-body")
|
|
860
|
+
});
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
//#endregion
|
|
864
|
+
//#region src/client/components/ui-base/not-found.tsx
|
|
865
|
+
function NotFound() {
|
|
866
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
867
|
+
className: "flex items-center justify-center min-h-[65vh] text-center px-4",
|
|
868
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
869
|
+
className: "space-y-6 max-w-md mx-auto p-8 border border-subtle bg-surface rounded-2xl shadow-xs",
|
|
870
|
+
children: [
|
|
871
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
872
|
+
className: "block text-7xl font-extrabold tracking-tight text-primary-500",
|
|
873
|
+
children: "404"
|
|
874
|
+
}),
|
|
875
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
876
|
+
className: "space-y-2",
|
|
877
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
878
|
+
className: "text-xl font-bold text-body",
|
|
879
|
+
children: "Page Not Found"
|
|
880
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
881
|
+
className: "text-sm text-muted leading-relaxed",
|
|
882
|
+
children: "The page you're looking for doesn't exist or has been moved."
|
|
883
|
+
})]
|
|
884
|
+
}),
|
|
885
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_icons_dev.Link, {
|
|
886
|
+
href: "/",
|
|
887
|
+
className: "inline-flex items-center gap-2 rounded-xl border border-subtle bg-main px-6 py-2.5 text-xs font-semibold text-body hover:bg-primary-50/50 hover:border-primary-500/50 transition-all duration-300 outline-none select-none",
|
|
888
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.ArrowLeft, { size: 14 }), " Go to Home"]
|
|
889
|
+
})
|
|
890
|
+
]
|
|
891
|
+
})
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
//#endregion
|
|
896
|
+
//#region src/client/components/ui-base/on-this-page.tsx
|
|
897
|
+
function OnThisPage({ headings = [], editLink, communityHelp, filePath }) {
|
|
898
|
+
if (headings.length === 0) return null;
|
|
899
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.OnThisPage.Root, { children: [
|
|
900
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.OnThisPage.Header, {
|
|
901
|
+
className: "flex flex-row gap-x-2",
|
|
902
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.TextAlignStart, { size: 16 }), "On this page"]
|
|
903
|
+
}),
|
|
904
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.OnThisPage.Tree, { headings }),
|
|
905
|
+
(editLink || communityHelp) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
906
|
+
className: "mt-8 pt-8 border-t border-subtle space-y-4",
|
|
907
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
908
|
+
className: "text-xs font-bold text-body",
|
|
909
|
+
children: "Need help?"
|
|
910
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("ul", {
|
|
911
|
+
className: "space-y-3",
|
|
912
|
+
children: [editLink && filePath && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
913
|
+
href: editLink.replace(":path", filePath),
|
|
914
|
+
target: "_blank",
|
|
915
|
+
rel: "noopener noreferrer",
|
|
916
|
+
className: "flex items-center gap-2 text-sm text-muted hover:text-body transition-colors",
|
|
917
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.Pencil, { size: 16 }), "Edit this page"]
|
|
918
|
+
}) }), communityHelp && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", {
|
|
919
|
+
href: communityHelp,
|
|
920
|
+
target: "_blank",
|
|
921
|
+
rel: "noopener noreferrer",
|
|
922
|
+
className: "flex items-center gap-2 text-sm text-muted hover:text-body transition-colors",
|
|
923
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.CircleHelp, { size: 16 }), "Community help"]
|
|
924
|
+
}) })]
|
|
925
|
+
})]
|
|
926
|
+
})
|
|
927
|
+
] });
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
//#endregion
|
|
931
|
+
//#region src/client/hooks/use-page-nav.ts
|
|
932
|
+
/**
|
|
933
|
+
* Hook to manage the previous and next button functionality for documentation pages.
|
|
934
|
+
* Intelligent: respects current locale, version, and tab to keep navigation logical.
|
|
935
|
+
*/
|
|
936
|
+
function usePageNav() {
|
|
937
|
+
const { routes, currentRoute } = require_icons_dev.useRoutes();
|
|
938
|
+
const location = (0, react_router_dom.useLocation)();
|
|
939
|
+
return (0, react.useMemo)(() => {
|
|
940
|
+
if (!currentRoute) return {
|
|
941
|
+
prevPage: null,
|
|
942
|
+
nextPage: null,
|
|
943
|
+
currentRoute: null
|
|
944
|
+
};
|
|
945
|
+
const activeTabId = currentRoute.tab?.toLowerCase();
|
|
946
|
+
const contextRoutes = activeTabId ? routes.filter((r) => r.tab?.toLowerCase() === activeTabId) : routes.filter((r) => !r.tab);
|
|
947
|
+
const currentIndex = contextRoutes.findIndex((r) => r.path === location.pathname);
|
|
948
|
+
return {
|
|
949
|
+
prevPage: currentIndex > 0 ? contextRoutes[currentIndex - 1] : null,
|
|
950
|
+
nextPage: currentIndex !== -1 && currentIndex < contextRoutes.length - 1 ? contextRoutes[currentIndex + 1] : null,
|
|
951
|
+
currentRoute
|
|
952
|
+
};
|
|
953
|
+
}, [
|
|
954
|
+
routes,
|
|
955
|
+
currentRoute,
|
|
956
|
+
location.pathname
|
|
957
|
+
]);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
//#endregion
|
|
961
|
+
//#region src/client/components/ui-base/page-nav.tsx
|
|
962
|
+
/**
|
|
963
|
+
* Component to display the previous and next page navigation buttons.
|
|
964
|
+
* Enhanced with subtle entrance animations, modern card layout, and hover highlights.
|
|
965
|
+
*/
|
|
966
|
+
function PageNav() {
|
|
967
|
+
const { prevPage, nextPage } = usePageNav();
|
|
968
|
+
if (!prevPage && !nextPage) return null;
|
|
969
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.PageNav.Root, {
|
|
970
|
+
className: "pt-8 border-t border-subtle grid sm:grid-cols-2 gap-4 animate-in fade-in slide-in-from-bottom-4 duration-700 select-none",
|
|
971
|
+
children: [prevPage ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.PageNav.Link, {
|
|
972
|
+
to: prevPage.path,
|
|
973
|
+
direction: "prev",
|
|
974
|
+
className: "group border border-subtle bg-surface p-5 rounded-2xl transition-all duration-300 hover:border-primary-500/50 hover:bg-primary-50/20",
|
|
975
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.PageNav.Title, {
|
|
976
|
+
className: "text-xs font-bold uppercase tracking-wider text-muted/60 mb-1",
|
|
977
|
+
children: "Previous"
|
|
978
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.PageNav.Description, {
|
|
979
|
+
className: "text-sm sm:text-base font-bold text-body group-hover:text-primary-500 transition-colors",
|
|
980
|
+
children: prevPage.title
|
|
981
|
+
})]
|
|
982
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {}), nextPage ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.PageNav.Link, {
|
|
983
|
+
to: nextPage.path,
|
|
984
|
+
direction: "next",
|
|
985
|
+
className: "group border border-subtle bg-surface p-5 rounded-2xl transition-all duration-300 hover:border-primary-500/50 hover:bg-primary-50/20",
|
|
986
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.PageNav.Title, {
|
|
987
|
+
className: "text-xs font-bold uppercase tracking-wider text-muted/60 mb-1",
|
|
988
|
+
children: "Next"
|
|
989
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.PageNav.Description, {
|
|
990
|
+
className: "text-sm sm:text-base font-bold text-body group-hover:text-primary-500 transition-colors",
|
|
991
|
+
children: nextPage.title
|
|
992
|
+
})]
|
|
993
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {})]
|
|
994
|
+
});
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
//#endregion
|
|
998
|
+
//#region src/client/components/ui-base/sidebar.tsx
|
|
999
|
+
function SidebarMain({ routes, config }) {
|
|
1000
|
+
const { logo, title, logoProps } = useNavbar();
|
|
1001
|
+
const { closeSidebar } = require_docs_layout.useUI();
|
|
1002
|
+
const SidebarLogo = logo ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
1003
|
+
src: logo,
|
|
1004
|
+
alt: logoProps?.alt || title,
|
|
1005
|
+
width: 24,
|
|
1006
|
+
height: 24,
|
|
1007
|
+
className: "rounded-xl"
|
|
1008
|
+
}) : null;
|
|
1009
|
+
const hasUtilities = config.versions || config.i18n;
|
|
1010
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Sidebar.Root, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Sidebar.Content, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Sidebar.Items, { routes }) }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Sidebar.Mobile, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Sidebar.Header, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1011
|
+
className: "flex items-center gap-3",
|
|
1012
|
+
children: [SidebarLogo, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1013
|
+
className: "font-bold text-lg tracking-tight text-body truncate max-w-[120px]",
|
|
1014
|
+
children: title
|
|
1015
|
+
})]
|
|
1016
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1017
|
+
className: "flex items-center gap-2",
|
|
1018
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThemeSwitcher, { className: "w-24 h-9 rounded-xl" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Button, {
|
|
1019
|
+
onPress: closeSidebar,
|
|
1020
|
+
className: "h-9 w-9 flex items-center justify-center bg-transparent border-none outline-none select-none cursor-pointer rounded-xl hover:bg-primary-50/50 text-muted hover:text-body transition-colors",
|
|
1021
|
+
"aria-label": "Close sidebar",
|
|
1022
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.X, { size: 20 })
|
|
1023
|
+
})]
|
|
1024
|
+
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.Sidebar.Content, { children: [hasUtilities && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1025
|
+
className: "flex flex-col gap-4 mb-10",
|
|
1026
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1027
|
+
className: "flex gap-3",
|
|
1028
|
+
children: [config.versions && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VersionSelector, { className: "flex-1 justify-between h-10 bg-surface border-subtle rounded-xl" }), config.i18n && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(I18nSelector, { className: "flex-1 justify-between h-10 bg-surface border-subtle rounded-xl" })]
|
|
1029
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "mt-2 border-b border-subtle" })]
|
|
1030
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.Sidebar.Items, { routes })] })] })] });
|
|
1031
|
+
}
|
|
1032
|
+
const Sidebar = Object.assign(SidebarMain, {
|
|
1033
|
+
Root: require_docs_layout.Sidebar.Root,
|
|
1034
|
+
Mobile: require_docs_layout.Sidebar.Mobile,
|
|
1035
|
+
Header: require_docs_layout.Sidebar.Header,
|
|
1036
|
+
Content: require_docs_layout.Sidebar.Content,
|
|
1037
|
+
Group: require_docs_layout.Sidebar.Group,
|
|
1038
|
+
Link: require_docs_layout.Sidebar.Link,
|
|
1039
|
+
SubGroup: require_docs_layout.Sidebar.SubGroup,
|
|
1040
|
+
Item: require_docs_layout.Sidebar.Item,
|
|
1041
|
+
Items: require_docs_layout.Sidebar.Items
|
|
1042
|
+
});
|
|
1043
|
+
|
|
1044
|
+
//#endregion
|
|
1045
|
+
//#region src/client/components/ui-base/last-updated.tsx
|
|
1046
|
+
/**
|
|
1047
|
+
* A subtle display for when the page was last updated.
|
|
1048
|
+
* Small, opaque, and positioned at the bottom of the content with a thin top border divider.
|
|
1049
|
+
*/
|
|
1050
|
+
function LastUpdated({ date }) {
|
|
1051
|
+
if (!date) return null;
|
|
1052
|
+
const d = new Date(date);
|
|
1053
|
+
if (isNaN(d.getTime())) return null;
|
|
1054
|
+
const formattedDate = d.toLocaleDateString(void 0, {
|
|
1055
|
+
year: "numeric",
|
|
1056
|
+
month: "long",
|
|
1057
|
+
day: "numeric"
|
|
1058
|
+
});
|
|
1059
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1060
|
+
className: "mt-16 pt-6 border-t border-subtle flex items-center justify-between text-xs text-muted select-none",
|
|
1061
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1062
|
+
className: "italic",
|
|
1063
|
+
children: ["Last updated on ", formattedDate]
|
|
1064
|
+
})]
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
//#endregion
|
|
1069
|
+
//#region src/client/app/doc-page.tsx
|
|
1070
|
+
/**
|
|
1071
|
+
* DocPage renders the MDX content and page-specific metadata.
|
|
1072
|
+
* It is rendered inside the Outlet of DocsLayout.
|
|
1073
|
+
*/
|
|
1074
|
+
function DocPage({ route, content: Content, mdxComponents: propComponents }) {
|
|
1075
|
+
const contextComponents = useMdxComponents();
|
|
1076
|
+
const allComponents = (0, react.useMemo)(() => ({
|
|
1077
|
+
LastUpdated,
|
|
1078
|
+
...contextComponents,
|
|
1079
|
+
...propComponents
|
|
1080
|
+
}), [contextComponents, propComponents]);
|
|
1081
|
+
const LastUpdated$1 = allComponents.LastUpdated || LastUpdated;
|
|
1082
|
+
if (!Content) return null;
|
|
1083
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Content, { components: allComponents }), route?.lastUpdated && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LastUpdated$1, { date: route.lastUpdated })] });
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
//#endregion
|
|
1087
|
+
//#region src/client/ssg/mdx-page.tsx
|
|
1088
|
+
/**
|
|
1089
|
+
* Renders an MDX page by consuming pre-loaded module data.
|
|
1090
|
+
* Uses DocPage to ensure consistent layout and metadata application.
|
|
1091
|
+
*/
|
|
1092
|
+
function MdxPage({ MDXComponent: propMDX, mdxComponents: propComponents }) {
|
|
1093
|
+
const data = (0, react_router_dom.useLoaderData)();
|
|
1094
|
+
const MDXComponent = propMDX || data?.MDXComponent;
|
|
1095
|
+
const components = propComponents || data?.mdxComponents;
|
|
1096
|
+
if (!MDXComponent) return null;
|
|
1097
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DocPage, {
|
|
1098
|
+
route: {
|
|
1099
|
+
path: data.path,
|
|
1100
|
+
filePath: data.filePath,
|
|
1101
|
+
title: data.frontmatter.title,
|
|
1102
|
+
description: data.frontmatter.description,
|
|
1103
|
+
headings: data.headings,
|
|
1104
|
+
locale: data.locale,
|
|
1105
|
+
version: data.version,
|
|
1106
|
+
group: data.group,
|
|
1107
|
+
groupTitle: data.groupTitle,
|
|
1108
|
+
lastUpdated: data.lastUpdated,
|
|
1109
|
+
frontmatter: data.frontmatter
|
|
1110
|
+
},
|
|
1111
|
+
content: MDXComponent,
|
|
1112
|
+
mdxComponents: components
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
//#endregion
|
|
1117
|
+
//#region src/client/app/helmet-compat.tsx
|
|
1118
|
+
const mod = react_helmet_async;
|
|
1119
|
+
/**
|
|
1120
|
+
* The `<Helmet>` component, resolved across CJS/ESM module shapes.
|
|
1121
|
+
* Falls back to a transparent fragment wrapper if the module cannot be resolved.
|
|
1122
|
+
*/
|
|
1123
|
+
const Helmet = mod.Helmet || mod.default?.Helmet || (({ children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children }));
|
|
1124
|
+
/**
|
|
1125
|
+
* The `<HelmetProvider>` component, resolved across CJS/ESM module shapes.
|
|
1126
|
+
* Falls back to a transparent fragment wrapper if the module cannot be resolved.
|
|
1127
|
+
*/
|
|
1128
|
+
const HelmetProvider = mod.HelmetProvider || mod.default?.HelmetProvider || (({ children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children }));
|
|
1129
|
+
|
|
1130
|
+
//#endregion
|
|
1131
|
+
//#region src/client/app/scroll-handler.tsx
|
|
1132
|
+
/**
|
|
1133
|
+
* Handles scroll restoration and hash scrolling on navigation.
|
|
1134
|
+
* It ensures the page scrolls to top on pathname changes,
|
|
1135
|
+
* or specifically to an anchor element if a hash is present.
|
|
1136
|
+
*/
|
|
1137
|
+
function ScrollHandler() {
|
|
1138
|
+
const { pathname, hash } = (0, react_router_dom.useLocation)();
|
|
1139
|
+
const handleScroll = (behavior = "auto") => {
|
|
1140
|
+
const container = document.querySelector(".boltdocs-content") || window;
|
|
1141
|
+
const getScrollTop = () => {
|
|
1142
|
+
if (container === window) return window.scrollY;
|
|
1143
|
+
return container.scrollTop;
|
|
1144
|
+
};
|
|
1145
|
+
const scrollTo = (top, scrollBehavior) => {
|
|
1146
|
+
if (container === window) window.scrollTo({
|
|
1147
|
+
top,
|
|
1148
|
+
behavior: scrollBehavior
|
|
1149
|
+
});
|
|
1150
|
+
else container.scrollTo({
|
|
1151
|
+
top,
|
|
1152
|
+
behavior: scrollBehavior
|
|
1153
|
+
});
|
|
1154
|
+
};
|
|
1155
|
+
if (hash) {
|
|
1156
|
+
const id = hash.replace("#", "");
|
|
1157
|
+
const element = document.getElementById(id);
|
|
1158
|
+
if (element) {
|
|
1159
|
+
const offset = 80;
|
|
1160
|
+
const containerTop = container === window ? 0 : container.getBoundingClientRect().top;
|
|
1161
|
+
scrollTo(element.getBoundingClientRect().top - containerTop - offset + getScrollTop(), behavior);
|
|
1162
|
+
return true;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
scrollTo(0, behavior);
|
|
1166
|
+
return false;
|
|
1167
|
+
};
|
|
1168
|
+
(0, react.useLayoutEffect)(() => {
|
|
1169
|
+
handleScroll("auto");
|
|
1170
|
+
}, [pathname, hash]);
|
|
1171
|
+
(0, react.useEffect)(() => {
|
|
1172
|
+
handleScroll("auto");
|
|
1173
|
+
const rafId = requestAnimationFrame(() => {
|
|
1174
|
+
handleScroll("auto");
|
|
1175
|
+
window.dispatchEvent(new Event("resize"));
|
|
1176
|
+
});
|
|
1177
|
+
return () => cancelAnimationFrame(rafId);
|
|
1178
|
+
}, [pathname, hash]);
|
|
1179
|
+
return null;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
//#endregion
|
|
1183
|
+
//#region src/client/app/mdx-component.tsx
|
|
1184
|
+
const mdxComponentsDefault = {
|
|
1185
|
+
...require_mdx.mdx_components_default,
|
|
1186
|
+
NotFound,
|
|
1187
|
+
"404": NotFound
|
|
1188
|
+
};
|
|
1189
|
+
|
|
1190
|
+
//#endregion
|
|
1191
|
+
//#region src/client/ssg/boltdocs-shell.tsx
|
|
1192
|
+
/** Normalize a path: strip trailing slash unless it is exactly '/'. */
|
|
1193
|
+
function normalizePath(p) {
|
|
1194
|
+
return p.endsWith("/") && p.length > 1 ? p.slice(0, -1) : p;
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* Updates the HTML lang and dir attributes based on the current locale configuration.
|
|
1198
|
+
*/
|
|
1199
|
+
function I18nUpdater({ config }) {
|
|
1200
|
+
const { currentLocale } = require_icons_dev.useBoltdocsContext();
|
|
1201
|
+
(0, react.useEffect)(() => {
|
|
1202
|
+
if (!config.i18n || typeof document === "undefined") return;
|
|
1203
|
+
const locale = currentLocale || config.i18n.defaultLocale;
|
|
1204
|
+
const localeConfig = config.i18n.localeConfigs?.[locale];
|
|
1205
|
+
document.documentElement.lang = localeConfig?.htmlLang || locale || "en";
|
|
1206
|
+
document.documentElement.dir = localeConfig?.direction || "ltr";
|
|
1207
|
+
}, [currentLocale, config.i18n]);
|
|
1208
|
+
return null;
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Synchronizes the Zustand store with the current URL pathname.
|
|
1212
|
+
* Receives a pre-built Map for O(1) route lookups instead of O(n) .find().
|
|
1213
|
+
*/
|
|
1214
|
+
function StoreSync({ config, routeMap }) {
|
|
1215
|
+
const location = (0, react_router_dom.useLocation)();
|
|
1216
|
+
const { setLocale, setVersion } = require_icons_dev.useBoltdocsContext();
|
|
1217
|
+
(0, react.useEffect)(() => {
|
|
1218
|
+
const currentPath = normalizePath(location.pathname);
|
|
1219
|
+
const matchedRoute = routeMap.get(currentPath);
|
|
1220
|
+
if (matchedRoute) {
|
|
1221
|
+
if (config.i18n) setLocale(matchedRoute.locale || config.i18n.defaultLocale);
|
|
1222
|
+
if (config.versions) setVersion(matchedRoute.version || config.versions.defaultVersion);
|
|
1223
|
+
}
|
|
1224
|
+
}, [
|
|
1225
|
+
location.pathname,
|
|
1226
|
+
config,
|
|
1227
|
+
routeMap,
|
|
1228
|
+
setLocale,
|
|
1229
|
+
setVersion
|
|
1230
|
+
]);
|
|
1231
|
+
return null;
|
|
1232
|
+
}
|
|
1233
|
+
function BoltdocsShell({ config, routes, components = {} }) {
|
|
1234
|
+
const allComponents = (0, react.useMemo)(() => ({
|
|
1235
|
+
...mdxComponentsDefault,
|
|
1236
|
+
...virtual_boltdocs_mdx_components.default,
|
|
1237
|
+
...components
|
|
1238
|
+
}), [components]);
|
|
1239
|
+
const { pathname } = (0, react_router_dom.useLocation)();
|
|
1240
|
+
const currentPath = (0, react.useMemo)(() => normalizePath(pathname || "/"), [pathname]);
|
|
1241
|
+
const routeMap = (0, react.useMemo)(() => {
|
|
1242
|
+
const map = /* @__PURE__ */ new Map();
|
|
1243
|
+
for (const r of routes) {
|
|
1244
|
+
const key = normalizePath(r.path === "" ? "/" : r.path);
|
|
1245
|
+
map.set(key, r);
|
|
1246
|
+
}
|
|
1247
|
+
return map;
|
|
1248
|
+
}, [routes]);
|
|
1249
|
+
const initialData = (0, react.useMemo)(() => {
|
|
1250
|
+
const matched = routeMap.get(currentPath);
|
|
1251
|
+
let initLocale = void 0;
|
|
1252
|
+
let initVersion = void 0;
|
|
1253
|
+
if (matched) {
|
|
1254
|
+
if (config.i18n) initLocale = matched.locale || config.i18n.defaultLocale;
|
|
1255
|
+
if (config.versions) initVersion = matched.version || config.versions.defaultVersion;
|
|
1256
|
+
}
|
|
1257
|
+
return {
|
|
1258
|
+
initLocale,
|
|
1259
|
+
initVersion
|
|
1260
|
+
};
|
|
1261
|
+
}, [
|
|
1262
|
+
currentPath,
|
|
1263
|
+
config,
|
|
1264
|
+
routeMap
|
|
1265
|
+
]);
|
|
1266
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HelmetProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons_dev.RoutesProvider, {
|
|
1267
|
+
routes,
|
|
1268
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_image.ThemeProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.UIProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MdxComponentsProvider, {
|
|
1269
|
+
components: allComponents,
|
|
1270
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_icons_dev.ConfigContext.Provider, {
|
|
1271
|
+
value: config,
|
|
1272
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ScrollHandler, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_icons_dev.BoltdocsProvider, {
|
|
1273
|
+
initialLocale: initialData.initLocale,
|
|
1274
|
+
initialVersion: initialData.initVersion,
|
|
1275
|
+
children: [
|
|
1276
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StoreSync, {
|
|
1277
|
+
config,
|
|
1278
|
+
routeMap
|
|
1279
|
+
}),
|
|
1280
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(I18nUpdater, { config }),
|
|
1281
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Outlet, {})
|
|
1282
|
+
]
|
|
1283
|
+
})]
|
|
1284
|
+
})
|
|
1285
|
+
}) }) })
|
|
1286
|
+
}) });
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
//#endregion
|
|
1290
|
+
//#region src/client/app/head.tsx
|
|
1291
|
+
function Head({ siteTitle, siteDescription, routes }) {
|
|
1292
|
+
const location = (0, react_router_dom.useLocation)();
|
|
1293
|
+
const config = require_icons_dev.useConfig();
|
|
1294
|
+
const { currentLocale } = require_icons_dev.useRoutes();
|
|
1295
|
+
const currentRoute = (0, react.useMemo)(() => routes?.find?.((r) => r.path === location.pathname), [routes, location.pathname]);
|
|
1296
|
+
const pageTitle = currentRoute?.title;
|
|
1297
|
+
const translatedSiteDescription = getTranslated(siteDescription, currentLocale);
|
|
1298
|
+
const pageDescription = currentRoute?.description || translatedSiteDescription || "";
|
|
1299
|
+
const translatedSiteTitle = getTranslated(siteTitle, currentLocale);
|
|
1300
|
+
const finalTitle = pageTitle ? `${pageTitle} | ${translatedSiteTitle}` : translatedSiteTitle;
|
|
1301
|
+
const seo = currentRoute?.seo || {};
|
|
1302
|
+
const globalMetatags = config?.seo?.metatags || {};
|
|
1303
|
+
const defaultOgImage = config?.seo?.thumbnails?.background;
|
|
1304
|
+
const ogImage = seo["og:image"] || defaultOgImage;
|
|
1305
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Helmet, { children: [
|
|
1306
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("title", { children: finalTitle }),
|
|
1307
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1308
|
+
name: "description",
|
|
1309
|
+
content: pageDescription
|
|
1310
|
+
}),
|
|
1311
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1312
|
+
property: "og:title",
|
|
1313
|
+
content: finalTitle
|
|
1314
|
+
}),
|
|
1315
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1316
|
+
property: "og:description",
|
|
1317
|
+
content: pageDescription
|
|
1318
|
+
}),
|
|
1319
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1320
|
+
property: "og:type",
|
|
1321
|
+
content: "article"
|
|
1322
|
+
}),
|
|
1323
|
+
typeof window !== "undefined" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1324
|
+
property: "og:url",
|
|
1325
|
+
content: window.location.href
|
|
1326
|
+
}),
|
|
1327
|
+
typeof window !== "undefined" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("link", {
|
|
1328
|
+
rel: "canonical",
|
|
1329
|
+
href: window.location.origin + location.pathname
|
|
1330
|
+
}),
|
|
1331
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1332
|
+
name: "twitter:card",
|
|
1333
|
+
content: "summary"
|
|
1334
|
+
}),
|
|
1335
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1336
|
+
name: "twitter:title",
|
|
1337
|
+
content: finalTitle
|
|
1338
|
+
}),
|
|
1339
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1340
|
+
name: "twitter:description",
|
|
1341
|
+
content: pageDescription
|
|
1342
|
+
}),
|
|
1343
|
+
ogImage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1344
|
+
name: "twitter:image",
|
|
1345
|
+
content: ogImage
|
|
1346
|
+
}),
|
|
1347
|
+
ogImage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1348
|
+
property: "og:image",
|
|
1349
|
+
content: ogImage
|
|
1350
|
+
}),
|
|
1351
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1352
|
+
name: "generator",
|
|
1353
|
+
content: "Boltdocs"
|
|
1354
|
+
}),
|
|
1355
|
+
Object.entries(globalMetatags).map(([key, value]) => {
|
|
1356
|
+
return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1357
|
+
property: key,
|
|
1358
|
+
content: value
|
|
1359
|
+
}, key) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1360
|
+
name: key,
|
|
1361
|
+
content: value
|
|
1362
|
+
}, key);
|
|
1363
|
+
}),
|
|
1364
|
+
Object.entries(seo).map(([key, value]) => {
|
|
1365
|
+
if (key === "noindex" && value === true) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1366
|
+
name: "robots",
|
|
1367
|
+
content: "noindex"
|
|
1368
|
+
}, "noindex");
|
|
1369
|
+
if (key === "robots") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1370
|
+
name: "robots",
|
|
1371
|
+
content: value
|
|
1372
|
+
}, "robots");
|
|
1373
|
+
if (key === "canonical") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("link", {
|
|
1374
|
+
rel: "canonical",
|
|
1375
|
+
href: value
|
|
1376
|
+
}, "canonical");
|
|
1377
|
+
return key.startsWith("og:") || key.startsWith("music:") || key.startsWith("video:") || key.startsWith("article:") || key.startsWith("book:") || key.startsWith("profile:") ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1378
|
+
property: key,
|
|
1379
|
+
content: value
|
|
1380
|
+
}, key) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("meta", {
|
|
1381
|
+
name: key,
|
|
1382
|
+
content: value
|
|
1383
|
+
}, key);
|
|
1384
|
+
})
|
|
1385
|
+
] });
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
//#endregion
|
|
1389
|
+
//#region src/client/app/docs-layout.tsx
|
|
1390
|
+
/**
|
|
1391
|
+
* Wraps the docs Outlet with the user's (or default) layout component.
|
|
1392
|
+
* The Layout receives the routed page as `children`.
|
|
1393
|
+
* We use useRoutes to pass the current route context to the persistent layout.
|
|
1394
|
+
*/
|
|
1395
|
+
function DocsLayout$1() {
|
|
1396
|
+
const config = require_icons_dev.useConfig();
|
|
1397
|
+
const { currentRoute, allRoutes } = require_icons_dev.useRoutes();
|
|
1398
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Head, {
|
|
1399
|
+
siteTitle: config.theme?.title,
|
|
1400
|
+
siteDescription: config.theme?.description,
|
|
1401
|
+
routes: allRoutes || []
|
|
1402
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(virtual_boltdocs_layout.default, {
|
|
1403
|
+
route: currentRoute,
|
|
1404
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_router_dom.Outlet, {})
|
|
1405
|
+
})] });
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
//#endregion
|
|
1409
|
+
//#region src/client/ssg/create-routes.tsx
|
|
1410
|
+
const Loading = () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1411
|
+
className: "text-muted text-sm py-4",
|
|
1412
|
+
children: "Loading..."
|
|
1413
|
+
});
|
|
1414
|
+
/**
|
|
1415
|
+
* Stable component to render MDX pages.
|
|
1416
|
+
* By being outside createRoutes, it prevents React from unmounting the page on HMR.
|
|
1417
|
+
*/
|
|
1418
|
+
const MdxRouteElement = ({ moduleLoader, moduleKey, route, components }) => {
|
|
1419
|
+
const MDXComponent = moduleLoader?.default ?? moduleLoader ?? null;
|
|
1420
|
+
(0, react.useEffect)(() => {
|
|
1421
|
+
if (!{}.hot || !moduleKey) return;
|
|
1422
|
+
const handler = (data) => {
|
|
1423
|
+
if (data.relPath.replace(/\\/g, "/").replace(/^\//, "") !== route.filePath.replace(/\\/g, "/").replace(/^\//, "")) return;
|
|
1424
|
+
import(moduleKey + "?t=" + Date.now()).then((m) => {});
|
|
1425
|
+
};
|
|
1426
|
+
({}).hot.on("boltdocs:mdx-update", handler);
|
|
1427
|
+
return () => ({}).hot?.off("boltdocs:mdx-update", handler);
|
|
1428
|
+
}, [moduleKey, route.filePath]);
|
|
1429
|
+
if (!MDXComponent) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Loading, {});
|
|
1430
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MdxPage, {
|
|
1431
|
+
MDXComponent,
|
|
1432
|
+
mdxComponents: components
|
|
1433
|
+
});
|
|
1434
|
+
};
|
|
1435
|
+
const NotFoundWrapper = () => {
|
|
1436
|
+
const components = useMdxComponents();
|
|
1437
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(components.NotFound || components["404"] || NotFound, {});
|
|
1438
|
+
};
|
|
1439
|
+
function createRoutes(options) {
|
|
1440
|
+
const { routesData, config, mdxModules, externalPages, externalLayout, components } = options;
|
|
1441
|
+
const EffectiveExternalLayout = externalLayout || (({ children }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children }));
|
|
1442
|
+
const withBase = (path) => {
|
|
1443
|
+
const base = config.base || "/";
|
|
1444
|
+
if (path.startsWith(base)) return path;
|
|
1445
|
+
return `${base === "/" ? "" : base.replace(/\/$/, "")}${path.startsWith("/") ? path : `/${path}`}` || "/";
|
|
1446
|
+
};
|
|
1447
|
+
const defaultVersionMetadata = [];
|
|
1448
|
+
const defaultVersion = config.versions?.defaultVersion;
|
|
1449
|
+
const docsBase = (config.base || "/docs").replace(/\/$/, "");
|
|
1450
|
+
let baseDocsPath = (config.base || "/docs").replace(/\/$/, "");
|
|
1451
|
+
if (!baseDocsPath) baseDocsPath = "/";
|
|
1452
|
+
if (defaultVersion) routesData.forEach((route) => {
|
|
1453
|
+
if (route.version) return;
|
|
1454
|
+
const p = route.path || "";
|
|
1455
|
+
const subPath = p.startsWith(docsBase) ? p.substring(docsBase.length).replace(/^\//, "") : p.replace(/^\//, "");
|
|
1456
|
+
if (!(subPath === defaultVersion || subPath.startsWith(`${defaultVersion}/`))) {
|
|
1457
|
+
const explicitPath = `${docsBase}/${defaultVersion}/${subPath}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
1458
|
+
defaultVersionMetadata.push({
|
|
1459
|
+
...route,
|
|
1460
|
+
path: explicitPath,
|
|
1461
|
+
version: defaultVersion
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
});
|
|
1465
|
+
const docMetadata = [...routesData, ...defaultVersionMetadata];
|
|
1466
|
+
const moduleMap = /* @__PURE__ */ new Map();
|
|
1467
|
+
const mdxModuleKeys = Object.keys(mdxModules);
|
|
1468
|
+
if (mdxModuleKeys.length > 0) {
|
|
1469
|
+
const docsDirName = mdxModuleKeys[0].replace(/\\/g, "/").split("/").filter(Boolean)[0] || "docs";
|
|
1470
|
+
const primaryPrefix = `/${docsDirName}/`;
|
|
1471
|
+
const altPrefix = `./${docsDirName}/`;
|
|
1472
|
+
for (const rawKey of mdxModuleKeys) {
|
|
1473
|
+
const k = rawKey.replace(/\\/g, "/");
|
|
1474
|
+
let relativePath = "";
|
|
1475
|
+
if (k.indexOf(primaryPrefix) !== -1) relativePath = k.substring(k.indexOf(primaryPrefix) + primaryPrefix.length);
|
|
1476
|
+
else if (k.startsWith(altPrefix)) relativePath = k.substring(altPrefix.length);
|
|
1477
|
+
if (relativePath) moduleMap.set(relativePath, rawKey);
|
|
1478
|
+
else moduleMap.set(k, rawKey);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
const docRoutes = docMetadata.map((route) => {
|
|
1482
|
+
const normalizedFilePath = route.filePath.replace(/\\/g, "/");
|
|
1483
|
+
const moduleKey = moduleMap.get(normalizedFilePath);
|
|
1484
|
+
const moduleLoader = moduleKey ? mdxModules[moduleKey] : null;
|
|
1485
|
+
const fullPath = withBase(route.path === "" ? "/" : route.path);
|
|
1486
|
+
const path = fullPath === baseDocsPath ? "." : fullPath.startsWith(baseDocsPath + "/") ? fullPath.slice(baseDocsPath.length + 1) : fullPath;
|
|
1487
|
+
return {
|
|
1488
|
+
path,
|
|
1489
|
+
element: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MdxRouteElement, {
|
|
1490
|
+
moduleKey,
|
|
1491
|
+
moduleLoader,
|
|
1492
|
+
route,
|
|
1493
|
+
components
|
|
1494
|
+
}, moduleKey || path),
|
|
1495
|
+
loader: async () => ({
|
|
1496
|
+
path,
|
|
1497
|
+
frontmatter: {
|
|
1498
|
+
title: route.title,
|
|
1499
|
+
description: route.description || "",
|
|
1500
|
+
...route.frontmatter || {}
|
|
1501
|
+
},
|
|
1502
|
+
headings: route.headings || [],
|
|
1503
|
+
filePath: route.filePath,
|
|
1504
|
+
locale: route.locale,
|
|
1505
|
+
version: route.version,
|
|
1506
|
+
group: route.group,
|
|
1507
|
+
groupTitle: route.groupTitle,
|
|
1508
|
+
date: route.date,
|
|
1509
|
+
lastUpdated: route.lastUpdated
|
|
1510
|
+
}),
|
|
1511
|
+
getStaticPaths: () => [path]
|
|
1512
|
+
};
|
|
1513
|
+
});
|
|
1514
|
+
const locales = config.i18n?.locales ? Array.isArray(config.i18n.locales) ? config.i18n.locales : Object.keys(config.i18n.locales) : [];
|
|
1515
|
+
const allVersions = config.versions?.versions?.map((v) => v.path) || [];
|
|
1516
|
+
const targetBasePaths = [];
|
|
1517
|
+
targetBasePaths.push({
|
|
1518
|
+
path: baseDocsPath,
|
|
1519
|
+
filter: () => true
|
|
1520
|
+
});
|
|
1521
|
+
const subPaths = [];
|
|
1522
|
+
if (allVersions.length > 0) allVersions.forEach((v) => subPaths.push(`/${v}`));
|
|
1523
|
+
if (locales.length > 0) locales.forEach((l) => subPaths.push(`/${l}`));
|
|
1524
|
+
if (allVersions.length > 0 && locales.length > 0) allVersions.forEach((v) => {
|
|
1525
|
+
locales.forEach((l) => {
|
|
1526
|
+
subPaths.push(`/${v}/${l}`);
|
|
1527
|
+
});
|
|
1528
|
+
});
|
|
1529
|
+
subPaths.forEach((sp) => {
|
|
1530
|
+
const fullP = baseDocsPath === "/" ? sp : `${baseDocsPath}${sp}`;
|
|
1531
|
+
targetBasePaths.push({
|
|
1532
|
+
path: fullP,
|
|
1533
|
+
filter: (rp) => rp.startsWith(fullP.replace(/\/$/, "") + "/")
|
|
1534
|
+
});
|
|
1535
|
+
});
|
|
1536
|
+
const docPathRegistry = new Set(docRoutes.map((r) => (r.path || "").replace(/\/$/, "")));
|
|
1537
|
+
const externalPaths = /* @__PURE__ */ new Set();
|
|
1538
|
+
if (externalPages) Object.keys(externalPages).forEach((rawPath) => {
|
|
1539
|
+
const p = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
|
|
1540
|
+
externalPaths.add(p.replace(/\/$/, ""));
|
|
1541
|
+
if (config.i18n) Object.keys(config.i18n.locales).forEach((locale) => {
|
|
1542
|
+
externalPaths.add(`/${locale}${p === "/" ? "" : p}`.replace(/\/$/, ""));
|
|
1543
|
+
});
|
|
1544
|
+
});
|
|
1545
|
+
targetBasePaths.forEach(({ path: bPath, filter }) => {
|
|
1546
|
+
if (bPath === "/") return;
|
|
1547
|
+
const normalizedPath = bPath.replace(/\/$/, "");
|
|
1548
|
+
if (!(docPathRegistry.has(normalizedPath) || externalPaths.has(normalizedPath))) {
|
|
1549
|
+
const defaultTab = config.theme?.tabs?.[0]?.id;
|
|
1550
|
+
const defaultTabPath = defaultTab ? `${normalizedPath}/${defaultTab}`.replace(/\/+/g, "/") : null;
|
|
1551
|
+
let matchedRouteObj = defaultTabPath && docPathRegistry.has(defaultTabPath.replace(/\/$/, "")) ? docRoutes.find((r) => r.path.replace(/\/$/, "") === defaultTabPath.replace(/\/$/, "")) : docRoutes.find((r) => filter(r.path) && r.path !== normalizedPath);
|
|
1552
|
+
if (!matchedRouteObj && docRoutes.length > 0) matchedRouteObj = docRoutes[0];
|
|
1553
|
+
if (matchedRouteObj) {
|
|
1554
|
+
const redirectPath = bPath === baseDocsPath ? "." : bPath.startsWith(baseDocsPath + "/") ? bPath.slice(baseDocsPath.length + 1) : bPath;
|
|
1555
|
+
const isBasePathFallback = redirectPath === ".";
|
|
1556
|
+
docRoutes.push({
|
|
1557
|
+
...isBasePathFallback ? { index: true } : { path: redirectPath },
|
|
1558
|
+
element: matchedRouteObj.element,
|
|
1559
|
+
loader: matchedRouteObj.loader,
|
|
1560
|
+
getStaticPaths: () => []
|
|
1561
|
+
});
|
|
1562
|
+
const matchedMetaObj = docMetadata.find((m) => {
|
|
1563
|
+
const fullPath = withBase(m.path === "" ? "/" : m.path);
|
|
1564
|
+
return (fullPath === baseDocsPath ? "." : fullPath.startsWith(baseDocsPath + "/") ? fullPath.slice(baseDocsPath.length + 1) : fullPath) === matchedRouteObj.path;
|
|
1565
|
+
});
|
|
1566
|
+
if (matchedMetaObj) {
|
|
1567
|
+
const canonicalPath = withBase(matchedMetaObj.path);
|
|
1568
|
+
const canonicalUrl = config.siteUrl ? `${config.siteUrl.replace(/\/$/, "")}${canonicalPath}` : canonicalPath;
|
|
1569
|
+
docMetadata.push({
|
|
1570
|
+
...matchedMetaObj,
|
|
1571
|
+
path: bPath,
|
|
1572
|
+
filePath: "",
|
|
1573
|
+
slugParts: [],
|
|
1574
|
+
seo: {
|
|
1575
|
+
...matchedMetaObj.seo,
|
|
1576
|
+
canonical: canonicalUrl
|
|
1577
|
+
}
|
|
1578
|
+
});
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
});
|
|
1583
|
+
const children = [{
|
|
1584
|
+
path: baseDocsPath,
|
|
1585
|
+
element: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DocsLayout$1, {}),
|
|
1586
|
+
children: docRoutes
|
|
1587
|
+
}];
|
|
1588
|
+
const externalMetadata = [];
|
|
1589
|
+
if (externalPages) Object.entries(externalPages).forEach(([rawPath, ExtComponent]) => {
|
|
1590
|
+
const path = rawPath.startsWith("/") ? rawPath : `/${rawPath}`;
|
|
1591
|
+
if (!children.find((r) => r.path === path)) {
|
|
1592
|
+
externalMetadata.push({
|
|
1593
|
+
path,
|
|
1594
|
+
locale: config.i18n?.defaultLocale,
|
|
1595
|
+
title: rawPath === "/" ? "Home" : rawPath.replace(/^\//, "").split("/").pop() || "Page",
|
|
1596
|
+
filePath: "",
|
|
1597
|
+
headings: []
|
|
1598
|
+
});
|
|
1599
|
+
children.push({
|
|
1600
|
+
path,
|
|
1601
|
+
element: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EffectiveExternalLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExtComponent, {}) }),
|
|
1602
|
+
loader: async () => ({
|
|
1603
|
+
path,
|
|
1604
|
+
locale: config.i18n?.defaultLocale
|
|
1605
|
+
}),
|
|
1606
|
+
getStaticPaths: () => [path]
|
|
1607
|
+
});
|
|
1608
|
+
if (config.i18n) Object.keys(config.i18n.locales).forEach((locale) => {
|
|
1609
|
+
const localePath = `/${locale}${rawPath === "/" ? "" : rawPath}`;
|
|
1610
|
+
if (!children.find((r) => r.path === localePath)) {
|
|
1611
|
+
externalMetadata.push({
|
|
1612
|
+
path: localePath,
|
|
1613
|
+
locale,
|
|
1614
|
+
title: rawPath,
|
|
1615
|
+
filePath: "",
|
|
1616
|
+
headings: []
|
|
1617
|
+
});
|
|
1618
|
+
children.push({
|
|
1619
|
+
path: localePath,
|
|
1620
|
+
element: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EffectiveExternalLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExtComponent, {}) }),
|
|
1621
|
+
loader: async () => ({
|
|
1622
|
+
path: localePath,
|
|
1623
|
+
locale
|
|
1624
|
+
}),
|
|
1625
|
+
getStaticPaths: () => [localePath]
|
|
1626
|
+
});
|
|
1627
|
+
}
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
children.push({
|
|
1632
|
+
path: "*",
|
|
1633
|
+
element: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EffectiveExternalLayout, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(NotFoundWrapper, {}) })
|
|
1634
|
+
});
|
|
1635
|
+
return [{
|
|
1636
|
+
element: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(BoltdocsShell, {
|
|
1637
|
+
config,
|
|
1638
|
+
routes: [...docMetadata, ...externalMetadata],
|
|
1639
|
+
components
|
|
1640
|
+
}),
|
|
1641
|
+
children
|
|
1642
|
+
}];
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
//#endregion
|
|
1646
|
+
//#region src/client/hooks/use-analytics.ts
|
|
1647
|
+
function createAnalyticsInstance(config) {
|
|
1648
|
+
if (typeof window === "undefined") return createDisabledAnalytics();
|
|
1649
|
+
if (typeof window.gtag === "function") return createGtagAnalytics(config);
|
|
1650
|
+
if (window.dataLayer) return createDataLayerAnalytics(config);
|
|
1651
|
+
return createDisabledAnalytics();
|
|
1652
|
+
}
|
|
1653
|
+
function createGtagAnalytics(config) {
|
|
1654
|
+
return {
|
|
1655
|
+
trackPageView: (path, title) => {
|
|
1656
|
+
window.gtag?.("event", "page_view", {
|
|
1657
|
+
page_path: path,
|
|
1658
|
+
page_title: title || document.title,
|
|
1659
|
+
send_to: config?.ga4?.measurementId
|
|
1660
|
+
});
|
|
1661
|
+
},
|
|
1662
|
+
trackEvent: ({ action, category, label, value, params }) => {
|
|
1663
|
+
window.gtag?.("event", action, {
|
|
1664
|
+
event_category: category,
|
|
1665
|
+
event_label: label,
|
|
1666
|
+
value,
|
|
1667
|
+
send_to: config?.ga4?.measurementId,
|
|
1668
|
+
...params
|
|
1669
|
+
});
|
|
1670
|
+
},
|
|
1671
|
+
trackSearch: (query, resultsCount) => {
|
|
1672
|
+
window.gtag?.("event", "search", {
|
|
1673
|
+
search_term: query,
|
|
1674
|
+
results_count: resultsCount,
|
|
1675
|
+
send_to: config?.ga4?.measurementId
|
|
1676
|
+
});
|
|
1677
|
+
},
|
|
1678
|
+
trackDownload: (file, type) => {
|
|
1679
|
+
window.gtag?.("event", "file_download", {
|
|
1680
|
+
file_name: file,
|
|
1681
|
+
file_type: type || file.split(".").pop(),
|
|
1682
|
+
send_to: config?.ga4?.measurementId
|
|
1683
|
+
});
|
|
1684
|
+
},
|
|
1685
|
+
trackExternalLink: (url) => {
|
|
1686
|
+
window.gtag?.("event", "external_link", {
|
|
1687
|
+
link_url: url,
|
|
1688
|
+
send_to: config?.ga4?.measurementId
|
|
1689
|
+
});
|
|
1690
|
+
},
|
|
1691
|
+
isEnabled: true
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
function createDataLayerAnalytics(config) {
|
|
1695
|
+
return {
|
|
1696
|
+
trackPageView: (path, title) => {
|
|
1697
|
+
window.dataLayer?.push({
|
|
1698
|
+
event: "page_view",
|
|
1699
|
+
page_path: path,
|
|
1700
|
+
page_title: title || document.title,
|
|
1701
|
+
send_to: config?.gtm?.tagId
|
|
1702
|
+
});
|
|
1703
|
+
},
|
|
1704
|
+
trackEvent: ({ action, category, label, value, params }) => {
|
|
1705
|
+
window.dataLayer?.push({
|
|
1706
|
+
event: action,
|
|
1707
|
+
event_category: category,
|
|
1708
|
+
event_label: label,
|
|
1709
|
+
value,
|
|
1710
|
+
send_to: config?.gtm?.tagId,
|
|
1711
|
+
...params
|
|
1712
|
+
});
|
|
1713
|
+
},
|
|
1714
|
+
trackSearch: (query, resultsCount) => {
|
|
1715
|
+
window.dataLayer?.push({
|
|
1716
|
+
event: "search",
|
|
1717
|
+
search_term: query,
|
|
1718
|
+
results_count: resultsCount,
|
|
1719
|
+
send_to: config?.gtm?.tagId
|
|
1720
|
+
});
|
|
1721
|
+
},
|
|
1722
|
+
trackDownload: (file, type) => {
|
|
1723
|
+
window.dataLayer?.push({
|
|
1724
|
+
event: "file_download",
|
|
1725
|
+
file_name: file,
|
|
1726
|
+
file_type: type || file.split(".").pop(),
|
|
1727
|
+
send_to: config?.gtm?.tagId
|
|
1728
|
+
});
|
|
1729
|
+
},
|
|
1730
|
+
trackExternalLink: (url) => {
|
|
1731
|
+
window.dataLayer?.push({
|
|
1732
|
+
event: "external_link",
|
|
1733
|
+
link_url: url,
|
|
1734
|
+
send_to: config?.gtm?.tagId
|
|
1735
|
+
});
|
|
1736
|
+
},
|
|
1737
|
+
isEnabled: true
|
|
1738
|
+
};
|
|
1739
|
+
}
|
|
1740
|
+
function createDisabledAnalytics() {
|
|
1741
|
+
return {
|
|
1742
|
+
trackPageView: () => {},
|
|
1743
|
+
trackEvent: () => {},
|
|
1744
|
+
trackSearch: () => {},
|
|
1745
|
+
trackDownload: () => {},
|
|
1746
|
+
trackExternalLink: () => {},
|
|
1747
|
+
isEnabled: false
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1750
|
+
const CONFIG_INSTANCE_SYMBOL = Symbol.for("__BDOCS_CONFIG_INSTANCE__");
|
|
1751
|
+
function useAnalytics(options = {}) {
|
|
1752
|
+
const { config: optionsConfig, autoTrackPageViews = true, autoTrackDownloads = true, autoTrackExternalLinks = true, excludePatterns = [] } = options;
|
|
1753
|
+
const globalConfig = typeof globalThis !== "undefined" ? globalThis[CONFIG_INSTANCE_SYMBOL] : void 0;
|
|
1754
|
+
const config = optionsConfig ?? globalConfig?.integrations;
|
|
1755
|
+
const analytics = (0, react.useMemo)(() => createAnalyticsInstance(config), [config]);
|
|
1756
|
+
const previousPath = (0, react.useRef)("");
|
|
1757
|
+
const location = require_docs_layout.useLocation();
|
|
1758
|
+
(0, react.useEffect)(() => {
|
|
1759
|
+
if (!autoTrackPageViews || !analytics.isEnabled) return;
|
|
1760
|
+
const path = location.pathname + location.search;
|
|
1761
|
+
if (path !== previousPath.current) {
|
|
1762
|
+
previousPath.current = path;
|
|
1763
|
+
analytics.trackPageView(path, document.title);
|
|
1764
|
+
}
|
|
1765
|
+
}, [
|
|
1766
|
+
location.pathname,
|
|
1767
|
+
autoTrackPageViews,
|
|
1768
|
+
analytics
|
|
1769
|
+
]);
|
|
1770
|
+
(0, react.useEffect)(() => {
|
|
1771
|
+
if (!autoTrackDownloads || !analytics.isEnabled) return;
|
|
1772
|
+
const handleClick = (event) => {
|
|
1773
|
+
const target = event.target?.closest("a");
|
|
1774
|
+
if (!target) return;
|
|
1775
|
+
const href = target.getAttribute("href");
|
|
1776
|
+
if (!href) return;
|
|
1777
|
+
if (excludePatterns.some((pattern) => pattern.test(href))) return;
|
|
1778
|
+
if (target.hasAttribute("download") || /\.(pdf|doc|docx|xls|xlsx|ppt|pptx|zip|rar|7z|tar|gz|mp3|mp4|avi|mov|png|jpg|jpeg|gif|svg|webp)$/i.test(href)) {
|
|
1779
|
+
const fileName = href.split("/").pop() || href;
|
|
1780
|
+
analytics.trackDownload(fileName, fileName.split(".").pop());
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1783
|
+
document.addEventListener("click", handleClick);
|
|
1784
|
+
return () => document.removeEventListener("click", handleClick);
|
|
1785
|
+
}, [
|
|
1786
|
+
autoTrackDownloads,
|
|
1787
|
+
autoTrackExternalLinks,
|
|
1788
|
+
analytics,
|
|
1789
|
+
excludePatterns
|
|
1790
|
+
]);
|
|
1791
|
+
(0, react.useEffect)(() => {
|
|
1792
|
+
if (!autoTrackExternalLinks || !analytics.isEnabled) return;
|
|
1793
|
+
const handleClick = (event) => {
|
|
1794
|
+
const target = event.target?.closest("a");
|
|
1795
|
+
if (!target) return;
|
|
1796
|
+
const href = target.getAttribute("href");
|
|
1797
|
+
if (!href) return;
|
|
1798
|
+
if (excludePatterns.some((pattern) => pattern.test(href))) return;
|
|
1799
|
+
if ((href.startsWith("http://") || href.startsWith("https://") || href.startsWith("//")) && !href.includes(window.location.hostname)) analytics.trackExternalLink(href);
|
|
1800
|
+
};
|
|
1801
|
+
document.addEventListener("click", handleClick);
|
|
1802
|
+
return () => document.removeEventListener("click", handleClick);
|
|
1803
|
+
}, [
|
|
1804
|
+
autoTrackExternalLinks,
|
|
1805
|
+
analytics,
|
|
1806
|
+
excludePatterns
|
|
1807
|
+
]);
|
|
1808
|
+
return analytics;
|
|
1809
|
+
}
|
|
1810
|
+
function useTrackPageView() {
|
|
1811
|
+
const analytics = (0, react.useMemo)(() => createAnalyticsInstance(), []);
|
|
1812
|
+
return (0, react.useCallback)((path, title) => {
|
|
1813
|
+
analytics.trackPageView(path, title);
|
|
1814
|
+
}, [analytics]);
|
|
1815
|
+
}
|
|
1816
|
+
function useTrackEvent() {
|
|
1817
|
+
const analytics = (0, react.useMemo)(() => createAnalyticsInstance(), []);
|
|
1818
|
+
return (0, react.useCallback)((event) => {
|
|
1819
|
+
analytics.trackEvent(event);
|
|
1820
|
+
}, [analytics]);
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
//#endregion
|
|
1824
|
+
//#region src/client/components/docs-layout-default.tsx
|
|
1825
|
+
/**
|
|
1826
|
+
* Pre-assembled high-fidelity documentation layout component.
|
|
1827
|
+
* Fully styled and optimized to adapt seamlessly to our custom Parchment/Slate theme.
|
|
1828
|
+
*/
|
|
1829
|
+
function DocsLayoutComponent({ children }) {
|
|
1830
|
+
const { routes: filteredRoutes, currentRoute } = require_icons_dev.useRoutes();
|
|
1831
|
+
const config = require_icons_dev.useConfig();
|
|
1832
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.DocsLayout, {
|
|
1833
|
+
className: "selection:bg-primary-500/10 selection:text-primary-500",
|
|
1834
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Navbar, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.DocsLayout.Body, {
|
|
1835
|
+
className: "bg-main",
|
|
1836
|
+
children: [
|
|
1837
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Sidebar, {
|
|
1838
|
+
routes: filteredRoutes || [],
|
|
1839
|
+
config
|
|
1840
|
+
}),
|
|
1841
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.DocsLayout.Content, {
|
|
1842
|
+
className: "animate-in fade-in duration-500 scroll-smooth",
|
|
1843
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.DocsLayout.ContentMdx, {
|
|
1844
|
+
className: "max-w-3xl sm:max-w-4xl lg:max-w-4xl px-2 pt-8 pb-24",
|
|
1845
|
+
children: [
|
|
1846
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_docs_layout.DocsLayout.Header, { children: [
|
|
1847
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1848
|
+
className: "mb-4 border-b border-subtle pb-4 flex flex-wrap items-center justify-between gap-3",
|
|
1849
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Breadcrumbs, {}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyMarkdown, {
|
|
1850
|
+
mdxRaw: currentRoute?._rawContent,
|
|
1851
|
+
route: currentRoute
|
|
1852
|
+
})]
|
|
1853
|
+
}),
|
|
1854
|
+
currentRoute?.title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
|
|
1855
|
+
className: "text-4xl font-bold tracking-tight text-default mb-3",
|
|
1856
|
+
children: currentRoute.title
|
|
1857
|
+
}),
|
|
1858
|
+
currentRoute?.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
1859
|
+
className: "text-lg text-muted-foreground mb-6 leading-relaxed",
|
|
1860
|
+
children: currentRoute.description
|
|
1861
|
+
})
|
|
1862
|
+
] }),
|
|
1863
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1864
|
+
className: "prose prose-neutral dark:prose-invert max-w-none",
|
|
1865
|
+
children
|
|
1866
|
+
}) }),
|
|
1867
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_docs_layout.DocsLayout.Footer, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PageNav, {}) })
|
|
1868
|
+
]
|
|
1869
|
+
})
|
|
1870
|
+
}),
|
|
1871
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(OnThisPage, {
|
|
1872
|
+
headings: currentRoute?.headings,
|
|
1873
|
+
editLink: config.theme?.editLink,
|
|
1874
|
+
communityHelp: config.theme?.communityHelp,
|
|
1875
|
+
filePath: currentRoute?.filePath
|
|
1876
|
+
})
|
|
1877
|
+
]
|
|
1878
|
+
})]
|
|
1879
|
+
});
|
|
1880
|
+
}
|
|
1881
|
+
const DocsLayout = Object.assign(DocsLayoutComponent, {
|
|
1882
|
+
Body: require_docs_layout.DocsLayout.Body,
|
|
1883
|
+
Content: require_docs_layout.DocsLayout.Content,
|
|
1884
|
+
ContentMdx: require_docs_layout.DocsLayout.ContentMdx,
|
|
1885
|
+
Header: require_docs_layout.DocsLayout.Header,
|
|
1886
|
+
Footer: require_docs_layout.DocsLayout.Footer
|
|
1887
|
+
});
|
|
1888
|
+
|
|
1889
|
+
//#endregion
|
|
1890
|
+
exports.BoltdocsShell = BoltdocsShell;
|
|
1891
|
+
exports.Breadcrumbs = Breadcrumbs;
|
|
1892
|
+
exports.Card = require_mdx.Card;
|
|
1893
|
+
exports.Cards = require_mdx.Cards;
|
|
1894
|
+
exports.CopyMarkdown = CopyMarkdown;
|
|
1895
|
+
exports.DocsLayout = DocsLayout;
|
|
1896
|
+
exports.ErrorBoundary = ErrorBoundary;
|
|
1897
|
+
exports.MdxPage = MdxPage;
|
|
1898
|
+
exports.Navbar = Navbar;
|
|
1899
|
+
exports.NotFound = NotFound;
|
|
1900
|
+
exports.OnThisPage = OnThisPage;
|
|
1901
|
+
exports.PageNav = PageNav;
|
|
1902
|
+
exports.SearchDialog = require_search_dialog$1.SearchDialog;
|
|
1903
|
+
exports.Sidebar = Sidebar;
|
|
1904
|
+
Object.defineProperty(exports, 'ViteReactSSG', {
|
|
1905
|
+
enumerable: true,
|
|
1906
|
+
get: function () {
|
|
1907
|
+
return _bdocs_ssg.ViteReactSSG;
|
|
1908
|
+
}
|
|
1909
|
+
});
|
|
1910
|
+
exports.cn = require_icons_dev.cn;
|
|
1911
|
+
exports.copyToClipboard = require_mdx.copyToClipboard;
|
|
1912
|
+
exports.createRoutes = createRoutes;
|
|
1913
|
+
exports.getStarsRepo = getStarsRepo;
|
|
1914
|
+
exports.getTranslated = getTranslated;
|
|
1915
|
+
exports.reactToText = require_mdx.reactToText;
|
|
1916
|
+
exports.useAnalytics = useAnalytics;
|
|
1917
|
+
exports.useBreadcrumbs = useBreadcrumbs;
|
|
1918
|
+
exports.useConfig = require_icons_dev.useConfig;
|
|
1919
|
+
exports.useI18n = useI18n;
|
|
1920
|
+
exports.useLocalizedTo = require_icons_dev.useLocalizedTo;
|
|
1921
|
+
exports.useLocation = require_docs_layout.useLocation;
|
|
1922
|
+
exports.useMdxComponents = useMdxComponents;
|
|
1923
|
+
exports.useNavbar = useNavbar;
|
|
1924
|
+
exports.usePageNav = usePageNav;
|
|
1925
|
+
exports.useRoutes = require_icons_dev.useRoutes;
|
|
1926
|
+
exports.useSearch = require_search_dialog$1.useSearch;
|
|
1927
|
+
exports.useSearchHighlight = require_docs_layout.useSearchHighlight;
|
|
1928
|
+
exports.useSidebar = require_docs_layout.useSidebar;
|
|
1929
|
+
exports.useTabs = useTabs;
|
|
1930
|
+
exports.useTheme = require_image.useTheme;
|
|
1931
|
+
exports.useTrackEvent = useTrackEvent;
|
|
1932
|
+
exports.useTrackPageView = useTrackPageView;
|
|
1933
|
+
exports.useUI = require_docs_layout.useUI;
|
|
1934
|
+
exports.useVersion = useVersion;
|