var loadScriptTag=function(t){return new Promise(function(e,n){var o=document.createElement("script");o.type="text/javascript",o.readyState?o.onreadystatechange=function(){"loaded"!=o.readyState&&"complete"!=o.readyState||(o.onreadystatechange=null,e())}:o.onload=function(){e()},o.onerror=function(){n(Error("Failed to load script with src: "+t))},o.src=t,document.getElementsByTagName("head")[0].appendChild(o)})};!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).ahoy=e()}(this,function(){"use strict";function t(){return j.urlPrefix+j.visitsUrl}function e(){return j.urlPrefix+j.eventsUrl}function n(t){return 0===Object.keys(t).length}function o(){return(j.useBeacon||j.trackNow)&&n(j.headers)&&Q&&"undefined"!=typeof window.navigator.sendBeacon&&!j.withCredentials}function i(t,e,n){A.set(t,e,n,j.cookieDomain||j.domain)}function r(t){return A.get(t)}function a(t){A.set(t,"",-1)}function c(t){r("ahoy_debug")&&window.console.log(t)}function s(){for(var t;t=V.shift();)t();M=!0}function u(t,e){var n=t.matches||t.matchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector||t.webkitMatchesSelector;return n?n.apply(t,[e]):(c("Unable to match"),!1)}function d(t,e,n){document.addEventListener(t,function(t){u(t.target,e)&&n(t)})}function l(t){"interactive"===document.readyState||"complete"===document.readyState?setTimeout(t,0):document.addEventListener("DOMContentLoaded",t)}function f(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=16*Math.random()|0,n;return("x"==t?e:3&e|8).toString(16)})}function p(){j.cookies&&Q&&i("ahoy_events",JSON.stringify(U),1)}function h(){var t=document.querySelector("meta[name=csrf-token]");return t&&t.content}function _(){var t=document.querySelector("meta[name=csrf-param]");return t&&t.content}function g(t){var e=h();e&&t.setRequestHeader("X-CSRF-Token",e)}function m(t,e,n){if(Q)if(q&&q.ajax)q.ajax({type:"POST",url:t,data:JSON.stringify(e),contentType:"application/json; charset=utf-8",dataType:"json",beforeSend:g,success:n,headers:j.headers,xhrFields:{withCredentials:j.withCredentials}});else{var o=new XMLHttpRequest;for(var i in o.open("POST",t,!0),o.withCredentials=j.withCredentials,o.setRequestHeader("Content-Type","application/json"),j.headers)j.headers.hasOwnProperty(i)&&o.setRequestHeader(i,j.headers[i]);o.onload=function(){200===o.status&&n()},g(o),o.send(JSON.stringify(e))}}function y(t){var e={events:[t]};return j.cookies&&(e.visit_token=t.visit_token,e.visitor_token=t.visitor_token),delete t.visit_token,delete t.visitor_token,e}function v(t){F.ready(function(){m(e(),y(t),function(){for(var e=0;e<U.length;e++)if(U[e].id==t.id){U.splice(e,1);break}p()})})}function k(t){F.ready(function(){var n=y(t),o=_(),i=h();o&&i&&(n[o]=i),n.events_json=JSON.stringify(n.events),delete n.events,window.navigator.sendBeacon(e(),D(n))})}function b(){return j.page||window.location.pathname}function w(t){return t&&t.length>0?t:null}function C(t){for(var e in t)t.hasOwnProperty(e)&&null===t[e]&&delete t[e];return t}function P(t){var e=t.target;return C({tag:e.tagName.toLowerCase(),id:w(e.id),"class":w(e.className),page:b(),section:I(e)})}function I(t){for(;t&&t!==document;t=t.parentNode)if(t.hasAttribute("data-section"))return t.getAttribute("data-section");return null}function x(){if(M=!1,L=F.getVisitId(),N=F.getVisitorId(),E=r("ahoy_track"),!1===j.cookies||!1===j.trackVisits)c("Visit tracking disabled"),s();else if(L&&N&&!E)c("Active visit"),s();else if(L||i("ahoy_visit",L=f(),j.visitDuration),r("ahoy_visit")){c("Visit started"),N||i("ahoy_visitor",N=f(),j.visitorDuration);var e={visit_token:L,visitor_token:N,platform:j.platform,landing_page:window.location.href,screen_width:window.screen.width,screen_height:window.screen.height,js:!0};for(var n in document.referrer.length>0&&(e.referrer=document.referrer),j.visitParams)j.visitParams.hasOwnProperty(n)&&(e[n]=j.visitParams[n]);c(e),m(t(),e,function(){a("ahoy_track"),s()})}else c("Cookies disabled"),s()}var S=function(t){return void 0===t},O=function(t){return Array.isArray(t)},T=function(t){return t&&"number"==typeof t.size&&"string"==typeof t.type&&"function"==typeof t.slice},D=function(t,e,n,o){return(e=e||{}).indices=!S(e.indices)&&e.indices,e.nullsAsUndefineds=!S(e.nullsAsUndefineds)&&e.nullsAsUndefineds,e.booleansAsIntegers=!S(e.booleansAsIntegers)&&e.booleansAsIntegers,n=n||new FormData,S(t)?n:(null===t?e.nullsAsUndefineds||n.append(o,""):"boolean"!=typeof t?O(t)?t.length&&t.forEach(function(t,i){D(t,e,n,o+"["+(e.indices?i:"")+"]")}):t instanceof Date?n.append(o,t.toISOString()):t!==Object(t)||function(t){return T(t)&&"string"==typeof t.name&&("object"==typeof t.lastModifiedDate||"number"==typeof t.lastModified)}(t)||T(t)?n.append(o,t):Object.keys(t).forEach(function(i){var r=t[i];if(O(r))for(;i.length>2&&i.lastIndexOf("[]")===i.length-2;)i=i.substring(0,i.length-2);D(r,e,n,o?o+"["+i+"]":i)}):n.append(o,e.booleansAsIntegers?t?1:0:t),n)},A={set:function(t,e,n,o){var i="",r="";if(n){var a=new Date;a.setTime(a.getTime()+60*n*1e3),i="; expires="+a.toGMTString()}o&&(r="; domain="+o),document.cookie=t+"="+escape(e)+i+r+"; path=/"},get:function(t){var e,n,o=t+"=",i=document.cookie.split(";");for(e=0;e<i.length;e++){for(n=i[e];" "===n.charAt(0);)n=n.substring(1,n.length);if(0===n.indexOf(o))return unescape(n.substring(o.length,n.length))}return null}},j={urlPrefix:"",visitsUrl:"/ahoy/visits",eventsUrl:"/ahoy/events",page:null,platform:"Web",useBeacon:!0,startOnReady:!0,trackVisits:!0,cookies:!0,cookieDomain:null,headers:{},visitParams:{},withCredentials:!1,visitDuration:240,visitorDuration:1051200},F=window.ahoy||window.Ahoy||{};F.configure=function(t){for(var e in t)t.hasOwnProperty(e)&&(j[e]=t[e])},F.configure(F);var q=window.jQuery||window.Zepto||window.$,L,N,E,M=!1,V=[],Q="undefined"!=typeof JSON&&"undefined"!=typeof JSON.stringify,U=[];F.ready=function(t){M?t():V.push(t)},F.getVisitId=F.getVisitToken=function(){return r("ahoy_visit")},F.getVisitorId=F.getVisitorToken=function(){return r("ahoy_visitor")},F.reset=function(){return a("ahoy_visit"),a("ahoy_visitor"),a("ahoy_events"),a("ahoy_track"),!0},F.debug=function(t){return!1===t?a("ahoy_debug"):i("ahoy_debug","t",525600),!0},F.track=function(t,e){var n={name:t,properties:e||{},time:(new Date).getTime()/1e3,id:f(),js:!0};return F.ready(function(){j.cookies&&!F.getVisitId()&&x(),F.ready(function(){c(n),n.visit_token=F.getVisitId(),n.visitor_token=F.getVisitorId(),o()?k(n):(U.push(n),p(),setTimeout(function(){v(n)},1e3))})}),!0},F.trackView=function(t){var e={url:window.location.href,title:document.title,page:b()};if(t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);F.track("$view",e)},F.trackClicks=function(){d("click","a, button, input[type=submit]",function(t){var e=t.target,n=P(t);n.text="input"==n.tag?e.value:(e.textContent||e.innerText||e.innerHTML).replace(/[\s\r\n]+/g," ").trim(),n.href=e.href,F.track("$click",n)})},F.trackSubmits=function(){d("submit","form",function(t){var e=P(t);F.track("$submit",e)})},F.trackChanges=function(){d("change","input, textarea, select",function(t){var e=P(t);F.track("$change",e)})},F.trackAll=function(){F.trackView(),F.trackClicks(),F.trackSubmits(),F.trackChanges()};try{U=JSON.parse(r("ahoy_events")||"[]")}catch(O){}for(var R=0;R<U.length;R++)v(U[R]);return F.start=function(){x(),F.start=function(){}},l(function(){j.startOnReady&&F.start()}),F}),ahoy.configure({startOnReady:!1});var myFrontendJavascriptUN=function(t){function e(){var t=this;this.configure=function(){p.log("configuring ahoy"),ahoy.configure({urlPrefix:p.getAnalyticsApiUrl(),visitParams:{shop_id:window.un.datastore.shop.id}})},this.start=function(){window.un.datastore.shop.id?(p.log("starting ahoy and possibly creating a visit"),ahoy.start()):p.log("can't start analytics")},this.track=function(t,e){window.un.datastore.shop.id?(p.log("track event: "+t,", with properties: "+e),ahoy.track(t,e)):p.log("can't track: "+t)}}function n(){var e=this,n=function(t){"undefined"==typeof un.debug&&(un.debug=[]),un.debug.push(t)},o=function(t){return"string"==typeof t&&""!==t},i=function(t){return void 0!==t&&null!=t&&!1!==t},r=function(t){return void 0!==t&&null!=t&&t.length>0},a=function(t,e){function n(t,e){return void 0===t?e:t}function o(t,e,o,i){if(e=n(e,2),o=n(o,","),i=n(i,"."),isNaN(t)||null==t)return 0;var r=(t=(t/100).toFixed(e)).split("."),a,c;return r[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g,"$1"+o)+(r[1]?i+r[1]:"")}if(void 0===t||null==t)return"";if("string"==typeof t&&0==t.length)return"";var i=/\{\{\s*(\w+)\s*\}\}/;"string"==typeof t&&(t=t.replace(".",""));var r="";switch(e.match(i)[1]){case"amount":r=o(t,2);break;case"amount_no_decimals":r=o(t,0);break;case"amount_no_decimals_with_comma_separator":r=o(t,0,".",",");break;case"amount_with_comma_separator":r=o(t,2,".",",")}return e.replace(i,r)},c=function(t){return Math.round(100*t)+"%"},s=function(){for(var t=document.getElementsByTagName("script"),n="",o="",i=0;i<t.length;i++)if((n=t[i].getAttribute("src"))&&(n=n.match(/^(.*)widget\/javascript(\?\s*(.+))?\s*/))){o=n[3].match(/shop=(.+).myshopify.com/)[1];break}return".myshopify.com"===(o+=".myshopify.com")&&e.objectChecker(window.Shopify)&&e.objectChecker(window.Shopify.shop)&&(o=window.Shopify.shop),".myshopify.com"===o&&console.log("UN: unable to get shop domain"),o},u=function(){return e.stringChecker(h.primary_domain)?h.primary_domain:h.shopify_domain},d=function(){var t=s(),e=/^un-(.+)-staging(.*)\.myshopify.com$/;return"un-chris-local-2.myshopify.com"===t?"https://wod.ngrok.io":"un-marc-local-pc.myshopify.com"===t?"https://wod4.ngrok.io":"un-teej-local-dev-env.myshopify.com"===t?"https://wod3.ngrok.io":t.match(e)?"https://upsell-now-staging.herokuapp.com":"https://upsell-now.herokuapp.com"},l=function(){var t=s(),e=/^un-(.+)-staging(.*)\.myshopify.com$/;return"un-chris-local-2.myshopify.com"===t?"https://wod.ngrok.io":"un-marc-local-pc.myshopify.com"===t?"https://wod4.ngrok.io":"un-teej-local-dev-env.myshopify.com"===t?"https://wod3.ngrok.io":t.match(e)?"https://upsell-now-api-staging.herokuapp.com":"https://upsell-now-api.herokuapp.com"},f=function(){return!("undefined"==typeof window.un||"undefined"==typeof window.un.datastore)},_=function(){return g()&&v().length>0},g=function(){return!(!f()||"undefined"==typeof window.un.datastore.shop)&&window.un.datastore.shop},v=function(){return f()&&"undefined"!=typeof window.un.datastore.offers?window.un.datastore.offers:[]},k=function(){return"undefined"!=typeof window.un&&"undefined"!=typeof window.un.offers?window.un.offers:[]},b=function(n){var o=!1,i=e.getOfferObjects();return p.arrayChecker(i)&&t.each(i,function(t,e){n===e.id&&(o=e)}),o},w=function(){return-1!==window.location.href.replace("https://","").indexOf("/products")},C=function(){return-1!==window.location.href.replace("https://","").indexOf("/cart")},P=function(){return-1!==window.location.href.indexOf("/collections/")&&-1===window.location.href.indexOf("/products/")},I=function(){return"/"===window.location.pathname},x=function(){return window.un.datastore.shop.enabled_on_homepage},S=function(){return window.un.datastore.shop.enabled_on_collection_pages},O=function(){return p.onHomePage()&&p.enabledOnHomePage()||p.onCollectionPage()&&p.enabledOnCollectionPage()||!p.onHomePage()&&!p.onCollectionPage()},T=function(){var e=1;return t('form[action="/cart/add"]:first').find("input[name=quantity]:visible").length>0&&(e=t('form[action="/cart/add"]:first').find("input[name=quantity]:visible").val()),Number(e)},D=function(){var n=window.un.datastore.theme_setting,i=window.un.datastore.shop,r=[["cart_subtotal_selector","cart_subtotal_selector"],["checkout_button_selector","checkout_button_selector"],["add_to_cart_form_selector","add_to_cart_form_selector"],["add_to_cart_button_selector","add_to_cart_button_selector"],["quantity_selector","quantity_selector"],["cart_form_selector","cart_form_selector"],["quantity_button_selector","quantity_button_selector"],["variant_selector","variant_selector"],["swatch_selector","swatch_selector"],["mutation_ids","mutation_ids"],["mutation_classes","mutation_classes"],["cart_bar_placement_selector","cart_bar_placement_selector"],["cart_bar_placement_position","cart_bar_placement_position"],["cart_bar_ajax_placement_selector","cart_bar_ajax_placement_selector"],["cart_bar_ajax_placement_position","cart_bar_ajax_placement_position"]];t.each(r,function(t,o){i[o[0]]=e.mergeValues(i[o[0]],n[o[1]])}),null==i.custom_css&&(i.custom_css=""),i.add_to_cart_button_selector=i.add_to_cart_button_selector+", .un-cloned-atc-btn",o(n.custom_css)&&(i.custom_css=i.custom_css+"\r\n"+n.custom_css),o(i.custom_css)&&t("head").append('<style type="text/css">'+i.custom_css+"</style>"),window.un.datastore.shop=i,window.un.addedToCart={}},A=function(t,e){return o(t)?t:e},j=function(t,e,n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3);var i="expires="+o.toUTCString();document.cookie=t+"="+e+";"+i+";path=/"},F=function(t){var e=new Date;e.setTime(e.getTime()-2592e6);var n="expires="+e.toUTCString();document.cookie=t+"=;"+n+";path=/"},q=function(t){for(var e=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var i=n[o];" "==i.charAt(0);)i=i.substring(1);if(0==i.indexOf(e))return i.substring(e.length,i.length)}return""},L=function(t){for(var e=[],n=t,o=document.cookie.split(";"),i=0;i<o.length;i++){for(var r=o[i];" "==r.charAt(0);)r=r.substring(1);0==r.indexOf(n)&&e.push(r)}return e},N=function(){var e=location.search.match(/variant=([0-9]+)/);return null!=e?e[1]:"radio"===t(h.add_to_cart_form_selector).find('select[name="id"], input[name="id"]').attr("type")?t(h.add_to_cart_form_selector).find('input[name="id"]:checked').val():t(h.add_to_cart_form_selector).find('select[name="id"], input[name="id"]').val()},E=function(){if(!e.onProductPage())return null;if(void 0!==e.getCurrentVariantId()){var t=window.un.product.variants.find(function(t){return t.id.toString()===e.getCurrentVariantId().toString()});return void 0===t?(p.log("Unable to find current variant because current variant ID isn't matching a variant in un.product.variants object. Returning first variant in product object."),window.un.product.variants[0]):t}return p.log("Unable to find current variant because getCurrentVariantId() is returning undefined. Returning first variant in product object."),window.un.product.variants[0]},M=function(t){var n=e.getCookie("_un_discounted_line_item_"+t);return""!==n&&(n.indexOf("_")>-1?parseInt(n.split("_")[0]):parseInt(n))},V=function(t){var n=e.getCookie("_un_discounted_line_item_"+t);return""!==n&&(n.indexOf("_")>-1&&parseInt(n.split("_")[1]))},Q=function(e){var n;if("function"==typeof Spinner){var o=new Spinner({top:"-50px",left:"50%",position:"relative"}).spin().el;t(e).first().after(o)}},U=function(){t(".spinner").remove()},R=function(e){t(e).css("background","#EEEEEE"),t(e).css("color","#FFFFFF"),t(e).css("border","1px solid #DDDDDD")},H=function(t){return!t.available},B=function(e,n,o){p.stringChecker(o)&&t(e).css(n,o)},K=function(){return window.location.href.indexOf("upsell-now-debug")<0},W=function(t){return t<0?0:t},z=function(t,e){return this.checkMutationIds(t,e)||this.checkMutationClasses(t,e)},G=function(e,n){var o=[],i=!1;return"ajaxCart"===n&&(o=["drawer","cart-drawer__item-list","cart-item__qty","mm-opened","cart-sidebar","opened","cart-preview","ajaxcart__inner","cart--is-visible"]),t.each(o,function(t,n){"undefined"!=typeof e.target.classList&&e.target.classList.contains(n)&&(i=!0)}),i},J=function(t,e){var n=[];return"ajaxCart"===e&&(n=["ajaxifyCart","cart-loading","AjaxifyCart","layer-addcart-modal"]),n.indexOf(t.target.id)>-1},$=function(t){if("string"==typeof t){var e=[];return e.push(t),e}return t},X=function(){var t=p.getCookiesWithPartialName("_un_discounted_line_item_");return t=t.filter(function(t){return t.indexOf(y)<0&&t.indexOf(m)<0})},Y=function(e,n){var o=["display","border","background","margin","padding","font-family","font-size","font-weight","height","width","text-transform","font-style","letter-spacing","flex","color","line-height","text-decoration","text-align","vertical-align","white-space","border-radius","cursor","position"];t.each(o,function(o,i){t(n).css(i,t(e).css(i))})};this.stringChecker=o,this.objectChecker=i,this.arrayChecker=r,this.unFormatCents=a,this.unFormatPercent=c,this.getShopifyDomain=s,this.getPrimaryDomain=u,this.getServerAddress=d,this.getAnalyticsApiUrl=l,this.checkDatastore=f,this.checkSettingsInDatastore=_,this.getShopInDatastore=g,this.getOffersInDatastore=v,this.getOfferObjects=k,this.onProductPage=w,this.onCartPage=C,this.onCollectionPage=P,this.onHomePage=I,this.enabledOnHomePage=x,this.enabledOnCollectionPage=S,this.getProductPageQuantityValue=T,this.mergeThemeAndShopSettings=D,this.mergeValues=A,this.setCookie=j,this.expireCookie=F,this.getCookie=q,this.getCookiesWithPartialName=L,this.getOfferIdForItemKeyFromCookie=M,this.getQuantityForItemKeyFromCookie=V,this.enableSpinner=Q,this.disableSpinner=U,this.applyDisabledStyles=R,this.outOfStock=H,this.applyStyle=B,this.log=n,this.notInDebugMode=K,this.noNegative=W,this.enabledOnCurrentPage=O,this.getCurrentVariant=E,this.getCurrentVariantId=N,this.checkMutations=z,this.checkMutationClasses=G,this.checkMutationIds=J,this.arrayify=$,this.getDiscountedLineItemsFromCookies=X,this.getOfferById=b,this.cloneStyles=Y}function o(e){var n=this,o=function(){n.checkBundleIntegrity()},i=function(){_.updateCart(function(){n.switchTempOriginalProductLinksToLineItemKeys(),n.clearOldLineItemKeys(),h.remove_upsell_products_if_original_product_removed&&(p.log("Checking for original products"),n.initAjaxCartMutationObserver(),n.disableRemoveButtonClickListeners(),n.createRemoveButtonClickEventListener(),n.checkIfOriginalProductStillInCart()),h.remove_upsell_products_if_trigger_products_removed&&(p.log("Checking for trigger product requirements"),n.checkTriggerProductRequirements()),h.prevent_upsell_product_qty_change&&(p.log("Checking for upsell product quantity changes"),n.checkUpsellProductQtys())})},r=function(){var e=p.getDiscountedLineItemsFromCookies(),n=[];t.each(e,function(t,e){var o=e.substring(0,e.indexOf("=")),i=o.substring(o.lastIndexOf("_")+1),r=p.getOfferIdForItemKeyFromCookie(i);if(r){var a=p.getOfferById(r);a&&(a.checkIfTriggerProductsInCart()||(p.log("Trigger products req not met for "+r+". Removing associated upsell items."),n.push(i)))}}),n.length>0&&(p.log("Removing line items:"+n),_.removeLineItemKeysFromCart(n))},a=function(){var e=p.getDiscountedLineItemsFromCookies();t.each(e,function(t,e){var n=e.substring(0,e.indexOf("=")),o=n.substring(n.lastIndexOf("_")+1);_.hasLineItemKey(o)||p.expireCookie(n)})},c=function(){var e=p.getDiscountedLineItemsFromCookies();t.each(e,function(t,e){var n=e.substring(0,e.indexOf("=")),o=n.substring(n.lastIndexOf("_")+1),i=p.getQuantityForItemKeyFromCookie(o),r;i!==_.getLineItemQuantity(o)&&(p.log("Upsell product quantity changed for: "+o+". Resetting quantity."),_.changeQuantity(o,i))})},s=function(){var e=p.getCookiesWithPartialName(m);t.each(e,function(t,e){var n=e.substring(e.lastIndexOf("_")+1,e.indexOf("=")),o=e.substring(e.indexOf("=")+1).split(",");_.hasLineItemKey(n)?p.log("Original product line item key found in cart."):(p.log("Original product line item key missing from cart. Removing upsell items."),o=p.arrayify(o),p.expireCookie(e.substring(0,e.indexOf("="))),_.removeLineItemKeysFromCart(o))})},u=function(){var t=n.generateOriginalProductVariantIdToUpsellKeyMap();n.setOriginalProductLineItemKeyToUpsellItemKeysCookie(t),n.clearTempOriginalProductLinkCookies()},d=function(){var e=p.getCookiesWithPartialName(y),n={};return t.each(e,function(t,e){var o=e.substring(y.length,e.indexOf("=")),i=e.substring(e.indexOf("=")+1,e.length);p.objectChecker(n[i])||(n[i]=[]),n[i].push(o)}),n},l=function(e){t.each(Object.keys(e),function(t,n){var o=_.getLastLineItemKeyForVariantId(n);if(o){var i=e[n].join(",");p.stringChecker(i)&&p.stringChecker(o)&&p.setCookie(m+o,i,30)}})},f=function(){var e=p.getCookiesWithPartialName(y);t.each(e,function(t,e){var n=e.substring(0,e.indexOf("="));p.expireCookie(n)})},g=function(){t(document).on("click",v,function(t){return t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation(),_.updateCart(function(){n.switchTempOriginalProductLinksToLineItemKeys(),n.handleRemoveButtonClick(t)}),!1})},k=function(){var t=!1,e=new MutationObserver(function(e){e.forEach(function(e){!t&&p.checkMutations(e,"ajaxCart")&&(setTimeout(function(){p.log("Ajax cart mutation triggered."),n.disableRemoveButtonClickListeners(),n.checkBundleIntegrity()},250),t=!0)}),setTimeout(function(){t=!1},2e3)}),o={attributes:!0,childList:!0,characterData:!0,subtree:!0},i=document.body;e.observe(i,o)},b=function(){t(".cart-item__remove, .cart-drawer__item-delete").removeAttr("data-cart-item-delete"),t.each(t(".cart-item__remove"),function(e,n){t(n).replaceWith(t(n).clone().removeClass("cart-item__remove").addClass("un-remove-btn"))})},w=function(t){var e=n.getRemovedLineItemKeyFromLink(t);if(e){var o=p.getCookie(m+e);if(p.stringChecker(o))p.log("Found upsell cookie, displaying warning"),n.showUpsellProductRemovalWarning(e,o);else{p.log("Couldn't find upsell item cookie for removed item.");var i=[];i.push(e),_.removeLineItemKeysFromCart(i)}}else p.log("Couldn't find line item key for removed item.")},C=function(e,o){var i=n.convertProductKeysToProductNames(e)[0],r=o.split(","),a=n.convertProductKeysToProductNames(r);if(a.length>0){var c=a.join(", "),s=h.removing_original_product_will_remove_upsell_products_warning.replace("{{original_product}}",i).replace("{{upsell_products}}",c),u,d;if(s=t("<div/>").html(s).text(),confirm(s))(d=[]).push(e),d=d.concat(r),p.expireCookie(m+e),_.removeLineItemKeysFromCart(d)}else{var d;p.log("No upsell items associated with line item key. Clearing cookie and removing item from cart."),(d=[]).push(e),p.expireCookie(m+e),_.removeLineItemKeysFromCart(d)}},P=function(e){var n=[];if("string"==typeof e){var o=_.getProductTitleFromLineItemKey(e);p.stringChecker(o)&&n.push(o)}else"object"==typeof e&&t.each(e,function(t,e){var o=_.getProductTitleFromLineItemKey(e);p.stringChecker(o)&&n.push(o)});return n},I=function(e){var n=!1,o=t(e.target).attr("href");if(p.stringChecker(o)||(o=t(e.target).parent().attr("href")),p.stringChecker(o)&&o.indexOf("line=")>=0){var i=/line=([0-9]+)/g.exec(o)[1]-1;n=un.cart.items[i].key}else n=t(e.target).parents(".cart-drawer__item").data("cart-item-id");return p.stringChecker(n)||(n=t(e.target).parents(".cart-row").data("id")),n};this.offers=e,this.startBundleEnforcer=o,this.switchTempOriginalProductLinksToLineItemKeys=u,this.createRemoveButtonClickEventListener=g,this.handleRemoveButtonClick=w,this.clearTempOriginalProductLinkCookies=f,this.generateOriginalProductVariantIdToUpsellKeyMap=d,this.setOriginalProductLineItemKeyToUpsellItemKeysCookie=l,this.getRemovedLineItemKeyFromLink=I,this.showUpsellProductRemovalWarning=C,this.convertProductKeysToProductNames=P,this.initAjaxCartMutationObserver=k,this.disableRemoveButtonClickListeners=b,this.checkBundleIntegrity=i,this.checkIfOriginalProductStillInCart=s,this.checkUpsellProductQtys=c,this.clearOldLineItemKeys=a,this.checkTriggerProductRequirements=r}function i(e){var n=this,o=function(){n.checkIfItemsWereAddedViaUpsellPopup(),n.updateCartPageWithDiscounts(),n.initRefreshCartPageEventHandler()},i=function(){n.updateDiscountedSubtotal(),n.updateLineItemPrices(),n.updateLineItemTotals(),h.cart_bar_enabled&&p.objectChecker(un.cart.un_total_discount)&&un.cart.un_total_discount>0&&n.showCartBar(),h.hide_express_checkout_buttons&&p.objectChecker(un.cart.un_total_discount)&&un.cart.un_total_discount>0&&(t("head").append('<style type="text/css">.additional-checkout-buttons,.google-wallet-button-holder,.amazon-payments-pay-button,.shopify-payment-button{\ndisplay:none !important;\n}</style>'),t(".additional-checkout-buttons, .google-wallet-button-holder,.amazon-payments-pay-button,.shopify-payment-button").css("display","none"))},r=function(){0===t("#un-cart-bar-page").length&&n.addBarToPage(h.cart_bar_placement_selector,h.cart_bar_placement_position,"un-cart-bar-page"),0===t("#un-cart-bar-ajax").length&&h.ajax_cart_integration_enabled&&n.addBarToPage(h.cart_bar_ajax_placement_selector,h.cart_bar_ajax_placement_position,"un-cart-bar-ajax"),n.applyBarStyles()},a=function(){p.stringChecker(h.cart_bar_font_family)&&(t("head").append('<link href="https://fonts.googleapis.com/css?family='+h.cart_bar_font_family+'" rel="stylesheet">'),t(".un-cart-bar").css("font-family",h.cart_bar_font_family.replace(/\+/g," ")+", sans-serif")),p.applyStyle(".un-cart-bar","background-color",h.cart_bar_bg_color),p.applyStyle(".un-cart-bar","color",h.cart_bar_text_color),p.applyStyle(".un-cart-bar","padding",h.cart_bar_padding),p.applyStyle(".un-cart-bar","font-size",h.cart_bar_font_size),p.applyStyle(".un-cart-bar","border-radius",h.cart_bar_border_radius)},c=function(e,n,o){var i='<div class="un-cart-bar" style="display: none;" id="'+o+'">'+h.cart_bar_text+"</div>",r=h.cart_bar_fade_in_duration||0,a=h.cart_bar_fade_out_duration||0,c=h.cart_bar_display_duration||0;p.stringChecker(n)&&"after"!==n?"before"===n?t(e).before(i):"prepend"===n?t(e).prepend(i):"append"===n&&t(e).append(i):t(e).after(i),t(".un-cart-bar").fadeIn(1e3*r),c>0&&setTimeout(function(){t(".un-cart-bar").fadeOut(1e3*a)},1e3*c)},u=function(){p.stringChecker(h.cart_form_selector)&&(p.stringChecker(h.quantity_selector)&&t(document).on("change",h.quantity_selector,function(e){setTimeout(function(){t(h.cart_form_selector).submit()},1500)}),p.stringChecker(h.quantity_button_selector)&&t(document).on("click",h.quantity_button_selector,function(e){setTimeout(function(){t(h.cart_form_selector).submit()},1500)}))},d=function(){var e=l();t(h.cart_subtotal_selector).html(p.unFormatCents(e,h.money_with_currency_format))},l=function(){var e=0;return t.each(un.cart.items,function(t,n){p.objectChecker(n.un_total_discount_value)&&(e+=n.un_total_discount_value)}),un.cart.un_total_discount=e,un.cart.total_price-e},f=function(){var e=t(".un-line-item-unit-price");t.each(un.cart.items,function(n,o){p.objectChecker(o.un_discount_value)&&t.each(e,function(e,n){t(n).data("id")===o.key&&t(n).html(p.unFormatCents(o.un_discounted_price,h.money_format))})})},g=function(){var e=t(".un-line-item-total");t.each(un.cart.items,function(n,o){p.objectChecker(o.un_discount_value)&&t.each(e,function(e,n){if(t(n).data("id")===o.key){var i=o.line_price-o.un_total_discount_value;t(n).html(p.unFormatCents(i,h.money_format))}})})},m=function(){p.objectChecker(window.un.cart.items)&&t.each(window.un.cart.items,function(t,e){var o=p.getOfferIdForItemKeyFromCookie(e.key);if(o){var i=s.getActiveOfferById(o);p.objectChecker(i)&&n.applyOfferDiscountToItem(e,i)}})},y=function(t,e){"percentage_discount"===e.discountType?(t.appliedDiscount=n.percentageDiscountHash(t,e),t.un_discount_value=100*t.appliedDiscount.discount_amount,t.un_total_discount_value=100*t.appliedDiscount.total_discount_amount,t.un_discounted_price=t.price-t.un_discount_value):"fixed_amount_discount"===e.discountType?(t.appliedDiscount=n.fixedAmountDiscountHash(t,e),t.un_discount_value=e.discountFixedAmount,t.un_total_discount_value=t.appliedDiscount.total_discount_amount,t.un_discounted_price=t.price-e.discountFixedAmount):"set_price"===e.discountType&&(t.appliedDiscount=n.setPriceDiscountHash(t,e),t.un_discount_value=t.price-e.discountPrice,t.un_total_discount_value=t.appliedDiscount.total_discount_amount,t.un_discounted_price=e.discountPrice)},v=function(t,e){var n=Math.floor(e.discountFixedAmount),o={};return n>t.price&&(n=t.price),o.discount_amount=n,o.total_discount_amount=n*t.quantity,o.value_type="fixed_amount",o.description=h.discount_title,o.title=h.discount_title,o.value=n/100,o.amount=n*t.quantity/100,o},k=function(t,e){var n={},o=t.price/100;return n.value=Math.floor(e.discountPercent),n.discount_amount=Math.floor(o*n.value)/100,n.total_discount_amount=Math.floor(o*n.value*t.quantity)/100,n.value_type="percentage",n.description=h.discount_title,n.title=h.discount_title,n.amount=Math.floor(o*n.value*t.quantity)/100,n},b=function(t,e){var n=Math.floor(t.price-e.discountPrice),o={};return o.discount_amount=n,o.total_discount_amount=n*t.quantity,o.value_type="fixed_amount",o.description=h.discount_title,o.title=h.discount_title,o.value=n/100,o.amount=n*t.quantity/100,o},w=function(t){var e=["ajaxifyCart","cart-loading","AjaxifyCart","layer-addcart-modal"];if(p.stringChecker(h.mutation_ids)){var n,o=h.mutation_ids.replace(/ /g,"").split(",");e=e.concat(o)}return-1!==e.indexOf(t.target.id)},C=function(e){var n=["drawer","cart-drawer__item-list","ajaxcart__footer--fixed","cart-item__qty","mm-opened","cart-sidebar","opened","cart-preview","mfp-ready"];if(p.stringChecker(h.mutation_classes)){var o,i=h.mutation_classes.replace(/ /g,"").split(",");n=n.concat(i)}var r=!1;return t.each(n,function(t,n){"undefined"!=typeof e.target.classList&&e.target.classList.contains(n)&&(r=!0)}),r},P=function(t){return w(t)||C(t)},I=function(){var t=!1,e=new MutationObserver(function(e){e.forEach(function(e){!t&&P(e)&&(setTimeout(function(){_.updateCart(function(){n.applyOfferDiscountsToCart(),s.createCheckoutEventListener()})},250),t=!0)}),setTimeout(function(){t=!1},2e3)}),o={attributes:!0,childList:!0,characterData:!0,subtree:!0},i=document.body;e.observe(i,o)};this.offers=e,this.applyOfferDiscountsToCart=o,this.checkIfItemsWereAddedViaUpsellPopup=m,this.applyOfferDiscountToItem=y,this.updateDiscountedSubtotal=d,this.updateLineItemPrices=f,this.updateLineItemTotals=g,this.fixedAmountDiscountHash=v,this.percentageDiscountHash=k,this.setPriceDiscountHash=b,this.updateCartPageWithDiscounts=i,this.initRefreshCartPageEventHandler=u,this.initAjaxCartObserver=I,this.showCartBar=r,this.addBarToPage=c,this.applyBarStyles=a}function r(){var e=this,n=function(e,n,o,i){window.un.addedToCart[e]=!0;var r={quantity:n,id:e};o.length>0&&(r.properties=o[0]),t.ajax({cache:!1,type:"POST",url:"/cart/add.js",data:r,dataType:"json"}).done(function(t){i(t)})},o=function(t){return"undefined"==typeof window.un.addedToCart[t]},i=function(e){t.ajax({cache:!1,type:"GET",url:"https://"+window.location.hostname+"/cart?view=upsell-now-cart",success:function(t){window.un.cart=JSON.parse(t),e()}})},r=function(){var n={};return n.line_items=JSON.stringify(e.getLineItemsHash()),n.order_notes="",t("#CartSpecialInstructions:visible").length>0&&(n.order_notes=t("#CartSpecialInstructions:visible").val()),t("#cartSpecialInstructions:visible").length>0&&(n.order_notes+=t("#cartSpecialInstructions:visible").val()),t("#cartSpecialInstructionsFromPopup:visible").length>0&&(n.order_notes+=t("#cartSpecialInstructionsFromPopup:visible").val()),""===n.order_notes&&t("textarea[name='note']:visible:first").length>0&&(n.order_notes+=t("textarea[name='note']:visible:first").val()),n},a=function(){var n=[];return t.each(window.un.cart.items,function(t,o){n.push(e.getLineItemHash(o))}),n},c=function(t){var n={};return n.title=t.title,n.variant_id=t.variant_id,n.product_id=t.product_id,n.image=t.image,n.quantity=t.quantity,n.grams=t.grams,n.requires_shipping=t.requires_shipping,n.price=t.price/100,n.properties=e.getLineItemPropertiesArray(t),p.objectChecker(t.appliedDiscount)&&(n.applied_discount=t.appliedDiscount),n},s=function(e){var n=[];return null!=e.properties&&t.each(Object.keys(e.properties),function(t,o){var i={};i.name=o,i.value=e.properties[o],n.push(i)}),n},u=function(){var e=!1;return t.each(window.un.cart.items,function(t,n){p.objectChecker(n.appliedDiscount)&&(e=!0)}),e},d=function(e){t.ajax({cache:!1,type:"POST",url:p.getServerAddress()+"/get_checkout_url?shopify_domain="+p.getShopifyDomain(),data:JSON.stringify(e),dataType:"json",contentType:"application/json; charset=utf-8",success:function(t){t.invoice_url?window.location.href=t.invoice_url.replace("checkout.shopify.com",h.primary_domain):alert("An error occured, and we're unable to process your order at this time. Please contact customer service for assistance. ")}})},l=function(){var t=e.cloneUnCart();return e.addCurrentProductPageVariantAsLineItem(t),t},f=function(){return JSON.parse(JSON.stringify(window.un.cart))},_=function(t){if(!p.onProductPage())return t;var e=p.getCurrentVariantId(),n=t.items.find(function(t){return t.variant_id==e});return"object"==typeof n?n.quantity+=p.getProductPageQuantityValue():((n={}).quantity=p.getProductPageQuantityValue(),n.price=p.getCurrentVariant().price,n.collection_ids=window.un.product_collections,n.product_id=window.un.product.id,n.variant_id=Number(e),t.items.push(n)),t.total_price=t.items.reduce(function(t,e){
return t+e.price*e.quantity},0),t.original_total_price=t.total_price,t},g=function(n){var o=!1,i=e.cloneWithCurrentProductPageVariantAsLineItem();return t.each(i.items,function(t,e){e.product_id.toString()===n.toString()&&(o=!0)}),o},m=function(e){var n=!1;return t.each(un.cart.items,function(t,o){o.key===e&&(n=!0)}),n},y=function(e){var n=!1;return t.each(un.cart.items,function(t,o){o.key===e&&(n=o)}),n},v=function(t){var n=e.getLineItem(t);return!!n&&n.quantity},k=function(e){var n=!1,o=un.cart.items.reverse();return t.each(o,function(t,o){o.variant_id.toString()===e.toString()&&(n=o.key)}),n},b=function(e){var n=!1;return t.each(un.cart.items,function(t,o){o.key.toString()===e&&(n=o.title)}),n},w=function(n){var o=e.createUpdateQtyHash(n,0);t.ajax({cache:!1,type:"POST",url:"/cart/update.js",data:{updates:o},dataType:"json"}).done(function(t){e.redirectToCartPage()})},C=function(n,o){var i=p.arrayify(n),r=e.createUpdateQtyHash(i,o);t.ajax({cache:!1,type:"POST",url:"/cart/update.js",data:{updates:r},dataType:"json"}).done(function(t){e.redirectToCartPage()})},P=function(e,n){var o={};return t.each(e,function(t,e){o[e]=n}),o},I=function(){setTimeout(function(){window.location.href="/cart"},250)};this.updateCart=i,this.changeQuantity=C,this.addToCart=n,this.createDraftOrder=r,this.getLineItemsHash=a,this.getLineItemHash=c,this.getLineItemPropertiesArray=s,this.hasDiscounts=u,this.getAndSendToCheckoutUrl=d,this.cloneWithCurrentProductPageVariantAsLineItem=l,this.cloneUnCart=f,this.addCurrentProductPageVariantAsLineItem=_,this.inCart=g,this.notYetAddedToCart=o,this.getLastLineItemKeyForVariantId=k,this.getProductTitleFromLineItemKey=b,this.removeLineItemKeysFromCart=w,this.redirectToCartPage=I,this.createUpdateQtyHash=P,this.hasLineItemKey=m,this.getLineItem=y,this.getLineItemQuantity=v}function a(e){var n=this,o="_un_closed_offer_"+e.id.toString(),i=function(){g.start(),g.track("viewed upsell popup",{offer_id:e.id}),t("#un-modal-title").text(e.popupTitle),t("#un-modal-description").text(e.popupDescription),t("#upsell-popup-close-link").text(h.no_thanks_text),n.printProductRows(),t("#un-modal-background").addClass("un-manual-modal-container"),n.initializeAddToCartButtons(),n.initializeVariantFields(),n.initializeCloseButtons(),n.applyStyles()},a=function(){t(window).click(function(t){!n.fullsizeImageModalOpenedOnPage()&&t.target.classList.contains("un-manual-modal-container")&&n.close(),n.closeImagePopupOnClickOutside()}),t("#un-modal-close-btn, #upsell-popup-close-link").click(function(){n.close()}),n.initializeAddToCartButtons(),n.initializeVariantFields(),n.initializeQuantityFields(),n.applyStyles()},c=function(){t("#un-modal-background").removeClass("un-manual-modal-container"),window.un.atcPopupClosed||(window.un.atcPopupClosed=!0,"omorose-natural-products.myshopify.com"!==p.getShopifyDomain()&&"roadgods-dev.myshopify.com"!==p.getShopifyDomain()&&t(h.add_to_cart_button_selector).trigger("click"),"honu-au.myshopify.com"===p.getShopifyDomain()&&setTimeout(function(){window.location.href="/cart"},1250)),h.hide_offer_if_already_declined&&p.setCookie(o,e.id,h.num_days_before_showing_offer_again)},s=function(){n.fullsizeImageModalOpenedOnPage()&&(t("#un-modal-background-for-full-img").hasClass("opened")?(t("#un-modal-background-for-full-img").removeClass("opened"),t("#un-modal-background-for-full-img").removeClass("un-manual-modal-container")):t("#un-modal-background-for-full-img").addClass("opened"))},u=function(){t("#un-modal-background").removeClass("un-manual-modal-container"),window.un.checkoutPopupClosed=!0,h.hide_offer_if_already_declined&&p.setCookie(o,e.id,h.num_days_before_showing_offer_again),r.checkoutEventHandler()},d=function(){t("#upsell-product-table").html(""),t.each(e.productsForPopup,function(o,i){var r=t("#upsell-popup-product-row").html(),a=n.getPrices(i.originalPrice,i.price),c=p.outOfStock(i),s=t("<div/>").html(i.title).text(),u=t("<div/>").html(a[0]).text(),d=t("<div/>").html(a[1]).text(),l=n.getVariantFieldHTML(i),f=n.getProductLink(i),_=e.showVariantField,g=n.getUpsellProductQty(i,e),m=n.getProductImageSetting(e.productImageSetting),y=n.showFullSizeProductImage(e);i.variants.length<2&&(_=!1);var v={show_product_image:m,upsell_product_img_src:i.imgSrc,upsell_product_title:s,upsell_product_qty:g,upsell_product_original_price:u,upsell_product_price:d,upsell_product_id:i.productId,upsell_variant_id:i.variantId,upsell_product_out_of_stock:c,upsell_product_in_stock:!c,upsell_product_add_to_cart_text:h.add_to_cart_button_text,upsell_product_sold_out_text:h.sold_out_button_text,upsell_show_quantity_field:e.showQuantityField,upsell_hide_quantity_field:!e.showQuantityField,upsell_show_variant_field:_,upsell_product_variants:l,upsell_product_link:f,product_links_enabled:e.productLinksEnabled,show_full_product_image:y},k,b=unHandleBars.compile(r)(v);b=b.replace(/undefined/g," "),t("#upsell-product-table").append(b)})},l=function(t,o){var i=[];return"no_discount"!==e.discountType&&0!==e.discountType?(i[0]=p.unFormatCents(o,h.money_format),i[1]=p.unFormatCents(n.getDiscountedPrice(o),h.money_format)):("number"==typeof parseInt(t)&&parseInt(t)>parseInt(o)?i[0]=p.unFormatCents(t,h.money_format):i[0]=!1,i[1]=p.unFormatCents(o,h.money_format)),i},f=function(t){var n=0,o=e.discountType;return"percentage_discount"===o?n=Math.floor(t*(1-e.discountPercent/100)):"fixed_amount_discount"===o?n=t-e.discountFixedAmount:"set_price"===o&&(n=e.discountPrice),(n<0||""===n)&&(n=0),n},m=function(){t(document).on("click",".upsell-product-add-to-cart",function(o){var i=t(o.target).data("id"),r=t(o.target).data("product-id");if(_.notYetAddedToCart(i)){if(t(o.target).text(h.added_to_cart_button_text).val(h.added_to_cart_button_text),t(o.target).addClass("disabled"),t("#upsell-now-qty-"+i).length>0)var a=t("#upsell-now-qty-"+i).val();else if(e.showQuantityField)var a=t(".upsell-now-quantity-field[data-product-id='"+r+"']").val();else var a=t(o.target).data("quantity");var c=e.getLineItemDiscountPropertyArray();_.addToCart(i,a,c,function(t){var o=t.key,i=p.getCurrentVariantId();p.setCookie("_un_discounted_line_item_"+o,e.id.toString()+"_"+a,30),p.setCookie("_un_discounted_line_item_original_product_link_temp_"+o,i,30),e.closePopupOnATC&&n.close()}),o.stopPropagation(),o.preventDefault()}})},y=function(){p.stringChecker(h.add_to_cart_button_font_family)&&(t("head").append('<link href="https://fonts.googleapis.com/css?family='+h.add_to_cart_button_font_family+'" rel="stylesheet">'),t("body #upsell-product-table .upsell-product-add-to-cart").css("font-family",h.add_to_cart_button_font_family.replace(/\+/g," ")+", sans-serif")),p.stringChecker(h.popup_font_family)&&(t("head").append('<link href="https://fonts.googleapis.com/css?family='+h.popup_font_family+'" rel="stylesheet">'),t("body #un-modal-content").css("font-family",h.popup_font_family.replace(/\+/g," ")+", sans-serif")),p.applyStyle("#upsell-product-table .upsell-product-add-to-cart","background-color",h.add_to_cart_button_bg_color),p.applyStyle("#upsell-product-table .upsell-product-add-to-cart","color",h.add_to_cart_button_text_color),p.applyStyle("#upsell-popup-close-link","color",h.no_thanks_text_color),p.applyStyle(".upsell-product-title","color",h.product_title_text_color),p.applyStyle(".upsell-product-original-price","color",h.regular_price_text_color),p.applyStyle(".upsell-product-price","color",h.sale_price_text_color),p.applyStyle("#un-modal-content","background-color",h.popup_bg_color),p.applyStyle("#un-modal-title","color",h.popup_title_text_color),p.applyStyle("#un-modal-description","color",h.popup_description_text_color)},v=function(e){var o="",i=!0,r="";return n.offer.showVariantField&&e.variants.length>1&&(o='<select class="upsell-product-variant-field" data-id="'+e.productId+'">',t.each(e.variants,function(t,e){e.available&&i?(r="SELECTED",i=!1):r="",o+='<option value="'+e.id+'" '+r+">"+e.title+"</option>"}),o+="</select>"),o},k=function(){n.offer.showVariantField&&t(document).on("change",".upsell-product-variant-field",function(e){var o=t(e.target).data("id").toString(),i=t(e.target).find(":selected").val(),r=n.offer.getPopupProductVariantData(o,i);!1!==r&&(n.swapPricesInRow(o,r),n.swapButtonIdAndStatusInRow(o,r),n.validateQuantityFieldOnChangeOfVariant(o,r)),e.preventDefault(),e.stopPropagation()})},b=function(){n.offer.showQuantityField&&t(document).on("change",".upsell-now-quantity-field",function(e){var o=t(this),i=t(this).data("product-id").toString(),r=n.getVariantId(i),a=n.offer.getPopupProductVariantData(i,r);!1!==a&&(n.variantPresentInCart(r,a)?n.cartAndInventoryStocklimitChecker(r,o,a):n.verifyIsUpsellQtyGreaterThanInventoryQty(o,a,r))})},w=function(e){var n,o=t("#upsell-product-"+e+" .upsell-product-add-to-cart").data("id");return t("#upsell-product-"+e+" .upsell-product-variant-field").length>0&&(o=t(".upsell-product-variant-field[data-id='"+e+"']").val()),o.toString()},C=function(e,o){var i=n.getPrices(o.originalPrice,o.price),r=t("<div/>").html(i[0]).text(),a=t("<div/>").html(i[1]).text();t("#upsell-product-"+e+" .upsell-product-original-price").html(r),t("#upsell-product-"+e+" .upsell-product-price").html(a)},P=function(e,n){var o=t("#upsell-product-"+e+" .upsell-product-add-to-cart");t(o).data("id",n.id),n.available?(t(o).text(h.add_to_cart_button_text),t(o).removeClass("disabled"),t(o).prop("disabled",!1)):(t(o).text(h.sold_out_button_text),t(o).addClass("disabled"),t(o).prop("disabled",!0))},I=function(e,o){var i=o.id,r=t(".upsell-now-quantity-field[data-product-id='"+e+"']");n.hideInsufficientStockWarning(r),n.variantPresentInCart(i,o)?n.cartAndInventoryStocklimitChecker(i,r,o):n.verifyIsUpsellQtyGreaterThanInventoryQty(r,o,i)},x=function(t){return"show_product_image"===t},S=function(t){return"https://"+window.Shopify.shop+"/products/"+t.handle},O=function(t){return"show_product_image_with_zoom"===t.productImageSetting&&(n.initalizeFullSizeImageModal(),!0)},T=function(e){t(document).on("click","#un-modal-background img",function(){var e=t(this).attr("src").replace("100x100","600x600");t(".upsell-product-image-for-full-img").attr("src",e),t("#un-modal-background-for-full-img").addClass("un-manual-modal-container")}),t("#un-modal-close-btn-for-full-img, #upsell-popup-close-link-for-full-img").click(function(){t("#un-modal-background-for-full-img").removeClass("un-manual-modal-container"),t("#un-modal-background-for-full-img").removeClass("opened")})},D=function(){var t=document.getElementById("un-modal-background-for-full-img");return null!==t&&t.classList.contains("un-manual-modal-container")},A=function(e,o,i){var r=parseInt(o.val());t.each(un.cart.items,function(t,a){if(a.variant_id===parseInt(e)){var c=a.quantity+r;if(n.isUpsellQtyGreaterThanInventoryAndCartQty(c,i)){var s=p.noNegative(parseInt(i.inventoryQuantity)-a.quantity);n.showInsufficientStockWarning(i,o,s,e)}else n.hideInsufficientStockWarning(o);return!1}})},j=function(t,e){return t>parseInt(e.inventoryQuantity)&&p.stringChecker(e.inventoryManagement)&&!(p.stringChecker(e.inventoryPolicy)&&"continue"===e.inventoryPolicy)},F=function(t,e,o,i){var r,a=h.insufficient_stock_message.replace("{quantity}",o);n.hideInsufficientStockWarning(e),e.after("<span class='qty-alert-popup-field upsell-now-qty-alert-"+e.data("product-id")+"'>"+a+"</span>"),e.val(o)},q=function(e,o){var i=o.upsellQty;return!o.showQuantityField||!p.stringChecker(e.inventoryManagement)||p.stringChecker(e.inventoryPolicy)&&"continue"===e.inventoryPolicy||(i>parseInt(e.inventoryQuantity)&&(i=p.noNegative(parseInt(e.inventoryQuantity))),t.each(un.cart.items,function(t,r){if(parseInt(e.variantId)===r.variant_id){var a=o.upsellQty+r.quantity;return n.isUpsellQtyGreaterThanInventoryAndCartQty(a,e)&&(i=p.noNegative(parseInt(e.inventoryQuantity)-r.quantity)),!1}})),i},L=function(e){t(".upsell-now-qty-alert-"+e.data("product-id")).remove()},N=function(e){var n=!1;return t.each(un.cart.items,function(t,o){if(o.variant_id===parseInt(e))return n=!0,!1}),n},E=function(t,e,o){if(parseInt(t.val())>e.inventoryQuantity&&p.stringChecker(e.inventoryManagement)&&(!p.stringChecker(e.inventoryPolicy)||"continue"!==e.inventoryPolicy)){var i=p.noNegative(parseInt(e.inventoryQuantity));n.showInsufficientStockWarning(e,t,i,o)}else n.hideInsufficientStockWarning(t)};this.offer=e,this.show=i,"add_to_cart"===e.triggerEvent?this.close=c:"checkout"===e.triggerEvent&&(this.close=u),this.printProductRows=d,this.getPrices=l,this.getDiscountedPrice=f,this.initializeAddToCartButtons=m,this.applyStyles=y,this.getVariantFieldHTML=v,this.initializeVariantFields=k,this.initializeQuantityFields=b,this.swapPricesInRow=C,this.swapButtonIdAndStatusInRow=P,this.getProductImageSetting=x,this.getProductLink=S,this.cartAndInventoryStocklimitChecker=A,this.getUpsellProductQty=q,this.showInsufficientStockWarning=F,this.validateQuantityFieldOnChangeOfVariant=I,this.hideInsufficientStockWarning=L,this.variantPresentInCart=N,this.verifyIsUpsellQtyGreaterThanInventoryQty=E,this.isUpsellQtyGreaterThanInventoryAndCartQty=j,this.getVariantId=w,this.showFullSizeProductImage=O,this.initalizeFullSizeImageModal=T,this.fullsizeImageModalOpenedOnPage=D,this.initializeCloseButtons=a,this.closeImagePopupOnClickOutside=s}function c(e,n){var o=this,i=function(t,e,n,i,r){o.productHandles=t,o.shopifyDomain=r,o.collectionHandles=e,o.maxNumberOfProducts=n,o.maxNumberOfProductsPerCollection=i,o.productsArray=[],t.length>0?(p.log("Getting upsell products for offer "+o.offer.id),o.ajaxCallToGetProduct(0)):o.getProductsFromSelectedCollections()},r=function(e){var n=o.productHandles[e];o.inProductCache(n.shopify_product_id)?o.processProductData(o.getCachedProduct(n.shopify_product_id),e):t.ajax({cache:!0,type:"GET",url:"https://"+o.shopifyDomain+"/products/"+n.handle+"?view=upsell-now-product",success:function(t){o.setCachedProduct(t,n.shopify_product_id),o.processProductData(t,e)},error:function(){o.processProductData(!1,e)}})},a=function(t,e){t=JSON.parse(t);var n=o.createNewProduct(t);n&&p.outOfStock(n)&&o.offer.hideOutOfStockProducts&&(n=!1,p.log("Not adding "+n.title+" to popup for offer "+o.offer.id+" because it's out of stock and hide out of stock products is enabled.")),n&&_.inCart(n.productId)&&o.offer.hideProductsAlreadyInCart&&(n=!1,p.log("Not adding "+n.title+" to popup for offer "+o.offer.id+" because it's in the cart and hide products in cart is enabled.")),n&&(p.log("Adding "+n.title+" to popup for offer "+o.offer.id+"."),o.productsArray.push(n)),o.productsArray.length===o.maxNumberOfProducts?o.callback(o.productsArray):e<o.productHandles.length-1?(e+=1,o.ajaxCallToGetProduct(e)):o.productsArray.length<o.maxNumberOfProducts&&e===o.productHandles.length-1&&o.getProductsFromSelectedCollections()},c=function(){o.collectionHandles.length>0?(p.log("Getting upsell products from upsell collections for offer "+o.offer.id),o.ajaxCallToGetCollection(0)):o.callback(this.productsArray)},s=function(e){var n=o.collectionHandles[e];o.inCollectionCache(n.shopify_collection_id)?o.processCollectionData(o.getCachedCollection(n.shopify_collection_id),e):t.ajax({cache:!0,type:"GET",url:"https://"+o.shopifyDomain+"/collections/"+n.handle+"?view=upsell-now-collection",success:function(t){o.setCachedCollection(t,n.shopify_collection_id),o.processCollectionData(t,e)}})},u=function(e,n){e=JSON.parse(e);var i=0;t.each(e,function(t,e){if(!o.inProductsArray(e)&&o.productsArray.length<o.maxNumberOfProducts&&i<o.maxNumberOfProductsPerCollection){var n=o.createNewProduct(e);n&&p.outOfStock(n)&&o.offer.hideOutOfStockProducts&&(n=!1,p.log("Not adding "+n.title+" to popup for offer "+o.offer.id+" because it's out of stock and hide out of stock products is enabled.")),n&&_.inCart(n.productId)&&o.offer.hideProductsAlreadyInCart&&(n=!1,p.log("Not adding "+n.title+" to popup for offer "+o.offer.id+" because it's in the cart and hide products in cart is enabled.")),n&&(p.log("Adding "+n.title+" to popup for offer "+o.offer.id+"."),o.productsArray.push(n),i+=1)}});var r=o.productsArray.length===o.maxNumberOfProducts,a=n===o.collectionHandles.length-1,c=n<o.collectionHandles.length-1;r||a?o.callback(o.productsArray):c&&s(n+=1)},d=function(e){var n=!1;return t.each(o.productsArray,function(t,o){e.handle===o.handle&&(n=!0)}),n},l=function(t){if(!1===t)return!1;var e={};return e.title=t.title,e.originalPrice=t.original_price,e.price=t.price,e.variantId=t.variant_id,e.inventoryQuantity=t.inventory_quantity,e.inventoryManagement=t.inventory_management,e.inventoryPolicy=t.inventory_policy,e.productId=t.id,e.available=t.available,e.handle=t.handle,e.variants=f(t.variants),null!=t.img?"wld-pch.myshopify.com"===p.getShopifyDomain()?e.imgSrc=t.img.replace("_100x100","_400x"):e.imgSrc=t.img:e.imgSrc=!1,e},f=function(e){var n=[];return t.each(e,function(t,e){var o={};o.originalPrice=e.original_price,o.price=e.price,o.title=e.variant_title,o.id=e.variant_id,o.inventoryQuantity=e.inventory_quantity,o.inventoryPolicy=e.inventory_policy,o.inventoryManagement=e.inventory_management,o.available=e.available,n.push(o)}),n},h=function(t){return"undefined"!=typeof window.un.cache.collections[t]},g=function(t){return window.un.cache.collections[t]},m=function(t,e){p.objectChecker(window.un.cache)&&p.objectChecker(window.un.cache.collections)&&(window.un.cache.collections[e]=t)},y=function(t){return"undefined"!=typeof window.un.cache.products[t]},v=function(t){return window.un.cache.products[t]},k=function(t,e){p.objectChecker(window.un.cache)&&p.objectChecker(window.un.cache.products)&&(window.un.cache.products[e]=t)};this.getProducts=i,this.ajaxCallToGetProduct=r,this.processProductData=a,this.getProductsFromSelectedCollections=c,this.ajaxCallToGetCollection=s,this.processCollectionData=u,this.createNewProduct=l,this.inProductsArray=d,this.createVariantArray=f,this.inCollectionCache=h,this.getCachedCollection=g,this.setCachedCollection=m,this.inProductCache=y,this.getCachedProduct=v,this.setCachedProduct=k,this.callback=e,this.offer=n}function s(e){var n=this,o=function(){var t="checkout"===n.triggerEvent||p.onProductPage(),e=n.withinStartEndDate(),o=!n.disabledForCustomers();return!t&&p.log("Offer "+n.id+" not qualified because is ATC and we're not on a product page."),!e&&p.log("Offer "+n.id+" not qualified because outside start/end date."),!o&&p.log("Offer "+n.id+" not qualified because customer is logged in and offer disabled for logged-in customers."),t&&e&&o},i=function(){return n.disableForLoggedInCustomers&&p.objectChecker(window.un.customer_id)},r=function(){return!n.beforeStartDate()&&!n.afterEndDate()},a=function(){if(p.stringChecker(n.startDate)){var t=new Date(n.startDate),e;return new Date<t}return!1},s=function(){if(p.stringChecker(n.endDate)){var t=new Date(n.endDate),e;return new Date>t}return!1},u=function(){var t=_.cloneWithCurrentProductPageVariantAsLineItem(),e=n.checkIfTriggerProductsInCart(t),o=n.checkIfRequiredCartValueMet(t),i=n.checkIfOnSelectedProductPage(),r="Upsell offer reqs failed because:";return!e&&(r+=" trigger products not in cart,"),!o&&(r+=" required cart value not met,"),!i&&(r+=" not on selected product page,"),"Upsell offer reqs failed because:"!==r&&p.log(r),e&&i&&o},d=function(t){p.objectChecker(t)||(t=_.cloneUnCart());var e=0;"undefined"!=typeof t.un_total_discount&&(Number.isNaN(t.un_total_discount)||(e=t.un_total_discount));var o=n.requiredMinimumCartValue<=t.total_price-e;return message=o?"Required cart value met: "+n.requiredMinimumCartValue+" <= "+(t.total_price-e):"Required cart value not met: "+n.requiredMinimumCartValue+" > "+(t.total_price-e),p.log(message),o},l=function(){var t=!1;if("checkout"===n.triggerEvent||p.onCartPage())t=!0;else if(0===n.productPages.length&&0===n.collectionPages.length)t=!0;else if(p.objectChecker(un.product)&&p.objectChecker(un.product_collections)){var e={};e.product_id=un.product.id,e.collection_ids=un.product_collections,t=n.itemInProductArray(e,n.productPages)||n.itemInCollectionArray(e,n.collectionPages)}return t},f=function(e){p.objectChecker(e)||(e=_.cloneUnCart());var o=!1;return 0===n.triggerProducts.length&&0===n.triggerCollections.length?o=!0:(n.triggerQty>1&&p.log("Offer "+n.id+" requires shoppers to have at least "+n.triggerQty+" of the trigger products in cart!"),t.each(e.items,function(t,e){e.quantity>=n.triggerQty&&(m(e,n.triggerProducts)||y(e,n.triggerCollections))&&(o=!0)})),o},g=function(t){return n.itemInProductArray(t,n.upsellProducts)||n.itemInCollectionArray(t,n.upsellCollections)},m=function(e,n){var o=!1;return t.each(n,function(t,n){e.product_id===n.shopify_product_id&&(o=!0)}),o},y=function(e,n){var o=!1;return t.each(e.collection_ids,function(e,i){t.each(n,function(t,e){i===e.shopify_collection_id&&(o=!0)})}),o},v=function(){var e=[],o={};if("percentage_discount"===n.discountType)o[h.line_item_message_key]=h.line_item_discount_amount_message.replace("{{discount_amount}}",p.unFormatPercent(n.discountPercent/100)),e.push(o);else if("fixed_amount_discount"===n.discountType){var i=t("<div/>").html(p.unFormatCents(n.discountFixedAmount,h.money_format)).text();o[h.line_item_message_key]=h.line_item_discount_amount_message.replace("{{discount_amount}}",i),e.push(o)}else if("set_price"===n.discountType){var r=t("<div/>").html(p.unFormatCents(n.discountPrice,h.money_format)).text();o[h.line_item_message_key]=h.line_item_set_price_message.replace("{{set_price}}",r),e.push(o)}return e},k=function(t){n.productsForPopup=t},b=function(){n.productGetter.getProducts(n.upsellProducts,n.upsellCollections,h.max_products_to_show,h.max_products_per_category_to_show,p.getPrimaryDomain())},w=function(){var t=!0;return!0===h.hide_offer_if_already_declined&&""!==n.getCookie("_un_closed_offer_"+n.id.toString())&&(t=!1),t},C=function(t){for(var e=t+"=",n=document.cookie.split(";"),o=0;o<n.length;o++){for(var i=n[o];" "==i.charAt(0);)i=i.substring(1);if(0==i.indexOf(e))return i.substring(e.length,i.length)}return""},P=function(){return n.productsForPopup.length>0},I=function(e,o){var i=!1;return t.each(n.productsForPopup,function(n,r){r.productId===e&&t.each(r.variants,function(t,e){e.id===o&&(i=e)})}),i};this.upsellProducts=e.upsell_products||[],this.upsellCollections=e.upsell_collections||[],this.triggerProducts=e.trigger_products||[],this.triggerCollections=e.trigger_collections||[],this.productPages=e.product_pages||[],this.collectionPages=e.collection_pages||[],this.id=e.id||0,this.offerEnabled=e.offer_enabled||!1,this.productLinksEnabled=e.product_links_enabled||!1,this.offerName=e.offer_name||"",this.discountType=e.discount_type||0,this.discountFixedAmount=e.discount_fixed_amount||"",this.discountPrice=e.discount_price||"",this.discountPercent=e.discount_percent||"",this.triggerEvent=e.trigger_event||"",this.popupTitle=e.popup_title||"",this.popupDescription=e.popup_description||"",this.popupSuccessMessage=e.popup_success_message||"",this.startDate=e.start_date||"",this.endDate=e.end_date||"",this.disableForLoggedInCustomers=e.disable_for_logged_in_customers||!1,this.upsellQty=e.upsell_qty||1,this.triggerQty=e.trigger_qty||0,this.requiredMinimumCartValue=e.required_minimum_cart_value||0,this.productsForPopup=[],this.hideOutOfStockProducts=e.hide_out_of_stock_products||!1,this.hideProductsAlreadyInCart=e.hide_products_already_in_cart||!1,this.showQuantityField=e.show_quantity_field||!1,this.showVariantField=e.show_variant_field,this.closePopupOnATC=e.close_popup_on_atc||!1,this.productImageSetting=e.product_image_setting||"show_product_image",this.storeProductsCallback=k,this.triggerProductRequirementsMet=u,this.appliesToItem=g,this.getLineItemDiscountPropertyArray=v,this.getProductsForPopup=b,this.itemInProductArray=m,this.itemInCollectionArray=y,this.checkIfTriggerProductsInCart=f,this.checkIfOnSelectedProductPage=l,this.notDeclined=w,this.getCookie=C,this.beforeStartDate=a,this.afterEndDate=s,this.withinStartEndDate=r,this.disabledForCustomers=i,this.baseRequirementsMet=o,this.checkIfRequiredCartValueMet=d,this.hasEligibleUpsellProductsToShow=P,this.getPopupProductVariantData=I,this.baseRequirementsMet()&&this.notDeclined()?(p.log("Loading products for offer: "+this.id),this.productGetter=new c(n.storeProductsCallback,n),this.getProductsForPopup()):p.log("Requirements check failed. Not loading products for offer: "+this.id)}function u(){s.createOfferObjects()&&(d(),g.configure(),p.onProductPage()&&l(),_.updateCart(f))}function d(){t.getScript("https://cdnjs.cloudflare.com/ajax/libs/spin.js/2.3.2/spin.min.js")}function l(){t.each(window.un.offers,function(t,e){"add_to_cart"===e.triggerEvent&&e.baseRequirementsMet()&&window.un.qualifyingATCOffers.push(e)}),window.un.qualifyingATCOffers.length>0&&s.createATCEventListener()}function f(){t.each(window.un.offers,function(t,e){"checkout"===e.triggerEvent&&e.baseRequirementsMet()&&window.un.qualifyingCheckoutOffers.push(e)}),s.createCheckoutEventListener();var e=new i(window.un.offers),n;e.applyOfferDiscountsToCart(),new o(window.un.offers).startBundleEnforcer(),h.ajax_cart_integration_enabled&&e.initAjaxCartObserver()}var p=new n,h=p.getShopInDatastore(),_=new r,g=new e,m="_un_discounted_line_item_original_product_link_perm_",y="_un_discounted_line_item_original_product_link_temp_",v=".btn-link, .remove, form a:contains(emove), .cart__remove a, .cart-drawer__item-delete, [data-cart-item-delete], .un-remove-btn";r.checkoutEventHandler=function(){_.updateCart(function(){var e,n;if(new i(window.un.offers).applyOfferDiscountsToCart(),new o(window.un.offers).startBundleEnforcer(),window.un.cartCheckedForDiscounts=!0,p.notInDebugMode())if(_.hasDiscounts()||"asoflattetest.myshopify.com"===p.getShopifyDomain()){p.enableSpinner(h.checkout_button_selector),p.stringChecker(h.redirecting_to_checkout_text)&&t(h.checkout_button_selector).after("<span id='un-checkout-redirect-msg'>"+h.redirecting_to_checkout_text+"</span>");var r=_.createDraftOrder();_.getAndSendToCheckoutUrl(r)}else"the-screen-surgery.myshopify.com"===p.getShopifyDomain()?window.location.href="/checkout":t(h.checkout_button_selector).trigger("click")})},s.createOfferObjects=function(){return window.un.offers=[],window.un.qualifyingATCOffers=[],window.un.qualifyingCheckoutOffers=[],t.each(p.getOffersInDatastore(),function(t,e){!0===e.offer_enabled?window.un.offers.push(new s(e)):p.log("One offer disabled - not creating offer object for it")}),p.arrayChecker(window.un.offers)},s.removeOtherATCEventListeners=function(){if(h.remove_add_to_cart_event_listeners){var e=t(h.add_to_cart_button_selector).clone();p.cloneStyles(t(h.add_to_cart_button_selector),e),t(h.add_to_cart_button_selector).replaceWith(e.attr("id","").attr("data-action","").attr("class","").addClass("un-cloned-atc-btn"))}},s.createATCEventListener=function(){s.removeThemeSpecificATCEventListeners(),s.removeOtherATCEventListeners(),0===t(h.add_to_cart_button_selector).length&&(p.log("WARNING: Add to cart button selector does not match any elements on page."),p.log(h.add_to_cart_button_selector)),p.notInDebugMode()||(console.log("UN found these add to cart buttons for selector: "+h.add_to_cart_button_selector),console.log(t(h.add_to_cart_button_selector))),t(document).on("click",h.add_to_cart_button_selector,function(){if("undefined"==typeof un.atcPopupClosed)return p.log("ATC event triggered"),s.atcEventHandler(),!1})},s.removeThemeSpecificATCEventListeners=function(){t.each(t(".product-single__meta .product-form #AddToCart"),function(e,n){t(n).replaceWith(t(n).clone().addClass("un-cloned-atc-btn"))})},s.createCheckoutEventListener=function(){0===t(h.checkout_button_selector).length&&(p.log("WARNING: Checkout button selector does not match any elements on page."),p.log(h.checkout_button_selector)),p.notInDebugMode()||(console.log("UN found these checkout buttons for selector: "+h.checkout_button_selector),console.log(t(h.checkout_button_selector))),t(document).on("click",h.checkout_button_selector,function(){if("undefined"==typeof un.checkingOut&&(p.log("Checkout event triggered"),un.checkingOut=!0,p.applyDisabledStyles(h.checkout_button_selector),t(h.checkout_button_selector).addClass("un-disabled-btn"),"undefined"==typeof un.checkoutPopupClosed))return s.checkoutEventHandler(),!1})},s.atcEventHandler=function(){var e=s.getFirstActiveOffer(window.un.qualifyingATCOffers),n;e?(p.log("Showing ATC popup for offer "+e.id),new a(e).show()):p.notInDebugMode()&&(window.un.atcPopupClosed||(window.un.atcPopupClosed=!0,"omorose-natural-products.myshopify.com"!==p.getShopifyDomain()&&"roadgods-dev.myshopify.com"!==p.getShopifyDomain()&&t(h.add_to_cart_button_selector).trigger("click")))},s.checkoutEventHandler=function(){var t=s.getFirstActiveOffer(window.un.qualifyingCheckoutOffers),e;t?(p.log("Showing checkout popup for offer "+t.id),new a(t).show()):p.notInDebugMode()&&(window.un.checkoutPopupClosed=!0,r.checkoutEventHandler())},s.getFirstActiveOffer=function(e){var n=!1;return t.each(e,function(t,e){p.log("Examining offer "+e.id+" ("+e.triggerEvent+").");var o=e.triggerProductRequirementsMet(),i=e.notDeclined(),r=e.hasEligibleUpsellProductsToShow();if(o&&i&&r)return n=e,p.log("Offer "+e.id+" passed."),!1;var a="Offer "+e.id+" failed because:";!o&&(a+=" upsell offer reqs not met,"),!i&&(a+=" offer has been previously declined,"),!r&&(a+=" no eligible upsell products to show in popup,"),p.log(a)}),n?p.log("Returning offer "+n.id.toString()):p.log("No valid offers"),n},s.getOfferForItem=function(e,n){var o=!1;return t.each(n,function(t,n){n.triggerProductRequirementsMet()&&n.appliesToItem(e)&&(o=n)}),o},s.getActiveOfferById=function(e){var n=!1;return t.each(un.offers,function(t,o){o.id.toString()===e.toString()&&(n=o)}),n},t(document).ready(function(){p.objectChecker(window.un)&&"undefined"==typeof window.un.running&&(window.un.running=!0,p.checkSettingsInDatastore()&&(p.mergeThemeAndShopSettings(),p.enabledOnCurrentPage()&&u()))})};window.loadjQuery321=loadScriptTag("//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js").then(function(){window.jQuery321=jQuery.noConflict(!0)}),window.loadjQuery321.then(function(){myFrontendJavascriptUN(jQuery321)});