{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./cartridges/app_bassett/cartridge/client/default/js/vimeoScript.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","addPrefetch","kind","url","as","linkElem","document","createElement","rel","href","crossorigin","head","append","appendChild","textContent","LiteVimeo","HTMLElement","preconnected","this","videoId","getAttribute","videoClass","params","fetch","then","response","json","data","thumbnailUrl","thumbnail_large","width","height","roundedWidth","roundedHeight","Math","ceil","round","devicePixelRatio","window","getThumbnailDimensions","getBoundingClientRect","replace","style","backgroundImage","playBtnEl","querySelector","playLabel","trim","type","setAttribute","classList","add","removeAttribute","addEventListener","warmConnections","once","addIframe","contains","iframeEl","title","allow","className","paramsString","join","src","encodeURIComponent","focus","customElements","define"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,S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,iBAAkB,OAC9CvC,KAAKgC,UAAUC,IAAI,iBAEnB,MAAMO,EAAWpD,SAASC,cAAc,UACxCmD,EAAS5B,MAAQ,IACjB4B,EAAS3B,OAAS,IAElB2B,EAASC,MAAQzC,KAAK4B,UACtBY,EAASE,MAAQ,0EACjBF,EAASG,UAAY3C,KAAKG,WAG1B,IAAIyC,EAAe5C,KAAKI,OAAOyC,KAAK,KACpCL,EAASM,IAAM,kCAAkCC,mBAAmB/C,KAAKC,YAAY2C,UACrF5C,KAAKN,OAAO8C,GAGZA,EAASL,iBAAiB,OAAQK,EAASQ,MAAO,CAAEX,MAAM,KAI9DjB,OAAO6B,iBAAmB7B,OAAO6B,eAAerF,IAAI,eACpDwD,OAAO6B,eAAeC,OAAO,aAAcrD","file":"default/js/vimeoScript.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 338);\n","const style = document.head.appendChild(document.createElement(\"style\"));\nstyle.textContent = /* css */`\n\nlite-vimeo {\naspect-ratio: 16 / 9;\nbackground-color: #000;\nposition: absolute;\ndisplay: block;\ntop: 0;\nbottom: 0;\nleft: 0;\nwidth: 100%;\nheight: 100%;\nborder: 0;\ncontain: content;\nbackground-position: center center;\nbackground-size: cover;\ncursor: pointer;\n}\n\nlite-vimeo > iframe {\nwidth: 100%;\nheight: 100%;\nposition: absolute;\ntop: 0;\nleft: 0;\nborder: 0;\n}\n\nlite-vimeo > .ltv-playbtn {\nfont-size: 10px;\npadding: 0;\nwidth: 6.5em;\nheight: 4em;\nbackground: rgba(23, 35, 34, .75);\nz-index: 1;\nopacity: .8;\nborder-radius: .5em;\ntransition: opacity .2s ease-out, background .2s ease-out;\noutline: 0;\nborder: 0;\ncursor: pointer;\n}\n\nlite-vimeo:hover > .ltv-playbtn {\nbackground-color: rgb(0, 173, 239);\nopacity: 1;\n}\n\n/* play button triangle */\nlite-vimeo > .ltv-playbtn::before {\ncontent: '';\nborder-style: solid;\nborder-width: 10px 0 10px 20px;\nborder-color: transparent transparent transparent #fff;\n}\n\nlite-vimeo > .ltv-playbtn,\nlite-vimeo > .ltv-playbtn::before {\nposition: absolute;\ntop: 50%;\nleft: 50%;\ntransform: translate3d(-50%, -50%, 0);\n}\n\n/* Post-click styles */\nlite-vimeo.ltv-activated {\ncursor: unset;\n}\n\nlite-vimeo.ltv-activated::before,\nlite-vimeo.ltv-activated > .ltv-playbtn {\nopacity: 0;\npointer-events: none;\n}\n`;\n\n/**\n * Ported from https://github.com/paulirish/lite-youtube-embed\n *\n * A lightweight vimeo embed. Still should feel the same to the user, just MUCH faster to initialize and paint.\n *\n * Thx to these as the inspiration\n * https://storage.googleapis.com/amp-vs-non-amp/youtube-lazy.html\n * https://autoplay-youtube-player.glitch.me/\n *\n * Once built it, I also found these:\n * https://github.com/ampproject/amphtml/blob/master/extensions/amp-youtube (👍👍)\n * https://github.com/Daugilas/lazyYT\n * https://github.com/vb/lazyframe\n */\n\n/**\n * Add a to the head\n */\nfunction addPrefetch(kind, url, as) {\n const linkElem = document.createElement(\"link\");\n linkElem.rel = kind;\n linkElem.href = url;\n if (as) {\n linkElem.as = as;\n }\n linkElem.crossorigin = true;\n document.head.append(linkElem);\n}\n\n/**\n * Get the thumbnail dimensions to use for a given player size.\n *\n * @param {Object} options\n * @param {number} options.width The width of the player\n * @param {number} options.height The height of the player\n * @return {Object} The width and height\n */\nfunction getThumbnailDimensions({ width, height }) {\n let roundedWidth = width;\n let roundedHeight = height;\n\n // If the original width is a multiple of 320 then we should\n // not round up. This is to keep the native image dimensions\n // so that they match up with the actual frames from the video.\n //\n // For example 640x360, 960x540, 1280x720, 1920x1080\n //\n // Round up to nearest 100 px to improve cacheability at the\n // CDN. For example, any width between 601 pixels and 699\n // pixels will render the thumbnail at 700 pixels width.\n if (roundedWidth % 320 !== 0) {\n roundedWidth = Math.ceil(width / 100) * 100;\n roundedHeight = Math.round((roundedWidth / width) * height);\n }\n\n let devicePixelRatio = window.devicePixelRatio || 1;\n if (devicePixelRatio >= 2) devicePixelRatio *= .75;\n roundedWidth = Math.round(roundedWidth * devicePixelRatio);\n roundedHeight = Math.round(roundedHeight * devicePixelRatio);\n\n return {\n width: roundedWidth,\n height: roundedHeight\n };\n}\n\nclass LiteVimeo extends HTMLElement {\n/**\n * Begin pre-connecting to warm up the iframe load\n * Since the embed's network requests load within its iframe,\n * preload/prefetch'ing them outside the iframe will only cause double-downloads.\n * So, the best we can do is warm up a few connections to origins that are in the critical path.\n *\n * Maybe `` would work, but it's unsupported: http://crbug.com/593267\n * But TBH, I don't think it'll happen soon with Site Isolation and split caches adding serious complexity.\n */\n static warmConnections() {\n if (LiteVimeo.preconnected) return;\n LiteVimeo.preconnected = true;\n\n // The iframe document and most of its subresources come right off player.vimeo.com\n addPrefetch(\"preconnect\", \"https://player.vimeo.com\");\n // Images\n addPrefetch(\"preconnect\", \"https://i.vimeocdn.com\");\n // Files .js, .css\n addPrefetch(\"preconnect\", \"https://f.vimeocdn.com\");\n // Metrics\n addPrefetch(\"preconnect\", \"https://fresnel.vimeocdn.com\");\n }\n\n connectedCallback() {\n this.videoId = this.getAttribute(\"videoid\");\n this.videoClass = this.getAttribute(\"data-class\");\n\n // Collecting attributes into an array\n this.params = [\n `h=${this.getAttribute(\"hashcode\")}`,\n `autoplay=${this.getAttribute(\"autoplay\")}`,\n `loop=${this.getAttribute(\"loop\")}`,\n `title=${this.getAttribute(\"title\")}`,\n `controls=${this.getAttribute(\"controls\")}`,\n `muted=${this.getAttribute(\"muted\")}`\n ];\n\n /**\n * Lo, the vimeo placeholder image! (aka the thumbnail, poster image, etc)\n * We have to use the Vimeo API.\n */\n fetch(`https://vimeo.com/api/v2/video/${this.videoId}.json`)\n .then(response => response.json())\n .then(data => {\n let thumbnailUrl = data[0].thumbnail_large;\n let { width, height } = getThumbnailDimensions(this.getBoundingClientRect());\n thumbnailUrl = thumbnailUrl.replace(/-d_[\\dx]+$/i, `-d_${width}x${height}`);\n this.style.backgroundImage = `url(\"${thumbnailUrl}\")`;\n });\n\n let playBtnEl = this.querySelector(\".ltv-playbtn\");\n // A label for the button takes priority over a [playlabel] attribute on the custom-element\n this.playLabel = (playBtnEl && playBtnEl.textContent.trim()) || this.getAttribute(\"playlabel\") || \"Play video\";\n\n if (!playBtnEl) {\n playBtnEl = document.createElement(\"button\");\n playBtnEl.type = \"button\";\n playBtnEl.setAttribute(\"aria-label\", this.playLabel);\n playBtnEl.classList.add(\"ltv-playbtn\");\n this.append(playBtnEl);\n }\n playBtnEl.removeAttribute(\"href\");\n\n // On hover (or tap), warm up the TCP connections we're (likely) about to use.\n this.addEventListener(\"pointerover\", LiteVimeo.warmConnections, {\n once: true\n });\n\n // Once the user clicks, add the real iframe and drop our play button\n // TODO: In the future we could be like amp-youtube and silently swap in the iframe during idle time\n // We'd want to only do this for in-viewport or near-viewport ones: https://github.com/ampproject/amphtml/pull/5003\n this.addEventListener(\"click\", this.addIframe);\n }\n\n addIframe() {\n if (this.classList.contains(\"ltv-activated\")) return;\n this.classList.add(\"ltv-activated\");\n\n const iframeEl = document.createElement(\"iframe\");\n iframeEl.width = 640;\n iframeEl.height = 360;\n // No encoding necessary as [title] is safe. https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html#:~:text=Safe%20HTML%20Attributes%20include\n iframeEl.title = this.playLabel;\n iframeEl.allow = \"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\";\n iframeEl.className = this.videoClass;\n // AFAIK, the encoding here isn't necessary for XSS, but we'll do it only because this is a URL\n // https://stackoverflow.com/q/64959723/89484\n let paramsString = this.params.join(\"&\");\n iframeEl.src = `https://player.vimeo.com/video/${encodeURIComponent(this.videoId)}?${paramsString}&api=1`;\n this.append(iframeEl);\n\n // Set focus for a11y\n iframeEl.addEventListener(\"load\", iframeEl.focus, { once: true });\n }\n}\n\nif (window.customElements && !window.customElements.get(\"lite-vimeo\")) {\n window.customElements.define(\"lite-vimeo\", LiteVimeo);\n}\n"],"sourceRoot":""}