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