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