!function(t){"use strict";"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"function"==typeof require?t(require("jquery")):t(jQuery)}(function(t){"use strict";var e={escapeRegExChars:function(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&")},createNode:function(t){var e=document.createElement("div");return e.className=t,e.style.position="absolute",e.style.display="none",e.setAttribute("unselectable","on"),e},highlight:function(t,s){if(dgwt_wcas.is_premium){var i,a=s.split(/ /);if(a)for(a=a.sort(function(t,e){return e.length-t.length}),i=0;i1){var o="("+e.escapeRegExChars(a[i].trim())+")";t=t.replace(new RegExp(o,"gi"),"$1")}}else o="("+e.escapeRegExChars(s)+")",t=t.replace(new RegExp(o,"gi"),"$1");return t},debounce:function(t,e){var i,a=(new Date).getUTCMilliseconds();if(0===s.id.length)return s.id=a,void t();s.id=a,i=setTimeout(function(){a===s.id?(t(),s.id=""):clearTimeout(i)},e)},mouseHoverDebounce:function(e,s,i){var a;a=setTimeout(function(){t(s+":hover").length>0?e():clearTimeout(a)},i)},getActiveInstance:function(){var e,s=t(".dgwt-wcas-search-wrapp.dgwt-wcas-active");return s.length>0&&s.each(function(){var s=t(this).find(".dgwt-wcas-search-input");if("object"==typeof s.data("autocomplete"))return e=s.data("autocomplete"),!1}),e}},s={id:"",callback:null,ajaxSettings:null,object:null},i=27,a=9,o=13,n=38,r=39,l=40,c=t.noop;function d(e,s){this.element=e,this.el=t(e),this.suggestions=[],this.badQueries=[],this.selectedIndex=-1,this.currentValue=this.element.value,this.timeoutId=null,this.cachedResponse={},this.cachedDetails={},this.detailsRequestsSent=[],this.onChangeTimeout=null,this.onChange=null,this.isLocal=!1,this.suggestionsContainer=null,this.detailsContainer=null,this.autoAligmentprocess=null,this.noSuggestionsContainer=null,this.options=t.extend(!0,{},d.defaults,s),this.classes={selected:"dgwt-wcas-suggestion-selected",suggestion:"dgwt-wcas-suggestion",suggestionsContainerOrientTop:"dgwt-wcas-suggestions-wrapp--top"},this.hint=null,this.hintValue="",this.selection=null,this.overlayMobileState="off",this.initialize(),this.setOptions(s)}d.utils=e,t.DgwtWcasAutocompleteSearch=d,d.defaults={ajaxSettings:{},autoSelectFirst:!1,appendTo:"body",serviceUrl:null,lookup:null,onSelect:null,width:"auto",containerDetailsWidth:"auto",showDetailsPanel:!1,showImage:!1,showPrice:!1,showSKU:!1,showDescription:!1,showSaleBadge:!1,showFeaturedBadge:!1,saleBadgeText:"sale",featuredBadgeText:"featured",minChars:3,maxHeight:600,deferRequestBy:0,params:{},formatResult:function(t,s,i){if(!s)return t;i&&(t=e.highlight(t,s));return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/<sup/g,"").replace(/<(\/?strong)>/g,"<$1>")},delimiter:null,zIndex:999999999,type:"GET",noCache:!1,isRtl:!1,onSearchStart:c,onSearchComplete:c,onSearchError:c,preserveInput:!1,searchFormClass:"dgwt-wcas-search-wrapp",containerClass:"dgwt-wcas-suggestions-wrapp",containerDetailsClass:"dgwt-wcas-details-wrapp",searchInputClass:"dgwt-wcas-search-input",preloaderClass:"dgwt-wcas-preloader",closeTrigger:"dgwt-wcas-close",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,isPremium:!1,overlayMobile:!1,preventBadQueries:!0,lookupFilter:function(t,e,s){return-1!==t.value.toLowerCase().indexOf(s)},paramName:"query",transformResult:function(e){return"string"==typeof e?t.parseJSON(e):e},noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1,positionFixed:!1,debounceWaitMs:400,sendGAEvents:!0},d.prototype={initialize:function(){var e=this;e.element.setAttribute("autocomplete","off"),e.createContainers(),e.registerEventsSearchBar(),e.registerEventsSuggestions(),e.registerEventsDetailsPanel(),e.registerEventsFixedMenu(),e.fixPositionCapture=function(){e.adjustContainerWidth(),e.visible&&e.fixPosition()},t(window).on("resize.autocomplete",e.fixPositionCapture),e.initMobileMode(),e.hideAfterClickOutsideListener(),e.suggestionsContainer.addClass("js-dgwt-wcas-initialized"),e.detailsContainer&&e.detailsContainer.length>0&&e.detailsContainer.addClass("js-dgwt-wcas-initialized")},createContainers:function(e){var s=this.options;0==t("."+s.containerClass).length?(this.suggestionsContainer=t(d.utils.createNode(s.containerClass)),this.suggestionsContainer.appendTo(s.appendTo||"body"),this.suggestionsContainer.addClass("woocommerce"),!0===s.showImage&&this.suggestionsContainer.addClass("dgwt-wcas-has-img"),!0===s.showPrice&&this.suggestionsContainer.addClass("dgwt-wcas-has-price"),!0===s.showDescription&&this.suggestionsContainer.addClass("dgwt-wcas-has-desc"),!0===s.showSKU&&this.suggestionsContainer.addClass("dgwt-wcas-has-sku"),!0===s.showHeadings&&this.suggestionsContainer.addClass("dgwt-wcas-has-headings"),"auto"!==s.width&&this.suggestionsContainer.width(s.width)):this.suggestionsContainer=t("."+this.options.containerClass),this.canShowDetailsBox()&&(0==t("."+s.containerDetailsClass).length?(this.detailsContainer=t(d.utils.createNode(s.containerDetailsClass)),this.detailsContainer.appendTo(s.appendTo||"body"),this.detailsContainer.addClass("woocommerce")):this.detailsContainer=t("."+s.containerDetailsClass))},registerEventsSearchBar:function(){var s=this;t(document).on("click.autocomplete","."+s.options.closeTrigger,function(){var s=e.getActiveInstance();s.hide(),s.clear(!1),t(this).removeClass(s.options.closeTrigger),t(this).closest("."+s.options.searchFormClass).find("."+s.options.searchInputClass).val("").focus()}),s.el.on("keydown.autocomplete",function(t){s.onKeyPress(t)}),s.el.on("keyup.autocomplete",function(t){s.onKeyUp(t)}),s.el.on("blur.autocomplete",function(){s.onBlur()}),s.el.on("focus.autocomplete",function(){s.onFocus()}),s.el.on("change.autocomplete",function(t){s.onKeyUp(t)}),s.el.on("input.autocomplete",function(t){s.onKeyUp(t)})},registerEventsSuggestions:function(){var s="."+this.classes.suggestion;this.getSuggestionsContainer().hasClass("js-dgwt-wcas-initialized")||(t(document).on("mouseenter.autocomplete",s,function(){var s=e.getActiveInstance(),i=t(this).data("index"),a='.dgwt-wcas-suggestion[data-index="'+i+'"]';s.selectedIndex!=i&&e.mouseHoverDebounce(function(){s.selectedIndex!==i&&(s.getDetails(s.suggestions[i]),s.activate(i))},a,100)}),t(document).on("click.autocomplete",s,function(){e.getActiveInstance().select(t(this).data("index"))}),t(document).on("click.autocomplete","."+this.options.containerClass,function(){var t=e.getActiveInstance();clearTimeout(t.blurTimeoutId)}))},registerEventsDetailsPanel:function(){var s=this.getDetailsContainer();this.canShowDetailsBox()&&!s.hasClass("js-dgwt-wcas-initialized")&&(t(document).on("click.autocomplete","."+this.options.containerDetailsClass,function(){var t=e.getActiveInstance();clearTimeout(t.blurTimeoutId)}),t(document).on("change",'[name="js-dgwt-wcas-quantity"]',function(e){t(this).closest(".js-dgwt-wcas-pd-addtc").find("[data-quantity]").attr("data-quantity",t(this).val())}))},registerEventsFixedMenu:function(){var e=this;t(window).on("scroll",function(){if(e.suggestions.length>0&&e.elementOrParentIsFixed(e.getFormWrapper()))if(0===t(window).scrollTop()){[1,10,20,30,40,50,60,70,80,90,120,140,170,200,250,400,700,1e3,2e3].forEach(function(t){setTimeout(function(){e.fixHeight(),e.fixPositionCapture()},t)})}else e.fixHeight(),e.fixPositionCapture()})},initMobileMode:function(){var t=this;if(t.options.overlayMobile&&t.isMobileMode()){var e=t.getFormWrapper();e.hasClass("js-dgwt-wcas-icon-mobile")&&e.prepend('
'+dgwt_wcas.magnifier_icon+"
"),e.prepend('
'),e.find(".js-dgwt-wcas-enable-mobile-form").on("click",function(e){t.enableOverlayMobile()})}},onFocus:function(){t("."+this.options.searchFormClass).removeClass("dgwt-wcas-active"),this.getFormWrapper().addClass("dgwt-wcas-active"),this.fixPositionCapture(),this.el.val().length>=this.options.minChars&&this.onValueChange()},onBlur:function(){var e=this,s=e.options,i=e.el.val(),a=e.getQuery(i);e.blurTimeoutId=setTimeout(function(){e.hide(),e.selection&&e.currentValue!==a&&(s.onInvalidateSelection||t.noop).call(e.element)},200)},abortAjax:function(){this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null)},setOptions:function(e){var s=this,i=s.getSuggestionsContainer(),a=t.extend({},s.options,e);(s.isLocal=Array.isArray(a.lookup),s.isLocal&&(a.lookup=s.verifySuggestionsFormat(a.lookup)),a.orientation=s.validateOrientation(a.orientation,"bottom"),i.css({"max-height":s.canShowDetailsBox()?"none":a.maxHeight+"px",width:a.width+"px","z-index":a.zIndex}),!0===a.showDetailsPanel)&&s.getDetailsContainer().css({"z-index":a.zIndex-1});a.onSearchComplete=function(){s.getFormWrapper().removeClass("dgwt-wcas-processing"),s.preloader("hide","form","dgwt-wcas-inner-preloader"),s.preloader("show","form",a.closeTrigger)},this.options=a},clearCache:function(){this.cachedResponse={},this.cachedDetails={},this.badQueries=[]},clear:function(t){t&&this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){this.disabled=!0,clearTimeout(this.onChangeTimeout),this.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var t=this.getFormOffset();this.getSuggestionsContainer().css(t),this.canShowDetailsBox()&&this.fixPositionDetailsBox()},fixPositionDetailsBox:function(){var e=this.getFormWrapper(),s=this.getSuggestionsContainer(),i=this.getDetailsContainer(),a=this.getFormOffset(),o=a.left;if(0==i.length)return!1;var n=!0===this.options.isRtl?1:2,r=Math.round(a.left);if(a.left=r+Math.round(s.width()+n),i.css(a),e.width()>=550)return t("body").removeClass("dgwt-wcas-details-outside"),t("body").removeClass("dgwt-wcas-details-right"),t("body").removeClass("dgwt-wcas-details-left"),void(!0===this.options.isRtl&&(s.css("left",r+Math.round(i.width()+n)+"px"),i.css("left",o+"px")));var l=t(window).width(),c=i.width(),d=i.offset();t("body").addClass("dgwt-wcas-details-outside"),!0===this.options.isRtl&&(a.left=a.left+1);var g=!1,u=!1;l2&&t.fixHeight())},10)}},getFormOffset:function(){var e=this.getFormWrapper(),s=this.getSuggestionsContainer(),i=this.options.orientation,a=e.outerHeight(),o=this.el.outerHeight(),n=this.el.offset(),r={top:n.top,left:n.left};if("auto"===i){var l=t(window).height(),c=t(window).scrollTop(),d=-c+n.top-a,g=c+l-(n.top+o+a);i=Math.max(d,g)===d?"top":"bottom"}if("top"===i){s[0].getBoundingClientRect().top;var u=e[0].getBoundingClientRect().top;s.css("height","auto"),u0?e.onChangeTimeout=setTimeout(function(){e.onValueChange()},e.options.deferRequestBy):e.onValueChange())}},onValueChange:function(){if(this.ignoreValueChange)this.ignoreValueChange=!1;else{var e=this.options,s=this.el.val(),i=this.getQuery(s);this.selection&&this.currentValue!==i&&(this.selection=null,(e.onInvalidateSelection||t.noop).call(this.element)),clearTimeout(this.onChangeTimeout),this.currentValue=s,this.selectedIndex=-1,e.triggerSelectOnValidInput&&this.isExactMatch(i)?this.select(0):i.lengthn&&(s.suggestions=s.suggestions.slice(0,n)),s},getSuggestions:function(i){var a,o,n,r,l=this,c=l.options,d=c.serviceUrl,g=l.getFormWrapper();c.params[c.paramName]=i,void 0!==dgwt_wcas.current_lang&&(c.params.l=dgwt_wcas.current_lang),l.preloader("show","form","dgwt-wcas-inner-preloader"),g.addClass("dgwt-wcas-processing"),!1!==c.onSearchStart.call(l.element,c.params)&&(o=c.ignoreParams?null:c.params,t.isFunction(c.lookup)?c.lookup(i,function(t){l.suggestions=t.suggestions,l.suggest(),l.selectFirstSuggestion(t.suggestions),c.onSearchComplete.call(l.element,i,t.suggestions)}):(l.isLocal?a=l.getSuggestionsLocal(i):(t.isFunction(d)&&(d=d.call(l.element,i)),n=d+"?"+t.param(o||{}),a=l.cachedResponse[n]),a&&Array.isArray(a.suggestions)?(l.suggestions=a.suggestions,l.suggest(),l.selectFirstSuggestion(a.suggestions),c.onSearchComplete.call(l.element,i,a.suggestions)):l.isBadQuery(i)?c.onSearchComplete.call(l.element,i,[]):(l.abortAjax(),r={url:d,data:o,type:c.type,dataType:c.dataType},t.extend(r,c.ajaxSettings),s.object=l,s.ajaxSettings=r,e.debounce(function(){var e=s.object,a=s.ajaxSettings;e.currentRequest=t.ajax(a).done(function(t){var s;e.currentRequest=null,void 0!==(s=e.options.transformResult(t,i)).suggestions&&(e.processResponse(s,i,n),e.selectFirstSuggestion(s.suggestions),1===s.suggestions.length&&void 0!==s.suggestions[0].type&&"no-results"===s.suggestions[0].type?e.gaEvent(i,"Autocomplete Search without results"):e.gaEvent(i,"Autocomplete Search with results")),e.fixPositionCapture(),e.options.onSearchComplete.call(e.element,i,s.suggestions)}).fail(function(t,s,a){e.options.onSearchError.call(e.element,i,t,s,a)})},c.debounceWaitMs))))},getDetails:function(e){var s=this;if(!s.canShowDetailsBox())return!1;if(null!=e&&void 0!==e.type&&("string"!=typeof e.more_products||"more_products"!==e.more_products)){s.fixHeight();var i,a=s.getDetailsContainer(),o=s.prepareSuggestionObjectID(e);if(null!=(i=s.cachedDetails[o]))a.html(i.html),s.fixHeight(),s.fixPositionCapture();else{var n={action:dgwt_wcas.action_result_details,items:[]};if(t.each(s.suggestions,function(t,e){if(void 0!==e.type&&"more_products"!=e.type&&"headline"!=e.type){var i={objectID:s.prepareSuggestionObjectID(e),value:null!=e.value?e.value:""};n.items.push(i)}}),a.html(""),s.preloader("show","details","",!0),-1!=t.inArray(o,s.detailsRequestsSent))return;s.detailsRequestsSent.push(o),t.ajax({data:n,type:"post",url:dgwt_wcas.ajax_details_endpoint,success:function(t){var e="string"==typeof t?jQuery.parseJSON(t):t;if(void 0!==e.items)for(var i=0;i0)(new Image).src=e.items[i].imageSrc}s.preloader("hide","details","",!0);var n=s.prepareSuggestionObjectID(s.suggestions[s.selectedIndex]);null!=s.cachedDetails[n]?a.html(s.cachedDetails[n].html):a.html(""),s.fixPositionCapture(),s.fixHeight()},error:function(t,e){s.preloader("hide","details","",!0),a.html(t),s.fixPositionCapture(),s.fixHeight()}})}t(document).trigger("dgwtWcasDetailsPanelLoaded",s)}},prepareSuggestionObjectID:function(t){var e="";return void 0!==t&&void 0!==t.type&&(null!=t.post_id&&(e=t.type+"__"+t.post_id,"product_variation"===t.type&&(e+="__"+t.variation_id),void 0!==t.post_type&&(e=t.type+"__"+t.post_id+"__"+t.post_type)),null!=t.term_id&&null!=t.taxonomy&&(e=t.type+"__"+t.term_id+"__"+t.taxonomy)),e},selectFirstSuggestion:function(e){var s=0,i=!1;this.canShowDetailsBox()&&("undefined"!=e&&e.length>0&&t.each(this.suggestions,function(t,e){if(void 0!==e.type&&"more_products"!=e.type&&"headline"!=e.type&&"no-results"!=e.type)return s=t,!1;void 0!==e.type&&"no-results"!==e.type||(i=!0)}),i||(this.getDetails(e[s]),this.activate(s)))},isBadQuery:function(t){if(!this.options.preventBadQueries)return!1;for(var e=this.badQueries,s=e.length;s--;)if(0===t.indexOf(e[s]))return!0;return!1},hide:function(){var e=this.getSuggestionsContainer(),s=this.getDetailsContainer();t.isFunction(this.options.onHide)&&this.visible&&this.options.onHide.call(this.element,container),this.visible=!1,this.selectedIndex=-1,clearTimeout(this.onChangeTimeout),e.hide(),e.removeClass(this.classes.suggestionsContainerOrientTop),s.hide(),t("body").removeClass("dgwt-wcas-open"),t("body").removeClass("dgwt-wcas-block-scroll"),t("body").removeClass("dgwt-wcas-is-details"),t("body").removeClass("dgwt-wcas-full-width"),t("body").removeClass("dgwt-wcas-nores"),t("body").removeClass("dgwt-wcas-details-outside"),t("body").removeClass("dgwt-wcas-details-right"),t("body").removeClass("dgwt-wcas-details-left"),null!=this.autoAligmentprocess&&(clearInterval(this.autoAligmentprocess),this.autoAligmentprocess=null),this.signalHint(null)},hideAfterClickOutsideListener:function(){var e=this;e.isMobileMode()||t(document).mouseup(function(s){if(e.visible){e.getSuggestionsContainer(),e.getDetailsContainer();var i=!(t(s.target).closest("."+e.options.searchFormClass).length>0||t(s.target).hasClass(e.options.searchFormClass)),a=!(t(s.target).closest("."+e.options.containerClass).length>0||t(s.target).hasClass(e.options.containerClass));if(e.canShowDetailsBox()){var o=!(t(s.target).closest("."+e.options.containerDetailsClass).length>0||t(s.target).hasClass(e.options.containerDetailsClass));i&&a&&o&&e.hide()}else i&&a&&e.hide()}})},suggest:function(){if(this.suggestions.length){var e,s=this,i=s.options,a=i.groupBy,o=i.formatResult,n=s.getQuery(s.currentValue),r=s.classes.suggestion,l=s.classes.selected,c=s.getSuggestionsContainer(),d=s.getDetailsContainer(),g=t(s.noSuggestionsContainer),u=i.beforeRender,h="";i.triggerSelectOnValidInput&&s.isExactMatch(n)?s.select(0):(t("body").removeClass("dgwt-wcas-nores"),t.each(s.suggestions,function(s,l){var c="",g=!1;if(a&&(h+=function(t,s){var i=t.data[a];return e===i?"":'
'+(e=i)+"
"}(l,0)),void 0===l.type||"product"!=l.type&&"product_variation"!=l.type){var u=r,w="dgwt-wcas-st",p="",m="",f="",v=!0;"product_cat"===l.taxonomy?(u+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-cat",i.showHeadings||(p+=''+dgwt_wcas.labels.category+""),void 0!==l.breadcrumbs&&l.breadcrumbs&&(f=l.breadcrumbs+" > "+l.value,m+=''+dgwt_wcas.labels.in+" "+l.breadcrumbs+"")):"product_tag"===l.taxonomy?(u+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-tag",i.showHeadings||(p+=''+dgwt_wcas.labels.tag+"")):i.isPremium&&l.taxonomy===i.taxonomyBrands?(u+=" dgwt-wcas-suggestion-tax dgwt-wcas-suggestion-brand",i.showHeadings||(p+=''+dgwt_wcas.labels.brand+"")):i.isPremium&&"post"===l.type?(u+=" dgwt-wcas-suggestion-pt dgwt-wcas-suggestion-tp-post",i.showHeadings||(p+=''+dgwt_wcas.labels.post+"")):i.isPremium&&"page"===l.type?(u+=" dgwt-wcas-suggestion-pt dgwt-wcas-suggestion-pt-page",i.showHeadings||(p+=''+dgwt_wcas.labels.page+"")):"more_products"===l.type?(u+=" js-dgwt-wcas-suggestion-more dgwt-wcas-suggestion-more",w="dgwt-wcas-st-more",l.value=dgwt_wcas.labels.show_more+" ("+l.total+")",v=!1):i.showHeadings&&"headline"===l.type?(u+=" js-dgwt-wcas-suggestion-headline dgwt-wcas-suggestion-headline",void 0!==dgwt_wcas.labels[l.value+"_plu"]&&(l.value=dgwt_wcas.labels[l.value+"_plu"]),v=!1):(u+=" dgwt-wcas-suggestion-nores",l.value=dgwt_wcas.labels.no_results,v=!1,!0===i.showDetailsPanel&&d.html(""),t("body").addClass("dgwt-wcas-nores")),f=f.length>0?' title="'+f+'"':"",h+='
',h+="'+p+o(l.value,n,v)+m+"",h+="
"}else!0===i.showImage&&void 0!==l.thumb_html&&(g=!0),c+=void 0!==l.post_id?'data-post-id="'+l.post_id+'" ':"",c+=void 0!==l.taxonomy?'data-taxonomy="'+l.taxonomy+'" ':"",c+=void 0!==l.term_id?'data-term-id="'+l.term_id+'" ':"",h+='
",g&&(h+=''+l.thumb_html+""),h+=g?'
':"",h+='',h+=''+o(l.value,n,!0)+"",!0===i.showSKU&&void 0!==l.sku&&l.sku.length>0&&(h+='('+dgwt_wcas.labels.sku_label+" "+o(l.sku,n,!0)+")"),!0===i.showDescription&&void 0!==l.desc&&l.desc&&(h+=''+o(l.desc,n,!0)+""),h+="",!0===i.showPrice&&void 0!==l.price&&(h+=''+l.price+""),!0===i.showFeaturedBadge&&!0===l.on_sale&&(h+=''+i.saleBadgeText+""),!0===i.showFeaturedBadge&&!0===l.featured&&(h+=''+i.featuredBadgeText+""),h+=g?"
":"",h+="
"}),this.adjustContainerWidth(),g.detach(),c.html(h),t.isFunction(u)&&u.call(s.element,c,s.suggestions),c.show(),t("body").addClass("dgwt-wcas-open"),s.automaticAlignment(),!0===i.showDetailsPanel&&(t("body").addClass("dgwt-wcas-is-details"),d.show(),s.fixHeight()),i.autoSelectFirst&&(s.selectedIndex=0,c.scrollTop(0),c.children("."+r).first().addClass(l)),s.visible=!0,s.fixPositionCapture(),"top"===s.options.orientation&&(s.getSuggestionsContainer().addClass(s.classes.suggestionsContainerOrientTop),t("body").addClass("dgwt-wcas-block-scroll"),setTimeout(function(){s.scrollDownSuggestions()},300)),s.findBestHint())}else this.hide()},adjustContainerWidth:function(){var e,s=this.options,i=t("body"),a=this.getFormWrapper(),o=this.getSuggestionsContainer(),n=this.getDetailsContainer(),r=this.getFormOffset();if(a.length){var l=getComputedStyle(a[0]).width;if(l=Math.round(parseFloat(l.replace("px",""))),"auto"===s.width&&(e=this.el.outerWidth(),o.css("width",e+"px")),this.canShowDetailsBox()){if(a.width()>=550)return i.addClass("dgwt-wcas-full-width"),l%2==0?(o.css("width",Math.round(l/2)),n.css("width",Math.round(l/2))):(o.css("width",Math.floor(l/2)),n.css("width",Math.ceil(l/2))),i.removeClass("dgwt-wcas-details-left"),i.removeClass("dgwt-wcas-details-right"),void(!0===s.isRtl?n.css("left","0"):o.css("left",l/2+r.left+"px"));i.addClass("dgwt-wcas-details-right")}}},findBestHint:function(){var e=this.el.val().toLowerCase(),s=null;e&&(t.each(this.suggestions,function(t,i){var a=0===i.value.toLowerCase().indexOf(e);return a&&(s=i),!a}),this.signalHint(s))},signalHint:function(e){var s="";e&&(s=this.currentValue+e.value.substr(this.currentValue.length)),this.hintValue!==s&&(this.hintValue=s,this.hint=e,(this.options.onHint||t.noop)(s))},preloader:function(e,s,i,a){var o,n,r="dgwt-wcas-preloader-wrapp",l=null==i?r:r+" "+i;if("form"===s?n=this.getFormWrapper().find(".dgwt-wcas-preloader"):"details"===s&&(n=this.getDetailsContainer()),1==dgwt_wcas.show_preloader&&0!=n.length)if(!0===a)if("hide"!==e){if("show"===e){var c=this.options.isRtl?"-rtl":"";o='
',n.html(o)}}else t(r).remove();else"hide"===e?n.removeClass(i):n.addClass(i)},verifySuggestionsFormat:function(e){return e.length&&"string"==typeof e[0]?t.map(e,function(t){return{value:t,data:null}}):e},validateOrientation:function(e,s){return e=t.trim(e||"").toLowerCase(),-1===t.inArray(e,["auto","bottom","top"])&&(e=s),e},processResponse:function(t,e,s){var i=this.options;t.suggestions=this.verifySuggestionsFormat(t.suggestions),i.noCache||(this.cachedResponse[s]=t,i.preventBadQueries&&!t.suggestions.length&&this.badQueries.push(e)),e===this.getQuery(this.currentValue)&&("top"===this.options.orientation&&t.suggestions.reverse(),this.suggestions=t.suggestions,this.suggest())},activate:function(e){var s,i=this.classes.selected,a=this.getSuggestionsContainer(),o=a.find("."+this.classes.suggestion);return a.find("."+i).removeClass(i),this.selectedIndex=e,-1!==this.selectedIndex&&o.length>this.selectedIndex?(s=o.get(this.selectedIndex),t(s).addClass(i),s):null},selectHint:function(){var e=t.inArray(this.hint,this.suggestions);this.select(e)},select:function(t){this.hide(),this.onSelect(t)},moveUp:function(){if(-1!==this.selectedIndex)return 0===this.selectedIndex?(this.getSuggestionsContainer().children("."+this.classes.suggestion).first().removeClass(this.classes.selected),this.selectedIndex=-1,this.ignoreValueChange=!1,this.el.val(this.currentValue),void this.findBestHint()):void this.adjustScroll(this.selectedIndex-1)},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(e){var s=this.activate(e);if(this.getDetails(this.suggestions[e]),s&&!this.canShowDetailsBox()){var i,a,o,n=this.getSuggestionsContainer(),r=t(s).outerHeight();i=s.offsetTop,o=(a=n.scrollTop())+this.options.maxHeight-r,io&&n.scrollTop(i-this.options.maxHeight+r),this.options.preserveInput||(this.ignoreValueChange=!0,this.el.val(this.getValue(this.suggestions[e].value))),this.signalHint(null)}},onSelect:function(e){var s=this.options.onSelect,i=this.suggestions[e];void 0===i.type||"more_products"!==i.type?(this.currentValue=this.getValue(i.value),this.currentValue===this.el.val()||this.options.preserveInput||this.el.val(this.currentValue),i.url.length>0&&(window.location.href=i.url),this.signalHint(null),this.suggestions=[],this.selection=i,t.isFunction(s)&&s.call(this.element,i)):this.el.closest("form").trigger("submit")},getValue:function(t){var e,s,i=this.options.delimiter;return i?1===(s=(e=this.currentValue).split(i)).length?t:e.substr(0,e.length-s[s.length-1].length)+t:t},dispose:function(){this.el.off(".autocomplete").removeData("autocomplete"),t(window).off("resize.autocomplete",this.fixPositionCapture),t("."+this.options.containerClass).remove(),t("."+this.options.containerDetailsClass).remove()},enableOverlayMobile:function(){var e=this;if("on"!==e.overlayMobileState){e.overlayMobileState="on";var s,i=e.getFormWrapper(),a=e.getSuggestionsContainer();t("html").addClass("dgwt-wcas-overlay-mobile-on"),'
','
','','','',"","","
","
",t(e.options.mobileOverlayWrapper).append('
'),(s=t(".js-dgwt-wcas-overlay-mobile")).css("zIndex",999999),i.after(''),i.appendTo(".js-dgwt-wcas-om-bar"),a.appendTo(".js-dgwt-wcas-om-bar"),i.addClass("dgwt-wcas-search-wrapp-mobile"),i.hasClass("dgwt-wcas-has-submit")&&(i.addClass("dgwt-wcas-has-submit-off"),i.removeClass("dgwt-wcas-has-submit")),i.find("."+e.options.searchInputClass).focus(),t(document).on("click",".js-dgwt-wcas-om-return",function(t){e.disableOverlayMobile(s)})}},disableOverlayMobile:function(e){var s=this,i=s.getSuggestionsContainer(),a=t(".js-dgwt-wcas-om-bar").find("."+s.options.searchFormClass);a.hasClass("dgwt-wcas-has-submit-off")&&(a.removeClass("dgwt-wcas-has-submit-off"),a.addClass("dgwt-wcas-has-submit")),a.removeClass("dgwt-wcas-search-wrapp-mobile"),t("html").removeClass("dgwt-wcas-overlay-mobile-on"),i.appendTo("body"),i.removeAttr("body-scroll-lock-ignore"),t(".js-dgwt-wcas-om-hook").after(a),t(".js-dgwt-wcas-overlay-mobile").remove(),t(".js-dgwt-wcas-om-hook").remove(),setTimeout(function(){a.find("."+s.options.searchInputClass).val("");var t=a.find(".dgwt-wcas-close");a.length>0&&t.removeClass("dgwt-wcas-close")},150),s.overlayMobileState="off"},elementOrParentIsFixed:function(e){var s=e.add(e.parents()),i=!1;return s.each(function(){if("fixed"===t(this).css("position"))return i=!0,!1}),i},gaEvent:function(t,e){if(this.options.sendGAEvents)try{if("undefined"!=typeof gtag)return void gtag("event","autocomplete_search",{event_label:t,event_category:e});"undefined"!=typeof ga&&ga("send",{hitType:"event",eventCategory:e,eventAction:"autocomplete_search",eventLabel:t})}catch(t){}}},t.fn.dgwtWcasAutocomplete=function(e,s){return arguments.length?this.each(function(){var i=t(this),a=i.data("autocomplete");"string"==typeof e?a&&"function"==typeof a[e]&&a[e](s):(a&&a.dispose&&a.dispose(),a=new d(this,e),i.data("autocomplete",a))}):this.first().data("autocomplete")},t.fn.autocomplete||(t.fn.autocomplete=t.fn.dgwtWcasAutocomplete),function(){function e(){var e=t(".dgwt-wcas-search-input"),s=[];e.length>1&&e.each(function(){var e=t(this).attr("id");if(-1==t.inArray(e,s))s.push(e);else{var i=Math.random().toString(36).substring(2,6);i="dgwt-wcas-search-input-"+i,t(this).attr("id",i),t(this).closest("form").find("label").attr("for",i)}})}function s(){var e=t(".dgwt-wcas-search-input");e.length>0&&e.each(function(){"object"!=typeof t(this).data("autocomplete")&&t(this).dgwtWcasAutocomplete(window.dgwt_wcas.config)})}t(window).on("load",function(){t(".dgwt-wcas-search-submit").length>0&&t(".dgwt-wcas-search-submit").each(function(){var e=t(this).closest(".dgwt-wcas-search-wrapp").find(".dgwt-wcas-preloader");1==dgwt_wcas.is_rtl?e.css("left",6+t(this).outerWidth()+"px"):e.css("right",t(this).outerWidth()+"px")})}),t(document).ready(function(){var e=1==dgwt_wcas.show_details_box,s=dgwt_wcas.mobile_breakpoint;(jQuery(window).width()