define(["jQuery","loading","libraryMenu","listViewStyle","emby-linkbutton"],function($,loading,libraryMenu){"use strict";function deleteDevice(page,id){var msg=Globalize.translate("DeleteDeviceConfirmation");require(["confirm"],function(confirm){confirm(msg,Globalize.translate("HeaderDeleteDevice")).then(function(){loading.show(),ApiClient.ajax({type:"DELETE",url:ApiClient.getUrl("Devices",{Id:id})}).then(function(){loadData(page)})})})}function load(page,devices){var html="";devices.length&&(html+='
'),html+=devices.map(function(d){var deviceHtml="";return deviceHtml+='
',deviceHtml+='
tablet_android',deviceHtml+=d.AppName&&d.LastUserName?'
':'
',deviceHtml+='
',deviceHtml+='',deviceHtml+=d.Name,deviceHtml+="
",d.AppName&&(deviceHtml+='',deviceHtml+=d.AppName,deviceHtml+="
"),d.LastUserName&&(deviceHtml+='',deviceHtml+=Globalize.translate("DeviceLastUsedByUserName",d.LastUserName),deviceHtml+="
"),deviceHtml+="",deviceHtml+="
",deviceHtml+='
',deviceHtml+="
"}).join(""),devices.length&&(html+="
");var elem=$(".devicesList",page).html(html).trigger("create");$(".btnDeleteDevice",elem).on("click",function(){deleteDevice(page,this.getAttribute("data-id"))})}function loadData(page){loading.show(),ApiClient.getJSON(ApiClient.getUrl("Devices",{SupportsPersistentIdentifier:!0})).then(function(result){load(page,result.Items),loading.hide()})}$(document).on("pageshow","#devicesPage",function(){var page=this;loadData(page)})});