define(["browser","dom","layoutManager","css!bower_components/emby-webcomponents/viewmanager/viewcontainer-lite"],function(browser,dom,layoutManager){"use strict";function enableAnimation(){return!browser.tv&&(!forceDisableAnimation&&(!(window.MainActivity&&window.MainActivity.getChromeVersion()<=53)&&browser.supportsCssAnimation()))}function loadView(options){if(!options.cancel){cancelActiveAnimations();var selected=selectedPageIndex,previousAnimatable=selected==-1?null:allPages[selected],pageIndex=selected+1;pageIndex>=pageContainerCount&&(pageIndex=0);var newViewInfo=normalizeNewView(options),newView=newViewInfo.elem,dependencies="string"==typeof newView?null:newView.getAttribute("data-require");dependencies=dependencies?dependencies.split(","):[];var isPluginpage=options.url.toLowerCase().indexOf("/configurationpage?")!=-1;return isPluginpage&&(dependencies.push("jqmpopup"),dependencies.push("legacy/dashboard"),dependencies.push("legacy/selectmenu"),dependencies.push("jqmlistview"),dependencies.push("fnchecked")),(isPluginpage||newView.classList&&newView.classList.contains("type-interior"))&&(dependencies.push("scripts/notifications"),dependencies.push("css!css/notifications.css"),dependencies.push("dashboardcss")),new Promise(function(resolve,reject){require(dependencies,function(){var currentPage=allPages[pageIndex];currentPage&&triggerDestroy(currentPage);var view=newView;"string"==typeof view&&(view=document.createElement("div"),view.innerHTML=newView),view.classList.add("mainAnimatedPage"),currentPage?newViewInfo.hasScript&&window.$?(view=$(view).appendTo(mainAnimatedPages)[0],mainAnimatedPages.removeChild(currentPage)):mainAnimatedPages.replaceChild(view,currentPage):newViewInfo.hasScript&&window.$?view=$(view).appendTo(mainAnimatedPages)[0]:mainAnimatedPages.appendChild(view),"string"!=typeof newView&&enhanceNewView(dependencies,view),options.type&&view.setAttribute("data-type",options.type);var properties=[];options.fullscreen&&properties.push("fullscreen"),properties.length&&view.setAttribute("data-properties",properties.join(","));var animatable=view;allPages[pageIndex]=view,onBeforeChange&&onBeforeChange(view,!1,options),beforeAnimate(allPages,pageIndex,selected),animate(animatable,previousAnimatable,options.transition,options.isBack).then(function(){selectedPageIndex=pageIndex,currentUrls[pageIndex]=options.url,!options.cancel&&previousAnimatable&&afterAnimate(allPages,pageIndex),document.dispatchEvent(new CustomEvent("scroll",{})),window.$&&($.mobile=$.mobile||{},$.mobile.activePage=view),resolve(view)})})})}}function enhanceNewView(dependencies,newView){for(var hasJqm=!1,i=0,length=dependencies.length;i-->",""));var wrapper=document.createElement("div");return wrapper.innerHTML=html,wrapper.querySelector('div[data-role="page"]')}function normalizeNewView(options){if(options.view.indexOf('data-role="page"')==-1)return options.view;var hasScript=options.view.indexOf("