define(["./layoutmanager.js","./backdrop/backdrop.js","./common/usersettings/usersettings.js","./emby-apiclient/connectionmanager.js"],function(_layoutmanager,_backdrop,_usersettings,_connectionmanager){function showBackdrop(view,type,parentId){var apiClient=_connectionmanager.default.currentApiClient();apiClient&&(view.backdropItems?_backdrop.default.setBackdrops(view.backdropItems):function(apiClient,types,parentId){return types={SortBy:"Random",Limit:20,Recursive:!0,IncludeItemTypes:types,ImageTypes:"Backdrop",ParentId:parentId,EnableTotalRecordCount:!1,ImageTypeLimit:1,EnableImageTypes:"Backdrop"},apiClient.getItems(apiClient.getCurrentUserId(),types)}(apiClient,type,parentId).then(function(result){result.Items.length?(result=result.Items,view.backdropItems=result,_backdrop.default.setBackdrops(result)):_backdrop.default.clear()}))}document.addEventListener("viewshow",function(e){var detail=e.detail,backdropItemTypes=detail.backdropItemTypes;backdropItemTypes&&!_layoutmanager.default.tv&&_usersettings.default.enableBackdrops()&&(detail=(detail=detail.params)?detail.parentId:null,showBackdrop(e.target,backdropItemTypes,detail))}),document.addEventListener("viewdestroy",function(e){e=e.target;e.backdropItems&&(e.backdropItems=null)})});