@deriv-com/analytics 1.6.4 → 1.7.0-beta.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/analytics.bundle.js +1 -1
- package/lib/growthbook.d.ts +2 -0
- package/lib/growthbook.js +4 -26
- package/lib/rudderstack.d.ts +4 -2
- package/lib/rudderstack.js +10 -32
- package/package.json +4 -4
package/dist/analytics.bundle.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Analytics=t():e.Analytics=t()}(this,(()=>(()=>{var e={328:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GrowthBook=void 0;var r,i=(r=n(591))&&r.__esModule?r:{default:r},s=n(106),o=n(427),a=n(707);const u="undefined"!=typeof window&&"undefined"!=typeof document,c=(0,s.loadSDKVersion)();t.GrowthBook=class{constructor(e){if(e=e||{},this.version=c,this._ctx=this.context=e,this._renderer=null,this._trackedExperiments=new Set,this._trackedFeatures={},this.debug=!1,this._subscriptions=new Set,this._rtQueue=[],this._rtTimer=0,this.ready=!1,this._assigned=new Map,this._forcedFeatureValues=new Map,this._attributeOverrides={},this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._loadFeaturesCalled=!1,this._redirectedUrl="",this._deferredTrackingCalls=[],e.renderer&&(this._renderer=e.renderer),e.remoteEval){if(e.decryptionKey)throw new Error("Encryption is not available for remoteEval");if(!e.clientKey)throw new Error("Missing clientKey");let t=!1;try{t=!!new URL(e.apiHost||"").hostname.match(/growthbook\.io$/i)}catch(e){}if(t)throw new Error("Cannot use remoteEval on GrowthBook Cloud")}else if(e.cacheKeyAttributes)throw new Error("cacheKeyAttributes are only used for remoteEval");e.features&&(this.ready=!0),u&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event("gbloaded"))),e.experiments?(this.ready=!0,this._updateAllAutoExperiments()):e.antiFlicker&&this._setAntiFlicker(),e.clientKey&&!e.remoteEval&&this._refresh({},!0,!1)}async loadFeatures(e){e&&e.autoRefresh&&(this._ctx.subscribeToChanges=!0),this._loadFeaturesCalled=!0,await this._refresh(e,!0,!0),this._canSubscribe()&&(0,a.subscribe)(this)}async refreshFeatures(e){await this._refresh(e,!1,!0)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){const e=this._ctx.apiHost||"https://cdn.growthbook.io";return{apiHost:e.replace(/\/*$/,""),streamingHost:(this._ctx.streamingHost||e).replace(/\/*$/,""),apiRequestHeaders:this._ctx.apiHostRequestHeaders,streamingHostRequestHeaders:this._ctx.streamingHostRequestHeaders}}getClientKey(){return this._ctx.clientKey||""}isRemoteEval(){return this._ctx.remoteEval||!1}getCacheKeyAttributes(){return this._ctx.cacheKeyAttributes}async _refresh(e,t,n){if(e=e||{},!this._ctx.clientKey)throw new Error("Missing clientKey");await(0,a.refreshFeatures)(this,e.timeout,e.skipCache||this._ctx.enableDevMode,t,n,!1!==this._ctx.backgroundSync)}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error("Failed to render",e)}}setFeatures(e){this._ctx.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,n){const r=await(0,s.decrypt)(e,t||this._ctx.decryptionKey,n);this.setFeatures(JSON.parse(r))}setExperiments(e){this._ctx.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,n){const r=await(0,s.decrypt)(e,t||this._ctx.decryptionKey,n);this.setExperiments(JSON.parse(r))}async decryptPayload(e,t,n){return e.encryptedFeatures&&(e.features=JSON.parse(await(0,s.decrypt)(e.encryptedFeatures,t||this._ctx.decryptionKey,n)),delete e.encryptedFeatures),e.encryptedExperiments&&(e.experiments=JSON.parse(await(0,s.decrypt)(e.encryptedExperiments,t||this._ctx.decryptionKey,n)),delete e.encryptedExperiments),e}async setAttributes(e){this._ctx.attributes=e,this._ctx.stickyBucketService&&await this.refreshStickyBuckets(),this._ctx.remoteEval?await this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())}async updateAttributes(e){return this.setAttributes({...this._ctx.attributes,...e})}async setAttributeOverrides(e){this._attributeOverrides=e,this._ctx.stickyBucketService&&await this.refreshStickyBuckets(),this._ctx.remoteEval?await this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())}async setForcedVariations(e){this._ctx.forcedVariations=e||{},this._ctx.remoteEval?await this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())}setForcedFeatures(e){this._forcedFeatureValues=e,this._render()}async setURL(e){if(this._ctx.url=e,this._redirectedUrl="",this._ctx.remoteEval)return await this._refreshForRemoteEval(),void this._updateAllAutoExperiments(!0);this._updateAllAutoExperiments(!0)}getAttributes(){return{...this._ctx.attributes,...this._attributeOverrides}}getForcedVariations(){return this._ctx.forcedVariations||{}}getForcedFeatures(){return this._forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._ctx.stickyBucketAssignmentDocs||{}}getUrl(){return this._ctx.url||""}getFeatures(){return this._ctx.features||{}}getExperiments(){return this._ctx.experiments||[]}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}_canSubscribe(){return!1!==this._ctx.backgroundSync&&this._ctx.subscribeToChanges}async _refreshForRemoteEval(){this._ctx.remoteEval&&this._loadFeaturesCalled&&await this._refresh({},!1,!0).catch((()=>{}))}getAllResults(){return new Map(this._assigned)}destroy(){this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._trackedFeatures={},this._rtQueue=[],this._rtTimer&&clearTimeout(this._rtTimer),(0,a.unsubscribe)(this),u&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach((e=>{e.undo()})),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){this._ctx.forcedVariations=this._ctx.forcedVariations||{},this._ctx.forcedVariations[e]=t,this._ctx.remoteEval?this._refreshForRemoteEval():(this._updateAllAutoExperiments(),this._render())}run(e){const t=this._run(e,null);return this._fireSubscriptions(e,t),t}triggerExperiment(e){return this._triggeredExpKeys.add(e),this._ctx.experiments?this._ctx.experiments.filter((t=>t.key===e)).map((e=>e.manual?this._runAutoExperiment(e):null)).filter((e=>null!==e)):null}_runAutoExperiment(e,t){const n=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!n)return null;const r=this.run(e),i=JSON.stringify(r.value);if(!t&&r.inExperiment&&n&&n.valueHash===i)return r;if(n&&this._undoActiveAutoExperiment(e),r.inExperiment)if(r.value.urlRedirect&&e.urlPatterns){const t=e.persistQueryString?(0,s.mergeQueryStrings)(this._getContextUrl(),r.value.urlRedirect):r.value.urlRedirect;if((0,s.isURLTargeted)(t,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),r;this._redirectedUrl=t;const n=this._getNavigateFunction();var o;if(n)if(u)this._setAntiFlicker(),window.setTimeout((()=>{try{n(t)}catch(e){console.error(e)}}),null!==(o=this._ctx.navigateDelay)&&void 0!==o?o:100);else try{n(t)}catch(e){console.error(e)}}else{const t=this._applyDOMChanges(r.value);t&&this._activeAutoExperiments.set(e,{undo:t,valueHash:i})}return r}_undoActiveAutoExperiment(e){const t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_isRedirectExperiment(e){return e.variations.some((e=>Object.keys(e).includes("urlRedirect")))}_updateAllAutoExperiments(e){const t=this._ctx.experiments||[],n=new Set(t);this._activeAutoExperiments.forEach(((e,t)=>{n.has(t)||(e.undo(),this._activeAutoExperiments.delete(t))}));for(const n of t){const t=this._runAutoExperiment(n,e);if(null!=t&&t.inExperiment&&this._isRedirectExperiment(n))break}}_fireSubscriptions(e,t){const n=e.key,r=this._assigned.get(n);r&&r.result.inExperiment===t.inExperiment&&r.result.variationId===t.variationId||(this._assigned.set(n,{experiment:e,result:t}),this._subscriptions.forEach((n=>{try{n(e,t)}catch(e){console.error(e)}})))}_trackFeatureUsage(e,t){if("override"===t.source)return;const n=JSON.stringify(t.value);if(this._trackedFeatures[e]!==n){if(this._trackedFeatures[e]=n,this._ctx.onFeatureUsage)try{this._ctx.onFeatureUsage(e,t)}catch(e){}u&&window.fetch&&(this._rtQueue.push({key:e,on:t.on}),this._rtTimer||(this._rtTimer=window.setTimeout((()=>{this._rtTimer=0;const e=[...this._rtQueue];this._rtQueue=[],this._ctx.realtimeKey&&window.fetch("https://rt.growthbook.io/?key=".concat(this._ctx.realtimeKey,"&events=").concat(encodeURIComponent(JSON.stringify(e))),{cache:"no-cache",mode:"no-cors"}).catch((()=>{}))}),this._ctx.realtimeInterval||2e3)))}}_getFeatureResult(e,t,n,r,i,s){const o={value:t,on:!!t,off:!t,source:n,ruleId:r||""};return i&&(o.experiment=i),s&&(o.experimentResult=s),this._trackFeatureUsage(e,o),o}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){const n=this.evalFeature(e).value;return null===n?t:n}feature(e){return this.evalFeature(e)}evalFeature(e){return this._evalFeature(e)}_evalFeature(e,t){if((t=t||{evaluatedFeatures:new Set}).evaluatedFeatures.has(e))return this._getFeatureResult(e,null,"cyclicPrerequisite");if(t.evaluatedFeatures.add(e),t.id=e,this._forcedFeatureValues.has(e))return this._getFeatureResult(e,this._forcedFeatureValues.get(e),"override");if(!this._ctx.features||!this._ctx.features[e])return this._getFeatureResult(e,null,"unknownFeature");const n=this._ctx.features[e];if(n.rules)e:for(const r of n.rules){if(r.parentConditions)for(const n of r.parentConditions){const r=this._evalFeature(n.id,t);if("cyclicPrerequisite"===r.source)return this._getFeatureResult(e,null,"cyclicPrerequisite");const i={value:r.value};if(!(0,o.evalCondition)(i,n.condition||{})){if(n.gate)return this._getFeatureResult(e,null,"prerequisite");continue e}}if(r.filters&&this._isFilteredOut(r.filters))continue;if("force"in r){if(r.condition&&!this._conditionPasses(r.condition))continue;if(!this._isIncludedInRollout(r.seed||e,r.hashAttribute,this._ctx.stickyBucketService&&!r.disableStickyBucketing?r.fallbackAttribute:void 0,r.range,r.coverage,r.hashVersion))continue;return r.tracks&&r.tracks.forEach((e=>{this._track(e.experiment,e.result)})),this._getFeatureResult(e,r.force,"force",r.id)}if(!r.variations)continue;const n={variations:r.variations,key:r.key||e};"coverage"in r&&(n.coverage=r.coverage),r.weights&&(n.weights=r.weights),r.hashAttribute&&(n.hashAttribute=r.hashAttribute),r.fallbackAttribute&&(n.fallbackAttribute=r.fallbackAttribute),r.disableStickyBucketing&&(n.disableStickyBucketing=r.disableStickyBucketing),void 0!==r.bucketVersion&&(n.bucketVersion=r.bucketVersion),void 0!==r.minBucketVersion&&(n.minBucketVersion=r.minBucketVersion),r.namespace&&(n.namespace=r.namespace),r.meta&&(n.meta=r.meta),r.ranges&&(n.ranges=r.ranges),r.name&&(n.name=r.name),r.phase&&(n.phase=r.phase),r.seed&&(n.seed=r.seed),r.hashVersion&&(n.hashVersion=r.hashVersion),r.filters&&(n.filters=r.filters),r.condition&&(n.condition=r.condition);const i=this._run(n,e);if(this._fireSubscriptions(n,i),i.inExperiment&&!i.passthrough)return this._getFeatureResult(e,i.value,"experiment",r.id,n,i)}return this._getFeatureResult(e,void 0===n.defaultValue?null:n.defaultValue,"defaultValue")}_isIncludedInRollout(e,t,n,r,i,o){if(!r&&void 0===i)return!0;const{hashValue:a}=this._getHashAttribute(t,n);if(!a)return!1;const u=(0,s.hash)(e,a,o||1);return null!==u&&(r?(0,s.inRange)(u,r):void 0===i||u<=i)}_conditionPasses(e){return(0,o.evalCondition)(this.getAttributes(),e)}_isFilteredOut(e){return e.some((e=>{const{hashValue:t}=this._getHashAttribute(e.attribute);if(!t)return!0;const n=(0,s.hash)(e.seed,t,e.hashVersion||2);return null===n||!e.ranges.some((e=>(0,s.inRange)(n,e)))}))}_run(e,t){const n=e.key,r=e.variations.length;if(r<2)return this._getResult(e,-1,!1,t);if(!1===this._ctx.enabled)return this._getResult(e,-1,!1,t);if((e=this._mergeOverrides(e)).urlPatterns&&!(0,s.isURLTargeted)(this._getContextUrl(),e.urlPatterns))return this._getResult(e,-1,!1,t);const i=(0,s.getQueryStringOverride)(n,this._getContextUrl(),r);if(null!==i)return this._getResult(e,i,!1,t);if(this._ctx.forcedVariations&&n in this._ctx.forcedVariations){const r=this._ctx.forcedVariations[n];return this._getResult(e,r,!1,t)}if("draft"===e.status||!1===e.active)return this._getResult(e,-1,!1,t);const{hashAttribute:a,hashValue:u}=this._getHashAttribute(e.hashAttribute,this._ctx.stickyBucketService&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!u)return this._getResult(e,-1,!1,t);let c=-1,l=!1,h=!1;if(this._ctx.stickyBucketService&&!e.disableStickyBucketing){const{variation:t,versionIsBlocked:n}=this._getStickyBucketVariation(e.key,e.bucketVersion,e.minBucketVersion,e.meta);l=t>=0,c=t,h=!!n}if(!l){if(e.filters){if(this._isFilteredOut(e.filters))return this._getResult(e,-1,!1,t)}else if(e.namespace&&!(0,s.inNamespace)(u,e.namespace))return this._getResult(e,-1,!1,t);if(e.include&&!(0,s.isIncluded)(e.include))return this._getResult(e,-1,!1,t);if(e.condition&&!this._conditionPasses(e.condition))return this._getResult(e,-1,!1,t);if(e.parentConditions)for(const n of e.parentConditions){const r=this._evalFeature(n.id);if("cyclicPrerequisite"===r.source)return this._getResult(e,-1,!1,t);const i={value:r.value};if(!(0,o.evalCondition)(i,n.condition||{}))return this._getResult(e,-1,!1,t)}if(e.groups&&!this._hasGroupOverlap(e.groups))return this._getResult(e,-1,!1,t)}if(e.url&&!this._urlIsValid(e.url))return this._getResult(e,-1,!1,t);const f=(0,s.hash)(e.seed||n,u,e.hashVersion||1);if(null===f)return this._getResult(e,-1,!1,t);if(!l){const t=e.ranges||(0,s.getBucketRanges)(r,void 0===e.coverage?1:e.coverage,e.weights);c=(0,s.chooseVariation)(f,t)}if(h)return this._getResult(e,-1,!1,t,void 0,!0);if(c<0)return this._getResult(e,-1,!1,t);if("force"in e)return this._getResult(e,void 0===e.force?-1:e.force,!1,t);if(this._ctx.qaMode)return this._getResult(e,-1,!1,t);if("stopped"===e.status)return this._getResult(e,-1,!1,t);const d=this._getResult(e,c,!0,t,f,l);if(this._ctx.stickyBucketService&&!e.disableStickyBucketing){const{changed:t,key:n,doc:r}=this._generateStickyBucketAssignmentDoc(a,(0,s.toString)(u),{[this._getStickyBucketExperimentKey(e.key,e.bucketVersion)]:d.key});t&&(this._ctx.stickyBucketAssignmentDocs=this._ctx.stickyBucketAssignmentDocs||{},this._ctx.stickyBucketAssignmentDocs[n]=r,this._ctx.stickyBucketService.saveAssignments(r))}return this._track(e,d),d}log(e,t){this.debug&&(this._ctx.log?this._ctx.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return this._deferredTrackingCalls}setDeferredTrackingCalls(e){this._deferredTrackingCalls=e}fireDeferredTrackingCalls(){let e=!1;if(this._deferredTrackingCalls.forEach((t=>{t&&t.experiment&&t.result?this._track(t.experiment,t.result):(console.error("Invalid deferred tracking call",{call:t}),e=!0)})),this._deferredTrackingCalls=[],e)throw new Error("Invalid tracking data")}setTrackingCallback(e){this._ctx.trackingCallback=e;try{this.fireDeferredTrackingCalls()}catch(e){console.error(e)}}_track(e,t){if(!this._ctx.trackingCallback)return void this._deferredTrackingCalls.push({experiment:e,result:t});const n=e.key,r=t.hashAttribute+t.hashValue+n+t.variationId;if(!this._trackedExperiments.has(r)){this._trackedExperiments.add(r);try{this._ctx.trackingCallback(e,t)}catch(e){console.error(e)}}}_mergeOverrides(e){const t=e.key,n=this._ctx.overrides;return n&&n[t]&&"string"==typeof(e=Object.assign({},e,n[t])).url&&(e.url=(0,s.getUrlRegExp)(e.url)),e}_getHashAttribute(e,t){let n=e||"id",r="";return this._attributeOverrides[n]?r=this._attributeOverrides[n]:this._ctx.attributes?r=this._ctx.attributes[n]||"":this._ctx.user&&(r=this._ctx.user[n]||""),!r&&t&&(this._attributeOverrides[t]?r=this._attributeOverrides[t]:this._ctx.attributes?r=this._ctx.attributes[t]||"":this._ctx.user&&(r=this._ctx.user[t]||""),r&&(n=t)),{hashAttribute:n,hashValue:r}}_getResult(e,t,n,r,i,s){let o=!0;(t<0||t>=e.variations.length)&&(t=0,o=!1);const{hashAttribute:a,hashValue:u}=this._getHashAttribute(e.hashAttribute,this._ctx.stickyBucketService&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),c=e.meta?e.meta[t]:{},l={key:c.key||""+t,featureId:r,inExperiment:o,hashUsed:n,variationId:t,value:e.variations[t],hashAttribute:a,hashValue:u,stickyBucketUsed:!!s};return c.name&&(l.name=c.name),void 0!==i&&(l.bucket=i),c.passthrough&&(l.passthrough=c.passthrough),l}_getContextUrl(){return this._ctx.url||(u?window.location.href:"")}_urlIsValid(e){const t=this._getContextUrl();if(!t)return!1;const n=t.replace(/^https?:\/\//,"").replace(/^[^/]*\//,"/");return!!e.test(t)||!!e.test(n)}_hasGroupOverlap(e){const t=this._ctx.groups||{};for(let n=0;n<e.length;n++)if(t[e[n]])return!0;return!1}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._ctx.navigate?this._ctx.navigate:u?e=>{window.location.replace(e)}:null}_setAntiFlicker(){if(this._ctx.antiFlicker&&u)try{var e;const t=document.createElement("style");t.innerHTML=".gb-anti-flicker { opacity: 0 !important; pointer-events: none; }",document.head.appendChild(t),document.documentElement.classList.add("gb-anti-flicker"),setTimeout((()=>{document.documentElement.classList.remove("gb-anti-flicker")}),null!==(e=this._ctx.antiFlickerTimeout)&&void 0!==e?e:3500)}catch(e){console.error(e)}}_applyDOMChanges(e){if(!u)return;const t=[];if(e.css){const n=document.createElement("style");n.innerHTML=e.css,document.head.appendChild(n),t.push((()=>n.remove()))}if(e.js){const n=document.createElement("script");n.innerHTML=e.js,document.head.appendChild(n),t.push((()=>n.remove()))}return e.domMutations&&e.domMutations.forEach((e=>{t.push(i.default.declarative(e).revert)})),()=>{t.forEach((e=>e()))}}_deriveStickyBucketIdentifierAttributes(e){const t=new Set,n=e&&e.features?e.features:this.getFeatures(),r=e&&e.experiments?e.experiments:this.getExperiments();return Object.keys(n).forEach((e=>{const r=n[e];if(r.rules)for(const e of r.rules)e.variations&&(t.add(e.hashAttribute||"id"),e.fallbackAttribute&&t.add(e.fallbackAttribute))})),r.map((e=>{t.add(e.hashAttribute||"id"),e.fallbackAttribute&&t.add(e.fallbackAttribute)})),Array.from(t)}async refreshStickyBuckets(e){if(this._ctx.stickyBucketService){const t=this._getStickyBucketAttributes(e);this._ctx.stickyBucketAssignmentDocs=await this._ctx.stickyBucketService.getAllAssignments(t)}}_getStickyBucketAssignments(){const e={};return Object.values(this._ctx.stickyBucketAssignmentDocs||{}).forEach((t=>{t.assignments&&Object.assign(e,t.assignments)})),e}_getStickyBucketVariation(e,t,n,r){t=t||0,n=n||0,r=r||[];const i=this._getStickyBucketExperimentKey(e,t),s=this._getStickyBucketAssignments();if(n>0)for(let t=0;t<=n;t++)if(void 0!==s[this._getStickyBucketExperimentKey(e,t)])return{variation:-1,versionIsBlocked:!0};const o=s[i];if(void 0===o)return{variation:-1};const a=r.findIndex((e=>e.key===o));return a<0?{variation:-1}:{variation:a}}_getStickyBucketExperimentKey(e,t){return t=t||0,"".concat(e,"__").concat(t)}_getStickyBucketAttributes(e){const t={};return this._ctx.stickyBucketIdentifierAttributes=this._ctx.stickyBucketIdentifierAttributes?this._ctx.stickyBucketIdentifierAttributes:this._deriveStickyBucketIdentifierAttributes(e),this._ctx.stickyBucketIdentifierAttributes.forEach((e=>{const{hashValue:n}=this._getHashAttribute(e);t[e]=(0,s.toString)(n)})),t}_generateStickyBucketAssignmentDoc(e,t,n){const r="".concat(e,"||").concat(t),i=this._ctx.stickyBucketAssignmentDocs&&this._ctx.stickyBucketAssignmentDocs[r]&&this._ctx.stickyBucketAssignmentDocs[r].assignments||{},s={...i,...n};return{key:r,doc:{attributeName:e,attributeValue:t,assignments:s},changed:JSON.stringify(i)!==JSON.stringify(s)}}}},707:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clearCache=async function(){a.clear(),u.clear(),I(),o=!1,await d()},t.configureCache=function(e){Object.assign(n,e),n.backgroundSync||I()},t.helpers=void 0,t.onHidden=h,t.onVisible=f,t.refreshFeatures=async function(e,t,s,u,c,h){h||(n.backgroundSync=!1);const f=await async function(e,t,s,u){const c=p(e),h=g(e),f=new Date,d=new Date(f.getTime()-n.maxAge+n.staleTTL);await async function(){if(!o){o=!0;try{if(r.localStorage){const e=await r.localStorage.getItem(n.cacheKey);if(e){const t=JSON.parse(e);t&&Array.isArray(t)&&t.forEach((e=>{let[t,n]=e;a.set(t,{...n,staleAt:new Date(n.staleAt)})})),y()}}}catch(e){}if(!n.disableIdleStreams){const e=i.startIdleListener();e&&(i.stopIdleListener=e)}}}();const v=a.get(h);return v&&!u&&(t||v.staleAt>f)&&v.staleAt>d?(v.sse&&l.add(c),v.staleAt<f?b(e):k(e),v.data):await function(e,t){return new Promise((n=>{let r,i=!1;const s=e=>{i||(i=!0,r&&clearTimeout(r),n(e||null))};t&&(r=setTimeout((()=>s()),t)),e.then((e=>s(e))).catch((()=>s()))}))}(b(e),s)}(e,u,t,s);c&&f&&await m(e,f)},t.setPolyfills=function(e){Object.assign(r,e)},t.subscribe=function(e){const t=p(e),n=s.get(t)||new Set;n.add(e),s.set(t,n)},t.unsubscribe=function(e){s.forEach((t=>t.delete(e)))};const n={staleTTL:6e4,maxAge:864e5,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4},r={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource},i={fetchFeaturesCall:e=>{let{host:t,clientKey:n,headers:i}=e;return r.fetch("".concat(t,"/api/features/").concat(n),{headers:i})},fetchRemoteEvalCall:e=>{let{host:t,clientKey:n,payload:i,headers:s}=e;const o={method:"POST",headers:{"Content-Type":"application/json",...s},body:JSON.stringify(i)};return r.fetch("".concat(t,"/api/eval/").concat(n),o)},eventSourceCall:e=>{let{host:t,clientKey:n,headers:i}=e;return i?new r.EventSource("".concat(t,"/sub/").concat(n),{headers:i}):new r.EventSource("".concat(t,"/sub/").concat(n))},startIdleListener:()=>{let e;if("undefined"==typeof window||"undefined"==typeof document)return;const t=()=>{"visible"===document.visibilityState?(window.clearTimeout(e),f()):"hidden"===document.visibilityState&&(e=window.setTimeout(h,n.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};t.helpers=i;try{globalThis.localStorage&&(r.localStorage=globalThis.localStorage)}catch(e){}const s=new Map;let o=!1;const a=new Map,u=new Map,c=new Map,l=new Set;function h(){c.forEach((e=>{e&&(e.state="idle",A(e))}))}function f(){c.forEach((e=>{e&&"idle"===e.state&&S(e)}))}async function d(){try{if(!r.localStorage)return;await r.localStorage.setItem(n.cacheKey,JSON.stringify(Array.from(a.entries())))}catch(e){}}function p(e){const[t,n]=e.getApiInfo();return"".concat(t,"||").concat(n)}function g(e){const t=p(e);if(!e.isRemoteEval())return t;const n=e.getAttributes(),r=e.getCacheKeyAttributes()||Object.keys(e.getAttributes()),i={};r.forEach((e=>{i[e]=n[e]}));const s=e.getForcedVariations(),o=e.getUrl();return"".concat(t,"||").concat(JSON.stringify({ca:i,fv:s,url:o}))}function y(){const e=Array.from(a.entries()).map((e=>{let[t,n]=e;return{key:t,staleAt:n.staleAt.getTime()}})).sort(((e,t)=>e.staleAt-t.staleAt)),t=Math.min(Math.max(0,a.size-n.maxEntries),a.size);for(let n=0;n<t;n++)a.delete(e[n].key)}function v(e,t,r){const i=r.dateUpdated||"",o=new Date(Date.now()+n.staleTTL),u=a.get(t);if(u&&i&&u.version===i)return u.staleAt=o,void d();a.set(t,{data:r,version:i,staleAt:o,sse:l.has(e)}),y(),d();const c=s.get(e);c&&c.forEach((e=>m(e,r)))}async function m(e,t){t=await e.decryptPayload(t,void 0,r.SubtleCrypto),await e.refreshStickyBuckets(t),e.setFeatures(t.features||e.getFeatures()),e.setExperiments(t.experiments||e.getExperiments())}async function b(e){const{apiHost:t,apiRequestHeaders:n}=e.getApiHosts(),r=e.getClientKey(),s=e.isRemoteEval(),o=p(e),a=g(e);let c=u.get(a);return c||(c=(s?i.fetchRemoteEvalCall({host:t,clientKey:r,payload:{attributes:e.getAttributes(),forcedVariations:e.getForcedVariations(),forcedFeatures:Array.from(e.getForcedFeatures().entries()),url:e.getUrl()},headers:n}):i.fetchFeaturesCall({host:t,clientKey:r,headers:n})).then((e=>{if(!e.ok)throw new Error("HTTP error: ".concat(e.status));return"enabled"===e.headers.get("x-sse-support")&&l.add(o),e.json()})).then((t=>(v(o,a,t),k(e),u.delete(a),t))).catch((e=>(u.delete(a),Promise.resolve({})))),u.set(a,c)),await c}function k(e){const t=p(e),i=g(e),{streamingHost:o,streamingHostRequestHeaders:a}=e.getApiHosts(),u=e.getClientKey();if(n.backgroundSync&&l.has(t)&&r.EventSource){if(c.has(t))return;const e={src:null,host:o,clientKey:u,headers:a,cb:n=>{try{if("features-updated"===n.type){const e=s.get(t);e&&e.forEach((e=>{b(e)}))}else if("features"===n.type){const e=JSON.parse(n.data);v(t,i,e)}e.errors=0}catch(t){_(e)}},errors:0,state:"active"};c.set(t,e),S(e)}}function _(e){if("idle"!==e.state&&(e.errors++,e.errors>3||e.src&&2===e.src.readyState)){const t=Math.pow(3,e.errors-3)*(1e3+1e3*Math.random());A(e),setTimeout((()=>{["idle","active"].includes(e.state)||S(e)}),Math.min(t,3e5))}}function A(e){e.src&&(e.src.onopen=null,e.src.onerror=null,e.src.close(),e.src=null,"active"===e.state&&(e.state="disabled"))}function S(e){e.src=i.eventSourceCall({host:e.host,clientKey:e.clientKey,headers:e.headers}),e.state="active",e.src.addEventListener("features",e.cb),e.src.addEventListener("features-updated",e.cb),e.src.onerror=()=>_(e),e.src.onopen=()=>{e.errors=0}}function E(e,t){A(e),c.delete(t)}function I(){l.clear(),c.forEach(E),s.clear(),i.stopIdleListener()}},200:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BrowserCookieStickyBucketService",{enumerable:!0,get:function(){return s.BrowserCookieStickyBucketService}}),Object.defineProperty(t,"ExpressCookieStickyBucketService",{enumerable:!0,get:function(){return s.ExpressCookieStickyBucketService}}),Object.defineProperty(t,"GrowthBook",{enumerable:!0,get:function(){return i.GrowthBook}}),Object.defineProperty(t,"LocalStorageStickyBucketService",{enumerable:!0,get:function(){return s.LocalStorageStickyBucketService}}),Object.defineProperty(t,"RedisStickyBucketService",{enumerable:!0,get:function(){return s.RedisStickyBucketService}}),Object.defineProperty(t,"StickyBucketService",{enumerable:!0,get:function(){return s.StickyBucketService}}),Object.defineProperty(t,"clearCache",{enumerable:!0,get:function(){return r.clearCache}}),Object.defineProperty(t,"configureCache",{enumerable:!0,get:function(){return r.configureCache}}),Object.defineProperty(t,"evalCondition",{enumerable:!0,get:function(){return o.evalCondition}}),Object.defineProperty(t,"helpers",{enumerable:!0,get:function(){return r.helpers}}),Object.defineProperty(t,"isURLTargeted",{enumerable:!0,get:function(){return a.isURLTargeted}}),Object.defineProperty(t,"onHidden",{enumerable:!0,get:function(){return r.onHidden}}),Object.defineProperty(t,"onVisible",{enumerable:!0,get:function(){return r.onVisible}}),Object.defineProperty(t,"setPolyfills",{enumerable:!0,get:function(){return r.setPolyfills}});var r=n(707),i=n(328),s=n(350),o=n(427),a=n(106)},427:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.evalCondition=s;var r=n(106);const i={};function s(e,t){if("$or"in t)return h(e,t.$or);if("$nor"in t)return!h(e,t.$nor);if("$and"in t)return function(e,t){for(let n=0;n<t.length;n++)if(!s(e,t[n]))return!1;return!0}(e,t.$and);if("$not"in t)return!s(e,t.$not);for(const[n,r]of Object.entries(t))if(!a(r,o(e,n)))return!1;return!0}function o(e,t){const n=t.split(".");let r=e;for(let e=0;e<n.length;e++){if(!r||"object"!=typeof r||!(n[e]in r))return null;r=r[n[e]]}return r}function a(e,t){if("string"==typeof e)return t+""===e;if("number"==typeof e)return 1*t===e;if("boolean"==typeof e)return!!t===e;if(null===e)return null===t;if(Array.isArray(e)||!u(e))return JSON.stringify(t)===JSON.stringify(e);for(const n in e)if(!l(n,t,e[n]))return!1;return!0}function u(e){const t=Object.keys(e);return t.length>0&&t.filter((e=>"$"===e[0])).length===t.length}function c(e,t){return Array.isArray(e)?e.some((e=>t.includes(e))):t.includes(e)}function l(e,t,n){switch(e){case"$veq":return(0,r.paddedVersionString)(t)===(0,r.paddedVersionString)(n);case"$vne":return(0,r.paddedVersionString)(t)!==(0,r.paddedVersionString)(n);case"$vgt":return(0,r.paddedVersionString)(t)>(0,r.paddedVersionString)(n);case"$vgte":return(0,r.paddedVersionString)(t)>=(0,r.paddedVersionString)(n);case"$vlt":return(0,r.paddedVersionString)(t)<(0,r.paddedVersionString)(n);case"$vlte":return(0,r.paddedVersionString)(t)<=(0,r.paddedVersionString)(n);case"$eq":return t===n;case"$ne":return t!==n;case"$lt":return t<n;case"$lte":return t<=n;case"$gt":return t>n;case"$gte":return t>=n;case"$exists":return n?null!=t:null==t;case"$in":return!!Array.isArray(n)&&c(t,n);case"$nin":return!!Array.isArray(n)&&!c(t,n);case"$not":return!a(n,t);case"$size":return!!Array.isArray(t)&&a(n,t.length);case"$elemMatch":return function(e,t){if(!Array.isArray(e))return!1;const n=u(t)?e=>a(t,e):e=>s(e,t);for(let t=0;t<e.length;t++)if(e[t]&&n(e[t]))return!0;return!1}(t,n);case"$all":if(!Array.isArray(t))return!1;for(let e=0;e<n.length;e++){let r=!1;for(let i=0;i<t.length;i++)if(a(n[e],t[i])){r=!0;break}if(!r)return!1}return!0;case"$regex":try{return(o=n,i[o]||(i[o]=new RegExp(o.replace(/([^\\])\//g,"$1\\/"))),i[o]).test(t)}catch(e){return!1}case"$type":return function(e){if(null===e)return"null";if(Array.isArray(e))return"array";const t=typeof e;return["string","number","boolean","object","undefined"].includes(t)?t:"unknown"}(t)===n;default:return console.error("Unknown operator: "+e),!1}var o}function h(e,t){if(!t.length)return!0;for(let n=0;n<t.length;n++)if(s(e,t[n]))return!0;return!1}},350:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StickyBucketService=t.RedisStickyBucketService=t.LocalStorageStickyBucketService=t.ExpressCookieStickyBucketService=t.BrowserCookieStickyBucketService=void 0;class n{async getAllAssignments(e){const t={};return(await Promise.all(Object.entries(e).map((e=>{let[t,n]=e;return this.getAssignments(t,n)})))).forEach((e=>{if(e){const n="".concat(e.attributeName,"||").concat(e.attributeValue);t[n]=e}})),t}}t.StickyBucketService=n,t.LocalStorageStickyBucketService=class extends n{constructor(e){e=e||{},super(),this.prefix=e.prefix||"gbStickyBuckets__";try{this.localStorage=e.localStorage||globalThis.localStorage}catch(e){}}async getAssignments(e,t){const n="".concat(e,"||").concat(t);let r=null;if(!this.localStorage)return r;try{const e=await this.localStorage.getItem(this.prefix+n)||"{}",t=JSON.parse(e);t.attributeName&&t.attributeValue&&t.assignments&&(r=t)}catch(e){}return r}async saveAssignments(e){const t="".concat(e.attributeName,"||").concat(e.attributeValue);if(this.localStorage)try{await this.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(e){}}},t.ExpressCookieStickyBucketService=class extends n{constructor(e){let{prefix:t="gbStickyBuckets__",req:n,res:r,cookieAttributes:i={}}=e;super(),this.prefix=t,this.req=n,this.res=r,this.cookieAttributes=i}async getAssignments(e,t){const n="".concat(e,"||").concat(t);let r=null;if(!this.req)return r;try{const e=this.req.cookies[this.prefix+n]||"{}",t=JSON.parse(e);t.attributeName&&t.attributeValue&&t.assignments&&(r=t)}catch(e){}return r}async saveAssignments(e){const t="".concat(e.attributeName,"||").concat(e.attributeValue);if(!this.res)return;const n=JSON.stringify(e);this.res.cookie(encodeURIComponent(this.prefix+t),encodeURIComponent(n),this.cookieAttributes)}},t.BrowserCookieStickyBucketService=class extends n{constructor(e){let{prefix:t="gbStickyBuckets__",jsCookie:n,cookieAttributes:r={}}=e;super(),this.prefix=t,this.jsCookie=n,this.cookieAttributes=r}async getAssignments(e,t){const n="".concat(e,"||").concat(t);let r=null;if(!this.jsCookie)return r;try{const e=this.jsCookie.get(this.prefix+n),t=JSON.parse(e||"{}");t.attributeName&&t.attributeValue&&t.assignments&&(r=t)}catch(e){}return r}async saveAssignments(e){const t="".concat(e.attributeName,"||").concat(e.attributeValue);if(!this.jsCookie)return;const n=JSON.stringify(e);this.jsCookie.set(this.prefix+t,n,this.cookieAttributes)}},t.RedisStickyBucketService=class extends n{constructor(e){let{redis:t}=e;super(),this.redis=t}async getAllAssignments(e){const t={},n=Object.entries(e).map((e=>{let[t,n]=e;return"".concat(t,"||").concat(n)}));return this.redis?(await this.redis.mget(...n).then((e=>{e.forEach((e=>{try{const n=JSON.parse(e||"{}");if(n.attributeName&&n.attributeValue&&n.assignments){const e="".concat(n.attributeName,"||").concat(n.attributeValue);t[e]=n}}catch(e){}}))})),t):t}async getAssignments(e,t){return null}async saveAssignments(e){const t="".concat(e.attributeName,"||").concat(e.attributeValue);this.redis&&await this.redis.set(t,JSON.stringify(e))}}},106:(e,t)=>{"use strict";function n(e){let t=2166136261;const n=e.length;for(let r=0;r<n;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}function r(e,t,r){return 2===r?n(n(e+t)+"")%1e4/1e4:1===r?n(t+e)%1e3/1e3:null}function i(e){return e<=0?[]:new Array(e).fill(1/e)}function s(e,t){return e>=t[0]&&e<t[1]}function o(e){try{const t=e.replace(/([^\\])\//g,"$1\\/");return new RegExp(t)}catch(e){return void console.error(e)}}function a(e,t,n){try{const r=new URL(e,"https://_");if("regex"===t){const e=o(n);return!!e&&(e.test(r.href)||e.test(r.href.substring(r.origin.length)))}return"simple"===t&&function(e,t){try{const n=new URL(t.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),r=[[e.host,n.host,!1],[e.pathname,n.pathname,!0]];return n.hash&&r.push([e.hash,n.hash,!1]),n.searchParams.forEach(((t,n)=>{r.push([e.searchParams.get(n)||"",t,!1])})),!r.some((e=>!function(e,t,n){try{let r=t.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return n&&(r="\\/?"+r.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+r+"$","i").test(e)}catch(e){return!1}}(e[0],e[1],e[2])))}catch(e){return!1}}(r,n)}catch(e){return!1}}Object.defineProperty(t,"__esModule",{value:!0}),t.chooseVariation=function(e,t){for(let n=0;n<t.length;n++)if(s(e,t[n]))return n;return-1},t.decrypt=async function(e,t,n){if(t=t||"",!(n=n||globalThis.crypto&&globalThis.crypto.subtle))throw new Error("No SubtleCrypto implementation found");try{const r=await n.importKey("raw",u(t),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=e.split("."),o=await n.decrypt({name:"AES-CBC",iv:u(i)},r,u(s));return(new TextDecoder).decode(o)}catch(e){throw new Error("Failed to decrypt")}},t.getBucketRanges=function(e,t,n){(t=void 0===t?1:t)<0?t=0:t>1&&(t=1);const r=i(e);(n=n||r).length!==e&&(n=r);const s=n.reduce(((e,t)=>t+e),0);(s<.99||s>1.01)&&(n=r);let o=0;return n.map((e=>{const n=o;return o+=e,[n,n+t*e]}))},t.getEqualWeights=i,t.getQueryStringOverride=function(e,t,n){if(!t)return null;const r=t.split("?")[1];if(!r)return null;const i=r.replace(/#.*/,"").split("&").map((e=>e.split("=",2))).filter((t=>{let[n]=t;return n===e})).map((e=>{let[,t]=e;return parseInt(t)}));return i.length>0&&i[0]>=0&&i[0]<n?i[0]:null},t.getUrlRegExp=o,t.hash=r,t.inNamespace=function(e,t){const n=r("__"+t[0],e,1);return null!==n&&n>=t[1]&&n<t[2]},t.inRange=s,t.isIncluded=function(e){try{return e()}catch(e){return console.error(e),!1}},t.isURLTargeted=function(e,t){if(!t.length)return!1;let n=!1,r=!1;for(let i=0;i<t.length;i++){const s=a(e,t[i].type,t[i].pattern);if(!1===t[i].include){if(s)return!1}else n=!0,s&&(r=!0)}return r||!n},t.loadSDKVersion=function(){let e;try{e="0.36.0"}catch(t){e=""}return e},t.mergeQueryStrings=function(e,t){let n,r;try{n=new URL(e),r=new URL(t)}catch(e){return console.error("Unable to merge query strings: ".concat(e)),t}return n.searchParams.forEach(((e,t)=>{r.searchParams.has(t)||r.searchParams.set(t,e)})),r.toString()},t.paddedVersionString=function(e){"number"==typeof e&&(e+=""),e&&"string"==typeof e||(e="0");const t=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return 3===t.length&&t.push("~"),t.map((e=>e.match(/^[0-9]+$/)?e.padStart(5," "):e)).join("-")},t.toString=function(e){return"string"==typeof e?e:JSON.stringify(e)};const u=e=>Uint8Array.from(atob(e),(e=>e.charCodeAt(0)))},591:(e,t,n)=>{"use strict";n.r(t),n.d(t,{connectGlobalObserver:()=>L,default:()=>U,disconnectGlobalObserver:()=>B,validAttributeName:()=>r});var r=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,i={revert:function(){}},s=new Map,o=new Set;function a(e){var t=s.get(e);return t||(t={element:e,attributes:{}},s.set(e,t)),t}function u(e,t,n,r,i){var s=n(e),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:e,_positionTimeout:null,observer:new MutationObserver((function(){if("position"!==t||!o._positionTimeout){"position"===t&&(o._positionTimeout=setTimeout((function(){o._positionTimeout=null}),1e3));var r=n(e);"position"===t&&r.parentNode===o.virtualValue.parentNode&&r.insertBeforeNode===o.virtualValue.insertBeforeNode||r!==o.virtualValue&&(o.originalValue=r,i(o))}})),mutationRunner:i,setValue:r,getCurrentValue:n};return"position"===t&&e.parentNode?o.observer.observe(e.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(e,function(e){return"html"===e?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[e]}}(t)),o}function c(e,t){var n=t.getCurrentValue(t.el);t.virtualValue=e,e&&"string"!=typeof e?n&&e.parentNode===n.parentNode&&e.insertBeforeNode===n.insertBeforeNode||(t.isDirty=!0,x()):e!==n&&(t.isDirty=!0,x())}function l(e){var t=e.originalValue;e.mutations.forEach((function(e){return t=e.mutate(t)})),c(function(e){return S||(S=document.createElement("div")),S.innerHTML=e,S.innerHTML}(t),e)}function h(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach((function(e){return e.mutate(t)})),c(Array.from(t).filter(Boolean).join(" "),e)}function f(e){var t=e.originalValue;e.mutations.forEach((function(e){return t=e.mutate(t)})),c(t,e)}function d(e){var t=e.originalValue;e.mutations.forEach((function(e){var n=function(e){var t=e.parentSelector,n=e.insertBeforeSelector,r=document.querySelector(t);if(!r)return null;var i=n?document.querySelector(n):null;return n&&!i?null:{parentNode:r,insertBeforeNode:i}}(e.mutate());t=n||t})),c(t,e)}var p=function(e){return e.innerHTML},g=function(e,t){return e.innerHTML=t};function y(e){var t=a(e);return t.html||(t.html=u(e,"html",p,g,l)),t.html}var v=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},m=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function b(e){var t=a(e);return t.position||(t.position=u(e,"position",v,m,d)),t.position}var k=function(e,t){return t?e.className=t:e.removeAttribute("class")},_=function(e){return e.className};function A(e){var t=a(e);return t.classes||(t.classes=u(e,"class",_,k,h)),t.classes}var S,E,I=function(e){return function(t){var n;return null!=(n=t.getAttribute(e))?n:null}},w=function(e){return function(t,n){return null!==n?t.setAttribute(e,n):t.removeAttribute(e)}};function O(e,t){var n=a(e);return n.attributes[t]||(n.attributes[t]=u(e,t,I(t),w(t),f)),n.attributes[t]}function C(e,t,n){if(n.isDirty){n.isDirty=!1;var r=n.virtualValue;n.mutations.length||function(e,t){var n,r,i=s.get(e);if(i)if("html"===t)null==(n=i.html)||null==(r=n.observer)||r.disconnect(),delete i.html;else if("class"===t){var o,a;null==(o=i.classes)||null==(a=o.observer)||a.disconnect(),delete i.classes}else if("position"===t){var u,c;null==(u=i.position)||null==(c=u.observer)||c.disconnect(),delete i.position}else{var l,h,f;null==(l=i.attributes)||null==(h=l[t])||null==(f=h.observer)||f.disconnect(),delete i.attributes[t]}}(e,t),n.setValue(e,r)}}function T(e,t){e.html&&C(t,"html",e.html),e.classes&&C(t,"class",e.classes),e.position&&C(t,"position",e.position),Object.keys(e.attributes).forEach((function(n){C(t,n,e.attributes[n])}))}function x(){s.forEach(T)}function R(e){if("position"!==e.kind||1!==e.elements.size){var t=new Set(e.elements);document.querySelectorAll(e.selector).forEach((function(n){t.has(n)||(e.elements.add(n),function(e,t){var n=null;"html"===e.kind?n=y(t):"class"===e.kind?n=A(t):"attribute"===e.kind?n=O(t,e.attribute):"position"===e.kind&&(n=b(t)),n&&(n.mutations.push(e),n.mutationRunner(n))}(e,n))}))}}function P(){o.forEach(R)}function B(){E&&E.disconnect()}function L(){"undefined"!=typeof document&&(E||(E=new MutationObserver((function(){P()}))),P(),E.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}function D(e){return"undefined"==typeof document?i:(o.add(e),R(e),{revert:function(){var t;(t=e).elements.forEach((function(e){return function(e,t){var n=null;if("html"===e.kind?n=y(t):"class"===e.kind?n=A(t):"attribute"===e.kind?n=O(t,e.attribute):"position"===e.kind&&(n=b(t)),n){var r=n.mutations.indexOf(e);-1!==r&&n.mutations.splice(r,1),n.mutationRunner(n)}}(t,e)})),t.elements.clear(),o.delete(t)}})}function M(e,t){return D({kind:"html",elements:new Set,mutate:t,selector:e})}function F(e,t){return D({kind:"position",elements:new Set,mutate:t,selector:e})}function N(e,t){return D({kind:"class",elements:new Set,mutate:t,selector:e})}function j(e,t,n){return r.test(t)?"class"===t||"className"===t?N(e,(function(e){var t=n(Array.from(e).join(" "));e.clear(),t&&t.split(/\s+/g).filter(Boolean).forEach((function(t){return e.add(t)}))})):D({kind:"attribute",attribute:t,elements:new Set,mutate:n,selector:e}):i}L();const U={html:M,classes:N,attribute:j,position:F,declarative:function(e){var t=e.selector,n=e.action,r=e.value,s=e.attribute,o=e.parentSelector,a=e.insertBeforeSelector;if("html"===s){if("append"===n)return M(t,(function(e){return e+(null!=r?r:"")}));if("set"===n)return M(t,(function(){return null!=r?r:""}))}else if("class"===s){if("append"===n)return N(t,(function(e){r&&e.add(r)}));if("remove"===n)return N(t,(function(e){r&&e.delete(r)}));if("set"===n)return N(t,(function(e){e.clear(),r&&e.add(r)}))}else if("position"===s){if("set"===n&&o)return F(t,(function(){return{insertBeforeSelector:a,parentSelector:o}}))}else{if("append"===n)return j(t,s,(function(e){return null!==e?e+(null!=r?r:""):null!=r?r:""}));if("set"===n)return j(t,s,(function(){return null!=r?r:""}));if("remove"===n)return j(t,s,(function(){return null}))}return i}}},202:function(e,t,n){!function(e){"use strict";function t(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function r(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?t(Object(r),!0).forEach((function(t){u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(e){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function a(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,n){return(t=f(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(){return c=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(this,arguments)}function l(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function f(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,"string");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}var d="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function p(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var g={exports:{}};!function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(g);var y=g.exports,v=p(y);function m(e){return null!=e&&"object"===i(e)&&!0===e["@@functional/placeholder"]}function b(e){return function t(n){return 0===arguments.length||m(n)?t:e.apply(this,arguments)}}function k(e){return function t(n,r){switch(arguments.length){case 0:return t;case 1:return m(n)?t:b((function(t){return e(n,t)}));default:return m(n)&&m(r)?t:m(n)?b((function(t){return e(t,r)})):m(r)?b((function(t){return e(n,t)})):e(n,r)}}}function _(e){return function t(n,r,i){switch(arguments.length){case 0:return t;case 1:return m(n)?t:k((function(t,r){return e(n,t,r)}));case 2:return m(n)&&m(r)?t:m(n)?k((function(t,n){return e(t,r,n)})):m(r)?k((function(t,r){return e(n,t,r)})):b((function(t){return e(n,r,t)}));default:return m(n)&&m(r)&&m(i)?t:m(n)&&m(r)?k((function(t,n){return e(t,n,i)})):m(n)&&m(i)?k((function(t,n){return e(t,r,n)})):m(r)&&m(i)?k((function(t,r){return e(n,t,r)})):m(n)?b((function(t){return e(t,r,i)})):m(r)?b((function(t){return e(n,t,i)})):m(i)?b((function(t){return e(n,r,t)})):e(n,r,i)}}}function A(e,t){return Object.prototype.hasOwnProperty.call(t,e)}var S=b((function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}));function E(e){return"[object Object]"===Object.prototype.toString.call(e)}function I(e,t,n){if(n||(n=new w),function(e){var t=i(e);return null==e||"object"!=t&&"function"!=t}(e))return e;var r,s=function(r){var i=n.get(e);if(i)return i;for(var s in n.set(e,r),e)Object.prototype.hasOwnProperty.call(e,s)&&(r[s]=t?I(e[s],!0,n):e[s]);return r};switch(S(e)){case"Object":return s(Object.create(Object.getPrototypeOf(e)));case"Array":return s([]);case"Date":return new Date(e.valueOf());case"RegExp":return r=e,new RegExp(r.source,r.flags?r.flags:(r.global?"g":"")+(r.ignoreCase?"i":"")+(r.multiline?"m":"")+(r.sticky?"y":"")+(r.unicode?"u":"")+(r.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 e.slice();default:return e}}var w=function(){function e(){this.map={},this.length=0}return e.prototype.set=function(e,t){var n=this.hash(e),r=this.map[n];r||(this.map[n]=r=[]),r.push([e,t]),this.length+=1},e.prototype.hash=function(e){var t=[];for(var n in e)t.push(Object.prototype.toString.call(e[n]));return t.join()},e.prototype.get=function(e){if(this.length<=180)for(var t in this.map)for(var n=this.map[t],r=0;r<n.length;r+=1){var i=n[r];if(i[0]===e)return i[1]}else{var s=this.hash(e),o=this.map[s];if(o)for(var a=0;a<o.length;a+=1){var u=o[a];if(u[0]===e)return u[1]}}},e}(),O=b((function(e){return null!=e&&"function"==typeof e.clone?e.clone():I(e,!0)})),C=_((function(e,t,n){var r,i={};for(r in n=n||{},t=t||{})A(r,t)&&(i[r]=A(r,n)?e(r,t[r],n[r]):t[r]);for(r in n)A(r,n)&&!A(r,i)&&(i[r]=n[r]);return i})),T=_((function e(t,n,r){return C((function(n,r,i){return E(r)&&E(i)?e(t,r,i):t(n,r,i)}),n,r)})),x=_((function(e,t,n){return T((function(t,n,r){return e(n,r)}),t,n)})),R=function(e){return null!=e&&"object"===i(e)&&!1===Array.isArray(e)};function P(e,t,n){return"function"==typeof n.join?n.join(e):e[0]+t+e[1]}function B(e,t,n){return"function"!=typeof n.isValid||n.isValid(e,t)}function L(e){return R(e)||Array.isArray(e)||"function"==typeof e}for(var D,M=p((function(e,t,n){if(R(n)||(n={default:n}),!L(e))return void 0!==n.default?n.default:e;"number"==typeof t&&(t=String(t));var r=Array.isArray(t),i="string"==typeof t,s=n.separator||".",o=n.joinChar||("string"==typeof s?s:".");if(!i&&!r)return e;if(i&&t in e)return B(t,e,n)?e[t]:n.default;var a=r?t:function(e,t,n){return"function"==typeof n.split?n.split(e):e.split(t)}(t,s,n),u=a.length,c=0;do{var l=a[c];for("number"==typeof l&&(l=String(l));l&&"\\"===l.slice(-1);)l=P([l.slice(0,-1),a[++c]||""],o,n);if(l in e){if(!B(l,e,n))return n.default;e=e[l]}else{for(var h=!1,f=c+1;f<u;)if(h=(l=P([l,a[f++]],o,n))in e){if(!B(l,e,n))return n.default;e=e[l],c=f-1;break}if(!h)return n.default}}while(++c<u&&L(e));return c===u?e:n.default})),F=256,N=[];F--;)N[F]=(F+256).toString(16).substring(1);for(var j,U=[],G=0;G<256;G++)U[G]=(G+256).toString(16).substring(1);var V,K,H,z,Q,q,$,J,W,Y,X,Z,ee,te,ne,re,ie,se,oe,ae,ue,ce,le,he,fe,de,pe,ge,ye,ve,me,be,ke,_e,Ae,Se,Ee,Ie,we,Oe,Ce,Te,xe,Re,Pe,Be,Le,De,Me,Fe,Ne,je,Ue,Ge,Ve,Ke,He,ze,Qe,qe,$e,Je,We,Ye,Xe,Ze,et,tt,nt,rt,it,st,ot,at=4,ut={setLogLevel:function(e){switch(e.toUpperCase()){case"INFO":at=1;break;case"DEBUG":at=2;break;case"WARN":at=3;break;default:at=4}},info:function(){var e;at<=1&&(e=console).info.apply(e,arguments)},debug:function(){var e;at<=2&&(e=console).log.apply(e,arguments)},warn:function(){var e;at<=3&&(e=console).warn.apply(e,arguments)},error:function(){var e;at<=4&&(e=console).error.apply(e,arguments)}},ct="ADOBE_ANALYTICS",lt=(u(V={"Adobe Analytics":ct,ADOBEANALYTICS:ct,"ADOBE ANALYTICS":ct},ct,ct),u(V,"AdobeAnalytics",ct),u(V,"adobeanalytics",ct),u(V,"adobe analytics",ct),u(V,"Adobe analytics",ct),u(V,"adobe Analytics",ct),V),ht="AM",ft=(u(K={},ht,ht),u(K,"AMPLITUDE",ht),u(K,"Amplitude",ht),u(K,"am",ht),K),dt="APPCUES",pt=(u(H={},dt,dt),u(H,"Appcues",dt),u(H,"App Cues",dt),u(H,"appcues",dt),H),gt="BINGADS",yt=(u(z={},gt,gt),u(z,"BingAds",gt),u(z,"bingads",gt),u(z,"Bing Ads",gt),u(z,"Bing ads",gt),u(z,"bing Ads",gt),u(z,"bing ads",gt),z),vt="BRAZE",mt=(u(Q={},vt,vt),u(Q,"Braze",vt),u(Q,"braze",vt),Q),bt="BUGSNAG",kt=(u(q={},bt,bt),u(q,"bugsnag",bt),u(q,"Bugsnag",bt),q),_t="CHARTBEAT",At=(u($={},_t,_t),u($,"Chartbeat",_t),u($,"chartbeat",_t),u($,"Chart Beat",_t),u($,"chart beat",_t),$),St="CLEVERTAP",Et=(u(J={},St,St),u(J,"Clevertap",St),u(J,"clevertap",St),J),It="COMSCORE",wt=(u(W={},It,It),u(W,"Comscore",It),u(W,"Com Score",It),u(W,"com Score",It),u(W,"com score",It),u(W,"Com score",It),W),Ot="CRITEO",Ct=(u(Y={},Ot,Ot),u(Y,"Criteo",Ot),u(Y,"criteo",Ot),Y),Tt="CUSTOMERIO",xt=(u(X={},Tt,Tt),u(X,"Customerio",Tt),u(X,"Customer.io",Tt),u(X,"CUSTOMER.IO",Tt),u(X,"customer.io",Tt),X),Rt="DRIP",Pt=(u(Z={},Rt,Rt),u(Z,"Drip",Rt),u(Z,"drip",Rt),Z),Bt="FACEBOOK_PIXEL",Lt=(u(ee={},Bt,Bt),u(ee,"FB Pixel",Bt),u(ee,"Facebook Pixel",Bt),u(ee,"facebook pixel",Bt),u(ee,"fbpixel",Bt),u(ee,"FBPIXEL",Bt),u(ee,"FB_PIXEL",Bt),ee),Dt="FULLSTORY",Mt=(u(te={},Dt,Dt),u(te,"Fullstory",Dt),u(te,"FullStory",Dt),u(te,"full Story",Dt),u(te,"Full Story",Dt),u(te,"Full story",Dt),u(te,"full story",Dt),u(te,"fullstory",Dt),te),Ft="GA",Nt=(u(ne={},Ft,Ft),u(ne,"Google Analytics",Ft),u(ne,"GoogleAnalytics",Ft),u(ne,"GOOGLE ANALYTICS",Ft),u(ne,"google analytics",Ft),ne),jt="GA4",Ut=(u(re={},jt,jt),u(re,"Google Analytics 4",jt),u(re,"Google analytics 4",jt),u(re,"google analytics 4",jt),u(re,"Google Analytics4",jt),u(re,"Google analytics4",jt),u(re,"google analytics4",jt),u(re,"GoogleAnalytics4",jt),re),Gt="GOOGLEADS",Vt=(u(ie={},Gt,Gt),u(ie,"Google Ads",Gt),u(ie,"GoogleAds",Gt),u(ie,"GOOGLE ADS",Gt),u(ie,"google ads",Gt),u(ie,"googleads",Gt),ie),Kt="GOOGLE_OPTIMIZE",Ht=(u(se={},Kt,Kt),u(se,"Google Optimize",Kt),u(se,"GoogleOptimize",Kt),u(se,"Googleoptimize",Kt),u(se,"GOOGLEOPTIMIZE",Kt),u(se,"google optimize",Kt),u(se,"Google optimize",Kt),u(se,"GOOGLE OPTIMIZE",Kt),se),zt="GTM",Qt=(u(oe={},zt,zt),u(oe,"Google Tag Manager",zt),u(oe,"google tag manager",zt),u(oe,"googletag manager",zt),u(oe,"googletagmanager",zt),oe),qt="HEAP",$t=(u(ae={},qt,qt),u(ae,"Heap",qt),u(ae,"heap",qt),u(ae,"Heap.io",qt),ae),Jt="HOTJAR",Wt=(u(ue={},Jt,Jt),u(ue,"Hotjar",Jt),u(ue,"hotjar",Jt),u(ue,"Hot Jar",Jt),u(ue,"hot jar",Jt),ue),Yt="HS",Xt=(u(ce={},Yt,Yt),u(ce,"Hubspot",Yt),u(ce,"HUBSPOT",Yt),u(ce,"hub spot",Yt),u(ce,"Hub Spot",Yt),u(ce,"Hub spot",Yt),ce),Zt="INTERCOM",en=(u(le={},Zt,Zt),u(le,"Intercom",Zt),u(le,"intercom",Zt),le),tn="KEEN",nn=(u(he={},tn,tn),u(he,"Keen",tn),u(he,"Keen.io",tn),u(he,"keen",tn),u(he,"keen.io",tn),he),rn="KISSMETRICS",sn=(u(fe={},rn,rn),u(fe,"Kissmetrics",rn),u(fe,"kissmetrics",rn),fe),on="KLAVIYO",an=(u(de={},on,on),u(de,"Klaviyo",on),u(de,"klaviyo",on),de),un="LAUNCHDARKLY",cn=(u(pe={},un,un),u(pe,"LaunchDarkly",un),u(pe,"Launch_Darkly",un),u(pe,"Launch Darkly",un),u(pe,"launchDarkly",un),u(pe,"launch darkly",un),pe),ln="LINKEDIN_INSIGHT_TAG",hn=(u(ge={},ln,ln),u(ge,"LinkedIn Insight Tag",ln),u(ge,"LinkedIn insight tag",ln),u(ge,"linkedIn insight tag",ln),u(ge,"Linkedin_insight_tag",ln),u(ge,"LinkedinInsighttag",ln),u(ge,"LinkedinInsightTag",ln),u(ge,"LinkedInInsightTag",ln),u(ge,"Linkedininsighttag",ln),u(ge,"LINKEDININSIGHTTAG",ln),u(ge,"linkedininsighttag",ln),ge),fn="LOTAME",dn=(u(ye={},fn,fn),u(ye,"Lotame",fn),u(ye,"lotame",fn),ye),pn="LYTICS",gn=(u(ve={},pn,pn),u(ve,"Lytics",pn),u(ve,"lytics",pn),ve),yn="MP",vn=(u(me={},yn,yn),u(me,"MIXPANEL",yn),u(me,"Mixpanel",yn),u(me,"MIX PANEL",yn),u(me,"Mix panel",yn),u(me,"Mix Panel",yn),me),mn="MOENGAGE",bn=(u(be={},mn,mn),u(be,"MoEngage",mn),u(be,"moengage",mn),u(be,"Moengage",mn),u(be,"Mo Engage",mn),u(be,"mo engage",mn),u(be,"Mo engage",mn),be),kn="OPTIMIZELY",_n=(u(ke={},kn,kn),u(ke,"Optimizely",kn),u(ke,"optimizely",kn),ke),An="PENDO",Sn=(u(_e={},An,An),u(_e,"Pendo",An),u(_e,"pendo",An),_e),En="PINTEREST_TAG",In=(u(Ae={},En,En),u(Ae,"PinterestTag",En),u(Ae,"Pinterest_Tag",En),u(Ae,"PINTERESTTAG",En),u(Ae,"pinterest",En),u(Ae,"PinterestAds",En),u(Ae,"Pinterest_Ads",En),u(Ae,"Pinterest",En),u(Ae,"Pinterest Tag",En),u(Ae,"Pinterest tag",En),u(Ae,"PINTEREST TAG",En),u(Ae,"pinterest tag",En),u(Ae,"Pinterest Ads",En),u(Ae,"Pinterest ads",En),Ae),wn="POST_AFFILIATE_PRO",On=(u(Se={},wn,wn),u(Se,"PostAffiliatePro",wn),u(Se,"Post_affiliate_pro",wn),u(Se,"Post Affiliate Pro",wn),u(Se,"Post affiliate pro",wn),u(Se,"post affiliate pro",wn),u(Se,"postaffiliatepro",wn),u(Se,"POSTAFFILIATEPRO",wn),Se),Cn="POSTHOG",Tn=(u(Ee={},Cn,Cn),u(Ee,"PostHog",Cn),u(Ee,"Posthog",Cn),u(Ee,"posthog",Cn),u(Ee,"Post Hog",Cn),u(Ee,"Post hog",Cn),u(Ee,"post hog",Cn),Ee),xn="PROFITWELL",Rn=(u(Ie={},xn,xn),u(Ie,"ProfitWell",xn),u(Ie,"profitwell",xn),u(Ie,"Profitwell",xn),u(Ie,"Profit Well",xn),u(Ie,"profit well",xn),u(Ie,"Profit well",xn),Ie),Pn="QUALTRICS",Bn=(u(we={},Pn,Pn),u(we,"Qualtrics",Pn),u(we,"qualtrics",Pn),we),Ln="QUANTUMMETRIC",Dn=(u(Oe={},Ln,Ln),u(Oe,"Quantum Metric",Ln),u(Oe,"quantum Metric",Ln),u(Oe,"quantum metric",Ln),u(Oe,"QuantumMetric",Ln),u(Oe,"quantumMetric",Ln),u(Oe,"quantummetric",Ln),u(Oe,"Quantum_Metric",Ln),Oe),Mn="REDDIT_PIXEL",Fn=(u(Ce={},Mn,Mn),u(Ce,"Reddit_Pixel",Mn),u(Ce,"RedditPixel",Mn),u(Ce,"REDDITPIXEL",Mn),u(Ce,"redditpixel",Mn),u(Ce,"Reddit Pixel",Mn),u(Ce,"REDDIT PIXEL",Mn),u(Ce,"reddit pixel",Mn),Ce),Nn="SENTRY",jn=(u(Te={},Nn,Nn),u(Te,"sentry",Nn),u(Te,"Sentry",Nn),Te),Un="SNAP_PIXEL",Gn=(u(xe={},Un,Un),u(xe,"Snap_Pixel",Un),u(xe,"SnapPixel",Un),u(xe,"SNAPPIXEL",Un),u(xe,"snappixel",Un),u(xe,"Snap Pixel",Un),u(xe,"SNAP PIXEL",Un),u(xe,"snap pixel",Un),xe),Vn="TVSQUARED",Kn=(u(Re={},Vn,Vn),u(Re,"TVSquared",Vn),u(Re,"tvsquared",Vn),u(Re,"tvSquared",Vn),u(Re,"TvSquared",Vn),u(Re,"Tvsquared",Vn),u(Re,"TV Squared",Vn),u(Re,"tv squared",Vn),u(Re,"tv Squared",Vn),Re),Hn="VWO",zn=(u(Pe={},Hn,Hn),u(Pe,"VisualWebsiteOptimizer",Hn),u(Pe,"Visualwebsiteoptimizer",Hn),u(Pe,"visualwebsiteoptimizer",Hn),u(Pe,"vwo",Hn),u(Pe,"Visual Website Optimizer",Hn),u(Pe,"Visual website optimizer",Hn),u(Pe,"visual website optimizer",Hn),Pe),Qn="GA360",qn=(u(Be={},Qn,Qn),u(Be,"Google Analytics 360",Qn),u(Be,"Google analytics 360",Qn),u(Be,"google analytics 360",Qn),u(Be,"Google Analytics360",Qn),u(Be,"Google analytics360",Qn),u(Be,"google analytics360",Qn),u(Be,"GoogleAnalytics360",Qn),u(Be,"GA 360",Qn),Be),$n="ADROLL",Jn=(u(Le={},$n,$n),u(Le,"Adroll",$n),u(Le,"Ad roll",$n),u(Le,"ad roll",$n),u(Le,"adroll",$n),Le),Wn="DCM_FLOODLIGHT",Yn=(u(De={},Wn,Wn),u(De,"DCM Floodlight",Wn),u(De,"dcm floodlight",Wn),u(De,"Dcm Floodlight",Wn),u(De,"DCMFloodlight",Wn),u(De,"dcmfloodlight",Wn),u(De,"DcmFloodlight",Wn),u(De,"dcm_floodlight",Wn),u(De,"DCM_Floodlight",Wn),De),Xn="MATOMO",Zn=(u(Me={},Xn,Xn),u(Me,"Matomo",Xn),u(Me,"matomo",Xn),Me),er="VERO",tr=(u(Fe={},er,er),u(Fe,"Vero",er),u(Fe,"vero",er),Fe),nr="MOUSEFLOW",rr=(u(Ne={},nr,nr),u(Ne,"Mouseflow",nr),u(Ne,"mouseflow",nr),u(Ne,"mouseFlow",nr),u(Ne,"MouseFlow",nr),u(Ne,"Mouse flow",nr),u(Ne,"mouse flow",nr),u(Ne,"mouse Flow",nr),u(Ne,"Mouse Flow",nr),Ne),ir="ROCKERBOX",sr=(u(je={},ir,ir),u(je,"Rockerbox",ir),u(je,"rockerbox",ir),u(je,"RockerBox",ir),u(je,"Rocker box",ir),u(je,"rocker box",ir),u(je,"Rocker Box",ir),je),or="CONVERTFLOW",ar=(u(Ue={},or,or),u(Ue,"Convertflow",or),u(Ue,"convertflow",or),u(Ue,"convertFlow",or),u(Ue,"ConvertFlow",or),u(Ue,"Convert flow",or),u(Ue,"convert flow",or),u(Ue,"convert Flow",or),u(Ue,"Convert Flow",or),u(Ue,"CONVERT FLOW",or),Ue),ur="SNAPENGAGE",cr=(u(Ge={},ur,ur),u(Ge,"SnapEngage",ur),u(Ge,"Snap_Engage",ur),u(Ge,"snapengage",ur),u(Ge,"SNAP ENGAGE",ur),u(Ge,"Snap Engage",ur),u(Ge,"snap engage",ur),Ge),lr="LIVECHAT",hr=(u(Ve={},lr,lr),u(Ve,"LiveChat",lr),u(Ve,"Live_Chat",lr),u(Ve,"livechat",lr),u(Ve,"LIVE CHAT",lr),u(Ve,"Live Chat",lr),u(Ve,"live chat",lr),Ve),fr="SHYNET",dr=(u(Ke={},fr,fr),u(Ke,"shynet",fr),u(Ke,"ShyNet",fr),u(Ke,"shyNet",fr),u(Ke,"Shynet",fr),u(Ke,"shy net",fr),u(Ke,"Shy Net",fr),u(Ke,"shy Net",fr),u(Ke,"Shy net",fr),Ke),pr="WOOPRA",gr=(u(He={},pr,pr),u(He,"Woopra",pr),u(He,"woopra",pr),He),yr="ROLLBAR",vr=(u(ze={},yr,yr),u(ze,"RollBar",yr),u(ze,"Roll_Bar",yr),u(ze,"rollbar",yr),u(ze,"Rollbar",yr),u(ze,"ROLL BAR",yr),u(ze,"Roll Bar",yr),u(ze,"roll bar",yr),ze),mr="QUORA_PIXEL",br=(u(Qe={},mr,mr),u(Qe,"Quora Pixel",mr),u(Qe,"Quora pixel",mr),u(Qe,"QUORA PIXEL",mr),u(Qe,"QuoraPixel",mr),u(Qe,"Quorapixel",mr),u(Qe,"QUORAPIXEL",mr),u(Qe,"Quora_Pixel",mr),u(Qe,"quora_pixel",mr),u(Qe,"Quora",mr),Qe),kr="JUNE",_r=(u(qe={},kr,kr),u(qe,"June",kr),u(qe,"june",kr),qe),Ar="ENGAGE",Sr=(u($e={},Ar,Ar),u($e,"Engage",Ar),u($e,"engage",Ar),$e),Er="ITERABLE",Ir=(u(Je={},Er,Er),u(Je,"Iterable",Er),u(Je,"iterable",Er),Je),wr="YANDEX_METRICA",Or=(u(We={},wr,wr),u(We,"Yandexmetrica",wr),u(We,"yandexmetrica",wr),u(We,"yandexMetrica",wr),u(We,"YandexMetrica",wr),We),Cr="REFINER",Tr=(u(Ye={},Cr,Cr),u(Ye,"Refiner",Cr),u(Ye,"refiner",Cr),Ye),xr="QUALAROO",Rr=(u(Xe={},xr,xr),u(Xe,"Qualaroo",xr),u(Xe,"qualaroo",xr),Xe),Pr="PODSIGHTS",Br=(u(Ze={},Pr,Pr),u(Ze,"Podsights",Pr),u(Ze,"PodSights",Pr),u(Ze,"pod Sights",Pr),u(Ze,"Pod Sights",Pr),u(Ze,"pod sights",Pr),u(Ze,"POD SIGHTS",Pr),u(Ze,"Pod sights",Pr),Ze),Lr="AXEPTIO",Dr=(u(et={},Lr,Lr),u(et,"Axeptio",Lr),u(et,"axeptio",Lr),et),Mr="SATISMETER",Fr=(u(tt={},Mr,Mr),u(tt,"Satismeter",Mr),u(tt,"SatisMeter",Mr),u(tt,"SATISMETER",Mr),tt),Nr="MICROSOFT_CLARITY",jr=(u(nt={},Nr,Nr),u(nt,"Microsoft Clarity",Nr),u(nt,"Microsoft clarity",Nr),u(nt,"microsoft clarity",Nr),u(nt,"Microsoft_clarity",Nr),u(nt,"MicrosoftClarity",Nr),u(nt,"MICROSOFTCLARITY",Nr),u(nt,"microsoftclarity",Nr),u(nt,"microsoftClarity",Nr),nt),Ur="SENDINBLUE",Gr=(u(rt={},Ur,Ur),u(rt,"Sendinblue",Ur),u(rt,"sendinblue",Ur),u(rt,"SendinBlue",Ur),rt),Vr="OLARK",Kr=(u(it={},Vr,Vr),u(it,"Olark",Vr),u(it,"olark",Vr),it),Hr="LEMNISK",zr=(u(st={},Hr,Hr),u(st,"LEMNISK_MARKETING_AUTOMATION",Hr),u(st,"Lemnisk Marketing Automation",Hr),u(st,"LemniskMarketingAutomation",Hr),u(st,"lemniskmarketingautomation",Hr),u(st,"lemniskMarketingAutomation",Hr),u(st,"lemnisk",Hr),u(st,"Lemnisk",Hr),st),Qr="TIKTOK_ADS",qr=(u(ot={},Qr,Qr),u(ot,"TiktokAds",Qr),u(ot,"TIKTOK_ADS",Qr),u(ot,"Tiktok ads",Qr),u(ot,"Tiktok Ads",Qr),u(ot,"Tik Tok Ads",Qr),u(ot,"tik tok ads",Qr),u(ot,"tiktokads",Qr),ot),$r=r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r(r({All:"All"},lt),ft),pt),yt),mt),kt),At),Et),wt),Ct),xt),Pt),Lt),Mt),Nt),Ut),qn),Vt),Ht),Qt),$t),Wt),Xt),en),nn),sn),an),cn),hn),dn),gn),vn),bn),_n),Sn),In),On),Tn),Rn),Bn),Dn),Fn),jn),Gn),Kn),zn),Jn),Yn),Zn),tr),rr),ar),cr),hr),dr),gr),vr),br),_r),Sr),Ir),sr),Or),Tr),Rr),Br),Dr),Fr),jr),Gr),Kr),zr),qr),Jr={All:"All",GA:"Google Analytics",GOOGLEADS:"Google Ads",BRAZE:"Braze",CHARTBEAT:"Chartbeat",COMSCORE:"Comscore",CUSTOMERIO:"Customer IO",DCM_Floodlight:"DCM Floodlight",FACEBOOK_PIXEL:"Facebook Pixel",GTM:"Google Tag Manager",HOTJAR:"Hotjar",HS:"HubSpot",INTERCOM:"Intercom",KEEN:"Keen",KISSMETRICS:"Kiss Metrics",LOTAME:"Lotame",VWO:"VWO",OPTIMIZELY:"Optimizely Web",FULLSTORY:"Fullstory",TVSQUARED:"TVSquared",GA4:"Google Analytics 4",MOENGAGE:"MoEngage",AM:"Amplitude",PENDO:"Pendo",LYTICS:"Lytics",APPCUES:"Appcues",POSTHOG:"PostHog",PROFITWELL:"ProfitWell",KLAVIYO:"Klaviyo",CLEVERTAP:"CleverTap",BINGADS:"Bing Ads",PINTEREST_TAG:"Pinterest Tag",SNAP_PIXEL:"Snap Pixel",LINKEDIN_INSIGHT_TAG:"Linkedin Insight Tag",REDDIT_PIXEL:"Reddit Pixel",DRIP:"Drip",HEAP:"Heap.io",CRITEO:"Criteo",MP:"Mixpanel",QUALTRICS:"Qualtrics",SENTRY:"Sentry",GOOGLE_OPTIMIZE:"Google Optimize",POST_AFFILIATE_PRO:"Post Affiliate Pro",LAUNCHDARKLY:"LaunchDarkly",GA360:"Google Analytics 360",ADROLL:"Adroll",VERO:"Vero",MATOMO:"Matomo",MOUSEFLOW:"Mouseflow",ROCKERBOX:"Rockerbox",CONVERTFLOW:"ConvertFlow",SNAPENGAGE:"SnapEngage",LIVECHAT:"LiveChat",SHYNET:"Shynet",WOOPRA:"Woopra",ROLLBAR:"RollBar",QUORA_PIXEL:"Quora Pixel",JUNE:"June",ENGAGE:"Engage",ITERABLE:"Iterable",YANDEX_METRICA:"Yandex.Metrica",REFINER:"Refiner",QUALAROO:"Qualaroo",PODSIGHTS:"Podsights",AXEPTIO:"Axeptio",SATISMETER:"Satismeter",MICROSOFT_CLARITY:"Microsoft Clarity",SENDINBLUE:"Sendinblue",OLARK:"Olark",LEMNISK:"Lemnisk",TIKTOK_ADS:"TikTok Ads"},Wr=["anonymous_id","id","sent_at","received_at","timestamp","original_timestamp","event_text","event"],Yr="https://api.rudderlabs.com/sourceConfig/?p=npm&v=2.37.0",Xr="v1.1",Zr="js-integrations",ei="".concat("https://cdn.rudderlabs.com","/").concat(Xr,"/").concat(Zr),ti=1e4,ni=1e3,ri=["Lax","None","Strict"],ii=["US","EU"],si=["oneTrust","ketch"],oi=["library","consentManagement"],ai=["none","default","full"],ui={All:!0},ci="Request failed with status:",li=[ci],hi=function(e){var t=window.rudderanalytics&&window.rudderanalytics.errorReporting;t&&e instanceof Error&&t.notify(e)},fi=function(e,t){if(!Array.isArray(e)||!Array.isArray(t))return O(t);var n=O(e);return t.forEach((function(e,t){n[t]=di(n[t],e)})),n},di=function(e,t){return x(fi,e,t)},pi=function(e,t){return JSON.stringify(e,function(e){var t=[];return function(n,r){if(!e||null!=r){if("object"!==i(r)||null===r)return r;for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(r)?(ut.debug("Circular Reference detected for key: ".concat(n)),"[Circular Reference]"):(t.push(r),r)}}}(t))},gi=function(e,t,n){var r,s;try{r="string"==typeof e?e:e instanceof Error||e.message?e.message:pi(e)}catch(e){r=""}if("object"===i(s=e)&&null!==s&&"target"in s){if(e.target&&"script"!==e.target.localName)return"";if(e.target.dataset&&("RS_JS_SDK"!==e.target.dataset.loader||"true"!==e.target.dataset.isNonNativeSDK))return"";if(r="error in script loading:: src:: ".concat(e.target.src," id:: ").concat(e.target.id),"ad-block"===e.target.id)return n.page("RudderJS-Initiated","ad-block page request",{path:"/ad-blocked",title:r},n.sendAdblockPageOptions),""}return"[handleError]::".concat(t||"",' "').concat(r,'"')},yi=function(e,t,n){var r;try{r=gi(e,t,n)}catch(t){ut.error("[handleError] Exception:: ",t),ut.error("[handleError] Original error:: ",pi(e)),hi(t)}r&&(ut.error(r),function(e){return!e.message||!li.some((function(t){return e.message.includes(t)}))}(e)&&hi(e))};function vi(e){return e&&e.endsWith("/")?e.replace(/\/+$/,""):e}function mi(){return window.crypto&&"function"==typeof window.crypto.getRandomValues?function(){(!j||G+16>4096)&&(j=crypto.getRandomValues(new Uint8Array(4096)),G=0);for(var e,t=0,n="";t<16;t++)e=j[G+t],n+=6==t?U[15&e|64]:8==t?U[63&e|128]:U[e],1&t&&t>1&&t<11&&(n+="-");return G+=16,n}():function(){var e,t=0,n="";if(!D||F+16>256){for(D=Array(t=256);t--;)D[t]=256*Math.random()|0;t=F=0}for(;t<16;t++)e=D[F+t],n+=6==t?N[15&e|64]:8==t?N[63&e|128]:N[e],1&t&&t>1&&t<11&&(n+="-");return F++,n}()}function bi(){return(new Date).toISOString()}function ki(e,t){Object.keys(e).forEach((function(n){e.hasOwnProperty(n)&&(t[n]&&(e[t[n]]=e[n]),"All"!=n&&null!=t[n]&&t[n]!=n&&delete e[n])}))}function _i(e){ki(e,$r)}function Ai(e){ki(e,Jr)}function Si(e,t){var n=[];if(!t||0===t.length)return n;var r=!0;void 0!==e.All&&(r=e.All);var s=[];return"string"==typeof t[0]?t.forEach((function(e){s.push({intgName:e,intObj:e})})):"object"===i(t[0])&&t.forEach((function(e){s.push({intgName:e.name,intObj:e})})),s.forEach((function(t){var i=t.intgName,s=t.intObj;if(r){var o=!0;null!=e[i]&&0==e[i]&&(o=!1),o&&n.push(s)}else null!=e[i]&&1==e[i]&&n.push(s)})),n}var Ei,Ii=function(){for(var e,t=document.getElementsByTagName("script"),n=!1,r=0;r<t.length;r+=1){var i=vi(t[r].getAttribute("src"));if(i){var s=i.match(/^.*rudder-analytics(-staging)?(\.min)?\.js$/);if(s){e=i,n=void 0!==s[1];break}}}return{sdkURL:e,isStaging:n}},wi=function(e){return"string"==typeof e||null==e?e:JSON.stringify(e)},Oi=function(e){return!(!e||"string"!=typeof e||0===e.trim().length)},Ci={exports:{}},Ti={exports:{}},xi=function(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var n=function e(){if(this instanceof e){var n=[null];return n.push.apply(n,arguments),new(Function.bind.apply(t,n))}return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}(Object.freeze({__proto__:null,default:{}}));function Ri(){return Ei||(Ei=1,function(e,t){var n;e.exports=(n=n||function(e,t){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==d&&d.crypto&&(n=d.crypto),!n)try{n=xi}catch(e){}var r=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},i=Object.create||function(){function e(){}return function(t){var n;return e.prototype=t,n=new e,e.prototype=null,n}}(),s={},o=s.lib={},a=o.Base={extend:function(e){var t=i(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=o.WordArray=a.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes,i=e.sigBytes;if(this.clamp(),r%4)for(var s=0;s<i;s++){var o=n[s>>>2]>>>24-s%4*8&255;t[r+s>>>2]|=o<<24-(r+s)%4*8}else for(var a=0;a<i;a+=4)t[r+a>>>2]=n[a>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],n=0;n<e;n+=4)t.push(r());return new u.init(t,e)}}),c=s.enc={},l=c.Hex={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var s=t[i>>>2]>>>24-i%4*8&255;r.push((s>>>4).toString(16)),r.push((15&s).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(n,t/2)}},h=c.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i<n;i++){var s=t[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(s))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(n,t)}},f=c.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},p=o.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=f.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n,r=this._data,i=r.words,s=r.sigBytes,o=this.blockSize,a=s/(4*o),c=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,l=e.min(4*c,s);if(c){for(var h=0;h<c;h+=o)this._doProcessBlock(i,h);n=i.splice(0,c),r.sigBytes-=l}return new u.init(n,l)},clone:function(){var e=a.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});o.Hasher=p.extend({cfg:a.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new g.HMAC.init(e,n).finalize(t)}}});var g=s.algo={};return s}(Math),n)}(Ti)),Ti.exports}var Pi,Bi={exports:{}};var Li,Di={exports:{}};var Mi,Fi={exports:{}},Ni={exports:{}};var ji,Ui,Gi={exports:{}};function Vi(){return Ui||(Ui=1,function(e,t){var n,r,i,s,o,a,u,c;e.exports=(c=Ri(),Mi||(Mi=1,function(e,t){var n,r,i,s,o,a,u,c;e.exports=(r=(n=c=Ri()).lib,i=r.WordArray,s=r.Hasher,o=n.algo,a=[],u=o.SHA1=s.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],s=n[2],o=n[3],u=n[4],c=0;c<80;c++){if(c<16)a[c]=0|e[t+c];else{var l=a[c-3]^a[c-8]^a[c-14]^a[c-16];a[c]=l<<1|l>>>31}var h=(r<<5|r>>>27)+u+a[c];h+=c<20?1518500249+(i&s|~i&o):c<40?1859775393+(i^s^o):c<60?(i&s|i&o|s&o)-1894007588:(i^s^o)-899497514,u=o,o=s,s=i<<30|i>>>2,i=r,r=h}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+s|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0},_doFinalize:function(){var e=this._data,t=e.words,n=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),t[15+(r+64>>>9<<4)]=n,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}}),n.SHA1=s._createHelper(u),n.HmacSHA1=s._createHmacHelper(u),c.SHA1)}(Ni)),Ni.exports,ji||(ji=1,function(e,t){var n;e.exports=(n=Ri(),void function(){var e=n,t=e.lib.Base,r=e.enc.Utf8;e.algo.HMAC=t.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var n=e.blockSize,i=4*n;t.sigBytes>i&&(t=e.finalize(t)),t.clamp();for(var s=this._oKey=t.clone(),o=this._iKey=t.clone(),a=s.words,u=o.words,c=0;c<n;c++)a[c]^=1549556828,u[c]^=909522486;s.sigBytes=o.sigBytes=i,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,n=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(n))}})}())}(Gi)),i=(r=(n=c).lib).Base,s=r.WordArray,a=(o=n.algo).MD5,u=o.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:a,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n,r=this.cfg,i=r.hasher.create(),o=s.create(),a=o.words,u=r.keySize,c=r.iterations;a.length<u;){n&&i.update(n),n=i.update(e).finalize(t),i.reset();for(var l=1;l<c;l++)n=i.finalize(n),i.reset();o.concat(n)}return o.sigBytes=4*u,o}}),n.EvpKDF=function(e,t,n){return u.create(n).compute(e,t)},c.EvpKDF)}(Fi)),Fi.exports}var Ki,Hi={exports:{}};!function(e,t){var n;e.exports=(n=Ri(),Pi||(Pi=1,function(e,t){var n;e.exports=(n=Ri(),function(){var e=n,t=e.lib.WordArray;function r(e,n,r){for(var i=[],s=0,o=0;o<n;o++)if(o%4){var a=r[e.charCodeAt(o-1)]<<o%4*2|r[e.charCodeAt(o)]>>>6-o%4*2;i[s>>>2]|=a<<24-s%4*8,s++}return t.create(i,s)}e.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],s=0;s<n;s+=3)for(var o=(t[s>>>2]>>>24-s%4*8&255)<<16|(t[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|t[s+2>>>2]>>>24-(s+2)%4*8&255,a=0;a<4&&s+.75*a<n;a++)i.push(r.charAt(o>>>6*(3-a)&63));var u=r.charAt(64);if(u)for(;i.length%4;)i.push(u);return i.join("")},parse:function(e){var t=e.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var s=0;s<n.length;s++)i[n.charCodeAt(s)]=s}var o=n.charAt(64);if(o){var a=e.indexOf(o);-1!==a&&(t=a)}return r(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),n.enc.Base64)}(Bi)),Li||(Li=1,function(e,t){var n;e.exports=(n=Ri(),function(e){var t=n,r=t.lib,i=r.WordArray,s=r.Hasher,o=t.algo,a=[];!function(){for(var t=0;t<64;t++)a[t]=4294967296*e.abs(e.sin(t+1))|0}();var u=o.MD5=s.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var n=0;n<16;n++){var r=t+n,i=e[r];e[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var s=this._hash.words,o=e[t+0],u=e[t+1],d=e[t+2],p=e[t+3],g=e[t+4],y=e[t+5],v=e[t+6],m=e[t+7],b=e[t+8],k=e[t+9],_=e[t+10],A=e[t+11],S=e[t+12],E=e[t+13],I=e[t+14],w=e[t+15],O=s[0],C=s[1],T=s[2],x=s[3];O=c(O,C,T,x,o,7,a[0]),x=c(x,O,C,T,u,12,a[1]),T=c(T,x,O,C,d,17,a[2]),C=c(C,T,x,O,p,22,a[3]),O=c(O,C,T,x,g,7,a[4]),x=c(x,O,C,T,y,12,a[5]),T=c(T,x,O,C,v,17,a[6]),C=c(C,T,x,O,m,22,a[7]),O=c(O,C,T,x,b,7,a[8]),x=c(x,O,C,T,k,12,a[9]),T=c(T,x,O,C,_,17,a[10]),C=c(C,T,x,O,A,22,a[11]),O=c(O,C,T,x,S,7,a[12]),x=c(x,O,C,T,E,12,a[13]),T=c(T,x,O,C,I,17,a[14]),O=l(O,C=c(C,T,x,O,w,22,a[15]),T,x,u,5,a[16]),x=l(x,O,C,T,v,9,a[17]),T=l(T,x,O,C,A,14,a[18]),C=l(C,T,x,O,o,20,a[19]),O=l(O,C,T,x,y,5,a[20]),x=l(x,O,C,T,_,9,a[21]),T=l(T,x,O,C,w,14,a[22]),C=l(C,T,x,O,g,20,a[23]),O=l(O,C,T,x,k,5,a[24]),x=l(x,O,C,T,I,9,a[25]),T=l(T,x,O,C,p,14,a[26]),C=l(C,T,x,O,b,20,a[27]),O=l(O,C,T,x,E,5,a[28]),x=l(x,O,C,T,d,9,a[29]),T=l(T,x,O,C,m,14,a[30]),O=h(O,C=l(C,T,x,O,S,20,a[31]),T,x,y,4,a[32]),x=h(x,O,C,T,b,11,a[33]),T=h(T,x,O,C,A,16,a[34]),C=h(C,T,x,O,I,23,a[35]),O=h(O,C,T,x,u,4,a[36]),x=h(x,O,C,T,g,11,a[37]),T=h(T,x,O,C,m,16,a[38]),C=h(C,T,x,O,_,23,a[39]),O=h(O,C,T,x,E,4,a[40]),x=h(x,O,C,T,o,11,a[41]),T=h(T,x,O,C,p,16,a[42]),C=h(C,T,x,O,v,23,a[43]),O=h(O,C,T,x,k,4,a[44]),x=h(x,O,C,T,S,11,a[45]),T=h(T,x,O,C,w,16,a[46]),O=f(O,C=h(C,T,x,O,d,23,a[47]),T,x,o,6,a[48]),x=f(x,O,C,T,m,10,a[49]),T=f(T,x,O,C,I,15,a[50]),C=f(C,T,x,O,y,21,a[51]),O=f(O,C,T,x,S,6,a[52]),x=f(x,O,C,T,p,10,a[53]),T=f(T,x,O,C,_,15,a[54]),C=f(C,T,x,O,u,21,a[55]),O=f(O,C,T,x,b,6,a[56]),x=f(x,O,C,T,w,10,a[57]),T=f(T,x,O,C,v,15,a[58]),C=f(C,T,x,O,E,21,a[59]),O=f(O,C,T,x,g,6,a[60]),x=f(x,O,C,T,A,10,a[61]),T=f(T,x,O,C,d,15,a[62]),C=f(C,T,x,O,k,21,a[63]),s[0]=s[0]+O|0,s[1]=s[1]+C|0,s[2]=s[2]+T|0,s[3]=s[3]+x|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var s=e.floor(r/4294967296),o=r;n[15+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),n[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(n.length+1),this._process();for(var a=this._hash,u=a.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return a},clone:function(){var e=s.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,n,r,i,s,o){var a=e+(t&n|~t&r)+i+o;return(a<<s|a>>>32-s)+t}function l(e,t,n,r,i,s,o){var a=e+(t&r|n&~r)+i+o;return(a<<s|a>>>32-s)+t}function h(e,t,n,r,i,s,o){var a=e+(t^n^r)+i+o;return(a<<s|a>>>32-s)+t}function f(e,t,n,r,i,s,o){var a=e+(n^(t|~r))+i+o;return(a<<s|a>>>32-s)+t}t.MD5=s._createHelper(u),t.HmacMD5=s._createHmacHelper(u)}(Math),n.MD5)}(Di)),Vi(),Ki||(Ki=1,function(e,t){var n;e.exports=(n=Ri(),Vi(),void(n.lib.Cipher||function(e){var t=n,r=t.lib,i=r.Base,s=r.WordArray,o=r.BufferedBlockAlgorithm,a=t.enc;a.Utf8;var u=a.Base64,c=t.algo.EvpKDF,l=r.Cipher=o.extend({cfg:i.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?b:v}return function(t){return{encrypt:function(n,r,i){return e(r).encrypt(t,n,r,i)},decrypt:function(n,r,i){return e(r).decrypt(t,n,r,i)}}}}()});r.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var h=t.mode={},f=r.BlockCipherMode=i.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),d=h.CBC=function(){var e=f.extend();function t(e,t,n){var r,i=this._iv;i?(r=i,this._iv=undefined):r=this._prevBlock;for(var s=0;s<n;s++)e[t+s]^=r[s]}return e.Encryptor=e.extend({processBlock:function(e,n){var r=this._cipher,i=r.blockSize;t.call(this,e,n,i),r.encryptBlock(e,n),this._prevBlock=e.slice(n,n+i)}}),e.Decryptor=e.extend({processBlock:function(e,n){var r=this._cipher,i=r.blockSize,s=e.slice(n,n+i);r.decryptBlock(e,n),t.call(this,e,n,i),this._prevBlock=s}}),e}(),p=(t.pad={}).Pkcs7={pad:function(e,t){for(var n=4*t,r=n-e.sigBytes%n,i=r<<24|r<<16|r<<8|r,o=[],a=0;a<r;a+=4)o.push(i);var u=s.create(o,r);e.concat(u)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};r.BlockCipher=l.extend({cfg:l.cfg.extend({mode:d,padding:p}),reset:function(){var e;l.reset.call(this);var t=this.cfg,n=t.iv,r=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=r.createEncryptor:(e=r.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,n&&n.words):(this._mode=e.call(r,this,n&&n.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var g=r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),y=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;return(n?s.create([1398893684,1701076831]).concat(n).concat(t):t).toString(u)},parse:function(e){var t,n=u.parse(e),r=n.words;return 1398893684==r[0]&&1701076831==r[1]&&(t=s.create(r.slice(2,4)),r.splice(0,4),n.sigBytes-=16),g.create({ciphertext:n,salt:t})}},v=r.SerializableCipher=i.extend({cfg:i.extend({format:y}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r),s=i.finalize(t),o=i.cfg;return g.create({ciphertext:s,key:n,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),m=(t.kdf={}).OpenSSL={execute:function(e,t,n,r){r||(r=s.random(8));var i=c.create({keySize:t+n}).compute(e,r),o=s.create(i.words.slice(t),4*n);return i.sigBytes=4*t,g.create({key:i,iv:o,salt:r})}},b=r.PasswordBasedCipher=v.extend({cfg:v.cfg.extend({kdf:m}),encrypt:function(e,t,n,r){var i=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize);r.iv=i.iv;var s=v.encrypt.call(this,e,t,i.key,r);return s.mixIn(i),s},decrypt:function(e,t,n,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var i=r.kdf.execute(n,e.keySize,e.ivSize,t.salt);return r.iv=i.iv,v.decrypt.call(this,e,t,i.key,r)}})}()))}(Hi)),function(){var e=n,t=e.lib.BlockCipher,r=e.algo,i=[],s=[],o=[],a=[],u=[],c=[],l=[],h=[],f=[],d=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var n=0,r=0;for(t=0;t<256;t++){var p=r^r<<1^r<<2^r<<3^r<<4;p=p>>>8^255&p^99,i[n]=p,s[p]=n;var g=e[n],y=e[g],v=e[y],m=257*e[p]^16843008*p;o[n]=m<<24|m>>>8,a[n]=m<<16|m>>>16,u[n]=m<<8|m>>>24,c[n]=m,m=16843009*v^65537*y^257*g^16843008*n,l[p]=m<<24|m>>>8,h[p]=m<<16|m>>>16,f[p]=m<<8|m>>>24,d[p]=m,n?(n=g^e[e[e[v^g]]],r^=e[e[r]]):n=r=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],g=r.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,n=e.sigBytes/4,r=4*((this._nRounds=n+6)+1),s=this._keySchedule=[],o=0;o<r;o++)o<n?s[o]=t[o]:(c=s[o-1],o%n?n>6&&o%n==4&&(c=i[c>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c]):(c=i[(c=c<<8|c>>>24)>>>24]<<24|i[c>>>16&255]<<16|i[c>>>8&255]<<8|i[255&c],c^=p[o/n|0]<<24),s[o]=s[o-n]^c);for(var a=this._invKeySchedule=[],u=0;u<r;u++){if(o=r-u,u%4)var c=s[o];else c=s[o-4];a[u]=u<4||o<=4?c:l[i[c>>>24]]^h[i[c>>>16&255]]^f[i[c>>>8&255]]^d[i[255&c]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,u,c,i)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,l,h,f,d,s),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,s,o,a){for(var u=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],h=e[t+2]^n[2],f=e[t+3]^n[3],d=4,p=1;p<u;p++){var g=r[c>>>24]^i[l>>>16&255]^s[h>>>8&255]^o[255&f]^n[d++],y=r[l>>>24]^i[h>>>16&255]^s[f>>>8&255]^o[255&c]^n[d++],v=r[h>>>24]^i[f>>>16&255]^s[c>>>8&255]^o[255&l]^n[d++],m=r[f>>>24]^i[c>>>16&255]^s[l>>>8&255]^o[255&h]^n[d++];c=g,l=y,h=v,f=m}g=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[h>>>8&255]<<8|a[255&f])^n[d++],y=(a[l>>>24]<<24|a[h>>>16&255]<<16|a[f>>>8&255]<<8|a[255&c])^n[d++],v=(a[h>>>24]<<24|a[f>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],m=(a[f>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&h])^n[d++],e[t]=g,e[t+1]=y,e[t+2]=v,e[t+3]=m},keySize:8});e.AES=t._createHelper(g)}(),n.AES)}(Ci);var zi=p(Ci.exports),Qi={exports:{}};!function(e,t){e.exports=Ri().enc.Utf8}(Qi);var qi=p(Qi.exports),$i=void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function Ji(){throw new Error("setTimeout has not been defined")}function Wi(){throw new Error("clearTimeout has not been defined")}var Yi=Ji,Xi=Wi;function Zi(e){if(Yi===setTimeout)return setTimeout(e,0);if((Yi===Ji||!Yi)&&setTimeout)return Yi=setTimeout,setTimeout(e,0);try{return Yi(e,0)}catch(t){try{return Yi.call(null,e,0)}catch(t){return Yi.call(this,e,0)}}}"function"==typeof $i.setTimeout&&(Yi=setTimeout),"function"==typeof $i.clearTimeout&&(Xi=clearTimeout);var es,ts=[],ns=!1,rs=-1;function is(){ns&&es&&(ns=!1,es.length?ts=es.concat(ts):rs=-1,ts.length&&ss())}function ss(){if(!ns){var e=Zi(is);ns=!0;for(var t=ts.length;t;){for(es=ts,ts=[];++rs<t;)es&&es[rs].run();rs=-1,t=ts.length}es=null,ns=!1,function(e){if(Xi===clearTimeout)return clearTimeout(e);if((Xi===Wi||!Xi)&&clearTimeout)return Xi=clearTimeout,clearTimeout(e);try{Xi(e)}catch(t){try{return Xi.call(null,e)}catch(t){return Xi.call(this,e)}}}(e)}}function os(e,t){this.fun=e,this.array=t}function as(){}os.prototype.run=function(){this.fun.apply(null,this.array)};var us,cs,ls=as,hs=as,fs=as,ds=as,ps=as,gs=as,ys=as,vs=$i.performance||{},ms=vs.now||vs.mozNow||vs.msNow||vs.oNow||vs.webkitNow||function(){return(new Date).getTime()},bs=new Date,ks={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];ts.push(new os(e,t)),1!==ts.length||ns||Zi(ss)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:ls,addListener:hs,once:fs,off:ds,removeListener:ps,removeAllListeners:gs,emit:ys,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*ms.call(vs),n=Math.floor(t),r=Math.floor(t%1*1e9);return e&&(n-=e[0],(r-=e[1])<0&&(n--,r+=1e9)),[n,r]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-bs)/1e3}},_s={exports:{}};function As(){if(cs)return us;cs=1;var e=1e3,t=60*e,n=60*t,r=24*n,s=7*r;function o(e,t,n,r){var i=t>=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}return us=function(a,u){u=u||{};var c=i(a);if("string"===c&&a.length>0)return function(i){if(!((i=String(i)).length>100)){var o=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(o){var a=parseFloat(o[1]);switch((o[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*a;case"weeks":case"week":case"w":return a*s;case"days":case"day":case"d":return a*r;case"hours":case"hour":case"hrs":case"hr":case"h":return a*n;case"minutes":case"minute":case"mins":case"min":case"m":return a*t;case"seconds":case"second":case"secs":case"sec":case"s":return a*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}}}(a);if("number"===c&&isFinite(a))return u.long?function(i){var s=Math.abs(i);return s>=r?o(i,s,r,"day"):s>=n?o(i,s,n,"hour"):s>=t?o(i,s,t,"minute"):s>=e?o(i,s,e,"second"):i+" ms"}(a):function(i){var s=Math.abs(i);return s>=r?Math.round(i/r)+"d":s>=n?Math.round(i/n)+"h":s>=t?Math.round(i/t)+"m":s>=e?Math.round(i/e)+"s":i+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))},us}!function(e,t){var n;t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),this.useColors){var n="color: "+this.color;t.splice(1,0,n,"color: inherit");var r=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(r++,"%c"===e&&(i=r))})),t.splice(i,0,n)}},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){var e;try{e=t.storage.getItem("debug")}catch(e){}return!e&&void 0!==ks&&"env"in ks&&(e=ks.env.DEBUG),e},t.useColors=function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(n=!1,function(){n||(n=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||function(){},e.exports=function(e){function t(e){var r,i,s,o=null;function a(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];if(a.enabled){var s=a,o=Number(new Date),u=o-(r||o);s.diff=u,s.prev=r,s.curr=o,r=o,n[0]=t.coerce(n[0]),"string"!=typeof n[0]&&n.unshift("%O");var c=0;n[0]=n[0].replace(/%([a-zA-Z%])/g,(function(e,r){if("%%"===e)return"%";c++;var i=t.formatters[r];if("function"==typeof i){var o=n[c];e=i.call(s,o),n.splice(c,1),c--}return e})),t.formatArgs.call(s,n),(s.log||t.log).apply(s,n)}}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=n,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:function(){return null!==o?o:(i!==t.namespaces&&(i=t.namespaces,s=t.enabled(e)),s)},set:function(e){o=e}}),"function"==typeof t.init&&t.init(a),a}function n(e,n){var r=t(this.namespace+(void 0===n?":":n)+e);return r.log=this.log,r}function r(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){var e=[].concat(l(t.names.map(r)),l(t.skips.map(r).map((function(e){return"-"+e})))).join(",");return t.enable(""),e},t.enable=function(e){var n;t.save(e),t.namespaces=e,t.names=[],t.skips=[];var r=("string"==typeof e?e:"").split(/[\s,]+/),i=r.length;for(n=0;n<i;n++)r[n]&&("-"===(e=r[n].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;var n,r;for(n=0,r=t.skips.length;n<r;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;n<r;n++)if(t.names[n].test(e))return!0;return!1},t.humanize=As(),t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((function(n){t[n]=e[n]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){for(var n=0,r=0;r<e.length;r++)n=(n<<5)-n+e.charCodeAt(r),n|=0;return t.colors[Math.abs(n)%t.colors.length]},t.enable(t.load()),t}(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(_s,_s.exports);var Ss=_s.exports,Es=Ss("cookie");function Is(){var e;try{e=document.cookie}catch(e){return"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e.stack||e),{}}return function(e){var t,n={},r=e.split(/ *; */);if(""==r[0])return n;for(var i=0;i<r.length;++i)n[Os((t=r[i].split("="))[0])]=Os(t[1]);return n}(e)}function ws(e){try{return encodeURIComponent(e)}catch(t){Es("error `encode(%o)` - %o",e,t)}}function Os(e){try{return decodeURIComponent(e)}catch(t){Es("error `decode(%o)` - %o",e,t)}}var Cs=p((function(e,t,n){switch(arguments.length){case 3:case 2:return function(e,t,n){n=n||{};var r=ws(e)+"="+ws(t);null==t&&(n.maxage=-1),n.maxage&&(n.expires=new Date(+new Date+n.maxage)),n.path&&(r+="; path="+n.path),n.domain&&(r+="; domain="+n.domain),n.expires&&(r+="; expires="+n.expires.toUTCString()),n.samesite&&(r+="; samesite="+n.samesite),n.secure&&(r+="; secure"),document.cookie=r}(e,t,n);case 1:return function(e){return Is()[e]}(e);default:return Is()}})),Ts={exports:{}},xs=Math.max,Rs=Math.max,Ps=function(e,t){var n=t?t.length:0;if(!n)return[];for(var r=xs(Number(e)||0,0),i=xs(n-r,0),s=new Array(i),o=0;o<i;o+=1)s[o]=t[o+r];return s},Bs=function(e){if(null==e||!e.length)return[];for(var t=new Array(Rs(e.length-2,0)),n=1;n<e.length;n+=1)t[n-1]=e[n];return t},Ls=Object.prototype.hasOwnProperty,Ds=Object.prototype.toString,Ms=function(e){return Boolean(e)&&"object"===i(e)},Fs=function(e){return Boolean(e)&&"[object Object]"===Ds.call(e)},Ns=function(e,t,n,r){return Ls.call(t,r)&&void 0===e[r]&&(e[r]=n),t},js=function(e,t,n,r){return Ls.call(t,r)&&(Fs(e[r])&&Fs(n)?e[r]=Gs(e[r],n):void 0===e[r]&&(e[r]=n)),t},Us=function(e,t){if(!Ms(t))return t;e=e||Ns;for(var n=Ps(2,arguments),r=0;r<n.length;r+=1)for(var i in n[r])e(t,n[r],n[r][i],i);return t},Gs=function(e){return Us.apply(null,[js,e].concat(Bs(arguments)))};Ts.exports=function(e){return Us.apply(null,[null,e].concat(Bs(arguments)))},Ts.exports.deep=Gs;var Vs=p(Ts.exports),Ks={exports:{}},Hs=Ss("cookie"),zs=function(e,t,n){switch(arguments.length){case 3:case 2:return function(e,t,n){n=n||{};var r=qs(e)+"="+qs(t);null==t&&(n.maxage=-1),n.maxage&&(n.expires=new Date(+new Date+n.maxage)),n.path&&(r+="; path="+n.path),n.domain&&(r+="; domain="+n.domain),n.expires&&(r+="; expires="+n.expires.toUTCString()),n.secure&&(r+="; secure"),document.cookie=r}(e,t,n);case 1:return function(e){return Qs()[e]}(e);default:return Qs()}};function Qs(){var e;try{e=document.cookie}catch(e){return"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e.stack||e),{}}return function(e){var t,n={},r=e.split(/ *; */);if(""==r[0])return n;for(var i=0;i<r.length;++i)n[$s((t=r[i].split("="))[0])]=$s(t[1]);return n}(e)}function qs(e){try{return encodeURIComponent(e)}catch(t){Hs("error `encode(%o)` - %o",e,t)}}function $s(e){try{return decodeURIComponent(e)}catch(t){Hs("error `decode(%o)` - %o",e,t)}}!function(e,t){var n=zs;function r(e){for(var n=t.cookie,r=t.levels(e),i=0;i<r.length;++i){var s="__tld__",o=r[i],a={domain:"."+o};if(n(s,1,a),n(s))return n(s,null,a),o}return""}r.levels=function(e){var t,n,r=("function"!=typeof window.URL?(t=e,(n=document.createElement("a")).href=t,n.hostname):new URL(e).hostname).split("."),i=r[r.length-1],s=[];if(4===r.length&&i===parseInt(i,10))return s;if(r.length<=1)return s;for(var o=r.length-2;o>=0;--o)s.push(r.slice(o).join("."));return s},r.cookie=n,t=e.exports=r}(Ks,Ks.exports);var Js=p(Ks.exports),Ws=function(){function e(t){s(this,e),this.cOpts={},this.options(t),this.isSupportAvailable=this.checkSupportAvailability()}return a(e,[{key:"options",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(0===arguments.length)return this.cOpts;var t=".".concat(Js(window.location.href));return"."===t&&(t=null),this.cOpts=Vs(e,{maxage:31536e6,path:"/",domain:t,samesite:"Lax"}),this.cOpts}},{key:"set",value:function(e,t){try{return Cs(e,t,O(this.cOpts)),!0}catch(e){return ut.error(e),!1}}},{key:"get",value:function(e){return Cs(e)}},{key:"remove",value:function(e){try{return Cs(e,null,O(this.cOpts)),!0}catch(e){return!1}}},{key:"checkSupportAvailability",value:function(){var e="test_rudder_cookie";return this.set(e,!0),!!this.get(e)&&(this.remove(e),!0)}}]),e}(),Ys=new Ws({}),Xs={exports:{}};!function(e,t){e.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 n(e){return"[object Function]"==={}.toString.call(e)}var r=function(e){var t="_Is_Incognit";try{e||(e=window.localStorage),e.setItem(t,"yes"),e.removeItem(t)}catch(t){var n={_data:{},setItem:function(e,t){return n._data[e]=String(t)},getItem:function(e){return n._data.hasOwnProperty(e)?n._data[e]:void 0},removeItem:function(e){return delete n._data[e]},clear:function(){return n._data={}}};e=n}finally{"yes"===e.getItem(t)&&e.removeItem(t)}return e}();function i(){if(!(this instanceof i))return new i}i.prototype={set:function(t,n){if(t&&!e(t))r.setItem(t,function(e){return void 0===e||"function"==typeof e?e+"":JSON.stringify(e)}(n));else if(e(t))for(var i in t)this.set(i,t[i]);return this},get:function(e){if(!e){var n={};return this.forEach((function(e,t){return n[e]=t})),n}if("?"===e.charAt(0))return this.has(e.substr(1));var i=arguments;if(i.length>1){for(var s={},o=0,a=i.length;o<a;o++){var u=t(r.getItem(i[o]));this.has(i[o])&&(s[i[o]]=u)}return s}return t(r.getItem(e))},clear:function(){return r.clear(),this},remove:function(e){var t=this.get(e);return r.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,n=r.length;t<n;t++){var i=r.key(t);e(i,this.get(i))}return this},search:function(e){for(var t=this.keys(),n={},r=0,i=t.length;r<i;r++)t[r].indexOf(e)>-1&&(n[t[r]]=this.get(t[r]));return n}};var s=null;function o(t,r){var a=arguments,u=null;if(s||(s=i()),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(!r)return s.remove(t);if(r&&"string"==typeof r)return s.set(t,r);r&&n(r)&&(u=null,u=r(t,s.get(t)),o.set(t,u))}if(2===a.length&&function(e){return"[object Array]"===Object.prototype.toString.call(e)}(t)&&n(r))for(var c=0,l=t.length;c<l;c++)u=r(t[c],s.get(t[c])),o.set(t[c],u);return o}for(var a in i.prototype)o[a]=i.prototype[a];return o}()}(Xs);var Zs=p(Xs.exports),eo=function(){function e(t){s(this,e),this.sOpts={},this.enabled=this.checkSupportAvailability(),this.options(t)}return a(e,[{key:"options",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return 0===arguments.length||(Vs(e,{enabled:!0}),this.enabled=e.enabled&&this.enabled,this.sOpts=e),this.sOpts}},{key:"set",value:function(e,t){return Zs.set(e,t)}},{key:"get",value:function(e){return Zs.get(e)}},{key:"remove",value:function(e){return Zs.remove(e)}},{key:"checkSupportAvailability",value:function(){var e="test_rudder_ls";return this.set(e,!0),!!this.get(e)&&(this.remove(e),!0)}}]),e}(),to=new eo({}),no="rl_user_id",ro="rl_trait",io="rl_anonymous_id",so="rl_group_id",oo="rl_group_trait",ao="rl_page_init_referrer",uo="rl_page_init_referring_domain",co="rl_session",lo="rl_auth_token",ho="RudderEncrypt:",fo="Rudder",po={segment:"ajs_anonymous_id"};function go(e){try{return e?JSON.parse(e):null}catch(t){return ut.error(t),e||null}}function yo(e){return e.replace(/^\s+|\s+$/gm,"")}function vo(e){return e&&"string"==typeof e&&""!==yo(e)&&e.substring(0,14)===ho?zi.decrypt(e.substring(14),fo).toString(qi):e}var mo=function(){function e(){s(this,e),Ys.isSupportAvailable?this.storage=Ys:(to.enabled&&(this.storage=to),this.storage||ut.error("No storage is available :: initializing the SDK without storage"))}return a(e,[{key:"options",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.storage.options(e)}},{key:"setItem",value:function(e,t){this.storage.set(e,function(e){return""===yo(e)?e:"".concat(ho).concat(zi.encrypt(e,fo).toString())}(function(e){return JSON.stringify(e)}(t)))}},{key:"setStringItem",value:function(e,t){"string"==typeof t?this.setItem(e,t):ut.error("[Storage] ".concat(e," should be string"))}},{key:"setUserId",value:function(e){this.setStringItem(no,e)}},{key:"setUserTraits",value:function(e){this.setItem(ro,e)}},{key:"setGroupId",value:function(e){this.setStringItem(so,e)}},{key:"setGroupTraits",value:function(e){this.setItem(oo,e)}},{key:"setAnonymousId",value:function(e){this.setStringItem(io,e)}},{key:"setInitialReferrer",value:function(e){this.setItem(ao,e)}},{key:"setInitialReferringDomain",value:function(e){this.setItem(uo,e)}},{key:"setSessionInfo",value:function(e){this.setItem(co,e)}},{key:"setAuthToken",value:function(e){this.setItem(lo,e)}},{key:"getItem",value:function(e){return go(vo(this.storage.get(e)))}},{key:"getUserId",value:function(){return this.getItem(no)}},{key:"getUserTraits",value:function(){return this.getItem(ro)}},{key:"getGroupId",value:function(){return this.getItem(so)}},{key:"getGroupTraits",value:function(){return this.getItem(oo)}},{key:"fetchExternalAnonymousId",value:function(e){var t,n=e.toLowerCase();return Object.keys(po).includes(n)&&"segment"===n?(to.enabled&&(t=to.get(po[n])),!t&&Ys.isSupportAvailable&&(t=Ys.get(po[n])),t):t}},{key:"getAnonymousId",value:function(e){var t=go(vo(this.storage.get(io)));if(t)return t;var n=M(e,"autoCapture.source");if(!0===M(e,"autoCapture.enabled")&&"string"==typeof n){var r=this.fetchExternalAnonymousId(n);if(r)return r}return t}},{key:"getInitialReferrer",value:function(){return this.getItem(ao)}},{key:"getInitialReferringDomain",value:function(){return this.getItem(uo)}},{key:"getSessionInfo",value:function(){return this.getItem(co)}},{key:"getAuthToken",value:function(){return this.getItem(lo)}},{key:"removeItem",value:function(e){return this.storage.remove(e)}},{key:"removeSessionInfo",value:function(){this.removeItem(co)}},{key:"clear",value:function(e){this.storage.remove(no),this.storage.remove(ro),this.storage.remove(so),this.storage.remove(oo),this.storage.remove(lo),e&&this.storage.remove(io)}}]),e}(),bo=new mo;function ko(){return document.referrer||"$direct"}function _o(e){var t=e.split("/");return t.length>=3?t[2]:""}function Ao(){for(var e=document.getElementsByTagName("link"),t=0;e[t];t+=1){var n=e[t];if("canonical"===n.getAttribute("rel"))return n.getAttribute("href")}}function So(){var e=Ao(),t=window.location.pathname;if(e)try{t=new URL(e).pathname}catch(e){}var n=window.location,r=n.search,i=n.href,s=document.title,o=function(e){var t,n=Ao(),r=(t=n?n.includes("?")?n:n+e:window.location.href).indexOf("#");return r>-1?t.slice(0,r):t}(r),a=i,u=ko();return{path:t,referrer:u,referring_domain:_o(u),search:r,title:s,url:o,tab_url:a,initial_referrer:bo.getInitialReferrer()||"",initial_referring_domain:bo.getInitialReferringDomain()||""}}for(var Eo,Io=a((function e(){s(this,e),this.name="RudderLabs JavaScript SDK",this.namespace="com.rudderlabs.javascript",this.version="2.37.0"})),wo=a((function e(){s(this,e),this.name="RudderLabs JavaScript SDK",this.version="2.37.0"})),Oo=a((function e(){s(this,e),this.name="",this.version=""})),Co=a((function e(){s(this,e),this.density=0,this.width=0,this.height=0,this.innerWidth=0,this.innerHeight=0})),To=a((function e(){var t;s(this,e),this.app=new Io,this.traits=null,this.library=new wo,this.userAgent=function(){if("undefined"==typeof navigator)return null;var e=navigator.userAgent,t=navigator.brave;if(t&&Object.getPrototypeOf(t).isBrave){var n=e.match(/(chrome)\/([\w.]+)/i);n&&(e="".concat(e," Brave/").concat(n[2]))}return e}(),this.device=null,this.network=null,this.os=new Oo,this.locale="undefined"==typeof navigator?null:navigator.language||navigator.browserLanguage,this.screen=(t=new Co,"undefined"==typeof window||(t.width=window.screen.width,t.height=window.screen.height,t.density=window.devicePixelRatio,t.innerWidth=window.innerWidth,t.innerHeight=window.innerHeight),t)})),xo=function(){function e(){s(this,e),this.channel="web",this.context=new To,this.type=null,this.messageId=mi(),this.originalTimestamp=(new Date).toISOString(),this.anonymousId=null,this.userId=null,this.event=null,this.properties={}}return a(e,[{key:"getProperty",value:function(e){return this.properties[e]}},{key:"addProperty",value:function(e,t){this.properties[e]=t}}]),e}(),Ro=function(){function e(){s(this,e),this.message=new xo}return a(e,[{key:"setType",value:function(e){this.message.type=e}},{key:"setProperty",value:function(e){this.message.properties=e}},{key:"setUserProperty",value:function(e){this.message.user_properties=e}},{key:"setUserId",value:function(e){this.message.userId=e}},{key:"setEventName",value:function(e){this.message.event=e}},{key:"getElementContent",value:function(){return this.message}}]),e}(),Po=function(){function e(){s(this,e),this.rudderProperty=null,this.rudderUserProperty=null,this.event=null,this.userId=null,this.type=null}return a(e,[{key:"setType",value:function(e){return this.type=e,this}},{key:"build",value:function(){var e=new Ro;return e.setUserId(this.userId),e.setType(this.type),e.setEventName(this.event),e.setProperty(this.rudderProperty),e.setUserProperty(this.rudderUserProperty),e}}]),e}(),Bo={},Lo=256,Do=[];Lo--;)Do[Lo]=(Lo+256).toString(16).substring(1);Bo.v4=function(){var e,t=0,n="";if(!Eo||Lo+16>256){for(Eo=Array(t=256);t--;)Eo[t]=256*Math.random()|0;t=Lo=0}for(;t<16;t++)e=Eo[Lo+t],n+=6==t?Do[15&e|64]:8==t?Do[63&e|128]:Do[e],1&t&&t>1&&t<11&&(n+="-");return Lo++,n};var Mo={},Fo=Object.prototype.hasOwnProperty,No=String.prototype.charAt,jo=Object.prototype.toString,Uo=function(e,t){return No.call(e,t)},Go=function(e,t){return Fo.call(e,t)},Vo=function(e,t){t=t||Go;for(var n=[],r=0,i=e.length;r<i;r+=1)t(e,r)&&n.push(String(r));return n},Ko=function(e){return null==e?[]:(t=e,"[object String]"===jo.call(t)?Vo(e,Uo):function(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length}(e)?Vo(e,Go):function(e,t){t=t||Go;var n=[];for(var r in e)t(e,r)&&n.push(String(r));return n}(e));var t},Ho=Ko,zo=Bo.v4,Qo={_data:{},length:0,setItem:function(e,t){return this._data[e]=t,this.length=Ho(this._data).length,t},getItem:function(e){return e in this._data?this._data[e]:null},removeItem:function(e){return e in this._data&&delete this._data[e],this.length=Ho(this._data).length,null},clear:function(){this._data={},this.length=0},key:function(e){return Ho(this._data)[e]}};Mo.defaultEngine=function(){try{if(!window.localStorage)return!1;var e=zo();window.localStorage.setItem(e,"test_value");var t=window.localStorage.getItem(e);return window.localStorage.removeItem(e),"test_value"===t}catch(e){return!1}}()?window.localStorage:Qo,Mo.inMemoryEngine=Qo;var qo=Ko,$o=Object.prototype.toString,Jo="function"==typeof Array.isArray?Array.isArray:function(e){return"[object Array]"===$o.call(e)},Wo=function(e,t){for(var n=0;n<t.length&&!1!==e(t[n],n,t);n+=1);},Yo=function(e,t){for(var n=qo(t),r=0;r<n.length&&!1!==e(t[n[r]],n[r],t);r+=1);},Xo=function(e,t){return(function(e){return null!=e&&(Jo(e)||"function"!==e&&function(e){var t=i(e);return"number"===t||"object"===t&&"[object Number]"===$o.call(e)}(e.length))}(t)?Wo:Yo).call(this,e,t)},Zo=Mo.defaultEngine,ea=Mo.inMemoryEngine,ta=Xo,na=Ko,ra=JSON;function ia(e,t,n,r){this.id=t,this.name=e,this.keys=n||{},this.engine=r||Zo,this.originalEngine=this.engine}ia.prototype.set=function(e,t){var n=this._createValidKey(e);if(n)try{this.engine.setItem(n,ra.stringify(t))}catch(n){(function(e){var t=!1;if(e.code)switch(e.code){case 22:t=!0;break;case 1014:"NS_ERROR_DOM_QUOTA_REACHED"===e.name&&(t=!0)}else-2147024882===e.number&&(t=!0);return t})(n)&&(this._swapEngine(),this.set(e,t))}},ia.prototype.get=function(e){try{var t=this.engine.getItem(this._createValidKey(e));return null===t?null:ra.parse(t)}catch(e){return null}},ia.prototype.getOriginalEngine=function(){return this.originalEngine},ia.prototype.remove=function(e){this.engine.removeItem(this._createValidKey(e))},ia.prototype._createValidKey=function(e){var t,n=this.name,r=this.id;return na(this.keys).length?(ta((function(i){i===e&&(t=[n,r,e].join("."))}),this.keys),t):[n,r,e].join(".")},ia.prototype._swapEngine=function(){var e=this;ta((function(t){var n=e.get(t);ea.setItem([e.name,e.id,t].join("."),n),e.remove(t)}),this.keys),this.engine=ea};var sa=ia,oa=Xo,aa={setTimeout:function(e,t){return window.setTimeout(e,t)},clearTimeout:function(e){return window.clearTimeout(e)},Date:window.Date},ua=aa,ca={ASAP:1,RESCHEDULE:2,ABANDON:3};function la(){this.tasks={},this.nextId=1}la.prototype.now=function(){return+new ua.Date},la.prototype.run=function(e,t,n){var r=this.nextId++;return this.tasks[r]=ua.setTimeout(this._handle(r,e,t,n||ca.ASAP),t),r},la.prototype.cancel=function(e){this.tasks[e]&&(ua.clearTimeout(this.tasks[e]),delete this.tasks[e])},la.prototype.cancelAll=function(){oa(ua.clearTimeout,this.tasks),this.tasks={}},la.prototype._handle=function(e,t,n,r){var i=this,s=i.now();return function(){if(delete i.tasks[e],!(r>=ca.RESCHEDULE&&s+2*n<i.now()))return t();r===ca.RESCHEDULE&&i.run(t,n,r)}},la.setClock=function(e){ua=e},la.resetClock=function(){ua=aa},la.Modes=ca;var ha=la,fa=Bo.v4,da=sa,pa=Xo,ga=ha,ya=Ss("localstorage-retry");function va(e,t){return function(){return e.apply(t,arguments)}}function ma(e,t,n){"function"==typeof t&&(n=t),this.name=e,this.id=fa(),this.fn=n,this.maxItems=t.maxItems||1/0,this.maxAttempts=t.maxAttempts||1/0,this.backoff={MIN_RETRY_DELAY:t.minRetryDelay||1e3,MAX_RETRY_DELAY:t.maxRetryDelay||3e4,FACTOR:t.backoffFactor||2,JITTER:t.backoffJitter||0},this.timeouts={ACK_TIMER:1e3,RECLAIM_TIMER:3e3,RECLAIM_TIMEOUT:1e4,RECLAIM_WAIT:500},this.keys={IN_PROGRESS:"inProgress",QUEUE:"queue",RECLAIM_START:"reclaimStart",RECLAIM_END:"reclaimEnd",ACK:"ack"},this._schedule=new ga,this._processId=0,this._store=new da(this.name,this.id,this.keys),this._store.set(this.keys.IN_PROGRESS,{}),this._store.set(this.keys.QUEUE,[]),this._ack=va(this._ack,this),this._checkReclaim=va(this._checkReclaim,this),this._processHead=va(this._processHead,this),this._running=!1}y(ma.prototype),ma.prototype.start=function(){this._running&&this.stop(),this._running=!0,this._ack(),this._checkReclaim(),this._processHead()},ma.prototype.stop=function(){this._schedule.cancelAll(),this._running=!1},ma.prototype.shouldRetry=function(e,t){return!(t>this.maxAttempts)},ma.prototype.getDelay=function(e){var t=this.backoff.MIN_RETRY_DELAY*Math.pow(this.backoff.FACTOR,e);if(this.backoff.JITTER){var n=Math.random(),r=Math.floor(n*this.backoff.JITTER*t);Math.floor(10*n)<5?t-=r:t+=r}return Number(Math.min(t,this.backoff.MAX_RETRY_DELAY).toPrecision(1))},ma.prototype.addItem=function(e){this._enqueue({item:e,attemptNumber:0,time:this._schedule.now(),id:fa()})},ma.prototype.requeue=function(e,t,n,r){this.shouldRetry(e,t,n)?this._enqueue({item:e,attemptNumber:t,time:this._schedule.now()+this.getDelay(t),id:r||fa()}):this.emit("discard",e,t)},ma.prototype._enqueue=function(e){var t=this._store.get(this.keys.QUEUE)||[];(t=t.slice(-(this.maxItems-1))).push(e),t=t.sort((function(e,t){return e.time-t.time})),this._store.set(this.keys.QUEUE,t),this._running&&this._processHead()},ma.prototype._processHead=function(){var e=this,t=this._store;this._schedule.cancel(this._processId);var n=t.get(this.keys.QUEUE)||[],r=t.get(this.keys.IN_PROGRESS)||{},i=this._schedule.now(),s=[];function o(n,r){s.push({item:n.item,done:function(i,s){var o=t.get(e.keys.IN_PROGRESS)||{};delete o[r],t.set(e.keys.IN_PROGRESS,o),e.emit("processed",i,s,n.item),i&&e.requeue(n.item,n.attemptNumber+1,i,n.id)}})}for(var a=Object.keys(r).length;n.length&&n[0].time<=i&&a++<e.maxItems;){var u=n.shift(),c=fa();r[c]={item:u.item,attemptNumber:u.attemptNumber,time:e._schedule.now()},o(u,c)}t.set(this.keys.QUEUE,n),t.set(this.keys.IN_PROGRESS,r),pa((function(t){try{e.fn(t.item,t.done)}catch(e){ya("Process function threw error: "+e)}}),s),n=t.get(this.keys.QUEUE)||[],this._schedule.cancel(this._processId),n.length>0&&(this._processId=this._schedule.run(this._processHead,n[0].time-i,ga.Modes.ASAP))},ma.prototype._ack=function(){this._store.set(this.keys.ACK,this._schedule.now()),this._store.set(this.keys.RECLAIM_START,null),this._store.set(this.keys.RECLAIM_END,null),this._schedule.run(this._ack,this.timeouts.ACK_TIMER,ga.Modes.ASAP)},ma.prototype._checkReclaim=function(){var e=this;pa((function(t){t.id!==e.id&&(e._schedule.now()-t.get(e.keys.ACK)<e.timeouts.RECLAIM_TIMEOUT||function(t){t.set(e.keys.RECLAIM_START,e.id),t.set(e.keys.ACK,e._schedule.now()),e._schedule.run((function(){t.get(e.keys.RECLAIM_START)===e.id&&(t.set(e.keys.RECLAIM_END,e.id),e._schedule.run((function(){t.get(e.keys.RECLAIM_END)===e.id&&t.get(e.keys.RECLAIM_START)===e.id&&e._reclaim(t.id)}),e.timeouts.RECLAIM_WAIT,ga.Modes.ABANDON))}),e.timeouts.RECLAIM_WAIT,ga.Modes.ABANDON)}(t))}),function(t){for(var n=[],r=e._store.getOriginalEngine(),i=0;i<r.length;i++){var s=r.key(i);if(null!==s){var o=s.split(".");3===o.length&&o[0]===t&&"ack"===o[2]&&n.push(new da(t,o[1],e.keys))}}return n}(this.name)),this._schedule.run(this._checkReclaim,this.timeouts.RECLAIM_TIMER,ga.Modes.RESCHEDULE)},ma.prototype._reclaim=function(e){var t=this,n=this,r=new da(this.name,e,this.keys),i={queue:this._store.get(this.keys.QUEUE)||[]},s={inProgress:r.get(this.keys.IN_PROGRESS)||{},queue:r.get(this.keys.QUEUE)||[]},o=[],a=function(e,t){pa((function(e){var r=e.id||fa();o.indexOf(r)>=0?n.emit("duplication",e.item,e.attemptNumber):(i.queue.push({item:e.item,attemptNumber:e.attemptNumber+t,time:n._schedule.now(),id:r}),o.push(r))}),e)};a(s.queue,0),a(s.inProgress,1),i.queue=i.queue.sort((function(e,t){return e.time-t.time})),this._store.set(this.keys.QUEUE,i.queue),setTimeout((function(){r.remove(t.keys.IN_PROGRESS),setTimeout((function(){r.remove(t.keys.QUEUE),setTimeout((function(){r.remove(t.keys.RECLAIM_START),setTimeout((function(){r.remove(t.keys.RECLAIM_END),setTimeout((function(){r.remove(t.keys.ACK)}),10)}),10)}),10)}),10)}),10),this._processHead()};var ba=p(ma),ka={maxRetryDelay:36e4,minRetryDelay:1e3,backoffFactor:2,maxAttempts:10,maxItems:100},_a=function(){function e(){s(this,e),this.url="",this.writeKey=""}return a(e,[{key:"init",value:function(e,t,n){var r=this;this.url=t,this.writeKey=e,n&&c(ka,n),this.payloadQueue=new ba("rudder",ka,(function(e,t){e.message.sentAt=bi(),r.processQueueElement(e.url,e.headers,e.message,1e4,(function(e,n){if(e)return t(e);t(null,n)}))})),this.payloadQueue.start()}},{key:"processQueueElement",value:function(e,t,n,r,i){try{var s=new XMLHttpRequest;for(var o in s.open("POST",e,!0),t)s.setRequestHeader(o,t[o]);s.timeout=r,s.ontimeout=i,s.onerror=i,s.onreadystatechange=function(){if(4===s.readyState)if(429===s.status||s.status>=500&&s.status<600){var t="".concat(ci,' "').concat(s.status,'" status text: "').concat(s.statusText,'" for URL: "').concat(e,'"'),n=new Error(t);yi(n),i(n)}else i(null,s.status)},s.send(pi(n,!0))}catch(e){i(e)}}},{key:"enqueue",value:function(e,t){var n={"Content-Type":"application/json",Authorization:"Basic ".concat(btoa("".concat(this.writeKey,":"))),AnonymousId:btoa(e.anonymousId)};this.payloadQueue.addItem({url:"".concat(this.url,"/v1/").concat(t),headers:n,message:e})}}]),e}(),Aa=function(){function e(){s(this,e),this.storage=to,this.maxItems=10,this.flushQueueTimeOut=void 0,this.timeOutActive=!1,this.flushQueueTimeOutInterval=6e5,this.url="",this.writekey="",this.queueName="".concat("queue",".").concat(Date.now())}return a(e,[{key:"sendQueueDataForBeacon",value:function(){this.sendDataFromQueueAndDestroyQueue()}},{key:"init",value:function(e,t,n){this.url=t,this.writekey=e,n.maxItems&&(this.maxItems=n.maxItems),n.flushQueueInterval&&(this.flushQueueTimeOutInterval=n.flushQueueInterval),this.sendQueueDataForBeacon=this.sendQueueDataForBeacon.bind(this),this.attachListeners()}},{key:"attachListeners",value:function(){var e=this;window.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e.sendQueueDataForBeacon()}))}},{key:"getQueue",value:function(){return this.storage.get(this.queueName)}},{key:"setQueue",value:function(e){this.storage.set(this.queueName,e)}},{key:"enqueue",value:function(e){var t=this.getQueue()||[];(t=t.slice(-(this.maxItems-1))).push(e);var n=t.slice(0);pi({batch:n},!0).length>64e3&&(n=t.slice(0,t.length-1),this.flushQueue(n),(t=this.getQueue()).push(e)),this.setQueue(t),this.setTimer(),t.length===this.maxItems&&this.flushQueue(n)}},{key:"sendDataFromQueueAndDestroyQueue",value:function(){this.sendDataFromQueue(),this.storage.remove(this.queueName)}},{key:"sendDataFromQueue",value:function(){var e=this.getQueue();if(e&&e.length>0){var t=e.slice(0,e.length);this.flushQueue(t)}}},{key:"flushQueue",value:function(e){e.forEach((function(e){e.sentAt=(new Date).toISOString()}));var t=pi({batch:e},!0),n=new Blob([t],{type:"text/plain"}),r="".concat(this.url,"?writeKey=").concat(this.writekey);try{"function"!=typeof navigator.sendBeacon&&yi(new Error("Beacon API is not supported by browser")),navigator.sendBeacon(r,n)||yi(new Error("Unable to queue data to browser's beacon queue"))}catch(e){e.message="".concat(e.message," - While sending Beacon data to: ").concat(r),yi(e)}this.setQueue([]),this.clearTimer()}},{key:"setTimer",value:function(){this.timeOutActive||(this.flushQueueTimeOut=setTimeout(this.sendDataFromQueue.bind(this),this.flushQueueTimeOutInterval),this.timeOutActive=!0)}},{key:"clearTimer",value:function(){this.timeOutActive&&(clearTimeout(this.flushQueueTimeOut),this.timeOutActive=!1)}}]),e}(),Sa=function(){function e(){s(this,e),this.queue=void 0}return a(e,[{key:"initialize",value:function(e,t,n){var r={},s=vi(t);n&&n.useBeacon&&navigator.sendBeacon?(n.beaconQueueOptions&&null!=n.beaconQueueOptions&&"object"===i(n.beaconQueueOptions)&&(r=n.beaconQueueOptions),s="".concat(s,"/beacon/v1/batch"),this.queue=new Aa):(n&&n.useBeacon&&ut.info("[EventRepository] sendBeacon feature not available in this browser :: fallback to XHR"),n&&n.queueOptions&&null!=n.queueOptions&&"object"===i(n.queueOptions)&&(r=n.queueOptions),this.queue=new _a),this.queue.init(e,s,r)}},{key:"enqueue",value:function(e,t){var n=e.getElementContent();n.originalTimestamp=n.originalTimestamp||bi(),n.sentAt=bi(),pi(n,!0).length>32e3&&ut.error("[EventRepository] enqueue:: message length greater 32 Kb ",n),this.queue.enqueue(n,t)}}]),e}(),Ea=new Sa,Ia={maxRetryDelay:36e4,minRetryDelay:1e3,backoffFactor:2,maxAttempts:1/0},wa=function(){function e(){s(this,e),this.callback=void 0,this.processQueueElements=!1}return a(e,[{key:"init",value:function(e,t){var n=this;e&&c(Ia,e),t&&(this.callback=t),this.payloadQueue=new ba("rs_events",Ia,(function(e,t){n.processQueueElement(e.type,e.rudderElement,(function(e,n){if(e)return t(e);t(null,n)}))})),this.payloadQueue.start()}},{key:"activateProcessor",value:function(){this.processQueueElements=!0}},{key:"processQueueElement",value:function(e,t,n){try{this.processQueueElements?(Object.setPrototypeOf(t,Ro.prototype),this.callback(e,t),n(null)):n(new Error("The queue elements are not ready to be processed yet"))}catch(e){n(e)}}},{key:"enqueue",value:function(e,t){this.payloadQueue.addItem({type:e,rudderElement:t})}}]),e}(),Oa=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{if(document.getElementById(e))return;var r=document.createElement("script");r.src=t,r.async=void 0===n.async||n.async,r.type="text/javascript",r.id=e,!0!==n.skipDatasetAttributes&&(r.setAttribute("data-loader","RS_JS_SDK"),void 0!==n.isNonNativeSDK&&r.setAttribute("data-isNonNativeSDK",n.isNonNativeSDK));var i=document.getElementsByTagName("head");if(i.length>0)i[0].insertBefore(r,i[0].firstChild);else{var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(r,s)}}catch(s){yi(s)}};function Ca(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return function(e){return decodeURIComponent(atob(e).split("").map((function(e){return"%".concat("00".concat(e.charCodeAt(0).toString(16)).slice(-2))})).join(""))}(e=e.endsWith("..")?e.substr(0,e.length-2):e)}var Ta=/^[a-zA-Z0-9\-_.]+$/,xa="*";function Ra(e,t,n,r){var i=function(e,t){return[e,(new Date).getTimezoneOffset(),t].join(xa)}(n,r),s=t||0,o=function(e){for(var t=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}(),n=-1,r=0;r<e.length;r++)n=n>>>8^t[255&(n^e.charCodeAt(r))];return~n>>>0}([i,Math.floor(Date.now()/6e4)-s,e].join(xa));return o.toString(36)}function Pa(e){var t=function(e){var t=e.split(xa),n=t.length%2==0;return t.length<4||!n||1!==Number(t.shift())?null:{checksum:t.shift(),serializedIds:t.join(xa)}}(e);if(!t)return null;var n=t.checksum,r=t.serializedIds;return function(e,t){for(var n=navigator&&navigator.userAgent,r=navigator&&navigator.language,i=0;i<=1;i+=1)if(Ra(e,i,n,r)===t)return!0;return!1}(r,n)?function(e){for(var t={},n=e.split(xa),r=0;r<n.length;r+=2){var i=n[r];if(Ta.test(i)){var s=Ca(n[r+1]);t[i]=s}}return t}(r):null}var Ba={HS:"HubSpot",GA:"GA",HOTJAR:"Hotjar",GOOGLEADS:"GoogleAds",VWO:"VWO",GTM:"GoogleTagManager",BRAZE:"Braze",INTERCOM:"INTERCOM",KEEN:"Keen",KISSMETRICS:"Kissmetrics",CUSTOMERIO:"CustomerIO",CHARTBEAT:"Chartbeat",COMSCORE:"Comscore",FACEBOOK_PIXEL:"FacebookPixel",LOTAME:"Lotame",OPTIMIZELY:"Optimizely",BUGSNAG:"Bugsnag",FULLSTORY:"Fullstory",TVSQUARED:"TVSquared",GA4:"GA4",MOENGAGE:"MoEngage",AM:"Amplitude",PENDO:"Pendo",LYTICS:"Lytics",APPCUES:"Appcues",POSTHOG:"Posthog",KLAVIYO:"Klaviyo",CLEVERTAP:"Clevertap",BINGADS:"BingAds",PINTEREST_TAG:"PinterestTag",ADOBE_ANALYTICS:"AdobeAnalytics",LINKEDIN_INSIGHT_TAG:"LinkedInInsightTag",REDDIT_PIXEL:"RedditPixel",DRIP:"Drip",HEAP:"Heap",CRITEO:"Criteo",MP:"Mixpanel",QUALTRICS:"Qualtrics",PROFITWELL:"ProfitWell",SENTRY:"Sentry",QUANTUMMETRIC:"QuantumMetric",SNAP_PIXEL:"SnapPixel",POST_AFFILIATE_PRO:"PostAffiliatePro",GOOGLE_OPTIMIZE:"GoogleOptimize",LAUNCHDARKLY:"LaunchDarkly",GA360:"GA360",ADROLL:"Adroll",DCM_FLOODLIGHT:"DCMFloodlight",MATOMO:"Matomo",VERO:"Vero",MOUSEFLOW:"Mouseflow",ROCKERBOX:"Rockerbox",CONVERTFLOW:"ConvertFlow",SNAPENGAGE:"SnapEngage",LIVECHAT:"LiveChat",SHYNET:"Shynet",WOOPRA:"Woopra",ROLLBAR:"RollBar",QUORA_PIXEL:"QuoraPixel",JUNE:"June",ENGAGE:"Engage",ITERABLE:"Iterable",YANDEX_METRICA:"YandexMetrica",REFINER:"Refiner",QUALAROO:"Qualaroo",PODSIGHTS:"Podsights",AXEPTIO:"Axeptio",SATISMETER:"Satismeter",MICROSOFT_CLARITY:"MicrosoftClarity",SENDINBLUE:"Sendinblue",OLARK:"Olark",LEMNISK:"Lemnisk",TIKTOK_ADS:"TiktokAds"},La=function(){function e(){var t=this;if(s(this,e),this.isInitialized=!1,window.OneTrust&&window.OnetrustActiveGroups){this.userSetConsentGroupIds=window.OnetrustActiveGroups.split(",").filter((function(e){return e}));var n=window.OneTrust.GetDomainData().Groups;this.userSetConsentGroupNames=[],this.userDeniedConsentGroupIds=[],n.forEach((function(e){var n=e.CustomGroupId,r=e.GroupName;t.userSetConsentGroupIds.includes(n)?t.userSetConsentGroupNames.push(r.toUpperCase().trim()):t.userDeniedConsentGroupIds.push(n)})),this.userSetConsentGroupIds=this.userSetConsentGroupIds.map((function(e){return e.toUpperCase()})),this.isInitialized=!0}else ut.error("OneTrust resources are not accessible.")}return a(e,[{key:"isEnabled",value:function(e){var t=this;try{if(!this.isInitialized)return!0;var n=e.oneTrustCookieCategories;if(!n)return!0;var r=n.map((function(e){return e.oneTrustCookieCategory})).filter((function(e){return e}));return r.every((function(e){return t.userSetConsentGroupIds.includes(e.toUpperCase().trim())||t.userSetConsentGroupNames.includes(e.toUpperCase().trim())}))}catch(e){return ut.error("Error during onetrust cookie consent management ".concat(e)),!0}}},{key:"getDeniedList",value:function(){return this.isInitialized?this.userDeniedConsentGroupIds:[]}}]),e}(),Da=function(){function e(){var t=this;if(s(this,e),this.updatePurposes=function(e){e&&Object.entries(e).forEach((function(e){var n=e[0];e[1]?t.userConsentedPurposes.push(n):t.userDeniedPurposes.push(n)}))},this.userConsentedPurposes=[],this.userDeniedPurposes=[],window.updateKetchConsent=function(e){e&&(t.userConsentedPurposes=[],t.userDeniedPurposes=[],t.updatePurposes(e))},window.getKetchUserConsentedPurposes=function(){return t.userConsentedPurposes.slice()},window.getKetchUserDeniedPurposes=function(){return t.userDeniedPurposes.slice()},window.ketchConsent)this.updatePurposes(window.ketchConsent);else{var n=this.getConsent();this.updatePurposes(n)}}return a(e,[{key:"isEnabled",value:function(e){var t=this;try{var n=e.ketchConsentPurposes;if(!n||0===n.length)return!0;var r=n.map((function(e){return e.purpose})).filter((function(e){return e}));return r.some((function(e){return t.userConsentedPurposes.includes(e.trim())}))}catch(e){return ut.error("Error occured checking ketch consent state ".concat(e)),!0}}},{key:"getDeniedList",value:function(){return this.userDeniedPurposes}},{key:"getConsent",value:function(){var e=Ys.get("_ketch_consent_v1_");if(e){var t;try{t=JSON.parse(atob(e))}catch(e){return void ut.error("Error occured while parsing consent cookie ".concat(e))}if(t){var n={};return Object.entries(t).forEach((function(e){var t=e[0],r=e[1];r&&r.status&&(n[t]="granted"===r.status)})),n}}}}]),e}(),Ma=function(){function e(){s(this,e),this.storage=bo,this.timeout=18e5,this.sessionInfo=this.storage.getSessionInfo()||{autoTrack:!0}}return a(e,[{key:"initialize",value:function(e){try{var t;if(this.sessionInfo.autoTrack=!(!1===(null==e||null===(t=e.sessions)||void 0===t?void 0:t.autoTrack)||this.sessionInfo.manualTrack),null!=e&&e.sessions&&!isNaN(e.sessions.timeout)){var n=e.sessions.timeout;0===n&&(ut.warn("[Session]:: Provided timeout value 0 will disable the auto session tracking feature."),this.sessionInfo.autoTrack=!1),n>0&&n<1e4&&ut.warn('[Session]:: It is not advised to set "timeout" less than 10 seconds'),this.timeout=n}this.sessionInfo.autoTrack?this.startAutoTracking():!1!==this.sessionInfo.autoTrack||this.sessionInfo.manualTrack||this.end()}catch(e){yi(e)}}},{key:"isValidSession",value:function(e){return e<=this.sessionInfo.expiresAt}},{key:"generateSessionId",value:function(){return Date.now()}},{key:"startAutoTracking",value:function(){var e=Date.now();this.isValidSession(e)||(this.sessionInfo={},this.sessionInfo.id=e,this.sessionInfo.expiresAt=e+this.timeout,this.sessionInfo.sessionStart=!0,this.sessionInfo.autoTrack=!0),this.storage.setSessionInfo(this.sessionInfo)}},{key:"validateSessionId",value:function(e){if("number"==typeof e&&e%1==0){var t;if(!(((t=e)?t.toString().length:0)<10))return e;ut.error('[Session]:: "sessionId" should at least be "'.concat(10,'" digits long'))}else ut.error('[Session]:: "sessionId" should only be a positive integer')}},{key:"start",value:function(e){var t=e?this.validateSessionId(e):this.generateSessionId();this.sessionInfo={id:t||this.generateSessionId(),sessionStart:!0,manualTrack:!0},this.storage.setSessionInfo(this.sessionInfo)}},{key:"getSessionId",value:function(){return this.sessionInfo.autoTrack&&this.isValidSession(Date.now())||this.sessionInfo.manualTrack?this.sessionInfo.id:null}},{key:"end",value:function(){this.sessionInfo={},this.storage.removeSessionInfo()}},{key:"getSessionInfo",value:function(){var e={};if(this.sessionInfo.autoTrack||this.sessionInfo.manualTrack){if(this.sessionInfo.autoTrack){var t=Date.now();this.isValidSession(t)?this.sessionInfo.expiresAt=t+this.timeout:this.startAutoTracking()}this.sessionInfo.sessionStart&&(e.sessionStart=!0,this.sessionInfo.sessionStart=!1),e.sessionId=this.sessionInfo.id,this.storage.setSessionInfo(this.sessionInfo)}return e}},{key:"reset",value:function(){var e=this.sessionInfo,t=e.manualTrack;e.autoTrack?(this.sessionInfo={},this.startAutoTracking()):t&&this.start()}}]),e}(),Fa=new Ma,Na=["integrations","anonymousId","originalTimestamp"],ja="rs-bugsnag",Ua=["Bugsnag","bugsnag"],Ga="0d96a60df267f4a13f808bbaa54e535c",Va=["rudder-analytics.min.js","rudder-analytics-staging.min.js","rudder-analytics.js"].concat(l(Object.keys(Ba).map((function(e){return"".concat(Ba[e],".min.js")}))),l(Object.keys(Ba).map((function(e){return"".concat(Ba[e],"-staging.min.js")}))),l(Object.keys(Ba).map((function(e){return"".concat(Ba[e],".js")})))),Ka=function(e){var t=e&&e._client&&e._client._notifier&&e._client._notifier.version;if(!t){var n=e({apiKey:Ga,releaseStage:"version-test",beforeSend:function(){return!1}});t=n.notifier&&n.notifier.version,n=void 0}return t&&"6"===t.charAt(0)},Ha=function(){function e(t,n){s(this,e),this.pluginName=ja,this.sourceId=t,this.onClientReady=n,this.initClientOnLibReadyInterval=void 0,this.init()}return a(e,[{key:"init",value:function(){var e=this;if(!(window.rudderanalytics&&window.rudderanalytics.errorReporting||Ga.match(/{{.+}}/))){!function(e){Ua.every((function(e){return!function(e,t){if(null==e)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(e),t)}(window,e)}))&&Oa(e,"https://d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js",{isNonNativeSDK:"true",skipDatasetAttributes:!0})}(this.pluginName);var t=window.bugsnag;"function"!=typeof t?(this.initClientOnLibReadyInterval=setInterval((function(){var t=window.bugsnag;"function"==typeof t&&(Ka(t)&&e.initClient(),clearInterval(e.initClientOnLibReadyInterval))}),100),setTimeout((function(){clearInterval(e.initClientOnLibReadyInterval)}),ti)):Ka(t)&&this.initClient()}}},{key:"initClient",value:function(){var e,t=window.bugsnag;this.client=t({apiKey:Ga,appVersion:"2.37.0",metaData:{SDK:{name:"JS",installType:"npm"}},beforeSend:this.onError(),autoTrackSessions:!1,collectUserIp:!1,enabledBreadcrumbTypes:["error","log","user"],maxEvents:100,releaseStage:(e=window.location.hostname,e&&["www.rs-unit-test-host.com","localhost","127.0.0.1","[::1]"].includes(e)?"development":"production")}),this.onClientReady()}},{key:"onError",value:function(){var e=this.sourceId;return function(t){try{return!!function(e){var t=M(e,"stacktrace.0.file");if(!t||"string"!=typeof t)return!1;var n=t.substring(t.lastIndexOf("/")+1);return Va.includes(n)}(t)&&(function(e,t){e.updateMetaData("source",{metadataSource:t});var n=e.errorMessage;e.context=n,n.includes("error in script loading")&&(e.context="Script load failures"),e.severity="error"}(t,e),!0)}catch(e){return!1}}}},{key:"notify",value:function(e){this.client&&this.client.notify(e)}},{key:"leaveBreadcrumb",value:function(e){this.client&&this.client.leaveBreadcrumb(e)}}]),e}(),za=ja,Qa=[ja],qa=function(){function e(t){s(this,e),this.isEnabled=!1,this.providerName=za,this.provider=void 0,this.logger=t,this.onClientReady=this.onClientReady.bind(this),this.exposeToGlobal=this.exposeToGlobal.bind(this)}return a(e,[{key:"init",value:function(e,t){e&&t?!0===function(e){return M(e,"statsCollection.errors.enabled")||!1}(e)?(this.enable(),this.setProviderName(function(e){return M(e,"statsCollection.errors.provider")}(e)),this.initProvider(e,t)):this.disable():this.logger.error("[Analytics] ErrorReporting :: Invalid configuration or missing source id provided.")}},{key:"enable",value:function(){this.isEnabled=!0}},{key:"disable",value:function(){this.isEnabled=!1}},{key:"setProviderName",value:function(e){e?!e||Qa.includes(e)?this.providerName=e:this.logger.error("[Analytics] ErrorReporting :: Invalid error reporting provider value. Value should be one of: ".concat(Qa.join(","))):this.providerName=za}},{key:"initProvider",value:function(e,t){this.providerName===ja&&(this.provider=new Ha(t,this.onClientReady))}},{key:"onClientReady",value:function(){this.exposeToGlobal()}},{key:"exposeToGlobal",value:function(){window.rudderanalytics.errorReporting=this}},{key:"leaveBreadcrumb",value:function(e){if(this.provider)try{this.provider.leaveBreadcrumb(e)}catch(e){this.logger.error("[Analytics] ErrorReporting :: leaveBreadcrumb method ".concat(e.toString()))}}},{key:"notify",value:function(e){if(this.provider)try{this.provider.notify(e)}catch(e){this.logger.error("[Analytics] ErrorReporting :: notify method ".concat(e.toString()))}}}]),e}(),$a=new(function(){function e(){s(this,e),this.retryAttempt=3,this.queue=[],this.isTransformationProcessing=!1,this.authToken=null}return a(e,[{key:"init",value:function(e,t,n){this.dataPlaneUrl=vi(t),this.writeKey=e,this.authToken=n||this.authToken,this.start()}},{key:"enqueue",value:function(e,t){this.queue.push({event:e,cb:t})}},{key:"sendEventForTransformation",value:function(e,t){var n=this;return new Promise((function(r,i){var s="".concat(n.dataPlaneUrl,"/transform"),o={"Content-Type":"application/json",Authorization:"Basic ".concat(btoa("".concat(n.writeKey,":")))};try{var a=new XMLHttpRequest;a.open("POST",s,!0),Object.keys(o).forEach((function(e){return a.setRequestHeader(e,o[e])})),a.timeout=1e4,a.onreadystatechange=function(){if(4===a.readyState)try{var s=a.status,o=a.response;if(200===s)return o&&"string"==typeof o?(o=JSON.parse(o),void r({transformedPayload:o.transformedBatch,transformationServerAccess:!0})):void i("[Transformation]:: Transformation failed. Invalid response from server.");if(400===s){var u=o?"[Transformation]:: ".concat(o):"[Transformation]:: Invalid request payload";return void i(u)}if(404===s)return void r({transformedPayload:e.batch,transformationServerAccess:!1});if(!(t>0))return void i("[Transformation]:: Transformation failed with status ".concat(s));var c=t-1;setTimeout((function(){return n.sendEventForTransformation(e,c).then(r).catch(i)}),500*Math.pow(2,n.retryAttempt-c))}catch(e){i(e)}},a.send(pi(e,!0))}catch(e){i(e)}}))}},{key:"checkQueueLengthAndProcess",value:function(){this.queue.length>0&&this.process()}},{key:"process",value:function(){var e=this;this.isTransformationProcessing=!0;var t,n=this.queue.shift(),r=(t=n.event,{metadata:{"Custom-Authorization":this.authToken},batch:[{orderNo:Date.now(),event:t.message}]});this.sendEventForTransformation(r,this.retryAttempt).then((function(t){e.isTransformationProcessing=!1,n.cb(t),e.checkQueueLengthAndProcess()})).catch((function(t){yi("string"==typeof t?t:t.message),e.isTransformationProcessing=!1,n.cb({transformedPayload:null}),e.checkQueueLengthAndProcess()}))}},{key:"start",value:function(){var e=this;setInterval((function(){e.isTransformationProcessing||e.checkQueueLengthAndProcess()}),100)}},{key:"setAuthToken",value:function(e){this.authToken=e}}]),e}()),Ja=function(){function e(){s(this,e),this.initialized=!1,this.clientIntegrations=[],this.loadOnlyIntegrations={},this.clientIntegrationObjects=void 0,this.successfullyLoadedIntegration=[],this.failedToBeLoadedIntegration=[],this.toBeProcessedArray=[],this.toBeProcessedByIntegrationArray=[],this.storage=bo,this.eventRepository=Ea,this.preProcessQueue=new wa,this.sendAdblockPage=!1,this.sendAdblockPageOptions={},this.clientSuppliedCallbacks={},this.readyCallbacks=[],this.methodToCallbackMapping={syncPixel:"syncPixelCallback"},this.loaded=!1,this.loadIntegration=!0,this.bufferDataPlaneEventsUntilReady=!1,this.dataPlaneEventsBufferTimeout=1e4,this.integrationsData={},this.dynamicallyLoadedIntegrations={},this.destSDKBaseURL=ei,this.cookieConsentOptions={},this.logLevel=void 0,this.clientIntegrationsReady=!1,this.uSession=Fa,this.version="2.37.0",this.lockIntegrationsVersion=!1,this.errorReporting=new qa(ut),this.deniedConsentIds=[],this.transformationHandler=$a}return a(e,[{key:"initializeUser",value:function(e){this.userId=this.storage.getUserId()||"",this.storage.setUserId(this.userId),this.userTraits=this.storage.getUserTraits()||{},this.storage.setUserTraits(this.userTraits),this.groupId=this.storage.getGroupId()||"",this.storage.setGroupId(this.groupId),this.groupTraits=this.storage.getGroupTraits()||{},this.storage.setGroupTraits(this.groupTraits),this.anonymousId=this.getAnonymousId(e),this.storage.setAnonymousId(this.anonymousId)}},{key:"setInitialPageProperties",value:function(){if(null==this.storage.getInitialReferrer()&&null==this.storage.getInitialReferringDomain()){var e=ko();this.storage.setInitialReferrer(e),this.storage.setInitialReferringDomain(_o(e))}}},{key:"allModulesInitialized",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Promise((function(n){e.clientIntegrations.every((function(t){return null!=e.dynamicallyLoadedIntegrations["".concat(Ba[t.name]).concat("_RS")]}))||t>=2e4?n(e):e.pause(ni).then((function(){return e.allModulesInitialized(t+ni).then(n)}))}))}},{key:"executeReadyCallback",value:function(){this.readyCallbacks.forEach((function(e){return e()}))}},{key:"integrationSDKLoaded",value:function(e,t){try{return e&&t&&window[e]&&window.hasOwnProperty(e)&&window[e][t]&&i(window[e][t].prototype)&&void 0!==window[e][t].prototype.constructor}catch(n){return yi(n,"While attempting to load ".concat(e," ").concat(t)),!1}}},{key:"processResponse",value:function(e,t){var n=this;try{var r=t;try{if("string"==typeof t&&(r=JSON.parse(t)),!r||"object"!==i(r)||Array.isArray(r))return void ut.error("Invalid source configuration")}catch(e){return void yi(e)}try{this.errorReporting.init(r.source.config,r.source.id)}catch(e){yi(e)}if(this.serverUrl=function(e,t,n){try{var r=e.source.dataplanes||{};if(Object.keys(r).length){var i=function(e){var t=e?e.residencyServer:void 0;if(t)return"string"==typeof t&&ii.includes(t.toUpperCase())?t.toUpperCase():void ut.error("Invalid residencyServer input")}(n),s=r[i]||r.US;if(s){var o=function(e){if(Array.isArray(e)&&e.length){var t=e.find((function(e){return!0===e.default}));if(t&&Oi(t.url))return t.url}}(s);if(o)return o}}if(Oi(t))return t;throw Error("Unable to load the SDK due to invalid data plane url")}catch(e){throw Error(e)}}(r,this.serverUrl,this.options),this.eventRepository.initialize(this.writeKey,this.serverUrl,this.options),this.loaded=!0,this.transformationHandler.init(this.writeKey,this.serverUrl,this.storage.getAuthToken()),this.options&&"function"==typeof this.options.onLoaded&&this.options.onLoaded(this),function(e){if(e.toBeProcessedArray.length>0)for(;e.toBeProcessedArray.length>0;){var t=l(e.toBeProcessedArray[0]);e.toBeProcessedArray.shift();var n=t[0];t.shift(),e[n].apply(e,l(t))}}(this),r.source.destinations.forEach((function(e){e.enabled&&this.clientIntegrations.push({name:e.destinationDefinition.name,config:e.config,destinationInfo:{areTransformationsConnected:e.areTransformationsConnected||!1,destinationId:e.id}})}),this),this.clientIntegrations=Si(this.loadOnlyIntegrations,this.clientIntegrations),Object.keys(this.cookieConsentOptions).length>0)try{var s=function(e){var t,n;return null!=e&&null!==(t=e.oneTrust)&&void 0!==t&&t.enabled?new La:null!=e&&null!==(n=e.ketch)&&void 0!==n&&n.enabled?new Da:null}(this.cookieConsentOptions);this.deniedConsentIds=s&&s.getDeniedList(),this.clientIntegrations=this.clientIntegrations.filter((function(e){return!s||s&&s.isEnabled(e.config)}))}catch(e){yi(e)}this.clientIntegrations=this.clientIntegrations.filter((function(e){return!!Ba[e.name]||(ut.error("[Analytics] Integration:: ".concat(e.name," not available for initialization")),!1)}));var o="";Ii().isStaging&&(o="-staging"),this.bufferDataPlaneEventsUntilReady&&setTimeout((function(){n.processBufferedCloudModeEvents()}),this.dataPlaneEventsBufferTimeout),this.errorReporting.leaveBreadcrumb("Starting device-mode initialization"),this.clientIntegrations.forEach((function(e){var t=Ba[e.name],r="".concat(t).concat("_RS"),i="".concat(n.destSDKBaseURL,"/").concat(t).concat(o,".min.js");window.hasOwnProperty(r)||Oa(r,i,{isNonNativeSDK:!0});var s=n,a=setInterval((function(){if(s.integrationSDKLoaded(r,t)){var i,o=window[r];clearInterval(a);try{var u="[Analytics] processResponse :: trying to initialize integration name:: ".concat(r);n.errorReporting.leaveBreadcrumb(u),(i=new o[t](e.config,s,e.destinationInfo)).init(),s.isInitialized(i).then((function(){s.dynamicallyLoadedIntegrations[r]=o[t]}))}catch(e){var c="[Analytics] 'integration.init()' failed :: ".concat(r," :: ").concat(e.message);yi(e,c),s.failedToBeLoadedIntegration.push(i)}}}),100);setTimeout((function(){clearInterval(a)}),ti)}));var a=this;this.allModulesInitialized().then((function(){if(!a.clientIntegrations||0===a.clientIntegrations.length)return n.clientIntegrationsReady=!0,n.executeReadyCallback(),void(n.toBeProcessedByIntegrationArray=[]);a.replayEvents(a)}))}catch(e){yi(e)}}},{key:"sendDataToDestination",value:function(e,t,n){try{if(e[n]){var r=O(t);e[n](r)}}catch(t){var i="[sendToNative]:: [Destination: ".concat(e.name,"]:: ");yi(t,i)}}},{key:"sendTransformedDataToDestination",value:function(e,t,n){var r=this;try{Ai(t.message.integrations),this.transformationHandler.enqueue(t,(function(t){var i=t.transformedPayload,s=t.transformationServerAccess;i&&e.forEach((function(e){try{var t,o=[];if(s){var a=i.find((function(t){return t.id===e.destinationId}));if(!a)return void ut.error('[DMT]::Transformed data for destination "'.concat(e.name,'" was not sent from the server'));null==a||a.payload.forEach((function(t){"200"===t.status?o.push(t):ut.error('[DMT]::Event transformation unsuccessful for destination "'.concat(e.name,'". Dropping the event. Status: "').concat(t.status,'". Error Message: "').concat(t.error,'"'))}))}else o=i;null===(t=o)||void 0===t||t.forEach((function(t){t.event&&r.sendDataToDestination(e,{message:t.event},n)}))}catch(t){t instanceof Error&&(t.message="[DMT]::[Destination:".concat(e.name,"]:: ").concat(t.message)),yi(t)}}))}))}catch(e){e instanceof Error&&(e.message="[DMT]:: ".concat(e.message)),yi(e)}}},{key:"processAndSendEventsToDeviceMode",value:function(e,t,n){var r=this,i=[],s=[];e.forEach((function(e){!r.IsEventBlackListed(t.message.event,e.name)&&(e.areTransformationsConnected?s.push(e):i.push(e))})),i.forEach((function(e){r.sendDataToDestination(e,t,n)})),s.length>0&&this.sendTransformedDataToDestination(s,t,n)}},{key:"queueEventForDataPlane",value:function(e,t){var n=t.message.integrations||{All:!0};t.message.integrations=function(e,t){var n=O(e),r=Object.keys(t).filter((function(e){return!(!0===t[e]&&n[e])})).reduce((function(e,n){return e[n]=t[n],e}),{});return di(n,r)}(this.integrationsData,n),this.eventRepository.enqueue(t,e)}},{key:"processBufferedCloudModeEvents",value:function(){this.bufferDataPlaneEventsUntilReady&&this.preProcessQueue.activateProcessor()}},{key:"replayEvents",value:function(e){var t,n,r,i=this;this.errorReporting.leaveBreadcrumb("Started replaying buffered events"),e.clientIntegrationObjects=[],e.clientIntegrationObjects=e.successfullyLoadedIntegration,e.clientIntegrationObjects.every((function(e){return!e.isReady||e.isReady()}))&&(this.integrationsData=(t=this.integrationsData,n=e.clientIntegrationObjects,r=O(t),n.forEach((function(e){if(e.getDataForIntegrationsObject)try{r=di(r,e.getDataForIntegrationsObject())}catch(e){ut.debug("[Analytics: prepareDataForIntegrationsObj]",e)}})),r),e.clientIntegrationsReady=!0,e.executeReadyCallback()),this.processBufferedCloudModeEvents(),e.toBeProcessedByIntegrationArray.forEach((function(t){var n=t[0];t.shift(),Object.keys(t[0].message.integrations).length>0&&_i(t[0].message.integrations);var r=Si(t[0].message.integrations,e.clientIntegrationObjects);i.processAndSendEventsToDeviceMode(r,t[0],n)})),e.toBeProcessedByIntegrationArray=[]}},{key:"pause",value:function(e){return new Promise((function(t){setTimeout(t,e)}))}},{key:"isInitialized",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(r){e.isLoaded()?(t.successfullyLoadedIntegration.push(e),r(t)):n>=ti?(t.failedToBeLoadedIntegration.push(e),r(t)):t.pause(ni).then((function(){return t.isInitialized(e,n+ni).then(r)}))}))}},{key:"page",value:function(e,t,n,r,s){if(this.errorReporting.leaveBreadcrumb("Page event"),this.loaded){"function"==typeof r&&(s=r,r=null),"function"==typeof n&&(s=n,r=n=null),"function"==typeof t&&(s=t,r=n=t=null),"function"==typeof e&&(s=e,r=n=t=e=null),"object"===i(e)&&null!=e&&null!=e&&(r=t,n=e,t=e=null),"object"===i(t)&&null!=t&&null!=t&&(r=n,n=t,t=null),"string"==typeof e&&"string"!=typeof t&&(t=e,e=null),this.sendAdblockPage&&"RudderJS-Initiated"!=e&&this.sendSampleRequest();var o=O(n),a=O(r),u=(new Po).setType("page").build();o||(o={}),t&&(u.message.name=o.name=t),e&&(u.message.category=o.category=e),u.message.properties=this.getPageProperties(o),this.processAndSendDataToDestinations("page",u,a,s)}else this.toBeProcessedArray.push(["page"].concat(Array.prototype.slice.call(arguments)))}},{key:"track",value:function(e,t,n,r){if(this.errorReporting.leaveBreadcrumb("Track event"),this.loaded){"function"==typeof n&&(r=n,n=null),"function"==typeof t&&(r=t,n=null,t=null);var i=O(t),s=O(n),o=(new Po).setType("track").build();e&&o.setEventName(e),o.setProperty(i||{}),this.processAndSendDataToDestinations("track",o,s,r)}else this.toBeProcessedArray.push(["track"].concat(Array.prototype.slice.call(arguments)))}},{key:"identify",value:function(e,t,n,r){if(this.errorReporting.leaveBreadcrumb("Identify event"),this.loaded){"function"==typeof n&&(r=n,n=null),"function"==typeof t&&(r=t,n=null,t=null),"object"===i(e)&&(n=t,t=e,e=this.userId);var s=wi(e);s&&this.userId&&s!==this.userId&&this.reset(),this.userId=s,this.storage.setUserId(this.userId);var o=O(t),a=O(n);if(o){for(var u in o)this.userTraits[u]=o[u];this.storage.setUserTraits(this.userTraits)}var c=(new Po).setType("identify").build();this.processAndSendDataToDestinations("identify",c,a,r)}else this.toBeProcessedArray.push(["identify"].concat(Array.prototype.slice.call(arguments)))}},{key:"alias",value:function(e,t,n,r){if(this.errorReporting.leaveBreadcrumb("Alias event"),this.loaded){"function"==typeof n&&(r=n,n=null),"function"==typeof t&&(r=t,n=null,t=null),"function"==typeof e&&(r=e,n=null,t=null,e=null),"object"===i(t)&&(n=t,t=null),"object"===i(e)&&(n=e,t=null,e=null);var s=(new Po).setType("alias").build();s.message.previousId=wi(t)||(this.userId?this.userId:this.getAnonymousId()),s.message.userId=wi(e);var o=O(n);this.processAndSendDataToDestinations("alias",s,o,r)}else this.toBeProcessedArray.push(["alias"].concat(Array.prototype.slice.call(arguments)))}},{key:"group",value:function(e,t,n,r){if(this.errorReporting.leaveBreadcrumb("Group event"),this.loaded){if(0!==arguments.length){"function"==typeof n&&(r=n,n=null),"function"==typeof t&&(r=t,n=null,t=null),"object"===i(e)&&(n=t,t=e,e=this.groupId),"function"==typeof e&&(r=e,n=null,t=null,e=this.groupId),this.groupId=wi(e),this.storage.setGroupId(this.groupId);var s=O(t),o=O(n),a=(new Po).setType("group").build();if(s)for(var u in s)this.groupTraits[u]=s[u];else this.groupTraits={};this.storage.setGroupTraits(this.groupTraits),this.processAndSendDataToDestinations("group",a,o,r)}}else this.toBeProcessedArray.push(["group"].concat(Array.prototype.slice.call(arguments)))}},{key:"IsEventBlackListed",value:function(e,t){if(!e||"string"!=typeof e)return!1;var n=$r[t],r=this.clientIntegrations.find((function(e){return e.name===n})).config,i=r.blacklistedEvents,s=r.whitelistedEvents,o=r.eventFilteringOption;if(!o)return!1;var a=e.trim().toUpperCase();switch(o){case"disable":default:return!1;case"blacklistedEvents":return!!Array.isArray(i)&&i.some((function(e){return e.eventName.trim().toUpperCase()===a}));case"whitelistedEvents":return!Array.isArray(s)||!s.some((function(e){return e.eventName.trim().toUpperCase()===a}))}}},{key:"shouldUseGlobalIntegrationsConfigInEvents",value:function(){return this.useGlobalIntegrationsConfigInEvents&&this.loadOnlyIntegrations&&Object.keys(this.loadOnlyIntegrations).length>0}},{key:"processAndSendDataToDestinations",value:function(e,t,n,i){try{this.anonymousId||this.setAnonymousId(),this.errorReporting.leaveBreadcrumb("Started sending data to destinations"),t.message.context.traits=r({},this.userTraits),t.message.anonymousId=this.anonymousId,t.message.userId=t.message.userId?t.message.userId:this.userId,"group"==e&&(this.groupId&&(t.message.groupId=this.groupId),this.groupTraits&&(t.message.traits=r({},this.groupTraits)));try{var s=this.uSession.getSessionInfo(),o=s.sessionId,a=s.sessionStart;t.message.context.sessionId=o,a&&(t.message.context.sessionStart=!0)}catch(e){yi(e)}h=this.cookieConsentOptions,f=!1,Object.keys(h).forEach((function(e){si.includes(e)&&"boolean"==typeof h[e].enabled&&!0===h[e].enabled&&(f=!0)})),f&&(t.message.context.consentManagement={deniedConsentIds:this.deniedConsentIds||[]}),this.processOptionsParam(t,n),function(e,t){var n=e.properties,r=e.traits;n&&Object.keys(n).forEach((function(e){Wr.indexOf(e.toLowerCase())>=0&&ut.error("Warning! : Reserved keyword used in properties--\x3e ".concat(e," with ").concat(t," call"))})),r&&Object.keys(r).forEach((function(e){Wr.indexOf(e.toLowerCase())>=0&&ut.error("Warning! : Reserved keyword used in traits--\x3e ".concat(e," with ").concat(t," call"))}));var i=e.context.traits;i&&Object.keys(i).forEach((function(e){Wr.indexOf(e.toLowerCase())>=0&&ut.error("Warning! : Reserved keyword used in traits --\x3e ".concat(e," with ").concat(t," call"))}))}(t.message,e);var u=t.message.integrations;u?_i(u):u=this.shouldUseGlobalIntegrationsConfigInEvents()?this.loadOnlyIntegrations:ui,t.message.integrations=u;try{t.message.context["ua-ch"]=this.uach}catch(e){yi(e)}if(this.clientIntegrationObjects){var c=Si(u,this.clientIntegrationObjects);this.processAndSendEventsToDeviceMode(c,t,e)}else this.toBeProcessedByIntegrationArray.push([e,t]);var l=O(t);Ai(l.message.integrations),!this.bufferDataPlaneEventsUntilReady||this.clientIntegrationObjects?this.queueEventForDataPlane(e,l):this.preProcessQueue.enqueue(e,l),i&&"function"==typeof i&&i(l)}catch(e){yi(e)}var h,f}},{key:"utm",value:function(e){var t={};try{var n=new URL(e),r="utm_";n.searchParams.forEach((function(e,n){if(n.startsWith(r)){var i=n.substring(4);"campaign"===i&&(i="name"),t[i]=e}}))}catch(e){}return t}},{key:"addCampaignInfo",value:function(e){var t=e.message.context;t&&"object"===i(t)&&(e.message.context.campaign=this.utm(window.location.href))}},{key:"processOptionsParam",value:function(e,t){var n=e.message,s=n.type,o=n.properties;this.addCampaignInfo(e),e.message.context.page=this.getContextPageProperties("page"===s?o:void 0),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"===i(t)&&null!==t&&Object.keys(t).forEach((function(n){Na.includes(n)&&(e[n]=t[n])}))}(e.message,t),e.message.context=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.context;return"object"!==i(t)||null===t||Object.keys(t).forEach((function(e){if(!Na.includes(e)&&!oi.includes(e))if("context"!==e)n=di(n,u({},e,t[e]));else if("object"===i(t[e])&&null!==t[e]){var s={};Object.keys(t[e]).forEach((function(n){oi.includes(n)||(s[n]=t[e][n])})),n=di(n,r({},s))}else ut.error("[Analytics: processOptionsParam] context passed in options ".concat(e," is not object."))})),n}(e.message,t)}},{key:"getPageProperties",value:function(e,t){var n=So(),r=t&&t.page||{};for(var i in n)void 0===e[i]&&(e[i]=r[i]||n[i]);return e}},{key:"getContextPageProperties",value:function(e){var t=So(),n={};for(var r in t)n[r]=e&&e[r]?e[r]:t[r];return n}},{key:"reset",value:function(e){this.errorReporting.leaveBreadcrumb("reset API :: flag: ".concat(e)),this.loaded?(e&&(this.anonymousId=""),this.userId="",this.userTraits={},this.groupId="",this.groupTraits={},this.uSession.reset(),this.storage.clear(e)):this.toBeProcessedArray.push(["reset",e])}},{key:"getAnonymousId",value:function(e){return this.anonymousId=this.storage.getAnonymousId(e),this.anonymousId||this.setAnonymousId(),this.anonymousId}},{key:"getUserId",value:function(){return this.userId}},{key:"getSessionId",value:function(){return this.uSession.getSessionId()}},{key:"getUserTraits",value:function(){return this.userTraits}},{key:"getGroupId",value:function(){return this.groupId}},{key:"getGroupTraits",value:function(){return this.groupTraits}},{key:"setAnonymousId",value:function(e,t){var n=t?Pa(t):null,r=n?n.rs_amp_id:null;this.anonymousId=e||r||mi(),this.storage.setAnonymousId(this.anonymousId)}},{key:"isValidWriteKey",value:function(e){return e&&"string"==typeof e&&e.trim().length>0}},{key:"isValidServerUrl",value:function(e){return e&&"string"==typeof e&&e.trim().length>0}},{key:"isDatasetAvailable",value:function(){var e=document.createElement("div");return e.setAttribute("data-a-b","c"),!!e.dataset&&"c"===e.dataset.aB}},{key:"loadAfterPolyfill",value:function(e,t,n){var s=this;if("object"===i(t)&&null!==t&&(n=t,t=null),n&&n.logLevel&&(this.logLevel=n.logLevel,ut.setLogLevel(n.logLevel)),!this.isValidWriteKey(e))throw Error("Unable to load the SDK due to invalid writeKey");if(!this.storage||0===Object.keys(this.storage).length)throw Error("Cannot proceed as no storage is available");n&&n.cookieConsentManager&&(this.cookieConsentOptions=n.cookieConsentManager),this.writeKey=e,this.serverUrl=t,this.options=n;var o={};if(n&&n.setCookieDomain&&(o=r(r({},o),{},{domain:n.setCookieDomain})),n&&"boolean"==typeof n.secureCookie&&(o=r(r({},o),{},{secure:n.secureCookie})),n&&-1!==ri.indexOf(n.sameSiteCookie)&&(o=r(r({},o),{},{samesite:n.sameSiteCookie})),this.storage.options(o),n&&"string"==typeof n.uaChTrackLevel&&ai.includes(n.uaChTrackLevel)&&(this.uaChTrackLevel=n.uaChTrackLevel),navigator.userAgentData&&function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"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((function(t){e(t)}))}((function(e){s.uach=e}),this.uaChTrackLevel),n&&n.integrations&&(c(this.loadOnlyIntegrations,n.integrations),_i(this.loadOnlyIntegrations)),this.useGlobalIntegrationsConfigInEvents=n&&!0===n.useGlobalIntegrationsConfigInEvents,n&&n.sendAdblockPage&&(this.sendAdblockPage=!0),n&&n.sendAdblockPageOptions&&"object"===i(n.sendAdblockPageOptions)&&(this.sendAdblockPageOptions=n.sendAdblockPageOptions),this.uSession.initialize(n),n&&n.clientSuppliedCallbacks){var a={};Object.keys(this.methodToCallbackMapping).forEach((function(e){s.methodToCallbackMapping.hasOwnProperty(e)&&n.clientSuppliedCallbacks[s.methodToCallbackMapping[e]]&&(a[e]=n.clientSuppliedCallbacks[s.methodToCallbackMapping[e]])})),c(this.clientSuppliedCallbacks,a),this.registerCallbacks(!0)}if(n&&null!=n.loadIntegration&&(this.loadIntegration=!!n.loadIntegration),n&&"boolean"==typeof n.bufferDataPlaneEventsUntilReady&&(this.bufferDataPlaneEventsUntilReady=!0===n.bufferDataPlaneEventsUntilReady,this.bufferDataPlaneEventsUntilReady&&this.preProcessQueue.init(this.options,this.queueEventForDataPlane.bind(this))),n&&"number"==typeof n.dataPlaneEventsBufferTimeout&&(this.dataPlaneEventsBufferTimeout=n.dataPlaneEventsBufferTimeout),n&&void 0!==n.lockIntegrationsVersion&&(this.lockIntegrationsVersion=!0===n.lockIntegrationsVersion),this.initializeUser(n?n.anonymousIdOptions:void 0),this.setInitialPageProperties(),this.destSDKBaseURL=function(e,t,n){var r="";if(n){if(!(r=vi(n))){var i="CDN base URL for integrations is not valid";throw yi({message:"[Analytics] load:: ".concat(i)}),Error("Failed to load Rudder SDK: ".concat(i))}return r}var s=Ii().sdkURL;return r=s?s.split("/").slice(0,-1).concat(Zr).join("/"):ei,t&&(r=r.replace(Xr,e)),r}(this.version,this.lockIntegrationsVersion,n&&n.destSDKBaseURL),n&&n.getSourceConfig)if("function"!=typeof n.getSourceConfig)yi(new Error('option "getSourceConfig" must be a function'));else{var u=n.getSourceConfig();u instanceof Promise?u.then((function(e){return s.processResponse(200,e)})).catch(yi):this.processResponse(200,u)}else{var l=function(e){return Yr.concat(Yr.includes("?")?"&":"?").concat(e?"writeKey=".concat(e):"")}(e);n&&n.configUrl&&(l=function(e,t){var n=e;-1===n.indexOf("sourceConfig")&&(n="".concat(vi(n),"/sourceConfig/")),n="/"===n.slice(-1)?n:"".concat(n,"/");var r=t.split("?")[1],i=n.split("?");return i.length>1&&i[1]!==r?"".concat(i[0],"?").concat(r):"".concat(n,"?").concat(r)}(n.configUrl,l));try{!function(e,t,n,r){var i=r.bind(e),s=new XMLHttpRequest;s.open("GET",t,!0),s.setRequestHeader("Authorization","Basic ".concat(btoa("".concat(n,":")))),s.onload=function(){var e=s.status;200==e?i(200,s.responseText):(yi(new Error("".concat(ci," ").concat(e," for url: ").concat(t))),i(e))},s.send()}(this,l,e,this.processResponse)}catch(e){yi(e)}}}},{key:"arePolyfillsRequired",value:function(e){return(!e||"boolean"!=typeof e.polyfillIfRequired||e.polyfillIfRequired)&&(!String.prototype.endsWith||!String.prototype.startsWith||!String.prototype.includes||!Array.prototype.find||!Array.prototype.includes||"function"!=typeof window.URL||"undefined"==typeof Promise||!Object.entries||!Object.values||!String.prototype.replaceAll||!this.isDatasetAvailable())}},{key:"load",value:function(e,t,n){if(!this.loaded){var r=O(n);if(this.arePolyfillsRequired(r)){var i="polyfill";Oa(i,"https://polyfill.io/v3/polyfill.min.js?features=Number.isNaN%2CURL%2CArray.prototype.find%2CArray.prototype.includes%2CPromise%2CString.prototype.endsWith%2CString.prototype.includes%2CString.prototype.startsWith%2CObject.entries%2CObject.values%2CElement.prototype.dataset%2CString.prototype.replaceAll",{skipDatasetAttributes:!0});var s=this,o=setInterval((function(){!window.hasOwnProperty(i)&&null===document.getElementById(i)||"undefined"==typeof Promise||(clearInterval(o),s.loadAfterPolyfill(e,t,r))}),100);setTimeout((function(){clearInterval(o)}),ti)}else this.loadAfterPolyfill(e,t,r)}}},{key:"ready",value:function(e){this.loaded?"function"!=typeof e?ut.error("ready callback is not a function"):this.clientIntegrationsReady?e():this.readyCallbacks.push(e):this.toBeProcessedArray.push(["ready",e])}},{key:"initializeCallbacks",value:function(){var e=this;Object.keys(this.methodToCallbackMapping).forEach((function(t){e.methodToCallbackMapping.hasOwnProperty(t)&&e.on(t,(function(){}))}))}},{key:"registerCallbacks",value:function(e){var t=this;e||Object.keys(this.methodToCallbackMapping).forEach((function(e){t.methodToCallbackMapping.hasOwnProperty(e)&&window.rudderanalytics&&"function"==typeof window.rudderanalytics[t.methodToCallbackMapping[e]]&&(t.clientSuppliedCallbacks[e]=window.rudderanalytics[t.methodToCallbackMapping[e]])})),Object.keys(this.clientSuppliedCallbacks).forEach((function(e){t.clientSuppliedCallbacks.hasOwnProperty(e)&&t.on(e,t.clientSuppliedCallbacks[e])}))}},{key:"sendSampleRequest",value:function(){Oa("ad-block","//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js")}},{key:"startSession",value:function(e){this.uSession.start(e)}},{key:"endSession",value:function(){this.uSession.end()}},{key:"setAuthToken",value:function(e){"string"==typeof e?(this.storage.setAuthToken(e),this.transformationHandler.setAuthToken(e)):ut.error("Provided input should be in string format")}}]),e}(),Wa=new Ja;v(Wa),window.addEventListener("error",(function(e){yi(e,void 0,Wa)}),!0),Wa.initializeCallbacks(),Wa.registerCallbacks(!1);var Ya,Xa=window.rudderanalytics,Za=Array.isArray(Xa);if(Za)for(var eu=0;eu<Xa.length;){if(Xa[eu]&&"load"===Xa[eu][0]){Ya=Xa[eu],Xa.splice(eu,1);break}eu+=1}!function(e){function t(e,t){var n={};return Object.keys(e).forEach((function(r){r.startsWith(t)&&(n[r.substr(t.length)]=e[r])})),n}var n=function(e){var t={};try{new URL(e).searchParams.forEach((function(e,n){t[n]=e}))}catch(e){}return t}(window.location.href);n.ajs_aid&&Wa.toBeProcessedArray.push(["setAnonymousId",n.ajs_aid]),n.ajs_uid&&Wa.toBeProcessedArray.push(["identify",n.ajs_uid,t(n,"ajs_trait_")]),n.ajs_event&&Wa.toBeProcessedArray.push(["track",n.ajs_event,t(n,"ajs_prop_")])}(),Za&&Xa.forEach((function(e){return Wa.toBeProcessedArray.push(e)})),Ya&&Ya.length>0&&(Ya.shift(),Wa.load.apply(Wa,l(Ya)));var tu=Wa.ready.bind(Wa),nu=Wa.identify.bind(Wa),ru=Wa.page.bind(Wa),iu=Wa.track.bind(Wa),su=Wa.alias.bind(Wa),ou=Wa.group.bind(Wa),au=Wa.reset.bind(Wa),uu=Wa.load.bind(Wa),cu=Wa.initialized=!0,lu=Wa.getUserId.bind(Wa),hu=Wa.getSessionId.bind(Wa),fu=Wa.getUserTraits.bind(Wa),du=Wa.getAnonymousId.bind(Wa),pu=Wa.setAnonymousId.bind(Wa),gu=Wa.getGroupId.bind(Wa),yu=Wa.getGroupTraits.bind(Wa),vu=Wa.startSession.bind(Wa),mu=Wa.endSession.bind(Wa),bu=Wa.setAuthToken.bind(Wa);e.alias=su,e.endSession=mu,e.getAnonymousId=du,e.getGroupId=gu,e.getGroupTraits=yu,e.getSessionId=hu,e.getUserId=lu,e.getUserTraits=fu,e.group=ou,e.identify=nu,e.initialized=cu,e.load=uu,e.page=ru,e.ready=tu,e.reset=au,e.setAnonymousId=pu,e.setAuthToken=bu,e.startSession=vu,e.track=iu,Object.defineProperty(e,"__esModule",{value:!0})}(t)},396:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Analytics=t.createAnalyticsInstance=void 0;var i=n(316),s=n(706);function o(e){var t,n,o={},a={},u={},c=function(e,n){return null==t?void 0:t.getFeatureValue(e,n)},l=function(){return(null==n?void 0:n.getUserId())||""};return{initialise:function(e){var r=e.growthbookKey,o=e.growthbookDecryptionKey,u=e.rudderstackKey,l=e.growthbookOptions;if(n=s.RudderStack.getRudderStackInstance(u),r&&o){t=i.Growthbook.getGrowthBookInstance(r,o,l);var h=setInterval((function(){Object.keys(a).length>0?clearInterval(h):a=c("tracking-buttons-config",{})}),1e3)}},setAttributes:function(e){var i=e.country,s=e.user_language,a=e.device_language,u=e.device_type,c=e.account_type,h=e.user_id,f=e.app_id,d=e.utm_source,p=e.utm_medium,g=e.utm_campaign,y=e.is_authorised,v=e.url,m=e.domain;if(t||n){var b=null!=h?h:l();t&&t.setAttributes({id:b||l(),country:i,user_language:s,device_language:a,device_type:u,utm_source:d,utm_medium:p,utm_campaign:g,is_authorised:y,url:v,domain:m}),o=r(r(r(r(r(r({},o),void 0!==s&&{user_language:s}),void 0!==c&&{account_type:c}),void 0!==f&&{app_id:f}),void 0!==u&&{device_type:u}),void 0!==v&&{url:v})}},identifyEvent:function(e){var t=e||l();n&&(null==n||n.identifyEvent(t,{language:(null==o?void 0:o.user_language)||"en"}))},getFeatureState:function(e){var n,r;return null===(r=null===(n=null==t?void 0:t.getFeatureState(e))||void 0===n?void 0:n.experimentResult)||void 0===r?void 0:r.name},getFeatureValue:c,isFeatureOn:function(e){return null==t?void 0:t.isOn(e)},setUrl:function(e){return null==t?void 0:t.setUrl(e)},getId:l,trackEvent:function(e,t){n&&(navigator.onLine?(Object.keys(u).length>0&&Object.keys(u).forEach((function(e){n.track(u[e].event,u[e].payload),delete u[e]})),e in a?a[e]&&(null==n||n.track(e,r(r({},o),t))):null==n||n.track(e,r(r({},o),t))):u[e+t.action]={event:e,payload:r(r({},o),t)})},getInstances:function(){return{ab:t,tracking:n}},pageView:function(e,t){void 0===t&&(t="Deriv App"),n&&(null==n||n.pageView(e,t,l()))},reset:function(){n&&(null==n||n.reset())}}}t.createAnalyticsInstance=o,t.Analytics=o()},316:function(e,t,n){"use strict";var r=this&&this.__assign||function(){return r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},r.apply(this,arguments)},i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Growthbook=void 0;var a=n(200),u=o(n(202)),c=function(){function e(e,t,n){void 0===n&&(n={});var i=this;this.setAttributes=function(e){var t=e.id,n=e.country,s=e.user_language,o=e.device_language,a=e.device_type,u=e.utm_source,c=e.utm_medium,l=e.utm_campaign,h=e.is_authorised,f=e.url,d=e.domain,p=e.utm_content,g=i.GrowthBook.getAttributes();i.GrowthBook.setAttributes(r(r(r(r(r(r(r(r(r(r(r(r(r({},g),{id:t}),void 0!==n&&{country:n}),void 0!==s&&{user_language:s}),void 0!==o&&{device_language:o}),void 0!==a&&{device_type:a}),void 0!==u&&{utm_source:u}),void 0!==c&&{utm_medium:c}),void 0!==l&&{utm_campaign:l}),void 0!==h&&{is_authorised:h}),void 0!==f&&{url:f}),void 0!==d&&{domain:d}),void 0!==p&&{utm_content:p}))},this.getFeatureValue=function(e,t){return i.GrowthBook.getFeatureValue(e,t)},this.getFeatureState=function(e){return i.GrowthBook.evalFeature(e)},this.setUrl=function(e){return i.GrowthBook.setURL(e)},this.isOn=function(e){return i.GrowthBook.isOn(e)},this.init=function(){return i.GrowthBook.loadFeatures().catch((function(e){return console.error(e)}))},this.GrowthBook=new a.GrowthBook(r({apiHost:"https://cdn.growthbook.io",clientKey:e,decryptionKey:t,antiFlicker:!1,navigateDelay:0,antiFlickerTimeout:3500,subscribeToChanges:!0,enableDevMode:null===window||void 0===window?void 0:window.location.hostname.includes("localhost"),trackingCallback:function(e,t){window.dataLayer&&window.dataLayer.push({event:"experiment_viewed",event_category:"experiment",rudder_anonymous_id:u.getAnonymousId(),experiment_id:e.key,variation_id:t.variationId}),u.track("experiment_viewed",{experimentId:e.key,variationId:t.variationId})}},n)),this.init()}return e.getGrowthBookInstance=function(t,n,r){return e._instance||(e._instance=new e(t,n,r)),e._instance},e}();t.Growthbook=c},706:function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),i=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&r(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.RudderStack=void 0;var o=s(n(202)),a=function(){function e(e){var t=this;this.has_identified=!1,this.has_initialized=!1,this.current_page="",this.getAnonymousId=function(){return o.getAnonymousId()},this.getUserId=function(){return o.getUserId()},this.init=function(e){e&&(o.load(e,"https://deriv-dataplane.rudderstack.com"),o.ready((function(){t.has_initialized=!0,t.has_identified=!(!t.getUserId()&&!t.getAnonymousId())})))},this.identifyEvent=function(e,n){o.identify(e,n),t.has_identified=!0},this.pageView=function(e,n,r){void 0===n&&(n="Deriv App"),t.has_initialized&&t.has_identified&&e!==t.current_page&&(o.page(n,e,{user_id:r}),t.current_page=e)},this.reset=function(){t.has_initialized&&(o.reset(),t.has_identified=!1)},this.track=function(e,n){var r=Object.fromEntries(Object.entries(n).filter((function(e){return e[0],void 0!==e[1]})));if(t.has_initialized&&t.has_identified)try{o.track(e,r)}catch(e){console.error(e)}},this.init(e)}return e.getRudderStackInstance=function(t){return e._instance||(e._instance=new e(t)),e._instance},e}();t.RudderStack=a}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,n),s.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.Analytics=void 0;var t=n(396);Object.defineProperty(e,"Analytics",{enumerable:!0,get:function(){return t.Analytics}})})(),r})()));
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Analytics=t():e.Analytics=t()}(this,(()=>(()=>{"use strict";var e={328:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GrowthBook=void 0,t.prefetchPayload=async function(e){const t=new c(e);await(0,a.refreshFeatures)({instance:t,skipCache:e.skipCache,allowStale:!1,backgroundSync:e.streaming}),t.destroy()};var n,i=(n=r(591))&&n.__esModule?n:{default:n},s=r(106),o=r(427),a=r(707);const l="undefined"!=typeof window&&"undefined"!=typeof document,u=(0,s.loadSDKVersion)();class c{constructor(e){if(e=e||{},this.version=u,this._ctx=this.context=e,this._renderer=e.renderer||null,this._trackedExperiments=new Set,this._completedChangeIds=new Set,this._trackedFeatures={},this.debug=!!e.debug,this._subscriptions=new Set,this._rtQueue=[],this._rtTimer=0,this.ready=!1,this._assigned=new Map,this._forcedFeatureValues=new Map,this._attributeOverrides={},this._activeAutoExperiments=new Map,this._triggeredExpKeys=new Set,this._initialized=!1,this._redirectedUrl="",this._deferredTrackingCalls=new Map,this._autoExperimentsAllowed=!e.disableExperimentsOnLoad,e.remoteEval){if(e.decryptionKey)throw new Error("Encryption is not available for remoteEval");if(!e.clientKey)throw new Error("Missing clientKey");let t=!1;try{t=!!new URL(e.apiHost||"").hostname.match(/growthbook\.io$/i)}catch(e){}if(t)throw new Error("Cannot use remoteEval on GrowthBook Cloud")}else if(e.cacheKeyAttributes)throw new Error("cacheKeyAttributes are only used for remoteEval");if(e.features&&(this.ready=!0),l&&e.enableDevMode&&(window._growthbook=this,document.dispatchEvent(new Event("gbloaded"))),e.experiments?(this.ready=!0,this._updateAllAutoExperiments()):e.antiFlicker&&this._setAntiFlicker(),this._ctx.stickyBucketService&&this._ctx.stickyBucketAssignmentDocs)for(const e in this._ctx.stickyBucketAssignmentDocs){const t=this._ctx.stickyBucketAssignmentDocs[e];t&&this._ctx.stickyBucketService.saveAssignments(t).catch((()=>{}))}this.ready&&this.refreshStickyBuckets(this.getPayload())}async setPayload(e){this._payload=e;const t=await this.decryptPayload(e);this._decryptedPayload=t,await this.refreshStickyBuckets(t),t.features&&(this._ctx.features=t.features),t.experiments&&(this._ctx.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,this._render()}initSync(e){this._initialized=!0;const t=e.payload;if(t.encryptedExperiments||t.encryptedFeatures)throw new Error("initSync does not support encrypted payloads");if(this._ctx.stickyBucketService&&!this._ctx.stickyBucketAssignmentDocs)throw new Error("initSync requires you to pass stickyBucketAssignmentDocs into the GrowthBook constructor");if(this._payload=t,this._decryptedPayload=t,t.features&&(this._ctx.features=t.features),t.experiments&&(this._ctx.experiments=t.experiments,this._updateAllAutoExperiments()),this.ready=!0,e.streaming){if(!this._ctx.clientKey)throw new Error("Must specify clientKey to enable streaming");(0,a.startAutoRefresh)(this,!0),(0,a.subscribe)(this)}return this}async init(e){if(this._initialized=!0,(e=e||{}).payload){if(await this.setPayload(e.payload),e.streaming){if(!this._ctx.clientKey)throw new Error("Must specify clientKey to enable streaming");(0,a.startAutoRefresh)(this,!0),(0,a.subscribe)(this)}return{success:!0,source:"init"}}{const{data:t,...r}=await this._refresh({...e,allowStale:!0});return e.streaming&&(0,a.subscribe)(this),await this.setPayload(t||{}),r}}async loadFeatures(e){this._initialized=!0,(e=e||{}).autoRefresh&&(this._ctx.subscribeToChanges=!0);const{data:t}=await this._refresh({...e,allowStale:!0});await this.setPayload(t||{}),this._canSubscribe()&&(0,a.subscribe)(this)}async refreshFeatures(e){const t=await this._refresh({...e||{},allowStale:!1});t.data&&await this.setPayload(t.data)}getApiInfo(){return[this.getApiHosts().apiHost,this.getClientKey()]}getApiHosts(){const e=this._ctx.apiHost||"https://cdn.growthbook.io";return{apiHost:e.replace(/\/*$/,""),streamingHost:(this._ctx.streamingHost||e).replace(/\/*$/,""),apiRequestHeaders:this._ctx.apiHostRequestHeaders,streamingHostRequestHeaders:this._ctx.streamingHostRequestHeaders}}getClientKey(){return this._ctx.clientKey||""}getPayload(){return this._payload||{features:this.getFeatures(),experiments:this.getExperiments()}}getDecryptedPayload(){return this._decryptedPayload||this.getPayload()}isRemoteEval(){return this._ctx.remoteEval||!1}getCacheKeyAttributes(){return this._ctx.cacheKeyAttributes}async _refresh(e){var t;let{timeout:r,skipCache:n,allowStale:i,streaming:s}=e;if(!this._ctx.clientKey)throw new Error("Missing clientKey");return(0,a.refreshFeatures)({instance:this,timeout:r,skipCache:n||this._ctx.disableCache,allowStale:i,backgroundSync:null===(t=null!=s?s:this._ctx.backgroundSync)||void 0===t||t})}_render(){if(this._renderer)try{this._renderer()}catch(e){console.error("Failed to render",e)}}setFeatures(e){this._ctx.features=e,this.ready=!0,this._render()}async setEncryptedFeatures(e,t,r){const n=await(0,s.decrypt)(e,t||this._ctx.decryptionKey,r);this.setFeatures(JSON.parse(n))}setExperiments(e){this._ctx.experiments=e,this.ready=!0,this._updateAllAutoExperiments()}async setEncryptedExperiments(e,t,r){const n=await(0,s.decrypt)(e,t||this._ctx.decryptionKey,r);this.setExperiments(JSON.parse(n))}async decryptPayload(e,t,r){return(e={...e}).encryptedFeatures&&(e.features=JSON.parse(await(0,s.decrypt)(e.encryptedFeatures,t||this._ctx.decryptionKey,r)),delete e.encryptedFeatures),e.encryptedExperiments&&(e.experiments=JSON.parse(await(0,s.decrypt)(e.encryptedExperiments,t||this._ctx.decryptionKey,r)),delete e.encryptedExperiments),e}async setAttributes(e){this._ctx.attributes=e,this._ctx.stickyBucketService&&await this.refreshStickyBuckets(),this._ctx.remoteEval?await this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())}async updateAttributes(e){return this.setAttributes({...this._ctx.attributes,...e})}async setAttributeOverrides(e){this._attributeOverrides=e,this._ctx.stickyBucketService&&await this.refreshStickyBuckets(),this._ctx.remoteEval?await this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())}async setForcedVariations(e){this._ctx.forcedVariations=e||{},this._ctx.remoteEval?await this._refreshForRemoteEval():(this._render(),this._updateAllAutoExperiments())}setForcedFeatures(e){this._forcedFeatureValues=e,this._render()}async setURL(e){if(this._ctx.url=e,this._redirectedUrl="",this._ctx.remoteEval)return await this._refreshForRemoteEval(),void this._updateAllAutoExperiments(!0);this._updateAllAutoExperiments(!0)}getAttributes(){return{...this._ctx.attributes,...this._attributeOverrides}}getForcedVariations(){return this._ctx.forcedVariations||{}}getForcedFeatures(){return this._forcedFeatureValues||new Map}getStickyBucketAssignmentDocs(){return this._ctx.stickyBucketAssignmentDocs||{}}getUrl(){return this._ctx.url||""}getFeatures(){return this._ctx.features||{}}getExperiments(){return this._ctx.experiments||[]}getCompletedChangeIds(){return Array.from(this._completedChangeIds)}subscribe(e){return this._subscriptions.add(e),()=>{this._subscriptions.delete(e)}}_canSubscribe(){var e;return(null===(e=this._ctx.backgroundSync)||void 0===e||e)&&this._ctx.subscribeToChanges}async _refreshForRemoteEval(){if(!this._ctx.remoteEval)return;if(!this._initialized)return;const e=await this._refresh({allowStale:!1});e.data&&await this.setPayload(e.data)}getAllResults(){return new Map(this._assigned)}destroy(){this._subscriptions.clear(),this._assigned.clear(),this._trackedExperiments.clear(),this._completedChangeIds.clear(),this._deferredTrackingCalls.clear(),this._trackedFeatures={},this._rtQueue=[],this._payload=void 0,this._rtTimer&&clearTimeout(this._rtTimer),(0,a.unsubscribe)(this),l&&window._growthbook===this&&delete window._growthbook,this._activeAutoExperiments.forEach((e=>{e.undo()})),this._activeAutoExperiments.clear(),this._triggeredExpKeys.clear()}setRenderer(e){this._renderer=e}forceVariation(e,t){this._ctx.forcedVariations=this._ctx.forcedVariations||{},this._ctx.forcedVariations[e]=t,this._ctx.remoteEval?this._refreshForRemoteEval():(this._updateAllAutoExperiments(),this._render())}run(e){const t=this._run(e,null);return this._fireSubscriptions(e,t),t}triggerExperiment(e){return this._triggeredExpKeys.add(e),this._ctx.experiments?this._ctx.experiments.filter((t=>t.key===e)).map((e=>this._runAutoExperiment(e))).filter((e=>null!==e)):null}triggerAutoExperiments(){this._autoExperimentsAllowed=!0,this._updateAllAutoExperiments(!0)}_runAutoExperiment(e,t){const r=this._activeAutoExperiments.get(e);if(e.manual&&!this._triggeredExpKeys.has(e.key)&&!r)return null;const n=this._isAutoExperimentBlockedByContext(e)?this._getResult(e,-1,!1,""):this.run(e),i=JSON.stringify(n.value);if(!t&&n.inExperiment&&r&&r.valueHash===i)return n;if(r&&this._undoActiveAutoExperiment(e),n.inExperiment){const t=(0,s.getAutoExperimentChangeType)(e);if("redirect"===t&&n.value.urlRedirect&&e.urlPatterns){const t=e.persistQueryString?(0,s.mergeQueryStrings)(this._getContextUrl(),n.value.urlRedirect):n.value.urlRedirect;if((0,s.isURLTargeted)(t,e.urlPatterns))return this.log("Skipping redirect because original URL matches redirect URL",{id:e.key}),n;this._redirectedUrl=t;const r=this._getNavigateFunction();var o;if(r)if(l)this._setAntiFlicker(),window.setTimeout((()=>{try{r(t)}catch(e){console.error(e)}}),null!==(o=this._ctx.navigateDelay)&&void 0!==o?o:100);else try{r(t)}catch(e){console.error(e)}}else if("visual"===t){const t=this._ctx.applyDomChangesCallback?this._ctx.applyDomChangesCallback(n.value):this._applyDOMChanges(n.value);t&&this._activeAutoExperiments.set(e,{undo:t,valueHash:i})}}return n}_undoActiveAutoExperiment(e){const t=this._activeAutoExperiments.get(e);t&&(t.undo(),this._activeAutoExperiments.delete(e))}_updateAllAutoExperiments(e){if(!this._autoExperimentsAllowed)return;const t=this._ctx.experiments||[],r=new Set(t);this._activeAutoExperiments.forEach(((e,t)=>{r.has(t)||(e.undo(),this._activeAutoExperiments.delete(t))}));for(const r of t){const t=this._runAutoExperiment(r,e);if(null!=t&&t.inExperiment&&"redirect"===(0,s.getAutoExperimentChangeType)(r))break}}_fireSubscriptions(e,t){const r=e.key,n=this._assigned.get(r);n&&n.result.inExperiment===t.inExperiment&&n.result.variationId===t.variationId||(this._assigned.set(r,{experiment:e,result:t}),this._subscriptions.forEach((r=>{try{r(e,t)}catch(e){console.error(e)}})))}_trackFeatureUsage(e,t){if("override"===t.source)return;const r=JSON.stringify(t.value);if(this._trackedFeatures[e]!==r){if(this._trackedFeatures[e]=r,this._ctx.onFeatureUsage)try{this._ctx.onFeatureUsage(e,t)}catch(e){}l&&window.fetch&&(this._rtQueue.push({key:e,on:t.on}),this._rtTimer||(this._rtTimer=window.setTimeout((()=>{this._rtTimer=0;const e=[...this._rtQueue];this._rtQueue=[],this._ctx.realtimeKey&&window.fetch("https://rt.growthbook.io/?key=".concat(this._ctx.realtimeKey,"&events=").concat(encodeURIComponent(JSON.stringify(e))),{cache:"no-cache",mode:"no-cors"}).catch((()=>{}))}),this._ctx.realtimeInterval||2e3)))}}_getFeatureResult(e,t,r,n,i,s){const o={value:t,on:!!t,off:!t,source:r,ruleId:n||""};return i&&(o.experiment=i),s&&(o.experimentResult=s),this._trackFeatureUsage(e,o),o}isOn(e){return this.evalFeature(e).on}isOff(e){return this.evalFeature(e).off}getFeatureValue(e,t){const r=this.evalFeature(e).value;return null===r?t:r}feature(e){return this.evalFeature(e)}evalFeature(e){return this._evalFeature(e)}_evalFeature(e,t){if((t=t||{evaluatedFeatures:new Set}).evaluatedFeatures.has(e))return this._getFeatureResult(e,null,"cyclicPrerequisite");if(t.evaluatedFeatures.add(e),t.id=e,this._forcedFeatureValues.has(e))return this._getFeatureResult(e,this._forcedFeatureValues.get(e),"override");if(!this._ctx.features||!this._ctx.features[e])return this._getFeatureResult(e,null,"unknownFeature");const r=this._ctx.features[e];if(r.rules)e:for(const n of r.rules){if(n.parentConditions)for(const r of n.parentConditions){const n=this._evalFeature(r.id,t);if("cyclicPrerequisite"===n.source)return this._getFeatureResult(e,null,"cyclicPrerequisite");const i={value:n.value};if(!(0,o.evalCondition)(i,r.condition||{})){if(r.gate)return this._getFeatureResult(e,null,"prerequisite");continue e}}if(n.filters&&this._isFilteredOut(n.filters))continue;if("force"in n){if(n.condition&&!this._conditionPasses(n.condition))continue;if(!this._isIncludedInRollout(n.seed||e,n.hashAttribute,this._ctx.stickyBucketService&&!n.disableStickyBucketing?n.fallbackAttribute:void 0,n.range,n.coverage,n.hashVersion))continue;return n.tracks&&n.tracks.forEach((e=>{this._track(e.experiment,e.result)})),this._getFeatureResult(e,n.force,"force",n.id)}if(!n.variations)continue;const r={variations:n.variations,key:n.key||e};"coverage"in n&&(r.coverage=n.coverage),n.weights&&(r.weights=n.weights),n.hashAttribute&&(r.hashAttribute=n.hashAttribute),n.fallbackAttribute&&(r.fallbackAttribute=n.fallbackAttribute),n.disableStickyBucketing&&(r.disableStickyBucketing=n.disableStickyBucketing),void 0!==n.bucketVersion&&(r.bucketVersion=n.bucketVersion),void 0!==n.minBucketVersion&&(r.minBucketVersion=n.minBucketVersion),n.namespace&&(r.namespace=n.namespace),n.meta&&(r.meta=n.meta),n.ranges&&(r.ranges=n.ranges),n.name&&(r.name=n.name),n.phase&&(r.phase=n.phase),n.seed&&(r.seed=n.seed),n.hashVersion&&(r.hashVersion=n.hashVersion),n.filters&&(r.filters=n.filters),n.condition&&(r.condition=n.condition);const i=this._run(r,e);if(this._fireSubscriptions(r,i),i.inExperiment&&!i.passthrough)return this._getFeatureResult(e,i.value,"experiment",n.id,r,i)}return this._getFeatureResult(e,void 0===r.defaultValue?null:r.defaultValue,"defaultValue")}_isIncludedInRollout(e,t,r,n,i,o){if(!n&&void 0===i)return!0;if(!n&&0===i)return!1;const{hashValue:a}=this._getHashAttribute(t,r);if(!a)return!1;const l=(0,s.hash)(e,a,o||1);return null!==l&&(n?(0,s.inRange)(l,n):void 0===i||l<=i)}_conditionPasses(e){return(0,o.evalCondition)(this.getAttributes(),e)}_isFilteredOut(e){return e.some((e=>{const{hashValue:t}=this._getHashAttribute(e.attribute);if(!t)return!0;const r=(0,s.hash)(e.seed,t,e.hashVersion||2);return null===r||!e.ranges.some((e=>(0,s.inRange)(r,e)))}))}_run(e,t){const r=e.key,n=e.variations.length;if(n<2)return this._getResult(e,-1,!1,t);if(!1===this._ctx.enabled)return this._getResult(e,-1,!1,t);if((e=this._mergeOverrides(e)).urlPatterns&&!(0,s.isURLTargeted)(this._getContextUrl(),e.urlPatterns))return this._getResult(e,-1,!1,t);const i=(0,s.getQueryStringOverride)(r,this._getContextUrl(),n);if(null!==i)return this._getResult(e,i,!1,t);if(this._ctx.forcedVariations&&r in this._ctx.forcedVariations){const n=this._ctx.forcedVariations[r];return this._getResult(e,n,!1,t)}if("draft"===e.status||!1===e.active)return this._getResult(e,-1,!1,t);const{hashAttribute:a,hashValue:l}=this._getHashAttribute(e.hashAttribute,this._ctx.stickyBucketService&&!e.disableStickyBucketing?e.fallbackAttribute:void 0);if(!l)return this._getResult(e,-1,!1,t);let u=-1,c=!1,d=!1;if(this._ctx.stickyBucketService&&!e.disableStickyBucketing){const{variation:t,versionIsBlocked:r}=this._getStickyBucketVariation({expKey:e.key,expBucketVersion:e.bucketVersion,expHashAttribute:e.hashAttribute,expFallbackAttribute:e.fallbackAttribute,expMinBucketVersion:e.minBucketVersion,expMeta:e.meta});c=t>=0,u=t,d=!!r}if(!c){if(e.filters){if(this._isFilteredOut(e.filters))return this._getResult(e,-1,!1,t)}else if(e.namespace&&!(0,s.inNamespace)(l,e.namespace))return this._getResult(e,-1,!1,t);if(e.include&&!(0,s.isIncluded)(e.include))return this._getResult(e,-1,!1,t);if(e.condition&&!this._conditionPasses(e.condition))return this._getResult(e,-1,!1,t);if(e.parentConditions)for(const r of e.parentConditions){const n=this._evalFeature(r.id);if("cyclicPrerequisite"===n.source)return this._getResult(e,-1,!1,t);const i={value:n.value};if(!(0,o.evalCondition)(i,r.condition||{}))return this._getResult(e,-1,!1,t)}if(e.groups&&!this._hasGroupOverlap(e.groups))return this._getResult(e,-1,!1,t)}if(e.url&&!this._urlIsValid(e.url))return this._getResult(e,-1,!1,t);const h=(0,s.hash)(e.seed||r,l,e.hashVersion||1);if(null===h)return this._getResult(e,-1,!1,t);if(!c){const t=e.ranges||(0,s.getBucketRanges)(n,void 0===e.coverage?1:e.coverage,e.weights);u=(0,s.chooseVariation)(h,t)}if(d)return this._getResult(e,-1,!1,t,void 0,!0);if(u<0)return this._getResult(e,-1,!1,t);if("force"in e)return this._getResult(e,void 0===e.force?-1:e.force,!1,t);if(this._ctx.qaMode)return this._getResult(e,-1,!1,t);if("stopped"===e.status)return this._getResult(e,-1,!1,t);const g=this._getResult(e,u,!0,t,h,c);if(this._ctx.stickyBucketService&&!e.disableStickyBucketing){const{changed:t,key:r,doc:n}=this._generateStickyBucketAssignmentDoc(a,(0,s.toString)(l),{[this._getStickyBucketExperimentKey(e.key,e.bucketVersion)]:g.key});t&&(this._ctx.stickyBucketAssignmentDocs=this._ctx.stickyBucketAssignmentDocs||{},this._ctx.stickyBucketAssignmentDocs[r]=n,this._ctx.stickyBucketService.saveAssignments(n))}return this._track(e,g),"changeId"in e&&e.changeId&&this._completedChangeIds.add(e.changeId),g}log(e,t){this.debug&&(this._ctx.log?this._ctx.log(e,t):console.log(e,t))}getDeferredTrackingCalls(){return Array.from(this._deferredTrackingCalls.values())}setDeferredTrackingCalls(e){this._deferredTrackingCalls=new Map(e.filter((e=>e&&e.experiment&&e.result)).map((e=>[this._getTrackKey(e.experiment,e.result),e])))}fireDeferredTrackingCalls(){this._ctx.trackingCallback&&(this._deferredTrackingCalls.forEach((e=>{e&&e.experiment&&e.result?this._track(e.experiment,e.result):console.error("Invalid deferred tracking call",{call:e})})),this._deferredTrackingCalls.clear())}setTrackingCallback(e){this._ctx.trackingCallback=e,this.fireDeferredTrackingCalls()}_getTrackKey(e,t){return t.hashAttribute+t.hashValue+e.key+t.variationId}_track(e,t){const r=this._getTrackKey(e,t);if(this._ctx.trackingCallback){if(!this._trackedExperiments.has(r)){this._trackedExperiments.add(r);try{this._ctx.trackingCallback(e,t)}catch(e){console.error(e)}}}else this._deferredTrackingCalls.has(r)||this._deferredTrackingCalls.set(r,{experiment:e,result:t})}_mergeOverrides(e){const t=e.key,r=this._ctx.overrides;return r&&r[t]&&"string"==typeof(e=Object.assign({},e,r[t])).url&&(e.url=(0,s.getUrlRegExp)(e.url)),e}_getHashAttribute(e,t){let r=e||"id",n="";return this._attributeOverrides[r]?n=this._attributeOverrides[r]:this._ctx.attributes?n=this._ctx.attributes[r]||"":this._ctx.user&&(n=this._ctx.user[r]||""),!n&&t&&(this._attributeOverrides[t]?n=this._attributeOverrides[t]:this._ctx.attributes?n=this._ctx.attributes[t]||"":this._ctx.user&&(n=this._ctx.user[t]||""),n&&(r=t)),{hashAttribute:r,hashValue:n}}_getResult(e,t,r,n,i,s){let o=!0;(t<0||t>=e.variations.length)&&(t=0,o=!1);const{hashAttribute:a,hashValue:l}=this._getHashAttribute(e.hashAttribute,this._ctx.stickyBucketService&&!e.disableStickyBucketing?e.fallbackAttribute:void 0),u=e.meta?e.meta[t]:{},c={key:u.key||""+t,featureId:n,inExperiment:o,hashUsed:r,variationId:t,value:e.variations[t],hashAttribute:a,hashValue:l,stickyBucketUsed:!!s};return u.name&&(c.name=u.name),void 0!==i&&(c.bucket=i),u.passthrough&&(c.passthrough=u.passthrough),c}_getContextUrl(){return this._ctx.url||(l?window.location.href:"")}_urlIsValid(e){const t=this._getContextUrl();if(!t)return!1;const r=t.replace(/^https?:\/\//,"").replace(/^[^/]*\//,"/");return!!e.test(t)||!!e.test(r)}_hasGroupOverlap(e){const t=this._ctx.groups||{};for(let r=0;r<e.length;r++)if(t[e[r]])return!0;return!1}_isAutoExperimentBlockedByContext(e){const t=(0,s.getAutoExperimentChangeType)(e);if("visual"===t){if(this._ctx.disableVisualExperiments)return!0;if(this._ctx.disableJsInjection&&e.variations.some((e=>e.js)))return!0}else{if("redirect"!==t)return!0;if(this._ctx.disableUrlRedirectExperiments)return!0;try{const t=new URL(this._getContextUrl());for(const r of e.variations){if(!r||!r.urlRedirect)continue;const e=new URL(r.urlRedirect);if(this._ctx.disableCrossOriginUrlRedirectExperiments){if(e.protocol!==t.protocol)return!0;if(e.host!==t.host)return!0}}}catch(t){return this.log("Error parsing current or redirect URL",{id:e.key,error:t}),!0}}return!(!e.changeId||!(this._ctx.blockedChangeIds||[]).includes(e.changeId))}getRedirectUrl(){return this._redirectedUrl}_getNavigateFunction(){return this._ctx.navigate?this._ctx.navigate:l?e=>{window.location.replace(e)}:null}_setAntiFlicker(){if(this._ctx.antiFlicker&&l)try{var e;const t=document.createElement("style");t.innerHTML=".gb-anti-flicker { opacity: 0 !important; pointer-events: none; }",document.head.appendChild(t),document.documentElement.classList.add("gb-anti-flicker"),setTimeout((()=>{document.documentElement.classList.remove("gb-anti-flicker")}),null!==(e=this._ctx.antiFlickerTimeout)&&void 0!==e?e:3500)}catch(e){console.error(e)}}_applyDOMChanges(e){if(!l)return;const t=[];if(e.css){const r=document.createElement("style");r.innerHTML=e.css,document.head.appendChild(r),t.push((()=>r.remove()))}if(e.js){const r=document.createElement("script");r.innerHTML=e.js,this._ctx.jsInjectionNonce&&(r.nonce=this._ctx.jsInjectionNonce),document.head.appendChild(r),t.push((()=>r.remove()))}return e.domMutations&&e.domMutations.forEach((e=>{t.push(i.default.declarative(e).revert)})),()=>{t.forEach((e=>e()))}}_deriveStickyBucketIdentifierAttributes(e){const t=new Set,r=e&&e.features?e.features:this.getFeatures(),n=e&&e.experiments?e.experiments:this.getExperiments();return Object.keys(r).forEach((e=>{const n=r[e];if(n.rules)for(const e of n.rules)e.variations&&(t.add(e.hashAttribute||"id"),e.fallbackAttribute&&t.add(e.fallbackAttribute))})),n.map((e=>{t.add(e.hashAttribute||"id"),e.fallbackAttribute&&t.add(e.fallbackAttribute)})),Array.from(t)}async refreshStickyBuckets(e){if(this._ctx.stickyBucketService){const t=this._getStickyBucketAttributes(e);this._ctx.stickyBucketAssignmentDocs=await this._ctx.stickyBucketService.getAllAssignments(t)}}_getStickyBucketAssignments(e,t){if(!this._ctx.stickyBucketAssignmentDocs)return{};const{hashAttribute:r,hashValue:n}=this._getHashAttribute(e),i="".concat(r,"||").concat((0,s.toString)(n)),{hashAttribute:o,hashValue:a}=this._getHashAttribute(t),l=a?"".concat(o,"||").concat((0,s.toString)(a)):null,u={};return l&&this._ctx.stickyBucketAssignmentDocs[l]&&Object.assign(u,this._ctx.stickyBucketAssignmentDocs[l].assignments||{}),this._ctx.stickyBucketAssignmentDocs[i]&&Object.assign(u,this._ctx.stickyBucketAssignmentDocs[i].assignments||{}),u}_getStickyBucketVariation(e){let{expKey:t,expBucketVersion:r,expHashAttribute:n,expFallbackAttribute:i,expMinBucketVersion:s,expMeta:o}=e;r=r||0,s=s||0,n=n||"id",o=o||[];const a=this._getStickyBucketExperimentKey(t,r),l=this._getStickyBucketAssignments(n,i);if(s>0)for(let e=0;e<=s;e++)if(void 0!==l[this._getStickyBucketExperimentKey(t,e)])return{variation:-1,versionIsBlocked:!0};const u=l[a];if(void 0===u)return{variation:-1};const c=o.findIndex((e=>e.key===u));return c<0?{variation:-1}:{variation:c}}_getStickyBucketExperimentKey(e,t){return t=t||0,"".concat(e,"__").concat(t)}_getStickyBucketAttributes(e){const t={};return this._ctx.stickyBucketIdentifierAttributes=this._ctx.stickyBucketIdentifierAttributes?this._ctx.stickyBucketIdentifierAttributes:this._deriveStickyBucketIdentifierAttributes(e),this._ctx.stickyBucketIdentifierAttributes.forEach((e=>{const{hashValue:r}=this._getHashAttribute(e);t[e]=(0,s.toString)(r)})),t}_generateStickyBucketAssignmentDoc(e,t,r){const n="".concat(e,"||").concat(t),i=this._ctx.stickyBucketAssignmentDocs&&this._ctx.stickyBucketAssignmentDocs[n]&&this._ctx.stickyBucketAssignmentDocs[n].assignments||{},s={...i,...r};return{key:n,doc:{attributeName:e,attributeValue:t,assignments:s},changed:JSON.stringify(i)!==JSON.stringify(s)}}}t.GrowthBook=c},707:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.clearCache=async function(){u.clear(),c.clear(),I(),l=!1,await p()},t.configureCache=function(e){Object.assign(i,e),i.backgroundSync||I()},t.helpers=void 0,t.onHidden=g,t.onVisible=f,t.refreshFeatures=async function(e){let{instance:t,timeout:r,skipCache:n,allowStale:a,backgroundSync:c}=e;return c||(i.backgroundSync=!1),async function(e){let{instance:t,allowStale:r,timeout:n,skipCache:a}=e;const c=v(t),d=y(t),g=new Date,f=new Date(g.getTime()-i.maxAge+i.staleTTL);await async function(){if(!l){l=!0;try{if(s.localStorage){const e=await s.localStorage.getItem(i.cacheKey);if(!i.disableCache&&e){const t=JSON.parse(e);t&&Array.isArray(t)&&t.forEach((e=>{let[t,r]=e;u.set(t,{...r,staleAt:new Date(r.staleAt)})})),m()}}}catch(e){}if(!i.disableIdleStreams){const e=o.startIdleListener();e&&(o.stopIdleListener=e)}}}();const p=i.disableCache||a?void 0:u.get(d);if(p&&(r||p.staleAt>g)&&p.staleAt>f)return p.sse&&h.add(c),p.staleAt<g?k(t):S(t),{data:p.data,success:!0,source:"cache"};{const e=await function(e,t){return new Promise((r=>{let n,i=!1;const s=e=>{i||(i=!0,n&&clearTimeout(n),r(e||null))};t&&(n=setTimeout((()=>s()),t)),e.then((e=>s(e))).catch((()=>s()))}))}(k(t),n);return e||{data:null,success:!1,source:"timeout",error:new Error("Timeout")}}}({instance:t,allowStale:a,timeout:r,skipCache:n})},t.setPolyfills=function(e){Object.assign(s,e)},t.startAutoRefresh=S,t.subscribe=function(e){const t=v(e),r=a.get(t)||new Set;r.add(e),a.set(t,r)},t.unsubscribe=function(e){a.forEach((t=>t.delete(e)))};var n=r(106);const i={staleTTL:6e4,maxAge:864e5,cacheKey:"gbFeaturesCache",backgroundSync:!0,maxEntries:10,disableIdleStreams:!1,idleStreamInterval:2e4,disableCache:!1},s=(0,n.getPolyfills)(),o={fetchFeaturesCall:e=>{let{host:t,clientKey:r,headers:n}=e;return s.fetch("".concat(t,"/api/features/").concat(r),{headers:n})},fetchRemoteEvalCall:e=>{let{host:t,clientKey:r,payload:n,headers:i}=e;const o={method:"POST",headers:{"Content-Type":"application/json",...i},body:JSON.stringify(n)};return s.fetch("".concat(t,"/api/eval/").concat(r),o)},eventSourceCall:e=>{let{host:t,clientKey:r,headers:n}=e;return n?new s.EventSource("".concat(t,"/sub/").concat(r),{headers:n}):new s.EventSource("".concat(t,"/sub/").concat(r))},startIdleListener:()=>{let e;if("undefined"==typeof window||"undefined"==typeof document)return;const t=()=>{"visible"===document.visibilityState?(window.clearTimeout(e),f()):"hidden"===document.visibilityState&&(e=window.setTimeout(g,i.idleStreamInterval))};return document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},stopIdleListener:()=>{}};t.helpers=o;try{globalThis.localStorage&&(s.localStorage=globalThis.localStorage)}catch(e){}const a=new Map;let l=!1;const u=new Map,c=new Map,d=new Map,h=new Set;function g(){d.forEach((e=>{e&&(e.state="idle",_(e))}))}function f(){d.forEach((e=>{e&&"idle"===e.state&&w(e)}))}async function p(){try{if(!s.localStorage)return;await s.localStorage.setItem(i.cacheKey,JSON.stringify(Array.from(u.entries())))}catch(e){}}function v(e){const[t,r]=e.getApiInfo();return"".concat(t,"||").concat(r)}function y(e){const t=v(e);if(!e.isRemoteEval())return t;const r=e.getAttributes(),n=e.getCacheKeyAttributes()||Object.keys(e.getAttributes()),i={};n.forEach((e=>{i[e]=r[e]}));const s=e.getForcedVariations(),o=e.getUrl();return"".concat(t,"||").concat(JSON.stringify({ca:i,fv:s,url:o}))}function m(){const e=Array.from(u.entries()).map((e=>{let[t,r]=e;return{key:t,staleAt:r.staleAt.getTime()}})).sort(((e,t)=>e.staleAt-t.staleAt)),t=Math.min(Math.max(0,u.size-i.maxEntries),u.size);for(let r=0;r<t;r++)u.delete(e[r].key)}function b(e,t,r){const n=r.dateUpdated||"",s=new Date(Date.now()+i.staleTTL),o=i.disableCache?void 0:u.get(t);if(o&&n&&o.version===n)return o.staleAt=s,void p();i.disableCache||(u.set(t,{data:r,version:n,staleAt:s,sse:h.has(e)}),m()),p();const l=a.get(e);l&&l.forEach((e=>async function(e,t){await e.setPayload(t||e.getPayload())}(e,r)))}async function k(e){const{apiHost:t,apiRequestHeaders:r}=e.getApiHosts(),n=e.getClientKey(),i=e.isRemoteEval(),s=v(e),a=y(e);let l=c.get(a);return l||(l=(i?o.fetchRemoteEvalCall({host:t,clientKey:n,payload:{attributes:e.getAttributes(),forcedVariations:e.getForcedVariations(),forcedFeatures:Array.from(e.getForcedFeatures().entries()),url:e.getUrl()},headers:r}):o.fetchFeaturesCall({host:t,clientKey:n,headers:r})).then((e=>{if(!e.ok)throw new Error("HTTP error: ".concat(e.status));return"enabled"===e.headers.get("x-sse-support")&&h.add(s),e.json()})).then((t=>(b(s,a,t),S(e),c.delete(a),{data:t,success:!0,source:"network"}))).catch((e=>(c.delete(a),{data:null,source:"error",success:!1,error:e}))),c.set(a,l)),l}function S(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=v(e),n=y(e),{streamingHost:o,streamingHostRequestHeaders:l}=e.getApiHosts(),u=e.getClientKey();if(t&&h.add(r),i.backgroundSync&&h.has(r)&&s.EventSource){if(d.has(r))return;const e={src:null,host:o,clientKey:u,headers:l,cb:t=>{try{if("features-updated"===t.type){const e=a.get(r);e&&e.forEach((e=>{k(e)}))}else if("features"===t.type){const e=JSON.parse(t.data);b(r,n,e)}e.errors=0}catch(t){E(e)}},errors:0,state:"active"};d.set(r,e),w(e)}}function E(e){if("idle"!==e.state&&(e.errors++,e.errors>3||e.src&&2===e.src.readyState)){const t=Math.pow(3,e.errors-3)*(1e3+1e3*Math.random());_(e),setTimeout((()=>{["idle","active"].includes(e.state)||w(e)}),Math.min(t,3e5))}}function _(e){e.src&&(e.src.onopen=null,e.src.onerror=null,e.src.close(),e.src=null,"active"===e.state&&(e.state="disabled"))}function w(e){e.src=o.eventSourceCall({host:e.host,clientKey:e.clientKey,headers:e.headers}),e.state="active",e.src.addEventListener("features",e.cb),e.src.addEventListener("features-updated",e.cb),e.src.onerror=()=>E(e),e.src.onopen=()=>{e.errors=0}}function A(e,t){_(e),d.delete(t)}function I(){h.clear(),d.forEach(A),a.clear(),o.stopIdleListener()}},200:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BrowserCookieStickyBucketService",{enumerable:!0,get:function(){return s.BrowserCookieStickyBucketService}}),Object.defineProperty(t,"ExpressCookieStickyBucketService",{enumerable:!0,get:function(){return s.ExpressCookieStickyBucketService}}),Object.defineProperty(t,"GrowthBook",{enumerable:!0,get:function(){return i.GrowthBook}}),Object.defineProperty(t,"LocalStorageStickyBucketService",{enumerable:!0,get:function(){return s.LocalStorageStickyBucketService}}),Object.defineProperty(t,"RedisStickyBucketService",{enumerable:!0,get:function(){return s.RedisStickyBucketService}}),Object.defineProperty(t,"StickyBucketService",{enumerable:!0,get:function(){return s.StickyBucketService}}),Object.defineProperty(t,"clearCache",{enumerable:!0,get:function(){return n.clearCache}}),Object.defineProperty(t,"configureCache",{enumerable:!0,get:function(){return n.configureCache}}),Object.defineProperty(t,"evalCondition",{enumerable:!0,get:function(){return o.evalCondition}}),Object.defineProperty(t,"getAutoExperimentChangeType",{enumerable:!0,get:function(){return a.getAutoExperimentChangeType}}),Object.defineProperty(t,"getPolyfills",{enumerable:!0,get:function(){return a.getPolyfills}}),Object.defineProperty(t,"helpers",{enumerable:!0,get:function(){return n.helpers}}),Object.defineProperty(t,"isURLTargeted",{enumerable:!0,get:function(){return a.isURLTargeted}}),Object.defineProperty(t,"onHidden",{enumerable:!0,get:function(){return n.onHidden}}),Object.defineProperty(t,"onVisible",{enumerable:!0,get:function(){return n.onVisible}}),Object.defineProperty(t,"paddedVersionString",{enumerable:!0,get:function(){return a.paddedVersionString}}),Object.defineProperty(t,"prefetchPayload",{enumerable:!0,get:function(){return i.prefetchPayload}}),Object.defineProperty(t,"setPolyfills",{enumerable:!0,get:function(){return n.setPolyfills}});var n=r(707),i=r(328),s=r(350),o=r(427),a=r(106)},427:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evalCondition=s;var n=r(106);const i={};function s(e,t){for(const[r,n]of Object.entries(t))switch(r){case"$or":if(!d(e,n))return!1;break;case"$nor":if(d(e,n))return!1;break;case"$and":if(!h(e,n))return!1;break;case"$not":if(s(e,n))return!1;break;default:if(!a(n,o(e,r)))return!1}return!0}function o(e,t){const r=t.split(".");let n=e;for(let e=0;e<r.length;e++){if(!n||"object"!=typeof n||!(r[e]in n))return null;n=n[r[e]]}return n}function a(e,t){if("string"==typeof e)return t+""===e;if("number"==typeof e)return 1*t===e;if("boolean"==typeof e)return!!t===e;if(null===e)return null===t;if(Array.isArray(e)||!l(e))return JSON.stringify(t)===JSON.stringify(e);for(const r in e)if(!c(r,t,e[r]))return!1;return!0}function l(e){const t=Object.keys(e);return t.length>0&&t.filter((e=>"$"===e[0])).length===t.length}function u(e,t){return Array.isArray(e)?e.some((e=>t.includes(e))):t.includes(e)}function c(e,t,r){switch(e){case"$veq":return(0,n.paddedVersionString)(t)===(0,n.paddedVersionString)(r);case"$vne":return(0,n.paddedVersionString)(t)!==(0,n.paddedVersionString)(r);case"$vgt":return(0,n.paddedVersionString)(t)>(0,n.paddedVersionString)(r);case"$vgte":return(0,n.paddedVersionString)(t)>=(0,n.paddedVersionString)(r);case"$vlt":return(0,n.paddedVersionString)(t)<(0,n.paddedVersionString)(r);case"$vlte":return(0,n.paddedVersionString)(t)<=(0,n.paddedVersionString)(r);case"$eq":return t===r;case"$ne":return t!==r;case"$lt":return t<r;case"$lte":return t<=r;case"$gt":return t>r;case"$gte":return t>=r;case"$exists":return r?null!=t:null==t;case"$in":return!!Array.isArray(r)&&u(t,r);case"$nin":return!!Array.isArray(r)&&!u(t,r);case"$not":return!a(r,t);case"$size":return!!Array.isArray(t)&&a(r,t.length);case"$elemMatch":return function(e,t){if(!Array.isArray(e))return!1;const r=l(t)?e=>a(t,e):e=>s(e,t);for(let t=0;t<e.length;t++)if(e[t]&&r(e[t]))return!0;return!1}(t,r);case"$all":if(!Array.isArray(t))return!1;for(let e=0;e<r.length;e++){let n=!1;for(let i=0;i<t.length;i++)if(a(r[e],t[i])){n=!0;break}if(!n)return!1}return!0;case"$regex":try{return(o=r,i[o]||(i[o]=new RegExp(o.replace(/([^\\])\//g,"$1\\/"))),i[o]).test(t)}catch(e){return!1}case"$type":return function(e){if(null===e)return"null";if(Array.isArray(e))return"array";const t=typeof e;return["string","number","boolean","object","undefined"].includes(t)?t:"unknown"}(t)===r;default:return console.error("Unknown operator: "+e),!1}var o}function d(e,t){if(!t.length)return!0;for(let r=0;r<t.length;r++)if(s(e,t[r]))return!0;return!1}function h(e,t){for(let r=0;r<t.length;r++)if(!s(e,t[r]))return!1;return!0}},350:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StickyBucketService=t.RedisStickyBucketService=t.LocalStorageStickyBucketService=t.ExpressCookieStickyBucketService=t.BrowserCookieStickyBucketService=void 0;class r{async getAllAssignments(e){const t={};return(await Promise.all(Object.entries(e).map((e=>{let[t,r]=e;return this.getAssignments(t,r)})))).forEach((e=>{if(e){const r="".concat(e.attributeName,"||").concat(e.attributeValue);t[r]=e}})),t}}t.StickyBucketService=r,t.LocalStorageStickyBucketService=class extends r{constructor(e){e=e||{},super(),this.prefix=e.prefix||"gbStickyBuckets__";try{this.localStorage=e.localStorage||globalThis.localStorage}catch(e){}}async getAssignments(e,t){const r="".concat(e,"||").concat(t);let n=null;if(!this.localStorage)return n;try{const e=await this.localStorage.getItem(this.prefix+r)||"{}",t=JSON.parse(e);t.attributeName&&t.attributeValue&&t.assignments&&(n=t)}catch(e){}return n}async saveAssignments(e){const t="".concat(e.attributeName,"||").concat(e.attributeValue);if(this.localStorage)try{await this.localStorage.setItem(this.prefix+t,JSON.stringify(e))}catch(e){}}},t.ExpressCookieStickyBucketService=class extends r{constructor(e){let{prefix:t="gbStickyBuckets__",req:r,res:n,cookieAttributes:i={}}=e;super(),this.prefix=t,this.req=r,this.res=n,this.cookieAttributes=i}async getAssignments(e,t){const r="".concat(e,"||").concat(t);let n=null;if(!this.req)return n;try{const e=this.req.cookies[this.prefix+r]||"{}",t=JSON.parse(e);t.attributeName&&t.attributeValue&&t.assignments&&(n=t)}catch(e){}return n}async saveAssignments(e){const t="".concat(e.attributeName,"||").concat(e.attributeValue);if(!this.res)return;const r=JSON.stringify(e);this.res.cookie(encodeURIComponent(this.prefix+t),encodeURIComponent(r),this.cookieAttributes)}},t.BrowserCookieStickyBucketService=class extends r{constructor(e){let{prefix:t="gbStickyBuckets__",jsCookie:r,cookieAttributes:n={}}=e;super(),this.prefix=t,this.jsCookie=r,this.cookieAttributes=n}async getAssignments(e,t){const r="".concat(e,"||").concat(t);let n=null;if(!this.jsCookie)return n;try{const e=this.jsCookie.get(this.prefix+r),t=JSON.parse(e||"{}");t.attributeName&&t.attributeValue&&t.assignments&&(n=t)}catch(e){}return n}async saveAssignments(e){const t="".concat(e.attributeName,"||").concat(e.attributeValue);if(!this.jsCookie)return;const r=JSON.stringify(e);this.jsCookie.set(this.prefix+t,r,this.cookieAttributes)}},t.RedisStickyBucketService=class extends r{constructor(e){let{redis:t}=e;super(),this.redis=t}async getAllAssignments(e){const t={},r=Object.entries(e).map((e=>{let[t,r]=e;return"".concat(t,"||").concat(r)}));return this.redis?(await this.redis.mget(...r).then((e=>{e.forEach((e=>{try{const r=JSON.parse(e||"{}");if(r.attributeName&&r.attributeValue&&r.assignments){const e="".concat(r.attributeName,"||").concat(r.attributeValue);t[e]=r}}catch(e){}}))})),t):t}async getAssignments(e,t){return null}async saveAssignments(e){const t="".concat(e.attributeName,"||").concat(e.attributeValue);this.redis&&await this.redis.set(t,JSON.stringify(e))}}},106:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.chooseVariation=function(e,t){for(let r=0;r<t.length;r++)if(o(e,t[r]))return r;return-1},t.decrypt=async function(e,t,n){if(t=t||"",!(n=n||globalThis.crypto&&globalThis.crypto.subtle||r.SubtleCrypto))throw new Error("No SubtleCrypto implementation found");try{const r=await n.importKey("raw",u(t),{name:"AES-CBC",length:128},!0,["encrypt","decrypt"]),[i,s]=e.split("."),o=await n.decrypt({name:"AES-CBC",iv:u(i)},r,u(s));return(new TextDecoder).decode(o)}catch(e){throw new Error("Failed to decrypt")}},t.getAutoExperimentChangeType=function(e){return e.urlPatterns&&e.variations.some((e=>c(e)&&"urlRedirect"in e))?"redirect":e.variations.some((e=>c(e)&&(e.domMutations||"js"in e||"css"in e)))?"visual":"unknown"},t.getBucketRanges=function(e,t,r){(t=void 0===t?1:t)<0?t=0:t>1&&(t=1);const n=s(e);(r=r||n).length!==e&&(r=n);const i=r.reduce(((e,t)=>t+e),0);(i<.99||i>1.01)&&(r=n);let o=0;return r.map((e=>{const r=o;return o+=e,[r,r+t*e]}))},t.getEqualWeights=s,t.getPolyfills=function(){return r},t.getQueryStringOverride=function(e,t,r){if(!t)return null;const n=t.split("?")[1];if(!n)return null;const i=n.replace(/#.*/,"").split("&").map((e=>e.split("=",2))).filter((t=>{let[r]=t;return r===e})).map((e=>{let[,t]=e;return parseInt(t)}));return i.length>0&&i[0]>=0&&i[0]<r?i[0]:null},t.getUrlRegExp=a,t.hash=i,t.inNamespace=function(e,t){const r=i("__"+t[0],e,1);return null!==r&&r>=t[1]&&r<t[2]},t.inRange=o,t.isIncluded=function(e){try{return e()}catch(e){return console.error(e),!1}},t.isURLTargeted=function(e,t){if(!t.length)return!1;let r=!1,n=!1;for(let i=0;i<t.length;i++){const s=l(e,t[i].type,t[i].pattern);if(!1===t[i].include){if(s)return!1}else r=!0,s&&(n=!0)}return n||!r},t.loadSDKVersion=function(){let e;try{e="1.0.1"}catch(t){e=""}return e},t.mergeQueryStrings=function(e,t){let r,n;try{r=new URL(e),n=new URL(t)}catch(e){return console.error("Unable to merge query strings: ".concat(e)),t}return r.searchParams.forEach(((e,t)=>{n.searchParams.has(t)||n.searchParams.set(t,e)})),n.toString()},t.paddedVersionString=function(e){"number"==typeof e&&(e+=""),e&&"string"==typeof e||(e="0");const t=e.replace(/(^v|\+.*$)/g,"").split(/[-.]/);return 3===t.length&&t.push("~"),t.map((e=>e.match(/^[0-9]+$/)?e.padStart(5," "):e)).join("-")},t.toString=function(e){return"string"==typeof e?e:JSON.stringify(e)};const r={fetch:globalThis.fetch?globalThis.fetch.bind(globalThis):void 0,SubtleCrypto:globalThis.crypto?globalThis.crypto.subtle:void 0,EventSource:globalThis.EventSource};function n(e){let t=2166136261;const r=e.length;for(let n=0;n<r;n++)t^=e.charCodeAt(n),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return t>>>0}function i(e,t,r){return 2===r?n(n(e+t)+"")%1e4/1e4:1===r?n(t+e)%1e3/1e3:null}function s(e){return e<=0?[]:new Array(e).fill(1/e)}function o(e,t){return e>=t[0]&&e<t[1]}function a(e){try{const t=e.replace(/([^\\])\//g,"$1\\/");return new RegExp(t)}catch(e){return void console.error(e)}}function l(e,t,r){try{const n=new URL(e,"https://_");if("regex"===t){const e=a(r);return!!e&&(e.test(n.href)||e.test(n.href.substring(n.origin.length)))}return"simple"===t&&function(e,t){try{const r=new URL(t.replace(/^([^:/?]*)\./i,"https://$1.").replace(/\*/g,"_____"),"https://_____"),n=[[e.host,r.host,!1],[e.pathname,r.pathname,!0]];return r.hash&&n.push([e.hash,r.hash,!1]),r.searchParams.forEach(((t,r)=>{n.push([e.searchParams.get(r)||"",t,!1])})),!n.some((e=>!function(e,t,r){try{let n=t.replace(/[*.+?^${}()|[\]\\]/g,"\\$&").replace(/_____/g,".*");return r&&(n="\\/?"+n.replace(/(^\/|\/$)/g,"")+"\\/?"),new RegExp("^"+n+"$","i").test(e)}catch(e){return!1}}(e[0],e[1],e[2])))}catch(e){return!1}}(n,r)}catch(e){return!1}}const u=e=>Uint8Array.from(atob(e),(e=>e.charCodeAt(0)));function c(e){return"object"==typeof e&&null!==e}},182:(e,t,r)=>{Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const n={"@@functional/placeholder":!0};function i(e){return e===n}function s(e){return function t(r){return 0===arguments.length||i(r)?t:e.apply(this,arguments)}}function o(e){return function t(r,n){switch(arguments.length){case 0:return t;case 1:return i(r)?t:s((function(t){return e(r,t)}));default:return i(r)&&i(n)?t:i(r)?s((function(t){return e(t,n)})):i(n)?s((function(t){return e(r,t)})):e(r,n)}}}function a(e){return function t(r,n,a){switch(arguments.length){case 0:return t;case 1:return i(r)?t:o((function(t,n){return e(r,t,n)}));case 2:return i(r)&&i(n)?t:i(r)?o((function(t,r){return e(t,n,r)})):i(n)?o((function(t,n){return e(r,t,n)})):s((function(t){return e(r,n,t)}));default:return i(r)&&i(n)&&i(a)?t:i(r)&&i(n)?o((function(t,r){return e(t,r,a)})):i(r)&&i(a)?o((function(t,r){return e(t,n,r)})):i(n)&&i(a)?o((function(t,n){return e(r,t,n)})):i(r)?s((function(t){return e(t,n,a)})):i(n)?s((function(t){return e(r,t,a)})):i(a)?s((function(t){return e(r,n,t)})):e(r,n,a)}}}function l(e,t){return Object.prototype.hasOwnProperty.call(t,e)}var u=s((function(e){return null===e?"Null":void 0===e?"Undefined":Object.prototype.toString.call(e).slice(8,-1)}));function c(e){return"[object Object]"===Object.prototype.toString.call(e)}const d=Number.isInteger||function(e){return(0|e)===e};function h(e,t,r){if(r||(r=new g),function(e){var t=typeof e;return null==e||"object"!=t&&"function"!=t}(e))return e;var n,i=function(t){var n=r.get(e);if(n)return n;for(var i in r.set(e,t),e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=h(e[i],0,r));return t};switch(u(e)){case"Object":return i(Object.create(Object.getPrototypeOf(e)));case"Array":return i(Array(e.length));case"Date":return new Date(e.valueOf());case"RegExp":return n=e,new RegExp(n.source,n.flags?n.flags:(n.global?"g":"")+(n.ignoreCase?"i":"")+(n.multiline?"m":"")+(n.sticky?"y":"")+(n.unicode?"u":"")+(n.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 e.slice();default:return e}}var g=function(){function e(){this.map={},this.length=0}return e.prototype.set=function(e,t){var r=this.hash(e),n=this.map[r];n||(this.map[r]=n=[]),n.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],n=0;n<r.length;n+=1)if((s=r[n])[0]===e)return s[1]}else{var i=this.hash(e);if(r=this.map[i])for(n=0;n<r.length;n+=1){var s;if((s=r[n])[0]===e)return s[1]}}},e}(),f=s((function(e){return null!=e&&"function"==typeof e.clone?e.clone():h(e)}));function p(e,t){for(var r=t,n=0;n<e.length;n+=1){if(null==r)return;var i=e[n];r=d(i)?(o=r,a=void 0,l=void 0,l=(s=i)<0?o.length+s:s,a=o,"[object String]"===Object.prototype.toString.call(a)?o.charAt(l):o[l]):r[i]}var s,o,a,l;return r}var v=a((function(e,t,r){var n,i={};for(n in r=r||{},t=t||{})l(n,t)&&(i[n]=l(n,r)?e(n,t[n],r[n]):t[n]);for(n in r)l(n,r)&&!l(n,i)&&(i[n]=r[n]);return i})),y=a((function e(t,r,n){return v((function(r,n,i){return c(n)&&c(i)?e(t,n,i):t(r,n,i)}),r,n)})),m=a((function(e,t,r){return y((function(t,r,n){return e(r,n)}),t,r)})),b=o(p),k=o((function(e,t){var r={};for(var n in t)e(t[n],n,t)&&(r[n]=t[n]);return r}));const S=e=>"function"==typeof e&&Boolean(e.constructor&&e.call&&e.apply),E=e=>"string"==typeof e,_=e=>null===e,w=e=>void 0===e,A=e=>_(e)||w(e),I=e=>!w(e),T=e=>!A(e),x=e=>e instanceof Error,C=(e,t)=>{const r=t.split(".");return b(r,e)},R=e=>!_(e)&&"object"==typeof e&&!Array.isArray(e),P=e=>!_(e)&&"[object Object]"===Object.prototype.toString.call(e),O=(e,t)=>{if(!Array.isArray(e)||!Array.isArray(t))return f(t);const r=f(e);return t.forEach(((e,t)=>{r[t]=Array.isArray(e)||R(e)?B(r[t],e):e})),r},B=(e,t)=>m(O,e,t),$=e=>P(e)&&Object.keys(e).length>0,D=e=>{const t=k(I,e);return Object.keys(t).forEach((e=>{const r=t[e];P(r)&&(t[e]=D(r))})),t},M=e=>{const t=k(T,e);return Object.keys(t).forEach((e=>{const r=t[e];P(r)&&(t[e]=M(r))})),t},L=e=>{let t=e;if(!E(e)&&!A(e))try{t=JSON.stringify(e)}catch(e){t=null}return t},j=(e,t,r,n,i)=>{const s={category:e,name:t,properties:r,options:n};return S(i)&&(s.callback=i),S(n)&&(s.category=e,s.name=t,s.properties=r,delete s.options,s.callback=n),S(r)&&(s.category=e,s.name=t,delete s.properties,delete s.options,s.callback=r),S(t)&&(s.category=e,delete s.name,delete s.properties,delete s.options,s.callback=t),S(e)&&(delete s.category,delete s.name,delete s.properties,delete s.options,s.callback=e),P(e)?(delete s.name,delete s.category,s.properties=e,s.options=t):P(t)&&(delete s.name,s.properties=t,s.options=S(r)?null:r),E(e)&&!E(t)&&(delete s.category,s.name=e),I(s.category)||delete s.category,I(s.name)||delete s.name,s.properties=s.properties?f(s.properties):{},I(s.options)?s.options=f(s.options):delete s.options,s.properties=B(P(s.properties)?s.properties:{},{name:E(s.name)?s.name:null,category:E(s.category)?s.category:null}),s},N=(e,t,r,n)=>{const i={name:e,properties:t,options:r};return S(n)&&(i.callback=n),S(r)&&(i.properties=t,delete i.options,i.callback=r),S(t)&&(delete i.properties,delete i.options,i.callback=t),i.properties=T(i.properties)?f(i.properties):{},I(i.options)?i.options=f(i.options):delete i.options,i},U=(e,t,r,n)=>{const i={userId:e,traits:t,options:r};return S(n)&&(i.callback=n),S(r)&&(i.userId=e,i.traits=t,delete i.options,i.callback=r),S(t)&&(i.userId=e,delete i.traits,delete i.options,i.callback=t),(P(e)||_(e))&&(i.userId=null,i.traits=e,i.options=t),I(i.userId)?i.userId=L(i.userId):delete i.userId,P(i.traits)?i.traits=f(i.traits):delete i.traits,I(i.options)?i.options=f(i.options):delete i.options,i},F=(e,t,r,n)=>{const i={to:e,from:t,options:r};return S(n)&&(i.callback=n),S(r)&&(i.to=e,i.from=t,delete i.options,i.callback=r),S(t)?(i.to=e,delete i.from,delete i.options,i.callback=t):(P(t)||_(t))&&(i.to=e,delete i.from,i.options=t),S(e)?(delete i.to,delete i.from,delete i.options,i.callback=e):(P(e)||_(e))&&(delete i.to,delete i.from,i.options=e),I(i.to)?i.to=L(i.to):delete i.to,I(i.from)?i.from=L(i.from):delete i.from,I(i.options)?i.options=f(i.options):delete i.options,i},H=(e,t,r,n)=>{const i={groupId:e,traits:t,options:r};return S(n)&&(i.callback=n),S(r)&&(i.groupId=e,i.traits=t,delete i.options,i.callback=r),S(t)&&(i.groupId=e,delete i.traits,delete i.options,i.callback=t),S(e)?(i.groupId=null,delete i.traits,delete i.options,i.callback=e):(P(e)||_(e))&&(i.groupId=null,i.traits=e,i.options=S(t)?null:t),I(i.groupId)?i.groupId=L(i.groupId):delete i.groupId,i.traits=P(i.traits)?f(i.traits):{},I(i.options)?i.options=f(i.options):delete i.options,i},V="CapabilitiesManager",K="ConfigManager",G="EventManager",Q="PluginsManager",z="UserSessionManager",q="ErrorHandler",J="PluginEngine",W="StoreManager",X="RudderStackApplication",Z="AnalyticsCore",Y="RudderLabs JavaScript SDK",ee="3.3.0",te="RudderJS-Initiated",re="preloadedEventsBuffer",ne="ajs_aid",ie="ajs_uid",se="ajs_event",oe=18e5,ae=(e="app")=>{globalThis.RudderStackGlobals||(globalThis.RudderStackGlobals={}),globalThis.RudderStackGlobals[e]||(globalThis.RudderStackGlobals[e]={})},le=(e,t,r="app")=>{ae(r),globalThis.RudderStackGlobals[r][e]=t},ue=(e,t)=>{const r={};return e.forEach(((n,i)=>{if(i.startsWith(t)){const n=i.substring(t.length);r[n]=e.get(i)}})),r},ce=(e,t)=>{const r=e.shift();let n;if(S(t[r])){switch(r){case"page":n=j(...e);break;case"track":n=N(...e);break;case"identify":n=U(...e);break;case"alias":n=F(...e);break;case"group":n=H(...e);break;default:t[r](...e)}n&&t[r](n)}},de=":: ",he=(e,t)=>`Failed to load the script with the id "${e}" from URL "${t}".`,ge=(e,t,r)=>{const n=[];return function(i,s){if(!(t?.includes(i)||e&&A(s))){if("object"!=typeof s||_(s))return s;for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(s)?(r?.warn(((e,t)=>`JSONStringify${de}A circular reference has been detected in the object and the property "${t}" has been dropped from the output.`)(0,i)),"[Circular Reference]"):(n.push(s),s)}}},fe=(e,t,r,n)=>{try{return JSON.stringify(e,ge(t,r,n))}catch(e){return n?.warn("Failed to convert the value to a JSON string.",e),null}},pe=(e,t)=>{let r=e;return x(e)?r.message=`${t}: ${e.message}`:r=new Error(`${t}: ${fe(e)}`),r};class ve{hasErrorHandler=!1;constructor(e,t,r=1e4){this.errorHandler=e,this.logger=t,this.timeout=r,this.hasErrorHandler=Boolean(this.errorHandler),this.onError=this.onError.bind(this)}loadJSFile(e){const{url:t,id:r,timeout:n,async:i,callback:s,extraAttributes:o}=e,a=!S(s);((e,t,r,n=!0,i)=>new Promise(((s,o)=>{document.getElementById(t)&&o(new Error((e=>`A script with the id "${e}" is already loaded. Skipping the loading of this script to prevent conflicts.`)(t)));try{let a;(e=>{const t=document.getElementsByTagName("head");if(t.length>0)return void t[0]?.insertBefore(e,t[0]?.firstChild);const r=document.getElementsByTagName("script");if(r.length>0&&r[0]?.parentNode)return void r[0]?.parentNode.insertBefore(e,r[0]);const n=document.createElement("head");n.appendChild(e);const i=document.getElementsByTagName("html")[0];i?.insertBefore(n,i.firstChild)})(((e,t,r=!0,n=null,i=null,s={})=>{const o=document.createElement("script");return o.type="text/javascript",o.onload=n,o.onerror=i,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,n,(()=>{globalThis.clearTimeout(a),s(t)}),(()=>{globalThis.clearTimeout(a),o(new Error(he(t,e)))}),i)),a=globalThis.setTimeout((()=>{o(new Error(((e,t,r)=>`A timeout of ${r} ms occurred while trying to load the script with id "${e}" from URL "${t}".`)(t,e,r)))}),r)}catch(r){o(pe(r,he(t,e)))}})))(t,r,n||this.timeout,i,o).then((e=>{a||s(e)})).catch((e=>{this.onError(e),a||s()}))}onError(e){if(!this.hasErrorHandler)throw e;this.errorHandler?.onError(e,"ExternalSrcLoader")}}var ye=Symbol.for("preact-signals");function me(){if(Ee>1)Ee--;else{for(var e,t=!1;void 0!==Se;){var r=Se;for(Se=void 0,_e++;void 0!==r;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&xe(r))try{r.c()}catch(r){t||(e=r,t=!0)}r=n}}if(_e=0,Ee--,t)throw e}}function be(e){if(Ee>0)return e();Ee++;try{return e()}finally{me()}}var ke=void 0,Se=void 0,Ee=0,_e=0,we=0;function Ae(e){if(void 0!==ke){var t=e.n;if(void 0===t||t.t!==ke)return t={i:0,S:e,p:ke.s,n:void 0,t:ke,e:void 0,x:void 0,r:t},void 0!==ke.s&&(ke.s.n=t),ke.s=t,e.n=t,32&ke.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=ke.s,t.n=void 0,ke.s.n=t,ke.s=t),t}}function Ie(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}function Te(e){return new Ie(e)}function xe(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 Ce(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 Re(e){for(var t=e.s,r=void 0;void 0!==t;){var n=t.p;-1===t.i?(t.S.U(t),void 0!==n&&(n.n=t.n),void 0!==t.n&&(t.n.p=n)):r=t,t.S.n=t.r,void 0!==t.r&&(t.r=void 0),t=n}e.s=r}function Pe(e){Ie.call(this,void 0),this.x=e,this.s=void 0,this.g=we-1,this.f=4}function Oe(e){var t=e.u;if(e.u=void 0,"function"==typeof t){Ee++;var r=ke;ke=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Be(e),t}finally{ke=r,me()}}}function Be(e){for(var t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Oe(e)}function $e(e){if(ke!==this)throw new Error("Out-of-order effect");Re(this),ke=e,this.f&=-2,8&this.f&&Be(this),me()}function De(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function Me(e){var t=new De(e);try{t.c()}catch(e){throw t.d(),e}return t.d.bind(t)}Ie.prototype.brand=ye,Ie.prototype.h=function(){return!0},Ie.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)},Ie.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)}},Ie.prototype.subscribe=function(e){var t=this;return Me((function(){var r=t.value,n=ke;ke=void 0;try{e(r)}finally{ke=n}}))},Ie.prototype.valueOf=function(){return this.value},Ie.prototype.toString=function(){return this.value+""},Ie.prototype.toJSON=function(){return this.value},Ie.prototype.peek=function(){var e=ke;ke=void 0;try{return this.value}finally{ke=e}},Object.defineProperty(Ie.prototype,"value",{get:function(){var e=Ae(this);return void 0!==e&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(_e>100)throw new Error("Cycle detected");this.v=e,this.i++,we++,Ee++;try{for(var t=this.t;void 0!==t;t=t.x)t.t.N()}finally{me()}}}}),(Pe.prototype=new Ie).h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===we)return!0;if(this.g=we,this.f|=1,this.i>0&&!xe(this))return this.f&=-2,!0;var e=ke;try{Ce(this),ke=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 ke=e,Re(this),this.f&=-2,!0},Pe.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)}Ie.prototype.S.call(this,e)},Pe.prototype.U=function(e){if(void 0!==this.t&&(Ie.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)}},Pe.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(Pe.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Ae(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),De.prototype.c=function(){var e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;var t=this.x();"function"==typeof t&&(this.u=t)}finally{e()}},De.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Oe(this),Ce(this),Ee++;var e=ke;return ke=this,$e.bind(this,e)},De.prototype.N=function(){2&this.f||(this.f|=2,this.o=Se,Se=this)},De.prototype.d=function(){this.f|=8,1&this.f||Be(this)};class Le{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=[]}}const je={LOG:0,INFO:1,DEBUG:2,WARN:3,ERROR:4,NONE:5},Ne="ERROR",Ue=new class{constructor(e=Ne,t="",r=console){this.minLogLevel=je[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<=je[e]&&this.logProvider[e.toLowerCase()]?.(...this.formatLogData(t))}setScope(e){this.scope=e||this.scope}setMinLogLevel(e){this.minLogLevel=je[e],w(this.minLogLevel)&&(this.minLogLevel=je[Ne])}formatLogData(e){if(Array.isArray(e)&&e.length>0){let t="%c RS SDK";this.scope&&(t=`${t} - ${this.scope}`),t=`${t} %c ${E(e[0])?e[0].trim():""}`;const r=[t,"font-weight: bold; background: black; color: white;","font-weight: normal;"];return E(e[0])||r.push(e[0]),r.push(...e.slice(1)),r}return e}},Fe=["localStorage","memoryStorage","cookieStorage","sessionStorage","none"],He="cookieStorage",Ve="Unable to process/parse source configuration response.",Ke=(e,t,r)=>`${e} due to timeout or no connection (${t?t.type:""}) for URL: ${r}.`,Ge="Failed to invoke the ready callback",Qe="js-integrations",ze="plugins",qe=new 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_]*)?$"),Je="modern",We="https://cdn.rudderlabs.com",Xe="v3",Ze=`${We}/${Xe}/${Je}/${Qe}`,Ye=`${We}/${Xe}/${Je}/${ze}`,et="https://api.rudderstack.com",tt="bugsnag",rt="v3",nt="xhr",it={oneTrust:"OneTrustConsentManager",ketch:"KetchConsentManager",custom:"CustomConsentManager"},st={[tt]:"Bugsnag"},ot={[rt]:"StorageEncryption",legacy:"StorageEncryptionLegacy"},at={[nt]:"XhrQueue",beacon:"BeaconQueue"},lt=Te(f({logLevel:"ERROR",configUrl:et,loadIntegration:!0,sessions:{autoTrack:!0,timeout:oe},sameSiteCookie:"Lax",polyfillIfRequired:!0,integrations:{All:!0},useBeacon:!1,beaconQueueOptions:{},destinationsQueueOptions:{},queueOptions:{},lockIntegrationsVersion:!1,uaChTrackLevel:"none",plugins:[],useGlobalIntegrationsConfigInEvents:!1,bufferDataPlaneEventsUntilReady:!1,dataPlaneEventsBufferTimeout:1e4,storage:{encryption:{version:rt},migrate:!0},sendAdblockPageOptions:{},useServerSideCookies:!1})),ut={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"},ct={userId:"",userTraits:{},anonymousId:"",groupId:"",groupTraits:{},initialReferrer:"",initialReferringDomain:"",sessionInfo:{},authToken:null},dt={autoTrack:!0,timeout:oe},ht={userId:Te(ct.userId),userTraits:Te(ct.userTraits),anonymousId:Te(ct.anonymousId),groupId:Te(ct.groupId),groupTraits:Te(ct.groupTraits),initialReferrer:Te(ct.initialReferrer),initialReferringDomain:Te(ct.initialReferringDomain),sessionInfo:Te(ct.sessionInfo),authToken:Te(ct.authToken)},gt={isOnline:Te(!0),storage:{isLocalStorageAvailable:Te(!1),isCookieStorageAvailable:Te(!1),isSessionStorageAvailable:Te(!1)},isBeaconAvailable:Te(!1),isLegacyDOM:Te(!1),isUaCHAvailable:Te(!1),isCryptoAvailable:Te(!1),isIE11:Te(!1),isAdBlocked:Te(!1)},ft={isErrorReportingEnabled:Te(!1),isMetricsReportingEnabled:Te(!1),errorReportingProviderPluginName:Te(void 0),isErrorReportingPluginLoaded:Te(!1)},pt=Te(void 0),vt={activeDataplaneUrl:Te(void 0),integrationsCDNPath:Te(Ze),pluginsCDNPath:Te(Ye),sourceConfigUrl:Te(void 0),status:Te(void 0),initialized:Te(!1),logLevel:Te("ERROR"),loaded:Te(!1),readyCallbacks:Te([]),writeKey:Te(void 0),dataPlaneUrl:Te(void 0)},yt={enabled:Te(!1),initialized:Te(!1),data:Te({}),activeConsentManagerPluginName:Te(void 0),preConsent:Te({enabled:!1}),postConsent:Te({}),resolutionStrategy:Te("and"),provider:Te(void 0),metadata:Te(void 0)},mt={retries:Te(0),dropped:Te(0),sent:Te(0),queued:Te(0),triggered:Te(0)},bt={app:Te({name:Y,namespace:"com.rudderlabs.javascript",version:ee,installType:"npm"}),traits:Te(null),library:Te({name:Y,version:ee,snippetVersion:globalThis.RudderSnippetVersion}),userAgent:Te(""),device:Te(null),network:Te(null),os:Te({name:"",version:""}),locale:Te(null),screen:Te({density:0,width:0,height:0,innerWidth:0,innerHeight:0}),"ua-ch":Te(void 0),timezone:Te(void 0)},kt={configuredDestinations:Te([]),activeDestinations:Te([]),loadOnlyIntegrations:Te({}),failedDestinations:Te([]),loadIntegration:Te(!0),initializedDestinations:Te([]),clientDestinationsReady:Te(!1),integrationsConfig:Te({})},St={toBeProcessedArray:Te([]),readyCallbacksArray:Te([])},Et={ready:Te(!1),loadedPlugins:Te([]),failedPlugins:Te([]),pluginsToLoadFromConfig:Te([]),activePlugins:Te([]),totalPluginsToLoad:Te(0)},_t={encryptionPluginName:Te(void 0),migrate:Te(!1),type:Te(void 0),cookie:Te(void 0),entries:Te({}),trulyAnonymousTracking:Te(!1)},wt={isEnabledServerSideCookies:Te(!1),dataServiceUrl:Te(void 0)},At={eventsQueuePluginName:Te(void 0),deliveryEnabled:Te(!0)},It={...f({capabilities:gt,consents:yt,context:bt,eventBuffer:St,lifecycle:vt,loadOptions:lt,metrics:mt,nativeDestinations:kt,plugins:Et,reporting:ft,session:ht,source:pt,storage:_t,serverCookies:wt,dataPlaneEvents:At})},Tt=new class{plugins=[];byName={};cache={};config={throws:!0};constructor(e={},t){this.config={throws:!0,...e},this.logger=t}register(e,t){if(!e.name){const t=`${J}${de}Plugin name is missing.`;if(this.config.throws)throw new Error(t);this.logger?.error(t,e)}if(this.byName[e.name]){const t=(r=J,n=e.name,`${r}${de}Plugin "${n}" already exists.`);if(this.config.throws)throw new Error(t);this.logger?.error(t)}var r,n;this.cache={},this.plugins=this.plugins.slice();let i=this.plugins.length;this.plugins.forEach(((t,r)=>{t.deps?.includes(e.name)&&(i=Math.min(i,r))})),this.plugins.splice(i,0,e),this.byName[e.name]=e,S(e.initialize)&&e.initialize(t)}unregister(e){const t=this.byName[e];if(!t){const t=`${J}${de}Plugin "${e}" not found.`;if(this.config.throws)throw new Error(t);this.logger?.error(t)}const r=this.plugins.indexOf(t);if(-1===r){const t=`${J}${de}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 new 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){const t=e??".";return this.cache[t]||(this.cache[t]=this.plugins.filter((e=>{if(e.deps?.some((e=>!this.byName[e]))){const t=e.deps.filter((e=>!this.byName[e]));return this.logger?.error(((e,t,r)=>`${e}${de}Plugin "${t}" could not be loaded because some of its dependencies "${r}" do not exist.`)(J,e.name,t)),!1}return"."===t||((e,t)=>Boolean(C(e,t)))(e,t)}))),this.cache[t]}processRawPlugins(e){e(this.plugins),this.cache={}}invoke(e,t=!0,...r){let n=e;if(!n)throw new Error("Failed to invoke plugin because the extension point name is missing.");const i=n.startsWith("!"),s=this.config.throws??n.endsWith("!");if(n=n.replace(/(^!|!$)/g,""),!n)throw new Error("Failed to invoke plugin because the extension point name is invalid.");const o=n.split(".");o.pop();const a=o.join(".");return(t?this.getPlugins(n):[this.getPlugins(n)[0]]).map((e=>{const t=C(e,n);if(!S(t)||i)return t;try{return t.apply(C(e,a),r)}catch(t){if(s)throw t;this.logger?.error(((e,t,r)=>`${e}${de}Failed to invoke the "${t}" extension point of plugin "${r}".`)(J,n,e.name),t)}return null}))}invokeSingle(e,...t){return this.invoke(e,!1,...t)[0]}invokeMultiple(e,...t){return this.invoke(e,!0,...t)}}({throws:!0},Ue),xt="The request failed",Ct=[xt],Rt=new class{constructor(e,t){this.logger=e,this.pluginEngine=t,this.errorBuffer=new Le,this.attachEffect()}attachEffect(){if(!0===It.reporting.isErrorReportingPluginLoaded.value)for(;this.errorBuffer.size()>0;)this.errorBuffer.dequeue()}attachErrorListeners(){"addEventListener"in globalThis?(globalThis.addEventListener("error",(e=>{this.onError(e,void 0,void 0,void 0,"unhandledException")})),globalThis.addEventListener("unhandledrejection",(e=>{this.onError(e,void 0,void 0,void 0,"unhandledPromiseRejection")}))):this.logger?.debug("Failed to attach global error listeners.")}init(e){if(this.pluginEngine)try{const t="errorReporting.init",r=this.pluginEngine.invokeSingle(t,It,this.pluginEngine,e,this.logger);r instanceof Promise&&r.then((e=>{this.errReportingClient=e})).catch((e=>{this.logger?.error(`${q}${de}Failed to initialize the error reporting plugin.`,e)}))}catch(e){this.onError(e,q)}}onError(e,t="",r="",n=!1,i="handled"){let s=(e=>{let t;try{if(E(e))t=e;else if(e instanceof Error)t=e.message;else if(e instanceof ErrorEvent)t=e.message;else if(e instanceof Event){const r=e.target;if(r&&"script"!==r.localName)return"";if(r?.dataset&&("RS_JS_SDK"!==r.dataset.loader||"true"!==r.dataset.isnonnativesdk))return"";t=`Error in loading a third-party script from URL ${r?.src} with ID ${r?.id}.`}else t=e.message?e.message:fe(e)}catch(e){t=`Unknown error: ${e.message}`}return t})(e);if(!s)return;s=`${t}${de}${r} ${s}`.replace(/ {2,}/g," ");let o=new Error(s);if(x(e)&&(o=Object.create(e,{message:{value:s}})),"handled"===i){if(this.notifyError(o),!this.logger)throw o;if(this.logger.error(s),n)throw o}It.reporting.isErrorReportingEnabled.value&&It.reporting.isErrorReportingPluginLoaded.value}leaveBreadcrumb(e){if(this.pluginEngine)try{this.pluginEngine.invokeSingle("errorReporting.breadcrumb",this.pluginEngine,this.errReportingClient,e,this.logger)}catch(e){this.onError(e,q,"errorReporting.breadcrumb")}}notifyError(e){if(this.pluginEngine&&(e=>!e.message||!Ct.some((t=>e.message.includes(t))))(e))try{this.pluginEngine.invokeSingle("errorReporting.notify",this.pluginEngine,this.errReportingClient,e,It,this.logger)}catch(e){this.logger?.error(`${q}${de}Failed to notify the error.`,e)}}}(Ue,Tt),Pt=e=>Boolean("cloud"!==e.config.connectionMode||!0===e.config.useNativeSDKToSend||!0===e.config.useNativeSDK),Ot=e=>e.filter(Pt),Bt=["BeaconQueue","Bugsnag","CustomConsentManager","DeviceModeDestinations","DeviceModeTransformation","ErrorReporting","ExternalAnonymousId","GoogleLinker","KetchConsentManager","NativeDestinationQueue","OneTrustConsentManager","StorageEncryption","StorageEncryptionLegacy","StorageMigrator","XhrQueue"],$t={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"}};function Dt(e,t){const r=Object.assign(e,t);for(const e of Object.keys(r))"object"==typeof r[e]&&"object"==typeof t[e]&&(r[e]=Dt(r[e],t[e]));return r}const Mt=e=>Dt({},(globalThis.__federation_shared__||{}).default||{});function Lt(e,t){if(!e?.default&&t){let t=Object.create(null);return t.default=e,t.__esModule=!0,t}return e}function jt(e,t){return async function(e){const t=$t[e];return t.inited?t.lib:"var"===t.format?new Promise((r=>(async(e,t)=>{const r="function"==typeof e?await e():e,n=document.createElement("script");n.type="text/javascript",n.onload=t,n.src=r,document.getElementsByTagName("head")[0].appendChild(n)})(t.url,(()=>{t.inited||(t.lib=window[e],t.lib.init(Mt(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((n=>{import(n).then((r=>{if(!t.inited){const e=Mt(t.from);r.init(e),t.lib=r,t.lib.init(e),t.inited=!0}e(t.lib)})).catch(r)}))})):void 0}(e).then((e=>e.get(t).then((e=>e()))))}const Nt=e=>(e=>{const t={};return e.forEach((e=>{if(Bt.includes(e)){const r=(e=>{switch(e){case"BeaconQueue":return()=>jt("rudderAnalyticsRemotePlugins","./BeaconQueue").then((e=>Lt(e,!0)));case"Bugsnag":return()=>jt("rudderAnalyticsRemotePlugins","./Bugsnag").then((e=>Lt(e,!0)));case"CustomConsentManager":return()=>jt("rudderAnalyticsRemotePlugins","./CustomConsentManager").then((e=>Lt(e,!0)));case"DeviceModeDestinations":return()=>jt("rudderAnalyticsRemotePlugins","./DeviceModeDestinations").then((e=>Lt(e,!0)));case"DeviceModeTransformation":return()=>jt("rudderAnalyticsRemotePlugins","./DeviceModeTransformation").then((e=>Lt(e,!0)));case"ErrorReporting":return()=>jt("rudderAnalyticsRemotePlugins","./ErrorReporting").then((e=>Lt(e,!0)));case"ExternalAnonymousId":return()=>jt("rudderAnalyticsRemotePlugins","./ExternalAnonymousId").then((e=>Lt(e,!0)));case"GoogleLinker":return()=>jt("rudderAnalyticsRemotePlugins","./GoogleLinker").then((e=>Lt(e,!0)));case"KetchConsentManager":return()=>jt("rudderAnalyticsRemotePlugins","./KetchConsentManager").then((e=>Lt(e,!0)));case"NativeDestinationQueue":return()=>jt("rudderAnalyticsRemotePlugins","./NativeDestinationQueue").then((e=>Lt(e,!0)));case"OneTrustConsentManager":return()=>jt("rudderAnalyticsRemotePlugins","./OneTrustConsentManager").then((e=>Lt(e,!0)));case"StorageEncryption":return()=>jt("rudderAnalyticsRemotePlugins","./StorageEncryption").then((e=>Lt(e,!0)));case"StorageEncryptionLegacy":return()=>jt("rudderAnalyticsRemotePlugins","./StorageEncryptionLegacy").then((e=>Lt(e,!0)));case"StorageMigrator":return()=>jt("rudderAnalyticsRemotePlugins","./StorageMigrator").then((e=>Lt(e,!0)));case"XhrQueue":return()=>jt("rudderAnalyticsRemotePlugins","./XhrQueue").then((e=>Lt(e,!0)));default:return}})(e);r&&(t[e]=r)}})),t})?.(e)||{},Ut={};class Ft{constructor(e,t,r){this.engine=e,this.errorHandler=t,this.logger=r,this.onError=this.onError.bind(this)}init(){It.lifecycle.status.value="pluginsLoading",le("pluginsCDNPath",It.lifecycle.pluginsCDNPath.value),this.setActivePlugins(),this.registerLocalPlugins(),this.registerRemotePlugins(),this.attachEffects()}attachEffects(){Me((()=>{(0===It.plugins.activePlugins.value.length||It.plugins.loadedPlugins.value.length+It.plugins.failedPlugins.value.length===It.plugins.totalPluginsToLoad.value)&&be((()=>{It.plugins.ready.value=!0,It.lifecycle.status.value="pluginsReady"}))}))}getPluginsToLoadBasedOnConfig(){let e=It.plugins.pluginsToLoadFromConfig.value;if(!e)return[];return[{configurationStatus:()=>I(It.dataPlaneEvents.eventsQueuePluginName.value),configurationStatusStr:"Data plane events delivery is enabled",activePluginName:It.dataPlaneEvents.eventsQueuePluginName.value,supportedPlugins:Object.values(at),shouldAddMissingPlugins:!0},{configurationStatus:()=>I(It.reporting.errorReportingProviderPluginName.value),configurationStatusStr:"Error reporting is enabled",activePluginName:It.reporting.errorReportingProviderPluginName.value,basePlugins:["ErrorReporting"],supportedPlugins:Object.values(st)},{configurationStatus:()=>Ot(It.nativeDestinations.configuredDestinations.value).length>0,configurationStatusStr:"Device mode destinations are connected to the source",supportedPlugins:["DeviceModeDestinations","NativeDestinationQueue"]},{configurationStatus:()=>Ot(It.nativeDestinations.configuredDestinations.value).some((e=>e.shouldApplyDeviceModeTransformation)),configurationStatusStr:"Device mode transformations are enabled for at least one destination",supportedPlugins:["DeviceModeTransformation"]},{configurationStatus:()=>I(It.consents.activeConsentManagerPluginName.value),configurationStatusStr:"Consent management is enabled",activePluginName:It.consents.activeConsentManagerPluginName.value,supportedPlugins:Object.values(it)},{configurationStatus:()=>I(It.storage.encryptionPluginName.value),configurationStatusStr:"Storage encryption is enabled",activePluginName:It.storage.encryptionPluginName.value,supportedPlugins:Object.values(ot)},{configurationStatus:()=>It.storage.migrate.value,configurationStatusStr:"Storage migration is enabled",supportedPlugins:["StorageMigrator"]}].forEach((t=>{t.configurationStatus()?(e=e.filter(t.activePluginName?e=>!(e!==t.activePluginName&&t.supportedPlugins.includes(e)):e=>I(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({}),...e]}addMissingPlugins(e,t,r){const n=e.shouldAddMissingPlugins||t;let i;i=e.activePluginName?[...e.basePlugins||[],e.activePluginName]:[...e.supportedPlugins];const s=i.filter((e=>!r.includes(e)));s.length>0&&(n&&r.push(...s),this.logger?.warn(((e,t,r,n)=>{const i=1===r.length,s=i?` '${r[0]}' plugin was`:` ['${r.join("', '")}'] plugins were`,o=`${e}${de}${t}, but${s} not configured to load.`;return n?`${o} So, ${i?"the plugin":"those plugins"} will be loaded automatically.`:`${o} Ignore if this was intentional. Otherwise, consider adding ${i?"it":"them"} to the 'plugins' load API option.`})(Q,e.configurationStatusStr,s,n)))}setActivePlugins(){const e=this.getPluginsToLoadBasedOnConfig(),t=[...Object.keys(Ut),...Bt],r=[],n=[];e.forEach((e=>{t.includes(e)?r.push(e):n.push(e)})),n.length>0&&this.onError(new Error(`Ignoring loading of unknown plugins: ${n.join(",")}. Mandatory plugins: ${Object.keys({}).join(",")}. Load option plugins: ${It.plugins.pluginsToLoadFromConfig.value.join(",")}`)),be((()=>{It.plugins.totalPluginsToLoad.value=e.length,It.plugins.activePlugins.value=r,It.plugins.failedPlugins.value=n}))}registerLocalPlugins(){Object.values(Ut).forEach((e=>{S(e)&&It.plugins.activePlugins.value.includes(e().name)&&this.register([e()])}))}registerRemotePlugins(){const e=(t=It.plugins.activePlugins.value,{...Nt(t)});var t;Promise.all(Object.keys(e).map((async t=>{await e[t]().then((e=>this.register([e.default()]))).catch((e=>{It.plugins.failedPlugins.value=[...It.plugins.failedPlugins.value,t],this.onError(e,t)}))}))).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,It)}catch(t){It.plugins.failedPlugins.value=[...It.plugins.failedPlugins.value,e.name],this.onError(t)}}))}unregisterLocalPlugins(){Object.values(Ut).forEach((e=>{try{this.engine.unregister(e().name)}catch(e){this.onError(e)}}))}onError(e,t){if(!this.errorHandler)throw e;this.errorHandler.onError(e,Q,t)}}const Ht=(e,t)=>{try{return JSON.parse(e||"")}catch(e){const r=pe(e,"Failed to parse response data");if(!S(t))throw r;t(r)}},Vt={headers:{Accept:"application/json","Content-Type":"application/json;charset=UTF-8"},method:"GET"},Kt=(e,t,r)=>{const n=B(Vt,t||{});return r&&(n.headers=B(n.headers,{Authorization:r})),n.url=e,n},Gt=(e,t=1e4,r)=>new Promise(((n,i)=>{let s;if(!0===e.sendRawData)s=e.data;else if(s=fe(e.data,!1,[],r),_(s))return void i({error:new Error("Failed to prepare data for the request."),undefined:void 0,options:e});const o=new XMLHttpRequest,a=t=>{i({error:new Error(Ke(xt,t,e.url)),xhr:o,options:e})};o.ontimeout=a,o.onerror=a,o.onload=()=>{var t,r,s,a;o.status>=200&&o.status<400?n({response:o.responseText,xhr:o,options:e}):i({error:new Error((t=xt,r=o.status,s=o.statusText,a=e.url,`${t} with status: ${r}, ${s} for URL: ${a}.`)),xhr:o,options:e})},o.open(e.method,e.url),!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(t){i({error:pe(t,(l=xt,u=e.url,`${l} for URL: ${u}`)),xhr:o,options:e})}var l,u}));class Qt{hasErrorHandler=!1;constructor(e,t){this.errorHandler=e,this.logger=t,this.hasErrorHandler=Boolean(this.errorHandler),this.onError=this.onError.bind(this)}async getData(e){const{url:t,options:r,timeout:n,isRawResponse:i}=e;try{const e=await Gt(Kt(t,r,this.basicAuthHeader),n,this.logger);return{data:i?e.response:Ht(e.response,this.onError),details:e}}catch(e){return this.onError(e.error??e),{data:void 0,details:e}}}getAsyncData(e){const{callback:t,url:r,options:n,timeout:i,isRawResponse:s}=e,o=!S(t);Gt(Kt(r,n,this.basicAuthHeader),i,this.logger).then((e=>{o||t(s?e.response:Ht(e.response,this.onError),e)})).catch((e=>{this.onError(e.error??e),o||t(void 0,e)}))}onError(e){if(!this.hasErrorHandler)throw e;this.errorHandler?.onError(e,"HttpClient")}setAuthHeader(e,t=!1){const r=t?e:(e=>(e=>{const t=Array.from(e,(e=>String.fromCodePoint(e))).join("");return globalThis.btoa(t)})((new TextEncoder).encode(e)))(`${e}:`);this.basicAuthHeader=`Basic ${r}`}resetAuthHeader(){this.basicAuthHeader=void 0}}const zt=new Qt(Rt,Ue),qt="cookieStorage",Jt="localStorage",Wt="sessionStorage",Xt="memoryStorage",Zt="none",Yt="clientDataInCookie",er="clientDataInLocalStorage",tr="clientDataInSessionStorage",rr=["userId","userTraits","anonymousId","groupId","groupTraits","initialReferrer","initialReferringDomain","sessionInfo","authToken"],nr={[qt]:Yt,[Jt]:er,[Xt]:"clientDataInMemory",[Wt]:tr},ir=()=>!A(globalThis.navigator.userAgentData),sr={URL:()=>!S(globalThis.URL)||!S(globalThis.URLSearchParams),Promise:()=>!S(globalThis.Promise),"Number.isNaN":()=>!S(globalThis.Number.isNaN),"Number.isInteger":()=>!S(globalThis.Number.isInteger),"Array.from":()=>!S(globalThis.Array.from),"Array.prototype.find":()=>!S(globalThis.Array.prototype.find),"Array.prototype.includes":()=>!S(globalThis.Array.prototype.includes),"String.prototype.endsWith":()=>!S(globalThis.String.prototype.endsWith),"String.prototype.startsWith":()=>!S(globalThis.String.prototype.startsWith),"String.prototype.includes":()=>!S(globalThis.String.prototype.includes),"String.prototype.replaceAll":()=>!S(globalThis.String.prototype.replaceAll),"String.fromCodePoint":()=>!S(globalThis.String.fromCodePoint),"Object.entries":()=>!S(globalThis.Object.entries),"Object.values":()=>!S(globalThis.Object.values),"Object.assign":()=>!S(globalThis.Object.assign),"Object.fromEntries":()=>!S(globalThis.Object.fromEntries),"Element.prototype.dataset":()=>!(()=>{const e=globalThis.document.createElement("div");return e.setAttribute("data-a-b","c"),!!e.dataset&&"c"===e.dataset.aB})(),TextEncoder:()=>!S(globalThis.TextEncoder)||!S(globalThis.TextDecoder),requestAnimationFrame:()=>!S(globalThis.requestAnimationFrame)||!S(globalThis.cancelAnimationFrame),CustomEvent:()=>!S(globalThis.CustomEvent),"navigator.sendBeacon":()=>!S(globalThis.navigator.sendBeacon),ArrayBuffer:()=>!S(globalThis.Uint8Array),Set:()=>!S(globalThis.Set)},or=()=>{let e={density:0,width:0,height:0,innerWidth:0,innerHeight:0};return e={width:globalThis.screen.width,height:globalThis.screen.height,density:globalThis.devicePixelRatio,innerWidth:globalThis.innerWidth,innerHeight:globalThis.innerHeight},e},ar=e=>{const t=["QuotaExceededError","NS_ERROR_DOM_QUOTA_REACHED"].includes(e.name)||[22,1014].includes(e.code);return e instanceof DOMException&&t},lr=(e=Jt,t,r)=>{let n,i;try{switch(e){case Xt:return!0;case qt:n=t,i="test_rudder_cookie";break;case Jt:n=t??globalThis.localStorage,i="test_rudder_ls";break;case Wt:n=t??globalThis.sessionStorage,i="test_rudder_ss";break;default:return!1}return!!n&&(n.setItem(i,"true"),!!n.getItem(i)&&(n.removeItem(i),!0))}catch(t){const n=`${V}${de}The "${e}" storage type is `;let i="unavailable";return ar(t)&&(i="full"),r?.warn(`${n}${i}.`,t),!1}},ur=(e,t)=>{try{return encodeURIComponent(e)}catch(e){return void t?.error("Failed to encode the cookie data.",e)}},cr=e=>{try{return decodeURIComponent(e)}catch(e){return}},dr=()=>(e=>{const t={},r=e.split(/\s*;\s*/);let n;return r[0]?(r.forEach((e=>{n=e.split("=");const r=n[0]?cr(n[0]):void 0;r&&(t[r]=n[1]?cr(n[1]):void 0)})),t):t})(globalThis.document.cookie),hr=function(e,t,r,n){switch(arguments.length){case 4:case 3:case 2:return((e,t,r,n)=>{const i={...r}||{};let s=`${ur(e,n)}=${ur(t,n)}`;_(t)&&(i.maxage=-1),i.maxage&&(i.expires=new Date(+new Date+i.maxage)),i.path&&(s+=`; path=${i.path}`),i.domain&&(s+=`; domain=${i.domain}`),i.expires&&(s+=`; expires=${i.expires.toUTCString()}`),i.samesite&&(s+=`; samesite=${i.samesite}`),i.secure&&(s+="; secure"),globalThis.document.cookie=s})(e,t,r,n);case 1:return e?(e=>dr()[e])(e):dr();default:return dr()}},gr=()=>{const e=`.${(e=>{const t=(e=>{const t="function"!=typeof globalThis.URL?(e=>{const t=document.createElement("a");return t.href=e,t.hostname})(e):new URL(e).hostname,r=t?.split(".")??[],n=r[r.length-1],i=[];if(4===r.length&&n&&n===parseInt(n,10).toString())return i;if(r.length<=1)return r[0]&&-1!==r[0].indexOf("localhost")?["localhost"]:i;for(let e=r.length-2;e>=0;e-=1)i.push(r.slice(e).join("."));return i})(globalThis.location.href);for(let e=0;e<t.length;e+=1){const r=t[e],n="__tld__",i={domain:`${-1!==r.indexOf("localhost")?"":"."}${r}`};if(hr(n,1,i),hr(n))return hr(n,null,i),r}return""})()}`;return{maxage:31536e6,path:"/",domain:e&&"."!==e?e:void 0,samesite:"Lax",enabled:!0}};class fr{static globalSingleton=null;isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e={},t){if(fr.globalSingleton)return fr.globalSingleton;this.options=gr(),this.logger=t,this.configure(e),fr.globalSingleton=this}configure(e){return this.options=B(this.options??{},e),e.sameDomainCookiesOnly&&delete this.options.domain,this.isSupportAvailable=lr(qt,this,this.logger),this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){return hr(e,t,this.options,this.logger),this.length=Object.keys(hr()).length,!0}getItem(e){const t=hr(e);return w(t)?null:t}removeItem(e){const t=this.setItem(e,null);return this.length=Object.keys(hr()).length,t}clear(){}key(e){return this.keys()[e]??null}keys(){return Object.keys(hr())}}const pr=new class{isEnabled=!0;length=0;data={};constructor(e,t){this.options={enabled:!0},this.logger=t,this.configure(e??{})}configure(e){return this.options=B(this.options,e),this.isEnabled=Boolean(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)}}({},Ue);function vr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self&&self;var yr={exports:{}};!function(e,t){e.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 n=function(e){var t="_Is_Incognit";try{e||(e=window.localStorage),e.setItem(t,"yes"),e.removeItem(t)}catch(t){var r={_data:{},setItem:function(e,t){return r._data[e]=String(t)},getItem:function(e){return r._data.hasOwnProperty(e)?r._data[e]:void 0},removeItem:function(e){return delete r._data[e]},clear:function(){return r._data={}}};e=r}finally{"yes"===e.getItem(t)&&e.removeItem(t)}return e}();function i(){if(!(this instanceof i))return new i}i.prototype={set:function(t,r){if(t&&!e(t))n.setItem(t,function(e){return void 0===e||"function"==typeof e?e+"":JSON.stringify(e)}(r));else if(e(t))for(var i in t)this.set(i,t[i]);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 i=arguments;if(i.length>1){for(var s={},o=0,a=i.length;o<a;o++){var l=t(n.getItem(i[o]));this.has(i[o])&&(s[i[o]]=l)}return s}return t(n.getItem(e))},clear:function(){return n.clear(),this},remove:function(e){var t=this.get(e);return n.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=n.length;t<r;t++){var i=n.key(t);e(i,this.get(i))}return this},search:function(e){for(var t=this.keys(),r={},n=0,i=t.length;n<i;n++)t[n].indexOf(e)>-1&&(r[t[n]]=this.get(t[n]));return r},len:function(){return n.length}};var s=null;function o(t,n){var a,l=arguments,u=null;if(s||(s=i()),0===l.length)return s.get();if(1===l.length){if("string"==typeof t)return s.get(t);if(e(t))return s.set(t)}if(2===l.length&&"string"==typeof t){if(!n)return s.remove(t);if(n&&"string"==typeof n)return s.set(t,n);n&&r(n)&&(u=null,u=n(t,s.get(t)),o.set(t,u))}if(2===l.length&&(a=t,"[object Array]"===Object.prototype.toString.call(a))&&r(n))for(var c=0,d=t.length;c<d;c++)u=n(t[c],s.get(t[c])),o.set(t[c],u);return o}for(var a in i.prototype)o[a]=i.prototype[a];return o}()}(yr);const mr=vr(yr.exports),br=new class{isSupportAvailable=!0;isEnabled=!0;length=0;constructor(e={},t){this.options={enabled:!0},this.logger=t,this.configure(e)}configure(e){return this.options=B(this.options,e),this.isSupportAvailable=lr(Jt,this,this.logger),this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){mr.set(e,t),this.length=mr.len()}getItem(e){const t=mr.get(e);return w(t)?null:t}removeItem(e){mr.remove(e),this.length=mr.len()}clear(){mr.clear(),this.length=0}key(e){return this.keys()[e]??null}keys(){return mr.keys()}}({},Ue),kr=new class{isSupportAvailable=!0;isEnabled=!0;length=0;store=globalThis.sessionStorage;constructor(e={},t){this.options={enabled:!0},this.logger=t,this.configure(e)}configure(e){return this.options=B(this.options,e),this.isSupportAvailable=lr(Wt,this,this.logger),this.isEnabled=Boolean(this.options.enabled&&this.isSupportAvailable),this.options}setItem(e,t){this.store.setItem(e,t),this.length=this.store.length}getItem(e){const t=this.store.getItem(e);return w(t)?null:t}removeItem(e){this.store.removeItem(e),this.length=this.store.length}clear(){this.store.clear(),this.length=0}key(e){return this.store.key(e)}keys(){const e=[];for(let t=0;t<this.store.length;t+=1){const r=this.store.key(t);null!==r&&e.push(r)}return e}}({},Ue),Sr=e=>{switch(e){case Jt:return br;case Wt:return kr;case Xt:return pr;case qt:return new fr({},Ue);default:return pr}};class Er{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??Sr(Jt),this.noKeyValidation=0===Object.keys(this.validKeys).length,this.noCompoundKey=e.noCompoundKey,this.originalEngine=this.engine,this.errorHandler=e.errorHandler??Rt,this.hasErrorHandler=Boolean(this.errorHandler),this.logger=e.logger??Ue,this.pluginsManager=r}createValidKey(e){const{name:t,id:r,validKeys:n,noKeyValidation:i,noCompoundKey:s}=this;if(i)return s?e:[t,r,e].join(".");let o;return Object.values(n).forEach((n=>{n===e&&(o=s?e:[t,r,e].join("."))})),o}swapQueueStoreToInMemoryEngine(){const{name:e,id:t,validKeys:r,noCompoundKey:n}=this,i=Sr(Xt);Object.keys(r).forEach((s=>{const o=this.get(r[s]),a=n?s:[e,t,s].join(".");i.setItem(a,o),this.remove(s)})),this.engine=i}set(e,t){const r=this.createValidKey(e);if(r)try{this.engine.setItem(r,this.encrypt(fe(t,!1,[],this.logger)))}catch(r){ar(r)?(this.logger?.warn(`Store ${this.id}${de}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)):this.onError(pe(r,(e=>`Failed to save the value for "${e}" to storage`)(e)))}}get(e){const t=this.createValidKey(e);try{if(!t)return null;const e=this.decrypt(this.engine.getItem(t));return A(e)?null:JSON.parse(e)}catch(t){return this.onError(new Error(`${(e=>`Failed to retrieve or parse data for "${e}" from storage`)(e)}: ${t.message}`)),null}}remove(e){const t=this.createValidKey(e);t&&this.engine.removeItem(t)}getOriginalEngine(){return this.originalEngine}decrypt(e){return A(e)?null:this.crypto(e,"decrypt")}encrypt(e){return this.crypto(e,"encrypt")}crypto(e,t){const r=!this.isEncrypted||!e||"string"!=typeof e||""===(e=>e.replace(/^\s+|\s+$/gm,""))(e);if(r)return e;const n=`storage.${t}`,i=this.pluginsManager?this.pluginsManager.invokeSingle(n,e):e;return void 0===i?e:i??""}onError(e){if(!this.hasErrorHandler)throw e;this.errorHandler?.onError(e,`Store ${this.id}`)}}class _r{stores={};isInitialized=!1;hasErrorHandler=!1;constructor(e,t,r){this.errorHandler=t,this.logger=r,this.hasErrorHandler=Boolean(this.errorHandler),this.pluginsManager=e,this.onError=this.onError.bind(this)}init(){if(this.isInitialized)return;const e=It.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={},n={})=>{var i;(e=>{const t=new fr({},Ue).configure(e);It.storage.cookie.value={maxage:t.maxage,path:t.path,domain:t.domain,samesite:t.samesite,expires:t.expires,secure:t.secure}})(e),i=t,br.configure(i),(e=>{pr.configure(e)})(r),(e=>{kr.configure(e)})(n)})(D(B(t.cookieStorageOptions??{},It.storage.cookie?.value??{})),D(t.localStorageOptions),D(t.inMemoryStorageOptions),D(t.sessionStorageOptions)),this.initClientDataStores(),this.isInitialized=!0}initClientDataStores(){this.initializeStorageState(),[Xt,Jt,qt,Wt].forEach((e=>{Sr(e)?.isEnabled&&this.setStore({id:nr[e],name:nr[e],isEncrypted:!0,noCompoundKey:!0,type:e})}))}initializeStorageState(){let e=It.storage.type.value,t=It.loadOptions.value.storage?.entries;const r=It.consents.postConsent.value.storage;(I(r?.type)||I(r?.entries))&&(e=r?.type,t=r?.entries);let n=!0,i={};rr.forEach((r=>{const s=r,o=r,a=t?.[s]?.type,l=((e,t)=>{let r;if(e.consents.preConsent.value.enabled)switch(e.consents.preConsent.value.storage?.strategy){case"none":r=Zt;break;case"session":"sessionInfo"!==t&&(r=Zt);break;case"anonymousId":"anonymousId"!==t&&(r=Zt)}return r})(It,r),u=l??a??e??He,c=this.getResolvedStorageTypeForEntry(u,r);c!==Zt&&(n=!1),i={...i,[r]:{type:c,key:ut[o]}}})),be((()=>{It.storage.type.value=e,It.storage.entries.value=i,It.storage.trulyAnonymousTracking.value=n}))}getResolvedStorageTypeForEntry(e,t){let r=e;switch(e){case Jt:Sr(Jt)?.isEnabled||(r=Xt);break;case Wt:Sr(Wt)?.isEnabled||(r=Xt);break;case Xt:case Zt:break;default:r=Sr(qt)?.isEnabled?qt:Sr(Jt)?.isEnabled?Jt:Sr(Wt)?.isEnabled?Wt:Xt}return r!==e&&this.logger?.warn(((e,t,r,n)=>`${e}${de}The storage type "${r}" is not available for entry "${t}". The SDK will initialize the entry with "${n}" storage type instead.`)(W,t,e,r)),r}setStore(e){const t=Sr(e.type);return this.stores[e.id]=new Er(e,t,this.pluginsManager),this.stores[e.id]}getStore(e){return this.stores[e]}onError(e){if(!this.hasErrorHandler)throw e;this.errorHandler?.onError(e,W)}}const wr=e=>{if(!E(e))return!1;try{return S(globalThis.URL)&&new URL(e),qe.test(e)}catch(e){return!1}},Ar=e=>e?.endsWith("/")?Ar(e.substring(0,e.length-1)):e,Ir=e=>{try{return new URL(e).host}catch(e){return null}},Tr=e=>Ir(e)??"",xr=e=>{const t={};try{const r=new URL(e),n="utm_";r.searchParams.forEach(((e,r)=>{if(r.startsWith(n)){let i=r.substring(n.length);"campaign"===i&&(i="name"),t[i]=e}}))}catch(e){}return t},Cr="US",Rr=(e,t,r,n)=>{if(e&&Object.keys(e).length>0){const t=(e=>{if(Array.isArray(e)&&e.length>0){const t=e.find((e=>!0===e.default));if(t&&wr(t.url))return t.url}})(e[((e,t)=>{if(!e||["US","EU"].includes(e))return e;t?.warn(`${K}${de}The residency server region "${e}" is not supported. Please choose one of the following supported regions: "US, EU". The default region "${Cr}" will be used instead.`)})(r,n)??Cr]||e[Cr]);if(t)return t}if(t)return t},Pr="none",Or="immediate",Br={All:!0},$r=e=>$(e)||Array.isArray(e),Dr=(e,t)=>{let r,n,i=[],s=[],o=!1,a=!0===e?.enabled;$(e)&&a&&(({provider:n,consentManagerPluginName:r}=((e,t)=>{let{provider:r}=e;const n=r?it[r]:void 0;var i;return r&&!n&&(t?.error((i=it,`${K}${de}The consent manager "${r}" is not supported. Please choose one of the following supported consent managers: "${Object.keys(i)}".`)),r=void 0),{provider:r,consentManagerPluginName:n}})(e,t)),$r(e.allowedConsentIds)&&(i=e.allowedConsentIds,o=!0),$r(e.deniedConsentIds)&&(s=e.deniedConsentIds,o=!0));const l={allowedConsentIds:i,deniedConsentIds:s};return a=a&&Boolean(r),{provider:n,consentManagerPluginName:r,initialized:o,enabled:a,consentsData:l}},Mr=()=>{const e=document.getElementsByTagName("script"),t=/(?:^|\/)rsa(\.min)?\.js$/;for(const r of e){const e=r.getAttribute("src");if(e&&t.test(e))return e}},Lr=e=>{const{useServerSideCookies:t,dataServiceEndpoint:r,storage:n}=It.loadOptions.value;let i=n?.type;I(i)&&!(e=>"string"==typeof e&&Fe.includes(e))(i)&&(e?.warn(((e,t,r)=>`${e}${de}The storage type "${t}" is not supported. Please choose one of the following supported types: "${Fe}". The default type "${r}" will be used instead.`)(K,i,He)),i=He);let s=n?.encryption?.version;const o=s&&ot[s];var a,l;!w(s)&&w(o)?(e?.warn((a=ot,l=rt,`${K}${de}The storage encryption version "${s}" is not supported. Please choose one of the following supported versions: "${Object.keys(a)}". The default version "${l}" will be used instead.`)),s=rt):w(s)&&(s=rt);const u=n?.migrate,c=u&&s===rt;!0===u&&c!==u&&e?.warn(((e,t,r)=>`${e}${de}The storage data migration has been disabled because the configured storage encryption version (${t}) is not the latest (${r}). To enable storage data migration, please update the storage encryption version to the latest version.`)(K,s,rt)),be((()=>{It.storage.type.value=i;let e=n?.cookie??{};if(t){It.serverCookies.isEnabledServerSideCookies.value=t;const n=(o=r??"rsaRequest",`${(e=>{const t=new URL(e),{host:r,protocol:n}=t,i=r.split(".");let s;return s=i.length>2?`${i[i.length-2]}.${i[i.length-1]}`:r,`${n}//${s}`})(window.location.href)}/${o.startsWith("/")?o.substring(1):o}`);wr(n)?(It.serverCookies.dataServiceUrl.value=Ar(n),Ir(window.location.href)!==Ir(n)&&(e={...e,samesite:"None",secure:!0})):It.serverCookies.isEnabledServerSideCookies.value=!1}var o;It.storage.cookie.value=e,It.storage.encryptionPluginName.value=ot[s],It.storage.migrate.value=c}))};class jr{hasErrorHandler=!1;constructor(e,t,r){this.errorHandler=t,this.logger=r,this.httpClient=e,this.hasErrorHandler=Boolean(this.errorHandler),this.onError=this.onError.bind(this),this.processConfig=this.processConfig.bind(this)}attachEffects(){Me((()=>{this.logger?.setMinLogLevel(It.lifecycle.logLevel.value)}))}init(){var e,t;this.attachEffects(),e=It.lifecycle.writeKey.value,t=It.lifecycle.dataPlaneUrl.value,(e=>{if(!E(e)||0===e.trim().length)throw new Error((e=>`The write key "${e}" is invalid. It must be a non-empty string. Please check that the write key is correct and try again.`)(e))})(e),(e=>{if(!wr(e))throw new Error((e=>`The data plane URL "${e}" is invalid. It must be a valid URL string. Please check that the data plane URL is correct and try again.`)(e))})(t);const r=It.loadOptions.value.lockIntegrationsVersion,n=((e,t,r)=>{let n="";if(r){if(n=Ar(r),!n||!wr(n))throw new Error("Failed to load the SDK as the CDN base URL for integrations is not valid.");return n}const i=Mr();return n=i?i.split("/").slice(0,-1).concat(Qe).join("/"):Ze,t&&(n=n.replace(Xe,e)),n})(ee,r,It.loadOptions.value.destSDKBaseURL),i=(e=>{let t="";if(e){if(t=Ar(e),!t||!wr(t))throw new Error("Failed to load the SDK as the CDN base URL for plugins is not valid.");return t}const r=Mr();return t=r?r.split("/").slice(0,-1).concat(ze).join("/"):Ye,t})(It.loadOptions.value.pluginsSDKBaseURL);Lr(this.logger),(e=>{const{provider:t,consentManagerPluginName:r,initialized:n,enabled:i,consentsData:s}=Dr(It.loadOptions.value.consentManagement,e),o=It.loadOptions.value.preConsent;let a=o?.storage?.strategy??Pr;var l,u;I(a)&&!["none","session","anonymousId"].includes(a)&&(a=Pr,e?.warn((l=K,u=o?.storage?.strategy,`${l}${de}The pre-consent storage strategy "${u}" is not supported. Please choose one of the following supported strategies: "none, session, anonymousId". The default strategy "${Pr}" will be used instead.`)));let c=o?.events?.delivery??Or;I(c)&&!["immediate","buffer"].includes(c)&&(c=Or,e?.warn(((e,t,r)=>`${e}${de}The pre-consent events delivery type "${t}" is not supported. Please choose one of the following supported types: "immediate, buffer". The default type "${r}" will be used instead.`)(K,o?.events?.delivery,Or))),be((()=>{It.consents.activeConsentManagerPluginName.value=r,It.consents.initialized.value=n,It.consents.enabled.value=i,It.consents.data.value=s,It.consents.provider.value=t,It.consents.preConsent.value={enabled:!0===It.loadOptions.value.preConsent?.enabled&&!1===n&&!0===i,storage:{strategy:a},events:{delivery:c}}}))})(this.logger),(e=>{if(It.dataPlaneEvents.deliveryEnabled.value){const t="XhrQueue";let r=t;It.loadOptions.value.useBeacon&&(It.capabilities.isBeaconAvailable.value?r="BeaconQueue":(r=t,e?.warn(`${K}${de}The Beacon API is not supported by your browser. The events will be sent using XHR instead.`))),be((()=>{It.dataPlaneEvents.eventsQueuePluginName.value=r}))}})(this.logger);const{logLevel:s,configUrl:o}=It.loadOptions.value;be((()=>{It.lifecycle.integrationsCDNPath.value=n,It.lifecycle.pluginsCDNPath.value=i,s&&(It.lifecycle.logLevel.value=s),It.lifecycle.sourceConfigUrl.value=((e,t,r,n)=>{const i=new URLSearchParams({p:"npm",v:ee,build:Je,writeKey:t,lockIntegrationsVersion:r.toString()});let s=et,o=i,a="/sourceConfig/",l="";if(wr(e)){const t=new URL(e);Ar(t.pathname).endsWith("/sourceConfig")||(t.pathname=`${Ar(t.pathname)}/sourceConfig/`),t.pathname=t.pathname.replace(/\/{2,}/g,"/"),i.forEach(((e,r)=>{null===t.searchParams.get(r)&&t.searchParams.set(r,e)})),s=t.origin,a=t.pathname,o=t.searchParams,l=t.hash}else n?.warn(((e,t)=>`${e}${de}The provided source config URL "${t}" is invalid. Using the default source config URL instead.`)(K,e));return`${s}${a}?${o}${l}`})(o,It.lifecycle.writeKey.value,r,this.logger)})),this.getConfig()}onError(e,t,r){if(!this.hasErrorHandler)throw e;this.errorHandler?.onError(e,K,t,r)}processConfig(e,t){if(!e)return void this.onError((r=t?.error,`Failed to fetch the source config. Reason: ${r}`));var r;let n;try{n=E(e)?JSON.parse(e):e}catch(e){return void this.onError(e,Ve,!0)}if(!(e=>P(e)&&P(e.source)&&!A(e.source.id)&&P(e.source.config)&&Array.isArray(e.source.destinations))(n))return void this.onError(new Error(Ve),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.");((e,t)=>{var r,n,i;if(It.reporting.isErrorReportingEnabled.value=(r=e.source.config,!(!0!==r?.statsCollection?.errors?.enabled||window.chrome&&window.chrome.runtime&&window.chrome.runtime.id)),It.reporting.isMetricsReportingEnabled.value=(e=>!0===e?.statsCollection?.metrics?.enabled)(e.source.config),It.reporting.isErrorReportingEnabled.value){const r=(e=>e?.statsCollection?.errors?.provider)(e.source.config),s=r?st[r]:void 0;w(r)||s||t?.warn((n=st,i=tt,`${K}${de}The error reporting provider "${r}" is not supported. Please choose one of the following supported providers: "${Object.keys(n)}". The default provider "${i}" will be used instead.`)),It.reporting.errorReportingProviderPluginName.value=s??st[tt]}})(n,this.logger);const i=Rr(n.source.dataplanes,It.lifecycle.dataPlaneUrl.value,It.loadOptions.value.residencyServer,this.logger);if(!i)return void this.onError(new Error("Failed to load the SDK as the data plane URL could not be determined. Please check that the data plane URL is set correctly and try again."),void 0,!0);const s=n.source.destinations.length>0?(e=>{const t=[];return e.forEach((e=>{e.enabled&&!e.deleted&&t.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}`})})),t})(n.source.destinations):[];be((()=>{It.source.value={config:n.source.config,id:n.source.id,workspaceId:n.source.workspaceId},It.nativeDestinations.configuredDestinations.value=s,It.plugins.pluginsToLoadFromConfig.value=It.loadOptions.value.plugins??[],(e=>{let t,r=It.consents.resolutionStrategy.value;P(e.consentManagementMetadata)&&(It.consents.provider.value&&(r=e.consentManagementMetadata.providers.find((e=>e.provider===It.consents.provider.value))?.resolutionStrategy??It.consents.resolutionStrategy.value),t=e.consentManagementMetadata),"custom"===It.consents.provider.value&&(r=void 0),be((()=>{It.consents.metadata.value=f(t),It.consents.resolutionStrategy.value=r}))})(n),It.lifecycle.activeDataplaneUrl.value=Ar(i),It.lifecycle.status.value="configured"}))}getConfig(){const e=It.loadOptions.value.getSourceConfig;if(e){if(!S(e))throw new Error('"getSourceConfig" must be a function. Please make sure that it is defined and returns a valid source configuration object.');const 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:It.lifecycle.sourceConfigUrl.value,options:{headers:{"Content-Type":void 0}},callback:this.processConfig})}}const Nr=()=>document?.referrer||"$direct",Ur=()=>{const e=(()=>{const e=document.getElementsByTagName("link");let t="";for(let r=0;e[r];r+=1){const n=e[r];if("canonical"===n.getAttribute("rel")&&!t){t=n.getAttribute("href")??"";break}}return t})();let t=globalThis.location.pathname;const{href:r}=globalThis.location;let n=r;const{search:i}=globalThis.location;if(e)try{const r=new URL(e);n=""===r.search?e+i:e,t=r.pathname}catch(e){}const s=(e=>{let t=e;try{const r=new URL(e);t=r.origin+r.pathname+r.search}catch(e){}return t})(n),{title:o}=document,a=Nr();return{path:t,referrer:a,referring_domain:Tr(a),search:i,title:o,url:s,tab_url:r}},Fr=`https://polyfill-fastly.io/v3/polyfill.min.js?version=3.111.0&features=${Object.keys(sr).join("%2C")}`,Hr="rudderstackPolyfill";class Vr{constructor(e,t){this.logger=t,this.errorHandler=e,this.externalSrcLoader=new ve(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(){be((()=>{It.capabilities.storage.isCookieStorageAvailable.value=lr(qt,Sr(qt),this.logger),It.capabilities.storage.isLocalStorageAvailable.value=lr(Jt,void 0,this.logger),It.capabilities.storage.isSessionStorageAvailable.value=lr(Wt,void 0,this.logger),It.capabilities.isBeaconAvailable.value=!A(globalThis.navigator.sendBeacon)&&S(globalThis.navigator.sendBeacon),It.capabilities.isUaCHAvailable.value=ir(),It.capabilities.isCryptoAvailable.value=!A(globalThis.crypto)&&S(globalThis.crypto.getRandomValues),It.capabilities.isIE11.value=Boolean(globalThis.navigator.userAgent.match(/Trident.*rv:11\./)),It.capabilities.isOnline.value=globalThis.navigator.onLine,It.context.userAgent.value=(()=>{if(w(globalThis.navigator))return null;let{userAgent:e}=globalThis.navigator;const{brave:t}=globalThis.navigator;if(t&&Object.getPrototypeOf(t).isBrave){const t=e.match(/(chrome)\/([\w.]+)/i);t&&(e=`${e} Brave/${t[2]}`)}return e})(),It.context.locale.value=w(globalThis.navigator)?null:globalThis.navigator.language??globalThis.navigator.browserLanguage,It.context.screen.value=or(),It.context.timezone.value=(()=>{const e=(new Date).toString().match(/([A-Z]+[+-]\d+)/);return e&&e[1]?e[1]:"NA"})(),ir()&&((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=>{It.context["ua-ch"].value=e}),It.loadOptions.value.uaChTrackLevel)})),Me((()=>{!0===It.loadOptions.value.sendAdblockPage&&void 0!==It.lifecycle.sourceConfigUrl.value&&((e,t)=>{const r=new URL(It.lifecycle.sourceConfigUrl.value),n=`${r.origin}${r.pathname}?view=ad`,i=new Qt(e,t);i.setAuthHeader(It.lifecycle.writeKey.value),i.getAsyncData({url:n,options:{method:"HEAD",headers:{"Content-Type":void 0}},isRawResponse:!0,callback:(e,t)=>{It.capabilities.isAdBlocked.value=void 0!==t?.error||t?.xhr?.responseURL!==n}})})(this.errorHandler,this.logger)}))}prepareBrowserCapabilities(){It.capabilities.isLegacyDOM.value=(()=>{const e=Object.keys(sr);let t=!1;for(let r=0;r<e.length;r++){const n=sr[e[r]];if(S(n)&&n()){t=!0;break}}return t})();const e=It.loadOptions.value.polyfillURL;let t=Fr;if(T(e)&&(wr(e)?t=e:this.logger?.warn(((e,t)=>`${e}${de}The provided polyfill URL "${t}" is invalid. The default polyfill URL will be used instead.`)(V,e))),It.loadOptions.value.polyfillIfRequired&&It.capabilities.isLegacyDOM.value&&wr(t)){const e=t!==It.loadOptions.value.polyfillURL;if(e){const e=`RS_polyfillCallback_${It.lifecycle.writeKey.value}`,r=()=>{this.onReady(),delete globalThis[e]};globalThis[e]=r,t=`${t}&callback=${e}`}this.externalSrcLoader.loadJSFile({url:t,id:Hr,async:!0,timeout:1e4,callback:r=>{r?e||this.onReady():this.onError(new Error(((e,t)=>`Failed to load the polyfill script with ID "${e}" from URL ${t}.`)(Hr,t)))}})}else this.onReady()}attachWindowListeners(){globalThis.addEventListener("offline",(()=>{It.capabilities.isOnline.value=!1})),globalThis.addEventListener("online",(()=>{It.capabilities.isOnline.value=!0})),globalThis.addEventListener("resize",function(e,t,r=250){let n;return(...i)=>{globalThis.clearTimeout(n),n=globalThis.setTimeout((()=>{e.apply(t,i)}),r)}}((()=>{It.context.screen.value=or()}),this))}onReady(){this.detectBrowserCapabilities(),It.lifecycle.status.value="browserCapabilitiesReady"}onError(e){if(!this.errorHandler)throw e;this.errorHandler.onError(e,V)}}for(var Kr,Gr=[],Qr=0;Qr<256;Qr++)Gr[Qr]=(Qr+256).toString(16).substring(1);for(var zr,qr=256,Jr=[];qr--;)Jr[qr]=(qr+256).toString(16).substring(1);const Wr=()=>!A(globalThis.crypto)&&S(globalThis.crypto.getRandomValues)?function(){(!Kr||Qr+16>4096)&&(Kr=crypto.getRandomValues(new Uint8Array(4096)),Qr=0);for(var e,t=0,r="";t<16;t++)e=Kr[Qr+t],r+=6==t?Gr[15&e|64]:8==t?Gr[63&e|128]:Gr[e],1&t&&t>1&&t<11&&(r+="-");return Qr+=16,r}():function(){var e,t=0,r="";if(!zr||qr+16>256){for(zr=Array(t=256);t--;)zr[t]=256*Math.random()|0;t=qr=0}for(;t<16;t++)e=zr[qr+t],r+=6==t?Jr[15&e|64]:8==t?Jr[63&e|128]:Jr[e],1&t&&t>1&&t<11&&(r+="-");return qr++,r}(),Xr=["integrations","anonymousId","originalTimestamp"],Zr=["library","consentManagement","userAgent","ua-ch","screen"],Yr=["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"],en=e=>"number"==typeof e&&!Number.isNaN(e),tn=e=>en(e)&&e>=0&&Number.isInteger(e),rn=e=>{const t=Date.now();return Boolean(!e||t>e)},nn=(e,t)=>{return!!(e&&tn(e)&&(r=e,r.toString().length>=10))||(t?.warn(((e,t,r)=>`${e}${de}The provided session ID (${t}) is either invalid, not a positive integer, or not at least "10" digits long. A new session ID will be auto-generated instead.`)(z,e)),!1);var r},sn=e=>Boolean(e===qt||e===Jt||e===Wt||e===Xt),on=()=>Wr(),an=e=>{const t=Ur(),r={};return Object.keys(t).forEach((n=>{r[n]=e?.[n]||t[n]})),r.initial_referrer=e?.initial_referrer||It.session.initialReferrer.value,r.initial_referring_domain=e?.initial_referring_domain||It.session.initialReferringDomain.value,r},ln=(e,t,r)=>{P(e)&&Object.keys(e).forEach((e=>{(Yr.includes(e)||Yr.includes(e.toLowerCase()))&&r?.warn(((e,t,r,n)=>`${e}${de}The "${t}" property defined under "${r}" is a reserved keyword. Please choose a different property name to avoid conflicts with reserved keywords (${n}).`)(G,e,t,Yr))}))},un=(e,t,r,n)=>{const i={channel:"web",context:{traits:f(It.session.userTraits.value),sessionId:It.session.sessionInfo.value.id||void 0,sessionStart:It.session.sessionInfo.value.sessionStart||void 0,...It.consents.enabled.value&&{consentManagement:{deniedConsentIds:f(It.consents.data.value.deniedConsentIds),allowedConsentIds:f(It.consents.data.value.allowedConsentIds),provider:It.consents.provider.value,resolutionStrategy:It.consents.resolutionStrategy.value}},"ua-ch":It.context["ua-ch"].value,app:It.context.app.value,library:It.context.library.value,userAgent:It.context.userAgent.value,os:It.context.os.value,locale:It.context.locale.value,screen:It.context.screen.value,campaign:xr(globalThis.location.href),page:an(r),timezone:It.context.timezone.value},originalTimestamp:(new Date).toISOString(),integrations:Br,messageId:Wr(),userId:e.userId||It.session.userId.value};sn(It.storage.entries.value.anonymousId?.type)?i.anonymousId=It.session.anonymousId.value:i.anonymousId=on(),It.storage.trulyAnonymousTracking.value&&(i.context.trulyAnonymousTracking=!0),"identify"===e.type&&(i.context.traits=It.storage.entries.value.userTraits?.type!==Zt?f(It.session.userTraits.value):e.context.traits),"group"===e.type&&((e.groupId||It.session.groupId.value)&&(i.groupId=e.groupId||It.session.groupId.value),(e.traits||It.session.groupTraits.value)&&(i.traits=It.storage.entries.value.groupTraits?.type!==Zt?f(It.session.groupTraits.value):e.traits));const s=B(e,i);return void 0===s.event&&(s.event=null),void 0===s.properties&&(s.properties=null),((e,t)=>{P(t)&&(((e,t)=>{t.anonymousId&&E(t.anonymousId)&&(e.anonymousId=t.anonymousId),P(t.integrations)&&(e.integrations=t.integrations),t.originalTimestamp&&E(t.originalTimestamp)&&(e.originalTimestamp=t.originalTimestamp)})(e,t),e.context=((e,t,r)=>{let n=e;return Object.keys(t).forEach((e=>{if(!Xr.includes(e)&&!Zr.includes(e))if("context"!==e)n=B(n,{[e]:t[e]});else if(!w(t[e])&&P(t[e])){const r={};Object.keys(t[e]).forEach((n=>{Zr.includes(n)||(r[n]=t[e][n])})),n=B(n,{...r})}})),n})(e.context,t))})(s,t),((e,t)=>{const{properties:r,traits:n,context:i}=e,{traits:s}=i;ln(r,"properties",t),ln(n,"traits",t),ln(s,"context.traits",t)})(s,n),s.integrations=(e=>{let t;return t=It.loadOptions.value.useGlobalIntegrationsConfigInEvents&&(P(It.consents.postConsent.value?.integrations)||P(It.nativeDestinations.loadOnlyIntegrations.value))?f(It.consents.postConsent.value?.integrations??It.nativeDestinations.loadOnlyIntegrations.value):P(e)?e:Br,t})(s.integrations),s};class cn{constructor(e){this.logger=e}generatePageEvent(e,t,r,n){let i=r??{};return i.name=t,i.category=e,i=((e,t)=>{const r=t?.page||{},n=e,i=Ur();return Object.keys(i).forEach((e=>{w(n[e])&&(n[e]=r[e]||i[e])})),w(n.initial_referrer)&&(n.initial_referrer=r.initial_referrer||It.session.initialReferrer.value),w(n.initial_referring_domain)&&(n.initial_referring_domain=r.initial_referring_domain||It.session.initialReferringDomain.value),n})(i,n),un({properties:i,name:t,category:e,type:"page"},n,i,this.logger)}generateTrackEvent(e,t,r){return un({properties:t,event:e,type:"track"},r,void 0,this.logger)}generateIdentifyEvent(e,t,r){return un({userId:e,type:"identify",context:{traits:t}},r,void 0,this.logger)}generateAliasEvent(e,t,r){const n=un({previousId:t,type:"alias"},r,void 0,this.logger);return n.userId=e??n.userId,n}generateGroupEvent(e,t,r){const n={type:"group"};return e&&(n.groupId=e),t&&(n.traits=t),un(n,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}}class dn{constructor(e,t,r,n){this.eventRepository=e,this.userSessionManager=t,this.errorHandler=r,this.logger=n,this.eventFactory=new cn(this.logger),this.onError=this.onError.bind(this)}init(){this.eventRepository.init()}resume(){this.eventRepository.resume()}addEvent(e){this.userSessionManager.refreshSession();const t=this.eventFactory.create(e);t?this.eventRepository.enqueue(t,e.callback):this.onError(new Error("Failed to generate the event object."))}onError(e,t,r){if(!this.errorHandler)throw e;this.errorHandler.onError(e,G,t,r)}}class hn{constructor(e,t,r,n,i){this.storeManager=n,this.pluginsManager=r,this.logger=t,this.errorHandler=e,this.httpClient=i,this.onError=this.onError.bind(this)}init(){this.syncStorageDataToState(),this.registerEffects()}syncStorageDataToState(){this.migrateStorageIfNeeded(),this.migrateDataFromPreviousStorage(),this.setUserId(this.getUserId()),this.setUserTraits(this.getUserTraits()),this.setGroupId(this.getGroupId()),this.setGroupTraits(this.getGroupTraits());const{externalAnonymousIdCookieName:e,anonymousIdOptions:t}=It.loadOptions.value;let r;T(e)&&"string"==typeof e&&(r=this.getExternalAnonymousIdByCookieName(e)),this.setAnonymousId(r??this.getAnonymousId(t)),this.setAuthToken(this.getAuthToken()),this.setInitialReferrerInfo(),this.configureSessionTracking()}configureSessionTracking(){let e=this.getSessionInfo();if(this.isPersistenceEnabledForStorageEntry("sessionInfo")){const t=this.getConfiguredSessionTrackingInfo(),r=e??dt;e={...r,...t,autoTrack:t.autoTrack&&!0!==r.manualTrack}}It.session.sessionInfo.value=this.isPersistenceEnabledForStorageEntry("sessionInfo")?e:ct.sessionInfo,It.session.sessionInfo.value.autoTrack&&this.startOrRenewAutoTracking(It.session.sessionInfo.value)}setInitialReferrerInfo(){const e=this.getInitialReferrer(),t=this.getInitialReferringDomain();if(e&&t)this.setInitialReferrer(e),this.setInitialReferringDomain(t);else{const t=e||Nr();this.setInitialReferrer(t),this.setInitialReferringDomain(Tr(t))}}isPersistenceEnabledForStorageEntry(e){return sn(It.storage.entries.value[e]?.type)}migrateDataFromPreviousStorage(){const e=It.storage.entries.value,t=[qt,Jt,Wt];Object.keys(e).forEach((r=>{const n=r,i=e[n]?.type,s=this.storeManager?.getStore(nr[i]);s&&t.forEach((e=>{const t=this.storeManager?.getStore(nr[e]);if(t&&e!==i){const e=t.get(ut[n]);(e=>T(e)&&""!==e)(e)&&s.set(ut[n],e),t.remove(ut[n])}}))}))}migrateStorageIfNeeded(){if(!It.storage.migrate.value)return;const e=[];[Yt,er,tr].forEach((t=>{const r=this.storeManager?.getStore(t);r&&e.push(r)})),Object.keys(ut).forEach((t=>{const r=ut[t];e.forEach((e=>{const t=this.pluginsManager?.invokeSingle("storage.migrate",r,e.engine,this.errorHandler,this.logger);A(t)||e.set(r,t)}))}))}getConfiguredSessionTrackingInfo(){let e,t=!1!==It.loadOptions.value.sessions?.autoTrack;if(!t)return{autoTrack:t};const r=It.loadOptions.value.sessions?.timeout;return tn(r)?e=r:(this.logger?.warn(((e,t,r)=>`${e}${de}The session timeout value "${t}" is not a number. The default timeout of 1800000 ms will be used instead.`)(z,r)),e=oe),0===e&&(this.logger?.warn(`${z}${de}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.`),t=!1),e>0&&e<1e4&&this.logger?.warn(((e,t,r)=>`${e}${de}The session timeout value ${t} ms is less than the recommended minimum of 10000 ms. Please consider increasing the timeout value to ensure optimal performance and reliability.`)(z,e)),{timeout:e,autoTrack:t}}onError(e,t){if(!this.errorHandler)throw e;this.errorHandler.onError(e,z,t)}getEncryptedCookieData(e,t){const r=[];return e.forEach((e=>{const n=t?.encrypt(fe(e.value,!1,[],this.logger));T(n)&&r.push({name:e.name,value:n})})),r}makeRequestToSetCookie(e,t){this.httpClient?.getAsyncData({url:It.serverCookies.dataServiceUrl.value,options:{method:"POST",data:fe({reqType:"setCookies",workspaceId:It.source.value?.workspaceId,data:{options:{maxAge:It.storage.cookie.value?.maxage,path:It.storage.cookie.value?.path,domain:It.storage.cookie.value?.domain,sameSite:It.storage.cookie.value?.samesite,secure:It.storage.cookie.value?.secure,expires:It.storage.cookie.value?.expires},cookies:e}}),sendRawData:!0,withCredentials:!0},isRawResponse:!0,callback:t})}setServerSideCookie(e,t,r){try{const n=this.getEncryptedCookieData(e,r);n.length>0&&this.makeRequestToSetCookie(n,((n,i)=>{var s;200===i?.xhr?.status?e.forEach((e=>{const n=r?.get(e.name),i=fe(e.value,!1,[]),s=fe(n,!1,[]);s!==i&&(this.logger?.debug("Cookie value sent to server side",i),this.logger?.debug("Cookie value set from server side",s),this.logger?.error(`The server failed to set the ${e.name} cookie. As a fallback, the cookies will be set client side.`),t&&t(e.name,e.value))})):(this.logger?.error((s=i?.xhr?.status,`The server responded with status ${s} 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){const r=It.storage.entries.value,n=r[e]?.type;if(sn(n)){const i=this.storeManager?.getStore(nr[n]),s=r[e]?.key;t&&(E(t)||$(t))?It.serverCookies.isEnabledServerSideCookies.value&&n===qt?this.setServerSideCookie([{name:s,value:t}],((e,t)=>{i?.set(e,t)}),i):i?.set(s,t):i?.remove(s)}}registerEffects(){rr.forEach((e=>{Me((()=>{this.syncValueToStorage(e,It.session[e].value)}))}))}setAnonymousId(e,t){let r=e;if(this.isPersistenceEnabledForStorageEntry("anonymousId")){if(!r&&t){const e=this.pluginsManager?.invokeSingle("userSession.anonymousIdGoogleLinker",t);r=e}r=r||on()}else r=ct.anonymousId;It.session.anonymousId.value=r}getAnonymousId(e){const t=It.storage.entries.value.anonymousId?.type;if(sn(t)){let t=this.getEntryValue("anonymousId");if(!t&&e){const r=this.pluginsManager?.invokeSingle("storage.getAnonymousId",Sr,e);t=r}It.session.anonymousId.value=t||on()}return It.session.anonymousId.value}getEntryValue(e){const t=It.storage.entries.value,r=t[e]?.type;if(sn(r)){const n=this.storeManager?.getStore(nr[r]),i=t[e]?.key;return n?.get(i)??null}return null}getExternalAnonymousIdByCookieName(e){const t=Sr(qt);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(){const e=this.getSessionInfo()??ct.sessionInfo;return e.autoTrack&&!rn(e.expiresAt)||e.manualTrack?e.id??null:null}refreshSession(){let e=this.getSessionInfo()??ct.sessionInfo;(e.autoTrack||e.manualTrack)&&(e.autoTrack&&(this.startOrRenewAutoTracking(e),e=It.session.sessionInfo.value),void 0===e.sessionStart?e={...e,sessionStart:!0}:e.sessionStart&&(e={...e,sessionStart:!1})),It.session.sessionInfo.value=e,"readyExecuted"!==It.lifecycle.status.value&&this.syncValueToStorage("sessionInfo",e)}reset(e,t){const{session:r}=It,{manualTrack:n,autoTrack:i}=r.sessionInfo.value;be((()=>{r.userId.value=ct.userId,r.userTraits.value=ct.userTraits,r.groupId.value=ct.groupId,r.groupTraits.value=ct.groupTraits,r.authToken.value=ct.authToken,e&&this.setAnonymousId(),t||(i?(r.sessionInfo.value=ct.sessionInfo,this.startOrRenewAutoTracking(r.sessionInfo.value)):n&&this.startManualTrackingInternal())}))}setUserId(e){It.session.userId.value=this.isPersistenceEnabledForStorageEntry("userId")&&e?e:ct.userId}setUserTraits(e){It.session.userTraits.value=this.isPersistenceEnabledForStorageEntry("userTraits")&&e?B(It.session.userTraits.value??ct.userTraits,e):ct.userTraits}setGroupId(e){It.session.groupId.value=this.isPersistenceEnabledForStorageEntry("groupId")&&e?e:ct.groupId}setGroupTraits(e){It.session.groupTraits.value=this.isPersistenceEnabledForStorageEntry("groupTraits")&&e?B(It.session.groupTraits.value??ct.groupTraits,e):ct.groupTraits}setInitialReferrer(e){It.session.initialReferrer.value=this.isPersistenceEnabledForStorageEntry("initialReferrer")&&e?e:ct.initialReferrer}setInitialReferringDomain(e){It.session.initialReferringDomain.value=this.isPersistenceEnabledForStorageEntry("initialReferringDomain")&&e?e:ct.initialReferringDomain}startOrRenewAutoTracking(e){if(rn(e.expiresAt))It.session.sessionInfo.value=(e=>{const t=Date.now(),r=e||oe;return{id:t,expiresAt:t+r,timeout:r,sessionStart:void 0,autoTrack:!0}})(e.timeout);else{const t=Date.now(),r=e.timeout;It.session.sessionInfo.value=B(e,{expiresAt:t+r})}}start(e){It.session.sessionInfo.value=((e,t)=>({id:nn(e,t)?e:Date.now(),sessionStart:void 0,manualTrack:!0}))(e,this.logger)}startManualTrackingInternal(){this.start(Date.now())}end(){It.session.sessionInfo.value=ct.sessionInfo}setAuthToken(e){It.session.authToken.value=this.isPersistenceEnabledForStorageEntry("authToken")&&e?e:ct.authToken}}const gn=["BeaconQueue","Bugsnag","CustomConsentManager","DeviceModeDestinations","DeviceModeTransformation","ErrorReporting","ExternalAnonymousId","GoogleLinker","KetchConsentManager","NativeDestinationQueue","OneTrustConsentManager","StorageEncryption","StorageEncryptionLegacy","StorageMigrator","XhrQueue"],fn="dataplaneEventsQueue",pn="destinationsEventsQueue";class vn{constructor(e,t,r,n){this.pluginsManager=e,this.errorHandler=r,this.logger=n,this.httpClient=new Qt(r,n),this.storeManager=t,this.onError=this.onError.bind(this)}init(){try{this.dataplaneEventsQueue=this.pluginsManager.invokeSingle(`${fn}.init`,It,this.httpClient,this.storeManager,this.errorHandler,this.logger)}catch(e){this.onError(e,"XhrQueuePlugin initialization failed")}try{this.dmtEventsQueue=this.pluginsManager.invokeSingle("transformEvent.init",It,this.pluginsManager,this.httpClient,this.storeManager,this.errorHandler,this.logger)}catch(e){this.onError(e,"DeviceModeTransformationPlugin initialization failed")}try{this.destinationsEventsQueue=this.pluginsManager.invokeSingle(`${pn}.init`,It,this.pluginsManager,this.storeManager,this.dmtEventsQueue,this.errorHandler,this.logger)}catch(e){this.onError(e,"NativeDestinationQueuePlugin initialization failed")}Me((()=>{!0===It.nativeDestinations.clientDestinationsReady.value&&(this.destinationsEventsQueue?.start(),this.dmtEventsQueue?.start())}));const e=(e=>e.consents.preConsent.value.enabled&&"buffer"===e.consents.preConsent.value.events?.delivery&&("session"===e.consents.preConsent.value.storage?.strategy||"none"===e.consents.preConsent.value.storage?.strategy))(It);let t;Me((()=>{const r=!0===It.loadOptions.value.bufferDataPlaneEventsUntilReady&&!1===It.nativeDestinations.clientDestinationsReady.value;!1!==It.nativeDestinations.activeDestinations.value.some((e=>{return t=e,Boolean("hybrid"===t.config.connectionMode||!0===t.config.useNativeSDKToSend);var t}))&&!1!==r||e||!0===this.dataplaneEventsQueue?.scheduleTimeoutActive||(globalThis.clearTimeout(t),this.dataplaneEventsQueue?.start())})),!0===It.loadOptions.value.bufferDataPlaneEventsUntilReady&&(t=globalThis.setTimeout((()=>{!0!==this.dataplaneEventsQueue?.scheduleTimeoutActive&&this.dataplaneEventsQueue?.start()}),It.loadOptions.value.dataPlaneEventsBufferTimeout))}resume(){!0!==this.dataplaneEventsQueue?.scheduleTimeoutActive&&(It.consents.postConsent.value.discardPreConsentEvents&&(this.dataplaneEventsQueue?.clear(),this.destinationsEventsQueue?.clear()),this.dataplaneEventsQueue?.start())}enqueue(e,t){let r;try{r=((e,t)=>{const r=f(e),n=e.integrations??Br,i=t.nativeDestinations.integrationsConfig.value,s=((e,t)=>Object.keys(e).filter((r=>!0!==e[r]||!t[r])).reduce(((t,r)=>{const n=f(t);return n[r]=e[r],n}),{}))(n,i);return r.integrations=B(i,s),r})(e,It),this.pluginsManager.invokeSingle(`${fn}.enqueue`,It,this.dataplaneEventsQueue,r,this.errorHandler,this.logger)}catch(e){this.onError(e,"XhrQueuePlugin event enqueue failed")}try{const t=f(e);this.pluginsManager.invokeSingle(`${pn}.enqueue`,It,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)throw e;this.errorHandler.onError(e,"EventRepository",t,r)}}const yn=e=>{const t=new CustomEvent(e,{detail:{analyticsInstance:globalThis.rudderanalytics},bubbles:!0,cancelable:!0,composed:!0});globalThis.document.dispatchEvent(t)};class mn{constructor(){this.preloadBuffer=new Le,this.initialized=!1,this.errorHandler=Rt,this.logger=Ue,this.externalSrcLoader=new ve(this.errorHandler,this.logger),this.capabilitiesManager=new Vr(this.errorHandler,this.logger),this.httpClient=zt}load(e,t,r={}){if(It.lifecycle.status.value)return;let n=f(t),i=f(r);R(t)&&(i=t,n=void 0),be((()=>{It.lifecycle.writeKey.value=e,It.lifecycle.dataPlaneUrl.value=n,It.loadOptions.value=((e,t)=>{const r=f(t);return E(r.setCookieDomain)||delete r.setCookieDomain,["Strict","Lax","None"].includes(r.sameSiteCookie)||delete r.sameSiteCookie,r.secureCookie=!0===r.secureCookie,["none","default","full"].includes(r.uaChTrackLevel)||delete r.uaChTrackLevel,P(r.integrations)||delete r.integrations,r.plugins=r.plugins??gn,r.useGlobalIntegrationsConfigInEvents=!0===r.useGlobalIntegrationsConfigInEvents,r.bufferDataPlaneEventsUntilReady=!0===r.bufferDataPlaneEventsUntilReady,r.sendAdblockPage=!0===r.sendAdblockPage,r.useServerSideCookies=!0===r.useServerSideCookies,r.dataServiceEndpoint&&"string"!=typeof r.dataServiceEndpoint&&delete r.dataServiceEndpoint,P(r.sendAdblockPageOptions)||delete r.sendAdblockPageOptions,I(r.loadIntegration)?r.loadIntegration=!0===r.loadIntegration:delete r.loadIntegration,P(r.storage)?(r.storage=M(r.storage),r.storage.migrate=!0===r.storage?.migrate):delete r.storage,P(r.beaconQueueOptions)?r.beaconQueueOptions=M(r.beaconQueueOptions):delete r.beaconQueueOptions,P(r.destinationsQueueOptions)?r.destinationsQueueOptions=M(r.destinationsQueueOptions):delete r.destinationsQueueOptions,P(r.queueOptions)?r.queueOptions=M(r.queueOptions):delete r.queueOptions,r.lockIntegrationsVersion=!0===r.lockIntegrationsVersion,en(r.dataPlaneEventsBufferTimeout)||delete r.dataPlaneEventsBufferTimeout,P(r.storage?.cookie)?r.storage.cookie=M(r.storage?.cookie):delete r.storage?.cookie,P(r.preConsent)?r.preConsent=M(r.preConsent):delete r.preConsent,B(e,r)})(It.loadOptions.value,i),It.lifecycle.status.value="mounted"})),It.loadOptions.value.logLevel&&this.logger?.setMinLogLevel(It.loadOptions.value.logLevel),le("state",It,e),this.startLifecycle()}startLifecycle(){Me((()=>{try{switch(It.lifecycle.status.value){case"mounted":this.onMounted();break;case"browserCapabilitiesReady":this.onBrowserCapabilitiesReady();break;case"configured":this.onConfigured();break;case"pluginsLoading":case"destinationsLoading":case"readyExecuted":default:break;case"pluginsReady":this.onPluginsReady();break;case"initialized":this.onInitialized();break;case"loaded":this.onLoaded();break;case"destinationsReady":this.onDestinationsReady();break;case"ready":this.onReady()}}catch(e){const t="Failed to load the SDK";this.errorHandler.onError(pe(e,t),Z)}}))}onBrowserCapabilitiesReady(){(e=>{const t=((e,t="app")=>(ae(t),globalThis.RudderStackGlobals[t][e]))(re)||[];((e=[])=>{const t=new URLSearchParams(globalThis.location.search);t.get(se)&&e.unshift(["track",t.get(se),ue(t,"ajs_prop_")]),t.get(ie)&&e.unshift(["identify",t.get(ie),ue(t,"ajs_trait_")]),t.get(ne)&&e.unshift(["setAnonymousId",t.get(ne)])})(t),t.length>0&&(e.enqueuePreloadBufferEvents(t),le(re,[]))})(this),this.prepareInternalServices(),this.loadConfig()}onLoaded(){this.processBufferedEvents(),!0===It.consents.preConsent.value.enabled?It.lifecycle.status.value="ready":this.loadDestinations()}onMounted(){this.capabilitiesManager.init()}enqueuePreloadBufferEvents(e){Array.isArray(e)&&e.forEach((e=>this.preloadBuffer.enqueue(f(e))))}processDataInPreloadBuffer(){for(;this.preloadBuffer.size()>0;){const e=this.preloadBuffer.dequeue();e&&ce([...e],this)}}prepareInternalServices(){this.pluginsManager=new Ft(Tt,this.errorHandler,this.logger),this.storeManager=new _r(this.pluginsManager,this.errorHandler,this.logger),this.configManager=new jr(this.httpClient,this.errorHandler,this.logger),this.userSessionManager=new hn(this.errorHandler,this.logger,this.pluginsManager,this.storeManager,this.httpClient),this.eventRepository=new vn(this.pluginsManager,this.storeManager,this.errorHandler,this.logger),this.eventManager=new dn(this.eventRepository,this.userSessionManager,this.errorHandler,this.logger)}loadConfig(){It.lifecycle.writeKey.value&&this.httpClient.setAuthHeader(It.lifecycle.writeKey.value),this.configManager?.init()}onPluginsReady(){this.errorHandler.init(this.externalSrcLoader),this.storeManager?.init(),this.userSessionManager?.init(),It.consents.enabled.value&&!It.consents.initialized.value&&(this.pluginsManager?.invokeSingle("consentManager.init",It,this.logger),!1===It.consents.preConsent.value.enabled&&this.pluginsManager?.invokeSingle("consentManager.updateConsentsInfo",It,this.storeManager,this.logger)),this.eventManager?.init(),It.lifecycle.status.value="initialized"}onConfigured(){this.pluginsManager?.init()}onInitialized(){this.processDataInPreloadBuffer(),S(It.loadOptions.value.onLoaded)&&It.loadOptions.value.onLoaded(globalThis.rudderanalytics),be((()=>{It.lifecycle.loaded.value=!0,It.lifecycle.status.value="loaded"})),this.initialized=!0,yn("RSA_Initialised")}onReady(){It.lifecycle.status.value="readyExecuted",It.eventBuffer.readyCallbacksArray.value.forEach((e=>{try{e()}catch(e){this.errorHandler.onError(e,Z,Ge)}})),yn("RSA_Ready")}processBufferedEvents(){let e=It.eventBuffer.toBeProcessedArray.value;for(;e.length>0;){const t=e.shift();if(It.eventBuffer.toBeProcessedArray.value=e,t){const e=t[0];S(this[e])&&this[e](...t.slice(1),!0)}e=It.eventBuffer.toBeProcessedArray.value}}loadDestinations(){if(It.nativeDestinations.clientDestinationsReady.value)return;this.pluginsManager?.invokeSingle("nativeDestinations.setActiveDestinations",It,this.pluginsManager,this.errorHandler,this.logger);const e=It.nativeDestinations.activeDestinations.value.length;0!==e?(It.lifecycle.status.value="destinationsLoading",this.pluginsManager?.invokeSingle("nativeDestinations.load",It,this.externalSrcLoader,this.errorHandler,this.logger),Me((()=>{(0===e||It.nativeDestinations.initializedDestinations.value.length+It.nativeDestinations.failedDestinations.value.length===e)&&be((()=>{It.lifecycle.status.value="destinationsReady",It.nativeDestinations.clientDestinationsReady.value=!0}))}))):It.lifecycle.status.value="destinationsReady"}onDestinationsReady(){"ready"!==It.lifecycle.status.value&&(It.lifecycle.status.value="ready")}ready(e,t=!1){const r="ready";if(It.lifecycle.loaded.value)if(this.errorHandler.leaveBreadcrumb(`New ${r} invocation`),S(e))if("readyExecuted"===It.lifecycle.status.value)try{e()}catch(e){this.errorHandler.onError(e,Z,Ge)}else It.eventBuffer.readyCallbacksArray.value=[...It.eventBuffer.readyCallbacksArray.value,e];else this.logger.error(`readyApi${de}The callback is not a function.`);else It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,[r,e]]}page(e,t=!1){const r="page";It.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} event`),It.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===It.capabilities.isAdBlocked.value&&e.category!==te&&this.page(j(te,"ad-block page request",{path:"/ad-blocked"},It.loadOptions.value.sendAdblockPageOptions))):It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,[r,e]]}track(e,t=!1){const r="track";It.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} event`),It.metrics.triggered.value+=1,this.eventManager?.addEvent({type:r,name:e.name||void 0,properties:e.properties,options:e.options,callback:e.callback})):It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,[r,e]]}identify(e,t=!1){const r="identify";It.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} event`),It.metrics.triggered.value+=1,Boolean(e.userId&&It.session.userId.value&&e.userId!==It.session.userId.value)&&this.reset(),_(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})):It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,[r,e]]}alias(e,t=!1){const r="alias";if(!It.lifecycle.loaded.value)return void(It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,[r,e]]);this.errorHandler.leaveBreadcrumb(`New ${r} event`),It.metrics.triggered.value+=1;const n=e.from??this.userSessionManager?.getUserId()??this.userSessionManager?.getAnonymousId();this.eventManager?.addEvent({type:r,to:e.to,from:n,options:e.options,callback:e.callback})}group(e,t=!1){const r="group";It.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} event`),It.metrics.triggered.value+=1,_(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})):It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,[r,e]]}reset(e,t=!1){const r="reset";It.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} invocation, resetAnonymousId: ${e}`),this.userSessionManager?.reset(e)):It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,[r,e]]}getAnonymousId(e){return this.userSessionManager?.getAnonymousId(e)}setAnonymousId(e,t,r=!1){const n="setAnonymousId";It.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${n} invocation`),this.userSessionManager?.setAnonymousId(e,t)):It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,[n,e,t]]}getUserId(){return It.session.userId.value}getUserTraits(){return It.session.userTraits.value}getGroupId(){return It.session.groupId.value}getGroupTraits(){return It.session.groupTraits.value}startSession(e,t=!1){const r="startSession";It.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${r} invocation`),this.userSessionManager?.start(e)):It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,[r,e]]}endSession(e=!1){const t="endSession";It.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb(`New ${t} invocation`),this.userSessionManager?.end()):It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,[t]]}getSessionId(){const e=this.userSessionManager?.getSessionId();return e??null}consent(e,t=!1){It.lifecycle.loaded.value?(this.errorHandler.leaveBreadcrumb("New consent invocation"),be((()=>{It.consents.preConsent.value={...It.consents.preConsent.value,enabled:!1},It.consents.postConsent.value=(e=>{const t={sendPageEvent:!1,trackConsent:!1,discardPreConsentEvents:!1};if(P(e)){const r=f(e);t.storage=r.storage,I(r.integrations)&&(t.integrations=P(r.integrations)?r.integrations:Br),t.discardPreConsentEvents=!0===r.discardPreConsentEvents,t.sendPageEvent=!0===r.sendPageEvent,t.trackConsent=!0===r.trackConsent,$(r.consentManagement)&&(t.consentManagement=B(r.consentManagement,{enabled:It.consents.enabled.value}))}return t})(e);const{initialized:t,consentsData:r}=Dr(It.consents.postConsent.value.consentManagement,this.logger);It.consents.initialized.value=t||It.consents.initialized.value,It.consents.data.value=r})),It.consents.enabled.value&&!It.consents.initialized.value&&this.pluginsManager?.invokeSingle("consentManager.updateConsentsInfo",It,this.storeManager,this.logger),this.storeManager?.initializeStorageState(),this.userSessionManager?.syncStorageDataToState(),this.eventManager?.resume(),this.loadDestinations(),this.sendTrackingEvents(t)):It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,["consent",e]]}sendTrackingEvents(e){if(It.consents.postConsent.value.trackConsent){const t=N("Consent Management Interaction");e?It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,["track",t]]:this.track(t)}if(It.consents.postConsent.value.sendPageEvent){const t=j();e?It.eventBuffer.toBeProcessedArray.value=[...It.eventBuffer.toBeProcessedArray.value,["page",t]]:this.page(t)}}setAuthToken(e){this.userSessionManager?.setAuthToken(e)}}class bn{static globalSingleton=null;analyticsInstances={};defaultAnalyticsKey="";logger=Ue;constructor(){if(bn.globalSingleton)return bn.globalSingleton;Rt.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.getSessionId=this.getSessionId.bind(this),this.setAuthToken=this.setAuthToken.bind(this),this.consent=this.consent.bind(this),bn.globalSingleton=this,this.triggerBufferedLoadEvent(),globalThis.rudderanalytics=this}setDefaultInstanceKey(e){e&&(this.defaultAnalyticsKey=e)}getAnalyticsInstance(e){const t=e??this.defaultAnalyticsKey;return Boolean(this.analyticsInstances[t])||(this.analyticsInstances[t]=new mn),this.analyticsInstances[t]}load(e,t,r){E(e)?this.analyticsInstances[e]||(this.setDefaultInstanceKey(e),this.analyticsInstances[e]=new mn,this.getAnalyticsInstance(e).load(e,t,r)):this.logger.error(((e,t)=>`${e}${de}The write key "${t}" is not a string. Please check that the write key is correct and try again.`)(X,e))}triggerBufferedLoadEvent(){const e=Array.isArray(globalThis.rudderanalytics)?globalThis.rudderanalytics:[];(e=>{const t="consent",r=e.filter((e=>e[0]===t)),n=e.filter((e=>e[0]!==t));e.splice(0,e.length,...r,...n)})(e);const t=(e=>{let t=[],r=0;for(;r<e.length;){if(e[r]&&"load"===e[r][0]){t=f(e[r]),e.splice(r,1);break}r+=1}return t})(e);le(re,f(e)),t.length>0&&(t.shift(),this.load.apply(null,t))}ready(e){this.getAnalyticsInstance().ready(e)}page(e,t,r,n,i){this.getAnalyticsInstance().page(j(e,t,r,n,i))}track(e,t,r,n){this.getAnalyticsInstance().track(N(e,t,r,n))}identify(e,t,r,n){this.getAnalyticsInstance().identify(U(e,t,r,n))}alias(e,t,r,n){this.getAnalyticsInstance().alias(F(e,t,r,n))}group(e,t,r,n){0!==arguments.length?this.getAnalyticsInstance().group(H(e,t,r,n)):this.logger.error(`${X}${de}The group() method must be called with at least one argument.`)}reset(e){this.getAnalyticsInstance().reset(e)}getAnonymousId(e){return this.getAnalyticsInstance().getAnonymousId(e)}setAnonymousId(e,t){this.getAnalyticsInstance().setAnonymousId(e,t)}getUserId(){return this.getAnalyticsInstance().getUserId()}getUserTraits(){return this.getAnalyticsInstance().getUserTraits()}getGroupId(){return this.getAnalyticsInstance().getGroupId()}getGroupTraits(){return this.getAnalyticsInstance().getGroupTraits()}startSession(e){return this.getAnalyticsInstance().startSession(e)}endSession(){return this.getAnalyticsInstance().endSession()}getSessionId(){return this.getAnalyticsInstance().getSessionId()}setAuthToken(e){return this.getAnalyticsInstance().setAuthToken(e)}consent(e){return this.getAnalyticsInstance().consent(e)}}t.RudderAnalytics=bn},591:(e,t,r)=>{r.r(t),r.d(t,{connectGlobalObserver:()=>$,default:()=>U,disconnectGlobalObserver:()=>B,validAttributeName:()=>n});var n=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,i={revert:function(){}},s=new Map,o=new Set;function a(e){var t=s.get(e);return t||(t={element:e,attributes:{}},s.set(e,t)),t}function l(e,t,r,n,i){var s=r(e),o={isDirty:!1,originalValue:s,virtualValue:s,mutations:[],el:e,_positionTimeout:null,observer:new MutationObserver((function(){if("position"!==t||!o._positionTimeout){"position"===t&&(o._positionTimeout=setTimeout((function(){o._positionTimeout=null}),1e3));var n=r(e);"position"===t&&n.parentNode===o.virtualValue.parentNode&&n.insertBeforeNode===o.virtualValue.insertBeforeNode||n!==o.virtualValue&&(o.originalValue=n,i(o))}})),mutationRunner:i,setValue:n,getCurrentValue:r};return"position"===t&&e.parentNode?o.observer.observe(e.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):o.observer.observe(e,function(e){return"html"===e?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[e]}}(t)),o}function u(e,t){var r=t.getCurrentValue(t.el);t.virtualValue=e,e&&"string"!=typeof e?r&&e.parentNode===r.parentNode&&e.insertBeforeNode===r.insertBeforeNode||(t.isDirty=!0,R()):e!==r&&(t.isDirty=!0,R())}function c(e){var t=e.originalValue;e.mutations.forEach((function(e){return t=e.mutate(t)})),u(function(e){return _||(_=document.createElement("div")),_.innerHTML=e,_.innerHTML}(t),e)}function d(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach((function(e){return e.mutate(t)})),u(Array.from(t).filter(Boolean).join(" "),e)}function h(e){var t=e.originalValue;e.mutations.forEach((function(e){return t=e.mutate(t)})),u(t,e)}function g(e){var t=e.originalValue;e.mutations.forEach((function(e){var r=function(e){var t=e.parentSelector,r=e.insertBeforeSelector,n=document.querySelector(t);if(!n)return null;var i=r?document.querySelector(r):null;return r&&!i?null:{parentNode:n,insertBeforeNode:i}}(e.mutate());t=r||t})),u(t,e)}var f=function(e){return e.innerHTML},p=function(e,t){return e.innerHTML=t};function v(e){var t=a(e);return t.html||(t.html=l(e,"html",f,p,c)),t.html}var y=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},m=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function b(e){var t=a(e);return t.position||(t.position=l(e,"position",y,m,g)),t.position}var k=function(e,t){return t?e.className=t:e.removeAttribute("class")},S=function(e){return e.className};function E(e){var t=a(e);return t.classes||(t.classes=l(e,"class",S,k,d)),t.classes}var _,w,A=function(e){return function(t){var r;return null!=(r=t.getAttribute(e))?r:null}},I=function(e){return function(t,r){return null!==r?t.setAttribute(e,r):t.removeAttribute(e)}};function T(e,t){var r=a(e);return r.attributes[t]||(r.attributes[t]=l(e,t,A(t),I(t),h)),r.attributes[t]}function x(e,t,r){if(r.isDirty){r.isDirty=!1;var n=r.virtualValue;r.mutations.length||function(e,t){var r,n,i=s.get(e);if(i)if("html"===t)null==(r=i.html)||null==(n=r.observer)||n.disconnect(),delete i.html;else if("class"===t){var o,a;null==(o=i.classes)||null==(a=o.observer)||a.disconnect(),delete i.classes}else if("position"===t){var l,u;null==(l=i.position)||null==(u=l.observer)||u.disconnect(),delete i.position}else{var c,d,h;null==(c=i.attributes)||null==(d=c[t])||null==(h=d.observer)||h.disconnect(),delete i.attributes[t]}}(e,t),r.setValue(e,n)}}function C(e,t){e.html&&x(t,"html",e.html),e.classes&&x(t,"class",e.classes),e.position&&x(t,"position",e.position),Object.keys(e.attributes).forEach((function(r){x(t,r,e.attributes[r])}))}function R(){s.forEach(C)}function P(e){if("position"!==e.kind||1!==e.elements.size){var t=new Set(e.elements);document.querySelectorAll(e.selector).forEach((function(r){t.has(r)||(e.elements.add(r),function(e,t){var r=null;"html"===e.kind?r=v(t):"class"===e.kind?r=E(t):"attribute"===e.kind?r=T(t,e.attribute):"position"===e.kind&&(r=b(t)),r&&(r.mutations.push(e),r.mutationRunner(r))}(e,r))}))}}function O(){o.forEach(P)}function B(){w&&w.disconnect()}function $(){"undefined"!=typeof document&&(w||(w=new MutationObserver((function(){O()}))),O(),w.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}))}function D(e){return"undefined"==typeof document?i:(o.add(e),P(e),{revert:function(){var t;(t=e).elements.forEach((function(e){return function(e,t){var r=null;if("html"===e.kind?r=v(t):"class"===e.kind?r=E(t):"attribute"===e.kind?r=T(t,e.attribute):"position"===e.kind&&(r=b(t)),r){var n=r.mutations.indexOf(e);-1!==n&&r.mutations.splice(n,1),r.mutationRunner(r)}}(t,e)})),t.elements.clear(),o.delete(t)}})}function M(e,t){return D({kind:"html",elements:new Set,mutate:t,selector:e})}function L(e,t){return D({kind:"position",elements:new Set,mutate:t,selector:e})}function j(e,t){return D({kind:"class",elements:new Set,mutate:t,selector:e})}function N(e,t,r){return n.test(t)?"class"===t||"className"===t?j(e,(function(e){var t=r(Array.from(e).join(" "));e.clear(),t&&t.split(/\s+/g).filter(Boolean).forEach((function(t){return e.add(t)}))})):D({kind:"attribute",attribute:t,elements:new Set,mutate:r,selector:e}):i}$();const U={html:M,classes:j,attribute:N,position:L,declarative:function(e){var t=e.selector,r=e.action,n=e.value,s=e.attribute,o=e.parentSelector,a=e.insertBeforeSelector;if("html"===s){if("append"===r)return M(t,(function(e){return e+(null!=n?n:"")}));if("set"===r)return M(t,(function(){return null!=n?n:""}))}else if("class"===s){if("append"===r)return j(t,(function(e){n&&e.add(n)}));if("remove"===r)return j(t,(function(e){n&&e.delete(n)}));if("set"===r)return j(t,(function(e){e.clear(),n&&e.add(n)}))}else if("position"===s){if("set"===r&&o)return L(t,(function(){return{insertBeforeSelector:a,parentSelector:o}}))}else{if("append"===r)return N(t,s,(function(e){return null!==e?e+(null!=n?n:""):null!=n?n:""}));if("set"===r)return N(t,s,(function(){return null!=n?n:""}));if("remove"===r)return N(t,s,(function(){return null}))}return i}}},396:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Analytics=t.createAnalyticsInstance=void 0;var i=r(316),s=r(706);function o(e){var t,r,o={},a={},l={},u=function(e,r){return null==t?void 0:t.getFeatureValue(e,r)},c=function(){return(null==r?void 0:r.getUserId())||""};return{initialise:function(e){var n=e.growthbookKey,o=e.growthbookDecryptionKey,l=e.rudderstackKey,c=e.growthbookOptions;if(r=s.RudderStack.getRudderStackInstance(l),n&&o){t=i.Growthbook.getGrowthBookInstance(n,o,c);var d=setInterval((function(){Object.keys(a).length>0?clearInterval(d):a=u("tracking-buttons-config",{})}),1e3)}},setAttributes:function(e){var i=e.country,s=e.user_language,a=e.device_language,l=e.device_type,u=e.account_type,d=e.user_id,h=e.app_id,g=e.utm_source,f=e.utm_medium,p=e.utm_campaign,v=e.is_authorised,y=e.url,m=e.domain;if(t||r){var b=null!=d?d:c();t&&t.setAttributes({id:b||c(),country:i,user_language:s,device_language:a,device_type:l,utm_source:g,utm_medium:f,utm_campaign:p,is_authorised:v,url:y,domain:m}),o=n(n(n(n(n(n({},o),void 0!==s&&{user_language:s}),void 0!==u&&{account_type:u}),void 0!==h&&{app_id:h}),void 0!==l&&{device_type:l}),void 0!==y&&{url:y})}},identifyEvent:function(e){var t=e||c();r&&(null==r||r.identifyEvent(t,{language:(null==o?void 0:o.user_language)||"en"}))},getFeatureState:function(e){var r,n;return null===(n=null===(r=null==t?void 0:t.getFeatureState(e))||void 0===r?void 0:r.experimentResult)||void 0===n?void 0:n.name},getFeatureValue:u,isFeatureOn:function(e){return null==t?void 0:t.isOn(e)},setUrl:function(e){return null==t?void 0:t.setUrl(e)},getId:c,trackEvent:function(e,t){r&&(navigator.onLine?(Object.keys(l).length>0&&Object.keys(l).forEach((function(e){r.track(l[e].event,l[e].payload),delete l[e]})),e in a?a[e]&&(null==r||r.track(e,n(n({},o),t))):null==r||r.track(e,n(n({},o),t))):l[e+t.action]={event:e,payload:n(n({},o),t)})},getInstances:function(){return{ab:t,tracking:r}},pageView:function(e,t){void 0===t&&(t="Deriv App"),r&&(null==r||r.pageView(e,t,c()))},reset:function(){r&&(null==r||r.reset())}}}t.createAnalyticsInstance=o,t.Analytics=o()},316:function(e,t,r){var n=this&&this.__assign||function(){return n=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},n.apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Growthbook=void 0;var i=r(200),s=r(182),o=function(){function e(e,t,r){void 0===r&&(r={});var o=this;this.analytics=new s.RudderAnalytics,this.setAttributes=function(e){var t=e.id,r=e.country,i=e.user_language,s=e.device_language,a=e.device_type,l=e.utm_source,u=e.utm_medium,c=e.utm_campaign,d=e.is_authorised,h=e.url,g=e.domain,f=e.utm_content,p=o.GrowthBook.getAttributes();o.GrowthBook.setAttributes(n(n(n(n(n(n(n(n(n(n(n(n(n({},p),{id:t}),void 0!==r&&{country:r}),void 0!==i&&{user_language:i}),void 0!==s&&{device_language:s}),void 0!==a&&{device_type:a}),void 0!==l&&{utm_source:l}),void 0!==u&&{utm_medium:u}),void 0!==c&&{utm_campaign:c}),void 0!==d&&{is_authorised:d}),void 0!==h&&{url:h}),void 0!==g&&{domain:g}),void 0!==f&&{utm_content:f}))},this.getFeatureValue=function(e,t){return o.GrowthBook.getFeatureValue(e,t)},this.getFeatureState=function(e){return o.GrowthBook.evalFeature(e)},this.setUrl=function(e){return o.GrowthBook.setURL(e)},this.isOn=function(e){return o.GrowthBook.isOn(e)},this.init=function(){return o.GrowthBook.loadFeatures().catch((function(e){return console.error(e)}))},this.GrowthBook=new i.GrowthBook(n({apiHost:"https://cdn.growthbook.io",clientKey:e,decryptionKey:t,antiFlicker:!1,navigateDelay:0,antiFlickerTimeout:3500,subscribeToChanges:!0,enableDevMode:null===window||void 0===window?void 0:window.location.hostname.includes("localhost"),trackingCallback:function(e,t){window.dataLayer&&window.dataLayer.push({event:"experiment_viewed",event_category:"experiment",rudder_anonymous_id:o.analytics.getAnonymousId(),experiment_id:e.key,variation_id:t.variationId}),o.analytics.track("experiment_viewed",{experimentId:e.key,variationId:t.variationId})}},r)),this.init()}return e.getGrowthBookInstance=function(t,r,n){return e._instance||(e._instance=new e(t,r,n)),e._instance},e}();t.Growthbook=o},706:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RudderStack=void 0;var n=r(182),i=function(){function e(e){var t=this;this.analytics=new n.RudderAnalytics,this.has_identified=!1,this.has_initialized=!1,this.current_page="",this.getAnonymousId=function(){return t.analytics.getAnonymousId()},this.getUserId=function(){return t.analytics.getUserId()},this.init=function(e){e&&(t.analytics.load(e,"https://deriv-dataplane.rudderstack.com"),t.analytics.ready((function(){t.has_initialized=!0,t.has_identified=!(!t.getUserId()&&!t.getAnonymousId())})))},this.identifyEvent=function(e,r){t.analytics.identify(e,r),t.has_identified=!0},this.pageView=function(e,r,n){void 0===r&&(r="Deriv App"),t.has_initialized&&t.has_identified&&e!==t.current_page&&(t.analytics.page(r,e,{user_id:n}),t.current_page=e)},this.reset=function(){t.has_initialized&&(t.analytics.reset(),t.has_identified=!1)},this.track=function(e,r){var n=Object.fromEntries(Object.entries(r).filter((function(e){return e[0],void 0!==e[1]})));if(t.has_initialized&&t.has_identified)try{t.analytics.track(e,n)}catch(e){console.error(e)}},this.init(e)}return e.getRudderStackInstance=function(t){return e._instance||(e._instance=new e(t)),e._instance},e}();t.RudderStack=i}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.Analytics=void 0;var t=r(396);Object.defineProperty(e,"Analytics",{enumerable:!0,get:function(){return t.Analytics}})})(),n})()));
|
package/lib/growthbook.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { Context, GrowthBook } from '@growthbook/growthbook';
|
2
|
+
import { RudderAnalytics } from '@rudderstack/analytics-js';
|
2
3
|
import { TGrowthbookAttributes } from './types';
|
3
4
|
export type GrowthbookConfigs = {
|
4
5
|
'tracking-buttons-config': Record<string, boolean>;
|
@@ -6,6 +7,7 @@ export type GrowthbookConfigs = {
|
|
6
7
|
[key: string]: Record<string, boolean> | string | boolean | [];
|
7
8
|
};
|
8
9
|
export declare class Growthbook {
|
10
|
+
analytics: RudderAnalytics;
|
9
11
|
GrowthBook: GrowthBook<GrowthbookConfigs>;
|
10
12
|
private static _instance;
|
11
13
|
constructor(clientKey: string, decryptionKey: string, settings?: Partial<Context>);
|
package/lib/growthbook.js
CHANGED
@@ -10,38 +10,16 @@ var __assign = (this && this.__assign) || function () {
|
|
10
10
|
};
|
11
11
|
return __assign.apply(this, arguments);
|
12
12
|
};
|
13
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
14
|
-
if (k2 === undefined) k2 = k;
|
15
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
16
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
17
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
18
|
-
}
|
19
|
-
Object.defineProperty(o, k2, desc);
|
20
|
-
}) : (function(o, m, k, k2) {
|
21
|
-
if (k2 === undefined) k2 = k;
|
22
|
-
o[k2] = m[k];
|
23
|
-
}));
|
24
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
25
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
26
|
-
}) : function(o, v) {
|
27
|
-
o["default"] = v;
|
28
|
-
});
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
30
|
-
if (mod && mod.__esModule) return mod;
|
31
|
-
var result = {};
|
32
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
33
|
-
__setModuleDefault(result, mod);
|
34
|
-
return result;
|
35
|
-
};
|
36
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
37
14
|
exports.Growthbook = void 0;
|
38
15
|
var growthbook_1 = require("@growthbook/growthbook");
|
39
|
-
var
|
16
|
+
var analytics_js_1 = require("@rudderstack/analytics-js");
|
40
17
|
var Growthbook = /** @class */ (function () {
|
41
18
|
// we have to pass settings due the specific framework implementation
|
42
19
|
function Growthbook(clientKey, decryptionKey, settings) {
|
43
20
|
if (settings === void 0) { settings = {}; }
|
44
21
|
var _this = this;
|
22
|
+
this.analytics = new analytics_js_1.RudderAnalytics();
|
45
23
|
this.setAttributes = function (_a) {
|
46
24
|
var id = _a.id, country = _a.country, user_language = _a.user_language, device_language = _a.device_language, device_type = _a.device_type, utm_source = _a.utm_source, utm_medium = _a.utm_medium, utm_campaign = _a.utm_campaign, is_authorised = _a.is_authorised, url = _a.url, domain = _a.domain, utm_content = _a.utm_content;
|
47
25
|
var CURRENT_ATTRIBUTES = _this.GrowthBook.getAttributes();
|
@@ -59,12 +37,12 @@ var Growthbook = /** @class */ (function () {
|
|
59
37
|
window.dataLayer.push({
|
60
38
|
event: 'experiment_viewed',
|
61
39
|
event_category: 'experiment',
|
62
|
-
rudder_anonymous_id:
|
40
|
+
rudder_anonymous_id: _this.analytics.getAnonymousId(),
|
63
41
|
experiment_id: experiment.key,
|
64
42
|
variation_id: result.variationId,
|
65
43
|
});
|
66
44
|
}
|
67
|
-
|
45
|
+
_this.analytics.track('experiment_viewed', {
|
68
46
|
experimentId: experiment.key,
|
69
47
|
variationId: result.variationId,
|
70
48
|
});
|
package/lib/rudderstack.d.ts
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
import { RudderAnalytics } from '@rudderstack/analytics-js';
|
1
2
|
import { TCoreAttributes, TEvents } from './types';
|
2
3
|
export declare class RudderStack {
|
4
|
+
analytics: RudderAnalytics;
|
3
5
|
has_identified: boolean;
|
4
6
|
has_initialized: boolean;
|
5
7
|
current_page: string;
|
@@ -9,11 +11,11 @@ export declare class RudderStack {
|
|
9
11
|
/**
|
10
12
|
* @returns The anonymous ID assigned to the user before the identify event was called
|
11
13
|
*/
|
12
|
-
getAnonymousId: () => string;
|
14
|
+
getAnonymousId: () => string | undefined;
|
13
15
|
/**
|
14
16
|
* @returns The user ID that was assigned to the user after calling identify event
|
15
17
|
*/
|
16
|
-
getUserId: () => string;
|
18
|
+
getUserId: () => (string | null) | undefined;
|
17
19
|
/**
|
18
20
|
* Initializes the Rudderstack SDK. Ensure that the appropriate environment variables are set before this is called.
|
19
21
|
* For local/staging environment, ensure that `RUDDERSTACK_STAGING_KEY` and `RUDDERSTACK_URL` is set.
|
package/lib/rudderstack.js
CHANGED
@@ -1,44 +1,22 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
15
|
-
}) : function(o, v) {
|
16
|
-
o["default"] = v;
|
17
|
-
});
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
24
|
-
};
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
3
|
exports.RudderStack = void 0;
|
27
|
-
var
|
4
|
+
var analytics_js_1 = require("@rudderstack/analytics-js");
|
28
5
|
var RudderStack = /** @class */ (function () {
|
29
6
|
function RudderStack(RUDDERSTACK_KEY) {
|
30
7
|
var _this = this;
|
8
|
+
this.analytics = new analytics_js_1.RudderAnalytics();
|
31
9
|
this.has_identified = false;
|
32
10
|
this.has_initialized = false;
|
33
11
|
this.current_page = '';
|
34
12
|
/**
|
35
13
|
* @returns The anonymous ID assigned to the user before the identify event was called
|
36
14
|
*/
|
37
|
-
this.getAnonymousId = function () { return
|
15
|
+
this.getAnonymousId = function () { return _this.analytics.getAnonymousId(); };
|
38
16
|
/**
|
39
17
|
* @returns The user ID that was assigned to the user after calling identify event
|
40
18
|
*/
|
41
|
-
this.getUserId = function () { return
|
19
|
+
this.getUserId = function () { return _this.analytics.getUserId(); };
|
42
20
|
/**
|
43
21
|
* Initializes the Rudderstack SDK. Ensure that the appropriate environment variables are set before this is called.
|
44
22
|
* For local/staging environment, ensure that `RUDDERSTACK_STAGING_KEY` and `RUDDERSTACK_URL` is set.
|
@@ -46,8 +24,8 @@ var RudderStack = /** @class */ (function () {
|
|
46
24
|
*/
|
47
25
|
this.init = function (RUDDERSTACK_KEY) {
|
48
26
|
if (RUDDERSTACK_KEY) {
|
49
|
-
|
50
|
-
|
27
|
+
_this.analytics.load(RUDDERSTACK_KEY, 'https://deriv-dataplane.rudderstack.com');
|
28
|
+
_this.analytics.ready(function () {
|
51
29
|
_this.has_initialized = true;
|
52
30
|
_this.has_identified = !!(_this.getUserId() || !!_this.getAnonymousId());
|
53
31
|
});
|
@@ -59,7 +37,7 @@ var RudderStack = /** @class */ (function () {
|
|
59
37
|
* @param payload Additional information passed to identify the user
|
60
38
|
*/
|
61
39
|
this.identifyEvent = function (user_id, payload) {
|
62
|
-
|
40
|
+
_this.analytics.identify(user_id, payload);
|
63
41
|
_this.has_identified = true;
|
64
42
|
};
|
65
43
|
/**
|
@@ -70,7 +48,7 @@ var RudderStack = /** @class */ (function () {
|
|
70
48
|
this.pageView = function (current_page, platform, user_id) {
|
71
49
|
if (platform === void 0) { platform = 'Deriv App'; }
|
72
50
|
if (_this.has_initialized && _this.has_identified && current_page !== _this.current_page) {
|
73
|
-
|
51
|
+
_this.analytics.page(platform, current_page, { user_id: user_id });
|
74
52
|
_this.current_page = current_page;
|
75
53
|
}
|
76
54
|
};
|
@@ -79,7 +57,7 @@ var RudderStack = /** @class */ (function () {
|
|
79
57
|
*/
|
80
58
|
this.reset = function () {
|
81
59
|
if (_this.has_initialized) {
|
82
|
-
|
60
|
+
_this.analytics.reset();
|
83
61
|
_this.has_identified = false;
|
84
62
|
}
|
85
63
|
};
|
@@ -97,7 +75,7 @@ var RudderStack = /** @class */ (function () {
|
|
97
75
|
}));
|
98
76
|
if (_this.has_initialized && _this.has_identified) {
|
99
77
|
try {
|
100
|
-
|
78
|
+
_this.analytics.track(event, clean_payload);
|
101
79
|
}
|
102
80
|
catch (err) {
|
103
81
|
console.error(err);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@deriv-com/analytics",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.7.0-beta.2",
|
4
4
|
"description": "The analytics package contains all the utility functions used for tracking user events and sending them to the respective platform such as Rudderstack.",
|
5
5
|
"keywords": [
|
6
6
|
"rudderstack",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
"publishConfig": {
|
12
12
|
"access": "public"
|
13
13
|
},
|
14
|
-
"author": "Amir Ali, Addriene, Nikita",
|
14
|
+
"author": "Amir Ali, Addriene, Nikita,Aswathy",
|
15
15
|
"main": "lib/index.js",
|
16
16
|
"types": "lib/index.d.ts",
|
17
17
|
"scripts": {
|
@@ -49,8 +49,8 @@
|
|
49
49
|
"webpack-cli": "^5.1.4"
|
50
50
|
},
|
51
51
|
"dependencies": {
|
52
|
-
"@growthbook/growthbook": "^0.
|
53
|
-
"
|
52
|
+
"@growthbook/growthbook": "^1.0.1",
|
53
|
+
"@rudderstack/analytics-js": "^3.3.0"
|
54
54
|
},
|
55
55
|
"engines": {
|
56
56
|
"node": "18.x",
|