function RenameDevices(){function r(){}function i(){return e}function s(){var e=funcObj.setupWizard.get_current_device();showDebug==2&&console.log("set_rename_devices: "+e),funcObj.setupWizard.set_page("name_device")}function o(){var e='<section id="unnamed_device_form">';e+='<form id="unnamed_devices_form" data-path="name">';var t=funcObj.setupWizard.get_current_device(),n=[t];for(var r=0;r<n.length;r++){var i=n[r],s=funcObj.setupWizard.get_device_info(i);if(s!=undefined){var o="",u=$(s).find("name").text();u=funcObj.setupWizard.get_device_default_string(u);if(u.match(/^bose\s/i)){var a=$(s).find("type").text();u=funcObj.setupWizard.get_device_default_name(a)}e+='<div class="device_row">',e+='<div class="unnamed_device">',e+='<div class="device_image" style="background-image: url(\''+funcObj.setupWizard.parseImage(s)+"')\"></div>",e+="</div>",e+='<div class="text_input required">',e+='<label for="device_'+i.uID+'">'+funcObj.stringController.get_string("device_name")+"</label>",e+='<span class="warning">*'+funcObj.stringController.get_string("caps_lock_on")+"</span>",e+='<input spellcheck="false" autocomplete="off" autocorrect="off" autocapitalize="on" type="text" class="required validate_inline" maxlength="32" id="device_'+i.uID+'" name="device_'+i.uID+'" value="'+u+'" placeholder="'+"*"+funcObj.stringController.get_string("required")+'"'+o+" />",e+='<div id="device_name_error" class="input_error"></div>',e+="</div>",e+="</div>"}}e+="</form>",e+="</section>",funcObj.setupWizard.populate_content_area(e),$(".validate_inline").trigger("input")}function u(){var r=funcObj.setupWizard.get_current_device();n=new Array,t=[r],e=[r],showDebug==2&&console.log("do_rename_devices: "+t.length+" / "+e.length),e.length==0?($("#wizard_content header p#error_message").length==0?$("#wizard_content header").html($("#wizard_content header").html()+'<p id="error_message" style="color: red;">Please select the devices you would like to set up.</p>'):$("p#error_message").html("Please select the devices you would like to set up."),funcObj.setupWizard.enable_buttons(),funcObj.setupWizard.set_page_visuals()):t.length==0?c():t.length>0&&(funcObj.setupWizard.set_renaming_devices(!0),e.length==1?funcObj.setupWizard.set_popup("renaming_devices_single"):e.length>1&&funcObj.setupWizard.set_popup("renaming_devices_multiple"),setTimeout(function(){var e=funcObj.setupWizard.get_renaming_devices();if(e){var r="name",i=new Array;for(var s=0;s<t.length;s++){var o=t[s],u,l=funcObj.setupWizard.get_unnamed_devices_form_xml();$(l).find("input").each(function(){var e=$(this).attr("name").split("_")[1];e==o.uID&&(u=this)});var c=$(u).attr("value");i.push("<name>"+funcObj.setupWizard.XML_escape(c)+"</name>")}var h,p=a,d=f,v=t,m=n,g=!0;funcObj.WebsocketController.do_obtrusive_websocket_action(r,i,h,p,d,v,m,g)}},2e3))}function a(e,t,n,r,i){setTimeout(function(){funcObj.setupWizard.get_renaming_devices()&&u()},3e3)}function f(e,t,n,r){funcObj.setupWizard.get_renaming_devices()&&(funcObj.setupWizard.device_arrays_match(e,t)?c():n.length>0||r.length>0)}function l(){funcObj.setupWizard.set_setting_device_language_after_rename(!1),funcObj.setupWizard.set_renaming_devices(!1),funcObj.setupWizard.close_popup()}function c(){showDebug==2&&console.log("rename_devices_done"),funcObj.setupWizard.set_renaming_devices(!1),funcObj.AddDevicesToAccount.add_devices_to_marge_after_rename()}function h(){showDebug==2&&console.log("redirect_away_from_name_devices"),funcObj.setupWizard.single_device_setup_done();var e=funcObj.devCon.getDevices();e=funcObj.setupWizard.get_devices_notassociated_with_current_account(e),e=funcObj.setupWizard.get_incomplete_devices(e),e.length>0?funcObj.setupWizard.set_page("set_up_another_device"):funcObj.Lightswitch.do_pair_lightswitch()}var e=new Array,t=new Array,n=new Array;this.set_rename_devices=s,this.set_rename_devices_form_content=o,this.do_rename_devices=u,this.get_devices_in_rename_screen=i,this.rename_devices_cancel=l,this.redirect_away_from_name_devices=h,r()};