docstra 2.1.0 → 2.2.0

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.
@@ -1,75 +1,23 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { I as IDocstraProvider, D as DocstraContextType } from '../types-DVK5_X07.mjs';
3
+ import { SidebarItem } from 'docstra-types';
2
4
 
3
- interface DocstraContextType {
5
+ declare function DocstraProvider({ children, docstraConfig, page }: IDocstraProvider): react_jsx_runtime.JSX.Element;
6
+ declare function useDocstra(): DocstraContextType;
7
+
8
+ interface SidebarContextType {
4
9
  openSidebar: boolean;
5
10
  setOpenSidebar: (open: boolean) => void;
6
- docstraConfig: DocstraConfig;
7
11
  openSearchBox: boolean;
8
12
  setOpenSearchBox: (open: boolean) => void;
9
- packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun';
10
- setPackageManager: (packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun') => void;
11
- sidebarItems?: SidebarItem[];
12
- page: any;
13
+ sidebarItems: SidebarItem[];
14
+ setSiderbarItems: (items: SidebarItem[]) => void;
13
15
  }
14
- interface IDocstraProvider {
16
+ declare function SidebarProvider({ children, initialSidebarItems }: {
15
17
  children: React.ReactNode;
16
- docstraConfig: DocstraConfig;
17
- page: any;
18
- }
19
- interface DocstraConfig {
20
- editOnGithub: {
21
- owner: string;
22
- repo: string;
23
- path: string;
24
- branch: string;
25
- };
26
- feedback?: {
27
- enabled?: boolean;
28
- formSyncFormID?: string;
29
- watermark?: boolean;
30
- };
31
- navbar?: {
32
- logo?: {
33
- link: string;
34
- src: string;
35
- alt: string;
36
- className?: string;
37
- };
38
- links?: {
39
- name: string;
40
- href: string;
41
- }[];
42
- };
43
- }
44
- type SidebarItem = {
45
- type: 'page';
46
- title: string;
47
- nav_title?: string;
48
- href: string;
49
- icon?: string;
50
- } | {
51
- type: 'section';
52
- title: string;
53
- nav_title?: string;
54
- href: string;
55
- group_title?: string;
56
- children: SidebarItem[];
57
- icon?: string;
58
- defaultOpen?: boolean;
59
- collapsible?: boolean;
60
- } | {
61
- type: 'separator';
62
- label: string;
63
- } | {
64
- type: 'link';
65
- title: string;
66
- nav_title?: string;
67
- href: string;
68
- external?: boolean;
69
- };
70
-
71
- declare function DocstraProvider({ children, docstraConfig, page }: IDocstraProvider): react_jsx_runtime.JSX.Element;
72
- declare function useDocstra(): DocstraContextType;
18
+ initialSidebarItems: any[];
19
+ }): react_jsx_runtime.JSX.Element;
20
+ declare function useSidebar(): SidebarContextType;
73
21
 
74
22
  declare function DocstraHeader(): react_jsx_runtime.JSX.Element;
75
23
 
@@ -96,4 +44,4 @@ declare function DocstraFileTree({ data, fromText, }: {
96
44
  fromText?: string;
97
45
  }): react_jsx_runtime.JSX.Element;
98
46
 
99
- export { DocstraBody, DocstraCodeBlock, DocstraFileTree, DocstraHeader, DocstraLayout, DocstraProvider, type Node, useDocstra };
47
+ export { DocstraBody, DocstraCodeBlock, DocstraFileTree, DocstraHeader, DocstraLayout, DocstraProvider, type Node, SidebarProvider, useDocstra, useSidebar };
@@ -1,75 +1,23 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { I as IDocstraProvider, D as DocstraContextType } from '../types-DVK5_X07.js';
3
+ import { SidebarItem } from 'docstra-types';
2
4
 
3
- interface DocstraContextType {
5
+ declare function DocstraProvider({ children, docstraConfig, page }: IDocstraProvider): react_jsx_runtime.JSX.Element;
6
+ declare function useDocstra(): DocstraContextType;
7
+
8
+ interface SidebarContextType {
4
9
  openSidebar: boolean;
5
10
  setOpenSidebar: (open: boolean) => void;
6
- docstraConfig: DocstraConfig;
7
11
  openSearchBox: boolean;
8
12
  setOpenSearchBox: (open: boolean) => void;
9
- packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun';
10
- setPackageManager: (packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun') => void;
11
- sidebarItems?: SidebarItem[];
12
- page: any;
13
+ sidebarItems: SidebarItem[];
14
+ setSiderbarItems: (items: SidebarItem[]) => void;
13
15
  }
14
- interface IDocstraProvider {
16
+ declare function SidebarProvider({ children, initialSidebarItems }: {
15
17
  children: React.ReactNode;
16
- docstraConfig: DocstraConfig;
17
- page: any;
18
- }
19
- interface DocstraConfig {
20
- editOnGithub: {
21
- owner: string;
22
- repo: string;
23
- path: string;
24
- branch: string;
25
- };
26
- feedback?: {
27
- enabled?: boolean;
28
- formSyncFormID?: string;
29
- watermark?: boolean;
30
- };
31
- navbar?: {
32
- logo?: {
33
- link: string;
34
- src: string;
35
- alt: string;
36
- className?: string;
37
- };
38
- links?: {
39
- name: string;
40
- href: string;
41
- }[];
42
- };
43
- }
44
- type SidebarItem = {
45
- type: 'page';
46
- title: string;
47
- nav_title?: string;
48
- href: string;
49
- icon?: string;
50
- } | {
51
- type: 'section';
52
- title: string;
53
- nav_title?: string;
54
- href: string;
55
- group_title?: string;
56
- children: SidebarItem[];
57
- icon?: string;
58
- defaultOpen?: boolean;
59
- collapsible?: boolean;
60
- } | {
61
- type: 'separator';
62
- label: string;
63
- } | {
64
- type: 'link';
65
- title: string;
66
- nav_title?: string;
67
- href: string;
68
- external?: boolean;
69
- };
70
-
71
- declare function DocstraProvider({ children, docstraConfig, page }: IDocstraProvider): react_jsx_runtime.JSX.Element;
72
- declare function useDocstra(): DocstraContextType;
18
+ initialSidebarItems: any[];
19
+ }): react_jsx_runtime.JSX.Element;
20
+ declare function useSidebar(): SidebarContextType;
73
21
 
74
22
  declare function DocstraHeader(): react_jsx_runtime.JSX.Element;
75
23
 
@@ -96,4 +44,4 @@ declare function DocstraFileTree({ data, fromText, }: {
96
44
  fromText?: string;
97
45
  }): react_jsx_runtime.JSX.Element;
98
46
 
99
- export { DocstraBody, DocstraCodeBlock, DocstraFileTree, DocstraHeader, DocstraLayout, DocstraProvider, type Node, useDocstra };
47
+ export { DocstraBody, DocstraCodeBlock, DocstraFileTree, DocstraHeader, DocstraLayout, DocstraProvider, type Node, SidebarProvider, useDocstra, useSidebar };
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var Xe=Object.create;var q=Object.defineProperty;var Je=Object.getOwnPropertyDescriptor;var je=Object.getOwnPropertyNames;var et=Object.getPrototypeOf,tt=Object.prototype.hasOwnProperty;var rt=(e,t)=>{for(var o in t)q(e,o,{get:t[o],enumerable:!0})},me=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of je(t))!tt.call(e,a)&&a!==o&&q(e,a,{get:()=>t[a],enumerable:!(r=Je(t,a))||r.enumerable});return e};var O=(e,t,o)=>(o=e!=null?Xe(et(e)):{},me(t||!e||!e.__esModule?q(o,"default",{value:e,enumerable:!0}):o,e)),ot=e=>me(q({},"__esModule",{value:!0}),e);var ut={};rt(ut,{DocstraBody:()=>ct,DocstraCodeBlock:()=>dt,DocstraFileTree:()=>mt,DocstraHeader:()=>j,DocstraLayout:()=>lt,DocstraProvider:()=>at,useDocstra:()=>b});module.exports=ot(ut);var R=require("react"),Ne=require("react-toast-msg");var he=require("lucide-react");var pe=require("tailwind-merge"),ue=O(require("clsx"));function m(...e){return(0,pe.twMerge)((0,ue.default)(e))}var P=require("react"),xe=O(require("fuse.js")),ye=O(require("next/link")),ve=require("next/navigation");var z=require("react"),be=require("react/jsx-runtime"),fe=(0,z.createContext)(null);function ge({children:e,initialSidebarItems:t}){let[o,r]=(0,z.useState)(t),[a,n]=(0,z.useState)(!1),[s,i]=(0,z.useState)(!1);return(0,be.jsx)(fe.Provider,{value:{openSidebar:a,setOpenSidebar:n,openSearchBox:s,setOpenSearchBox:i,sidebarItems:o,setSiderbarItems:r},children:e})}function M(){let e=(0,z.useContext)(fe);if(!e)throw new Error("Please wrap your layout with SidebarProvider");return e}var x=require("react/jsx-runtime");function we(){let{openSearchBox:e,setOpenSearchBox:t}=M(),{page:o}=b(),[r,a]=(0,P.useState)(""),[n,s]=(0,P.useState)([]),i=(0,ve.useRouter)();(0,P.useEffect)(()=>{let c=v=>{v.ctrlKey&&v.key==="k"&&(v.preventDefault(),t(!0))};return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[]);let f=(0,P.useMemo)(()=>!o||o.length===0?null:new xe.default(o,{keys:["data.metadata.title","data.metadata.description"],threshold:.3}),[o]);(0,P.useEffect)(()=>{if(r&&f){let c=f.search(r);s(c.map(v=>v.item))}else r||s([])},[r,f]);let u=c=>{if(c.preventDefault(),r){let v=n[0];v&&(i.push(`/docs/${v.slug}`),a(""),t(!1))}};return(0,P.useEffect)(()=>{let c=v=>{v.key==="Escape"&&(t(!1),a(""))};return e&&window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[e]),(0,x.jsx)("div",{onClick:()=>{t(!1),a("")},className:m("fixed inset-0 z-25 flex items-start justify-center bg-white/40 backdrop-blur-md opacity-0 pointer-events-none transition-all duration-300",e&&"opacity-100 pointer-events-auto"),children:(0,x.jsxs)("div",{onClick:c=>c.stopPropagation(),className:"flex flex-col items-center mt-30 max-w-lg w-full max-md:px-4",children:[(0,x.jsx)("form",{onSubmit:u,className:m("relative flex items-center justify-between w-full bg-white border border-slate-200 text-gray-400 h-15 p-0.5 rounded-lg",r&&"rounded-b-none border-b-0"),children:e&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(he.SearchIcon,{className:"size-5.5 mx-3 shrink-0"}),(0,x.jsx)("input",{className:"w-full bg-transparent h-full outline-none text-gray-400 placeholder:text-gray-400",type:"text",placeholder:"Search docs...",spellCheck:"false",autoFocus:!0,value:r,onChange:c=>a(c.target.value),name:"searchQuery",required:!0}),(0,x.jsx)("span",{className:"border border-gray-200 px-2 mr-3 py-1 rounded text-xs",children:"Esc"})]})}),(0,x.jsxs)("div",{className:m("max-h-70 overflow-x-hidden overflow-y-auto scrollbar-y w-full bg-white text-slate-700 flex flex-col",r&&"rounded-b-md border border-slate-200"),children:[n.map(c=>(0,x.jsxs)(ye.default,{href:`/docs/${c.slug==="index"?"":c.slug}`,onClick:()=>{t(!1),a("")},className:"w-full hover:bg-gray-100/70 border-b border-slate-200 transition-all py-4 px-4 last:mb-2",children:[(0,x.jsx)("h4",{className:"font-medium",children:c.data?.metadata?.title||c.slug}),(0,x.jsx)("p",{className:"text-sm mt-1 text-gray-500",children:c.data?.metadata?.description})]},c.slug)),r&&n.length===0&&(0,x.jsx)("div",{className:"text-gray-500 text-center py-20",children:"No results found"})]})]})})}var U=require("react/jsx-runtime"),Se=(0,R.createContext)(null);function at({children:e,docstraConfig:t,page:o}){let[r,a]=(0,R.useState)(!1),[n,s]=(0,R.useState)(!1),[i,f]=(0,R.useState)("npm");return(0,U.jsxs)(Se.Provider,{value:{openSidebar:r,setOpenSidebar:a,docstraConfig:t,openSearchBox:n,setOpenSearchBox:s,packageManager:i,setPackageManager:f,page:o},children:[(0,U.jsx)(Ne.ToastContainer,{}),(0,U.jsx)(we,{}),e]})}function b(){let e=(0,R.useContext)(Se);if(!e)throw new Error("Please wrap your app with DocstraProvider");return e}var K=require("lucide-react"),ke=require("react");var V=O(require("next/link"));var S=require("react/jsx-runtime");function j(){let{openSidebar:e,setOpenSidebar:t,openSearchBox:o,setOpenSearchBox:r}=M(),{docstraConfig:a}=b(),n="https://github.com/"+a?.editOnGithub?.owner+"/"+a?.editOnGithub?.repo;return(0,ke.useEffect)(()=>{e?document.body.classList.add("max-md:overflow-hidden"):document.body.classList.remove("max-md:overflow-hidden")},[e]),(0,S.jsxs)("header",{className:"fixed w-full top-0 z-10 text-sm flex items-center justify-between border-b border-gray-100 h-18 px-4 md:px-6 bg-white",children:[(0,S.jsx)(V.default,{href:a.navbar?.logo?.link||"/",className:"hover:opacity-80 transition",children:(0,S.jsx)("img",{src:a.navbar?.logo?.src||"/logo.png",alt:a.navbar?.logo?.alt||"Logo",className:m("h-9.5 w-auto",a.navbar?.logo?.className)})}),(0,S.jsxs)("div",{className:"hidden divide-x divide-gray-200 md:flex items-center",children:[a.navbar?.links?.map(s=>(0,S.jsx)(V.default,{href:s.href,className:"px-6 hover:text-gray-600",children:s.name},s.name)),(0,S.jsx)(V.default,{href:n||"https://github.com/sudhucodes/docstra",children:(0,S.jsx)("svg",{className:"size-6 mx-6",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,S.jsx)("path",{d:"M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3"})})})]}),(0,S.jsx)("button",{onClick:()=>t(!e),className:"md:hidden transition text-gray-600 active:ring-2 ring-gray-200 p-1.5 rounded-md",children:e?(0,S.jsx)(K.XIcon,{className:"size-6.5"}):(0,S.jsx)(K.TextAlignEnd,{className:"size-6.5"})})]})}var Z=require("lucide-react"),Ce=require("next/navigation");var nt=O(require("lucide-react"));function ee(e){if(e)return nt[e]}var te=O(require("next/link")),Ie=require("react");var d=require("react/jsx-runtime");function st({item:e,pathname:t,className:o,openSidebar:r,setOpenSidebar:a}){let[n,s]=(0,Ie.useState)(e.defaultOpen??!0),i=e.collapsible??!0,f=ee(e.icon);return(0,d.jsxs)("div",{className:"space-y-0.5",children:[e.group_title&&(0,d.jsx)("p",{className:"inline-flex items-center gap-2 mb-2 mt-2 px-2",children:e.group_title}),(0,d.jsxs)(te.default,{href:e.href,onClick:()=>{i&&t===e.href&&s(u=>!u)},className:m("w-full flex items-center justify-between gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",e.href===t&&"bg-gray-100 text-gray-800"),children:[(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[f&&(0,d.jsx)(f,{className:"size-4"}),e.nav_title?e.nav_title:e.title]}),i&&(0,d.jsx)("div",{className:"pl-3",children:(0,d.jsx)(Z.ChevronDownIcon,{className:m("size-4 text-black/50 transition-transform duration-300",n&&"rotate-180")})})]}),(!i||n)&&(0,d.jsx)("ul",{className:"mb-4 space-y-0.5",children:e.children.map((u,c)=>(0,d.jsx)(De,{className:m('relative pl-7 before:content-[""] before:absolute before:top-1/2 first:before:top-[calc(50%+1px)] last:before:top-[calc(50%-1px)] before:left-4 before:w-px before:h-full last:before:h-[calc(100%+1px)] first:before:h-[calc(100%+1px)] before:bg-gray-200 before:-translate-y-1/2',u.type==="page"&&u.href===t&&'after:content-[""] after:absolute after:top-1/2 after:left-4 after:w-px after:h-6 after:bg-gray-600 after:-translate-y-1/2'),item:u,pathname:t,openSidebar:r,setOpenSidebar:a},`${u.type}-${c}`))})]})}function it({item:e,pathname:t,openSidebar:o,className:r,setOpenSidebar:a}){let n=ee(e.icon);return(0,d.jsxs)(te.default,{href:e.href,onClick:()=>o&&a(!1),className:m("flex items-center gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",t===e.href&&"bg-gray-100 text-gray-800",r),children:[n&&(0,d.jsx)(n,{className:"size-4"}),(0,d.jsx)("span",{children:e.nav_title?e.nav_title:e.title})]})}function De({item:e,pathname:t,openSidebar:o,className:r,setOpenSidebar:a}){switch(e.type){case"page":return(0,d.jsx)(it,{item:e,pathname:t,openSidebar:o,className:r,setOpenSidebar:a});case"section":return(0,d.jsx)(st,{item:e,pathname:t,className:r,openSidebar:o,setOpenSidebar:a});default:return null}}function Le(){let{openSidebar:e,setOpenSidebar:t,sidebarItems:o,setOpenSearchBox:r}=M(),a=(0,Ce.usePathname)();return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:m("fixed inset-0 z-20 bg-black/50 md:hidden opacity-0 pointer-events-none transition-all duration-300",e&&"opacity-100 pointer-events-auto"),onClick:()=>t(!1)}),(0,d.jsxs)("aside",{className:m("fixed md:top-18 h-[calc(100svh-72px)] space-y-0.5 scrollbar-y w-screen max-md:rounded-t-lg z-21 md:w-72 pb-10 text-base md:text-sm shrink-0 border-r border-gray-200 p-4 max-md:fixed bg-white overflow-y-auto transition-all duration-300",e?"top-32":"top-full"),children:[(0,d.jsxs)("div",{className:"flex items-center select-none gap-2 cursor-pointer mt-6 mb-4 p-2.5 text-gray-500 border border-gray-200 rounded-lg hover:bg-gray-50",onClick:()=>{t(e&&!1),r(!0)},children:[(0,d.jsx)(Z.SearchIcon,{className:"size-4.5"}),(0,d.jsx)("p",{children:"Search"}),(0,d.jsxs)("div",{className:"ms-auto font-mono inline-flex gap-0.5",children:[(0,d.jsx)("span",{className:"rounded-md border border-gray-200 px-1.5",children:"Ctrl"}),(0,d.jsx)("span",{className:"rounded-md border border-gray-200 px-1.5",children:"K"})]})]}),o.map((n,s)=>(0,d.jsx)(De,{item:n,pathname:a,openSidebar:e,setOpenSidebar:t},`${n.type}-${s}`))]})]})}var H=require("react/jsx-runtime");function lt({children:e,tree:t}){return(0,H.jsx)(ge,{initialSidebarItems:t,children:(0,H.jsxs)("div",{className:"min-h-screen flex bg-white w-full",children:[(0,H.jsx)(Le,{}),e]})})}var Oe=require("next/navigation"),Pe=require("lucide-react"),re=O(require("next/link")),D=require("react/jsx-runtime");function ze(){let t=(0,Oe.usePathname)().split("/").filter(Boolean),o=t.map((r,a)=>{let n="/"+t.slice(0,a+1).join("/"),s=r.replace(/-/g," ").replace(/\b\w/g,i=>i.toUpperCase());return{href:n,title:s}});return(0,D.jsx)("nav",{"aria-label":"Breadcrumb",className:"flex text-sm items-center pb-4 text-gray-500 not-prose",children:(0,D.jsxs)("ol",{className:"flex items-center space-x-2",children:[(0,D.jsx)("li",{children:(0,D.jsx)(re.default,{href:"/",className:"hover:text-gray-700 transition-colors font-medium",children:"Home"})}),o.map((r,a)=>{let n=a===o.length-1;return(0,D.jsxs)("li",{className:"flex items-center space-x-2",children:[(0,D.jsx)(Pe.ChevronRight,{className:"w-4 h-4 text-gray-400"}),n?(0,D.jsx)("span",{className:"text-gray-600 font-medium",children:r.title}):(0,D.jsx)(re.default,{href:r.href,className:"hover:text-gray-700 font-medium transition-colors",children:r.title})]},r.href)})]})})}var A=require("lucide-react"),Re=require("next/navigation"),N=require("react");var y=require("react/jsx-runtime");function Te(){let[e,t]=(0,N.useState)(null),[o,r]=(0,N.useState)("down"),[a,n]=(0,N.useState)(!1),[s,i]=(0,N.useState)(!1),{docstraConfig:f,page:u}=b(),c=u?.path,v=u?.tableOfContents||[],ce=(0,N.useRef)(0),Ze=(0,N.useRef)(null),Ye=(0,Re.usePathname)(),Qe=`${"https://github.com/"+f?.editOnGithub?.owner+"/"+f?.editOnGithub?.repo}/edit/main/${f?.editOnGithub?.path}/${c}`;(0,N.useEffect)(()=>{let g=()=>{let w=window.scrollY;r(w>ce.current?"down":"up"),n(w>100),ce.current=w};return window.addEventListener("scroll",g),()=>window.removeEventListener("scroll",g)},[]),(0,N.useEffect)(()=>{let g=document.querySelectorAll("h2[id], h3[id]"),w=new IntersectionObserver(G=>{if(s)return;let B=G.filter($=>$.isIntersecting).sort(($,We)=>$.boundingClientRect.top-We.boundingClientRect.top);if(B.length>0){let $=o==="down"?B[0].target.id:B[B.length-1].target.id;t($)}},{rootMargin:"-40% 0px -50% 0px",threshold:[0,.2,.6,1]});return g.forEach(G=>w.observe(G)),Ze.current=w,()=>w.disconnect()},[Ye,o,s]),(0,N.useEffect)(()=>{!(window.scrollY>100)&&t(v[0]?.id)},[v]),(0,N.useEffect)(()=>{if(!e)return;let g=document.querySelector(".toc-scroll-container");if(!g)return;let w=g.querySelector(`a[href="#${e}"]`);if(!w)return;let G=g.getBoundingClientRect(),B=w.getBoundingClientRect();(B.top<G.top||B.bottom>G.bottom)&&w.scrollIntoView({behavior:"smooth",block:"nearest"})},[e]),(0,N.useEffect)(()=>{if(!s)return;let g=setTimeout(()=>i(!1),800);return()=>clearTimeout(g)},[s]);let de=g=>{t(g),i(!0)};return(0,y.jsxs)("aside",{className:"sticky top-18 text-sm hidden xl:block text-gray-500 shrink-0 h-[calc(100svh-72px)] w-64 border-l border-gray-200 p-6 overflow-y-auto",children:[(0,y.jsxs)("p",{className:"flex items-center gap-2 mb-5",children:[(0,y.jsx)(A.TextAlignStartIcon,{className:"size-4"}),"On this page"]}),(0,y.jsx)("ul",{className:"toc-scroll-container max-h-3/4 overflow-y-auto scrollbar-none",children:v.map(g=>(0,y.jsxs)("li",{children:[(0,y.jsx)(Me,{heading:g,activeId:e,handleClick:de}),g.children.map(w=>(0,y.jsx)(Me,{heading:w,activeId:e,handleClick:de,className:"pl-8"},w.id))]},g.id))}),(0,y.jsx)("hr",{className:"my-6 border-gray-200"}),f.editOnGithub&&(0,y.jsxs)("a",{href:Qe,rel:"noopener noreferrer",className:"flex items-center gap-2 text-gray-400 hover:text-gray-700 transition",children:["Edit this page on GitHub",(0,y.jsx)(A.SquareArrowOutUpRightIcon,{className:"size-4"})]}),a&&(0,y.jsxs)("button",{onClick:()=>scrollTo({top:0,behavior:"smooth"}),className:"flex items-center cursor-pointer gap-2 mt-3 text-gray-400 hover:text-gray-700 transition",children:["Scroll to top",(0,y.jsx)(A.ArrowUpCircleIcon,{className:"size-4"})]})]})}function Me({heading:e,activeId:t,handleClick:o,className:r}){return(0,y.jsx)("a",{href:`#${e.id}`,className:m("border-l border-gray-200 block py-1.5 pl-4 transition-colors",r,{"border-gray-800 text-gray-900 font-medium":t===e.id,"hover:text-gray-800 hover:border-gray-400":t!==e.id}),onClick:()=>o(e.id),children:e.text})}var Y=require("react"),Q=require("lucide-react");var E=require("react/jsx-runtime");function oe({label:e,type:t,placeholder:o="",id:r,required:a=!1,onChange:n,value:s,readOnly:i=!1,className:f="",optional:u=!1}){return(0,E.jsxs)("div",{className:m("flex flex-col mt-4 w-full",f),children:[e&&(0,E.jsxs)("label",{htmlFor:r,className:"font-medium w-max cursor-pointer",children:[e,u&&(0,E.jsx)("span",{className:"text-xs font-normal text-gray-400 ml-1 mt-1",children:"(Optional)"})]}),t==="textarea"?(0,E.jsx)("textarea",{id:r,name:r,className:m("mt-2 w-full p-3 border border-gray-300 resize-none not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",f),placeholder:o,required:a,onChange:n,rows:4,value:s,readOnly:i,maxLength:500}):(0,E.jsx)("input",{type:t,id:r,name:r,className:"mt-2 w-full h-12 px-3 border border-gray-300 not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",placeholder:o,required:a,onChange:n,value:s,readOnly:i,maxLength:500})]})}var Be=require("lucide-react");var ae=require("react/jsx-runtime");function ne({label:e,loading:t,type:o="submit",className:r="",disabled:a=!1,onClick:n}){return(0,ae.jsx)("button",{type:o,disabled:a,className:m("relative w-full mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg",r),"aria-label":e,onClick:n,children:t?(0,ae.jsx)(Be.Loader2Icon,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 animate-spin mx-auto"}):e})}var Ee=require("formsync");var se=require("react-toast-msg"),p=require("react/jsx-runtime");function Ge(){let[e,t]=(0,Y.useState)(null),{docstraConfig:o}=b(),[r,a]=(0,Y.useState)(""),[n,s]=(0,Y.useState)(!1),i=o?.editOnGithub?.owner+"/"+o?.editOnGithub?.repo,{isLoading:f,submit:u}=(0,Ee.useFormSync)({formId:o?.feedback?.formSyncFormID||"",onSuccess:()=>{se.toast.success("Feedback submitted successfully"),s(!0),t(null),a("")},onError:c=>{console.log(c),se.toast.error(c.message,{duration:5e3})}});return(0,p.jsx)("div",{className:"border-y border-gray-200 mt-10 py-10 space-y-4",children:n?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("p",{className:"font-medium text-gray-900",children:"We appreciate your feedback, Thank you!"}),(0,p.jsx)(ne,{onClick:()=>{s(!1),t(null),a("")},label:"Submit Again",className:"w-max text-sm"})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("p",{className:"font-medium",children:"How is this guide?"}),(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsxs)("button",{onClick:()=>t("good"),className:m("flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm",e==="good"?"bg-green-100 text-green-600 border-green-300":"border-gray-200 text-gray-600 hover:bg-gray-100"),children:[(0,p.jsx)(Q.ThumbsUp,{className:`size-4 ${e==="good"?"fill-green-600":"text-gray-500"}`}),"Good"]}),(0,p.jsxs)("button",{onClick:()=>t("bad"),className:m("flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm",e==="bad"?"bg-red-100 text-red-600 border-red-300":"border-gray-200 text-gray-600 hover:bg-gray-100"),children:[(0,p.jsx)(Q.ThumbsDown,{className:m("size-4 pt-0.5",e==="bad"?"fill-red-600":"text-gray-500")}),"Bad"]})]}),e&&(0,p.jsxs)("form",{className:"flex flex-col gap-2",onSubmit:u,children:[(0,p.jsx)(oe,{value:r,id:"message",onChange:c=>a(c.target.value),placeholder:"Leave your feedback...",required:!0,type:"textarea"}),(0,p.jsx)("input",{type:"hidden",name:"opinion",value:e}),(0,p.jsx)("input",{type:"hidden",name:"page",value:window.location.href}),(0,p.jsx)("input",{type:"hidden",name:"_redirect",value:window.location.href}),(0,p.jsx)("input",{type:"hidden",name:"_source",value:"sdk"}),(0,p.jsx)("input",{type:"hidden",name:"_fs_hp",tabIndex:-1,autoComplete:"off"}),(0,p.jsx)("button",{type:"submit",disabled:f,className:"relative mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg w-max text-sm",children:f?"Submitting...":"Submit"}),o?.feedback?.watermark!==!1&&(0,p.jsxs)("p",{className:"text-left text-sm text-gray-500 mt-6",children:["Powered by"," ",(0,p.jsx)("a",{href:`https://www.formsync.app?utm_source=${i}`,className:"text-gray-800 not-prose",children:"FormSync"})]})]})]})})}var Ae=require("react/jsx-runtime");function $e(){let{page:e}=b();if(!e?.lastUpdated)return null;let t=new Date(e.lastUpdated).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"});return(0,Ae.jsxs)("p",{className:"text-sm text-gray-500",children:["Last updated on ",t]})}var I=O(require("@radix-ui/react-dropdown-menu")),F=require("lucide-react"),_=require("react");var l=require("react/jsx-runtime");function Fe(){let{page:e,docstraConfig:t}=b(),[o,r]=(0,_.useState)(!1),[a,n]=(0,_.useState)(null),i=`${"https://github.com/"+t?.editOnGithub?.owner+"/"+t?.editOnGithub?.repo}/blob/main/${t?.editOnGithub?.path}/${e?.path}`;(0,_.useEffect)(()=>{n(window.location.href)},[]);let f=()=>{navigator.clipboard.writeText(e?.raw||""),r(!0),setTimeout(()=>r(!1),3e3)},u=`Read from this URL: ${a} and explain it to me.`;return(0,l.jsxs)("div",{className:"flex items-center gap-3 mt-6 not-prose",children:[(0,l.jsxs)("button",{title:"Copy Markdown",onClick:f,className:"flex items-center cursor-pointer gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",children:[o?(0,l.jsx)(F.CheckIcon,{className:"size-3.5"}):(0,l.jsx)(F.CopyIcon,{className:"size-3.5"}),"Copy Markdown"]}),(0,l.jsxs)(I.Root,{children:[(0,l.jsx)(I.Trigger,{asChild:!0,children:(0,l.jsxs)("button",{className:"flex items-center gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs outline-none focus:outline-none focus:ring-0",children:["Open",(0,l.jsx)(F.ChevronDownIcon,{className:"size-3.5"})]})}),(0,l.jsxs)(I.Content,{className:"bg-white border border-gray-200 rounded-md shadow-md p-1 mt-2 text-sm",align:"end",children:[(0,l.jsx)(I.Item,{asChild:!0,children:(0,l.jsxs)("a",{href:i,target:"_blank",className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[(0,l.jsxs)("svg",{className:"size-4.5",fill:"currentColor",viewBox:"0 0 24 24",children:[(0,l.jsx)("title",{children:"GitHub"}),(0,l.jsx)("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]}),"Open in GitHub"]})}),(0,l.jsx)(I.Item,{asChild:!0,children:(0,l.jsxs)("a",{href:`https://chatgpt.com/?q=${encodeURIComponent(u)}`,target:"_blank",className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[(0,l.jsxs)("svg",{className:"size-4.5",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[(0,l.jsx)("title",{children:"OpenAI"}),(0,l.jsx)("path",{d:"M22.282 9.821a6 6 0 0 0-.516-4.91 6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9 6.05 6.05 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206 6 6 0 0 0 3.997-2.9 6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023-.141-.085-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365 2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5Z"})]}),"Open in ChatGPT"]})}),(0,l.jsx)(I.Item,{asChild:!0,children:(0,l.jsxs)("a",{href:`https://claude.ai/new?q=${encodeURIComponent(u)}`,target:"_blank",className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[(0,l.jsxs)("svg",{className:"size-4.5",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,l.jsx)("title",{children:"Anthropic"}),(0,l.jsx)("path",{d:"M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.37-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223L8.616 7.82l2.291 5.945Z"})]}),"Open in Claude"]})}),(0,l.jsx)(I.Item,{asChild:!0,children:(0,l.jsxs)("a",{href:`https://cursor.com/link/prompt?text=${encodeURIComponent(u)}`,className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[(0,l.jsxs)("svg",{className:"size-4.5",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,l.jsx)("title",{children:"Cursor"}),(0,l.jsx)("path",{d:"M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23"})]}),"Open in Cursor"]})})]})]})]})}var Ue=require("next/navigation"),ie=O(require("next/link")),W=require("lucide-react");var k=require("react/jsx-runtime");function He(e){let t=[];for(let o of e)o.type==="page"?t.push({name:o.title,href:o.href,icon:o.icon}):o.type==="section"&&t.push(...He(o.children));return t}function _e(){let e=(0,Ue.usePathname)(),{docstraConfig:t}=b(),{sidebarItems:o}=M(),r=[];o&&o.length>0?r=He(o):t?.sidebar?.links&&(r=t.sidebar.links.flatMap(i=>i.items));let a=r.findIndex(i=>i.href===e),n=a>0?r[a-1]:null,s=a<r.length-1?r[a+1]:null;return(0,k.jsxs)("div",{className:"flex flex-col lg:flex-row gap-2 justify-between py-10 mt-10",children:[n?(0,k.jsxs)(ie.default,{href:n.href,className:"flex flex-col not-prose items-start gap-2 border border-gray-200 hover:bg-gray-50 py-3 md:min-w-62 pl-4 pr-10 rounded-lg text-sm",children:[(0,k.jsx)("span",{className:"text-gray-500",children:"Previous"}),(0,k.jsxs)("p",{className:"flex items-center font-medium",children:[(0,k.jsx)(W.ArrowLeftIcon,{className:"size-5 mr-2"}),n.name]})]}):(0,k.jsx)("div",{}),s?(0,k.jsxs)(ie.default,{href:s.href,className:"flex flex-col not-prose items-end gap-2 border border-gray-200 hover:bg-gray-50 py-3 pr-4 md:min-w-62 pl-10 rounded-lg text-sm",children:[(0,k.jsx)("span",{className:"text-gray-500",children:"Next"}),(0,k.jsxs)("p",{className:"flex items-center font-medium",children:[s.name,(0,k.jsx)(W.ArrowRightIcon,{className:"size-5 ml-2"})]})]}):(0,k.jsx)("div",{})]})}var h=require("react/jsx-runtime");function ct({children:e}){let{docstraConfig:t,page:o}=b();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(j,{}),(0,h.jsxs)("main",{className:"flex-1 px-4 md:px-8 md:pl-80 pt-28 py-10 prose prose-headings:scroll-mt-28 max-w-none",children:[(0,h.jsxs)("div",{className:"not-prose",children:[(0,h.jsx)(ze,{}),(0,h.jsx)("h1",{className:"text-3xl font-bold text-black",children:o?.metadata?.title}),(0,h.jsx)("p",{className:"my-2 text-gray-500",children:o?.metadata?.description}),(0,h.jsx)(Fe,{})]}),(0,h.jsx)("hr",{className:"border-gray-200"}),e,t?.feedback?.enabled&&(0,h.jsx)(Ge,{}),(0,h.jsx)($e,{}),(0,h.jsx)(_e,{})]}),(0,h.jsx)(Te,{})]})}var X=require("lucide-react"),qe=require("react"),Ve=require("react-toast-msg");var L=require("react/jsx-runtime");function le(e){return typeof e=="string"?e:Array.isArray(e)?e.map(le).join(""):e?.props?.children?le(e.props.children):""}function dt(e){let{title:t,copy:o,children:r}=e;if(typeof r=="string")return(0,L.jsx)("code",{className:"not-prose px-1 py-0.5 rounded border border-gray-200 bg-gray-50 text-gray-800 text-sm",children:r});let[n,s]=(0,qe.useState)(!1),i=e["data-language"],f=()=>{if(!o)return;let u=le(r);navigator.clipboard.writeText(u),s(!0),Ve.toast.success("Code copied to clipboard"),setTimeout(()=>s(!1),2e3)};return(0,L.jsxs)("div",{className:"max-w-2xl overflow-hidden rounded-lg text-sm text-gray-800 border border-gray-200 mt-4 bg-white",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between bg-gray-50 border-b border-gray-200",children:[(0,L.jsx)("span",{className:m("text-xs text-gray-400 px-4 py-3",!o&&"py-4"),children:t||i}),o&&(0,L.jsx)("button",{onClick:f,className:"rounded-lg cursor-pointer p-2 m-2 text-gray-500 hover:bg-gray-200 transition",children:n?(0,L.jsx)(X.CheckIcon,{className:"size-4 text-green-600"}):(0,L.jsx)(X.CopyIcon,{className:"size-4"})})]}),(0,L.jsx)("div",{className:"p-4 scrollbar-x max-md:max-w-[calc(100vw-34px)] whitespace-pre overflow-x-auto text-sm leading-relaxed",children:r})]})}var J=require("react"),T=require("lucide-react"),C=require("react/jsx-runtime");function mt({data:e,fromText:t}){let o=(0,J.useMemo)(()=>e||(t?pt(t):[]),[e,t]);return(0,C.jsx)("div",{className:"rounded-lg border border-zinc-200 bg-white p-3 text-sm min-w-80",children:o.map((r,a)=>(0,C.jsx)(Ke,{node:r},a))})}function Ke({node:e}){let[t,o]=(0,J.useState)(!0),r=e.type==="folder";return(0,C.jsxs)("div",{children:[(0,C.jsxs)("div",{onClick:()=>r&&o(a=>!a),className:"flex items-center gap-2 py-1.5 px-2 rounded-md cursor-pointer hover:bg-gray-100",children:[r&&(0,C.jsx)(T.ChevronRight,{className:`size-4 ${t&&"rotate-90"}`}),r?t?(0,C.jsx)(T.FolderOpen,{className:"size-4 text-blue-500"}):(0,C.jsx)(T.Folder,{className:"size-4 text-blue-500"}):(0,C.jsx)(T.FileText,{className:"size-4 text-gray-500"}),(0,C.jsx)("span",{children:e.name})]}),r&&t&&e.children&&(0,C.jsx)("div",{className:"ml-3 pl-3 border-l border-zinc-300",children:e.children.map((a,n)=>(0,C.jsx)(Ke,{node:a},n))})]})}function pt(e){let t=e.split(`
2
- `).map(a=>a.replace(/\t/g," ")).filter(a=>a.trim().length>0),o=[],r=[];for(let a of t){let n=a.match(/^ */)?.[0].length||0,s=a.trim(),i=s.endsWith("/"),u={name:i?s.slice(0,-1):s,type:i?"folder":"file",children:i?[]:void 0};for(;r.length&&r[r.length-1].indent>=n;)r.pop();r.length===0?o.push(u):r[r.length-1].node.children?.push(u),i&&r.push({indent:n,node:u})}return o}0&&(module.exports={DocstraBody,DocstraCodeBlock,DocstraFileTree,DocstraHeader,DocstraLayout,DocstraProvider,useDocstra});
1
+ "use strict";"use client";var We=Object.create;var q=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Je=Object.getOwnPropertyNames;var je=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty;var tt=(e,t)=>{for(var r in t)q(e,r,{get:t[r],enumerable:!0})},me=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Je(t))!et.call(e,a)&&a!==r&&q(e,a,{get:()=>t[a],enumerable:!(o=Xe(t,a))||o.enumerable});return e};var O=(e,t,r)=>(r=e!=null?We(je(e)):{},me(t||!e||!e.__esModule?q(r,"default",{value:e,enumerable:!0}):r,e)),ot=e=>me(q({},"__esModule",{value:!0}),e);var pt={};tt(pt,{DocstraBody:()=>lt,DocstraCodeBlock:()=>ct,DocstraFileTree:()=>dt,DocstraHeader:()=>ee,DocstraLayout:()=>it,DocstraProvider:()=>rt,SidebarProvider:()=>j,useDocstra:()=>b,useSidebar:()=>z});module.exports=ot(pt);var R=require("react"),we=require("react-toast-msg");var be=require("lucide-react");var pe=require("tailwind-merge"),ue=O(require("clsx"));function m(...e){return(0,pe.twMerge)((0,ue.default)(e))}var P=require("react"),he=O(require("fuse.js")),xe=O(require("next/link")),ye=require("next/navigation");var M=require("react"),ge=require("react/jsx-runtime"),fe=(0,M.createContext)(null);function j({children:e,initialSidebarItems:t}){let[r,o]=(0,M.useState)(t),[a,n]=(0,M.useState)(!1),[s,i]=(0,M.useState)(!1);return(0,ge.jsx)(fe.Provider,{value:{openSidebar:a,setOpenSidebar:n,openSearchBox:s,setOpenSearchBox:i,sidebarItems:r,setSiderbarItems:o},children:e})}function z(){let e=(0,M.useContext)(fe);if(!e)throw new Error("Please wrap your layout with SidebarProvider");return e}var x=require("react/jsx-runtime");function ve(){let{openSearchBox:e,setOpenSearchBox:t}=z(),{page:r}=b(),[o,a]=(0,P.useState)(""),[n,s]=(0,P.useState)([]),i=(0,ye.useRouter)();(0,P.useEffect)(()=>{let c=v=>{v.ctrlKey&&v.key==="k"&&(v.preventDefault(),t(!0))};return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[]);let u=(0,P.useMemo)(()=>!r||r.length===0?null:new he.default(r,{keys:["data.metadata.title","data.metadata.description"],threshold:.3}),[r]);(0,P.useEffect)(()=>{if(o&&u){let c=u.search(o);s(c.map(v=>v.item))}else o||s([])},[o,u]);let f=c=>{if(c.preventDefault(),o){let v=n[0];v&&(i.push(`/docs/${v.slug}`),a(""),t(!1))}};return(0,P.useEffect)(()=>{let c=v=>{v.key==="Escape"&&(t(!1),a(""))};return e&&window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c)}},[e]),(0,x.jsx)("div",{onClick:()=>{t(!1),a("")},className:m("fixed inset-0 z-25 flex items-start justify-center bg-white/40 backdrop-blur-md opacity-0 pointer-events-none transition-all duration-300",e&&"opacity-100 pointer-events-auto"),children:(0,x.jsxs)("div",{onClick:c=>c.stopPropagation(),className:"flex flex-col items-center mt-30 max-w-lg w-full max-md:px-4",children:[(0,x.jsx)("form",{onSubmit:f,className:m("relative flex items-center justify-between w-full bg-white border border-slate-200 text-gray-400 h-15 p-0.5 rounded-lg",o&&"rounded-b-none border-b-0"),children:e&&(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(be.SearchIcon,{className:"size-5.5 mx-3 shrink-0"}),(0,x.jsx)("input",{className:"w-full bg-transparent h-full outline-none text-gray-400 placeholder:text-gray-400",type:"text",placeholder:"Search docs...",spellCheck:"false",autoFocus:!0,value:o,onChange:c=>a(c.target.value),name:"searchQuery",required:!0}),(0,x.jsx)("span",{className:"border border-gray-200 px-2 mr-3 py-1 rounded text-xs",children:"Esc"})]})}),(0,x.jsxs)("div",{className:m("max-h-70 overflow-x-hidden overflow-y-auto scrollbar-y w-full bg-white text-slate-700 flex flex-col",o&&"rounded-b-md border border-slate-200"),children:[n.map(c=>(0,x.jsxs)(xe.default,{href:`/docs/${c.slug==="index"?"":c.slug}`,onClick:()=>{t(!1),a("")},className:"w-full hover:bg-gray-100/70 border-b border-slate-200 transition-all py-4 px-4 last:mb-2",children:[(0,x.jsx)("h4",{className:"font-medium",children:c.data?.metadata?.title||c.slug}),(0,x.jsx)("p",{className:"text-sm mt-1 text-gray-500",children:c.data?.metadata?.description})]},c.slug)),o&&n.length===0&&(0,x.jsx)("div",{className:"text-gray-500 text-center py-20",children:"No results found"})]})]})})}var A=require("react/jsx-runtime"),Ne=(0,R.createContext)(null);function rt({children:e,docstraConfig:t,page:r}){let[o,a]=(0,R.useState)(!1),[n,s]=(0,R.useState)(!1),[i,u]=(0,R.useState)("npm");return(0,A.jsxs)(Ne.Provider,{value:{openSidebar:o,setOpenSidebar:a,docstraConfig:t,openSearchBox:n,setOpenSearchBox:s,packageManager:i,setPackageManager:u,page:r},children:[(0,A.jsx)(we.ToastContainer,{}),(0,A.jsx)(ve,{}),e]})}function b(){let e=(0,R.useContext)(Ne);if(!e)throw new Error("Please wrap your app with DocstraProvider");return e}var K=require("lucide-react"),Se=require("react");var V=O(require("next/link"));var S=require("react/jsx-runtime");function ee(){let{openSidebar:e,setOpenSidebar:t,openSearchBox:r,setOpenSearchBox:o}=z(),{docstraConfig:a}=b(),n="https://github.com/"+a?.editOnGithub?.owner+"/"+a?.editOnGithub?.repo;return(0,Se.useEffect)(()=>{e?document.body.classList.add("max-md:overflow-hidden"):document.body.classList.remove("max-md:overflow-hidden")},[e]),(0,S.jsxs)("header",{className:"fixed w-full top-0 z-10 text-sm flex items-center justify-between border-b border-gray-100 h-18 px-4 md:px-6 bg-white",children:[(0,S.jsx)(V.default,{href:a.navbar?.logo?.link||"/",className:"hover:opacity-80 transition",children:(0,S.jsx)("img",{src:a.navbar?.logo?.src||"/logo.png",alt:a.navbar?.logo?.alt||"Logo",className:m("h-9.5 w-auto",a.navbar?.logo?.className)})}),(0,S.jsxs)("div",{className:"hidden divide-x divide-gray-200 md:flex items-center",children:[a.navbar?.links?.map(s=>(0,S.jsx)(V.default,{href:s.href,className:"px-6 hover:text-gray-600",children:s.name},s.name)),(0,S.jsx)(V.default,{href:n||"https://github.com/sudhucodes/docstra",children:(0,S.jsx)("svg",{className:"size-6 mx-6",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:(0,S.jsx)("path",{d:"M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3"})})})]}),(0,S.jsx)("button",{onClick:()=>t(!e),className:"md:hidden transition text-gray-600 active:ring-2 ring-gray-200 p-1.5 rounded-md",children:e?(0,S.jsx)(K.XIcon,{className:"size-6.5"}):(0,S.jsx)(K.TextAlignEnd,{className:"size-6.5"})})]})}var Z=require("lucide-react"),ke=require("next/navigation");var at=O(require("lucide-react"));function te(e){if(e)return at[e]}var oe=O(require("next/link")),Ce=require("react");var d=require("react/jsx-runtime");function nt({item:e,pathname:t,className:r,openSidebar:o,setOpenSidebar:a}){let[n,s]=(0,Ce.useState)(e.defaultOpen??!0),i=e.collapsible??!0,u=te(e.icon);return(0,d.jsxs)("div",{className:"space-y-0.5",children:[e.group_title&&(0,d.jsx)("p",{className:"inline-flex items-center gap-2 mb-2 mt-2 px-2",children:e.group_title}),(0,d.jsxs)(oe.default,{href:e.href,onClick:()=>{i&&t===e.href&&s(f=>!f)},className:m("w-full flex items-center justify-between gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",e.href===t&&"bg-gray-100 text-gray-800"),children:[(0,d.jsxs)("span",{className:"flex items-center gap-2",children:[u&&(0,d.jsx)(u,{className:"size-4"}),e.nav_title?e.nav_title:e.title]}),i&&(0,d.jsx)("div",{className:"pl-3",children:(0,d.jsx)(Z.ChevronDownIcon,{className:m("size-4 text-black/50 transition-transform duration-300",n&&"rotate-180")})})]}),(!i||n)&&(0,d.jsx)("ul",{className:"mb-4 space-y-0.5",children:e.children.map((f,c)=>(0,d.jsx)(Ie,{className:m('relative pl-7 before:content-[""] before:absolute before:top-1/2 first:before:top-[calc(50%+1px)] last:before:top-[calc(50%-1px)] before:left-4 before:w-px before:h-full last:before:h-[calc(100%+1px)] first:before:h-[calc(100%+1px)] before:bg-gray-200 before:-translate-y-1/2',f.type==="page"&&f.href===t&&'after:content-[""] after:absolute after:top-1/2 after:left-4 after:w-px after:h-6 after:bg-gray-600 after:-translate-y-1/2'),item:f,pathname:t,openSidebar:o,setOpenSidebar:a},`${f.type}-${c}`))})]})}function st({item:e,pathname:t,openSidebar:r,className:o,setOpenSidebar:a}){let n=te(e.icon);return(0,d.jsxs)(oe.default,{href:e.href,onClick:()=>r&&a(!1),className:m("flex items-center gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",t===e.href&&"bg-gray-100 text-gray-800",o),children:[n&&(0,d.jsx)(n,{className:"size-4"}),(0,d.jsx)("span",{children:e.nav_title?e.nav_title:e.title})]})}function Ie({item:e,pathname:t,openSidebar:r,className:o,setOpenSidebar:a}){switch(e.type){case"page":return(0,d.jsx)(st,{item:e,pathname:t,openSidebar:r,className:o,setOpenSidebar:a});case"section":return(0,d.jsx)(nt,{item:e,pathname:t,className:o,openSidebar:r,setOpenSidebar:a});default:return null}}function De(){let{openSidebar:e,setOpenSidebar:t,sidebarItems:r,setOpenSearchBox:o}=z(),a=(0,ke.usePathname)();return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:m("fixed inset-0 z-20 bg-black/50 md:hidden opacity-0 pointer-events-none transition-all duration-300",e&&"opacity-100 pointer-events-auto"),onClick:()=>t(!1)}),(0,d.jsxs)("aside",{className:m("fixed md:top-18 h-[calc(100svh-72px)] space-y-0.5 scrollbar-y w-screen max-md:rounded-t-lg z-21 md:w-72 pb-10 text-base md:text-sm shrink-0 border-r border-gray-200 p-4 max-md:fixed bg-white overflow-y-auto transition-all duration-300",e?"top-32":"top-full"),children:[(0,d.jsxs)("div",{className:"flex items-center select-none gap-2 cursor-pointer mt-6 mb-4 p-2.5 text-gray-500 border border-gray-200 rounded-lg hover:bg-gray-50",onClick:()=>{t(e&&!1),o(!0)},children:[(0,d.jsx)(Z.SearchIcon,{className:"size-4.5"}),(0,d.jsx)("p",{children:"Search"}),(0,d.jsxs)("div",{className:"ms-auto font-mono inline-flex gap-0.5",children:[(0,d.jsx)("span",{className:"rounded-md border border-gray-200 px-1.5",children:"Ctrl"}),(0,d.jsx)("span",{className:"rounded-md border border-gray-200 px-1.5",children:"K"})]})]}),r.map((n,s)=>(0,d.jsx)(Ie,{item:n,pathname:a,openSidebar:e,setOpenSidebar:t},`${n.type}-${s}`))]})]})}var H=require("react/jsx-runtime");function it({children:e,tree:t}){return(0,H.jsx)(j,{initialSidebarItems:t,children:(0,H.jsxs)("div",{className:"min-h-screen flex bg-white w-full",children:[(0,H.jsx)(De,{}),e]})})}var Le=require("next/navigation"),Oe=require("lucide-react"),re=O(require("next/link")),D=require("react/jsx-runtime");function ze(){let t=(0,Le.usePathname)().split("/").filter(Boolean),r=t.map((o,a)=>{let n="/"+t.slice(0,a+1).join("/"),s=o.replace(/-/g," ").replace(/\b\w/g,i=>i.toUpperCase());return{href:n,title:s}});return(0,D.jsx)("nav",{"aria-label":"Breadcrumb",className:"flex text-sm items-center pb-4 text-gray-500 not-prose",children:(0,D.jsxs)("ol",{className:"flex items-center space-x-2",children:[(0,D.jsx)("li",{children:(0,D.jsx)(re.default,{href:"/",className:"hover:text-gray-700 transition-colors font-medium",children:"Home"})}),r.map((o,a)=>{let n=a===r.length-1;return(0,D.jsxs)("li",{className:"flex items-center space-x-2",children:[(0,D.jsx)(Oe.ChevronRight,{className:"w-4 h-4 text-gray-400"}),n?(0,D.jsx)("span",{className:"text-gray-600 font-medium",children:o.title}):(0,D.jsx)(re.default,{href:o.href,className:"hover:text-gray-700 font-medium transition-colors",children:o.title})]},o.href)})]})})}var F=require("lucide-react"),Me=require("next/navigation"),N=require("react");var y=require("react/jsx-runtime");function Re(){let[e,t]=(0,N.useState)(null),[r,o]=(0,N.useState)("down"),[a,n]=(0,N.useState)(!1),[s,i]=(0,N.useState)(!1),{docstraConfig:u,page:f}=b(),c=f?.path,v=f?.tableOfContents||[],ce=(0,N.useRef)(0),Ke=(0,N.useRef)(null),Ze=(0,Me.usePathname)(),Ye=`${"https://github.com/"+u?.editOnGithub?.owner+"/"+u?.editOnGithub?.repo}/edit/main/${u?.editOnGithub?.path}/${c}`;(0,N.useEffect)(()=>{let g=()=>{let w=window.scrollY;o(w>ce.current?"down":"up"),n(w>100),ce.current=w};return window.addEventListener("scroll",g),()=>window.removeEventListener("scroll",g)},[]),(0,N.useEffect)(()=>{let g=document.querySelectorAll("h2[id], h3[id]"),w=new IntersectionObserver(G=>{if(s)return;let T=G.filter($=>$.isIntersecting).sort(($,Qe)=>$.boundingClientRect.top-Qe.boundingClientRect.top);if(T.length>0){let $=r==="down"?T[0].target.id:T[T.length-1].target.id;t($)}},{rootMargin:"-40% 0px -50% 0px",threshold:[0,.2,.6,1]});return g.forEach(G=>w.observe(G)),Ke.current=w,()=>w.disconnect()},[Ze,r,s]),(0,N.useEffect)(()=>{!(window.scrollY>100)&&t(v[0]?.id)},[v]),(0,N.useEffect)(()=>{if(!e)return;let g=document.querySelector(".toc-scroll-container");if(!g)return;let w=g.querySelector(`a[href="#${e}"]`);if(!w)return;let G=g.getBoundingClientRect(),T=w.getBoundingClientRect();(T.top<G.top||T.bottom>G.bottom)&&w.scrollIntoView({behavior:"smooth",block:"nearest"})},[e]),(0,N.useEffect)(()=>{if(!s)return;let g=setTimeout(()=>i(!1),800);return()=>clearTimeout(g)},[s]);let de=g=>{t(g),i(!0)};return(0,y.jsxs)("aside",{className:"sticky top-18 text-sm hidden xl:block text-gray-500 shrink-0 h-[calc(100svh-72px)] w-64 border-l border-gray-200 p-6 overflow-y-auto",children:[(0,y.jsxs)("p",{className:"flex items-center gap-2 mb-5",children:[(0,y.jsx)(F.TextAlignStartIcon,{className:"size-4"}),"On this page"]}),(0,y.jsx)("ul",{className:"toc-scroll-container max-h-3/4 overflow-y-auto scrollbar-none",children:v.map(g=>(0,y.jsxs)("li",{children:[(0,y.jsx)(Pe,{heading:g,activeId:e,handleClick:de}),g.children.map(w=>(0,y.jsx)(Pe,{heading:w,activeId:e,handleClick:de,className:"pl-8"},w.id))]},g.id))}),(0,y.jsx)("hr",{className:"my-6 border-gray-200"}),u.editOnGithub&&(0,y.jsxs)("a",{href:Ye,rel:"noopener noreferrer",className:"flex items-center gap-2 text-zinc-500 hover:text-gray-700 transition",children:["Edit this page on GitHub",(0,y.jsx)(F.SquareArrowOutUpRightIcon,{className:"size-4"})]}),a&&(0,y.jsxs)("button",{onClick:()=>scrollTo({top:0,behavior:"smooth"}),className:"flex items-center cursor-pointer gap-2 mt-3 text-zinc-500 hover:text-gray-700 transition",children:["Scroll to top",(0,y.jsx)(F.ArrowUpCircleIcon,{className:"size-4"})]})]})}function Pe({heading:e,activeId:t,handleClick:r,className:o}){return(0,y.jsx)("a",{href:`#${e.id}`,className:m("border-l border-gray-200 block py-1.5 pl-4 transition-colors",o,{"border-gray-800 text-gray-900 font-medium":t===e.id,"hover:text-gray-800 hover:border-gray-400":t!==e.id}),onClick:()=>r(e.id),children:e.text})}var Y=require("react"),Q=require("lucide-react");var E=require("react/jsx-runtime");function ae({label:e,type:t,placeholder:r="",id:o,required:a=!1,onChange:n,value:s,readOnly:i=!1,className:u="",optional:f=!1}){return(0,E.jsxs)("div",{className:m("flex flex-col mt-4 w-full",u),children:[e&&(0,E.jsxs)("label",{htmlFor:o,className:"font-medium w-max cursor-pointer",children:[e,f&&(0,E.jsx)("span",{className:"text-xs font-normal text-gray-400 ml-1 mt-1",children:"(Optional)"})]}),t==="textarea"?(0,E.jsx)("textarea",{id:o,name:o,className:m("mt-2 w-full p-3 border border-gray-300 resize-none not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",u),placeholder:r,required:a,onChange:n,rows:4,value:s,readOnly:i,maxLength:500}):(0,E.jsx)("input",{type:t,id:o,name:o,className:"mt-2 w-full h-12 px-3 border border-gray-300 not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",placeholder:r,required:a,onChange:n,value:s,readOnly:i,maxLength:500})]})}var Be=require("lucide-react");var ne=require("react/jsx-runtime");function se({label:e,loading:t,type:r="submit",className:o="",disabled:a=!1,onClick:n}){return(0,ne.jsx)("button",{type:r,disabled:a,className:m("relative w-full mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg",o),"aria-label":e,onClick:n,children:t?(0,ne.jsx)(Be.Loader2Icon,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 animate-spin mx-auto"}):e})}var Te=require("formsync");var ie=require("react-toast-msg"),p=require("react/jsx-runtime");function Ee(){let[e,t]=(0,Y.useState)(null),{docstraConfig:r}=b(),[o,a]=(0,Y.useState)(""),[n,s]=(0,Y.useState)(!1),i=r?.editOnGithub?.owner+"/"+r?.editOnGithub?.repo,{isLoading:u,submit:f}=(0,Te.useFormSync)({formId:r?.feedback?.formSyncFormID||"",onSuccess:()=>{ie.toast.success("Feedback submitted successfully"),s(!0),t(null),a("")},onError:c=>{console.log(c),ie.toast.error(c.message,{duration:5e3})}});return(0,p.jsx)("div",{className:"border-y border-gray-200 mt-10 py-10 space-y-4",children:n?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("p",{className:"font-medium text-gray-900",children:"We appreciate your feedback, Thank you!"}),(0,p.jsx)(se,{onClick:()=>{s(!1),t(null),a("")},label:"Submit Again",className:"w-max text-sm"})]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("p",{className:"font-medium",children:"How is this guide?"}),(0,p.jsxs)("div",{className:"flex gap-2",children:[(0,p.jsxs)("button",{onClick:()=>t("good"),className:m("flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm",e==="good"?"bg-green-100 text-green-600 border-green-300":"border-gray-200 text-gray-600 hover:bg-gray-100"),children:[(0,p.jsx)(Q.ThumbsUp,{className:`size-4 ${e==="good"?"fill-green-600":"text-gray-500"}`}),"Good"]}),(0,p.jsxs)("button",{onClick:()=>t("bad"),className:m("flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm",e==="bad"?"bg-red-100 text-red-600 border-red-300":"border-gray-200 text-gray-600 hover:bg-gray-100"),children:[(0,p.jsx)(Q.ThumbsDown,{className:m("size-4 pt-0.5",e==="bad"?"fill-red-600":"text-gray-500")}),"Bad"]})]}),e&&(0,p.jsxs)("form",{className:"flex flex-col gap-2",onSubmit:f,children:[(0,p.jsx)(ae,{value:o,id:"message",onChange:c=>a(c.target.value),placeholder:"Leave your feedback...",required:!0,type:"textarea"}),(0,p.jsx)("input",{type:"hidden",name:"opinion",value:e}),(0,p.jsx)("input",{type:"hidden",name:"page",value:window.location.href}),(0,p.jsx)("input",{type:"hidden",name:"_redirect",value:window.location.href}),(0,p.jsx)("input",{type:"hidden",name:"_source",value:"sdk"}),(0,p.jsx)("input",{type:"hidden",name:"_fs_hp",tabIndex:-1,autoComplete:"off"}),(0,p.jsx)("button",{type:"submit",disabled:u,className:"relative mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg w-max text-sm",children:u?"Submitting...":"Submit"}),r?.feedback?.watermark!==!1&&(0,p.jsxs)("p",{className:"text-left text-sm text-gray-500 mt-6",children:["Powered by"," ",(0,p.jsx)("a",{href:`https://www.formsync.app?utm_source=${i}`,className:"text-gray-800 not-prose",children:"FormSync"})]})]})]})})}var $e=require("react/jsx-runtime");function Ge(){let{page:e}=b();if(!e?.lastUpdated)return null;let t=new Date(e.lastUpdated).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"});return(0,$e.jsxs)("p",{className:"text-sm text-gray-500",children:["Last updated on ",t]})}var I=O(require("@radix-ui/react-dropdown-menu")),U=require("lucide-react"),_=require("react");var l=require("react/jsx-runtime");function Fe(){let{page:e,docstraConfig:t}=b(),[r,o]=(0,_.useState)(!1),[a,n]=(0,_.useState)(null),i=`${"https://github.com/"+t?.editOnGithub?.owner+"/"+t?.editOnGithub?.repo}/blob/main/${t?.editOnGithub?.path}/${e?.path}`;(0,_.useEffect)(()=>{n(window.location.href)},[]);let u=()=>{navigator.clipboard.writeText(e?.raw||""),o(!0),setTimeout(()=>o(!1),3e3)},f=`Read from this URL: ${a} and explain it to me.`;return(0,l.jsxs)("div",{className:"flex items-center gap-3 mt-6 not-prose",children:[(0,l.jsxs)("button",{title:"Copy Markdown",onClick:u,className:"flex items-center cursor-pointer gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",children:[r?(0,l.jsx)(U.CheckIcon,{className:"size-3.5"}):(0,l.jsx)(U.CopyIcon,{className:"size-3.5"}),"Copy Markdown"]}),(0,l.jsxs)(I.Root,{children:[(0,l.jsx)(I.Trigger,{asChild:!0,children:(0,l.jsxs)("button",{className:"flex items-center gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs outline-none focus:outline-none focus:ring-0",children:["Open",(0,l.jsx)(U.ChevronDownIcon,{className:"size-3.5"})]})}),(0,l.jsxs)(I.Content,{className:"bg-white border border-gray-200 rounded-md shadow-md p-1 mt-2 text-sm",align:"end",children:[(0,l.jsx)(I.Item,{asChild:!0,children:(0,l.jsxs)("a",{href:i,target:"_blank",className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[(0,l.jsxs)("svg",{className:"size-4.5",fill:"currentColor",viewBox:"0 0 24 24",children:[(0,l.jsx)("title",{children:"GitHub"}),(0,l.jsx)("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]}),"Open in GitHub"]})}),(0,l.jsx)(I.Item,{asChild:!0,children:(0,l.jsxs)("a",{href:`https://chatgpt.com/?q=${encodeURIComponent(f)}`,target:"_blank",className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[(0,l.jsxs)("svg",{className:"size-4.5",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[(0,l.jsx)("title",{children:"OpenAI"}),(0,l.jsx)("path",{d:"M22.282 9.821a6 6 0 0 0-.516-4.91 6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9 6.05 6.05 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206 6 6 0 0 0 3.997-2.9 6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023-.141-.085-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365 2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5Z"})]}),"Open in ChatGPT"]})}),(0,l.jsx)(I.Item,{asChild:!0,children:(0,l.jsxs)("a",{href:`https://claude.ai/new?q=${encodeURIComponent(f)}`,target:"_blank",className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[(0,l.jsxs)("svg",{className:"size-4.5",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,l.jsx)("title",{children:"Anthropic"}),(0,l.jsx)("path",{d:"M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.37-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223L8.616 7.82l2.291 5.945Z"})]}),"Open in Claude"]})}),(0,l.jsx)(I.Item,{asChild:!0,children:(0,l.jsxs)("a",{href:`https://cursor.com/link/prompt?text=${encodeURIComponent(f)}`,className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[(0,l.jsxs)("svg",{className:"size-4.5",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[(0,l.jsx)("title",{children:"Cursor"}),(0,l.jsx)("path",{d:"M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23"})]}),"Open in Cursor"]})})]})]})]})}var Ue=require("next/navigation"),le=O(require("next/link")),W=require("lucide-react");var k=require("react/jsx-runtime");function Ae(e){let t=[];for(let r of e)r.type==="page"?t.push({name:r.title,href:r.href,icon:r.icon}):r.type==="section"&&t.push(...Ae(r.children));return t}function He(){let e=(0,Ue.usePathname)(),{docstraConfig:t}=b(),{sidebarItems:r}=z(),o=[];r&&r.length>0?o=Ae(r):t?.sidebar?.links&&(o=t.sidebar.links.flatMap(i=>i.items));let a=o.findIndex(i=>i.href===e),n=a>0?o[a-1]:null,s=a<o.length-1?o[a+1]:null;return(0,k.jsxs)("div",{className:"flex flex-col lg:flex-row gap-2 justify-between py-10 mt-10",children:[n?(0,k.jsxs)(le.default,{href:n.href,className:"flex flex-col not-prose items-start gap-2 border border-gray-200 hover:bg-gray-50 py-3 md:min-w-62 pl-4 pr-10 rounded-lg text-sm",children:[(0,k.jsx)("span",{className:"text-gray-500",children:"Previous"}),(0,k.jsxs)("p",{className:"flex items-center font-medium",children:[(0,k.jsx)(W.ArrowLeftIcon,{className:"size-5 mr-2"}),n.name]})]}):(0,k.jsx)("div",{}),s?(0,k.jsxs)(le.default,{href:s.href,className:"flex flex-col not-prose items-end gap-2 border border-gray-200 hover:bg-gray-50 py-3 pr-4 md:min-w-62 pl-10 rounded-lg text-sm",children:[(0,k.jsx)("span",{className:"text-gray-500",children:"Next"}),(0,k.jsxs)("p",{className:"flex items-center font-medium",children:[s.name,(0,k.jsx)(W.ArrowRightIcon,{className:"size-5 ml-2"})]})]}):(0,k.jsx)("div",{})]})}var h=require("react/jsx-runtime");function lt({children:e}){let{docstraConfig:t,page:r}=b();return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ee,{}),(0,h.jsxs)("main",{className:"flex-1 px-4 md:px-8 md:pl-80 pt-28 py-10 prose prose-headings:scroll-mt-28 max-w-none",children:[(0,h.jsxs)("div",{className:"not-prose",children:[(0,h.jsx)(ze,{}),(0,h.jsx)("h1",{className:"text-3xl font-bold text-black",children:r?.metadata?.title}),(0,h.jsx)("p",{className:"my-2 text-gray-500",children:r?.metadata?.description}),(0,h.jsx)(Fe,{})]}),(0,h.jsx)("hr",{className:"border-gray-200"}),e,t?.feedback?.enabled&&(0,h.jsx)(Ee,{}),(0,h.jsx)(Ge,{}),(0,h.jsx)(He,{})]}),(0,h.jsx)(Re,{})]})}var X=require("lucide-react"),_e=require("react"),qe=require("react-toast-msg");var L=require("react/jsx-runtime");function ct(e){let{title:t,copy:r,children:o}=e;if(typeof o=="string")return(0,L.jsx)("code",{className:"not-prose px-1 py-0.5 rounded border border-gray-200 bg-gray-50 text-gray-800 text-sm",children:o});let[n,s]=(0,_e.useState)(!1),i=e["data-language"],u=()=>{r&&(navigator.clipboard.writeText(e.raw),s(!0),qe.toast.success("Code copied to clipboard"),setTimeout(()=>s(!1),2e3))};return(0,L.jsxs)("div",{className:"max-w-2xl overflow-hidden rounded-lg text-sm text-gray-800 border border-gray-200 mt-4 bg-white",children:[(0,L.jsxs)("div",{className:"flex items-center justify-between bg-gray-50 border-b border-gray-200",children:[(0,L.jsx)("span",{className:m("text-xs text-gray-400 px-4 py-3",!r&&"py-4"),children:t||i}),r&&(0,L.jsx)("button",{onClick:u,className:"rounded-lg cursor-pointer p-2 m-2 text-gray-500 hover:bg-gray-200 transition",children:n?(0,L.jsx)(X.CheckIcon,{className:"size-4 text-green-600"}):(0,L.jsx)(X.CopyIcon,{className:"size-4"})})]}),(0,L.jsx)("div",{className:"p-4 scrollbar-x max-md:max-w-[calc(100vw-34px)] whitespace-pre overflow-x-auto text-sm leading-relaxed",children:o})]})}var J=require("react"),B=require("lucide-react"),C=require("react/jsx-runtime");function dt({data:e,fromText:t}){let r=(0,J.useMemo)(()=>e||(t?mt(t):[]),[e,t]);return(0,C.jsx)("div",{className:"rounded-lg border border-zinc-200 bg-white p-3 text-sm min-w-80",children:r.map((o,a)=>(0,C.jsx)(Ve,{node:o},a))})}function Ve({node:e}){let[t,r]=(0,J.useState)(!0),o=e.type==="folder";return(0,C.jsxs)("div",{children:[(0,C.jsxs)("div",{onClick:()=>o&&r(a=>!a),className:"flex items-center gap-2 py-1.5 px-2 rounded-md cursor-pointer hover:bg-gray-100",children:[o&&(0,C.jsx)(B.ChevronRight,{className:`size-4 ${t&&"rotate-90"}`}),o?t?(0,C.jsx)(B.FolderOpen,{className:"size-4 text-blue-500"}):(0,C.jsx)(B.Folder,{className:"size-4 text-blue-500"}):(0,C.jsx)(B.FileText,{className:"size-4 text-gray-500"}),(0,C.jsx)("span",{children:e.name})]}),o&&t&&e.children&&(0,C.jsx)("div",{className:"ml-3 pl-3 border-l border-zinc-300",children:e.children.map((a,n)=>(0,C.jsx)(Ve,{node:a},n))})]})}function mt(e){let t=e.split(`
2
+ `).map(a=>a.replace(/\t/g," ")).filter(a=>a.trim().length>0),r=[],o=[];for(let a of t){let n=a.match(/^ */)?.[0].length||0,s=a.trim(),i=s.endsWith("/"),f={name:i?s.slice(0,-1):s,type:i?"folder":"file",children:i?[]:void 0};for(;o.length&&o[o.length-1].indent>=n;)o.pop();o.length===0?r.push(f):o[o.length-1].node.children?.push(f),i&&o.push({indent:n,node:f})}return r}0&&(module.exports={DocstraBody,DocstraCodeBlock,DocstraFileTree,DocstraHeader,DocstraLayout,DocstraProvider,SidebarProvider,useDocstra,useSidebar});
@@ -1,2 +1,2 @@
1
- "use client";import{createContext as Ke,useContext as Ze,useState as H}from"react";import{ToastContainer as Ye}from"react-toast-msg";import{SearchIcon as Fe}from"lucide-react";import{twMerge as Be}from"tailwind-merge";import Ee from"clsx";function c(...e){return Be(Ee(e))}import{useEffect as U,useMemo as Ue,useState as te}from"react";import He from"fuse.js";import _e from"next/link";import{useRouter as qe}from"next/navigation";import{createContext as Ge,useContext as $e,useState as F}from"react";import{jsx as Ae}from"react/jsx-runtime";var j=Ge(null);function ee({children:e,initialSidebarItems:r}){let[o,t]=F(r),[a,n]=F(!1),[s,i]=F(!1);return Ae(j.Provider,{value:{openSidebar:a,setOpenSidebar:n,openSearchBox:s,setOpenSearchBox:i,sidebarItems:o,setSiderbarItems:t},children:e})}function k(){let e=$e(j);if(!e)throw new Error("Please wrap your layout with SidebarProvider");return e}import{Fragment as Ve,jsx as C,jsxs as $}from"react/jsx-runtime";function re(){let{openSearchBox:e,setOpenSearchBox:r}=k(),{page:o}=u(),[t,a]=te(""),[n,s]=te([]),i=qe();U(()=>{let l=b=>{b.ctrlKey&&b.key==="k"&&(b.preventDefault(),r(!0))};return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[]);let m=Ue(()=>!o||o.length===0?null:new He(o,{keys:["data.metadata.title","data.metadata.description"],threshold:.3}),[o]);U(()=>{if(t&&m){let l=m.search(t);s(l.map(b=>b.item))}else t||s([])},[t,m]);let d=l=>{if(l.preventDefault(),t){let b=n[0];b&&(i.push(`/docs/${b.slug}`),a(""),r(!1))}};return U(()=>{let l=b=>{b.key==="Escape"&&(r(!1),a(""))};return e&&window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[e]),C("div",{onClick:()=>{r(!1),a("")},className:c("fixed inset-0 z-25 flex items-start justify-center bg-white/40 backdrop-blur-md opacity-0 pointer-events-none transition-all duration-300",e&&"opacity-100 pointer-events-auto"),children:$("div",{onClick:l=>l.stopPropagation(),className:"flex flex-col items-center mt-30 max-w-lg w-full max-md:px-4",children:[C("form",{onSubmit:d,className:c("relative flex items-center justify-between w-full bg-white border border-slate-200 text-gray-400 h-15 p-0.5 rounded-lg",t&&"rounded-b-none border-b-0"),children:e&&$(Ve,{children:[C(Fe,{className:"size-5.5 mx-3 shrink-0"}),C("input",{className:"w-full bg-transparent h-full outline-none text-gray-400 placeholder:text-gray-400",type:"text",placeholder:"Search docs...",spellCheck:"false",autoFocus:!0,value:t,onChange:l=>a(l.target.value),name:"searchQuery",required:!0}),C("span",{className:"border border-gray-200 px-2 mr-3 py-1 rounded text-xs",children:"Esc"})]})}),$("div",{className:c("max-h-70 overflow-x-hidden overflow-y-auto scrollbar-y w-full bg-white text-slate-700 flex flex-col",t&&"rounded-b-md border border-slate-200"),children:[n.map(l=>$(_e,{href:`/docs/${l.slug==="index"?"":l.slug}`,onClick:()=>{r(!1),a("")},className:"w-full hover:bg-gray-100/70 border-b border-slate-200 transition-all py-4 px-4 last:mb-2",children:[C("h4",{className:"font-medium",children:l.data?.metadata?.title||l.slug}),C("p",{className:"text-sm mt-1 text-gray-500",children:l.data?.metadata?.description})]},l.slug)),t&&n.length===0&&C("div",{className:"text-gray-500 text-center py-20",children:"No results found"})]})]})})}import{jsx as oe,jsxs as Qe}from"react/jsx-runtime";var ae=Ke(null);function sr({children:e,docstraConfig:r,page:o}){let[t,a]=H(!1),[n,s]=H(!1),[i,m]=H("npm");return Qe(ae.Provider,{value:{openSidebar:t,setOpenSidebar:a,docstraConfig:r,openSearchBox:n,setOpenSearchBox:s,packageManager:i,setPackageManager:m,page:o},children:[oe(Ye,{}),oe(re,{}),e]})}function u(){let e=Ze(ae);if(!e)throw new Error("Please wrap your app with DocstraProvider");return e}import{TextAlignEnd as We,XIcon as Xe}from"lucide-react";import{useEffect as Je}from"react";import _ from"next/link";import{jsx as N,jsxs as ne}from"react/jsx-runtime";function se(){let{openSidebar:e,setOpenSidebar:r,openSearchBox:o,setOpenSearchBox:t}=k(),{docstraConfig:a}=u(),n="https://github.com/"+a?.editOnGithub?.owner+"/"+a?.editOnGithub?.repo;return Je(()=>{e?document.body.classList.add("max-md:overflow-hidden"):document.body.classList.remove("max-md:overflow-hidden")},[e]),ne("header",{className:"fixed w-full top-0 z-10 text-sm flex items-center justify-between border-b border-gray-100 h-18 px-4 md:px-6 bg-white",children:[N(_,{href:a.navbar?.logo?.link||"/",className:"hover:opacity-80 transition",children:N("img",{src:a.navbar?.logo?.src||"/logo.png",alt:a.navbar?.logo?.alt||"Logo",className:c("h-9.5 w-auto",a.navbar?.logo?.className)})}),ne("div",{className:"hidden divide-x divide-gray-200 md:flex items-center",children:[a.navbar?.links?.map(s=>N(_,{href:s.href,className:"px-6 hover:text-gray-600",children:s.name},s.name)),N(_,{href:n||"https://github.com/sudhucodes/docstra",children:N("svg",{className:"size-6 mx-6",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:N("path",{d:"M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3"})})})]}),N("button",{onClick:()=>r(!e),className:"md:hidden transition text-gray-600 active:ring-2 ring-gray-200 p-1.5 rounded-md",children:e?N(Xe,{className:"size-6.5"}):N(We,{className:"size-6.5"})})]})}import{ChevronDownIcon as et,SearchIcon as tt}from"lucide-react";import{usePathname as rt}from"next/navigation";import*as je from"lucide-react";function q(e){if(e)return je[e]}import ie from"next/link";import{useState as ot}from"react";import{Fragment as st,jsx as f,jsxs as I}from"react/jsx-runtime";function at({item:e,pathname:r,className:o,openSidebar:t,setOpenSidebar:a}){let[n,s]=ot(e.defaultOpen??!0),i=e.collapsible??!0,m=q(e.icon);return I("div",{className:"space-y-0.5",children:[e.group_title&&f("p",{className:"inline-flex items-center gap-2 mb-2 mt-2 px-2",children:e.group_title}),I(ie,{href:e.href,onClick:()=>{i&&r===e.href&&s(d=>!d)},className:c("w-full flex items-center justify-between gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",e.href===r&&"bg-gray-100 text-gray-800"),children:[I("span",{className:"flex items-center gap-2",children:[m&&f(m,{className:"size-4"}),e.nav_title?e.nav_title:e.title]}),i&&f("div",{className:"pl-3",children:f(et,{className:c("size-4 text-black/50 transition-transform duration-300",n&&"rotate-180")})})]}),(!i||n)&&f("ul",{className:"mb-4 space-y-0.5",children:e.children.map((d,l)=>f(le,{className:c('relative pl-7 before:content-[""] before:absolute before:top-1/2 first:before:top-[calc(50%+1px)] last:before:top-[calc(50%-1px)] before:left-4 before:w-px before:h-full last:before:h-[calc(100%+1px)] first:before:h-[calc(100%+1px)] before:bg-gray-200 before:-translate-y-1/2',d.type==="page"&&d.href===r&&'after:content-[""] after:absolute after:top-1/2 after:left-4 after:w-px after:h-6 after:bg-gray-600 after:-translate-y-1/2'),item:d,pathname:r,openSidebar:t,setOpenSidebar:a},`${d.type}-${l}`))})]})}function nt({item:e,pathname:r,openSidebar:o,className:t,setOpenSidebar:a}){let n=q(e.icon);return I(ie,{href:e.href,onClick:()=>o&&a(!1),className:c("flex items-center gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",r===e.href&&"bg-gray-100 text-gray-800",t),children:[n&&f(n,{className:"size-4"}),f("span",{children:e.nav_title?e.nav_title:e.title})]})}function le({item:e,pathname:r,openSidebar:o,className:t,setOpenSidebar:a}){switch(e.type){case"page":return f(nt,{item:e,pathname:r,openSidebar:o,className:t,setOpenSidebar:a});case"section":return f(at,{item:e,pathname:r,className:t,openSidebar:o,setOpenSidebar:a});default:return null}}function ce(){let{openSidebar:e,setOpenSidebar:r,sidebarItems:o,setOpenSearchBox:t}=k(),a=rt();return I(st,{children:[f("div",{className:c("fixed inset-0 z-20 bg-black/50 md:hidden opacity-0 pointer-events-none transition-all duration-300",e&&"opacity-100 pointer-events-auto"),onClick:()=>r(!1)}),I("aside",{className:c("fixed md:top-18 h-[calc(100svh-72px)] space-y-0.5 scrollbar-y w-screen max-md:rounded-t-lg z-21 md:w-72 pb-10 text-base md:text-sm shrink-0 border-r border-gray-200 p-4 max-md:fixed bg-white overflow-y-auto transition-all duration-300",e?"top-32":"top-full"),children:[I("div",{className:"flex items-center select-none gap-2 cursor-pointer mt-6 mb-4 p-2.5 text-gray-500 border border-gray-200 rounded-lg hover:bg-gray-50",onClick:()=>{r(e&&!1),t(!0)},children:[f(tt,{className:"size-4.5"}),f("p",{children:"Search"}),I("div",{className:"ms-auto font-mono inline-flex gap-0.5",children:[f("span",{className:"rounded-md border border-gray-200 px-1.5",children:"Ctrl"}),f("span",{className:"rounded-md border border-gray-200 px-1.5",children:"K"})]})]}),o.map((n,s)=>f(le,{item:n,pathname:a,openSidebar:e,setOpenSidebar:r},`${n.type}-${s}`))]})]})}import{jsx as de,jsxs as it}from"react/jsx-runtime";function Or({children:e,tree:r}){return de(ee,{initialSidebarItems:r,children:it("div",{className:"min-h-screen flex bg-white w-full",children:[de(ce,{}),e]})})}import{usePathname as lt}from"next/navigation";import{ChevronRight as ct}from"lucide-react";import me from"next/link";import{jsx as M,jsxs as pe}from"react/jsx-runtime";function ue(){let r=lt().split("/").filter(Boolean),o=r.map((t,a)=>{let n="/"+r.slice(0,a+1).join("/"),s=t.replace(/-/g," ").replace(/\b\w/g,i=>i.toUpperCase());return{href:n,title:s}});return M("nav",{"aria-label":"Breadcrumb",className:"flex text-sm items-center pb-4 text-gray-500 not-prose",children:pe("ol",{className:"flex items-center space-x-2",children:[M("li",{children:M(me,{href:"/",className:"hover:text-gray-700 transition-colors font-medium",children:"Home"})}),o.map((t,a)=>{let n=a===o.length-1;return pe("li",{className:"flex items-center space-x-2",children:[M(ct,{className:"w-4 h-4 text-gray-400"}),n?M("span",{className:"text-gray-600 font-medium",children:t.title}):M(me,{href:t.href,className:"hover:text-gray-700 font-medium transition-colors",children:t.title})]},t.href)})]})})}import{ArrowUpCircleIcon as dt,SquareArrowOutUpRightIcon as mt,TextAlignStartIcon as pt}from"lucide-react";import{usePathname as ut}from"next/navigation";import{useEffect as B,useRef as fe,useState as A}from"react";import{jsx as D,jsxs as E}from"react/jsx-runtime";function be(){let[e,r]=A(null),[o,t]=A("down"),[a,n]=A(!1),[s,i]=A(!1),{docstraConfig:m,page:d}=u(),l=d?.path,b=d?.tableOfContents||[],X=fe(0),ze=fe(null),Me=ut(),Re=`${"https://github.com/"+m?.editOnGithub?.owner+"/"+m?.editOnGithub?.repo}/edit/main/${m?.editOnGithub?.path}/${l}`;B(()=>{let p=()=>{let h=window.scrollY;t(h>X.current?"down":"up"),n(h>100),X.current=h};return window.addEventListener("scroll",p),()=>window.removeEventListener("scroll",p)},[]),B(()=>{let p=document.querySelectorAll("h2[id], h3[id]"),h=new IntersectionObserver(P=>{if(s)return;let L=P.filter(z=>z.isIntersecting).sort((z,Te)=>z.boundingClientRect.top-Te.boundingClientRect.top);if(L.length>0){let z=o==="down"?L[0].target.id:L[L.length-1].target.id;r(z)}},{rootMargin:"-40% 0px -50% 0px",threshold:[0,.2,.6,1]});return p.forEach(P=>h.observe(P)),ze.current=h,()=>h.disconnect()},[Me,o,s]),B(()=>{!(window.scrollY>100)&&r(b[0]?.id)},[b]),B(()=>{if(!e)return;let p=document.querySelector(".toc-scroll-container");if(!p)return;let h=p.querySelector(`a[href="#${e}"]`);if(!h)return;let P=p.getBoundingClientRect(),L=h.getBoundingClientRect();(L.top<P.top||L.bottom>P.bottom)&&h.scrollIntoView({behavior:"smooth",block:"nearest"})},[e]),B(()=>{if(!s)return;let p=setTimeout(()=>i(!1),800);return()=>clearTimeout(p)},[s]);let J=p=>{r(p),i(!0)};return E("aside",{className:"sticky top-18 text-sm hidden xl:block text-gray-500 shrink-0 h-[calc(100svh-72px)] w-64 border-l border-gray-200 p-6 overflow-y-auto",children:[E("p",{className:"flex items-center gap-2 mb-5",children:[D(pt,{className:"size-4"}),"On this page"]}),D("ul",{className:"toc-scroll-container max-h-3/4 overflow-y-auto scrollbar-none",children:b.map(p=>E("li",{children:[D(ge,{heading:p,activeId:e,handleClick:J}),p.children.map(h=>D(ge,{heading:h,activeId:e,handleClick:J,className:"pl-8"},h.id))]},p.id))}),D("hr",{className:"my-6 border-gray-200"}),m.editOnGithub&&E("a",{href:Re,rel:"noopener noreferrer",className:"flex items-center gap-2 text-gray-400 hover:text-gray-700 transition",children:["Edit this page on GitHub",D(mt,{className:"size-4"})]}),a&&E("button",{onClick:()=>scrollTo({top:0,behavior:"smooth"}),className:"flex items-center cursor-pointer gap-2 mt-3 text-gray-400 hover:text-gray-700 transition",children:["Scroll to top",D(dt,{className:"size-4"})]})]})}function ge({heading:e,activeId:r,handleClick:o,className:t}){return D("a",{href:`#${e.id}`,className:c("border-l border-gray-200 block py-1.5 pl-4 transition-colors",t,{"border-gray-800 text-gray-900 font-medium":r===e.id,"hover:text-gray-800 hover:border-gray-400":r!==e.id}),onClick:()=>o(e.id),children:e.text})}import{useState as Y}from"react";import{ThumbsUp as gt,ThumbsDown as bt}from"lucide-react";import{jsx as V,jsxs as he}from"react/jsx-runtime";function K({label:e,type:r,placeholder:o="",id:t,required:a=!1,onChange:n,value:s,readOnly:i=!1,className:m="",optional:d=!1}){return he("div",{className:c("flex flex-col mt-4 w-full",m),children:[e&&he("label",{htmlFor:t,className:"font-medium w-max cursor-pointer",children:[e,d&&V("span",{className:"text-xs font-normal text-gray-400 ml-1 mt-1",children:"(Optional)"})]}),r==="textarea"?V("textarea",{id:t,name:t,className:c("mt-2 w-full p-3 border border-gray-300 resize-none not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",m),placeholder:o,required:a,onChange:n,rows:4,value:s,readOnly:i,maxLength:500}):V("input",{type:r,id:t,name:t,className:"mt-2 w-full h-12 px-3 border border-gray-300 not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",placeholder:o,required:a,onChange:n,value:s,readOnly:i,maxLength:500})]})}import{Loader2Icon as ft}from"lucide-react";import{jsx as xe}from"react/jsx-runtime";function Z({label:e,loading:r,type:o="submit",className:t="",disabled:a=!1,onClick:n}){return xe("button",{type:o,disabled:a,className:c("relative w-full mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg",t),"aria-label":e,onClick:n,children:r?xe(ft,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 animate-spin mx-auto"}):e})}import{useFormSync as ht}from"formsync";import{toast as ye}from"react-toast-msg";import{Fragment as ve,jsx as x,jsxs as O}from"react/jsx-runtime";function we(){let[e,r]=Y(null),{docstraConfig:o}=u(),[t,a]=Y(""),[n,s]=Y(!1),i=o?.editOnGithub?.owner+"/"+o?.editOnGithub?.repo,{isLoading:m,submit:d}=ht({formId:o?.feedback?.formSyncFormID||"",onSuccess:()=>{ye.success("Feedback submitted successfully"),s(!0),r(null),a("")},onError:l=>{console.log(l),ye.error(l.message,{duration:5e3})}});return x("div",{className:"border-y border-gray-200 mt-10 py-10 space-y-4",children:n?O(ve,{children:[x("p",{className:"font-medium text-gray-900",children:"We appreciate your feedback, Thank you!"}),x(Z,{onClick:()=>{s(!1),r(null),a("")},label:"Submit Again",className:"w-max text-sm"})]}):O(ve,{children:[x("p",{className:"font-medium",children:"How is this guide?"}),O("div",{className:"flex gap-2",children:[O("button",{onClick:()=>r("good"),className:c("flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm",e==="good"?"bg-green-100 text-green-600 border-green-300":"border-gray-200 text-gray-600 hover:bg-gray-100"),children:[x(gt,{className:`size-4 ${e==="good"?"fill-green-600":"text-gray-500"}`}),"Good"]}),O("button",{onClick:()=>r("bad"),className:c("flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm",e==="bad"?"bg-red-100 text-red-600 border-red-300":"border-gray-200 text-gray-600 hover:bg-gray-100"),children:[x(bt,{className:c("size-4 pt-0.5",e==="bad"?"fill-red-600":"text-gray-500")}),"Bad"]})]}),e&&O("form",{className:"flex flex-col gap-2",onSubmit:d,children:[x(K,{value:t,id:"message",onChange:l=>a(l.target.value),placeholder:"Leave your feedback...",required:!0,type:"textarea"}),x("input",{type:"hidden",name:"opinion",value:e}),x("input",{type:"hidden",name:"page",value:window.location.href}),x("input",{type:"hidden",name:"_redirect",value:window.location.href}),x("input",{type:"hidden",name:"_source",value:"sdk"}),x("input",{type:"hidden",name:"_fs_hp",tabIndex:-1,autoComplete:"off"}),x("button",{type:"submit",disabled:m,className:"relative mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg w-max text-sm",children:m?"Submitting...":"Submit"}),o?.feedback?.watermark!==!1&&O("p",{className:"text-left text-sm text-gray-500 mt-6",children:["Powered by"," ",x("a",{href:`https://www.formsync.app?utm_source=${i}`,className:"text-gray-800 not-prose",children:"FormSync"})]})]})]})})}import{jsxs as xt}from"react/jsx-runtime";function Ne(){let{page:e}=u();if(!e?.lastUpdated)return null;let r=new Date(e.lastUpdated).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"});return xt("p",{className:"text-sm text-gray-500",children:["Last updated on ",r]})}import*as v from"@radix-ui/react-dropdown-menu";import{CheckIcon as yt,CopyIcon as vt,ChevronDownIcon as wt}from"lucide-react";import{useEffect as Nt,useState as Se}from"react";import{jsx as g,jsxs as y}from"react/jsx-runtime";function ke(){let{page:e,docstraConfig:r}=u(),[o,t]=Se(!1),[a,n]=Se(null),i=`${"https://github.com/"+r?.editOnGithub?.owner+"/"+r?.editOnGithub?.repo}/blob/main/${r?.editOnGithub?.path}/${e?.path}`;Nt(()=>{n(window.location.href)},[]);let m=()=>{navigator.clipboard.writeText(e?.raw||""),t(!0),setTimeout(()=>t(!1),3e3)},d=`Read from this URL: ${a} and explain it to me.`;return y("div",{className:"flex items-center gap-3 mt-6 not-prose",children:[y("button",{title:"Copy Markdown",onClick:m,className:"flex items-center cursor-pointer gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",children:[o?g(yt,{className:"size-3.5"}):g(vt,{className:"size-3.5"}),"Copy Markdown"]}),y(v.Root,{children:[g(v.Trigger,{asChild:!0,children:y("button",{className:"flex items-center gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs outline-none focus:outline-none focus:ring-0",children:["Open",g(wt,{className:"size-3.5"})]})}),y(v.Content,{className:"bg-white border border-gray-200 rounded-md shadow-md p-1 mt-2 text-sm",align:"end",children:[g(v.Item,{asChild:!0,children:y("a",{href:i,target:"_blank",className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[y("svg",{className:"size-4.5",fill:"currentColor",viewBox:"0 0 24 24",children:[g("title",{children:"GitHub"}),g("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]}),"Open in GitHub"]})}),g(v.Item,{asChild:!0,children:y("a",{href:`https://chatgpt.com/?q=${encodeURIComponent(d)}`,target:"_blank",className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[y("svg",{className:"size-4.5",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[g("title",{children:"OpenAI"}),g("path",{d:"M22.282 9.821a6 6 0 0 0-.516-4.91 6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9 6.05 6.05 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206 6 6 0 0 0 3.997-2.9 6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023-.141-.085-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365 2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5Z"})]}),"Open in ChatGPT"]})}),g(v.Item,{asChild:!0,children:y("a",{href:`https://claude.ai/new?q=${encodeURIComponent(d)}`,target:"_blank",className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[y("svg",{className:"size-4.5",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[g("title",{children:"Anthropic"}),g("path",{d:"M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.37-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223L8.616 7.82l2.291 5.945Z"})]}),"Open in Claude"]})}),g(v.Item,{asChild:!0,children:y("a",{href:`https://cursor.com/link/prompt?text=${encodeURIComponent(d)}`,className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[y("svg",{className:"size-4.5",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[g("title",{children:"Cursor"}),g("path",{d:"M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23"})]}),"Open in Cursor"]})})]})]})]})}import{usePathname as St}from"next/navigation";import Ce from"next/link";import{ArrowLeftIcon as kt,ArrowRightIcon as Ct}from"lucide-react";import{jsx as R,jsxs as G}from"react/jsx-runtime";function Ie(e){let r=[];for(let o of e)o.type==="page"?r.push({name:o.title,href:o.href,icon:o.icon}):o.type==="section"&&r.push(...Ie(o.children));return r}function De(){let e=St(),{docstraConfig:r}=u(),{sidebarItems:o}=k(),t=[];o&&o.length>0?t=Ie(o):r?.sidebar?.links&&(t=r.sidebar.links.flatMap(i=>i.items));let a=t.findIndex(i=>i.href===e),n=a>0?t[a-1]:null,s=a<t.length-1?t[a+1]:null;return G("div",{className:"flex flex-col lg:flex-row gap-2 justify-between py-10 mt-10",children:[n?G(Ce,{href:n.href,className:"flex flex-col not-prose items-start gap-2 border border-gray-200 hover:bg-gray-50 py-3 md:min-w-62 pl-4 pr-10 rounded-lg text-sm",children:[R("span",{className:"text-gray-500",children:"Previous"}),G("p",{className:"flex items-center font-medium",children:[R(kt,{className:"size-5 mr-2"}),n.name]})]}):R("div",{}),s?G(Ce,{href:s.href,className:"flex flex-col not-prose items-end gap-2 border border-gray-200 hover:bg-gray-50 py-3 pr-4 md:min-w-62 pl-10 rounded-lg text-sm",children:[R("span",{className:"text-gray-500",children:"Next"}),G("p",{className:"flex items-center font-medium",children:[s.name,R(Ct,{className:"size-5 ml-2"})]})]}):R("div",{})]})}import{Fragment as It,jsx as w,jsxs as Q}from"react/jsx-runtime";function zo({children:e}){let{docstraConfig:r,page:o}=u();return Q(It,{children:[w(se,{}),Q("main",{className:"flex-1 px-4 md:px-8 md:pl-80 pt-28 py-10 prose prose-headings:scroll-mt-28 max-w-none",children:[Q("div",{className:"not-prose",children:[w(ue,{}),w("h1",{className:"text-3xl font-bold text-black",children:o?.metadata?.title}),w("p",{className:"my-2 text-gray-500",children:o?.metadata?.description}),w(ke,{})]}),w("hr",{className:"border-gray-200"}),e,r?.feedback?.enabled&&w(we,{}),w(Ne,{}),w(De,{})]}),w(be,{})]})}import{CheckIcon as Dt,CopyIcon as Lt}from"lucide-react";import{useState as Ot}from"react";import{toast as Pt}from"react-toast-msg";import{jsx as T,jsxs as Le}from"react/jsx-runtime";function W(e){return typeof e=="string"?e:Array.isArray(e)?e.map(W).join(""):e?.props?.children?W(e.props.children):""}function $o(e){let{title:r,copy:o,children:t}=e;if(typeof t=="string")return T("code",{className:"not-prose px-1 py-0.5 rounded border border-gray-200 bg-gray-50 text-gray-800 text-sm",children:t});let[n,s]=Ot(!1),i=e["data-language"],m=()=>{if(!o)return;let d=W(t);navigator.clipboard.writeText(d),s(!0),Pt.success("Code copied to clipboard"),setTimeout(()=>s(!1),2e3)};return Le("div",{className:"max-w-2xl overflow-hidden rounded-lg text-sm text-gray-800 border border-gray-200 mt-4 bg-white",children:[Le("div",{className:"flex items-center justify-between bg-gray-50 border-b border-gray-200",children:[T("span",{className:c("text-xs text-gray-400 px-4 py-3",!o&&"py-4"),children:r||i}),o&&T("button",{onClick:m,className:"rounded-lg cursor-pointer p-2 m-2 text-gray-500 hover:bg-gray-200 transition",children:n?T(Dt,{className:"size-4 text-green-600"}):T(Lt,{className:"size-4"})})]}),T("div",{className:"p-4 scrollbar-x max-md:max-w-[calc(100vw-34px)] whitespace-pre overflow-x-auto text-sm leading-relaxed",children:t})]})}import{useMemo as zt,useState as Mt}from"react";import{ChevronRight as Rt,Folder as Tt,FolderOpen as Bt,FileText as Et}from"lucide-react";import{jsx as S,jsxs as Oe}from"react/jsx-runtime";function _o({data:e,fromText:r}){let o=zt(()=>e||(r?Gt(r):[]),[e,r]);return S("div",{className:"rounded-lg border border-zinc-200 bg-white p-3 text-sm min-w-80",children:o.map((t,a)=>S(Pe,{node:t},a))})}function Pe({node:e}){let[r,o]=Mt(!0),t=e.type==="folder";return Oe("div",{children:[Oe("div",{onClick:()=>t&&o(a=>!a),className:"flex items-center gap-2 py-1.5 px-2 rounded-md cursor-pointer hover:bg-gray-100",children:[t&&S(Rt,{className:`size-4 ${r&&"rotate-90"}`}),t?r?S(Bt,{className:"size-4 text-blue-500"}):S(Tt,{className:"size-4 text-blue-500"}):S(Et,{className:"size-4 text-gray-500"}),S("span",{children:e.name})]}),t&&r&&e.children&&S("div",{className:"ml-3 pl-3 border-l border-zinc-300",children:e.children.map((a,n)=>S(Pe,{node:a},n))})]})}function Gt(e){let r=e.split(`
2
- `).map(a=>a.replace(/\t/g," ")).filter(a=>a.trim().length>0),o=[],t=[];for(let a of r){let n=a.match(/^ */)?.[0].length||0,s=a.trim(),i=s.endsWith("/"),d={name:i?s.slice(0,-1):s,type:i?"folder":"file",children:i?[]:void 0};for(;t.length&&t[t.length-1].indent>=n;)t.pop();t.length===0?o.push(d):t[t.length-1].node.children?.push(d),i&&t.push({indent:n,node:d})}return o}export{zo as DocstraBody,$o as DocstraCodeBlock,_o as DocstraFileTree,se as DocstraHeader,Or as DocstraLayout,sr as DocstraProvider,u as useDocstra};
1
+ "use client";import{createContext as Ve,useContext as Ke,useState as H}from"react";import{ToastContainer as Ze}from"react-toast-msg";import{SearchIcon as Fe}from"lucide-react";import{twMerge as Be}from"tailwind-merge";import Te from"clsx";function c(...e){return Be(Te(e))}import{useEffect as A,useMemo as Ue,useState as ee}from"react";import Ae from"fuse.js";import He from"next/link";import{useRouter as _e}from"next/navigation";import{createContext as Ee,useContext as Ge,useState as U}from"react";import{jsx as $e}from"react/jsx-runtime";var J=Ee(null);function j({children:e,initialSidebarItems:t}){let[r,o]=U(t),[a,n]=U(!1),[s,i]=U(!1);return $e(J.Provider,{value:{openSidebar:a,setOpenSidebar:n,openSearchBox:s,setOpenSearchBox:i,sidebarItems:r,setSiderbarItems:o},children:e})}function k(){let e=Ge(J);if(!e)throw new Error("Please wrap your layout with SidebarProvider");return e}import{Fragment as qe,jsx as C,jsxs as $}from"react/jsx-runtime";function te(){let{openSearchBox:e,setOpenSearchBox:t}=k(),{page:r}=u(),[o,a]=ee(""),[n,s]=ee([]),i=_e();A(()=>{let l=b=>{b.ctrlKey&&b.key==="k"&&(b.preventDefault(),t(!0))};return window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[]);let d=Ue(()=>!r||r.length===0?null:new Ae(r,{keys:["data.metadata.title","data.metadata.description"],threshold:.3}),[r]);A(()=>{if(o&&d){let l=d.search(o);s(l.map(b=>b.item))}else o||s([])},[o,d]);let m=l=>{if(l.preventDefault(),o){let b=n[0];b&&(i.push(`/docs/${b.slug}`),a(""),t(!1))}};return A(()=>{let l=b=>{b.key==="Escape"&&(t(!1),a(""))};return e&&window.addEventListener("keydown",l),()=>{window.removeEventListener("keydown",l)}},[e]),C("div",{onClick:()=>{t(!1),a("")},className:c("fixed inset-0 z-25 flex items-start justify-center bg-white/40 backdrop-blur-md opacity-0 pointer-events-none transition-all duration-300",e&&"opacity-100 pointer-events-auto"),children:$("div",{onClick:l=>l.stopPropagation(),className:"flex flex-col items-center mt-30 max-w-lg w-full max-md:px-4",children:[C("form",{onSubmit:m,className:c("relative flex items-center justify-between w-full bg-white border border-slate-200 text-gray-400 h-15 p-0.5 rounded-lg",o&&"rounded-b-none border-b-0"),children:e&&$(qe,{children:[C(Fe,{className:"size-5.5 mx-3 shrink-0"}),C("input",{className:"w-full bg-transparent h-full outline-none text-gray-400 placeholder:text-gray-400",type:"text",placeholder:"Search docs...",spellCheck:"false",autoFocus:!0,value:o,onChange:l=>a(l.target.value),name:"searchQuery",required:!0}),C("span",{className:"border border-gray-200 px-2 mr-3 py-1 rounded text-xs",children:"Esc"})]})}),$("div",{className:c("max-h-70 overflow-x-hidden overflow-y-auto scrollbar-y w-full bg-white text-slate-700 flex flex-col",o&&"rounded-b-md border border-slate-200"),children:[n.map(l=>$(He,{href:`/docs/${l.slug==="index"?"":l.slug}`,onClick:()=>{t(!1),a("")},className:"w-full hover:bg-gray-100/70 border-b border-slate-200 transition-all py-4 px-4 last:mb-2",children:[C("h4",{className:"font-medium",children:l.data?.metadata?.title||l.slug}),C("p",{className:"text-sm mt-1 text-gray-500",children:l.data?.metadata?.description})]},l.slug)),o&&n.length===0&&C("div",{className:"text-gray-500 text-center py-20",children:"No results found"})]})]})})}import{jsx as oe,jsxs as Ye}from"react/jsx-runtime";var re=Ve(null);function no({children:e,docstraConfig:t,page:r}){let[o,a]=H(!1),[n,s]=H(!1),[i,d]=H("npm");return Ye(re.Provider,{value:{openSidebar:o,setOpenSidebar:a,docstraConfig:t,openSearchBox:n,setOpenSearchBox:s,packageManager:i,setPackageManager:d,page:r},children:[oe(Ze,{}),oe(te,{}),e]})}function u(){let e=Ke(re);if(!e)throw new Error("Please wrap your app with DocstraProvider");return e}import{TextAlignEnd as Qe,XIcon as We}from"lucide-react";import{useEffect as Xe}from"react";import _ from"next/link";import{jsx as N,jsxs as ae}from"react/jsx-runtime";function ne(){let{openSidebar:e,setOpenSidebar:t,openSearchBox:r,setOpenSearchBox:o}=k(),{docstraConfig:a}=u(),n="https://github.com/"+a?.editOnGithub?.owner+"/"+a?.editOnGithub?.repo;return Xe(()=>{e?document.body.classList.add("max-md:overflow-hidden"):document.body.classList.remove("max-md:overflow-hidden")},[e]),ae("header",{className:"fixed w-full top-0 z-10 text-sm flex items-center justify-between border-b border-gray-100 h-18 px-4 md:px-6 bg-white",children:[N(_,{href:a.navbar?.logo?.link||"/",className:"hover:opacity-80 transition",children:N("img",{src:a.navbar?.logo?.src||"/logo.png",alt:a.navbar?.logo?.alt||"Logo",className:c("h-9.5 w-auto",a.navbar?.logo?.className)})}),ae("div",{className:"hidden divide-x divide-gray-200 md:flex items-center",children:[a.navbar?.links?.map(s=>N(_,{href:s.href,className:"px-6 hover:text-gray-600",children:s.name},s.name)),N(_,{href:n||"https://github.com/sudhucodes/docstra",children:N("svg",{className:"size-6 mx-6",width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",children:N("path",{d:"M12 .3a12 12 0 0 0-3.8 23.38c.6.12.83-.26.83-.57L9 21.07c-3.34.72-4.04-1.61-4.04-1.61-.55-1.39-1.34-1.76-1.34-1.76-1.08-.74.09-.73.09-.73 1.2.09 1.83 1.24 1.83 1.24 1.08 1.83 2.81 1.3 3.5 1 .1-.78.42-1.31.76-1.61-2.67-.3-5.47-1.33-5.47-5.93 0-1.31.47-2.38 1.24-3.22-.14-.3-.54-1.52.1-3.18 0 0 1-.32 3.3 1.23a11.5 11.5 0 0 1 6 0c2.28-1.55 3.29-1.23 3.29-1.23.64 1.66.24 2.88.12 3.18a4.65 4.65 0 0 1 1.23 3.22c0 4.61-2.8 5.63-5.48 5.92.42.36.81 1.1.81 2.22l-.01 3.29c0 .31.2.69.82.57A12 12 0 0 0 12 .3"})})})]}),N("button",{onClick:()=>t(!e),className:"md:hidden transition text-gray-600 active:ring-2 ring-gray-200 p-1.5 rounded-md",children:e?N(We,{className:"size-6.5"}):N(Qe,{className:"size-6.5"})})]})}import{ChevronDownIcon as je,SearchIcon as et}from"lucide-react";import{usePathname as tt}from"next/navigation";import*as Je from"lucide-react";function q(e){if(e)return Je[e]}import se from"next/link";import{useState as ot}from"react";import{Fragment as nt,jsx as f,jsxs as I}from"react/jsx-runtime";function rt({item:e,pathname:t,className:r,openSidebar:o,setOpenSidebar:a}){let[n,s]=ot(e.defaultOpen??!0),i=e.collapsible??!0,d=q(e.icon);return I("div",{className:"space-y-0.5",children:[e.group_title&&f("p",{className:"inline-flex items-center gap-2 mb-2 mt-2 px-2",children:e.group_title}),I(se,{href:e.href,onClick:()=>{i&&t===e.href&&s(m=>!m)},className:c("w-full flex items-center justify-between gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",e.href===t&&"bg-gray-100 text-gray-800"),children:[I("span",{className:"flex items-center gap-2",children:[d&&f(d,{className:"size-4"}),e.nav_title?e.nav_title:e.title]}),i&&f("div",{className:"pl-3",children:f(je,{className:c("size-4 text-black/50 transition-transform duration-300",n&&"rotate-180")})})]}),(!i||n)&&f("ul",{className:"mb-4 space-y-0.5",children:e.children.map((m,l)=>f(ie,{className:c('relative pl-7 before:content-[""] before:absolute before:top-1/2 first:before:top-[calc(50%+1px)] last:before:top-[calc(50%-1px)] before:left-4 before:w-px before:h-full last:before:h-[calc(100%+1px)] first:before:h-[calc(100%+1px)] before:bg-gray-200 before:-translate-y-1/2',m.type==="page"&&m.href===t&&'after:content-[""] after:absolute after:top-1/2 after:left-4 after:w-px after:h-6 after:bg-gray-600 after:-translate-y-1/2'),item:m,pathname:t,openSidebar:o,setOpenSidebar:a},`${m.type}-${l}`))})]})}function at({item:e,pathname:t,openSidebar:r,className:o,setOpenSidebar:a}){let n=q(e.icon);return I(se,{href:e.href,onClick:()=>r&&a(!1),className:c("flex items-center gap-2 text-gray-500 hover:bg-gray-100 py-2 px-2.5 rounded-lg",t===e.href&&"bg-gray-100 text-gray-800",o),children:[n&&f(n,{className:"size-4"}),f("span",{children:e.nav_title?e.nav_title:e.title})]})}function ie({item:e,pathname:t,openSidebar:r,className:o,setOpenSidebar:a}){switch(e.type){case"page":return f(at,{item:e,pathname:t,openSidebar:r,className:o,setOpenSidebar:a});case"section":return f(rt,{item:e,pathname:t,className:o,openSidebar:r,setOpenSidebar:a});default:return null}}function le(){let{openSidebar:e,setOpenSidebar:t,sidebarItems:r,setOpenSearchBox:o}=k(),a=tt();return I(nt,{children:[f("div",{className:c("fixed inset-0 z-20 bg-black/50 md:hidden opacity-0 pointer-events-none transition-all duration-300",e&&"opacity-100 pointer-events-auto"),onClick:()=>t(!1)}),I("aside",{className:c("fixed md:top-18 h-[calc(100svh-72px)] space-y-0.5 scrollbar-y w-screen max-md:rounded-t-lg z-21 md:w-72 pb-10 text-base md:text-sm shrink-0 border-r border-gray-200 p-4 max-md:fixed bg-white overflow-y-auto transition-all duration-300",e?"top-32":"top-full"),children:[I("div",{className:"flex items-center select-none gap-2 cursor-pointer mt-6 mb-4 p-2.5 text-gray-500 border border-gray-200 rounded-lg hover:bg-gray-50",onClick:()=>{t(e&&!1),o(!0)},children:[f(et,{className:"size-4.5"}),f("p",{children:"Search"}),I("div",{className:"ms-auto font-mono inline-flex gap-0.5",children:[f("span",{className:"rounded-md border border-gray-200 px-1.5",children:"Ctrl"}),f("span",{className:"rounded-md border border-gray-200 px-1.5",children:"K"})]})]}),r.map((n,s)=>f(ie,{item:n,pathname:a,openSidebar:e,setOpenSidebar:t},`${n.type}-${s}`))]})]})}import{jsx as ce,jsxs as st}from"react/jsx-runtime";function Mo({children:e,tree:t}){return ce(j,{initialSidebarItems:t,children:st("div",{className:"min-h-screen flex bg-white w-full",children:[ce(le,{}),e]})})}import{usePathname as it}from"next/navigation";import{ChevronRight as lt}from"lucide-react";import de from"next/link";import{jsx as M,jsxs as me}from"react/jsx-runtime";function pe(){let t=it().split("/").filter(Boolean),r=t.map((o,a)=>{let n="/"+t.slice(0,a+1).join("/"),s=o.replace(/-/g," ").replace(/\b\w/g,i=>i.toUpperCase());return{href:n,title:s}});return M("nav",{"aria-label":"Breadcrumb",className:"flex text-sm items-center pb-4 text-gray-500 not-prose",children:me("ol",{className:"flex items-center space-x-2",children:[M("li",{children:M(de,{href:"/",className:"hover:text-gray-700 transition-colors font-medium",children:"Home"})}),r.map((o,a)=>{let n=a===r.length-1;return me("li",{className:"flex items-center space-x-2",children:[M(lt,{className:"w-4 h-4 text-gray-400"}),n?M("span",{className:"text-gray-600 font-medium",children:o.title}):M(de,{href:o.href,className:"hover:text-gray-700 font-medium transition-colors",children:o.title})]},o.href)})]})})}import{ArrowUpCircleIcon as ct,SquareArrowOutUpRightIcon as dt,TextAlignStartIcon as mt}from"lucide-react";import{usePathname as pt}from"next/navigation";import{useEffect as T,useRef as ue,useState as F}from"react";import{jsx as D,jsxs as E}from"react/jsx-runtime";function ge(){let[e,t]=F(null),[r,o]=F("down"),[a,n]=F(!1),[s,i]=F(!1),{docstraConfig:d,page:m}=u(),l=m?.path,b=m?.tableOfContents||[],W=ue(0),ze=ue(null),Pe=pt(),Me=`${"https://github.com/"+d?.editOnGithub?.owner+"/"+d?.editOnGithub?.repo}/edit/main/${d?.editOnGithub?.path}/${l}`;T(()=>{let p=()=>{let h=window.scrollY;o(h>W.current?"down":"up"),n(h>100),W.current=h};return window.addEventListener("scroll",p),()=>window.removeEventListener("scroll",p)},[]),T(()=>{let p=document.querySelectorAll("h2[id], h3[id]"),h=new IntersectionObserver(z=>{if(s)return;let L=z.filter(P=>P.isIntersecting).sort((P,Re)=>P.boundingClientRect.top-Re.boundingClientRect.top);if(L.length>0){let P=r==="down"?L[0].target.id:L[L.length-1].target.id;t(P)}},{rootMargin:"-40% 0px -50% 0px",threshold:[0,.2,.6,1]});return p.forEach(z=>h.observe(z)),ze.current=h,()=>h.disconnect()},[Pe,r,s]),T(()=>{!(window.scrollY>100)&&t(b[0]?.id)},[b]),T(()=>{if(!e)return;let p=document.querySelector(".toc-scroll-container");if(!p)return;let h=p.querySelector(`a[href="#${e}"]`);if(!h)return;let z=p.getBoundingClientRect(),L=h.getBoundingClientRect();(L.top<z.top||L.bottom>z.bottom)&&h.scrollIntoView({behavior:"smooth",block:"nearest"})},[e]),T(()=>{if(!s)return;let p=setTimeout(()=>i(!1),800);return()=>clearTimeout(p)},[s]);let X=p=>{t(p),i(!0)};return E("aside",{className:"sticky top-18 text-sm hidden xl:block text-gray-500 shrink-0 h-[calc(100svh-72px)] w-64 border-l border-gray-200 p-6 overflow-y-auto",children:[E("p",{className:"flex items-center gap-2 mb-5",children:[D(mt,{className:"size-4"}),"On this page"]}),D("ul",{className:"toc-scroll-container max-h-3/4 overflow-y-auto scrollbar-none",children:b.map(p=>E("li",{children:[D(fe,{heading:p,activeId:e,handleClick:X}),p.children.map(h=>D(fe,{heading:h,activeId:e,handleClick:X,className:"pl-8"},h.id))]},p.id))}),D("hr",{className:"my-6 border-gray-200"}),d.editOnGithub&&E("a",{href:Me,rel:"noopener noreferrer",className:"flex items-center gap-2 text-zinc-500 hover:text-gray-700 transition",children:["Edit this page on GitHub",D(dt,{className:"size-4"})]}),a&&E("button",{onClick:()=>scrollTo({top:0,behavior:"smooth"}),className:"flex items-center cursor-pointer gap-2 mt-3 text-zinc-500 hover:text-gray-700 transition",children:["Scroll to top",D(ct,{className:"size-4"})]})]})}function fe({heading:e,activeId:t,handleClick:r,className:o}){return D("a",{href:`#${e.id}`,className:c("border-l border-gray-200 block py-1.5 pl-4 transition-colors",o,{"border-gray-800 text-gray-900 font-medium":t===e.id,"hover:text-gray-800 hover:border-gray-400":t!==e.id}),onClick:()=>r(e.id),children:e.text})}import{useState as Y}from"react";import{ThumbsUp as ft,ThumbsDown as gt}from"lucide-react";import{jsx as V,jsxs as be}from"react/jsx-runtime";function K({label:e,type:t,placeholder:r="",id:o,required:a=!1,onChange:n,value:s,readOnly:i=!1,className:d="",optional:m=!1}){return be("div",{className:c("flex flex-col mt-4 w-full",d),children:[e&&be("label",{htmlFor:o,className:"font-medium w-max cursor-pointer",children:[e,m&&V("span",{className:"text-xs font-normal text-gray-400 ml-1 mt-1",children:"(Optional)"})]}),t==="textarea"?V("textarea",{id:o,name:o,className:c("mt-2 w-full p-3 border border-gray-300 resize-none not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",d),placeholder:r,required:a,onChange:n,rows:4,value:s,readOnly:i,maxLength:500}):V("input",{type:t,id:o,name:o,className:"mt-2 w-full h-12 px-3 border border-gray-300 not-focus:hover:border-gray-500 read-only:text-gray-400/80 outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2 transition-all duration-200 rounded-lg",placeholder:r,required:a,onChange:n,value:s,readOnly:i,maxLength:500})]})}import{Loader2Icon as ut}from"lucide-react";import{jsx as he}from"react/jsx-runtime";function Z({label:e,loading:t,type:r="submit",className:o="",disabled:a=!1,onClick:n}){return he("button",{type:r,disabled:a,className:c("relative w-full mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg",o),"aria-label":e,onClick:n,children:t?he(ut,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 animate-spin mx-auto"}):e})}import{useFormSync as bt}from"formsync";import{toast as xe}from"react-toast-msg";import{Fragment as ye,jsx as x,jsxs as O}from"react/jsx-runtime";function ve(){let[e,t]=Y(null),{docstraConfig:r}=u(),[o,a]=Y(""),[n,s]=Y(!1),i=r?.editOnGithub?.owner+"/"+r?.editOnGithub?.repo,{isLoading:d,submit:m}=bt({formId:r?.feedback?.formSyncFormID||"",onSuccess:()=>{xe.success("Feedback submitted successfully"),s(!0),t(null),a("")},onError:l=>{console.log(l),xe.error(l.message,{duration:5e3})}});return x("div",{className:"border-y border-gray-200 mt-10 py-10 space-y-4",children:n?O(ye,{children:[x("p",{className:"font-medium text-gray-900",children:"We appreciate your feedback, Thank you!"}),x(Z,{onClick:()=>{s(!1),t(null),a("")},label:"Submit Again",className:"w-max text-sm"})]}):O(ye,{children:[x("p",{className:"font-medium",children:"How is this guide?"}),O("div",{className:"flex gap-2",children:[O("button",{onClick:()=>t("good"),className:c("flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm",e==="good"?"bg-green-100 text-green-600 border-green-300":"border-gray-200 text-gray-600 hover:bg-gray-100"),children:[x(ft,{className:`size-4 ${e==="good"?"fill-green-600":"text-gray-500"}`}),"Good"]}),O("button",{onClick:()=>t("bad"),className:c("flex items-center cursor-pointer gap-1 px-3 py-2 rounded-full border text-sm",e==="bad"?"bg-red-100 text-red-600 border-red-300":"border-gray-200 text-gray-600 hover:bg-gray-100"),children:[x(gt,{className:c("size-4 pt-0.5",e==="bad"?"fill-red-600":"text-gray-500")}),"Bad"]})]}),e&&O("form",{className:"flex flex-col gap-2",onSubmit:m,children:[x(K,{value:o,id:"message",onChange:l=>a(l.target.value),placeholder:"Leave your feedback...",required:!0,type:"textarea"}),x("input",{type:"hidden",name:"opinion",value:e}),x("input",{type:"hidden",name:"page",value:window.location.href}),x("input",{type:"hidden",name:"_redirect",value:window.location.href}),x("input",{type:"hidden",name:"_source",value:"sdk"}),x("input",{type:"hidden",name:"_fs_hp",tabIndex:-1,autoComplete:"off"}),x("button",{type:"submit",disabled:d,className:"relative mt-4 h-12 px-6 py-3 cursor-pointer font-medium bg-gray-900 hover:opacity-85 text-white rounded-lg w-max text-sm",children:d?"Submitting...":"Submit"}),r?.feedback?.watermark!==!1&&O("p",{className:"text-left text-sm text-gray-500 mt-6",children:["Powered by"," ",x("a",{href:`https://www.formsync.app?utm_source=${i}`,className:"text-gray-800 not-prose",children:"FormSync"})]})]})]})})}import{jsxs as ht}from"react/jsx-runtime";function we(){let{page:e}=u();if(!e?.lastUpdated)return null;let t=new Date(e.lastUpdated).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"UTC"});return ht("p",{className:"text-sm text-gray-500",children:["Last updated on ",t]})}import*as v from"@radix-ui/react-dropdown-menu";import{CheckIcon as xt,CopyIcon as yt,ChevronDownIcon as vt}from"lucide-react";import{useEffect as wt,useState as Ne}from"react";import{jsx as g,jsxs as y}from"react/jsx-runtime";function Se(){let{page:e,docstraConfig:t}=u(),[r,o]=Ne(!1),[a,n]=Ne(null),i=`${"https://github.com/"+t?.editOnGithub?.owner+"/"+t?.editOnGithub?.repo}/blob/main/${t?.editOnGithub?.path}/${e?.path}`;wt(()=>{n(window.location.href)},[]);let d=()=>{navigator.clipboard.writeText(e?.raw||""),o(!0),setTimeout(()=>o(!1),3e3)},m=`Read from this URL: ${a} and explain it to me.`;return y("div",{className:"flex items-center gap-3 mt-6 not-prose",children:[y("button",{title:"Copy Markdown",onClick:d,className:"flex items-center cursor-pointer gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs",children:[r?g(xt,{className:"size-3.5"}):g(yt,{className:"size-3.5"}),"Copy Markdown"]}),y(v.Root,{children:[g(v.Trigger,{asChild:!0,children:y("button",{className:"flex items-center gap-2 bg-gray-50 hover:bg-gray-100 border border-gray-200 px-3 py-2 rounded-md text-xs outline-none focus:outline-none focus:ring-0",children:["Open",g(vt,{className:"size-3.5"})]})}),y(v.Content,{className:"bg-white border border-gray-200 rounded-md shadow-md p-1 mt-2 text-sm",align:"end",children:[g(v.Item,{asChild:!0,children:y("a",{href:i,target:"_blank",className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[y("svg",{className:"size-4.5",fill:"currentColor",viewBox:"0 0 24 24",children:[g("title",{children:"GitHub"}),g("path",{d:"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"})]}),"Open in GitHub"]})}),g(v.Item,{asChild:!0,children:y("a",{href:`https://chatgpt.com/?q=${encodeURIComponent(m)}`,target:"_blank",className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[y("svg",{className:"size-4.5",viewBox:"0 0 24 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",children:[g("title",{children:"OpenAI"}),g("path",{d:"M22.282 9.821a6 6 0 0 0-.516-4.91 6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9 6.05 6.05 0 0 0 .743 7.097 5.98 5.98 0 0 0 .51 4.911 6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206 6 6 0 0 0 3.997-2.9 6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081 4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085 4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023-.141-.085-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365 2.602-1.5 2.607 1.5v2.999l-2.597 1.5-2.607-1.5Z"})]}),"Open in ChatGPT"]})}),g(v.Item,{asChild:!0,children:y("a",{href:`https://claude.ai/new?q=${encodeURIComponent(m)}`,target:"_blank",className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[y("svg",{className:"size-4.5",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[g("title",{children:"Anthropic"}),g("path",{d:"M17.304 3.541h-3.672l6.696 16.918H24Zm-10.608 0L0 20.459h3.744l1.37-3.553h7.005l1.369 3.553h3.744L10.536 3.541Zm-.371 10.223L8.616 7.82l2.291 5.945Z"})]}),"Open in Claude"]})}),g(v.Item,{asChild:!0,children:y("a",{href:`https://cursor.com/link/prompt?text=${encodeURIComponent(m)}`,className:"flex items-center gap-2 px-3 py-2 rounded hover:bg-gray-100 outline-none focus:outline-none focus:ring-0",children:[y("svg",{className:"size-4.5",fill:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:[g("title",{children:"Cursor"}),g("path",{d:"M11.503.131 1.891 5.678a.84.84 0 0 0-.42.726v11.188c0 .3.162.575.42.724l9.609 5.55a1 1 0 0 0 .998 0l9.61-5.55a.84.84 0 0 0 .42-.724V6.404a.84.84 0 0 0-.42-.726L12.497.131a1.01 1.01 0 0 0-.996 0M2.657 6.338h18.55c.263 0 .43.287.297.515L12.23 22.918c-.062.107-.229.064-.229-.06V12.335a.59.59 0 0 0-.295-.51l-9.11-5.257c-.109-.063-.064-.23.061-.23"})]}),"Open in Cursor"]})})]})]})]})}import{usePathname as Nt}from"next/navigation";import ke from"next/link";import{ArrowLeftIcon as St,ArrowRightIcon as kt}from"lucide-react";import{jsx as R,jsxs as G}from"react/jsx-runtime";function Ce(e){let t=[];for(let r of e)r.type==="page"?t.push({name:r.title,href:r.href,icon:r.icon}):r.type==="section"&&t.push(...Ce(r.children));return t}function Ie(){let e=Nt(),{docstraConfig:t}=u(),{sidebarItems:r}=k(),o=[];r&&r.length>0?o=Ce(r):t?.sidebar?.links&&(o=t.sidebar.links.flatMap(i=>i.items));let a=o.findIndex(i=>i.href===e),n=a>0?o[a-1]:null,s=a<o.length-1?o[a+1]:null;return G("div",{className:"flex flex-col lg:flex-row gap-2 justify-between py-10 mt-10",children:[n?G(ke,{href:n.href,className:"flex flex-col not-prose items-start gap-2 border border-gray-200 hover:bg-gray-50 py-3 md:min-w-62 pl-4 pr-10 rounded-lg text-sm",children:[R("span",{className:"text-gray-500",children:"Previous"}),G("p",{className:"flex items-center font-medium",children:[R(St,{className:"size-5 mr-2"}),n.name]})]}):R("div",{}),s?G(ke,{href:s.href,className:"flex flex-col not-prose items-end gap-2 border border-gray-200 hover:bg-gray-50 py-3 pr-4 md:min-w-62 pl-10 rounded-lg text-sm",children:[R("span",{className:"text-gray-500",children:"Next"}),G("p",{className:"flex items-center font-medium",children:[s.name,R(kt,{className:"size-5 ml-2"})]})]}):R("div",{})]})}import{Fragment as Ct,jsx as w,jsxs as Q}from"react/jsx-runtime";function Tr({children:e}){let{docstraConfig:t,page:r}=u();return Q(Ct,{children:[w(ne,{}),Q("main",{className:"flex-1 px-4 md:px-8 md:pl-80 pt-28 py-10 prose prose-headings:scroll-mt-28 max-w-none",children:[Q("div",{className:"not-prose",children:[w(pe,{}),w("h1",{className:"text-3xl font-bold text-black",children:r?.metadata?.title}),w("p",{className:"my-2 text-gray-500",children:r?.metadata?.description}),w(Se,{})]}),w("hr",{className:"border-gray-200"}),e,t?.feedback?.enabled&&w(ve,{}),w(we,{}),w(Ie,{})]}),w(ge,{})]})}import{CheckIcon as It,CopyIcon as Dt}from"lucide-react";import{useState as Lt}from"react";import{toast as Ot}from"react-toast-msg";import{jsx as B,jsxs as De}from"react/jsx-runtime";function Hr(e){let{title:t,copy:r,children:o}=e;if(typeof o=="string")return B("code",{className:"not-prose px-1 py-0.5 rounded border border-gray-200 bg-gray-50 text-gray-800 text-sm",children:o});let[n,s]=Lt(!1),i=e["data-language"],d=()=>{r&&(navigator.clipboard.writeText(e.raw),s(!0),Ot.success("Code copied to clipboard"),setTimeout(()=>s(!1),2e3))};return De("div",{className:"max-w-2xl overflow-hidden rounded-lg text-sm text-gray-800 border border-gray-200 mt-4 bg-white",children:[De("div",{className:"flex items-center justify-between bg-gray-50 border-b border-gray-200",children:[B("span",{className:c("text-xs text-gray-400 px-4 py-3",!r&&"py-4"),children:t||i}),r&&B("button",{onClick:d,className:"rounded-lg cursor-pointer p-2 m-2 text-gray-500 hover:bg-gray-200 transition",children:n?B(It,{className:"size-4 text-green-600"}):B(Dt,{className:"size-4"})})]}),B("div",{className:"p-4 scrollbar-x max-md:max-w-[calc(100vw-34px)] whitespace-pre overflow-x-auto text-sm leading-relaxed",children:o})]})}import{useMemo as zt,useState as Pt}from"react";import{ChevronRight as Mt,Folder as Rt,FolderOpen as Bt,FileText as Tt}from"lucide-react";import{jsx as S,jsxs as Le}from"react/jsx-runtime";function Zr({data:e,fromText:t}){let r=zt(()=>e||(t?Et(t):[]),[e,t]);return S("div",{className:"rounded-lg border border-zinc-200 bg-white p-3 text-sm min-w-80",children:r.map((o,a)=>S(Oe,{node:o},a))})}function Oe({node:e}){let[t,r]=Pt(!0),o=e.type==="folder";return Le("div",{children:[Le("div",{onClick:()=>o&&r(a=>!a),className:"flex items-center gap-2 py-1.5 px-2 rounded-md cursor-pointer hover:bg-gray-100",children:[o&&S(Mt,{className:`size-4 ${t&&"rotate-90"}`}),o?t?S(Bt,{className:"size-4 text-blue-500"}):S(Rt,{className:"size-4 text-blue-500"}):S(Tt,{className:"size-4 text-gray-500"}),S("span",{children:e.name})]}),o&&t&&e.children&&S("div",{className:"ml-3 pl-3 border-l border-zinc-300",children:e.children.map((a,n)=>S(Oe,{node:a},n))})]})}function Et(e){let t=e.split(`
2
+ `).map(a=>a.replace(/\t/g," ")).filter(a=>a.trim().length>0),r=[],o=[];for(let a of t){let n=a.match(/^ */)?.[0].length||0,s=a.trim(),i=s.endsWith("/"),m={name:i?s.slice(0,-1):s,type:i?"folder":"file",children:i?[]:void 0};for(;o.length&&o[o.length-1].indent>=n;)o.pop();o.length===0?r.push(m):o[o.length-1].node.children?.push(m),i&&o.push({indent:n,node:m})}return r}export{Tr as DocstraBody,Hr as DocstraCodeBlock,Zr as DocstraFileTree,ne as DocstraHeader,Mo as DocstraLayout,no as DocstraProvider,j as SidebarProvider,u as useDocstra,k as useSidebar};
@@ -1,11 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { C as CalloutProps } from '../types-DVK5_X07.mjs';
2
3
  export * from 'docstra-mdx';
4
+ import 'docstra-types';
3
5
 
4
- type CalloutType = 'info' | 'warning' | 'error';
5
- interface CalloutProps {
6
- type?: CalloutType;
7
- children: React.ReactNode;
8
- }
9
6
  declare function Callout({ type, children }: CalloutProps): react_jsx_runtime.JSX.Element;
10
7
 
11
8
  declare const defaultMdxComponents: {
@@ -1,11 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { C as CalloutProps } from '../types-DVK5_X07.js';
2
3
  export * from 'docstra-mdx';
4
+ import 'docstra-types';
3
5
 
4
- type CalloutType = 'info' | 'warning' | 'error';
5
- interface CalloutProps {
6
- type?: CalloutType;
7
- children: React.ReactNode;
8
- }
9
6
  declare function Callout({ type, children }: CalloutProps): react_jsx_runtime.JSX.Element;
10
7
 
11
8
  declare const defaultMdxComponents: {
package/dist/mdx/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";var b=Object.create;var y=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var N=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var k=(e,n)=>{for(var t in n)y(e,t,{get:n[t],enumerable:!0})},h=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of N(n))!C.call(e,l)&&l!==t&&y(e,l,{get:()=>n[l],enumerable:!(s=x(n,l))||s.enumerable});return e},f=(e,n,t)=>(h(e,n,"default"),t&&h(t,n,"default")),w=(e,n,t)=>(t=e!=null?b(v(e)):{},h(n||!e||!e.__esModule?y(t,"default",{value:e,enumerable:!0}):t,e)),I=e=>h(y({},"__esModule",{value:!0}),e);var d={};k(d,{defaultMdxComponents:()=>T});module.exports=I(d);var o=require("lucide-react"),i=require("react/jsx-runtime");function u({type:e="info",children:n}){let t={info:"border-blue-500 bg-blue-50 text-blue-500",warning:"border-yellow-500 bg-yellow-50 text-yellow-500",error:"border-red-500 bg-red-50 text-red-500"},l={info:o.InfoIcon,warning:o.AlertTriangleIcon,error:o.AlertCircleIcon}[e];return(0,i.jsxs)("div",{className:`flex not-prose items-center gap-2 border-l-4 ${t[e]} px-4 py-2.5`,children:[(0,i.jsx)(l,{className:"w-5 h-5 shrink-0"}),(0,i.jsx)("div",{children:n})]})}var m=w(require("next/link"));var g=require("lucide-react");function p(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}var c=require("react/jsx-runtime");function a({children:e,level:n}){let t=`h${n}`,l=p(typeof e=="string"?e:"");return(0,c.jsxs)(t,{id:l,className:"group",children:[(0,c.jsx)("a",{className:"not-prose",href:`#${l}`,children:e}),(0,c.jsx)(g.LinkIcon,{className:"inline-block ml-2 size-5 text-gray-400 opacity-0 group-hover:opacity-100 transition"})]})}var r=require("react/jsx-runtime"),T={h1:e=>(0,r.jsx)("h1",{className:"text-3xl font-bold text-gray-900",children:e.children}),h2:e=>(0,r.jsx)(a,{...e,level:2}),h3:e=>(0,r.jsx)(a,{...e,level:3}),h4:e=>(0,r.jsx)(a,{...e,level:4}),h5:e=>(0,r.jsx)(a,{...e,level:5}),p:e=>(0,r.jsx)("p",{children:e.children}),hr:e=>(0,r.jsx)("hr",{...e,className:"border-gray-200"}),a:e=>e.href.startsWith("http")?(0,r.jsx)("a",{href:e.href,className:"underline underline-offset-4",...e,target:"_blank",rel:"noopener noreferrer",children:e.children}):(0,r.jsx)(m.default,{href:e.href,className:"underline underline-offset-4",...e,children:e.children}),ul:e=>(0,r.jsx)("ul",{children:e.children}),li:e=>(0,r.jsx)("li",{children:e.children}),ol:e=>(0,r.jsx)("ol",{children:e.children}),blockquote:e=>(0,r.jsx)("blockquote",{className:"not-italic",children:e.children}),pre:e=>(0,r.jsx)("pre",{className:"not-prose",children:e.children}),Callout:u,table:e=>(0,r.jsx)("table",{children:e.children}),thead:e=>(0,r.jsx)("thead",{children:e.children}),tbody:e=>(0,r.jsx)("tbody",{children:e.children}),tr:e=>(0,r.jsx)("tr",{children:e.children}),th:e=>(0,r.jsx)("th",{children:e.children}),td:e=>(0,r.jsx)("td",{children:e.children})};f(d,require("docstra-mdx"),module.exports);0&&(module.exports={defaultMdxComponents,...require("docstra-mdx")});
1
+ "use strict";var b=Object.create;var y=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,C=Object.prototype.hasOwnProperty;var k=(e,n)=>{for(var t in n)y(e,t,{get:n[t],enumerable:!0})},h=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of v(n))!C.call(e,l)&&l!==t&&y(e,l,{get:()=>n[l],enumerable:!(s=x(n,l))||s.enumerable});return e},f=(e,n,t)=>(h(e,n,"default"),t&&h(t,n,"default")),w=(e,n,t)=>(t=e!=null?b(N(e)):{},h(n||!e||!e.__esModule?y(t,"default",{value:e,enumerable:!0}):t,e)),I=e=>h(y({},"__esModule",{value:!0}),e);var d={};k(d,{defaultMdxComponents:()=>T});module.exports=I(d);var o=require("lucide-react"),i=require("react/jsx-runtime");function u({type:e="info",children:n}){let t={info:"border-blue-500 bg-blue-50 text-blue-500",warning:"border-yellow-500 bg-yellow-50 text-yellow-500",error:"border-red-500 bg-red-50 text-red-500"},l={info:o.InfoIcon,warning:o.AlertTriangleIcon,error:o.AlertCircleIcon}[e];return(0,i.jsxs)("div",{className:`flex not-prose items-center gap-2 border-l-4 ${t[e]} px-4 py-2.5`,children:[(0,i.jsx)(l,{className:"w-5 h-5 shrink-0"}),(0,i.jsx)("div",{children:n})]})}var m=w(require("next/link"));var g=require("lucide-react");function p(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}var c=require("react/jsx-runtime");function a({children:e,level:n}){let t=`h${n}`,l=p(typeof e=="string"?e:"");return(0,c.jsxs)(t,{id:l,className:"group",children:[(0,c.jsx)("a",{className:"not-prose",href:`#${l}`,children:e}),(0,c.jsx)(g.LinkIcon,{className:"inline-block ml-2 size-5 text-gray-400 opacity-0 group-hover:opacity-100 transition"})]})}var r=require("react/jsx-runtime"),T={h1:e=>(0,r.jsx)("h1",{className:"text-3xl font-bold text-gray-900",children:e.children}),h2:e=>(0,r.jsx)(a,{...e,level:2}),h3:e=>(0,r.jsx)(a,{...e,level:3}),h4:e=>(0,r.jsx)(a,{...e,level:4}),h5:e=>(0,r.jsx)(a,{...e,level:5}),p:e=>(0,r.jsx)("p",{children:e.children}),hr:e=>(0,r.jsx)("hr",{...e,className:"border-gray-200"}),a:e=>e.href.startsWith("http")?(0,r.jsx)("a",{href:e.href,className:"underline underline-offset-4",...e,target:"_blank",rel:"noopener noreferrer",children:e.children}):(0,r.jsx)(m.default,{href:e.href,className:"underline underline-offset-4",...e,children:e.children}),ul:e=>(0,r.jsx)("ul",{children:e.children}),li:e=>(0,r.jsx)("li",{children:e.children}),ol:e=>(0,r.jsx)("ol",{children:e.children}),blockquote:e=>(0,r.jsx)("blockquote",{className:"not-italic",children:e.children}),pre:e=>(0,r.jsx)("pre",{className:"not-prose",children:e.children}),Callout:u,table:e=>(0,r.jsx)("table",{children:e.children}),thead:e=>(0,r.jsx)("thead",{children:e.children}),tbody:e=>(0,r.jsx)("tbody",{children:e.children}),tr:e=>(0,r.jsx)("tr",{children:e.children}),th:e=>(0,r.jsx)("th",{children:e.children}),td:e=>(0,r.jsx)("td",{children:e.children})};f(d,require("docstra-mdx"),module.exports);0&&(module.exports={defaultMdxComponents,...require("docstra-mdx")});
@@ -1 +1 @@
1
- import{AlertTriangleIcon as h,InfoIcon as y,AlertCircleIcon as f}from"lucide-react";import{jsx as i,jsxs as u}from"react/jsx-runtime";function a({type:e="info",children:l}){let o={info:"border-blue-500 bg-blue-50 text-blue-500",warning:"border-yellow-500 bg-yellow-50 text-yellow-500",error:"border-red-500 bg-red-50 text-red-500"},t={info:y,warning:h,error:f}[e];return u("div",{className:`flex not-prose items-center gap-2 border-l-4 ${o[e]} px-4 py-2.5`,children:[i(t,{className:"w-5 h-5 shrink-0"}),i("div",{children:l})]})}import m from"next/link";import{LinkIcon as p}from"lucide-react";function c(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}import{jsx as d,jsxs as g}from"react/jsx-runtime";function n({children:e,level:l}){let o=`h${l}`,t=c(typeof e=="string"?e:"");return g(o,{id:t,className:"group",children:[d("a",{className:"not-prose",href:`#${t}`,children:e}),d(p,{className:"inline-block ml-2 size-5 text-gray-400 opacity-0 group-hover:opacity-100 transition"})]})}import{jsx as r}from"react/jsx-runtime";var L={h1:e=>r("h1",{className:"text-3xl font-bold text-gray-900",children:e.children}),h2:e=>r(n,{...e,level:2}),h3:e=>r(n,{...e,level:3}),h4:e=>r(n,{...e,level:4}),h5:e=>r(n,{...e,level:5}),p:e=>r("p",{children:e.children}),hr:e=>r("hr",{...e,className:"border-gray-200"}),a:e=>e.href.startsWith("http")?r("a",{href:e.href,className:"underline underline-offset-4",...e,target:"_blank",rel:"noopener noreferrer",children:e.children}):r(m,{href:e.href,className:"underline underline-offset-4",...e,children:e.children}),ul:e=>r("ul",{children:e.children}),li:e=>r("li",{children:e.children}),ol:e=>r("ol",{children:e.children}),blockquote:e=>r("blockquote",{className:"not-italic",children:e.children}),pre:e=>r("pre",{className:"not-prose",children:e.children}),Callout:a,table:e=>r("table",{children:e.children}),thead:e=>r("thead",{children:e.children}),tbody:e=>r("tbody",{children:e.children}),tr:e=>r("tr",{children:e.children}),th:e=>r("th",{children:e.children}),td:e=>r("td",{children:e.children})};export*from"docstra-mdx";export{L as defaultMdxComponents};
1
+ import{AlertTriangleIcon as h,InfoIcon as y,AlertCircleIcon as f}from"lucide-react";import{jsx as i,jsxs as u}from"react/jsx-runtime";function a({type:e="info",children:l}){let o={info:"border-blue-500 bg-blue-50 text-blue-500",warning:"border-yellow-500 bg-yellow-50 text-yellow-500",error:"border-red-500 bg-red-50 text-red-500"},t={info:y,warning:h,error:f}[e];return u("div",{className:`flex not-prose items-center gap-2 border-l-4 ${o[e]} px-4 py-2.5`,children:[i(t,{className:"w-5 h-5 shrink-0"}),i("div",{children:l})]})}import m from"next/link";import{LinkIcon as p}from"lucide-react";function c(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}import{jsx as d,jsxs as g}from"react/jsx-runtime";function n({children:e,level:l}){let o=`h${l}`,t=c(typeof e=="string"?e:"");return g(o,{id:t,className:"group",children:[d("a",{className:"not-prose",href:`#${t}`,children:e}),d(p,{className:"inline-block ml-2 size-5 text-gray-400 opacity-0 group-hover:opacity-100 transition"})]})}import{jsx as r}from"react/jsx-runtime";var $={h1:e=>r("h1",{className:"text-3xl font-bold text-gray-900",children:e.children}),h2:e=>r(n,{...e,level:2}),h3:e=>r(n,{...e,level:3}),h4:e=>r(n,{...e,level:4}),h5:e=>r(n,{...e,level:5}),p:e=>r("p",{children:e.children}),hr:e=>r("hr",{...e,className:"border-gray-200"}),a:e=>e.href.startsWith("http")?r("a",{href:e.href,className:"underline underline-offset-4",...e,target:"_blank",rel:"noopener noreferrer",children:e.children}):r(m,{href:e.href,className:"underline underline-offset-4",...e,children:e.children}),ul:e=>r("ul",{children:e.children}),li:e=>r("li",{children:e.children}),ol:e=>r("ol",{children:e.children}),blockquote:e=>r("blockquote",{className:"not-italic",children:e.children}),pre:e=>r("pre",{className:"not-prose",children:e.children}),Callout:a,table:e=>r("table",{children:e.children}),thead:e=>r("thead",{children:e.children}),tbody:e=>r("tbody",{children:e.children}),tr:e=>r("tr",{children:e.children}),th:e=>r("th",{children:e.children}),td:e=>r("td",{children:e.children})};export*from"docstra-mdx";export{$ as defaultMdxComponents};
@@ -0,0 +1,25 @@
1
+ import { DocstraConfig, SidebarItem } from 'docstra-types';
2
+
3
+ interface DocstraContextType {
4
+ openSidebar: boolean;
5
+ setOpenSidebar: (open: boolean) => void;
6
+ docstraConfig: DocstraConfig;
7
+ openSearchBox: boolean;
8
+ setOpenSearchBox: (open: boolean) => void;
9
+ packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun';
10
+ setPackageManager: (packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun') => void;
11
+ sidebarItems?: SidebarItem[];
12
+ page: any;
13
+ }
14
+ interface IDocstraProvider {
15
+ children: React.ReactNode;
16
+ docstraConfig: DocstraConfig;
17
+ page: any;
18
+ }
19
+ type CalloutType = 'info' | 'warning' | 'error';
20
+ interface CalloutProps {
21
+ type?: CalloutType;
22
+ children: React.ReactNode;
23
+ }
24
+
25
+ export type { CalloutProps as C, DocstraContextType as D, IDocstraProvider as I };
@@ -0,0 +1,25 @@
1
+ import { DocstraConfig, SidebarItem } from 'docstra-types';
2
+
3
+ interface DocstraContextType {
4
+ openSidebar: boolean;
5
+ setOpenSidebar: (open: boolean) => void;
6
+ docstraConfig: DocstraConfig;
7
+ openSearchBox: boolean;
8
+ setOpenSearchBox: (open: boolean) => void;
9
+ packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun';
10
+ setPackageManager: (packageManager: 'npm' | 'yarn' | 'pnpm' | 'bun') => void;
11
+ sidebarItems?: SidebarItem[];
12
+ page: any;
13
+ }
14
+ interface IDocstraProvider {
15
+ children: React.ReactNode;
16
+ docstraConfig: DocstraConfig;
17
+ page: any;
18
+ }
19
+ type CalloutType = 'info' | 'warning' | 'error';
20
+ interface CalloutProps {
21
+ type?: CalloutType;
22
+ children: React.ReactNode;
23
+ }
24
+
25
+ export type { CalloutProps as C, DocstraContextType as D, IDocstraProvider as I };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docstra",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "The Modern Documentation Framework for Next.js",
5
5
  "files": [
6
6
  "dist"
@@ -41,7 +41,7 @@
41
41
  "lucide-react": "^0.554.0",
42
42
  "react-toast-msg": "^2.7.0",
43
43
  "tailwind-merge": "^3.4.0",
44
- "docstra-mdx": "0.1.0"
44
+ "docstra-mdx": "0.2.0"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "next": ">=16.0.0",