import{_ as w}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{cO as C,n as S,hv as b,m as x}from"./index-BTglIPU2.js?v=1773287522785";import{u as L}from"./useLoading-CZ2gSAW7.js?v=1773287522785";import{u as k}from"./index-CNMkGSax.js?v=1773287522785";import{k as B,R as H,r as l,$ as R,Z as $,a0 as o,a9 as _,_ as E,S as n,X as N}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a1 as O,a6 as V}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";const A={class:"p-20px"},I={class:"w-150px"},J=B({__name:"category",props:{data:{}},setup(c,{expose:u}){const m=c,{t:r}=H(),{rows:p}=m.data,d=k(),t=l(null),a=l([]),{loading:f,setLoading:i}=L();(async()=>{try{i(!0);const{message:e}=await C();S(e)&&e.length>0?(a.value=e.map(s=>({label:s.name,value:s.id})),t.value=e[0].id):(t.value=null,a.value=[])}finally{i(!1)}})();const g=()=>{if(t.value===null)throw x.error(r("Site.PHP.add_site_46")),new Error(r("Site.PHP.add_site_46"));return{id:t.value,site_ids:p.map(e=>e.id)}};return u({onConfirm:async({hide:e})=>{await b(g()),d.setRefresh(!0),e()}}),(e,s)=>{const v=V,y=O,h=w;return R(),$("div",A,[o(h,null,{default:_(()=>[o(y,{label:e.$t("Site.PHP.add_site_22"),"show-feedback":!1},{default:_(()=>[E("div",I,[o(v,{value:n(t),"onUpdate:value":s[0]||(s[0]=P=>N(t)?t.value=P:null),loading:n(f),options:n(a)},null,8,["value","loading","options"])])]),_:1},8,["label"])]),_:1})])}}});export{J as default};
