define("firewall_url_filter","underscore jquery knockout set service".split(" "),function(g,c,i,b,e){function a(){var n=this;var k=e.getUrlFilterList();var l=[{columnType:"checkbox",rowText:"index",width:"30%"},{headerTextTrans:"url",rowText:"url",width:"70%"}];n.rules=i.observableArray(k.urlFilterRules);n.gridTemplate=new i.simpleGrid.viewModel({data:n.rules(),idName:"index",columns:l,tmplType:"list",pageSize:10});n.clear=f;n.callback=j;n.deleteRule=o;n.addRule=m;function j(p){if(p.result!="success"){errorOverlay()}else{n.clear();d(n);successOverlay();c("#urlFilters").translate()}}function m(){if(n.rules().length>=b.urlFilterMax){showAlert({msg:"url_filter_max",params:b.urlFilterMax});return false}var q=[];for(var p=0;p<n.rules().length;p++){q.push(n.rules()[p].url)}if(c.inArray(c("#addURLFilter").val(),q)!=-1){showAlert("url_repeated");return false}showLoading();var r={goformId:"URL_FILTER_ADD",addURLFilter:c("#addURLFilter").val()};e.addUrlFilterRule(r,n.callback)}function o(){showConfirm("confirm_data_delete",function(){showLoading();var p={goformId:"URL_FILTER_DELETE",url_filter_delete_id:n.gridTemplate.selectedIds().join(";")+";"};e.deleteSelectedRules(p,n.callback)})}}function f(){c("#addURLFilter").val("")}function d(){var j=new a();h(j)}function h(k){var j=c("#container");i.cleanNode(j[0]);i.applyBindings(k,j[0]);c("#urlFilterForm").validate({submitHandler:function(){k.addRule()},rules:{addURLFilter:"url_filter_check"}});c("#urlFilterListForm").validate({submitHandler:function(){k.deleteRule()}})}return{init:d}});define("firewall_upnp_set","underscore jquery knockout set service".split(" "),function(g,b,i,a,d){function e(){var k=this;var j=f();k.upnpSetting=i.observable(j.upnpSetting);k.save=l;function l(){showLoading();var m={};m.upnpSetting=k.upnpSetting();d.setUpnpSetting(m,function(n){if(n.result=="success"){successOverlay()}else{errorOverlay()}})}}function f(){return d.getUpnpSetting()}function c(){var j=new e();h(j)}function h(k){var j=b("#container");i.cleanNode(j[0]);i.applyBindings(k,j[0]);b("#upnpSettingForm").validate({submitHandler:function(){k.save()}})}return{init:c}});define("firewall_port_map","underscore jquery knockout set service".split(" "),function(j,e,k,b,f){var i=j.map(b.MAP_PROTOCOL_MODES,function(l){return new Option(l.name,l.value)});var c=[{columnType:"checkbox",rowText:"index",width:"8%"},{headerTextTrans:"source_port",rowText:"sourcePort",width:"20%"},{headerTextTrans:"dest_ip_address",rowText:"destIpAddress",width:"20%"},{headerTextTrans:"dest_port",rowText:"destPort",width:"20%"},{headerTextTrans:"protocol",rowText:"protocol",width:"12%"},{headerTextTrans:"comment",rowText:"comment",width:"20%"}];function a(){var q=this;var s=h();q.oriPortMapEnable=k.observable(s.portMapEnable);q.rules=k.observableArray(s.portMapRules);q.portMapEnable=k.observable(s.portMapEnable);q.comment=k.observable("");q.selectedMode=k.observable("TCP&UDP");q.modes=k.observableArray(i);q.destPort=k.observable("");q.destIpAddress=k.observable("");q.sourcePort=k.observable("");q.gridTemplate=new k.simpleGrid.viewModel({data:q.rules(),idName:"index",columns:c,tmplType:"list",pageSize:10});q.callback=m;q.deleteMapRules=o;q.checkExist=n;q.enablePortMap=p;q.save=r;function r(){if(q.rules().length>=b.portForwardMax){showAlert({msg:"rules_max",params:b.portForwardMax});return}if(q.checkExist()){showAlert("rule_exist");return}showLoading();var t={};t.portMapEnable=q.portMapEnable();t.sourcePort=q.sourcePort();t.destIpAddress=q.destIpAddress();t.destPort=q.destPort();t.protocol=q.selectedMode();t.comment=q.comment();f.setPortMap(t,q.callback)}function n(){var u={sourcePort:q.sourcePort(),destIpAddress:q.destIpAddress(),destPort:q.destPort(),protocol:transProtocolValue(q.selectedMode())};var w;var v=q.rules();for(var t=0;t<v.length;t++){w={sourcePort:v[t].sourcePort,destIpAddress:v[t].destIpAddress,destPort:v[t].destPort,protocol:v[t].protocol};if(j.isEqual(u,w)){return true}}return false}function p(){showLoading();var t={};t.portMapEnable=q.portMapEnable();f.enablePortMap(t,q.callback)}function o(){var t=q.gridTemplate.selectedIds();if(t.length==0){showAlert("no_data_selected");return}showConfirm("confirm_data_delete",function(){showLoading();var u={};u.indexs=t;f.deleteMapRules(u,q.callback)})}function m(t){if(t.result=="success"){l();d(q);successOverlay()}else{errorOverlay()}}function l(){q.sourcePort("");q.destIpAddress("");q.destPort("");q.selectedMode("TCP&UDP");q.comment("")}}function h(){return f.getPortMap()}function g(m){var l=e("#container");k.cleanNode(l[0]);k.applyBindings(m,l[0])}function d(l){var m;if(l){m=l;var n=h();m.portMapEnable(n.portMapEnable);m.oriPortMapEnable(n.portMapEnable);m.rules(n.portMapRules);m.gridTemplate.clearAllChecked();m.gridTemplate.data(n.portMapRules);refreshTableHeight();renderCheckbox();return}m=new a();g(m);fixTableHeight();e("#mapBasicForm").validate({submitHandler:function(){m.enablePortMap()}});e("#portMapListForm").validate({submitHandler:function(){m.deleteMapRules()}});e("#portMapForm").validate({submitHandler:function(){m.save()},rules:{txtDestIpAddress:{ip_check:true},txtSourcePort:{digits:true,range_except:[1,65000]},txtDestPort:{digits:true,range_except:[1,65000]},txtComment:{comment_check:true}},errorPlacement:function(o,p){if(p.attr("name")=="txtDestIpAddress"){o.appendTo("#txtDestIpAddressErrorDiv")}else{if(p.attr("name")=="txtSourcePort"){o.appendTo("#txtSourcePortErrorDiv")}else{if(p.attr("name")=="txtDestPort"){o.appendTo("#txtDestPortErrorDiv")}else{o.insertAfter(p)}}}}})}return{init:d}});define("firewall_port_forward","underscore jquery knockout set service".split(" "),function(h,d,j,a,f){var g=h.map(a.FORWARD_PROTOCOL_MODES,function(l){return new Option(l.name,l.value)});var b=[{columnType:"checkbox",rowText:"index",width:"8%"},{headerTextTrans:"ip_address",rowText:"ipAddress",width:"23%"},{headerTextTrans:"port_range",rowText:"portRange",width:"23%"},{headerTextTrans:"protocol",rowText:"protocol",width:"23%"},{headerTextTrans:"comment",rowText:"comment",width:"23%"}];function e(){var q=this;var r=k();q.portForwardEnable=j.observable(r.portForwardEnable);q.oriPortForwardEnable=j.observable(r.portForwardEnable);q.portEnd=j.observable("");q.portStart=j.observable("");q.ipAddress=j.observable("");q.comment=j.observable("");q.selectedMode=j.observable("3");q.modes=j.observableArray(g);q.rules=j.observableArray(r.portForwardRules);q.callback=m;q.gridTemplate=new j.simpleGrid.viewModel({data:q.rules(),idName:"index",columns:b,tmplType:"list",pageSize:10});q.checkExist=l;q.save=s;q.deleteForwardRules=o;q.enableVirtualServer=p;function p(){showLoading();var t={};t.portForwardEnable=q.portForwardEnable();f.enableVirtualServer(t,q.callback)}function o(){var t=q.gridTemplate.selectedIds();if(t.length==0){showAlert("no_data_selected");return}showConfirm("confirm_data_delete",function(){showLoading("deleting");var u={};u.indexs=t;f.deleteForwardRules(u,q.callback)})}function s(){if(q.rules().length>=a.portForwardMax){showAlert({msg:"rules_max",params:a.portForwardMax});return}if(q.checkExist()){showAlert("rule_exist");return}showLoading();var t={};t.comment=q.comment();t.protocol=q.selectedMode();t.portEnd=q.portEnd();t.portStart=q.portStart();t.ipAddress=q.ipAddress();f.setPortForward(t,q.callback)}function n(){q.ipAddress("");q.portStart("");q.portEnd("");q.selectedMode("TCP&UDP");q.comment("")}function m(t){if(t.result=="success"){n();c(q);successOverlay()}else{errorOverlay()}}function l(){var u={ipAddress:q.ipAddress(),portRange:q.portStart()+" - "+q.portEnd(),protocol:transProtocolValue(q.selectedMode())};var w;var t=q.rules();for(var v=0;v<t.length;v++){w={ipAddress:t[v].ipAddress,portRange:t[v].portRange,protocol:t[v].protocol};if(h.isEqual(u,w)){return true}}return false}}function k(){return f.getPortForward()}function c(l){var m;if(l){m=l;var n=k();m.gridTemplate.clearAllChecked();m.gridTemplate.data(n.portForwardRules);m.rules(n.portForwardRules);m.portForwardEnable(n.portForwardEnable);m.oriPortForwardEnable(n.portForwardEnable);refreshTableHeight();return}m=new e();i(m);fixTableHeight();renderCheckbox();d("#virtualServerForm").validate({submitHandler:function(){m.enableVirtualServer()}});d("#portForwardListForm").validate({submitHandler:function(){m.deleteForwardRules()}});d("#portForwardForm").validate({submitHandler:function(){m.save()},rules:{txtIpAddress:{ip_check:true},txtPortStart:{digits:true,range:[1,65535],portCompare:"#txtPortEnd"},txtPortEnd:{digits:true,range:[1,65535],portCompare:"#txtPortStart"},txtComment:{comment_check:true}},groups:{range:"txtPortStart txtPortEnd"},errorPlacement:function(o,p){if(p.attr("name")=="txtIpAddress"){o.appendTo("#ipErrorDiv")}else{if(p.attr("name")=="txtPortStart"||p.attr("name")=="txtPortEnd"){o.appendTo("#portRangeErrorDiv")}else{o.insertAfter(p)}}}})}function i(m){var l=d("#container");j.cleanNode(l[0]);j.applyBindings(m,l[0])}return{init:c}});define("firewall_port_filter","underscore jquery knockout set service".split(" "),function(k,g,l,b,h){var d={ICMP:"ICMP",NONE:"None"};var e=[{columnType:"checkbox",rowText:"index",width:"4%"},{headerTextTrans:"mac_address",rowText:"macAddress",width:"12%"},{headerTextTrans:"ip_type",rowText:"ipType",width:"5%",display:b.IPV6_SUPPORT},{headerTextTrans:"source_ip_address",rowText:"sourceIpAddress",width:"12%"},{headerTextTrans:"dest_ip_address",rowText:"destIpAddress",width:"12%"},{headerTextTrans:"protocol",rowText:"protocol",width:"12%",needTrans:true},{headerTextTrans:"source_port_range",rowText:"sourcePortRange",width:"12%"},{headerTextTrans:"dest_port_range",rowText:"destPortRange",width:"12%"},{headerTextTrans:"port_filter_action",rowText:"action",width:"12%",needTrans:true},{headerTextTrans:"comment",rowText:"comment",width:"12%"}];var i=k.map(b.FILTER_PROTOCOL_MODES,function(m){return new Option(m.name,m.value)});function c(){var q=this;var p=a();q.oriDefaultPolicy=l.observable(p.defaultPolicy);q.defaultPolicy=l.observable(p.defaultPolicy);q.oriPortFilterEnable=l.observable(p.portFilterEnable);q.portFilterEnable=l.observable(p.portFilterEnable);q.rules=l.observableArray(p.portFilterRules);q.ipv6Support=l.observable(b.IPV6_SUPPORT);q.comment=l.observable("");q.selectedMode=l.observable("5");q.modes=l.observableArray(i);q.sourcePortEnd=l.observable("");q.sourcePortStart=l.observable("");q.destPortEnd=l.observable("");q.destPortStart=l.observable("");q.destIpv6Address=l.observable("");q.sourceIpv6Address=l.observable("");q.sourceIpAddress=l.observable("");q.destIpAddress=l.observable("");q.macAddress=l.observable("");q.portFilterAction=l.observable("");q.ipType=l.observable("ipv4");q.callback=v;q.gridTemplate=new l.simpleGrid.viewModel({data:q.rules(),idName:"index",columns:e,tmplType:"list",pageSize:20});q.policyChangeHandler=m;q.save=o;q.setPortFilterBasic=t;q.clear=s;q.checkExist=n;q.ipTypeChangeHandler=j;q.protocolChangeHandler=u;q.deleteFilterRules=r;q.policyChangeHandler();function v(w){if(w.result!="success"){errorOverlay()}else{q.clear();f(q);successOverlay()}}function m(){var w=q.defaultPolicy()!="1"?"Drop":"Accept";q.portFilterAction(w);return true}function o(){q.sourceIpAddress(q.sourceIpAddress().replace(/\s+/g,""));q.destIpAddress(q.destIpAddress().replace(/\s+/g,""));q.sourceIpv6Address(q.sourceIpv6Address().replace(/\s+/g,""));q.destIpv6Address(q.destIpv6Address().replace(/\s+/g,""));q.macAddress(q.macAddress().replace(/\s+/g,""));if(q.ipv6Support()==false){if(q.rules().length>=b.portForwardMax){showAlert({msg:"rules_max",params:b.portForwardMax});return}if(q.checkExist()){showAlert("rule_exist");return}}else{var x=q.ipType()=="ipv4"?"IPv4":"IPv6";var w=k.filter(q.rules(),function(y){return y.ipType==x});if(w.length>=b.portForwardMax){showAlert({msg:"rules_max_v4v6",params:[x,b.portForwardMax]});return}if(q.checkExist()){showAlert({msg:"rule_exist_v4v6",params:x});return}}showConfirm("confirm_data_effect",function(){showLoading();var y={};y.macAddress=q.macAddress();if(q.ipv6Support()&&q.ipType()!="ipv6"){y.destIpAddress=q.destIpAddress();y.sourceIpAddress=q.sourceIpAddress()}else{y.destIpAddress=q.destIpv6Address();y.sourceIpAddress=q.sourceIpv6Address()}y.ipType=q.ipType();y.comment=q.comment();y.protocol=q.selectedMode();y.action=q.portFilterAction();y.sourcePortEnd=q.sourcePortEnd();y.sourcePortStart=q.sourcePortStart();y.destPortEnd=q.destPortEnd();y.destPortStart=q.destPortStart();h.setPortFilter(y,q.callback)})}function t(){showLoading();var w={};w.defaultPolicy=q.defaultPolicy();w.portFilterEnable=q.portFilterEnable();h.setPortFilterBasic(w,q.callback)}function s(){q.comment("");q.selectedMode("None");q.sourcePortEnd("0");q.sourcePortStart("0");q.destPortEnd("0");q.destPortStart("0");q.sourceIpv6Address("");q.sourceIpAddress("");q.destIpv6Address("");q.destIpAddress("");q.macAddress("");clearValidateMsg()}function n(){q.macAddress(q.macAddress().toUpperCase());var w=q.ipType().toUpperCase();var x={macAddress:q.macAddress(),destIpAddress:w=="IPV4"?q.destIpAddress():q.destIpv6Address(),sourceIpAddress:w=="IPV4"?q.sourceIpAddress():q.sourceIpv6Address(),destPortRange:q.destPortStart()=="0"?"":q.destPortStart()+" - "+q.destPortEnd(),sourcePortRange:q.sourcePortStart()=="0"?"":q.sourcePortStart()+" - "+q.sourcePortEnd(),action:q.portFilterAction()=="Drop"?"filter_drop":"filter_accept",protocol:transProtocolValue(q.selectedMode()),ipType:w};var A;var z=q.rules();for(var y=0;y<z.length;y++){A={macAddress:z[y].macAddress,destIpAddress:z[y].destIpAddress,sourceIpAddress:z[y].sourceIpAddress,destPortRange:z[y].destPortRange,sourcePortRange:z[y].sourcePortRange,action:z[y].action,protocol:z[y].protocol,ipType:z[y].ipType.toUpperCase()};if(k.isEqual(x,A)){return true}}return false}function u(){if(q.selectedMode()==d.ICMP||q.selectedMode()==d.NONE){q.sourcePortEnd("0");q.sourcePortStart("0");q.destPortEnd("0");q.destPortStart("0");clearValidateMsg("#portRangeArea")}else{q.sourcePortEnd("65535");q.sourcePortStart("1");q.destPortEnd("65535");q.destPortStart("1")}return true}function r(){var w=q.gridTemplate.selectedIds();if(w.length==0){showAlert("no_data_selected");return}showConfirm("confirm_data_effect",function(){showLoading("deleting");var x={};x.indexs=w;h.deleteFilterRules(x,q.callback)})}}function a(){return h.getPortFilter()}function j(){clearValidateMsg();return true}function f(n){var o;if(n){o=n;var p=a();o.gridTemplate.clearAllChecked();o.gridTemplate.data(p.portFilterRules);o.defaultPolicy(p.defaultPolicy);o.oriDefaultPolicy(p.defaultPolicy);o.portFilterEnable(p.portFilterEnable);o.oriPortFilterEnable(p.portFilterEnable);o.rules(p.portFilterRules);refreshTableHeight();g("#portFilters").find("tbody").translate();renderCheckbox();g(".notes-content").translate();return}o=new c();var m=g("#container");l.cleanNode(m[0]);l.applyBindings(o,m[0]);fixTableHeight();g("#filterBasicForm").validate({submitHandler:function(){showConfirm("confirm_data_effect",function(){o.setPortFilterBasic()})}});g("#portFilterListForm").validate({submitHandler:function(){o.deleteFilterRules()}});g("#portFilterForm").validate({submitHandler:function(){o.save()},rules:{txtMacAddress:{filter_optional:true,mac_check:true},txtDestIpAddress:{ip_check:true},txtSourceIpAddress:{ip_check:true},txtSourceIpv6Address:{ipv6:true},txtDestIpv6Address:{ipv6:true},txtDestPortStart:{digits:true,range:[1,65535],portCompare:"#txtDestPortEnd"},txtDestPortEnd:{digits:true,range:[1,65535],portCompare:"#txtDestPortStart"},txtSourcePortStart:{digits:true,range:[1,65535],portCompare:"#txtSourcePortEnd"},txtSourcePortEnd:{digits:true,range:[1,65535],portCompare:"#txtSourcePortStart"},txtComment:{comment_check:true}},groups:{destPort:"txtDestPortStart txtDestPortEnd",sourcePort:"txtSourcePortStart txtSourcePortEnd"},errorPlacement:function(q,r){if(r.attr("name")=="txtMacAddress"){q.appendTo("#macErrorDiv")}else{if(r.attr("name")=="txtDestPortStart"||r.attr("name")=="txtDestPortEnd"){q.appendTo("#destPortErrorDiv")}else{if(r.attr("name")=="txtSourcePortStart"||r.attr("name")=="txtSourcePortEnd"){q.appendTo("#sourcePortErrorDiv")}else{q.insertAfter(r)}}}}})}g.validator.addMethod("filter_optional",function(p,o,q){var m=k.any(["#txtMacAddress","#txtDestIpAddress","#txtSourceIpAddress","#txtSourceIpv6Address","#txtDestIpv6Address"],function(s){var r=g(s).val().replace(/\s+/g,"");return g(s+":visible").length>0&&r!=""});var n=k.any(["#txtDestPortStart","#txtDestPortEnd","#txtSourcePortStart","#txtSourcePortEnd"],function(r){return g(r).val()!="0"});return m||n});return{init:f}});define("firewall_parental_control","underscore jquery knockout set service".split(" "),function(u,g,d,s,v){var j=10;var h=null;var b={MAIN:0,MANAGE:1,RULE:2};function r(){var S=this;var Q=v.getHostNameList({}).devices;S.currentPage=d.observable(b.MAIN);S.pages=b;S.childGroupList=d.observable([]);S.childGroupMac=d.computed(function(){return u.map(S.childGroupList(),function(U){return U.mac})});S.currentUserInChildGroup=d.observable(true);S.fetchChildGroupList=F;S.fetchChildGroupList();S.manageHandler=E;function E(){S.currentPage(b.MANAGE);S.fetchAttachedDevices()}S.attachedDevices=d.observable([]);S.fetchAttachedDevices=N;S.backToMainHandler=P;d.computed(function(){S.attachedDevices();S.childGroupList();g("#pc_children_group_form").translate()}).extend({notify:"always",throttle:300});function J(U,V){showLoading();v.addChildGroup(V,function(W){S.fetchChildGroupList(function(){S.fetchAttachedDevices(function(){hideLoading();if(U){v.logout({},function(){window.location="index.html"})}})})},function(W){errorOverlay()})}S.removeChildGroupHandler=O;S.addChildGroupHandler=H;S.dealElement=n;S.cancelEditHostNameHandler=G;S.saveHostNameHandler=z;S.editHostNameHandler=I;S.selectedIds=d.observableArray([]);S.siteList=d.observable([]);S.disableAdd=d.computed(function(){return S.siteList().length==j});d.computed(function(){S.siteList();S.selectedIds();setTimeout(function(){renderCheckbox()},100);g("#pc_site_white_list_form").translate()});S.openAddSitePopoverHandler=D;S.checkboxClickHandler=M;S.fetchSiteWhiteList=L;function K(U){showConfirm("confirm_data_delete",function(){showLoading();v.removeSiteWhite({ids:U},function(V){S.fetchSiteWhiteList(function(){successOverlay()})},function(V){S.fetchSiteWhiteList(function(){errorOverlay()})})})}S.removeAllWhiteSite=B;S.removeSelectedWhiteSite=T;S.removeWhiteSite=R;S.saveSiteWhite=x;S.notSave=d.observable(false);S.fetchTimeLimited=o;S.bindEvent=y;S.saveTimeLimitedHandler=w;var A=false;S.openRulePage=C;function C(){if(S.currentPage()==b.RULE){return}S.currentPage(b.RULE);S.currentUserInChildGroup(v.checkCurrentUserInChildGroup().result);t();if(!A){if(!S.currentUserInChildGroup()){S.bindEvent()}A=true}showLoading();S.fetchTimeLimited();S.fetchSiteWhiteList(function(){hideLoading()})}function F(U){v.childGroupList({},function(V){S.currentUserInChildGroup(v.checkCurrentUserInChildGroup(V.devices).result);S.childGroupList([]);u.map(V.devices,function(X,W){X.idx=W;X.hostname=e.getHostName(X.hostname,X.mac,Q)});S.childGroupList(V.devices);if(u.isFunction(U)){U.apply(this)}})}function N(U){S.attachedDevices([]);var V=0;var W=[];v.getAttachedCableDevices({},function(X){V++;var Y=u.map(X.attachedDevices,function(Z){Z.idx=u.uniqueId("wireless_");Z.hostName=e.getHostName(Z.hostName,Z.macAddress,Q);Z.inChildGroup=u.contains(S.childGroupMac(),Z.macAddress);return Z});if(V!=1){S.attachedDevices(u.flatten([W,Y]));if(u.isFunction(U)){U.apply(this)}}else{W=Y}});v.getCurrentlyAttachedDevicesInfo({},function(X){V++;var Y=u.map(X.attachedDevices,function(Z){Z.idx=u.uniqueId("wireless_");Z.hostName=e.getHostName(Z.hostName,Z.macAddress,Q);Z.inChildGroup=u.contains(S.childGroupMac(),Z.macAddress);return Z});if(V!=1){S.attachedDevices(u.flatten([W,Y]));if(u.isFunction(U)){U.apply(this)}}else{W=Y}})}function P(){S.currentPage(b.MAIN)}function O(U){showLoading();v.removeChildGroup(U,function(V){S.fetchChildGroupList(function(){S.fetchAttachedDevices(function(){hideLoading()})})},function(V){errorOverlay()})}function H(U){var V=v.getCurretnMAC();if(V!=U.macAddress){J(false,U)}else{showConfirm("parental_add_self",function(){J(true,U)})}}function G(U){S.dealElement(false,U.idx)}function z(X){var V=g("#hostname_input_"+X.idx);var U=g.trim(V.val());if(U.indexOf(" ")==0||U.lastIndexOf(" ")==(U.length-1)||/[\*\+\$\[&:,;<>'"\\`\]￥]{1,32}/.test(U)){showAlert("modify_hostname_invalid");return false}else{if(U==""){g(".promptErrorLabel","#confirm-message-container").text(g.i18n.prop("required"));var W=V.closest("td").addClass("has-error");addTimeout(function(){W.removeClass("has-error")},5000);showAlert("required");return false}}showLoading();X.hostname=U;v.editHostName(X,function(){v.getHostNameList({},function(Y){Q=Y.devices;S.fetchChildGroupList(function(){hideLoading()});S.fetchAttachedDevices()})},function(){errorOverlay()})}function I(U){g("#hostname_input_"+U.idx).val(U.hostname);S.dealElement(true,U.idx);return false}function D(){var U=g("#addNewSiteTmpl").html();popover.open({target:g("#openAddSiteBtn"),html:U,width:"300px",validation:m})}function M(V,U){addTimeout(function(){S.selectedIds(k())},100)}function L(U){v.getSiteWhiteList({},function(V){S.selectedIds([]);S.siteList(V.siteList);u.isFunction(U)&&U.apply(this)},function(){S.siteList([]);u.isFunction(U)&&U.apply(this)})}function B(){K(q())}function T(){K(k())}function R(V,U){K([V.id])}function x(W,V){popover.hide();var U=u.find(S.siteList(),function(X){return X.site==V});if(U){showAlert("pc_link_exist",function(){setTimeout(function(){popover.show()},200)});return false}showLoading();v.saveSiteWhite({name:W,site:V},function(){S.fetchSiteWhiteList(function(){popover.close();successOverlay()})},function(){S.fetchSiteWhiteList(function(){errorOverlay();popover.show()})})}function y(){g("td:not('.col-head')","#pc_time_limited_tbody").addClass("cursorhand").die().click(function(){S.notSave(true);g(this).toggleClass("active")}).hover(function(){var W=g(this);var U=W.data("week");var V=W.data("hour");g("tr:nth-child("+(U+1)+") td:first-child","#pc_time_limited_tbody").addClass("time_td_hover");g("#col_"+V).addClass("time_td_hover");if(W.not(".active")){W.addClass("time_td_hover")}},function(){var W=g(this);var U=W.data("week");var V=W.data("hour");g("tr:nth-child("+(U+1)+") td:first-child","#pc_time_limited_tbody").removeClass("time_td_hover");g("#col_"+V).removeClass("time_td_hover");W.removeClass("time_td_hover")})}function w(){showLoading();var U=a();var V=f(U);v.saveTimeLimited({time:V},function(){S.notSave(false);successOverlay()},function(){errorOverlay()})}}function n(x,w){if(x==false){g("#edit_btn_"+w+",#hostname_txt_"+w).show();g("#save_btn_"+w+",#cancel_btn_"+w+",#hostname_input_"+w).hide()}else{g("#edit_btn_"+w+",#hostname_txt_"+w).hide();g("#save_btn_"+w+",#cancel_btn_"+w+",#hostname_input_"+w).show()}}function o(){v.getTimeLimited({},function(x){for(var y in x){for(var w=0;w<x[y].length;w++){var z="td_"+y+"_"+x[y][w];g("#"+z).addClass("active")}}},function(){})}var e={getHostName:function(z,y,x){var w=u.find(x,function(A){return A.mac==y});return w?w.hostname:z}};function p(w){var x=[];g(":checkbox"+(w?":checked":""),"#pb_white_list").each(function(y,z){x.push(z.value)});return x}function k(){return p(true)}function q(){return p(false)}function m(){g("#whiteSiteAddForm").validate({submitHandler:function(){var x=g("#siteName").val();var w=g("#siteLink").val();h.saveSiteWhite(x,w)},rules:{siteName:"siteName_check",siteLink:"siteLink_check"}})}function f(z){var x="";for(var y in z){var w=u.sortBy(z[y],function(A){return A});if(z[y].length){x+=y+"+";x+=w.join(",");x+=";"}}return x.substring(0,x.length-1)}function a(){var w={"0":[],"1":[],"2":[],"3":[],"4":[],"5":[],"6":[]};g("td.active","#pc_time_limited_tbody").each(function(z,B){var A=g(B);var y=A.data("week");var x=A.data("hour");w[y].push(x)});return w}function i(w){if(w<=16){return w+7}else{return w-17}}function t(){g("tr","#pc_time_limited_tbody").each(function(w,y){var x=g(y);g("td:not(:first)",x).each(function(B,z){var C=g(z);var A=i(B);C.attr({id:"td_"+w+"_"+A}).data({week:w,hour:A})})});g("td.active","#pc_time_limited_tbody").removeClass("active");g("thead td:not(:first)","#pc_time_limited_form").each(function(w,y){var x=i(w);g(y).attr({id:"col_"+x})});h.notSave(false)}function c(){h=new r();l(h)}function l(x){var w=g("#container");d.cleanNode(w[0]);d.applyBindings(x,w[0])}return{init:c}});define("firewall_dmz_set","underscore jquery knockout set service".split(" "),function(h,d,j,a,f){function c(){var k=this;var m=e();k.dmzSetting=j.observable(m.dmzSetting);k.ipAddress=j.observable(m.ipAddress);k.isDataCard=a.PRODUCT_TYPE=="DATACARD";k.clear=g;k.save=l;function l(){showLoading();var n={};n.dmzSetting=k.dmzSetting();n.ipAddress=k.ipAddress();f.setDmzSetting(n,function(o){if(o.result!="success"){errorOverlay()}else{k.clear();successOverlay()}})}}function g(){b()}function e(){return f.getDmzSetting()}function b(){var k=new c();i(k)}function i(l){var k=d("#container");j.cleanNode(k[0]);j.applyBindings(l,k[0]);d("#dmzSettingForm").validate({submitHandler:function(){l.save()},rules:{txtIpAddress:"dmz_ip_check"}})}return{init:b}});define("firewall","underscore jquery knockout set service".split(" "),function(e,g,d,c,b){function h(){var j=this;j.hasDdns=c.DDNS_SUPPORT;j.hasUpdateCheck=c.HAS_UPDATE_CHECK;j.hasUrlFilter=c.HAS_URL;var i=checkCableMode(b.getOpMode().blc_wan_mode);var k=b.getExtraFunc();j.bandSelectFuncEnable=d.observable(k.bandSelectFuncEnable);if(j.bandSelectFuncEnable()=="2"&&!i){g(".bandSelect").attr("id","rootBandSelect")}else{if(j.bandSelectFuncEnable()=="1"&&!i){g(".bandSelect").attr("id","bandSelect")}else{g(".bandSelect").attr("id","removeBandSelect");g("#removeBandSelect").css("display","none")}}j.hasUpnp=c.HAS_UPNP}function a(){var k=new h();f(k);var j=b.getPassword().CurrentPasswd;var i=b.getPassword().RootPasswd;if(j!=i&&j!="xfnj1234"){g("#rootBandSelect").css("display","none")}}function f(j){var i=g("#container");d.cleanNode(i[0]);d.applyBindings(j,i[0])}return{init:a}});define("ddns","underscore jquery knockout set service".split(" "),function(j,e,k,b,f){var i=j.map(b.DDNSSetMode,g);var h=j.map(b.DDNSDDP,g);var c=j.map(b.ddns_Modeselect,g);function g(l){return new Option(l.name,l.value)}function a(){var r=this;r.hasUpdateCheck=b.HAS_UPDATE_CHECK;var q=f.getDdnsParams();r.ddnsSetModes=k.observableArray(i);r.ddnsProviderList=k.observableArray(h);r.ddns_mode_select=k.observableArray(c);r.currentMode=k.observable(q.DDNS_Enable);r.currentModeselect=k.observable(q.DDNS_Mode);r.currentProviderList=k.observable("dyndns.org");e.each(b.DDNSDDP,function(w,x){if(q.DDNSProvider==x.value){r.currentProviderList(q.DDNSProvider)}});r.DDNSaccount=k.observable(q.DDNSAccount);r.DDNSpasswd=k.observable(q.DDNSPassword);r.DDNSname=k.observable(q.DDNS);r.DDNS_HashValue=k.observable(q.DDNS_Hash_Value);r.isddnsStatusTrans=k.observable();r.isEnableSet=k.observable();r.isHashValue=k.observable();r.isddnsaccount=k.observable();r.isddnspasswd=k.observable();r.isDDNSStatus=k.observable();r.isddnsdomainName=k.observable();r.isNone=k.observable();r.onStates=k.observable();r.showPassword_ddns=k.observable(false);var n=checkCableMode(f.getOpMode().blc_wan_mode);var o=f.getExtraFunc();r.bandSelectFuncEnable=k.observable(o.bandSelectFuncEnable);if(r.bandSelectFuncEnable()=="2"&&!n){e(".bandSelect").attr("id","rootBandSelect")}else{if(r.bandSelectFuncEnable()=="1"&&!n){e(".bandSelect").attr("id","bandSelect")}else{e(".bandSelect").attr("id","removeBandSelect");e("#removeBandSelect").css("display","none")}}r.showPasswordHandler_ddns=p;t();r.changeDdnsProvider=l;s();r.changeSetDdnsMode=m;v();r.apply=u;function v(){var w="";e.getJSON("/goform/goform_get_cmd_process",{cmd:"getddns_status",_:new Date().getTime()},function(x){if(x.getddns_status=="0"){w="register successful";r.onStates(true)}else{if(x.getddns_status=="1"){w="login error";r.onStates(true)}else{if(x.getddns_status=="2"){w="network error";r.onStates(true)}else{if(x.getddns_status=="3"){w="registering";r.onStates(true)}else{if(x.getddns_status=="4"){w="not registered";r.onStates(true)}else{if(x.getddns_status=="5"){w="error registering";r.onStates(true)}else{if(x.getddns_status=="-1"){w="";r.onStates(true)}}}}}}}r.isddnsStatusTrans(e.i18n.prop(w));addTimeout(v,2000)})}function s(){if(r.currentMode()!="1"){r.isEnableSet(false)}else{r.isEnableSet(true)}return true}function m(){s()}function p(){e("#ddns_secretcode_input").parent().find(".error").hide();var w=e("#showPassword_ddns:checked");if(w&&w.length==0){r.showPassword_ddns(true)}else{r.showPassword_ddns(false)}}function l(){if(q.DDNSProvider!=r.currentProviderList()){r.DDNSaccount("");r.DDNSpasswd("");r.DDNSname("")}else{r.DDNSaccount(q.DDNSAccount);r.DDNSpasswd(q.DDNSPassword);r.DDNSname(q.DDNS)}t()}function t(){if(r.currentProviderList()!="none"){r.isddnsaccount(true);r.isddnspasswd(true);r.isddnsdomainName(true);r.isHashValue(true);r.isDDNSStatus(true)}else{r.isddnsaccount(false);r.isddnspasswd(false);r.isddnsdomainName(false);r.isHashValue(false);r.isDDNSStatus(false)}if(r.currentProviderList()!="freedns.afraid.org"){r.isHashValue(false)}else{r.isHashValue(true)}return true}function u(){showLoading();var w={};w.goformId="DDNS";w.DDNS_Enable=r.currentMode();if(r.currentMode()=="1"){w.DDNS_Mode=r.currentModeselect();w.DDNSProvider=r.currentProviderList();if(r.currentProviderList()!="none"){w.DDNS=r.DDNSname();w.DDNSPassword=r.DDNSpasswd();w.DDNSAccount=r.DDNSaccount()}if(r.currentProviderList()=="freedns.afraid.org"){w.DDNS_Hash_Value=r.DDNS_HashValue()}}f.setDDNSForward(w,function(x){if(x.result=="success"){successOverlay();q=f.getDdnsParams()}else{errorOverlay()}})}}function d(){var l=e("#container");k.cleanNode(l[0]);var n=new a();k.applyBindings(n,l[0]);var o=f.getPassword().CurrentPasswd;var m=f.getPassword().RootPasswd;if(o!=m&&o!="xfnj1234"){e("#rootBandSelect").css("display","none")}e("#ddnsForm").validate({submitHandler:function(){n.apply()},rules:{ddns_secretcode_input:"secretcode_check",DDNS_Hash_Value:"ddns_hashvalue_check",ddns_secretcode_inputshow:"secretcode_check"},errorPlacement:function(p,q){var r=q.attr("id");if(r=="ddns_secretcode_input"||r=="ddns_secretcode_inputshow"){p.insertAfter("#lblShowPassword")}else{p.insertAfter(q)}}})}return{init:d}});define("network_net_select","underscore jquery knockout set service".split(" "),function(k,f,m,a,h){var c=k.map(a.AUTO_MODES,function(n){return new Option(n.name,n.value)});function i(){var w=this;w.networkList=m.observableArray([]);w.selectNetwork=m.observable("");w.enableFlag=m.observable(true);w.types=m.observableArray(c);w.selectedType=m.observable();w.selectMode=m.observable();w.networkText=B;w.networkStatusId=n;w.networkStatus=y;w.subnetworkType=x;w.networkType=z;w.operatorName=p;w.networkValue=v;w.networkTypeId=u;w.subnetTypeId=A;w.search=s;w.save=o;w.checkEnable=t;w.register=r;w.checkEnable();var q=b();if("manual_select"==q.net_select_mode||"manual_select"==q.m_netselect_save){w.selectMode("manual_select")}else{w.selectMode("auto_select")}w.selectedType(q.net_select);function r(){showLoading("registering_net");var C=w.selectNetwork().split(",");h.setNetwork(C[0],parseInt(C[1]),parseInt(C[2]),function(D){if(D){w.networkList([]);var E=b();w.selectedType(E.net_select);successOverlay()}else{errorOverlay()}})}function t(){var C=h.getStatusInfo();if(C.connectStatus=="ppp_connected"||C.connectStatus=="ppp_connecting"){w.enableFlag(false)}else{w.enableFlag(true)}}function o(){showLoading();var C={};C.strBearerPreference=w.selectedType();h.setBearerPreference(C,function(D){if(D.result=="success"){w.networkList([]);successOverlay()}else{errorOverlay()}})}function s(){showLoading("searching_net");h.scanForNetwork(function(C,E){hideLoading();if(C){w.networkList(E);for(var D=0;D<E.length;D++){var F=E[D];if(F.nState=="2"){w.selectNetwork(F.strNumeric+","+F.nRat+","+F.SubAct);return}}}else{w.networkList([])}})}function A(C){return g(C.nRat,C.SubAct)}function u(C){return e(C.nRat)}function v(D){var C=[];C.push(D.strNumeric);C.push(D.nRat);C.push(D.SubAct);return C.join(",")}function p(C){return C.strShortName}function z(D){var C=e(D.nRat);if(C=="auto"){C=f.i18n.prop("auto")}return C}function x(D){var C=g(D.nRat,D.SubAct);return C}function y(C){return f.i18n.prop(j(C.nState))}function n(C){return j(C.nState)}function B(C){return C.strNumeric}}function b(){return h.getNetSelectInfo()}function j(n){if("3"==n){return"forbidden"}else{if("2"==n){return"current"}else{if("1"==n){return"available"}else{if("0"==n){return"unknown"}}}}}function g(o,n){var p=[2,4,5,6,8];if("1"==n){if("7"==o){n="FDD-LTE"}else{if(f.inArray(o,p)!=-1){n="WCDMA"}else{n="GSM"}}}else{if("0"==n){if("7"==o){n="TD-LTE"}else{if(f.inArray(o,p)!=-1){n="TD-SCDMA"}else{n="GSM"}}}else{n=""}}return n}function e(n){if("7"==n){return"4G"}else{if("2"==n){return"3G"}else{if("0"==n){return"2G"}else{return"auto"}}}}function l(o){var n=f("#container");m.cleanNode(n[0]);m.applyBindings(o,n[0])}function d(){var n=new i();l(n);addInterval(n.checkEnable,1000)}return{init:d}});define("locknet","jquery knockout service set main".split(" "),function(f,d,b,c,g){function a(){var h=f("#container")[0];d.cleanNode(h);var i=new e();d.applyBindings(i,h);f("#frmNetworkLock").validate({submitHandler:function(){i.unlock()},rules:{txtLockNumber:"unlock_code_check"}})}function e(){var n=this;var k=false;n.isCPE=c.PRODUCT_TYPE=="CPE";n.hasRj45=c.RJ45_SUPPORT;n.hasSms=c.HAS_SMS;n.hasPhonebook=c.HAS_PHONEBOOK;n.isSupportSD=c.SD_CARD_SUPPORT;if(c.WIFI_SUPPORT_QR_SWITCH==false){n.showQRCode=c.WIFI_SUPPORT_QR_CODE}else{var j=b.getWifiBasic();n.showQRCode=c.WIFI_SUPPORT_QR_CODE&&j.show_qrcode_flag}if(c.WIFI_SUPPORT_QR_CODE){n.qrcodeSrc="./pic/qrcode_ssid_wifikey.png?_="+f.now()}else{n.qrcodeSrc="./pic/res_blacktrans.png"}n.hasParentalControl=d.observable(c.HAS_PARENTAL_CONTROL&&k);n.deviceInfo=d.observable([]);n.isHomePage=d.observable(false);if(window.location.hash=="#main"){n.isHomePage(true)}n.supportUnlock=c.NETWORK_UNLOCK_SUPPORT;n.unlockCode=d.observable();var m=b.getNetworkUnlockTimes();n.times=d.observable(m.unlock_nck_time);n.showOpModeWindow=l;n.isLoggedIn=d.observable(false);n.enableFlag=d.observable(false);n.unlock=i;n.refreshOpmodeInfo=h;if(n.hasRj45){n.refreshOpmodeInfo();addInterval(function(){n.refreshOpmodeInfo()},1000)}function h(){var q=b.getStatusInfo();n.isLoggedIn(q.isLoggedIn);if(!k&&checkCableMode(q.blc_wan_mode)){window.location.reload();return}k=checkCableMode(q.blc_wan_mode);n.hasParentalControl(c.HAS_PARENTAL_CONTROL&&k);if(k&&q.ethWanMode.toUpperCase()=="DHCP"){n.enableFlag(true)}else{if((!k&&q.connectStatus!="ppp_disconnected")||(k&&q.rj45ConnectStatus!="idle"&&q.rj45ConnectStatus!="dead")){n.enableFlag(false)}else{n.enableFlag(true)}}var o=(q.blc_wan_mode=="AUTO_PPP"||q.blc_wan_mode=="AUTO_PPPOE")?"AUTO":q.blc_wan_mode;var p="";switch(o){case"PPP":p="opmode_gateway";break;case"PPPOE":p="opmode_cable";break;case"AUTO":p="opmode_auto";break;default:break}f("#opmode").attr("data-trans",p).text(f.i18n.prop(p))}function i(){showLoading();b.unlockNetwork({unlock_network_code:n.unlockCode()},function(o){n.unlockCode("");if(o&&o.result=="success"){successOverlay();if(window.location.hash=="#main"){setTimeout(function(){window.location.reload()},500)}else{window.location.hash="#main"}}else{var p=b.getNetworkUnlockTimes();n.times(p.unlock_nck_time);errorOverlay()}})}function l(){showSettingWindow("change_mode","opmode_popup","opmode_popup",400,300,function(){})}}return{init:a}});define("network_dial_set_cpe","underscore jquery knockout set service".split(" "),function(q,e,a,o,s){var g=q.map(o.dialActions,function(t){return new Option(t.name,t.value)});var m=q.map(o.pppoeModes,function(t){return new Option(t.name,t.value)});var p=0;var k=0;var j=false;function c(){var E=s.getPppoeParams();var F=E;var A=this;A.staticNoticeShow=a.observable();A.dhcpNoticeShow=a.observable();A.pppoeNoticeShow=a.observable();A.autoNoticeShow=a.observable();A.staticNotice=a.observable();A.dhcpNotice=a.observable();A.pppoeNotice=a.observable();A.autoNotice=a.observable();A.dhcpNoticeText=a.observable();A.staticNoticeText=a.observable();A.pppoeNoticeText=a.observable();A.autoNoticeText=a.observable();A.currentMode=a.observable(E.ethwan_mode);A.showPassword=a.observable(false);A.modes=a.observableArray(m);A.isPppoeMode=a.observable(false);A.isStaticMode=a.observable(false);A.isAutoMode=a.observable(false);A.action=a.observable();A.btnTrans=a.observable();A.enableFlag=a.observable();A.isShowDisbtn=a.observable();A.isShowCancelbtn=a.observable();if(E.rj45_state=="dead"){D()}else{if(E.rj45_state=="connect"){j=true;x("connect")}else{if(E.rj45_state=="working"){y()}}}A.user=a.observable(E.pppoe_username);A.password=a.observable(E.pppoe_cc);A.autoUser=a.observable(E.pppoe_username);A.autoPassword=a.observable(E.pppoe_cc);A.pppMode=a.observable(E.ethwan_dialmode);C();A.changeModeDiv=t;A.radioHandler=w;A.primaryDNS=a.observable(E.static_wan_primary_dns);A.secondaryDNS=a.observable(E.static_wan_secondary_dns);A.ipAddress=a.observable(E.static_wan_ipaddr);A.subnetMask=a.observable(E.static_wan_netmask);A.defaultGateway=a.observable(E.static_wan_gateway);addInterval(function(){F=s.getPppoeParams();E.rj45_state=F.rj45_state;C()},1000);A.cancelConnect=v;A.save=u;A.showPasswordHandler=function(){var G=e("#showPassword:checked");if(G&&G.length==0){A.showPassword(true)}else{A.showPassword(false)}};function C(){D();if(A.currentMode()=="PPPOE"){A.isPppoeMode(true);A.isStaticMode(false);A.isAutoMode(false);A.staticNoticeShow(false);A.dhcpNoticeShow(false);A.autoNoticeShow(false)}else{if(A.currentMode()=="AUTO"){A.isStaticMode(false);A.isPppoeMode(false);A.isAutoMode(true);A.dhcpNoticeShow(false);A.pppoeNoticeShow(false);A.staticNoticeShow(false)}else{if(A.currentMode()=="STATIC"){A.isStaticMode(true);A.isPppoeMode(false);A.isAutoMode(false);A.dhcpNoticeShow(false);A.pppoeNoticeShow(false);A.autoNoticeShow(false)}else{A.isStaticMode(false);A.isPppoeMode(false);A.isAutoMode(false);A.staticNoticeShow(false);A.pppoeNoticeShow(false);A.autoNoticeShow(false)}}}if(F.ethwan_dialmode!="auto_dial"&&(E.rj45_state=="working"||E.rj45_state=="connect")){A.enableFlag(false)}else{A.enableFlag(true)}if(E.rj45_state=="connect"){if(A.pppMode()=="auto_dial"){A.action("connect")}else{A.action("disconnect")}}else{if(E.rj45_state=="working"){A.action("disconnect")}else{A.action("connect")}}if(A.pppMode()!="auto_dial"&&A.currentMode()==F.ethwan_mode){A.btnTrans("connect")}else{A.btnTrans("apply")}if(E.rj45_state!="idle"){e("#pppoeApply").attr("disabled",true)}else{e("#pppoeApply").attr("disabled",false)}A.isShowDisbtn(A.pppMode()!="auto_dial"&&E.rj45_state=="working");A.isShowCancelbtn(A.pppMode()!="auto_dial"&&E.rj45_state=="connect");e("#pppoeApply").translate()}function x(G){p&&window.clearInterval(p);if("connect"!=G){p=addInterval(function(){z()},2000)}else{if(A.currentMode()=="PPPOE"){A.pppoeNoticeShow(true);A.pppoeNotice("pppoe_processing");A.pppoeNoticeText(e.i18n.prop("pppoe_processing"))}else{if(A.currentMode()=="STATIC"){A.staticNoticeShow(true);A.staticNotice("static_processing");A.staticNoticeText(e.i18n.prop("static_processing"))}else{if(A.currentMode()=="DHCP"){A.dhcpNoticeShow(true);A.dhcpNotice("dyn_processing");A.dhcpNoticeText(e.i18n.prop("dyn_processing"))}else{A.autoNoticeShow(true);A.autoNotice("auto_processing");A.autoNoticeText(e.i18n.prop("auto_processing"))}}}p=addInterval(function(){B()},2000)}}function B(){if(k<1){k++;return}if(E.rj45_state=="connect"){if(A.currentMode()!=F.ethwan_mode){if(A.currentMode()=="AUTO"){A.autoNoticeShow(true)}else{if(A.currentMode()=="PPPOE"){A.pppoeNoticeShow(true)}else{if(A.currentMode()=="STATIC"){A.staticNoticeShow(true)}else{if(A.currentMode()=="DHCP"){A.dhcpNoticeShow(true)}}}}}if(k>6){if(j==false){j=true;showAlert("ussd_operation_timeout")}}k++}else{if(E.rj45_state=="working"){hideLoading();y();window.clearInterval(p)}else{if(E.rj45_state=="dead"){hideLoading();D();window.clearInterval(p)}else{if(E.rj45_state=="idle"){hideLoading();if(A.currentMode()=="DHCP"&&F.ethwan_mode=="DHCP"){j==false&&A.dhcpNoticeShow(true);A.dhcpNotice("dyn_fail");A.dhcpNoticeText(e.i18n.prop("dyn_fail"))}if(A.currentMode()=="STATIC"&&F.ethwan_mode=="STATIC"){j==false&&A.staticNoticeShow(true);A.staticNotice("static_fail");A.staticNoticeText(e.i18n.prop("static_fail"))}if(A.currentMode()=="PPPOE"&&F.ethwan_mode=="PPPOE"){j==false&&A.pppoeNoticeShow(true);A.pppoeNotice("pppoe_fail");A.pppoeNoticeText(e.i18n.prop("pppoe_fail"))}if(A.currentMode()=="AUTO"&&F.ethwan_mode=="AUTO"){j==false&&A.autoNoticeShow(true);A.autoNotice("auto_fail");A.autoNoticeText(e.i18n.prop("auto_fail"))}window.clearInterval(p)}else{hideLoading();window.clearInterval(p)}}}}}function y(){if(A.currentMode()==F.ethwan_mode){if(A.currentMode()=="AUTO"){A.autoNoticeShow(true);A.autoNotice("auto_success");A.autoNoticeText(e.i18n.prop("auto_success"))}else{if(A.currentMode()=="PPPOE"){A.pppoeNoticeShow(true);A.pppoeNotice("pppoe_success");A.pppoeNoticeText(e.i18n.prop("pppoe_success"))}else{if(A.currentMode()=="STATIC"){A.staticNoticeShow(true);A.staticNotice("static_success");A.staticNoticeText(e.i18n.prop("static_success"))}else{if(A.currentMode()=="DHCP"){A.dhcpNoticeShow(true);A.dhcpNotice("dyn_success");A.dhcpNoticeText(e.i18n.prop("dyn_success"))}}}}}}function D(){if(E.rj45_state!="dead"){if(A.currentMode()=="AUTO"&&A.autoNotice()=="pppoe_msg"){A.autoNoticeShow(false)}else{if(A.currentMode()=="PPPOE"&&A.pppoeNotice()=="pppoe_msg"){A.pppoeNoticeShow(false)}else{if(A.currentMode()=="STATIC"&&A.staticNotice()=="pppoe_msg"){A.staticNoticeShow(false)}else{if(A.currentMode()=="DHCP"&&A.dhcpNotice()=="pppoe_msg"){A.dhcpNoticeShow(false)}}}}}else{A.dhcpNotice("pppoe_msg");A.dhcpNoticeText(e.i18n.prop("pppoe_msg"));A.staticNotice("pppoe_msg");A.staticNoticeText(e.i18n.prop("pppoe_msg"));A.pppoeNotice("pppoe_msg");A.pppoeNoticeText(e.i18n.prop("pppoe_msg"));A.autoNotice("pppoe_msg");A.autoNoticeText(e.i18n.prop("pppoe_msg"));if(A.currentMode()=="AUTO"){A.autoNoticeShow(true)}else{if(A.currentMode()=="PPPOE"){A.pppoeNoticeShow(true)}else{if(A.currentMode()=="STATIC"){A.staticNoticeShow(true)}else{if(A.currentMode()=="DHCP"){A.dhcpNoticeShow(true)}}}}}}function z(){if(k<1){k++}else{if(E.rj45_state!="working"&&E.rj45_state!="connect"){A.dhcpNoticeShow(false);A.staticNoticeShow(false);A.pppoeNoticeShow(false);A.autoNoticeShow(false);window.clearInterval(p);successOverlay()}else{if(k>6){if(j==false){j=true;showAlert("ussd_operation_timeout")}window.clearInterval(p)}else{if(k<7){k++}else{hideLoading();window.clearInterval(p)}}}}}function u(){A.dhcpNoticeShow(false);A.staticNoticeShow(false);A.pppoeNoticeShow(false);A.autoNoticeShow(false);if(E.rj45_state=="dead"){showAlert("pppoe_msg");return}var G={};if(e("#pppoe_mode").val()=="PPPOE"){G=e.extend({},{goformId:"WAN_GATEWAYMODE_PPPOE",pppoe_username:A.user(),pppoe_cc:A.password()})}else{if(e("#pppoe_mode").val()=="AUTO"){G=e.extend({},{goformId:"WAN_GATEWAYMODE_AUTO",pppoe_username:A.autoUser(),pppoe_cc:A.autoPassword()})}else{if(e("#pppoe_mode").val()=="STATIC"){if(A.ipAddress()==A.defaultGateway()){showAlert("ip_gate_not_same");return}if(n(A.ipAddress(),E.lan_ipaddr,E.lan_netmask)){showAlert("ip_innergate_not_same");return}G=e.extend({},{goformId:"WAN_GATEWAYMODE_STATIC",static_wan_ipaddr:A.ipAddress(),static_wan_netmask:A.subnetMask(),static_wan_gateway:A.defaultGateway(),static_wan_primary_dns:A.primaryDNS(),static_wan_secondary_dns:A.secondaryDNS(),WAN_MODE:"STATIC"})}else{G=e.extend({},{goformId:"WAN_GATEWAYMODE_DHCP"})}}}G.action_link="connect";G.dial_mode=A.pppMode();showLoading("waiting");s.setPppoeDialMode(G,function(H){if(H.result){A.currentMode(e("#pppoe_mode").val());E=s.getPppoeParams();k=0;j=false;x("connect");e("#pppoeApply").translate()}else{errorOverlay("pppoe_message_send_fail")}})}function v(){A.dhcpNoticeShow(false);A.staticNoticeShow(false);A.pppoeNoticeShow(false);A.autoNoticeShow(false);if(E.rj45_state=="dead"){showAlert("pppoe_msg");return}var G={dial_mode:A.pppMode(),action_link:"disconnect"};if(E.ethwan_mode=="PPPOE"){G=e.extend(G,{goformId:"WAN_GATEWAYMODE_PPPOE",pppoe_username:E.pppoe_username,pppoe_cc:E.pppoe_cc})}else{if(E.ethwan_mode=="AUTO"){G=e.extend(G,{goformId:"WAN_GATEWAYMODE_AUTO",pppoe_username:E.pppoe_username,pppoe_cc:E.pppoe_cc})}else{if(E.ethwan_mode=="STATIC"){G=e.extend(G,{goformId:"WAN_GATEWAYMODE_STATIC",static_wan_ipaddr:E.static_wan_ipaddr,static_wan_netmask:E.static_wan_netmask,static_wan_gateway:E.static_wan_gateway,static_wan_primary_dns:E.static_wan_primary_dns,static_wan_secondary_dns:E.static_wan_secondary_dns,WAN_MODE:"STATIC"})}else{G=e.extend(G,{goformId:"WAN_GATEWAYMODE_DHCP"})}}}showLoading("waiting");s.setPppoeDialMode(G,function(H){if(H.result){k=0;j=false;x("disconnect");e("#pppoeApply").translate()}else{errorOverlay("pppoe_message_send_fail")}})}function w(){C();return true}function t(){C()}}function h(u){var t=e("#container");a.cleanNode(t[0]);a.applyBindings(u,t[0])}function b(){var t=new c();h(t);e("#pppoeApply").translate();e("#pppoeForm").validate({submitHandler:function(){t.save()},rules:{txtPin:"wps_pin_check",txtIpAddress:"dmz_ip_check",txtSubnetMask:{ipv4:true,subnetmask_check:true},txtDefaultGateway:{ipv4:true,gateway_check:true},txtPrimaryDNS:{ipv4:true,dns_check:true},txtSecondaryDNS:{ipv4:true,dns_check:true}}})}function l(t){if("0.0.0.0"==t||"255.255.255.255"==t){return false}return true}function n(z,v,u){if(!z||!v||!u){return false}if(z==v){return true}var y=[],x=[],t=[];addr1=z.split(".");addr2=v.split(".");t=u.split(".");for(var w=0;w<addr1.length;w+=1){y.push(parseInt(addr1[w])&parseInt(t[w]));x.push(parseInt(addr2[w])&parseInt(t[w]))}if(y.join(".")==x.join(".")){return true}else{return false}}function r(t){if(t==255||t==254||t==252||t==248||t==240||t==224||t==192||t==128||t==0){return true}else{return false}}function d(t){var u=new Array();u=t.split(".");if(u.length!=4){return false}u[0]=parseInt(u[0]);u[1]=parseInt(u[1]);u[2]=parseInt(u[2]);u[3]=parseInt(u[3]);if(u[3]!=0){if(u[2]!=255||u[1]!=255||u[0]!=255){return false}else{if(!r(u[3])){return false}}}if(u[2]!=0){if(u[1]!=255||u[0]!=255){return false}else{if(!r(u[2])){return false}}}if(u[1]!=0){if(u[0]!=255){return false}else{if(!r(u[1])){return false}}}if(u[0]!=255){return false}if("0.0.0.0"==t||"255.255.255.255"==t){return false}return true}jQuery.validator.addMethod("subnetmask_check",function(v,u,w){var t=d(v);return this.optional(u)||t});jQuery.validator.addMethod("dns_check",function(v,u,w){var t=l(v);return this.optional(u)||t});function i(u,t,v){if(f(u,t)==f(t,v)){return true}else{return false}}function f(w,v){var t=[];var y=w.split(".");var x=v.split(".");for(var u=0;u<y.length;u++){t[u]=(y[u]&x[u])}return t.join(".")}jQuery.validator.addMethod("gateway_check",function(v,u,w){var t=i(e("#txtIpAddress").val(),e("#txtSubnetMask").val(),e("#txtDefaultGateway").val());return this.optional(u)||t});return{init:b}});define("network_dial_set","underscore jquery knockout set service".split(" "),function(f,g,e,d,b){function h(){var j=b.getConnectionMode();var m=this;m.selectMode=e.observable(j.connectionMode);m.enableFlag=e.observable(true);m.isAllowedRoaming=e.observable(j.isAllowedRoaming);var k=j.isAllowedRoaming;m.setAllowedRoaming=l;var n=g(".checkboxToggle");m.checkEnable=i;m.save=o;function o(){showLoading();var p=m.selectMode();if(p=="auto_dial"){k=m.isAllowedRoaming()}else{m.isAllowedRoaming(k)}b.setConnectionMode({connectionMode:p,isAllowedRoaming:m.isAllowedRoaming()},function(q){if(q.result=="success"){successOverlay()}else{errorOverlay()}})}function l(){if(!g("#roamBtn").hasClass("disable")){var p=g("#isAllowedRoaming:checked");if(p&&p.length==0){m.isAllowedRoaming("on")}else{m.isAllowedRoaming("off")}}}function i(){var p=b.getStatusInfo();if(p.connectStatus=="ppp_connected"||p.connectStatus=="ppp_connecting"){m.enableFlag(false);disableCheckbox(n)}else{m.enableFlag(true);enableCheckbox(n)}}}function a(){var i=new h();c(i);i.checkEnable();addInterval(i.checkEnable,1000)}function c(j){var i=g("#container");e.cleanNode(i[0]);e.applyBindings(j,i[0])}return{init:a}});define("network_apn_set","underscore jquery knockout set service".split(" "),function(t,h,d,s,u){function j(){return t.map(s.APN_AUTH_MODES,function(v){return new Option(v.name,v.value)})}function f(){var v=[new Option("IPv4","IP")];if(s.IPV6_SUPPORT){v.push(new Option("IPv6","IPv6"));if(s.IPV4V6_SUPPORT){v.push(new Option("IPv4v6","IPv4v6"))}if(s.IPV4_AND_V6_SUPPORT){v.push(new Option("IPv4 & IPv6","IPv4v6"))}}return v}function e(){var v=u.getApnSettings();v.ipv6ApnConfigs=q(v.ipv6APNs,true);v.apnConfigs=q(v.APNs,false);v.autoApnConfigs=m(v.autoApns,v.autoApnsV6);return v}var l={};var g={};var c={};function m(z,x){var A=[];var y=[];if(z&&z.length>5){var v=z.split("||");for(var B=0;B<v.length;B++){if(v[B]!=""){var w=i(v[B],false);A.push(w)}}}if(x&&x.length>5){var v=x.split("||");for(var B=0;B<v.length;B++){if(v[B]!=""){var w=i(v[B],false);y.push(w)}}}return p(A,y)}function q(v,z){var A=[];var x={};if(v&&v.length>10){var w=v.split("||");for(var B=0;B<w.length;B++){if(w[B]!=""){var y=i(w[B],z);A.push(y);x[y.profileName]=y}}}if(z==false){l=x}else{g=x}return A}function i(z,x){var w={};var v=z.split("($)");for(var y=0;y<v.length;y++){w.profileName=v[0];w.pdpType=v[7];if(x==false){w.dnsMode=v[10];w.dns1=v[11];w.dns2=v[12];w.wanApn=v[1];w.authMode=v[4].toLowerCase();w.username=v[5];w.password=v[6]}else{w.dnsModeV6=v[10];w.dns1V6=v[11];w.dns2V6=v[12];w.wanApnV6=v[1];w.authModeV6=v[4].toLowerCase();w.usernameV6=v[5];w.passwordV6=v[6]}}return w}function p(x,w){c={};var A=[];for(var z=0;z<x.length;z++){var v=x[z];var y=w[z];if(v&&(v.pdpType=="IPv6"||v.pdpType=="IPv4v6")){v.usernameV6=v.username;v.passwordV6=v.password;v.dns1V6=v.dns1;v.dns2V6=v.dns2;v.wanApnV6=v.wanApn;v.authModeV6=v.authMode;v.dnsModeV6=v.dnsMode}A.push(v);c[v.profileName]=v}return A}function r(v){return t.map(v,function(w){return new Option(w.profileName,w.profileName)})}function o(){var N=this;var I=e();if(I.apnNumPreset){s.maxApnNumber=I.apnNumPreset}N.defApn=d.observable(I.profileName);N.apnMode=d.observable(I.apnMode);N.autoProfiles=d.observableArray(r(I.autoApnConfigs));N.profiles=d.observableArray(r(I.apnConfigs));N.wanDial=d.observable(I.wanDial);N.showApnDns=d.observable(s.SHOW_APN_DNS);N.index=d.observable(I.currIndex);N.supportIPv6=d.observable(s.IPV6_SUPPORT);N.supportIpv4AndIpv6=d.observable(s.IPV4_AND_V6_SUPPORT);N.dnsMode=d.observable(I.dnsMode=="manual"?"manual":"auto");N.dns1=d.observable(I.dns1);N.dns2=d.observable(I.dns2);N.authModes=d.observableArray(j());N.apn=d.observable(I.wanApn);N.username=d.observable(I.username);N.password=d.observable(I.password);N.pdpTypes=d.observableArray(f());N.selectedPdpType=d.observable(I.pdpType);N.selectedPdpTypeTmp=d.observable(I.pdpType);N.profileName=d.observable(I.profileName);N.selectedProfile=d.observable(I.profileName);N.showPassword=d.observable(false);N.apnV6=d.observable(I.wanApnV6);N.dnsModeV6=d.observable(I.dnsModeV6=="manual"?"manual":"auto");N.dns1V6=d.observable(I.dns1V6);N.dns2V6=d.observable(I.dns2V6);N.authModesV6=d.observableArray(j());N.usernameV6=d.observable(I.usernameV6);N.passwordV6=d.observable(I.passwordV6);if(I.apnMode=="auto"){N.dnsMode=d.observable(I.autoApnConfigs[0].dnsMode=="manual"?"manual":"auto");N.dns1=d.observable(I.autoApnConfigs[0].dns1);N.dns2=d.observable(I.autoApnConfigs[0].dns2);N.authModes=d.observableArray(j());N.apn=d.observable(I.autoApnConfigs[0].wanApn);N.username=d.observable(I.autoApnConfigs[0].username);N.password=d.observable(I.autoApnConfigs[0].password);N.apnV6=d.observable(I.autoApnConfigs[0].wanApnV6);N.dnsModeV6=d.observable(I.autoApnConfigs[0].dnsModeV6=="manual"?"manual":"auto");N.dns1V6=d.observable(I.autoApnConfigs[0].dns1V6);N.dns2V6=d.observable(I.autoApnConfigs[0].dns2V6);N.authModesV6=d.observableArray(j());N.usernameV6=d.observable(I.autoApnConfigs[0].usernameV6);N.passwordV6=d.observable(I.autoApnConfigs[0].passwordV6)}N.pdpTypeNote=d.observable(true);if(I.autoApnConfigs&&I.autoApnConfigs.length>0){N.selectedAutoProfile=d.observable(I.autoApnConfigs[0].profileName)}else{N.selectedAutoProfile=d.observable()}if(s.EMPTY_APN_SUPPORT==false){h("#apn_ipv4_apn").addClass("required");h("#apn_ipv6_apn").addClass("required")}else{h("#apn_ipv4_apn").removeClass("required");h("#apn_ipv6_apn").removeClass("required")}N.disableProfile=d.observable(false);N.addApnHide=d.observable(true);N.defaultCfg=d.observable(true);N.predeterminedCfg=d.observable(true);N.selectedAuthenticationV6=d.observable(I.authModeV6);if(I.apnMode=="auto"){if(I.pdpType=="IPv4v6"||I.pdpType=="IPv6"){N.selectedAuthenticationV6=d.observable(I.autoApnConfigs[0].authModeV6)}N.selectedAuthentication=d.observable(I.autoApnConfigs[0].authMode)}else{N.selectedAuthentication=d.observable(I.authMode)}N.transApnV6=d.observable("apn");N.transDnsModeV6=d.observable("apn_dns_mode");N.transDns1V6=d.observable("apn_dns1");N.transDns2V6=d.observable("apn_dns2");N.transAuthV6=d.observable("apn_authentication");N.transUserNameV6=d.observable("apn_user_name");N.transPasswordV6=d.observable("apn_password");N.transApn=d.observable(s.IPV4_AND_V6_SUPPORT?"apn_ipv4_apn":"apn");N.transDnsMode=d.observable(s.IPV4_AND_V6_SUPPORT?"apn_dns_mode_ipv4":"apn_dns_mode");N.transDns1=d.observable(s.IPV4_AND_V6_SUPPORT?"apn_dns1_ipv4":"apn_dns1");N.transDns2=d.observable(s.IPV4_AND_V6_SUPPORT?"apn_dns2_ipv4":"apn_dns2");N.transAuth=d.observable(s.IPV4_AND_V6_SUPPORT?"apn_authentication_ipv4":"apn_authentication");N.transUserName=d.observable(s.IPV4_AND_V6_SUPPORT?"apn_user_name_ipv4":"apn_user_name");N.transPassword=d.observable(s.IPV4_AND_V6_SUPPORT?"apn_password_ipv4":"apn_password");N.setDefaultVisible=d.observable(!a());N.tmp1=d.computed(function(){if(N.selectedPdpType()=="IPv6"){N.transApnV6("apn");N.transDnsModeV6("apn_dns_mode");N.transDns1V6("apn_dns1");N.transDns2V6("apn_dns2");N.transAuthV6("apn_authentication");N.transUserNameV6("apn_user_name");N.transPasswordV6("apn_password")}else{if(s.IPV4_AND_V6_SUPPORT&&N.selectedPdpType()=="IPv4v6"){N.transApn("apn_ipv4_apn");N.transDnsMode("apn_dns_mode_ipv4");N.transDns1("apn_dns1_ipv4");N.transDns2("apn_dns2_ipv4");N.transAuth("apn_authentication_ipv4");N.transUserName("apn_user_name_ipv4");N.transPassword("apn_password_ipv4");N.transApnV6("apn_ipv6_apn");N.transDnsModeV6("apn_dns_mode_ipv6");N.transDns1V6("apn_dns1_ipv6");N.transDns2V6("apn_dns2_ipv6");N.transAuthV6("apn_authentication_ipv6");N.transUserNameV6("apn_user_name_ipv6");N.transPasswordV6("apn_password_ipv6")}else{if(N.selectedPdpType()=="IP"||N.selectedPdpType()=="IPv4"){N.transApn("apn");N.transDnsMode("apn_dns_mode");N.transDns1("apn_dns1");N.transDns2("apn_dns2");N.transAuth("apn_authentication");N.transUserName("apn_user_name");N.transPassword("apn_password")}else{N.transApn("apn");N.transDnsMode("apn_dns_mode");N.transDns1("apn_dns1");N.transDns2("apn_dns2");N.transAuth("apn_authentication");N.transUserName("apn_user_name");N.transPassword("apn_password")}}}h("#apn_setting_form").translate()});N.autoApnChecked=d.computed(function(){return N.apnMode()=="auto"});N.hasCapacity=d.computed(function(){if(N.profiles().length<s.maxApnNumber){return true}else{return false}});N.showDnsV6=d.computed(function(){return N.dnsModeV6()=="manual"});N.showDns=d.computed(function(){return N.dnsMode()=="manual"});v();N.checkInputDisable=d.computed(function(){if(N.apnMode()!="auto"&&(N.predeterminedCfg()==false&&N.defaultCfg()==true)&&!a()){return false}if(((N.apnMode()!="auto"&&(N.predeterminedCfg()||N.defaultCfg())&&!N.disableProfile()))||N.apnMode()=="auto"){return true}if((!N.disableProfile()||!(N.predeterminedCfg()||N.defaultCfg()))&&N.apnMode()!="auto"){return false}return false});var O=u.getDeviceInfo();N.pdpTypeChangeAlert=z;N.showAutoApnDetail=d.computed(function(){if(N.apnMode()!="auto"){return true}else{return N.autoProfiles().length>0}});N.showPasswordHandler=function(){var Q=h("#showPassword:checked");if(Q&&Q.length==0){N.showPassword(true)}else{N.showPassword(false)}};N.autoProfileChangeHandler=L;N.profileChangeHandler=P;N.setUIData=H;function v(){var Q=A();if(N.apnMode()!="auto"){if(N.selectedProfile()!=N.defApn()){N.defaultCfg(false)}else{N.defaultCfg(true)}}else{if(N.selectedAutoProfile()!=N.defApn()){N.defaultCfg(false)}else{N.defaultCfg(true)}}if(Q>=s.defaultApnSize){N.predeterminedCfg(false)}else{N.predeterminedCfg(true)}}N.setDefaultAct=w;N.apnModeChangeHandler=B;function K(){var R=0;if(N.apnMode()!="auto"){R=A();N.selectedProfile(h("#profile").val())}else{R=G();N.selectedAutoProfile(h("#autoProfile").val())}var Q=N.getSelectedManualProfile();u.setDefaultApn({index:R,apnMode:N.apnMode(),pdpType:Q.pdpType,profileName:Q.profileName,wanApn:Q.wanApn,authMode:Q.authMode,username:Q.username,password:Q.password,dnsMode:s.SHOW_APN_DNS?Q.dnsMode:"auto",dns1:s.SHOW_APN_DNS?Q.dns1:"",dns2:s.SHOW_APN_DNS?Q.dns2:""},function(S){if(S.result){addTimeout(function(){b(true);N.apnModeChangeHandler();successOverlay()},500)}else{errorOverlay()}},function(S){errorOverlay()})}N.getSelectedManualProfile=M;function G(){var Q=h("#autoProfile option");for(var R=0;R<Q.length;R++){if(Q[R].value==N.selectedAutoProfile()){return R}}return Q.length-1}function A(){var Q=h("#profile option");if(Q.length==0){Q=N.profiles()}var R=0;for(;R<Q.length;R++){if(Q[R].value==N.selectedProfile()){break}}return R}N.saveAct=J;function C(R){showLoading();var S=A();var T=false;if(s.IPV4V6_SUPPORT&&N.selectedPdpType()=="IPv4v6"){T=true}var Q=false;if(R||(N.predeterminedCfg()||N.defaultCfg())){Q=true}u.addOrEditApn({profileName:N.profileName(),pdpType:N.selectedPdpType(),index:S,wanApn:N.apn(),authMode:N.selectedAuthentication(),username:N.username(),password:N.password(),dnsMode:s.SHOW_APN_DNS?N.dnsMode():"auto",dns1:s.SHOW_APN_DNS?N.dns1():"",dns2:s.SHOW_APN_DNS?N.dns2():"",wanApnV6:T?N.apn():N.apnV6(),authModeV6:T?N.selectedAuthentication():N.selectedAuthenticationV6(),usernameV6:T?N.username():N.usernameV6(),passwordV6:T?N.password():N.passwordV6(),dnsModeV6:s.SHOW_APN_DNS?(T?N.dnsMode():N.dnsModeV6()):"auto",dns1V6:s.SHOW_APN_DNS?(T?N.dns1():N.dns1V6()):"",dns2V6:s.SHOW_APN_DNS?(T?N.dns2():N.dns2V6()):""},function(V){if(V.result){I=e();if(N.profileName()!=N.selectedProfile()){var U=N.profileName();N.profiles(r(I.apnConfigs));h("#profile").val(U).trigger("change")}if(Q==false){successOverlay()}else{K()}}else{errorOverlay()}},function(U){errorOverlay()})}function x(){showLoading("waiting");var R=h("option","#profile").length;if(R<s.defaultApnSize){errorOverlay();return}var Q=false;if(s.IPV4V6_SUPPORT&&N.selectedPdpType()=="IPv4v6"){Q=true}u.addOrEditApn({profileName:N.profileName(),pdpType:N.selectedPdpType(),index:R,wanApn:N.apn(),authMode:N.selectedAuthentication(),username:N.username(),password:N.password(),dnsMode:s.SHOW_APN_DNS?N.dnsMode():"auto",dns1:s.SHOW_APN_DNS?N.dns1():"",dns2:s.SHOW_APN_DNS?N.dns2():"",wanApnV6:Q?N.apn():N.apnV6(),authModeV6:Q?N.selectedAuthentication():N.selectedAuthenticationV6(),usernameV6:Q?N.username():N.usernameV6(),passwordV6:Q?N.password():N.passwordV6(),dnsModeV6:s.SHOW_APN_DNS?(Q?N.dnsMode():N.dnsModeV6()):"auto",dns1V6:s.SHOW_APN_DNS?(Q?N.dns1():N.dns1V6()):"",dns2V6:s.SHOW_APN_DNS?(Q?N.dns2():N.dns2V6()):""},function(T){if(T.result){I=e();if(N.profileName()!=N.selectedProfile()){var S=N.profileName();N.profiles(r(I.apnConfigs));h("#profile").val(S).trigger("change")}K()}else{errorOverlay()}},function(S){errorOverlay()})}var F={};N.deleteAct=E;N.cancelAddAct=D;N.addAct=y;function y(){clearValidateMsg("#apn_setting_form");N.pdpTypeNote(true);N.disableProfile(true);N.addApnHide(true);F={profileName:N.profileName(),selectedPdpType:N.selectedPdpType(),wanApnV6:N.apnV6(),dnsModeV6:s.SHOW_APN_DNS?N.dnsModeV6():"auto",dns1V6:s.SHOW_APN_DNS?N.dns1V6():"",dns2V6:s.SHOW_APN_DNS?N.dns2V6():"",authModeV6:N.selectedAuthenticationV6(),usernameV6:N.usernameV6(),passwordV6:N.passwordV6(),wanApn:N.apn(),dnsMode:s.SHOW_APN_DNS?N.dnsMode():"auto",dns1:s.SHOW_APN_DNS?N.dns1():"",dns2:s.SHOW_APN_DNS?N.dns2():"",authMode:N.selectedAuthentication(),username:N.username(),password:N.password()};N.profileName("");N.selectedPdpType("IP");N.selectedPdpTypeTmp("IP");N.apnV6("");N.dnsModeV6("auto");N.dns1V6("");N.dns2V6("");N.selectedAuthenticationV6("none");N.usernameV6("");N.passwordV6("");N.apn("");N.dnsMode("auto");N.dns1("");N.dns2("");N.selectedAuthentication("none");N.username("");N.password("")}function D(){clearValidateMsg("#apn_setting_form");N.pdpTypeNote(false);N.disableProfile(false);N.addApnHide(false);N.profileName(F.profileName);N.selectedPdpType(F.selectedPdpType);N.selectedPdpTypeTmp(F.selectedPdpType);N.apnV6(F.wanApnV6);N.dnsModeV6(F.dnsModeV6);N.dns1V6(F.dns1V6);N.dns2V6(F.dns2V6);N.selectedAuthenticationV6(F.authModeV6);N.usernameV6(F.usernameV6);N.passwordV6(F.passwordV6);N.apn(F.wanApn);N.dnsMode(F.dnsMode);N.dns1(F.dns1);N.dns2(F.dns2);N.selectedAuthentication(F.authMode);N.username(F.username);N.password(F.password)}function E(){if(!N.selectedProfile()){showAlert("apn_no_select_alert");return false}if(N.predeterminedCfg()){errorOverlay("apn_delete_cant_delete_default");return false}if(e().profileName==N.profileName()){errorOverlay("apn_cant_delete_current");return false}showConfirm("apn_delete_confirm",function(){showLoading("deleting");u.deleteApn({index:A()},function(Q){if(Q.result){N.profiles(r(e().apnConfigs));N.selectedProfile(N.defApn());N.profileChangeHandler();successOverlay()}else{errorOverlay()}},function(Q){errorOverlay()})})}function J(){if(!h("#apn_setting_form").valid()){return false}if(!N.selectedProfile()&&!N.disableProfile()){showAlert("apn_no_select_alert");return false}var Q=false;h.each(N.profiles(),function(S,T){if(T.value==N.profileName()){Q=true}});if(N.disableProfile()==false){if(Q&&N.selectedProfile()!=N.profileName()){showInfo("apn_save_profile_exist");return false}if(N.predeterminedCfg()){errorOverlay();return false}if(N.predeterminedCfg()||N.defaultCfg()){C(false)}else{C(false)}}else{if(h("#profile option").length>=s.maxApnNumber){showInfo({msg:"apn_profile_full",params:[s.maxApnNumber]});return false}if(Q){showInfo("apn_save_profile_exist");return false}var R=u.getStatusInfo();if(R.connectStatus!="ppp_connected"){x()}else{showConfirm("apn_diconneted_network_confirm",function(){showLoading("disconnecting");u.disconnect({},function(S){if(S.result){s.connect_flag=true;x()}else{errorOverlay()}})})}}}function M(){var R={};var Q=h("#profile").val();if(typeof N.selectedProfile()=="undefined"){N.selectedProfile(Q)}var T=l[Q];var S=g[Q];if(T&&!S){h.extend(R,T)}else{if(T&&S){if(!!T.pdpType){h.extend(R,S);h.extend(R,T)}else{h.extend(R,T);h.extend(R,S)}}}return R}function B(R,Q){if(N.apnMode()!="auto"){N.profileChangeHandler()}else{if(N.showAutoApnDetail()){N.autoProfileChangeHandler()}}return true}function w(){if(!N.selectedProfile()){showAlert("apn_no_select_alert");return false}var R=u.getConnectionInfo().connectStatus;if(R=="ppp_connecting"){showAlert({msg:"apn_cant_modify_status",params:[h.i18n.prop("connecting").toLowerCase()]});return false}else{if(R=="ppp_disconnecting"){showAlert({msg:"apn_cant_modify_status",params:[h.i18n.prop("disconnecting").toLowerCase()]});return false}else{if(R=="ppp_connected"){showAlert({msg:"apn_cant_modify_status",params:[h.i18n.prop("connected").toLowerCase()]});return false}}}if(N.apnMode()=="auto"||N.predeterminedCfg()){showLoading("waiting");K()}else{if(h("#apn_setting_form").valid()==false){h(".error:first","#apn_setting_form").focus()}else{var Q=false;h.each(N.profiles(),function(S,T){if(T.value==N.profileName()){Q=true}});if(Q&&N.selectedProfile()!=N.profileName()){showInfo("apn_save_profile_exist");return false}C(true)}}}function H(Q){clearValidateMsg("#apn_setting_form");if(!Q){return}N.selectedPdpType(Q.pdpType||"IP");N.selectedPdpTypeTmp(Q.pdpType||"IP");N.profileName(Q.profileName);N.apn(Q.wanApn);N.dnsMode(Q.dnsMode!="manual"?"auto":"manual");N.dns1(Q.dns1);N.dns2(Q.dns2);N.username(Q.username);N.password(Q.password);N.selectedAuthentication(Q.authMode||"none");N.apnV6(Q.wanApnV6);N.dnsModeV6(Q.dnsModeV6!="manual"?"auto":"manual");N.dns1V6(Q.dns1V6);N.dns2V6(Q.dns2V6);N.usernameV6(Q.usernameV6);N.passwordV6(Q.passwordV6);N.selectedAuthenticationV6(Q.authModeV6||"none")}function P(S,R){N.pdpTypeNote(true);if(N.apnMode()!="manual"){return true}var Q=N.getSelectedManualProfile();N.setUIData(Q);v();return true}function L(S,R){if(N.apnMode()!="auto"){return true}var Q=c[N.selectedAutoProfile()];N.setUIData(Q);v();return true}function z(){if(N.pdpTypeNote()){showAlert({msg:"apn_pdptype_change_note",params:[O.lanDomain,O.ipAddress]})}if(N.apnMode()!="auto"&&!N.disableProfile()){if((s.IPV4_AND_V6_SUPPORT&&N.selectedPdpTypeTmp()!="IPv4v6"&&N.selectedPdpType()!="IPv4v6")||!s.IPV4_AND_V6_SUPPORT){if(N.selectedPdpTypeTmp()=="IPv6"){N.apn(N.apnV6());N.dnsMode(N.dnsModeV6());N.dns1(N.dns1V6());N.dns2(N.dns2V6());N.username(N.usernameV6());N.password(N.passwordV6());N.selectedAuthentication(N.selectedAuthenticationV6())}else{if(N.selectedPdpType()=="IPv6"){N.apnV6(N.apn());N.dnsModeV6(N.dnsMode());N.dns1V6(N.dns1());N.dns2V6(N.dns2());N.usernameV6(N.username());N.passwordV6(N.password());N.selectedAuthenticationV6(N.selectedAuthentication())}}}}N.selectedPdpTypeTmp(N.selectedPdpType())}}function a(){var v=u.getConnectionInfo();return v.connectStatus=="ppp_connected"}function k(){l={};g={};c={}}function n(w){var v=h("#container");d.cleanNode(v[0]);d.applyBindings(w,v[0])}function b(w){k();var v=new o();n(v);if(!w){addInterval(function(){v.setDefaultVisible(!a())},1000)}h("#apn_setting_form").validate({submitHandler:function(){v.saveAct()},rules:{profile_name:"apn_profile_name_check",apn_ipv4_apn:"apn_check",apn_dns1_ipv4:"ipv4",apn_dns2_ipv4:"ipv4",apn_ipv6_apn:"apn_check",apn_dns1_ipv6:"ipv6",apn_dns2_ipv6:"ipv6",apn_user_name_ipv4:"ppp_username_check",apn_secretcode_ipv4:"ppp_secretcode_check",apn_user_name_ipv6:"ppp_username_check",apn_secretcode_ipv6:"ppp_secretcode_check"}})}return{init:b}});define("band_selection","jquery jq_fileinput service knockout set statusBar".split(" "),function(g,b,a,e,d,c){function f(){var k=this;k.hasDdns=d.DDNS_SUPPORT;k.hasUpdateCheck=d.HAS_UPDATE_CHECK;k.isSupportSD=d.SD_CARD_SUPPORT;k.isDataCard=d.PRODUCT_TYPE=="DATACARD";var l=a.getExtraFunc();k.hasTr069=l.tr069FuncEnable;k.hasVpn=l.vpnEnable;var j=a.getBand();var i=a.getSetband().set_band_list;g.each(g('[name="4G"]'),function(m,o){for(var n in j){if(n==g(o).val()&&j[n]==0){g(o).attr("disabled",true)}}for(var n in i){if(i.split(",")[n]==g(o).val()){g(o).prop("checked",true)}}});g.each(g('[name="3G"]'),function(m,o){for(var n in j){if(n==g(o).val()&&j[n]==0){g(o).attr("disabled",true)}}for(var n in i){if(i.split(",")[n]==g(o).val()){g(o).prop("checked",true)}}});k.apply=function(){showConfirm("lan_confirm_reopen",{ok:function(){showLoading();var m="";g.each(g('[name="4G"]'),function(o,p){if(g(p).is(":checked")){m+=g(p).val()+","}});g.each(g('[name="3G"]'),function(o,p){if(g(p).is(":checked")){m+=g(p).val()+","}});var n={};n.band_list=m.substr(0,m.length-1);a.setBandlist(n,function(o){if(o.result=="success"){successOverlay()}else{errorOverlay()}})}})}}function h(){var i=g("#container")[0];e.cleanNode(i);var j=new f();e.applyBindings(j,i);g("#frmBandpdate").validate({submitHandler:function(){j.apply()}})}return{init:h}});