1import { D as Directive, b as HostChildren, a as autobind } from './bundled-app.js'; 2import { C as Carousel, S as Swiper } from './bundled-carousel.directive.js'; 3import { E as ElementDirective } from './bundled-element-directive.decorator.js'; 4 5function e(e,t,i,o){var n,r=arguments.length,s=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(s=(r<3?n(s):r>3?n(t,i,s):n(t,i))||s);return r>3&&s&&Object.defineProperty(t,i,s),s}function t(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}class ShoppableImage extends Directive{onAppInit(){this.bindEvents(),this.autoSelect();}onBlockSelect(e){let t=Array.from(this.pins).find(t=>JSON.parse(t.getAttribute("data-shopify-editor-block")).id===e);t?.click();}bindEvents(){this.pins.forEach(e=>{e.addEventListener("click",this.onPinClick);}),this.carousel?.instance?.on("slideChange",this.onSlideChange);}onPinClick(e){let t=e.target.closest("button"),i=+t.getAttribute("product-index");this.pins.forEach(e=>{e.classList.toggle("shoppablePin--active",e===t);}),this.carousel&&this.carousel.instance?.slideTo(i,500,!1);}autoSelect(){let e=Array.from(this.pins).find(e=>e.hasAttribute("autoselect"));e?e.click():this.pins[0].click();}onSlideChange(e){let t=e.realIndex;this.pins[t]?.click();}}ShoppableImage.selector=".shoppableImage",e([HostChildren(".shoppablePin"),t("design:type",Array)],ShoppableImage.prototype,"pins",void 0),e([ElementDirective(".shoppableImage__carousel",Carousel,"host"),t("design:type",void 0===Carousel?Object:Carousel)],ShoppableImage.prototype,"carousel",void 0),e([autobind,t("design:type",Function),t("design:paramtypes",["undefined"==typeof Event?Object:Event]),t("design:returntype",void 0)],ShoppableImage.prototype,"onPinClick",null),e([autobind,t("design:type",Function),t("design:paramtypes",[void 0===Swiper?Object:Swiper]),t("design:returntype",void 0)],ShoppableImage.prototype,"onSlideChange",null); 6 7export { ShoppableImage };
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.