import{u as D,a as L,s as R,r as S,j as e,_ as I,g as T,B as n,T as m,S as k,fH as P,L as A,fI as B,F as H,b as O,eh as _,f as $,i as N,eX as W,Q as w,I as q,fJ as G,D as J,W as Q,eY as U}from"./index-def636a4.js";import{A as V}from"./index-accbca3c.js";import{u as X}from"./useToggle-2b3cfa4d.js";import{g as Y,u as K}from"./useViewPort-4849ab19.js";import{I as F,R as M}from"./index-02faff3d.js";import{C as Z}from"./CardContent-c8b2d0af.js";const z=({tabsData:h,onTabClick:p,currentTab:E,id:l})=>{const f=D(),u=L(s=>R(s)),[b,y]=S.useState(new Set);S.useMemo(()=>Y(u.sidenav.theme),[u.sidenav.theme]);const g=s=>{y(t=>{const o=new Set(t);return o.has(s)?o.delete(s):o.add(s),o})};return e.jsx(I,{sx:{height:"100%",flex:1},children:e.jsx(T,{style:{height:"100%",padding:24,paddingTop:6},children:e.jsxs(n,{sx:{mt:2},children:[e.jsx(m,{variant:"h5",children:"Navigation"}),e.jsx(n,{sx:{my:1},children:h&&h.map((s,t)=>{var j;const o=E===t,c=b.has(t),r=s.children&&s.children.length>0,i=F[s.icon];return e.jsxs(n,{children:[e.jsx(n,{onClick:()=>{r?g(t):p(l,t,(s==null?void 0:s.url)||"")},sx:{cursor:"pointer",textDecoration:"none",color:"inherit"},children:e.jsxs(k,{sx:a=>({display:"flex",flexDirection:"row",gap:2,ml:0,width:"100%",lineHeight:2,p:1,transition:"all 0.3s",borderRadius:"5px",backgroundColor:o&&!r?"#E0EFFF":"",color:o&&!r?a.palette.common.black:"","&:hover":{backgroundColor:o&&!r?"#E0EFFF":"#f5f5f5"},justifyContent:"space-between",alignItems:"center"}),children:[e.jsxs(n,{sx:{display:"flex",alignItems:"center",gap:2},children:[i?e.jsx(i,{style:{fontSize:16}}):e.jsx(M,{style:{fontSize:16}}),e.jsx(m,{variant:"subtitle1",children:s.label})]}),r&&(c?e.jsx(P,{size:16}):e.jsx(A,{size:16}))]})}),r&&e.jsx(B,{in:c,children:e.jsx(n,{sx:{ml:3,mt:1},children:(j=s.children)==null?void 0:j.map((a,C)=>{const x=f.pathname===a.url,d=F[a.icon];return e.jsx(n,{onClick:()=>p(l,t,(a==null?void 0:a.url)||""),sx:{cursor:"pointer",textDecoration:"none",color:"inherit",mb:.5},children:e.jsxs(k,{sx:v=>({display:"flex",flexDirection:"row",gap:2,ml:0,width:"100%",lineHeight:2,p:1,transition:"all 0.3s",borderRadius:"5px",backgroundColor:x?"#E0EFFF":"",color:x?v.palette.common.black:"","&:hover":{backgroundColor:x?"#E0EFFF":"#f5f5f5"}}),children:[d?e.jsx(d,{style:{fontSize:14}}):e.jsx(M,{style:{fontSize:14}}),e.jsx(m,{variant:"body2",children:a.label})]})},C)})})})]},t)})})]})})})},ae=({menuCode:h,fromScreen:p,callback:E,data:l,app_label:f,model_name:u,goBackUrl:b,assignUserCallback:y,headerContent:g,tabsData:s,onTabClick:t})=>{const o=H(),c=O(),{id:r,tab:i}=_();K();const{isOpen:j,hide:a,toggleOpen:C}=X(),x=`${f}.${u}`,d=L(v=>v.customise.sidenav.showMobileMenu);return S.useEffect(()=>{c($({showMobileMenu:!1})),c(N({code:h,from:p}))},[]),e.jsx(n,{sx:{width:"100%"},children:e.jsxs(n,{sx:{mt:1},children:[e.jsxs(n,{sx:{py:1,display:"flex",alignItems:"center",justifyContent:"space-between",gap:2},children:[e.jsxs(m,{variant:"h4",sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer",fontWeight:"500"},onClick:()=>{o(b,{relative:"path"})},children:[e.jsx(W,{size:24}),`${l==null?void 0:l.code}`]}),e.jsxs(n,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(V,{instance_id:r||"",modal_path:x,callback:y}),g&&g]})]}),e.jsxs(w,{container:!0,spacing:2,sx:{mt:1},children:[e.jsx(w,{size:{xs:12,lg:3.3,xl:d?2.3:2.7},sx:{display:{lg:"block",xs:"none"}},children:e.jsx(z,{tabsData:s,onTabClick:t,currentTab:i?+i:0,id:r||""})}),e.jsxs(w,{size:{xs:12,lg:8.7,xl:d?9.7:9.3},children:[e.jsx(I,{sx:{display:{lg:"none",xs:"block"}},children:e.jsxs(n,{children:[e.jsx(q,{onClick:()=>{C()},children:e.jsx(G,{size:20})}),e.jsx(J,{open:j,onClose:a,sx:{width:288,"& .MuiDrawer-paper":{width:288}},children:e.jsx(z,{tabsData:s,onTabClick:t,currentTab:i?+i:0,id:r||""})})]})}),e.jsx(I,{sx:{mt:{xs:2,lg:0},height:"100%"},children:e.jsx(Z,{children:e.jsx(Q,{variant:"elevation",sx:{p:2,borderRadius:"10px"},children:e.jsx(U,{})})})})]})]})]})})};export{ae as S};
