define(["jQuery","libraryBrowser","imageLoader","indicators","loading"],function($,libraryBrowser,imageLoader,indicators,loading){"use strict";function reload(page){var id=getParameterByName("id");loading.show(),ApiClient.getJSON(ApiClient.getUrl("Social/Shares/Public/"+id+"/Item")).then(function(item){reloadFromItem(page,item)})}function reloadFromItem(page,item){currentItem=item,libraryBrowser.renderName(item,$(".itemName",page)[0],!1),libraryBrowser.renderParentName(item,$(".parentName",page)[0]),libraryBrowser.renderDetailPageBackdrop(page,item,ApiClient,imageLoader,indicators),renderImage(page,item),setInitialCollapsibleState(page,item),ItemDetailPage.renderDetails(page,item,null,!0),loading.hide()}function setInitialCollapsibleState(page,item){$(".collectionItems",page).empty(),item.MediaSources&&item.MediaSources.length&&ItemDetailPage.renderMediaSources(page,null,item);var chapters=item.Chapters||[];chapters.length?($("#scenesCollapsible",page).show(),ItemDetailPage.renderScenes(page,item,null,3,!0)):$("#scenesCollapsible",page).hide(),item.People&&item.People.length?($("#castCollapsible",page).show(),ItemDetailPage.renderCast(page,item,null,6,!0)):$("#castCollapsible",page).hide()}function renderImage(page,item){libraryBrowser.renderDetailImage(page,page.querySelector(".detailImageContainer"),item,ApiClient,!1,imageLoader,indicators)}var currentItem;$(document).on("pageinit","#publicSharedItemPage",function(){var page=this;$(page).on("click",".moreScenes",function(){ItemDetailPage.renderScenes(page,currentItem,null,null,!0)}).on("click",".morePeople",function(){ItemDetailPage.renderCast(page,currentItem,null,null,!0)})}).on("pageshow","#publicSharedItemPage",function(){var page=this;reload(page)})});