import{o as e}from"./rolldown-runtime-GyhWBpbT.js";import{F as t}from"./react-vendor-DoSylNpz.js";import{D as n,Dt as r,E as i,Er as a,Et as o,Fr as s,Gr as c,Hr as l,Kr as u,Lr as d,Mr as f,Nt as p,On as m,Yt as h,fr as g,ii as _,jr as v,kn as y,kr as b,kt as x,mn as S,ni as C,yr as w,zr as T}from"./mui-vendor-1IGyn9nW.js";import"./state-vendor-bhJgZEQG.js";import{A as E,D,O,b as k,g as A,ut as j,w as M}from"./index-BD_w4_v3.js";var N=e(_(),1),P=C(),F=()=>{let e=t(),{user:_}=j(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)(o,{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)(r,{sx:{fontSize:n}}),cloud_upload:(0,P.jsx)(h,{sx:{fontSize:n}})}[e?.toLowerCase()||``]||(0,P.jsx)(h,{sx:{fontSize:n}})},B=e=>E(_)||!e.permissions||e.permissions.length===0?!0:e.permissions.some(e=>_?.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,_]),H=t=>{e(t)},U=(e,t)=>{t!==null&&R(t)},W=()=>(0,P.jsx)(g,{container:!0,spacing:3,children:V.map(e=>(0,P.jsx)(g,{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)(v,{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)(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)(g,{container:!0,spacing:2,children:V.map(e=>(0,P.jsx)(g,{size:{xs:12,sm:6,md:4},children:(0,P.jsx)(f,{sx:{transition:`all 0.3s`,"&:hover":{transform:`translateX(4px)`,boxShadow:4}},children:(0,P.jsx)(v,{onClick:()=>H(e.link||e.path),children:(0,P.jsxs)(b,{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)(S,{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)(v,{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)(S,{}),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)(a,{maxWidth:`xl`,sx:k(),children:[(0,P.jsxs)(s,{sx:{display:`flex`,justifyContent:`space-between`,alignItems:`center`,mb:A.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)(m,{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)(i,{})}),(0,P.jsx)(y,{value:`square`,"aria-label":`square view`,children:(0,P.jsx)(x,{})}),(0,P.jsx)(y,{value:`list`,"aria-label":`list view`,children:(0,P.jsx)(n,{})})]})]}),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};