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AUT,yBAAyB,CACrCuC,OAAQC,EAAYC,cACpBC,KAAM,CACJC,KAAMC,EAAkBG,QAE1B,GAEJ,CAAEC,UAAW,CAAC,GAAIC,WAAY,yBAGhCvB,EAAAC,KAAIhB,GAAAA,GAAgB2B,QAAQX,KAC9B,CAAC,SAAAN,IAEqB,IAAA6B,EAAAC,EAChB,OAAJD,EAAAxB,EAAAC,KAAIhB,GAAAA,KAAJuC,EAAqBb,aACjB,OAAJc,EAAAzB,EAAAC,KAAIf,GAAAA,KAAJuC,EAAoBd,YACtB,CAGGe,eAAeC,IAAI/C,IACtB8C,eAAeE,OAAOhD,EAAKU,E","sources":["webpack://hei-boksen/./node_modules/cuid/index.js","webpack://hei-boksen/./node_modules/cuid/lib/fingerprint.browser.js","webpack://hei-boksen/./node_modules/cuid/lib/getRandomValue.browser.js","webpack://hei-boksen/./node_modules/cuid/lib/pad.js","webpack://hei-boksen/./node_modules/@nrk/dh-server-libs/get-element-tag.js","webpack://hei-boksen/./node_modules/@nrk/dh-server-libs/src/get-element-tag.js","webpack://hei-boksen/webpack/bootstrap","webpack://hei-boksen/./node_modules/@nrk/nrkno-snowplow/node_modules/@nrk/snowplow-web/index.js","webpack://hei-boksen/./node_modules/@nrk/nrkno-snowplow/build-npm/nrkno-snowplow.package.mjs","webpack://hei-boksen/./node_modules/@nrk/snowplow-web/index.js","webpack://hei-boksen/./node_modules/@nrk/dh-snowplow/dist/index.mjs","webpack://hei-boksen/./node_modules/@nrk/dh-snowplow/dist/shared/dh-snowplow.1ee613bf.mjs","webpack://hei-boksen/./src/client.ts"],"sourcesContent":["/**\n * cuid.js\n * Collision-resistant UID generator for browsers and node.\n * Sequential for fast db lookups and recency sorting.\n * Safe for element IDs and server-side lookups.\n *\n * Extracted from CLCTR\n *\n * Copyright (c) Eric Elliott 2012\n * MIT License\n */\n\nvar fingerprint = require('./lib/fingerprint.js');\nvar pad = require('./lib/pad.js');\nvar getRandomValue = require('./lib/getRandomValue.js');\n\nvar c = 0,\n blockSize = 4,\n base = 36,\n discreteValues = Math.pow(base, blockSize);\n\nfunction randomBlock () {\n return pad((getRandomValue() *\n discreteValues << 0)\n .toString(base), blockSize);\n}\n\nfunction safeCounter () {\n c = c < discreteValues ? c : 0;\n c++; // this is not subliminal\n return c - 1;\n}\n\nfunction cuid () {\n // Starting with a lowercase letter makes\n // it HTML element ID friendly.\n var letter = 'c', // hard-coded allows for sequential access\n\n // timestamp\n // warning: this exposes the exact date and time\n // that the uid was created.\n timestamp = (new Date().getTime()).toString(base),\n\n // Prevent same-machine collisions.\n counter = pad(safeCounter().toString(base), blockSize),\n\n // A few chars to generate distinct ids for different\n // clients (so different computers are far less\n // likely to generate the same id)\n print = fingerprint(),\n\n // Grab some more chars from Math.random()\n random = randomBlock() + randomBlock();\n\n return letter + timestamp + counter + print + random;\n}\n\ncuid.slug = function slug () {\n var date = new Date().getTime().toString(36),\n counter = safeCounter().toString(36).slice(-4),\n print = fingerprint().slice(0, 1) +\n fingerprint().slice(-1),\n random = randomBlock().slice(-2);\n\n return date.slice(-2) +\n counter + print + random;\n};\n\ncuid.isCuid = function isCuid (stringToCheck) {\n if (typeof stringToCheck !== 'string') return false;\n if (stringToCheck.startsWith('c')) return true;\n return false;\n};\n\ncuid.isSlug = function isSlug (stringToCheck) {\n if (typeof stringToCheck !== 'string') return false;\n var stringLength = stringToCheck.length;\n if (stringLength >= 7 && stringLength <= 10) return true;\n return false;\n};\n\ncuid.fingerprint = fingerprint;\n\nmodule.exports = cuid;\n","var pad = require('./pad.js');\n\nvar env = typeof window === 'object' ? window : self;\nvar globalCount = Object.keys(env).length;\nvar mimeTypesLength = navigator.mimeTypes ? navigator.mimeTypes.length : 0;\nvar clientId = pad((mimeTypesLength +\n navigator.userAgent.length).toString(36) +\n globalCount.toString(36), 4);\n\nmodule.exports = function fingerprint () {\n return clientId;\n};\n","\nvar getRandomValue;\n\nvar crypto = typeof window !== 'undefined' &&\n (window.crypto || window.msCrypto) ||\n typeof self !== 'undefined' &&\n self.crypto;\n\nif (crypto) {\n var lim = Math.pow(2, 32) - 1;\n getRandomValue = function () {\n return Math.abs(crypto.getRandomValues(new Uint32Array(1))[0] / lim);\n };\n} else {\n getRandomValue = Math.random;\n}\n\nmodule.exports = getRandomValue;\n","module.exports = function pad (num, size) {\n var s = '000000000' + num;\n return s.substr(s.length - size);\n};\n","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","var __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\n\n// src/nrk-types.ts\nvar ClickEventKind = /* @__PURE__ */ ((ClickEventKind2) => {\n ClickEventKind2[\"Content\"] = \"content\";\n ClickEventKind2[\"Other\"] = \"other\";\n return ClickEventKind2;\n})(ClickEventKind || {});\nvar ImpressionEventKind = /* @__PURE__ */ ((ImpressionEventKind2) => {\n ImpressionEventKind2[\"Impression\"] = \"impression\";\n return ImpressionEventKind2;\n})(ImpressionEventKind || {});\nvar PlaybackEventKind = /* @__PURE__ */ ((PlaybackEventKind2) => {\n PlaybackEventKind2[\"Complete\"] = \"complete\";\n PlaybackEventKind2[\"Exit\"] = \"exit\";\n PlaybackEventKind2[\"Progress\"] = \"progress\";\n PlaybackEventKind2[\"Start\"] = \"start\";\n return PlaybackEventKind2;\n})(PlaybackEventKind || {});\nvar SearchSource = /* @__PURE__ */ ((SearchSource2) => {\n SearchSource2[\"PopularSearch\"] = \"popular-search\";\n SearchSource2[\"PreviousResult\"] = \"previous-result\";\n SearchSource2[\"Search\"] = \"search\";\n return SearchSource2;\n})(SearchSource || {});\nvar ViewportEventKind = /* @__PURE__ */ ((ViewportEventKind2) => {\n ViewportEventKind2[\"Entry\"] = \"entry\";\n ViewportEventKind2[\"Exit\"] = \"exit\";\n return ViewportEventKind2;\n})(ViewportEventKind || {});\nvar EventSchema = /* @__PURE__ */ ((EventSchema3) => {\n EventSchema3[\"BackstageEvent\"] = \"iglu:no.nrk.innlogging/backstage-event/jsonschema/1-0-0\";\n EventSchema3[\"ClickEvent\"] = \"iglu:no.nrk/click-event/jsonschema/1-0-0\";\n EventSchema3[\"FrontstageServerEvent\"] = \"iglu:no.nrk.innlogging/frontstage-server-event/jsonschema/1-0-0\";\n EventSchema3[\"ImpressionEvent\"] = \"iglu:no.nrk/impression-event/jsonschema/1-0-0\";\n EventSchema3[\"LoginRegisterFlowEvent\"] = \"iglu:no.nrk.innlogging/login-register-flow-event/jsonschema/1-0-0\";\n EventSchema3[\"PlaybackEvent\"] = \"iglu:no.nrk/playback-event/jsonschema/1-0-0\";\n EventSchema3[\"ProfilePageEvent\"] = \"iglu:no.nrk.innlogging/profile-page-event/jsonschema/1-0-0\";\n EventSchema3[\"RadioEvent\"] = \"iglu:no.nrk.radio/radio-event/jsonschema/1-0-0\";\n EventSchema3[\"SearchEvent\"] = \"iglu:no.nrk/search-event/jsonschema/1-0-0\";\n EventSchema3[\"StepEvent\"] = \"iglu:no.nrk.dh/step-event/jsonschema/1-0-0\";\n EventSchema3[\"TimeSpentEvent\"] = \"iglu:no.nrk/time-spent-event/jsonschema/1-0-0\";\n EventSchema3[\"ViewportEvent\"] = \"iglu:no.nrk.dh/viewport-event/jsonschema/1-0-0\";\n return EventSchema3;\n})(EventSchema || {});\nvar EntitySchema = /* @__PURE__ */ ((EntitySchema2) => {\n EntitySchema2[\"ClientID\"] = \"iglu:no.nrk.innlogging/client-id/jsonschema/1-0-0\";\n EntitySchema2[\"Content\"] = \"iglu:no.nrk/content/jsonschema/1-0-1\";\n EntitySchema2[\"Experiment\"] = \"iglu:no.nrk/experiment/jsonschema/1-0-0\";\n EntitySchema2[\"Link\"] = \"iglu:no.nrk/link/jsonschema/2-0-0\";\n EntitySchema2[\"NrkSession\"] = \"iglu:no.nrk/nrk-session/jsonschema/1-0-0\";\n EntitySchema2[\"NrkUser\"] = \"iglu:no.nrk/nrk-user/jsonschema/1-0-0\";\n EntitySchema2[\"Plug\"] = \"iglu:no.nrk/plug/jsonschema/3-0-0\";\n EntitySchema2[\"PreviousWebPage\"] = \"iglu:no.nrk/previous-web-page/jsonschema/1-0-0\";\n EntitySchema2[\"RegistrationContext\"] = \"iglu:no.nrk.innlogging/registration-context/jsonschema/1-0-0\";\n EntitySchema2[\"SearchResult\"] = \"iglu:no.nrk/search-result/jsonschema/1-0-1\";\n EntitySchema2[\"Service\"] = \"iglu:no.nrk/service/jsonschema/2-0-0\";\n EntitySchema2[\"Application\"] = \"iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0\";\n return EntitySchema2;\n})(EntitySchema || {});\n\n// src/nrk-base-tracker.ts\nimport cuid from \"cuid\";\nvar NrkBaseTracker = class {\n constructor(snowplow, config) {\n this.sharedEntities = {};\n var _a, _b, _c;\n this.snowplow = snowplow;\n this.trackerId = (_a = config.trackerId) != null ? _a : cuid.slug();\n this.setSharedEntity(\"iglu:no.nrk/service/jsonschema/2-0-0\" /* Service */, { id: config.serviceId, environment: (_b = config.environment) != null ? _b : null });\n if (config.appVersion && config.appBuild) {\n this.setSharedEntity(\"iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0\" /* Application */, { build: config.appBuild, version: config.appVersion });\n }\n snowplow.newTracker(this.trackerId, config.collectorUrl, {\n postPath: \"/nrk/wd6\",\n appId: config.appId,\n plugins: config.plugins,\n platform: (_c = config.platform) != null ? _c : \"web\",\n contexts: {\n webPage: config.disableWebContext !== true\n },\n stateStorageStrategy: config.disableLocalStorage ? \"cookie\" : void 0\n });\n }\n /**\n * Track page view.\n */\n trackPageView(contentEntity) {\n if (contentEntity) {\n this.snowplow.trackPageView(\n {\n context: entitiesToContexts(__spreadProps(__spreadValues({}, this.sharedEntities), {\n [\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */]: contentEntity\n }))\n },\n [this.trackerId]\n );\n } else {\n this.snowplow.trackPageView({ context: entitiesToContexts(this.sharedEntities) }, [this.trackerId]);\n }\n }\n /**\n * Generic track event for custom schemas, typed up to only support NRK\n * events and entities. All shared entities are included, and can be\n * overridden by specified entities.\n */\n trackSchemaEvent(schema, data, entities) {\n const context = entitiesToContexts(__spreadValues(__spreadValues({}, this.sharedEntities), entities));\n this.snowplow.trackSelfDescribingEvent(\n {\n event: { schema, data: __spreadValues({}, data) },\n context\n },\n [this.trackerId]\n );\n }\n /**\n * Send a standard structured event.\n */\n trackEvent(data, entities) {\n const context = entitiesToContexts(__spreadValues(__spreadValues({}, this.sharedEntities), entities));\n this.snowplow.trackStructEvent(__spreadProps(__spreadValues({}, data), { context }), [this.trackerId]);\n }\n /**\n * Set the logged in user.\n */\n setUser(userId) {\n this.snowplow.setUserId(userId, [this.trackerId]);\n this.setSharedEntity(\"iglu:no.nrk/nrk-user/jsonschema/1-0-0\" /* NrkUser */, { id: userId });\n }\n /**\n * Clear the user when logged out.\n */\n clearUser() {\n this.snowplow.setUserId(null, [this.trackerId]);\n this.removeSharedEntity(\"iglu:no.nrk/nrk-user/jsonschema/1-0-0\" /* NrkUser */);\n }\n /**\n * Add a plugin to the tracker.\n */\n addPlugin(configuration) {\n this.snowplow.addPlugin(configuration, [this.trackerId]);\n }\n /**\n * Set data for a shared entity for all events of this tracker.\n *\n * The `snowplow.addGlobalContexts()` method could potentially be used, but\n * `removeGlobalContexts()` requires the data as argument as well (awkward),\n * and there's no `getGlobalContexts()` to help with that.\n */\n setSharedEntity(schema, data) {\n this.sharedEntities[schema] = data;\n }\n /**\n * Returns any shared entities for an entity schema.\n */\n getSharedEntity(schema) {\n return this.sharedEntities[schema];\n }\n /**\n * Remove all shared entities for an entity schema.\n */\n removeSharedEntity(schema) {\n if (schema in this.sharedEntities) {\n delete this.sharedEntities[schema];\n }\n }\n};\nfunction entitiesToContexts(entities) {\n const contexts = [];\n Object.entries(entities).forEach(([schema, data]) => {\n const dataList = Array.isArray(data) ? data : [data];\n for (const entityData of dataList) {\n contexts.push({ schema, data: __spreadValues({}, entityData) });\n }\n });\n return contexts;\n}\n\n// src/nrk-player-tracker.ts\nvar NrkPlayerTracker = class extends NrkBaseTracker {\n /**\n * Tell the tracker what the current media is.\n */\n setMedia(mediaId, details) {\n const content = { id: mediaId };\n if (details == null ? void 0 : details.source) {\n content.source = details == null ? void 0 : details.source;\n }\n if (details == null ? void 0 : details.kind) {\n content.kind = details == null ? void 0 : details.kind;\n }\n this.setSharedEntity(\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */, content);\n if (details == null ? void 0 : details.channelId) {\n this.channelId = details.channelId;\n }\n if (details && \"autoplay\" in details && details.autoplay !== void 0) {\n this.autoplay = details.autoplay;\n }\n }\n /**\n * Set autoplay for the current media.\n */\n setMediaAutoplay(autoplay) {\n this.autoplay = autoplay;\n }\n /**\n * Tell the tracker that media is unknown (like for gaps in the EPG).\n */\n setUnknownMedia(channelId) {\n this.setSharedEntity(\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */, { id: \"unknown\", kind: \"unknown\" });\n this.channelId = channelId;\n }\n /**\n * Send a playback event of kind 'start'.\n *\n * Should be called when time starts running:\n * - After changing media.\n * - After user pauses playback.\n * - At replay.\n */\n sendStartEvent(startTime, live) {\n if (this.getSharedEntity(\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */) === void 0) {\n throw new Error(\"Must use setMedia() first!\");\n }\n const start = Math.max(0, Math.floor(startTime));\n this.trackSchemaEvent(\"iglu:no.nrk/playback-event/jsonschema/1-0-0\" /* PlaybackEvent */, {\n kind: \"start\" /* Start */,\n startTime: start,\n endTime: start,\n autoplay: this.autoplay,\n live,\n channelId: this.channelId\n });\n }\n /**\n * Send a playback event of kind 'progress'.\n *\n * Should be called when time stops for any reason other than complete or\n * exit.\n */\n sendProgressEvent(startTime, endTime, live) {\n this.sendPlaybackEvent(\"progress\" /* Progress */, startTime, endTime, live);\n }\n /**\n * Send a playback event of kind 'complete'.\n *\n * Should be called when:\n * - Playback reaches the end (100%) of the media (for ODM it stops, for\n * channels it continues to play the next program in the EPG).\n * - When a skip-to-next media function is invoked when binging.\n */\n sendCompleteEvent(startTime, endTime, live) {\n this.sendPlaybackEvent(\"complete\" /* Complete */, startTime, endTime != null ? endTime : startTime, live);\n }\n /**\n * Send a playback event of kind 'exit'.\n *\n * Should be called when leaving the media before a 'complete'-event is sent,\n * including when seeking away from a program in the EPG to another.\n */\n sendExitEvent(startTime, endTime, live) {\n this.sendPlaybackEvent(\"exit\" /* Exit */, startTime, endTime != null ? endTime : startTime, live);\n }\n sendPlaybackEvent(kind, startTime, endTime, live) {\n const start = Math.max(0, Math.floor(startTime));\n const end = Math.max(0, Math.floor(endTime));\n if (start === end && kind === \"progress\" /* Progress */) {\n return;\n }\n if (start > end) {\n throw new Error(`Start time can't be after end time (${start} vs ${end}). Event was ${kind}`);\n }\n this.trackSchemaEvent(\"iglu:no.nrk/playback-event/jsonschema/1-0-0\" /* PlaybackEvent */, {\n kind,\n startTime: start,\n endTime: end,\n live,\n channelId: this.channelId\n });\n }\n};\n\n// src/service-id.ts\nvar ServiceID = /* @__PURE__ */ ((ServiceID2) => {\n ServiceID2[\"Embed\"] = \"embed\";\n ServiceID2[\"Nrkbeta\"] = \"nrkbeta\";\n ServiceID2[\"Nrkinnlogging\"] = \"nrkinnlogging\";\n ServiceID2[\"Nrkno\"] = \"nrkno\";\n ServiceID2[\"Nrkp3\"] = \"nrkp3\";\n ServiceID2[\"Nrkradio\"] = \"nrkradio\";\n ServiceID2[\"Nrksuper\"] = \"nrksuper\";\n ServiceID2[\"Nrktv\"] = \"nrktv\";\n ServiceID2[\"Yr\"] = \"yr\";\n return ServiceID2;\n})(ServiceID || {});\n\n// src/snowplow-global.ts\nvar SnowplowGlobal = class {\n constructor() {\n this.snowplow = window.snowplow;\n if (this.snowplow === void 0) {\n throw new Error(\"There is no global Snowplow function.\");\n }\n }\n /**\n * Check if the global API is available (provided by the \"Snowplow tag\"). No\n * distinction is made between sp.js and sp.lite.js.\n */\n static isAvailable() {\n return window.snowplow !== void 0;\n }\n /**\n * Modify newTracker() to support adding plugins via the tracker\n * configuration. See \"Creating your own plugins\" in the JavaScript tracker\n * Snowplow docs.\n *\n * Note: The tracker configuration hasn't been thoroughly checked for\n * inconsistencies between the global API and @snowplow/browser-tracker.\n * There might be issues.\n */\n newTracker(trackerId, collectorUrl, configuration) {\n this.snowplow(\"newTracker\", trackerId, collectorUrl, configuration);\n if ((configuration == null ? void 0 : configuration.plugins) !== void 0) {\n configuration.plugins.forEach((plugin) => {\n this.addPlugin({ plugin }, [trackerId]);\n });\n }\n }\n setUserId(...args) {\n this.proxy(\"setUserId\", args, 2);\n }\n trackPageView(...args) {\n this.proxy(\"trackPageView\", args, 2);\n }\n trackSelfDescribingEvent(...args) {\n this.proxy(\"trackSelfDescribingEvent\", args, 2);\n }\n trackStructEvent(...args) {\n this.proxy(\"trackStructEvent\", args, 2);\n }\n preservePageViewId(...args) {\n this.proxy(\"preservePageViewId\", args, 1);\n }\n addPlugin(config, trackers) {\n const args = [{ Plugin: () => config.plugin }, \"Plugin\", trackers];\n this.proxy(\"addPlugin\", args, args.length);\n }\n /**\n * Make a call to the global Snowplow API, with the specified method and\n * arguments. It only supports methods which have a `trackers` argument as\n * the last (optional) argument.\n *\n * The `trackers` argument of the Snowplow methods is optional and not always\n * in the same position. The `maxArgs` argument specifies the maximum number\n * of arguments the method supports and so in which position the `trackers`\n * argument is, when present. This is necessary in order to transform the use\n * of `trackers` between the Snowplow API and the global API. So if\n * `Args['length']` is `1 | 2`, then `maxArgs` should be 2.\n */\n proxy(method, args, maxArgs) {\n const trackerIds = args.length === maxArgs ? args.pop() : void 0;\n if (trackerIds && trackerIds.length > 0) {\n trackerIds.forEach((trackerId) => {\n this.snowplow(`${method}:${trackerId}`, ...args);\n });\n } else {\n this.snowplow(method, ...args);\n }\n }\n};\nexport {\n ClickEventKind,\n EntitySchema,\n EventSchema,\n ImpressionEventKind,\n NrkBaseTracker,\n NrkPlayerTracker,\n PlaybackEventKind,\n SearchSource,\n ServiceID,\n SnowplowGlobal,\n ViewportEventKind,\n entitiesToContexts\n};\n","import { EntitySchema, EventSchema } from '@nrk/snowplow-web';\n\n/**\n * Root path to snowplow bundle on static.nrk.no.\n */\nvar staticSnowplowRoot = \"https://static.nrk.no/nrkno-snowplow\";\n/**\n * The current major version\n */\nvar staticSnowplowMajorVersion = \"1\";\n\n//@ts-expect-error post-fix version to allow multiple versions to co-exists at the same time\nvar globalKey = \"nrknoOnTrackerReady-\" + staticSnowplowMajorVersion;\n\n/**\n * Modified version of @nrk/snowplow-web. Does not allow array or undefined\n */\n\n/**\n * Typecheck and generate `{schema, data}`\n */\nfunction getTyped(schema, data) {\n return {\n schema,\n data\n };\n}\n\n/**\n * No-op type check\n */\nfunction isTypedContext(_schema, _data) {}\n/**\n * No-op type check\n */\nfunction isTypedEvent(_schema, _data) {}\n/**\n * No-op type check\n */\nfunction isTyped(_schema, _data) {}\n\n/**\n * No-op type check\n */\nfunction isTypedArray(_schema, _data) {}\n\n/**\n * Typechecks a context and return the Snowplow type\n */\nfunction asSnowplowContext(data) {\n return data;\n}\nfunction asSnowplowEntity(data) {\n return data;\n}\n\nvar typeUtil = /*#__PURE__*/Object.freeze({\n __proto__: null,\n EntitySchema: EntitySchema,\n EventSchema: EventSchema,\n asSnowplowContext: asSnowplowContext,\n asSnowplowEntity: asSnowplowEntity,\n getTyped: getTyped,\n isTyped: isTyped,\n isTypedArray: isTypedArray,\n isTypedContext: isTypedContext,\n isTypedEvent: isTypedEvent\n});\n\n/// \n/**\n * Takes a callback that will be called with the bundled JS when ready.\n *\n * This function will load the major version (defined above in JS file) from `static.nrk.no`\n * @note the callback will never be called if a network error occurs.\n */\nfunction getBundle(callback) {\n // Add callback queue placeholder if needed\n if (globalThis[globalKey] === undefined) {\n //@ts-expect-error `q` is next line\n globalThis[globalKey] = function (cb) {\n globalThis[globalKey].q.push(cb);\n };\n globalThis[globalKey].q = [];\n }\n {\n // load script if needed\n loadOnce(staticSnowplowRoot + \"/major/\" + staticSnowplowMajorVersion + \"/nrkno-snowplow-entry.js\");\n }\n\n // add callback\n globalThis[globalKey](callback);\n}\n/**\n * loadOnce loads the given script IFF it is not already present in the DOM.\n * @param {string} src URL for script\n * @returns {undefined}\n */\nfunction loadOnce(src) {\n var hasScript = document.querySelector(\"script[src=\\\"\" + src + \"\\\"]\");\n if (hasScript) {\n return;\n }\n var script = document.createElement('script');\n script.async = true;\n script.src = src;\n document.head.appendChild(script);\n}\n\nexport { typeUtil as TypeUtils, getBundle };\n","var __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\n\n// src/nrk-types.ts\nvar ClickEventKind = /* @__PURE__ */ ((ClickEventKind2) => {\n ClickEventKind2[\"Content\"] = \"content\";\n ClickEventKind2[\"Other\"] = \"other\";\n return ClickEventKind2;\n})(ClickEventKind || {});\nvar ImpressionEventKind = /* @__PURE__ */ ((ImpressionEventKind2) => {\n ImpressionEventKind2[\"Impression\"] = \"impression\";\n return ImpressionEventKind2;\n})(ImpressionEventKind || {});\nvar PlaybackEventKind = /* @__PURE__ */ ((PlaybackEventKind2) => {\n PlaybackEventKind2[\"Complete\"] = \"complete\";\n PlaybackEventKind2[\"Exit\"] = \"exit\";\n PlaybackEventKind2[\"Progress\"] = \"progress\";\n PlaybackEventKind2[\"Start\"] = \"start\";\n return PlaybackEventKind2;\n})(PlaybackEventKind || {});\nvar SearchSource = /* @__PURE__ */ ((SearchSource2) => {\n SearchSource2[\"PopularSearch\"] = \"popular-search\";\n SearchSource2[\"PreviousResult\"] = \"previous-result\";\n SearchSource2[\"Search\"] = \"search\";\n return SearchSource2;\n})(SearchSource || {});\nvar ViewportEventKind = /* @__PURE__ */ ((ViewportEventKind2) => {\n ViewportEventKind2[\"Entry\"] = \"entry\";\n ViewportEventKind2[\"Exit\"] = \"exit\";\n return ViewportEventKind2;\n})(ViewportEventKind || {});\nvar EventSchema = /* @__PURE__ */ ((EventSchema3) => {\n EventSchema3[\"BackstageEvent\"] = \"iglu:no.nrk.innlogging/backstage-event/jsonschema/1-0-0\";\n EventSchema3[\"ClickEvent\"] = \"iglu:no.nrk/click-event/jsonschema/1-0-0\";\n EventSchema3[\"FrontstageServerEvent\"] = \"iglu:no.nrk.innlogging/frontstage-server-event/jsonschema/1-0-0\";\n EventSchema3[\"ImpressionEvent\"] = \"iglu:no.nrk/impression-event/jsonschema/1-0-0\";\n EventSchema3[\"LoginRegisterFlowEvent\"] = \"iglu:no.nrk.innlogging/login-register-flow-event/jsonschema/1-0-0\";\n EventSchema3[\"PlaybackEvent\"] = \"iglu:no.nrk/playback-event/jsonschema/1-0-0\";\n EventSchema3[\"ProfilePageEvent\"] = \"iglu:no.nrk.innlogging/profile-page-event/jsonschema/1-0-0\";\n EventSchema3[\"RadioEvent\"] = \"iglu:no.nrk.radio/radio-event/jsonschema/1-0-0\";\n EventSchema3[\"SearchEvent\"] = \"iglu:no.nrk/search-event/jsonschema/1-0-0\";\n EventSchema3[\"StepEvent\"] = \"iglu:no.nrk.dh/step-event/jsonschema/1-0-0\";\n EventSchema3[\"TimeSpentEvent\"] = \"iglu:no.nrk/time-spent-event/jsonschema/1-0-0\";\n EventSchema3[\"ViewportEvent\"] = \"iglu:no.nrk.dh/viewport-event/jsonschema/1-0-0\";\n return EventSchema3;\n})(EventSchema || {});\nvar EntitySchema = /* @__PURE__ */ ((EntitySchema2) => {\n EntitySchema2[\"ClientID\"] = \"iglu:no.nrk.innlogging/client-id/jsonschema/1-0-0\";\n EntitySchema2[\"Content\"] = \"iglu:no.nrk/content/jsonschema/1-0-1\";\n EntitySchema2[\"Experiment\"] = \"iglu:no.nrk/experiment/jsonschema/1-0-0\";\n EntitySchema2[\"Link\"] = \"iglu:no.nrk/link/jsonschema/2-0-0\";\n EntitySchema2[\"NrkSession\"] = \"iglu:no.nrk/nrk-session/jsonschema/1-0-0\";\n EntitySchema2[\"NrkUser\"] = \"iglu:no.nrk/nrk-user/jsonschema/1-0-0\";\n EntitySchema2[\"Plug\"] = \"iglu:no.nrk/plug/jsonschema/3-0-0\";\n EntitySchema2[\"PreviousWebPage\"] = \"iglu:no.nrk/previous-web-page/jsonschema/1-0-0\";\n EntitySchema2[\"RegistrationContext\"] = \"iglu:no.nrk.innlogging/registration-context/jsonschema/1-0-0\";\n EntitySchema2[\"SearchResult\"] = \"iglu:no.nrk/search-result/jsonschema/1-0-1\";\n EntitySchema2[\"Service\"] = \"iglu:no.nrk/service/jsonschema/2-0-0\";\n EntitySchema2[\"Application\"] = \"iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0\";\n return EntitySchema2;\n})(EntitySchema || {});\n\n// src/nrk-base-tracker.ts\nimport cuid from \"cuid\";\nvar NrkBaseTracker = class {\n constructor(snowplow, config) {\n this.sharedEntities = {};\n var _a, _b, _c;\n this.snowplow = snowplow;\n this.trackerId = (_a = config.trackerId) != null ? _a : cuid.slug();\n this.setSharedEntity(\"iglu:no.nrk/service/jsonschema/2-0-0\" /* Service */, { id: config.serviceId, environment: (_b = config.environment) != null ? _b : null });\n if (config.appVersion && config.appBuild) {\n this.setSharedEntity(\"iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0\" /* Application */, { build: config.appBuild, version: config.appVersion });\n }\n snowplow.newTracker(this.trackerId, config.collectorUrl, {\n postPath: \"/nrk/wd6\",\n appId: config.appId,\n plugins: config.plugins,\n platform: (_c = config.platform) != null ? _c : \"web\",\n contexts: {\n webPage: config.disableWebContext !== true\n },\n stateStorageStrategy: config.disableLocalStorage ? \"cookie\" : void 0\n });\n }\n /**\n * Track page view.\n */\n trackPageView(contentEntity) {\n if (contentEntity) {\n this.snowplow.trackPageView(\n {\n context: entitiesToContexts(__spreadProps(__spreadValues({}, this.sharedEntities), {\n [\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */]: contentEntity\n }))\n },\n [this.trackerId]\n );\n } else {\n this.snowplow.trackPageView({ context: entitiesToContexts(this.sharedEntities) }, [this.trackerId]);\n }\n }\n /**\n * Generic track event for custom schemas, typed up to only support NRK\n * events and entities. All shared entities are included, and can be\n * overridden by specified entities.\n */\n trackSchemaEvent(schema, data, entities) {\n const context = entitiesToContexts(__spreadValues(__spreadValues({}, this.sharedEntities), entities));\n this.snowplow.trackSelfDescribingEvent(\n {\n event: { schema, data: __spreadValues({}, data) },\n context\n },\n [this.trackerId]\n );\n }\n /**\n * Send a standard structured event.\n */\n trackEvent(data, entities) {\n const context = entitiesToContexts(__spreadValues(__spreadValues({}, this.sharedEntities), entities));\n this.snowplow.trackStructEvent(__spreadProps(__spreadValues({}, data), { context }), [this.trackerId]);\n }\n /**\n * Set the logged in user.\n */\n setUser(userId) {\n this.snowplow.setUserId(userId, [this.trackerId]);\n this.setSharedEntity(\"iglu:no.nrk/nrk-user/jsonschema/1-0-0\" /* NrkUser */, { id: userId });\n }\n /**\n * Clear the user when logged out.\n */\n clearUser() {\n this.snowplow.setUserId(null, [this.trackerId]);\n this.removeSharedEntity(\"iglu:no.nrk/nrk-user/jsonschema/1-0-0\" /* NrkUser */);\n }\n /**\n * Add a plugin to the tracker.\n */\n addPlugin(configuration) {\n this.snowplow.addPlugin(configuration, [this.trackerId]);\n }\n /**\n * Set data for a shared entity for all events of this tracker.\n *\n * The `snowplow.addGlobalContexts()` method could potentially be used, but\n * `removeGlobalContexts()` requires the data as argument as well (awkward),\n * and there's no `getGlobalContexts()` to help with that.\n */\n setSharedEntity(schema, data) {\n this.sharedEntities[schema] = data;\n }\n /**\n * Returns any shared entities for an entity schema.\n */\n getSharedEntity(schema) {\n return this.sharedEntities[schema];\n }\n /**\n * Remove all shared entities for an entity schema.\n */\n removeSharedEntity(schema) {\n if (schema in this.sharedEntities) {\n delete this.sharedEntities[schema];\n }\n }\n};\nfunction entitiesToContexts(entities) {\n const contexts = [];\n Object.entries(entities).forEach(([schema, data]) => {\n const dataList = Array.isArray(data) ? data : [data];\n for (const entityData of dataList) {\n contexts.push({ schema, data: __spreadValues({}, entityData) });\n }\n });\n return contexts;\n}\n\n// src/nrk-player-tracker.ts\nvar NrkPlayerTracker = class extends NrkBaseTracker {\n /**\n * Tell the tracker what the current media is.\n */\n setMedia(mediaId, details) {\n const content = { id: mediaId };\n if (details == null ? void 0 : details.source) {\n content.source = details == null ? void 0 : details.source;\n }\n if (details == null ? void 0 : details.kind) {\n content.kind = details == null ? void 0 : details.kind;\n }\n this.setSharedEntity(\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */, content);\n if (details == null ? void 0 : details.channelId) {\n this.channelId = details.channelId;\n }\n if (details && \"autoplay\" in details && details.autoplay !== void 0) {\n this.autoplay = details.autoplay;\n }\n }\n /**\n * Set autoplay for the current media.\n */\n setMediaAutoplay(autoplay) {\n this.autoplay = autoplay;\n }\n /**\n * Tell the tracker that media is unknown (like for gaps in the EPG).\n */\n setUnknownMedia(channelId) {\n this.setSharedEntity(\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */, { id: \"unknown\", kind: \"unknown\" });\n this.channelId = channelId;\n }\n /**\n * Send a playback event of kind 'start'.\n *\n * Should be called when time starts running:\n * - After changing media.\n * - After user pauses playback.\n * - At replay.\n */\n sendStartEvent(startTime, live) {\n if (this.getSharedEntity(\"iglu:no.nrk/content/jsonschema/1-0-1\" /* Content */) === void 0) {\n throw new Error(\"Must use setMedia() first!\");\n }\n const start = Math.max(0, Math.floor(startTime));\n this.trackSchemaEvent(\"iglu:no.nrk/playback-event/jsonschema/1-0-0\" /* PlaybackEvent */, {\n kind: \"start\" /* Start */,\n startTime: start,\n endTime: start,\n autoplay: this.autoplay,\n live,\n channelId: this.channelId\n });\n }\n /**\n * Send a playback event of kind 'progress'.\n *\n * Should be called when time stops for any reason other than complete or\n * exit.\n */\n sendProgressEvent(startTime, endTime, live) {\n this.sendPlaybackEvent(\"progress\" /* Progress */, startTime, endTime, live);\n }\n /**\n * Send a playback event of kind 'complete'.\n *\n * Should be called when:\n * - Playback reaches the end (100%) of the media (for ODM it stops, for\n * channels it continues to play the next program in the EPG).\n * - When a skip-to-next media function is invoked when binging.\n */\n sendCompleteEvent(startTime, endTime, live) {\n this.sendPlaybackEvent(\"complete\" /* Complete */, startTime, endTime != null ? endTime : startTime, live);\n }\n /**\n * Send a playback event of kind 'exit'.\n *\n * Should be called when leaving the media before a 'complete'-event is sent,\n * including when seeking away from a program in the EPG to another.\n */\n sendExitEvent(startTime, endTime, live) {\n this.sendPlaybackEvent(\"exit\" /* Exit */, startTime, endTime != null ? endTime : startTime, live);\n }\n sendPlaybackEvent(kind, startTime, endTime, live) {\n const start = Math.max(0, Math.floor(startTime));\n const end = Math.max(0, Math.floor(endTime));\n if (start === end && kind === \"progress\" /* Progress */) {\n return;\n }\n if (start > end) {\n throw new Error(`Start time can't be after end time (${start} vs ${end}). Event was ${kind}`);\n }\n this.trackSchemaEvent(\"iglu:no.nrk/playback-event/jsonschema/1-0-0\" /* PlaybackEvent */, {\n kind,\n startTime: start,\n endTime: end,\n live,\n channelId: this.channelId\n });\n }\n};\n\n// src/service-id.ts\nvar ServiceID = /* @__PURE__ */ ((ServiceID2) => {\n ServiceID2[\"Embed\"] = \"embed\";\n ServiceID2[\"Nrkbeta\"] = \"nrkbeta\";\n ServiceID2[\"Nrkinnlogging\"] = \"nrkinnlogging\";\n ServiceID2[\"Nrkno\"] = \"nrkno\";\n ServiceID2[\"Nrkp3\"] = \"nrkp3\";\n ServiceID2[\"Nrkradio\"] = \"nrkradio\";\n ServiceID2[\"Nrksuper\"] = \"nrksuper\";\n ServiceID2[\"Nrktv\"] = \"nrktv\";\n ServiceID2[\"Yr\"] = \"yr\";\n return ServiceID2;\n})(ServiceID || {});\n\n// src/snowplow-global.ts\nvar SnowplowGlobal = class {\n constructor() {\n this.snowplow = window.snowplow;\n if (this.snowplow === void 0) {\n throw new Error(\"There is no global Snowplow function.\");\n }\n }\n /**\n * Check if the global API is available (provided by the \"Snowplow tag\"). No\n * distinction is made between sp.js and sp.lite.js.\n */\n static isAvailable() {\n return window.snowplow !== void 0;\n }\n /**\n * Modify newTracker() to support adding plugins via the tracker\n * configuration. See \"Creating your own plugins\" in the JavaScript tracker\n * Snowplow docs.\n *\n * Note: The tracker configuration hasn't been thoroughly checked for\n * inconsistencies between the global API and @snowplow/browser-tracker.\n * There might be issues.\n */\n newTracker(trackerId, collectorUrl, configuration) {\n this.snowplow(\"newTracker\", trackerId, collectorUrl, configuration);\n if ((configuration == null ? void 0 : configuration.plugins) !== void 0) {\n configuration.plugins.forEach((plugin) => {\n this.addPlugin({ plugin }, [trackerId]);\n });\n }\n }\n setUserId(...args) {\n this.proxy(\"setUserId\", args, 2);\n }\n trackPageView(...args) {\n this.proxy(\"trackPageView\", args, 2);\n }\n trackSelfDescribingEvent(...args) {\n this.proxy(\"trackSelfDescribingEvent\", args, 2);\n }\n trackStructEvent(...args) {\n this.proxy(\"trackStructEvent\", args, 2);\n }\n preservePageViewId(...args) {\n this.proxy(\"preservePageViewId\", args, 1);\n }\n addPlugin(config, trackers) {\n const args = [{ Plugin: () => config.plugin }, \"Plugin\", trackers];\n this.proxy(\"addPlugin\", args, args.length);\n }\n /**\n * Make a call to the global Snowplow API, with the specified method and\n * arguments. It only supports methods which have a `trackers` argument as\n * the last (optional) argument.\n *\n * The `trackers` argument of the Snowplow methods is optional and not always\n * in the same position. The `maxArgs` argument specifies the maximum number\n * of arguments the method supports and so in which position the `trackers`\n * argument is, when present. This is necessary in order to transform the use\n * of `trackers` between the Snowplow API and the global API. So if\n * `Args['length']` is `1 | 2`, then `maxArgs` should be 2.\n */\n proxy(method, args, maxArgs) {\n const trackerIds = args.length === maxArgs ? args.pop() : void 0;\n if (trackerIds && trackerIds.length > 0) {\n trackerIds.forEach((trackerId) => {\n this.snowplow(`${method}:${trackerId}`, ...args);\n });\n } else {\n this.snowplow(method, ...args);\n }\n }\n};\nexport {\n ClickEventKind,\n EntitySchema,\n EventSchema,\n ImpressionEventKind,\n NrkBaseTracker,\n NrkPlayerTracker,\n PlaybackEventKind,\n SearchSource,\n ServiceID,\n SnowplowGlobal,\n ViewportEventKind,\n entitiesToContexts\n};\n","import { getBundle } from '@nrk/nrkno-snowplow';\nimport { EntitySchema } from '@nrk/snowplow-web';\nimport { g as getHost } from './shared/dh-snowplow.1ee613bf.mjs';\n\nconst APP_ID = \"no.nrk.dh\";\nfunction resolveOrTimeout(promise, wait) {\n return Promise.race([\n promise.then(() => true),\n new Promise((resolve) => {\n setTimeout(() => {\n resolve(false);\n }, wait);\n })\n ]);\n}\nfunction createTracker(trackerId, { environment, contentContext }) {\n let trackerReady = false;\n let bundle;\n const host = getHost(environment);\n const eventQueue = [];\n const contexts = [\"service\", \"user\"];\n const trackOrQueue = (callback) => {\n if (trackerReady) {\n callback(bundle);\n } else {\n eventQueue.push(callback);\n }\n };\n const trackStructuredEvent = (event) => trackOrQueue(({ NrknoUtils, Snowplow }) => {\n Snowplow.trackStructEvent(\n {\n ...event,\n context: NrknoUtils.context.collect(contexts)\n },\n [trackerId]\n );\n });\n const trackSelfDescribingEvent = (event) => trackOrQueue(\n ({ NrknoUtils, Snowplow }) => Snowplow.trackSelfDescribingEvent(\n {\n event,\n context: NrknoUtils.context.collect(contexts)\n },\n [trackerId]\n )\n );\n getBundle((nrknoBundle) => {\n bundle = nrknoBundle;\n const { NrknoUtils } = nrknoBundle;\n NrknoUtils.newTracker(trackerId, APP_ID, host);\n if (contentContext) {\n const contentContextId = `${trackerId}-${contentContext.id}`;\n contexts.push(contentContextId);\n NrknoUtils.context.set(contentContextId, EntitySchema.Content, {\n source: contentContext.source,\n id: contentContext.id\n });\n }\n resolveOrTimeout(NrknoUtils.trackers.whenReady(\"main-tracker\"), 1e3).then((isResolved) => {\n trackerReady = true;\n if (isResolved === false) {\n console.warn(\"nrkno tracker not available\");\n }\n while (eventQueue.length) {\n const fn = eventQueue.pop();\n fn(bundle);\n }\n return;\n }).catch(console.error);\n });\n return {\n trackSelfDescribingEvent,\n trackStructuredEvent\n };\n}\n\nexport { createTracker, getHost };\n","function getHost(environment = \"development\") {\n if (environment === \"production\") {\n return \"https://data.nrk.no\";\n }\n return \"https://no-nrk-prod1.mini.snplow.net\";\n}\n\nexport { getHost as g };\n","import { getElementTag } from '@nrk/dh-server-libs/get-element-tag'\nimport { Environment, createTracker } from '@nrk/dh-snowplow'\nimport { EventSchema, ViewportEventKind } from '@nrk/snowplow-web'\n\nimport './components/App.module.css'\n\nconst tag = getElementTag(__APP_NAME__, __APP_VERSION__)\n\nclass AppElement extends HTMLElement {\n name = tag\n #tracker\n #entryObserver\n #exitObserver\n\n connectedCallback() {\n this.#createTracker()\n this.#startViewportLogger()\n\n const emailLink = this.querySelector('a.nrk-button')\n emailLink.addEventListener('click', () => {\n // this.sendGaEvent({ eventAction: 'click', eventLabel: 'send-email' })\n })\n }\n\n disconnectedCallback() {\n this.#stopViewportLogger()\n }\n\n #createTracker() {\n if (process.env.DEV) {\n // @ts-ignore\n import('@nrk/dh-snowplow/mock').then(({ mock }) => mock()).catch(console.error)\n }\n\n this.#tracker = createTracker('dh-hei-boksen', {\n environment: process.env.ENVIRONMENT as Environment,\n contentContext: {\n source: 'pp',\n id: this.dataset.selfId,\n },\n })\n }\n\n #startViewportLogger() {\n this.#entryObserver = new IntersectionObserver((entries) => {\n if (!entries[0]?.isIntersecting) {\n return\n }\n this.#entryObserver.disconnect()\n this.#exitObserver.observe(this)\n this.#tracker.trackSelfDescribingEvent({\n schema: EventSchema.ViewportEvent,\n data: {\n kind: ViewportEventKind.Entry,\n },\n })\n }, {})\n\n this.#exitObserver = new IntersectionObserver(\n (entries) => {\n if (!entries[0]?.isIntersecting) {\n return\n }\n this.#exitObserver.disconnect()\n this.#tracker.trackSelfDescribingEvent({\n schema: EventSchema.ViewportEvent,\n data: {\n kind: ViewportEventKind.Exit,\n },\n })\n },\n { threshold: [1], rootMargin: '3000px 0px -100% 0px' },\n )\n\n this.#entryObserver.observe(this)\n }\n\n #stopViewportLogger() {\n this.#entryObserver?.disconnect()\n this.#exitObserver?.disconnect()\n }\n}\n\nif (!customElements.get(tag)) {\n customElements.define(tag, AppElement)\n}\n"],"names":["fingerprint","pad","getRandomValue","c","blockSize","base","discreteValues","Math","pow","randomBlock","toString","safeCounter","cuid","Date","getTime","slug","date","counter","slice","print","random","isCuid","stringToCheck","startsWith","isSlug","stringLength","length","module","exports","env","window","self","globalCount","Object","keys","clientId","navigator","mimeTypes","userAgent","crypto","msCrypto","lim","abs","getRandomValues","Uint32Array","num","size","s","substr","getElementTag","name","version","split","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","defineProperty","defineProperties","getOwnPropertyDescriptors","getOwnPropertySymbols","prototype","hasOwnProperty","propertyIsEnumerable","staticSnowplowRoot","staticSnowplowMajorVersion","globalKey","getBundle","callback","globalThis","cb","q","push","src","document","querySelector","script","createElement","async","head","appendChild","loadOnce","ViewportEventKind2","EventSchema3","EntitySchema2","APP_ID","createTracker","trackerId","environment","contentContext","bundle","trackerReady","host","getHost","eventQueue","contexts","trackOrQueue","nrknoBundle","NrknoUtils","newTracker","contentContextId","id","context","set","Content","source","promise","wait","trackers","whenReady","Promise","race","then","resolve","setTimeout","isResolved","console","warn","pop","fn","catch","error","trackSelfDescribingEvent","event","Snowplow","collect","trackStructuredEvent","trackStructEvent","tag","__APP_NAME__","__APP_VERSION__","_tracker","_classPrivateFieldLooseKey","_entryObserver","_exitObserver","_createTracker","_startViewportLogger","_stopViewportLogger","AppElement","HTMLElement","constructor","args","value","_stopViewportLogger2","_startViewportLogger2","_createTracker2","writable","connectedCallback","_classPrivateFieldLooseBase","this","addEventListener","disconnectedCallback","process","dataset","selfId","IntersectionObserver","entries","_entries$","isIntersecting","disconnect","observe","schema","EventSchema","ViewportEvent","data","kind","ViewportEventKind","Entry","_entries$2","Exit","threshold","rootMargin","_classPrivateFieldLoo","_classPrivateFieldLoo2","customElements","get","define"],"sourceRoot":""}