"use client"
import{c as b}from"./chunk-R4KEOG3E.mjs";import{f as u}from"./chunk-JG7HARGV.mjs";import{b as g}from"./chunk-2SIZB6Z2.mjs";import{d as c,g as h,i as t}from"./chunk-JP57AFGB.mjs";import{ChevronDown as w,Menu as x,X as z}from"lucide-react";import n from"next/link";import{useParams as y}from"next/navigation";import{useEffect as C,useState as N}from"react";import L from"swr";import{Fragment as S,jsx as e,jsxs as i}from"react/jsx-runtime";function R({theme:r="light"}){let{domain:d="dub.co"}=y(),[a,s]=N(!1);C(()=>{a?document.body.style.overflow="hidden":document.body.style.overflow="auto"},[a]);let{data:l}=L(d==="dub.co"&&"/api/auth/session",h,{dedupingInterval:6e4});return i("div",{className:t(r==="dark"&&"dark"),children:[e("button",{onClick:()=>s(!a),className:t("fixed right-3 top-3 z-40 rounded-full p-2 transition-colors duration-200 hover:bg-gray-200 focus:outline-none active:bg-gray-300 lg:hidden dark:hover:bg-white/20 dark:active:bg-white/30",a&&"hover:bg-gray-100 active:bg-gray-200"),children:a?e(z,{className:"h-5 w-5 text-gray-600 dark:text-white/70"}):e(x,{className:"h-5 w-5 text-gray-600 dark:text-white/70"})}),e("nav",{className:t("fixed inset-0 z-20 hidden w-full bg-white px-5 py-16 lg:hidden dark:bg-black dark:text-white/70",a&&"block"),children:i("ul",{className:"grid divide-y divide-gray-200 dark:divide-white/[0.15]",children:[b.map(({name:o,href:f,childItems:p},m)=>e(I,{name:o,href:f,childItems:p,setOpen:s},m)),l&&Object.keys(l).length>0?e("li",{className:"py-3",children:e(n,{href:c,className:"flex w-full font-semibold capitalize",children:"Dashboard"})}):i(S,{children:[e("li",{className:"py-3",children:e(n,{href:`${c}/login`,className:"flex w-full font-semibold capitalize",children:"Log in"})}),e("li",{className:"py-3",children:e(n,{href:`${c}/register`,className:"flex w-full font-semibold capitalize",children:"Sign Up"})})]})]})})]})}var I=({name:r,href:d,childItems:a,setOpen:s})=>{let{domain:l="dub.co"}=y(),[o,f]=N(!1);return a?e("li",{className:"py-3",children:i(g,{height:!0,children:[i("button",{className:"flex w-full justify-between",onClick:()=>f(!o),children:[e("p",{className:"font-semibold",children:r}),e(w,{className:t("h-5 w-5 text-gray-500 transition-all dark:text-white/50",o&&"rotate-180")})]}),o&&e("div",{className:"grid gap-4 overflow-hidden py-4",children:a.map(({title:p,href:m,icon:k,iconClassName:v})=>i(n,{href:u(m,l),onClick:()=>s(!1),className:"flex w-full space-x-2",children:[e(k,{className:t("h-5 w-5 text-gray-500 dark:text-white/80",v)}),e("span",{className:"text-sm",children:p})]},m))})]})}):e("li",{className:"py-3",children:e(n,{href:l==="dub.co"?`/${d}`:`https://dub.co/${d}`,onClick:()=>s(!1),className:"flex w-full font-semibold capitalize",children:r})})};export{R as a};
