"use client"
import{c as b}from"./chunk-DYSKPYAV.mjs";import{f as u}from"./chunk-GBHGC6EE.mjs";import{b as g}from"./chunk-UUTUGJ26.mjs";import{c as f,h as i,j as h}from"./chunk-C3INMDSG.mjs";import{ChevronDown as w,Menu as x,X as z}from"lucide-react";import o 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 s}from"react/jsx-runtime";function H({theme:r="light"}){let{domain:m="dub.co"}=y(),[a,n]=N(!1);C(()=>{a?document.body.style.overflow="hidden":document.body.style.overflow="auto"},[a]);let{data:t}=L(m==="dub.co"&&"/api/auth/session",h,{dedupingInterval:6e4});return s("div",{className:i(r==="dark"&&"dark"),children:[e("button",{onClick:()=>n(!a),className:i("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:i("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:s("ul",{className:"grid divide-y divide-gray-200 dark:divide-white/[0.15]",children:[b.map(({name:l,href:p,childItems:d},c)=>e(I,{name:l,href:p,childItems:d,setOpen:n},c)),t&&Object.keys(t).length>0?e("li",{className:"py-3",children:e(o,{href:f,className:"flex w-full font-semibold capitalize",children:"Dashboard"})}):s(S,{children:[e("li",{className:"py-3",children:e(o,{href:`${f}/login`,className:"flex w-full font-semibold capitalize",children:"Log in"})}),e("li",{className:"py-3",children:e(o,{href:`${f}/register`,className:"flex w-full font-semibold capitalize",children:"Sign Up"})})]})]})})]})}var I=({name:r,href:m,childItems:a,setOpen:n})=>{let{domain:t="dub.co"}=y(),[l,p]=N(!1);return a?e("li",{className:"py-3",children:s(g,{height:!0,children:[s("button",{className:"flex w-full justify-between",onClick:()=>p(!l),children:[e("p",{className:"font-semibold",children:r}),e(w,{className:i("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:d,href:c,icon:v,iconClassName:k})=>s(o,{href:u(c,t,{utm_source:"custom-domain",utm_medium:"navbar-item",utm_campaign:t,utm_content:d}),onClick:()=>n(!1),className:"flex w-full space-x-2",children:[e(v,{className:i("h-5 w-5 text-gray-500 dark:text-white/80",k)}),e("span",{className:"text-sm",children:d})]},c))})]})}):m?e("li",{className:"py-3",children:e(o,{href:u(m,t),onClick:()=>n(!1),className:"flex w-full font-semibold capitalize",children:r})}):null};export{H as a};
