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AEtB7B,EAAEO,QAAQgB,aAAe,KACzBvB,EAAE,qBAAqB6B,OAE3B7B,EAAE,gBAAgBgI,OACtB,CAEA,SAAS0B,EAA2BK,GAChC,OAAO/J,EAAE+J,GAAOpD,QAAQ,wBAAwBnF,KAAK,6BACzD,CAEAxB,EAAEC,UAAU+J,OAAM,WACdX,EAAeC,EAAQ,QACvBD,EAAeC,EAAQ,QACvBtJ,EAAEC,UAAUC,GAAG,QAAS,6CAA6C,WA3CzE,IAAoC6J,IA4CD/J,EAAE0C,MA3C7B1C,EAAE+J,GAAOpH,KAAK,WAAWlB,QAAU,GACnCzB,EAAE,iBAAiBG,UAAUC,QAC7BJ,EAAEoG,KAAK,CACH6D,QAASF,EACT1D,IAAKrG,EAAE,+BAA+B2C,KAAK,YAAc3C,EAAE+J,GAAOpH,KAAK,WACvE2D,OAAQ,MACRE,QAAS+C,EACTtB,MAAO,WACHjI,EAAEG,UAAU6E,MAChB,IAEJhF,EAAE,4BAA4B+B,YAAY,YAAY8C,SAAS,cAE/D6E,EAA2BK,GAAOJ,QA+B7B3J,EAAE0C,MAAMwH,SAAS,kBAClB3J,OAAOC,IAAI4C,iBAAiBpD,EAAE0C,MAAMC,KAAK,WAEjD,GACJ,G","sources":["webpack:///./cartridges/app_custom_mufe/cartridges/app_custom_mufe/cartridge/client/default/js/product/pdpRework/virtualtry.js","webpack:///./cartridges/app_custom_mufe/cartridges/app_custom_mufe/cartridge/client/default/js/product/pdpRework/vto-modal.js","webpack:///./cartridges/sfcc-core-ecom/storefront-reference-architecture/cartridges/app_storefront_base/cartridge/client/default/js/util.js","webpack:///webpack/bootstrap","webpack:///./cartridges/app_custom_mufe/cartridges/app_custom_mufe/cartridge/client/default/js/virtualTryPdp.js"],"sourcesContent":["'use strict';\n\n/* eslint-disable no-undef */\n\n$(document).on(\"sfvto:init\", function() {\n    $.spinner().start();\n\n    var event = new Event('YMKloaded');\n\n    window.YMK.addEventListener('loaded', function () {\n        setTimeout(\n            function () {\n                document.dispatchEvent(event);\n            },\n            1000\n        );\n    });\n\n    var initParameters = {\n        userConsent: 'agree',\n        enableFourWayLooks: false,\n        language: PropertiesPreferences.VTO_DATA_LANG\n    };\n\n    var windowSize = $(window).width();\n    var windowHeight = $(window).height();\n    var useMobileView = $(window).outerWidth() < 500;\n    \n    if (useMobileView) {\n        initParameters.width = windowSize;\n        initParameters.height = 476;\n        if ($('.shade-finder-vto-body').find('.vto-revamp').length) {\n            initParameters.height = windowHeight - ($('header').height());\n            $('#vto-sf-modal').css('top', $('header').height() + 'px');\n        }\n    } else {\n        initParameters.width = 547;\n        initParameters.height = 619;\n        if ($('.shade-finder-vto-body').find('.vto-revamp').length) {\n            initParameters.width = 510;\n            initParameters.height = 656;\n        }\n    }\n    // Init VTO module\n    window.YMK.init(initParameters);\n    // Open VTO module\n    window.YMK.open();\n\n    window.YMK.addEventListener('backToLive', function () {\n        $('.custom-shade-search').show();\n        if (useMobileView) {\n            $('.pdp-title-mobile').show();\n        }\n    });\n\n    window.YMK.addEventListener('enterTakePhoto', function () {\n        $('.custom-shade-search').hide();\n        if (useMobileView) {\n            $('.pdp-title-mobile').hide();\n        }\n    }); \n\n    window.YMK.addEventListener(\"closed\", function() {\n        $('#one-to-one-initiation').removeClass('d-none');\n        $('#vto-sf-modal').modal('hide');\n        $('.custom-shade-search').hide();\n        $('.pdp-title-mobile').hide();\n    });\n\n    var $owltryon = $('.tryon-pdp');\n\n    document.addEventListener('YMKloaded', function () {\n        var currentShadeId = $(\".shade-selector-button.selected\").attr(\"data-attr-value\");\n        var isShadeFound = false;\n\n        $owltryon.find('.owl-item').each(function () {\n            var self = $(this);\n            \n            if (self.find('.is-outStock').length) {\n                self.append('<span class=\"strock-line\"></span>');\n            }\n        })\n\n        adaptSuggestionShadeVTO();\n\n        $('.tryon-pdp .shadefinder-shadesquare').each(function() {\n            var $this = $(this);\n            if ($this.attr(\"data-shade-id\") === currentShadeId && currentShadeId !== undefined) {\n                $(\".custom-shade-search\").removeClass(\"hidden\");\n                $('.pdp-title-mobile').removeClass('hidden');\n                $this.trigger('click');\n                window.YMK.applyMakeupBySku($this.attr('data-id'));\n                if($this.length > 0) {\n                    $owltryon.trigger('to.owl.carousel', $this.data('position'));\n                }\n                isShadeFound = true;\n                return false;\n            }\n        })\n\n        if (!isShadeFound) {\n            var selectedFirstElement = $(\".tryon-pdp .shadefinder-shadesquare\").first();\n\n            $(\".custom-shade-search\").removeClass(\"hidden\");\n            $('.pdp-title-mobile').removeClass('hidden');\n            selectedFirstElement.trigger('click');\n            window.YMK.applyMakeupBySku(selectedFirstElement.attr('data-id'));\n        }\n    });\n\n    function onDraggedFunction(event) {\n        var childrens = $(event.target).find('.shadefinder-shadesquare');\n        var selectedValue = event.item.index;\n        childrens.each( function(){\n            if(parseInt($(this).attr('data-position')) === selectedValue){\n                $(this).trigger('click');\n            }\n        })\n    }\n\n    function adaptSuggestionShadeVTO() {\n        if ($('.shade-finder-vto-body').find('.vto-revamp').length) {\n            var timeOut = 1000; \n\n            if (useMobileView) {\n                setTimeout(\n                    function () {\n                        $('.suggestions-shade-vto').css({\n                            'height' : (windowHeight - ($('header').height())) + 'px',\n                            'width' : windowSize + 'px',\n                            'top' : $('header').height() + 'px'\n                        });\n                    },\n                    timeOut\n                );\n            } else {\n                setTimeout(\n                    function () {\n                        $('.suggestions-shade-vto').css({\n                            'height' : '660px',\n                            'width' : '520px'\n                        });\n                    },\n                    timeOut\n                );\n            }\n        }\n    }\n    \n    var $owltryonpdp = $('.tryon-pdp');\n    var loopsParam = false;\n    var centerMode = false;\n    var maxDisplayShadeSquare = PropertiesPreferences.MAXIMUM_SHADE_SQUARE;\n    \n    $owltryonpdp.each( function() {\n        $(this).children().each( function( index ) {\n            $(this).attr( 'data-position', index );\n        });\n    });\n\n    if ($owltryonpdp.find('.shadefinder-shadesquare').length > maxDisplayShadeSquare) {\n        loopsParam = true;\n        centerMode = true;\n    }\n    \n    if ($('.shade-finder-vto-body').find('.vto-revamp').length) {\n        $owltryonpdp.owlCarousel({\n            loop: loopsParam,\n            rewind: false,\n            center: centerMode,\n            margin: 10,\n            nav: true,\n            dots: false,\n            transitionStyle: \"fade\",\n            itemElement: \"li\",\n            stageElement: \"ul\",\n            autoWidth: true,\n            onDragged: onDraggedFunction,\n            items: 5,\n            navText: [\n                '<span class=\"icon-chevron-thin-right\" aria-hidden=\"true\"></span><span class=\"sr-only\">Previous panel</span>',\n                '<span class=\"icon-chevron-thin-right\" aria-hidden=\"true\"></span><span class=\"sr-only\">Next panel</span>'\n            ]\n        });\n    } else {\n        $owltryonpdp.owlCarousel({\n            loop: false,\n            rewind: false,\n            center: false,\n            margin: 10,\n            nav: true,\n            dots: false,\n            transitionStyle: \"fade\",\n            itemElement: \"li\",\n            stageElement: \"ul\",\n            autoWidth: true,\n            onDragged: onDraggedFunction,\n            items: 5,\n            navText: [\n                '<span class=\"icon-chevron-thin-right\" aria-hidden=\"true\"></span><span class=\"sr-only\">Previous panel</span>',\n                '<span class=\"icon-chevron-thin-right\" aria-hidden=\"true\"></span><span class=\"sr-only\">Next panel</span>'\n            ]\n        });\n    }\n    \n    $(document).on('click', '.owl-item>svg', function() {\n        $owltryonpdp.trigger('to.owl.carousel', $(this).data( 'position' ) );\n        $(this).parent('.owl-item').addClass('focused').siblings('.owl-item').removeClass('focused');\n        adaptSuggestionShadeVTO();\n    });\n    \n    $(document).on('click', '.owl-prev, .owl-next', function() {\n        var actualposition = $('.owl-item.focused .shadefinder-shadesquare').attr('data-position');\n        $('.shadefinder-shadesquare').each(function(){\n            if(parseInt($(this).attr('data-position')) === parseInt(actualposition)){\n                $(this).trigger('click');\n            }\n        });\n    });\n\n    $.spinner().stop();\n\n    function uploadPicture(input) {\n        if (input.files && input.files[0]) {\n            $(\".VTOcamera-iconcontainer\").removeClass('active');\n            $('#YMK-wrapper .VTOpicture-iconcontainer').hide();\n    \n            var reader = new FileReader();\n            reader.readAsDataURL(input.files[0]); // convert to base64 string\n    \n            reader.onload = function (e) {\n                window.YMK.open( false , e.target.result); // reload module with upload image\n            }\n        }\n    }\n    \n    function reloadmodule() {\n        $(\".VTOcamera-iconcontainer\").addClass('active');\n        $('#YMK-wrapper .VTOcamera-iconcontainer').hide();\n        $('#YMK-wrapper .VTOpicture-iconcontainer').hide();\n        window.YMK.open();\n        $(\"#VTOpicture\").val('');\n    }\n    \n    $(\"#VTOpicture\").change(function () {\n        uploadPicture(this);\n    });\n    \n    $(\".VTOcamera-iconcontainer\").click(function () {\n        reloadmodule();\n    });\n});","var isClickInprogress = false;\n\nfunction waitForElm(selector) {\n    return new Promise((resolve) => {\n        if (document.querySelector(selector)) {\n            return resolve(document.querySelector(selector));\n        }\n\n        const observer = new MutationObserver(() => {\n            if (document.querySelector(selector)) {\n                resolve(document.querySelector(selector));\n                observer.disconnect();\n            }\n        });\n\n        observer.observe(document.body, {\n            childList: true,\n            subtree: true,\n        });\n    });\n}\n\nfunction handleRadioBtn() {\n    $('.shade-circle-wrapper').each(function () {\n        var $button = $(this);\n\n        $button.attr('role', 'radio');\n        $button.attr('tabindex', '-1');\n\n        waitForElm('.click-first-button').then((elm) => {\n            $(elm).attr('tabindex', '0').attr('aria-checked', 'true');\n        });\n    });\n\n    $('.shade-circle-wrapper').on('keyup', function (event) {\n        var $buttons = $('.shade-circle-wrapper');\n        var currentIndex = $buttons.index(this);\n        var nextIndex, prevIndex;\n    \n        if (event.key === 'ArrowRight') {\n            nextIndex = (currentIndex + 1) % $buttons.length;\n            $buttons\n                .attr('tabindex', '-1')\n                .eq(nextIndex)\n                .attr('tabindex', '0')\n                .attr('aria-checked', 'true')\n                .focus()\n                .click();\n        } else if (event.key === 'ArrowLeft') {\n            prevIndex = (currentIndex - 1 + $buttons.length) % $buttons.length;\n            $buttons\n                .attr('tabindex', '-1')\n                .eq(prevIndex)\n                .attr('tabindex', '0')\n                .attr('aria-checked', 'true')\n                .focus()\n                .click();\n        }\n    });\n}\n\nfunction initShadeFinderVto() {\n    var selectedValueUrl = $(\".display-vto-sf\").attr('data-href');\n    isClickInprogress = true;\n    if ($('#vto-sf-modal').length !== 0) {\n        if (!$(\".skintone-wrapper\").length) {\n            window.YMK.open();\n        }\n        $('#vto-sf-modal').modal('show');\n        isClickInprogress = false;\n        return;\n    }\n    var isIphoneClass = navigator.userAgent.match(/(iPod|iPhone|iPad)/) ? \" iphone-shade-finder\" : \"\"\n\n    var htmlString = '<!-- Modal -->'\n        + '<div class=\"modal fade\" id=\"vto-sf-modal\" role=\"dialog\">'\n        + '<div class=\"modal-dialog vto-dialog container\">'\n        + '<!-- Modal content-->'\n        + '<div class=\"modal-content\">'\n        + '<div class=\"modal-body shade-finder-vto-body' + isIphoneClass + '\"><button type=\"button\" class=\"hidden close close-vto-modal pull-right\" data-dismiss=\"modal\">&times;</button><button class=\"hidden retry-vto-sf btn btn-primary\">'+ $(\"#tryagain\").val() +'</button></div>'\n        + '</div>'\n        + '</div>'\n        + '</div>';\n    $('body').append(htmlString);\n    $('.modal-body').spinner().start();\n    $.ajax({\n        url: selectedValueUrl,\n        method: 'GET',\n        dataType: 'html',\n        success: function (data) {\n            var $html = $('<div>').append($.parseHTML(data));\n            $('.shade-finder-vto-body').append($html);\n            if ($('.shade-finder-vto-body').find('.vto-revamp').length) {\n                $('.shade-finder-vto-body').parents('#vto-sf-modal').addClass('vto-revamp-modal');\n            }\n            $('#vto-sf-modal').modal('show');\n            isClickInprogress = false;\n            $(document).trigger('sfvto:init');\n            handleRadioBtn();\n        },\n        error: function () {\n            isClickInprogress = false;\n        }\n    });\n}\n\n$(window).on('load', function() {\n    var optinAlreadyDisplayed = false;\n    $(document).on('click', '.display-vto-sf', function (e) {\n        e.preventDefault();\n\n        $('#one-to-one-initiation').addClass('d-none');\n\n        if (isClickInprogress) {\n            return;\n        }\n\n        // Check if an optin should be displayed\n        if ($(\"#optin-vto-shadefiner\").length && !optinAlreadyDisplayed) {\n            $(\"#optin-vto-shadefiner\").modal(\"show\");\n    \n            $(\".button-optin-submit\").on(\"click\", function() {\n                $(\"#optin-vto-shadefiner\").modal(\"hide\");\n                optinAlreadyDisplayed = true;\n                initShadeFinderVto();\n            })\n        } else {\n            initShadeFinderVto();\n        }\n    });\n});","'use strict';\n\nmodule.exports = function (include) {\n    if (typeof include === 'function') {\n        include();\n    } else if (typeof include === 'object') {\n        Object.keys(include).forEach(function (key) {\n            if (typeof include[key] === 'function') {\n                include[key]();\n            }\n        });\n    }\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","'use strict';\n\nvar processInclude = require('base/util');\n\nfunction getSuggestionsShadeProduct(scope) {\n    if ($(scope).attr('data-id').length >= 3) {\n        $(\"#vto-sf-modal\").spinner().start();\n        $.ajax({\n            context: scope,\n            url: $(\".url-vto-seggestion-product\").attr('data-url') + $(scope).attr('data-id'),\n            method: 'GET',\n            success: processResponseShade,\n            error: function () {\n                $.spinner().stop();\n            }\n        });\n        $('.product-view-suggestion').removeClass('col-md-4').addClass('col-md-12');\n    } else {\n        getSuggestionsShadeWrapper(scope).empty();\n    }\n}\n\nfunction processResponseShade(response) {\n    var $suggestionsWrapper = getSuggestionsShadeWrapper(this).empty();\n    $.spinner().stop();\n    if (!(typeof (response) === 'object')) {\n        $suggestionsWrapper.append(response).fadeIn();\n        $('#no-result-search').text($('.search-field').val());\n        $('body').trigger('LoadSliderImages');\n    } else {\n        $suggestionsWrapper.fadeOut();\n    }\n    $('.custom-shade-search').show();\n    \n    if ($(window).outerWidth() < 500) {\n        $('.pdp-title-mobile').show();\n    }\n    $('#YMK-wrapper').focus();\n}\n\nfunction getSuggestionsShadeWrapper(scope) {\n    return $(scope).parents('.custom-shade-search').find('.suggestions-shade-wrapper');\n}\n\n$(document).ready(function () {\n    processInclude(require('./product/pdpRework/vto-modal'));\n    processInclude(require('./product/pdpRework/virtualtry'));\n    $(document).on('click', '#virtual-try-pdp .shadefinder-shadesquare', function () {\n        getSuggestionsShadeProduct($(this));\n        if(!($(this).hasClass('disabledshade'))){\n            window.YMK.applyMakeupBySku($(this).attr('data-id'));\n        }\n    });\n});\n"],"names":["$","document","on","spinner","start","event","Event","window","YMK","addEventListener","setTimeout","dispatchEvent","initParameters","userConsent","enableFourWayLooks","language","PropertiesPreferences","VTO_DATA_LANG","windowSize","width","windowHeight","height","useMobileView","outerWidth","find","length","css","init","open","show","hide","removeClass","modal","$owltryon","onDraggedFunction","childrens","target","selectedValue","item","index","each","parseInt","this","attr","trigger","adaptSuggestionShadeVTO","currentShadeId","isShadeFound","self","append","$this","undefined","applyMakeupBySku","data","selectedFirstElement","first","$owltryonpdp","loopsParam","centerMode","maxDisplayShadeSquare","MAXIMUM_SHADE_SQUARE","children","owlCarousel","loop","rewind","center","margin","nav","dots","transitionStyle","itemElement","stageElement","autoWidth","onDragged","items","navText","parent","addClass","siblings","actualposition","stop","change","input","files","reader","FileReader","readAsDataURL","onload","e","result","uploadPicture","click","val","isClickInprogress","initShadeFinderVto","selectedValueUrl","htmlString","navigator","userAgent","match","ajax","url","method","dataType","success","$html","parseHTML","parents","selector","$button","Promise","resolve","querySelector","observer","MutationObserver","disconnect","observe","body","childList","subtree","then","elm","nextIndex","prevIndex","$buttons","currentIndex","key","eq","focus","error","optinAlreadyDisplayed","preventDefault","_typeof","o","Symbol","iterator","constructor","prototype","module","exports","include","Object","keys","forEach","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","processInclude","require","processResponseShade","response","$suggestionsWrapper","getSuggestionsShadeWrapper","empty","fadeIn","text","fadeOut","scope","ready","context","hasClass"],"sourceRoot":""}