PageSourceSearch

https://auth.realmforge.ai/apps/hosted-authkit/production/_next/static/chunks/a36a47da.bbcddd304c1305d7.js

js realmforge.ai collected 2026-10-05 12:30:19 UTC 99,980 bytes, 2 lines download raw bytes

1!function(){try{var e="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="b0ff83ef-b078-4174-a425-3c993a5b27e7",e._sentryDebugIdIdentifier="sentry-dbid-b0ff83ef-b078-4174-a425-3c993a5b27e7")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8782],{71061:(e,t,r)=>{function i(e){return null!=e&&"object"==typeof e&&!0===e["@@functional/placeholder"]}function n(e){return function t(r){return 0==arguments.length||i(r)?t:e.apply(this,arguments)}}function s(e){return function t(r,s){switch(arguments.length){case 0:return t;case 1:return i(r)?t:n(function(t){return e(r,t)});default:return i(r)&&i(s)?t:i(r)?n(function(t){return e(t,s)}):i(s)?n(function(t){return e(r,t)}):e(r,s)}}}function o(e){return function t(r,o,a){switch(arguments.length){case 0:return t;case 1:return i(r)?t:s(function(t,i){return e(r,t,i)});case 2:return i(r)&&i(o)?t:i(r)?s(function(t,r){return e(t,o,r)}):i(o)?s(function(t,i){return e(r,t,i)}):n(function(t){return e(r,o,t)});default:return i(r)&&i(o)&&i(a)?t:i(r)&&i(o)?s(function(t,r){return e(t,r,a)}):i(r)&&i(a)?s(function(t,r){return e(t,o,r)}):i(o)&&i(a)?s(function(t,i){return e(r,t,i)}):i(r)?n(function(t){return e(t,o,a)}):i(o)?n(function(t){return e(r,t,a)}):i(a)?n(function(t){return e(r,o,t)}):e(r,o,a)}}}function a(e,t){return Object.prototype.hasOwnProperty.call(t,e)}r.d(t,{RudderAnalytics:()=>rH});var l,u,c,d=n(function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)});function g(e){return"[object Object]"===Object.prototype.toString.call(e)}let h=Number.isInteger||function(e){return(0|e)===e};var p=function(){function e(){this.map={},this.length=0}return e.prototype.set=function(e,t){var r=this.hash(e),i=this.map[r];i||(this.map[r]=i=[]),i.push([e,t]),this.length+=1},e.prototype.hash=function(e){var t=[];for(var r in e)t.push(Object.prototype.toString.call(e[r]));return t.join()},e.prototype.get=function(e){if(this.length<=180){for(var t in this.map)for(var r=this.map[t],i=0;i<r.length;i+=1){var n=r[i];if(n[0]===e)return n[1]}return}var s=this.hash(e),r=this.map[s];if(r)for(var i=0;i<r.length;i+=1){var n=r[i];if(n[0]===e)return n[1]}},e}(),v=n(function(e){return null!=e&&"function"==typeof e.clone?e.clone():function e(t,r,i){if(i||(i=new p),s=typeof(n=t),null==n||"object"!=s&&"function"!=s)return t;var n,s,o=function(r){var n=i.get(t);if(n)return n;for(var s in i.set(t,r),t)Object.prototype.hasOwnProperty.call(t,s)&&(r[s]=e(t[s],!0,i));return r};switch(d(t)){case"Object":return o(Object.create(Object.getPrototypeOf(t)));case"Array":return o(Array(t.length));case"Date":return new Date(t.valueOf());case"RegExp":return new RegExp(t.source,t.flags?t.flags:(t.global?"g":"")+(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.sticky?"y":"")+(t.unicode?"u":"")+(t.dotAll?"s":""));case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":return t.slice();default:return t}}(e)}),f=o(function(e,t,r){var i,n={};for(i in r=r||{},t=t||{})a(i,t)&&(n[i]=a(i,r)?e(i,t[i],r[i]):t[i]);for(i in r)a(i,r)&&!a(i,n)&&(n[i]=r[i]);return n}),y=o(function e(t,r,i){return f(function(r,i,n){return g(i)&&g(n)?e(t,i,n):t(r,i,n)},r,i)}),m=o(function(e,t,r){return y(function(t,r,i){return e(r,i)},t,r)}),b=s(function(e,t){for(var r=t,i=0;i<e.length;i+=1){if(null==r)return;var n=e[i];r=h(n)?function(e,t){var r=e<0?t.length+e:e;return"[object String]"===Object.prototype.toString.call(t)?t.charAt(r):t[r]}(n,r):r[n]}return r}),E=s(function(e,t){var r={};for(var i in t)e(t[i],i,t)&&(r[i]=t[i]);return r});let k=e=>"function"==typeof e&&!!(e.constructor&&e.call&&e.apply),S=e=>void 0!==e,I=e=>{let t;return null!=(t=e)},T=(e,t)=>b(t.split("."),e),A=e=>null!==e&&"[object Object]"===Object.prototype.toString.call(e),w=(e,t)=>{if(!Array.isArray(e)||!Array.isArray(t))return v(t);let r=v(e);return t.forEach((e,t)=>{let i;r[t]=Array.isArray(e)||null!==(i=e)&&"object"==typeof i&&!Array.isArray(i)?P(r[t],e):e}),r},P=(e,t)=>m(w,e,t),C=e=>A(e)&&Object.keys(e).length>0,R=e=>{let t=E(S,e);
1return Object.keys(t).forEach(e=>{let r=t[e];A(r)&&(t[e]=R(r))}),t},D=e=>{let t=E(I,e);return Object.keys(t).forEach(e=>{let r=t[e];A(r)&&(t[e]=D(r))}),t},O=e=>{let t,r=e;if("string"!=typeof e&&null!=(t=e))try{r=JSON.stringify(e)}catch(e){r=null}return r},$=(e,t,r,i,n)=>{let s={category:e,name:t,properties:r,options:i,callback:void 0};k(n)&&(s.callback=n),k(i)&&(s.category=e,s.name=t,s.properties=r,s.options=void 0,s.callback=i),k(r)&&(s.category=e,s.name=t,s.properties=void 0,s.options=void 0,s.callback=r),k(t)&&(s.category=e,s.name=void 0,s.properties=void 0,s.options=void 0,s.callback=t),k(e)&&(s.category=void 0,s.name=void 0,s.properties=void 0,s.options=void 0,s.callback=e),A(e)?(s.name=void 0,s.category=void 0,s.properties=e,k(t)?s.options=void 0:s.options=t):A(t)&&(s.name=void 0,s.properties=t,k(r)?s.options=void 0:s.options=r),"string"==typeof e&&"string"!=typeof t&&(s.category=void 0,s.name=e),S(s.category)||(s.category=void 0),S(s.name)||(s.name=void 0),s.properties=s.properties?v(s.properties):{},S(s.options)?s.options=v(s.options):s.options=void 0;let o="string"==typeof s.name?s.name:s.properties.name,a="string"==typeof s.category?s.category:s.properties.category;return s.properties=P(A(s.properties)?s.properties:{},{...o&&{name:o},...a&&{category:a}}),s},L=(e,t,r,i)=>{let n={name:e,properties:t,options:r,callback:void 0};return k(i)&&(n.callback=i),k(r)&&(n.properties=t,n.options=void 0,n.callback=r),k(t)&&(n.properties=void 0,n.options=void 0,n.callback=t),n.properties=I(n.properties)?v(n.properties):{},S(n.options)?n.options=v(n.options):n.options=void 0,n},M=(e,t,r,i)=>{let n={userId:e,traits:t,options:r,callback:void 0};return k(i)&&(n.callback=i),k(r)&&(n.userId=e,n.traits=t,n.options=void 0,n.callback=r),k(t)&&(n.userId=e,n.traits=void 0,n.options=void 0,n.callback=t),(A(e)||null===e)&&(n.userId=null,n.traits=e,k(t)?n.options=void 0:n.options=t),n.userId=O(n.userId),A(n.traits)?n.traits=v(n.traits):n.traits=void 0,S(n.options)?n.options=v(n.options):n.options=void 0,n},B=(e,t,r,i)=>{let n={to:e,from:t,options:r,callback:void 0};return(k(i)&&(n.callback=i),k(r)&&(n.to=e,n.from=t,n.options=void 0,n.callback=r),k(t))?(n.to=e,n.from=void 0,n.options=void 0,n.callback=t):(A(t)||null===t)&&(n.to=e,n.from=void 0,n.options=t),S(n.to)&&(n.to=O(n.to)),S(n.from)?n.from=O(n.from):n.from=void 0,S(n.options)?n.options=v(n.options):n.options=void 0,n},N=(e,t,r,i)=>{let n={groupId:e,traits:t,options:r,callback:void 0};return k(i)&&(n.callback=i),k(r)&&(n.groupId=e,n.traits=t,n.options=void 0,n.callback=r),k(t)&&(n.groupId=e,n.traits=void 0,n.options=void 0,n.callback=t),(A(e)||null===e)&&(n.groupId=null,n.traits=e,k(t)?n.options=void 0:n.options=t),n.groupId=O(n.groupId),A(n.traits)?n.traits=v(n.traits):n.traits=void 0,S(n.options)?n.options=v(n.options):n.options=void 0,n},U=((V={}).LOADED="Page Loaded",V.UNLOADED="Page Unloaded",V),x="CapabilitiesManager",j="ConfigManager",H="EventManager",_="PluginsManager",F="UserSessionManager",Q="ErrorHandler",G="PluginEngine",z="StoreManager",K="AnalyticsCore";for(var V,q,W=[],J=0;J<256;J++)W[J]=(J+256).toString(16).substring(1);for(var X,Z=256,Y=[];Z--;)Y[Z]=(Z+256).toString(16).substring(1);let ee=()=>{let e;if(null!=(e=globalThis.crypto)&&k(globalThis.crypto.getRandomValues)){(!q||J+16>4096)&&(q=crypto.getRandomValues(new Uint8Array(4096)),J=0);for(var t,r=0,i="";r<16;r++)t=q[J+r],6==r?i+=W[15&t|64]:8==r?i+=W[63&t|128]:i+=W[t],1&r&&r>1&&r<11&&(i+="-");return J+=16,i}var n,s=0,o="";if(!X||Z+16>256){for(X=Array(s=256);s--;)X[s]=256*Math.random()|0;s=Z=0}for(;s<16;s++)n=X[Z+s],6==s?o+=Y[15&n|64]:8==s?o+=Y[63&n|128]:o+=Y[n],1&s&&s>1&&s<11&&(o+="-");return Z++,o},et=(e,t)=>`Failed to load the script with the id "${e}" from URL "${t}".`,er="[Circular Reference]",ei=(e,t,r,i)=>{try{let n;return JSON.stringify(e,(n=[],function(e,s){if(!r?.includes(e)){let r;if(!(t&&null==(r=s))){if("object"!=typeof s||null===s)return s;for(;n.length>0&&n[n.length-1]!==this;)n.pop();if(n.includes(s))return i?.warn(`JSONStringify:: A circular reference has been detected in the object and the property "${e}" has been dropped from the output.`),er;return n.push(s),s}}}))}catch(e){return i?.warn("Failed to convert the value to a JSON string.",e),null}},en=(e,t)=>{let r=Array.isArray(e)?[]:{};for(let i in e)if(Object.hasOwnProperty.call(e,i)){let n=e[i],s=t.call(e,i,n);A(s)||Array.isArray(s)?r[i]=en(s,t):r[i]=s}return r},es=(e,t)=>{let r,i=(r=[],function(e,t){if("bigint"==typeof t)return"[BigInt]";for(;r.length>0&&r[r.length-1]!==this;)r.pop();return r.includes(t)?er:(r.push(t),t)}),n=i.call(e,"",e);return A(e)||Array.isArray(e)?en(e,i):n},eo="[MANUAL ERROR]",ea=(e,t)=>{let r=e;return e instanceof Error?r.message=`${t}: ${e.message}`:r=Error(`${t}: ${ei(e)}`),r},el=e=>{e instanceof Error&&(e.stack=`${e.stack??""}
2${eo}`),globalThis.dispatchEvent(new ErrorEvent("error",{error:e}))},eu="RudderLabs JavaScript SDK",ec="3.11.15",ed="RudderJS-Initiated",eg="preloadedEventsBuffer",eh="ajs_aid",ep="ajs_uid",ev="ajs_event",ef=1e4,ey=(e="app")=>{globalThis.RudderStackGlobals||(globalThis.RudderStackGlobals={}),globalThis.RudderStackGlobals[e]||(globalThis.RudderStackGlobals[e]={})},em=(e,t,r="app")=>{ey(r),globalThis.RudderStackGlobals[r][e]=t},eb=(e,t="app")=>(ey(t),globalThis.RudderStackGlobals[t][e]),eE=(e,t)=>{let r={};return e.forEach((i,n)=>{n.startsWith(t)&&(r[n.substring(t.length)]=e.get(n))}),r},ek=(e,t)=>{let r,i=e.shift();if(k(t[i])){switch(i){case"page":r=$(...e);break;case"track":r=L(...e);break;case"identify":r=M(...e);break;case"alias":r=B(...e);break;case"group":r=N(...e);break;default:t[i](...e)}r&&t[i](r)}};class eS{hasErrorHandler=!1;constructor(e,t,r=1e4){this.errorHandler=e,this.logger=t,this.timeout=r,this.hasErrorHandler=!!this.errorHandler,this.onError=this.onError.bind(this)}loadJSFile(e){let{url:t,id:r,timeout:i,async:n,callback:s,extraAttributes:o}=e,a=!k(s);((e,t,r,i=!0,n)=>new Promise((s,o)=>{document.getElementById(t)&&o(Error(`A script with the id "${t}" is already loaded. Skipping the loading of this script to prevent conflicts.`));try{let a;(e=>{let t=document.getElementsByTagName("head");if(t.length>0)return t[0]?.insertBefore(e,t[0]?.firstChild);let r=document.getElementsByTagName("script");
2if(r.length>0&&r[0]?.parentNode)return r[0]?.parentNode.insertBefore(e,r[0]);let i=document.createElement("head");i.appendChild(e);let n=document.getElementsByTagName("html")[0];n?.insertBefore(i,n.firstChild)})(((e,t,r=!0,i=null,n=null,s={})=>{let o=document.createElement("script");return o.type="text/javascript",o.onload=i,o.onerror=n,o.src=e,o.id=t,o.async=r,Object.keys(s).forEach(e=>{o.setAttribute(e,s[e])}),o.setAttribute("data-loader","RS_JS_SDK"),o})(e,t,i,()=>{globalThis.clearTimeout(a),s(t)},()=>{globalThis.clearTimeout(a),o(Error(et(t,e)))},n)),a=globalThis.setTimeout(()=>{o(Error(`A timeout of ${r} ms occurred while trying to load the script with id "${t}" from URL "${e}".`))},r)}catch(r){o(ea(r,et(t,e)))}}))(t,r,i||this.timeout,n,o).then(e=>{a||s(e)}).catch(e=>{this.onError(e),a||s()})}onError(e){if(this.hasErrorHandler)this.errorHandler?.onError(e,"ExternalSrcLoader");else throw e}}var eI=Symbol.for("preact-signals");function eT(){if(eC>1)eC--;else{for(var e,t=!1;void 0!==eP;){var r=eP;for(eP=void 0,eR++;void 0!==r;){var i=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&eM(r))try{r.c()}catch(r){t||(e=r,t=!0)}r=i}}if(eR=0,eC--,t)throw e}}function eA(e){if(eC>0)return e();eC++;try{return e()}finally{eT()}}var ew=void 0,eP=void 0,eC=0,eR=0,eD=0;function eO(e){if(void 0!==ew){var t=e.n;if(void 0===t||t.t!==ew)return t={i:0,S:e,p:ew.s,n:void 0,t:ew,e:void 0,x:void 0,r:t},void 0!==ew.s&&(ew.s.n=t),ew.s=t,e.n=t,32&ew.f&&e.S(t),t;if(-1===t.i)return t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=ew.s,t.n=void 0,ew.s.n=t,ew.s=t),t}}function e$(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}function eL(e){return new e$(e)}function eM(e){for(var t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function eB(e){for(var t=e.s;void 0!==t;t=t.n){var r=t.S.n;if(void 0!==r&&(t.r=r),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function eN(e){for(var t=e.s,r=void 0;void 0!==t;){var i=t.p;-1===t.i?(t.S.U(t),void 0!==i&&(i.n=t.n),void 0!==t.n&&(t.n.p=i)):r=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=i}e.s=r}function eU(e){e$.call(this,void 0),this.x=e,this.s=void 0,this.g=eD-1,this.f=4}function ex(e){var t=e.u;if(e.u=void 0,"function"==typeof t){eC++;var r=ew;ew=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,ej(e),t}finally{ew=r,eT()}}}function ej(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ex(e)}function eH(e){if(ew!==this)throw Error("Out-of-order effect");eN(this),ew=e,this.f&=-2,8&this.f&&ej(this),eT()}function e_(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function eF(e){var t=new e_(e);try{t.c()}catch(e){throw t.d(),e}return t.d.bind(t)}e$.prototype.brand=eI,e$.prototype.h=function(){return!0},e$.prototype.S=function(e){this.t!==e&&void 0===e.e&&(e.x=this.t,void 0!==this.t&&(this.t.e=e),this.t=e)},e$.prototype.U=function(e){if(void 0!==this.t){var t=e.e,r=e.x;void 0!==t&&(t.x=r,e.e=void 0),void 0!==r&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r)}},e$.prototype.subscribe=function(e){var t=this;return eF(function(){var r=t.value,i=ew;ew=void 0;try{e(r)}finally{ew=i}})},e$.prototype.valueOf=function(){return this.value},e$.prototype.toString=function(){return this.value+""},e$.prototype.toJSON=function(){return this.value},e$.prototype.peek=function(){var e=ew;ew=void 0;try{return this.value}finally{ew=e}},Object.defineProperty(e$.prototype,"value",{get:function(){var e=eO(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(eR>100)throw Error("Cycle detected");this.v=e,this.i++,eD++,eC++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{eT()}}}}),(eU.prototype=new e$).h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f)||(this.f&=-5,this.g===eD))return!0;if(this.g=eD,this.f|=1,this.i>0&&!eM(this))return this.f&=-2,!0;var e=ew;try{eB(this),ew=this;var t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return ew=e,eN(this),this.f&=-2,!0},eU.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(var t=this.s;void 0!==t;t=t.n)t.S.S(t)}e$.prototype.S.call(this,e)},eU.prototype.U=function(e){if(void 0!==this.t&&(e$.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(var t=this.s;void 0!==t;t=t.n)t.S.U(t)}},eU.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(eU.prototype,"value",{get:function(){if(1&this.f)throw Error("Cycle detected");var e=eO(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),e_.prototype.c=function(){var e=this.S();try{if(8&this.f||void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},e_.prototype.S=function(){if(1&this.f)throw Error("Cycle detected");this.f|=1,this.f&=-9,ex(this),eB(this),eC++;var e=ew;return ew=this,eH.bind(this,e)},e_.prototype.N=function(){2&this.f||(this.f|=2,this.o=eP,eP=this)},e_.prototype.d=function(){this.f|=8,1&this.f||ej(this)};class eQ{constructor(){this.items=[]}enqueue(e){this.items.push(e)}dequeue(){return 0===this.items.length?null:this.items.shift()}isEmpty(){return 0===this.items.length}size(){return this.items.length}clear(){this.items=[]}}let eG={LOG:0,INFO:1,DEBUG:2,WARN:3,ERROR:4,NONE:5};class ez{constructor(e="LOG",t="",r=console){this.minLogLevel=eG[e],this.scope=t,this.logProvider=r}log(...e){this.outputLog("LOG",e)}info(...e){this.outputLog("INFO",e)}debug(...e){this.outputLog("DEBUG",e)}warn(...e){this.outputLog("WARN",e)}error(...e){this.outputLog("ERROR",e)}outputLog(e,t){this.minLogLevel<=eG[e]&&this.logProvider[e.toLowerCase()]?.(...this.formatLogData(t))}setScope(e){this.scope=e||this.scope}setMinLogLevel(e){this.minLogLevel=eG[e],void 0===this.minLogLevel&&(this.minLogLevel=eG.LOG)}formatLogData(e){if(Array.isArray(e)&&e.length>0){let t="%c RS SDK";this.scope&&(t=`${t} - ${this.scope}`);let r="string"==typeof e[0]?e[0].trim():"",i=[t=`${t} %c ${r}`,"font-weight: bold; background: black; color: white;","font-weight: normal;"];return"string"!=typeof e[0]&&i.push(e[0]),i.push(...e.slice(1)),i}return e}}let eK=new ez,eV=((l={}).HANDLEDEXCEPTION="handledException",l.UNHANDLEDEXCEPTION="unhandledException",l.UNHANDLEDREJECTION="unhandledPromiseRejection",l),eq=["localStorage","memoryStorage","cookieStorage","sessionStorage","none"],eW="cookieStorage",eJ="Unable to process/parse source configuration response.",eX=e=>`${e}:: Failed to notify the error.`,eZ="Failed to invoke the ready callback",eY={All:!0}
2,e0="js-integrations",e1="plugins",e2=RegExp("^(https?:\\/\\/)(((([a-zA-Z\\d]([a-zA-Z\\d-]*[a-zA-Z\\d])*)\\.)+[a-zA-Z]{2,}|localhost|((25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[0-1]?[0-9]?[0-9]?)))(\\:\\d+)?(\\/[-a-zA-Z\\d%_.~+]*)*(\\?[;&a-zA-Z\\d%_.~+=-]*)?(\\#[-a-zA-Z\\d_]*)?$"),e3="modern",e6="https://cdn.rudderlabs.com",e8=`${e6}/v3/${e3}/${e0}`,e4=`${e6}/v3/${e3}/${e1}`,e5="https://api.rudderstack.com",e9={iubenda:"IubendaConsentManager",oneTrust:"OneTrustConsentManager",ketch:"KetchConsentManager",custom:"CustomConsentManager"},e7={v3:"StorageEncryption",legacy:"StorageEncryptionLegacy"},te={xhr:"XhrQueue",beacon:"BeaconQueue"},tt=eL(v({logLevel:"ERROR",configUrl:e5,loadIntegration:!0,sessions:{autoTrack:!0,timeout:18e5},sameSiteCookie:"Lax",polyfillIfRequired:!0,integrations:eY,useBeacon:!1,beaconQueueOptions:{},destinationsQueueOptions:{},queueOptions:{},lockIntegrationsVersion:!1,lockPluginsVersion:!1,uaChTrackLevel:"none",plugins:[],useGlobalIntegrationsConfigInEvents:!1,bufferDataPlaneEventsUntilReady:!1,dataPlaneEventsBufferTimeout:1e4,storage:{encryption:{version:"v3"},migrate:!0,cookie:{}},sendAdblockPageOptions:{},useServerSideCookies:!1})),tr={},ti={},tn={},ts={autoTrack:!0,timeout:18e5},to={userId:eL(""),userTraits:eL(tr),anonymousId:eL(""),groupId:eL(""),groupTraits:eL(ti),initialReferrer:eL(""),initialReferringDomain:eL(""),sessionInfo:eL(tn),authToken:eL(null)},ta={isOnline:eL(!0),storage:{isLocalStorageAvailable:eL(!1),isCookieStorageAvailable:eL(!1),isSessionStorageAvailable:eL(!1)},isBeaconAvailable:eL(!1),isLegacyDOM:eL(!1),isUaCHAvailable:eL(!1),isCryptoAvailable:eL(!1),isIE11:eL(!1),isAdBlocked:eL(!1)},tl={isErrorReportingEnabled:eL(!1),isMetricsReportingEnabled:eL(!1),isErrorReportingPluginLoaded:eL(!1),breadcrumbs:eL([])},tu=eL(void 0),tc={activeDataplaneUrl:eL(void 0),integrationsCDNPath:eL(e8),pluginsCDNPath:eL(e4),sourceConfigUrl:eL(void 0),status:eL(void 0),initialized:eL(!1),logLevel:eL("ERROR"),loaded:eL(!1),readyCallbacks:eL([]),writeKey:eL(void 0),dataPlaneUrl:eL(void 0)},td={enabled:eL(!1),initialized:eL(!1),data:eL({}),activeConsentManagerPluginName:eL(void 0),preConsent:eL({enabled:!1}),postConsent:eL({}),resolutionStrategy:eL("and"),provider:eL(void 0),metadata:eL(void 0)},tg={retries:eL(0),dropped:eL(0),sent:eL(0),queued:eL(0),triggered:eL(0),metricsServiceUrl:eL(void 0)},th={app:eL({name:eu,namespace:"com.rudderlabs.javascript",version:ec,installType:"npm"}),traits:eL(null),library:eL({name:eu,version:ec,snippetVersion:globalThis.RudderSnippetVersion}),userAgent:eL(""),device:eL(null),network:eL(null),os:eL({name:"",version:""}),locale:eL(null),screen:eL({density:0,width:0,height:0,innerWidth:0,innerHeight:0}),"ua-ch":eL(void 0),timezone:eL(void 0)},tp={configuredDestinations:eL([]),activeDestinations:eL([]),loadOnlyIntegrations:eL({}),failedDestinations:eL([]),loadIntegration:eL(!0),initializedDestinations:eL([]),clientDestinationsReady:eL(!1),integrationsConfig:eL({})},tv={...v({capabilities:ta,consents:td,context:th,eventBuffer:{toBeProcessedArray:eL([]),readyCallbacksArray:eL([])},lifecycle:tc,loadOptions:tt,metrics:tg,nativeDestinations:tp,plugins:{ready:eL(!1),loadedPlugins:eL([]),failedPlugins:eL([]),pluginsToLoadFromConfig:eL([]),activePlugins:eL([]),totalPluginsToLoad:eL(0)},reporting:tl,session:to,source:tu,storage:{encryptionPluginName:eL(void 0),migrate:eL(!1),type:eL(void 0),cookie:eL(void 0),entries:eL({}),trulyAnonymousTracking:eL(!1)},serverCookies:{isEnabledServerSideCookies:eL(!1),dataServiceUrl:eL(void 0)},dataPlaneEvents:{eventsQueuePluginName:eL(void 0),deliveryEnabled:eL(!0)},autoTrack:{enabled:eL(!1),pageLifecycle:{enabled:eL(!1),visitId:eL(void 0),pageLoadedTimestamp:eL(void 0)}}})};class tf{plugins=[];byName={};cache={};config={throws:!0};constructor(e={},t){this.config={throws:!0,...e},this.logger=t}register(e,t){if(!e.name){let t=`${G}:: Plugin name is missing.`;if(this.config.throws)throw Error(t);this.logger?.error(t,e)}if(this.byName[e.name]){let t,r=(t=e.name,`${G}:: Plugin "${t}" already exists.`);if(this.config.throws)throw Error(r);this.logger?.error(r)}this.cache={},this.plugins=this.plugins.slice();let r=this.plugins.length;this.plugins.forEach((t,i)=>{t.deps?.includes(e.name)&&(r=Math.min(r,i))}),this.plugins.splice(r,0,e),this.byName[e.name]=e,k(e.initialize)&&e.initialize(t)}unregister(e){let t=this.byName[e];if(!t){let t=`${G}:: Plugin "${e}" not found.`;if(this.config.throws)throw Error(t);this.logger?.error(t)}let r=this.plugins.indexOf(t);if(-1===r){let t=`${G}:: Plugin "${e}" not found in plugins but found in byName. This indicates a bug in the plugin engine. Please report this issue to the development team.`;if(this.config.throws)throw Error(t);this.logger?.error(t)}this.cache={},delete this.byName[e],this.plugins=this.plugins.slice(),this.plugins.splice(r,1)}getPlugin(e){return this.byName[e]}getPlugins(e){let t=e??".";return this.cache[t]||(this.cache[t]=this.plugins.filter(e=>{if(e.deps?.some(e=>!this.byName[e])){let t,r=e.deps.filter(e=>!this.byName[e]);return this.logger?.error((t=e.name,`${G}:: Plugin "${t}" could not be loaded because some of its dependencies "${r}" do not exist.`)),!1}return"."===t||!!T(e,t)})),this.cache[t]}processRawPlugins(e){e(this.plugins),this.cache={}}invoke(e,t=!0,...r){let i=e;if(!i)throw Error("Failed to invoke plugin because the extension point name is missing.");let n=i.startsWith("!"),s=this.config.throws??i.endsWith("!");if(!(i=i.replace(/(^!|!$)/g,"")))throw Error("Failed to invoke plugin because the extension point name is invali
2d.");let o=i.split(".");o.pop();let a=o.join(".");return(t?this.getPlugins(i):[this.getPlugins(i)[0]]).map(e=>{let t=T(e,i);if(!k(t)||n)return t;try{return t.apply(T(e,a),r)}catch(n){let t,r;if(s)throw n;this.logger?.error((t=i,r=e.name,`${G}:: Failed to invoke the "${t}" extension point of plugin "${r}".`),n)}return null})}invokeSingle(e,...t){return this.invoke(e,!1,...t)[0]}invokeMultiple(e,...t){return this.invoke(e,!0,...t)}}let ty=new tf({throws:!0},eK);class tm{constructor(e,t){this.logger=e,this.pluginEngine=t,this.errorBuffer=new eQ,this.attachEffect()}attachEffect(){if(!0===tv.reporting.isErrorReportingPluginLoaded.value)for(;this.errorBuffer.size()>0;){let e=this.errorBuffer.dequeue();e&&this.notifyError(e.error,e.errorState)}}attachErrorListeners(){"addEventListener"in globalThis?(globalThis.addEventListener("error",e=>{this.onError(e,void 0,void 0,void 0,eV.UNHANDLEDEXCEPTION)}),globalThis.addEventListener("unhandledrejection",e=>{this.onError(e,void 0,void 0,void 0,eV.UNHANDLEDREJECTION)})):this.logger?.debug("Failed to attach global error listeners.")}init(e,t){if(this.httpClient=e,this.pluginEngine)try{let e=this.pluginEngine.invokeSingle("errorReporting.init",tv,this.pluginEngine,t,this.logger,!0);e instanceof Promise&&e.then(e=>{this.errReportingClient=e}).catch(e=>{this.logger?.error(`${Q}:: Failed to initialize the error reporting plugin.`,e)})}catch(e){this.onError(e,Q)}}onError(e,t="",r="",i=!1,n=eV.HANDLEDEXCEPTION){let s,o;if(n===eV.HANDLEDEXCEPTION){if(!(o=(e=>{let t;try{t="string"==typeof e?e:e instanceof Error||e instanceof ErrorEvent||e.message?e.message:ei(e)}catch(e){t=`Unknown error: ${e.message}`}return t})(e)))return;s=Error(o=`${t}:: ${r} ${o}`.replace(/ {2,}/g," ")),e instanceof Error&&(s=Object.create(e,{message:{value:o}}))}else s=(e=>{try{if(e instanceof Error||e instanceof ErrorEvent||e instanceof PromiseRejectionEvent&&e.reason)return e;if(e instanceof Event){let t=e.target;if(t&&"script"!==t.localName||t?.dataset&&("RS_JS_SDK"!==t.dataset.loader||"true"!==t.dataset.isnonnativesdk))return;let r=`Error in loading a third-party script from URL ${t?.src} with ID ${t?.id}.`;return Object.create(e,{message:{value:r}})}return e}catch(e){return e}})(e);let a=tv.reporting.isErrorReportingEnabled.value,l=tv.reporting.isErrorReportingPluginLoaded.value;try{if(a){let e={severity:"error",unhandled:n!==eV.HANDLEDEXCEPTION,severityReason:{type:n}};l?s&&this.notifyError(s,e):this.errorBuffer.enqueue({error:s,errorState:e})}}catch(e){this.logger?.error(eX(Q),e)}if(n===eV.HANDLEDEXCEPTION)if(this.logger){if(this.logger.error(o),i)throw s}else throw s;else e.error?.stack?.includes(eo)&&this.logger?.error("An unknown error occurred:",e.error?.message)}leaveBreadcrumb(e){if(this.pluginEngine)try{this.pluginEngine.invokeSingle("errorReporting.breadcrumb",this.pluginEngine,this.errReportingClient,e,this.logger,tv)}catch(e){this.onError(e,Q,"errorReporting.breadcrumb")}}notifyError(e,t){if(this.pluginEngine&&this.httpClient)try{this.pluginEngine.invokeSingle("errorReporting.notify",this.pluginEngine,this.errReportingClient,e,tv,this.logger,this.httpClient,t)}catch(e){this.logger?.error(eX(Q),e)}}}let tb=new tm(eK,ty),tE=e=>"cloud"!==e.config.connectionMode||!0===e.config.useNativeSDKToSend||!0===e.config.useNativeSDK,tk=["BeaconQueue","Bugsnag","CustomConsentManager","DeviceModeDestinations","DeviceModeTransformation","ErrorReporting","ExternalAnonymousId","GoogleLinker","IubendaConsentManager","KetchConsentManager","NativeDestinationQueue","OneTrustConsentManager","StorageEncryption","StorageEncryptionLegacy","StorageMigrator","XhrQueue"],tS={rudderAnalyticsRemotePlugins:{url:()=>Promise.resolve(window.RudderStackGlobals&&window.RudderStackGlobals.app&&window.RudderStackGlobals.app.pluginsCDNPath?`${window.RudderStackGlobals.app.pluginsCDNPath}/rsa-plugins.js`:"https://cdn.rudderlabs.com/v3/modern/plugins/rsa-plugins.js"),format:"esm",from:"vite"}},tI=async(e,t)=>{let r="function"==typeof e?await e():e,i=document.createElement("script");i.type="text/javascript",i.onload=t,i.src=r,document.getElementsByTagName("head")[0].appendChild(i)},tT=e=>(function e(t,r){let i=Object.assign(t,r);for(let t of Object.keys(i))"object"==typeof i[t]&&"object"==typeof r[t]&&(i[t]=e(i[t],r[t]));return i})({},(globalThis.__federation_shared__||{}).default||{});async function tA(e){let t=tS[e];return t.inited?t.lib:"var"===t.format?new Promise(r=>tI(t.url,()=>{t.inited||(t.lib=window[e],t.lib.init(tT(t.from)),t.inited=!0),r(t.lib)})):["esm","systemjs"].includes(t.format)?new Promise((e,r)=>{("function"==typeof t.url?t.url:()=>Promise.resolve(t.url))().then(i=>{import(i).then(r=>{if(!t.inited){let e=tT(t.from);r.init(e),t.lib=r,t.lib.init(e),t.inited=!0}e(t.lib)}).catch(r)})}):void 0}function tw(e,t){if(!e?.default&&t){let t=Object.create(null);return t.default=e,t.__esModule=!0,t}return e}function tP(e,t){return tA(e).then(e=>e.get(t).then(e=>e()))}let tC=e=>{let t={};
2return e.forEach(e=>{if(tk.includes(e)){let r=(e=>{switch(e){case"BeaconQueue":return()=>tP("rudderAnalyticsRemotePlugins","./BeaconQueue").then(e=>tw(e,!0));case"Bugsnag":return()=>tP("rudderAnalyticsRemotePlugins","./Bugsnag").then(e=>tw(e,!0));case"CustomConsentManager":return()=>tP("rudderAnalyticsRemotePlugins","./CustomConsentManager").then(e=>tw(e,!0));case"DeviceModeDestinations":return()=>tP("rudderAnalyticsRemotePlugins","./DeviceModeDestinations").then(e=>tw(e,!0));case"DeviceModeTransformation":return()=>tP("rudderAnalyticsRemotePlugins","./DeviceModeTransformation").then(e=>tw(e,!0));case"ErrorReporting":return()=>tP("rudderAnalyticsRemotePlugins","./ErrorReporting").then(e=>tw(e,!0));case"ExternalAnonymousId":return()=>tP("rudderAnalyticsRemotePlugins","./ExternalAnonymousId").then(e=>tw(e,!0));case"GoogleLinker":return()=>tP("rudderAnalyticsRemotePlugins","./GoogleLinker").then(e=>tw(e,!0));case"KetchConsentManager":return()=>tP("rudderAnalyticsRemotePlugins","./KetchConsentManager").then(e=>tw(e,!0));case"IubendaConsentManager":return()=>tP("rudderAnalyticsRemotePlugins","./IubendaConsentManager").then(e=>tw(e,!0));case"NativeDestinationQueue":return()=>tP("rudderAnalyticsRemotePlugins","./NativeDestinationQueue").then(e=>tw(e,!0));case"OneTrustConsentManager":return()=>tP("rudderAnalyticsRemotePlugins","./OneTrustConsentManager").then(e=>tw(e,!0));case"StorageEncryption":return()=>tP("rudderAnalyticsRemotePlugins","./StorageEncryption").then(e=>tw(e,!0));case"StorageEncryptionLegacy":return()=>tP("rudderAnalyticsRemotePlugins","./StorageEncryptionLegacy").then(e=>tw(e,!0));case"StorageMigrator":return()=>tP("rudderAnalyticsRemotePlugins","./StorageMigrator").then(e=>tw(e,!0));case"XhrQueue":return()=>tP("rudderAnalyticsRemotePlugins","./XhrQueue").then(e=>tw(e,!0));default:return}})(e);r&&(t[e]=r)}}),t},tR=()=>({}),tD={...tR()};class tO{constructor(e,t,r){this.engine=e,this.errorHandler=t,this.logger=r,this.onError=this.onError.bind(this)}init(){tv.lifecycle.status.value="pluginsLoading",em("pluginsCDNPath",tv.lifecycle.pluginsCDNPath.value),this.setActivePlugins(),this.registerLocalPlugins(),this.registerRemotePlugins(),this.attachEffects()}attachEffects(){eF(()=>{(0===tv.plugins.activePlugins.value.length||tv.plugins.loadedPlugins.value.length+tv.plugins.failedPlugins.value.length===tv.plugins.totalPluginsToLoad.value)&&eA(()=>{tv.plugins.ready.value=!0,tv.lifecycle.status.value="pluginsReady"})})}getPluginsToLoadBasedOnConfig(){let e=tv.plugins.pluginsToLoadFromConfig.value;return e?([{configurationStatus:()=>S(tv.dataPlaneEvents.eventsQueuePluginName.value),configurationStatusStr:"Data plane events delivery is enabled",activePluginName:tv.dataPlaneEvents.eventsQueuePluginName.value,supportedPlugins:Object.values(te),shouldAddMissingPlugins:!0},{configurationStatus:()=>tv.reporting.isErrorReportingEnabled.value,configurationStatusStr:"Error reporting is enabled",supportedPlugins:["ErrorReporting","Bugsnag"]},{configurationStatus:()=>tv.nativeDestinations.configuredDestinations.value.filter(tE).length>0,configurationStatusStr:"Device mode destinations are connected to the source",supportedPlugins:["DeviceModeDestinations","NativeDestinationQueue"]},{configurationStatus:()=>tv.nativeDestinations.configuredDestinations.value.filter(tE).some(e=>e.shouldApplyDeviceModeTransformation),configurationStatusStr:"Device mode transformations are enabled for at least one destination",supportedPlugins:["DeviceModeTransformation"]},{configurationStatus:()=>S(tv.consents.activeConsentManagerPluginName.value),configurationStatusStr:"Consent management is enabled",activePluginName:tv.consents.activeConsentManagerPluginName.value,supportedPlugins:Object.values(e9)},{configurationStatus:()=>S(tv.storage.encryptionPluginName.value),configurationStatusStr:"Storage encryption is enabled",activePluginName:tv.storage.encryptionPluginName.value,supportedPlugins:Object.values(e7)},{configurationStatus:()=>tv.storage.migrate.value,configurationStatusStr:"Storage migration is enabled",supportedPlugins:["StorageMigrator"]}
2].forEach(t=>{t.configurationStatus()?(e=e.filter(t.activePluginName?e=>!(e!==t.activePluginName&&t.supportedPlugins.includes(e)):e=>S(e)),this.addMissingPlugins(t,!1,e)):e=e.filter(void 0!==t.basePlugins?e=>!(t.basePlugins.includes(e)||t.supportedPlugins.includes(e)):e=>!t.supportedPlugins.includes(e))}),[...Object.keys(tR()),...e]):[]}addMissingPlugins(e,t,r){let i=e.shouldAddMissingPlugins||t,n=(e.activePluginName?[...e.basePlugins||[],e.activePluginName]:[...e.supportedPlugins]).filter(e=>!r.includes(e));if(n.length>0){var s;let t,o,a;i&&r.push(...n),this.logger?.warn((s=e.configurationStatusStr,o=(t=1===n.length)?` '${n[0]}' plugin was`:` ['${n.join("', '")}'] plugins were`,a=`${_}:: ${s}, but${o} not configured to load.`,i?`${a} So, ${t?"the plugin":"those plugins"} will be loaded automatically.`:`${a} Ignore if this was intentional. Otherwise, consider adding ${t?"it":"them"} to the 'plugins' load API option.`))}}setActivePlugins(){let e=this.getPluginsToLoadBasedOnConfig(),t=[...Object.keys(tD),...tk],r=[],i=[];e.forEach(e=>{t.includes(e)?r.push(e):i.push(e)}),i.length>0&&this.onError(Error(`Ignoring loading of unknown plugins: ${i.join(",")}. Mandatory plugins: ${Object.keys(tR()).join(",")}. Load option plugins: ${tv.plugins.pluginsToLoadFromConfig.value.join(",")}`)),eA(()=>{tv.plugins.totalPluginsToLoad.value=e.length,tv.plugins.activePlugins.value=r,tv.plugins.failedPlugins.value=i})}registerLocalPlugins(){Object.values(tD).forEach(e=>{k(e)&&tv.plugins.activePlugins.value.includes(e().name)&&this.register([e()])})}registerRemotePlugins(){let e,t={...(e=tv.plugins.activePlugins.value,tC?.(e)||{})};Promise.all(Object.keys(t).map(async e=>{await t[e]().then(e=>this.register([e.default()])).catch(t=>{tv.plugins.failedPlugins.value=[...tv.plugins.failedPlugins.value,e],this.onError(t,e)})})).catch(e=>{this.onError(e)})}invokeMultiple(e,...t){try{return this.engine.invokeMultiple(e,...t)}catch(t){return this.onError(t,e),[]}}invokeSingle(e,...t){try{return this.engine.invokeSingle(e,...t)}catch(t){return this.onError(t,e),null}}register(e){e.forEach(e=>{try{this.engine.register(e,tv)}catch(t){tv.plugins.failedPlugins.value=[...tv.plugins.failedPlugins.value,e.name],this.onError(t)}})}unregisterLocalPlugins(){Object.values(tD).forEach(e=>{try{this.engine.unregister(e().name)}catch(e){this.onError(e)}})}onError(e,t){if(this.errorHandler)this.errorHandler.onError(e,_,t);else throw e}}let t$=(e,t)=>{try{return JSON.parse(e||"")}catch(r){let e=ea(r,"Failed to parse response data");if(k(t))t(e);else throw e}},tL="The request failed",tM={headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},method:"GET"},tB=(e,t,r)=>{let i=P(tM,t||{});return r&&(i.headers=P(i.headers,{Authorization:r})),i.url=e,i},tN=(e,t=ef,r)=>new Promise((i,n)=>{let s;if(!0===e.sendRawData)s=e.data;else if(null===(s=ei(e.data,!1,[],r)))return void n({error:Error("Failed to prepare data for the request."),undefined,options:e});let o=new XMLHttpRequest,a=t=>{let r;n({error:Error((r=e.url,`${tL} due to timeout or no connection (${t?t.type:""}) for URL: ${r}.`)),xhr:o,options:e})};o.ontimeout=a,o.onerror=a,o.onload=()=>{if(o.status>=200&&o.status<400)i({response:o.responseText,xhr:o,options:e});else{let t,r,i;n({error:Error((t=o.status,r=o.statusText,i=e.url,`${tL} with status: ${t}, ${r} for URL: ${i}.`)),xhr:o,options:e})}},o.open(e.method,e.url,!0),!0===e.withCredentials&&(o.withCredentials=!0),o.timeout=t,Object.keys(e.headers).forEach(t=>{e.headers[t]&&o.setRequestHeader(t,e.headers[t])});try{o.send(s)}catch(r){let t;n({error:ea(r,(t=e.url,`${tL} for URL: ${t}`)),xhr:o,options:e})}});class tU{hasErrorHandler=!1;constructor(e,t){this.errorHandler=e,this.logger=t,this.hasErrorHandler=!!this.errorHandler,this.onError=this.onError.bind(this)}async getData(e){let{url:t,options:r,timeout:i,isRawResponse:n}=e;try{let e=await tN(tB(t,r,this.basicAuthHeader),i,this.logger);return{data:n?e.response:t$(e.response,this.onError),details:e}}catch(e){return this.onError(e.error??e),{data:void 0,details:e}}}getAsyncData(e){let{callback:t,url:r,options:i,timeout:n,isRawResponse:s}=e,o=!k(t);tN(tB(r,i,this.basicAuthHeader),n,this.logger).then(e=>{o||t(s?e.response:t$(e.response,this.onError),e)}
2).catch(e=>{this.onError(e.error??e),o||t(void 0,e)})}onError(e){if(this.hasErrorHandler)this.errorHandler?.onError(e,"HttpClient");else throw e}setAuthHeader(e,t=!1){let r,i=t?e:(r=`${e}:`,globalThis.btoa(Array.from(new TextEncoder().encode(r),e=>String.fromCodePoint(e)).join("")));this.basicAuthHeader=`Basic ${i}`}resetAuthHeader(){this.basicAuthHeader=void 0}}let tx=new tU(tb,eK),tj="cookieStorage",tH="localStorage",t_="sessionStorage",tF="memoryStorage",tQ="none",tG={userId:"rl_user_id",userTraits:"rl_trait",anonymousId:"rl_anonymous_id",groupId:"rl_group_id",groupTraits:"rl_group_trait",initialReferrer:"rl_page_init_referrer",initialReferringDomain:"rl_page_init_referring_domain",sessionInfo:"rl_session",authToken:"rl_auth_token"},tz="clientDataInCookie",tK="clientDataInLocalStorage",tV="clientDataInSessionStorage",tq=["userId","userTraits","anonymousId","groupId","groupTraits","initialReferrer","initialReferringDomain","sessionInfo","authToken"],tW={[tj]:tz,[tH]:tK,[tF]:"clientDataInMemory",[t_]:tV},tJ=(e,t)=>{try{return encodeURIComponent(e)}catch(e){t?.error("Failed to encode the cookie data.",e);return}},tX=e=>{try{return decodeURIComponent(e)}catch(e){return}},tZ=()=>{let e,t,r;return t={},(r=globalThis.document.cookie.split(/\s*;\s*/))[0]&&r.forEach(r=>{let i=(e=r.split("="))[0]?tX(e[0]):void 0;i&&(t[i]=e[1]?tX(e[1]):void 0)}),t},tY=function(e,t,r,i){switch(arguments.length){case 4:case 3:case 2:let n={...r||{}},s=`${tJ(e,i)}=${tJ(t,i)}`;null===t&&(n.maxage=-1),n.maxage&&(n.expires=new Date(+new Date+n.maxage)),n.path&&(s+=`; path=${n.path}`),n.domain&&(s+=`; domain=${n.domain}`),n.expires&&(s+=`; expires=${n.expires.toUTCString()}`),n.samesite&&(s+=`; samesite=${n.samesite}`),n.secure&&(s+="; secure"),globalThis.document.cookie=s;return;case 1:if(e)return tZ()[e];return tZ();default:return tZ()}},t0=()=>{let e;return null!=(e=globalThis.navigator.userAgentData)},t1={URL:()=>!k(globalThis.URL)||!k(globalThis.URLSearchParams),Promise:()=>!k(globalThis.Promise),"Number.isNaN":()=>!k(globalThis.Number.isNaN),"Number.isInteger":()=>!k(globalThis.Number.isInteger),"Array.from":()=>!k(globalThis.Array.from),"Array.prototype.find":()=>!k(globalThis.Array.prototype.find),"Array.prototype.includes":()=>!k(globalThis.Array.prototype.includes),"String.prototype.endsWith":()=>!k(globalThis.String.prototype.endsWith),"String.prototype.startsWith":()=>!k(globalThis.String.prototype.startsWith),"String.prototype.includes":()=>!k(globalThis.String.prototype.includes),"String.prototype.replaceAll":()=>!k(globalThis.String.prototype.replaceAll),"String.fromCodePoint":()=>!k(globalThis.String.fromCodePoint),"Object.entries":()=>!k(globalThis.Object.entries),"Object.values":()=>!k(globalThis.Object.values),"Object.assign":()=>!k(globalThis.Object.assign),"Object.fromEntries":()=>!k(globalThis.Object.fromEntries),"Element.prototype.dataset":()=>{let e;return(e=globalThis.document.createElement("div")).setAttribute("data-a-b","c"),!e.dataset||"c"!==e.dataset.aB},TextEncoder:()=>!k(globalThis.TextEncoder)||!k(globalThis.TextDecoder),requestAnimationFrame:()=>!k(globalThis.requestAnimationFrame)||!k(globalThis.cancelAnimationFrame),CustomEvent:()=>!k(globalThis.CustomEvent),"navigator.sendBeacon":()=>!k(globalThis.navigator.sendBeacon),ArrayBuffer:()=>!k(globalThis.Uint8Array),Set:()=>!k(globalThis.Set),atob:()=>!k(globalThis.atob)},t2=()=>({width:globalThis.screen.width,height:globalThis.screen.height,density:globalThis.devicePixelRatio,innerWidth:globalThis.innerWidth,innerHeight:globalThis.innerHeight}),t3=e=>{let t=["QuotaExceededError","NS_ERROR_DOM_QUOTA_REACHED"].includes(e.name)||[22,1014].includes(e.code);return e instanceof DOMException&&t},t6=(e=tH,t,r)=>{let i,n,s,o=`${x}:: The "${e}" storage type is `,a="unavailable",l=!0;try{switch(e){case tF:return!0;case tj:i=t,n="test_rudder_cookie";break;case tH:i=t??globalThis.localStorage,n="test_rudder_ls";break;case t_:i=t??globalThis.sessionStorage,n="test_rudder_ss";break;default:return!1}if(i&&(i.setItem(n,"true"),i.getItem(n)))return i.removeItem(n),!0;l=!1}catch(e){l=!1,s=e,t3(e)&&(a="full")}return l||r?.warn(`${o}${a}.`,s),!1};class t8{static globalSingleton=null;isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e={},t){if(t8.globalSingleton)return t8.globalSingleton;this.options=(()=>{let e=`.${(e=>{let t=(e=>
2{let t,r="function"!=typeof globalThis.URL?((t=document.createElement("a")).href=e,t.hostname):new URL(e).hostname,i=r?.split(".")??[],n=i[i.length-1],s=[];if(4===i.length&&n&&n===parseInt(n,10).toString())return s;if(i.length<=1)return i[0]&&-1!==i[0].indexOf("localhost")?["localhost"]:s;for(let e=i.length-2;e>=0;e-=1)s.push(i.slice(e).join("."));return s})(e);for(let e=0;e<t.length;e+=1){let r=t[e],i="__tld__",n={domain:`${-1!==r.indexOf("localhost")?"":"."}${r}`};if(tY(i,1,n),tY(i))return tY(i,null,n),r}return""})(globalThis.location.href)}`;return{maxage:31536e6,path:"/",domain:e&&"."!==e?e:void 0,samesite:"Lax",enabled:!0}})(),this.logger=t,this.configure(e),t8.globalSingleton=this}configure(e){return this.options=P(this.options??{},e),e.sameDomainCookiesOnly&&delete this.options.domain,this.isSupportAvailable=t6(tj,this),this.isEnabled=!!(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){return tY(e,t,this.options,this.logger),this.length=Object.keys(tY()).length,!0}getItem(e){let t=tY(e);return void 0===t?null:t}removeItem(e){let t=this.setItem(e,null);return this.length=Object.keys(tY()).length,t}clear(){}key(e){return this.keys()[e]??null}keys(){return Object.keys(tY())}}class t4{isEnabled=!0;length=0;data={};constructor(e,t){this.options={enabled:!0},this.logger=t,this.configure(e??{})}configure(e){return this.options=P(this.options,e),this.isEnabled=!!this.options.enabled,this.options}setItem(e,t){return this.data[e]=t,this.length=Object.keys(this.data).length,t}getItem(e){return e in this.data?this.data[e]:null}removeItem(e){return e in this.data&&delete this.data[e],this.length=Object.keys(this.data).length,null}clear(){this.data={},this.length=0}key(e){return this.keys()[e]??null}keys(){return Object.keys(this.data)}}let t5=new t4({},eK);var t9={exports:{}};t9.exports;let t7=(u=c?t9.exports:(c=1,t9.exports=function(){function e(e){return e=JSON.stringify(e),!!/^\{[\s\S]*\}$/.test(e)}function t(e){if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e}}function r(e){return"[object Function]"===({}).toString.call(e)}var i=function(e){var t="_Is_Incognit";try{e||(e=window.localStorage),e.setItem(t,"yes"),e.removeItem(t)}catch(t){var r={};r._data={},r.setItem=function(e,t){return r._data[e]=String(t)},r.getItem=function(e){return r._data.hasOwnProperty(e)?r._data[e]:void 0},r.removeItem=function(e){return delete r._data[e]},r.clear=function(){return r._data={}},e=r}finally{"yes"===e.getItem(t)&&e.removeItem(t)}return e}();function n(){if(!(this instanceof n))return new n}n.prototype={set:function(t,r){if(t&&!e(t))i.setItem(t,void 0===r||"function"==typeof r?r+"":JSON.stringify(r));else if(e(t))for(var n in t)this.set(n,t[n]);return this},get:function(e){if(void 0===e){var r={};return this.forEach(function(e,t){return r[e]=t}),r}if("?"===e.charAt(0))return this.has(e.substr(1));var n=arguments;if(n.length>1){for(var s={},o=0,a=n.length;o<a;o++){var l=t(i.getItem(n[o]));this.has(n[o])&&(s[n[o]]=l)}return s}return t(i.getItem(e))},clear:function(){return i.clear(),this},remove:function(e){var t=this.get(e);return i.removeItem(e),t},has:function(e){return({}).hasOwnProperty.call(this.get(),e)},keys:function(){var e=[];return this.forEach(function(t){e.push(t)}),e},forEach:function(e){for(var t=0,r=i.length;t<r;t++){var n=i.key(t);e(n,this.get(n))}return this},search:function(e){for(var t=this.keys(),r={},i=0,n=t.length;i<n;i++)t[i].indexOf(e)>-1&&(r[t[i]]=this.get(t[i]));return r},len:function(){return i.length}};var s=null;function o(t,i){var a=arguments,l=null;if(s||(s=n()),0===a.length)return s.get();if(1===a.length){if("string"==typeof t)return s.get(t);if(e(t))return s.set(t)}if(2===a.length&&"string"==typeof t){if(!i)return s.remove(t);if(i&&"string"==typeof i)return s.set(t,i);i&&r(i)&&(l=null,l=i(t,s.get(t)),o.set(t,l))}if(2===a.length&&"[object Array]"===Object.prototype.toString.call(t)&&r(i))for(var u=0,c=t.length;u<c;u++)l=i(t[u],s.get(t[u])),o.set(t[u],l);return o}for(var a in n.prototype)o[a]=n.prototype[a];return o}(),t9.exports))&&u.__esModule&&Object.prototype.hasOwnProperty.call(u,"default")?u.default:u;class re{isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e={},t){this.options={enabled:!0},this.logger=t,this.configure(e)}configure(e){return this.options=P(this.options,e),this.isSupportAvailable=t6(tH),this.isEnabled=!!(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){t7.set(e,t),this.length=t7.len()}getItem(e){let t=t7.get(e);return void 0===t?null:t}removeItem(e){t7.remove(e),this.length=t7.len()}clear(){t7.clear(),this.length=0}key(e){return this.keys()[e]??null}keys(){return t7.keys()}}let rt=new re({},eK);class rr{isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e={},t){this.options={enabled:!0},this.logger=t,this.configure(e)}configure(e){return this.options=P(this.options,e),this.isSupportAvailable=t6(t_),this.isSupportAvailable&&(this.store=globalThis.sessionStorage),this.isEnabled=!!(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){this.store&&(this.store.setItem(e,t),this.length=this.store.length)}getItem(e){if(!this.store)return null;let t=this.store.getItem(e);return void 0===t?null:t}removeItem(e){this.store&&(this.store.removeItem(e),this.length=this.store.length)}clear(){this.store?.clear(),this.length=0}key(e){return this.store?.key(e)??null}keys(){let e=[];
2if(!this.store)return e;for(let t=0;t<this.store.length;t+=1){let r=this.store.key(t);null!==r&&e.push(r)}return e}}let ri=new rr({},eK),rn=e=>{switch(e){case tH:return rt;case t_:return ri;case tF:return t5;case tj:return new t8({},eK);default:return t5}};class rs{hasErrorHandler=!1;constructor(e,t,r){this.id=e.id,this.name=e.name,this.isEncrypted=e.isEncrypted??!1,this.validKeys=e.validKeys??{},this.engine=t??rn(tH),this.noKeyValidation=0===Object.keys(this.validKeys).length,this.noCompoundKey=e.noCompoundKey,this.originalEngine=this.engine,this.errorHandler=e.errorHandler??tb,this.hasErrorHandler=!!this.errorHandler,this.logger=e.logger??eK,this.pluginsManager=r}createValidKey(e){let t,{name:r,id:i,validKeys:n,noKeyValidation:s,noCompoundKey:o}=this;return s?o?e:[r,i,e].join("."):(Object.values(n).forEach(n=>{n===e&&(t=o?e:[r,i,e].join("."))}),t)}swapQueueStoreToInMemoryEngine(){let{name:e,id:t,validKeys:r,noCompoundKey:i}=this,n=rn(tF);Object.keys(r).forEach(s=>{let o=this.get(r[s]),a=i?s:[e,t,s].join(".");n.setItem(a,o),this.remove(s)}),this.engine=n}set(e,t){let r=this.createValidKey(e);if(r)try{this.engine.setItem(r,this.encrypt(ei(t,!1,[],this.logger)))}catch(r){if(t3(r)){let r;this.logger?.warn((r=`Store ${this.id}`,`${r}:: The storage is either full or unavailable, so the data will not be persisted. Switching to in-memory storage.`)),this.swapQueueStoreToInMemoryEngine(),this.set(e,t)}else this.onError(ea(r,`Failed to save the value for "${e}" to storage`))}}get(e){let t,r=this.createValidKey(e);try{if(!r)return null;if(t=this.decrypt(this.engine.getItem(r)),null==t)return null;return JSON.parse(t)}catch(r){return this.onError(Error(`Failed to retrieve or parse data for "${e}" from storage: ${r.message}`)),"string"==typeof t&&t.startsWith("RudderEncrypt:")&&this.logger?.warn(`The cookie data for ${e} seems to be encrypted using SDK versions < v3. The data is dropped. This can potentially stem from using SDK versions < v3 on other sites or web pages that can share cookies with this webpage. We recommend using the same SDK (v3) version everywhere or avoid disabling the storage data migration.`),null}}remove(e){let t=this.createValidKey(e);t&&this.engine.removeItem(t)}getOriginalEngine(){return this.originalEngine}decrypt(e){return null==e?null:this.crypto(e,"decrypt")}encrypt(e){return this.crypto(e,"encrypt")}crypto(e,t){if(!this.isEncrypted||!e||"string"!=typeof e||""===e.replace(/^\s+|\s+$/gm,""))return e;let r=`storage.${t}`,i=this.pluginsManager?this.pluginsManager.invokeSingle(r,e):e;return void 0===i?e:i??""}onError(e){if(this.hasErrorHandler)this.errorHandler?.onError(e,`Store ${this.id}`);else throw e}}class ro{stores={};isInitialized=!1;hasErrorHandler=!1;constructor(e,t,r){this.errorHandler=t,this.logger=r,this.hasErrorHandler=!!this.errorHandler,this.pluginsManager=e,this.onError=this.onError.bind(this)}init(){if(this.isInitialized)return;let e=tv.loadOptions.value,t={cookieStorageOptions:{samesite:e.sameSiteCookie,secure:e.secureCookie,domain:e.setCookieDomain,sameDomainCookiesOnly:e.sameDomainCookiesOnly,enabled:!0},localStorageOptions:{enabled:!0},inMemoryStorageOptions:{enabled:!0},sessionStorageOptions:{enabled:!0}};((e={},t={},r={},i={})=>{let n;n=new t8({},eK).configure(e),tv.storage.cookie.value={maxage:n.maxage,path:n.path,domain:n.domain,samesite:n.samesite,expires:n.expires,secure:n.secure},rt.configure(t),t5.configure(r),ri.configure(i)})(R(P(t.cookieStorageOptions??{},tv.storage.cookie?.value??{})),R(t.localStorageOptions),R(t.inMemoryStorageOptions),R(t.sessionStorageOptions)),this.initClientDataStores(),this.isInitialized=!0}initClientDataStores(){this.initializeStorageState(),[tF,tH,tj,t_].forEach(e=>{rn(e)?.isEnabled&&this.setStore({id:tW[e],name:tW[e],isEncrypted:!0,noCompoundKey:!0,type:e})})}initializeStorageState(){let e=tv.storage.type.value,t=tv.loadOptions.value.storage?.entries,r=tv.consents.postConsent.value.storage;(S(r?.type)||S(r?.entries))&&(e=r?.type,t=r?.entries);let i=!0,n={};tq.forEach(r=>{let s=t?.[r]?.type,o=((e,t)=>{let r;if(e.consents.preConsent.value.enabled)switch(e.consents.preConsent.value.storage?.strategy){case"none":r=tQ;break;case"session":"sessionInfo"!==t&&(r=tQ);break;case"anonymousId":"anonymousId"!==t&&(r=tQ)}return r})(tv,r)??s??e??eW,a=this.getResolvedStorageTypeForEntry(o,r);a!==tQ&&(i=!1),n={...n,[r]:{type:a,key:tG[r]}}}),eA(()=>{tv.storage.type.value=e,tv.storage.entries.value=n,tv.storage.trulyAnonymousTracking.value=i})}getResolvedStorageTypeForEntry(e,t){let r,i=e;switch(e){case tH:rn(tH)?.isEnabled||(i=tF);break;case t_:rn(t_)?.isEnabled||(i=tF);break;case tF:case tQ:break;default:i=rn(tj)?.isEnabled?tj:rn(tH)?.isEnabled?tH:rn(t_)?.isEnabled?t_:tF}return i!==e&&this.logger?.warn((r=i,`${z}:: The storage type "${e}" is not available for entry "${t}". The SDK will initialize the entry with "${r}" storage type instead.`)),i}setStore(e){let t=rn(e.type);return this.stores[e.id]=new rs(e,t,this.pluginsManager),this.stores[e.id]}getStore(e){return this.stores[e]}onError(e){if(this.hasErrorHandler)this.errorHandler?.onError(e,z);else throw e}}let ra=e=>{let{host:t,protocol:r}=new URL(e),i=t.split(".");return{topDomain:i.length>2?`${i[i.length-2]}.${i[i.length-1]}`:t,protocol:r}},rl=e=>e?.endsWith("/")?rl(e.substring(0,e.length-1)):e,ru=e=>{try{return new URL(e).host}catch(e){return null}},rc=e=>{if("string"!=typeof e)return!1;try{return k(globalThis.URL)&&new URL(e),e2.test(e)}catch(e){return!1}},rd="none",rg="immediate",rh=e=>C(e)||Array.isArray(e),rp=(e,t)=>{let r,i,n=[],s=[],o=!1,a=e?.enabled===!0;C(e)&&a&&({provider:i,consentManagerPluginName:r}=((e,t)=>{let{provider:r}=e,i=r?e9[r]:void 0;if(r&&!i){let e;t?.error((e=r,`${j}:: The consent manager "${e}" is not supported. Please choose one of the following supported consent managers: "${Object.keys(e9)}".`)),r=void 0}return{provider:r,consentManagerPluginName:i}})(e,t),rh(e.allowedConsentIds)&&(n=e.allowedConsentIds,o=!0),rh(e.deniedConsentIds)&&(s=e.deniedConsentIds,o=!0));let l={allowedConsentIds:n,deniedConsentIds:s};return a=a&&!!r,{provider:i,consentManagerPluginName:r,initialized:o,enabled:a,consentsData:l}},rv=(e,t,r,i,n,s)=>{let o="";if(s){if(!rc(s))throw Error(`Failed to load the SDK as the base URL for ${e}
2 is not valid.`);return rl(s)}let a=(()=>{let e=document.getElementsByTagName("script"),t=/(?:^|\/)rsa(\.min)?\.js$/;for(let r of e){let e=r.getAttribute("src");if(e&&t.test(e))return e}})();return o=a?a.split("/").slice(0,-1).concat(t).join("/"):r,n&&(o=o.replace(`/v3/${e3}/${t}`,`/${i}/${e3}/${t}`)),o};class rf{hasErrorHandler=!1;constructor(e,t,r){this.errorHandler=t,this.logger=r,this.httpClient=e,this.hasErrorHandler=!!this.errorHandler,this.onError=this.onError.bind(this),this.processConfig=this.processConfig.bind(this)}attachEffects(){eF(()=>{this.logger?.setMinLogLevel(tv.lifecycle.logLevel.value)})}init(){this.attachEffects();let{logLevel:e,configUrl:t,lockIntegrationsVersion:r,lockPluginsVersion:i,destSDKBaseURL:n,pluginsSDKBaseURL:s,integrations:o}=tv.loadOptions.value;tv.lifecycle.activeDataplaneUrl.value=rl(tv.lifecycle.dataPlaneUrl.value);let a=rv("integrations",e0,e8,ec,r,n),l=rv("plugins",e1,e4,ec,i,s);(e=>{let t,r,{storage:i}=tv.loadOptions.value,n=i?.type;if(S(n)&&!("string"==typeof(t=n)&&eq.includes(t))){let t;e?.warn((t=n,`${j}:: The storage type "${t}" is not supported. Please choose one of the following supported types: "${eq}". The default type "${eW}" will be used instead.`)),n=eW}let s=i?.encryption?.version,o=s&&e7[s];if(void 0===s||void 0!==o)void 0===s&&(s="v3");else{let t;e?.warn((t=s,`${j}:: The storage encryption version "${t}" is not supported. Please choose one of the following supported versions: "${Object.keys(e7)}". The default version "v3" will be used instead.`)),s="v3"}let a=i?.migrate,l=a&&"v3"===s;!0===a&&l!==a&&e?.warn((r=s,`${j}:: The storage data migration has been disabled because the configured storage encryption version (${r}) is not the latest (v3). To enable storage data migration, please update the storage encryption version to the latest version.`));let{sscEnabled:u,finalDataServiceUrl:c,cookieOptions:d}=(e=>{let t,{useServerSideCookies:r,dataServiceEndpoint:i,storage:n,setCookieDomain:s,sameDomainCookiesOnly:o}=tv.loadOptions.value,a=n?.cookie,l=!1;if(r){var u;let n,c;l=r;let d=a.domain??s,g=S(d)&&!(e=>{let{topDomain:t}=ra(window.location.href);return t===e})(d.replace(/^\.+/,""))||o,h=(u=i??"rsaRequest",n=g?window.location.origin:(e=>{let{topDomain:t,protocol:r}=ra(e);return`${r}//${t}`})(window.location.href),c=u.startsWith("/")?u.substring(1):u,`${n}/${c}`);if(rc(h)){t=rl(h);let r=ru(window.location.href),i=ru(h);(r!==i&&(a={...a,samesite:"None",secure:!0}),!o&&g&&i!==d.replace(/^\.+/,""))&&(l=!1,e?.warn(`${j}:: The provided cookie domain (${d}) does not match the current webpage's domain (${i}). Hence, the cookies will be set client-side.`))}else l=!1}return{sscEnabled:l,cookieOptions:a,finalDataServiceUrl:t}})(e);eA(()=>{tv.storage.type.value=n,tv.storage.cookie.value=d,tv.serverCookies.isEnabledServerSideCookies.value=u,tv.serverCookies.dataServiceUrl.value=c,tv.storage.encryptionPluginName.value=e7[s],tv.storage.migrate.value=l})})(this.logger),(e=>{let{provider:t,consentManagerPluginName:r,initialized:i,enabled:n,consentsData:s}=rp(tv.loadOptions.value.consentManagement,e),o=tv.loadOptions.value.preConsent,a=o?.storage?.strategy??rd;if(S(a)&&!["none","session","anonymousId"].includes(a)){let t;a=rd,e?.warn((t=o?.storage?.strategy,`${j}:: The pre-consent storage strategy "${t}" is not supported. Please choose one of the following supported strategies: "none, session, anonymousId". The default strategy "${rd}" will be used instead.`))}let l=o?.events?.delivery??rg;if(S(l)&&!["immediate","buffer"].includes(l)){let t;l=rg,e?.warn((t=o?.events?.delivery,`${j}:: The pre-consent events delivery type "${t}" is not supported. Please choose one of the following supported types: "immediate, buffer". The default type "${rg}" will be used instead.`))}eA(()=>{tv.consents.activeConsentManagerPluginName.value=r,tv.consents.initialized.value=i,tv.consents.enabled.value=n,tv.consents.data.value=s,tv.consents.provider.value=t,tv.consents.preConsent.value={enabled:tv.loadOptions.value.preConsent?.enabled===!0&&!1===i&&!0===n,storage:{strategy:a},events:{delivery:l}}})})(this.logger),(e=>{if(tv.dataPlaneEvents.deliveryEnabled.value){let t="XhrQueue",r=t;if(tv.loadOptions.value.useBeacon)if(tv.capabilities.isBeaconAvailable.value)r="BeaconQueue";else r=t,e?.warn(`${j}:: The Beacon API is not supported by your browser. The events will be sent using XHR instead.`);eA(()=>{tv.dataPlaneEvents.eventsQueuePluginName.value=r})}})(this.logger),eA(()=>{tv.lifecycle.integrationsCDNPath.value=a,tv.lifecycle.pluginsCDNPath.value=l,e&&(tv.lifecycle.logLevel.value=e),tv.lifecycle.sourceConfigUrl.value=((e,t,r,i,n)=>{let s=new URLSearchParams({p:"npm",v:ec,build:e3,writeKey:t,lockIntegrationsVersion:r.toString(),lockPluginsVersion:i.toString()}),o=e5,a=s,l="/sourceConfig/",u="";if(rc(e)){let t=new URL(e);rl(t.pathname).endsWith("/sourceConfig")||(t.pathname=`${rl(t.pathname)}
2/sourceConfig/`),t.pathname=t.pathname.replace(/\/{2,}/g,"/"),s.forEach((e,r)=>{null===t.searchParams.get(r)&&t.searchParams.set(r,e)}),o=t.origin,l=t.pathname,a=t.searchParams,u=t.hash}else n?.warn(`${j}:: The provided source config URL "${e}" is invalid. Using the default source config URL instead.`);return`${o}${l}?${a}${u}`})(t,tv.lifecycle.writeKey.value,r,i,this.logger),tv.metrics.metricsServiceUrl.value=`${tv.lifecycle.activeDataplaneUrl.value}/rsaMetrics`,tv.nativeDestinations.loadOnlyIntegrations.value=o}),this.getConfig()}onError(e,t,r){if(this.hasErrorHandler)this.errorHandler?.onError(e,j,t,r);else throw e}processConfig(e,t){var r,i;let n,s,o,a,l,u;if(!e){let e;return void this.onError((e=t?.error,`Failed to fetch the source config. Reason: ${e}`))}try{n="string"==typeof e?JSON.parse(e):e}catch(e){this.onError(e,eJ,!0);return}if(!(A(s=n)&&A(s.source)&&null!=(u=s.source.id)&&A(s.source.config)&&Array.isArray(s.source.destinations)))return void this.onError(Error(eJ),void 0,!0);if(!1===n.source.enabled)return void this.logger?.error("The source is disabled. Please enable the source in the dashboard to send events.");r=n,tv.reporting.isErrorReportingEnabled.value=(o=r.source.config,o?.statsCollection?.errors?.enabled===!0&&!(window.chrome&&window.chrome.runtime&&window.chrome.runtime.id)),tv.reporting.isMetricsReportingEnabled.value=(a=r.source.config,a?.statsCollection?.metrics?.enabled===!0);let c=n.source.destinations.length>0?(i=n.source.destinations,l=[],i.forEach(e=>{e.enabled&&!e.deleted&&l.push({id:e.id,displayName:e.destinationDefinition.displayName,config:e.config,shouldApplyDeviceModeTransformation:e.shouldApplyDeviceModeTransformation||!1,propagateEventsUntransformedOnError:e.propagateEventsUntransformedOnError||!1,userFriendlyId:`${e.destinationDefinition.displayName.replaceAll(" ","-")}___${e.id}`})}),l):[];eA(()=>{var e;let t,r;tv.source.value={config:n.source.config,id:n.source.id,workspaceId:n.source.workspaceId},tv.nativeDestinations.configuredDestinations.value=c,tv.plugins.pluginsToLoadFromConfig.value=tv.loadOptions.value.plugins??[],e=n,r=tv.consents.resolutionStrategy.value,A(e.consentManagementMetadata)&&(tv.consents.provider.value&&(r=e.consentManagementMetadata.providers.find(e=>e.provider===tv.consents.provider.value)?.resolutionStrategy??tv.consents.resolutionStrategy.value),t=e.consentManagementMetadata),"custom"===tv.consents.provider.value&&(r=void 0),eA(()=>{tv.consents.metadata.value=v(t),tv.consents.resolutionStrategy.value=r}),tv.lifecycle.status.value="configured"})}getConfig(){let e=tv.loadOptions.value.getSourceConfig;if(e){if(!k(e))throw Error('"getSourceConfig" must be a function. Please make sure that it is defined and returns a valid source configuration object.');let t=e();t instanceof Promise?t.then(e=>this.processConfig(e)).catch(e=>{this.onError(e,"SourceConfig")}):this.processConfig(t)}else this.httpClient.getAsyncData({url:tv.lifecycle.sourceConfigUrl.value,options:{headers:{"Content-Type":void 0}},callback:this.processConfig})}}let ry=()=>document?.referrer||"$direct",rm=()=>{let e=(()=>{let e=document.getElementsByTagName("link"),t="";for(let r=0;e[r];r+=1){let i=e[r];if("canonical"===i.getAttribute("rel")&&!t){t=i.getAttribute("href")??"";break}}return t})(),t=globalThis.location.pathname,{href:r}=globalThis.location,i=r,{search:n}=globalThis.location;if(e)try{let r=new URL(e);i=""===r.search?e+n:e,t=r.pathname}catch(e){}let s=(e=>{let t=e;try{let r=new URL(e);t=r.origin+r.pathname+r.search}catch(e){}return t})(i),{title:o}=document,a=ry();return{path:t,referrer:a,referring_domain:ru(a)??"",search:n,title:o,url:s,tab_url:r}},rb=`https://polyfill-fastly.io/v3/polyfill.min.js?version=3.111.0&features=${Object.keys(t1).join("%2C")}`,rE="rudderstackPolyfill";class rk{constructor(e,t){this.logger=t,this.errorHandler=e,this.externalSrcLoader=new eS(this.errorHandler,this.logger),this.onError=this.onError.bind(this),this.onReady=this.onReady.bind(this)}init(){try{this.prepareBrowserCapabilities(),this.attachWindowListeners()}catch(e){this.onError(e)}}detectBrowserCapabilities(){eA(()=>{let e,t,r;tv.capabilities.storage.isCookieStorageAvailable.value=t6(tj,rn(tj),this.logger),tv.capabilities.storage.isLocalStorageAvailable.value=t6(tH,void 0,this.logger),tv.capabilities.storage.isSessionStorageAvailable.value=t6(t_,void 0,this.logger),tv.capabilities.isBeaconAvailable.value=null!=(t=globalThis.navigator.sendBeacon)&&k(globalThis.navigator.sendBeacon),tv.capabilities.isUaCHAvailable.value=t0(),tv.capabilities.isCryptoAvailable.value=null!=(r=globalThis.crypto)&&k(globalThis.crypto.getRandomValues),tv.capabilities.isIE11.value=!!globalThis.navigator.userAgent.match(/Trident.*rv:11\./),tv.capabilities.isOnline.value=globalThis.navigator.onLine,tv.context.userAgent.value=(()=>
2{if(void 0===globalThis.navigator)return null;let{userAgent:e}=globalThis.navigator,{brave:t}=globalThis.navigator;if(t&&Object.getPrototypeOf(t).isBrave){let t=e.match(/(chrome)\/([\w.]+)/i);t&&(e=`${e} Brave/${t[2]}`)}return e})(),tv.context.locale.value=void 0===globalThis.navigator?null:globalThis.navigator.language??globalThis.navigator.browserLanguage,tv.context.screen.value=t2(),tv.context.timezone.value=(e=new Date().toString().match(/([A-Z]+[+-]\d+)/))&&e[1]?e[1]:"NA",t0()&&((e,t="none")=>{"none"===t&&e(void 0),"default"===t&&e(navigator.userAgentData),"full"===t&&navigator.userAgentData?.getHighEntropyValues(["architecture","bitness","brands","mobile","model","platform","platformVersion","uaFullVersion","fullVersionList","wow64"]).then(t=>{e(t)}).catch(()=>{e()})})(e=>{tv.context["ua-ch"].value=e},tv.loadOptions.value.uaChTrackLevel)}),eF(()=>{var e,t;let r,i,n;!0===tv.loadOptions.value.sendAdblockPage&&void 0!==tv.lifecycle.sourceConfigUrl.value&&(e=this.errorHandler,t=this.logger,r=new URL(tv.lifecycle.sourceConfigUrl.value),i=`${r.origin}${r.pathname}?view=ad`,(n=new tU(e,t)).setAuthHeader(tv.lifecycle.writeKey.value),n.getAsyncData({url:i,options:{method:"HEAD",headers:{"Content-Type":void 0}},isRawResponse:!0,callback:(e,t)=>{tv.capabilities.isAdBlocked.value=t?.error!==void 0||t?.xhr?.responseURL!==i}}))})}prepareBrowserCapabilities(){tv.capabilities.isLegacyDOM.value=(()=>{let e=Object.keys(t1),t=!1;for(let r=0;r<e.length;r++){let i=t1[e[r]];if(k(i)&&i()){t=!0;break}}return t})();let e=tv.loadOptions.value.polyfillURL,t=rb;if(I(e))if(rc(e))t=e;else this.logger?.warn(`${x}:: The provided polyfill URL "${e}" is invalid. The default polyfill URL will be used instead.`);if(tv.loadOptions.value.polyfillIfRequired&&tv.capabilities.isLegacyDOM.value&&rc(t)){let e=t!==tv.loadOptions.value.polyfillURL;if(e){let e=`RS_polyfillCallback_${tv.lifecycle.writeKey.value}`,r=()=>{this.onReady(),delete globalThis[e]};globalThis[e]=r,t=`${t}&callback=${e}`}this.externalSrcLoader.loadJSFile({url:t,id:rE,async:!0,timeout:1e4,callback:r=>{if(r)e||this.onReady();else{let e;this.onError(Error((e=t,`Failed to load the polyfill script with ID "${rE}" from URL ${e}.`)))}}})}else this.onReady()}attachWindowListeners(){globalThis.addEventListener("offline",()=>{tv.capabilities.isOnline.value=!1}),globalThis.addEventListener("online",()=>{tv.capabilities.isOnline.value=!0}),globalThis.addEventListener("resize",function(e,t,r=250){let i;return(...n)=>{globalThis.clearTimeout(i),i=globalThis.setTimeout(()=>{e.apply(t,n)},r)}}(()=>{tv.context.screen.value=t2()},this))}onReady(){this.detectBrowserCapabilities(),tv.lifecycle.status.value="browserCapabilitiesReady"}onError(e){if(this.errorHandler)this.errorHandler.onError(e,x);else throw e}}let rS=["integrations","anonymousId","originalTimestamp"],rI=["library","consentManagement","userAgent","ua-ch","screen"],rT=["id","anonymous_id","user_id","sent_at","timestamp","received_at","original_timestamp","event","event_text","channel","context_ip","context_request_ip","context_passed_ip","group_id","previous_id"],rA=e=>"number"==typeof e&&!Number.isNaN(e),rw=e=>rA(e)&&e>=0&&Number.isInteger(e),rP=e=>{let t=Date.now();return!!(!e||t>e)},rC=e=>e===tj||e===tH||e===t_||e===tF,rR=(e,t,r)=>{A(e)&&Object.keys(e).forEach(e=>{(rT.includes(e)||rT.includes(e.toLowerCase()))&&r?.warn(`${H}:: The "${e}" property defined under "${t}" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (${rT}).`)})},rD=(e,t,r,i)=>{var n;let s,o,a={channel:"web",context:{traits:v(tv.session.userTraits.value),sessionId:tv.session.sessionInfo.value.id||void 0,sessionStart:tv.session.sessionInfo.value.sessionStart||void 0,...tv.consents.enabled.value&&{consentManagement:{deniedConsentIds:v(tv.consents.data.value.deniedConsentIds),allowedConsentIds:v(tv.consents.data.value.allowedConsentIds),provider:tv.consents.provider.value,resolutionStrategy:tv.consents.resolutionStrategy.value}},"ua-ch":tv.context["ua-ch"].value,app:tv.context.app.value,library:tv.context.library.value,userAgent:tv.context.userAgent.value,os:tv.context.os.value,locale:tv.context.locale.value,screen:tv.context.screen.value,campaign:(e=>{let t={};try{let r=new URL(e),i="utm_";
2r.searchParams.forEach((e,r)=>{if(r.startsWith(i)){let n=r.substring(i.length);"campaign"===n&&(n="name"),t[n]=e}})}catch(e){}return t})(globalThis.location.href),page:(s=rm(),o={},Object.keys(s).forEach(e=>{o[e]=r?.[e]||s[e]}),o.initial_referrer=r?.initial_referrer||tv.session.initialReferrer.value,o.initial_referring_domain=r?.initial_referring_domain||tv.session.initialReferringDomain.value,o),timezone:tv.context.timezone.value,...tv.autoTrack.enabled.value&&{autoTrack:{...tv.autoTrack.pageLifecycle.enabled.value&&{page:{visitId:tv.autoTrack.pageLifecycle.visitId.value}}}}},originalTimestamp:new Date().toISOString(),messageId:ee(),userId:e.userId||tv.session.userId.value};rC(tv.storage.entries.value.anonymousId?.type)?a.anonymousId=tv.session.anonymousId.value:a.anonymousId=ee(),tv.storage.trulyAnonymousTracking.value&&(a.context.trulyAnonymousTracking=!0),"identify"===e.type&&(a.context.traits=tv.storage.entries.value.userTraits?.type!==tQ?v(tv.session.userTraits.value):e.context.traits),"group"===e.type&&((e.groupId||tv.session.groupId.value)&&(a.groupId=e.groupId||tv.session.groupId.value),(e.traits||tv.session.groupTraits.value)&&(a.traits=tv.storage.entries.value.groupTraits?.type!==tQ?v(tv.session.groupTraits.value):e.traits));let l=P(e,a);return void 0===l.event&&(l.event=null),void 0===l.properties&&(l.properties=null),((e,t)=>{if(A(t)){var r;let i;t.anonymousId&&"string"==typeof t.anonymousId&&(e.anonymousId=t.anonymousId),C(t.integrations)&&(e.integrations=t.integrations),t.originalTimestamp&&"string"==typeof t.originalTimestamp&&(e.originalTimestamp=t.originalTimestamp),r=e.context,i=r,Object.keys(t).forEach(e=>{if(!rS.includes(e)&&!rI.includes(e)){if("context"!==e)i=P(i,{[e]:t[e]});else if(void 0!==t[e]&&A(t[e])){let r={};Object.keys(t[e]).forEach(i=>{rI.includes(i)||(r[i]=t[e][i])}),i=P(i,{...r})}}}),e.context=i}})(l,t),((e,t)=>{let{properties:r,traits:i,context:n}=e,{traits:s}=n;rR(r,"properties",t),rR(i,"traits",t),rR(s,"context.traits",t)})(l,i),n=l.integrations,l.integrations=v(tv.loadOptions.value.useGlobalIntegrationsConfigInEvents?tv.consents.postConsent.value.integrations??tv.nativeDestinations.loadOnlyIntegrations.value:n||eY),l};class rO{constructor(e){this.logger=e}generatePageEvent(e,t,r,i){var n,s;let o,a,l=r??{};return rD({properties:(n=l,s=i,o=s?.page||{},Object.keys(a=rm()).forEach(e=>{void 0===n[e]&&(n[e]=o[e]||a[e])}),void 0===n.initial_referrer&&(n.initial_referrer=o.initial_referrer||tv.session.initialReferrer.value),void 0===n.initial_referring_domain&&(n.initial_referring_domain=o.initial_referring_domain||tv.session.initialReferringDomain.value),l=n),name:t,category:e,type:"page"},i,l,this.logger)}generateTrackEvent(e,t,r){return rD({properties:t,event:e,type:"track"},r,void 0,this.logger)}generateIdentifyEvent(e,t,r){return rD({userId:e,type:"identify",context:{traits:t}},r,void 0,this.logger)}generateAliasEvent(e,t,r){let i=rD({previousId:t,type:"alias"},r,void 0,this.logger);return i.userId=e??i.userId,i}generateGroupEvent(e,t,r){let i={type:"group"};return e&&(i.groupId=e),t&&(i.traits=t),rD(i,r,void 0,this.logger)}create(e){let t;switch(e.type){case"page":t=this.generatePageEvent(e.category,e.name,e.properties,e.options);break;case"track":t=this.generateTrackEvent(e.name,e.properties,e.options);break;case"identify":t=this.generateIdentifyEvent(e.userId,e.traits,e.options);break;case"alias":t=this.generateAliasEvent(e.to,e.from,e.options);break;case"group":t=this.generateGroupEvent(e.groupId,e.traits,e.options)}return t}}
2class r${constructor(e,t,r,i){this.eventRepository=e,this.userSessionManager=t,this.errorHandler=r,this.logger=i,this.eventFactory=new rO(this.logger),this.onError=this.onError.bind(this)}init(){this.eventRepository.init()}resume(){this.eventRepository.resume()}addEvent(e){this.userSessionManager.refreshSession();let t=this.eventFactory.create(e);t?this.eventRepository.enqueue(t,e.callback):this.onError(Error("Failed to generate the event object."))}onError(e,t,r){if(this.errorHandler)this.errorHandler.onError(e,H,t,r);else throw e}}class rL{constructor(e,t,r,i,n){this.storeManager=i,this.pluginsManager=r,this.logger=t,this.errorHandler=e,this.httpClient=n,this.onError=this.onError.bind(this),this.serverSideCookieDebounceFuncs={}}init(){this.syncStorageDataToState(),this.registerEffects()}syncStorageDataToState(){let e;this.migrateStorageIfNeeded(),this.migrateDataFromPreviousStorage(),this.setUserId(this.getUserId()),this.setUserTraits(this.getUserTraits()),this.setGroupId(this.getGroupId()),this.setGroupTraits(this.getGroupTraits());let{externalAnonymousIdCookieName:t,anonymousIdOptions:r}=tv.loadOptions.value;I(t)&&"string"==typeof t&&(e=this.getExternalAnonymousIdByCookieName(t)),this.setAnonymousId(e??this.getAnonymousId(r)),this.setAuthToken(this.getAuthToken()),this.setInitialReferrerInfo(),this.configureSessionTracking()}configureSessionTracking(){let e=this.getSessionInfo();if(this.isPersistenceEnabledForStorageEntry("sessionInfo")){let t=this.getConfiguredSessionTrackingInfo(),r=e??ts;(e={...r,...t,autoTrack:t.autoTrack&&!0!==r.manualTrack}).autoTrack||!0===e.manualTrack||(e=tn)}else e=tn;tv.session.sessionInfo.value=e,tv.session.sessionInfo.value.autoTrack&&this.startOrRenewAutoTracking(tv.session.sessionInfo.value)}setInitialReferrerInfo(){let e=this.getInitialReferrer(),t=this.getInitialReferringDomain();if(e&&t)this.setInitialReferrer(e),this.setInitialReferringDomain(t);else{let t=e||ry();this.setInitialReferrer(t),this.setInitialReferringDomain(ru(t)??"")}}isPersistenceEnabledForStorageEntry(e){return rC(tv.storage.entries.value[e]?.type)}migrateDataFromPreviousStorage(){let e=tv.storage.entries.value,t=[tj,tH,t_];Object.keys(e).forEach(r=>{let i=e[r]?.type,n=this.storeManager?.getStore(tW[i]);n&&t.forEach(e=>{let t=this.storeManager?.getStore(tW[e]);if(t&&e!==i){let e=t.get(tG[r]);I(e)&&""!==e&&n.set(tG[r],e),t.remove(tG[r])}})})}migrateStorageIfNeeded(){if(!tv.storage.migrate.value)return;let e=[];
2[tz,tK,tV].forEach(t=>{let r=this.storeManager?.getStore(t);r&&e.push(r)}),Object.keys(tG).forEach(t=>{let r=tG[t];e.forEach(e=>{let t=this.pluginsManager?.invokeSingle("storage.migrate",r,e.engine,this.errorHandler,this.logger);null==t||e.set(r,t)})})}getConfiguredSessionTrackingInfo(){let e,t,r=tv.loadOptions.value.sessions?.autoTrack!==!1;if(!r)return{autoTrack:r};let i=tv.loadOptions.value.sessions?.timeout;if(rw(i))t=i;else this.logger?.warn(`${F}:: The session timeout value "${i}" is not a number. The default timeout of 1800000 ms will be used instead.`),t=18e5;0===t&&(this.logger?.warn(`${F}:: The session timeout value is 0, which disables the automatic session tracking feature. If you want to enable session tracking, please provide a positive integer value for the timeout.`),r=!1);return t>0&&t<1e4&&this.logger?.warn((e=t,`${F}:: The session timeout value ${e} ms is less than the recommended minimum of 10000 ms. Please consider increasing the timeout value to ensure optimal performance and reliability.`)),{timeout:t,autoTrack:r}}onError(e,t){if(this.errorHandler)this.errorHandler.onError(e,F,t);else throw e}getEncryptedCookieData(e,t){let r=[];return e.forEach(e=>{let i=t?.encrypt(ei(e.value,!1,[],this.logger));I(i)&&r.push({name:e.name,value:i})}),r}makeRequestToSetCookie(e,t){this.httpClient?.getAsyncData({url:tv.serverCookies.dataServiceUrl.value,options:{method:"POST",data:ei({reqType:"setCookies",workspaceId:tv.source.value?.workspaceId,data:{options:{maxAge:tv.storage.cookie.value?.maxage,path:tv.storage.cookie.value?.path,domain:tv.storage.cookie.value?.domain,sameSite:tv.storage.cookie.value?.samesite,secure:tv.storage.cookie.value?.secure,expires:tv.storage.cookie.value?.expires},cookies:e}}),sendRawData:!0,withCredentials:!0},isRawResponse:!0,callback:t})}setServerSideCookies(e,t,r){try{let i=this.getEncryptedCookieData(e,r);i.length>0&&this.makeRequestToSetCookie(i,(i,n)=>{if(n?.xhr?.status===200)e.forEach(e=>{let i=r?.get(e.name),n=ei(e.value,!1,[]);if(ei(i,!1,[])!==n){let r;this.logger?.error((r=e.name,`The server failed to set the ${r} cookie. As a fallback, the cookies will be set client side.`)),t&&t(e.name,e.value)}});else{let r;this.logger?.error((r=n?.xhr?.status,`The server responded with status ${r} while setting the cookies. As a fallback, the cookies will be set client side.`)),e.forEach(e=>{t&&t(e.name,e.value)})}})}catch(r){this.onError(r,"Failed to set/remove cookies via server. As a fallback, the cookies will be managed client side."),e.forEach(e=>{t&&t(e.name,e.value)})}}syncValueToStorage(e,t){let r=tv.storage.entries.value,i=r[e]?.type;if(rC(i)){let n=this.storeManager?.getStore(tW[i]),s=r[e]?.key;t&&("string"==typeof t||C(t))?tv.serverCookies.isEnabledServerSideCookies.value&&i===tj?(this.serverSideCookieDebounceFuncs[e]&&globalThis.clearTimeout(this.serverSideCookieDebounceFuncs[e]),this.serverSideCookieDebounceFuncs[e]=globalThis.setTimeout(()=>{this.setServerSideCookies([{name:s,value:t}],(e,t)=>{n?.set(e,t)},n)},10)):n?.set(s,t):n?.remove(s)}}registerEffects(){tq.forEach(e=>{eF(()=>{this.syncValueToStorage(e,tv.session[e].value)})})}setAnonymousId(e,t){let r=e;"string"==typeof e&&r||(r=void 0),this.isPersistenceEnabledForStorageEntry("anonymousId")?(!r&&t&&(r=this.pluginsManager?.invokeSingle("userSession.anonymousIdGoogleLinker",t)),r=r||ee()):r="",tv.session.anonymousId.value=r}getAnonymousId(e){if(rC(tv.storage.entries.value.anonymousId?.type)){let t=this.getEntryValue("anonymousId");!t&&e&&(t=this.pluginsManager?.invokeSingle("storage.getAnonymousId",rn,e)),tv.session.anonymousId.value=t||ee()}return tv.session.anonymousId.value}getEntryValue(e){let t=tv.storage.entries.value,r=t[e]?.type;if(rC(r)){let i=this.storeManager?.getStore(tW[r]),n=t[e]?.key;return i?.get(n)??null}return null}getExternalAnonymousIdByCookieName(e){let t=rn(tj);return t?.isEnabled?t.getItem(e)??null:null}getUserId(){return this.getEntryValue("userId")}getUserTraits(){return this.getEntryValue("userTraits")}getGroupId(){return this.getEntryValue("groupId")}getGroupTraits(){return this.getEntryValue("groupTraits")}getInitialReferrer(){return this.getEntryValue("initialReferrer")}getInitialReferringDomain(){return this.getEntryValue("initialReferringDomain")}getSessionInfo(){return this.getEntryValue("sessionInfo")}getAuthToken(){return this.getEntryValue("authToken")}getSessionId(){let e=this.getSessionInfo()??tn;return e.autoTrack&&!rP(e.expiresAt)||e.manualTrack?e.id??null:null}refreshSession(){let e=this.getSessionInfo()??tn;(e.autoTrack||e.manualTrack)&&(e.autoTrack&&(this.startOrRenewAutoTracking(e),e=tv.session.sessionInfo.value),void 0===e.sessionStart?e={...e,sessionStart:!0}:e.sessionStart&&(e={...e,sessionStart:!1})),tv.session.sessionInfo.value=e,"readyExecuted"!==tv.lifecycle.status.value&&this.syncValueToStorage("sessionInfo",e)}reset(e,t){let{session:r}=tv,{manualTrack:i,autoTrack:n}=r.sessionInfo.value;eA(()=>{r.userId.value="",r.userTraits.value=tr,r.groupId.value="",r.groupTraits.value=ti,r.authToken.value=null,!0===e&&this.setAnonymousId(),!t&&(n?(r.sessionInfo.value=tn,this.startOrRenewAutoTracking(r.sessionInfo.value)):i&&this.startManualTrackingInternal())})}setUserId(e){tv.session.userId.value=this.isPersistenceEnabledForStorageEntry("userId")&&e?e:""}setUserTraits(e){tv.session.userTraits.value=this.isPersistenceEnabledForStorageEntry("userTraits")&&A(e)?P(tv.session.userTraits.value??tr,e):tr}setGroupId(e){tv.session.groupId.value=this.isPersistenceEnabledForStorageEntry("groupId")&&e?e:""}setGroupTraits(e){tv.session.groupTraits.value=this.isPersistenceEnabledForStorageEntry("groupTraits")&&A(e)?P(tv.session.groupTraits.value??ti,e):ti}setInitialReferrer(e){tv.session.initialReferrer.value=this.isPersistenceEnabledForStorageEntry("initialReferrer")&&e?e:""}setInitialReferringDomain(e){tv.session.initialReferringDomain.value=this.isPersistenceEnabledForStorageEntry("initialReferringDomain")&&e?e:""}startOrRenewAutoTracking(e){if(rP(e.expiresAt)){var t;let r,i;tv.session.sessionInfo.value=(t=e.timeout,r=Date.now(),{id:r,expiresAt:r+(i=t||18e5),timeout:i,sessionStart:void 0,autoTrack:!0})}else{let t=Date.now(),r=e.timeout;tv.session.sessionInfo.value=P(e,{expiresAt:t+r})}}start(e){tv.session.sessionInfo.value={id:((e,t)=>{if(!e||!rw(e)||!(e.toString().length>=10))return t?.warn(`${F}:: The provided session ID (${e}) is either invalid, not a positive integer, or not at least "10" digits long. A new session ID will be auto-generated instead.`),!1;return!0})(e,this.logger)?e:Date.now(),sessionStart:void 0,manualTrack:!0}}startManualTrackingInternal(){this.start(Date.now())}end(){tv.session.sessionInfo.value=tn}setAuthToken(e){tv.session.authToken.value=this.isPersistenceEnabledForStorageEntry("authToken")&&e?e:null}}let rM=["BeaconQueue","Bugsnag","CustomConsentManager","DeviceModeDestinations","DeviceModeTransformation","ErrorReporting","ExternalAnonymousId","GoogleLinker","IubendaConsentManager","KetchConsentManager","NativeDestinationQueue","OneTrustConsentManager","StorageEncryption","StorageEncryptionLegacy","StorageMigrator","XhrQueue"],rB="dataplaneEventsQueue",rN="destinationsEventsQueue";
2class rU{constructor(e,t,r,i){this.pluginsManager=e,this.errorHandler=r,this.logger=i,this.httpClient=new tU(r,i),this.storeManager=t,this.onError=this.onError.bind(this)}init(){let e;try{this.dataplaneEventsQueue=this.pluginsManager.invokeSingle(`${rB}.init`,tv,this.httpClient,this.storeManager,this.errorHandler,this.logger)}catch(e){this.onError(e,"XhrQueuePlugin initialization failed")}try{this.dmtEventsQueue=this.pluginsManager.invokeSingle("transformEvent.init",tv,this.pluginsManager,this.httpClient,this.storeManager,this.errorHandler,this.logger)}catch(e){this.onError(e,"DeviceModeTransformationPlugin initialization failed")}try{this.destinationsEventsQueue=this.pluginsManager.invokeSingle(`${rN}.init`,tv,this.pluginsManager,this.storeManager,this.dmtEventsQueue,this.errorHandler,this.logger)}catch(e){this.onError(e,"NativeDestinationQueuePlugin initialization failed")}eF(()=>{!0===tv.nativeDestinations.clientDestinationsReady.value&&(this.destinationsEventsQueue?.start(),this.dmtEventsQueue?.start())});let t=tv.consents.preConsent.value.enabled&&tv.consents.preConsent.value.events?.delivery==="buffer"&&(tv.consents.preConsent.value.storage?.strategy==="session"||tv.consents.preConsent.value.storage?.strategy==="none");eF(()=>{let r=!0===tv.loadOptions.value.bufferDataPlaneEventsUntilReady&&!1===tv.nativeDestinations.clientDestinationsReady.value;!1!==tv.nativeDestinations.activeDestinations.value.some(e=>"hybrid"===e.config.connectionMode||!0===e.config.useNativeSDKToSend)&&!1!==r||t||this.dataplaneEventsQueue?.scheduleTimeoutActive===!0||(globalThis.clearTimeout(e),this.dataplaneEventsQueue?.start())}),!0===tv.loadOptions.value.bufferDataPlaneEventsUntilReady&&(e=globalThis.setTimeout(()=>{this.dataplaneEventsQueue?.scheduleTimeoutActive!==!0&&this.dataplaneEventsQueue?.start()},tv.loadOptions.value.dataPlaneEventsBufferTimeout))}resume(){this.dataplaneEventsQueue?.scheduleTimeoutActive!==!0&&(tv.consents.postConsent.value.discardPreConsentEvents&&(this.dataplaneEventsQueue?.clear(),this.destinationsEventsQueue?.clear()),this.dataplaneEventsQueue?.start())}enqueue(e,t){let r;try{let t,i,n,s;t=v(e),i=tv.nativeDestinations.integrationsConfig.value,n=e.integrations,s=Object.keys(n).filter(e=>!0!==n[e]||!i[e]).reduce((e,t)=>{let r=v(e);return r[t]=n[t],r},{}),t.integrations=P(i,s),r=t,this.pluginsManager.invokeSingle(`${rB}.enqueue`,tv,this.dataplaneEventsQueue,r,this.errorHandler,this.logger)}catch(e){this.onError(e,"XhrQueuePlugin event enqueue failed")}try{let t=v(e);this.pluginsManager.invokeSingle(`${rN}.enqueue`,tv,this.destinationsEventsQueue,t,this.errorHandler,this.logger)}catch(e){this.onError(e,"NativeDestinationQueuePlugin event enqueue failed")}try{t?.(r)}catch(e){this.onError(e,"API Callback Invocation Failed")}}onError(e,t,r){if(this.errorHandler)this.errorHandler.onError(e,"EventRepository",t,r);else throw e}}let rx=e=>{let t=new CustomEvent(e,{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:!0,cancelable:!0,composed:!0});globalThis.document.dispatchEvent(t)};class rj{constructor(){this.preloadBuffer=new eQ,this.initialized=!1,this.errorHandler=tb,this.logger=eK,this.externalSrcLoader=new eS(this.errorHandler,this.logger),this.capabilitiesManager=new rk(this.errorHandler,this.logger),this.httpClient=tx}load(e,t,r={}){if(!tv.lifecycle.status.value){let i;if(!("string"==typeof(i=e)&&i.trim().length>0))return void this.logger.error(`${K}:: The write key "${e}" is invalid. It must be a non-empty string. Please check that the write key is correct and try again.`);if(!rc(t))return void this.logger.error(`${K}:: The data plane URL "${t}" is invalid. It must be a valid URL string. Please check that the data plane URL is correct and try again.`);eA(()=>{var i;let n;tv.lifecycle.writeKey.value=v(e),tv.lifecycle.dataPlaneUrl.value=v(t),tv.loadOptions.value=(i=tv.loadOptions.value,"string"!=typeof(n=v(r)).setCookieDomain&&delete n.setCookieDomain,["Strict","Lax","None"].includes(n.sameSiteCookie)||delete n.sameSiteCookie,n.secureCookie=!0===n.secureCookie,n.sameDomainCookiesOnly=!0===n.sameDomainCookiesOnly,["none","default","full"].includes(n.uaChTrackLevel)||delete n.uaChTrackLevel,C(n.integrations)||delete n.integrations,n.plugins=n.plugins??rM,n.useGlobalIntegrationsConfigInEvents=!0===n.useGlobalIntegrationsConfigInEvents,n.bufferDataPlaneEventsUntilReady=!0===n.bufferDataPlaneEventsUntilReady,n.sendAdblockPage=!0===n.sendAdblockPage,n.useServerSideCookies=!0===n.useServerSideCookies,n.dataServiceEndpoint&&"string"!=typeof n.dataServiceEndpoint&&delete n.dataServiceEndpoint,A(n.sendAdblockPageOptions)||delete n.sendAdblockPageOptions,S(n.loadIntegration)?n.loadIntegration=!0===n.loadIntegration:delete n.loadIntegration,A(n.storage)?(n.storage=D(n.storage),n.storage.migrate=n.storage?.migrate===!0):delete n.storage,A(n.beaconQueueOptions)?n.beaconQueueOptions=D(n.beaconQueueOptions):delete n.beaconQueueOptions,A(n.destinationsQueueOptions)?n.destinationsQueueOptions=D(n.destinationsQueueOptions):delete n.destinationsQueueOptions,A(n.queueOptions)?n.queueOptions=D(n.queueOptions):delete n.queueOptions,n.lockIntegrationsVersion=!0===n.lockIntegrationsVersion,n.lockPluginsVersion=!0===n.lockPluginsVersion,rA(n.dataPlaneEventsBufferTimeout)||delete n.dataPlaneEventsBufferTimeout,A(n.storage?.cookie)?n.storage.cookie=D(n.storage?.cookie):delete n.storage?.cookie,A(n.preConsent)?n.preConsent=D(n.preConsent):delete n.preConsent,P(i,n)),tv.lifecycle.status.value="mounted"}),this.logger?.setMinLogLevel(tv.loadOptions.value.logLevel??"ERROR"),em("state",tv,e),this.startLifecycle()}}startLifecycle(){eF(()=>{try{switch(tv.lifecycle.status.value){case"mounted":this.onMounted();break;case"browserCapabilitiesReady":this.onBrowserCapabilitiesReady();break;case"configured":this.onConfigured();break;case"pluginsLoading":case"destinationsLoading":break;case"pluginsReady":this.onPluginsReady();break;case"initialized":this.onInitialized();break;case"loaded":this.onLoaded();break;
2case"destinationsReady":this.onDestinationsReady();break;case"ready":this.onReady()}}catch(e){this.errorHandler.onError(ea(e,"Failed to load the SDK"),K)}})}onBrowserCapabilitiesReady(){let e;((e=[])=>{let t=new URLSearchParams(globalThis.location.search);t.get(ev)&&e.unshift(["track",t.get(ev),eE(t,"ajs_prop_")]),t.get(ep)&&e.unshift(["identify",t.get(ep),eE(t,"ajs_trait_")]),t.get(eh)&&e.unshift(["setAnonymousId",t.get(eh)])})(e=eb(eg)||[]),e.length>0&&(this.enqueuePreloadBufferEvents(e),em(eg,[])),this.prepareInternalServices(),this.loadConfig()}onLoaded(){this.processBufferedEvents(),!0===tv.consents.preConsent.value.enabled?tv.lifecycle.status.value="ready":this.loadDestinations()}onMounted(){this.capabilitiesManager.init()}enqueuePreloadBufferEvents(e){Array.isArray(e)&&e.forEach(e=>this.preloadBuffer.enqueue(v(e)))}processDataInPreloadBuffer(){for(;this.preloadBuffer.size()>0;){let e=this.preloadBuffer.dequeue();e&&ek([...e],this)}}prepareInternalServices(){this.pluginsManager=new tO(ty,this.errorHandler,this.logger),this.storeManager=new ro(this.pluginsManager,this.errorHandler,this.logger),this.configManager=new rf(this.httpClient,this.errorHandler,this.logger),this.userSessionManager=new rL(this.errorHandler,this.logger,this.pluginsManager,this.storeManager,this.httpClient),this.eventRepository=new rU(this.pluginsManager,this.storeManager,this.errorHandler,this.logger),this.eventManager=new r$(this.eventRepository,this.userSessionManager,this.errorHandler,this.logger)}loadConfig(){tv.lifecycle.writeKey.value&&this.httpClient.setAuthHeader(tv.lifecycle.writeKey.value),this.configManager?.init()}onPluginsReady(){this.errorHandler.init(this.httpClient,this.externalSrcLoader),this.storeManager?.init(),this.userSessionManager?.init(),tv.consents.enabled.value&&!tv.consents.initialized.value&&(this.pluginsManager?.invokeSingle("consentManager.init",tv,this.logger),!1===tv.consents.preConsent.value.enabled&&this.pluginsManager?.invokeSingle("consentManager.updateConsentsInfo",tv,this.storeManager,this.logger)),this.eventManager?.init(),tv.lifecycle.status.value="initialized"}onConfigured(){this.pluginsManager?.init()}onInitialized(){this.processDataInPreloadBuffer(),k(tv.loadOptions.value.onLoaded)&&tv.loadOptions.value.onLoaded(globalThis.rudderanalytics),eA(()=>{tv.lifecycle.loaded.value=!0,tv.lifecycle.status.value="loaded"}),this.initialized=!0,rx("RSA_Initialised")}onReady(){tv.lifecycle.status.value="readyExecuted",tv.eventBuffer.readyCallbacksArray.value.forEach(e=>{try{e()}catch(e){this.errorHandler.onError(e,K,eZ)}}),rx("RSA_Ready")}processBufferedEvents(){let e=tv.eventBuffer.toBeProcessedArray.value;for(;e.length>0;){let t=e.shift();if(tv.eventBuffer.toBeProcessedArray.value=e,t){let e=t[0];k(this[e])&&this[e](...t.slice(1),!0)}e=tv.eventBuffer.toBeProcessedArray.value}}loadDestinations(){if(tv.nativeDestinations.clientDestinationsReady.value)return;this.pluginsManager?.invokeSingle("nativeDestinations.setActiveDestinations",tv,this.pluginsManager,this.errorHandler,this.logger);let e=tv.nativeDestinations.activeDestinations.value.length;if(0===e){tv.lifecycle.status.value="destinationsReady";return}tv.lifecycle.status.value="destinationsLoading",this.pluginsManager?.invokeSingle("nativeDestinations.load",tv,this.externalSrcLoader,this.errorHandler,this.logger),eF(()=>{(0===e||tv.nativeDestinations.initializedDestinations.value.length+tv.nativeDestinations.failedDestinations.value.length===e)&&eA(()=>{tv.lifecycle.status.value="destinationsReady",tv.nativeDestinations.clientDestinationsReady.value=!0})})}onDestinationsReady(){"ready"!==tv.lifecycle.status.value&&(tv.lifecycle.status.value="ready")}ready(e,t=!1){let r="ready";if(!tv.lifecycle.loaded.value){tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,[r,e]];return}if(this.errorHandler.leaveBreadcrumb(`New ${r} invocation`),!k(e))return void this.logger.error("readyApi:: The provided callback is not a function.");if("readyExecuted"===tv.lifecycle.status.value)try{e()}catch(e){this.errorHandler.onError(e,K,eZ)}else tv.eventBuffer.readyCallbacksArray.value=[...tv.eventBuffer.readyCallbacksArray.value,e]}page(e,t=!1){let r="page";if(!tv.lifecycle.loaded.value){tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} event`),tv.metrics.triggered.value+=1,this.eventManager?.addEvent({type:"page",category:e.category,name:e.name,properties:e.properties,options:e.options,callback:e.callback}),!0===tv.capabilities.isAdBlocked.value&&e.category!==ed&&this.page($(ed,"ad-block page request",{path:"/ad-blocked"},tv.loadOptions.value.sendAdblockPageOptions))}track(e,t=!1){let r="track";if(!tv.lifecycle.loaded.value){tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} event - ${e.name}`),tv.metrics.triggered.value+=1,this.eventManager?.addEvent({type:r,name:e.name||void 0,properties:e.properties,options:e.options,callback:e.callback})}identify(e,t=!1){let r="identify";if(!tv.lifecycle.loaded.value){tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} event`),tv.metrics.triggered.value+=1,e.userId&&tv.session.userId.value&&e.userId!==tv.session.userId.value&&this.reset(),null!==e.userId&&this.userSessionManager?.setUserId(e.userId),this.userSessionManager?.setUserTraits(e.traits),this.eventManager?.addEvent({type:r,userId:e.userId,traits:e.traits,options:e.options,callback:e.callback})}alias(e,t=!1){let r="alias";if(!tv.lifecycle.loaded.value){tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} event`),tv.metrics.triggered.value+=1;let i=e.from??this.userSessionManager?.getUserId()??this.userSessionManager?.getAnonymousId();this.eventManager?.addEvent({type:r,to:e.to,from:i,options:e.options,callback:e.callback})}group(e,t=!1){let r="group";if(!tv.lifecycle.loaded.value){tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} event`),tv.metrics.triggered.value+=1,null!==e.groupId&&this.userSessionManager?.setGroupId(e.groupId),this.userSessionManager?.setGroupTraits(e.traits),this.eventManager?.addEvent({type:r,groupId:e.groupId,traits:e.traits,options:e.options,callback:e.callback})}reset(e,t=!1){let r="reset";if(!tv.lifecycle.loaded.value){tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} invocation, resetAnonymousId: ${e}`),this.userSessionManager?.reset(e)}getAnonymousId(e){return this.userSessionManager?.getAnonymousId(e)}setAnonymousId(e,t,r=!1){let i="setAnonymousId";if(!tv.lifecycle.loaded.value){tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,[i,e,t]];return}this.errorHandler.leaveBreadcrumb(`New ${i} invocation`),this.userSessionManager?.setAnonymousId(e,t)}getUserId(){return tv.session.userId.value}getUserTraits(){return tv.session.userTraits.value}getGroupId(){return tv.session.groupId.value}getGroupTraits(){return tv.session.groupTraits.value}startSession(e,t=!1){let r="startSession";if(!tv.lifecycle.loaded.value){tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,[r,e]];return}this.errorHandler.leaveBreadcrumb(`New ${r} invocation`),this.userSessionManager?.start(e)}endSession(e=!1){let t="endSession";if(!tv.lifecycle.loaded.value){tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,[t]];return}this.errorHandler.leaveBreadcrumb(`New ${t} invocation`),this.userSessionManager?.end()}getSessionId(){return this.userSessionManager?.getSessionId()??null}consent(e,t=!1){if(!tv.lifecycle.loaded.value){tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,["consent",e]];return}this.errorHandler.leaveBreadcrumb("New consent invocation"),eA(()=>{tv.consents.preConsent.value={...tv.consents.preConsent.value,enabled:!1},tv.consents.postConsent.value=(e=>{let t={sendPageEvent:!1,trackConsent:!1,discardPreConsentEvents:!1};if(A(e)){let r=v(e);t.storage=r.storage,C(r.integrations)&&(t.integrations=r.integrations),t.discardPreConsentEvents=!0===r.discardPreConsentEvents,t.sendPageEvent=!0===r.sendPageEvent,t.trackConsent=!0===r.trackConsent,C(r.consentManagement)&&(t.consentManagement=P(r.consentManagement,{enabled:tv.consents.enabled.value}))}return t})(e);let{initialized:t,consentsData:r}=rp(tv.consents.postConsent.value.consentManagement,this.logger);tv.consents.initialized.value=t||tv.consents.initialized.value,tv.consents.data.value=r}),tv.consents.enabled.value&&!tv.consents.initialized.value&&this.pluginsManager?.invokeSingle("consentManager.updateConsentsInfo",tv,this.storeManager,this.logger),this.storeManager?.initializeStorageState(),this.userSessionManager?.syncStorageDataToState(),this.eventManager?.resume(),this.loadDestinations(),this.sendTrackingEvents(t)}sendTrackingEvents(e){if(tv.consents.postConsent.value.trackConsent){let t=L("Consent Management Interaction");e?tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,["track",t]]:this.track(t)}if(tv.consents.postConsent.value.sendPageEvent){let t=$();e?tv.eventBuffer.toBeProcessedArray.value=[...tv.eventBuffer.toBeProcessedArray.value,["page",t]]:this.page(t)}}setAuthToken(e){this.userSessionManager?.setAuthToken(e)}}class rH{static globalSingleton=null;analyticsInstances={};defaultAnalyticsKey="";logger=eK;constructor(){try{if(rH.globalSingleton)return rH.globalSingleton;tb.attachErrorListeners(),this.setDefaultInstanceKey=this.setDefaultInstanceKey.bind(this),this.getAnalyticsInstance=this.getAnalyticsInstance.bind(this),this.load=this.load.bind(this),this.ready=this.ready.bind(this),this.triggerBufferedLoadEvent=this.triggerBufferedLoadEvent.bind(this),this.page=this.page.bind(this),this.track=this.track.bind(this),this.identify=this.identify.bind(this),this.alias=this.alias.bind(this),this.group=this.group.bind(this),this.reset=this.reset.bind(this),this.getAnonymousId=this.getAnonymousId.bind(this),this.setAnonymousId=this.setAnonymousId.bind(this),this.getUserId=this.getUserId.bind(this),this.getUserTraits=this.getUserTraits.bind(this),this.getGroupId=this.getGroupId.bind(this),this.getGroupTraits=this.getGroupTraits.bind(this),this.startSession=this.startSession.bind(this),this.endSession=this.endSession.bind(this),this.get
2SessionId=this.getSessionId.bind(this),this.setAuthToken=this.setAuthToken.bind(this),this.consent=this.consent.bind(this),rH.globalSingleton=this,tv.autoTrack.pageLifecycle.visitId.value=ee(),tv.autoTrack.pageLifecycle.pageLoadedTimestamp.value=Date.now(),this.triggerBufferedLoadEvent(),globalThis.rudderanalytics=this}catch(e){el(e)}}setDefaultInstanceKey(e){"string"==typeof e&&e&&(this.defaultAnalyticsKey=e)}getAnalyticsInstance(e){try{let t,r=e;return t=r,"string"==typeof t&&r||(r=this.defaultAnalyticsKey),this.analyticsInstances[r]||(this.analyticsInstances[r]=new rj),this.analyticsInstances[r]}catch(e){el(e);return}}load(e,t,r){try{let i,n;if(this.analyticsInstances[e])return;this.setDefaultInstanceKey(e);let s=eb(eg);this.trackPageLifecycleEvents(s,r),i=s.filter(e=>"consent"===e[0]),n=s.filter(e=>"consent"!==e[0]),s.splice(0,s.length,...i,...n),em(eg,v(s)),this.analyticsInstances[e]=new rj,this.getAnalyticsInstance(e)?.load(e,t,es(r))}catch(e){el(e)}}trackPageLifecycleEvents(e,t){let{autoTrack:r,useBeacon:i}=t??{},{enabled:n=!1,options:s={},pageLifecycle:o}=r??{},{events:a=[U.LOADED,U.UNLOADED],enabled:l=n,options:u=s}=o??{};tv.autoTrack.pageLifecycle.enabled.value=l,tv.autoTrack.enabled.value=n||l,l&&(this.trackPageLoadedEvent(a,u,e),this.setupPageUnloadTracking(a,i,u))}trackPageLoadedEvent(e,t,r){(0===e.length||e.includes(U.LOADED))&&r.unshift(["track",U.LOADED,{},{...t,originalTimestamp:new Date(tv.autoTrack.pageLifecycle.pageLoadedTimestamp.value).toISOString()}])}setupPageUnloadTracking(e,t,r){(0===e.length||e.includes(U.UNLOADED))&&(!0===t?(e=>{let t=!1,r=!1;function i(){t||(t=!0,e(r),setTimeout(()=>{t=!1},0))}globalThis.addEventListener("beforeunload",()=>{r=!1,i()}),globalThis.addEventListener("blur",()=>{r=!0,i()}),globalThis.addEventListener("focus",()=>{t=!1}),document.addEventListener("pagehide",()=>{r="hidden"===document.visibilityState,i()}),document.addEventListener("visibilitychange",()=>{r=!0,"hidden"===document.visibilityState?i():t=!1})})(e=>{if(!1===e&&tv.lifecycle.loaded.value){let e=Date.now(),t=e-tv.autoTrack.pageLifecycle.pageLoadedTimestamp.value;this.track(U.UNLOADED,{visitDuration:t},{...r,originalTimestamp:new Date(e).toISOString()})}}):this.logger.warn('RudderStackAnalytics:: Page Unloaded event can only be tracked when the Beacon transport is active. Please enable "useBeacon" load API option.'))}triggerBufferedLoadEvent(){let e=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[],t=(e=>{let t=[],r=0;for(;r<e.length;){if(e[r]&&"load"===e[r][0]){t=v(e[r]),e.splice(r,1);break}r+=1}return t})(e);em(eg,v([...e])),t.length>0&&(t.shift(),this.load.apply(null,t))}ready(e){try{this.getAnalyticsInstance()?.ready(es(e))}catch(e){el(e)}}page(e,t,r,i,n){try{this.getAnalyticsInstance()?.page($(es(e),es(t),es(r),es(i),es(n)))}catch(e){el(e)}}track(e,t,r,i){try{this.getAnalyticsInstance()?.track(L(es(e),es(t),es(r),es(i)))}catch(e){el(e)}}identify(e,t,r,i){try{this.getAnalyticsInstance()?.identify(M(es(e),es(t),es(r),es(i)))}catch(e){el(e)}}alias(e,t,r,i){try{this.getAnalyticsInstance()?.alias(B(es(e),es(t),es(r),es(i)))}catch(e){el(e)}}group(e,t,r,i){try{this.getAnalyticsInstance()?.group(N(es(e),es(t),es(r),es(i)))}catch(e){el(e)}}reset(e){try{this.getAnalyticsInstance()?.reset(es(e))}catch(e){el(e)}}getAnonymousId(e){try{return this.getAnalyticsInstance()?.getAnonymousId(es(e))}catch(e){el(e);return}}setAnonymousId(e,t){try{this.getAnalyticsInstance()?.setAnonymousId(es(e),es(t))}catch(e){el(e)}}getUserId(){try{return this.getAnalyticsInstance()?.getUserId()}catch(e){el(e);return}}getUserTraits(){try{return this.getAnalyticsInstance()?.getUserTraits()}catch(e){el(e);return}}getGroupId(){try{return this.getAnalyticsInstance()?.getGroupId()}catch(e){el(e);return}}getGroupTraits(){try{return this.getAnalyticsInstance()?.getGroupTraits()}catch(e){el(e);return}}startSession(e){try{this.getAnalyticsInstance()?.startSession(es(e))}catch(e){el(e)}}endSession(){try{this.getAnalyticsInstance()?.endSession()}catch(e){el(e)}}getSessionId(){try{return this.getAnalyticsInstance()?.getSessionId()}catch(e){el(e);return}}setAuthToken(e){try{this.getAnalyticsInstance()?.setAuthToken(es(e))}catch(e){el(e)}}consent(e){try{this.getAnalyticsInstance()?.consent(es(e))}catch(e){el(e)}}}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.