import{_ as R}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{_ as k,fc as C,m as N}from"./index-BTglIPU2.js?v=1773287522785";import{_ as U}from"./index.vue_vue_type_script_setup_true_lang-DG86e1NA.js?v=1773287522785";import{k as y,R as S,a6 as q,r as B,e as V,c as E,$ as T,a8 as j,a9 as l,a0 as o,_ as d,S as t,j as I,aa as L,N as O}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{u as P}from"./index-B5d4M70B.js?v=1773287522785";import{g as z}from"./index-wgWqrNqx.js?v=1773287522785";import{a1 as A,b as F,a6 as G}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./index-K4YGya6V.js?v=1773287522785";import"./index-COOnaZWq.js?v=1773287522785";const H={class:"w-240px"},J={class:"w-240px"},K={class:"w-240px"},M={class:"w-240px"},Q={class:"ml-8px"},ie=y({__name:"index",setup(W,{expose:c}){const{t:r}=S(),_=P(),{remoteList:m}=q(_),p=B(null),a=V({sid:m.value.length>0?m.value[0].id:null,name:"",db_user:"",password:"",active:!1,ssl:""}),f=E(()=>m.value.map(e=>({label:"".concat(e.ps," (").concat(e.db_host,")"),value:e.id}))),b={name:{required:!0,message:r("Database.form.index_15"),trigger:["blur","change"]},db_user:{required:!0,message:r("Database.form.index_16"),trigger:["blur","change"]},password:{required:!0,message:r("Database.form.index_17"),trigger:["blur","change"]},sid:{trigger:"change",validator:(e,s)=>s===null?new Error(r("Database.form.index_18")):!0}},v=e=>{a.db_user=e},g=()=>{z()},w=()=>{const{sid:e}=a;if(e===null)throw N.error(r("Database.form.index_18")),new Error(r("Database.form.index_18"));return{...O(a),sid:e,ps:a.name}};return c({onConfirm:async({hide:e})=>{var i;await((i=p.value)==null?void 0:i.validate());const s=w();await C(_.type,s),_.setRefresh(!0),e()}}),(e,s)=>{const i=F,u=A,x=U,h=G,D=k,$=R;return T(),j($,{ref_key:"formRef",ref:p,model:t(a),rules:b,class:"p-20px"},{default:l(()=>[o(u,{label:e.$t("Database.index_12"),path:"name"},{default:l(()=>[d("div",H,[o(i,{value:t(a).name,"onUpdate:value":[s[0]||(s[0]=n=>t(a).name=n),v],placeholder:e.$t("Database.form.index_2")},null,8,["value","placeholder"])])]),_:1},8,["label"]),o(u,{label:e.$t("Database.index_13"),path:"db_user"},{default:l(()=>[d("div",J,[o(i,{value:t(a).db_user,"onUpdate:value":s[1]||(s[1]=n=>t(a).db_user=n),placeholder:e.$t("Database.form.index_4")},null,8,["value","placeholder"])])]),_:1},8,["label"]),o(u,{label:e.$t("Database.index_14"),path:"password"},{default:l(()=>[d("div",K,[o(x,{value:t(a).password,"onUpdate:value":s[2]||(s[2]=n=>t(a).password=n),placeholder:""},null,8,["value"])])]),_:1},8,["label"]),o(u,{label:e.$t("Database.form.index_9"),path:"sid"},{default:l(()=>[d("div",M,[o(h,{value:t(a).sid,"onUpdate:value":s[3]||(s[3]=n=>t(a).sid=n),options:t(f)},null,8,["value","options"])]),d("div",Q,[o(D,{onClick:g},{default:l(()=>[I(L(e.$t("Database.form.index_10")),1)]),_:1})])]),_:1},8,["label"])]),_:1},8,["model"])}}});export{ie as default};
