import{b as n,c as i,a as c}from"./vendor-redux-a1f00e6b.js";import{d5 as u,F as p}from"./index-c62ac197.js";async function L(){return(await u.apiV10LayoutsGet()).data}async function I(t,a){return(await u.apiV10LayoutsLayoutIdAssignPost(t,a)).data}async function D(t){return(await u.apiV10LayoutsLayoutIdGet(t)).data}async function S(t,a){return(await u.apiV10LayoutsLayoutIdPut(t,a)).data}async function m(t){return(await u.apiV10LayoutsPost(t)).data}async function A(t){return(await u.apiV10LayoutsLayoutIdDelete(t)).data}const y="layouts",g={loading:!1,loadingDetails:!1,isDeleteConfirmation:!1,layoutList:[],isDrawerOpen:!1,type:"Add",selectedLayout:{},selectedLayoutData:[]},d=n(y+"/getLayouts",async()=>{var e,s,o;const t=await L();return{data:((s=(e=t==null?void 0:t.data)==null?void 0:e.layouts)==null?void 0:s.$values)||[],totalCount:((o=t==null?void 0:t.data)==null?void 0:o.totalCount)||0}}),l=n(y+"/getLayoutById",async t=>{var s,o;const a=await D(t);return{layoutData:(s=a==null?void 0:a.data)!=null&&s.layoutData?JSON.parse((o=a==null?void 0:a.data)==null?void 0:o.layoutData):[],layoutDetails:(a==null?void 0:a.data)||[]}}),r=i({name:"layouts",initialState:g,reducers:{setSelectedLayout:(t,a)=>{t.selectedLayout=a.payload},toggleDrawer:(t,a)=>{t.isDrawerOpen=a.payload.isDrawerOpen,t.type=a.payload.type},toggleDelete:(t,a)=>{t.isDeleteConfirmation=a.payload}},extraReducers:t=>{t.addCase(d.fulfilled,(a,e)=>{var s;a.layoutList=(s=e==null?void 0:e.payload)==null?void 0:s.data,a.loading=!1}).addCase(d.pending,a=>{a.loading=!0}).addCase(d.rejected,a=>{a.loading=!1}).addCase(l.fulfilled,(a,e)=>{var s,o;a.selectedLayout=(s=e==null?void 0:e.payload)==null?void 0:s.layoutDetails,a.selectedLayoutData=(o=e==null?void 0:e.payload)==null?void 0:o.layoutData,a.loadingDetails=!1}).addCase(l.pending,a=>{a.loadingDetails=!0}).addCase(l.rejected,a=>{a.loadingDetails=!1})}}),{toggleDrawer:P,toggleDelete:V,setSelectedLayout:G}=r.actions,f=r.reducer,O=c({data:f}),b=p;export{m as a,S as b,A as c,V as d,I as e,l as f,d as g,O as r,G as s,P as t,b as u};
