import{o as e}from"./rolldown-runtime-GyhWBpbT.js";import{F as t,s as n}from"./react-vendor-BD_NkAgt.js";import{Fr as r,Gr as i,Lr as a,ii as o,oi as s,qr as c}from"./mui-vendor-DsoH2_ot.js";import{st as l}from"./index-Bo9BrBsx.js";s();var u=o(),d=({children:e,partnerType:o})=>{let s=t(),{data:d,isLoading:f,error:p}=n({queryKey:[`channelConfig`],queryFn:async()=>{let e=await l.get(`/api/masters/channel-config/`);return{enable_superstockist:e.data.enable_superstockist||!1,enable_distributor:e.data.enable_distributor||!1,enable_retailer:e.data.enable_retailer||!1}},refetchOnMount:`always`,staleTime:0}),m=d?o===`superstockist`?d.enable_superstockist:o===`distributor`?d.enable_distributor:d.enable_retailer:!1;return f?(0,u.jsx)(a,{sx:{display:`flex`,justifyContent:`center`,alignItems:`center`,minHeight:`60vh`},children:(0,u.jsx)(c,{})}):p?(0,u.jsx)(a,{sx:{p:3},children:(0,u.jsx)(i,{severity:`error`,children:`Failed to load channel configuration`})}):m?(0,u.jsx)(u.Fragment,{children:e}):(0,u.jsxs)(a,{sx:{display:`flex`,flexDirection:`column`,justifyContent:`center`,alignItems:`center`,minHeight:`60vh`,gap:2},children:[(0,u.jsxs)(i,{severity:`warning`,sx:{maxWidth:600},children:[o.charAt(0).toUpperCase()+o.slice(1).replace(`_`,` `),` feature is currently disabled. Please enable it in Channel Configuration to access this feature.`]}),(0,u.jsxs)(a,{sx:{display:`flex`,gap:2},children:[(0,u.jsx)(r,{variant:`outlined`,onClick:()=>s(`/masters`),children:`Back to Masters`}),(0,u.jsx)(r,{variant:`contained`,onClick:()=>s(`/settings/channel-configuration`),children:`Channel Configuration`})]})]})};export{d as t};