← Back
Editing: add-area-rule-legacy.js
!function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e=function(){return n};var r,n={},o=Object.prototype,i=o.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},l=u.iterator||"@@iterator",c=u.asyncIterator||"@@asyncIterator",f=u.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(r){s=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),u=new N(n||[]);return a(i,"_invoke",{value:k(t,r,u)}),i}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}n.wrap=p;var y="suspendedStart",d="suspendedYield",m="executing",v="completed",g={};function b(){}function w(){}function j(){}var x={};s(x,l,(function(){return this}));var _=Object.getPrototypeOf,O=_&&_(_(G([])));O&&O!==o&&i.call(O,l)&&(x=O);var E=j.prototype=b.prototype=Object.create(x);function L(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function P(e,r){function n(o,a,u,l){var c=h(e[o],e,a);if("throw"!==c.type){var f=c.arg,s=f.value;return s&&"object"==t(s)&&i.call(s,"__await")?r.resolve(s.__await).then((function(t){n("next",t,u,l)}),(function(t){n("throw",t,u,l)})):r.resolve(s).then((function(t){f.value=t,u(f)}),(function(t){return n("throw",t,u,l)}))}l(c.arg)}var o;a(this,"_invoke",{value:function(t,e){function i(){return new r((function(r,o){n(t,e,r,o)}))}return o=o?o.then(i,i):i()}})}function k(t,e,n){var o=y;return function(i,a){if(o===m)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var l=S(u,n);if(l){if(l===g)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===y)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=m;var c=h(t,e,n);if("normal"===c.type){if(o=n.done?v:d,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=v,n.method="throw",n.arg=c.arg)}}}function S(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,S(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=h(o,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,g):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function D(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function V(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(D,this),this.reset(!0)}function G(e){if(e||""===e){var n=e[l];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function t(){for(;++o<e.length;)if(i.call(e,o))return t.value=e[o],t.done=!1,t;return t.value=r,t.done=!0,t};return a.next=a}}throw new TypeError(t(e)+" is not iterable")}return w.prototype=j,a(E,"constructor",{value:j,configurable:!0}),a(j,"constructor",{value:w,configurable:!0}),w.displayName=s(j,f,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,j):(t.__proto__=j,s(t,f,"GeneratorFunction")),t.prototype=Object.create(E),t},n.awrap=function(t){return{__await:t}},L(P.prototype),s(P.prototype,c,(function(){return this})),n.AsyncIterator=P,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new P(p(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},L(E),s(E,f,"Generator"),s(E,l,(function(){return this})),s(E,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},n.values=G,N.prototype={constructor:N,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(V),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,o){return u.type="throw",u.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(l&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),V(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;V(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:G(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),g}},n}function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){o(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function o(e,r,n){return(r=function(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,r||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function i(t,e,r,n,o,i,a){try{var u=t[i](a),l=u.value}catch(t){return void r(t)}u.done?e(l):Promise.resolve(l).then(n,o)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function u(t){i(a,n,o,u,l,"next",t)}function l(t){i(a,n,o,u,l,"throw",t)}u(void 0)}))}}System.register(["./base-lib-legacy.js?v=VERSION_NUMBER","./utils-lib-legacy.js?v=VERSION_NUMBER","./firewall-legacy.js?v=VERSION_NUMBER","./useMethod-legacy6.js?v=VERSION_NUMBER","./__commonjsHelpers__-legacy.js?v=VERSION_NUMBER","./column-legacy.js?v=VERSION_NUMBER","./index-legacy104.js?v=VERSION_NUMBER","./useStore-legacy5.js?v=VERSION_NUMBER","./validator-legacy.js?v=VERSION_NUMBER"],(function(t,r){"use strict";var o,i,u,l,c,f,s,p,h,y,d,m,v,g,b,w,j,x,_,O,E,L,P,k,S,D,V,N,G;return{setters:[function(t){o=t.c,i=t.r,u=t.p,l=t.G,c=t.q,f=t.M,s=t.A,p=t.e,h=t.x,y=t.v,d=t.a_,m=t.F,v=t.C,g=t.H,b=t.B,w=t.y,j=t.ai,x=t.aj,_=t.a9,O=t.T,E=t.a7},function(t){L=t.T,P=t.K,k=t.k},function(t){S=t.b0,D=t.b1,V=t.b2},function(t){N=t.a,G=t.g},null,null,null,null,null],execute:function(){var r={class:"mt-20px leading-8 text-[1.2rem] list-disc ml-24px"},T={key:0};t("default",o({__name:"add-area-rule",props:{compData:{default:function(){}}},setup:function(t,o){var F=o.expose,I=t,A=i(),C=i(!1),H=i([]),U=i({country:["美国"],brief:"",types:"drop",ports:"",choose:"all",is_update:!1}),q=[{title:"所有端口",key:"all"},{title:"指定端口",key:"point"}],M={country:[{required:!0,message:"请选择国家或地区",trigger:"change"}],ports:[{validator:function(t,e,r){e.length>0&&(L(e)||r(new Error("端口格式错误,可用范围:1-65535")),r()),r(new Error("请输入源端口"))},trigger:["input"]}]},R=function(){var t=a(e().mark((function t(r){var o,i;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,A.value.validate();case 2:return o=n({},U.value),(i=I.compData.isEdit)&&(o.id=I.compData.id,o.addtime=I.compData.addtime,o.country=U.value.country,o.brief=H.value.find((function(t){return t.CH===U.value.country})).brief),"all"===U.value.choose&&(o.ports=""),o={data:JSON.stringify(o)},t.next=9,P({loading:"正在设置规则,请稍后...",request:i?S(o):D(o),message:!0});case 9:r(),I.compData.refreshFn(),N(),G();case 13:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),Y=function(){var t=a(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,P({loading:C,request:V(),data:[Array,H]});case 2:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return u((function(){if(Y(),I.compData.isEdit){var t=I.compData;Object.assign(U.value,{country:t.country,brief:t.brief,types:t.types,ports:t.ports,choose:t.ports?"point":"all"})}})),F({onConfirm:R}),function(t,e){var n=j,o=x,i=_,a=k,u=O,L=E,P=l("bt-loading");return c(),f(L,{ref_key:"editAreaRulesRef",ref:A,model:h(U),rules:M,class:"p-[2rem] addfrom"},{default:s((function(){return[p(i,{label:"策略"},{default:s((function(){return[p(o,{modelValue:h(U).types,"onUpdate:modelValue":e[0]||(e[0]=function(t){return h(U).types=t}),class:"!w-[24rem]"},{default:s((function(){return[p(n,{label:"屏蔽",value:"drop"})]})),_:1},8,["modelValue"])]})),_:1}),p(i,{label:"端口"},{default:s((function(){return[p(o,{modelValue:h(U).choose,"onUpdate:modelValue":e[1]||(e[1]=function(t){return h(U).choose=t}),class:"!w-[24rem]"},{default:s((function(){return[(c(),y(m,null,d(q,(function(t){return p(n,{key:t.key,label:t.title,value:t.key},null,8,["label","value"])})),64))]})),_:1},8,["modelValue"])]})),_:1}),"point"===h(U).choose?(c(),f(i,{key:0,label:"指定端口",prop:"ports"},{default:s((function(){return[p(a,{modelValue:h(U).ports,"onUpdate:modelValue":e[2]||(e[2]=function(t){return h(U).ports=t}),type:"number",min:"1",max:"65535",width:"24rem",placeholder:"请输入指定端口"},null,8,["modelValue"])]})),_:1})):v("",!0),p(i,{label:"地区",prop:"country"},{default:s((function(){return[g((c(),f(o,{modelValue:h(U).country,"onUpdate:modelValue":e[3]||(e[3]=function(t){return h(U).country=t}),class:"!w-[24rem]",multiple:!t.compData.id,filterable:!t.compData.id,"collapse-tags":!t.compData.id},{default:s((function(){return[(c(!0),y(m,null,d(h(H),(function(t){return c(),f(n,{key:t.brief,label:t.CH,value:t.CH},null,8,["label","value"])})),128))]})),_:1},8,["modelValue","multiple","filterable","collapse-tags"])),[[P,h(C)]])]})),_:1}),t.compData.id?v("",!0):(c(),f(i,{key:1,label:" "},{default:s((function(){return[p(u,{modelValue:h(U).is_update,"onUpdate:modelValue":e[4]||(e[4]=function(t){return h(U).is_update=t})},{default:s((function(){return e[5]||(e[5]=[b("更新IP池")])})),_:1},8,["modelValue"])]})),_:1})),w("ul",r,[e[6]||(e[6]=w("li",null,"地区规则中IP数量较多,添加时可能耗时较长",-1)),t.compData.id?v("",!0):(c(),y("li",T,"勾选【更新IP池】会从云端获取指定地区近1个月最新的IP池")),e[7]||(e[7]=w("li",null,"添加【除中国之外】或多个地区时,可能会导致系统防火墙占用高,添加完成后会恢复",-1)),e[8]||(e[8]=w("li",null,"此操作将重载防火墙,未持久化的 iptables 规则会清空,请先备份保存!",-1))])]})),_:1},8,["model"])}}}))}}}))}();
Save File
Cancel