(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["VueFirewall"]=e():t["VueFirewall"]=e()})("undefined"!==typeof self?self:this,(()=>(()=>{"use strict";var t={};(()=>{t.d=(e,r)=>{for(var a in r)t.o(r,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:r[a]})}})(),(()=>{t.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})(),(()=>{t.p=""})();var e={};if(t.d(e,{default:()=>c}),"undefined"!==typeof window){var r=window.document.currentScript,a=r&&r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);a&&(t.p=a[1])}var s=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"shadow-md rounded-lg bg-white dark:bg-neutral-700 overflow-hidden"},[r("div",{staticClass:"flex flex-row flex-auto items-center mb-4 p-3 px-5 border-b-2 border-gray-100 dark:border-neutral-600"},[r("div",{staticClass:"flex-grow"},[r("p",{staticClass:"text-2xl font-medium dark:text-neutral-200"},[t._v(t._s(t.$t("fwFirewall")))])])]),r("table",{staticClass:"table-auto w-[70%] dark:text-neutral-200 mb-4"},[r("thead",[r("tr",[r("th",[t._v(t._s(t.$t("fwInterface")))]),r("th",[t._v(t._s(t.$t("fwIpv4")))]),r("th",[t._v(t._s(t.$t("fwIpv6")))])])]),r("tbody",{staticClass:"text-center"},t._l(t.interfaces,(function(e,a){return r("tr",{key:a},[r("td",[t._v(t._s(e.name))]),r("td",[t._v(t._s(e.ipv4))]),r("td",[t._v(t._s(e.ipv6))])])})),0)]),r("table",{staticClass:"table-auto border-t-2 dark:border-neutral-200 w-full dark:text-neutral-200"},[r("thead",{staticClass:"bg-gray-200 dark:bg-gray-600"},[r("tr",[r("th",[t._v(t._s(t.$t("fwAction")))]),r("th",{staticClass:"border-x-2 dark:border-neutral-200"},[t._v(t._s(t.$t("fwSource")))]),r("th",{staticClass:"border-x-2 dark:border-neutral-200"},[t._v(t._s(t.$t("fwDestination")))]),r("th",{staticClass:"border-x-2 dark:border-neutral-200"},[t._v(t._s(t.$t("fwProtocol")))]),r("th",[t._v(t._s(t.$t("fwTarget")))])])]),r("tbody",{staticClass:"text-center"},[t._l(t.rules,(function(e,a){return r("tr",{key:a},[r("td",{staticClass:"border border-gray-600 p-1 hover:bg-red-800 transition"},[r("button",{on:{click:function(r){return t.deleteRule(e.num)}}},[r("svg",{staticClass:"size-6",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"}},[r("path",{attrs:{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18 18 6M6 6l12 12"}})])])]),r("td",{staticClass:"border border-gray-600 p-1"},[t._v(t._s(e.source))]),r("td",{staticClass:"border border-gray-600 p-1"},[t._v(t._s(e.destination))]),r("td",{staticClass:"border border-gray-600 p-1"},[t._v(t._s(e.protocol))]),r("td",{staticClass:"border border-gray-600 p-1"},[t._v(t._s(e.target))])])})),r("tr",[r("td",{staticClass:"border border-gray-600 p-1 hover:bg-green-600 transition"},[r("form",{attrs:{id:"fw"},on:{submit:t.addRule}},[r("button",{attrs:{type:"submit"}},[r("svg",{staticClass:"size-6",attrs:{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor"}},[r("path",{attrs:{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v6m3-3H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}})])])])]),r("td",{staticClass:"border border-gray-600"},[r("input",{directives:[{name:"model",rawName:"v-model",value:t.newRule.source,expression:"newRule.source"}],staticClass:"w-full outline-none bg-transparent text-center",attrs:{form:"fw",type:"text",name:"source"},domProps:{value:t.newRule.source},on:{input:function(e){e.target.composing||t.$set(t.newRule,"source",e.target.value)}}})]),r("td",{staticClass:"border border-gray-600"},[r("input",{directives:[{name:"model",rawName:"v-model",value:t.newRule.destination,expression:"newRule.destination"}],staticClass:"w-full outline-none bg-transparent text-center",attrs:{form:"fw",type:"text",name:"destination"},domProps:{value:t.newRule.destination},on:{input:function(e){e.target.composing||t.$set(t.newRule,"destination",e.target.value)}}})]),r("td",{staticClass:"border border-gray-600"},[r("select",{directives:[{name:"model",rawName:"v-model",value:t.newRule.protocol,expression:"newRule.protocol"}],staticClass:"bg-transparent",attrs:{form:"fw",name:"protocol"},on:{change:function(e){var r=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){var e="_value"in t?t._value:t.value;return e}));t.$set(t.newRule,"protocol",e.target.multiple?r:r[0])}}},[r("option",{attrs:{value:"tcp"}},[t._v("TCP")]),r("option",{attrs:{value:"udp"}},[t._v("UDP")])])]),r("td",{staticClass:"border border-gray-600 p-1"},[r("select",{directives:[{name:"model",rawName:"v-model",value:t.newRule.target,expression:"newRule.target"}],staticClass:"bg-transparent",attrs:{form:"fw",name:"target"},on:{change:function(e){var r=Array.prototype.filter.call(e.target.options,(function(t){return t.selected})).map((function(t){var e="_value"in t?t._value:t.value;return e}));t.$set(t.newRule,"target",e.target.multiple?r:r[0])}}},[r("option",{attrs:{value:"ACCEPT"}},[t._v("ALLOW")]),r("option",{attrs:{value:"DROP"}},[t._v("BLOCK")])])])])],2)])])},o=[];const n={name:"Firewall",data(){let t=[],e=[],r={source:"",destination:"",protocol:"",target:""};return{interfaces:t,rules:e,newRule:r}},methods:{getInterfaces(){this.api.getInterfaces().then((t=>{this.interfaces=t})).catch((t=>{alert(t.message||t.toString())}))},getRules(){this.api.getRules().then((t=>{this.rules=t})).catch((t=>{alert(t.message||t.toString())}))},addRule(t){t.preventDefault();const{source:e,destination:r,protocol:a,target:s}=this.newRule;this.api.addRule({source:e,destination:r,protocol:a,target:s}).then((()=>{this.getRules()})).then((()=>{this.newRule={source:"",destination:"",protocol:"",target:""}})).catch((t=>{alert(t.message||t.toString())}))},deleteRule(t){this.api.deleteRule({num:t}).then((()=>{this.getRules()})).catch((t=>{alert(t.message||t.toString())}))}},mounted(){this.api=new API,this.getInterfaces(),this.getRules()}},i=n;function l(t,e,r,a,s,o,n,i){var l,d="function"===typeof t?t.options:t;if(e&&(d.render=e,d.staticRenderFns=r,d._compiled=!0),a&&(d.functional=!0),o&&(d._scopeId="data-v-"+o),n?(l=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),s&&s.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(n)},d._ssrRegister=l):s&&(l=i?function(){s.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:s),l)if(d.functional){d._injectStyles=l;var u=d.render;d.render=function(t,e){return l.call(e),u(t,e)}}else{var c=d.beforeCreate;d.beforeCreate=c?[].concat(c,l):[l]}return{exports:t,options:d}}var d=l(i,s,o,!1,null,null,null);const u=d.exports,c=u;return e=e["default"],e})())); //# sourceMappingURL=vue-firewall.umd.min.js.map