import{jsxs as n,jsx as e,Fragment as j}from"react/jsx-runtime";import{I as B}from"./index-CUpX7x90.js";import{M as E}from"./main-Cv60h411.js";import{A as O}from"./app-logo-CAnM-q9p.js";import{U as L,V as z,B as l,W as A,a0 as F,c as C,e as T,X}from"./ui-components-B24mpb8o.js";import{u as M}from"./use-auth-cj50aT3v.js";import{u as I}from"./use-screen-CJI_WQZy.js";import{usePage as _,Link as t}from"@inertiajs/react";import{X as D,List as G,Menu as R,ChevronDown as U}from"lucide-react";import{useState as N,useEffect as V,Fragment as k}from"react";import{A as W}from"./appearance-zLWEcDPI.js";import{L as Y}from"./language-79bZLpyc.js";import{N as $}from"./notification-BBQVVMqD.js";import{P as q}from"./profile-toggle-E46Ne1rK.js";const H=({language:o})=>{const{props:c}=_(),{navbar:i,translate:a,system:g}=c,{isLoggedIn:h}=M(),{screen:p}=I(),[d,x]=N(!1),f=i.navbar_items.sort((r,v)=>r.sort-v.sort),m=()=>f.map(r=>r.slug==="theme"?e(W,{},r.id):g.fields.language_selector&&o&&r.slug==="language"?e(Y,{},r.id):h&&r.slug==="notification"?e($,{},r.id):null);return n("div",{className:"flex items-center gap-2",children:[p>768?e("div",{className:"flex items-center gap-2",children:m()}):n(L,{open:d,onOpenChange:x,children:[e(z,{asChild:!0,children:e(l,{size:"icon",variant:"secondary",className:"md:hidden",children:d?e(D,{className:"h-6 w-6"}):e(G,{className:"h-6 w-6"})})}),e(A,{className:"w-12 min-w-10",children:e(F,{value:"bottom",children:e("div",{className:"flex flex-col items-center gap-2",children:m()})})})]}),h?f.map(r=>r.slug==="profile"?e(q,{},r.id):null):n("div",{className:"hidden space-x-2 sm:block",children:[e(l,{asChild:!0,variant:"outline",className:"",children:e(t,{href:route("register"),children:a.button.sign_up})}),e(l,{asChild:!0,className:"",children:e(t,{href:route("login"),children:a.button.log_in})})]})]})},J=({language:o=!1,heightCover:c=!0,customizable:i=!0})=>{const{props:a}=_(),{ziggy:g,navbar:h,translate:p}=a,{isAdmin:d,isLoggedIn:x}=M(),[f,m]=N(!1),[r,v]=N(!1),{screen:S}=I();V(()=>{const s=()=>{window.scrollY>100?m(!0):m(!1)};return window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s)}},[]);const w=s=>{if(s.active)switch(s.type){case"url":return e(t,{href:s.value||"",className:"text-sm font-normal",children:s.title},s.id);case"dropdown":return n(L,{children:[n(z,{className:"flex cursor-pointer items-center gap-1 text-sm",children:[s.title,e(U,{className:"ml-1 h-4 w-4"})]}),e(A,{align:"start",className:"min-w-20",children:s.items&&Array.isArray(s.items)&&s.items.map((u,P)=>e(X,{asChild:!0,className:"cursor-pointer px-5",children:e(t,{href:u.url||"",children:u.title})},P))})]},s.id);default:return null}},b=h.navbar_items.sort((s,u)=>s.sort-u.sort),y=a.customize?g.location:"?customize=true";return n(j,{children:[n("div",{className:C("fixed top-0 z-30 w-full",r&&"bg-background"),children:[n("div",{className:C("container mt-0 flex h-[72px] items-center justify-between gap-1 !px-4 transition-all duration-200 md:gap-6",f&&"bg-background shadow-card mx-auto mt-4 h-16 w-full rounded-2xl md:!max-w-6xl",S<768&&"mt-0 h-[72px] rounded-none"),children:[n("div",{className:"flex items-center gap-2",children:[e(l,{size:"icon",variant:"secondary",className:"md:hidden",onClick:()=>v(!r),children:r?e(D,{className:"h-6 w-6"}):e(R,{className:"h-6 w-6"})}),e(t,{href:"/",children:e(O,{})})]}),e("div",{className:"hidden gap-4 md:flex md:items-center",children:b.map(s=>e(k,{children:w(s)},s.id))}),n("div",{className:"flex items-center gap-2",children:[i&&d&&e(l,{asChild:!0,variant:"outline",className:"hidden text-sm font-normal sm:block",children:e(t,{href:y,children:a.customize?"Back":"Customize"})}),e(H,{language:o})]})]}),r&&e(T,{className:"bg-background h-[calc(100vh-72px)] border-t md:hidden",children:n("div",{className:"flex flex-col space-y-4 px-6 py-4",children:[b.map(s=>e(k,{children:w(s)},s.id)),i&&d&&e(l,{asChild:!0,variant:"outline",className:"text-sm font-normal",children:e(t,{href:y,children:a.customize?"Back":"Customize"})}),!x&&n("div",{className:"block space-y-2 sm:hidden",children:[e(l,{asChild:!0,variant:"outline",className:"w-full rounded-sm shadow-none sm:px-5 md:h-10",children:e(t,{href:route("register"),children:p.button.sign_up})}),e(l,{asChild:!0,className:"w-full rounded-sm shadow-none sm:px-5 md:h-10",children:e(t,{href:route("login"),children:p.button.log_in})})]})]})})]}),c&&e("div",{className:"relative z-20 h-[72px] bg-transparent"})]})},me=({children:o,language:c=!1,navbarHeight:i=!0,customizable:a})=>e(E,{children:n("div",{className:"flex min-h-screen flex-col justify-between overflow-x-hidden",children:[n("main",{children:[e(J,{heightCover:i,customizable:a,language:c}),o]}),e(B,{})]})});export{me as L};
