From 15cae49e733220c5ea81dd7a76fff413bb3f256c Mon Sep 17 00:00:00 2001 From: sandeepdigumarty Date: Tue, 19 Mar 2024 11:01:20 +0530 Subject: [PATCH 1/5] fix: updated isLoaded and isReady conditions for mixpanel --- __tests__/prodsdk.js | 2 ++ .../src/integrations/Mixpanel/browser.js | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 __tests__/prodsdk.js diff --git a/__tests__/prodsdk.js b/__tests__/prodsdk.js new file mode 100644 index 0000000000..c9eb4d80c1 --- /dev/null +++ b/__tests__/prodsdk.js @@ -0,0 +1,2 @@ +rudderanalytics=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 n(e){for(var n=1;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n4096)&&(e=4096,F=crypto.getRandomValues(new Uint8Array(e)),U=0);for(var t,n=0,r="";n<16;n++)t=F[U+n],r+=6==n?j[15&t|64]:8==n?j[63&t|128]:j[t],1&n&&n>1&&n<11&&(r+="-");return U+=16,r}var K,H,z,Q,q,V,W,Y,X,J,$,Z,ee,te,ne,re,ie,oe,se,ae,ue,ce,le,fe,he,de,pe,ge,ye,ve,me,Ie,ke,be,Ae,Ee,Ce,Se,Te,we,Oe,_e,Re,Pe,De,Le,xe,Me,Be,Ne,Fe,je,Ue,Ge,Ke,He,ze,Qe,qe,Ve,We,Ye,Xe,Je,$e,Ze,et,tt,nt,rt,it,ot,st,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=(K={"Adobe Analytics":ct,ADOBEANALYTICS:ct,"ADOBE ANALYTICS":ct},a(K,ct,ct),a(K,"AdobeAnalytics",ct),a(K,"adobeanalytics",ct),a(K,"adobe analytics",ct),a(K,"Adobe analytics",ct),a(K,"adobe Analytics",ct),K),ft="AM",ht=(H={},a(H,ft,ft),a(H,"AMPLITUDE",ft),a(H,"Amplitude",ft),a(H,"am",ft),H),dt="APPCUES",pt=(z={},a(z,dt,dt),a(z,"Appcues",dt),a(z,"App Cues",dt),a(z,"appcues",dt),z),gt="BINGADS",yt=(Q={},a(Q,gt,gt),a(Q,"BingAds",gt),a(Q,"bingads",gt),a(Q,"Bing Ads",gt),a(Q,"Bing ads",gt),a(Q,"bing Ads",gt),a(Q,"bing ads",gt),Q),vt="BRAZE",mt=(q={},a(q,vt,vt),a(q,"Braze",vt),a(q,"braze",vt),q),It="BUGSNAG",kt=(V={},a(V,It,It),a(V,"bugsnag",It),a(V,"Bugsnag",It),V),bt="CHARTBEAT",At=(W={},a(W,bt,bt),a(W,"Chartbeat",bt),a(W,"chartbeat",bt),a(W,"Chart Beat",bt),a(W,"chart beat",bt),W),Et="CLEVERTAP",Ct=(Y={},a(Y,Et,Et),a(Y,"Clevertap",Et),a(Y,"clevertap",Et),Y),St="COMSCORE",Tt=(X={},a(X,St,St),a(X,"Comscore",St),a(X,"Com Score",St),a(X,"com Score",St),a(X,"com score",St),a(X,"Com score",St),X),wt="CRITEO",Ot=(J={},a(J,wt,wt),a(J,"Criteo",wt),a(J,"criteo",wt),J),_t="CUSTOMERIO",Rt=($={},a($,_t,_t),a($,"Customerio",_t),a($,"Customer.io",_t),a($,"CUSTOMER.IO",_t),a($,"customer.io",_t),$),Pt="DRIP",Dt=(Z={},a(Z,Pt,Pt),a(Z,"Drip",Pt),a(Z,"drip",Pt),Z),Lt="FACEBOOK_PIXEL",xt=(ee={},a(ee,Lt,Lt),a(ee,"FB Pixel",Lt),a(ee,"Facebook Pixel",Lt),a(ee,"facebook pixel",Lt),a(ee,"fbpixel",Lt),a(ee,"FBPIXEL",Lt),a(ee,"FB_PIXEL",Lt),ee),Mt="FULLSTORY",Bt=(te={},a(te,Mt,Mt),a(te,"Fullstory",Mt),a(te,"FullStory",Mt),a(te,"full Story",Mt),a(te,"Full Story",Mt),a(te,"Full story",Mt),a(te,"full story",Mt),a(te,"fullstory",Mt),te),Nt="GA",Ft=(ne={},a(ne,Nt,Nt),a(ne,"Google Analytics",Nt),a(ne,"GoogleAnalytics",Nt),a(ne,"GOOGLE ANALYTICS",Nt),a(ne,"google analytics",Nt),ne),jt="GA4",Ut=(re={},a(re,jt,jt),a(re,"Google Analytics 4",jt),a(re,"Google analytics 4",jt),a(re,"google analytics 4",jt),a(re,"Google Analytics4",jt),a(re,"Google analytics4",jt),a(re,"google analytics4",jt),a(re,"GoogleAnalytics4",jt),re),Gt="GOOGLEADS",Kt=(ie={},a(ie,Gt,Gt),a(ie,"Google Ads",Gt),a(ie,"GoogleAds",Gt),a(ie,"GOOGLE ADS",Gt),a(ie,"google ads",Gt),a(ie,"googleads",Gt),ie),Ht="GOOGLE_OPTIMIZE",zt=(oe={},a(oe,Ht,Ht),a(oe,"Google Optimize",Ht),a(oe,"GoogleOptimize",Ht),a(oe,"Googleoptimize",Ht),a(oe,"GOOGLEOPTIMIZE",Ht),a(oe,"google optimize",Ht),a(oe,"Google optimize",Ht),a(oe,"GOOGLE OPTIMIZE",Ht),oe),Qt="GTM",qt=(a(se={},Qt,Qt),a(se,"Google Tag Manager",Qt),a(se,"google tag manager",Qt),a(se,"googletag manager",Qt),a(se,"googletagmanager",Qt),se),Vt="HEAP",Wt=(a(ae={},Vt,Vt),a(ae,"Heap",Vt),a(ae,"heap",Vt),a(ae,"Heap.io",Vt),ae),Yt="HOTJAR",Xt=(a(ue={},Yt,Yt),a(ue,"Hotjar",Yt),a(ue,"hotjar",Yt),a(ue,"Hot Jar",Yt),a(ue,"hot jar",Yt),ue),Jt="HS",$t=(a(ce={},Jt,Jt),a(ce,"Hubspot",Jt),a(ce,"HUBSPOT",Jt),a(ce,"hub spot",Jt),a(ce,"Hub Spot",Jt),a(ce,"Hub spot",Jt),ce),Zt="INTERCOM",en=(a(le={},Zt,Zt),a(le,"Intercom",Zt),a(le,"intercom",Zt),le),tn="KEEN",nn=(a(fe={},tn,tn),a(fe,"Keen",tn),a(fe,"Keen.io",tn),a(fe,"keen",tn),a(fe,"keen.io",tn),fe),rn="KISSMETRICS",on=(a(he={},rn,rn),a(he,"Kissmetrics",rn),a(he,"kissmetrics",rn),he),sn="KLAVIYO",an=(a(de={},sn,sn),a(de,"Klaviyo",sn),a(de,"klaviyo",sn),de),un="LAUNCHDARKLY",cn=(a(pe={},un,un),a(pe,"LaunchDarkly",un),a(pe,"Launch_Darkly",un),a(pe,"Launch Darkly",un),a(pe,"launchDarkly",un),a(pe,"launch darkly",un),pe),ln="LINKEDIN_INSIGHT_TAG",fn=(a(ge={},ln,ln),a(ge,"LinkedIn Insight Tag",ln),a(ge,"LinkedIn insight tag",ln),a(ge,"linkedIn insight tag",ln),a(ge,"Linkedin_insight_tag",ln),a(ge,"LinkedinInsighttag",ln),a(ge,"LinkedinInsightTag",ln),a(ge,"LinkedInInsightTag",ln),a(ge,"Linkedininsighttag",ln),a(ge,"LINKEDININSIGHTTAG",ln),a(ge,"linkedininsighttag",ln),ge),hn="LOTAME",dn=(a(ye={},hn,hn),a(ye,"Lotame",hn),a(ye,"lotame",hn),ye),pn="LYTICS",gn=(a(ve={},pn,pn),a(ve,"Lytics",pn),a(ve,"lytics",pn),ve),yn="MP",vn=(a(me={},yn,yn),a(me,"MIXPANEL",yn),a(me,"Mixpanel",yn),a(me,"MIX PANEL",yn),a(me,"Mix panel",yn),a(me,"Mix Panel",yn),me),mn="MOENGAGE",In=(a(Ie={},mn,mn),a(Ie,"MoEngage",mn),a(Ie,"moengage",mn),a(Ie,"Moengage",mn),a(Ie,"Mo Engage",mn),a(Ie,"mo engage",mn),a(Ie,"Mo engage",mn),Ie),kn="OPTIMIZELY",bn=(a(ke={},kn,kn),a(ke,"Optimizely",kn),a(ke,"optimizely",kn),ke),An="PENDO",En=(a(be={},An,An),a(be,"Pendo",An),a(be,"pendo",An),be),Cn="PINTEREST_TAG",Sn=(a(Ae={},Cn,Cn),a(Ae,"PinterestTag",Cn),a(Ae,"Pinterest_Tag",Cn),a(Ae,"PINTERESTTAG",Cn),a(Ae,"pinterest",Cn),a(Ae,"PinterestAds",Cn),a(Ae,"Pinterest_Ads",Cn),a(Ae,"Pinterest",Cn),a(Ae,"Pinterest Tag",Cn),a(Ae,"Pinterest tag",Cn),a(Ae,"PINTEREST TAG",Cn),a(Ae,"pinterest tag",Cn),a(Ae,"Pinterest Ads",Cn),a(Ae,"Pinterest ads",Cn),Ae),Tn="POST_AFFILIATE_PRO",wn=(a(Ee={},Tn,Tn),a(Ee,"PostAffiliatePro",Tn),a(Ee,"Post_affiliate_pro",Tn),a(Ee,"Post Affiliate Pro",Tn),a(Ee,"Post affiliate pro",Tn),a(Ee,"post affiliate pro",Tn),a(Ee,"postaffiliatepro",Tn),a(Ee,"POSTAFFILIATEPRO",Tn),Ee),On="POSTHOG",_n=(a(Ce={},On,On),a(Ce,"PostHog",On),a(Ce,"Posthog",On),a(Ce,"posthog",On),a(Ce,"Post Hog",On),a(Ce,"Post hog",On),a(Ce,"post hog",On),Ce),Rn="PROFITWELL",Pn=(a(Se={},Rn,Rn),a(Se,"ProfitWell",Rn),a(Se,"profitwell",Rn),a(Se,"Profitwell",Rn),a(Se,"Profit Well",Rn),a(Se,"profit well",Rn),a(Se,"Profit well",Rn),Se),Dn="QUALTRICS",Ln=(a(Te={},Dn,Dn),a(Te,"Qualtrics",Dn),a(Te,"qualtrics",Dn),Te),xn="QUANTUMMETRIC",Mn=(a(we={},xn,xn),a(we,"Quantum Metric",xn),a(we,"quantum Metric",xn),a(we,"quantum metric",xn),a(we,"QuantumMetric",xn),a(we,"quantumMetric",xn),a(we,"quantummetric",xn),a(we,"Quantum_Metric",xn),we),Bn="REDDIT_PIXEL",Nn=(a(Oe={},Bn,Bn),a(Oe,"Reddit_Pixel",Bn),a(Oe,"RedditPixel",Bn),a(Oe,"REDDITPIXEL",Bn),a(Oe,"redditpixel",Bn),a(Oe,"Reddit Pixel",Bn),a(Oe,"REDDIT PIXEL",Bn),a(Oe,"reddit pixel",Bn),Oe),Fn="SENTRY",jn=(a(_e={},Fn,Fn),a(_e,"sentry",Fn),a(_e,"Sentry",Fn),_e),Un="SNAP_PIXEL",Gn=(a(Re={},Un,Un),a(Re,"Snap_Pixel",Un),a(Re,"SnapPixel",Un),a(Re,"SNAPPIXEL",Un),a(Re,"snappixel",Un),a(Re,"Snap Pixel",Un),a(Re,"SNAP PIXEL",Un),a(Re,"snap pixel",Un),Re),Kn="TVSQUARED",Hn=(a(Pe={},Kn,Kn),a(Pe,"TVSquared",Kn),a(Pe,"tvsquared",Kn),a(Pe,"tvSquared",Kn),a(Pe,"TvSquared",Kn),a(Pe,"Tvsquared",Kn),a(Pe,"TV Squared",Kn),a(Pe,"tv squared",Kn),a(Pe,"tv Squared",Kn),Pe),zn="VWO",Qn=(a(De={},zn,zn),a(De,"VisualWebsiteOptimizer",zn),a(De,"Visualwebsiteoptimizer",zn),a(De,"visualwebsiteoptimizer",zn),a(De,"vwo",zn),a(De,"Visual Website Optimizer",zn),a(De,"Visual website optimizer",zn),a(De,"visual website optimizer",zn),De),qn="GA360",Vn=(a(Le={},qn,qn),a(Le,"Google Analytics 360",qn),a(Le,"Google analytics 360",qn),a(Le,"google analytics 360",qn),a(Le,"Google Analytics360",qn),a(Le,"Google analytics360",qn),a(Le,"google analytics360",qn),a(Le,"GoogleAnalytics360",qn),a(Le,"GA 360",qn),Le),Wn="ADROLL",Yn=(a(xe={},Wn,Wn),a(xe,"Adroll",Wn),a(xe,"Ad roll",Wn),a(xe,"ad roll",Wn),a(xe,"adroll",Wn),xe),Xn="DCM_FLOODLIGHT",Jn=(a(Me={},Xn,Xn),a(Me,"DCM Floodlight",Xn),a(Me,"dcm floodlight",Xn),a(Me,"Dcm Floodlight",Xn),a(Me,"DCMFloodlight",Xn),a(Me,"dcmfloodlight",Xn),a(Me,"DcmFloodlight",Xn),a(Me,"dcm_floodlight",Xn),a(Me,"DCM_Floodlight",Xn),Me),$n="MATOMO",Zn=(a(Be={},$n,$n),a(Be,"Matomo",$n),a(Be,"matomo",$n),Be),er="VERO",tr=(a(Ne={},er,er),a(Ne,"Vero",er),a(Ne,"vero",er),Ne),nr="MOUSEFLOW",rr=(a(Fe={},nr,nr),a(Fe,"Mouseflow",nr),a(Fe,"mouseflow",nr),a(Fe,"mouseFlow",nr),a(Fe,"MouseFlow",nr),a(Fe,"Mouse flow",nr),a(Fe,"mouse flow",nr),a(Fe,"mouse Flow",nr),a(Fe,"Mouse Flow",nr),Fe),ir="ROCKERBOX",or=(a(je={},ir,ir),a(je,"Rockerbox",ir),a(je,"rockerbox",ir),a(je,"RockerBox",ir),a(je,"Rocker box",ir),a(je,"rocker box",ir),a(je,"Rocker Box",ir),je),sr="CONVERTFLOW",ar=(a(Ue={},sr,sr),a(Ue,"Convertflow",sr),a(Ue,"convertflow",sr),a(Ue,"convertFlow",sr),a(Ue,"ConvertFlow",sr),a(Ue,"Convert flow",sr),a(Ue,"convert flow",sr),a(Ue,"convert Flow",sr),a(Ue,"Convert Flow",sr),a(Ue,"CONVERT FLOW",sr),Ue),ur="SNAPENGAGE",cr=(a(Ge={},ur,ur),a(Ge,"SnapEngage",ur),a(Ge,"Snap_Engage",ur),a(Ge,"snapengage",ur),a(Ge,"SNAP ENGAGE",ur),a(Ge,"Snap Engage",ur),a(Ge,"snap engage",ur),Ge),lr="LIVECHAT",fr=(a(Ke={},lr,lr),a(Ke,"LiveChat",lr),a(Ke,"Live_Chat",lr),a(Ke,"livechat",lr),a(Ke,"LIVE CHAT",lr),a(Ke,"Live Chat",lr),a(Ke,"live chat",lr),Ke),hr="SHYNET",dr=(a(He={},hr,hr),a(He,"shynet",hr),a(He,"ShyNet",hr),a(He,"shyNet",hr),a(He,"Shynet",hr),a(He,"shy net",hr),a(He,"Shy Net",hr),a(He,"shy Net",hr),a(He,"Shy net",hr),He),pr="WOOPRA",gr=(a(ze={},pr,pr),a(ze,"Woopra",pr),a(ze,"woopra",pr),ze),yr="ROLLBAR",vr=(a(Qe={},yr,yr),a(Qe,"RollBar",yr),a(Qe,"Roll_Bar",yr),a(Qe,"rollbar",yr),a(Qe,"Rollbar",yr),a(Qe,"ROLL BAR",yr),a(Qe,"Roll Bar",yr),a(Qe,"roll bar",yr),Qe),mr="QUORA_PIXEL",Ir=(a(qe={},mr,mr),a(qe,"Quora Pixel",mr),a(qe,"Quora pixel",mr),a(qe,"QUORA PIXEL",mr),a(qe,"QuoraPixel",mr),a(qe,"Quorapixel",mr),a(qe,"QUORAPIXEL",mr),a(qe,"Quora_Pixel",mr),a(qe,"quora_pixel",mr),a(qe,"Quora",mr),qe),kr="JUNE",br=(a(Ve={},kr,kr),a(Ve,"June",kr),a(Ve,"june",kr),Ve),Ar="ENGAGE",Er=(a(We={},Ar,Ar),a(We,"Engage",Ar),a(We,"engage",Ar),We),Cr="ITERABLE",Sr=(a(Ye={},Cr,Cr),a(Ye,"Iterable",Cr),a(Ye,"iterable",Cr),Ye),Tr="YANDEX_METRICA",wr=(a(Xe={},Tr,Tr),a(Xe,"Yandexmetrica",Tr),a(Xe,"yandexmetrica",Tr),a(Xe,"yandexMetrica",Tr),a(Xe,"YandexMetrica",Tr),Xe),Or="REFINER",_r=(a(Je={},Or,Or),a(Je,"Refiner",Or),a(Je,"refiner",Or),Je),Rr="QUALAROO",Pr=(a($e={},Rr,Rr),a($e,"Qualaroo",Rr),a($e,"qualaroo",Rr),$e),Dr="PODSIGHTS",Lr=(a(Ze={},Dr,Dr),a(Ze,"Podsights",Dr),a(Ze,"PodSights",Dr),a(Ze,"pod Sights",Dr),a(Ze,"Pod Sights",Dr),a(Ze,"pod sights",Dr),a(Ze,"POD SIGHTS",Dr),a(Ze,"Pod sights",Dr),Ze),xr="AXEPTIO",Mr=(a(et={},xr,xr),a(et,"Axeptio",xr),a(et,"axeptio",xr),et),Br="SATISMETER",Nr=(a(tt={},Br,Br),a(tt,"Satismeter",Br),a(tt,"SatisMeter",Br),a(tt,"SATISMETER",Br),tt),Fr="MICROSOFT_CLARITY",jr=(a(nt={},Fr,Fr),a(nt,"Microsoft Clarity",Fr),a(nt,"Microsoft clarity",Fr),a(nt,"microsoft clarity",Fr),a(nt,"Microsoft_clarity",Fr),a(nt,"MicrosoftClarity",Fr),a(nt,"MICROSOFTCLARITY",Fr),a(nt,"microsoftclarity",Fr),a(nt,"microsoftClarity",Fr),nt),Ur="SENDINBLUE",Gr=(a(rt={},Ur,Ur),a(rt,"Sendinblue",Ur),a(rt,"sendinblue",Ur),a(rt,"SendinBlue",Ur),rt),Kr="OLARK",Hr=(a(it={},Kr,Kr),a(it,"Olark",Kr),a(it,"olark",Kr),it),zr="LEMNISK",Qr=(a(ot={},zr,zr),a(ot,"LEMNISK_MARKETING_AUTOMATION",zr),a(ot,"Lemnisk Marketing Automation",zr),a(ot,"LemniskMarketingAutomation",zr),a(ot,"lemniskmarketingautomation",zr),a(ot,"lemniskMarketingAutomation",zr),a(ot,"lemnisk",zr),a(ot,"Lemnisk",zr),ot),qr="TIKTOK_ADS",Vr=(a(st={},qr,qr),a(st,"TiktokAds",qr),a(st,"TIKTOK_ADS",qr),a(st,"Tiktok ads",qr),a(st,"Tiktok Ads",qr),a(st,"Tik Tok Ads",qr),a(st,"tik tok ads",qr),a(st,"tiktokads",qr),st),Wr=n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n({All:"All"},lt),ht),pt),yt),mt),kt),At),Ct),Tt),Ot),Rt),Dt),xt),Bt),Ft),Ut),Vn),Kt),zt),qt),Wt),Xt),$t),en),nn),on),an),cn),fn),dn),gn),vn),In),bn),En),Sn),wn),_n),Pn),Ln),Mn),Nn),jn),Gn),Hn),Qn),Yn),Jn),Zn),tr),rr),ar),cr),fr),dr),gr),vr),Ir),br),Er),Sr),or),wr),_r),Pr),Lr),Mr),Nr),jr),Gr),Hr),Qr),Vr),Yr={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"},Xr=["anonymous_id","id","sent_at","received_at","timestamp","original_timestamp","event_text","event"],Jr="https://api.rudderlabs.com/sourceConfig/?p=cdn&v=2.37.0",$r="v1.1",Zr="js-integrations",ei="".concat("https://cdn.rudderlabs.com","/").concat($r,"/").concat(Zr),ti=1e4,ni=1e3,ri="_RS",ii=["Lax","None","Strict"],oi=["US","EU"],si=["oneTrust","ketch"],ai=["library","consentManagement"],ui=["none","default","full"],ci={All:!0},li="Request failed with status:",fi=[li],hi=function(e){var t=window.rudderanalytics&&window.rudderanalytics.errorReporting;t&&e instanceof Error&&t.notify(e)},di=function(e,t){if(!Array.isArray(e)||!Array.isArray(t))return S(t);var n=S(e);return t.forEach((function(e,t){n[t]=pi(n[t],e)})),n},pi=function(e,t){return O(di,e,t)},gi=function(e,t){return JSON.stringify(e,function(e){var t=[];return function(n,i){if(!e||null!=i){if("object"!==r(i)||null===i)return i;for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?(ut.debug("Circular Reference detected for key: ".concat(n)),"[Circular Reference]"):(t.push(i),i)}}}(t))},yi=function(e,t,n){var i,o;try{i="string"==typeof e?e:e instanceof Error||e.message?e.message:gi(e)}catch(e){i=""}if("object"===r(o=e)&&null!==o&&"target"in o){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(i="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:i},n.sendAdblockPageOptions),""}return"[handleError]::".concat(t||"",' "').concat(i,'"')},vi=function(e,t,n){var r;try{r=yi(e,t,n)}catch(t){ut.error("[handleError] Exception:: ",t),ut.error("[handleError] Original error:: ",gi(e)),hi(t)}r&&(ut.error(r),function(e){return!e.message||!fi.some((function(t){return e.message.includes(t)}))}(e)&&hi(e))};function mi(e){return e&&e.endsWith("/")?e.replace(/\/+$/,""):e}function Ii(){return window.crypto&&"function"==typeof window.crypto.getRandomValues?G():function(){var e,t=0,n="";if(!x||B+16>256){for(x=Array(t=256);t--;)x[t]=256*Math.random()|0;t=B=0}for(;t<16;t++)e=x[B+t],n+=6==t?N[15&e|64]:8==t?N[63&e|128]:N[e],1&t&&t>1&&t<11&&(n+="-");return B++,n}()}function ki(){return(new Date).toISOString()}function bi(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 Ai(e){bi(e,Wr)}function Ei(e){bi(e,Yr)}function Ci(e,t){var n=[];if(!t||0===t.length)return n;var i=!0;void 0!==e.All&&(i=e.All);var o=[];return"string"==typeof t[0]?t.forEach((function(e){o.push({intgName:e,intObj:e})})):"object"===r(t[0])&&t.forEach((function(e){o.push({intgName:e.name,intObj:e})})),o.forEach((function(t){var r=t.intgName,o=t.intObj;if(i){var s=!0;null!=e[r]&&0==e[r]&&(s=!1),s&&n.push(o)}else null!=e[r]&&1==e[r]&&n.push(o)})),n}var Si,Ti=function(){for(var e,t=document.getElementsByTagName("script"),n=!1,r=0;r>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(o=0;o>>2]=n[o>>>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=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,r=[],i=function(t){var n=987654321,r=4294967295;return function(){var i=((n=36969*(65535&n)+(n>>16)&r)<<16)+(t=18e3*(65535&t)+(t>>16)&r)&r;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},o=0;o>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new s.init(n,t/2)}},c=a.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new s.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,i=n.sigBytes,o=this.blockSize,a=i/(4*o),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,c=e.min(4*u,i);if(u){for(var l=0;l>>6-s%4*2;i[o>>>2]|=(a|u)<<24-o%4*8,o++}return n.create(i,o)}t.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>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 o=0;o>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=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],I=e[t+8],k=e[t+9],b=e[t+10],A=e[t+11],E=e[t+12],C=e[t+13],S=e[t+14],T=e[t+15],w=o[0],O=o[1],_=o[2],R=o[3];w=c(w,O,_,R,s,7,a[0]),R=c(R,w,O,_,u,12,a[1]),_=c(_,R,w,O,d,17,a[2]),O=c(O,_,R,w,p,22,a[3]),w=c(w,O,_,R,g,7,a[4]),R=c(R,w,O,_,y,12,a[5]),_=c(_,R,w,O,v,17,a[6]),O=c(O,_,R,w,m,22,a[7]),w=c(w,O,_,R,I,7,a[8]),R=c(R,w,O,_,k,12,a[9]),_=c(_,R,w,O,b,17,a[10]),O=c(O,_,R,w,A,22,a[11]),w=c(w,O,_,R,E,7,a[12]),R=c(R,w,O,_,C,12,a[13]),_=c(_,R,w,O,S,17,a[14]),w=l(w,O=c(O,_,R,w,T,22,a[15]),_,R,u,5,a[16]),R=l(R,w,O,_,v,9,a[17]),_=l(_,R,w,O,A,14,a[18]),O=l(O,_,R,w,s,20,a[19]),w=l(w,O,_,R,y,5,a[20]),R=l(R,w,O,_,b,9,a[21]),_=l(_,R,w,O,T,14,a[22]),O=l(O,_,R,w,g,20,a[23]),w=l(w,O,_,R,k,5,a[24]),R=l(R,w,O,_,S,9,a[25]),_=l(_,R,w,O,p,14,a[26]),O=l(O,_,R,w,I,20,a[27]),w=l(w,O,_,R,C,5,a[28]),R=l(R,w,O,_,d,9,a[29]),_=l(_,R,w,O,m,14,a[30]),w=f(w,O=l(O,_,R,w,E,20,a[31]),_,R,y,4,a[32]),R=f(R,w,O,_,I,11,a[33]),_=f(_,R,w,O,A,16,a[34]),O=f(O,_,R,w,S,23,a[35]),w=f(w,O,_,R,u,4,a[36]),R=f(R,w,O,_,g,11,a[37]),_=f(_,R,w,O,m,16,a[38]),O=f(O,_,R,w,b,23,a[39]),w=f(w,O,_,R,C,4,a[40]),R=f(R,w,O,_,s,11,a[41]),_=f(_,R,w,O,p,16,a[42]),O=f(O,_,R,w,v,23,a[43]),w=f(w,O,_,R,k,4,a[44]),R=f(R,w,O,_,E,11,a[45]),_=f(_,R,w,O,T,16,a[46]),w=h(w,O=f(O,_,R,w,d,23,a[47]),_,R,s,6,a[48]),R=h(R,w,O,_,m,10,a[49]),_=h(_,R,w,O,S,15,a[50]),O=h(O,_,R,w,y,21,a[51]),w=h(w,O,_,R,E,6,a[52]),R=h(R,w,O,_,p,10,a[53]),_=h(_,R,w,O,b,15,a[54]),O=h(O,_,R,w,u,21,a[55]),w=h(w,O,_,R,I,6,a[56]),R=h(R,w,O,_,T,10,a[57]),_=h(_,R,w,O,v,15,a[58]),O=h(O,_,R,w,C,21,a[59]),w=h(w,O,_,R,g,6,a[60]),R=h(R,w,O,_,A,10,a[61]),_=h(_,R,w,O,d,15,a[62]),O=h(O,_,R,w,k,21,a[63]),o[0]=o[0]+w|0,o[1]=o[1]+O|0,o[2]=o[2]+_|0,o[3]=o[3]+R|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;n[i>>>5]|=128<<24-i%32;var o=t.floor(r/4294967296),s=r;n[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),e.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=o.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,n,r,i,o,s){var a=e+(t&n|~t&r)+i+s;return(a<>>32-o)+t}function l(e,t,n,r,i,o,s){var a=e+(t&r|n&~r)+i+s;return(a<>>32-o)+t}function f(e,t,n,r,i,o,s){var a=e+(t^n^r)+i+s;return(a<>>32-o)+t}function h(e,t,n,r,i,o,s){var a=e+(n^(t|~r))+i+s;return(a<>>32-o)+t}n.MD5=o._createHelper(u),n.HmacMD5=o._createHmacHelper(u)}(Math),e.MD5)),Ni.exports;var e}var ji,Ui={exports:{}},Gi={exports:{}};function Ki(){return ji||(ji=1,Gi.exports=(a=Di(),t=(e=a).lib,n=t.WordArray,r=t.Hasher,i=e.algo,o=[],s=i.SHA1=r.extend({_doReset:function(){this._hash=new n.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],a=n[3],u=n[4],c=0;c<80;c++){if(c<16)o[c]=0|e[t+c];else{var l=o[c-3]^o[c-8]^o[c-14]^o[c-16];o[c]=l<<1|l>>>31}var f=(r<<5|r>>>27)+u+o[c];f+=c<20?1518500249+(i&s|~i&a):c<40?1859775393+(i^s^a):c<60?(i&s|i&a|s&a)-1894007588:(i^s^a)-899497514,u=a,a=s,s=i<<30|i>>>2,i=r,r=f}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+s|0,n[3]=n[3]+a|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=r.clone.call(this);return e._hash=this._hash.clone(),e}}),e.SHA1=r._createHelper(s),e.HmacSHA1=r._createHmacHelper(s),a.SHA1)),Gi.exports;var e,t,n,r,i,o,s,a}var Hi,zi,Qi={exports:{}};function qi(){return zi||(zi=1,Ui.exports=function(e){return n=(t=e).lib,r=n.Base,i=n.WordArray,o=t.algo,s=o.MD5,a=o.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,r=n.hasher.create(),o=i.create(),s=o.words,a=n.keySize,u=n.iterations;s.lengthi&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),s=this._iKey=t.clone(),a=o.words,u=s.words,c=0;c>>8^255&p^99,i[n]=p,o[p]=n;var g=e[n],y=e[g],v=e[y],m=257*e[p]^16843008*p;s[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,f[p]=m<<16|m>>>16,h[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=n.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),o=this._keySchedule=[],s=0;s6&&s%n==4&&(a=i[a>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a]):(a=i[(a=a<<8|a>>>24)>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a],a^=p[s/n|0]<<24),o[s]=o[s-n]^a}for(var u=this._invKeySchedule=[],c=0;c>>24]]^f[i[a>>>16&255]]^h[i[a>>>8&255]]^d[i[255&a]]}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,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,f,h,d,o),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,o,s,a){for(var u=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],f=e[t+2]^n[2],h=e[t+3]^n[3],d=4,p=1;p>>24]^i[l>>>16&255]^o[f>>>8&255]^s[255&h]^n[d++],y=r[l>>>24]^i[f>>>16&255]^o[h>>>8&255]^s[255&c]^n[d++],v=r[f>>>24]^i[h>>>16&255]^o[c>>>8&255]^s[255&l]^n[d++],m=r[h>>>24]^i[c>>>16&255]^o[l>>>8&255]^s[255&f]^n[d++];c=g,l=y,f=v,h=m}g=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[f>>>8&255]<<8|a[255&h])^n[d++],y=(a[l>>>24]<<24|a[f>>>16&255]<<16|a[h>>>8&255]<<8|a[255&c])^n[d++],v=(a[f>>>24]<<24|a[h>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],m=(a[h>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&f])^n[d++],e[t]=g,e[t+1]=y,e[t+2]=v,e[t+3]=m},keySize:8});t.AES=n._createHelper(g)}(),e.AES}(Di(),Mi(),Fi(),qi(),Vi||(Vi=1,Yi.exports=(Wi=Di(),qi(),void(Wi.lib.Cipher||function(e){var t=Wi,n=t.lib,r=n.Base,i=n.WordArray,o=n.BufferedBlockAlgorithm,s=t.enc;s.Utf8;var a=s.Base64,u=t.algo.EvpKDF,c=n.Cipher=o.extend({cfg:r.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?m:y}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)}}}}()});n.StreamCipher=c.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=t.mode={},f=n.BlockCipherMode=r.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}}),h=l.CBC=function(){var t=f.extend();function n(t,n,r){var i=this._iv;if(i){var o=i;this._iv=e}else o=this._prevBlock;for(var s=0;s>>2];e.sigBytes-=t}};n.BlockCipher=c.extend({cfg:c.cfg.extend({mode:h,padding:d}),reset:function(){c.reset.call(this);var e=this.cfg,t=e.iv,n=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=n.createEncryptor;else r=n.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==r?this._mode.init(this,t&&t.words):(this._mode=r.call(n,this,t&&t.words),this._mode.__creator=r)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var p=n.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;if(n)var r=i.create([1398893684,1701076831]).concat(n).concat(t);else r=t;return r.toString(a)},parse:function(e){var t=a.parse(e),n=t.words;if(1398893684==n[0]&&1701076831==n[1]){var r=i.create(n.slice(2,4));n.splice(0,4),t.sigBytes-=16}return p.create({ciphertext:t,salt:r})}},y=n.SerializableCipher=r.extend({cfg:r.extend({format:g}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r),o=i.finalize(t),s=i.cfg;return p.create({ciphertext:o,key:n,iv:s.iv,algorithm:e,mode:s.mode,padding:s.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}}),v=(t.kdf={}).OpenSSL={execute:function(e,t,n,r){r||(r=i.random(8));var o=u.create({keySize:t+n}).compute(e,r),s=i.create(o.words.slice(t),4*n);return o.sigBytes=4*t,p.create({key:o,iv:s,salt:r})}},m=n.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:v}),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 o=y.encrypt.call(this,e,t,i.key,r);return o.mixIn(i),o},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,y.decrypt.call(this,e,t,i.key,r)}})}()))));var Xi=h(Ri.exports),Ji={exports:{}};!function(e,t){e.exports=function(e){return e.enc.Utf8}(Di())}(Ji);var $i=h(Ji.exports),Zi="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function eo(){throw new Error("setTimeout has not been defined")}function to(){throw new Error("clearTimeout has not been defined")}var no=eo,ro=to;function io(e){if(no===setTimeout)return setTimeout(e,0);if((no===eo||!no)&&setTimeout)return no=setTimeout,setTimeout(e,0);try{return no(e,0)}catch(t){try{return no.call(null,e,0)}catch(t){return no.call(this,e,0)}}}"function"==typeof Zi.setTimeout&&(no=setTimeout),"function"==typeof Zi.clearTimeout&&(ro=clearTimeout);var oo,so=[],ao=!1,uo=-1;function co(){ao&&oo&&(ao=!1,oo.length?so=oo.concat(so):uo=-1,so.length&&lo())}function lo(){if(!ao){var e=io(co);ao=!0;for(var t=so.length;t;){for(oo=so,so=[];++uo1)for(var n=1;n=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}return Co=function(u,c){c=c||{};var l=r(u);if("string"===l&&u.length>0)return function(r){if((r=String(r)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(!a)return;var u=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*s;case"weeks":case"week":case"w":return u*o;case"days":case"day":case"d":return u*i;case"hours":case"hour":case"hrs":case"hr":case"h":return u*n;case"minutes":case"minute":case"mins":case"min":case"m":return u*t;case"seconds":case"second":case"secs":case"sec":case"s":return u*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(u);if("number"===l&&isFinite(u))return c.long?function(r){var o=Math.abs(r);if(o>=i)return a(r,o,i,"day");if(o>=n)return a(r,o,n,"hour");if(o>=t)return a(r,o,t,"minute");if(o>=e)return a(r,o,e,"second");return r+" ms"}(u):function(r){var o=Math.abs(r);if(o>=i)return Math.round(r/i)+"d";if(o>=n)return Math.round(r/n)+"h";if(o>=t)return Math.round(r/t)+"m";if(o>=e)return Math.round(r/e)+"s";return r+"ms"}(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))},Co}var _o=function(e){function t(e){var r,i,o,s=null;function a(){for(var e=arguments.length,n=new Array(e),i=0;i=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=_o(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(wo,wo.exports);var Ro=wo.exports,Po=Ro("cookie"),Do=function(e,t,n){switch(arguments.length){case 3:case 2:return Lo(e,t,n);case 1:return Mo(e);default:return xo()}};function Lo(e,t,n){n=n||{};var r=Bo(e)+"="+Bo(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}function xo(){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=0;--i)r.push(t.slice(i).join("."));return r},r.cookie=n,t=e.exports=r}(ts,ts.exports);var cs=h(ts.exports),ls=function(){function e(t){i(this,e),this.cOpts={},this.options(t),this.isSupportAvailable=this.checkSupportAvailability()}return s(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(cs(window.location.href));return"."===t&&(t=null),this.cOpts=es(e,{maxage:31536e6,path:"/",domain:t,samesite:"Lax"}),this.cOpts}},{key:"set",value:function(e,t){try{return Fo(e,t,S(this.cOpts)),!0}catch(e){return ut.error(e),!1}}},{key:"get",value:function(e){return Fo(e)}},{key:"remove",value:function(e){try{return Fo(e,null,S(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}(),fs=new ls({}),hs={exports:{}};!function(e,t){e.exports=function(){function e(e){return e=JSON.stringify(e),!!/^\{[\s\S]*\}$/.test(e)}function t(e){return void 0===e||"function"==typeof e?e+"":JSON.stringify(e)}function n(e){if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e}}function r(e){return"[object Function]"==={}.toString.call(e)}function i(e){return"[object Array]"===Object.prototype.toString.call(e)}function o(e){var t="_Is_Incognit",n="yes";try{e||(e=window.localStorage),e.setItem(t,n),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{e.getItem(t)===n&&e.removeItem(t)}return e}var s=o();function a(){if(!(this instanceof a))return new a}a.prototype={set:function(n,r){if(n&&!e(n))s.setItem(n,t(r));else if(e(n))for(var i in n)this.set(i,n[i]);return this},get:function(e){if(!e){var t={};return this.forEach((function(e,n){return t[e]=n})),t}if("?"===e.charAt(0))return this.has(e.substr(1));var r=arguments;if(r.length>1){for(var i={},o=0,a=r.length;o-1&&(n[t[r]]=this.get(t[r]));return n}};var u=null;function c(t,n){var o=arguments,s=null;if(u||(u=a()),0===o.length)return u.get();if(1===o.length){if("string"==typeof t)return u.get(t);if(e(t))return u.set(t)}if(2===o.length&&"string"==typeof t){if(!n)return u.remove(t);if(n&&"string"==typeof n)return u.set(t,n);n&&r(n)&&(s=null,s=n(t,u.get(t)),c.set(t,s))}if(2===o.length&&i(t)&&r(n))for(var l=0,f=t.length;l0&&void 0!==arguments[0]?arguments[0]:{};return 0===arguments.length||(es(e,{enabled:!0}),this.enabled=e.enabled&&this.enabled,this.sOpts=e),this.sOpts}},{key:"set",value:function(e,t){return ds.set(e,t)}},{key:"get",value:function(e){return ds.get(e)}},{key:"remove",value:function(e){return ds.remove(e)}},{key:"checkSupportAvailability",value:function(){var e="test_rudder_ls";return this.set(e,!0),!!this.get(e)&&(this.remove(e),!0)}}]),e}(),gs=new ps({}),ys="rl_user_id",vs="rl_trait",ms="rl_anonymous_id",Is="rl_group_id",ks="rl_group_trait",bs="rl_page_init_referrer",As="rl_page_init_referring_domain",Es="rl_session",Cs="rl_auth_token",Ss="RudderEncrypt:",Ts="Rudder",ws={segment:"ajs_anonymous_id"};function Os(e){try{return e?JSON.parse(e):null}catch(t){return ut.error(t),e||null}}function _s(e){return e.replace(/^\s+|\s+$/gm,"")}function Rs(e){return e&&"string"==typeof e&&""!==_s(e)&&e.substring(0,Ss.length)===Ss?Xi.decrypt(e.substring(Ss.length),Ts).toString($i):e}var Ps=function(){function e(){i(this,e),fs.isSupportAvailable?this.storage=fs:(gs.enabled&&(this.storage=gs),this.storage||ut.error("No storage is available :: initializing the SDK without storage"))}return s(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""===_s(e)?e:"".concat(Ss).concat(Xi.encrypt(e,Ts).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(ys,e)}},{key:"setUserTraits",value:function(e){this.setItem(vs,e)}},{key:"setGroupId",value:function(e){this.setStringItem(Is,e)}},{key:"setGroupTraits",value:function(e){this.setItem(ks,e)}},{key:"setAnonymousId",value:function(e){this.setStringItem(ms,e)}},{key:"setInitialReferrer",value:function(e){this.setItem(bs,e)}},{key:"setInitialReferringDomain",value:function(e){this.setItem(As,e)}},{key:"setSessionInfo",value:function(e){this.setItem(Es,e)}},{key:"setAuthToken",value:function(e){this.setItem(Cs,e)}},{key:"getItem",value:function(e){return Os(Rs(this.storage.get(e)))}},{key:"getUserId",value:function(){return this.getItem(ys)}},{key:"getUserTraits",value:function(){return this.getItem(vs)}},{key:"getGroupId",value:function(){return this.getItem(Is)}},{key:"getGroupTraits",value:function(){return this.getItem(ks)}},{key:"fetchExternalAnonymousId",value:function(e){var t,n=e.toLowerCase();return Object.keys(ws).includes(n)&&"segment"===n?(gs.enabled&&(t=gs.get(ws[n])),!t&&fs.isSupportAvailable&&(t=fs.get(ws[n])),t):t}},{key:"getAnonymousId",value:function(e){var t=Os(Rs(this.storage.get(ms)));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(bs)}},{key:"getInitialReferringDomain",value:function(){return this.getItem(As)}},{key:"getSessionInfo",value:function(){return this.getItem(Es)}},{key:"getAuthToken",value:function(){return this.getItem(Cs)}},{key:"removeItem",value:function(e){return this.storage.remove(e)}},{key:"removeSessionInfo",value:function(){this.removeItem(Es)}},{key:"clear",value:function(e){this.storage.remove(ys),this.storage.remove(vs),this.storage.remove(Is),this.storage.remove(ks),this.storage.remove(Cs),e&&this.storage.remove(ms)}}]),e}(),Ds=new Ps;function Ls(){return document.referrer||"$direct"}function xs(e){var t=e.split("/");return t.length>=3?t[2]:""}function Ms(){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 Bs(){var e=Ms(),t=window.location.pathname;if(e)try{t=new URL(e).pathname}catch(e){}var n=window.location,r=n.search,i=n.href,o=document.title,s=function(e){var t,n=Ms(),r=(t=n?n.includes("?")?n:n+e:window.location.href).indexOf("#");return r>-1?t.slice(0,r):t}(r),a=i,u=Ls();return{path:t,referrer:u,referring_domain:xs(u),search:r,title:o,url:s,tab_url:a,initial_referrer:Ds.getInitialReferrer()||"",initial_referring_domain:Ds.getInitialReferringDomain()||""}}for(var Ns,Fs=s((function e(){i(this,e),this.name="RudderLabs JavaScript SDK",this.namespace="com.rudderlabs.javascript",this.version="2.37.0"})),js=s((function e(){i(this,e),this.name="RudderLabs JavaScript SDK",this.version="2.37.0"})),Us=s((function e(){i(this,e),this.name="",this.version=""})),Gs=s((function e(){i(this,e),this.density=0,this.width=0,this.height=0,this.innerWidth=0,this.innerHeight=0})),Ks=s((function e(){var t;i(this,e),this.app=new Fs,this.traits=null,this.library=new js,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 Us,this.locale="undefined"==typeof navigator?null:navigator.language||navigator.browserLanguage,this.screen=(t=new Gs,"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)})),Hs=function(){function e(){i(this,e),this.channel="web",this.context=new Ks,this.type=null,this.messageId=Ii(),this.originalTimestamp=(new Date).toISOString(),this.anonymousId=null,this.userId=null,this.event=null,this.properties={}}return s(e,[{key:"getProperty",value:function(e){return this.properties[e]}},{key:"addProperty",value:function(e,t){this.properties[e]=t}}]),e}(),zs=function(){function e(){i(this,e),this.message=new Hs}return s(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}(),Qs=function(){function e(){i(this,e),this.rudderProperty=null,this.rudderUserProperty=null,this.event=null,this.userId=null,this.type=null}return s(e,[{key:"setType",value:function(e){return this.type=e,this}},{key:"build",value:function(){var e=new zs;return e.setUserId(this.userId),e.setType(this.type),e.setEventName(this.event),e.setProperty(this.rudderProperty),e.setUserProperty(this.rudderUserProperty),e}}]),e}(),qs={},Vs=256,Ws=[];Vs--;)Ws[Vs]=(Vs+256).toString(16).substring(1);qs.v4=function(){var e,t=0,n="";if(!Ns||Vs+16>256){for(Ns=Array(t=256);t--;)Ns[t]=256*Math.random()|0;t=Vs=0}for(;t<16;t++)e=Ns[Vs+t],n+=6==t?Ws[15&e|64]:8==t?Ws[63&e|128]:Ws[e],1&t&&t>1&&t<11&&(n+="-");return Vs++,n};var Ys={},Xs=Object.prototype.hasOwnProperty,Js=String.prototype.charAt,$s=Object.prototype.toString,Zs=function(e,t){return Js.call(e,t)},ea=function(e,t){return Xs.call(e,t)},ta=function(e,t){t=t||ea;for(var n=[],r=0,i=e.length;r=Ea.RESCHEDULE&&o+2*nthis.maxAttempts)},Da.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))},Da.prototype.addItem=function(e){this._enqueue({item:e,attemptNumber:0,time:this._schedule.now(),id:Ta()})},Da.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||Ta()}):this.emit("discard",e,t)},Da.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()},Da.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(),o=[];function s(n,r){o.push({item:n.item,done:function(i,o){var s=t.get(e.keys.IN_PROGRESS)||{};delete s[r],t.set(e.keys.IN_PROGRESS,s),e.emit("processed",i,o,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++0&&(this._processId=this._schedule.run(this._processHead,n[0].time-i,_a.Modes.ASAP))},Da.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,_a.Modes.ASAP)},Da.prototype._checkReclaim=function(){var e=this;Oa((function(t){t.id!==e.id&&(e._schedule.now()-t.get(e.keys.ACK)=0?n.emit("duplication",e.item,e.attemptNumber):(i.queue.push({item:e.item,attemptNumber:e.attemptNumber+t,time:n._schedule.now(),id:r}),s.push(r))}),e)};a(o.queue,0),a(o.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 La=h(Da),xa={maxRetryDelay:36e4,minRetryDelay:1e3,backoffFactor:2,maxAttempts:10,maxItems:100},Ma=function(){function e(){i(this,e),this.url="",this.writeKey=""}return s(e,[{key:"init",value:function(e,t,n){var r=this;this.url=t,this.writeKey=e,n&&u(xa,n),this.payloadQueue=new La("rudder",xa,(function(e,t){e.message.sentAt=ki(),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 o=new XMLHttpRequest;for(var s in o.open("POST",e,!0),t)o.setRequestHeader(s,t[s]);o.timeout=r,o.ontimeout=i,o.onerror=i,o.onreadystatechange=function(){if(4===o.readyState)if(429===o.status||o.status>=500&&o.status<600){var t="".concat(li,' "').concat(o.status,'" status text: "').concat(o.statusText,'" for URL: "').concat(e,'"'),n=new Error(t);vi(n),i(n)}else i(null,o.status)},o.send(gi(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}(),Ba="queue",Na=64e3,Fa=function(){function e(){i(this,e),this.storage=gs,this.maxItems=10,this.flushQueueTimeOut=void 0,this.timeOutActive=!1,this.flushQueueTimeOutInterval=6e5,this.url="",this.writekey="",this.queueName="".concat(Ba,".").concat(Date.now())}return s(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);gi({batch:n},!0).length>Na&&(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=gi({batch:e},!0),n=new Blob([t],{type:"text/plain"}),r="".concat(this.url,"?writeKey=").concat(this.writekey);try{"function"!=typeof navigator.sendBeacon&&vi(new Error("Beacon API is not supported by browser")),navigator.sendBeacon(r,n)||vi(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),vi(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}(),ja=function(){function e(){i(this,e),this.queue=void 0}return s(e,[{key:"initialize",value:function(e,t,n){var i={},o=mi(t);n&&n.useBeacon&&navigator.sendBeacon?(n.beaconQueueOptions&&null!=n.beaconQueueOptions&&"object"===r(n.beaconQueueOptions)&&(i=n.beaconQueueOptions),o="".concat(o,"/beacon/v1/batch"),this.queue=new Fa):(n&&n.useBeacon&&ut.info("[EventRepository] sendBeacon feature not available in this browser :: fallback to XHR"),n&&n.queueOptions&&null!=n.queueOptions&&"object"===r(n.queueOptions)&&(i=n.queueOptions),this.queue=new Ma),this.queue.init(e,o,i)}},{key:"enqueue",value:function(e,t){var n=e.getElementContent();n.originalTimestamp=n.originalTimestamp||ki(),n.sentAt=ki(),gi(n,!0).length>32e3&&ut.error("[EventRepository] enqueue:: message length greater 32 Kb ",n),this.queue.enqueue(n,t)}}]),e}(),Ua=new ja,Ga={maxRetryDelay:36e4,minRetryDelay:1e3,backoffFactor:2,maxAttempts:1/0},Ka=function(){function e(){i(this,e),this.callback=void 0,this.processQueueElements=!1}return s(e,[{key:"init",value:function(e,t){var n=this;e&&u(Ga,e),t&&(this.callback=t),this.payloadQueue=new La("rs_events",Ga,(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,zs.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}(),Ha="RS_JS_SDK",za=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{var r=document.getElementById(e);if(r)return;var i=document.createElement("script");i.src=t,i.async=void 0===n.async||n.async,i.type="text/javascript",i.id=e,!0!==n.skipDatasetAttributes&&(i.setAttribute("data-loader",Ha),void 0!==n.isNonNativeSDK&&i.setAttribute("data-isNonNativeSDK",n.isNonNativeSDK));var o=document.getElementsByTagName("head");if(o.length>0)o[0].insertBefore(i,o[0].firstChild);else{var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(i,s)}}catch(s){vi(s)}},Qa=function(){return navigator&&navigator.language},qa=function(){return navigator&&navigator.userAgent};function Va(e){return decodeURIComponent(atob(e).split("").map((function(e){return"%".concat("00".concat(e.charCodeAt(0).toString(16)).slice(-2))})).join(""))}function Wa(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Va(e=e.endsWith("..")?e.substr(0,e.length-2):e)}var Ya=/^[a-zA-Z0-9\-_.]+$/,Xa="*";function Ja(e,t,n,r){var i=function(e,t){return[e,(new Date).getTimezoneOffset(),t].join(Xa)}(n,r),o=t||0,s=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>>8^t[255&(n^e.charCodeAt(r))];return(-1^n)>>>0}([i,Math.floor(Date.now()/6e4)-o,e].join(Xa));return s.toString(36)}function $a(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=qa(),r=Qa(),i=0;i<=1;i+=1)if(Ja(e,i,n,r)===t)return!0;return!1}(r,n)?function(e){for(var t={},n=e.split(Xa),r=0;r0&&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){vi(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}(),iu=new ru,ou=["integrations","anonymousId","originalTimestamp"],su="rs-bugsnag",au="bugsnag",uu=["Bugsnag",au],cu="{{{{__RS_BUGSNAG_API_KEY__}}}}",lu=["rudder-analytics.min.js","rudder-analytics-staging.min.js","rudder-analytics.js"].concat(c(Object.keys(Za).map((function(e){return"".concat(Za[e],".min.js")}))),c(Object.keys(Za).map((function(e){return"".concat(Za[e],"-staging.min.js")}))),c(Object.keys(Za).map((function(e){return"".concat(Za[e],".js")})))),fu=function(e){var t=e&&e._client&&e._client._notifier&&e._client._notifier.version;if(!t){var n=e({apiKey:cu,releaseStage:"version-test",beforeSend:function(){return!1}});t=n.notifier&&n.notifier.version,n=void 0}return t&&"6"===t.charAt(0)},hu=function(e){uu.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)}))&&za(e,"https://d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js",{isNonNativeSDK:"true",skipDatasetAttributes:!0})},du=function(){function e(t,n){i(this,e),this.pluginName=su,this.sourceId=t,this.onClientReady=n,this.initClientOnLibReadyInterval=void 0,this.init()}return s(e,[{key:"init",value:function(){var e=this;if(!window.rudderanalytics||!window.rudderanalytics.errorReporting){if(!cu.match(/{{.+}}/)){hu(this.pluginName);var t=window.bugsnag;"function"!=typeof t?(this.initClientOnLibReadyInterval=setInterval((function(){var t=window.bugsnag;"function"==typeof t&&(fu(t)&&e.initClient(),clearInterval(e.initClientOnLibReadyInterval))}),100),setTimeout((function(){clearInterval(e.initClientOnLibReadyInterval)}),ti)):fu(t)&&this.initClient()}}}},{key:"initClient",value:function(){var e,t=window.bugsnag;this.client=t({apiKey:cu,appVersion:"2.37.0",metaData:{SDK:{name:"JS",installType:"cdn"}},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 lu.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}(),pu=su,gu=[su],yu=function(){function e(t){i(this,e),this.isEnabled=!1,this.providerName=pu,this.provider=void 0,this.logger=t,this.onClientReady=this.onClientReady.bind(this),this.exposeToGlobal=this.exposeToGlobal.bind(this)}return s(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||gu.includes(e)?this.providerName=e:this.logger.error("[Analytics] ErrorReporting :: Invalid error reporting provider value. Value should be one of: ".concat(gu.join(","))):this.providerName=pu}},{key:"initProvider",value:function(e,t){if(this.providerName===su)this.provider=new du(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}(),vu=new(function(){function e(){i(this,e),this.retryAttempt=3,this.queue=[],this.isTransformationProcessing=!1,this.authToken=null}return s(e,[{key:"init",value:function(e,t,n){this.dataPlaneUrl=mi(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 o="".concat(n.dataPlaneUrl,"/transform"),s={"Content-Type":"application/json",Authorization:"Basic ".concat(btoa("".concat(n.writeKey,":")))};try{var a=new XMLHttpRequest;a.open("POST",o,!0),Object.keys(s).forEach((function(e){return a.setRequestHeader(e,s[e])})),a.timeout=1e4,a.onreadystatechange=function(){if(4===a.readyState)try{var o=a.status,s=a.response;if(200===o)return s&&"string"==typeof s?(s=JSON.parse(s),void r({transformedPayload:s.transformedBatch,transformationServerAccess:!0})):void i("[Transformation]:: Transformation failed. Invalid response from server.");if(400===o){var u=s?"[Transformation]:: ".concat(s):"[Transformation]:: Invalid request payload";return void i(u)}if(404===o)return void r({transformedPayload:e.batch,transformationServerAccess:!1});if(!(t>0))return void i("[Transformation]:: Transformation failed with status ".concat(o));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(gi(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){vi("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}()),mu=function(){function e(){i(this,e),this.initialized=!1,this.clientIntegrations=[],this.loadOnlyIntegrations={},this.clientIntegrationObjects=void 0,this.successfullyLoadedIntegration=[],this.failedToBeLoadedIntegration=[],this.toBeProcessedArray=[],this.toBeProcessedByIntegrationArray=[],this.storage=Ds,this.eventRepository=Ua,this.preProcessQueue=new Ka,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=iu,this.version="2.37.0",this.lockIntegrationsVersion=!1,this.errorReporting=new yu(ut),this.deniedConsentIds=[],this.transformationHandler=vu}return s(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=Ls();this.storage.setInitialReferrer(e),this.storage.setInitialReferringDomain(xs(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(Za[t.name]).concat(ri)]}))||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){return window[e]&&window[e][t]&&window[e][t].prototype&&void 0!==window[e][t].prototype.constructor}},{key:"processResponse",value:function(e,t){var n=this;try{var i=t;try{if("string"==typeof t&&(i=JSON.parse(t)),!i||"object"!==r(i)||Array.isArray(i))return void ut.error("Invalid source configuration")}catch(e){return void vi(e)}try{this.errorReporting.init(i.source.config,i.source.id)}catch(e){vi(e)}if(this.serverUrl=_i(i,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=c(e.toBeProcessedArray[0]);e.toBeProcessedArray.shift();var n=t[0];t.shift(),e[n].apply(e,c(t))}}(this),i.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=Ci(this.loadOnlyIntegrations,this.clientIntegrations),Object.keys(this.cookieConsentOptions).length>0)try{var o=nu(this.cookieConsentOptions);this.deniedConsentIds=o&&o.getDeniedList(),this.clientIntegrations=this.clientIntegrations.filter((function(e){return!o||o&&o.isEnabled(e.config)}))}catch(e){vi(e)}this.clientIntegrations=this.clientIntegrations.filter((function(e){return!!Za[e.name]||(ut.error("[Analytics] Integration:: ".concat(e.name," not available for initialization")),!1)}));var s="";Ti().isStaging&&(s="-staging"),this.bufferDataPlaneEventsUntilReady&&setTimeout((function(){n.processBufferedCloudModeEvents()}),this.dataPlaneEventsBufferTimeout),this.errorReporting.leaveBreadcrumb("Starting device-mode initialization"),this.clientIntegrations.forEach((function(e){var t=Za[e.name],r="".concat(t).concat(ri),i="".concat(n.destSDKBaseURL,"/").concat(t).concat(s,".min.js");window.hasOwnProperty(r)||za(r,i,{isNonNativeSDK:!0});var o=n,a=setInterval((function(){if(o.integrationSDKLoaded(r,t)){var i,s=window[r];clearInterval(a);try{var u="[Analytics] processResponse :: trying to initialize integration name:: ".concat(r);n.errorReporting.leaveBreadcrumb(u),(i=new s[t](e.config,o,e.destinationInfo)).init(),o.isInitialized(i).then((function(){o.dynamicallyLoadedIntegrations[r]=s[t]}))}catch(e){var c="[Analytics] 'integration.init()' failed :: ".concat(r," :: ").concat(e.message);vi(e,c),o.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){vi(e)}}},{key:"sendDataToDestination",value:function(e,t,n){try{if(e[n]){var r=S(t);e[n](r)}}catch(t){var i="[sendToNative]:: [Destination: ".concat(e.name,"]:: ");vi(t,i)}}},{key:"sendTransformedDataToDestination",value:function(e,t,n){var r=this;try{Ei(t.message.integrations),this.transformationHandler.enqueue(t,(function(t){var i=t.transformedPayload,o=t.transformationServerAccess;i&&e.forEach((function(e){try{var t,s=[];if(o){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?s.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 s=i;null===(t=s)||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)),vi(t)}}))}))}catch(e){e instanceof Error&&(e.message="[DMT]:: ".concat(e.message)),vi(e)}}},{key:"processAndSendEventsToDeviceMode",value:function(e,t,n){var r=this,i=[],o=[];e.forEach((function(e){!r.IsEventBlackListed(t.message.event,e.name)&&(e.areTransformationsConnected?o.push(e):i.push(e))})),i.forEach((function(e){r.sendDataToDestination(e,t,n)})),o.length>0&&this.sendTransformedDataToDestination(o,t,n)}},{key:"queueEventForDataPlane",value:function(e,t){var n=t.message.integrations||{All:!0};t.message.integrations=function(e,t){var n=S(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 pi(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=S(t),n.forEach((function(e){if(e.getDataForIntegrationsObject)try{r=pi(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&&Ai(t[0].message.integrations);var r=Ci(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,i,o){if(this.errorReporting.leaveBreadcrumb("Page event"),this.loaded){"function"==typeof i&&(o=i,i=null),"function"==typeof n&&(o=n,i=n=null),"function"==typeof t&&(o=t,i=n=t=null),"function"==typeof e&&(o=e,i=n=t=e=null),"object"===r(e)&&null!=e&&null!=e&&(i=t,n=e,t=e=null),"object"===r(t)&&null!=t&&null!=t&&(i=n,n=t,t=null),"string"==typeof e&&"string"!=typeof t&&(t=e,e=null),this.sendAdblockPage&&"RudderJS-Initiated"!=e&&this.sendSampleRequest();var s=S(n),a=S(i),u=(new Qs).setType("page").build();s||(s={}),t&&(u.message.name=s.name=t),e&&(u.message.category=s.category=e),u.message.properties=this.getPageProperties(s),this.processAndSendDataToDestinations("page",u,a,o)}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=S(t),o=S(n),s=(new Qs).setType("track").build();e&&s.setEventName(e),s.setProperty(i||{}),this.processAndSendDataToDestinations("track",s,o,r)}else this.toBeProcessedArray.push(["track"].concat(Array.prototype.slice.call(arguments)))}},{key:"identify",value:function(e,t,n,i){if(this.errorReporting.leaveBreadcrumb("Identify event"),this.loaded){"function"==typeof n&&(i=n,n=null),"function"==typeof t&&(i=t,n=null,t=null),"object"===r(e)&&(n=t,t=e,e=this.userId);var o=wi(e);o&&this.userId&&o!==this.userId&&this.reset(),this.userId=o,this.storage.setUserId(this.userId);var s=S(t),a=S(n);if(s){for(var u in s)this.userTraits[u]=s[u];this.storage.setUserTraits(this.userTraits)}var c=(new Qs).setType("identify").build();this.processAndSendDataToDestinations("identify",c,a,i)}else this.toBeProcessedArray.push(["identify"].concat(Array.prototype.slice.call(arguments)))}},{key:"alias",value:function(e,t,n,i){if(this.errorReporting.leaveBreadcrumb("Alias event"),this.loaded){"function"==typeof n&&(i=n,n=null),"function"==typeof t&&(i=t,n=null,t=null),"function"==typeof e&&(i=e,n=null,t=null,e=null),"object"===r(t)&&(n=t,t=null),"object"===r(e)&&(n=e,t=null,e=null);var o=(new Qs).setType("alias").build();o.message.previousId=wi(t)||(this.userId?this.userId:this.getAnonymousId()),o.message.userId=wi(e);var s=S(n);this.processAndSendDataToDestinations("alias",o,s,i)}else this.toBeProcessedArray.push(["alias"].concat(Array.prototype.slice.call(arguments)))}},{key:"group",value:function(e,t,n,i){if(this.errorReporting.leaveBreadcrumb("Group event"),this.loaded){if(0!==arguments.length){"function"==typeof n&&(i=n,n=null),"function"==typeof t&&(i=t,n=null,t=null),"object"===r(e)&&(n=t,t=e,e=this.groupId),"function"==typeof e&&(i=e,n=null,t=null,e=this.groupId),this.groupId=wi(e),this.storage.setGroupId(this.groupId);var o=S(t),s=S(n),a=(new Qs).setType("group").build();if(o)for(var u in o)this.groupTraits[u]=o[u];else this.groupTraits={};this.storage.setGroupTraits(this.groupTraits),this.processAndSendDataToDestinations("group",a,s,i)}}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=Wr[t],r=this.clientIntegrations.find((function(e){return e.name===n})).config,i=r.blacklistedEvents,o=r.whitelistedEvents,s=r.eventFilteringOption;if(!s)return!1;var a=e.trim().toUpperCase();switch(s){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(o)||!o.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,r,i){try{this.anonymousId||this.setAnonymousId(),this.errorReporting.leaveBreadcrumb("Started sending data to destinations"),t.message.context.traits=n({},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=n({},this.groupTraits)));try{var o=this.uSession.getSessionInfo(),s=o.sessionId,a=o.sessionStart;t.message.context.sessionId=s,a&&(t.message.context.sessionStart=!0)}catch(e){vi(e)}f=this.cookieConsentOptions,h=!1,Object.keys(f).forEach((function(e){si.includes(e)&&"boolean"==typeof f[e].enabled&&!0===f[e].enabled&&(h=!0)})),h&&(t.message.context.consentManagement={deniedConsentIds:this.deniedConsentIds||[]}),this.processOptionsParam(t,r),function(e,t){var n=e.properties,r=e.traits;n&&Object.keys(n).forEach((function(e){Xr.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){Xr.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){Xr.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?Ai(u):u=this.shouldUseGlobalIntegrationsConfigInEvents()?this.loadOnlyIntegrations:ci,t.message.integrations=u;try{t.message.context["ua-ch"]=this.uach}catch(e){vi(e)}if(this.clientIntegrationObjects){var c=Ci(u,this.clientIntegrationObjects);this.processAndSendEventsToDeviceMode(c,t,e)}else this.toBeProcessedByIntegrationArray.push([e,t]);var l=S(t);Ei(l.message.integrations),!this.bufferDataPlaneEventsUntilReady||this.clientIntegrationObjects?this.queueEventForDataPlane(e,l):this.preProcessQueue.enqueue(e,l),i&&"function"==typeof i&&i(l)}catch(e){vi(e)}var f,h}},{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(r.length);"campaign"===i&&(i="name"),t[i]=e}}))}catch(e){}return t}},{key:"addCampaignInfo",value:function(e){var t=e.message.context;t&&"object"===r(t)&&(e.message.context.campaign=this.utm(window.location.href))}},{key:"processOptionsParam",value:function(e,t){var i=e.message,o=i.type,s=i.properties;this.addCampaignInfo(e),e.message.context.page=this.getContextPageProperties("page"===o?s:void 0),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"===r(t)&&null!==t&&Object.keys(t).forEach((function(n){ou.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]:{},i=e.context;return"object"!==r(t)||null===t||Object.keys(t).forEach((function(e){if(!ou.includes(e)&&!ai.includes(e))if("context"!==e)i=pi(i,a({},e,t[e]));else if("object"===r(t[e])&&null!==t[e]){var o={};Object.keys(t[e]).forEach((function(n){ai.includes(n)||(o[n]=t[e][n])})),i=pi(i,n({},o))}else ut.error("[Analytics: processOptionsParam] context passed in options ".concat(e," is not object."))})),i}(e.message,t)}},{key:"getPageProperties",value:function(e,t){var n=Bs(),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=Bs(),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?$a(t):null,r=n?n.rs_amp_id:null;this.anonymousId=e||r||Ii(),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,i){var o=this;if("object"===r(t)&&null!==t&&(i=t,t=null),i&&i.logLevel&&(this.logLevel=i.logLevel,ut.setLogLevel(i.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");i&&i.cookieConsentManager&&(this.cookieConsentOptions=i.cookieConsentManager),this.writeKey=e,this.serverUrl=t,this.options=i;var s={};if(i&&i.setCookieDomain&&(s=n(n({},s),{},{domain:i.setCookieDomain})),i&&"boolean"==typeof i.secureCookie&&(s=n(n({},s),{},{secure:i.secureCookie})),i&&-1!==ii.indexOf(i.sameSiteCookie)&&(s=n(n({},s),{},{samesite:i.sameSiteCookie})),this.storage.options(s),i&&"string"==typeof i.uaChTrackLevel&&ui.includes(i.uaChTrackLevel)&&(this.uaChTrackLevel=i.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){o.uach=e}),this.uaChTrackLevel),i&&i.integrations&&(u(this.loadOnlyIntegrations,i.integrations),Ai(this.loadOnlyIntegrations)),this.useGlobalIntegrationsConfigInEvents=i&&!0===i.useGlobalIntegrationsConfigInEvents,i&&i.sendAdblockPage&&(this.sendAdblockPage=!0),i&&i.sendAdblockPageOptions&&"object"===r(i.sendAdblockPageOptions)&&(this.sendAdblockPageOptions=i.sendAdblockPageOptions),this.uSession.initialize(i),i&&i.clientSuppliedCallbacks){var a={};Object.keys(this.methodToCallbackMapping).forEach((function(e){o.methodToCallbackMapping.hasOwnProperty(e)&&i.clientSuppliedCallbacks[o.methodToCallbackMapping[e]]&&(a[e]=i.clientSuppliedCallbacks[o.methodToCallbackMapping[e]])})),u(this.clientSuppliedCallbacks,a),this.registerCallbacks(!0)}if(i&&null!=i.loadIntegration&&(this.loadIntegration=!!i.loadIntegration),i&&"boolean"==typeof i.bufferDataPlaneEventsUntilReady&&(this.bufferDataPlaneEventsUntilReady=!0===i.bufferDataPlaneEventsUntilReady,this.bufferDataPlaneEventsUntilReady&&this.preProcessQueue.init(this.options,this.queueEventForDataPlane.bind(this))),i&&"number"==typeof i.dataPlaneEventsBufferTimeout&&(this.dataPlaneEventsBufferTimeout=i.dataPlaneEventsBufferTimeout),i&&void 0!==i.lockIntegrationsVersion&&(this.lockIntegrationsVersion=!0===i.lockIntegrationsVersion),this.initializeUser(i?i.anonymousIdOptions:void 0),this.setInitialPageProperties(),this.destSDKBaseURL=function(e,t,n){var r="";if(n){if(!(r=mi(n))){var i="CDN base URL for integrations is not valid";throw vi({message:"[Analytics] load:: ".concat(i)}),Error("Failed to load Rudder SDK: ".concat(i))}return r}var o=Ti().sdkURL;return r=o?o.split("/").slice(0,-1).concat(Zr).join("/"):ei,t&&(r=r.replace($r,e)),r}(this.version,this.lockIntegrationsVersion,i&&i.destSDKBaseURL),i&&i.getSourceConfig)if("function"!=typeof i.getSourceConfig)vi(new Error('option "getSourceConfig" must be a function'));else{var c=i.getSourceConfig();c instanceof Promise?c.then((function(e){return o.processResponse(200,e)})).catch(vi):this.processResponse(200,c)}else{var l=function(e){return Jr.concat(Jr.includes("?")?"&":"?").concat(e?"writeKey=".concat(e):"")}(e);i&&i.configUrl&&(l=function(e,t){var n=e;-1===n.indexOf("sourceConfig")&&(n="".concat(mi(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)}(i.configUrl,l));try{!function(e,t,n,r){var i=r.bind(e),o=new XMLHttpRequest;o.open("GET",t,!0),o.setRequestHeader("Authorization","Basic ".concat(btoa("".concat(n,":")))),o.onload=function(){var e=o.status;200==e?i(200,o.responseText):(vi(new Error("".concat(li," ").concat(e," for url: ").concat(t))),i(e))},o.send()}(this,l,e,this.processResponse)}catch(e){vi(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=S(n);if(this.arePolyfillsRequired(r)){var i="polyfill";za(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 o=this,s=setInterval((function(){!window.hasOwnProperty(i)&&null===document.getElementById(i)||"undefined"==typeof Promise||(clearInterval(s),o.loadAfterPolyfill(e,t,r))}),100);setTimeout((function(){clearInterval(s)}),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(){za("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}(),Iu=new mu;g(Iu),window.addEventListener("error",(function(e){vi(e,void 0,Iu)}),!0),Iu.initializeCallbacks(),Iu.registerCallbacks(!1);var ku,bu="load",Au=window.rudderanalytics,Eu=Array.isArray(Au);if(Eu)for(var Cu=0;Cu0&&(ku.shift(),Iu.load.apply(Iu,c(ku)));var Su=Iu.ready.bind(Iu),Tu=Iu.identify.bind(Iu),wu=Iu.page.bind(Iu),Ou=Iu.track.bind(Iu),_u=Iu.alias.bind(Iu),Ru=Iu.group.bind(Iu),Pu=Iu.reset.bind(Iu),Du=Iu.load.bind(Iu),Lu=Iu.initialized=!0,xu=Iu.getUserId.bind(Iu),Mu=Iu.getSessionId.bind(Iu),Bu=Iu.getUserTraits.bind(Iu),Nu=Iu.getAnonymousId.bind(Iu),Fu=Iu.setAnonymousId.bind(Iu),ju=Iu.getGroupId.bind(Iu),Uu=Iu.getGroupTraits.bind(Iu),Gu=Iu.startSession.bind(Iu),Ku=Iu.endSession.bind(Iu),Hu=Iu.setAuthToken.bind(Iu);return e.alias=_u,e.endSession=Ku,e.getAnonymousId=Nu,e.getGroupId=ju,e.getGroupTraits=Uu,e.getSessionId=Mu,e.getUserId=xu,e.getUserTraits=Bu,e.group=Ru,e.identify=Tu,e.initialized=Lu,e.load=Du,e.page=wu,e.ready=Su,e.reset=Pu,e.setAnonymousId=Fu,e.setAuthToken=Hu,e.startSession=Gu,e.track=Ou,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); +//# sourceMappingURL=rudder-analytics.min.js.map diff --git a/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js b/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js index 104c24a110..d33276d2e8 100644 --- a/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js +++ b/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js @@ -1,4 +1,4 @@ -/* eslint-disable class-methods-use-this */ +/* eslint-disable class-methods-use-this,no-underscore-dangle */ import get from 'get-value'; import { NAME, @@ -98,11 +98,11 @@ class Mixpanel { isLoaded() { window.mixpanel.register({ mp_lib: 'Rudderstack: web' }); - return !!window?.mixpanel?.config; + return !!window?.mixpanel?.__loaded; } isReady() { - return !!window?.mixpanel?.config; + return !!window?.mixpanel?.__loaded; } /** From 26e4b7ff0091baf1c782935e59919034bab2b44c Mon Sep 17 00:00:00 2001 From: sandeepdigumarty Date: Tue, 19 Mar 2024 11:30:02 +0530 Subject: [PATCH 2/5] chare: addressed review comments --- __tests__/prodsdk.js | 2 -- .../src/integrations/Mixpanel/browser.js | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 __tests__/prodsdk.js diff --git a/__tests__/prodsdk.js b/__tests__/prodsdk.js deleted file mode 100644 index c9eb4d80c1..0000000000 --- a/__tests__/prodsdk.js +++ /dev/null @@ -1,2 +0,0 @@ -rudderanalytics=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 n(e){for(var n=1;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n4096)&&(e=4096,F=crypto.getRandomValues(new Uint8Array(e)),U=0);for(var t,n=0,r="";n<16;n++)t=F[U+n],r+=6==n?j[15&t|64]:8==n?j[63&t|128]:j[t],1&n&&n>1&&n<11&&(r+="-");return U+=16,r}var K,H,z,Q,q,V,W,Y,X,J,$,Z,ee,te,ne,re,ie,oe,se,ae,ue,ce,le,fe,he,de,pe,ge,ye,ve,me,Ie,ke,be,Ae,Ee,Ce,Se,Te,we,Oe,_e,Re,Pe,De,Le,xe,Me,Be,Ne,Fe,je,Ue,Ge,Ke,He,ze,Qe,qe,Ve,We,Ye,Xe,Je,$e,Ze,et,tt,nt,rt,it,ot,st,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=(K={"Adobe Analytics":ct,ADOBEANALYTICS:ct,"ADOBE ANALYTICS":ct},a(K,ct,ct),a(K,"AdobeAnalytics",ct),a(K,"adobeanalytics",ct),a(K,"adobe analytics",ct),a(K,"Adobe analytics",ct),a(K,"adobe Analytics",ct),K),ft="AM",ht=(H={},a(H,ft,ft),a(H,"AMPLITUDE",ft),a(H,"Amplitude",ft),a(H,"am",ft),H),dt="APPCUES",pt=(z={},a(z,dt,dt),a(z,"Appcues",dt),a(z,"App Cues",dt),a(z,"appcues",dt),z),gt="BINGADS",yt=(Q={},a(Q,gt,gt),a(Q,"BingAds",gt),a(Q,"bingads",gt),a(Q,"Bing Ads",gt),a(Q,"Bing ads",gt),a(Q,"bing Ads",gt),a(Q,"bing ads",gt),Q),vt="BRAZE",mt=(q={},a(q,vt,vt),a(q,"Braze",vt),a(q,"braze",vt),q),It="BUGSNAG",kt=(V={},a(V,It,It),a(V,"bugsnag",It),a(V,"Bugsnag",It),V),bt="CHARTBEAT",At=(W={},a(W,bt,bt),a(W,"Chartbeat",bt),a(W,"chartbeat",bt),a(W,"Chart Beat",bt),a(W,"chart beat",bt),W),Et="CLEVERTAP",Ct=(Y={},a(Y,Et,Et),a(Y,"Clevertap",Et),a(Y,"clevertap",Et),Y),St="COMSCORE",Tt=(X={},a(X,St,St),a(X,"Comscore",St),a(X,"Com Score",St),a(X,"com Score",St),a(X,"com score",St),a(X,"Com score",St),X),wt="CRITEO",Ot=(J={},a(J,wt,wt),a(J,"Criteo",wt),a(J,"criteo",wt),J),_t="CUSTOMERIO",Rt=($={},a($,_t,_t),a($,"Customerio",_t),a($,"Customer.io",_t),a($,"CUSTOMER.IO",_t),a($,"customer.io",_t),$),Pt="DRIP",Dt=(Z={},a(Z,Pt,Pt),a(Z,"Drip",Pt),a(Z,"drip",Pt),Z),Lt="FACEBOOK_PIXEL",xt=(ee={},a(ee,Lt,Lt),a(ee,"FB Pixel",Lt),a(ee,"Facebook Pixel",Lt),a(ee,"facebook pixel",Lt),a(ee,"fbpixel",Lt),a(ee,"FBPIXEL",Lt),a(ee,"FB_PIXEL",Lt),ee),Mt="FULLSTORY",Bt=(te={},a(te,Mt,Mt),a(te,"Fullstory",Mt),a(te,"FullStory",Mt),a(te,"full Story",Mt),a(te,"Full Story",Mt),a(te,"Full story",Mt),a(te,"full story",Mt),a(te,"fullstory",Mt),te),Nt="GA",Ft=(ne={},a(ne,Nt,Nt),a(ne,"Google Analytics",Nt),a(ne,"GoogleAnalytics",Nt),a(ne,"GOOGLE ANALYTICS",Nt),a(ne,"google analytics",Nt),ne),jt="GA4",Ut=(re={},a(re,jt,jt),a(re,"Google Analytics 4",jt),a(re,"Google analytics 4",jt),a(re,"google analytics 4",jt),a(re,"Google Analytics4",jt),a(re,"Google analytics4",jt),a(re,"google analytics4",jt),a(re,"GoogleAnalytics4",jt),re),Gt="GOOGLEADS",Kt=(ie={},a(ie,Gt,Gt),a(ie,"Google Ads",Gt),a(ie,"GoogleAds",Gt),a(ie,"GOOGLE ADS",Gt),a(ie,"google ads",Gt),a(ie,"googleads",Gt),ie),Ht="GOOGLE_OPTIMIZE",zt=(oe={},a(oe,Ht,Ht),a(oe,"Google Optimize",Ht),a(oe,"GoogleOptimize",Ht),a(oe,"Googleoptimize",Ht),a(oe,"GOOGLEOPTIMIZE",Ht),a(oe,"google optimize",Ht),a(oe,"Google optimize",Ht),a(oe,"GOOGLE OPTIMIZE",Ht),oe),Qt="GTM",qt=(a(se={},Qt,Qt),a(se,"Google Tag Manager",Qt),a(se,"google tag manager",Qt),a(se,"googletag manager",Qt),a(se,"googletagmanager",Qt),se),Vt="HEAP",Wt=(a(ae={},Vt,Vt),a(ae,"Heap",Vt),a(ae,"heap",Vt),a(ae,"Heap.io",Vt),ae),Yt="HOTJAR",Xt=(a(ue={},Yt,Yt),a(ue,"Hotjar",Yt),a(ue,"hotjar",Yt),a(ue,"Hot Jar",Yt),a(ue,"hot jar",Yt),ue),Jt="HS",$t=(a(ce={},Jt,Jt),a(ce,"Hubspot",Jt),a(ce,"HUBSPOT",Jt),a(ce,"hub spot",Jt),a(ce,"Hub Spot",Jt),a(ce,"Hub spot",Jt),ce),Zt="INTERCOM",en=(a(le={},Zt,Zt),a(le,"Intercom",Zt),a(le,"intercom",Zt),le),tn="KEEN",nn=(a(fe={},tn,tn),a(fe,"Keen",tn),a(fe,"Keen.io",tn),a(fe,"keen",tn),a(fe,"keen.io",tn),fe),rn="KISSMETRICS",on=(a(he={},rn,rn),a(he,"Kissmetrics",rn),a(he,"kissmetrics",rn),he),sn="KLAVIYO",an=(a(de={},sn,sn),a(de,"Klaviyo",sn),a(de,"klaviyo",sn),de),un="LAUNCHDARKLY",cn=(a(pe={},un,un),a(pe,"LaunchDarkly",un),a(pe,"Launch_Darkly",un),a(pe,"Launch Darkly",un),a(pe,"launchDarkly",un),a(pe,"launch darkly",un),pe),ln="LINKEDIN_INSIGHT_TAG",fn=(a(ge={},ln,ln),a(ge,"LinkedIn Insight Tag",ln),a(ge,"LinkedIn insight tag",ln),a(ge,"linkedIn insight tag",ln),a(ge,"Linkedin_insight_tag",ln),a(ge,"LinkedinInsighttag",ln),a(ge,"LinkedinInsightTag",ln),a(ge,"LinkedInInsightTag",ln),a(ge,"Linkedininsighttag",ln),a(ge,"LINKEDININSIGHTTAG",ln),a(ge,"linkedininsighttag",ln),ge),hn="LOTAME",dn=(a(ye={},hn,hn),a(ye,"Lotame",hn),a(ye,"lotame",hn),ye),pn="LYTICS",gn=(a(ve={},pn,pn),a(ve,"Lytics",pn),a(ve,"lytics",pn),ve),yn="MP",vn=(a(me={},yn,yn),a(me,"MIXPANEL",yn),a(me,"Mixpanel",yn),a(me,"MIX PANEL",yn),a(me,"Mix panel",yn),a(me,"Mix Panel",yn),me),mn="MOENGAGE",In=(a(Ie={},mn,mn),a(Ie,"MoEngage",mn),a(Ie,"moengage",mn),a(Ie,"Moengage",mn),a(Ie,"Mo Engage",mn),a(Ie,"mo engage",mn),a(Ie,"Mo engage",mn),Ie),kn="OPTIMIZELY",bn=(a(ke={},kn,kn),a(ke,"Optimizely",kn),a(ke,"optimizely",kn),ke),An="PENDO",En=(a(be={},An,An),a(be,"Pendo",An),a(be,"pendo",An),be),Cn="PINTEREST_TAG",Sn=(a(Ae={},Cn,Cn),a(Ae,"PinterestTag",Cn),a(Ae,"Pinterest_Tag",Cn),a(Ae,"PINTERESTTAG",Cn),a(Ae,"pinterest",Cn),a(Ae,"PinterestAds",Cn),a(Ae,"Pinterest_Ads",Cn),a(Ae,"Pinterest",Cn),a(Ae,"Pinterest Tag",Cn),a(Ae,"Pinterest tag",Cn),a(Ae,"PINTEREST TAG",Cn),a(Ae,"pinterest tag",Cn),a(Ae,"Pinterest Ads",Cn),a(Ae,"Pinterest ads",Cn),Ae),Tn="POST_AFFILIATE_PRO",wn=(a(Ee={},Tn,Tn),a(Ee,"PostAffiliatePro",Tn),a(Ee,"Post_affiliate_pro",Tn),a(Ee,"Post Affiliate Pro",Tn),a(Ee,"Post affiliate pro",Tn),a(Ee,"post affiliate pro",Tn),a(Ee,"postaffiliatepro",Tn),a(Ee,"POSTAFFILIATEPRO",Tn),Ee),On="POSTHOG",_n=(a(Ce={},On,On),a(Ce,"PostHog",On),a(Ce,"Posthog",On),a(Ce,"posthog",On),a(Ce,"Post Hog",On),a(Ce,"Post hog",On),a(Ce,"post hog",On),Ce),Rn="PROFITWELL",Pn=(a(Se={},Rn,Rn),a(Se,"ProfitWell",Rn),a(Se,"profitwell",Rn),a(Se,"Profitwell",Rn),a(Se,"Profit Well",Rn),a(Se,"profit well",Rn),a(Se,"Profit well",Rn),Se),Dn="QUALTRICS",Ln=(a(Te={},Dn,Dn),a(Te,"Qualtrics",Dn),a(Te,"qualtrics",Dn),Te),xn="QUANTUMMETRIC",Mn=(a(we={},xn,xn),a(we,"Quantum Metric",xn),a(we,"quantum Metric",xn),a(we,"quantum metric",xn),a(we,"QuantumMetric",xn),a(we,"quantumMetric",xn),a(we,"quantummetric",xn),a(we,"Quantum_Metric",xn),we),Bn="REDDIT_PIXEL",Nn=(a(Oe={},Bn,Bn),a(Oe,"Reddit_Pixel",Bn),a(Oe,"RedditPixel",Bn),a(Oe,"REDDITPIXEL",Bn),a(Oe,"redditpixel",Bn),a(Oe,"Reddit Pixel",Bn),a(Oe,"REDDIT PIXEL",Bn),a(Oe,"reddit pixel",Bn),Oe),Fn="SENTRY",jn=(a(_e={},Fn,Fn),a(_e,"sentry",Fn),a(_e,"Sentry",Fn),_e),Un="SNAP_PIXEL",Gn=(a(Re={},Un,Un),a(Re,"Snap_Pixel",Un),a(Re,"SnapPixel",Un),a(Re,"SNAPPIXEL",Un),a(Re,"snappixel",Un),a(Re,"Snap Pixel",Un),a(Re,"SNAP PIXEL",Un),a(Re,"snap pixel",Un),Re),Kn="TVSQUARED",Hn=(a(Pe={},Kn,Kn),a(Pe,"TVSquared",Kn),a(Pe,"tvsquared",Kn),a(Pe,"tvSquared",Kn),a(Pe,"TvSquared",Kn),a(Pe,"Tvsquared",Kn),a(Pe,"TV Squared",Kn),a(Pe,"tv squared",Kn),a(Pe,"tv Squared",Kn),Pe),zn="VWO",Qn=(a(De={},zn,zn),a(De,"VisualWebsiteOptimizer",zn),a(De,"Visualwebsiteoptimizer",zn),a(De,"visualwebsiteoptimizer",zn),a(De,"vwo",zn),a(De,"Visual Website Optimizer",zn),a(De,"Visual website optimizer",zn),a(De,"visual website optimizer",zn),De),qn="GA360",Vn=(a(Le={},qn,qn),a(Le,"Google Analytics 360",qn),a(Le,"Google analytics 360",qn),a(Le,"google analytics 360",qn),a(Le,"Google Analytics360",qn),a(Le,"Google analytics360",qn),a(Le,"google analytics360",qn),a(Le,"GoogleAnalytics360",qn),a(Le,"GA 360",qn),Le),Wn="ADROLL",Yn=(a(xe={},Wn,Wn),a(xe,"Adroll",Wn),a(xe,"Ad roll",Wn),a(xe,"ad roll",Wn),a(xe,"adroll",Wn),xe),Xn="DCM_FLOODLIGHT",Jn=(a(Me={},Xn,Xn),a(Me,"DCM Floodlight",Xn),a(Me,"dcm floodlight",Xn),a(Me,"Dcm Floodlight",Xn),a(Me,"DCMFloodlight",Xn),a(Me,"dcmfloodlight",Xn),a(Me,"DcmFloodlight",Xn),a(Me,"dcm_floodlight",Xn),a(Me,"DCM_Floodlight",Xn),Me),$n="MATOMO",Zn=(a(Be={},$n,$n),a(Be,"Matomo",$n),a(Be,"matomo",$n),Be),er="VERO",tr=(a(Ne={},er,er),a(Ne,"Vero",er),a(Ne,"vero",er),Ne),nr="MOUSEFLOW",rr=(a(Fe={},nr,nr),a(Fe,"Mouseflow",nr),a(Fe,"mouseflow",nr),a(Fe,"mouseFlow",nr),a(Fe,"MouseFlow",nr),a(Fe,"Mouse flow",nr),a(Fe,"mouse flow",nr),a(Fe,"mouse Flow",nr),a(Fe,"Mouse Flow",nr),Fe),ir="ROCKERBOX",or=(a(je={},ir,ir),a(je,"Rockerbox",ir),a(je,"rockerbox",ir),a(je,"RockerBox",ir),a(je,"Rocker box",ir),a(je,"rocker box",ir),a(je,"Rocker Box",ir),je),sr="CONVERTFLOW",ar=(a(Ue={},sr,sr),a(Ue,"Convertflow",sr),a(Ue,"convertflow",sr),a(Ue,"convertFlow",sr),a(Ue,"ConvertFlow",sr),a(Ue,"Convert flow",sr),a(Ue,"convert flow",sr),a(Ue,"convert Flow",sr),a(Ue,"Convert Flow",sr),a(Ue,"CONVERT FLOW",sr),Ue),ur="SNAPENGAGE",cr=(a(Ge={},ur,ur),a(Ge,"SnapEngage",ur),a(Ge,"Snap_Engage",ur),a(Ge,"snapengage",ur),a(Ge,"SNAP ENGAGE",ur),a(Ge,"Snap Engage",ur),a(Ge,"snap engage",ur),Ge),lr="LIVECHAT",fr=(a(Ke={},lr,lr),a(Ke,"LiveChat",lr),a(Ke,"Live_Chat",lr),a(Ke,"livechat",lr),a(Ke,"LIVE CHAT",lr),a(Ke,"Live Chat",lr),a(Ke,"live chat",lr),Ke),hr="SHYNET",dr=(a(He={},hr,hr),a(He,"shynet",hr),a(He,"ShyNet",hr),a(He,"shyNet",hr),a(He,"Shynet",hr),a(He,"shy net",hr),a(He,"Shy Net",hr),a(He,"shy Net",hr),a(He,"Shy net",hr),He),pr="WOOPRA",gr=(a(ze={},pr,pr),a(ze,"Woopra",pr),a(ze,"woopra",pr),ze),yr="ROLLBAR",vr=(a(Qe={},yr,yr),a(Qe,"RollBar",yr),a(Qe,"Roll_Bar",yr),a(Qe,"rollbar",yr),a(Qe,"Rollbar",yr),a(Qe,"ROLL BAR",yr),a(Qe,"Roll Bar",yr),a(Qe,"roll bar",yr),Qe),mr="QUORA_PIXEL",Ir=(a(qe={},mr,mr),a(qe,"Quora Pixel",mr),a(qe,"Quora pixel",mr),a(qe,"QUORA PIXEL",mr),a(qe,"QuoraPixel",mr),a(qe,"Quorapixel",mr),a(qe,"QUORAPIXEL",mr),a(qe,"Quora_Pixel",mr),a(qe,"quora_pixel",mr),a(qe,"Quora",mr),qe),kr="JUNE",br=(a(Ve={},kr,kr),a(Ve,"June",kr),a(Ve,"june",kr),Ve),Ar="ENGAGE",Er=(a(We={},Ar,Ar),a(We,"Engage",Ar),a(We,"engage",Ar),We),Cr="ITERABLE",Sr=(a(Ye={},Cr,Cr),a(Ye,"Iterable",Cr),a(Ye,"iterable",Cr),Ye),Tr="YANDEX_METRICA",wr=(a(Xe={},Tr,Tr),a(Xe,"Yandexmetrica",Tr),a(Xe,"yandexmetrica",Tr),a(Xe,"yandexMetrica",Tr),a(Xe,"YandexMetrica",Tr),Xe),Or="REFINER",_r=(a(Je={},Or,Or),a(Je,"Refiner",Or),a(Je,"refiner",Or),Je),Rr="QUALAROO",Pr=(a($e={},Rr,Rr),a($e,"Qualaroo",Rr),a($e,"qualaroo",Rr),$e),Dr="PODSIGHTS",Lr=(a(Ze={},Dr,Dr),a(Ze,"Podsights",Dr),a(Ze,"PodSights",Dr),a(Ze,"pod Sights",Dr),a(Ze,"Pod Sights",Dr),a(Ze,"pod sights",Dr),a(Ze,"POD SIGHTS",Dr),a(Ze,"Pod sights",Dr),Ze),xr="AXEPTIO",Mr=(a(et={},xr,xr),a(et,"Axeptio",xr),a(et,"axeptio",xr),et),Br="SATISMETER",Nr=(a(tt={},Br,Br),a(tt,"Satismeter",Br),a(tt,"SatisMeter",Br),a(tt,"SATISMETER",Br),tt),Fr="MICROSOFT_CLARITY",jr=(a(nt={},Fr,Fr),a(nt,"Microsoft Clarity",Fr),a(nt,"Microsoft clarity",Fr),a(nt,"microsoft clarity",Fr),a(nt,"Microsoft_clarity",Fr),a(nt,"MicrosoftClarity",Fr),a(nt,"MICROSOFTCLARITY",Fr),a(nt,"microsoftclarity",Fr),a(nt,"microsoftClarity",Fr),nt),Ur="SENDINBLUE",Gr=(a(rt={},Ur,Ur),a(rt,"Sendinblue",Ur),a(rt,"sendinblue",Ur),a(rt,"SendinBlue",Ur),rt),Kr="OLARK",Hr=(a(it={},Kr,Kr),a(it,"Olark",Kr),a(it,"olark",Kr),it),zr="LEMNISK",Qr=(a(ot={},zr,zr),a(ot,"LEMNISK_MARKETING_AUTOMATION",zr),a(ot,"Lemnisk Marketing Automation",zr),a(ot,"LemniskMarketingAutomation",zr),a(ot,"lemniskmarketingautomation",zr),a(ot,"lemniskMarketingAutomation",zr),a(ot,"lemnisk",zr),a(ot,"Lemnisk",zr),ot),qr="TIKTOK_ADS",Vr=(a(st={},qr,qr),a(st,"TiktokAds",qr),a(st,"TIKTOK_ADS",qr),a(st,"Tiktok ads",qr),a(st,"Tiktok Ads",qr),a(st,"Tik Tok Ads",qr),a(st,"tik tok ads",qr),a(st,"tiktokads",qr),st),Wr=n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n(n({All:"All"},lt),ht),pt),yt),mt),kt),At),Ct),Tt),Ot),Rt),Dt),xt),Bt),Ft),Ut),Vn),Kt),zt),qt),Wt),Xt),$t),en),nn),on),an),cn),fn),dn),gn),vn),In),bn),En),Sn),wn),_n),Pn),Ln),Mn),Nn),jn),Gn),Hn),Qn),Yn),Jn),Zn),tr),rr),ar),cr),fr),dr),gr),vr),Ir),br),Er),Sr),or),wr),_r),Pr),Lr),Mr),Nr),jr),Gr),Hr),Qr),Vr),Yr={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"},Xr=["anonymous_id","id","sent_at","received_at","timestamp","original_timestamp","event_text","event"],Jr="https://api.rudderlabs.com/sourceConfig/?p=cdn&v=2.37.0",$r="v1.1",Zr="js-integrations",ei="".concat("https://cdn.rudderlabs.com","/").concat($r,"/").concat(Zr),ti=1e4,ni=1e3,ri="_RS",ii=["Lax","None","Strict"],oi=["US","EU"],si=["oneTrust","ketch"],ai=["library","consentManagement"],ui=["none","default","full"],ci={All:!0},li="Request failed with status:",fi=[li],hi=function(e){var t=window.rudderanalytics&&window.rudderanalytics.errorReporting;t&&e instanceof Error&&t.notify(e)},di=function(e,t){if(!Array.isArray(e)||!Array.isArray(t))return S(t);var n=S(e);return t.forEach((function(e,t){n[t]=pi(n[t],e)})),n},pi=function(e,t){return O(di,e,t)},gi=function(e,t){return JSON.stringify(e,function(e){var t=[];return function(n,i){if(!e||null!=i){if("object"!==r(i)||null===i)return i;for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(i)?(ut.debug("Circular Reference detected for key: ".concat(n)),"[Circular Reference]"):(t.push(i),i)}}}(t))},yi=function(e,t,n){var i,o;try{i="string"==typeof e?e:e instanceof Error||e.message?e.message:gi(e)}catch(e){i=""}if("object"===r(o=e)&&null!==o&&"target"in o){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(i="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:i},n.sendAdblockPageOptions),""}return"[handleError]::".concat(t||"",' "').concat(i,'"')},vi=function(e,t,n){var r;try{r=yi(e,t,n)}catch(t){ut.error("[handleError] Exception:: ",t),ut.error("[handleError] Original error:: ",gi(e)),hi(t)}r&&(ut.error(r),function(e){return!e.message||!fi.some((function(t){return e.message.includes(t)}))}(e)&&hi(e))};function mi(e){return e&&e.endsWith("/")?e.replace(/\/+$/,""):e}function Ii(){return window.crypto&&"function"==typeof window.crypto.getRandomValues?G():function(){var e,t=0,n="";if(!x||B+16>256){for(x=Array(t=256);t--;)x[t]=256*Math.random()|0;t=B=0}for(;t<16;t++)e=x[B+t],n+=6==t?N[15&e|64]:8==t?N[63&e|128]:N[e],1&t&&t>1&&t<11&&(n+="-");return B++,n}()}function ki(){return(new Date).toISOString()}function bi(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 Ai(e){bi(e,Wr)}function Ei(e){bi(e,Yr)}function Ci(e,t){var n=[];if(!t||0===t.length)return n;var i=!0;void 0!==e.All&&(i=e.All);var o=[];return"string"==typeof t[0]?t.forEach((function(e){o.push({intgName:e,intObj:e})})):"object"===r(t[0])&&t.forEach((function(e){o.push({intgName:e.name,intObj:e})})),o.forEach((function(t){var r=t.intgName,o=t.intObj;if(i){var s=!0;null!=e[r]&&0==e[r]&&(s=!1),s&&n.push(o)}else null!=e[r]&&1==e[r]&&n.push(o)})),n}var Si,Ti=function(){for(var e,t=document.getElementsByTagName("script"),n=!1,r=0;r>>2]>>>24-o%4*8&255;t[r+o>>>2]|=s<<24-(r+o)%4*8}else for(o=0;o>>2]=n[o>>>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=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n,r=[],i=function(t){var n=987654321,r=4294967295;return function(){var i=((n=36969*(65535&n)+(n>>16)&r)<<16)+(t=18e3*(65535&t)+(t>>16)&r)&r;return i/=4294967296,(i+=.5)*(e.random()>.5?1:-1)}},o=0;o>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new s.init(n,t/2)}},c=a.Latin1={stringify:function(e){for(var t=e.words,n=e.sigBytes,r=[],i=0;i>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new s.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},f=i.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,i=n.sigBytes,o=this.blockSize,a=i/(4*o),u=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,c=e.min(4*u,i);if(u){for(var l=0;l>>6-s%4*2;i[o>>>2]|=(a|u)<<24-o%4*8,o++}return n.create(i,o)}t.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp();for(var i=[],o=0;o>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a>>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 o=0;o>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,s=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],I=e[t+8],k=e[t+9],b=e[t+10],A=e[t+11],E=e[t+12],C=e[t+13],S=e[t+14],T=e[t+15],w=o[0],O=o[1],_=o[2],R=o[3];w=c(w,O,_,R,s,7,a[0]),R=c(R,w,O,_,u,12,a[1]),_=c(_,R,w,O,d,17,a[2]),O=c(O,_,R,w,p,22,a[3]),w=c(w,O,_,R,g,7,a[4]),R=c(R,w,O,_,y,12,a[5]),_=c(_,R,w,O,v,17,a[6]),O=c(O,_,R,w,m,22,a[7]),w=c(w,O,_,R,I,7,a[8]),R=c(R,w,O,_,k,12,a[9]),_=c(_,R,w,O,b,17,a[10]),O=c(O,_,R,w,A,22,a[11]),w=c(w,O,_,R,E,7,a[12]),R=c(R,w,O,_,C,12,a[13]),_=c(_,R,w,O,S,17,a[14]),w=l(w,O=c(O,_,R,w,T,22,a[15]),_,R,u,5,a[16]),R=l(R,w,O,_,v,9,a[17]),_=l(_,R,w,O,A,14,a[18]),O=l(O,_,R,w,s,20,a[19]),w=l(w,O,_,R,y,5,a[20]),R=l(R,w,O,_,b,9,a[21]),_=l(_,R,w,O,T,14,a[22]),O=l(O,_,R,w,g,20,a[23]),w=l(w,O,_,R,k,5,a[24]),R=l(R,w,O,_,S,9,a[25]),_=l(_,R,w,O,p,14,a[26]),O=l(O,_,R,w,I,20,a[27]),w=l(w,O,_,R,C,5,a[28]),R=l(R,w,O,_,d,9,a[29]),_=l(_,R,w,O,m,14,a[30]),w=f(w,O=l(O,_,R,w,E,20,a[31]),_,R,y,4,a[32]),R=f(R,w,O,_,I,11,a[33]),_=f(_,R,w,O,A,16,a[34]),O=f(O,_,R,w,S,23,a[35]),w=f(w,O,_,R,u,4,a[36]),R=f(R,w,O,_,g,11,a[37]),_=f(_,R,w,O,m,16,a[38]),O=f(O,_,R,w,b,23,a[39]),w=f(w,O,_,R,C,4,a[40]),R=f(R,w,O,_,s,11,a[41]),_=f(_,R,w,O,p,16,a[42]),O=f(O,_,R,w,v,23,a[43]),w=f(w,O,_,R,k,4,a[44]),R=f(R,w,O,_,E,11,a[45]),_=f(_,R,w,O,T,16,a[46]),w=h(w,O=f(O,_,R,w,d,23,a[47]),_,R,s,6,a[48]),R=h(R,w,O,_,m,10,a[49]),_=h(_,R,w,O,S,15,a[50]),O=h(O,_,R,w,y,21,a[51]),w=h(w,O,_,R,E,6,a[52]),R=h(R,w,O,_,p,10,a[53]),_=h(_,R,w,O,b,15,a[54]),O=h(O,_,R,w,u,21,a[55]),w=h(w,O,_,R,I,6,a[56]),R=h(R,w,O,_,T,10,a[57]),_=h(_,R,w,O,v,15,a[58]),O=h(O,_,R,w,C,21,a[59]),w=h(w,O,_,R,g,6,a[60]),R=h(R,w,O,_,A,10,a[61]),_=h(_,R,w,O,d,15,a[62]),O=h(O,_,R,w,k,21,a[63]),o[0]=o[0]+w|0,o[1]=o[1]+O|0,o[2]=o[2]+_|0,o[3]=o[3]+R|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;n[i>>>5]|=128<<24-i%32;var o=t.floor(r/4294967296),s=r;n[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),e.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=o.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,n,r,i,o,s){var a=e+(t&n|~t&r)+i+s;return(a<>>32-o)+t}function l(e,t,n,r,i,o,s){var a=e+(t&r|n&~r)+i+s;return(a<>>32-o)+t}function f(e,t,n,r,i,o,s){var a=e+(t^n^r)+i+s;return(a<>>32-o)+t}function h(e,t,n,r,i,o,s){var a=e+(n^(t|~r))+i+s;return(a<>>32-o)+t}n.MD5=o._createHelper(u),n.HmacMD5=o._createHmacHelper(u)}(Math),e.MD5)),Ni.exports;var e}var ji,Ui={exports:{}},Gi={exports:{}};function Ki(){return ji||(ji=1,Gi.exports=(a=Di(),t=(e=a).lib,n=t.WordArray,r=t.Hasher,i=e.algo,o=[],s=i.SHA1=r.extend({_doReset:function(){this._hash=new n.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],a=n[3],u=n[4],c=0;c<80;c++){if(c<16)o[c]=0|e[t+c];else{var l=o[c-3]^o[c-8]^o[c-14]^o[c-16];o[c]=l<<1|l>>>31}var f=(r<<5|r>>>27)+u+o[c];f+=c<20?1518500249+(i&s|~i&a):c<40?1859775393+(i^s^a):c<60?(i&s|i&a|s&a)-1894007588:(i^s^a)-899497514,u=a,a=s,s=i<<30|i>>>2,i=r,r=f}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+s|0,n[3]=n[3]+a|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=r.clone.call(this);return e._hash=this._hash.clone(),e}}),e.SHA1=r._createHelper(s),e.HmacSHA1=r._createHmacHelper(s),a.SHA1)),Gi.exports;var e,t,n,r,i,o,s,a}var Hi,zi,Qi={exports:{}};function qi(){return zi||(zi=1,Ui.exports=function(e){return n=(t=e).lib,r=n.Base,i=n.WordArray,o=t.algo,s=o.MD5,a=o.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=this.cfg,r=n.hasher.create(),o=i.create(),s=o.words,a=n.keySize,u=n.iterations;s.lengthi&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),s=this._iKey=t.clone(),a=o.words,u=s.words,c=0;c>>8^255&p^99,i[n]=p,o[p]=n;var g=e[n],y=e[g],v=e[y],m=257*e[p]^16843008*p;s[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,f[p]=m<<16|m>>>16,h[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=n.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),o=this._keySchedule=[],s=0;s6&&s%n==4&&(a=i[a>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a]):(a=i[(a=a<<8|a>>>24)>>>24]<<24|i[a>>>16&255]<<16|i[a>>>8&255]<<8|i[255&a],a^=p[s/n|0]<<24),o[s]=o[s-n]^a}for(var u=this._invKeySchedule=[],c=0;c>>24]]^f[i[a>>>16&255]]^h[i[a>>>8&255]]^d[i[255&a]]}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,s,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,f,h,d,o),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,o,s,a){for(var u=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],f=e[t+2]^n[2],h=e[t+3]^n[3],d=4,p=1;p>>24]^i[l>>>16&255]^o[f>>>8&255]^s[255&h]^n[d++],y=r[l>>>24]^i[f>>>16&255]^o[h>>>8&255]^s[255&c]^n[d++],v=r[f>>>24]^i[h>>>16&255]^o[c>>>8&255]^s[255&l]^n[d++],m=r[h>>>24]^i[c>>>16&255]^o[l>>>8&255]^s[255&f]^n[d++];c=g,l=y,f=v,h=m}g=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[f>>>8&255]<<8|a[255&h])^n[d++],y=(a[l>>>24]<<24|a[f>>>16&255]<<16|a[h>>>8&255]<<8|a[255&c])^n[d++],v=(a[f>>>24]<<24|a[h>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[d++],m=(a[h>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&f])^n[d++],e[t]=g,e[t+1]=y,e[t+2]=v,e[t+3]=m},keySize:8});t.AES=n._createHelper(g)}(),e.AES}(Di(),Mi(),Fi(),qi(),Vi||(Vi=1,Yi.exports=(Wi=Di(),qi(),void(Wi.lib.Cipher||function(e){var t=Wi,n=t.lib,r=n.Base,i=n.WordArray,o=n.BufferedBlockAlgorithm,s=t.enc;s.Utf8;var a=s.Base64,u=t.algo.EvpKDF,c=n.Cipher=o.extend({cfg:r.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?m:y}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)}}}}()});n.StreamCipher=c.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=t.mode={},f=n.BlockCipherMode=r.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}}),h=l.CBC=function(){var t=f.extend();function n(t,n,r){var i=this._iv;if(i){var o=i;this._iv=e}else o=this._prevBlock;for(var s=0;s>>2];e.sigBytes-=t}};n.BlockCipher=c.extend({cfg:c.cfg.extend({mode:h,padding:d}),reset:function(){c.reset.call(this);var e=this.cfg,t=e.iv,n=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=n.createEncryptor;else r=n.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==r?this._mode.init(this,t&&t.words):(this._mode=r.call(n,this,t&&t.words),this._mode.__creator=r)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var p=n.CipherParams=r.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),g=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,n=e.salt;if(n)var r=i.create([1398893684,1701076831]).concat(n).concat(t);else r=t;return r.toString(a)},parse:function(e){var t=a.parse(e),n=t.words;if(1398893684==n[0]&&1701076831==n[1]){var r=i.create(n.slice(2,4));n.splice(0,4),t.sigBytes-=16}return p.create({ciphertext:t,salt:r})}},y=n.SerializableCipher=r.extend({cfg:r.extend({format:g}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r),o=i.finalize(t),s=i.cfg;return p.create({ciphertext:o,key:n,iv:s.iv,algorithm:e,mode:s.mode,padding:s.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}}),v=(t.kdf={}).OpenSSL={execute:function(e,t,n,r){r||(r=i.random(8));var o=u.create({keySize:t+n}).compute(e,r),s=i.create(o.words.slice(t),4*n);return o.sigBytes=4*t,p.create({key:o,iv:s,salt:r})}},m=n.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:v}),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 o=y.encrypt.call(this,e,t,i.key,r);return o.mixIn(i),o},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,y.decrypt.call(this,e,t,i.key,r)}})}()))));var Xi=h(Ri.exports),Ji={exports:{}};!function(e,t){e.exports=function(e){return e.enc.Utf8}(Di())}(Ji);var $i=h(Ji.exports),Zi="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function eo(){throw new Error("setTimeout has not been defined")}function to(){throw new Error("clearTimeout has not been defined")}var no=eo,ro=to;function io(e){if(no===setTimeout)return setTimeout(e,0);if((no===eo||!no)&&setTimeout)return no=setTimeout,setTimeout(e,0);try{return no(e,0)}catch(t){try{return no.call(null,e,0)}catch(t){return no.call(this,e,0)}}}"function"==typeof Zi.setTimeout&&(no=setTimeout),"function"==typeof Zi.clearTimeout&&(ro=clearTimeout);var oo,so=[],ao=!1,uo=-1;function co(){ao&&oo&&(ao=!1,oo.length?so=oo.concat(so):uo=-1,so.length&&lo())}function lo(){if(!ao){var e=io(co);ao=!0;for(var t=so.length;t;){for(oo=so,so=[];++uo1)for(var n=1;n=1.5*n;return Math.round(e/n)+" "+r+(i?"s":"")}return Co=function(u,c){c=c||{};var l=r(u);if("string"===l&&u.length>0)return function(r){if((r=String(r)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(!a)return;var u=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return u*s;case"weeks":case"week":case"w":return u*o;case"days":case"day":case"d":return u*i;case"hours":case"hour":case"hrs":case"hr":case"h":return u*n;case"minutes":case"minute":case"mins":case"min":case"m":return u*t;case"seconds":case"second":case"secs":case"sec":case"s":return u*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u;default:return}}(u);if("number"===l&&isFinite(u))return c.long?function(r){var o=Math.abs(r);if(o>=i)return a(r,o,i,"day");if(o>=n)return a(r,o,n,"hour");if(o>=t)return a(r,o,t,"minute");if(o>=e)return a(r,o,e,"second");return r+" ms"}(u):function(r){var o=Math.abs(r);if(o>=i)return Math.round(r/i)+"d";if(o>=n)return Math.round(r/n)+"h";if(o>=t)return Math.round(r/t)+"m";if(o>=e)return Math.round(r/e)+"s";return r+"ms"}(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))},Co}var _o=function(e){function t(e){var r,i,o,s=null;function a(){for(var e=arguments.length,n=new Array(e),i=0;i=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=_o(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(wo,wo.exports);var Ro=wo.exports,Po=Ro("cookie"),Do=function(e,t,n){switch(arguments.length){case 3:case 2:return Lo(e,t,n);case 1:return Mo(e);default:return xo()}};function Lo(e,t,n){n=n||{};var r=Bo(e)+"="+Bo(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}function xo(){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=0;--i)r.push(t.slice(i).join("."));return r},r.cookie=n,t=e.exports=r}(ts,ts.exports);var cs=h(ts.exports),ls=function(){function e(t){i(this,e),this.cOpts={},this.options(t),this.isSupportAvailable=this.checkSupportAvailability()}return s(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(cs(window.location.href));return"."===t&&(t=null),this.cOpts=es(e,{maxage:31536e6,path:"/",domain:t,samesite:"Lax"}),this.cOpts}},{key:"set",value:function(e,t){try{return Fo(e,t,S(this.cOpts)),!0}catch(e){return ut.error(e),!1}}},{key:"get",value:function(e){return Fo(e)}},{key:"remove",value:function(e){try{return Fo(e,null,S(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}(),fs=new ls({}),hs={exports:{}};!function(e,t){e.exports=function(){function e(e){return e=JSON.stringify(e),!!/^\{[\s\S]*\}$/.test(e)}function t(e){return void 0===e||"function"==typeof e?e+"":JSON.stringify(e)}function n(e){if("string"==typeof e)try{return JSON.parse(e)}catch(t){return e}}function r(e){return"[object Function]"==={}.toString.call(e)}function i(e){return"[object Array]"===Object.prototype.toString.call(e)}function o(e){var t="_Is_Incognit",n="yes";try{e||(e=window.localStorage),e.setItem(t,n),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{e.getItem(t)===n&&e.removeItem(t)}return e}var s=o();function a(){if(!(this instanceof a))return new a}a.prototype={set:function(n,r){if(n&&!e(n))s.setItem(n,t(r));else if(e(n))for(var i in n)this.set(i,n[i]);return this},get:function(e){if(!e){var t={};return this.forEach((function(e,n){return t[e]=n})),t}if("?"===e.charAt(0))return this.has(e.substr(1));var r=arguments;if(r.length>1){for(var i={},o=0,a=r.length;o-1&&(n[t[r]]=this.get(t[r]));return n}};var u=null;function c(t,n){var o=arguments,s=null;if(u||(u=a()),0===o.length)return u.get();if(1===o.length){if("string"==typeof t)return u.get(t);if(e(t))return u.set(t)}if(2===o.length&&"string"==typeof t){if(!n)return u.remove(t);if(n&&"string"==typeof n)return u.set(t,n);n&&r(n)&&(s=null,s=n(t,u.get(t)),c.set(t,s))}if(2===o.length&&i(t)&&r(n))for(var l=0,f=t.length;l0&&void 0!==arguments[0]?arguments[0]:{};return 0===arguments.length||(es(e,{enabled:!0}),this.enabled=e.enabled&&this.enabled,this.sOpts=e),this.sOpts}},{key:"set",value:function(e,t){return ds.set(e,t)}},{key:"get",value:function(e){return ds.get(e)}},{key:"remove",value:function(e){return ds.remove(e)}},{key:"checkSupportAvailability",value:function(){var e="test_rudder_ls";return this.set(e,!0),!!this.get(e)&&(this.remove(e),!0)}}]),e}(),gs=new ps({}),ys="rl_user_id",vs="rl_trait",ms="rl_anonymous_id",Is="rl_group_id",ks="rl_group_trait",bs="rl_page_init_referrer",As="rl_page_init_referring_domain",Es="rl_session",Cs="rl_auth_token",Ss="RudderEncrypt:",Ts="Rudder",ws={segment:"ajs_anonymous_id"};function Os(e){try{return e?JSON.parse(e):null}catch(t){return ut.error(t),e||null}}function _s(e){return e.replace(/^\s+|\s+$/gm,"")}function Rs(e){return e&&"string"==typeof e&&""!==_s(e)&&e.substring(0,Ss.length)===Ss?Xi.decrypt(e.substring(Ss.length),Ts).toString($i):e}var Ps=function(){function e(){i(this,e),fs.isSupportAvailable?this.storage=fs:(gs.enabled&&(this.storage=gs),this.storage||ut.error("No storage is available :: initializing the SDK without storage"))}return s(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""===_s(e)?e:"".concat(Ss).concat(Xi.encrypt(e,Ts).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(ys,e)}},{key:"setUserTraits",value:function(e){this.setItem(vs,e)}},{key:"setGroupId",value:function(e){this.setStringItem(Is,e)}},{key:"setGroupTraits",value:function(e){this.setItem(ks,e)}},{key:"setAnonymousId",value:function(e){this.setStringItem(ms,e)}},{key:"setInitialReferrer",value:function(e){this.setItem(bs,e)}},{key:"setInitialReferringDomain",value:function(e){this.setItem(As,e)}},{key:"setSessionInfo",value:function(e){this.setItem(Es,e)}},{key:"setAuthToken",value:function(e){this.setItem(Cs,e)}},{key:"getItem",value:function(e){return Os(Rs(this.storage.get(e)))}},{key:"getUserId",value:function(){return this.getItem(ys)}},{key:"getUserTraits",value:function(){return this.getItem(vs)}},{key:"getGroupId",value:function(){return this.getItem(Is)}},{key:"getGroupTraits",value:function(){return this.getItem(ks)}},{key:"fetchExternalAnonymousId",value:function(e){var t,n=e.toLowerCase();return Object.keys(ws).includes(n)&&"segment"===n?(gs.enabled&&(t=gs.get(ws[n])),!t&&fs.isSupportAvailable&&(t=fs.get(ws[n])),t):t}},{key:"getAnonymousId",value:function(e){var t=Os(Rs(this.storage.get(ms)));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(bs)}},{key:"getInitialReferringDomain",value:function(){return this.getItem(As)}},{key:"getSessionInfo",value:function(){return this.getItem(Es)}},{key:"getAuthToken",value:function(){return this.getItem(Cs)}},{key:"removeItem",value:function(e){return this.storage.remove(e)}},{key:"removeSessionInfo",value:function(){this.removeItem(Es)}},{key:"clear",value:function(e){this.storage.remove(ys),this.storage.remove(vs),this.storage.remove(Is),this.storage.remove(ks),this.storage.remove(Cs),e&&this.storage.remove(ms)}}]),e}(),Ds=new Ps;function Ls(){return document.referrer||"$direct"}function xs(e){var t=e.split("/");return t.length>=3?t[2]:""}function Ms(){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 Bs(){var e=Ms(),t=window.location.pathname;if(e)try{t=new URL(e).pathname}catch(e){}var n=window.location,r=n.search,i=n.href,o=document.title,s=function(e){var t,n=Ms(),r=(t=n?n.includes("?")?n:n+e:window.location.href).indexOf("#");return r>-1?t.slice(0,r):t}(r),a=i,u=Ls();return{path:t,referrer:u,referring_domain:xs(u),search:r,title:o,url:s,tab_url:a,initial_referrer:Ds.getInitialReferrer()||"",initial_referring_domain:Ds.getInitialReferringDomain()||""}}for(var Ns,Fs=s((function e(){i(this,e),this.name="RudderLabs JavaScript SDK",this.namespace="com.rudderlabs.javascript",this.version="2.37.0"})),js=s((function e(){i(this,e),this.name="RudderLabs JavaScript SDK",this.version="2.37.0"})),Us=s((function e(){i(this,e),this.name="",this.version=""})),Gs=s((function e(){i(this,e),this.density=0,this.width=0,this.height=0,this.innerWidth=0,this.innerHeight=0})),Ks=s((function e(){var t;i(this,e),this.app=new Fs,this.traits=null,this.library=new js,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 Us,this.locale="undefined"==typeof navigator?null:navigator.language||navigator.browserLanguage,this.screen=(t=new Gs,"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)})),Hs=function(){function e(){i(this,e),this.channel="web",this.context=new Ks,this.type=null,this.messageId=Ii(),this.originalTimestamp=(new Date).toISOString(),this.anonymousId=null,this.userId=null,this.event=null,this.properties={}}return s(e,[{key:"getProperty",value:function(e){return this.properties[e]}},{key:"addProperty",value:function(e,t){this.properties[e]=t}}]),e}(),zs=function(){function e(){i(this,e),this.message=new Hs}return s(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}(),Qs=function(){function e(){i(this,e),this.rudderProperty=null,this.rudderUserProperty=null,this.event=null,this.userId=null,this.type=null}return s(e,[{key:"setType",value:function(e){return this.type=e,this}},{key:"build",value:function(){var e=new zs;return e.setUserId(this.userId),e.setType(this.type),e.setEventName(this.event),e.setProperty(this.rudderProperty),e.setUserProperty(this.rudderUserProperty),e}}]),e}(),qs={},Vs=256,Ws=[];Vs--;)Ws[Vs]=(Vs+256).toString(16).substring(1);qs.v4=function(){var e,t=0,n="";if(!Ns||Vs+16>256){for(Ns=Array(t=256);t--;)Ns[t]=256*Math.random()|0;t=Vs=0}for(;t<16;t++)e=Ns[Vs+t],n+=6==t?Ws[15&e|64]:8==t?Ws[63&e|128]:Ws[e],1&t&&t>1&&t<11&&(n+="-");return Vs++,n};var Ys={},Xs=Object.prototype.hasOwnProperty,Js=String.prototype.charAt,$s=Object.prototype.toString,Zs=function(e,t){return Js.call(e,t)},ea=function(e,t){return Xs.call(e,t)},ta=function(e,t){t=t||ea;for(var n=[],r=0,i=e.length;r=Ea.RESCHEDULE&&o+2*nthis.maxAttempts)},Da.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))},Da.prototype.addItem=function(e){this._enqueue({item:e,attemptNumber:0,time:this._schedule.now(),id:Ta()})},Da.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||Ta()}):this.emit("discard",e,t)},Da.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()},Da.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(),o=[];function s(n,r){o.push({item:n.item,done:function(i,o){var s=t.get(e.keys.IN_PROGRESS)||{};delete s[r],t.set(e.keys.IN_PROGRESS,s),e.emit("processed",i,o,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++0&&(this._processId=this._schedule.run(this._processHead,n[0].time-i,_a.Modes.ASAP))},Da.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,_a.Modes.ASAP)},Da.prototype._checkReclaim=function(){var e=this;Oa((function(t){t.id!==e.id&&(e._schedule.now()-t.get(e.keys.ACK)=0?n.emit("duplication",e.item,e.attemptNumber):(i.queue.push({item:e.item,attemptNumber:e.attemptNumber+t,time:n._schedule.now(),id:r}),s.push(r))}),e)};a(o.queue,0),a(o.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 La=h(Da),xa={maxRetryDelay:36e4,minRetryDelay:1e3,backoffFactor:2,maxAttempts:10,maxItems:100},Ma=function(){function e(){i(this,e),this.url="",this.writeKey=""}return s(e,[{key:"init",value:function(e,t,n){var r=this;this.url=t,this.writeKey=e,n&&u(xa,n),this.payloadQueue=new La("rudder",xa,(function(e,t){e.message.sentAt=ki(),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 o=new XMLHttpRequest;for(var s in o.open("POST",e,!0),t)o.setRequestHeader(s,t[s]);o.timeout=r,o.ontimeout=i,o.onerror=i,o.onreadystatechange=function(){if(4===o.readyState)if(429===o.status||o.status>=500&&o.status<600){var t="".concat(li,' "').concat(o.status,'" status text: "').concat(o.statusText,'" for URL: "').concat(e,'"'),n=new Error(t);vi(n),i(n)}else i(null,o.status)},o.send(gi(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}(),Ba="queue",Na=64e3,Fa=function(){function e(){i(this,e),this.storage=gs,this.maxItems=10,this.flushQueueTimeOut=void 0,this.timeOutActive=!1,this.flushQueueTimeOutInterval=6e5,this.url="",this.writekey="",this.queueName="".concat(Ba,".").concat(Date.now())}return s(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);gi({batch:n},!0).length>Na&&(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=gi({batch:e},!0),n=new Blob([t],{type:"text/plain"}),r="".concat(this.url,"?writeKey=").concat(this.writekey);try{"function"!=typeof navigator.sendBeacon&&vi(new Error("Beacon API is not supported by browser")),navigator.sendBeacon(r,n)||vi(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),vi(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}(),ja=function(){function e(){i(this,e),this.queue=void 0}return s(e,[{key:"initialize",value:function(e,t,n){var i={},o=mi(t);n&&n.useBeacon&&navigator.sendBeacon?(n.beaconQueueOptions&&null!=n.beaconQueueOptions&&"object"===r(n.beaconQueueOptions)&&(i=n.beaconQueueOptions),o="".concat(o,"/beacon/v1/batch"),this.queue=new Fa):(n&&n.useBeacon&&ut.info("[EventRepository] sendBeacon feature not available in this browser :: fallback to XHR"),n&&n.queueOptions&&null!=n.queueOptions&&"object"===r(n.queueOptions)&&(i=n.queueOptions),this.queue=new Ma),this.queue.init(e,o,i)}},{key:"enqueue",value:function(e,t){var n=e.getElementContent();n.originalTimestamp=n.originalTimestamp||ki(),n.sentAt=ki(),gi(n,!0).length>32e3&&ut.error("[EventRepository] enqueue:: message length greater 32 Kb ",n),this.queue.enqueue(n,t)}}]),e}(),Ua=new ja,Ga={maxRetryDelay:36e4,minRetryDelay:1e3,backoffFactor:2,maxAttempts:1/0},Ka=function(){function e(){i(this,e),this.callback=void 0,this.processQueueElements=!1}return s(e,[{key:"init",value:function(e,t){var n=this;e&&u(Ga,e),t&&(this.callback=t),this.payloadQueue=new La("rs_events",Ga,(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,zs.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}(),Ha="RS_JS_SDK",za=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{var r=document.getElementById(e);if(r)return;var i=document.createElement("script");i.src=t,i.async=void 0===n.async||n.async,i.type="text/javascript",i.id=e,!0!==n.skipDatasetAttributes&&(i.setAttribute("data-loader",Ha),void 0!==n.isNonNativeSDK&&i.setAttribute("data-isNonNativeSDK",n.isNonNativeSDK));var o=document.getElementsByTagName("head");if(o.length>0)o[0].insertBefore(i,o[0].firstChild);else{var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(i,s)}}catch(s){vi(s)}},Qa=function(){return navigator&&navigator.language},qa=function(){return navigator&&navigator.userAgent};function Va(e){return decodeURIComponent(atob(e).split("").map((function(e){return"%".concat("00".concat(e.charCodeAt(0).toString(16)).slice(-2))})).join(""))}function Wa(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return Va(e=e.endsWith("..")?e.substr(0,e.length-2):e)}var Ya=/^[a-zA-Z0-9\-_.]+$/,Xa="*";function Ja(e,t,n,r){var i=function(e,t){return[e,(new Date).getTimezoneOffset(),t].join(Xa)}(n,r),o=t||0,s=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>>8^t[255&(n^e.charCodeAt(r))];return(-1^n)>>>0}([i,Math.floor(Date.now()/6e4)-o,e].join(Xa));return s.toString(36)}function $a(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=qa(),r=Qa(),i=0;i<=1;i+=1)if(Ja(e,i,n,r)===t)return!0;return!1}(r,n)?function(e){for(var t={},n=e.split(Xa),r=0;r0&&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){vi(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}(),iu=new ru,ou=["integrations","anonymousId","originalTimestamp"],su="rs-bugsnag",au="bugsnag",uu=["Bugsnag",au],cu="{{{{__RS_BUGSNAG_API_KEY__}}}}",lu=["rudder-analytics.min.js","rudder-analytics-staging.min.js","rudder-analytics.js"].concat(c(Object.keys(Za).map((function(e){return"".concat(Za[e],".min.js")}))),c(Object.keys(Za).map((function(e){return"".concat(Za[e],"-staging.min.js")}))),c(Object.keys(Za).map((function(e){return"".concat(Za[e],".js")})))),fu=function(e){var t=e&&e._client&&e._client._notifier&&e._client._notifier.version;if(!t){var n=e({apiKey:cu,releaseStage:"version-test",beforeSend:function(){return!1}});t=n.notifier&&n.notifier.version,n=void 0}return t&&"6"===t.charAt(0)},hu=function(e){uu.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)}))&&za(e,"https://d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js",{isNonNativeSDK:"true",skipDatasetAttributes:!0})},du=function(){function e(t,n){i(this,e),this.pluginName=su,this.sourceId=t,this.onClientReady=n,this.initClientOnLibReadyInterval=void 0,this.init()}return s(e,[{key:"init",value:function(){var e=this;if(!window.rudderanalytics||!window.rudderanalytics.errorReporting){if(!cu.match(/{{.+}}/)){hu(this.pluginName);var t=window.bugsnag;"function"!=typeof t?(this.initClientOnLibReadyInterval=setInterval((function(){var t=window.bugsnag;"function"==typeof t&&(fu(t)&&e.initClient(),clearInterval(e.initClientOnLibReadyInterval))}),100),setTimeout((function(){clearInterval(e.initClientOnLibReadyInterval)}),ti)):fu(t)&&this.initClient()}}}},{key:"initClient",value:function(){var e,t=window.bugsnag;this.client=t({apiKey:cu,appVersion:"2.37.0",metaData:{SDK:{name:"JS",installType:"cdn"}},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 lu.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}(),pu=su,gu=[su],yu=function(){function e(t){i(this,e),this.isEnabled=!1,this.providerName=pu,this.provider=void 0,this.logger=t,this.onClientReady=this.onClientReady.bind(this),this.exposeToGlobal=this.exposeToGlobal.bind(this)}return s(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||gu.includes(e)?this.providerName=e:this.logger.error("[Analytics] ErrorReporting :: Invalid error reporting provider value. Value should be one of: ".concat(gu.join(","))):this.providerName=pu}},{key:"initProvider",value:function(e,t){if(this.providerName===su)this.provider=new du(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}(),vu=new(function(){function e(){i(this,e),this.retryAttempt=3,this.queue=[],this.isTransformationProcessing=!1,this.authToken=null}return s(e,[{key:"init",value:function(e,t,n){this.dataPlaneUrl=mi(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 o="".concat(n.dataPlaneUrl,"/transform"),s={"Content-Type":"application/json",Authorization:"Basic ".concat(btoa("".concat(n.writeKey,":")))};try{var a=new XMLHttpRequest;a.open("POST",o,!0),Object.keys(s).forEach((function(e){return a.setRequestHeader(e,s[e])})),a.timeout=1e4,a.onreadystatechange=function(){if(4===a.readyState)try{var o=a.status,s=a.response;if(200===o)return s&&"string"==typeof s?(s=JSON.parse(s),void r({transformedPayload:s.transformedBatch,transformationServerAccess:!0})):void i("[Transformation]:: Transformation failed. Invalid response from server.");if(400===o){var u=s?"[Transformation]:: ".concat(s):"[Transformation]:: Invalid request payload";return void i(u)}if(404===o)return void r({transformedPayload:e.batch,transformationServerAccess:!1});if(!(t>0))return void i("[Transformation]:: Transformation failed with status ".concat(o));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(gi(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){vi("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}()),mu=function(){function e(){i(this,e),this.initialized=!1,this.clientIntegrations=[],this.loadOnlyIntegrations={},this.clientIntegrationObjects=void 0,this.successfullyLoadedIntegration=[],this.failedToBeLoadedIntegration=[],this.toBeProcessedArray=[],this.toBeProcessedByIntegrationArray=[],this.storage=Ds,this.eventRepository=Ua,this.preProcessQueue=new Ka,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=iu,this.version="2.37.0",this.lockIntegrationsVersion=!1,this.errorReporting=new yu(ut),this.deniedConsentIds=[],this.transformationHandler=vu}return s(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=Ls();this.storage.setInitialReferrer(e),this.storage.setInitialReferringDomain(xs(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(Za[t.name]).concat(ri)]}))||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){return window[e]&&window[e][t]&&window[e][t].prototype&&void 0!==window[e][t].prototype.constructor}},{key:"processResponse",value:function(e,t){var n=this;try{var i=t;try{if("string"==typeof t&&(i=JSON.parse(t)),!i||"object"!==r(i)||Array.isArray(i))return void ut.error("Invalid source configuration")}catch(e){return void vi(e)}try{this.errorReporting.init(i.source.config,i.source.id)}catch(e){vi(e)}if(this.serverUrl=_i(i,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=c(e.toBeProcessedArray[0]);e.toBeProcessedArray.shift();var n=t[0];t.shift(),e[n].apply(e,c(t))}}(this),i.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=Ci(this.loadOnlyIntegrations,this.clientIntegrations),Object.keys(this.cookieConsentOptions).length>0)try{var o=nu(this.cookieConsentOptions);this.deniedConsentIds=o&&o.getDeniedList(),this.clientIntegrations=this.clientIntegrations.filter((function(e){return!o||o&&o.isEnabled(e.config)}))}catch(e){vi(e)}this.clientIntegrations=this.clientIntegrations.filter((function(e){return!!Za[e.name]||(ut.error("[Analytics] Integration:: ".concat(e.name," not available for initialization")),!1)}));var s="";Ti().isStaging&&(s="-staging"),this.bufferDataPlaneEventsUntilReady&&setTimeout((function(){n.processBufferedCloudModeEvents()}),this.dataPlaneEventsBufferTimeout),this.errorReporting.leaveBreadcrumb("Starting device-mode initialization"),this.clientIntegrations.forEach((function(e){var t=Za[e.name],r="".concat(t).concat(ri),i="".concat(n.destSDKBaseURL,"/").concat(t).concat(s,".min.js");window.hasOwnProperty(r)||za(r,i,{isNonNativeSDK:!0});var o=n,a=setInterval((function(){if(o.integrationSDKLoaded(r,t)){var i,s=window[r];clearInterval(a);try{var u="[Analytics] processResponse :: trying to initialize integration name:: ".concat(r);n.errorReporting.leaveBreadcrumb(u),(i=new s[t](e.config,o,e.destinationInfo)).init(),o.isInitialized(i).then((function(){o.dynamicallyLoadedIntegrations[r]=s[t]}))}catch(e){var c="[Analytics] 'integration.init()' failed :: ".concat(r," :: ").concat(e.message);vi(e,c),o.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){vi(e)}}},{key:"sendDataToDestination",value:function(e,t,n){try{if(e[n]){var r=S(t);e[n](r)}}catch(t){var i="[sendToNative]:: [Destination: ".concat(e.name,"]:: ");vi(t,i)}}},{key:"sendTransformedDataToDestination",value:function(e,t,n){var r=this;try{Ei(t.message.integrations),this.transformationHandler.enqueue(t,(function(t){var i=t.transformedPayload,o=t.transformationServerAccess;i&&e.forEach((function(e){try{var t,s=[];if(o){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?s.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 s=i;null===(t=s)||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)),vi(t)}}))}))}catch(e){e instanceof Error&&(e.message="[DMT]:: ".concat(e.message)),vi(e)}}},{key:"processAndSendEventsToDeviceMode",value:function(e,t,n){var r=this,i=[],o=[];e.forEach((function(e){!r.IsEventBlackListed(t.message.event,e.name)&&(e.areTransformationsConnected?o.push(e):i.push(e))})),i.forEach((function(e){r.sendDataToDestination(e,t,n)})),o.length>0&&this.sendTransformedDataToDestination(o,t,n)}},{key:"queueEventForDataPlane",value:function(e,t){var n=t.message.integrations||{All:!0};t.message.integrations=function(e,t){var n=S(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 pi(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=S(t),n.forEach((function(e){if(e.getDataForIntegrationsObject)try{r=pi(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&&Ai(t[0].message.integrations);var r=Ci(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,i,o){if(this.errorReporting.leaveBreadcrumb("Page event"),this.loaded){"function"==typeof i&&(o=i,i=null),"function"==typeof n&&(o=n,i=n=null),"function"==typeof t&&(o=t,i=n=t=null),"function"==typeof e&&(o=e,i=n=t=e=null),"object"===r(e)&&null!=e&&null!=e&&(i=t,n=e,t=e=null),"object"===r(t)&&null!=t&&null!=t&&(i=n,n=t,t=null),"string"==typeof e&&"string"!=typeof t&&(t=e,e=null),this.sendAdblockPage&&"RudderJS-Initiated"!=e&&this.sendSampleRequest();var s=S(n),a=S(i),u=(new Qs).setType("page").build();s||(s={}),t&&(u.message.name=s.name=t),e&&(u.message.category=s.category=e),u.message.properties=this.getPageProperties(s),this.processAndSendDataToDestinations("page",u,a,o)}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=S(t),o=S(n),s=(new Qs).setType("track").build();e&&s.setEventName(e),s.setProperty(i||{}),this.processAndSendDataToDestinations("track",s,o,r)}else this.toBeProcessedArray.push(["track"].concat(Array.prototype.slice.call(arguments)))}},{key:"identify",value:function(e,t,n,i){if(this.errorReporting.leaveBreadcrumb("Identify event"),this.loaded){"function"==typeof n&&(i=n,n=null),"function"==typeof t&&(i=t,n=null,t=null),"object"===r(e)&&(n=t,t=e,e=this.userId);var o=wi(e);o&&this.userId&&o!==this.userId&&this.reset(),this.userId=o,this.storage.setUserId(this.userId);var s=S(t),a=S(n);if(s){for(var u in s)this.userTraits[u]=s[u];this.storage.setUserTraits(this.userTraits)}var c=(new Qs).setType("identify").build();this.processAndSendDataToDestinations("identify",c,a,i)}else this.toBeProcessedArray.push(["identify"].concat(Array.prototype.slice.call(arguments)))}},{key:"alias",value:function(e,t,n,i){if(this.errorReporting.leaveBreadcrumb("Alias event"),this.loaded){"function"==typeof n&&(i=n,n=null),"function"==typeof t&&(i=t,n=null,t=null),"function"==typeof e&&(i=e,n=null,t=null,e=null),"object"===r(t)&&(n=t,t=null),"object"===r(e)&&(n=e,t=null,e=null);var o=(new Qs).setType("alias").build();o.message.previousId=wi(t)||(this.userId?this.userId:this.getAnonymousId()),o.message.userId=wi(e);var s=S(n);this.processAndSendDataToDestinations("alias",o,s,i)}else this.toBeProcessedArray.push(["alias"].concat(Array.prototype.slice.call(arguments)))}},{key:"group",value:function(e,t,n,i){if(this.errorReporting.leaveBreadcrumb("Group event"),this.loaded){if(0!==arguments.length){"function"==typeof n&&(i=n,n=null),"function"==typeof t&&(i=t,n=null,t=null),"object"===r(e)&&(n=t,t=e,e=this.groupId),"function"==typeof e&&(i=e,n=null,t=null,e=this.groupId),this.groupId=wi(e),this.storage.setGroupId(this.groupId);var o=S(t),s=S(n),a=(new Qs).setType("group").build();if(o)for(var u in o)this.groupTraits[u]=o[u];else this.groupTraits={};this.storage.setGroupTraits(this.groupTraits),this.processAndSendDataToDestinations("group",a,s,i)}}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=Wr[t],r=this.clientIntegrations.find((function(e){return e.name===n})).config,i=r.blacklistedEvents,o=r.whitelistedEvents,s=r.eventFilteringOption;if(!s)return!1;var a=e.trim().toUpperCase();switch(s){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(o)||!o.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,r,i){try{this.anonymousId||this.setAnonymousId(),this.errorReporting.leaveBreadcrumb("Started sending data to destinations"),t.message.context.traits=n({},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=n({},this.groupTraits)));try{var o=this.uSession.getSessionInfo(),s=o.sessionId,a=o.sessionStart;t.message.context.sessionId=s,a&&(t.message.context.sessionStart=!0)}catch(e){vi(e)}f=this.cookieConsentOptions,h=!1,Object.keys(f).forEach((function(e){si.includes(e)&&"boolean"==typeof f[e].enabled&&!0===f[e].enabled&&(h=!0)})),h&&(t.message.context.consentManagement={deniedConsentIds:this.deniedConsentIds||[]}),this.processOptionsParam(t,r),function(e,t){var n=e.properties,r=e.traits;n&&Object.keys(n).forEach((function(e){Xr.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){Xr.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){Xr.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?Ai(u):u=this.shouldUseGlobalIntegrationsConfigInEvents()?this.loadOnlyIntegrations:ci,t.message.integrations=u;try{t.message.context["ua-ch"]=this.uach}catch(e){vi(e)}if(this.clientIntegrationObjects){var c=Ci(u,this.clientIntegrationObjects);this.processAndSendEventsToDeviceMode(c,t,e)}else this.toBeProcessedByIntegrationArray.push([e,t]);var l=S(t);Ei(l.message.integrations),!this.bufferDataPlaneEventsUntilReady||this.clientIntegrationObjects?this.queueEventForDataPlane(e,l):this.preProcessQueue.enqueue(e,l),i&&"function"==typeof i&&i(l)}catch(e){vi(e)}var f,h}},{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(r.length);"campaign"===i&&(i="name"),t[i]=e}}))}catch(e){}return t}},{key:"addCampaignInfo",value:function(e){var t=e.message.context;t&&"object"===r(t)&&(e.message.context.campaign=this.utm(window.location.href))}},{key:"processOptionsParam",value:function(e,t){var i=e.message,o=i.type,s=i.properties;this.addCampaignInfo(e),e.message.context.page=this.getContextPageProperties("page"===o?s:void 0),function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};"object"===r(t)&&null!==t&&Object.keys(t).forEach((function(n){ou.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]:{},i=e.context;return"object"!==r(t)||null===t||Object.keys(t).forEach((function(e){if(!ou.includes(e)&&!ai.includes(e))if("context"!==e)i=pi(i,a({},e,t[e]));else if("object"===r(t[e])&&null!==t[e]){var o={};Object.keys(t[e]).forEach((function(n){ai.includes(n)||(o[n]=t[e][n])})),i=pi(i,n({},o))}else ut.error("[Analytics: processOptionsParam] context passed in options ".concat(e," is not object."))})),i}(e.message,t)}},{key:"getPageProperties",value:function(e,t){var n=Bs(),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=Bs(),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?$a(t):null,r=n?n.rs_amp_id:null;this.anonymousId=e||r||Ii(),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,i){var o=this;if("object"===r(t)&&null!==t&&(i=t,t=null),i&&i.logLevel&&(this.logLevel=i.logLevel,ut.setLogLevel(i.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");i&&i.cookieConsentManager&&(this.cookieConsentOptions=i.cookieConsentManager),this.writeKey=e,this.serverUrl=t,this.options=i;var s={};if(i&&i.setCookieDomain&&(s=n(n({},s),{},{domain:i.setCookieDomain})),i&&"boolean"==typeof i.secureCookie&&(s=n(n({},s),{},{secure:i.secureCookie})),i&&-1!==ii.indexOf(i.sameSiteCookie)&&(s=n(n({},s),{},{samesite:i.sameSiteCookie})),this.storage.options(s),i&&"string"==typeof i.uaChTrackLevel&&ui.includes(i.uaChTrackLevel)&&(this.uaChTrackLevel=i.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){o.uach=e}),this.uaChTrackLevel),i&&i.integrations&&(u(this.loadOnlyIntegrations,i.integrations),Ai(this.loadOnlyIntegrations)),this.useGlobalIntegrationsConfigInEvents=i&&!0===i.useGlobalIntegrationsConfigInEvents,i&&i.sendAdblockPage&&(this.sendAdblockPage=!0),i&&i.sendAdblockPageOptions&&"object"===r(i.sendAdblockPageOptions)&&(this.sendAdblockPageOptions=i.sendAdblockPageOptions),this.uSession.initialize(i),i&&i.clientSuppliedCallbacks){var a={};Object.keys(this.methodToCallbackMapping).forEach((function(e){o.methodToCallbackMapping.hasOwnProperty(e)&&i.clientSuppliedCallbacks[o.methodToCallbackMapping[e]]&&(a[e]=i.clientSuppliedCallbacks[o.methodToCallbackMapping[e]])})),u(this.clientSuppliedCallbacks,a),this.registerCallbacks(!0)}if(i&&null!=i.loadIntegration&&(this.loadIntegration=!!i.loadIntegration),i&&"boolean"==typeof i.bufferDataPlaneEventsUntilReady&&(this.bufferDataPlaneEventsUntilReady=!0===i.bufferDataPlaneEventsUntilReady,this.bufferDataPlaneEventsUntilReady&&this.preProcessQueue.init(this.options,this.queueEventForDataPlane.bind(this))),i&&"number"==typeof i.dataPlaneEventsBufferTimeout&&(this.dataPlaneEventsBufferTimeout=i.dataPlaneEventsBufferTimeout),i&&void 0!==i.lockIntegrationsVersion&&(this.lockIntegrationsVersion=!0===i.lockIntegrationsVersion),this.initializeUser(i?i.anonymousIdOptions:void 0),this.setInitialPageProperties(),this.destSDKBaseURL=function(e,t,n){var r="";if(n){if(!(r=mi(n))){var i="CDN base URL for integrations is not valid";throw vi({message:"[Analytics] load:: ".concat(i)}),Error("Failed to load Rudder SDK: ".concat(i))}return r}var o=Ti().sdkURL;return r=o?o.split("/").slice(0,-1).concat(Zr).join("/"):ei,t&&(r=r.replace($r,e)),r}(this.version,this.lockIntegrationsVersion,i&&i.destSDKBaseURL),i&&i.getSourceConfig)if("function"!=typeof i.getSourceConfig)vi(new Error('option "getSourceConfig" must be a function'));else{var c=i.getSourceConfig();c instanceof Promise?c.then((function(e){return o.processResponse(200,e)})).catch(vi):this.processResponse(200,c)}else{var l=function(e){return Jr.concat(Jr.includes("?")?"&":"?").concat(e?"writeKey=".concat(e):"")}(e);i&&i.configUrl&&(l=function(e,t){var n=e;-1===n.indexOf("sourceConfig")&&(n="".concat(mi(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)}(i.configUrl,l));try{!function(e,t,n,r){var i=r.bind(e),o=new XMLHttpRequest;o.open("GET",t,!0),o.setRequestHeader("Authorization","Basic ".concat(btoa("".concat(n,":")))),o.onload=function(){var e=o.status;200==e?i(200,o.responseText):(vi(new Error("".concat(li," ").concat(e," for url: ").concat(t))),i(e))},o.send()}(this,l,e,this.processResponse)}catch(e){vi(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=S(n);if(this.arePolyfillsRequired(r)){var i="polyfill";za(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 o=this,s=setInterval((function(){!window.hasOwnProperty(i)&&null===document.getElementById(i)||"undefined"==typeof Promise||(clearInterval(s),o.loadAfterPolyfill(e,t,r))}),100);setTimeout((function(){clearInterval(s)}),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(){za("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}(),Iu=new mu;g(Iu),window.addEventListener("error",(function(e){vi(e,void 0,Iu)}),!0),Iu.initializeCallbacks(),Iu.registerCallbacks(!1);var ku,bu="load",Au=window.rudderanalytics,Eu=Array.isArray(Au);if(Eu)for(var Cu=0;Cu0&&(ku.shift(),Iu.load.apply(Iu,c(ku)));var Su=Iu.ready.bind(Iu),Tu=Iu.identify.bind(Iu),wu=Iu.page.bind(Iu),Ou=Iu.track.bind(Iu),_u=Iu.alias.bind(Iu),Ru=Iu.group.bind(Iu),Pu=Iu.reset.bind(Iu),Du=Iu.load.bind(Iu),Lu=Iu.initialized=!0,xu=Iu.getUserId.bind(Iu),Mu=Iu.getSessionId.bind(Iu),Bu=Iu.getUserTraits.bind(Iu),Nu=Iu.getAnonymousId.bind(Iu),Fu=Iu.setAnonymousId.bind(Iu),ju=Iu.getGroupId.bind(Iu),Uu=Iu.getGroupTraits.bind(Iu),Gu=Iu.startSession.bind(Iu),Ku=Iu.endSession.bind(Iu),Hu=Iu.setAuthToken.bind(Iu);return e.alias=_u,e.endSession=Ku,e.getAnonymousId=Nu,e.getGroupId=ju,e.getGroupTraits=Uu,e.getSessionId=Mu,e.getUserId=xu,e.getUserTraits=Bu,e.group=Ru,e.identify=Tu,e.initialized=Lu,e.load=Du,e.page=wu,e.ready=Su,e.reset=Pu,e.setAnonymousId=Fu,e.setAuthToken=Hu,e.startSession=Gu,e.track=Ou,Object.defineProperty(e,"__esModule",{value:!0}),e}({}); -//# sourceMappingURL=rudder-analytics.min.js.map diff --git a/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js b/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js index d33276d2e8..fedecf65c6 100644 --- a/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js +++ b/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js @@ -98,11 +98,11 @@ class Mixpanel { isLoaded() { window.mixpanel.register({ mp_lib: 'Rudderstack: web' }); - return !!window?.mixpanel?.__loaded; + return !!window.mixpanel?.__loaded; } isReady() { - return !!window?.mixpanel?.__loaded; + return !!window.mixpanel?.__loaded; } /** From 31ad6e123cbf524e1447109454ffa5c1a0102585 Mon Sep 17 00:00:00 2001 From: sandeepdigumarty Date: Tue, 2 Apr 2024 16:54:25 +0530 Subject: [PATCH 3/5] fix: updated isLoaded and isReady conditions for mixpanel --- .../integrations/Mixpanel/browser.test.js | 32 ++++++++++++++++++- .../src/integrations/Mixpanel/browser.js | 10 ++++-- 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js b/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js index 5e86a90312..885d797728 100644 --- a/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js +++ b/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js @@ -2,7 +2,7 @@ import { Mixpanel } from '../../../src/integrations/Mixpanel'; beforeEach(() => { - window.mixpanel = {}; + window.mixpanel = []; // Add a dummy script as it is required by the init script const scriptElement = document.createElement('script'); @@ -27,6 +27,7 @@ describe('Init tests', () => { cross_subdomain_cookie: false, secure_cookie: false, persistence: 'cookie', + loaded: expect.any(Function), }); }); @@ -40,6 +41,7 @@ describe('Init tests', () => { cross_subdomain_cookie: false, secure_cookie: false, persistence: 'cookie', + loaded: expect.any(Function), }); }); @@ -54,6 +56,7 @@ describe('Init tests', () => { secure_cookie: false, persistence: 'localStorage', persistence_name: 'abc', + loaded: expect.any(Function), }); }); @@ -67,6 +70,33 @@ describe('Init tests', () => { cross_subdomain_cookie: false, secure_cookie: false, disable_persistence: true, + loaded: expect.any(Function), + }); + }); +}); + +describe('isLoaded and isReady tests', () => { + let mixpanel; + + const loadSDK = () => { + setTimeout(() => { + mixpanel.isNativeSDKLoaded = true; // Change to true after 5 seconds + }, 5000); // 5 seconds + }; + + test('isLoaded test', () => { + mixpanel = new Mixpanel({ persistence: 'none' }, { logLevel: 'debug' }); + + loadSDK(); // Call loadSDK to set isNativeSDKLoaded after 5 seconds + + return new Promise(resolve => { + const interval = setInterval(() => { + if (mixpanel.isLoaded()) { + clearInterval(interval); + expect(mixpanel.isLoaded()).toBe(true); + resolve(); // Resolve the promise once the expectation is met + } + }, 1000); }); }); }); diff --git a/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js b/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js index fedecf65c6..82607c4aeb 100644 --- a/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js +++ b/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js @@ -66,6 +66,7 @@ class Mixpanel { this.ignoreDnt = config.ignoreDnt || false; this.useUserDefinedPageEventName = config.useUserDefinedPageEventName || false; this.userDefinedPageEventTemplate = config.userDefinedPageEventTemplate; + this.isNativeSDKLoaded = false; } init() { @@ -93,16 +94,19 @@ class Mixpanel { if (this.ignoreDnt) { options.ignore_dnt = true; } + options.loaded = () => { + this.isNativeSDKLoaded = true; + }; window.mixpanel.init(this.token, options); + window.mixpanel.register({ mp_lib: 'Rudderstack: web' }); } isLoaded() { - window.mixpanel.register({ mp_lib: 'Rudderstack: web' }); - return !!window.mixpanel?.__loaded; + return this.isNativeSDKLoaded; } isReady() { - return !!window.mixpanel?.__loaded; + return this.isLoaded(); } /** From 7385891a864583697f3e56e4933c0a505e909c83 Mon Sep 17 00:00:00 2001 From: sandeepdigumarty Date: Tue, 2 Apr 2024 17:00:17 +0530 Subject: [PATCH 4/5] fix: added extra tests --- .../integrations/Mixpanel/browser.test.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js b/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js index 885d797728..6e242e3b98 100644 --- a/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js +++ b/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js @@ -99,6 +99,22 @@ describe('isLoaded and isReady tests', () => { }, 1000); }); }); + + test('isReady test', () => { + mixpanel = new Mixpanel({ persistence: 'none' }, { logLevel: 'debug' }); + + loadSDK(); // Call loadSDK to set isNativeSDKLoaded after 5 seconds + + return new Promise(resolve => { + const interval = setInterval(() => { + if (mixpanel.isReady()) { + clearInterval(interval); + expect(mixpanel.isReady()).toBe(true); + resolve(); // Resolve the promise once the expectation is met + } + }, 1000); + }); + }); }); describe('Page tests', () => { From bc6be4f062704ef2450cd7a46c3d173c8a49b8cd Mon Sep 17 00:00:00 2001 From: sandeepdigumarty Date: Tue, 2 Apr 2024 17:36:01 +0530 Subject: [PATCH 5/5] fix: updated tests --- .../__tests__/integrations/Mixpanel/browser.test.js | 8 +++++++- .../src/integrations/Mixpanel/browser.js | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js b/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js index 6e242e3b98..f086279b08 100644 --- a/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js +++ b/packages/analytics-js-integrations/__tests__/integrations/Mixpanel/browser.test.js @@ -2,7 +2,7 @@ import { Mixpanel } from '../../../src/integrations/Mixpanel'; beforeEach(() => { - window.mixpanel = []; + window.mixpanel = {}; // Add a dummy script as it is required by the init script const scriptElement = document.createElement('script'); @@ -18,6 +18,9 @@ afterEach(() => { }); describe('Init tests', () => { + beforeEach(() => { + window.mixpanel = []; + }); let mixpanel; test('Persistence type is missing', () => { @@ -118,6 +121,9 @@ describe('isLoaded and isReady tests', () => { }); describe('Page tests', () => { + beforeEach(() => { + window.mixpanel = []; + }); let mixpanel; test('should return a custom generated event name when useUserDefinedPageEventName setting is enabled and event template is provided', () => { mixpanel = new Mixpanel( diff --git a/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js b/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js index 82607c4aeb..24d918c0fc 100644 --- a/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js +++ b/packages/analytics-js-integrations/src/integrations/Mixpanel/browser.js @@ -1,4 +1,4 @@ -/* eslint-disable class-methods-use-this,no-underscore-dangle */ +/* eslint-disable class-methods-use-this */ import get from 'get-value'; import { NAME,