"use client"
import{c as h}from"./chunk-2SXMJV3C.mjs";import{d as m,g as u,i as t}from"./chunk-JP57AFGB.mjs";import{ChevronDown as k,Menu as v,X as w}from"lucide-react";import n from"next/link";import{useParams as g}from"next/navigation";import{useEffect as x,useState as b}from"react";import L from"swr";import{Fragment as C,jsx as e,jsxs as i}from"react/jsx-runtime";function S({theme:r="light"}){let{domain:d="dub.co"}=g(),[a,s]=b(!1);x(()=>{a?document.body.style.overflow="hidden":document.body.style.overflow="auto"},[a]);let{data:l}=L(d==="dub.co"&&"/api/auth/session",u,{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(w,{className:"h-5 w-5 text-gray-600 dark:text-white/70"}):e(v,{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:[h.map(({name:o,href:c,childItems:f})=>e(z,{name:o,href:c,childItems:f,setOpen:s},c)),l&&Object.keys(l).length>0?e("li",{className:"py-3",children:e(n,{href:m,className:"flex w-full font-semibold capitalize",children:"Dashboard"})}):i(C,{children:[e("li",{className:"py-3",children:e(n,{href:`${m}/login`,className:"flex w-full font-semibold capitalize",children:"Log in"})}),e("li",{className:"py-3",children:e(n,{href:`${m}/register`,className:"flex w-full font-semibold capitalize",children:"Sign Up"})})]})]})})]})}var z=({name:r,href:d,childItems:a,setOpen:s})=>{let{domain:l="dub.co"}=g(),[o,c]=b(!1);return a?i("li",{className:"py-3",children:[i("button",{className:"flex w-full justify-between",onClick:()=>c(!o),children:[e("p",{className:"font-semibold",children:r}),e(k,{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:f,href:p,icon:y,iconClassName:N})=>i(n,{href:l==="dub.co"?`/${p}`:`https://dub.co/${p}`,onClick:()=>s(!1),className:"flex w-full space-x-2",children:[e(y,{className:t("h-5 w-5 text-gray-500 dark:text-white/80",N)}),e("span",{className:"text-sm",children:f})]},p))})]}):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{S as a};
