import{j as a,l as j}from"./vendor-mui-69397583.js";import{u as L,r as E,f as A}from"./index-8ab45286.js";import{Y as D,l as N}from"./index-c62ac197.js";import{B as W,C as G,O as R,a as k,L as B,c as h,b as T,M,d as H,A as z,f as O,N as P,g as Y}from"./OpportunityStatus-fa8108ea.js";import{r as s}from"./vendor-react-ece1c85f.js";import{r as b}from"./styles-0608350c.js";import{A as $}from"./AdaptableCard-df7695d6.js";import"./vendor-redux-a1f00e6b.js";import"./vendor-pdf-b2a5d8b1.js";import"./vendor-devex-33a39e11.js";import"./vendor-i18n-2fcb1983.js";import"./vendor-msal-9caa1ed1.js";import"./vendor-charts-eccea5d1.js";import"./Alert-7dfbd254.js";import"./index-6b6d0f06.js";import"./useControllableState-d0909575.js";import"./index-c2088808.js";import"./useDidUpdate-25c4d4ed.js";import"./Drawer-949c18c6.js";import"./FormContainer-91c2b0e4.js";import"./Switcher-c8648037.js";import"./index-36228db5.js";import"./Upload-fb34ce03.js";import"./index-bea4c3dc.js";import"./esm-f306d015.js";import"./tableV3-3d2f4952.js";import"./FileSaver.min-20f3f13a.js";import"./mapView-ab35acaa.js";import"./lodash-306e3f66.js";import"./DensitySelector-a2c1c68f.js";import"./NoData-8c485a3a.js";import"./cjs-162261df.js";const F=[{widgetId:"6f8a2c3e-9d4a-4c3b-9f6e-8b6d3f4a2e91",name:"Bar Graph",component:W,icon:G,layout:{i:"o-1",x:0,y:1/0,w:6,h:3},templateId:"o-1",desc:"Shows a timeline...",configuration:{}},{widgetId:"1b7e9d2a-4c6f-4e1a-b8d3-2a9f6c5e7d10",name:"Data Grid",component:R,icon:k,layout:{i:"o-2",x:0,y:1/0,w:12,h:4},templateId:"o-2",desc:"Displays content...",configuration:{}},{widgetId:"c3f9a6b4-2d7e-4a5f-9e18-6b0d2a4c8f31",name:"Line Graph",component:B,icon:h,layout:{i:"o-3",x:0,y:1/0,w:4,h:2},templateId:"o-3",desc:"Track automation ...",configuration:{}},{widgetId:"9e2d6b5a-7c3f-4a1e-b084-3f6c9d2a8e57",name:"Count Card",component:T,icon:h,layout:{i:"o-4",x:0,y:1/0,w:4,h:1},templateId:"o-4",desc:"Track counts...",configuration:{}},{widgetId:"4a8f2c9d-6b3e-4f1a-9d72-5e8b6c3a2f40",name:"Maps",component:M,icon:H,layout:{i:"o-5",x:0,y:1/0,w:6,h:4},templateId:"o-5",desc:"Visualizes location data...",configuration:{}},{widgetId:"2f6b9a8e-3d4c-4e1a-bf57-9c2d6a8e4b10",name:"Activity Log",component:z,icon:O,layout:{i:"o-7",x:0,y:1/0,w:10,h:3},templateId:"o-7",desc:"Shows a timeline...",configuration:{}},{widgetId:"a9e3f2d6-8b4c-4f1a-9d75-6c2e8b4a0f93",name:"Alert",component:P,icon:Y,layout:{i:"o-8",x:0,y:1/0,w:12,h:1},templateId:"o-8",desc:"Displays brief messages...",configuration:{}}],U=d=>{const g=["lg","md","sm","xs","xxs"],c={};return g.forEach(l=>{c[l]=d.map(m=>({...m}))}),c},V=b.WidthProvider(b.Responsive),_=30,q={className:"layout",breakpoints:{lg:1200},cols:{lg:12,md:10,sm:6,xs:4},rowHeight:_,draggableHandle:".react-grid-dragHandleExample",isDroppable:!0},At=({menuData:d})=>{const{name:g,keyExpr:c,layoutId:l}=d;D("layouts",E);const m=N(),{loadingDetails:x,selectedLayout:J,selectedLayoutData:o}=L(t=>t.layouts.data),[I,p]=s.useState([]),[u,f]=s.useState([]),v=s.useRef({}),w=async()=>{m(A(l))};s.useEffect(()=>{w()},[]),s.useEffect(()=>{var t;if(!((t=o==null?void 0:o.WIDGETS)!=null&&t.length)){p([]),f([]);return}},[o]);const C=U(u);return s.useEffect(()=>{var i;if(!((i=o==null?void 0:o.WIDGETS)!=null&&i.length)){p([]),f([]);return}const t=new Map(o.LAYOUT.map(e=>[e.i,{...e,y:Number.isFinite(e.y)?e.y:0}])),n=o.WIDGETS.map(e=>{const y=F.find(S=>S.templateId===e.templateId);return y?{...y,...e,layout:t.get(e.id)}:null}).filter(Boolean),r=n.map(e=>e.layout).filter(Boolean);p(n),f(r)},[o]),a.jsx("div",{children:a.jsxs($,{className:"m-6 h-full py-4 px-6 bg-transparent",bodyClass:"h-full",children:[x&&a.jsx(j,{sx:{backgroundColor:"rgba(0, 0, 0, 0.1)","& .MuiLinearProgress-bar":{backgroundColor:"var(--custom-600)"}}}),a.jsx("div",{className:"flex w-full h-[calc(100vh-120px)] gap-4",children:a.jsx("div",{className:"transition-all duration-300 w-full h-full overflow-hidden",children:a.jsx("div",{className:"h-full overflow-y-auto",children:a.jsx(V,{...q,layouts:C,isDraggable:!1,isResizable:!1,children:I.map(t=>{const n=u.find(i=>i.i===t.id),r=t.component;return a.jsx("div",{"data-grid":n,className:"relative",children:a.jsx("div",{ref:i=>v.current[t.id]=i,className:"relative w-full h-full p-2 bg-white rounded-md shadow-sm group",children:a.jsx("div",{className:`widget-content widget-content-${t.id} overflow-hidden`,style:{width:"100%"},children:r&&a.jsx(r,{widgetData:t})})})},t.id)})},`grid-${u.length}`)})})})]})})};export{At as default};
