${ul({icon:fl({icon:h.s}),onClick:()=>this.isMenuOpen?this.hideSettings():this.showSettings(),ariaLabel:"Settings"})} ${this.renderSettings()}
`;}};bl.styles=[e.i`:host{position:relative}`,t.t],t._([t.n()],bl.prototype,"mediaActionsController",void 0),t._([t.n({type:Boolean})],bl.prototype,"autoplayPref",void 0),t._([t.n({type:Boolean})],bl.prototype,"isLoggedInUser",void 0),t._([t.n({type:Boolean,attribute:"hide-autoplay-toggle"})],bl.prototype,"hideAutoplayToggle",void 0),t._([t.n()],bl.prototype,"qualityLevels",void 0),t._([t.n()],bl.prototype,"currentQualityLevelIndex",void 0),t._([t.n({type:String})],bl.prototype,"rootSelector",void 0),t._([t.v()],bl.prototype,"isMenuOpen",void 0),bl=t._([t.e("shreddit-video-settings")],bl);let Al=class extends e.s{constructor(){super(...arguments),this.isMobile=!1,this._updateVolume=e=>{t.km(e);const{height:i=0,y:s=0}=this.sliderTrack?.getBoundingClientRect()??{};if(!i)return;const r=Math.min(1,Math.max(0,(s+i-e.y)/i));this.mediaActionsController?.setVolume(r)}}render(){const i=this.isMobile?e.A:e.x` ${ul({icon:e.x` ${fl({icon:a.p,additionalClasses:"hidden play-icon"})} ${fl({icon:Ko,additionalClasses:"hidden pause-icon"})} `,additionalClasses:"absolute left-0 bottom-0",onClick:t=>this.gifToggle(t)})}
`} ${this.hideGifIcon?e.A:ul({icon:fl({icon:a.g}),disabled:!0,ariaHidden:!0,additionalClasses:"absolute right-0 bottom-0"})} ${this.renderErrorOverlay()}`}connectedCallback(){super.connectedCallback(),this.autoplay||this.playerRoot?.hasHadPlayAttempt||(this.showPoster(),this.setPausedState())}disconnectedCallback(){super.disconnectedCallback(),this.hideLoadingSpinner()}get playerRoot(){return t.bx(this,this.rootSelector)}renderPosterPlayButton(){return ul({icon:e.x` ${fl({icon:a.p,size:e.I.ExtraLarge})} `,onClick:t=>{t?.preventDefault(),t?.stopImmediatePropagation(),this.mediaActionsController?.play()},ariaLabel:"Play",additionalClasses:"poster-play-button absolute inset-0 flex items-center justify-center cursor-pointer pointer-events-auto"});}showPoster(){this.setAttr(t.gt.SHOW_POSTER)}showLoadingSpinner(){this.hasAttribute(t.gt.LOADING)||(this._loadingSpinnerRAF=requestAnimationFrame((()=>{this.videoElement&&this.videoElement.readyState<3&&this.setAttr(t.gt.LOADING)})))}hideLoadingSpinner(){this._loadingSpinnerRAF&&(cancelAnimationFrame(this._loadingSpinnerRAF),this._loadingSpinnerRAF=void 0),this.hasAttribute(t.gt.LOADING)&&requestAnimationFrame((()=>{this.setAttr(t.gt.LOADING,!1)}))}renderCaptionOverlay(){return e.x` Debug info
${this.debugLogs.map((t=>e.x`
${t.key}
${t.value}
`))}
`}};Rl.styles=[t.t,e.i`:host{position:absolute;top:0;left:0;right:0;bottom:50px;max-height:100%;overflow-y:auto}`],t._([t.n({type:Array})],Rl.prototype,"debugLogs",void 0),Rl=t._([t.e("shreddit-player-debug-overlay")],Rl),(({country:e,_setCookie:i=t.B})=>{const s=t.kj;if(!e||!t.aI({country:e,name:s}))return;i({name:s,value:function(){const t=document.createElement("video"),e=[];""!==t.canPlayType('video/mp4; codecs="avc1.42E01E"')&&e.push(No.AVC);""!==t.canPlayType('video/webm; codecs="vp9"')&&e.push(No.VP9);return e}().join(","),options:t.D,country:e})})({country:document.querySelector("shreddit-app")?.getAttribute("country")??void 0});const kl="shreddit-player";let Cl=class extends e.s{constructor(){super(...arguments),this.playbackId=t.a3(),this.subSessionId=t.a3(),this.navigationSessionId=t.a3(),this.videoElement=document.createElement("video"),this.initialized=!1,this.rootSelector=kl,this.hasHadPlayAttempt=!1,this.playCount=0,this._disconnected=!1,this.errorControllerLegacy=new m(this),this.errorControllerNew=new y(this),this.hlsController=new io(this),this.mediaActionsController=new co(this),this.mediaSyncController=new vo(this),this.mediaVisibilityController=new yo(this),this.packagedMediaController=new To(this),this.telemetryController=new Mo(this),this.adController=new c(this),this.userIdleController=new Fo(this),this.volumeController=new mo(this),this.gestureController=new E(this),this.mediaHotkeyController=new uo(this),this.pageController=new So(this),this.src="",this.autoplay=!1,this.autoplayPref=!1,this.hideAutoplayToggle=!1,this.gif=!1,this.loop=!1,this.hideControls=!1,this.hideFullscreenButton=!1,this.isMobile=!1,this.isBot=!1,this.poster="",this.isLoggedInUser=!1,this.singlePlayback=!1,this.playOutOfViewport=!1,this.objectFit="contain",this.shouldRoundBackground=!1,this.errorImprovements=!1,this.idleAutoplay=!1,this.hideGifIcon=!1,this.debug=!1,this.qualityLevels=[],this.currentQualityLevelIndex=-1}connectedCallback(){super.connectedCallback(),this.videoElement.poster=this.poster,this._disconnected&&this.reconnect()}disconnectedCallback(){this.stop(),this._disconnected=!0,this.initialized=!1,super.disconnectedCallback()}firstUpdated(){this.volumeController.setInitialVolumeSetting()}reconnect(){this.adController.fromReconnect=!0,this.autoplay||this.mediaUI?.setPausedState(),this._disconnected=!1}get isMp4(){return this.packagedMediaController.hasPackagedMedia}get isHls(){return this.hlsController.isHlsStream&&!this.isMp4}get errorController(){return this.errorImprovements?this.errorControllerNew:this.errorControllerLegacy}shouldUseFakePosterImage(){return this.gif&&!this.autoplay&&!this.poster}initializeVideoElement(){if(this.initialized)return;this.initialized=!0,this.isMp4&&this.packagedMediaController.initialize(),this.isMp4||this.isHls||(this.videoElement.src=this.src),this._restoreVideoTime(),this.videoElement.playsInline=!0;this.shouldUseFakePosterImage()?(this.videoElement.preload=t.kf.AUTO,this.videoElement.src=this.videoElement.src.concat("#t=.01")):this.videoElement.preload=t.kf.NONE,this.videoElement.tabIndex=-1,this.videoElement.setAttribute("aria-label",String(Uo.videoPlayerLabel())),this.videoElement.style.objectFit=this.objectFit,this.shouldRoundBackground&&this.videoElement.classList.add("rounded-4"),this.stoppedState=void 0}async play(t=!1){return this.mediaActionsController.play(t)}async load(e=t.kf.AUTO){return this.mediaActionsController.load(e)}pause(t){return this.mediaActionsController.pause(t)}stop(){this.mediaActionsController.stop()}updateSubSession(){this.subSessionId=t.a3(),this.hlsController.updateCmcdSessionId(this.subSessionId),this.subSessionInstructionTime=void 0,this.subSessionPlayStartTime=void 0,this.subSessionPlayingStartTime=void 0}hideRecommendationOverlay(){this.mediaUI?.recommendationOverlayController?.hideRecommendationOverlay()}_restoreVideoTime(){!this.videoElement.currentTime&&this.stoppedState?.currentTime&&(this.videoElement.currentTime=this.stoppedState?.currentTime)}render(){return e.x` ${this.videoElement}