import{_ as a}from"./index.vue_vue_type_script_setup_true_lang.js?v=1763625242172";import{bn as e,eV as s,o as r,m as l}from"./page_layout.js?v=1763625242172";import{_ as t}from"./index.vue_vue_type_script_setup_true_lang2.js?v=1763625242172";import{k as o,P as d,a0 as i,r as n,e as u,c as p,R as m,a2 as _,a3 as c,X as b,U as v,V as f,j as x,a4 as g,N as h}from"./vue.js?v=1763625242172";import"./public.js?v=1763625242172";import{g as j}from"./index131.js?v=1763625242172";import{au as w,dP as D,dV as y}from"./naive.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";import"./index98.js?v=1763625242172";import"./index132.js?v=1763625242172";import"./soft.js?v=1763625242172";import"./site.js?v=1763625242172";const $={class:"w-240px"},U={class:"w-240px"},k={class:"w-240px"},q={class:"w-240px"},R={class:"ml-8px"},V=o({__name:"index",setup(o,{expose:V}){const{t:C}=d(),E=e(),{remoteList:P}=i(E),H=n(null),L=u({sid:P.value.length>0?P.value[0].id:null,name:"",db_user:"",password:"",active:!1,ssl:""}),N=p((()=>P.value.map((a=>({label:"".concat(a.ps," (").concat(a.db_host,")"),value:a.id}))))),X={name:{required:!0,message:C("Database.form.index_15"),trigger:["blur","change"]},db_user:{required:!0,message:C("Database.form.index_16"),trigger:["blur","change"]},password:{required:!0,message:C("Database.form.index_17"),trigger:["blur","change"]},sid:{trigger:"change",validator:(a,e)=>null!==e||new Error(C("Database.form.index_18"))}},z=a=>{L.db_user=a},A=()=>{j()};return V({onConfirm:async({hide:a})=>{var e;try{await(null==(e=H.value)?void 0:e.validate());const r=(()=>{const{sid:a}=L;if(null===a)throw l.error(C("Database.form.index_18")),new Error(C("Database.form.index_18"));return{...h(L),sid:a,ps:L.name}})();await s(E.type,r),E.setRefresh(!0),a()}catch(r){console.error(r)}}}),(e,s)=>{const l=w,o=D,d=t,i=y,n=r,u=a;return m(),_(u,{ref_key:"formRef",ref:H,model:f(L),rules:X,class:"p-20px"},{default:c((()=>[b(o,{label:e.$t("Database.index_12"),path:"name"},{default:c((()=>[v("div",$,[b(l,{value:f(L).name,"onUpdate:value":[s[0]||(s[0]=a=>f(L).name=a),z],placeholder:e.$t("Database.form.index_2")},null,8,["value","placeholder"])])])),_:1},8,["label"]),b(o,{label:e.$t("Database.index_13"),path:"db_user"},{default:c((()=>[v("div",U,[b(l,{value:f(L).db_user,"onUpdate:value":s[1]||(s[1]=a=>f(L).db_user=a),placeholder:e.$t("Database.form.index_4")},null,8,["value","placeholder"])])])),_:1},8,["label"]),b(o,{label:e.$t("Database.index_14"),path:"password"},{default:c((()=>[v("div",k,[b(d,{value:f(L).password,"onUpdate:value":s[2]||(s[2]=a=>f(L).password=a),placeholder:""},null,8,["value"])])])),_:1},8,["label"]),b(o,{label:e.$t("Database.form.index_9"),path:"sid"},{default:c((()=>[v("div",q,[b(i,{value:f(L).sid,"onUpdate:value":s[3]||(s[3]=a=>f(L).sid=a),options:f(N)},null,8,["value","options"])]),v("div",R,[b(n,{onClick:A},{default:c((()=>[x(g(e.$t("Database.form.index_10")),1)])),_:1})])])),_:1},8,["label"])])),_:1},8,["model"])}}});export{V as default};
