import{o as e}from"./rolldown-runtime-GyhWBpbT.js";import{F as t}from"./react-vendor-ChE_eana.js";import{At as n,D as r,Dt as i,E as a,Er as o,Fr as s,Gr as c,Hr as l,Kr as u,Lr as d,Mr as f,On as p,Ot as m,Pt as h,Xt as g,fr as _,hn as v,ii as y,jr as b,kn as x,kr as S,ni as C,yr as w,zr as T}from"./mui-vendor-K60S-ugg.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-Cz-yne81.js";var N=e(y(),1),P=C(),F=()=>{let e=t(),{user:y}=A(e=>e.auth),{menus:C,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)(i,{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)(h,{sx:{fontSize:n}}),history:(0,P.jsx)(m,{sx:{fontSize:n}}),cloud_upload:(0,P.jsx)(g,{sx:{fontSize:n}})}[e?.toLowerCase()||``]||(0,P.jsx)(g,{sx:{fontSize:n}})},B=e=>E(y)||!e.permissions||e.permissions.length===0?!0:e.permissions.some(e=>y?.permissions?.includes(e)),V=N.useMemo(()=>{if(!C)return[];let e=[];return C.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)},[C,y]),H=t=>{e(t)},U=(e,t)=>{t!==null&&R(t)},W=()=>(0,P.jsx)(_,{container:!0,spacing:3,children:V.map(e=>(0,P.jsx)(_,{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)(b,{onClick:()=>H(e.link||e.path),sx:{height:`100%`,display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,py:4},children:(0,P.jsxs)(S,{sx:{textAlign:`center`},children:[(0,P.jsx)(s,{sx:{color:`primary.main`,mb:2},children:z(e.icon)}),(0,P.jsx)(l,{variant:`h6`,component:`div`,gutterBottom:!0,children:e.name}),e.description&&(0,P.jsx)(l,{variant:`body2`,color:`text.secondary`,sx:{mt:1},children:e.description})]})})})},e.id))}),G=()=>(0,P.jsx)(_,{container:!0,spacing:2,children:V.map(e=>(0,P.jsx)(_,{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)(b,{onClick:()=>H(e.link||e.path),children:(0,P.jsxs)(S,{sx:{display:`flex`,alignItems:`center`,gap:2,py:2},children:[(0,P.jsx)(d,{sx:{bgcolor:`primary.main`,width:56,height:56},children:z(e.icon,`medium`)}),(0,P.jsx)(s,{sx:{flex:1},children:(0,P.jsx)(l,{variant:`h6`,component:`div`,children:e.name})}),(0,P.jsx)(v,{color:`action`})]})})})},e.id))}),K=()=>(0,P.jsx)(u,{elevation:1,children:V.map((e,t)=>(0,P.jsxs)(N.Fragment,{children:[(0,P.jsx)(b,{onClick:()=>H(e.link||e.path),sx:{transition:`all 0.2s`,"&:hover":{bgcolor:`action.hover`}},children:(0,P.jsxs)(s,{sx:{display:`flex`,alignItems:`center`,gap:3,p:2.5},children:[(0,P.jsx)(s,{sx:{bgcolor:`primary.main`,borderRadius:2,p:1.5,display:`flex`,alignItems:`center`,justifyContent:`center`},children:(0,P.jsx)(s,{sx:{color:`white`},children:z(e.icon,`medium`)})}),(0,P.jsxs)(s,{sx:{flex:1},children:[(0,P.jsx)(l,{variant:`h6`,component:`div`,sx:{mb:.5},children:e.name}),e.description&&(0,P.jsx)(l,{variant:`body2`,color:`text.secondary`,children:e.description})]}),(0,P.jsx)(T,{label:`View`,color:`primary`,variant:`outlined`,icon:(0,P.jsx)(v,{}),sx:{px:1}})]})}),t<V.length-1&&(0,P.jsx)(w,{})]},e.id))});return F?(0,P.jsx)(s,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,minHeight:`60vh`},children:(0,P.jsx)(c,{})}):(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(o,{maxWidth:!1,sx:{...k(),px:{xs:2,sm:3}},children:[(0,P.jsxs)(s,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:j.SECTION_MARGIN,flexWrap:`wrap`,gap:1},children:[(0,P.jsx)(s,{sx:{display:`flex`,alignItems:`center`,gap:1},children:(0,P.jsx)(l,{variant:`h5`,sx:{fontWeight:600},children:`Import Module`})}),(0,P.jsxs)(p,{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)(x,{value:`rectangle`,"aria-label":`rectangle view`,children:(0,P.jsx)(a,{})}),(0,P.jsx)(x,{value:`square`,"aria-label":`square view`,children:(0,P.jsx)(n,{})}),(0,P.jsx)(x,{value:`list`,"aria-label":`list view`,children:(0,P.jsx)(r,{})})]})]}),V.length===0?(0,P.jsxs)(s,{sx:{textAlign:`center`,py:8},children:[(0,P.jsx)(l,{variant:`h6`,color:`text.secondary`,children:`No import options available`}),(0,P.jsx)(l,{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};