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