(()=>{"use strict";var e,t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};t.r(n),t.d(n,{ALL:()=>v,DEBUG:()=>w,ERROR:()=>k,FATAL:()=>I,INFO:()=>x,OFF:()=>E,TRACE:()=>b,WARN:()=>S}),function(e){e.fatal="fatal",e.error="error",e.warning="warning",e.log="log",e.info="info",e.debug="debug",e.critical="critical"}(e||(e={}));const r=/^\s*at (?:(.*?) ?\()?((?:file|https?|blob|chrome-extension|address|native|eval|webpack||[-a-z]+:|.*bundle|\/).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,o=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:file|https?|blob|chrome|webpack|resource|moz-extension).*?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js))(?::(\d+))?(?::(\d+))?\s*$/i,s=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i,i="?",a=/^(?:(\w+):)\/\/(?:([\w-]+)(?::(\w+))?@)([\w.-]+)(?::(\d+))?\/(.+)/;function c(e){return(e&&e.message||"No error message").split("\n").filter((e=>!!e))[0]}function l(e){try{const t=function(e){if(!e.stack)return null;const t=[],n=e.stack.split("\n");let a,l;for(let c=0;c{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})),sdk:{name:"micro-sentry.javascript.core",version:"0.0.0"},timestamp:Date.now()/1e3,environment:this.environment}}}function d(e,t){return"[object RegExp]"===Object.prototype.toString.call(t)?t.test(e):"string"==typeof t&&-1!==e.indexOf(t)}function p(){return window}class f extends u{constructor(e,t=p()){super(e),this.options=e,this.window=t,this.destroyed=!1,this._state={};const{plugins:n=[],beforeSend:r=(e=>e),beforeBreadcrumb:o=(e=>e),blacklistUrls:s=[],ignoreErrors:i=[],release:a}=this.options||{};this.plugins=n.map((e=>new e(this))),this.beforeSend=r,this.beforeBreadcrumb=o,this.blacklistUrls=s,this.ignoreErrors=i,this.release=a}get state(){return this._state}clearState(){this._state={}}setTags(e){return this.setKeyState("tags",{...e}),this}setTag(e,t){return this.extendState({tags:{[e]:t}}),this}setExtra(e,t){return this.extendState({extra:{[e]:t}}),this}setExtras(e){return this.setKeyState("extra",{...e}),this}setUser(e){return this.setKeyState("user",{...e}),this}clone(){const e=new f({...this.options,plugins:[]});return e.extendState(this.state),e}withScope(e){const t=this.clone();e(t),t.destroy(),this.setBreadcrumbs(void 0)}addBreadcrumb(e){this.extendState({breadcrumbs:[{timestamp:Date.now()/1e3,...this.beforeBreadcrumb(e)}]})}setBreadcrumbs(e){this.setKeyState("breadcrumbs",e)}captureMessage(e,t){this.send({...this.getRequestBlank(),message:e,level:t})}destroy(){this.destroyed=!0,this.plugins.forEach((e=>{e.destroy&&e.destroy()}))}isIgnoredError(e){return!!this.ignoreErrors.length&&this.getPossibleEventMessages(e).some((e=>this.ignoreErrors.some((t=>d(e,t)))))}getRequestBlank(){return{request:{url:this.window.location.toString(),headers:{"User-Agent":this.window.navigator.userAgent}},...super.getRequestBlank(),sdk:{name:"micro-sentry.javascript.browser",version:"0.0.0"},...this.state}}send(e){this.destroyed||this.isDeniedUrl(e)||this.isIgnoredError(e)||(super.send(this.beforeSend({release:this.release,...e})),this.setBreadcrumbs(void 0))}getPossibleEventMessages(e){if(e.message)return[e.message];if(e.exception)try{const{type:t="",value:n=""}=e.exception.values&&e.exception.values[0]||{};return[`${n}`,`${t}: ${n}`]}catch(e){return[]}return[]}isDeniedUrl(e){if(!this.blacklistUrls.length)return!1;const t=this.getEventFilterUrl(e);return!!t&&this.blacklistUrls.some((e=>d(t,e)))}getEventFilterUrl(e){try{if(e.exception){const t=e.exception.values&&e.exception.values[0].stacktrace&&e.exception.values[0].stacktrace.frames;return t&&t[t.length-1].filename||null}return null}catch(e){return null}}extendState(e){this._state=Object.keys(e).reduce(((t,n)=>{const r=this._state[n],o=Array.isArray(r)?r:null,s=e[n],i=Array.isArray(s)?s:null;return{...t,[n]:o||i?[...o||[],...i||[]]:{..."string"!=typeof r?r:{},..."string"!=typeof s?s:{}}}}),this._state)}setKeyState(e,t){this._state[e]=t}}var m,g;!function(e){e.SENTRY_NOT_CONFIGURED="sentry_not_configured"}(m||(m={})),function(e){e.websdk="websdk",e.osm="osm-client-script",e.identitySdk="identity-sdk"}(g||(g={}));const h={create:function(e,t){(new e.Image).src=t}},y={create:function(e,t,n){e.navigator.sendBeacon(t,JSON.stringify(n))}};var v=0,b=0,w=1,x=2,S=3,k=4,I=5,E=6,U=Object.assign||function(e){for(var t=1;t{i(n,r={},o={})=>e(n,r,o,t);return{configure:({options:t,data:n={},instanceId:o})=>{r=n,T[e]||(T[e]=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:window;if("object"!==(void 0===e?"undefined":j(e))||!e)throw new TypeError("expected configuration object");var n=e.baseUrl,r=void 0===n?"https://eu.klarnaevt.com":n,o=e.client,s=e.clientVersion,i=e.sessionId,a=e.commonData,c=void 0===a?{}:a,l=e.instanceId,u=void 0===l?Math.floor(9e3*Math.random())+1e3:l,d=e.logLevel||v;if("string"!=typeof o)throw new TypeError("expected `client` in the configuration object");if("string"!=typeof s)throw new TypeError("expected `clientVersion` in the configuration object");if("string"!=typeof i)throw new TypeError("expected `sessionId` in the configuration object");if("number"!=typeof d||dE)throw new TypeError("invalid `logLevel` ("+d+")");function p(e){return Object.keys(e).sort().map((function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])})).join("&")}function f(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=arguments[2];if(!(d>(arguments.length>3&&void 0!==arguments[3]?arguments[3]:v))){if(!e)throw new TypeError("expected `name` as first parameter");var l=function(e,t){return""+r+K+o+"/"+s+"/"+e+"?"+p(t)}(e,n=U({},c,n,{iid:u,sid:i,timestamp:n.timestamp||(new Date).getTime()}));try{y.create(t,l,a)}catch(e){a&&(l+="&"+p(a)),h.create(t,l)}}}return{event:f,trace:function(e,t,n){f(e,t,n,b)},debug:function(e,t,n){f(e,t,n,w)},info:function(e,t,n){f(e,t,n,x)},warn:function(e,t,n){f(e,t,n,S)},error:function(e,t,n){f(e,t,n,k)},fatal:function(e,t,n){f(e,t,n,I)},setLogLevel:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;if("number"!=typeof e||eE)throw new TypeError("invalid `logLevel` ("+e+")");d=e},getConfig:function(){return{baseUrl:r,client:o,clientVersion:s,sessionId:i,instanceId:u,logLevel:d}}}}(D({...t,instanceId:o})))},event:o,trace:s(o,b),debug:s(o,w),info:s(o,x),warn:s(o,S),error:s(o,k),fatal:s(o,I),setLogLevel(r="ALL"){try{const o=r.toUpperCase();t=o in n?n[o]:v,T[e]&&T[e].setLogLevel(t)}catch(e){}},removeInstance(){T[e]&&delete T[e]}}}const D=({client:e="sdk",clientVersion:t="",sessionId:n="",instanceId:r,baseUrl:o=""})=>({client:e,clientVersion:t,environment:"production",sessionId:n,instanceId:r,baseUrl:o});var R;!function(e){e.sessionStorageNotSupported="sessionStorage-not-supported",e.localStorageNotSupported="localStorage-not-supported",e.dynamicImportFailed="dynamic-import-failed",e.multipleCustomElementsWithSameTagName="multiple-custom-elements-same-tag-name",e.unexpectedTokenMethodParamsList="unexpected-token-method-params-list",e.missingColonAfterPropertyId="missing-colon-after-property-id",e.unexpectedTokenEqual="unexpected-token-equal",e.expectedExpressionGotEqual="expected-expression-got-equal"}(R||(R={}));const _=["https://s3.int.klarna.net","https://js.klarna.com","https://x.klarnacdn.net","https://x.nonprod.us1.js.klarna.net","https://osm.klarnaservices.com","https://eu-assets.playground.klarnaservices.com","https://na-assets.playground.klarnaservices.com","https://ap-assets.playground.klarnaservices.com"],N=e=>100*Math.random(){},setTag:()=>{}},C=({version:e,environment:t,tags:n})=>("staging"===t?L=V:L||(L=new f({dsn:"https://6fdc8e6e634d4a998b6f0dbfd7b025e1@o24547.ingest.sentry.io/4505471301713920",release:e,environment:t,beforeSend:e=>{e.exception?.values?.forEach((({value:t})=>{e.fingerprint=(e=>{switch(e){case"Storage type: sessionStorage not supported":return[R.sessionStorageNotSupported];case"Storage type: localStorage not supported":return[R.localStorageNotSupported];case"Cannot define multiple custom elements with the same tag name":return[R.multipleCustomElementsWithSameTagName];case"Unexpected token ';'. Expected an opening '(' before a method's parameter list.":return[R.unexpectedTokenMethodParamsList];case e.match(/Failed to fetch dynamically imported module/)?.input:return[R.dynamicImportFailed];case e.match("missing : after property id")?.input:return[R.missingColonAfterPropertyId];case e.match("Unexpected token '='")?.input:return[R.unexpectedTokenEqual];case e.match("expected expression, got '='")?.input:return[R.expectedExpressionGotEqual];case e.match(/error loading dynamically imported module/)?.input:return[R.dynamicImportFailed]}})(t)}));const t=(e=>{let t=!0;return e.exception?.values?.forEach((({stacktrace:e})=>{e?.frames?.forEach((({filename:e})=>{var n;n=e,t=!_.some((e=>n.startsWith(e)))}))})),t?null:e})(e);return t?(e=>{let t=!0;return e.exception?.values?.forEach((({value:e})=>{A.forEach((n=>{e.includes(n)&&(t=N(5))}))})),t?e:null})(t):null},blacklistUrls:[/pagead\/js/i,/graph\.facebook\.com/i,/connect\.facebook\.net\/en_US\/all\.js/i,/extensions\//i,/^chrome:\/\//i,/metrics\.itunes\.apple\.com\.edgesuite\.net\//i]})),n&&Object.entries(n).forEach((([e,t])=>{t&&L.setTag(e,t.toString())})),L);function P(e){const t="string"==typeof e?new Error(e):e;(L||(((e,t,n=g.websdk)=>{const r=O(n);try{r.event("error",{message:t,name_1:e})}catch{}})(m.SENTRY_NOT_CONFIGURED,"Sentry client not initialized"),V)).report(t)}var $;!function(e){e.localStorage="localStorage",e.sessionStorage="sessionStorage",e.klarnaIframeStorage="klarnaIframeStorage"}($||($={}));const M=e=>{const t=`__klarna_sdk_${e}`;try{return function(e,t=window){if(!t?.localStorage)throw new Error(`client does not support ${$.localStorage}`);const n=()=>JSON.parse(t.localStorage.getItem(e)||"{}"),r={get:e=>{const t=n(),o=t?.[e];if(!o)return null;const s=t?.ttl;return s&&s{const s=n();return null===o?delete s[r]:s[r]=o,t.localStorage.setItem(e,JSON.stringify(s))},remove:e=>r.set(e,null),flush:()=>t.localStorage.removeItem(e)};return r}(t)}catch{P("Storage type: localStorage not supported")}},q="version",F={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let B;const W=new Uint8Array(16);function G(){if(!B&&(B="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!B))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return B(W)}const H=[];for(let e=0;e<256;++e)H.push((e+256).toString(16).slice(1));const J=function(e,t,n){if(F.randomUUID&&!t&&!e)return F.randomUUID();const r=(e=e||{}).random||(e.rng||G)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(let e=0;e<16;++e)t[n+e]=r[e];return t}return function(e,t=0){return H[e[t+0]]+H[e[t+1]]+H[e[t+2]]+H[e[t+3]]+"-"+H[e[t+4]]+H[e[t+5]]+"-"+H[e[t+6]]+H[e[t+7]]+"-"+H[e[t+8]]+H[e[t+9]]+"-"+H[e[t+10]]+H[e[t+11]]+H[e[t+12]]+H[e[t+13]]+H[e[t+14]]+H[e[t+15]]}(r)};function z(){const e=new CustomEvent("OSM:refresh");return document.dispatchEvent(e),null}const X=[];class Y extends Array{constructor(){super(...arguments),this.refresh=z}pop(){return X.pop()}push(e){return X.push(e),X.length}}const Q=async({accountId:e,clientId:t,clientToken:n,version:r,environment:o,additionalIdentifier:s,instanceId:i="default"})=>{if(!t&&!n)throw new Error("Missing `client-id` attribute that is required for the SDK to work");if(!["production","playground","staging"].includes(o))throw new Error('Only "production", "playground" and "staging" environments are supported');let a,c=r,l="https://js.klarna.com/web-sdk/";const u=J(),d=(e=>{const t={...e};return Object.keys(t).forEach((e=>void 0===t[e]?delete t[e]:{})),t})({accountId:e,clientId:t,clientToken:n,instanceId:i,additionalIdentifier:s}),p={...d,product:"entrypoint",sessionId:u},f=O(g.websdk);f.configure({options:{sessionId:"",client:g.websdk,clientVersion:c},data:p});try{c?(a={lib:{defaultVersion:c}},l+=(e=>new RegExp("^([0-9]|[1-9][0-9]*).([0-9]|[1-9][0-9]*).([0-9]|[1-9][0-9]*)?$").test(e))(c)?`v1/${c}/`:`${c}/`):(a=await(async(e,t="production")=>{const n="production"===t?"runtime-config":`runtime-config-${t}`;try{const t=await fetch(`${e}config/${n}.json`);if(!t.ok)throw new Error(`Failed to fetch configuration. Server responded with status ${t.status}: ${t.statusText}`);return await t.json()}catch(e){return null}})("https://js.klarna.com/web-sdk/",o),c=(e=>{if(!e)throw new Error("Missing runtime config");try{const t=M(q);e.lib.defaultVersion!==e.lib.canaryVersion&&"true"!==e.lib.flushVersion||(t.remove("version"),t.remove("rolloutVariant"),t.remove("ttl"));const n=t.get("version");if(n)return n;{const t=(({defaultVersion:e,canaryVersion:t,canaryWeight:n,ttl:r=86400})=>{const o=M(q),s=Date.now()+1e3*r;return o.set("ttl",s.toString()),N(100*n)?N(50)?(o.set("rolloutVariant","canary"),o.set("version",t),t):(o.set("rolloutVariant","control"),o.set("version",e),e):(o.set("rolloutVariant","none"),o.set("version",e),e)})(e.lib);if(t)return t;throw new Error("Failed to set rollout and version")}}catch(t){if(e.lib.defaultVersion)return e.lib.defaultVersion;throw new Error(`Failed to get version: ${t.message}`)}})(a),l+=`v1/${c}/`),C({environment:o,version:c,tags:p});const e=`${l}sdk.js`,{default:t}=await import(e);return new t({...d,baseUrl:l,version:c,environment:o,sessionId:u,runtimeConfig:a}).getPublicAPI()}catch(e){f.event("metric_fallback_script_loaded",{message:e?.message});try{const e="https://js.klarna.com/web-sdk/v1/fallback/",t=`${e}sdk.js`,{default:n}=await import(t);return new n({...d,baseUrl:e,version:"fallback",environment:o,sessionId:u,runtimeConfig:a}).getPublicAPI()}catch(e){throw P(e),new Error("Failed to load the main SDK and the fallback SDK. CDN URL might be incorrect")}}};(async function(e=window){e.Klarna=e.Klarna||{};const t=((e=document)=>e?.currentScript??e?.scripts?.[e?.scripts?.length-1])(),{accountId:n,clientId:r,clientKey:o,clientToken:s,version:i,additionalIdentifier:a}=t?.dataset||{},c=t?.dataset?.environment||"production",l=r||o,u=new URL(t?.src),d=u?.searchParams?.get("ready"),p=e[d??"KlarnaSDKCallback"]??e.KlarnaSDKCallback;if(l||s){const{isWebSDKAvailable:t}=((e=window)=>{const t=!!e.Klarna,n=!!(e=>e.Klarna&&e.Klarna.Credit&&e.Klarna.DirectBankTransfer&&e.Klarna.DirectDebit&&e.Klarna.Payments)(e),r=!!(e=>e.Klarna&&e.Klarna.Identity&&e.Klarna.Messaging&&e.Klarna.OnsiteMessaging&&e.Klarna.Payment)(e);return{isKlarnaNamespaceAvailable:t,isKPLibAvailable:n,isWebSDKAvailable:r}})(e);if((e=>{e.KlarnaOnsiteService=new Y,e.kudt=e.KlarnaOnsiteService,e.OnsiteMessaging={refresh:z,eventListeners:{},on:()=>{}}})(e),t)return void("function"==typeof p&&p(e.Klarna));const r=await Q({accountId:n,clientId:l,clientToken:s,version:i,environment:c,additionalIdentifier:a});e.Klarna=Object.assign(r,e.Klarna),"function"==typeof p&&p(e.Klarna)}else try{e.Klarna.init=({accountId:e,clientId:t,clientToken:n,version:r,environment:o,instanceId:s,additionalIdentifier:i})=>Q({accountId:e,clientId:t,clientToken:n,version:r,environment:o,instanceId:s,additionalIdentifier:i})}catch(e){throw new Error("Klarna Web SDK init failed: ",{cause:e})}})().catch((()=>{}))})();