import{_ as r}from"./public.js?v=1764233927359";import{_ as e}from"./index.vue_vue_type_script_setup_true_lang.js?v=1764233927359";import{gV as a,gW as l,b6 as o}from"./page_layout.js?v=1764233927359";import{k as t,P as s,r as d,e as i,R as p,V as _,W as u,a3 as c,S as w,U as f,a4 as m}from"./vue.js?v=1764233927359";import{dR as n,dV as v,au as F}from"./naive.js?v=1764233927359";import"./common.js?v=1764233927359";import"./__commonjsHelpers__.js?v=1764233927359";const b={class:"p-20px"},y={class:"w-200px"},S={class:"w-200px"},h={class:"w-200px"},x={class:"w-200px"},$={class:"w-200px"},P=t({__name:"form",props:{row:{},isEdit:{type:Boolean,default:!1}},emits:["refresh"],setup(t,{expose:P,emit:g}){const j=t,U=g,{t:E}=s(),{isEdit:T,row:k}=j,C=d(null),R=i({protocol:"tcp",s_ports:"",d_address:"",d_ports:"",brief:""}),V={s_ports:{trigger:["blur","input"],validator:()=>""!==R.s_ports.trim()&&R.s_ports?!!o(R.s_ports)||new Error(E("Security.Firewall.Forward.form_12")):new Error(E("Security.Firewall.Forward.form_3"))},d_ports:{trigger:["blur","input"],validator:()=>""!==R.d_ports.trim()&&R.d_ports?!!o(R.d_ports)||new Error(E("Security.Firewall.Forward.form_12")):new Error(E("Security.Firewall.Forward.form_7"))}},A=[{label:"TCP",value:"tcp"},{label:"UDP",value:"udp"}];return T&&k&&(R.protocol=k.Protocol?k.Protocol.toLowerCase():"tcp",R.s_ports=k.S_Port||"",R.d_address=k.T_Address||"",R.d_ports=k.T_Port||"",R.brief=k.brief),P({onConfirm:async()=>{var r;await(null==(r=C.value)?void 0:r.validate());const e={protocol:R.protocol,S_Port:R.s_ports,T_Port:R.d_ports,T_Address:R.d_address,brief:R.brief};T&&k?await a({new_data:{...e,id:k.id},old_data:k}):await l(e),U("refresh")}}),(a,l)=>{const o=v,t=n,s=F,d=e,i=r;return _(),p("div",b,[u(d,{ref_key:"formRef",ref:C,model:f(R),rules:V},{default:c(()=>[u(t,{label:a.$t("Security.Firewall.Forward.form_1"),path:"protocol"},{default:c(()=>[w("div",y,[u(o,{value:f(R).protocol,"onUpdate:value":l[0]||(l[0]=r=>f(R).protocol=r),options:A},null,8,["value"])])]),_:1},8,["label"]),u(t,{label:a.$t("Security.Firewall.Forward.form_2"),path:"s_ports"},{default:c(()=>[w("div",S,[u(s,{value:f(R).s_ports,"onUpdate:value":l[1]||(l[1]=r=>f(R).s_ports=r),placeholder:a.$t("Security.Firewall.Forward.form_3")},null,8,["value","placeholder"])])]),_:1},8,["label"]),u(t,{label:a.$t("Security.Firewall.Forward.form_4"),path:"d_address"},{default:c(()=>[w("div",h,[u(s,{value:f(R).d_address,"onUpdate:value":l[2]||(l[2]=r=>f(R).d_address=r),placeholder:a.$t("Security.Firewall.Forward.form_5")},null,8,["value","placeholder"])])]),_:1},8,["label"]),u(t,{label:a.$t("Security.Firewall.Forward.form_6"),path:"d_ports"},{default:c(()=>[w("div",x,[u(s,{value:f(R).d_ports,"onUpdate:value":l[3]||(l[3]=r=>f(R).d_ports=r),placeholder:a.$t("Security.Firewall.Forward.form_7")},null,8,["value","placeholder"])])]),_:1},8,["label"]),u(t,{label:a.$t("Security.Firewall.Forward.form_8"),path:"brief","show-feedback":!1},{default:c(()=>[w("div",$,[u(s,{value:f(R).brief,"onUpdate:value":l[4]||(l[4]=r=>f(R).brief=r),placeholder:a.$t("Security.Firewall.Forward.form_9")},null,8,["value","placeholder"])])]),_:1},8,["label"])]),_:1},8,["model"]),u(i,{class:"mt-20px ml-40px"},{default:c(()=>[w("li",null,m(a.$t("Security.Firewall.Forward.form_10")),1),w("li",null,m(a.$t("Security.Firewall.Forward.form_11")),1)]),_:1})])}}});export{P as default};
