define("wifi_advance","underscore jquery knockout set service jqui".split(" "),function(G,l,e,F,H,C){var q=null;var f=false;function u(L){var K=[];for(var I=0;I<L.length;I++){var J=L[I].rate==0?"Auto":L[I].rate+" Mbps";K.push(new Option(J,L[I].index))}return K}var k=[0,1,2,5.5,6,6.5,9,11,12,13,18,19.5,24,26,36,39,48,52,54,58.5,65];function z(J,I){return J.rate-I.rate}function x(M){var L=[],I=[];for(var K=0;K<M.length;K++){for(var J=0;J<M[K].length;J++){if(e.utils.arrayIndexOf(L,M[K][J])==-1){L.push(M[K][J]);I.push({index:M[K][J],rate:k[M[K][J]]})}}}I.sort(z);return I}function j(N){var L=[0,5,9,11,13,15,17,19,20];var J=[0,4,6,8,10,12,14,16,18];var M=[0,1,2,3,7];var I=[];switch(N){case"5":I.push(L);I.push(J);I.push(M);break;case"4":I.push(L);I.push(J);I.push(M);break;case"3":I.push(J);I.push(M);break;case"2":I.push(L);break;case"1":I.push(J);break;case"0":I.push(M);break;default:I.push(L);break}var K=x(I);return u(K)}function n(M){var I=F.countryCode;var L="";for(key in I){var J=I[key];if(l.inArray(M,J)!=-1){L=key;break}}var K=F.countryCodeType[L];return K?K:"0"}function a(K){var I=[new Option("Auto","0")];var J=n(K)+"";switch(J){case"9":b(I,2307,13);break;case"7":b(I,2307,13);b(I,2407,11);b(I,2462,2);break;case"3":b(I,2407,11);b(I,2462,2);break;case"2":b(I,2307,13);b(I,2407,11);break;case"1":b(I,2407,11);break;default:b(I,2407,11)}return I}function b(J,M,L){for(var K=1;K<=L;K++){var I=M+K*5+"MHz (Channel "+J.length+")";J.push(new Option(I,J.length+"_"+(M+K*5)))}}function E(J){for(key in F.countryCode_5g){var I=F.countryCode_5g[key];if(l.inArray(J,I.codes)!=-1){return d(I.channels)}}return[new Option("Auto","0")]}function d(J){var L=[new Option("Auto","0")];for(var M=0;M<J.length;M++){var N=J[M];var K=N*5+5000;var I=K+"MHz (Channel "+N+")";L.push(new Option(I,N+"_"+(K)))}return L}function A(){var I=[];if(!F.WIFI_HAS_5G){I.push(new Option("2.4GHz","b"))}else{I.push(new Option("5GHz","a"));I.push(new Option("2.4GHz","b"))}return I}function t(J){var I=[];if(J){I.push(new Option("20MHz","0"));I.push(new Option("20MHz/40MHz","1"))}else{I.push(new Option("20MHz","0"))}return I}function D(K){var I=K?F.countries_5g:F.countries;var J=[];for(key in I){J.push(new Option(I[key],key))}J=G.sortBy(J,function(L){return L.text});return J}function s(){return H.getWifiAdvance()}function y(){return H.getWpsInfo()}function h(L){var K=L=="a"?F.NETWORK_MODES_BAND:F.NETWORK_MODES;if(L=="a"){l("#mode").hide();l("#modeFor5HZ").show();l("#modeLabel").attr("for","modeFor5HZ")}else{if(K.length==1){l("#mode").hide();l("#modeFor5HZ").hide()}else{l("#mode").show();l("#modeFor5HZ").hide()}}var J=[];for(var I=0;I<K.length;I++){J.push(new Option(K[I].name,K[I].value))}return J}function m(L,K){for(var J=0;J<K.length;J++){var I=K[J];if(I.text==L+" Mbps"){return I.value}}return"0"}function g(L,I){for(var K=0;K<I.length;K++){var J=l(I[K]);if(J.val().split("_")[0]==L){return J.val()}}return"0"}function p(){var K=this;var J=H.getWifiAdvance();K.origin_ap_station_enable=J.ap_station_enable;K.modes=e.observableArray(h(J.wifiBand));K.bands=e.observableArray(A());var I=D(J.wifiBand=="a");K.countries=e.observableArray(I);K.channels=e.observableArray(J.wifiBand=="a"?E(J.countryCode):a(J.countryCode));K.rates=e.observableArray(j(J.mode));K.hasAPStation=F.AP_STATION_SUPPORT;K.hasWifiSwitch=F.WIFI_SWITCH_SUPPORT;K.hasMultiSSID=F.HAS_MULTI_SSID;K.hasWlanMacfilter=F.HAS_BLACK_AND_WHITE_FILTER;K.hasWifiBand=e.observable(F.WIFI_BAND_SUPPORT);K.hasBandwidth=e.observable(F.WIFI_BANDWIDTH_SUPPORT);K.selectedMode=e.observable(J.mode);K.selectedChannel=e.observable(g(J.channel,K.channels()));K.selectedChannelBandwidth=e.observable(J.bandwidth);K.selectedCountry=e.observable(J.countryCode.toUpperCase());K.selectedBand=e.observable(J.wifiBand);K.selectedRate=e.observable(m(J.rate,K.rates()));var L=H.getWifiBasic();K.wifi_enable=e.observable(L.wifi_enable);if(F.HAS_MULTI_SSID&&((L.m_AuthMode=="OPEN"&&L.m_encryptType=="WEP")||(L.m_AuthMode=="SHARED"&&L.m_encryptType=="WEP")||L.m_encryptType=="TKIP")){K.isF=e.observable(true)}else{if((L.AuthMode=="OPEN"&&L.encryptType=="WEP")||(L.AuthMode=="SHARED"&&L.encryptType=="WEP")||L.encryptType=="TKIP"){K.isF=e.observable(true)}else{K.isF=e.observable(false)}}K.isShowSSIDInfoDiv=e.observable(false);if(F.WIFI_SWITCH_SUPPORT){if(L.wifi_enable=="1"){K.isShowSSIDInfoDiv(true)}else{K.isShowSSIDInfoDiv(false)}}else{K.isShowSSIDInfoDiv(true)}K.multi_ssid_enable=e.observable(L.multi_ssid_enable);K.origin_multi_ssid_enable=L.multi_ssid_enable;K.maxStationNumber=e.observable(J.MAX_Station_num);K.selectedStation=e.observable(J.MAX_Access_num);K.selectedStationM=e.observable(J.m_MAX_Access_num);K.oneBandTrans=e.observable(J.wifiBand=="a"?"5G":"2.4G");K.oneModeTrans=e.observable((J.wifiBand=="a"?"network_modes_band_select_":"network_mode_select_")+J.mode);K.channelBandwidths=e.computed(function(){if(F.WIFI_BANDWIDTH_SUPPORT_40MHZ){return t(true)}else{return t(false)}});J=l.extend(J,K);K.bandChangeHandler=function(){if(K.selectedBand()=="a"){K.modes(h(K.selectedBand()));K.countries(D(true))}else{K.modes(h(K.selectedBand()));K.countries(D(false))}K.selectedCountry("0");K.channels(K.generateChannelOption());K.selectedChannel("0")};K.countryChangeHandler=function(O,N){var M=K.generateChannelOption();K.channels(M);K.selectedChannel("0")};K.modeChangeHandler=function(O,N){var M=j(K.selectedMode());K.rates(M);K.selectedRate("0")};K.generateChannelOption=function(){if(K.selectedBand()=="a"){return E(K.selectedCountry())}else{return a(K.selectedCountry())}};K.save=function(){var M=y();if(M.wpsFlag=="1"){showAlert("wps_on_info");return}var P=l("#rate option:selected").text();var Q=null;if(P!=l.i18n.prop("rate_0")){Q=l.trim(P.replace("Mbps",""))}else{Q=0}var O={};O.countryCode=K.selectedCountry();O.mode=K.selectedMode();var N=K.selectedChannel();O.channel=N=="0"?"0":N.split("_")[0];O.rate=Q;O.wifiBand=K.selectedBand();if(F.WIFI_BANDWIDTH_SUPPORT){O.bandwidth=K.selectedChannelBandwidth()}O.station=K.selectedStation();O.m_station=K.selectedStationM();showConfirm("wifi_disconnect_confirm",function(){showLoading("waiting");H.setWifiAdvance(O,function(R){if(R.result=="success"){if(f){setTimeout(o,15000)}else{addInterval(i,1000)}}else{errorOverlay()}})})};K.checkSettings=function(N){var M=y();if(M.wpsFlag=="1"){showAlert("wps_on_info");return true}if(F.HAS_MULTI_SSID&&L.multi_ssid_enable=="1"){if((N=="ssid1"&&parseInt(K.selectedStation())+parseInt(L.m_MAX_Access_num)>L.MAX_Station_num)||(N=="ssid2"&&parseInt(K.m_selectedStation())+parseInt(L.MAX_Access_num)>L.MAX_Station_num)){showAlert({msg:"multi_ssid_max_access_number_alert",wifiParam:L.MAX_Station_num});return true}}return false};K.setMultiSSIDSwitch=function(){if(K.checkSettings("switch")){return}var N=function(){showLoading("waiting");var Q={};Q.m_ssid_enable=K.multi_ssid_enable();if(F.WIFI_SWITCH_SUPPORT){Q.wifiEnabled=K.wifi_enable()}H.setWifiBasicMultiSSIDSwitch(Q,function(R){if(R.result=="success"){if(f){setTimeout(M,15000)}else{addInterval(O,1000)}}else{errorOverlay()}})};var P=H.getStatusInfo();if(F.HAS_MULTI_SSID&&K.wifi_enable()=="1"){if(K.multi_ssid_enable()=="1"&&F.AP_STATION_SUPPORT&&K.origin_ap_station_enable=="1"){if(!P.wifiStatus){showConfirm("multi_ssid_enable_confirm",function(){N()})}else{showConfirm("multi_ssid_enable_confirm2",function(){N()})}}else{if(!P.wifiStatus){N()}else{showConfirm("wifi_disconnect_confirm2",function(){N()})}}}else{N()}function M(){successOverlay();setTimeout(function(){window.location.reload()},1000);clearTimer();clearValidateMsg();H.refreshAPStationStatus();c()}function O(){var Q=H.getWifiBasic();if(Q.wifi_enable==K.wifi_enable()){successOverlay();clearTimer();clearValidateMsg();H.refreshAPStationStatus();c()}}}}function r(){H.getParams({nv:"user_ip_addr"},function(I){H.getParams({nv:"station_list"},function(J){f=isWifiConnected(I.user_ip_addr,J.station_list)})})}function o(){successOverlay();setTimeout(function(){window.location.reload()},1000)}function i(){var I=H.getWifiBasic();if(I.wifi_enable=="1"){successOverlay();clearTimer();clearValidateMsg();c()}}function c(){var I=l("#container");e.cleanNode(I[0]);var J=new p();e.applyBindings(J,I[0]);addTimeout(function(){r()},600);if(F.WDS_SUPPORT){w()}else{if(F.AP_STATION_SUPPORT){B()}}l("#wifi_advance_form").validate({submitHandler:function(){J.save()}});l("#frmWifiSwitch").validate({submitHandler:function(){J.setMultiSSIDSwitch()}})}function w(){var I=H.getWdsInfo();if(I.currentMode=="0"){l(":input","#frmWifiSwitch,#wifi_advance_form").each(function(){l(this).prop("disabled",false)})}else{l(":input","#frmWifiSwitch,#wifi_advance_form").each(function(){l(this).prop("disabled",true)})}}function B(){var I=H.getAPStationBasic();if(I.ap_station_enable!="1"){l(":input","#wifi_advance_form").each(function(){l(this).prop("disabled",false)})}else{l(":input","#wifi_advance_form").each(function(){l(this).prop("disabled",true)})}}return{init:c}});define("wifi_ap_station","underscore jquery knockout set service".split(" "),function(k,g,m,e,j){var l=false;function h(){j.getParams({nv:"user_ip_addr"},function(n){j.getParams({nv:"station_list"},function(o){l=isWifiConnected(n.user_ip_addr,o.station_list)})})}function c(){var u=this;var w="";u.hasMultiSSID=e.HAS_MULTI_SSID;u.hasAPStation=e.AP_STATION_SUPPORT;u.hasWifiSwitch=e.WIFI_SWITCH_SUPPORT;u.hasWlanMacfilter=e.HAS_BLACK_AND_WHITE_FILTER;var x=k.map(e.AUTH_MODES_ALL,function(z){return new Option(z.name,z.value)});u.page={list:1,add:2,edit:3};var t=[{columnType:"radio",headerTextTrans:"option",rowText:"profileName",width:"10%"},{headerTextTrans:"ssid_title",rowText:"ssid",width:"30%"},{columnType:"image",headerTextTrans:"signal",rowText:"imgSignal",width:"30%"},{headerTextTrans:"security_mode",rowText:"authMode_show",width:"30%"}];var p=[{columnType:"radio",rowText:"index",width:"10%"},{headerTextTrans:"ssid_title",rowText:"ssid",width:"30%"},{columnType:"image",headerTextTrans:"signal",rowText:"imgSignal",width:"30%"},{headerTextTrans:"security_mode",rowText:"authMode_show",width:"30%"}];u.pageState=m.observable(u.page.list);var r=j.getAPStationBasic();u.origin_ap_station_enable=r.ap_station_enable;u.ap_station_enable=m.observable(r.ap_station_enable);u.apList=m.observable([]);if(u.origin_ap_station_enable=="1"){var y=j.getHotspotList();u.apList(b(y.hotspotList))}u.apSearchList=m.observable([]);u.connectButtonStatus=m.observable("disable");u.hasSelectFromUser=m.observable();u.showPassword=m.observable(false);u.isCableMode=m.observable();var o=j.getWifiBasic();u.wifi_enable=m.observable(o.wifi_enable);u.isShowSSIDInfoDiv=m.observable(false);if(e.WIFI_SWITCH_SUPPORT){if(o.wifi_enable=="1"){u.isShowSSIDInfoDiv(true)}else{u.isShowSSIDInfoDiv(false)}}else{u.isShowSSIDInfoDiv(true)}u.multi_ssid_enable=m.observable(o.multi_ssid_enable);u.showPasswordHandler=function(){g("#codeWPAKey").parent().find(".error").hide();g("#pwdWepKey").parent().find(".error").hide();var z=g("#showPassword:checked");if(z&&z.length==0){u.showPassword(true)}else{u.showPassword(false)}};u.showWPAPasswordHandler=function(){g("#codeWPAKey").parent().find(".error").hide();g("#pwdWepKey").parent().find(".error").hide();if(g("#showWPAPassword").is(":checked")){u.showPassword(true)}else{u.showPassword(false)}};u.apGrid=new m.simpleGrid.viewModel({idName:"profileName",data:u.apList(),tmplType:"list",pageSize:100,columns:t,primaryColumn:"fromProvider",radioClickHandler:function(){n()}});u.apSearchGrid=new m.simpleGrid.viewModel({data:u.apSearchList(),idName:"index",tmplType:"list",pageSize:100,columns:p,radioClickHandler:function(){var B=u.apSearchGrid.radioSelectValue();var z=u.apSearchList();for(var C=0;C<z.length;C++){var A=z[C];if(A.index==B){u.profileName("");u.ssid(A.ssid);w=A.ssid;u.signal(A.signal);u.authMode(A.authMode);u.password(A.password);u.mac(A.mac);if(A.authMode=="WPAPSKWPA2PSK"||A.authMode=="WPA2PSK"||A.authMode=="WPAPSK"||A.authMode=="WPA3Personal"||A.authMode=="WPA2WPA3"){u.encryptType_WPA(A.encryptType)}else{u.encryptType(A.encryptType)}u.keyID(A.keyID);renderCustomElement(g("#cipherGroup"));break}}}});u.computeConnectStatus=function(){n();var z=u.connectStatus();if(z=="ppp_connected"){u.current_status_trans("ap_station_wan_connected");u.current_status_text(g.i18n.prop("ap_station_wan_connected"));return}var A=u.connectWifiSSID();var B=u.connectWifiStatus();if(A&&B=="connect"){u.current_status_trans("ap_station_wlan_connected");u.current_status_text(g.i18n.prop("ap_station_wlan_connected"));return}u.current_status_trans("ap_station_no_connection");u.current_status_text(g.i18n.prop("ap_station_no_connection"))};function n(){var D=u.apGrid.radioSelectValue();if(!D){u.hasSelectFromUser(false);u.connectButtonStatus("disable");return}var A="";var z="";for(var C=0;C<u.apList().length;C++){var B=u.apList()[C];if(B.profileName==D){A=B.connectStatus;z=B.fromProvider;break}}if(A=="1"){u.connectButtonStatus("hide");u.hasSelectFromUser(false)}else{u.connectButtonStatus("show");u.hasSelectFromUser(z=="0")}}var s=j.getStatusInfo();u.networkType=m.observable(s.networkType);u.networkOperator=m.observable(s.networkOperator);u.connectStatus=m.observable(s.connectStatus);u.connectWifiStatus=m.observable(s.connectWifiStatus);u.connectWifiProfile=m.observable(s.connectWifiProfile);u.connectWifiSSID=m.observable(s.connectWifiSSID);u.current_status_trans=m.observable("");u.current_status_text=m.observable("");u.current_status=m.computed(function(){u.computeConnectStatus()});u.modes=x;u.profileName=m.observable("");u.ssid=m.observable();u.signal=m.observable("0");u.authMode=m.observable();u.password=m.observable();u.encryptType=m.observable();u.encryptType_WPA=m.observable("TKIPCCMP");u.keyID=m.observable("0");u.mac=m.observable();u.openAddPage=function(){if(d()){return}if(i()){return}u.clear();q()};u.openListPage=function(){if(d()){return}if(i()){return}u.clear();u.pageState(u.page.list);u.apGrid.data(u.apList());v.computeConnectStatus()};u.addHotspot=function(){if(d()){return}if(i()){return}if(u.pageState()==u.page.add&&u.apList().length>=e.AP_STATION_LIST_LENGTH){showAlert({msg:"ap_station_exceed_list_max",params:e.AP_STATION_LIST_LENGTH});return}showLoading("waiting");var A={};var z=u.apGrid.radioSelectValue();A.profileName=u.profileName();A.ssid=u.ssid();A.signal=u.signal();A.authMode=u.authMode();A.password=u.password();if(A.authMode=="SHARED"){A.encryptType="WEP"}else{if(A.authMode=="WPAPSKWPA2PSK"||A.authMode=="WPA2PSK"||A.authMode=="WPAPSK"||A.authMode=="WPA3Personal"||A.authMode=="WPA2WPA3"){A.encryptType=u.encryptType_WPA()}else{A.encryptType=u.encryptType()}}A.keyID=u.keyID();A.mac=(u.mac()==""||u.ssid()!=w)?"0F:00:00:00:00:00":u.mac();A.apList=u.apList();j.saveHotspot(A,function(B){u.callback(B,true)})};u.deleteHotspot=function(){if(d()){return}if(i()){return}showConfirm("confirm_data_delete",function(){var z={};z.profileName=u.apGrid.radioSelectValue();z.apList=u.apList();showLoading("waiting");j.deleteHotspot(z,function(A){u.callback(A,true)})})};u.openEditPage=function(){if(d()){return}if(i()){return}var C=u.apGrid.radioSelectValue();var z=u.apList();for(var B=0;B<z.length;B++){var A=z[B];if(A.profileName==C){u.profileName(C);u.ssid(A.ssid);u.signal(A.signal);u.authMode(A.authMode);u.password(A.password);u.mac(A.mac);if(A.authMode=="WPAPSKWPA2PSK"||A.authMode=="WPA2PSK"||A.authMode=="WPAPSK"||A.authMode=="WPA3Personal"||A.authMode=="WPA2WPA3"){u.encryptType_WPA(A.encryptType)}else{u.encryptType(A.encryptType)}u.keyID(A.keyID)}}u.pageState(u.page.edit)};u.connectHotspot=function(){if(d()){return}if(i()){return}var B=u.apGrid.radioSelectValue();var F=u.apList();function A(){showLoading("connecting");var J={};var I=-1;var K="";for(var H=0;H<F.length;H++){if(F[H].profileName==B){J.EX_SSID1=F[H].ssid;J.EX_AuthMode=F[H].authMode;J.EX_EncrypType=F[H].encryptType;J.EX_DefaultKeyID=F[H].keyID;J.EX_WEPKEY=F[H].password;J.EX_WPAPSK1=F[H].password;J.EX_wifi_profile=F[H].profileName;J.EX_mac=F[H].mac;I=H;K=F[H].ssid;break}}u.connectWifiSSID(K);u.connectWifiStatus("connecting");u.apGrid.setRadioSelect(B);u.connectButtonStatus("disable");j.connectHotspot(J,function(L){if(L&&L.result=="success"){u.connectButtonStatus("disable");addTimeout(E,3000)}else{if(L&&L.result=="processing"){showAlert("ap_station_processing")}else{var M=u.apList();M[I].connectStatus="0";u.connectWifiStatus("disconnect");u.connectButtonStatus("show");hideLoading();errorOverlay()}}var M=j.getHotspotList();u.apList(b(M.hotspotList));u.connectWifiProfile(B);u.connectWifiSSID(K);u.apGrid.data([]);u.apGrid.data(u.apList());u.apGrid.setRadioSelect(B)})}function G(K,I){var H=[];var M=[];for(var J=0;J<I.length;J++){if(I[J].fromProvider!="1"){if(I[J].profileName==K){M.push(F[J])}else{H.push(F[J])}}else{M.push(F[J])}}var L=M.concat(H);j.saveHotspot({apList:L},function(N){if(N&&N.result=="success"){F=L;u.apList(b(F))}})}var C=0;var D=false;var z=j.getStatusInfo();if(z.connectStatus=="ppp_connected"||z.connectStatus=="ppp_connecting"){showConfirm("ap_station_connect_change_alert",function(){showLoading();A()})}else{A()}function E(){C=C+1;if(C>60){hideLoading();errorOverlay();return}if(!D){var H=j.getStatusInfo();if(H.connectWifiStatus!="connect"){addTimeout(E,1000)}else{D=true}}if(D){j.getHotspotList({},function(M){for(var K=0,I=M.hotspotList.length;K<I;K++){var J=M.hotspotList[K];if(J.profileName==B){if(J.connectStatus=="1"){hideLoading();return}else{var L={msg:"ap_connect_error",params:[J.ssid]};showAlert(L);return}break}}addTimeout(E,1000)})}}};u.disconnectHotspot=function(){if(i()){return}showLoading("disconnecting");j.disconnectHotspot({},function(z){u.callback(z,true)})};function q(){var A=0;function z(){var B=j.getSearchHotspotList();if(B.scan_finish=="0"){if(A<=60){A=A+1;addTimeout(z,1000)}else{hideLoading();showAlert("ap_station_search_hotspot_fail")}}else{if("2"==B.scan_finish){hideLoading();showAlert("ap_station_processing")}else{u.apSearchList(b(B.hotspotList));u.apSearchGrid.data(u.apSearchList());hideLoading()}}}showLoading("scanning");j.searchHotspot({},function(B){if(B&&B.result=="processing"){hideLoading();showAlert("ap_station_processing")}else{if(B&&B.result=="success"){if(u.pageState()!=u.page.add){u.pageState(u.page.add)}z()}else{if(u.pageState()!=u.page.add){u.pageState(u.page.add)}hideLoading();showAlert("ap_station_search_hotspot_fail")}}})}u.clear=function(){u.apSearchGrid.clearRadioSelect();u.profileName("");u.ssid("");u.signal("0");u.authMode("OPEN");u.password("");u.encryptType("NONE");u.encryptType_WPA("TKIPCCMP");u.keyID("0");u.mac("")};u.apply=function(){if(d()){return}if(i()){return}function z(){showLoading("waiting");var B={};B.ap_station_enable=u.ap_station_enable();j.setAPStationBasic(B,function(C){if(u.origin_ap_station_enable==u.ap_station_enable()){u.callback(C,true)}else{u.callback2(C,true)}});j.refreshAPStationStatus()}if(!e.HAS_MULTI_SSID){z()}else{var A=j.getWifiBasic();if(u.ap_station_enable()=="1"&&A.multi_ssid_enable=="1"){showConfirm("ap_station_enable_confirm",z)}else{z()}}};u.searchHotspot=function(){if(d()){return}if(i()){return}q()};u.callback=function(A,z){if(A){if(z){f();g("#apList").translate()}if(A.result=="processing"){showAlert("ap_station_processing")}else{if(A.result=="spot_connected"||A.result=="spot_connecting"){showAlert("ap_station_update_fail")}else{if(A.result=="success"){successOverlay()}else{if(A.result=="exist"){showAlert("ap_station_exist")}else{errorOverlay()}}}}}else{errorOverlay()}};u.callback2=function(A,z){if(A){if(!l){addInterval(function(){var B=j.getWifiBasic();if(B.wifi_enable=="1"){clearTimer();clearValidateMsg();f();g("#apList").translate();if(A.result=="spot_connected"||A.result=="spot_connecting"){showAlert("ap_station_update_fail")}else{if(A.result=="success"){successOverlay()}else{errorOverlay()}}}},1000)}else{setTimeout(function(){if(A.result=="processing"){showAlert("ap_station_processing")}else{if(A.result=="spot_connecting"||A.result=="spot_connected"){showAlert("ap_station_update_fail")}else{if(A.result=="success"){successOverlay();setTimeout(function(){window.location.reload()},1000);clearTimer();clearValidateMsg();f()}else{errorOverlay()}}}},15000)}}else{errorOverlay()}};u.checkSettings=function(A){var z=j.getWpsInfo();if(z.wpsFlag=="1"){showAlert("wps_on_info");return true}if(e.HAS_MULTI_SSID&&r.multi_ssid_enable=="1"){if((A=="ssid1"&&parseInt(u.selectedStation())+parseInt(r.m_MAX_Access_num)>r.MAX_Station_num)||(A=="ssid2"&&parseInt(u.m_selectedStation())+parseInt(r.MAX_Access_num)>r.MAX_Station_num)){showAlert({msg:"multi_ssid_max_access_number_alert",params:r.MAX_Station_num});return true}}return false};u.setMultiSSIDSwitch=function(){if(u.checkSettings("switch")){return}var z=function(){showLoading("waiting");var B={};B.m_ssid_enable=u.multi_ssid_enable();if(e.WIFI_SWITCH_SUPPORT){B.wifiEnabled=u.wifi_enable()}j.setWifiBasicMultiSSIDSwitch(B,function(C){if(C.result=="success"){if(!l){addInterval(function(){var D=j.getWifiBasic();if(D.wifi_enable==u.wifi_enable()){successOverlay();clearTimer();clearValidateMsg();j.refreshAPStationStatus();f()}},1000)}else{setTimeout(function(){successOverlay();setTimeout(function(){window.location.reload()},1000);clearTimer();clearValidateMsg();j.refreshAPStationStatus();f()},15000)}}else{errorOverlay()}})};var A=j.getStatusInfo();if(e.HAS_MULTI_SSID&&u.wifi_enable()=="1"){if(u.multi_ssid_enable()=="1"&&e.AP_STATION_SUPPORT&&u.origin_ap_station_enable=="1"){if(!A.wifiStatus){showConfirm("multi_ssid_enable_confirm",function(){z()})}else{showConfirm("multi_ssid_enable_confirm2",function(){z()})}}else{if(!A.wifiStatus){z()}else{showConfirm("wifi_disconnect_confirm2",function(){z()})}}}else{z()}}}function i(){var n=j.getWpsInfo();if(n.wpsFlag=="1"){showAlert("wps_on_info");return true}}function b(o){var q=[];for(var n=0;n<o.length;n++){o[n].index=n;var p="";if(o[n].connectStatus!="1"){if(o[n].encryptType.toLowerCase()=="none"&&o[n].authMode.toLowerCase()=="open"){p="pic/wlan_signal_"+o[n].signal+".png"}else{p="pic/wlan_lock_signal_"+o[n].signal+".png"}}else{if(o[n].encryptType.toLowerCase()=="none"&&o[n].authMode.toLowerCase()=="open"){p="pic/wlan_connected.png"}else{p="pic/wlan_lock_connected.png"}}o[n].imgSignal=p;o[n].authMode_show=g.i18n.prop("ap_station_security_mode_"+o[n].authMode)}return o}function d(){var n=j.getWpsInfo();if(n.radioFlag=="0"){showAlert("wps_wifi_off");return true}}function a(n){g("#showWPAPassword").change(function(){n.showWPAPasswordHandler()});g("#showPassword").change(function(){n.showPasswordHandler()})}function f(){var n=new c();var o=g("#container")[0];m.cleanNode(o);m.applyBindings(n,o);a(n);p(true);clearTimer();addInterval(function(){p(false);h()},1000);g("#frmWifiSwitch").validate({submitHandler:function(){n.setMultiSSIDSwitch()}});g("#frmAPStation").validate({submitHandler:function(){n.addHotspot()},rules:{txtSSID:"ssid_ap"},errorPlacement:function(q,r){var s=r.attr("id");if(s=="txtWPAKey"||s=="codeWPAKey"){q.insertAfter("#lblshowWPAPassword")}else{if(s=="txtWepKey"||s=="pwdWepKey"){q.insertAfter("#lblShowPassword")}else{q.insertAfter(r)}}}});function p(q){var r=j.getStatusInfo();if(r.multi_ssid_enable!="1"){n.isCableMode(checkCableMode(r.blc_wan_mode));n.connectWifiProfile(r.connectWifiProfile);n.connectWifiSSID(r.connectWifiSSID);n.connectWifiStatus(r.connectWifiStatus);n.networkType(r.networkType);n.connectStatus(r.connectStatus);n.computeConnectStatus();j.getHotspotList({},function(t){var s=b(t.hotspotList);n.apList(s);var w=n.apGrid.data();if(s.length>0&&s[0].profileName!=w[0].profileName&&s[0].connectStatus=="1"){n.apGrid.data([]);n.apGrid.data(n.apList());n.apGrid.setRadioSelect(s[0].profileName)}renderCustomElement(g("#apList"));var u=g("input[type='radio']","#apList").each(function(){for(var z=0,x=s.length;z<x;z++){if(s[z].profileName==g(this).val()){var y=g(this).parent().parent().find("img")[0];y.src=s[z].imgSignal;if(q){if(s[z].connectStatus=="1"){n.hasSelectFromUser(false);n.connectButtonStatus("disable")}}}}})})}else{}}}return{init:f}});define("wifi_guest","underscore jquery knockout set service CryptoJS".split(" "),function(i,d,n,b,f,h){var m=false;function e(){f.getParams({nv:"user_ip_addr"},function(o){f.getParams({nv:"station_list"},function(p){m=isWifiConnected(o.user_ip_addr,p.station_list)})})}var j=i.map(b.WIFI_WEP_SUPPORT?b.AUTH_MODES_WEP:b.AUTH_MODES,function(o){return new Option(o.name,o.value)});function g(o){var p=[];for(var q=1;q<=o;q++){p.push(new Option(q,q))}return p}function l(){var r=this;var p=f.getWifiBasic();r.hasWifiSwitch=b.WIFI_SWITCH_SUPPORT;r.hasMultiSSID=b.HAS_MULTI_SSID;r.showIsolated=b.SHOW_WIFI_AP_ISOLATED;r.hasAPStation=b.AP_STATION_SUPPORT;r.hasWlanMacfilter=b.HAS_BLACK_AND_WHITE_FILTER;r.hasWifiWep=b.WIFI_WEP_SUPPORT;var o=f.getWifiAdvance();r.adBand=n.observable(o.wifiBand);r.adMode=n.observable(o.mode);r.showQRSwitch=b.WIFI_SUPPORT_QR_CODE&&b.WIFI_SUPPORT_QR_SWITCH;r.showQR=n.observable(p.m_show_qrcode_flag);if(b.WIFI_SUPPORT_QR_SWITCH){r.showQRCode=n.observable(b.WIFI_SUPPORT_QR_CODE&&r.showQR())}else{r.showQRCode=n.observable(b.WIFI_SUPPORT_QR_CODE)}if(b.WIFI_SUPPORT_QR_CODE){r.qrcodeSrc="./pic/qrcode_multi_ssid_wifikey.png?_="+d.now()}else{r.qrcodeSrc="./pic/res_blacktrans.png"}r.origin_ap_station_enable=p.ap_station_enable;r.wifi_enable=n.observable(p.wifi_enable);r.isShowSSIDInfoDiv=n.observable(false);if(b.WIFI_SWITCH_SUPPORT){if(p.wifi_enable=="1"){r.isShowSSIDInfoDiv(true)}else{r.isShowSSIDInfoDiv(false)}}else{r.isShowSSIDInfoDiv(true)}r.multi_ssid_enable=n.observable(p.multi_ssid_enable);r.origin_multi_ssid_enable=p.multi_ssid_enable;r.maxStationNumber=n.computed(function(){return b.MAX_STATION_NUMBER});r.modes=n.observableArray(j);r.selectedMode=n.observable(p.AuthMode);r.passPhrase=n.observable(p.passPhrase);r.showPassword=n.observable(false);r.ssid=n.observable(p.SSID);r.broadcast=n.observable(p.broadcast=="1"?"1":"0");r.apIsolation=n.observable(p.apIsolation=="1"?"1":"0");r.cipher=p.cipher;r.selectedStation=n.observable(p.MAX_Access_num);r.maxStations=n.observableArray(g(p.MAX_Station_num));r.m_modes=n.observableArray(j);r.m_selectedMode=n.observable(p.m_AuthMode);r.m_passPhrase=n.observable(p.m_passPhrase);r.m_showPassword=n.observable(false);r.m_ssid=n.observable(p.m_SSID);r.m_broadcast=n.observable(p.m_broadcast=="1"?"1":"0");r.m_apIsolation=n.observable(p.m_apIsolation=="1"?"1":"0");r.m_cipher=p.m_cipher;r.m_selectedStation=n.observable(p.m_MAX_Access_num);r.m_maxStations=n.observableArray(g(p.MAX_Station_num));r.m_encryptType=n.observable(p.m_encryptType);r.m_keyID=n.observable(p.m_keyID);r.m_wepPassword=n.observable("");r.clear=function(y){if(y=="switch"){r.multi_ssid_enable(p.multi_ssid_enable);r.wifi_enable(p.wifi_enable)}else{if(y=="ssid1"){r.selectedMode(p.AuthMode);r.passPhrase(p.passPhrase);r.ssid(p.SSID);r.broadcast(p.broadcast=="1"?"1":"0");r.cipher=p.cipher;r.selectedStation(p.MAX_Access_num);r.apIsolation(p.apIsolation=="1"?"1":"0")}else{if(y=="ssid2"){r.m_selectedMode(p.m_AuthMode);r.m_passPhrase(p.m_passPhrase);r.m_ssid(p.m_SSID);r.m_broadcast(p.m_broadcast=="1"?"1":"0");r.m_cipher=p.m_cipher;r.m_selectedStation(p.m_MAX_Access_num);r.m_apIsolation(p.m_apIsolation=="1"?"1":"0");if(b.WIFI_WEP_SUPPORT){r.m_encryptType(p.m_encryptType);r.m_keyID(p.m_keyID);r.m_wepPassword(r.getWepPassword())}}else{clearTimer();clearValidateMsg();c();f.refreshAPStationStatus()}}}};r.getWepPassword=function(){return r.m_keyID()=="3"?p.m_Key4Str1:(r.m_keyID()=="2"?p.m_Key3Str1:r.m_keyID()=="1"?p.m_Key2Str1:p.m_Key1Str1)};r.m_wepPassword(r.getWepPassword());r.profileChangeHandler=function(z,y){d("#pwdWepKey").parent().find("label[class='error']").hide();r.m_wepPassword(r.getWepPassword());return true};r.saveSSID1=function(){if(r.checkSettings("ssid1")){return}showConfirm("wifi_disconnect_confirm",function(){r.saveSSID1Action()})};r.saveSSID1Action=function(){showLoading("waiting");r.broadcast(d("#broadcastCheckbox:checked").length>0?"0":"1");r.apIsolation(d("#apisolatedCheckbox:checked").length);var y={};y.AuthMode=r.selectedMode();y.passPhrase=r.passPhrase();y.SSID=r.ssid();y.broadcast=r.broadcast();y.station=r.selectedStation();y.cipher=r.selectedMode()=="WPA2PSK"?1:2;if(y.AuthMode=="WPA3Personal"||y.AuthMode=="WPA2WPA3"){y.cipher=1}y.NoForwarding=r.apIsolation();y.show_qrcode_flag=r.showQR()==true?1:0;f.setWifiBasic(y,function(z){if(z.result=="success"){if(m){setTimeout(s,15000)}else{addInterval(q,1000)}}else{errorOverlay()}})};r.saveSSID2=function(){if(r.checkSettings("ssid2")){return}if(!b.PASSWORD_ENCODE){var y=new RegExp("(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,32}");if(!y.test(r.m_passPhrase())){showConfirm("password_note_too_low",function(){showConfirm("wifi_disconnect_confirm",function(){r.saveSSID2Action();return});return});return}}showConfirm("wifi_disconnect_confirm",function(){r.saveSSID2Action()})};r.saveSSID2Action=function(){showLoading("waiting");r.m_broadcast(d("#mBroadcastCheckbox:checked").length>0?"0":"1");r.m_apIsolation(d("#mApIsolatedCheckbox:checked").length);var A="";if(b.PASSWORD_ENCODE){A=r.m_passPhrase()}else{var z=f.getDeviceInfoLow();var B=h.enc.Latin1.parse(z.skey);var y=h.enc.Latin1.parse(z.siv);A=h.AES.encrypt(r.m_passPhrase(),B,{iv:y,mode:h.mode.CBC,padding:h.pad.ZeroPadding}).toString()}var D={};D.m_AuthMode=r.m_selectedMode();D.m_passPhrase=A;D.m_SSID=r.m_ssid();D.m_broadcast=r.m_broadcast();D.m_station=r.m_selectedStation();D.m_cipher=r.m_selectedMode()=="WPA2PSK"?1:2;if(D.m_AuthMode=="WPA3Personal"||D.m_AuthMode=="WPA2WPA3"){D.m_cipher=1}D.m_NoForwarding=r.m_apIsolation();D.m_show_qrcode_flag=r.showQR()==true?1:0;if(b.WIFI_WEP_SUPPORT){if(D.m_AuthMode=="SHARED"){D.m_encryptType="WEP"}else{if(D.m_AuthMode=="WPAPSKWPA2PSK"||D.m_AuthMode=="WPA2PSK"||D.m_AuthMode=="WPAPSK"||D.m_AuthMode=="WPA3Personal"||D.m_AuthMode=="WPA2WPA3"){}else{D.m_encryptType=r.m_encryptType()}}D.m_wep_default_key=r.m_keyID();D.m_wep_key_4=p.m_Key4Str1;D.m_wep_key_3=p.m_Key3Str1;D.m_wep_key_2=p.m_Key2Str1;D.m_wep_key_1=p.m_Key1Str1;var C="0";if(r.m_wepPassword().length=="13"||r.m_wepPassword().length=="5"){C="1"}else{C="0"}if(r.m_keyID()=="3"){D.m_wep_key_4=r.m_wepPassword();D.m_WEP4Select=C}else{if(r.m_keyID()=="2"){D.m_wep_key_3=r.m_wepPassword();D.m_WEP3Select=C}else{if(r.m_keyID()=="1"){D.m_wep_key_2=r.m_wepPassword();D.m_WEP2Select=C}else{D.m_wep_key_1=r.m_wepPassword();D.m_WEP1Select=C}}}}f.setWifiBasic4SSID2(D,function(E){if(E.result=="success"){if(m){setTimeout(t,15000)}else{addInterval(w,1000)}}else{errorOverlay()}})};function s(){successOverlay();setTimeout(function(){window.location.reload()},1000);r.clear()}function q(){var y=k();if(y.wifi_enable=="1"){successOverlay();r.clear()}}function t(){successOverlay();setTimeout(function(){window.location.reload()},1000);r.clear()}function w(){var y=k();if(y.wifi_enable=="1"){successOverlay();r.clear()}}r.checkSettings=function(A){var y=a();if(b.HAS_MULTI_SSID){if(A=="ssid1"||A=="ssid2"){if(A=="ssid2"){var z=f.getStatusInfo().ssid2AttachedNum;if(parseInt(r.m_selectedStation())<z){showAlert("Extend_accessDevice");return true}}else{var z=f.getStatusInfo().ssid1AttachedNum;if(parseInt(r.selectedStation())<z){showAlert("Extend_accessDevice");return true}}}}if(y.wpsFlag=="1"){showAlert("wps_on_info");return true}if(b.HAS_MULTI_SSID&&p.multi_ssid_enable=="1"){if((A=="ssid1"&&parseInt(r.selectedStation())+parseInt(p.m_MAX_Access_num)>p.MAX_Station_num)||(A=="ssid2"&&parseInt(r.m_selectedStation())+parseInt(p.MAX_Access_num)>p.MAX_Station_num)){showAlert({msg:"multi_ssid_max_access_number_alert",params:p.MAX_Station_num});return true}}return false};r.setMultiSSIDSwitch=function(){if(r.checkSettings("switch")){return}var A=function(){showLoading("waiting");var C={};C.m_ssid_enable=r.multi_ssid_enable();if(b.WIFI_SWITCH_SUPPORT){C.wifiEnabled=r.wifi_enable()}f.setWifiBasicMultiSSIDSwitch(C,function(D){if(D.result=="success"){if(m){setTimeout(y,15000)}else{addInterval(z,1000)}}else{errorOverlay()}})};function y(){successOverlay();setTimeout(function(){window.location.reload()},1000);r.clear()}function z(){var C=k();if(C.wifi_enable==r.wifi_enable()){successOverlay();r.clear()}}var B=f.getStatusInfo();if(b.HAS_MULTI_SSID&&r.wifi_enable()=="1"){if(b.AP_STATION_SUPPORT&&r.multi_ssid_enable()=="1"&&r.origin_ap_station_enable=="1"){if(!B.wifiStatus){showConfirm("multi_ssid_enable_confirm",function(){A()})}else{showConfirm("multi_ssid_enable_confirm2",function(){A()})}}else{if(!B.wifiStatus){A()}else{showConfirm("wifi_disconnect_confirm2",function(){A()})}}}else{A()}};r.showQRHandler=function(){var y=d("#showQR:checked");if(y&&y.length==0){r.showQR(true)}else{r.showQR(false)}r.showQRCode(b.WIFI_SUPPORT_QR_CODE&&r.showQR())};r.showPasswordHandler=u;r.m_showPasswordHandler=x;function u(){d("#passShow").parent().find(".error").hide();var y=d("#showPassword:checked");if(y&&y.length==0){r.showPassword(true)}else{r.showPassword(false)}}function x(){d("#m_passShow").parent().find(".error").hide();d("#m_pwdWepKey").parent().find(".error").hide();var y=d("#m_showPassword:checked");if(y&&y.length==0){r.m_showPassword(true)}else{r.m_showPassword(false)}}}function k(){return f.getWifiBasic()}function c(){var o=d("#container");n.cleanNode(o[0]);var q=new l();n.applyBindings(q,o[0]);addTimeout(function(){e()},600);function r(){var s=f.getAPStationBasic();if(s.ap_station_enable!="1"){d("#frmMultiSSID :input").each(function(){d(this).attr("disabled",false)})}else{d("#frmMultiSSID :input").each(function(){d(this).attr("disabled",true)})}}function p(){var s=f.getWdsInfo();if(s.currentMode=="0"){d("#frmWifiSwitch :input").each(function(){d(this).attr("disabled",false)});d("#frmSSID2 :input").each(function(){d(this).attr("disabled",false)});d("#frmSSID1 :input").each(function(){d(this).attr("disabled",false)})}else{d("#frmWifiSwitch :input").each(function(){d(this).attr("disabled",true)});d("#frmSSID2 :input").each(function(){d(this).attr("disabled",true)});d("#frmSSID1 :input").each(function(){d(this).attr("disabled",true)})}}if(b.WDS_SUPPORT){p()}else{if(b.AP_STATION_SUPPORT){r()}}d("#frmMultiSSID").validate({submitHandler:function(){q.setMultiSSIDSwitch()}});d("#frmWifiSwitch").validate({submitHandler:function(){q.setMultiSSIDSwitch()}});d("#frmSSID2").validate({submitHandler:function(){q.saveSSID2()},rules:{m_ssid:"ssid",m_pwdWepKey:{wifi_wep_password_check:true,wifi_password_check:true},m_txtWepKey:{wifi_wep_password_check:true,wifi_password_check:true},m_pass:"wifi_password_check",m_passShow:"wifi_password_check"},errorPlacement:function(s,t){var u=t.attr("id");if(u=="m_passShow"||u=="m_pass"){s.insertAfter("#m_lblShowPassword")}else{if(u=="m_txtWepKey"||u=="m_pwdWepKey"){s.insertAfter("#m_lblShowWepPassword")}else{s.insertAfter(t)}}}});d("#frmSSID1").validate({submitHandler:function(){q.saveSSID1()},rules:{pass:"wifi_password_check",ssid:"ssid",passShow:"wifi_password_check"},errorPlacement:function(s,t){var u=t.attr("id");if(u=="passShow"||u=="pass"){s.insertAfter("#lblShowPassword")}else{s.insertAfter(t)}}})}function a(){return f.getWpsInfo()}return{init:c}});define("wifi_mac_filter","underscore jquery knockout set service".split(" "),function(g,c,j,a,f){var i=false;function d(){f.getParams({nv:"user_ip_addr"},function(k){f.getParams({nv:"station_list"},function(l){i=isWifiConnected(k.user_ip_addr,l.station_list)})})}function e(){var n=this;n.hasAPStation=a.AP_STATION_SUPPORT;n.hasWifiSwitch=a.WIFI_SWITCH_SUPPORT;n.hasMultiSSID=a.HAS_MULTI_SSID;n.showIsolated=a.SHOW_WIFI_AP_ISOLATED;var m=f.getMacFilterInfo();var l=f.getWifiBasic();n.multi_ssid_enable=j.observable(l.multi_ssid_enable);n.origin_ap_station_enable=l.ap_station_enable;n.wifi_enable=j.observable(l.wifi_enable);n.isShowSSIDInfoDiv=j.observable(false);if(a.WIFI_SWITCH_SUPPORT){if(l.wifi_enable=="1"){n.isShowSSIDInfoDiv(true)}else{n.isShowSSIDInfoDiv(false)}}else{n.isShowSSIDInfoDiv(true)}n.selectedAction=j.observable(m.ACL_mode);n.mac1=j.observable("");n.mac2=j.observable("");n.mac3=j.observable("");n.mac4=j.observable("");n.mac5=j.observable("");n.mac6=j.observable("");n.mac7=j.observable("");n.mac8=j.observable("");n.mac9=j.observable("");n.mac10=j.observable("");if(m.ACL_mode=="1"){macInfoWhite=m.wifi_mac_white_list.split(";");n.mac1=j.observable(macInfoWhite[0]);n.mac2=j.observable(macInfoWhite[1]);n.mac3=j.observable(macInfoWhite[2]);n.mac4=j.observable(macInfoWhite[3]);n.mac5=j.observable(macInfoWhite[4]);n.mac6=j.observable(macInfoWhite[5]);n.mac7=j.observable(macInfoWhite[6]);n.mac8=j.observable(macInfoWhite[7]);n.mac9=j.observable(macInfoWhite[8]);n.mac10=j.observable(macInfoWhite[9])}else{if(m.ACL_mode=="2"){macInfoBlack=m.wifi_mac_black_list.split(";");n.mac1=j.observable(macInfoBlack[0]);n.mac2=j.observable(macInfoBlack[1]);n.mac3=j.observable(macInfoBlack[2]);n.mac4=j.observable(macInfoBlack[3]);n.mac5=j.observable(macInfoBlack[4]);n.mac6=j.observable(macInfoBlack[5]);n.mac7=j.observable(macInfoBlack[6]);n.mac8=j.observable(macInfoBlack[7]);n.mac9=j.observable(macInfoBlack[8]);n.mac10=j.observable(macInfoBlack[9])}}n.save=k;n.ChangeHandler=function(){c("#mac_filter_form").find(".error").hide();c("#mac_filter_form").find("input[type=text]").show();var o=f.getMacFilterInfo();if(n.selectedAction()=="1"){macInfoWhite=o.wifi_mac_white_list.split(";");n.mac1(macInfoWhite[0]);n.mac2(macInfoWhite[1]);n.mac3(macInfoWhite[2]);n.mac4(macInfoWhite[3]);n.mac5(macInfoWhite[4]);n.mac6(macInfoWhite[5]);n.mac7(macInfoWhite[6]);n.mac8(macInfoWhite[7]);n.mac9(macInfoWhite[8]);n.mac10(macInfoWhite[9])}else{if(n.selectedAction()=="2"){macInfoBlack=o.wifi_mac_black_list.split(";");n.mac1(macInfoBlack[0]);n.mac2(macInfoBlack[1]);n.mac3(macInfoBlack[2]);n.mac4(macInfoBlack[3]);n.mac5(macInfoBlack[4]);n.mac6(macInfoBlack[5]);n.mac7(macInfoBlack[6]);n.mac8(macInfoBlack[7]);n.mac9(macInfoBlack[8]);n.mac10(macInfoBlack[9])}else{n.mac1("");n.mac2("");n.mac3("");n.mac4("");n.mac5("");n.mac6("");n.mac7("");n.mac8("");n.mac9("");n.mac10("")}}};n.checkSettings=function(p){var o=f.getWpsInfo();if(o.wpsFlag=="1"){showAlert("wps_on_info");return true}return false};n.setMultiSSIDSwitch=function(){if(n.checkSettings("switch")){return}var o=q;var p=f.getStatusInfo();if(a.HAS_MULTI_SSID&&n.wifi_enable()=="1"){if(n.multi_ssid_enable()=="1"&&a.AP_STATION_SUPPORT&&n.origin_ap_station_enable=="1"){if(!p.wifiStatus){showConfirm("multi_ssid_enable_confirm",function(){o()})}else{showConfirm("multi_ssid_enable_confirm2",function(){o()})}}else{if(!p.wifiStatus){o()}else{showConfirm("wifi_disconnect_confirm2",function(){o()})}}}else{o()}function q(){showLoading("waiting");var r={};r.m_ssid_enable=n.multi_ssid_enable();if(a.WIFI_SWITCH_SUPPORT){r.wifiEnabled=n.wifi_enable()}f.setWifiBasicMultiSSIDSwitch(r,function(s){if(s.result=="success"){if(!i){addInterval(function(){var t=f.getWifiBasic();f.refreshAPStationStatus();if(t.wifi_enable==n.wifi_enable()){successOverlay();clearTimer();clearValidateMsg();f.refreshAPStationStatus();b()}},1000)}else{setTimeout(function(){successOverlay();setTimeout(function(){window.location.reload()},1000);clearTimer();clearValidateMsg();f.refreshAPStationStatus();b()},15000)}}else{errorOverlay()}})}};function k(){var r=f.getWpsInfo();if(r.wpsFlag=="1"){showAlert("wps_on_info");return true}if(n.mac1()==undefined||n.mac1().indexOf(" ")>=0){n.mac1("")}if(n.mac2()==undefined||n.mac2().indexOf(" ")>=0){n.mac2("")}if(n.mac3()==undefined||n.mac3().indexOf(" ")>=0){n.mac3("")}if(n.mac4()==undefined||n.mac4().indexOf(" ")>=0){n.mac4("")}if(n.mac5()==undefined||n.mac5().indexOf(" ")>=0){n.mac5("")}if(n.mac6()==undefined||n.mac6().indexOf(" ")>=0){n.mac6("")}if(n.mac7()==undefined||n.mac7().indexOf(" ")>=0){n.mac7("")}if(n.mac8()==undefined||n.mac8().indexOf(" ")>=0){n.mac8("")}if(n.mac9()==undefined||n.mac9().indexOf(" ")>=0){n.mac9("")}if(n.mac10()==undefined||n.mac10().indexOf(" ")>=0){n.mac10("")}var s=new Array(n.mac1(),n.mac2(),n.mac3(),n.mac4(),n.mac5(),n.mac6(),n.mac7(),n.mac8(),n.mac9(),n.mac10());if(n.selectedAction()=="2"&&m.client_mac_address!=""&&c.inArray(m.client_mac_address,s)!=-1){showAlert("black_yourself_tip");return false}var p=s.sort();for(var q=0;q<p.length-1;q++){if(p[q]!=""&&p[q]==p[q+1]){showAlert("mac_repeat_tip");return false}}var t="";for(var q=0;q<10;q++){if(t==""){t=s[q]}else{if(s[q]){t=t+";"+s[q]}}}var o={};o.ACL_mode=n.selectedAction();if(n.selectedAction()=="2"){o.wifi_mac_black_list=t}else{if(n.selectedAction()=="1"){o.wifi_mac_white_list=t}}showLoading("waiting");f.setMacFilter(o,function(u){if(u.result=="success"){successOverlay()}else{errorOverlay()}})}}function h(l){var k=c("#container");j.cleanNode(k[0]);j.applyBindings(l,k[0]);c("#frmWifiSwitch").validate({submitHandler:function(){l.setMultiSSIDSwitch()}});c("#mac_filter_form").validate({submitHandler:function(){l.save()},rules:{mac_1:"mac_check",mac_2:"mac_check",mac_3:"mac_check",mac_4:"mac_check",mac_5:"mac_check",mac_6:"mac_check",mac_7:"mac_check",mac_8:"mac_check",mac_9:"mac_check",mac_10:"mac_check"}})}function b(){var k=new e();h(k);addTimeout(function(){d()},600)}return{init:b}});define("wifi_main","underscore jquery knockout set service CryptoJS".split(" "),function(k,f,p,d,h,j){var l=k.map(d.WIFI_WEP_SUPPORT?d.AUTH_MODES_WEP:d.AUTH_MODES,function(q){return new Option(q.name,q.value)});function i(q){var r=[];for(var s=1;s<=q;s++){r.push(new Option(s,s))}return r}var o=false;function g(){h.getParams({nv:"user_ip_addr"},function(q){h.getParams({nv:"station_list"},function(r){o=isWifiConnected(q.user_ip_addr,r.station_list)})})}function c(){var w=this;var s=n();w.hasWifiSwitch=d.WIFI_SWITCH_SUPPORT;w.hasMultiSSID=d.HAS_MULTI_SSID;w.showIsolated=d.SHOW_WIFI_AP_ISOLATED;w.hasAPStation=d.AP_STATION_SUPPORT;w.hasWlanMacfilter=d.HAS_BLACK_AND_WHITE_FILTER;w.hasWifiWep=d.WIFI_WEP_SUPPORT;var q=h.getWifiAdvance();w.adBand=p.observable(q.wifiBand);w.adMode=p.observable(q.mode);w.showQRSwitch=d.WIFI_SUPPORT_QR_CODE&&d.WIFI_SUPPORT_QR_SWITCH;w.showQR=p.observable(s.show_qrcode_flag);if(d.WIFI_SUPPORT_QR_SWITCH){w.showQRCode=p.observable(d.WIFI_SUPPORT_QR_CODE&&w.showQR())}else{w.showQRCode=p.observable(d.WIFI_SUPPORT_QR_CODE)}if(d.WIFI_SUPPORT_QR_CODE){w.qrcodeSrc="./pic/qrcode_ssid_wifikey.png?_="+f.now()}else{w.qrcodeSrc="./pic/res_blacktrans.png"}w.origin_ap_station_enable=s.ap_station_enable;w.wifi_enable=p.observable(s.wifi_enable);w.isShowSSIDInfoDiv=p.observable(false);if(d.WIFI_SWITCH_SUPPORT){if(s.wifi_enable=="1"){w.isShowSSIDInfoDiv(true)}else{w.isShowSSIDInfoDiv(false)}}else{w.isShowSSIDInfoDiv(true)}w.multi_ssid_enable=p.observable(s.multi_ssid_enable);w.origin_multi_ssid_enable=s.multi_ssid_enable;w.maxStationNumber=p.computed(function(){return d.MAX_STATION_NUMBER});w.modes=p.observableArray(l);w.selectedMode=p.observable(s.AuthMode);w.passPhrase=p.observable(s.passPhrase);w.showPassword=p.observable(false);w.ssid=p.observable(s.SSID);w.broadcast=p.observable(s.broadcast=="1"?"1":"0");w.apIsolation=p.observable(s.apIsolation=="1"?"1":"0");w.cipher=s.cipher;w.selectedStation=p.observable(s.MAX_Access_num);w.maxStations=p.observableArray(i(s.MAX_Station_num));w.encryptType=p.observable(s.encryptType);w.keyID=p.observable(s.keyID);w.wepPassword=p.observable("");w.m_modes=p.observableArray(l);w.m_selectedMode=p.observable(s.m_AuthMode);w.m_passPhrase=p.observable(s.m_passPhrase);w.m_showPassword=p.observable(false);w.m_ssid=p.observable(s.m_SSID);w.m_broadcast=p.observable(s.m_broadcast=="1"?"1":"0");w.m_apIsolation=p.observable(s.m_apIsolation=="1"?"1":"0");w.m_cipher=s.m_cipher;w.m_selectedStation=p.observable(s.m_MAX_Access_num);w.m_maxStations=p.observableArray(i(s.MAX_Station_num));w.getWepPassword=function(){return w.keyID()=="3"?s.Key4Str1:(w.keyID()=="2"?s.Key3Str1:w.keyID()=="1"?s.Key2Str1:s.Key1Str1)};w.wepPassword(w.getWepPassword());w.profileChangeHandler=function(B,A){f("#pwdWepKey").parent().find("label[class='error']").hide();w.wepPassword(w.getWepPassword());return true};w.clear=function(A){if(A=="switch"){w.multi_ssid_enable(s.multi_ssid_enable);w.wifi_enable(s.wifi_enable)}else{if(A=="ssid2"){w.m_selectedMode(s.m_AuthMode);w.m_passPhrase(s.m_passPhrase);w.m_ssid(s.m_SSID);w.m_broadcast(s.m_broadcast=="1"?"1":"0");w.m_cipher=s.m_cipher;w.m_selectedStation(s.m_MAX_Access_num);w.m_apIsolation(s.m_apIsolation=="1"?"1":"0")}else{if(A=="ssid1"){w.selectedMode(s.AuthMode);w.passPhrase(s.passPhrase);w.ssid(s.SSID);w.broadcast(s.broadcast=="1"?"1":"0");w.cipher=s.cipher;w.selectedStation(s.MAX_Access_num);w.apIsolation(s.apIsolation=="1"?"1":"0");if(d.WIFI_WEP_SUPPORT){w.encryptType(s.encryptType);w.keyID(s.keyID);w.wepPassword(w.getWepPassword())}}else{clearTimer();clearValidateMsg();e()}}}};w.saveSSID1=function(){if(w.checkSettings("ssid1")){return}if(!d.PASSWORD_ENCODE){var A=new RegExp("(?=.*[0-9])(?=.*[a-zA-Z])(?=.*[^a-zA-Z0-9]).{8,32}");if(!A.test(w.passPhrase())){showConfirm("password_note_too_low",function(){showConfirm("wifi_disconnect_confirm",function(){w.saveSSID1Action();return});return});return}}showConfirm("wifi_disconnect_confirm",function(){w.saveSSID1Action()})};w.saveSSID1Action=t;w.saveSSID2=function(){if(w.checkSettings("ssid2")){return}showConfirm("wifi_disconnect_confirm",function(){w.saveSSID2Action()})};w.saveSSID2Action=r;w.checkSettings=function(C){var A=b();if(C=="ssid1"||C=="ssid2"){if(C=="ssid2"){var B=h.getStatusInfo().ssid2AttachedNum;if(parseInt(w.m_selectedStation())<B){showAlert("Extend_accessDevice");return true}}else{var B=h.getStatusInfo().ssid1AttachedNum;if(parseInt(w.selectedStation())<B){showAlert("Extend_accessDevice");return true}}}if(A.wpsFlag=="1"){showAlert("wps_on_info");return true}if(s.multi_ssid_enable=="1"&&d.HAS_MULTI_SSID){if((C=="ssid2"&&parseInt(w.m_selectedStation())+parseInt(s.MAX_Access_num)>s.MAX_Station_num)||(C=="ssid1"&&parseInt(w.selectedStation())+parseInt(s.m_MAX_Access_num)>s.MAX_Station_num)){showAlert({msg:"multi_ssid_max_access_number_alert",params:s.MAX_Station_num});return true}}return false};w.setMultiSSIDSwitch=function(){if(w.checkSettings("switch")){return}var B=function(){showLoading("waiting");var E={};E.m_ssid_enable=w.multi_ssid_enable();if(d.WIFI_SWITCH_SUPPORT){E.wifiEnabled=w.wifi_enable()}h.setWifiBasicMultiSSIDSwitch(E,function(F){if(F.result=="success"){if(o){setTimeout(A,15000)}else{addInterval(C,1000)}}else{errorOverlay()}})};function A(){successOverlay();setTimeout(function(){window.location.reload()},1000);h.refreshAPStationStatus();w.clear()}function C(){var E=n();h.refreshAPStationStatus();if(E.wifi_enable==w.wifi_enable()){successOverlay();w.clear()}}var D=h.getStatusInfo();if(d.HAS_MULTI_SSID&&w.wifi_enable()=="1"){if(w.multi_ssid_enable()=="1"&&d.AP_STATION_SUPPORT&&w.origin_ap_station_enable=="1"){if(!D.wifiStatus){showConfirm("multi_ssid_enable_confirm",function(){B()})}else{showConfirm("multi_ssid_enable_confirm2",function(){B()})}}else{if(!D.wifiStatus){B()}else{showConfirm("wifi_disconnect_confirm2",function(){B()})}}}else{B()}};w.showQRHandler=function(){var A=f("#showQR:checked");if(A&&A.length==0){w.showQR(true)}else{w.showQR(false)}w.showQRCode(d.WIFI_SUPPORT_QR_CODE&&w.showQR())};w.m_showPasswordHandler=function(){f("#m_passShow").parent().find(".error").hide();var A=f("#m_showPassword:checked");if(A&&A.length==0){w.m_showPassword(true)}else{w.m_showPassword(false)}};w.showPasswordHandler=function(){f("#codeWPAKey").parent().find(".error").hide();f("#pwdWepKey").parent().find(".error").hide();var A=f("#showPassword:checked");if(A&&A.length==0){w.showPassword(true)}else{w.showPassword(false)}};function r(){showLoading("waiting");var A={};A.m_AuthMode=w.m_selectedMode();A.m_passPhrase=w.m_passPhrase();A.m_SSID=w.m_ssid();A.m_broadcast=w.m_broadcast();A.m_station=w.m_selectedStation();A.m_cipher=w.m_selectedMode()=="WPA2PSK"?1:2;if(A.m_AuthMode=="WPA3Personal"||A.m_AuthMode=="WPA2WPA3"){A.m_cipher=1}A.m_NoForwarding=w.m_apIsolation();A.m_show_qrcode_flag=w.showQR()==true?1:0;h.setWifiBasic4SSID2(A,function(B){if(B.result=="success"){if(o){setTimeout(x,15000)}else{addInterval(z,1000)}}else{errorOverlay()}})}function x(){successOverlay();setTimeout(function(){window.location.reload()},1000);w.clear()}function z(){var A=n();if(A.wifi_enable=="1"){successOverlay();w.clear()}}function t(){showLoading("waiting");w.broadcast(f("#broadcastCheckbox:checked").length>0?"0":"1");w.apIsolation(f("#apisolatedCheckbox:checked").length);var D="";if(d.PASSWORD_ENCODE){D=w.passPhrase()}else{var B=h.getDeviceInfoLow();var E=j.enc.Latin1.parse(B.skey);var A=j.enc.Latin1.parse(B.siv);D=j.AES.encrypt(w.passPhrase(),E,{iv:A,mode:j.mode.CBC,padding:j.pad.ZeroPadding}).toString()}var F={};F.AuthMode=w.selectedMode();F.passPhrase=D;F.SSID=w.ssid();F.broadcast=w.broadcast();F.station=w.selectedStation();F.cipher=w.selectedMode()=="WPA2PSK"?1:2;if(F.AuthMode=="WPA3Personal"||F.AuthMode=="WPA2WPA3"){F.cipher=1}F.NoForwarding=w.apIsolation();F.show_qrcode_flag=w.showQR()==true?1:0;if(d.WIFI_WEP_SUPPORT){if(F.AuthMode=="WPAPSK"||F.AuthMode=="WPA2PSK"||F.AuthMode=="WPAPSKWPA2PSK"||F.AuthMode=="WPA3Personal"||F.AuthMode=="WPA2WPA3"){}else{if(F.AuthMode=="SHARED"){F.encryptType="WEP"}else{F.encryptType=w.encryptType()}}F.wep_default_key=w.keyID();F.wep_key_1=s.Key1Str1;F.wep_key_2=s.Key2Str1;F.wep_key_3=s.Key3Str1;F.wep_key_4=s.Key4Str1;var C="0";if(w.wepPassword().length=="5"||w.wepPassword().length=="13"){C="1"}else{C="0"}if(w.keyID()=="3"){F.wep_key_4=w.wepPassword();F.WEP4Select=C}else{if(w.keyID()=="2"){F.wep_key_3=w.wepPassword();F.WEP3Select=C}else{if(w.keyID()=="1"){F.wep_key_2=w.wepPassword();F.WEP2Select=C}else{F.wep_key_1=w.wepPassword();F.WEP1Select=C}}}}h.setWifiBasic(F,function(G){if(G.result=="success"){if(o){setTimeout(y,15000)}else{addInterval(u,1000)}}else{errorOverlay()}})}function y(){successOverlay();setTimeout(function(){window.location.reload()},1000);w.clear()}function u(){var A=n();if(A.wifi_enable=="1"){successOverlay();w.clear()}}}function b(){return h.getWpsInfo()}function n(){return h.getWifiBasic()}function e(){var q=f("#container");p.cleanNode(q[0]);var r=new c();p.applyBindings(r,q[0]);addTimeout(function(){g()},600);if(d.WDS_SUPPORT){m()}else{if(d.AP_STATION_SUPPORT){a()}}f("#frmSSID1").validate({submitHandler:function(){r.saveSSID1()},rules:{ssid:"ssid",pwdWepKey:{wifi_wep_password_check:true,wifi_password_check:true},txtWepKey:{wifi_wep_password_check:true,wifi_password_check:true},codeWPAKey:"wifi_password_check",txtWPAKey:"wifi_password_check"},errorPlacement:function(s,t){var u=t.attr("id");if(u=="codeWPAKey"||u=="txtWPAKey"){s.insertAfter("#lblshowWPAPassword")}else{if(u=="pwdWepKey"||u=="txtWepKey"){s.insertAfter("#lblShowWepPassword")}else{s.insertAfter(t)}}}});f("#frmSSID2").validate({submitHandler:function(){r.saveSSID2()},rules:{m_ssid:"ssid",m_pass:"wifi_password_check",m_passShow:"wifi_password_check"},errorPlacement:function(s,t){var u=t.attr("id");if(u=="m_pass"||u=="m_passShow"){s.insertAfter("#m_lblShowPassword")}else{if(u=="pass"||u=="passShow"){s.insertAfter("#lblShowPassword")}else{s.insertAfter(t)}}}});f("#frmWifiSwitch").validate({submitHandler:function(){r.setMultiSSIDSwitch()}});f("#frmMultiSSID").validate({submitHandler:function(){r.setMultiSSIDSwitch()}})}function m(){var q=h.getWdsInfo();if(q.currentMode=="0"){f("#frmWifiSwitch :input").each(function(){f(this).prop("disabled",false)});f("#frmSSID1 :input").each(function(){f(this).prop("disabled",false)});f("#frmSSID2 :input").each(function(){f(this).prop("disabled",false)})}else{f("#frmWifiSwitch :input").each(function(){f(this).prop("disabled",true)});f("#frmSSID1 :input").each(function(){f(this).prop("disabled",true)});f("#frmSSID2 :input").each(function(){f(this).prop("disabled",true)})}}function a(){var q=h.getAPStationBasic();if(q.ap_station_enable=="1"){f("#frmMultiSSID :input").each(function(){f(this).prop("disabled",true)})}else{f("#frmMultiSSID :input").each(function(){f(this).prop("disabled",false)})}}return{init:e}});define("wifi_sleep_mode","underscore jquery knockout set service".split(" "),function(i,d,k,b,e){function f(){return e.getSleepMode()}function l(){return e.getWifiRange()}var h=i.map(b.SLEEP_MODES,function(m){return new Option(m.name,m.value)});function g(){var w=this;var o=e.getExtraFunc();w.isCPE=b.PRODUCT_TYPE=="CPE";w.showTSWDiv=b.TSW_SUPPORT;w.showSleepDiv=k.observable(o.wifiSleepEnable);w.hasUpdateCheck=b.HAS_UPDATE_CHECK;w.hasDdns=b.DDNS_SUPPORT;var n=checkCableMode(e.getOpMode().blc_wan_mode);w.bandSelectFuncEnable=k.observable(o.bandSelectFuncEnable);if(w.bandSelectFuncEnable()=="2"&&!n){d(".bandSelect").attr("id","rootBandSelect")}else{if(w.bandSelectFuncEnable()=="1"&&!n){d(".bandSelect").attr("id","bandSelect")}else{d(".bandSelect").attr("id","removeBandSelect");d("#removeBandSelect").css("display","none")}}w.modes=k.observableArray(h);var s=f();w.selectedMode=k.observable(s.sleepMode);var p=l();w.wifiRangeMode=k.observable(p.wifiRangeMode);w.setWifiRange=u;w.setWifiRangeAct=q;w.setSleepMode=r;w.setSleepModeAct=x;var m=e.getTsw();w.openEnable=k.observable(m.openEnable==""?"0":m.openEnable);w.openH=k.observable(m.openH);w.openM=k.observable(m.openM);w.closeH=k.observable(m.closeH);w.closeM=k.observable(m.closeM);w.saveTsw=t;function u(){e.getWpsInfo({},function(y){if(y.wpsFlag=="1"){showAlert("wps_on_info")}else{if(y.radioFlag=="0"){showAlert("wps_wifi_off")}else{showConfirm("wifi_sleep_confirm",function(){showLoading("waiting");w.setWifiRangeAct()})}}})}function x(){var y={};y.sleepMode=w.selectedMode();e.setSleepMode(y,function(z){if(z.result!="success"){errorOverlay()}else{successOverlay()}})}function q(){var y={};y.wifiRangeMode=w.wifiRangeMode();e.setWifiRange(y,function(z){if(z.result!="success"){errorOverlay()}else{successOverlay()}})}function r(){showLoading("waiting");e.getWpsInfo({},function(y){if(y.wpsFlag=="1"){showAlert("wps_on_info")}else{if(y.radioFlag=="0"){showAlert("wps_wifi_off")}else{w.setSleepModeAct()}}})}function t(){if(w.openEnable()=="1"){if(Math.abs((w.openH()*60+parseInt(w.openM(),10))-(w.closeH()*60+parseInt(w.closeM(),10)))<10){showAlert("tsw_time_interval_alert");return false}showLoading("waiting");e.saveTsw({openEnable:w.openEnable(),closeEnable:w.openEnable(),openTime:leftInsert(w.openH(),2,"0")+":"+leftInsert(w.openM(),2,"0"),closeTime:leftInsert(w.closeH(),2,"0")+":"+leftInsert(w.closeM(),2,"0")},a,d.noop)}else{showLoading("waiting");e.saveTsw({openEnable:w.openEnable(),closeEnable:w.openEnable()},a,d.noop)}}}function j(n){var m=d("#container");k.cleanNode(m[0]);k.applyBindings(n,m[0]);d("#frmTsw").validate({submitHandler:function(){n.saveTsw()},errorPlacement:function(o,p){if(p.attr("name")=="closeM"||p.attr("name")=="closeH"){d("#closeErrorDiv").html(o)}else{if(p.attr("name")=="openM"||p.attr("name")=="openH"){d("#openErrorDiv").html(o)}else{o.insertAfter(p)}}}});d("#sleepModeForm").validate({submitHandler:function(){n.setSleepMode()}});d("#wifiRangeForm").validate({submitHandler:function(){n.setWifiRange()}})}function c(){var o=new g();j(o);var n=e.getPassword().CurrentPasswd;var m=e.getPassword().RootPasswd;if(n!=m&&n!="xfnj1234"){d("#rootBandSelect").css("display","none")}}function a(m){if(m&&m.result=="success"){successOverlay()}else{errorOverlay()}}return{init:c}});define("wifi_station_info","underscore jquery knockout set service menu".split(" "),function(g,d,i,b,f,a){var j={dealElement:function(l,k){if(k!="all"){if(!l){d("#edit_btn_"+k+",#hostname_txt_"+k).show();d("#save_btn_"+k+",#cancel_btn_"+k+",#hostname_input_"+k).hide()}else{d("#edit_btn_"+k+",#hostname_txt_"+k).hide();d("#save_btn_"+k+",#cancel_btn_"+k+",#hostname_input_"+k).show()}}else{d("input[id^='hostname_txt_'],a[id^='edit_btn_']").show();d("input[id^='hostname_input_'],a[id^='cancel_btn_'],a[id^='save_btn_']").hide()}},getHostName:function(n,m,l){var k=g.find(l,function(o){return o.mac==m});return k?k.hostname:n},parseBlackString:function(p,o){if(p==""){return[]}var m=p.split(";");var l=o.split(";");var k=[];for(var n=0;n<m.length;n++){k.push({hostName:l[n],macAddress:m[n]})}return k}};function e(){var p=this;var n={user_ip:"",macList:"",ACL_mode:2,hostnameList:""};p.showCableDiv=b.PRODUCT_TYPE=="CPE"&&b.RJ45_SUPPORT;p.supportBlock=b.STATION_BLOCK_SUPPORT;var m=a.findMenu("#parental_control");p.showPCLink=m&&m.length>0&&b.HAS_PARENTAL_CONTROL;p.deviceInfo=i.observableArray([]);p.cableDeviceInfo=i.observableArray([]);p.blackDevices=i.observableArray([]);p.blackDevicesMac=i.computed(function(){return g.map(p.blackDevices(),function(r){return r.macAddress})});p.showBlackDiv=i.observable(b.HAS_BLACK_AND_WHITE_FILTER?(n.ACL_mode=="2"?true:false):b.STATION_BLOCK_SUPPORT);i.computed(function(){p.deviceInfo();p.cableDeviceInfo();p.blackDevices();d("#station_info_div").translate()}).extend({notify:"always",throttle:300});var q=f.getHostNameList({}).devices;p.fetchAttachedDevices=function(r){f.getCurrentlyAttachedDevicesInfo({},function(s){if(l){return false}p.deviceInfo(g.map(s.attachedDevices,function(u,t){u.idx=g.uniqueId("wireless_");u.type=1;u.inBlackGroup=b.HAS_BLACK_AND_WHITE_FILTER&&n.ACL_mode!="2"?false:g.contains(p.blackDevicesMac(),u.macAddress);u.hostName=j.getHostName(u.hostName,u.macAddress,q);u.disableFlag=(b.HAS_BLACK_AND_WHITE_FILTER&&n.ACL_mode!="2")||u.inBlackGroup||l;return u}));d("#station_info_div").translate();if(g.isFunction(r)){r.apply(this)}})};p.fetchAttachedCableDevices=function(r){f.getAttachedCableDevices({},function(s){if(l){return false}p.cableDeviceInfo(g.map(s.attachedDevices,function(u,t){u.idx=g.uniqueId("cable_");u.hostName=j.getHostName(u.hostName,u.macAddress,q);u.type=2;return u}));d("#station_info_div").translate();if(g.isFunction(r)){r.apply(this)}})};p.fetchBlacklist=function(r){f.getMacFilterInfo({},function(s){n.ACL_mode=s.ACL_mode;n.user_ip=s.user_ip_addr;n.hostnameList=s.wifi_hostname_black_list;n.macList=s.wifi_mac_black_list;p.showBlackDiv(b.HAS_BLACK_AND_WHITE_FILTER?(n.ACL_mode=="2"?true:false):b.STATION_BLOCK_SUPPORT);var t=j.parseBlackString(s.wifi_mac_black_list,s.wifi_hostname_black_list);p.blackDevices(g.map(t,function(w,u){w.idx=g.uniqueId("black_");w.type=3;w.hostName=j.getHostName(w.hostName,w.macAddress,q);return w}));if(g.isFunction(r)){r.apply(this)}},d.noop)};p.fetchBlacklist();p.fetchAttachedDevices();if(p.showCableDiv){p.fetchAttachedCableDevices()}var l=0;addInterval(function(){if(l==0){p.fetchAttachedDevices()}},3000);if(p.showCableDiv){addInterval(function(){if(l==0){p.fetchAttachedCableDevices()}},5000)}p.wirelessBlockHandler=k;p.saveHostNameHandler=o;p.editHostNameHandler=function(r){l++;d("#hostname_input_"+r.idx).val(r.hostName);j.dealElement(true,r.idx);return false};p.cancelEditHostNameHandler=function(r){j.dealElement(false,r.idx);l--};p.cancelAllEditHostNameHandler=function(){j.dealElement(false,"all");l=0};p.blacklistRemoveHandler=function(r){if(n.macList.indexOf(r.macAddress)==-1){return false}if(l){p.cancelAllEditHostNameHandler()}showLoading("waiting");var u=[];var s=[];d.each(p.blackDevices(),function(w,x){if(x.macAddress!=r.macAddress){u.push(x.macAddress);s.push(x.hostName)}});var t={ACL_mode:"2",macFilteringMode:"2",wifi_hostname_black_list:s.join(";"),wifi_mac_black_list:u.join(";")};p.updateMacFilterList(t)};p.updateMacFilterList=function(r){f.setMacFilter(r,function(s){if(s.result=="success"){p.blackDevices([]);p.fetchBlacklist(function(){p.fetchAttachedDevices(function(){successOverlay()})})}},function(){errorOverlay()})};function o(r){var u=d("#hostname_input_"+r.idx);var t=u.val();if(t.indexOf(" ")==0||t.lastIndexOf(" ")==(t.length-1)||/[\*\$\[&:,;<>'"\\`\]￥]{1,32}/.test(t)){showAlert("device_rename");return false}else{if(t==""){d(".promptErrorLabel","#confirm-message-container").text(d.i18n.prop("required"));var s=u.closest("td").addClass("has-error");addTimeout(function(){s.removeClass("has-error")},5000);showAlert("required");return false}}showLoading("waiting");r.hostName=t;f.editHostName({hostname:r.hostName,mac:r.macAddress},function(){l=0;f.getHostNameList({},function(w){q=w.devices;if(r.type==3){p.fetchBlacklist(function(){hideLoading();successOverlay()})}else{if(r.type==2){p.fetchAttachedCableDevices(function(){hideLoading();successOverlay()})}else{if(r.type==1){p.fetchAttachedDevices(function(){hideLoading();successOverlay()})}}}})},function(){errorOverlay()})}function k(r){if(b.HAS_BLACK_AND_WHITE_FILTER&&n.ACL_mode!="2"){return false}if(n.macList.split(";").length==10){showAlert("black_list_max");return false}if(n.macList.indexOf(r.macAddress)!=-1){return false}if(r.ipAddress==n.user_ip){showAlert("black_yourself_tip");return false}if(l){p.cancelAllEditHostNameHandler()}showLoading("waiting");var t=n.hostnameList==""?r.hostName:r.hostName+";"+n.hostnameList;var s=n.macList==""?r.macAddress:r.macAddress+";"+n.macList;var u={ACL_mode:"2",wifi_hostname_black_list:t,wifi_mac_black_list:s};p.updateMacFilterList(u)}}function h(l){var k=d("#container")[0];i.cleanNode(k);i.applyBindings(l,k)}function c(){var k=new e();h(k)}return{init:c}});define("wifi_wps","underscore jquery knockout set service".split(" "),function(j,e,n,b,g){var l=false;function m(){var r=this;r.hasMultiSSID=b.HAS_MULTI_SSID;r.hasAPStation=b.AP_STATION_SUPPORT;r.hasWifiSwitch=b.WIFI_SWITCH_SUPPORT;r.hasWlanMacfilter=b.HAS_BLACK_AND_WHITE_FILTER;r.wpsType=n.observable("");r.wpsPin=n.observable("");var p=a();r.origin_ap_station_enable=p.ap_station_enable;r.wpsFlag=n.observable(p.wpsFlag);r.authMode=n.observable(p.authMode);r.radioFlag=n.observable(p.radioFlag);r.encrypType=n.observable(p.encrypType);r.mulOption=n.observable(h(p));r.wpsSSID=n.observable(i(p));var q=g.getWifiBasic();r.wifi_enable=n.observable(q.wifi_enable);r.isShowSSIDInfoDiv=n.observable(false);if(b.WIFI_SWITCH_SUPPORT){if(q.wifi_enable=="1"){r.isShowSSIDInfoDiv(true)}else{r.isShowSSIDInfoDiv(false)}}else{r.isShowSSIDInfoDiv(true)}r.multi_ssid_enable=n.observable(q.multi_ssid_enable);r.origin_multi_ssid_enable=q.multi_ssid_enable;r.save=o;if(p.wpsFlag!="0"){r.wpsType(p.wpsType=="PIN"?"PIN":"PBC")}else{r.wpsType("")}r.setMultiSSIDSwitch=function(){if(r.checkSettings("switch")){return}function t(){showLoading("waiting");var y={};y.m_ssid_enable=r.multi_ssid_enable();if(b.WIFI_SWITCH_SUPPORT){y.wifiEnabled=r.wifi_enable()}g.setWifiBasicMultiSSIDSwitch(y,function(z){if(z.result=="success"){if(!l){addInterval(x,1000)}else{setTimeout(u,15000)}}else{errorOverlay()}})}var s=t;var w=g.getStatusInfo();if(r.wifi_enable()=="1"&&b.HAS_MULTI_SSID){if(r.multi_ssid_enable()=="1"&&b.AP_STATION_SUPPORT&&r.origin_ap_station_enable=="1"){if(!w.wifiStatus){showConfirm("multi_ssid_enable_confirm",function(){s()})}else{showConfirm("multi_ssid_enable_confirm2",function(){s()})}}else{if(!w.wifiStatus){s()}else{showConfirm("wifi_disconnect_confirm2",function(){s()})}}}else{s()}function x(){var y=g.getWifiBasic();if(y.wifi_enable==r.wifi_enable()){successOverlay();clearTimer();clearValidateMsg();g.refreshAPStationStatus();d()}}function u(){successOverlay();setTimeout(function(){window.location.reload()},1000);clearTimer();clearValidateMsg();g.refreshAPStationStatus();d()}};r.checkSettings=function(t){var s=a();if(s.wpsFlag=="1"){showAlert("wps_on_info");return true}return false};function o(){var z=a();if(z.radioFlag=="0"){showAlert("wps_wifi_off");return}if(z.wpsFlag=="1"){showAlert("wps_on_info");return true}if(r.wpsSSID()=="SSID1"){var w=(z.AuthMode=="OPEN"&&z.encrypType=="WEP")||(z.AuthMode=="SHARED"&&z.encrypType=="WEP")||(z.AuthMode=="WPAPSK"&&z.encrypType=="TKIP")||(z.AuthMode=="WPAPSK"&&z.encrypType=="TKIPCCMP")||(z.AuthMode=="WPAPSK"&&z.encrypType=="AES")||(z.AuthMode=="WPA2PSK"&&z.encrypType=="TKIP")||(z.AuthMode=="WPAPSKWPA2PSK"&&z.encrypType=="TKIP")||(z.AuthMode=="WPA3Personal")||(z.AuthMode=="WPA2WPA3");if(w){showAlert("wps_auth_open");return}}else{var s=(z.m_AuthMode=="OPEN"&&z.m_encrypType=="WEP")||(z.m_AuthMode=="SHARED"&&z.m_encrypType=="WEP")||(z.m_AuthMode=="WPAPSK"&&z.m_encrypType=="TKIP")||(z.m_AuthMode=="WPAPSK"&&z.m_encrypType=="TKIPCCMP")||(z.m_AuthMode=="WPAPSK"&&z.m_encrypType=="AES")||(z.m_AuthMode=="WPA2PSK"&&z.m_encrypType=="TKIP")||(z.m_AuthMode=="WPAPSKWPA2PSK"&&z.m_encrypType=="TKIP")||(z.m_AuthMode=="WPA3Personal")||(z.m_AuthMode=="WPA2WPA3");if(s){showAlert("wps_auth_open");return}}var x;var u;if(r.wpsSSID()!="SSID1"){x=z.multiSSID;u=2}else{x=z.ssid;u=1}var t=g.getWifiBasic();if(x==t.m_SSID&&u==2){if(t.m_broadcast=="1"){showAlert("wps_ssid_broadcast_disable");return}}else{if(x==t.SSID&&u==1){if(t.broadcast=="1"){showAlert("wps_ssid_broadcast_disable");return}}}showLoading("waiting");var y={};y.wpsType=r.wpsType();y.wpsSSID=x;y.wpsIndex=u;y.wpsPin=c(r.wpsPin());g.openWps(y,function(A){if(A.result!="success"){errorOverlay()}else{r.wpsPin("");clearValidateMsg();successOverlay()}})}}function c(o){if(o.length!=9){return o}else{return o.substring(0,4)+o.substring(5)}}function a(){return g.getWpsInfo()}function h(p){var o=[];o.push(new Option(p.ssid,"SSID1"));if(p.ssidEnable=="1"){o.push(new Option(p.multiSSID,"SSID2"))}return o}function f(){g.getParams({nv:"user_ip_addr"},function(o){g.getParams({nv:"station_list"},function(p){l=isWifiConnected(o.user_ip_addr,p.station_list)})})}function k(p){var o=e("#container");n.cleanNode(o[0]);n.applyBindings(p,o[0]);addTimeout(function(){f()},600);e("#wpsForm").validate({submitHandler:function(){p.save()},rules:{txtPin:{wps_pin_validator:true}}});e("#frmWifiSwitch").validate({submitHandler:function(){p.setMultiSSIDSwitch()}})}function i(o){if(o.ssid!=o.multiSSID){return o.wpsSSID==o.multiSSID?"SSID2":"SSID1"}else{if(o.wifi_wps_index=="2"){return"SSID2"}else{return"SSID1"}}}function d(){var o=new m();k(o)}return{init:d}});