import{_ as a}from"./index.vue_vue_type_script_setup_true_lang.js?v=1763625242172";import{x as s,m as e}from"./page_layout.js?v=1763625242172";import{d as t}from"./public.js?v=1763625242172";import{f as o,aN as l}from"./site.js?v=1763625242172";import{u as i}from"./index238.js?v=1763625242172";import{k as r,P as n,r as u,R as d,S as p,X as m,a3 as _,U as v,V as f,aj as c}from"./vue.js?v=1763625242172";import{dV as j,dP as g}from"./naive.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";const P={class:"p-20px"},w={class:"w-150px"},x=r({__name:"category",props:{data:{}},setup(r,{expose:x}){const y=r,{t:b}=n(),{rows:h}=y.data,H=i(),S=u(null),k=u([]),{loading:R,setLoading:U}=t();(async()=>{try{U(!0);const{message:a}=await o();s(a)&&a.length>0?(k.value=a.map((a=>({label:a.name,value:a.id}))),S.value=a[0].id):(S.value=null,k.value=[])}finally{U(!1)}})();return x({onConfirm:async({hide:a})=>{await l((()=>{if(null===S.value)throw e.error(b("Site.PHP.add_site_46")),new Error(b("Site.PHP.add_site_46"));return{id:S.value,site_ids:h.map((a=>a.id))}})()),H.setRefresh(!0),a()}}),(s,e)=>{const t=j,o=g,l=a;return d(),p("div",P,[m(l,null,{default:_((()=>[m(o,{label:s.$t("Site.PHP.add_site_22"),"show-feedback":!1},{default:_((()=>[v("div",w,[m(t,{value:f(S),"onUpdate:value":e[0]||(e[0]=a=>c(S)?S.value=a:null),loading:f(R),options:f(k)},null,8,["value","loading","options"])])])),_:1},8,["label"])])),_:1})])}}});export{x as default};
