@schibsted/advertory 2.61.0 → 2.61.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/core/aftenposten/es/index.css +1 -1
  2. package/core/aftenposten/es/index.js +1 -1
  3. package/core/aftenposten/index.js +1 -1
  4. package/core/aftenpostenv2/es/index.css +1 -0
  5. package/core/aftenpostenv2/es/index.js +1 -0
  6. package/core/aftonbladet/es/index.css +1 -1
  7. package/core/bt/es/index.css +1 -1
  8. package/core/bt/es/index.js +1 -1
  9. package/core/bt/index.js +1 -1
  10. package/core/e24/es/index.css +1 -1
  11. package/core/e24/es/index.js +1 -1
  12. package/core/e24/index.js +1 -1
  13. package/core/koket/es/index.css +1 -1
  14. package/core/sa/es/index.css +1 -1
  15. package/core/sa/es/index.js +1 -1
  16. package/core/sa/index.js +1 -1
  17. package/core/svd/es/index.css +1 -1
  18. package/core/svdv2/es/index.css +1 -1
  19. package/core/tek/index.js +1 -1
  20. package/core/vg/es/index.css +1 -1
  21. package/core/vg/es/index.js +1 -1
  22. package/core/vg/index.js +1 -1
  23. package/core/vgv2/es/index.css +1 -1
  24. package/core/vgv2/es/index.js +1 -1
  25. package/package.json +1 -1
  26. package/sites/aftenposten/es/index.css +1 -1
  27. package/sites/aftenpostenv2/es/index.css +1 -0
  28. package/sites/aftenpostenv2/es/index.js +1 -0
  29. package/sites/aftonbladetv2/es/index.css +1 -1
  30. package/sites/bt/es/index.css +1 -1
  31. package/sites/e24/es/index.css +1 -1
  32. package/sites/e24/index.js +1 -1
  33. package/sites/fotbollskanalen/es/index.css +1 -1
  34. package/sites/sa/es/index.css +1 -1
  35. package/sites/svd/es/index.css +1 -1
  36. package/sites/svdv2/es/index.css +1 -1
  37. package/sites/tv4/es/index.css +1 -1
  38. package/sites/vg/es/index.css +1 -1
  39. package/sites/vgv2/es/index.css +1 -1
  40. package/styles/e24/styles.css +1 -1
  41. package/styles/svdv2/styles.css +1 -1
  42. package/core/aftenpostenv2/index.js +0 -1
  43. package/sites/aftenpostenv2/index.js +0 -1
  44. /package/core/aftenpostenv2/{index.d.ts → es/index.d.ts} +0 -0
  45. /package/core/aftenpostenv2/{package.json → es/package.json} +0 -0
  46. /package/sites/aftenpostenv2/{index.d.ts → es/index.d.ts} +0 -0
  47. /package/sites/aftenpostenv2/{package.json → es/package.json} +0 -0
@@ -1 +1 @@
1
- import"react/jsx-runtime";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,n;var i=e(function(){if(n)return t;n=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===i}(e)}(e)},i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map(function(e){return r(e,n)})}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function a(e,t){try{return t in e}catch(e){return!1}}function d(e,t,n){var i={};return n.isMergeableObject(e)&&s(e).forEach(function(t){i[t]=r(e[t],n)}),s(t).forEach(function(o){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(a(e,o)&&n.isMergeableObject(t[o])?i[o]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(o,n)(e[o],t[o],n):i[o]=r(t[o],n))}),i}function l(t,n,i){(i=i||{}).arrayMerge=i.arrayMerge||o,i.isMergeableObject=i.isMergeableObject||e,i.cloneUnlessOtherwiseSpecified=r;var s=Array.isArray(n);return s===Array.isArray(t)?s?i.arrayMerge(t,n,i):d(t,n,i):r(n,i)}return l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return l(e,n,t)},{})},t=l}());const r=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],o={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},s=6;class a{set(e){this.config=e}modifyConfigProperties(e){if(!this.config)throw new Error("Config was accessed before it had been initialized.");const t={};for(const n of r){const i=e[n];void 0!==i&&(t[n]=i)}Object.assign(this.config,t),Object.prototype.hasOwnProperty.call(e,"pageOptions")&&void 0!==e.pageOptions&&(this.config.pageOptions=Object.assign(Object.assign({},this.config.pageOptions),e.pageOptions))}get(){if(!this.config)throw new Error("Config was accessed before it had been initialized.");return this.config}getHandlers(){if(!this.siteHandlers)throw new Error("Handlers were accessed before it had been initialized.");return this.siteHandlers}setHandlers(e){this.siteHandlers=i(a.DEFAULT_SITE_HANDLERS,e)}}a.DEFAULT_SITE_HANDLERS={siteEvents:o,initNativeAd:function(){}};const d=new a,l=d.modifyConfigProperties.bind(d);function c(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}d((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const u="0123456789abcdefghijklmnopqrstuvwxyz",v=e=>{window.apntag.anq.push(e)},p=new Promise(e=>{"undefined"!=typeof document&&document.prerendering?document.addEventListener("prerenderingchange",()=>e()):e()}),g=new Promise(e=>{if("undefined"==typeof document||!document.hidden)return void e();const t=()=>{document.hidden||(document.removeEventListener("visibilitychange",t),e())};document.addEventListener("visibilitychange",t,{once:!0})});class h{initialize(){this.DATA=Object.assign({},h.INITIAL_DATA)}getData(e){if(!this.DATA)throw new Error("Storage was accessed with invalid data.");return this.DATA[e]}setData(e,t){if(!this.DATA)throw new Error("Storage was accessed before it had been initialized.");this.DATA[e]=Object.assign(Object.assign({},this.DATA[e]),t)}}h.INITIAL_DATA={wallpaper:{isAvailable:!1},horseshoe:{isAvailable:!1},initialClassNames:{},alertoryConfigKeywords:{}};const m=new h,y="advertory-wallpaper-background",f="advertory-with-horseshoe",w=()=>{const e=document.querySelector(`.${y}`);e&&e.remove()},b=e=>{const t=e.getBoundingClientRect().top;requestAnimationFrame(()=>(e=>{if(!document.body)return;const t=document.querySelector(`.${y}`);t&&t.style.setProperty("top",`${e}px`)})(t+15))},E=/^wallpaper:url:(http[s]?:\/\/)?[^\s(["<,>]*\.[^\s[",><]*/,T=e=>{if(window.location.href.includes("collapse_ad=0"))return;const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.setProperty("width","0","important"),t.style.setProperty("height","0","important"),t.style.setProperty("display","none","important"),n.style.setProperty("display","none","important"),e.includes("wallpaper")&&w())},I=e=>{const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.removeProperty("width"),t.style.removeProperty("height"),t.style.removeProperty("display"),n.style.removeProperty("display"))},k=()=>{const{publisher:e,country:t,finnBlink:n}=d.get(),{loadFinnBlinkAd:i,wallpaperHandlers:{adjustAdToHorseshoe:r}}=d.getHandlers(),o=window.apntag,s={publisher:e,country:t,finnBlink:n},a=e=>{I(e),v(()=>o.showTag(e))};return{withXandrAd:a,withFinnBlinkAd:e=>c(void 0,void 0,void 0,function*(){yield i(e,s,null)}),withFullAdsChain:e=>c(void 0,void 0,void 0,function*(){yield i(e,s,a,()=>{m.getData("horseshoe").isAvailable&&r(e)})})}},A={Blink:"Blink"},C=(e,...t)=>c(void 0,[e,...t],void 0,function*(e,{timeout:t}={timeout:1e3}){Array.from(document.querySelectorAll('script[type="module"]')).some(t=>{var n;return null===(n=t.textContent)||void 0===n?void 0:n.includes(`import(${JSON.stringify(e)})`)})||(yield new Promise((n,i)=>{const r=document.createElement("script");r.async=!0,r.type="module",r.textContent=`(async () => {\n try {\n const moduleNamespace = await import(${JSON.stringify(e)});\n const allowedExports = ${JSON.stringify(A)};\n\n for (const key of Object.keys(allowedExports)) {\n const exportedValue = moduleNamespace[key];\n \n if (exportedValue !== undefined) {\n window[allowedExports[key]] = exportedValue;\n }\n }\n } catch (error) {\n console.error('ESM load failed: ', error);\n }\n })();`;const o=()=>{a(),n()},s=()=>{a(),i(new Error(`Failed to load ${e}`))},a=()=>{r.removeEventListener("load",o),r.removeEventListener("error",s),clearTimeout(d)};r.addEventListener("load",o),r.addEventListener("error",s);const d=setTimeout(()=>{a(),i(new Error(`Loading script timed out: ${e}`))},t);document.head.appendChild(r)}).catch(e=>{console.error(e)}))}),S="https://assets.finn.no/pkg/distribution-fixed/v1/FINNExternalDistribution.modern.js",O=(e,t,n,i)=>{const r=t.parentElement;if(!r)return;const o=e?`-${e}`:"",s=i?`__${i}`:"",a=`advertory${o}-${n}${s}`,d=`advertory${o}-${n}-wrapper${s}`;t.classList.remove(...t.classList),r.classList.remove(...r.classList),t.classList.add(a),r.classList.add(d),t.dataset.adType=n},P={MOBILE:"mobile",TABLET:"tablet",DESKTOP:"desktop"},$=e=>e===P.MOBILE,L="finn-blink",x="native-ad",N=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},j=()=>c(void 0,void 0,void 0,function*(){try{(()=>{const e=document.createElement("script");e.setAttribute("src","https://ads.inventory.schibsted.io/ad-service/ad-banner-sponsor-advertisement/ad.js"),e.setAttribute("type","text/javascript"),e.setAttribute("async","true"),document.head.appendChild(e)})(),(()=>{const e=document.createElement("div");e.setAttribute("id","ads-advertory-anchor"),e.classList.add("subscribe_box"),e.classList.add("ad-box"),e.classList.add("leftAd"),e.classList.add("netboard"),e.classList.add("advert"),e.classList.add("module"),e.classList.add("banner"),e.classList.add("leaderboard"),e.classList.add("adsbygoogle"),e.classList.add("ad-banner"),e.classList.add("ad-container"),e.classList.add("adsbox"),e.classList.add("sidebar-ads"),e.classList.add("banner-ads"),e.style.opacity="0",e.style.width="1px",e.style.height="1px",e.style.minWidth="0px",e.style.minHeight="0px",e.style.maxWidth="1px",e.style.maxHeight="1px",e.style.position="absolute",e.style.top="0",e.style.boxSizing="border-box",e.style.margin="0",e.style.padding="0",document.body.appendChild(e)})()}catch(e){console.error("Error running adblock scripts:",e)}}),_=e=>{const t=e.split("-"),n=t[t.length-1];return 6===n.length&&n.match(/^[a-zA-Z0-9]+$/)?t.slice(0,-1).join("-"):e},q=(e,t)=>{const{siteSpecificConfig:{publisherClassName:n}={}}=d.get(),i=document.createElement("div"),r=document.createElement("div");return r.id=e,i.appendChild(r),O(n,r,L),N(`Creating blink container for: ${e}`),i},D=(e,t)=>{var n;(N(`Appending ${t.id} after ${e.id}`),e.parentElement&&(n=e.parentElement,!Array.from(n.children).some(e=>e.classList.contains("advertory-finn-blink-wrapper"))))?(e.parentElement.style.display="none",e.parentElement.insertAdjacentElement("afterend",t)):N(`Cannot perform afterend on: ${e.id}`)},M="ABSOLUTE_FULLSCREEN",B="ANY_FULLSCREEN",R="VERTICAL_FULLWIDTH",F="FULLWIDTH",V="TAKEOVER",U="VELVET_TAKEOVER",H="WALLPAPER",z="COLLAPSE",W={ANY_FULLSCREEN:[{width:6,height:6},{width:1920,height:1080},{width:3,height:3}],ABSOLUTE_FULLSCREEN:[{width:6,height:6}],VERTICAL_FULLWIDTH:[{width:1080,height:1920}],FIXED_FULLSCREEN:[{width:1920,height:1080},{width:3,height:3}],FULLWIDTH:[{width:5},{width:400,height:400}],NATIVE_AD:[{width:1,height:1}],TAKEOVER:[{width:4,height:4}],VELVET_TAKEOVER:[{width:7,height:7}],WALLPAPER:[{width:2,height:2}],COLLAPSE:[{width:2,height:1}]},K={wallpaper:1600,"l-format":1600},J=e=>{const{banner:t,targetId:n}=e;return!(!t||(null==n?void 0:n.includes("takeover")))&&le(e,B)},G=e=>{const{native:t}=e;return!!t},Y=e=>le(e,F),Q=e=>{const{targetId:t}=e;return t.includes("takeover")||le(e,V)},X=e=>le(e,V),Z=e=>le(e,H),ee=e=>le(e,z),te=e=>e.targetId.includes("sponsorstripe"),ne=e=>(980===e.width||1920===e.width&&e.targetId.includes("brandboard"))&&!e.targetId.includes("topboard")&&!e.targetId.includes("companion")&&!re(e),ie=e=>{const t=document.querySelector(`#${e}`);return!!t&&"true"===t.dataset.isFinnBlinkPlacement},re=e=>e.targetId.startsWith("panorama")||e.targetId.startsWith("modul"),oe=e=>e.targetId.startsWith("midboard"),se=e=>e.targetId.startsWith("widescreen"),ae=e=>e.width>=1260&&e.width<=1280,de=e=>e.width>=1600&&e.width<=1620,le=(e,t)=>{const n=W[t];if(!n)return!1;return!!n.find(t=>{var n,i;const r=(null===(n=e.banner)||void 0===n?void 0:n.width)||e.width,o=(null===(i=e.banner)||void 0===i?void 0:i.height)||e.height,s=t.width===r,a=!t.height||t.height===o;return s&&a})},ce=e=>`${Math.max(0,Math.round(e))}px`,ue=e=>{const{marginTop:t,marginBottom:n}=getComputedStyle(e);return e.getBoundingClientRect().height+parseFloat(t||"0")+parseFloat(n||"0")},ve=e=>{const t=document.getElementById(e.targetId),n=null==t?void 0:t.parentElement;t&&n&&[t,n].forEach(e=>{const t=Array.from(e.classList).find(e=>e.includes("netboard"));if(!t)return;const n=t.replace(/netboard/g,"brandboard");e.classList.remove(t),e.classList.add(n)})},pe={adRequested:()=>{},adAvailable:e=>{if(e.targetId.includes("skyscraperright_1")){(e=>{var t;const n=document.querySelector(e),i=document.querySelector(".advertory-skyscrapers-right-track"),[r,o]=Array.from(null!==(t=null==i?void 0:i.querySelectorAll('div[id*="skyscraper"]'))&&void 0!==t?t:[]);if(!(n&&i&&r&&o))return;const s=()=>{const e=i.getBoundingClientRect().top+window.scrollY,t=n.getBoundingClientRect().top+window.scrollY,o=document.querySelector(".advertory-wallpaper-background");if(document.body.style.setProperty("--skyscrapers-right-track-height",ce(t-e)),document.body.style.setProperty("--skyscraperright_1-height",ce(ue(r))),o){const e=ue(o)-ue(r)+15;document.body.style.setProperty("--skyscraper-second-margin",ce(e))}};s(),window.addEventListener("resize",s),window.addEventListener("orientationchange",s);const a=new ResizeObserver(s);a.observe(n),a.observe(r),a.observe(i),window.addEventListener("load",s)})('div:has(div[id*="fullscreen"])')}Q(e)&&(()=>{const e=document.querySelector("#takeover"),t=document.querySelector("div[id*='mobile-topboard'], div[id*='topboard']"),n=null==t?void 0:t.parentElement;t&&n&&e&&(e.appendChild(t),n.style.display="none")})(),ne(e)&&e.targetId.includes("netboard")&&ve(e)},adLoaded:e=>{},adNoBid:e=>{if(ie(e.targetId)){const{finnBlink:t}=d.get();((e,t)=>{c(void 0,void 0,void 0,function*(){const{deviceType:n}=d.get();if(!t||!$(n))return;yield C(S);const{replacementConfig:i}=t,r=document.querySelector(`[id^="${e}"]`);if(!r||!(null==i?void 0:i.sizes))return;const{sizes:o}=i,s=_(e),a=q(s);r.dataset.finnBlinkId=s,r.dataset.noBidAd="true",D(r,a),k().withFinnBlinkAd(s)})})(e.targetId,t)}},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},ge={NO:"no",SE:"se"},he=()=>{const{country:e}=d.get();return e===ge.NO?"no-sno":"se-generic"},me=()=>{const{country:e,publisher:t}=d.get();return`${e}-${t}`},ye=e=>new URLSearchParams(window.location.search).get(e),fe=()=>{if(!window.location.search.includes("kv_"))return{};const e={},t=(()=>{const e=new URLSearchParams(window.location.search);return Object.fromEntries(e)})();return Object.keys(t).forEach(n=>{n.startsWith("kv_")&&(e[n.slice(3)]=t[n])}),e},we={SVD:"svd",VG:"vg",GODARE:"godare",AFTENPOSTEN:"aftenposten",SA:"sa",BT:"bt",AFTONBLADET:"aftonbladet",E24:"e24",MINMOTE:"minmote",PENT:"pent",GODT:"godt",TEK:"tekno",KLART:"klart",TVNU:"tvnu",POLARIS:"polaris",KOKET:"koket",TV4:"tv4",FOTBOLLSKANALEN:"fotbollskanalen"},be=e=>{const{source:t}=e;return"csm"===t},Ee={[we.VG]:["board","netboard","backfill","outstream"],[we.AFTONBLADET]:["panorama","outstream"],[we.GODARE]:["panorama","outstream"],[we.SVD]:["wph-article-panorama","wph-front-panorama"]},Te=e=>{var t;const{publisher:n}=d.get();return!!Ee[n]&&!!(null===(t=Ee[n])||void 0===t?void 0:t.some(t=>e.includes(t)))},Ie=e=>new Promise(t=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void t(!1);const n=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const t=Number(e);return N("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let i=!1;const r=e=>{i||(N("Resolving advertising permission value obtained"),i=!0,t(e))},o=setTimeout(()=>{N("Advertising permission timed out, resolving with false"),r(!1)},3e3);window._tcf_.onTcfReady(()=>{N("On Tcf Ready called, waiting for permission"),clearTimeout(o)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(o);const t=Number(e);N("Advertising permission value obtained asynchronously: ",e),r(Boolean(t))})}),ke="cmp:loaded";let Ae,Ce=!1;const Se=(e,t,n)=>{const i=!!(null==e?void 0:e.enabled),r=(null==e?void 0:e.timeout)||3e3,o=ye("bypass_tcf"),s=()=>{if(!(null==e?void 0:e.enabled))return!0;if(((e,t)=>e?!!t&&(N("TCF bypass param detected, returning consent: true"),!0):(N("TCF is not enabled, returning consent: true"),!0))(i,o))return!0;if(Ce)return null;if(!Ae)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const t=Ae.getConsentedToAllSync();return N(`TCF consented to all is: ${t}`),Ae.getConsentedToAllSync()};return{initConsentManager:()=>(null==e?void 0:e.enabled)?new Promise((e,t)=>{if(N("Getting TCF consent manager..."),window._tcf_)return N("TCF consent manager is already available"),Ae=window._tcf_,void e(Ae);N("TCF consent manager is not available");const n=()=>{N("CMP loaded, resolving consent manager..."),i&&clearTimeout(i),window._tcf_?(Ae=window._tcf_,e(Ae)):t(new Error("CMP loaded but window._tcf_ is not defined"))},i=setTimeout(()=>{document.removeEventListener(ke,n),Ce=!0,t(new Error("Timeout waiting for CMP to load"))},r);N("Listening for CMP loaded event..."),document.addEventListener(ke,n,{once:!0})}):Promise.resolve(null),getConsentSync:s,getConsentAsync:()=>c(void 0,void 0,void 0,function*(){if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return N(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));const i=(null==e?void 0:e.schibstedAdChoicesEnabled)&&n===ge.SE,o=(null==e?void 0:e.schibstedAdChoicesEnabled)&&!t&&n===ge.NO;if(i||o)return N("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield Ie(e);if(!(null==e?void 0:e.enabled))return!0;const a=s();return null!==a?a:yield new Promise((e,t)=>{try{if(!Ae)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");let t=!1;const n=n=>{t||(t=!0,e(n))},i=setTimeout(()=>{N("TCF isConsentedToAll timed out, resolving with false"),n(!1)},r);Ae.onTcfReady(()=>{N("On Tcf Ready called, waiting for consent"),clearTimeout(i)}),Ae.isConsentedToAll(t=>{clearTimeout(i),e(t)})}catch(e){t(e)}})})}},Oe=e=>{const t=encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),n=new RegExp(`(?:(?:^|.*;)\\s*${t}\\s*\\=\\s*([^;]*).*$)|^.*$`);return decodeURIComponent(document.cookie.replace(n,"$1"))||null},Pe=()=>{const e=Oe("_pulse2data");return e?e.split(",")[2]:void 0},$e=9826;class Le{constructor(){this.getSupplyTypeKeywords=()=>{const{deviceType:e=P.DESKTOP,isMobileApp:t}=d.get();if(t){return{"aa-sch-supply_type":`app_${e===P.MOBILE?"phone":P.TABLET}`}}return{"aa-sch-supply_type":`web_${this.getPageOptionsFormatDevice(e)}`}}}prepare(e){return c(this,void 0,void 0,function*(){return Object.assign(Object.assign({},e),{keywords:Object.assign(Object.assign(Object.assign(Object.assign({},e.keywords),this.getSupplyTypeKeywords()),yield this.getFormattedExternalIdKeywords()),this.getHasContextKeywords(e.keywords)),user:{externalUid:yield this.getExternalUid(),dnt:yield this.isTrackingForbidden()}})})}getFormattedExternalIdKeywords(){return c(this,void 0,void 0,function*(){const e=yield this.getExternalUid(),t=this.getUserId();return{"aa-sch-externalid_src":Number(!!e)+Number(!!t)}})}getUserId(){return Pe()}getExternalUid(){return c(this,void 0,void 0,function*(){return yield c(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=d.get(),{getConsentAsync:i}=Se(e,t,n);if(!(yield i()))return;const r=Oe("_pulse2data");return r?r.split(",")[9]:void 0})})}isTrackingForbidden(){return c(this,void 0,void 0,function*(){return(null===navigator||void 0===navigator?void 0:navigator.globalPrivacyControl)||"1"===(null===navigator||void 0===navigator?void 0:navigator.doNotTrack)||"DO_NOT_TRACK"===(yield this.getExternalUid())})}getMember(){const{pageOptions:{member:e},testMember:t=$e}=d.get();return window.location.search.includes("inventory_test=true")?t:e}getCMPValue(e){return localStorage.getItem(`CMP:${e}`)?"0"===localStorage.getItem(`CMP:${e}`)?"0":"1":"0"}getPublisherKeywords(){const{publisher:e}=d.get();return{"aa-sch-publisher":`${e}`}}getAnalyticsConsentKeywords(){return{"aa-sch-cmp_analytics":this.getCMPValue("analytics")}}getAdvertisingConsentKeywords(){return c(this,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=d.get(),{getConsentAsync:i}=Se(e,t,n);return{"aa-sch-cmp_advertising":(yield i())?"1":"0"}})}getPageTypeKeywords(){const{pageType:e}=d.get();return{"aa-sch-page_type":e}}getCountryCodeKeywords(e){return{"aa-sch-country_code":e}}getInventoryTypeKeywords(){return{"aa-sch-inventory_type":"editorial"}}getHasContextKeywords(e){const t=e["aa-sch-context_keyword"];return{"aa-sch-has_context_keyword":Array.isArray(t)&&t.length?1:0}}getPageOptionsFormatDevice(e="desktop"){return"mobile"===e?"phone":e}getSponsorsKeywords(){var e;const{publisher:t,keywordsConfig:n}=d.get(),i=null===(e=null==n?void 0:n.sponsors)||void 0===e?void 0:e.split(":").map(e=>`${t}_${e}`);return i?{"no-sno-news-sponsors":i}:{}}}const xe=new Le;function Ne(e=!1){var t,n;const i=null===(n=null===(t=window.navigator)||void 0===t?void 0:t.userAgent)||void 0===n?void 0:n.toLocaleLowerCase(),r=(()=>{const e=window.navigator.userAgent.toLowerCase(),t=[["win","windows"],["macintosh","macos"],["x11","linux"],["android","android"],["ipad","ios"],["iphone","ios"]].find(([t])=>e.includes(t));return t?t[1]:"unknown"})();return{OS:r,mobileOS:["ios","android"].includes(r)?r:"unknown",isHybridApp:i.includes("hermes"),appMode:e?"hybrid":"notinapp"}}xe.prepare.bind(xe);const je=["aLOLE","xBqQj","1KaqJ","1nzXzK","opm8zV","4qKXKR","Ad9QgE"];function _e(e){return t=window.location.pathname.split("/").slice(-2,-1).pop()||"",je.includes(t)?{"no-sno-news-section":`${e}_doedsfall`}:{};var t}class qe extends Le{constructor(){super(...arguments),this.getDeviceKeywords=()=>{const{deviceType:e=P.DESKTOP}=d.get();return{"no-sno-device":this.getPageOptionsFormatDevice(e)}}}getAppTypeKeywords(){const{deviceType:e,isMobileApp:t}=d.get(),{OS:n,isHybridApp:i}=Ne(t);return{"no-sno-apptype":n&&e&&i?`${n}_${this.getPageOptionsFormatDevice()}_hybrid`:"none"}}getObituariesKeywords(e){return _e(e)}getSectionPageTypeKeywords(){var e,t;const{pageOptions:n,pageType:i}=d.get(),r=null!==(t=null===(e=n.keywords["no-sno-news-section"])||void 0===e?void 0:e.toString())&&void 0!==t?t:"ettan";return{"no-sno-section-page_type":`${r.split("_").pop()||r}_${"article"===i?"article":"front"}`}}}const De=864e5,Me=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return N("Error with parsing localStorage data"),null}},t=(e,t)=>{window.localStorage.setItem(e,JSON.stringify(t))};return{get:e,set:t,setWithTimestamp:(e,n,i=De)=>{const r={data:n,expirationTime:(new Date).getTime()+i};t(e,JSON.stringify(r))},getByTimestamp:(t,n=De)=>{const i=e(t);if(!i)return null;if(!n)return i;try{const{expirationTime:e,data:t}=JSON.parse(i);return(new Date).getTime()<=e?t:null}catch(e){return N("Error with parsing localStorage data"),null}}}})(),Be="glimrTags",Re=["glwe_","glwet_"],Fe={geofenceTags:[],geoTags:[],weatherTags:[]},Ve=(e,t,n,...i)=>c(void 0,[e,t,n,...i],void 0,function*(e,t,n,i="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return N(`Schibsted Consent to Pay is not enabled, returning true for ${i}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return N(`Schibsted Ad Choices override value is set, returning override value: ${null==e?void 0:e.schibstedAdChoicesOverrideValue} for ${i}`),Boolean(Number(null==e?void 0:e.schibstedAdChoicesOverrideValue));const{getConsentAsync:r}=Se(e,t,n);return(yield r())?(N(`Schibsted Ad Choices consent given according to TCF consent manager for ${i}`),!0):(N(`Schibsted Ad Choices consent not given according to TCF consent manager for ${i}`),!1)}),Ue=()=>c(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=d.get();if(null==e?void 0:e.schibstedConsentToPayEnabled){return yield Ve(e,t,n,"glimr")}const{getConsentAsync:i}=Se(e,t,n);return yield i()}),He=()=>c(void 0,void 0,void 0,function*(){const{glimr:e}=d.get();if(!(yield Ue())||!(null==e?void 0:e.enabled))return void N("No consent for glimr data fetching.");const t=yield(n=500,c(void 0,void 0,void 0,function*(){return yield Promise.race([c(void 0,void 0,void 0,function*(){const e=yield import("glimr-sdk");return e.default||e}),new Promise(e=>setTimeout(()=>e(!1),n))])}));var n;if(t)try{t.setTagCacheTimeInSeconds(300),yield new Promise(n=>{t.getTags(e.clientId,(e,t)=>{Me.setWithTimestamp(Be,{tags:e,tagMappings:t}),n(!0)})})}catch(e){N(`Error during getting glimr data: ${e}`)}else N("Timeout (500ms) while loading glimr package. Skipping glimr data fetching.",{glimr:t})}),ze={svd:"svd",vg:"vg",godare:"godare",aftenposten:"no-aftenposten",sa:"no-stavangeraftenblad",bt:"no-bergenstidende",aftonbladet:"aftonbladet",e24:"e24",minmote:"minmote",pent:"pent",godt:"godt",tek:"no-tek"},We=e=>Re.some(t=>e.startsWith(t)),Ke=e=>e.startsWith("glgc_"),Je=e=>!We(e)&&!Ke(e),Ge=e=>{const t=Ye();if(!t)return Fe;const n=((e=[])=>e.filter(We))(t),i=((e=[])=>e.filter(Ke))(t),r=((e=[],t)=>{const n=e.filter(Je);if(t){const{publisher:e}=d.get(),t=ze[e]||e;n.push(t)}return n})(t,e);return{geoTags:r,geofenceTags:i,weatherTags:n}},Ye=()=>{const e=Me.getByTimestamp(Be);return e&&"string"!=typeof e?null==e?void 0:e.tags:null},Qe={get:(e,t)=>c(void 0,void 0,void 0,function*(){const n=yield fetch(e,t);if(!n.ok)throw new Error(n.statusText);return yield n.json()}),post:(e,t,n)=>c(void 0,void 0,void 0,function*(){const i=JSON.stringify(n),r=yield fetch(e,{method:"POST",headers:t,body:i});if(!r.ok)throw new Error(r.statusText);return yield r.json()})},Xe="advertory:ppids-cache",Ze={[ge.SE]:`SCH${ge.SE.toUpperCase()}-EnvHash`,[ge.NO]:`SCH${ge.NO.toUpperCase()}-EnvHash`},et={[ge.SE]:`SCH${ge.SE.toUpperCase()}-UserHash`,[ge.NO]:`SCH${ge.NO.toUpperCase()}-UserHash`},tt={[ge.SE]:`sch${ge.SE}-envhash-v3`,[ge.NO]:`sch${ge.NO}-envhash-v3`},nt={[ge.SE]:`sch${ge.SE}-userhash-v3`,[ge.NO]:`sch${ge.NO}-userhash-v3`},it={[ge.SE]:`'sch${ge.SE}-iosid-v3'`,[ge.NO]:`'sch${ge.NO}-iosid-v3'`},rt={[ge.SE]:`sch${ge.SE}-androidid-v3`,[ge.NO]:`sch${ge.NO}-androidid-v3`},ot={[ge.SE]:"sdrn:schibsted.com:user",[ge.NO]:"sdrn:spid.no:user"};class st{constructor(){this.eids=[]}add(e,t){return e&&this.eids.push({id:e,source:t}),this}buildRyEids(){return this.eids.map(({id:e,source:t})=>({source:t,uids:[{id:e,atype:1,ext:{stype:"ppuid"}}]}))}buildEids(){return[...this.eids]}buildVideoEids(){return this.eids.map(({id:e,source:t})=>`${t},${e}`).join("|")}buildNorstatPath(){const e=this.eids[0];return e?`${e.source}-${e.id}`:""}buildNorstatQuery(e){const t=new URLSearchParams;return this.eids.slice(1).forEach(({id:n,source:i})=>{t.append(e,`${i}-${n}`)}),t}}const at=new class{constructor(){this.ppid1=null,this.ppid2=null}processPPIDs(e){return c(this,arguments,void 0,function*(e,t=1e4){var n,i;const r=yield Promise.race([new Promise(e=>{setTimeout(()=>e({xandr:{ppId1:"",ppId2:""}}),t)}),e.instance.getAdvertisingIdentifiers()]);this.setPPIDs(null===(n=r.xandr)||void 0===n?void 0:n.ppId1,null===(i=r.xandr)||void 0===i?void 0:i.ppId2)})}getPPIDs(){var e,t;return null!==this.ppid1&&null!==this.ppid2||N("PPIDv2s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(t=this.ppid2)&&void 0!==t?t:""}}setPPIDs(e,t){this.ppid1=null!=e?e:"",this.ppid2=null!=t?t:""}},dt=new class{constructor(){this.ppid1=null,this.ppid2=null,this.idfv=null,this.anId=null}processPPIDs(e,t){return c(this,void 0,void 0,function*(){var n,i,r,o,s,a,d,l,c,u,v;const p=Me.get(Xe),g=yield this.getNewPPIDs(e,t);if(this.shouldHash(p,g)){const t=null!==(n=e.hasherUrl)&&void 0!==n?n:"https://hasher.schibsted.com/api/v1/hash",l=this.createHasherPayload(g),c=yield this.hashPPIDs(l,t);return c?(this.cachePPIDs(l,c,null===(i=g.idfv)||void 0===i?void 0:i.plain,null===(r=g.anId)||void 0===r?void 0:r.plain),void this.setPPIDs(null!==(o=c.userId)&&void 0!==o?o:"",null!==(s=c.environmentId)&&void 0!==s?s:"",null===(a=g.idfv)||void 0===a?void 0:a.plain,null===(d=g.anId)||void 0===d?void 0:d.plain)):void this.setPPIDs("","")}this.setPPIDs(null!==(l=null==p?void 0:p.userId.hashed)&&void 0!==l?l:"",null!==(c=null==p?void 0:p.environmentId.hashed)&&void 0!==c?c:"",null===(u=null==g?void 0:g.idfv)||void 0===u?void 0:u.plain,null===(v=null==g?void 0:g.anId)||void 0===v?void 0:v.plain)})}getPPIDs(){var e,t;return null!==this.ppid1&&null!==this.ppid2||N("PPIDv3s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(t=this.ppid2)&&void 0!==t?t:"",idfv:this.idfv,anId:this.anId}}setPPIDs(e,t,n,i){this.ppid1=null!=e?e:"",this.ppid2=null!=t?t:"",this.idfv=null!=n?n:null,this.anId=null!=i?i:null}shouldHash(e,t){var n,i;if(!e)return!0;for(const r in e){if((null===(n=e[r])||void 0===n?void 0:n.plain)!==(null===(i=t[r])||void 0===i?void 0:i.plain))return!0}return!1}cachePPIDs(e,t,n,i){const r=Object.assign(Object.assign({clientId:{plain:e.clientId},userId:{plain:e.userId,hashed:t.userId},environmentId:{plain:e.environmentId,hashed:t.environmentId},trackerType:{plain:e.trackerType},trackerVersion:{plain:e.trackerVersion}},n?{idfv:{plain:n}}:{}),i?{anId:{plain:i}}:{});Me.set(Xe,r)}hashPPIDs(e,t){return c(this,void 0,void 0,function*(){try{const n=new Headers({"Content-Type":"application/json"});return yield Qe.post(t,n,e)}catch(e){return N("Error with hashing PPIDs",e),null}})}getNewPPIDs(e,t){return c(this,arguments,void 0,function*({clientId:e,instance:t},n){const i=yield((e,t)=>c(void 0,void 0,void 0,function*(){const n=yield e.getUserId();return n?`${ot[t]}:${n}`:null}))(t,n),r=yield(e=>c(void 0,void 0,void 0,function*(){const t=yield e.getEnvironmentId();return t?`sdrn:schibsted:environment:${t}`:null}))(t),o=window.advertory_idfv,s=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:e},userId:{plain:i},environmentId:{plain:r},trackerType:{plain:"Advertory"},trackerVersion:{plain:"1.0.0"}},o?{idfv:{plain:o}}:{}),s?{anId:{plain:s}}:{})})}createHasherPayload({clientId:e,trackerType:t,trackerVersion:n,userId:i,environmentId:r}){return{clientId:e.plain,trackerType:t.plain,trackerVersion:n.plain,userId:i.plain,environmentId:r.plain}}},lt=e=>c(void 0,void 0,void 0,function*(){const{tracker:t,tcf:n,country:i,isMobileApp:r}=e;if(!(yield Ve(n,r,i,"setXandrPPIDs")))return;if(!t)return;(yield Promise.allSettled([at.processPPIDs(t,null==n?void 0:n.timeout),dt.processPPIDs(t,i)])).forEach((e,t)=>{if("rejected"===e.status){N(`Cannot fetch PPIDs v${t+2}`,e.reason)}})}),ct=e=>{const{ppid1:t,ppid2:n}=at.getPPIDs(),{ppid1:i,ppid2:r,idfv:o,anId:s}=dt.getPPIDs();return{userIds:[{type:"extendedIDs",eids:(new st).add(n,Ze[e]).add(t,et[e]).add(r,tt[e]).add(i,nt[e]).add(o,it[e]).add(s,rt[e]).buildEids()}]}},ut=e=>{const{ppid1:t,ppid2:n}=at.getPPIDs(),{ppid1:i,ppid2:r,idfv:o,anId:s}=dt.getPPIDs();if(!n)return{};return{userSync:{userIds:[{name:"pubProvidedId",params:{eids:(new st).add(n,Ze[e]).add(t,et[e]).add(r,tt[e]).add(i,nt[e]).add(o,it[e]).add(s,rt[e]).buildRyEids()}}]}}},vt={FRONT:"front"};const pt=new class extends qe{prepare(e){return c(this,void 0,void 0,function*(){const t=this.getPageTypeKeywords()["aa-sch-page_type"],n=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({"aa-sch-country_code":ge.NO},this.getPublisherKeywords()),this.getPageTypeKeywords()),yield this.getFormattedExternalIdKeywords()),this.getSupplyTypeKeywords()),this.getAppTypeKeywords()),this.getDeviceKeywords()),yield this.getAdvertisingConsentKeywords()),this.getHasContextKeywords(e.keywords)),yield c(void 0,void 0,void 0,function*(){const{glimr:e}=d.get(),{addPublisherToGeo:t}={},n=yield Ue();if(!(null==e?void 0:e.enabled)||!n)return N("No consent for getting glimr tags."),{};const i=he(),r=Ge(t);return{[`${i}-geo`]:r.geoTags,[`${i}-weather`]:r.weatherTags,[`${i}-geofence`]:r.geofenceTags}})),(()=>{const{ppid1:e,ppid2:t}=at.getPPIDs();return{"aa-sch-schuserhash":e?"1":"0","aa-sch-schenvhash":t?"1":"0"}})()),e.keywords),i=Object.assign(Object.assign({},n),this.getSponsorsKeywords()),r=Object.assign(Object.assign({},n),this.getPageTypeKeywords());return Object.assign(Object.assign({},e),{keywords:t===vt.FRONT?r:i,user:Object.assign(Object.assign({},ct(ge.NO)),{externalUid:yield this.getExternalUid()}),member:this.getMember()})})}};var gt=pt.prepare.bind(pt);const ht=()=>(window.apntag||(window.apntag={anq:[],defineTag:e=>({targetId:""}),showTag:e=>{},onEvent:(e,t,n)=>{},offEvent:(e,t)=>{},refresh:e=>{},modifyTag:(e,t)=>{},loadTags:e=>{},emitEvent:(e,t)=>{},setPageOpts:e=>{},resizeAd:(e,t,n)=>{},getAstVersion:()=>"",setEndpoint:(e,t)=>{},fireImpressionTrackers:e=>{},setKeywords:()=>{},clearRequest:()=>{}}),window.apntag),mt=()=>(window.relevantDigital||(window.relevantDigital={cmd:[]}),window.relevantDigital),yt=(e={},t)=>{const{prebid:{externalUidInAuctionEnabled:n,forwardGlimrTags:i=!1}={}}=d.get(),r=[`${he()}-geo`],o=["aa-sch-context_keyword","aa-sch-publisher","se-aftonbladet-section","se-svd-section","se-generic-section","no-sno-news-section","no-sno-news-subsection",...i?r:[]],s=Object.fromEntries(Object.entries(e).filter(([e])=>o.includes(e))),a=t&&n?{id:t}:{};return{ortb2:Object.assign({site:{ext:{data:s}}},a)}},ft=(e,...t)=>c(void 0,[e,...t],void 0,function*(e,{timeout:t}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((n,i)=>{const r=document.createElement("script");r.async=!0,r.src=e;const o=()=>{a(),n()},s=()=>{a(),i(new Error(`Failed to load ${e}`))},a=()=>{r.removeEventListener("load",o),r.removeEventListener("error",s),clearTimeout(d)};r.addEventListener("load",o),r.addEventListener("error",s);const d=setTimeout(()=>{a(),i(new Error(`Loading script timed out: ${e}`))},t);document.head.appendChild(r)}).catch(e=>{console.error(e)}))}),wt=e=>e.includes("snoap.no"),bt=e=>{var t,n,i,r,o;return!!(null===(o=null===(r=null===(i=null===(n=null===(t=window.apntag)||void 0===t?void 0:t.requests)||void 0===n?void 0:n.tags[e])||void 0===i?void 0:i.adResponse)||void 0===r?void 0:r.ads[1])||void 0===o?void 0:o.rtb)},Et=(e,t=(...e)=>{})=>{const n=t.toString();if(0===e.length)return n;const i=n.substring(0,n.indexOf("=>")).replace("(","").replace(")","").split(",").map(e=>e.trim()),r=n.substring(n.indexOf("{")+1,n.lastIndexOf("}")),o=i.map((t,n)=>`${t} = "${e[n]}"`);return new Function(...o,r).toString()},Tt=Et([],()=>{const e=({width:e,height:t})=>{var n;const i=null===(n=document.querySelector("#sf_align"))||void 0===n?void 0:n.querySelector("div");if(!i)return;const{clientWidth:r,clientHeight:o}=i,s=e/r,a=t/o;i.style.transform=`scale(${s},${a})`,i.style.transformOrigin="left top"},t=()=>{const{innerWidth:t,innerHeight:n}=window;e({width:t,height:n})};window.addEventListener("resize",t=>{if(!t.currentTarget)return;const n={width:innerWidth,height:innerHeight};e(n)});const n=window.frameElement;(null==n?void 0:n.contentWindow)?n.contentWindow.document.body.onload=t:document.body.onload=t}),It=e=>{const t=Et([],()=>{new MutationObserver((e,t)=>{document.querySelector("iframe")&&((()=>{const e=document.querySelector("iframe");e&&(e.onload=()=>{if(!e.contentDocument)return;document.body.style.height="100%",document.documentElement.style.height="100%",e.height="100%",e.width="100%";const t=e.contentDocument.createElement("style");t.textContent="\n adfm-ad {\n height: 100% !important;\n width: 100% !important;\n }\n ",e.contentDocument.head.appendChild(t);const n=e.contentDocument.querySelector("iframe");if(!(null==n?void 0:n.contentDocument))return;const i=n.contentDocument.createElement("style");i.textContent="\n #image {\n background-size: cover !important;\n }\n ",new MutationObserver((e,t)=>{n.contentDocument&&(n.contentDocument.head.appendChild(i),t.disconnect())}).observe(e.contentDocument,{childList:!0,subtree:!0})})})(),t.disconnect())}).observe(document.body,{childList:!0,subtree:!0})}),n=document.createElement("script");n.textContent=`(${t})()`;return e+n.outerHTML},kt=[],At={},Ct=(e,t)=>{e.forEach(({target:e,isIntersecting:n})=>{const i=Ot(e);n?(St(i,n),Pt(e,i,t)):(St(i,n),$t(e,i,t))})},St=(e,t)=>{var n,i;const r=null===(n=document.getElementById(e))||void 0===n?void 0:n.querySelector("iframe");if(!r)return;const o=t?"showFullscreen":"hideFullscreen";null===(i=r.contentWindow)||void 0===i||i.postMessage(`advertory:${o}-${e}`,"*")},Ot=e=>{var t;return null===(t=e.children[0])||void 0===t?void 0:t.id},Pt=(e,t,n)=>{e.classList.add("in-screen"),document.body.classList.add("fullscreen-scroll-in-screen"),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollInView")),kt.includes(t)||kt.push(t),n&&window.addEventListener("scroll",At[t],{passive:!0})},$t=(e,t,n)=>{kt.includes(t)&&(n&&window.removeEventListener("scroll",At[t]),document.body.classList.remove("fullscreen-scroll-in-screen"),e.classList.remove("in-screen"),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollNotInView")))},Lt=(e,t={fadingHeaderEnabled:!1,headerSelectors:[".js-masthead"],skyscraperSelectors:[".skyscraper_r"],headerZIndex:3})=>{const{headerSelectors:n=[".js-masthead"],skyscraperSelectors:i=[".skyscraper_r"],headerZIndex:r=3}=t,o=[],s=[];return n.forEach(e=>{var t;const n=null!==(t=document.querySelector(e))&&void 0!==t?t:document.querySelector("header");n&&o.push(n)}),i.forEach(e=>{const t=document.querySelector(e);t&&s.push(t)}),()=>{o.length&&xt(e,o,r,0),s.length&&xt(e,s,r,40)}},xt=(e,t,n,i)=>{const r=e.offsetHeight,o=window.scrollY,s=e.getBoundingClientRect().top+o;t.forEach(e=>{const t=e.offsetHeight;let a;a=s>o?(s-o)/t-i:(o+t-(s+r))/t;const d=a<=0;e.style.visibility=d?"hidden":"",e.style.zIndex=d?"":n.toString(),e.style.pointerEvents=d?"none":"all",e.style.opacity=a.toString()})},Nt={no:{adText:"ANNONSE",adFrom:"ANNONSE FRA",adContent:"ANNONSØRINNHOLD",adContentFrom:"ANNONSØRINNHOLD FRA"},se:{adText:"ANNONS",adFrom:"ANNONS FRÅN",adContent:"EXTERN LÄNK",adContentFrom:"EXTERN LÄNK FRÅN"}};let jt=null;const _t=(e,t)=>{let n=e;return n=(e=>{const t=document.createElement("script");return t.textContent="\n {\n const frame = window.frameElement;\n \n if (frame) {\n frame.contentWindow.document.body.onload = onLoad;\n } else {\n document.body.onload = onLoad;\n }\n \n function onLoad() {\n window.addEventListener('message', function(event) {\n if (event.data === 'advertory:showFullscreen-'+document.body.id) {\n document.body.style.display= \"block\";\n } else if (event.data === 'advertory:hideFullscreen-'+document.body.id) {\n document.body.style.display= \"none\";\n }\n });\n }\n }\n ",e+t.outerHTML})(e),n=(e=>{const t=document.createElement("script");return t.textContent=`(${Tt})()`,e+t.outerHTML})(n),n=(e=>{if((e=>e.includes("google"))(e))return e;const t=document.createElement("div");t.innerHTML=e;const n=t.querySelector("img");return n?(n.style.width="100%",n.style.height="100%",n.style.objectFit="cover",n.style.position="fixed",t.innerHTML):e})(n),n=(e=>{if(wt(e))return e;const t=document.createElement("style");return t.textContent="\n .GoogleActiveViewClass, .GoogleActiveViewElement {\n transform: translate(calc(-50% + 50vw), 0);\n width: 100vw !important;\n height: 100vh !important;\n }\n .GoogleActiveViewClass img, .GoogleActiveViewElement img {\n width: 100vw;\n height: 100vh;\n object-fit: cover;\n }\n .GoogleActiveViewClass iframe {\n width: 100vw !important;\n height: 100vh !important;\n }\n ",e+t.outerHTML})(n),(e=>e.includes("adform"))(n)&&(n=(e=>{const t=document.createElement("script");t.textContent='\n var frame = window.frameElement;\n if (frame) {\n frame.style.removeProperty("width");\n frame.style.removeProperty("height");\n frame.contentWindow.document.body.onload = onLoad;\n } else {\n document.body.onload = onLoad;\n }\n \n function onLoad() {\n var iframe = document.querySelector("adfm-ad iframe");\n if (iframe) {\n var image = iframe.contentWindow.document.getElementById("image");\n if (!image) return;\n image.style.backgroundSize = "cover";\n } else {\n var iframe = document.querySelector(".adform-adbox iframe");\n if (iframe) {\n var style = document.createElement("style");\n style.textContent = "#banner {width: 100% !important; height: 100% !important;} #banner img {object-fit: cover;}";\n iframe.contentDocument.body.append(style);\n iframe.style = "width: 100vw; height: 100vh;";\n } else {\n var observer = new MutationObserver(function(mutations, obs) {\n for (var mutation of mutations) {\n var iframe = mutation.addedNodes[0];\n if (iframe && iframe.nodeName === "IFRAME") {\n iframe.style = "width: 100vw; height: 100vh;";\n iframe.dataset.contents += "<style>#banner {width: 100% !important; height: 100% !important;} #banner img {object-fit: cover;}</style>";\n obs.disconnect();\n }\n }\n });\n observer.observe(document.body, { childList: true, subtree: true });\n }\n }\n }\n ';const n=document.createElement("style");return n.textContent="\n html, body, adfm-ad, #sf_align, .adform-adbox, .adform-adbox img {\n width: 100% !important;\n height: 100% !important;\n object-fit: cover;\n max-width: 100vw;\n }\n ",e+n.outerHTML+t.outerHTML})(n)),(e=>e.includes("529299503"))(n)&&(n=It(n)),(e=>e.includes("de17a"))(n)&&(n=(e=>wt(e)?e:e.replace("<iframe ","<iframe onload=\"\n var f = document.querySelector('iframe');\n if (!f) return;\n var s = f.style;\n s.transform = 'scale(' + (window.innerHeight / Number(f.height)).toFixed(2) + ')';\n s.right = parseInt((Number(f.width) - window.innerWidth) / 2) + 'px';\n s.bottom = parseInt((Number(f.height) - window.innerHeight) / 2) + 'px';\n s.position = 'relative';\n \" "))(n)),wt(n)&&(n=(e=>{let t=e.replace("<html>",'<html style="height: 100%;">');return t=t.replace("</iframe>","</iframe><style>#sf_align {height: 100%;} #sf_align iframe {height: 100vh;}</style>"),t=t.replace('<body style="','<body style="height: 100%; '),t})(n)),(e=>e.includes("kreateam.io"))(n)&&(n=(e=>{let t=e.replace("<html>",'<html style="height: 100%;">');return t=t.replace("</div>","</div><style>#sf_align {height: 100%;} #sf_align iframe {height: 100vh;}</style>"),t=t.replace('<body style="','<body style="height: 100%; '),t})(n)),bt(t)&&(n=(e=>{const t=document.createElement("script");t.textContent='var frame = window.frameElement;\n if (frame) {\n frame.style.width = "100vw";\n frame.style.height = "100vh";\n }';const n=document.createElement("div");return n.innerHTML=e,n.appendChild(t),n.innerHTML})(n)),n},qt=()=>{jt=null;const e=window.visualViewport,t=e?e.height:window.innerHeight,n=e?e.width:window.innerWidth,i=e?e.offsetLeft:0,r=document.documentElement;r.style.setProperty("--advertory-fullscreen-scroll-vh",`${t}px`),r.style.setProperty("--advertory-fullscreen-scroll-vw",`${n}px`),r.style.setProperty("--advertory-fullscreen-scroll-left",`${i}px`)},Dt=()=>{jt||(jt=window.requestAnimationFrame(qt))},Mt=(e,t)=>{var n,i,r,o;const{country:s}=d.get(),{targetId:a}=e;document.documentElement.style.setProperty("--advertory-ios-safe-area-top-fix",null!==(n=null==t?void 0:t.iosSafeAreaTopFix)&&void 0!==n?n:"0px"),(e=>{const{articlesContainerWidth:t=1302,backgroundColor:n="#fff",foregroundColor:i="#fff",margin:r="16px 0",beforeContentValue:o=""}=e,s=t/2,a=document.createElement("style");a.innerHTML=`\n :root {\n --background: linear-gradient(\n to right,\n ${n} 0px,\n ${n} calc(50% - ${s}px),\n ${i} calc(50% - ${s}px),\n ${i} calc(50% + ${s}px),\n ${n} calc(50% + ${s}px),\n ${n} 100%\n ) !important;\n \n --advertory-fullscreen-scroll-wrapper-margin: ${r};\n }\n \n .advertory-fullscreen-scroll-wrapper {\n ${o&&"clip-path: polygon(0 -16px, 100vw -16px, 100vw 100dvh, 0 100dvh);\n -webkit-clip-path: polygon(0 -16px, 100vw -16px, 100vw 100dvh, 0 100dvh);"}\n }\n\n .advertory-fullscreen-scroll-wrapper:before, .advertory-fullscreen-scroll-wrapper:after {\n background: var(--background);\n content: '${o}' !important;\n }`,a.id="ad-fullscreen-scroll-wrapper-style",document.head.appendChild(a)})(null!==(i=null==t?void 0:t.overlayStyles)&&void 0!==i?i:{});const l=document.getElementById(a),c=null==l?void 0:l.parentElement;if(!l||!c)return;((e,t)=>{const n=(null==t?void 0:t.fadingHeaderEnabled)||!1,i=new IntersectionObserver(e=>Ct(e,n),{}),r=Ot(e);i.observe(e),n&&(At[r]=Lt(e,t))})(c,t),l.className="advertory-fullscreen-scroll";const u=le(e,M)?"absolute":"fixed";l.style.position=u,c.className="advertory-fullscreen-scroll-wrapper",c.dataset.showTagSubscribeId=a,l.setAttribute("data-ad-label",Nt[s].adText),(null==t?void 0:t.moveCogwheelToTheLeft)&&(l.dataset.moveCogwheelToTheLeft="true"),Dt(),window.addEventListener("resize",Dt),null===(r=window.visualViewport)||void 0===r||r.addEventListener("resize",Dt),null===(o=window.visualViewport)||void 0===o||o.addEventListener("scroll",Dt)},Bt=({targetId:e})=>{const t=(e=>{const{requests:t}=window.apntag,n=bt(e)?1:0;return null==t?void 0:t.tags[e].adResponse.ads[n].rtb.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=bt(e)?1:0;n&&(n.tags[e].adResponse.ads[i].rtb.banner.content=t)})(e,_t(t,e))},Rt=()=>c(void 0,void 0,void 0,function*(){const{prebid:e,tcf:t,country:n,isMobileApp:i,fullscreenScroll:r}=d.get();if(!(null==e?void 0:e.enabled))return;const{initNativeAd:o}=d.getHandlers(),{getConsentAsync:s}=Se(t,i,n),a=yield s(),l=(()=>{let e=!1,t=[];const n={relevantCb:{timeout:1e3},auctionCb:{timeout:2e3}};return{getCancel:()=>e,setCancel:t=>{e=t},events:n,failsafeOnTimeout:i=>{const r=ht(),{prebid:{relevantCbTimeout:o}={}}=d.get(),s="relevantCb"===i&&o?o:n[i].timeout,a=setTimeout(()=>{!n[i].done&&!e&&(console.warn(`Doing failsafe loadTags() call after waiting too long for '${i}'`),e=!0,r.loadTags&&r.loadTags())},s);t.push(a)},cleanup:()=>{t.forEach(e=>clearTimeout(e)),t=[],e=!1,n.relevantCb.done=!1,n.auctionCb.done=!1}}})(),c=ht(),u=(()=>{const{requests:{user:e={userIds:[]},keywords:t={}}={}}=ht();return{user:e,keywords:t}})();l.failsafeOnTimeout("relevantCb");const{user:{externalUid:v=""}={},keywords:p}=u;(()=>{const e=mt();return e.cmd||(e.cmd=[]),e.cmd})().push(()=>{if(l.getCancel()||!c.loadTags)return N("core loadTags() call was cancelled",{cancel:l.getCancel(),apnTagLoadTags:!c.loadTags,condition:"or"}),void l.cleanup();const t=mt();l.events.relevantCb.done=!0,l.failsafeOnTimeout("auctionCb");const i=a?{gdpr:{cmpApi:"iab",timeout:8e3}}:{cmpApi:"none"};N("prebid consentManagement",i),t.addPrebidConfig(Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},ut(n)),yt(p,v))),N("core add prebid config",Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},ut(n)),yt(p,v))),t.loadPrebid({configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{l.getCancel()||(l.events.auctionCb.done=!0,c.loadTags(e)),l.cleanup()}},customNativeRender:e=>{Ft(e,o)},directRenderFn:e=>{const{settings:t,renderFn:n}=e,{bid:i,adDiv:o}=t||{};if(!o)return;const s=n(t),a=Object.assign(Object.assign({},i),{targetId:o.id,banner:!0});J(a)&&(Mt(a,r),(e=>{const t=()=>{const t=e.contentDocument;if(!(null==t?void 0:t.body))return;const n=()=>{const e=t.querySelector("iframe");if(!e)return!1;const n=()=>{var t;const n=null===(t=e.contentDocument)||void 0===t?void 0:t.querySelector(".adn-ttpa-container");n&&(n.style.setProperty("bottom","10px","important"),n.style.setProperty("top","unset","important"))};return e.addEventListener("load",n),n(),!0};if(n())return;const i=new MutationObserver(()=>{n()&&i.disconnect()});i.observe(t.body,{childList:!0,subtree:!0})};e.addEventListener("load",t),t()})(s))}}),N("core load prebid",{configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{l.getCancel()||(l.events.auctionCb.done=!0,c.loadTags(e))}},customNativeRender:e=>{Ft(e,o)},directRenderFn:()=>{}})})}),Ft=(e,t)=>{var n;const{divId:i,native:r,bid:o}=e,s=document.querySelectorAll(`[id^=${i}]`)[0],a=`RY-${s.id}`;((e,t)=>{e.childNodes.forEach(e=>e.style.cssText="position: absolute; z-index: -1;");const n=document.createElement("div");n.setAttribute("id",t),e.appendChild(n)})(s,a);const l=null===(n=s.getElementsByTagName("iframe")[0])||void 0===n?void 0:n.contentWindow;t({native:r,targetId:a},d.get()),null==l||l.postMessage(JSON.stringify({message:"Prebid Response",ad:"\x3c!-- nothing --\x3e",adId:o.adId}),"*")};let Vt="";const Ut=new Map,Ht=e=>{var t;const n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement,i=(null==n?void 0:n.offsetHeight)||0;n&&(n.style.minHeight=`${i}px`)},zt=e=>{const t=e.parentElement;if(!e||!t)return;const{container:n,wrapper:i}=(e=>{const t=m.getData("initialClassNames")[e.id];return{wrapper:(null==t?void 0:t.wrapper)?t.wrapper.join(" "):"",container:(null==t?void 0:t.container)?t.container.join(" "):""}})(e);e.className=n,t.className=i},Wt=()=>{w();document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{T(e.id),zt(e),(e=>{const t=document.querySelector(`#${e}`),n=null==t?void 0:t.getAttribute("data-probable-height"),i=null==t?void 0:t.getAttribute("data-probable-width");n&&i&&(null==t||t.style.setProperty("min-height",n+"px"),null==t||t.style.setProperty("min-probable-width",i+"px"))})(e.id),e.innerHTML="",e.id=_(e.id)}),v(()=>window.apntag.clearRequest())},Kt="noGroupedPlacements",Jt=e=>{const t=e.replace(/[0-9]/g,"");return"_"===t.slice(-1)?t.substring(0,t.length-1):t},Gt=e=>{if(!(null==e?void 0:e.minViewWidth))return!0;return window.innerWidth>=e.minViewWidth},Yt=e=>{var t;if(!(null===(t=null===window||void 0===window?void 0:window.advertory)||void 0===t?void 0:t.initialized))return[];const{placements:n,queryConfig:i,deviceType:r}=d.get(),o=n[r].filter(Gt)||[],s=e?document.querySelector(e):document;if(!s)return[];const a=o.reduce((e,t)=>{const n=Jt(t.id);return!n||e.includes(n)||e.push(n),e},[]).flatMap(e=>{const t=new RegExp(`^${e}(_(\\d+))?$`),n=o.filter(({id:e})=>e.match(t)),a=(null==i?void 0:i.queryByDataDevice)?`div[id^="${e}"][data-device=${r}], div[id^="${e}"][data-device=all]`:`div[id^="${e}"]:not([data-disabled="true"])`,l=s.querySelectorAll(a),c=Array.from(l).filter(({id:e})=>e.match(t)).map((e,t)=>{const i=Qt(e,t,n),r=`${e.id}-${((e=6)=>{if(e<=0)return"";let t="";for(let n=0;n<e;n++)t+=u[Math.floor(36*Math.random())];return t})(6)}`;return e.id=r,e.setAttribute("data-advertory-ad-rendered","true"),i.finnBlink&&!i.finnBlink.renderOnlyWithAdBlock&&e.setAttribute("data-is-finn-blink-placement","true"),(e=>{var t;const n=e.id;n&&m.setData("initialClassNames",{[n]:{wrapper:null===(t=e.parentElement)||void 0===t?void 0:t.className.split(" "),container:e.className.split(" ")}})})(e),Object.assign(Object.assign({},i),{id:r})});return(e=>{const{keywordsConfig:t}=d.get();return(null==t?void 0:t.includeCountingKeywordInTags)?(Vt!==window.location.pathname&&(Ut.clear(),Vt=window.location.pathname),e.map(e=>{var t;const n=e.invCode.replace(/_\d+$/,""),i=null!==(t=Ut.get(n))&&void 0!==t?t:0;return e.keywords=Object.assign({},e.keywords),e.keywords[`${me()}-count`]=i,Ut.set(n,i+1),e})):e})(c)});return(e=>{const t=Array.from(document.querySelectorAll('div[class^="advertory"]'));return e.sort((e,n)=>t.findIndex(t=>t.id===e.id)-t.findIndex(e=>e.id===n.id))})(a)},Qt=(e,t,n)=>{const i=n[t],r=n[n.length-1],o=n.filter(({id:t})=>t===e.id)[0];return(null==e?void 0:e.id)===(null==i?void 0:i.id)?i:(null==e?void 0:e.id)===(null==r?void 0:r.id)?r:o||r},Xt=e=>{const{queryConfig:{placementBatches:t}={},deviceType:n}=d.get(),i=(null==t?void 0:t[n])||{},r=Object.values(i).flat(),o=(e=>{const t={};return e.forEach(e=>{const n=_(e.id);e.isBackfill&&(t[n]=[e])}),t})(e),s=((e,t)=>{const n={};for(const[i,r]of Object.entries(t))n[i]=e.filter(e=>r.includes(_(e.id)));return n})(e,i),a=Object.keys(o),l=((e,t)=>e.filter(e=>!t.has(_(e.id))))(e,new Set([...a,...r]));return Object.assign(Object.assign(Object.assign({},s),o),{[Kt]:l})},Zt=(e,t,n)=>{const i=document.getElementById(`div_utif_${e}`);if(!i)return;const{apntag:r}=window,[o,s]=t;if(!i.dataset.lockedsize&&s&&o)i.style.width=`${o}px`,i.style.height=`${s}px`,n&&(r.resizeAd(i.id,[o,s]),i.dataset.lockedsize="true",i.dataset.lockedwidth=o.toString(),i.dataset.lockedheight=s.toString());else if(null==i?void 0:i.dataset.lockedsize){const{lockedwidth:e,lockedheight:t}=i.dataset;e&&t&&r.resizeAd(i.id,[e,t])}},en=["netboard","board"];class tn{constructor(e,t){this.identityFacade=e,this.tracker=t}buildUrl(e,t){var n,i;const{editionName:r}=e,o=(()=>{const e=window.location.href;return new URL(e).searchParams.get("dre_override_inv_code")||""})(),s=JSON.stringify(null!==(i=null===(n=window.advertory)||void 0===n?void 0:n.renderedDrEditionAds)&&void 0!==i?i:[]),a=new URL("https://dr-edition-teaser-server.inventory.schibsted.io/editions"),{envId:d,spid:l}=t;return a.searchParams.append("editionName",r),o&&a.searchParams.append("urlData",o),s&&a.searchParams.append("excludedItems",s),l&&a.searchParams.append("spid",l),d&&a.searchParams.append("envid",d),a.toString()}fetchData(e){return c(this,void 0,void 0,function*(){var t,n;const i=yield this.identityFacade.getIdentityUser(),r=null!==(n=yield null===(t=this.tracker)||void 0===t?void 0:t.getEnvironmentId())&&void 0!==n?n:"",o=(null==i?void 0:i.userId)?String(i.userId):"",s=this.buildUrl(e,{envId:r,spid:o});try{N("Starting fetching DrEdition ad from URL:",s);const e={method:"GET"},t=yield Qe.get(s,e);return N("Fetch operation completed successfully."),t}catch(e){N("Error during fetch operation:",e)}return null})}}let nn=class{getDrEditionUTMParams(e,t){var n;const{title:i="",clientName:r,creativeId:o}=null!==(n=null==e?void 0:e.pulseData)&&void 0!==n?n:{},{editionName:s}=t,a=i.replace(/<[^>]*>/g,"");return Object.assign({utm_source:"vgfront",utm_content:s,utm_campaign:r,utm_medium:a},o&&{utm_id:`df-${o}`})}getUrlSearchParams(e,t,n){if(!e)return"";const i=this.getDrEditionUTMParams(t,n),r=new URLSearchParams(decodeURIComponent(e.search)),o=new URLSearchParams(e.search);return Object.entries(i).forEach(([e,t])=>{r.has(e)||o.set(e,null!=t?t:"")}),o.toString().replace(/\+/g,"%20")}getUrlWithParams(e,t){var n;const i=null===(n=null==e?void 0:e.pulseData)||void 0===n?void 0:n.url;if(!i)return"";const r=this.getDrEditionUTMParams(e,t),o=new URL(i);return Object.entries(r).forEach(([e,t])=>{o.searchParams.has(e)||o.searchParams.set(e,null!=t?t:"")}),o.toString()}handleVideo(e,t){return c(this,void 0,void 0,function*(){const{id:n,autoplay:i,mute:r,videoLoop:o,vendor:s}=t.videoConfiguration;e.classList.add("vgtv-video-container"),Object.assign(e.dataset,{vgtvVideoId:n,vgtvVendor:s,vgtvAutoplay:i,vgtvMuted:r,vgtvLoop:!!o,vgtvNa:!0,vgtvRecommended:!1,vgtvPulseProvider:"vg",vgtvPulseProductTag:"partnerstudio"})})}getPulseObjectId(){return"sdrn:vg:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(){return"sdrn:vg:frontpage:front"}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];const{host:i,pathname:r}=new URL(n);if(!i.includes("www.vg.no")&&!r.includes("annonsorinnhold"))return[n];const o=r.split("/");return o.length?[...o.filter(Boolean).slice(1).map(e=>e),n]:[n]}};const rn=e=>{const t=e.parentElement;t?t.classList.remove("dr-edition-lock-height"):N("Dr. Edition container does not have a parent element, cannot remove height lock.")};class on{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(e,t){return c(this,void 0,void 0,function*(){var n,i;const{drEditionConfig:{containerSelector:r},renderAsBackfill:o=!1}=t,s=e.querySelector(r);if(!s)return void N(`Container with selector "${r}" not found.`);const a=yield this.drEditionService.fetchData(t);return(null==a?void 0:a.itemId)||o?!(null==a?void 0:a.itemId)&&o?(N("No Dr. Edition ads available to render. Collapsing whole placement."),T(e.id),void rn(s)):((null==a?void 0:a.itemId)&&o&&(N("Dr. Edition ad available to render as a Xandr backfill."),I(e.id)),void(a?(a.css&&((e,t)=>{const n=document.createElement("link");n.rel="preload",n.href=e,n.as=t,document.head.appendChild(n)})(a.css,"style"),yield this.rendererManager.render(s,a,t),yield null===(n=this.videoManager)||void 0===n?void 0:n.handle(a,t),rn(s),this.drEditionAds.push(a),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(a.itemId),this.observeAdView(e,a,t),null===(i=e.querySelector("a"))||void 0===i||i.addEventListener("pointerup",()=>null)):rn(s))):(N("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(s),this.showBackfill(e),void rn(s))})}observeAdView(e,t,n){this.observeCarousel(e,t,n)||((e,t,n={threshold:.5})=>{new IntersectionObserver(([e],n)=>{e.isIntersecting&&(t(),n.disconnect())},n).observe(e)})(e,()=>this.pulseManager.trackContentView(e,t,n),{threshold:.5})}showBackfill(e){var t;const n=e.querySelector(".fallback");if(!n)return;n.style.display="block";const i=null!==(t=n.dataset.fallbackTargetId)&&void 0!==t?t:"";I(i)}hideDrEdition(e){e.style.display="none"}observeCarousel(e,t,n){const i=e.querySelector(".dr-edition-slider");if(!i)return!1;let r=null;const o=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&e.intersectionRatio>=.9&&(r&&clearTimeout(r),r=setTimeout(()=>{e.target.onclick=()=>this.pulseManager.trackContentClick(e.target,t,n),this.pulseManager.trackContentView(e.target,t,n)},500)),[...i.children].forEach(e=>{o.observe(e)})})},{threshold:[.9]});return[...i.children].forEach(e=>{o.observe(e)}),!0}}class sn{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(e,t,n){return c(this,void 0,void 0,function*(){if(!(null==t?void 0:t.itemId))return;const{getConsentAsync:i}=Se(n.tcf,n.isMobileApp,n.country),r=yield i(),o=$(n.device)?t.mobileHTML:t.desktopHTML,s=r?o:o.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");e.innerHTML=s,e.querySelectorAll("a").forEach(e=>{var i,r,o;e.search=null!==(o=null===(r=(i=this.newsroomStrategy).getUrlSearchParams)||void 0===r?void 0:r.call(i,e,t,n))&&void 0!==o?o:"",e.onclick=()=>this.pulseManager.trackContentClick(e,t,n)})})}}class an{constructor(e){this.strategy=e}handle(e,t){return c(this,void 0,void 0,function*(){const{videoConfiguration:{id:n,preview:i}={}}=e;(n||i)&&(yield this.importScript(t),yield this.createVideoElement(e,t))})}importScript(e){return c(this,void 0,void 0,function*(){const t=e.drEditionConfig.videoScriptUrl,n=document.querySelector(`script[src="${t}"]`);if(t&&!window.autoplayQueue&&!n)try{yield ft(t)}catch(e){N("Error! Failed to prepare SVP player script for Dr. Edition!",e)}})}createVideoElement(e,t){return c(this,void 0,void 0,function*(){const n=document.createElement("div"),{node:i}=e.videoConfiguration,r=[...document.querySelectorAll(`#${i}`)||[]].find(e=>0===e.children.length);if(this.handlePreviewVideo(e,t))return;this.strategy.handleVideo(n,e),null==r||r.appendChild(n),window.autoplayQueue=window.autoplayQueue||[],window.autoplayQueue.push(e=>{e.parse()});const o=null==r?void 0:r.parentNode;if(!o)return;const s=o.closest("a");o.addEventListener("click",e=>{const t=e.target.closest("a");s!==t&&t||(e.stopPropagation(),e.preventDefault())})})}handlePreviewVideo(e,t){var n,i,r;const{preview:{url:o,thumbnail:s}}=null!==(n=e.videoConfiguration)&&void 0!==n?n:{};if(!o)return!1;const a=document.querySelector(".dr-edition-preview .preview-video");return!!a&&(a.setAttribute("src",o),a.setAttribute("playsinline",""),!(!a||!s)&&(null===(r=(i=t.drEditionConfig).addPreviewVideo)||void 0===r||r.call(i,a),!0))}}let dn=class{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t,n,i){return{}}mapPageType(e){return{front:"Frontpage",article:"Article",section:"Article",collection:"Article",other:"Article"}[e||"front"]||"Frontpage"}getArticleId(){return location.pathname.split("/").slice(-2,-1).pop()||""}getTeaserElementText(e,t){if(!e)return"";const n=e.querySelector({title:".dr-edition-title",subtitle:".dr-edition-subtitle",image:"img.teaser-main-image"}[t]);if(!n)return"";if("image"===t)return n.src||"";const i=null==n?void 0:n.textContent;return i?i.trim():""}getEventTarget(e,t){const{itemId:n,pulseData:{url:i}={}}=t,r=this.getTeaserElementText(e,"title");return{id:n,name:this.normalizePlacementTitle(null!=r?r:""),type:"Page",url:i}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(e,t,n){return c(this,void 0,void 0,function*(){var i,r,o,s,a,d,l,c;if(!this.pulse)return;const u=this.getEventInput(e,t,n,"view");(null===(i=this.pulse)||void 0===i?void 0:i.trackLegacyViewUIElement)?null===(o=null===(r=this.pulse)||void 0===r?void 0:r.trackLegacyViewUIElement)||void 0===o||o.call(r,u):(null===(s=this.pulse)||void 0===s?void 0:s.trackViewUIElement)?null===(d=null===(a=this.pulse)||void 0===a?void 0:a.trackViewUIElement)||void 0===d||d.call(a,u):null===(c=null===(l=this.pulse)||void 0===l?void 0:l.trackElementView)||void 0===c||c.call(l,u)})}trackContentClick(e,t,n){return c(this,void 0,void 0,function*(){var i,r,o,s,a,d;if(!this.pulse)return;const l=this.getEventInput(e,t,n,"click");this.pulse.trackLegacyClickUIElement?null===(r=(i=this.pulse).trackLegacyClickUIElement)||void 0===r||r.call(i,l):this.pulse.trackClickUIElement?null===(s=(o=this.pulse).trackClickUIElement)||void 0===s||s.call(o,l):null===(d=(a=this.pulse).trackElementClick)||void 0===d||d.call(a,l)})}};class ln extends dn{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){const{pulseData:{title:i,clientName:r="",creativeId:o}={}}=t,{columnName:s,primaryPosition:a}=n;return{"@type":"UIElement",elementType:"Teaser",layout:{elementSize:"large",imageUrl:"",name:"large"},name:i,placement:{columnName:s,primaryPosition:a},"spt:custom":{is_sponsored:!0,sponsor:r,"spt:creativeId":o},url:location.origin}}getEventInput(e,t,n){return{object:this.getEventBaseData(e,t,n),target:this.getEventTarget(e,t)}}}let cn=class extends dn{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){var i,r,o,s,a,d;const{itemId:l,pulseData:{clientName:c,creativeId:u}={}}=t,v=n.editionName,p=this.mapPageType(this.pageType),g=null===(i=this.newsroomStrategy)||void 0===i?void 0:i.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getPulseObjectId)||void 0===o?void 0:o.call(r))&&void 0!==s?s:v,"@type":"UIElement",position:v,elementType:"Article",custom:{customer:c,creativeId:null!=u?u:l},page:{"@id":null!=g?g:v,"@type":p,url:location.origin},tags:null===(d=null===(a=this.newsroomStrategy)||void 0===a?void 0:a.getTags)||void 0===d?void 0:d.call(a,e)}}getEventInput(e,t,n,i){return{object:this.getEventBaseData(e,t,n),partnerstudio:this.getEventPartnerstudioData(e,t,n,i),target:this.getEventTarget(e,t),provider:this.getProviderData()}}getEventPartnerstudioData(e,t,n,i){var r,o,s,a;const{pulseData:{algorithm:d="sov",clientName:l,creativeId:c,editionId:u,itemId:v,url:p,probability:g}={}}=t,h=Math.floor(Date.now()/1e3),m=this.getTeaserElementText(e,"title"),y=this.getTeaserElementText(e,"subtitle"),f=this.getTeaserElementText(e,"image"),w=null!==(a=null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getUrlWithParams)||void 0===o?void 0:o.call(r,t,n))&&void 0!==s?s:p)&&void 0!==a?a:"";return{algorithm:d,clientName:l,probability:g,creativeId:c,device:n.device,editionId:u,itemId:v,link:w,placement:n.editionName,subtitle:y,time:h,title:m,type:i,imageUrl:f,frontId:86,tracking_type:"ad",xandrAdLoaded:!1}}getProviderData(){return{productTag:"partnerstudio"}}};const un=(e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})},vn=e=>c(void 0,void 0,void 0,function*(){var t,n;return(null===(t=null===window||void 0===window?void 0:window.SVP)||void 0===t?void 0:t.Player)?new window.SVP.Player(e):((()=>{const e="svp-player-sdk",t=document.querySelector(e),n=Array.from(document.querySelectorAll('script[src^="https://cdn.stream.schibsted.media/player"]'));if(t||n.length>0)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.stream.schibsted.media/player/3.78.1/player.min.js",i.async=!0;try{i.src=i.src.replace("player.min","player.next.min")}catch(e){console.error("Failed to set player.next.min source:",e)}document.head.insertBefore(i,document.head.firstChild)})(),(null===(n=window.SVP)||void 0===n?void 0:n.isLoaded)?new window.SVP.Player(e):yield new Promise(t=>{window.addEventListener("onSvpPlayerReady",()=>t(new window.SVP.Player(e)))}))}),pn={ContentMutePlugin:e=>{window.SVP.Player.Plugins.register({getName:()=>"ContentMutePlugin",initialize(){},setup(){const t=this.player.config.get("mute");this.container=e||this.player.getContainer(),this.muted=t,t&&this.listenToOnce(this.player,"ready",this.renderButtonElement,this)},getButtonElement(){const e=document.createElement("button");e.className="player-plugin-content-mute";const t=document.createElement("span");return t.className="volume-button-icon",e.appendChild(t),e},renderButtonElement(){this.buttonElement=this.getButtonElement(),this.buttonElement.addEventListener("click",this.onButtonClick.bind(this)),this.container.appendChild(this.buttonElement),this.isVideo()||(this.buttonElement.style.display="none"),this.getJWPlayer()&&this.getJWPlayer().on("mute",this.onMuteChange,this)},onButtonClick(){this.getJWPlayer()&&(this.container.classList.add("has-interacted"),this.muted=!this.muted,this.getJWPlayer().setMute(this.muted))},onMuteChange(e){this.muted=e.mute,this.muted?this.buttonElement.classList.remove("content-video-volume-on"):this.buttonElement.classList.add("content-video-volume-on")},isVideo(){return"video"===this.player.getRawAsset().assetType},getJWPlayer(){return this.player.model.player}})},IntegrationMenu:()=>{window.SVP.Player.Plugins.register({getName:()=>"IntegrationMenu",setup(){return c(this,void 0,void 0,function*(){yield Promise.resolve().then(function(){return fo})})}})}},gn=(e,t)=>{null==e||e.forEach(e=>{pn[e](t)})};class hn{handleVideo(e,t){return c(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:r,vendor:o}}){yield c(void 0,void 0,void 0,function*(){return yield new Promise(e=>{var t;Boolean(null===(t=window.SVP)||void 0===t?void 0:t.Player)?e(!0):window.addEventListener("onSvpPlayerReady",()=>e(!0))})});const s=["ContentMutePlugin"],a=this.createPlayerOverlay(e);gn(s,a);const d={id:t,node:n,autoplay:i,mute:r,vendor:o,autopause:"viewable",maxBitrate:600,pulse:{provider:"e24"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"e24-default",url:""}},l=yield vn(d);l.once("assetReady",()=>{un(l,s)}),l.once("ready",()=>{const t=e;new MutationObserver(e=>{e.forEach(({type:e,attributeName:n})=>{"attributes"===e&&"class"===n&&(t.classList.contains("jw-state-playing")?a.classList.add("is-playing"):a.classList.remove("is-playing"),t.classList.contains("jw-flag-user-inactive")?a.classList.add("is-inactive"):a.classList.remove("is-inactive"))})}).observe(t,{attributes:!0,attributeFilter:["class"]})}),l.once("PulseStats:ready",()=>c(this,void 0,void 0,function*(){const e=yield l.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"e24",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:e24:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===vt.FRONT?"sdrn:e24:frontpage:front":`sdrn:e24:article:${t}`}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];if(!n.includes("https://e24.no/annonsorinnhold/"))return[n];const{pathname:i}=new URL(n),r=i.split("/").filter(Boolean);return r.length?[...r.slice(1),n]:[n]}createPlayerOverlay(e){const t=document.createElement("div");t.classList.add("cm-custom-video-overlay"),e.parentElement&&(t.innerHTML=e.parentElement.innerHTML,e.parentElement.replaceChild(t,e));return t.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),t.classList.add("has-interacted")}),t}}const mn="https://www.aftonbladet.se/video-player-extras/latest/";class yn{handleVideo(e,t){return c(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:r,vendor:o}}){const s={id:t,node:n,autoplay:i,mute:r,vendor:o,autopause:"viewable",maxBitrate:600,pulse:{provider:"aftonbladet"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"",url:""},plugins:{[`${mn}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${mn}external-link.js`]:{name:"ExternalLink"}}};yield vn(s),this.addEditionVideoClass(e)})}addEditionVideoClass(e){var t;(null===(t=null==e?void 0:e.parentElement)||void 0===t?void 0:t.parentElement)&&e.parentElement.parentElement.classList.add("dr-edition-video-player")}getPulseObjectId(){return""}getPulsePageId(){return""}}const fn=e=>null!==e&&"object"==typeof e&&!Array.isArray(e);class wn{handleVideo(e,t){return c(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:r,vendor:o}}){const s={id:t,node:n,autoplay:i,mute:r,vendor:o,locale:"se",autopause:"viewable",maxBitrate:600,sharing:!1,recommended:!1,pulse:{provider:"svdse",decorator:(e,t)=>Object.assign(Object.assign({},fn(e)?e:{}),{provider:Object.assign(Object.assign({},fn(null==e?void 0:e.provider)?e.provider:{}),{productTag:"partnerstudio"})})},skin:{name:"svd-player",url:""},settings:{pulse:{host:"se-aftonbladet.videoplaza.tv",contentMetadata:{category:"SvD",tags:["standard-linears","pause",`video-${t}`]},requestSettings:{}}}},a=yield vn(s);a.once("PulseStats:ready",()=>c(this,void 0,void 0,function*(){const e=yield a.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"svdse",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:svdse:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===vt.FRONT?"sdrn:svdse:frontpage:front":`sdrn:svdse:article:${t}`}}let bn=class{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}};const En=(e,t,n)=>{var i;const{publisher:r,pageType:o,country:s}=e,a={[we.VG]:new nn,[we.E24]:new hn,[we.AFTONBLADET]:new yn,[we.SVD]:new wn}[r]||new bn,d=new(s===ge.SE?ln:cn)(n,a,o),l=new tn(t,null!==(i=null==n?void 0:n.pulseTracker)&&void 0!==i?i:n),c=new sn(a,d),u=new an(a);return new on(l,c,u,d)},Tn=()=>c(void 0,void 0,void 0,function*(){return yield new Promise(e=>{if("undefined"!=typeof window)if(window.Identity)e(window.Identity);else{const t=()=>{e(window.Identity)};window.addEventListener("identity-initialized",t,{once:!0})}else e(void 0)})});class In{constructor(e){this.identity=e,this.getIdentityUser=this.getIdentityUser.bind(this),this.isUserLoggedIn=this.isUserLoggedIn.bind(this),this.onIdentityLogout=this.onIdentityLogout.bind(this)}getIdentityUser(){return c(this,void 0,void 0,function*(){var e;try{const t=yield null===(e=this.identity)||void 0===e?void 0:e.getUser();return null!=t?t:null}catch(e){return N("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return c(this,void 0,void 0,function*(){var e,t;return null!==(t=yield null===(e=this.identity)||void 0===e?void 0:e.isLoggedIn())&&void 0!==t&&t})}onIdentityLogout(e){var t;null===(t=this.identity)||void 0===t||t.on("logout",e)}}const kn=(e,t,n)=>{const{wrapperSelector:i}=null==e?void 0:e.drEditionConfig,r=document.querySelectorAll(i),o=new IntersectionObserver((i,r)=>((e,t,n,i,r)=>{const o=En(n,i,r);e.forEach(e=>{var i,r,s;if(!e.isIntersecting)return;const a=e.target,d=null!==(i=a.dataset.editionName)&&void 0!==i?i:"",l=null!==(r=a.dataset.pulseColumnname)&&void 0!==r?r:"",c=null!==(s=a.dataset.pulsePrimaryposition)&&void 0!==s?s:"";o.fetchAndRenderAd(a,Object.assign(Object.assign({},n),{editionName:d,columnName:l,primaryPosition:c})),t.unobserve(a)})})(i,r,e,t,n),{rootMargin:"400% 0px"});r.forEach(e=>o.observe(e))},An=[],Cn=(e,t)=>c(void 0,void 0,void 0,function*(){var n;const{pulse:i,tcf:r,deviceType:o,drEdition:s,publisher:a,pageType:d,country:l,isMobileApp:c}=e;if(!(yield Ve(r,c,l,"handleDrEditionBackfill")))return;const u=((e,t)=>{var n;const{deviceType:i,placements:r,drEdition:{fallbackGlobalEditionName:o}={}}=e,s=r[i]||r.desktop,a=_(t.targetId),d=s.find(e=>e.id===a),l=en.some(e=>a.startsWith(e)),c=An.includes(a),u=(null===(n=null==d?void 0:d.drEdition)||void 0===n?void 0:n.editionName)||o;return d&&l&&!c&&u?(An.push(a),Object.assign(Object.assign({},d),{drEdition:Object.assign(Object.assign({},d.drEdition),{editionName:u})})):null})(e,t);if(!u)return;if(!(null==i?void 0:i.instance))return void N("Pulse has not been passed as a prop, aborting");const v=yield Tn(),p=new In(v),g=En({publisher:a,pageType:d,country:l},p,null==i?void 0:i.instance),h=document.getElementById(t.targetId);if(!h||!s)return;h.classList.value="";const m=document.createElement("div");m.className=s.containerSelector.replace(/^[.#:[\]]+/,""),h.innerHTML=m.outerHTML;const y={editionName:(null===(n=null==u?void 0:u.drEdition)||void 0===n?void 0:n.editionName)||"",drEditionConfig:s,device:o,tcf:r,isMobileApp:c,country:l,renderAsBackfill:!0};yield g.fetchAndRenderAd(h,y)}),Sn="collapseAd",On="hideAd",Pn="resizeAd",$n="renderDrEditionFallback",Ln="wallpaperImageUrl",xn="wallpaperColor",Nn="velvet",jn=[Pn,Ln,xn,Sn,On,$n,Nn];let _n;const qn=e=>{if("object"==typeof e)return e;if(t=e,E.test(t)){const t=e.replace(/^wallpaper:url:/,"");return{name:Ln,wallpaperImageUrl:t}}var t;if((e=>e.startsWith("wallpaper:color:"))(e)){const t=e.replace(/^wallpaper:color:/,"");return{name:xn,wallpaperColor:t}}if(e.startsWith($n)){const t=e.split(":")[1];return{name:$n,targetId:t}}if(e.startsWith(Sn)||e.startsWith(On)){const t=e.split(":")[1];return{name:Sn,targetId:t}}if(e.includes("name")&&jn.some(t=>e.includes(t)))try{return JSON.parse(e)}catch(e){}},Dn=e=>{if(!["http://acdn.adnxs-simple.com","https://acdn.adnxs-simple.com","https://crcdn01.adnxs-simple.com","http://crcdn01.adnxs-simple.com","https://acdn.adnxs.com","http://acdn.adnxs.com","https://adsdk.microsoft.com","https://adsdk.bing.net","https://adsdkprod.azureedge.net"].includes(e.origin.trim()))return;const{data:t}=e;if(!t)return;const n=qn(t);if(!n)return;if(!n.name||!jn.some(e=>n.name===e))return;const{name:i,targetId:r,wallpaperImageUrl:o,wallpaperColor:s,cmd:a,size:l}=n;i===Nn&&a&&(a.includes("noScroll")&&(_n=(e=>{if(!e)return()=>{};const t=e.style.overflow;return e.style.setProperty("overflow","hidden"),()=>{e.style.setProperty("overflow",t)}})(document.querySelector("body"))),(a.includes("close")||a.includes("ended"))&&(null==_n||_n(),dispatchEvent(new CustomEvent("advertory:closeTakeover",{})))),i!==Sn&&i!==On||!r||T(r),i===Pn&&r&&a&&Zt(r,a),i===$n&&r&&(T(r),Cn(d.get(),{targetId:r})),"resizeMediationAd"===i&&r&&l&&Zt(r,l,!0),i===Ln&&o&&(e=>{const t=document.querySelector(`.${y}`);t&&(t.style.backgroundImage=`url(${e})`)})(o),i===xn&&s&&(e=>{const t=document.querySelector(`.${y}`);t&&(t.style.backgroundColor=e)})(s)},Mn=e=>({rootMargin:`${e}px 0px ${e}px 0px`}),Bn=(e,t)=>{if(ie(t))return N(`loading finn blink ad with full ads chain for ${t}`),void k().withFullAdsChain(t);v(()=>(N("core showTag",{id:t}),e.showTag(t)))},Rn=(e,t)=>c(void 0,void 0,void 0,function*(){yield p,yield g;const n=new IntersectionObserver((e,t)=>((e,t,n)=>{e.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(e=>{const{target:i}=e,r=(e=>{const t=e.dataset.showTagSubscribeId;return!e.id.length&&t?t:e.id})(i),o=document.getElementById(r);N("core log from intersection observer handler",{targetId:r,element:o}),n(window.apntag,r),o&&(t.unobserve(o),t.disconnect())})})(e,t,Bn),Mn(t));n.observe(e)}),Fn=new Map,Vn=["no-stavangeraftenblad","sa","no-aftenposten","aftenposten","no-bergenstidende","bt"],Un=".brandstudio-premium-content-widget",Hn=({adWrapper:e,placementContainer:t})=>t.offsetHeight+(({adWrapper:e})=>{const{paddingTop:t,paddingBottom:n}=getComputedStyle(e);return parseFloat(t)+parseFloat(n)})({adWrapper:e}),zn=({adWrapper:e,placementContainer:t})=>{const n=Hn({adWrapper:e,placementContainer:t});var i;null==e||e.style.setProperty("height",`${n}px`),zt(i=t),i.innerHTML=""},Wn=e=>{e&&e.style.getPropertyValue("height")&&e.style.removeProperty("height")},Kn=({adWrapper:e,placementContainer:t})=>{const{publisher:n}=d.get(),i=Vn.includes(n)&&Boolean(t.closest(Un));const r=i?t.closest(Un):null,o=new MutationObserver(t=>{t.forEach(({addedNodes:t})=>{t.forEach(t=>{const n=t instanceof HTMLElement,s=n&&t.matches("iframe, article")&&e;if(!n||!i&&!s||i&&!r)return;if(s)return Wn(e),void o.disconnect();const a=t.closest('[style*="height"]'),d=r;a&&d.contains(a)?Wn(a):d.hasAttribute("style")&&Wn(d),o.disconnect()})})});try{o.observe(t,{childList:!0,subtree:!0})}catch(e){o.disconnect()}},Jn=(e,t,n,i,r,o)=>{var s;const a=performance.now(),d=null!==(s=Fn.get(t))&&void 0!==s?s:0,l=((e,t)=>!!t&&e+t<(new Date).getTime())(i,r)&&n<0;a-d>=r&&l&&(Fn.set(t,a),((e,t,n)=>{const i=null==n?void 0:n.parentElement;i&&n&&zn({adWrapper:i,placementContainer:n}),v(()=>{e.setKeywords([t],{[`${he()}-adreload`]:"1"},{overrideKeyValue:!0}),e.refresh([t])})})(e,t,o))},Gn=(e,t,n,i)=>{const r=new IntersectionObserver((e,t)=>((e,t,n,i)=>{e.filter(({isIntersecting:e})=>e).forEach(e=>{const{target:r,boundingClientRect:o}=e;t(window.apntag,r.id,o.y,n,i,r)})})(e,Jn,n,i),Mn(t));r.observe(e)},Yn=(e,t=6)=>{const n=[];for(let i=0;i<e.length;i+=t){const r=e.slice(i,i+t);n.push(r)}return n},Qn=()=>navigator&&navigator.userAgent.match(/chrome/i)?null:navigator&&navigator.userAgent.match(/apple/i),Xn=(e,t=0)=>{const n=e.getBoundingClientRect(),i=window.innerHeight;return n.bottom>-t&&n.top<i+t},Zn=(e,t)=>{if(!(null==t?void 0:t.scrollRefreshEnabled))return;const{targetId:n}=e,i=document.querySelector(`#${n}`),r=null==i?void 0:i.parentElement;if(!r||!i)return;Kn({adWrapper:r,placementContainer:i});const{delayTime:o=1e3}=t,s=(new Date).getTime();if(i&&"true"!==i.dataset.subscribedForRefresh){const e=(e=>{var t;const{deviceType:n,preloadMarginsConfig:i}=d.get(),r=null==i?void 0:i[n];return((e,t)=>t[e])(null!==(t=e.dataset.priority)&&void 0!==t?t:"normal",(({high:e,normal:t,low:n}={})=>{var i,r,o,s,a,d;return{high:{refreshMargin:null!==(i=null==e?void 0:e.refreshMargin)&&void 0!==i?i:600,renderMargin:null!==(r=null==e?void 0:e.renderMargin)&&void 0!==r?r:300},normal:{refreshMargin:null!==(o=null==t?void 0:t.refreshMargin)&&void 0!==o?o:300,renderMargin:null!==(s=null==t?void 0:t.renderMargin)&&void 0!==s?s:150},low:{refreshMargin:null!==(a=null==n?void 0:n.refreshMargin)&&void 0!==a?a:100,renderMargin:null!==(d=null==n?void 0:n.renderMargin)&&void 0!==d?d:50}}})(r)).refreshMargin})(i);i.dataset.subscribedForRefresh="true",i.dataset.refresh&&Gn(i,e,s,o)}},ei=e=>{const{refreshConfig:{visibilityStateRefreshEnabled:t=!1}={}}=d.get();if(!t)return;const n=()=>{"visible"===document.visibilityState&&document.removeEventListener("visibilitychange",n),oi(e)};"visible"!==document.visibilityState&&document.addEventListener("visibilitychange",n)},ti=(e,t,n)=>{const i=document.querySelectorAll('[data-bf-cache-refresh="true"]');for(const r of i){const i=e.find(e=>{var t;return e.id===(null===(t=r.firstElementChild)||void 0===t?void 0:t.id)&&e.bfCacheRefresh}),o=null==i?void 0:i.threshold;Xn(r,o)&&i&&(Ht(i.id),n.length&&r.classList.remove(...n),oi([i],t))}},ni=e=>{const{refreshConfig:{backForwardNavigationRefreshEnabled:t=!1}={},siteSpecificConfig:{classesToRemoveOnRefresh:n=[]}={},isMobileApp:i}=d.get();t&&(e.forEach(({id:e})=>{const t=ii(e);t&&(t.dataset.bfCacheRefresh="true")}),i?((e,t)=>{document.addEventListener("visibilitychange",()=>{ti(e,!0,t)})})(e,n):((e,t)=>{window.addEventListener("pageshow",n=>{const i=()=>{window.scrollY>0&&(window.removeEventListener("scroll",i),ti(e,!1,t))};n.persisted&&(Qn()?window.addEventListener("scroll",i,{passive:!0}):ti(e,!1,t))})})(e,n))},ii=e=>{var t,n;return null!==(n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement)&&void 0!==n?n:null},ri=e=>{const{id:t,allowedFormats:n}=e,i=(e=>{if(!e)return[];try{return JSON.parse(e.dataset.adSizes||"[]")}catch(e){return[]}})(ii(t)),r=(e=>1===e[0]&&1===e[1])(i),o={sizes:[i],allowedFormats:r?n:n.filter(e=>"native"!==e),allowSmallerSizes:!1};return r||(o.native=void 0),o},oi=(e,t=!1)=>{const{requestSize:n=s}=d.get(),i=e.map(({id:e})=>e),r=Yn(i,n);if(t)for(const t of e){const e=ri(t);window.apntag.modifyTag(t.id,e)}for(const e of r)v(()=>window.apntag.refresh(e))};const si="#fff",ai="#0098da",di="splash",li="welcomePage",ci="topscroller",ui="velvet",vi="takeover-displayed",pi="takeover-visit-count",gi=14400,hi=()=>{const e=Oe(pi);return e?parseInt(e):0},mi=()=>{const{takeover:{enabled:e=!1,secondVisitEnabled:t=!1}={}}=d.get();return!window.location.href.includes("takeover=0")&&(!!window.location.href.includes("takeover=1")||!(!e||(()=>{var e;const t=(null===(e=d.get().takeover)||void 0===e?void 0:e.cookieCapName)||vi;return"true"===Oe(t)})())&&(!t||yi()))},yi=()=>{const e=hi();return 0===e?((()=>{const e=hi(),{takeover:{cookieCapTime:t=gi}={}}=d.get(),n=document.location.hostname;window.document.cookie=`${pi}=${e+1}; max-age=${t}; domain=${n}; path=/`})(),!1):1===e},fi=(e,t)=>[[1,1],[1920,1080]].some(([n,i])=>n===e&&i===t),wi=()=>{const{takeover:e}=d.get();return Boolean(null==e?void 0:e.topscroller)},bi=()=>c(void 0,void 0,void 0,function*(){const e=document.location.hostname,{takeover:{cookieCapName:t=vi,cookieCapTime:n=gi}={},isMobileApp:i,tcf:r,country:o}=d.get(),s=yield Ve(r,i,o,"ad-takeover-cookiecap");n&&s&&(window.document.cookie=`${t}=true; max-age=${n}; domain=${e}; path=/`)}),Ei=e=>{var t;const n=!!(null===(t=d.get().takeover)||void 0===t?void 0:t.setCookieCapForNotShownAd);return Q(e)&&n},Ti=(e,t)=>{var n;if(t===ci){const{topscroller:t}=e;return null!=t?t:{}}if(t===di){const{splash:t}=e;return null!=t?t:{}}return null!==(n=e.welcomePage)&&void 0!==n?n:{}},Ii=(e,t)=>{t!==di?(e=>{var t,n,i;const r=null===(n=null===(t=d.get().takeover)||void 0===t?void 0:t.welcomePage)||void 0===n?void 0:n.headerElementSelector,o=null===(i=d.get().takeover)||void 0===i?void 0:i.topscroller;if(!r||o)return;const s=document.querySelector(r),a=document.querySelector(".welcome-page-wrapper"),l=document.querySelector(`#${e.targetId}`),c=document.querySelector(".advertory-welcome-page-scroll");if(!(s&&a&&c&&l))return;const u=null==s?void 0:s.offsetHeight,v=X(e)?"60svh":`calc(100svh - ${u}px)`,p=X(e)?"calc(40svh + 30px)":`calc(${u}px + 30px)`;a.style.setProperty("height",v,"important"),l.style.setProperty("height",v,"important"),c.style.setProperty("bottom",p,"important")})(e):(e=>{var t;if(!(null===(t=d.get().takeover)||void 0===t?void 0:t.splash))return;const n=document.querySelector(".advertory-splash-navbar-wrapper"),i=document.querySelector(`#${e.targetId}`);if(!n||!i)return;const r=`calc(100svh - ${n.offsetHeight}px)`;i.style.setProperty("height",r,"important")})(e)},ki=Et([],()=>{new MutationObserver((e,t)=>{document.querySelector("iframe")&&((()=>{const e=document.querySelector("iframe");e&&(e.onload=()=>{if(!e.contentDocument)return;document.body.style.height="100%",document.documentElement.style.height="100%",e.height="100%",e.width="100%";const t=e.contentDocument.createElement("style");t.textContent="\n .adform-adbox {\n height: 100% !important;\n width: 100% !important;\n }\n img {\n height: 100% !important;\n width: 100% !important;\n object-fit: cover !important;\n object-position: top !important;\n }\n ",e.contentDocument.head.appendChild(t)})})(),t.disconnect())}).observe(document.body,{childList:!0,subtree:!0})}),Ai=(e,t=!0)=>{(e===li||e===ci)&&(e=>{e?setTimeout(()=>window.scrollTo(0,0),100):window.scrollTo(0,10)})(t)},Ci=()=>{const e=parseInt(document.body.dataset.scrollY||"0",10);document.body.style.top="",window.scrollTo(0,e),document.body.classList.remove("page-locked")},Si=e=>{document.body.style.overflow=e?"initial":"hidden"},Oi=e=>{const t=$i(e),n=Pi(e);(e=>{e.classList.toggle("takeover-ad-hidden",!0)})(e),Si(!0),e.style.display="none",window.removeEventListener("keydown",t),window.removeEventListener("advertory:closeTakeover",n)},Pi=e=>{const t=()=>Oi(e);return window.addEventListener("advertory:closeTakeover",t),Ci(),t},$i=e=>{const t=t=>{["Enter","Escape"].includes(t.key)&&Oi(e)};return Ci(),window.addEventListener("keydown",t),t},Li=e=>{const t=e.querySelector(".advertory-splash-navbar-wrapper");t&&($i(e),Pi(e),Ci(),t.addEventListener("click",()=>{Oi(e)}),Si(!1))},xi=e=>{(e=>{window.addEventListener("scroll",()=>{e.getBoundingClientRect().bottom,(e=>{const t=e.getBoundingClientRect().bottom;e.style.opacity=""+t/e.offsetHeight})(e)},{passive:!0})})(e),Pi(e);const t=document.querySelector("header");document.querySelectorAll(".smooth-close-takeover").forEach(e=>e.addEventListener("click",()=>null==t?void 0:t.scrollIntoView({behavior:"smooth"})))},Ni=e=>{(e=>{window.addEventListener("advertory:closeTakeover",()=>Oi(e))})(e)},ji=e=>{const{takeover:{splash:{showAnnonsLabel:t=!1}={}}={}}=d.get(),n=e.querySelectorAll(".advertory-splash-navbar-wrapper"),i=document.querySelector(".advertory-takeover-label");Array.from(n).forEach(e=>e.style.display="flex"),t&&i&&(i.style.display="flex",i.innerText=Nt.se.adText),e.classList.toggle("advertory-splash-wrapper",!0)},_i=e=>{const t=document.querySelectorAll(".advertory-topscroller-elements");Array.from(t).forEach(e=>e.style.display="flex");const n=document.querySelector(".advertory-takeover-label");n&&(n.style.display="flex",n.innerText=Nt.no.adText,n.classList.add("takeover-topscroller-label"),e.classList.toggle("topscroller-wrapper",!0))},qi=e=>{const t=document.querySelectorAll(".advertory-welcome-page-elements");Array.from(t).forEach(e=>{e.style.display="flex",e.style.animation="elementsAnimation 1.5s ease-out forwards"});const n=document.querySelector(".advertory-takeover-label");n&&(n.style.display="flex",n.innerText=Nt.se.adText,e.classList.toggle("welcome-page-wrapper",!0))},Di=e=>{e.classList.toggle("advertory-impact-wrapper",!0)},Mi=()=>{const e=document.querySelector(".welcome-page-wrapper, .topscroller-wrapper, .advertory-splash-wrapper");if(!e)return;let t=0;new IntersectionObserver(e=>{e.forEach(e=>{var n;if(e.isIntersecting){window.dispatchEvent(new CustomEvent("advertory:takeoverInView"));(null!==(n=Array.from(e.target.classList))&&void 0!==n?n:[]).includes("advertory-splash-wrapper")&&(()=>{const e=window.scrollY||0;document.body.dataset.scrollY=e.toString(),document.body.style.top="0",document.body.classList.add("page-locked"),document.documentElement.scrollTop=0})(),t++}else t>0&&window.dispatchEvent(new CustomEvent("advertory:takeoverNotInView"))})},{root:null,rootMargin:"0px",threshold:0}).observe(e)},Bi=(e,t)=>{let n=e;return e.includes("529299503")&&(n=(e=>{const t=document.createElement("script");return t.textContent=`(${ki})()`,e+t.outerHTML})(e)),n},Ri=e=>{const t=(e=>{const{requests:t}=window.apntag,n=bt(e)?1:0;return null==t?void 0:t.tags[e].adResponse.ads[n].rtb.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=bt(e)?1:0;n&&(n.tags[e].adResponse.ads[i].rtb.banner.content=t)})(e,Bi(t))},Fi=e=>c(void 0,void 0,void 0,function*(){const{takeover:t}=d.get(),{targetId:n}=e,i=document.querySelector(`#${n}`),r=document.querySelector(".advertory-takeover-wrapper");if(!i||!r||!t)return;const o=(e=>{const{width:t,height:n}=e;return fi(t,n)?di:le(e,U)?ui:wi()?ci:li})(e),s=r.offsetHeight,a=window.scrollY>s;r.style.display="block",!a&&Ai(o,!1),((e,t)=>{({[li]:qi,[di]:ji,[ci]:_i,[ui]:Di})[t](e)})(r,o),Mi(),((e,t)=>{({[li]:xi,[ci]:xi,[di]:Li,[ui]:Ni})[t](e)})(r,o),((e,t,n)=>{if(!n)return;({[li]:()=>{const{buttonLabel:i}=Ti(n,t);["#advertory-welcome-page-scroll-label","#advertory-welcome-page-scroll-image"].forEach(t=>{const n=e.querySelector(`${t}`);n&&(n.innerText=null!=i?i:"")})},[di]:()=>{const{themeColors:i,logotype:r,buttonLabel:o,showArrowIcon:s}=Ti(n,t);["#advertory-splash-close-label",".advertory-splash-close","#advertory-splash-logotype",".advertory-splash-navbar-wrapper"].forEach(t=>{const n=e.querySelector(`${t}`);if(n){if("#advertory-splash-close-label"===t&&(n.innerText=null!=o?o:""),".advertory-splash-close"===t&&s){const e=document.createElement("img");e.setAttribute("src","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAfQAAAH0Bx0gPAAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABzSURBVDiNtdPJCYBADEDRzzRmE3ZgEV6tRHHpzELiIQrBZRajA7lk4EE2RIQjgApYgdbmY8EJaADZo3sDBKAvQa4JRYZc5D6pyJiDPMuKTCkkXp8icwxJd1mRxSC1/Q94328luJroGqNrkdyrzAfHVHzOG+8CKlLk+LO+AAAAAElFTkSuQmCC"),e.setAttribute("alt","close ad"),n.appendChild(e)}if("#advertory-splash-logotype"===t&&r&&(n.setAttribute("src",r.url),n.setAttribute("alt",r.alt)),".advertory-splash-navbar-wrapper"===t&&i){const{backgroundColor:e,color:t}=i;n.style.setProperty("background-color",null!=e?e:si,"important"),n.style.color=null!=t?t:ai}}})},[ci]:()=>{const{buttonLabel:i,showArrowIcon:r,showCloseButton:o=!0}=Ti(n,t);["#advertory-topscroller-scroll-label","#advertory-topscroller-scroll-image",".advertory-topscroller-close"].forEach(t=>{const n=e.querySelector(`${t}`);n&&(".advertory-topscroller-close"!==t||o||(n.style.display="none"),"#advertory-topscroller-scroll-image"!==t||r||(n.style.display="none"),"#advertory-topscroller-scroll-label"===t&&(n.innerText=null!=i?i:""))})},[ui]:()=>{}})[t]()})(r,o,t),yield bi(),!a&&Ai(o,!0),Ii(e,o)}),Vi="advertory-brandmetrics-survey",Ui=()=>c(void 0,void 0,void 0,function*(){const{norstat:{enabled:e}={},country:t,isMobileApp:n,tcf:i}=d.get(),r=yield Ve(i,n,t,"norstat");if(!e||n||!r)return;const o=(e=>{const{ppid1:t,ppid2:n}=at.getPPIDs(),{ppid1:i,ppid2:r}=dt.getPPIDs(),o=(new st).add(n,Ze[e]).add(t,et[e]).add(r,tt[e]).add(i,nt[e]);return`${o.buildNorstatPath()}?${o.buildNorstatQuery("alias").toString()}`})(t);((e,t,...n)=>{c(void 0,[e,t,...n],void 0,function*(e,t,n=!0){if(document.getElementById(t))return;const i=document.createElement("img");i.src=e,i.id=null!=t?t:"",n&&(i.style.display="none"),document.body.appendChild(i)})})(`https://sch-map.norstatsurveys.com/api/nids/${t===ge.NO?"schibsted":"schibstedse"}/map/${o}`,"norstat")}),Hi={nativeAd:e=>G(e)&&!te(e),buyrecipe:e=>e.targetId.startsWith("buyrecipe"),fullwidthAd:Y,fullscreenScroll:J,topscroller:e=>Q(e)&&wi(),splash:e=>Q(e)&&fi(e.width,e.height),welcomePage:Q,wallpaper:Z,skyscraper:e=>e.targetId.includes("skyscraper")&&!!e.banner,lFormat:ae,hFormat:de,toppanorama:e=>e.targetId.startsWith("toppanorama")&&!de(e)&&!ae(e),topboard:e=>e.targetId.startsWith("topboard")&&!Q(e),widescreen:se,insider:e=>e.targetId.startsWith("insider"),sponsorstripe:te,brandboard:e=>ne(e)&&!(e=>e.targetId.includes("backfill"))(e)&&!oe(e),outstream:e=>"https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js"===e.renderer_url,netboard:e=>(e=>e.targetId.startsWith("netboard"))(e)||(e=>e.targetId.startsWith("board"))(e),panorama:re,midboard:oe},zi=({adObj:e,preferredTestIdData:t})=>{var n,i;const r=null!==(n=null==t?void 0:t.targetId)&&void 0!==n?n:null==e?void 0:e.targetId;if(!r)return;const o=null===(i=document.querySelector(`#${r}`))||void 0===i?void 0:i.parentElement;if(!o)return;if(((e,t)=>{var n,i,r,o;const s=null===(o=null===(r=null===(i=null===(n=window.apntag)||void 0===n?void 0:n.requests)||void 0===i?void 0:i.tags)||void 0===r?void 0:r[e])||void 0===o?void 0:o.invCode;s&&(t.dataset.invCode=s)})(r,o),null==t?void 0:t.testId)return void(o.dataset.testid=t.testId);const s="DIV"===(null==o?void 0:o.tagName);e&&s&&((e,t)=>{var n,i;for(const[r,o]of Object.entries(Hi))if(o(e)){if("nativeAd"===r){const o="default";t.dataset.testid=`${r}-${null!==(i=null===(n=null==e?void 0:e.native)||void 0===n?void 0:n.desc2)&&void 0!==i?i:o}`;break}t.dataset.testid=r;break}})(e,o)},Wi=e=>{var t;return(null===(t=Object.entries(Hi).find(([,t])=>t(e)))||void 0===t?void 0:t[0])||""},Ki=(e,t)=>{const n=e.width,i=(null!=t?t:window.screen.width)/n;return i<1?i:1},Ji=new Map;Ji.set("insider",{scale:.82,transformOrigin:"left center",cogwheelAdjust:!0}),Ji.set("panorama",{scale:.79,transformOrigin:"center center"}),Ji.set("outstream",{scale:.79,transformOrigin:"center center"}),Ji.set("integration",{scale:.79,transformOrigin:"center center"}),Ji.set("toppanorama",{scale:.8,transformOrigin:"left center"});const Gi=e=>{if(!((null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.clientWidth)>767&&(null===(n=null===document||void 0===document?void 0:document.body)||void 0===n?void 0:n.clientWidth)<=853))return;var t,n;const i=Wi(e),r=Ji.get(i),o=document.querySelector(`#${e.targetId}`);if(!o||!r)return;if(o.style.transformOrigin=r.transformOrigin,o.style.transform=`scale(${r.scale})`,!(null==r?void 0:r.cogwheelAdjust))return;const s=document.querySelector(`div[class*="gdpr-cogwheel-button"][id$="${e.targetId}"]`),a=null==o?void 0:o.offsetWidth;s&&"number"==typeof a&&!isNaN(a)&&s.style.setProperty("right",String(-1*a*.2)+"px")},Yi=(e,t)=>t?Object.assign(Object.assign({},e),{"aa-sch-ssa-native-ad":"true","aa-sch-ssa-format":"NATIVE_CONTENT","aa-sch-ssa-market":"XNO","aa-sch-ssa-cat":["ssa_1","ssa_2","ssa_3","ssa_4","ssa_5","ssa_6","ssa_7","ssa_8","ssa_9","ssa_10","ssa_11","ssa_12","ssa_13","ssa_14","ssa_15","ssa_16","ssa_17","ssa_18","ssa_19","ssa_20","ssa_21","ssa_22","ssa_23","ssa_24","ssa_25","ssa_26","ssa_27","ssa_28","ssa_29","ssa_30"]}):e,Qi=e=>`externalImpId:'${e}'`,Xi=e=>{var t;const{forwardExternalImpId:n=!1,tracker:i}=d.get(),r=(e=>{var t;if(!e.positionConfig)return e;const n=e.keywords[`${me()}-count`],i=e.positionConfig.find(e=>e.adPositionIndex===n);if(!i)return e;const r=i.keywords?Object.assign(Object.assign({},e.keywords),i.keywords):e.keywords;return Object.assign(Object.assign({},e),{sizes:null!==(t=null==i?void 0:i.sizes)&&void 0!==t?t:e.sizes,keywords:r})})(e),{id:o,sizes:s,keywords:a,allowedFormats:l,invCode:c,ssa:u=!1,nativeCustomProperties:v,safeframeConfig:p,resizeAdParentDiv:g=!1,dynamicSizeWidthCheck:h=!1}=(e=>{var t;if(!e.takeoverCookieCapForSharedPlacement||mi())return e;const n=null===(t=e.keywords)||void 0===t?void 0:t["no-sno-adformat"],i=null==n?void 0:n.filter(e=>e!==ci),r=Object.assign(Object.assign({},e.keywords),n&&{"no-sno-adformat":i}),o=e.sizes.filter(([e,t])=>4!==e||4!==t);return Object.assign(Object.assign({},e),{sizes:o,keywords:r})})(r),m=Object.assign({invCode:c,sizes:s,targetId:o,keywords:Yi(a,u),allowedFormats:l,resizeAdParentDiv:g,dynamicSizeWidthCheck:h},p&&{safeframeConfig:p}),y=(e=>{var t,n,i,r,o,s,a;return e?(null===(t=null==e?void 0:e.instance)||void 0===t?void 0:t.state)?(null===(i=null===(n=null==e?void 0:e.instance)||void 0===n?void 0:n.state)||void 0===i?void 0:i.pageViewId)?(N("Tracker state pageViewId is:",null===(o=null===(r=null==e?void 0:e.instance)||void 0===r?void 0:r.state)||void 0===o?void 0:o.pageViewId),null===(a=null===(s=null==e?void 0:e.instance)||void 0===s?void 0:s.state)||void 0===a?void 0:a.pageViewId):(N("Tracker state does not contain field pageViewId or it is empty"),""):(N("Tracker state is empty"),""):(N("Tracker is not configured in initAdvertory function"),"")})(i);n&&y&&(N("External Impression ID assigned to defineTag:",Qi(y)),m.externalImpId=Qi(y));const f=(e=>Object.entries({video:{required:!1},address:{required:!1},saleprice:{required:!1},rating:{required:!1},price:{required:!1},phone:{required:!1},likes:{required:!1},downloads:{required:!1},customIcon2:{required:!1}}).reduce((t,[n,i])=>((null==e?void 0:e.includes(n))&&(t[n]=i),t),{customTitle1:{required:!1},customTitle2:{required:!1},customTitle3:{required:!1},customTitle4:{required:!1},title:{required:!1},body:{required:!1},image:{required:!1},icon:{required:!1},sponsoredBy:{required:!1},cta:{required:!1},clickUrl:{required:!1},desc2:{required:!1},displayUrl:{required:!1},description:{required:!1}}))(v);return(null===(t=e.allowedFormats)||void 0===t?void 0:t.includes("native"))&&(m.native=f),m},Zi=e=>!e.includes("takeover")||mi(),er=e=>{const{publisher:t=""}=d.get(),n=document.querySelector(`#${e}`);if(!n)return;const i=`-${t}`;n.classList.remove(`advertory${i}-finn-blink`),n.classList.remove(`advertory${i}-finn-blink-wrapper`)},tr=e=>{if(!e)return e;const t=e[`${he()}-targetid`],n=t?_(t[0]):"";return Object.assign(Object.assign({},e),t&&{[`${he()}-targetid`]:[n]})},nr=e=>Object.assign(Object.assign(Object.assign(Object.assign({},e),e[`${he()}-geo`]&&{[`${he()}-geo`]:["geo-test-value"]}),e[`${he()}-geofence`]&&{[`${he()}-geofence`]:["geofence-test-value"]}),e[`${he()}-weather`]&&{[`${he()}-weather`]:["weather-test-value"]}),ir=e=>{(e=>{const t=new URLSearchParams(window.location.search);if("true"!==t.get("scrollToFirstInvCode"))return;const n=t.get("ast_override_inv_code");if(!n)return;const i=n.split(",")[0].split(":")[0],r=e.find(e=>e.invCode===i),o=document.querySelector(`[id^=${null==r?void 0:r.id}]`);o&&o.scrollIntoView({behavior:"smooth",block:"start"})})(e),(()=>{var e;const t=new URLSearchParams(window.location.search).get("scrollToDrEditionPlacement");if(!t)return;const n=null!==(e=document.querySelector(`[id*="${t}}"]`))&&void 0!==e?e:document.querySelector(`a[aria-label*="${t}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"start"})})()},rr=(e,t)=>c(void 0,void 0,void 0,function*(){return yield new Promise(t=>{e().then(e=>{t(null!=e?e:null)}).catch(e=>{t(null)})})}),or={arrayMerge:(e,t)=>t},sr=e=>c(void 0,void 0,void 0,function*(){if(!(e=>{const{editableConfiguration:{useS3Config:t=!1,pageTypeToFetch:n}={},siteSpecificConfig:i}=e;return Boolean(t&&n&&(null==i?void 0:i.publisherClassName))})(e))return e;try{const t=yield(e=>c(void 0,void 0,void 0,function*(){const t=(e=>{const{siteSpecificConfig:t,editableConfiguration:{pageTypeToFetch:n}={}}=e;return(null==t?void 0:t.publisherClassName)&&n?`https://alertory-cdn.staging.inventory.schibsted.io/editable-configurations/${t.publisherClassName}/${n.toUpperCase()}.json`:null})(e);if(!t)return null;const n=new AbortController,i=setTimeout(()=>n.abort(),5e3);try{return yield Qe.get(t,{method:"GET",signal:n.signal})}catch(e){throw N("Failed to fetch S3 config",{error:e,url:t}),e}finally{clearTimeout(i)}}))(e);return t?(({siteConfig:e,configOverrides:t})=>{var n;const{keywords:r,refresh:o,placements:s,threshold:a,batchSize:d}=t,l=i.all([e.placements,s],or),c=i(e.pageOptions,{keywords:r},or),u=i(e.appearanceConfig,{defaultThreshold:a},or),v=i(null!==(n=e.refreshConfig)&&void 0!==n?n:{},{scrollRefreshEnabled:o},or);return Object.assign(Object.assign({},e),{placements:l,requestSize:null!=d?d:e.requestSize,pageOptions:c,appearanceConfig:u,refreshConfig:v})})({siteConfig:e,configOverrides:t}):e}catch(t){return N("Error fetching S3 config, using site config",{error:t}),e}}),ar=".advertory-right-column-track",dr="--advertory-right-column-track-height",lr=e=>e.getBoundingClientRect().top+window.scrollY,cr=(e,t)=>{const n=ce(t);document.body.style.setProperty(e,n)},ur=(e,t)=>`${e}-${t}`,vr=(e,t,n)=>{var i;const r=Array.from(null!==(i=e.querySelectorAll(t))&&void 0!==i?i:[]),o=(e=>e.map(e=>{var t;return null===(t=document.querySelector(`[id^="${e}"]`))||void 0===t?void 0:t.parentElement}).map((e,t)=>({point:e,originalIndex:t})).filter(e=>Boolean(e.point)))(n);if(0===o.length)return;const s=lr(e);(()=>{const e=document.querySelector("header");if(!e)return;const t=ue(e);cr("--advertory-newsroom-header-height",t)})(),o.forEach(({point:e,originalIndex:t})=>{((e,t,n)=>{const i=lr(e),r=ur(dr,t),o=i-n,s=ur("--advertory-right-column-split-point-height",t),a=ue(e);cr(r,o),cr(s,a)})(e,t+1,s),(e=>{const t=null==e?void 0:e.id;if(!t)return;const n=ur("--advertory-right-column-ad-height",t),i=ue(e);cr(n,i)})(r[t])});((e,t)=>{const n=lr(e);cr(dr,n-t)})(o[Math.min(r.length,o.length-1)].point,s)};let pr=!1;class gr{getPulseObjectId(){return"sdrn:vg:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(){return"sdrn:vg:frontpage:front"}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];const{host:i,pathname:r}=new URL(n);if(!i.includes("www.vg.no")&&!r.includes("annonsorinnhold"))return[n];const o=r.split("/");return o.length?[...o.filter(Boolean).slice(1).map(e=>e),n]:[n]}}class hr{getPulseObjectId(){return""}getPulsePageId(e,t){return""}}class mr{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t){return{}}parseKilkayaData(e){const t=e.querySelector("article");if(!t)return{};const n=t.dataset.k5aTeaserAnalytics;try{return n?JSON.parse(n):{}}catch(e){return{}}}mapPageType(e){return{front:"Frontpage",article:"Article",section:"Article",collection:"Article",other:"Article"}[e||"front"]||"Frontpage"}getArticleId(){return location.pathname.split("/").slice(-2,-1).pop()||""}getEventTarget(e){const{url:t,title:n,itemId:i}=this.parseKilkayaData(e);return{id:i,name:this.normalizePlacementTitle(null!=n?n:""),type:"Page",url:t}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(e){return c(this,void 0,void 0,function*(){var t,n,i,r,o,s,a,d;if(!this.pulse)return;const l=this.getEventInput(e,"view");(null===(t=this.pulse)||void 0===t?void 0:t.trackLegacyViewUIElement)?null===(i=null===(n=this.pulse)||void 0===n?void 0:n.trackLegacyViewUIElement)||void 0===i||i.call(n,l):(null===(r=this.pulse)||void 0===r?void 0:r.trackViewUIElement)?null===(s=null===(o=this.pulse)||void 0===o?void 0:o.trackViewUIElement)||void 0===s||s.call(o,l):null===(d=null===(a=this.pulse)||void 0===a?void 0:a.trackElementView)||void 0===d||d.call(a,l)})}trackContentClick(e){return c(this,void 0,void 0,function*(){var t,n,i,r,o,s;if(!this.pulse)return;const a=this.getEventInput(e,"click");this.pulse.trackLegacyClickUIElement?null===(n=(t=this.pulse).trackLegacyClickUIElement)||void 0===n||n.call(t,a):this.pulse.trackClickUIElement?null===(r=(i=this.pulse).trackClickUIElement)||void 0===r||r.call(i,a):null===(s=(o=this.pulse).trackElementClick)||void 0===s||s.call(o,a)})}}class yr extends mr{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e){var t,n,i,r,o,s;const{clientName:a,creativeId:d,itemId:l,placement:c}=this.parseKilkayaData(e),u=this.mapPageType(this.pageType),v=null===(t=this.newsroomStrategy)||void 0===t?void 0:t.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(r=null===(i=null===(n=this.newsroomStrategy)||void 0===n?void 0:n.getPulseObjectId)||void 0===i?void 0:i.call(n))&&void 0!==r?r:c,"@type":"UIElement",position:c,elementType:"Article",custom:{customer:a,creativeId:null!=d?d:l},page:{"@id":null!=v?v:c,"@type":u,url:location.origin},tags:null===(s=null===(o=this.newsroomStrategy)||void 0===o?void 0:o.getTags)||void 0===s?void 0:s.call(o,e)}}getEventTarget(e){const{link:t,itemId:n,title:i}=this.parseKilkayaData(e);return{id:n,name:this.normalizePlacementTitle(null!=i?i:""),type:"Page",url:t}}getEventInput(e,t){return{object:this.getEventBaseData(e),partnerstudio:this.getEventPartnerstudioData(e,t),target:this.getEventTarget(e),provider:this.getProviderData()}}getEventPartnerstudioData(e,t){const n=this.parseKilkayaData(e);return Object.assign(Object.assign({},n),{type:t,tracking_type:"ad",xandrAdLoaded:!1})}getProviderData(){return{productTag:"partnerstudio"}}}const fr="[data-k5a-teaser-analytics]",wr=(e,t,n)=>{const i=document.querySelectorAll("k5a-stream");if(!i.length)return;const r=new yr(e,t,n),o=new WeakMap,s=e=>{const t=o.get(e);t&&(t.disconnect(),o.delete(e))},a=new IntersectionObserver((e,t)=>{e.forEach(e=>{if(!e.isIntersecting)return;const n=e.target,i=n.querySelector(fr);Boolean(null==i?void 0:i.dataset.k5aTeaserAnalytics)?(r.trackContentView(n),t.unobserve(e.target),s(n)):((e,t)=>{if(o.has(e))return;const n=new MutationObserver(()=>{const n=e.querySelector(fr);Boolean(null==n?void 0:n.dataset.k5aTeaserAnalytics)&&(r.trackContentView(e),t.unobserve(e),s(e))});n.observe(e,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["data-k5a-teaser-analytics"]}),o.set(e,n)})(n,t)})},{threshold:.5});i.forEach(e=>{a.observe(e),e.addEventListener("click",()=>r.trackContentClick(e))})};class br{handleKilkayaStreamTracking({pulse:e,pageType:t,publisher:n}){if(!(null==e?void 0:e.instance))return;const i={[we.VG]:new gr}[n]||new hr;wr(e.instance,i,t)}injectKilkayaMeta(e){const t=document.createElement("script");t.textContent=`var k5aMeta = { consent: ${e} };`,document.head.appendChild(t)}observeForKilkayaBackfills(){document.addEventListener("K5A:EmptyStreamSlot",e=>{var t;const n=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.streamSlot;if(!n)return;const i=n.parentElement;i&&(N(`Kilkaya placement ${n.getAttribute("name")} has not been loaded, loading Xandr backfill`),this.showBackfill(i))})}showBackfill(e){var t;const n=e.querySelector(".fallback");if(!n)return;n.style.display="block";const i=null!==(t=n.dataset.fallbackTargetId)&&void 0!==t?t:"";I(i)}loadKilkayaScript(e){return c(this,void 0,void 0,function*(){yield ft(e)})}run(e){return c(this,void 0,void 0,function*(){const{tcf:t,isMobileApp:n,country:i,kilkaya:r}=e;if(!(null==r?void 0:r.enabled))return;const o=yield Ve(t,n,i,"kilkaya");o&&(this.observeForKilkayaBackfills(),this.injectKilkayaMeta(o),yield this.loadKilkayaScript(r.url),this.handleKilkayaStreamTracking(e))})}}const Er=e=>{var t,n,i,r,o,s;const{adScaleConfig:a,deviceType:l}=d.get();if(!(null==a?void 0:a.enabled))return;if(le(e,B))return;const c=null!==(t=a.adsToBeScaled[l])&&void 0!==t?t:[],u=Jt(e.targetId.split("-")[0]);if(!c.includes(u))return;const v=null!==(i=null===(n=a.offset)||void 0===n?void 0:n[u])&&void 0!==i?i:0,p=document.getElementById(e.targetId),g=null!==(r=null==p?void 0:p.offsetWidth)&&void 0!==r?r:window.screen.width,h=null!==(s=null===(o=null==p?void 0:p.parentElement)||void 0===o?void 0:o.offsetWidth)&&void 0!==s?s:window.screen.width;((e,t=window.screen.width)=>{const n=Ki(e,t),i=document.querySelector(`iframe[id^="utif_${e.targetId}"]`);i&&(i.style.transform=`scale(${n})`,i.style.transformOrigin="left top")})(e,(g<h?g:h)-v)},Tr=1e4,Ir=e=>e.some(e=>e.some(e=>!!e&&Xn(e,0))),kr=()=>{const{widescreenSwitching:e}=d.get(),{enabled:t,rotationInterval:n=Tr,widescreenIdPrefix:i}=null!=e?e:{};if(!t)return;const r=((e="widescreen")=>{const{pageSectionsSelectors:{right:t}={}}=d.get();return t?Array.from(document.querySelectorAll(t)).map(t=>Array.from(t.querySelectorAll(`div[id^="${e}"]`))):[]})(i);let o=0,s=Date.now(),a=Ir(r);if(!r.length)return;const l=(e,t,n)=>{e.forEach(e=>{e&&e.style.setProperty(t,n)})},c=e=>1===e?0:1;(e=>{e.forEach(e=>{e[0]&&(e[0].style.display="block"),e[1]&&(e[1].style.display="none")})})(r);const u=((e,t)=>{let n=null;return(...i)=>{null===n&&(e(...i),n=setTimeout(()=>{n=null},t))}})(()=>{a||(a=Ir(r)||a,s=Date.now());Date.now()-s>=n&&((()=>{const e=c(o),t=r.map(e=>e[o]),n=r.map(t=>t[e]);l(t,"opacity","0"),setTimeout(()=>{l(t,"display","none"),l(n,"opacity","0"),l(n,"display","block"),setTimeout(()=>{l(n,"opacity","1")},450)},450)})(),o=c(o),s=Date.now())},1e3);window.addEventListener("scroll",u)};let Ar,Cr=[];const Sr=["takeover","wallpaper"],Or=e=>{const t=(e=>{const t=m.getData("alertoryConfigKeywords"),{queryConfig:n,placements:i,tcf:r,glimr:o,appearanceConfig:a,requestSize:d=s,publisher:l,country:c,pageType:u,deviceType:v,isMobileApp:p=!1,pageOptions:{member:g},takeover:h,fullscreenScroll:y,useAppTabletInvCode:f}=e;return{xandr:{member:g,keywords:t,tags:[]},advertory:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({publisher:l,country:c,pageType:u,deviceType:v,placements:i,tcf:r,requestSize:d,isMobileApp:p,useAppTabletInvCode:f},o&&{glimr:o}),n&&{queryConfig:n}),a&&{appearanceConfig:a}),h&&{takeover:h}),y&&{fullscreenScroll:y})}})(e);window.advertory={initialized:!0,siteConfig:e,alertoryConfig:t}},Pr=()=>c(void 0,void 0,void 0,function*(){const{pageOptions:e}=d.get(),{preparePageOptions:t}=d.getHandlers(),n=(()=>{const{sandboxAdIframeEnabled:e=!0}=d.get();return{sandboxAdIframe:e,sandboxAttributes:["allow-same-origin","allow-scripts","allow-top-navigation-by-user-activation","allow-popups","allow-popups-to-escape-sandbox","allow-forms"]}})(),i=yield c(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=d.get();return(yield Ve(e,t,n,"page-options"))?{}:{userSync:{disabled:!0}}}),r=yield t(Object.assign(Object.assign(Object.assign({disablePsa:!0,enableSafeFrame:!0},e),{renderingManagement:Object.assign({},n)}),i));(e=>{const t=m.getData("alertoryConfigKeywords");if(Object.keys(t).length)return;const n=nr(e);m.setData("alertoryConfigKeywords",n)})(r.keywords),v(()=>Ar.setPageOpts(r))}),$r=e=>c(void 0,void 0,void 0,function*(){const{prebid:t,tcf:n,isMobileApp:i,country:r}=d.get();Lr(e);const o=yield Ve(n,i,r,"prebid");(null==t?void 0:t.enabled)&&o?(N("core loadPlacements prebid enabled"),yield Rt()):(N("core load tags invoked without prebid enabled"),xr(e))}),Lr=e=>{const{prepareTag:t}=d.getHandlers(),n=[];(e=>{const t=["skyscraperright_1","topboard","wallpaper","skyscraperleft_1"];return e.sort((e,n)=>{const i=t.findIndex(t=>e.id.includes(t)),r=t.findIndex(e=>n.id.includes(e));return-1!==i&&-1===r?-1:-1===i&&-1!==r?1:i-r})})(e).forEach(e=>{N("core defineTags",{placement:e});const i=Xi(e);if(Zi(e.id)){const r=t(i),o=(e=>{const{allowedFormats:t,invCode:n,keywords:i,sizes:r}=e;return{adTypes:t,invCode:n,keywords:tr(i),sizes:r}})(r);n.push(o),v(()=>(N("core defineTag - add to the queue",{placement:e,preparedTag:r}),Ar.defineTag(r)))}}),(e=>{var t,n,i;(null===(i=null===(n=null===(t=window.advertory)||void 0===t?void 0:t.alertoryConfig)||void 0===n?void 0:n.xandr)||void 0===i?void 0:i.tags)&&e.length&&window.advertory.alertoryConfig.xandr.tags.push(e)})(n)},xr=e=>{const t=e.filter(({id:e})=>Zi(e)).map(({id:e})=>e);t.length&&v(()=>(N("core loadTags",{placementsIdsToLoad:t}),Ar.loadTags([...t])))},Nr=(e,t)=>c(void 0,void 0,void 0,function*(){const{appearanceConfig:n,deviceType:i}=d.get(),{threshold:r,refresh:o,priority:s="normal"}=e,a=(e=>{const t=document.querySelector(`[data-show-tag-subscribe-id=${e.targetId}]`),n=document.querySelector(`#${e.targetId}`);return t||n})(t),l=null==n?void 0:n.defaultThreshold[i];a&&(N("core showAd - subscribe for show tag with thresholds",{placement:e,adObj:t,threshold:r,deviceDefaultThreshold:l}),yield Rn(a,null!=r?r:l)),a&&o&&(N("core showAd - setup refreshing",{placement:e,adObj:t}),a.dataset.refresh=o.toString(),a.dataset.priority=s)}),jr=e=>e.some(({id:e})=>Sr.some(t=>e.includes(t))),_r=e=>c(void 0,void 0,void 0,function*(){var t;if(!(null===(t=null===window||void 0===window?void 0:window.advertory)||void 0===t?void 0:t.initialized))return;const{requestSize:n=s}=d.get(),i=Xt(e);for(const e of Object.keys(i)){const t=i[e],r=Yn(t,n);for(const e of r)jr(e)?(N("core loadAds without lazy loading",{placementsToLoad:e}),yield $r(e)):e.length&&(N("core loadAds with lazy loading",{placementsToLoad:e}),yield qr(e))}}),qr=e=>c(void 0,void 0,void 0,function*(){const{queryConfig:{lazyLoadingV3:{enabled:t=!1,rootMargin:n="200% 0px"}={}}={}}=d.get(),i=[];if(!t)return N("lazy load is not enabled",{placements:e}),void(yield $r(e));const r=new IntersectionObserver((t,n)=>{t.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(t=>{N("lazy load is enabled - handler start",{loadedPlacementIds:i,placements:e});const r=e.every(e=>i.includes(e.id)),o=e.map(e=>e.id);!r&&i.push(...o),!r&&$r(e),N("lazy load is enabled - handler stop",{loadedPlacementIds:i,placements:e,arePlacementsLoaded:r,placementIds:o}),n.disconnect()})},{rootMargin:n});e.forEach(e=>{const t=document.getElementById(e.id);t&&(N("lazy loading - observe element",{placementId:e.id,element:t}),r.observe(t))})}),Dr=()=>c(void 0,void 0,void 0,function*(){const{siteEvents:e,initNativeAd:t,wallpaperHandlers:{initWallpaperAd:n,adjustAdToHorseshoe:i}}=d.getHandlers(),{wallpaper:r,fullscreenScroll:o}=d.get(),s=[];v(()=>{Ar.onEvent("adRequested",()=>{e.adRequested()}),Ar.onEvent("adAvailable",i=>c(void 0,void 0,void 0,function*(){var s,a,l,c,u,p;N("core adAvailable start",{placementsAvailable:Cr,adObj:i,isFullscreenScrollAd:J(i),isFinnBlink:ie(i.targetId),isNativeAd:G(i),isMediation:be(i),isTakeoverAd:Q(i),isCollapseAd:ee(i),isWallpaperAd:Z(i)});const g=null===(l=null===(a=null===(s=null===window||void 0===window?void 0:window.apntag)||void 0===s?void 0:s.requests)||void 0===a?void 0:a.tags[i.targetId])||void 0===l?void 0:l.adResponse.ads;be(i)&&g&&(null===(c=g[1])||void 0===c?void 0:c.rtb)&&(i.banner=null===(p=null===(u=g[1])||void 0===u?void 0:u.rtb)||void 0===p?void 0:p.banner),J(i)&&Bt(i),se(i)&&kr(),J(i)&&!ie(i.targetId)&&Mt(i,o),!G(i)||be(i)||ie(i.targetId)||t(i,d.get()),Q(i)&&!ee(i)&&(Ri(i.targetId),yield Fi(i)),Z(i)&&(n(()=>v(()=>window.apntag.showTag(i.targetId)),r),m.setData("wallpaper",{isAvailable:!0})),(e=>e.targetId.includes("skyscraperleft")&&!!e.banner)(i)&&m.setData("horseshoe",{isAvailable:!0}),zi({adObj:i}),(e=>{var t;const n=null==e?void 0:e.targetId;if(!n)return;const i=null===(t=document.querySelector(`#${n}`))||void 0===t?void 0:t.parentElement;i&&((e,t)=>{const{height:n,width:i,native:r}=e;r?t.dataset.adSizes="[1,1]":n&&i&&(t.dataset.adSizes=`[${i},${n}]`)})(e,i)})(i),e.adAvailable(i);const h=Cr.find(({id:e})=>e===i.targetId);h&&(yield Nr(h,i),Cr=Cr.filter(e=>e.id!==h.id)),N("core adAvailable stop",{placementsAvailable:Cr,adObj:i,isFullscreenScrollAd:J(i),isFinnBlink:ie(i.targetId),isNativeAd:G(i),isMediation:be(i),isTakeoverAd:Q(i),isCollapseAd:ee(i),isWallpaperAd:Z(i)})})),Ar.onEvent("adLoaded",n=>{const{refreshConfig:r,appearanceConfig:o}=d.get(),a=document.getElementById(n.targetId);ie(n.targetId)&&(e=>{const{fullscreenScroll:t}=d.get(),{initNativeAd:n}=d.getHandlers();J(e)&&Mt(e,t),G(e)&&n(e,d.get())})(n);s.includes(n.targetId)&&G(n)&&(t(n,d.get()),zi({adObj:n})),!s.includes(n.targetId)&&be(n)&&s.push(n.targetId),ee(n)&&T(n.targetId),Q(n)&&((e,t)=>{var n;const i="100%",r="100%";e.resizeAd(t,[i,r]);const o=null===(n=document.querySelector(`#div_utif_${t}`))||void 0===n?void 0:n.querySelector("iframe");if(!o)return;new MutationObserver(e=>{for(const t of e)if("attributes"===t.type&&"style"===t.attributeName){const e=window.getComputedStyle(o),t=e.width,n=e.height;t===i&&n===r||(o.style.width=i,o.style.height=r)}}).observe(o,{attributes:!0,attributeFilter:["style"]})})(Ar,n.targetId),Y(n)&&(e=>{const t=document.querySelector(`#${e.targetId}`),{siteSpecificConfig:{publisherClassName:n,fullWidthFormatClassName:i}={}}=d.get();if(!t||!n||!i)return;const r=t.parentElement;r&&(t.classList.add(`advertory-${n}-${i}__full-width-ad`),r.classList.add(`advertory-${n}-${i}-wrapper__full-width-ad`))})(n),(e=>le(e,R))(n)&&(e=>{const t=document.querySelector(`#${e.targetId}`),n=null==t?void 0:t.querySelector("iframe"),i=null==n?void 0:n.parentElement,{siteSpecificConfig:{publisherClassName:r,fullWidthFormatClassName:o}={}}=d.get();if(!t||!n||!i)return;const s=window.innerWidth,a=Math.round(s/1080*1920);t.style.width="100%",t.style.height=`${a}px`,t.classList.add(`advertory-${r}-${o}__vertical-full-width-ad`);const l=Ki(e,t.offsetWidth);i.style.transform=`scale(${l})`,i.style.transformOrigin="left top"})(n),Zn(n,r),(null==o?void 0:o.clearProbableDimensionsEnabled)&&(e=>{const t=document.querySelector(`#${e}`);t&&(t.style.minWidth="",t.style.minHeight="")})(n.targetId);var l,c;m.getData("horseshoe").isAvailable&&i(n.targetId),Er(n),e.adLoaded(n),l=n.targetId,!document.querySelector(`#gdprAdTransparencyCogWheelButton-${l}`)&&(null===(c=window.gdpr)||void 0===c?void 0:c.setupButton)&&window.gdpr.setupButton(l),a&&(a.classList.add("ad-loaded"),(e=>{var t;const{siteSpecificConfig:n}=d.get(),i=null!==(t=null==n?void 0:n.mainColumnWidth)&&void 0!==t?t:1/0;e.clientWidth>i&&e.setAttribute("data-two-column-ad-layout","true")})(a)),Gi(n),window.dispatchEvent(new CustomEvent("advertory:adLoaded",{detail:{targetId:n.targetId,adFormat:Wi(n)}}))}),Ar.onEvent("adNoBid",t=>c(void 0,void 0,void 0,function*(){T(t.targetId),yield Cn(d.get(),t),Ei(t)&&(yield bi()),e.adNoBid(t)})),Ar.onEvent("adError",(t,n)=>c(void 0,void 0,void 0,function*(){Ei(n)&&(yield bi()),e.adError(t,n)})),Ar.onEvent("adCollapse",()=>{e.adCollapse()}),Ar.onEvent("adRequestFailure",t=>{T(t.targetId),e.adRequestFailure(t)}),Ar.onEvent("adBadRequest",t=>{T(t.targetId),e.adBadRequest(t)}),Ar.onEvent("adLoadedMediated",t=>e.adLoadedMediated(t)),Ar.onEvent("adNoBidMediated",t=>e.adNoBidMediated(t))})}),Mr=(e,t)=>c(void 0,void 0,void 0,function*(){var n;if(!(null===(n=null===window||void 0===window?void 0:window.advertory)||void 0===n?void 0:n.initialized))return[];const{clearAds:i,reloadExistingAds:r,renderFinnBlinkPlacements:o,contextSelector:s}=null!=t?t:{};if(i)return Wt(),[];r&&(Wt(),document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{I(e.id)})),l(null!=e?e:{}),yield Pr();let a=Yt(s);return o&&(a=a.filter(e=>ie(e.id))),a.length>0&&(Cr=[...Cr,...a.map(e=>Object.assign({},e))],ei(a),ni(a),yield _r(a)),Cr}),Br=(e,t)=>c(void 0,void 0,void 0,function*(){var n;d.set(e),d.setHandlers(t),m.initialize(),window.addEventListener("message",Dn,!1),Ar=window.apntag||{anq:[],defineTag:e=>({targetId:""}),showTag:e=>{},onEvent:(e,t,n)=>{},offEvent:(e,t)=>{},refresh:e=>{},modifyTag:(e,t)=>{},loadTags:e=>{},emitEvent:(e,t)=>{},setPageOpts:e=>{},resizeAd:(e,t,n)=>{},getAstVersion:()=>"",setEndpoint:(e,t)=>{},fireImpressionTrackers:e=>{},setKeywords:()=>{},clearRequest:()=>{}},window.apntag=Ar,N("Apn tag is set up on window"),yield Promise.allSettled([c(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=d.get();(yield Ve(e,t,n,"xandr-endpoint"))||Ar.setEndpoint("ib.adnxs-simple.com",!0)}),c(void 0,void 0,void 0,function*(){const{prebid:e,tcf:t,isMobileApp:n,country:i}=d.get(),r=yield Ve(t,n,i,"prebid");(null==e?void 0:e.enabled)&&r&&(yield ft(null==e?void 0:e.url))}),lt(e),c(void 0,void 0,void 0,function*(){const{astUrl:e}=d.get();yield ft(null!=e?e:"https://adsdk.microsoft.com/ast/ast.js")}),c(void 0,void 0,void 0,function*(){const{gptUrl:e}=d.get();yield ft(null!=e?e:"https://securepubads.g.doubleclick.net/tag/js/gpt.js")}),c(void 0,void 0,void 0,function*(){const{brandmetrics:{enabled:e,url:t}={},tcf:n,isMobileApp:i,country:r}=d.get(),{getConsentAsync:o}=Se(n,i,r),s=yield o();if(e&&t&&s){if(yield ft(t),document.querySelector(`.${Vi}`))return window._brandmetrics=window._brandmetrics||[],void window._brandmetrics.push({cmd:"_loadsurvey"});new MutationObserver((e,t)=>{for(const n of e){if("childList"!==n.type)return;Array.from(n.addedNodes).some(e=>{var t;return null===(t=e.outerHTML)||void 0===t?void 0:t.includes(Vi)})&&(t.disconnect(),window._brandmetrics=window._brandmetrics||[],window._brandmetrics.push({cmd:"_loadsurvey"}))}}).observe(document,{childList:!0,subtree:!0,attributes:!0})}}),He(),c(void 0,void 0,void 0,function*(){const{gdpr:{url:e,allowHidingAds:t=!0}={}}=d.get();t&&(window.gdpr=window.gdpr||{},window.gdpr.allowHidingAds=!0),yield ft(null!=e?e:"https://cogwheel.inventory.schibsted.io/prod/latest/gdpr-bundle.js")})]),yield Ui(),N("Libraries have been loaded and trackers have been set"),yield(n=t.librariesToLoad,c(void 0,void 0,void 0,function*(){const e=n.map(e=>ft(e));yield Promise.all(e)})),yield Dr(),yield Pr(),N("Page options have been set"),Or(e),N("Advertory is setup on window"),Cr=Yt(),ei(Cr),ni(Cr),yield _r(Cr),N("Ads has been loaded",Cr),ir(Cr),yield t.replaceAdsWithFinnBlink(e.finnBlink),yield(e=>c(void 0,void 0,void 0,function*(){var t;if(!e.drEdition)return;if(!(yield Ve(e.tcf,e.isMobileApp,e.country,"handleDrEdition")))return;const n=yield Tn(),i=new In(n);kn({publisher:e.publisher,drEditionConfig:e.drEdition,device:e.deviceType,pageType:e.pageType,country:e.country},i,null===(t=e.pulse)||void 0===t?void 0:t.instance)}))(e),(e=>{if(!(null==e?void 0:e.enabled)||pr)return;const{splitPointIDs:t,adSelector:n,trackSelector:i=ar}=e,r=document.querySelector(i);if(!r)return;pr=!0;const o=()=>{vr(r,n,t)};o(),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),window.addEventListener("load",o),window.addEventListener("advertory:adLoaded",()=>{requestAnimationFrame(o)}),new ResizeObserver(o).observe(r)})(e.rightColumnSplit),yield(e=>c(void 0,void 0,void 0,function*(){const t=new br;yield t.run(e)}))(e)}),Rr=(e,t)=>c(void 0,void 0,void 0,function*(){yield((e,t)=>c(void 0,void 0,void 0,function*(){const{initConsentManager:n,getConsentAsync:i}=Se(e.tcf,e.isMobileApp,e.country),r=yield sr(e);yield j(),yield rr(n),yield rr(i),N("TCF resolved successfully"),yield Br(r,t),N("Run function resolved successfully")}))(e,t)}),Fr="native_override_desc2",Vr=(e,t,n)=>{var i;const{image:r,icon:o,sponsoredBy:s,title:a,clickUrl:d,cta:l,body:c,desc2:u,video:v,description:p,customTitle1:g,customTitle2:h,customTitle3:m,customTitle4:y,customIcon2:f}=e,w=(e,t="")=>{var n;return e?null!==(n=e.url)&&void 0!==n?n:e:t};return Object.assign({containerId:n,img:w(r),imgWidth:null==r?void 0:r.width,imgHeight:null==r?void 0:r.height,imgAltText:null!=a?a:"",logo:w(o),sponsoredBy:null!=s?s:"",title:null!=a?a:"",url:null!=d?d:"",cta:null!=l?l:"",description:null!==(i=null!=c?c:p)&&void 0!==i?i:"",desc2:null!=u?u:"",video:v,customTitle1:null!=g?g:"",customTitle2:null!=h?h:"",customTitle3:null!=m?m:"",customTitle4:null!=y?y:"",logo2:w(f)},t)},Ur=(e,t)=>{const n=(i=Fr,window.location.href.includes(i));var i;const r=new URLSearchParams(window.location.search).get(Fr),o=t.includes("native_recirc");return n&&r?r:(null==e?void 0:e.includes("recirc"))?o?"native_recirc":"recirc":(null==e?void 0:e.includes("sponsor"))?"sponsorstripe":null},Hr=(e,t,n,i)=>{const r=document.querySelector(`#${e}`);r&&t&&(r.innerHTML=t,((e,t)=>{const n=e.parentElement,{publisher:i,pageType:r}=t,o=i&&Object.values(we).includes(i);n&&o&&O(i,e,x,r)})(r,n),i())},zr=e=>{var t;const n=document.querySelector(`#${e.targetId}`);if(!n||!(null===(t=e.native)||void 0===t?void 0:t.clickTrackers))return;(null==n?void 0:n.querySelectorAll("a.ad-link")).forEach(t=>{"true"!==t.dataset.tracked&&(t.addEventListener("click",()=>{var t,n;for(const i of null!==(n=null===(t=e.native)||void 0===t?void 0:t.clickTrackers)&&void 0!==n?n:[])Gr(i)}),t.dataset.tracked="true")})},Wr=e=>{const{native:{impressionTrackers:t}={}}=e;(null==t?void 0:t.some(e=>e.includes("googleads")))?null==t||t.forEach(Jr):window.apntag.fireImpressionTrackers(e);const n=new CustomEvent("advertory:nativeImpression",{detail:{ad:e}});window.dispatchEvent(n)},Kr=(e,t)=>{var n;let i=!1;const r=document.querySelector(`#${e.targetId}`);if(!r||!e.native)return;const{deviceType:o,appearanceConfig:s,nativeTrackingConfig:{fireImpressionsBasedOnAppearanceThreshold:a=!1}={}}=t,d=a?{rootMargin:`${l=null!==(n=null==s?void 0:s.defaultThreshold[null!=o?o:P.DESKTOP])&&void 0!==n?n:0}px 0px ${l}px 0px`}:{};var l;const c=new IntersectionObserver(t=>{if(!i)for(const n of t)if(n.isIntersecting){i=!0,Wr(e),c.disconnect();break}},d);c.observe(r)},Jr=e=>{const t=e.includes("googleads");"function"!=typeof window.navigator.sendBeacon||t?Gr(e):window.navigator.sendBeacon(e)},Gr=e=>{fetch(e,{method:"GET",mode:"no-cors"}).catch(t=>console.warn(`Tracker ${e} failed. Error: ${t||"Unknown"}`))},Yr=(e,t,n)=>{const i=((e,t,n)=>{var i;const{displayTemplates:r,videoTemplates:o}=n,s="default";if(!e.native)return null;const{native:a,targetId:d}=e,{desc2:l=s}=e.native,c=l.toLowerCase(),u=null!==(i=Ur(e.targetId,l))&&void 0!==i?i:c,v=Nt[t.language||ge.NO],p=Vr(a,v,d);return(a.video?o[u]:r[u]||r.default)(p,t)})(e,t,n);Hr(e.targetId,i,t,()=>{const{nativeTrackingConfig:{nativeTrackingEnabled:n=!0}={}}=t;n&&((e,t)=>{zr(e),Kr(e,t)})(e,t)})},Qr="viewable",Xr="adClick";const Zr=(e,t)=>{const n=(new DOMParser).parseFromString(e,"text/xml"),i=n.querySelector("ClickThrough"),r=n.querySelector("VideoClicks");if(i){for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(n.createCDATASection(t))}else if(r){const e=n.createElement("ClickThrough");e.appendChild(n.createCDATASection(t)),r.appendChild(e)}return URL.createObjectURL(new Blob([(new XMLSerializer).serializeToString(n)],{type:"text/xml"}))},eo=({id:e,nodeId:t,poster:n,tagURL:i,publisher:r="",productTag:o="xandr",videoLoop:s=!1})=>({id:e,poster:n,vendor:"appnexus",node:t,mute:!0,autoplay:s,repeat:s,skin:{name:"inventory-player",url:"https://ads.inventory.schibsted.io/styles/player.css"},settings:{jw:{stretching:"fill",advertising:{client:"vast",tag:i}}},pulse:{provider:r.toLowerCase(),decorator:e=>Object.assign(Object.assign({},fn(e)?e:{}),{provider:Object.assign(Object.assign({},fn(null==e?void 0:e.provider)?e.provider:{}),{productTag:o})})}}),to=e=>c(void 0,void 0,void 0,function*(){const{playerConfig:t,pluginsNames:n,clickUrl:i}=e,{repeat:r}=t,o=yield vn(t);gn(n),o.once("assetReady",()=>{un(o,n)}),o.on(Qr,e=>{const{viewable:t}=e;t?o.play():o.pause()}),o.on(Xr,()=>{window.open(i,"_blank")}),r&&o.on("pause",()=>{o.play()})}),no=({containerId:e,adText:t,url:n,adFrom:i,sponsoredBy:r,title:o},s,a)=>`<article class="advertory-abo-ad-native-video">\n <div class="ad-info" id="${e}-button"></div>\n <div class="ad-content">\n <div class="ad-image-container">\n <div class="ad-header">\n <span>${t}</span>\n </div>\n <div class="ad-player-wrapper">\n <div id="${a}"></div>\n </div>\n </div>\n <div class="ad-text-container">\n <span class="sponsored-by">\n ${i} ${r}\n </span>\n <a class="ad-link" href="${n}" target="_blank">\n <span class="ad-title">${o}</span>\n <div class="ad-description">${o}</div>\n </a>\n </div>\n </div>\n </article>`,io={VIDEO:(e,t)=>{return(n=no,(e,t,i)=>{const{video:r,img:o,url:s}=e,{publisher:a,productTag:d}=t,{pluginsNames:l,videoLoop:c}=i||{};if(!(null==r?void 0:r.content))return null;const u=Math.ceil(1e5*Math.random()),v=o||"https://custom.inventory.schibsted.io/1x1-00000000.png",p=`ad-player-${u}`,g=Zr(r.content,s),h=eo({id:u,nodeId:p,poster:v,tagURL:g,publisher:a,productTag:d,videoLoop:c});return to({playerConfig:h,clickUrl:s,pluginsNames:l}),`${n(e,t,p)}`})(e,t);var n},SPONSORSTRIPE:({title:e,sponsoredBy:t,logo:n})=>`<article class="advertory-abo-ad-native-sponsorstripe">\n <div class="ad-wrapper">\n <div class="info-button-wrapper" onClick="\n const adDescription = document.getElementById('ad-sponsorstripe-description');\n adDescription.classList.toggle('hide');\n ">\n <div class="info-button"></div>\n </div>\n\n <span class="ad-title">${e}</span>\n <img alt="${t}" class="ad-logo" src="${n}" />\n\n <div id="ad-sponsorstripe-description" class="ad-description hide">\n <span>${(e=>`Annonsøren har betalt for profilering av logo og merkenavn i artikler tilknyttet ${e}. Annonsøren har ingen innflytelse på Aftenpostens journalistiske virksomhet.`)(t)}</span>\n <a class="ad-description-readmore" href="https://www.aftenposten.no/slik-jobber-vi-i-aftenposten/i/xgKR18/ekstern-finansiering-av-innhold-i-aftenposten" target="_blank">Les mer</a>\n <div class="close-button-wrapper" onClick="\n const adDescription = document.getElementById('ad-sponsorstripe-description');\n adDescription.classList.toggle('hide');\n ">\n <div class="close-button"></div>\n </div>\n </div>\n </div>\n \n </article>`},ro={NATIVE_TEMPLATE:({containerId:e,url:t,sponsoredBy:n,title:i,img:r,adText:o})=>`<article class="advertory-no-ad-native-default">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_self">\n <div class="ad-content">\n <div class="ad-image-container">\n <img alt="${i}" class="ad-image" src="${r}" />\n </div>\n <div class="ad-text-container">\n <div class="ad-sponsor">\n <span class="ad-label">${o}</span> ${n}\n </div>\n <div class="ad-title">${i}</div>\n </div>\n </div>\n </a>\n </article>`,NATIVE_RECIRC:({containerId:e,url:t,sponsoredBy:n,title:i,img:r,adText:o})=>`<article class="advertory-no-ad-native-recirc">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_self">\n <div class="ad-content">\n <div class="ad-image-container">\n <img alt="${i}" class="ad-image" src="${r}" />\n </div>\n <div class="ad-text-container">\n <div class="ad-sponsor">\n <span class="ad-label">${o}</span> ${n}\n </div>\n <div class="ad-title">${i}</div>\n </div>\n </div>\n </a>\n </article>`},oo={CONTENT:({containerId:e,url:t,title:n,logo:i,sponsoredBy:r,img:o,description:s})=>`<article class="advertory-e24-ad-native-content">\n <div class="ad-info" id="${e}"></div>\n <a class="ad-link" href="${t}" target="_blank" rel="noreferrer noopener nofollow sponsored">\n <div class="ad-content">\n <div class="ad-header">\n <span class="ad-annonse">Annonsørinnhold|</span>\n <img alt="${r}" class="ad-logo" src="${i}" />\n </div>\n <div class="ad-image-container">\n <img alt="${n}" class="ad-image" src="${o}" />\n </div>\n <div class="ad-text-container">\n ${s?`<span class="ad-subtitle">${s}</span>`:""}\n <span class="ad-title">${n}</span>\n </div>\n </div>\n </a>\n </article>`,BASIC:({containerId:e,url:t,title:n,logo:i,sponsoredBy:r,img:o})=>`<article class="advertory-e24-ad-native-content-basic">\n <div class="ad-info" id="${e}"></div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-content">\n <div class="ad-header">\n <div id="${e}-button"></div>\n <span>Annonse</span>\n </div>\n <div class="ad-image-container">\n <div class="ad-ratio-container">\n <img src="${o}" alt="${n}" />\n </div>\n <img class="ad-sponsored-by" src="${i}" alt="${r}" />\n </div>\n <div class="ad-text-container">\n <span class="ad-annonse-label">Annonse fra ${r}</span>\n <h6 class="ad-title">${n}</h6>\n </div>\n </div>\n </a> \n </article>`,RECIRC:({containerId:e,url:t,title:n,logo:i,sponsoredBy:r,img:o})=>`<article class="advertory-e24-ad-native-recirc">\n <div class="ad-info" id="${e}"></div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-content">\n <div class="ad-header">\n <div id="${e}-button"></div>\n <span>Annonse</span>\n </div>\n <div class="ad-image-container">\n <div class="ad-ratio-container">\n <img src="${o}" alt="${n}" />\n </div>\n <img class="ad-sponsored-by" src="${i}" alt="${r}" />\n </div>\n <div class="ad-text-container">\n <span class="ad-annonse-label">Annonse fra ${r}</span>\n <h6 class="ad-title">${n}</h6>\n </div>\n </div>\n </a> \n </article>`},so={CONTENT:({containerId:e,url:t,title:n,logo:i,sponsoredBy:r,img:o,description:s})=>`<article class="advertory-e24-ad-native-content__front">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_blank" rel="noreferrer noopener nofollow sponsored">\n <div class="ad-content">\n <div class="ad-header">\n <span class="ad-annonse">Annonsørinnhold|</span>\n <img alt="${r}" class="ad-logo" src="${i}" />\n </div>\n <div class="ad-image-container">\n <img alt="${n}" class="ad-image" src="${o}" />\n </div>\n <div class="ad-text-container">\n ${s?`<span class="ad-subtitle">${s}</span>`:""}\n <span class="ad-title">${n}</span>\n </div>\n </div>\n </a>\n </article>`,BASIC:({containerId:e,url:t,title:n,logo:i,sponsoredBy:r,img:o})=>`<article class="advertory-e24-ad-native-content-basic__front">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-content">\n <div class="ad-header">\n <div id="${e}-button"></div>\n <span>Annonse</span>\n </div>\n <div class="ad-image-container">\n <div class="ad-ratio-container">\n <img src="${o}" alt="${n}" />\n </div>\n <img class="ad-sponsored-by" src="${i}" alt="${r}" />\n </div>\n <div class="ad-text-container">\n <span class="ad-annonse-label">Annonse fra ${r}</span>\n <h6 class="ad-title">${n}</h6>\n </div>\n </div>\n </a> \n </article>`},ao={default:io.VIDEO},lo={displayTemplates:{content:oo.CONTENT,basic:oo.BASIC,recirc:oo.RECIRC,sponsorstripe:io.SPONSORSTRIPE,native:ro.NATIVE_TEMPLATE,native_recirc:ro.NATIVE_RECIRC,default:oo.BASIC},videoTemplates:ao},co={displayTemplates:{content:so.CONTENT,basic:so.BASIC,native:ro.NATIVE_TEMPLATE,native_recirc:ro.NATIVE_RECIRC,default:so.BASIC},videoTemplates:ao},uo={get:e=>{try{const t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return N(`sessionStorageClient.get: Error during getting data from sessionStorage: ${e}`),null}},set:(e,t)=>{try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){N(`sessionStorageClient.set: Error during saving data to sessionStorage: ${e}`)}},remove:e=>{try{sessionStorage.removeItem(e)}catch(e){N(`sessionStorageClient.remove: Error during remove data from sessionStorage: ${e}`)}}},vo="finn_blink_id",po=e=>c(void 0,void 0,void 0,function*(){const{id:t,hashed_email:n,theme:i}=e,r=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(e,["id","hashed_email","theme"]),o=window[A.Blink];if(!o)return;const s=new o({remote:"https://www.finn.no/distribution-front/external/carousel",id:t,hashed_email:n,theme:i});yield s.inject(r)}),go=e=>{var t,n;const i=document.querySelector(`[id^="${e}"]`);return null!==(n=null===(t=null==i?void 0:i.dataset)||void 0===t?void 0:t.finnBlinkId)&&void 0!==n?n:e},ho=(e,t)=>{const{finnBlink:{enabled:n}={}}=d.get(),i=(null==t?void 0:t.enabled)||(e=>{var t;const n=document.querySelector(`[id^="${e}"]`);return!!(null===(t=null==n?void 0:n.dataset)||void 0===t?void 0:t.noBidAd)})(e);if(!i||!n)return null;const{limit:r,height:o,requireImage:s,theme:a,rec:l,distributionTypes:c,position:u,offset:v,advertoryTheme:p}=t||{};return{selector:`#${go(e)}`,enabled:i,position:null!=u?u:e,distributionTypes:null!=c?c:[],limit:null!=r?r:100,height:null!=o?o:100,offset:null!=v?v:200,requireImage:s,rec:l,theme:"dark"===a?"dark":"light",advertoryTheme:p}},mo=(e,t,n)=>c(void 0,void 0,void 0,function*(){const{placements:i,deviceType:r}=d.get();N(`rendering finn blink ad for ${e}`);const o=_(e),s=i[r].find(e=>e.id===o),a=ho(e,null==s?void 0:s.finnBlink),{publisher:l,country:u,finnBlink:v}=t,{userId:p,uuid:g,channel:h,theme:m}=null!=v?v:{},y=null!=h?h:`${l}.${u}`,f=(e=>{if(!e){const e=Pe();return null!=e?e:""}return e})(p),w="dark"===m?"dark":"light";if(!(null==a?void 0:a.enabled))return N(`Finn blink is not enabled on placement: ${e}`),n&&n(e),void er(e);if((e=>{var t;const n=go(e),i=document.querySelector(`[id^="${n}"]`);return!!(null===(t=null==i?void 0:i.classList)||void 0===t?void 0:t.contains("finn"))})(e))N(`Finn blink already loaded ${e}`);else try{const e=yield c(void 0,void 0,void 0,function*(){const{finnBlink:{identifierUrl:e}={}}=d.get(),t=uo.get(vo),n=ye("finncode");if(!e||n)return"";if(!t){const t=yield Qe.get(e,{credentials:"include"}),{finn_blink_id:n}=t;if(!n)throw new Error("getFinnBlinkIdentifier: No finn_blink_id found");return uo.set(vo,n),n}return t});yield po(Object.assign(Object.assign({},a),{hashed_email:e,channel:y,id:f,theme:w,uuid:g})).then(()=>{((e,t)=>{const{siteSpecificConfig:{publisherClassName:n}={},pageType:i}=d.get(),r=document.querySelector(`#${e}`);if(!r)return;if(r.classList.add("disable-cogwheel"),!n)return;O(n,r,L,null!=t?t:i),zi({preferredTestIdData:{targetId:e,testId:"finn"}})})(a.selector.replace("#",""),a.advertoryTheme)})}catch(t){N(`Finn blink error ${t}`),n&&n(e),!n&&T(e),er(e)}}),yo=((e,t)=>n=>Rr(Object.assign(Object.assign({},n),{siteSpecificConfig:t}),e))({initNativeAd:(e,t)=>{const{targetId:n}=e,i=document.querySelector(`#${n}`),r=(null==t?void 0:t.pageType)===vt.FRONT?co:lo;if(!i)return;const{pageType:o=vt.FRONT,nativeTrackingConfig:s,appearanceConfig:a,deviceType:d}=null!=t?t:{},l={language:ge.NO,publisher:we.E24,deviceType:d,pageType:o,nativeTrackingConfig:s,appearanceConfig:a};Yr(e,l,r)},wallpaperHandlers:{initWallpaperAd:(e,t)=>{if(!t)return;const{options:{appMainContainerSelector:n,wallpaperAnchorSelector:i}={}}=t;(e=>{const t=document.querySelector(e||"#application");if(!t)return;w();const n=document.createElement("div");n.classList.add(y),document.body.insertBefore(n,t.nextSibling),n.style.setProperty("position","fixed"),n.style.setProperty("width","100%"),n.style.setProperty("height","calc(100% - var(--header-height, 0) - 15px)"),n.style.setProperty("background-position","center top"),n.style.setProperty("background-repeat","no-repeat")})(n),(e=>{const t=e||".advertory-wrapper-common-skyscraperleft_1",n=document.querySelector(t);n&&(b(n),window.addEventListener("scroll",()=>b(n)))})(i),e()},adjustAdToHorseshoe:e=>{var t;const n=document.querySelector(`#${e}`);n&&(null===(t=n.parentElement)||void 0===t||t.classList.add(f),n.classList.add(f))}},loadFinnBlinkAd:(e,t,n,i)=>c(void 0,void 0,void 0,function*(){const{isMobileApp:r}=d.get();if(N(`loadFinnBlinkAd: loading finn blink ad for ${e}`),!(yield c(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=d.get(),{getConsentAsync:i}=Se(e,t,n),r=yield i();return!(!(null==e?void 0:e.enabled)||!r)||(N("Skip loading finn blink ad due to missing TCF consent."),!1)}))||r)return n&&n(e),void er(e);yield C(S),yield mo(e,t,n),i&&i()}),replaceAdsWithFinnBlink:e=>c(void 0,void 0,void 0,function*(){if(!e)return;yield C(S);const{replacementConfig:t}=e;if(!((()=>{const e=document.getElementById("ads-advertory-anchor");return!(e&&"none"!==getComputedStyle(e).display&&window.advertoryFluepapir)})()&&(null==t?void 0:t.adsToReplace)&&(null==t?void 0:t.sizes)&&e.enabled))return void N(`Finn blink configuration is incorrect: ${JSON.stringify(t)}`);const{adsToReplace:n,sizes:i}=t;n.forEach(([e,t])=>{const n=document.querySelector(`[id^="${e}"]`);if(!n)return;const i=q(t);(e=>{N(`Hiding old ad container: ${e.id}`),e.style.setProperty("display","none","important")})(n),D(n,i),n.dataset.finnBlinkId=t,k().withFullAdsChain(e)})}),preparePageOptions:gt,prepareTag:e=>{const{keywords:t,targetId:n,invCode:i}=e,{useAppTabletInvCode:r=!0}=d.get(),o=((e,t)=>{const{isMobileApp:n}=d.get();return n?((e,t)=>e.replace(/wtb|wde|wph/g,e=>"wph"===e?"aph":t?"atb":e))(e,t):e})(i,r),s=(e=>{const{keywords:t,dynamicSizeWidthCheck:n}=e,i=`${he()}-adformat`,r=t?t[i]:[];if(!r)return{};const o=(Array.isArray(r)?r:[r]).filter(e=>!(e in K)||window.innerWidth>=K[e]);return{[i]:n?o:r}})(e),a=(e=>{const t=`${he()}-targetid`;return e?{[t]:[e]}:{}})(n),l=fe(),c=(e=>Te(e)?{"aa-sch-dynamic-outstream":["true"]}:{})(i),u=((e,t)=>Te(e)?Object.assign(Object.assign({},t),{playerSkin:{videoBackgroundColor:"#e6e7e8"}}):{})(i);return Object.assign(Object.assign({},e),{invCode:o,keywords:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),s),a),c),l),rendererOptions:u})},siteEvents:pe,librariesToLoad:[]},{publisherClassName:we.E24,fullWidthFormatClassName:"netboard",mainColumnWidth:580});var fo=Object.freeze({__proto__:null,default:""});export{yo as initAdvertoryPackage,Mr as updateAdvertory};
1
+ import"react/jsx-runtime";function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var t,n;var i=e(function(){if(n)return t;n=1;var e=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===i}(e)}(e)},i="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function r(e,t){return!1!==t.clone&&t.isMergeableObject(e)?l((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function o(e,t,n){return e.concat(t).map(function(e){return r(e,n)})}function s(e){return Object.keys(e).concat(function(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}(e))}function a(e,t){try{return t in e}catch(e){return!1}}function d(e,t,n){var i={};return n.isMergeableObject(e)&&s(e).forEach(function(t){i[t]=r(e[t],n)}),s(t).forEach(function(o){(function(e,t){return a(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))})(e,o)||(a(e,o)&&n.isMergeableObject(t[o])?i[o]=function(e,t){if(!t.customMerge)return l;var n=t.customMerge(e);return"function"==typeof n?n:l}(o,n)(e[o],t[o],n):i[o]=r(t[o],n))}),i}function l(t,n,i){(i=i||{}).arrayMerge=i.arrayMerge||o,i.isMergeableObject=i.isMergeableObject||e,i.cloneUnlessOtherwiseSpecified=r;var s=Array.isArray(n);return s===Array.isArray(t)?s?i.arrayMerge(t,n,i):d(t,n,i):r(n,i)}return l.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return l(e,n,t)},{})},t=l}());const r=["deviceType","pageType","placements","takeover","refreshConfig","editableConfiguration"],o={adRequested:()=>{},adAvailable:e=>{},adLoaded:e=>{},adNoBid:e=>{},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},s=6;class a{set(e){this.config=e}modifyConfigProperties(e){if(!this.config)throw new Error("Config was accessed before it had been initialized.");const t={};for(const n of r){const i=e[n];void 0!==i&&(t[n]=i)}Object.assign(this.config,t),Object.prototype.hasOwnProperty.call(e,"pageOptions")&&void 0!==e.pageOptions&&(this.config.pageOptions=Object.assign(Object.assign({},this.config.pageOptions),e.pageOptions))}get(){if(!this.config)throw new Error("Config was accessed before it had been initialized.");return this.config}getHandlers(){if(!this.siteHandlers)throw new Error("Handlers were accessed before it had been initialized.");return this.siteHandlers}setHandlers(e){this.siteHandlers=i(a.DEFAULT_SITE_HANDLERS,e)}}a.DEFAULT_SITE_HANDLERS={siteEvents:o,initNativeAd:function(){}};const d=new a,l=d.modifyConfigProperties.bind(d);function c(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{d(i.next(e))}catch(e){o(e)}}function a(e){try{d(i.throw(e))}catch(e){o(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(s,a)}d((i=i.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const u="0123456789abcdefghijklmnopqrstuvwxyz",v=e=>{window.apntag.anq.push(e)},p=new Promise(e=>{"undefined"!=typeof document&&document.prerendering?document.addEventListener("prerenderingchange",()=>e()):e()}),g=new Promise(e=>{if("undefined"==typeof document||!document.hidden)return void e();const t=()=>{document.hidden||(document.removeEventListener("visibilitychange",t),e())};document.addEventListener("visibilitychange",t,{once:!0})});class h{initialize(){this.DATA=Object.assign({},h.INITIAL_DATA)}getData(e){if(!this.DATA)throw new Error("Storage was accessed with invalid data.");return this.DATA[e]}setData(e,t){if(!this.DATA)throw new Error("Storage was accessed before it had been initialized.");this.DATA[e]=Object.assign(Object.assign({},this.DATA[e]),t)}}h.INITIAL_DATA={wallpaper:{isAvailable:!1},horseshoe:{isAvailable:!1},initialClassNames:{},alertoryConfigKeywords:{}};const m=new h,y="advertory-wallpaper-background",f="advertory-with-horseshoe",w=()=>{const e=document.querySelector(`.${y}`);e&&e.remove()},b=e=>{const t=e.getBoundingClientRect().top;requestAnimationFrame(()=>(e=>{if(!document.body)return;const t=document.querySelector(`.${y}`);t&&t.style.setProperty("top",`${e}px`)})(t+15))},E=/^wallpaper:url:(http[s]?:\/\/)?[^\s(["<,>]*\.[^\s[",><]*/,T=e=>{if(window.location.href.includes("collapse_ad=0"))return;const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.setProperty("width","0","important"),t.style.setProperty("height","0","important"),t.style.setProperty("display","none","important"),n.style.setProperty("display","none","important"),e.includes("wallpaper")&&w())},I=e=>{const t=document.querySelector(`div[id^="${e}"]`);if(!t)return;const n=t.parentElement;n&&(t.style.removeProperty("width"),t.style.removeProperty("height"),t.style.removeProperty("display"),n.style.removeProperty("display"))},A=()=>{const{publisher:e,country:t,finnBlink:n}=d.get(),{loadFinnBlinkAd:i,wallpaperHandlers:{adjustAdToHorseshoe:r}}=d.getHandlers(),o=window.apntag,s={publisher:e,country:t,finnBlink:n},a=e=>{I(e),v(()=>o.showTag(e))};return{withXandrAd:a,withFinnBlinkAd:e=>c(void 0,void 0,void 0,function*(){yield i(e,s,null)}),withFullAdsChain:e=>c(void 0,void 0,void 0,function*(){yield i(e,s,a,()=>{m.getData("horseshoe").isAvailable&&r(e)})})}},k={Blink:"Blink"},C=new Map,S=e=>{var t;if(!C.has(e)){const t=import(e).then(e=>(e=>{for(const[t,n]of Object.entries(k)){const i=e[t];null!=i&&(window[n]=i)}})(e)).catch(t=>{throw C.delete(e),t});C.set(e,t)}return null!==(t=C.get(e))&&void 0!==t?t:Promise.resolve()},O="https://assets.finn.no/pkg/distribution-fixed/v1/FINNExternalDistribution.modern.js",P=(e,t,n,i)=>{const r=t.parentElement;if(!r)return;const o=e?`-${e}`:"",s=i?`__${i}`:"",a=`advertory${o}-${n}${s}`,d=`advertory${o}-${n}-wrapper${s}`;t.classList.remove(...t.classList),r.classList.remove(...r.classList),t.classList.add(a),r.classList.add(d),t.dataset.adType=n},$={MOBILE:"mobile",TABLET:"tablet",DESKTOP:"desktop"},L=e=>e===$.MOBILE,x="finn-blink",N="native-ad",j=(e,t)=>{const n="[Advertory LOG]: ";location.search.includes("ast_debug=true")&&(t?console.log(n,e,t):console.log(n,e))},_=()=>c(void 0,void 0,void 0,function*(){try{(()=>{const e=document.createElement("script");e.setAttribute("src","https://ads.inventory.schibsted.io/ad-service/ad-banner-sponsor-advertisement/ad.js"),e.setAttribute("type","text/javascript"),e.setAttribute("async","true"),document.head.appendChild(e)})(),(()=>{const e=document.createElement("div");e.setAttribute("id","ads-advertory-anchor"),e.classList.add("subscribe_box"),e.classList.add("ad-box"),e.classList.add("leftAd"),e.classList.add("netboard"),e.classList.add("advert"),e.classList.add("module"),e.classList.add("banner"),e.classList.add("leaderboard"),e.classList.add("adsbygoogle"),e.classList.add("ad-banner"),e.classList.add("ad-container"),e.classList.add("adsbox"),e.classList.add("sidebar-ads"),e.classList.add("banner-ads"),e.style.opacity="0",e.style.width="1px",e.style.height="1px",e.style.minWidth="0px",e.style.minHeight="0px",e.style.maxWidth="1px",e.style.maxHeight="1px",e.style.position="absolute",e.style.top="0",e.style.boxSizing="border-box",e.style.margin="0",e.style.padding="0",document.body.appendChild(e)})()}catch(e){console.error("Error running adblock scripts:",e)}}),q=e=>{const t=e.split("-"),n=t[t.length-1];return 6===n.length&&n.match(/^[a-zA-Z0-9]+$/)?t.slice(0,-1).join("-"):e},D=(e,t)=>{const{siteSpecificConfig:{publisherClassName:n}={}}=d.get(),i=document.createElement("div"),r=document.createElement("div");return r.id=e,i.appendChild(r),P(n,r,x),j(`Creating blink container for: ${e}`),i},M=(e,t)=>{var n;(j(`Appending ${t.id} after ${e.id}`),e.parentElement&&(n=e.parentElement,!Array.from(n.children).some(e=>e.classList.contains("advertory-finn-blink-wrapper"))))?(e.parentElement.style.display="none",e.parentElement.insertAdjacentElement("afterend",t)):j(`Cannot perform afterend on: ${e.id}`)},B="ABSOLUTE_FULLSCREEN",R="ANY_FULLSCREEN",F="VERTICAL_FULLWIDTH",V="FULLWIDTH",U="TAKEOVER",H="VELVET_TAKEOVER",z="WALLPAPER",W="COLLAPSE",K={ANY_FULLSCREEN:[{width:6,height:6},{width:1920,height:1080},{width:3,height:3}],ABSOLUTE_FULLSCREEN:[{width:6,height:6}],VERTICAL_FULLWIDTH:[{width:1080,height:1920}],FIXED_FULLSCREEN:[{width:1920,height:1080},{width:3,height:3}],FULLWIDTH:[{width:5},{width:400,height:400}],NATIVE_AD:[{width:1,height:1}],TAKEOVER:[{width:4,height:4}],VELVET_TAKEOVER:[{width:7,height:7}],WALLPAPER:[{width:2,height:2}],COLLAPSE:[{width:2,height:1}]},G={wallpaper:1600,"l-format":1600},J=e=>{const{banner:t,targetId:n}=e;return!(!t||(null==n?void 0:n.includes("takeover")))&&ce(e,R)},Y=e=>{const{native:t}=e;return!!t},Q=e=>ce(e,V),X=e=>{const{targetId:t}=e;return t.includes("takeover")||ce(e,U)},Z=e=>ce(e,U),ee=e=>ce(e,z),te=e=>ce(e,W),ne=e=>e.targetId.includes("sponsorstripe"),ie=e=>(980===e.width||1920===e.width&&e.targetId.includes("brandboard"))&&!e.targetId.includes("topboard")&&!e.targetId.includes("companion")&&!oe(e),re=e=>{const t=document.querySelector(`#${e}`);return!!t&&"true"===t.dataset.isFinnBlinkPlacement},oe=e=>e.targetId.startsWith("panorama")||e.targetId.startsWith("modul"),se=e=>e.targetId.startsWith("midboard"),ae=e=>e.targetId.startsWith("widescreen"),de=e=>e.width>=1260&&e.width<=1280,le=e=>e.width>=1600&&e.width<=1620,ce=(e,t)=>{const n=K[t];if(!n)return!1;return!!n.find(t=>{var n,i;const r=(null===(n=e.banner)||void 0===n?void 0:n.width)||e.width,o=(null===(i=e.banner)||void 0===i?void 0:i.height)||e.height,s=t.width===r,a=!t.height||t.height===o;return s&&a})},ue=e=>`${Math.max(0,Math.round(e))}px`,ve=e=>{const{marginTop:t,marginBottom:n}=getComputedStyle(e);return e.getBoundingClientRect().height+parseFloat(t||"0")+parseFloat(n||"0")},pe=e=>{const t=document.getElementById(e.targetId),n=null==t?void 0:t.parentElement;t&&n&&[t,n].forEach(e=>{const t=Array.from(e.classList).find(e=>e.includes("netboard"));if(!t)return;const n=t.replace(/netboard/g,"brandboard");e.classList.remove(t),e.classList.add(n)})},ge={adRequested:()=>{},adAvailable:e=>{if(e.targetId.includes("skyscraperright_1")){(e=>{var t;const n=document.querySelector(e),i=document.querySelector(".advertory-skyscrapers-right-track"),[r,o]=Array.from(null!==(t=null==i?void 0:i.querySelectorAll('div[id*="skyscraper"]'))&&void 0!==t?t:[]);if(!(n&&i&&r&&o))return;const s=()=>{const e=i.getBoundingClientRect().top+window.scrollY,t=n.getBoundingClientRect().top+window.scrollY,o=document.querySelector(".advertory-wallpaper-background");if(document.body.style.setProperty("--skyscrapers-right-track-height",ue(t-e)),document.body.style.setProperty("--skyscraperright_1-height",ue(ve(r))),o){const e=ve(o)-ve(r)+15;document.body.style.setProperty("--skyscraper-second-margin",ue(e))}};s(),window.addEventListener("resize",s),window.addEventListener("orientationchange",s);const a=new ResizeObserver(s);a.observe(n),a.observe(r),a.observe(i),window.addEventListener("load",s)})('div:has(div[id*="fullscreen"])')}X(e)&&(()=>{const e=document.querySelector("#takeover"),t=document.querySelector("div[id*='mobile-topboard'], div[id*='topboard']"),n=null==t?void 0:t.parentElement;t&&n&&e&&(e.appendChild(t),n.style.display="none")})(),ie(e)&&e.targetId.includes("netboard")&&pe(e)},adLoaded:e=>{},adNoBid:e=>{if(re(e.targetId)){const{finnBlink:t}=d.get();((e,t)=>{c(void 0,void 0,void 0,function*(){const{deviceType:n}=d.get();if(!t||!L(n))return;yield S(O);const{replacementConfig:i}=t,r=document.querySelector(`[id^="${e}"]`);if(!r||!(null==i?void 0:i.sizes))return;const{sizes:o}=i,s=q(e),a=D(s);r.dataset.finnBlinkId=s,r.dataset.noBidAd="true",M(r,a),A().withFinnBlinkAd(s)})})(e.targetId,t)}},adError:(e,t)=>{},adCollapse:()=>{},adRequestFailure:e=>{},adBadRequest:e=>{},adLoadedMediated:e=>{},adNoBidMediated:e=>{}},he={NO:"no",SE:"se"},me=()=>{const{country:e}=d.get();return e===he.NO?"no-sno":"se-generic"},ye=()=>{const{country:e,publisher:t}=d.get();return`${e}-${t}`},fe=e=>new URLSearchParams(window.location.search).get(e),we=()=>{if(!window.location.search.includes("kv_"))return{};const e={},t=(()=>{const e=new URLSearchParams(window.location.search);return Object.fromEntries(e)})();return Object.keys(t).forEach(n=>{n.startsWith("kv_")&&(e[n.slice(3)]=t[n])}),e},be={SVD:"svd",VG:"vg",GODARE:"godare",AFTENPOSTEN:"aftenposten",SA:"sa",BT:"bt",AFTONBLADET:"aftonbladet",E24:"e24",MINMOTE:"minmote",PENT:"pent",GODT:"godt",TEK:"tekno",KLART:"klart",TVNU:"tvnu",POLARIS:"polaris",KOKET:"koket",TV4:"tv4",FOTBOLLSKANALEN:"fotbollskanalen"},Ee=e=>{const{source:t}=e;return"csm"===t},Te={[be.VG]:["board","netboard","backfill","outstream"],[be.AFTONBLADET]:["panorama","outstream"],[be.GODARE]:["panorama","outstream"],[be.SVD]:["wph-article-panorama","wph-front-panorama"]},Ie=e=>{var t;const{publisher:n}=d.get();return!!Te[n]&&!!(null===(t=Te[n])||void 0===t?void 0:t.some(t=>e.includes(t)))},Ae=e=>new Promise(t=>{if(!window._tcf_||!(null==e?void 0:e.enabled))return void t(!1);const n=(()=>{if(!window._tcf_)return null;const e=window._tcf_.getPermissionSync("CMP:advertising");if(null===e)return null;const t=Number(e);return j("Advertising permission value obtained synchronously: ",e),Boolean(t)})();if(null!==n)return void t(n);let i=!1;const r=e=>{i||(j("Resolving advertising permission value obtained"),i=!0,t(e))},o=setTimeout(()=>{j("Advertising permission timed out, resolving with false"),r(!1)},3e3);window._tcf_.onTcfReady(()=>{j("On Tcf Ready called, waiting for permission"),clearTimeout(o)}),window._tcf_.getPermission("CMP:advertising",e=>{clearTimeout(o);const t=Number(e);j("Advertising permission value obtained asynchronously: ",e),r(Boolean(t))})}),ke="cmp:loaded";let Ce,Se=!1;const Oe=(e,t,n)=>{const i=!!(null==e?void 0:e.enabled),r=(null==e?void 0:e.timeout)||3e3,o=fe("bypass_tcf"),s=()=>{if(!(null==e?void 0:e.enabled))return!0;if(((e,t)=>e?!!t&&(j("TCF bypass param detected, returning consent: true"),!0):(j("TCF is not enabled, returning consent: true"),!0))(i,o))return!0;if(Se)return null;if(!Ce)throw new Error("[Advertory]: getConsentSync method was called before the tcfManager was available.");const t=Ce.getConsentedToAllSync();return j(`TCF consented to all is: ${t}`),Ce.getConsentedToAllSync()};return{initConsentManager:()=>(null==e?void 0:e.enabled)?new Promise((e,t)=>{if(j("Getting TCF consent manager..."),window._tcf_)return j("TCF consent manager is already available"),Ce=window._tcf_,void e(Ce);j("TCF consent manager is not available");const n=()=>{j("CMP loaded, resolving consent manager..."),i&&clearTimeout(i),window._tcf_?(Ce=window._tcf_,e(Ce)):t(new Error("CMP loaded but window._tcf_ is not defined"))},i=setTimeout(()=>{document.removeEventListener(ke,n),Se=!0,t(new Error("Timeout waiting for CMP to load"))},r);j("Listening for CMP loaded event..."),document.addEventListener(ke,n,{once:!0})}):Promise.resolve(null),getConsentSync:s,getConsentAsync:()=>c(void 0,void 0,void 0,function*(){if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return j(`Schibsted Ad Choices override value is set, returning override value: ${e.schibstedAdChoicesOverrideValue}`),Boolean(Number(e.schibstedAdChoicesOverrideValue));const i=(null==e?void 0:e.schibstedAdChoicesEnabled)&&n===he.SE,o=(null==e?void 0:e.schibstedAdChoicesEnabled)&&!t&&n===he.NO;if(i||o)return j("Schibsted Ad Choices is enabled, getting advertising permissions..."),yield Ae(e);if(!(null==e?void 0:e.enabled))return!0;const a=s();return null!==a?a:yield new Promise((e,t)=>{try{if(!Ce)throw new Error("[Advertory]: getConsentAsync method was called before the tcfManager was available.");let t=!1;const n=n=>{t||(t=!0,e(n))},i=setTimeout(()=>{j("TCF isConsentedToAll timed out, resolving with false"),n(!1)},r);Ce.onTcfReady(()=>{j("On Tcf Ready called, waiting for consent"),clearTimeout(i)}),Ce.isConsentedToAll(t=>{clearTimeout(i),e(t)})}catch(e){t(e)}})})}},Pe=e=>{const t=encodeURIComponent(e).replace(/[-.+*]/g,"\\$&"),n=new RegExp(`(?:(?:^|.*;)\\s*${t}\\s*\\=\\s*([^;]*).*$)|^.*$`);return decodeURIComponent(document.cookie.replace(n,"$1"))||null},$e=()=>{const e=Pe("_pulse2data");return e?e.split(",")[2]:void 0},Le=9826;class xe{constructor(){this.getSupplyTypeKeywords=()=>{const{deviceType:e=$.DESKTOP,isMobileApp:t}=d.get();if(t){return{"aa-sch-supply_type":`app_${e===$.MOBILE?"phone":$.TABLET}`}}return{"aa-sch-supply_type":`web_${this.getPageOptionsFormatDevice(e)}`}}}prepare(e){return c(this,void 0,void 0,function*(){return Object.assign(Object.assign({},e),{keywords:Object.assign(Object.assign(Object.assign(Object.assign({},e.keywords),this.getSupplyTypeKeywords()),yield this.getFormattedExternalIdKeywords()),this.getHasContextKeywords(e.keywords)),user:{externalUid:yield this.getExternalUid(),dnt:yield this.isTrackingForbidden()}})})}getFormattedExternalIdKeywords(){return c(this,void 0,void 0,function*(){const e=yield this.getExternalUid(),t=this.getUserId();return{"aa-sch-externalid_src":Number(!!e)+Number(!!t)}})}getUserId(){return $e()}getExternalUid(){return c(this,void 0,void 0,function*(){return yield c(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=d.get(),{getConsentAsync:i}=Oe(e,t,n);if(!(yield i()))return;const r=Pe("_pulse2data");return r?r.split(",")[9]:void 0})})}isTrackingForbidden(){return c(this,void 0,void 0,function*(){return(null===navigator||void 0===navigator?void 0:navigator.globalPrivacyControl)||"1"===(null===navigator||void 0===navigator?void 0:navigator.doNotTrack)||"DO_NOT_TRACK"===(yield this.getExternalUid())})}getMember(){const{pageOptions:{member:e},testMember:t=Le}=d.get();return window.location.search.includes("inventory_test=true")?t:e}getCMPValue(e){return localStorage.getItem(`CMP:${e}`)?"0"===localStorage.getItem(`CMP:${e}`)?"0":"1":"0"}getPublisherKeywords(){const{publisher:e}=d.get();return{"aa-sch-publisher":`${e}`}}getAnalyticsConsentKeywords(){return{"aa-sch-cmp_analytics":this.getCMPValue("analytics")}}getAdvertisingConsentKeywords(){return c(this,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=d.get(),{getConsentAsync:i}=Oe(e,t,n);return{"aa-sch-cmp_advertising":(yield i())?"1":"0"}})}getPageTypeKeywords(){const{pageType:e}=d.get();return{"aa-sch-page_type":e}}getCountryCodeKeywords(e){return{"aa-sch-country_code":e}}getInventoryTypeKeywords(){return{"aa-sch-inventory_type":"editorial"}}getHasContextKeywords(e){const t=e["aa-sch-context_keyword"];return{"aa-sch-has_context_keyword":Array.isArray(t)&&t.length?1:0}}getPageOptionsFormatDevice(e="desktop"){return"mobile"===e?"phone":e}getSponsorsKeywords(){var e;const{publisher:t,keywordsConfig:n}=d.get(),i=null===(e=null==n?void 0:n.sponsors)||void 0===e?void 0:e.split(":").map(e=>`${t}_${e}`);return i?{"no-sno-news-sponsors":i}:{}}}const Ne=new xe;function je(e=!1){var t,n;const i=null===(n=null===(t=window.navigator)||void 0===t?void 0:t.userAgent)||void 0===n?void 0:n.toLocaleLowerCase(),r=(()=>{const e=window.navigator.userAgent.toLowerCase(),t=[["win","windows"],["macintosh","macos"],["x11","linux"],["android","android"],["ipad","ios"],["iphone","ios"]].find(([t])=>e.includes(t));return t?t[1]:"unknown"})();return{OS:r,mobileOS:["ios","android"].includes(r)?r:"unknown",isHybridApp:i.includes("hermes"),appMode:e?"hybrid":"notinapp"}}Ne.prepare.bind(Ne);const _e=["aLOLE","xBqQj","1KaqJ","1nzXzK","opm8zV","4qKXKR","Ad9QgE"];function qe(e){return t=window.location.pathname.split("/").slice(-2,-1).pop()||"",_e.includes(t)?{"no-sno-news-section":`${e}_doedsfall`}:{};var t}class De extends xe{constructor(){super(...arguments),this.getDeviceKeywords=()=>{const{deviceType:e=$.DESKTOP}=d.get();return{"no-sno-device":this.getPageOptionsFormatDevice(e)}}}getAppTypeKeywords(){const{deviceType:e,isMobileApp:t}=d.get(),{OS:n,isHybridApp:i}=je(t);return{"no-sno-apptype":n&&e&&i?`${n}_${this.getPageOptionsFormatDevice()}_hybrid`:"none"}}getObituariesKeywords(e){return qe(e)}getSectionPageTypeKeywords(){var e,t;const{pageOptions:n,pageType:i}=d.get(),r=null!==(t=null===(e=n.keywords["no-sno-news-section"])||void 0===e?void 0:e.toString())&&void 0!==t?t:"ettan";return{"no-sno-section-page_type":`${r.split("_").pop()||r}_${"article"===i?"article":"front"}`}}}const Me=864e5,Be=(()=>{const e=e=>{const t=window.localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return j("Error with parsing localStorage data"),null}},t=(e,t)=>{window.localStorage.setItem(e,JSON.stringify(t))};return{get:e,set:t,setWithTimestamp:(e,n,i=Me)=>{const r={data:n,expirationTime:(new Date).getTime()+i};t(e,JSON.stringify(r))},getByTimestamp:(t,n=Me)=>{const i=e(t);if(!i)return null;if(!n)return i;try{const{expirationTime:e,data:t}=JSON.parse(i);return(new Date).getTime()<=e?t:null}catch(e){return j("Error with parsing localStorage data"),null}}}})(),Re="glimrTags",Fe=["glwe_","glwet_"],Ve={geofenceTags:[],geoTags:[],weatherTags:[]},Ue=(e,t,n,...i)=>c(void 0,[e,t,n,...i],void 0,function*(e,t,n,i="NOT SPECIFIED FEATURE"){if(!(null==e?void 0:e.schibstedConsentToPayEnabled))return j(`Schibsted Consent to Pay is not enabled, returning true for ${i}`),!0;if(null==e?void 0:e.schibstedAdChoicesOverrideValue)return j(`Schibsted Ad Choices override value is set, returning override value: ${null==e?void 0:e.schibstedAdChoicesOverrideValue} for ${i}`),Boolean(Number(null==e?void 0:e.schibstedAdChoicesOverrideValue));const{getConsentAsync:r}=Oe(e,t,n);return(yield r())?(j(`Schibsted Ad Choices consent given according to TCF consent manager for ${i}`),!0):(j(`Schibsted Ad Choices consent not given according to TCF consent manager for ${i}`),!1)}),He=()=>c(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=d.get();if(null==e?void 0:e.schibstedConsentToPayEnabled){return yield Ue(e,t,n,"glimr")}const{getConsentAsync:i}=Oe(e,t,n);return yield i()}),ze=()=>c(void 0,void 0,void 0,function*(){const{glimr:e}=d.get();if(!(yield He())||!(null==e?void 0:e.enabled))return void j("No consent for glimr data fetching.");const t=yield(n=500,c(void 0,void 0,void 0,function*(){return yield Promise.race([c(void 0,void 0,void 0,function*(){const e=yield import("glimr-sdk");return e.default||e}),new Promise(e=>setTimeout(()=>e(!1),n))])}));var n;if(t)try{t.setTagCacheTimeInSeconds(300),yield new Promise(n=>{t.getTags(e.clientId,(e,t)=>{Be.setWithTimestamp(Re,{tags:e,tagMappings:t}),n(!0)})})}catch(e){j(`Error during getting glimr data: ${e}`)}else j("Timeout (500ms) while loading glimr package. Skipping glimr data fetching.",{glimr:t})}),We={svd:"svd",vg:"vg",godare:"godare",aftenposten:"no-aftenposten",sa:"no-stavangeraftenblad",bt:"no-bergenstidende",aftonbladet:"aftonbladet",e24:"e24",minmote:"minmote",pent:"pent",godt:"godt",tek:"no-tek"},Ke=e=>Fe.some(t=>e.startsWith(t)),Ge=e=>e.startsWith("glgc_"),Je=e=>!Ke(e)&&!Ge(e),Ye=e=>{const t=Qe();if(!t)return Ve;const n=((e=[])=>e.filter(Ke))(t),i=((e=[])=>e.filter(Ge))(t),r=((e=[],t)=>{const n=e.filter(Je);if(t){const{publisher:e}=d.get(),t=We[e]||e;n.push(t)}return n})(t,e);return{geoTags:r,geofenceTags:i,weatherTags:n}},Qe=()=>{const e=Be.getByTimestamp(Re);return e&&"string"!=typeof e?null==e?void 0:e.tags:null},Xe={get:(e,t)=>c(void 0,void 0,void 0,function*(){const n=yield fetch(e,t);if(!n.ok)throw new Error(n.statusText);return yield n.json()}),post:(e,t,n)=>c(void 0,void 0,void 0,function*(){const i=JSON.stringify(n),r=yield fetch(e,{method:"POST",headers:t,body:i});if(!r.ok)throw new Error(r.statusText);return yield r.json()})},Ze="advertory:ppids-cache",et={[he.SE]:`SCH${he.SE.toUpperCase()}-EnvHash`,[he.NO]:`SCH${he.NO.toUpperCase()}-EnvHash`},tt={[he.SE]:`SCH${he.SE.toUpperCase()}-UserHash`,[he.NO]:`SCH${he.NO.toUpperCase()}-UserHash`},nt={[he.SE]:`sch${he.SE}-envhash-v3`,[he.NO]:`sch${he.NO}-envhash-v3`},it={[he.SE]:`sch${he.SE}-userhash-v3`,[he.NO]:`sch${he.NO}-userhash-v3`},rt={[he.SE]:`'sch${he.SE}-iosid-v3'`,[he.NO]:`'sch${he.NO}-iosid-v3'`},ot={[he.SE]:`sch${he.SE}-androidid-v3`,[he.NO]:`sch${he.NO}-androidid-v3`},st={[he.SE]:"sdrn:schibsted.com:user",[he.NO]:"sdrn:spid.no:user"};class at{constructor(){this.eids=[]}add(e,t){return e&&this.eids.push({id:e,source:t}),this}buildRyEids(){return this.eids.map(({id:e,source:t})=>({source:t,uids:[{id:e,atype:1,ext:{stype:"ppuid"}}]}))}buildEids(){return[...this.eids]}buildVideoEids(){return this.eids.map(({id:e,source:t})=>`${t},${e}`).join("|")}buildNorstatPath(){const e=this.eids[0];return e?`${e.source}-${e.id}`:""}buildNorstatQuery(e){const t=new URLSearchParams;return this.eids.slice(1).forEach(({id:n,source:i})=>{t.append(e,`${i}-${n}`)}),t}}const dt=new class{constructor(){this.ppid1=null,this.ppid2=null}processPPIDs(e){return c(this,arguments,void 0,function*(e,t=1e4){var n,i;const r=yield Promise.race([new Promise(e=>{setTimeout(()=>e({xandr:{ppId1:"",ppId2:""}}),t)}),e.instance.getAdvertisingIdentifiers()]);this.setPPIDs(null===(n=r.xandr)||void 0===n?void 0:n.ppId1,null===(i=r.xandr)||void 0===i?void 0:i.ppId2)})}getPPIDs(){var e,t;return null!==this.ppid1&&null!==this.ppid2||j("PPIDv2s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(t=this.ppid2)&&void 0!==t?t:""}}setPPIDs(e,t){this.ppid1=null!=e?e:"",this.ppid2=null!=t?t:""}},lt=new class{constructor(){this.ppid1=null,this.ppid2=null,this.idfv=null,this.anId=null}processPPIDs(e,t){return c(this,void 0,void 0,function*(){var n,i,r,o,s,a,d,l,c,u,v;const p=Be.get(Ze),g=yield this.getNewPPIDs(e,t);if(this.shouldHash(p,g)){const t=null!==(n=e.hasherUrl)&&void 0!==n?n:"https://hasher.schibsted.com/api/v1/hash",l=this.createHasherPayload(g),c=yield this.hashPPIDs(l,t);return c?(this.cachePPIDs(l,c,null===(i=g.idfv)||void 0===i?void 0:i.plain,null===(r=g.anId)||void 0===r?void 0:r.plain),void this.setPPIDs(null!==(o=c.userId)&&void 0!==o?o:"",null!==(s=c.environmentId)&&void 0!==s?s:"",null===(a=g.idfv)||void 0===a?void 0:a.plain,null===(d=g.anId)||void 0===d?void 0:d.plain)):void this.setPPIDs("","")}this.setPPIDs(null!==(l=null==p?void 0:p.userId.hashed)&&void 0!==l?l:"",null!==(c=null==p?void 0:p.environmentId.hashed)&&void 0!==c?c:"",null===(u=null==g?void 0:g.idfv)||void 0===u?void 0:u.plain,null===(v=null==g?void 0:g.anId)||void 0===v?void 0:v.plain)})}getPPIDs(){var e,t;return null!==this.ppid1&&null!==this.ppid2||j("PPIDv3s accessed before they have been initialized"),{ppid1:null!==(e=this.ppid1)&&void 0!==e?e:"",ppid2:null!==(t=this.ppid2)&&void 0!==t?t:"",idfv:this.idfv,anId:this.anId}}setPPIDs(e,t,n,i){this.ppid1=null!=e?e:"",this.ppid2=null!=t?t:"",this.idfv=null!=n?n:null,this.anId=null!=i?i:null}shouldHash(e,t){var n,i;if(!e)return!0;for(const r in e){if((null===(n=e[r])||void 0===n?void 0:n.plain)!==(null===(i=t[r])||void 0===i?void 0:i.plain))return!0}return!1}cachePPIDs(e,t,n,i){const r=Object.assign(Object.assign({clientId:{plain:e.clientId},userId:{plain:e.userId,hashed:t.userId},environmentId:{plain:e.environmentId,hashed:t.environmentId},trackerType:{plain:e.trackerType},trackerVersion:{plain:e.trackerVersion}},n?{idfv:{plain:n}}:{}),i?{anId:{plain:i}}:{});Be.set(Ze,r)}hashPPIDs(e,t){return c(this,void 0,void 0,function*(){try{const n=new Headers({"Content-Type":"application/json"});return yield Xe.post(t,n,e)}catch(e){return j("Error with hashing PPIDs",e),null}})}getNewPPIDs(e,t){return c(this,arguments,void 0,function*({clientId:e,instance:t},n){const i=yield((e,t)=>c(void 0,void 0,void 0,function*(){const n=yield e.getUserId();return n?`${st[t]}:${n}`:null}))(t,n),r=yield(e=>c(void 0,void 0,void 0,function*(){const t=yield e.getEnvironmentId();return t?`sdrn:schibsted:environment:${t}`:null}))(t),o=window.advertory_idfv,s=window.advertory_anId;return Object.assign(Object.assign({clientId:{plain:e},userId:{plain:i},environmentId:{plain:r},trackerType:{plain:"Advertory"},trackerVersion:{plain:"1.0.0"}},o?{idfv:{plain:o}}:{}),s?{anId:{plain:s}}:{})})}createHasherPayload({clientId:e,trackerType:t,trackerVersion:n,userId:i,environmentId:r}){return{clientId:e.plain,trackerType:t.plain,trackerVersion:n.plain,userId:i.plain,environmentId:r.plain}}},ct=e=>c(void 0,void 0,void 0,function*(){const{tracker:t,tcf:n,country:i,isMobileApp:r}=e;if(!(yield Ue(n,r,i,"setXandrPPIDs")))return;if(!t)return;(yield Promise.allSettled([dt.processPPIDs(t,null==n?void 0:n.timeout),lt.processPPIDs(t,i)])).forEach((e,t)=>{if("rejected"===e.status){j(`Cannot fetch PPIDs v${t+2}`,e.reason)}})}),ut=e=>{const{ppid1:t,ppid2:n}=dt.getPPIDs(),{ppid1:i,ppid2:r,idfv:o,anId:s}=lt.getPPIDs();return{userIds:[{type:"extendedIDs",eids:(new at).add(n,et[e]).add(t,tt[e]).add(r,nt[e]).add(i,it[e]).add(o,rt[e]).add(s,ot[e]).buildEids()}]}},vt=e=>{const{ppid1:t,ppid2:n}=dt.getPPIDs(),{ppid1:i,ppid2:r,idfv:o,anId:s}=lt.getPPIDs();if(!n)return{};return{userSync:{userIds:[{name:"pubProvidedId",params:{eids:(new at).add(n,et[e]).add(t,tt[e]).add(r,nt[e]).add(i,it[e]).add(o,rt[e]).add(s,ot[e]).buildRyEids()}}]}}},pt={FRONT:"front"};const gt=new class extends De{prepare(e){return c(this,void 0,void 0,function*(){const t=this.getPageTypeKeywords()["aa-sch-page_type"],n=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({"aa-sch-country_code":he.NO},this.getPublisherKeywords()),this.getPageTypeKeywords()),yield this.getFormattedExternalIdKeywords()),this.getSupplyTypeKeywords()),this.getAppTypeKeywords()),this.getDeviceKeywords()),yield this.getAdvertisingConsentKeywords()),this.getHasContextKeywords(e.keywords)),yield c(void 0,void 0,void 0,function*(){const{glimr:e}=d.get(),{addPublisherToGeo:t}={},n=yield He();if(!(null==e?void 0:e.enabled)||!n)return j("No consent for getting glimr tags."),{};const i=me(),r=Ye(t);return{[`${i}-geo`]:r.geoTags,[`${i}-weather`]:r.weatherTags,[`${i}-geofence`]:r.geofenceTags}})),(()=>{const{ppid1:e,ppid2:t}=dt.getPPIDs();return{"aa-sch-schuserhash":e?"1":"0","aa-sch-schenvhash":t?"1":"0"}})()),e.keywords),i=Object.assign(Object.assign({},n),this.getSponsorsKeywords()),r=Object.assign(Object.assign({},n),this.getPageTypeKeywords());return Object.assign(Object.assign({},e),{keywords:t===pt.FRONT?r:i,user:Object.assign(Object.assign({},ut(he.NO)),{externalUid:yield this.getExternalUid()}),member:this.getMember()})})}};var ht=gt.prepare.bind(gt);const mt=()=>(window.apntag||(window.apntag={anq:[],defineTag:e=>({targetId:""}),showTag:e=>{},onEvent:(e,t,n)=>{},offEvent:(e,t)=>{},refresh:e=>{},modifyTag:(e,t)=>{},loadTags:e=>{},emitEvent:(e,t)=>{},setPageOpts:e=>{},resizeAd:(e,t,n)=>{},getAstVersion:()=>"",setEndpoint:(e,t)=>{},fireImpressionTrackers:e=>{},setKeywords:()=>{},clearRequest:()=>{}}),window.apntag),yt=()=>(window.relevantDigital||(window.relevantDigital={cmd:[]}),window.relevantDigital),ft=(e={},t)=>{const{prebid:{externalUidInAuctionEnabled:n,forwardGlimrTags:i=!1}={}}=d.get(),r=[`${me()}-geo`],o=["aa-sch-context_keyword","aa-sch-publisher","se-aftonbladet-section","se-svd-section","se-generic-section","no-sno-news-section","no-sno-news-subsection",...i?r:[]],s=Object.fromEntries(Object.entries(e).filter(([e])=>o.includes(e))),a=t&&n?{id:t}:{};return{ortb2:Object.assign({site:{ext:{data:s}}},a)}},wt=(e,...t)=>c(void 0,[e,...t],void 0,function*(e,{timeout:t}={timeout:1e3}){document.querySelector(`script[src="${e}"]:not([type="module"])`)||(yield new Promise((n,i)=>{const r=document.createElement("script");r.async=!0,r.src=e;const o=()=>{a(),n()},s=()=>{a(),i(new Error(`Failed to load ${e}`))},a=()=>{r.removeEventListener("load",o),r.removeEventListener("error",s),clearTimeout(d)};r.addEventListener("load",o),r.addEventListener("error",s);const d=setTimeout(()=>{a(),i(new Error(`Loading script timed out: ${e}`))},t);document.head.appendChild(r)}).catch(e=>{console.error(e)}))}),bt=e=>e.includes("snoap.no"),Et=e=>{var t,n,i,r,o;return!!(null===(o=null===(r=null===(i=null===(n=null===(t=window.apntag)||void 0===t?void 0:t.requests)||void 0===n?void 0:n.tags[e])||void 0===i?void 0:i.adResponse)||void 0===r?void 0:r.ads[1])||void 0===o?void 0:o.rtb)},Tt=(e,t=(...e)=>{})=>{const n=t.toString();if(0===e.length)return n;const i=n.substring(0,n.indexOf("=>")).replace("(","").replace(")","").split(",").map(e=>e.trim()),r=n.substring(n.indexOf("{")+1,n.lastIndexOf("}")),o=i.map((t,n)=>`${t} = "${e[n]}"`);return new Function(...o,r).toString()},It=Tt([],()=>{const e=({width:e,height:t})=>{var n;const i=null===(n=document.querySelector("#sf_align"))||void 0===n?void 0:n.querySelector("div");if(!i)return;const{clientWidth:r,clientHeight:o}=i,s=e/r,a=t/o;i.style.transform=`scale(${s},${a})`,i.style.transformOrigin="left top"},t=()=>{const{innerWidth:t,innerHeight:n}=window;e({width:t,height:n})};window.addEventListener("resize",t=>{if(!t.currentTarget)return;const n={width:innerWidth,height:innerHeight};e(n)});const n=window.frameElement;(null==n?void 0:n.contentWindow)?n.contentWindow.document.body.onload=t:document.body.onload=t}),At=e=>{const t=Tt([],()=>{new MutationObserver((e,t)=>{document.querySelector("iframe")&&((()=>{const e=document.querySelector("iframe");e&&(e.onload=()=>{if(!e.contentDocument)return;document.body.style.height="100%",document.documentElement.style.height="100%",e.height="100%",e.width="100%";const t=e.contentDocument.createElement("style");t.textContent="\n adfm-ad {\n height: 100% !important;\n width: 100% !important;\n }\n ",e.contentDocument.head.appendChild(t);const n=e.contentDocument.querySelector("iframe");if(!(null==n?void 0:n.contentDocument))return;const i=n.contentDocument.createElement("style");i.textContent="\n #image {\n background-size: cover !important;\n }\n ",new MutationObserver((e,t)=>{n.contentDocument&&(n.contentDocument.head.appendChild(i),t.disconnect())}).observe(e.contentDocument,{childList:!0,subtree:!0})})})(),t.disconnect())}).observe(document.body,{childList:!0,subtree:!0})}),n=document.createElement("script");n.textContent=`(${t})()`;return e+n.outerHTML},kt=[],Ct={},St=(e,t)=>{e.forEach(({target:e,isIntersecting:n})=>{const i=Pt(e);n?(Ot(i,n),$t(e,i,t)):(Ot(i,n),Lt(e,i,t))})},Ot=(e,t)=>{var n,i;const r=null===(n=document.getElementById(e))||void 0===n?void 0:n.querySelector("iframe");if(!r)return;const o=t?"showFullscreen":"hideFullscreen";null===(i=r.contentWindow)||void 0===i||i.postMessage(`advertory:${o}-${e}`,"*")},Pt=e=>{var t;return null===(t=e.children[0])||void 0===t?void 0:t.id},$t=(e,t,n)=>{e.classList.add("in-screen"),document.body.classList.add("fullscreen-scroll-in-screen"),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollInView")),kt.includes(t)||kt.push(t),n&&window.addEventListener("scroll",Ct[t],{passive:!0})},Lt=(e,t,n)=>{kt.includes(t)&&(n&&window.removeEventListener("scroll",Ct[t]),document.body.classList.remove("fullscreen-scroll-in-screen"),e.classList.remove("in-screen"),window.dispatchEvent(new CustomEvent("advertory:fullscreenScrollNotInView")))},xt=(e,t={fadingHeaderEnabled:!1,headerSelectors:[".js-masthead"],skyscraperSelectors:[".skyscraper_r"],headerZIndex:3})=>{const{headerSelectors:n=[".js-masthead"],skyscraperSelectors:i=[".skyscraper_r"],headerZIndex:r=3}=t,o=[],s=[];return n.forEach(e=>{var t;const n=null!==(t=document.querySelector(e))&&void 0!==t?t:document.querySelector("header");n&&o.push(n)}),i.forEach(e=>{const t=document.querySelector(e);t&&s.push(t)}),()=>{o.length&&Nt(e,o,r,0),s.length&&Nt(e,s,r,40)}},Nt=(e,t,n,i)=>{const r=e.offsetHeight,o=window.scrollY,s=e.getBoundingClientRect().top+o;t.forEach(e=>{const t=e.offsetHeight;let a;a=s>o?(s-o)/t-i:(o+t-(s+r))/t;const d=a<=0;e.style.visibility=d?"hidden":"",e.style.zIndex=d?"":n.toString(),e.style.pointerEvents=d?"none":"all",e.style.opacity=a.toString()})},jt={no:{adText:"ANNONSE",adFrom:"ANNONSE FRA",adContent:"ANNONSØRINNHOLD",adContentFrom:"ANNONSØRINNHOLD FRA"},se:{adText:"ANNONS",adFrom:"ANNONS FRÅN",adContent:"EXTERN LÄNK",adContentFrom:"EXTERN LÄNK FRÅN"}};let _t=null;const qt=(e,t)=>{let n=e;return n=(e=>{const t=document.createElement("script");return t.textContent="\n {\n const frame = window.frameElement;\n \n if (frame) {\n frame.contentWindow.document.body.onload = onLoad;\n } else {\n document.body.onload = onLoad;\n }\n \n function onLoad() {\n window.addEventListener('message', function(event) {\n if (event.data === 'advertory:showFullscreen-'+document.body.id) {\n document.body.style.display= \"block\";\n } else if (event.data === 'advertory:hideFullscreen-'+document.body.id) {\n document.body.style.display= \"none\";\n }\n });\n }\n }\n ",e+t.outerHTML})(e),n=(e=>{const t=document.createElement("script");return t.textContent=`(${It})()`,e+t.outerHTML})(n),n=(e=>{if((e=>e.includes("google"))(e))return e;const t=document.createElement("div");t.innerHTML=e;const n=t.querySelector("img");return n?(n.style.width="100%",n.style.height="100%",n.style.objectFit="cover",n.style.position="fixed",t.innerHTML):e})(n),n=(e=>{if(bt(e))return e;const t=document.createElement("style");return t.textContent="\n .GoogleActiveViewClass, .GoogleActiveViewElement {\n transform: translate(calc(-50% + 50vw), 0);\n width: 100vw !important;\n height: 100vh !important;\n }\n .GoogleActiveViewClass img, .GoogleActiveViewElement img {\n width: 100vw;\n height: 100vh;\n object-fit: cover;\n }\n .GoogleActiveViewClass iframe {\n width: 100vw !important;\n height: 100vh !important;\n }\n ",e+t.outerHTML})(n),(e=>e.includes("adform"))(n)&&(n=(e=>{const t=document.createElement("script");t.textContent='\n var frame = window.frameElement;\n if (frame) {\n frame.style.removeProperty("width");\n frame.style.removeProperty("height");\n frame.contentWindow.document.body.onload = onLoad;\n } else {\n document.body.onload = onLoad;\n }\n \n function onLoad() {\n var iframe = document.querySelector("adfm-ad iframe");\n if (iframe) {\n var image = iframe.contentWindow.document.getElementById("image");\n if (!image) return;\n image.style.backgroundSize = "cover";\n } else {\n var iframe = document.querySelector(".adform-adbox iframe");\n if (iframe) {\n var style = document.createElement("style");\n style.textContent = "#banner {width: 100% !important; height: 100% !important;} #banner img {object-fit: cover;}";\n iframe.contentDocument.body.append(style);\n iframe.style = "width: 100vw; height: 100vh;";\n } else {\n var observer = new MutationObserver(function(mutations, obs) {\n for (var mutation of mutations) {\n var iframe = mutation.addedNodes[0];\n if (iframe && iframe.nodeName === "IFRAME") {\n iframe.style = "width: 100vw; height: 100vh;";\n iframe.dataset.contents += "<style>#banner {width: 100% !important; height: 100% !important;} #banner img {object-fit: cover;}</style>";\n obs.disconnect();\n }\n }\n });\n observer.observe(document.body, { childList: true, subtree: true });\n }\n }\n }\n ';const n=document.createElement("style");return n.textContent="\n html, body, adfm-ad, #sf_align, .adform-adbox, .adform-adbox img {\n width: 100% !important;\n height: 100% !important;\n object-fit: cover;\n max-width: 100vw;\n }\n ",e+n.outerHTML+t.outerHTML})(n)),(e=>e.includes("529299503"))(n)&&(n=At(n)),(e=>e.includes("de17a"))(n)&&(n=(e=>bt(e)?e:e.replace("<iframe ","<iframe onload=\"\n var f = document.querySelector('iframe');\n if (!f) return;\n var s = f.style;\n s.transform = 'scale(' + (window.innerHeight / Number(f.height)).toFixed(2) + ')';\n s.right = parseInt((Number(f.width) - window.innerWidth) / 2) + 'px';\n s.bottom = parseInt((Number(f.height) - window.innerHeight) / 2) + 'px';\n s.position = 'relative';\n \" "))(n)),bt(n)&&(n=(e=>{let t=e.replace("<html>",'<html style="height: 100%;">');return t=t.replace("</iframe>","</iframe><style>#sf_align {height: 100%;} #sf_align iframe {height: 100vh;}</style>"),t=t.replace('<body style="','<body style="height: 100%; '),t})(n)),(e=>e.includes("kreateam.io"))(n)&&(n=(e=>{let t=e.replace("<html>",'<html style="height: 100%;">');return t=t.replace("</div>","</div><style>#sf_align {height: 100%;} #sf_align iframe {height: 100vh;}</style>"),t=t.replace('<body style="','<body style="height: 100%; '),t})(n)),Et(t)&&(n=(e=>{const t=document.createElement("script");t.textContent='var frame = window.frameElement;\n if (frame) {\n frame.style.width = "100vw";\n frame.style.height = "100vh";\n }';const n=document.createElement("div");return n.innerHTML=e,n.appendChild(t),n.innerHTML})(n)),n},Dt=()=>{_t=null;const e=window.visualViewport,t=e?e.height:window.innerHeight,n=e?e.width:window.innerWidth,i=e?e.offsetLeft:0,r=document.documentElement;r.style.setProperty("--advertory-fullscreen-scroll-vh",`${t}px`),r.style.setProperty("--advertory-fullscreen-scroll-vw",`${n}px`),r.style.setProperty("--advertory-fullscreen-scroll-left",`${i}px`)},Mt=()=>{_t||(_t=window.requestAnimationFrame(Dt))},Bt=(e,t)=>{var n,i,r,o;const{country:s}=d.get(),{targetId:a}=e;document.documentElement.style.setProperty("--advertory-ios-safe-area-top-fix",null!==(n=null==t?void 0:t.iosSafeAreaTopFix)&&void 0!==n?n:"0px"),(e=>{const{articlesContainerWidth:t=1302,backgroundColor:n="#fff",foregroundColor:i="#fff",margin:r="16px 0",beforeContentValue:o=""}=e,s=t/2,a=document.createElement("style");a.innerHTML=`\n :root {\n --background: linear-gradient(\n to right,\n ${n} 0px,\n ${n} calc(50% - ${s}px),\n ${i} calc(50% - ${s}px),\n ${i} calc(50% + ${s}px),\n ${n} calc(50% + ${s}px),\n ${n} 100%\n ) !important;\n \n --advertory-fullscreen-scroll-wrapper-margin: ${r};\n }\n \n .advertory-fullscreen-scroll-wrapper {\n ${o&&"clip-path: polygon(0 -16px, 100vw -16px, 100vw 100dvh, 0 100dvh);\n -webkit-clip-path: polygon(0 -16px, 100vw -16px, 100vw 100dvh, 0 100dvh);"}\n }\n\n .advertory-fullscreen-scroll-wrapper:before, .advertory-fullscreen-scroll-wrapper:after {\n background: var(--background);\n content: '${o}' !important;\n }`,a.id="ad-fullscreen-scroll-wrapper-style",document.head.appendChild(a)})(null!==(i=null==t?void 0:t.overlayStyles)&&void 0!==i?i:{});const l=document.getElementById(a),c=null==l?void 0:l.parentElement;if(!l||!c)return;((e,t)=>{const n=(null==t?void 0:t.fadingHeaderEnabled)||!1,i=new IntersectionObserver(e=>St(e,n),{}),r=Pt(e);i.observe(e),n&&(Ct[r]=xt(e,t))})(c,t),l.className="advertory-fullscreen-scroll";const u=ce(e,B)?"absolute":"fixed";l.style.position=u,c.className="advertory-fullscreen-scroll-wrapper",c.dataset.showTagSubscribeId=a,l.setAttribute("data-ad-label",jt[s].adText),(null==t?void 0:t.moveCogwheelToTheLeft)&&(l.dataset.moveCogwheelToTheLeft="true"),Mt(),window.addEventListener("resize",Mt),null===(r=window.visualViewport)||void 0===r||r.addEventListener("resize",Mt),null===(o=window.visualViewport)||void 0===o||o.addEventListener("scroll",Mt)},Rt=({targetId:e})=>{const t=(e=>{const{requests:t}=window.apntag,n=Et(e)?1:0;return null==t?void 0:t.tags[e].adResponse.ads[n].rtb.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Et(e)?1:0;n&&(n.tags[e].adResponse.ads[i].rtb.banner.content=t)})(e,qt(t,e))},Ft=()=>c(void 0,void 0,void 0,function*(){const{prebid:e,tcf:t,country:n,isMobileApp:i,fullscreenScroll:r}=d.get();if(!(null==e?void 0:e.enabled))return;const{initNativeAd:o}=d.getHandlers(),{getConsentAsync:s}=Oe(t,i,n),a=yield s(),l=(()=>{let e=!1,t=[];const n={relevantCb:{timeout:1e3},auctionCb:{timeout:2e3}};return{getCancel:()=>e,setCancel:t=>{e=t},events:n,failsafeOnTimeout:i=>{const r=mt(),{prebid:{relevantCbTimeout:o}={}}=d.get(),s="relevantCb"===i&&o?o:n[i].timeout,a=setTimeout(()=>{!n[i].done&&!e&&(console.warn(`Doing failsafe loadTags() call after waiting too long for '${i}'`),e=!0,r.loadTags&&r.loadTags())},s);t.push(a)},cleanup:()=>{t.forEach(e=>clearTimeout(e)),t=[],e=!1,n.relevantCb.done=!1,n.auctionCb.done=!1}}})(),c=mt(),u=(()=>{const{requests:{user:e={userIds:[]},keywords:t={}}={}}=mt();return{user:e,keywords:t}})();l.failsafeOnTimeout("relevantCb");const{user:{externalUid:v=""}={},keywords:p}=u;(()=>{const e=yt();return e.cmd||(e.cmd=[]),e.cmd})().push(()=>{if(l.getCancel()||!c.loadTags)return j("core loadTags() call was cancelled",{cancel:l.getCancel(),apnTagLoadTags:!c.loadTags,condition:"or"}),void l.cleanup();const t=yt();l.events.relevantCb.done=!0,l.failsafeOnTimeout("auctionCb");const i=a?{gdpr:{cmpApi:"iab",timeout:8e3}}:{cmpApi:"none"};j("prebid consentManagement",i),t.addPrebidConfig(Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},vt(n)),ft(p,v))),j("core add prebid config",Object.assign(Object.assign({consentManagement:i,enableSendAllBids:!1},vt(n)),ft(p,v))),t.loadPrebid({configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{l.getCancel()||(l.events.auctionCb.done=!0,c.loadTags(e)),l.cleanup()}},customNativeRender:e=>{Vt(e,o)},directRenderFn:e=>{const{settings:t,renderFn:n}=e,{bid:i,adDiv:o}=t||{};if(!o)return;const s=n(t),a=Object.assign(Object.assign({},i),{targetId:o.id,banner:!0});J(a)&&(Bt(a,r),(e=>{const t=()=>{const t=e.contentDocument;if(!(null==t?void 0:t.body))return;const n=()=>{const e=t.querySelector("iframe");if(!e)return!1;const n=()=>{var t;const n=null===(t=e.contentDocument)||void 0===t?void 0:t.querySelector(".adn-ttpa-container");n&&(n.style.setProperty("bottom","10px","important"),n.style.setProperty("top","unset","important"))};return e.addEventListener("load",n),n(),!0};if(n())return;const i=new MutationObserver(()=>{n()&&i.disconnect()});i.observe(t.body,{childList:!0,subtree:!0})};e.addEventListener("load",t),t()})(s))}}),j("core load prebid",{configId:e.id,manageAdserver:!1,collapseEmptyDivs:!1,collapseBeforeAdFetch:!1,noGpt:!0,noSlotReload:!0,loadUnknownSlots:!0,apntagCalls:{showTag:()=>{},loadTags:e=>{l.getCancel()||(l.events.auctionCb.done=!0,c.loadTags(e))}},customNativeRender:e=>{Vt(e,o)},directRenderFn:()=>{}})})}),Vt=(e,t)=>{var n;const{divId:i,native:r,bid:o}=e,s=document.querySelectorAll(`[id^=${i}]`)[0],a=`RY-${s.id}`;((e,t)=>{e.childNodes.forEach(e=>e.style.cssText="position: absolute; z-index: -1;");const n=document.createElement("div");n.setAttribute("id",t),e.appendChild(n)})(s,a);const l=null===(n=s.getElementsByTagName("iframe")[0])||void 0===n?void 0:n.contentWindow;t({native:r,targetId:a},d.get()),null==l||l.postMessage(JSON.stringify({message:"Prebid Response",ad:"\x3c!-- nothing --\x3e",adId:o.adId}),"*")};let Ut="";const Ht=new Map,zt=e=>{var t;const n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement,i=(null==n?void 0:n.offsetHeight)||0;n&&(n.style.minHeight=`${i}px`)},Wt=e=>{const t=e.parentElement;if(!e||!t)return;const{container:n,wrapper:i}=(e=>{const t=m.getData("initialClassNames")[e.id];return{wrapper:(null==t?void 0:t.wrapper)?t.wrapper.join(" "):"",container:(null==t?void 0:t.container)?t.container.join(" "):""}})(e);e.className=n,t.className=i},Kt=()=>{w();document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{T(e.id),Wt(e),(e=>{const t=document.querySelector(`#${e}`),n=null==t?void 0:t.getAttribute("data-probable-height"),i=null==t?void 0:t.getAttribute("data-probable-width");n&&i&&(null==t||t.style.setProperty("min-height",n+"px"),null==t||t.style.setProperty("min-probable-width",i+"px"))})(e.id),e.innerHTML="",e.id=q(e.id)}),v(()=>window.apntag.clearRequest())},Gt="noGroupedPlacements",Jt=e=>{const t=e.replace(/[0-9]/g,"");return"_"===t.slice(-1)?t.substring(0,t.length-1):t},Yt=e=>{if(!(null==e?void 0:e.minViewWidth))return!0;return window.innerWidth>=e.minViewWidth},Qt=e=>{var t;if(!(null===(t=null===window||void 0===window?void 0:window.advertory)||void 0===t?void 0:t.initialized))return[];const{placements:n,queryConfig:i,deviceType:r}=d.get(),o=n[r].filter(Yt)||[],s=e?document.querySelector(e):document;if(!s)return[];const a=o.reduce((e,t)=>{const n=Jt(t.id);return!n||e.includes(n)||e.push(n),e},[]).flatMap(e=>{const t=new RegExp(`^${e}(_(\\d+))?$`),n=o.filter(({id:e})=>e.match(t)),a=(null==i?void 0:i.queryByDataDevice)?`div[id^="${e}"][data-device=${r}], div[id^="${e}"][data-device=all]`:`div[id^="${e}"]:not([data-disabled="true"])`,l=s.querySelectorAll(a),c=Array.from(l).filter(({id:e})=>e.match(t)).map((e,t)=>{const i=Xt(e,t,n),r=`${e.id}-${((e=6)=>{if(e<=0)return"";let t="";for(let n=0;n<e;n++)t+=u[Math.floor(36*Math.random())];return t})(6)}`;return e.id=r,e.setAttribute("data-advertory-ad-rendered","true"),i.finnBlink&&!i.finnBlink.renderOnlyWithAdBlock&&e.setAttribute("data-is-finn-blink-placement","true"),(e=>{var t;const n=e.id;n&&m.setData("initialClassNames",{[n]:{wrapper:null===(t=e.parentElement)||void 0===t?void 0:t.className.split(" "),container:e.className.split(" ")}})})(e),Object.assign(Object.assign({},i),{id:r})});return(e=>{const{keywordsConfig:t}=d.get();return(null==t?void 0:t.includeCountingKeywordInTags)?(Ut!==window.location.pathname&&(Ht.clear(),Ut=window.location.pathname),e.map(e=>{var t;const n=e.invCode.replace(/_\d+$/,""),i=null!==(t=Ht.get(n))&&void 0!==t?t:0;return e.keywords=Object.assign({},e.keywords),e.keywords[`${ye()}-count`]=i,Ht.set(n,i+1),e})):e})(c)});return(e=>{const t=Array.from(document.querySelectorAll('div[class^="advertory"]'));return e.sort((e,n)=>t.findIndex(t=>t.id===e.id)-t.findIndex(e=>e.id===n.id))})(a)},Xt=(e,t,n)=>{const i=n[t],r=n[n.length-1],o=n.filter(({id:t})=>t===e.id)[0];return(null==e?void 0:e.id)===(null==i?void 0:i.id)?i:(null==e?void 0:e.id)===(null==r?void 0:r.id)?r:o||r},Zt=e=>{const{queryConfig:{placementBatches:t}={},deviceType:n}=d.get(),i=(null==t?void 0:t[n])||{},r=Object.values(i).flat(),o=(e=>{const t={};return e.forEach(e=>{const n=q(e.id);e.isBackfill&&(t[n]=[e])}),t})(e),s=((e,t)=>{const n={};for(const[i,r]of Object.entries(t))n[i]=e.filter(e=>r.includes(q(e.id)));return n})(e,i),a=Object.keys(o),l=((e,t)=>e.filter(e=>!t.has(q(e.id))))(e,new Set([...a,...r]));return Object.assign(Object.assign(Object.assign({},s),o),{[Gt]:l})},en=(e,t,n)=>{const i=document.getElementById(`div_utif_${e}`);if(!i)return;const{apntag:r}=window,[o,s]=t;if(!i.dataset.lockedsize&&s&&o)i.style.width=`${o}px`,i.style.height=`${s}px`,n&&(r.resizeAd(i.id,[o,s]),i.dataset.lockedsize="true",i.dataset.lockedwidth=o.toString(),i.dataset.lockedheight=s.toString());else if(null==i?void 0:i.dataset.lockedsize){const{lockedwidth:e,lockedheight:t}=i.dataset;e&&t&&r.resizeAd(i.id,[e,t])}},tn=["netboard","board"];class nn{constructor(e,t){this.identityFacade=e,this.tracker=t}buildUrl(e,t){var n,i;const{editionName:r}=e,o=(()=>{const e=window.location.href;return new URL(e).searchParams.get("dre_override_inv_code")||""})(),s=JSON.stringify(null!==(i=null===(n=window.advertory)||void 0===n?void 0:n.renderedDrEditionAds)&&void 0!==i?i:[]),a=new URL("https://dr-edition-teaser-server.inventory.schibsted.io/editions"),{envId:d,spid:l}=t;return a.searchParams.append("editionName",r),o&&a.searchParams.append("urlData",o),s&&a.searchParams.append("excludedItems",s),l&&a.searchParams.append("spid",l),d&&a.searchParams.append("envid",d),a.toString()}fetchData(e){return c(this,void 0,void 0,function*(){var t,n;const i=yield this.identityFacade.getIdentityUser(),r=null!==(n=yield null===(t=this.tracker)||void 0===t?void 0:t.getEnvironmentId())&&void 0!==n?n:"",o=(null==i?void 0:i.userId)?String(i.userId):"",s=this.buildUrl(e,{envId:r,spid:o});try{j("Starting fetching DrEdition ad from URL:",s);const e={method:"GET"},t=yield Xe.get(s,e);return j("Fetch operation completed successfully."),t}catch(e){j("Error during fetch operation:",e)}return null})}}let rn=class{getDrEditionUTMParams(e,t){var n;const{title:i="",clientName:r,creativeId:o}=null!==(n=null==e?void 0:e.pulseData)&&void 0!==n?n:{},{editionName:s}=t,a=i.replace(/<[^>]*>/g,"");return Object.assign({utm_source:"vgfront",utm_content:s,utm_campaign:r,utm_medium:a},o&&{utm_id:`df-${o}`})}getUrlSearchParams(e,t,n){if(!e)return"";const i=this.getDrEditionUTMParams(t,n),r=new URLSearchParams(decodeURIComponent(e.search)),o=new URLSearchParams(e.search);return Object.entries(i).forEach(([e,t])=>{r.has(e)||o.set(e,null!=t?t:"")}),o.toString().replace(/\+/g,"%20")}getUrlWithParams(e,t){var n;const i=null===(n=null==e?void 0:e.pulseData)||void 0===n?void 0:n.url;if(!i)return"";const r=this.getDrEditionUTMParams(e,t),o=new URL(i);return Object.entries(r).forEach(([e,t])=>{o.searchParams.has(e)||o.searchParams.set(e,null!=t?t:"")}),o.toString()}handleVideo(e,t){return c(this,void 0,void 0,function*(){const{id:n,autoplay:i,mute:r,videoLoop:o,vendor:s}=t.videoConfiguration;e.classList.add("vgtv-video-container"),Object.assign(e.dataset,{vgtvVideoId:n,vgtvVendor:s,vgtvAutoplay:i,vgtvMuted:r,vgtvLoop:!!o,vgtvNa:!0,vgtvRecommended:!1,vgtvPulseProvider:"vg",vgtvPulseProductTag:"partnerstudio"})})}getPulseObjectId(){return"sdrn:vg:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(){return"sdrn:vg:frontpage:front"}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];const{host:i,pathname:r}=new URL(n);if(!i.includes("www.vg.no")&&!r.includes("annonsorinnhold"))return[n];const o=r.split("/");return o.length?[...o.filter(Boolean).slice(1).map(e=>e),n]:[n]}};const on=e=>{const t=e.parentElement;t?t.classList.remove("dr-edition-lock-height"):j("Dr. Edition container does not have a parent element, cannot remove height lock.")};class sn{constructor(e,t,n,i){this.drEditionService=e,this.rendererManager=t,this.videoManager=n,this.pulseManager=i,this.drEditionAds=[]}fetchAndRenderAd(e,t){return c(this,void 0,void 0,function*(){var n,i;const{drEditionConfig:{containerSelector:r},renderAsBackfill:o=!1}=t,s=e.querySelector(r);if(!s)return void j(`Container with selector "${r}" not found.`);const a=yield this.drEditionService.fetchData(t);return(null==a?void 0:a.itemId)||o?!(null==a?void 0:a.itemId)&&o?(j("No Dr. Edition ads available to render. Collapsing whole placement."),T(e.id),void on(s)):((null==a?void 0:a.itemId)&&o&&(j("Dr. Edition ad available to render as a Xandr backfill."),I(e.id)),void(a?(a.css&&((e,t)=>{const n=document.createElement("link");n.rel="preload",n.href=e,n.as=t,document.head.appendChild(n)})(a.css,"style"),yield this.rendererManager.render(s,a,t),yield null===(n=this.videoManager)||void 0===n?void 0:n.handle(a,t),on(s),this.drEditionAds.push(a),window.advertory=window.advertory||{},window.advertory.renderedDrEditionAds=window.advertory.renderedDrEditionAds||[],window.advertory.renderedDrEditionAds.push(a.itemId),this.observeAdView(e,a,t),null===(i=e.querySelector("a"))||void 0===i||i.addEventListener("pointerup",()=>null)):on(s))):(j("No Dr. Edition ads available to render. Hiding Dr. Edition and rendering Xandr backfill."),this.hideDrEdition(s),this.showBackfill(e),void on(s))})}observeAdView(e,t,n){this.observeCarousel(e,t,n)||((e,t,n={threshold:.5})=>{new IntersectionObserver(([e],n)=>{e.isIntersecting&&(t(),n.disconnect())},n).observe(e)})(e,()=>this.pulseManager.trackContentView(e,t,n),{threshold:.5})}showBackfill(e){var t;const n=e.querySelector(".fallback");if(!n)return;n.style.display="block";const i=null!==(t=n.dataset.fallbackTargetId)&&void 0!==t?t:"";I(i)}hideDrEdition(e){e.style.display="none"}observeCarousel(e,t,n){const i=e.querySelector(".dr-edition-slider");if(!i)return!1;let r=null;const o=new IntersectionObserver(e=>{e.forEach(e=>{e.isIntersecting&&e.intersectionRatio>=.9&&(r&&clearTimeout(r),r=setTimeout(()=>{e.target.onclick=()=>this.pulseManager.trackContentClick(e.target,t,n),this.pulseManager.trackContentView(e.target,t,n)},500)),[...i.children].forEach(e=>{o.observe(e)})})},{threshold:[.9]});return[...i.children].forEach(e=>{o.observe(e)}),!0}}class an{constructor(e,t){this.newsroomStrategy=e,this.pulseManager=t}render(e,t,n){return c(this,void 0,void 0,function*(){if(!(null==t?void 0:t.itemId))return;const{getConsentAsync:i}=Oe(n.tcf,n.isMobileApp,n.country),r=yield i(),o=L(n.device)?t.mobileHTML:t.desktopHTML,s=r?o:o.replace(/<img [^>]*class="tracking-pixel"[^>]*>/g,"");e.innerHTML=s,e.querySelectorAll("a").forEach(e=>{var i,r,o;e.search=null!==(o=null===(r=(i=this.newsroomStrategy).getUrlSearchParams)||void 0===r?void 0:r.call(i,e,t,n))&&void 0!==o?o:"",e.onclick=()=>this.pulseManager.trackContentClick(e,t,n)})})}}class dn{constructor(e){this.strategy=e}handle(e,t){return c(this,void 0,void 0,function*(){const{videoConfiguration:{id:n,preview:i}={}}=e;(n||i)&&(yield this.importScript(t),yield this.createVideoElement(e,t))})}importScript(e){return c(this,void 0,void 0,function*(){const t=e.drEditionConfig.videoScriptUrl,n=document.querySelector(`script[src="${t}"]`);if(t&&!window.autoplayQueue&&!n)try{yield wt(t)}catch(e){j("Error! Failed to prepare SVP player script for Dr. Edition!",e)}})}createVideoElement(e,t){return c(this,void 0,void 0,function*(){const n=document.createElement("div"),{node:i}=e.videoConfiguration,r=[...document.querySelectorAll(`#${i}`)||[]].find(e=>0===e.children.length);if(this.handlePreviewVideo(e,t))return;this.strategy.handleVideo(n,e),null==r||r.appendChild(n),window.autoplayQueue=window.autoplayQueue||[],window.autoplayQueue.push(e=>{e.parse()});const o=null==r?void 0:r.parentNode;if(!o)return;const s=o.closest("a");o.addEventListener("click",e=>{const t=e.target.closest("a");s!==t&&t||(e.stopPropagation(),e.preventDefault())})})}handlePreviewVideo(e,t){var n,i,r;const{preview:{url:o,thumbnail:s}}=null!==(n=e.videoConfiguration)&&void 0!==n?n:{};if(!o)return!1;const a=document.querySelector(".dr-edition-preview .preview-video");return!!a&&(a.setAttribute("src",o),a.setAttribute("playsinline",""),!(!a||!s)&&(null===(r=(i=t.drEditionConfig).addPreviewVideo)||void 0===r||r.call(i,a),!0))}}let ln=class{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t,n,i){return{}}mapPageType(e){return{front:"Frontpage",article:"Article",section:"Article",collection:"Article",other:"Article"}[e||"front"]||"Frontpage"}getArticleId(){return location.pathname.split("/").slice(-2,-1).pop()||""}getTeaserElementText(e,t){if(!e)return"";const n=e.querySelector({title:".dr-edition-title",subtitle:".dr-edition-subtitle",image:"img.teaser-main-image"}[t]);if(!n)return"";if("image"===t)return n.src||"";const i=null==n?void 0:n.textContent;return i?i.trim():""}getEventTarget(e,t){const{itemId:n,pulseData:{url:i}={}}=t,r=this.getTeaserElementText(e,"title");return{id:n,name:this.normalizePlacementTitle(null!=r?r:""),type:"Page",url:i}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(e,t,n){return c(this,void 0,void 0,function*(){var i,r,o,s,a,d,l,c;if(!this.pulse)return;const u=this.getEventInput(e,t,n,"view");(null===(i=this.pulse)||void 0===i?void 0:i.trackLegacyViewUIElement)?null===(o=null===(r=this.pulse)||void 0===r?void 0:r.trackLegacyViewUIElement)||void 0===o||o.call(r,u):(null===(s=this.pulse)||void 0===s?void 0:s.trackViewUIElement)?null===(d=null===(a=this.pulse)||void 0===a?void 0:a.trackViewUIElement)||void 0===d||d.call(a,u):null===(c=null===(l=this.pulse)||void 0===l?void 0:l.trackElementView)||void 0===c||c.call(l,u)})}trackContentClick(e,t,n){return c(this,void 0,void 0,function*(){var i,r,o,s,a,d;if(!this.pulse)return;const l=this.getEventInput(e,t,n,"click");this.pulse.trackLegacyClickUIElement?null===(r=(i=this.pulse).trackLegacyClickUIElement)||void 0===r||r.call(i,l):this.pulse.trackClickUIElement?null===(s=(o=this.pulse).trackClickUIElement)||void 0===s||s.call(o,l):null===(d=(a=this.pulse).trackElementClick)||void 0===d||d.call(a,l)})}};class cn extends ln{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){const{pulseData:{title:i,clientName:r="",creativeId:o}={}}=t,{columnName:s,primaryPosition:a}=n;return{"@type":"UIElement",elementType:"Teaser",layout:{elementSize:"large",imageUrl:"",name:"large"},name:i,placement:{columnName:s,primaryPosition:a},"spt:custom":{is_sponsored:!0,sponsor:r,"spt:creativeId":o},url:location.origin}}getEventInput(e,t,n){return{object:this.getEventBaseData(e,t,n),target:this.getEventTarget(e,t)}}}let un=class extends ln{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e,t,n){var i,r,o,s,a,d;const{itemId:l,pulseData:{clientName:c,creativeId:u}={}}=t,v=n.editionName,p=this.mapPageType(this.pageType),g=null===(i=this.newsroomStrategy)||void 0===i?void 0:i.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getPulseObjectId)||void 0===o?void 0:o.call(r))&&void 0!==s?s:v,"@type":"UIElement",position:v,elementType:"Article",custom:{customer:c,creativeId:null!=u?u:l},page:{"@id":null!=g?g:v,"@type":p,url:location.origin},tags:null===(d=null===(a=this.newsroomStrategy)||void 0===a?void 0:a.getTags)||void 0===d?void 0:d.call(a,e)}}getEventInput(e,t,n,i){return{object:this.getEventBaseData(e,t,n),partnerstudio:this.getEventPartnerstudioData(e,t,n,i),target:this.getEventTarget(e,t),provider:this.getProviderData()}}getEventPartnerstudioData(e,t,n,i){var r,o,s,a;const{pulseData:{algorithm:d="sov",clientName:l,creativeId:c,editionId:u,itemId:v,url:p,probability:g}={}}=t,h=Math.floor(Date.now()/1e3),m=this.getTeaserElementText(e,"title"),y=this.getTeaserElementText(e,"subtitle"),f=this.getTeaserElementText(e,"image"),w=null!==(a=null!==(s=null===(o=null===(r=this.newsroomStrategy)||void 0===r?void 0:r.getUrlWithParams)||void 0===o?void 0:o.call(r,t,n))&&void 0!==s?s:p)&&void 0!==a?a:"";return{algorithm:d,clientName:l,probability:g,creativeId:c,device:n.device,editionId:u,itemId:v,link:w,placement:n.editionName,subtitle:y,time:h,title:m,type:i,imageUrl:f,frontId:86,tracking_type:"ad",xandrAdLoaded:!1}}getProviderData(){return{productTag:"partnerstudio"}}};const vn=(e,t)=>{null==t||t.forEach(t=>{const n=window.SVP.Player.Plugins.get(t);e.addPlugin(new n)})},pn=e=>c(void 0,void 0,void 0,function*(){var t,n;return(null===(t=null===window||void 0===window?void 0:window.SVP)||void 0===t?void 0:t.Player)?new window.SVP.Player(e):((()=>{const e="svp-player-sdk",t=document.querySelector(e),n=Array.from(document.querySelectorAll('script[src^="https://cdn.stream.schibsted.media/player"]'));if(t||n.length>0)return;const i=document.createElement("script");i.id=e,i.src="https://cdn.stream.schibsted.media/player/3.78.1/player.min.js",i.async=!0;try{i.src=i.src.replace("player.min","player.next.min")}catch(e){console.error("Failed to set player.next.min source:",e)}document.head.insertBefore(i,document.head.firstChild)})(),(null===(n=window.SVP)||void 0===n?void 0:n.isLoaded)?new window.SVP.Player(e):yield new Promise(t=>{window.addEventListener("onSvpPlayerReady",()=>t(new window.SVP.Player(e)))}))}),gn={ContentMutePlugin:e=>{window.SVP.Player.Plugins.register({getName:()=>"ContentMutePlugin",initialize(){},setup(){const t=this.player.config.get("mute");this.container=e||this.player.getContainer(),this.muted=t,t&&this.listenToOnce(this.player,"ready",this.renderButtonElement,this)},getButtonElement(){const e=document.createElement("button");e.className="player-plugin-content-mute";const t=document.createElement("span");return t.className="volume-button-icon",e.appendChild(t),e},renderButtonElement(){this.buttonElement=this.getButtonElement(),this.buttonElement.addEventListener("click",this.onButtonClick.bind(this)),this.container.appendChild(this.buttonElement),this.isVideo()||(this.buttonElement.style.display="none"),this.getJWPlayer()&&this.getJWPlayer().on("mute",this.onMuteChange,this)},onButtonClick(){this.getJWPlayer()&&(this.container.classList.add("has-interacted"),this.muted=!this.muted,this.getJWPlayer().setMute(this.muted))},onMuteChange(e){this.muted=e.mute,this.muted?this.buttonElement.classList.remove("content-video-volume-on"):this.buttonElement.classList.add("content-video-volume-on")},isVideo(){return"video"===this.player.getRawAsset().assetType},getJWPlayer(){return this.player.model.player}})},IntegrationMenu:()=>{window.SVP.Player.Plugins.register({getName:()=>"IntegrationMenu",setup(){return c(this,void 0,void 0,function*(){yield Promise.resolve().then(function(){return wo})})}})}},hn=(e,t)=>{null==e||e.forEach(e=>{gn[e](t)})};class mn{handleVideo(e,t){return c(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:r,vendor:o}}){yield c(void 0,void 0,void 0,function*(){return yield new Promise(e=>{var t;Boolean(null===(t=window.SVP)||void 0===t?void 0:t.Player)?e(!0):window.addEventListener("onSvpPlayerReady",()=>e(!0))})});const s=["ContentMutePlugin"],a=this.createPlayerOverlay(e);hn(s,a);const d={id:t,node:n,autoplay:i,mute:r,vendor:o,autopause:"viewable",maxBitrate:600,pulse:{provider:"e24"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"e24-default",url:""}},l=yield pn(d);l.once("assetReady",()=>{vn(l,s)}),l.once("ready",()=>{const t=e;new MutationObserver(e=>{e.forEach(({type:e,attributeName:n})=>{"attributes"===e&&"class"===n&&(t.classList.contains("jw-state-playing")?a.classList.add("is-playing"):a.classList.remove("is-playing"),t.classList.contains("jw-flag-user-inactive")?a.classList.add("is-inactive"):a.classList.remove("is-inactive"))})}).observe(t,{attributes:!0,attributeFilter:["class"]})}),l.once("PulseStats:ready",()=>c(this,void 0,void 0,function*(){const e=yield l.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"e24",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:e24:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===pt.FRONT?"sdrn:e24:frontpage:front":`sdrn:e24:article:${t}`}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];if(!n.includes("https://e24.no/annonsorinnhold/"))return[n];const{pathname:i}=new URL(n),r=i.split("/").filter(Boolean);return r.length?[...r.slice(1),n]:[n]}createPlayerOverlay(e){const t=document.createElement("div");t.classList.add("cm-custom-video-overlay"),e.parentElement&&(t.innerHTML=e.parentElement.innerHTML,e.parentElement.replaceChild(t,e));return t.addEventListener("click",e=>{e.stopPropagation(),e.preventDefault(),t.classList.add("has-interacted")}),t}}const yn="https://www.aftonbladet.se/video-player-extras/latest/";class fn{handleVideo(e,t){return c(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:r,vendor:o}}){const s={id:t,node:n,autoplay:i,mute:r,vendor:o,autopause:"viewable",maxBitrate:600,pulse:{provider:"aftonbladet"},recommended:{autoplay:!1,next:{countdown:10}},skin:{name:"",url:""},plugins:{[`${yn}cta-button.js`]:{name:"CtaButton",options:{type:"unmute"}},[`${yn}external-link.js`]:{name:"ExternalLink"}}};yield pn(s),this.addEditionVideoClass(e)})}addEditionVideoClass(e){var t;(null===(t=null==e?void 0:e.parentElement)||void 0===t?void 0:t.parentElement)&&e.parentElement.parentElement.classList.add("dr-edition-video-player")}getPulseObjectId(){return""}getPulsePageId(){return""}}const wn=e=>null!==e&&"object"==typeof e&&!Array.isArray(e);class bn{handleVideo(e,t){return c(this,arguments,void 0,function*(e,{videoConfiguration:{id:t,node:n,autoplay:i,mute:r,vendor:o}}){const s={id:t,node:n,autoplay:i,mute:r,vendor:o,locale:"se",autopause:"viewable",maxBitrate:600,sharing:!1,recommended:!1,pulse:{provider:"svdse",decorator:(e,t)=>Object.assign(Object.assign({},wn(e)?e:{}),{provider:Object.assign(Object.assign({},wn(null==e?void 0:e.provider)?e.provider:{}),{productTag:"partnerstudio"})})},skin:{name:"svd-player",url:""},settings:{pulse:{host:"se-aftonbladet.videoplaza.tv",contentMetadata:{category:"SvD",tags:["standard-linears","pause",`video-${t}`]},requestSettings:{}}}},a=yield pn(s);a.once("PulseStats:ready",()=>c(this,void 0,void 0,function*(){const e=yield a.getPlugin("PulseStats").getTracker();null==e||e.update({provider:{id:"svdse",productTag:"partnerstudio"}})}))})}getPulseObjectId(){return"sdrn:svdse:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(e,t){return e===pt.FRONT?"sdrn:svdse:frontpage:front":`sdrn:svdse:article:${t}`}}let En=class{handleVideo(e,t){}getPulseObjectId(){return""}getPulsePageId(e,t){return""}};const Tn=(e,t,n)=>{var i;const{publisher:r,pageType:o,country:s}=e,a={[be.VG]:new rn,[be.E24]:new mn,[be.AFTONBLADET]:new fn,[be.SVD]:new bn}[r]||new En,d=new(s===he.SE?cn:un)(n,a,o),l=new nn(t,null!==(i=null==n?void 0:n.pulseTracker)&&void 0!==i?i:n),c=new an(a,d),u=new dn(a);return new sn(l,c,u,d)},In=()=>c(void 0,void 0,void 0,function*(){return yield new Promise(e=>{if("undefined"!=typeof window)if(window.Identity)e(window.Identity);else{const t=()=>{e(window.Identity)};window.addEventListener("identity-initialized",t,{once:!0})}else e(void 0)})});class An{constructor(e){this.identity=e,this.getIdentityUser=this.getIdentityUser.bind(this),this.isUserLoggedIn=this.isUserLoggedIn.bind(this),this.onIdentityLogout=this.onIdentityLogout.bind(this)}getIdentityUser(){return c(this,void 0,void 0,function*(){var e;try{const t=yield null===(e=this.identity)||void 0===e?void 0:e.getUser();return null!=t?t:null}catch(e){return j("[Privacy Broker] User is not logged in."),null}})}isUserLoggedIn(){return c(this,void 0,void 0,function*(){var e,t;return null!==(t=yield null===(e=this.identity)||void 0===e?void 0:e.isLoggedIn())&&void 0!==t&&t})}onIdentityLogout(e){var t;null===(t=this.identity)||void 0===t||t.on("logout",e)}}const kn=(e,t,n)=>{const{wrapperSelector:i}=null==e?void 0:e.drEditionConfig,r=document.querySelectorAll(i),o=new IntersectionObserver((i,r)=>((e,t,n,i,r)=>{const o=Tn(n,i,r);e.forEach(e=>{var i,r,s;if(!e.isIntersecting)return;const a=e.target,d=null!==(i=a.dataset.editionName)&&void 0!==i?i:"",l=null!==(r=a.dataset.pulseColumnname)&&void 0!==r?r:"",c=null!==(s=a.dataset.pulsePrimaryposition)&&void 0!==s?s:"";o.fetchAndRenderAd(a,Object.assign(Object.assign({},n),{editionName:d,columnName:l,primaryPosition:c})),t.unobserve(a)})})(i,r,e,t,n),{rootMargin:"400% 0px"});r.forEach(e=>o.observe(e))},Cn=[],Sn=(e,t)=>c(void 0,void 0,void 0,function*(){var n;const{pulse:i,tcf:r,deviceType:o,drEdition:s,publisher:a,pageType:d,country:l,isMobileApp:c}=e;if(!(yield Ue(r,c,l,"handleDrEditionBackfill")))return;const u=((e,t)=>{var n;const{deviceType:i,placements:r,drEdition:{fallbackGlobalEditionName:o}={}}=e,s=r[i]||r.desktop,a=q(t.targetId),d=s.find(e=>e.id===a),l=tn.some(e=>a.startsWith(e)),c=Cn.includes(a),u=(null===(n=null==d?void 0:d.drEdition)||void 0===n?void 0:n.editionName)||o;return d&&l&&!c&&u?(Cn.push(a),Object.assign(Object.assign({},d),{drEdition:Object.assign(Object.assign({},d.drEdition),{editionName:u})})):null})(e,t);if(!u)return;if(!(null==i?void 0:i.instance))return void j("Pulse has not been passed as a prop, aborting");const v=yield In(),p=new An(v),g=Tn({publisher:a,pageType:d,country:l},p,null==i?void 0:i.instance),h=document.getElementById(t.targetId);if(!h||!s)return;h.classList.value="";const m=document.createElement("div");m.className=s.containerSelector.replace(/^[.#:[\]]+/,""),h.innerHTML=m.outerHTML;const y={editionName:(null===(n=null==u?void 0:u.drEdition)||void 0===n?void 0:n.editionName)||"",drEditionConfig:s,device:o,tcf:r,isMobileApp:c,country:l,renderAsBackfill:!0};yield g.fetchAndRenderAd(h,y)}),On="collapseAd",Pn="hideAd",$n="resizeAd",Ln="renderDrEditionFallback",xn="wallpaperImageUrl",Nn="wallpaperColor",jn="velvet",_n=[$n,xn,Nn,On,Pn,Ln,jn];let qn;const Dn=e=>{if("object"==typeof e)return e;if(t=e,E.test(t)){const t=e.replace(/^wallpaper:url:/,"");return{name:xn,wallpaperImageUrl:t}}var t;if((e=>e.startsWith("wallpaper:color:"))(e)){const t=e.replace(/^wallpaper:color:/,"");return{name:Nn,wallpaperColor:t}}if(e.startsWith(Ln)){const t=e.split(":")[1];return{name:Ln,targetId:t}}if(e.startsWith(On)||e.startsWith(Pn)){const t=e.split(":")[1];return{name:On,targetId:t}}if(e.includes("name")&&_n.some(t=>e.includes(t)))try{return JSON.parse(e)}catch(e){}},Mn=e=>{if(!["http://acdn.adnxs-simple.com","https://acdn.adnxs-simple.com","https://crcdn01.adnxs-simple.com","http://crcdn01.adnxs-simple.com","https://acdn.adnxs.com","http://acdn.adnxs.com","https://adsdk.microsoft.com","https://adsdk.bing.net","https://adsdkprod.azureedge.net"].includes(e.origin.trim()))return;const{data:t}=e;if(!t)return;const n=Dn(t);if(!n)return;if(!n.name||!_n.some(e=>n.name===e))return;const{name:i,targetId:r,wallpaperImageUrl:o,wallpaperColor:s,cmd:a,size:l}=n;i===jn&&a&&(a.includes("noScroll")&&(qn=(e=>{if(!e)return()=>{};const t=e.style.overflow;return e.style.setProperty("overflow","hidden"),()=>{e.style.setProperty("overflow",t)}})(document.querySelector("body"))),(a.includes("close")||a.includes("ended"))&&(null==qn||qn(),dispatchEvent(new CustomEvent("advertory:closeTakeover",{})))),i!==On&&i!==Pn||!r||T(r),i===$n&&r&&a&&en(r,a),i===Ln&&r&&(T(r),Sn(d.get(),{targetId:r})),"resizeMediationAd"===i&&r&&l&&en(r,l,!0),i===xn&&o&&(e=>{const t=document.querySelector(`.${y}`);t&&(t.style.backgroundImage=`url(${e})`)})(o),i===Nn&&s&&(e=>{const t=document.querySelector(`.${y}`);t&&(t.style.backgroundColor=e)})(s)},Bn=e=>({rootMargin:`${e}px 0px ${e}px 0px`}),Rn=(e,t)=>{if(re(t))return j(`loading finn blink ad with full ads chain for ${t}`),void A().withFullAdsChain(t);v(()=>(j("core showTag",{id:t}),e.showTag(t)))},Fn=(e,t)=>c(void 0,void 0,void 0,function*(){yield p,yield g;const n=new IntersectionObserver((e,t)=>((e,t,n)=>{e.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(e=>{const{target:i}=e,r=(e=>{const t=e.dataset.showTagSubscribeId;return!e.id.length&&t?t:e.id})(i),o=document.getElementById(r);j("core log from intersection observer handler",{targetId:r,element:o}),n(window.apntag,r),o&&(t.unobserve(o),t.disconnect())})})(e,t,Rn),Bn(t));n.observe(e)}),Vn=new Map,Un=["no-stavangeraftenblad","sa","no-aftenposten","aftenposten","no-bergenstidende","bt"],Hn=".brandstudio-premium-content-widget",zn=({adWrapper:e,placementContainer:t})=>t.offsetHeight+(({adWrapper:e})=>{const{paddingTop:t,paddingBottom:n}=getComputedStyle(e);return parseFloat(t)+parseFloat(n)})({adWrapper:e}),Wn=({adWrapper:e,placementContainer:t})=>{const n=zn({adWrapper:e,placementContainer:t});var i;null==e||e.style.setProperty("height",`${n}px`),Wt(i=t),i.innerHTML=""},Kn=e=>{e&&e.style.getPropertyValue("height")&&e.style.removeProperty("height")},Gn=({adWrapper:e,placementContainer:t})=>{const{publisher:n}=d.get(),i=Un.includes(n)&&Boolean(t.closest(Hn));const r=i?t.closest(Hn):null,o=new MutationObserver(t=>{t.forEach(({addedNodes:t})=>{t.forEach(t=>{const n=t instanceof HTMLElement,s=n&&t.matches("iframe, article")&&e;if(!n||!i&&!s||i&&!r)return;if(s)return Kn(e),void o.disconnect();const a=t.closest('[style*="height"]'),d=r;a&&d.contains(a)?Kn(a):d.hasAttribute("style")&&Kn(d),o.disconnect()})})});try{o.observe(t,{childList:!0,subtree:!0})}catch(e){o.disconnect()}},Jn=(e,t,n,i,r,o)=>{var s;const a=performance.now(),d=null!==(s=Vn.get(t))&&void 0!==s?s:0,l=((e,t)=>!!t&&e+t<(new Date).getTime())(i,r)&&n<0;a-d>=r&&l&&(Vn.set(t,a),((e,t,n)=>{const i=null==n?void 0:n.parentElement;i&&n&&Wn({adWrapper:i,placementContainer:n}),v(()=>{e.setKeywords([t],{[`${me()}-adreload`]:"1"},{overrideKeyValue:!0}),e.refresh([t])})})(e,t,o))},Yn=(e,t,n,i)=>{const r=new IntersectionObserver((e,t)=>((e,t,n,i)=>{e.filter(({isIntersecting:e})=>e).forEach(e=>{const{target:r,boundingClientRect:o}=e;t(window.apntag,r.id,o.y,n,i,r)})})(e,Jn,n,i),Bn(t));r.observe(e)},Qn=(e,t=6)=>{const n=[];for(let i=0;i<e.length;i+=t){const r=e.slice(i,i+t);n.push(r)}return n},Xn=()=>navigator&&navigator.userAgent.match(/chrome/i)?null:navigator&&navigator.userAgent.match(/apple/i),Zn=(e,t=0)=>{const n=e.getBoundingClientRect(),i=window.innerHeight;return n.bottom>-t&&n.top<i+t},ei=(e,t)=>{if(!(null==t?void 0:t.scrollRefreshEnabled))return;const{targetId:n}=e,i=document.querySelector(`#${n}`),r=null==i?void 0:i.parentElement;if(!r||!i)return;Gn({adWrapper:r,placementContainer:i});const{delayTime:o=1e3}=t,s=(new Date).getTime();if(i&&"true"!==i.dataset.subscribedForRefresh){const e=(e=>{var t;const{deviceType:n,preloadMarginsConfig:i}=d.get(),r=null==i?void 0:i[n];return((e,t)=>t[e])(null!==(t=e.dataset.priority)&&void 0!==t?t:"normal",(({high:e,normal:t,low:n}={})=>{var i,r,o,s,a,d;return{high:{refreshMargin:null!==(i=null==e?void 0:e.refreshMargin)&&void 0!==i?i:600,renderMargin:null!==(r=null==e?void 0:e.renderMargin)&&void 0!==r?r:300},normal:{refreshMargin:null!==(o=null==t?void 0:t.refreshMargin)&&void 0!==o?o:300,renderMargin:null!==(s=null==t?void 0:t.renderMargin)&&void 0!==s?s:150},low:{refreshMargin:null!==(a=null==n?void 0:n.refreshMargin)&&void 0!==a?a:100,renderMargin:null!==(d=null==n?void 0:n.renderMargin)&&void 0!==d?d:50}}})(r)).refreshMargin})(i);i.dataset.subscribedForRefresh="true",i.dataset.refresh&&Yn(i,e,s,o)}},ti=e=>{const{refreshConfig:{visibilityStateRefreshEnabled:t=!1}={}}=d.get();if(!t)return;const n=()=>{"visible"===document.visibilityState&&document.removeEventListener("visibilitychange",n),si(e)};"visible"!==document.visibilityState&&document.addEventListener("visibilitychange",n)},ni=(e,t,n)=>{const i=document.querySelectorAll('[data-bf-cache-refresh="true"]');for(const r of i){const i=e.find(e=>{var t;return e.id===(null===(t=r.firstElementChild)||void 0===t?void 0:t.id)&&e.bfCacheRefresh}),o=null==i?void 0:i.threshold;Zn(r,o)&&i&&(zt(i.id),n.length&&r.classList.remove(...n),si([i],t))}},ii=e=>{const{refreshConfig:{backForwardNavigationRefreshEnabled:t=!1}={},siteSpecificConfig:{classesToRemoveOnRefresh:n=[]}={},isMobileApp:i}=d.get();t&&(e.forEach(({id:e})=>{const t=ri(e);t&&(t.dataset.bfCacheRefresh="true")}),i?((e,t)=>{document.addEventListener("visibilitychange",()=>{ni(e,!0,t)})})(e,n):((e,t)=>{window.addEventListener("pageshow",n=>{const i=()=>{window.scrollY>0&&(window.removeEventListener("scroll",i),ni(e,!1,t))};n.persisted&&(Xn()?window.addEventListener("scroll",i,{passive:!0}):ni(e,!1,t))})})(e,n))},ri=e=>{var t,n;return null!==(n=null===(t=document.querySelector(`#${e}`))||void 0===t?void 0:t.parentElement)&&void 0!==n?n:null},oi=e=>{const{id:t,allowedFormats:n}=e,i=(e=>{if(!e)return[];try{return JSON.parse(e.dataset.adSizes||"[]")}catch(e){return[]}})(ri(t)),r=(e=>1===e[0]&&1===e[1])(i),o={sizes:[i],allowedFormats:r?n:n.filter(e=>"native"!==e),allowSmallerSizes:!1};return r||(o.native=void 0),o},si=(e,t=!1)=>{const{requestSize:n=s}=d.get(),i=e.map(({id:e})=>e),r=Qn(i,n);if(t)for(const t of e){const e=oi(t);window.apntag.modifyTag(t.id,e)}for(const e of r)v(()=>window.apntag.refresh(e))};const ai="#fff",di="#0098da",li="splash",ci="welcomePage",ui="topscroller",vi="velvet",pi="takeover-displayed",gi="takeover-visit-count",hi=14400,mi=()=>{const e=Pe(gi);return e?parseInt(e):0},yi=()=>{const{takeover:{enabled:e=!1,secondVisitEnabled:t=!1}={}}=d.get();return!window.location.href.includes("takeover=0")&&(!!window.location.href.includes("takeover=1")||!(!e||(()=>{var e;const t=(null===(e=d.get().takeover)||void 0===e?void 0:e.cookieCapName)||pi;return"true"===Pe(t)})())&&(!t||fi()))},fi=()=>{const e=mi();return 0===e?((()=>{const e=mi(),{takeover:{cookieCapTime:t=hi}={}}=d.get(),n=document.location.hostname;window.document.cookie=`${gi}=${e+1}; max-age=${t}; domain=${n}; path=/`})(),!1):1===e},wi=(e,t)=>[[1,1],[1920,1080]].some(([n,i])=>n===e&&i===t),bi=()=>{const{takeover:e}=d.get();return Boolean(null==e?void 0:e.topscroller)},Ei=()=>c(void 0,void 0,void 0,function*(){const e=document.location.hostname,{takeover:{cookieCapName:t=pi,cookieCapTime:n=hi}={},isMobileApp:i,tcf:r,country:o}=d.get(),s=yield Ue(r,i,o,"ad-takeover-cookiecap");n&&s&&(window.document.cookie=`${t}=true; max-age=${n}; domain=${e}; path=/`)}),Ti=e=>{var t;const n=!!(null===(t=d.get().takeover)||void 0===t?void 0:t.setCookieCapForNotShownAd);return X(e)&&n},Ii=(e,t)=>{var n;if(t===ui){const{topscroller:t}=e;return null!=t?t:{}}if(t===li){const{splash:t}=e;return null!=t?t:{}}return null!==(n=e.welcomePage)&&void 0!==n?n:{}},Ai=(e,t)=>{t!==li?(e=>{var t,n,i;const r=null===(n=null===(t=d.get().takeover)||void 0===t?void 0:t.welcomePage)||void 0===n?void 0:n.headerElementSelector,o=null===(i=d.get().takeover)||void 0===i?void 0:i.topscroller;if(!r||o)return;const s=document.querySelector(r),a=document.querySelector(".welcome-page-wrapper"),l=document.querySelector(`#${e.targetId}`),c=document.querySelector(".advertory-welcome-page-scroll");if(!(s&&a&&c&&l))return;const u=null==s?void 0:s.offsetHeight,v=Z(e)?"60svh":`calc(100svh - ${u}px)`,p=Z(e)?"calc(40svh + 30px)":`calc(${u}px + 30px)`;a.style.setProperty("height",v,"important"),l.style.setProperty("height",v,"important"),c.style.setProperty("bottom",p,"important")})(e):(e=>{var t;if(!(null===(t=d.get().takeover)||void 0===t?void 0:t.splash))return;const n=document.querySelector(".advertory-splash-navbar-wrapper"),i=document.querySelector(`#${e.targetId}`);if(!n||!i)return;const r=`calc(100svh - ${n.offsetHeight}px)`;i.style.setProperty("height",r,"important")})(e)},ki=Tt([],()=>{new MutationObserver((e,t)=>{document.querySelector("iframe")&&((()=>{const e=document.querySelector("iframe");e&&(e.onload=()=>{if(!e.contentDocument)return;document.body.style.height="100%",document.documentElement.style.height="100%",e.height="100%",e.width="100%";const t=e.contentDocument.createElement("style");t.textContent="\n .adform-adbox {\n height: 100% !important;\n width: 100% !important;\n }\n img {\n height: 100% !important;\n width: 100% !important;\n object-fit: cover !important;\n object-position: top !important;\n }\n ",e.contentDocument.head.appendChild(t)})})(),t.disconnect())}).observe(document.body,{childList:!0,subtree:!0})}),Ci=(e,t=!0)=>{(e===ci||e===ui)&&(e=>{e?setTimeout(()=>window.scrollTo(0,0),100):window.scrollTo(0,10)})(t)},Si=()=>{const e=parseInt(document.body.dataset.scrollY||"0",10);document.body.style.top="",window.scrollTo(0,e),document.body.classList.remove("page-locked")},Oi=e=>{document.body.style.overflow=e?"initial":"hidden"},Pi=e=>{const t=Li(e),n=$i(e);(e=>{e.classList.toggle("takeover-ad-hidden",!0)})(e),Oi(!0),e.style.display="none",window.removeEventListener("keydown",t),window.removeEventListener("advertory:closeTakeover",n)},$i=e=>{const t=()=>Pi(e);return window.addEventListener("advertory:closeTakeover",t),Si(),t},Li=e=>{const t=t=>{["Enter","Escape"].includes(t.key)&&Pi(e)};return Si(),window.addEventListener("keydown",t),t},xi=e=>{const t=e.querySelector(".advertory-splash-navbar-wrapper");t&&(Li(e),$i(e),Si(),t.addEventListener("click",()=>{Pi(e)}),Oi(!1))},Ni=e=>{(e=>{window.addEventListener("scroll",()=>{e.getBoundingClientRect().bottom,(e=>{const t=e.getBoundingClientRect().bottom;e.style.opacity=""+t/e.offsetHeight})(e)},{passive:!0})})(e),$i(e);const t=document.querySelector("header");document.querySelectorAll(".smooth-close-takeover").forEach(e=>e.addEventListener("click",()=>null==t?void 0:t.scrollIntoView({behavior:"smooth"})))},ji=e=>{(e=>{window.addEventListener("advertory:closeTakeover",()=>Pi(e))})(e)},_i=e=>{const{takeover:{splash:{showAnnonsLabel:t=!1}={}}={}}=d.get(),n=e.querySelectorAll(".advertory-splash-navbar-wrapper"),i=document.querySelector(".advertory-takeover-label");Array.from(n).forEach(e=>e.style.display="flex"),t&&i&&(i.style.display="flex",i.innerText=jt.se.adText),e.classList.toggle("advertory-splash-wrapper",!0)},qi=e=>{const t=document.querySelectorAll(".advertory-topscroller-elements");Array.from(t).forEach(e=>e.style.display="flex");const n=document.querySelector(".advertory-takeover-label");n&&(n.style.display="flex",n.innerText=jt.no.adText,n.classList.add("takeover-topscroller-label"),e.classList.toggle("topscroller-wrapper",!0))},Di=e=>{const t=document.querySelectorAll(".advertory-welcome-page-elements");Array.from(t).forEach(e=>{e.style.display="flex",e.style.animation="elementsAnimation 1.5s ease-out forwards"});const n=document.querySelector(".advertory-takeover-label");n&&(n.style.display="flex",n.innerText=jt.se.adText,e.classList.toggle("welcome-page-wrapper",!0))},Mi=e=>{e.classList.toggle("advertory-impact-wrapper",!0)},Bi=()=>{const e=document.querySelector(".welcome-page-wrapper, .topscroller-wrapper, .advertory-splash-wrapper");if(!e)return;let t=0;new IntersectionObserver(e=>{e.forEach(e=>{var n;if(e.isIntersecting){window.dispatchEvent(new CustomEvent("advertory:takeoverInView"));(null!==(n=Array.from(e.target.classList))&&void 0!==n?n:[]).includes("advertory-splash-wrapper")&&(()=>{const e=window.scrollY||0;document.body.dataset.scrollY=e.toString(),document.body.style.top="0",document.body.classList.add("page-locked"),document.documentElement.scrollTop=0})(),t++}else t>0&&window.dispatchEvent(new CustomEvent("advertory:takeoverNotInView"))})},{root:null,rootMargin:"0px",threshold:0}).observe(e)},Ri=(e,t)=>{let n=e;return e.includes("529299503")&&(n=(e=>{const t=document.createElement("script");return t.textContent=`(${ki})()`,e+t.outerHTML})(e)),n},Fi=e=>{const t=(e=>{const{requests:t}=window.apntag,n=Et(e)?1:0;return null==t?void 0:t.tags[e].adResponse.ads[n].rtb.banner.content})(e);if(!t)return;((e,t)=>{const{requests:n}=window.apntag,i=Et(e)?1:0;n&&(n.tags[e].adResponse.ads[i].rtb.banner.content=t)})(e,Ri(t))},Vi=e=>c(void 0,void 0,void 0,function*(){const{takeover:t}=d.get(),{targetId:n}=e,i=document.querySelector(`#${n}`),r=document.querySelector(".advertory-takeover-wrapper");if(!i||!r||!t)return;const o=(e=>{const{width:t,height:n}=e;return wi(t,n)?li:ce(e,H)?vi:bi()?ui:ci})(e),s=r.offsetHeight,a=window.scrollY>s;r.style.display="block",!a&&Ci(o,!1),((e,t)=>{({[ci]:Di,[li]:_i,[ui]:qi,[vi]:Mi})[t](e)})(r,o),Bi(),((e,t)=>{({[ci]:Ni,[ui]:Ni,[li]:xi,[vi]:ji})[t](e)})(r,o),((e,t,n)=>{if(!n)return;({[ci]:()=>{const{buttonLabel:i}=Ii(n,t);["#advertory-welcome-page-scroll-label","#advertory-welcome-page-scroll-image"].forEach(t=>{const n=e.querySelector(`${t}`);n&&(n.innerText=null!=i?i:"")})},[li]:()=>{const{themeColors:i,logotype:r,buttonLabel:o,showArrowIcon:s}=Ii(n,t);["#advertory-splash-close-label",".advertory-splash-close","#advertory-splash-logotype",".advertory-splash-navbar-wrapper"].forEach(t=>{const n=e.querySelector(`${t}`);if(n){if("#advertory-splash-close-label"===t&&(n.innerText=null!=o?o:""),".advertory-splash-close"===t&&s){const e=document.createElement("img");e.setAttribute("src","data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAfQAAAH0Bx0gPAAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABzSURBVDiNtdPJCYBADEDRzzRmE3ZgEV6tRHHpzELiIQrBZRajA7lk4EE2RIQjgApYgdbmY8EJaADZo3sDBKAvQa4JRYZc5D6pyJiDPMuKTCkkXp8icwxJd1mRxSC1/Q94328luJroGqNrkdyrzAfHVHzOG+8CKlLk+LO+AAAAAElFTkSuQmCC"),e.setAttribute("alt","close ad"),n.appendChild(e)}if("#advertory-splash-logotype"===t&&r&&(n.setAttribute("src",r.url),n.setAttribute("alt",r.alt)),".advertory-splash-navbar-wrapper"===t&&i){const{backgroundColor:e,color:t}=i;n.style.setProperty("background-color",null!=e?e:ai,"important"),n.style.color=null!=t?t:di}}})},[ui]:()=>{const{buttonLabel:i,showArrowIcon:r,showCloseButton:o=!0}=Ii(n,t);["#advertory-topscroller-scroll-label","#advertory-topscroller-scroll-image",".advertory-topscroller-close"].forEach(t=>{const n=e.querySelector(`${t}`);n&&(".advertory-topscroller-close"!==t||o||(n.style.display="none"),"#advertory-topscroller-scroll-image"!==t||r||(n.style.display="none"),"#advertory-topscroller-scroll-label"===t&&(n.innerText=null!=i?i:""))})},[vi]:()=>{}})[t]()})(r,o,t),yield Ei(),!a&&Ci(o,!0),Ai(e,o)}),Ui="advertory-brandmetrics-survey",Hi=()=>c(void 0,void 0,void 0,function*(){const{norstat:{enabled:e}={},country:t,isMobileApp:n,tcf:i}=d.get(),r=yield Ue(i,n,t,"norstat");if(!e||n||!r)return;const o=(e=>{const{ppid1:t,ppid2:n}=dt.getPPIDs(),{ppid1:i,ppid2:r}=lt.getPPIDs(),o=(new at).add(n,et[e]).add(t,tt[e]).add(r,nt[e]).add(i,it[e]);return`${o.buildNorstatPath()}?${o.buildNorstatQuery("alias").toString()}`})(t);((e,t,...n)=>{c(void 0,[e,t,...n],void 0,function*(e,t,n=!0){if(document.getElementById(t))return;const i=document.createElement("img");i.src=e,i.id=null!=t?t:"",n&&(i.style.display="none"),document.body.appendChild(i)})})(`https://sch-map.norstatsurveys.com/api/nids/${t===he.NO?"schibsted":"schibstedse"}/map/${o}`,"norstat")}),zi={nativeAd:e=>Y(e)&&!ne(e),buyrecipe:e=>e.targetId.startsWith("buyrecipe"),fullwidthAd:Q,fullscreenScroll:J,topscroller:e=>X(e)&&bi(),splash:e=>X(e)&&wi(e.width,e.height),welcomePage:X,wallpaper:ee,skyscraper:e=>e.targetId.includes("skyscraper")&&!!e.banner,lFormat:de,hFormat:le,toppanorama:e=>e.targetId.startsWith("toppanorama")&&!le(e)&&!de(e),topboard:e=>e.targetId.startsWith("topboard")&&!X(e),widescreen:ae,insider:e=>e.targetId.startsWith("insider"),sponsorstripe:ne,brandboard:e=>ie(e)&&!(e=>e.targetId.includes("backfill"))(e)&&!se(e),outstream:e=>"https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js"===e.renderer_url,netboard:e=>(e=>e.targetId.startsWith("netboard"))(e)||(e=>e.targetId.startsWith("board"))(e),panorama:oe,midboard:se},Wi=({adObj:e,preferredTestIdData:t})=>{var n,i;const r=null!==(n=null==t?void 0:t.targetId)&&void 0!==n?n:null==e?void 0:e.targetId;if(!r)return;const o=null===(i=document.querySelector(`#${r}`))||void 0===i?void 0:i.parentElement;if(!o)return;if(((e,t)=>{var n,i,r,o;const s=null===(o=null===(r=null===(i=null===(n=window.apntag)||void 0===n?void 0:n.requests)||void 0===i?void 0:i.tags)||void 0===r?void 0:r[e])||void 0===o?void 0:o.invCode;s&&(t.dataset.invCode=s)})(r,o),null==t?void 0:t.testId)return void(o.dataset.testid=t.testId);const s="DIV"===(null==o?void 0:o.tagName);e&&s&&((e,t)=>{var n,i;for(const[r,o]of Object.entries(zi))if(o(e)){if("nativeAd"===r){const o="default";t.dataset.testid=`${r}-${null!==(i=null===(n=null==e?void 0:e.native)||void 0===n?void 0:n.desc2)&&void 0!==i?i:o}`;break}t.dataset.testid=r;break}})(e,o)},Ki=e=>{var t;return(null===(t=Object.entries(zi).find(([,t])=>t(e)))||void 0===t?void 0:t[0])||""},Gi=(e,t)=>{const n=e.width,i=(null!=t?t:window.screen.width)/n;return i<1?i:1},Ji=new Map;Ji.set("insider",{scale:.82,transformOrigin:"left center",cogwheelAdjust:!0}),Ji.set("panorama",{scale:.79,transformOrigin:"center center"}),Ji.set("outstream",{scale:.79,transformOrigin:"center center"}),Ji.set("integration",{scale:.79,transformOrigin:"center center"}),Ji.set("toppanorama",{scale:.8,transformOrigin:"left center"});const Yi=e=>{if(!((null===(t=null===document||void 0===document?void 0:document.body)||void 0===t?void 0:t.clientWidth)>767&&(null===(n=null===document||void 0===document?void 0:document.body)||void 0===n?void 0:n.clientWidth)<=853))return;var t,n;const i=Ki(e),r=Ji.get(i),o=document.querySelector(`#${e.targetId}`);if(!o||!r)return;if(o.style.transformOrigin=r.transformOrigin,o.style.transform=`scale(${r.scale})`,!(null==r?void 0:r.cogwheelAdjust))return;const s=document.querySelector(`div[class*="gdpr-cogwheel-button"][id$="${e.targetId}"]`),a=null==o?void 0:o.offsetWidth;s&&"number"==typeof a&&!isNaN(a)&&s.style.setProperty("right",String(-1*a*.2)+"px")},Qi=(e,t)=>t?Object.assign(Object.assign({},e),{"aa-sch-ssa-native-ad":"true","aa-sch-ssa-format":"NATIVE_CONTENT","aa-sch-ssa-market":"XNO","aa-sch-ssa-cat":["ssa_1","ssa_2","ssa_3","ssa_4","ssa_5","ssa_6","ssa_7","ssa_8","ssa_9","ssa_10","ssa_11","ssa_12","ssa_13","ssa_14","ssa_15","ssa_16","ssa_17","ssa_18","ssa_19","ssa_20","ssa_21","ssa_22","ssa_23","ssa_24","ssa_25","ssa_26","ssa_27","ssa_28","ssa_29","ssa_30"]}):e,Xi=e=>`externalImpId:'${e}'`,Zi=e=>{var t;const{forwardExternalImpId:n=!1,tracker:i}=d.get(),r=(e=>{var t;if(!e.positionConfig)return e;const n=e.keywords[`${ye()}-count`],i=e.positionConfig.find(e=>e.adPositionIndex===n);if(!i)return e;const r=i.keywords?Object.assign(Object.assign({},e.keywords),i.keywords):e.keywords;return Object.assign(Object.assign({},e),{sizes:null!==(t=null==i?void 0:i.sizes)&&void 0!==t?t:e.sizes,keywords:r})})(e),{id:o,sizes:s,keywords:a,allowedFormats:l,invCode:c,ssa:u=!1,nativeCustomProperties:v,safeframeConfig:p,resizeAdParentDiv:g=!1,dynamicSizeWidthCheck:h=!1}=(e=>{var t;if(!e.takeoverCookieCapForSharedPlacement||yi())return e;const n=null===(t=e.keywords)||void 0===t?void 0:t["no-sno-adformat"],i=null==n?void 0:n.filter(e=>e!==ui),r=Object.assign(Object.assign({},e.keywords),n&&{"no-sno-adformat":i}),o=e.sizes.filter(([e,t])=>4!==e||4!==t);return Object.assign(Object.assign({},e),{sizes:o,keywords:r})})(r),m=Object.assign({invCode:c,sizes:s,targetId:o,keywords:Qi(a,u),allowedFormats:l,resizeAdParentDiv:g,dynamicSizeWidthCheck:h},p&&{safeframeConfig:p}),y=(e=>{var t,n,i,r,o,s,a;return e?(null===(t=null==e?void 0:e.instance)||void 0===t?void 0:t.state)?(null===(i=null===(n=null==e?void 0:e.instance)||void 0===n?void 0:n.state)||void 0===i?void 0:i.pageViewId)?(j("Tracker state pageViewId is:",null===(o=null===(r=null==e?void 0:e.instance)||void 0===r?void 0:r.state)||void 0===o?void 0:o.pageViewId),null===(a=null===(s=null==e?void 0:e.instance)||void 0===s?void 0:s.state)||void 0===a?void 0:a.pageViewId):(j("Tracker state does not contain field pageViewId or it is empty"),""):(j("Tracker state is empty"),""):(j("Tracker is not configured in initAdvertory function"),"")})(i);n&&y&&(j("External Impression ID assigned to defineTag:",Xi(y)),m.externalImpId=Xi(y));const f=(e=>Object.entries({video:{required:!1},address:{required:!1},saleprice:{required:!1},rating:{required:!1},price:{required:!1},phone:{required:!1},likes:{required:!1},downloads:{required:!1},customIcon2:{required:!1}}).reduce((t,[n,i])=>((null==e?void 0:e.includes(n))&&(t[n]=i),t),{customTitle1:{required:!1},customTitle2:{required:!1},customTitle3:{required:!1},customTitle4:{required:!1},title:{required:!1},body:{required:!1},image:{required:!1},icon:{required:!1},sponsoredBy:{required:!1},cta:{required:!1},clickUrl:{required:!1},desc2:{required:!1},displayUrl:{required:!1},description:{required:!1}}))(v);return(null===(t=e.allowedFormats)||void 0===t?void 0:t.includes("native"))&&(m.native=f),m},er=e=>!e.includes("takeover")||yi(),tr=e=>{const{publisher:t=""}=d.get(),n=document.querySelector(`#${e}`);if(!n)return;const i=`-${t}`;n.classList.remove(`advertory${i}-finn-blink`),n.classList.remove(`advertory${i}-finn-blink-wrapper`)},nr=e=>{if(!e)return e;const t=e[`${me()}-targetid`],n=t?q(t[0]):"";return Object.assign(Object.assign({},e),t&&{[`${me()}-targetid`]:[n]})},ir=e=>Object.assign(Object.assign(Object.assign(Object.assign({},e),e[`${me()}-geo`]&&{[`${me()}-geo`]:["geo-test-value"]}),e[`${me()}-geofence`]&&{[`${me()}-geofence`]:["geofence-test-value"]}),e[`${me()}-weather`]&&{[`${me()}-weather`]:["weather-test-value"]}),rr=e=>{(e=>{const t=new URLSearchParams(window.location.search);if("true"!==t.get("scrollToFirstInvCode"))return;const n=t.get("ast_override_inv_code");if(!n)return;const i=n.split(",")[0].split(":")[0],r=e.find(e=>e.invCode===i),o=document.querySelector(`[id^=${null==r?void 0:r.id}]`);o&&o.scrollIntoView({behavior:"smooth",block:"start"})})(e),(()=>{var e;const t=new URLSearchParams(window.location.search).get("scrollToDrEditionPlacement");if(!t)return;const n=null!==(e=document.querySelector(`[id*="${t}}"]`))&&void 0!==e?e:document.querySelector(`a[aria-label*="${t}"]`);n&&n.scrollIntoView({behavior:"smooth",block:"start"})})()},or=(e,t)=>c(void 0,void 0,void 0,function*(){return yield new Promise(t=>{e().then(e=>{t(null!=e?e:null)}).catch(e=>{t(null)})})}),sr={arrayMerge:(e,t)=>t},ar=e=>c(void 0,void 0,void 0,function*(){if(!(e=>{const{editableConfiguration:{useS3Config:t=!1,pageTypeToFetch:n}={},siteSpecificConfig:i}=e;return Boolean(t&&n&&(null==i?void 0:i.publisherClassName))})(e))return e;try{const t=yield(e=>c(void 0,void 0,void 0,function*(){const t=(e=>{const{siteSpecificConfig:t,editableConfiguration:{pageTypeToFetch:n}={}}=e;return(null==t?void 0:t.publisherClassName)&&n?`https://alertory-cdn.staging.inventory.schibsted.io/editable-configurations/${t.publisherClassName}/${n.toUpperCase()}.json`:null})(e);if(!t)return null;const n=new AbortController,i=setTimeout(()=>n.abort(),5e3);try{return yield Xe.get(t,{method:"GET",signal:n.signal})}catch(e){throw j("Failed to fetch S3 config",{error:e,url:t}),e}finally{clearTimeout(i)}}))(e);return t?(({siteConfig:e,configOverrides:t})=>{var n;const{keywords:r,refresh:o,placements:s,threshold:a,batchSize:d}=t,l=i.all([e.placements,s],sr),c=i(e.pageOptions,{keywords:r},sr),u=i(e.appearanceConfig,{defaultThreshold:a},sr),v=i(null!==(n=e.refreshConfig)&&void 0!==n?n:{},{scrollRefreshEnabled:o},sr);return Object.assign(Object.assign({},e),{placements:l,requestSize:null!=d?d:e.requestSize,pageOptions:c,appearanceConfig:u,refreshConfig:v})})({siteConfig:e,configOverrides:t}):e}catch(t){return j("Error fetching S3 config, using site config",{error:t}),e}}),dr=".advertory-right-column-track",lr="--advertory-right-column-track-height",cr=e=>e.getBoundingClientRect().top+window.scrollY,ur=(e,t)=>{const n=ue(t);document.body.style.setProperty(e,n)},vr=(e,t)=>`${e}-${t}`,pr=(e,t,n)=>{var i;const r=Array.from(null!==(i=e.querySelectorAll(t))&&void 0!==i?i:[]),o=(e=>e.map(e=>{var t;return null===(t=document.querySelector(`[id^="${e}"]`))||void 0===t?void 0:t.parentElement}).map((e,t)=>({point:e,originalIndex:t})).filter(e=>Boolean(e.point)))(n);if(0===o.length)return;const s=cr(e);(()=>{const e=document.querySelector("header");if(!e)return;const t=ve(e);ur("--advertory-newsroom-header-height",t)})(),o.forEach(({point:e,originalIndex:t})=>{((e,t,n)=>{const i=cr(e),r=vr(lr,t),o=i-n,s=vr("--advertory-right-column-split-point-height",t),a=ve(e);ur(r,o),ur(s,a)})(e,t+1,s),(e=>{const t=null==e?void 0:e.id;if(!t)return;const n=vr("--advertory-right-column-ad-height",t),i=ve(e);ur(n,i)})(r[t])});((e,t)=>{const n=cr(e);ur(lr,n-t)})(o[Math.min(r.length,o.length-1)].point,s)};let gr=!1;class hr{getPulseObjectId(){return"sdrn:vg:content:partnerstudio:element:partnerstudio:stats"}getPulsePageId(){return"sdrn:vg:frontpage:front"}getTags(e){var t;let n;if(n=e instanceof HTMLAnchorElement?e.href:null===(t=null==e?void 0:e.querySelector("a"))||void 0===t?void 0:t.href,!n)return[];const{host:i,pathname:r}=new URL(n);if(!i.includes("www.vg.no")&&!r.includes("annonsorinnhold"))return[n];const o=r.split("/");return o.length?[...o.filter(Boolean).slice(1).map(e=>e),n]:[n]}}class mr{getPulseObjectId(){return""}getPulsePageId(e,t){return""}}class yr{constructor(e,t){this.pulse=e,this.newsroomStrategy=t}getEventInput(e,t){return{}}parseKilkayaData(e){const t=e.querySelector("article");if(!t)return{};const n=t.dataset.k5aTeaserAnalytics;try{return n?JSON.parse(n):{}}catch(e){return{}}}mapPageType(e){return{front:"Frontpage",article:"Article",section:"Article",collection:"Article",other:"Article"}[e||"front"]||"Frontpage"}getArticleId(){return location.pathname.split("/").slice(-2,-1).pop()||""}getEventTarget(e){const{url:t,title:n,itemId:i}=this.parseKilkayaData(e);return{id:i,name:this.normalizePlacementTitle(null!=n?n:""),type:"Page",url:t}}normalizePlacementTitle(e){return e.replace(/<[^>]+>/gi,"").replace(/[^a-z0-9æøå\s_-]/gi,"")}trackContentView(e){return c(this,void 0,void 0,function*(){var t,n,i,r,o,s,a,d;if(!this.pulse)return;const l=this.getEventInput(e,"view");(null===(t=this.pulse)||void 0===t?void 0:t.trackLegacyViewUIElement)?null===(i=null===(n=this.pulse)||void 0===n?void 0:n.trackLegacyViewUIElement)||void 0===i||i.call(n,l):(null===(r=this.pulse)||void 0===r?void 0:r.trackViewUIElement)?null===(s=null===(o=this.pulse)||void 0===o?void 0:o.trackViewUIElement)||void 0===s||s.call(o,l):null===(d=null===(a=this.pulse)||void 0===a?void 0:a.trackElementView)||void 0===d||d.call(a,l)})}trackContentClick(e){return c(this,void 0,void 0,function*(){var t,n,i,r,o,s;if(!this.pulse)return;const a=this.getEventInput(e,"click");this.pulse.trackLegacyClickUIElement?null===(n=(t=this.pulse).trackLegacyClickUIElement)||void 0===n||n.call(t,a):this.pulse.trackClickUIElement?null===(r=(i=this.pulse).trackClickUIElement)||void 0===r||r.call(i,a):null===(s=(o=this.pulse).trackElementClick)||void 0===s||s.call(o,a)})}}class fr extends yr{constructor(e,t,n){super(e,t),this.pulse=e,this.newsroomStrategy=t,this.pageType=n}getEventBaseData(e){var t,n,i,r,o,s;const{clientName:a,creativeId:d,itemId:l,placement:c}=this.parseKilkayaData(e),u=this.mapPageType(this.pageType),v=null===(t=this.newsroomStrategy)||void 0===t?void 0:t.getPulsePageId(this.pageType||"front",this.getArticleId());return{"@id":null!==(r=null===(i=null===(n=this.newsroomStrategy)||void 0===n?void 0:n.getPulseObjectId)||void 0===i?void 0:i.call(n))&&void 0!==r?r:c,"@type":"UIElement",position:c,elementType:"Article",custom:{customer:a,creativeId:null!=d?d:l},page:{"@id":null!=v?v:c,"@type":u,url:location.origin},tags:null===(s=null===(o=this.newsroomStrategy)||void 0===o?void 0:o.getTags)||void 0===s?void 0:s.call(o,e)}}getEventTarget(e){const{link:t,itemId:n,title:i}=this.parseKilkayaData(e);return{id:n,name:this.normalizePlacementTitle(null!=i?i:""),type:"Page",url:t}}getEventInput(e,t){return{object:this.getEventBaseData(e),partnerstudio:this.getEventPartnerstudioData(e,t),target:this.getEventTarget(e),provider:this.getProviderData()}}getEventPartnerstudioData(e,t){const n=this.parseKilkayaData(e);return Object.assign(Object.assign({},n),{type:t,tracking_type:"ad",xandrAdLoaded:!1})}getProviderData(){return{productTag:"partnerstudio"}}}const wr="[data-k5a-teaser-analytics]",br=(e,t,n)=>{const i=document.querySelectorAll("k5a-stream");if(!i.length)return;const r=new fr(e,t,n),o=new WeakMap,s=e=>{const t=o.get(e);t&&(t.disconnect(),o.delete(e))},a=new IntersectionObserver((e,t)=>{e.forEach(e=>{if(!e.isIntersecting)return;const n=e.target,i=n.querySelector(wr);Boolean(null==i?void 0:i.dataset.k5aTeaserAnalytics)?(r.trackContentView(n),t.unobserve(e.target),s(n)):((e,t)=>{if(o.has(e))return;const n=new MutationObserver(()=>{const n=e.querySelector(wr);Boolean(null==n?void 0:n.dataset.k5aTeaserAnalytics)&&(r.trackContentView(e),t.unobserve(e),s(e))});n.observe(e,{attributes:!0,childList:!0,subtree:!0,attributeFilter:["data-k5a-teaser-analytics"]}),o.set(e,n)})(n,t)})},{threshold:.5});i.forEach(e=>{a.observe(e),e.addEventListener("click",()=>r.trackContentClick(e))})};class Er{handleKilkayaStreamTracking({pulse:e,pageType:t,publisher:n}){if(!(null==e?void 0:e.instance))return;const i={[be.VG]:new hr}[n]||new mr;br(e.instance,i,t)}injectKilkayaMeta(e){const t=document.createElement("script");t.textContent=`var k5aMeta = { consent: ${e} };`,document.head.appendChild(t)}observeForKilkayaBackfills(){document.addEventListener("K5A:EmptyStreamSlot",e=>{var t;const n=null===(t=null==e?void 0:e.detail)||void 0===t?void 0:t.streamSlot;if(!n)return;const i=n.parentElement;i&&(j(`Kilkaya placement ${n.getAttribute("name")} has not been loaded, loading Xandr backfill`),this.showBackfill(i))})}showBackfill(e){var t;const n=e.querySelector(".fallback");if(!n)return;n.style.display="block";const i=null!==(t=n.dataset.fallbackTargetId)&&void 0!==t?t:"";I(i)}loadKilkayaScript(e){return c(this,void 0,void 0,function*(){yield wt(e)})}run(e){return c(this,void 0,void 0,function*(){const{tcf:t,isMobileApp:n,country:i,kilkaya:r}=e;if(!(null==r?void 0:r.enabled))return;const o=yield Ue(t,n,i,"kilkaya");o&&(this.observeForKilkayaBackfills(),this.injectKilkayaMeta(o),yield this.loadKilkayaScript(r.url),this.handleKilkayaStreamTracking(e))})}}const Tr=e=>{var t,n,i,r,o,s;const{adScaleConfig:a,deviceType:l}=d.get();if(!(null==a?void 0:a.enabled))return;if(ce(e,R))return;const c=null!==(t=a.adsToBeScaled[l])&&void 0!==t?t:[],u=Jt(e.targetId.split("-")[0]);if(!c.includes(u))return;const v=null!==(i=null===(n=a.offset)||void 0===n?void 0:n[u])&&void 0!==i?i:0,p=document.getElementById(e.targetId),g=null!==(r=null==p?void 0:p.offsetWidth)&&void 0!==r?r:window.screen.width,h=null!==(s=null===(o=null==p?void 0:p.parentElement)||void 0===o?void 0:o.offsetWidth)&&void 0!==s?s:window.screen.width;((e,t=window.screen.width)=>{const n=Gi(e,t),i=document.querySelector(`iframe[id^="utif_${e.targetId}"]`);i&&(i.style.transform=`scale(${n})`,i.style.transformOrigin="left top")})(e,(g<h?g:h)-v)},Ir=1e4,Ar=e=>e.some(e=>e.some(e=>!!e&&Zn(e,0))),kr=()=>{const{widescreenSwitching:e}=d.get(),{enabled:t,rotationInterval:n=Ir,widescreenIdPrefix:i}=null!=e?e:{};if(!t)return;const r=((e="widescreen")=>{const{pageSectionsSelectors:{right:t}={}}=d.get();return t?Array.from(document.querySelectorAll(t)).map(t=>Array.from(t.querySelectorAll(`div[id^="${e}"]`))):[]})(i);let o=0,s=Date.now(),a=Ar(r);if(!r.length)return;const l=(e,t,n)=>{e.forEach(e=>{e&&e.style.setProperty(t,n)})},c=e=>1===e?0:1;(e=>{e.forEach(e=>{e[0]&&(e[0].style.display="block"),e[1]&&(e[1].style.display="none")})})(r);const u=((e,t)=>{let n=null;return(...i)=>{null===n&&(e(...i),n=setTimeout(()=>{n=null},t))}})(()=>{a||(a=Ar(r)||a,s=Date.now());Date.now()-s>=n&&((()=>{const e=c(o),t=r.map(e=>e[o]),n=r.map(t=>t[e]);l(t,"opacity","0"),setTimeout(()=>{l(t,"display","none"),l(n,"opacity","0"),l(n,"display","block"),setTimeout(()=>{l(n,"opacity","1")},450)},450)})(),o=c(o),s=Date.now())},1e3);window.addEventListener("scroll",u)};let Cr,Sr=[];const Or=["takeover","wallpaper"],Pr=e=>{const t=(e=>{const t=m.getData("alertoryConfigKeywords"),{queryConfig:n,placements:i,tcf:r,glimr:o,appearanceConfig:a,requestSize:d=s,publisher:l,country:c,pageType:u,deviceType:v,isMobileApp:p=!1,pageOptions:{member:g},takeover:h,fullscreenScroll:y,useAppTabletInvCode:f}=e;return{xandr:{member:g,keywords:t,tags:[]},advertory:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({publisher:l,country:c,pageType:u,deviceType:v,placements:i,tcf:r,requestSize:d,isMobileApp:p,useAppTabletInvCode:f},o&&{glimr:o}),n&&{queryConfig:n}),a&&{appearanceConfig:a}),h&&{takeover:h}),y&&{fullscreenScroll:y})}})(e);window.advertory={initialized:!0,siteConfig:e,alertoryConfig:t}},$r=()=>c(void 0,void 0,void 0,function*(){const{pageOptions:e}=d.get(),{preparePageOptions:t}=d.getHandlers(),n=(()=>{const{sandboxAdIframeEnabled:e=!0}=d.get();return{sandboxAdIframe:e,sandboxAttributes:["allow-same-origin","allow-scripts","allow-top-navigation-by-user-activation","allow-popups","allow-popups-to-escape-sandbox","allow-forms"]}})(),i=yield c(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=d.get();return(yield Ue(e,t,n,"page-options"))?{}:{userSync:{disabled:!0}}}),r=yield t(Object.assign(Object.assign(Object.assign({disablePsa:!0,enableSafeFrame:!0},e),{renderingManagement:Object.assign({},n)}),i));(e=>{const t=m.getData("alertoryConfigKeywords");if(Object.keys(t).length)return;const n=ir(e);m.setData("alertoryConfigKeywords",n)})(r.keywords),v(()=>Cr.setPageOpts(r))}),Lr=e=>c(void 0,void 0,void 0,function*(){const{prebid:t,tcf:n,isMobileApp:i,country:r}=d.get();xr(e);const o=yield Ue(n,i,r,"prebid");(null==t?void 0:t.enabled)&&o?(j("core loadPlacements prebid enabled"),yield Ft()):(j("core load tags invoked without prebid enabled"),Nr(e))}),xr=e=>{const{prepareTag:t}=d.getHandlers(),n=[];(e=>{const t=["skyscraperright_1","topboard","wallpaper","skyscraperleft_1"];return e.sort((e,n)=>{const i=t.findIndex(t=>e.id.includes(t)),r=t.findIndex(e=>n.id.includes(e));return-1!==i&&-1===r?-1:-1===i&&-1!==r?1:i-r})})(e).forEach(e=>{j("core defineTags",{placement:e});const i=Zi(e);if(er(e.id)){const r=t(i),o=(e=>{const{allowedFormats:t,invCode:n,keywords:i,sizes:r}=e;return{adTypes:t,invCode:n,keywords:nr(i),sizes:r}})(r);n.push(o),v(()=>(j("core defineTag - add to the queue",{placement:e,preparedTag:r}),Cr.defineTag(r)))}}),(e=>{var t,n,i;(null===(i=null===(n=null===(t=window.advertory)||void 0===t?void 0:t.alertoryConfig)||void 0===n?void 0:n.xandr)||void 0===i?void 0:i.tags)&&e.length&&window.advertory.alertoryConfig.xandr.tags.push(e)})(n)},Nr=e=>{const t=e.filter(({id:e})=>er(e)).map(({id:e})=>e);t.length&&v(()=>(j("core loadTags",{placementsIdsToLoad:t}),Cr.loadTags([...t])))},jr=(e,t)=>c(void 0,void 0,void 0,function*(){const{appearanceConfig:n,deviceType:i}=d.get(),{threshold:r,refresh:o,priority:s="normal"}=e,a=(e=>{const t=document.querySelector(`[data-show-tag-subscribe-id=${e.targetId}]`),n=document.querySelector(`#${e.targetId}`);return t||n})(t),l=null==n?void 0:n.defaultThreshold[i];a&&(j("core showAd - subscribe for show tag with thresholds",{placement:e,adObj:t,threshold:r,deviceDefaultThreshold:l}),yield Fn(a,null!=r?r:l)),a&&o&&(j("core showAd - setup refreshing",{placement:e,adObj:t}),a.dataset.refresh=o.toString(),a.dataset.priority=s)}),_r=e=>e.some(({id:e})=>Or.some(t=>e.includes(t))),qr=e=>c(void 0,void 0,void 0,function*(){var t;if(!(null===(t=null===window||void 0===window?void 0:window.advertory)||void 0===t?void 0:t.initialized))return;const{requestSize:n=s}=d.get(),i=Zt(e);for(const e of Object.keys(i)){const t=i[e],r=Qn(t,n);for(const e of r)_r(e)?(j("core loadAds without lazy loading",{placementsToLoad:e}),yield Lr(e)):e.length&&(j("core loadAds with lazy loading",{placementsToLoad:e}),yield Dr(e))}}),Dr=e=>c(void 0,void 0,void 0,function*(){const{queryConfig:{lazyLoadingV3:{enabled:t=!1,rootMargin:n="200% 0px"}={}}={}}=d.get(),i=[];if(!t)return j("lazy load is not enabled",{placements:e}),void(yield Lr(e));const r=new IntersectionObserver((t,n)=>{t.filter(({isIntersecting:e,target:{id:t}})=>e&&!t.includes("wallpaper")).forEach(t=>{j("lazy load is enabled - handler start",{loadedPlacementIds:i,placements:e});const r=e.every(e=>i.includes(e.id)),o=e.map(e=>e.id);!r&&i.push(...o),!r&&Lr(e),j("lazy load is enabled - handler stop",{loadedPlacementIds:i,placements:e,arePlacementsLoaded:r,placementIds:o}),n.disconnect()})},{rootMargin:n});e.forEach(e=>{const t=document.getElementById(e.id);t&&(j("lazy loading - observe element",{placementId:e.id,element:t}),r.observe(t))})}),Mr=()=>c(void 0,void 0,void 0,function*(){const{siteEvents:e,initNativeAd:t,wallpaperHandlers:{initWallpaperAd:n,adjustAdToHorseshoe:i}}=d.getHandlers(),{wallpaper:r,fullscreenScroll:o}=d.get(),s=[];v(()=>{Cr.onEvent("adRequested",()=>{e.adRequested()}),Cr.onEvent("adAvailable",i=>c(void 0,void 0,void 0,function*(){var s,a,l,c,u,p;j("core adAvailable start",{placementsAvailable:Sr,adObj:i,isFullscreenScrollAd:J(i),isFinnBlink:re(i.targetId),isNativeAd:Y(i),isMediation:Ee(i),isTakeoverAd:X(i),isCollapseAd:te(i),isWallpaperAd:ee(i)});const g=null===(l=null===(a=null===(s=null===window||void 0===window?void 0:window.apntag)||void 0===s?void 0:s.requests)||void 0===a?void 0:a.tags[i.targetId])||void 0===l?void 0:l.adResponse.ads;Ee(i)&&g&&(null===(c=g[1])||void 0===c?void 0:c.rtb)&&(i.banner=null===(p=null===(u=g[1])||void 0===u?void 0:u.rtb)||void 0===p?void 0:p.banner),J(i)&&Rt(i),ae(i)&&kr(),J(i)&&!re(i.targetId)&&Bt(i,o),!Y(i)||Ee(i)||re(i.targetId)||t(i,d.get()),X(i)&&!te(i)&&(Fi(i.targetId),yield Vi(i)),ee(i)&&(n(()=>v(()=>window.apntag.showTag(i.targetId)),r),m.setData("wallpaper",{isAvailable:!0})),(e=>e.targetId.includes("skyscraperleft")&&!!e.banner)(i)&&m.setData("horseshoe",{isAvailable:!0}),Wi({adObj:i}),(e=>{var t;const n=null==e?void 0:e.targetId;if(!n)return;const i=null===(t=document.querySelector(`#${n}`))||void 0===t?void 0:t.parentElement;i&&((e,t)=>{const{height:n,width:i,native:r}=e;r?t.dataset.adSizes="[1,1]":n&&i&&(t.dataset.adSizes=`[${i},${n}]`)})(e,i)})(i),e.adAvailable(i);const h=Sr.find(({id:e})=>e===i.targetId);h&&(yield jr(h,i),Sr=Sr.filter(e=>e.id!==h.id)),j("core adAvailable stop",{placementsAvailable:Sr,adObj:i,isFullscreenScrollAd:J(i),isFinnBlink:re(i.targetId),isNativeAd:Y(i),isMediation:Ee(i),isTakeoverAd:X(i),isCollapseAd:te(i),isWallpaperAd:ee(i)})})),Cr.onEvent("adLoaded",n=>{const{refreshConfig:r,appearanceConfig:o}=d.get(),a=document.getElementById(n.targetId);re(n.targetId)&&(e=>{const{fullscreenScroll:t}=d.get(),{initNativeAd:n}=d.getHandlers();J(e)&&Bt(e,t),Y(e)&&n(e,d.get())})(n);s.includes(n.targetId)&&Y(n)&&(t(n,d.get()),Wi({adObj:n})),!s.includes(n.targetId)&&Ee(n)&&s.push(n.targetId),te(n)&&T(n.targetId),X(n)&&((e,t)=>{var n;const i="100%",r="100%";e.resizeAd(t,[i,r]);const o=null===(n=document.querySelector(`#div_utif_${t}`))||void 0===n?void 0:n.querySelector("iframe");if(!o)return;new MutationObserver(e=>{for(const t of e)if("attributes"===t.type&&"style"===t.attributeName){const e=window.getComputedStyle(o),t=e.width,n=e.height;t===i&&n===r||(o.style.width=i,o.style.height=r)}}).observe(o,{attributes:!0,attributeFilter:["style"]})})(Cr,n.targetId),Q(n)&&(e=>{const t=document.querySelector(`#${e.targetId}`),{siteSpecificConfig:{publisherClassName:n,fullWidthFormatClassName:i}={}}=d.get();if(!t||!n||!i)return;const r=t.parentElement;r&&(t.classList.add(`advertory-${n}-${i}__full-width-ad`),r.classList.add(`advertory-${n}-${i}-wrapper__full-width-ad`))})(n),(e=>ce(e,F))(n)&&(e=>{const t=document.querySelector(`#${e.targetId}`),n=null==t?void 0:t.querySelector("iframe"),i=null==n?void 0:n.parentElement,{siteSpecificConfig:{publisherClassName:r,fullWidthFormatClassName:o}={}}=d.get();if(!t||!n||!i)return;const s=window.innerWidth,a=Math.round(s/1080*1920);t.style.width="100%",t.style.height=`${a}px`,t.classList.add(`advertory-${r}-${o}__vertical-full-width-ad`);const l=Gi(e,t.offsetWidth);i.style.transform=`scale(${l})`,i.style.transformOrigin="left top"})(n),ei(n,r),(null==o?void 0:o.clearProbableDimensionsEnabled)&&(e=>{const t=document.querySelector(`#${e}`);t&&(t.style.minWidth="",t.style.minHeight="")})(n.targetId);var l,c;m.getData("horseshoe").isAvailable&&i(n.targetId),Tr(n),e.adLoaded(n),l=n.targetId,!document.querySelector(`#gdprAdTransparencyCogWheelButton-${l}`)&&(null===(c=window.gdpr)||void 0===c?void 0:c.setupButton)&&window.gdpr.setupButton(l),a&&(a.classList.add("ad-loaded"),(e=>{var t;const{siteSpecificConfig:n}=d.get(),i=null!==(t=null==n?void 0:n.mainColumnWidth)&&void 0!==t?t:1/0;e.clientWidth>i&&e.setAttribute("data-two-column-ad-layout","true")})(a)),Yi(n),window.dispatchEvent(new CustomEvent("advertory:adLoaded",{detail:{targetId:n.targetId,adFormat:Ki(n)}}))}),Cr.onEvent("adNoBid",t=>c(void 0,void 0,void 0,function*(){T(t.targetId),yield Sn(d.get(),t),Ti(t)&&(yield Ei()),e.adNoBid(t)})),Cr.onEvent("adError",(t,n)=>c(void 0,void 0,void 0,function*(){Ti(n)&&(yield Ei()),e.adError(t,n)})),Cr.onEvent("adCollapse",()=>{e.adCollapse()}),Cr.onEvent("adRequestFailure",t=>{T(t.targetId),e.adRequestFailure(t)}),Cr.onEvent("adBadRequest",t=>{T(t.targetId),e.adBadRequest(t)}),Cr.onEvent("adLoadedMediated",t=>e.adLoadedMediated(t)),Cr.onEvent("adNoBidMediated",t=>e.adNoBidMediated(t))})}),Br=(e,t)=>c(void 0,void 0,void 0,function*(){var n;if(!(null===(n=null===window||void 0===window?void 0:window.advertory)||void 0===n?void 0:n.initialized))return[];const{clearAds:i,reloadExistingAds:r,renderFinnBlinkPlacements:o,contextSelector:s}=null!=t?t:{};if(i)return Kt(),[];r&&(Kt(),document.querySelectorAll('[data-advertory-ad-rendered="true"]').forEach(e=>{I(e.id)})),l(null!=e?e:{}),yield $r();let a=Qt(s);return o&&(a=a.filter(e=>re(e.id))),a.length>0&&(Sr=[...Sr,...a.map(e=>Object.assign({},e))],ti(a),ii(a),yield qr(a)),Sr}),Rr=(e,t)=>c(void 0,void 0,void 0,function*(){var n;d.set(e),d.setHandlers(t),m.initialize(),window.addEventListener("message",Mn,!1),Cr=window.apntag||{anq:[],defineTag:e=>({targetId:""}),showTag:e=>{},onEvent:(e,t,n)=>{},offEvent:(e,t)=>{},refresh:e=>{},modifyTag:(e,t)=>{},loadTags:e=>{},emitEvent:(e,t)=>{},setPageOpts:e=>{},resizeAd:(e,t,n)=>{},getAstVersion:()=>"",setEndpoint:(e,t)=>{},fireImpressionTrackers:e=>{},setKeywords:()=>{},clearRequest:()=>{}},window.apntag=Cr,j("Apn tag is set up on window"),yield Promise.allSettled([c(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=d.get();(yield Ue(e,t,n,"xandr-endpoint"))||Cr.setEndpoint("ib.adnxs-simple.com",!0)}),c(void 0,void 0,void 0,function*(){const{prebid:e,tcf:t,isMobileApp:n,country:i}=d.get(),r=yield Ue(t,n,i,"prebid");(null==e?void 0:e.enabled)&&r&&(yield wt(null==e?void 0:e.url))}),ct(e),c(void 0,void 0,void 0,function*(){const{astUrl:e}=d.get();yield wt(null!=e?e:"https://adsdk.microsoft.com/ast/ast.js")}),c(void 0,void 0,void 0,function*(){const{gptUrl:e}=d.get();yield wt(null!=e?e:"https://securepubads.g.doubleclick.net/tag/js/gpt.js")}),c(void 0,void 0,void 0,function*(){const{brandmetrics:{enabled:e,url:t}={},tcf:n,isMobileApp:i,country:r}=d.get(),{getConsentAsync:o}=Oe(n,i,r),s=yield o();if(e&&t&&s){if(yield wt(t),document.querySelector(`.${Ui}`))return window._brandmetrics=window._brandmetrics||[],void window._brandmetrics.push({cmd:"_loadsurvey"});new MutationObserver((e,t)=>{for(const n of e){if("childList"!==n.type)return;Array.from(n.addedNodes).some(e=>{var t;return null===(t=e.outerHTML)||void 0===t?void 0:t.includes(Ui)})&&(t.disconnect(),window._brandmetrics=window._brandmetrics||[],window._brandmetrics.push({cmd:"_loadsurvey"}))}}).observe(document,{childList:!0,subtree:!0,attributes:!0})}}),ze(),c(void 0,void 0,void 0,function*(){const{gdpr:{url:e,allowHidingAds:t=!0}={}}=d.get();t&&(window.gdpr=window.gdpr||{},window.gdpr.allowHidingAds=!0),yield wt(null!=e?e:"https://cogwheel.inventory.schibsted.io/prod/latest/gdpr-bundle.js")})]),yield Hi(),j("Libraries have been loaded and trackers have been set"),yield(n=t.librariesToLoad,c(void 0,void 0,void 0,function*(){const e=n.map(e=>wt(e));yield Promise.all(e)})),yield Mr(),yield $r(),j("Page options have been set"),Pr(e),j("Advertory is setup on window"),Sr=Qt(),ti(Sr),ii(Sr),yield qr(Sr),j("Ads has been loaded",Sr),rr(Sr),yield t.replaceAdsWithFinnBlink(e.finnBlink),yield(e=>c(void 0,void 0,void 0,function*(){var t;if(!e.drEdition)return;if(!(yield Ue(e.tcf,e.isMobileApp,e.country,"handleDrEdition")))return;const n=yield In(),i=new An(n);kn({publisher:e.publisher,drEditionConfig:e.drEdition,device:e.deviceType,pageType:e.pageType,country:e.country},i,null===(t=e.pulse)||void 0===t?void 0:t.instance)}))(e),(e=>{if(!(null==e?void 0:e.enabled)||gr)return;const{splitPointIDs:t,adSelector:n,trackSelector:i=dr}=e,r=document.querySelector(i);if(!r)return;gr=!0;const o=()=>{pr(r,n,t)};o(),window.addEventListener("resize",o),window.addEventListener("orientationchange",o),window.addEventListener("load",o),window.addEventListener("advertory:adLoaded",()=>{requestAnimationFrame(o)}),new ResizeObserver(o).observe(r)})(e.rightColumnSplit),yield(e=>c(void 0,void 0,void 0,function*(){const t=new Er;yield t.run(e)}))(e)}),Fr=(e,t)=>c(void 0,void 0,void 0,function*(){yield((e,t)=>c(void 0,void 0,void 0,function*(){const{initConsentManager:n,getConsentAsync:i}=Oe(e.tcf,e.isMobileApp,e.country),r=yield ar(e);yield _(),yield or(n),yield or(i),j("TCF resolved successfully"),yield Rr(r,t),j("Run function resolved successfully")}))(e,t)}),Vr="native_override_desc2",Ur=(e,t,n)=>{var i;const{image:r,icon:o,sponsoredBy:s,title:a,clickUrl:d,cta:l,body:c,desc2:u,video:v,description:p,customTitle1:g,customTitle2:h,customTitle3:m,customTitle4:y,customIcon2:f}=e,w=(e,t="")=>{var n;return e?null!==(n=e.url)&&void 0!==n?n:e:t};return Object.assign({containerId:n,img:w(r),imgWidth:null==r?void 0:r.width,imgHeight:null==r?void 0:r.height,imgAltText:null!=a?a:"",logo:w(o),sponsoredBy:null!=s?s:"",title:null!=a?a:"",url:null!=d?d:"",cta:null!=l?l:"",description:null!==(i=null!=c?c:p)&&void 0!==i?i:"",desc2:null!=u?u:"",video:v,customTitle1:null!=g?g:"",customTitle2:null!=h?h:"",customTitle3:null!=m?m:"",customTitle4:null!=y?y:"",logo2:w(f)},t)},Hr=(e,t)=>{const n=(i=Vr,window.location.href.includes(i));var i;const r=new URLSearchParams(window.location.search).get(Vr),o=t.includes("native_recirc");return n&&r?r:(null==e?void 0:e.includes("recirc"))?o?"native_recirc":"recirc":(null==e?void 0:e.includes("sponsor"))?"sponsorstripe":null},zr=(e,t,n,i)=>{const r=document.querySelector(`#${e}`);r&&t&&(r.innerHTML=t,((e,t)=>{const n=e.parentElement,{publisher:i,pageType:r}=t,o=i&&Object.values(be).includes(i);n&&o&&P(i,e,N,r)})(r,n),i())},Wr=e=>{var t;const n=document.querySelector(`#${e.targetId}`);if(!n||!(null===(t=e.native)||void 0===t?void 0:t.clickTrackers))return;(null==n?void 0:n.querySelectorAll("a.ad-link")).forEach(t=>{"true"!==t.dataset.tracked&&(t.addEventListener("click",()=>{var t,n;for(const i of null!==(n=null===(t=e.native)||void 0===t?void 0:t.clickTrackers)&&void 0!==n?n:[])Yr(i)}),t.dataset.tracked="true")})},Kr=e=>{const{native:{impressionTrackers:t}={}}=e;(null==t?void 0:t.some(e=>e.includes("googleads")))?null==t||t.forEach(Jr):window.apntag.fireImpressionTrackers(e);const n=new CustomEvent("advertory:nativeImpression",{detail:{ad:e}});window.dispatchEvent(n)},Gr=(e,t)=>{var n;let i=!1;const r=document.querySelector(`#${e.targetId}`);if(!r||!e.native)return;const{deviceType:o,appearanceConfig:s,nativeTrackingConfig:{fireImpressionsBasedOnAppearanceThreshold:a=!1}={}}=t,d=a?{rootMargin:`${l=null!==(n=null==s?void 0:s.defaultThreshold[null!=o?o:$.DESKTOP])&&void 0!==n?n:0}px 0px ${l}px 0px`}:{};var l;const c=new IntersectionObserver(t=>{if(!i)for(const n of t)if(n.isIntersecting){i=!0,Kr(e),c.disconnect();break}},d);c.observe(r)},Jr=e=>{const t=e.includes("googleads");"function"!=typeof window.navigator.sendBeacon||t?Yr(e):window.navigator.sendBeacon(e)},Yr=e=>{fetch(e,{method:"GET",mode:"no-cors"}).catch(t=>console.warn(`Tracker ${e} failed. Error: ${t||"Unknown"}`))},Qr=(e,t,n)=>{const i=((e,t,n)=>{var i;const{displayTemplates:r,videoTemplates:o}=n,s="default";if(!e.native)return null;const{native:a,targetId:d}=e,{desc2:l=s}=e.native,c=l.toLowerCase(),u=null!==(i=Hr(e.targetId,l))&&void 0!==i?i:c,v=jt[t.language||he.NO],p=Ur(a,v,d);return(a.video?o[u]:r[u]||r.default)(p,t)})(e,t,n);zr(e.targetId,i,t,()=>{const{nativeTrackingConfig:{nativeTrackingEnabled:n=!0}={}}=t;n&&((e,t)=>{Wr(e),Gr(e,t)})(e,t)})},Xr="viewable",Zr="adClick";const eo=(e,t)=>{const n=(new DOMParser).parseFromString(e,"text/xml"),i=n.querySelector("ClickThrough"),r=n.querySelector("VideoClicks");if(i){for(;i.firstChild;)i.removeChild(i.firstChild);i.appendChild(n.createCDATASection(t))}else if(r){const e=n.createElement("ClickThrough");e.appendChild(n.createCDATASection(t)),r.appendChild(e)}return URL.createObjectURL(new Blob([(new XMLSerializer).serializeToString(n)],{type:"text/xml"}))},to=({id:e,nodeId:t,poster:n,tagURL:i,publisher:r="",productTag:o="xandr",videoLoop:s=!1})=>({id:e,poster:n,vendor:"appnexus",node:t,mute:!0,autoplay:s,repeat:s,skin:{name:"inventory-player",url:"https://ads.inventory.schibsted.io/styles/player.css"},settings:{jw:{stretching:"fill",advertising:{client:"vast",tag:i}}},pulse:{provider:r.toLowerCase(),decorator:e=>Object.assign(Object.assign({},wn(e)?e:{}),{provider:Object.assign(Object.assign({},wn(null==e?void 0:e.provider)?e.provider:{}),{productTag:o})})}}),no=e=>c(void 0,void 0,void 0,function*(){const{playerConfig:t,pluginsNames:n,clickUrl:i}=e,{repeat:r}=t,o=yield pn(t);hn(n),o.once("assetReady",()=>{vn(o,n)}),o.on(Xr,e=>{const{viewable:t}=e;t?o.play():o.pause()}),o.on(Zr,()=>{window.open(i,"_blank")}),r&&o.on("pause",()=>{o.play()})}),io=({containerId:e,adText:t,url:n,adFrom:i,sponsoredBy:r,title:o},s,a)=>`<article class="advertory-abo-ad-native-video">\n <div class="ad-info" id="${e}-button"></div>\n <div class="ad-content">\n <div class="ad-image-container">\n <div class="ad-header">\n <span>${t}</span>\n </div>\n <div class="ad-player-wrapper">\n <div id="${a}"></div>\n </div>\n </div>\n <div class="ad-text-container">\n <span class="sponsored-by">\n ${i} ${r}\n </span>\n <a class="ad-link" href="${n}" target="_blank">\n <span class="ad-title">${o}</span>\n <div class="ad-description">${o}</div>\n </a>\n </div>\n </div>\n </article>`,ro={VIDEO:(e,t)=>{return(n=io,(e,t,i)=>{const{video:r,img:o,url:s}=e,{publisher:a,productTag:d}=t,{pluginsNames:l,videoLoop:c}=i||{};if(!(null==r?void 0:r.content))return null;const u=Math.ceil(1e5*Math.random()),v=o||"https://custom.inventory.schibsted.io/1x1-00000000.png",p=`ad-player-${u}`,g=eo(r.content,s),h=to({id:u,nodeId:p,poster:v,tagURL:g,publisher:a,productTag:d,videoLoop:c});return no({playerConfig:h,clickUrl:s,pluginsNames:l}),`${n(e,t,p)}`})(e,t);var n},SPONSORSTRIPE:({title:e,sponsoredBy:t,logo:n})=>`<article class="advertory-abo-ad-native-sponsorstripe">\n <div class="ad-wrapper">\n <div class="info-button-wrapper" onClick="\n const adDescription = document.getElementById('ad-sponsorstripe-description');\n adDescription.classList.toggle('hide');\n ">\n <div class="info-button"></div>\n </div>\n\n <span class="ad-title">${e}</span>\n <img alt="${t}" class="ad-logo" src="${n}" />\n\n <div id="ad-sponsorstripe-description" class="ad-description hide">\n <span>${(e=>`Annonsøren har betalt for profilering av logo og merkenavn i artikler tilknyttet ${e}. Annonsøren har ingen innflytelse på Aftenpostens journalistiske virksomhet.`)(t)}</span>\n <a class="ad-description-readmore" href="https://www.aftenposten.no/slik-jobber-vi-i-aftenposten/i/xgKR18/ekstern-finansiering-av-innhold-i-aftenposten" target="_blank">Les mer</a>\n <div class="close-button-wrapper" onClick="\n const adDescription = document.getElementById('ad-sponsorstripe-description');\n adDescription.classList.toggle('hide');\n ">\n <div class="close-button"></div>\n </div>\n </div>\n </div>\n \n </article>`},oo={NATIVE_TEMPLATE:({containerId:e,url:t,sponsoredBy:n,title:i,img:r,adText:o})=>`<article class="advertory-no-ad-native-default">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_self">\n <div class="ad-content">\n <div class="ad-image-container">\n <img alt="${i}" class="ad-image" src="${r}" />\n </div>\n <div class="ad-text-container">\n <div class="ad-sponsor">\n <span class="ad-label">${o}</span> ${n}\n </div>\n <div class="ad-title">${i}</div>\n </div>\n </div>\n </a>\n </article>`,NATIVE_RECIRC:({containerId:e,url:t,sponsoredBy:n,title:i,img:r,adText:o})=>`<article class="advertory-no-ad-native-recirc">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_self">\n <div class="ad-content">\n <div class="ad-image-container">\n <img alt="${i}" class="ad-image" src="${r}" />\n </div>\n <div class="ad-text-container">\n <div class="ad-sponsor">\n <span class="ad-label">${o}</span> ${n}\n </div>\n <div class="ad-title">${i}</div>\n </div>\n </div>\n </a>\n </article>`},so={CONTENT:({containerId:e,url:t,title:n,logo:i,sponsoredBy:r,img:o,description:s})=>`<article class="advertory-e24-ad-native-content">\n <div class="ad-info" id="${e}"></div>\n <a class="ad-link" href="${t}" target="_blank" rel="noreferrer noopener nofollow sponsored">\n <div class="ad-content">\n <div class="ad-header">\n <span class="ad-annonse">Annonsørinnhold|</span>\n <img alt="${r}" class="ad-logo" src="${i}" />\n </div>\n <div class="ad-image-container">\n <img alt="${n}" class="ad-image" src="${o}" />\n </div>\n <div class="ad-text-container">\n ${s?`<span class="ad-subtitle">${s}</span>`:""}\n <span class="ad-title">${n}</span>\n </div>\n </div>\n </a>\n </article>`,BASIC:({containerId:e,url:t,title:n,logo:i,sponsoredBy:r,img:o})=>`<article class="advertory-e24-ad-native-content-basic">\n <div class="ad-info" id="${e}"></div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-content">\n <div class="ad-header">\n <div id="${e}-button"></div>\n <span>Annonse</span>\n </div>\n <div class="ad-image-container">\n <div class="ad-ratio-container">\n <img src="${o}" alt="${n}" />\n </div>\n <img class="ad-sponsored-by" src="${i}" alt="${r}" />\n </div>\n <div class="ad-text-container">\n <span class="ad-annonse-label">Annonse fra ${r}</span>\n <h6 class="ad-title">${n}</h6>\n </div>\n </div>\n </a> \n </article>`,RECIRC:({containerId:e,url:t,title:n,logo:i,sponsoredBy:r,img:o})=>`<article class="advertory-e24-ad-native-recirc">\n <div class="ad-info" id="${e}"></div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-content">\n <div class="ad-header">\n <div id="${e}-button"></div>\n <span>Annonse</span>\n </div>\n <div class="ad-image-container">\n <div class="ad-ratio-container">\n <img src="${o}" alt="${n}" />\n </div>\n <img class="ad-sponsored-by" src="${i}" alt="${r}" />\n </div>\n <div class="ad-text-container">\n <span class="ad-annonse-label">Annonse fra ${r}</span>\n <h6 class="ad-title">${n}</h6>\n </div>\n </div>\n </a> \n </article>`},ao={CONTENT:({containerId:e,url:t,title:n,logo:i,sponsoredBy:r,img:o,description:s})=>`<article class="advertory-e24-ad-native-content__front">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_blank" rel="noreferrer noopener nofollow sponsored">\n <div class="ad-content">\n <div class="ad-header">\n <span class="ad-annonse">Annonsørinnhold|</span>\n <img alt="${r}" class="ad-logo" src="${i}" />\n </div>\n <div class="ad-image-container">\n <img alt="${n}" class="ad-image" src="${o}" />\n </div>\n <div class="ad-text-container">\n ${s?`<span class="ad-subtitle">${s}</span>`:""}\n <span class="ad-title">${n}</span>\n </div>\n </div>\n </a>\n </article>`,BASIC:({containerId:e,url:t,title:n,logo:i,sponsoredBy:r,img:o})=>`<article class="advertory-e24-ad-native-content-basic__front">\n <div class="ad-info" id="${e}-button"></div>\n <a class="ad-link" href="${t}" target="_blank">\n <div class="ad-content">\n <div class="ad-header">\n <div id="${e}-button"></div>\n <span>Annonse</span>\n </div>\n <div class="ad-image-container">\n <div class="ad-ratio-container">\n <img src="${o}" alt="${n}" />\n </div>\n <img class="ad-sponsored-by" src="${i}" alt="${r}" />\n </div>\n <div class="ad-text-container">\n <span class="ad-annonse-label">Annonse fra ${r}</span>\n <h6 class="ad-title">${n}</h6>\n </div>\n </div>\n </a> \n </article>`},lo={default:ro.VIDEO},co={displayTemplates:{content:so.CONTENT,basic:so.BASIC,recirc:so.RECIRC,sponsorstripe:ro.SPONSORSTRIPE,native:oo.NATIVE_TEMPLATE,native_recirc:oo.NATIVE_RECIRC,default:so.BASIC},videoTemplates:lo},uo={displayTemplates:{content:ao.CONTENT,basic:ao.BASIC,native:oo.NATIVE_TEMPLATE,native_recirc:oo.NATIVE_RECIRC,default:ao.BASIC},videoTemplates:lo},vo={get:e=>{try{const t=sessionStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return j(`sessionStorageClient.get: Error during getting data from sessionStorage: ${e}`),null}},set:(e,t)=>{try{sessionStorage.setItem(e,JSON.stringify(t))}catch(e){j(`sessionStorageClient.set: Error during saving data to sessionStorage: ${e}`)}},remove:e=>{try{sessionStorage.removeItem(e)}catch(e){j(`sessionStorageClient.remove: Error during remove data from sessionStorage: ${e}`)}}},po="finn_blink_id",go=e=>c(void 0,void 0,void 0,function*(){const{id:t,hashed_email:n,theme:i}=e,r=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}(e,["id","hashed_email","theme"]),o=window[k.Blink];if(!o)return;const s=new o({remote:"https://www.finn.no/distribution-front/external/carousel",id:t,hashed_email:n,theme:i});yield s.inject(r)}),ho=e=>{var t,n;const i=document.querySelector(`[id^="${e}"]`);return null!==(n=null===(t=null==i?void 0:i.dataset)||void 0===t?void 0:t.finnBlinkId)&&void 0!==n?n:e},mo=(e,t)=>{const{finnBlink:{enabled:n}={}}=d.get(),i=(null==t?void 0:t.enabled)||(e=>{var t;const n=document.querySelector(`[id^="${e}"]`);return!!(null===(t=null==n?void 0:n.dataset)||void 0===t?void 0:t.noBidAd)})(e);if(!i||!n)return null;const{limit:r,height:o,requireImage:s,theme:a,rec:l,distributionTypes:c,position:u,offset:v,advertoryTheme:p}=t||{};return{selector:`#${ho(e)}`,enabled:i,position:null!=u?u:e,distributionTypes:null!=c?c:[],limit:null!=r?r:100,height:null!=o?o:100,offset:null!=v?v:200,requireImage:s,rec:l,theme:"dark"===a?"dark":"light",advertoryTheme:p}},yo=(e,t,n)=>c(void 0,void 0,void 0,function*(){const{placements:i,deviceType:r}=d.get();j(`rendering finn blink ad for ${e}`);const o=q(e),s=i[r].find(e=>e.id===o),a=mo(e,null==s?void 0:s.finnBlink),{publisher:l,country:u,finnBlink:v}=t,{userId:p,uuid:g,channel:h,theme:m}=null!=v?v:{},y=null!=h?h:`${l}.${u}`,f=(e=>{if(!e){const e=$e();return null!=e?e:""}return e})(p),w="dark"===m?"dark":"light";if(!(null==a?void 0:a.enabled))return j(`Finn blink is not enabled on placement: ${e}`),n&&n(e),void tr(e);if((e=>{var t;const n=ho(e),i=document.querySelector(`[id^="${n}"]`);return!!(null===(t=null==i?void 0:i.classList)||void 0===t?void 0:t.contains("finn"))})(e))j(`Finn blink already loaded ${e}`);else try{const e=yield c(void 0,void 0,void 0,function*(){const{finnBlink:{identifierUrl:e}={}}=d.get(),t=vo.get(po),n=fe("finncode");if(!e||n)return"";if(!t){const t=yield Xe.get(e,{credentials:"include"}),{finn_blink_id:n}=t;if(!n)throw new Error("getFinnBlinkIdentifier: No finn_blink_id found");return vo.set(po,n),n}return t});yield go(Object.assign(Object.assign({},a),{hashed_email:e,channel:y,id:f,theme:w,uuid:g})).then(()=>{((e,t)=>{const{siteSpecificConfig:{publisherClassName:n}={},pageType:i}=d.get(),r=document.querySelector(`#${e}`);if(!r)return;if(r.classList.add("disable-cogwheel"),!n)return;P(n,r,x,null!=t?t:i),Wi({preferredTestIdData:{targetId:e,testId:"finn"}})})(a.selector.replace("#",""),a.advertoryTheme)})}catch(t){j(`Finn blink error ${t}`),n&&n(e),!n&&T(e),tr(e)}}),fo=((e,t)=>n=>Fr(Object.assign(Object.assign({},n),{siteSpecificConfig:t}),e))({initNativeAd:(e,t)=>{const{targetId:n}=e,i=document.querySelector(`#${n}`),r=(null==t?void 0:t.pageType)===pt.FRONT?uo:co;if(!i)return;const{pageType:o=pt.FRONT,nativeTrackingConfig:s,appearanceConfig:a,deviceType:d}=null!=t?t:{},l={language:he.NO,publisher:be.E24,deviceType:d,pageType:o,nativeTrackingConfig:s,appearanceConfig:a};Qr(e,l,r)},wallpaperHandlers:{initWallpaperAd:(e,t)=>{if(!t)return;const{options:{appMainContainerSelector:n,wallpaperAnchorSelector:i}={}}=t;(e=>{const t=document.querySelector(e||"#application");if(!t)return;w();const n=document.createElement("div");n.classList.add(y),document.body.insertBefore(n,t.nextSibling),n.style.setProperty("position","fixed"),n.style.setProperty("width","100%"),n.style.setProperty("height","calc(100% - var(--header-height, 0) - 15px)"),n.style.setProperty("background-position","center top"),n.style.setProperty("background-repeat","no-repeat")})(n),(e=>{const t=e||".advertory-wrapper-common-skyscraperleft_1",n=document.querySelector(t);n&&(b(n),window.addEventListener("scroll",()=>b(n)))})(i),e()},adjustAdToHorseshoe:e=>{var t;const n=document.querySelector(`#${e}`);n&&(null===(t=n.parentElement)||void 0===t||t.classList.add(f),n.classList.add(f))}},loadFinnBlinkAd:(e,t,n,i)=>c(void 0,void 0,void 0,function*(){const{isMobileApp:r}=d.get();if(j(`loadFinnBlinkAd: loading finn blink ad for ${e}`),!(yield c(void 0,void 0,void 0,function*(){const{tcf:e,isMobileApp:t,country:n}=d.get(),{getConsentAsync:i}=Oe(e,t,n),r=yield i();return!(!(null==e?void 0:e.enabled)||!r)||(j("Skip loading finn blink ad due to missing TCF consent."),!1)}))||r)return n&&n(e),void tr(e);yield S(O),yield yo(e,t,n),i&&i()}),replaceAdsWithFinnBlink:e=>c(void 0,void 0,void 0,function*(){if(!e)return;yield S(O);const{replacementConfig:t}=e;if(!((()=>{const e=document.getElementById("ads-advertory-anchor");return!(e&&"none"!==getComputedStyle(e).display&&window.advertoryFluepapir)})()&&(null==t?void 0:t.adsToReplace)&&(null==t?void 0:t.sizes)&&e.enabled))return void j(`Finn blink configuration is incorrect: ${JSON.stringify(t)}`);const{adsToReplace:n,sizes:i}=t;n.forEach(([e,t])=>{const n=document.querySelector(`[id^="${e}"]`);if(!n)return;const i=D(t);(e=>{j(`Hiding old ad container: ${e.id}`),e.style.setProperty("display","none","important")})(n),M(n,i),n.dataset.finnBlinkId=t,A().withFullAdsChain(e)})}),preparePageOptions:ht,prepareTag:e=>{const{keywords:t,targetId:n,invCode:i}=e,{useAppTabletInvCode:r=!0}=d.get(),o=((e,t)=>{const{isMobileApp:n}=d.get();return n?((e,t)=>e.replace(/wtb|wde|wph/g,e=>"wph"===e?"aph":t?"atb":e))(e,t):e})(i,r),s=(e=>{const{keywords:t,dynamicSizeWidthCheck:n}=e,i=`${me()}-adformat`,r=t?t[i]:[];if(!r)return{};const o=(Array.isArray(r)?r:[r]).filter(e=>!(e in G)||window.innerWidth>=G[e]);return{[i]:n?o:r}})(e),a=(e=>{const t=`${me()}-targetid`;return e?{[t]:[e]}:{}})(n),l=we(),c=(e=>Ie(e)?{"aa-sch-dynamic-outstream":["true"]}:{})(i),u=((e,t)=>Ie(e)?Object.assign(Object.assign({},t),{playerSkin:{videoBackgroundColor:"#e6e7e8"}}):{})(i);return Object.assign(Object.assign({},e),{invCode:o,keywords:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t),s),a),c),l),rendererOptions:u})},siteEvents:ge,librariesToLoad:[]},{publisherClassName:be.E24,fullWidthFormatClassName:"netboard",mainColumnWidth:580});var wo=Object.freeze({__proto__:null,default:""});export{fo as initAdvertoryPackage,Br as updateAdvertory};