class ImageCompare{constructor(e,t={}){this.settings=Object.assign({showLabels:!1,labelOptions:{before:"Before",after:"After",onHover:!1},smoothing:!0,smoothingAmount:100,onHover:!1,verticalMode:!1,startingPoint:50,prefix:"etheme-image-comparison",addOverlay:!1},t),this.safariAgent=-1!=navigator.userAgent.indexOf("Safari")&&-1==navigator.userAgent.indexOf("Chrome"),this.el=e,this.images={},this.wrapper=null,this.control=null,this.arrowContainer=null,this.arrowAnimator=[],this.active=!1,this.arrowCoordinates={circle:[5,3],standard:[8,0]}}mount(){this.safariAgent&&(this.settings.smoothing=!1),this._getImages(),this._shapeContainer(),this._buildControl(),this._events()}_events(){this.el.addEventListener("mousedown",e=>{this._activate(!0),document.body.classList.add(this.settings.prefix+"-body"),this._slideCompare(e)}),this.el.addEventListener("mousemove",e=>this.active&&this._slideCompare(e)),this.el.addEventListener("mouseup",()=>!this.settings.onHover&&this._activate(!1)),document.body.addEventListener("mouseup",()=>{document.body.classList.remove(this.settings.prefix+"-body"),this.settings.onHover||this._activate(!1)}),this.control.addEventListener("touchstart",e=>{this._activate(!0),document.body.classList.add(this.settings.prefix+"-body")}),this.el.addEventListener("touchmove",e=>{this.active&&this._slideCompare(e)}),this.el.addEventListener("touchend",()=>{this._activate(!1),document.body.classList.remove(this.settings.prefix+"-body")}),this.el.addEventListener("mouseenter",()=>{this.settings.onHover&&this._activate(!0)})}_slideCompare(e){var t=this.el.getBoundingClientRect(),n=void 0!==e.touches?e.touches[0].clientX-t.left:e.clientX-t.left,e=void 0!==e.touches?e.touches[0].clientY-t.top:e.clientY-t.top,e=this.settings.verticalMode?e/t.height*100:n/t.width*100;0<=e&&e<=100&&(this.settings.verticalMode?this.control.style.top=`calc(${e}% - (var(--divider-width, 45px) / 2))`:this.control.style.left=`calc(${e}% - (var(--divider-width, 45px) / 2))`,this.settings.verticalMode?this.wrapper.style.height=`calc(${e}%)`:this.wrapper.style.width=`calc(${100-e}%)`)}_activate(e){this.active=e}_shapeContainer(){var e=document.createElement("span"),t=document.createElement("span");e.classList.add(this.settings.prefix+"-label",this.settings.prefix+"-label-before"),t.classList.add(this.settings.prefix+"-label",this.settings.prefix+"-label-after"),this.settings.labelOptions.onHover&&(e.classList.add("on-hover"),t.classList.add("on-hover")),e.innerHTML=this.settings.labelOptions.before||"Before",t.innerHTML=this.settings.labelOptions.after||"After",this.settings.showLabels&&(this.el.prepend(e),this.wrapper.appendChild(t)),this.settings.addOverlay&&((e=document.createElement("div")).classList.add(this.settings.prefix+"-overlay"),this.el.appendChild(e))}_buildControl(){var e=document.createElement("div"),t=document.createElement("div"),n=document.createElement("div"),i=document.createElement("div");n.classList.add(this.settings.prefix+"-theme-wrapper"),i.classList.add(this.settings.prefix+"-arrows-wrapper"),n.appendChild(i);for(var s=0;s<=1;s++){var r=document.createElement("span");let e='",r.innerHTML+=e,this.arrowAnimator.push(r),i.appendChild(r)}e.classList.add(this.settings.prefix+"-control"),e.style.cssText=` ${this.settings.verticalMode?"height":"width "}: var(--divider-width, 45px); ${this.settings.verticalMode?"top":"left "}: calc(${this.settings.startingPoint}% - (var(--divider-width, 45px) / 2)); ${!("ontouchstart"in document.documentElement)&&this.settings.smoothing?`transition: ${this.settings.smoothingAmount}ms ease-out;`:""} `,t.classList.add(this.settings.prefix+"-control-line"),t.style.cssText=` ${this.settings.verticalMode?"height":"width "}: var(--divider-line-width, 2px); background: var(--divider-bg-color, #2962FF); `;var a=t.cloneNode(!0);e.appendChild(t),e.appendChild(n),e.appendChild(a),this.arrowContainer=n,this.control=e,this.el.appendChild(e)}_getImages(){var e=this.el.querySelectorAll("img, ."+this.settings.prefix+"-label"),t=(this.el.innerHTML="",e.forEach(e=>{this.el.appendChild(e)}),[...e].filter(e=>"img"===e.nodeName.toLowerCase()));this.settings.verticalMode&&t.reverse();for(let e=0;e<=1;e++){var n,i=t[e];i.classList.add(this.settings.prefix+"-img"),i.classList.add(0===e?this.settings.prefix+"-img-a":this.settings.prefix+"-img-b"),1===e&&((n=document.createElement("div")).classList.add(this.settings.prefix+"-wrapper"),n.style.cssText=` width: ${100-this.settings.startingPoint}%; height: ${this.settings.startingPoint}%; ${!("ontouchstart"in document.documentElement)&&this.settings.smoothing?`transition: ${this.settings.smoothingAmount}ms ease-out;`:""} `,n.appendChild(i),this.wrapper=n,this.el.appendChild(this.wrapper))}}}!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports&&"function"==typeof require?e(require("jquery")):e(jQuery)}(function(c){"use strict";var n={escapeRegExChars:function(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(e){var t=document.createElement("div");return t.className=e,t.style.position="absolute",t.style.display="none",t}},i=27,s=9,r=13,a=38,o=39,l=40,e=c.noop;function h(e,t){var n=this;n.element=e,n.el=c(e),n.suggestions=[],n.badQueries=[],n.selectedIndex=-1,n.currentValue=n.element.value,n.timeoutId=null,n.cachedResponse={},n.onChangeTimeout=null,n.onChange=null,n.isLocal=!1,n.suggestionsContainer=null,n.noSuggestionsContainer=null,n.options=c.extend(!0,{},h.defaults,t),n.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},n.hint=null,n.hintValue="",n.selection=null,n.initialize(),n.setOptions(t)}h.utils=n,(c.Autocomplete=h).defaults={ajaxSettings:{},autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,onHint:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:function(e,t){return t?(t="("+n.escapeRegExChars(t)+")",e.value.replace(new RegExp(t,"gi"),"$1").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/<(\/?strong)>/g,"<$1>")):e.value},formatGroup:function(e,t){return'
'+e.value.replace(new RegExp(i,"gi"),"$1")+"
",e.in_stock&&e.stock&&(n+=e.stock),e.price&&(n+=''+e.value.replace(new RegExp(i,"gi"),"$1")+"
",!e.in_stock&&e.stock&&(n+=e.stock),e.price&&(n+=''+e.value.replace(new RegExp(i,"gi"),"$1")+"
")+''+e.value.replace(new RegExp(i,"gi"),"$1")+"
")+''+e.value.replace(new RegExp(i,"gi"),"$1")+"
")+''+e.value.replace(new RegExp(i,"gi"),"$1")+"
"),t=[],e.sku&&o.content_elements.product_sku&&t.push(''+e.sku+""),e.stock&&o.content_elements.product_stock&&t.push(e.stock.replace("","")),e.category&&o.content_elements.category&&(r=JSON.parse(e.category),t.push(''+r.title+"")),t.length&&(n+='
'+t.value.replace(new RegExp(s,"gi"),"$1")+"
",n.product_stock&&t.in_stock&&(r+=t.stock),n.product_price&&t.price&&(r+='