import{r as s}from"./app-DZcRemIr.js";function D(){const t=s(!1),c=s(""),l=s([]),i=s(null),u=s(!1),f=s(""),m=s("success"),o=s("");let n=null;const p=()=>{n&&(clearTimeout(n),n=null),t.value=!1,i.value=null,l.value=[],u.value=!1,f.value="",o.value=""};return{showErrorDialog:t,errorDialogMessage:c,errorDialogDetails:l,errorSummary:i,showToast:u,toastMessage:f,toastType:m,toastDetails:o,showNotification:(g,v,e)=>{var _;if(p(),v==="error"||v==="warning"){c.value=g,e!=null&&e.summary&&(i.value=e.summary,i.value.mensaje_general&&(c.value=i.value.mensaje_general));const r=[];if(e){if(e.errors&&typeof e.errors=="object")for(const h in e.errors)Array.isArray(e.errors[h])&&r.push(...e.errors[h]);e.validation_errors&&Array.isArray(e.validation_errors)&&r.push(...e.validation_errors),e.validation_failures&&Array.isArray(e.validation_failures)&&r.push(...e.validation_failures),e.processing_errors&&Array.isArray(e.processing_errors)&&r.push(...e.processing_errors),e.details&&(typeof e.details=="string"?r.push(e.details):Array.isArray(e.details)?r.push(...e.details):typeof e.details=="object"&&r.push(JSON.stringify(e.details,null,2)))}l.value=r,l.value.length>0||i.value?t.value=!0:(u.value=!0,f.value=g,m.value=v)}else f.value=g,m.value=v,(_=e==null?void 0:e.summary)!=null&&_.mensaje_general?o.value=e.summary.mensaje_general:e!=null&&e.details&&(o.value=typeof e.details=="string"?e.details:JSON.stringify(e.details,null,2)),u.value=!0,n=setTimeout(()=>{u.value=!1,n=null},5e3)},clearNotifications:p}}export{D as u};
