import{_ as B}from"./index-DIKmrNCq.js?v=1773287522785";import{_ as C}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import{_ as E}from"./index-CZps0rIN.js?v=1773287522785";import{z as N,A as T}from"./firewall-jQIxKxfN.js?v=1773287522785";import{k as x,R as O,r as A,e as V,$ as z,Z as D,a0 as l,a9 as n,_ as i,S as r,aa as _}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{a1 as Z,a6 as j,b as q}from"./naive-ui--dJnpVcV.js?v=1773287522785";import"./index-BTglIPU2.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";const G={class:"p-20px"},H={class:"w-200px"},J={class:"w-200px"},K={class:"w-200px"},L={class:"w-200px"},le=x({__name:"form",props:{row:{},isEdit:{type:Boolean,default:!1}},emits:["refresh"],setup(f,{expose:y,emit:b}){const w=f,v=b,{t:p}=O(),{isEdit:d,row:s}=w,m=A(null),e=V({address:"",types:"accept",chain:"INPUT",brief:""}),P={address:{trigger:["blur","input"],validator:()=>e.address.trim()===""||!e.address?new Error(p("Security.Firewall.IP.form_10")):!0}},h=[{label:p("Security.Firewall.IP.form_11"),value:"accept"},{label:p("Security.Firewall.IP.form_12"),value:"drop"}],I=[{label:p("Security.Firewall.IP.form_13"),value:"INPUT"},{label:p("Security.Firewall.IP.form_14"),value:"OUTPUT"}],S=()=>{d&&s&&(e.address=s.Address,e.types=s.Strategy,e.chain=s.Chain,e.brief=s.brief)},F=()=>({address:e.address,types:e.types,strategy:e.types,chain:e.chain,brief:e.brief,family:"ipv4"}),$=async()=>{var t;await((t=m.value)==null?void 0:t.validate());const a=F();d&&s?await N({new_data:{...a,id:s.id},old_data:s}):await T(a),v("refresh")};return S(),y({onConfirm:$}),(a,t)=>{const g=E,u=Z,c=j,U=q,k=C,R=B;return z(),D("div",G,[l(k,{ref_key:"formRef",ref:m,model:r(e),rules:P},{default:n(()=>[l(u,{label:a.$t("Security.Firewall.IP.form_16"),path:"address"},{default:n(()=>[i("div",H,[l(g,{value:r(e).address,"onUpdate:value":t[0]||(t[0]=o=>r(e).address=o),rows:3,disabled:r(d),placeholder:a.$t("Security.Firewall.IP.form_1")},null,8,["value","disabled","placeholder"])])]),_:1},8,["label"]),l(u,{label:a.$t("Security.Firewall.IP.form_2"),path:"types"},{default:n(()=>[i("div",J,[l(c,{value:r(e).types,"onUpdate:value":t[1]||(t[1]=o=>r(e).types=o),options:h},null,8,["value"])])]),_:1},8,["label"]),l(u,{label:a.$t("Security.Firewall.IP.form_3"),path:"chain"},{default:n(()=>[i("div",K,[l(c,{value:r(e).chain,"onUpdate:value":t[2]||(t[2]=o=>r(e).chain=o),options:I},null,8,["value"])])]),_:1},8,["label"]),l(u,{label:a.$t("Security.Firewall.IP.form_4"),path:"brief","show-feedback":!1},{default:n(()=>[i("div",L,[l(U,{value:r(e).brief,"onUpdate:value":t[3]||(t[3]=o=>r(e).brief=o),placeholder:a.$t("Security.Firewall.IP.form_5")},null,8,["value","placeholder"])])]),_:1},8,["label"])]),_:1},8,["model"]),l(R,{class:"mt-20px ml-40px"},{default:n(()=>[i("li",null,_(a.$t("Security.Firewall.IP.form_15")),1),i("li",null,_(a.$t("Security.Firewall.IP.form_8")),1),i("li",null,_(a.$t("Security.Firewall.IP.form_9")),1)]),_:1})])}}});export{le as default};
