define(["exports","./../emby-apiclient/connectionmanager.js","./../dom.js","./../common/playback/playbackmanager.js","./../common/methodtimer.js"],function(_exports,_connectionmanager,_dom,_playbackmanager,_methodtimer){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var uiDependencies=["css!modules/backdrop/style.css"],supportsAsyncDecodedImages=_dom.default.supportsAsyncDecodedImages(),supportsObjectFit=CSS.supports("object-fit","contain"),supportsImgSrcSet="srcset"in HTMLImageElement.prototype,RotationIntervalMs=24e3;uiDependencies.length&&require(uiDependencies);var backdropContainer,supportsCssAnimations=CSS.supports("animation-name","a");function enableAnimation(){return supportsCssAnimations&&_dom.default.supportsEventListenerOnce()}function enableRotation(){return!!enableAnimation()}function Backdrop(){}function mapImageSourceToUrl(source){return source.url}function getImageInfoId(imageInfo){var id=imageInfo.id;return id=id||(imageInfo.id=imageInfo.sources.map(mapImageSourceToUrl).join("|"))}function getFallbackImageSource(imageInfo){return imageInfo.sources[imageInfo.sources.length-1]}function mapSourceToString(source){return source.url+" "+source.width+"w"}Backdrop.prototype.load=function(imageInfo,animate,parent,existingBackdropImage){var img=new Image,self=(img.setAttribute("data-id",getImageInfoId(imageInfo)),img.setAttribute("draggable","false"),img.setAttribute("fetchpriority","low"),supportsObjectFit&&(supportsAsyncDecodedImages&&img.setAttribute("decoding","async"),img.setAttribute("loading","lazy")),img.classList.add("backdropImage"),!1===imageInfo.coverImage&&img.classList.add("backdropImage-contain"),this);this.previousBackdropImage=existingBackdropImage;img.onload=function(){var backdropImage,onAnimationComplete;!self.isDestroyed&&(backdropImage=supportsObjectFit?img:document.createElement("div"),supportsObjectFit||(backdropImage.style.backgroundImage="url('"+getFallbackImageSource(imageInfo).url+"')"),backdropImage.classList.add("backdropImage","displayingBackdropImage"),!1===imageInfo.coverImage&&backdropImage.classList.add("backdropImage-contain"),self.elem=backdropImage,internalBackdrop(!0),animate&&enableAnimation()&&backdropImage.classList.add("backdropImageFadeIn"),supportsObjectFit||parent.appendChild(backdropImage),img.style.visibility=null,enableAnimation())?(onAnimationComplete=function(){_dom.default.removeEventListener(backdropImage,_dom.default.whichAnimationEvent(),onAnimationComplete,{once:!0}),_dom.default.removeEventListener(backdropImage,_dom.default.whichAnimationCancelEvent(),onAnimationComplete,{once:!0}),self.removePreviousBackdropImage()},_dom.default.addEventListener(backdropImage,_dom.default.whichAnimationEvent(),onAnimationComplete,{once:!0}),_dom.default.addEventListener(backdropImage,_dom.default.whichAnimationCancelEvent(),onAnimationComplete,{once:!0})):self.removePreviousBackdropImage()},supportsObjectFit&&(img.style.visibility="hidden"),img.src=getFallbackImageSource(imageInfo).url,supportsImgSrcSet&&supportsObjectFit&&1=currentRotatingImages.length&&(force=0),setBackdropImage(currentRotatingImages[currentRotationIndex=force],animationEnabledByCaller),animationEnabledByCaller=!0)}function clearRotation(){rotationInterval&&rotationInterval.destroy(),rotationInterval=null,currentRotatingImages=[],currentRotationIndex=-1}_exports.default={getBackdropsFromOptions:function(items,options){return getImageInfos(items,(options=options||{}).imageOptions,options.enablePrimaryImageBeforeInherited,options.allowPrimaryImage)},setBackdrops:function(items,options){(items=getImageInfos(items,(options=options||{}).imageOptions,options.enablePrimaryImageBeforeInherited,options.allowPrimaryImage)).length?function(images,enableImageRotation,enableAnimation){!function(a,b){if(a===b)return 1;if(null!=a&&null!=b&&a.length===b.length){for(var i=0;i