{"version":3,"file":"default/js/vimeo.js","mappings":";;;;;;;;;AAAA;AACA,IAAI,KAAyC;AAC7C,IAAI,iCAAO,EAAE,mCAAE;AACf;AACA,KAAK;AAAA,kGAAC,GAAG,CAGsD;AAC/D,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA8C,yBAAyB;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wFAAwF;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2B,qBAAqB;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iCAAiC;AACjC;AACA,8BAA8B;AAC9B;AACA;AACA;AACA,0BAA0B;AAC1B;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yBAAyB;AACzB;AACA;AACA;AACA;AACA,6BAA6B,gEAAgE;AAC7F;AACA;AACA;AACA,CAAC;;;;;;UCzGD;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;;;;;;;ACtBa;;AAEb;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA,oEAAoE;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;;AAEA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA;AACA;AACA;AACA,aAAa;;AAEb;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAc;;AAEd;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,kBAAkB;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,SAAS;;AAET,+CAA+C,iCAAiC;AAChF,KAAK;AACL,CAAC;;;;;;;;AC/LD,mBAAO,CAAC,yEAAe,IAAI","sources":["webpack://sfra-startup-kit/./node_modules/svg4everybody/dist/svg4everybody.js","webpack://sfra-startup-kit/webpack/bootstrap","webpack://sfra-startup-kit/./cartridges/app_custom_fraserhart/cartridge/client/default/js/vimeo.js","webpack://sfra-startup-kit/./node_modules/svg-spritemap-webpack-plugin/svg4everybody-helper.js"],"sourcesContent":["!function(root, factory) {\n \"function\" == typeof define && define.amd ? // AMD. Register as an anonymous module unless amdModuleId is set\n define([], function() {\n return root.svg4everybody = factory();\n }) : \"object\" == typeof module && module.exports ? // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory() : root.svg4everybody = factory();\n}(this, function() {\n /*! svg4everybody v2.1.9 | github.com/jonathantneal/svg4everybody */\n function embed(parent, svg, target) {\n // if the target exists\n if (target) {\n // create a document fragment to hold the contents of the target\n var fragment = document.createDocumentFragment(), viewBox = !svg.hasAttribute(\"viewBox\") && target.getAttribute(\"viewBox\");\n // conditionally set the viewBox on the svg\n viewBox && svg.setAttribute(\"viewBox\", viewBox);\n // copy the contents of the clone into the fragment\n for (// clone the target\n var clone = target.cloneNode(!0); clone.childNodes.length; ) {\n fragment.appendChild(clone.firstChild);\n }\n // append the fragment into the svg\n parent.appendChild(fragment);\n }\n }\n function loadreadystatechange(xhr) {\n // listen to changes in the request\n xhr.onreadystatechange = function() {\n // if the request is ready\n if (4 === xhr.readyState) {\n // get the cached html document\n var cachedDocument = xhr._cachedDocument;\n // ensure the cached html document based on the xhr response\n cachedDocument || (cachedDocument = xhr._cachedDocument = document.implementation.createHTMLDocument(\"\"), \n cachedDocument.body.innerHTML = xhr.responseText, xhr._cachedTarget = {}), // clear the xhr embeds list and embed each item\n xhr._embeds.splice(0).map(function(item) {\n // get the cached target\n var target = xhr._cachedTarget[item.id];\n // ensure the cached target\n target || (target = xhr._cachedTarget[item.id] = cachedDocument.getElementById(item.id)), \n // embed the target into the svg\n embed(item.parent, item.svg, target);\n });\n }\n }, // test the ready state change immediately\n xhr.onreadystatechange();\n }\n function svg4everybody(rawopts) {\n function oninterval() {\n // while the index exists in the live collection\n for (// get the cached index\n var index = 0; index < uses.length; ) {\n // get the current \n var use = uses[index], parent = use.parentNode, svg = getSVGAncestor(parent), src = use.getAttribute(\"xlink:href\") || use.getAttribute(\"href\");\n if (!src && opts.attributeName && (src = use.getAttribute(opts.attributeName)), \n svg && src) {\n if (polyfill) {\n if (!opts.validate || opts.validate(src, svg, use)) {\n // remove the element\n parent.removeChild(use);\n // parse the src and get the url and id\n var srcSplit = src.split(\"#\"), url = srcSplit.shift(), id = srcSplit.join(\"#\");\n // if the link is external\n if (url.length) {\n // get the cached xhr request\n var xhr = requests[url];\n // ensure the xhr request exists\n xhr || (xhr = requests[url] = new XMLHttpRequest(), xhr.open(\"GET\", url), xhr.send(), \n xhr._embeds = []), // add the svg and id as an item to the xhr embeds list\n xhr._embeds.push({\n parent: parent,\n svg: svg,\n id: id\n }), // prepare the xhr ready state change event\n loadreadystatechange(xhr);\n } else {\n // embed the local id into the svg\n embed(parent, svg, document.getElementById(id));\n }\n } else {\n // increase the index when the previous value was not \"valid\"\n ++index, ++numberOfSvgUseElementsToBypass;\n }\n }\n } else {\n // increase the index when the previous value was not \"valid\"\n ++index;\n }\n }\n // continue the interval\n (!uses.length || uses.length - numberOfSvgUseElementsToBypass > 0) && requestAnimationFrame(oninterval, 67);\n }\n var polyfill, opts = Object(rawopts), newerIEUA = /\\bTrident\\/[567]\\b|\\bMSIE (?:9|10)\\.0\\b/, webkitUA = /\\bAppleWebKit\\/(\\d+)\\b/, olderEdgeUA = /\\bEdge\\/12\\.(\\d+)\\b/, edgeUA = /\\bEdge\\/.(\\d+)\\b/, inIframe = window.top !== window.self;\n polyfill = \"polyfill\" in opts ? opts.polyfill : newerIEUA.test(navigator.userAgent) || (navigator.userAgent.match(olderEdgeUA) || [])[1] < 10547 || (navigator.userAgent.match(webkitUA) || [])[1] < 537 || edgeUA.test(navigator.userAgent) && inIframe;\n // create xhr requests object\n var requests = {}, requestAnimationFrame = window.requestAnimationFrame || setTimeout, uses = document.getElementsByTagName(\"use\"), numberOfSvgUseElementsToBypass = 0;\n // conditionally start the interval if the polyfill is active\n polyfill && oninterval();\n }\n function getSVGAncestor(node) {\n for (var svg = node; \"svg\" !== svg.nodeName.toLowerCase() && (svg = svg.parentNode); ) {}\n return svg;\n }\n return svg4everybody;\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].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","'use strict';\n\n// updates progress bar when clicked\nfunction updateProgressOnClick(player, $progress) {\n player.getDuration().then(function (duration) {\n $progress.val($progress.val());\n player.setCurrentTime((duration / 1000) * $progress.val());\n });\n}\n\n$(document).ready(function () {\n var $vimeoPlayers = $('.vimeo-player');\n\n $vimeoPlayers.each(function (index) {\n var vimeoPlayer = $vimeoPlayers[index];\n var vimeoWidth = $(vimeoPlayer).width();\n\n // Hide control panel on the small width of the parent container.\n if (vimeoWidth < 200) {\n $(vimeoPlayer).find('.custom-controls-block').addClass('d-none');\n }\n\n var options = $(vimeoPlayer).attr('data-options');\n if (options) {\n options = JSON.parse(options);\n\n // Hide default control panel.\n options.controls = 0;\n\n var player = new Vimeo.Player($(vimeoPlayer), options); // eslint-disable-line\n player.setVolume(0);\n\n var $controls = $(vimeoPlayer).find('.custom-controls'),\n $thumbnail = $(vimeoPlayer).find('.thumbnail'),\n $mainBtnPlay = $(vimeoPlayer).find('.js-main-video-play'),\n $btnPlay = $controls.find('.js-video-play'),\n $btnPause = $controls.find('.js-video-pause'),\n $progress = $controls.find('.custom-controls__bar'),\n timeDrag = false,\n playing = false;\n\n if (options.autoplay) {\n $mainBtnPlay.parent().addClass('d-none');\n }\n\n $mainBtnPlay.on('click', function (e) {\n e.preventDefault();\n playing = true;\n $(this).parent().addClass('d-none');\n $controls.removeClass('d-none');\n $btnPause.removeClass('d-none');\n $btnPlay.addClass('d-none');\n player.play();\n });\n\n $btnPlay.on('click', function (e) {\n e.preventDefault();\n $btnPause.removeClass('d-none');\n $btnPlay.addClass('d-none');\n player.play();\n });\n\n $btnPause.on('click', function (e) {\n e.preventDefault();\n $btnPlay.removeClass('d-none');\n $btnPause.addClass('d-none');\n player.pause();\n });\n\n $thumbnail.on('click', function () {\n playing ? player.pause() : player.play();\n\n if ($(this).width() < 200) {\n $mainBtnPlay.parent().toggleClass('d-none', !playing);\n }\n });\n\n player.on('play', function () {\n playing = true;\n $btnPause.removeClass('d-none');\n $btnPlay.addClass('d-none');\n });\n\n player.on('pause', function () {\n playing = false;\n $btnPlay.removeClass('d-none');\n $btnPause.addClass('d-none');\n });\n\n player.on('timeupdate', function (data) {\n if (!timeDrag) {\n $progress.val(data.percent * 1000);\n }\n });\n\n // progress bar interactions\n $progress.on('mousedown', function () {\n timeDrag = true;\n });\n\n $progress.on('mouseup', function () {\n if (timeDrag) {\n timeDrag = false;\n updateProgressOnClick(player, $progress);\n }\n });\n\n $(document).on('mousemove', function () {\n if (timeDrag) {\n updateProgressOnClick(player, $progress);\n }\n });\n\n }\n });\n\n /**\n * Calculates the width and height of container based on parent DOM element (in case of video-banner)\n * or other similar containers (in case of swiper/carousel).\n * Width and height of iframe tag is taken directly from parents container.\n */\n var $vimeoScale = $('.js-crop-full-width, .js-crop-full-height');\n $vimeoScale.each(function (index) {\n const observer = new MutationObserver(function () {\n var containerWidth,\n containerHeight,\n newVimeoWidth,\n newVimeoHeight,\n vimeoWidth,\n vimeoHeight;\n\n var vimeoItem = $vimeoScale[index];\n if ($(vimeoItem).hasClass('js-crop-full-width')) {\n containerWidth = $(vimeoItem).width();\n vimeoWidth = $(vimeoItem).find('iframe').attr('width');\n vimeoHeight = $(vimeoItem).find('iframe').attr('height');\n\n newVimeoWidth = containerWidth;\n newVimeoHeight = (containerWidth / vimeoWidth) * vimeoHeight;\n containerHeight = newVimeoHeight;\n } else if ($(vimeoItem).hasClass('js-crop-full-height')) {\n\n if ($(vimeoItem).closest('.content__container').length > 0) {\n // Content Tile (PLP)\n containerHeight = $(vimeoItem).closest('.tile-container').height();\n containerWidth = $(vimeoItem).closest('.tile-container').width();\n\n vimeoHeight = $(vimeoItem).find('iframe').attr('height');\n vimeoWidth = $(vimeoItem).find('iframe').attr('width');\n newVimeoWidth = (containerHeight * vimeoWidth) / vimeoHeight;\n newVimeoHeight = containerHeight;\n\n $(vimeoItem).find('iframe').css('left', '-' + ((newVimeoWidth - containerWidth) / 2) + 'px');\n\n } else if ($(vimeoItem).closest('.content-tile').length > 0) {\n // Content Tile Layout (homepage component)\n vimeoWidth = $(vimeoItem).find('iframe').width();\n $(vimeoItem).addClass('d-none');\n containerWidth = $(vimeoItem).closest('.content-tile__tile').width();\n $(vimeoItem).removeClass('d-none');\n\n containerHeight = $(vimeoItem).closest('.content-tile').find('.content-tile__img');\n containerHeight = containerHeight.length ? containerHeight.height() : $(vimeoItem).find('iframe').height();\n vimeoHeight = $(vimeoItem).find('iframe').height();\n newVimeoWidth = (containerHeight * vimeoWidth) / vimeoHeight;\n newVimeoHeight = containerHeight;\n\n $(vimeoItem).find('iframe').css('left', '-' + ((newVimeoWidth - containerWidth) / 2) + 'px');\n\n } else if ($(vimeoItem).closest('.primary-images').length > 0) {\n // Carousel Image (PDP)\n containerHeight = $(vimeoItem).closest('.primary-images').find('.carousel-inner').width();\n containerWidth = $(vimeoItem).closest('.primary-images').find('.carousel-inner').width();\n vimeoHeight = $(vimeoItem).find('iframe').height();\n vimeoWidth = $(vimeoItem).find('iframe').width();\n newVimeoWidth = (containerHeight * vimeoWidth) / vimeoHeight;\n newVimeoHeight = containerHeight;\n\n $(vimeoItem).find('iframe').css('left', '-' + ((newVimeoWidth - containerWidth) / 2) + 'px');\n }\n }\n\n $(vimeoItem).css('width', containerWidth);\n $(vimeoItem).css('height', containerHeight);\n $(vimeoItem).find('iframe').css('width', newVimeoWidth);\n $(vimeoItem).find('iframe').css('height', newVimeoHeight);\n observer.disconnect();\n });\n\n observer.observe($vimeoScale[index], { subtree: false, childList: true });\n });\n});\n","require('svg4everybody')({});\n"],"names":[],"sourceRoot":""}