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