function Lightswitch(){function t(){}function n(e){var t=!1;if(e!==undefined&&e.infoXML!==undefined){switch($(e.infoXML).find("type").text().toLowerCase()){case"colin":case"soundtouch sa-4":case"luke":case"soundtouch stereo jc":t=!0;break;default:}$(e.infoXML).find("moduleType").text()==="sm2"&&(t=!1)}return t}function r(){e=0,s()}function i(){e++,s()}function s(){var t=funcObj.setupWizard.get_completed_devices_arr();if(e>t.length-1)funcObj.setupWizard.set_lightswitch_now_pairing(!1),funcObj.setupWizard.set_current_device(undefined),f();else{funcObj.setupWizard.set_current_device(t[e]);var r=funcObj.setupWizard.get_current_device();if(n(r)){funcObj.setupWizard.set_lightswitch_now_pairing(!0),funcObj.setupWizard.set_page("lightswitch_prompt_colin_luke"),funcObj.WebsocketController.remove_unfinished_unobtrusive_websocket_calls("cancelPairLightswitch",[r]);var s="pairLightswitch",a=new Array,l=u,c=o,h,p=[r],d=new Array,v=!0;funcObj.WebsocketController.do_obtrusive_websocket_action(s,a,l,c,h,p,d,v)}else i()}}function o(e,t,n,r,i){var s=funcObj.setupWizard.get_lightswitch_now_pairing();if(s){funcObj.setupWizard.set_lightswitch_now_pairing(!1);switch($(r).find("error").attr("value")){case"2008":funcObj.setupWizard.set_popup("lightswitch_already_paired");break;case"2007":case"2009":case"2010":case"2011":case"2012":case"2013":default:funcObj.setupWizard.set_popup("lightswitch_pairing_failure");break;case"2014":funcObj.setupWizard.set_popup("lightswitch_pairing_problem")}}}function u(e,t,n,r,i){var s=funcObj.setupWizard.get_lightswitch_now_pairing();s&&(funcObj.setupWizard.set_lightswitch_now_pairing(!1),funcObj.setupWizard.set_page("lightswitch_pairing_complete"))}function a(){funcObj.WebsocketController.remove_unfinished_unobtrusive_websocket_calls("pairLightswitch",[e]),funcObj.setupWizard.set_lightswitch_now_pairing(!1);var e=funcObj.setupWizard.get_current_device(),t="cancelPairLightswitch",n=new Array,r,i,s,o=[e],u=new Array;funcObj.WebsocketController.do_unobtrusive_websocket_action(t,n,r,i,s,o,u),funcObj.setupWizard.set_popup("lightswitch_prompt_decline")}function f(){var e=funcObj.setupWizard.get_startUpPage(),t=funcObj.setupWizard.get_bose_accountID(),n=funcObj.setupWizard.get_show_discovery_issue_success_popup(),r=funcObj.setupWizard.get_discovery_network_error();showDebug==2&&console.log("redirect_after_lightswitch_pairing: "+e+" / "+t),t==undefined?funcObj.setupWizard.set_page("create_bose_account"):n?r?funcObj.setupWizard.set_popup("app_block_ip_success"):funcObj.setupWizard.set_popup("no_block_ip_success"):e=="index.html"?funcObj.setupWizard.exit_setup():funcObj.setupWizard.setup_done()}var e;this.do_pair_lightswitch=r,this.pair_lightswitch_next=i,this.pair_lightswitch_current=s,this.lightswitch_pairing_skip=a,t()};