import{_ as U}from"./index-DIKmrNCq.js?v=1773287522785";import{_ as B}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import"./index-BTglIPU2.js?v=1773287522785";import{a as m}from"./check-CNel7fTH.js?v=1773287522785";import{B as T,C as R}from"./firewall-jQIxKxfN.js?v=1773287522785";import{k as A,R as D,r as N,e as V,$ as x,Z as I,a0 as t,a9 as i,_ as d,S as a,aa as c}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a1 as L,a6 as O,b as Z}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";const j={class:"p-20px"},q={class:"w-200px"},z={class:"w-200px"},G={class:"w-200px"},H={class:"w-200px"},J={class:"w-200px"},er=A({__name:"form",props:{row:{},isEdit:{type:Boolean,default:!1}},emits:["refresh"],setup(w,{expose:F,emit:v}){const b=w,y=v,{t:p}=D(),{isEdit:u,row:l}=b,f=N(null),r=V({protocol:"tcp",s_ports:"",d_address:"",d_ports:"",brief:""}),S={s_ports:{trigger:["blur","input"],validator:()=>r.s_ports.trim()===""||!r.s_ports?new Error(p("Security.Firewall.Forward.form_3")):m(r.s_ports)?!0:new Error(p("Security.Firewall.Forward.form_12"))},d_ports:{trigger:["blur","input"],validator:()=>r.d_ports.trim()===""||!r.d_ports?new Error(p("Security.Firewall.Forward.form_7")):m(r.d_ports)?!0:new Error(p("Security.Firewall.Forward.form_12"))}},h=[{label:"TCP",value:"tcp"},{label:"UDP",value:"udp"}],$=()=>{u&&l&&(r.protocol=l.Protocol?l.Protocol.toLowerCase():"tcp",r.s_ports=l.S_Port||"",r.d_address=l.T_Address||"",r.d_ports=l.T_Port||"",r.brief=l.brief)},P=()=>({protocol:r.protocol,S_Port:r.s_ports,T_Port:r.d_ports,T_Address:r.d_address,brief:r.brief}),g=async()=>{var e;await((e=f.value)==null?void 0:e.validate());const o=P();u&&l?await T({new_data:{...o,id:l.id},old_data:l}):await R(o),y("refresh")};return $(),F({onConfirm:g}),(o,e)=>{const E=O,n=L,_=Z,k=B,C=U;return x(),I("div",j,[t(k,{ref_key:"formRef",ref:f,model:a(r),rules:S},{default:i(()=>[t(n,{label:o.$t("Security.Firewall.Forward.form_1"),path:"protocol"},{default:i(()=>[d("div",q,[t(E,{value:a(r).protocol,"onUpdate:value":e[0]||(e[0]=s=>a(r).protocol=s),options:h},null,8,["value"])])]),_:1},8,["label"]),t(n,{label:o.$t("Security.Firewall.Forward.form_2"),path:"s_ports"},{default:i(()=>[d("div",z,[t(_,{value:a(r).s_ports,"onUpdate:value":e[1]||(e[1]=s=>a(r).s_ports=s),placeholder:o.$t("Security.Firewall.Forward.form_3")},null,8,["value","placeholder"])])]),_:1},8,["label"]),t(n,{label:o.$t("Security.Firewall.Forward.form_4"),path:"d_address"},{default:i(()=>[d("div",G,[t(_,{value:a(r).d_address,"onUpdate:value":e[2]||(e[2]=s=>a(r).d_address=s),placeholder:o.$t("Security.Firewall.Forward.form_5")},null,8,["value","placeholder"])])]),_:1},8,["label"]),t(n,{label:o.$t("Security.Firewall.Forward.form_6"),path:"d_ports"},{default:i(()=>[d("div",H,[t(_,{value:a(r).d_ports,"onUpdate:value":e[3]||(e[3]=s=>a(r).d_ports=s),placeholder:o.$t("Security.Firewall.Forward.form_7")},null,8,["value","placeholder"])])]),_:1},8,["label"]),t(n,{label:o.$t("Security.Firewall.Forward.form_8"),path:"brief","show-feedback":!1},{default:i(()=>[d("div",J,[t(_,{value:a(r).brief,"onUpdate:value":e[4]||(e[4]=s=>a(r).brief=s),placeholder:o.$t("Security.Firewall.Forward.form_9")},null,8,["value","placeholder"])])]),_:1},8,["label"])]),_:1},8,["model"]),t(C,{class:"mt-20px ml-40px"},{default:i(()=>[d("li",null,c(o.$t("Security.Firewall.Forward.form_10")),1),d("li",null,c(o.$t("Security.Firewall.Forward.form_11")),1)]),_:1})])}}});export{er as default};
