import{defineStore as e}from"pinia";import{k as a}from"./server.mjs";import{ref as t}from"vue";const r=e("service",(()=>{const{$axios:e}=a(),r=t({}),l=t(!1),s=t([]),i=t(null);return{errors:r,isLoading:l,services:s,service:i,getServices:async function(){l.value=!0;const a=await e.get("services");a.status>=200&&(s.value=a.data.data,l.value=!1)},getServiceById:async function(a){var t;l.value=!0;try{const r=await e.get(`/services/${a}`);"Service Not Found"===(null==(t=r.data)?void 0:t.message)?i.value=null:i.value=r.data.data}catch{i.value=null}finally{l.value=!1}},getServiceBySlug:async function(a){var t;l.value=!0;try{const r=await e.get(`/services/show/${a}`);"Service Not Found"===(null==(t=r.data)?void 0:t.message)?i.value=null:i.value=r.data.data}catch{i.value=null}finally{l.value=!1}},slugify:function(e){return e.toString().toLowerCase().trim().replace(/\s+/g,"-").replace(/[؟,،!%&]/g,"").replace(/-+/g,"-")}}}));export{r as h};
