import{Component}from"@theme/component";import{ThemeEvents}from"@theme/events";export class MediaGallery extends Component{connectedCallback(){super.connectedCallback();const{signal}=this.#controller;this.closest(".shopify-section, dialog")?.addEventListener(ThemeEvents.variantUpdate,this.#handleVariantUpdate,{signal}),this.refs.zoomDialogComponent?.addEventListener(ThemeEvents.zoomMediaSelected,this.#handleZoomMediaSelected,{signal})}#controller=new AbortController;disconnectedCallback(){super.disconnectedCallback(),this.#controller.abort()}#handleVariantUpdate=event=>{const source=event.detail.data.html;if(!source)return;const newMediaGallery=source.querySelector("media-gallery");newMediaGallery&&this.replaceWith(newMediaGallery)};#handleZoomMediaSelected=async event=>{this.slideshow?.select(event.detail.index,void 0,{animate:!1})};zoom(index,event){this.refs.zoomDialogComponent?.open(index,event)}get slideshow(){return this.refs.slideshow}get media(){return this.refs.media}get presentation(){return this.dataset.presentation}}customElements.get("media-gallery")||customElements.define("media-gallery",MediaGallery);
//# sourceMappingURL=/s/files/1/0677/1399/0759/t/1/assets/media-gallery.js.map?v=1783128577
