import{o as e}from"./rolldown-runtime-GyhWBpbT.js";import{F as t}from"./react-vendor-BD_NkAgt.js";import{An as n,At as r,D as i,Dt as a,E as o,Jr as s,Lr as c,Nr as l,Or as u,Ot as d,Pr as f,Pt as p,Vr as m,Wr as h,Xt as g,gn as _,ii as v,jn as y,jr as b,mr as x,oi as S,qr as C,xr as w,zr as T}from"./mui-vendor-DsoH2_ot.js";import"./state-vendor-Cw2RdylD.js";import{A as E,D,O,b as k,dt as A,g as j,w as M}from"./index-Bo9BrBsx.js";var N=e(S(),1),P=v(),F=()=>{let e=t(),{user:v}=A(e=>e.auth),{menus:S,isLoading:F}=O(),{setBreadcrumbs:I}=D(),[L,R]=(0,N.useState)(`rectangle`);M(`Import Module`),(0,N.useEffect)(()=>(I([{label:`Home`,path:`/`,icon:(0,P.jsx)(a,{fontSize:`small`})},{label:`Import Module`}]),()=>I([])),[I]);let z=(e,t=`large`)=>{let n=t===`small`?32:t===`medium`?40:48;return{file_upload:(0,P.jsx)(p,{sx:{fontSize:n}}),history:(0,P.jsx)(d,{sx:{fontSize:n}}),cloud_upload:(0,P.jsx)(g,{sx:{fontSize:n}})}[e?.toLowerCase()||``]||(0,P.jsx)(g,{sx:{fontSize:n}})},B=e=>E(v)||!e.permissions||e.permissions.length===0?!0:e.permissions.some(e=>v?.permissions?.includes(e)),V=N.useMemo(()=>{if(!S)return[];let e=[];return S.forEach(t=>{let n=t.submenus||t.submenu||[];n.length>0&&n.forEach(t=>{t.name.toLowerCase()===`import module`&&t.menuitems&&t.menuitems.forEach(t=>{B(t)&&e.push(t)})})}),e.sort((e,t)=>e.sequence-t.sequence)},[S,v]),H=t=>{e(t)},U=(e,t)=>{t!==null&&R(t)},W=()=>(0,P.jsx)(x,{container:!0,spacing:3,children:V.map(e=>(0,P.jsx)(x,{size:{xs:12,sm:6,md:4,lg:3},children:(0,P.jsx)(f,{sx:{height:`100%`,transition:`all 0.3s`,"&:hover":{transform:`translateY(-4px)`,boxShadow:6}},children:(0,P.jsx)(l,{onClick:()=>H(e.link||e.path),sx:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,py:4},children:(0,P.jsxs)(b,{sx:{textAlign:`center`},children:[(0,P.jsx)(c,{sx:{color:`primary.main`,mb:2},children:z(e.icon)}),(0,P.jsx)(h,{variant:`h6`,component:`div`,gutterBottom:!0,children:e.name}),e.description&&(0,P.jsx)(h,{variant:`body2`,color:`text.secondary`,sx:{mt:1},children:e.description})]})})})},e.id))}),G=()=>(0,P.jsx)(x,{container:!0,spacing:2,children:V.map(e=>(0,P.jsx)(x,{size:{xs:12,sm:6,lg:4},children:(0,P.jsx)(f,{sx:{transition:`all 0.3s`,"&:hover":{transform:`translateX(4px)`,boxShadow:4}},children:(0,P.jsx)(l,{onClick:()=>H(e.link||e.path),children:(0,P.jsxs)(b,{sx:{display:`flex`,alignItems:`center`,gap:2,py:2},children:[(0,P.jsx)(T,{sx:{bgcolor:`primary.main`,width:56,height:56},children:z(e.icon,`medium`)}),(0,P.jsx)(c,{sx:{flex:1},children:(0,P.jsx)(h,{variant:`h6`,component:`div`,children:e.name})}),(0,P.jsx)(_,{color:`action`})]})})})},e.id))}),K=()=>(0,P.jsx)(s,{elevation:1,children:V.map((e,t)=>(0,P.jsxs)(N.Fragment,{children:[(0,P.jsx)(l,{onClick:()=>H(e.link||e.path),sx:{transition:`all 0.2s`,"&:hover":{bgcolor:`action.hover`}},children:(0,P.jsxs)(c,{sx:{display:`flex`,alignItems:`center`,gap:3,p:2.5},children:[(0,P.jsx)(c,{sx:{bgcolor:`primary.main`,borderRadius:2,p:1.5,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,P.jsx)(c,{sx:{color:`white`},children:z(e.icon,`medium`)})}),(0,P.jsxs)(c,{sx:{flex:1},children:[(0,P.jsx)(h,{variant:`h6`,component:`div`,sx:{mb:.5},children:e.name}),e.description&&(0,P.jsx)(h,{variant:`body2`,color:`text.secondary`,children:e.description})]}),(0,P.jsx)(m,{label:`View`,color:`primary`,variant:`outlined`,icon:(0,P.jsx)(_,{}),sx:{px:1}})]})}),t<V.length-1&&(0,P.jsx)(w,{})]},e.id))});return F?(0,P.jsx)(c,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,minHeight:`60vh`},children:(0,P.jsx)(C,{})}):(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(u,{maxWidth:!1,sx:{...k(),px:{xs:2,sm:3}},children:[(0,P.jsxs)(c,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:j.SECTION_MARGIN,flexWrap:`wrap`,gap:1},children:[(0,P.jsx)(c,{sx:{display:`flex`,alignItems:`center`,gap:1},children:(0,P.jsx)(h,{variant:`h5`,sx:{fontWeight:600},children:`Import Module`})}),(0,P.jsxs)(n,{value:L,exclusive:!0,onChange:U,"aria-label":`view mode`,size:`small`,sx:{"& .MuiToggleButton-root.Mui-selected":{backgroundColor:`primary.main`,color:`white`,"&:hover":{backgroundColor:`primary.dark`}}},children:[(0,P.jsx)(y,{value:`rectangle`,"aria-label":`rectangle view`,children:(0,P.jsx)(o,{})}),(0,P.jsx)(y,{value:`square`,"aria-label":`square view`,children:(0,P.jsx)(r,{})}),(0,P.jsx)(y,{value:`list`,"aria-label":`list view`,children:(0,P.jsx)(i,{})})]})]}),V.length===0?(0,P.jsxs)(c,{sx:{textAlign:`center`,py:8},children:[(0,P.jsx)(h,{variant:`h6`,color:`text.secondary`,children:`No import options available`}),(0,P.jsx)(h,{variant:`body2`,color:`text.secondary`,children:`You don't have permission to access any import features`})]}):(0,P.jsxs)(P.Fragment,{children:[L===`square`&&W(),L===`rectangle`&&G(),L===`list`&&K()]})]})})};export{F as default};