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UAAA,EAAAL,MAEmBA,KACbmJ,EAAAxH,KAAIgH,GAAAA,GAAYO,gBACnBC,EAAAxH,KAAIgH,GAAAA,GAAYO,eAAgB,EAClC,GACD,CAhDD1D,iBAAAA,GACE7D,KAAKyH,SACLzH,KAAKwE,iBAAiB,8BAA6BgD,EAAExH,KAAIkH,GAAAA,IACzDlH,KAAKwE,iBAAiB,8BAA6BgD,EAAExH,KAAImH,GAAAA,GAC3D,CAEAnD,oBAAAA,GAC4B,MAA1Bb,MAAMa,sBAANb,MAAMa,uBACNhE,KAAK6E,oBAAoB,8BAA6B2C,EAAExH,KAAIkH,GAAAA,IAC5DlH,KAAK6E,oBAAoB,8BAA6B2C,EAAExH,KAAImH,GAAAA,GAC9D,CAEAM,MAAAA,GACE,IA5BgBC,EA6BH,kCA7BgBnK,EA6BmBoK,OA5BH,IAApCC,eAAeC,IAAIH,IAC5BE,eAAeE,OAAOJ,EAAanK,GA6BjC,MAAMwK,EAAsB/H,KAAKgI,cAAc,qBAGvB,IAAIpI,EAC1B,CAACmI,IACA7H,IACC,MAAM0B,EAAU1B,EAAc,GACxB+H,EAA0BF,EAAoBtB,aAAahE,GAC7Db,EAAQvB,gBAA8C,oBAA5B4H,GAC5BF,EAAoB5C,aAAa1C,EAAwB,eAEtDb,EAAQvB,gBAA8C,gBAA5B4H,GAC7BF,EAAoB5C,aAAa1C,EAAwB,kBAC3D,GAGN,CAAE,MAAOyF,GAEP/B,QAAQC,MAAO,yBAAwBS,IAAOqB,EAChD,CAlDJ,IAAoBR,EAAanK,CAmD/B,EAeGqK,eAAeC,IAAIhB,IACtBe,eAAeE,OAAOjB,EAAKO,E","sources":["webpack://levende-stillbilde/./node_modules/@nrk/dh-server-libs/get-element-tag.js","webpack://levende-stillbilde/./node_modules/@nrk/dh-server-libs/src/get-element-tag.js","webpack://levende-stillbilde/webpack/bootstrap","webpack://levende-stillbilde/./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://levende-stillbilde/./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://levende-stillbilde/./node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://levende-stillbilde/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://levende-stillbilde/./node_modules/@nrk/dh-basis-common/dist/index.esm.js","webpack://levende-stillbilde/./node_modules/@nrk/dh-basis-levende-stillbilde/dist/index.esm.js","webpack://levende-stillbilde/./src/kurator/client.js"],"sourcesContent":["module.exports = require('./src/get-element-tag')\n","/**\n * Creates a valid custom element name that is versioned (major)\n */\nfunction getElementTag(name, version) {\n const formattedVersion = version ? `-v${version.split('.')[0]}` : ''\n return name + formattedVersion\n}\n\nmodule.exports.getElementTag = getElementTag\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","export default function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}","import _typeof from \"./typeof.js\";\nexport default function toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","import _defineProperty from '@babel/runtime/helpers/defineProperty';\n\n/* eslint-disable compat/compat */\nfunction getDefaultRoot() {\n /*\n Use document if supported\n IntersectionObserver will otherwise default to top level document,\n and IntersectionObserver will not work as expected in an iframe.\n https://github.com/w3c/IntersectionObserver/issues/372\n */\n\n /*\n Safari does not throw error on root: document, but does not trigger events as expected\n returning null for now until better feature detection is possible\n */\n return null;\n\n /*\n try {\n // eslint-disable-next-line no-new\n new IntersectionObserver(() => {}, { root: document })\n return document\n } catch (e) {\n return null\n }\n */\n}\n\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nvar defaultConfig = {\n rootMargin: '0px 0px 0px 0px',\n threshold: [0, 0.5, 1],\n root: getDefaultRoot()\n};\nclass ElementIntersectionObserver {\n constructor(elements, onChange, config) {\n _defineProperty(this, \"intersections\", void 0);\n _defineProperty(this, \"elements\", void 0);\n this.elements = elements.slice(0);\n this.intersections = elements.map(target => ({\n target,\n isIntersecting: false,\n ratio: null\n }));\n this.intersectionObserver = new IntersectionObserver(entries => {\n var intersections = this.intersections.slice(0);\n entries.forEach(entry => {\n var idx = elements.indexOf(entry.target);\n intersections.splice(idx, 1, {\n target: entry.target,\n isIntersecting: entry.isIntersecting,\n ratio: entry.intersectionRatio\n });\n });\n this.intersections = intersections;\n onChange(this.intersections);\n }, _objectSpread(_objectSpread({}, defaultConfig), config));\n elements.forEach(elm => this.intersectionObserver.observe(elm));\n }\n disconnect() {\n // Unregister trigger elements\n this.elements.forEach(elm => this.intersectionObserver.unobserve(elm));\n\n // Disconnect intersection observer\n this.intersectionObserver.disconnect();\n }\n}\n\nfunction toggleAttribute(el, name, boolValue) {\n if (!el) {\n return;\n }\n var nextValue;\n if (typeof boolValue !== 'undefined') {\n nextValue = !!boolValue;\n } else {\n nextValue = el.hasAttribute(name);\n }\n if (nextValue) {\n el.setAttribute(name, '');\n } else {\n el.removeAttribute(name);\n }\n}\nfunction setAttribute(el, name, nextValue) {\n if (!el) {\n return;\n }\n if (nextValue) {\n el.setAttribute(name, nextValue);\n } else {\n el.removeAttribute(name);\n }\n}\nvar closest = (() => {\n var proto = typeof window === 'undefined' ? {} : window.Element.prototype;\n var match = proto.matches || proto.msMatchesSelector || proto.webkitMatchesSelector;\n if (proto.closest) {\n return (el, css) => el.closest(css);\n } else {\n return (el, css) => {\n for (; el; el = el.parentElement) if (match.call(el, css)) return el;\n return null;\n };\n }\n})();\nfunction addStyle(nodeName, css) {\n var key = \"style-\".concat(nodeName.toLowerCase());\n var min = css.replace(/\\/\\*[^!][^*]*\\*\\//g, '').replace(/\\s*(^|[:;,{}]|$)\\s*/g, '$1');\n document.getElementById(key) || document.head.insertAdjacentHTML('afterbegin', \"\"));\n}\nfunction toArray(nodeList) {\n return [].slice.call(nodeList);\n}\nfunction dispatchEvent(element, name) {\n var detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var ignore = \"prevent_recursive_dispatch_maximum_callstack\".concat(name);\n var event;\n if (element[ignore]) return true;\n // We are already processing this event, so skip sending a new one\n else element[ignore] = true; // Add name to dispatching ignore\n\n if (typeof window.CustomEvent === 'function') {\n event = new window.CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail\n });\n } else {\n event = document.createEvent('CustomEvent');\n event.initCustomEvent(name, true, true, detail);\n }\n // IE reports incorrect event.defaultPrevented\n // but correct return value on element.dispatchEvent\n var result = element.dispatchEvent(event);\n element[ignore] = null; // Remove name from dispatching ignore\n\n return result; // Follow W3C standard for return value\n}\n\nfunction easeOutQuint(t) {\n return 1 + --t * t * t * t * t;\n}\nclass VerticalScroll {\n constructor(container) {\n _defineProperty(this, \"container\", void 0);\n this.container = container;\n }\n cancel() {\n this._cancelled = true;\n }\n to(top) {\n var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;\n var callback = arguments.length > 2 ? arguments[2] : undefined;\n var from = this.container.scrollTop;\n var distance = top - from;\n var startTime = null;\n var loop = currentTime => {\n if (this._cancelled) {\n return;\n }\n if (!startTime) {\n startTime = currentTime - 1;\n }\n var timeElapsed = currentTime - startTime;\n if (timeElapsed < duration) {\n this.container.scrollTop = from + distance * easeOutQuint(timeElapsed / duration);\n window.requestAnimationFrame(loop);\n } else {\n this.container.scrollTop = top;\n callback && callback();\n }\n };\n\n // eslint-disable-next-line compat/compat\n window.requestAnimationFrame(loop);\n }\n}\nclass HorizontalScroll {\n constructor(container) {\n _defineProperty(this, \"container\", void 0);\n this.container = container;\n }\n cancel() {\n this._cancelled = true;\n }\n to(left) {\n var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;\n var callback = arguments.length > 2 ? arguments[2] : undefined;\n var from = this.container.scrollLeft;\n var distance = left - from;\n var startTime = null;\n var loop = currentTime => {\n if (this._cancelled) {\n return;\n }\n if (!startTime) {\n startTime = currentTime - 1;\n }\n var timeElapsed = currentTime - startTime;\n if (timeElapsed < duration) {\n this.container.scrollLeft = from + distance * easeOutQuint(timeElapsed / duration);\n window.requestAnimationFrame(loop);\n } else {\n this.container.scrollLeft = left;\n callback && callback();\n }\n };\n\n // eslint-disable-next-line compat/compat\n window.requestAnimationFrame(loop);\n }\n}\n\nfunction testReducedMotion() {\n if (typeof window !== 'undefined') {\n return !!window.matchMedia && window.matchMedia('(prefers-reduced-motion)').matches;\n }\n return false;\n}\n\nvar MAX_SAFE_INTEGER = 9007199254740991;\nfunction withinRange(current) {\n var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var stop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : MAX_SAFE_INTEGER;\n return current >= start && current <= stop;\n}\nfunction withinStops(currentTime, stops, targetStop) {\n var nrOfStops = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n var uniqueStops = stops.filter(unique);\n var targetTime = stops[targetStop];\n var prevTime = uniqueStops[uniqueStops.indexOf(targetTime) - nrOfStops];\n var nextTime = uniqueStops[uniqueStops.indexOf(targetTime) + nrOfStops];\n return withinRange(currentTime, prevTime, nextTime);\n}\nfunction unique(value, index, self) {\n return self.indexOf(value) === index;\n}\n\n/*\n * 'loading=\"lazy\"' is defined in terms of IntersectionObserver and the initial root.\n * As a result images with 'loading=\"lazy\"' inside a scroll container will not load\n * until they at least have one pixel visible in the viewport.\n *\n * This will hopefully fixed in a future version of the spec:\n * https://github.com/w3c/IntersectionObserver/issues/431\n *\n * scroll-container-lazy-load observes images and a scroll container.\n * Once images are close to intersecting it will change 'loading=\"lazy\"' to 'loading=\"eager\"'.\n * */\nfunction loadImage(image) {\n if (image.loading === 'lazy') {\n image.loading = 'eager';\n }\n}\nfunction connectScrollContainerLazyLoad(container, images) {\n var containerIntersecting = false;\n var deferredImages = [];\n\n // eslint-disable-next-line compat/compat\n var containerObserver = new IntersectionObserver(entries => {\n containerIntersecting = entries === null || entries === void 0 ? void 0 : entries[0].isIntersecting;\n if (containerIntersecting) {\n deferredImages.forEach(image => loadImage(image));\n deferredImages = [];\n }\n }, {\n root: getDefaultRoot(),\n threshold: [0.0]\n });\n containerObserver.observe(container);\n\n // eslint-disable-next-line compat/compat\n var imageObserver = new IntersectionObserver(entries => {\n for (var entry of entries) {\n if (entry.isIntersecting) {\n var image = entry.target;\n imageObserver.unobserve(image);\n if (containerIntersecting) {\n loadImage(image);\n } else {\n /* Defer loading of if the container is not intersecting the viewport */\n deferredImages.push(image);\n }\n }\n }\n }, {\n root: container,\n rootMargin: '300px',\n threshold: 0.0\n });\n for (var image of images) {\n imageObserver.observe(image);\n }\n return () => {\n containerObserver.disconnect();\n imageObserver.disconnect();\n };\n}\n\nfunction debounce(fn, delay) {\n var timeout;\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n clearTimeout(timeout);\n timeout = setTimeout(() => fn(...args), delay);\n };\n}\n\nexport { ElementIntersectionObserver, HorizontalScroll, VerticalScroll, addStyle, closest, connectScrollContainerLazyLoad, debounce, dispatchEvent, setAttribute, testReducedMotion, toArray, toggleAttribute, withinRange, withinStops };\n//# sourceMappingURL=index.esm.js.map\n","import _defineProperty from '@babel/runtime/helpers/defineProperty';\nimport { dispatchEvent, testReducedMotion, toArray, toggleAttribute } from '@nrk/dh-basis-common';\n\nvar STATE_ATTR = 'data-state';\nvar VIEWPORT_POSITION_ATTR = 'data-viewport-position';\nvar DISABLE_FORCED_ATTRIBUTES_ATTR = 'disable-forced-attributes';\nvar IS_PAUSED = 'is-paused';\nvar AUTOPLAY_BLOCKED = 'autoplay-blocked';\nvar READY_STATE = {\n HAVE_NOTHING: 0,\n HAVE_METADATA: 1,\n HAVE_CURRENT_DATA: 2,\n HAVE_FUTURE_DATA: 3,\n HAVE_ENOUGH_DATA: 4 // Can play through\n};\nvar isVisible = child => !!child.offsetParent;\nclass LevendeStillbilde extends HTMLElement {\n constructor() {\n super(...arguments);\n _defineProperty(this, \"_disconnecting\", false);\n _defineProperty(this, \"_visibleVideoElement\", void 0);\n _defineProperty(this, \"_handlePlayChange\", e => {\n if (e.type === 'play') {\n dispatchEvent(this, 'dh-basis-autoplay-succeeded');\n }\n if (e.target === this._visibleVideoElement) {\n this.isPaused = this._visibleVideoElement.paused;\n }\n });\n _defineProperty(this, \"_updatePlayState\", () => {\n if (!this._visibleVideoElement) {\n return;\n }\n if (this._shouldPlay()) {\n this._playVideo();\n } else {\n this._pauseVideo();\n }\n });\n _defineProperty(this, \"_handleResize\", () => {\n this._updateVisibleVideoElement();\n });\n }\n static get observedAttributes() {\n return [STATE_ATTR, DISABLE_FORCED_ATTRIBUTES_ATTR, VIEWPORT_POSITION_ATTR];\n }\n connectedCallback() {\n this._setVideoAttributes();\n this._setEventListeners();\n this._updateVisibleVideoElement();\n }\n disconnectedCallback() {\n this._disconnecting = true;\n this._removeEventListeners();\n }\n attributeChangedCallback(name, prevValue, newValue) {\n var valueChanged = prevValue !== newValue;\n if (name === STATE_ATTR || name === VIEWPORT_POSITION_ATTR) {\n if (valueChanged) {\n this._updateVisibleVideoElement();\n this._updatePlayState();\n if (name === VIEWPORT_POSITION_ATTR && newValue === 'IN-VIEWPORT') {\n this._preload();\n }\n }\n }\n }\n _setEventListeners() {\n window.addEventListener('resize', this._handleResize);\n this.videoElements.forEach(el => {\n el.addEventListener('pause', this._handlePlayChange);\n el.addEventListener('play', this._handlePlayChange);\n el.addEventListener('canplaythrough', this._updatePlayState);\n });\n }\n _removeEventListeners() {\n window.removeEventListener('resize', this._handleResize);\n this.videoElements.forEach(el => {\n el.removeEventListener('pause', this._handlePlayChange);\n el.removeEventListener('play', this._handlePlayChange);\n el.removeEventListener('canplaythrough', this._updatePlayState);\n });\n }\n _updateVisibleVideoElement() {\n // eslint-disable-next-line compat/compat\n requestAnimationFrame(() => {\n var nextVisibleVideo = this.videoElements.find(isVisible);\n if (nextVisibleVideo !== this._visibleVideoElement) {\n // Pause previous video\n this._pauseVideo();\n this._visibleVideoElement = nextVisibleVideo;\n if (this._shouldPreload()) {\n this._preload();\n }\n this._updatePlayState();\n }\n });\n }\n _setVideoAttributes() {\n if (!this.disableForcedAttributes) {\n this.videoElements.forEach(el => {\n el.setAttribute('playsInline', '');\n el.setAttribute('loop', '');\n el.setAttribute('disableRemotePlayback', '');\n el.setAttribute('x-webkit-airplay', 'deny');\n });\n }\n }\n _shouldPlay() {\n var _this$_visibleVideoEl;\n /*\n * Safari 14-15.5 hides poster on play, leaving a transparent element until enough data is available to play through.\n * We have to wait for the canplaythrough event and readystate = READY_STATE.HAVE_ENOUGH_DATA before calling `.play()`\n * */\n return ((_this$_visibleVideoEl = this._visibleVideoElement) === null || _this$_visibleVideoEl === void 0 ? void 0 : _this$_visibleVideoEl.readyState) >= READY_STATE.HAVE_ENOUGH_DATA && this.state === 'ACTIVE' && this.viewportPosition === 'IN-VIEWPORT';\n }\n _shouldPreload() {\n return this.viewportPosition === 'IN-VIEWPORT';\n }\n _preload() {\n var _this$_visibleVideoEl2;\n if (((_this$_visibleVideoEl2 = this._visibleVideoElement) === null || _this$_visibleVideoEl2 === void 0 ? void 0 : _this$_visibleVideoEl2.readyState) < READY_STATE.HAVE_ENOUGH_DATA) {\n var _this$_visibleVideoEl3;\n (_this$_visibleVideoEl3 = this._visibleVideoElement) === null || _this$_visibleVideoEl3 === void 0 || _this$_visibleVideoEl3.load();\n }\n }\n _playVideo() {\n dispatchEvent(this, 'dh-basis-autoplay-attempted');\n var reducedMotion = testReducedMotion();\n var videoElement = this._visibleVideoElement;\n if (videoElement.paused && !reducedMotion && !this.autoplayBlocked) {\n var playPromise = videoElement.play() || Promise.resolve();\n playPromise.catch(e => {\n console.error(e);\n this.autoplayBlocked = true;\n });\n }\n }\n _pauseVideo() {\n var videoElement = this._visibleVideoElement;\n if (videoElement && !videoElement.paused) {\n videoElement.pause();\n }\n }\n get videoElements() {\n return toArray(this.querySelectorAll('video'));\n }\n get disableForcedAttributes() {\n return this.hasAttribute(DISABLE_FORCED_ATTRIBUTES_ATTR);\n }\n get state() {\n return this.getAttribute(STATE_ATTR);\n }\n set state(val) {\n this.setAttribute(STATE_ATTR, val);\n }\n get isPaused() {\n return this.getAttribute(IS_PAUSED);\n }\n set isPaused(val) {\n if (val) {\n this.setAttribute(IS_PAUSED, '');\n } else {\n this.removeAttribute(IS_PAUSED);\n }\n }\n get autoplayBlocked() {\n return this.hasAttribute(AUTOPLAY_BLOCKED) || false;\n }\n set autoplayBlocked(val) {\n toggleAttribute(this, AUTOPLAY_BLOCKED, val);\n }\n get viewportPosition() {\n return this.getAttribute(VIEWPORT_POSITION_ATTR);\n }\n set viewportPosition(val) {\n this.setAttribute(VIEWPORT_POSITION_ATTR, val);\n }\n}\n\nexport { LevendeStillbilde as default };\n//# sourceMappingURL=index.esm.js.map\n","import { getElementTag } from '@nrk/dh-server-libs/get-element-tag'\n\nimport levendeStillbilde from '@nrk/dh-basis-levende-stillbilde'\nimport { ElementIntersectionObserver } from '@nrk/dh-basis-common'\nimport './components/VideoLoop.module.css'\n\nconst tag = getElementTag(__APP_NAME__, __APP_VERSION__)\n\nfunction safeDefine(elementName, constructor) {\n if (typeof customElements.get(elementName) === 'undefined') {\n customElements.define(elementName, constructor)\n }\n}\n\nconst VIEWPORT_POSITION_ATTR = 'data-viewport-position'\n\nclass AppElement extends HTMLElement {\n name = tag\n #logStatus = {\n playAttempted: false,\n playSucceeded: false,\n }\n\n connectedCallback() {\n this.render()\n this.addEventListener('dh-basis-autoplay-attempted', this.#logPlayAttempted)\n this.addEventListener('dh-basis-autoplay-succeeded', this.#logPlaySucceeded)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback?.()\n this.removeEventListener('dh-basis-autoplay-attempted', this.#logPlayAttempted)\n this.removeEventListener('dh-basis-autoplay-succeeded', this.#logPlaySucceeded)\n }\n\n render() {\n try {\n safeDefine('dh-lvs-basis-levende-stillbilde', levendeStillbilde)\n\n const videoWrapperElement = this.querySelector('.dh-video-wrapper')\n\n // eslint-disable-next-line no-unused-vars\n const elementObserver = new ElementIntersectionObserver(\n [videoWrapperElement],\n (intersections) => {\n const element = intersections[0]\n const elementViewportPosition = videoWrapperElement.getAttribute(VIEWPORT_POSITION_ATTR)\n if (element.isIntersecting && elementViewportPosition === 'OUT-OF-VIEWPORT') {\n videoWrapperElement.setAttribute(VIEWPORT_POSITION_ATTR, 'IN-VIEWPORT')\n }\n if (!element.isIntersecting && elementViewportPosition === 'IN-VIEWPORT') {\n videoWrapperElement.setAttribute(VIEWPORT_POSITION_ATTR, 'OUT-OF-VIEWPORT')\n }\n },\n )\n } catch (err) {\n // fail silently\n console.error(`Error while rendering ${tag}`, err)\n }\n }\n\n #logPlayAttempted = () => {\n if (!this.#logStatus.playAttempted) {\n this.#logStatus.playAttempted = true\n }\n }\n\n #logPlaySucceeded = () => {\n if (!this.#logStatus.playSucceeded) {\n this.#logStatus.playSucceeded = true\n }\n }\n}\n\nif (!customElements.get(tag)) {\n customElements.define(tag, AppElement)\n}\n"],"names":["module","exports","getElementTag","name","version","split","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","_typeof","o","Symbol","iterator","constructor","prototype","toPropertyKey","t","i","r","e","toPrimitive","call","TypeError","String","Number","obj","key","value","Object","defineProperty","enumerable","configurable","writable","ownKeys","keys","getOwnPropertySymbols","filter","getOwnPropertyDescriptor","push","apply","_objectSpread","arguments","length","forEach","getOwnPropertyDescriptors","defineProperties","defaultConfig","rootMargin","threshold","root","ElementIntersectionObserver","elements","onChange","config","this","slice","intersections","map","target","isIntersecting","ratio","intersectionObserver","IntersectionObserver","entries","entry","idx","indexOf","splice","intersectionRatio","elm","observe","disconnect","unobserve","proto","match","window","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","dispatchEvent","element","event","detail","ignore","concat","CustomEvent","bubbles","cancelable","document","createEvent","initCustomEvent","result","STATE_ATTR","VIEWPORT_POSITION_ATTR","DISABLE_FORCED_ATTRIBUTES_ATTR","IS_PAUSED","AUTOPLAY_BLOCKED","READY_STATE","isVisible","child","offsetParent","LevendeStillbilde","HTMLElement","super","type","_visibleVideoElement","isPaused","paused","_shouldPlay","_playVideo","_pauseVideo","_updateVisibleVideoElement","observedAttributes","connectedCallback","_setVideoAttributes","_setEventListeners","disconnectedCallback","_disconnecting","_removeEventListeners","attributeChangedCallback","prevValue","newValue","_updatePlayState","_preload","addEventListener","_handleResize","videoElements","el","_handlePlayChange","removeEventListener","requestAnimationFrame","nextVisibleVideo","find","_shouldPreload","disableForcedAttributes","setAttribute","_this$_visibleVideoEl","readyState","state","viewportPosition","_this$_visibleVideoEl2","_this$_visibleVideoEl3","load","reducedMotion","matchMedia","videoElement","autoplayBlocked","play","Promise","resolve","catch","console","error","pause","nodeList","querySelectorAll","hasAttribute","getAttribute","val","removeAttribute","boolValue","tag","__APP_NAME__","__APP_VERSION__","_logStatus","_classPrivateFieldLooseKey","_logPlayAttempted","_logPlaySucceeded","AppElement","args","playAttempted","playSucceeded","_classPrivateFieldLooseBase","render","elementName","levendeStillbilde","customElements","get","define","videoWrapperElement","querySelector","elementViewportPosition","err"],"sourceRoot":""}