import{jsxs as c,jsx as r,Fragment as w}from"react/jsx-runtime";import{u as k,d as _,e as S,S as x,f as F,g as N,h as T,i as M,A as C,j as I,N as A,k as P,l as j,m as L,n as D,o as H}from"./app-sidebar-header-BX2s-HO_.js";import{g as O}from"./main-CWwoxgdq.js";import{usePage as y,Link as q}from"@inertiajs/react";import{useEffect as f,useState as g}from"react";import{T as z}from"./toaster-DuLpwsc2.js";import{toast as d}from"sonner";import{WelcomeModal as B}from"./WelcomeModal-BFw-aFh5.js";function E(){const{services:e}=y().props,{theme:t}=k(),a={dashboard:e?.menu_dashboard_enabled??!0,online:e?.menu_online_enabled??!0,voucher:e?.menu_voucher_enabled??!0,shop:e?.menu_shop_enabled??!0,topspender:e?.menu_topspender_enabled??!0,ingame:e?.menu_ingame_enabled??!0,historylog:e?.menu_historylog_enabled??!0,streamer:e?.menu_streamer_enabled??!0,event:e?.menu_event_enabled??!0,topup:e?.menu_topup_enabled??!0,rankingPvp:e?.menu_ranking_pvp_enabled??!0},s=O(e?.ipaymu_active??!0,e?.duitku_active??!1,e?.tripay_active??!1,e?.pakasir_active??!1,a);f(()=>{t?.colors?_(t.colors,t.respectsSystemTheme):_(S,!0)},[t]);const o=t?.colors??S,l=t?.respectsSystemTheme??!0,p=l?{}:{backgroundColor:o.background,color:o.foreground},n=l?{}:{borderColor:o.border};return c(x,{collapsible:"icon",variant:"sidebar",style:p,children:[r(F,{style:n,children:r(N,{children:r(T,{children:r(M,{size:"lg",asChild:!0,children:r(q,{href:"/dashboard",prefetch:!0,children:r(C,{})})})})})}),r(I,{children:r(A,{items:s})}),r(P,{style:n,children:r(j,{})})]})}function J({children:e,breadcrumbs:t=[],className:a}){const{flash:s}=y().props,[o,l]=g(null),[p,n]=g(!1);return f(()=>{(async()=>{try{const i=await(await fetch("/api/news/popup/active")).json();if(i&&i.id){const u=`news_popup_dismissed_${i.id}`,h=localStorage.getItem(u);let m=!0;if(h)if(i.popup_frequency==="daily")try{const b=JSON.parse(h);b.expiry&&Date.now()<b.expiry?m=!1:localStorage.removeItem(u)}catch{localStorage.removeItem(u)}else m=!1;m&&(l(i),n(!0))}}catch{}})()},[]),f(()=>{s?.success&&d.success(s.success),s?.error&&d.error(s.error),s?.info&&d.info(s.info),s?.warning&&d.warning(s.warning)},[s]),c(w,{children:[c(L,{variant:"sidebar",children:[r(E,{}),c(D,{variant:"sidebar",className:a,children:[r(z,{}),r(H,{breadcrumbs:t}),r("div",{className:"flex flex-1 flex-col p-4 md:p-6",children:e})]})]}),r(B,{isOpen:p,onClose:()=>n(!1),news:o})]})}const Y=({children:e,breadcrumbs:t,className:a,...s})=>r(J,{breadcrumbs:t,className:a,...s,children:e});export{Y as F};
