boltdocs 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,U as g,V as _,_ as ee,a as v,b as y,c as te,d as b,f as ne,g as re,h as ie,i as ae,j as x,k as oe,l as S,m as se,n as C,o as w,p as ce,r as T,s as E,t as le,u as ue,v as D,w as de,x as fe,y as O,z as k}from"../use-search-C9bxCqfF.js";import{Outlet as pe,useLoaderData as me,useLocation as A,useNavigate as he}from"react-router-dom";import ge from"virtual:boltdocs-layout";import{Children as j,Component as _e,Suspense as ve,createContext as ye,isValidElement as M,lazy as be,use as xe,useCallback as N,useEffect as P,useLayoutEffect as Se,useMemo as F,useRef as I,useState as L}from"react";import{Fragment as R,jsx as z,jsxs as B}from"react/jsx-runtime";import*as V from"react-aria-components";import{Button as Ce,RouterProvider as we}from"react-aria-components";import{Helmet as Te,HelmetProvider as Ee}from"react-helmet-async";import*as De from"lucide-react";import{AlertTriangle as Oe,ArrowLeft as ke,Bookmark as Ae,Check as je,ChevronDown as H,ChevronLeft as Me,ChevronRight as U,ChevronUp as Ne,ChevronsLeft as Pe,ChevronsRight as Fe,Circle as Ie,CircleHelp as Le,Copy as W,ExternalLink as Re,File as ze,FileCode as Be,FileImage as Ve,FileText as He,Flame as Ue,Folder as We,Home as Ge,Info as Ke,Languages as qe,Lightbulb as Je,Link as Ye,Monitor as Xe,Moon as Ze,Pencil as Qe,ShieldAlert as $e,Sun as et,TextAlignStart as tt,Zap as nt}from"lucide-react";import{cva as G}from"class-variance-authority";import rt from"virtual:boltdocs-mdx-components";import it from"virtual:boltdocs-icons";var at=Object.defineProperty,ot=(e,t)=>{let n={};for(var r in e)at(n,r,{get:e[r],enumerable:!0});return t||at(n,Symbol.toStringTag,{value:`Module`}),n};function st(e){return e}const ct=Symbol.for(`__BDOCS_MDX_COMPONENTS_CONTEXT__`),lt=Symbol.for(`__BDOCS_MDX_COMPONENTS_INSTANCE__`),ut=globalThis[ct]||(globalThis[ct]=ye({}));function dt(){let e=xe(ut);return(!e||Object.keys(e).length===0)&&globalThis[lt]?globalThis[lt]:e}function ft({components:e,children:t}){return typeof globalThis<`u`&&(globalThis[lt]=e),z(ut.Provider,{value:e,children:t})}function pt({route:e,content:t,mdxComponents:n}){let r=dt(),i=F(()=>({...r,...n}),[r,n]);return t?z(ge,{route:e,children:z(t,{components:i})}):null}function mt({MDXComponent:e,mdxComponents:t}){let n=me(),r=e||n?.MDXComponent,i=t||n?.mdxComponents;return r?z(pt,{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},content:r,mdxComponents:i}):null}const ht=Symbol.for(`__BDOCS_THEME_CONTEXT__`),gt=Symbol.for(`__BDOCS_THEME_INSTANCE__`),_t=`boltdocs-theme-change`,vt=globalThis[ht]||(globalThis[ht]=ye(void 0));function yt({children:e}){let[t,n]=L(`system`),[r,i]=L(`dark`),a=e=>{let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=e===`dark`||e===`system`&&t.matches,r=window.document.documentElement;r.classList.toggle(`dark`,n),r.dataset.theme=n?`dark`:`light`,i(n?`dark`:`light`)};P(()=>{let e=localStorage.getItem(`boltdocs-theme`);e?(n(e),a(e)):a(`system`);let t=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>{(localStorage.getItem(`boltdocs-theme`)||`system`)===`system`&&a(`system`)};return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[]);let o={theme:t,resolvedTheme:r,setTheme:e=>{n(e),localStorage.setItem(`boltdocs-theme`,e),a(e),typeof window<`u`&&window.dispatchEvent(new CustomEvent(_t,{detail:e}))}};return typeof globalThis<`u`&&(globalThis[gt]=o),z(vt.Provider,{value:o,children:e})}function K(){let e=xe(vt),[,t]=L({});if(P(()=>{if(e)return;let n=()=>t({});return window.addEventListener(_t,n),()=>window.removeEventListener(_t,n)},[e]),!e&&typeof globalThis<`u`&&globalThis[gt])return globalThis[gt];if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e}function bt(){let{pathname:e,hash:t}=A();return Se(()=>{let e=document.querySelector(`.boltdocs-content`)||window,n=()=>e===window?window.scrollY:e.scrollTop,r=(t,n=`auto`)=>{e===window?window.scrollTo({top:t,behavior:n}):e.scrollTo({top:t,behavior:n})};if(t){let i=t.replace(`#`,``),a=document.getElementById(i);if(a){let t=e===window?0:e.getBoundingClientRect().top;r(a.getBoundingClientRect().top-t-80+n(),`smooth`);return}}r(0)},[e,t]),null}const xt=({className:e,variant:t,size:n,rounded:r,iconSize:i,disabled:a,...o})=>z(c,{className:k(`group`,p({variant:t,size:n,rounded:r,iconSize:i,disabled:a,className:e})),...o}),St=(e,t)=>{if(e==null||typeof e==`boolean`)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(e=>St(e,t)).join(``);if(M(e)){let n=t?.get(e.type);return n?n(e.props):St(e.props.children,t)}return``},Ct=async e=>{try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);return t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),!0}};function wt(e){let{title:t}=e,[n,r]=L(!1),[i,a]=L(!1),[o,s]=L(!1),c=I(null);_();let l=N(async()=>{Ct(c.current?.textContent??``),r(!0),setTimeout(()=>r(!1),2e3)},[]);return P(()=>{s((c.current?.textContent?.length??0)>120)},[e.children,e.highlightedHtml]),{copied:n,isExpanded:i,setIsExpanded:a,isExpandable:o,preRef:c,handleCopy:l,shouldTruncate:o&&!i}}const Tt=({children:e,className:t,plain:n=!1,...r})=>z(`div`,{className:k(`not-prose boltdocs-code-block`,`group relative overflow-hidden bg-(--color-code-bg)`,`contain-layout contain-paint`,{"my-6 rounded-lg border border-border-subtle":!n},t),...r,children:e}),Et=({children:e,className:t,...n})=>z(`div`,{className:k(`flex h-9 items-center justify-between px-4 py-1.5`,`border-b border-border-subtle bg-bg-surface/50`,`text-[13px] font-medium text-text-muted`,t),...n,children:e}),Dt=({children:e,className:t,...n})=>z(`div`,{className:k(`flex items-center space-x-2`,t),...n,children:e}),Ot=({className:e,children:t,shouldTruncate:n=!1,...r})=>z(`div`,{className:k(`relative`,{"[&>pre]:max-h-62.5 [&>pre]:overflow-hidden":n},e),...r,children:t}),kt={ts:a,tsx:l,js:oe,jsx:l,json:e,css:r,html:h,md:x,mdx:x,bash:f,sh:f,yaml:s,yml:s,rs:u,rust:u,toml:i},At=({copied:e,handleCopy:t})=>z(de,{content:e?`Copied!`:`Copy code`,children:z(Ce,{onPress:t,className:k(`grid place-items-center size-8 bg-transparent outline-none cursor-pointer transition-all duration-200 hover:scale-110 active:scale-95 [&>svg]:size-4 [&>svg]:stroke-2`,e?`text-emerald-400`:`text-text-muted hover:text-text-main`),"aria-label":`Copy code`,children:z(e?je:W,{size:20})})});function q(e){let{children:t,hideCopy:n=!1,highlightedHtml:r,"data-highlighted-html":i,title:a,"data-title":o,"data-lang":s,plain:c=!1,...l}=e,u=r||i,d=a||o,f=e.lang||s||``,{copied:p,isExpanded:m,setIsExpanded:h,isExpandable:g,preRef:_,handleCopy:ee,shouldTruncate:v}=wt(e),y=kt[f];return B(Tt,{plain:c,className:e.className,children:[(d||!n)&&B(Et,{children:[z(Dt,{children:d&&B(R,{children:[y?z(y,{size:14}):z(ze,{size:14,className:`opacity-60`}),z(`span`,{children:d})]})}),!n&&z(At,{copied:p,handleCopy:ee})]}),B(Ot,{shouldTruncate:v,children:[u?z(`div`,{ref:_,className:`shiki-wrapper [&>pre]:m-0! [&>pre]:rounded-none! [&>pre]:border-none! [&>pre]:bg-inherit! [&>pre>code]:grid! [&>pre>code]:p-5! [&>.shiki.shiki-themes]:bg-transparent!`,dangerouslySetInnerHTML:{__html:u}}):z(`pre`,{ref:_,className:`m-0! p-5! rounded-none! border-none! bg-inherit! font-mono text-[0.8125rem] leading-[1.7] overflow-x-auto`,...l,children:St(t)}),g&&z(`div`,{className:k(v?`absolute bottom-0 inset-x-0 h-24 bg-linear-to-t from-(--color-code-bg) to-transparent flex items-end justify-center pb-4 z-10`:`relative flex justify-center py-4`),children:z(Ce,{onPress:()=>h(!m),className:`rounded-full bg-bg-surface border border-border-subtle px-5 py-2 text-[0.8125rem] font-medium text-text-main outline-none cursor-pointer transition-all hover:bg-border-subtle hover:-translate-y-px backdrop-blur-md`,children:m?`Show less`:`Expand code`})})]})]})}function jt({initialIndex:e=0,tabs:t}){let n=t[e]?.props.disabled?t.findIndex(e=>!e.props.disabled):e,[r,i]=L(n===-1?0:n),a=I([]),[o,s]=L({opacity:0,transform:`translateX(0)`,width:0});return P(()=>{let e=a.current[r];e&&s({opacity:1,width:e.offsetWidth,transform:`translateX(${e.offsetLeft}px)`})},[r,t]),{active:r,setActive:i,tabRefs:a,indicatorStyle:o,handleKeyDown:N(e=>{let n=0;if(e.key===`ArrowRight`?n=1:e.key===`ArrowLeft`&&(n=-1),n!==0){let e=(r+n+t.length)%t.length;for(;t[e].props.disabled&&e!==r;)e=(e+n+t.length)%t.length;e!==r&&!t[e].props.disabled&&(i(e),a.current[e]?.focus())}},[r,t])}}const Mt=G(`relative flex items-center border-b border-border-subtle gap-1 overflow-x-auto no-scrollbar`,{variants:{size:{default:`px-0`,compact:`px-2`}},defaultVariants:{size:`default`}}),Nt=G(`flex items-center gap-2 px-4 py-2.5 text-sm font-medium outline-none transition-all duration-200 cursor-pointer bg-transparent border-none select-none whitespace-nowrap`,{variants:{isActive:{true:`text-primary-500`,false:`text-text-muted hover:text-text-main`},isDisabled:{true:`opacity-40 pointer-events-none`,false:``}},defaultVariants:{isActive:!1,isDisabled:!1}});function Pt({children:e}){return z(`div`,{className:`py-4`,children:typeof e==`string`?z(q,{className:`language-bash`,children:z(`code`,{children:e.trim()})}):e})}function Ft({defaultIndex:e=0,children:t}){let n=F(()=>j.toArray(t).filter(e=>M(e)&&e.props?.label),[t]),{active:r,setActive:i,tabRefs:a,indicatorStyle:o}=jt({initialIndex:e,tabs:n});return z(`div`,{className:`my-8 w-full group/tabs`,children:B(V.Tabs,{selectedKey:r.toString(),onSelectionChange:e=>i(Number(e)),className:`w-full`,children:[B(V.TabList,{"aria-label":`Content Tabs`,className:k(Mt()),children:[n.map((e,t)=>{let{label:n,icon:r,disabled:i}=e.props,o=t.toString();return B(V.Tab,{id:o,isDisabled:i,ref:e=>{a.current[t]=e},className:({isSelected:e,isDisabled:t})=>k(Nt({isActive:e,isDisabled:t})),children:[!!r&&z(`span`,{className:`shrink-0 [&>svg]:w-4 [&>svg]:h-4`,children:r}),z(`span`,{children:n})]},o)}),z(`div`,{className:`absolute bottom-0 h-0.5 bg-primary-500 transition-all duration-300 ease-in-out pointer-events-none`,style:o,"aria-hidden":`true`})]}),n.map((e,t)=>z(V.TabPanel,{id:t.toString(),children:n[t]},t))]})})}function It({src:e,poster:t,alt:n,children:r,controls:i,preload:a=`metadata`,...o}){let s=I(null),[c,l]=L(!1);return P(()=>{let e=s.current;if(!e)return;let t=new IntersectionObserver(([e])=>{e.isIntersecting&&(l(!0),t.disconnect())},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[]),z(`div`,{ref:s,className:`my-6 overflow-hidden rounded-lg border border-border-subtle`,children:c?B(`video`,{className:`block w-full h-auto`,src:e,poster:t,controls:!0,preload:a,playsInline:!0,...o,children:[r,`Your browser does not support the video tag.`]}):z(`div`,{className:`aspect-video bg-bg-surface animate-pulse`,role:`img`,"aria-label":n||`Video`})})}const Lt=G(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold tracking-tight`,{variants:{variant:{default:`bg-bg-surface text-text-muted border-border-subtle`,primary:`bg-primary-500/15 text-primary-400 border-primary-500/20`,success:`bg-emerald-500/15 text-emerald-400 border-emerald-500/20`,warning:`bg-amber-500/15 text-amber-400 border-amber-500/20`,danger:`bg-red-500/15 text-red-400 border-red-500/20`,info:`bg-sky-500/15 text-sky-400 border-sky-500/20`}},defaultVariants:{variant:`default`}});function Rt({variant:e=`default`,children:t,className:n=``,...r}){return z(`span`,{className:k(Lt({variant:e}),n),...r,children:t})}const zt=G(`grid gap-4 my-6`,{variants:{cols:{1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,4:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-4`}},defaultVariants:{cols:3}});function Bt({cols:e=3,children:t,className:n=``,...r}){return z(`div`,{className:k(zt({cols:e}),n),...r,children:t})}function Vt({title:e,icon:t,href:n,children:r,className:i=``,...a}){let o=I(null),s=I(null),c=N(e=>{let t=o.current||s.current;if(!t)return;let{left:n,top:r}=t.getBoundingClientRect();t.style.setProperty(`--x`,`${e.clientX-n}px`),t.style.setProperty(`--y`,`${e.clientY-r}px`)},[]),l=B(R,{children:[z(`div`,{className:`pointer-events-none absolute -inset-px rounded-xl opacity-0 transition-opacity duration-300 group-hover:opacity-100`,style:{background:`radial-gradient(400px circle at var(--x) var(--y), color-mix(in oklch, var(--color-primary-500), transparent 90%), transparent 80%)`}}),t&&z(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-primary-500/10 text-primary-400 text-lg transition-transform duration-300 group-hover:scale-105 group-hover:-rotate-3`,children:t}),B(`div`,{className:`space-y-1.5`,children:[e&&z(`h3`,{className:`text-sm font-bold text-text-main`,children:e}),r&&z(`div`,{className:`text-sm text-text-muted leading-relaxed`,children:r})]})]}),u=k(`group relative block rounded-xl border border-border-subtle bg-bg-surface p-5 outline-none overflow-hidden`,`transition-all duration-200 hover:border-primary-500/40 hover:shadow-lg hover:shadow-primary-500/5`,`focus-visible:ring-2 focus-visible:ring-primary-500/30`,i);return n?z(V.Link,{ref:s,href:n,className:k(u,`no-underline cursor-pointer`),onMouseMove:c,...a,children:l}):z(`div`,{ref:o,role:`presentation`,className:u,onMouseMove:c,...a,children:l})}const Ht={note:z(Ae,{size:18}),tip:z(Je,{size:18}),info:z(Ke,{size:18}),warning:z(Oe,{size:18}),danger:z($e,{size:18}),important:z(Ue,{size:18}),caution:z(nt,{size:18})},Ut=G(`py-4 px-4 rounded-lg flex items-center gap-3 border-[1px] flex-row`,{variants:{type:{note:`border-primary-200 dark:border-primary-800 bg-primary-500/5 text-primary-400`,tip:`border-emerald-200 dark:border-emerald-800 bg-emerald-500/5 text-emerald-500`,info:`border-sky-200 dark:border-sky-800 bg-sky-500/5 text-sky-500`,warning:`border-amber-200 dark:border-amber-800 bg-amber-500/5 text-amber-500`,danger:`border-red-200 dark:border-red-800/70 bg-red-500/5 text-red-500`,important:`border-orange-200 dark:border-orange-800/70 bg-orange-500/5 text-orange-500`,caution:`border-yellow-200 dark:border-yellow-800/70 bg-yellow-500/5 text-yellow-500`}},defaultVariants:{type:`note`}});function J({type:e=`note`,title:t,children:n,className:r=``,...i}){return B(`div`,{className:k(Ut({type:e}),r),role:e===`warning`||e===`danger`?`alert`:`note`,...i,children:[Ht[e],z(`div`,{className:`text-sm text-text-muted leading-relaxed [&>p]:m-0 [&>p]:mb-2 [&>p:last-child]:mb-0`,children:n})]})}const Wt=e=>z(J,{type:`note`,...e}),Gt=e=>z(J,{type:`tip`,...e}),Kt=e=>z(J,{type:`warning`,...e}),qt=e=>z(J,{type:`danger`,...e}),Jt=e=>z(J,{type:`info`,...e}),Yt=e=>z(J,{type:`important`,...e}),Xt=e=>z(J,{type:`caution`,...e}),Zt=G(`my-6 transition-all duration-200`,{variants:{variant:{default:`list-disc pl-5 text-text-muted marker:text-primary-500/50`,number:`list-decimal pl-5 text-text-muted marker:text-primary-500/50 marker:font-bold`,checked:`list-none p-0`,arrow:`list-none p-0`,bubble:`list-none p-0`},cols:{1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,4:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-4`},isGrid:{true:`grid gap-x-8 gap-y-3`,false:`space-y-2`},dense:{true:`space-y-1`,false:`space-y-2`}},compoundVariants:[{variant:`default`,dense:!0,className:`space-y-0.5`}],defaultVariants:{variant:`default`,cols:1,isGrid:!1,dense:!1}}),Qt=G(`group flex items-start gap-3 text-sm leading-relaxed transition-all duration-200`,{variants:{variant:{default:``,number:``,checked:`hover:translate-x-0.5`,arrow:`hover:translate-x-0.5`,bubble:`hover:translate-x-0.5`},dense:{true:`py-0`,false:`py-0.5`}},defaultVariants:{variant:`default`,dense:!1}}),$t=G(`mt-1 shrink-0 flex items-center justify-center transition-transform group-hover:scale-110`,{variants:{variant:{bubble:`h-5 w-5 rounded-full bg-primary-500/10 text-primary-500 text-[10px] font-bold`,default:``}},defaultVariants:{variant:`default`}});function en({icon:e,children:t,variant:n,dense:r}){return B(`li`,{className:k(Qt({variant:n,dense:r})),children:[e&&z(`span`,{className:k($t({variant:n===`bubble`?`bubble`:`default`})),children:e}),z(`div`,{className:`flex-1 text-text-muted group-hover:text-text-main transition-colors`,children:t})]})}const tn={checked:e=>z(je,{size:14,className:k(`text-emerald-500 shrink-0`,e)}),arrow:e=>z(U,{size:14,className:k(`text-primary-400 shrink-0`,e)}),bubble:e=>z(Ie,{size:6,fill:`currentColor`,className:k(`text-primary-500 shrink-0`,e)}),default:()=>null,number:()=>null};function nn({variant:e=`default`,cols:t=1,dense:n=!1,children:r,className:i,...a}){let o=t!==void 0&&Number(t)>1,s=tn[e],c=Zt({variant:e,cols:t,dense:n,isGrid:o,className:i});return e===`default`||e===`number`?z(e===`number`?`ol`:`ul`,{className:c,...a,children:r}):z(`ul`,{className:c,...a,children:j.map(r,t=>{if(!M(t))return t;let r=t,i=r.type===`li`?r.props.children:r.props.children||t;return z(en,{icon:s(),variant:e,dense:n,children:i})})})}const rn={ts:a,tsx:l,js:oe,jsx:l,json:e,css:r,html:h,md:x,mdx:x,bash:f,sh:f,yaml:s,yml:s},an={CODE:/\.(ts|tsx|js|jsx|json|mjs|cjs|astro|vue|svelte)$/i,TEXT:/\.(md|mdx|txt)$/i,IMAGE:/\.(png|jpg|jpeg|svg|gif)$/i};function on(e){return typeof e==`string`?e:typeof e==`number`?e.toString():Array.isArray(e)?e.map(on).join(``):M(e)&&e.props&&typeof e.props==`object`&&`children`in e.props?on(e.props.children):``}function sn(e,t){let n=e.toLowerCase(),r=`shrink-0 transition-colors duration-200`;if(t)return z(We,{size:16,strokeWidth:2,className:k(r,`text-primary-400`),fill:`currentColor`,fillOpacity:.15});let i=rn[n.split(`.`).pop()||``];if(i)return z(i,{size:16});let a=k(r,`text-text-dim group-hover:text-text-main`);return an.CODE.test(n)?z(Be,{size:16,strokeWidth:2,className:a}):an.TEXT.test(n)?z(He,{size:16,strokeWidth:2,className:a}):an.IMAGE.test(n)?z(Ve,{size:16,strokeWidth:2,className:a}):z(ze,{size:16,strokeWidth:2,className:a})}function cn(e,t){if(!M(e))return!1;let n=e.type;if(typeof n==`string`)return n===t;if(typeof n==`function`)return n.name===t||n.name?.toLowerCase()===t;let r=e.props;return r?.originalType===t||r?.mdxType===t}function ln(e){let t=e.match(/\s+(\/\/|#)\s+(.*)$/);return t?{name:e.slice(0,t.index).trim(),comment:t[2]}:{name:e.trim()}}function Y(e,t=`root`){if(!M(e))return[];let n=[];if(cn(e,`ul`))return j.forEach(e.props.children,(e,r)=>{n.push(...Y(e,`${t}-${r}`))}),n;if(cn(e,`li`)){let r=j.toArray(e.props.children),i=r.findIndex(e=>cn(e,`ul`)),a=i!==-1,o=a?r.slice(0,i):r,s=a?r.slice(i):[],{name:c,comment:l}=ln(on(o)),u=c.endsWith(`/`),d=u?c.slice(0,-1):c,f=a||u;return n.push({id:`${t}-${d}`,name:d,comment:l,isFolder:f,children:a?Y(s[0],`${t}-${d}`):void 0}),n}return e.props&&typeof e.props==`object`&&`children`in e.props&&j.forEach(e.props.children,(e,r)=>{n.push(...Y(e,`${t}-${r}`))}),n}function un({item:e}){return B(V.TreeItem,{id:e.id,textValue:e.name,className:`outline-none group focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-md`,children:[z(V.TreeItemContent,{children:({isExpanded:t,hasChildItems:n})=>B(`div`,{className:`flex items-center gap-2 py-1 px-1.5 rounded-md transition-colors hover:bg-primary-500/5 cursor-pointer`,children:[z(`div`,{style:{width:`calc((var(--tree-item-level) - 1) * 1rem)`},className:`shrink-0`}),n?z(V.Button,{slot:`chevron`,className:`outline-none text-text-dim hover:text-primary-400 p-0.5 rounded transition-colors`,children:z(U,{size:14,strokeWidth:3,className:k(`transition-transform duration-200`,t&&`rotate-90`)})}):z(`div`,{className:`w-[18px]`}),sn(e.name,e.isFolder),z(`span`,{className:k(`text-sm transition-colors truncate select-none`,e.isFolder?`font-semibold text-text-main`:`text-text-muted group-hover:text-text-main`),children:e.name}),e.comment&&B(`span`,{className:`ml-2 text-xs italic text-text-dim opacity-70 group-hover:opacity-100 transition-opacity whitespace-nowrap overflow-hidden text-ellipsis font-sans`,children:[`//`,` `,e.comment]})]})}),e.children&&z(V.Collection,{items:e.children,children:e=>z(un,{item:e})})]})}function dn({children:e}){let t=F(()=>Y(e),[e]);return z(`div`,{className:`my-8`,children:z(V.Tree,{items:t,"aria-label":`File Tree`,className:k(`rounded-xl border border-border-subtle bg-bg-surface/50 p-4 font-mono text-sm shadow-sm backdrop-blur-sm outline-none`,`max-h-[500px] overflow-y-auto scrollbar-thin scrollbar-thumb-border-subtle`,`focus-visible:ring-2 focus-visible:ring-primary-500/20`),children:e=>z(un,{item:e})})})}function fn({data:e,sortable:t=!1,paginated:n=!1,pageSize:r=10}){let[i,a]=L(null),[o,s]=L(1),c=F(()=>{if(!e)return[];let n=[...e];return t&&i!==null&&n.sort((e,t)=>{let n=e[i.key],r=t[i.key],a=typeof n==`string`?n:``,o=typeof r==`string`?r:``;return a<o?i.direction===`asc`?-1:1:a>o?i.direction===`asc`?1:-1:0}),n},[e,i,t]);return{sortConfig:i,currentPage:o,setCurrentPage:s,totalPages:Math.ceil(c.length/r),paginatedData:F(()=>{if(!n)return c;let e=(o-1)*r;return c.slice(e,e+r)},[c,n,o,r]),requestSort:e=>{if(!t)return;let n=`asc`;i&&i.key===e&&i.direction===`asc`&&(n=`desc`),a({key:e,direction:n})}}}function pn({headers:e,data:t,children:n,className:r=``,sortable:i=!1,paginated:a=!1,pageSize:o=10}){let{sortConfig:s,currentPage:c,setCurrentPage:l,totalPages:u,paginatedData:d,requestSort:f}=fn({data:t,sortable:i,paginated:a,pageSize:o}),p=e=>i?s?.key===e?s.direction===`asc`?z(Ne,{size:14,className:`ml-1 text-primary-400`}):z(H,{size:14,className:`ml-1 text-primary-400`}):z(H,{size:14,className:`ml-1 opacity-30`}):null,m=n||B(R,{children:[e&&z(`thead`,{children:z(`tr`,{children:e.map((e,t)=>z(`th`,{onClick:()=>f(t),className:k(`text-left px-3 py-2.5 border-b-2 border-border-subtle text-text-main font-semibold text-sm`,i&&`cursor-pointer select-none hover:text-primary-400 transition-colors`),children:B(`div`,{className:`flex items-center`,children:[e,p(t)]})},t))})}),d&&z(`tbody`,{children:d.map((e,t)=>z(`tr`,{className:`transition-colors hover:bg-bg-surface`,children:e.map((e,t)=>z(`td`,{className:`px-3 py-2 border-b border-border-subtle text-sm text-text-muted`,children:e},t))},t))})]});return B(`div`,{className:k(`my-6 rounded-lg border border-border-subtle overflow-hidden`,r),children:[z(`div`,{className:`overflow-x-auto`,children:z(`table`,{className:`w-full border-collapse text-sm`,children:m})}),a&&u>1&&B(`div`,{className:`flex items-center justify-between border-t border-border-subtle px-4 py-3`,children:[B(`span`,{className:`text-xs text-text-muted`,children:[`Page `,c,` of `,u]}),B(`div`,{className:`flex items-center gap-1`,children:[z(V.Button,{onPress:()=>l(1),isDisabled:c===1,className:`grid place-items-center h-7 w-7 rounded-md text-text-muted outline-none transition-colors hover:bg-bg-surface disabled:opacity-30 disabled:pointer-events-none cursor-pointer`,children:z(Pe,{size:16})}),z(V.Button,{onPress:()=>l(e=>Math.max(e-1,1)),isDisabled:c===1,className:`grid place-items-center h-7 w-7 rounded-md text-text-muted outline-none transition-colors hover:bg-bg-surface disabled:opacity-30 disabled:pointer-events-none cursor-pointer`,children:z(Me,{size:16})}),z(V.Button,{onPress:()=>l(e=>Math.min(e+1,u)),isDisabled:c===u,className:`grid place-items-center h-7 w-7 rounded-md text-text-muted outline-none transition-colors hover:bg-bg-surface disabled:opacity-30 disabled:pointer-events-none cursor-pointer`,children:z(U,{size:16})}),z(V.Button,{onPress:()=>l(u),isDisabled:c===u,className:`grid place-items-center h-7 w-7 rounded-md text-text-muted outline-none transition-colors hover:bg-bg-surface disabled:opacity-30 disabled:pointer-events-none cursor-pointer`,children:z(Fe,{size:16})})]})]})]})}function mn({name:e,type:t,defaultValue:n,required:r=!1,children:i,id:a,className:o=``}){return B(`article`,{className:k(`group relative my-6 rounded-xl border border-border-subtle bg-bg-surface p-5 transition-all duration-300`,o),id:a,children:[B(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4`,children:[B(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[z(`code`,{className:`inline-flex items-center rounded-md bg-primary-500/10 px-2.5 py-1 font-mono text-sm font-bold text-primary-400 border border-primary-500/20 shadow-sm transition-colors`,children:e}),t&&z(`span`,{className:`rounded-md bg-bg-muted/80 border border-border-subtle px-2 py-0.5 text-[11px] font-semibold text-text-muted uppercase shadow-sm`,children:t}),r&&B(`div`,{className:`flex items-center gap-1.5 rounded-full bg-red-500/10 px-2.5 py-0.5 text-[10px] font-bold uppercase text-red-400 border border-red-500/20 shadow-sm`,children:[z(`span`,{className:`h-1 w-1 rounded-full bg-red-400 animate-pulse`}),`Required`]})]}),n&&B(`div`,{className:`flex items-center gap-2 text-[11px] text-text-muted bg-bg-muted/30 px-2.5 py-1 rounded-md border border-border-subtle/50`,children:[z(`span`,{className:`font-semibold opacity-60 uppercase tracking-tighter`,children:`Default`}),z(`code`,{className:`font-mono text-text-main font-medium`,children:n})]})]}),z(`div`,{className:`text-sm text-text-muted leading-relaxed [&>p]:m-0 selection:bg-primary-500/30`,children:i})]})}function hn({to:e,children:t,className:n=``,...r}){let i=e&&(e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`//`));return z(O,{href:e,className:k(`text-blue-600 hover:text-blue-800 hover:underline cursor-pointer`,n),target:i?`_blank`:void 0,rel:i?`noopener noreferrer`:void 0,...r,children:t})}function gn({src:e,alt:t,theme:n,...r}){let{theme:i}=K();return n&&n!==i?null:z(`img`,{src:e,alt:t||``,...r})}function _n({title:e,props:t,className:n=``}){return B(`div`,{className:k(`my-6`,n),children:[e&&z(`h3`,{className:`text-base font-bold text-text-main mb-3`,children:e}),z(`div`,{className:`overflow-x-auto rounded-lg border border-border-subtle`,children:B(`table`,{className:`w-full border-collapse text-sm`,children:[z(`thead`,{children:B(`tr`,{children:[z(`th`,{className:`text-left px-4 py-3 border-b-2 border-border-subtle text-xs font-bold uppercase tracking-wider text-text-muted`,children:`Property`}),z(`th`,{className:`text-left px-4 py-3 border-b-2 border-border-subtle text-xs font-bold uppercase tracking-wider text-text-muted`,children:`Type`}),z(`th`,{className:`text-left px-4 py-3 border-b-2 border-border-subtle text-xs font-bold uppercase tracking-wider text-text-muted`,children:`Default`}),z(`th`,{className:`text-left px-4 py-3 border-b-2 border-border-subtle text-xs font-bold uppercase tracking-wider text-text-muted`,children:`Description`})]})}),z(`tbody`,{children:t.map((e,t)=>B(`tr`,{className:`transition-colors hover:bg-bg-surface`,children:[B(`td`,{className:`px-4 py-2.5 border-b border-border-subtle`,children:[z(`code`,{className:`rounded bg-bg-surface px-1.5 py-0.5 font-mono text-xs font-bold text-primary-400`,children:e.name}),e.required&&z(`span`,{className:`ml-1 text-red-400 font-bold`,children:`*`})]}),z(`td`,{className:`px-4 py-2.5 border-b border-border-subtle`,children:z(`code`,{className:`rounded bg-bg-muted px-1.5 py-0.5 font-mono text-xs text-text-muted`,children:e.type})}),z(`td`,{className:`px-4 py-2.5 border-b border-border-subtle`,children:e.defaultValue?z(`code`,{className:`rounded bg-bg-muted px-1.5 py-0.5 font-mono text-xs text-primary-400`,children:e.defaultValue}):z(`span`,{className:`text-text-dim`,children:`—`})}),z(`td`,{className:`px-4 py-2.5 border-b border-border-subtle text-text-muted`,children:e.description})]},`${e.name}-${t}`))})]})})]})}function vn(e){let{code:t,children:n,preview:r}=e;return{initialCode:F(()=>(t??(typeof n==`string`?n:``)).trim(),[t,n]),previewElement:F(()=>r??(typeof n==`string`?null:n),[r,n])}}function yn(e){let{highlightedHtml:t,hideCode:n=!1,hideCopy:r=!1}=e,{initialCode:i,previewElement:a}=vn(e);return B(`div`,{className:`my-6 overflow-hidden rounded-xl border border-border-subtle`,children:[z(`div`,{className:`flex items-center justify-center p-8 bg-bg-surface`,children:a}),!n&&z(`div`,{className:`border-t border-border-subtle`,children:z(q,{hideCopy:r,lang:`tsx`,highlightedHtml:t,plain:!0,children:i})})]})}const bn=e=>{let[t,n]=L(!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 xn({content:e,mdxRaw:t,config:n}){let r=t||e||``,{copied:i,handleCopy:a,handleOpenRaw:o}=bn(r),s=n!==!1,l=typeof n==`object`&&n.text||`Copy Markdown`;return!s||!r?null:z(`div`,{className:`relative inline-flex z-100 flex-shrink-0 w-max translate-y-0 active:translate-y-px transition-transform duration-200`,children:B(v,{className:`rounded-xl border border-border-subtle bg-bg-surface/40 backdrop-blur-md transition-all duration-300 hover:border-primary-500/50 hover:shadow-lg hover:shadow-primary-500/5 group overflow-hidden`,children:[z(c,{variant:`ghost`,onPress:a,icon:z(i?je:W,{size:16}),iconPosition:`left`,className:k(`px-5 py-2 bg-transparent text-[0.8125rem] font-semibold h-9 border-none shrink-0`,`text-text-main transition-all duration-300 hover:bg-primary-500/5`,i&&`text-emerald-500 hover:bg-emerald-500/5`),children:i?`Copied!`:l}),B(T.Trigger,{placement:`bottom end`,children:[z(c,{variant:`ghost`,isIconOnly:!0,icon:z(H,{size:14}),className:k(`px-3.5 h-9 border-l border-border-subtle/50 text-text-muted rounded-none bg-transparent shrink-0`,`transition-all duration-300 hover:bg-primary-500/5 hover:text-primary-500`)}),B(T.Root,{className:`w-52`,children:[B(T.Item,{onAction:a,children:[z(W,{size:16,className:`size-4 mt-0.5 text-text-muted group-hover:text-primary-500`}),z(`span`,{className:`font-medium text-[0.8125rem]`,children:`Copy Markdown`})]}),B(T.Item,{onAction:o,children:[z(Re,{size:16,className:`size-4 mt-0.5 text-text-muted group-hover:text-primary-500`}),z(`span`,{className:`font-medium text-[0.8125rem]`,children:`View as Markdown`})]})]})]})]})})}var Sn=ot({Admonition:()=>J,Badge:()=>Rt,Button:()=>xt,Card:()=>Vt,Cards:()=>Bt,Caution:()=>Xt,CodeBlock:()=>q,ComponentPreview:()=>yn,ComponentProps:()=>_n,CopyMarkdown:()=>xn,Danger:()=>qt,Field:()=>mn,FileTree:()=>dn,Image:()=>gn,Important:()=>Yt,InfoBox:()=>Jt,Link:()=>hn,List:()=>nn,Note:()=>Wt,Tab:()=>Pt,Table:()=>pn,Tabs:()=>Ft,Tip:()=>Gt,Video:()=>It,Warning:()=>Kt});function Cn(){return z(`div`,{className:k(`w-full h-full relative overflow-y-auto transition-opacity duration-300 animate-fade-in`),children:B(`div`,{className:`mx-auto max-w-(--spacing-content-max) px-4 py-8 space-y-10`,children:[B(`div`,{className:`flex gap-2`,children:[z(C,{className:`h-3 w-16`}),z(C,{className:`h-3 w-24`})]}),z(C,{className:`h-10 w-[60%] sm:h-12`}),B(`div`,{className:`space-y-3`,children:[z(C,{className:`h-4 w-full`}),z(C,{className:`h-4 w-[95%]`}),z(C,{className:`h-4 w-[40%]`})]}),B(`div`,{className:`space-y-6 pt-4`,children:[z(C,{className:`h-7 w-32`}),B(`div`,{className:`space-y-3`,children:[z(C,{className:`h-4 w-full`}),z(C,{className:`h-4 w-[98%]`}),z(C,{className:`h-4 w-[92%]`}),z(C,{className:`h-4 w-[60%]`})]})]}),z(C,{className:`h-32 w-full rounded-lg bg-bg-muted/50`}),B(`div`,{className:`space-y-6 pt-4`,children:[z(C,{className:`h-7 w-48`}),B(`div`,{className:`space-y-3`,children:[z(C,{className:`h-4 w-full`}),z(C,{className:`h-4 w-[85%]`})]})]})]})})}const X=({level:e,id:t,children:n,...r})=>B(`h${e}`,{id:t,...r,className:`boltdocs-heading`,children:[n,t&&z(`a`,{href:`#${t}`,className:`header-anchor`,"aria-label":`Anchor`,children:z(Ye,{size:16})})]}),wn={...Sn,Loading:Cn,h1:e=>z(X,{level:1,...e}),h2:e=>z(X,{level:2,...e}),h3:e=>z(X,{level:3,...e}),h4:e=>z(X,{level:4,...e}),h5:e=>z(X,{level:5,...e}),h6:e=>z(X,{level:6,...e}),pre:e=>z(q,{...e,children:e.children})};function Tn({config:e}){let{currentLocale:t}=g();return P(()=>{if(!e.i18n||typeof document>`u`)return;let n=t||e.i18n.defaultLocale,r=e.i18n.localeConfigs?.[n];document.documentElement.lang=r?.htmlLang||n||`en`,document.documentElement.dir=r?.direction||`ltr`},[t,e.i18n]),null}function En({config:e}){let t=A(),{setLocale:n,setVersion:r,currentLocale:i,currentVersion:a}=g();return P(()=>{let o=t.pathname.split(`/`).filter(Boolean),s=0,c=e.versions?.defaultVersion,l=e.i18n?.defaultLocale;if(o[s]===`docs`&&s++,e.versions&&o.length>s){let t=e.versions.versions.find(e=>e.path===o[s]);t&&(c=t.path,s++)}e.i18n&&o.length>s&&e.i18n.locales[o[s]]?l=o[s]:e.i18n&&o.length===0&&(l=i||e.i18n.defaultLocale),l!==i&&n(l||``),c!==a&&r(c??``)},[t.pathname,e,n,r,i,a]),null}function Dn({config:e,routes:r,components:i={}}){let a=F(()=>({...wn,...rt,...i}),[i]),s=he();return z(Ee,{children:z(o,{children:z(yt,{children:z(ft,{components:a,children:z(t.Provider,{value:e,children:z(n,{routes:r,children:B(we,{navigate:s,children:[z(bt,{}),z(En,{config:e}),z(Tn,{config:e}),z(pe,{})]})})})})})})})}function On(){return z(`div`,{className:`flex items-center justify-center min-h-[60vh] text-center`,children:B(`div`,{className:`space-y-4`,children:[z(`span`,{className:`text-8xl font-black tracking-tighter text-primary-500/20`,children:`404`}),z(`h1`,{className:`text-2xl font-bold text-text-main`,children:`Page Not Found`}),z(`p`,{className:`text-sm text-text-muted max-w-sm mx-auto`,children:`The page you're looking for doesn't exist or has been moved.`}),B(O,{href:`/`,className:`inline-flex items-center gap-2 rounded-lg bg-primary-500 px-5 py-2.5 text-sm font-semibold text-white outline-none transition-all hover:brightness-110 hover:shadow-lg focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:[z(ke,{size:16}),` Go to Home`]})]})})}function kn(e,t){let n=t.replace(/\\/g,`/`);return Object.keys(e).find(e=>e.endsWith(`/${n}`)||e.endsWith(n))}function An(e){let{routesData:t,config:n,mdxModules:r,Layout:i,homePage:a,externalPages:o,externalLayout:s,components:c}=e,l=s||i,u=e=>{let t=n.base||`/`;return e.startsWith(t)?e:`${t===`/`?``:t.replace(/\/$/,``)}${e.startsWith(`/`)?e:`/${e}`}`||`/`},d=[...t.map(e=>{let t=kn(r,e.filePath),n=t?r[t]?.default:null,i=u(e.path===``?`/`:e.path);return{path:i,element:z(mt,{MDXComponent:n,mdxComponents:c}),loader:async()=>({path:i,frontmatter:{title:e.title,description:e.description||``},headings:e.headings||[],filePath:e.filePath,locale:e.locale,version:e.version,group:e.group,groupTitle:e.groupTitle}),getStaticPaths:()=>[i]}})];if(a){let e=[u(`/`)];n.i18n&&Object.keys(n.i18n.locales).forEach(t=>{e.push(u(`/${t}`))}),e.forEach(e=>{d.find(t=>t.path===e)||d.push({path:e,element:z(l,{children:z(a,{})}),getStaticPaths:()=>[e]})})}return o&&Object.entries(o).forEach(([e,t])=>{let r=u(e);d.find(e=>e.path===r)||(d.push({path:r,element:z(l,{children:z(t,{})}),getStaticPaths:()=>[r]}),n.i18n&&Object.keys(n.i18n.locales).forEach(n=>{let r=u(`/${n}${e===`/`?``:e}`);d.find(e=>e.path===r)||d.push({path:r,element:z(l,{children:z(t,{})}),getStaticPaths:()=>[r]})}))}),d.push({path:`*`,element:z(l,{children:z(On,{})})}),[{element:z(Dn,{config:n,routes:[...t],components:c}),children:d}]}function Z(e,t){return e?typeof e==`string`?e:t&&e[t]?e[t]:Object.values(e)[0]||``:``}function jn(){let e=_(),{theme:t,resolvedTheme:n}=K(),r=A(),{currentLocale:i}=m(),a=e.theme||{},o=Z(a.title,i)||`Boltdocs`,s=a.navbar||[],c=a.socialLinks||[],l=a.githubRepo,u=s.map(t=>{let n=t.href||t.to||t.link||``;return{label:Z(t.label||t.text,i),href:n,active:(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)})(n),to:n.startsWith(`http`)||n.startsWith(`//`)?`external`:void 0}}),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 Mn(e){let t=_(),n=A(),r=e=>e.endsWith(`/`)&&e.length>1?e.slice(0,-1):e,i=r(n.pathname),a=e.find(e=>r(e.path)===i),o=a?.tab?.toLowerCase(),s=o?e.filter(e=>!e.tab||e.tab.toLowerCase()===o):e,c=[],l=new Map;for(let e of s)e.group?(l.has(e.group)||l.set(e.group,{slug:e.group,title:e.groupTitle||e.group,routes:[],icon:e.groupIcon}),l.get(e.group).routes.push(e)):c.push(e);return{groups:Array.from(l.values()).map(e=>{let t=new Map,n=new Map;for(let r of e.routes)r.subRouteGroup&&((r.path.endsWith(`/${r.subRouteGroup}`)||r.path.endsWith(`/${r.subRouteGroup}/`))&&!t.has(r.subRouteGroup)?t.set(r.subRouteGroup,r):(n.has(r.subRouteGroup)||n.set(r.subRouteGroup,[]),n.get(r.subRouteGroup).push(r)));let r=[],i=new Set;for(let a of e.routes)if(a.subRouteGroup){if(!i.has(a.subRouteGroup)){i.add(a.subRouteGroup);let e=t.get(a.subRouteGroup),o=n.get(a.subRouteGroup)||[];e?r.push({...e,subRoutes:o}):r.push(...o)}}else r.push(a);return{...e,routes:r}}),ungrouped:c,activeRoute:a,activePath:i,config:t}}function Nn(e=[]){let[t,n]=L(null);return{headings:e,activeId:t,setActiveId:n}}function Pn(e=[],t=[]){let n=A(),r=I([]),[i,a]=L({opacity:0,transform:`translateX(0) scaleX(0)`,width:0}),o=e=>e.endsWith(`/`)&&e.length>1?e.slice(0,-1):e,s=o(n.pathname),c=t.find(e=>o(e.path)===s)?.tab?.toLowerCase(),l=e.findIndex(e=>e.id.toLowerCase()===c),u=l===-1?0:l;return P(()=>{let e=r.current[u];e&&a({opacity:1,width:e.offsetWidth,transform:`translateX(${e.offsetLeft}px)`})},[u,e.length,n.pathname]),{tabs:e,activeIndex:u,indicatorStyle:i,tabRefs:r,activeTabId:c}}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 Fn(){let e=he(),t=m(),{allRoutes:n,currentRoute:r,currentVersion:i,currentLocale:a,config:o}=t,s=o.versions,{setVersion:c}=g(),l=t=>{if(!s||t===i)return;c(t);let o=`/docs/${t}`;if(r){let e=Q(r.filePath,r.version,r.locale),i=n.find(n=>Q(n.filePath,n.version,n.locale)===e&&(n.version||s.defaultVersion)===t&&(a?n.locale===a:!n.locale));if(i)o=i.path;else{let e=n.find(e=>Q(e.filePath,e.version,e.locale)===`index.md`&&(e.version||s.defaultVersion)===t&&(a?e.locale===a:!e.locale));o=e?e.path:`/docs/${t}${a?`/${a}`:``}`}}e(o)},u=t.availableVersions.map(e=>({...e,label:e.label,value:e.key}));return{currentVersion:i,currentVersionLabel:t.currentVersionLabel,availableVersions:u,handleVersionChange:l}}function In(){let e=he(),{allRoutes:t,currentRoute:n,currentLocale:r,config:i}=m(),a=i.i18n,{setLocale:o}=g();return{currentLocale:r,currentLocaleLabel:i.i18n?.localeConfigs?.[r]?.label||i.i18n?.locales[r]||r,availableLocales:i.i18n?Object.entries(i.i18n.locales).map(([e,t])=>({key:e,label:i.i18n?.localeConfigs?.[e]?.label||t,value:e,isCurrent:e===r})):[],handleLocaleChange:i=>{if(!a||i===r)return;o(i);let s=`/`;if(n){let e=Q(n.filePath,n.version,n.locale),r=t.find(t=>Q(t.filePath,t.version,t.locale)===e&&(t.locale||a.defaultLocale)===i&&t.version===n.version);if(r)s=r.path;else{let e=t.find(e=>Q(e.filePath,e.version,e.locale)===`index.md`&&(e.locale||a.defaultLocale)===i&&e.version===n.version);s=e?e.path:i===a.defaultLocale?n.version?`/${n.version}`:`/`:n.version?`/${n.version}/${i}`:`/${i}`}}else{let e=t.find(e=>(e.filePath===`index.mdx`||e.filePath===`index.md`)&&(e.locale||a.defaultLocale)===i&&!e.version);s=e?e.path:i===a.defaultLocale?`/`:`/${i}`}e(s)}}}function Ln(){let{routes:e,currentRoute:t}=m(),n=A();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}}function Rn(){let{currentRoute:e}=m(),t=[];return e&&(e.groupTitle&&t.push({label:e.groupTitle}),t.push({label:e.title,href:e.path})),{crumbs:t,activeRoute:e}}const zn=()=>A();function Bn({children:e,className:t,style:n}){return z(`div`,{className:k(`h-screen flex flex-col overflow-hidden bg-bg-main text-text-main`,t),style:n,children:e})}function Vn({children:e,className:t,style:n}){return z(`div`,{className:k(`mx-auto flex flex-1 w-full max-w-(--breakpoint-3xl) bg-bg-main overflow-hidden`,t),style:n,children:e})}function Hn({children:e,className:t,style:n}){return z(`main`,{className:k(`boltdocs-content flex-1 min-w-0 overflow-y-auto`,`contain-layout`,t),style:n,children:e})}function Un({children:e,className:t,style:n}){let{pathname:r}=zn();return z(`div`,{className:k(`boltdocs-page mx-auto pt-4 pb-20 px-4 sm:px-8`,{"max-w-content-max":r.includes(`/docs/`)},t),style:n,children:e})}function Wn({children:e,className:t,style:n}){return z(`div`,{className:k(`flex items-center justify-between mb-10`,t),style:n,children:e})}function Gn({children:e,className:t,style:n}){return z(`div`,{className:k(`mt-20`,t),style:n,children:e})}const $=Object.assign(Bn,{Body:Vn,Content:Hn,ContentMdx:Un,ContentHeader:Wn,ContentFooter:Gn});function Kn(){let{theme:e,setTheme:t}=K(),[n,r]=L(!1);if(P(()=>{r(!0)},[]),!n)return z(`div`,{className:`h-9 w-9`});let i=e===`system`?Xe:e===`dark`?Ze:et;return B(T.Trigger,{placement:`bottom right`,children:[z(Ce,{className:`flex h-9 w-9 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-bg-surface hover:text-text-main outline-none focus-visible:ring-2 focus-visible:ring-primary-500`,"aria-label":`Selection theme`,children:z(i,{size:20,className:`animate-in fade-in zoom-in duration-300`})}),B(T.Root,{selectionMode:`single`,selectedKeys:[e],onSelectionChange:e=>{let n=Array.from(e)[0];t(n)},children:[B(T.Item,{id:`light`,children:[z(et,{size:16}),z(`span`,{children:`Light`})]}),B(T.Item,{id:`dark`,children:[z(Ze,{size:16}),z(`span`,{children:`Dark`})]}),B(T.Item,{id:`system`,children:[z(Xe,{size:16}),z(`span`,{children:`System`})]})]})]})}async function qn(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`:Jn(i.stargazers_count)}const Jn=e=>Intl.NumberFormat(`en`,{notation:`compact`,compactDisplay:`short`}).format(e);function Yn({repo:e}){let[t,n]=L(null);return P(()=>{e&&qn(e).then(e=>n(e)).catch(()=>n(`0`))},[e]),B(`a`,{href:`https://github.com/${e}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-2 rounded-md border border-border-subtle bg-bg-surface px-2.5 py-1.5 text-xs font-medium text-text-muted transition-all hover:bg-bg-main hover:border-border-strong hover:text-text-main`,children:[z(d,{className:`h-4 w-4`}),t&&z(`span`,{className:`tabular-nums`,children:t})]})}function Xn({tabs:e,routes:t}){let{currentLocale:n}=m(),{indicatorStyle:r,tabRefs:i,activeIndex:a}=Pn(e,t),o=e=>{if(!e)return null;if(e.trim().startsWith(`<svg`))return z(`span`,{className:`h-4 w-4`,dangerouslySetInnerHTML:{__html:e}});let t=De[e];return t?z(t,{size:16}):z(`img`,{src:e,alt:``,className:`h-4 w-4 object-contain`})};return z(`div`,{className:`mx-auto max-w-(--breakpoint-3xl) px-4 md:px-6`,children:B(te.List,{className:`border-none py-0`,children:[e.map((e,r)=>{let s=r===a,c=t.find(t=>t.tab&&t.tab.toLowerCase()===e.id.toLowerCase());return B(O,{href:c?c.path:`#`,ref:e=>{i.current[r]=e},className:`relative flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors outline-none ${s?`text-primary-500`:`text-text-muted hover:text-text-main`}`,children:[o(e.icon),z(`span`,{children:Z(e.text,n)})]},e.id)}),z(te.Indicator,{style:r})]})})}const Zn=be(()=>import(`../search-dialog-3lvKsbVG.js`).then(e=>({default:e.SearchDialog})));function Qn(){let{links:e,title:t,logo:n,logoProps:r,github:i,social:a,config:o}=jn(),{routes:s,allRoutes:c,currentVersion:l,currentLocale:u}=m(),{pathname:d}=A(),f=o.theme||{},p=d.startsWith(`/docs`),h=f?.tabs&&f.tabs.length>0;return B(D.Root,{className:h?`border-b-0`:``,children:[B(D.Content,{children:[B(D.Left,{children:[n&&z(D.Logo,{src:n,alt:r?.alt||t,width:r?.width??24,height:r?.height??24}),z(D.Title,{children:t}),o.versions&&l&&z(er,{})]}),z(D.Center,{children:z(ve,{fallback:z(`div`,{className:`h-9 w-32 animate-pulse rounded-md bg-bg-surface`}),children:z(Zn,{routes:s||[]})})}),B(D.Right,{children:[z(D.Links,{children:e.map(e=>z($n,{link:e},e.href))}),o.i18n&&u&&z(tr,{}),z(D.Split,{}),z(Kn,{}),i&&z(Yn,{repo:f?.githubRepo??``}),a.length>0&&z(D.Split,{}),z(`div`,{className:`flex items-center gap-1`,children:a.map(({icon:e,link:t})=>z(D.Socials,{icon:e,link:t,className:`p-1.5`},t))})]})]}),p&&h&&f?.tabs&&z(`div`,{className:`w-full border-b border-border-subtle bg-bg-main`,children:z(Xn,{tabs:f.tabs,routes:c||s||[]})})]})}function $n({link:e}){let t=fe(e.href||``);return z(D.Link,{...e,href:t})}function er(){let{currentVersionLabel:e,availableVersions:t,handleVersionChange:n}=Fn();return t.length===0?null:B(T.Trigger,{children:[z(c,{variant:`outline`,size:`sm`,rounded:`lg`,iconPosition:`right`,icon:z(H,{className:`w-3.5 h-3.5 text-text-muted/60`}),className:`h-8 border-border-subtle/60 bg-bg-surface/30 backdrop-blur-sm transition-all duration-200 hover:border-primary-500/50 hover:bg-primary-500/5`,children:z(`span`,{className:`font-semibold text-[0.8125rem]`,children:e})}),z(T.Root,{children:z(T.Section,{items:t,children:e=>z(T.Item,{onPress:()=>n(e.value),children:e.label},`${e.value??``}`)})})]})}function tr(){let{currentLocale:e,availableLocales:t,handleLocaleChange:n}=In();return t.length===0?null:B(T.Trigger,{children:[z(c,{variant:`outline`,size:`sm`,rounded:`lg`,iconPosition:`right`,icon:z(H,{className:`w-3.5 h-3.5 text-text-muted/60`}),className:`h-8 border-border-subtle/60 bg-bg-surface/30 backdrop-blur-sm transition-all duration-200 hover:border-primary-500/50 hover:bg-primary-500/5 px-2.5`,children:B(`div`,{className:`flex items-center gap-1.5`,children:[z(qe,{className:`w-3.5 h-3.5 text-primary-500`}),z(`span`,{className:`font-bold text-[0.75rem] uppercase opacity-90`,children:e||`en`})]})}),z(T.Root,{children:z(T.Section,{items:t,children:e=>z(T.Item,{onPress:()=>n(e.value),children:B(`div`,{className:`flex items-center justify-between w-full gap-4`,children:[z(`span`,{children:e.label}),z(`span`,{className:`text-[10px] font-bold opacity-40 uppercase tracking-tighter`,children:e.value})]})},`${e.value??``}`)})})]})}function nr(){return z(`div`,{className:`flex items-center justify-center mt-10 mb-4 px-4 w-full`,children:B(`a`,{href:`https://github.com/jesusalcaladev/boltdocs`,target:`_blank`,rel:`noopener noreferrer`,className:`group relative flex items-center gap-2 px-4 py-2 rounded-full border border-border-subtle bg-bg-surface/50 backdrop-blur-md transition-all duration-300 hover:border-primary-500/50 hover:bg-bg-surface hover:shadow-xl hover:shadow-primary-500/5 select-none`,children:[z(nt,{className:`w-3.5 h-3.5 text-text-muted group-hover:text-primary-500 transition-colors duration-300`,fill:`currentColor`}),B(`span`,{className:`text-[11px] font-medium text-text-muted group-hover:text-text-main transition-colors duration-300 tracking-wide`,children:[`Powered by`,` `,z(`strong`,{className:`font-bold text-text-main/80 group-hover:text-text-main`,children:`Boltdocs`})]})]})})}function rr(e){if(!e)return;let t={...De,...it};return t[e]||t[e+`Icon`]||void 0}function ir({route:e,activePath:t,getIcon:n}){let r=t===(e.path.endsWith(`/`)?e.path.slice(0,-1):e.path),i=F(()=>e.subRoutes?.some(e=>e.path===t),[e.subRoutes,t]),[a,o]=L(i||r);return P(()=>{(i||r)&&o(!0)},[i,r]),z(E.SubGroup,{label:e.title,href:e.path,active:r,icon:n(e.icon),badge:e.badge,isOpen:a,onToggle:()=>o(!a),children:e.subRoutes?.map(e=>{let r=t===(e.path.endsWith(`/`)?e.path.slice(0,-1):e.path);return z(E.Link,{label:e.title,href:e.path,active:r,icon:n(e.icon),badge:e.badge},e.path)})})}function ar({group:e,activePath:t,getIcon:n}){return z(E.Group,{title:e.title,icon:n(e.icon),children:e.routes.map(e=>{if(e.subRoutes&&e.subRoutes.length>0)return z(ir,{route:e,activePath:t,getIcon:n},e.path);let r=t===(e.path.endsWith(`/`)?e.path.slice(0,-1):e.path);return z(E.Link,{label:e.title,href:e.path,active:r,icon:n(e.icon),badge:e.badge},e.path)})})}function or({routes:e,config:t}){let{groups:n,ungrouped:r,activePath:i}=Mn(e),a=t.theme||{};return B(E.Root,{children:[r.length>0&&z(E.Group,{className:`mb-6`,children:r.map(e=>{let t=i===(e.path.endsWith(`/`)?e.path.slice(0,-1):e.path);return z(E.Link,{label:e.title,href:e.path,active:t,icon:rr(e.icon),badge:e.badge},e.path)})}),n.map(e=>z(ar,{group:e,activePath:i,getIcon:rr},e.slug)),a?.poweredBy&&z(`div`,{className:`mt-auto pt-8`,children:z(nr,{})})]})}function sr({headings:e=[],editLink:t,communityHelp:n,filePath:r}){let{headings:i}=Nn(e),a=F(()=>i.map(e=>({title:e.text,url:`#${e.id}`,depth:e.level})),[i]);return i.length===0?null:z(ue,{toc:a,children:z(cr,{headings:i,editLink:t,communityHelp:n,filePath:r})})}function cr({headings:e,editLink:t,communityHelp:n,filePath:r}){let i=ce(),[a,o]=L({opacity:0}),s=I(null),c=I(null);P(()=>{if(!i||!s.current)return;let e=s.current.querySelector(`a[href="#${i}"]`);e&&o({transform:`translateY(${e.offsetTop}px)`,height:`${e.offsetHeight}px`,opacity:1})},[i]);let l=N((e,t)=>{e.preventDefault();let n=document.getElementById(t);n&&(n.scrollIntoView({behavior:`smooth`}),window.history.pushState(null,``,`#${t}`))},[]);return B(b.Root,{children:[B(b.Header,{className:`flex flex-row gap-x-2`,children:[z(tt,{size:16}),`On this page`]}),z(ne,{containerRef:c,children:B(b.Content,{className:`max-h-[450px] boltdocs-otp-scroll-area`,ref:c,children:[z(b.Indicator,{style:a}),z(`ul`,{className:`relative space-y-2 border-l border-border-subtle`,ref:s,children:e.map(e=>z(b.Item,{level:e.level,children:z(b.Link,{href:`#${e.id}`,active:i===e.id,onClick:t=>l(t,e.id),className:`pl-4`,children:e.text})},e.id))})]})}),(t||n)&&B(`div`,{className:`mt-8 pt-8 border-t border-border-subtle space-y-4`,children:[z(`p`,{className:`text-xs font-bold uppercase text-text-main`,children:`Need help?`}),B(`ul`,{className:`space-y-3`,children:[t&&r&&z(`li`,{children:B(`a`,{href:t.replace(`:path`,r),target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-sm text-text-muted hover:text-text-main transition-colors`,children:[z(Qe,{size:16}),`Edit this page`]})}),n&&z(`li`,{children:B(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-sm text-text-muted hover:text-text-main transition-colors`,children:[z(Le,{size:16}),`Community help`]})})]})]})]})}function lr({siteTitle:e,siteDescription:t,routes:n}){let r=A(),i=_(),a=n?.find?.(e=>e.path===r.pathname),o=a?.title,s=a?.description||t||``,c=o?`${o} | ${e}`:e,l=a?.seo||{},u=i?.seo?.metatags||{},d=i?.seo?.thumbnails?.background,f=l[`og:image`]||d;return B(Te,{children:[z(`title`,{children:c}),z(`meta`,{name:`description`,content:s}),z(`meta`,{property:`og:title`,content:c}),z(`meta`,{property:`og:description`,content:s}),z(`meta`,{property:`og:type`,content:`article`}),typeof window<`u`&&z(`meta`,{property:`og:url`,content:window.location.href}),typeof window<`u`&&z(`link`,{rel:`canonical`,href:window.location.origin+r.pathname}),z(`meta`,{name:`twitter:card`,content:`summary`}),z(`meta`,{name:`twitter:title`,content:c}),z(`meta`,{name:`twitter:description`,content:s}),f&&z(`meta`,{name:`twitter:image`,content:f}),f&&z(`meta`,{property:`og:image`,content:f}),z(`meta`,{name:`generator`,content:`Boltdocs`}),Object.entries(u).map(([e,t])=>e.startsWith(`og:`)||e.startsWith(`music:`)||e.startsWith(`video:`)||e.startsWith(`article:`)||e.startsWith(`book:`)||e.startsWith(`profile:`)?z(`meta`,{property:e,content:t},e):z(`meta`,{name:e,content:t},e)),Object.entries(l).map(([e,t])=>e===`noindex`&&t===!0?z(`meta`,{name:`robots`,content:`noindex`},`noindex`):e===`robots`?z(`meta`,{name:`robots`,content:t},`robots`):e===`canonical`?z(`link`,{rel:`canonical`,href:t},`canonical`):e.startsWith(`og:`)||e.startsWith(`music:`)||e.startsWith(`video:`)||e.startsWith(`article:`)||e.startsWith(`book:`)||e.startsWith(`profile:`)?z(`meta`,{property:e,content:t},e):z(`meta`,{name:e,content:t},e))]})}function ur(){let{crumbs:e,activeRoute:t}=Rn(),n=_().theme||{};return e.length===0||!n?.breadcrumbs?null:B(w.Root,{children:[z(w.Item,{children:z(w.Link,{href:`/`,children:z(Ge,{size:14})})}),e.map((e,n)=>B(w.Item,{children:[z(w.Separator,{}),z(w.Link,{href:e.href,className:k({"font-medium text-text-main":e.href===t?.path}),children:e.label})]},`crumb-${e.href}-${e.label}-${n}`))]})}function dr(){let{prevPage:e,nextPage:t}=Ln();return!e&&!t?null:B(S.Root,{className:`animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[e?B(S.Link,{to:e.path,direction:`prev`,children:[z(S.Title,{children:`Previous`}),z(S.Description,{children:e.title})]}):z(`div`,{}),t&&B(S.Link,{to:t.path,direction:`next`,children:[z(S.Title,{children:`Next`}),z(S.Description,{children:t.title})]})]})}var fr=class extends _e{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`Uncaught error in Boltdocs Layout:`,e,t)}render(){return this.state.hasError?this.props.fallback||B(`div`,{className:`flex flex-col items-center justify-center min-h-[40vh] text-center gap-4 px-4`,children:[z(`div`,{className:`text-lg font-bold text-red-400`,children:`Something went wrong`}),z(`p`,{className:`text-sm text-text-muted max-w-md`,children:this.state.error?.message||`An unexpected error occurred while rendering this page.`}),z(c,{className:`rounded-lg border border-border-subtle bg-bg-surface px-5 py-2 text-sm font-medium text-text-main transition-colors hover:bg-bg-muted cursor-pointer`,onPress:()=>this.setState({hasError:!1}),children:`Try again`})]}):this.props.children}};function pr({children:e}){let{routes:t,allRoutes:n,currentRoute:r,currentLocale:i}=m(),{pathname:a}=A(),o=_(),s=dt().CopyMarkdown||xn,c=a.startsWith(`/docs`);return B($,{children:[z(lr,{siteTitle:Z(o.theme?.title,i)||`Boltdocs`,siteDescription:Z(o.theme?.description,i)||``,routes:n}),z(Qn,{}),B($.Body,{children:[c&&z(or,{routes:t,config:o}),z($.Content,{children:B($.ContentMdx,{children:[c&&B($.ContentHeader,{children:[z(ur,{}),z(s,{mdxRaw:r?._rawContent,route:r,config:o.theme?.copyMarkdown})]}),z(fr,{children:e}),c&&z($.ContentFooter,{children:z(dr,{})})]})}),c&&z(sr,{headings:r?.headings,editLink:o.theme?.editLink,communityHelp:o.theme?.communityHelp,filePath:r?.filePath})]})]})}export{J as Admonition,ue as AnchorProvider,Rt as Badge,Dn as BoltdocsShell,ur as Breadcrumbs,xt as Button,v as ButtonGroup,Vt as Card,Bt as Cards,Xt as Caution,q as CodeBlock,yn as ComponentPreview,_n as ComponentProps,xn as CopyMarkdown,qt as Danger,pr as DefaultLayout,$ as DocsLayout,fr as ErrorBoundary,mn as Field,dn as FileTree,lr as Head,gn as Image,Yt as Important,Jt as InfoBox,hn as Link,nn as List,Cn as Loading,mt as MdxPage,Qn as Navbar,On as NotFound,Wt as Note,sr as OnThisPage,dr as PageNav,w as PrimitiveBreadcrumbs,c as PrimitiveButton,O as PrimitiveLink,T as PrimitiveMenu,y as PrimitiveNavLink,D as PrimitiveNavbar,ee as PrimitiveNavigationMenu,b as PrimitiveOnThisPage,S as PrimitivePageNav,ae as PrimitivePopover,E as PrimitiveSidebar,C as PrimitiveSkeleton,te as PrimitiveTabs,de as PrimitiveTooltip,ne as ScrollProvider,re as SearchDialogPrimitive,or as Sidebar,Pt as Tab,pn as Table,Ft as Tabs,Gt as Tip,It as Video,Kt as Warning,k as cn,An as createRoutes,st as defineConfig,ce as useActiveAnchor,se as useActiveAnchors,Rn as useBreadcrumbs,_ as useConfig,In as useI18n,ie as useItems,fe as useLocalizedTo,zn as useLocation,dt as useMdxComponents,jn as useNavbar,Nn as useOnThisPage,Ln as usePageNav,m as useRoutes,le as useSearch,Mn as useSidebar,Pn as useTabs,K as useTheme,Fn as useVersion};
6
+ import{A as e,B as t,C as n,D as r,E as i,F as a,H as o,I as s,L as c,M as l,N as u,O as d,P as f,R as p,S as m,T as h,U as g,V as _,_ as ee,a as v,b as y,c as b,d as x,f as te,g as ne,h as re,i as ie,j as S,k as ae,l as C,m as oe,n as w,o as T,p as se,r as E,s as D,t as ce,u as le,v as O,w as ue,x as de,y as k,z as A}from"../use-search-C9bxCqfF.js";import{Outlet as fe,useLoaderData as pe,useLocation as j,useNavigate as me}from"react-router-dom";import he from"virtual:boltdocs-layout";import{Children as M,Component as ge,Suspense as _e,createContext as ve,isValidElement as N,lazy as ye,use as be,useCallback as P,useEffect as F,useLayoutEffect as xe,useMemo as I,useRef as L,useState as R}from"react";import{Fragment as z,jsx as B,jsxs as V}from"react/jsx-runtime";import*as H from"react-aria-components";import{Button as U,RouterProvider as Se}from"react-aria-components";import{Helmet as Ce,HelmetProvider as we}from"react-helmet-async";import*as Te from"lucide-react";import{AlertTriangle as Ee,ArrowLeft as De,Bookmark as Oe,Check as W,ChevronDown as G,ChevronLeft as ke,ChevronRight as Ae,ChevronUp as je,ChevronsLeft as Me,ChevronsRight as Ne,Circle as Pe,CircleHelp as Fe,Copy as Ie,ExternalLink as Le,File as Re,FileCode as ze,FileImage as Be,FileText as Ve,Flame as He,Folder as Ue,Home as We,Info as Ge,Languages as Ke,Lightbulb as qe,Link as Je,Monitor as Ye,Moon as Xe,Pencil as Ze,ShieldAlert as Qe,Sun as $e,TextAlignStart as et,Zap as tt}from"lucide-react";import{cva as K}from"class-variance-authority";import nt from"virtual:boltdocs-mdx-components";import rt from"virtual:boltdocs-icons";var it=Object.defineProperty,at=(e,t)=>{let n={};for(var r in e)it(n,r,{get:e[r],enumerable:!0});return t||it(n,Symbol.toStringTag,{value:`Module`}),n};const ot=Symbol.for(`__BDOCS_MDX_COMPONENTS_CONTEXT__`),st=Symbol.for(`__BDOCS_MDX_COMPONENTS_INSTANCE__`),ct=globalThis[ot]||(globalThis[ot]=ve({}));function lt(){let e=be(ct);return(!e||Object.keys(e).length===0)&&globalThis[st]?globalThis[st]:e}function ut({components:e,children:t}){return typeof globalThis<`u`&&(globalThis[st]=e),B(ct.Provider,{value:e,children:t})}function dt({route:e,content:t,mdxComponents:n}){let r=lt(),i=I(()=>({...r,...n}),[r,n]);return t?B(he,{route:e,children:B(t,{components:i})}):null}function ft({MDXComponent:e,mdxComponents:t}){let n=pe(),r=e||n?.MDXComponent,i=t||n?.mdxComponents;return r?B(dt,{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},content:r,mdxComponents:i}):null}const pt=Symbol.for(`__BDOCS_THEME_CONTEXT__`),mt=Symbol.for(`__BDOCS_THEME_INSTANCE__`),ht=`boltdocs-theme-change`,gt=globalThis[pt]||(globalThis[pt]=ve(void 0));function _t({children:e}){let[t,n]=R(`system`),[r,i]=R(`dark`),a=e=>{let t=window.matchMedia(`(prefers-color-scheme: dark)`),n=e===`dark`||e===`system`&&t.matches,r=window.document.documentElement;r.classList.toggle(`dark`,n),r.dataset.theme=n?`dark`:`light`,i(n?`dark`:`light`)};F(()=>{let e=localStorage.getItem(`boltdocs-theme`);e?(n(e),a(e)):a(`system`);let t=window.matchMedia(`(prefers-color-scheme: dark)`),r=()=>{(localStorage.getItem(`boltdocs-theme`)||`system`)===`system`&&a(`system`)};return t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[]);let o={theme:t,resolvedTheme:r,setTheme:e=>{n(e),localStorage.setItem(`boltdocs-theme`,e),a(e),typeof window<`u`&&window.dispatchEvent(new CustomEvent(ht,{detail:e}))}};return typeof globalThis<`u`&&(globalThis[mt]=o),B(gt.Provider,{value:o,children:e})}function q(){let e=be(gt),[,t]=R({});if(F(()=>{if(e)return;let n=()=>t({});return window.addEventListener(ht,n),()=>window.removeEventListener(ht,n)},[e]),!e&&typeof globalThis<`u`&&globalThis[mt])return globalThis[mt];if(e===void 0)throw Error(`useTheme must be used within a ThemeProvider`);return e}function vt(){let{pathname:e,hash:t}=j();return xe(()=>{let e=document.querySelector(`.boltdocs-content`)||window,n=()=>e===window?window.scrollY:e.scrollTop,r=(t,n=`auto`)=>{e===window?window.scrollTo({top:t,behavior:n}):e.scrollTo({top:t,behavior:n})};if(t){let i=t.replace(`#`,``),a=document.getElementById(i);if(a){let t=e===window?0:e.getBoundingClientRect().top;r(a.getBoundingClientRect().top-t-80+n(),`smooth`);return}}r(0)},[e,t]),null}const yt=({className:e,variant:t,size:n,rounded:r,iconSize:i,disabled:a,...o})=>B(c,{className:A(`group`,p({variant:t,size:n,rounded:r,iconSize:i,disabled:a,className:e})),...o}),bt=(e,t)=>{if(e==null||typeof e==`boolean`)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(e=>bt(e,t)).join(``);if(N(e)){let n=t?.get(e.type);return n?n(e.props):bt(e.props.children,t)}return``},xt=async e=>{try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);return t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),!0}};function St(e){let{title:t}=e,[n,r]=R(!1),[i,a]=R(!1),[o,s]=R(!1),c=L(null);_();let l=P(async()=>{xt(c.current?.textContent??``),r(!0),setTimeout(()=>r(!1),2e3)},[]);return F(()=>{s((c.current?.textContent?.length??0)>120)},[e.children,e.highlightedHtml]),{copied:n,isExpanded:i,setIsExpanded:a,isExpandable:o,preRef:c,handleCopy:l,shouldTruncate:o&&!i}}const Ct=({children:e,className:t,plain:n=!1,...r})=>B(`div`,{className:A(`not-prose boltdocs-code-block`,`group relative overflow-hidden bg-(--color-code-bg)`,`contain-layout contain-paint`,{"my-6 rounded-lg border border-border-subtle":!n},t),...r,children:e}),wt=({children:e,className:t,...n})=>B(`div`,{className:A(`flex h-9 items-center justify-between px-4 py-1.5`,`border-b border-border-subtle bg-bg-surface/50`,`text-[13px] font-medium text-text-muted`,t),...n,children:e}),Tt=({children:e,className:t,...n})=>B(`div`,{className:A(`flex items-center space-x-2`,t),...n,children:e}),Et=({className:e,children:t,shouldTruncate:n=!1,...r})=>B(`div`,{className:A(`relative`,{"[&>pre]:max-h-62.5 [&>pre]:overflow-hidden":n},e),...r,children:t}),Dt={ts:a,tsx:l,js:ae,jsx:l,json:e,css:r,html:h,md:S,mdx:S,bash:f,sh:f,yaml:s,yml:s,rs:u,rust:u,toml:i},Ot=({copied:e,handleCopy:t})=>B(ue,{content:e?`Copied!`:`Copy code`,children:B(U,{onPress:t,className:A(`grid place-items-center size-8 bg-transparent outline-none cursor-pointer transition-all duration-200 hover:scale-110 active:scale-95 [&>svg]:size-4 [&>svg]:stroke-2`,e?`text-emerald-400`:`text-text-muted hover:text-text-main`),"aria-label":`Copy code`,children:B(e?W:Ie,{size:20})})});function J(e){let{children:t,hideCopy:n=!1,highlightedHtml:r,"data-highlighted-html":i,title:a,"data-title":o,"data-lang":s,plain:c=!1,...l}=e,u=r||i,d=a||o,f=e.lang||s||``,{copied:p,isExpanded:m,setIsExpanded:h,isExpandable:g,preRef:_,handleCopy:ee,shouldTruncate:v}=St(e),y=Dt[f];return V(Ct,{plain:c,className:e.className,children:[(d||!n)&&V(wt,{children:[B(Tt,{children:d&&V(z,{children:[y?B(y,{size:14}):B(Re,{size:14,className:`opacity-60`}),B(`span`,{children:d})]})}),!n&&B(Ot,{copied:p,handleCopy:ee})]}),V(Et,{shouldTruncate:v,children:[u?B(`div`,{ref:_,className:`shiki-wrapper [&>pre]:m-0! [&>pre]:rounded-none! [&>pre]:border-none! [&>pre]:bg-inherit! [&>pre>code]:grid! [&>pre>code]:p-5! [&>.shiki.shiki-themes]:bg-transparent!`,dangerouslySetInnerHTML:{__html:u}}):B(`pre`,{ref:_,className:`m-0! p-5! rounded-none! border-none! bg-inherit! font-mono text-[0.8125rem] leading-[1.7] overflow-x-auto`,...l,children:bt(t)}),g&&B(`div`,{className:A(v?`absolute bottom-0 inset-x-0 h-24 bg-linear-to-t from-(--color-code-bg) to-transparent flex items-end justify-center pb-4 z-10`:`relative flex justify-center py-4`),children:B(U,{onPress:()=>h(!m),className:`rounded-full bg-bg-surface border border-border-subtle px-5 py-2 text-[0.8125rem] font-medium text-text-main outline-none cursor-pointer transition-all hover:bg-border-subtle hover:-translate-y-px backdrop-blur-md`,children:m?`Show less`:`Expand code`})})]})]})}function kt({initialIndex:e=0,tabs:t}){let n=t[e]?.props.disabled?t.findIndex(e=>!e.props.disabled):e,[r,i]=R(n===-1?0:n),a=L([]),[o,s]=R({opacity:0,transform:`translateX(0)`,width:0});return F(()=>{let e=a.current[r];e&&s({opacity:1,width:e.offsetWidth,transform:`translateX(${e.offsetLeft}px)`})},[r,t]),{active:r,setActive:i,tabRefs:a,indicatorStyle:o,handleKeyDown:P(e=>{let n=0;if(e.key===`ArrowRight`?n=1:e.key===`ArrowLeft`&&(n=-1),n!==0){let e=(r+n+t.length)%t.length;for(;t[e].props.disabled&&e!==r;)e=(e+n+t.length)%t.length;e!==r&&!t[e].props.disabled&&(i(e),a.current[e]?.focus())}},[r,t])}}const At=K(`relative flex items-center border-b border-border-subtle gap-1 overflow-x-auto no-scrollbar`,{variants:{size:{default:`px-0`,compact:`px-2`}},defaultVariants:{size:`default`}}),jt=K(`flex items-center gap-2 px-4 py-2.5 text-sm font-medium outline-none transition-all duration-200 cursor-pointer bg-transparent border-none select-none whitespace-nowrap`,{variants:{isActive:{true:`text-primary-500`,false:`text-text-muted hover:text-text-main`},isDisabled:{true:`opacity-40 pointer-events-none`,false:``}},defaultVariants:{isActive:!1,isDisabled:!1}});function Mt({children:e}){return B(`div`,{className:`py-4`,children:typeof e==`string`?B(J,{className:`language-bash`,children:B(`code`,{children:e.trim()})}):e})}function Nt({defaultIndex:e=0,children:t}){let n=I(()=>M.toArray(t).filter(e=>N(e)&&e.props?.label),[t]),{active:r,setActive:i,tabRefs:a,indicatorStyle:o}=kt({initialIndex:e,tabs:n});return B(`div`,{className:`my-8 w-full group/tabs`,children:V(H.Tabs,{selectedKey:r.toString(),onSelectionChange:e=>i(Number(e)),className:`w-full`,children:[V(H.TabList,{"aria-label":`Content Tabs`,className:A(At()),children:[n.map((e,t)=>{let{label:n,icon:r,disabled:i}=e.props,o=t.toString();return V(H.Tab,{id:o,isDisabled:i,ref:e=>{a.current[t]=e},className:({isSelected:e,isDisabled:t})=>A(jt({isActive:e,isDisabled:t})),children:[!!r&&B(`span`,{className:`shrink-0 [&>svg]:w-4 [&>svg]:h-4`,children:r}),B(`span`,{children:n})]},o)}),B(`div`,{className:`absolute bottom-0 h-0.5 bg-primary-500 transition-all duration-300 ease-in-out pointer-events-none`,style:o,"aria-hidden":`true`})]}),n.map((e,t)=>B(H.TabPanel,{id:t.toString(),children:n[t]},t))]})})}function Pt({src:e,poster:t,alt:n,children:r,controls:i,preload:a=`metadata`,...o}){let s=L(null),[c,l]=R(!1);return F(()=>{let e=s.current;if(!e)return;let t=new IntersectionObserver(([e])=>{e.isIntersecting&&(l(!0),t.disconnect())},{rootMargin:`200px`});return t.observe(e),()=>t.disconnect()},[]),B(`div`,{ref:s,className:`my-6 overflow-hidden rounded-lg border border-border-subtle`,children:c?V(`video`,{className:`block w-full h-auto`,src:e,poster:t,controls:!0,preload:a,playsInline:!0,...o,children:[r,`Your browser does not support the video tag.`]}):B(`div`,{className:`aspect-video bg-bg-surface animate-pulse`,role:`img`,"aria-label":n||`Video`})})}const Ft=K(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold tracking-tight`,{variants:{variant:{default:`bg-bg-surface text-text-muted border-border-subtle`,primary:`bg-primary-500/15 text-primary-400 border-primary-500/20`,success:`bg-emerald-500/15 text-emerald-400 border-emerald-500/20`,warning:`bg-amber-500/15 text-amber-400 border-amber-500/20`,danger:`bg-red-500/15 text-red-400 border-red-500/20`,info:`bg-sky-500/15 text-sky-400 border-sky-500/20`}},defaultVariants:{variant:`default`}});function It({variant:e=`default`,children:t,className:n=``,...r}){return B(`span`,{className:A(Ft({variant:e}),n),...r,children:t})}const Lt=K(`grid gap-4 my-6`,{variants:{cols:{1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,4:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-4`}},defaultVariants:{cols:3}});function Rt({cols:e=3,children:t,className:n=``,...r}){return B(`div`,{className:A(Lt({cols:e}),n),...r,children:t})}function zt({title:e,icon:t,href:n,children:r,className:i=``,...a}){let o=L(null),s=L(null),c=P(e=>{let t=o.current||s.current;if(!t)return;let{left:n,top:r}=t.getBoundingClientRect();t.style.setProperty(`--x`,`${e.clientX-n}px`),t.style.setProperty(`--y`,`${e.clientY-r}px`)},[]),l=V(z,{children:[B(`div`,{className:`pointer-events-none absolute -inset-px rounded-xl opacity-0 transition-opacity duration-300 group-hover:opacity-100`,style:{background:`radial-gradient(400px circle at var(--x) var(--y), color-mix(in oklch, var(--color-primary-500), transparent 90%), transparent 80%)`}}),t&&B(`div`,{className:`mb-3 flex h-10 w-10 items-center justify-center rounded-lg bg-primary-500/10 text-primary-400 text-lg transition-transform duration-300 group-hover:scale-105 group-hover:-rotate-3`,children:t}),V(`div`,{className:`space-y-1.5`,children:[e&&B(`h3`,{className:`text-sm font-bold text-text-main`,children:e}),r&&B(`div`,{className:`text-sm text-text-muted leading-relaxed`,children:r})]})]}),u=A(`group relative block rounded-xl border border-border-subtle bg-bg-surface p-5 outline-none overflow-hidden`,`transition-all duration-200 hover:border-primary-500/40 hover:shadow-lg hover:shadow-primary-500/5`,`focus-visible:ring-2 focus-visible:ring-primary-500/30`,i);return n?B(H.Link,{ref:s,href:n,className:A(u,`no-underline cursor-pointer`),onMouseMove:c,...a,children:l}):B(`div`,{ref:o,role:`presentation`,className:u,onMouseMove:c,...a,children:l})}const Bt={note:B(Oe,{size:18}),tip:B(qe,{size:18}),info:B(Ge,{size:18}),warning:B(Ee,{size:18}),danger:B(Qe,{size:18}),important:B(He,{size:18}),caution:B(tt,{size:18})},Vt=K(`py-4 px-4 rounded-lg flex items-center gap-3 border-[1px] flex-row`,{variants:{type:{note:`border-primary-200 dark:border-primary-800 bg-primary-500/5 text-primary-400`,tip:`border-emerald-200 dark:border-emerald-800 bg-emerald-500/5 text-emerald-500`,info:`border-sky-200 dark:border-sky-800 bg-sky-500/5 text-sky-500`,warning:`border-amber-200 dark:border-amber-800 bg-amber-500/5 text-amber-500`,danger:`border-red-200 dark:border-red-800/70 bg-red-500/5 text-red-500`,important:`border-orange-200 dark:border-orange-800/70 bg-orange-500/5 text-orange-500`,caution:`border-yellow-200 dark:border-yellow-800/70 bg-yellow-500/5 text-yellow-500`}},defaultVariants:{type:`note`}});function Y({type:e=`note`,title:t,children:n,className:r=``,...i}){return V(`div`,{className:A(Vt({type:e}),r),role:e===`warning`||e===`danger`?`alert`:`note`,...i,children:[Bt[e],B(`div`,{className:`text-sm text-text-muted leading-relaxed [&>p]:m-0 [&>p]:mb-2 [&>p:last-child]:mb-0`,children:n})]})}const Ht=e=>B(Y,{type:`note`,...e}),Ut=e=>B(Y,{type:`tip`,...e}),Wt=e=>B(Y,{type:`warning`,...e}),Gt=e=>B(Y,{type:`danger`,...e}),Kt=e=>B(Y,{type:`info`,...e}),qt=e=>B(Y,{type:`important`,...e}),Jt=e=>B(Y,{type:`caution`,...e}),Yt=K(`my-6 transition-all duration-200`,{variants:{variant:{default:`list-disc pl-5 text-text-muted marker:text-primary-500/50`,number:`list-decimal pl-5 text-text-muted marker:text-primary-500/50 marker:font-bold`,checked:`list-none p-0`,arrow:`list-none p-0`,bubble:`list-none p-0`},cols:{1:`grid-cols-1`,2:`grid-cols-1 sm:grid-cols-2`,3:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-3`,4:`grid-cols-1 sm:grid-cols-2 lg:grid-cols-4`},isGrid:{true:`grid gap-x-8 gap-y-3`,false:`space-y-2`},dense:{true:`space-y-1`,false:`space-y-2`}},compoundVariants:[{variant:`default`,dense:!0,className:`space-y-0.5`}],defaultVariants:{variant:`default`,cols:1,isGrid:!1,dense:!1}}),Xt=K(`group flex items-start gap-3 text-sm leading-relaxed transition-all duration-200`,{variants:{variant:{default:``,number:``,checked:`hover:translate-x-0.5`,arrow:`hover:translate-x-0.5`,bubble:`hover:translate-x-0.5`},dense:{true:`py-0`,false:`py-0.5`}},defaultVariants:{variant:`default`,dense:!1}}),Zt=K(`mt-1 shrink-0 flex items-center justify-center transition-transform group-hover:scale-110`,{variants:{variant:{bubble:`h-5 w-5 rounded-full bg-primary-500/10 text-primary-500 text-[10px] font-bold`,default:``}},defaultVariants:{variant:`default`}});function Qt({icon:e,children:t,variant:n,dense:r}){return V(`li`,{className:A(Xt({variant:n,dense:r})),children:[e&&B(`span`,{className:A(Zt({variant:n===`bubble`?`bubble`:`default`})),children:e}),B(`div`,{className:`flex-1 text-text-muted group-hover:text-text-main transition-colors`,children:t})]})}const $t={checked:e=>B(W,{size:14,className:A(`text-emerald-500 shrink-0`,e)}),arrow:e=>B(Ae,{size:14,className:A(`text-primary-400 shrink-0`,e)}),bubble:e=>B(Pe,{size:6,fill:`currentColor`,className:A(`text-primary-500 shrink-0`,e)}),default:()=>null,number:()=>null};function en({variant:e=`default`,cols:t=1,dense:n=!1,children:r,className:i,...a}){let o=t!==void 0&&Number(t)>1,s=$t[e],c=Yt({variant:e,cols:t,dense:n,isGrid:o,className:i});return e===`default`||e===`number`?B(e===`number`?`ol`:`ul`,{className:c,...a,children:r}):B(`ul`,{className:c,...a,children:M.map(r,t=>{if(!N(t))return t;let r=t,i=r.type===`li`?r.props.children:r.props.children||t;return B(Qt,{icon:s(),variant:e,dense:n,children:i})})})}const tn={ts:a,tsx:l,js:ae,jsx:l,json:e,css:r,html:h,md:S,mdx:S,bash:f,sh:f,yaml:s,yml:s},nn={CODE:/\.(ts|tsx|js|jsx|json|mjs|cjs|astro|vue|svelte)$/i,TEXT:/\.(md|mdx|txt)$/i,IMAGE:/\.(png|jpg|jpeg|svg|gif)$/i};function rn(e){return typeof e==`string`?e:typeof e==`number`?e.toString():Array.isArray(e)?e.map(rn).join(``):N(e)&&e.props&&typeof e.props==`object`&&`children`in e.props?rn(e.props.children):``}function an(e,t){let n=e.toLowerCase(),r=`shrink-0 transition-colors duration-200`;if(t)return B(Ue,{size:16,strokeWidth:2,className:A(r,`text-primary-400`),fill:`currentColor`,fillOpacity:.15});let i=tn[n.split(`.`).pop()||``];if(i)return B(i,{size:16});let a=A(r,`text-text-dim group-hover:text-text-main`);return nn.CODE.test(n)?B(ze,{size:16,strokeWidth:2,className:a}):nn.TEXT.test(n)?B(Ve,{size:16,strokeWidth:2,className:a}):nn.IMAGE.test(n)?B(Be,{size:16,strokeWidth:2,className:a}):B(Re,{size:16,strokeWidth:2,className:a})}function on(e,t){if(!N(e))return!1;let n=e.type;if(typeof n==`string`)return n===t;if(typeof n==`function`)return n.name===t||n.name?.toLowerCase()===t;let r=e.props;return r?.originalType===t||r?.mdxType===t}function sn(e){let t=e.match(/\s+(\/\/|#)\s+(.*)$/);return t?{name:e.slice(0,t.index).trim(),comment:t[2]}:{name:e.trim()}}function X(e,t=`root`){if(!N(e))return[];let n=[];if(on(e,`ul`))return M.forEach(e.props.children,(e,r)=>{n.push(...X(e,`${t}-${r}`))}),n;if(on(e,`li`)){let r=M.toArray(e.props.children),i=r.findIndex(e=>on(e,`ul`)),a=i!==-1,o=a?r.slice(0,i):r,s=a?r.slice(i):[],{name:c,comment:l}=sn(rn(o)),u=c.endsWith(`/`),d=u?c.slice(0,-1):c,f=a||u;return n.push({id:`${t}-${d}`,name:d,comment:l,isFolder:f,children:a?X(s[0],`${t}-${d}`):void 0}),n}return e.props&&typeof e.props==`object`&&`children`in e.props&&M.forEach(e.props.children,(e,r)=>{n.push(...X(e,`${t}-${r}`))}),n}function cn({item:e}){return V(H.TreeItem,{id:e.id,textValue:e.name,className:`outline-none group focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-md`,children:[B(H.TreeItemContent,{children:({isExpanded:t,hasChildItems:n})=>V(`div`,{className:`flex items-center gap-2 py-1 px-1.5 rounded-md transition-colors hover:bg-primary-500/5 cursor-pointer`,children:[B(`div`,{style:{width:`calc((var(--tree-item-level) - 1) * 1rem)`},className:`shrink-0`}),n?B(H.Button,{slot:`chevron`,className:`outline-none text-text-dim hover:text-primary-400 p-0.5 rounded transition-colors`,children:B(Ae,{size:14,strokeWidth:3,className:A(`transition-transform duration-200`,t&&`rotate-90`)})}):B(`div`,{className:`w-[18px]`}),an(e.name,e.isFolder),B(`span`,{className:A(`text-sm transition-colors truncate select-none`,e.isFolder?`font-semibold text-text-main`:`text-text-muted group-hover:text-text-main`),children:e.name}),e.comment&&V(`span`,{className:`ml-2 text-xs italic text-text-dim opacity-70 group-hover:opacity-100 transition-opacity whitespace-nowrap overflow-hidden text-ellipsis font-sans`,children:[`//`,` `,e.comment]})]})}),e.children&&B(H.Collection,{items:e.children,children:e=>B(cn,{item:e})})]})}function ln({children:e}){let t=I(()=>X(e),[e]);return B(`div`,{className:`my-8`,children:B(H.Tree,{items:t,"aria-label":`File Tree`,className:A(`rounded-xl border border-border-subtle bg-bg-surface/50 p-4 font-mono text-sm shadow-sm backdrop-blur-sm outline-none`,`max-h-[500px] overflow-y-auto scrollbar-thin scrollbar-thumb-border-subtle`,`focus-visible:ring-2 focus-visible:ring-primary-500/20`),children:e=>B(cn,{item:e})})})}function un({data:e,sortable:t=!1,paginated:n=!1,pageSize:r=10}){let[i,a]=R(null),[o,s]=R(1),c=I(()=>{if(!e)return[];let n=[...e];return t&&i!==null&&n.sort((e,t)=>{let n=e[i.key],r=t[i.key],a=typeof n==`string`?n:``,o=typeof r==`string`?r:``;return a<o?i.direction===`asc`?-1:1:a>o?i.direction===`asc`?1:-1:0}),n},[e,i,t]);return{sortConfig:i,currentPage:o,setCurrentPage:s,totalPages:Math.ceil(c.length/r),paginatedData:I(()=>{if(!n)return c;let e=(o-1)*r;return c.slice(e,e+r)},[c,n,o,r]),requestSort:e=>{if(!t)return;let n=`asc`;i&&i.key===e&&i.direction===`asc`&&(n=`desc`),a({key:e,direction:n})}}}function dn({headers:e,data:t,children:n,className:r=``,sortable:i=!1,paginated:a=!1,pageSize:o=10}){let{sortConfig:s,currentPage:c,setCurrentPage:l,totalPages:u,paginatedData:d,requestSort:f}=un({data:t,sortable:i,paginated:a,pageSize:o}),p=e=>i?s?.key===e?s.direction===`asc`?B(je,{size:14,className:`ml-1 text-primary-400`}):B(G,{size:14,className:`ml-1 text-primary-400`}):B(G,{size:14,className:`ml-1 opacity-30`}):null,m=n||V(z,{children:[e&&B(`thead`,{children:B(`tr`,{children:e.map((e,t)=>B(`th`,{onClick:()=>f(t),className:A(`text-left px-3 py-2.5 border-b-2 border-border-subtle text-text-main font-semibold text-sm`,i&&`cursor-pointer select-none hover:text-primary-400 transition-colors`),children:V(`div`,{className:`flex items-center`,children:[e,p(t)]})},t))})}),d&&B(`tbody`,{children:d.map((e,t)=>B(`tr`,{className:`transition-colors hover:bg-bg-surface`,children:e.map((e,t)=>B(`td`,{className:`px-3 py-2 border-b border-border-subtle text-sm text-text-muted`,children:e},t))},t))})]});return V(`div`,{className:A(`my-6 rounded-lg border border-border-subtle overflow-hidden`,r),children:[B(`div`,{className:`overflow-x-auto`,children:B(`table`,{className:`w-full border-collapse text-sm`,children:m})}),a&&u>1&&V(`div`,{className:`flex items-center justify-between border-t border-border-subtle px-4 py-3`,children:[V(`span`,{className:`text-xs text-text-muted`,children:[`Page `,c,` of `,u]}),V(`div`,{className:`flex items-center gap-1`,children:[B(H.Button,{onPress:()=>l(1),isDisabled:c===1,className:`grid place-items-center h-7 w-7 rounded-md text-text-muted outline-none transition-colors hover:bg-bg-surface disabled:opacity-30 disabled:pointer-events-none cursor-pointer`,children:B(Me,{size:16})}),B(H.Button,{onPress:()=>l(e=>Math.max(e-1,1)),isDisabled:c===1,className:`grid place-items-center h-7 w-7 rounded-md text-text-muted outline-none transition-colors hover:bg-bg-surface disabled:opacity-30 disabled:pointer-events-none cursor-pointer`,children:B(ke,{size:16})}),B(H.Button,{onPress:()=>l(e=>Math.min(e+1,u)),isDisabled:c===u,className:`grid place-items-center h-7 w-7 rounded-md text-text-muted outline-none transition-colors hover:bg-bg-surface disabled:opacity-30 disabled:pointer-events-none cursor-pointer`,children:B(Ae,{size:16})}),B(H.Button,{onPress:()=>l(u),isDisabled:c===u,className:`grid place-items-center h-7 w-7 rounded-md text-text-muted outline-none transition-colors hover:bg-bg-surface disabled:opacity-30 disabled:pointer-events-none cursor-pointer`,children:B(Ne,{size:16})})]})]})]})}function fn({name:e,type:t,defaultValue:n,required:r=!1,children:i,id:a,className:o=``}){return V(`article`,{className:A(`group relative my-6 rounded-xl border border-border-subtle bg-bg-surface p-5 transition-all duration-300`,o),id:a,children:[V(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between mb-4`,children:[V(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[B(`code`,{className:`inline-flex items-center rounded-md bg-primary-500/10 px-2.5 py-1 font-mono text-sm font-bold text-primary-400 border border-primary-500/20 shadow-sm transition-colors`,children:e}),t&&B(`span`,{className:`rounded-md bg-bg-muted/80 border border-border-subtle px-2 py-0.5 text-[11px] font-semibold text-text-muted uppercase shadow-sm`,children:t}),r&&V(`div`,{className:`flex items-center gap-1.5 rounded-full bg-red-500/10 px-2.5 py-0.5 text-[10px] font-bold uppercase text-red-400 border border-red-500/20 shadow-sm`,children:[B(`span`,{className:`h-1 w-1 rounded-full bg-red-400 animate-pulse`}),`Required`]})]}),n&&V(`div`,{className:`flex items-center gap-2 text-[11px] text-text-muted bg-bg-muted/30 px-2.5 py-1 rounded-md border border-border-subtle/50`,children:[B(`span`,{className:`font-semibold opacity-60 uppercase tracking-tighter`,children:`Default`}),B(`code`,{className:`font-mono text-text-main font-medium`,children:n})]})]}),B(`div`,{className:`text-sm text-text-muted leading-relaxed [&>p]:m-0 selection:bg-primary-500/30`,children:i})]})}function pn({to:e,children:t,className:n=``,...r}){let i=e&&(e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`//`));return B(k,{href:e,className:A(`text-blue-600 hover:text-blue-800 hover:underline cursor-pointer`,n),target:i?`_blank`:void 0,rel:i?`noopener noreferrer`:void 0,...r,children:t})}function mn({src:e,alt:t,theme:n,...r}){let{theme:i}=q();return n&&n!==i?null:B(`img`,{src:e,alt:t||``,...r})}function hn({title:e,props:t,className:n=``}){return V(`div`,{className:A(`my-6`,n),children:[e&&B(`h3`,{className:`text-base font-bold text-text-main mb-3`,children:e}),B(`div`,{className:`overflow-x-auto rounded-lg border border-border-subtle`,children:V(`table`,{className:`w-full border-collapse text-sm`,children:[B(`thead`,{children:V(`tr`,{children:[B(`th`,{className:`text-left px-4 py-3 border-b-2 border-border-subtle text-xs font-bold uppercase tracking-wider text-text-muted`,children:`Property`}),B(`th`,{className:`text-left px-4 py-3 border-b-2 border-border-subtle text-xs font-bold uppercase tracking-wider text-text-muted`,children:`Type`}),B(`th`,{className:`text-left px-4 py-3 border-b-2 border-border-subtle text-xs font-bold uppercase tracking-wider text-text-muted`,children:`Default`}),B(`th`,{className:`text-left px-4 py-3 border-b-2 border-border-subtle text-xs font-bold uppercase tracking-wider text-text-muted`,children:`Description`})]})}),B(`tbody`,{children:t.map((e,t)=>V(`tr`,{className:`transition-colors hover:bg-bg-surface`,children:[V(`td`,{className:`px-4 py-2.5 border-b border-border-subtle`,children:[B(`code`,{className:`rounded bg-bg-surface px-1.5 py-0.5 font-mono text-xs font-bold text-primary-400`,children:e.name}),e.required&&B(`span`,{className:`ml-1 text-red-400 font-bold`,children:`*`})]}),B(`td`,{className:`px-4 py-2.5 border-b border-border-subtle`,children:B(`code`,{className:`rounded bg-bg-muted px-1.5 py-0.5 font-mono text-xs text-text-muted`,children:e.type})}),B(`td`,{className:`px-4 py-2.5 border-b border-border-subtle`,children:e.defaultValue?B(`code`,{className:`rounded bg-bg-muted px-1.5 py-0.5 font-mono text-xs text-primary-400`,children:e.defaultValue}):B(`span`,{className:`text-text-dim`,children:`—`})}),B(`td`,{className:`px-4 py-2.5 border-b border-border-subtle text-text-muted`,children:e.description})]},`${e.name}-${t}`))})]})})]})}function gn(e){let{code:t,children:n,preview:r}=e;return{initialCode:I(()=>(t??(typeof n==`string`?n:``)).trim(),[t,n]),previewElement:I(()=>r??(typeof n==`string`?null:n),[r,n])}}function _n(e){let{highlightedHtml:t,hideCode:n=!1,hideCopy:r=!1}=e,{initialCode:i,previewElement:a}=gn(e);return V(`div`,{className:`my-6 overflow-hidden rounded-xl border border-border-subtle`,children:[B(`div`,{className:`flex items-center justify-center p-8 bg-bg-surface`,children:a}),!n&&B(`div`,{className:`border-t border-border-subtle`,children:B(J,{hideCopy:r,lang:`tsx`,highlightedHtml:t,plain:!0,children:i})})]})}const vn=e=>{let[t,n]=R(!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 yn({content:e,mdxRaw:t,config:n}){let r=t||e||``,{copied:i,handleCopy:a,handleOpenRaw:o}=vn(r),s=n!==!1,l=typeof n==`object`&&n.text||`Copy Markdown`;return!s||!r?null:B(`div`,{className:`relative inline-flex z-100 flex-shrink-0 w-max translate-y-0 active:translate-y-px transition-transform duration-200`,children:V(v,{className:`rounded-xl border border-border-subtle bg-bg-surface/40 backdrop-blur-md transition-all duration-300 hover:border-primary-500/50 hover:shadow-lg hover:shadow-primary-500/5 group overflow-hidden`,children:[B(c,{variant:`ghost`,onPress:a,icon:B(i?W:Ie,{size:16}),iconPosition:`left`,className:A(`px-5 py-2 bg-transparent text-[0.8125rem] font-semibold h-9 border-none shrink-0`,`text-text-main transition-all duration-300 hover:bg-primary-500/5`,i&&`text-emerald-500 hover:bg-emerald-500/5`),children:i?`Copied!`:l}),V(E.Trigger,{placement:`bottom end`,children:[B(c,{variant:`ghost`,isIconOnly:!0,icon:B(G,{size:14}),className:A(`px-3.5 h-9 border-l border-border-subtle/50 text-text-muted rounded-none bg-transparent shrink-0`,`transition-all duration-300 hover:bg-primary-500/5 hover:text-primary-500`)}),V(E.Root,{className:`w-52`,children:[V(E.Item,{onAction:a,children:[B(Ie,{size:16,className:`size-4 mt-0.5 text-text-muted group-hover:text-primary-500`}),B(`span`,{className:`font-medium text-[0.8125rem]`,children:`Copy Markdown`})]}),V(E.Item,{onAction:o,children:[B(Le,{size:16,className:`size-4 mt-0.5 text-text-muted group-hover:text-primary-500`}),B(`span`,{className:`font-medium text-[0.8125rem]`,children:`View as Markdown`})]})]})]})]})})}var bn=at({Admonition:()=>Y,Badge:()=>It,Button:()=>yt,Card:()=>zt,Cards:()=>Rt,Caution:()=>Jt,CodeBlock:()=>J,ComponentPreview:()=>_n,ComponentProps:()=>hn,CopyMarkdown:()=>yn,Danger:()=>Gt,Field:()=>fn,FileTree:()=>ln,Image:()=>mn,Important:()=>qt,InfoBox:()=>Kt,Link:()=>pn,List:()=>en,Note:()=>Ht,Tab:()=>Mt,Table:()=>dn,Tabs:()=>Nt,Tip:()=>Ut,Video:()=>Pt,Warning:()=>Wt});function xn(){return B(`div`,{className:A(`w-full h-full relative overflow-y-auto transition-opacity duration-300 animate-fade-in`),children:V(`div`,{className:`mx-auto max-w-(--spacing-content-max) px-4 py-8 space-y-10`,children:[V(`div`,{className:`flex gap-2`,children:[B(w,{className:`h-3 w-16`}),B(w,{className:`h-3 w-24`})]}),B(w,{className:`h-10 w-[60%] sm:h-12`}),V(`div`,{className:`space-y-3`,children:[B(w,{className:`h-4 w-full`}),B(w,{className:`h-4 w-[95%]`}),B(w,{className:`h-4 w-[40%]`})]}),V(`div`,{className:`space-y-6 pt-4`,children:[B(w,{className:`h-7 w-32`}),V(`div`,{className:`space-y-3`,children:[B(w,{className:`h-4 w-full`}),B(w,{className:`h-4 w-[98%]`}),B(w,{className:`h-4 w-[92%]`}),B(w,{className:`h-4 w-[60%]`})]})]}),B(w,{className:`h-32 w-full rounded-lg bg-bg-muted/50`}),V(`div`,{className:`space-y-6 pt-4`,children:[B(w,{className:`h-7 w-48`}),V(`div`,{className:`space-y-3`,children:[B(w,{className:`h-4 w-full`}),B(w,{className:`h-4 w-[85%]`})]})]})]})})}const Z=({level:e,id:t,children:n,...r})=>V(`h${e}`,{id:t,...r,className:`boltdocs-heading`,children:[n,t&&B(`a`,{href:`#${t}`,className:`header-anchor`,"aria-label":`Anchor`,children:B(Je,{size:16})})]}),Sn={...bn,Loading:xn,h1:e=>B(Z,{level:1,...e}),h2:e=>B(Z,{level:2,...e}),h3:e=>B(Z,{level:3,...e}),h4:e=>B(Z,{level:4,...e}),h5:e=>B(Z,{level:5,...e}),h6:e=>B(Z,{level:6,...e}),pre:e=>B(J,{...e,children:e.children})};function Cn({config:e}){let{currentLocale:t}=g();return F(()=>{if(!e.i18n||typeof document>`u`)return;let n=t||e.i18n.defaultLocale,r=e.i18n.localeConfigs?.[n];document.documentElement.lang=r?.htmlLang||n||`en`,document.documentElement.dir=r?.direction||`ltr`},[t,e.i18n]),null}function wn({config:e}){let t=j(),{setLocale:n,setVersion:r,currentLocale:i,currentVersion:a}=g();return F(()=>{let o=t.pathname.split(`/`).filter(Boolean),s=0,c=e.versions?.defaultVersion,l=e.i18n?.defaultLocale;if(o[s]===`docs`&&s++,e.versions&&o.length>s){let t=e.versions.versions.find(e=>e.path===o[s]);t&&(c=t.path,s++)}e.i18n&&o.length>s&&e.i18n.locales[o[s]]?l=o[s]:e.i18n&&o.length===0&&(l=i||e.i18n.defaultLocale),l!==i&&n(l||``),c!==a&&r(c??``)},[t.pathname,e,n,r,i,a]),null}function Tn({config:e,routes:r,components:i={}}){let a=I(()=>({...Sn,...nt,...i}),[i]),s=me();return B(we,{children:B(o,{children:B(_t,{children:B(ut,{components:a,children:B(t.Provider,{value:e,children:B(n,{routes:r,children:V(Se,{navigate:s,children:[B(vt,{}),B(wn,{config:e}),B(Cn,{config:e}),B(fe,{})]})})})})})})})}function En(){return B(`div`,{className:`flex items-center justify-center min-h-[60vh] text-center`,children:V(`div`,{className:`space-y-4`,children:[B(`span`,{className:`text-8xl font-black tracking-tighter text-primary-500/20`,children:`404`}),B(`h1`,{className:`text-2xl font-bold text-text-main`,children:`Page Not Found`}),B(`p`,{className:`text-sm text-text-muted max-w-sm mx-auto`,children:`The page you're looking for doesn't exist or has been moved.`}),V(k,{href:`/`,className:`inline-flex items-center gap-2 rounded-lg bg-primary-500 px-5 py-2.5 text-sm font-semibold text-white outline-none transition-all hover:brightness-110 hover:shadow-lg focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:[B(De,{size:16}),` Go to Home`]})]})})}function Dn(e,t){let n=t.replace(/\\/g,`/`);return Object.keys(e).find(e=>e.endsWith(`/${n}`)||e.endsWith(n))}function On(e){let{routesData:t,config:n,mdxModules:r,Layout:i,homePage:a,externalPages:o,externalLayout:s,components:c}=e,l=s||i,u=e=>{let t=n.base||`/`;return e.startsWith(t)?e:`${t===`/`?``:t.replace(/\/$/,``)}${e.startsWith(`/`)?e:`/${e}`}`||`/`},d=[...t.map(e=>{let t=Dn(r,e.filePath),n=t?r[t]?.default:null,i=u(e.path===``?`/`:e.path);return{path:i,element:B(ft,{MDXComponent:n,mdxComponents:c}),loader:async()=>({path:i,frontmatter:{title:e.title,description:e.description||``},headings:e.headings||[],filePath:e.filePath,locale:e.locale,version:e.version,group:e.group,groupTitle:e.groupTitle}),getStaticPaths:()=>[i]}})];if(a){let e=[u(`/`)];n.i18n&&Object.keys(n.i18n.locales).forEach(t=>{e.push(u(`/${t}`))}),e.forEach(e=>{d.find(t=>t.path===e)||d.push({path:e,element:B(l,{children:B(a,{})}),getStaticPaths:()=>[e]})})}return o&&Object.entries(o).forEach(([e,t])=>{let r=u(e);d.find(e=>e.path===r)||(d.push({path:r,element:B(l,{children:B(t,{})}),getStaticPaths:()=>[r]}),n.i18n&&Object.keys(n.i18n.locales).forEach(n=>{let r=u(`/${n}${e===`/`?``:e}`);d.find(e=>e.path===r)||d.push({path:r,element:B(l,{children:B(t,{})}),getStaticPaths:()=>[r]})}))}),d.push({path:`*`,element:B(l,{children:B(En,{})})}),[{element:B(Tn,{config:n,routes:[...t],components:c}),children:d}]}function Q(e,t){return e?typeof e==`string`?e:t&&e[t]?e[t]:Object.values(e)[0]||``:``}function kn(){let e=_(),{theme:t,resolvedTheme:n}=q(),r=j(),{currentLocale:i}=m(),a=e.theme||{},o=Q(a.title,i)||`Boltdocs`,s=a.navbar||[],c=a.socialLinks||[],l=a.githubRepo,u=s.map(t=>{let n=t.href||t.to||t.link||``;return{label:Q(t.label||t.text,i),href:n,active:(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)})(n),to:n.startsWith(`http`)||n.startsWith(`//`)?`external`:void 0}}),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 An(e){let t=_(),n=j(),r=e=>e.endsWith(`/`)&&e.length>1?e.slice(0,-1):e,i=r(n.pathname),a=e.find(e=>r(e.path)===i),o=a?.tab?.toLowerCase(),s=o?e.filter(e=>!e.tab||e.tab.toLowerCase()===o):e,c=[],l=new Map;for(let e of s)e.group?(l.has(e.group)||l.set(e.group,{slug:e.group,title:e.groupTitle||e.group,routes:[],icon:e.groupIcon}),l.get(e.group).routes.push(e)):c.push(e);return{groups:Array.from(l.values()).map(e=>{let t=new Map,n=new Map;for(let r of e.routes)r.subRouteGroup&&((r.path.endsWith(`/${r.subRouteGroup}`)||r.path.endsWith(`/${r.subRouteGroup}/`))&&!t.has(r.subRouteGroup)?t.set(r.subRouteGroup,r):(n.has(r.subRouteGroup)||n.set(r.subRouteGroup,[]),n.get(r.subRouteGroup).push(r)));let r=[],i=new Set;for(let a of e.routes)if(a.subRouteGroup){if(!i.has(a.subRouteGroup)){i.add(a.subRouteGroup);let e=t.get(a.subRouteGroup),o=n.get(a.subRouteGroup)||[];e?r.push({...e,subRoutes:o}):r.push(...o)}}else r.push(a);return{...e,routes:r}}),ungrouped:c,activeRoute:a,activePath:i,config:t}}function jn(e=[]){let[t,n]=R(null);return{headings:e,activeId:t,setActiveId:n}}function Mn(e=[],t=[]){let n=j(),r=L([]),[i,a]=R({opacity:0,transform:`translateX(0) scaleX(0)`,width:0}),o=e=>e.endsWith(`/`)&&e.length>1?e.slice(0,-1):e,s=o(n.pathname),c=t.find(e=>o(e.path)===s)?.tab?.toLowerCase(),l=e.findIndex(e=>e.id.toLowerCase()===c),u=l===-1?0:l;return F(()=>{let e=r.current[u];e&&a({opacity:1,width:e.offsetWidth,transform:`translateX(${e.offsetLeft}px)`})},[u,e.length,n.pathname]),{tabs:e,activeIndex:u,indicatorStyle:i,tabRefs:r,activeTabId:c}}function $(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 Nn(){let e=me(),t=m(),{allRoutes:n,currentRoute:r,currentVersion:i,currentLocale:a,config:o}=t,s=o.versions,{setVersion:c}=g(),l=t=>{if(!s||t===i)return;c(t);let o=`/docs/${t}`;if(r){let e=$(r.filePath,r.version,r.locale),i=n.find(n=>$(n.filePath,n.version,n.locale)===e&&(n.version||s.defaultVersion)===t&&(a?n.locale===a:!n.locale));if(i)o=i.path;else{let e=n.find(e=>$(e.filePath,e.version,e.locale)===`index.md`&&(e.version||s.defaultVersion)===t&&(a?e.locale===a:!e.locale));o=e?e.path:`/docs/${t}${a?`/${a}`:``}`}}e(o)},u=t.availableVersions.map(e=>({...e,label:e.label,value:e.key}));return{currentVersion:i,currentVersionLabel:t.currentVersionLabel,availableVersions:u,handleVersionChange:l}}function Pn(){let e=me(),{allRoutes:t,currentRoute:n,currentLocale:r,config:i}=m(),a=i.i18n,{setLocale:o}=g();return{currentLocale:r,currentLocaleLabel:i.i18n?.localeConfigs?.[r]?.label||i.i18n?.locales[r]||r,availableLocales:i.i18n?Object.entries(i.i18n.locales).map(([e,t])=>({key:e,label:i.i18n?.localeConfigs?.[e]?.label||t,value:e,isCurrent:e===r})):[],handleLocaleChange:i=>{if(!a||i===r)return;o(i);let s=`/`;if(n){let e=$(n.filePath,n.version,n.locale),r=t.find(t=>$(t.filePath,t.version,t.locale)===e&&(t.locale||a.defaultLocale)===i&&t.version===n.version);if(r)s=r.path;else{let e=t.find(e=>$(e.filePath,e.version,e.locale)===`index.md`&&(e.locale||a.defaultLocale)===i&&e.version===n.version);s=e?e.path:i===a.defaultLocale?n.version?`/${n.version}`:`/`:n.version?`/${n.version}/${i}`:`/${i}`}}else{let e=t.find(e=>(e.filePath===`index.mdx`||e.filePath===`index.md`)&&(e.locale||a.defaultLocale)===i&&!e.version);s=e?e.path:i===a.defaultLocale?`/`:`/${i}`}e(s)}}}function Fn(){let{routes:e,currentRoute:t}=m(),n=j();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}}function In(){let{currentRoute:e}=m(),t=[];return e&&(e.groupTitle&&t.push({label:e.groupTitle}),t.push({label:e.title,href:e.path})),{crumbs:t,activeRoute:e}}const Ln=()=>j();function Rn({children:e,className:t,style:n}){return B(`div`,{className:A(`h-screen flex flex-col overflow-hidden bg-bg-main text-text-main`,t),style:n,children:e})}function zn({children:e,className:t,style:n}){return B(`div`,{className:A(`mx-auto flex flex-1 w-full max-w-(--breakpoint-3xl) bg-bg-main overflow-hidden`,t),style:n,children:e})}function Bn({children:e,className:t,style:n}){return B(`main`,{className:A(`boltdocs-content flex-1 min-w-0 overflow-y-auto`,`contain-layout`,t),style:n,children:e})}function Vn({children:e,className:t,style:n}){let{pathname:r}=Ln();return B(`div`,{className:A(`boltdocs-page mx-auto pt-4 pb-20 px-4 sm:px-8`,{"max-w-content-max":r.includes(`/docs/`)},t),style:n,children:e})}function Hn({children:e,className:t,style:n}){return B(`div`,{className:A(`flex items-center justify-between mb-10`,t),style:n,children:e})}function Un({children:e,className:t,style:n}){return B(`div`,{className:A(`mt-20`,t),style:n,children:e})}const Wn=Object.assign(Rn,{Body:zn,Content:Bn,ContentMdx:Vn,ContentHeader:Hn,ContentFooter:Un});function Gn(){let{theme:e,setTheme:t}=q(),[n,r]=R(!1);if(F(()=>{r(!0)},[]),!n)return B(`div`,{className:`h-9 w-9`});let i=e===`system`?Ye:e===`dark`?Xe:$e;return V(E.Trigger,{placement:`bottom right`,children:[B(U,{className:`flex h-9 w-9 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-bg-surface hover:text-text-main outline-none focus-visible:ring-2 focus-visible:ring-primary-500`,"aria-label":`Selection theme`,children:B(i,{size:20,className:`animate-in fade-in zoom-in duration-300`})}),V(E.Root,{selectionMode:`single`,selectedKeys:[e],onSelectionChange:e=>{let n=Array.from(e)[0];t(n)},children:[V(E.Item,{id:`light`,children:[B($e,{size:16}),B(`span`,{children:`Light`})]}),V(E.Item,{id:`dark`,children:[B(Xe,{size:16}),B(`span`,{children:`Dark`})]}),V(E.Item,{id:`system`,children:[B(Ye,{size:16}),B(`span`,{children:`System`})]})]})]})}async function Kn(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`:qn(i.stargazers_count)}const qn=e=>Intl.NumberFormat(`en`,{notation:`compact`,compactDisplay:`short`}).format(e);function Jn({repo:e}){let[t,n]=R(null);return F(()=>{e&&Kn(e).then(e=>n(e)).catch(()=>n(`0`))},[e]),V(`a`,{href:`https://github.com/${e}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-2 rounded-md border border-border-subtle bg-bg-surface px-2.5 py-1.5 text-xs font-medium text-text-muted transition-all hover:bg-bg-main hover:border-border-strong hover:text-text-main`,children:[B(d,{className:`h-4 w-4`}),t&&B(`span`,{className:`tabular-nums`,children:t})]})}function Yn({tabs:e,routes:t}){let{currentLocale:n}=m(),{indicatorStyle:r,tabRefs:i,activeIndex:a}=Mn(e,t),o=e=>{if(!e)return null;if(e.trim().startsWith(`<svg`))return B(`span`,{className:`h-4 w-4`,dangerouslySetInnerHTML:{__html:e}});let t=Te[e];return t?B(t,{size:16}):B(`img`,{src:e,alt:``,className:`h-4 w-4 object-contain`})};return B(`div`,{className:`mx-auto max-w-(--breakpoint-3xl) px-4 md:px-6`,children:V(b.List,{className:`border-none py-0`,children:[e.map((e,r)=>{let s=r===a,c=t.find(t=>t.tab&&t.tab.toLowerCase()===e.id.toLowerCase());return V(k,{href:c?c.path:`#`,ref:e=>{i.current[r]=e},className:`relative flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors outline-none ${s?`text-primary-500`:`text-text-muted hover:text-text-main`}`,children:[o(e.icon),B(`span`,{children:Q(e.text,n)})]},e.id)}),B(b.Indicator,{style:r})]})})}const Xn=ye(()=>import(`../search-dialog-3lvKsbVG.js`).then(e=>({default:e.SearchDialog})));function Zn(){let{links:e,title:t,logo:n,logoProps:r,github:i,social:a,config:o}=kn(),{routes:s,allRoutes:c,currentVersion:l,currentLocale:u}=m(),{pathname:d}=j(),f=o.theme||{},p=d.startsWith(`/docs`),h=f?.tabs&&f.tabs.length>0;return V(O.Root,{className:h?`border-b-0`:``,children:[V(O.Content,{children:[V(O.Left,{children:[n&&B(O.Logo,{src:n,alt:r?.alt||t,width:r?.width??24,height:r?.height??24}),B(O.Title,{children:t}),o.versions&&l&&B($n,{})]}),B(O.Center,{children:B(_e,{fallback:B(`div`,{className:`h-9 w-32 animate-pulse rounded-md bg-bg-surface`}),children:B(Xn,{routes:s||[]})})}),V(O.Right,{children:[B(O.Links,{children:e.map(e=>B(Qn,{link:e},e.href))}),o.i18n&&u&&B(er,{}),B(O.Split,{}),B(Gn,{}),i&&B(Jn,{repo:f?.githubRepo??``}),a.length>0&&B(O.Split,{}),B(`div`,{className:`flex items-center gap-1`,children:a.map(({icon:e,link:t})=>B(O.Socials,{icon:e,link:t,className:`p-1.5`},t))})]})]}),p&&h&&f?.tabs&&B(`div`,{className:`w-full border-b border-border-subtle bg-bg-main`,children:B(Yn,{tabs:f.tabs,routes:c||s||[]})})]})}function Qn({link:e}){let t=de(e.href||``);return B(O.Link,{...e,href:t})}function $n(){let{currentVersionLabel:e,availableVersions:t,handleVersionChange:n}=Nn();return t.length===0?null:V(E.Trigger,{children:[B(c,{variant:`outline`,size:`sm`,rounded:`lg`,iconPosition:`right`,icon:B(G,{className:`w-3.5 h-3.5 text-text-muted/60`}),className:`h-8 border-border-subtle/60 bg-bg-surface/30 backdrop-blur-sm transition-all duration-200 hover:border-primary-500/50 hover:bg-primary-500/5`,children:B(`span`,{className:`font-semibold text-[0.8125rem]`,children:e})}),B(E.Root,{children:B(E.Section,{items:t,children:e=>B(E.Item,{onPress:()=>n(e.value),children:e.label},`${e.value??``}`)})})]})}function er(){let{currentLocale:e,availableLocales:t,handleLocaleChange:n}=Pn();return t.length===0?null:V(E.Trigger,{children:[B(c,{variant:`outline`,size:`sm`,rounded:`lg`,iconPosition:`right`,icon:B(G,{className:`w-3.5 h-3.5 text-text-muted/60`}),className:`h-8 border-border-subtle/60 bg-bg-surface/30 backdrop-blur-sm transition-all duration-200 hover:border-primary-500/50 hover:bg-primary-500/5 px-2.5`,children:V(`div`,{className:`flex items-center gap-1.5`,children:[B(Ke,{className:`w-3.5 h-3.5 text-primary-500`}),B(`span`,{className:`font-bold text-[0.75rem] uppercase opacity-90`,children:e||`en`})]})}),B(E.Root,{children:B(E.Section,{items:t,children:e=>B(E.Item,{onPress:()=>n(e.value),children:V(`div`,{className:`flex items-center justify-between w-full gap-4`,children:[B(`span`,{children:e.label}),B(`span`,{className:`text-[10px] font-bold opacity-40 uppercase tracking-tighter`,children:e.value})]})},`${e.value??``}`)})})]})}function tr(){return B(`div`,{className:`flex items-center justify-center mt-10 mb-4 px-4 w-full`,children:V(`a`,{href:`https://github.com/jesusalcaladev/boltdocs`,target:`_blank`,rel:`noopener noreferrer`,className:`group relative flex items-center gap-2 px-4 py-2 rounded-full border border-border-subtle bg-bg-surface/50 backdrop-blur-md transition-all duration-300 hover:border-primary-500/50 hover:bg-bg-surface hover:shadow-xl hover:shadow-primary-500/5 select-none`,children:[B(tt,{className:`w-3.5 h-3.5 text-text-muted group-hover:text-primary-500 transition-colors duration-300`,fill:`currentColor`}),V(`span`,{className:`text-[11px] font-medium text-text-muted group-hover:text-text-main transition-colors duration-300 tracking-wide`,children:[`Powered by`,` `,B(`strong`,{className:`font-bold text-text-main/80 group-hover:text-text-main`,children:`Boltdocs`})]})]})})}function nr(e){if(!e)return;let t={...Te,...rt};return t[e]||t[e+`Icon`]||void 0}function rr({route:e,activePath:t,getIcon:n}){let r=t===(e.path.endsWith(`/`)?e.path.slice(0,-1):e.path),i=I(()=>e.subRoutes?.some(e=>e.path===t),[e.subRoutes,t]),[a,o]=R(i||r);return F(()=>{(i||r)&&o(!0)},[i,r]),B(D.SubGroup,{label:e.title,href:e.path,active:r,icon:n(e.icon),badge:e.badge,isOpen:a,onToggle:()=>o(!a),children:e.subRoutes?.map(e=>{let r=t===(e.path.endsWith(`/`)?e.path.slice(0,-1):e.path);return B(D.Link,{label:e.title,href:e.path,active:r,icon:n(e.icon),badge:e.badge},e.path)})})}function ir({group:e,activePath:t,getIcon:n}){return B(D.Group,{title:e.title,icon:n(e.icon),children:e.routes.map(e=>{if(e.subRoutes&&e.subRoutes.length>0)return B(rr,{route:e,activePath:t,getIcon:n},e.path);let r=t===(e.path.endsWith(`/`)?e.path.slice(0,-1):e.path);return B(D.Link,{label:e.title,href:e.path,active:r,icon:n(e.icon),badge:e.badge},e.path)})})}function ar({routes:e,config:t}){let{groups:n,ungrouped:r,activePath:i}=An(e),a=t.theme||{};return V(D.Root,{children:[r.length>0&&B(D.Group,{className:`mb-6`,children:r.map(e=>{let t=i===(e.path.endsWith(`/`)?e.path.slice(0,-1):e.path);return B(D.Link,{label:e.title,href:e.path,active:t,icon:nr(e.icon),badge:e.badge},e.path)})}),n.map(e=>B(ir,{group:e,activePath:i,getIcon:nr},e.slug)),a?.poweredBy&&B(`div`,{className:`mt-auto pt-8`,children:B(tr,{})})]})}function or({headings:e=[],editLink:t,communityHelp:n,filePath:r}){let{headings:i}=jn(e),a=I(()=>i.map(e=>({title:e.text,url:`#${e.id}`,depth:e.level})),[i]);return i.length===0?null:B(le,{toc:a,children:B(sr,{headings:i,editLink:t,communityHelp:n,filePath:r})})}function sr({headings:e,editLink:t,communityHelp:n,filePath:r}){let i=se(),[a,o]=R({opacity:0}),s=L(null),c=L(null);F(()=>{if(!i||!s.current)return;let e=s.current.querySelector(`a[href="#${i}"]`);e&&o({transform:`translateY(${e.offsetTop}px)`,height:`${e.offsetHeight}px`,opacity:1})},[i]);let l=P((e,t)=>{e.preventDefault();let n=document.getElementById(t);n&&(n.scrollIntoView({behavior:`smooth`}),window.history.pushState(null,``,`#${t}`))},[]);return V(x.Root,{children:[V(x.Header,{className:`flex flex-row gap-x-2`,children:[B(et,{size:16}),`On this page`]}),B(te,{containerRef:c,children:V(x.Content,{className:`max-h-[450px] boltdocs-otp-scroll-area`,ref:c,children:[B(x.Indicator,{style:a}),B(`ul`,{className:`relative space-y-2 border-l border-border-subtle`,ref:s,children:e.map(e=>B(x.Item,{level:e.level,children:B(x.Link,{href:`#${e.id}`,active:i===e.id,onClick:t=>l(t,e.id),className:`pl-4`,children:e.text})},e.id))})]})}),(t||n)&&V(`div`,{className:`mt-8 pt-8 border-t border-border-subtle space-y-4`,children:[B(`p`,{className:`text-xs font-bold uppercase text-text-main`,children:`Need help?`}),V(`ul`,{className:`space-y-3`,children:[t&&r&&B(`li`,{children:V(`a`,{href:t.replace(`:path`,r),target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-sm text-text-muted hover:text-text-main transition-colors`,children:[B(Ze,{size:16}),`Edit this page`]})}),n&&B(`li`,{children:V(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 text-sm text-text-muted hover:text-text-main transition-colors`,children:[B(Fe,{size:16}),`Community help`]})})]})]})]})}function cr({siteTitle:e,siteDescription:t,routes:n}){let r=j(),i=_(),a=n?.find?.(e=>e.path===r.pathname),o=a?.title,s=a?.description||t||``,c=o?`${o} | ${e}`:e,l=a?.seo||{},u=i?.seo?.metatags||{},d=i?.seo?.thumbnails?.background,f=l[`og:image`]||d;return V(Ce,{children:[B(`title`,{children:c}),B(`meta`,{name:`description`,content:s}),B(`meta`,{property:`og:title`,content:c}),B(`meta`,{property:`og:description`,content:s}),B(`meta`,{property:`og:type`,content:`article`}),typeof window<`u`&&B(`meta`,{property:`og:url`,content:window.location.href}),typeof window<`u`&&B(`link`,{rel:`canonical`,href:window.location.origin+r.pathname}),B(`meta`,{name:`twitter:card`,content:`summary`}),B(`meta`,{name:`twitter:title`,content:c}),B(`meta`,{name:`twitter:description`,content:s}),f&&B(`meta`,{name:`twitter:image`,content:f}),f&&B(`meta`,{property:`og:image`,content:f}),B(`meta`,{name:`generator`,content:`Boltdocs`}),Object.entries(u).map(([e,t])=>e.startsWith(`og:`)||e.startsWith(`music:`)||e.startsWith(`video:`)||e.startsWith(`article:`)||e.startsWith(`book:`)||e.startsWith(`profile:`)?B(`meta`,{property:e,content:t},e):B(`meta`,{name:e,content:t},e)),Object.entries(l).map(([e,t])=>e===`noindex`&&t===!0?B(`meta`,{name:`robots`,content:`noindex`},`noindex`):e===`robots`?B(`meta`,{name:`robots`,content:t},`robots`):e===`canonical`?B(`link`,{rel:`canonical`,href:t},`canonical`):e.startsWith(`og:`)||e.startsWith(`music:`)||e.startsWith(`video:`)||e.startsWith(`article:`)||e.startsWith(`book:`)||e.startsWith(`profile:`)?B(`meta`,{property:e,content:t},e):B(`meta`,{name:e,content:t},e))]})}function lr(){let{crumbs:e,activeRoute:t}=In(),n=_().theme||{};return e.length===0||!n?.breadcrumbs?null:V(T.Root,{children:[B(T.Item,{children:B(T.Link,{href:`/`,children:B(We,{size:14})})}),e.map((e,n)=>V(T.Item,{children:[B(T.Separator,{}),B(T.Link,{href:e.href,className:A({"font-medium text-text-main":e.href===t?.path}),children:e.label})]},`crumb-${e.href}-${e.label}-${n}`))]})}function ur(){let{prevPage:e,nextPage:t}=Fn();return!e&&!t?null:V(C.Root,{className:`animate-in fade-in slide-in-from-bottom-4 duration-700`,children:[e?V(C.Link,{to:e.path,direction:`prev`,children:[B(C.Title,{children:`Previous`}),B(C.Description,{children:e.title})]}):B(`div`,{}),t&&V(C.Link,{to:t.path,direction:`next`,children:[B(C.Title,{children:`Next`}),B(C.Description,{children:t.title})]})]})}var dr=class extends ge{state={hasError:!1};static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){console.error(`Uncaught error in Boltdocs Layout:`,e,t)}render(){return this.state.hasError?this.props.fallback||V(`div`,{className:`flex flex-col items-center justify-center min-h-[40vh] text-center gap-4 px-4`,children:[B(`div`,{className:`text-lg font-bold text-red-400`,children:`Something went wrong`}),B(`p`,{className:`text-sm text-text-muted max-w-md`,children:this.state.error?.message||`An unexpected error occurred while rendering this page.`}),B(c,{className:`rounded-lg border border-border-subtle bg-bg-surface px-5 py-2 text-sm font-medium text-text-main transition-colors hover:bg-bg-muted cursor-pointer`,onPress:()=>this.setState({hasError:!1}),children:`Try again`})]}):this.props.children}};export{Y as Admonition,le as AnchorProvider,It as Badge,Tn as BoltdocsShell,lr as Breadcrumbs,yt as Button,v as ButtonGroup,zt as Card,Rt as Cards,Jt as Caution,J as CodeBlock,_n as ComponentPreview,hn as ComponentProps,yn as CopyMarkdown,Gt as Danger,Wn as DocsLayout,dr as ErrorBoundary,fn as Field,ln as FileTree,cr as Head,mn as Image,qt as Important,Kt as InfoBox,pn as Link,en as List,xn as Loading,ft as MdxPage,Zn as Navbar,En as NotFound,Ht as Note,or as OnThisPage,ur as PageNav,T as PrimitiveBreadcrumbs,c as PrimitiveButton,k as PrimitiveLink,E as PrimitiveMenu,y as PrimitiveNavLink,O as PrimitiveNavbar,ee as PrimitiveNavigationMenu,x as PrimitiveOnThisPage,C as PrimitivePageNav,ie as PrimitivePopover,D as PrimitiveSidebar,w as PrimitiveSkeleton,b as PrimitiveTabs,ue as PrimitiveTooltip,te as ScrollProvider,ne as SearchDialogPrimitive,ar as Sidebar,Mt as Tab,dn as Table,Nt as Tabs,Ut as Tip,Pt as Video,Wt as Warning,A as cn,On as createRoutes,Q as getTranslated,se as useActiveAnchor,oe as useActiveAnchors,In as useBreadcrumbs,_ as useConfig,Pn as useI18n,re as useItems,de as useLocalizedTo,Ln as useLocation,lt as useMdxComponents,kn as useNavbar,jn as useOnThisPage,Fn as usePageNav,m as useRoutes,ce as useSearch,An as useSidebar,Mn as useTabs,q as useTheme,Nn as useVersion};
@@ -4,5 +4,5 @@
4
4
  * Copyright (c) 2026 Jesus Alcala
5
5
  * Licensed under the MIT License.
6
6
  */
7
- const e=require(`../node-vkbb0MK7.cjs`);let t=require(`vite`),n=require(`fast-glob`);n=e.x(n);let r=require(`fs`);r=e.x(r);let i=require(`path`);i=e.x(i);let a=require(`cac`);a=e.x(a);let o=require(`@bdocs/ssg/node`);var s=e.b({colors:()=>c,error:()=>d,formatLog:()=>l,info:()=>u,success:()=>f});const c={reset:`\x1B[0m`,bold:`\x1B[1m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,cyan:`\x1B[36m`,gray:`\x1B[90m`};function l(e,t=``){return`${t}${c.bold}[boltdocs]${c.reset} ${e}${c.reset}`}function u(e){console.log(l(e))}function d(e,t){console.error(l(e,c.red)),t&&console.error(t)}function f(e){console.log(l(e,c.green))}async function p(t=process.cwd()){try{let n=await(0,o.createServer)(await e.n(t,`development`));await n.listen(),n.printUrls(),n.bindCLIShortcuts({print:!0})}catch(e){d(`Failed to start dev server:`,e),process.exit(1)}}async function m(t=process.cwd()){try{await(0,o.build)({entry:`boltdocs/entry`},await e.n(t,`production`)),f(`SSG build completed successfully!`)}catch(e){d(`Build failed:`,e),process.exit(1)}}async function h(n=process.cwd()){try{(await(0,t.preview)(await e.n(n,`production`))).printUrls()}catch(e){d(`Failed to start preview server:`,e),process.exit(1)}}async function g(t=process.cwd()){let{colors:a}=s;u(`${a.bold}Running documentation health check...${a.reset}\n`);let o=performance.now();try{let s=await e.g(`docs`,t),c=i.default.resolve(t,`docs`);r.default.existsSync(c)||(d(`Documentation directory not found at ${c}`),process.exit(1));let l=await(0,n.default)([`**/*.md`,`**/*.mdx`],{cwd:c,absolute:!0,suppressErrors:!0}),p=0,m=0,h=0,g=new Map,_=(e,t)=>{let n=i.default.relative(c,e),r=g.get(n);r||(r=[],g.set(n,r)),r.push(t),t.level===`high`?p++:t.level===`warning`?m++:t.level===`low`&&h++},v=`/docs`;for(let t of l){let{data:n,content:a}=e.y(t);n.title||_(t,{level:`warning`,message:`Missing "title" in frontmatter.`,suggestion:"Add `title: Your Title` to the YAML frontmatter at the top of the file."}),n.description||_(t,{level:`low`,message:`Missing "description" in frontmatter.`,suggestion:`Adding a description helps with SEO and search previews.`});let o=/\[.*?\]\((.*?)\)/g,s=/<a\s+[^>]*href=["']([^"']+)["'][^>]*>/g,l=[...a.matchAll(o),...a.matchAll(s)];for(let e of l){let n=e[1];if(!n||n.startsWith(`http`)||n.startsWith(`https`)||n.startsWith(`#`)||n.startsWith(`mailto:`)||n.startsWith(`tel:`)||(n=n.split(`#`)[0],!n))continue;let a;if(n.startsWith(`/`)){let e=n;(n.startsWith(v+`/`)||n===v)&&(e=n.substring(5)),a=i.default.join(c,e)}else a=i.default.resolve(i.default.dirname(t),n);let o=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`],s=!1;for(let e of o){let t=a+e;if(r.default.existsSync(t)&&r.default.statSync(t).isFile()){s=!0;break}}s||_(t,{level:`high`,message:`Broken internal link: "${n}"`,suggestion:`Ensure the file exists at "${a}". If it's a directory, ensure it has an "index.md" or "index.mdx".`})}}if(s.i18n){let{defaultLocale:t,locales:n}=s.i18n,a=Object.keys(n).filter(e=>e!==t);for(let n of l){let o=e.v(i.default.relative(c,n)).split(`/`);if(o[0]===t){let e=o.slice(1).join(`/`);for(let t of a){let a=[t,...o.slice(1)],s=i.default.join(c,...a);r.default.existsSync(s)||_(n,{level:`warning`,message:`Missing translation for locale "${t}"`,suggestion:`Create a translated version of this file at "${t}/${e}".`})}}}}if(g.size===0)f(`All documentation files are healthy!
7
+ const e=require(`../node-D5iosYXv.cjs`);let t=require(`vite`),n=require(`fast-glob`);n=e.S(n);let r=require(`fs`);r=e.S(r);let i=require(`path`);i=e.S(i);let a=require(`cac`);a=e.S(a);let o=require(`@bdocs/ssg/node`);var s=e.x({colors:()=>c,error:()=>d,formatLog:()=>l,info:()=>u,success:()=>f});const c={reset:`\x1B[0m`,bold:`\x1B[1m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,cyan:`\x1B[36m`,gray:`\x1B[90m`};function l(e,t=``){return`${t}${c.bold}[boltdocs]${c.reset} ${e}${c.reset}`}function u(e){console.log(l(e))}function d(e,t){console.error(l(e,c.red)),t&&console.error(t)}function f(e){console.log(l(e,c.green))}async function p(t=process.cwd()){try{let n=await(0,o.createServer)(await e.n(t,`development`));await n.listen(),n.printUrls(),n.bindCLIShortcuts({print:!0})}catch(e){d(`Failed to start dev server:`,e),process.exit(1)}}async function m(t=process.cwd()){try{await(0,o.build)({entry:`boltdocs/entry`},await e.n(t,`production`)),f(`SSG build completed successfully!`)}catch(e){d(`Build failed:`,e),process.exit(1)}}async function h(n=process.cwd()){try{(await(0,t.preview)(await e.n(n,`production`))).printUrls()}catch(e){d(`Failed to start preview server:`,e),process.exit(1)}}async function g(t=process.cwd()){let{colors:a}=s;u(`${a.bold}Running documentation health check...${a.reset}\n`);let o=performance.now();try{let s=await e.g(`docs`,t),c=i.default.resolve(t,`docs`);r.default.existsSync(c)||(d(`Documentation directory not found at ${c}`),process.exit(1));let l=await(0,n.default)([`**/*.md`,`**/*.mdx`],{cwd:c,absolute:!0,suppressErrors:!0}),p=0,m=0,h=0,g=new Map,_=(e,t)=>{let n=i.default.relative(c,e),r=g.get(n);r||(r=[],g.set(n,r)),r.push(t),t.level===`high`?p++:t.level===`warning`?m++:t.level===`low`&&h++},v=`/docs`;for(let t of l){let{data:n,content:a}=e.y(t);n.title||_(t,{level:`warning`,message:`Missing "title" in frontmatter.`,suggestion:"Add `title: Your Title` to the YAML frontmatter at the top of the file."}),n.description||_(t,{level:`low`,message:`Missing "description" in frontmatter.`,suggestion:`Adding a description helps with SEO and search previews.`});let o=/\[.*?\]\((.*?)\)/g,s=/<a\s+[^>]*href=["']([^"']+)["'][^>]*>/g,l=[...a.matchAll(o),...a.matchAll(s)];for(let e of l){let n=e[1];if(!n||n.startsWith(`http`)||n.startsWith(`https`)||n.startsWith(`#`)||n.startsWith(`mailto:`)||n.startsWith(`tel:`)||(n=n.split(`#`)[0],!n))continue;let a;if(n.startsWith(`/`)){let e=n;(n.startsWith(v+`/`)||n===v)&&(e=n.substring(5)),a=i.default.join(c,e)}else a=i.default.resolve(i.default.dirname(t),n);let o=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`],s=!1;for(let e of o){let t=a+e;if(r.default.existsSync(t)&&r.default.statSync(t).isFile()){s=!0;break}}s||_(t,{level:`high`,message:`Broken internal link: "${n}"`,suggestion:`Ensure the file exists at "${a}". If it's a directory, ensure it has an "index.md" or "index.mdx".`})}}if(s.i18n){let{defaultLocale:t,locales:n}=s.i18n,a=Object.keys(n).filter(e=>e!==t);for(let n of l){let o=e.v(i.default.relative(c,n)).split(`/`);if(o[0]===t){let e=o.slice(1).join(`/`);for(let t of a){let a=[t,...o.slice(1)],s=i.default.join(c,...a);r.default.existsSync(s)||_(n,{level:`warning`,message:`Missing translation for locale "${t}"`,suggestion:`Create a translated version of this file at "${t}/${e}".`})}}}}if(g.size===0)f(`All documentation files are healthy!
8
8
  `);else{for(let[e,t]of g.entries()){console.log(`📄 ${a.bold}${e}${a.reset}`);let n=t.sort((e,t)=>{let n={high:1,warning:2,low:3};return n[e.level]-n[t.level]});for(let e of n){let t=``,n=``;e.level===`high`?(t=`❌`,n=a.red):e.level===`warning`?(t=`⚠️`,n=a.yellow):(t=`ℹ️`,n=a.cyan),console.log(` ${n}${t} ${e.level.toUpperCase()}:${a.reset} ${e.message}`),e.suggestion&&console.log(` ${a.gray}💡 Suggestion: ${e.suggestion}${a.reset}`)}console.log(``)}console.log(`${a.bold}Summary:${a.reset}`),console.log(` ${a.red}${p} high-level errors${a.reset}`),console.log(` ${a.yellow}${m} warnings${a.reset}`),console.log(` ${a.cyan}${h} minor improvements${a.reset}\n`),p>0&&d(`HIGH ERROR: Fix these to ensure your documentation builds correctly.`),(m>0||h>0)&&u(`TIP: Address warnings and suggestions for premium quality docs.`),console.log(``)}u(`Finished in ${(performance.now()-o).toFixed(2)}ms\n`),p>0&&process.exit(1)}catch(e){d(`Failed to run doctor check:`,e),process.exit(1)}}const _=(0,a.default)(`boltdocs`);_.command(`[root]`,`Start development server`).alias(`dev`).action(p),_.command(`build [root]`,`Build for production`).action(m),_.command(`preview [root]`,`Preview production build`).action(h),_.command(`doctor [root]`,`Check documentation health`).action(g),_.help(),_.version(`2.0.0`),_.parse();
@@ -4,5 +4,5 @@
4
4
  * Copyright (c) 2026 Jesus Alcala
5
5
  * Licensed under the MIT License.
6
6
  */
7
- import{g as e,n as t,v as n,y as r}from"../node-BgvNl2Ay.mjs";import{preview as i}from"vite";import a from"fast-glob";import o from"fs";import s from"path";import c from"cac";import{build as l,createServer as u}from"@bdocs/ssg/node";var d=Object.defineProperty,f=((e,t)=>{let n={};for(var r in e)d(n,r,{get:e[r],enumerable:!0});return t||d(n,Symbol.toStringTag,{value:`Module`}),n})({colors:()=>p,error:()=>g,formatLog:()=>m,info:()=>h,success:()=>_});const p={reset:`\x1B[0m`,bold:`\x1B[1m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,cyan:`\x1B[36m`,gray:`\x1B[90m`};function m(e,t=``){return`${t}${p.bold}[boltdocs]${p.reset} ${e}${p.reset}`}function h(e){console.log(m(e))}function g(e,t){console.error(m(e,p.red)),t&&console.error(t)}function _(e){console.log(m(e,p.green))}async function v(e=process.cwd()){try{let n=await u(await t(e,`development`));await n.listen(),n.printUrls(),n.bindCLIShortcuts({print:!0})}catch(e){g(`Failed to start dev server:`,e),process.exit(1)}}async function y(e=process.cwd()){try{await l({entry:`boltdocs/entry`},await t(e,`production`)),_(`SSG build completed successfully!`)}catch(e){g(`Build failed:`,e),process.exit(1)}}async function b(e=process.cwd()){try{(await i(await t(e,`production`))).printUrls()}catch(e){g(`Failed to start preview server:`,e),process.exit(1)}}async function x(t=process.cwd()){let{colors:i}=f;h(`${i.bold}Running documentation health check...${i.reset}\n`);let c=performance.now();try{let l=await e(`docs`,t),u=s.resolve(t,`docs`);o.existsSync(u)||(g(`Documentation directory not found at ${u}`),process.exit(1));let d=await a([`**/*.md`,`**/*.mdx`],{cwd:u,absolute:!0,suppressErrors:!0}),f=0,p=0,m=0,v=new Map,y=(e,t)=>{let n=s.relative(u,e),r=v.get(n);r||(r=[],v.set(n,r)),r.push(t),t.level===`high`?f++:t.level===`warning`?p++:t.level===`low`&&m++},b=`/docs`;for(let e of d){let{data:t,content:n}=r(e);t.title||y(e,{level:`warning`,message:`Missing "title" in frontmatter.`,suggestion:"Add `title: Your Title` to the YAML frontmatter at the top of the file."}),t.description||y(e,{level:`low`,message:`Missing "description" in frontmatter.`,suggestion:`Adding a description helps with SEO and search previews.`});let i=/\[.*?\]\((.*?)\)/g,a=/<a\s+[^>]*href=["']([^"']+)["'][^>]*>/g,c=[...n.matchAll(i),...n.matchAll(a)];for(let t of c){let n=t[1];if(!n||n.startsWith(`http`)||n.startsWith(`https`)||n.startsWith(`#`)||n.startsWith(`mailto:`)||n.startsWith(`tel:`)||(n=n.split(`#`)[0],!n))continue;let r;if(n.startsWith(`/`)){let e=n;(n.startsWith(b+`/`)||n===b)&&(e=n.substring(5)),r=s.join(u,e)}else r=s.resolve(s.dirname(e),n);let i=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`],a=!1;for(let e of i){let t=r+e;if(o.existsSync(t)&&o.statSync(t).isFile()){a=!0;break}}a||y(e,{level:`high`,message:`Broken internal link: "${n}"`,suggestion:`Ensure the file exists at "${r}". If it's a directory, ensure it has an "index.md" or "index.mdx".`})}}if(l.i18n){let{defaultLocale:e,locales:t}=l.i18n,r=Object.keys(t).filter(t=>t!==e);for(let t of d){let i=n(s.relative(u,t)).split(`/`);if(i[0]===e){let e=i.slice(1).join(`/`);for(let n of r){let r=[n,...i.slice(1)],a=s.join(u,...r);o.existsSync(a)||y(t,{level:`warning`,message:`Missing translation for locale "${n}"`,suggestion:`Create a translated version of this file at "${n}/${e}".`})}}}}if(v.size===0)_(`All documentation files are healthy!
7
+ import{g as e,n as t,v as n,y as r}from"../node-CWN8U_p8.mjs";import{preview as i}from"vite";import a from"fast-glob";import o from"fs";import s from"path";import c from"cac";import{build as l,createServer as u}from"@bdocs/ssg/node";var d=Object.defineProperty,f=((e,t)=>{let n={};for(var r in e)d(n,r,{get:e[r],enumerable:!0});return t||d(n,Symbol.toStringTag,{value:`Module`}),n})({colors:()=>p,error:()=>g,formatLog:()=>m,info:()=>h,success:()=>_});const p={reset:`\x1B[0m`,bold:`\x1B[1m`,red:`\x1B[31m`,green:`\x1B[32m`,yellow:`\x1B[33m`,blue:`\x1B[34m`,cyan:`\x1B[36m`,gray:`\x1B[90m`};function m(e,t=``){return`${t}${p.bold}[boltdocs]${p.reset} ${e}${p.reset}`}function h(e){console.log(m(e))}function g(e,t){console.error(m(e,p.red)),t&&console.error(t)}function _(e){console.log(m(e,p.green))}async function v(e=process.cwd()){try{let n=await u(await t(e,`development`));await n.listen(),n.printUrls(),n.bindCLIShortcuts({print:!0})}catch(e){g(`Failed to start dev server:`,e),process.exit(1)}}async function y(e=process.cwd()){try{await l({entry:`boltdocs/entry`},await t(e,`production`)),_(`SSG build completed successfully!`)}catch(e){g(`Build failed:`,e),process.exit(1)}}async function b(e=process.cwd()){try{(await i(await t(e,`production`))).printUrls()}catch(e){g(`Failed to start preview server:`,e),process.exit(1)}}async function x(t=process.cwd()){let{colors:i}=f;h(`${i.bold}Running documentation health check...${i.reset}\n`);let c=performance.now();try{let l=await e(`docs`,t),u=s.resolve(t,`docs`);o.existsSync(u)||(g(`Documentation directory not found at ${u}`),process.exit(1));let d=await a([`**/*.md`,`**/*.mdx`],{cwd:u,absolute:!0,suppressErrors:!0}),f=0,p=0,m=0,v=new Map,y=(e,t)=>{let n=s.relative(u,e),r=v.get(n);r||(r=[],v.set(n,r)),r.push(t),t.level===`high`?f++:t.level===`warning`?p++:t.level===`low`&&m++},b=`/docs`;for(let e of d){let{data:t,content:n}=r(e);t.title||y(e,{level:`warning`,message:`Missing "title" in frontmatter.`,suggestion:"Add `title: Your Title` to the YAML frontmatter at the top of the file."}),t.description||y(e,{level:`low`,message:`Missing "description" in frontmatter.`,suggestion:`Adding a description helps with SEO and search previews.`});let i=/\[.*?\]\((.*?)\)/g,a=/<a\s+[^>]*href=["']([^"']+)["'][^>]*>/g,c=[...n.matchAll(i),...n.matchAll(a)];for(let t of c){let n=t[1];if(!n||n.startsWith(`http`)||n.startsWith(`https`)||n.startsWith(`#`)||n.startsWith(`mailto:`)||n.startsWith(`tel:`)||(n=n.split(`#`)[0],!n))continue;let r;if(n.startsWith(`/`)){let e=n;(n.startsWith(b+`/`)||n===b)&&(e=n.substring(5)),r=s.join(u,e)}else r=s.resolve(s.dirname(e),n);let i=[``,`.md`,`.mdx`,`/index.md`,`/index.mdx`],a=!1;for(let e of i){let t=r+e;if(o.existsSync(t)&&o.statSync(t).isFile()){a=!0;break}}a||y(e,{level:`high`,message:`Broken internal link: "${n}"`,suggestion:`Ensure the file exists at "${r}". If it's a directory, ensure it has an "index.md" or "index.mdx".`})}}if(l.i18n){let{defaultLocale:e,locales:t}=l.i18n,r=Object.keys(t).filter(t=>t!==e);for(let t of d){let i=n(s.relative(u,t)).split(`/`);if(i[0]===e){let e=i.slice(1).join(`/`);for(let n of r){let r=[n,...i.slice(1)],a=s.join(u,...r);o.existsSync(a)||y(t,{level:`warning`,message:`Missing translation for locale "${n}"`,suggestion:`Create a translated version of this file at "${n}/${e}".`})}}}}if(v.size===0)_(`All documentation files are healthy!
8
8
  `);else{for(let[e,t]of v.entries()){console.log(`📄 ${i.bold}${e}${i.reset}`);let n=t.sort((e,t)=>{let n={high:1,warning:2,low:3};return n[e.level]-n[t.level]});for(let e of n){let t=``,n=``;e.level===`high`?(t=`❌`,n=i.red):e.level===`warning`?(t=`⚠️`,n=i.yellow):(t=`ℹ️`,n=i.cyan),console.log(` ${n}${t} ${e.level.toUpperCase()}:${i.reset} ${e.message}`),e.suggestion&&console.log(` ${i.gray}💡 Suggestion: ${e.suggestion}${i.reset}`)}console.log(``)}console.log(`${i.bold}Summary:${i.reset}`),console.log(` ${i.red}${f} high-level errors${i.reset}`),console.log(` ${i.yellow}${p} warnings${i.reset}`),console.log(` ${i.cyan}${m} minor improvements${i.reset}\n`),f>0&&g(`HIGH ERROR: Fix these to ensure your documentation builds correctly.`),(p>0||m>0)&&h(`TIP: Address warnings and suggestions for premium quality docs.`),console.log(``)}h(`Finished in ${(performance.now()-c).toFixed(2)}ms\n`),f>0&&process.exit(1)}catch(e){g(`Failed to run doctor check:`,e),process.exit(1)}}const S=c(`boltdocs`);S.command(`[root]`,`Start development server`).alias(`dev`).action(v),S.command(`build [root]`,`Build for production`).action(y),S.command(`preview [root]`,`Preview production build`).action(b),S.command(`doctor [root]`,`Check documentation health`).action(x),S.help(),S.version(`2.0.0`),S.parse();export{};
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`../node-vkbb0MK7.cjs`);exports.BoltdocsPluginStore=e.l,exports.PluginCompatibilityError=e.u,exports.PluginError=e.d,exports.PluginHookError=e.f,exports.PluginLifecycleManager=e.i,exports.PluginPermissionError=e.p,exports.PluginSandbox=e.a,exports.PluginValidationError=e.m,exports.SecurePluginSchema=e.o,exports.createPlugin=e.r,exports.createViteConfig=e.n,exports.default=e.t,exports.defineConfig=e._,exports.generateEntryCode=e.h,exports.hasPermission=e.s,exports.resolveConfig=e.g,exports.validatePlugins=e.c;
6
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`../node-D5iosYXv.cjs`);exports.BoltdocsPluginStore=e.l,exports.PluginCompatibilityError=e.u,exports.PluginError=e.d,exports.PluginHookError=e.f,exports.PluginLifecycleManager=e.i,exports.PluginPermissionError=e.p,exports.PluginSandbox=e.a,exports.PluginValidationError=e.m,exports.SecurePluginSchema=e.o,exports.createPlugin=e.r,exports.createViteConfig=e.n,exports.default=e.t,exports.defineConfig=e._,exports.generateEntryCode=e.h,exports.hasPermission=e.s,exports.normalizePath=e.v,exports.resolveConfig=e.g,exports.sanitizeFilename=e.b,exports.validatePlugins=e.c;
@@ -261,6 +261,24 @@ interface RouteMeta {
261
261
  seo?: Record<string, any>;
262
262
  }
263
263
  //#endregion
264
+ //#region src/node/utils.d.ts
265
+ /**
266
+ * Normalizes a file path by replacing Windows backslashes with forward slashes.
267
+ * Ensures consistent path handling across different operating systems.
268
+ *
269
+ * @param p - The file path to normalize
270
+ * @returns The normalized path using forward slashes
271
+ */
272
+ declare function normalizePath(p: string): string;
273
+ /**
274
+ * Sanitizes a filename or path component by removing dangerous characters.
275
+ * Prevents multiple dots to avoid path traversal tricks.
276
+ *
277
+ * @param name - The name to sanitize
278
+ * @returns The sanitized name
279
+ */
280
+ declare function sanitizeFilename(name: string): string;
281
+ //#endregion
264
282
  //#region src/node/plugins/plugin-types.d.ts
265
283
  /**
266
284
  * Permissions that a plugin can request to access specific Boltdocs capabilities.
@@ -516,4 +534,4 @@ declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
516
534
  */
517
535
  declare function createViteConfig(root: string, mode?: 'development' | 'production'): Promise<InlineConfig>;
518
536
  //#endregion
519
- export { type BoltdocsConfig, type BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, PluginCompatibilityError, PluginContext, PluginError, PluginHookError, PluginLifecycleHooks, PluginLifecycleManager, PluginLogger, PluginMeta, PluginPermission, PluginPermissionError, PluginSandbox, PluginStore, PluginValidationError, type RouteMeta, SecureBoltdocsPlugin, SecurePluginSchema, createPlugin, createViteConfig, boltdocs as default, defineConfig, generateEntryCode, hasPermission, resolveConfig, validatePlugins };
537
+ export { type BoltdocsConfig, type BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, PluginCompatibilityError, PluginContext, PluginError, PluginHookError, PluginLifecycleHooks, PluginLifecycleManager, PluginLogger, PluginMeta, PluginPermission, PluginPermissionError, PluginSandbox, PluginStore, PluginValidationError, type RouteMeta, SecureBoltdocsPlugin, SecurePluginSchema, createPlugin, createViteConfig, boltdocs as default, defineConfig, generateEntryCode, hasPermission, normalizePath, resolveConfig, sanitizeFilename, validatePlugins };
@@ -261,6 +261,24 @@ interface RouteMeta {
261
261
  seo?: Record<string, any>;
262
262
  }
263
263
  //#endregion
264
+ //#region src/node/utils.d.ts
265
+ /**
266
+ * Normalizes a file path by replacing Windows backslashes with forward slashes.
267
+ * Ensures consistent path handling across different operating systems.
268
+ *
269
+ * @param p - The file path to normalize
270
+ * @returns The normalized path using forward slashes
271
+ */
272
+ declare function normalizePath(p: string): string;
273
+ /**
274
+ * Sanitizes a filename or path component by removing dangerous characters.
275
+ * Prevents multiple dots to avoid path traversal tricks.
276
+ *
277
+ * @param name - The name to sanitize
278
+ * @returns The sanitized name
279
+ */
280
+ declare function sanitizeFilename(name: string): string;
281
+ //#endregion
264
282
  //#region src/node/plugins/plugin-types.d.ts
265
283
  /**
266
284
  * Permissions that a plugin can request to access specific Boltdocs capabilities.
@@ -516,4 +534,4 @@ declare function boltdocs(options?: BoltdocsPluginOptions): Promise<Plugin[]>;
516
534
  */
517
535
  declare function createViteConfig(root: string, mode?: 'development' | 'production'): Promise<InlineConfig>;
518
536
  //#endregion
519
- export { type BoltdocsConfig, type BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, PluginCompatibilityError, PluginContext, PluginError, PluginHookError, PluginLifecycleHooks, PluginLifecycleManager, PluginLogger, PluginMeta, PluginPermission, PluginPermissionError, PluginSandbox, PluginStore, PluginValidationError, type RouteMeta, SecureBoltdocsPlugin, SecurePluginSchema, createPlugin, createViteConfig, boltdocs as default, defineConfig, generateEntryCode, hasPermission, resolveConfig, validatePlugins };
537
+ export { type BoltdocsConfig, type BoltdocsPlugin, type BoltdocsPluginOptions, BoltdocsPluginStore, type BoltdocsThemeConfig, PluginCompatibilityError, PluginContext, PluginError, PluginHookError, PluginLifecycleHooks, PluginLifecycleManager, PluginLogger, PluginMeta, PluginPermission, PluginPermissionError, PluginSandbox, PluginStore, PluginValidationError, type RouteMeta, SecureBoltdocsPlugin, SecurePluginSchema, createPlugin, createViteConfig, boltdocs as default, defineConfig, generateEntryCode, hasPermission, normalizePath, resolveConfig, sanitizeFilename, validatePlugins };
@@ -3,4 +3,4 @@
3
3
  * Copyright (c) 2026 Jesus Alcala
4
4
  * Licensed under the MIT License.
5
5
  */
6
- import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as g}from"../node-BgvNl2Ay.mjs";export{c as BoltdocsPluginStore,g as PluginCompatibilityError,r as PluginError,i as PluginHookError,s as PluginLifecycleManager,f as PluginPermissionError,t as PluginSandbox,l as PluginValidationError,d as SecurePluginSchema,p as createPlugin,u as createViteConfig,h as default,e as defineConfig,o as generateEntryCode,m as hasPermission,a as resolveConfig,n as validatePlugins};
6
+ import{_ as e,a as t,b as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _,v}from"../node-CWN8U_p8.mjs";export{l as BoltdocsPluginStore,_ as PluginCompatibilityError,i as PluginError,a as PluginHookError,c as PluginLifecycleManager,p as PluginPermissionError,t as PluginSandbox,u as PluginValidationError,f as SecurePluginSchema,m as createPlugin,d as createViteConfig,g as default,e as defineConfig,s as generateEntryCode,h as hasPermission,v as normalizePath,o as resolveConfig,n as sanitizeFilename,r as validatePlugins};
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Boltdocs - https://boltdocs.vercel.app
3
+ * Copyright (c) 2026 Jesus Alcala
4
+ * Licensed under the MIT License.
5
+ */
6
+ import e from"@vitejs/plugin-react";import t from"@tailwindcss/vite";import n from"node:path";import{fileURLToPath as r}from"node:url";import{loadConfigFromFile as i,loadEnv as a,normalizePath as o}from"vite";import s from"fast-glob";import c from"fs";import l from"gray-matter";import u from"isomorphic-dompurify";import{z as d}from"zod";import f from"path";import p from"crypto";import m from"zlib";import{promisify as h}from"util";import ee from"github-slugger";import{ViteImageOptimizer as te}from"vite-plugin-image-optimizer";import g from"node:fs";import _ from"semver";import ne from"@mdx-js/rollup";import re from"remark-gfm";import ie from"remark-frontmatter";import ae from"rehype-slug";import{visit as v}from"unist-util-visit";import{createJavaScriptRegexEngine as y}from"shiki/engine/javascript";import{createHighlighterCore as b}from"shiki/core";import x from"@shikijs/themes/github-light";import S from"@shikijs/themes/github-dark";import C from"@shikijs/themes/tokyo-night";import w from"@shikijs/themes/dracula";import oe from"@shikijs/themes/nord";import T from"@shikijs/themes/one-dark-pro";import E from"@shikijs/themes/one-light";import D from"@shikijs/langs/html";import se from"@shikijs/langs/js";import ce from"@shikijs/langs/ts";import le from"@shikijs/langs/tsx";import ue from"@shikijs/langs/css";import de from"@shikijs/langs/json";import fe from"@shikijs/langs/bash";import pe from"@shikijs/langs/markdown";import me from"@shikijs/langs/mdx";import he from"@shikijs/langs/yaml";import ge from"@shikijs/langs/rust";import _e from"@shikijs/langs/toml";const O=n.dirname(r(import.meta.url)),ve=/^[a-zA-Z0-9\-_\/\.\(\)]+$/,ye=d.object({title:d.string().max(200).optional(),description:d.string().max(500).optional(),sidebarPosition:d.number().optional(),sidebarLabel:d.string().max(100).optional(),category:d.string().max(50).optional(),order:d.number().optional(),badge:d.string().max(50).optional(),icon:d.string().max(50).optional()});var k=class e extends Error{constructor(t){super(t),this.name=`SecurityViolationError`,Object.setPrototypeOf(this,e.prototype)}},be=class e extends k{constructor(t){super(t),this.name=`PathTraversalError`,Object.setPrototypeOf(this,e.prototype)}},xe=class e extends k{constructor(t){super(t),this.name=`EncodingSecurityError`,Object.setPrototypeOf(this,e.prototype)}},A=class e extends k{constructor(t){super(t),this.name=`ValidationError`,Object.setPrototypeOf(this,e.prototype)}};function j(e){return e.replace(/\\/g,`/`)}function M(e){return e.replace(/^\d+\./,``)}function N(e){let t=e.match(/^(\d+)\./);return t?parseInt(t[1],10):void 0}function Se(e){return/\.mdx?$/.test(e)}function P(e){try{return c.statSync(e).mtimeMs}catch{return 0}}function Ce(e){let t=c.readFileSync(e,`utf-8`);try{let{data:n,content:r,matter:i}=l(t);if(i&&i.length>10240)throw R(`FRONTMATTER_TOO_LARGE`,`Frontmatter block exceeds size limit`,{size:i.length,file:e}),new A(`Security breach: Frontmatter size exceeds limit of 10240 bytes`);let a=ye.safeParse(n);a.success||console.warn(`[VALIDATION][${e}] Invalid frontmatter fields detected.`);let o={...a.success?a.data:{}};return o.title&&=I(o.title).trim(),o.description&&=I(o.description).trim(),{data:o,content:r}}catch(e){if(e instanceof A)throw e;return{data:{},content:t}}}function we(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&apos;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function Te(e){return we(e)}function Ee(e){let t=e.split(`/`).map(e=>M(De(e))).join(`/`).replace(/\/$/,``);return t=t.replace(/\.mdx?$/,``),(t===`index`||t.endsWith(`/index`))&&(t=t.replace(/index$/,``)),t.startsWith(`/`)||(t=`/`+t),t.length>1&&t.endsWith(`/`)&&(t=t.slice(0,-1)),t}function F(e){return u.sanitize(e,{ALLOWED_TAGS:`b.i.em.strong.a.p.br.code.pre.span.div.h1.h2.h3.h4.h5.h6.ul.ol.li.table.thead.tbody.tr.th.td.blockquote.hr`.split(`.`),ALLOWED_ATTR:[`href`,`title`,`target`,`class`,`id`,`src`,`alt`,`width`,`height`],FORCE_BODY:!0})}u.addHook(`afterSanitizeAttributes`,e=>{if(e.hasAttribute(`href`)){let t=e.getAttribute(`href`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`href`)}if(e.hasAttribute(`src`)){let t=e.getAttribute(`src`)?.toLowerCase()||``;(t.startsWith(`javascript:`)||t.startsWith(`data:`)||t.startsWith(`vbscript:`))&&e.removeAttribute(`src`)}});function I(e){return u.sanitize(e,{ALLOWED_TAGS:[],KEEP_CONTENT:!0})}function L(e){return e.charAt(0).toUpperCase()+e.slice(1)}function De(e){return e.replace(/[^a-zA-Z0-9\-_\/\.]/g,``).split(`/`).filter(e=>e!==`..`&&e!==`.`).map(e=>e.replace(/\.\.+/g,`.`)).join(`/`)}function R(e,t,n={}){let r=new Date().toISOString(),i={...n};for(let e in i)typeof i[e]==`string`&&i[e].includes(`:`)&&(i[e]=i[e].split(/[\\/]/).pop()||i[e]);console.error(`[SECURITY][${r}] TYPE: ${e} | MESSAGE: ${t} | DETAILS: ${JSON.stringify(i)}`)}const z=h(c.writeFile),Oe=h(c.readFile),B=h(c.mkdir),ke=h(c.rename);h(c.unlink);const Ae=process.env.BOLTDOCS_CACHE_DIR||`.boltdocs`,je=parseInt(process.env.BOLTDOCS_CACHE_LRU_LIMIT||`2000`,10),Me=process.env.BOLTDOCS_CACHE_COMPRESS!==`0`;var Ne=class{cache=new Map;constructor(e){this.limit=e}get(e){let t=this.cache.get(e);return t!==void 0&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){if(this.cache.has(e))this.cache.delete(e);else if(this.cache.size>=this.limit){let e=this.cache.keys().next().value;e!==void 0&&this.cache.delete(e)}this.cache.set(e,t)}get size(){return this.cache.size}clear(){this.cache.clear()}};const V=new class{queue=Promise.resolve();pendingCount=0;add(e){this.pendingCount++,this.queue=this.queue.then(e).finally(()=>{this.pendingCount--})}async flush(){await this.queue}get pending(){return this.pendingCount}};var Pe=class{entries=new Map;cachePath=null;compress;constructor(e={}){if(this.compress=e.compress===void 0?Me:e.compress,e.name){let t=e.root||process.cwd(),n=this.compress?`json.gz`:`json`;this.cachePath=f.resolve(t,Ae,`${e.name}.${n}`)}}load(){if(process.env.BOLTDOCS_NO_CACHE!==`1`&&!(!this.cachePath||!c.existsSync(this.cachePath)))try{let e=c.readFileSync(this.cachePath);this.cachePath.endsWith(`.gz`)&&(e=m.gunzipSync(e));let t=JSON.parse(e.toString(`utf-8`));this.entries=new Map(Object.entries(t))}catch{}}save(){if(process.env.BOLTDOCS_NO_CACHE===`1`||!this.cachePath)return;let e=Object.fromEntries(this.entries),t=JSON.stringify(e),n=this.cachePath,r=this.compress;V.add(async()=>{try{await B(f.dirname(n),{recursive:!0});let e=Buffer.from(t);r&&(e=m.gzipSync(e));let i=`${n}.${p.randomBytes(4).toString(`hex`)}.tmp`;await z(i,e),await ke(i,n)}catch{}})}get(e){let t=this.entries.get(e);return!t||P(e)!==t.mtime?null:t.data}set(e,t){this.entries.set(e,{data:t,mtime:P(e)})}isValid(e){let t=this.entries.get(e);return t?P(e)===t.mtime:!1}invalidate(e){this.entries.delete(e)}invalidateAll(){this.entries.clear()}pruneStale(e){for(let t of this.entries.keys())e.has(t)||this.entries.delete(t)}get size(){return this.entries.size}async flush(){await V.flush()}},Fe=class{index=new Map;memoryCache=new Ne(je);baseDir;shardsDir;indexPath;constructor(e,t=process.cwd()){this.baseDir=f.resolve(t,Ae,`transform-${e}`),this.shardsDir=f.resolve(this.baseDir,`shards`),this.indexPath=f.resolve(this.baseDir,`index.json`)}load(){if(process.env.BOLTDOCS_NO_CACHE!==`1`&&c.existsSync(this.indexPath))try{let e=c.readFileSync(this.indexPath,`utf-8`);this.index=new Map(Object.entries(JSON.parse(e)))}catch{}}save(){if(process.env.BOLTDOCS_NO_CACHE===`1`)return;let e=JSON.stringify(Object.fromEntries(this.index)),t=this.indexPath;V.add(async()=>{await B(f.dirname(t),{recursive:!0}),await z(t,e)})}async getMany(e){let t=new Map,n=[];for(let r of e){let e=this.memoryCache.get(r);e?t.set(r,e):this.index.has(r)&&n.push(r)}if(n.length>0){let e=await Promise.all(n.map(async e=>{let t=this.index.get(e),n=f.resolve(this.shardsDir,`${t}.gz`);try{let t=await Oe(n),r=m.gunzipSync(t).toString(`utf-8`);return this.memoryCache.set(e,r),{key:e,val:r}}catch{return null}}));for(let n of e)n&&t.set(n.key,n.val)}return t}get(e){let t=this.memoryCache.get(e);if(t)return t;let n=this.index.get(e);if(!n)return null;let r=f.resolve(this.shardsDir,`${n}.gz`);if(!c.existsSync(r))return null;try{let t=c.readFileSync(r),n=m.gunzipSync(t).toString(`utf-8`);return this.memoryCache.set(e,n),n}catch{return null}}set(e,t){let n=p.createHash(`md5`).update(t).digest(`hex`);this.index.set(e,n),this.memoryCache.set(e,t);let r=f.resolve(this.shardsDir,`${n}.gz`);V.add(async()=>{if(c.existsSync(r))return;await B(this.shardsDir,{recursive:!0});let e=m.gzipSync(Buffer.from(t)),n=`${r}.${p.randomBytes(4).toString(`hex`)}.tmp`;await z(n,e),await ke(n,r)})}get size(){return this.index.size}async flush(){await V.flush()}};const H=new Pe({name:`routes`});function Ie(){H.invalidateAll()}function Le(e){H.invalidate(e)}function Re(e,t,n,r){let i;try{i=decodeURIComponent(e)}catch{let t=f.basename(e);throw R(`ENCODING_ERROR`,`Invalid character encoding`,{file:t}),new xe(`Security breach: Invalid characters or encoding in path: ${t}`)}if(i.length>260){let e=f.basename(i);throw R(`PATH_TOO_LONG`,`Path length exceeds limit`,{length:i.length,file:e}),new be(`Security breach: Path length exceeds limit of 260 characters: ${e}`)}let a=f.resolve(i),o=f.resolve(t),s=j(f.relative(o,a));if(s.startsWith(`../`)||s===`..`||a.includes(`\0`)||!ve.test(s)){let t=f.basename(e);throw R(`PATH_TRAVERSAL_ATTEMPT`,`Path traversal or invalid characters detected`,{path:s}),new be(`Security breach: File is outside of docs directory, contains null bytes, or invalid characters: ${t}`)}let{data:c,content:l}=Ce(e),u=s.split(`/`),d,p;if(r?.versions&&u.length>0){let e=u[0],t=r.versions.prefix||``,n=r.versions.versions.find(n=>e===t+n.path||e===n.path);n&&(p=n.path,u=u.slice(1))}if(r?.i18n&&u.length>0){let e=u[0];r.i18n.locales[e]&&(d=e,u=u.slice(1))}let m;if(u.length>0){let e=u[0].match(/^\((.+)\)$/);e&&(m=e[1].toLowerCase(),u=u.slice(1))}let h;u=u.map(e=>{let t=M(e);return t.startsWith(`_`)&&t!==`_`?(h=t.substring(1),e.substring(0,e.length-t.length)+t.substring(1)):e});let te=u.join(`/`),g;g=c.permalink?c.permalink.startsWith(`/`)?c.permalink:`/${c.permalink}`:Ee(te||`index.md`);let _=n;p&&(_+=`/`+p),d&&(_+=`/`+d),m&&(_+=`/`+m),_+=g===`/`?``:g,(!_||_===``)&&(_=`/`);let ne=u[u.length-1],re=M(ne),ie=M(f.basename(e,f.extname(e))),ae=c.sidebarPosition??N(ne),v=u.length>=2?u[0]:void 0,y=v?M(v):void 0,b=u.length===2&&/^index\.mdx?$/.test(re),x=new ee,S=[];for(let e of l.matchAll(/^(#{2,4})\s+(.+)$/gm)){let t=e[1].length,n=F(e[2].replace(/\[([^\]]+)\]\([^\)]+\)/g,`$1`).replace(/[_*`]/g,``).trim()).trim(),r=x.slug(n);S.push({level:t,text:n,id:r})}let C=c.title?F(String(c.title)):ie,w=c.description?F(String(c.description)):``;!w&&l&&(w=I(l.replace(/^#+.*$/gm,``).replace(/\[([^\]]+)\]\([^\)]+\)/g,`$1`).replace(/[_*`]/g,``).replace(/\s+/g,` `)).trim().slice(0,160));let oe=c.badge?F(String(c.badge)):void 0,T=c.icon?String(c.icon):void 0,E=ze(l),D={},se=[`og:`,`twitter:`,`article:`,`music:`,`video:`,`profile:`,`book:`],ce=[`noindex`,`robots`,`canonical`,`keywords`,`author`];c.seo&&typeof c.seo==`object`&&Object.assign(D,c.seo);for(let e of Object.keys(c))(ce.includes(e)||se.some(t=>e.startsWith(t)))&&(D[e]=c[e]);return c.hidden===!0&&D.noindex===void 0&&(D.noindex=!0),{route:{path:_,componentPath:e,filePath:s,title:C,description:w,sidebarPosition:ae,headings:S,locale:d,version:p,badge:oe,icon:T,tab:m,subRouteGroup:h,_content:E,_rawContent:l,seo:Object.keys(D).length>0?D:void 0},relativeDir:y,isGroupIndex:b,inferredTab:m,groupMeta:b?{title:c.groupTitle||c.title||(y?L(y):``),position:c.groupPosition??c.sidebarPosition??(v?N(v):void 0),icon:T}:void 0,inferredGroupPosition:v?N(v):void 0}}function ze(e){return I(e.replace(/^#+.*$/gm,``).replace(/\[([^\]]+)\]\([^\)]+\)/g,`$1`).replace(/\{[^\}]+\}/g,``).replace(/[_*`]/g,``).replace(/\s+/g,` `)).trim()}function Be(e){return e.sort((e,t)=>!e.group&&!t.group?Ve(e,t):e.group?t.group?e.group===t.group?Ve(e,t):He(e,t):1:-1)}function Ve(e,t){return e.sidebarPosition!==void 0&&t.sidebarPosition!==void 0?e.sidebarPosition-t.sidebarPosition:e.sidebarPosition===void 0?t.sidebarPosition===void 0?e.title.localeCompare(t.title):1:-1}function He(e,t){return e.groupPosition!==void 0&&t.groupPosition!==void 0?e.groupPosition-t.groupPosition:e.groupPosition===void 0?t.groupPosition===void 0?(e.groupTitle||e.group).localeCompare(t.groupTitle||t.group):1:-1}let U=null;const W=new Map;async function G(e,t,n=`/docs`,r=!0){H.load(),W.clear(),(process.env.BOLTDOCS_FORCE_REPARSE===`true`||t?.i18n)&&H.invalidateAll();let i;!r&&U?i=U:(i=await s([`**/*.md`,`**/*.mdx`],{cwd:e,absolute:!0,suppressErrors:!0,followSymbolicLinks:!1}),U=i),H.pruneStale(new Set(i));let a=[],o=0;for(let r=0;r<i.length;r+=50){let s=i.slice(r,r+50),c=await Promise.all(s.map(async r=>{let i=H.get(r);if(i)return o++,i;let a=Re(r,e,n,t);return H.set(r,a),a}));a.push(...c),r+50<i.length&&await new Promise(e=>setImmediate(e))}H.save();let c=new Map,l=[];for(let e of a)if(e.isGroupIndex&&e.relativeDir&&l.push(e),e.relativeDir){let t=c.get(e.relativeDir);t?t.position===void 0&&e.inferredGroupPosition!==void 0&&(t.position=e.inferredGroupPosition):(t={title:L(e.relativeDir),position:e.inferredGroupPosition},c.set(e.relativeDir,t))}for(let e of l){let t=c.get(e.relativeDir);e.groupMeta&&(t.title=e.groupMeta.title,e.groupMeta.position!==void 0&&(t.position=e.groupMeta.position),e.groupMeta.icon&&(t.icon=e.groupMeta.icon))}if(t?.theme?.sidebarGroups)for(let[e,n]of Object.entries(t.theme.sidebarGroups)){let t=c.get(e);t?(n.title&&(t.title=n.title),n.icon&&(t.icon=n.icon)):c.set(e,{title:n.title||L(e),icon:n.icon})}let u=Array(a.length);for(let e=0;e<a.length;e++){let t=a[e],n=t.relativeDir,r=n?c.get(n):void 0;u[e]={...t.route,group:n,groupTitle:r?.title||(n?L(n):void 0),groupPosition:r?.position,groupIcon:r?.icon}}let d=u;if(t?.i18n){let e=Ue(u,t,n);d=[...u,...e]}return Be(d)}function Ue(e,t,n){let r=t.i18n.defaultLocale,i=Object.keys(t.i18n.locales),a=[],o=new Map,s=[];for(let t of e){let e=t.locale||r;o.has(e)||o.set(e,new Set),o.get(e).add(t.path),e===r&&s.push(t)}for(let e of i){let i=o.get(e)||new Set;for(let o of s){let s=We(o.path,r,e,n,t);s!==o.path&&(i.has(s)||a.push({...o,path:s,locale:e}))}}return a}function We(e,t,n,r,i){let a=`${e}:${n}`,o=W.get(a);if(o)return o;let s=r;if(i?.versions){let t=i.versions.prefix||``;for(let n of i.versions.versions){let i=t+n.path;if(e.startsWith(`${r}/${i}`)){s+=`/`+i;break}if(e.startsWith(`${r}/${n.path}`)){s+=`/`+n.path;break}}}let c=e.substring(s.length),l=`/${t}`;if(c.startsWith(l+`/`))c=`/`+n+`/`+c.substring(l.length+1);else if(c===l)c=`/`+n;else if(c===`/`||c===``)c=`/`+n;else{let e=c.startsWith(`/`)?``:`/`;c=`/`+n+e+c}let u=s+c;return W.size>2e3&&W.clear(),W.set(a,u),u}function Ge(e){return e.map(e=>({path:e.path,filePath:e.filePath,title:e.title,description:e.description||``,sidebarPosition:e.sidebarPosition,badge:e.badge,icon:e.icon,headings:e.headings||[],_content:e._content||``,locale:e.locale,version:e.version,tab:e.tab,group:e.group,groupTitle:e.groupTitle,groupPosition:e.groupPosition,groupIcon:e.groupIcon,subRouteGroup:e.subRouteGroup,seo:e.seo}))}const Ke=d.object({icon:d.string().max(50),link:d.string().url()}),qe=d.object({text:d.string().max(2e3).optional()}),Je=d.enum([`fs:read`,`fs:write`,`vite:config`,`mdx:remark`,`mdx:rehype`,`components`,`hooks:build`,`hooks:dev`]),Ye=d.object({name:d.string(),enforce:d.enum([`pre`,`post`]).optional(),version:d.string().optional(),boltdocsVersion:d.string().optional(),permissions:d.array(Je).optional(),remarkPlugins:d.array(d.any()).optional(),rehypePlugins:d.array(d.any()).optional(),vitePlugins:d.array(d.any()).optional(),components:d.record(d.string(),d.string()).optional(),hooks:d.record(d.string(),d.any()).optional()}),Xe=d.object({title:d.union([d.string(),d.record(d.string(),d.string())]).optional(),description:d.union([d.string(),d.record(d.string(),d.string())]).optional(),logo:d.union([d.string(),d.object({dark:d.string(),light:d.string(),alt:d.string().optional(),width:d.number().optional(),height:d.number().optional()})]).optional(),navbar:d.array(d.object({label:d.union([d.string(),d.record(d.string(),d.string())]),href:d.string()})).optional(),sidebar:d.record(d.string(),d.array(d.object({text:d.string(),link:d.string()}))).optional(),sidebarGroups:d.record(d.string(),d.object({title:d.string().optional(),icon:d.string().optional()})).optional(),socialLinks:d.array(Ke).optional(),footer:qe.optional(),breadcrumbs:d.boolean().optional(),editLink:d.string().refine(e=>!e||e.includes(`:path`),{message:`editLink must contain ':path' placeholder if specified`}).optional(),communityHelp:d.string().url().optional(),version:d.string().max(50).optional(),githubRepo:d.string().max(100).optional(),favicon:d.string().optional(),poweredBy:d.boolean().optional(),tabs:d.array(d.object({id:d.string(),text:d.union([d.string(),d.record(d.string(),d.string())]),icon:d.string().optional()})).optional(),codeTheme:d.union([d.string(),d.object({light:d.string(),dark:d.string()})]).optional(),copyMarkdown:d.union([d.boolean(),d.object({text:d.string().optional(),icon:d.string().optional()})]).optional()}),Ze=d.union([d.string(),d.object({rules:d.array(d.object({userAgent:d.string(),allow:d.union([d.string(),d.array(d.string())]).optional(),disallow:d.union([d.string(),d.array(d.string())]).optional()})).optional(),sitemaps:d.array(d.string().url()).optional()})]),Qe=d.object({defaultLocale:d.string(),locales:d.record(d.string(),d.string()),localeConfigs:d.record(d.string(),d.object({label:d.string().optional(),direction:d.enum([`ltr`,`rtl`]).optional(),htmlLang:d.string().optional(),calendar:d.string().optional()})).optional()}),$e=d.object({defaultVersion:d.string(),prefix:d.string().optional(),versions:d.array(d.object({label:d.string(),path:d.string()}))}),et=d.object({headers:d.record(d.string(),d.string()).optional(),enableCSP:d.boolean().optional(),customHeaders:d.record(d.string(),d.string()).optional()}),tt=d.object({metatags:d.record(d.string(),d.string()).optional(),indexing:d.enum([`all`,`public`]).optional(),thumbnails:d.object({background:d.string().optional()}).optional()}),nt=d.object({siteUrl:d.string().url().optional(),docsDir:d.string().optional(),homePage:d.string().optional(),theme:Xe.optional(),i18n:Qe.optional(),versions:$e.optional(),plugins:d.array(Ye).optional(),robots:Ze.optional(),security:et.optional(),seo:tt.optional(),vite:d.record(d.string(),d.unknown()).optional()});function rt(e){return e}const K=[`boltdocs.config.js`,`boltdocs.config.mjs`,`boltdocs.config.ts`];async function q(e,t=process.cwd()){let r=t,a={docsDir:n.resolve(e),theme:{title:`Boltdocs`,description:`A Vite documentation framework`,navbar:[{label:`Home`,href:`/`},{label:`Documentation`,href:`/docs`}],codeTheme:{light:`github-light`,dark:`github-dark`},poweredBy:!0,breadcrumbs:!0}},o={};for(let e of K){let t=n.resolve(r,e);if(g.existsSync(t))try{let e=await i({command:`serve`,mode:`development`},t,r);if(e){o=e.config;break}}catch(t){console.warn(`[boltdocs] Failed to load config from ${e}:`,t)}}let s={title:o.title,description:o.description,logo:o.logo,favicon:o.favicon,navbar:o.navbar,sidebar:o.sidebar,sidebarGroups:o.theme?.sidebarGroups,socialLinks:o.socialLinks,footer:o.footer,githubRepo:o.githubRepo,tabs:o.tabs,codeTheme:o.codeTheme,copyMarkdown:o.copyMarkdown,breadcrumbs:o.breadcrumbs,poweredBy:o.poweredBy,communityHelp:o.communityHelp,version:o.version,editLink:o.editLink,...o.theme||{}},c=Object.fromEntries(Object.entries(s).filter(([e,t])=>t!==void 0));c.navbar&&=c.navbar.map(e=>({label:e.label||e.text||``,href:e.href||e.link||e.to||``}));let l={docsDir:n.resolve(e),homePage:o.homePage,theme:{...a.theme,...c},i18n:o.i18n,versions:o.versions,siteUrl:o.siteUrl,plugins:o.plugins||[],robots:o.robots,security:o.security,vite:o.vite},u=nt.safeParse(l);if(!u.success)throw new A(`Invalid Boltdocs configuration:\n${u.error.issues.map(e=>` - ${e.path.join(`.`)}: ${e.message}`).join(`
7
+ `)}`);return u.data}function it(e,t){let n=(t.siteUrl||``).replace(/\/$/,``);if(!n)return``;let r=t.seo?.indexing!==`all`&&t.seo?.indexing!==`public`;return`<?xml version="1.0" encoding="UTF-8"?>
8
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
9
+ ${e.filter(e=>e.seo?.noindex||typeof e.seo?.robots==`string`&&e.seo.robots.includes(`noindex`)?!1:(r&&e.seo?.index,!0)).map(e=>` <url>
10
+ <loc>${Te(`${n}${e.path.startsWith(`/`)?e.path:`/${e.path}`}`)}</loc>
11
+ <changefreq>weekly</changefreq>
12
+ <priority>0.7</priority>
13
+ </url>`).join(`
14
+ `)}
15
+ </urlset>`}function at(e){let t=e.siteUrl||``,n=t?`${t.replace(/\/$/,``)}/sitemap.xml`:``;if(e.seo?.indexing!==`all`&&e.seo?.indexing!==`public`&&e.seo?.indexing)return[`User-agent: *`,`Disallow: /`].filter(Boolean).join(`
16
+ `);if(typeof e.robots==`string`)return e.robots;if(e.robots&&typeof e.robots==`object`){let t=e.robots.rules||[],r=e.robots.sitemaps||[],i=t.map(e=>{let t=`User-agent: ${e.userAgent}\n`;return e.allow&&(Array.isArray(e.allow)?t+=e.allow.map(e=>`Allow: ${e}`).join(`
17
+ `)+`
18
+ `:t+=`Allow: ${e.allow}\n`),e.disallow&&(Array.isArray(e.disallow)?t+=e.disallow.map(e=>`Disallow: ${e}`).join(`
19
+ `)+`
20
+ `:t+=`Disallow: ${e.disallow}\n`),t.trim()}).join(`
21
+
22
+ `),a=[...n?[n]:[],...r].map(e=>`Sitemap: ${e}`).join(`
23
+ `);return`${i}${a?`\n\n${a}`:``}`}return[`User-agent: *`,`Allow: /`,``,n?`Sitemap: ${n}`:``].filter(Boolean).join(`
24
+ `)}function J(e,t){let n=e.homePage?`import HomePage from '${j(e.homePage)}';`:``,r=f.resolve(process.cwd(),`index.css`),i=c.existsSync(r)?`import './index.css';`:``,a=e.homePage?`homePage: HomePage,`:``,o=t?.plugins?.flatMap(e=>Object.entries(e.components||{}))||[],s=o.map(([e,t])=>`import * as _comp_${e} from '${j(t)}';
25
+ const ${e} = _comp_${e}.default || _comp_${e}['${e}'] || _comp_${e};`).join(`
26
+ `),l=o.map(([e])=>e).join(`, `),u=f.basename(e.docsDir||`docs`),d=f.resolve(process.cwd(),e.docsDir||`docs`),p=[`tsx`,`ts`,`jsx`,`js`].map(e=>f.resolve(d,`pages-external/index.${e}`)).find(e=>c.existsSync(e)),m=p?`import * as _external_module from '${j(p)}';`:``;return a=p?`homePage: _external_module.homePage || HomePage,`:e.homePage?`homePage: HomePage,`:``,`
27
+ import { ViteReactSSG } from '@bdocs/ssg';
28
+ import { createRoutes } from 'boltdocs/client';
29
+ import _routes from 'virtual:boltdocs-routes.ts';
30
+ import _config from 'virtual:boltdocs-config.ts';
31
+ import _user_mdx_components from 'virtual:boltdocs-mdx-components.tsx';
32
+ import _Layout from 'virtual:boltdocs-layout.tsx';
33
+ ${i}
34
+ ${n}
35
+ ${s}
36
+ ${m}
37
+
38
+ const mdxModules = import.meta.glob('/${u}/**/*.{md,mdx}', { eager: true });
39
+
40
+ export const createRoot = ViteReactSSG(
41
+ {
42
+ routes: createRoutes({
43
+ routesData: _routes,
44
+ config: _config,
45
+ mdxModules,
46
+ Layout: _Layout,
47
+ ${a}
48
+ ${p?`externalPages: _external_module.pages, externalLayout: _external_module.layout,`:``}
49
+ components: { ${l}${l?`, `:``} ...(_user_mdx_components || {}) },
50
+ }),
51
+ },
52
+ ({ isClient }) => {
53
+ // Boltdocs initialization hook
54
+ if (isClient) {
55
+ // Client-side initialization
56
+ }
57
+ },
58
+ );
59
+ `}function ot(e){return`<!doctype html>
60
+ <html lang="en">
61
+ <head>
62
+ <meta charset="UTF-8" />
63
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
64
+ <title>${e.theme?.title||`Boltdocs`}</title>
65
+ </head>
66
+ <body>
67
+ <div id="root"></div>
68
+ </body>
69
+ </html>`}function st(e,t){(!e||!e.includes(`<body`)||!e.includes(`<head`))&&(e=ot(t));let n=t.theme,r=n?.title||`Boltdocs`,i=n?.description||``,a=n?.favicon;!a&&n?.logo&&(a=typeof n.logo==`string`?n.logo:n.logo.light||n.logo.dark);let o=[a?`<link rel="icon" href="${a}">`:``,`<meta name="description" content="${i}">`,`<meta property="og:title" content="${r}">`,`<meta property="og:description" content="${i}">`,`<meta property="og:type" content="website">`,`<meta name="twitter:card" content="summary_large_image">`,`<meta name="twitter:title" content="${r}">`,`<meta name="twitter:description" content="${i}">`,`<meta name="generator" content="Boltdocs">`].filter(Boolean).join(`
70
+ `);return e=e.includes(`<title>`)?e.replace(/<title>.*?<\/title>/,`<title>${r}</title>`):e.replace(`</head>`,` <title>${r}</title>\n </head>`),e=e.replace(`</head>`,` ${o}\n
71
+ <script>
72
+ (function() {
73
+ try {
74
+ var stored = localStorage.getItem("boltdocs-theme");
75
+ var isDark =
76
+ stored === "dark" ||
77
+ (stored !== "light" && window.matchMedia("(prefers-color-scheme: dark)").matches);
78
+ document.documentElement.classList.toggle("dark", isDark);
79
+ document.documentElement.dataset.theme = isDark ? "dark" : "light";
80
+ } catch (e) {}
81
+ })();
82
+ <\/script>
83
+ </head>`),!e.includes(`src/main`)&&!e.includes(`virtual:boltdocs-entry`)&&(e=e.replace(`</body>`,` <script type="module">import "virtual:boltdocs-entry";<\/script>
84
+ </body>`)),e}function ct(e){let t=[];for(let n of e)if(t.push({id:n.path,title:n.title,content:n._content||``,url:n.path,display:n.groupTitle?`${n.groupTitle} > ${n.title}`:n.title,locale:n.locale,version:n.version}),n.headings)for(let e of n.headings)t.push({id:`${n.path}#${e.id}`,title:e.text,content:`${e.text} in ${n.title}`,url:`${n.path}#${e.id}`,display:`${n.title} > ${e.text}`,locale:n.locale,version:n.version});return t}const lt={"X-Content-Type-Options":`nosniff`,"X-Frame-Options":`DENY`,"X-XSS-Protection":`1; mode=block`,"Referrer-Policy":`strict-origin-when-cross-origin`,"Permissions-Policy":`camera=(), microphone=(), geolocation=()`,"Strict-Transport-Security":`max-age=31536000; includeSubDomains`};function ut(e){let t=process.env.NODE_ENV===`development`,n={"default-src":[`'self'`],"script-src":[`'self'`,`'unsafe-inline'`],"style-src":[`'self'`,`'unsafe-inline'`],"img-src":[`'self'`,`data:`,`https:`],"font-src":[`'self'`],"connect-src":[`'self'`]};return t&&(n[`script-src`]=[`'self'`,`'unsafe-eval'`,`'unsafe-inline'`],n[`style-src`]=[`'self'`,`'unsafe-inline'`]),Object.entries(n).map(([e,t])=>`${e} ${t.join(` `)}`).join(`; `)}var Y=class e extends Error{pluginName;constructor(t,n){super(`[plugin:${t}] ${n}`),this.name=`PluginError`,this.pluginName=t,Object.setPrototypeOf(this,e.prototype)}},X=class e extends Y{constructor(t,n){super(t,`Validation failed: ${n}`),this.name=`PluginValidationError`,Object.setPrototypeOf(this,e.prototype)}},dt=class e extends Y{constructor(t,n){super(t,`Compatibility error: ${n}`),this.name=`PluginCompatibilityError`,Object.setPrototypeOf(this,e.prototype)}},ft=class e extends Y{constructor(t,n){super(t,`Missing required permission: '${n}'`),this.name=`PluginPermissionError`,Object.setPrototypeOf(this,e.prototype)}},pt=class e extends Y{hookName;constructor(t,n,r){super(t,`Error in hook '${n}': ${r.message}`),this.name=`PluginHookError`,this.hookName=n,this.stack=r.stack,Object.setPrototypeOf(this,e.prototype)}},mt=class{data=new Map;getNamespaceKey(e,t){return`${e}:${t}`}get(e,t){let n=this.getNamespaceKey(e,t),r=this.data.get(n);if(r!==void 0)return typeof r==`object`&&r?JSON.parse(JSON.stringify(r)):r}set(e,t,n){let r=this.getNamespaceKey(e,t),i=typeof n==`object`&&n?JSON.parse(JSON.stringify(n)):n;this.data.set(r,i)}has(e,t){let n=this.getNamespaceKey(e,t);return this.data.has(n)}};const ht=Ye.extend({version:d.string().optional(),boltdocsVersion:d.string().optional(),permissions:d.array(d.string()).optional(),hooks:d.object({beforeBuild:d.function().optional(),afterBuild:d.function().optional(),beforeDev:d.function().optional(),afterDev:d.function().optional(),configResolved:d.function().optional(),buildEnd:d.function().optional()}).optional()});function gt(e,t){let n=[],r=new Set;for(let i of e){let e=ht.safeParse(i);if(!e.success)throw new X(i.name||`unknown`,e.error.issues.map(e=>`${e.path.join(`.`)}: ${e.message}`).join(`, `));let a=e.data;if(r.has(a.name))throw new X(a.name,`Duplicate plugin name detected`);if(r.add(a.name),a.boltdocsVersion&&!_.satisfies(t,a.boltdocsVersion))throw new dt(a.name,`Plugin expects Boltdocs version ${a.boltdocsVersion}, but current is ${t}`);if(a.components){for(let[e,t]of Object.entries(a.components))if((t.includes(`..`)||f.isAbsolute(t))&&t.includes(`..`))throw new X(a.name,`Component '${e}' has an invalid path: traversal sequences are not allowed.`)}n.push(a)}return n}function Z(e,t){return e.permissions?e.permissions.includes(t):!1}var Q=class{static checkPermission(e,t){if(!Z(e,t))throw new ft(e.name,t)}static getSanitizedCapabilities(e){return{remarkPlugins:Z(e,`mdx:remark`)?e.remarkPlugins:[],rehypePlugins:Z(e,`mdx:rehype`)?e.rehypePlugins:[],vitePlugins:Z(e,`vite:config`)?e.vitePlugins:[],components:Z(e,`components`)?e.components:{}}}static async executeWithIsolation(e,t,n,r){try{return this.checkPermission(e,t),await r()}catch(t){if(t instanceof ft){console.warn(`[boltdocs] Skipping hook '${n}' for plugin '${e.name}': ${t.message}`);return}throw t}}},_t=class{plugins;config;store;constructor(e,t){this.plugins=e,this.config=t,this.store=new mt}async runHook(e,...t){let n=this.getSortedPlugins();for(let r of n){if(!r.hooks?.[e])continue;let n=this.createContext(r),i=e.toLowerCase().includes(`build`),a=e.toLowerCase().includes(`dev`),o=i?`hooks:build`:a?`hooks:dev`:void 0;try{o?await Q.executeWithIsolation(r,o,e,()=>r.hooks[e](n,...t)):await r.hooks[e](n,...t)}catch(t){let i=new pt(r.name,e,t instanceof Error?t:Error(String(t)));n.logger.error(i)}}}getSortedPlugins(){let e=this.plugins.filter(e=>e.enforce===`pre`),t=this.plugins.filter(e=>!e.enforce),n=this.plugins.filter(e=>e.enforce===`post`);return[...e,...t,...n]}createContext(e){return{config:Object.freeze({...this.config}),meta:{name:e.name,version:e.version,boltdocsVersion:e.boltdocsVersion},store:{get:(e,t)=>this.store.get(e,t),set:(e,t,n)=>this.store.set(e,t,n),has:(e,t)=>this.store.has(e,t)},logger:this.createLogger(e.name)}}createLogger(e){let t=`[plugin:${e}]`;return{info:e=>console.log(`${t} INFO: ${e}`),warn:e=>console.warn(`${t} WARN: ${e}`),error:e=>{let n=e instanceof Error?e.message:e;console.error(`${t} ERROR: ${n}`)},debug:e=>console.debug(`${t} DEBUG: ${e}`)}}};function vt(e){return e}function yt(e={},t){let r=n.resolve(process.cwd(),e.docsDir||`docs`),i=j(r),o=t,s,c=!1,l,u=[];return[{name:`vite-plugin-boltdocs`,enforce:`pre`,async config(e,t){c=t.command===`build`;let i=e.envDir||process.cwd(),s=a(t.mode,i,``);Object.assign(process.env,s),o||=await q(r);let d=(await import(`./package-DukYeKmD.mjs`)).version,f=gt(o.plugins||[],d);return o.plugins=f,l=new _t(f,o),u=f.flatMap(e=>Q.getSanitizedCapabilities(e).vitePlugins||[]),c&&await l.runHook(`beforeBuild`),{ssgOptions:{entry:`boltdocs/entry`,htmlEntry:`index.html`,dirStyle:`nested`,includeAllRoutes:!0,mock:!0,script:`async`,beastiesOptions:{preload:`media`},onFinished:async e=>{let t=it(Ge(await G(r,o)),o);t&&g.writeFileSync(n.join(e,`sitemap.xml`),t);let i=at(o);g.writeFileSync(n.join(e,`robots.txt`),i)}},build:{ssrManifest:c},async config(){let e=O;for(;e!==n.parse(e).root&&!g.existsSync(n.join(e,`package.json`));)e=n.dirname(e);if(g.existsSync(n.join(e,`package.json`))&&JSON.parse(g.readFileSync(n.join(e,`package.json`),`utf-8`)).name!==`boltdocs`){let t=n.dirname(e);for(;t!==n.parse(t).root;){if(g.existsSync(n.join(t,`package.json`))&&JSON.parse(g.readFileSync(n.join(t,`package.json`),`utf-8`)).name===`boltdocs`){e=t;break}t=n.dirname(t)}}return{optimizeDeps:{include:[`react`,`react-dom`,`react-dom/client`,`react-router-dom`,`react-helmet-async`],exclude:[`boltdocs`,`boltdocs/client`]},resolve:{dedupe:[`react`,`react-dom`]}}}}},configResolved(e){s=e,l?.runHook(`configResolved`,o)},async configureServer(e){await l?.runHook(`beforeDev`),e.middlewares.use((e,t,n)=>{process.env.NODE_ENV===`production`&&Object.entries(lt).forEach(([e,n])=>{t.setHeader(e,n)}),o.security?.enableCSP&&t.setHeader(`Content-Security-Policy`,ut(o)),n()}),e.middlewares.use((e,t,n)=>{if(e.url===`/robots.txt`){n();return}n()}),e.middlewares.use(async(t,n,r)=>{let i=t.url?.split(`?`)[0]||`/`,a=t.headers.accept||``,s=i===`/`||i.startsWith(`/docs`)||o.i18n&&Object.keys(o.i18n.locales).some(e=>i.startsWith(`/${e}/docs`)||i===`/${e}`)||!0,c=/\.(js|css|png|jpe?g|gif|svg|ico|webp|woff2?|ttf|otf|mp4|webm|ogg|mp3|wav|flac|aac|pdf|zip|gz|map|json)$/i.test(i);if(a.includes(`text/html`)&&!c&&s){let r=ot(o);r=st(r,o),r=await e.transformIndexHtml(t.url||`/`,r),n.statusCode=200,n.setHeader(`Content-Type`,`text/html`),n.end(r);return}r()});let t=K.map(e=>n.resolve(process.cwd(),e)),a=[`tsx`,`jsx`].map(e=>n.resolve(r,`layout.${e}`)),s=[`tsx`,`ts`,`jsx`,`js`],c=s.map(e=>n.resolve(r,`mdx-components.${e}`)),u=s.map(e=>n.resolve(r,`pages-external/index.${e}`)),d=s.map(e=>n.resolve(r,`icons.${e}`));e.watcher.add([...t,...c,...a,...u,...d]);let f=async(t,n)=>{try{let a=j(t);if(K.some(e=>a.endsWith(e))){e.restart();return}if(s.some(e=>a.endsWith(`mdx-components.${e}`))){let t=e.moduleGraph.getModuleById(`\0virtual:boltdocs-mdx-components.tsx`);t&&e.moduleGraph.invalidateModule(t),e.ws.send({type:`full-reload`});return}if(s.some(e=>a.endsWith(`icons.${e}`))){let t=e.moduleGraph.getModuleById(`\0virtual:boltdocs-icons.tsx`);t&&e.moduleGraph.invalidateModule(t),e.ws.send({type:`full-reload`});return}if(a.endsWith(`layout.tsx`)||a.endsWith(`layout.jsx`)){let t=e.moduleGraph.getModuleById(`\0virtual:boltdocs-layout.tsx`);t&&e.moduleGraph.invalidateModule(t),e.ws.send({type:`full-reload`});return}if(a.includes(`/pages-external/`)||a.includes(`\\pages-external\\`)){let t=e.moduleGraph.getModuleById(`\0virtual:boltdocs-entry`);t&&e.moduleGraph.invalidateModule(t),e.ws.send({type:`full-reload`});return}if(!a.startsWith(i)||!Se(a))return;if(n===`add`||n===`unlink`){Ie(),o=await q(r);let t=e.moduleGraph.getModuleById(`\0virtual:boltdocs-config.ts`);t&&e.moduleGraph.invalidateModule(t),e.ws.send({type:`custom`,event:`boltdocs:config-update`,data:{theme:o?.theme,i18n:o?.i18n,versions:o?.versions,siteUrl:o?.siteUrl}})}else Le(t);let c=e.moduleGraph.getModuleById(`\0virtual:boltdocs-routes.ts`);c&&e.moduleGraph.invalidateModule(c);let l=e.moduleGraph.getModuleById(`\0virtual:boltdocs-config.ts`);l&&e.moduleGraph.invalidateModule(l),e.ws.send({type:`full-reload`})}catch(e){console.error(`[boltdocs] HMR error during ${n} event:`,e)}};e.watcher.on(`add`,e=>f(e,`add`)),e.watcher.on(`unlink`,e=>f(e,`unlink`)),e.watcher.on(`change`,e=>f(e,`change`)),await l?.runHook(`afterDev`)},resolveId(e){let t=s?.root||process.cwd();return e.includes(`boltdocs-entry.mjs`)||e===`virtual:boltdocs-entry`||e===`boltdocs-entry`||e===`\0virtual:boltdocs-entry`?j(n.resolve(t,`boltdocs-entry.mjs`)):e.includes(`boltdocs-client.mjs`)||e===`virtual:boltdocs-client`||e===`boltdocs-client`||e===`\0virtual:boltdocs-client.ts`?j(n.resolve(t,`boltdocs-client.mjs`)):e.startsWith(`virtual:boltdocs-`)?`\0`+e:e.startsWith(`\0virtual:boltdocs-`)?e:null},async load(t){if(t.includes(`boltdocs-entry.mjs`)||t===`\0virtual:boltdocs-entry`)return J(e,o);if(t.includes(`boltdocs-client.mjs`)||t===`\0virtual:boltdocs-client.ts`||t===`virtual:boltdocs-client`){let e=O,t=e;for(;e!==n.parse(e).root;){if(g.existsSync(n.join(e,`package.json`))&&JSON.parse(g.readFileSync(n.join(e,`package.json`),`utf-8`)).name===`boltdocs`){t=e;break}e=n.dirname(e)}let r=n.join(t,`src/client/index.ts`),i=n.join(t,`dist/client/index.js`);return`export * from '${j(g.existsSync(r)?r:i)}';`}if(!t.startsWith(`\0virtual:boltdocs-`))return;let i=t.replace(`\0virtual:boltdocs-`,``).replace(/\.tsx?$/,``);if(i===`routes`){let e=Ge(await G(r,o));return`export default ${JSON.stringify(e,null,2)};`}if(i===`config`){let e={theme:o?.theme,i18n:o?.i18n,versions:o?.versions,siteUrl:o?.siteUrl,plugins:o?.plugins?.map(e=>({name:e.name}))};return`export default ${JSON.stringify(e,null,2)};`}if(i===`entry`)return J(e,o);if(i===`mdx-components`){let e=[`tsx`,`ts`,`jsx`,`js`],t=null;for(let i of e){let e=n.resolve(r,`mdx-components.${i}`);if(g.existsSync(e)){t=e;break}}if(t){let e=j(t);return`import * as components from '${e}';
85
+ const mdxComponents = components.default || components;
86
+ export default mdxComponents;
87
+ export * from '${e}';`}return`export default {};`}if(i===`layout`){let e=[`tsx`,`jsx`],t=null;for(let i of e){let e=n.resolve(r,`layout.${i}`);if(g.existsSync(e)){t=e;break}}if(t)return`import UserLayout from '${j(t)}';
88
+ export default UserLayout;`;throw Error(`[Boltdocs] Layout file not found. A 'layout.tsx' or 'layout.jsx' file is mandatory in your docs directory. Please create one to define your site structure.`)}if(i===`icons`){let e=[`tsx`,`jsx`,`ts`,`js`],t=null;for(let i of e){let e=n.resolve(r,`icons.${i}`);if(g.existsSync(e)){t=e;break}}return t?`import * as icons from '${j(t)}';\nexport default icons;`:`export default {};`}if(i===`search`){let e=ct(await G(r,o));return`export default ${JSON.stringify(e,null,2)};`}if(i===`client`){let e=O,t=``;for(;e&&e!==n.parse(e).root;){let r=n.join(e,`src/client/index.ts`),i=n.join(e,`dist/client/index.mjs`),a=n.join(e,`client/index.ts`);if(g.existsSync(r)){t=j(r);break}if(g.existsSync(i)){t=j(i);break}if(g.existsSync(a)){t=j(a);break}e=n.dirname(e)}if(!t)throw Error(`[boltdocs] Could not resolve boltdocs/client entry point starting from ${O}`);return`export * from '${t}';`}},transformIndexHtml:{order:`pre`,handler(e){return st(e,o)}},async closeBundle(){!c||s?.build?.ssr||(await l?.runHook(`afterBuild`),await l?.runHook(`buildEnd`))}},te({includePublic:!0,png:{quality:80},jpeg:{quality:80},jpg:{quality:80},webp:{quality:80},avif:{quality:80},svg:{multipass:!0,plugins:[{name:`preset-default`}]}}),{name:`vite-plugin-boltdocs-extra-plugins`,async configResolved(){}},...u]}const $=new Fe(`mdx`),bt=[x.default||x,S.default||S,C.default||C,w.default||w,oe.default||oe,T.default||T,E.default||E],xt=[D,se,ce,le,ue,de,fe,pe,me,he,ge,_e];let St=null,Ct=null;const wt=()=>(St??=y(),St),Tt=async e=>Ct||(Ct=b({themes:bt,langs:xt,engine:wt()}),Ct),Et=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:line-numbers`,pre(e){let n=this.options.meta?.__raw||``,r=/lineNumbers|showLineNumbers/.test(n);(t||r)&&this.addClassToHast(e,`shiki-line-numbers`)}}},Dt=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:word-wrap`,pre(e){let n=this.options.meta?.__raw||``,r=/wordWrap|word-wrap/.test(n);(t||r)&&this.addClassToHast(e,`shiki-word-wrap`)}}},Ot=()=>({name:`AddTitleProperty`,pre(e){let t=this.options.meta?.__raw;if(!t)return;let n=t.match(/title=(["'])(.*?)\1/)?.[2];e.properties[`data-title`]=n}}),kt=()=>({name:`AddLanguageProperty`,pre(e){e.properties[`data-lang`]=this.options.lang||`plaintext`}});var At=class{config;constructor(e){this.config=e}getTheme(){return this.config?.theme?.codeTheme||{light:`github-light`,dark:`github-dark`}}async getHighlighter(){return await Tt(this.getTheme())}getOptions(e,t){let n=this.getTheme(),r={lang:e,meta:{__raw:t},transformers:[Et(),Dt(),Ot(),kt()]};return typeof n==`object`?r.themes={light:n.light,dark:n.dark}:r.theme=n,r}async render(e,t,n){let r=await this.getHighlighter(),i=this.getOptions(t,n);return r.codeToHtml(e,i)}};function jt(e){let t=new At(e);return async e=>{let n=await t.getHighlighter();v(e,[`mdxJsxFlowElement`,`mdxJsxTextElement`],e=>{if(e.name!==`ComponentPreview`)return;let r=e.attributes?.find(e=>e.name===`code`),i=``;if(r){if(typeof r.value==`string`)i=r.value;else if(r.value?.type===`mdxJsxAttributeValueExpression`){let e=r.value.value??``;i=e.match(/^[`'"]([\s\S]+)[`'"]$/)?.[1]??e}}if(!i)return;let a=e.attributes?.find(e=>e.name===`lineNumbers`||e.name===`showLineNumbers`),o=e.attributes?.find(e=>e.name===`wordWrap`||e.name===`word-wrap`),s=e.attributes?.find(e=>e.name===`title`),c=``;a&&(c+=` lineNumbers`),o&&(c+=` wordWrap`),s&&typeof s.value==`string`&&(c+=` title="${s.value}"`);let l=t.getOptions(`tsx`,c),u=n.codeToHtml(i,l);e.attributes=(e.attributes??[]).filter(e=>e.name!==`highlightedHtml`),e.attributes.push({type:`mdxJsxAttribute`,name:`highlightedHtml`,value:u})})}}function Mt(e){let t=new At(e);return async e=>{let n=await t.getHighlighter();v(e,`element`,e=>{if(e.tagName===`pre`&&e.children?.[0]?.tagName===`code`){let r=e.children[0],i=(r.properties?.className||[]).find(e=>e.startsWith(`language-`)),a=i?i.slice(9):`text`,o=r.children[0]?.value||``,s=r.properties?.metastring||r.data?.meta||``,c=t.getOptions(a,s),l=n.codeToHtml(o,c);e.properties[`data-highlighted`]=`true`,e.properties[`data-highlighted-html`]=l,e.properties[`data-lang`]=a,e.children=[]}})}}function Nt(){return e=>{v(e,`code`,e=>{e.meta&&(e.data=e.data||{},e.data.hProperties=e.data.hProperties||{},e.data.hProperties.metastring=e.meta)})}}let Pt=!1;function Ft(e,t=ne){let n=e?.plugins?.flatMap(e=>Q.getSanitizedCapabilities(e).remarkPlugins||[])||[],r=e?.plugins?.flatMap(e=>Q.getSanitizedCapabilities(e).rehypePlugins||[])||[],i=t({remarkPlugins:[re,ie,Nt,[jt,e],...n],rehypePlugins:[ae,[Mt,e],...r],jsxRuntime:`automatic`});return{...i,name:`vite-plugin-boltdocs-mdx`,async buildStart(){Pt||=($.load(),!0),i.buildStart&&await i.buildStart.call(this)},async transform(e,t,n){if(!t.endsWith(`.md`)&&!t.endsWith(`.mdx`))return i.transform?.call(this,e,t,n);let r=`${t}:${p.createHash(`md5`).update(e).digest(`hex`)}:v2`,a=$.get(r);if(a)return{code:a,map:null};let o=await i.transform.call(this,e,t,n);return o&&typeof o==`object`&&o.code&&$.set(r,o.code),o},async buildEnd(){$.save(),await $.flush(),i.buildEnd&&await i.buildEnd.call(this)}}}async function It(e){let t=await q(e?.docsDir||`docs`);return[...yt({...e,homePage:e?.homePage||t.homePage},t),Ft(t)]}async function Lt(r,i=`development`){let a=await q(`docs`,r),s=i===`production`,c=s?{...lt}:{};return a.security?.enableCSP&&(c[`Content-Security-Policy`]=ut(a)),{root:r,mode:i,oxc:{jsx:{development:!s,runtime:`automatic`,importSource:`react`}},optimizeDeps:{include:[`react`,`react-dom`,`react-dom/client`,`react-helmet-async`,`react-router-dom`,`use-sync-external-store/shim`],rolldownOptions:{}},build:{rolldownOptions:{}},plugins:[e(),t(),await It({...a,root:r})],resolve:{alias:[{find:`boltdocs/entry`,replacement:o(n.resolve(r,`boltdocs-entry.mjs`))},{find:`boltdocs/client`,replacement:o(n.resolve(r,`boltdocs-client.mjs`))},{find:`use-sync-external-store/shim/index.js`,replacement:`react`},{find:`use-sync-external-store/shim`,replacement:`react`},{find:`use-sync-external-store`,replacement:`react`}],dedupe:[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`]},ssr:{noExternal:[`boltdocs`,/@bdocs\/(?!ssg).*/,`react-helmet-async`,`react-aria-components`,`@react-aria/collections`,`@react-aria/utils`]},server:{headers:{...c,...a.vite?.server?.headers},...a.vite?.server},preview:{headers:{...c,...a.vite?.preview?.headers},...a.vite?.preview},...a.vite}}export{rt as _,Q as a,De as b,gt as c,Y as d,pt as f,q as g,J as h,_t as i,mt as l,X as m,Lt as n,ht as o,ft as p,vt as r,Z as s,It as t,dt as u,j as v,Ce as y};