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