1import{t as o}from"./lodash.throttle-Bv6m4KN_.js";import"./picturefill-BXw1sXem.js";const r=".bJS_video-mobile",d=".bJS_video-desktop",h=".bJS_keyvisual-video-content-box",n=".bJS_keyvisual-video-play",l=".bJS_keyvisual-video-pause",s="b_keyvisual-video__is-playing";class v{constructor(e){this.keyvisual=e,this.mobileVideo=e.querySelector(r),this.desktopVideo=e.querySelector(d),this.browserSize="",this.registerEvents(),this.handleResize(),this.setBoxHeight()}handleResize(){window.innerWidth>=1024?this.browserSize!=="desktop"&&(this.unsetVideo(this.mobileVideo),this.setVideo(this.desktopVideo),this.browserSize="desktop"):this.browserSize!=="mobile"&&(this.unsetVideo(this.desktopVideo),this.setVideo(this.mobileVideo),this.browserSize="mobile"),this.setBoxHeight()}registerEvents(){window.addEventListener("resize",o(this.handleResize.bind(this),200)),this.registerVideoEvents(this.mobileVideo),this.registerVideoEvents(this.desktopVideo),this.registerControlEvents()}registerControlEvents(){const e=this.keyvisual.querySelector(n),t=this.keyvisual.querySelector(l);e&&e.addEventListener("click",()=>{const i=this.getActiveVideo();i&&i.play()}),t&&t.addEventListener("click",()=>{const i=this.getActiveVideo();i&&i.pause()})}getActiveVideo(){return this.browserSize==="desktop"?this.desktopVideo:this.browserSize==="mobile"?this.mobileVideo:this.desktopVideo||this.mobileVideo}registerVideoEvents(e){e&&(e.addEventListener("play",()=>{this.keyvisual.classList.add(s)}),e.addEventListener("pause",()=>{this.keyvisual.classList.remove(s)}),e.addEventListener("ended",()=>{this.keyvisual.classList.remove(s)}))}setVideo(e){e&&e.dataset.src!==""&&(e.src=e.dataset.src)}unsetVideo(e){e&&e.removeAttribute("src")}setBoxHeight(){this.keyvisual.querySelectorAll(h).forEach(e=>{const{height:t}=e.getBoundingClientRect();e.style.setProperty("--keyvisual-box-height",`${t}px`),this.keyvisual.style.setProperty("--keyvisual-box-height",`${t}px`)})}}export{v as VideoKeyvisual};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.