import{d as y,r as o,D as I,J as n,o as u,h as m,u as c,F as d,P as i}from"../../../common/index.DXvi0yH9.js";import{u as k}from"../../../common/index.CZtQfmHi.js";import{_ as x}from"../../../common/_plugin-vue_export-helper.DlAUqK2U.js";import"../../../common/pinia.D9yoqqEz.js";const A=y({__name:"AppLayout",setup(L){const{getCollection:_}=k(),f=d("components/Lists.vue"),p=d("components/Items.vue"),t=o(!1),a=o({key:"",user_id:0,id:0,name:"",description:"",status:"",is_default:!1,is_public:!1,url_code:"",items:[],emails:[],user_ids:[],allowed_roles:[],allowed_edit_emails:[]}),s=o(null),v=async(e,l)=>{e!=="new"&&(e!=null&&e.id)?(a.value=e,t.value=!0,s.value=l,i("item",e.id)):e==="new"&&(t.value=!0,s.value=null,i("item",""))},r=e=>{e==="close"&&(t.value=!1,a.value={key:"",user_id:0,id:0,name:"",description:"",status:"",is_default:!1,is_public:!1,url_code:"",items:[],emails:[],user_ids:[],allowed_roles:[],allowed_edit_emails:[]},s.value=null,i("item",""),i("add",""))},w=async()=>{const e=n("item");if(e){const l=await _(e);a.value=l.data,t.value=!0,s.value=0}};return I(()=>{n("add")==="new"?(t.value=!0,s.value=null):w()}),(e,l)=>!t.value&&s.value===null?(u(),m(c(f),{key:0,onLoadItems:v})):(u(),m(c(p),{key:1,item:a.value,"item-index":s.value,onAction:r},null,8,["item","item-index"]))}}),P=x(A,[["__scopeId","data-v-7f5f80ab"]]);export{P as default};
