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-bilde/webpack/runtime/import chunk loading","webpack://dh-tilpasset-bilde/./node_modules/@nrk/dh-server-libs/base-element.js","webpack://dh-tilpasset-bilde/./node_modules/@nrk/dh-server-libs/get-element-tag.js","webpack://dh-tilpasset-bilde/./node_modules/@nrk/dh-server-libs/src/base-element.js","webpack://dh-tilpasset-bilde/./node_modules/@nrk/dh-server-libs/src/get-context-id.js","webpack://dh-tilpasset-bilde/./node_modules/@nrk/dh-server-libs/src/get-element-tag.js","webpack://dh-tilpasset-bilde/webpack/bootstrap","webpack://dh-tilpasset-bilde/webpack/runtime/define property getters","webpack://dh-tilpasset-bilde/webpack/runtime/ensure chunk","webpack://dh-tilpasset-bilde/webpack/runtime/get javascript chunk filename","webpack://dh-tilpasset-bilde/webpack/runtime/get mini-css chunk filename","webpack://dh-tilpasset-bilde/webpack/runtime/hasOwnProperty shorthand","webpack://dh-tilpasset-bilde/webpack/runtime/make namespace object","webpack://dh-tilpasset-bilde/webpack/runtime/publicPath","webpack://dh-tilpasset-bilde/webpack/runtime/css loading","webpack://dh-tilpasset-bilde/./node_modules/@nrk/dh-basis-common/dh-basis-common.esm.js","webpack://dh-tilpasset-bilde/./src/components/tilpasset-bilde.js","webpack://dh-tilpasset-bilde/./node_modules/@nrk/dh-utils/dist/module/array.js","webpack://dh-tilpasset-bilde/./src/client.module.css?98d6","webpack://dh-tilpasset-bilde/./src/client.js"],"sourcesContent":["var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t179: 0\n};\n\nvar installChunk = (data) => {\n\tvar {ids, modules, runtime} = data;\n\t// add \"modules\" to the modules object,\n\t// then flag all \"ids\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tfor(moduleId in modules) {\n\t\tif(__webpack_require__.o(modules, moduleId)) {\n\t\t\t__webpack_require__.m[moduleId] = modules[moduleId];\n\t\t}\n\t}\n\tif(runtime) runtime(__webpack_require__);\n\tfor(;i < ids.length; i++) {\n\t\tchunkId = ids[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[ids[i]] = 0;\n\t}\n\n}\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// import() chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[1]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = import(\"./\" + __webpack_require__.u(chunkId)).then(installChunk, (e) => {\n\t\t\t\t\t\tif(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t});\n\t\t\t\t\tvar promise = Promise.race([promise, new Promise((resolve) => (installedChunkData = installedChunks[chunkId] = [resolve]))])\n\t\t\t\t\tpromises.push(installedChunkData[1] = promise);\n\t\t\t\t} else installedChunks[chunkId] = 0;\n\t\t\t}\n\t\t}\n};\n\n// no external install chunk\n\n// no on chunks loaded","module.exports = require('./src/base-element.js')\n","module.exports = require('./src/get-element-tag')\n","const { getContextId } = require('./get-context-id')\n\nlet _coreAnalyticsPromise = undefined\nfunction getCoreAnalytics() {\n if (!_coreAnalyticsPromise) {\n if ('coreAnalytics' in window) {\n _coreAnalyticsPromise = Promise.resolve(window['coreAnalytics'])\n } else {\n _coreAnalyticsPromise = import('@nrk/core-analytics' /* webpackChunkName: \"ca\" */).then(\n (m) => m.default\n )\n }\n }\n return _coreAnalyticsPromise\n}\n\nclass BaseElement extends HTMLElement {\n constructor() {\n super()\n this.sendError = this.sendError.bind(this)\n this.sendGaEvent = this.sendGaEvent.bind(this)\n }\n connectedCallback() {\n if (!this.name) throw Error('Name not provided')\n this.setupTracker()\n if (typeof this.render === 'function') this.render()\n }\n\n setupTracker() {\n this.coreAnalyticsTracker = new Promise((resolve) => {\n getCoreAnalytics().then((coreAnalytics) => {\n const tracker = coreAnalytics.create()\n\n tracker('initialize', {\n container: this,\n parentId: this.metadata.parentId || getContextId(window.location.href),\n ga: this.dataset.gaPropertyId,\n })\n\n tracker('context', {\n title: this.metadata.title,\n contentId: this.metadata.selfId,\n publishDate: this.metadata.published,\n })\n\n resolve(tracker)\n })\n })\n }\n\n async sendError(message) {\n // error reporter has been removed\n }\n\n async sendGaEvent(event) {\n const tracker = await this.coreAnalyticsTracker\n tracker('event', {\n ga: {\n eventCategory: `dh-modul-${this.name}`,\n ...event,\n },\n })\n }\n\n get metadata() {\n return this.dataset.metadata ? JSON.parse(this.dataset.metadata) : {}\n }\n\n get preloadedState() {\n return this.dataset.preloadedState ? JSON.parse(this.dataset.preloadedState) : null\n }\n\n get errorTracking() {\n return {\n url: '',\n enabled: false,\n }\n }\n}\n\nmodule.exports.BaseElement = BaseElement\n","const POLOPOLY_ID_REGEX = /[1-9]{1,2}\\.\\d+/g\n\nfunction extractPolopolyIdFromString(str) {\n const matches = str.match(POLOPOLY_ID_REGEX)\n if (matches && matches.length) {\n return matches[0]\n }\n return null\n}\n\nfunction getContextId(url) {\n return extractPolopolyIdFromString(url)\n}\n\nmodule.exports.getContextId = getContextId\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].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + {\"371\":\"dh-preview-iframe\",\"537\":\"ca\"}[chunkId] + \"-chunk-\" + {\"371\":\"29e7d5d554e9717b654d\",\"537\":\"7f46a9303f533c62a4a1\"}[chunkId] + \".js\";\n};","// This function allow to reference async chunks\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \"-\" + \"e65dfe501277211c266e\" + \".css\";\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.p = \"https://static.nrk.no/dh/module/tilpasset-bilde/static/\";","if (typeof document === \"undefined\") return;\nvar createStylesheet = (chunkId, fullhref, oldTag, resolve, reject) => {\n\tvar linkTag = document.createElement(\"link\");\n\n\tlinkTag.rel = \"stylesheet\";\n\tlinkTag.type = \"text/css\";\n\tvar onLinkComplete = (event) => {\n\t\t// avoid mem leaks.\n\t\tlinkTag.onerror = linkTag.onload = null;\n\t\tif (event.type === 'load') {\n\t\t\tresolve();\n\t\t} else {\n\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\tvar realHref = event && event.target && event.target.href || fullhref;\n\t\t\tvar err = new Error(\"Loading CSS chunk \" + chunkId + \" failed.\\n(\" + realHref + \")\");\n\t\t\terr.code = \"CSS_CHUNK_LOAD_FAILED\";\n\t\t\terr.type = errorType;\n\t\t\terr.request = realHref;\n\t\t\tif (linkTag.parentNode) linkTag.parentNode.removeChild(linkTag)\n\t\t\treject(err);\n\t\t}\n\t}\n\tlinkTag.onerror = linkTag.onload = onLinkComplete;\n\tlinkTag.href = fullhref;\n\n\tif (oldTag) {\n\t\toldTag.parentNode.insertBefore(linkTag, oldTag.nextSibling);\n\t} else {\n\t\tdocument.head.appendChild(linkTag);\n\t}\n\treturn linkTag;\n};\nvar findStylesheet = (href, fullhref) => {\n\tvar existingLinkTags = document.getElementsByTagName(\"link\");\n\tfor(var i = 0; i < existingLinkTags.length; i++) {\n\t\tvar tag = existingLinkTags[i];\n\t\tvar dataHref = tag.getAttribute(\"data-href\") || tag.getAttribute(\"href\");\n\t\tif(tag.rel === \"stylesheet\" && (dataHref === href || dataHref === fullhref)) return tag;\n\t}\n\tvar existingStyleTags = document.getElementsByTagName(\"style\");\n\tfor(var i = 0; i < existingStyleTags.length; i++) {\n\t\tvar tag = existingStyleTags[i];\n\t\tvar dataHref = tag.getAttribute(\"data-href\");\n\t\tif(dataHref === href || dataHref === fullhref) return tag;\n\t}\n};\nvar loadStylesheet = (chunkId) => {\n\treturn new Promise((resolve, reject) => {\n\t\tvar href = __webpack_require__.miniCssF(chunkId);\n\t\tvar fullhref = __webpack_require__.p + href;\n\t\tif(findStylesheet(href, fullhref)) return resolve();\n\t\tcreateStylesheet(chunkId, fullhref, null, resolve, reject);\n\t});\n}\n// object to store loaded CSS chunks\nvar installedCssChunks = {\n\t179: 0\n};\n\n__webpack_require__.f.miniCss = (chunkId, promises) => {\n\tvar cssChunks = {\"371\":1};\n\tif(installedCssChunks[chunkId]) promises.push(installedCssChunks[chunkId]);\n\telse if(installedCssChunks[chunkId] !== 0 && cssChunks[chunkId]) {\n\t\tpromises.push(installedCssChunks[chunkId] = loadStylesheet(chunkId).then(() => {\n\t\t\tinstalledCssChunks[chunkId] = 0;\n\t\t}, (e) => {\n\t\t\tdelete installedCssChunks[chunkId];\n\t\t\tthrow e;\n\t\t}));\n\t}\n};\n\n// no hmr","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 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(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\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\n _defineProperty(this, \"elements\", void 0);\n\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\n disconnect() {\n // Unregister trigger elements\n this.elements.forEach(elm => this.intersectionObserver.unobserve(elm)); // Disconnect intersection observer\n\n this.intersectionObserver.disconnect();\n }\n\n}\n\nfunction toggleAttribute(el, name, boolValue) {\n if (!el) {\n return;\n }\n\n var nextValue;\n\n if (typeof boolValue !== 'undefined') {\n nextValue = !!boolValue;\n } else {\n nextValue = el.hasAttribute(name);\n }\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\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\n if (proto.closest) {\n return (el, css) => el.closest(css);\n } else {\n return (el, css) => {\n for (; el; el = el.parentElement) {\n if (match.call(el, css)) return el;\n }\n\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; // 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 } // IE reports incorrect event.defaultPrevented\n // but correct return value on element.dispatchEvent\n\n\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}\n\nclass VerticalScroll {\n constructor(container) {\n _defineProperty(this, \"container\", void 0);\n\n this.container = container;\n }\n\n cancel() {\n this._cancelled = true;\n }\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\n var loop = currentTime => {\n if (this._cancelled) {\n return;\n }\n\n if (!startTime) {\n startTime = currentTime - 1;\n }\n\n var timeElapsed = currentTime - startTime;\n\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 window.requestAnimationFrame(loop);\n }\n\n}\nclass HorizontalScroll {\n constructor(container) {\n _defineProperty(this, \"container\", void 0);\n\n this.container = container;\n }\n\n cancel() {\n this._cancelled = true;\n }\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\n var loop = currentTime => {\n if (this._cancelled) {\n return;\n }\n\n if (!startTime) {\n startTime = currentTime - 1;\n }\n\n var timeElapsed = currentTime - startTime;\n\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 window.requestAnimationFrame(loop);\n }\n\n}\n\nfunction testReducedMotion() {\n if (typeof window !== 'undefined') {\n return !!window.matchMedia && window.matchMedia('(prefers-reduced-motion)').matches;\n }\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}\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 * */\n\nfunction loadImage(image) {\n if (image.loading === 'lazy') {\n image.loading = 'eager';\n }\n}\n\nfunction connectScrollContainerLazyLoad(container, images) {\n var containerIntersecting = false;\n var deferredImages = []; // eslint-disable-next-line compat/compat\n\n var containerObserver = new IntersectionObserver(entries => {\n containerIntersecting = entries === null || entries === void 0 ? void 0 : entries[0].isIntersecting;\n\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); // eslint-disable-next-line compat/compat\n\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\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\n for (var image of images) {\n imageObserver.observe(image);\n }\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\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=dh-basis-common.esm.js.map\n","import { toArray } from '@nrk/dh-utils'\nimport { closest } from '@nrk/dh-basis-common'\n\nexport default class TilpassetBilde extends HTMLElement {\n connectedCallback() {\n if (this._isFullWidth() || this._isFeatureCover() || this._isDhFullWidth()) {\n const sources = toArray(this.querySelectorAll('source'))\n sources.forEach((source) => {\n source.setAttribute('sizes', '100vw')\n })\n }\n }\n\n _isFullWidth() {\n const remoterendered = closest(\n this,\n '.remoterenderedcontent-reference,.inlinesanitycontent-reference'\n )\n return remoterendered && remoterendered.classList.contains('fc')\n }\n\n _isFeatureCover() {\n const cover = closest(this, '.article-feature__cover')\n return !!cover\n }\n\n _isDhFullWidth() {\n return !!closest(this, '.dh-fullbredde')\n }\n}\n","export function toArray(nodeList) {\n return [].slice.call(nodeList);\n}","// extracted by mini-css-extract-plugin\nexport default {\"root\":\"dh-tilpasset-bilde-root--tuh_u\"};","import { BaseElement } from '@nrk/dh-server-libs/base-element'\nimport { getElementTag } from '@nrk/dh-server-libs/get-element-tag'\nimport TilpassetBilde from './components/tilpasset-bilde'\n\nimport './client.module.css'\nimport './components/tilpasset-bilde.module.css'\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\nexport class AppElement extends BaseElement {\n name = tag\n\n connectedCallback() {\n super.connectedCallback()\n\n if (this.features.sanityIframePreview) {\n import('./components/preview/preview-iframe-api' /* webpackChunkName: \"dh-preview-iframe\" */)\n }\n }\n\n render() {\n safeDefine('dh-tilpasset-bilde', TilpassetBilde)\n }\n\n get features() {\n return JSON.parse(this.getAttribute('features'))\n }\n}\n\nsafeDefine(tag, AppElement)\n"],"names":["leafPrototypes","getProto","installedChunks","installChunk","module","exports","getContextId","_coreAnalyticsPromise","BaseElement","HTMLElement","constructor","super","this","sendError","bind","sendGaEvent","connectedCallback","name","Error","setupTracker","render","coreAnalyticsTracker","Promise","resolve","window","then","m","default","coreAnalytics","tracker","create","container","parentId","metadata","location","href","ga","dataset","gaPropertyId","title","contentId","selfId","publishDate","published","async","message","event","eventCategory","JSON","parse","preloadedState","errorTracking","url","enabled","POLOPOLY_ID_REGEX","str","matches","match","length","extractPolopolyIdFromString","getElementTag","version","split","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","call","Object","getPrototypeOf","obj","t","value","mode","__esModule","ns","r","def","current","indexOf","getOwnPropertyNames","forEach","key","d","definition","o","defineProperty","enumerable","get","f","e","chunkId","all","keys","reduce","promises","u","miniCssF","prop","prototype","hasOwnProperty","Symbol","toStringTag","p","document","loadStylesheet","reject","fullhref","existingLinkTags","getElementsByTagName","i","dataHref","tag","getAttribute","rel","existingStyleTags","findStylesheet","oldTag","linkTag","createElement","type","onerror","onload","errorType","realHref","target","err","code","request","parentNode","removeChild","insertBefore","nextSibling","head","appendChild","createStylesheet","installedCssChunks","miniCss","push","data","ids","modules","runtime","j","installedChunkData","promise","import","race","proto","closest","Element","msMatchesSelector","webkitMatchesSelector","el","css","parentElement","TilpassetBilde","_isFullWidth","_isFeatureCover","_isDhFullWidth","nodeList","querySelectorAll","slice","source","setAttribute","remoterendered","classList","contains","__APP_NAME__","__APP_VERSION__","safeDefine","elementName","customElements","define","AppElement","args","features","sanityIframePreview"],"sourceRoot":""}