define(["jquery","Amasty_Label/vendor/tooltipster/js/tooltipster.min","Amasty_Label/js/label","matchMedia","domReady!"],function(e,t){"use strict";return e.widget("mage.amInitLabel",{options:{mode:null,isAdminArea:null,config:null,productId:null,selector:null},classes:{amSearchSection:"amsearch-products-section"},tooltipVendorClass:"tooltip",mediaBreakpoint:"all and (max-width: 768px)",_create:function(){var e=this,t=e.element.closest(".product-item, .item");this.element.parent().hasClass(this.classes.amSearchSection)&&this.element.parent().find(this.options.selector).length>1||(this.renderTooltip(),"prod"===e.options.mode||e.options.isAdminArea||e.element.hasClass("amlabel-swatch")||e.isIE()?e.execLabel():"cat"===e.options.mode&&t.length&&!e.element.hasClass("amlabel-swatch")?e._handleIntersect(t):e.execLabel())},execLabel:function(){this.element.amShowLabel(this.options.config)},isIE:function(){var e=window.navigator.userAgent;return e.indexOf("MSIE ")>-1||e.indexOf("Trident/")>-1},renderTooltip:function(){var t=this.options.config.tooltip,n=decodeURIComponent(t.content);this._isHiddenOnMobile()||+t.status>1&&n&&!this._isEmpty(n)&&this.element.addClass(this.tooltipVendorClass).tooltipster({theme:"tooltipster-shadow",interactive:!0,content:e("<span>",{html:n}),styles:{backgroundColor:t.backgroundColor,textColor:t.color}})},_isEmpty:function(e){return null===e||null!==e.match(/^ *$/)},_isHiddenOnMobile:function(){return matchMedia(this.mediaBreakpoint).matches&&3==+this.options.config.tooltip.status},_handleIntersect:function(e){var t,n=this;t=new IntersectionObserver(function(e){e[0].isIntersecting&&(n.execLabel(),t.disconnect())}),t.observe(e[0])}}),e.mage.amInitLabel});
//# sourceMappingURL=initLabel.js.map