"use strict";var Oakley=Oakley||{};define(["notifications","oakleyUtilities","debounce","viewport","prosite","tealium","loadingHandler","pdpOosDialog","affirm","paybright"],function(e,C,p,o,t,a,w,x,r,s){var S={elements:{flexWrapper:".flex-wrapper",siteWrapper:".site-wrapper",cartFlyout:".cart-flyout",cartButton:".cart-button",cartButtonLink:".cart-button a",close:".cart-flyout .close",closeOut:".flex-wrapper.active>.site-wrapper.noscroll",closeOutOverlay:".flex-wrapper.active>.site-wrapper",product:".cart-flyout .product",remove:".cart-flyout .remove",addToCart:"button.product-cart-button",addToCartInline:"button.addToCart-inline",continueShoppingBtn:"goto-shopping",continueShoppingBtnOO:".continue-shopping",addtoCartCTAMobileSticky:".product-cart-button"},vars:{lastFocusedElement:null},consts:{firstLoad:!0},timeout:null,mousePositionY:0,init:function(){this.bind(),C[0].bind([this.elements.cartFlyout],C[0].selectors([this.elements.cartButtonLink,this.elements.addToCart,this.elements.addToCartInline]),[$.proxy(this.noscroll,this,"remove")]),this.viewCartRx()},bind:function(){$("body").on("click",this.elements.close,$.proxy(this.toggleFlyout,this,null,!0)),$("body").on("click",this.elements.continueShoppingBtnOO,$.proxy(this.toggleFlyout,this,null,!0)),$("body").on("click",this.elements.closeOut,$.proxy(this.toggleFlyout,this,null,!0)),$("body").on("click",this.elements.closeOutOverlay,$.proxy(this.toggleFlyout,this,null,!0)),$("body").on("click touchend",this.elements.addToCart,C[0].wrapCallback($.proxy(this.addItem,this))),$("body").on("click",this.elements.remove,$.proxy(this.removeItem,this)),$("body").on("click touchend",this.elements.cartFlyout,$.proxy(this.clearTimeout,this)),$("body").on("click",this.elements.product,$.proxy(this.preventNavigation,this)),$("body").on("click",this.elements.continueShoppingBtn,$.proxy(this.toggleFlyout,this,null,!1)),$(window).on("orientationchange",$.proxy(this.noscroll,this,"remove")),$("body").on("click touchend",this.elements.addtoCartCTAMobileSticky,$.proxy(this.rightImageThumbSticky,this))},rightImageThumbSticky:function(e){var t=$(".variant.selected img").attr("src"),a=$(".pdp-area .product-name span").eq(0).text(),o=$(".addToBag-button-price").eq(0).text();$(".productAddedFlex .mobile-cart-image img").attr("src",t),$(".mobile-product-added__name").text(a),$(".mobile-product-added__price").text(o)},viewCartRx:function(){var e=sessionStorage.getItem("eyewear_selected_size_variant"),t="true"===$("#isRoxable-button").val(),a=0<$(".size-selection-box").length||0<$(".pdpSizeSelect").length,o=0<".size-selection-box .select-checkboxes.eyewear".length,r="rx_frames"===$("#productTypeForRx").val();function s(){$(".button-cart-rx").addClass("hidden"),$(".button-cart-noRx").removeClass("hidden")}t&&r&&(a&&e||!a||o)?($(".button-cart-rx").removeClass("hidden"),$(".button-cart-noRx").addClass("hidden")):s()},scrollToElement:function(e,t){t=t||0,$("html,body").animate({scrollTop:e.position().top-t},1e3)},togglePopupMobile:function(e,t){var r=$(".site-wrapper"),s=$("#global-header-dropdown .cart-button"),a=(s.children("a"),function(e){if(window.addEventListener("scroll",i),$("body").addClass("noscroll"),$("html").css("height","100vh"),$(".floatingPromo").show(),$(window).scrollTop(0),r.addClass("mobile-popup-opened"),s.addClass("open"),s.find(".mobile-cart-popup").addClass("show"),$("#pdhero").hasClass("pdp-Sunglasses")&&$(".js-stickyOsi-addToBag").addClass("underBottom"),$("#pdhero").hasClass("pdp-Rx_Frames")&&$(".js-rx-stickyOsi-addToBag").addClass("underBottom"),$("#target-VMirror").addClass("removeZIndex"),$("#modal-VMirror").addClass("removeZIndex"),e.offsetParent.querySelector(".accessoryPosition")){var t=e.dataset.price,a=e.dataset.name,o=e.offsetParent.querySelector(".accessoryPosition").dataset.backgroundimage;$(".mobile-product-added__name").text(a.trim()),$(".mobile-product-added__price").text(t.trim()),$(".mobile-cart-image img").attr("src",o)}$(".fc-price").text().trim()&&$(".mobile-product-added__price").text($(".fc-price").text().trim()),$("body").hasClass("page-customproductpage")&&$(".carousel-key-Left img").attr("src")&&$(".mobile-cart-image img").attr("src",$(".carousel-key-Left img").attr("src"))}),o=function(e){window.removeEventListener("scroll",i),$(".floatingPromo").hide(),$("body").removeClass("noscroll"),$("html").css("height",""),$(".site-wrapper").removeClass("noscroll"),r.removeClass("mobile-popup-opened"),e.removeClass("open"),$("#pdhero").hasClass("pdp-Sunglasses")&&$(".js-stickyOsi-addToBag").removeClass("underBottom"),$("#pdhero").hasClass("pdp-Rx_Frames")&&$(".js-rx-stickyOsi-addToBag").removeClass("underBottom"),e.find(".mobile-cart-popup").removeClass("show"),$("#target-VMirror").removeClass("removeZIndex"),$("#modal-VMirror").removeClass("removeZIndex")};e&&e.preventDefault(),s.hasClass("open")||t?o(s):e&&e.currentTarget?a(e.currentTarget):a(s[0]),s.find(".mobile-cart-overlay").on("click",function(){o(s)})},adjustHeight:function(){var e=$(".cartPromoContainer.minicart").last(),t=e.parents(".floatingPromo").height()-e.find(".cartPromoHeader").height()-160;e.find(".cartPromoDesc").height(t).css("overflow-y","scroll")},loadContent:function(l,d,c){var u;$.ajax({url:rolloverPopupUrl,cache:!1,type:"GET",success:function(e){$(S.elements.cartFlyout).html(e),S.updateCartCount();var t=".cartPromoContainer:not(.minicart)",a=".minicartMessageContainer:not(.minicart)";0==$(t).length&&$(".floatingPromo").hide(),0==$(a).length&&$(".mcMessageTarget").hide();var o=$(t).clone().addClass("minicart"),r=$(".floatingPromo");$(a).clone().addClass("minicart"),$(".mcMessageTarget");r.html(o),$(S.elements.close).siblings().on("click",function(){$.tealium.utagDataLink({cart_type:"standard"})});var s=[],i=$(S.elements.product);$.each(i,function(e,t){var a=$(t),o={productId:a.data("prod_code").toString(),sku:a.data("sku"),quantity:a.data("prod_units"),unitPrice:a.data("prod_price")};s.push(o),$(".monetateHelperCartProduct").attr("value",JSON.stringify(o))}),void 0===window.monetateData||Oakley.variables.disabledMonetate||(window.monetateQ.push(["setPageType",window.monetateData.pageType.toLowerCase()]),window.monetateQ.push(["addBreadcrumbs",window.monetateData.breadcrumbs]),window.monetateQ.push(["addCartRows",s]),window.monetateQ.push(["trackData"])),$(S.elements.addToCart).length&&(u=$(S.elements.addToCart).offset().top,S.checkInteraction({clientY:u},!0),$(S.elements.cartFlyout).on("mouseover.checkInteraction",p(S.checkInteraction,300)));var n="true"===$("#isOSI").attr("value");l&&!d&&(window.matchMedia("all and (max-width: 991px)").matches&&n?0 Add To Cart - "+t+" "+a+" statusCode:"+e.status})},complete:function(){$("body").removeClass("no-scroll"),$("#RxFlyout").removeClass("open"),$("#RxFlyout > .oo_flyout-overlay-background").css("pointer-events","none"),$("#RxFlyout > .oo_flyout-overlay-background").css("opacity",0),w.removeLoading(u)}})}else h.removeClass("hide");else d.removeClass("hide"),$(".sticky-header").hasClass("sticky_start")&&S.scrollToElement($("body")),0