import{_ as B}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{gh as C,gi as N,i as U,ao as S}from"./index-BTglIPU2.js?v=1773287522785";import{k as V,R as j,r as m,e as E,$ as _,a8 as u,a9 as c,a0 as r,_ as d,S as t,ak as f,N as b}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a1 as q,a6 as F,b as I,a8 as M}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";const O={class:"w-280px"},z={class:"w-280px"},T=V({__name:"index",props:{row:{}},setup(v,{expose:x}){const h=v,{row:i}=h,{t:n}=j(),l=m(null),e=E({dataAccess:"127.0.0.1",access:"127.0.0.1",ssl:""}),w=m([{label:n("Database.form.index_12"),value:"127.0.0.1"},{label:n("Database.form.index_13"),value:"%"},{label:n("Database.form.index_14"),value:"ip"}]),g={host:{trigger:["blur","change"],validator:()=>e.dataAccess==="ip"&&e.access.trim()===""?new Error(n("Database.form.index_19")):!0}},k=s=>{s==="ip"?e.access="":e.access=s},A=()=>({...b(e),name:i.username,access:e.dataAccess==="ip"?e.access.trim().split("\n").join(","):e.access}),y=async()=>{var a;await((a=l.value)==null?void 0:a.validate());const s=A();C(b(s))};return(async()=>{const{message:s}=await N({name:i.name});U(s)&&(s.permission!=="127.0.0.1"&&s.permission!=="%"?(e.dataAccess="ip",e.access=s.permission.split(",").join("\n")):(e.dataAccess=s.permission,e.access=s.permission),e.ssl=S(s.ssl)?s.ssl:"")})(),x({onConfirm:y}),(s,a)=>{const D=F,p=q,$=I,P=M,R=B;return _(),u(R,{ref_key:"formRef",ref:l,model:t(e),rules:g,class:"px-20px py-24px"},{default:c(()=>[r(p,{label:s.$t("Database.form.index_6"),path:"listen_ip"},{default:c(()=>[d("div",O,[r(D,{value:t(e).dataAccess,"onUpdate:value":[a[0]||(a[0]=o=>t(e).dataAccess=o),k],class:"permission-select",options:t(w)},null,8,["value","options"])])]),_:1},8,["label"]),t(e).dataAccess==="ip"?(_(),u(p,{key:0,label:s.$t("Database.form.index_7"),path:"host"},{default:c(()=>[d("div",z,[r($,{value:t(e).access,"onUpdate:value":a[1]||(a[1]=o=>t(e).access=o),type:"textarea",autosize:{minRows:3,maxRows:3},"input-props":{name:"address"},placeholder:s.$t("Database.form.index_8")},null,8,["value","placeholder"])])]),_:1},8,["label"])):f("",!0),f("",!0)]),_:1},8,["model"])}}});export{T as default};
